@markweave/vue2 0.1.0 → 0.1.2

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
@@ -4,49 +4,50 @@ import { Editor as n, EditorContent as r, NodeViewWrapper as i, VueNodeViewRende
4
4
  import * as o from "vue";
5
5
  import { getMarkweaveEditorModeState as s, isMarkweaveEditorLiveEditable as c, normalizeMarkweaveEditorMode as l, setMarkweaveEditorModeState as u, subscribeToMarkweaveEditorMode as d } from "markweave/internal/core/editor-mode-state";
6
6
  import { getLocalizedSlashCommandSpecs as f, getMarkweaveMessages as p, normalizeMarkweaveLang as m } from "markweave/internal/i18n";
7
- import { MarkweaveCoreImage as h, MarkweaveCoreVideo as g, attrsFromMarkweaveImageUploadResult as _, attrsFromMarkweaveVideoUploadResult as v, attrsFromMarkweaveVideoUrl as y, clampMarkweaveImageWidth as b, createMarkweaveImageUploadRequest as x, createMarkweaveVideoUploadRequest as S, downloadMarkweaveImage as C, markweaveVideoIframeAllow as w, normalizeMarkweaveCoreImageAlign as T, normalizeMarkweaveVideoEmbedUrl as E, numberAttribute as D, stringAttribute as O } from "markweave/internal/plugins/media/core-media-nodes";
8
- import { detectUploadSource as k, getDirectUploadResult as A, resolveMarkweaveUploadResult as j } from "markweave/internal/plugins/slash-command/upload";
9
- import { BubbleMenu as M } from "@tiptap/vue-2/menus";
10
- import { isEditorComposing as N } from "markweave/internal/editor-core/composition-guard";
11
- import { createMarkweaveEditorUpdatePayload as ee, getMarkweaveContentType as P, isEditorContentCurrent as te, normalizeMarkweaveContentFormat as F } from "markweave/internal/editor-core/editor-content";
12
- import { getCurrentFloatingToolbarBlockType as I, getFloatingToolbarHighlightColorOptions as L, getFloatingToolbarMoreActions as R, getFloatingToolbarTextColorOptions as ne, getFloatingToolbarTurnIntoOptions as re, runFloatingToolbarMoreAction as z, setFloatingToolbarTurnInto as ie } from "markweave/internal/editor-core/floating-toolbar-model";
13
- import { openMarkweaveReadonlyLinkFromEvent as ae } from "markweave/internal/editor-core/readonly-link";
14
- import { createMarkweaveEditorRuntimeSnapshot as oe } from "markweave/internal/editor-core/runtime-snapshot";
15
- import { createSelectionSnapshot as B, shouldShowFloatingToolbar as se } from "markweave/internal/editor-core/selection-state";
16
- import { createMarkweaveTocState as ce, emptyMarkweaveTocState as le, getActiveMarkweaveTocId as ue, getMarkweaveTocItems as de, getValidMarkweaveTocActiveId as fe, scrollToMarkweaveTocItem as pe } from "markweave/internal/core/toc-state";
17
- import { codeBlockCollapsePluginKey as me, copyActiveCodeBlock as he, getActiveCodeBlockState as ge, getCodeBlockCopyFeedbackSnapshot as _e, markweaveCodeBlockBehavior as ve, setCodeBlockCollapsedAtPosition as ye, setCodeBlockLanguageAtPosition as be, setCodeBlockMermaidPreviewModeAtPosition as xe } from "markweave/internal/plugins/codeblock/codeblock-behavior";
18
- import { calculateCodeBlockLanguageMenuPosition as Se, clampFullscreenScale as Ce, codeBlockCopyFeedbackTimeoutMs as we, copyCodeBlockText as Te, createCodeBlockOverlayPosition as Ee, createMermaidFullscreenViewerState as De, createMermaidTabPosition as Oe, focusCodeBlockTarget as ke, formatCodeBlockLanguageLabel as Ae, formatFullscreenZoom as je, getActiveCodeBlockElement as Me, getAnchoredRect as Ne, getCodeBlockLanguageItems as Pe, getCodeBlockPositionFromEventTarget as Fe, getCodeBlockStateAtPosition as Ie, getFrameElement as Le, getMermaidCodeBlockTargets as Re, getMermaidSvgMarkup as ze, isCodeBlockTargetCollapsed as Be, mergeStableMermaidTabPositions as Ve, mermaidFullscreenZoomStep as He, moveMermaidFullscreenViewer as Ue } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
19
- import { normalizeMarkdownLinkHref as We } from "markweave/internal/plugins/markdown/markdown-input";
20
- import { applyMarkweaveMathLatex as Ge, calculateMarkweaveMathPopoverPosition as Ke, getMarkweaveMathAnchorRect as qe, getMarkweaveMathBlockIndex as Je, getMarkweaveMathRenderedHtml as Ye, getMarkweaveMathTargetAtPos as Xe, getMarkweaveMathTargetFromDomEvent as Ze, getMarkweaveMathTargetFromSelection as Qe, renderMarkweaveMathPreview as $e, setMarkweaveMathEditingDomState as et, setMarkweaveMathEditingDomStateInView as tt, setMarkweaveMathSelectionInView as nt } from "markweave/internal/plugins/math/math-ui-model";
21
- import { isMermaidInlinePreviewTransaction as rt, setMermaidInlinePreviewEditorMode as it, setReadonlyMermaidPreviewMode as at } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
22
- import { getMermaidPreviewState as ot } from "markweave/internal/plugins/mermaid/mermaid-renderer";
23
- import { filterSlashCommands as st, isExecutableSlashCommand as ct } from "markweave/internal/plugins/slash-command/command-spec";
24
- import { getSlashCommandKeyboardAction as lt } from "markweave/internal/plugins/slash-command/slash-keyboard";
25
- import { executeSlashCommand as ut, getNextSlashCommandState as dt, getSlashCommandAnchoredMenuPosition as ft, getSlashCommandContext as pt } from "markweave/internal/plugins/slash-command/slash-runtime";
26
- import { initialSlashCommandState as mt, reduceSlashCommandState as ht } from "markweave/internal/plugins/slash-command/slash-state";
27
- import { setMarkweaveTableMenuAxisTarget as gt } from "markweave/internal/plugins/table/table-clipboard";
28
- import { getFirstTableDebugSnapshot as _t } from "markweave/internal/plugins/table/table-debug-snapshot";
29
- import { focusFirstTableBodyCell as vt } from "markweave/internal/plugins/table/table-focus-position";
30
- import { getTableFocusState as yt } from "markweave/internal/plugins/table/table-focus-state";
31
- import { getTableSelectionOverlayState as bt, initialTableInteractionState as xt, tableInteractionPluginKey as St } from "markweave/internal/plugins/table/table-interaction-layer";
32
- import { calculateAnchoredTableMenuPosition as Ct, calculateTableEdgeHandlePosition as wt, canRunTableCommand as Tt, executeTableMenuCommand as Et, formatTableCopyFeedback as Dt, getActiveTableElement as Ot, getAvailableCellMenuCommandSpecs as kt, getTableAxisTargetRect as At, getTableControlAxisSelectionModel as jt, getTableEditWithAiRequest as Mt, getTableMenuItemGroup as Nt, getTableMenuItemLabel as Pt, getTableMenuItems as Ft, getTableSelectionTargetRect as It, measureTableSelectionOverlay as Lt, selectTableAxisFromCell as Rt, tableCopyFeedbackTimeoutMs as zt, tableMenuLabel as Bt } from "markweave/internal/plugins/table/table-ui-model";
7
+ import { openMarkweaveImagePreview as h } from "markweave/internal/plugins/media/image-preview";
8
+ import { MarkweaveCoreImage as g, MarkweaveCoreVideo as _, attrsFromMarkweaveImageUploadResult as v, attrsFromMarkweaveVideoUploadResult as y, attrsFromMarkweaveVideoUrl as b, clampMarkweaveImageWidth as x, createMarkweaveImageUploadRequest as S, createMarkweaveVideoUploadRequest as C, downloadMarkweaveImage as w, markweaveVideoIframeAllow as T, normalizeMarkweaveCoreImageAlign as E, normalizeMarkweaveVideoEmbedUrl as D, numberAttribute as O, stringAttribute as k } from "markweave/internal/plugins/media/core-media-nodes";
9
+ import { detectUploadSource as A, getDirectUploadResult as j, resolveMarkweaveUploadResult as M } from "markweave/internal/plugins/slash-command/upload";
10
+ import { BubbleMenu as N } from "@tiptap/vue-2/menus";
11
+ import { isEditorComposing as ee } from "markweave/internal/editor-core/composition-guard";
12
+ import { createMarkweaveEditorUpdatePayload as te, getMarkweaveContentType as P, isEditorContentCurrent as F, normalizeMarkweaveContentFormat as I } from "markweave/internal/editor-core/editor-content";
13
+ import { getCurrentFloatingToolbarBlockType as L, getFloatingToolbarHighlightColorOptions as R, getFloatingToolbarMoreActions as ne, getFloatingToolbarTextColorOptions as re, getFloatingToolbarTurnIntoOptions as z, runFloatingToolbarMoreAction as ie, setFloatingToolbarTurnInto as ae } from "markweave/internal/editor-core/floating-toolbar-model";
14
+ import { openMarkweaveReadonlyLinkFromEvent as oe } from "markweave/internal/editor-core/readonly-link";
15
+ import { createMarkweaveEditorRuntimeSnapshot as se } from "markweave/internal/editor-core/runtime-snapshot";
16
+ import { createSelectionSnapshot as ce, shouldShowFloatingToolbar as le } from "markweave/internal/editor-core/selection-state";
17
+ import { createMarkweaveTocState as ue, emptyMarkweaveTocState as de, getActiveMarkweaveTocId as fe, getMarkweaveTocItems as pe, getValidMarkweaveTocActiveId as me, normalizeMarkweaveInnerTocPlacement as he, observeMarkweaveInnerTocContainerPosition as ge, scrollToMarkweaveTocItem as _e } from "markweave/internal/core/toc-state";
18
+ import { codeBlockCollapsePluginKey as ve, copyActiveCodeBlock as ye, getActiveCodeBlockState as be, getCodeBlockCopyFeedbackSnapshot as xe, markweaveCodeBlockBehavior as Se, setCodeBlockCollapsedAtPosition as Ce, setCodeBlockLanguageAtPosition as we, setCodeBlockMermaidPreviewModeAtPosition as Te } from "markweave/internal/plugins/codeblock/codeblock-behavior";
19
+ import { calculateCodeBlockLanguageMenuPosition as Ee, clampFullscreenScale as De, codeBlockCopyFeedbackTimeoutMs as Oe, copyCodeBlockText as ke, createCodeBlockOverlayPosition as Ae, createMermaidFullscreenViewerState as je, createMermaidTabPosition as Me, focusCodeBlockTarget as Ne, formatCodeBlockLanguageLabel as Pe, formatFullscreenZoom as Fe, getActiveCodeBlockElement as Ie, getAnchoredRect as Le, getCodeBlockLanguageItems as Re, getCodeBlockPositionFromEventTarget as ze, getCodeBlockStateAtPosition as Be, getFrameElement as Ve, getMermaidCodeBlockTargets as He, getMermaidSvgMarkup as Ue, isCodeBlockTargetCollapsed as We, mergeStableMermaidTabPositions as Ge, mermaidFullscreenZoomStep as Ke, moveMermaidFullscreenViewer as qe } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
20
+ import { normalizeMarkdownLinkHref as Je } from "markweave/internal/plugins/markdown/markdown-input";
21
+ import { applyMarkweaveMathLatex as Ye, calculateMarkweaveMathPopoverPosition as Xe, getMarkweaveMathAnchorRect as Ze, getMarkweaveMathBlockIndex as Qe, getMarkweaveMathRenderedHtml as $e, getMarkweaveMathTargetAtPos as et, getMarkweaveMathTargetFromDomEvent as tt, getMarkweaveMathTargetFromSelection as nt, renderMarkweaveMathPreview as rt, setMarkweaveMathEditingDomState as it, setMarkweaveMathEditingDomStateInView as at, setMarkweaveMathSelectionInView as ot } from "markweave/internal/plugins/math/math-ui-model";
22
+ import { isMermaidInlinePreviewTransaction as st, setMermaidInlinePreviewEditorMode as ct, setReadonlyMermaidPreviewMode as lt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
23
+ import { getMermaidPreviewState as ut } from "markweave/internal/plugins/mermaid/mermaid-renderer";
24
+ import { filterSlashCommands as dt, isExecutableSlashCommand as ft } from "markweave/internal/plugins/slash-command/command-spec";
25
+ import { getSlashCommandKeyboardAction as pt } from "markweave/internal/plugins/slash-command/slash-keyboard";
26
+ import { executeSlashCommand as mt, getNextSlashCommandState as ht, getSlashCommandAnchoredMenuPosition as gt, getSlashCommandContext as _t } from "markweave/internal/plugins/slash-command/slash-runtime";
27
+ import { initialSlashCommandState as vt, reduceSlashCommandState as yt } from "markweave/internal/plugins/slash-command/slash-state";
28
+ import { setMarkweaveTableMenuAxisTarget as bt } from "markweave/internal/plugins/table/table-clipboard";
29
+ import { getFirstTableDebugSnapshot as xt } from "markweave/internal/plugins/table/table-debug-snapshot";
30
+ import { focusFirstTableBodyCell as St } from "markweave/internal/plugins/table/table-focus-position";
31
+ import { getTableFocusState as Ct } from "markweave/internal/plugins/table/table-focus-state";
32
+ import { getTableSelectionOverlayState as wt, initialTableInteractionState as Tt, tableInteractionPluginKey as Et } from "markweave/internal/plugins/table/table-interaction-layer";
33
+ import { calculateAnchoredTableMenuPosition as Dt, calculateTableEdgeHandlePosition as Ot, canRunTableCommand as kt, executeTableMenuCommand as At, formatTableCopyFeedback as jt, getActiveTableElement as Mt, getAvailableCellMenuCommandSpecs as Nt, getTableAxisTargetRect as Pt, getTableControlAxisSelectionModel as Ft, getTableEditWithAiRequest as It, getTableMenuItemGroup as Lt, getTableMenuItemLabel as Rt, getTableMenuItems as zt, getTableSelectionTargetRect as Bt, measureTableSelectionOverlay as Vt, selectTableAxisFromCell as Ht, tableCopyFeedbackTimeoutMs as Ut, tableMenuLabel as Wt } from "markweave/internal/plugins/table/table-ui-model";
33
34
  //#region src/vue2-compat.ts
34
- var Vt = o.default ?? o, Ht = null, Ut = null, Wt = null;
35
- function Gt(e) {
35
+ var Gt = o.default ?? o, Kt = null, qt = null, Jt = null;
36
+ function Yt(e) {
36
37
  return !!(e && typeof e == "object" && "value" in e);
37
38
  }
38
- function Kt(e) {
39
+ function Xt(e) {
39
40
  let t = e.slice(2);
40
41
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
41
42
  }
42
- function qt(e) {
43
+ function Zt(e) {
43
44
  let t = {}, n = {}, r = {}, i = {}, a = {};
44
45
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
45
46
  if (o === "class" || o === "style" || o === "key") {
46
47
  t[o] = s;
47
48
  continue;
48
49
  }
49
- if (o === "ref" && Gt(s)) {
50
+ if (o === "ref" && Yt(s)) {
50
51
  a.insert = (e) => {
51
52
  s.value = e.elm;
52
53
  }, a.destroy = () => {
@@ -55,7 +56,7 @@ function qt(e) {
55
56
  continue;
56
57
  }
57
58
  if (/^on[A-Z]/.test(o)) {
58
- i[Kt(o)] = s;
59
+ i[Xt(o)] = s;
59
60
  continue;
60
61
  }
61
62
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -66,14 +67,14 @@ function qt(e) {
66
67
  }
67
68
  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;
68
69
  }
69
- function Jt(e) {
70
+ function Qt(e) {
70
71
  let t = {}, n = {}, r = {}, i = {};
71
72
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
72
73
  if (a === "class" || a === "style" || a === "key") {
73
74
  t[a] = o;
74
75
  continue;
75
76
  }
76
- if (a === "ref" && Gt(o)) {
77
+ if (a === "ref" && Yt(o)) {
77
78
  i.insert = (e) => {
78
79
  o.value = e.componentInstance ?? e.elm;
79
80
  }, i.destroy = () => {
@@ -89,47 +90,47 @@ function Jt(e) {
89
90
  }
90
91
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
91
92
  }
92
- function Yt(e) {
93
+ function $t(e) {
93
94
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
94
95
  }
95
- function Xt(e) {
96
+ function en(e) {
96
97
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
97
98
  }
98
- function Zt(e) {
99
+ function tn(e) {
99
100
  return e == null || Array.isArray(e) ? e : [e];
100
101
  }
101
- function Qt(e) {
102
- return typeof e == "function" ? Zt(e()) : Yt(e) ? Zt(e.default()) : Xt(e) ? [e] : e;
102
+ function nn(e) {
103
+ return typeof e == "function" ? tn(e()) : $t(e) ? tn(e.default()) : en(e) ? [e] : e;
103
104
  }
104
- function V(e, t, n) {
105
- if (!Wt) throw Error("Vue 2 render context is not available.");
106
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? qt(r) : Jt(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Qt(n);
107
- return Wt(e, i, a);
105
+ function B(e, t, n) {
106
+ if (!Jt) throw Error("Vue 2 render context is not available.");
107
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Zt(r) : Qt(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : nn(n);
108
+ return Jt(e, i, a);
108
109
  }
109
- function H(e) {
110
- return Vt.observable({ value: e });
110
+ function V(e) {
111
+ return Gt.observable({ value: e });
111
112
  }
112
- var U = H;
113
- function W(e) {
113
+ var H = V;
114
+ function U(e) {
114
115
  return { get value() {
115
116
  return e();
116
117
  } };
117
118
  }
118
- function G(e, t, n) {
119
+ function W(e, t, n) {
119
120
  let r = typeof e == "function" ? e : () => e.value;
120
- return Ht?.$watch ? Ht.$watch(r, t, n) : () => void 0;
121
+ return Kt?.$watch ? Kt.$watch(r, t, n) : () => void 0;
121
122
  }
122
- function $t(e) {
123
- Ut?.mounted.push(e);
123
+ function G(e) {
124
+ qt?.mounted.push(e);
124
125
  }
125
126
  function K(e) {
126
- Ut?.beforeUnmount.push(e);
127
+ qt?.beforeUnmount.push(e);
127
128
  }
128
129
  function q(e) {
129
- return Vt.nextTick(e);
130
+ return Gt.nextTick(e);
130
131
  }
131
132
  function J(e) {
132
- return Vt.extend({
133
+ return Gt.extend({
133
134
  name: e.name,
134
135
  props: e.props,
135
136
  created() {
@@ -137,12 +138,12 @@ function J(e) {
137
138
  mounted: [],
138
139
  beforeUnmount: []
139
140
  };
140
- Ht = this, Ut = t;
141
+ Kt = this, qt = t;
141
142
  try {
142
143
  let n = e.setup?.(this.$props ?? this) ?? null;
143
144
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
144
145
  } finally {
145
- Ht = null, Ut = null;
146
+ Kt = null, qt = null;
146
147
  }
147
148
  },
148
149
  mounted() {
@@ -152,19 +153,19 @@ function J(e) {
152
153
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
153
154
  },
154
155
  render(t) {
155
- Wt = t;
156
+ Jt = t;
156
157
  try {
157
158
  let n = this.__markweaveVue2Render;
158
159
  return n ? n() : e.render?.(t) ?? null;
159
160
  } finally {
160
- Wt = null;
161
+ Jt = null;
161
162
  }
162
163
  }
163
164
  });
164
165
  }
165
166
  //#endregion
166
167
  //#region src/vue2-icons.ts
167
- var en = {
168
+ var rn = {
168
169
  AlignCenter: {
169
170
  iconName: "text-align-center",
170
171
  node: [
@@ -1029,8 +1030,8 @@ var en = {
1029
1030
  }]]
1030
1031
  }
1031
1032
  };
1032
- function tn(e) {
1033
- return e.map(([e, t]) => V(e, t));
1033
+ function an(e) {
1034
+ return e.map(([e, t]) => B(e, t));
1034
1035
  }
1035
1036
  function Y(e) {
1036
1037
  return J({
@@ -1050,8 +1051,8 @@ function Y(e) {
1050
1051
  }
1051
1052
  },
1052
1053
  setup(t) {
1053
- let n = en[e];
1054
- return () => V("svg", {
1054
+ let n = rn[e];
1055
+ return () => B("svg", {
1055
1056
  class: `lucide lucide-${n.iconName}`,
1056
1057
  viewBox: "0 0 24 24",
1057
1058
  width: t.size,
@@ -1063,16 +1064,14 @@ function Y(e) {
1063
1064
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1064
1065
  "aria-hidden": "true",
1065
1066
  focusable: "false"
1066
- }, tn(n.node));
1067
+ }, an(n.node));
1067
1068
  }
1068
1069
  });
1069
1070
  }
1070
- var nn = Y("AlignCenter"), rn = Y("AlignJustify"), an = Y("AlignLeft"), on = Y("AlignRight"), sn = Y("AlertTriangle"), cn = Y("Bold"), ln = Y("Braces"), un = Y("Captions"), dn = Y("CheckCircle2"), fn = Y("ChevronDown"), pn = Y("ChevronUp"), mn = Y("CircleX"), hn = Y("Code2"), gn = Y("CornerDownLeft"), _n = Y("Download");
1071
- Y("Eye");
1072
- var vn = Y("ExternalLink"), yn = Y("Heading1"), bn = Y("Heading2"), xn = Y("Heading3"), Sn = Y("Image"), Cn = Y("ImageUp"), wn = Y("IndentDecrease"), Tn = Y("IndentIncrease"), En = Y("Info"), Dn = Y("Italic"), On = Y("Lightbulb"), kn = Y("Link2"), An = Y("List"), jn = Y("ListChecks"), Mn = Y("ListOrdered"), Nn = Y("Minus"), Pn = Y("MoreVertical"), Fn = Y("Paperclip");
1071
+ var on = Y("AlignCenter"), sn = Y("AlignJustify"), cn = Y("AlignLeft"), ln = Y("AlignRight"), un = Y("AlertTriangle"), dn = Y("Bold"), fn = Y("Braces"), pn = Y("Captions"), mn = Y("CheckCircle2"), hn = Y("ChevronDown"), gn = Y("ChevronUp"), _n = Y("CircleX"), vn = Y("Code2"), yn = Y("CornerDownLeft"), bn = Y("Download"), xn = Y("Eye"), Sn = Y("ExternalLink"), Cn = Y("Heading1"), wn = Y("Heading2"), Tn = Y("Heading3"), En = Y("Image"), Dn = Y("ImageUp"), On = Y("IndentDecrease"), kn = Y("IndentIncrease"), An = Y("Info"), jn = Y("Italic"), Mn = Y("Lightbulb"), Nn = Y("Link2"), Pn = Y("List"), Fn = Y("ListChecks"), In = Y("ListOrdered"), Ln = Y("Minus"), Rn = Y("MoreVertical"), zn = Y("Paperclip");
1073
1072
  Y("PencilLine");
1074
- var In = Y("Quote"), Ln = Y("Replace"), Rn = Y("Sigma"), zn = Y("SmilePlus"), Bn = Y("Strikethrough"), Vn = Y("Subscript"), Hn = Y("Superscript"), Un = Y("Table2"), Wn = Y("Text"), Gn = Y("Trash2"), Kn = Y("Type"), qn = Y("Underline"), Jn = Y("Upload"), Yn = Y("Video"), Xn = T;
1075
- function Zn(e) {
1073
+ var Bn = Y("Quote"), Vn = Y("Replace"), Hn = Y("Sigma"), Un = Y("SmilePlus"), Wn = Y("Strikethrough"), Gn = Y("Subscript"), Kn = Y("Superscript"), qn = Y("Table2"), Jn = Y("Text"), Yn = Y("Trash2"), Xn = Y("Type"), Zn = Y("Underline"), Qn = Y("Upload"), $n = Y("Video"), er = E;
1074
+ function tr(e) {
1076
1075
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1077
1076
  let n = t?.getAttribute("data-markweave-mode");
1078
1077
  return n === "view" ? {
@@ -1082,7 +1081,7 @@ function Zn(e) {
1082
1081
  mode: "live",
1083
1082
  editable: e.isEditable
1084
1083
  } : s(e);
1085
- }, r = H(n()), i = d(e, () => {
1084
+ }, r = V(n()), i = d(e, () => {
1086
1085
  r.value = n();
1087
1086
  }), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
1088
1087
  r.value = n();
@@ -1094,21 +1093,21 @@ function Zn(e) {
1094
1093
  i(), a?.disconnect();
1095
1094
  }), r;
1096
1095
  }
1097
- function Qn(e) {
1096
+ function nr(e) {
1098
1097
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1099
1098
  }
1100
- function $n(e) {
1099
+ function rr(e) {
1101
1100
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1102
1101
  }
1103
- function er(e, t) {
1104
- return V(e, {
1102
+ function ir(e, t) {
1103
+ return B(e, {
1105
1104
  size: 18,
1106
1105
  strokeWidth: 1.8,
1107
1106
  "aria-hidden": "true"
1108
1107
  }, { default: () => t });
1109
1108
  }
1110
1109
  function X(e) {
1111
- return V("button", {
1110
+ return B("button", {
1112
1111
  type: "button",
1113
1112
  "aria-label": e.label,
1114
1113
  title: e.label,
@@ -1116,14 +1115,14 @@ function X(e) {
1116
1115
  "data-active": e.active ? "true" : "false",
1117
1116
  onMousedown: (e) => e.preventDefault(),
1118
1117
  onClick: e.onClick
1119
- }, [er(e.icon, e.label), V("span", {
1118
+ }, [ir(e.icon, e.label), B("span", {
1120
1119
  class: "markweave-image-tooltip",
1121
1120
  role: "tooltip"
1122
1121
  }, e.label)]);
1123
1122
  }
1124
- function tr(e) {
1125
- let t = H(null), n = e.messages.image;
1126
- return V("section", {
1123
+ function ar(e) {
1124
+ let t = V(null), n = e.messages.image;
1125
+ return B("section", {
1127
1126
  class: "markweave-image-upload-placeholder",
1128
1127
  "data-testid": "markweave-image-upload-placeholder",
1129
1128
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1141,7 +1140,7 @@ function tr(e) {
1141
1140
  n && e.onFile(n);
1142
1141
  }
1143
1142
  }, [
1144
- V("input", {
1143
+ B("input", {
1145
1144
  ref: t,
1146
1145
  "data-testid": "markweave-image-file-input",
1147
1146
  type: "file",
@@ -1152,20 +1151,20 @@ function tr(e) {
1152
1151
  r && e.onFile(r), n.value = "";
1153
1152
  }
1154
1153
  }),
1155
- V("div", {
1154
+ B("div", {
1156
1155
  class: "markweave-image-upload-icon",
1157
1156
  "aria-hidden": "true"
1158
- }, [V(Cn, {
1157
+ }, [B(Dn, {
1159
1158
  size: 46,
1160
1159
  strokeWidth: 1.6
1161
1160
  })]),
1162
- V("div", { class: "markweave-image-upload-copy" }, [V("button", {
1161
+ B("div", { class: "markweave-image-upload-copy" }, [B("button", {
1163
1162
  type: "button",
1164
1163
  onClick: () => t.value?.click()
1165
- }, n.clickToUpload), V("span", null, n.dragAndDrop)]),
1166
- V("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1167
- V("div", { class: "markweave-image-upload-row" }, [
1168
- V("input", {
1164
+ }, n.clickToUpload), B("span", null, n.dragAndDrop)]),
1165
+ B("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1166
+ B("div", { class: "markweave-image-upload-row" }, [
1167
+ B("input", {
1169
1168
  "data-testid": "markweave-image-url-input",
1170
1169
  value: e.inputValue,
1171
1170
  placeholder: n.uploadInputPlaceholder,
@@ -1175,30 +1174,30 @@ function tr(e) {
1175
1174
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1176
1175
  }
1177
1176
  }),
1178
- V("button", {
1177
+ B("button", {
1179
1178
  type: "button",
1180
1179
  "data-testid": "markweave-image-upload-submit",
1181
1180
  disabled: e.isSubmitting || !e.inputValue.trim(),
1182
1181
  onClick: e.onSubmit
1183
- }, [V(Cn, {
1182
+ }, [B(Dn, {
1184
1183
  size: 16,
1185
1184
  strokeWidth: 1.8
1186
1185
  }), e.messages.common.insert]),
1187
- V("button", {
1186
+ B("button", {
1188
1187
  type: "button",
1189
1188
  "data-testid": "markweave-image-upload-cancel",
1190
1189
  onClick: e.onCancel
1191
1190
  }, e.messages.common.cancel)
1192
1191
  ]),
1193
- e.error ? V("div", {
1192
+ e.error ? B("div", {
1194
1193
  class: "markweave-image-upload-error",
1195
1194
  role: "alert"
1196
1195
  }, e.error) : null
1197
1196
  ]);
1198
1197
  }
1199
- function nr(e) {
1200
- let t = H(null), n = e.messages.video;
1201
- return V("section", {
1198
+ function or(e) {
1199
+ let t = V(null), n = e.messages.video;
1200
+ return B("section", {
1202
1201
  class: "markweave-video-upload-placeholder",
1203
1202
  "data-testid": "markweave-video-upload-placeholder",
1204
1203
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1216,7 +1215,7 @@ function nr(e) {
1216
1215
  n && e.onFile(n);
1217
1216
  }
1218
1217
  }, [
1219
- V("input", {
1218
+ B("input", {
1220
1219
  ref: t,
1221
1220
  "data-testid": "markweave-video-file-input",
1222
1221
  type: "file",
@@ -1227,20 +1226,20 @@ function nr(e) {
1227
1226
  r && e.onFile(r), n.value = "";
1228
1227
  }
1229
1228
  }),
1230
- V("div", {
1229
+ B("div", {
1231
1230
  class: "markweave-video-upload-icon",
1232
1231
  "aria-hidden": "true"
1233
- }, [V(Yn, {
1232
+ }, [B($n, {
1234
1233
  size: 46,
1235
1234
  strokeWidth: 1.6
1236
1235
  })]),
1237
- V("div", { class: "markweave-video-upload-copy" }, [V("button", {
1236
+ B("div", { class: "markweave-video-upload-copy" }, [B("button", {
1238
1237
  type: "button",
1239
1238
  onClick: () => t.value?.click()
1240
- }, n.clickToUpload), V("span", null, n.dragAndDrop)]),
1241
- V("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1242
- V("div", { class: "markweave-video-upload-row" }, [
1243
- V("input", {
1239
+ }, n.clickToUpload), B("span", null, n.dragAndDrop)]),
1240
+ B("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1241
+ B("div", { class: "markweave-video-upload-row" }, [
1242
+ B("input", {
1244
1243
  "data-testid": "markweave-video-url-input",
1245
1244
  value: e.inputValue,
1246
1245
  placeholder: n.uploadInputPlaceholder,
@@ -1250,28 +1249,28 @@ function nr(e) {
1250
1249
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1251
1250
  }
1252
1251
  }),
1253
- V("button", {
1252
+ B("button", {
1254
1253
  type: "button",
1255
1254
  "data-testid": "markweave-video-upload-submit",
1256
1255
  disabled: e.isSubmitting || !e.inputValue.trim(),
1257
1256
  onClick: e.onSubmit
1258
- }, [V(Jn, {
1257
+ }, [B(Qn, {
1259
1258
  size: 16,
1260
1259
  strokeWidth: 1.8
1261
1260
  }), e.messages.common.insert]),
1262
- V("button", {
1261
+ B("button", {
1263
1262
  type: "button",
1264
1263
  "data-testid": "markweave-video-upload-cancel",
1265
1264
  onClick: e.onCancel
1266
1265
  }, e.messages.common.cancel)
1267
1266
  ]),
1268
- e.error ? V("div", {
1267
+ e.error ? B("div", {
1269
1268
  class: "markweave-video-upload-error",
1270
1269
  role: "alert"
1271
1270
  }, e.error) : null
1272
1271
  ]);
1273
1272
  }
1274
- var rr = J({
1273
+ var sr = J({
1275
1274
  name: "MarkweaveVueImageNodeView",
1276
1275
  props: {
1277
1276
  editor: {
@@ -1304,69 +1303,81 @@ var rr = J({
1304
1303
  }
1305
1304
  },
1306
1305
  setup(e) {
1307
- let t = H(null), n = H(!1), r = H(!1), a = H(!1), o = H(""), s = H(null), l = H(!1), u = W(() => e.node.attrs), d = H(!!O(u.value.caption)), f = H(O(u.value.caption) ?? ""), m = Zn(e.editor), h = W(() => c(m.value)), g = W(() => e.extension.options?.messages ?? p("zh")), v = W(() => g.value.image), y = W(() => O(u.value.src)), S = W(() => Xn(u.value.align)), w = W(() => D(u.value.width)), T = W(() => O(u.value.caption)), E = W(() => h.value && (!y.value || r.value));
1308
- G(T, (e) => {
1306
+ let t = V(null), n = V(!1), r = V(!1), a = V(!1), o = V(""), s = V(null), l = V(!1), u = U(() => e.node.attrs), d = V(!!k(u.value.caption)), f = V(k(u.value.caption) ?? ""), m = tr(e.editor), g = U(() => c(m.value)), _ = U(() => e.extension.options?.messages ?? p("zh")), y = U(() => _.value.image), b = U(() => k(u.value.src)), C = U(() => er(u.value.align)), T = U(() => O(u.value.width)), E = U(() => k(u.value.caption)), D = U(() => g.value && (!b.value || r.value)), j = () => {
1307
+ b.value && h({
1308
+ src: b.value,
1309
+ alt: k(u.value.alt) ?? "",
1310
+ messages: {
1311
+ dialogAriaLabel: y.value.previewDialogAriaLabel,
1312
+ zoomOut: y.value.previewZoomOut,
1313
+ zoomIn: y.value.previewZoomIn,
1314
+ reset: y.value.previewReset,
1315
+ close: y.value.previewClose
1316
+ }
1317
+ });
1318
+ };
1319
+ W(E, (e) => {
1309
1320
  d.value || (f.value = e ?? "");
1310
1321
  });
1311
- let A = () => {
1312
- if (!h.value) return;
1322
+ let N = () => {
1323
+ if (!g.value) return;
1313
1324
  let t = e.getPos();
1314
1325
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1315
- }, M = () => {
1316
- if (o.value = "", s.value = null, a.value = !1, y.value) {
1326
+ }, ee = () => {
1327
+ if (o.value = "", s.value = null, a.value = !1, b.value) {
1317
1328
  r.value = !1;
1318
1329
  return;
1319
1330
  }
1320
1331
  e.deleteNode();
1321
- }, N = async (t) => {
1322
- if (!h.value) return;
1332
+ }, te = async (t) => {
1333
+ if (!g.value) return;
1323
1334
  let n = e.extension.options;
1324
1335
  l.value = !0, s.value = null;
1325
1336
  try {
1326
- let i = await j(x(t, y.value && r.value ? "image-replace" : "image-insert"), n?.onUpload);
1327
- e.updateAttributes(_(u.value, i)), o.value = "", r.value = !1;
1337
+ let i = await M(S(t, b.value && r.value ? "image-replace" : "image-insert"), n?.onUpload);
1338
+ e.updateAttributes(v(u.value, i)), o.value = "", r.value = !1;
1328
1339
  } catch (e) {
1329
- s.value = e instanceof Error ? e.message : v.value.uploadFailedError;
1340
+ s.value = e instanceof Error ? e.message : y.value.uploadFailedError;
1330
1341
  } finally {
1331
1342
  l.value = !1, a.value = !1;
1332
1343
  }
1333
- }, ee = () => {
1344
+ }, P = () => {
1334
1345
  if (!o.value.trim()) {
1335
- s.value = v.value.uploadRequiredError;
1346
+ s.value = y.value.uploadRequiredError;
1336
1347
  return;
1337
1348
  }
1338
- N(k(o.value));
1339
- }, P = (e) => {
1340
- N({
1349
+ te(A(o.value));
1350
+ }, F = (e) => {
1351
+ te({
1341
1352
  type: "file",
1342
1353
  file: e,
1343
1354
  mimeType: e.type || "image/*"
1344
1355
  });
1345
- }, te = () => {
1346
- d.value = !d.value, d.value && (f.value = T.value ?? "");
1347
- }, F = (n, r) => {
1348
- if (!h.value || !y.value) return;
1349
- r.preventDefault(), r.stopPropagation(), A();
1356
+ }, I = () => {
1357
+ d.value = !d.value, d.value && (f.value = E.value ?? "");
1358
+ }, L = (n, r) => {
1359
+ if (!g.value || !b.value) return;
1360
+ r.preventDefault(), r.stopPropagation(), N();
1350
1361
  let i = t.value;
1351
1362
  if (!i) return;
1352
- let a = r.clientX, o = i.getBoundingClientRect().width || w.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1363
+ let a = r.clientX, o = i.getBoundingClientRect().width || T.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
1353
1364
  let r = n === "right" ? t.clientX - a : a - t.clientX;
1354
- e.updateAttributes({ width: b(o + r, s) });
1365
+ e.updateAttributes({ width: x(o + r, s) });
1355
1366
  }, l = () => {
1356
1367
  window.removeEventListener("pointermove", c), window.removeEventListener("pointerup", l);
1357
1368
  };
1358
1369
  window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
1359
1370
  };
1360
- return () => E.value ? V(i, {
1371
+ return () => D.value ? B(i, {
1361
1372
  as: "figure",
1362
1373
  class: "markweave-image-node",
1363
1374
  "data-testid": "markweave-image-node",
1364
- "data-align": S.value,
1375
+ "data-align": C.value,
1365
1376
  "data-selected": "false",
1366
1377
  "data-hovered": "false",
1367
1378
  "data-empty": "true"
1368
- }, () => tr({
1369
- messages: g.value,
1379
+ }, () => ar({
1380
+ messages: _.value,
1370
1381
  inputValue: o.value,
1371
1382
  error: s.value,
1372
1383
  dragActive: a.value,
@@ -1374,19 +1385,19 @@ var rr = J({
1374
1385
  onInputValue: (e) => {
1375
1386
  o.value = e;
1376
1387
  },
1377
- onFile: P,
1378
- onSubmit: ee,
1379
- onCancel: M,
1388
+ onFile: F,
1389
+ onSubmit: P,
1390
+ onCancel: ee,
1380
1391
  onDragActive: (e) => {
1381
1392
  a.value = e;
1382
1393
  }
1383
- })) : V(i, {
1394
+ })) : B(i, {
1384
1395
  as: "figure",
1385
1396
  class: "markweave-image-node",
1386
1397
  "data-testid": "markweave-image-node",
1387
- "data-align": S.value,
1388
- "data-selected": h.value && e.selected ? "true" : "false",
1389
- "data-hovered": h.value && n.value ? "true" : "false",
1398
+ "data-align": C.value,
1399
+ "data-selected": g.value && e.selected ? "true" : "false",
1400
+ "data-hovered": n.value ? "true" : "false",
1390
1401
  "data-empty": "false",
1391
1402
  onMouseenter: () => {
1392
1403
  n.value = !0;
@@ -1395,129 +1406,151 @@ var rr = J({
1395
1406
  n.value = !1;
1396
1407
  },
1397
1408
  onMousedown: (e) => {
1398
- h.value && !Qn(e.target) && A();
1409
+ g.value && !nr(e.target) && N();
1399
1410
  }
1400
1411
  }, () => [
1401
- h.value ? V("div", {
1412
+ g.value ? B("div", {
1402
1413
  class: "markweave-image-toolbar",
1403
1414
  "data-testid": "markweave-image-toolbar",
1404
1415
  "data-markweave-image-ui": "true",
1405
- "aria-label": v.value.toolsAriaLabel
1416
+ "aria-label": y.value.toolsAriaLabel
1406
1417
  }, [
1407
1418
  X({
1408
1419
  testId: "markweave-image-align-left",
1409
- label: v.value.alignLeft,
1410
- icon: an,
1411
- active: S.value === "left",
1420
+ label: y.value.alignLeft,
1421
+ icon: cn,
1422
+ active: C.value === "left",
1412
1423
  onClick: () => e.updateAttributes({ align: "left" })
1413
1424
  }),
1414
1425
  X({
1415
1426
  testId: "markweave-image-align-center",
1416
- label: v.value.alignCenter,
1417
- icon: nn,
1418
- active: S.value === "center",
1427
+ label: y.value.alignCenter,
1428
+ icon: on,
1429
+ active: C.value === "center",
1419
1430
  onClick: () => e.updateAttributes({ align: "center" })
1420
1431
  }),
1421
1432
  X({
1422
1433
  testId: "markweave-image-align-right",
1423
- label: v.value.alignRight,
1424
- icon: on,
1425
- active: S.value === "right",
1434
+ label: y.value.alignRight,
1435
+ icon: ln,
1436
+ active: C.value === "right",
1426
1437
  onClick: () => e.updateAttributes({ align: "right" })
1427
1438
  }),
1428
- V("span", {
1439
+ B("span", {
1429
1440
  class: "markweave-image-toolbar-divider",
1430
1441
  "aria-hidden": "true"
1431
1442
  }),
1432
1443
  X({
1433
1444
  testId: "markweave-image-caption",
1434
- label: v.value.caption,
1435
- icon: un,
1436
- active: d.value || !!T.value,
1437
- onClick: te
1445
+ label: y.value.caption,
1446
+ icon: pn,
1447
+ active: d.value || !!E.value,
1448
+ onClick: I
1449
+ }),
1450
+ X({
1451
+ testId: "markweave-image-preview",
1452
+ label: y.value.preview,
1453
+ icon: xn,
1454
+ onClick: j
1438
1455
  }),
1439
1456
  X({
1440
1457
  testId: "markweave-image-download",
1441
- label: v.value.download,
1442
- icon: _n,
1458
+ label: y.value.download,
1459
+ icon: bn,
1443
1460
  onClick: () => {
1444
- y.value && C(y.value);
1461
+ b.value && w(b.value);
1445
1462
  }
1446
1463
  }),
1447
1464
  X({
1448
1465
  testId: "markweave-image-replace",
1449
- label: v.value.replace,
1450
- icon: Ln,
1466
+ label: y.value.replace,
1467
+ icon: Vn,
1451
1468
  onClick: () => {
1452
1469
  o.value = "", s.value = null, r.value = !0;
1453
1470
  }
1454
1471
  }),
1455
- V("span", {
1472
+ B("span", {
1456
1473
  class: "markweave-image-toolbar-divider",
1457
1474
  "aria-hidden": "true"
1458
1475
  }),
1459
1476
  X({
1460
1477
  testId: "markweave-image-delete",
1461
- label: v.value.delete,
1462
- icon: Gn,
1478
+ label: y.value.delete,
1479
+ icon: Yn,
1463
1480
  onClick: () => e.deleteNode()
1464
1481
  })
1465
1482
  ]) : null,
1466
- V("div", {
1483
+ B("div", {
1467
1484
  ref: t,
1468
1485
  class: "markweave-image-box",
1469
- style: w.value ? { width: `${Math.round(w.value)}px` } : void 0
1486
+ style: T.value ? { width: `${Math.round(T.value)}px` } : void 0
1470
1487
  }, [
1471
- y.value ? V("img", {
1488
+ b.value ? B("img", {
1472
1489
  class: "markweave-image",
1473
- src: y.value,
1474
- alt: O(u.value.alt) ?? "",
1475
- title: O(u.value.title) ?? void 0,
1490
+ src: b.value,
1491
+ alt: k(u.value.alt) ?? "",
1492
+ title: k(u.value.title) ?? void 0,
1476
1493
  draggable: !1
1477
- }) : V("div", {
1494
+ }) : B("div", {
1478
1495
  class: "markweave-image-readonly-empty",
1479
1496
  "data-testid": "markweave-image-readonly-empty",
1480
1497
  "aria-hidden": "true"
1481
1498
  }),
1482
- h.value ? V("button", {
1499
+ !g.value && b.value ? B("button", {
1500
+ type: "button",
1501
+ class: "markweave-image-preview-trigger",
1502
+ "data-testid": "markweave-image-preview",
1503
+ "data-markweave-image-ui": "true",
1504
+ "aria-label": y.value.preview,
1505
+ title: y.value.preview,
1506
+ onMousedown: (e) => e.preventDefault(),
1507
+ onClick: j
1508
+ }, [B(xn, {
1509
+ size: 16,
1510
+ strokeWidth: 1.8
1511
+ }), B("span", {
1512
+ class: "markweave-image-tooltip",
1513
+ role: "tooltip"
1514
+ }, y.value.preview)]) : null,
1515
+ g.value ? B("button", {
1483
1516
  type: "button",
1484
1517
  class: "markweave-image-resize-handle",
1485
1518
  "data-testid": "markweave-image-resize-left",
1486
1519
  "data-side": "left",
1487
- "aria-label": v.value.resizeLeft,
1520
+ "aria-label": y.value.resizeLeft,
1488
1521
  "data-markweave-image-ui": "true",
1489
- onPointerdown: (e) => F("left", e)
1522
+ onPointerdown: (e) => L("left", e)
1490
1523
  }) : null,
1491
- h.value ? V("button", {
1524
+ g.value ? B("button", {
1492
1525
  type: "button",
1493
1526
  class: "markweave-image-resize-handle",
1494
1527
  "data-testid": "markweave-image-resize-right",
1495
1528
  "data-side": "right",
1496
- "aria-label": v.value.resizeRight,
1529
+ "aria-label": y.value.resizeRight,
1497
1530
  "data-markweave-image-ui": "true",
1498
- onPointerdown: (e) => F("right", e)
1531
+ onPointerdown: (e) => L("right", e)
1499
1532
  }) : null
1500
1533
  ]),
1501
- h.value && (d.value || T.value) ? V("input", {
1534
+ g.value && (d.value || E.value) ? B("input", {
1502
1535
  class: "markweave-image-caption-input",
1503
1536
  "data-testid": "markweave-image-caption-input",
1504
1537
  "data-markweave-image-ui": "true",
1505
1538
  value: f.value,
1506
- placeholder: v.value.captionPlaceholder,
1507
- "aria-label": v.value.captionAriaLabel,
1539
+ placeholder: y.value.captionPlaceholder,
1540
+ "aria-label": y.value.captionAriaLabel,
1508
1541
  onInput: (t) => {
1509
1542
  f.value = t.target.value, e.updateAttributes({ caption: f.value.trim() ? f.value : null });
1510
1543
  },
1511
1544
  onKeydown: (e) => {
1512
1545
  e.key === "Escape" && (e.preventDefault(), d.value = !1);
1513
1546
  }
1514
- }) : T.value ? V("figcaption", {
1547
+ }) : E.value ? B("figcaption", {
1515
1548
  class: "markweave-image-caption",
1516
1549
  "data-testid": "markweave-image-caption"
1517
- }, T.value) : null
1550
+ }, E.value) : null
1518
1551
  ]);
1519
1552
  }
1520
- }), ir = J({
1553
+ }), cr = J({
1521
1554
  name: "MarkweaveVueVideoNodeView",
1522
1555
  props: {
1523
1556
  editor: {
@@ -1550,48 +1583,48 @@ var rr = J({
1550
1583
  }
1551
1584
  },
1552
1585
  setup(e) {
1553
- let t = H(!1), n = H(""), r = H(null), a = H(!1), o = Zn(e.editor), s = W(() => c(o.value)), l = W(() => e.extension.options?.messages ?? p("zh")), u = W(() => l.value.video), d = W(() => e.node.attrs), f = W(() => O(d.value.src)), m = W(() => O(d.value.embedUrl)), h = W(() => O(d.value.provider)), g = W(() => m.value ? E(m.value, h.value) : null), _ = W(() => O(d.value.mimeType)), b = W(() => O(d.value.title)), x = () => {
1586
+ let t = V(!1), n = V(""), r = V(null), a = V(!1), o = tr(e.editor), s = U(() => c(o.value)), l = U(() => e.extension.options?.messages ?? p("zh")), u = U(() => l.value.video), d = U(() => e.node.attrs), f = U(() => k(d.value.src)), m = U(() => k(d.value.embedUrl)), h = U(() => k(d.value.provider)), g = U(() => m.value ? D(m.value, h.value) : null), _ = U(() => k(d.value.mimeType)), v = U(() => k(d.value.title)), x = () => {
1554
1587
  f.value || e.deleteNode(), n.value = "", r.value = null, t.value = !1;
1555
- }, C = async (i) => {
1588
+ }, S = async (i) => {
1556
1589
  if (!s.value) return;
1557
1590
  let o = e.extension.options;
1558
1591
  a.value = !0, r.value = null;
1559
1592
  try {
1560
- let t = await j(S(i), o?.onUpload);
1561
- e.updateAttributes(v(t)), n.value = "";
1593
+ let t = await M(C(i), o?.onUpload);
1594
+ e.updateAttributes(y(t)), n.value = "";
1562
1595
  } catch (e) {
1563
1596
  r.value = e instanceof Error ? e.message : u.value.uploadFailedError;
1564
1597
  } finally {
1565
1598
  a.value = !1, t.value = !1;
1566
1599
  }
1567
- }, T = () => {
1600
+ }, w = () => {
1568
1601
  if (!s.value) return;
1569
- let t = y(n.value);
1602
+ let t = b(n.value);
1570
1603
  if (!t) {
1571
1604
  r.value = u.value.unsupportedUrlError;
1572
1605
  return;
1573
1606
  }
1574
1607
  r.value = null, e.updateAttributes(t), n.value = "";
1575
- }, D = (e) => {
1576
- C({
1608
+ }, E = (e) => {
1609
+ S({
1577
1610
  type: "file",
1578
1611
  file: e,
1579
1612
  mimeType: e.type || "video/*"
1580
1613
  });
1581
- }, k = () => {
1614
+ }, O = () => {
1582
1615
  if (!s.value) return;
1583
1616
  let t = e.getPos();
1584
1617
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1585
1618
  }, A = (t) => {
1586
1619
  s.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
1587
1620
  };
1588
- return () => s.value && !f.value ? V(i, {
1621
+ return () => s.value && !f.value ? B(i, {
1589
1622
  as: "figure",
1590
1623
  class: "markweave-video-node",
1591
1624
  "data-testid": "markweave-video-node",
1592
1625
  "data-empty": "true",
1593
1626
  "data-selected": "false"
1594
- }, () => nr({
1627
+ }, () => or({
1595
1628
  messages: l.value,
1596
1629
  inputValue: n.value,
1597
1630
  error: r.value,
@@ -1600,13 +1633,13 @@ var rr = J({
1600
1633
  onInputValue: (e) => {
1601
1634
  n.value = e;
1602
1635
  },
1603
- onFile: D,
1604
- onSubmit: T,
1636
+ onFile: E,
1637
+ onSubmit: w,
1605
1638
  onCancel: x,
1606
1639
  onDragActive: (e) => {
1607
1640
  t.value = e;
1608
1641
  }
1609
- })) : V(i, {
1642
+ })) : B(i, {
1610
1643
  as: "figure",
1611
1644
  class: "markweave-video-node",
1612
1645
  "data-testid": "markweave-video-node",
@@ -1615,46 +1648,46 @@ var rr = J({
1615
1648
  "data-selected": s.value && e.selected ? "true" : "false",
1616
1649
  "aria-label": u.value.nodeAriaLabel,
1617
1650
  tabindex: s.value ? 0 : void 0,
1618
- onFocus: k,
1651
+ onFocus: O,
1619
1652
  onKeydown: A,
1620
1653
  onMousedown: (e) => {
1621
- s.value && !$n(e.target) && (e.preventDefault(), k());
1654
+ s.value && !rr(e.target) && (e.preventDefault(), O());
1622
1655
  }
1623
- }, () => [g.value ? V("div", { class: "markweave-video-embed" }, [V("iframe", {
1656
+ }, () => [g.value ? B("div", { class: "markweave-video-embed" }, [B("iframe", {
1624
1657
  class: "markweave-video-iframe",
1625
1658
  src: g.value,
1626
- title: b.value ?? `${h.value ?? "Video"} embed`,
1659
+ title: v.value ?? `${h.value ?? "Video"} embed`,
1627
1660
  "data-markweave-video-embed": "true",
1628
1661
  "data-markweave-video-provider": h.value ?? void 0,
1629
1662
  "data-markweave-video-src": f.value ?? void 0,
1630
- allow: w,
1663
+ allow: T,
1631
1664
  allowfullscreen: "true"
1632
- }), s.value ? V("button", {
1665
+ }), s.value ? B("button", {
1633
1666
  type: "button",
1634
1667
  class: "markweave-video-selection-layer",
1635
1668
  "data-testid": "markweave-video-selection-layer",
1636
1669
  tabindex: -1,
1637
1670
  "aria-label": u.value.selectAriaLabel
1638
- }) : null]) : f.value ? V("div", { class: "markweave-video-box" }, [V("video", {
1671
+ }) : null]) : f.value ? B("div", { class: "markweave-video-box" }, [B("video", {
1639
1672
  class: "markweave-video",
1640
1673
  src: f.value,
1641
- title: b.value ?? void 0,
1674
+ title: v.value ?? void 0,
1642
1675
  controls: !0,
1643
1676
  "data-markweave-video": "true",
1644
1677
  "data-markweave-mime-type": _.value ?? void 0
1645
- }), s.value ? V("button", {
1678
+ }), s.value ? B("button", {
1646
1679
  type: "button",
1647
1680
  class: "markweave-video-selection-layer",
1648
1681
  "data-testid": "markweave-video-selection-layer",
1649
1682
  tabindex: -1,
1650
1683
  "aria-label": u.value.selectAriaLabel
1651
- }) : null]) : V("div", {
1684
+ }) : null]) : B("div", {
1652
1685
  class: "markweave-video-readonly-empty",
1653
1686
  "data-testid": "markweave-video-readonly-empty",
1654
1687
  "aria-hidden": "true"
1655
1688
  })]);
1656
1689
  }
1657
- }), ar = h.extend({
1690
+ }), lr = g.extend({
1658
1691
  addOptions() {
1659
1692
  return {
1660
1693
  ...this.parent?.(),
@@ -1663,9 +1696,9 @@ var rr = J({
1663
1696
  };
1664
1697
  },
1665
1698
  addNodeView() {
1666
- return typeof document > "u" ? null : a(rr, { stopEvent: ({ event: e }) => Qn(e.target) });
1699
+ return typeof document > "u" ? null : a(sr, { stopEvent: ({ event: e }) => nr(e.target) });
1667
1700
  }
1668
- }), or = g.extend({
1701
+ }), ur = _.extend({
1669
1702
  addOptions() {
1670
1703
  return {
1671
1704
  ...this.parent?.(),
@@ -1674,17 +1707,17 @@ var rr = J({
1674
1707
  };
1675
1708
  },
1676
1709
  addNodeView() {
1677
- return typeof document > "u" ? null : a(ir, { stopEvent: ({ event: e }) => $n(e.target) });
1710
+ return typeof document > "u" ? null : a(cr, { stopEvent: ({ event: e }) => rr(e.target) });
1678
1711
  }
1679
1712
  });
1680
1713
  //#endregion
1681
1714
  //#region src/create-editor-extensions.ts
1682
- function sr(n = {}) {
1715
+ function dr(n = {}) {
1683
1716
  return e({
1684
1717
  lang: n.lang,
1685
1718
  mediaExtensions: t({
1686
- image: ar,
1687
- video: or,
1719
+ image: lr,
1720
+ video: ur,
1688
1721
  lang: n.lang,
1689
1722
  onImageUpload: n.onImageUpload,
1690
1723
  onVideoUpload: n.onVideoUpload
@@ -1693,7 +1726,7 @@ function sr(n = {}) {
1693
1726
  }
1694
1727
  //#endregion
1695
1728
  //#region src/MarkweaveEditor.ts
1696
- var cr = {
1729
+ var fr = {
1697
1730
  active: !1,
1698
1731
  mode: "outside",
1699
1732
  activeCellPos: null,
@@ -1701,17 +1734,17 @@ var cr = {
1701
1734
  selectedCellCount: 0,
1702
1735
  selectionFrom: 0,
1703
1736
  selectionTo: 0
1704
- }, lr = {
1737
+ }, pr = {
1705
1738
  active: !1,
1706
- language: ve.defaultLanguage,
1739
+ language: Se.defaultLanguage,
1707
1740
  mermaidPreviewMode: "code",
1708
1741
  pos: null,
1709
1742
  text: ""
1710
1743
  };
1711
- function ur(e) {
1712
- return St.getState(e.state) ?? xt;
1744
+ function mr(e) {
1745
+ return Et.getState(e.state) ?? Tt;
1713
1746
  }
1714
- function dr(e) {
1747
+ function hr(e) {
1715
1748
  if (!e || typeof window > "u") return null;
1716
1749
  let t = e.parentElement;
1717
1750
  for (; t;) {
@@ -1722,133 +1755,133 @@ function dr(e) {
1722
1755
  return null;
1723
1756
  }
1724
1757
  function Z(e, t, n = 18, r = 1.8) {
1725
- return V(e, {
1758
+ return B(e, {
1726
1759
  size: n,
1727
1760
  strokeWidth: r,
1728
1761
  "aria-hidden": "true"
1729
1762
  }, { default: () => t });
1730
1763
  }
1731
- function fr(e) {
1732
- return e === "clipboard" ? [V("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" }), V("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" ? [V("circle", {
1764
+ function gr(e) {
1765
+ 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", {
1733
1766
  cx: "10",
1734
1767
  cy: "10",
1735
1768
  r: "5.5"
1736
- }), V("path", { d: "m14 14 4 4" })] : e === "check" ? [V("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
1737
- V("path", { d: "M8 4H4v4" }),
1738
- V("path", { d: "M4 4l5 5" }),
1739
- V("path", { d: "M16 4h4v4" }),
1740
- V("path", { d: "m20 4-5 5" }),
1741
- V("path", { d: "M8 20H4v-4" }),
1742
- V("path", { d: "m4 20 5-5" }),
1743
- V("path", { d: "M16 20h4v-4" }),
1744
- V("path", { d: "m20 20-5-5" })
1769
+ }), B("path", { d: "m14 14 4 4" })] : e === "check" ? [B("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
1770
+ B("path", { d: "M8 4H4v4" }),
1771
+ B("path", { d: "M4 4l5 5" }),
1772
+ B("path", { d: "M16 4h4v4" }),
1773
+ B("path", { d: "m20 4-5 5" }),
1774
+ B("path", { d: "M8 20H4v-4" }),
1775
+ B("path", { d: "m4 20 5-5" }),
1776
+ B("path", { d: "M16 20h4v-4" }),
1777
+ B("path", { d: "m20 20-5-5" })
1745
1778
  ] : e === "download" ? [
1746
- V("path", { d: "M12 4v10" }),
1747
- V("path", { d: "m8 10 4 4 4-4" }),
1748
- V("path", { d: "M5 19h14" })
1749
- ] : e === "close" ? [V("path", { d: "M6 6l12 12" }), V("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
1750
- V("circle", {
1779
+ B("path", { d: "M12 4v10" }),
1780
+ B("path", { d: "m8 10 4 4 4-4" }),
1781
+ B("path", { d: "M5 19h14" })
1782
+ ] : e === "close" ? [B("path", { d: "M6 6l12 12" }), B("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
1783
+ B("circle", {
1751
1784
  cx: "10",
1752
1785
  cy: "10",
1753
1786
  r: "5.25"
1754
1787
  }),
1755
- V("path", { d: "M7.5 10h5" }),
1756
- V("path", { d: "m14 14 4 4" })
1788
+ B("path", { d: "M7.5 10h5" }),
1789
+ B("path", { d: "m14 14 4 4" })
1757
1790
  ] : e === "zoomIn" ? [
1758
- V("circle", {
1791
+ B("circle", {
1759
1792
  cx: "10",
1760
1793
  cy: "10",
1761
1794
  r: "5.25"
1762
1795
  }),
1763
- V("path", { d: "M7.5 10h5" }),
1764
- V("path", { d: "M10 7.5v5" }),
1765
- V("path", { d: "m14 14 4 4" })
1766
- ] : e === "reset" ? [V("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), V("path", { d: "M6.5 8.5H3.5v-3" })] : [V("path", { d: "m6 9 6 6 6-6" })];
1796
+ B("path", { d: "M7.5 10h5" }),
1797
+ B("path", { d: "M10 7.5v5" }),
1798
+ B("path", { d: "m14 14 4 4" })
1799
+ ] : 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" })];
1767
1800
  }
1768
1801
  function Q(e) {
1769
- return V("svg", {
1802
+ return B("svg", {
1770
1803
  viewBox: "0 0 24 24",
1771
1804
  "aria-hidden": "true",
1772
1805
  focusable: "false"
1773
- }, V("g", {
1806
+ }, B("g", {
1774
1807
  fill: "none",
1775
1808
  stroke: "currentColor",
1776
1809
  "stroke-linecap": "round",
1777
1810
  "stroke-linejoin": "round",
1778
1811
  "stroke-width": "1.8"
1779
- }, fr(e)));
1812
+ }, gr(e)));
1780
1813
  }
1781
1814
  function $(e) {
1782
1815
  e.preventDefault();
1783
1816
  }
1784
- function pr(e) {
1785
- let t = We(e);
1817
+ function _r(e) {
1818
+ let t = Je(e);
1786
1819
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
1787
1820
  }
1788
- var mr = {
1789
- bold: cn,
1790
- italic: Dn,
1791
- underline: qn,
1792
- strike: Bn,
1793
- "inline-code": hn,
1794
- link: kn,
1795
- more: Pn,
1796
- superscript: Hn,
1797
- subscript: Vn,
1798
- "inline-math": Rn,
1799
- "align-left": an,
1800
- "align-center": nn,
1801
- "align-right": on,
1802
- "align-justify": rn,
1803
- "decrease-indent": wn,
1804
- "increase-indent": Tn
1805
- }, hr = {
1806
- type: Wn,
1807
- "heading-1": yn,
1808
- "heading-2": bn,
1809
- "heading-3": xn,
1810
- "bullet-list": An,
1811
- "ordered-list": Mn,
1812
- "task-list": jn,
1813
- blockquote: In,
1814
- "code-block": ln,
1815
- info: En,
1816
- tip: On,
1817
- warning: sn,
1818
- error: mn,
1819
- success: dn,
1820
- emoji: zn,
1821
- math: Rn,
1822
- table: Un,
1823
- separator: Nn,
1824
- image: Sn,
1825
- video: Yn,
1826
- attachment: Fn
1821
+ var vr = {
1822
+ bold: dn,
1823
+ italic: jn,
1824
+ underline: Zn,
1825
+ strike: Wn,
1826
+ "inline-code": vn,
1827
+ link: Nn,
1828
+ more: Rn,
1829
+ superscript: Kn,
1830
+ subscript: Gn,
1831
+ "inline-math": Hn,
1832
+ "align-left": cn,
1833
+ "align-center": on,
1834
+ "align-right": ln,
1835
+ "align-justify": sn,
1836
+ "decrease-indent": On,
1837
+ "increase-indent": kn
1838
+ }, yr = {
1839
+ type: Jn,
1840
+ "heading-1": Cn,
1841
+ "heading-2": wn,
1842
+ "heading-3": Tn,
1843
+ "bullet-list": Pn,
1844
+ "ordered-list": In,
1845
+ "task-list": Fn,
1846
+ blockquote: Bn,
1847
+ "code-block": fn,
1848
+ info: An,
1849
+ tip: Mn,
1850
+ warning: un,
1851
+ error: _n,
1852
+ success: mn,
1853
+ emoji: Un,
1854
+ math: Hn,
1855
+ table: qn,
1856
+ separator: Ln,
1857
+ image: En,
1858
+ video: $n,
1859
+ attachment: zn
1827
1860
  };
1828
- function gr(e) {
1829
- let t = hr[e];
1830
- return V(t, {
1861
+ function br(e) {
1862
+ let t = yr[e];
1863
+ return B(t, {
1831
1864
  size: 18,
1832
1865
  strokeWidth: 1.6,
1833
1866
  absoluteStrokeWidth: !0,
1834
1867
  "aria-hidden": "true"
1835
1868
  });
1836
1869
  }
1837
- var _r = {
1838
- paragraph: Kn,
1839
- "heading-1": yn,
1840
- "heading-2": bn,
1841
- "heading-3": xn,
1842
- "bullet-list": An,
1843
- "numbered-list": Mn,
1844
- "todo-list": jn,
1845
- quote: In,
1846
- "code-block": ln
1870
+ var xr = {
1871
+ paragraph: Xn,
1872
+ "heading-1": Cn,
1873
+ "heading-2": wn,
1874
+ "heading-3": Tn,
1875
+ "bullet-list": Pn,
1876
+ "numbered-list": In,
1877
+ "todo-list": Fn,
1878
+ quote: Bn,
1879
+ "code-block": fn
1847
1880
  };
1848
- function vr(e, t) {
1849
- return I(e, t).label;
1881
+ function Sr(e, t) {
1882
+ return L(e, t).label;
1850
1883
  }
1851
- var yr = J({
1884
+ var Cr = J({
1852
1885
  name: "MarkweaveVueFloatingToolbar",
1853
1886
  props: {
1854
1887
  editor: {
@@ -1865,19 +1898,19 @@ var yr = J({
1865
1898
  }
1866
1899
  },
1867
1900
  setup(e) {
1868
- let t = H(null), n = H(""), r = H(null), i = H(null), a = H(null), o = W(() => We(n.value.trim())), s = W(() => e.messages.floatingToolbar), c = W(() => re(e.messages).map((e) => [
1901
+ let t = V(null), n = V(""), r = V(null), i = V(null), a = V(null), o = U(() => Je(n.value.trim())), s = U(() => e.messages.floatingToolbar), c = U(() => z(e.messages).map((e) => [
1869
1902
  e.id,
1870
1903
  e.label,
1871
- _r[e.id]
1872
- ])), l = W(() => ne(e.messages).map((e) => [
1904
+ xr[e.id]
1905
+ ])), l = U(() => re(e.messages).map((e) => [
1873
1906
  e.id,
1874
1907
  e.value,
1875
1908
  e.label
1876
- ])), u = W(() => L(e.messages).map((e) => [
1909
+ ])), u = U(() => R(e.messages).map((e) => [
1877
1910
  e.id,
1878
1911
  e.value,
1879
1912
  e.label
1880
- ])), d = W(() => R(e.messages).map((e) => e.id)), f = () => {
1913
+ ])), d = U(() => ne(e.messages).map((e) => e.id)), f = () => {
1881
1914
  o.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: o.value }).run(), t.value = null);
1882
1915
  }, p = () => {
1883
1916
  e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), n.value = "", t.value = null;
@@ -1894,7 +1927,7 @@ var yr = J({
1894
1927
  let e = r.value;
1895
1928
  if (!e || t.value !== null) return null;
1896
1929
  let n = s.value.buttons[e];
1897
- return n ? V("div", {
1930
+ return n ? B("div", {
1898
1931
  class: "markweave-floating-toolbar-tooltip",
1899
1932
  role: "tooltip",
1900
1933
  "data-testid": "markweave-floating-toolbar-tooltip",
@@ -1902,7 +1935,7 @@ var yr = J({
1902
1935
  "data-active": h(e),
1903
1936
  style: i.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${i.value}px` }
1904
1937
  }, n) : null;
1905
- }, v = (n, i, a, o, s = !1, c) => V("button", {
1938
+ }, v = (n, i, a, o, s = !1, c) => B("button", {
1906
1939
  type: "button",
1907
1940
  class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
1908
1941
  "aria-label": i,
@@ -1921,13 +1954,13 @@ var yr = J({
1921
1954
  onMouseenter: (e) => g(n, e.currentTarget),
1922
1955
  onMouseleave: () => g(null),
1923
1956
  onClick: o
1924
- }, n === "block-type" ? [V("span", { class: "markweave-floating-toolbar-button-inner" }, [V("span", { class: "markweave-floating-toolbar-block-label" }, vr(e.editor, e.messages)), Z(t.value === "block-type" ? pn : fn, i)])] : n === "color" ? [V("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [V("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? pn : fn, i)])] : [Z(a, i)]), y = () => V("span", {
1957
+ }, n === "block-type" ? [B("span", { class: "markweave-floating-toolbar-button-inner" }, [B("span", { class: "markweave-floating-toolbar-block-label" }, Sr(e.editor, e.messages)), Z(t.value === "block-type" ? gn : hn, 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" ? gn : hn, i)])] : [Z(a, i)]), y = () => B("span", {
1925
1958
  class: "markweave-floating-toolbar-divider",
1926
1959
  "aria-hidden": "true"
1927
- }), b = (n, r, i) => V("section", {
1960
+ }), b = (n, r, i) => B("section", {
1928
1961
  class: "markweave-floating-toolbar-color-section",
1929
1962
  "aria-label": n
1930
- }, [V("div", { class: "markweave-floating-toolbar-menu-title" }, n), V("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => V("button", {
1963
+ }, [B("div", { class: "markweave-floating-toolbar-menu-title" }, n), B("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => B("button", {
1931
1964
  key: `${r}-${n}`,
1932
1965
  type: "button",
1933
1966
  "aria-label": a,
@@ -1936,31 +1969,31 @@ var yr = J({
1936
1969
  onClick: () => {
1937
1970
  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;
1938
1971
  }
1939
- }, r === "text" ? [V("span", {
1972
+ }, r === "text" ? [B("span", {
1940
1973
  class: "markweave-floating-toolbar-text-swatch",
1941
1974
  style: { color: i ?? "#646970" }
1942
- }, "A")] : [V("span", {
1975
+ }, "A")] : [B("span", {
1943
1976
  class: "markweave-floating-toolbar-highlight-swatch",
1944
1977
  style: { backgroundColor: i ?? "#ffffff" },
1945
1978
  "aria-hidden": "true"
1946
- })])))]), x = () => t.value === "block-type" ? V("div", {
1979
+ })])))]), x = () => t.value === "block-type" ? B("div", {
1947
1980
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
1948
1981
  "data-testid": "markweave-floating-toolbar-turn-menu"
1949
- }, [V("div", { class: "markweave-floating-toolbar-menu-title" }, s.value.turnIntoTitle), ...c.value.map(([n, r, i]) => V("button", {
1982
+ }, [B("div", { class: "markweave-floating-toolbar-menu-title" }, s.value.turnIntoTitle), ...c.value.map(([n, r, i]) => B("button", {
1950
1983
  key: n,
1951
1984
  type: "button",
1952
1985
  "data-testid": `markweave-floating-toolbar-turn-${n}`,
1953
1986
  onMousedown: $,
1954
1987
  onClick: () => {
1955
- ie(e.editor, n), t.value = null;
1988
+ ae(e.editor, n), t.value = null;
1956
1989
  }
1957
- }, [V("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), V("span", null, r)]))]) : t.value === "link" ? V("form", {
1990
+ }, [B("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), B("span", null, r)]))]) : t.value === "link" ? B("form", {
1958
1991
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
1959
1992
  "data-testid": "markweave-floating-toolbar-link-popover",
1960
1993
  onSubmit: (e) => {
1961
1994
  e.preventDefault(), f();
1962
1995
  }
1963
- }, [V("input", {
1996
+ }, [B("input", {
1964
1997
  value: n.value,
1965
1998
  placeholder: s.value.linkPlaceholder,
1966
1999
  "aria-label": s.value.linkUrlLabel,
@@ -1968,43 +2001,43 @@ var yr = J({
1968
2001
  onInput: (e) => {
1969
2002
  n.value = e.target.value;
1970
2003
  }
1971
- }), V("span", { class: "markweave-floating-toolbar-link-actions" }, [
1972
- V("button", {
2004
+ }), B("span", { class: "markweave-floating-toolbar-link-actions" }, [
2005
+ B("button", {
1973
2006
  type: "submit",
1974
2007
  disabled: !o.value,
1975
2008
  "aria-label": s.value.applyLink,
1976
2009
  "data-testid": "markweave-floating-toolbar-link-apply",
1977
2010
  onMousedown: $
1978
- }, [Z(gn, s.value.applyLink)]),
1979
- V("span", {
2011
+ }, [Z(yn, s.value.applyLink)]),
2012
+ B("span", {
1980
2013
  class: "markweave-floating-toolbar-link-divider",
1981
2014
  "aria-hidden": "true"
1982
2015
  }),
1983
- V("button", {
2016
+ B("button", {
1984
2017
  type: "button",
1985
2018
  disabled: !o.value,
1986
2019
  "aria-label": s.value.openLink,
1987
2020
  "data-testid": "markweave-floating-toolbar-link-open",
1988
2021
  onMousedown: $,
1989
- onClick: () => pr(n.value)
1990
- }, [Z(vn, s.value.openLink)]),
1991
- V("button", {
2022
+ onClick: () => _r(n.value)
2023
+ }, [Z(Sn, s.value.openLink)]),
2024
+ B("button", {
1992
2025
  type: "button",
1993
2026
  "aria-label": s.value.removeLink,
1994
2027
  "data-testid": "markweave-floating-toolbar-link-remove",
1995
2028
  onMousedown: $,
1996
2029
  onClick: p
1997
- }, [Z(Gn, s.value.removeLink)])
1998
- ])]) : t.value === "color" ? V("div", {
2030
+ }, [Z(Yn, s.value.removeLink)])
2031
+ ])]) : t.value === "color" ? B("div", {
1999
2032
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
2000
2033
  "data-testid": "markweave-floating-toolbar-color-menu"
2001
- }, [b(s.value.textColorTitle, "text", l.value), b(s.value.highlightColorTitle, "highlight", u.value)]) : t.value === "more" ? V("div", {
2034
+ }, [b(s.value.textColorTitle, "text", l.value), b(s.value.highlightColorTitle, "highlight", u.value)]) : t.value === "more" ? B("div", {
2002
2035
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
2003
2036
  "data-testid": "markweave-floating-toolbar-more-menu"
2004
- }, d.value.map((n) => V("span", {
2037
+ }, d.value.map((n) => B("span", {
2005
2038
  key: n,
2006
2039
  class: "markweave-floating-toolbar-more-item"
2007
- }, [V("button", {
2040
+ }, [B("button", {
2008
2041
  type: "button",
2009
2042
  "aria-label": s.value.moreActions[n],
2010
2043
  "data-testid": `markweave-floating-toolbar-more-${n}`,
@@ -2017,41 +2050,41 @@ var yr = J({
2017
2050
  r.value = null;
2018
2051
  },
2019
2052
  onClick: () => {
2020
- z(e.editor, n), t.value = null;
2053
+ ie(e.editor, n), t.value = null;
2021
2054
  }
2022
- }, [Z(mr[n], s.value.moreActions[n])]), r.value === n ? V("div", {
2055
+ }, [Z(vr[n], s.value.moreActions[n])]), r.value === n ? B("div", {
2023
2056
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
2024
2057
  role: "tooltip"
2025
2058
  }, s.value.moreActions[n]) : null]))) : null;
2026
- return () => V(M, {
2059
+ return () => B(N, {
2027
2060
  editor: e.editor,
2028
- shouldShow: ({ editor: e }) => e.isEditable && se(B(e)),
2061
+ shouldShow: ({ editor: e }) => e.isEditable && le(ce(e)),
2029
2062
  options: { placement: "top" }
2030
- }, { default: () => V("div", {
2063
+ }, { default: () => B("div", {
2031
2064
  class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
2032
2065
  "data-testid": "markweave-floating-toolbar"
2033
- }, [V("div", {
2066
+ }, [B("div", {
2034
2067
  ref: a,
2035
2068
  class: "markweave-floating-toolbar-content",
2036
2069
  "data-menu": t.value ?? "none"
2037
2070
  }, [
2038
- v("block-type", s.value.buttons["block-type"], Kn, () => m("block-type"), t.value === "block-type"),
2071
+ v("block-type", s.value.buttons["block-type"], Xn, () => m("block-type"), t.value === "block-type"),
2039
2072
  y(),
2040
- v("bold", s.value.buttons.bold, cn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2041
- v("italic", s.value.buttons.italic, Dn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2042
- v("underline", s.value.buttons.underline, qn, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2043
- v("strike", s.value.buttons.strike, Bn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2044
- v("inline-code", s.value.buttons["inline-code"], hn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2073
+ v("bold", s.value.buttons.bold, dn, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2074
+ v("italic", s.value.buttons.italic, jn, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2075
+ v("underline", s.value.buttons.underline, Zn, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2076
+ v("strike", s.value.buttons.strike, Wn, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2077
+ v("inline-code", s.value.buttons["inline-code"], vn, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2045
2078
  y(),
2046
- v("link", s.value.buttons.link, kn, () => m("link"), e.editor.isActive("link")),
2047
- v("color", s.value.buttons.color, Kn, () => m("color"), t.value === "color"),
2079
+ v("link", s.value.buttons.link, Nn, () => m("link"), e.editor.isActive("link")),
2080
+ v("color", s.value.buttons.color, Xn, () => m("color"), t.value === "color"),
2048
2081
  y(),
2049
- v("more", s.value.buttons.more, Pn, () => m("more"), t.value === "more"),
2082
+ v("more", s.value.buttons.more, Rn, () => m("more"), t.value === "more"),
2050
2083
  x(),
2051
2084
  _()
2052
2085
  ])]) });
2053
2086
  }
2054
- }), br = J({
2087
+ }), wr = J({
2055
2088
  name: "MarkweaveVueMathEditorPopover",
2056
2089
  props: {
2057
2090
  editor: {
@@ -2072,17 +2105,17 @@ var yr = J({
2072
2105
  }
2073
2106
  },
2074
2107
  setup(e) {
2075
- let t = H(e.target.latex), n = U(null), r = H(null), i = H(null), a = U(Ye(e.editor, e.target)), o = W(() => t.value === e.target.latex && a.value ? {
2108
+ let t = V(e.target.latex), n = H(null), r = V(null), i = V(null), a = H($e(e.editor, e.target)), o = U(() => t.value === e.target.latex && a.value ? {
2076
2109
  html: a.value,
2077
2110
  error: !1
2078
- } : $e(t.value, e.target.kind, e.editor)), s = W(() => t.value.trim().length > 0), c = W(() => e.messages.math), l = W(() => Je(e.editor, e.target) ?? 1), u = () => {
2111
+ } : rt(t.value, e.target.kind, e.editor)), s = U(() => t.value.trim().length > 0), c = U(() => e.messages.math), l = U(() => Qe(e.editor, e.target) ?? 1), u = () => {
2079
2112
  if (typeof window > "u") return;
2080
- let r = qe(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2113
+ let r = Ze(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
2081
2114
  if (!r || !i) {
2082
2115
  e.onClose();
2083
2116
  return;
2084
2117
  }
2085
- n.value = Ke({
2118
+ n.value = Xe({
2086
2119
  anchorRect: r,
2087
2120
  frameRect: i,
2088
2121
  kind: e.target.kind,
@@ -2091,7 +2124,7 @@ var yr = J({
2091
2124
  viewportWidth: window.innerWidth
2092
2125
  });
2093
2126
  }, d = () => {
2094
- s.value && Ge(e.editor, e.target, t.value) && e.onClose();
2127
+ s.value && Ye(e.editor, e.target, t.value) && e.onClose();
2095
2128
  }, f = (t) => {
2096
2129
  if (t.key === "Escape") {
2097
2130
  t.preventDefault(), e.onClose(), e.editor.commands.focus();
@@ -2102,14 +2135,14 @@ var yr = J({
2102
2135
  let n = t.target;
2103
2136
  n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
2104
2137
  };
2105
- return G(() => [e.target.pos, e.target.latex], () => {
2106
- t.value = e.target.latex, a.value = Ye(e.editor, e.target), q(u);
2107
- }), $t(() => {
2108
- et(e.editor, e.target, !0), u(), q(() => {
2138
+ return W(() => [e.target.pos, e.target.latex], () => {
2139
+ t.value = e.target.latex, a.value = $e(e.editor, e.target), q(u);
2140
+ }), G(() => {
2141
+ it(e.editor, e.target, !0), u(), q(() => {
2109
2142
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
2110
2143
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
2111
2144
  }), K(() => {
2112
- et(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2145
+ it(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
2113
2146
  }), () => {
2114
2147
  let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
2115
2148
  ref: i,
@@ -2122,7 +2155,7 @@ var yr = J({
2122
2155
  },
2123
2156
  onKeydown: f
2124
2157
  };
2125
- return e.target.kind === "inline" ? V("form", {
2158
+ return e.target.kind === "inline" ? B("form", {
2126
2159
  ref: r,
2127
2160
  class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
2128
2161
  "aria-label": a,
@@ -2137,22 +2170,22 @@ var yr = J({
2137
2170
  onSubmit: (e) => {
2138
2171
  e.preventDefault(), d();
2139
2172
  }
2140
- }, [V("label", {
2173
+ }, [B("label", {
2141
2174
  class: "markweave-math-inline-source",
2142
2175
  "data-testid": "markweave-math-inline-source"
2143
2176
  }, [
2144
- V("span", { attrs: { "aria-hidden": "true" } }, "$"),
2145
- V("input", {
2177
+ B("span", { attrs: { "aria-hidden": "true" } }, "$"),
2178
+ B("input", {
2146
2179
  ...u,
2147
2180
  "aria-label": c.value.latexLabel,
2148
2181
  size: Math.max(t.value.length, 1)
2149
2182
  }),
2150
- V("span", { attrs: { "aria-hidden": "true" } }, "$")
2151
- ]), V("div", {
2183
+ B("span", { attrs: { "aria-hidden": "true" } }, "$")
2184
+ ]), B("div", {
2152
2185
  class: "markweave-math-inline-preview",
2153
2186
  "data-error": o.value.error ? "true" : "false",
2154
2187
  "data-testid": "markweave-math-editor-preview"
2155
- }, [V("div", { innerHTML: o.value.html || " " }), o.value.error ? V("small", null, c.value.invalidPreview) : null])]) : V("form", {
2188
+ }, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])]) : B("form", {
2156
2189
  ref: r,
2157
2190
  class: "markweave-math-editor-popover markweave-math-editor-popover--block",
2158
2191
  "aria-label": a,
@@ -2168,39 +2201,39 @@ var yr = J({
2168
2201
  e.preventDefault(), d();
2169
2202
  }
2170
2203
  }, [
2171
- V("div", { class: "markweave-math-block-toolbar" }, [
2172
- V("span", null, c.value.label),
2173
- Z(hn, c.value.label, 15, 1.75),
2174
- V("button", {
2204
+ B("div", { class: "markweave-math-block-toolbar" }, [
2205
+ B("span", null, c.value.label),
2206
+ Z(vn, c.value.label, 15, 1.75),
2207
+ B("button", {
2175
2208
  type: "submit",
2176
2209
  title: c.value.apply,
2177
2210
  "aria-label": c.value.apply,
2178
2211
  disabled: !s.value,
2179
2212
  "data-testid": "markweave-math-editor-apply"
2180
- }, [Z(dn, c.value.apply, 16, 2)])
2213
+ }, [Z(mn, c.value.apply, 16, 2)])
2181
2214
  ]),
2182
- V("label", {
2215
+ B("label", {
2183
2216
  class: "markweave-math-block-source",
2184
2217
  "data-testid": "markweave-math-block-source"
2185
2218
  }, [
2186
- V("span", { attrs: { "aria-hidden": "true" } }, "$$"),
2187
- V("textarea", {
2219
+ B("span", { attrs: { "aria-hidden": "true" } }, "$$"),
2220
+ B("textarea", {
2188
2221
  ...u,
2189
2222
  "aria-label": c.value.latexLabel,
2190
2223
  rows: 3
2191
2224
  }),
2192
- V("span", { attrs: { "aria-hidden": "true" } }, "$$")
2225
+ B("span", { attrs: { "aria-hidden": "true" } }, "$$")
2193
2226
  ]),
2194
- V("div", {
2227
+ B("div", {
2195
2228
  class: "markweave-math-block-preview",
2196
2229
  "data-error": o.value.error ? "true" : "false",
2197
2230
  "data-math-number": String(l.value),
2198
2231
  "data-testid": "markweave-math-editor-preview"
2199
- }, [V("div", { innerHTML: o.value.html || " " }), o.value.error ? V("small", null, c.value.invalidPreview) : null])
2232
+ }, [B("div", { innerHTML: o.value.html || " " }), o.value.error ? B("small", null, c.value.invalidPreview) : null])
2200
2233
  ]);
2201
2234
  };
2202
2235
  }
2203
- }), xr = J({
2236
+ }), Tr = J({
2204
2237
  name: "MarkweaveVueSlashCommandMenu",
2205
2238
  props: {
2206
2239
  commands: {
@@ -2237,7 +2270,7 @@ var yr = J({
2237
2270
  }
2238
2271
  },
2239
2272
  setup(e) {
2240
- let t = H(""), n = H(null), r = H(null), i = H(!1), a = H(""), o = H(0), s = W(() => {
2273
+ let t = V(""), n = V(null), r = V(null), i = V(!1), a = V(""), o = V(0), s = U(() => {
2241
2274
  let t = a.value.trim().toLowerCase();
2242
2275
  return (t ? e.messages.slash.emojiItems.filter((e) => [
2243
2276
  e.emoji,
@@ -2259,13 +2292,13 @@ var yr = J({
2259
2292
  } : {
2260
2293
  kind: e.inputCommand.uploadKind ?? "attachment",
2261
2294
  trigger: "slash-command",
2262
- source: k(t.value)
2295
+ source: A(t.value)
2263
2296
  };
2264
2297
  if (!n.value && !t.value.trim()) {
2265
2298
  r.value = e.messages.slash.uploadRequiredError;
2266
2299
  return;
2267
2300
  }
2268
- let a = await j(i, e.onUpload);
2301
+ let a = await M(i, e.onUpload);
2269
2302
  e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
2270
2303
  } catch (t) {
2271
2304
  r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
@@ -2292,32 +2325,32 @@ var yr = J({
2292
2325
  group: t,
2293
2326
  commands: e.commands.filter((e) => e.group === t)
2294
2327
  })).filter((e) => e.commands.length);
2295
- return V("div", {
2328
+ return B("div", {
2296
2329
  class: "markweave-slash-layer",
2297
2330
  style: { display: "contents" },
2298
2331
  "data-testid": "markweave-slash-layer"
2299
- }, [V("div", {
2332
+ }, [B("div", {
2300
2333
  class: "markweave-slash-trigger",
2301
2334
  style: d,
2302
2335
  "aria-hidden": "true",
2303
2336
  "data-testid": "markweave-slash-trigger"
2304
- }, [V("span", null, "/"), V("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), V("div", {
2337
+ }, [B("span", null, "/"), B("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), B("div", {
2305
2338
  class: "markweave-slash-menu",
2306
2339
  style: u,
2307
2340
  role: "listbox",
2308
2341
  "aria-label": e.messages.slash.ariaLabel,
2309
2342
  "data-placement": e.position.placement,
2310
2343
  "data-testid": "markweave-slash-menu"
2311
- }, [e.inputCommand?.inputKind === "emoji" ? V("div", {
2344
+ }, [e.inputCommand?.inputKind === "emoji" ? B("div", {
2312
2345
  class: "markweave-slash-subpanel",
2313
2346
  "data-testid": "markweave-slash-emoji-picker"
2314
2347
  }, [
2315
- V("div", { class: "markweave-slash-subpanel-header" }, [V("button", {
2348
+ B("div", { class: "markweave-slash-subpanel-header" }, [B("button", {
2316
2349
  type: "button",
2317
2350
  onMousedown: $,
2318
2351
  onClick: () => e.onInputCommandChange(null)
2319
- }, e.messages.common.back), V("span", null, e.messages.slash.emojiTitle)]),
2320
- V("label", { class: "markweave-slash-input" }, [V("span", null, "/"), V("input", {
2352
+ }, e.messages.common.back), B("span", null, e.messages.slash.emojiTitle)]),
2353
+ B("label", { class: "markweave-slash-input" }, [B("span", null, "/"), B("input", {
2321
2354
  autofocus: !0,
2322
2355
  value: a.value,
2323
2356
  placeholder: e.messages.slash.emojiSearchPlaceholder,
@@ -2328,11 +2361,11 @@ var yr = J({
2328
2361
  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));
2329
2362
  }
2330
2363
  })]),
2331
- V("div", {
2364
+ B("div", {
2332
2365
  class: "markweave-slash-emoji-grid",
2333
2366
  role: "listbox",
2334
2367
  "aria-label": e.messages.slash.emojiTitle
2335
- }, s.value.map((e, t) => V("button", {
2368
+ }, s.value.map((e, t) => B("button", {
2336
2369
  key: `${e.emoji}-${e.label}`,
2337
2370
  type: "button",
2338
2371
  role: "option",
@@ -2341,17 +2374,17 @@ var yr = J({
2341
2374
  onMouseenter: () => o.value = t,
2342
2375
  onMousedown: $,
2343
2376
  onClick: () => l(t)
2344
- }, [V("span", null, e.emoji), V("small", null, e.label)])))
2345
- ]) : e.inputCommand?.inputKind === "upload" ? V("div", {
2377
+ }, [B("span", null, e.emoji), B("small", null, e.label)])))
2378
+ ]) : e.inputCommand?.inputKind === "upload" ? B("div", {
2346
2379
  class: "markweave-slash-subpanel",
2347
2380
  "data-testid": "markweave-slash-upload-panel"
2348
2381
  }, [
2349
- V("div", { class: "markweave-slash-upload-header" }, [V("button", {
2382
+ B("div", { class: "markweave-slash-upload-header" }, [B("button", {
2350
2383
  type: "button",
2351
2384
  onMousedown: $,
2352
2385
  onClick: () => e.onInputCommandChange(null)
2353
- }, e.messages.common.back), V("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
2354
- V("label", { class: "markweave-slash-upload-field" }, [V("span", null, e.messages.slash.uploadValueLabel), V("input", {
2386
+ }, e.messages.common.back), B("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
2387
+ B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.slash.uploadValueLabel), B("input", {
2355
2388
  autofocus: !0,
2356
2389
  value: t.value,
2357
2390
  placeholder: e.messages.slash.uploadValuePlaceholder,
@@ -2362,32 +2395,32 @@ var yr = J({
2362
2395
  e.key === "Enter" && (e.preventDefault(), c());
2363
2396
  }
2364
2397
  })]),
2365
- V("label", { class: "markweave-slash-upload-field" }, [V("span", null, e.messages.common.file), V("input", {
2398
+ B("label", { class: "markweave-slash-upload-field" }, [B("span", null, e.messages.common.file), B("input", {
2366
2399
  type: "file",
2367
2400
  onChange: (e) => n.value = e.target.files?.[0] ?? null
2368
2401
  })]),
2369
- r.value ? V("div", {
2402
+ r.value ? B("div", {
2370
2403
  class: "markweave-slash-upload-error",
2371
2404
  role: "alert"
2372
2405
  }, r.value) : null,
2373
- V("div", { class: "markweave-slash-upload-actions" }, [V("button", {
2406
+ B("div", { class: "markweave-slash-upload-actions" }, [B("button", {
2374
2407
  type: "button",
2375
2408
  onMousedown: $,
2376
2409
  onClick: () => e.onInputCommandChange(null)
2377
- }, e.messages.common.cancel), V("button", {
2410
+ }, e.messages.common.cancel), B("button", {
2378
2411
  type: "button",
2379
2412
  "data-primary": "true",
2380
2413
  disabled: i.value,
2381
2414
  onMousedown: $,
2382
2415
  onClick: c
2383
2416
  }, e.messages.common.insert)])
2384
- ]) : e.commands.length ? V("div", { class: "markweave-slash-command-list" }, f.map((t) => V("section", {
2417
+ ]) : e.commands.length ? B("div", { class: "markweave-slash-command-list" }, f.map((t) => B("section", {
2385
2418
  key: t.group,
2386
2419
  class: "markweave-slash-group",
2387
2420
  "aria-label": t.group
2388
- }, [V("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
2389
- let n = e.commands.indexOf(t) === e.state.activeIndex, r = ct(t);
2390
- return V("button", {
2421
+ }, [B("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
2422
+ let n = e.commands.indexOf(t) === e.state.activeIndex, r = ft(t);
2423
+ return B("button", {
2391
2424
  key: t.id,
2392
2425
  type: "button",
2393
2426
  role: "option",
@@ -2409,18 +2442,18 @@ var yr = J({
2409
2442
  }
2410
2443
  }
2411
2444
  }, [
2412
- gr(t.icon),
2413
- V("span", null, t.label),
2414
- t.disabledReason ? V("small", null, t.disabledReason) : null
2445
+ br(t.icon),
2446
+ B("span", null, t.label),
2447
+ t.disabledReason ? B("small", null, t.disabledReason) : null
2415
2448
  ]);
2416
- })]))) : V("div", {
2449
+ })]))) : B("div", {
2417
2450
  class: "markweave-slash-menu__empty",
2418
2451
  role: "option",
2419
2452
  "aria-disabled": "true"
2420
2453
  }, e.messages.slash.noResults)])]);
2421
2454
  };
2422
2455
  }
2423
- }), Sr = J({
2456
+ }), Er = J({
2424
2457
  name: "MarkweaveVueTableControls",
2425
2458
  props: {
2426
2459
  editor: {
@@ -2453,12 +2486,12 @@ var yr = J({
2453
2486
  }
2454
2487
  },
2455
2488
  setup(e) {
2456
- let t = H(null), n = H("row-edge"), r = H(null), i = H(null), a = H(null), o = H(null), s = H(null), c = H(null), l = H(null), u = H(null), d = H(null), f = H(null), p = null, m = W(() => e.active ? yt(e.editor.state) : cr), h = W(() => jt(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = W(() => jt(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = W(() => kt(e.editor)), v = W(() => _.value.length > 0), y = W(() => t.value ? Ft(e.editor, t.value) : []), b = () => {
2489
+ 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 ? Ct(e.editor.state) : fr), h = U(() => Ft(e.editor, e.interactionState, "row", m.value.activeCellPos)), g = U(() => Ft(e.editor, e.interactionState, "column", m.value.activeCellPos)), _ = U(() => Nt(e.editor)), v = U(() => _.value.length > 0), y = U(() => t.value ? zt(e.editor, t.value) : []), b = () => {
2457
2490
  p === null || typeof window > "u" || (window.clearTimeout(p), p = null);
2458
2491
  }, x = (e) => {
2459
2492
  b(), s.value = e, !(!e || typeof window > "u") && (p = window.setTimeout(() => {
2460
2493
  s.value = null, p = null;
2461
- }, zt));
2494
+ }, Ut));
2462
2495
  }, S = () => {
2463
2496
  if (!e.active) {
2464
2497
  r.value = null, i.value = null, a.value = null, x(null);
@@ -2469,16 +2502,16 @@ var yr = J({
2469
2502
  r.value = null, i.value = null, a.value = null;
2470
2503
  return;
2471
2504
  }
2472
- let s = o.getBoundingClientRect(), c = h.value ? At(e.editor, h.value) : null, l = g.value ? At(e.editor, g.value) : null, u = v.value ? It(e.editor) : null;
2473
- c ? r.value = wt({
2505
+ let s = o.getBoundingClientRect(), c = h.value ? Pt(e.editor, h.value) : null, l = g.value ? Pt(e.editor, g.value) : null, u = v.value ? Bt(e.editor) : null;
2506
+ c ? r.value = Ot({
2474
2507
  targetRect: c,
2475
2508
  frameRect: s,
2476
2509
  kind: "row"
2477
- }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = wt({
2510
+ }) : t.value === "row" && n.value === "row-edge" || (r.value = null), l ? i.value = Ot({
2478
2511
  targetRect: l,
2479
2512
  frameRect: s,
2480
2513
  kind: "column"
2481
- }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = wt({
2514
+ }) : t.value === "column" && n.value === "column-edge" || (i.value = null), u ? a.value = Ot({
2482
2515
  targetRect: u,
2483
2516
  frameRect: s,
2484
2517
  kind: "selection"
@@ -2493,13 +2526,13 @@ var yr = J({
2493
2526
  o.value = null;
2494
2527
  return;
2495
2528
  }
2496
- let a = i.getBoundingClientRect(), s = t.value === "row" ? Ot(e.editor)?.getBoundingClientRect() : null, c = s ? {
2529
+ let a = i.getBoundingClientRect(), s = t.value === "row" ? Mt(e.editor)?.getBoundingClientRect() : null, c = s ? {
2497
2530
  left: a.left,
2498
2531
  top: s.top,
2499
2532
  width: a.width,
2500
2533
  height: a.height
2501
2534
  } : a, p = r.getBoundingClientRect(), m = f.value.getBoundingClientRect();
2502
- o.value = Ct({
2535
+ o.value = Dt({
2503
2536
  anchorRect: c,
2504
2537
  frameRect: p,
2505
2538
  menuSize: {
@@ -2516,16 +2549,16 @@ var yr = J({
2516
2549
  let i = t.value === e && n.value === r;
2517
2550
  n.value = r, t.value = i ? null : e, T();
2518
2551
  }, D = () => {
2519
- e.editor.view.dispatch(gt(e.editor.state.tr, null));
2552
+ e.editor.view.dispatch(bt(e.editor.state.tr, null));
2520
2553
  }, O = (t, n) => {
2521
2554
  let r = e.interactionState.hoverCellPos ?? m.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
2522
- r !== null && Rt(e.editor, r, t, { visualIndex: i }), E(t, n);
2555
+ r !== null && Ht(e.editor, r, t, { visualIndex: i }), E(t, n);
2523
2556
  }, k = () => {
2524
2557
  D(), E("selection", "selection-edge");
2525
2558
  }, A = (n = !1) => {
2526
2559
  t.value = null, o.value = null, n && e.editor.view.focus();
2527
2560
  }, j = async (n, r) => {
2528
- let i = await Et({
2561
+ let i = await At({
2529
2562
  editor: e.editor,
2530
2563
  commandId: n,
2531
2564
  menu: r ?? t.value ?? "selection",
@@ -2533,18 +2566,18 @@ var yr = J({
2533
2566
  });
2534
2567
  return i.copyFeedback ? (x(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : x(null), e.onCommandResult?.(i.commandResult), i.success;
2535
2568
  }, M = (t) => {
2536
- let n = Mt(e.editor, t);
2569
+ let n = It(e.editor, t);
2537
2570
  n && e.onEditWithAi?.(n), A(!0);
2538
2571
  }, N = (e) => {
2539
2572
  !t.value || e.key !== "Escape" || A(!0);
2540
2573
  }, ee = (e) => {
2541
2574
  t.value && (e.target instanceof Node && c.value?.contains(e.target) || A());
2542
2575
  };
2543
- $t(() => {
2576
+ G(() => {
2544
2577
  w(), window.addEventListener("resize", w), window.addEventListener("scroll", w, !0), document.addEventListener("keydown", N), document.addEventListener("mousedown", ee);
2545
2578
  }), K(() => {
2546
2579
  b(), window.removeEventListener("resize", w), window.removeEventListener("scroll", w, !0), document.removeEventListener("keydown", N), document.removeEventListener("mousedown", ee);
2547
- }), G(() => [
2580
+ }), W(() => [
2548
2581
  e.active,
2549
2582
  m.value.activeCellPos,
2550
2583
  m.value.selectionFrom,
@@ -2555,11 +2588,11 @@ var yr = J({
2555
2588
  t.value,
2556
2589
  n.value
2557
2590
  ], T, { flush: "post" });
2558
- let P = () => t.value ? V("div", {
2591
+ let te = () => t.value ? B("div", {
2559
2592
  ref: f,
2560
2593
  class: "markweave-table-menu",
2561
2594
  role: "menu",
2562
- "aria-label": Bt(t.value, e.messages),
2595
+ "aria-label": Wt(t.value, e.messages),
2563
2596
  "data-testid": "markweave-table-menu",
2564
2597
  "data-positioned": o.value ? "true" : "false",
2565
2598
  style: o.value ? {
@@ -2567,8 +2600,8 @@ var yr = J({
2567
2600
  top: `${o.value.top}px`
2568
2601
  } : void 0
2569
2602
  }, y.value.map((n, r) => {
2570
- let i = Nt(n), a = r === 0 ? i : Nt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : Tt(e.editor, n.commandId), c = Pt(n, e.messages);
2571
- return V("button", {
2603
+ let i = Lt(n), a = r === 0 ? i : Lt(y.value[r - 1]), o = r > 0 && a !== i, s = n.commandId === null ? !!e.onEditWithAi : kt(e.editor, n.commandId), c = Rt(n, e.messages);
2604
+ return B("button", {
2572
2605
  key: `${n.id}-${r}`,
2573
2606
  type: "button",
2574
2607
  role: "menuitem",
@@ -2591,7 +2624,7 @@ var yr = J({
2591
2624
  }
2592
2625
  }, c);
2593
2626
  })) : null;
2594
- return () => e.active ? V("div", {
2627
+ return () => e.active ? B("div", {
2595
2628
  ref: c,
2596
2629
  class: "markweave-table-controls",
2597
2630
  "data-testid": "markweave-table-controls",
@@ -2599,7 +2632,7 @@ var yr = J({
2599
2632
  "data-open-menu": t.value ?? "none",
2600
2633
  "data-positioned": r.value || i.value || a.value ? "true" : "false"
2601
2634
  }, [
2602
- s.value ? V("div", {
2635
+ s.value ? B("div", {
2603
2636
  class: "markweave-table-copy-feedback",
2604
2637
  role: "status",
2605
2638
  "aria-live": "polite",
@@ -2607,8 +2640,8 @@ var yr = J({
2607
2640
  "data-copy-kind": s.value.kind,
2608
2641
  "data-text-length": s.value.textLength,
2609
2642
  "data-html-length": s.value.htmlLength
2610
- }, Dt(s.value)) : null,
2611
- r.value ? V("button", {
2643
+ }, jt(s.value)) : null,
2644
+ r.value ? B("button", {
2612
2645
  ref: l,
2613
2646
  type: "button",
2614
2647
  class: "markweave-table-edge-handle markweave-table-edge-handle--row",
@@ -2627,8 +2660,8 @@ var yr = J({
2627
2660
  },
2628
2661
  onMousedown: $,
2629
2662
  onClick: () => O("row", "row-edge")
2630
- }, [V("span", { "aria-hidden": "true" }, "...")]) : null,
2631
- i.value ? V("button", {
2663
+ }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2664
+ i.value ? B("button", {
2632
2665
  ref: u,
2633
2666
  type: "button",
2634
2667
  class: "markweave-table-edge-handle markweave-table-edge-handle--column",
@@ -2647,8 +2680,8 @@ var yr = J({
2647
2680
  },
2648
2681
  onMousedown: $,
2649
2682
  onClick: () => O("column", "column-edge")
2650
- }, [V("span", { "aria-hidden": "true" }, "...")]) : null,
2651
- v.value && a.value ? V("button", {
2683
+ }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2684
+ v.value && a.value ? B("button", {
2652
2685
  ref: d,
2653
2686
  type: "button",
2654
2687
  class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
@@ -2663,11 +2696,11 @@ var yr = J({
2663
2696
  },
2664
2697
  onMousedown: $,
2665
2698
  onClick: k
2666
- }, [V("span", { "aria-hidden": "true" }, "...")]) : null,
2667
- P()
2699
+ }, [B("span", { "aria-hidden": "true" }, "...")]) : null,
2700
+ te()
2668
2701
  ]) : null;
2669
2702
  }
2670
- }), Cr = J({
2703
+ }), Dr = J({
2671
2704
  name: "MarkweaveVueTableSelectionOverlay",
2672
2705
  props: {
2673
2706
  editor: {
@@ -2680,18 +2713,18 @@ var yr = J({
2680
2713
  }
2681
2714
  },
2682
2715
  setup(e) {
2683
- let t = H(null), n = () => {
2716
+ let t = V(null), n = () => {
2684
2717
  if (e.focusState.mode !== "cell-selection") {
2685
2718
  t.value = null;
2686
2719
  return;
2687
2720
  }
2688
- t.value = Lt(e.editor, bt(e.editor.state));
2721
+ t.value = Vt(e.editor, wt(e.editor.state));
2689
2722
  };
2690
- return $t(() => {
2723
+ return G(() => {
2691
2724
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
2692
2725
  }), K(() => {
2693
2726
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
2694
- }), G(() => [
2727
+ }), W(() => [
2695
2728
  e.focusState.activeCellPos,
2696
2729
  e.focusState.anchorCellPos,
2697
2730
  e.focusState.mode,
@@ -2702,7 +2735,7 @@ var yr = J({
2702
2735
  q(n);
2703
2736
  }, { flush: "post" }), () => {
2704
2737
  let e = t.value;
2705
- return e ? V("div", {
2738
+ return e ? B("div", {
2706
2739
  "aria-hidden": "true",
2707
2740
  class: "markweave-table-selection-overlay",
2708
2741
  "data-anchor-cell-pos": e.anchorCellPos ?? "",
@@ -2723,7 +2756,7 @@ var yr = J({
2723
2756
  }) : null;
2724
2757
  };
2725
2758
  }
2726
- }), wr = J({
2759
+ }), Or = J({
2727
2760
  name: "MarkweaveVueCodeBlockControls",
2728
2761
  props: {
2729
2762
  editor: {
@@ -2752,20 +2785,20 @@ var yr = J({
2752
2785
  }
2753
2786
  },
2754
2787
  setup(e) {
2755
- let t = H(null), n = H(null), r = H(null), i = H(null), a = H(null), o = H([]), s = H(null), c = H(!1), l = H(""), u = H(null), d = H(!1), f = H(null), p = H(null), m = H(!1), h = H({
2788
+ 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({
2756
2789
  active: !1,
2757
2790
  lastX: 0,
2758
2791
  lastY: 0
2759
- }), g = H(0), _ = H(0), v = H(0), y = null, b = W(() => (v.value, Ie(e.editor, i.value))), x = W(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
2792
+ }), g = V(0), _ = V(0), v = V(0), y = null, b = U(() => (v.value, Be(e.editor, i.value))), x = U(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
2760
2793
  ...e.state,
2761
2794
  pos: e.state.pos,
2762
2795
  active: !0
2763
- } : null), S = W(() => b.value ?? x.value), C = W(() => S.value !== null), w = W(() => S.value?.language === "mermaid"), T = W(() => Be(e.editor, S.value)), E = W(() => C.value && S.value !== null && !T.value), D = W(() => !e.readOnly), O = W(() => S.value ? Ae(S.value.language) : Ae("text")), k = W(() => u.value?.status ?? "idle"), A = W(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), j = W(() => w.value && A.value === "preview"), M = W(() => (v.value, g.value, _.value, Re(e.editor))), N = W(() => `${_.value}|${M.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), ee = W(() => Pe(l.value)), P = W(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), te = () => {
2796
+ } : null), S = U(() => b.value ?? x.value), C = U(() => S.value !== null), w = U(() => S.value?.language === "mermaid"), T = U(() => We(e.editor, S.value)), E = U(() => C.value && S.value !== null && !T.value), D = U(() => !e.readOnly), O = U(() => S.value ? Pe(S.value.language) : Pe("text")), k = U(() => u.value?.status ?? "idle"), A = U(() => S.value?.mermaidPreviewMode ?? e.mermaidMode), j = U(() => w.value && A.value === "preview"), M = U(() => (v.value, g.value, _.value, He(e.editor))), N = U(() => `${_.value}|${M.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), ee = U(() => Re(l.value)), te = U(() => S.value ? `${S.value.pos}:${S.value.language}:${S.value.text}` : "none"), P = () => {
2764
2797
  y !== null && (window.clearTimeout(y), y = null);
2765
2798
  }, F = (e) => {
2766
- te(), u.value = e, e && (y = window.setTimeout(() => {
2799
+ P(), u.value = e, e && (y = window.setTimeout(() => {
2767
2800
  u.value = null, y = null;
2768
- }, we));
2801
+ }, Oe));
2769
2802
  }, I = () => {
2770
2803
  f.value = null, p.value = null, m.value = !1, h.value = {
2771
2804
  active: !1,
@@ -2775,15 +2808,15 @@ var yr = J({
2775
2808
  }, L = () => {
2776
2809
  let n = t.value;
2777
2810
  if (!n) return;
2778
- if (!Le(n) || M.value.length === 0) {
2811
+ if (!Ve(n) || M.value.length === 0) {
2779
2812
  o.value = [];
2780
2813
  return;
2781
2814
  }
2782
2815
  let r = n.getBoundingClientRect(), i = M.value.flatMap((t) => {
2783
- let n = Ne(Me(e.editor, t.pos, t.mermaidPreviewMode), r);
2784
- return n ? [Oe(t, n, r)] : [];
2816
+ let n = Le(Ie(e.editor, t.pos, t.mermaidPreviewMode), r);
2817
+ return n ? [Me(t, n, r)] : [];
2785
2818
  });
2786
- o.value = Ve(o.value, i, M.value.map((e) => e.pos));
2819
+ o.value = Ge(o.value, i, M.value.map((e) => e.pos));
2787
2820
  }, R = () => {
2788
2821
  if (!E.value || !S.value) {
2789
2822
  a.value = null, s.value = null;
@@ -2791,14 +2824,14 @@ var yr = J({
2791
2824
  }
2792
2825
  let r = t.value;
2793
2826
  if (!r) return;
2794
- let i = Me(e.editor, S.value.pos, A.value), o = r.getBoundingClientRect(), l = Ne(i, o);
2827
+ let i = Ie(e.editor, S.value.pos, A.value), o = r.getBoundingClientRect(), l = Le(i, o);
2795
2828
  if (!l) {
2796
2829
  a.value = a.value?.pos === S.value.pos ? a.value : null, s.value = c.value ? s.value : null;
2797
2830
  return;
2798
2831
  }
2799
- if (a.value = Ee(S.value.pos, l, o), c.value && n.value) {
2832
+ if (a.value = Ae(S.value.pos, l, o), c.value && n.value) {
2800
2833
  let e = n.value.getBoundingClientRect();
2801
- s.value = Se({
2834
+ s.value = Ee({
2802
2835
  overlayRect: o,
2803
2836
  buttonRect: e,
2804
2837
  windowWidth: window.innerWidth,
@@ -2808,60 +2841,60 @@ var yr = J({
2808
2841
  }, ne = async () => {
2809
2842
  if (e.readOnly) {
2810
2843
  if (!S.value) return;
2811
- let e = await Te(S.value.text);
2812
- F(_e(S.value, e ? "copied" : "failed"));
2844
+ let e = await ke(S.value.text);
2845
+ F(xe(S.value, e ? "copied" : "failed"));
2813
2846
  return;
2814
2847
  }
2815
- if (!ke(e.editor, S.value)) return;
2816
- let t = await he(e.editor);
2817
- F(_e(ge(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
2848
+ if (!Ne(e.editor, S.value)) return;
2849
+ let t = await ye(e.editor);
2850
+ F(xe(be(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
2818
2851
  }, re = (t, n) => {
2819
2852
  if (e.readOnly) {
2820
- at(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
2853
+ lt(e.editor, t.pos, n) && (_.value += 1, v.value += 1);
2821
2854
  return;
2822
2855
  }
2823
2856
  let r = e.state.active && e.state.pos === t.pos;
2824
- xe(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
2857
+ Te(e.editor, t.pos, n) && (e.onMermaidModeChange(n), v.value += 1, r && e.editor.view.focus());
2825
2858
  }, z = (t) => {
2826
2859
  if (e.readOnly || !S.value) return;
2827
2860
  let n = e.state.active && e.state.pos === S.value.pos;
2828
- be(e.editor, S.value.pos, t) && (t === "mermaid" && xe(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
2861
+ we(e.editor, S.value.pos, t) && (t === "mermaid" && Te(e.editor, S.value.pos, "preview") && e.onMermaidModeChange("preview"), c.value = !1, l.value = "", v.value += 1, n && e.editor.view.focus());
2829
2862
  }, ie = () => {
2830
- e.readOnly || !S.value || ye(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
2863
+ e.readOnly || !S.value || Ce(e.editor, S.value.pos, !T.value) && (g.value += 1, v.value += 1, i.value = null);
2831
2864
  }, ae = () => {
2832
2865
  if (!S.value) return;
2833
- let t = ze(e.editor, S.value.pos);
2866
+ let t = Ue(e.editor, S.value.pos);
2834
2867
  if (!t) return;
2835
2868
  let n = new Blob([t], { type: "image/svg+xml" }), r = URL.createObjectURL(n), i = document.createElement("a");
2836
2869
  i.href = r, i.download = "markweave-mermaid.svg", i.click(), URL.revokeObjectURL(r), e.editor.view.focus();
2837
2870
  }, oe = () => {
2838
2871
  if (!S.value) return;
2839
- let t = ze(e.editor, S.value.pos);
2840
- t && (f.value = De(t), p.value = null, m.value = !1, h.value = {
2872
+ let t = Ue(e.editor, S.value.pos);
2873
+ t && (f.value = je(t), p.value = null, m.value = !1, h.value = {
2841
2874
  active: !1,
2842
2875
  lastX: 0,
2843
2876
  lastY: 0
2844
2877
  });
2845
- }, B = (e) => {
2878
+ }, se = (e) => {
2846
2879
  f.value = f.value ? {
2847
2880
  ...f.value,
2848
- scale: Ce(f.value.scale + e)
2881
+ scale: De(f.value.scale + e)
2849
2882
  } : null;
2850
- }, se = () => {
2851
- f.value = f.value ? De(f.value.svg) : null, h.value = {
2883
+ }, ce = () => {
2884
+ f.value = f.value ? je(f.value.svg) : null, h.value = {
2852
2885
  active: !1,
2853
2886
  lastX: 0,
2854
2887
  lastY: 0
2855
2888
  }, m.value = !1;
2856
- }, ce = (e) => {
2857
- e.preventDefault(), B(e.deltaY < 0 ? He : -He);
2858
2889
  }, le = (e) => {
2890
+ e.preventDefault(), se(e.deltaY < 0 ? Ke : -Ke);
2891
+ }, ue = (e) => {
2859
2892
  e.button === 0 && (e.preventDefault(), h.value = {
2860
2893
  active: !0,
2861
2894
  lastX: e.clientX,
2862
2895
  lastY: e.clientY
2863
2896
  }, m.value = !0);
2864
- }, ue = (e) => {
2897
+ }, de = (e) => {
2865
2898
  let t = h.value;
2866
2899
  if (!t.active) return;
2867
2900
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
@@ -2869,21 +2902,21 @@ var yr = J({
2869
2902
  active: !0,
2870
2903
  lastX: e.clientX,
2871
2904
  lastY: e.clientY
2872
- }, f.value = Ue(f.value, n, r);
2873
- }, de = () => {
2905
+ }, f.value = qe(f.value, n, r);
2906
+ }, fe = () => {
2874
2907
  h.value = {
2875
2908
  active: !1,
2876
2909
  lastX: 0,
2877
2910
  lastY: 0
2878
2911
  }, m.value = !1;
2879
2912
  };
2880
- G(() => e.readOnly, (e) => {
2913
+ W(() => e.readOnly, (e) => {
2881
2914
  e && (c.value = !1, l.value = "");
2882
- }), G(P, () => {
2915
+ }), W(te, () => {
2883
2916
  F(null), c.value = !1, l.value = "", f.value = null, p.value = null, m.value = !1;
2884
- }), G(c, async (e) => {
2917
+ }), W(c, async (e) => {
2885
2918
  e && (await q(), R(), r.value?.focus({ preventScroll: !0 }));
2886
- }), G(() => [
2919
+ }), W(() => [
2887
2920
  E.value,
2888
2921
  g.value,
2889
2922
  S.value?.pos ?? null,
@@ -2894,18 +2927,18 @@ var yr = J({
2894
2927
  }, {
2895
2928
  flush: "post",
2896
2929
  immediate: !0
2897
- }), G(N, async () => {
2930
+ }), W(N, async () => {
2898
2931
  await q(), L(), window.requestAnimationFrame(L);
2899
2932
  }, {
2900
2933
  flush: "post",
2901
2934
  immediate: !0
2902
2935
  });
2903
- let fe = null;
2904
- return $t(() => {
2936
+ let pe = null;
2937
+ return G(() => {
2905
2938
  q(() => {
2906
2939
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
2907
2940
  if (n.target instanceof Node && t.value?.contains(n.target) || c.value) return;
2908
- let r = Fe(e.editor, n.target), a = Ie(e.editor, r), o = a && !Be(e.editor, a) ? a.pos : null;
2941
+ let r = ze(e.editor, n.target), a = Be(e.editor, r), o = a && !We(e.editor, a) ? a.pos : null;
2909
2942
  i.value = i.value === o ? i.value : o;
2910
2943
  }, a = () => {
2911
2944
  c.value || (i.value = null);
@@ -2920,14 +2953,14 @@ var yr = J({
2920
2953
  }, s = (e) => {
2921
2954
  c.value && (e.target instanceof Node && t.value?.contains(e.target) || (c.value = !1));
2922
2955
  }, l = ({ transaction: e }) => {
2923
- e.getMeta(me) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(me) || rt(e)) && (v.value += 1);
2956
+ e.getMeta(ve) && (g.value += 1), (e.docChanged || e.selectionSet || e.getMeta(ve) || st(e)) && (v.value += 1);
2924
2957
  };
2925
- 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), fe = () => {
2926
- 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), te();
2958
+ 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 = () => {
2959
+ 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), P();
2927
2960
  };
2928
2961
  });
2929
2962
  }), K(() => {
2930
- fe?.(), fe = null, te();
2963
+ pe?.(), pe = null, P();
2931
2964
  }), () => {
2932
2965
  if (!E.value && M.value.length === 0 && !f.value) return null;
2933
2966
  let i = a.value ? {
@@ -2937,7 +2970,7 @@ var yr = J({
2937
2970
  left: `${s.value.left}px`,
2938
2971
  top: `${s.value.top}px`
2939
2972
  } : void 0;
2940
- return V("div", {
2973
+ return B("div", {
2941
2974
  ref: t,
2942
2975
  class: "markweave-codeblock-overlay",
2943
2976
  "data-testid": "markweave-codeblock-overlay",
@@ -2945,7 +2978,7 @@ var yr = J({
2945
2978
  }, [
2946
2979
  ...M.value.map((e) => {
2947
2980
  let t = o.value.find((t) => t.pos === e.pos);
2948
- return V("div", {
2981
+ return B("div", {
2949
2982
  key: e.pos,
2950
2983
  class: "markweave-mermaid-tabs",
2951
2984
  "data-testid": "markweave-mermaid-tabs",
@@ -2955,7 +2988,7 @@ var yr = J({
2955
2988
  top: `${t.top}px`,
2956
2989
  left: `${t.left}px`
2957
2990
  } : void 0
2958
- }, ["code", "preview"].map((t) => V("button", {
2991
+ }, ["code", "preview"].map((t) => B("button", {
2959
2992
  key: t,
2960
2993
  type: "button",
2961
2994
  "data-testid": `markweave-mermaid-mode-${t}`,
@@ -2964,7 +2997,7 @@ var yr = J({
2964
2997
  onClick: () => re(e, t)
2965
2998
  }, t === "code" ? "Code" : "Preview")));
2966
2999
  }),
2967
- E.value && S.value ? V("div", {
3000
+ E.value && S.value ? B("div", {
2968
3001
  class: "markweave-codeblock-controls",
2969
3002
  "data-testid": "markweave-codeblock-controls",
2970
3003
  "data-positioned": a.value ? "true" : "false",
@@ -2973,11 +3006,11 @@ var yr = J({
2973
3006
  "aria-label": "Code block controls",
2974
3007
  style: i
2975
3008
  }, [
2976
- e.readOnly ? V("span", {
3009
+ e.readOnly ? B("span", {
2977
3010
  class: "markweave-codeblock-language-button markweave-codeblock-language-label",
2978
3011
  "aria-label": "Code block language",
2979
3012
  "data-testid": "markweave-codeblock-language"
2980
- }, [V("span", null, O.value)]) : V("button", {
3013
+ }, [B("span", null, O.value)]) : B("button", {
2981
3014
  ref: n,
2982
3015
  type: "button",
2983
3016
  class: "markweave-codeblock-language-button",
@@ -2989,8 +3022,8 @@ var yr = J({
2989
3022
  onClick: () => {
2990
3023
  c.value = !c.value;
2991
3024
  }
2992
- }, [V("span", null, O.value), Q("chevron")]),
2993
- D.value ? V("button", {
3025
+ }, [B("span", null, O.value), Q("chevron")]),
3026
+ D.value ? B("button", {
2994
3027
  type: "button",
2995
3028
  class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
2996
3029
  "aria-label": T.value ? "Expand code block" : "Collapse code block",
@@ -3000,7 +3033,7 @@ var yr = J({
3000
3033
  onMousedown: $,
3001
3034
  onClick: ie
3002
3035
  }, [Q("chevron")]) : null,
3003
- V("span", { class: "markweave-codeblock-copy-wrap" }, [V("button", {
3036
+ B("span", { class: "markweave-codeblock-copy-wrap" }, [B("button", {
3004
3037
  type: "button",
3005
3038
  class: "markweave-codeblock-icon-button",
3006
3039
  "aria-label": "Copy to clipboard",
@@ -3022,15 +3055,15 @@ var yr = J({
3022
3055
  onClick: () => {
3023
3056
  ne();
3024
3057
  }
3025
- }, [Q(k.value === "copied" ? "check" : "clipboard")]), d.value ? V("span", {
3058
+ }, [Q(k.value === "copied" ? "check" : "clipboard")]), d.value ? B("span", {
3026
3059
  class: "markweave-codeblock-tooltip",
3027
3060
  role: "tooltip",
3028
3061
  "data-testid": "markweave-codeblock-copy-tooltip"
3029
3062
  }, "Copy to clipboard") : null]),
3030
- w.value && A.value === "preview" ? V("div", {
3063
+ w.value && A.value === "preview" ? B("div", {
3031
3064
  class: "markweave-mermaid-preview-actions",
3032
3065
  "data-testid": "markweave-mermaid-preview-actions"
3033
- }, [V("button", {
3066
+ }, [B("button", {
3034
3067
  type: "button",
3035
3068
  class: "markweave-codeblock-icon-button",
3036
3069
  "aria-label": "Fullscreen Mermaid preview",
@@ -3038,7 +3071,7 @@ var yr = J({
3038
3071
  disabled: !j.value,
3039
3072
  onMousedown: $,
3040
3073
  onClick: oe
3041
- }, [Q("expand")]), V("button", {
3074
+ }, [Q("expand")]), B("button", {
3042
3075
  type: "button",
3043
3076
  class: "markweave-codeblock-icon-button",
3044
3077
  "aria-label": "Download Mermaid SVG",
@@ -3048,14 +3081,14 @@ var yr = J({
3048
3081
  onClick: ae
3049
3082
  }, [Q("download")])]) : null
3050
3083
  ]) : null,
3051
- D.value && E.value && c.value && S.value ? V("div", {
3084
+ D.value && E.value && c.value && S.value ? B("div", {
3052
3085
  class: "markweave-codeblock-language-menu",
3053
3086
  role: "listbox",
3054
3087
  "aria-label": "Code block languages",
3055
3088
  "data-testid": "markweave-codeblock-language-menu",
3056
3089
  "data-positioned": s.value ? "true" : "false",
3057
3090
  style: u
3058
- }, [V("label", { class: "markweave-codeblock-language-search" }, [V("input", {
3091
+ }, [B("label", { class: "markweave-codeblock-language-search" }, [B("input", {
3059
3092
  ref: r,
3060
3093
  value: l.value,
3061
3094
  placeholder: "Search...",
@@ -3066,9 +3099,9 @@ var yr = J({
3066
3099
  onKeydown: (t) => {
3067
3100
  t.key === "Escape" && (t.preventDefault(), c.value = !1, e.editor.view.focus());
3068
3101
  }
3069
- }), Q("search")]), V("div", { class: "markweave-codeblock-language-list" }, ee.value.map((e) => {
3102
+ }), Q("search")]), B("div", { class: "markweave-codeblock-language-list" }, ee.value.map((e) => {
3070
3103
  let t = S.value?.language === e.language;
3071
- return V("button", {
3104
+ return B("button", {
3072
3105
  key: e.language,
3073
3106
  type: "button",
3074
3107
  role: "option",
@@ -3077,20 +3110,20 @@ var yr = J({
3077
3110
  "data-active": t ? "true" : "false",
3078
3111
  onMousedown: $,
3079
3112
  onClick: () => z(e.language)
3080
- }, [V("span", null, e.label), t ? Q("check") : null]);
3113
+ }, [B("span", null, e.label), t ? Q("check") : null]);
3081
3114
  }))]) : null,
3082
- f.value ? V("div", {
3115
+ f.value ? B("div", {
3083
3116
  class: "markweave-mermaid-fullscreen-layer",
3084
3117
  role: "dialog",
3085
3118
  "aria-modal": "true",
3086
3119
  "aria-label": "Mermaid preview",
3087
3120
  "data-testid": "markweave-mermaid-fullscreen-layer"
3088
3121
  }, [
3089
- V("div", {
3122
+ B("div", {
3090
3123
  class: "markweave-mermaid-fullscreen-toolbar",
3091
3124
  "data-testid": "markweave-mermaid-fullscreen-toolbar"
3092
3125
  }, [
3093
- V("button", {
3126
+ B("button", {
3094
3127
  type: "button",
3095
3128
  class: "markweave-mermaid-fullscreen-control",
3096
3129
  "aria-label": "Zoom out",
@@ -3107,13 +3140,13 @@ var yr = J({
3107
3140
  onBlur: () => {
3108
3141
  p.value = null;
3109
3142
  },
3110
- onClick: () => B(-He)
3143
+ onClick: () => se(-Ke)
3111
3144
  }, [Q("zoomOut")]),
3112
- V("span", {
3145
+ B("span", {
3113
3146
  class: "markweave-mermaid-fullscreen-zoom-label",
3114
3147
  "data-testid": "markweave-mermaid-fullscreen-zoom-label"
3115
- }, je(f.value.scale)),
3116
- V("button", {
3148
+ }, Fe(f.value.scale)),
3149
+ B("button", {
3117
3150
  type: "button",
3118
3151
  class: "markweave-mermaid-fullscreen-control",
3119
3152
  "aria-label": "Zoom in",
@@ -3130,9 +3163,9 @@ var yr = J({
3130
3163
  onBlur: () => {
3131
3164
  p.value = null;
3132
3165
  },
3133
- onClick: () => B(He)
3166
+ onClick: () => se(Ke)
3134
3167
  }, [Q("zoomIn")]),
3135
- V("button", {
3168
+ B("button", {
3136
3169
  type: "button",
3137
3170
  class: "markweave-mermaid-fullscreen-control",
3138
3171
  "aria-label": "Reset zoom",
@@ -3149,31 +3182,31 @@ var yr = J({
3149
3182
  onBlur: () => {
3150
3183
  p.value = null;
3151
3184
  },
3152
- onClick: se
3185
+ onClick: ce
3153
3186
  }, [Q("reset")]),
3154
- p.value ? V("span", {
3187
+ p.value ? B("span", {
3155
3188
  class: "markweave-mermaid-fullscreen-tooltip",
3156
3189
  role: "tooltip",
3157
3190
  "data-testid": "markweave-mermaid-fullscreen-tooltip"
3158
3191
  }, p.value === "zoom-out" ? "Zoom out" : p.value === "zoom-in" ? "Zoom in" : "Reset") : null
3159
3192
  ]),
3160
- V("button", {
3193
+ B("button", {
3161
3194
  type: "button",
3162
3195
  class: "markweave-mermaid-fullscreen-close",
3163
3196
  "aria-label": "Close fullscreen Mermaid preview",
3164
3197
  "data-testid": "markweave-mermaid-fullscreen-close",
3165
3198
  onClick: I
3166
3199
  }, [Q("close")]),
3167
- V("div", {
3200
+ B("div", {
3168
3201
  class: "markweave-mermaid-fullscreen-viewport",
3169
3202
  "data-testid": "markweave-mermaid-fullscreen-viewport",
3170
3203
  "data-dragging": m.value ? "true" : "false",
3171
- onWheel: ce,
3172
- onMousedown: le,
3173
- onMousemove: ue,
3174
- onMouseup: de,
3175
- onMouseleave: de
3176
- }, [V("div", {
3204
+ onWheel: le,
3205
+ onMousedown: ue,
3206
+ onMousemove: de,
3207
+ onMouseup: fe,
3208
+ onMouseleave: fe
3209
+ }, [B("div", {
3177
3210
  class: "markweave-mermaid-fullscreen-content",
3178
3211
  "data-testid": "markweave-mermaid-fullscreen-content",
3179
3212
  "data-scale-percent": Math.round(f.value.scale * 100),
@@ -3189,7 +3222,7 @@ var yr = J({
3189
3222
  ]);
3190
3223
  };
3191
3224
  }
3192
- }), Tr = J({
3225
+ }), kr = J({
3193
3226
  name: "MarkweaveVueInnerToc",
3194
3227
  props: {
3195
3228
  editor: {
@@ -3207,21 +3240,29 @@ var yr = J({
3207
3240
  editable: {
3208
3241
  type: Boolean,
3209
3242
  required: !0
3243
+ },
3244
+ placement: {
3245
+ type: String,
3246
+ required: !0
3210
3247
  }
3211
3248
  },
3212
3249
  setup(e) {
3213
- return () => e.state.items.length ? V("nav", {
3250
+ let t = V(null), n, r = () => {
3251
+ n?.(), n = e.placement === "container" && t.value ? ge(t.value) : void 0;
3252
+ };
3253
+ return G(r), K(() => n?.()), W(() => e.placement, r), () => e.state.items.length ? B("nav", {
3254
+ ref: t,
3214
3255
  class: "markweave-inner-toc",
3215
3256
  "data-testid": "markweave-inner-toc",
3216
3257
  "aria-label": e.messages.toc.ariaLabel
3217
- }, [V("div", {
3258
+ }, [B("div", {
3218
3259
  class: "markweave-inner-toc-rail",
3219
3260
  "aria-hidden": "true"
3220
- }, e.state.items.map((e) => V("span", {
3261
+ }, e.state.items.map((e) => B("span", {
3221
3262
  key: e.id,
3222
3263
  "data-level": e.level,
3223
3264
  "data-active": e.active ? "true" : "false"
3224
- }))), V("div", { class: "markweave-inner-toc-panel" }, [V("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => V("button", {
3265
+ }))), B("div", { class: "markweave-inner-toc-panel" }, [B("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => B("button", {
3225
3266
  key: t.id,
3226
3267
  type: "button",
3227
3268
  class: "markweave-inner-toc-item",
@@ -3230,20 +3271,20 @@ var yr = J({
3230
3271
  "aria-current": t.active ? "location" : void 0,
3231
3272
  "aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
3232
3273
  title: t.text,
3233
- onClick: () => pe(e.editor, t, {
3274
+ onClick: () => _e(e.editor, t, {
3234
3275
  behavior: "smooth",
3235
3276
  focus: e.editable
3236
3277
  })
3237
3278
  }, t.text)))])]) : null;
3238
3279
  }
3239
3280
  });
3240
- function Er(e = {}) {
3241
- let t = m(e.lang), r = p(t), i = f(t), a = H(l(e.mode)), o = W(() => a.value === "live" && e.editable !== !1), s = H(0), c = U(null), d = H(mt), h = U(null), g = U(null), _ = H("code"), v = U(null), y = U(xt), b = H(null), x = H(!1), S = F(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), C = e.onSlashCommandUpload, w = U(null);
3281
+ function Ar(e = {}) {
3282
+ let t = m(e.lang), r = p(t), i = f(t), a = V(l(e.mode)), o = U(() => a.value === "live" && e.editable !== !1), s = V(0), c = H(null), d = V(vt), h = H(null), g = H(null), _ = V("code"), v = H(null), y = H(Tt), b = V(null), x = V(!1), S = I(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), C = e.onSlashCommandUpload, w = H(null);
3242
3283
  w.value = new n({
3243
- extensions: sr({
3284
+ extensions: dr({
3244
3285
  lang: t,
3245
- onImageUpload: (e) => C?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3246
- onVideoUpload: (e) => C?.(e) ?? A(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
3286
+ onImageUpload: (e) => C?.(e) ?? j(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
3287
+ onVideoUpload: (e) => C?.(e) ?? j(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler."))
3247
3288
  }),
3248
3289
  content: e.content ?? e.defaultContent ?? "",
3249
3290
  contentType: P(S),
@@ -3259,17 +3300,17 @@ function Er(e = {}) {
3259
3300
  translate: "no"
3260
3301
  },
3261
3302
  handleClick: (e, t, n) => {
3262
- if (!o.value) return ae(n);
3263
- let r = Ze(e, n);
3264
- return r ? (n.preventDefault(), n.stopPropagation(), E(), tt(e, r, !0), nt(e, r), v.value = r, !0) : (v.value = null, !1);
3303
+ if (!o.value) return oe(n);
3304
+ let r = tt(e, n);
3305
+ return r ? (n.preventDefault(), n.stopPropagation(), E(), at(e, r, !0), ot(e, r), v.value = r, !0) : (v.value = null, !1);
3265
3306
  },
3266
3307
  handleDOMEvents: {
3267
- compositionstart: () => o.value ? (d.value = ht(d.value, { type: "composition-start" }), h.value = null, !1) : !1,
3308
+ compositionstart: () => o.value ? (d.value = yt(d.value, { type: "composition-start" }), h.value = null, !1) : !1,
3268
3309
  compositionend: (e) => (o.value && window.setTimeout(() => D(e), 0), !1),
3269
3310
  click: (e, t) => {
3270
- if (!o.value) return ae(t);
3271
- let n = Ze(e, t);
3272
- return n ? (t.preventDefault(), t.stopPropagation(), E(), tt(e, n, !0), nt(e, n), v.value = n, !0) : (v.value = null, !1);
3311
+ if (!o.value) return oe(t);
3312
+ let n = tt(e, t);
3313
+ return n ? (t.preventDefault(), t.stopPropagation(), E(), at(e, n, !0), ot(e, n), v.value = n, !0) : (v.value = null, !1);
3273
3314
  }
3274
3315
  }
3275
3316
  },
@@ -3278,98 +3319,98 @@ function Er(e = {}) {
3278
3319
  u(t, {
3279
3320
  mode: a.value,
3280
3321
  editable: o.value
3281
- }), it(t, o.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && o.value && vt(t), j(t), k(t), s.value += 1;
3322
+ }), ct(t, o.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && o.value && St(t), A(t), k(t), s.value += 1;
3282
3323
  },
3283
3324
  onTransaction: ({ editor: e, transaction: t }) => {
3284
- if (j(e), (t.docChanged || rt(t)) && (s.value += 1), t.docChanged && v.value) {
3285
- let t = Xe(e, v.value.pos);
3325
+ if (A(e), (t.docChanged || st(t)) && (s.value += 1), t.docChanged && v.value) {
3326
+ let t = et(e, v.value.pos);
3286
3327
  v.value = t?.kind === v.value.kind ? t : null;
3287
3328
  }
3288
3329
  },
3289
3330
  onUpdate: ({ editor: t }) => {
3290
- k(t), o.value && O(t), x.value || e.onUpdate?.(ee(t));
3331
+ k(t), o.value && O(t), x.value || e.onUpdate?.(te(t));
3291
3332
  }
3292
3333
  });
3293
- let T = W(() => w.value ?? null);
3334
+ let T = U(() => w.value ?? null);
3294
3335
  function E() {
3295
- h.value = null, g.value = null, d.value = mt;
3336
+ h.value = null, g.value = null, d.value = vt;
3296
3337
  }
3297
3338
  function D(e) {
3298
- let t = pt(e.state);
3339
+ let t = _t(e.state);
3299
3340
  if (!t) {
3300
- d.value = d.value.name === "idle" ? d.value : mt, h.value = null, g.value = null;
3341
+ d.value = d.value.name === "idle" ? d.value : vt, h.value = null, g.value = null;
3301
3342
  return;
3302
3343
  }
3303
3344
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3304
- h.value = ft(n, {
3345
+ h.value = gt(n, {
3305
3346
  frameRect: i,
3306
3347
  triggerRect: r
3307
- }), d.value = dt(d.value, t);
3348
+ }), d.value = ht(d.value, t);
3308
3349
  }
3309
3350
  function O(e) {
3310
3351
  D(e.view);
3311
3352
  }
3312
3353
  function k(e) {
3313
- c.value = B(e);
3314
- let t = Qe(e);
3315
- t && (et(e, t, !0), v.value = t);
3316
- let n = ge(e);
3354
+ c.value = ce(e);
3355
+ let t = nt(e);
3356
+ t && (it(e, t, !0), v.value = t);
3357
+ let n = be(e);
3317
3358
  n.active && n.language === "mermaid" && (_.value = n.mermaidPreviewMode);
3318
3359
  }
3319
- function j(e) {
3320
- y.value = ur(e);
3360
+ function A(e) {
3361
+ y.value = mr(e);
3321
3362
  }
3322
- let M = W(() => T.value ? ge(T.value) : lr), I = W(() => T.value ? yt(T.value.state) : cr), L = W(() => c.value?.currentNode === "codeBlock"), R = W(() => L.value && M.value.language === "mermaid"), ne = W(() => T.value ? ot({
3363
+ let M = U(() => T.value ? be(T.value) : pr), N = U(() => T.value ? Ct(T.value.state) : fr), L = U(() => c.value?.currentNode === "codeBlock"), R = U(() => L.value && M.value.language === "mermaid"), ne = U(() => T.value ? ut({
3323
3364
  active: R.value,
3324
3365
  mode: _.value,
3325
3366
  source: M.value.text
3326
- }) : ot({
3367
+ }) : ut({
3327
3368
  active: !1,
3328
3369
  mode: "code",
3329
3370
  source: ""
3330
- })), re = W(() => T.value ? _t(T.value.state) : null), z = W(() => T.value ? de(T.value.state.doc) : le.items), ie = W(() => fe(z.value, b.value)), se = W(() => ce(z.value, ie.value)), pe = W(() => st(d.value.query, i)), me = W(() => oe({
3371
+ })), re = U(() => T.value ? xt(T.value.state) : null), z = U(() => T.value ? pe(T.value.state.doc) : de.items), ie = U(() => me(z.value, b.value)), ae = U(() => ue(z.value, ie.value)), le = U(() => dt(d.value.query, i)), he = U(() => se({
3331
3372
  revision: s.value,
3332
3373
  mode: a.value,
3333
3374
  editable: o.value,
3334
- toc: se.value,
3375
+ toc: ae.value,
3335
3376
  selection: c.value,
3336
3377
  slash: d.value,
3337
- table: I.value,
3378
+ table: N.value,
3338
3379
  tableInteraction: y.value,
3339
3380
  codeBlock: M.value,
3340
3381
  mermaid: ne.value,
3341
3382
  tableDebugSnapshot: re.value
3342
- })), he = {
3383
+ })), ge = {
3343
3384
  closeSlashMenu: E,
3344
- focusFirstTableBodyCell: () => T.value ? vt(T.value) : !1,
3385
+ focusFirstTableBodyCell: () => T.value ? St(T.value) : !1,
3345
3386
  setContent: (e, t = {}) => {
3346
3387
  if (!T.value) return !1;
3347
- let n = F(t.format);
3388
+ let n = I(t.format);
3348
3389
  return T.value.commands.setContent(e, {
3349
3390
  contentType: P(n),
3350
3391
  emitUpdate: t.emitUpdate ?? !1
3351
- }), t.focusFirstTableBodyCell && vt(T.value), k(T.value), o.value && O(T.value), j(T.value), s.value += 1, !0;
3392
+ }), t.focusFirstTableBodyCell && St(T.value), k(T.value), o.value && O(T.value), A(T.value), s.value += 1, !0;
3352
3393
  }
3353
3394
  };
3354
3395
  function _e(e, t) {
3355
- if (!(!T.value || !o.value || !ct(e))) {
3396
+ if (!(!T.value || !o.value || !ft(e))) {
3356
3397
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
3357
3398
  g.value = e;
3358
3399
  return;
3359
3400
  }
3360
- ut(T.value, d.value, e, t), d.value = ht(d.value, { type: "execute" }), E();
3401
+ mt(T.value, d.value, e, t), d.value = yt(d.value, { type: "execute" }), E();
3361
3402
  }
3362
3403
  }
3363
3404
  function ve(e) {
3364
3405
  if (!T.value || g.value || !o.value) return;
3365
- let t = lt(d.value, pe.value, e.key, { isComposing: e.isComposing || N(T.value.state) });
3406
+ let t = pt(d.value, le.value, e.key, { isComposing: e.isComposing || ee(T.value.state) });
3366
3407
  if (t.type !== "ignore") {
3367
3408
  if (e.preventDefault(), t.type === "close") {
3368
- d.value = ht(d.value, { type: "escape" }), E();
3409
+ d.value = yt(d.value, { type: "escape" }), E();
3369
3410
  return;
3370
3411
  }
3371
3412
  if (t.type === "move-active") {
3372
- d.value = ht(d.value, {
3413
+ d.value = yt(d.value, {
3373
3414
  type: "move-active",
3374
3415
  delta: t.delta,
3375
3416
  optionCount: t.optionCount
@@ -3379,22 +3420,22 @@ function Er(e = {}) {
3379
3420
  _e(t.command);
3380
3421
  }
3381
3422
  }
3382
- G(() => [e.mode, e.editable], () => {
3423
+ W(() => [e.mode, e.editable], () => {
3383
3424
  a.value = l(e.mode), T.value && (T.value.setEditable(o.value), u(T.value, {
3384
3425
  mode: a.value,
3385
3426
  editable: o.value
3386
- }), it(T.value, o.value ? "live" : "view"), o.value || E());
3387
- }, { immediate: !0 }), G(() => e.content, (t) => {
3388
- !T.value || t === void 0 || te(T.value, t, F(e.contentFormat)) || (x.value = !0, T.value.commands.setContent(t, {
3389
- contentType: P(F(e.contentFormat)),
3427
+ }), ct(T.value, o.value ? "live" : "view"), o.value || E());
3428
+ }, { immediate: !0 }), W(() => e.content, (t) => {
3429
+ !T.value || t === void 0 || F(T.value, t, I(e.contentFormat)) || (x.value = !0, T.value.commands.setContent(t, {
3430
+ contentType: P(I(e.contentFormat)),
3390
3431
  emitUpdate: !1
3391
- }), x.value = !1, k(T.value), o.value && O(T.value), j(T.value), s.value += 1);
3392
- }), G(me, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), G(se, (t) => e.onTocChange?.(t), { immediate: !0 }), G(z, (e) => {
3393
- let t = fe(e, b.value);
3432
+ }), x.value = !1, k(T.value), o.value && O(T.value), A(T.value), s.value += 1);
3433
+ }), W(he, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), W(ae, (t) => e.onTocChange?.(t), { immediate: !0 }), W(z, (e) => {
3434
+ let t = me(e, b.value);
3394
3435
  b.value !== t && (b.value = t);
3395
3436
  });
3396
3437
  let ye = null;
3397
- return $t(() => {
3438
+ return G(() => {
3398
3439
  let e = () => {
3399
3440
  if (!T.value || !z.value.length) {
3400
3441
  b.value = null;
@@ -3402,12 +3443,12 @@ function Er(e = {}) {
3402
3443
  }
3403
3444
  let e = null;
3404
3445
  try {
3405
- e = ue(T.value, z.value);
3446
+ e = fe(T.value, z.value);
3406
3447
  } catch {
3407
3448
  return;
3408
3449
  }
3409
3450
  b.value !== e && (b.value = e);
3410
- }, t = () => window.requestAnimationFrame(e), n = dr(T.value?.view.dom ?? null);
3451
+ }, t = () => window.requestAnimationFrame(e), n = hr(T.value?.view.dom ?? null);
3411
3452
  window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), ye = () => {
3412
3453
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
3413
3454
  };
@@ -3415,12 +3456,12 @@ function Er(e = {}) {
3415
3456
  ye?.(), w.value?.destroy(), w.value = null;
3416
3457
  }), {
3417
3458
  editor: T,
3418
- runtimeSnapshot: me,
3419
- actions: he,
3459
+ runtimeSnapshot: he,
3460
+ actions: ge,
3420
3461
  __render: {
3421
3462
  messages: r,
3422
3463
  effectiveEditable: o,
3423
- tableFocusState: I,
3464
+ tableFocusState: N,
3424
3465
  tableInteractionState: y,
3425
3466
  codeBlockState: M,
3426
3467
  isCodeBlockActive: L,
@@ -3429,8 +3470,8 @@ function Er(e = {}) {
3429
3470
  setMermaidMode: (e) => {
3430
3471
  _.value = e;
3431
3472
  },
3432
- tocState: se,
3433
- filteredSlashCommands: pe,
3473
+ tocState: ae,
3474
+ filteredSlashCommands: le,
3434
3475
  slashState: d,
3435
3476
  slashMenuPosition: h,
3436
3477
  slashInputCommand: g,
@@ -3442,7 +3483,7 @@ function Er(e = {}) {
3442
3483
  }
3443
3484
  };
3444
3485
  }
3445
- var Dr = J({
3486
+ var jr = J({
3446
3487
  name: "MarkweaveEditor",
3447
3488
  props: {
3448
3489
  defaultContent: {
@@ -3473,6 +3514,10 @@ var Dr = J({
3473
3514
  type: Boolean,
3474
3515
  default: !0
3475
3516
  },
3517
+ innerTocPlacement: {
3518
+ type: String,
3519
+ default: "container"
3520
+ },
3476
3521
  autofocus: {
3477
3522
  type: Boolean,
3478
3523
  default: !1
@@ -3531,26 +3576,27 @@ var Dr = J({
3531
3576
  }
3532
3577
  },
3533
3578
  setup(e) {
3534
- let t = Er(e);
3579
+ let t = Ar(e);
3535
3580
  return () => {
3536
3581
  let n = t.editor.value;
3537
3582
  if (!n) return null;
3538
3583
  let i = t.__render;
3539
- return V("section", {
3584
+ return B("section", {
3540
3585
  class: ["markweave-editor-frame", e.className].filter(Boolean).join(" "),
3541
3586
  "aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
3542
3587
  "data-testid": "markweave-editor-frame",
3543
3588
  "data-markweave-mode": t.runtimeSnapshot.value.mode,
3544
3589
  "data-markweave-inner-toc": e.innerToc ? "true" : "false",
3590
+ "data-markweave-inner-toc-placement": he(e.innerTocPlacement),
3545
3591
  "data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
3546
3592
  "data-table-focus-mode": i.tableFocusState.value.mode,
3547
3593
  onKeydownCapture: i.handleEditorKeyDown
3548
3594
  }, [
3549
- i.effectiveEditable.value ? V(yr, {
3595
+ i.effectiveEditable.value ? B(Cr, {
3550
3596
  editor: n,
3551
3597
  messages: i.messages
3552
3598
  }) : null,
3553
- i.effectiveEditable.value ? V(xr, {
3599
+ i.effectiveEditable.value ? B(Tr, {
3554
3600
  commands: i.filteredSlashCommands.value,
3555
3601
  state: i.slashState.value,
3556
3602
  position: i.slashMenuPosition.value,
@@ -3560,7 +3606,7 @@ var Dr = J({
3560
3606
  onInputCommandChange: i.setSlashInputCommand,
3561
3607
  onUpload: e.onSlashCommandUpload
3562
3608
  }) : null,
3563
- i.effectiveEditable.value ? V(Sr, {
3609
+ i.effectiveEditable.value ? B(Er, {
3564
3610
  editor: n,
3565
3611
  active: i.tableFocusState.value.active,
3566
3612
  interactionState: i.tableInteractionState.value,
@@ -3569,11 +3615,11 @@ var Dr = J({
3569
3615
  onCommandResult: e.onTableCommandResult,
3570
3616
  onEditWithAi: e.onEditWithAi
3571
3617
  }) : null,
3572
- i.effectiveEditable.value ? V(Cr, {
3618
+ i.effectiveEditable.value ? B(Dr, {
3573
3619
  editor: n,
3574
3620
  focusState: i.tableFocusState.value
3575
3621
  }) : null,
3576
- V(wr, {
3622
+ B(Or, {
3577
3623
  editor: n,
3578
3624
  state: i.codeBlockState.value,
3579
3625
  active: i.effectiveEditable.value && i.isCodeBlockActive.value,
@@ -3581,22 +3627,23 @@ var Dr = J({
3581
3627
  onMermaidModeChange: i.setMermaidMode,
3582
3628
  readOnly: !i.effectiveEditable.value
3583
3629
  }),
3584
- e.innerToc && i.tocState.value.items.length ? V(Tr, {
3630
+ e.innerToc && i.tocState.value.items.length ? B(kr, {
3585
3631
  editor: n,
3586
3632
  state: i.tocState.value,
3587
3633
  messages: i.messages,
3588
- editable: i.effectiveEditable.value
3634
+ editable: i.effectiveEditable.value,
3635
+ placement: he(e.innerTocPlacement)
3589
3636
  }) : null,
3590
- i.effectiveEditable.value && i.mathTarget.value ? V(br, {
3637
+ i.effectiveEditable.value && i.mathTarget.value ? B(wr, {
3591
3638
  editor: n,
3592
3639
  messages: i.messages,
3593
3640
  target: i.mathTarget.value,
3594
3641
  onClose: () => i.mathTarget.value = null
3595
3642
  }) : null,
3596
- V(r, { editor: n })
3643
+ B(r, { editor: n })
3597
3644
  ]);
3598
3645
  };
3599
3646
  }
3600
3647
  });
3601
3648
  //#endregion
3602
- export { Dr as MarkweaveEditor, sr as createMarkweaveEditorExtensions, sr as createMarkweaveVue2EditorExtensions, Er as useMarkweaveEditorController };
3649
+ export { jr as MarkweaveEditor, dr as createMarkweaveEditorExtensions, dr as createMarkweaveVue2EditorExtensions, Ar as useMarkweaveEditorController };