@markweave/vue2 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -10,55 +10,55 @@ import { normalizeMarkweaveLinkCardAttrs as _, normalizeMarkweaveLinkCardHref as
10
10
  import { openMarkweaveImagePreview as b } from "markweave/internal/plugins/media/image-preview";
11
11
  import { createMarkweaveLightweightImageNodeViewRenderer as x } from "markweave/internal/plugins/media/lightweight-image-node-view";
12
12
  import { resolveMarkweaveMediaSource as S } from "markweave/internal/plugins/media/media-source";
13
- import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as M, normalizeMarkweaveCoreImageAlign as ee, normalizeMarkweaveVideoEmbedUrl as N, numberAttribute as P, stringAttribute as F } from "markweave/internal/plugins/media/core-media-nodes";
14
- import { detectUploadSource as I, getDirectUploadResult as L, resolveMarkweaveUploadResult as te } from "markweave/internal/plugins/slash-command/upload";
13
+ import { MarkweaveCoreImage as C, MarkweaveCoreVideo as w, attrsFromMarkweaveImageUploadResult as T, attrsFromMarkweaveVideoUploadResult as E, attrsFromMarkweaveVideoUrl as D, clampMarkweaveImageWidth as O, createMarkweaveImageUploadRequest as k, createMarkweaveVideoUploadRequest as A, downloadMarkweaveImage as j, markweaveVideoIframeAllow as ee, normalizeMarkweaveCoreImageAlign as te, normalizeMarkweaveVideoEmbedUrl as M, numberAttribute as N, stringAttribute as P } from "markweave/internal/plugins/media/core-media-nodes";
14
+ import { detectUploadSource as F, getDirectUploadResult as I, resolveMarkweaveUploadResult as L } from "markweave/internal/plugins/slash-command/upload";
15
15
  import { createMarkweaveAiEditController as R } from "markweave";
16
16
  import { BubbleMenu as z } from "@tiptap/vue-2/menus";
