tuikit-atomicx-vue3 4.5.0 → 4.5.1

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.
Files changed (109) hide show
  1. package/dist/{PopoverTrigger-L8abAry7.js → PopoverPortal-DghpKKm8.js} +91 -136
  2. package/dist/PopoverTrigger-BajjNkGO.js +54 -0
  3. package/dist/{PopperContent-XdhqL8Y2.js → PopperContent-SLoFuK7k.js} +6 -6
  4. package/dist/{Teleport-CSEuZbpM.js → Teleport-DFrneqLM.js} +4 -4
  5. package/dist/baseComp/Modal/Modal.js +3 -3
  6. package/dist/components/BarrageInput/EmojiPicker/EmojiPicker.js +10 -9
  7. package/dist/components/BarrageInput/TextEditor/CharacterCountExtension.js +1 -1
  8. package/dist/components/BarrageInput/TextEditor/EditorCore.js +16 -15
  9. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewAbstract.js +62 -40
  10. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTimestamp.js +29 -27
  11. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTitle.js +27 -23
  12. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewTitle.vue.d.ts +1 -1
  13. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUI.js +67 -65
  14. package/dist/components/ConversationList/ConversationPreview/ConversationPreviewUnread.js +32 -30
  15. package/dist/components/ConversationList/ConversationPreview/utils.d.ts +2 -2
  16. package/dist/components/ConversationList/ConversationPreview/utils.js +81 -35
  17. package/dist/components/ConversationList/i18n/en-US.d.ts +10 -1
  18. package/dist/components/ConversationList/i18n/en-US.js +11 -2
  19. package/dist/components/ConversationList/i18n/zh-CN.d.ts +10 -1
  20. package/dist/components/ConversationList/i18n/zh-CN.js +11 -2
  21. package/dist/components/LiveScenePanel/index.js +10 -9
  22. package/dist/components/MessageInput/AttachmentPicker/index.js +10 -9
  23. package/dist/components/MessageInput/EmojiPicker/EmojiPicker.js +17 -16
  24. package/dist/components/MessageInput/QuotedMessagePreview/index.js +35 -35
  25. package/dist/components/MessageInput/TextEditor/EditorCore.d.ts +13 -12
  26. package/dist/components/MessageInput/TextEditor/EditorCore.js +54 -89
  27. package/dist/components/MessageInput/TextEditor/extensions/MentionSuggestion.js +229 -0
  28. package/dist/components/MessageInput/TextEditor/extensions/MentionSuggestion.vue.d.ts +15 -0
  29. package/dist/components/MessageInput/TextEditor/extensions/characterCountExtension.js +1 -1
  30. package/dist/components/MessageInput/TextEditor/extensions/emojiExtension.d.ts +1 -0
  31. package/dist/components/MessageInput/TextEditor/extensions/emojiExtension.js +22 -0
  32. package/dist/components/MessageInput/TextEditor/extensions/enterKeyExtension.d.ts +3 -0
  33. package/dist/components/MessageInput/TextEditor/extensions/enterKeyExtension.js +15 -0
  34. package/dist/components/MessageInput/TextEditor/extensions/imageExtension.js +2 -2
  35. package/dist/components/MessageInput/TextEditor/extensions/index.d.ts +8 -0
  36. package/dist/components/MessageInput/TextEditor/extensions/index.js +12 -0
  37. package/dist/components/MessageInput/TextEditor/extensions/mentionExtension.d.ts +5 -0
  38. package/dist/components/MessageInput/TextEditor/extensions/mentionExtension.js +330 -0
  39. package/dist/components/MessageInput/TextEditor/index.js +62 -62
  40. package/dist/components/MessageInput/i18n/en-US.d.ts +3 -0
  41. package/dist/components/MessageInput/i18n/en-US.js +4 -1
  42. package/dist/components/MessageInput/i18n/index.d.ts +6 -0
  43. package/dist/components/MessageInput/i18n/zh-CN.d.ts +3 -0
  44. package/dist/components/MessageInput/i18n/zh-CN.js +4 -1
  45. package/dist/components/MessageList/Message/ImageMessage/ImageMessage.js +119 -89
  46. package/dist/components/MessageList/Message/ImageMessage/ImagePreview.js +142 -0
  47. package/dist/components/MessageList/Message/ImageMessage/ImagePreview.vue.d.ts +20 -0
  48. package/dist/components/MessageList/Message/Message.vue.d.ts +8 -0
  49. package/dist/components/MessageList/Message/MessageLayout/MessageActionDropdown/MessageActionDropdown.js +3 -3
  50. package/dist/components/MessageList/Message/MessageLayout/MessageLayout.js +69 -58
  51. package/dist/components/MessageList/Message/MessageLayout/MessageLayout.vue.d.ts +8 -0
  52. package/dist/components/MessageList/Message/index.js +8 -4
  53. package/dist/components/MessageList/MessageList.js +98 -90
  54. package/dist/components/MessageList/MessageList.vue.d.ts +1 -1
  55. package/dist/components/MessageList/index.d.ts +21 -3
  56. package/dist/components/Search/SearchResults/SearchResultsItem/Message/Message.js +6 -6
  57. package/dist/components/Search/SearchResults/SearchResultsItem/Message/Message.vue.d.ts +1 -1
  58. package/dist/index-BvFYOUyz.js +2936 -0
  59. package/dist/{index-Do-2CngU.js → index-C8Jw_xE4.js} +1621 -1731
  60. package/dist/{index-7vNB_Vx8.js → index-CiYL_XsE.js} +1 -1
  61. package/dist/index-CzCDLp99.js +2174 -0
  62. package/dist/index.d.ts +1 -1
  63. package/dist/index.js +103 -103
  64. package/dist/states/MessageActionState/MessageActionState.js +83 -223
  65. package/dist/states/MessageInputState/MessageInputState.js +115 -83
  66. package/dist/states/MessageInputState/type.d.ts +36 -10
  67. package/dist/states/MessageInputState/utils.d.ts +1 -5
  68. package/dist/states/MessageListState/MessageListState.d.ts +1 -1
  69. package/dist/styles/index.css +1 -1
  70. package/dist/{chat/index.d.ts → subEntry/chat/chat.d.ts} +2112 -2087
  71. package/dist/subEntry/chat/chat.js +89 -0
  72. package/dist/subEntry/chat/index.d.ts +11 -0
  73. package/dist/subEntry/chat/index.js +81 -0
  74. package/dist/{chat → subEntry/chat}/server.js +4 -4
  75. package/dist/{useId-CtirfF0W.js → useId-D5WE76CM.js} +1 -1
  76. package/dist/{utils-DaB7eSu5.js → utils-CttDpxqz.js} +1 -1
  77. package/package.json +8 -6
  78. package/src/components/ConversationList/ConversationPreview/ConversationPreview.scss +8 -0
  79. package/src/components/ConversationList/ConversationPreview/ConversationPreviewAbstract.vue +32 -1
  80. package/src/components/ConversationList/ConversationPreview/ConversationPreviewTitle.vue +3 -2
  81. package/src/components/ConversationList/ConversationPreview/utils.ts +98 -28
  82. package/src/components/ConversationList/i18n/en-US.ts +10 -1
  83. package/src/components/ConversationList/i18n/zh-CN.ts +10 -1
  84. package/src/components/LiveScenePanel/index.vue +1 -0
  85. package/src/components/MessageInput/QuotedMessagePreview/QuotedMessagePreview.vue +19 -22
  86. package/src/components/MessageInput/TextEditor/Editor.scss +25 -0
  87. package/src/components/MessageInput/TextEditor/EditorCore.ts +79 -99
  88. package/src/components/MessageInput/TextEditor/TextEditor.vue +64 -68
  89. package/src/components/MessageInput/TextEditor/extensions/MentionSuggestion.vue +449 -0
  90. package/src/components/MessageInput/TextEditor/extensions/emojiExtension.ts +22 -0
  91. package/src/components/MessageInput/TextEditor/extensions/enterKeyExtension.ts +22 -0
  92. package/src/components/MessageInput/TextEditor/extensions/index.ts +8 -0
  93. package/src/components/MessageInput/TextEditor/extensions/mentionExtension.ts +87 -0
  94. package/src/components/MessageInput/i18n/en-US.ts +3 -0
  95. package/src/components/MessageInput/i18n/zh-CN.ts +3 -0
  96. package/src/components/MessageList/Message/ImageMessage/ImageMessage.vue +49 -0
  97. package/src/components/MessageList/Message/ImageMessage/ImagePreview.vue +344 -0
  98. package/src/components/MessageList/Message/Message.vue +6 -0
  99. package/src/components/MessageList/Message/MessageLayout/MessageLayout.vue +8 -1
  100. package/src/components/MessageList/MessageList.vue +36 -14
  101. package/src/components/Search/SearchResults/SearchResultsItem/Message/Message.vue +30 -31
  102. package/src/index.ts +1 -1
  103. package/src/{chat/index.ts → subEntry/chat/chat.ts} +25 -18
  104. package/src/subEntry/chat/index.ts +13 -0
  105. package/src/{chat → subEntry/chat}/server.ts +3 -3
  106. package/dist/chat/index.js +0 -59
  107. package/dist/index-ZILx4LYk.js +0 -4826
  108. package/dist/states/SearchState.d.ts +0 -314
  109. /package/dist/{chat → subEntry/chat}/server.d.ts +0 -0
