@markweave/vue2 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8,51 +8,54 @@ import { MarkweaveLinkCard as h } from "markweave/internal/plugins/link-card/lin
8
8
  import { openMarkweaveLinkCardComposer as g } from "markweave/internal/plugins/link-card/link-card-composer";
9
9
  import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as v, replaceMarkweaveLinkCardWithLink as y } from "markweave/internal/plugins/link-card/link-card";
10
10
  import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
11
- import { MarkweaveCoreImage as x, MarkweaveCoreVideo as S, attrsFromMarkweaveImageUploadResult as C, attrsFromMarkweaveVideoUploadResult as w, attrsFromMarkweaveVideoUrl as T, clampMarkweaveImageWidth as E, createMarkweaveImageUploadRequest as ee, createMarkweaveVideoUploadRequest as D, downloadMarkweaveImage as O, markweaveVideoIframeAllow as k, normalizeMarkweaveCoreImageAlign as A, normalizeMarkweaveVideoEmbedUrl as j, numberAttribute as M, stringAttribute as N } from "markweave/internal/plugins/media/core-media-nodes";
12
- import { detectUploadSource as P, getDirectUploadResult as F, resolveMarkweaveUploadResult as I } from "markweave/internal/plugins/slash-command/upload";
13
- import { BubbleMenu as te } from "@tiptap/vue-2/menus";
14
- import { isEditorComposing as L } from "markweave/internal/editor-core/composition-guard";
15
- import { createMarkweaveFrameScheduler as R } from "markweave/internal/editor-core/frame-scheduler";
16
- import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
17
- import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as z, getFloatingToolbarTurnIntoOptions as ue, runFloatingToolbarMoreAction as de, setFloatingToolbarTurnInto as fe } from "markweave/internal/editor-core/floating-toolbar-model";
18
- import { openMarkweaveReadonlyLinkFromEvent as pe } from "markweave/internal/editor-core/readonly-link";
19
- import { createMarkweaveEditorRuntimeSnapshot as me } from "markweave/internal/editor-core/runtime-snapshot";
20
- import { areEditorSelectionSnapshotsEquivalent as he, calculateFloatingToolbarPopoverPlacement as ge, createSelectionSnapshot as _e, markweaveRuntimeProjectionDelayMs as ve, shouldShowFloatingToolbar as ye } from "markweave/internal/editor-core/selection-state";
21
- import { normalizeMarkweaveCanvasColor as be, normalizeMarkweaveTheme as xe } from "markweave/internal/core/theme";
22
- import { createMarkweaveTocState as Se, emptyMarkweaveTocState as Ce, getActiveMarkweaveTocId as we, getMarkweaveTocItems as Te, getValidMarkweaveTocActiveId as Ee, normalizeMarkweaveInnerTocPlacement as De, observeMarkweaveInnerTocContainerPosition as Oe, scrollToMarkweaveTocItem as ke } from "markweave/internal/core/toc-state";
23
- import { codeBlockCollapsePluginKey as Ae, copyActiveCodeBlock as je, getActiveCodeBlockState as Me, getCodeBlockCopyFeedbackSnapshot as Ne, markweaveCodeBlockBehavior as Pe, setCodeBlockCollapsedAtPosition as Fe, setCodeBlockLanguageAtPosition as Ie, setCodeBlockMermaidPreviewModeAtPosition as Le } from "markweave/internal/plugins/codeblock/codeblock-behavior";
24
- import { calculateCodeBlockLanguageMenuPosition as Re, clampFullscreenScale as ze, codeBlockCopyFeedbackTimeoutMs as Be, copyCodeBlockText as Ve, createCodeBlockOverlayPosition as He, createMermaidFullscreenViewerState as Ue, createMermaidTabPosition as We, focusCodeBlockTarget as Ge, formatCodeBlockLanguageLabel as Ke, formatFullscreenZoom as qe, getActiveCodeBlockElement as Je, getAnchoredRect as Ye, getCodeBlockLanguageItems as Xe, getCodeBlockPositionFromEventTarget as Ze, getCodeBlockStateAtPosition as Qe, getFrameElement as $e, getMermaidCodeBlockTargets as et, getMermaidSvgMarkup as tt, isCodeBlockTargetCollapsed as nt, mergeStableMermaidTabPositions as rt, mermaidFullscreenZoomStep as it, moveMermaidFullscreenViewer as at } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
25
- import { normalizeMarkdownLinkHref as ot } from "markweave/internal/plugins/markdown/markdown-input";
26
- import { applyMarkweaveMathLatex as st, calculateMarkweaveMathPopoverPosition as ct, getMarkweaveMathAnchorRect as lt, getMarkweaveMathBlockIndex as ut, getMarkweaveMathRenderedHtml as dt, getMarkweaveMathTargetAtPos as ft, getMarkweaveMathTargetFromDomEvent as pt, getMarkweaveMathTargetFromSelection as mt, renderMarkweaveMathPreview as ht, setMarkweaveMathEditingDomState as gt, setMarkweaveMathEditingDomStateInView as _t, setMarkweaveMathSelectionInView as vt } from "markweave/internal/plugins/math/math-ui-model";
27
- import { isMermaidInlinePreviewTransaction as yt, setMarkweaveMermaidTheme as bt, setMermaidInlinePreviewEditorMode as xt, setReadonlyMermaidPreviewMode as St } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
28
- import { getMermaidPreviewState as Ct } from "markweave/internal/plugins/mermaid/mermaid-renderer";
29
- import { filterSlashCommands as wt, isExecutableSlashCommand as Tt } from "markweave/internal/plugins/slash-command/command-spec";
30
- import { getSlashCommandKeyboardAction as Et } from "markweave/internal/plugins/slash-command/slash-keyboard";
31
- import { executeSlashCommand as Dt, getNextSlashCommandState as Ot, getSlashCommandAnchoredMenuPosition as kt, getSlashCommandContext as At } from "markweave/internal/plugins/slash-command/slash-runtime";
32
- import { initialSlashCommandState as jt, reduceSlashCommandState as Mt } from "markweave/internal/plugins/slash-command/slash-state";
33
- import { setMarkweaveTableMenuAxisTarget as Nt } from "markweave/internal/plugins/table/table-clipboard";
34
- import { getFirstTableDebugSnapshot as Pt } from "markweave/internal/plugins/table/table-debug-snapshot";
35
- import { focusFirstTableBodyCell as Ft } from "markweave/internal/plugins/table/table-focus-position";
36
- import { getTableFocusState as It } from "markweave/internal/plugins/table/table-focus-state";
37
- import { getTableSelectionOverlayState as Lt, initialTableInteractionState as Rt, tableInteractionPluginKey as zt } from "markweave/internal/plugins/table/table-interaction-layer";
38
- import { calculateAnchoredTableMenuPosition as Bt, calculateTableEdgeHandlePosition as Vt, canRunTableCommand as Ht, executeTableMenuCommand as Ut, formatTableCopyFeedback as Wt, getActiveTableElement as Gt, getAvailableCellMenuCommandSpecs as Kt, getTableAxisTargetRect as qt, getTableControlAxisSelectionModel as Jt, getTableEditWithAiRequest as Yt, getTableMenuItemGroup as Xt, getTableMenuItemLabel as Zt, getTableMenuItems as Qt, getTableSelectionTargetRect as $t, measureTableSelectionOverlay as en, selectTableAxisFromCell as tn, tableCopyFeedbackTimeoutMs as nn, tableMenuLabel as rn } from "markweave/internal/plugins/table/table-ui-model";
11
+ import { createMarkweaveLightweightImageNodeViewRenderer as x } from "markweave/internal/plugins/media/lightweight-image-node-view";
12
+ import { resolveMarkweaveMediaSource as S } from "markweave/internal/plugins/media/media-source";
13
+ import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as ee, markweaveVideoIframeAllow as j, normalizeMarkweaveCoreImageAlign as M, normalizeMarkweaveVideoEmbedUrl as N, numberAttribute as P, stringAttribute as F } from "markweave/internal/plugins/media/core-media-nodes";
14
+ import { detectUploadSource as I, getDirectUploadResult as te, resolveMarkweaveUploadResult as L } from "markweave/internal/plugins/slash-command/upload";
15
+ import { BubbleMenu as R } from "@tiptap/vue-2/menus";
16
+ import { isEditorComposing as ne } from "markweave/internal/editor-core/composition-guard";
17
+ import { saveMarkweaveBrowserFile as re } from "markweave/internal/core/browser-file-save";
18
+ import { createMarkweaveFrameScheduler as z } from "markweave/internal/editor-core/frame-scheduler";
19
+ import { createMarkweaveEditorUpdatePayload as B, getMarkweaveContentType as ie, isEditorContentCurrent as ae, isMarkweaveControlledContentEchoCurrent as oe, normalizeMarkweaveContentFormat as V } from "markweave/internal/editor-core/editor-content";
20
+ import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as ue, getFloatingToolbarTurnIntoOptions as de, runFloatingToolbarMoreAction as fe, setFloatingToolbarTurnInto as pe } from "markweave/internal/editor-core/floating-toolbar-model";
21
+ import { openMarkweaveReadonlyLinkFromEvent as me } from "markweave/internal/editor-core/readonly-link";
22
+ import { createMarkweaveEditorRuntimeSnapshot as he } from "markweave/internal/editor-core/runtime-snapshot";
23
+ import { areEditorSelectionSnapshotsEquivalent as ge, calculateFloatingToolbarPopoverPlacement as _e, createSelectionSnapshot as ve, markweaveRuntimeProjectionDelayMs as ye, shouldShowFloatingToolbar as be } from "markweave/internal/editor-core/selection-state";
24
+ import { normalizeMarkweaveCanvasColor as xe, normalizeMarkweaveTheme as Se } from "markweave/internal/core/theme";
25
+ import { createMarkweaveTocState as Ce, emptyMarkweaveTocState as we, getActiveMarkweaveTocId as Te, getMarkweaveTocItemsFromState as Ee, getValidMarkweaveTocActiveId as De, normalizeMarkweaveInnerTocPlacement as Oe, observeMarkweaveInnerTocContainerPosition as ke, scrollToMarkweaveTocItem as Ae } from "markweave/internal/core/toc-state";
26
+ import { codeBlockCollapsePluginKey as je, copyActiveCodeBlock as Me, getActiveCodeBlockState as Ne, getCodeBlockCopyFeedbackSnapshot as Pe, markweaveCodeBlockBehavior as Fe, setCodeBlockCollapsedAtPosition as Ie, setCodeBlockLanguageAtPosition as Le, setCodeBlockMermaidPreviewModeAtPosition as Re } from "markweave/internal/plugins/codeblock/codeblock-behavior";
27
+ import { calculateCodeBlockLanguageMenuPosition as ze, clampFullscreenScale as Be, codeBlockCopyFeedbackTimeoutMs as Ve, copyCodeBlockText as He, createCodeBlockLanguageMenuDomId as Ue, createCodeBlockOverlayPosition as We, createMermaidFullscreenViewerState as Ge, createMermaidTabPosition as Ke, focusCodeBlockTarget as qe, formatCodeBlockLanguageLabel as Je, formatFullscreenZoom as Ye, getActiveCodeBlockElement as Xe, getAnchoredRect as Ze, getCodeBlockLanguageItems as Qe, getCodeBlockLanguageOptionDomId as $e, getCodeBlockPositionFromEventTarget as et, getCodeBlockStateAtPosition as tt, getFrameElement as nt, getInitialCodeBlockLanguageItemIndex as rt, getMermaidCodeBlockTargets as it, getMermaidSvgMarkup as at, isCodeBlockTargetCollapsed as ot, mergeStableMermaidTabPositions as st, mermaidFullscreenZoomStep as ct, moveCodeBlockLanguageItemIndex as lt, moveMermaidFullscreenViewer as ut, scrollCodeBlockLanguageItemIntoView as dt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
28
+ import { normalizeMarkdownLinkHref as ft } from "markweave/internal/plugins/markdown/markdown-input";
29
+ import { applyMarkweaveMathLatex as pt, calculateMarkweaveMathPopoverPosition as mt, getMarkweaveMathAnchorRect as ht, getMarkweaveMathBlockIndex as gt, getMarkweaveMathRenderedHtml as _t, getMarkweaveMathTargetAtPos as vt, getMarkweaveMathTargetFromDomEvent as yt, getMarkweaveMathTargetFromSelection as bt, renderMarkweaveMathPreview as xt, setMarkweaveMathEditingDomState as St, setMarkweaveMathEditingDomStateInView as Ct, setMarkweaveMathSelectionInView as wt } from "markweave/internal/plugins/math/math-ui-model";
30
+ import { isMermaidInlinePreviewTransaction as Tt, setMarkweaveMermaidTheme as Et, setMermaidInlinePreviewEditorMode as Dt, setReadonlyMermaidPreviewMode as Ot } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
31
+ import { getMermaidPreviewState as kt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
32
+ import { filterSlashCommands as At, isExecutableSlashCommand as jt } from "markweave/internal/plugins/slash-command/command-spec";
33
+ import { getSlashCommandKeyboardAction as Mt } from "markweave/internal/plugins/slash-command/slash-keyboard";
34
+ import { areSlashCommandMenuPositionsEquivalent as Nt, executeSlashCommand as Pt, getNextSlashCommandState as Ft, getSlashCommandAnchoredMenuPosition as It, getSlashCommandContext as Lt, isSlashCommandAnchorVisible as Rt } from "markweave/internal/plugins/slash-command/slash-runtime";
35
+ import { initialSlashCommandState as zt, reduceSlashCommandState as Bt } from "markweave/internal/plugins/slash-command/slash-state";
36
+ import { setMarkweaveTableMenuAxisTarget as Vt } from "markweave/internal/plugins/table/table-clipboard";
37
+ import { getFirstTableDebugSnapshot as Ht } from "markweave/internal/plugins/table/table-debug-snapshot";
38
+ import { focusFirstTableBodyCell as Ut } from "markweave/internal/plugins/table/table-focus-position";
39
+ import { getTableFocusState as Wt } from "markweave/internal/plugins/table/table-focus-state";
40
+ import { getTableSelectionOverlayState as Gt, initialTableInteractionState as Kt, tableInteractionPluginKey as qt } from "markweave/internal/plugins/table/table-interaction-layer";
41
+ import { applyTableAxisAlignment as Jt, applyTableAxisBackgroundColor as Yt, applyTableAxisTextColor as Xt, calculateAnchoredTableMenuPosition as Zt, calculateAnchoredTableSubmenuPosition as Qt, calculateTableAxisHandleLayout as $t, calculateTableExtendButtonLayout as en, canRunTableCommand as tn, executeTableMenuCommand as nn, formatTableCopyFeedback as rn, getActiveTableElement as an, getAvailableCellMenuCommandSpecs as on, getTableAxisDropIndexAtPoint as sn, getTableAxisFormattingState as cn, getTableAxisTargetRect as ln, getTableControlAxisSelectionModel as un, getTableEditWithAiRequest as dn, getTableMenuBoundaryRect as fn, getTableMenuItemGroup as pn, getTableMenuItemLabel as mn, getTableMenuItems as hn, getTableSelectionTargetRect as gn, measureTableSelectionOverlay as _n, moveTargetedTableAxis as vn, selectTableAxisFromCell as yn, tableColorOptions as bn, tableCopyFeedbackTimeoutMs as xn, tableHorizontalAlignmentOptions as Sn, tableMenuLabel as Cn, tableVerticalAlignmentOptions as wn, targetTableAxisFromCell as Tn } from "markweave/internal/plugins/table/table-ui-model";
39
42
  //#region src/vue2-compat.ts
40
- var an = l.default ?? l, on = null, sn = null, cn = null;
41
- function ln(e) {
43
+ var En = l.default ?? l, Dn = null, On = null, kn = null;
44
+ function An(e) {
42
45
  return !!(e && typeof e == "object" && "value" in e);
43
46
  }
44
- function un(e) {
47
+ function jn(e) {
45
48
  let t = e.slice(2);
46
49
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
47
50
  }
48
- function dn(e) {
51
+ function Mn(e) {
49
52
  let t = {}, n = {}, r = {}, i = {}, a = {};
50
53
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
51
54
  if (o === "class" || o === "style" || o === "key") {
52
55
  t[o] = s;
53
56
  continue;
54
57
  }
55
- if (o === "ref" && ln(s)) {
58
+ if (o === "ref" && An(s)) {
56
59
  a.insert = (e) => {
57
60
  s.value = e.elm;
58
61
  }, a.destroy = () => {
@@ -61,7 +64,7 @@ function dn(e) {
61
64
  continue;
62
65
  }
63
66
  if (/^on[A-Z]/.test(o)) {
64
- i[un(o)] = s;
67
+ i[jn(o)] = s;
65
68
  continue;
66
69
  }
67
70
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -72,14 +75,14 @@ function dn(e) {
72
75
  }
73
76
  return Object.keys(n).length && (t.attrs = n), Object.keys(r).length && (t.domProps = r), Object.keys(i).length && (t.on = i), Object.keys(a).length && (t.hook = a), t;
74
77
  }
75
- function fn(e) {
78
+ function Nn(e) {
76
79
  let t = {}, n = {}, r = {}, i = {};
77
80
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
78
81
  if (a === "class" || a === "style" || a === "key") {
79
82
  t[a] = o;
80
83
  continue;
81
84
  }
82
- if (a === "ref" && ln(o)) {
85
+ if (a === "ref" && An(o)) {
83
86
  i.insert = (e) => {
84
87
  o.value = e.componentInstance ?? e.elm;
85
88
  }, i.destroy = () => {
@@ -95,47 +98,47 @@ function fn(e) {
95
98
  }
96
99
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
97
100
  }
98
- function pn(e) {
101
+ function Pn(e) {
99
102
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
100
103
  }
101
- function mn(e) {
104
+ function Fn(e) {
102
105
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
103
106
  }
104
- function hn(e) {
107
+ function In(e) {
105
108
  return e == null || Array.isArray(e) ? e : [e];
106
109
  }
107
- function gn(e) {
108
- return typeof e == "function" ? hn(e()) : pn(e) ? hn(e.default()) : mn(e) ? [e] : e;
110
+ function Ln(e) {
111
+ return typeof e == "function" ? In(e()) : Pn(e) ? In(e.default()) : Fn(e) ? [e] : e;
109
112
  }
110
- function B(e, t, n) {
111
- if (!cn) throw Error("Vue 2 render context is not available.");
112
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? dn(r) : fn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : gn(n);
113
- return cn(e, i, a);
113
+ function H(e, t, n) {
114
+ if (!kn) throw Error("Vue 2 render context is not available.");
115
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Mn(r) : Nn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Ln(n);
116
+ return kn(e, i, a);
114
117
  }
115
- function V(e) {
116
- return an.observable({ value: e });
117
- }
118
- var H = V;
119
118
  function U(e) {
119
+ return En.observable({ value: e });
120
+ }
121
+ var W = U;
122
+ function G(e) {
120
123
  return { get value() {
121
124
  return e();
122
125
  } };
123
126
  }
124
- function W(e, t, n) {
127
+ function K(e, t, n) {
125
128
  let r = typeof e == "function" ? e : () => e.value;
126
- return on?.$watch ? on.$watch(r, t, n) : () => void 0;
129
+ return Dn?.$watch ? Dn.$watch(r, t, n) : () => void 0;
127
130
  }
128
- function G(e) {
129
- sn?.mounted.push(e);
130
- }
131
- function K(e) {
132
- sn?.beforeUnmount.push(e);
131
+ function Rn(e) {
132
+ On?.mounted.push(e);
133
133
  }
134
134
  function q(e) {
135
- return an.nextTick(e);
135
+ On?.beforeUnmount.push(e);
136
136
  }
137
137
  function J(e) {
138
- return an.extend({
138
+ return En.nextTick(e);
139
+ }
140
+ function Y(e) {
141
+ return En.extend({
139
142
  name: e.name,
140
143
  props: e.props,
141
144
  created() {
@@ -143,12 +146,12 @@ function J(e) {
143
146
  mounted: [],
144
147
  beforeUnmount: []
145
148
  };
146
- on = this, sn = t;
149
+ Dn = this, On = t;
147
150
  try {
148
151
  let n = e.setup?.(this.$props ?? this) ?? null;
149
152
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
150
153
  } finally {
151
- on = null, sn = null;
154
+ Dn = null, On = null;
152
155
  }
153
156
  },
154
157
  mounted() {
@@ -158,19 +161,413 @@ function J(e) {
158
161
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
159
162
  },
160
163
  render(t) {
161
- cn = t;
164
+ kn = t;
162
165
  try {
163
166
  let n = this.__markweaveVue2Render;
164
167
  return n ? n() : e.render?.(t) ?? null;
165
168
  } finally {
166
- cn = null;
169
+ kn = null;
167
170
  }
168
171
  }
169
172
  });
170
173
  }
171
174
  //#endregion
172
175
  //#region src/vue2-icons.ts
173
- var _n = {
176
+ var zn = {
177
+ AlignVerticalJustifyCenter: {
178
+ iconName: "align-vertical-justify-center",
179
+ node: [
180
+ ["rect", {
181
+ width: "14",
182
+ height: "6",
183
+ x: "5",
184
+ y: "16",
185
+ rx: "2",
186
+ key: "1i8z2d"
187
+ }],
188
+ ["rect", {
189
+ width: "10",
190
+ height: "6",
191
+ x: "7",
192
+ y: "2",
193
+ rx: "2",
194
+ key: "ypihtt"
195
+ }],
196
+ ["path", {
197
+ d: "M2 12h20",
198
+ key: "9i4pu4"
199
+ }]
200
+ ]
201
+ },
202
+ AlignVerticalJustifyEnd: {
203
+ iconName: "align-vertical-justify-end",
204
+ node: [
205
+ ["rect", {
206
+ width: "14",
207
+ height: "6",
208
+ x: "5",
209
+ y: "12",
210
+ rx: "2",
211
+ key: "4l4tp2"
212
+ }],
213
+ ["rect", {
214
+ width: "10",
215
+ height: "6",
216
+ x: "7",
217
+ y: "2",
218
+ rx: "2",
219
+ key: "ypihtt"
220
+ }],
221
+ ["path", {
222
+ d: "M2 22h20",
223
+ key: "272qi7"
224
+ }]
225
+ ]
226
+ },
227
+ AlignVerticalJustifyStart: {
228
+ iconName: "align-vertical-justify-start",
229
+ node: [
230
+ ["rect", {
231
+ width: "14",
232
+ height: "6",
233
+ x: "5",
234
+ y: "16",
235
+ rx: "2",
236
+ key: "1i8z2d"
237
+ }],
238
+ ["rect", {
239
+ width: "10",
240
+ height: "6",
241
+ x: "7",
242
+ y: "6",
243
+ rx: "2",
244
+ key: "13squh"
245
+ }],
246
+ ["path", {
247
+ d: "M2 2h20",
248
+ key: "1ennik"
249
+ }]
250
+ ]
251
+ },
252
+ ArrowDown: {
253
+ iconName: "arrow-down",
254
+ node: [["path", {
255
+ d: "M12 5v14",
256
+ key: "s699le"
257
+ }], ["path", {
258
+ d: "m19 12-7 7-7-7",
259
+ key: "1idqje"
260
+ }]]
261
+ },
262
+ ArrowDownAZ: {
263
+ iconName: "arrow-down-a-z",
264
+ node: [
265
+ ["path", {
266
+ d: "m3 16 4 4 4-4",
267
+ key: "1co6wj"
268
+ }],
269
+ ["path", {
270
+ d: "M7 20V4",
271
+ key: "1yoxec"
272
+ }],
273
+ ["path", {
274
+ d: "M20 8h-5",
275
+ key: "1vsyxs"
276
+ }],
277
+ ["path", {
278
+ d: "M15 10V6.5a2.5 2.5 0 0 1 5 0V10",
279
+ key: "ag13bf"
280
+ }],
281
+ ["path", {
282
+ d: "M15 14h5l-5 6h5",
283
+ key: "ur5jdg"
284
+ }]
285
+ ]
286
+ },
287
+ ArrowLeft: {
288
+ iconName: "arrow-left",
289
+ node: [["path", {
290
+ d: "m12 19-7-7 7-7",
291
+ key: "1l729n"
292
+ }], ["path", {
293
+ d: "M19 12H5",
294
+ key: "x3x0zl"
295
+ }]]
296
+ },
297
+ ArrowRight: {
298
+ iconName: "arrow-right",
299
+ node: [["path", {
300
+ d: "M5 12h14",
301
+ key: "1ays0h"
302
+ }], ["path", {
303
+ d: "m12 5 7 7-7 7",
304
+ key: "xquz4c"
305
+ }]]
306
+ },
307
+ ArrowUp: {
308
+ iconName: "arrow-up",
309
+ node: [["path", {
310
+ d: "m5 12 7-7 7 7",
311
+ key: "hav0vg"
312
+ }], ["path", {
313
+ d: "M12 19V5",
314
+ key: "x0mq9r"
315
+ }]]
316
+ },
317
+ ArrowUpZA: {
318
+ iconName: "arrow-up-z-a",
319
+ node: [
320
+ ["path", {
321
+ d: "m3 8 4-4 4 4",
322
+ key: "11wl7u"
323
+ }],
324
+ ["path", {
325
+ d: "M7 4v16",
326
+ key: "1glfcx"
327
+ }],
328
+ ["path", {
329
+ d: "M15 4h5l-5 6h5",
330
+ key: "8asdl1"
331
+ }],
332
+ ["path", {
333
+ d: "M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",
334
+ key: "r6l5cz"
335
+ }],
336
+ ["path", {
337
+ d: "M20 18h-5",
338
+ key: "18j1r2"
339
+ }]
340
+ ]
341
+ },
342
+ BetweenHorizontalEnd: {
343
+ iconName: "between-horizontal-end",
344
+ node: [
345
+ ["rect", {
346
+ width: "13",
347
+ height: "7",
348
+ x: "3",
349
+ y: "3",
350
+ rx: "1",
351
+ key: "11xb64"
352
+ }],
353
+ ["path", {
354
+ d: "m22 15-3-3 3-3",
355
+ key: "26chmm"
356
+ }],
357
+ ["rect", {
358
+ width: "13",
359
+ height: "7",
360
+ x: "3",
361
+ y: "14",
362
+ rx: "1",
363
+ key: "k6ky7n"
364
+ }]
365
+ ]
366
+ },
367
+ BetweenHorizontalStart: {
368
+ iconName: "between-horizontal-start",
369
+ node: [
370
+ ["rect", {
371
+ width: "13",
372
+ height: "7",
373
+ x: "8",
374
+ y: "3",
375
+ rx: "1",
376
+ key: "pkso9a"
377
+ }],
378
+ ["path", {
379
+ d: "m2 9 3 3-3 3",
380
+ key: "1agib5"
381
+ }],
382
+ ["rect", {
383
+ width: "13",
384
+ height: "7",
385
+ x: "8",
386
+ y: "14",
387
+ rx: "1",
388
+ key: "1q5fc1"
389
+ }]
390
+ ]
391
+ },
392
+ BetweenVerticalEnd: {
393
+ iconName: "between-vertical-end",
394
+ node: [
395
+ ["rect", {
396
+ width: "7",
397
+ height: "13",
398
+ x: "3",
399
+ y: "3",
400
+ rx: "1",
401
+ key: "1fdu0f"
402
+ }],
403
+ ["path", {
404
+ d: "m9 22 3-3 3 3",
405
+ key: "17z65a"
406
+ }],
407
+ ["rect", {
408
+ width: "7",
409
+ height: "13",
410
+ x: "14",
411
+ y: "3",
412
+ rx: "1",
413
+ key: "1squn4"
414
+ }]
415
+ ]
416
+ },
417
+ BetweenVerticalStart: {
418
+ iconName: "between-vertical-start",
419
+ node: [
420
+ ["rect", {
421
+ width: "7",
422
+ height: "13",
423
+ x: "3",
424
+ y: "8",
425
+ rx: "1",
426
+ key: "1fjrkv"
427
+ }],
428
+ ["path", {
429
+ d: "m15 2-3 3-3-3",
430
+ key: "1uh6eb"
431
+ }],
432
+ ["rect", {
433
+ width: "7",
434
+ height: "13",
435
+ x: "14",
436
+ y: "8",
437
+ rx: "1",
438
+ key: "w3fjg8"
439
+ }]
440
+ ]
441
+ },
442
+ ChevronRight: {
443
+ iconName: "chevron-right",
444
+ node: [["path", {
445
+ d: "m9 18 6-6-6-6",
446
+ key: "mthhwq"
447
+ }]]
448
+ },
449
+ Copy: {
450
+ iconName: "copy",
451
+ node: [["rect", {
452
+ width: "14",
453
+ height: "14",
454
+ x: "8",
455
+ y: "8",
456
+ rx: "2",
457
+ ry: "2",
458
+ key: "17jyea"
459
+ }], ["path", {
460
+ d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
461
+ key: "zix9uf"
462
+ }]]
463
+ },
464
+ PaintBucket: {
465
+ iconName: "paint-bucket",
466
+ node: [
467
+ ["path", {
468
+ d: "m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",
469
+ key: "irua1i"
470
+ }],
471
+ ["path", {
472
+ d: "m5 2 5 5",
473
+ key: "1lls2c"
474
+ }],
475
+ ["path", {
476
+ d: "M2 13h15",
477
+ key: "1hkzvu"
478
+ }],
479
+ ["path", {
480
+ d: "M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",
481
+ key: "xk76lq"
482
+ }]
483
+ ]
484
+ },
485
+ Plus: {
486
+ iconName: "plus",
487
+ node: [["path", {
488
+ d: "M5 12h14",
489
+ key: "1ays0h"
490
+ }], ["path", {
491
+ d: "M12 5v14",
492
+ key: "s699le"
493
+ }]]
494
+ },
495
+ SquareX: {
496
+ iconName: "square-x",
497
+ node: [
498
+ ["rect", {
499
+ width: "18",
500
+ height: "18",
501
+ x: "3",
502
+ y: "3",
503
+ rx: "2",
504
+ ry: "2",
505
+ key: "1m3agn"
506
+ }],
507
+ ["path", {
508
+ d: "m15 9-6 6",
509
+ key: "1uzhvr"
510
+ }],
511
+ ["path", {
512
+ d: "m9 9 6 6",
513
+ key: "z0biqf"
514
+ }]
515
+ ]
516
+ },
517
+ TableCellsMerge: {
518
+ iconName: "table-cells-merge",
519
+ node: [
520
+ ["path", {
521
+ d: "M12 21v-6",
522
+ key: "lihzve"
523
+ }],
524
+ ["path", {
525
+ d: "M12 9V3",
526
+ key: "da5inc"
527
+ }],
528
+ ["path", {
529
+ d: "M3 15h18",
530
+ key: "5xshup"
531
+ }],
532
+ ["path", {
533
+ d: "M3 9h18",
534
+ key: "1pudct"
535
+ }],
536
+ ["rect", {
537
+ width: "18",
538
+ height: "18",
539
+ x: "3",
540
+ y: "3",
541
+ rx: "2",
542
+ key: "afitv7"
543
+ }]
544
+ ]
545
+ },
546
+ TableCellsSplit: {
547
+ iconName: "table-cells-split",
548
+ node: [
549
+ ["path", {
550
+ d: "M12 15V9",
551
+ key: "8c7uyn"
552
+ }],
553
+ ["path", {
554
+ d: "M3 15h18",
555
+ key: "5xshup"
556
+ }],
557
+ ["path", {
558
+ d: "M3 9h18",
559
+ key: "1pudct"
560
+ }],
561
+ ["rect", {
562
+ width: "18",
563
+ height: "18",
564
+ x: "3",
565
+ y: "3",
566
+ rx: "2",
567
+ key: "afitv7"
568
+ }]
569
+ ]
570
+ },
174
571
  AlignCenter: {
175
572
  iconName: "text-align-center",
176
573
  node: [
@@ -1035,11 +1432,11 @@ var _n = {
1035
1432
  }]]
1036
1433
  }
1037
1434
  };
1038
- function vn(e) {
1039
- return e.map(([e, t]) => B(e, t));
1435
+ function Bn(e) {
1436
+ return e.map(([e, t]) => H(e, t));
1040
1437
  }
1041
- function Y(e) {
1042
- return J({
1438
+ function X(e) {
1439
+ return Y({
1043
1440
  name: `MarkweaveVue2Icon${e}`,
1044
1441
  props: {
1045
1442
  size: {
@@ -1056,8 +1453,8 @@ function Y(e) {
1056
1453
  }
1057
1454
  },
1058
1455
  setup(t) {
1059
- let n = _n[e];
1060
- return () => B("svg", {
1456
+ let n = zn[e];
1457
+ return () => H("svg", {
1061
1458
  class: `lucide lucide-${n.iconName}`,
1062
1459
  viewBox: "0 0 24 24",
1063
1460
  width: t.size,
@@ -1069,12 +1466,12 @@ function Y(e) {
1069
1466
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1070
1467
  "aria-hidden": "true",
1071
1468
  focusable: "false"
1072
- }, vn(n.node));
1469
+ }, Bn(n.node));
1073
1470
  }
1074
1471
  });
1075
1472
  }
1076
- var yn = Y("AlignCenter"), bn = Y("AlignJustify"), xn = Y("AlignLeft"), Sn = Y("AlignRight"), Cn = Y("AlertTriangle"), wn = Y("Bold"), Tn = Y("Braces"), En = Y("Captions"), Dn = Y("CheckCircle2"), On = Y("ChevronDown"), kn = Y("ChevronUp"), An = Y("CircleX"), jn = Y("Code2"), Mn = Y("CornerDownLeft"), Nn = Y("Download"), Pn = Y("Eye"), Fn = Y("ExternalLink"), In = Y("Heading1"), Ln = Y("Heading2"), Rn = Y("Heading3"), zn = Y("Image"), Bn = Y("ImageUp"), Vn = Y("IndentDecrease"), Hn = Y("IndentIncrease"), Un = Y("Info"), Wn = Y("Italic"), Gn = Y("Lightbulb"), Kn = Y("Link2"), qn = Y("List"), Jn = Y("ListChecks"), Yn = Y("ListOrdered"), Xn = Y("Minus"), Zn = Y("MoreVertical"), Qn = Y("Paperclip"), $n = Y("PencilLine"), er = Y("Quote"), tr = Y("Replace"), nr = Y("Sigma"), rr = Y("SmilePlus"), ir = Y("Strikethrough"), ar = Y("Subscript"), or = Y("Superscript"), sr = Y("Table2"), cr = Y("Text"), lr = Y("Trash2"), ur = Y("Type"), dr = Y("Underline"), fr = Y("Upload"), pr = Y("Video"), mr = A;
1077
- function hr(e) {
1473
+ var Vn = X("AlignCenter"), Hn = X("AlignJustify"), Un = X("AlignLeft"), Wn = X("AlignRight"), Gn = X("AlignVerticalJustifyCenter"), Kn = X("AlignVerticalJustifyEnd"), qn = X("AlignVerticalJustifyStart"), Jn = X("AlertTriangle"), Yn = X("ArrowDown"), Xn = X("ArrowDownAZ"), Zn = X("ArrowLeft"), Qn = X("ArrowRight"), $n = X("ArrowUp"), er = X("ArrowUpZA"), tr = X("BetweenHorizontalEnd"), nr = X("BetweenHorizontalStart"), rr = X("BetweenVerticalEnd"), ir = X("BetweenVerticalStart"), ar = X("Bold"), or = X("Braces"), sr = X("Captions"), cr = X("CheckCircle2"), lr = X("ChevronDown"), ur = X("ChevronRight"), dr = X("ChevronUp"), fr = X("CircleX"), pr = X("Code2"), mr = X("CornerDownLeft"), hr = X("Copy"), gr = X("Download"), _r = X("Eye"), vr = X("ExternalLink"), yr = X("Heading1"), br = X("Heading2"), xr = X("Heading3"), Sr = X("Image"), Cr = X("ImageUp"), wr = X("IndentDecrease"), Tr = X("IndentIncrease"), Er = X("Info"), Dr = X("Italic"), Or = X("Lightbulb"), kr = X("Link2"), Ar = X("List"), jr = X("ListChecks"), Mr = X("ListOrdered"), Nr = X("Minus"), Pr = X("MoreVertical"), Fr = X("PaintBucket"), Ir = X("Paperclip"), Lr = X("PencilLine"), Rr = X("Plus"), zr = X("Quote"), Br = X("Replace"), Vr = X("Sigma"), Hr = X("SmilePlus"), Ur = X("SquareX"), Wr = X("Strikethrough"), Gr = X("Subscript"), Kr = X("Superscript"), qr = X("Table2"), Jr = X("TableCellsMerge"), Yr = X("TableCellsSplit"), Xr = X("Text"), Zr = X("Trash2"), Qr = X("Type"), $r = X("Underline"), ei = X("Upload"), ti = X("Video"), ni = M;
1474
+ function ri(e) {
1078
1475
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1079
1476
  let n = t?.getAttribute("data-markweave-mode");
1080
1477
  return n === "view" ? {
@@ -1084,7 +1481,7 @@ function hr(e) {
1084
1481
  mode: "live",
1085
1482
  editable: e.isEditable
1086
1483
  } : u(e);
1087
- }, r = V(n()), i = m(e, () => {
1484
+ }, r = U(n()), i = m(e, () => {
1088
1485
  r.value = n();
1089
1486
  }), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
1090
1487
  r.value = n();
@@ -1092,28 +1489,28 @@ function hr(e) {
1092
1489
  return a && t && a.observe(t, {
1093
1490
  attributes: !0,
1094
1491
  attributeFilter: ["data-markweave-mode"]
1095
- }), K(() => {
1492
+ }), q(() => {
1096
1493
  i(), a?.disconnect();
1097
1494
  }), r;
1098
1495
  }
1099
- function gr(e) {
1496
+ function ii(e) {
1100
1497
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1101
1498
  }
1102
- function _r(e) {
1499
+ function ai(e) {
1103
1500
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1104
1501
  }
1105
- function vr(e) {
1502
+ function oi(e) {
1106
1503
  return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
1107
1504
  }
1108
- function yr(e, t) {
1109
- return B(e, {
1505
+ function si(e, t) {
1506
+ return H(e, {
1110
1507
  size: 18,
1111
1508
  strokeWidth: 1.8,
1112
1509
  "aria-hidden": "true"
1113
1510
  }, { default: () => t });
1114
1511
  }
1115
- function X(e) {
1116
- return B("button", {
1512
+ function ci(e) {
1513
+ return H("button", {
1117
1514
  type: "button",
1118
1515
  "aria-label": e.label,
1119
1516
  title: e.label,
@@ -1121,14 +1518,14 @@ function X(e) {
1121
1518
  "data-active": e.active ? "true" : "false",
1122
1519
  onMousedown: (e) => e.preventDefault(),
1123
1520
  onClick: e.onClick
1124
- }, [yr(e.icon, e.label), B("span", {
1521
+ }, [si(e.icon, e.label), H("span", {
1125
1522
  class: "markweave-image-tooltip",
1126
1523
  role: "tooltip"
1127
1524
  }, e.label)]);
1128
1525
  }
1129
- function br(e) {
1130
- let t = V(null), n = e.messages.image;
1131
- return B("section", {
1526
+ function li(e) {
1527
+ let t = U(null), n = e.messages.image;
1528
+ return H("section", {
1132
1529
  class: "markweave-image-upload-placeholder",
1133
1530
  "data-testid": "markweave-image-upload-placeholder",
1134
1531
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1146,7 +1543,7 @@ function br(e) {
1146
1543
  n && e.onFile(n);
1147
1544
  }
1148
1545
  }, [
1149
- B("input", {
1546
+ H("input", {
1150
1547
  ref: t,
1151
1548
  "data-testid": "markweave-image-file-input",
1152
1549
  type: "file",
@@ -1157,20 +1554,20 @@ function br(e) {
1157
1554
  r && e.onFile(r), n.value = "";
1158
1555
  }
1159
1556
  }),
1160
- B("div", {
1557
+ H("div", {
1161
1558
  class: "markweave-image-upload-icon",
1162
1559
  "aria-hidden": "true"
1163
- }, [B(Bn, {
1560
+ }, [H(Cr, {
1164
1561
  size: 46,
1165
1562
  strokeWidth: 1.6
1166
1563
  })]),
1167
- B("div", { class: "markweave-image-upload-copy" }, [B("button", {
1564
+ H("div", { class: "markweave-image-upload-copy" }, [H("button", {
1168
1565
  type: "button",
1169
1566
  onClick: () => t.value?.click()
1170
- }, n.clickToUpload), B("span", null, n.dragAndDrop)]),
1171
- B("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1172
- B("div", { class: "markweave-image-upload-row" }, [
1173
- B("input", {
1567
+ }, n.clickToUpload), H("span", null, n.dragAndDrop)]),
1568
+ H("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1569
+ H("div", { class: "markweave-image-upload-row" }, [
1570
+ H("input", {
1174
1571
  "data-testid": "markweave-image-url-input",
1175
1572
  value: e.inputValue,
1176
1573
  placeholder: n.uploadInputPlaceholder,
@@ -1180,30 +1577,30 @@ function br(e) {
1180
1577
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1181
1578
  }
1182
1579
  }),
1183
- B("button", {
1580
+ H("button", {
1184
1581
  type: "button",
1185
1582
  "data-testid": "markweave-image-upload-submit",
1186
1583
  disabled: e.isSubmitting || !e.inputValue.trim(),
1187
1584
  onClick: e.onSubmit
1188
- }, [B(Bn, {
1585
+ }, [H(Cr, {
1189
1586
  size: 16,
1190
1587
  strokeWidth: 1.8
1191
1588
  }), e.messages.common.insert]),
1192
- B("button", {
1589
+ H("button", {
1193
1590
  type: "button",
1194
1591
  "data-testid": "markweave-image-upload-cancel",
1195
1592
  onClick: e.onCancel
1196
1593
  }, e.messages.common.cancel)
1197
1594
  ]),
1198
- e.error ? B("div", {
1595
+ e.error ? H("div", {
1199
1596
  class: "markweave-image-upload-error",
1200
1597
  role: "alert"
1201
1598
  }, e.error) : null
1202
1599
  ]);
1203
1600
  }
1204
- function xr(e) {
1205
- let t = V(null), n = e.messages.video;
1206
- return B("section", {
1601
+ function ui(e) {
1602
+ let t = U(null), n = e.messages.video;
1603
+ return H("section", {
1207
1604
  class: "markweave-video-upload-placeholder",
1208
1605
  "data-testid": "markweave-video-upload-placeholder",
1209
1606
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1221,7 +1618,7 @@ function xr(e) {
1221
1618
  n && e.onFile(n);
1222
1619
  }
1223
1620
  }, [
1224
- B("input", {
1621
+ H("input", {
1225
1622
  ref: t,
1226
1623
  "data-testid": "markweave-video-file-input",
1227
1624
  type: "file",
@@ -1232,20 +1629,20 @@ function xr(e) {
1232
1629
  r && e.onFile(r), n.value = "";
1233
1630
  }
1234
1631
  }),
1235
- B("div", {
1632
+ H("div", {
1236
1633
  class: "markweave-video-upload-icon",
1237
1634
  "aria-hidden": "true"
1238
- }, [B(pr, {
1635
+ }, [H(ti, {
1239
1636
  size: 46,
1240
1637
  strokeWidth: 1.6
1241
1638
  })]),
1242
- B("div", { class: "markweave-video-upload-copy" }, [B("button", {
1639
+ H("div", { class: "markweave-video-upload-copy" }, [H("button", {
1243
1640
  type: "button",
1244
1641
  onClick: () => t.value?.click()
1245
- }, n.clickToUpload), B("span", null, n.dragAndDrop)]),
1246
- B("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1247
- B("div", { class: "markweave-video-upload-row" }, [
1248
- B("input", {
1642
+ }, n.clickToUpload), H("span", null, n.dragAndDrop)]),
1643
+ H("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1644
+ H("div", { class: "markweave-video-upload-row" }, [
1645
+ H("input", {
1249
1646
  "data-testid": "markweave-video-url-input",
1250
1647
  value: e.inputValue,
1251
1648
  placeholder: n.uploadInputPlaceholder,
@@ -1255,28 +1652,28 @@ function xr(e) {
1255
1652
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1256
1653
  }
1257
1654
  }),
1258
- B("button", {
1655
+ H("button", {
1259
1656
  type: "button",
1260
1657
  "data-testid": "markweave-video-upload-submit",
1261
1658
  disabled: e.isSubmitting || !e.inputValue.trim(),
1262
1659
  onClick: e.onSubmit
1263
- }, [B(fr, {
1660
+ }, [H(ei, {
1264
1661
  size: 16,
1265
1662
  strokeWidth: 1.8
1266
1663
  }), e.messages.common.insert]),
1267
- B("button", {
1664
+ H("button", {
1268
1665
  type: "button",
1269
1666
  "data-testid": "markweave-video-upload-cancel",
1270
1667
  onClick: e.onCancel
1271
1668
  }, e.messages.common.cancel)
1272
1669
  ]),
1273
- e.error ? B("div", {
1670
+ e.error ? H("div", {
1274
1671
  class: "markweave-video-upload-error",
1275
1672
  role: "alert"
1276
1673
  }, e.error) : null
1277
1674
  ]);
1278
1675
  }
1279
- var Sr = J({
1676
+ var di = Y({
1280
1677
  name: "MarkweaveVueImageNodeView",
1281
1678
  props: {
1282
1679
  editor: {
@@ -1309,10 +1706,31 @@ var Sr = J({
1309
1706
  }
1310
1707
  },
1311
1708
  setup(e) {
1312
- let t = V(null), r = V(!1), i = V(!1), a = V(!1), o = V(""), c = V(null), l = V(!1), u = U(() => e.node.attrs), f = V(!!N(u.value.caption)), p = V(N(u.value.caption) ?? ""), m = hr(e.editor), h = U(() => d(m.value)), g = U(() => e.extension.options?.messages ?? n("zh")), _ = U(() => g.value.image), v = U(() => N(u.value.src)), y = U(() => mr(u.value.align)), x = U(() => M(u.value.width)), S = U(() => N(u.value.caption)), w = U(() => h.value && (!v.value || i.value)), T = () => {
1313
- v.value && b({
1314
- src: v.value,
1315
- alt: N(u.value.alt) ?? "",
1709
+ let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!F(u.value.caption)), p = U(F(u.value.caption) ?? ""), m = ri(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => F(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
1710
+ K(v, (t) => {
1711
+ if (C?.abort(), C = null, !t) {
1712
+ x.value = null;
1713
+ return;
1714
+ }
1715
+ let n = y.value;
1716
+ if (!n) {
1717
+ x.value = { src: t };
1718
+ return;
1719
+ }
1720
+ let r = new AbortController();
1721
+ C = r, S(n, {
1722
+ kind: "image",
1723
+ priority: e.selected ? "visible" : "nearby",
1724
+ signal: r.signal,
1725
+ src: t
1726
+ }).then((e) => {
1727
+ r.signal.aborted || (x.value = e);
1728
+ });
1729
+ }, { immediate: !0 }), q(() => C?.abort());
1730
+ let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => ni(u.value.align)), D = G(() => P(u.value.width)), A = G(() => F(u.value.caption)), j = G(() => h.value && (!v.value || i.value)), M = () => {
1731
+ w.value && b({
1732
+ src: w.value,
1733
+ alt: F(u.value.alt) ?? "",
1316
1734
  messages: {
1317
1735
  dialogAriaLabel: _.value.previewDialogAriaLabel,
1318
1736
  zoomOut: _.value.previewZoomOut,
@@ -1322,67 +1740,67 @@ var Sr = J({
1322
1740
  }
1323
1741
  });
1324
1742
  };
1325
- W(S, (e) => {
1743
+ K(A, (e) => {
1326
1744
  f.value || (p.value = e ?? "");
1327
1745
  });
1328
- let D = () => {
1746
+ let N = () => {
1329
1747
  if (!h.value) return;
1330
1748
  let t = e.getPos();
1331
1749
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1332
- }, k = () => {
1750
+ }, te = () => {
1333
1751
  if (o.value = "", c.value = null, a.value = !1, v.value) {
1334
1752
  i.value = !1;
1335
1753
  return;
1336
1754
  }
1337
1755
  e.deleteNode();
1338
- }, A = async (t) => {
1756
+ }, R = async (t) => {
1339
1757
  if (!h.value) return;
1340
1758
  let n = e.extension.options;
1341
1759
  l.value = !0, c.value = null;
1342
1760
  try {
1343
- let r = await I(ee(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1344
- e.updateAttributes(C(u.value, r)), o.value = "", i.value = !1;
1761
+ let r = await L(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1762
+ e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
1345
1763
  } catch (e) {
1346
1764
  c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
1347
1765
  } finally {
1348
1766
  l.value = !1, a.value = !1;
1349
1767
  }
1350
- }, j = () => {
1768
+ }, ne = () => {
1351
1769
  if (!o.value.trim()) {
1352
1770
  c.value = _.value.uploadRequiredError;
1353
1771
  return;
1354
1772
  }
1355
- A(P(o.value));
1356
- }, F = (e) => {
1357
- A({
1773
+ R(I(o.value));
1774
+ }, re = (e) => {
1775
+ R({
1358
1776
  type: "file",
1359
1777
  file: e,
1360
1778
  mimeType: e.type || "image/*"
1361
1779
  });
1362
- }, te = () => {
1363
- f.value = !f.value, f.value && (p.value = S.value ?? "");
1364
- }, L = (n, r) => {
1780
+ }, z = () => {
1781
+ f.value = !f.value, f.value && (p.value = A.value ?? "");
1782
+ }, B = (n, r) => {
1365
1783
  if (!h.value || !v.value) return;
1366
- r.preventDefault(), r.stopPropagation(), D();
1784
+ r.preventDefault(), r.stopPropagation(), N();
1367
1785
  let i = t.value;
1368
1786
  if (!i) return;
1369
- let a = r.clientX, o = i.getBoundingClientRect().width || x.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1787
+ let a = r.clientX, o = i.getBoundingClientRect().width || D.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1370
1788
  let r = n === "right" ? t.clientX - a : a - t.clientX;
1371
- e.updateAttributes({ width: E(o + r, s) });
1789
+ e.updateAttributes({ width: O(o + r, s) });
1372
1790
  }, l = () => {
1373
1791
  window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
1374
1792
  };
1375
1793
  window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
1376
1794
  };
1377
- return () => w.value ? B(s, {
1795
+ return () => j.value ? H(s, {
1378
1796
  as: "figure",
1379
1797
  class: "markweave-image-node",
1380
1798
  "data-testid": "markweave-image-node",
1381
- "data-align": y.value,
1799
+ "data-align": E.value,
1382
1800
  "data-selected": "false",
1383
1801
  "data-hovered": "false",
1384
1802
  "data-empty": "true"
1385
- }, () => br({
1803
+ }, () => li({
1386
1804
  messages: g.value,
1387
1805
  inputValue: o.value,
1388
1806
  error: c.value,
@@ -1391,17 +1809,17 @@ var Sr = J({
1391
1809
  onInputValue: (e) => {
1392
1810
  o.value = e;
1393
1811
  },
1394
- onFile: F,
1395
- onSubmit: j,
1396
- onCancel: k,
1812
+ onFile: re,
1813
+ onSubmit: ne,
1814
+ onCancel: te,
1397
1815
  onDragActive: (e) => {
1398
1816
  a.value = e;
1399
1817
  }
1400
- })) : B(s, {
1818
+ })) : H(s, {
1401
1819
  as: "figure",
1402
1820
  class: "markweave-image-node",
1403
1821
  "data-testid": "markweave-image-node",
1404
- "data-align": y.value,
1822
+ "data-align": E.value,
1405
1823
  "data-selected": h.value && e.selected ? "true" : "false",
1406
1824
  "data-hovered": r.value ? "true" : "false",
1407
1825
  "data-empty": "false",
@@ -1412,97 +1830,104 @@ var Sr = J({
1412
1830
  r.value = !1;
1413
1831
  },
1414
1832
  onMousedown: (e) => {
1415
- h.value && !gr(e.target) && D();
1833
+ h.value && !ii(e.target) && N();
1416
1834
  }
1417
1835
  }, () => [
1418
- h.value ? B("div", {
1836
+ h.value ? H("div", {
1419
1837
  class: "markweave-image-toolbar",
1420
1838
  "data-testid": "markweave-image-toolbar",
1421
1839
  "data-markweave-image-ui": "true",
1422
1840
  "aria-label": _.value.toolsAriaLabel
1423
1841
  }, [
1424
- X({
1842
+ ci({
1425
1843
  testId: "markweave-image-align-left",
1426
1844
  label: _.value.alignLeft,
1427
- icon: xn,
1428
- active: y.value === "left",
1845
+ icon: Un,
1846
+ active: E.value === "left",
1429
1847
  onClick: () => e.updateAttributes({ align: "left" })
1430
1848
  }),
1431
- X({
1849
+ ci({
1432
1850
  testId: "markweave-image-align-center",
1433
1851
  label: _.value.alignCenter,
1434
- icon: yn,
1435
- active: y.value === "center",
1852
+ icon: Vn,
1853
+ active: E.value === "center",
1436
1854
  onClick: () => e.updateAttributes({ align: "center" })
1437
1855
  }),
1438
- X({
1856
+ ci({
1439
1857
  testId: "markweave-image-align-right",
1440
1858
  label: _.value.alignRight,
1441
- icon: Sn,
1442
- active: y.value === "right",
1859
+ icon: Wn,
1860
+ active: E.value === "right",
1443
1861
  onClick: () => e.updateAttributes({ align: "right" })
1444
1862
  }),
1445
- B("span", {
1863
+ H("span", {
1446
1864
  class: "markweave-image-toolbar-divider",
1447
1865
  "aria-hidden": "true"
1448
1866
  }),
1449
- X({
1867
+ ci({
1450
1868
  testId: "markweave-image-caption",
1451
1869
  label: _.value.caption,
1452
- icon: En,
1453
- active: f.value || !!S.value,
1454
- onClick: te
1870
+ icon: sr,
1871
+ active: f.value || !!A.value,
1872
+ onClick: z
1455
1873
  }),
1456
- X({
1874
+ ci({
1457
1875
  testId: "markweave-image-preview",
1458
1876
  label: _.value.preview,
1459
- icon: Pn,
1460
- onClick: T
1877
+ icon: _r,
1878
+ onClick: M
1461
1879
  }),
1462
- X({
1880
+ ci({
1463
1881
  testId: "markweave-image-download",
1464
1882
  label: _.value.download,
1465
- icon: Nn,
1883
+ icon: gr,
1466
1884
  onClick: () => {
1467
- v.value && O(v.value);
1885
+ w.value && ee(w.value);
1468
1886
  }
1469
1887
  }),
1470
- X({
1888
+ ci({
1471
1889
  testId: "markweave-image-replace",
1472
1890
  label: _.value.replace,
1473
- icon: tr,
1891
+ icon: Br,
1474
1892
  onClick: () => {
1475
1893
  o.value = "", c.value = null, i.value = !0;
1476
1894
  }
1477
1895
  }),
1478
- B("span", {
1896
+ H("span", {
1479
1897
  class: "markweave-image-toolbar-divider",
1480
1898
  "aria-hidden": "true"
1481
1899
  }),
1482
- X({
1900
+ ci({
1483
1901
  testId: "markweave-image-delete",
1484
1902
  label: _.value.delete,
1485
- icon: lr,
1903
+ icon: Zr,
1486
1904
  onClick: () => e.deleteNode()
1487
1905
  })
1488
1906
  ]) : null,
1489
- B("div", {
1907
+ H("div", {
1490
1908
  ref: t,
1491
1909
  class: "markweave-image-box",
1492
- style: x.value ? { width: `${Math.round(x.value)}px` } : void 0
1910
+ style: {
1911
+ ...D.value ? { width: `${Math.round(D.value)}px` } : {},
1912
+ ...x.value?.width && x.value.height ? { aspectRatio: `${x.value.width} / ${x.value.height}` } : {}
1913
+ }
1493
1914
  }, [
1494
- v.value ? B("img", {
1915
+ w.value ? H("img", {
1495
1916
  class: "markweave-image",
1496
- src: v.value,
1497
- alt: N(u.value.alt) ?? "",
1498
- title: N(u.value.title) ?? void 0,
1499
- draggable: !1
1500
- }) : B("div", {
1917
+ src: w.value,
1918
+ alt: F(u.value.alt) ?? "",
1919
+ title: F(u.value.title) ?? void 0,
1920
+ draggable: !1,
1921
+ loading: "lazy",
1922
+ decoding: "async",
1923
+ width: x.value?.width,
1924
+ height: x.value?.height
1925
+ }) : H("div", {
1501
1926
  class: "markweave-image-readonly-empty",
1502
1927
  "data-testid": "markweave-image-readonly-empty",
1503
1928
  "aria-hidden": "true"
1504
1929
  }),
1505
- !h.value && v.value ? B("button", {
1930
+ !h.value && w.value ? H("button", {
1506
1931
  type: "button",
1507
1932
  class: "markweave-image-preview-trigger",
1508
1933
  "data-testid": "markweave-image-preview",
@@ -1510,34 +1935,34 @@ var Sr = J({
1510
1935
  "aria-label": _.value.preview,
1511
1936
  title: _.value.preview,
1512
1937
  onMousedown: (e) => e.preventDefault(),
1513
- onClick: T
1514
- }, [B(Pn, {
1938
+ onClick: M
1939
+ }, [H(_r, {
1515
1940
  size: 16,
1516
1941
  strokeWidth: 1.8
1517
- }), B("span", {
1942
+ }), H("span", {
1518
1943
  class: "markweave-image-tooltip",
1519
1944
  role: "tooltip"
1520
1945
  }, _.value.preview)]) : null,
1521
- h.value ? B("button", {
1946
+ h.value ? H("button", {
1522
1947
  type: "button",
1523
1948
  class: "markweave-image-resize-handle",
1524
1949
  "data-testid": "markweave-image-resize-left",
1525
1950
  "data-side": "left",
1526
1951
  "aria-label": _.value.resizeLeft,
1527
1952
  "data-markweave-image-ui": "true",
1528
- onPointerdown: (e) => L("left", e)
1953
+ onPointerdown: (e) => B("left", e)
1529
1954
  }) : null,
1530
- h.value ? B("button", {
1955
+ h.value ? H("button", {
1531
1956
  type: "button",
1532
1957
  class: "markweave-image-resize-handle",
1533
1958
  "data-testid": "markweave-image-resize-right",
1534
1959
  "data-side": "right",
1535
1960
  "aria-label": _.value.resizeRight,
1536
1961
  "data-markweave-image-ui": "true",
1537
- onPointerdown: (e) => L("right", e)
1962
+ onPointerdown: (e) => B("right", e)
1538
1963
  }) : null
1539
1964
  ]),
1540
- h.value && (f.value || S.value) ? B("input", {
1965
+ h.value && (f.value || A.value) ? H("input", {
1541
1966
  class: "markweave-image-caption-input",
1542
1967
  "data-testid": "markweave-image-caption-input",
1543
1968
  "data-markweave-image-ui": "true",
@@ -1550,13 +1975,13 @@ var Sr = J({
1550
1975
  onKeydown: (e) => {
1551
1976
  e.key === "Escape" && (e.preventDefault(), f.value = !1);
1552
1977
  }
1553
- }) : S.value ? B("figcaption", {
1978
+ }) : A.value ? H("figcaption", {
1554
1979
  class: "markweave-image-caption",
1555
1980
  "data-testid": "markweave-image-caption"
1556
- }, S.value) : null
1981
+ }, A.value) : null
1557
1982
  ]);
1558
1983
  }
1559
- }), Cr = J({
1984
+ }), fi = Y({
1560
1985
  name: "MarkweaveVueVideoNodeView",
1561
1986
  props: {
1562
1987
  editor: {
@@ -1589,15 +2014,15 @@ var Sr = J({
1589
2014
  }
1590
2015
  },
1591
2016
  setup(e) {
1592
- let t = V(!1), r = V(""), i = V(null), a = V(!1), o = hr(e.editor), c = U(() => d(o.value)), l = U(() => e.extension.options?.messages ?? n("zh")), u = U(() => l.value.video), f = U(() => e.node.attrs), p = U(() => N(f.value.src)), m = U(() => N(f.value.embedUrl)), h = U(() => N(f.value.provider)), g = U(() => m.value ? j(m.value, h.value) : null), _ = U(() => N(f.value.mimeType)), v = U(() => N(f.value.title)), y = () => {
2017
+ let t = U(!1), r = U(""), i = U(null), a = U(!1), o = ri(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => F(f.value.src)), m = G(() => F(f.value.embedUrl)), h = G(() => F(f.value.provider)), g = G(() => m.value ? N(m.value, h.value) : null), _ = G(() => F(f.value.mimeType)), v = G(() => F(f.value.title)), y = () => {
1593
2018
  p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
1594
2019
  }, b = async (n) => {
1595
2020
  if (!c.value) return;
1596
2021
  let o = e.extension.options;
1597
2022
  a.value = !0, i.value = null;
1598
2023
  try {
1599
- let t = await I(D(n), o?.onUpload);
1600
- e.updateAttributes(w(t)), r.value = "";
2024
+ let t = await L(A(n), o?.onUpload);
2025
+ e.updateAttributes(E(t)), r.value = "";
1601
2026
  } catch (e) {
1602
2027
  i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
1603
2028
  } finally {
@@ -1605,7 +2030,7 @@ var Sr = J({
1605
2030
  }
1606
2031
  }, x = () => {
1607
2032
  if (!c.value) return;
1608
- let t = T(r.value);
2033
+ let t = D(r.value);
1609
2034
  if (!t) {
1610
2035
  i.value = u.value.unsupportedUrlError;
1611
2036
  return;
@@ -1621,16 +2046,16 @@ var Sr = J({
1621
2046
  if (!c.value) return;
1622
2047
  let t = e.getPos();
1623
2048
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1624
- }, E = (t) => {
2049
+ }, w = (t) => {
1625
2050
  c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
1626
2051
  };
1627
- return () => c.value && !p.value ? B(s, {
2052
+ return () => c.value && !p.value ? H(s, {
1628
2053
  as: "figure",
1629
2054
  class: "markweave-video-node",
1630
2055
  "data-testid": "markweave-video-node",
1631
2056
  "data-empty": "true",
1632
2057
  "data-selected": "false"
1633
- }, () => xr({
2058
+ }, () => ui({
1634
2059
  messages: l.value,
1635
2060
  inputValue: r.value,
1636
2061
  error: i.value,
@@ -1645,7 +2070,7 @@ var Sr = J({
1645
2070
  onDragActive: (e) => {
1646
2071
  t.value = e;
1647
2072
  }
1648
- })) : B(s, {
2073
+ })) : H(s, {
1649
2074
  as: "figure",
1650
2075
  class: "markweave-video-node",
1651
2076
  "data-testid": "markweave-video-node",
@@ -1655,27 +2080,27 @@ var Sr = J({
1655
2080
  "aria-label": u.value.nodeAriaLabel,
1656
2081
  tabindex: c.value ? 0 : void 0,
1657
2082
  onFocus: C,
1658
- onKeydown: E,
2083
+ onKeydown: w,
1659
2084
  onMousedown: (e) => {
1660
- c.value && !_r(e.target) && (e.preventDefault(), C());
2085
+ c.value && !ai(e.target) && (e.preventDefault(), C());
1661
2086
  }
1662
- }, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
2087
+ }, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
1663
2088
  class: "markweave-video-iframe",
1664
2089
  src: g.value,
1665
2090
  title: v.value ?? `${h.value ?? "Video"} embed`,
1666
2091
  "data-markweave-video-embed": "true",
1667
2092
  "data-markweave-video-provider": h.value ?? void 0,
1668
2093
  "data-markweave-video-src": p.value ?? void 0,
1669
- allow: k,
2094
+ allow: j,
1670
2095
  loading: "lazy",
1671
2096
  allowfullscreen: "true"
1672
- }), c.value ? B("button", {
2097
+ }), c.value ? H("button", {
1673
2098
  type: "button",
1674
2099
  class: "markweave-video-selection-layer",
1675
2100
  "data-testid": "markweave-video-selection-layer",
1676
2101
  tabindex: -1,
1677
2102
  "aria-label": u.value.selectAriaLabel
1678
- }) : null]) : p.value ? B("div", { class: "markweave-video-box" }, [B("video", {
2103
+ }) : null]) : p.value ? H("div", { class: "markweave-video-box" }, [H("video", {
1679
2104
  class: "markweave-video",
1680
2105
  src: p.value,
1681
2106
  title: v.value ?? void 0,
@@ -1683,41 +2108,51 @@ var Sr = J({
1683
2108
  controls: !0,
1684
2109
  "data-markweave-video": "true",
1685
2110
  "data-markweave-mime-type": _.value ?? void 0
1686
- }), c.value ? B("button", {
2111
+ }), c.value ? H("button", {
1687
2112
  type: "button",
1688
2113
  class: "markweave-video-selection-layer",
1689
2114
  "data-testid": "markweave-video-selection-layer",
1690
2115
  tabindex: -1,
1691
2116
  "aria-label": u.value.selectAriaLabel
1692
- }) : null]) : B("div", {
2117
+ }) : null]) : H("div", {
1693
2118
  class: "markweave-video-readonly-empty",
1694
2119
  "data-testid": "markweave-video-readonly-empty",
1695
2120
  "aria-hidden": "true"
1696
2121
  })]);
1697
2122
  }
1698
- }), wr = x.extend({
2123
+ }), pi = C.extend({
1699
2124
  addOptions() {
1700
2125
  return {
1701
2126
  ...this.parent?.(),
1702
2127
  messages: n("zh"),
1703
- onUpload: void 0
2128
+ onUpload: void 0,
2129
+ resolveMediaSource: void 0
1704
2130
  };
1705
2131
  },
1706
2132
  addNodeView() {
1707
- return typeof document > "u" ? null : c(Sr, { stopEvent: ({ event: e }) => gr(e.target) });
2133
+ if (typeof document > "u") return null;
2134
+ let e = c(di, { stopEvent: ({ event: e }) => ii(e.target) }), t = this.options.resolveMediaSource;
2135
+ if (!t) return e;
2136
+ let r = x({
2137
+ messages: this.options.messages ?? n("zh"),
2138
+ onUpload: this.options.onUpload,
2139
+ resolveMediaSource: t
2140
+ });
2141
+ return (t) => F(t.node.attrs.src) ? r(t) : e(t);
1708
2142
  }
1709
- }), Tr = S.extend({
2143
+ }), mi = w.extend({
1710
2144
  addOptions() {
1711
2145
  return {
1712
2146
  ...this.parent?.(),
1713
2147
  messages: n("zh"),
1714
- onUpload: void 0
2148
+ onUpload: void 0,
2149
+ resolveMediaSource: void 0
1715
2150
  };
1716
2151
  },
1717
2152
  addNodeView() {
1718
- return typeof document > "u" ? null : c(Cr, { stopEvent: ({ event: e }) => _r(e.target) });
2153
+ return typeof document > "u" ? null : c(fi, { stopEvent: ({ event: e }) => ai(e.target) });
1719
2154
  }
1720
- }), Er = J({
2155
+ }), hi = Y({
1721
2156
  name: "MarkweaveVueLinkCardNodeView",
1722
2157
  props: {
1723
2158
  editor: {
@@ -1750,11 +2185,11 @@ var Sr = J({
1750
2185
  }
1751
2186
  },
1752
2187
  setup(e) {
1753
- let t = e.extension.options, r = t.messages ?? n("zh"), i = hr(e.editor), a = V(!1), o = V(!1), c = V(!1), l = U(() => _(e.node.attrs ?? {})), u = V(l.value?.title ?? ""), f = V(l.value?.href ?? "");
1754
- W(l, (e) => {
2188
+ let t = e.extension.options, r = t.messages ?? n("zh"), i = ri(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
2189
+ K(l, (e) => {
1755
2190
  u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
1756
2191
  });
1757
- let p = U(() => d(i.value)), m = U(() => {
2192
+ let p = G(() => d(i.value)), m = G(() => {
1758
2193
  try {
1759
2194
  return new URL(l.value?.href ?? "").host;
1760
2195
  } catch {
@@ -1778,18 +2213,18 @@ var Sr = J({
1778
2213
  ...r,
1779
2214
  ...i
1780
2215
  }) ?? r);
1781
- }, C = (e, t, n, r) => B("button", {
2216
+ }, C = (e, t, n, r) => H("button", {
1782
2217
  type: "button",
1783
2218
  title: e,
1784
2219
  "aria-label": e,
1785
2220
  "data-testid": n,
1786
2221
  onMousedown: h,
1787
2222
  onClick: r
1788
- }, [yr(t, e), B("span", { role: "tooltip" }, e)]);
2223
+ }, [si(t, e), H("span", { role: "tooltip" }, e)]);
1789
2224
  return () => {
1790
2225
  let n = l.value;
1791
2226
  if (!n) return null;
1792
- let i = !c.value && n.imageUrl ? B("img", {
2227
+ let i = !c.value && n.imageUrl ? H("img", {
1793
2228
  src: n.imageUrl,
1794
2229
  alt: "",
1795
2230
  loading: "lazy",
@@ -1797,7 +2232,7 @@ var Sr = J({
1797
2232
  onError: () => {
1798
2233
  c.value = !0;
1799
2234
  }
1800
- }) : !c.value && n.faviconUrl ? B("img", {
2235
+ }) : !c.value && n.faviconUrl ? H("img", {
1801
2236
  class: "markweave-link-card-favicon",
1802
2237
  src: n.faviconUrl,
1803
2238
  alt: "",
@@ -1806,8 +2241,8 @@ var Sr = J({
1806
2241
  onError: () => {
1807
2242
  c.value = !0;
1808
2243
  }
1809
- }) : B("b", null, m.value.slice(0, 1).toUpperCase());
1810
- return B(s, {
2244
+ }) : H("b", null, m.value.slice(0, 1).toUpperCase());
2245
+ return H(s, {
1811
2246
  as: "article",
1812
2247
  class: "markweave-link-card",
1813
2248
  "data-testid": "markweave-link-card",
@@ -1821,32 +2256,32 @@ var Sr = J({
1821
2256
  a.value = !1;
1822
2257
  },
1823
2258
  onMousedown: (e) => {
1824
- vr(e.target) || e.preventDefault();
2259
+ oi(e.target) || e.preventDefault();
1825
2260
  },
1826
2261
  onClick: (e) => {
1827
- vr(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
2262
+ oi(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
1828
2263
  }
1829
2264
  }, () => [
1830
- B("a", {
2265
+ H("a", {
1831
2266
  class: "markweave-link-card-main",
1832
2267
  href: n.href,
1833
2268
  "aria-label": r.linkCard.open
1834
- }, [B("span", { class: "markweave-link-card-copy" }, [
1835
- B("strong", null, n.title),
1836
- n.description ? B("span", null, n.description) : null,
1837
- B("small", null, n.siteName ?? m.value)
1838
- ]), B("span", {
2269
+ }, [H("span", { class: "markweave-link-card-copy" }, [
2270
+ H("strong", null, n.title),
2271
+ n.description ? H("span", null, n.description) : null,
2272
+ H("small", null, n.siteName ?? m.value)
2273
+ ]), H("span", {
1839
2274
  class: "markweave-link-card-media",
1840
2275
  "aria-hidden": "true"
1841
2276
  }, [i])]),
1842
- p.value && a.value ? B("div", {
2277
+ p.value && a.value ? H("div", {
1843
2278
  class: "markweave-link-card-tools",
1844
2279
  "data-markweave-link-card-ui": "true",
1845
2280
  "aria-label": r.linkCard.toolsAriaLabel
1846
2281
  }, [
1847
- C(r.linkCard.convertToLink, Kn, "markweave-link-card-convert", x),
1848
- C(r.linkCard.copyAddress, Nn, "markweave-link-card-copy", () => b(n.href)),
1849
- C(r.linkCard.edit, $n, "markweave-link-card-edit", (i) => g({
2282
+ C(r.linkCard.convertToLink, kr, "markweave-link-card-convert", x),
2283
+ C(r.linkCard.copyAddress, gr, "markweave-link-card-copy", () => b(n.href)),
2284
+ C(r.linkCard.edit, Lr, "markweave-link-card-edit", (i) => g({
1850
2285
  anchor: i.currentTarget,
1851
2286
  editor: e.editor,
1852
2287
  messages: r,
@@ -1856,15 +2291,15 @@ var Sr = J({
1856
2291
  attrs: n
1857
2292
  }
1858
2293
  })),
1859
- C(r.linkCard.delete, lr, "markweave-link-card-delete", () => e.deleteNode())
2294
+ C(r.linkCard.delete, Zr, "markweave-link-card-delete", () => e.deleteNode())
1860
2295
  ]) : null,
1861
- p.value && o.value ? B("form", {
2296
+ p.value && o.value ? H("form", {
1862
2297
  class: "markweave-link-card-editor",
1863
2298
  "data-markweave-link-card-ui": "true",
1864
2299
  "data-testid": "markweave-link-card-editor",
1865
2300
  onSubmit: S
1866
2301
  }, [
1867
- B("label", null, [B("span", null, r.linkCard.titleLabel), B("input", {
2302
+ H("label", null, [H("span", null, r.linkCard.titleLabel), H("input", {
1868
2303
  value: u.value,
1869
2304
  placeholder: r.linkCard.titlePlaceholder,
1870
2305
  "aria-label": r.linkCard.titleLabel,
@@ -1872,7 +2307,7 @@ var Sr = J({
1872
2307
  u.value = e.target.value;
1873
2308
  }
1874
2309
  })]),
1875
- B("label", null, [B("span", null, r.linkCard.addressLabel), B("input", {
2310
+ H("label", null, [H("span", null, r.linkCard.addressLabel), H("input", {
1876
2311
  value: f.value,
1877
2312
  placeholder: r.linkCard.addressPlaceholder,
1878
2313
  "aria-label": r.linkCard.addressLabel,
@@ -1880,16 +2315,16 @@ var Sr = J({
1880
2315
  f.value = e.target.value;
1881
2316
  }
1882
2317
  })]),
1883
- B("button", {
2318
+ H("button", {
1884
2319
  type: "submit",
1885
2320
  disabled: !v(f.value),
1886
2321
  "aria-label": r.linkCard.edit
1887
- }, [yr(Kn, r.linkCard.edit)])
2322
+ }, [si(kr, r.linkCard.edit)])
1888
2323
  ]) : null
1889
2324
  ]);
1890
2325
  };
1891
2326
  }
1892
- }), Dr = h.extend({
2327
+ }), gi = h.extend({
1893
2328
  addOptions() {
1894
2329
  return {
1895
2330
  ...this.parent?.(),
@@ -1898,32 +2333,33 @@ var Sr = J({
1898
2333
  };
1899
2334
  },
1900
2335
  addNodeView() {
1901
- return typeof document > "u" ? null : c(Er, { stopEvent: ({ event: e }) => vr(e.target) });
2336
+ return typeof document > "u" ? null : c(hi, { stopEvent: ({ event: e }) => oi(e.target) });
1902
2337
  }
1903
2338
  });
1904
2339
  //#endregion
1905
2340
  //#region src/create-editor-extensions.ts
1906
- function Or(t = {}) {
2341
+ function _i(t = {}) {
1907
2342
  return e({
1908
2343
  lang: t.lang,
1909
2344
  onImageUpload: t.onImageUpload,
1910
- linkCardExtension: Dr.configure({
2345
+ linkCardExtension: gi.configure({
1911
2346
  lang: t.lang,
1912
2347
  messages: n(t.lang),
1913
2348
  resolver: t.linkCardResolver
1914
2349
  }),
1915
2350
  mediaExtensions: i({
1916
- image: wr,
1917
- video: Tr,
2351
+ image: pi,
2352
+ video: mi,
1918
2353
  lang: t.lang,
1919
2354
  onImageUpload: t.onImageUpload,
1920
- onVideoUpload: t.onVideoUpload
2355
+ onVideoUpload: t.onVideoUpload,
2356
+ resolveMediaSource: t.resolveMediaSource
1921
2357
  })
1922
2358
  });
1923
2359
  }
1924
2360
  //#endregion
1925
2361
  //#region src/MarkweaveEditor.ts
1926
- var kr = {
2362
+ var vi = {
1927
2363
  active: !1,
1928
2364
  mode: "outside",
1929
2365
  activeCellPos: null,
@@ -1931,17 +2367,17 @@ var kr = {
1931
2367
  selectedCellCount: 0,
1932
2368
  selectionFrom: 0,
1933
2369
  selectionTo: 0
1934
- }, Ar = {
2370
+ }, yi = {
1935
2371
  active: !1,
1936
- language: Pe.defaultLanguage,
2372
+ language: Fe.defaultLanguage,
1937
2373
  mermaidPreviewMode: "code",
1938
2374
  pos: null,
1939
2375
  text: ""
1940
2376
  };
1941
- function jr(e) {
1942
- return zt.getState(e.state) ?? Rt;
2377
+ function bi(e) {
2378
+ return qt.getState(e.state) ?? Kt;
1943
2379
  }
1944
- function Mr(e) {
2380
+ function xi(e) {
1945
2381
  if (!e || typeof window > "u") return null;
1946
2382
  let t = e.parentElement;
1947
2383
  for (; t;) {
@@ -1952,133 +2388,133 @@ function Mr(e) {
1952
2388
  return null;
1953
2389
  }
1954
2390
  function Z(e, t, n = 18, r = 1.8) {
1955
- return B(e, {
2391
+ return H(e, {
1956
2392
  size: n,
1957
2393
  strokeWidth: r,
1958
2394
  "aria-hidden": "true"
1959
2395
  }, { default: () => t });
1960
2396
  }
1961
- function Nr(e) {
1962
- return e === "clipboard" ? [B("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), B("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [B("circle", {
2397
+ function Si(e) {
2398
+ return e === "clipboard" ? [H("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), H("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [H("circle", {
1963
2399
  cx: "10",
1964
2400
  cy: "10",
1965
2401
  r: "5.5"
1966
- }), B("path", { d: "m14 14 4 4" })] : e === "check" ? [B("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
1967
- B("path", { d: "M8 4H4v4" }),
1968
- B("path", { d: "M4 4l5 5" }),
1969
- B("path", { d: "M16 4h4v4" }),
1970
- B("path", { d: "m20 4-5 5" }),
1971
- B("path", { d: "M8 20H4v-4" }),
1972
- B("path", { d: "m4 20 5-5" }),
1973
- B("path", { d: "M16 20h4v-4" }),
1974
- B("path", { d: "m20 20-5-5" })
2402
+ }), H("path", { d: "m14 14 4 4" })] : e === "check" ? [H("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
2403
+ H("path", { d: "M8 4H4v4" }),
2404
+ H("path", { d: "M4 4l5 5" }),
2405
+ H("path", { d: "M16 4h4v4" }),
2406
+ H("path", { d: "m20 4-5 5" }),
2407
+ H("path", { d: "M8 20H4v-4" }),
2408
+ H("path", { d: "m4 20 5-5" }),
2409
+ H("path", { d: "M16 20h4v-4" }),
2410
+ H("path", { d: "m20 20-5-5" })
1975
2411
  ] : e === "download" ? [
1976
- B("path", { d: "M12 4v10" }),
1977
- B("path", { d: "m8 10 4 4 4-4" }),
1978
- B("path", { d: "M5 19h14" })
1979
- ] : e === "close" ? [B("path", { d: "M6 6l12 12" }), B("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
1980
- B("circle", {
2412
+ H("path", { d: "M12 4v10" }),
2413
+ H("path", { d: "m8 10 4 4 4-4" }),
2414
+ H("path", { d: "M5 19h14" })
2415
+ ] : e === "close" ? [H("path", { d: "M6 6l12 12" }), H("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
2416
+ H("circle", {
1981
2417
  cx: "10",
1982
2418
  cy: "10",
1983
2419
  r: "5.25"
1984
2420
  }),
1985
- B("path", { d: "M7.5 10h5" }),
1986
- B("path", { d: "m14 14 4 4" })
2421
+ H("path", { d: "M7.5 10h5" }),
2422
+ H("path", { d: "m14 14 4 4" })
1987
2423
  ] : e === "zoomIn" ? [
1988
- B("circle", {
2424
+ H("circle", {
1989
2425
  cx: "10",
1990
2426
  cy: "10",
1991
2427
  r: "5.25"
1992
2428
  }),
1993
- B("path", { d: "M7.5 10h5" }),
1994
- B("path", { d: "M10 7.5v5" }),
1995
- B("path", { d: "m14 14 4 4" })
1996
- ] : e === "reset" ? [B("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), B("path", { d: "M6.5 8.5H3.5v-3" })] : [B("path", { d: "m6 9 6 6 6-6" })];
2429
+ H("path", { d: "M7.5 10h5" }),
2430
+ H("path", { d: "M10 7.5v5" }),
2431
+ H("path", { d: "m14 14 4 4" })
2432
+ ] : e === "reset" ? [H("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), H("path", { d: "M6.5 8.5H3.5v-3" })] : [H("path", { d: "m6 9 6 6 6-6" })];
1997
2433
  }
1998
2434
  function Q(e) {
1999
- return B("svg", {
2435
+ return H("svg", {
2000
2436
  viewBox: "0 0 24 24",
2001
2437
  "aria-hidden": "true",
2002
2438
  focusable: "false"
2003
- }, B("g", {
2439
+ }, H("g", {
2004
2440
  fill: "none",
2005
2441
  stroke: "currentColor",
2006
2442
  "stroke-linecap": "round",
2007
2443
  "stroke-linejoin": "round",
2008
2444
  "stroke-width": "1.8"
2009
- }, Nr(e)));
2445
+ }, Si(e)));
2010
2446
  }
2011
2447
  function $(e) {
2012
2448
  e.preventDefault();
2013
2449
  }
2014
- function Pr(e) {
2015
- let t = ot(e);
2450
+ function Ci(e) {
2451
+ let t = ft(e);
2016
2452
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
2017
2453
  }
2018
- var Fr = {
2019
- bold: wn,
2020
- italic: Wn,
2021
- underline: dr,
2022
- strike: ir,
2023
- "inline-code": jn,
2024
- link: Kn,
2025
- more: Zn,
2026
- superscript: or,
2027
- subscript: ar,
2028
- "inline-math": nr,
2029
- "align-left": xn,
2030
- "align-center": yn,
2031
- "align-right": Sn,
2032
- "align-justify": bn,
2033
- "decrease-indent": Vn,
2034
- "increase-indent": Hn
2035
- }, Ir = {
2036
- type: cr,
2037
- "heading-1": In,
2038
- "heading-2": Ln,
2039
- "heading-3": Rn,
2040
- "bullet-list": qn,
2041
- "ordered-list": Yn,
2042
- "task-list": Jn,
2043
- blockquote: er,
2044
- "code-block": Tn,
2045
- info: Un,
2046
- tip: Gn,
2047
- warning: Cn,
2048
- error: An,
2049
- success: Dn,
2050
- emoji: rr,
2051
- math: nr,
2052
- table: sr,
2053
- separator: Xn,
2054
- image: zn,
2055
- video: pr,
2056
- attachment: Qn
2454
+ var wi = {
2455
+ bold: ar,
2456
+ italic: Dr,
2457
+ underline: $r,
2458
+ strike: Wr,
2459
+ "inline-code": pr,
2460
+ link: kr,
2461
+ more: Pr,
2462
+ superscript: Kr,
2463
+ subscript: Gr,
2464
+ "inline-math": Vr,
2465
+ "align-left": Un,
2466
+ "align-center": Vn,
2467
+ "align-right": Wn,
2468
+ "align-justify": Hn,
2469
+ "decrease-indent": wr,
2470
+ "increase-indent": Tr
2471
+ }, Ti = {
2472
+ type: Xr,
2473
+ "heading-1": yr,
2474
+ "heading-2": br,
2475
+ "heading-3": xr,
2476
+ "bullet-list": Ar,
2477
+ "ordered-list": Mr,
2478
+ "task-list": jr,
2479
+ blockquote: zr,
2480
+ "code-block": or,
2481
+ info: Er,
2482
+ tip: Or,
2483
+ warning: Jn,
2484
+ error: fr,
2485
+ success: cr,
2486
+ emoji: Hr,
2487
+ math: Vr,
2488
+ table: qr,
2489
+ separator: Nr,
2490
+ image: Sr,
2491
+ video: ti,
2492
+ attachment: Ir
2057
2493
  };
2058
- function Lr(e) {
2059
- let t = Ir[e];
2060
- return B(t, {
2494
+ function Ei(e) {
2495
+ let t = Ti[e];
2496
+ return H(t, {
2061
2497
  size: 18,
2062
2498
  strokeWidth: 1.6,
2063
2499
  absoluteStrokeWidth: !0,
2064
2500
  "aria-hidden": "true"
2065
2501
  });
2066
2502
  }
2067
- var Rr = {
2068
- paragraph: ur,
2069
- "heading-1": In,
2070
- "heading-2": Ln,
2071
- "heading-3": Rn,
2072
- "bullet-list": qn,
2073
- "numbered-list": Yn,
2074
- "todo-list": Jn,
2075
- quote: er,
2076
- "code-block": Tn
2503
+ var Di = {
2504
+ paragraph: Qr,
2505
+ "heading-1": yr,
2506
+ "heading-2": br,
2507
+ "heading-3": xr,
2508
+ "bullet-list": Ar,
2509
+ "numbered-list": Mr,
2510
+ "todo-list": jr,
2511
+ quote: zr,
2512
+ "code-block": or
2077
2513
  };
2078
- function zr(e, t) {
2514
+ function Oi(e, t) {
2079
2515
  return se(e, t).label;
2080
2516
  }
2081
- var Br = J({
2517
+ var ki = Y({
2082
2518
  name: "MarkweaveVueFloatingToolbar",
2083
2519
  props: {
2084
2520
  editor: {
@@ -2095,28 +2531,28 @@ var Br = J({
2095
2531
  }
2096
2532
  },
2097
2533
  setup(e) {
2098
- let t = V(null), n = V(""), r = V(null), i = V(null), a = V("bottom"), o = V(null), s = V(null), c = V(null), l = U(() => ot(n.value.trim())), u = U(() => e.messages.floatingToolbar), d = U(() => ue(e.messages).map((e) => [
2534
+ let t = U(null), n = U(""), r = U(null), i = U(null), a = U("bottom"), o = U(null), s = U(null), c = U(null), l = G(() => ft(n.value.trim())), u = G(() => e.messages.floatingToolbar), d = G(() => de(e.messages).map((e) => [
2099
2535
  e.id,
2100
2536
  e.label,
2101
- Rr[e.id]
2102
- ])), f = U(() => z(e.messages).map((e) => [
2537
+ Di[e.id]
2538
+ ])), f = G(() => ue(e.messages).map((e) => [
2103
2539
  e.id,
2104
2540
  e.value,
2105
2541
  e.label
2106
- ])), p = U(() => ce(e.messages).map((e) => [
2542
+ ])), p = G(() => ce(e.messages).map((e) => [
2107
2543
  e.id,
2108
2544
  e.value,
2109
2545
  e.label
2110
- ])), m = U(() => le(e.messages).map((e) => e.id)), h = () => {
2546
+ ])), m = G(() => le(e.messages).map((e) => e.id)), h = () => {
2111
2547
  l.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: l.value }).run(), t.value = null);
2112
2548
  }, g = () => {
2113
2549
  e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
2114
2550
  }, _ = (r) => {
2115
2551
  t.value = t.value === r ? null : r, r === "link" && (n.value = e.editor.getAttributes("link").href ?? "");
2116
- }, v = R(() => {
2552
+ }, v = z(() => {
2117
2553
  let n = o.value, r = c.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
2118
2554
  if (!t.value || !n || !r) return;
2119
- let s = ge({
2555
+ let s = _e({
2120
2556
  toolbarRect: n.getBoundingClientRect(),
2121
2557
  popoverSize: r.getBoundingClientRect(),
2122
2558
  viewport: {
@@ -2128,11 +2564,11 @@ var Br = J({
2128
2564
  });
2129
2565
  a.value = s.placement;
2130
2566
  });
2131
- W(t, (e) => {
2132
- e && q(v.schedule);
2133
- }), G(() => {
2567
+ K(t, (e) => {
2568
+ e && J(v.schedule);
2569
+ }), Rn(() => {
2134
2570
  window.addEventListener("resize", v.schedule), window.addEventListener("scroll", v.schedule, !0);
2135
- }), K(() => {
2571
+ }), q(() => {
2136
2572
  v.cancel(), window.removeEventListener("resize", v.schedule), window.removeEventListener("scroll", v.schedule, !0);
2137
2573
  });
2138
2574
  let y = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, b = (e, t) => {
@@ -2146,7 +2582,7 @@ var Br = J({
2146
2582
  let e = r.value;
2147
2583
  if (!e || t.value !== null) return null;
2148
2584
  let n = u.value.buttons[e];
2149
- return n ? B("div", {
2585
+ return n ? H("div", {
2150
2586
  class: "markweave-floating-toolbar-tooltip",
2151
2587
  role: "tooltip",
2152
2588
  "data-testid": "markweave-floating-toolbar-tooltip",
@@ -2154,7 +2590,7 @@ var Br = J({
2154
2590
  "data-active": y(e),
2155
2591
  style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
2156
2592
  }, n) : null;
2157
- }, S = (n, i, a, o, s = !1, c) => B("button", {
2593
+ }, S = (n, i, a, o, s = !1, c) => H("button", {
2158
2594
  type: "button",
2159
2595
  class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
2160
2596
  "aria-label": i,
@@ -2173,13 +2609,13 @@ var Br = J({
2173
2609
  onMouseenter: (e) => b(n, e.currentTarget),
2174
2610
  onMouseleave: () => b(null),
2175
2611
  onClick: o
2176
- }, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, zr(e.editor, e.messages)), Z(t.value === "block-type" ? kn : On, i)])] : n === "color" ? [B("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [B("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? kn : On, i)])] : [Z(a, i)]), C = () => B("span", {
2612
+ }, n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Oi(e.editor, e.messages)), Z(t.value === "block-type" ? dr : lr, i)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? dr : lr, i)])] : [Z(a, i)]), C = () => H("span", {
2177
2613
  class: "markweave-floating-toolbar-divider",
2178
2614
  "aria-hidden": "true"
2179
- }), w = (n, r, i) => B("section", {
2615
+ }), w = (n, r, i) => H("section", {
2180
2616
  class: "markweave-floating-toolbar-color-section",
2181
2617
  "aria-label": n
2182
- }, [B("div", { class: "markweave-floating-toolbar-menu-title" }, n), B("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => B("button", {
2618
+ }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
2183
2619
  key: `${r}-${n}`,
2184
2620
  type: "button",
2185
2621
  "aria-label": a,
@@ -2188,33 +2624,33 @@ var Br = J({
2188
2624
  onClick: () => {
2189
2625
  r === "text" ? i ? e.editor.chain().focus().setColor(i).run() : e.editor.chain().focus().unsetColor().run() : i ? e.editor.chain().focus().toggleHighlight({ color: i }).run() : e.editor.chain().focus().unsetHighlight().run(), t.value = null;
2190
2626
  }
2191
- }, r === "text" ? [B("span", {
2627
+ }, r === "text" ? [H("span", {
2192
2628
  class: "markweave-floating-toolbar-text-swatch",
2193
2629
  style: { color: i ?? "#646970" }
2194
- }, "A")] : [B("span", {
2630
+ }, "A")] : [H("span", {
2195
2631
  class: "markweave-floating-toolbar-highlight-swatch",
2196
2632
  style: { backgroundColor: i ?? "#ffffff" },
2197
2633
  "aria-hidden": "true"
2198
- })])))]), T = () => t.value === "block-type" ? B("div", {
2634
+ })])))]), T = () => t.value === "block-type" ? H("div", {
2199
2635
  ref: c,
2200
2636
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
2201
2637
  "data-testid": "markweave-floating-toolbar-turn-menu"
2202
- }, [B("div", { class: "markweave-floating-toolbar-menu-title" }, u.value.turnIntoTitle), ...d.value.map(([n, r, i]) => B("button", {
2638
+ }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, u.value.turnIntoTitle), ...d.value.map(([n, r, i]) => H("button", {
2203
2639
  key: n,
2204
2640
  type: "button",
2205
2641
  "data-testid": `markweave-floating-toolbar-turn-${n}`,
2206
2642
  onMousedown: $,
2207
2643
  onClick: () => {
2208
- fe(e.editor, n), t.value = null;
2644
+ pe(e.editor, n), t.value = null;
2209
2645
  }
2210
- }, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
2646
+ }, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
2211
2647
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
2212
2648
  ref: c,
2213
2649
  "data-testid": "markweave-floating-toolbar-link-popover",
2214
2650
  onSubmit: (e) => {
2215
2651
  e.preventDefault(), h();
2216
2652
  }
2217
- }, [B("input", {
2653
+ }, [H("input", {
2218
2654
  value: n.value,
2219
2655
  placeholder: u.value.linkPlaceholder,
2220
2656
  "aria-label": u.value.linkUrlLabel,
@@ -2222,45 +2658,45 @@ var Br = J({
2222
2658
  onInput: (e) => {
2223
2659
  n.value = e.target.value;
2224
2660
  }
2225
- }), B("span", { class: "markweave-floating-toolbar-link-actions" }, [
2226
- B("button", {
2661
+ }), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
2662
+ H("button", {
2227
2663
  type: "submit",
2228
2664
  disabled: !l.value,
2229
2665
  "aria-label": u.value.applyLink,
2230
2666
  "data-testid": "markweave-floating-toolbar-link-apply",
2231
2667
  onMousedown: $
2232
- }, [Z(Mn, u.value.applyLink)]),
2233
- B("span", {
2668
+ }, [Z(mr, u.value.applyLink)]),
2669
+ H("span", {
2234
2670
  class: "markweave-floating-toolbar-link-divider",
2235
2671
  "aria-hidden": "true"
2236
2672
  }),
2237
- B("button", {
2673
+ H("button", {
2238
2674
  type: "button",
2239
2675
  disabled: !l.value,
2240
2676
  "aria-label": u.value.openLink,
2241
2677
  "data-testid": "markweave-floating-toolbar-link-open",
2242
2678
  onMousedown: $,
2243
- onClick: () => Pr(n.value)
2244
- }, [Z(Fn, u.value.openLink)]),
2245
- B("button", {
2679
+ onClick: () => Ci(n.value)
2680
+ }, [Z(vr, u.value.openLink)]),
2681
+ H("button", {
2246
2682
  type: "button",
2247
2683
  "aria-label": u.value.removeLink,
2248
2684
  "data-testid": "markweave-floating-toolbar-link-remove",
2249
2685
  onMousedown: $,
2250
2686
  onClick: g
2251
- }, [Z(lr, u.value.removeLink)])
2252
- ])]) : t.value === "color" ? B("div", {
2687
+ }, [Z(Zr, u.value.removeLink)])
2688
+ ])]) : t.value === "color" ? H("div", {
2253
2689
  ref: c,
2254
2690
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
2255
2691
  "data-testid": "markweave-floating-toolbar-color-menu"
2256
- }, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ? B("div", {
2692
+ }, [w(u.value.textColorTitle, "text", f.value), w(u.value.highlightColorTitle, "highlight", p.value)]) : t.value === "more" ? H("div", {
2257
2693
  ref: c,
2258
2694
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
2259
2695
  "data-testid": "markweave-floating-toolbar-more-menu"
2260
- }, m.value.map((n) => B("span", {
2696
+ }, m.value.map((n) => H("span", {
2261
2697
  key: n,
2262
2698
  class: "markweave-floating-toolbar-more-item"
2263
- }, [B("button", {
2699
+ }, [H("button", {
2264
2700
  type: "button",
2265
2701
  "aria-label": u.value.moreActions[n],
2266
2702
  "data-testid": `markweave-floating-toolbar-more-${n}`,
@@ -2273,43 +2709,43 @@ var Br = J({
2273
2709
  r.value = null;
2274
2710
  },
2275
2711
  onClick: () => {
2276
- de(e.editor, n), t.value = null;
2712
+ fe(e.editor, n), t.value = null;
2277
2713
  }
2278
- }, [Z(Fr[n], u.value.moreActions[n])]), r.value === n ? B("div", {
2714
+ }, [Z(wi[n], u.value.moreActions[n])]), r.value === n ? H("div", {
2279
2715
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
2280
2716
  role: "tooltip"
2281
2717
  }, u.value.moreActions[n]) : null]))) : null;
2282
- return () => B(te, {
2718
+ return () => H(R, {
2283
2719
  editor: e.editor,
2284
- shouldShow: ({ editor: e }) => e.isEditable && ye(_e(e)),
2720
+ shouldShow: ({ editor: e }) => e.isEditable && be(ve(e)),
2285
2721
  options: { placement: "top" }
2286
- }, { default: () => B("div", {
2722
+ }, { default: () => H("div", {
2287
2723
  ref: o,
2288
2724
  class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
2289
2725
  "data-popover-placement": t.value ? a.value : void 0,
2290
2726
  "data-testid": "markweave-floating-toolbar"
2291
- }, [B("div", {
2727
+ }, [H("div", {
2292
2728
  ref: s,
2293
2729
  class: "markweave-floating-toolbar-content",
2294
2730
  "data-menu": t.value ?? "none"
2295
2731
  }, [
2296
- S("block-type", u.value.buttons["block-type"], ur, () => _("block-type"), t.value === "block-type"),
2732
+ S("block-type", u.value.buttons["block-type"], Qr, () => _("block-type"), t.value === "block-type"),
2297
2733
  C(),
2298
- S("bold", u.value.buttons.bold, wn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2299
- S("italic", u.value.buttons.italic, Wn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2300
- S("underline", u.value.buttons.underline, dr, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2301
- S("strike", u.value.buttons.strike, ir, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2302
- S("inline-code", u.value.buttons["inline-code"], jn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2734
+ S("bold", u.value.buttons.bold, ar, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2735
+ S("italic", u.value.buttons.italic, Dr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2736
+ S("underline", u.value.buttons.underline, $r, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2737
+ S("strike", u.value.buttons.strike, Wr, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2738
+ S("inline-code", u.value.buttons["inline-code"], pr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2303
2739
  C(),
2304
- S("link", u.value.buttons.link, Kn, () => _("link"), e.editor.isActive("link")),
2305
- S("color", u.value.buttons.color, ur, () => _("color"), t.value === "color"),
2740
+ S("link", u.value.buttons.link, kr, () => _("link"), e.editor.isActive("link")),
2741
+ S("color", u.value.buttons.color, Qr, () => _("color"), t.value === "color"),
2306
2742
  C(),
2307
- S("more", u.value.buttons.more, Zn, () => _("more"), t.value === "more"),
2743
+ S("more", u.value.buttons.more, Pr, () => _("more"), t.value === "more"),
2308
2744
  T(),
2309
2745
  x()
2310
2746
  ])]) });
2311
2747
  }
2312
- }), Vr = J({
2748
+ }), Ai = Y({
2313
2749
  name: "MarkweaveVueMathEditorPopover",
2314
2750
  props: {
2315
2751
  editor: {
@@ -2330,17 +2766,17 @@ var Br = J({
2330
2766
  }
2331
2767
  },
2332
2768
  setup(e) {
2333
- let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H(dt(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
2769
+ let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(_t(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
2334
2770
  html: a.value,
2335
2771
  error: !1
2336
- } : ht(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => ut(e.editor, e.target) ?? 1), u = () => {
2772
+ } : xt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => gt(e.editor, e.target) ?? 1), u = () => {
2337
2773
  if (typeof window > "u") return;
2338
- let r = lt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2774
+ let r = ht(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2339
2775
  if (!r || !i) {
2340
2776
  e.onClose();
2341
2777
  return;
2342
2778
  }
2343
- n.value = ct({
2779
+ n.value = mt({
2344
2780
  anchorRect: r,
2345
2781
  frameRect: i,
2346
2782
  kind: e.target.kind,
@@ -2349,7 +2785,7 @@ var Br = J({
2349
2785
  viewportWidth: window.innerWidth
2350
2786
  });
2351
2787
  }, d = () => {
2352
- s.value && st(e.editor, e.target, t.value) && e.onClose();
2788
+ s.value && pt(e.editor, e.target, t.value) && e.onClose();
2353
2789
  }, f = (t) => {
2354
2790
  if (t.key === "Escape") {
2355
2791
  t.preventDefault(), e.onClose(), e.editor.commands.focus();
@@ -2360,14 +2796,14 @@ var Br = J({
2360
2796
  let n = t.target;
2361
2797
  n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
2362
2798
  };
2363
- return W(() => [e.target.pos, e.target.latex], () => {
2364
- t.value = e.target.latex, a.value = dt(e.editor, e.target), q(u);
2365
- }), G(() => {
2366
- gt(e.editor, e.target, !0), u(), q(() => {
2799
+ return K(() => [e.target.pos, e.target.latex], () => {
2800
+ t.value = e.target.latex, a.value = _t(e.editor, e.target), J(u);
2801
+ }), Rn(() => {
2802
+ St(e.editor, e.target, !0), u(), J(() => {
2367
2803
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
2368
2804
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
2369
- }), K(() => {
2370
- gt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2805
+ }), q(() => {
2806
+ St(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2371
2807
  }), () => {
2372
2808
  let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
2373
2809
  ref: i,
@@ -2380,7 +2816,7 @@ var Br = J({
2380
2816
  },
2381
2817
  onKeydown: f
2382
2818
  };
2383
- return e.target.kind === "inline" ? B("form", {
2819
+ return e.target.kind === "inline" ? H("form", {
2384
2820
  ref: r,
2385
2821
  class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
2386
2822
  "aria-label": a,
@@ -2395,22 +2831,22 @@ var Br = J({
2395
2831
  onSubmit: (e) => {
2396
2832
  e.preventDefault(), d();
2397
2833
  }
2398
- }, [B("label", {
2834
+ }, [H("label", {
2399
2835
  class: "markweave-math-inline-source",
2400
2836
  "data-testid": "markweave-math-inline-source"
2401
2837
  }, [
2402
- B("span", { attrs: { "aria-hidden": "true" } }, "$"),
2403
- B("input", {
2838
+ H("span", { attrs: { "aria-hidden": "true" } }, "$"),
2839
+ H("input", {
2404
2840
  ...u,
2405
2841
  "aria-label": c.value.latexLabel,
2406
2842
  size: Math.max(t.value.length, 1)
2407
2843
  }),
2408
- B("span", { attrs: { "aria-hidden": "true" } }, "$")
2409
- ]), B("div", {
2844
+ H("span", { attrs: { "aria-hidden": "true" } }, "$")
2845
+ ]), H("div", {
2410
2846
  class: "markweave-math-inline-preview",
2411
2847
  "data-error": o.value.error ? "true" : "false",
2412
2848
  "data-testid": "markweave-math-editor-preview"
2413
- }, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])]) : B("form", {
2849
+ }, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])]) : H("form", {
2414
2850
  ref: r,
2415
2851
  class: "markweave-math-editor-popover markweave-math-editor-popover--block",
2416
2852
  "aria-label": a,
@@ -2426,39 +2862,39 @@ var Br = J({
2426
2862
  e.preventDefault(), d();
2427
2863
  }
2428
2864
  }, [
2429
- B("div", { class: "markweave-math-block-toolbar" }, [
2430
- B("span", null, c.value.label),
2431
- Z(jn, c.value.label, 15, 1.75),
2432
- B("button", {
2865
+ H("div", { class: "markweave-math-block-toolbar" }, [
2866
+ H("span", null, c.value.label),
2867
+ Z(pr, c.value.label, 15, 1.75),
2868
+ H("button", {
2433
2869
  type: "submit",
2434
2870
  title: c.value.apply,
2435
2871
  "aria-label": c.value.apply,
2436
2872
  disabled: !s.value,
2437
2873
  "data-testid": "markweave-math-editor-apply"
2438
- }, [Z(Dn, c.value.apply, 16, 2)])
2874
+ }, [Z(cr, c.value.apply, 16, 2)])
2439
2875
  ]),
2440
- B("label", {
2876
+ H("label", {
2441
2877
  class: "markweave-math-block-source",
2442
2878
  "data-testid": "markweave-math-block-source"
2443
2879
  }, [
2444
- B("span", { attrs: { "aria-hidden": "true" } }, "$$"),
2445
- B("textarea", {
2880
+ H("span", { attrs: { "aria-hidden": "true" } }, "$$"),
2881
+ H("textarea", {
2446
2882
  ...u,
2447
2883
  "aria-label": c.value.latexLabel,
2448
2884
  rows: 3
2449
2885
  }),
2450
- B("span", { attrs: { "aria-hidden": "true" } }, "$$")
2886
+ H("span", { attrs: { "aria-hidden": "true" } }, "$$")
2451
2887
  ]),
2452
- B("div", {
2888
+ H("div", {
2453
2889
  class: "markweave-math-block-preview",
2454
2890
  "data-error": o.value.error ? "true" : "false",
2455
2891
  "data-math-number": String(l.value),
2456
2892
  "data-testid": "markweave-math-editor-preview"
2457
- }, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])
2893
+ }, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])
2458
2894
  ]);
2459
2895
  };
2460
2896
  }
2461
- }), Hr = J({
2897
+ }), ji = Y({
2462
2898
  name: "MarkweaveVueSlashCommandMenu",
2463
2899
  props: {
2464
2900
  commands: {
@@ -2495,7 +2931,7 @@ var Br = J({
2495
2931
  }
2496
2932
  },
2497
2933
  setup(e) {
2498
- let t = V(""), n = V(null), r = V(null), i = V(!1), a = V(""), o = V(0), s = U(() => {
2934
+ let t = U(""), n = U(null), r = U(null), i = U(!1), a = U(""), o = U(0), s = G(() => {
2499
2935
  let t = a.value.trim().toLowerCase();
2500
2936
  return (t ? e.messages.slash.emojiItems.filter((e) => [
2501
2937
  e.emoji,
@@ -2517,13 +2953,13 @@ var Br = J({
2517
2953
  } : {
2518
2954
  kind: e.inputCommand.uploadKind ?? "attachment",
2519
2955
  trigger: "slash-command",
2520
- source: P(t.value)
2956
+ source: I(t.value)
2521
2957
  };
2522
2958
  if (!n.value && !t.value.trim()) {
2523
2959
  r.value = e.messages.slash.uploadRequiredError;
2524
2960
  return;
2525
2961
  }
2526
- let a = await I(i, e.onUpload);
2962
+ let a = await L(i, e.onUpload);
2527
2963
  e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
2528
2964
  } catch (t) {
2529
2965
  r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
@@ -2550,32 +2986,32 @@ var Br = J({
2550
2986
  group: t,
2551
2987
  commands: e.commands.filter((e) => e.group === t)
2552
2988
  })).filter((e) => e.commands.length);
2553
- return B("div", {
2989
+ return H("div", {
2554
2990
  class: "markweave-slash-layer",
2555
2991
  style: { display: "contents" },
2556
2992
  "data-testid": "markweave-slash-layer"
2557
- }, [B("div", {
2993
+ }, [H("div", {
2558
2994
  class: "markweave-slash-trigger",
2559
2995
  style: d,
2560
2996
  "aria-hidden": "true",
2561
2997
  "data-testid": "markweave-slash-trigger"
2562
- }, [B("span", null, "/"), B("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), B("div", {
2998
+ }, [H("span", null, "/"), H("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), H("div", {
2563
2999
  class: "markweave-slash-menu",
2564
3000
  style: u,
2565
3001
  role: "listbox",
2566
3002
  "aria-label": e.messages.slash.ariaLabel,
2567
3003
  "data-placement": e.position.placement,
2568
3004
  "data-testid": "markweave-slash-menu"
2569
- }, [e.inputCommand?.inputKind === "emoji" ? B("div", {
3005
+ }, [e.inputCommand?.inputKind === "emoji" ? H("div", {
2570
3006
  class: "markweave-slash-subpanel",
2571
3007
  "data-testid": "markweave-slash-emoji-picker"
2572
3008
  }, [
2573
- B("div", { class: "markweave-slash-subpanel-header" }, [B("button", {
3009
+ H("div", { class: "markweave-slash-subpanel-header" }, [H("button", {
2574
3010
  type: "button",
2575
3011
  onMousedown: $,
2576
3012
  onClick: () => e.onInputCommandChange(null)
2577
- }, e.messages.common.back), B("span", null, e.messages.slash.emojiTitle)]),
2578
- B("label", { class: "markweave-slash-input" }, [B("span", null, "/"), B("input", {
3013
+ }, e.messages.common.back), H("span", null, e.messages.slash.emojiTitle)]),
3014
+ H("label", { class: "markweave-slash-input" }, [H("span", null, "/"), H("input", {
2579
3015
  autofocus: !0,
2580
3016
  value: a.value,
2581
3017
  placeholder: e.messages.slash.emojiSearchPlaceholder,
@@ -2586,11 +3022,11 @@ var Br = J({
2586
3022
  t.key === "Escape" ? (t.preventDefault(), e.onInputCommandChange(null)) : t.key === "ArrowDown" ? (t.preventDefault(), o.value = s.value.length ? (o.value + 1) % s.value.length : 0) : t.key === "ArrowUp" ? (t.preventDefault(), o.value = s.value.length ? (o.value - 1 + s.value.length) % s.value.length : 0) : (t.key === "Enter" || t.key === "Tab") && (t.preventDefault(), l(o.value));
2587
3023
  }
2588
3024
  })]),
2589
- B("div", {
3025
+ H("div", {
2590
3026
  class: "markweave-slash-emoji-grid",
2591
3027
  role: "listbox",
2592
3028
  "aria-label": e.messages.slash.emojiTitle
2593
- }, s.value.map((e, t) => B("button", {
3029
+ }, s.value.map((e, t) => H("button", {
2594
3030
  key: `${e.emoji}-${e.label}`,
2595
3031
  type: "button",
2596
3032
  role: "option",
@@ -2599,17 +3035,17 @@ var Br = J({
2599
3035
  onMouseenter: () => o.value = t,
2600
3036
  onMousedown: $,
2601
3037
  onClick: () => l(t)
2602
- }, [B("span", null, e.emoji), B("small", null, e.label)])))
2603
- ]) : e.inputCommand?.inputKind === "upload" ? B("div", {
3038
+ }, [H("span", null, e.emoji), H("small", null, e.label)])))
3039
+ ]) : e.inputCommand?.inputKind === "upload" ? H("div", {
2604
3040
  class: "markweave-slash-subpanel",
2605
3041
  "data-testid": "markweave-slash-upload-panel"
2606
3042
  }, [
2607
- B("div", { class: "markweave-slash-upload-header" }, [B("button", {
3043
+ H("div", { class: "markweave-slash-upload-header" }, [H("button", {
2608
3044
  type: "button",
2609
3045
  onMousedown: $,
2610
3046
  onClick: () => e.onInputCommandChange(null)
2611
- }, e.messages.common.back), B("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
2612
- B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.slash.uploadValueLabel), B("input", {
3047
+ }, e.messages.common.back), H("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
3048
+ H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.slash.uploadValueLabel), H("input", {
2613
3049
  autofocus: !0,
2614
3050
  value: t.value,
2615
3051
  placeholder: e.messages.slash.uploadValuePlaceholder,
@@ -2620,32 +3056,32 @@ var Br = J({
2620
3056
  e.key === "Enter" && (e.preventDefault(), c());
2621
3057
  }
2622
3058
  })]),
2623
- B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.common.file), B("input", {
3059
+ H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.common.file), H("input", {
2624
3060
  type: "file",
2625
3061
  onChange: (e) => n.value = e.target.files?.[0] ?? null
2626
3062
  })]),
2627
- r.value ? B("div", {
3063
+ r.value ? H("div", {
2628
3064
  class: "markweave-slash-upload-error",
2629
3065
  role: "alert"
2630
3066
  }, r.value) : null,
2631
- B("div", { class: "markweave-slash-upload-actions" }, [B("button", {
3067
+ H("div", { class: "markweave-slash-upload-actions" }, [H("button", {
2632
3068
  type: "button",
2633
3069
  onMousedown: $,
2634
3070
  onClick: () => e.onInputCommandChange(null)
2635
- }, e.messages.common.cancel), B("button", {
3071
+ }, e.messages.common.cancel), H("button", {
2636
3072
  type: "button",
2637
3073
  "data-primary": "true",
2638
3074
  disabled: i.value,
2639
3075
  onMousedown: $,
2640
3076
  onClick: c
2641
3077
  }, e.messages.common.insert)])
2642
- ]) : e.commands.length ? B("div", { class: "markweave-slash-command-list" }, f.map((t) => B("section", {
3078
+ ]) : e.commands.length ? H("div", { class: "markweave-slash-command-list" }, f.map((t) => H("section", {
2643
3079
  key: t.group,
2644
3080
  class: "markweave-slash-group",
2645
3081
  "aria-label": t.group
2646
- }, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
2647
- let n = e.commands.indexOf(t) === e.state.activeIndex, r = Tt(t);
2648
- return B("button", {
3082
+ }, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
3083
+ let n = e.commands.indexOf(t) === e.state.activeIndex, r = jt(t);
3084
+ return H("button", {
2649
3085
  key: t.id,
2650
3086
  type: "button",
2651
3087
  role: "option",
@@ -2667,18 +3103,44 @@ var Br = J({
2667
3103
  }
2668
3104
  }
2669
3105
  }, [
2670
- Lr(t.icon),
2671
- B("span", null, t.label),
2672
- t.disabledReason ? B("small", null, t.disabledReason) : null
3106
+ Ei(t.icon),
3107
+ H("span", null, t.label),
3108
+ t.disabledReason ? H("small", null, t.disabledReason) : null
2673
3109
  ]);
2674
- })]))) : B("div", {
3110
+ })]))) : H("div", {
2675
3111
  class: "markweave-slash-menu__empty",
2676
3112
  role: "option",
2677
3113
  "aria-disabled": "true"
2678
3114
  }, e.messages.slash.noResults)])]);
2679
3115
  };
2680
3116
  }
2681
- }), Ur = J({
3117
+ }), Mi = {
3118
+ "move-left": Zn,
3119
+ "move-right": Qn,
3120
+ "move-up": $n,
3121
+ "move-down": Yn,
3122
+ "insert-left": ir,
3123
+ "insert-right": rr,
3124
+ "insert-above": nr,
3125
+ "insert-below": tr,
3126
+ "sort-asc": Xn,
3127
+ "sort-desc": er,
3128
+ color: Fr,
3129
+ alignment: Un,
3130
+ clear: Ur,
3131
+ duplicate: hr,
3132
+ copy: hr,
3133
+ merge: Jr,
3134
+ split: Yr,
3135
+ delete: Zr
3136
+ }, Ni = {
3137
+ left: Un,
3138
+ center: Vn,
3139
+ right: Wn,
3140
+ top: qn,
3141
+ middle: Gn,
3142
+ bottom: Kn
3143
+ }, Pi = Y({
2682
3144
  name: "MarkweaveVueTableControls",
2683
3145
  props: {
2684
3146
  editor: {
@@ -2711,221 +3173,465 @@ var Br = J({
2711
3173
  }
2712
3174
  },
2713
3175
  setup(e) {
2714
- let t = V(null), n = V("row-edge"), r = V(null), i = V(null), a = V(null), o = V(null), s = V(null), c = V(null), l = V(null), u = V(null), d = V(null), f = V(null), p = null, m = U(() => e.active ? It(e.editor.state) : kr), h = U(() => Jt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Jt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Kt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? Qt(e.editor, t.value) : []), b = () => {
2715
- p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
2716
- }, x = (e) => {
2717
- b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
2718
- s.value = null, p = null;
2719
- }, nn));
2720
- }, S = () => {
3176
+ let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.active ? Wt(e.editor.state) : vi), w = G(() => un(e.editor, e.interactionState, "row", C.value.activeCellPos)), T = G(() => un(e.editor, e.interactionState, "column", C.value.activeCellPos)), E = G(() => on(e.editor)), D = G(() => (E.value, C.value.active)), O = G(() => t.value ? hn(e.editor, t.value) : []), k = () => {
3177
+ b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
3178
+ }, A = (e) => {
3179
+ k(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
3180
+ d.value = null, b = null;
3181
+ }, xn));
3182
+ }, ee = () => {
2721
3183
  if (!e.active) {
2722
- r.value = null, i.value = null, a.value = null, x(null);
3184
+ i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, A(null);
2723
3185
  return;
2724
3186
  }
2725
- let o = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
2726
- if (!o) {
2727
- r.value = null, i.value = null, a.value = null;
3187
+ let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement;
3188
+ if (!n) {
3189
+ i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
2728
3190
  return;
2729
3191
  }
2730
- let s = o.getBoundingClientRect(), c = h.value ? qt(e.editor, h.value) : null, l = g.value ? qt(e.editor, g.value) : null, u = v.value ? $t(e.editor) : null;
2731
- c ? r.value = Vt({
2732
- targetRect: c,
2733
- frameRect: s,
3192
+ let l = n.getBoundingClientRect(), u = w.value ? ln(e.editor, w.value) : null, d = T.value ? ln(e.editor, T.value) : null, f = D.value ? gn(e.editor) : null, p = an(e.editor)?.getBoundingClientRect() ?? null;
3193
+ u ? i.value = $t({
3194
+ targetRect: u,
3195
+ frameRect: l,
2734
3196
  kind: "row"
2735
- }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Vt({
2736
- targetRect: l,
2737
- frameRect: s,
3197
+ }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = $t({
3198
+ targetRect: d,
3199
+ frameRect: l,
2738
3200
  kind: "column"
2739
- }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Vt({
2740
- targetRect: u,
2741
- frameRect: s,
3201
+ }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = $t({
3202
+ targetRect: f,
3203
+ frameRect: l,
2742
3204
  kind: "selection"
2743
- }) : t.value === "selection" && n.value === "selection-edge" || (a.value = null);
2744
- }, C = () => {
3205
+ }) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
3206
+ let m = e.interactionState.hoverCellPos !== null && !!(w.value && w.value.index === w.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(T.value && T.value.index === T.value.visualWidth - 1);
3207
+ s.value = p && m ? en({
3208
+ tableRect: p,
3209
+ frameRect: l,
3210
+ kind: "row"
3211
+ }) : null, c.value = p && h ? en({
3212
+ tableRect: p,
3213
+ frameRect: l,
3214
+ kind: "column"
3215
+ }) : null;
3216
+ }, j = () => {
2745
3217
  if (!e.active || !t.value) {
2746
- o.value = null;
3218
+ l.value = null;
2747
3219
  return;
2748
3220
  }
2749
- let r = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = n.value === "row-edge" ? l.value : n.value === "column-edge" ? u.value : d.value;
2750
- if (!r || !i || !f.value) {
2751
- o.value = null;
3221
+ let n = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = r.value === "row-edge" ? m.value : r.value === "column-edge" ? h.value : g.value;
3222
+ if (!n || !i || !_.value) {
3223
+ l.value = null;
2752
3224
  return;
2753
3225
  }
2754
- let a = i.getBoundingClientRect(), s = t.value === "row" ? Gt(e.editor)?.getBoundingClientRect() : null, c = s ? {
3226
+ let a = i.getBoundingClientRect(), o = t.value === "row" ? an(e.editor)?.getBoundingClientRect() : null, s = o ? {
2755
3227
  left: a.left,
2756
- top: s.top,
3228
+ top: o.top,
2757
3229
  width: a.width,
2758
3230
  height: a.height
2759
- } : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
2760
- o.value = Bt({
2761
- anchorRect: c,
2762
- frameRect: p,
3231
+ } : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
3232
+ l.value = Zt({
3233
+ anchorRect: s,
3234
+ frameRect: c,
3235
+ boundaryRect: fn(n),
2763
3236
  menuSize: {
2764
- width: m.width || 204,
2765
- height: m.height || 220
3237
+ width: u.width || 254,
3238
+ height: f || u.height || 410
2766
3239
  },
2767
3240
  kind: t.value
2768
3241
  });
2769
- }, w = () => {
2770
- S(), C();
2771
- }, T = () => {
2772
- q(w);
2773
- }, E = (e, r) => {
2774
- let i = t.value === e && n.value === r;
2775
- n.value = r, t.value = i ? null : e, T();
2776
- }, ee = () => {
2777
- e.editor.view.dispatch(Nt(e.editor.state.tr, null));
2778
- }, D = (t, n) => {
2779
- let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
2780
- r !== null && tn(e.editor, r, t, { visualIndex: i }), E(t, n);
2781
- }, O = () => {
2782
- ee(), E("selection", "selection-edge");
2783
- }, k = (n = !1) => {
2784
- t.value = null, o.value = null, n && e.editor.view.focus();
2785
- }, A = async (n, r) => {
2786
- let i = await Ut({
3242
+ }, M = () => {
3243
+ if (!e.active || !t.value || !n.value || !l.value) {
3244
+ u.value = null;
3245
+ return;
3246
+ }
3247
+ let r = e.editor.view.dom.closest(".markweave-editor-frame") ?? e.editor.view.dom.parentElement, i = _.value?.querySelector(`[data-submenu-trigger="${n.value}"]`);
3248
+ if (!r || !_.value || !y.value || !i) {
3249
+ u.value = null;
3250
+ return;
3251
+ }
3252
+ let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
3253
+ u.value = Qt({
3254
+ triggerRect: i.getBoundingClientRect(),
3255
+ parentMenuRect: _.value.getBoundingClientRect(),
3256
+ boundaryRect: fn(r),
3257
+ submenuSize: {
3258
+ width: a.width || 238,
3259
+ height: o || 410
3260
+ }
3261
+ });
3262
+ }, N = () => {
3263
+ ee(), j(), M();
3264
+ }, P = () => {
3265
+ J(N);
3266
+ }, F = (e, i) => {
3267
+ let a = t.value === e && r.value === i;
3268
+ r.value = i, t.value = a ? null : e, n.value = null, u.value = null, P();
3269
+ }, I = () => {
3270
+ e.editor.view.dispatch(Vt(e.editor.state.tr, null));
3271
+ }, te = (t, n) => {
3272
+ let r = e.interactionState.hoverCellPos ?? C.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
3273
+ r !== null && yn(e.editor, r, t, { visualIndex: i }), F(t, n);
3274
+ }, L = () => {
3275
+ I(), F("selection", "selection-edge");
3276
+ }, R = (r = !1) => {
3277
+ t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
3278
+ }, ne = async (n, r) => {
3279
+ let i = await nn({
2787
3280
  editor: e.editor,
2788
3281
  commandId: n,
2789
3282
  menu: r ?? t.value ?? "selection",
2790
3283
  messages: e.messages
2791
3284
  });
2792
- return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
2793
- }, j = (t) => {
2794
- let n = Yt(e.editor, t);
2795
- n && e.onEditWithAi?.(n), k(!0);
2796
- }, M = (e) => {
2797
- !t.value || e.key !== "Escape" || k(!0);
2798
- }, N = (e) => {
2799
- t.value && (e.target instanceof Node && c.value?.contains(e.target) || k());
3285
+ return i.copyFeedback ? (A(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : A(null), e.onCommandResult?.(i.commandResult), i.success;
3286
+ }, re = (t) => {
3287
+ let n = dn(e.editor, t);
3288
+ n && e.onEditWithAi?.(n), R(!0);
3289
+ }, z = (e) => {
3290
+ t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, P());
3291
+ }, B = (t) => {
3292
+ let n = t === "row" ? w.value : T.value, r = e.interactionState.hoverCellPos ?? C.value.activeCellPos;
3293
+ !n || r === null || Tn(e.editor, r, t, { visualIndex: n.index }) && ne(t === "row" ? "add-row-after" : "add-column-after", t);
3294
+ }, ie = (e, t, n) => {
3295
+ x = {
3296
+ axis: e,
3297
+ index: t
3298
+ }, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
3299
+ }, ae = (t) => {
3300
+ if (!x) return;
3301
+ let n = sn(e.editor, x.axis, t.clientX, t.clientY);
3302
+ n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
3303
+ }, oe = (t) => {
3304
+ let n = x;
3305
+ if (!n) return;
3306
+ let r = sn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
3307
+ t.preventDefault(), x = null, S = null, r !== null && vn(e.editor, n.axis, n.index, r);
3308
+ }, V = G(() => (f.value, t.value === "row" || t.value === "column" ? cn(e.editor, t.value) : null)), se = (e) => {
3309
+ if (!(!t.value || e.key !== "Escape")) {
3310
+ if (n.value) {
3311
+ n.value = null;
3312
+ return;
3313
+ }
3314
+ R(!0);
3315
+ }
3316
+ }, ce = (e) => {
3317
+ if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
3318
+ let t = e.currentTarget;
3319
+ if (!(t instanceof HTMLElement)) return;
3320
+ let n = t.classList.contains("markweave-table-menu") ? t.querySelector(":scope > .markweave-table-menu-scroll") ?? t : t, r = Array.from(n.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), i = r.indexOf(document.activeElement), a = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + a));
3321
+ e.preventDefault(), e.stopPropagation(), r[o]?.focus();
3322
+ }, le = (e) => {
3323
+ t.value && (e.target instanceof Node && p.value?.contains(e.target) || R());
2800
3324
  };
2801
- G(() => {
2802
- w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", M), document.addEventListener("mousedown", N);
2803
- }), K(() => {
2804
- b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", M), document.removeEventListener("mousedown", N);
2805
- }), W(() => [
3325
+ Rn(() => {
3326
+ N(), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), document.addEventListener("keydown", se), document.addEventListener("mousedown", le), document.addEventListener("dragover", ae), document.addEventListener("drop", oe);
3327
+ }), q(() => {
3328
+ k(), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0), document.removeEventListener("keydown", se), document.removeEventListener("mousedown", le), document.removeEventListener("dragover", ae), document.removeEventListener("drop", oe);
3329
+ }), K(() => [
2806
3330
  e.active,
2807
- m.value.activeCellPos,
2808
- m.value.selectionFrom,
2809
- m.value.selectionTo,
3331
+ C.value.activeCellPos,
3332
+ C.value.selectionFrom,
3333
+ C.value.selectionTo,
2810
3334
  e.interactionState.hoverCellPos,
2811
3335
  e.interactionState.hoverVisualColumnIndex,
2812
3336
  e.interactionState.hoverVisualRowIndex,
2813
3337
  t.value,
2814
- n.value
2815
- ], T, { flush: "post" });
2816
- let P = () => t.value ? B("div", {
2817
- ref: f,
2818
- class: "markweave-table-menu",
2819
- role: "menu",
2820
- "aria-label": rn(t.value, e.messages),
2821
- "data-testid": "markweave-table-menu",
2822
- "data-positioned": o.value ? "true" : "false",
2823
- style: o.value ? {
2824
- left: `${o.value.left}px`,
2825
- top: `${o.value.top}px`
2826
- } : void 0
2827
- }, y.value.map((n, r) => {
2828
- let i = Xt(n), a = r === 0 ? i : Xt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Ht(e.editor, n.commandId), c = Zt(n, e.messages);
2829
- return B("button", {
2830
- key: `${n.id}-${r}`,
2831
- type: "button",
2832
- role: "menuitem",
2833
- "aria-label": c,
2834
- "aria-disabled": !s,
2835
- disabled: !s,
2836
- "data-menu-group": i,
2837
- "data-starts-group": o ? "true" : "false",
2838
- "data-command-enabled": s ? "true" : "false",
2839
- "data-testid": n.commandId ? `markweave-table-menu-command-${n.commandId}` : "markweave-table-menu-command-edit-with-ai",
2840
- onMousedown: $,
2841
- onClick: () => {
2842
- if (s) {
2843
- if (n.commandId === null) {
2844
- j(t.value === "row" || t.value === "column" ? t.value : "selection");
2845
- return;
3338
+ n.value,
3339
+ r.value
3340
+ ], P, { flush: "post" });
3341
+ let ue = () => {
3342
+ if (!t.value) return null;
3343
+ let r = O.value.map((r, i) => {
3344
+ let a = pn(r), o = i === 0 ? a : pn(O.value[i - 1]), s = i > 0 && o !== a, c = r.submenuId ? !0 : r.commandId === null ? !!e.onEditWithAi : tn(e.editor, r.commandId), l = mn(r, e.messages), u = Mi[r.icon];
3345
+ return H("button", {
3346
+ key: `${r.id}-${i}`,
3347
+ type: "button",
3348
+ role: "menuitem",
3349
+ "aria-label": l,
3350
+ "aria-disabled": !c,
3351
+ "aria-haspopup": r.submenuId ? "menu" : void 0,
3352
+ "aria-expanded": r.submenuId ? n.value === r.submenuId : void 0,
3353
+ disabled: !c,
3354
+ "data-menu-group": a,
3355
+ "data-starts-group": s ? "true" : "false",
3356
+ "data-command-enabled": c ? "true" : "false",
3357
+ "data-submenu-trigger": r.submenuId ?? void 0,
3358
+ "data-testid": r.commandId ? `markweave-table-menu-command-${r.commandId}` : r.submenuId ? `markweave-table-menu-submenu-${r.submenuId}` : "markweave-table-menu-command-edit-with-ai",
3359
+ onMousedown: $,
3360
+ onMouseenter: () => {
3361
+ n.value = r.submenuId;
3362
+ },
3363
+ onClick: () => {
3364
+ if (c) {
3365
+ if (r.submenuId) {
3366
+ n.value = r.submenuId;
3367
+ return;
3368
+ }
3369
+ if (r.commandId === null) {
3370
+ re(t.value === "row" || t.value === "column" ? t.value : "selection");
3371
+ return;
3372
+ }
3373
+ ne(r.commandId).finally(() => R());
2846
3374
  }
2847
- A(n.commandId).finally(() => k());
2848
3375
  }
2849
- }
2850
- }, c);
2851
- })) : null;
2852
- return () => e.active ? B("div", {
2853
- ref: c,
3376
+ }, [
3377
+ H("span", {
3378
+ class: "markweave-table-menu-item-icon",
3379
+ "aria-hidden": "true"
3380
+ }, [H(u, {
3381
+ size: 18,
3382
+ strokeWidth: 1.8
3383
+ })]),
3384
+ H("span", { class: "markweave-table-menu-item-label" }, l),
3385
+ r.submenuId ? H(ur, {
3386
+ class: "markweave-table-menu-chevron",
3387
+ size: 16,
3388
+ "aria-hidden": "true"
3389
+ }) : null
3390
+ ]);
3391
+ }), i = [H("div", {
3392
+ ref: v,
3393
+ class: "markweave-table-menu-scroll",
3394
+ style: l.value ? { maxHeight: `${Math.max(1, l.value.maxHeight - 12)}px` } : void 0
3395
+ }, r)];
3396
+ if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(H("div", {
3397
+ ref: y,
3398
+ class: "markweave-table-submenu markweave-table-color-menu",
3399
+ role: "menu",
3400
+ "aria-label": e.messages.table.submenus.color,
3401
+ "data-testid": "markweave-table-color-menu",
3402
+ "data-positioned": u.value ? "true" : "false",
3403
+ "data-placement": u.value?.placement,
3404
+ style: u.value ? {
3405
+ left: `${u.value.left}px`,
3406
+ top: `${u.value.top}px`,
3407
+ maxHeight: `${u.value.maxHeight}px`
3408
+ } : void 0,
3409
+ onKeydown: ce
3410
+ }, [
3411
+ H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
3412
+ ...bn.map((t) => H("button", {
3413
+ key: `text-${t.id}`,
3414
+ type: "button",
3415
+ role: "menuitemradio",
3416
+ "aria-checked": V.value?.textColorId === t.id,
3417
+ "data-active": V.value?.textColorId === t.id ? "true" : "false",
3418
+ "data-testid": `markweave-table-text-color-${t.id}`,
3419
+ onMousedown: $,
3420
+ onClick: () => z((n) => Xt(e.editor, n, t.id))
3421
+ }, [H("span", {
3422
+ class: "markweave-table-color-swatch markweave-table-text-color-swatch",
3423
+ "aria-hidden": "true",
3424
+ style: { backgroundColor: t.textColor ?? "var(--markweave-text)" }
3425
+ }), H("span", null, e.messages.table.colors[t.id].text)])),
3426
+ H("div", { class: "markweave-table-submenu-separator" }),
3427
+ H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
3428
+ ...bn.map((t) => H("button", {
3429
+ key: `background-${t.id}`,
3430
+ type: "button",
3431
+ role: "menuitemradio",
3432
+ "aria-checked": V.value?.backgroundColorId === t.id,
3433
+ "data-active": V.value?.backgroundColorId === t.id ? "true" : "false",
3434
+ "data-testid": `markweave-table-background-color-${t.id}`,
3435
+ onMousedown: $,
3436
+ onClick: () => z((n) => Yt(e.editor, n, t.id))
3437
+ }, [H("span", {
3438
+ class: "markweave-table-color-swatch",
3439
+ "aria-hidden": "true",
3440
+ style: { backgroundColor: t.backgroundColor }
3441
+ }), H("span", null, e.messages.table.colors[t.id].background)]))
3442
+ ])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
3443
+ let t = (t, n) => {
3444
+ let r = Ni[t];
3445
+ return H("button", {
3446
+ key: t,
3447
+ type: "button",
3448
+ role: "menuitemradio",
3449
+ "aria-checked": n,
3450
+ "data-active": n ? "true" : "false",
3451
+ "data-testid": `markweave-table-alignment-${t}`,
3452
+ onMousedown: $,
3453
+ onClick: () => z((n) => Jt(e.editor, n, t))
3454
+ }, [H(r, {
3455
+ size: 18,
3456
+ strokeWidth: 1.8,
3457
+ "aria-hidden": "true"
3458
+ }), H("span", null, e.messages.table.alignments[t])]);
3459
+ };
3460
+ i.push(H("div", {
3461
+ ref: y,
3462
+ class: "markweave-table-submenu markweave-table-alignment-menu",
3463
+ role: "menu",
3464
+ "aria-label": e.messages.table.submenus.alignment,
3465
+ "data-testid": "markweave-table-alignment-menu",
3466
+ "data-positioned": u.value ? "true" : "false",
3467
+ "data-placement": u.value?.placement,
3468
+ style: u.value ? {
3469
+ left: `${u.value.left}px`,
3470
+ top: `${u.value.top}px`,
3471
+ maxHeight: `${u.value.maxHeight}px`
3472
+ } : void 0,
3473
+ onKeydown: ce
3474
+ }, [
3475
+ ...Sn.map((e) => t(e, V.value?.textAlign === e)),
3476
+ H("div", { class: "markweave-table-submenu-separator" }),
3477
+ ...wn.map((e) => t(e, V.value?.verticalAlign === e))
3478
+ ]));
3479
+ }
3480
+ return H("div", {
3481
+ ref: _,
3482
+ class: "markweave-table-menu",
3483
+ role: "menu",
3484
+ "aria-label": Cn(t.value, e.messages),
3485
+ "data-testid": "markweave-table-menu",
3486
+ "data-positioned": l.value ? "true" : "false",
3487
+ "data-placement": l.value?.placement,
3488
+ "data-submenu": n.value ?? "none",
3489
+ style: l.value ? {
3490
+ left: `${l.value.left}px`,
3491
+ top: `${l.value.top}px`
3492
+ } : void 0,
3493
+ onKeydown: ce
3494
+ }, i);
3495
+ };
3496
+ return () => e.active ? H("div", {
3497
+ ref: p,
2854
3498
  class: "markweave-table-controls",
2855
3499
  "data-testid": "markweave-table-controls",
2856
3500
  "aria-label": e.messages.table.controlsAriaLabel,
2857
3501
  "data-open-menu": t.value ?? "none",
2858
- "data-positioned": r.value || i.value || a.value ? "true" : "false"
3502
+ "data-positioned": i.value || a.value || o.value ? "true" : "false",
3503
+ onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(qt, { type: "clear-hover" }))
2859
3504
  }, [
2860
- s.value ? B("div", {
3505
+ d.value ? H("div", {
2861
3506
  class: "markweave-table-copy-feedback",
2862
3507
  role: "status",
2863
3508
  "aria-live": "polite",
2864
3509
  "data-testid": "markweave-table-copy-feedback",
2865
- "data-copy-kind": s.value.kind,
2866
- "data-text-length": s.value.textLength,
2867
- "data-html-length": s.value.htmlLength
2868
- }, Wt(s.value)) : null,
2869
- r.value ? B("button", {
2870
- ref: l,
3510
+ "data-copy-kind": d.value.kind,
3511
+ "data-text-length": d.value.textLength,
3512
+ "data-html-length": d.value.htmlLength
3513
+ }, rn(d.value)) : null,
3514
+ i.value ? H("button", {
3515
+ ref: m,
2871
3516
  type: "button",
3517
+ draggable: !0,
2872
3518
  class: "markweave-table-edge-handle markweave-table-edge-handle--row",
2873
3519
  "aria-label": e.messages.table.activeRowActions,
2874
- "aria-expanded": t.value === "row" && n.value === "row-edge",
3520
+ "aria-expanded": t.value === "row" && r.value === "row-edge",
2875
3521
  "aria-haspopup": "menu",
2876
3522
  title: e.messages.table.rowActions,
2877
3523
  "data-testid": "markweave-table-hover-row-handle",
2878
- "data-axis-index": h.value?.index ?? "",
2879
- "data-axis-selected-cells": h.value?.selectedCellCount ?? "",
2880
- "data-axis-visual-cells": h.value?.visualCellCount ?? "",
2881
- "data-axis-visual-size": h.value?.visualHeight ?? "",
3524
+ "data-axis-index": w.value?.index ?? "",
3525
+ "data-axis-selected-cells": w.value?.selectedCellCount ?? "",
3526
+ "data-axis-visual-cells": w.value?.visualCellCount ?? "",
3527
+ "data-axis-visual-size": w.value?.visualHeight ?? "",
2882
3528
  style: {
2883
- left: `${r.value.left}px`,
2884
- top: `${r.value.top}px`
3529
+ left: `${i.value.left}px`,
3530
+ top: `${i.value.top}px`,
3531
+ width: `${i.value.width}px`,
3532
+ height: `${i.value.height}px`
2885
3533
  },
2886
3534
  onMousedown: $,
2887
- onClick: () => D("row", "row-edge")
2888
- }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2889
- i.value ? B("button", {
2890
- ref: u,
3535
+ onClick: () => te("row", "row-edge"),
3536
+ onDragstart: (e) => ie("row", w.value?.index ?? 0, e),
3537
+ onDragend: () => {
3538
+ x = null, S = null;
3539
+ }
3540
+ }, [H(Pr, {
3541
+ size: 14,
3542
+ "aria-hidden": "true"
3543
+ })]) : null,
3544
+ a.value ? H("button", {
3545
+ ref: h,
2891
3546
  type: "button",
3547
+ draggable: !0,
2892
3548
  class: "markweave-table-edge-handle markweave-table-edge-handle--column",
2893
3549
  "aria-label": e.messages.table.activeColumnActions,
2894
- "aria-expanded": t.value === "column" && n.value === "column-edge",
3550
+ "aria-expanded": t.value === "column" && r.value === "column-edge",
2895
3551
  "aria-haspopup": "menu",
2896
3552
  title: e.messages.table.columnActions,
2897
3553
  "data-testid": "markweave-table-hover-column-handle",
2898
- "data-axis-index": g.value?.index ?? "",
2899
- "data-axis-selected-cells": g.value?.selectedCellCount ?? "",
2900
- "data-axis-visual-cells": g.value?.visualCellCount ?? "",
2901
- "data-axis-visual-size": g.value?.visualWidth ?? "",
3554
+ "data-axis-index": T.value?.index ?? "",
3555
+ "data-axis-selected-cells": T.value?.selectedCellCount ?? "",
3556
+ "data-axis-visual-cells": T.value?.visualCellCount ?? "",
3557
+ "data-axis-visual-size": T.value?.visualWidth ?? "",
2902
3558
  style: {
2903
- left: `${i.value.left}px`,
2904
- top: `${i.value.top}px`
3559
+ left: `${a.value.left}px`,
3560
+ top: `${a.value.top}px`,
3561
+ width: `${a.value.width}px`,
3562
+ height: `${a.value.height}px`
2905
3563
  },
2906
3564
  onMousedown: $,
2907
- onClick: () => D("column", "column-edge")
2908
- }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2909
- v.value && a.value ? B("button", {
2910
- ref: d,
3565
+ onClick: () => te("column", "column-edge"),
3566
+ onDragstart: (e) => ie("column", T.value?.index ?? 0, e),
3567
+ onDragend: () => {
3568
+ x = null, S = null;
3569
+ }
3570
+ }, [H(Pr, {
3571
+ size: 14,
3572
+ "aria-hidden": "true"
3573
+ })]) : null,
3574
+ D.value && o.value ? H("button", {
3575
+ ref: g,
2911
3576
  type: "button",
2912
3577
  class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
2913
3578
  "aria-label": e.messages.table.selectionActions,
2914
- "aria-expanded": t.value === "selection" && n.value === "selection-edge",
3579
+ "aria-expanded": t.value === "selection" && r.value === "selection-edge",
2915
3580
  "aria-haspopup": "menu",
2916
3581
  title: e.messages.table.selectionActions,
2917
3582
  "data-testid": "markweave-table-cell-handle",
2918
3583
  style: {
2919
- left: `${a.value.left}px`,
2920
- top: `${a.value.top}px`
3584
+ left: `${o.value.left}px`,
3585
+ top: `${o.value.top}px`,
3586
+ width: `${o.value.width}px`,
3587
+ height: `${o.value.height}px`
3588
+ },
3589
+ onMousedown: $,
3590
+ onClick: L
3591
+ }, [H(Pr, {
3592
+ size: 14,
3593
+ "aria-hidden": "true"
3594
+ })]) : null,
3595
+ s.value ? H("button", {
3596
+ type: "button",
3597
+ class: "markweave-table-extend-button markweave-table-extend-button--row",
3598
+ "aria-label": e.messages.table.addRow,
3599
+ title: e.messages.table.addRow,
3600
+ "data-testid": "markweave-table-add-row",
3601
+ style: {
3602
+ left: `${s.value.left}px`,
3603
+ top: `${s.value.top}px`,
3604
+ width: `${s.value.width}px`,
3605
+ height: `${s.value.height}px`
2921
3606
  },
2922
3607
  onMousedown: $,
2923
- onClick: O
2924
- }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2925
- P()
3608
+ onClick: () => B("row")
3609
+ }, [H(Rr, {
3610
+ size: 14,
3611
+ "aria-hidden": "true"
3612
+ })]) : null,
3613
+ c.value ? H("button", {
3614
+ type: "button",
3615
+ class: "markweave-table-extend-button markweave-table-extend-button--column",
3616
+ "aria-label": e.messages.table.addColumn,
3617
+ title: e.messages.table.addColumn,
3618
+ "data-testid": "markweave-table-add-column",
3619
+ style: {
3620
+ left: `${c.value.left}px`,
3621
+ top: `${c.value.top}px`,
3622
+ width: `${c.value.width}px`,
3623
+ height: `${c.value.height}px`
3624
+ },
3625
+ onMousedown: $,
3626
+ onClick: () => B("column")
3627
+ }, [H(Rr, {
3628
+ size: 14,
3629
+ "aria-hidden": "true"
3630
+ })]) : null,
3631
+ ue()
2926
3632
  ]) : null;
2927
3633
  }
2928
- }), Wr = J({
3634
+ }), Fi = Y({
2929
3635
  name: "MarkweaveVueTableSelectionOverlay",
2930
3636
  props: {
2931
3637
  editor: {
@@ -2938,18 +3644,18 @@ var Br = J({
2938
3644
  }
2939
3645
  },
2940
3646
  setup(e) {
2941
- let t = V(null), n = () => {
3647
+ let t = U(null), n = () => {
2942
3648
  if (e.focusState.mode !== "cell-selection") {
2943
3649
  t.value = null;
2944
3650
  return;
2945
3651
  }
2946
- t.value = en(e.editor, Lt(e.editor.state));
3652
+ t.value = _n(e.editor, Gt(e.editor.state));
2947
3653
  };
2948
- return G(() => {
3654
+ return Rn(() => {
2949
3655
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
2950
- }), K(() => {
3656
+ }), q(() => {
2951
3657
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
2952
- }), W(() => [
3658
+ }), K(() => [
2953
3659
  e.focusState.activeCellPos,
2954
3660
  e.focusState.anchorCellPos,
2955
3661
  e.focusState.mode,
@@ -2957,12 +3663,13 @@ var Br = J({
2957
3663
  e.focusState.selectionFrom,
2958
3664
  e.focusState.selectionTo
2959
3665
  ], () => {
2960
- q(n);
3666
+ J(n);
2961
3667
  }, { flush: "post" }), () => {
2962
3668
  let e = t.value;
2963
- return e ? B("div", {
3669
+ return e ? H("div", {
2964
3670
  "aria-hidden": "true",
2965
3671
  class: "markweave-table-selection-overlay",
3672
+ "data-axis-target": e.axisTarget ?? "none",
2966
3673
  "data-anchor-cell-pos": e.anchorCellPos ?? "",
2967
3674
  "data-head-cell-pos": e.headCellPos ?? "",
2968
3675
  "data-selected-cells": e.selectedCellCount,
@@ -2981,7 +3688,7 @@ var Br = J({
2981
3688
  }) : null;
2982
3689
  };
2983
3690
  }
2984
- }), Gr = J({
3691
+ }), Ii = Y({
2985
3692
  name: "MarkweaveVueCodeBlockControls",
2986
3693
  props: {
2987
3694
  editor: {
@@ -3010,200 +3717,234 @@ var Br = J({
3010
3717
  }
3011
3718
  },
3012
3719
  setup(e) {
3013
- let t = V(null), n = V(null), r = V(null), i = V(null), a = V(null), o = V([]), s = V(null), c = V(!1), l = V(""), u = V(null), d = V(!1), f = V(null), p = V(null), m = V(!1), h = V({
3720
+ let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U([]), l = U(null), u = U(!1), d = U(""), f = U(-1), p = U(null), m = U(!1), h = U(null), g = U(null), _ = U(!1), v = U({
3014
3721
  active: !1,
3015
3722
  lastX: 0,
3016
3723
  lastY: 0
3017
- }), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Qe(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
3724
+ }), y = U(0), b = U(0), x = U(0), S = null, C = G(() => (x.value, tt(e.editor, o.value))), w = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
3018
3725
  ...e.state,
3019
3726
  pos: e.state.pos,
3020
3727
  active: !0
3021
- } : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => nt(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), ee = U(() => !e.readOnly), D = U(() => S.value ? Ke(S.value.language) : Ke("text")), O = U(() => u.value?.status ?? "idle"), k = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), A = U(() => w.value && k.value === "preview"), j = U(() => (v.value, g.value, _.value, et(e.editor))), M = U(() => `${_.value}|${j.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), N = U(() => Xe(l.value)), P = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), F = () => {
3022
- y !== null && (window.clearTimeout(y), y = null);
3023
- }, I = (e) => {
3024
- F(), u.value = e, e && (y = window.setTimeout(() => {
3025
- u.value = null, y = null;
3026
- }, Be));
3027
- }, te = () => {
3028
- f.value = null, p.value = null, m.value = !1, h.value = {
3728
+ } : null), T = G(() => C.value ?? w.value), E = G(() => T.value !== null), D = G(() => T.value?.language === "mermaid"), O = G(() => ot(e.editor, T.value)), k = G(() => E.value && T.value !== null && !O.value), A = G(() => !e.readOnly), ee = G(() => T.value ? Je(T.value.language) : Je("text")), j = G(() => p.value?.status ?? "idle"), M = G(() => T.value?.mermaidPreviewMode ?? e.mermaidMode), N = G(() => D.value && M.value === "preview"), P = G(() => (x.value, y.value, b.value, it(e.editor))), F = G(() => `${b.value}|${P.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), I = G(() => Qe(d.value)), te = G(() => T.value ? `${T.value.pos}:${T.value.language}:${T.value.text}` : "none"), L = () => {
3729
+ S !== null && (window.clearTimeout(S), S = null);
3730
+ }, R = (e) => {
3731
+ L(), p.value = e, e && (S = window.setTimeout(() => {
3732
+ p.value = null, S = null;
3733
+ }, Ve));
3734
+ }, ne = () => {
3735
+ h.value = null, g.value = null, _.value = !1, v.value = {
3029
3736
  active: !1,
3030
3737
  lastX: 0,
3031
3738
  lastY: 0
3032
3739
  }, e.editor.view.focus();
3033
- }, L = () => {
3740
+ }, z = () => {
3034
3741
  let n = t.value;
3035
3742
  if (!n) return;
3036
- if (!$e(n) || j.value.length === 0) {
3037
- o.value = [];
3743
+ if (!nt(n) || P.value.length === 0) {
3744
+ c.value = [];
3038
3745
  return;
3039
3746
  }
3040
- let r = n.getBoundingClientRect(), i = j.value.flatMap((t) => {
3041
- let n = Ye(Je(e.editor, t.pos, t.mermaidPreviewMode), r);
3042
- return n ? [We(t, n, r)] : [];
3747
+ let r = n.getBoundingClientRect(), i = P.value.flatMap((t) => {
3748
+ let n = Ze(Xe(e.editor, t.pos, t.mermaidPreviewMode), r);
3749
+ return n ? [Ke(t, n, r)] : [];
3043
3750
  });
3044
- o.value = rt(o.value, i, j.value.map((e) => e.pos));
3045
- }, R = () => {
3046
- if (!E.value || !S.value) {
3047
- a.value = null, s.value = null;
3751
+ c.value = st(c.value, i, P.value.map((e) => e.pos));
3752
+ }, B = () => {
3753
+ if (!k.value || !T.value) {
3754
+ s.value = null, l.value = null;
3048
3755
  return;
3049
3756
  }
3050
3757
  let r = t.value;
3051
3758
  if (!r) return;
3052
- let i = Je(e.editor, S.value.pos, k.value), o = r.getBoundingClientRect(), l = Ye(i, o);
3053
- if (!l) {
3054
- a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
3759
+ let i = Xe(e.editor, T.value.pos, M.value), a = r.getBoundingClientRect(), o = Ze(i, a);
3760
+ if (!o) {
3761
+ s.value = s.value?.pos === T.value.pos ? s.value : null, l.value = u.value ? l.value : null;
3055
3762
  return;
3056
3763
  }
3057
- if (a.value = He(S.value.pos, l, o), c.value && n.value) {
3764
+ if (s.value = We(T.value.pos, o, a), u.value && n.value) {
3058
3765
  let e = n.value.getBoundingClientRect();
3059
- s.value = Re({
3060
- overlayRect: o,
3766
+ l.value = ze({
3767
+ overlayRect: a,
3061
3768
  buttonRect: e,
3062
3769
  windowWidth: window.innerWidth,
3063
3770
  windowHeight: window.innerHeight
3064
3771
  });
3065
3772
  }
3066
- }, ne = async () => {
3773
+ }, ie = async () => {
3067
3774
  if (e.readOnly) {
3068
- if (!S.value) return;
3069
- let e = await Ve(S.value.text);
3070
- I(Ne(S.value, e ? "copied" : "failed"));
3775
+ if (!T.value) return;
3776
+ let e = await He(T.value.text);
3777
+ R(Pe(T.value, e ? "copied" : "failed"));
3071
3778
  return;
3072
3779
  }
3073
- if (!Ge(e.editor, S.value)) return;
3074
- let t = await je(e.editor);
3075
- I(Ne(Me(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
3076
- }, re = (t, n) => {
3780
+ if (!qe(e.editor, T.value)) return;
3781
+ let t = await Me(e.editor);
3782
+ R(Pe(Ne(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
3783
+ }, ae = (t, n) => {
3077
3784
  if (e.readOnly) {
3078
- St(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
3785
+ Ot(e.editor, t.pos, n) && (b.value += 1, x.value += 1);
3079
3786
  return;
3080
3787
  }
3081
3788
  let r = e.state.active && e.state.pos === t.pos;
3082
- Le(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
3083
- }, ie = (t) => {
3084
- if (e.readOnly || !S.value) return;
3085
- let n = e.state.active && e.state.pos === S.value.pos;
3086
- Ie(e.editor, S.value.pos, t) && (t === "mermaid" && Le(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
3087
- }, ae = () => {
3088
- e.readOnly || !S.value || Fe(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
3089
- }, oe = () => {
3090
- if (!S.value) return;
3091
- let t = tt(e.editor, S.value.pos);
3092
- if (!t) return;
3093
- let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
3094
- i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
3095
- }, se = () => {
3096
- if (!S.value) return;
3097
- let t = tt(e.editor, S.value.pos);
3098
- t && (f.value = Ue(t), p.value = null, m.value = !1, h.value = {
3789
+ Re(e.editor, t.pos, n) && (e.onMermaidModeChange(n), x.value += 1, r && e.editor.view.focus());
3790
+ }, oe = (t) => {
3791
+ if (e.readOnly || !T.value) return;
3792
+ let n = e.state.active && e.state.pos === T.value.pos;
3793
+ Le(e.editor, T.value.pos, t) && (t === "mermaid" && Re(e.editor, T.value.pos, "preview") && e.onMermaidModeChange("preview"), u.value = !1, d.value = "", f.value = -1, x.value += 1, n && e.editor.view.focus());
3794
+ }, V = () => {
3795
+ u.value = !u.value, u.value && a.value === null && (a.value = Ue()), f.value = u.value ? rt(I.value, T.value?.language ?? null) : -1;
3796
+ }, se = (e) => {
3797
+ let t = Qe(e);
3798
+ d.value = e, f.value = rt(t, e.trim() ? null : T.value?.language ?? null);
3799
+ }, ce = (t) => {
3800
+ if (!t.isComposing) {
3801
+ if (t.key === "ArrowDown" || t.key === "ArrowUp") {
3802
+ t.preventDefault(), f.value = lt(f.value, I.value.length, t.key === "ArrowUp" ? "previous" : "next");
3803
+ return;
3804
+ }
3805
+ if (t.key === "Enter") {
3806
+ let e = I.value[f.value];
3807
+ e && (t.preventDefault(), oe(e.language));
3808
+ return;
3809
+ }
3810
+ t.key === "Escape" && (t.preventDefault(), u.value = !1, f.value = -1, e.editor.view.focus());
3811
+ }
3812
+ }, le = () => {
3813
+ e.readOnly || !T.value || Ie(e.editor, T.value.pos, !O.value) && (y.value += 1, x.value += 1, o.value = null);
3814
+ }, ue = () => {
3815
+ if (!T.value) return;
3816
+ let t = at(e.editor, T.value.pos);
3817
+ t && re({
3818
+ data: new Blob([t], { type: "image/svg+xml" }),
3819
+ fileName: "markweave-mermaid.svg",
3820
+ onSettled: () => e.editor.view.focus(),
3821
+ ownerDocument: document
3822
+ });
3823
+ }, de = () => {
3824
+ if (!T.value) return;
3825
+ let t = at(e.editor, T.value.pos);
3826
+ t && (h.value = Ge(t), g.value = null, _.value = !1, v.value = {
3099
3827
  active: !1,
3100
3828
  lastX: 0,
3101
3829
  lastY: 0
3102
3830
  });
3103
- }, ce = (e) => {
3104
- f.value = f.value ? {
3105
- ...f.value,
3106
- scale: ze(f.value.scale + e)
3831
+ }, fe = (e) => {
3832
+ h.value = h.value ? {
3833
+ ...h.value,
3834
+ scale: Be(h.value.scale + e)
3107
3835
  } : null;
3108
- }, le = () => {
3109
- f.value = f.value ? Ue(f.value.svg) : null, h.value = {
3836
+ }, pe = () => {
3837
+ h.value = h.value ? Ge(h.value.svg) : null, v.value = {
3110
3838
  active: !1,
3111
3839
  lastX: 0,
3112
3840
  lastY: 0
3113
- }, m.value = !1;
3114
- }, z = (e) => {
3115
- e.preventDefault(), ce(e.deltaY < 0 ? it : -it);
3116
- }, ue = (e) => {
3117
- e.button === 0 && (e.preventDefault(), h.value = {
3841
+ }, _.value = !1;
3842
+ }, me = (e) => {
3843
+ e.preventDefault(), fe(e.deltaY < 0 ? ct : -ct);
3844
+ }, he = (e) => {
3845
+ e.button === 0 && (e.preventDefault(), v.value = {
3118
3846
  active: !0,
3119
3847
  lastX: e.clientX,
3120
3848
  lastY: e.clientY
3121
- }, m.value = !0);
3122
- }, de = (e) => {
3123
- let t = h.value;
3849
+ }, _.value = !0);
3850
+ }, ge = (e) => {
3851
+ let t = v.value;
3124
3852
  if (!t.active) return;
3125
3853
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
3126
- h.value = {
3854
+ v.value = {
3127
3855
  active: !0,
3128
3856
  lastX: e.clientX,
3129
3857
  lastY: e.clientY
3130
- }, f.value = at(f.value, n, r);
3131
- }, fe = () => {
3132
- h.value = {
3858
+ }, h.value = ut(h.value, n, r);
3859
+ }, _e = () => {
3860
+ v.value = {
3133
3861
  active: !1,
3134
3862
  lastX: 0,
3135
3863
  lastY: 0
3136
- }, m.value = !1;
3864
+ }, _.value = !1;
3137
3865
  };
3138
- W(() => e.readOnly, (e) => {
3139
- e && (c.value = !1, l.value = "");
3140
- }), W(P, () => {
3141
- I(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
3142
- }), W(c, async (e) => {
3143
- e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
3144
- }), W(() => [
3145
- E.value,
3146
- g.value,
3147
- S.value?.pos ?? null,
3148
- c.value,
3149
- k.value
3866
+ K(() => e.readOnly, (e) => {
3867
+ e && (u.value = !1, d.value = "");
3868
+ }), K(te, () => {
3869
+ R(null), u.value = !1, d.value = "", f.value = -1, h.value = null, g.value = null, _.value = !1;
3870
+ }), K(u, async (e) => {
3871
+ if (!e) {
3872
+ f.value = -1;
3873
+ return;
3874
+ }
3875
+ await J(), B(), r.value?.focus({ preventScroll: !0 });
3876
+ }), K(() => [
3877
+ u.value,
3878
+ d.value,
3879
+ f.value
3880
+ ], async () => {
3881
+ if (!u.value || f.value < 0) return;
3882
+ await J();
3883
+ let e = i.value, t = e?.querySelector(`[data-language-index="${f.value}"]`);
3884
+ e && t && dt(e, t);
3885
+ }, { flush: "post" }), K(() => [
3886
+ k.value,
3887
+ y.value,
3888
+ T.value?.pos ?? null,
3889
+ u.value,
3890
+ M.value
3150
3891
  ], async () => {
3151
- await q(), R();
3892
+ await J(), B();
3152
3893
  }, {
3153
3894
  flush: "post",
3154
3895
  immediate: !0
3155
- }), W(M, async () => {
3156
- await q(), L(), window.requestAnimationFrame(L);
3896
+ }), K(F, async () => {
3897
+ await J(), z(), window.requestAnimationFrame(z);
3157
3898
  }, {
3158
3899
  flush: "post",
3159
3900
  immediate: !0
3160
3901
  });
3161
- let pe = null;
3162
- return G(() => {
3163
- q(() => {
3902
+ let ve = null;
3903
+ return Rn(() => {
3904
+ J(() => {
3164
3905
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
3165
- if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
3166
- let r = Ze(e.editor, n.target), a = Qe(e.editor, r), o = a && !nt(e.editor, a) ? a.pos : null;
3167
- i.value = i.value === o ? i.value : o;
3168
- }, a = () => {
3169
- c.value || (i.value = null);
3170
- }, o = (t) => {
3906
+ if (n.target instanceof Node && t.value?.contains(n.target) || u.value) return;
3907
+ let r = et(e.editor, n.target), i = tt(e.editor, r), a = i && !ot(e.editor, i) ? i.pos : null;
3908
+ o.value = o.value === a ? o.value : a;
3909
+ }, i = () => {
3910
+ u.value || (o.value = null);
3911
+ }, a = (t) => {
3171
3912
  if (t.key === "Escape") {
3172
- if (f.value) {
3173
- te();
3913
+ if (h.value) {
3914
+ ne();
3174
3915
  return;
3175
3916
  }
3176
- c.value && (c.value = !1, e.editor.view.focus());
3917
+ u.value && (u.value = !1, f.value = -1, e.editor.view.focus());
3177
3918
  }
3178
3919
  }, s = (e) => {
3179
- c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
3180
- }, l = ({ transaction: e }) => {
3181
- e.getMeta(Ae) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Ae) || yt(e)) && (v.value += 1);
3920
+ u.value && (e.target instanceof Node && t.value?.contains(e.target) || (u.value = !1, f.value = -1));
3921
+ }, c = ({ transaction: e }) => {
3922
+ e.getMeta(je) && (y.value += 1), (e.docChanged || e.selectionSet || e.getMeta(je) || Tt(e)) && (x.value += 1);
3182
3923
  };
3183
- n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", a), window.addEventListener("resize", R), window.addEventListener("scroll", R, !0), window.addEventListener("resize", L), window.addEventListener("scroll", L, !0), document.addEventListener("keydown", o), document.addEventListener("mousedown", s), e.editor.on("transaction", l), pe = () => {
3184
- n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", a), window.removeEventListener("resize", R), window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", L), window.removeEventListener("scroll", L, !0), document.removeEventListener("keydown", o), document.removeEventListener("mousedown", s), e.editor.off("transaction", l), F();
3924
+ n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), window.addEventListener("resize", z), window.addEventListener("scroll", z, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", s), e.editor.on("transaction", c), ve = () => {
3925
+ n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", z), window.removeEventListener("scroll", z, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", s), e.editor.off("transaction", c), L();
3185
3926
  };
3186
3927
  });
3187
- }), K(() => {
3188
- pe?.(), pe = null, F();
3928
+ }), q(() => {
3929
+ ve?.(), ve = null, L();
3189
3930
  }), () => {
3190
- if (!E.value && j.value.length === 0 && !f.value) return null;
3191
- let i = a.value ? {
3192
- top: `${a.value.top}px`,
3193
- right: `${a.value.right}px`
3194
- } : void 0, u = s.value ? {
3195
- left: `${s.value.left}px`,
3196
- top: `${s.value.top}px`
3931
+ if (!k.value && P.value.length === 0 && !h.value) return null;
3932
+ let o = s.value ? {
3933
+ top: `${s.value.top}px`,
3934
+ right: `${s.value.right}px`
3935
+ } : void 0, p = l.value ? {
3936
+ left: `${l.value.left}px`,
3937
+ top: `${l.value.top}px`
3197
3938
  } : void 0;
3198
- return B("div", {
3939
+ return H("div", {
3199
3940
  ref: t,
3200
3941
  class: "markweave-codeblock-overlay",
3201
3942
  "data-testid": "markweave-codeblock-overlay",
3202
3943
  "data-read-only": e.readOnly ? "true" : "false"
3203
3944
  }, [
3204
- ...j.value.map((e) => {
3205
- let t = o.value.find((t) => t.pos === e.pos);
3206
- return B("div", {
3945
+ ...P.value.map((e) => {
3946
+ let t = c.value.find((t) => t.pos === e.pos);
3947
+ return H("div", {
3207
3948
  key: e.pos,
3208
3949
  class: "markweave-mermaid-tabs",
3209
3950
  "data-testid": "markweave-mermaid-tabs",
@@ -3213,241 +3954,253 @@ var Br = J({
3213
3954
  top: `${t.top}px`,
3214
3955
  left: `${t.left}px`
3215
3956
  } : void 0
3216
- }, ["code", "preview"].map((t) => B("button", {
3957
+ }, ["code", "preview"].map((t) => H("button", {
3217
3958
  key: t,
3218
3959
  type: "button",
3219
3960
  "data-testid": `markweave-mermaid-mode-${t}`,
3220
3961
  "data-active": e.mermaidPreviewMode === t ? "true" : "false",
3221
3962
  onMousedown: $,
3222
- onClick: () => re(e, t)
3963
+ onClick: () => ae(e, t)
3223
3964
  }, t === "code" ? "Code" : "Preview")));
3224
3965
  }),
3225
- E.value && S.value ? B("div", {
3966
+ k.value && T.value ? H("div", {
3226
3967
  class: "markweave-codeblock-controls",
3227
3968
  "data-testid": "markweave-codeblock-controls",
3228
- "data-positioned": a.value ? "true" : "false",
3229
- "data-collapsed": T.value ? "true" : "false",
3969
+ "data-positioned": s.value ? "true" : "false",
3970
+ "data-collapsed": O.value ? "true" : "false",
3230
3971
  "data-read-only": e.readOnly ? "true" : "false",
3231
3972
  "aria-label": "Code block controls",
3232
- style: i
3973
+ style: o
3233
3974
  }, [
3234
- e.readOnly ? B("span", {
3975
+ e.readOnly ? H("span", {
3235
3976
  class: "markweave-codeblock-language-button markweave-codeblock-language-label",
3236
3977
  "aria-label": "Code block language",
3237
3978
  "data-testid": "markweave-codeblock-language"
3238
- }, [B("span", null, D.value)]) : B("button", {
3979
+ }, [H("span", null, ee.value)]) : H("button", {
3239
3980
  ref: n,
3240
3981
  type: "button",
3241
3982
  class: "markweave-codeblock-language-button",
3242
3983
  "aria-label": "Code block language",
3243
- "aria-expanded": c.value ? "true" : "false",
3984
+ "aria-expanded": u.value ? "true" : "false",
3244
3985
  "aria-haspopup": "listbox",
3245
3986
  "data-testid": "markweave-codeblock-language",
3246
3987
  onMousedown: $,
3247
- onClick: () => {
3248
- c.value = !c.value;
3249
- }
3250
- }, [B("span", null, D.value), Q("chevron")]),
3251
- ee.value ? B("button", {
3988
+ onClick: V
3989
+ }, [H("span", null, ee.value), Q("chevron")]),
3990
+ A.value ? H("button", {
3252
3991
  type: "button",
3253
3992
  class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
3254
- "aria-label": T.value ? "Expand code block" : "Collapse code block",
3255
- title: T.value ? "Expand code block" : "Collapse code block",
3993
+ "aria-label": O.value ? "Expand code block" : "Collapse code block",
3994
+ title: O.value ? "Expand code block" : "Collapse code block",
3256
3995
  "data-testid": "markweave-codeblock-collapse",
3257
- "data-collapsed": T.value ? "true" : "false",
3996
+ "data-collapsed": O.value ? "true" : "false",
3258
3997
  onMousedown: $,
3259
- onClick: ae
3998
+ onClick: le
3260
3999
  }, [Q("chevron")]) : null,
3261
- B("span", { class: "markweave-codeblock-copy-wrap" }, [B("button", {
4000
+ H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
3262
4001
  type: "button",
3263
4002
  class: "markweave-codeblock-icon-button",
3264
4003
  "aria-label": "Copy to clipboard",
3265
4004
  "data-testid": "markweave-codeblock-copy",
3266
- "data-copy-state": O.value,
4005
+ "data-copy-state": j.value,
3267
4006
  onMousedown: $,
3268
4007
  onMouseenter: () => {
3269
- d.value = !0;
4008
+ m.value = !0;
3270
4009
  },
3271
4010
  onMouseleave: () => {
3272
- d.value = !1;
4011
+ m.value = !1;
3273
4012
  },
3274
4013
  onFocus: () => {
3275
- d.value = !0;
4014
+ m.value = !0;
3276
4015
  },
3277
4016
  onBlur: () => {
3278
- d.value = !1;
4017
+ m.value = !1;
3279
4018
  },
3280
4019
  onClick: () => {
3281
- ne();
4020
+ ie();
3282
4021
  }
3283
- }, [Q(O.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
4022
+ }, [Q(j.value === "copied" ? "check" : "clipboard")]), m.value ? H("span", {
3284
4023
  class: "markweave-codeblock-tooltip",
3285
4024
  role: "tooltip",
3286
4025
  "data-testid": "markweave-codeblock-copy-tooltip"
3287
4026
  }, "Copy to clipboard") : null]),
3288
- w.value && k.value === "preview" ? B("div", {
4027
+ D.value && M.value === "preview" ? H("div", {
3289
4028
  class: "markweave-mermaid-preview-actions",
3290
4029
  "data-testid": "markweave-mermaid-preview-actions"
3291
- }, [B("button", {
4030
+ }, [H("button", {
3292
4031
  type: "button",
3293
4032
  class: "markweave-codeblock-icon-button",
3294
4033
  "aria-label": "Fullscreen Mermaid preview",
3295
4034
  "data-testid": "markweave-mermaid-fullscreen",
3296
- disabled: !A.value,
4035
+ disabled: !N.value,
3297
4036
  onMousedown: $,
3298
- onClick: se
3299
- }, [Q("expand")]), B("button", {
4037
+ onClick: de
4038
+ }, [Q("expand")]), H("button", {
3300
4039
  type: "button",
3301
4040
  class: "markweave-codeblock-icon-button",
3302
4041
  "aria-label": "Download Mermaid SVG",
3303
4042
  "data-testid": "markweave-mermaid-download",
3304
- disabled: !A.value,
4043
+ disabled: !N.value,
3305
4044
  onMousedown: $,
3306
- onClick: oe
4045
+ onClick: ue
3307
4046
  }, [Q("download")])]) : null
3308
4047
  ]) : null,
3309
- ee.value && E.value && c.value && S.value ? B("div", {
4048
+ A.value && k.value && u.value && T.value ? H("div", {
3310
4049
  class: "markweave-codeblock-language-menu",
3311
- role: "listbox",
3312
- "aria-label": "Code block languages",
3313
4050
  "data-testid": "markweave-codeblock-language-menu",
3314
- "data-positioned": s.value ? "true" : "false",
3315
- style: u
3316
- }, [B("label", { class: "markweave-codeblock-language-search" }, [B("input", {
4051
+ "data-positioned": l.value ? "true" : "false",
4052
+ style: p
4053
+ }, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
3317
4054
  ref: r,
3318
- value: l.value,
4055
+ role: "combobox",
4056
+ "aria-autocomplete": "list",
4057
+ "aria-controls": a.value ?? void 0,
4058
+ "aria-expanded": "true",
4059
+ "aria-activedescendant": a.value && I.value[f.value] ? $e(a.value, I.value[f.value].language) : void 0,
4060
+ "aria-label": "Search code block languages",
4061
+ value: d.value,
3319
4062
  placeholder: "Search...",
3320
4063
  "data-testid": "markweave-codeblock-language-search",
3321
4064
  onInput: (e) => {
3322
- l.value = e.target.value;
4065
+ se(e.target.value);
3323
4066
  },
3324
- onKeydown: (t) => {
3325
- t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
3326
- }
3327
- }), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, N.value.map((e) => {
3328
- let t = S.value?.language === e.language;
3329
- return B("button", {
4067
+ onKeydown: ce
4068
+ }), Q("search")]), H("div", {
4069
+ ref: i,
4070
+ id: a.value ?? void 0,
4071
+ class: "markweave-codeblock-language-list",
4072
+ role: "listbox",
4073
+ "aria-label": "Code block languages"
4074
+ }, I.value.map((e, t) => {
4075
+ let n = T.value?.language === e.language, r = t === f.value;
4076
+ return H("button", {
3330
4077
  key: e.language,
4078
+ id: a.value ? $e(a.value, e.language) : void 0,
3331
4079
  type: "button",
3332
4080
  role: "option",
3333
- "aria-selected": t ? "true" : "false",
4081
+ "aria-selected": n ? "true" : "false",
3334
4082
  "data-testid": `markweave-codeblock-language-option-${e.language}`,
3335
- "data-active": t ? "true" : "false",
4083
+ "data-active": n ? "true" : "false",
4084
+ "data-highlighted": r ? "true" : "false",
4085
+ "data-language-index": t,
3336
4086
  onMousedown: $,
3337
- onClick: () => ie(e.language)
3338
- }, [B("span", null, e.label), t ? Q("check") : null]);
4087
+ onMouseenter: () => {
4088
+ f.value = t;
4089
+ },
4090
+ onClick: () => oe(e.language)
4091
+ }, [H("span", null, e.label), n ? Q("check") : null]);
3339
4092
  }))]) : null,
3340
- f.value ? B("div", {
4093
+ h.value ? H("div", {
3341
4094
  class: "markweave-mermaid-fullscreen-layer",
3342
4095
  role: "dialog",
3343
4096
  "aria-modal": "true",
3344
4097
  "aria-label": "Mermaid preview",
3345
4098
  "data-testid": "markweave-mermaid-fullscreen-layer"
3346
4099
  }, [
3347
- B("div", {
4100
+ H("div", {
3348
4101
  class: "markweave-mermaid-fullscreen-toolbar",
3349
4102
  "data-testid": "markweave-mermaid-fullscreen-toolbar"
3350
4103
  }, [
3351
- B("button", {
4104
+ H("button", {
3352
4105
  type: "button",
3353
4106
  class: "markweave-mermaid-fullscreen-control",
3354
4107
  "aria-label": "Zoom out",
3355
4108
  "data-testid": "markweave-mermaid-fullscreen-zoom-out",
3356
4109
  onMouseenter: () => {
3357
- p.value = "zoom-out";
4110
+ g.value = "zoom-out";
3358
4111
  },
3359
4112
  onMouseleave: () => {
3360
- p.value = null;
4113
+ g.value = null;
3361
4114
  },
3362
4115
  onFocus: () => {
3363
- p.value = "zoom-out";
4116
+ g.value = "zoom-out";
3364
4117
  },
3365
4118
  onBlur: () => {
3366
- p.value = null;
4119
+ g.value = null;
3367
4120
  },
3368
- onClick: () => ce(-it)
4121
+ onClick: () => fe(-ct)
3369
4122
  }, [Q("zoomOut")]),
3370
- B("span", {
4123
+ H("span", {
3371
4124
  class: "markweave-mermaid-fullscreen-zoom-label",
3372
4125
  "data-testid": "markweave-mermaid-fullscreen-zoom-label"
3373
- }, qe(f.value.scale)),
3374
- B("button", {
4126
+ }, Ye(h.value.scale)),
4127
+ H("button", {
3375
4128
  type: "button",
3376
4129
  class: "markweave-mermaid-fullscreen-control",
3377
4130
  "aria-label": "Zoom in",
3378
4131
  "data-testid": "markweave-mermaid-fullscreen-zoom-in",
3379
4132
  onMouseenter: () => {
3380
- p.value = "zoom-in";
4133
+ g.value = "zoom-in";
3381
4134
  },
3382
4135
  onMouseleave: () => {
3383
- p.value = null;
4136
+ g.value = null;
3384
4137
  },
3385
4138
  onFocus: () => {
3386
- p.value = "zoom-in";
4139
+ g.value = "zoom-in";
3387
4140
  },
3388
4141
  onBlur: () => {
3389
- p.value = null;
4142
+ g.value = null;
3390
4143
  },
3391
- onClick: () => ce(it)
4144
+ onClick: () => fe(ct)
3392
4145
  }, [Q("zoomIn")]),
3393
- B("button", {
4146
+ H("button", {
3394
4147
  type: "button",
3395
4148
  class: "markweave-mermaid-fullscreen-control",
3396
4149
  "aria-label": "Reset zoom",
3397
4150
  "data-testid": "markweave-mermaid-fullscreen-reset",
3398
4151
  onMouseenter: () => {
3399
- p.value = "reset";
4152
+ g.value = "reset";
3400
4153
  },
3401
4154
  onMouseleave: () => {
3402
- p.value = null;
4155
+ g.value = null;
3403
4156
  },
3404
4157
  onFocus: () => {
3405
- p.value = "reset";
4158
+ g.value = "reset";
3406
4159
  },
3407
4160
  onBlur: () => {
3408
- p.value = null;
4161
+ g.value = null;
3409
4162
  },
3410
- onClick: le
4163
+ onClick: pe
3411
4164
  }, [Q("reset")]),
3412
- p.value ? B("span", {
4165
+ g.value ? H("span", {
3413
4166
  class: "markweave-mermaid-fullscreen-tooltip",
3414
4167
  role: "tooltip",
3415
4168
  "data-testid": "markweave-mermaid-fullscreen-tooltip"
3416
- }, p.value === "zoom-out" ? "Zoom out" : p.value === "zoom-in" ? "Zoom in" : "Reset") : null
4169
+ }, g.value === "zoom-out" ? "Zoom out" : g.value === "zoom-in" ? "Zoom in" : "Reset") : null
3417
4170
  ]),
3418
- B("button", {
4171
+ H("button", {
3419
4172
  type: "button",
3420
4173
  class: "markweave-mermaid-fullscreen-close",
3421
4174
  "aria-label": "Close fullscreen Mermaid preview",
3422
4175
  "data-testid": "markweave-mermaid-fullscreen-close",
3423
- onClick: te
4176
+ onClick: ne
3424
4177
  }, [Q("close")]),
3425
- B("div", {
4178
+ H("div", {
3426
4179
  class: "markweave-mermaid-fullscreen-viewport",
3427
4180
  "data-testid": "markweave-mermaid-fullscreen-viewport",
3428
- "data-dragging": m.value ? "true" : "false",
3429
- onWheel: z,
3430
- onMousedown: ue,
3431
- onMousemove: de,
3432
- onMouseup: fe,
3433
- onMouseleave: fe
3434
- }, [B("div", {
4181
+ "data-dragging": _.value ? "true" : "false",
4182
+ onWheel: me,
4183
+ onMousedown: he,
4184
+ onMousemove: ge,
4185
+ onMouseup: _e,
4186
+ onMouseleave: _e
4187
+ }, [H("div", {
3435
4188
  class: "markweave-mermaid-fullscreen-content",
3436
4189
  "data-testid": "markweave-mermaid-fullscreen-content",
3437
- "data-scale-percent": Math.round(f.value.scale * 100),
3438
- "data-translate": `${Math.round(f.value.translateX)},${Math.round(f.value.translateY)}`,
4190
+ "data-scale-percent": Math.round(h.value.scale * 100),
4191
+ "data-translate": `${Math.round(h.value.translateX)},${Math.round(h.value.translateY)}`,
3439
4192
  style: {
3440
- width: `${f.value.width}px`,
3441
- height: `${f.value.height}px`,
3442
- transform: `translate(${f.value.translateX}px, ${f.value.translateY}px) scale(${f.value.scale})`
4193
+ width: `${h.value.width}px`,
4194
+ height: `${h.value.height}px`,
4195
+ transform: `translate(${h.value.translateX}px, ${h.value.translateY}px) scale(${h.value.scale})`
3443
4196
  },
3444
- innerHTML: f.value.svg
4197
+ innerHTML: h.value.svg
3445
4198
  })])
3446
4199
  ]) : null
3447
4200
  ]);
3448
4201
  };
3449
4202
  }
3450
- }), Kr = J({
4203
+ }), Li = Y({
3451
4204
  name: "MarkweaveVueInnerToc",
3452
4205
  props: {
3453
4206
  editor: {
@@ -3472,22 +4225,22 @@ var Br = J({
3472
4225
  }
3473
4226
  },
3474
4227
  setup(e) {
3475
- let t = V(null), n, r = () => {
3476
- n?.(), n = e.placement === "container" && t.value ? Oe(t.value) : void 0;
4228
+ let t = U(null), n, r = () => {
4229
+ n?.(), n = e.placement === "container" && t.value ? ke(t.value) : void 0;
3477
4230
  };
3478
- return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
4231
+ return Rn(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
3479
4232
  ref: t,
3480
4233
  class: "markweave-inner-toc",
3481
4234
  "data-testid": "markweave-inner-toc",
3482
4235
  "aria-label": e.messages.toc.ariaLabel
3483
- }, [B("div", {
4236
+ }, [H("div", {
3484
4237
  class: "markweave-inner-toc-rail",
3485
4238
  "aria-hidden": "true"
3486
- }, e.state.items.map((e) => B("span", {
4239
+ }, e.state.items.map((e) => H("span", {
3487
4240
  key: e.id,
3488
4241
  "data-level": e.level,
3489
4242
  "data-active": e.active ? "true" : "false"
3490
- }))), B("div", { class: "markweave-inner-toc-panel" }, [B("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => B("button", {
4243
+ }))), H("div", { class: "markweave-inner-toc-panel" }, [H("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => H("button", {
3491
4244
  key: t.id,
3492
4245
  type: "button",
3493
4246
  class: "markweave-inner-toc-item",
@@ -3496,75 +4249,77 @@ var Br = J({
3496
4249
  "aria-current": t.active ? "location" : void 0,
3497
4250
  "aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
3498
4251
  title: t.text,
3499
- onClick: () => ke(e.editor, t, {
4252
+ onClick: () => Ae(e.editor, t, {
3500
4253
  behavior: "smooth",
3501
4254
  focus: e.editable
3502
4255
  })
3503
4256
  }, t.text)))])]) : null;
3504
4257
  }
3505
4258
  });
3506
- function qr(e = {}) {
3507
- let i = r(e.lang), o = n(i), s = t(i), c = V(f(e.mode)), l = U(() => xe(e.theme)), u = U(() => c.value === "live" && e.editable !== !1), d = V(0), m = H(null), h = V(jt), g = H(null), _ = H(null), v = V("code"), y = H(null), b = H(Rt), x = V(null), S = V(!1), C = H(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = null;
3508
- function E() {
3509
- T !== null && (window.clearTimeout(T), T = null), d.value += 1;
4259
+ function Ri(e = {}) {
4260
+ let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Se(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(zt), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(Kt), x = U(null), S = U(!1), C = W(null), w = V(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
4261
+ function O() {
4262
+ D !== null && (window.clearTimeout(D), D = null), d.value += 1;
3510
4263
  }
3511
- function ee() {
3512
- T !== null && window.clearTimeout(T), T = window.setTimeout(() => {
3513
- T = null, d.value += 1;
3514
- }, ve);
4264
+ function k() {
4265
+ D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
4266
+ D = null, d.value += 1;
4267
+ }, ye);
3515
4268
  }
3516
- let D = e.onSlashCommandUpload, O = H(null);
3517
- O.value = new a({
3518
- extensions: Or({
4269
+ let A = e.onSlashCommandUpload, ee = W(null);
4270
+ ee.value = new a({
4271
+ extensions: _i({
3519
4272
  lang: i,
3520
4273
  linkCardResolver: e.linkCardResolver,
3521
- onImageUpload: (e) => D?.(e) ?? F(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3522
- onVideoUpload: (e) => D?.(e) ?? F(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
4274
+ onImageUpload: (e) => A?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4275
+ onVideoUpload: (e) => A?.(e) ?? te(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4276
+ resolveMediaSource: e.resolveMediaSource
3523
4277
  }),
3524
- content: e.content ?? e.defaultContent ?? "",
3525
- contentType: re(w),
4278
+ content: T,
4279
+ contentType: ie(w),
3526
4280
  editable: u.value,
3527
4281
  autofocus: e.autofocus,
3528
4282
  editorProps: {
3529
4283
  attributes: {
3530
4284
  class: "markweave-editor-surface",
3531
4285
  "data-testid": "markweave-editor-surface",
4286
+ "data-markweave-large-document": E ? "true" : "false",
3532
4287
  autocapitalize: "off",
3533
4288
  autocorrect: "off",
3534
4289
  spellcheck: "false",
3535
4290
  translate: "no"
3536
4291
  },
3537
4292
  handleClick: (e, t, n) => {
3538
- if (!u.value) return pe(n);
3539
- let r = pt(e, n);
3540
- return r ? (n.preventDefault(), n.stopPropagation(), A(), _t(e, r, !0), vt(e, r), y.value = r, !0) : (y.value = null, !1);
4293
+ if (!u.value) return me(n);
4294
+ let r = yt(e, n);
4295
+ return r ? (n.preventDefault(), n.stopPropagation(), M(), Ct(e, r, !0), wt(e, r), y.value = r, !0) : (y.value = null, !1);
3541
4296
  },
3542
4297
  handleDOMEvents: {
3543
- compositionstart: () => u.value ? (h.value = Mt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
3544
- compositionend: (e) => (u.value && window.setTimeout(() => j(e), 0), !1),
4298
+ compositionstart: () => u.value ? (h.value = Bt(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
4299
+ compositionend: (e) => (u.value && window.setTimeout(() => N(e), 0), !1),
3545
4300
  click: (e, t) => {
3546
- if (!u.value) return pe(t);
3547
- let n = pt(e, t);
3548
- return n ? (t.preventDefault(), t.stopPropagation(), A(), _t(e, n, !0), vt(e, n), y.value = n, !0) : (y.value = null, !1);
4301
+ if (!u.value) return me(t);
4302
+ let n = yt(e, t);
4303
+ return n ? (t.preventDefault(), t.stopPropagation(), M(), Ct(e, n, !0), wt(e, n), y.value = n, !0) : (y.value = null, !1);
3549
4304
  }
3550
4305
  }
3551
4306
  },
3552
- onSelectionUpdate: ({ editor: e }) => N(e),
4307
+ onSelectionUpdate: ({ editor: e }) => F(e),
3553
4308
  onCreate: ({ editor: t }) => {
3554
4309
  p(t, {
3555
4310
  mode: c.value,
3556
4311
  editable: u.value
3557
- }), bt(t, l.value), xt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ft(t), P(t), N(t), E();
4312
+ }), Et(t, l.value), Dt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && Ut(t), I(t), F(t), O();
3558
4313
  },
3559
4314
  onTransaction: ({ editor: e, transaction: t }) => {
3560
- if (P(e), (t.docChanged || yt(t)) && ee(), t.docChanged && y.value) {
3561
- let t = ft(e, y.value.pos);
4315
+ if (I(e), (t.docChanged || Tt(t)) && k(), t.docChanged && y.value) {
4316
+ let t = vt(e, y.value.pos);
3562
4317
  y.value = t?.kind === y.value.kind ? t : null;
3563
4318
  }
3564
4319
  },
3565
4320
  onUpdate: ({ editor: t }) => {
3566
- N(t), u.value && M(t), S.value || e.onUpdate?.(ne(t, { onContentRead: (n, r) => {
3567
- let i = oe(e.contentFormat);
4321
+ F(t), u.value && P(t), S.value || e.onUpdate?.(B(t, { onContentRead: (n, r) => {
4322
+ let i = V(e.contentFormat);
3568
4323
  e.content !== void 0 && n === i && (C.value = {
3569
4324
  content: r,
3570
4325
  format: n,
@@ -3573,173 +4328,190 @@ function qr(e = {}) {
3573
4328
  } }));
3574
4329
  }
3575
4330
  });
3576
- let k = U(() => O.value ?? null);
3577
- function A() {
3578
- g.value = null, _.value = null, h.value = jt;
4331
+ let j = G(() => ee.value ?? null);
4332
+ function M() {
4333
+ g.value = null, _.value = null, h.value = zt;
3579
4334
  }
3580
- function j(e) {
3581
- let t = At(e.state);
4335
+ function N(e) {
4336
+ let t = Lt(e.state);
3582
4337
  if (!t) {
3583
- h.value = h.value.name === "idle" ? h.value : jt, g.value = null, _.value = null;
4338
+ h.value = h.value.name === "idle" ? h.value : zt, g.value = null, _.value = null;
3584
4339
  return;
3585
4340
  }
3586
4341
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3587
- g.value = kt(n, {
4342
+ if (!Rt(r, { frameRect: i })) {
4343
+ M();
4344
+ return;
4345
+ }
4346
+ let a = It(n, {
3588
4347
  frameRect: i,
3589
4348
  triggerRect: r
3590
- }), h.value = Ot(h.value, t);
4349
+ });
4350
+ Nt(g.value, a) || (g.value = a), h.value = Ft(h.value, t);
3591
4351
  }
3592
- function M(e) {
3593
- j(e.view);
4352
+ function P(e) {
4353
+ N(e.view);
3594
4354
  }
3595
- function N(e) {
3596
- let t = _e(e);
3597
- he(m.value, t) || (m.value = t);
3598
- let n = mt(e);
3599
- n && (gt(e, n, !0), y.value = n);
3600
- let r = Me(e);
4355
+ function F(e) {
4356
+ let t = ve(e);
4357
+ ge(m.value, t) || (m.value = t);
4358
+ let n = bt(e);
4359
+ n && (St(e, n, !0), y.value = n);
4360
+ let r = Ne(e);
3601
4361
  r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
3602
4362
  }
3603
- function P(e) {
3604
- b.value = jr(e);
4363
+ function I(e) {
4364
+ b.value = bi(e);
3605
4365
  }
3606
- let I = U(() => k.value ? Me(k.value) : Ar), te = U(() => k.value ? It(k.value.state) : kr), R = U(() => m.value?.currentNode === "codeBlock"), se = U(() => R.value && I.value.language === "mermaid"), ce = U(() => k.value ? Ct({
4366
+ let L = G(() => j.value ? Ne(j.value) : yi), R = G(() => j.value ? Wt(j.value.state) : vi), re = G(() => m.value?.currentNode === "codeBlock"), se = G(() => re.value && L.value.language === "mermaid"), ce = G(() => j.value ? kt({
3607
4367
  active: se.value,
3608
4368
  mode: v.value,
3609
- source: I.value.text
3610
- }) : Ct({
4369
+ source: L.value.text
4370
+ }) : kt({
3611
4371
  active: !1,
3612
4372
  mode: "code",
3613
4373
  source: ""
3614
- })), le = U(() => k.value ? Pt(k.value.state) : null), z = U(() => k.value ? Te(k.value.state.doc) : Ce.items), ue = U(() => Ee(z.value, x.value)), de = U(() => Se(z.value, ue.value)), fe = U(() => wt(h.value.query, s)), ge = U(() => me({
4374
+ })), le = G(() => j.value && e.onRuntimeStateChange ? Ht(j.value.state) : null), ue = G(() => j.value ? Ee(j.value.state) : we.items), de = G(() => De(ue.value, x.value)), fe = G(() => Ce(ue.value, de.value)), pe = G(() => At(h.value.query, s)), _e = G(() => he({
3615
4375
  revision: d.value,
3616
4376
  mode: c.value,
3617
4377
  editable: u.value,
3618
- toc: de.value,
4378
+ toc: fe.value,
3619
4379
  selection: m.value,
3620
4380
  slash: h.value,
3621
- table: te.value,
4381
+ table: R.value,
3622
4382
  tableInteraction: b.value,
3623
- codeBlock: I.value,
4383
+ codeBlock: L.value,
3624
4384
  mermaid: ce.value,
3625
4385
  tableDebugSnapshot: le.value
3626
- })), ye = {
3627
- closeSlashMenu: A,
3628
- focusFirstTableBodyCell: () => k.value ? Ft(k.value) : !1,
4386
+ })), be = {
4387
+ closeSlashMenu: M,
4388
+ focusFirstTableBodyCell: () => j.value ? Ut(j.value) : !1,
3629
4389
  setContent: (e, t = {}) => {
3630
- if (!k.value) return !1;
3631
- let n = oe(t.format);
3632
- return k.value.commands.setContent(e, {
3633
- contentType: re(n),
4390
+ if (!j.value) return !1;
4391
+ let n = V(t.format);
4392
+ return j.value.commands.setContent(e, {
4393
+ contentType: ie(n),
3634
4394
  emitUpdate: t.emitUpdate ?? !1
3635
- }), t.focusFirstTableBodyCell && Ft(k.value), N(k.value), u.value && M(k.value), P(k.value), E(), !0;
4395
+ }), t.focusFirstTableBodyCell && Ut(j.value), F(j.value), u.value && P(j.value), I(j.value), O(), !0;
3636
4396
  }
3637
4397
  };
3638
- function be(e, t) {
3639
- if (!(!k.value || !u.value || !Tt(e))) {
4398
+ function xe(e, t) {
4399
+ if (!(!j.value || !u.value || !jt(e))) {
3640
4400
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
3641
4401
  _.value = e;
3642
4402
  return;
3643
4403
  }
3644
- Dt(k.value, h.value, e, t), h.value = Mt(h.value, { type: "execute" }), A();
4404
+ Pt(j.value, h.value, e, t), h.value = Bt(h.value, { type: "execute" }), M();
3645
4405
  }
3646
4406
  }
3647
- function De(e) {
3648
- if (!k.value || _.value || !u.value) return;
3649
- let t = Et(h.value, fe.value, e.key, { isComposing: e.isComposing || L(k.value.state) });
4407
+ function Oe(e) {
4408
+ if (!j.value || _.value || !u.value) return;
4409
+ let t = Mt(h.value, pe.value, e.key, { isComposing: e.isComposing || ne(j.value.state) });
3650
4410
  if (t.type !== "ignore") {
3651
4411
  if (e.preventDefault(), t.type === "close") {
3652
- h.value = Mt(h.value, { type: "escape" }), A();
4412
+ h.value = Bt(h.value, { type: "escape" }), M();
3653
4413
  return;
3654
4414
  }
3655
4415
  if (t.type === "move-active") {
3656
- h.value = Mt(h.value, {
4416
+ h.value = Bt(h.value, {
3657
4417
  type: "move-active",
3658
4418
  delta: t.delta,
3659
4419
  optionCount: t.optionCount
3660
4420
  });
3661
4421
  return;
3662
4422
  }
3663
- be(t.command);
4423
+ xe(t.command);
3664
4424
  }
3665
4425
  }
3666
- W(() => [e.mode, e.editable], () => {
3667
- c.value = f(e.mode), k.value && (k.value.setEditable(u.value), p(k.value, {
4426
+ K(() => [e.mode, e.editable], () => {
4427
+ c.value = f(e.mode), j.value && (j.value.setEditable(u.value), p(j.value, {
3668
4428
  mode: c.value,
3669
4429
  editable: u.value
3670
- }), xt(k.value, u.value ? "live" : "view"), E(), u.value || A());
3671
- }, { immediate: !0 }), W(() => e.theme, () => {
3672
- k.value && bt(k.value, l.value);
3673
- }, { immediate: !0 }), W(() => e.content, (t) => {
3674
- let n = oe(e.contentFormat);
3675
- if (!(!k.value || t === void 0)) {
3676
- if (ae(k.value, C.value, t, n)) {
4430
+ }), Dt(j.value, u.value ? "live" : "view"), O(), u.value || M());
4431
+ }, { immediate: !0 }), K(() => e.theme, () => {
4432
+ j.value && Et(j.value, l.value);
4433
+ }, { immediate: !0 }), K(() => e.content, (t) => {
4434
+ let n = V(e.contentFormat);
4435
+ if (!(!j.value || t === void 0)) {
4436
+ if (oe(j.value, C.value, t, n)) {
3677
4437
  C.value = null;
3678
4438
  return;
3679
4439
  }
3680
- C.value = null, !ie(k.value, t, n) && (S.value = !0, k.value.commands.setContent(t, {
3681
- contentType: re(n),
4440
+ C.value = null, !ae(j.value, t, n) && (S.value = !0, j.value.commands.setContent(t, {
4441
+ contentType: ie(n),
3682
4442
  emitUpdate: !1
3683
- }), S.value = !1, N(k.value), u.value && M(k.value), P(k.value), E());
4443
+ }), S.value = !1, F(j.value), u.value && P(j.value), I(j.value), O());
3684
4444
  }
3685
- }), W(ge, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(de, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
3686
- let t = Ee(e, x.value);
4445
+ }), K(_e, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(fe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ue, (e) => {
4446
+ let t = De(e, x.value);
3687
4447
  x.value !== t && (x.value = t);
3688
4448
  });
3689
- let Oe = null;
3690
- return K(() => {
3691
- T !== null && window.clearTimeout(T);
3692
- }), G(() => {
4449
+ let ke = z(() => {
4450
+ j.value && g.value && N(j.value.view);
4451
+ }), Ae = () => {
4452
+ g.value && ke.schedule();
4453
+ };
4454
+ K(g, (e) => {
4455
+ e ? Ae() : ke.cancel();
4456
+ }), Rn(() => {
4457
+ window.addEventListener("resize", Ae), window.addEventListener("scroll", Ae, !0);
4458
+ }), q(() => {
4459
+ ke.cancel(), window.removeEventListener("resize", Ae), window.removeEventListener("scroll", Ae, !0);
4460
+ });
4461
+ let je = null;
4462
+ return q(() => {
4463
+ D !== null && window.clearTimeout(D);
4464
+ }), Rn(() => {
3693
4465
  let e = () => {
3694
- if (!k.value || !z.value.length) {
4466
+ if (!j.value || !ue.value.length) {
3695
4467
  x.value = null;
3696
4468
  return;
3697
4469
  }
3698
4470
  let e = null;
3699
4471
  try {
3700
- e = we(k.value, z.value);
4472
+ e = Te(j.value, ue.value);
3701
4473
  } catch {
3702
4474
  return;
3703
4475
  }
3704
4476
  x.value !== e && (x.value = e);
3705
- }, t = () => window.requestAnimationFrame(e), n = Mr(k.value?.view.dom ?? null);
3706
- window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Oe = () => {
4477
+ }, t = () => window.requestAnimationFrame(e), n = xi(j.value?.view.dom ?? null);
4478
+ window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), je = () => {
3707
4479
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
3708
4480
  };
3709
- }), K(() => {
3710
- Oe?.();
3711
- let e = O.value;
3712
- O.value = null, q(() => e?.destroy());
4481
+ }), q(() => {
4482
+ je?.();
4483
+ let e = ee.value;
4484
+ ee.value = null, J(() => e?.destroy());
3713
4485
  }), {
3714
- editor: k,
3715
- runtimeSnapshot: ge,
3716
- actions: ye,
4486
+ editor: j,
4487
+ runtimeSnapshot: _e,
4488
+ actions: be,
3717
4489
  __render: {
3718
4490
  messages: o,
3719
4491
  effectiveEditable: u,
3720
- tableFocusState: te,
4492
+ tableFocusState: R,
3721
4493
  tableInteractionState: b,
3722
- codeBlockState: I,
3723
- isCodeBlockActive: R,
4494
+ codeBlockState: L,
4495
+ isCodeBlockActive: re,
3724
4496
  mermaidMode: v,
3725
4497
  mathTarget: y,
3726
4498
  setMermaidMode: (e) => {
3727
4499
  v.value = e;
3728
4500
  },
3729
- tocState: de,
3730
- filteredSlashCommands: fe,
4501
+ tocState: fe,
4502
+ filteredSlashCommands: pe,
3731
4503
  slashState: h,
3732
4504
  slashMenuPosition: g,
3733
4505
  slashInputCommand: _,
3734
- runSlashCommand: be,
3735
- handleEditorKeyDown: De,
4506
+ runSlashCommand: xe,
4507
+ handleEditorKeyDown: Oe,
3736
4508
  setSlashInputCommand: (e) => {
3737
4509
  _.value = e;
3738
4510
  }
3739
4511
  }
3740
4512
  };
3741
4513
  }
3742
- var Jr = J({
4514
+ var zi = Y({
3743
4515
  name: "MarkweaveEditor",
3744
4516
  props: {
3745
4517
  defaultContent: {
@@ -3802,6 +4574,10 @@ var Jr = J({
3802
4574
  type: Function,
3803
4575
  default: void 0
3804
4576
  },
4577
+ resolveMediaSource: {
4578
+ type: Function,
4579
+ default: void 0
4580
+ },
3805
4581
  className: {
3806
4582
  type: String,
3807
4583
  default: void 0
@@ -3844,29 +4620,29 @@ var Jr = J({
3844
4620
  }
3845
4621
  },
3846
4622
  setup(e) {
3847
- let t = qr(e);
4623
+ let t = Ri(e);
3848
4624
  return () => {
3849
4625
  let n = t.editor.value;
3850
4626
  if (!n) return null;
3851
- let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = be(e.canvasColor);
3852
- return B("section", {
4627
+ let r = t.__render, i = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), a = xe(e.canvasColor);
4628
+ return H("section", {
3853
4629
  class: i,
3854
4630
  "aria-label": e.ariaLabel ?? r.messages.common.editorAriaLabel,
3855
4631
  "data-testid": "markweave-editor-frame",
3856
4632
  "data-markweave-mode": t.runtimeSnapshot.value.mode,
3857
- "data-markweave-theme": xe(e.theme),
4633
+ "data-markweave-theme": Se(e.theme),
3858
4634
  style: a ? { "--markweave-canvas": a } : void 0,
3859
4635
  "data-markweave-inner-toc": e.innerToc ? "true" : "false",
3860
- "data-markweave-inner-toc-placement": De(e.innerTocPlacement),
4636
+ "data-markweave-inner-toc-placement": Oe(e.innerTocPlacement),
3861
4637
  "data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
3862
4638
  "data-table-focus-mode": r.tableFocusState.value.mode,
3863
4639
  onKeydownCapture: r.handleEditorKeyDown
3864
4640
  }, [
3865
- r.effectiveEditable.value ? B(Br, {
4641
+ r.effectiveEditable.value ? H(ki, {
3866
4642
  editor: n,
3867
4643
  messages: r.messages
3868
4644
  }) : null,
3869
- r.effectiveEditable.value ? B(Hr, {
4645
+ r.effectiveEditable.value ? H(ji, {
3870
4646
  commands: r.filteredSlashCommands.value,
3871
4647
  state: r.slashState.value,
3872
4648
  position: r.slashMenuPosition.value,
@@ -3876,7 +4652,7 @@ var Jr = J({
3876
4652
  onInputCommandChange: r.setSlashInputCommand,
3877
4653
  onUpload: e.onSlashCommandUpload
3878
4654
  }) : null,
3879
- r.effectiveEditable.value ? B(Ur, {
4655
+ r.effectiveEditable.value ? H(Pi, {
3880
4656
  editor: n,
3881
4657
  active: r.tableFocusState.value.active,
3882
4658
  interactionState: r.tableInteractionState.value,
@@ -3885,11 +4661,11 @@ var Jr = J({
3885
4661
  onCommandResult: e.onTableCommandResult,
3886
4662
  onEditWithAi: e.onEditWithAi
3887
4663
  }) : null,
3888
- r.effectiveEditable.value ? B(Wr, {
4664
+ r.effectiveEditable.value ? H(Fi, {
3889
4665
  editor: n,
3890
4666
  focusState: r.tableFocusState.value
3891
4667
  }) : null,
3892
- B(Gr, {
4668
+ H(Ii, {
3893
4669
  editor: n,
3894
4670
  state: r.codeBlockState.value,
3895
4671
  active: r.effectiveEditable.value && r.isCodeBlockActive.value,
@@ -3897,23 +4673,23 @@ var Jr = J({
3897
4673
  onMermaidModeChange: r.setMermaidMode,
3898
4674
  readOnly: !r.effectiveEditable.value
3899
4675
  }),
3900
- e.innerToc && r.tocState.value.items.length ? B(Kr, {
4676
+ e.innerToc && r.tocState.value.items.length ? H(Li, {
3901
4677
  editor: n,
3902
4678
  state: r.tocState.value,
3903
4679
  messages: r.messages,
3904
4680
  editable: r.effectiveEditable.value,
3905
- placement: De(e.innerTocPlacement)
4681
+ placement: Oe(e.innerTocPlacement)
3906
4682
  }) : null,
3907
- r.effectiveEditable.value && r.mathTarget.value ? B(Vr, {
4683
+ r.effectiveEditable.value && r.mathTarget.value ? H(Ai, {
3908
4684
  editor: n,
3909
4685
  messages: r.messages,
3910
4686
  target: r.mathTarget.value,
3911
4687
  onClose: () => r.mathTarget.value = null
3912
4688
  }) : null,
3913
- B(o, { editor: n })
4689
+ H(o, { editor: n })
3914
4690
  ]);
3915
4691
  };
3916
4692
  }
3917
4693
  });
3918
4694
  //#endregion
3919
- export { Jr as MarkweaveEditor, Or as createMarkweaveEditorExtensions, Or as createMarkweaveVue2EditorExtensions, qr as useMarkweaveEditorController };
4695
+ export { zi as MarkweaveEditor, _i as createMarkweaveEditorExtensions, _i as createMarkweaveVue2EditorExtensions, Ri as useMarkweaveEditorController };