17
- import { isEditorComposing as ne } from "markweave/internal/editor-core/composition-guard";
18
- import { saveMarkweaveBrowserFile as re } from "markweave/internal/core/browser-file-save";
19
- import { createMarkweaveFrameScheduler as B } from "markweave/internal/editor-core/frame-scheduler";
20
- import { createMarkweaveEditorUpdatePayload as ie, getMarkweaveContentType as ae, isEditorContentCurrent as oe, isMarkweaveControlledContentEchoCurrent as se, normalizeMarkweaveContentFormat as V } from "markweave/internal/editor-core/editor-content";
21
- import { getCurrentFloatingToolbarBlockType as ce, getFloatingToolbarHighlightColorOptions as le, getFloatingToolbarMoreActions as ue, getFloatingToolbarTextColorOptions as de, getFloatingToolbarTurnIntoOptions as fe, runFloatingToolbarMoreAction as pe, setFloatingToolbarTurnInto as me } from "markweave/internal/editor-core/floating-toolbar-model";
22
- import { openMarkweaveReadonlyLinkFromEvent as he } from "markweave/internal/editor-core/readonly-link";
23
- import { createMarkweaveEditorRuntimeSnapshot as ge } from "markweave/internal/editor-core/runtime-snapshot";
24
- import { areEditorSelectionSnapshotsEquivalent as _e, calculateFloatingToolbarPopoverPlacement as ve, createSelectionSnapshot as ye, markweaveRuntimeProjectionDelayMs as be, shouldShowFloatingToolbarForAiState as xe } from "markweave/internal/editor-core/selection-state";
25
- import { normalizeMarkweaveCanvasColor as Se, normalizeMarkweaveTheme as Ce } from "markweave/internal/core/theme";
26
- import { createMarkweaveAiEditController as we } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
27
- import { MarkweaveAskAiError as Te, acceptMarkweaveAskAiResult as Ee, calculateMarkweaveAskAiPanelPosition as De, canStartMarkweaveAskAiTableTarget as Oe, clearMarkweaveAskAiPreview as ke, clearMarkweaveAskAiTarget as Ae, createMarkweaveAskAiRequest as je, getMappedMarkweaveAskAiSelection as Me, getMarkweaveAskAiSurfaceRect as Ne, getMarkweaveAskAiTarget as Pe, getMarkweaveAskAiTargetRect as Fe, hasMarkweaveAskAiPreview as Ie, isMarkweaveAskAiSelectionEligible as Le, restoreMarkweaveAskAiTargetSelection as Re, runMarkweaveAskAiHandler as ze, setMarkweaveAskAiPreview as Be, startMarkweaveAskAiTableTarget as Ve, startMarkweaveAskAiTarget as He } from "markweave/internal/plugins/ask-ai/ask-ai-session";
28
- import { createMarkweaveTocState as Ue, emptyMarkweaveTocState as We, getActiveMarkweaveTocId as Ge, getMarkweaveTocItemsFromState as Ke, getValidMarkweaveTocActiveId as qe, normalizeMarkweaveInnerTocPlacement as Je, observeMarkweaveInnerTocContainerPosition as Ye, scrollToMarkweaveTocItem as Xe } from "markweave/internal/core/toc-state";
29
- import { codeBlockCollapsePluginKey as Ze, copyActiveCodeBlock as Qe, getActiveCodeBlockState as $e, getCodeBlockCopyFeedbackSnapshot as et, markweaveCodeBlockBehavior as tt, setCodeBlockCollapsedAtPosition as nt, setCodeBlockLanguageAtPosition as rt, setCodeBlockMermaidPreviewModeAtPosition as it } from "markweave/internal/plugins/codeblock/codeblock-behavior";
30
- import { calculateCodeBlockLanguageMenuPosition as at, clampFullscreenScale as ot, codeBlockCopyFeedbackTimeoutMs as st, copyCodeBlockText as ct, createCodeBlockLanguageMenuDomId as lt, createCodeBlockOverlayPosition as ut, createMermaidFullscreenViewerState as dt, createMermaidTabPosition as ft, focusCodeBlockTarget as pt, formatCodeBlockLanguageLabel as mt, formatFullscreenZoom as ht, getActiveCodeBlockElement as gt, getAnchoredRect as _t, getCodeBlockLanguageItems as vt, getCodeBlockLanguageOptionDomId as yt, getCodeBlockPositionFromEventTarget as bt, getCodeBlockStateAtPosition as xt, getFrameElement as St, getInitialCodeBlockLanguageItemIndex as Ct, getMermaidCodeBlockTargets as wt, getMermaidSvgMarkup as Tt, isCodeBlockTargetCollapsed as Et, mergeStableMermaidTabPositions as Dt, mermaidFullscreenZoomStep as Ot, moveCodeBlockLanguageItemIndex as kt, moveMermaidFullscreenViewer as At, scrollCodeBlockLanguageItemIntoView as jt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
31
- import { normalizeMarkdownLinkHref as Mt } from "markweave/internal/plugins/markdown/markdown-input";
32
- import { applyMarkweaveMathLatex as Nt, calculateMarkweaveMathPopoverPosition as Pt, getMarkweaveMathAnchorRect as Ft, getMarkweaveMathBlockIndex as It, getMarkweaveMathRenderedHtml as Lt, getMarkweaveMathTargetAtPos as Rt, getMarkweaveMathTargetFromDomEvent as zt, getMarkweaveMathTargetFromSelection as Bt, renderMarkweaveMathPreview as Vt, setMarkweaveMathEditingDomState as Ht, setMarkweaveMathEditingDomStateInView as Ut, setMarkweaveMathSelectionInView as Wt } from "markweave/internal/plugins/math/math-ui-model";
33
- import { isMermaidInlinePreviewTransaction as Gt, setMarkweaveMermaidTheme as Kt, setMermaidInlinePreviewEditorMode as qt, setReadonlyMermaidPreviewMode as Jt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
34
- import { getMermaidPreviewState as Yt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
35
- import { filterSlashCommands as Xt, isExecutableSlashCommand as Zt } from "markweave/internal/plugins/slash-command/command-spec";
36
- import { getSlashCommandKeyboardAction as Qt } from "markweave/internal/plugins/slash-command/slash-keyboard";
37
- import { areSlashCommandMenuPositionsEquivalent as $t, executeSlashCommand as en, getNextSlashCommandState as tn, getSlashCommandAnchoredMenuPosition as nn, getSlashCommandContext as rn, isSlashCommandAnchorVisible as an } from "markweave/internal/plugins/slash-command/slash-runtime";
38
- import { initialSlashCommandState as on, reduceSlashCommandState as sn } from "markweave/internal/plugins/slash-command/slash-state";
39
- import { setMarkweaveTableMenuAxisTarget as cn } from "markweave/internal/plugins/table/table-clipboard";
40
- import { getFirstTableDebugSnapshot as ln } from "markweave/internal/plugins/table/table-debug-snapshot";
41
- import { focusFirstTableBodyCell as un } from "markweave/internal/plugins/table/table-focus-position";
42
- import { getTableFocusState as dn } from "markweave/internal/plugins/table/table-focus-state";
43
- import { getTableSelectionOverlayState as fn, initialTableInteractionState as pn, tableInteractionPluginKey as mn } from "markweave/internal/plugins/table/table-interaction-layer";
44
- import { applyTableAxisAlignment as hn, applyTableAxisBackgroundColor as gn, applyTableAxisTextColor as _n, calculateAnchoredTableMenuPosition as vn, calculateAnchoredTableSubmenuPosition as yn, calculateTableAxisHandleLayout as bn, calculateTableExtendButtonLayout as xn, canRunTableCommand as Sn, executeTableMenuCommand as Cn, formatTableCopyFeedback as wn, getActiveTableElement as Tn, getAvailableCellMenuCommandSpecs as En, getTableAxisDropIndexAtPoint as Dn, getTableAxisFormattingState as On, getTableAxisTargetRect as kn, getTableControlAxisSelectionModel as An, getTableMenuBoundaryRect as jn, getTableMenuItemGroup as Mn, getTableMenuItemLabel as Nn, getTableMenuItems as Pn, getTableSelectionTargetRect as Fn, measureTableSelectionOverlay as In, moveTargetedTableAxis as Ln, selectTableAxisFromCell as Rn, tableColorOptions as zn, tableCopyFeedbackTimeoutMs as Bn, tableHorizontalAlignmentOptions as Vn, tableMenuLabel as Hn, tableVerticalAlignmentOptions as Un, targetTableAxisFromCell as Wn } from "markweave/internal/plugins/table/table-ui-model";
17
+ import { isEditorComposing as B } from "markweave/internal/editor-core/composition-guard";
18
+ import { saveMarkweaveBrowserFile as V } from "markweave/internal/core/browser-file-save";
19
+ import { createMarkweaveFrameScheduler as H } from "markweave/internal/editor-core/frame-scheduler";
20
+ import { createMarkweaveEditorUpdatePayload as ne, getMarkweaveContentType as re, isEditorContentCurrent as ie, isMarkweaveControlledContentEchoCurrent as ae, normalizeMarkweaveContentFormat as oe } from "markweave/internal/editor-core/editor-content";
21
+ import { getCurrentFloatingToolbarBlockType as se, getFloatingToolbarHighlightColorOptions as ce, getFloatingToolbarMoreActions as le, getFloatingToolbarTextColorOptions as ue, getFloatingToolbarTurnIntoOptions as de, runFloatingToolbarMoreAction as fe, setFloatingToolbarTurnInto as pe } from "markweave/internal/editor-core/floating-toolbar-model";
22
+ import { openMarkweaveReadonlyLinkFromEvent as me } from "markweave/internal/editor-core/readonly-link";
23
+ import { createMarkweaveEditorRuntimeSnapshot as he } from "markweave/internal/editor-core/runtime-snapshot";
24
+ import { areEditorSelectionSnapshotsEquivalent as ge, calculateFloatingToolbarPopoverPlacement as _e, createSelectionSnapshot as ve, markweaveRuntimeProjectionDelayMs as ye, shouldShowFloatingToolbarForAiState as be } from "markweave/internal/editor-core/selection-state";
25
+ import { normalizeMarkweaveCanvasColor as xe, normalizeMarkweaveTheme as Se } from "markweave/internal/core/theme";
26
+ import { createMarkweaveAiEditController as Ce } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
27
+ import { MarkweaveAskAiError as we, acceptMarkweaveAskAiResult as Te, calculateMarkweaveAskAiPanelPosition as Ee, canStartMarkweaveAskAiTableTarget as De, clearMarkweaveAskAiPreview as Oe, clearMarkweaveAskAiTarget as ke, createMarkweaveAskAiRequest as Ae, getMappedMarkweaveAskAiSelection as je, getMarkweaveAskAiSurfaceRect as Me, getMarkweaveAskAiTarget as Ne, getMarkweaveAskAiTargetRect as Pe, hasMarkweaveAskAiPreview as Fe, isMarkweaveAskAiSelectionEligible as Ie, restoreMarkweaveAskAiTargetSelection as Le, runMarkweaveAskAiHandler as Re, setMarkweaveAskAiPreview as ze, startMarkweaveAskAiTableTarget as Be, startMarkweaveAskAiTarget as Ve } from "markweave/internal/plugins/ask-ai/ask-ai-session";
28
+ import { createMarkweaveTocState as He, emptyMarkweaveTocState as Ue, getActiveMarkweaveTocId as We, getMarkweaveTocItemsFromState as Ge, getValidMarkweaveTocActiveId as Ke, normalizeMarkweaveInnerTocPlacement as qe, observeMarkweaveInnerTocContainerPosition as Je, scrollToMarkweaveTocItem as Ye } from "markweave/internal/core/toc-state";
29
+ import { codeBlockCollapsePluginKey as Xe, copyActiveCodeBlock as Ze, getActiveCodeBlockState as Qe, getCodeBlockCopyFeedbackSnapshot as $e, markweaveCodeBlockBehavior as et, setCodeBlockCollapsedAtPosition as tt, setCodeBlockLanguageAtPosition as nt, setCodeBlockMermaidPreviewModeAtPosition as rt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
30
+ import { calculateCodeBlockLanguageMenuPosition as it, clampFullscreenScale as at, codeBlockCopyFeedbackTimeoutMs as ot, copyCodeBlockText as st, createCodeBlockLanguageMenuDomId as ct, createCodeBlockOverlayPosition as lt, createMermaidFullscreenViewerState as ut, createMermaidTabPosition as dt, focusCodeBlockTarget as ft, formatCodeBlockLanguageLabel as pt, formatFullscreenZoom as mt, getActiveCodeBlockElement as ht, getAnchoredRect as gt, getCodeBlockLanguageItems as _t, getCodeBlockLanguageOptionDomId as vt, getCodeBlockPositionFromEventTarget as yt, getCodeBlockStateAtPosition as bt, getFrameElement as xt, getInitialCodeBlockLanguageItemIndex as St, getMermaidCodeBlockTargets as Ct, getMermaidSvgMarkup as wt, isCodeBlockTargetCollapsed as Tt, mergeStableMermaidTabPositions as Et, mermaidFullscreenZoomStep as Dt, moveCodeBlockLanguageItemIndex as Ot, moveMermaidFullscreenViewer as kt, scrollCodeBlockLanguageItemIntoView as At } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
31
+ import { normalizeMarkdownLinkHref as jt } from "markweave/internal/plugins/markdown/markdown-input";
32
+ import { applyMarkweaveMathLatex as Mt, calculateMarkweaveMathPopoverPosition as Nt, getMarkweaveMathAnchorRect as Pt, getMarkweaveMathBlockIndex as Ft, getMarkweaveMathRenderedHtml as It, getMarkweaveMathTargetAtPos as Lt, getMarkweaveMathTargetFromDomEvent as Rt, getMarkweaveMathTargetFromSelection as zt, renderMarkweaveMathPreview as Bt, setMarkweaveMathEditingDomState as Vt, setMarkweaveMathEditingDomStateInView as Ht, setMarkweaveMathSelectionInView as Ut } from "markweave/internal/plugins/math/math-ui-model";
33
+ import { isMermaidInlinePreviewTransaction as Wt, setMarkweaveMermaidTheme as Gt, setMermaidInlinePreviewEditorMode as Kt, setReadonlyMermaidPreviewMode as qt } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
34
+ import { getMermaidPreviewState as Jt } from "markweave/internal/plugins/mermaid/mermaid-renderer";
35
+ import { filterSlashCommands as Yt, isExecutableSlashCommand as Xt } from "markweave/internal/plugins/slash-command/command-spec";
36
+ import { getSlashCommandKeyboardAction as Zt } from "markweave/internal/plugins/slash-command/slash-keyboard";
37
+ import { areSlashCommandMenuPositionsEquivalent as Qt, executeSlashCommand as $t, getNextSlashCommandState as en, getSlashCommandAnchoredMenuPosition as tn, getSlashCommandContext as nn, isSlashCommandAnchorVisible as rn } from "markweave/internal/plugins/slash-command/slash-runtime";
38
+ import { initialSlashCommandState as an, reduceSlashCommandState as on } from "markweave/internal/plugins/slash-command/slash-state";
39
+ import { setMarkweaveTableMenuAxisTarget as sn } from "markweave/internal/plugins/table/table-clipboard";
40
+ import { getFirstTableDebugSnapshot as cn } from "markweave/internal/plugins/table/table-debug-snapshot";
41
+ import { focusFirstTableBodyCell as ln } from "markweave/internal/plugins/table/table-focus-position";
42
+ import { getTableFocusState as un } from "markweave/internal/plugins/table/table-focus-state";
43
+ import { getTableSelectionOverlayState as dn, initialTableInteractionState as fn, tableInteractionPluginKey as pn } from "markweave/internal/plugins/table/table-interaction-layer";
44
+ import { applyTableAxisAlignment as mn, applyTableAxisBackgroundColor as hn, applyTableAxisTextColor as gn, calculateAnchoredTableMenuPosition as _n, calculateAnchoredTableSubmenuPosition as vn, calculateTableAxisHandleLayout as yn, calculateTableExtendButtonLayout as bn, canRunTableCommand as xn, executeTableMenuCommand as Sn, formatTableCopyFeedback as Cn, getActiveTableElement as wn, getAvailableCellMenuCommandSpecs as Tn, getTableAxisDropIndexAtPoint as En, getTableAxisFormattingState as Dn, getTableAxisTargetRect as On, getTableControlAxisSelectionModel as kn, getTableMenuBoundaryRect as An, getTableMenuItemGroup as jn, getTableMenuItemLabel as Mn, getTableMenuItems as Nn, getTableSelectionTargetRect as Pn, measureTableSelectionOverlay as Fn, moveTargetedTableAxis as In, selectTableAxisFromCell as Ln, tableColorOptions as Rn, tableCopyFeedbackTimeoutMs as zn, tableHorizontalAlignmentOptions as Bn, tableMenuLabel as Vn, tableVerticalAlignmentOptions as Hn, targetTableAxisFromCell as Un } from "markweave/internal/plugins/table/table-ui-model";
45
45
  //#region src/vue2-compat.ts
46
- var Gn = l.default ?? l, Kn = null, qn = null, Jn = null;
47
- function Yn(e) {
46
+ var Wn = l.default ?? l, Gn = null, Kn = null, qn = null;
47
+ function Jn(e) {
48
48
  return !!(e && typeof e == "object" && "value" in e);
49
49
  }
50
- function Xn(e) {
50
+ function Yn(e) {
51
51
  let t = e.slice(2);
52
52
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
53
53
  }
54
- function Zn(e) {
54
+ function Xn(e) {
55
55
  let t = {}, n = {}, r = {}, i = {}, a = {};
56
56
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
57
57
  if (o === "class" || o === "style" || o === "key") {
58
58
  t[o] = s;
59
59
  continue;
60
60
  }
61
- if (o === "ref" && Yn(s)) {
61
+ if (o === "ref" && Jn(s)) {
62
62
  a.insert = (e) => {
63
63
  s.value = e.elm;
64
64
  }, a.destroy = () => {
@@ -67,7 +67,7 @@ function Zn(e) {
67
67
  continue;
68
68
  }
69
69
  if (/^on[A-Z]/.test(o)) {
70
- i[Xn(o)] = s;
70
+ i[Yn(o)] = s;
71
71
  continue;
72
72
  }
73
73
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -78,14 +78,14 @@ function Zn(e) {
78
78
  }
79
79
  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;
80
80
  }
81
- function Qn(e) {
81
+ function Zn(e) {
82
82
  let t = {}, n = {}, r = {}, i = {};
83
83
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
84
84
  if (a === "class" || a === "style" || a === "key") {
85
85
  t[a] = o;
86
86
  continue;
87
87
  }
88
- if (a === "ref" && Yn(o)) {
88
+ if (a === "ref" && Jn(o)) {
89
89
  i.insert = (e) => {
90
90
  o.value = e.componentInstance ?? e.elm;
91
91
  }, i.destroy = () => {
@@ -101,47 +101,47 @@ function Qn(e) {
101
101
  }
102
102
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
103
103
  }
104
- function $n(e) {
104
+ function Qn(e) {
105
105
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
106
106
  }
107
- function er(e) {
107
+ function $n(e) {
108
108
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
109
109
  }
110
- function tr(e) {
110
+ function er(e) {
111
111
  return e == null || Array.isArray(e) ? e : [e];
112
112
  }
113
- function nr(e) {
114
- return typeof e == "function" ? tr(e()) : $n(e) ? tr(e.default()) : er(e) ? [e] : e;
113
+ function tr(e) {
114
+ return typeof e == "function" ? er(e()) : Qn(e) ? er(e.default()) : $n(e) ? [e] : e;
115
115
  }
116
- function H(e, t, n) {
117
- if (!Jn) throw Error("Vue 2 render context is not available.");
118
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Zn(r) : Qn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : nr(n);
119
- return Jn(e, i, a);
116
+ function U(e, t, n) {
117
+ if (!qn) throw Error("Vue 2 render context is not available.");
118
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Xn(r) : Zn(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : tr(n);
119
+ return qn(e, i, a);
120
120
  }
121
- function U(e) {
122
- return Gn.observable({ value: e });
121
+ function W(e) {
122
+ return Wn.observable({ value: e });
123
123
  }
124
- var W = U;
125
- function G(e) {
124
+ var G = W;
125
+ function K(e) {
126
126
  return { get value() {
127
127
  return e();
128
128
  } };
129
129
  }
130
- function K(e, t, n) {
130
+ function q(e, t, n) {
131
131
  let r = typeof e == "function" ? e : () => e.value;
132
- return Kn?.$watch ? Kn.$watch(r, t, n) : () => void 0;
133
- }
134
- function rr(e) {
135
- qn?.mounted.push(e);
132
+ return Gn?.$watch ? Gn.$watch(r, t, n) : () => void 0;
136
133
  }
137
- function q(e) {
138
- qn?.beforeUnmount.push(e);
134
+ function nr(e) {
135
+ Kn?.mounted.push(e);
139
136
  }
140
137
  function J(e) {
141
- return Gn.nextTick(e);
138
+ Kn?.beforeUnmount.push(e);
142
139
  }
143
140
  function Y(e) {
144
- return Gn.extend({
141
+ return Wn.nextTick(e);
142
+ }
143
+ function X(e) {
144
+ return Wn.extend({
145
145
  name: e.name,
146
146
  props: e.props,
147
147
  created() {
@@ -149,12 +149,12 @@ function Y(e) {
149
149
  mounted: [],
150
150
  beforeUnmount: []
151
151
  };
152
- Kn = this, qn = t;
152
+ Gn = this, Kn = t;
153
153
  try {
154
154
  let n = e.setup?.(this.$props ?? this) ?? null;
155
155
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
156
156
  } finally {
157
- Kn = null, qn = null;
157
+ Gn = null, Kn = null;
158
158
  }
159
159
  },
160
160
  mounted() {
@@ -164,19 +164,19 @@ function Y(e) {
164
164
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
165
165
  },
166
166
  render(t) {
167
- Jn = t;
167
+ qn = t;
168
168
  try {
169
169
  let n = this.__markweaveVue2Render;
170
170
  return n ? n() : e.render?.(t) ?? null;
171
171
  } finally {
172
- Jn = null;
172
+ qn = null;
173
173
  }
174
174
  }
175
175
  });
176
176
  }
177
177
  //#endregion
178
178
  //#region src/vue2-icons.ts
179
- var ir = {
179
+ var rr = {
180
180
  AlignVerticalJustifyCenter: {
181
181
  iconName: "align-vertical-justify-center",
182
182
  node: [
@@ -1498,11 +1498,11 @@ var ir = {
1498
1498
  }]]
1499
1499
  }
1500
1500
  };
1501
- function ar(e) {
1502
- return e.map(([e, t]) => H(e, t));
1501
+ function ir(e) {
1502
+ return e.map(([e, t]) => U(e, t));
1503
1503
  }
1504
- function X(e) {
1505
- return Y({
1504
+ function Z(e) {
1505
+ return X({
1506
1506
  name: `MarkweaveVue2Icon${e}`,
1507
1507
  props: {
1508
1508
  size: {
@@ -1519,8 +1519,8 @@ function X(e) {
1519
1519
  }
1520
1520
  },
1521
1521
  setup(t) {
1522
- let n = ir[e];
1523
- return () => H("svg", {
1522
+ let n = rr[e];
1523
+ return () => U("svg", {
1524
1524
  class: `lucide lucide-${n.iconName}`,
1525
1525
  viewBox: "0 0 24 24",
1526
1526
  width: t.size,
@@ -1532,12 +1532,12 @@ function X(e) {
1532
1532
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1533
1533
  "aria-hidden": "true",
1534
1534
  focusable: "false"
1535
- }, ar(n.node));
1535
+ }, ir(n.node));
1536
1536
  }
1537
1537
  });
1538
1538
  }
1539
- var or = X("AlignCenter"), sr = X("AlignJustify"), cr = X("AlignLeft"), lr = X("AlignRight"), ur = X("AlignVerticalJustifyCenter"), dr = X("AlignVerticalJustifyEnd"), fr = X("AlignVerticalJustifyStart"), pr = X("AlertTriangle"), mr = X("ArrowDown"), hr = X("ArrowDownAZ"), gr = X("ArrowLeft"), _r = X("ArrowRight"), vr = X("ArrowUp"), yr = X("ArrowUpZA"), br = X("BetweenHorizontalEnd"), xr = X("BetweenHorizontalStart"), Sr = X("BetweenVerticalEnd"), Cr = X("BetweenVerticalStart"), wr = X("Bold"), Tr = X("Braces"), Er = X("Captions"), Dr = X("Check"), Or = X("CheckCircle2"), kr = X("ChevronDown"), Ar = X("ChevronRight"), jr = X("ChevronUp"), Mr = X("CircleX"), Nr = X("Code2"), Pr = X("CornerDownLeft"), Fr = X("Copy"), Ir = X("Download"), Lr = X("Eye"), Rr = X("ExternalLink"), zr = X("Heading1"), Br = X("Heading2"), Vr = X("Heading3"), Hr = X("Image"), Ur = X("ImageUp"), Wr = X("IndentDecrease"), Gr = X("IndentIncrease"), Kr = X("Info"), qr = X("Italic"), Jr = X("Lightbulb"), Yr = X("Link2"), Xr = X("List"), Zr = X("ListChecks"), Qr = X("ListOrdered"), $r = X("Minus"), ei = X("MoreVertical"), ti = X("PaintBucket"), ni = X("Paperclip"), ri = X("PencilLine"), ii = X("Plus"), ai = X("Quote"), oi = X("Replace"), si = X("RotateCcw"), ci = X("Sigma"), li = X("SmilePlus"), ui = X("Sparkles"), di = X("Square"), fi = X("SquareX"), pi = X("Strikethrough"), mi = X("Subscript"), hi = X("Superscript"), gi = X("Table2"), _i = X("TableCellsMerge"), vi = X("TableCellsSplit"), yi = X("Text"), bi = X("Trash2"), xi = X("Type"), Si = X("Underline"), Ci = X("Upload"), wi = X("Video"), Ti = X("X"), Ei = ee;
1540
- function Di(e) {
1539
+ var ar = Z("AlignCenter"), or = Z("AlignJustify"), sr = Z("AlignLeft"), cr = Z("AlignRight"), lr = Z("AlignVerticalJustifyCenter"), ur = Z("AlignVerticalJustifyEnd"), dr = Z("AlignVerticalJustifyStart"), fr = Z("AlertTriangle"), pr = Z("ArrowDown"), mr = Z("ArrowDownAZ"), hr = Z("ArrowLeft"), gr = Z("ArrowRight"), _r = Z("ArrowUp"), vr = Z("ArrowUpZA"), yr = Z("BetweenHorizontalEnd"), br = Z("BetweenHorizontalStart"), xr = Z("BetweenVerticalEnd"), Sr = Z("BetweenVerticalStart"), Cr = Z("Bold"), wr = Z("Braces"), Tr = Z("Captions"), Er = Z("Check"), Dr = Z("CheckCircle2"), Or = Z("ChevronDown"), kr = Z("ChevronRight"), Ar = Z("ChevronUp"), jr = Z("CircleX"), Mr = Z("Code2"), Nr = Z("CornerDownLeft"), Pr = Z("Copy"), Fr = Z("Download"), Ir = Z("Eye"), Lr = Z("ExternalLink"), Rr = Z("Heading1"), zr = Z("Heading2"), Br = Z("Heading3"), Vr = Z("Image"), Hr = Z("ImageUp"), Ur = Z("IndentDecrease"), Wr = Z("IndentIncrease"), Gr = Z("Info"), Kr = Z("Italic"), qr = Z("Lightbulb"), Jr = Z("Link2"), Yr = Z("List"), Xr = Z("ListChecks"), Zr = Z("ListOrdered"), Qr = Z("Minus"), $r = Z("MoreVertical"), ei = Z("PaintBucket"), ti = Z("Paperclip"), ni = Z("PencilLine"), ri = Z("Plus"), ii = Z("Quote"), ai = Z("Replace"), oi = Z("RotateCcw"), si = Z("Sigma"), ci = Z("SmilePlus"), li = Z("Sparkles"), ui = Z("Square"), di = Z("SquareX"), fi = Z("Strikethrough"), pi = Z("Subscript"), mi = Z("Superscript"), hi = Z("Table2"), gi = Z("TableCellsMerge"), _i = Z("TableCellsSplit"), vi = Z("Text"), yi = Z("Trash2"), bi = Z("Type"), xi = Z("Underline"), Si = Z("Upload"), Ci = Z("Video"), wi = Z("X"), Ti = te;
1540
+ function Ei(e) {
1541
1541
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1542
1542
  let n = t?.getAttribute("data-markweave-mode");
1543
1543
  return n === "view" ? {
@@ -1547,7 +1547,7 @@ function Di(e) {
1547
1547
  mode: "live",
1548
1548
  editable: e.isEditable
1549
1549
  } : u(e);
1550
- }, r = U(n()), i = m(e, () => {
1550
+ }, r = W(n()), i = m(e, () => {
1551
1551
  r.value = n();
1552
1552
  }), a = typeof MutationObserver > "u" || !t ? null : new MutationObserver(() => {
1553
1553
  r.value = n();
@@ -1555,28 +1555,28 @@ function Di(e) {
1555
1555
  return a && t && a.observe(t, {
1556
1556
  attributes: !0,
1557
1557
  attributeFilter: ["data-markweave-mode"]
1558
- }), q(() => {
1558
+ }), J(() => {
1559
1559
  i(), a?.disconnect();
1560
1560
  }), r;
1561
1561
  }
1562
- function Oi(e) {
1562
+ function Di(e) {
1563
1563
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1564
1564
  }
1565
- function ki(e) {
1565
+ function Oi(e) {
1566
1566
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1567
1567
  }
1568
- function Ai(e) {
1568
+ function ki(e) {
1569
1569
  return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
1570
1570
  }
1571
- function ji(e, t) {
1572
- return H(e, {
1571
+ function Ai(e, t) {
1572
+ return U(e, {
1573
1573
  size: 18,
1574
1574
  strokeWidth: 1.8,
1575
1575
  "aria-hidden": "true"
1576
1576
  }, { default: () => t });
1577
1577
  }
1578
- function Mi(e) {
1579
- return H("button", {
1578
+ function ji(e) {
1579
+ return U("button", {
1580
1580
  type: "button",
1581
1581
  "aria-label": e.label,
1582
1582
  title: e.label,
@@ -1584,14 +1584,14 @@ function Mi(e) {
1584
1584
  "data-active": e.active ? "true" : "false",
1585
1585
  onMousedown: (e) => e.preventDefault(),
1586
1586
  onClick: e.onClick
1587
- }, [ji(e.icon, e.label), H("span", {
1587
+ }, [Ai(e.icon, e.label), U("span", {
1588
1588
  class: "markweave-image-tooltip",
1589
1589
  role: "tooltip"
1590
1590
  }, e.label)]);
1591
1591
  }
1592
- function Ni(e) {
1593
- let t = U(null), n = e.messages.image;
1594
- return H("section", {
1592
+ function Mi(e) {
1593
+ let t = W(null), n = e.messages.image;
1594
+ return U("section", {
1595
1595
  class: "markweave-image-upload-placeholder",
1596
1596
  "data-testid": "markweave-image-upload-placeholder",
1597
1597
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1609,7 +1609,7 @@ function Ni(e) {
1609
1609
  n && e.onFile(n);
1610
1610
  }
1611
1611
  }, [
1612
- H("input", {
1612
+ U("input", {
1613
1613
  ref: t,
1614
1614
  "data-testid": "markweave-image-file-input",
1615
1615
  type: "file",
@@ -1620,20 +1620,20 @@ function Ni(e) {
1620
1620
  r && e.onFile(r), n.value = "";
1621
1621
  }
1622
1622
  }),
1623
- H("div", {
1623
+ U("div", {
1624
1624
  class: "markweave-image-upload-icon",
1625
1625
  "aria-hidden": "true"
1626
- }, [H(Ur, {
1626
+ }, [U(Hr, {
1627
1627
  size: 46,
1628
1628
  strokeWidth: 1.6
1629
1629
  })]),
1630
- H("div", { class: "markweave-image-upload-copy" }, [H("button", {
1630
+ U("div", { class: "markweave-image-upload-copy" }, [U("button", {
1631
1631
  type: "button",
1632
1632
  onClick: () => t.value?.click()
1633
- }, n.clickToUpload), H("span", null, n.dragAndDrop)]),
1634
- H("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1635
- H("div", { class: "markweave-image-upload-row" }, [
1636
- H("input", {
1633
+ }, n.clickToUpload), U("span", null, n.dragAndDrop)]),
1634
+ U("div", { class: "markweave-image-upload-note" }, n.uploadNote),
1635
+ U("div", { class: "markweave-image-upload-row" }, [
1636
+ U("input", {
1637
1637
  "data-testid": "markweave-image-url-input",
1638
1638
  value: e.inputValue,
1639
1639
  placeholder: n.uploadInputPlaceholder,
@@ -1643,30 +1643,30 @@ function Ni(e) {
1643
1643
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1644
1644
  }
1645
1645
  }),
1646
- H("button", {
1646
+ U("button", {
1647
1647
  type: "button",
1648
1648
  "data-testid": "markweave-image-upload-submit",
1649
1649
  disabled: e.isSubmitting || !e.inputValue.trim(),
1650
1650
  onClick: e.onSubmit
1651
- }, [H(Ur, {
1651
+ }, [U(Hr, {
1652
1652
  size: 16,
1653
1653
  strokeWidth: 1.8
1654
1654
  }), e.messages.common.insert]),
1655
- H("button", {
1655
+ U("button", {
1656
1656
  type: "button",
1657
1657
  "data-testid": "markweave-image-upload-cancel",
1658
1658
  onClick: e.onCancel
1659
1659
  }, e.messages.common.cancel)
1660
1660
  ]),
1661
- e.error ? H("div", {
1661
+ e.error ? U("div", {
1662
1662
  class: "markweave-image-upload-error",
1663
1663
  role: "alert"
1664
1664
  }, e.error) : null
1665
1665
  ]);
1666
1666
  }
1667
- function Pi(e) {
1668
- let t = U(null), n = e.messages.video;
1669
- return H("section", {
1667
+ function Ni(e) {
1668
+ let t = W(null), n = e.messages.video;
1669
+ return U("section", {
1670
1670
  class: "markweave-video-upload-placeholder",
1671
1671
  "data-testid": "markweave-video-upload-placeholder",
1672
1672
  "data-drag-active": e.dragActive ? "true" : "false",
@@ -1684,7 +1684,7 @@ function Pi(e) {
1684
1684
  n && e.onFile(n);
1685
1685
  }
1686
1686
  }, [
1687
- H("input", {
1687
+ U("input", {
1688
1688
  ref: t,
1689
1689
  "data-testid": "markweave-video-file-input",
1690
1690
  type: "file",
@@ -1695,20 +1695,20 @@ function Pi(e) {
1695
1695
  r && e.onFile(r), n.value = "";
1696
1696
  }
1697
1697
  }),
1698
- H("div", {
1698
+ U("div", {
1699
1699
  class: "markweave-video-upload-icon",
1700
1700
  "aria-hidden": "true"
1701
- }, [H(wi, {
1701
+ }, [U(Ci, {
1702
1702
  size: 46,
1703
1703
  strokeWidth: 1.6
1704
1704
  })]),
1705
- H("div", { class: "markweave-video-upload-copy" }, [H("button", {
1705
+ U("div", { class: "markweave-video-upload-copy" }, [U("button", {
1706
1706
  type: "button",
1707
1707
  onClick: () => t.value?.click()
1708
- }, n.clickToUpload), H("span", null, n.dragAndDrop)]),
1709
- H("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1710
- H("div", { class: "markweave-video-upload-row" }, [
1711
- H("input", {
1708
+ }, n.clickToUpload), U("span", null, n.dragAndDrop)]),
1709
+ U("div", { class: "markweave-video-upload-note" }, n.uploadNote),
1710
+ U("div", { class: "markweave-video-upload-row" }, [
1711
+ U("input", {
1712
1712
  "data-testid": "markweave-video-url-input",
1713
1713
  value: e.inputValue,
1714
1714
  placeholder: n.uploadInputPlaceholder,
@@ -1718,28 +1718,28 @@ function Pi(e) {
1718
1718
  t.key === "Enter" && (t.preventDefault(), e.onSubmit());
1719
1719
  }
1720
1720
  }),
1721
- H("button", {
1721
+ U("button", {
1722
1722
  type: "button",
1723
1723
  "data-testid": "markweave-video-upload-submit",
1724
1724
  disabled: e.isSubmitting || !e.inputValue.trim(),
1725
1725
  onClick: e.onSubmit
1726
- }, [H(Ci, {
1726
+ }, [U(Si, {
1727
1727
  size: 16,
1728
1728
  strokeWidth: 1.8
1729
1729
  }), e.messages.common.insert]),
1730
- H("button", {
1730
+ U("button", {
1731
1731
  type: "button",
1732
1732
  "data-testid": "markweave-video-upload-cancel",
1733
1733
  onClick: e.onCancel
1734
1734
  }, e.messages.common.cancel)
1735
1735
  ]),
1736
- e.error ? H("div", {
1736
+ e.error ? U("div", {
1737
1737
  class: "markweave-video-upload-error",
1738
1738
  role: "alert"
1739
1739
  }, e.error) : null
1740
1740
  ]);
1741
1741
  }
1742
- var Fi = Y({
1742
+ var Pi = X({
1743
1743
  name: "MarkweaveVueImageNodeView",
1744
1744
  props: {
1745
1745
  editor: {
@@ -1772,8 +1772,8 @@ var Fi = Y({
1772
1772
  }
1773
1773
  },
1774
1774
  setup(e) {
1775
- let t = U(null), r = U(!1), i = U(!1), a = U(!1), o = U(""), c = U(null), l = U(!1), u = G(() => e.node.attrs), f = U(!!F(u.value.caption)), p = U(F(u.value.caption) ?? ""), m = Di(e.editor), h = G(() => d(m.value)), g = G(() => e.extension.options?.messages ?? n("zh")), _ = G(() => g.value.image), v = G(() => F(u.value.src)), y = G(() => e.extension.options?.resolveMediaSource), x = U(null), C = null;
1776
- K(v, (t) => {
1775
+ let t = W(null), r = W(!1), i = W(!1), a = W(!1), o = W(""), c = W(null), l = W(!1), u = K(() => e.node.attrs), f = W(!!P(u.value.caption)), p = W(P(u.value.caption) ?? ""), m = Ei(e.editor), h = K(() => d(m.value)), g = K(() => e.extension.options?.messages ?? n("zh")), _ = K(() => g.value.image), v = K(() => P(u.value.src)), y = K(() => e.extension.options?.resolveMediaSource), x = W(null), C = null;
1776
+ q(v, (t) => {
1777
1777
  if (C?.abort(), C = null, !t) {
1778
1778
  x.value = null;
1779
1779
  return;
@@ -1792,11 +1792,11 @@ var Fi = Y({
1792
1792
  }).then((e) => {
1793
1793
  r.signal.aborted || (x.value = e);
1794
1794
  });
1795
- }, { immediate: !0 }), q(() => C?.abort());
1796
- let w = G(() => x.value?.src ?? (y.value ? null : v.value)), E = G(() => Ei(u.value.align)), D = G(() => P(u.value.width)), A = G(() => F(u.value.caption)), M = G(() => h.value && (!v.value || i.value)), ee = () => {
1795
+ }, { immediate: !0 }), J(() => C?.abort());
1796
+ let w = K(() => x.value?.src ?? (y.value ? null : v.value)), E = K(() => Ti(u.value.align)), D = K(() => N(u.value.width)), A = K(() => P(u.value.caption)), ee = K(() => h.value && (!v.value || i.value)), te = () => {
1797
1797
  w.value && b({
1798
1798
  src: w.value,
1799
- alt: F(u.value.alt) ?? "",
1799
+ alt: P(u.value.alt) ?? "",
1800
1800
  messages: {
1801
1801
  dialogAriaLabel: _.value.previewDialogAriaLabel,
1802
1802
  zoomOut: _.value.previewZoomOut,
@@ -1806,14 +1806,14 @@ var Fi = Y({
1806
1806
  }
1807
1807
  });
1808
1808
  };
1809
- K(A, (e) => {
1809
+ q(A, (e) => {
1810
1810
  f.value || (p.value = e ?? "");
1811
1811
  });
1812
- let N = () => {
1812
+ let M = () => {
1813
1813
  if (!h.value) return;
1814
1814
  let t = e.getPos();
1815
1815
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
1816
- }, L = () => {
1816
+ }, I = () => {
1817
1817
  if (o.value = "", c.value = null, a.value = !1, v.value) {
1818
1818
  i.value = !1;
1819
1819
  return;
@@ -1824,7 +1824,7 @@ var Fi = Y({
1824
1824
  let n = e.extension.options;
1825
1825
  l.value = !0, c.value = null;
1826
1826
  try {
1827
- let r = await te(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1827
+ let r = await L(k(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1828
1828
  e.updateAttributes(T(u.value, r)), o.value = "", i.value = !1;
1829
1829
  } catch (e) {
1830
1830
  c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
@@ -1836,18 +1836,18 @@ var Fi = Y({
1836
1836
  c.value = _.value.uploadRequiredError;
1837
1837
  return;
1838
1838
  }
1839
- R(I(o.value));
1840
- }, ne = (e) => {
1839
+ R(F(o.value));
1840
+ }, B = (e) => {
1841
1841
  R({
1842
1842
  type: "file",
1843
1843
  file: e,
1844
1844
  mimeType: e.type || "image/*"
1845
1845
  });
1846
- }, re = () => {
1846
+ }, V = () => {
1847
1847
  f.value = !f.value, f.value && (p.value = A.value ?? "");
1848
- }, B = (n, r) => {
1848
+ }, H = (n, r) => {
1849
1849
  if (!h.value || !v.value) return;
1850
- r.preventDefault(), r.stopPropagation(), N();
1850
+ r.preventDefault(), r.stopPropagation(), M();
1851
1851
  let i = t.value;
1852
1852
  if (!i) return;
1853
1853
  let a = r.clientX, o = i.getBoundingClientRect().width || D.value || 320, s = i.closest(".markweave-editor-surface")?.getBoundingClientRect().width ?? i.parentElement?.getBoundingClientRect().width ?? o, c = (t) => {
@@ -1858,7 +1858,7 @@ var Fi = Y({
1858
1858
  };
1859
1859
  window.addEventListener("pointermove", c), window.addEventListener("pointerup", l, { once: !0 });
1860
1860
  };
1861
- return () => M.value ? H(s, {
1861
+ return () => ee.value ? U(s, {
1862
1862
  as: "figure",
1863
1863
  class: "markweave-image-node",
1864
1864
  "data-testid": "markweave-image-node",
@@ -1866,7 +1866,7 @@ var Fi = Y({
1866
1866
  "data-selected": "false",
1867
1867
  "data-hovered": "false",
1868
1868
  "data-empty": "true"
1869
- }, () => Ni({
1869
+ }, () => Mi({
1870
1870
  messages: g.value,
1871
1871
  inputValue: o.value,
1872
1872
  error: c.value,
@@ -1875,13 +1875,13 @@ var Fi = Y({
1875
1875
  onInputValue: (e) => {
1876
1876
  o.value = e;
1877
1877
  },
1878
- onFile: ne,
1878
+ onFile: B,
1879
1879
  onSubmit: z,
1880
- onCancel: L,
1880
+ onCancel: I,
1881
1881
  onDragActive: (e) => {
1882
1882
  a.value = e;
1883
1883
  }
1884
- })) : H(s, {
1884
+ })) : U(s, {
1885
1885
  as: "figure",
1886
1886
  class: "markweave-image-node",
1887
1887
  "data-testid": "markweave-image-node",
@@ -1896,81 +1896,81 @@ var Fi = Y({
1896
1896
  r.value = !1;
1897
1897
  },
1898
1898
  onMousedown: (e) => {
1899
- h.value && !Oi(e.target) && N();
1899
+ h.value && !Di(e.target) && M();
1900
1900
  }
1901
1901
  }, () => [
1902
- h.value ? H("div", {
1902
+ h.value ? U("div", {
1903
1903
  class: "markweave-image-toolbar",
1904
1904
  "data-testid": "markweave-image-toolbar",
1905
1905
  "data-markweave-image-ui": "true",
1906
1906
  "aria-label": _.value.toolsAriaLabel
1907
1907
  }, [
1908
- Mi({
1908
+ ji({
1909
1909
  testId: "markweave-image-align-left",
1910
1910
  label: _.value.alignLeft,
1911
- icon: cr,
1911
+ icon: sr,
1912
1912
  active: E.value === "left",
1913
1913
  onClick: () => e.updateAttributes({ align: "left" })
1914
1914
  }),
1915
- Mi({
1915
+ ji({
1916
1916
  testId: "markweave-image-align-center",
1917
1917
  label: _.value.alignCenter,
1918
- icon: or,
1918
+ icon: ar,
1919
1919
  active: E.value === "center",
1920
1920
  onClick: () => e.updateAttributes({ align: "center" })
1921
1921
  }),
1922
- Mi({
1922
+ ji({
1923
1923
  testId: "markweave-image-align-right",
1924
1924
  label: _.value.alignRight,
1925
- icon: lr,
1925
+ icon: cr,
1926
1926
  active: E.value === "right",
1927
1927
  onClick: () => e.updateAttributes({ align: "right" })
1928
1928
  }),
1929
- H("span", {
1929
+ U("span", {
1930
1930
  class: "markweave-image-toolbar-divider",
1931
1931
  "aria-hidden": "true"
1932
1932
  }),
1933
- Mi({
1933
+ ji({
1934
1934
  testId: "markweave-image-caption",
1935
1935
  label: _.value.caption,
1936
- icon: Er,
1936
+ icon: Tr,
1937
1937
  active: f.value || !!A.value,
1938
- onClick: re
1938
+ onClick: V
1939
1939
  }),
1940
- Mi({
1940
+ ji({
1941
1941
  testId: "markweave-image-preview",
1942
1942
  label: _.value.preview,
1943
- icon: Lr,
1944
- onClick: ee
1943
+ icon: Ir,
1944
+ onClick: te
1945
1945
  }),
1946
- Mi({
1946
+ ji({
1947
1947
  testId: "markweave-image-download",
1948
1948
  label: _.value.download,
1949
- icon: Ir,
1949
+ icon: Fr,
1950
1950
  onClick: () => {
1951
1951
  w.value && j(w.value);
1952
1952
  }
1953
1953
  }),
1954
- Mi({
1954
+ ji({
1955
1955
  testId: "markweave-image-replace",
1956
1956
  label: _.value.replace,
1957
- icon: oi,
1957
+ icon: ai,
1958
1958
  onClick: () => {
1959
1959
  o.value = "", c.value = null, i.value = !0;
1960
1960
  }
1961
1961
  }),
1962
- H("span", {
1962
+ U("span", {
1963
1963
  class: "markweave-image-toolbar-divider",
1964
1964
  "aria-hidden": "true"
1965
1965
  }),
1966
- Mi({
1966
+ ji({
1967
1967
  testId: "markweave-image-delete",
1968
1968
  label: _.value.delete,
1969
- icon: bi,
1969
+ icon: yi,
1970
1970
  onClick: () => e.deleteNode()
1971
1971
  })
1972
1972
  ]) : null,
1973
- H("div", {
1973
+ U("div", {
1974
1974
  ref: t,
1975
1975
  class: "markweave-image-box",
1976
1976
  style: {
@@ -1978,22 +1978,22 @@ var Fi = Y({
1978
1978
  ...x.value?.width && x.value.height ? { aspectRatio: `${x.value.width} / ${x.value.height}` } : {}
1979
1979
  }
1980
1980
  }, [
1981
- w.value ? H("img", {
1981
+ w.value ? U("img", {
1982
1982
  class: "markweave-image",
1983
1983
  src: w.value,
1984
- alt: F(u.value.alt) ?? "",
1985
- title: F(u.value.title) ?? void 0,
1984
+ alt: P(u.value.alt) ?? "",
1985
+ title: P(u.value.title) ?? void 0,
1986
1986
  draggable: !1,
1987
1987
  loading: "lazy",
1988
1988
  decoding: "async",
1989
1989
  width: x.value?.width,
1990
1990
  height: x.value?.height
1991
- }) : H("div", {
1991
+ }) : U("div", {
1992
1992
  class: "markweave-image-readonly-empty",
1993
1993
  "data-testid": "markweave-image-readonly-empty",
1994
1994
  "aria-hidden": "true"
1995
1995
  }),
1996
- !h.value && w.value ? H("button", {
1996
+ !h.value && w.value ? U("button", {
1997
1997
  type: "button",
1998
1998
  class: "markweave-image-preview-trigger",
1999
1999
  "data-testid": "markweave-image-preview",
@@ -2001,34 +2001,34 @@ var Fi = Y({
2001
2001
  "aria-label": _.value.preview,
2002
2002
  title: _.value.preview,
2003
2003
  onMousedown: (e) => e.preventDefault(),
2004
- onClick: ee
2005
- }, [H(Lr, {
2004
+ onClick: te
2005
+ }, [U(Ir, {
2006
2006
  size: 16,
2007
2007
  strokeWidth: 1.8
2008
- }), H("span", {
2008
+ }), U("span", {
2009
2009
  class: "markweave-image-tooltip",
2010
2010
  role: "tooltip"
2011
2011
  }, _.value.preview)]) : null,
2012
- h.value ? H("button", {
2012
+ h.value ? U("button", {
2013
2013
  type: "button",
2014
2014
  class: "markweave-image-resize-handle",
2015
2015
  "data-testid": "markweave-image-resize-left",
2016
2016
  "data-side": "left",
2017
2017
  "aria-label": _.value.resizeLeft,
2018
2018
  "data-markweave-image-ui": "true",
2019
- onPointerdown: (e) => B("left", e)
2019
+ onPointerdown: (e) => H("left", e)
2020
2020
  }) : null,
2021
- h.value ? H("button", {
2021
+ h.value ? U("button", {
2022
2022
  type: "button",
2023
2023
  class: "markweave-image-resize-handle",
2024
2024
  "data-testid": "markweave-image-resize-right",
2025
2025
  "data-side": "right",
2026
2026
  "aria-label": _.value.resizeRight,
2027
2027
  "data-markweave-image-ui": "true",
2028
- onPointerdown: (e) => B("right", e)
2028
+ onPointerdown: (e) => H("right", e)
2029
2029
  }) : null
2030
2030
  ]),
2031
- h.value && (f.value || A.value) ? H("input", {
2031
+ h.value && (f.value || A.value) ? U("input", {
2032
2032
  class: "markweave-image-caption-input",
2033
2033
  "data-testid": "markweave-image-caption-input",
2034
2034
  "data-markweave-image-ui": "true",
@@ -2041,13 +2041,13 @@ var Fi = Y({
2041
2041
  onKeydown: (e) => {
2042
2042
  e.key === "Escape" && (e.preventDefault(), f.value = !1);
2043
2043
  }
2044
- }) : A.value ? H("figcaption", {
2044
+ }) : A.value ? U("figcaption", {
2045
2045
  class: "markweave-image-caption",
2046
2046
  "data-testid": "markweave-image-caption"
2047
2047
  }, A.value) : null
2048
2048
  ]);
2049
2049
  }
2050
- }), Ii = Y({
2050
+ }), Fi = X({
2051
2051
  name: "MarkweaveVueVideoNodeView",
2052
2052
  props: {
2053
2053
  editor: {
@@ -2080,14 +2080,14 @@ var Fi = Y({
2080
2080
  }
2081
2081
  },
2082
2082
  setup(e) {
2083
- let t = U(!1), r = U(""), i = U(null), a = U(!1), o = Di(e.editor), c = G(() => d(o.value)), l = G(() => e.extension.options?.messages ?? n("zh")), u = G(() => l.value.video), f = G(() => e.node.attrs), p = G(() => F(f.value.src)), m = G(() => F(f.value.embedUrl)), h = G(() => F(f.value.provider)), g = G(() => m.value ? N(m.value, h.value) : null), _ = G(() => F(f.value.mimeType)), v = G(() => F(f.value.title)), y = () => {
2083
+ let t = W(!1), r = W(""), i = W(null), a = W(!1), o = Ei(e.editor), c = K(() => d(o.value)), l = K(() => e.extension.options?.messages ?? n("zh")), u = K(() => l.value.video), f = K(() => e.node.attrs), p = K(() => P(f.value.src)), m = K(() => P(f.value.embedUrl)), h = K(() => P(f.value.provider)), g = K(() => m.value ? M(m.value, h.value) : null), _ = K(() => P(f.value.mimeType)), v = K(() => P(f.value.title)), y = () => {
2084
2084
  p.value || e.deleteNode(), r.value = "", i.value = null, t.value = !1;
2085
2085
  }, b = async (n) => {
2086
2086
  if (!c.value) return;
2087
2087
  let o = e.extension.options;
2088
2088
  a.value = !0, i.value = null;
2089
2089
  try {
2090
- let t = await te(A(n), o?.onUpload);
2090
+ let t = await L(A(n), o?.onUpload);
2091
2091
  e.updateAttributes(E(t)), r.value = "";
2092
2092
  } catch (e) {
2093
2093
  i.value = e instanceof Error ? e.message : u.value.uploadFailedError;
@@ -2115,13 +2115,13 @@ var Fi = Y({
2115
2115
  }, w = (t) => {
2116
2116
  c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
2117
2117
  };
2118
- return () => c.value && !p.value ? H(s, {
2118
+ return () => c.value && !p.value ? U(s, {
2119
2119
  as: "figure",
2120
2120
  class: "markweave-video-node",
2121
2121
  "data-testid": "markweave-video-node",
2122
2122
  "data-empty": "true",
2123
2123
  "data-selected": "false"
2124
- }, () => Pi({
2124
+ }, () => Ni({
2125
2125
  messages: l.value,
2126
2126
  inputValue: r.value,
2127
2127
  error: i.value,
@@ -2136,7 +2136,7 @@ var Fi = Y({
2136
2136
  onDragActive: (e) => {
2137
2137
  t.value = e;
2138
2138
  }
2139
- })) : H(s, {
2139
+ })) : U(s, {
2140
2140
  as: "figure",
2141
2141
  class: "markweave-video-node",
2142
2142
  "data-testid": "markweave-video-node",
@@ -2148,25 +2148,25 @@ var Fi = Y({
2148
2148
  onFocus: C,
2149
2149
  onKeydown: w,
2150
2150
  onMousedown: (e) => {
2151
- c.value && !ki(e.target) && (e.preventDefault(), C());
2151
+ c.value && !Oi(e.target) && (e.preventDefault(), C());
2152
2152
  }
2153
- }, () => [g.value ? H("div", { class: "markweave-video-embed" }, [H("iframe", {
2153
+ }, () => [g.value ? U("div", { class: "markweave-video-embed" }, [U("iframe", {
2154
2154
  class: "markweave-video-iframe",
2155
2155
  src: g.value,
2156
2156
  title: v.value ?? `${h.value ?? "Video"} embed`,
2157
2157
  "data-markweave-video-embed": "true",
2158
2158
  "data-markweave-video-provider": h.value ?? void 0,
2159
2159
  "data-markweave-video-src": p.value ?? void 0,
2160
- allow: M,
2160
+ allow: ee,
2161
2161
  loading: "lazy",
2162
2162
  allowfullscreen: "true"
2163
- }), c.value ? H("button", {
2163
+ }), c.value ? U("button", {
2164
2164
  type: "button",
2165
2165
  class: "markweave-video-selection-layer",
2166
2166
  "data-testid": "markweave-video-selection-layer",
2167
2167
  tabindex: -1,
2168
2168
  "aria-label": u.value.selectAriaLabel
2169
- }) : null]) : p.value ? H("div", { class: "markweave-video-box" }, [H("video", {
2169
+ }) : null]) : p.value ? U("div", { class: "markweave-video-box" }, [U("video", {
2170
2170
  class: "markweave-video",
2171
2171
  src: p.value,
2172
2172
  title: v.value ?? void 0,
@@ -2174,19 +2174,19 @@ var Fi = Y({
2174
2174
  controls: !0,
2175
2175
  "data-markweave-video": "true",
2176
2176
  "data-markweave-mime-type": _.value ?? void 0
2177
- }), c.value ? H("button", {
2177
+ }), c.value ? U("button", {
2178
2178
  type: "button",
2179
2179
  class: "markweave-video-selection-layer",
2180
2180
  "data-testid": "markweave-video-selection-layer",
2181
2181
  tabindex: -1,
2182
2182
  "aria-label": u.value.selectAriaLabel
2183
- }) : null]) : H("div", {
2183
+ }) : null]) : U("div", {
2184
2184
  class: "markweave-video-readonly-empty",
2185
2185
  "data-testid": "markweave-video-readonly-empty",
2186
2186
  "aria-hidden": "true"
2187
2187
  })]);
2188
2188
  }
2189
- }), Li = C.extend({
2189
+ }), Ii = C.extend({
2190
2190
  addOptions() {
2191
2191
  return {
2192
2192
  ...this.parent?.(),
@@ -2197,16 +2197,16 @@ var Fi = Y({
2197
2197
  },
2198
2198
  addNodeView() {
2199
2199
  if (typeof document > "u") return null;
2200
- let e = c(Fi, { stopEvent: ({ event: e }) => Oi(e.target) }), t = this.options.resolveMediaSource;
2200
+ let e = c(Pi, { stopEvent: ({ event: e }) => Di(e.target) }), t = this.options.resolveMediaSource;
2201
2201
  if (!t) return e;
2202
2202
  let r = x({
2203
2203
  messages: this.options.messages ?? n("zh"),
2204
2204
  onUpload: this.options.onUpload,
2205
2205
  resolveMediaSource: t
2206
2206
  });
2207
- return (t) => F(t.node.attrs.src) ? r(t) : e(t);
2207
+ return (t) => P(t.node.attrs.src) ? r(t) : e(t);
2208
2208
  }
2209
- }), Ri = w.extend({
2209
+ }), Li = w.extend({
2210
2210
  addOptions() {
2211
2211
  return {
2212
2212
  ...this.parent?.(),
@@ -2216,9 +2216,9 @@ var Fi = Y({
2216
2216
  };
2217
2217
  },
2218
2218
  addNodeView() {
2219
- return typeof document > "u" ? null : c(Ii, { stopEvent: ({ event: e }) => ki(e.target) });
2219
+ return typeof document > "u" ? null : c(Fi, { stopEvent: ({ event: e }) => Oi(e.target) });
2220
2220
  }
2221
- }), zi = Y({
2221
+ }), Ri = X({
2222
2222
  name: "MarkweaveVueLinkCardNodeView",
2223
2223
  props: {
2224
2224
  editor: {
@@ -2251,11 +2251,11 @@ var Fi = Y({
2251
2251
  }
2252
2252
  },
2253
2253
  setup(e) {
2254
- let t = e.extension.options, r = t.messages ?? n("zh"), i = Di(e.editor), a = U(!1), o = U(!1), c = U(!1), l = G(() => _(e.node.attrs ?? {})), u = U(l.value?.title ?? ""), f = U(l.value?.href ?? "");
2255
- K(l, (e) => {
2254
+ let t = e.extension.options, r = t.messages ?? n("zh"), i = Ei(e.editor), a = W(!1), o = W(!1), c = W(!1), l = K(() => _(e.node.attrs ?? {})), u = W(l.value?.title ?? ""), f = W(l.value?.href ?? "");
2255
+ q(l, (e) => {
2256
2256
  u.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
2257
2257
  });
2258
- let p = G(() => d(i.value)), m = G(() => {
2258
+ let p = K(() => d(i.value)), m = K(() => {
2259
2259
  try {
2260
2260
  return new URL(l.value?.href ?? "").host;
2261
2261
  } catch {
@@ -2279,18 +2279,18 @@ var Fi = Y({
2279
2279
  ...r,
2280
2280
  ...i
2281
2281
  }) ?? r);
2282
- }, C = (e, t, n, r) => H("button", {
2282
+ }, C = (e, t, n, r) => U("button", {
2283
2283
  type: "button",
2284
2284
  title: e,
2285
2285
  "aria-label": e,
2286
2286
  "data-testid": n,
2287
2287
  onMousedown: h,
2288
2288
  onClick: r
2289
- }, [ji(t, e), H("span", { role: "tooltip" }, e)]);
2289
+ }, [Ai(t, e), U("span", { role: "tooltip" }, e)]);
2290
2290
  return () => {
2291
2291
  let n = l.value;
2292
2292
  if (!n) return null;
2293
- let i = !c.value && n.imageUrl ? H("img", {
2293
+ let i = !c.value && n.imageUrl ? U("img", {
2294
2294
  src: n.imageUrl,
2295
2295
  alt: "",
2296
2296
  loading: "lazy",
@@ -2298,7 +2298,7 @@ var Fi = Y({
2298
2298
  onError: () => {
2299
2299
  c.value = !0;
2300
2300
  }
2301
- }) : !c.value && n.faviconUrl ? H("img", {
2301
+ }) : !c.value && n.faviconUrl ? U("img", {
2302
2302
  class: "markweave-link-card-favicon",
2303
2303
  src: n.faviconUrl,
2304
2304
  alt: "",
@@ -2307,8 +2307,8 @@ var Fi = Y({
2307
2307
  onError: () => {
2308
2308
  c.value = !0;
2309
2309
  }
2310
- }) : H("b", null, m.value.slice(0, 1).toUpperCase());
2311
- return H(s, {
2310
+ }) : U("b", null, m.value.slice(0, 1).toUpperCase());
2311
+ return U(s, {
2312
2312
  as: "article",
2313
2313
  class: "markweave-link-card",
2314
2314
  "data-testid": "markweave-link-card",
@@ -2322,32 +2322,32 @@ var Fi = Y({
2322
2322
  a.value = !1;
2323
2323
  },
2324
2324
  onMousedown: (e) => {
2325
- Ai(e.target) || e.preventDefault();
2325
+ ki(e.target) || e.preventDefault();
2326
2326
  },
2327
2327
  onClick: (e) => {
2328
- Ai(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
2328
+ ki(e.target) || (e.preventDefault(), n.href && window.open(n.href, "_blank", "noopener,noreferrer"));
2329
2329
  }
2330
2330
  }, () => [
2331
- H("a", {
2331
+ U("a", {
2332
2332
  class: "markweave-link-card-main",
2333
2333
  href: n.href,
2334
2334
  "aria-label": r.linkCard.open
2335
- }, [H("span", { class: "markweave-link-card-copy" }, [
2336
- H("strong", null, n.title),
2337
- n.description ? H("span", null, n.description) : null,
2338
- H("small", null, n.siteName ?? m.value)
2339
- ]), H("span", {
2335
+ }, [U("span", { class: "markweave-link-card-copy" }, [
2336
+ U("strong", null, n.title),
2337
+ n.description ? U("span", null, n.description) : null,
2338
+ U("small", null, n.siteName ?? m.value)
2339
+ ]), U("span", {
2340
2340
  class: "markweave-link-card-media",
2341
2341
  "aria-hidden": "true"
2342
2342
  }, [i])]),
2343
- p.value && a.value ? H("div", {
2343
+ p.value && a.value ? U("div", {
2344
2344
  class: "markweave-link-card-tools",
2345
2345
  "data-markweave-link-card-ui": "true",
2346
2346
  "aria-label": r.linkCard.toolsAriaLabel
2347
2347
  }, [
2348
- C(r.linkCard.convertToLink, Yr, "markweave-link-card-convert", x),
2349
- C(r.linkCard.copyAddress, Ir, "markweave-link-card-copy", () => b(n.href)),
2350
- C(r.linkCard.edit, ri, "markweave-link-card-edit", (i) => g({
2348
+ C(r.linkCard.convertToLink, Jr, "markweave-link-card-convert", x),
2349
+ C(r.linkCard.copyAddress, Fr, "markweave-link-card-copy", () => b(n.href)),
2350
+ C(r.linkCard.edit, ni, "markweave-link-card-edit", (i) => g({
2351
2351
  anchor: i.currentTarget,
2352
2352
  editor: e.editor,
2353
2353
  messages: r,
@@ -2357,15 +2357,15 @@ var Fi = Y({
2357
2357
  attrs: n
2358
2358
  }
2359
2359
  })),
2360
- C(r.linkCard.delete, bi, "markweave-link-card-delete", () => e.deleteNode())
2360
+ C(r.linkCard.delete, yi, "markweave-link-card-delete", () => e.deleteNode())
2361
2361
  ]) : null,
2362
- p.value && o.value ? H("form", {
2362
+ p.value && o.value ? U("form", {
2363
2363
  class: "markweave-link-card-editor",
2364
2364
  "data-markweave-link-card-ui": "true",
2365
2365
  "data-testid": "markweave-link-card-editor",
2366
2366
  onSubmit: S
2367
2367
  }, [
2368
- H("label", null, [H("span", null, r.linkCard.titleLabel), H("input", {
2368
+ U("label", null, [U("span", null, r.linkCard.titleLabel), U("input", {
2369
2369
  value: u.value,
2370
2370
  placeholder: r.linkCard.titlePlaceholder,
2371
2371
  "aria-label": r.linkCard.titleLabel,
@@ -2373,7 +2373,7 @@ var Fi = Y({
2373
2373
  u.value = e.target.value;
2374
2374
  }
2375
2375
  })]),
2376
- H("label", null, [H("span", null, r.linkCard.addressLabel), H("input", {
2376
+ U("label", null, [U("span", null, r.linkCard.addressLabel), U("input", {
2377
2377
  value: f.value,
2378
2378
  placeholder: r.linkCard.addressPlaceholder,
2379
2379
  "aria-label": r.linkCard.addressLabel,
@@ -2381,16 +2381,16 @@ var Fi = Y({
2381
2381
  f.value = e.target.value;
2382
2382
  }
2383
2383
  })]),
2384
- H("button", {
2384
+ U("button", {
2385
2385
  type: "submit",
2386
2386
  disabled: !v(f.value),
2387
2387
  "aria-label": r.linkCard.edit
2388
- }, [ji(Yr, r.linkCard.edit)])
2388
+ }, [Ai(Jr, r.linkCard.edit)])
2389
2389
  ]) : null
2390
2390
  ]);
2391
2391
  };
2392
2392
  }
2393
- }), Bi = h.extend({
2393
+ }), zi = h.extend({
2394
2394
  addOptions() {
2395
2395
  return {
2396
2396
  ...this.parent?.(),
@@ -2399,23 +2399,23 @@ var Fi = Y({
2399
2399
  };
2400
2400
  },
2401
2401
  addNodeView() {
2402
- return typeof document > "u" ? null : c(zi, { stopEvent: ({ event: e }) => Ai(e.target) });
2402
+ return typeof document > "u" ? null : c(Ri, { stopEvent: ({ event: e }) => ki(e.target) });
2403
2403
  }
2404
2404
  });
2405
2405
  //#endregion
2406
2406
  //#region src/create-editor-extensions.ts
2407
- function Vi(t = {}) {
2407
+ function Bi(t = {}) {
2408
2408
  return e({
2409
2409
  lang: t.lang,
2410
2410
  onImageUpload: t.onImageUpload,
2411
- linkCardExtension: Bi.configure({
2411
+ linkCardExtension: zi.configure({
2412
2412
  lang: t.lang,
2413
2413
  messages: n(t.lang),
2414
2414
  resolver: t.linkCardResolver
2415
2415
  }),
2416
2416
  mediaExtensions: i({
2417
- image: Li,
2418
- video: Ri,
2417
+ image: Ii,
2418
+ video: Li,
2419
2419
  lang: t.lang,
2420
2420
  onImageUpload: t.onImageUpload,
2421
2421
  onVideoUpload: t.onVideoUpload,
@@ -2425,7 +2425,7 @@ function Vi(t = {}) {
2425
2425
  }
2426
2426
  //#endregion
2427
2427
  //#region src/MarkweaveEditor.ts
2428
- var Hi = {
2428
+ var Vi = {
2429
2429
  active: !1,
2430
2430
  mode: "outside",
2431
2431
  activeCellPos: null,
@@ -2433,17 +2433,17 @@ var Hi = {
2433
2433
  selectedCellCount: 0,
2434
2434
  selectionFrom: 0,
2435
2435
  selectionTo: 0
2436
- }, Ui = {
2436
+ }, Hi = {
2437
2437
  active: !1,
2438
- language: tt.defaultLanguage,
2438
+ language: et.defaultLanguage,
2439
2439
  mermaidPreviewMode: "code",
2440
2440
  pos: null,
2441
2441
  text: ""
2442
2442
  };
2443
- function Wi(e) {
2444
- return mn.getState(e.state) ?? pn;
2443
+ function Ui(e) {
2444
+ return pn.getState(e.state) ?? fn;
2445
2445
  }
2446
- function Gi(e) {
2446
+ function Wi(e) {
2447
2447
  if (!e || typeof window > "u") return null;
2448
2448
  let t = e.parentElement;
2449
2449
  for (; t;) {
@@ -2453,113 +2453,113 @@ function Gi(e) {
2453
2453
  }
2454
2454
  return null;
2455
2455
  }
2456
- function Z(e, t, n = 18, r = 1.8) {
2457
- return H(e, {
2456
+ function Q(e, t, n = 18, r = 1.8) {
2457
+ return U(e, {
2458
2458
  size: n,
2459
2459
  strokeWidth: r,
2460
2460
  "aria-hidden": "true"
2461
2461
  }, { default: () => t });
2462
2462
  }
2463
- function Ki(e) {
2464
- return e === "clipboard" ? [H("path", { d: "M9 4.5h6a1.5 1.5 0 0 1 1.5 1.5v11A1.5 1.5 0 0 1 15 18.5H7A1.5 1.5 0 0 1 5.5 17V6A1.5 1.5 0 0 1 7 4.5h2" }), H("path", { d: "M8.5 5.5v-1A1.5 1.5 0 0 1 10 3h2a1.5 1.5 0 0 1 1.5 1.5v1h-5Z" })] : e === "search" ? [H("circle", {
2463
+ function Gi(e) {
2464
+ return e === "clipboard" ? [U("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" }), U("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" ? [U("circle", {
2465
2465
  cx: "10",
2466
2466
  cy: "10",
2467
2467
  r: "5.5"
2468
- }), H("path", { d: "m14 14 4 4" })] : e === "check" ? [H("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
2469
- H("path", { d: "M8 4H4v4" }),
2470
- H("path", { d: "M4 4l5 5" }),
2471
- H("path", { d: "M16 4h4v4" }),
2472
- H("path", { d: "m20 4-5 5" }),
2473
- H("path", { d: "M8 20H4v-4" }),
2474
- H("path", { d: "m4 20 5-5" }),
2475
- H("path", { d: "M16 20h4v-4" }),
2476
- H("path", { d: "m20 20-5-5" })
2468
+ }), U("path", { d: "m14 14 4 4" })] : e === "check" ? [U("path", { d: "m5 11 4 4 8-9" })] : e === "expand" ? [
2469
+ U("path", { d: "M8 4H4v4" }),
2470
+ U("path", { d: "M4 4l5 5" }),
2471
+ U("path", { d: "M16 4h4v4" }),
2472
+ U("path", { d: "m20 4-5 5" }),
2473
+ U("path", { d: "M8 20H4v-4" }),
2474
+ U("path", { d: "m4 20 5-5" }),
2475
+ U("path", { d: "M16 20h4v-4" }),
2476
+ U("path", { d: "m20 20-5-5" })
2477
2477
  ] : e === "download" ? [
2478
- H("path", { d: "M12 4v10" }),
2479
- H("path", { d: "m8 10 4 4 4-4" }),
2480
- H("path", { d: "M5 19h14" })
2481
- ] : e === "close" ? [H("path", { d: "M6 6l12 12" }), H("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
2482
- H("circle", {
2478
+ U("path", { d: "M12 4v10" }),
2479
+ U("path", { d: "m8 10 4 4 4-4" }),
2480
+ U("path", { d: "M5 19h14" })
2481
+ ] : e === "close" ? [U("path", { d: "M6 6l12 12" }), U("path", { d: "M18 6 6 18" })] : e === "zoomOut" ? [
2482
+ U("circle", {
2483
2483
  cx: "10",
2484
2484
  cy: "10",
2485
2485
  r: "5.25"
2486
2486
  }),
2487
- H("path", { d: "M7.5 10h5" }),
2488
- H("path", { d: "m14 14 4 4" })
2487
+ U("path", { d: "M7.5 10h5" }),
2488
+ U("path", { d: "m14 14 4 4" })
2489
2489
  ] : e === "zoomIn" ? [
2490
- H("circle", {
2490
+ U("circle", {
2491
2491
  cx: "10",
2492
2492
  cy: "10",
2493
2493
  r: "5.25"
2494
2494
  }),
2495
- H("path", { d: "M7.5 10h5" }),
2496
- H("path", { d: "M10 7.5v5" }),
2497
- H("path", { d: "m14 14 4 4" })
2498
- ] : e === "reset" ? [H("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), H("path", { d: "M6.5 8.5H3.5v-3" })] : [H("path", { d: "m6 9 6 6 6-6" })];
2495
+ U("path", { d: "M7.5 10h5" }),
2496
+ U("path", { d: "M10 7.5v5" }),
2497
+ U("path", { d: "m14 14 4 4" })
2498
+ ] : e === "reset" ? [U("path", { d: "M6.5 8.5A6 6 0 1 1 6 15" }), U("path", { d: "M6.5 8.5H3.5v-3" })] : [U("path", { d: "m6 9 6 6 6-6" })];
2499
2499
  }
2500
- function Q(e) {
2501
- return H("svg", {
2500
+ function Ki(e) {
2501
+ return U("svg", {
2502
2502
  viewBox: "0 0 24 24",
2503
2503
  "aria-hidden": "true",
2504
2504
  focusable: "false"
2505
- }, H("g", {
2505
+ }, U("g", {
2506
2506
  fill: "none",
2507
2507
  stroke: "currentColor",
2508
2508
  "stroke-linecap": "round",
2509
2509
  "stroke-linejoin": "round",
2510
2510
  "stroke-width": "1.8"
2511
- }, Ki(e)));
2511
+ }, Gi(e)));
2512
2512
  }
2513
2513
  function $(e) {
2514
2514
  e.preventDefault();
2515
2515
  }
2516
2516
  function qi(e) {
2517
- let t = Mt(e);
2517
+ let t = jt(e);
2518
2518
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
2519
2519
  }
2520
2520
  var Ji = {
2521
- bold: wr,
2522
- italic: qr,
2523
- underline: Si,
2524
- strike: pi,
2525
- "inline-code": Nr,
2526
- link: Yr,
2527
- more: ei,
2528
- superscript: hi,
2529
- subscript: mi,
2530
- "inline-math": ci,
2531
- "align-left": cr,
2532
- "align-center": or,
2533
- "align-right": lr,
2534
- "align-justify": sr,
2535
- "decrease-indent": Wr,
2536
- "increase-indent": Gr
2521
+ bold: Cr,
2522
+ italic: Kr,
2523
+ underline: xi,
2524
+ strike: fi,
2525
+ "inline-code": Mr,
2526
+ link: Jr,
2527
+ more: $r,
2528
+ superscript: mi,
2529
+ subscript: pi,
2530
+ "inline-math": si,
2531
+ "align-left": sr,
2532
+ "align-center": ar,
2533
+ "align-right": cr,
2534
+ "align-justify": or,
2535
+ "decrease-indent": Ur,
2536
+ "increase-indent": Wr
2537
2537
  }, Yi = {
2538
- type: yi,
2539
- "heading-1": zr,
2540
- "heading-2": Br,
2541
- "heading-3": Vr,
2542
- "bullet-list": Xr,
2543
- "ordered-list": Qr,
2544
- "task-list": Zr,
2545
- blockquote: ai,
2546
- "code-block": Tr,
2547
- info: Kr,
2548
- tip: Jr,
2549
- warning: pr,
2550
- error: Mr,
2551
- success: Or,
2552
- emoji: li,
2553
- math: ci,
2554
- table: gi,
2555
- separator: $r,
2556
- image: Hr,
2557
- video: wi,
2558
- attachment: ni
2538
+ type: vi,
2539
+ "heading-1": Rr,
2540
+ "heading-2": zr,
2541
+ "heading-3": Br,
2542
+ "bullet-list": Yr,
2543
+ "ordered-list": Zr,
2544
+ "task-list": Xr,
2545
+ blockquote: ii,
2546
+ "code-block": wr,
2547
+ info: Gr,
2548
+ tip: qr,
2549
+ warning: fr,
2550
+ error: jr,
2551
+ success: Dr,
2552
+ emoji: ci,
2553
+ math: si,
2554
+ table: hi,
2555
+ separator: Qr,
2556
+ image: Vr,
2557
+ video: Ci,
2558
+ attachment: ti
2559
2559
  };
2560
2560
  function Xi(e) {
2561
2561
  let t = Yi[e];
2562
- return H(t, {
2562
+ return U(t, {
2563
2563
  size: 18,
2564
2564
  strokeWidth: 1.6,
2565
2565
  absoluteStrokeWidth: !0,
@@ -2567,20 +2567,20 @@ function Xi(e) {
2567
2567
  });
2568
2568
  }
2569
2569
  var Zi = {
2570
- paragraph: xi,
2571
- "heading-1": zr,
2572
- "heading-2": Br,
2573
- "heading-3": Vr,
2574
- "bullet-list": Xr,
2575
- "numbered-list": Qr,
2576
- "todo-list": Zr,
2577
- quote: ai,
2578
- "code-block": Tr
2570
+ paragraph: bi,
2571
+ "heading-1": Rr,
2572
+ "heading-2": zr,
2573
+ "heading-3": Br,
2574
+ "bullet-list": Yr,
2575
+ "numbered-list": Zr,
2576
+ "todo-list": Xr,
2577
+ quote: ii,
2578
+ "code-block": wr
2579
2579
  };
2580
2580
  function Qi(e, t) {
2581
- return ce(e, t).label;
2581
+ return se(e, t).label;
2582
2582
  }
2583
- var $i = Y({
2583
+ var $i = X({
2584
2584
  name: "MarkweaveVueFloatingToolbar",
2585
2585
  props: {
2586
2586
  editor: {
@@ -2605,73 +2605,73 @@ var $i = Y({
2605
2605
  }
2606
2606
  },
2607
2607
  setup(e) {
2608
- let t = U(null), n = U("input"), r = U(""), i = U(""), a = U(""), o = U(""), s = W(null), c = W(null), l = U(null), u = U(null), d = "", f = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = U(""), m = U(null), h = U(null), g = U("bottom"), _ = U(null), v = U(null), y = U(null), b = G(() => Mt(p.value.trim())), x = G(() => e.messages.floatingToolbar), S = G(() => fe(e.messages).map((e) => [
2608
+ let t = W(null), n = W("input"), r = W(""), i = W(""), a = W(""), o = W(""), s = G(null), c = G(null), l = W(null), u = W(null), d = "", f = K(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), p = W(""), m = W(null), h = W(null), g = W("bottom"), _ = W(null), v = W(null), y = W(null), b = K(() => jt(p.value.trim())), x = K(() => e.messages.floatingToolbar), S = K(() => de(e.messages).map((e) => [
2609
2609
  e.id,
2610
2610
  e.label,
2611
2611
  Zi[e.id]
2612
- ])), C = G(() => de(e.messages).map((e) => [
2612
+ ])), C = K(() => ue(e.messages).map((e) => [
2613
2613
  e.id,
2614
2614
  e.value,
2615
2615
  e.label
2616
- ])), w = G(() => le(e.messages).map((e) => [
2616
+ ])), w = K(() => ce(e.messages).map((e) => [
2617
2617
  e.id,
2618
2618
  e.value,
2619
2619
  e.label
2620
- ])), T = G(() => ue(e.messages).map((e) => e.id)), E = () => {
2620
+ ])), T = K(() => le(e.messages).map((e) => e.id)), E = () => {
2621
2621
  b.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: b.value }).run(), t.value = null);
2622
2622
  }, D = () => {
2623
2623
  e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
2624
2624
  }, O = (n) => {
2625
2625
  t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
2626
- }, k = B(() => {
2627
- Be(e.editor, d), a.value = d;
2626
+ }, k = H(() => {
2627
+ ze(e.editor, d), a.value = d;
2628
2628
  }), A = (n = !0) => {
2629
- c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Re(e.editor), Ae(e.editor), t.value = null, n && e.editor.commands.focus();
2629
+ c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Le(e.editor), ke(e.editor), t.value = null, n && e.editor.commands.focus();
2630
2630
  }, j = () => {
2631
2631
  if (!f.value) return;
2632
- let r = He(e.editor);
2633
- r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus()));
2634
- }, M = async (t) => {
2632
+ let r = Ve(e.editor);
2633
+ r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", Y(() => u.value?.focus()));
2634
+ }, ee = async (t) => {
2635
2635
  if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
2636
2636
  let u = (t ?? r.value).trim();
2637
2637
  if (!u) {
2638
2638
  o.value = e.messages.askAi.emptyPrompt, n.value = "error";
2639
2639
  return;
2640
2640
  }
2641
- let p = Me(e.editor, s.value);
2641
+ let p = je(e.editor, s.value);
2642
2642
  if (!p) {
2643
2643
  n.value = "conflict";
2644
2644
  return;
2645
2645
  }
2646
- s.value = p, c.value?.abort(), ke(e.editor);
2647
- let m = new AbortController(), h = je(p, u, e.lang, m.signal, void 0, Pe(e.editor)?.target);
2646
+ s.value = p, c.value?.abort(), Oe(e.editor);
2647
+ let m = new AbortController(), h = Ae(p, u, e.lang, m.signal, void 0, Ne(e.editor)?.target);
2648
2648
  c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
2649
2649
  try {
2650
- let t = await ze(e.askAi.handler, h, (e) => {
2650
+ let t = await Re(e.askAi.handler, h, (e) => {
2651
2651
  l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
2652
2652
  });
2653
2653
  if (l.value !== h.id || m.signal.aborted) return;
2654
- if (k.cancel(), d = t, !Be(e.editor, t)) throw new Te("invalid-output", "Ask AI output is incompatible with the selected content.");
2655
- a.value = t, r.value = "", n.value = Pe(e.editor)?.status === "target" ? "result" : "conflict";
2654
+ if (k.cancel(), d = t, !ze(e.editor, t)) throw new we("invalid-output", "Ask AI output is incompatible with the selected content.");
2655
+ a.value = t, r.value = "", n.value = Ne(e.editor)?.status === "target" ? "result" : "conflict";
2656
2656
  } catch (t) {
2657
2657
  if (l.value !== h.id) return;
2658
2658
  if (k.cancel(), m.signal.aborted) {
2659
- ke(e.editor), n.value = Pe(e.editor)?.status === "conflict" ? "conflict" : "input";
2659
+ Oe(e.editor), n.value = Ne(e.editor)?.status === "conflict" ? "conflict" : "input";
2660
2660
  return;
2661
2661
  }
2662
- ke(e.editor), o.value = t instanceof Te ? t.code === "empty-result" ? e.messages.askAi.emptyResult : e.messages.askAi.errorFallback : t instanceof Error && t.message ? t.message : e.messages.askAi.errorFallback, n.value = "error";
2662
+ Oe(e.editor), o.value = t instanceof we ? t.code === "empty-result" ? e.messages.askAi.emptyResult : e.messages.askAi.errorFallback : t instanceof Error && t.message ? t.message : e.messages.askAi.errorFallback, n.value = "error";
2663
2663
  }
2664
- }, ee = () => {
2665
- if (!Ee(e.editor, a.value)) {
2666
- n.value = Pe(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
2664
+ }, te = () => {
2665
+ if (!Te(e.editor, a.value)) {
2666
+ n.value = Ne(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
2667
2667
  return;
2668
2668
  }
2669
- t.value = null, window.setTimeout(() => Ae(e.editor), 560), e.editor.commands.focus();
2670
- }, N = B(() => {
2669
+ t.value = null, window.setTimeout(() => ke(e.editor), 560), e.editor.commands.focus();
2670
+ }, M = H(() => {
2671
2671
  let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
2672
2672
  if (!t.value || !n || !r) return;
2673
2673
  if (t.value === "ask-ai") {
2674
- let t = Fe(e.editor), n = v.value?.getBoundingClientRect();
2674
+ let t = Pe(e.editor), n = v.value?.getBoundingClientRect();
2675
2675
  if (!t || !n) return;
2676
2676
  let a = {
2677
2677
  anchorRect: n,
@@ -2681,18 +2681,18 @@ var $i = Y({
2681
2681
  height: window.innerHeight
2682
2682
  },
2683
2683
  frameRect: i?.getBoundingClientRect() ?? null,
2684
- surfaceRect: Ne(e.editor.view.dom)
2685
- }, o = De({
2684
+ surfaceRect: Me(e.editor.view.dom)
2685
+ }, o = Ee({
2686
2686
  ...a,
2687
2687
  panelSize: r.getBoundingClientRect()
2688
2688
  }), s = `${o.width}px`;
2689
- r.style.width !== s && (r.style.width = s, o = De({
2689
+ r.style.width !== s && (r.style.width = s, o = Ee({
2690
2690
  ...a,
2691
2691
  panelSize: r.getBoundingClientRect()
2692
2692
  })), r.style.left = `${o.left}px`, r.style.top = `${o.top}px`, r.style.bottom = "auto", r.style.maxWidth = `${o.maxWidth}px`, r.style.maxHeight = `${Math.max(0, o.maxHeight)}px`, r.dataset.positioned = "true", g.value = o.placement;
2693
2693
  return;
2694
2694
  }
2695
- let a = ve({
2695
+ let a = _e({
2696
2696
  toolbarRect: n.getBoundingClientRect(),
2697
2697
  popoverSize: r.getBoundingClientRect(),
2698
2698
  viewport: {
@@ -2703,27 +2703,35 @@ var $i = Y({
2703
2703
  gap: t.value === "more" ? 8 : 6
2704
2704
  });
2705
2705
  g.value = a.placement;
2706
- }), P = () => {
2707
- let l = Pe(e.editor);
2706
+ }), N = () => {
2707
+ let l = Ne(e.editor);
2708
2708
  if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
2709
- s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus());
2709
+ s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", Y(() => u.value?.focus());
2710
2710
  return;
2711
2711
  }
2712
2712
  t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), k.cancel(), n.value = "conflict");
2713
- }, F = (e) => {
2713
+ }, P = (e) => {
2714
2714
  e.key !== "Escape" || t.value !== "ask-ai" || (e.preventDefault(), n.value === "generating" ? (c.value?.abort(), k.cancel(), n.value = "input") : A(!0));
2715
+ }, F = (e) => {
2716
+ if (!(!t.value || v.value?.contains(e.target))) {
2717
+ if (t.value === "ask-ai") {
2718
+ A(!0);
2719
+ return;
2720
+ }
2721
+ t.value = null;
2722
+ }
2715
2723
  };
2716
- K(() => [
2724
+ q(() => [
2717
2725
  t.value,
2718
2726
  n.value,
2719
2727
  a.value,
2720
2728
  o.value
2721
2729
  ], ([e]) => {
2722
- e && J(N.schedule);
2723
- }), rr(() => {
2724
- window.addEventListener("resize", N.schedule), window.addEventListener("scroll", N.schedule, !0), e.editor.on("transaction", P), document.addEventListener("keydown", F, !0);
2725
- }), q(() => {
2726
- N.cancel(), k.cancel(), window.removeEventListener("resize", N.schedule), window.removeEventListener("scroll", N.schedule, !0), e.editor.off("transaction", P), document.removeEventListener("keydown", F, !0), c.value?.abort(), Ae(e.editor);
2730
+ e && Y(M.schedule);
2731
+ }), nr(() => {
2732
+ window.addEventListener("resize", M.schedule), window.addEventListener("scroll", M.schedule, !0), e.editor.on("transaction", N), document.addEventListener("pointerdown", F, !0), document.addEventListener("keydown", P, !0);
2733
+ }), J(() => {
2734
+ M.cancel(), k.cancel(), window.removeEventListener("resize", M.schedule), window.removeEventListener("scroll", M.schedule, !0), e.editor.off("transaction", N), document.removeEventListener("pointerdown", F, !0), document.removeEventListener("keydown", P, !0), c.value?.abort(), ke(e.editor);
2727
2735
  });
2728
2736
  let I = (n) => n === "block-type" || n === "color" || n === "more" ? t.value === n : n === "bold" ? e.editor.isActive("bold") : n === "italic" ? e.editor.isActive("italic") : n === "underline" ? e.editor.isActive("underline") : n === "strike" ? e.editor.isActive("strike") : n === "inline-code" ? e.editor.isActive("code") : n === "link" ? e.editor.isActive("link") : !1, L = (e, t) => {
2729
2737
  if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
@@ -2732,11 +2740,11 @@ var $i = Y({
2732
2740
  }
2733
2741
  let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
2734
2742
  h.value = n.left + n.width / 2 - r.left;
2735
- }, te = () => {
2743
+ }, R = () => {
2736
2744
  let e = m.value;
2737
2745
  if (!e || t.value !== null) return null;
2738
2746
  let n = x.value.buttons[e];
2739
- return n ? H("div", {
2747
+ return n ? U("div", {
2740
2748
  class: "markweave-floating-toolbar-tooltip",
2741
2749
  role: "tooltip",
2742
2750
  "data-testid": "markweave-floating-toolbar-tooltip",
@@ -2744,7 +2752,7 @@ var $i = Y({
2744
2752
  "data-active": I(e),
2745
2753
  style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
2746
2754
  }, n) : null;
2747
- }, R = (n, r, i, a, o = !1, s) => H("button", {
2755
+ }, B = (n, r, i, a, o = !1, s) => U("button", {
2748
2756
  type: "button",
2749
2757
  class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
2750
2758
  "aria-label": r,
@@ -2764,13 +2772,13 @@ var $i = Y({
2764
2772
  onMouseenter: (e) => L(n, e.currentTarget),
2765
2773
  onMouseleave: () => L(null),
2766
2774
  onClick: a
2767
- }, n === "ask-ai" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [Z(i, r), H("span", null, s ?? r)])] : n === "block-type" ? [H("span", { class: "markweave-floating-toolbar-button-inner" }, [H("span", { class: "markweave-floating-toolbar-block-label" }, Qi(e.editor, e.messages)), Z(t.value === "block-type" ? jr : kr, r)])] : n === "color" ? [H("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [H("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Z(t.value === "color" ? jr : kr, r)])] : [Z(i, r)]), ne = () => H("span", {
2775
+ }, n === "ask-ai" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [Q(i, r), U("span", null, s ?? r)])] : n === "block-type" ? [U("span", { class: "markweave-floating-toolbar-button-inner" }, [U("span", { class: "markweave-floating-toolbar-block-label" }, Qi(e.editor, e.messages)), Q(t.value === "block-type" ? Ar : Or, r)])] : n === "color" ? [U("span", { class: "markweave-floating-toolbar-button-inner markweave-floating-toolbar-button-inner--color" }, [U("span", { class: "markweave-floating-toolbar-color-trigger" }, "A"), Q(t.value === "color" ? Ar : Or, r)])] : [Q(i, r)]), V = () => U("span", {
2768
2776
  class: "markweave-floating-toolbar-divider",
2769
2777
  "aria-hidden": "true"
2770
- }), re = (n, r, i) => H("section", {
2778
+ }), ne = (n, r, i) => U("section", {
2771
2779
  class: "markweave-floating-toolbar-color-section",
2772
2780
  "aria-label": n
2773
- }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, n), H("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => H("button", {
2781
+ }, [U("div", { class: "markweave-floating-toolbar-menu-title" }, n), U("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => U("button", {
2774
2782
  key: `${r}-${n}`,
2775
2783
  type: "button",
2776
2784
  "aria-label": a,
@@ -2779,24 +2787,24 @@ var $i = Y({
2779
2787
  onClick: () => {
2780
2788
  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;
2781
2789
  }
2782
- }, r === "text" ? [H("span", {
2790
+ }, r === "text" ? [U("span", {
2783
2791
  class: "markweave-floating-toolbar-text-swatch",
2784
2792
  style: { color: i ?? "#646970" }
2785
- }, "A")] : [H("span", {
2793
+ }, "A")] : [U("span", {
2786
2794
  class: "markweave-floating-toolbar-highlight-swatch",
2787
2795
  style: { backgroundColor: i ?? "#ffffff" },
2788
2796
  "aria-hidden": "true"
2789
- })])))]), ie = () => {
2797
+ })])))]), re = () => {
2790
2798
  if (t.value === "ask-ai") {
2791
- let t = (e, t, n, r) => H("button", {
2799
+ let t = (e, t, n, r) => U("button", {
2792
2800
  type: "button",
2793
2801
  class: n,
2794
2802
  onMousedown: $,
2795
2803
  onClick: t
2796
- }, r ? [Z(r, e), H("span", null, e)] : e), s = n.value === "input" || n.value === "result" || n.value === "error" ? H("div", {
2804
+ }, r ? [Q(r, e), U("span", null, e)] : e), s = n.value === "input" || n.value === "result" || n.value === "error" ? U("div", {
2797
2805
  class: "markweave-ask-ai-composer",
2798
2806
  "data-variant": n.value === "result" ? "follow-up" : "prompt"
2799
- }, [H("textarea", {
2807
+ }, [U("textarea", {
2800
2808
  ref: u,
2801
2809
  class: "markweave-ask-ai-input",
2802
2810
  rows: 2,
@@ -2807,19 +2815,19 @@ var $i = Y({
2807
2815
  r.value = e.target.value;
2808
2816
  },
2809
2817
  onKeydown: (e) => {
2810
- e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), M());
2818
+ e.key === "Enter" && !e.shiftKey && !e.isComposing && (e.preventDefault(), ee());
2811
2819
  }
2812
- }), H("button", {
2820
+ }), U("button", {
2813
2821
  type: "button",
2814
2822
  class: "markweave-ask-ai-send",
2815
2823
  "aria-label": e.messages.askAi.send,
2816
2824
  disabled: !r.value.trim(),
2817
2825
  onMousedown: $,
2818
2826
  onClick: () => {
2819
- M();
2827
+ ee();
2820
2828
  }
2821
- }, [Z(vr, e.messages.askAi.send)])]) : null;
2822
- return H("section", {
2829
+ }, [Q(_r, e.messages.askAi.send)])]) : null;
2830
+ return U("section", {
2823
2831
  ref: y,
2824
2832
  class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
2825
2833
  "aria-label": e.messages.askAi.ariaLabel,
@@ -2827,65 +2835,65 @@ var $i = Y({
2827
2835
  "data-testid": "markweave-ask-ai-popover"
2828
2836
  }, [
2829
2837
  s,
2830
- n.value === "generating" ? H("div", {
2838
+ n.value === "generating" ? U("div", {
2831
2839
  class: "markweave-ask-ai-progress markweave-ask-ai-generating",
2832
2840
  role: "status"
2833
2841
  }, [
2834
- H("span", {
2842
+ U("span", {
2835
2843
  class: "markweave-ask-ai-sparkles",
2836
2844
  "aria-hidden": "true"
2837
- }, [Z(ui, "")]),
2838
- H("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
2839
- H("button", {
2845
+ }, [Q(li, "")]),
2846
+ U("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
2847
+ U("button", {
2840
2848
  type: "button",
2841
2849
  class: "markweave-ask-ai-stop",
2842
2850
  "aria-label": e.messages.askAi.stop,
2843
2851
  onMousedown: $,
2844
2852
  onClick: () => {
2845
- c.value?.abort(), k.cancel(), ke(e.editor), n.value = "input";
2853
+ c.value?.abort(), k.cancel(), Oe(e.editor), n.value = "input";
2846
2854
  }
2847
- }, [Z(di, e.messages.askAi.stop)])
2855
+ }, [Q(ui, e.messages.askAi.stop)])
2848
2856
  ]) : null,
2849
- n.value === "result" ? H("div", { class: "markweave-ask-ai-action-bar" }, [
2857
+ n.value === "result" ? U("div", { class: "markweave-ask-ai-action-bar" }, [
2850
2858
  t(e.messages.askAi.retry, () => {
2851
- M(i.value);
2852
- }, "markweave-ask-ai-retry", si),
2853
- H("span", { class: "markweave-ask-ai-action-spacer" }),
2854
- t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ti),
2855
- t(e.messages.askAi.accept, ee, "markweave-ask-ai-accept", Dr)
2859
+ ee(i.value);
2860
+ }, "markweave-ask-ai-retry", oi),
2861
+ U("span", { class: "markweave-ask-ai-action-spacer" }),
2862
+ t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", wi),
2863
+ t(e.messages.askAi.accept, te, "markweave-ask-ai-accept", Er)
2856
2864
  ]) : null,
2857
- n.value === "error" || n.value === "conflict" ? H("div", {
2865
+ n.value === "error" || n.value === "conflict" ? U("div", {
2858
2866
  class: "markweave-ask-ai-error",
2859
2867
  role: "alert"
2860
- }, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, H("div", { class: "markweave-ask-ai-action-bar" }, [
2868
+ }, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, U("div", { class: "markweave-ask-ai-action-bar" }, [
2861
2869
  n.value === "error" ? t(e.messages.askAi.retry, () => {
2862
- M(i.value);
2863
- }, "markweave-ask-ai-retry", si) : null,
2864
- H("span", { class: "markweave-ask-ai-action-spacer" }),
2865
- t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Ti)
2870
+ ee(i.value);
2871
+ }, "markweave-ask-ai-retry", oi) : null,
2872
+ U("span", { class: "markweave-ask-ai-action-spacer" }),
2873
+ t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", wi)
2866
2874
  ])]) : null
2867
2875
  ]);
2868
2876
  }
2869
- return t.value === "block-type" ? H("div", {
2877
+ return t.value === "block-type" ? U("div", {
2870
2878
  ref: y,
2871
2879
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-turn-menu",
2872
2880
  "data-testid": "markweave-floating-toolbar-turn-menu"
2873
- }, [H("div", { class: "markweave-floating-toolbar-menu-title" }, x.value.turnIntoTitle), ...S.value.map(([n, r, i]) => H("button", {
2881
+ }, [U("div", { class: "markweave-floating-toolbar-menu-title" }, x.value.turnIntoTitle), ...S.value.map(([n, r, i]) => U("button", {
2874
2882
  key: n,
2875
2883
  type: "button",
2876
2884
  "data-testid": `markweave-floating-toolbar-turn-${n}`,
2877
2885
  onMousedown: $,
2878
2886
  onClick: () => {
2879
- me(e.editor, n), t.value = null;
2887
+ pe(e.editor, n), t.value = null;
2880
2888
  }
2881
- }, [H("span", { class: "markweave-floating-toolbar-menu-icon" }, [Z(i, r)]), H("span", null, r)]))]) : t.value === "link" ? H("form", {
2889
+ }, [U("span", { class: "markweave-floating-toolbar-menu-icon" }, [Q(i, r)]), U("span", null, r)]))]) : t.value === "link" ? U("form", {
2882
2890
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
2883
2891
  ref: y,
2884
2892
  "data-testid": "markweave-floating-toolbar-link-popover",
2885
2893
  onSubmit: (e) => {
2886
2894
  e.preventDefault(), E();
2887
2895
  }
2888
- }, [H("input", {
2896
+ }, [U("input", {
2889
2897
  value: p.value,
2890
2898
  placeholder: x.value.linkPlaceholder,
2891
2899
  "aria-label": x.value.linkUrlLabel,
@@ -2893,45 +2901,45 @@ var $i = Y({
2893
2901
  onInput: (e) => {
2894
2902
  p.value = e.target.value;
2895
2903
  }
2896
- }), H("span", { class: "markweave-floating-toolbar-link-actions" }, [
2897
- H("button", {
2904
+ }), U("span", { class: "markweave-floating-toolbar-link-actions" }, [
2905
+ U("button", {
2898
2906
  type: "submit",
2899
2907
  disabled: !b.value,
2900
2908
  "aria-label": x.value.applyLink,
2901
2909
  "data-testid": "markweave-floating-toolbar-link-apply",
2902
2910
  onMousedown: $
2903
- }, [Z(Pr, x.value.applyLink)]),
2904
- H("span", {
2911
+ }, [Q(Nr, x.value.applyLink)]),
2912
+ U("span", {
2905
2913
  class: "markweave-floating-toolbar-link-divider",
2906
2914
  "aria-hidden": "true"
2907
2915
  }),
2908
- H("button", {
2916
+ U("button", {
2909
2917
  type: "button",
2910
2918
  disabled: !b.value,
2911
2919
  "aria-label": x.value.openLink,
2912
2920
  "data-testid": "markweave-floating-toolbar-link-open",
2913
2921
  onMousedown: $,
2914
2922
  onClick: () => qi(p.value)
2915
- }, [Z(Rr, x.value.openLink)]),
2916
- H("button", {
2923
+ }, [Q(Lr, x.value.openLink)]),
2924
+ U("button", {
2917
2925
  type: "button",
2918
2926
  "aria-label": x.value.removeLink,
2919
2927
  "data-testid": "markweave-floating-toolbar-link-remove",
2920
2928
  onMousedown: $,
2921
2929
  onClick: D
2922
- }, [Z(bi, x.value.removeLink)])
2923
- ])]) : t.value === "color" ? H("div", {
2930
+ }, [Q(yi, x.value.removeLink)])
2931
+ ])]) : t.value === "color" ? U("div", {
2924
2932
  ref: y,
2925
2933
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
2926
2934
  "data-testid": "markweave-floating-toolbar-color-menu"
2927
- }, [re(x.value.textColorTitle, "text", C.value), re(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? H("div", {
2935
+ }, [ne(x.value.textColorTitle, "text", C.value), ne(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? U("div", {
2928
2936
  ref: y,
2929
2937
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
2930
2938
  "data-testid": "markweave-floating-toolbar-more-menu"
2931
- }, T.value.map((n) => H("span", {
2939
+ }, T.value.map((n) => U("span", {
2932
2940
  key: n,
2933
2941
  class: "markweave-floating-toolbar-more-item"
2934
- }, [H("button", {
2942
+ }, [U("button", {
2935
2943
  type: "button",
2936
2944
  "aria-label": x.value.moreActions[n],
2937
2945
  "data-testid": `markweave-floating-toolbar-more-${n}`,
@@ -2944,61 +2952,61 @@ var $i = Y({
2944
2952
  m.value = null;
2945
2953
  },
2946
2954
  onClick: () => {
2947
- pe(e.editor, n), t.value = null;
2955
+ fe(e.editor, n), t.value = null;
2948
2956
  }
2949
- }, [Z(Ji[n], x.value.moreActions[n])]), m.value === n ? H("div", {
2957
+ }, [Q(Ji[n], x.value.moreActions[n])]), m.value === n ? U("div", {
2950
2958
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
2951
2959
  role: "tooltip"
2952
2960
  }, x.value.moreActions[n]) : null]))) : null;
2953
2961
  };
2954
- return () => H(z, {
2962
+ return () => U(z, {
2955
2963
  editor: e.editor,
2956
2964
  shouldShow: ({ editor: e }) => {
2957
- let t = Pe(e);
2958
- return xe(ye(e), {
2965
+ let t = Ne(e);
2966
+ return be(ve(e), {
2959
2967
  editable: e.isEditable,
2960
- hasAskAiPreview: Ie(e.state),
2968
+ hasAskAiPreview: Fe(e.state),
2961
2969
  hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
2962
2970
  });
2963
2971
  },
2964
2972
  getReferencedVirtualElement: () => {
2965
- let t = Pe(e.editor)?.target.kind === "table" ? Fe(e.editor) : null;
2973
+ let t = Ne(e.editor)?.target.kind === "table" ? Pe(e.editor) : null;
2966
2974
  return t ? {
2967
2975
  getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
2968
2976
  getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
2969
2977
  } : null;
2970
2978
  },
2971
2979
  options: { placement: "top" }
2972
- }, { default: () => H("div", {
2980
+ }, { default: () => U("div", {
2973
2981
  ref: _,
2974
2982
  class: "markweave-floating-toolbar markweave-floating-toolbar--default markweave-floating-toolbar--motion-entered",
2975
2983
  "data-popover-placement": t.value ? g.value : void 0,
2976
2984
  "data-ask-ai-session": t.value === "ask-ai" ? "open" : "closed",
2977
2985
  "data-testid": "markweave-floating-toolbar"
2978
- }, [H("div", {
2986
+ }, [U("div", {
2979
2987
  ref: v,
2980
2988
  class: "markweave-floating-toolbar-content",
2981
2989
  "data-menu": t.value ?? "none"
2982
2990
  }, [
2983
- f.value && Le(e.editor) ? R("ask-ai", x.value.buttons["ask-ai"], ui, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
2984
- f.value && Le(e.editor) ? ne() : null,
2985
- R("block-type", x.value.buttons["block-type"], xi, () => O("block-type"), t.value === "block-type"),
2986
- ne(),
2987
- R("bold", x.value.buttons.bold, wr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2988
- R("italic", x.value.buttons.italic, qr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2989
- R("underline", x.value.buttons.underline, Si, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2990
- R("strike", x.value.buttons.strike, pi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2991
- R("inline-code", x.value.buttons["inline-code"], Nr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
2992
- ne(),
2993
- R("link", x.value.buttons.link, Yr, () => O("link"), e.editor.isActive("link")),
2994
- R("color", x.value.buttons.color, xi, () => O("color"), t.value === "color"),
2995
- ne(),
2996
- R("more", x.value.buttons.more, ei, () => O("more"), t.value === "more"),
2997
- ie(),
2998
- te()
2991
+ f.value && Ie(e.editor) ? B("ask-ai", x.value.buttons["ask-ai"], li, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
2992
+ f.value && Ie(e.editor) ? V() : null,
2993
+ B("block-type", x.value.buttons["block-type"], bi, () => O("block-type"), t.value === "block-type"),
2994
+ V(),
2995
+ B("bold", x.value.buttons.bold, Cr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
2996
+ B("italic", x.value.buttons.italic, Kr, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
2997
+ B("underline", x.value.buttons.underline, xi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
2998
+ B("strike", x.value.buttons.strike, fi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
2999
+ B("inline-code", x.value.buttons["inline-code"], Mr, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
3000
+ V(),
3001
+ B("link", x.value.buttons.link, Jr, () => O("link"), e.editor.isActive("link")),
3002
+ B("color", x.value.buttons.color, bi, () => O("color"), t.value === "color"),
3003
+ V(),
3004
+ B("more", x.value.buttons.more, $r, () => O("more"), t.value === "more"),
3005
+ re(),
3006
+ R()
2999
3007
  ])]) });
3000
3008
  }
3001
- }), ea = Y({
3009
+ }), ea = X({
3002
3010
  name: "MarkweaveVueMathEditorPopover",
3003
3011
  props: {
3004
3012
  editor: {
@@ -3019,17 +3027,17 @@ var $i = Y({
3019
3027
  }
3020
3028
  },
3021
3029
  setup(e) {
3022
- let t = U(e.target.latex), n = W(null), r = U(null), i = U(null), a = W(Lt(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
3030
+ let t = W(e.target.latex), n = G(null), r = W(null), i = W(null), a = G(It(e.editor, e.target)), o = K(() => t.value === e.target.latex && a.value ? {
3023
3031
  html: a.value,
3024
3032
  error: !1
3025
- } : Vt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => It(e.editor, e.target) ?? 1), u = () => {
3033
+ } : Bt(t.value, e.target.kind, e.editor)), s = K(() => t.value.trim().length > 0), c = K(() => e.messages.math), l = K(() => Ft(e.editor, e.target) ?? 1), u = () => {
3026
3034
  if (typeof window > "u") return;
3027
- let r = Ft(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3035
+ let r = Pt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
3028
3036
  if (!r || !i) {
3029
3037
  e.onClose();
3030
3038
  return;
3031
3039
  }
3032
- n.value = Pt({
3040
+ n.value = Nt({
3033
3041
  anchorRect: r,
3034
3042
  frameRect: i,
3035
3043
  kind: e.target.kind,
@@ -3038,7 +3046,7 @@ var $i = Y({
3038
3046
  viewportWidth: window.innerWidth
3039
3047
  });
3040
3048
  }, d = () => {
3041
- s.value && Nt(e.editor, e.target, t.value) && e.onClose();
3049
+ s.value && Mt(e.editor, e.target, t.value) && e.onClose();
3042
3050
  }, f = (t) => {
3043
3051
  if (t.key === "Escape") {
3044
3052
  t.preventDefault(), e.onClose(), e.editor.commands.focus();
@@ -3049,14 +3057,14 @@ var $i = Y({
3049
3057
  let n = t.target;
3050
3058
  n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
3051
3059
  };
3052
- return K(() => [e.target.pos, e.target.latex], () => {
3053
- t.value = e.target.latex, a.value = Lt(e.editor, e.target), J(u);
3054
- }), rr(() => {
3055
- Ht(e.editor, e.target, !0), u(), J(() => {
3060
+ return q(() => [e.target.pos, e.target.latex], () => {
3061
+ t.value = e.target.latex, a.value = It(e.editor, e.target), Y(u);
3062
+ }), nr(() => {
3063
+ Vt(e.editor, e.target, !0), u(), Y(() => {
3056
3064
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
3057
3065
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
3058
- }), q(() => {
3059
- Ht(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
3066
+ }), J(() => {
3067
+ Vt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
3060
3068
  }), () => {
3061
3069
  let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
3062
3070
  ref: i,
@@ -3069,7 +3077,7 @@ var $i = Y({
3069
3077
  },
3070
3078
  onKeydown: f
3071
3079
  };
3072
- return e.target.kind === "inline" ? H("form", {
3080
+ return e.target.kind === "inline" ? U("form", {
3073
3081
  ref: r,
3074
3082
  class: "markweave-math-editor-popover markweave-math-editor-popover--inline",
3075
3083
  "aria-label": a,
@@ -3084,22 +3092,22 @@ var $i = Y({
3084
3092
  onSubmit: (e) => {
3085
3093
  e.preventDefault(), d();
3086
3094
  }
3087
- }, [H("label", {
3095
+ }, [U("label", {
3088
3096
  class: "markweave-math-inline-source",
3089
3097
  "data-testid": "markweave-math-inline-source"
3090
3098
  }, [
3091
- H("span", { attrs: { "aria-hidden": "true" } }, "$"),
3092
- H("input", {
3099
+ U("span", { attrs: { "aria-hidden": "true" } }, "$"),
3100
+ U("input", {
3093
3101
  ...u,
3094
3102
  "aria-label": c.value.latexLabel,
3095
3103
  size: Math.max(t.value.length, 1)
3096
3104
  }),
3097
- H("span", { attrs: { "aria-hidden": "true" } }, "$")
3098
- ]), H("div", {
3105
+ U("span", { attrs: { "aria-hidden": "true" } }, "$")
3106
+ ]), U("div", {
3099
3107
  class: "markweave-math-inline-preview",
3100
3108
  "data-error": o.value.error ? "true" : "false",
3101
3109
  "data-testid": "markweave-math-editor-preview"
3102
- }, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])]) : H("form", {
3110
+ }, [U("div", { innerHTML: o.value.html || " " }), o.value.error ? U("small", null, c.value.invalidPreview) : null])]) : U("form", {
3103
3111
  ref: r,
3104
3112
  class: "markweave-math-editor-popover markweave-math-editor-popover--block",
3105
3113
  "aria-label": a,
@@ -3115,39 +3123,39 @@ var $i = Y({
3115
3123
  e.preventDefault(), d();
3116
3124
  }
3117
3125
  }, [
3118
- H("div", { class: "markweave-math-block-toolbar" }, [
3119
- H("span", null, c.value.label),
3120
- Z(Nr, c.value.label, 15, 1.75),
3121
- H("button", {
3126
+ U("div", { class: "markweave-math-block-toolbar" }, [
3127
+ U("span", null, c.value.label),
3128
+ Q(Mr, c.value.label, 15, 1.75),
3129
+ U("button", {
3122
3130
  type: "submit",
3123
3131
  title: c.value.apply,
3124
3132
  "aria-label": c.value.apply,
3125
3133
  disabled: !s.value,
3126
3134
  "data-testid": "markweave-math-editor-apply"
3127
- }, [Z(Or, c.value.apply, 16, 2)])
3135
+ }, [Q(Dr, c.value.apply, 16, 2)])
3128
3136
  ]),
3129
- H("label", {
3137
+ U("label", {
3130
3138
  class: "markweave-math-block-source",
3131
3139
  "data-testid": "markweave-math-block-source"
3132
3140
  }, [
3133
- H("span", { attrs: { "aria-hidden": "true" } }, "$$"),
3134
- H("textarea", {
3141
+ U("span", { attrs: { "aria-hidden": "true" } }, "$$"),
3142
+ U("textarea", {
3135
3143
  ...u,
3136
3144
  "aria-label": c.value.latexLabel,
3137
3145
  rows: 3
3138
3146
  }),
3139
- H("span", { attrs: { "aria-hidden": "true" } }, "$$")
3147
+ U("span", { attrs: { "aria-hidden": "true" } }, "$$")
3140
3148
  ]),
3141
- H("div", {
3149
+ U("div", {
3142
3150
  class: "markweave-math-block-preview",
3143
3151
  "data-error": o.value.error ? "true" : "false",
3144
3152
  "data-math-number": String(l.value),
3145
3153
  "data-testid": "markweave-math-editor-preview"
3146
- }, [H("div", { innerHTML: o.value.html || " " }), o.value.error ? H("small", null, c.value.invalidPreview) : null])
3154
+ }, [U("div", { innerHTML: o.value.html || " " }), o.value.error ? U("small", null, c.value.invalidPreview) : null])
3147
3155
  ]);
3148
3156
  };
3149
3157
  }
3150
- }), ta = Y({
3158
+ }), ta = X({
3151
3159
  name: "MarkweaveVueSlashCommandMenu",
3152
3160
  props: {
3153
3161
  commands: {
@@ -3184,7 +3192,7 @@ var $i = Y({
3184
3192
  }
3185
3193
  },
3186
3194
  setup(e) {
3187
- let t = U(""), n = U(null), r = U(null), i = U(!1), a = U(""), o = U(0), s = G(() => {
3195
+ let t = W(""), n = W(null), r = W(null), i = W(!1), a = W(""), o = W(0), s = K(() => {
3188
3196
  let t = a.value.trim().toLowerCase();
3189
3197
  return (t ? e.messages.slash.emojiItems.filter((e) => [
3190
3198
  e.emoji,
@@ -3206,13 +3214,13 @@ var $i = Y({
3206
3214
  } : {
3207
3215
  kind: e.inputCommand.uploadKind ?? "attachment",
3208
3216
  trigger: "slash-command",
3209
- source: I(t.value)
3217
+ source: F(t.value)
3210
3218
  };
3211
3219
  if (!n.value && !t.value.trim()) {
3212
3220
  r.value = e.messages.slash.uploadRequiredError;
3213
3221
  return;
3214
3222
  }
3215
- let a = await te(i, e.onUpload);
3223
+ let a = await L(i, e.onUpload);
3216
3224
  e.onSelect(e.inputCommand, { uploadResult: a }), e.onInputCommandChange(null), t.value = "", n.value = null;
3217
3225
  } catch (t) {
3218
3226
  r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
@@ -3239,32 +3247,32 @@ var $i = Y({
3239
3247
  group: t,
3240
3248
  commands: e.commands.filter((e) => e.group === t)
3241
3249
  })).filter((e) => e.commands.length);
3242
- return H("div", {
3250
+ return U("div", {
3243
3251
  class: "markweave-slash-layer",
3244
3252
  style: { display: "contents" },
3245
3253
  "data-testid": "markweave-slash-layer"
3246
- }, [H("div", {
3254
+ }, [U("div", {
3247
3255
  class: "markweave-slash-trigger",
3248
3256
  style: d,
3249
3257
  "aria-hidden": "true",
3250
3258
  "data-testid": "markweave-slash-trigger"
3251
- }, [H("span", null, "/"), H("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), H("div", {
3259
+ }, [U("span", null, "/"), U("em", null, e.state.query || e.messages.slash.filterPlaceholder)]), U("div", {
3252
3260
  class: "markweave-slash-menu",
3253
3261
  style: u,
3254
3262
  role: "listbox",
3255
3263
  "aria-label": e.messages.slash.ariaLabel,
3256
3264
  "data-placement": e.position.placement,
3257
3265
  "data-testid": "markweave-slash-menu"
3258
- }, [e.inputCommand?.inputKind === "emoji" ? H("div", {
3266
+ }, [e.inputCommand?.inputKind === "emoji" ? U("div", {
3259
3267
  class: "markweave-slash-subpanel",
3260
3268
  "data-testid": "markweave-slash-emoji-picker"
3261
3269
  }, [
3262
- H("div", { class: "markweave-slash-subpanel-header" }, [H("button", {
3270
+ U("div", { class: "markweave-slash-subpanel-header" }, [U("button", {
3263
3271
  type: "button",
3264
3272
  onMousedown: $,
3265
3273
  onClick: () => e.onInputCommandChange(null)
3266
- }, e.messages.common.back), H("span", null, e.messages.slash.emojiTitle)]),
3267
- H("label", { class: "markweave-slash-input" }, [H("span", null, "/"), H("input", {
3274
+ }, e.messages.common.back), U("span", null, e.messages.slash.emojiTitle)]),
3275
+ U("label", { class: "markweave-slash-input" }, [U("span", null, "/"), U("input", {
3268
3276
  autofocus: !0,
3269
3277
  value: a.value,
3270
3278
  placeholder: e.messages.slash.emojiSearchPlaceholder,
@@ -3275,11 +3283,11 @@ var $i = Y({
3275
3283
  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));
3276
3284
  }
3277
3285
  })]),
3278
- H("div", {
3286
+ U("div", {
3279
3287
  class: "markweave-slash-emoji-grid",
3280
3288
  role: "listbox",
3281
3289
  "aria-label": e.messages.slash.emojiTitle
3282
- }, s.value.map((e, t) => H("button", {
3290
+ }, s.value.map((e, t) => U("button", {
3283
3291
  key: `${e.emoji}-${e.label}`,
3284
3292
  type: "button",
3285
3293
  role: "option",
@@ -3288,17 +3296,17 @@ var $i = Y({
3288
3296
  onMouseenter: () => o.value = t,
3289
3297
  onMousedown: $,
3290
3298
  onClick: () => l(t)
3291
- }, [H("span", null, e.emoji), H("small", null, e.label)])))
3292
- ]) : e.inputCommand?.inputKind === "upload" ? H("div", {
3299
+ }, [U("span", null, e.emoji), U("small", null, e.label)])))
3300
+ ]) : e.inputCommand?.inputKind === "upload" ? U("div", {
3293
3301
  class: "markweave-slash-subpanel",
3294
3302
  "data-testid": "markweave-slash-upload-panel"
3295
3303
  }, [
3296
- H("div", { class: "markweave-slash-upload-header" }, [H("button", {
3304
+ U("div", { class: "markweave-slash-upload-header" }, [U("button", {
3297
3305
  type: "button",
3298
3306
  onMousedown: $,
3299
3307
  onClick: () => e.onInputCommandChange(null)
3300
- }, e.messages.common.back), H("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
3301
- H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.slash.uploadValueLabel), H("input", {
3308
+ }, e.messages.common.back), U("strong", null, e.inputCommand ? e.messages.slash.uploadKindLabels[e.inputCommand.uploadKind ?? "upload"] : e.messages.slash.uploadKindLabels.upload)]),
3309
+ U("label", { class: "markweave-slash-upload-field" }, [U("span", null, e.messages.slash.uploadValueLabel), U("input", {
3302
3310
  autofocus: !0,
3303
3311
  value: t.value,
3304
3312
  placeholder: e.messages.slash.uploadValuePlaceholder,
@@ -3309,32 +3317,32 @@ var $i = Y({
3309
3317
  e.key === "Enter" && (e.preventDefault(), c());
3310
3318
  }
3311
3319
  })]),
3312
- H("label", { class: "markweave-slash-upload-field" }, [H("span", null, e.messages.common.file), H("input", {
3320
+ U("label", { class: "markweave-slash-upload-field" }, [U("span", null, e.messages.common.file), U("input", {
3313
3321
  type: "file",
3314
3322
  onChange: (e) => n.value = e.target.files?.[0] ?? null
3315
3323
  })]),
3316
- r.value ? H("div", {
3324
+ r.value ? U("div", {
3317
3325
  class: "markweave-slash-upload-error",
3318
3326
  role: "alert"
3319
3327
  }, r.value) : null,
3320
- H("div", { class: "markweave-slash-upload-actions" }, [H("button", {
3328
+ U("div", { class: "markweave-slash-upload-actions" }, [U("button", {
3321
3329
  type: "button",
3322
3330
  onMousedown: $,
3323
3331
  onClick: () => e.onInputCommandChange(null)
3324
- }, e.messages.common.cancel), H("button", {
3332
+ }, e.messages.common.cancel), U("button", {
3325
3333
  type: "button",
3326
3334
  "data-primary": "true",
3327
3335
  disabled: i.value,
3328
3336
  onMousedown: $,
3329
3337
  onClick: c
3330
3338
  }, e.messages.common.insert)])
3331
- ]) : e.commands.length ? H("div", { class: "markweave-slash-command-list" }, f.map((t) => H("section", {
3339
+ ]) : e.commands.length ? U("div", { class: "markweave-slash-command-list" }, f.map((t) => U("section", {
3332
3340
  key: t.group,
3333
3341
  class: "markweave-slash-group",
3334
3342
  "aria-label": t.group
3335
- }, [H("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
3336
- let n = e.commands.indexOf(t) === e.state.activeIndex, r = Zt(t);
3337
- return H("button", {
3343
+ }, [U("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
3344
+ let n = e.commands.indexOf(t) === e.state.activeIndex, r = Xt(t);
3345
+ return U("button", {
3338
3346
  key: t.id,
3339
3347
  type: "button",
3340
3348
  role: "option",
@@ -3357,10 +3365,10 @@ var $i = Y({
3357
3365
  }
3358
3366
  }, [
3359
3367
  Xi(t.icon),
3360
- H("span", null, t.label),
3361
- t.disabledReason ? H("small", null, t.disabledReason) : null
3368
+ U("span", null, t.label),
3369
+ t.disabledReason ? U("small", null, t.disabledReason) : null
3362
3370
  ]);
3363
- })]))) : H("div", {
3371
+ })]))) : U("div", {
3364
3372
  class: "markweave-slash-menu__empty",
3365
3373
  role: "option",
3366
3374
  "aria-disabled": "true"
@@ -3368,33 +3376,33 @@ var $i = Y({
3368
3376
  };
3369
3377
  }
3370
3378
  }), na = {
3371
- "ask-ai": ui,
3372
- "move-left": gr,
3373
- "move-right": _r,
3374
- "move-up": vr,
3375
- "move-down": mr,
3376
- "insert-left": Cr,
3377
- "insert-right": Sr,
3378
- "insert-above": xr,
3379
- "insert-below": br,
3380
- "sort-asc": hr,
3381
- "sort-desc": yr,
3382
- color: ti,
3383
- alignment: cr,
3384
- clear: fi,
3385
- duplicate: Fr,
3386
- copy: Fr,
3387
- merge: _i,
3388
- split: vi,
3389
- delete: bi
3379
+ "ask-ai": li,
3380
+ "move-left": hr,
3381
+ "move-right": gr,
3382
+ "move-up": _r,
3383
+ "move-down": pr,
3384
+ "insert-left": Sr,
3385
+ "insert-right": xr,
3386
+ "insert-above": br,
3387
+ "insert-below": yr,
3388
+ "sort-asc": mr,
3389
+ "sort-desc": vr,
3390
+ color: ei,
3391
+ alignment: sr,
3392
+ clear: di,
3393
+ duplicate: Pr,
3394
+ copy: Pr,
3395
+ merge: gi,
3396
+ split: _i,
3397
+ delete: yi
3390
3398
  }, ra = {
3391
- left: cr,
3392
- center: or,
3393
- right: lr,
3394
- top: fr,
3395
- middle: ur,
3396
- bottom: dr
3397
- }, ia = Y({
3399
+ left: sr,
3400
+ center: ar,
3401
+ right: cr,
3402
+ top: dr,
3403
+ middle: lr,
3404
+ bottom: ur
3405
+ }, ia = X({
3398
3406
  name: "MarkweaveVueTableControls",
3399
3407
  props: {
3400
3408
  editor: {
@@ -3431,13 +3439,13 @@ var $i = Y({
3431
3439
  }
3432
3440
  },
3433
3441
  setup(e) {
3434
- let t = U(null), n = U(null), r = U("row-edge"), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U(null), u = U(null), d = U(null), f = U(0), p = U(null), m = U(null), h = U(null), g = U(null), _ = U(null), v = U(null), y = U(null), b = null, x = null, S = null, C = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = G(() => e.active ? dn(e.editor.state) : Hi), T = G(() => An(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = G(() => An(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = G(() => En(e.editor)), O = G(() => (D.value, w.value.active && Pn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = G(() => t.value ? Pn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
3442
+ let t = W(null), n = W(null), r = W("row-edge"), i = W(null), a = W(null), o = W(null), s = W(null), c = W(null), l = W(null), u = W(null), d = W(null), f = W(0), p = W(null), m = W(null), h = W(null), g = W(null), _ = W(null), v = W(null), y = W(null), b = null, x = null, S = null, C = K(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = K(() => e.active ? un(e.editor.state) : Vi), T = K(() => kn(e.editor, e.interactionState, "row", w.value.activeCellPos)), E = K(() => kn(e.editor, e.interactionState, "column", w.value.activeCellPos)), D = K(() => Tn(e.editor)), O = K(() => (D.value, w.value.active && Nn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), k = K(() => t.value ? Nn(e.editor, t.value, { askAiEnabled: C.value }) : []), A = () => {
3435
3443
  b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
3436
3444
  }, j = (e) => {
3437
3445
  A(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
3438
3446
  d.value = null, b = null;
3439
- }, Bn));
3440
- }, M = () => {
3447
+ }, zn));
3448
+ }, ee = () => {
3441
3449
  if (!e.active) {
3442
3450
  i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, j(null);
3443
3451
  return;
@@ -3447,31 +3455,31 @@ var $i = Y({
3447
3455
  i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
3448
3456
  return;
3449
3457
  }
3450
- let l = n.getBoundingClientRect(), u = T.value ? kn(e.editor, T.value) : null, d = E.value ? kn(e.editor, E.value) : null, f = O.value ? Fn(e.editor) : null, p = Tn(e.editor)?.getBoundingClientRect() ?? null;
3451
- u ? i.value = bn({
3458
+ let l = n.getBoundingClientRect(), u = T.value ? On(e.editor, T.value) : null, d = E.value ? On(e.editor, E.value) : null, f = O.value ? Pn(e.editor) : null, p = wn(e.editor)?.getBoundingClientRect() ?? null;
3459
+ u ? i.value = yn({
3452
3460
  targetRect: u,
3453
3461
  frameRect: l,
3454
3462
  kind: "row"
3455
- }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = bn({
3463
+ }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = yn({
3456
3464
  targetRect: d,
3457
3465
  frameRect: l,
3458
3466
  kind: "column"
3459
- }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = bn({
3467
+ }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = yn({
3460
3468
  targetRect: f,
3461
3469
  frameRect: l,
3462
3470
  kind: "selection"
3463
3471
  }) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
3464
3472
  let m = e.interactionState.hoverCellPos !== null && !!(T.value && T.value.index === T.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(E.value && E.value.index === E.value.visualWidth - 1);
3465
- s.value = p && m ? xn({
3473
+ s.value = p && m ? bn({
3466
3474
  tableRect: p,
3467
3475
  frameRect: l,
3468
3476
  kind: "row"
3469
- }) : null, c.value = p && h ? xn({
3477
+ }) : null, c.value = p && h ? bn({
3470
3478
  tableRect: p,
3471
3479
  frameRect: l,
3472
3480
  kind: "column"
3473
3481
  }) : null;
3474
- }, ee = () => {
3482
+ }, te = () => {
3475
3483
  if (!e.active || !t.value) {
3476
3484
  l.value = null;
3477
3485
  return;
@@ -3481,23 +3489,23 @@ var $i = Y({
3481
3489
  l.value = null;
3482
3490
  return;
3483
3491
  }
3484
- let a = i.getBoundingClientRect(), o = t.value === "row" ? Tn(e.editor)?.getBoundingClientRect() : null, s = o ? {
3492
+ let a = i.getBoundingClientRect(), o = t.value === "row" ? wn(e.editor)?.getBoundingClientRect() : null, s = o ? {
3485
3493
  left: a.left,
3486
3494
  top: o.top,
3487
3495
  width: a.width,
3488
3496
  height: a.height
3489
3497
  } : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
3490
- l.value = vn({
3498
+ l.value = _n({
3491
3499
  anchorRect: s,
3492
3500
  frameRect: c,
3493
- boundaryRect: jn(n),
3501
+ boundaryRect: An(n),
3494
3502
  menuSize: {
3495
3503
  width: u.width || 254,
3496
3504
  height: f || u.height || 410
3497
3505
  },
3498
3506
  kind: t.value
3499
3507
  });
3500
- }, N = () => {
3508
+ }, M = () => {
3501
3509
  if (!e.active || !t.value || !n.value || !l.value) {
3502
3510
  u.value = null;
3503
3511
  return;
@@ -3508,61 +3516,61 @@ var $i = Y({
3508
3516
  return;
3509
3517
  }
3510
3518
  let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
3511
- u.value = yn({
3519
+ u.value = vn({
3512
3520
  triggerRect: i.getBoundingClientRect(),
3513
3521
  parentMenuRect: _.value.getBoundingClientRect(),
3514
- boundaryRect: jn(r),
3522
+ boundaryRect: An(r),
3515
3523
  submenuSize: {
3516
3524
  width: a.width || 238,
3517
3525
  height: o || 410
3518
3526
  }
3519
3527
  });
3528
+ }, N = () => {
3529
+ ee(), te(), M();
3520
3530
  }, P = () => {
3521
- M(), ee(), N();
3522
- }, F = () => {
3523
- J(P);
3524
- }, I = (e, i) => {
3531
+ Y(N);
3532
+ }, F = (e, i) => {
3525
3533
  let a = t.value === e && r.value === i;
3526
- r.value = i, t.value = a ? null : e, n.value = null, u.value = null, F();
3527
- }, L = () => {
3528
- e.editor.view.dispatch(cn(e.editor.state.tr, null));
3529
- }, te = (t, n) => {
3534
+ r.value = i, t.value = a ? null : e, n.value = null, u.value = null, P();
3535
+ }, I = () => {
3536
+ e.editor.view.dispatch(sn(e.editor.state.tr, null));
3537
+ }, L = (t, n) => {
3530
3538
  let r = e.interactionState.hoverCellPos ?? w.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
3531
- r !== null && Rn(e.editor, r, t, { visualIndex: i }), I(t, n);
3539
+ r !== null && Ln(e.editor, r, t, { visualIndex: i }), F(t, n);
3532
3540
  }, R = () => {
3533
- L(), I("selection", "selection-edge");
3541
+ I(), F("selection", "selection-edge");
3534
3542
  }, z = (r = !1) => {
3535
3543
  t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
3536
- }, ne = async (n, r) => {
3537
- let i = await Cn({
3544
+ }, B = async (n, r) => {
3545
+ let i = await Sn({
3538
3546
  editor: e.editor,
3539
3547
  commandId: n,
3540
3548
  menu: r ?? t.value ?? "selection",
3541
3549
  messages: e.messages
3542
3550
  });
3543
3551
  return i.copyFeedback ? (j(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : j(null), e.onCommandResult?.(i.commandResult), i.success;
3544
- }, re = (t) => {
3545
- C.value && (Ve(e.editor, t), z(!1));
3546
- }, B = (e) => {
3547
- t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, F());
3548
- }, ie = (t) => {
3552
+ }, V = (t) => {
3553
+ C.value && (Be(e.editor, t), z(!1));
3554
+ }, H = (e) => {
3555
+ t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, P());
3556
+ }, ne = (t) => {
3549
3557
  let n = t === "row" ? T.value : E.value, r = e.interactionState.hoverCellPos ?? w.value.activeCellPos;
3550
- !n || r === null || Wn(e.editor, r, t, { visualIndex: n.index }) && ne(t === "row" ? "add-row-after" : "add-column-after", t);
3551
- }, ae = (e, t, n) => {
3558
+ !n || r === null || Un(e.editor, r, t, { visualIndex: n.index }) && B(t === "row" ? "add-row-after" : "add-column-after", t);
3559
+ }, re = (e, t, n) => {
3552
3560
  x = {
3553
3561
  axis: e,
3554
3562
  index: t
3555
3563
  }, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
3556
- }, oe = (t) => {
3564
+ }, ie = (t) => {
3557
3565
  if (!x) return;
3558
- let n = Dn(e.editor, x.axis, t.clientX, t.clientY);
3566
+ let n = En(e.editor, x.axis, t.clientX, t.clientY);
3559
3567
  n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
3560
- }, se = (t) => {
3568
+ }, ae = (t) => {
3561
3569
  let n = x;
3562
3570
  if (!n) return;
3563
- let r = Dn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
3564
- t.preventDefault(), x = null, S = null, r !== null && Ln(e.editor, n.axis, n.index, r);
3565
- }, V = G(() => (f.value, t.value === "row" || t.value === "column" ? On(e.editor, t.value) : null)), ce = (e) => {
3571
+ let r = En(e.editor, n.axis, t.clientX, t.clientY) ?? S;
3572
+ t.preventDefault(), x = null, S = null, r !== null && In(e.editor, n.axis, n.index, r);
3573
+ }, oe = K(() => (f.value, t.value === "row" || t.value === "column" ? Dn(e.editor, t.value) : null)), se = (e) => {
3566
3574
  if (!(!t.value || e.key !== "Escape")) {
3567
3575
  if (n.value) {
3568
3576
  n.value = null;
@@ -3570,20 +3578,20 @@ var $i = Y({
3570
3578
  }
3571
3579
  z(!0);
3572
3580
  }
3573
- }, le = (e) => {
3581
+ }, ce = (e) => {
3574
3582
  if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
3575
3583
  let t = e.currentTarget;
3576
3584
  if (!(t instanceof HTMLElement)) return;
3577
3585
  let n = t.classList.contains("markweave-table-menu") ? t.querySelector(":scope > .markweave-table-menu-scroll") ?? t : t, r = Array.from(n.querySelectorAll(":scope > button[role=\"menuitem\"]:not(:disabled), :scope > button[role=\"menuitemradio\"]:not(:disabled)")), i = r.indexOf(document.activeElement), a = e.key === "ArrowDown" ? 1 : -1, o = i < 0 ? 0 : Math.min(r.length - 1, Math.max(0, i + a));
3578
3586
  e.preventDefault(), e.stopPropagation(), r[o]?.focus();
3579
- }, ue = (e) => {
3587
+ }, le = (e) => {
3580
3588
  t.value && (e.target instanceof Node && p.value?.contains(e.target) || z());
3581
3589
  };
3582
- rr(() => {
3583
- P(), window.addEventListener("resize", P), window.addEventListener("scroll", P, !0), document.addEventListener("keydown", ce), document.addEventListener("mousedown", ue), document.addEventListener("dragover", oe), document.addEventListener("drop", se);
3584
- }), q(() => {
3585
- A(), window.removeEventListener("resize", P), window.removeEventListener("scroll", P, !0), document.removeEventListener("keydown", ce), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", oe), document.removeEventListener("drop", se);
3586
- }), K(() => [
3590
+ nr(() => {
3591
+ N(), window.addEventListener("resize", N), window.addEventListener("scroll", N, !0), document.addEventListener("keydown", se), document.addEventListener("mousedown", le), document.addEventListener("dragover", ie), document.addEventListener("drop", ae);
3592
+ }), J(() => {
3593
+ A(), window.removeEventListener("resize", N), window.removeEventListener("scroll", N, !0), document.removeEventListener("keydown", se), document.removeEventListener("mousedown", le), document.removeEventListener("dragover", ie), document.removeEventListener("drop", ae);
3594
+ }), q(() => [
3587
3595
  e.active,
3588
3596
  w.value.activeCellPos,
3589
3597
  w.value.selectionFrom,
@@ -3594,12 +3602,12 @@ var $i = Y({
3594
3602
  t.value,
3595
3603
  n.value,
3596
3604
  r.value
3597
- ], F, { flush: "post" });
3598
- let de = () => {
3605
+ ], P, { flush: "post" });
3606
+ let ue = () => {
3599
3607
  if (!t.value) return null;
3600
3608
  let r = k.value.map((r, i) => {
3601
- let a = Mn(r), o = i === 0 ? a : Mn(k.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && Oe(e.editor, c) : Sn(e.editor, r.commandId), u = Nn(r, e.messages), d = na[r.icon];
3602
- return H("button", {
3609
+ let a = jn(r), o = i === 0 ? a : jn(k.value[i - 1]), s = i > 0 && o !== a, c = t.value === "row" || t.value === "column" ? t.value : "selection", l = r.submenuId ? !0 : r.commandId === null ? C.value && De(e.editor, c) : xn(e.editor, r.commandId), u = Mn(r, e.messages), d = na[r.icon];
3610
+ return U("button", {
3603
3611
  key: `${r.id}-${i}`,
3604
3612
  type: "button",
3605
3613
  role: "menuitem",
@@ -3615,7 +3623,7 @@ var $i = Y({
3615
3623
  "data-submenu-trigger": r.submenuId ?? void 0,
3616
3624
  "data-testid": r.commandId ? `markweave-table-menu-command-${r.commandId}` : r.submenuId ? `markweave-table-menu-submenu-${r.submenuId}` : "markweave-table-menu-command-edit-with-ai",
3617
3625
  onMousedown: (e) => {
3618
- $(e), l && r.id === "edit-with-ai" && re(c);
3626
+ $(e), l && r.id === "edit-with-ai" && V(c);
3619
3627
  },
3620
3628
  onMouseenter: () => {
3621
3629
  n.value = r.submenuId;
@@ -3627,33 +3635,33 @@ var $i = Y({
3627
3635
  return;
3628
3636
  }
3629
3637
  if (r.commandId === null) {
3630
- e.detail === 0 && re(c);
3638
+ e.detail === 0 && V(c);
3631
3639
  return;
3632
3640
  }
3633
- ne(r.commandId).finally(() => z());
3641
+ B(r.commandId).finally(() => z());
3634
3642
  }
3635
3643
  }
3636
3644
  }, [
3637
- H("span", {
3645
+ U("span", {
3638
3646
  class: "markweave-table-menu-item-icon",
3639
3647
  "aria-hidden": "true"
3640
- }, [H(d, {
3648
+ }, [U(d, {
3641
3649
  size: 18,
3642
3650
  strokeWidth: 1.8
3643
3651
  })]),
3644
- H("span", { class: "markweave-table-menu-item-label" }, u),
3645
- r.submenuId ? H(Ar, {
3652
+ U("span", { class: "markweave-table-menu-item-label" }, u),
3653
+ r.submenuId ? U(kr, {
3646
3654
  class: "markweave-table-menu-chevron",
3647
3655
  size: 16,
3648
3656
  "aria-hidden": "true"
3649
3657
  }) : null
3650
3658
  ]);
3651
- }), i = [H("div", {
3659
+ }), i = [U("div", {
3652
3660
  ref: v,
3653
3661
  class: "markweave-table-menu-scroll",
3654
3662
  style: l.value ? { maxHeight: `${Math.max(1, l.value.maxHeight - 12)}px` } : void 0
3655
3663
  }, r)];
3656
- if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(H("div", {
3664
+ if (n.value === "color" && (t.value === "row" || t.value === "column") && i.push(U("div", {
3657
3665
  ref: y,
3658
3666
  class: "markweave-table-submenu markweave-table-color-menu",
3659
3667
  role: "menu",
@@ -3666,43 +3674,43 @@ var $i = Y({
3666
3674
  top: `${u.value.top}px`,
3667
3675
  maxHeight: `${u.value.maxHeight}px`
3668
3676
  } : void 0,
3669
- onKeydown: le
3677
+ onKeydown: ce
3670
3678
  }, [
3671
- H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
3672
- ...zn.map((t) => H("button", {
3679
+ U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
3680
+ ...Rn.map((t) => U("button", {
3673
3681
  key: `text-${t.id}`,
3674
3682
  type: "button",
3675
3683
  role: "menuitemradio",
3676
- "aria-checked": V.value?.textColorId === t.id,
3677
- "data-active": V.value?.textColorId === t.id ? "true" : "false",
3684
+ "aria-checked": oe.value?.textColorId === t.id,
3685
+ "data-active": oe.value?.textColorId === t.id ? "true" : "false",
3678
3686
  "data-testid": `markweave-table-text-color-${t.id}`,
3679
3687
  onMousedown: $,
3680
- onClick: () => B((n) => _n(e.editor, n, t.id))
3681
- }, [H("span", {
3688
+ onClick: () => H((n) => gn(e.editor, n, t.id))
3689
+ }, [U("span", {
3682
3690
  class: "markweave-table-color-swatch markweave-table-text-color-swatch",
3683
3691
  "aria-hidden": "true",
3684
3692
  style: { backgroundColor: t.textColor ?? "var(--markweave-text)" }
3685
- }), H("span", null, e.messages.table.colors[t.id].text)])),
3686
- H("div", { class: "markweave-table-submenu-separator" }),
3687
- H("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
3688
- ...zn.map((t) => H("button", {
3693
+ }), U("span", null, e.messages.table.colors[t.id].text)])),
3694
+ U("div", { class: "markweave-table-submenu-separator" }),
3695
+ U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
3696
+ ...Rn.map((t) => U("button", {
3689
3697
  key: `background-${t.id}`,
3690
3698
  type: "button",
3691
3699
  role: "menuitemradio",
3692
- "aria-checked": V.value?.backgroundColorId === t.id,
3693
- "data-active": V.value?.backgroundColorId === t.id ? "true" : "false",
3700
+ "aria-checked": oe.value?.backgroundColorId === t.id,
3701
+ "data-active": oe.value?.backgroundColorId === t.id ? "true" : "false",
3694
3702
  "data-testid": `markweave-table-background-color-${t.id}`,
3695
3703
  onMousedown: $,
3696
- onClick: () => B((n) => gn(e.editor, n, t.id))
3697
- }, [H("span", {
3704
+ onClick: () => H((n) => hn(e.editor, n, t.id))
3705
+ }, [U("span", {
3698
3706
  class: "markweave-table-color-swatch",
3699
3707
  "aria-hidden": "true",
3700
3708
  style: { backgroundColor: t.backgroundColor }
3701
- }), H("span", null, e.messages.table.colors[t.id].background)]))
3709
+ }), U("span", null, e.messages.table.colors[t.id].background)]))
3702
3710
  ])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
3703
3711
  let t = (t, n) => {
3704
3712
  let r = ra[t];
3705
- return H("button", {
3713
+ return U("button", {
3706
3714
  key: t,
3707
3715
  type: "button",
3708
3716
  role: "menuitemradio",
@@ -3710,14 +3718,14 @@ var $i = Y({
3710
3718
  "data-active": n ? "true" : "false",
3711
3719
  "data-testid": `markweave-table-alignment-${t}`,
3712
3720
  onMousedown: $,
3713
- onClick: () => B((n) => hn(e.editor, n, t))
3714
- }, [H(r, {
3721
+ onClick: () => H((n) => mn(e.editor, n, t))
3722
+ }, [U(r, {
3715
3723
  size: 18,
3716
3724
  strokeWidth: 1.8,
3717
3725
  "aria-hidden": "true"
3718
- }), H("span", null, e.messages.table.alignments[t])]);
3726
+ }), U("span", null, e.messages.table.alignments[t])]);
3719
3727
  };
3720
- i.push(H("div", {
3728
+ i.push(U("div", {
3721
3729
  ref: y,
3722
3730
  class: "markweave-table-submenu markweave-table-alignment-menu",
3723
3731
  role: "menu",
@@ -3730,18 +3738,18 @@ var $i = Y({
3730
3738
  top: `${u.value.top}px`,
3731
3739
  maxHeight: `${u.value.maxHeight}px`
3732
3740
  } : void 0,
3733
- onKeydown: le
3741
+ onKeydown: ce
3734
3742
  }, [
3735
- ...Vn.map((e) => t(e, V.value?.textAlign === e)),
3736
- H("div", { class: "markweave-table-submenu-separator" }),
3737
- ...Un.map((e) => t(e, V.value?.verticalAlign === e))
3743
+ ...Bn.map((e) => t(e, oe.value?.textAlign === e)),
3744
+ U("div", { class: "markweave-table-submenu-separator" }),
3745
+ ...Hn.map((e) => t(e, oe.value?.verticalAlign === e))
3738
3746
  ]));
3739
3747
  }
3740
- return H("div", {
3748
+ return U("div", {
3741
3749
  ref: _,
3742
3750
  class: "markweave-table-menu",
3743
3751
  role: "menu",
3744
- "aria-label": Hn(t.value, e.messages),
3752
+ "aria-label": Vn(t.value, e.messages),
3745
3753
  "data-testid": "markweave-table-menu",
3746
3754
  "data-positioned": l.value ? "true" : "false",
3747
3755
  "data-placement": l.value?.placement,
@@ -3750,19 +3758,19 @@ var $i = Y({
3750
3758
  left: `${l.value.left}px`,
3751
3759
  top: `${l.value.top}px`
3752
3760
  } : void 0,
3753
- onKeydown: le
3761
+ onKeydown: ce
3754
3762
  }, i);
3755
3763
  };
3756
- return () => e.active ? H("div", {
3764
+ return () => e.active ? U("div", {
3757
3765
  ref: p,
3758
3766
  class: "markweave-table-controls",
3759
3767
  "data-testid": "markweave-table-controls",
3760
3768
  "aria-label": e.messages.table.controlsAriaLabel,
3761
3769
  "data-open-menu": t.value ?? "none",
3762
3770
  "data-positioned": i.value || a.value || o.value ? "true" : "false",
3763
- onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(mn, { type: "clear-hover" }))
3771
+ onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(pn, { type: "clear-hover" }))
3764
3772
  }, [
3765
- d.value ? H("div", {
3773
+ d.value ? U("div", {
3766
3774
  class: "markweave-table-copy-feedback",
3767
3775
  role: "status",
3768
3776
  "aria-live": "polite",
@@ -3770,8 +3778,8 @@ var $i = Y({
3770
3778
  "data-copy-kind": d.value.kind,
3771
3779
  "data-text-length": d.value.textLength,
3772
3780
  "data-html-length": d.value.htmlLength
3773
- }, wn(d.value)) : null,
3774
- i.value ? H("button", {
3781
+ }, Cn(d.value)) : null,
3782
+ i.value ? U("button", {
3775
3783
  ref: m,
3776
3784
  type: "button",
3777
3785
  draggable: !0,
@@ -3792,16 +3800,16 @@ var $i = Y({
3792
3800
  height: `${i.value.height}px`
3793
3801
  },
3794
3802
  onMousedown: $,
3795
- onClick: () => te("row", "row-edge"),
3796
- onDragstart: (e) => ae("row", T.value?.index ?? 0, e),
3803
+ onClick: () => L("row", "row-edge"),
3804
+ onDragstart: (e) => re("row", T.value?.index ?? 0, e),
3797
3805
  onDragend: () => {
3798
3806
  x = null, S = null;
3799
3807
  }
3800
- }, [H(ei, {
3808
+ }, [U($r, {
3801
3809
  size: 14,
3802
3810
  "aria-hidden": "true"
3803
3811
  })]) : null,
3804
- a.value ? H("button", {
3812
+ a.value ? U("button", {
3805
3813
  ref: h,
3806
3814
  type: "button",
3807
3815
  draggable: !0,
@@ -3822,16 +3830,16 @@ var $i = Y({
3822
3830
  height: `${a.value.height}px`
3823
3831
  },
3824
3832
  onMousedown: $,
3825
- onClick: () => te("column", "column-edge"),
3826
- onDragstart: (e) => ae("column", E.value?.index ?? 0, e),
3833
+ onClick: () => L("column", "column-edge"),
3834
+ onDragstart: (e) => re("column", E.value?.index ?? 0, e),
3827
3835
  onDragend: () => {
3828
3836
  x = null, S = null;
3829
3837
  }
3830
- }, [H(ei, {
3838
+ }, [U($r, {
3831
3839
  size: 14,
3832
3840
  "aria-hidden": "true"
3833
3841
  })]) : null,
3834
- O.value && o.value ? H("button", {
3842
+ O.value && o.value ? U("button", {
3835
3843
  ref: g,
3836
3844
  type: "button",
3837
3845
  class: "markweave-table-edge-handle markweave-table-edge-handle--selection",
@@ -3848,11 +3856,11 @@ var $i = Y({
3848
3856
  },
3849
3857
  onMousedown: $,
3850
3858
  onClick: R
3851
- }, [H(ei, {
3859
+ }, [U($r, {
3852
3860
  size: 14,
3853
3861
  "aria-hidden": "true"
3854
3862
  })]) : null,
3855
- s.value ? H("button", {
3863
+ s.value ? U("button", {
3856
3864
  type: "button",
3857
3865
  class: "markweave-table-extend-button markweave-table-extend-button--row",
3858
3866
  "aria-label": e.messages.table.addRow,
@@ -3865,12 +3873,12 @@ var $i = Y({
3865
3873
  height: `${s.value.height}px`
3866
3874
  },
3867
3875
  onMousedown: $,
3868
- onClick: () => ie("row")
3869
- }, [H(ii, {
3876
+ onClick: () => ne("row")
3877
+ }, [U(ri, {
3870
3878
  size: 14,
3871
3879
  "aria-hidden": "true"
3872
3880
  })]) : null,
3873
- c.value ? H("button", {
3881
+ c.value ? U("button", {
3874
3882
  type: "button",
3875
3883
  class: "markweave-table-extend-button markweave-table-extend-button--column",
3876
3884
  "aria-label": e.messages.table.addColumn,
@@ -3883,15 +3891,15 @@ var $i = Y({
3883
3891
  height: `${c.value.height}px`
3884
3892
  },
3885
3893
  onMousedown: $,
3886
- onClick: () => ie("column")
3887
- }, [H(ii, {
3894
+ onClick: () => ne("column")
3895
+ }, [U(ri, {
3888
3896
  size: 14,
3889
3897
  "aria-hidden": "true"
3890
3898
  })]) : null,
3891
- de()
3899
+ ue()
3892
3900
  ]) : null;
3893
3901
  }
3894
- }), aa = Y({
3902
+ }), aa = X({
3895
3903
  name: "MarkweaveVueTableSelectionOverlay",
3896
3904
  props: {
3897
3905
  editor: {
@@ -3904,18 +3912,18 @@ var $i = Y({
3904
3912
  }
3905
3913
  },
3906
3914
  setup(e) {
3907
- let t = U(null), n = () => {
3915
+ let t = W(null), n = () => {
3908
3916
  if (e.focusState.mode !== "cell-selection") {
3909
3917
  t.value = null;
3910
3918
  return;
3911
3919
  }
3912
- t.value = In(e.editor, fn(e.editor.state));
3920
+ t.value = Fn(e.editor, dn(e.editor.state));
3913
3921
  };
3914
- return rr(() => {
3922
+ return nr(() => {
3915
3923
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
3916
- }), q(() => {
3924
+ }), J(() => {
3917
3925
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
3918
- }), K(() => [
3926
+ }), q(() => [
3919
3927
  e.focusState.activeCellPos,
3920
3928
  e.focusState.anchorCellPos,
3921
3929
  e.focusState.mode,
@@ -3923,10 +3931,10 @@ var $i = Y({
3923
3931
  e.focusState.selectionFrom,
3924
3932
  e.focusState.selectionTo
3925
3933
  ], () => {
3926
- J(n);
3934
+ Y(n);
3927
3935
  }, { flush: "post" }), () => {
3928
3936
  let e = t.value;
3929
- return e ? H("div", {
3937
+ return e ? U("div", {
3930
3938
  "aria-hidden": "true",
3931
3939
  class: "markweave-table-selection-overlay",
3932
3940
  "data-axis-target": e.axisTarget ?? "none",
@@ -3948,7 +3956,7 @@ var $i = Y({
3948
3956
  }) : null;
3949
3957
  };
3950
3958
  }
3951
- }), oa = Y({
3959
+ }), oa = X({
3952
3960
  name: "MarkweaveVueCodeBlockControls",
3953
3961
  props: {
3954
3962
  editor: {
@@ -3977,53 +3985,53 @@ var $i = Y({
3977
3985
  }
3978
3986
  },
3979
3987
  setup(e) {
3980
- let t = U(null), n = U(null), r = U(null), i = U(null), a = U(null), o = U(null), s = U(null), c = U(null), l = U([]), u = U(null), d = U(!1), f = U(""), p = U(-1), m = U(null), h = U(!1), g = U(null), _ = U(null), v = U(!1), y = U({
3988
+ let t = W(null), n = W(null), r = W(null), i = W(null), a = W(null), o = W(null), s = W(null), c = W(null), l = W([]), u = W(null), d = W(!1), f = W(""), p = W(-1), m = W(null), h = W(!1), g = W(null), _ = W(null), v = W(!1), y = W({
3981
3989
  active: !1,
3982
3990
  lastX: 0,
3983
3991
  lastY: 0
3984
- }), b = U(0), x = U(0), S = U(0), C = null, w = G(() => (S.value, xt(e.editor, s.value))), T = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
3992
+ }), b = W(0), x = W(0), S = W(0), C = null, w = K(() => (S.value, bt(e.editor, s.value))), T = K(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
3985
3993
  ...e.state,
3986
3994
  pos: e.state.pos,
3987
3995
  active: !0
3988
- } : null), E = G(() => w.value ?? T.value), D = G(() => E.value !== null), O = G(() => E.value?.language === "mermaid"), k = G(() => Et(e.editor, E.value)), A = G(() => D.value && E.value !== null && !k.value), j = G(() => !e.readOnly), M = G(() => E.value ? mt(E.value.language) : mt("text")), ee = G(() => m.value?.status ?? "idle"), N = G(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), P = G(() => O.value && N.value === "preview"), F = G(() => (S.value, b.value, x.value, wt(e.editor))), I = G(() => `${x.value}|${F.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => vt(f.value)), te = G(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), R = () => {
3996
+ } : null), E = K(() => w.value ?? T.value), D = K(() => E.value !== null), O = K(() => E.value?.language === "mermaid"), k = K(() => Tt(e.editor, E.value)), A = K(() => D.value && E.value !== null && !k.value), j = K(() => !e.readOnly), ee = K(() => E.value ? pt(E.value.language) : pt("text")), te = K(() => m.value?.status ?? "idle"), M = K(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), N = K(() => O.value && M.value === "preview"), P = K(() => (S.value, b.value, x.value, Ct(e.editor))), F = K(() => `${x.value}|${P.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), I = K(() => _t(f.value)), L = K(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), R = () => {
3989
3997
  C !== null && (window.clearTimeout(C), C = null);
3990
3998
  }, z = (e) => {
3991
3999
  R(), m.value = e, e && (C = window.setTimeout(() => {
3992
4000
  m.value = null, C = null;
3993
- }, st));
3994
- }, ne = () => {
4001
+ }, ot));
4002
+ }, B = () => {
3995
4003
  g.value = null, _.value = null, v.value = !1, y.value = {
3996
4004
  active: !1,
3997
4005
  lastX: 0,
3998
4006
  lastY: 0
3999
4007
  }, e.editor.view.focus();
4000
- }, B = () => {
4008
+ }, H = () => {
4001
4009
  let n = t.value;
4002
4010
  if (!n) return;
4003
- if (!St(n) || F.value.length === 0) {
4011
+ if (!xt(n) || P.value.length === 0) {
4004
4012
  l.value = [];
4005
4013
  return;
4006
4014
  }
4007
- let r = n.getBoundingClientRect(), i = F.value.flatMap((t) => {
4008
- let n = _t(gt(e.editor, t.pos, t.mermaidPreviewMode), r);
4009
- return n ? [ft(t, n, r)] : [];
4015
+ let r = n.getBoundingClientRect(), i = P.value.flatMap((t) => {
4016
+ let n = gt(ht(e.editor, t.pos, t.mermaidPreviewMode), r);
4017
+ return n ? [dt(t, n, r)] : [];
4010
4018
  });
4011
- l.value = Dt(l.value, i, F.value.map((e) => e.pos));
4012
- }, ie = () => {
4019
+ l.value = Et(l.value, i, P.value.map((e) => e.pos));
4020
+ }, ne = () => {
4013
4021
  if (!A.value || !E.value) {
4014
4022
  c.value = null, u.value = null;
4015
4023
  return;
4016
4024
  }
4017
4025
  let i = t.value;
4018
4026
  if (!i) return;
4019
- let a = gt(e.editor, E.value.pos, N.value), o = i.getBoundingClientRect(), s = _t(a, o);
4027
+ let a = ht(e.editor, E.value.pos, M.value), o = i.getBoundingClientRect(), s = gt(a, o);
4020
4028
  if (!s) {
4021
4029
  c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
4022
4030
  return;
4023
4031
  }
4024
- if (c.value = ut(E.value.pos, s, o), d.value && n.value) {
4032
+ if (c.value = lt(E.value.pos, s, o), d.value && n.value) {
4025
4033
  let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
4026
- u.value = at({
4034
+ u.value = it({
4027
4035
  overlayRect: o,
4028
4036
  buttonRect: e,
4029
4037
  menuHeight: t,
@@ -4031,84 +4039,84 @@ var $i = Y({
4031
4039
  windowHeight: window.innerHeight
4032
4040
  });
4033
4041
  }
4034
- }, ae = async () => {
4042
+ }, re = async () => {
4035
4043
  if (e.readOnly) {
4036
4044
  if (!E.value) return;
4037
- let e = await ct(E.value.text);
4038
- z(et(E.value, e ? "copied" : "failed"));
4045
+ let e = await st(E.value.text);
4046
+ z($e(E.value, e ? "copied" : "failed"));
4039
4047
  return;
4040
4048
  }
4041
- if (!pt(e.editor, E.value)) return;
4042
- let t = await Qe(e.editor);
4043
- z(et($e(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
4044
- }, oe = (t, n) => {
4049
+ if (!ft(e.editor, E.value)) return;
4050
+ let t = await Ze(e.editor);
4051
+ z($e(Qe(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
4052
+ }, ie = (t, n) => {
4045
4053
  if (e.readOnly) {
4046
- Jt(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
4054
+ qt(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
4047
4055
  return;
4048
4056
  }
4049
4057
  let r = e.state.active && e.state.pos === t.pos;
4050
- it(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
4051
- }, se = (t) => {
4058
+ rt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
4059
+ }, ae = (t) => {
4052
4060
  if (e.readOnly || !E.value) return;
4053
4061
  let n = e.state.active && e.state.pos === E.value.pos;
4054
- rt(e.editor, E.value.pos, t) && (t === "mermaid" && it(e.editor, E.value.pos, "preview") && e.onMermaidModeChange("preview"), d.value = !1, f.value = "", p.value = -1, S.value += 1, n && e.editor.view.focus());
4055
- }, V = () => {
4056
- d.value = !d.value, d.value && o.value === null && (o.value = lt()), p.value = d.value ? Ct(L.value, E.value?.language ?? null) : -1;
4057
- }, ce = (e) => {
4058
- let t = vt(e);
4059
- f.value = e, p.value = Ct(t, e.trim() ? null : E.value?.language ?? null);
4060
- }, le = (t) => {
4062
+ nt(e.editor, E.value.pos, t) && (t === "mermaid" && rt(e.editor, E.value.pos, "preview") && e.onMermaidModeChange("preview"), d.value = !1, f.value = "", p.value = -1, S.value += 1, n && e.editor.view.focus());
4063
+ }, oe = () => {
4064
+ d.value = !d.value, d.value && o.value === null && (o.value = ct()), p.value = d.value ? St(I.value, E.value?.language ?? null) : -1;
4065
+ }, se = (e) => {
4066
+ let t = _t(e);
4067
+ f.value = e, p.value = St(t, e.trim() ? null : E.value?.language ?? null);
4068
+ }, ce = (t) => {
4061
4069
  if (!t.isComposing) {
4062
4070
  if (t.key === "ArrowDown" || t.key === "ArrowUp") {
4063
- t.preventDefault(), p.value = kt(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
4071
+ t.preventDefault(), p.value = Ot(p.value, I.value.length, t.key === "ArrowUp" ? "previous" : "next");
4064
4072
  return;
4065
4073
  }
4066
4074
  if (t.key === "Enter") {
4067
- let e = L.value[p.value];
4068
- e && (t.preventDefault(), se(e.language));
4075
+ let e = I.value[p.value];
4076
+ e && (t.preventDefault(), ae(e.language));
4069
4077
  return;
4070
4078
  }
4071
4079
  t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
4072
4080
  }
4081
+ }, le = () => {
4082
+ e.readOnly || !E.value || tt(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
4073
4083
  }, ue = () => {
4074
- e.readOnly || !E.value || nt(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
4075
- }, de = () => {
4076
4084
  if (!E.value) return;
4077
- let t = Tt(e.editor, E.value.pos);
4078
- t && re({
4085
+ let t = wt(e.editor, E.value.pos);
4086
+ t && V({
4079
4087
  data: new Blob([t], { type: "image/svg+xml" }),
4080
4088
  fileName: "markweave-mermaid.svg",
4081
4089
  onSettled: () => e.editor.view.focus(),
4082
4090
  ownerDocument: document
4083
4091
  });
4084
- }, fe = () => {
4092
+ }, de = () => {
4085
4093
  if (!E.value) return;
4086
- let t = Tt(e.editor, E.value.pos);
4087
- t && (g.value = dt(t), _.value = null, v.value = !1, y.value = {
4094
+ let t = wt(e.editor, E.value.pos);
4095
+ t && (g.value = ut(t), _.value = null, v.value = !1, y.value = {
4088
4096
  active: !1,
4089
4097
  lastX: 0,
4090
4098
  lastY: 0
4091
4099
  });
4092
- }, pe = (e) => {
4100
+ }, fe = (e) => {
4093
4101
  g.value = g.value ? {
4094
4102
  ...g.value,
4095
- scale: ot(g.value.scale + e)
4103
+ scale: at(g.value.scale + e)
4096
4104
  } : null;
4097
- }, me = () => {
4098
- g.value = g.value ? dt(g.value.svg) : null, y.value = {
4105
+ }, pe = () => {
4106
+ g.value = g.value ? ut(g.value.svg) : null, y.value = {
4099
4107
  active: !1,
4100
4108
  lastX: 0,
4101
4109
  lastY: 0
4102
4110
  }, v.value = !1;
4111
+ }, me = (e) => {
4112
+ e.preventDefault(), fe(e.deltaY < 0 ? Dt : -Dt);
4103
4113
  }, he = (e) => {
4104
- e.preventDefault(), pe(e.deltaY < 0 ? Ot : -Ot);
4105
- }, ge = (e) => {
4106
4114
  e.button === 0 && (e.preventDefault(), y.value = {
4107
4115
  active: !0,
4108
4116
  lastX: e.clientX,
4109
4117
  lastY: e.clientY
4110
4118
  }, v.value = !0);
4111
- }, _e = (e) => {
4119
+ }, ge = (e) => {
4112
4120
  let t = y.value;
4113
4121
  if (!t.active) return;
4114
4122
  let n = e.clientX - t.lastX, r = e.clientY - t.lastY;
@@ -4116,64 +4124,64 @@ var $i = Y({
4116
4124
  active: !0,
4117
4125
  lastX: e.clientX,
4118
4126
  lastY: e.clientY
4119
- }, g.value = At(g.value, n, r);
4120
- }, ve = () => {
4127
+ }, g.value = kt(g.value, n, r);
4128
+ }, _e = () => {
4121
4129
  y.value = {
4122
4130
  active: !1,
4123
4131
  lastX: 0,
4124
4132
  lastY: 0
4125
4133
  }, v.value = !1;
4126
4134
  };
4127
- K(() => e.readOnly, (e) => {
4135
+ q(() => e.readOnly, (e) => {
4128
4136
  e && (d.value = !1, f.value = "");
4129
- }), K(te, () => {
4137
+ }), q(L, () => {
4130
4138
  z(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
4131
- }), K(d, async (e) => {
4139
+ }), q(d, async (e) => {
4132
4140
  if (!e) {
4133
4141
  p.value = -1;
4134
4142
  return;
4135
4143
  }
4136
- await J(), ie(), i.value?.focus({ preventScroll: !0 });
4137
- }), K(() => [
4144
+ await Y(), ne(), i.value?.focus({ preventScroll: !0 });
4145
+ }), q(() => [
4138
4146
  d.value,
4139
4147
  f.value,
4140
4148
  p.value
4141
4149
  ], async () => {
4142
4150
  if (!d.value || p.value < 0) return;
4143
- await J();
4151
+ await Y();
4144
4152
  let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
4145
- e && t && jt(e, t);
4146
- }, { flush: "post" }), K(() => [
4153
+ e && t && At(e, t);
4154
+ }, { flush: "post" }), q(() => [
4147
4155
  A.value,
4148
4156
  b.value,
4149
4157
  E.value?.pos ?? null,
4150
- L.value.length,
4158
+ I.value.length,
4151
4159
  d.value,
4152
- N.value
4160
+ M.value
4153
4161
  ], async () => {
4154
- await J(), ie();
4162
+ await Y(), ne();
4155
4163
  }, {
4156
4164
  flush: "post",
4157
4165
  immediate: !0
4158
- }), K(I, async () => {
4159
- await J(), B(), window.requestAnimationFrame(B);
4166
+ }), q(F, async () => {
4167
+ await Y(), H(), window.requestAnimationFrame(H);
4160
4168
  }, {
4161
4169
  flush: "post",
4162
4170
  immediate: !0
4163
4171
  });
4164
- let ye = null;
4165
- return rr(() => {
4166
- J(() => {
4172
+ let ve = null;
4173
+ return nr(() => {
4174
+ Y(() => {
4167
4175
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
4168
4176
  if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
4169
- let r = bt(e.editor, n.target), i = xt(e.editor, r), a = i && !Et(e.editor, i) ? i.pos : null;
4177
+ let r = yt(e.editor, n.target), i = bt(e.editor, r), a = i && !Tt(e.editor, i) ? i.pos : null;
4170
4178
  s.value = s.value === a ? s.value : a;
4171
4179
  }, i = () => {
4172
4180
  d.value || (s.value = null);
4173
4181
  }, a = (t) => {
4174
4182
  if (t.key === "Escape") {
4175
4183
  if (g.value) {
4176
- ne();
4184
+ B();
4177
4185
  return;
4178
4186
  }
4179
4187
  d.value && (d.value = !1, p.value = -1, e.editor.view.focus());
@@ -4181,16 +4189,16 @@ var $i = Y({
4181
4189
  }, o = (e) => {
4182
4190
  d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
4183
4191
  }, c = ({ transaction: e }) => {
4184
- e.getMeta(Ze) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Ze) || Gt(e)) && (S.value += 1);
4192
+ e.getMeta(Xe) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(Xe) || Wt(e)) && (S.value += 1);
4185
4193
  };
4186
- n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", ie), window.addEventListener("scroll", ie, !0), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ye = () => {
4187
- n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", ie), window.removeEventListener("scroll", ie, !0), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), R();
4194
+ n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", ne), window.addEventListener("scroll", ne, !0), window.addEventListener("resize", H), window.addEventListener("scroll", H, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ve = () => {
4195
+ n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", ne), window.removeEventListener("scroll", ne, !0), window.removeEventListener("resize", H), window.removeEventListener("scroll", H, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), R();
4188
4196
  };
4189
4197
  });
4190
- }), q(() => {
4191
- ye?.(), ye = null, R();
4198
+ }), J(() => {
4199
+ ve?.(), ve = null, R();
4192
4200
  }), () => {
4193
- if (!A.value && F.value.length === 0 && !g.value) return null;
4201
+ if (!A.value && P.value.length === 0 && !g.value) return null;
4194
4202
  let s = c.value ? {
4195
4203
  top: `${c.value.top}px`,
4196
4204
  right: `${c.value.right}px`
@@ -4198,15 +4206,15 @@ var $i = Y({
4198
4206
  left: `${u.value.left}px`,
4199
4207
  top: `${u.value.top}px`
4200
4208
  } : void 0;
4201
- return H("div", {
4209
+ return U("div", {
4202
4210
  ref: t,
4203
4211
  class: "markweave-codeblock-overlay",
4204
4212
  "data-testid": "markweave-codeblock-overlay",
4205
4213
  "data-read-only": e.readOnly ? "true" : "false"
4206
4214
  }, [
4207
- ...F.value.map((e) => {
4215
+ ...P.value.map((e) => {
4208
4216
  let t = l.value.find((t) => t.pos === e.pos);
4209
- return H("div", {
4217
+ return U("div", {
4210
4218
  key: e.pos,
4211
4219
  class: "markweave-mermaid-tabs",
4212
4220
  "data-testid": "markweave-mermaid-tabs",
@@ -4216,16 +4224,16 @@ var $i = Y({
4216
4224
  top: `${t.top}px`,
4217
4225
  left: `${t.left}px`
4218
4226
  } : void 0
4219
- }, ["code", "preview"].map((t) => H("button", {
4227
+ }, ["code", "preview"].map((t) => U("button", {
4220
4228
  key: t,
4221
4229
  type: "button",
4222
4230
  "data-testid": `markweave-mermaid-mode-${t}`,
4223
4231
  "data-active": e.mermaidPreviewMode === t ? "true" : "false",
4224
4232
  onMousedown: $,
4225
- onClick: () => oe(e, t)
4233
+ onClick: () => ie(e, t)
4226
4234
  }, t === "code" ? "Code" : "Preview")));
4227
4235
  }),
4228
- A.value && E.value ? H("div", {
4236
+ A.value && E.value ? U("div", {
4229
4237
  class: "markweave-codeblock-controls",
4230
4238
  "data-testid": "markweave-codeblock-controls",
4231
4239
  "data-positioned": c.value ? "true" : "false",
@@ -4234,11 +4242,11 @@ var $i = Y({
4234
4242
  "aria-label": "Code block controls",
4235
4243
  style: s
4236
4244
  }, [
4237
- e.readOnly ? H("span", {
4245
+ e.readOnly ? U("span", {
4238
4246
  class: "markweave-codeblock-language-button markweave-codeblock-language-label",
4239
4247
  "aria-label": "Code block language",
4240
4248
  "data-testid": "markweave-codeblock-language"
4241
- }, [H("span", null, M.value)]) : H("button", {
4249
+ }, [U("span", null, ee.value)]) : U("button", {
4242
4250
  ref: n,
4243
4251
  type: "button",
4244
4252
  class: "markweave-codeblock-language-button",
@@ -4247,9 +4255,9 @@ var $i = Y({
4247
4255
  "aria-haspopup": "listbox",
4248
4256
  "data-testid": "markweave-codeblock-language",
4249
4257
  onMousedown: $,
4250
- onClick: V
4251
- }, [H("span", null, M.value), Q("chevron")]),
4252
- j.value ? H("button", {
4258
+ onClick: oe
4259
+ }, [U("span", null, ee.value), Ki("chevron")]),
4260
+ j.value ? U("button", {
4253
4261
  type: "button",
4254
4262
  class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
4255
4263
  "aria-label": k.value ? "Expand code block" : "Collapse code block",
@@ -4257,14 +4265,14 @@ var $i = Y({
4257
4265
  "data-testid": "markweave-codeblock-collapse",
4258
4266
  "data-collapsed": k.value ? "true" : "false",
4259
4267
  onMousedown: $,
4260
- onClick: ue
4261
- }, [Q("chevron")]) : null,
4262
- H("span", { class: "markweave-codeblock-copy-wrap" }, [H("button", {
4268
+ onClick: le
4269
+ }, [Ki("chevron")]) : null,
4270
+ U("span", { class: "markweave-codeblock-copy-wrap" }, [U("button", {
4263
4271
  type: "button",
4264
4272
  class: "markweave-codeblock-icon-button",
4265
4273
  "aria-label": "Copy to clipboard",
4266
4274
  "data-testid": "markweave-codeblock-copy",
4267
- "data-copy-state": ee.value,
4275
+ "data-copy-state": te.value,
4268
4276
  onMousedown: $,
4269
4277
  onMouseenter: () => {
4270
4278
  h.value = !0;
@@ -4279,66 +4287,66 @@ var $i = Y({
4279
4287
  h.value = !1;
4280
4288
  },
4281
4289
  onClick: () => {
4282
- ae();
4290
+ re();
4283
4291
  }
4284
- }, [Q(ee.value === "copied" ? "check" : "clipboard")]), h.value ? H("span", {
4292
+ }, [Ki(te.value === "copied" ? "check" : "clipboard")]), h.value ? U("span", {
4285
4293
  class: "markweave-codeblock-tooltip",
4286
4294
  role: "tooltip",
4287
4295
  "data-testid": "markweave-codeblock-copy-tooltip"
4288
4296
  }, "Copy to clipboard") : null]),
4289
- O.value && N.value === "preview" ? H("div", {
4297
+ O.value && M.value === "preview" ? U("div", {
4290
4298
  class: "markweave-mermaid-preview-actions",
4291
4299
  "data-testid": "markweave-mermaid-preview-actions"
4292
- }, [H("button", {
4300
+ }, [U("button", {
4293
4301
  type: "button",
4294
4302
  class: "markweave-codeblock-icon-button",
4295
4303
  "aria-label": "Fullscreen Mermaid preview",
4296
4304
  "data-testid": "markweave-mermaid-fullscreen",
4297
- disabled: !P.value,
4305
+ disabled: !N.value,
4298
4306
  onMousedown: $,
4299
- onClick: fe
4300
- }, [Q("expand")]), H("button", {
4307
+ onClick: de
4308
+ }, [Ki("expand")]), U("button", {
4301
4309
  type: "button",
4302
4310
  class: "markweave-codeblock-icon-button",
4303
4311
  "aria-label": "Download Mermaid SVG",
4304
4312
  "data-testid": "markweave-mermaid-download",
4305
- disabled: !P.value,
4313
+ disabled: !N.value,
4306
4314
  onMousedown: $,
4307
- onClick: de
4308
- }, [Q("download")])]) : null
4315
+ onClick: ue
4316
+ }, [Ki("download")])]) : null
4309
4317
  ]) : null,
4310
- j.value && A.value && d.value && E.value ? H("div", {
4318
+ j.value && A.value && d.value && E.value ? U("div", {
4311
4319
  ref: r,
4312
4320
  class: "markweave-codeblock-language-menu",
4313
4321
  "data-testid": "markweave-codeblock-language-menu",
4314
4322
  "data-positioned": u.value ? "true" : "false",
4315
4323
  style: m
4316
- }, [H("label", { class: "markweave-codeblock-language-search" }, [H("input", {
4324
+ }, [U("label", { class: "markweave-codeblock-language-search" }, [U("input", {
4317
4325
  ref: i,
4318
4326
  role: "combobox",
4319
4327
  "aria-autocomplete": "list",
4320
4328
  "aria-controls": o.value ?? void 0,
4321
4329
  "aria-expanded": "true",
4322
- "aria-activedescendant": o.value && L.value[p.value] ? yt(o.value, L.value[p.value].language) : void 0,
4330
+ "aria-activedescendant": o.value && I.value[p.value] ? vt(o.value, I.value[p.value].language) : void 0,
4323
4331
  "aria-label": "Search code block languages",
4324
4332
  value: f.value,
4325
4333
  placeholder: "Search...",
4326
4334
  "data-testid": "markweave-codeblock-language-search",
4327
4335
  onInput: (e) => {
4328
- ce(e.target.value);
4336
+ se(e.target.value);
4329
4337
  },
4330
- onKeydown: le
4331
- }), Q("search")]), H("div", {
4338
+ onKeydown: ce
4339
+ }), Ki("search")]), U("div", {
4332
4340
  ref: a,
4333
4341
  id: o.value ?? void 0,
4334
4342
  class: "markweave-codeblock-language-list",
4335
4343
  role: "listbox",
4336
4344
  "aria-label": "Code block languages"
4337
- }, L.value.map((e, t) => {
4345
+ }, I.value.map((e, t) => {
4338
4346
  let n = E.value?.language === e.language, r = t === p.value;
4339
- return H("button", {
4347
+ return U("button", {
4340
4348
  key: e.language,
4341
- id: o.value ? yt(o.value, e.language) : void 0,
4349
+ id: o.value ? vt(o.value, e.language) : void 0,
4342
4350
  type: "button",
4343
4351
  role: "option",
4344
4352
  "aria-selected": n ? "true" : "false",
@@ -4350,21 +4358,21 @@ var $i = Y({
4350
4358
  onMouseenter: () => {
4351
4359
  p.value = t;
4352
4360
  },
4353
- onClick: () => se(e.language)
4354
- }, [H("span", null, e.label), n ? Q("check") : null]);
4361
+ onClick: () => ae(e.language)
4362
+ }, [U("span", null, e.label), n ? Ki("check") : null]);
4355
4363
  }))]) : null,
4356
- g.value ? H("div", {
4364
+ g.value ? U("div", {
4357
4365
  class: "markweave-mermaid-fullscreen-layer",
4358
4366
  role: "dialog",
4359
4367
  "aria-modal": "true",
4360
4368
  "aria-label": "Mermaid preview",
4361
4369
  "data-testid": "markweave-mermaid-fullscreen-layer"
4362
4370
  }, [
4363
- H("div", {
4371
+ U("div", {
4364
4372
  class: "markweave-mermaid-fullscreen-toolbar",
4365
4373
  "data-testid": "markweave-mermaid-fullscreen-toolbar"
4366
4374
  }, [
4367
- H("button", {
4375
+ U("button", {
4368
4376
  type: "button",
4369
4377
  class: "markweave-mermaid-fullscreen-control",
4370
4378
  "aria-label": "Zoom out",
@@ -4381,13 +4389,13 @@ var $i = Y({
4381
4389
  onBlur: () => {
4382
4390
  _.value = null;
4383
4391
  },
4384
- onClick: () => pe(-Ot)
4385
- }, [Q("zoomOut")]),
4386
- H("span", {
4392
+ onClick: () => fe(-Dt)
4393
+ }, [Ki("zoomOut")]),
4394
+ U("span", {
4387
4395
  class: "markweave-mermaid-fullscreen-zoom-label",
4388
4396
  "data-testid": "markweave-mermaid-fullscreen-zoom-label"
4389
- }, ht(g.value.scale)),
4390
- H("button", {
4397
+ }, mt(g.value.scale)),
4398
+ U("button", {
4391
4399
  type: "button",
4392
4400
  class: "markweave-mermaid-fullscreen-control",
4393
4401
  "aria-label": "Zoom in",
@@ -4404,9 +4412,9 @@ var $i = Y({
4404
4412
  onBlur: () => {
4405
4413
  _.value = null;
4406
4414
  },
4407
- onClick: () => pe(Ot)
4408
- }, [Q("zoomIn")]),
4409
- H("button", {
4415
+ onClick: () => fe(Dt)
4416
+ }, [Ki("zoomIn")]),
4417
+ U("button", {
4410
4418
  type: "button",
4411
4419
  class: "markweave-mermaid-fullscreen-control",
4412
4420
  "aria-label": "Reset zoom",
@@ -4423,31 +4431,31 @@ var $i = Y({
4423
4431
  onBlur: () => {
4424
4432
  _.value = null;
4425
4433
  },
4426
- onClick: me
4427
- }, [Q("reset")]),
4428
- _.value ? H("span", {
4434
+ onClick: pe
4435
+ }, [Ki("reset")]),
4436
+ _.value ? U("span", {
4429
4437
  class: "markweave-mermaid-fullscreen-tooltip",
4430
4438
  role: "tooltip",
4431
4439
  "data-testid": "markweave-mermaid-fullscreen-tooltip"
4432
4440
  }, _.value === "zoom-out" ? "Zoom out" : _.value === "zoom-in" ? "Zoom in" : "Reset") : null
4433
4441
  ]),
4434
- H("button", {
4442
+ U("button", {
4435
4443
  type: "button",
4436
4444
  class: "markweave-mermaid-fullscreen-close",
4437
4445
  "aria-label": "Close fullscreen Mermaid preview",
4438
4446
  "data-testid": "markweave-mermaid-fullscreen-close",
4439
- onClick: ne
4440
- }, [Q("close")]),
4441
- H("div", {
4447
+ onClick: B
4448
+ }, [Ki("close")]),
4449
+ U("div", {
4442
4450
  class: "markweave-mermaid-fullscreen-viewport",
4443
4451
  "data-testid": "markweave-mermaid-fullscreen-viewport",
4444
4452
  "data-dragging": v.value ? "true" : "false",
4445
- onWheel: he,
4446
- onMousedown: ge,
4447
- onMousemove: _e,
4448
- onMouseup: ve,
4449
- onMouseleave: ve
4450
- }, [H("div", {
4453
+ onWheel: me,
4454
+ onMousedown: he,
4455
+ onMousemove: ge,
4456
+ onMouseup: _e,
4457
+ onMouseleave: _e
4458
+ }, [U("div", {
4451
4459
  class: "markweave-mermaid-fullscreen-content",
4452
4460
  "data-testid": "markweave-mermaid-fullscreen-content",
4453
4461
  "data-scale-percent": Math.round(g.value.scale * 100),
@@ -4463,7 +4471,7 @@ var $i = Y({
4463
4471
  ]);
4464
4472
  };
4465
4473
  }
4466
- }), sa = Y({
4474
+ }), sa = X({
4467
4475
  name: "MarkweaveVueInnerToc",
4468
4476
  props: {
4469
4477
  editor: {
@@ -4488,22 +4496,22 @@ var $i = Y({
4488
4496
  }
4489
4497
  },
4490
4498
  setup(e) {
4491
- let t = U(null), n, r = () => {
4492
- n?.(), n = e.placement === "container" && t.value ? Ye(t.value) : void 0;
4499
+ let t = W(null), n, r = () => {
4500
+ n?.(), n = e.placement === "container" && t.value ? Je(t.value) : void 0;
4493
4501
  };
4494
- return rr(r), q(() => n?.()), K(() => e.placement, r), () => e.state.items.length ? H("nav", {
4502
+ return nr(r), J(() => n?.()), q(() => e.placement, r), () => e.state.items.length ? U("nav", {
4495
4503
  ref: t,
4496
4504
  class: "markweave-inner-toc",
4497
4505
  "data-testid": "markweave-inner-toc",
4498
4506
  "aria-label": e.messages.toc.ariaLabel
4499
- }, [H("div", {
4507
+ }, [U("div", {
4500
4508
  class: "markweave-inner-toc-rail",
4501
4509
  "aria-hidden": "true"
4502
- }, e.state.items.map((e) => H("span", {
4510
+ }, e.state.items.map((e) => U("span", {
4503
4511
  key: e.id,
4504
4512
  "data-level": e.level,
4505
4513
  "data-active": e.active ? "true" : "false"
4506
- }))), H("div", { class: "markweave-inner-toc-panel" }, [H("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => H("button", {
4514
+ }))), U("div", { class: "markweave-inner-toc-panel" }, [U("div", { class: "markweave-inner-toc-list" }, e.state.items.map((t) => U("button", {
4507
4515
  key: t.id,
4508
4516
  type: "button",
4509
4517
  class: "markweave-inner-toc-item",
@@ -4512,7 +4520,7 @@ var $i = Y({
4512
4520
  "aria-current": t.active ? "location" : void 0,
4513
4521
  "aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
4514
4522
  title: t.text,
4515
- onClick: () => Xe(e.editor, t, {
4523
+ onClick: () => Ye(e.editor, t, {
4516
4524
  behavior: "smooth",
4517
4525
  focus: e.editable
4518
4526
  })
@@ -4520,26 +4528,26 @@ var $i = Y({
4520
4528
  }
4521
4529
  });
4522
4530
  function ca(e = {}) {
4523
- let i = r(e.lang), o = n(i), s = t(i), c = U(f(e.mode)), l = G(() => Ce(e.theme)), u = G(() => c.value === "live" && e.editable !== !1), d = U(0), m = W(null), h = U(on), g = W(null), _ = W(null), v = U("code"), y = W(null), b = W(pn), x = U(null), S = U(!1), C = W(null), w = V(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
4531
+ let i = r(e.lang), o = n(i), s = t(i), c = W(f(e.mode)), l = K(() => Se(e.theme)), u = K(() => c.value === "live" && e.editable !== !1), d = W(0), m = G(null), h = W(an), g = G(null), _ = G(null), v = W("code"), y = G(null), b = G(fn), x = W(null), S = W(!1), C = G(null), w = oe(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
4524
4532
  function O() {
4525
4533
  D !== null && (window.clearTimeout(D), D = null), d.value += 1;
4526
4534
  }
4527
4535
  function k() {
4528
4536
  D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
4529
4537
  D = null, d.value += 1;
4530
- }, be);
4538
+ }, ye);
4531
4539
  }
4532
- let A = e.onSlashCommandUpload, j = W(null);
4540
+ let A = e.onSlashCommandUpload, j = G(null);
4533
4541
  j.value = new a({
4534
- extensions: Vi({
4542
+ extensions: Bi({
4535
4543
  lang: i,
4536
4544
  linkCardResolver: e.linkCardResolver,
4537
- onImageUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4538
- onVideoUpload: (e) => A?.(e) ?? L(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4545
+ onImageUpload: (e) => A?.(e) ?? I(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4546
+ onVideoUpload: (e) => A?.(e) ?? I(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
4539
4547
  resolveMediaSource: e.resolveMediaSource
4540
4548
  }),
4541
4549
  content: T,
4542
- contentType: ae(w),
4550
+ contentType: re(w),
4543
4551
  editable: u.value,
4544
4552
  autofocus: e.autofocus,
4545
4553
  editorProps: {
@@ -4553,17 +4561,17 @@ function ca(e = {}) {
4553
4561
  translate: "no"
4554
4562
  },
4555
4563
  handleClick: (e, t, n) => {
4556
- if (!u.value) return he(n);
4557
- let r = zt(e, n);
4558
- return r ? (n.preventDefault(), n.stopPropagation(), I(), Ut(e, r, !0), Wt(e, r), y.value = r, !0) : (y.value = null, !1);
4564
+ if (!u.value) return me(n);
4565
+ let r = Rt(e, n);
4566
+ return r ? (n.preventDefault(), n.stopPropagation(), F(), Ht(e, r, !0), Ut(e, r), y.value = r, !0) : (y.value = null, !1);
4559
4567
  },
4560
4568
  handleDOMEvents: {
4561
- compositionstart: () => u.value ? (h.value = sn(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
4562
- compositionend: (e) => (u.value && window.setTimeout(() => te(e), 0), !1),
4569
+ compositionstart: () => u.value ? (h.value = on(h.value, { type: "composition-start" }), g.value = null, !1) : !1,
4570
+ compositionend: (e) => (u.value && window.setTimeout(() => L(e), 0), !1),
4563
4571
  click: (e, t) => {
4564
- if (!u.value) return he(t);
4565
- let n = zt(e, t);
4566
- return n ? (t.preventDefault(), t.stopPropagation(), I(), Ut(e, n, !0), Wt(e, n), y.value = n, !0) : (y.value = null, !1);
4572
+ if (!u.value) return me(t);
4573
+ let n = Rt(e, t);
4574
+ return n ? (t.preventDefault(), t.stopPropagation(), F(), Ht(e, n, !0), Ut(e, n), y.value = n, !0) : (y.value = null, !1);
4567
4575
  }
4568
4576
  }
4569
4577
  },
@@ -4572,17 +4580,17 @@ function ca(e = {}) {
4572
4580
  p(t, {
4573
4581
  mode: c.value,
4574
4582
  editable: u.value
4575
- }), Kt(t, l.value), qt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && un(t), re(t), z(t), O();
4583
+ }), Gt(t, l.value), Kt(t, u.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && u.value && ln(t), V(t), z(t), O();
4576
4584
  },
4577
4585
  onTransaction: ({ editor: e, transaction: t }) => {
4578
- if (re(e), (t.docChanged || Gt(t)) && k(), t.docChanged && y.value) {
4579
- let t = Rt(e, y.value.pos);
4586
+ if (V(e), (t.docChanged || Wt(t)) && k(), t.docChanged && y.value) {
4587
+ let t = Lt(e, y.value.pos);
4580
4588
  y.value = t?.kind === y.value.kind ? t : null;
4581
4589
  }
4582
4590
  },
4583
4591
  onUpdate: ({ editor: t }) => {
4584
- z(t), u.value && R(t), S.value || e.onUpdate?.(ie(t, { onContentRead: (n, r) => {
4585
- let i = V(e.contentFormat);
4592
+ z(t), u.value && R(t), S.value || e.onUpdate?.(ne(t, { onContentRead: (n, r) => {
4593
+ let i = oe(e.contentFormat);
4586
4594
  e.content !== void 0 && n === i && (C.value = {
4587
4595
  content: r,
4588
4596
  format: n,
@@ -4591,194 +4599,194 @@ function ca(e = {}) {
4591
4599
  } }));
4592
4600
  }
4593
4601
  });
4594
- let M = j.value, ee = we(M), N = !1, P = !1;
4595
- J(() => {
4596
- N || j.value !== M || (P = !0, e.onAiEditControllerChange?.(ee));
4602
+ let ee = j.value, te = Ce(ee), M = !1, N = !1;
4603
+ Y(() => {
4604
+ M || j.value !== ee || (N = !0, e.onAiEditControllerChange?.(te));
4597
4605
  });
4598
- let F = G(() => j.value ?? null);
4599
- function I() {
4600
- g.value = null, _.value = null, h.value = on;
4606
+ let P = K(() => j.value ?? null);
4607
+ function F() {
4608
+ g.value = null, _.value = null, h.value = an;
4601
4609
  }
4602
- function te(e) {
4603
- let t = rn(e.state);
4610
+ function L(e) {
4611
+ let t = nn(e.state);
4604
4612
  if (!t) {
4605
- h.value = h.value.name === "idle" ? h.value : on, g.value = null, _.value = null;
4613
+ h.value = h.value.name === "idle" ? h.value : an, g.value = null, _.value = null;
4606
4614
  return;
4607
4615
  }
4608
4616
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
4609
- if (!an(r, { frameRect: i })) {
4610
- I();
4617
+ if (!rn(r, { frameRect: i })) {
4618
+ F();
4611
4619
  return;
4612
4620
  }
4613
- let a = nn(n, {
4621
+ let a = tn(n, {
4614
4622
  frameRect: i,
4615
4623
  triggerRect: r
4616
4624
  });
4617
- $t(g.value, a) || (g.value = a), h.value = tn(h.value, t);
4625
+ Qt(g.value, a) || (g.value = a), h.value = en(h.value, t);
4618
4626
  }
4619
4627
  function R(e) {
4620
- te(e.view);
4628
+ L(e.view);
4621
4629
  }
4622
4630
  function z(e) {
4623
- let t = ye(e);
4624
- _e(m.value, t) || (m.value = t);
4625
- let n = Bt(e);
4626
- n && (Ht(e, n, !0), y.value = n);
4627
- let r = $e(e);
4631
+ let t = ve(e);
4632
+ ge(m.value, t) || (m.value = t);
4633
+ let n = zt(e);
4634
+ n && (Vt(e, n, !0), y.value = n);
4635
+ let r = Qe(e);
4628
4636
  r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
4629
4637
  }
4630
- function re(e) {
4631
- b.value = Wi(e);
4638
+ function V(e) {
4639
+ b.value = Ui(e);
4632
4640
  }
4633
- let ce = G(() => F.value ? $e(F.value) : Ui), le = G(() => F.value ? dn(F.value.state) : Hi), ue = G(() => m.value?.currentNode === "codeBlock"), de = G(() => ue.value && ce.value.language === "mermaid"), fe = G(() => F.value ? Yt({
4634
- active: de.value,
4641
+ let se = K(() => P.value ? Qe(P.value) : Hi), ce = K(() => P.value ? un(P.value.state) : Vi), le = K(() => m.value?.currentNode === "codeBlock"), ue = K(() => le.value && se.value.language === "mermaid"), de = K(() => P.value ? Jt({
4642
+ active: ue.value,
4635
4643
  mode: v.value,
4636
- source: ce.value.text
4637
- }) : Yt({
4644
+ source: se.value.text
4645
+ }) : Jt({
4638
4646
  active: !1,
4639
4647
  mode: "code",
4640
4648
  source: ""
4641
- })), pe = G(() => F.value && e.onRuntimeStateChange ? ln(F.value.state) : null), me = G(() => F.value ? Ke(F.value.state) : We.items), ve = G(() => qe(me.value, x.value)), xe = G(() => Ue(me.value, ve.value)), Se = G(() => Xt(h.value.query, s)), Te = G(() => ge({
4649
+ })), fe = K(() => P.value && e.onRuntimeStateChange ? cn(P.value.state) : null), pe = K(() => P.value ? Ge(P.value.state) : Ue.items), _e = K(() => Ke(pe.value, x.value)), be = K(() => He(pe.value, _e.value)), xe = K(() => Yt(h.value.query, s)), we = K(() => he({
4642
4650
  revision: d.value,
4643
4651
  mode: c.value,
4644
4652
  editable: u.value,
4645
- toc: xe.value,
4653
+ toc: be.value,
4646
4654
  selection: m.value,
4647
4655
  slash: h.value,
4648
- table: le.value,
4656
+ table: ce.value,
4649
4657
  tableInteraction: b.value,
4650
- codeBlock: ce.value,
4651
- mermaid: fe.value,
4652
- tableDebugSnapshot: pe.value
4653
- })), Ee = {
4654
- closeSlashMenu: I,
4655
- focusFirstTableBodyCell: () => F.value ? un(F.value) : !1,
4658
+ codeBlock: se.value,
4659
+ mermaid: de.value,
4660
+ tableDebugSnapshot: fe.value
4661
+ })), Te = {
4662
+ closeSlashMenu: F,
4663
+ focusFirstTableBodyCell: () => P.value ? ln(P.value) : !1,
4656
4664
  setContent: (e, t = {}) => {
4657
- if (!F.value) return !1;
4658
- let n = V(t.format);
4659
- return F.value.commands.setContent(e, {
4660
- contentType: ae(n),
4665
+ if (!P.value) return !1;
4666
+ let n = oe(t.format);
4667
+ return P.value.commands.setContent(e, {
4668
+ contentType: re(n),
4661
4669
  emitUpdate: t.emitUpdate ?? !1
4662
- }), t.focusFirstTableBodyCell && un(F.value), z(F.value), u.value && R(F.value), re(F.value), O(), !0;
4670
+ }), t.focusFirstTableBodyCell && ln(P.value), z(P.value), u.value && R(P.value), V(P.value), O(), !0;
4663
4671
  }
4664
4672
  };
4665
- function De(e, t) {
4666
- if (!(!F.value || !u.value || !Zt(e))) {
4673
+ function Ee(e, t) {
4674
+ if (!(!P.value || !u.value || !Xt(e))) {
4667
4675
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
4668
4676
  _.value = e;
4669
4677
  return;
4670
4678
  }
4671
- en(F.value, h.value, e, t), h.value = sn(h.value, { type: "execute" }), I();
4679
+ $t(P.value, h.value, e, t), h.value = on(h.value, { type: "execute" }), F();
4672
4680
  }
4673
4681
  }
4674
- function Oe(e) {
4675
- if (!F.value || _.value || !u.value) return;
4676
- let t = Qt(h.value, Se.value, e.key, { isComposing: e.isComposing || ne(F.value.state) });
4682
+ function De(e) {
4683
+ if (!P.value || _.value || !u.value) return;
4684
+ let t = Zt(h.value, xe.value, e.key, { isComposing: e.isComposing || B(P.value.state) });
4677
4685
  if (t.type !== "ignore") {
4678
4686
  if (e.preventDefault(), t.type === "close") {
4679
- h.value = sn(h.value, { type: "escape" }), I();
4687
+ h.value = on(h.value, { type: "escape" }), F();
4680
4688
  return;
4681
4689
  }
4682
4690
  if (t.type === "move-active") {
4683
- h.value = sn(h.value, {
4691
+ h.value = on(h.value, {
4684
4692
  type: "move-active",
4685
4693
  delta: t.delta,
4686
4694
  optionCount: t.optionCount
4687
4695
  });
4688
4696
  return;
4689
4697
  }
4690
- De(t.command);
4698
+ Ee(t.command);
4691
4699
  }
4692
4700
  }
4693
- K(() => [e.mode, e.editable], () => {
4694
- c.value = f(e.mode), F.value && (F.value.setEditable(u.value), p(F.value, {
4701
+ q(() => [e.mode, e.editable], () => {
4702
+ c.value = f(e.mode), P.value && (P.value.setEditable(u.value), p(P.value, {
4695
4703
  mode: c.value,
4696
4704
  editable: u.value
4697
- }), qt(F.value, u.value ? "live" : "view"), O(), u.value || I());
4698
- }, { immediate: !0 }), K(() => e.theme, () => {
4699
- F.value && Kt(F.value, l.value);
4700
- }, { immediate: !0 }), K(() => e.content, (t) => {
4701
- let n = V(e.contentFormat);
4702
- if (!(!F.value || t === void 0)) {
4703
- if (se(F.value, C.value, t, n)) {
4705
+ }), Kt(P.value, u.value ? "live" : "view"), O(), u.value || F());
4706
+ }, { immediate: !0 }), q(() => e.theme, () => {
4707
+ P.value && Gt(P.value, l.value);
4708
+ }, { immediate: !0 }), q(() => e.content, (t) => {
4709
+ let n = oe(e.contentFormat);
4710
+ if (!(!P.value || t === void 0)) {
4711
+ if (ae(P.value, C.value, t, n)) {
4704
4712
  C.value = null;
4705
4713
  return;
4706
4714
  }
4707
- C.value = null, !oe(F.value, t, n) && (S.value = !0, F.value.commands.setContent(t, {
4708
- contentType: ae(n),
4715
+ C.value = null, !ie(P.value, t, n) && (S.value = !0, P.value.commands.setContent(t, {
4716
+ contentType: re(n),
4709
4717
  emitUpdate: !1
4710
- }), S.value = !1, z(F.value), u.value && R(F.value), re(F.value), O());
4718
+ }), S.value = !1, z(P.value), u.value && R(P.value), V(P.value), O());
4711
4719
  }
4712
- }), K(Te, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(xe, (t) => e.onTocChange?.(t), { immediate: !0 }), K(me, (e) => {
4713
- let t = qe(e, x.value);
4720
+ }), q(we, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), q(be, (t) => e.onTocChange?.(t), { immediate: !0 }), q(pe, (e) => {
4721
+ let t = Ke(e, x.value);
4714
4722
  x.value !== t && (x.value = t);
4715
4723
  });
4716
- let ke = B(() => {
4717
- F.value && g.value && te(F.value.view);
4718
- }), Ae = () => {
4719
- g.value && ke.schedule();
4724
+ let Oe = H(() => {
4725
+ P.value && g.value && L(P.value.view);
4726
+ }), ke = () => {
4727
+ g.value && Oe.schedule();
4720
4728
  };
4721
- K(g, (e) => {
4722
- e ? Ae() : ke.cancel();
4723
- }), rr(() => {
4724
- window.addEventListener("resize", Ae), window.addEventListener("scroll", Ae, !0);
4725
- }), q(() => {
4726
- ke.cancel(), window.removeEventListener("resize", Ae), window.removeEventListener("scroll", Ae, !0);
4729
+ q(g, (e) => {
4730
+ e ? ke() : Oe.cancel();
4731
+ }), nr(() => {
4732
+ window.addEventListener("resize", ke), window.addEventListener("scroll", ke, !0);
4733
+ }), J(() => {
4734
+ Oe.cancel(), window.removeEventListener("resize", ke), window.removeEventListener("scroll", ke, !0);
4727
4735
  });
4728
- let je = null;
4729
- return q(() => {
4736
+ let Ae = null;
4737
+ return J(() => {
4730
4738
  D !== null && window.clearTimeout(D);
4731
- }), rr(() => {
4739
+ }), nr(() => {
4732
4740
  let e = () => {
4733
- if (!F.value || !me.value.length) {
4741
+ if (!P.value || !pe.value.length) {
4734
4742
  x.value = null;
4735
4743
  return;
4736
4744
  }
4737
4745
  let e = null;
4738
4746
  try {
4739
- e = Ge(F.value, me.value);
4747
+ e = We(P.value, pe.value);
4740
4748
  } catch {
4741
4749
  return;
4742
4750
  }
4743
4751
  x.value !== e && (x.value = e);
4744
- }, t = () => window.requestAnimationFrame(e), n = Gi(F.value?.view.dom ?? null);
4745
- window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), je = () => {
4752
+ }, t = () => window.requestAnimationFrame(e), n = Wi(P.value?.view.dom ?? null);
4753
+ window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Ae = () => {
4746
4754
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
4747
4755
  };
4748
- }), q(() => {
4749
- je?.(), N = !0, P && e.onAiEditControllerChange?.(null);
4756
+ }), J(() => {
4757
+ Ae?.(), M = !0, N && e.onAiEditControllerChange?.(null);
4750
4758
  let t = j.value;
4751
- j.value = null, J(() => t?.destroy());
4759
+ j.value = null, Y(() => t?.destroy());
4752
4760
  }), {
4753
- editor: F,
4754
- runtimeSnapshot: Te,
4755
- actions: Ee,
4761
+ editor: P,
4762
+ runtimeSnapshot: we,
4763
+ actions: Te,
4756
4764
  __render: {
4757
4765
  messages: o,
4758
4766
  effectiveEditable: u,
4759
- tableFocusState: le,
4767
+ tableFocusState: ce,
4760
4768
  tableInteractionState: b,
4761
- codeBlockState: ce,
4762
- isCodeBlockActive: ue,
4769
+ codeBlockState: se,
4770
+ isCodeBlockActive: le,
4763
4771
  mermaidMode: v,
4764
4772
  mathTarget: y,
4765
4773
  setMermaidMode: (e) => {
4766
4774
  v.value = e;
4767
4775
  },
4768
- tocState: xe,
4769
- filteredSlashCommands: Se,
4776
+ tocState: be,
4777
+ filteredSlashCommands: xe,
4770
4778
  slashState: h,
4771
4779
  slashMenuPosition: g,
4772
4780
  slashInputCommand: _,
4773
- runSlashCommand: De,
4774
- handleEditorKeyDown: Oe,
4781
+ runSlashCommand: Ee,
4782
+ handleEditorKeyDown: De,
4775
4783
  setSlashInputCommand: (e) => {
4776
4784
  _.value = e;
4777
4785
  }
4778
4786
  }
4779
4787
  };
4780
4788
  }
4781
- var la = Y({
4789
+ var la = X({
4782
4790
  name: "MarkweaveEditor",
4783
4791
  props: {
4784
4792
  defaultContent: {
@@ -4899,27 +4907,27 @@ var la = Y({
4899
4907
  return () => {
4900
4908
  let n = t.editor.value;
4901
4909
  if (!n) return null;
4902
- let i = t.__render, a = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = Se(e.canvasColor);
4903
- return H("section", {
4910
+ let i = t.__render, a = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = xe(e.canvasColor);
4911
+ return U("section", {
4904
4912
  class: a,
4905
4913
  "aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
4906
4914
  "data-testid": "markweave-editor-frame",
4907
4915
  "data-markweave-mode": t.runtimeSnapshot.value.mode,
4908
- "data-markweave-theme": Ce(e.theme),
4916
+ "data-markweave-theme": Se(e.theme),
4909
4917
  style: s ? { "--markweave-canvas": s } : void 0,
4910
4918
  "data-markweave-inner-toc": e.innerToc ? "true" : "false",
4911
- "data-markweave-inner-toc-placement": Je(e.innerTocPlacement),
4919
+ "data-markweave-inner-toc-placement": qe(e.innerTocPlacement),
4912
4920
  "data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
4913
4921
  "data-table-focus-mode": i.tableFocusState.value.mode,
4914
4922
  onKeydownCapture: i.handleEditorKeyDown
4915
4923
  }, [
4916
- i.effectiveEditable.value ? H($i, {
4924
+ i.effectiveEditable.value ? U($i, {
4917
4925
  editor: n,
4918
4926
  lang: r(e.lang),
4919
4927
  messages: i.messages,
4920
4928
  askAi: e.askAi
4921
4929
  }) : null,
4922
- i.effectiveEditable.value ? H(ta, {
4930
+ i.effectiveEditable.value ? U(ta, {
4923
4931
  commands: i.filteredSlashCommands.value,
4924
4932
  state: i.slashState.value,
4925
4933
  position: i.slashMenuPosition.value,
@@ -4929,7 +4937,7 @@ var la = Y({
4929
4937
  onInputCommandChange: i.setSlashInputCommand,
4930
4938
  onUpload: e.onSlashCommandUpload
4931
4939
  }) : null,
4932
- i.effectiveEditable.value ? H(ia, {
4940
+ i.effectiveEditable.value ? U(ia, {
4933
4941
  editor: n,
4934
4942
  active: i.tableFocusState.value.active,
4935
4943
  interactionState: i.tableInteractionState.value,
@@ -4939,11 +4947,11 @@ var la = Y({
4939
4947
  onCommandResult: e.onTableCommandResult,
4940
4948
  onEditWithAi: e.onEditWithAi
4941
4949
  }) : null,
4942
- i.effectiveEditable.value ? H(aa, {
4950
+ i.effectiveEditable.value ? U(aa, {
4943
4951
  editor: n,
4944
4952
  focusState: i.tableFocusState.value
4945
4953
  }) : null,
4946
- H(oa, {
4954
+ U(oa, {
4947
4955
  editor: n,
4948
4956
  state: i.codeBlockState.value,
4949
4957
  active: i.effectiveEditable.value && i.isCodeBlockActive.value,
@@ -4951,23 +4959,23 @@ var la = Y({
4951
4959
  onMermaidModeChange: i.setMermaidMode,
4952
4960
  readOnly: !i.effectiveEditable.value
4953
4961
  }),
4954
- e.innerToc && i.tocState.value.items.length ? H(sa, {
4962
+ e.innerToc && i.tocState.value.items.length ? U(sa, {
4955
4963
  editor: n,
4956
4964
  state: i.tocState.value,
4957
4965
  messages: i.messages,
4958
4966
  editable: i.effectiveEditable.value,
4959
- placement: Je(e.innerTocPlacement)
4967
+ placement: qe(e.innerTocPlacement)
4960
4968
  }) : null,
4961
- i.effectiveEditable.value && i.mathTarget.value ? H(ea, {
4969
+ i.effectiveEditable.value && i.mathTarget.value ? U(ea, {
4962
4970
  editor: n,
4963
4971
  messages: i.messages,
4964
4972
  target: i.mathTarget.value,
4965
4973
  onClose: () => i.mathTarget.value = null
4966
4974
  }) : null,
4967
- H(o, { editor: n })
4975
+ U(o, { editor: n })
4968
4976
  ]);
4969
4977
  };
4970
4978
  }
4971
4979
  });
4972
4980
  //#endregion
4973
- export { la as MarkweaveEditor, R as createMarkweaveAiEditController, Vi as createMarkweaveEditorExtensions, Vi as createMarkweaveVue2EditorExtensions, ca as useMarkweaveEditorController };
4981
+ export { la as MarkweaveEditor, R as createMarkweaveAiEditController, Bi as createMarkweaveEditorExtensions, Bi as createMarkweaveVue2EditorExtensions, ca as useMarkweaveEditorController };