@@ -1,4826 +0,0 @@
1
- import { E as Ge, P as U, a as J, i as Jr, D as tr, b as nr, S as oe, w as Zr, c as Qr, F as Me, d as ln, T as _, e as Nt, f as ft, s as ei, g as Tn, h as ti, j as ni, k as ri, l as ii, o as oi, A as si, p as ai, q as li, r as ci, t as ui, u as di, v as pi, x as fi, y as rr, z as hi, B as mi, C as vi, G as gi, H as yi, I as bi, J as wi, K as ir, L as xi, M as ki, O as Ut, R as Mi, Q as Ti, N as se, U as at, m as K, V as Vt, W as We, X as ze, Y as tn, Z as Oi, _ as Ci, $ as Ei, a0 as Ai, a1 as Si, n as Ii, a2 as Li, a3 as or, a4 as Pi, a5 as sr, a6 as Di, a7 as Ni, a8 as Ri } from "./index-Do-2CngU.js";
2
- import { markRaw as $i, customRef as Bi, defineComponent as ht, ref as cn, onMounted as ar, onBeforeUnmount as un, h as mt, getCurrentInstance as Hi, watchEffect as ji, nextTick as _i, unref as Fi } from "vue";
3
- const Gl = Ge.create({
4
- name: "placeholder",
5
- addOptions() {
6
- return {
7
- emptyEditorClass: "is-editor-empty",
8
- emptyNodeClass: "is-empty",
9
- placeholder: "Write something …",
10
- showOnlyWhenEditable: !0,
11
- showOnlyCurrent: !0,
12
- includeChildren: !1
13
- };
14
- },
15
- addProseMirrorPlugins() {
16
- return [
17
- new U({
18
- key: new J("placeholder"),
19
- props: {
20
- decorations: ({ doc: t, selection: e }) => {
21
- const n = this.editor.isEditable || !this.options.showOnlyWhenEditable, { anchor: r } = e, i = [];
22
- if (!n)
23
- return null;
24
- const o = this.editor.isEmpty;
25
- return t.descendants((s, a) => {
26
- const l = r >= a && r <= a + s.nodeSize, c = !s.isLeaf && Jr(s);
27
- if ((l || !this.options.showOnlyCurrent) && c) {
28
- const u = [this.options.emptyNodeClass];
29
- o && u.push(this.options.emptyEditorClass);
30
- const p = tr.node(a, a + s.nodeSize, {
31
- class: u.join(" "),
32
- "data-placeholder": typeof this.options.placeholder == "function" ? this.options.placeholder({
33
- editor: this.editor,
34
- node: s,
35
- pos: a,
36
- hasAnchor: l
37
- }) : this.options.placeholder
38
- });
39
- i.push(p);
40
- }
41
- return this.options.includeChildren;
42
- }), nr.create(t, i);
43
- }
44
- }
45
- })
46
- ];
47
- }
48
- });
49
- function lr(t) {
50
- const { state: e, transaction: n } = t;
51
- let { selection: r } = n, { doc: i } = n, { storedMarks: o } = n;
52
- return {
53
- ...e,
54
- apply: e.apply.bind(e),
55
- applyTransaction: e.applyTransaction.bind(e),
56
- plugins: e.plugins,
57
- schema: e.schema,
58
- reconfigure: e.reconfigure.bind(e),
59
- toJSON: e.toJSON.bind(e),
60
- get storedMarks() {
61
- return o;
62
- },
63
- get selection() {
64
- return r;
65
- },
66
- get doc() {
67
- return i;
68
- },
69
- get tr() {
70
- return r = n.selection, i = n.doc, o = n.storedMarks, n;
71
- }
72
- };
73
- }
74
- class Vi {
75
- constructor(e) {
76
- this.editor = e.editor, this.rawCommands = this.editor.extensionManager.commands, this.customState = e.state;
77
- }
78
- get hasCustomState() {
79
- return !!this.customState;
80
- }
81
- get state() {
82
- return this.customState || this.editor.state;
83
- }
84
- get commands() {
85
- const { rawCommands: e, editor: n, state: r } = this, { view: i } = n, { tr: o } = r, s = this.buildProps(o);
86
- return Object.fromEntries(Object.entries(e).map(([a, l]) => [a, (...u) => {
87
- const p = l(...u)(s);
88
- return !o.getMeta("preventDispatch") && !this.hasCustomState && i.dispatch(o), p;
89
- }]));
90
- }
91
- get chain() {
92
- return () => this.createChain();
93
- }
94
- get can() {
95
- return () => this.createCan();
96
- }
97
- createChain(e, n = !0) {
98
- const { rawCommands: r, editor: i, state: o } = this, { view: s } = i, a = [], l = !!e, c = e || o.tr, u = () => (!l && n && !c.getMeta("preventDispatch") && !this.hasCustomState && s.dispatch(c), a.every((f) => f === !0)), p = {
99
- ...Object.fromEntries(Object.entries(r).map(([f, h]) => [f, (...v) => {
100
- const g = this.buildProps(c, n), w = h(...v)(g);
101
- return a.push(w), p;
102
- }])),
103
- run: u
104
- };
105
- return p;
106
- }
107
- createCan(e) {
108
- const { rawCommands: n, state: r } = this, i = !1, o = e || r.tr, s = this.buildProps(o, i);
109
- return {
110
- ...Object.fromEntries(Object.entries(n).map(([l, c]) => [l, (...u) => c(...u)({ ...s, dispatch: void 0 })])),
111
- chain: () => this.createChain(o, i)
112
- };
113
- }
114
- buildProps(e, n = !0) {
115
- const { rawCommands: r, editor: i, state: o } = this, { view: s } = i, a = {
116
- tr: e,
117
- editor: i,
118
- view: s,
119
- state: lr({
120
- state: o,
121
- transaction: e
122
- }),
123
- dispatch: n ? () => {
124
- } : void 0,
125
- chain: () => this.createChain(e, n),
126
- can: () => this.createCan(e),
127
- get commands() {
128
- return Object.fromEntries(Object.entries(r).map(([l, c]) => [l, (...u) => c(...u)(a)]));
129
- }
130
- };
131
- return a;
132
- }
133
- }
134
- function Le(t, e, n) {
135
- return t.config[e] === void 0 && t.parent ? Le(t.parent, e, n) : typeof t.config[e] == "function" ? t.config[e].bind({
136
- ...n,
137
- parent: t.parent ? Le(t.parent, e, n) : null
138
- }) : t.config[e];
139
- }
140
- function Wi(t) {
141
- const e = t.filter((i) => i.type === "extension"), n = t.filter((i) => i.type === "node"), r = t.filter((i) => i.type === "mark");
142
- return {
143
- baseExtensions: e,
144
- nodeExtensions: n,
145
- markExtensions: r
146
- };
147
- }
148
- function F(t, e) {
149
- if (typeof t == "string") {
150
- if (!e.nodes[t])
151
- throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);
152
- return e.nodes[t];
153
- }
154
- return t;
155
- }
156
- function zi(t) {
157
- return typeof t == "function";
158
- }
159
- function rt(t, e = void 0, ...n) {
160
- return zi(t) ? e ? t.bind(e)(...n) : t(...n) : t;
161
- }
162
- function Ki(t) {
163
- return Object.prototype.toString.call(t) === "[object RegExp]";
164
- }
165
- function Ui(t) {
166
- return Object.prototype.toString.call(t).slice(8, -1);
167
- }
168
- function St(t) {
169
- return Ui(t) !== "Object" ? !1 : t.constructor === Object && Object.getPrototypeOf(t) === Object.prototype;
170
- }
171
- function cr(t, e) {
172
- const n = { ...t };
173
- return St(t) && St(e) && Object.keys(e).forEach((r) => {
174
- St(e[r]) && St(t[r]) ? n[r] = cr(t[r], e[r]) : n[r] = e[r];
175
- }), n;
176
- }
177
- class ee {
178
- constructor(e = {}) {
179
- this.type = "extension", this.name = "extension", this.parent = null, this.child = null, this.config = {
180
- name: this.name,
181
- defaultOptions: {}
182
- }, this.config = {
183
- ...this.config,
184
- ...e
185
- }, this.name = this.config.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`), this.options = this.config.defaultOptions, this.config.addOptions && (this.options = rt(Le(this, "addOptions", {
186
- name: this.name
187
- }))), this.storage = rt(Le(this, "addStorage", {
188
- name: this.name,
189
- options: this.options
190
- })) || {};
191
- }
192
- static create(e = {}) {
193
- return new ee(e);
194
- }
195
- configure(e = {}) {
196
- const n = this.extend({
197
- ...this.config,
198
- addOptions: () => cr(this.options, e)
199
- });
200
- return n.name = this.name, n.parent = this.parent, n;
201
- }
202
- extend(e = {}) {
203
- const n = new ee({ ...this.config, ...e });
204
- return n.parent = this, this.child = n, n.name = e.name ? e.name : n.parent.name, e.defaultOptions && Object.keys(e.defaultOptions).length > 0 && console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`), n.options = rt(Le(n, "addOptions", {
205
- name: n.name
206
- })), n.storage = rt(Le(n, "addStorage", {
207
- name: n.name,
208
- options: n.options
209
- })), n;
210
- }
211
- }
212
- function qi(t, e, n) {
213
- const { from: r, to: i } = e, { blockSeparator: o = `
214
-
215
- `, textSerializers: s = {} } = n || {};
216
- let a = "";
217
- return t.nodesBetween(r, i, (l, c, u, p) => {
218
- var f;
219
- l.isBlock && c > r && (a += o);
220
- const h = s == null ? void 0 : s[l.type.name];
221
- if (h)
222
- return u && (a += h({
223
- node: l,
224
- pos: c,
225
- parent: u,
226
- index: p,
227
- range: e
228
- })), !1;
229
- l.isText && (a += (f = l == null ? void 0 : l.text) === null || f === void 0 ? void 0 : f.slice(Math.max(r, c) - c, i - c));
230
- }), a;
231
- }
232
- function Yi(t) {
233
- return Object.fromEntries(Object.entries(t.nodes).filter(([, e]) => e.spec.toText).map(([e, n]) => [e, n.spec.toText]));
234
- }
235
- ee.create({
236
- name: "clipboardTextSerializer",
237
- addOptions() {
238
- return {
239
- blockSeparator: void 0
240
- };
241
- },
242
- addProseMirrorPlugins() {
243
- return [
244
- new U({
245
- key: new J("clipboardTextSerializer"),
246
- props: {
247
- clipboardTextSerializer: () => {
248
- const { editor: t } = this, { state: e, schema: n } = t, { doc: r, selection: i } = e, { ranges: o } = i, s = Math.min(...o.map((u) => u.$from.pos)), a = Math.max(...o.map((u) => u.$to.pos)), l = Yi(n);
249
- return qi(r, { from: s, to: a }, {
250
- ...this.options.blockSeparator !== void 0 ? { blockSeparator: this.options.blockSeparator } : {},
251
- textSerializers: l
252
- });
253
- }
254
- }
255
- })
256
- ];
257
- }
258
- });
259
- const Gi = () => ({ editor: t, view: e }) => (requestAnimationFrame(() => {
260
- var n;
261
- t.isDestroyed || (e.dom.blur(), (n = window == null ? void 0 : window.getSelection()) === null || n === void 0 || n.removeAllRanges());
262
- }), !0), Xi = (t = !1) => ({ commands: e }) => e.setContent("", t), Ji = () => ({ state: t, tr: e, dispatch: n }) => {
263
- const { selection: r } = e, { ranges: i } = r;
264
- return n && i.forEach(({ $from: o, $to: s }) => {
265
- t.doc.nodesBetween(o.pos, s.pos, (a, l) => {
266
- if (a.type.isText)
267
- return;
268
- const { doc: c, mapping: u } = e, p = c.resolve(u.map(l)), f = c.resolve(u.map(l + a.nodeSize)), h = p.blockRange(f);
269
- if (!h)
270
- return;
271
- const y = wi(h);
272
- if (a.type.isTextblock) {
273
- const { defaultType: v } = p.parent.contentMatchAt(p.index());
274
- e.setNodeMarkup(h.start, v);
275
- }
276
- (y || y === 0) && e.lift(h, y);
277
- });
278
- }), !0;
279
- }, Zi = (t) => (e) => t(e), Qi = () => ({ state: t, dispatch: e }) => bi(t, e), eo = (t, e) => ({ editor: n, tr: r }) => {
280
- const { state: i } = n, o = i.doc.slice(t.from, t.to);
281
- r.deleteRange(t.from, t.to);
282
- const s = r.mapping.map(e);
283
- return r.insert(s, o.content), r.setSelection(new _(r.doc.resolve(Math.max(s - 1, 0)))), !0;
284
- }, to = () => ({ tr: t, dispatch: e }) => {
285
- const { selection: n } = t, r = n.$anchor.node();
286
- if (r.content.size > 0)
287
- return !1;
288
- const i = t.selection.$anchor;
289
- for (let o = i.depth; o > 0; o -= 1)
290
- if (i.node(o).type === r.type) {
291
- if (e) {
292
- const a = i.before(o), l = i.after(o);
293
- t.delete(a, l).scrollIntoView();
294
- }
295
- return !0;
296
- }
297
- return !1;
298
- }, no = (t) => ({ tr: e, state: n, dispatch: r }) => {
299
- const i = F(t, n.schema), o = e.selection.$anchor;
300
- for (let s = o.depth; s > 0; s -= 1)
301
- if (o.node(s).type === i) {
302
- if (r) {
303
- const l = o.before(s), c = o.after(s);
304
- e.delete(l, c).scrollIntoView();
305
- }
306
- return !0;
307
- }
308
- return !1;
309
- }, ro = (t) => ({ tr: e, dispatch: n }) => {
310
- const { from: r, to: i } = t;
311
- return n && e.delete(r, i), !0;
312
- }, io = () => ({ state: t, dispatch: e }) => yi(t, e), oo = () => ({ commands: t }) => t.keyboardShortcut("Enter"), so = () => ({ state: t, dispatch: e }) => gi(t, e);
313
- function Ht(t, e, n = { strict: !0 }) {
314
- const r = Object.keys(e);
315
- return r.length ? r.every((i) => n.strict ? e[i] === t[i] : Ki(e[i]) ? e[i].test(t[i]) : e[i] === t[i]) : !0;
316
- }
317
- function ur(t, e, n = {}) {
318
- return t.find((r) => r.type === e && Ht(
319
- // Only check equality for the attributes that are provided
320
- Object.fromEntries(Object.keys(n).map((i) => [i, r.attrs[i]])),
321
- n
322
- ));
323
- }
324
- function On(t, e, n = {}) {
325
- return !!ur(t, e, n);
326
- }
327
- function dr(t, e, n) {
328
- var r;
329
- if (!t || !e)
330
- return;
331
- let i = t.parent.childAfter(t.parentOffset);
332
- if ((!i.node || !i.node.marks.some((u) => u.type === e)) && (i = t.parent.childBefore(t.parentOffset)), !i.node || !i.node.marks.some((u) => u.type === e) || (n = n || ((r = i.node.marks[0]) === null || r === void 0 ? void 0 : r.attrs), !ur([...i.node.marks], e, n)))
333
- return;
334
- let s = i.index, a = t.start() + i.offset, l = s + 1, c = a + i.node.nodeSize;
335
- for (; s > 0 && On([...t.parent.child(s - 1).marks], e, n); )
336
- s -= 1, a -= t.parent.child(s).nodeSize;
337
- for (; l < t.parent.childCount && On([...t.parent.child(l).marks], e, n); )
338
- c += t.parent.child(l).nodeSize, l += 1;
339
- return {
340
- from: a,
341
- to: c
342
- };
343
- }
344
- function Te(t, e) {
345
- if (typeof t == "string") {
346
- if (!e.marks[t])
347
- throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);
348
- return e.marks[t];
349
- }
350
- return t;
351
- }
352
- const ao = (t, e = {}) => ({ tr: n, state: r, dispatch: i }) => {
353
- const o = Te(t, r.schema), { doc: s, selection: a } = n, { $from: l, from: c, to: u } = a;
354
- if (i) {
355
- const p = dr(l, o, e);
356
- if (p && p.from <= c && p.to >= u) {
357
- const f = _.create(s, p.from, p.to);
358
- n.setSelection(f);
359
- }
360
- }
361
- return !0;
362
- }, lo = (t) => (e) => {
363
- const n = typeof t == "function" ? t(e) : t;
364
- for (let r = 0; r < n.length; r += 1)
365
- if (n[r](e))
366
- return !0;
367
- return !1;
368
- };
369
- function pr(t) {
370
- return t instanceof _;
371
- }
372
- function Pe(t = 0, e = 0, n = 0) {
373
- return Math.min(Math.max(t, e), n);
374
- }
375
- function co(t, e = null) {
376
- if (!e)
377
- return null;
378
- const n = oe.atStart(t), r = oe.atEnd(t);
379
- if (e === "start" || e === !0)
380
- return n;
381
- if (e === "end")
382
- return r;
383
- const i = n.from, o = r.to;
384
- return e === "all" ? _.create(t, Pe(0, i, o), Pe(t.content.size, i, o)) : _.create(t, Pe(e, i, o), Pe(e, i, o));
385
- }
386
- function uo() {
387
- return navigator.platform === "Android" || /android/i.test(navigator.userAgent);
388
- }
389
- function dn() {
390
- return [
391
- "iPad Simulator",
392
- "iPhone Simulator",
393
- "iPod Simulator",
394
- "iPad",
395
- "iPhone",
396
- "iPod"
397
- ].includes(navigator.platform) || navigator.userAgent.includes("Mac") && "ontouchend" in document;
398
- }
399
- const po = (t = null, e = {}) => ({ editor: n, view: r, tr: i, dispatch: o }) => {
400
- e = {
401
- scrollIntoView: !0,
402
- ...e
403
- };
404
- const s = () => {
405
- (dn() || uo()) && r.dom.focus(), requestAnimationFrame(() => {
406
- n.isDestroyed || (r.focus(), e != null && e.scrollIntoView && n.commands.scrollIntoView());
407
- });
408
- };
409
- if (r.hasFocus() && t === null || t === !1)
410
- return !0;
411
- if (o && t === null && !pr(n.state.selection))
412
- return s(), !0;
413
- const a = co(i.doc, t) || n.state.selection, l = n.state.selection.eq(a);
414
- return o && (l || i.setSelection(a), l && i.storedMarks && i.setStoredMarks(i.storedMarks), s()), !0;
415
- }, fo = (t, e) => (n) => t.every((r, i) => e(r, { ...n, index: i })), ho = (t, e) => ({ tr: n, commands: r }) => r.insertContentAt({ from: n.selection.from, to: n.selection.to }, t, e), fr = (t) => {
416
- const e = t.childNodes;
417
- for (let n = e.length - 1; n >= 0; n -= 1) {
418
- const r = e[n];
419
- r.nodeType === 3 && r.nodeValue && /^(\n\s\s|\n)$/.test(r.nodeValue) ? t.removeChild(r) : r.nodeType === 1 && fr(r);
420
- }
421
- return t;
422
- };
423
- function It(t) {
424
- const e = `<body>${t}</body>`, n = new window.DOMParser().parseFromString(e, "text/html").body;
425
- return fr(n);
426
- }
427
- function lt(t, e, n) {
428
- if (t instanceof xi || t instanceof Me)
429
- return t;
430
- n = {
431
- slice: !0,
432
- parseOptions: {},
433
- ...n
434
- };
435
- const r = typeof t == "object" && t !== null, i = typeof t == "string";
436
- if (r)
437
- try {
438
- if (Array.isArray(t) && t.length > 0)
439
- return Me.fromArray(t.map((a) => e.nodeFromJSON(a)));
440
- const s = e.nodeFromJSON(t);
441
- return n.errorOnInvalidContent && s.check(), s;
442
- } catch (o) {
443
- if (n.errorOnInvalidContent)
444
- throw new Error("[tiptap error]: Invalid JSON content", { cause: o });
445
- return console.warn("[tiptap warn]: Invalid content.", "Passed value:", t, "Error:", o), lt("", e, n);
446
- }
447
- if (i) {
448
- if (n.errorOnInvalidContent) {
449
- let s = !1, a = "";
450
- const l = new ki({
451
- topNode: e.spec.topNode,
452
- marks: e.spec.marks,
453
- // Prosemirror's schemas are executed such that: the last to execute, matches last
454
- // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle
455
- nodes: e.spec.nodes.append({
456
- __tiptap__private__unknown__catch__all__node: {
457
- content: "inline*",
458
- group: "block",
459
- parseDOM: [
460
- {
461
- tag: "*",
462
- getAttrs: (c) => (s = !0, a = typeof c == "string" ? c : c.outerHTML, null)
463
- }
464
- ]
465
- }
466
- })
467
- });
468
- if (n.slice ? Ut.fromSchema(l).parseSlice(It(t), n.parseOptions) : Ut.fromSchema(l).parse(It(t), n.parseOptions), n.errorOnInvalidContent && s)
469
- throw new Error("[tiptap error]: Invalid HTML content", { cause: new Error(`Invalid element found: ${a}`) });
470
- }
471
- const o = Ut.fromSchema(e);
472
- return n.slice ? o.parseSlice(It(t), n.parseOptions).content : o.parse(It(t), n.parseOptions);
473
- }
474
- return lt("", e, n);
475
- }
476
- function mo(t, e, n) {
477
- const r = t.steps.length - 1;
478
- if (r < e)
479
- return;
480
- const i = t.steps[r];
481
- if (!(i instanceof Mi || i instanceof Ti))
482
- return;
483
- const o = t.mapping.maps[r];
484
- let s = 0;
485
- o.forEach((a, l, c, u) => {
486
- s === 0 && (s = u);
487
- }), t.setSelection(oe.near(t.doc.resolve(s), n));
488
- }
489
- const vo = (t) => !("type" in t), go = (t, e, n) => ({ tr: r, dispatch: i, editor: o }) => {
490
- var s;
491
- if (i) {
492
- n = {
493
- parseOptions: o.options.parseOptions,
494
- updateSelection: !0,
495
- applyInputRules: !1,
496
- applyPasteRules: !1,
497
- ...n
498
- };
499
- let a;
500
- const l = (g) => {
501
- o.emit("contentError", {
502
- editor: o,
503
- error: g,
504
- disableCollaboration: () => {
505
- o.storage.collaboration && (o.storage.collaboration.isDisabled = !0);
506
- }
507
- });
508
- }, c = {
509
- preserveWhitespace: "full",
510
- ...n.parseOptions
511
- };
512
- if (!n.errorOnInvalidContent && !o.options.enableContentCheck && o.options.emitContentError)
513
- try {
514
- lt(e, o.schema, {
515
- parseOptions: c,
516
- errorOnInvalidContent: !0
517
- });
518
- } catch (g) {
519
- l(g);
520
- }
521
- try {
522
- a = lt(e, o.schema, {
523
- parseOptions: c,
524
- errorOnInvalidContent: (s = n.errorOnInvalidContent) !== null && s !== void 0 ? s : o.options.enableContentCheck
525
- });
526
- } catch (g) {
527
- return l(g), !1;
528
- }
529
- let { from: u, to: p } = typeof t == "number" ? { from: t, to: t } : { from: t.from, to: t.to }, f = !0, h = !0;
530
- if ((vo(a) ? a : [a]).forEach((g) => {
531
- g.check(), f = f ? g.isText && g.marks.length === 0 : !1, h = h ? g.isBlock : !1;
532
- }), u === p && h) {
533
- const { parent: g } = r.doc.resolve(u);
534
- g.isTextblock && !g.type.spec.code && !g.childCount && (u -= 1, p += 1);
535
- }
536
- let v;
537
- if (f) {
538
- if (Array.isArray(e))
539
- v = e.map((g) => g.text || "").join("");
540
- else if (e instanceof Me) {
541
- let g = "";
542
- e.forEach((w) => {
543
- w.text && (g += w.text);
544
- }), v = g;
545
- } else typeof e == "object" && e && e.text ? v = e.text : v = e;
546
- r.insertText(v, u, p);
547
- } else
548
- v = a, r.replaceWith(u, p, v);
549
- n.updateSelection && mo(r, r.steps.length - 1, -1), n.applyInputRules && r.setMeta("applyInputRules", { from: u, text: v }), n.applyPasteRules && r.setMeta("applyPasteRules", { from: u, text: v });
550
- }
551
- return !0;
552
- }, yo = () => ({ state: t, dispatch: e }) => di(t, e), bo = () => ({ state: t, dispatch: e }) => mi(t, e), wo = () => ({ state: t, dispatch: e }) => vi(t, e), xo = () => ({ state: t, dispatch: e }) => hi(t, e), ko = () => ({ state: t, dispatch: e, tr: n }) => {
553
- try {
554
- const r = rr(t.doc, t.selection.$from.pos, -1);
555
- return r == null ? !1 : (n.join(r, 2), e && e(n), !0);
556
- } catch {
557
- return !1;
558
- }
559
- }, Mo = () => ({ state: t, dispatch: e, tr: n }) => {
560
- try {
561
- const r = rr(t.doc, t.selection.$from.pos, 1);
562
- return r == null ? !1 : (n.join(r, 2), e && e(n), !0);
563
- } catch {
564
- return !1;
565
- }
566
- }, To = () => ({ state: t, dispatch: e }) => fi(t, e), Oo = () => ({ state: t, dispatch: e }) => pi(t, e);
567
- function hr() {
568
- return typeof navigator < "u" ? /Mac/.test(navigator.platform) : !1;
569
- }
570
- function Co(t) {
571
- const e = t.split(/-(?!$)/);
572
- let n = e[e.length - 1];
573
- n === "Space" && (n = " ");
574
- let r, i, o, s;
575
- for (let a = 0; a < e.length - 1; a += 1) {
576
- const l = e[a];
577
- if (/^(cmd|meta|m)$/i.test(l))
578
- s = !0;
579
- else if (/^a(lt)?$/i.test(l))
580
- r = !0;
581
- else if (/^(c|ctrl|control)$/i.test(l))
582
- i = !0;
583
- else if (/^s(hift)?$/i.test(l))
584
- o = !0;
585
- else if (/^mod$/i.test(l))
586
- dn() || hr() ? s = !0 : i = !0;
587
- else
588
- throw new Error(`Unrecognized modifier name: ${l}`);
589
- }
590
- return r && (n = `Alt-${n}`), i && (n = `Ctrl-${n}`), s && (n = `Meta-${n}`), o && (n = `Shift-${n}`), n;
591
- }
592
- const Eo = (t) => ({ editor: e, view: n, tr: r, dispatch: i }) => {
593
- const o = Co(t).split(/-(?!$)/), s = o.find((c) => !["Alt", "Ctrl", "Meta", "Shift"].includes(c)), a = new KeyboardEvent("keydown", {
594
- key: s === "Space" ? " " : s,
595
- altKey: o.includes("Alt"),
596
- ctrlKey: o.includes("Ctrl"),
597
- metaKey: o.includes("Meta"),
598
- shiftKey: o.includes("Shift"),
599
- bubbles: !0,
600
- cancelable: !0
601
- }), l = e.captureTransaction(() => {
602
- n.someProp("handleKeyDown", (c) => c(n, a));
603
- });
604
- return l == null || l.steps.forEach((c) => {
605
- const u = c.map(r.mapping);
606
- u && i && r.maybeStep(u);
607
- }), !0;
608
- };
609
- function pn(t, e, n = {}) {
610
- const { from: r, to: i, empty: o } = t.selection, s = e ? F(e, t.schema) : null, a = [];
611
- t.doc.nodesBetween(r, i, (p, f) => {
612
- if (p.isText)
613
- return;
614
- const h = Math.max(r, f), y = Math.min(i, f + p.nodeSize);
615
- a.push({
616
- node: p,
617
- from: h,
618
- to: y
619
- });
620
- });
621
- const l = i - r, c = a.filter((p) => s ? s.name === p.node.type.name : !0).filter((p) => Ht(p.node.attrs, n, { strict: !1 }));
622
- return o ? !!c.length : c.reduce((p, f) => p + f.to - f.from, 0) >= l;
623
- }
624
- const Ao = (t, e = {}) => ({ state: n, dispatch: r }) => {
625
- const i = F(t, n.schema);
626
- return pn(n, i, e) ? ui(n, r) : !1;
627
- }, So = () => ({ state: t, dispatch: e }) => ci(t, e), Io = (t) => ({ state: e, dispatch: n }) => {
628
- const r = F(t, e.schema);
629
- return li(r)(e, n);
630
- }, Lo = () => ({ state: t, dispatch: e }) => ai(t, e);
631
- function mr(t, e) {
632
- return e.nodes[t] ? "node" : e.marks[t] ? "mark" : null;
633
- }
634
- function Cn(t, e) {
635
- const n = typeof e == "string" ? [e] : e;
636
- return Object.keys(t).reduce((r, i) => (n.includes(i) || (r[i] = t[i]), r), {});
637
- }
638
- const Po = (t, e) => ({ tr: n, state: r, dispatch: i }) => {
639
- let o = null, s = null;
640
- const a = mr(typeof t == "string" ? t : t.name, r.schema);
641
- return a ? (a === "node" && (o = F(t, r.schema)), a === "mark" && (s = Te(t, r.schema)), i && n.selection.ranges.forEach((l) => {
642
- r.doc.nodesBetween(l.$from.pos, l.$to.pos, (c, u) => {
643
- o && o === c.type && n.setNodeMarkup(u, void 0, Cn(c.attrs, e)), s && c.marks.length && c.marks.forEach((p) => {
644
- s === p.type && n.addMark(u, u + c.nodeSize, s.create(Cn(p.attrs, e)));
645
- });
646
- });
647
- }), !0) : !1;
648
- }, Do = () => ({ tr: t, dispatch: e }) => (e && t.scrollIntoView(), !0), No = () => ({ tr: t, dispatch: e }) => {
649
- if (e) {
650
- const n = new si(t.doc);
651
- t.setSelection(n);
652
- }
653
- return !0;
654
- }, Ro = () => ({ state: t, dispatch: e }) => oi(t, e), $o = () => ({ state: t, dispatch: e }) => ii(t, e), Bo = () => ({ state: t, dispatch: e }) => ri(t, e), Ho = () => ({ state: t, dispatch: e }) => ni(t, e), jo = () => ({ state: t, dispatch: e }) => ti(t, e);
655
- function _o(t, e, n = {}, r = {}) {
656
- return lt(t, e, {
657
- slice: !1,
658
- parseOptions: n,
659
- errorOnInvalidContent: r.errorOnInvalidContent
660
- });
661
- }
662
- const Fo = (t, e = !1, n = {}, r = {}) => ({ editor: i, tr: o, dispatch: s, commands: a }) => {
663
- var l, c;
664
- const { doc: u } = o;
665
- if (n.preserveWhitespace !== "full") {
666
- const p = _o(t, i.schema, n, {
667
- errorOnInvalidContent: (l = r.errorOnInvalidContent) !== null && l !== void 0 ? l : i.options.enableContentCheck
668
- });
669
- return s && o.replaceWith(0, u.content.size, p).setMeta("preventUpdate", !e), !0;
670
- }
671
- return s && o.setMeta("preventUpdate", !e), a.insertContentAt({ from: 0, to: u.content.size }, t, {
672
- parseOptions: n,
673
- errorOnInvalidContent: (c = r.errorOnInvalidContent) !== null && c !== void 0 ? c : i.options.enableContentCheck
674
- });
675
- };
676
- function Vo(t, e) {
677
- const n = Te(e, t.schema), { from: r, to: i, empty: o } = t.selection, s = [];
678
- o ? (t.storedMarks && s.push(...t.storedMarks), s.push(...t.selection.$head.marks())) : t.doc.nodesBetween(r, i, (l) => {
679
- s.push(...l.marks);
680
- });
681
- const a = s.find((l) => l.type.name === n.name);
682
- return a ? { ...a.attrs } : {};
683
- }
684
- function Wo(t) {
685
- for (let e = 0; e < t.edgeCount; e += 1) {
686
- const { type: n } = t.edge(e);
687
- if (n.isTextblock && !n.hasRequiredAttrs())
688
- return n;
689
- }
690
- return null;
691
- }
692
- function zo(t, e) {
693
- for (let n = t.depth; n > 0; n -= 1) {
694
- const r = t.node(n);
695
- if (e(r))
696
- return {
697
- pos: n > 0 ? t.before(n) : 0,
698
- start: t.start(n),
699
- depth: n,
700
- node: r
701
- };
702
- }
703
- }
704
- function fn(t) {
705
- return (e) => zo(e.$from, t);
706
- }
707
- function Rt(t, e, n) {
708
- return Object.fromEntries(Object.entries(n).filter(([r]) => {
709
- const i = t.find((o) => o.type === e && o.name === r);
710
- return i ? i.attribute.keepOnSplit : !1;
711
- }));
712
- }
713
- function Ko(t, e, n = {}) {
714
- const { empty: r, ranges: i } = t.selection, o = e ? Te(e, t.schema) : null;
715
- if (r)
716
- return !!(t.storedMarks || t.selection.$from.marks()).filter((p) => o ? o.name === p.type.name : !0).find((p) => Ht(p.attrs, n, { strict: !1 }));
717
- let s = 0;
718
- const a = [];
719
- if (i.forEach(({ $from: p, $to: f }) => {
720
- const h = p.pos, y = f.pos;
721
- t.doc.nodesBetween(h, y, (v, g) => {
722
- if (!v.isText && !v.marks.length)
723
- return;
724
- const w = Math.max(h, g), x = Math.min(y, g + v.nodeSize), O = x - w;
725
- s += O, a.push(...v.marks.map((d) => ({
726
- mark: d,
727
- from: w,
728
- to: x
729
- })));
730
- });
731
- }), s === 0)
732
- return !1;
733
- const l = a.filter((p) => o ? o.name === p.mark.type.name : !0).filter((p) => Ht(p.mark.attrs, n, { strict: !1 })).reduce((p, f) => p + f.to - f.from, 0), c = a.filter((p) => o ? p.mark.type !== o && p.mark.type.excludes(o) : !0).reduce((p, f) => p + f.to - f.from, 0);
734
- return (l > 0 ? l + c : l) >= s;
735
- }
736
- function En(t, e) {
737
- const { nodeExtensions: n } = Wi(e), r = n.find((s) => s.name === t);
738
- if (!r)
739
- return !1;
740
- const i = {
741
- name: r.name,
742
- options: r.options,
743
- storage: r.storage
744
- }, o = rt(Le(r, "group", i));
745
- return typeof o != "string" ? !1 : o.split(" ").includes("list");
746
- }
747
- function vr(t, { checkChildren: e = !0, ignoreWhitespace: n = !1 } = {}) {
748
- var r;
749
- if (n) {
750
- if (t.type.name === "hardBreak")
751
- return !0;
752
- if (t.isText)
753
- return /^\s*$/m.test((r = t.text) !== null && r !== void 0 ? r : "");
754
- }
755
- if (t.isText)
756
- return !t.text;
757
- if (t.isAtom || t.isLeaf)
758
- return !1;
759
- if (t.content.childCount === 0)
760
- return !0;
761
- if (e) {
762
- let i = !0;
763
- return t.content.forEach((o) => {
764
- i !== !1 && (vr(o, { ignoreWhitespace: n, checkChildren: e }) || (i = !1));
765
- }), i;
766
- }
767
- return !1;
768
- }
769
- function Uo(t, e, n) {
770
- var r;
771
- const { selection: i } = e;
772
- let o = null;
773
- if (pr(i) && (o = i.$cursor), o) {
774
- const a = (r = t.storedMarks) !== null && r !== void 0 ? r : o.marks();
775
- return !!n.isInSet(a) || !a.some((l) => l.type.excludes(n));
776
- }
777
- const { ranges: s } = i;
778
- return s.some(({ $from: a, $to: l }) => {
779
- let c = a.depth === 0 ? t.doc.inlineContent && t.doc.type.allowsMarkType(n) : !1;
780
- return t.doc.nodesBetween(a.pos, l.pos, (u, p, f) => {
781
- if (c)
782
- return !1;
783
- if (u.isInline) {
784
- const h = !f || f.type.allowsMarkType(n), y = !!n.isInSet(u.marks) || !u.marks.some((v) => v.type.excludes(n));
785
- c = h && y;
786
- }
787
- return !c;
788
- }), c;
789
- });
790
- }
791
- const qo = (t, e = {}) => ({ tr: n, state: r, dispatch: i }) => {
792
- const { selection: o } = n, { empty: s, ranges: a } = o, l = Te(t, r.schema);
793
- if (i)
794
- if (s) {
795
- const c = Vo(r, l);
796
- n.addStoredMark(l.create({
797
- ...c,
798
- ...e
799
- }));
800
- } else
801
- a.forEach((c) => {
802
- const u = c.$from.pos, p = c.$to.pos;
803
- r.doc.nodesBetween(u, p, (f, h) => {
804
- const y = Math.max(h, u), v = Math.min(h + f.nodeSize, p);
805
- f.marks.find((w) => w.type === l) ? f.marks.forEach((w) => {
806
- l === w.type && n.addMark(y, v, l.create({
807
- ...w.attrs,
808
- ...e
809
- }));
810
- }) : n.addMark(y, v, l.create(e));
811
- });
812
- });
813
- return Uo(r, n, l);
814
- }, Yo = (t, e) => ({ tr: n }) => (n.setMeta(t, e), !0), Go = (t, e = {}) => ({ state: n, dispatch: r, chain: i }) => {
815
- const o = F(t, n.schema);
816
- let s;
817
- return n.selection.$anchor.sameParent(n.selection.$head) && (s = n.selection.$anchor.parent.attrs), o.isTextblock ? i().command(({ commands: a }) => Tn(o, { ...s, ...e })(n) ? !0 : a.clearNodes()).command(({ state: a }) => Tn(o, { ...s, ...e })(a, r)).run() : (console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'), !1);
818
- }, Xo = (t) => ({ tr: e, dispatch: n }) => {
819
- if (n) {
820
- const { doc: r } = e, i = Pe(t, 0, r.content.size), o = ft.create(r, i);
821
- e.setSelection(o);
822
- }
823
- return !0;
824
- }, Jo = (t) => ({ tr: e, dispatch: n }) => {
825
- if (n) {
826
- const { doc: r } = e, { from: i, to: o } = typeof t == "number" ? { from: t, to: t } : t, s = _.atStart(r).from, a = _.atEnd(r).to, l = Pe(i, s, a), c = Pe(o, s, a), u = _.create(r, l, c);
827
- e.setSelection(u);
828
- }
829
- return !0;
830
- }, Zo = (t) => ({ state: e, dispatch: n }) => {
831
- const r = F(t, e.schema);
832
- return ei(r)(e, n);
833
- };
834
- function An(t, e) {
835
- const n = t.storedMarks || t.selection.$to.parentOffset && t.selection.$from.marks();
836
- if (n) {
837
- const r = n.filter((i) => e == null ? void 0 : e.includes(i.type.name));
838
- t.tr.ensureMarks(r);
839
- }
840
- }
841
- const Qo = ({ keepMarks: t = !0 } = {}) => ({ tr: e, state: n, dispatch: r, editor: i }) => {
842
- const { selection: o, doc: s } = e, { $from: a, $to: l } = o, c = i.extensionManager.attributes, u = Rt(c, a.node().type.name, a.node().attrs);
843
- if (o instanceof ft && o.node.isBlock)
844
- return !a.parentOffset || !Nt(s, a.pos) ? !1 : (r && (t && An(n, i.extensionManager.splittableMarks), e.split(a.pos).scrollIntoView()), !0);
845
- if (!a.parent.isBlock)
846
- return !1;
847
- const p = l.parentOffset === l.parent.content.size, f = a.depth === 0 ? void 0 : Wo(a.node(-1).contentMatchAt(a.indexAfter(-1)));
848
- let h = p && f ? [
849
- {
850
- type: f,
851
- attrs: u
852
- }
853
- ] : void 0, y = Nt(e.doc, e.mapping.map(a.pos), 1, h);
854
- if (!h && !y && Nt(e.doc, e.mapping.map(a.pos), 1, f ? [{ type: f }] : void 0) && (y = !0, h = f ? [
855
- {
856
- type: f,
857
- attrs: u
858
- }
859
- ] : void 0), r) {
860
- if (y && (o instanceof _ && e.deleteSelection(), e.split(e.mapping.map(a.pos), 1, h), f && !p && !a.parentOffset && a.parent.type !== f)) {
861
- const v = e.mapping.map(a.before()), g = e.doc.resolve(v);
862
- a.node(-1).canReplaceWith(g.index(), g.index() + 1, f) && e.setNodeMarkup(e.mapping.map(a.before()), f);
863
- }
864
- t && An(n, i.extensionManager.splittableMarks), e.scrollIntoView();
865
- }
866
- return y;
867
- }, es = (t, e = {}) => ({ tr: n, state: r, dispatch: i, editor: o }) => {
868
- var s;
869
- const a = F(t, r.schema), { $from: l, $to: c } = r.selection, u = r.selection.node;
870
- if (u && u.isBlock || l.depth < 2 || !l.sameParent(c))
871
- return !1;
872
- const p = l.node(-1);
873
- if (p.type !== a)
874
- return !1;
875
- const f = o.extensionManager.attributes;
876
- if (l.parent.content.size === 0 && l.node(-1).childCount === l.indexAfter(-1)) {
877
- if (l.depth === 2 || l.node(-3).type !== a || l.index(-2) !== l.node(-2).childCount - 1)
878
- return !1;
879
- if (i) {
880
- let w = Me.empty;
881
- const x = l.index(-1) ? 1 : l.index(-2) ? 2 : 3;
882
- for (let S = l.depth - x; S >= l.depth - 3; S -= 1)
883
- w = Me.from(l.node(S).copy(w));
884
- const O = l.indexAfter(-1) < l.node(-2).childCount ? 1 : l.indexAfter(-2) < l.node(-3).childCount ? 2 : 3, d = {
885
- ...Rt(f, l.node().type.name, l.node().attrs),
886
- ...e
887
- }, T = ((s = a.contentMatch.defaultType) === null || s === void 0 ? void 0 : s.createAndFill(d)) || void 0;
888
- w = w.append(Me.from(a.createAndFill(null, T) || void 0));
889
- const b = l.before(l.depth - (x - 1));
890
- n.replace(b, l.after(-O), new ln(w, 4 - x, 0));
891
- let C = -1;
892
- n.doc.nodesBetween(b, n.doc.content.size, (S, L) => {
893
- if (C > -1)
894
- return !1;
895
- S.isTextblock && S.content.size === 0 && (C = L + 1);
896
- }), C > -1 && n.setSelection(_.near(n.doc.resolve(C))), n.scrollIntoView();
897
- }
898
- return !0;
899
- }
900
- const h = c.pos === l.end() ? p.contentMatchAt(0).defaultType : null, y = {
901
- ...Rt(f, p.type.name, p.attrs),
902
- ...e
903
- }, v = {
904
- ...Rt(f, l.node().type.name, l.node().attrs),
905
- ...e
906
- };
907
- n.delete(l.pos, c.pos);
908
- const g = h ? [
909
- { type: a, attrs: y },
910
- { type: h, attrs: v }
911
- ] : [{ type: a, attrs: y }];
912
- if (!Nt(n.doc, l.pos, 2))
913
- return !1;
914
- if (i) {
915
- const { selection: w, storedMarks: x } = r, { splittableMarks: O } = o.extensionManager, d = x || w.$to.parentOffset && w.$from.marks();
916
- if (n.split(l.pos, 2, g).scrollIntoView(), !d || !i)
917
- return !0;
918
- const T = d.filter((b) => O.includes(b.type.name));
919
- n.ensureMarks(T);
920
- }
921
- return !0;
922
- }, qt = (t, e) => {
923
- const n = fn((s) => s.type === e)(t.selection);
924
- if (!n)
925
- return !0;
926
- const r = t.doc.resolve(Math.max(0, n.pos - 1)).before(n.depth);
927
- if (r === void 0)
928
- return !0;
929
- const i = t.doc.nodeAt(r);
930
- return n.node.type === (i == null ? void 0 : i.type) && ir(t.doc, n.pos) && t.join(n.pos), !0;
931
- }, Yt = (t, e) => {
932
- const n = fn((s) => s.type === e)(t.selection);
933
- if (!n)
934
- return !0;
935
- const r = t.doc.resolve(n.start).after(n.depth);
936
- if (r === void 0)
937
- return !0;
938
- const i = t.doc.nodeAt(r);
939
- return n.node.type === (i == null ? void 0 : i.type) && ir(t.doc, r) && t.join(r), !0;
940
- }, ts = (t, e, n, r = {}) => ({ editor: i, tr: o, state: s, dispatch: a, chain: l, commands: c, can: u }) => {
941
- const { extensions: p, splittableMarks: f } = i.extensionManager, h = F(t, s.schema), y = F(e, s.schema), { selection: v, storedMarks: g } = s, { $from: w, $to: x } = v, O = w.blockRange(x), d = g || v.$to.parentOffset && v.$from.marks();
942
- if (!O)
943
- return !1;
944
- const T = fn((b) => En(b.type.name, p))(v);
945
- if (O.depth >= 1 && T && O.depth - T.depth <= 1) {
946
- if (T.node.type === h)
947
- return c.liftListItem(y);
948
- if (En(T.node.type.name, p) && h.validContent(T.node.content) && a)
949
- return l().command(() => (o.setNodeMarkup(T.pos, h), !0)).command(() => qt(o, h)).command(() => Yt(o, h)).run();
950
- }
951
- return !n || !d || !a ? l().command(() => u().wrapInList(h, r) ? !0 : c.clearNodes()).wrapInList(h, r).command(() => qt(o, h)).command(() => Yt(o, h)).run() : l().command(() => {
952
- const b = u().wrapInList(h, r), C = d.filter((S) => f.includes(S.type.name));
953
- return o.ensureMarks(C), b ? !0 : c.clearNodes();
954
- }).wrapInList(h, r).command(() => qt(o, h)).command(() => Yt(o, h)).run();
955
- }, ns = (t, e = {}, n = {}) => ({ state: r, commands: i }) => {
956
- const { extendEmptyMarkRange: o = !1 } = n, s = Te(t, r.schema);
957
- return Ko(r, s, e) ? i.unsetMark(s, { extendEmptyMarkRange: o }) : i.setMark(s, e);
958
- }, rs = (t, e, n = {}) => ({ state: r, commands: i }) => {
959
- const o = F(t, r.schema), s = F(e, r.schema), a = pn(r, o, n);
960
- let l;
961
- return r.selection.$anchor.sameParent(r.selection.$head) && (l = r.selection.$anchor.parent.attrs), a ? i.setNode(s, l) : i.setNode(o, { ...l, ...n });
962
- }, is = (t, e = {}) => ({ state: n, commands: r }) => {
963
- const i = F(t, n.schema);
964
- return pn(n, i, e) ? r.lift(i) : r.wrapIn(i, e);
965
- }, os = () => ({ state: t, dispatch: e }) => {
966
- const n = t.plugins;
967
- for (let r = 0; r < n.length; r += 1) {
968
- const i = n[r];
969
- let o;
970
- if (i.spec.isInputRules && (o = i.getState(t))) {
971
- if (e) {
972
- const s = t.tr, a = o.transform;
973
- for (let l = a.steps.length - 1; l >= 0; l -= 1)
974
- s.step(a.steps[l].invert(a.docs[l]));
975
- if (o.text) {
976
- const l = s.doc.resolve(o.from).marks();
977
- s.replaceWith(o.from, o.to, t.schema.text(o.text, l));
978
- } else
979
- s.delete(o.from, o.to);
980
- }
981
- return !0;
982
- }
983
- }
984
- return !1;
985
- }, ss = () => ({ tr: t, dispatch: e }) => {
986
- const { selection: n } = t, { empty: r, ranges: i } = n;
987
- return r || e && i.forEach((o) => {
988
- t.removeMark(o.$from.pos, o.$to.pos);
989
- }), !0;
990
- }, as = (t, e = {}) => ({ tr: n, state: r, dispatch: i }) => {
991
- var o;
992
- const { extendEmptyMarkRange: s = !1 } = e, { selection: a } = n, l = Te(t, r.schema), { $from: c, empty: u, ranges: p } = a;
993
- if (!i)
994
- return !0;
995
- if (u && s) {
996
- let { from: f, to: h } = a;
997
- const y = (o = c.marks().find((g) => g.type === l)) === null || o === void 0 ? void 0 : o.attrs, v = dr(c, l, y);
998
- v && (f = v.from, h = v.to), n.removeMark(f, h, l);
999
- } else
1000
- p.forEach((f) => {
1001
- n.removeMark(f.$from.pos, f.$to.pos, l);
1002
- });
1003
- return n.removeStoredMark(l), !0;
1004
- }, ls = (t, e = {}) => ({ tr: n, state: r, dispatch: i }) => {
1005
- let o = null, s = null;
1006
- const a = mr(typeof t == "string" ? t : t.name, r.schema);
1007
- return a ? (a === "node" && (o = F(t, r.schema)), a === "mark" && (s = Te(t, r.schema)), i && n.selection.ranges.forEach((l) => {
1008
- const c = l.$from.pos, u = l.$to.pos;
1009
- let p, f, h, y;
1010
- n.selection.empty ? r.doc.nodesBetween(c, u, (v, g) => {
1011
- o && o === v.type && (h = Math.max(g, c), y = Math.min(g + v.nodeSize, u), p = g, f = v);
1012
- }) : r.doc.nodesBetween(c, u, (v, g) => {
1013
- g < c && o && o === v.type && (h = Math.max(g, c), y = Math.min(g + v.nodeSize, u), p = g, f = v), g >= c && g <= u && (o && o === v.type && n.setNodeMarkup(g, void 0, {
1014
- ...v.attrs,
1015
- ...e
1016
- }), s && v.marks.length && v.marks.forEach((w) => {
1017
- if (s === w.type) {
1018
- const x = Math.max(g, c), O = Math.min(g + v.nodeSize, u);
1019
- n.addMark(x, O, s.create({
1020
- ...w.attrs,
1021
- ...e
1022
- }));
1023
- }
1024
- }));
1025
- }), f && (p !== void 0 && n.setNodeMarkup(p, void 0, {
1026
- ...f.attrs,
1027
- ...e
1028
- }), s && f.marks.length && f.marks.forEach((v) => {
1029
- s === v.type && n.addMark(h, y, s.create({
1030
- ...v.attrs,
1031
- ...e
1032
- }));
1033
- }));
1034
- }), !0) : !1;
1035
- }, cs = (t, e = {}) => ({ state: n, dispatch: r }) => {
1036
- const i = F(t, n.schema);
1037
- return Qr(i, e)(n, r);
1038
- }, us = (t, e = {}) => ({ state: n, dispatch: r }) => {
1039
- const i = F(t, n.schema);
1040
- return Zr(i, e)(n, r);
1041
- };
1042
- var ds = /* @__PURE__ */ Object.freeze({
1043
- __proto__: null,
1044
- blur: Gi,
1045
- clearContent: Xi,
1046
- clearNodes: Ji,
1047
- command: Zi,
1048
- createParagraphNear: Qi,
1049
- cut: eo,
1050
- deleteCurrentNode: to,
1051
- deleteNode: no,
1052
- deleteRange: ro,
1053
- deleteSelection: io,
1054
- enter: oo,
1055
- exitCode: so,
1056
- extendMarkRange: ao,
1057
- first: lo,
1058
- focus: po,
1059
- forEach: fo,
1060
- insertContent: ho,
1061
- insertContentAt: go,
1062
- joinBackward: wo,
1063
- joinDown: bo,
1064
- joinForward: xo,
1065
- joinItemBackward: ko,
1066
- joinItemForward: Mo,
1067
- joinTextblockBackward: To,
1068
- joinTextblockForward: Oo,
1069
- joinUp: yo,
1070
- keyboardShortcut: Eo,
1071
- lift: Ao,
1072
- liftEmptyBlock: So,
1073
- liftListItem: Io,
1074
- newlineInCode: Lo,
1075
- resetAttributes: Po,
1076
- scrollIntoView: Do,
1077
- selectAll: No,
1078
- selectNodeBackward: Ro,
1079
- selectNodeForward: $o,
1080
- selectParentNode: Bo,
1081
- selectTextblockEnd: Ho,
1082
- selectTextblockStart: jo,
1083
- setContent: Fo,
1084
- setMark: qo,
1085
- setMeta: Yo,
1086
- setNode: Go,
1087
- setNodeSelection: Xo,
1088
- setTextSelection: Jo,
1089
- sinkListItem: Zo,
1090
- splitBlock: Qo,
1091
- splitListItem: es,
1092
- toggleList: ts,
1093
- toggleMark: ns,
1094
- toggleNode: rs,
1095
- toggleWrap: is,
1096
- undoInputRule: os,
1097
- unsetAllMarks: ss,
1098
- unsetMark: as,
1099
- updateAttributes: ls,
1100
- wrapIn: cs,
1101
- wrapInList: us
1102
- });
1103
- ee.create({
1104
- name: "commands",
1105
- addCommands() {
1106
- return {
1107
- ...ds
1108
- };
1109
- }
1110
- });
1111
- ee.create({
1112
- name: "drop",
1113
- addProseMirrorPlugins() {
1114
- return [
1115
- new U({
1116
- key: new J("tiptapDrop"),
1117
- props: {
1118
- handleDrop: (t, e, n, r) => {
1119
- this.editor.emit("drop", {
1120
- editor: this.editor,
1121
- event: e,
1122
- slice: n,
1123
- moved: r
1124
- });
1125
- }
1126
- }
1127
- })
1128
- ];
1129
- }
1130
- });
1131
- ee.create({
1132
- name: "editable",
1133
- addProseMirrorPlugins() {
1134
- return [
1135
- new U({
1136
- key: new J("editable"),
1137
- props: {
1138
- editable: () => this.editor.options.editable
1139
- }
1140
- })
1141
- ];
1142
- }
1143
- });
1144
- const ps = new J("focusEvents");
1145
- ee.create({
1146
- name: "focusEvents",
1147
- addProseMirrorPlugins() {
1148
- const { editor: t } = this;
1149
- return [
1150
- new U({
1151
- key: ps,
1152
- props: {
1153
- handleDOMEvents: {
1154
- focus: (e, n) => {
1155
- t.isFocused = !0;
1156
- const r = t.state.tr.setMeta("focus", { event: n }).setMeta("addToHistory", !1);
1157
- return e.dispatch(r), !1;
1158
- },
1159
- blur: (e, n) => {
1160
- t.isFocused = !1;
1161
- const r = t.state.tr.setMeta("blur", { event: n }).setMeta("addToHistory", !1);
1162
- return e.dispatch(r), !1;
1163
- }
1164
- }
1165
- }
1166
- })
1167
- ];
1168
- }
1169
- });
1170
- ee.create({
1171
- name: "keymap",
1172
- addKeyboardShortcuts() {
1173
- const t = () => this.editor.commands.first(({ commands: s }) => [
1174
- () => s.undoInputRule(),
1175
- // maybe convert first text block node to default node
1176
- () => s.command(({ tr: a }) => {
1177
- const { selection: l, doc: c } = a, { empty: u, $anchor: p } = l, { pos: f, parent: h } = p, y = p.parent.isTextblock && f > 0 ? a.doc.resolve(f - 1) : p, v = y.parent.type.spec.isolating, g = p.pos - p.parentOffset, w = v && y.parent.childCount === 1 ? g === p.pos : oe.atStart(c).from === f;
1178
- return !u || !h.type.isTextblock || h.textContent.length || !w || w && p.parent.type.name === "paragraph" ? !1 : s.clearNodes();
1179
- }),
1180
- () => s.deleteSelection(),
1181
- () => s.joinBackward(),
1182
- () => s.selectNodeBackward()
1183
- ]), e = () => this.editor.commands.first(({ commands: s }) => [
1184
- () => s.deleteSelection(),
1185
- () => s.deleteCurrentNode(),
1186
- () => s.joinForward(),
1187
- () => s.selectNodeForward()
1188
- ]), r = {
1189
- Enter: () => this.editor.commands.first(({ commands: s }) => [
1190
- () => s.newlineInCode(),
1191
- () => s.createParagraphNear(),
1192
- () => s.liftEmptyBlock(),
1193
- () => s.splitBlock()
1194
- ]),
1195
- "Mod-Enter": () => this.editor.commands.exitCode(),
1196
- Backspace: t,
1197
- "Mod-Backspace": t,
1198
- "Shift-Backspace": t,
1199
- Delete: e,
1200
- "Mod-Delete": e,
1201
- "Mod-a": () => this.editor.commands.selectAll()
1202
- }, i = {
1203
- ...r
1204
- }, o = {
1205
- ...r,
1206
- "Ctrl-h": t,
1207
- "Alt-Backspace": t,
1208
- "Ctrl-d": e,
1209
- "Ctrl-Alt-Backspace": e,
1210
- "Alt-Delete": e,
1211
- "Alt-d": e,
1212
- "Ctrl-a": () => this.editor.commands.selectTextblockStart(),
1213
- "Ctrl-e": () => this.editor.commands.selectTextblockEnd()
1214
- };
1215
- return dn() || hr() ? o : i;
1216
- },
1217
- addProseMirrorPlugins() {
1218
- return [
1219
- // With this plugin we check if the whole document was selected and deleted.
1220
- // In this case we will additionally call `clearNodes()` to convert e.g. a heading
1221
- // to a paragraph if necessary.
1222
- // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well
1223
- // with many other commands.
1224
- new U({
1225
- key: new J("clearDocument"),
1226
- appendTransaction: (t, e, n) => {
1227
- if (t.some((v) => v.getMeta("composition")))
1228
- return;
1229
- const r = t.some((v) => v.docChanged) && !e.doc.eq(n.doc), i = t.some((v) => v.getMeta("preventClearDocument"));
1230
- if (!r || i)
1231
- return;
1232
- const { empty: o, from: s, to: a } = e.selection, l = oe.atStart(e.doc).from, c = oe.atEnd(e.doc).to;
1233
- if (o || !(s === l && a === c) || !vr(n.doc))
1234
- return;
1235
- const f = n.tr, h = lr({
1236
- state: n,
1237
- transaction: f
1238
- }), { commands: y } = new Vi({
1239
- editor: this.editor,
1240
- state: h
1241
- });
1242
- if (y.clearNodes(), !!f.steps.length)
1243
- return f;
1244
- }
1245
- })
1246
- ];
1247
- }
1248
- });
1249
- ee.create({
1250
- name: "paste",
1251
- addProseMirrorPlugins() {
1252
- return [
1253
- new U({
1254
- key: new J("tiptapPaste"),
1255
- props: {
1256
- handlePaste: (t, e, n) => {
1257
- this.editor.emit("paste", {
1258
- editor: this.editor,
1259
- event: e,
1260
- slice: n
1261
- });
1262
- }
1263
- }
1264
- })
1265
- ];
1266
- }
1267
- });
1268
- ee.create({
1269
- name: "tabindex",
1270
- addProseMirrorPlugins() {
1271
- return [
1272
- new U({
1273
- key: new J("tabindex"),
1274
- props: {
1275
- attributes: () => this.editor.isEditable ? { tabindex: "0" } : {}
1276
- }
1277
- })
1278
- ];
1279
- }
1280
- });
1281
- const fs = /^\s*>\s$/, hs = se.create({
1282
- name: "blockquote",
1283
- addOptions() {
1284
- return {
1285
- HTMLAttributes: {}
1286
- };
1287
- },
1288
- content: "block+",
1289
- group: "block",
1290
- defining: !0,
1291
- parseHTML() {
1292
- return [
1293
- { tag: "blockquote" }
1294
- ];
1295
- },
1296
- renderHTML({ HTMLAttributes: t }) {
1297
- return ["blockquote", K(this.options.HTMLAttributes, t), 0];
1298
- },
1299
- addCommands() {
1300
- return {
1301
- setBlockquote: () => ({ commands: t }) => t.wrapIn(this.name),
1302
- toggleBlockquote: () => ({ commands: t }) => t.toggleWrap(this.name),
1303
- unsetBlockquote: () => ({ commands: t }) => t.lift(this.name)
1304
- };
1305
- },
1306
- addKeyboardShortcuts() {
1307
- return {
1308
- "Mod-Shift-b": () => this.editor.commands.toggleBlockquote()
1309
- };
1310
- },
1311
- addInputRules() {
1312
- return [
1313
- at({
1314
- find: fs,
1315
- type: this.type
1316
- })
1317
- ];
1318
- }
1319
- }), ms = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/, vs = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g, gs = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/, ys = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g, bs = Vt.create({
1320
- name: "bold",
1321
- addOptions() {
1322
- return {
1323
- HTMLAttributes: {}
1324
- };
1325
- },
1326
- parseHTML() {
1327
- return [
1328
- {
1329
- tag: "strong"
1330
- },
1331
- {
1332
- tag: "b",
1333
- getAttrs: (t) => t.style.fontWeight !== "normal" && null
1334
- },
1335
- {
1336
- style: "font-weight=400",
1337
- clearMark: (t) => t.type.name === this.name
1338
- },
1339
- {
1340
- style: "font-weight",
1341
- getAttrs: (t) => /^(bold(er)?|[5-9]\d{2,})$/.test(t) && null
1342
- }
1343
- ];
1344
- },
1345
- renderHTML({ HTMLAttributes: t }) {
1346
- return ["strong", K(this.options.HTMLAttributes, t), 0];
1347
- },
1348
- addCommands() {
1349
- return {
1350
- setBold: () => ({ commands: t }) => t.setMark(this.name),
1351
- toggleBold: () => ({ commands: t }) => t.toggleMark(this.name),
1352
- unsetBold: () => ({ commands: t }) => t.unsetMark(this.name)
1353
- };
1354
- },
1355
- addKeyboardShortcuts() {
1356
- return {
1357
- "Mod-b": () => this.editor.commands.toggleBold(),
1358
- "Mod-B": () => this.editor.commands.toggleBold()
1359
- };
1360
- },
1361
- addInputRules() {
1362
- return [
1363
- ze({
1364
- find: ms,
1365
- type: this.type
1366
- }),
1367
- ze({
1368
- find: gs,
1369
- type: this.type
1370
- })
1371
- ];
1372
- },
1373
- addPasteRules() {
1374
- return [
1375
- We({
1376
- find: vs,
1377
- type: this.type
1378
- }),
1379
- We({
1380
- find: ys,
1381
- type: this.type
1382
- })
1383
- ];
1384
- }
1385
- }), ws = "listItem", Sn = "textStyle", In = /^\s*([-+*])\s$/, xs = se.create({
1386
- name: "bulletList",
1387
- addOptions() {
1388
- return {
1389
- itemTypeName: "listItem",
1390
- HTMLAttributes: {},
1391
- keepMarks: !1,
1392
- keepAttributes: !1
1393
- };
1394
- },
1395
- group: "block list",
1396
- content() {
1397
- return `${this.options.itemTypeName}+`;
1398
- },
1399
- parseHTML() {
1400
- return [
1401
- { tag: "ul" }
1402
- ];
1403
- },
1404
- renderHTML({ HTMLAttributes: t }) {
1405
- return ["ul", K(this.options.HTMLAttributes, t), 0];
1406
- },
1407
- addCommands() {
1408
- return {
1409
- toggleBulletList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ws, this.editor.getAttributes(Sn)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
1410
- };
1411
- },
1412
- addKeyboardShortcuts() {
1413
- return {
1414
- "Mod-Shift-8": () => this.editor.commands.toggleBulletList()
1415
- };
1416
- },
1417
- addInputRules() {
1418
- let t = at({
1419
- find: In,
1420
- type: this.type
1421
- });
1422
- return (this.options.keepMarks || this.options.keepAttributes) && (t = at({
1423
- find: In,
1424
- type: this.type,
1425
- keepMarks: this.options.keepMarks,
1426
- keepAttributes: this.options.keepAttributes,
1427
- getAttributes: () => this.editor.getAttributes(Sn),
1428
- editor: this.editor
1429
- })), [
1430
- t
1431
- ];
1432
- }
1433
- }), ks = /(^|[^`])`([^`]+)`(?!`)/, Ms = /(^|[^`])`([^`]+)`(?!`)/g, Ts = Vt.create({
1434
- name: "code",
1435
- addOptions() {
1436
- return {
1437
- HTMLAttributes: {}
1438
- };
1439
- },
1440
- excludes: "_",
1441
- code: !0,
1442
- exitable: !0,
1443
- parseHTML() {
1444
- return [
1445
- { tag: "code" }
1446
- ];
1447
- },
1448
- renderHTML({ HTMLAttributes: t }) {
1449
- return ["code", K(this.options.HTMLAttributes, t), 0];
1450
- },
1451
- addCommands() {
1452
- return {
1453
- setCode: () => ({ commands: t }) => t.setMark(this.name),
1454
- toggleCode: () => ({ commands: t }) => t.toggleMark(this.name),
1455
- unsetCode: () => ({ commands: t }) => t.unsetMark(this.name)
1456
- };
1457
- },
1458
- addKeyboardShortcuts() {
1459
- return {
1460
- "Mod-e": () => this.editor.commands.toggleCode()
1461
- };
1462
- },
1463
- addInputRules() {
1464
- return [
1465
- ze({
1466
- find: ks,
1467
- type: this.type
1468
- })
1469
- ];
1470
- },
1471
- addPasteRules() {
1472
- return [
1473
- We({
1474
- find: Ms,
1475
- type: this.type
1476
- })
1477
- ];
1478
- }
1479
- }), Os = /^```([a-z]+)?[\s\n]$/, Cs = /^~~~([a-z]+)?[\s\n]$/, Es = se.create({
1480
- name: "codeBlock",
1481
- addOptions() {
1482
- return {
1483
- languageClassPrefix: "language-",
1484
- exitOnTripleEnter: !0,
1485
- exitOnArrowDown: !0,
1486
- defaultLanguage: null,
1487
- HTMLAttributes: {}
1488
- };
1489
- },
1490
- content: "text*",
1491
- marks: "",
1492
- group: "block",
1493
- code: !0,
1494
- defining: !0,
1495
- addAttributes() {
1496
- return {
1497
- language: {
1498
- default: this.options.defaultLanguage,
1499
- parseHTML: (t) => {
1500
- var e;
1501
- const { languageClassPrefix: n } = this.options, o = [...((e = t.firstElementChild) === null || e === void 0 ? void 0 : e.classList) || []].filter((s) => s.startsWith(n)).map((s) => s.replace(n, ""))[0];
1502
- return o || null;
1503
- },
1504
- rendered: !1
1505
- }
1506
- };
1507
- },
1508
- parseHTML() {
1509
- return [
1510
- {
1511
- tag: "pre",
1512
- preserveWhitespace: "full"
1513
- }
1514
- ];
1515
- },
1516
- renderHTML({ node: t, HTMLAttributes: e }) {
1517
- return [
1518
- "pre",
1519
- K(this.options.HTMLAttributes, e),
1520
- [
1521
- "code",
1522
- {
1523
- class: t.attrs.language ? this.options.languageClassPrefix + t.attrs.language : null
1524
- },
1525
- 0
1526
- ]
1527
- ];
1528
- },
1529
- addCommands() {
1530
- return {
1531
- setCodeBlock: (t) => ({ commands: e }) => e.setNode(this.name, t),
1532
- toggleCodeBlock: (t) => ({ commands: e }) => e.toggleNode(this.name, "paragraph", t)
1533
- };
1534
- },
1535
- addKeyboardShortcuts() {
1536
- return {
1537
- "Mod-Alt-c": () => this.editor.commands.toggleCodeBlock(),
1538
- // remove code block when at start of document or code block is empty
1539
- Backspace: () => {
1540
- const { empty: t, $anchor: e } = this.editor.state.selection, n = e.pos === 1;
1541
- return !t || e.parent.type.name !== this.name ? !1 : n || !e.parent.textContent.length ? this.editor.commands.clearNodes() : !1;
1542
- },
1543
- // exit node on triple enter
1544
- Enter: ({ editor: t }) => {
1545
- if (!this.options.exitOnTripleEnter)
1546
- return !1;
1547
- const { state: e } = t, { selection: n } = e, { $from: r, empty: i } = n;
1548
- if (!i || r.parent.type !== this.type)
1549
- return !1;
1550
- const o = r.parentOffset === r.parent.nodeSize - 2, s = r.parent.textContent.endsWith(`
1551
-
1552
- `);
1553
- return !o || !s ? !1 : t.chain().command(({ tr: a }) => (a.delete(r.pos - 2, r.pos), !0)).exitCode().run();
1554
- },
1555
- // exit node on arrow down
1556
- ArrowDown: ({ editor: t }) => {
1557
- if (!this.options.exitOnArrowDown)
1558
- return !1;
1559
- const { state: e } = t, { selection: n, doc: r } = e, { $from: i, empty: o } = n;
1560
- if (!o || i.parent.type !== this.type || !(i.parentOffset === i.parent.nodeSize - 2))
1561
- return !1;
1562
- const a = i.after();
1563
- return a === void 0 ? !1 : r.nodeAt(a) ? t.commands.command(({ tr: c }) => (c.setSelection(oe.near(r.resolve(a))), !0)) : t.commands.exitCode();
1564
- }
1565
- };
1566
- },
1567
- addInputRules() {
1568
- return [
1569
- tn({
1570
- find: Os,
1571
- type: this.type,
1572
- getAttributes: (t) => ({
1573
- language: t[1]
1574
- })
1575
- }),
1576
- tn({
1577
- find: Cs,
1578
- type: this.type,
1579
- getAttributes: (t) => ({
1580
- language: t[1]
1581
- })
1582
- })
1583
- ];
1584
- },
1585
- addProseMirrorPlugins() {
1586
- return [
1587
- // this plugin creates a code block for pasted content from VS Code
1588
- // we can also detect the copied code language
1589
- new U({
1590
- key: new J("codeBlockVSCodeHandler"),
1591
- props: {
1592
- handlePaste: (t, e) => {
1593
- if (!e.clipboardData || this.editor.isActive(this.type.name))
1594
- return !1;
1595
- const n = e.clipboardData.getData("text/plain"), r = e.clipboardData.getData("vscode-editor-data"), i = r ? JSON.parse(r) : void 0, o = i == null ? void 0 : i.mode;
1596
- if (!n || !o)
1597
- return !1;
1598
- const { tr: s, schema: a } = t.state, l = a.text(n.replace(/\r\n?/g, `
1599
- `));
1600
- return s.replaceSelectionWith(this.type.create({ language: o }, l)), s.selection.$from.parent.type !== this.type && s.setSelection(_.near(s.doc.resolve(Math.max(0, s.selection.from - 2)))), s.setMeta("paste", !0), t.dispatch(s), !0;
1601
- }
1602
- }
1603
- })
1604
- ];
1605
- }
1606
- }), As = se.create({
1607
- name: "doc",
1608
- topNode: !0,
1609
- content: "block+"
1610
- });
1611
- function Ss(t = {}) {
1612
- return new U({
1613
- view(e) {
1614
- return new Is(e, t);
1615
- }
1616
- });
1617
- }
1618
- class Is {
1619
- constructor(e, n) {
1620
- var r;
1621
- this.editorView = e, this.cursorPos = null, this.element = null, this.timeout = -1, this.width = (r = n.width) !== null && r !== void 0 ? r : 1, this.color = n.color === !1 ? void 0 : n.color || "black", this.class = n.class, this.handlers = ["dragover", "dragend", "drop", "dragleave"].map((i) => {
1622
- let o = (s) => {
1623
- this[i](s);
1624
- };
1625
- return e.dom.addEventListener(i, o), { name: i, handler: o };
1626
- });
1627
- }
1628
- destroy() {
1629
- this.handlers.forEach(({ name: e, handler: n }) => this.editorView.dom.removeEventListener(e, n));
1630
- }
1631
- update(e, n) {
1632
- this.cursorPos != null && n.doc != e.state.doc && (this.cursorPos > e.state.doc.content.size ? this.setCursor(null) : this.updateOverlay());
1633
- }
1634
- setCursor(e) {
1635
- e != this.cursorPos && (this.cursorPos = e, e == null ? (this.element.parentNode.removeChild(this.element), this.element = null) : this.updateOverlay());
1636
- }
1637
- updateOverlay() {
1638
- let e = this.editorView.state.doc.resolve(this.cursorPos), n = !e.parent.inlineContent, r, i = this.editorView.dom, o = i.getBoundingClientRect(), s = o.width / i.offsetWidth, a = o.height / i.offsetHeight;
1639
- if (n) {
1640
- let p = e.nodeBefore, f = e.nodeAfter;
1641
- if (p || f) {
1642
- let h = this.editorView.nodeDOM(this.cursorPos - (p ? p.nodeSize : 0));
1643
- if (h) {
1644
- let y = h.getBoundingClientRect(), v = p ? y.bottom : y.top;
1645
- p && f && (v = (v + this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top) / 2);
1646
- let g = this.width / 2 * a;
1647
- r = { left: y.left, right: y.right, top: v - g, bottom: v + g };
1648
- }
1649
- }
1650
- }
1651
- if (!r) {
1652
- let p = this.editorView.coordsAtPos(this.cursorPos), f = this.width / 2 * s;
1653
- r = { left: p.left - f, right: p.left + f, top: p.top, bottom: p.bottom };
1654
- }
1655
- let l = this.editorView.dom.offsetParent;
1656
- this.element || (this.element = l.appendChild(document.createElement("div")), this.class && (this.element.className = this.class), this.element.style.cssText = "position: absolute; z-index: 50; pointer-events: none;", this.color && (this.element.style.backgroundColor = this.color)), this.element.classList.toggle("prosemirror-dropcursor-block", n), this.element.classList.toggle("prosemirror-dropcursor-inline", !n);
1657
- let c, u;
1658
- if (!l || l == document.body && getComputedStyle(l).position == "static")
1659
- c = -pageXOffset, u = -pageYOffset;
1660
- else {
1661
- let p = l.getBoundingClientRect(), f = p.width / l.offsetWidth, h = p.height / l.offsetHeight;
1662
- c = p.left - l.scrollLeft * f, u = p.top - l.scrollTop * h;
1663
- }
1664
- this.element.style.left = (r.left - c) / s + "px", this.element.style.top = (r.top - u) / a + "px", this.element.style.width = (r.right - r.left) / s + "px", this.element.style.height = (r.bottom - r.top) / a + "px";
1665
- }
1666
- scheduleRemoval(e) {
1667
- clearTimeout(this.timeout), this.timeout = setTimeout(() => this.setCursor(null), e);
1668
- }
1669
- dragover(e) {
1670
- if (!this.editorView.editable)
1671
- return;
1672
- let n = this.editorView.posAtCoords({ left: e.clientX, top: e.clientY }), r = n && n.inside >= 0 && this.editorView.state.doc.nodeAt(n.inside), i = r && r.type.spec.disableDropCursor, o = typeof i == "function" ? i(this.editorView, n, e) : i;
1673
- if (n && !o) {
1674
- let s = n.pos;
1675
- if (this.editorView.dragging && this.editorView.dragging.slice) {
1676
- let a = Oi(this.editorView.state.doc, s, this.editorView.dragging.slice);
1677
- a != null && (s = a);
1678
- }
1679
- this.setCursor(s), this.scheduleRemoval(5e3);
1680
- }
1681
- }
1682
- dragend() {
1683
- this.scheduleRemoval(20);
1684
- }
1685
- drop() {
1686
- this.scheduleRemoval(20);
1687
- }
1688
- dragleave(e) {
1689
- this.editorView.dom.contains(e.relatedTarget) || this.setCursor(null);
1690
- }
1691
- }
1692
- const Ls = Ge.create({
1693
- name: "dropCursor",
1694
- addOptions() {
1695
- return {
1696
- color: "currentColor",
1697
- width: 1,
1698
- class: void 0
1699
- };
1700
- },
1701
- addProseMirrorPlugins() {
1702
- return [
1703
- Ss(this.options)
1704
- ];
1705
- }
1706
- });
1707
- class N extends oe {
1708
- /**
1709
- Create a gap cursor.
1710
- */
1711
- constructor(e) {
1712
- super(e, e);
1713
- }
1714
- map(e, n) {
1715
- let r = e.resolve(n.map(this.head));
1716
- return N.valid(r) ? new N(r) : oe.near(r);
1717
- }
1718
- content() {
1719
- return ln.empty;
1720
- }
1721
- eq(e) {
1722
- return e instanceof N && e.head == this.head;
1723
- }
1724
- toJSON() {
1725
- return { type: "gapcursor", pos: this.head };
1726
- }
1727
- /**
1728
- @internal
1729
- */
1730
- static fromJSON(e, n) {
1731
- if (typeof n.pos != "number")
1732
- throw new RangeError("Invalid input for GapCursor.fromJSON");
1733
- return new N(e.resolve(n.pos));
1734
- }
1735
- /**
1736
- @internal
1737
- */
1738
- getBookmark() {
1739
- return new hn(this.anchor);
1740
- }
1741
- /**
1742
- @internal
1743
- */
1744
- static valid(e) {
1745
- let n = e.parent;
1746
- if (n.isTextblock || !Ps(e) || !Ds(e))
1747
- return !1;
1748
- let r = n.type.spec.allowGapCursor;
1749
- if (r != null)
1750
- return r;
1751
- let i = n.contentMatchAt(e.index()).defaultType;
1752
- return i && i.isTextblock;
1753
- }
1754
- /**
1755
- @internal
1756
- */
1757
- static findGapCursorFrom(e, n, r = !1) {
1758
- e: for (; ; ) {
1759
- if (!r && N.valid(e))
1760
- return e;
1761
- let i = e.pos, o = null;
1762
- for (let s = e.depth; ; s--) {
1763
- let a = e.node(s);
1764
- if (n > 0 ? e.indexAfter(s) < a.childCount : e.index(s) > 0) {
1765
- o = a.child(n > 0 ? e.indexAfter(s) : e.index(s) - 1);
1766
- break;
1767
- } else if (s == 0)
1768
- return null;
1769
- i += n;
1770
- let l = e.doc.resolve(i);
1771
- if (N.valid(l))
1772
- return l;
1773
- }
1774
- for (; ; ) {
1775
- let s = n > 0 ? o.firstChild : o.lastChild;
1776
- if (!s) {
1777
- if (o.isAtom && !o.isText && !ft.isSelectable(o)) {
1778
- e = e.doc.resolve(i + o.nodeSize * n), r = !1;
1779
- continue e;
1780
- }
1781
- break;
1782
- }
1783
- o = s, i += n;
1784
- let a = e.doc.resolve(i);
1785
- if (N.valid(a))
1786
- return a;
1787
- }
1788
- return null;
1789
- }
1790
- }
1791
- }
1792
- N.prototype.visible = !1;
1793
- N.findFrom = N.findGapCursorFrom;
1794
- oe.jsonID("gapcursor", N);
1795
- class hn {
1796
- constructor(e) {
1797
- this.pos = e;
1798
- }
1799
- map(e) {
1800
- return new hn(e.map(this.pos));
1801
- }
1802
- resolve(e) {
1803
- let n = e.resolve(this.pos);
1804
- return N.valid(n) ? new N(n) : oe.near(n);
1805
- }
1806
- }
1807
- function gr(t) {
1808
- return t.isAtom || t.spec.isolating || t.spec.createGapCursor;
1809
- }
1810
- function Ps(t) {
1811
- for (let e = t.depth; e >= 0; e--) {
1812
- let n = t.index(e), r = t.node(e);
1813
- if (n == 0) {
1814
- if (r.type.spec.isolating)
1815
- return !0;
1816
- continue;
1817
- }
1818
- for (let i = r.child(n - 1); ; i = i.lastChild) {
1819
- if (i.childCount == 0 && !i.inlineContent || gr(i.type))
1820
- return !0;
1821
- if (i.inlineContent)
1822
- return !1;
1823
- }
1824
- }
1825
- return !0;
1826
- }
1827
- function Ds(t) {
1828
- for (let e = t.depth; e >= 0; e--) {
1829
- let n = t.indexAfter(e), r = t.node(e);
1830
- if (n == r.childCount) {
1831
- if (r.type.spec.isolating)
1832
- return !0;
1833
- continue;
1834
- }
1835
- for (let i = r.child(n); ; i = i.firstChild) {
1836
- if (i.childCount == 0 && !i.inlineContent || gr(i.type))
1837
- return !0;
1838
- if (i.inlineContent)
1839
- return !1;
1840
- }
1841
- }
1842
- return !0;
1843
- }
1844
- function Ns() {
1845
- return new U({
1846
- props: {
1847
- decorations: Hs,
1848
- createSelectionBetween(t, e, n) {
1849
- return e.pos == n.pos && N.valid(n) ? new N(n) : null;
1850
- },
1851
- handleClick: $s,
1852
- handleKeyDown: Rs,
1853
- handleDOMEvents: { beforeinput: Bs }
1854
- }
1855
- });
1856
- }
1857
- const Rs = Ci({
1858
- ArrowLeft: Lt("horiz", -1),
1859
- ArrowRight: Lt("horiz", 1),
1860
- ArrowUp: Lt("vert", -1),
1861
- ArrowDown: Lt("vert", 1)
1862
- });
1863
- function Lt(t, e) {
1864
- const n = t == "vert" ? e > 0 ? "down" : "up" : e > 0 ? "right" : "left";
1865
- return function(r, i, o) {
1866
- let s = r.selection, a = e > 0 ? s.$to : s.$from, l = s.empty;
1867
- if (s instanceof _) {
1868
- if (!o.endOfTextblock(n) || a.depth == 0)
1869
- return !1;
1870
- l = !1, a = r.doc.resolve(e > 0 ? a.after() : a.before());
1871
- }
1872
- let c = N.findGapCursorFrom(a, e, l);
1873
- return c ? (i && i(r.tr.setSelection(new N(c))), !0) : !1;
1874
- };
1875
- }
1876
- function $s(t, e, n) {
1877
- if (!t || !t.editable)
1878
- return !1;
1879
- let r = t.state.doc.resolve(e);
1880
- if (!N.valid(r))
1881
- return !1;
1882
- let i = t.posAtCoords({ left: n.clientX, top: n.clientY });
1883
- return i && i.inside > -1 && ft.isSelectable(t.state.doc.nodeAt(i.inside)) ? !1 : (t.dispatch(t.state.tr.setSelection(new N(r))), !0);
1884
- }
1885
- function Bs(t, e) {
1886
- if (e.inputType != "insertCompositionText" || !(t.state.selection instanceof N))
1887
- return !1;
1888
- let { $from: n } = t.state.selection, r = n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);
1889
- if (!r)
1890
- return !1;
1891
- let i = Me.empty;
1892
- for (let s = r.length - 1; s >= 0; s--)
1893
- i = Me.from(r[s].createAndFill(null, i));
1894
- let o = t.state.tr.replace(n.pos, n.pos, new ln(i, 0, 0));
1895
- return o.setSelection(_.near(o.doc.resolve(n.pos + 1))), t.dispatch(o), !1;
1896
- }
1897
- function Hs(t) {
1898
- if (!(t.selection instanceof N))
1899
- return null;
1900
- let e = document.createElement("div");
1901
- return e.className = "ProseMirror-gapcursor", nr.create(t.doc, [tr.widget(t.selection.head, e, { key: "gapcursor" })]);
1902
- }
1903
- const js = Ge.create({
1904
- name: "gapCursor",
1905
- addProseMirrorPlugins() {
1906
- return [
1907
- Ns()
1908
- ];
1909
- },
1910
- extendNodeSchema(t) {
1911
- var e;
1912
- const n = {
1913
- name: t.name,
1914
- options: t.options,
1915
- storage: t.storage
1916
- };
1917
- return {
1918
- allowGapCursor: (e = Ei(Ai(t, "allowGapCursor", n))) !== null && e !== void 0 ? e : null
1919
- };
1920
- }
1921
- }), _s = se.create({
1922
- name: "hardBreak",
1923
- addOptions() {
1924
- return {
1925
- keepMarks: !0,
1926
- HTMLAttributes: {}
1927
- };
1928
- },
1929
- inline: !0,
1930
- group: "inline",
1931
- selectable: !1,
1932
- linebreakReplacement: !0,
1933
- parseHTML() {
1934
- return [
1935
- { tag: "br" }
1936
- ];
1937
- },
1938
- renderHTML({ HTMLAttributes: t }) {
1939
- return ["br", K(this.options.HTMLAttributes, t)];
1940
- },
1941
- renderText() {
1942
- return `
1943
- `;
1944
- },
1945
- addCommands() {
1946
- return {
1947
- setHardBreak: () => ({ commands: t, chain: e, state: n, editor: r }) => t.first([
1948
- () => t.exitCode(),
1949
- () => t.command(() => {
1950
- const { selection: i, storedMarks: o } = n;
1951
- if (i.$from.parent.type.spec.isolating)
1952
- return !1;
1953
- const { keepMarks: s } = this.options, { splittableMarks: a } = r.extensionManager, l = o || i.$to.parentOffset && i.$from.marks();
1954
- return e().insertContent({ type: this.name }).command(({ tr: c, dispatch: u }) => {
1955
- if (u && l && s) {
1956
- const p = l.filter((f) => a.includes(f.type.name));
1957
- c.ensureMarks(p);
1958
- }
1959
- return !0;
1960
- }).run();
1961
- })
1962
- ])
1963
- };
1964
- },
1965
- addKeyboardShortcuts() {
1966
- return {
1967
- "Mod-Enter": () => this.editor.commands.setHardBreak(),
1968
- "Shift-Enter": () => this.editor.commands.setHardBreak()
1969
- };
1970
- }
1971
- }), Fs = se.create({
1972
- name: "heading",
1973
- addOptions() {
1974
- return {
1975
- levels: [1, 2, 3, 4, 5, 6],
1976
- HTMLAttributes: {}
1977
- };
1978
- },
1979
- content: "inline*",
1980
- group: "block",
1981
- defining: !0,
1982
- addAttributes() {
1983
- return {
1984
- level: {
1985
- default: 1,
1986
- rendered: !1
1987
- }
1988
- };
1989
- },
1990
- parseHTML() {
1991
- return this.options.levels.map((t) => ({
1992
- tag: `h${t}`,
1993
- attrs: { level: t }
1994
- }));
1995
- },
1996
- renderHTML({ node: t, HTMLAttributes: e }) {
1997
- return [`h${this.options.levels.includes(t.attrs.level) ? t.attrs.level : this.options.levels[0]}`, K(this.options.HTMLAttributes, e), 0];
1998
- },
1999
- addCommands() {
2000
- return {
2001
- setHeading: (t) => ({ commands: e }) => this.options.levels.includes(t.level) ? e.setNode(this.name, t) : !1,
2002
- toggleHeading: (t) => ({ commands: e }) => this.options.levels.includes(t.level) ? e.toggleNode(this.name, "paragraph", t) : !1
2003
- };
2004
- },
2005
- addKeyboardShortcuts() {
2006
- return this.options.levels.reduce((t, e) => ({
2007
- ...t,
2008
- [`Mod-Alt-${e}`]: () => this.editor.commands.toggleHeading({ level: e })
2009
- }), {});
2010
- },
2011
- addInputRules() {
2012
- return this.options.levels.map((t) => tn({
2013
- find: new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),
2014
- type: this.type,
2015
- getAttributes: {
2016
- level: t
2017
- }
2018
- }));
2019
- }
2020
- });
2021
- var jt = 200, $ = function() {
2022
- };
2023
- $.prototype.append = function(e) {
2024
- return e.length ? (e = $.from(e), !this.length && e || e.length < jt && this.leafAppend(e) || this.length < jt && e.leafPrepend(this) || this.appendInner(e)) : this;
2025
- };
2026
- $.prototype.prepend = function(e) {
2027
- return e.length ? $.from(e).append(this) : this;
2028
- };
2029
- $.prototype.appendInner = function(e) {
2030
- return new Vs(this, e);
2031
- };
2032
- $.prototype.slice = function(e, n) {
2033
- return e === void 0 && (e = 0), n === void 0 && (n = this.length), e >= n ? $.empty : this.sliceInner(Math.max(0, e), Math.min(this.length, n));
2034
- };
2035
- $.prototype.get = function(e) {
2036
- if (!(e < 0 || e >= this.length))
2037
- return this.getInner(e);
2038
- };
2039
- $.prototype.forEach = function(e, n, r) {
2040
- 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);
2041
- };
2042
- $.prototype.map = function(e, n, r) {
2043
- n === void 0 && (n = 0), r === void 0 && (r = this.length);
2044
- var i = [];
2045
- return this.forEach(function(o, s) {
2046
- return i.push(e(o, s));
2047
- }, n, r), i;
2048
- };
2049
- $.from = function(e) {
2050
- return e instanceof $ ? e : e && e.length ? new yr(e) : $.empty;
2051
- };
2052
- var yr = /* @__PURE__ */ function(t) {
2053
- function e(r) {
2054
- t.call(this), this.values = r;
2055
- }
2056
- t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e;
2057
- var n = { length: { configurable: !0 }, depth: { configurable: !0 } };
2058
- return e.prototype.flatten = function() {
2059
- return this.values;
2060
- }, e.prototype.sliceInner = function(i, o) {
2061
- return i == 0 && o == this.length ? this : new e(this.values.slice(i, o));
2062
- }, e.prototype.getInner = function(i) {
2063
- return this.values[i];
2064
- }, e.prototype.forEachInner = function(i, o, s, a) {
2065
- for (var l = o; l < s; l++)
2066
- if (i(this.values[l], a + l) === !1)
2067
- return !1;
2068
- }, e.prototype.forEachInvertedInner = function(i, o, s, a) {
2069
- for (var l = o - 1; l >= s; l--)
2070
- if (i(this.values[l], a + l) === !1)
2071
- return !1;
2072
- }, e.prototype.leafAppend = function(i) {
2073
- if (this.length + i.length <= jt)
2074
- return new e(this.values.concat(i.flatten()));
2075
- }, e.prototype.leafPrepend = function(i) {
2076
- if (this.length + i.length <= jt)
2077
- return new e(i.flatten().concat(this.values));
2078
- }, n.length.get = function() {
2079
- return this.values.length;
2080
- }, n.depth.get = function() {
2081
- return 0;
2082
- }, Object.defineProperties(e.prototype, n), e;
2083
- }($);
2084
- $.empty = new yr([]);
2085
- var Vs = /* @__PURE__ */ function(t) {
2086
- function e(n, r) {
2087
- t.call(this), this.left = n, this.right = r, this.length = n.length + r.length, this.depth = Math.max(n.depth, r.depth) + 1;
2088
- }
2089
- return t && (e.__proto__ = t), e.prototype = Object.create(t && t.prototype), e.prototype.constructor = e, e.prototype.flatten = function() {
2090
- return this.left.flatten().concat(this.right.flatten());
2091
- }, e.prototype.getInner = function(r) {
2092
- return r < this.left.length ? this.left.get(r) : this.right.get(r - this.left.length);
2093
- }, e.prototype.forEachInner = function(r, i, o, s) {
2094
- var a = this.left.length;
2095
- if (i < a && this.left.forEachInner(r, i, Math.min(o, a), s) === !1 || o > a && this.right.forEachInner(r, Math.max(i - a, 0), Math.min(this.length, o) - a, s + a) === !1)
2096
- return !1;
2097
- }, e.prototype.forEachInvertedInner = function(r, i, o, s) {
2098
- var a = this.left.length;
2099
- if (i > a && this.right.forEachInvertedInner(r, i - a, Math.max(o, a) - a, s + a) === !1 || o < a && this.left.forEachInvertedInner(r, Math.min(i, a), o, s) === !1)
2100
- return !1;
2101
- }, e.prototype.sliceInner = function(r, i) {
2102
- if (r == 0 && i == this.length)
2103
- return this;
2104
- var o = this.left.length;
2105
- return i <= o ? this.left.slice(r, i) : r >= o ? this.right.slice(r - o, i - o) : this.left.slice(r, o).append(this.right.slice(0, i - o));
2106
- }, e.prototype.leafAppend = function(r) {
2107
- var i = this.right.leafAppend(r);
2108
- if (i)
2109
- return new e(this.left, i);
2110
- }, e.prototype.leafPrepend = function(r) {
2111
- var i = this.left.leafPrepend(r);
2112
- if (i)
2113
- return new e(i, this.right);
2114
- }, e.prototype.appendInner = function(r) {
2115
- 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);
2116
- }, e;
2117
- }($);
2118
- const Ws = 500;
2119
- class ie {
2120
- constructor(e, n) {
2121
- this.items = e, this.eventCount = n;
2122
- }
2123
- // Pop the latest event off the branch's history and apply it
2124
- // to a document transform.
2125
- popEvent(e, n) {
2126
- if (this.eventCount == 0)
2127
- return null;
2128
- let r = this.items.length;
2129
- for (; ; r--)
2130
- if (this.items.get(r - 1).selection) {
2131
- --r;
2132
- break;
2133
- }
2134
- let i, o;
2135
- n && (i = this.remapping(r, this.items.length), o = i.maps.length);
2136
- let s = e.tr, a, l, c = [], u = [];
2137
- return this.items.forEach((p, f) => {
2138
- if (!p.step) {
2139
- i || (i = this.remapping(r, f + 1), o = i.maps.length), o--, u.push(p);
2140
- return;
2141
- }
2142
- if (i) {
2143
- u.push(new ue(p.map));
2144
- let h = p.step.map(i.slice(o)), y;
2145
- h && s.maybeStep(h).doc && (y = s.mapping.maps[s.mapping.maps.length - 1], c.push(new ue(y, void 0, void 0, c.length + u.length))), o--, y && i.appendMap(y, o);
2146
- } else
2147
- s.maybeStep(p.step);
2148
- if (p.selection)
2149
- return a = i ? p.selection.map(i.slice(o)) : p.selection, l = new ie(this.items.slice(0, r).append(u.reverse().concat(c)), this.eventCount - 1), !1;
2150
- }, this.items.length, 0), { remaining: l, transform: s, selection: a };
2151
- }
2152
- // Create a new branch with the given transform added.
2153
- addTransform(e, n, r, i) {
2154
- let o = [], s = this.eventCount, a = this.items, l = !i && a.length ? a.get(a.length - 1) : null;
2155
- for (let u = 0; u < e.steps.length; u++) {
2156
- let p = e.steps[u].invert(e.docs[u]), f = new ue(e.mapping.maps[u], p, n), h;
2157
- (h = l && l.merge(f)) && (f = h, u ? o.pop() : a = a.slice(0, a.length - 1)), o.push(f), n && (s++, n = void 0), i || (l = f);
2158
- }
2159
- let c = s - r.depth;
2160
- return c > Ks && (a = zs(a, c), s -= c), new ie(a.append(o), s);
2161
- }
2162
- remapping(e, n) {
2163
- let r = new Si();
2164
- return this.items.forEach((i, o) => {
2165
- let s = i.mirrorOffset != null && o - i.mirrorOffset >= e ? r.maps.length - i.mirrorOffset : void 0;
2166
- r.appendMap(i.map, s);
2167
- }, e, n), r;
2168
- }
2169
- addMaps(e) {
2170
- return this.eventCount == 0 ? this : new ie(this.items.append(e.map((n) => new ue(n))), this.eventCount);
2171
- }
2172
- // When the collab module receives remote changes, the history has
2173
- // to know about those, so that it can adjust the steps that were
2174
- // rebased on top of the remote changes, and include the position
2175
- // maps for the remote changes in its array of items.
2176
- rebased(e, n) {
2177
- if (!this.eventCount)
2178
- return this;
2179
- let r = [], i = Math.max(0, this.items.length - n), o = e.mapping, s = e.steps.length, a = this.eventCount;
2180
- this.items.forEach((f) => {
2181
- f.selection && a--;
2182
- }, i);
2183
- let l = n;
2184
- this.items.forEach((f) => {
2185
- let h = o.getMirror(--l);
2186
- if (h == null)
2187
- return;
2188
- s = Math.min(s, h);
2189
- let y = o.maps[h];
2190
- if (f.step) {
2191
- let v = e.steps[h].invert(e.docs[h]), g = f.selection && f.selection.map(o.slice(l + 1, h));
2192
- g && a++, r.push(new ue(y, v, g));
2193
- } else
2194
- r.push(new ue(y));
2195
- }, i);
2196
- let c = [];
2197
- for (let f = n; f < s; f++)
2198
- c.push(new ue(o.maps[f]));
2199
- let u = this.items.slice(0, i).append(c).append(r), p = new ie(u, a);
2200
- return p.emptyItemCount() > Ws && (p = p.compress(this.items.length - r.length)), p;
2201
- }
2202
- emptyItemCount() {
2203
- let e = 0;
2204
- return this.items.forEach((n) => {
2205
- n.step || e++;
2206
- }), e;
2207
- }
2208
- // Compressing a branch means rewriting it to push the air (map-only
2209
- // items) out. During collaboration, these naturally accumulate
2210
- // because each remote change adds one. The `upto` argument is used
2211
- // to ensure that only the items below a given level are compressed,
2212
- // because `rebased` relies on a clean, untouched set of items in
2213
- // order to associate old items with rebased steps.
2214
- compress(e = this.items.length) {
2215
- let n = this.remapping(0, e), r = n.maps.length, i = [], o = 0;
2216
- return this.items.forEach((s, a) => {
2217
- if (a >= e)
2218
- i.push(s), s.selection && o++;
2219
- else if (s.step) {
2220
- let l = s.step.map(n.slice(r)), c = l && l.getMap();
2221
- if (r--, c && n.appendMap(c, r), l) {
2222
- let u = s.selection && s.selection.map(n.slice(r));
2223
- u && o++;
2224
- let p = new ue(c.invert(), l, u), f, h = i.length - 1;
2225
- (f = i.length && i[h].merge(p)) ? i[h] = f : i.push(p);
2226
- }
2227
- } else s.map && r--;
2228
- }, this.items.length, 0), new ie($.from(i.reverse()), o);
2229
- }
2230
- }
2231
- ie.empty = new ie($.empty, 0);
2232
- function zs(t, e) {
2233
- let n;
2234
- return t.forEach((r, i) => {
2235
- if (r.selection && e-- == 0)
2236
- return n = i, !1;
2237
- }), t.slice(n);
2238
- }
2239
- class ue {
2240
- constructor(e, n, r, i) {
2241
- this.map = e, this.step = n, this.selection = r, this.mirrorOffset = i;
2242
- }
2243
- merge(e) {
2244
- if (this.step && e.step && !e.selection) {
2245
- let n = e.step.merge(this.step);
2246
- if (n)
2247
- return new ue(n.getMap().invert(), n, this.selection);
2248
- }
2249
- }
2250
- }
2251
- class ke {
2252
- constructor(e, n, r, i, o) {
2253
- this.done = e, this.undone = n, this.prevRanges = r, this.prevTime = i, this.prevComposition = o;
2254
- }
2255
- }
2256
- const Ks = 20;
2257
- function Us(t, e, n, r) {
2258
- let i = n.getMeta(De), o;
2259
- if (i)
2260
- return i.historyState;
2261
- n.getMeta(Gs) && (t = new ke(t.done, t.undone, null, 0, -1));
2262
- let s = n.getMeta("appendedTransaction");
2263
- if (n.steps.length == 0)
2264
- return t;
2265
- if (s && s.getMeta(De))
2266
- return s.getMeta(De).redo ? new ke(t.done.addTransform(n, void 0, r, $t(e)), t.undone, Ln(n.mapping.maps), t.prevTime, t.prevComposition) : new ke(t.done, t.undone.addTransform(n, void 0, r, $t(e)), null, t.prevTime, t.prevComposition);
2267
- if (n.getMeta("addToHistory") !== !1 && !(s && s.getMeta("addToHistory") === !1)) {
2268
- let a = n.getMeta("composition"), l = t.prevTime == 0 || !s && t.prevComposition != a && (t.prevTime < (n.time || 0) - r.newGroupDelay || !qs(n, t.prevRanges)), c = s ? Gt(t.prevRanges, n.mapping) : Ln(n.mapping.maps);
2269
- return new ke(t.done.addTransform(n, l ? e.selection.getBookmark() : void 0, r, $t(e)), ie.empty, c, n.time, a ?? t.prevComposition);
2270
- } else return (o = n.getMeta("rebased")) ? new ke(t.done.rebased(n, o), t.undone.rebased(n, o), Gt(t.prevRanges, n.mapping), t.prevTime, t.prevComposition) : new ke(t.done.addMaps(n.mapping.maps), t.undone.addMaps(n.mapping.maps), Gt(t.prevRanges, n.mapping), t.prevTime, t.prevComposition);
2271
- }
2272
- function qs(t, e) {
2273
- if (!e)
2274
- return !1;
2275
- if (!t.docChanged)
2276
- return !0;
2277
- let n = !1;
2278
- return t.mapping.maps[0].forEach((r, i) => {
2279
- for (let o = 0; o < e.length; o += 2)
2280
- r <= e[o + 1] && i >= e[o] && (n = !0);
2281
- }), n;
2282
- }
2283
- function Ln(t) {
2284
- let e = [];
2285
- for (let n = t.length - 1; n >= 0 && e.length == 0; n--)
2286
- t[n].forEach((r, i, o, s) => e.push(o, s));
2287
- return e;
2288
- }
2289
- function Gt(t, e) {
2290
- if (!t)
2291
- return null;
2292
- let n = [];
2293
- for (let r = 0; r < t.length; r += 2) {
2294
- let i = e.map(t[r], 1), o = e.map(t[r + 1], -1);
2295
- i <= o && n.push(i, o);
2296
- }
2297
- return n;
2298
- }
2299
- function Ys(t, e, n) {
2300
- let r = $t(e), i = De.get(e).spec.config, o = (n ? t.undone : t.done).popEvent(e, r);
2301
- if (!o)
2302
- return null;
2303
- let s = o.selection.resolve(o.transform.doc), a = (n ? t.done : t.undone).addTransform(o.transform, e.selection.getBookmark(), i, r), l = new ke(n ? a : o.remaining, n ? o.remaining : a, null, 0, -1);
2304
- return o.transform.setSelection(s).setMeta(De, { redo: n, historyState: l });
2305
- }
2306
- let Xt = !1, Pn = null;
2307
- function $t(t) {
2308
- let e = t.plugins;
2309
- if (Pn != e) {
2310
- Xt = !1, Pn = e;
2311
- for (let n = 0; n < e.length; n++)
2312
- if (e[n].spec.historyPreserveItems) {
2313
- Xt = !0;
2314
- break;
2315
- }
2316
- }
2317
- return Xt;
2318
- }
2319
- const De = new J("history"), Gs = new J("closeHistory");
2320
- function Xs(t = {}) {
2321
- return t = {
2322
- depth: t.depth || 100,
2323
- newGroupDelay: t.newGroupDelay || 500
2324
- }, new U({
2325
- key: De,
2326
- state: {
2327
- init() {
2328
- return new ke(ie.empty, ie.empty, null, 0, -1);
2329
- },
2330
- apply(e, n, r) {
2331
- return Us(n, r, e, t);
2332
- }
2333
- },
2334
- config: t,
2335
- props: {
2336
- handleDOMEvents: {
2337
- beforeinput(e, n) {
2338
- let r = n.inputType, i = r == "historyUndo" ? wr : r == "historyRedo" ? xr : null;
2339
- return !i || !e.editable ? !1 : (n.preventDefault(), i(e.state, e.dispatch));
2340
- }
2341
- }
2342
- }
2343
- });
2344
- }
2345
- function br(t, e) {
2346
- return (n, r) => {
2347
- let i = De.getState(n);
2348
- if (!i || (t ? i.undone : i.done).eventCount == 0)
2349
- return !1;
2350
- if (r) {
2351
- let o = Ys(i, n, t);
2352
- o && r(e ? o.scrollIntoView() : o);
2353
- }
2354
- return !0;
2355
- };
2356
- }
2357
- const wr = br(!1, !0), xr = br(!0, !0), Js = Ge.create({
2358
- name: "history",
2359
- addOptions() {
2360
- return {
2361
- depth: 100,
2362
- newGroupDelay: 500
2363
- };
2364
- },
2365
- addCommands() {
2366
- return {
2367
- undo: () => ({ state: t, dispatch: e }) => wr(t, e),
2368
- redo: () => ({ state: t, dispatch: e }) => xr(t, e)
2369
- };
2370
- },
2371
- addProseMirrorPlugins() {
2372
- return [
2373
- Xs(this.options)
2374
- ];
2375
- },
2376
- addKeyboardShortcuts() {
2377
- return {
2378
- "Mod-z": () => this.editor.commands.undo(),
2379
- "Shift-Mod-z": () => this.editor.commands.redo(),
2380
- "Mod-y": () => this.editor.commands.redo(),
2381
- // Russian keyboard layouts
2382
- "Mod-я": () => this.editor.commands.undo(),
2383
- "Shift-Mod-я": () => this.editor.commands.redo()
2384
- };
2385
- }
2386
- }), Zs = se.create({
2387
- name: "horizontalRule",
2388
- addOptions() {
2389
- return {
2390
- HTMLAttributes: {}
2391
- };
2392
- },
2393
- group: "block",
2394
- parseHTML() {
2395
- return [{ tag: "hr" }];
2396
- },
2397
- renderHTML({ HTMLAttributes: t }) {
2398
- return ["hr", K(this.options.HTMLAttributes, t)];
2399
- },
2400
- addCommands() {
2401
- return {
2402
- setHorizontalRule: () => ({ chain: t, state: e }) => {
2403
- if (!Li(e, e.schema.nodes[this.name]))
2404
- return !1;
2405
- const { selection: n } = e, { $from: r, $to: i } = n, o = t();
2406
- return r.parentOffset === 0 ? o.insertContentAt({
2407
- from: Math.max(r.pos - 1, 0),
2408
- to: i.pos
2409
- }, {
2410
- type: this.name
2411
- }) : or(n) ? o.insertContentAt(i.pos, {
2412
- type: this.name
2413
- }) : o.insertContent({ type: this.name }), o.command(({ tr: s, dispatch: a }) => {
2414
- var l;
2415
- if (a) {
2416
- const { $to: c } = s.selection, u = c.end();
2417
- if (c.nodeAfter)
2418
- c.nodeAfter.isTextblock ? s.setSelection(_.create(s.doc, c.pos + 1)) : c.nodeAfter.isBlock ? s.setSelection(ft.create(s.doc, c.pos)) : s.setSelection(_.create(s.doc, c.pos));
2419
- else {
2420
- const p = (l = c.parent.type.contentMatch.defaultType) === null || l === void 0 ? void 0 : l.create();
2421
- p && (s.insert(u, p), s.setSelection(_.create(s.doc, u + 1)));
2422
- }
2423
- s.scrollIntoView();
2424
- }
2425
- return !0;
2426
- }).run();
2427
- }
2428
- };
2429
- },
2430
- addInputRules() {
2431
- return [
2432
- Ii({
2433
- find: /^(?:---|—-|___\s|\*\*\*\s)$/,
2434
- type: this.type
2435
- })
2436
- ];
2437
- }
2438
- }), Qs = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/, ea = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g, ta = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/, na = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g, ra = Vt.create({
2439
- name: "italic",
2440
- addOptions() {
2441
- return {
2442
- HTMLAttributes: {}
2443
- };
2444
- },
2445
- parseHTML() {
2446
- return [
2447
- {
2448
- tag: "em"
2449
- },
2450
- {
2451
- tag: "i",
2452
- getAttrs: (t) => t.style.fontStyle !== "normal" && null
2453
- },
2454
- {
2455
- style: "font-style=normal",
2456
- clearMark: (t) => t.type.name === this.name
2457
- },
2458
- {
2459
- style: "font-style=italic"
2460
- }
2461
- ];
2462
- },
2463
- renderHTML({ HTMLAttributes: t }) {
2464
- return ["em", K(this.options.HTMLAttributes, t), 0];
2465
- },
2466
- addCommands() {
2467
- return {
2468
- setItalic: () => ({ commands: t }) => t.setMark(this.name),
2469
- toggleItalic: () => ({ commands: t }) => t.toggleMark(this.name),
2470
- unsetItalic: () => ({ commands: t }) => t.unsetMark(this.name)
2471
- };
2472
- },
2473
- addKeyboardShortcuts() {
2474
- return {
2475
- "Mod-i": () => this.editor.commands.toggleItalic(),
2476
- "Mod-I": () => this.editor.commands.toggleItalic()
2477
- };
2478
- },
2479
- addInputRules() {
2480
- return [
2481
- ze({
2482
- find: Qs,
2483
- type: this.type
2484
- }),
2485
- ze({
2486
- find: ta,
2487
- type: this.type
2488
- })
2489
- ];
2490
- },
2491
- addPasteRules() {
2492
- return [
2493
- We({
2494
- find: ea,
2495
- type: this.type
2496
- }),
2497
- We({
2498
- find: na,
2499
- type: this.type
2500
- })
2501
- ];
2502
- }
2503
- }), ia = se.create({
2504
- name: "listItem",
2505
- addOptions() {
2506
- return {
2507
- HTMLAttributes: {},
2508
- bulletListTypeName: "bulletList",
2509
- orderedListTypeName: "orderedList"
2510
- };
2511
- },
2512
- content: "paragraph block*",
2513
- defining: !0,
2514
- parseHTML() {
2515
- return [
2516
- {
2517
- tag: "li"
2518
- }
2519
- ];
2520
- },
2521
- renderHTML({ HTMLAttributes: t }) {
2522
- return ["li", K(this.options.HTMLAttributes, t), 0];
2523
- },
2524
- addKeyboardShortcuts() {
2525
- return {
2526
- Enter: () => this.editor.commands.splitListItem(this.name),
2527
- Tab: () => this.editor.commands.sinkListItem(this.name),
2528
- "Shift-Tab": () => this.editor.commands.liftListItem(this.name)
2529
- };
2530
- }
2531
- }), oa = "listItem", Dn = "textStyle", Nn = /^(\d+)\.\s$/, sa = se.create({
2532
- name: "orderedList",
2533
- addOptions() {
2534
- return {
2535
- itemTypeName: "listItem",
2536
- HTMLAttributes: {},
2537
- keepMarks: !1,
2538
- keepAttributes: !1
2539
- };
2540
- },
2541
- group: "block list",
2542
- content() {
2543
- return `${this.options.itemTypeName}+`;
2544
- },
2545
- addAttributes() {
2546
- return {
2547
- start: {
2548
- default: 1,
2549
- parseHTML: (t) => t.hasAttribute("start") ? parseInt(t.getAttribute("start") || "", 10) : 1
2550
- },
2551
- type: {
2552
- default: null,
2553
- parseHTML: (t) => t.getAttribute("type")
2554
- }
2555
- };
2556
- },
2557
- parseHTML() {
2558
- return [
2559
- {
2560
- tag: "ol"
2561
- }
2562
- ];
2563
- },
2564
- renderHTML({ HTMLAttributes: t }) {
2565
- const { start: e, ...n } = t;
2566
- return e === 1 ? ["ol", K(this.options.HTMLAttributes, n), 0] : ["ol", K(this.options.HTMLAttributes, t), 0];
2567
- },
2568
- addCommands() {
2569
- return {
2570
- toggleOrderedList: () => ({ commands: t, chain: e }) => this.options.keepAttributes ? e().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(oa, this.editor.getAttributes(Dn)).run() : t.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)
2571
- };
2572
- },
2573
- addKeyboardShortcuts() {
2574
- return {
2575
- "Mod-Shift-7": () => this.editor.commands.toggleOrderedList()
2576
- };
2577
- },
2578
- addInputRules() {
2579
- let t = at({
2580
- find: Nn,
2581
- type: this.type,
2582
- getAttributes: (e) => ({ start: +e[1] }),
2583
- joinPredicate: (e, n) => n.childCount + n.attrs.start === +e[1]
2584
- });
2585
- return (this.options.keepMarks || this.options.keepAttributes) && (t = at({
2586
- find: Nn,
2587
- type: this.type,
2588
- keepMarks: this.options.keepMarks,
2589
- keepAttributes: this.options.keepAttributes,
2590
- getAttributes: (e) => ({ start: +e[1], ...this.editor.getAttributes(Dn) }),
2591
- joinPredicate: (e, n) => n.childCount + n.attrs.start === +e[1],
2592
- editor: this.editor
2593
- })), [
2594
- t
2595
- ];
2596
- }
2597
- }), aa = se.create({
2598
- name: "paragraph",
2599
- priority: 1e3,
2600
- addOptions() {
2601
- return {
2602
- HTMLAttributes: {}
2603
- };
2604
- },
2605
- group: "block",
2606
- content: "inline*",
2607
- parseHTML() {
2608
- return [
2609
- { tag: "p" }
2610
- ];
2611
- },
2612
- renderHTML({ HTMLAttributes: t }) {
2613
- return ["p", K(this.options.HTMLAttributes, t), 0];
2614
- },
2615
- addCommands() {
2616
- return {
2617
- setParagraph: () => ({ commands: t }) => t.setNode(this.name)
2618
- };
2619
- },
2620
- addKeyboardShortcuts() {
2621
- return {
2622
- "Mod-Alt-0": () => this.editor.commands.setParagraph()
2623
- };
2624
- }
2625
- }), la = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/, ca = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g, ua = Vt.create({
2626
- name: "strike",
2627
- addOptions() {
2628
- return {
2629
- HTMLAttributes: {}
2630
- };
2631
- },
2632
- parseHTML() {
2633
- return [
2634
- {
2635
- tag: "s"
2636
- },
2637
- {
2638
- tag: "del"
2639
- },
2640
- {
2641
- tag: "strike"
2642
- },
2643
- {
2644
- style: "text-decoration",
2645
- consuming: !1,
2646
- getAttrs: (t) => t.includes("line-through") ? {} : !1
2647
- }
2648
- ];
2649
- },
2650
- renderHTML({ HTMLAttributes: t }) {
2651
- return ["s", K(this.options.HTMLAttributes, t), 0];
2652
- },
2653
- addCommands() {
2654
- return {
2655
- setStrike: () => ({ commands: t }) => t.setMark(this.name),
2656
- toggleStrike: () => ({ commands: t }) => t.toggleMark(this.name),
2657
- unsetStrike: () => ({ commands: t }) => t.unsetMark(this.name)
2658
- };
2659
- },
2660
- addKeyboardShortcuts() {
2661
- return {
2662
- "Mod-Shift-s": () => this.editor.commands.toggleStrike()
2663
- };
2664
- },
2665
- addInputRules() {
2666
- return [
2667
- ze({
2668
- find: la,
2669
- type: this.type
2670
- })
2671
- ];
2672
- },
2673
- addPasteRules() {
2674
- return [
2675
- We({
2676
- find: ca,
2677
- type: this.type
2678
- })
2679
- ];
2680
- }
2681
- }), da = se.create({
2682
- name: "text",
2683
- group: "inline"
2684
- }), Xl = ee.create({
2685
- name: "starterKit",
2686
- addExtensions() {
2687
- var t, e, n, r, i, o, s, a, l, c, u, p, f, h, y, v, g, w;
2688
- const x = [];
2689
- return this.options.bold !== !1 && x.push(bs.configure((t = this.options) === null || t === void 0 ? void 0 : t.bold)), this.options.blockquote !== !1 && x.push(hs.configure((e = this.options) === null || e === void 0 ? void 0 : e.blockquote)), this.options.bulletList !== !1 && x.push(xs.configure((n = this.options) === null || n === void 0 ? void 0 : n.bulletList)), this.options.code !== !1 && x.push(Ts.configure((r = this.options) === null || r === void 0 ? void 0 : r.code)), this.options.codeBlock !== !1 && x.push(Es.configure((i = this.options) === null || i === void 0 ? void 0 : i.codeBlock)), this.options.document !== !1 && x.push(As.configure((o = this.options) === null || o === void 0 ? void 0 : o.document)), this.options.dropcursor !== !1 && x.push(Ls.configure((s = this.options) === null || s === void 0 ? void 0 : s.dropcursor)), this.options.gapcursor !== !1 && x.push(js.configure((a = this.options) === null || a === void 0 ? void 0 : a.gapcursor)), this.options.hardBreak !== !1 && x.push(_s.configure((l = this.options) === null || l === void 0 ? void 0 : l.hardBreak)), this.options.heading !== !1 && x.push(Fs.configure((c = this.options) === null || c === void 0 ? void 0 : c.heading)), this.options.history !== !1 && x.push(Js.configure((u = this.options) === null || u === void 0 ? void 0 : u.history)), this.options.horizontalRule !== !1 && x.push(Zs.configure((p = this.options) === null || p === void 0 ? void 0 : p.horizontalRule)), this.options.italic !== !1 && x.push(ra.configure((f = this.options) === null || f === void 0 ? void 0 : f.italic)), this.options.listItem !== !1 && x.push(ia.configure((h = this.options) === null || h === void 0 ? void 0 : h.listItem)), this.options.orderedList !== !1 && x.push(sa.configure((y = this.options) === null || y === void 0 ? void 0 : y.orderedList)), this.options.paragraph !== !1 && x.push(aa.configure((v = this.options) === null || v === void 0 ? void 0 : v.paragraph)), this.options.strike !== !1 && x.push(ua.configure((g = this.options) === null || g === void 0 ? void 0 : g.strike)), this.options.text !== !1 && x.push(da.configure((w = this.options) === null || w === void 0 ? void 0 : w.text)), x;
2690
- }
2691
- });
2692
- var W = "top", te = "bottom", ne = "right", z = "left", mn = "auto", vt = [W, te, ne, z], Ke = "start", ct = "end", pa = "clippingParents", kr = "viewport", nt = "popper", fa = "reference", Rn = /* @__PURE__ */ vt.reduce(function(t, e) {
2693
- return t.concat([e + "-" + Ke, e + "-" + ct]);
2694
- }, []), Mr = /* @__PURE__ */ [].concat(vt, [mn]).reduce(function(t, e) {
2695
- return t.concat([e, e + "-" + Ke, e + "-" + ct]);
2696
- }, []), ha = "beforeRead", ma = "read", va = "afterRead", ga = "beforeMain", ya = "main", ba = "afterMain", wa = "beforeWrite", xa = "write", ka = "afterWrite", Ma = [ha, ma, va, ga, ya, ba, wa, xa, ka];
2697
- function fe(t) {
2698
- return t ? (t.nodeName || "").toLowerCase() : null;
2699
- }
2700
- function X(t) {
2701
- if (t == null)
2702
- return window;
2703
- if (t.toString() !== "[object Window]") {
2704
- var e = t.ownerDocument;
2705
- return e && e.defaultView || window;
2706
- }
2707
- return t;
2708
- }
2709
- function Re(t) {
2710
- var e = X(t).Element;
2711
- return t instanceof e || t instanceof Element;
2712
- }
2713
- function Q(t) {
2714
- var e = X(t).HTMLElement;
2715
- return t instanceof e || t instanceof HTMLElement;
2716
- }
2717
- function vn(t) {
2718
- if (typeof ShadowRoot > "u")
2719
- return !1;
2720
- var e = X(t).ShadowRoot;
2721
- return t instanceof e || t instanceof ShadowRoot;
2722
- }
2723
- function Ta(t) {
2724
- var e = t.state;
2725
- Object.keys(e.elements).forEach(function(n) {
2726
- var r = e.styles[n] || {}, i = e.attributes[n] || {}, o = e.elements[n];
2727
- !Q(o) || !fe(o) || (Object.assign(o.style, r), Object.keys(i).forEach(function(s) {
2728
- var a = i[s];
2729
- a === !1 ? o.removeAttribute(s) : o.setAttribute(s, a === !0 ? "" : a);
2730
- }));
2731
- });
2732
- }
2733
- function Oa(t) {
2734
- var e = t.state, n = {
2735
- popper: {
2736
- position: e.options.strategy,
2737
- left: "0",
2738
- top: "0",
2739
- margin: "0"
2740
- },
2741
- arrow: {
2742
- position: "absolute"
2743
- },
2744
- reference: {}
2745
- };
2746
- return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
2747
- Object.keys(e.elements).forEach(function(r) {
2748
- var i = e.elements[r], o = e.attributes[r] || {}, s = Object.keys(e.styles.hasOwnProperty(r) ? e.styles[r] : n[r]), a = s.reduce(function(l, c) {
2749
- return l[c] = "", l;
2750
- }, {});
2751
- !Q(i) || !fe(i) || (Object.assign(i.style, a), Object.keys(o).forEach(function(l) {
2752
- i.removeAttribute(l);
2753
- }));
2754
- });
2755
- };
2756
- }
2757
- const Tr = {
2758
- name: "applyStyles",
2759
- enabled: !0,
2760
- phase: "write",
2761
- fn: Ta,
2762
- effect: Oa,
2763
- requires: ["computeStyles"]
2764
- };
2765
- function pe(t) {
2766
- return t.split("-")[0];
2767
- }
2768
- var Ne = Math.max, _t = Math.min, Ue = Math.round;
2769
- function nn() {
2770
- var t = navigator.userAgentData;
2771
- return t != null && t.brands && Array.isArray(t.brands) ? t.brands.map(function(e) {
2772
- return e.brand + "/" + e.version;
2773
- }).join(" ") : navigator.userAgent;
2774
- }
2775
- function Or() {
2776
- return !/^((?!chrome|android).)*safari/i.test(nn());
2777
- }
2778
- function qe(t, e, n) {
2779
- e === void 0 && (e = !1), n === void 0 && (n = !1);
2780
- var r = t.getBoundingClientRect(), i = 1, o = 1;
2781
- e && Q(t) && (i = t.offsetWidth > 0 && Ue(r.width) / t.offsetWidth || 1, o = t.offsetHeight > 0 && Ue(r.height) / t.offsetHeight || 1);
2782
- var s = Re(t) ? X(t) : window, a = s.visualViewport, l = !Or() && n, c = (r.left + (l && a ? a.offsetLeft : 0)) / i, u = (r.top + (l && a ? a.offsetTop : 0)) / o, p = r.width / i, f = r.height / o;
2783
- return {
2784
- width: p,
2785
- height: f,
2786
- top: u,
2787
- right: c + p,
2788
- bottom: u + f,
2789
- left: c,
2790
- x: c,
2791
- y: u
2792
- };
2793
- }
2794
- function gn(t) {
2795
- var e = qe(t), n = t.offsetWidth, r = t.offsetHeight;
2796
- return Math.abs(e.width - n) <= 1 && (n = e.width), Math.abs(e.height - r) <= 1 && (r = e.height), {
2797
- x: t.offsetLeft,
2798
- y: t.offsetTop,
2799
- width: n,
2800
- height: r
2801
- };
2802
- }
2803
- function Cr(t, e) {
2804
- var n = e.getRootNode && e.getRootNode();
2805
- if (t.contains(e))
2806
- return !0;
2807
- if (n && vn(n)) {
2808
- var r = e;
2809
- do {
2810
- if (r && t.isSameNode(r))
2811
- return !0;
2812
- r = r.parentNode || r.host;
2813
- } while (r);
2814
- }
2815
- return !1;
2816
- }
2817
- function be(t) {
2818
- return X(t).getComputedStyle(t);
2819
- }
2820
- function Ca(t) {
2821
- return ["table", "td", "th"].indexOf(fe(t)) >= 0;
2822
- }
2823
- function Oe(t) {
2824
- return ((Re(t) ? t.ownerDocument : (
2825
- // $FlowFixMe[prop-missing]
2826
- t.document
2827
- )) || window.document).documentElement;
2828
- }
2829
- function Wt(t) {
2830
- return fe(t) === "html" ? t : (
2831
- // this is a quicker (but less type safe) way to save quite some bytes from the bundle
2832
- // $FlowFixMe[incompatible-return]
2833
- // $FlowFixMe[prop-missing]
2834
- t.assignedSlot || // step into the shadow DOM of the parent of a slotted node
2835
- t.parentNode || // DOM Element detected
2836
- (vn(t) ? t.host : null) || // ShadowRoot detected
2837
- // $FlowFixMe[incompatible-call]: HTMLElement is a Node
2838
- Oe(t)
2839
- );
2840
- }
2841
- function $n(t) {
2842
- return !Q(t) || // https://github.com/popperjs/popper-core/issues/837
2843
- be(t).position === "fixed" ? null : t.offsetParent;
2844
- }
2845
- function Ea(t) {
2846
- var e = /firefox/i.test(nn()), n = /Trident/i.test(nn());
2847
- if (n && Q(t)) {
2848
- var r = be(t);
2849
- if (r.position === "fixed")
2850
- return null;
2851
- }
2852
- var i = Wt(t);
2853
- for (vn(i) && (i = i.host); Q(i) && ["html", "body"].indexOf(fe(i)) < 0; ) {
2854
- var o = be(i);
2855
- if (o.transform !== "none" || o.perspective !== "none" || o.contain === "paint" || ["transform", "perspective"].indexOf(o.willChange) !== -1 || e && o.willChange === "filter" || e && o.filter && o.filter !== "none")
2856
- return i;
2857
- i = i.parentNode;
2858
- }
2859
- return null;
2860
- }
2861
- function gt(t) {
2862
- for (var e = X(t), n = $n(t); n && Ca(n) && be(n).position === "static"; )
2863
- n = $n(n);
2864
- return n && (fe(n) === "html" || fe(n) === "body" && be(n).position === "static") ? e : n || Ea(t) || e;
2865
- }
2866
- function yn(t) {
2867
- return ["top", "bottom"].indexOf(t) >= 0 ? "x" : "y";
2868
- }
2869
- function it(t, e, n) {
2870
- return Ne(t, _t(e, n));
2871
- }
2872
- function Aa(t, e, n) {
2873
- var r = it(t, e, n);
2874
- return r > n ? n : r;
2875
- }
2876
- function Er() {
2877
- return {
2878
- top: 0,
2879
- right: 0,
2880
- bottom: 0,
2881
- left: 0
2882
- };
2883
- }
2884
- function Ar(t) {
2885
- return Object.assign({}, Er(), t);
2886
- }
2887
- function Sr(t, e) {
2888
- return e.reduce(function(n, r) {
2889
- return n[r] = t, n;
2890
- }, {});
2891
- }
2892
- var Sa = function(e, n) {
2893
- return e = typeof e == "function" ? e(Object.assign({}, n.rects, {
2894
- placement: n.placement
2895
- })) : e, Ar(typeof e != "number" ? e : Sr(e, vt));
2896
- };
2897
- function Ia(t) {
2898
- var e, n = t.state, r = t.name, i = t.options, o = n.elements.arrow, s = n.modifiersData.popperOffsets, a = pe(n.placement), l = yn(a), c = [z, ne].indexOf(a) >= 0, u = c ? "height" : "width";
2899
- if (!(!o || !s)) {
2900
- var p = Sa(i.padding, n), f = gn(o), h = l === "y" ? W : z, y = l === "y" ? te : ne, v = n.rects.reference[u] + n.rects.reference[l] - s[l] - n.rects.popper[u], g = s[l] - n.rects.reference[l], w = gt(o), x = w ? l === "y" ? w.clientHeight || 0 : w.clientWidth || 0 : 0, O = v / 2 - g / 2, d = p[h], T = x - f[u] - p[y], b = x / 2 - f[u] / 2 + O, C = it(d, b, T), S = l;
2901
- n.modifiersData[r] = (e = {}, e[S] = C, e.centerOffset = C - b, e);
2902
- }
2903
- }
2904
- function La(t) {
2905
- var e = t.state, n = t.options, r = n.element, i = r === void 0 ? "[data-popper-arrow]" : r;
2906
- i != null && (typeof i == "string" && (i = e.elements.popper.querySelector(i), !i) || Cr(e.elements.popper, i) && (e.elements.arrow = i));
2907
- }
2908
- const Pa = {
2909
- name: "arrow",
2910
- enabled: !0,
2911
- phase: "main",
2912
- fn: Ia,
2913
- effect: La,
2914
- requires: ["popperOffsets"],
2915
- requiresIfExists: ["preventOverflow"]
2916
- };
2917
- function Ye(t) {
2918
- return t.split("-")[1];
2919
- }
2920
- var Da = {
2921
- top: "auto",
2922
- right: "auto",
2923
- bottom: "auto",
2924
- left: "auto"
2925
- };
2926
- function Na(t, e) {
2927
- var n = t.x, r = t.y, i = e.devicePixelRatio || 1;
2928
- return {
2929
- x: Ue(n * i) / i || 0,
2930
- y: Ue(r * i) / i || 0
2931
- };
2932
- }
2933
- function Bn(t) {
2934
- var e, n = t.popper, r = t.popperRect, i = t.placement, o = t.variation, s = t.offsets, a = t.position, l = t.gpuAcceleration, c = t.adaptive, u = t.roundOffsets, p = t.isFixed, f = s.x, h = f === void 0 ? 0 : f, y = s.y, v = y === void 0 ? 0 : y, g = typeof u == "function" ? u({
2935
- x: h,
2936
- y: v
2937
- }) : {
2938
- x: h,
2939
- y: v
2940
- };
2941
- h = g.x, v = g.y;
2942
- var w = s.hasOwnProperty("x"), x = s.hasOwnProperty("y"), O = z, d = W, T = window;
2943
- if (c) {
2944
- var b = gt(n), C = "clientHeight", S = "clientWidth";
2945
- if (b === X(n) && (b = Oe(n), be(b).position !== "static" && a === "absolute" && (C = "scrollHeight", S = "scrollWidth")), b = b, i === W || (i === z || i === ne) && o === ct) {
2946
- d = te;
2947
- var L = p && b === T && T.visualViewport ? T.visualViewport.height : (
2948
- // $FlowFixMe[prop-missing]
2949
- b[C]
2950
- );
2951
- v -= L - r.height, v *= l ? 1 : -1;
2952
- }
2953
- if (i === z || (i === W || i === te) && o === ct) {
2954
- O = ne;
2955
- var P = p && b === T && T.visualViewport ? T.visualViewport.width : (
2956
- // $FlowFixMe[prop-missing]
2957
- b[S]
2958
- );
2959
- h -= P - r.width, h *= l ? 1 : -1;
2960
- }
2961
- }
2962
- var R = Object.assign({
2963
- position: a
2964
- }, c && Da), D = u === !0 ? Na({
2965
- x: h,
2966
- y: v
2967
- }, X(n)) : {
2968
- x: h,
2969
- y: v
2970
- };
2971
- if (h = D.x, v = D.y, l) {
2972
- var I;
2973
- return Object.assign({}, R, (I = {}, I[d] = x ? "0" : "", I[O] = w ? "0" : "", I.transform = (T.devicePixelRatio || 1) <= 1 ? "translate(" + h + "px, " + v + "px)" : "translate3d(" + h + "px, " + v + "px, 0)", I));
2974
- }
2975
- return Object.assign({}, R, (e = {}, e[d] = x ? v + "px" : "", e[O] = w ? h + "px" : "", e.transform = "", e));
2976
- }
2977
- function Ra(t) {
2978
- var e = t.state, n = t.options, r = n.gpuAcceleration, i = r === void 0 ? !0 : r, o = n.adaptive, s = o === void 0 ? !0 : o, a = n.roundOffsets, l = a === void 0 ? !0 : a, c = {
2979
- placement: pe(e.placement),
2980
- variation: Ye(e.placement),
2981
- popper: e.elements.popper,
2982
- popperRect: e.rects.popper,
2983
- gpuAcceleration: i,
2984
- isFixed: e.options.strategy === "fixed"
2985
- };
2986
- e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, Bn(Object.assign({}, c, {
2987
- offsets: e.modifiersData.popperOffsets,
2988
- position: e.options.strategy,
2989
- adaptive: s,
2990
- roundOffsets: l
2991
- })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, Bn(Object.assign({}, c, {
2992
- offsets: e.modifiersData.arrow,
2993
- position: "absolute",
2994
- adaptive: !1,
2995
- roundOffsets: l
2996
- })))), e.attributes.popper = Object.assign({}, e.attributes.popper, {
2997
- "data-popper-placement": e.placement
2998
- });
2999
- }
3000
- const $a = {
3001
- name: "computeStyles",
3002
- enabled: !0,
3003
- phase: "beforeWrite",
3004
- fn: Ra,
3005
- data: {}
3006
- };
3007
- var Pt = {
3008
- passive: !0
3009
- };
3010
- function Ba(t) {
3011
- var e = t.state, n = t.instance, r = t.options, i = r.scroll, o = i === void 0 ? !0 : i, s = r.resize, a = s === void 0 ? !0 : s, l = X(e.elements.popper), c = [].concat(e.scrollParents.reference, e.scrollParents.popper);
3012
- return o && c.forEach(function(u) {
3013
- u.addEventListener("scroll", n.update, Pt);
3014
- }), a && l.addEventListener("resize", n.update, Pt), function() {
3015
- o && c.forEach(function(u) {
3016
- u.removeEventListener("scroll", n.update, Pt);
3017
- }), a && l.removeEventListener("resize", n.update, Pt);
3018
- };
3019
- }
3020
- const Ha = {
3021
- name: "eventListeners",
3022
- enabled: !0,
3023
- phase: "write",
3024
- fn: function() {
3025
- },
3026
- effect: Ba,
3027
- data: {}
3028
- };
3029
- var ja = {
3030
- left: "right",
3031
- right: "left",
3032
- bottom: "top",
3033
- top: "bottom"
3034
- };
3035
- function Bt(t) {
3036
- return t.replace(/left|right|bottom|top/g, function(e) {
3037
- return ja[e];
3038
- });
3039
- }
3040
- var _a = {
3041
- start: "end",
3042
- end: "start"
3043
- };
3044
- function Hn(t) {
3045
- return t.replace(/start|end/g, function(e) {
3046
- return _a[e];
3047
- });
3048
- }
3049
- function bn(t) {
3050
- var e = X(t), n = e.pageXOffset, r = e.pageYOffset;
3051
- return {
3052
- scrollLeft: n,
3053
- scrollTop: r
3054
- };
3055
- }
3056
- function wn(t) {
3057
- return qe(Oe(t)).left + bn(t).scrollLeft;
3058
- }
3059
- function Fa(t, e) {
3060
- var n = X(t), r = Oe(t), i = n.visualViewport, o = r.clientWidth, s = r.clientHeight, a = 0, l = 0;
3061
- if (i) {
3062
- o = i.width, s = i.height;
3063
- var c = Or();
3064
- (c || !c && e === "fixed") && (a = i.offsetLeft, l = i.offsetTop);
3065
- }
3066
- return {
3067
- width: o,
3068
- height: s,
3069
- x: a + wn(t),
3070
- y: l
3071
- };
3072
- }
3073
- function Va(t) {
3074
- var e, n = Oe(t), r = bn(t), i = (e = t.ownerDocument) == null ? void 0 : e.body, o = Ne(n.scrollWidth, n.clientWidth, i ? i.scrollWidth : 0, i ? i.clientWidth : 0), s = Ne(n.scrollHeight, n.clientHeight, i ? i.scrollHeight : 0, i ? i.clientHeight : 0), a = -r.scrollLeft + wn(t), l = -r.scrollTop;
3075
- return be(i || n).direction === "rtl" && (a += Ne(n.clientWidth, i ? i.clientWidth : 0) - o), {
3076
- width: o,
3077
- height: s,
3078
- x: a,
3079
- y: l
3080
- };
3081
- }
3082
- function xn(t) {
3083
- var e = be(t), n = e.overflow, r = e.overflowX, i = e.overflowY;
3084
- return /auto|scroll|overlay|hidden/.test(n + i + r);
3085
- }
3086
- function Ir(t) {
3087
- return ["html", "body", "#document"].indexOf(fe(t)) >= 0 ? t.ownerDocument.body : Q(t) && xn(t) ? t : Ir(Wt(t));
3088
- }
3089
- function ot(t, e) {
3090
- var n;
3091
- e === void 0 && (e = []);
3092
- var r = Ir(t), i = r === ((n = t.ownerDocument) == null ? void 0 : n.body), o = X(r), s = i ? [o].concat(o.visualViewport || [], xn(r) ? r : []) : r, a = e.concat(s);
3093
- return i ? a : (
3094
- // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
3095
- a.concat(ot(Wt(s)))
3096
- );
3097
- }
3098
- function rn(t) {
3099
- return Object.assign({}, t, {
3100
- left: t.x,
3101
- top: t.y,
3102
- right: t.x + t.width,
3103
- bottom: t.y + t.height
3104
- });
3105
- }
3106
- function Wa(t, e) {
3107
- var n = qe(t, !1, e === "fixed");
3108
- return n.top = n.top + t.clientTop, n.left = n.left + t.clientLeft, n.bottom = n.top + t.clientHeight, n.right = n.left + t.clientWidth, n.width = t.clientWidth, n.height = t.clientHeight, n.x = n.left, n.y = n.top, n;
3109
- }
3110
- function jn(t, e, n) {
3111
- return e === kr ? rn(Fa(t, n)) : Re(e) ? Wa(e, n) : rn(Va(Oe(t)));
3112
- }
3113
- function za(t) {
3114
- var e = ot(Wt(t)), n = ["absolute", "fixed"].indexOf(be(t).position) >= 0, r = n && Q(t) ? gt(t) : t;
3115
- return Re(r) ? e.filter(function(i) {
3116
- return Re(i) && Cr(i, r) && fe(i) !== "body";
3117
- }) : [];
3118
- }
3119
- function Ka(t, e, n, r) {
3120
- var i = e === "clippingParents" ? za(t) : [].concat(e), o = [].concat(i, [n]), s = o[0], a = o.reduce(function(l, c) {
3121
- var u = jn(t, c, r);
3122
- return l.top = Ne(u.top, l.top), l.right = _t(u.right, l.right), l.bottom = _t(u.bottom, l.bottom), l.left = Ne(u.left, l.left), l;
3123
- }, jn(t, s, r));
3124
- return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a;
3125
- }
3126
- function Lr(t) {
3127
- var e = t.reference, n = t.element, r = t.placement, i = r ? pe(r) : null, o = r ? Ye(r) : null, s = e.x + e.width / 2 - n.width / 2, a = e.y + e.height / 2 - n.height / 2, l;
3128
- switch (i) {
3129
- case W:
3130
- l = {
3131
- x: s,
3132
- y: e.y - n.height
3133
- };
3134
- break;
3135
- case te:
3136
- l = {
3137
- x: s,
3138
- y: e.y + e.height
3139
- };
3140
- break;
3141
- case ne:
3142
- l = {
3143
- x: e.x + e.width,
3144
- y: a
3145
- };
3146
- break;
3147
- case z:
3148
- l = {
3149
- x: e.x - n.width,
3150
- y: a
3151
- };
3152
- break;
3153
- default:
3154
- l = {
3155
- x: e.x,
3156
- y: e.y
3157
- };
3158
- }
3159
- var c = i ? yn(i) : null;
3160
- if (c != null) {
3161
- var u = c === "y" ? "height" : "width";
3162
- switch (o) {
3163
- case Ke:
3164
- l[c] = l[c] - (e[u] / 2 - n[u] / 2);
3165
- break;
3166
- case ct:
3167
- l[c] = l[c] + (e[u] / 2 - n[u] / 2);
3168
- break;
3169
- }
3170
- }
3171
- return l;
3172
- }
3173
- function ut(t, e) {
3174
- e === void 0 && (e = {});
3175
- var n = e, r = n.placement, i = r === void 0 ? t.placement : r, o = n.strategy, s = o === void 0 ? t.strategy : o, a = n.boundary, l = a === void 0 ? pa : a, c = n.rootBoundary, u = c === void 0 ? kr : c, p = n.elementContext, f = p === void 0 ? nt : p, h = n.altBoundary, y = h === void 0 ? !1 : h, v = n.padding, g = v === void 0 ? 0 : v, w = Ar(typeof g != "number" ? g : Sr(g, vt)), x = f === nt ? fa : nt, O = t.rects.popper, d = t.elements[y ? x : f], T = Ka(Re(d) ? d : d.contextElement || Oe(t.elements.popper), l, u, s), b = qe(t.elements.reference), C = Lr({
3176
- reference: b,
3177
- element: O,
3178
- placement: i
3179
- }), S = rn(Object.assign({}, O, C)), L = f === nt ? S : b, P = {
3180
- top: T.top - L.top + w.top,
3181
- bottom: L.bottom - T.bottom + w.bottom,
3182
- left: T.left - L.left + w.left,
3183
- right: L.right - T.right + w.right
3184
- }, R = t.modifiersData.offset;
3185
- if (f === nt && R) {
3186
- var D = R[i];
3187
- Object.keys(P).forEach(function(I) {
3188
- var q = [ne, te].indexOf(I) >= 0 ? 1 : -1, Y = [W, te].indexOf(I) >= 0 ? "y" : "x";
3189
- P[I] += D[Y] * q;
3190
- });
3191
- }
3192
- return P;
3193
- }
3194
- function Ua(t, e) {
3195
- e === void 0 && (e = {});
3196
- var n = e, r = n.placement, i = n.boundary, o = n.rootBoundary, s = n.padding, a = n.flipVariations, l = n.allowedAutoPlacements, c = l === void 0 ? Mr : l, u = Ye(r), p = u ? a ? Rn : Rn.filter(function(y) {
3197
- return Ye(y) === u;
3198
- }) : vt, f = p.filter(function(y) {
3199
- return c.indexOf(y) >= 0;
3200
- });
3201
- f.length === 0 && (f = p);
3202
- var h = f.reduce(function(y, v) {
3203
- return y[v] = ut(t, {
3204
- placement: v,
3205
- boundary: i,
3206
- rootBoundary: o,
3207
- padding: s
3208
- })[pe(v)], y;
3209
- }, {});
3210
- return Object.keys(h).sort(function(y, v) {
3211
- return h[y] - h[v];
3212
- });
3213
- }
3214
- function qa(t) {
3215
- if (pe(t) === mn)
3216
- return [];
3217
- var e = Bt(t);
3218
- return [Hn(t), e, Hn(e)];
3219
- }
3220
- function Ya(t) {
3221
- var e = t.state, n = t.options, r = t.name;
3222
- if (!e.modifiersData[r]._skip) {
3223
- for (var i = n.mainAxis, o = i === void 0 ? !0 : i, s = n.altAxis, a = s === void 0 ? !0 : s, l = n.fallbackPlacements, c = n.padding, u = n.boundary, p = n.rootBoundary, f = n.altBoundary, h = n.flipVariations, y = h === void 0 ? !0 : h, v = n.allowedAutoPlacements, g = e.options.placement, w = pe(g), x = w === g, O = l || (x || !y ? [Bt(g)] : qa(g)), d = [g].concat(O).reduce(function(he, re) {
3224
- return he.concat(pe(re) === mn ? Ua(e, {
3225
- placement: re,
3226
- boundary: u,
3227
- rootBoundary: p,
3228
- padding: c,
3229
- flipVariations: y,
3230
- allowedAutoPlacements: v
3231
- }) : re);
3232
- }, []), T = e.rects.reference, b = e.rects.popper, C = /* @__PURE__ */ new Map(), S = !0, L = d[0], P = 0; P < d.length; P++) {
3233
- var R = d[P], D = pe(R), I = Ye(R) === Ke, q = [W, te].indexOf(D) >= 0, Y = q ? "width" : "height", H = ut(e, {
3234
- placement: R,
3235
- boundary: u,
3236
- rootBoundary: p,
3237
- altBoundary: f,
3238
- padding: c
3239
- }), j = q ? I ? ne : z : I ? te : W;
3240
- T[Y] > b[Y] && (j = Bt(j));
3241
- var B = Bt(j), ae = [];
3242
- if (o && ae.push(H[D] <= 0), a && ae.push(H[j] <= 0, H[B] <= 0), ae.every(function(he) {
3243
- return he;
3244
- })) {
3245
- L = R, S = !1;
3246
- break;
3247
- }
3248
- C.set(R, ae);
3249
- }
3250
- if (S)
3251
- for (var le = y ? 3 : 1, Ce = function(re) {
3252
- var me = d.find(function($e) {
3253
- var ve = C.get($e);
3254
- if (ve)
3255
- return ve.slice(0, re).every(function(Be) {
3256
- return Be;
3257
- });
3258
- });
3259
- if (me)
3260
- return L = me, "break";
3261
- }, ce = le; ce > 0; ce--) {
3262
- var Ee = Ce(ce);
3263
- if (Ee === "break") break;
3264
- }
3265
- e.placement !== L && (e.modifiersData[r]._skip = !0, e.placement = L, e.reset = !0);
3266
- }
3267
- }
3268
- const Ga = {
3269
- name: "flip",
3270
- enabled: !0,
3271
- phase: "main",
3272
- fn: Ya,
3273
- requiresIfExists: ["offset"],
3274
- data: {
3275
- _skip: !1
3276
- }
3277
- };
3278
- function _n(t, e, n) {
3279
- return n === void 0 && (n = {
3280
- x: 0,
3281
- y: 0
3282
- }), {
3283
- top: t.top - e.height - n.y,
3284
- right: t.right - e.width + n.x,
3285
- bottom: t.bottom - e.height + n.y,
3286
- left: t.left - e.width - n.x
3287
- };
3288
- }
3289
- function Fn(t) {
3290
- return [W, ne, te, z].some(function(e) {
3291
- return t[e] >= 0;
3292
- });
3293
- }
3294
- function Xa(t) {
3295
- var e = t.state, n = t.name, r = e.rects.reference, i = e.rects.popper, o = e.modifiersData.preventOverflow, s = ut(e, {
3296
- elementContext: "reference"
3297
- }), a = ut(e, {
3298
- altBoundary: !0
3299
- }), l = _n(s, r), c = _n(a, i, o), u = Fn(l), p = Fn(c);
3300
- e.modifiersData[n] = {
3301
- referenceClippingOffsets: l,
3302
- popperEscapeOffsets: c,
3303
- isReferenceHidden: u,
3304
- hasPopperEscaped: p
3305
- }, e.attributes.popper = Object.assign({}, e.attributes.popper, {
3306
- "data-popper-reference-hidden": u,
3307
- "data-popper-escaped": p
3308
- });
3309
- }
3310
- const Ja = {
3311
- name: "hide",
3312
- enabled: !0,
3313
- phase: "main",
3314
- requiresIfExists: ["preventOverflow"],
3315
- fn: Xa
3316
- };
3317
- function Za(t, e, n) {
3318
- var r = pe(t), i = [z, W].indexOf(r) >= 0 ? -1 : 1, o = typeof n == "function" ? n(Object.assign({}, e, {
3319
- placement: t
3320
- })) : n, s = o[0], a = o[1];
3321
- return s = s || 0, a = (a || 0) * i, [z, ne].indexOf(r) >= 0 ? {
3322
- x: a,
3323
- y: s
3324
- } : {
3325
- x: s,
3326
- y: a
3327
- };
3328
- }
3329
- function Qa(t) {
3330
- var e = t.state, n = t.options, r = t.name, i = n.offset, o = i === void 0 ? [0, 0] : i, s = Mr.reduce(function(u, p) {
3331
- return u[p] = Za(p, e.rects, o), u;
3332
- }, {}), a = s[e.placement], l = a.x, c = a.y;
3333
- e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += l, e.modifiersData.popperOffsets.y += c), e.modifiersData[r] = s;
3334
- }
3335
- const el = {
3336
- name: "offset",
3337
- enabled: !0,
3338
- phase: "main",
3339
- requires: ["popperOffsets"],
3340
- fn: Qa
3341
- };
3342
- function tl(t) {
3343
- var e = t.state, n = t.name;
3344
- e.modifiersData[n] = Lr({
3345
- reference: e.rects.reference,
3346
- element: e.rects.popper,
3347
- placement: e.placement
3348
- });
3349
- }
3350
- const nl = {
3351
- name: "popperOffsets",
3352
- enabled: !0,
3353
- phase: "read",
3354
- fn: tl,
3355
- data: {}
3356
- };
3357
- function rl(t) {
3358
- return t === "x" ? "y" : "x";
3359
- }
3360
- function il(t) {
3361
- var e = t.state, n = t.options, r = t.name, i = n.mainAxis, o = i === void 0 ? !0 : i, s = n.altAxis, a = s === void 0 ? !1 : s, l = n.boundary, c = n.rootBoundary, u = n.altBoundary, p = n.padding, f = n.tether, h = f === void 0 ? !0 : f, y = n.tetherOffset, v = y === void 0 ? 0 : y, g = ut(e, {
3362
- boundary: l,
3363
- rootBoundary: c,
3364
- padding: p,
3365
- altBoundary: u
3366
- }), w = pe(e.placement), x = Ye(e.placement), O = !x, d = yn(w), T = rl(d), b = e.modifiersData.popperOffsets, C = e.rects.reference, S = e.rects.popper, L = typeof v == "function" ? v(Object.assign({}, e.rects, {
3367
- placement: e.placement
3368
- })) : v, P = typeof L == "number" ? {
3369
- mainAxis: L,
3370
- altAxis: L
3371
- } : Object.assign({
3372
- mainAxis: 0,
3373
- altAxis: 0
3374
- }, L), R = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, D = {
3375
- x: 0,
3376
- y: 0
3377
- };
3378
- if (b) {
3379
- if (o) {
3380
- var I, q = d === "y" ? W : z, Y = d === "y" ? te : ne, H = d === "y" ? "height" : "width", j = b[d], B = j + g[q], ae = j - g[Y], le = h ? -S[H] / 2 : 0, Ce = x === Ke ? C[H] : S[H], ce = x === Ke ? -S[H] : -C[H], Ee = e.elements.arrow, he = h && Ee ? gn(Ee) : {
3381
- width: 0,
3382
- height: 0
3383
- }, re = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : Er(), me = re[q], $e = re[Y], ve = it(0, C[H], he[H]), Be = O ? C[H] / 2 - le - ve - me - P.mainAxis : Ce - ve - me - P.mainAxis, we = O ? -C[H] / 2 + le + ve + $e + P.mainAxis : ce + ve + $e + P.mainAxis, He = e.elements.arrow && gt(e.elements.arrow), yt = He ? d === "y" ? He.clientTop || 0 : He.clientLeft || 0 : 0, Je = (I = R == null ? void 0 : R[d]) != null ? I : 0, bt = j + Be - Je - yt, wt = j + we - Je, Ze = it(h ? _t(B, bt) : B, j, h ? Ne(ae, wt) : ae);
3384
- b[d] = Ze, D[d] = Ze - j;
3385
- }
3386
- if (a) {
3387
- var Qe, xt = d === "x" ? W : z, kt = d === "x" ? te : ne, ge = b[T], xe = T === "y" ? "height" : "width", et = ge + g[xt], Ae = ge - g[kt], tt = [W, z].indexOf(w) !== -1, Mt = (Qe = R == null ? void 0 : R[T]) != null ? Qe : 0, Tt = tt ? et : ge - C[xe] - S[xe] - Mt + P.altAxis, Ot = tt ? ge + C[xe] + S[xe] - Mt - P.altAxis : Ae, Ct = h && tt ? Aa(Tt, ge, Ot) : it(h ? Tt : et, ge, h ? Ot : Ae);
3388
- b[T] = Ct, D[T] = Ct - ge;
3389
- }
3390
- e.modifiersData[r] = D;
3391
- }
3392
- }
3393
- const ol = {
3394
- name: "preventOverflow",
3395
- enabled: !0,
3396
- phase: "main",
3397
- fn: il,
3398
- requiresIfExists: ["offset"]
3399
- };
3400
- function sl(t) {
3401
- return {
3402
- scrollLeft: t.scrollLeft,
3403
- scrollTop: t.scrollTop
3404
- };
3405
- }
3406
- function al(t) {
3407
- return t === X(t) || !Q(t) ? bn(t) : sl(t);
3408
- }
3409
- function ll(t) {
3410
- var e = t.getBoundingClientRect(), n = Ue(e.width) / t.offsetWidth || 1, r = Ue(e.height) / t.offsetHeight || 1;
3411
- return n !== 1 || r !== 1;
3412
- }
3413
- function cl(t, e, n) {
3414
- n === void 0 && (n = !1);
3415
- var r = Q(e), i = Q(e) && ll(e), o = Oe(e), s = qe(t, i, n), a = {
3416
- scrollLeft: 0,
3417
- scrollTop: 0
3418
- }, l = {
3419
- x: 0,
3420
- y: 0
3421
- };
3422
- return (r || !r && !n) && ((fe(e) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
3423
- xn(o)) && (a = al(e)), Q(e) ? (l = qe(e, !0), l.x += e.clientLeft, l.y += e.clientTop) : o && (l.x = wn(o))), {
3424
- x: s.left + a.scrollLeft - l.x,
3425
- y: s.top + a.scrollTop - l.y,
3426
- width: s.width,
3427
- height: s.height
3428
- };
3429
- }
3430
- function ul(t) {
3431
- var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [];
3432
- t.forEach(function(o) {
3433
- e.set(o.name, o);
3434
- });
3435
- function i(o) {
3436
- n.add(o.name);
3437
- var s = [].concat(o.requires || [], o.requiresIfExists || []);
3438
- s.forEach(function(a) {
3439
- if (!n.has(a)) {
3440
- var l = e.get(a);
3441
- l && i(l);
3442
- }
3443
- }), r.push(o);
3444
- }
3445
- return t.forEach(function(o) {
3446
- n.has(o.name) || i(o);
3447
- }), r;
3448
- }
3449
- function dl(t) {
3450
- var e = ul(t);
3451
- return Ma.reduce(function(n, r) {
3452
- return n.concat(e.filter(function(i) {
3453
- return i.phase === r;
3454
- }));
3455
- }, []);
3456
- }
3457
- function pl(t) {
3458
- var e;
3459
- return function() {
3460
- return e || (e = new Promise(function(n) {
3461
- Promise.resolve().then(function() {
3462
- e = void 0, n(t());
3463
- });
3464
- })), e;
3465
- };
3466
- }
3467
- function fl(t) {
3468
- var e = t.reduce(function(n, r) {
3469
- var i = n[r.name];
3470
- return n[r.name] = i ? Object.assign({}, i, r, {
3471
- options: Object.assign({}, i.options, r.options),
3472
- data: Object.assign({}, i.data, r.data)
3473
- }) : r, n;
3474
- }, {});
3475
- return Object.keys(e).map(function(n) {
3476
- return e[n];
3477
- });
3478
- }
3479
- var Vn = {
3480
- placement: "bottom",
3481
- modifiers: [],
3482
- strategy: "absolute"
3483
- };
3484
- function Wn() {
3485
- for (var t = arguments.length, e = new Array(t), n = 0; n < t; n++)
3486
- e[n] = arguments[n];
3487
- return !e.some(function(r) {
3488
- return !(r && typeof r.getBoundingClientRect == "function");
3489
- });
3490
- }
3491
- function hl(t) {
3492
- t === void 0 && (t = {});
3493
- var e = t, n = e.defaultModifiers, r = n === void 0 ? [] : n, i = e.defaultOptions, o = i === void 0 ? Vn : i;
3494
- return function(a, l, c) {
3495
- c === void 0 && (c = o);
3496
- var u = {
3497
- placement: "bottom",
3498
- orderedModifiers: [],
3499
- options: Object.assign({}, Vn, o),
3500
- modifiersData: {},
3501
- elements: {
3502
- reference: a,
3503
- popper: l
3504
- },
3505
- attributes: {},
3506
- styles: {}
3507
- }, p = [], f = !1, h = {
3508
- state: u,
3509
- setOptions: function(w) {
3510
- var x = typeof w == "function" ? w(u.options) : w;
3511
- v(), u.options = Object.assign({}, o, u.options, x), u.scrollParents = {
3512
- reference: Re(a) ? ot(a) : a.contextElement ? ot(a.contextElement) : [],
3513
- popper: ot(l)
3514
- };
3515
- var O = dl(fl([].concat(r, u.options.modifiers)));
3516
- return u.orderedModifiers = O.filter(function(d) {
3517
- return d.enabled;
3518
- }), y(), h.update();
3519
- },
3520
- // Sync update – it will always be executed, even if not necessary. This
3521
- // is useful for low frequency updates where sync behavior simplifies the
3522
- // logic.
3523
- // For high frequency updates (e.g. `resize` and `scroll` events), always
3524
- // prefer the async Popper#update method
3525
- forceUpdate: function() {
3526
- if (!f) {
3527
- var w = u.elements, x = w.reference, O = w.popper;
3528
- if (Wn(x, O)) {
3529
- u.rects = {
3530
- reference: cl(x, gt(O), u.options.strategy === "fixed"),
3531
- popper: gn(O)
3532
- }, u.reset = !1, u.placement = u.options.placement, u.orderedModifiers.forEach(function(P) {
3533
- return u.modifiersData[P.name] = Object.assign({}, P.data);
3534
- });
3535
- for (var d = 0; d < u.orderedModifiers.length; d++) {
3536
- if (u.reset === !0) {
3537
- u.reset = !1, d = -1;
3538
- continue;
3539
- }
3540
- var T = u.orderedModifiers[d], b = T.fn, C = T.options, S = C === void 0 ? {} : C, L = T.name;
3541
- typeof b == "function" && (u = b({
3542
- state: u,
3543
- options: S,
3544
- name: L,
3545
- instance: h
3546
- }) || u);
3547
- }
3548
- }
3549
- }
3550
- },
3551
- // Async and optimistically optimized update – it will not be executed if
3552
- // not necessary (debounced to run at most once-per-tick)
3553
- update: pl(function() {
3554
- return new Promise(function(g) {
3555
- h.forceUpdate(), g(u);
3556
- });
3557
- }),
3558
- destroy: function() {
3559
- v(), f = !0;
3560
- }
3561
- };
3562
- if (!Wn(a, l))
3563
- return h;
3564
- h.setOptions(c).then(function(g) {
3565
- !f && c.onFirstUpdate && c.onFirstUpdate(g);
3566
- });
3567
- function y() {
3568
- u.orderedModifiers.forEach(function(g) {
3569
- var w = g.name, x = g.options, O = x === void 0 ? {} : x, d = g.effect;
3570
- if (typeof d == "function") {
3571
- var T = d({
3572
- state: u,
3573
- name: w,
3574
- instance: h,
3575
- options: O
3576
- }), b = function() {
3577
- };
3578
- p.push(T || b);
3579
- }
3580
- });
3581
- }
3582
- function v() {
3583
- p.forEach(function(g) {
3584
- return g();
3585
- }), p = [];
3586
- }
3587
- return h;
3588
- };
3589
- }
3590
- var ml = [Ha, nl, $a, Tr, el, Ga, ol, Pa, Ja], vl = /* @__PURE__ */ hl({
3591
- defaultModifiers: ml
3592
- }), gl = "tippy-box", Pr = "tippy-content", yl = "tippy-backdrop", Dr = "tippy-arrow", Nr = "tippy-svg-arrow", Ie = {
3593
- passive: !0,
3594
- capture: !0
3595
- }, Rr = function() {
3596
- return document.body;
3597
- };
3598
- function bl(t, e) {
3599
- return {}.hasOwnProperty.call(t, e);
3600
- }
3601
- function Jt(t, e, n) {
3602
- if (Array.isArray(t)) {
3603
- var r = t[e];
3604
- return r ?? (Array.isArray(n) ? n[e] : n);
3605
- }
3606
- return t;
3607
- }
3608
- function kn(t, e) {
3609
- var n = {}.toString.call(t);
3610
- return n.indexOf("[object") === 0 && n.indexOf(e + "]") > -1;
3611
- }
3612
- function $r(t, e) {
3613
- return typeof t == "function" ? t.apply(void 0, e) : t;
3614
- }
3615
- function zn(t, e) {
3616
- if (e === 0)
3617
- return t;
3618
- var n;
3619
- return function(r) {
3620
- clearTimeout(n), n = setTimeout(function() {
3621
- t(r);
3622
- }, e);
3623
- };
3624
- }
3625
- function wl(t, e) {
3626
- var n = Object.assign({}, t);
3627
- return e.forEach(function(r) {
3628
- delete n[r];
3629
- }), n;
3630
- }
3631
- function xl(t) {
3632
- return t.split(/\s+/).filter(Boolean);
3633
- }
3634
- function Ve(t) {
3635
- return [].concat(t);
3636
- }
3637
- function Kn(t, e) {
3638
- t.indexOf(e) === -1 && t.push(e);
3639
- }
3640
- function kl(t) {
3641
- return t.filter(function(e, n) {
3642
- return t.indexOf(e) === n;
3643
- });
3644
- }
3645
- function Ml(t) {
3646
- return t.split("-")[0];
3647
- }
3648
- function Ft(t) {
3649
- return [].slice.call(t);
3650
- }
3651
- function Un(t) {
3652
- return Object.keys(t).reduce(function(e, n) {
3653
- return t[n] !== void 0 && (e[n] = t[n]), e;
3654
- }, {});
3655
- }
3656
- function st() {
3657
- return document.createElement("div");
3658
- }
3659
- function dt(t) {
3660
- return ["Element", "Fragment"].some(function(e) {
3661
- return kn(t, e);
3662
- });
3663
- }
3664
- function Tl(t) {
3665
- return kn(t, "NodeList");
3666
- }
3667
- function Ol(t) {
3668
- return kn(t, "MouseEvent");
3669
- }
3670
- function Cl(t) {
3671
- return !!(t && t._tippy && t._tippy.reference === t);
3672
- }
3673
- function El(t) {
3674
- return dt(t) ? [t] : Tl(t) ? Ft(t) : Array.isArray(t) ? t : Ft(document.querySelectorAll(t));
3675
- }
3676
- function Zt(t, e) {
3677
- t.forEach(function(n) {
3678
- n && (n.style.transitionDuration = e + "ms");
3679
- });
3680
- }
3681
- function qn(t, e) {
3682
- t.forEach(function(n) {
3683
- n && n.setAttribute("data-state", e);
3684
- });
3685
- }
3686
- function Al(t) {
3687
- var e, n = Ve(t), r = n[0];
3688
- return r != null && (e = r.ownerDocument) != null && e.body ? r.ownerDocument : document;
3689
- }
3690
- function Sl(t, e) {
3691
- var n = e.clientX, r = e.clientY;
3692
- return t.every(function(i) {
3693
- var o = i.popperRect, s = i.popperState, a = i.props, l = a.interactiveBorder, c = Ml(s.placement), u = s.modifiersData.offset;
3694
- if (!u)
3695
- return !0;
3696
- var p = c === "bottom" ? u.top.y : 0, f = c === "top" ? u.bottom.y : 0, h = c === "right" ? u.left.x : 0, y = c === "left" ? u.right.x : 0, v = o.top - r + p > l, g = r - o.bottom - f > l, w = o.left - n + h > l, x = n - o.right - y > l;
3697
- return v || g || w || x;
3698
- });
3699
- }
3700
- function Qt(t, e, n) {
3701
- var r = e + "EventListener";
3702
- ["transitionend", "webkitTransitionEnd"].forEach(function(i) {
3703
- t[r](i, n);
3704
- });
3705
- }
3706
- function Yn(t, e) {
3707
- for (var n = e; n; ) {
3708
- var r;
3709
- if (t.contains(n))
3710
- return !0;
3711
- n = n.getRootNode == null || (r = n.getRootNode()) == null ? void 0 : r.host;
3712
- }
3713
- return !1;
3714
- }
3715
- var de = {
3716
- isTouch: !1
3717
- }, Gn = 0;
3718
- function Il() {
3719
- de.isTouch || (de.isTouch = !0, window.performance && document.addEventListener("mousemove", Br));
3720
- }
3721
- function Br() {
3722
- var t = performance.now();
3723
- t - Gn < 20 && (de.isTouch = !1, document.removeEventListener("mousemove", Br)), Gn = t;
3724
- }
3725
- function Ll() {
3726
- var t = document.activeElement;
3727
- if (Cl(t)) {
3728
- var e = t._tippy;
3729
- t.blur && !e.state.isVisible && t.blur();
3730
- }
3731
- }
3732
- function Pl() {
3733
- document.addEventListener("touchstart", Il, Ie), window.addEventListener("blur", Ll);
3734
- }
3735
- var Dl = typeof window < "u" && typeof document < "u", Nl = Dl ? (
3736
- // @ts-ignore
3737
- !!window.msCrypto
3738
- ) : !1;
3739
- function Fe(t) {
3740
- var e = t === "destroy" ? "n already-" : " ";
3741
- return [t + "() was called on a" + e + "destroyed instance. This is a no-op but", "indicates a potential memory leak."].join(" ");
3742
- }
3743
- function Xn(t) {
3744
- var e = /[ \t]{2,}/g, n = /^[ \t]*/gm;
3745
- return t.replace(e, " ").replace(n, "").trim();
3746
- }
3747
- function Rl(t) {
3748
- return Xn(`
3749
- %ctippy.js
3750
-
3751
- %c` + Xn(t) + `
3752
-
3753
- %c👷‍ This is a development-only message. It will be removed in production.
3754
- `);
3755
- }
3756
- function Hr(t) {
3757
- return [
3758
- Rl(t),
3759
- // title
3760
- "color: #00C584; font-size: 1.3em; font-weight: bold;",
3761
- // message
3762
- "line-height: 1.5",
3763
- // footer
3764
- "color: #a6a095;"
3765
- ];
3766
- }
3767
- var pt;
3768
- process.env.NODE_ENV !== "production" && $l();
3769
- function $l() {
3770
- pt = /* @__PURE__ */ new Set();
3771
- }
3772
- function ye(t, e) {
3773
- if (t && !pt.has(e)) {
3774
- var n;
3775
- pt.add(e), (n = console).warn.apply(n, Hr(e));
3776
- }
3777
- }
3778
- function on(t, e) {
3779
- if (t && !pt.has(e)) {
3780
- var n;
3781
- pt.add(e), (n = console).error.apply(n, Hr(e));
3782
- }
3783
- }
3784
- function Bl(t) {
3785
- var e = !t, n = Object.prototype.toString.call(t) === "[object Object]" && !t.addEventListener;
3786
- on(e, ["tippy() was passed", "`" + String(t) + "`", "as its targets (first) argument. Valid types are: String, Element,", "Element[], or NodeList."].join(" ")), on(n, ["tippy() was passed a plain object which is not supported as an argument", "for virtual positioning. Use props.getReferenceClientRect instead."].join(" "));
3787
- }
3788
- var jr = {
3789
- animateFill: !1,
3790
- followCursor: !1,
3791
- inlinePositioning: !1,
3792
- sticky: !1
3793
- }, Hl = {
3794
- allowHTML: !1,
3795
- animation: "fade",
3796
- arrow: !0,
3797
- content: "",
3798
- inertia: !1,
3799
- maxWidth: 350,
3800
- role: "tooltip",
3801
- theme: "",
3802
- zIndex: 9999
3803
- }, G = Object.assign({
3804
- appendTo: Rr,
3805
- aria: {
3806
- content: "auto",
3807
- expanded: "auto"
3808
- },
3809
- delay: 0,
3810
- duration: [300, 250],
3811
- getReferenceClientRect: null,
3812
- hideOnClick: !0,
3813
- ignoreAttributes: !1,
3814
- interactive: !1,
3815
- interactiveBorder: 2,
3816
- interactiveDebounce: 0,
3817
- moveTransition: "",
3818
- offset: [0, 10],
3819
- onAfterUpdate: function() {
3820
- },
3821
- onBeforeUpdate: function() {
3822
- },
3823
- onCreate: function() {
3824
- },
3825
- onDestroy: function() {
3826
- },
3827
- onHidden: function() {
3828
- },
3829
- onHide: function() {
3830
- },
3831
- onMount: function() {
3832
- },
3833
- onShow: function() {
3834
- },
3835
- onShown: function() {
3836
- },
3837
- onTrigger: function() {
3838
- },
3839
- onUntrigger: function() {
3840
- },
3841
- onClickOutside: function() {
3842
- },
3843
- placement: "top",
3844
- plugins: [],
3845
- popperOptions: {},
3846
- render: null,
3847
- showOnCreate: !1,
3848
- touch: !0,
3849
- trigger: "mouseenter focus",
3850
- triggerTarget: null
3851
- }, jr, Hl), jl = Object.keys(G), _l = function(e) {
3852
- process.env.NODE_ENV !== "production" && Fr(e, []);
3853
- var n = Object.keys(e);
3854
- n.forEach(function(r) {
3855
- G[r] = e[r];
3856
- });
3857
- };
3858
- function _r(t) {
3859
- var e = t.plugins || [], n = e.reduce(function(r, i) {
3860
- var o = i.name, s = i.defaultValue;
3861
- if (o) {
3862
- var a;
3863
- r[o] = t[o] !== void 0 ? t[o] : (a = G[o]) != null ? a : s;
3864
- }
3865
- return r;
3866
- }, {});
3867
- return Object.assign({}, t, n);
3868
- }
3869
- function Fl(t, e) {
3870
- var n = e ? Object.keys(_r(Object.assign({}, G, {
3871
- plugins: e
3872
- }))) : jl, r = n.reduce(function(i, o) {
3873
- var s = (t.getAttribute("data-tippy-" + o) || "").trim();
3874
- if (!s)
3875
- return i;
3876
- if (o === "content")
3877
- i[o] = s;
3878
- else
3879
- try {
3880
- i[o] = JSON.parse(s);
3881
- } catch {
3882
- i[o] = s;
3883
- }
3884
- return i;
3885
- }, {});
3886
- return r;
3887
- }
3888
- function Jn(t, e) {
3889
- var n = Object.assign({}, e, {
3890
- content: $r(e.content, [t])
3891
- }, e.ignoreAttributes ? {} : Fl(t, e.plugins));
3892
- return n.aria = Object.assign({}, G.aria, n.aria), n.aria = {
3893
- expanded: n.aria.expanded === "auto" ? e.interactive : n.aria.expanded,
3894
- content: n.aria.content === "auto" ? e.interactive ? null : "describedby" : n.aria.content
3895
- }, n;
3896
- }
3897
- function Fr(t, e) {
3898
- t === void 0 && (t = {}), e === void 0 && (e = []);
3899
- var n = Object.keys(t);
3900
- n.forEach(function(r) {
3901
- var i = wl(G, Object.keys(jr)), o = !bl(i, r);
3902
- o && (o = e.filter(function(s) {
3903
- return s.name === r;
3904
- }).length === 0), ye(o, ["`" + r + "`", "is not a valid prop. You may have spelled it incorrectly, or if it's", "a plugin, forgot to pass it in an array as props.plugins.", `
3905
-
3906
- `, `All props: https://atomiks.github.io/tippyjs/v6/all-props/
3907
- `, "Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "));
3908
- });
3909
- }
3910
- var Vl = function() {
3911
- return "innerHTML";
3912
- };
3913
- function sn(t, e) {
3914
- t[Vl()] = e;
3915
- }
3916
- function Zn(t) {
3917
- var e = st();
3918
- return t === !0 ? e.className = Dr : (e.className = Nr, dt(t) ? e.appendChild(t) : sn(e, t)), e;
3919
- }
3920
- function Qn(t, e) {
3921
- dt(e.content) ? (sn(t, ""), t.appendChild(e.content)) : typeof e.content != "function" && (e.allowHTML ? sn(t, e.content) : t.textContent = e.content);
3922
- }
3923
- function an(t) {
3924
- var e = t.firstElementChild, n = Ft(e.children);
3925
- return {
3926
- box: e,
3927
- content: n.find(function(r) {
3928
- return r.classList.contains(Pr);
3929
- }),
3930
- arrow: n.find(function(r) {
3931
- return r.classList.contains(Dr) || r.classList.contains(Nr);
3932
- }),
3933
- backdrop: n.find(function(r) {
3934
- return r.classList.contains(yl);
3935
- })
3936
- };
3937
- }
3938
- function Vr(t) {
3939
- var e = st(), n = st();
3940
- n.className = gl, n.setAttribute("data-state", "hidden"), n.setAttribute("tabindex", "-1");
3941
- var r = st();
3942
- r.className = Pr, r.setAttribute("data-state", "hidden"), Qn(r, t.props), e.appendChild(n), n.appendChild(r), i(t.props, t.props);
3943
- function i(o, s) {
3944
- var a = an(e), l = a.box, c = a.content, u = a.arrow;
3945
- s.theme ? l.setAttribute("data-theme", s.theme) : l.removeAttribute("data-theme"), typeof s.animation == "string" ? l.setAttribute("data-animation", s.animation) : l.removeAttribute("data-animation"), s.inertia ? l.setAttribute("data-inertia", "") : l.removeAttribute("data-inertia"), l.style.maxWidth = typeof s.maxWidth == "number" ? s.maxWidth + "px" : s.maxWidth, s.role ? l.setAttribute("role", s.role) : l.removeAttribute("role"), (o.content !== s.content || o.allowHTML !== s.allowHTML) && Qn(c, t.props), s.arrow ? u ? o.arrow !== s.arrow && (l.removeChild(u), l.appendChild(Zn(s.arrow))) : l.appendChild(Zn(s.arrow)) : u && l.removeChild(u);
3946
- }
3947
- return {
3948
- popper: e,
3949
- onUpdate: i
3950
- };
3951
- }
3952
- Vr.$$tippy = !0;
3953
- var Wl = 1, Dt = [], en = [];
3954
- function zl(t, e) {
3955
- var n = Jn(t, Object.assign({}, G, _r(Un(e)))), r, i, o, s = !1, a = !1, l = !1, c = !1, u, p, f, h = [], y = zn(bt, n.interactiveDebounce), v, g = Wl++, w = null, x = kl(n.plugins), O = {
3956
- // Is the instance currently enabled?
3957
- isEnabled: !0,
3958
- // Is the tippy currently showing and not transitioning out?
3959
- isVisible: !1,
3960
- // Has the instance been destroyed?
3961
- isDestroyed: !1,
3962
- // Is the tippy currently mounted to the DOM?
3963
- isMounted: !1,
3964
- // Has the tippy finished transitioning in?
3965
- isShown: !1
3966
- }, d = {
3967
- // properties
3968
- id: g,
3969
- reference: t,
3970
- popper: st(),
3971
- popperInstance: w,
3972
- props: n,
3973
- state: O,
3974
- plugins: x,
3975
- // methods
3976
- clearDelayTimeouts: Tt,
3977
- setProps: Ot,
3978
- setContent: Ct,
3979
- show: Kr,
3980
- hide: Ur,
3981
- hideWithInteractivity: qr,
3982
- enable: tt,
3983
- disable: Mt,
3984
- unmount: Yr,
3985
- destroy: Gr
3986
- };
3987
- if (!n.render)
3988
- return process.env.NODE_ENV !== "production" && on(!0, "render() function has not been supplied."), d;
3989
- var T = n.render(d), b = T.popper, C = T.onUpdate;
3990
- b.setAttribute("data-tippy-root", ""), b.id = "tippy-" + d.id, d.popper = b, t._tippy = d, b._tippy = d;
3991
- var S = x.map(function(m) {
3992
- return m.fn(d);
3993
- }), L = t.hasAttribute("aria-expanded");
3994
- return He(), le(), j(), B("onCreate", [d]), n.showOnCreate && et(), b.addEventListener("mouseenter", function() {
3995
- d.props.interactive && d.state.isVisible && d.clearDelayTimeouts();
3996
- }), b.addEventListener("mouseleave", function() {
3997
- d.props.interactive && d.props.trigger.indexOf("mouseenter") >= 0 && q().addEventListener("mousemove", y);
3998
- }), d;
3999
- function P() {
4000
- var m = d.props.touch;
4001
- return Array.isArray(m) ? m : [m, 0];
4002
- }
4003
- function R() {
4004
- return P()[0] === "hold";
4005
- }
4006
- function D() {
4007
- var m;
4008
- return !!((m = d.props.render) != null && m.$$tippy);
4009
- }
4010
- function I() {
4011
- return v || t;
4012
- }
4013
- function q() {
4014
- var m = I().parentNode;
4015
- return m ? Al(m) : document;
4016
- }
4017
- function Y() {
4018
- return an(b);
4019
- }
4020
- function H(m) {
4021
- return d.state.isMounted && !d.state.isVisible || de.isTouch || u && u.type === "focus" ? 0 : Jt(d.props.delay, m ? 0 : 1, G.delay);
4022
- }
4023
- function j(m) {
4024
- m === void 0 && (m = !1), b.style.pointerEvents = d.props.interactive && !m ? "" : "none", b.style.zIndex = "" + d.props.zIndex;
4025
- }
4026
- function B(m, k, M) {
4027
- if (M === void 0 && (M = !0), S.forEach(function(E) {
4028
- E[m] && E[m].apply(E, k);
4029
- }), M) {
4030
- var A;
4031
- (A = d.props)[m].apply(A, k);
4032
- }
4033
- }
4034
- function ae() {
4035
- var m = d.props.aria;
4036
- if (m.content) {
4037
- var k = "aria-" + m.content, M = b.id, A = Ve(d.props.triggerTarget || t);
4038
- A.forEach(function(E) {
4039
- var V = E.getAttribute(k);
4040
- if (d.state.isVisible)
4041
- E.setAttribute(k, V ? V + " " + M : M);
4042
- else {
4043
- var Z = V && V.replace(M, "").trim();
4044
- Z ? E.setAttribute(k, Z) : E.removeAttribute(k);
4045
- }
4046
- });
4047
- }
4048
- }
4049
- function le() {
4050
- if (!(L || !d.props.aria.expanded)) {
4051
- var m = Ve(d.props.triggerTarget || t);
4052
- m.forEach(function(k) {
4053
- d.props.interactive ? k.setAttribute("aria-expanded", d.state.isVisible && k === I() ? "true" : "false") : k.removeAttribute("aria-expanded");
4054
- });
4055
- }
4056
- }
4057
- function Ce() {
4058
- q().removeEventListener("mousemove", y), Dt = Dt.filter(function(m) {
4059
- return m !== y;
4060
- });
4061
- }
4062
- function ce(m) {
4063
- if (!(de.isTouch && (l || m.type === "mousedown"))) {
4064
- var k = m.composedPath && m.composedPath()[0] || m.target;
4065
- if (!(d.props.interactive && Yn(b, k))) {
4066
- if (Ve(d.props.triggerTarget || t).some(function(M) {
4067
- return Yn(M, k);
4068
- })) {
4069
- if (de.isTouch || d.state.isVisible && d.props.trigger.indexOf("click") >= 0)
4070
- return;
4071
- } else
4072
- B("onClickOutside", [d, m]);
4073
- d.props.hideOnClick === !0 && (d.clearDelayTimeouts(), d.hide(), a = !0, setTimeout(function() {
4074
- a = !1;
4075
- }), d.state.isMounted || me());
4076
- }
4077
- }
4078
- }
4079
- function Ee() {
4080
- l = !0;
4081
- }
4082
- function he() {
4083
- l = !1;
4084
- }
4085
- function re() {
4086
- var m = q();
4087
- m.addEventListener("mousedown", ce, !0), m.addEventListener("touchend", ce, Ie), m.addEventListener("touchstart", he, Ie), m.addEventListener("touchmove", Ee, Ie);
4088
- }
4089
- function me() {
4090
- var m = q();
4091
- m.removeEventListener("mousedown", ce, !0), m.removeEventListener("touchend", ce, Ie), m.removeEventListener("touchstart", he, Ie), m.removeEventListener("touchmove", Ee, Ie);
4092
- }
4093
- function $e(m, k) {
4094
- Be(m, function() {
4095
- !d.state.isVisible && b.parentNode && b.parentNode.contains(b) && k();
4096
- });
4097
- }
4098
- function ve(m, k) {
4099
- Be(m, k);
4100
- }
4101
- function Be(m, k) {
4102
- var M = Y().box;
4103
- function A(E) {
4104
- E.target === M && (Qt(M, "remove", A), k());
4105
- }
4106
- if (m === 0)
4107
- return k();
4108
- Qt(M, "remove", p), Qt(M, "add", A), p = A;
4109
- }
4110
- function we(m, k, M) {
4111
- M === void 0 && (M = !1);
4112
- var A = Ve(d.props.triggerTarget || t);
4113
- A.forEach(function(E) {
4114
- E.addEventListener(m, k, M), h.push({
4115
- node: E,
4116
- eventType: m,
4117
- handler: k,
4118
- options: M
4119
- });
4120
- });
4121
- }
4122
- function He() {
4123
- R() && (we("touchstart", Je, {
4124
- passive: !0
4125
- }), we("touchend", wt, {
4126
- passive: !0
4127
- })), xl(d.props.trigger).forEach(function(m) {
4128
- if (m !== "manual")
4129
- switch (we(m, Je), m) {
4130
- case "mouseenter":
4131
- we("mouseleave", wt);
4132
- break;
4133
- case "focus":
4134
- we(Nl ? "focusout" : "blur", Ze);
4135
- break;
4136
- case "focusin":
4137
- we("focusout", Ze);
4138
- break;
4139
- }
4140
- });
4141
- }
4142
- function yt() {
4143
- h.forEach(function(m) {
4144
- var k = m.node, M = m.eventType, A = m.handler, E = m.options;
4145
- k.removeEventListener(M, A, E);
4146
- }), h = [];
4147
- }
4148
- function Je(m) {
4149
- var k, M = !1;
4150
- if (!(!d.state.isEnabled || Qe(m) || a)) {
4151
- var A = ((k = u) == null ? void 0 : k.type) === "focus";
4152
- u = m, v = m.currentTarget, le(), !d.state.isVisible && Ol(m) && Dt.forEach(function(E) {
4153
- return E(m);
4154
- }), m.type === "click" && (d.props.trigger.indexOf("mouseenter") < 0 || s) && d.props.hideOnClick !== !1 && d.state.isVisible ? M = !0 : et(m), m.type === "click" && (s = !M), M && !A && Ae(m);
4155
- }
4156
- }
4157
- function bt(m) {
4158
- var k = m.target, M = I().contains(k) || b.contains(k);
4159
- if (!(m.type === "mousemove" && M)) {
4160
- var A = xe().concat(b).map(function(E) {
4161
- var V, Z = E._tippy, je = (V = Z.popperInstance) == null ? void 0 : V.state;
4162
- return je ? {
4163
- popperRect: E.getBoundingClientRect(),
4164
- popperState: je,
4165
- props: n
4166
- } : null;
4167
- }).filter(Boolean);
4168
- Sl(A, m) && (Ce(), Ae(m));
4169
- }
4170
- }
4171
- function wt(m) {
4172
- var k = Qe(m) || d.props.trigger.indexOf("click") >= 0 && s;
4173
- if (!k) {
4174
- if (d.props.interactive) {
4175
- d.hideWithInteractivity(m);
4176
- return;
4177
- }
4178
- Ae(m);
4179
- }
4180
- }
4181
- function Ze(m) {
4182
- d.props.trigger.indexOf("focusin") < 0 && m.target !== I() || d.props.interactive && m.relatedTarget && b.contains(m.relatedTarget) || Ae(m);
4183
- }
4184
- function Qe(m) {
4185
- return de.isTouch ? R() !== m.type.indexOf("touch") >= 0 : !1;
4186
- }
4187
- function xt() {
4188
- kt();
4189
- var m = d.props, k = m.popperOptions, M = m.placement, A = m.offset, E = m.getReferenceClientRect, V = m.moveTransition, Z = D() ? an(b).arrow : null, je = E ? {
4190
- getBoundingClientRect: E,
4191
- contextElement: E.contextElement || I()
4192
- } : t, Mn = {
4193
- name: "$$tippy",
4194
- enabled: !0,
4195
- phase: "beforeWrite",
4196
- requires: ["computeStyles"],
4197
- fn: function(Et) {
4198
- var _e = Et.state;
4199
- if (D()) {
4200
- var Xr = Y(), Kt = Xr.box;
4201
- ["placement", "reference-hidden", "escaped"].forEach(function(At) {
4202
- At === "placement" ? Kt.setAttribute("data-placement", _e.placement) : _e.attributes.popper["data-popper-" + At] ? Kt.setAttribute("data-" + At, "") : Kt.removeAttribute("data-" + At);
4203
- }), _e.attributes.popper = {};
4204
- }
4205
- }
4206
- }, Se = [{
4207
- name: "offset",
4208
- options: {
4209
- offset: A
4210
- }
4211
- }, {
4212
- name: "preventOverflow",
4213
- options: {
4214
- padding: {
4215
- top: 2,
4216
- bottom: 2,
4217
- left: 5,
4218
- right: 5
4219
- }
4220
- }
4221
- }, {
4222
- name: "flip",
4223
- options: {
4224
- padding: 5
4225
- }
4226
- }, {
4227
- name: "computeStyles",
4228
- options: {
4229
- adaptive: !V
4230
- }
4231
- }, Mn];
4232
- D() && Z && Se.push({
4233
- name: "arrow",
4234
- options: {
4235
- element: Z,
4236
- padding: 3
4237
- }
4238
- }), Se.push.apply(Se, (k == null ? void 0 : k.modifiers) || []), d.popperInstance = vl(je, b, Object.assign({}, k, {
4239
- placement: M,
4240
- onFirstUpdate: f,
4241
- modifiers: Se
4242
- }));
4243
- }
4244
- function kt() {
4245
- d.popperInstance && (d.popperInstance.destroy(), d.popperInstance = null);
4246
- }
4247
- function ge() {
4248
- var m = d.props.appendTo, k, M = I();
4249
- d.props.interactive && m === Rr || m === "parent" ? k = M.parentNode : k = $r(m, [M]), k.contains(b) || k.appendChild(b), d.state.isMounted = !0, xt(), process.env.NODE_ENV !== "production" && ye(d.props.interactive && m === G.appendTo && M.nextElementSibling !== b, ["Interactive tippy element may not be accessible via keyboard", "navigation because it is not directly after the reference element", "in the DOM source order.", `
4250
-
4251
- `, "Using a wrapper <div> or <span> tag around the reference element", "solves this by creating a new parentNode context.", `
4252
-
4253
- `, "Specifying `appendTo: document.body` silences this warning, but it", "assumes you are using a focus management solution to handle", "keyboard navigation.", `
4254
-
4255
- `, "See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "));
4256
- }
4257
- function xe() {
4258
- return Ft(b.querySelectorAll("[data-tippy-root]"));
4259
- }
4260
- function et(m) {
4261
- d.clearDelayTimeouts(), m && B("onTrigger", [d, m]), re();
4262
- var k = H(!0), M = P(), A = M[0], E = M[1];
4263
- de.isTouch && A === "hold" && E && (k = E), k ? r = setTimeout(function() {
4264
- d.show();
4265
- }, k) : d.show();
4266
- }
4267
- function Ae(m) {
4268
- if (d.clearDelayTimeouts(), B("onUntrigger", [d, m]), !d.state.isVisible) {
4269
- me();
4270
- return;
4271
- }
4272
- if (!(d.props.trigger.indexOf("mouseenter") >= 0 && d.props.trigger.indexOf("click") >= 0 && ["mouseleave", "mousemove"].indexOf(m.type) >= 0 && s)) {
4273
- var k = H(!1);
4274
- k ? i = setTimeout(function() {
4275
- d.state.isVisible && d.hide();
4276
- }, k) : o = requestAnimationFrame(function() {
4277
- d.hide();
4278
- });
4279
- }
4280
- }
4281
- function tt() {
4282
- d.state.isEnabled = !0;
4283
- }
4284
- function Mt() {
4285
- d.hide(), d.state.isEnabled = !1;
4286
- }
4287
- function Tt() {
4288
- clearTimeout(r), clearTimeout(i), cancelAnimationFrame(o);
4289
- }
4290
- function Ot(m) {
4291
- if (process.env.NODE_ENV !== "production" && ye(d.state.isDestroyed, Fe("setProps")), !d.state.isDestroyed) {
4292
- B("onBeforeUpdate", [d, m]), yt();
4293
- var k = d.props, M = Jn(t, Object.assign({}, k, Un(m), {
4294
- ignoreAttributes: !0
4295
- }));
4296
- d.props = M, He(), k.interactiveDebounce !== M.interactiveDebounce && (Ce(), y = zn(bt, M.interactiveDebounce)), k.triggerTarget && !M.triggerTarget ? Ve(k.triggerTarget).forEach(function(A) {
4297
- A.removeAttribute("aria-expanded");
4298
- }) : M.triggerTarget && t.removeAttribute("aria-expanded"), le(), j(), C && C(k, M), d.popperInstance && (xt(), xe().forEach(function(A) {
4299
- requestAnimationFrame(A._tippy.popperInstance.forceUpdate);
4300
- })), B("onAfterUpdate", [d, m]);
4301
- }
4302
- }
4303
- function Ct(m) {
4304
- d.setProps({
4305
- content: m
4306
- });
4307
- }
4308
- function Kr() {
4309
- process.env.NODE_ENV !== "production" && ye(d.state.isDestroyed, Fe("show"));
4310
- var m = d.state.isVisible, k = d.state.isDestroyed, M = !d.state.isEnabled, A = de.isTouch && !d.props.touch, E = Jt(d.props.duration, 0, G.duration);
4311
- if (!(m || k || M || A) && !I().hasAttribute("disabled") && (B("onShow", [d], !1), d.props.onShow(d) !== !1)) {
4312
- if (d.state.isVisible = !0, D() && (b.style.visibility = "visible"), j(), re(), d.state.isMounted || (b.style.transition = "none"), D()) {
4313
- var V = Y(), Z = V.box, je = V.content;
4314
- Zt([Z, je], 0);
4315
- }
4316
- f = function() {
4317
- var Se;
4318
- if (!(!d.state.isVisible || c)) {
4319
- if (c = !0, b.style.transition = d.props.moveTransition, D() && d.props.animation) {
4320
- var zt = Y(), Et = zt.box, _e = zt.content;
4321
- Zt([Et, _e], E), qn([Et, _e], "visible");
4322
- }
4323
- ae(), le(), Kn(en, d), (Se = d.popperInstance) == null || Se.forceUpdate(), B("onMount", [d]), d.props.animation && D() && ve(E, function() {
4324
- d.state.isShown = !0, B("onShown", [d]);
4325
- });
4326
- }
4327
- }, ge();
4328
- }
4329
- }
4330
- function Ur() {
4331
- process.env.NODE_ENV !== "production" && ye(d.state.isDestroyed, Fe("hide"));
4332
- var m = !d.state.isVisible, k = d.state.isDestroyed, M = !d.state.isEnabled, A = Jt(d.props.duration, 1, G.duration);
4333
- if (!(m || k || M) && (B("onHide", [d], !1), d.props.onHide(d) !== !1)) {
4334
- if (d.state.isVisible = !1, d.state.isShown = !1, c = !1, s = !1, D() && (b.style.visibility = "hidden"), Ce(), me(), j(!0), D()) {
4335
- var E = Y(), V = E.box, Z = E.content;
4336
- d.props.animation && (Zt([V, Z], A), qn([V, Z], "hidden"));
4337
- }
4338
- ae(), le(), d.props.animation ? D() && $e(A, d.unmount) : d.unmount();
4339
- }
4340
- }
4341
- function qr(m) {
4342
- process.env.NODE_ENV !== "production" && ye(d.state.isDestroyed, Fe("hideWithInteractivity")), q().addEventListener("mousemove", y), Kn(Dt, y), y(m);
4343
- }
4344
- function Yr() {
4345
- process.env.NODE_ENV !== "production" && ye(d.state.isDestroyed, Fe("unmount")), d.state.isVisible && d.hide(), d.state.isMounted && (kt(), xe().forEach(function(m) {
4346
- m._tippy.unmount();
4347
- }), b.parentNode && b.parentNode.removeChild(b), en = en.filter(function(m) {
4348
- return m !== d;
4349
- }), d.state.isMounted = !1, B("onHidden", [d]));
4350
- }
4351
- function Gr() {
4352
- process.env.NODE_ENV !== "production" && ye(d.state.isDestroyed, Fe("destroy")), !d.state.isDestroyed && (d.clearDelayTimeouts(), d.unmount(), yt(), delete t._tippy, d.state.isDestroyed = !0, B("onDestroy", [d]));
4353
- }
4354
- }
4355
- function Xe(t, e) {
4356
- e === void 0 && (e = {});
4357
- var n = G.plugins.concat(e.plugins || []);
4358
- process.env.NODE_ENV !== "production" && (Bl(t), Fr(e, n)), Pl();
4359
- var r = Object.assign({}, e, {
4360
- plugins: n
4361
- }), i = El(t);
4362
- if (process.env.NODE_ENV !== "production") {
4363
- var o = dt(r.content), s = i.length > 1;
4364
- ye(o && s, ["tippy() was passed an Element as the `content` prop, but more than", "one tippy instance was created by this invocation. This means the", "content element will only be appended to the last tippy instance.", `
4365
-
4366
- `, "Instead, pass the .innerHTML of the element, or use a function that", "returns a cloned version of the element instead.", `
4367
-
4368
- `, `1) content: element.innerHTML
4369
- `, "2) content: () => element.cloneNode(true)"].join(" "));
4370
- }
4371
- var a = i.reduce(function(l, c) {
4372
- var u = c && zl(c, r);
4373
- return u && l.push(u), l;
4374
- }, []);
4375
- return dt(t) ? a[0] : a;
4376
- }
4377
- Xe.defaultProps = G;
4378
- Xe.setDefaultProps = _l;
4379
- Xe.currentInput = de;
4380
- Object.assign({}, Tr, {
4381
- effect: function(e) {
4382
- var n = e.state, r = {
4383
- popper: {
4384
- position: n.options.strategy,
4385
- left: "0",
4386
- top: "0",
4387
- margin: "0"
4388
- },
4389
- arrow: {
4390
- position: "absolute"
4391
- },
4392
- reference: {}
4393
- };
4394
- Object.assign(n.elements.popper.style, r.popper), n.styles = r, n.elements.arrow && Object.assign(n.elements.arrow.style, r.arrow);
4395
- }
4396
- });
4397
- Xe.setDefaultProps({
4398
- render: Vr
4399
- });
4400
- class Kl {
4401
- constructor({ editor: e, element: n, view: r, tippyOptions: i = {}, updateDelay: o = 250, shouldShow: s }) {
4402
- this.preventHide = !1, this.shouldShow = ({ view: a, state: l, from: c, to: u }) => {
4403
- const { doc: p, selection: f } = l, { empty: h } = f, y = !p.textBetween(c, u).length && Pi(l.selection), v = this.element.contains(document.activeElement);
4404
- return !(!(a.hasFocus() || v) || h || y || !this.editor.isEditable);
4405
- }, this.mousedownHandler = () => {
4406
- this.preventHide = !0;
4407
- }, this.dragstartHandler = () => {
4408
- this.hide();
4409
- }, this.focusHandler = () => {
4410
- setTimeout(() => this.update(this.editor.view));
4411
- }, this.blurHandler = ({ event: a }) => {
4412
- var l;
4413
- if (this.preventHide) {
4414
- this.preventHide = !1;
4415
- return;
4416
- }
4417
- a != null && a.relatedTarget && (!((l = this.element.parentNode) === null || l === void 0) && l.contains(a.relatedTarget)) || (a == null ? void 0 : a.relatedTarget) !== this.editor.view.dom && this.hide();
4418
- }, this.tippyBlurHandler = (a) => {
4419
- this.blurHandler({ event: a });
4420
- }, this.handleDebouncedUpdate = (a, l) => {
4421
- const c = !(l != null && l.selection.eq(a.state.selection)), u = !(l != null && l.doc.eq(a.state.doc));
4422
- !c && !u || (this.updateDebounceTimer && clearTimeout(this.updateDebounceTimer), this.updateDebounceTimer = window.setTimeout(() => {
4423
- this.updateHandler(a, c, u, l);
4424
- }, this.updateDelay));
4425
- }, this.updateHandler = (a, l, c, u) => {
4426
- var p, f, h;
4427
- const { state: y, composing: v } = a, { selection: g } = y;
4428
- if (v || !l && !c)
4429
- return;
4430
- this.createTooltip();
4431
- const { ranges: x } = g, O = Math.min(...x.map((b) => b.$from.pos)), d = Math.max(...x.map((b) => b.$to.pos));
4432
- if (!((p = this.shouldShow) === null || p === void 0 ? void 0 : p.call(this, {
4433
- editor: this.editor,
4434
- element: this.element,
4435
- view: a,
4436
- state: y,
4437
- oldState: u,
4438
- from: O,
4439
- to: d
4440
- }))) {
4441
- this.hide();
4442
- return;
4443
- }
4444
- (f = this.tippy) === null || f === void 0 || f.setProps({
4445
- getReferenceClientRect: ((h = this.tippyOptions) === null || h === void 0 ? void 0 : h.getReferenceClientRect) || (() => {
4446
- if (or(y.selection)) {
4447
- let b = a.nodeDOM(O);
4448
- if (b) {
4449
- const C = b.dataset.nodeViewWrapper ? b : b.querySelector("[data-node-view-wrapper]");
4450
- if (C && (b = C.firstChild), b)
4451
- return b.getBoundingClientRect();
4452
- }
4453
- }
4454
- return sr(a, O, d);
4455
- })
4456
- }), this.show();
4457
- }, this.editor = e, this.element = n, this.view = r, this.updateDelay = o, s && (this.shouldShow = s), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.addEventListener("dragstart", this.dragstartHandler), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = i, this.element.remove(), this.element.style.visibility = "visible";
4458
- }
4459
- createTooltip() {
4460
- const { element: e } = this.editor.options, n = !!e.parentElement;
4461
- this.element.tabIndex = 0, !(this.tippy || !n) && (this.tippy = Xe(e, {
4462
- duration: 0,
4463
- getReferenceClientRect: null,
4464
- content: this.element,
4465
- interactive: !0,
4466
- trigger: "manual",
4467
- placement: "top",
4468
- hideOnClick: "toggle",
4469
- ...this.tippyOptions
4470
- }), this.tippy.popper.firstChild && this.tippy.popper.firstChild.addEventListener("blur", this.tippyBlurHandler));
4471
- }
4472
- update(e, n) {
4473
- const { state: r } = e, i = r.selection.from !== r.selection.to;
4474
- if (this.updateDelay > 0 && i) {
4475
- this.handleDebouncedUpdate(e, n);
4476
- return;
4477
- }
4478
- const o = !(n != null && n.selection.eq(e.state.selection)), s = !(n != null && n.doc.eq(e.state.doc));
4479
- this.updateHandler(e, o, s, n);
4480
- }
4481
- show() {
4482
- var e;
4483
- (e = this.tippy) === null || e === void 0 || e.show();
4484
- }
4485
- hide() {
4486
- var e;
4487
- (e = this.tippy) === null || e === void 0 || e.hide();
4488
- }
4489
- destroy() {
4490
- var e, n;
4491
- !((e = this.tippy) === null || e === void 0) && e.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (n = this.tippy) === null || n === void 0 || n.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
4492
- }
4493
- }
4494
- const Wr = (t) => new U({
4495
- key: typeof t.pluginKey == "string" ? new J(t.pluginKey) : t.pluginKey,
4496
- view: (e) => new Kl({ view: e, ...t })
4497
- });
4498
- Ge.create({
4499
- name: "bubbleMenu",
4500
- addOptions() {
4501
- return {
4502
- element: null,
4503
- tippyOptions: {},
4504
- pluginKey: "bubbleMenu",
4505
- updateDelay: void 0,
4506
- shouldShow: null
4507
- };
4508
- },
4509
- addProseMirrorPlugins() {
4510
- return this.options.element ? [
4511
- Wr({
4512
- pluginKey: this.options.pluginKey,
4513
- editor: this.editor,
4514
- element: this.options.element,
4515
- tippyOptions: this.options.tippyOptions,
4516
- updateDelay: this.options.updateDelay,
4517
- shouldShow: this.options.shouldShow
4518
- })
4519
- ] : [];
4520
- }
4521
- });
4522
- class Ul {
4523
- getTextContent(e) {
4524
- return Di(e, { textSerializers: Ni(this.editor.schema) });
4525
- }
4526
- constructor({ editor: e, element: n, view: r, tippyOptions: i = {}, shouldShow: o }) {
4527
- this.preventHide = !1, this.shouldShow = ({ view: s, state: a }) => {
4528
- const { selection: l } = a, { $anchor: c, empty: u } = l, p = c.depth === 1, f = c.parent.isTextblock && !c.parent.type.spec.code && !c.parent.textContent && c.parent.childCount === 0 && !this.getTextContent(c.parent);
4529
- return !(!s.hasFocus() || !u || !p || !f || !this.editor.isEditable);
4530
- }, this.mousedownHandler = () => {
4531
- this.preventHide = !0;
4532
- }, this.focusHandler = () => {
4533
- setTimeout(() => this.update(this.editor.view));
4534
- }, this.blurHandler = ({ event: s }) => {
4535
- var a;
4536
- if (this.preventHide) {
4537
- this.preventHide = !1;
4538
- return;
4539
- }
4540
- s != null && s.relatedTarget && (!((a = this.element.parentNode) === null || a === void 0) && a.contains(s.relatedTarget)) || (s == null ? void 0 : s.relatedTarget) !== this.editor.view.dom && this.hide();
4541
- }, this.tippyBlurHandler = (s) => {
4542
- this.blurHandler({ event: s });
4543
- }, this.editor = e, this.element = n, this.view = r, o && (this.shouldShow = o), this.element.addEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.on("focus", this.focusHandler), this.editor.on("blur", this.blurHandler), this.tippyOptions = i, this.element.remove(), this.element.style.visibility = "visible";
4544
- }
4545
- createTooltip() {
4546
- const { element: e } = this.editor.options, n = !!e.parentElement;
4547
- this.element.tabIndex = 0, !(this.tippy || !n) && (this.tippy = Xe(e, {
4548
- duration: 0,
4549
- getReferenceClientRect: null,
4550
- content: this.element,
4551
- interactive: !0,
4552
- trigger: "manual",
4553
- placement: "right",
4554
- hideOnClick: "toggle",
4555
- ...this.tippyOptions
4556
- }), this.tippy.popper.firstChild && this.tippy.popper.firstChild.addEventListener("blur", this.tippyBlurHandler));
4557
- }
4558
- update(e, n) {
4559
- var r, i, o;
4560
- const { state: s } = e, { doc: a, selection: l } = s, { from: c, to: u } = l;
4561
- if (n && n.doc.eq(a) && n.selection.eq(l))
4562
- return;
4563
- if (this.createTooltip(), !((r = this.shouldShow) === null || r === void 0 ? void 0 : r.call(this, {
4564
- editor: this.editor,
4565
- view: e,
4566
- state: s,
4567
- oldState: n
4568
- }))) {
4569
- this.hide();
4570
- return;
4571
- }
4572
- (i = this.tippy) === null || i === void 0 || i.setProps({
4573
- getReferenceClientRect: ((o = this.tippyOptions) === null || o === void 0 ? void 0 : o.getReferenceClientRect) || (() => sr(e, c, u))
4574
- }), this.show();
4575
- }
4576
- show() {
4577
- var e;
4578
- (e = this.tippy) === null || e === void 0 || e.show();
4579
- }
4580
- hide() {
4581
- var e;
4582
- (e = this.tippy) === null || e === void 0 || e.hide();
4583
- }
4584
- destroy() {
4585
- var e, n;
4586
- !((e = this.tippy) === null || e === void 0) && e.popper.firstChild && this.tippy.popper.firstChild.removeEventListener("blur", this.tippyBlurHandler), (n = this.tippy) === null || n === void 0 || n.destroy(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler);
4587
- }
4588
- }
4589
- const zr = (t) => new U({
4590
- key: typeof t.pluginKey == "string" ? new J(t.pluginKey) : t.pluginKey,
4591
- view: (e) => new Ul({ view: e, ...t })
4592
- });
4593
- Ge.create({
4594
- name: "floatingMenu",
4595
- addOptions() {
4596
- return {
4597
- element: null,
4598
- tippyOptions: {},
4599
- pluginKey: "floatingMenu",
4600
- shouldShow: null
4601
- };
4602
- },
4603
- addProseMirrorPlugins() {
4604
- return this.options.element ? [
4605
- zr({
4606
- pluginKey: this.options.pluginKey,
4607
- editor: this.editor,
4608
- element: this.options.element,
4609
- tippyOptions: this.options.tippyOptions,
4610
- shouldShow: this.options.shouldShow
4611
- })
4612
- ] : [];
4613
- }
4614
- });
4615
- ht({
4616
- name: "BubbleMenu",
4617
- props: {
4618
- pluginKey: {
4619
- type: [String, Object],
4620
- default: "bubbleMenu"
4621
- },
4622
- editor: {
4623
- type: Object,
4624
- required: !0
4625
- },
4626
- updateDelay: {
4627
- type: Number,
4628
- default: void 0
4629
- },
4630
- tippyOptions: {
4631
- type: Object,
4632
- default: () => ({})
4633
- },
4634
- shouldShow: {
4635
- type: Function,
4636
- default: null
4637
- }
4638
- },
4639
- setup(t, { slots: e }) {
4640
- const n = cn(null);
4641
- return ar(() => {
4642
- const { updateDelay: r, editor: i, pluginKey: o, shouldShow: s, tippyOptions: a } = t;
4643
- i.registerPlugin(Wr({
4644
- updateDelay: r,
4645
- editor: i,
4646
- element: n.value,
4647
- pluginKey: o,
4648
- shouldShow: s,
4649
- tippyOptions: a
4650
- }));
4651
- }), un(() => {
4652
- const { pluginKey: r, editor: i } = t;
4653
- i.unregisterPlugin(r);
4654
- }), () => {
4655
- var r;
4656
- return mt("div", { ref: n }, (r = e.default) === null || r === void 0 ? void 0 : r.call(e));
4657
- };
4658
- }
4659
- });
4660
- function er(t) {
4661
- return Bi((e, n) => ({
4662
- get() {
4663
- return e(), t;
4664
- },
4665
- set(r) {
4666
- t = r, requestAnimationFrame(() => {
4667
- requestAnimationFrame(() => {
4668
- n();
4669
- });
4670
- });
4671
- }
4672
- }));
4673
- }
4674
- class Jl extends Ri {
4675
- constructor(e = {}) {
4676
- return super(e), this.contentComponent = null, this.appContext = null, this.reactiveState = er(this.view.state), this.reactiveExtensionStorage = er(this.extensionStorage), this.on("beforeTransaction", ({ nextState: n }) => {
4677
- this.reactiveState.value = n, this.reactiveExtensionStorage.value = this.extensionStorage;
4678
- }), $i(this);
4679
- }
4680
- get state() {
4681
- return this.reactiveState ? this.reactiveState.value : this.view.state;
4682
- }
4683
- get storage() {
4684
- return this.reactiveExtensionStorage ? this.reactiveExtensionStorage.value : super.storage;
4685
- }
4686
- /**
4687
- * Register a ProseMirror plugin.
4688
- */
4689
- registerPlugin(e, n) {
4690
- const r = super.registerPlugin(e, n);
4691
- return this.reactiveState && (this.reactiveState.value = r), r;
4692
- }
4693
- /**
4694
- * Unregister a ProseMirror plugin.
4695
- */
4696
- unregisterPlugin(e) {
4697
- const n = super.unregisterPlugin(e);
4698
- return this.reactiveState && n && (this.reactiveState.value = n), n;
4699
- }
4700
- }
4701
- ht({
4702
- name: "EditorContent",
4703
- props: {
4704
- editor: {
4705
- default: null,
4706
- type: Object
4707
- }
4708
- },
4709
- setup(t) {
4710
- const e = cn(), n = Hi();
4711
- return ji(() => {
4712
- const r = t.editor;
4713
- r && r.options.element && e.value && _i(() => {
4714
- if (!e.value || !r.options.element.firstChild)
4715
- return;
4716
- const i = Fi(e.value);
4717
- e.value.append(...r.options.element.childNodes), r.contentComponent = n.ctx._, n && (r.appContext = {
4718
- ...n.appContext,
4719
- // Vue internally uses prototype chain to forward/shadow injects across the entire component chain
4720
- // so don't use object spread operator or 'Object.assign' and just set `provides` as is on editor's appContext
4721
- // @ts-expect-error forward instance's 'provides' into appContext
4722
- provides: n.provides
4723
- }), r.setOptions({
4724
- element: i
4725
- }), r.createNodeViews();
4726
- });
4727
- }), un(() => {
4728
- const r = t.editor;
4729
- r && (r.contentComponent = null, r.appContext = null);
4730
- }), { rootEl: e };
4731
- },
4732
- render() {
4733
- return mt("div", {
4734
- ref: (t) => {
4735
- this.rootEl = t;
4736
- }
4737
- });
4738
- }
4739
- });
4740
- ht({
4741
- name: "FloatingMenu",
4742
- props: {
4743
- pluginKey: {
4744
- // TODO: TypeScript breaks :(
4745
- // type: [String, Object as PropType<Exclude<FloatingMenuPluginProps['pluginKey'], string>>],
4746
- type: null,
4747
- default: "floatingMenu"
4748
- },
4749
- editor: {
4750
- type: Object,
4751
- required: !0
4752
- },
4753
- tippyOptions: {
4754
- type: Object,
4755
- default: () => ({})
4756
- },
4757
- shouldShow: {
4758
- type: Function,
4759
- default: null
4760
- }
4761
- },
4762
- setup(t, { slots: e }) {
4763
- const n = cn(null);
4764
- return ar(() => {
4765
- const { pluginKey: r, editor: i, tippyOptions: o, shouldShow: s } = t;
4766
- i.registerPlugin(zr({
4767
- pluginKey: r,
4768
- editor: i,
4769
- element: n.value,
4770
- tippyOptions: o,
4771
- shouldShow: s
4772
- }));
4773
- }), un(() => {
4774
- const { pluginKey: r, editor: i } = t;
4775
- i.unregisterPlugin(r);
4776
- }), () => {
4777
- var r;
4778
- return mt("div", { ref: n }, (r = e.default) === null || r === void 0 ? void 0 : r.call(e));
4779
- };
4780
- }
4781
- });
4782
- ht({
4783
- name: "NodeViewContent",
4784
- props: {
4785
- as: {
4786
- type: String,
4787
- default: "div"
4788
- }
4789
- },
4790
- render() {
4791
- return mt(this.as, {
4792
- style: {
4793
- whiteSpace: "pre-wrap"
4794
- },
4795
- "data-node-view-content": ""
4796
- });
4797
- }
4798
- });
4799
- ht({
4800
- name: "NodeViewWrapper",
4801
- props: {
4802
- as: {
4803
- type: String,
4804
- default: "div"
4805
- }
4806
- },
4807
- inject: ["onDragStart", "decorationClasses"],
4808
- render() {
4809
- var t, e;
4810
- return mt(this.as, {
4811
- // @ts-ignore
4812
- class: this.decorationClasses,
4813
- style: {
4814
- whiteSpace: "normal"
4815
- },
4816
- "data-node-view-wrapper": "",
4817
- // @ts-ignore (https://github.com/vuejs/vue-next/issues/3031)
4818
- onDragstart: this.onDragStart
4819
- }, (e = (t = this.$slots).default) === null || e === void 0 ? void 0 : e.call(t));
4820
- }
4821
- });
4822
- export {
4823
- Jl as E,
4824
- Gl as P,
4825
- Xl as S
4826
- };