@markweave/vue2 0.9.1 → 0.10.0

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
@@ -11,61 +11,64 @@ import { openMarkweaveImagePreview as y } from "markweave/internal/plugins/media
11
11
  import { createMarkweaveLightweightImageNodeViewRenderer as b } from "markweave/internal/plugins/media/lightweight-image-node-view";
12
12
  import { resolveMarkweaveMediaSource as x } from "markweave/internal/plugins/media/media-source";
13
13
  import { MarkweaveCoreImage as S, MarkweaveCoreVideo as C, attrsFromMarkweaveImageUploadResult as w, attrsFromMarkweaveVideoUploadResult as T, attrsFromMarkweaveVideoUrl as E, clampMarkweaveImageWidth as D, createMarkweaveImageUploadRequest as O, createMarkweaveVideoUploadRequest as k, downloadMarkweaveImage as A, markweaveVideoIframeAllow as j, normalizeMarkweaveCoreImageAlign as M, normalizeMarkweaveVideoEmbedUrl as N, numberAttribute as P, stringAttribute as F } from "markweave/internal/plugins/media/core-media-nodes";
14
- import { activateMarkweaveAttachmentDownload as I, attrsFromMarkweaveAttachmentUploadResult as ee, createMarkweaveAttachmentRefFromAttrs as L, createMarkweaveAttachmentUploadRequest as R, formatMarkweaveAttachmentSize as te } from "markweave/internal/plugins/media/attachment-download";
15
- import { MarkweaveAttachment as z } from "markweave/internal/plugins/media/media-nodes";
16
- import { detectUploadSource as B, getDirectUploadResult as V, resolveMarkweaveUploadResult as H } from "markweave/internal/plugins/slash-command/upload";
17
- import { createMarkweaveAiEditController as ne } from "markweave";
18
- import { isTextSelection as re, posToDOMRect as ie } from "@tiptap/core";
19
- import { NodeSelection as ae, Plugin as oe, PluginKey as se } from "@tiptap/pm/state";
20
- import { CellSelection as ce } from "@tiptap/pm/tables";
21
- import { isEditorComposing as le } from "markweave/internal/editor-core/composition-guard";
22
- import { saveMarkweaveBrowserFile as ue } from "markweave/internal/core/browser-file-save";
23
- import { createMarkweaveFrameScheduler as de } from "markweave/internal/editor-core/frame-scheduler";
24
- import { createMarkweaveEditorUpdatePayload as fe, getMarkweaveContentType as pe, isEditorContentCurrent as me, isMarkweaveControlledContentEchoCurrent as he, normalizeMarkweaveContentFormat as ge } from "markweave/internal/editor-core/editor-content";
25
- import { getCurrentFloatingToolbarBlockType as _e, getFloatingToolbarHighlightColorOptions as ve, getFloatingToolbarMoreActions as ye, getFloatingToolbarTextColorOptions as be, getFloatingToolbarTurnIntoOptions as xe, runFloatingToolbarMoreAction as Se, setFloatingToolbarTurnInto as Ce } from "markweave/internal/editor-core/floating-toolbar-model";
26
- import { createMarkweaveEditorRuntimeSnapshot as we } from "markweave/internal/editor-core/runtime-snapshot";
27
- import { areEditorSelectionSnapshotsEquivalent as Te, calculateFloatingToolbarPopoverPlacement as Ee, createSelectionSnapshot as De, markweaveRuntimeProjectionDelayMs as Oe, shouldShowFloatingToolbarForAiState as ke } from "markweave/internal/editor-core/selection-state";
28
- import { normalizeMarkweaveCanvasColor as Ae, normalizeMarkweaveTheme as je } from "markweave/internal/core/theme";
29
- import { createMarkweaveAiEditController as Me } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
30
- import { MarkweaveAskAiError as Ne, acceptMarkweaveAskAiResult as Pe, calculateMarkweaveAskAiPanelPosition as Fe, canStartMarkweaveAskAiTableTarget as Ie, clearMarkweaveAskAiPreview as Le, clearMarkweaveAskAiTarget as Re, createMarkweaveAskAiRequest as ze, getMappedMarkweaveAskAiSelection as Be, getMarkweaveAskAiSurfaceRect as Ve, getMarkweaveAskAiTarget as He, getMarkweaveAskAiTargetRect as Ue, hasMarkweaveAskAiPreview as We, isMarkweaveAskAiSelectionEligible as Ge, restoreMarkweaveAskAiTargetSelection as Ke, runMarkweaveAskAiHandler as qe, setMarkweaveAskAiPreview as Je, startMarkweaveAskAiTableTarget as Ye, startMarkweaveAskAiTarget as Xe } from "markweave/internal/plugins/ask-ai/ask-ai-session";
31
- import { createMarkweaveTocState as Ze, emptyMarkweaveTocState as Qe, getActiveMarkweaveTocId as $e, getMarkweaveInnerTocRailHeight as et, getMarkweaveTocItemsFromState as tt, getValidMarkweaveTocActiveId as nt, normalizeMarkweaveInnerTocPlacement as rt, observeMarkweaveInnerTocContainerPosition as it, observeMarkweaveInnerTocRailOverflow as at, scrollToMarkweaveTocItem as ot } from "markweave/internal/core/toc-state";
32
- import { codeBlockCollapsePluginKey as st, copyActiveCodeBlock as ct, getActiveCodeBlockState as lt, getCodeBlockCopyFeedbackSnapshot as ut, markweaveCodeBlockBehavior as dt, setCodeBlockCollapsedAtPosition as ft, setCodeBlockLanguageAtPosition as pt, setCodeBlockMermaidPreviewModeAtPosition as mt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
33
- import { calculateCodeBlockLanguageMenuPosition as ht, clampFullscreenScale as gt, codeBlockCopyFeedbackTimeoutMs as _t, copyCodeBlockText as vt, createCodeBlockLanguageMenuDomId as yt, createCodeBlockOverlayPosition as bt, createMermaidFullscreenViewerState as xt, createMermaidTabPosition as St, focusCodeBlockTarget as Ct, formatCodeBlockLanguageLabel as wt, formatFullscreenZoom as Tt, getActiveCodeBlockElement as Et, getAnchoredRect as Dt, getCodeBlockLanguageItems as Ot, getCodeBlockLanguageOptionDomId as kt, getCodeBlockPositionFromEventTarget as At, getCodeBlockStateAtPosition as jt, getFrameElement as Mt, getInitialCodeBlockLanguageItemIndex as Nt, getMermaidCodeBlockTargets as Pt, getMermaidSvgMarkup as Ft, isCodeBlockTargetCollapsed as It, mergeStableMermaidTabPositions as Lt, mermaidFullscreenZoomStep as Rt, moveCodeBlockLanguageItemIndex as zt, moveMermaidFullscreenViewer as Bt, scrollCodeBlockLanguageItemIntoView as Vt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
34
- import { normalizeMarkdownLinkHref as Ht } from "markweave/internal/plugins/markdown/markdown-input";
35
- import { applyMarkweaveMathLatex as Ut, calculateMarkweaveMathPopoverPosition as Wt, getMarkweaveMathAnchorRect as Gt, getMarkweaveMathBlockIndex as Kt, getMarkweaveMathRenderedHtml as qt, getMarkweaveMathTargetAtPos as Jt, getMarkweaveMathTargetFromDomEvent as Yt, getMarkweaveMathTargetFromSelection as Xt, renderMarkweaveMathPreview as Zt, setMarkweaveMathEditingDomState as Qt, setMarkweaveMathEditingDomStateInView as $t, setMarkweaveMathSelectionInView as en } from "markweave/internal/plugins/math/math-ui-model";
36
- import { isMermaidInlinePreviewTransaction as tn, setMarkweaveMermaidTheme as nn, setMermaidInlinePreviewEditorMode as rn, setReadonlyMermaidPreviewMode as an } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
37
- import { getMermaidPreviewState as on } from "markweave/internal/plugins/mermaid/mermaid-renderer";
38
- import { createResolvedSlashCommandSpecs as sn, getSlashCommandTextIconLength as cn, isExecutableSlashCommand as ln } from "markweave/internal/plugins/slash-command/command-spec";
39
- import { getSlashCommandKeyboardAction as un } from "markweave/internal/plugins/slash-command/slash-keyboard";
40
- import { scrollSlashCommandItemIntoView as dn } from "markweave/internal/plugins/slash-command/slash-menu-scroll";
41
- import { areSlashCommandMenuPositionsEquivalent as fn, getNextSlashCommandState as pn, getSlashCommandAnchoredMenuPosition as mn, getSlashCommandContext as hn, isMarkweaveSlashMenuScrollTarget as gn, isSlashCommandAnchorVisible as _n } from "markweave/internal/plugins/slash-command/slash-runtime";
42
- import { createMarkweaveCommandController as vn, executeMarkweaveSlashCommand as yn, setMarkweaveCommandContentFormat as bn, setMarkweaveCommandRegistry as xn } from "markweave/internal/commands/command-runtime";
43
- import { createMarkweaveCommandRegistry as Sn } from "markweave/internal/commands/command-registry";
44
- import { initialSlashCommandState as Cn, reduceSlashCommandState as wn } from "markweave/internal/plugins/slash-command/slash-state";
45
- import { setMarkweaveTableMenuAxisTarget as Tn } from "markweave/internal/plugins/table/table-clipboard";
46
- import { isMarkweaveTableCapabilityAllowed as En } from "markweave/internal/plugins/table/table-capabilities";
47
- import { getFirstTableDebugSnapshot as Dn } from "markweave/internal/plugins/table/table-debug-snapshot";
48
- import { focusFirstTableBodyCell as On } from "markweave/internal/plugins/table/table-focus-position";
49
- import { getTableFocusState as kn } from "markweave/internal/plugins/table/table-focus-state";
50
- import { getTableSelectionOverlayState as An, initialTableInteractionState as jn, tableInteractionPluginKey as Mn } from "markweave/internal/plugins/table/table-interaction-layer";
51
- import { applyTableAxisAlignment as Nn, applyTableAxisBackgroundColor as Pn, applyTableAxisTextColor as Fn, calculateAnchoredTableMenuPosition as In, calculateAnchoredTableSubmenuPosition as Ln, calculateTableAxisHandleLayout as Rn, calculateTableExtendButtonLayout as zn, canRunTableCommand as Bn, executeTableMenuCommand as Vn, formatTableCopyFeedback as Hn, getActiveTableElement as Un, getAvailableCellMenuCommandSpecs as Wn, getTableAxisDropIndexAtPoint as Gn, getTableAxisFormattingState as Kn, getTableAxisTargetRect as qn, getTableControlAxisSelectionModel as Jn, getTableMenuBoundaryRect as Yn, getTableMenuItemGroup as Xn, getTableMenuItemLabel as Zn, getTableMenuItems as Qn, getTableSelectionTargetRect as $n, measureTableSelectionOverlay as er, moveTargetedTableAxis as tr, selectTableAxisFromCell as nr, tableColorOptions as rr, tableCopyFeedbackTimeoutMs as ir, tableHorizontalAlignmentOptions as ar, tableMenuLabel as or, tableVerticalAlignmentOptions as sr, targetTableAxisFromCell as cr } from "markweave/internal/plugins/table/table-ui-model";
14
+ import { activateMarkweaveAttachmentDownload as I, attrsFromMarkweaveAttachmentUploadResult as ee, createMarkweaveAttachmentRefFromAttrs as L, createMarkweaveAttachmentUploadRequest as te, formatMarkweaveAttachmentSize as ne } from "markweave/internal/plugins/media/attachment-download";
15
+ import { MarkweaveAttachment as R } from "markweave/internal/plugins/media/media-nodes";
16
+ import { detectUploadSource as re, getDirectUploadResult as z, resolveMarkweaveUploadResult as B } from "markweave/internal/plugins/slash-command/upload";
17
+ import { createMarkweaveAiEditController as ie, prepareMarkweaveEditorForOutput as ae } from "markweave";
18
+ import { isTextSelection as oe, posToDOMRect as V } from "@tiptap/core";
19
+ import { NodeSelection as se, Plugin as ce, PluginKey as le } from "@tiptap/pm/state";
20
+ import { CellSelection as H } from "@tiptap/pm/tables";
21
+ import { isEditorComposing as ue } from "markweave/internal/editor-core/composition-guard";
22
+ import { saveMarkweaveBrowserFile as de } from "markweave/internal/core/browser-file-save";
23
+ import { createMarkweaveFrameScheduler as fe } from "markweave/internal/editor-core/frame-scheduler";
24
+ import { createMarkweaveDocumentViewportCoordinator as pe } from "markweave/internal/core/document-viewport";
25
+ import { createMarkweaveEditorUpdatePayload as me, getMarkweaveContentType as he, isEditorContentCurrent as ge, isMarkweaveControlledContentEchoCurrent as _e, normalizeMarkweaveContentFormat as ve } from "markweave/internal/editor-core/editor-content";
26
+ import { getCurrentFloatingToolbarBlockType as ye, getFloatingToolbarHighlightColorOptions as be, getFloatingToolbarMoreActions as xe, getFloatingToolbarTextColorOptions as Se, getFloatingToolbarTurnIntoOptions as Ce, runFloatingToolbarMoreAction as we, setFloatingToolbarTurnInto as Te } from "markweave/internal/editor-core/floating-toolbar-model";
27
+ import { createMarkweaveEditorRuntimeSnapshot as Ee } from "markweave/internal/editor-core/runtime-snapshot";
28
+ import { createMarkweaveDocumentLoadState as De, getMarkweaveContentLength as Oe, getMarkweaveDocumentLoadMeta as ke, loadMarkweaveDocument as Ae, profileMarkweaveDocument as je, resolveMarkweavePerformanceTier as Me, shouldCoordinateMarkweaveDocumentLoad as Ne } from "markweave/internal/editor-core/document-load";
29
+ import { areEditorSelectionSnapshotsEquivalent as Pe, calculateFloatingToolbarPopoverPlacement as Fe, createSelectionSnapshot as Ie, markweaveRuntimeProjectionDelayMs as Le, shouldShowFloatingToolbarForAiState as Re } from "markweave/internal/editor-core/selection-state";
30
+ import { normalizeMarkweaveCanvasColor as ze, normalizeMarkweaveTheme as Be } from "markweave/internal/core/theme";
31
+ import { createMarkweaveAiEditController as Ve } from "markweave/internal/plugins/ai-edit/ai-edit-controller";
32
+ import { createMarkweaveSearchController as He } from "markweave/internal/plugins/search/search-controller";
33
+ import { MarkweaveAskAiError as Ue, acceptMarkweaveAskAiResult as We, calculateMarkweaveAskAiPanelPosition as Ge, canStartMarkweaveAskAiTableTarget as Ke, clearMarkweaveAskAiPreview as qe, clearMarkweaveAskAiTarget as Je, createMarkweaveAskAiRequest as Ye, getMappedMarkweaveAskAiSelection as Xe, getMarkweaveAskAiSurfaceRect as Ze, getMarkweaveAskAiTarget as Qe, getMarkweaveAskAiTargetRect as $e, hasMarkweaveAskAiPreview as et, isMarkweaveAskAiSelectionEligible as tt, restoreMarkweaveAskAiTargetSelection as nt, runMarkweaveAskAiHandler as rt, setMarkweaveAskAiPreview as it, startMarkweaveAskAiTableTarget as at, startMarkweaveAskAiTarget as ot } from "markweave/internal/plugins/ask-ai/ask-ai-session";
34
+ import { createMarkweaveTocState as st, emptyMarkweaveTocState as ct, getActiveMarkweaveTocId as lt, getMarkweaveInnerTocRailHeight as ut, getMarkweaveTocItemsFromState as dt, getValidMarkweaveTocActiveId as ft, normalizeMarkweaveInnerTocPlacement as pt, observeMarkweaveInnerTocContainerPosition as mt, observeMarkweaveInnerTocRailOverflow as ht, scrollToMarkweaveTocItem as gt } from "markweave/internal/core/toc-state";
35
+ import { codeBlockCollapsePluginKey as _t, copyActiveCodeBlock as vt, getActiveCodeBlockState as yt, getCodeBlockCopyFeedbackSnapshot as bt, markweaveCodeBlockBehavior as xt, setCodeBlockCollapsedAtPosition as St, setCodeBlockLanguageAtPosition as Ct, setCodeBlockMermaidPreviewModeAtPosition as wt } from "markweave/internal/plugins/codeblock/codeblock-behavior";
36
+ import { calculateCodeBlockLanguageMenuPosition as Tt, clampFullscreenScale as Et, codeBlockCopyFeedbackTimeoutMs as Dt, copyCodeBlockText as Ot, createCodeBlockLanguageMenuDomId as kt, createCodeBlockOverlayPosition as At, createMermaidFullscreenViewerState as jt, createMermaidTabPosition as Mt, focusCodeBlockTarget as Nt, formatCodeBlockLanguageLabel as Pt, formatFullscreenZoom as Ft, getActiveCodeBlockElement as It, getAnchoredRect as Lt, getCodeBlockLanguageItems as Rt, getCodeBlockLanguageOptionDomId as zt, getCodeBlockPositionFromEventTarget as Bt, getCodeBlockStateAtPosition as Vt, getFrameElement as Ht, getInitialCodeBlockLanguageItemIndex as Ut, getMermaidCodeBlockTargets as Wt, getMermaidSvgMarkup as Gt, isCodeBlockTargetCollapsed as Kt, mergeStableMermaidTabPositions as qt, mermaidFullscreenZoomStep as Jt, moveCodeBlockLanguageItemIndex as Yt, moveMermaidFullscreenViewer as Xt, scrollCodeBlockLanguageItemIntoView as Zt } from "markweave/internal/plugins/codeblock/codeblock-ui-model";
37
+ import { normalizeMarkdownLinkHref as Qt } from "markweave/internal/plugins/markdown/markdown-input";
38
+ import { applyMarkweaveMathLatex as $t, calculateMarkweaveMathPopoverPosition as en, getMarkweaveMathAnchorRect as tn, getMarkweaveMathBlockIndex as nn, getMarkweaveMathRenderedHtml as rn, getMarkweaveMathTargetAtPos as an, getMarkweaveMathTargetFromDomEvent as on, getMarkweaveMathTargetFromSelection as sn, renderMarkweaveMathPreview as cn, setMarkweaveMathEditingDomState as ln, setMarkweaveMathEditingDomStateInView as un, setMarkweaveMathSelectionInView as dn } from "markweave/internal/plugins/math/math-ui-model";
39
+ import { isMermaidInlinePreviewTransaction as fn, setMarkweaveMermaidTheme as pn, setMermaidInlinePreviewEditorMode as mn, setReadonlyMermaidPreviewMode as hn } from "markweave/internal/plugins/mermaid/mermaid-inline-preview";
40
+ import { getMermaidPreviewState as gn } from "markweave/internal/plugins/mermaid/mermaid-renderer";
41
+ import { createResolvedSlashCommandSpecs as _n, getSlashCommandTextIconLength as vn, isExecutableSlashCommand as yn } from "markweave/internal/plugins/slash-command/command-spec";
42
+ import { getSlashCommandKeyboardAction as bn } from "markweave/internal/plugins/slash-command/slash-keyboard";
43
+ import { scrollSlashCommandItemIntoView as xn } from "markweave/internal/plugins/slash-command/slash-menu-scroll";
44
+ import { areSlashCommandMenuPositionsEquivalent as Sn, getNextSlashCommandState as Cn, getSlashCommandAnchoredMenuPosition as wn, getSlashCommandContext as Tn, isMarkweaveSlashMenuScrollTarget as En, isSlashCommandAnchorVisible as Dn } from "markweave/internal/plugins/slash-command/slash-runtime";
45
+ import { createMarkweaveCommandController as On, executeMarkweaveSlashCommand as kn, setMarkweaveCommandContentFormat as An, setMarkweaveCommandRegistry as jn } from "markweave/internal/commands/command-runtime";
46
+ import { createMarkweaveCommandRegistry as Mn } from "markweave/internal/commands/command-registry";
47
+ import { initialSlashCommandState as Nn, reduceSlashCommandState as Pn } from "markweave/internal/plugins/slash-command/slash-state";
48
+ import { setMarkweaveTableMenuAxisTarget as Fn } from "markweave/internal/plugins/table/table-clipboard";
49
+ import { isMarkweaveTableCapabilityAllowed as In } from "markweave/internal/plugins/table/table-capabilities";
50
+ import { getFirstTableDebugSnapshot as Ln } from "markweave/internal/plugins/table/table-debug-snapshot";
51
+ import { focusFirstTableBodyCell as Rn } from "markweave/internal/plugins/table/table-focus-position";
52
+ import { getTableFocusState as zn } from "markweave/internal/plugins/table/table-focus-state";
53
+ import { getTableSelectionOverlayState as Bn, initialTableInteractionState as Vn, tableInteractionPluginKey as Hn } from "markweave/internal/plugins/table/table-interaction-layer";
54
+ import { applyTableAxisAlignment as Un, applyTableAxisBackgroundColor as Wn, applyTableAxisTextColor as Gn, calculateAnchoredTableMenuPosition as Kn, calculateAnchoredTableSubmenuPosition as qn, calculateTableAxisHandleLayout as Jn, calculateTableExtendButtonLayout as Yn, canRunTableCommand as Xn, executeTableMenuCommand as Zn, formatTableCopyFeedback as Qn, getActiveTableElement as $n, getAvailableCellMenuCommandSpecs as er, getTableAxisDropIndexAtPoint as tr, getTableAxisFormattingState as nr, getTableAxisTargetRect as rr, getTableControlAxisSelectionModel as ir, getTableMenuBoundaryRect as ar, getTableMenuItemGroup as or, getTableMenuItemLabel as sr, getTableMenuItems as cr, getTableSelectionTargetRect as lr, measureTableSelectionOverlay as ur, moveTargetedTableAxis as dr, selectTableAxisFromCell as fr, tableColorOptions as pr, tableCopyFeedbackTimeoutMs as mr, tableHorizontalAlignmentOptions as hr, tableMenuLabel as gr, tableVerticalAlignmentOptions as _r, targetTableAxisFromCell as vr } from "markweave/internal/plugins/table/table-ui-model";
52
55
  //#region src/vue2-compat.ts
53
- var lr = c.default ?? c, ur = null, dr = null, fr = null;
54
- function pr(e) {
56
+ var yr = c.default ?? c, br = null, xr = null, Sr = null;
57
+ function Cr(e) {
55
58
  return !!(e && typeof e == "object" && "value" in e);
56
59
  }
57
- function mr(e) {
60
+ function wr(e) {
58
61
  let t = e.slice(2);
59
62
  return t.endsWith("Capture") ? `!${t.slice(0, -7).replace(/^[A-Z]/, (e) => e.toLowerCase())}` : t.replace(/^[A-Z]/, (e) => e.toLowerCase());
60
63
  }
61
- function hr(e) {
64
+ function Tr(e) {
62
65
  let t = {}, n = {}, r = {}, i = {}, a = {};
63
66
  for (let [o, s] of Object.entries(e)) if (s !== void 0) {
64
67
  if (o === "class" || o === "style" || o === "key") {
65
68
  t[o] = s;
66
69
  continue;
67
70
  }
68
- if (o === "ref" && pr(s)) {
71
+ if (o === "ref" && Cr(s)) {
69
72
  a.insert = (e) => {
70
73
  s.value = e.elm;
71
74
  }, a.destroy = () => {
@@ -74,7 +77,7 @@ function hr(e) {
74
77
  continue;
75
78
  }
76
79
  if (/^on[A-Z]/.test(o)) {
77
- i[mr(o)] = s;
80
+ i[wr(o)] = s;
78
81
  continue;
79
82
  }
80
83
  if (o === "value" || o === "checked" || o === "innerHTML" || o === "textContent") {
@@ -85,14 +88,14 @@ function hr(e) {
85
88
  }
86
89
  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;
87
90
  }
88
- function gr(e) {
91
+ function Er(e) {
89
92
  let t = {}, n = {}, r = {}, i = {};
90
93
  for (let [a, o] of Object.entries(e)) if (o !== void 0) {
91
94
  if (a === "class" || a === "style" || a === "key") {
92
95
  t[a] = o;
93
96
  continue;
94
97
  }
95
- if (a === "ref" && pr(o)) {
98
+ if (a === "ref" && Cr(o)) {
96
99
  i.insert = (e) => {
97
100
  o.value = e.componentInstance ?? e.elm;
98
101
  }, i.destroy = () => {
@@ -108,34 +111,34 @@ function gr(e) {
108
111
  }
109
112
  return Object.keys(n).length && (t.props = n), Object.keys(r).length && (t.attrs = r), Object.keys(i).length && (t.hook = i), t;
110
113
  }
111
- function _r(e) {
114
+ function Dr(e) {
112
115
  return !!(e && typeof e == "object" && "default" in e && typeof e.default == "function");
113
116
  }
114
- function vr(e) {
117
+ function Or(e) {
115
118
  return !!(e && typeof e == "object" && ("tag" in e || "text" in e || "elm" in e || "componentOptions" in e || "componentInstance" in e));
116
119
  }
117
- function yr(e) {
120
+ function kr(e) {
118
121
  return e == null || Array.isArray(e) ? e : [e];
119
122
  }
120
- function br(e) {
121
- return typeof e == "function" ? yr(e()) : _r(e) ? yr(e.default()) : vr(e) ? [e] : e;
123
+ function Ar(e) {
124
+ return typeof e == "function" ? kr(e()) : Dr(e) ? kr(e.default()) : Or(e) ? [e] : e;
122
125
  }
123
126
  function U(e, t, n) {
124
- if (!fr) throw Error("Vue 2 render context is not available.");
125
- let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? hr(r) : gr(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : br(n);
126
- return fr(e, i, a);
127
+ if (!Sr) throw Error("Vue 2 render context is not available.");
128
+ let r = t && typeof t == "object" && !Array.isArray(t) ? t : {}, i = typeof e == "string" ? Tr(r) : Er(r), a = arguments.length === 2 && (Array.isArray(t) || typeof t == "string") ? t : Ar(n);
129
+ return Sr(e, i, a);
127
130
  }
128
131
  function W(e) {
129
- return lr.observable({ value: e });
132
+ return yr.observable({ value: e });
130
133
  }
131
- var xr = W;
132
- function G(e) {
134
+ var G = W;
135
+ function K(e) {
133
136
  return { get value() {
134
137
  return e();
135
138
  } };
136
139
  }
137
- function K(e, t, n) {
138
- let r = typeof e == "function" ? e : () => e.value, i = ur;
140
+ function q(e, t, n) {
141
+ let r = typeof e == "function" ? e : () => e.value, i = br;
139
142
  if (!i?.$watch) return () => void 0;
140
143
  let a = n ? {
141
144
  deep: n.deep,
@@ -143,25 +146,25 @@ function K(e, t, n) {
143
146
  } : void 0;
144
147
  if (n?.flush !== "post") return i.$watch(r, t, a);
145
148
  let o = !1, s = !1, c, l, u = i.$watch(r, (e, n) => {
146
- c = e, !s && (s = !0, l = n, Promise.resolve(lr.nextTick()).then(() => {
149
+ c = e, !s && (s = !0, l = n, Promise.resolve(yr.nextTick()).then(() => {
147
150
  o || (s = !1, t(c, l));
148
151
  }));
149
152
  }, a), d = () => {
150
153
  o || (o = !0, u());
151
154
  };
152
- return dr?.beforeUnmount.push(d), d;
155
+ return xr?.beforeUnmount.push(d), d;
153
156
  }
154
- function Sr(e) {
155
- dr?.mounted.push(e);
156
- }
157
- function Cr(e) {
158
- dr?.beforeUnmount.push(e);
157
+ function jr(e) {
158
+ xr?.mounted.push(e);
159
159
  }
160
- function q(e) {
161
- return e ? lr.nextTick(e) : lr.nextTick();
160
+ function Mr(e) {
161
+ xr?.beforeUnmount.push(e);
162
162
  }
163
163
  function J(e) {
164
- return lr.extend({
164
+ return e ? yr.nextTick(e) : yr.nextTick();
165
+ }
166
+ function Y(e) {
167
+ return yr.extend({
165
168
  name: e.name,
166
169
  props: e.props,
167
170
  created() {
@@ -169,12 +172,12 @@ function J(e) {
169
172
  mounted: [],
170
173
  beforeUnmount: []
171
174
  };
172
- ur = this, dr = t;
175
+ br = this, xr = t;
173
176
  try {
174
177
  let n = e.setup?.(this.$props ?? this) ?? null;
175
178
  this.__markweaveVue2Render = typeof n == "function" ? n : null, this.__markweaveVue2Lifecycle = t;
176
179
  } finally {
177
- ur = null, dr = null;
180
+ br = null, xr = null;
178
181
  }
179
182
  },
180
183
  mounted() {
@@ -184,19 +187,19 @@ function J(e) {
184
187
  this.__markweaveVue2Lifecycle?.beforeUnmount.forEach((e) => e());
185
188
  },
186
189
  render(t) {
187
- fr = t;
190
+ Sr = t;
188
191
  try {
189
192
  let n = this.__markweaveVue2Render;
190
193
  return n ? n() : e.render?.(t) ?? null;
191
194
  } finally {
192
- fr = null;
195
+ Sr = null;
193
196
  }
194
197
  }
195
198
  });
196
199
  }
197
200
  //#endregion
198
201
  //#region src/vue2-icons.ts
199
- var wr = {
202
+ var Nr = {
200
203
  AlignVerticalJustifyCenter: {
201
204
  iconName: "align-vertical-justify-center",
202
205
  node: [
@@ -1518,11 +1521,11 @@ var wr = {
1518
1521
  }]]
1519
1522
  }
1520
1523
  };
1521
- function Tr(e) {
1524
+ function Pr(e) {
1522
1525
  return e.map(([e, t]) => U(e, t));
1523
1526
  }
1524
- function Y(e) {
1525
- return J({
1527
+ function X(e) {
1528
+ return Y({
1526
1529
  name: `MarkweaveVue2Icon${e}`,
1527
1530
  props: {
1528
1531
  size: {
@@ -1539,7 +1542,7 @@ function Y(e) {
1539
1542
  }
1540
1543
  },
1541
1544
  setup(t) {
1542
- let n = wr[e];
1545
+ let n = Nr[e];
1543
1546
  return () => U("svg", {
1544
1547
  class: `lucide lucide-${n.iconName}`,
1545
1548
  viewBox: "0 0 24 24",
@@ -1552,12 +1555,12 @@ function Y(e) {
1552
1555
  "stroke-width": t.absoluteStrokeWidth && t.size ? Number(t.strokeWidth) * 24 / Number(t.size) : t.strokeWidth,
1553
1556
  "aria-hidden": "true",
1554
1557
  focusable: "false"
1555
- }, Tr(n.node));
1558
+ }, Pr(n.node));
1556
1559
  }
1557
1560
  });
1558
1561
  }
1559
- var Er = Y("AlignCenter"), Dr = Y("AlignJustify"), Or = Y("AlignLeft"), kr = Y("AlignRight"), Ar = Y("AlignVerticalJustifyCenter"), jr = Y("AlignVerticalJustifyEnd"), Mr = Y("AlignVerticalJustifyStart"), Nr = Y("AlertTriangle"), Pr = Y("ArrowDown"), Fr = Y("ArrowDownAZ"), Ir = Y("ArrowLeft"), Lr = Y("ArrowRight"), Rr = Y("ArrowUp"), zr = Y("ArrowUpZA"), Br = Y("BetweenHorizontalEnd"), Vr = Y("BetweenHorizontalStart"), Hr = Y("BetweenVerticalEnd"), Ur = Y("BetweenVerticalStart"), Wr = Y("Bold"), Gr = Y("Braces"), Kr = Y("Captions"), qr = Y("Check"), Jr = Y("CheckCircle2"), Yr = Y("ChevronDown"), Xr = Y("ChevronRight"), Zr = Y("ChevronUp"), Qr = Y("CircleX"), $r = Y("Code2"), ei = Y("CornerDownLeft"), ti = Y("Copy"), ni = Y("Download"), ri = Y("Eye"), ii = Y("ExternalLink"), ai = Y("Heading1"), oi = Y("Heading2"), si = Y("Heading3"), ci = Y("Image"), li = Y("ImageUp"), ui = Y("IndentDecrease"), di = Y("IndentIncrease"), fi = Y("Info"), pi = Y("Italic"), mi = Y("Lightbulb"), hi = Y("Link2"), gi = Y("List"), _i = Y("ListChecks"), vi = Y("ListOrdered"), yi = Y("Minus"), bi = Y("MoreVertical"), xi = Y("PaintBucket"), Si = Y("Paperclip"), Ci = Y("PencilLine"), wi = Y("Plus"), Ti = Y("Quote"), Ei = Y("Replace"), Di = Y("RotateCcw"), Oi = Y("Sigma"), ki = Y("SmilePlus"), Ai = Y("Sparkles"), ji = Y("Square"), Mi = Y("SquareX"), Ni = Y("Strikethrough"), Pi = Y("Subscript"), Fi = Y("Superscript"), Ii = Y("Table2"), Li = Y("TableCellsMerge"), Ri = Y("TableCellsSplit"), zi = Y("Text"), Bi = Y("Trash2"), Vi = Y("Type"), Hi = Y("Underline"), Ui = Y("Upload"), Wi = Y("Video"), Gi = Y("X"), Ki = M;
1560
- function qi(e) {
1562
+ var Fr = X("AlignCenter"), Ir = X("AlignJustify"), Lr = X("AlignLeft"), Rr = X("AlignRight"), zr = X("AlignVerticalJustifyCenter"), Br = X("AlignVerticalJustifyEnd"), Vr = X("AlignVerticalJustifyStart"), Hr = X("AlertTriangle"), Ur = X("ArrowDown"), Wr = X("ArrowDownAZ"), Gr = X("ArrowLeft"), Kr = X("ArrowRight"), qr = X("ArrowUp"), Jr = X("ArrowUpZA"), Yr = X("BetweenHorizontalEnd"), Xr = X("BetweenHorizontalStart"), Zr = X("BetweenVerticalEnd"), Qr = X("BetweenVerticalStart"), $r = X("Bold"), ei = X("Braces"), ti = X("Captions"), ni = X("Check"), ri = X("CheckCircle2"), ii = X("ChevronDown"), ai = X("ChevronRight"), oi = X("ChevronUp"), si = X("CircleX"), ci = X("Code2"), li = X("CornerDownLeft"), ui = X("Copy"), di = X("Download"), fi = X("Eye"), pi = X("ExternalLink"), mi = X("Heading1"), hi = X("Heading2"), gi = X("Heading3"), _i = X("Image"), vi = X("ImageUp"), yi = X("IndentDecrease"), bi = X("IndentIncrease"), xi = X("Info"), Si = X("Italic"), Ci = X("Lightbulb"), wi = X("Link2"), Ti = X("List"), Ei = X("ListChecks"), Di = X("ListOrdered"), Oi = X("Minus"), ki = X("MoreVertical"), Ai = X("PaintBucket"), ji = X("Paperclip"), Mi = X("PencilLine"), Ni = X("Plus"), Pi = X("Quote"), Fi = X("Replace"), Ii = X("RotateCcw"), Li = X("Sigma"), Ri = X("SmilePlus"), zi = X("Sparkles"), Bi = X("Square"), Vi = X("SquareX"), Hi = X("Strikethrough"), Ui = X("Subscript"), Wi = X("Superscript"), Gi = X("Table2"), Ki = X("TableCellsMerge"), qi = X("TableCellsSplit"), Ji = X("Text"), Yi = X("Trash2"), Xi = X("Type"), Zi = X("Underline"), Qi = X("Upload"), $i = X("Video"), ea = X("X"), ta = M;
1563
+ function na(e) {
1561
1564
  let t = e.view.dom.closest(".markweave-editor-frame"), n = () => {
1562
1565
  let n = t?.getAttribute("data-markweave-mode");
1563
1566
  return n === "view" ? {
@@ -1575,27 +1578,27 @@ function qi(e) {
1575
1578
  return a && t && a.observe(t, {
1576
1579
  attributes: !0,
1577
1580
  attributeFilter: ["data-markweave-mode"]
1578
- }), Cr(() => {
1581
+ }), Mr(() => {
1579
1582
  i(), a?.disconnect();
1580
1583
  }), r;
1581
1584
  }
1582
- function Ji(e) {
1585
+ function ra(e) {
1583
1586
  return e instanceof Element && !!e.closest("[data-markweave-image-ui=\"true\"]");
1584
1587
  }
1585
- function Yi(e) {
1588
+ function ia(e) {
1586
1589
  return e instanceof Element && !!e.closest("[data-markweave-video-ui=\"true\"], iframe[data-markweave-video-embed], video[data-markweave-video]");
1587
1590
  }
1588
- function Xi(e) {
1591
+ function aa(e) {
1589
1592
  return e instanceof Element && !!e.closest("[data-markweave-link-card-ui=\"true\"]");
1590
1593
  }
1591
- function Zi(e, t) {
1594
+ function oa(e, t) {
1592
1595
  return U(e, {
1593
1596
  size: 18,
1594
1597
  strokeWidth: 1.8,
1595
1598
  "aria-hidden": "true"
1596
1599
  }, { default: () => t });
1597
1600
  }
1598
- function Qi(e) {
1601
+ function sa(e) {
1599
1602
  return U("button", {
1600
1603
  type: "button",
1601
1604
  "aria-label": e.label,
@@ -1604,12 +1607,12 @@ function Qi(e) {
1604
1607
  "data-active": e.active ? "true" : "false",
1605
1608
  onMousedown: (e) => e.preventDefault(),
1606
1609
  onClick: e.onClick
1607
- }, [Zi(e.icon, e.label), U("span", {
1610
+ }, [oa(e.icon, e.label), U("span", {
1608
1611
  class: "markweave-image-tooltip",
1609
1612
  role: "tooltip"
1610
1613
  }, e.label)]);
1611
1614
  }
1612
- function $i(e) {
1615
+ function ca(e) {
1613
1616
  let t = W(null), n = e.messages.image;
1614
1617
  return U("section", {
1615
1618
  class: "markweave-image-upload-placeholder",
@@ -1651,7 +1654,7 @@ function $i(e) {
1651
1654
  U("span", {
1652
1655
  class: "markweave-image-upload-icon",
1653
1656
  "aria-hidden": "true"
1654
- }, [U(li, {
1657
+ }, [U(vi, {
1655
1658
  size: 16,
1656
1659
  strokeWidth: 1.8
1657
1660
  })]),
@@ -1677,7 +1680,7 @@ function $i(e) {
1677
1680
  "data-testid": "markweave-image-upload-submit",
1678
1681
  disabled: e.isSubmitting || !e.inputValue.trim(),
1679
1682
  onClick: e.onSubmit
1680
- }, [U(li, {
1683
+ }, [U(vi, {
1681
1684
  size: 16,
1682
1685
  strokeWidth: 1.8
1683
1686
  }), e.messages.common.insert]),
@@ -1693,7 +1696,7 @@ function $i(e) {
1693
1696
  }, e.error) : null
1694
1697
  ]);
1695
1698
  }
1696
- function ea(e) {
1699
+ function la(e) {
1697
1700
  let t = W(null), n = e.messages.video;
1698
1701
  return U("section", {
1699
1702
  class: "markweave-video-upload-placeholder",
@@ -1735,7 +1738,7 @@ function ea(e) {
1735
1738
  U("span", {
1736
1739
  class: "markweave-video-upload-icon",
1737
1740
  "aria-hidden": "true"
1738
- }, [U(Wi, {
1741
+ }, [U($i, {
1739
1742
  size: 16,
1740
1743
  strokeWidth: 1.8
1741
1744
  })]),
@@ -1761,7 +1764,7 @@ function ea(e) {
1761
1764
  "data-testid": "markweave-video-upload-submit",
1762
1765
  disabled: e.isSubmitting || !e.inputValue.trim(),
1763
1766
  onClick: e.onSubmit
1764
- }, [U(Ui, {
1767
+ }, [U(Qi, {
1765
1768
  size: 16,
1766
1769
  strokeWidth: 1.8
1767
1770
  }), e.messages.common.insert]),
@@ -1777,7 +1780,7 @@ function ea(e) {
1777
1780
  }, e.error) : null
1778
1781
  ]);
1779
1782
  }
1780
- var ta = J({
1783
+ var ua = Y({
1781
1784
  name: "MarkweaveVueImageNodeView",
1782
1785
  props: {
1783
1786
  editor: {
@@ -1810,8 +1813,8 @@ var ta = J({
1810
1813
  }
1811
1814
  },
1812
1815
  setup(e) {
1813
- let n = W(null), r = W(!1), i = W(!1), a = W(!1), s = W(""), c = W(null), l = W(!1), d = G(() => e.node.attrs), f = W(!!F(d.value.caption)), p = W(F(d.value.caption) ?? ""), m = qi(e.editor), h = G(() => u(m.value)), g = G(() => e.extension.options?.messages ?? t("zh")), _ = G(() => g.value.image), v = G(() => F(d.value.src)), b = G(() => e.extension.options?.resolveMediaSource), S = W(null), C = null;
1814
- K(v, (t) => {
1816
+ let n = W(null), r = W(!1), i = W(!1), a = W(!1), s = W(""), c = W(null), l = W(!1), d = K(() => e.node.attrs), f = W(!!F(d.value.caption)), p = W(F(d.value.caption) ?? ""), m = na(e.editor), h = K(() => u(m.value)), g = K(() => e.extension.options?.messages ?? t("zh")), _ = K(() => g.value.image), v = K(() => F(d.value.src)), b = K(() => e.extension.options?.resolveMediaSource), S = W(null), C = null;
1817
+ q(v, (t) => {
1815
1818
  if (C?.abort(), C = null, !t) {
1816
1819
  S.value = null;
1817
1820
  return;
@@ -1830,8 +1833,8 @@ var ta = J({
1830
1833
  }).then((e) => {
1831
1834
  r.signal.aborted || (S.value = e);
1832
1835
  });
1833
- }, { immediate: !0 }), Cr(() => C?.abort());
1834
- let T = G(() => S.value?.src ?? (b.value ? null : v.value)), E = G(() => Ki(d.value.align)), k = G(() => P(d.value.width)), j = G(() => F(d.value.caption)), M = G(() => h.value && (!v.value || i.value)), N = () => {
1836
+ }, { immediate: !0 }), Mr(() => C?.abort());
1837
+ let T = K(() => S.value?.src ?? (b.value ? null : v.value)), E = K(() => ta(d.value.align)), k = K(() => P(d.value.width)), j = K(() => F(d.value.caption)), M = K(() => h.value && (!v.value || i.value)), N = () => {
1835
1838
  T.value && y({
1836
1839
  src: T.value,
1837
1840
  alt: F(d.value.alt) ?? "",
@@ -1844,7 +1847,7 @@ var ta = J({
1844
1847
  }
1845
1848
  });
1846
1849
  };
1847
- K(j, (e) => {
1850
+ q(j, (e) => {
1848
1851
  f.value || (p.value = e ?? "");
1849
1852
  });
1850
1853
  let I = () => {
@@ -1862,28 +1865,28 @@ var ta = J({
1862
1865
  let n = e.extension.options;
1863
1866
  l.value = !0, c.value = null;
1864
1867
  try {
1865
- let r = await H(O(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1868
+ let r = await B(O(t, v.value && i.value ? "image-replace" : "image-insert"), n?.onUpload);
1866
1869
  e.updateAttributes(w(d.value, r)), s.value = "", i.value = !1;
1867
1870
  } catch (e) {
1868
1871
  c.value = e instanceof Error ? e.message : _.value.uploadFailedError;
1869
1872
  } finally {
1870
1873
  l.value = !1, a.value = !1;
1871
1874
  }
1872
- }, R = () => {
1875
+ }, te = () => {
1873
1876
  if (!s.value.trim()) {
1874
1877
  c.value = _.value.uploadRequiredError;
1875
1878
  return;
1876
1879
  }
1877
- L(B(s.value));
1878
- }, te = (e) => {
1880
+ L(re(s.value));
1881
+ }, ne = (e) => {
1879
1882
  L({
1880
1883
  type: "file",
1881
1884
  file: e,
1882
1885
  mimeType: e.type || "image/*"
1883
1886
  });
1884
- }, z = () => {
1887
+ }, R = () => {
1885
1888
  f.value = !f.value, f.value && (p.value = j.value ?? "");
1886
- }, V = (t, r) => {
1889
+ }, z = (t, r) => {
1887
1890
  if (!h.value || !v.value) return;
1888
1891
  r.preventDefault(), r.stopPropagation(), I();
1889
1892
  let i = n.value;
@@ -1904,7 +1907,7 @@ var ta = J({
1904
1907
  "data-selected": "false",
1905
1908
  "data-hovered": "false",
1906
1909
  "data-empty": "true"
1907
- }, () => $i({
1910
+ }, () => ca({
1908
1911
  messages: g.value,
1909
1912
  inputValue: s.value,
1910
1913
  error: c.value,
@@ -1913,8 +1916,8 @@ var ta = J({
1913
1916
  onInputValue: (e) => {
1914
1917
  s.value = e;
1915
1918
  },
1916
- onFile: te,
1917
- onSubmit: R,
1919
+ onFile: ne,
1920
+ onSubmit: te,
1918
1921
  onCancel: ee,
1919
1922
  onDragActive: (e) => {
1920
1923
  a.value = e;
@@ -1934,7 +1937,7 @@ var ta = J({
1934
1937
  r.value = !1;
1935
1938
  },
1936
1939
  onMousedown: (e) => {
1937
- h.value && !Ji(e.target) && I();
1940
+ h.value && !ra(e.target) && I();
1938
1941
  }
1939
1942
  }, () => [
1940
1943
  h.value ? U("div", {
@@ -1943,24 +1946,24 @@ var ta = J({
1943
1946
  "data-markweave-image-ui": "true",
1944
1947
  "aria-label": _.value.toolsAriaLabel
1945
1948
  }, [
1946
- Qi({
1949
+ sa({
1947
1950
  testId: "markweave-image-align-left",
1948
1951
  label: _.value.alignLeft,
1949
- icon: Or,
1952
+ icon: Lr,
1950
1953
  active: E.value === "left",
1951
1954
  onClick: () => e.updateAttributes({ align: "left" })
1952
1955
  }),
1953
- Qi({
1956
+ sa({
1954
1957
  testId: "markweave-image-align-center",
1955
1958
  label: _.value.alignCenter,
1956
- icon: Er,
1959
+ icon: Fr,
1957
1960
  active: E.value === "center",
1958
1961
  onClick: () => e.updateAttributes({ align: "center" })
1959
1962
  }),
1960
- Qi({
1963
+ sa({
1961
1964
  testId: "markweave-image-align-right",
1962
1965
  label: _.value.alignRight,
1963
- icon: kr,
1966
+ icon: Rr,
1964
1967
  active: E.value === "right",
1965
1968
  onClick: () => e.updateAttributes({ align: "right" })
1966
1969
  }),
@@ -1968,31 +1971,31 @@ var ta = J({
1968
1971
  class: "markweave-image-toolbar-divider",
1969
1972
  "aria-hidden": "true"
1970
1973
  }),
1971
- Qi({
1974
+ sa({
1972
1975
  testId: "markweave-image-caption",
1973
1976
  label: _.value.caption,
1974
- icon: Kr,
1977
+ icon: ti,
1975
1978
  active: f.value || !!j.value,
1976
- onClick: z
1979
+ onClick: R
1977
1980
  }),
1978
- Qi({
1981
+ sa({
1979
1982
  testId: "markweave-image-preview",
1980
1983
  label: _.value.preview,
1981
- icon: ri,
1984
+ icon: fi,
1982
1985
  onClick: N
1983
1986
  }),
1984
- Qi({
1987
+ sa({
1985
1988
  testId: "markweave-image-download",
1986
1989
  label: _.value.download,
1987
- icon: ni,
1990
+ icon: di,
1988
1991
  onClick: () => {
1989
1992
  T.value && A(T.value);
1990
1993
  }
1991
1994
  }),
1992
- Qi({
1995
+ sa({
1993
1996
  testId: "markweave-image-replace",
1994
1997
  label: _.value.replace,
1995
- icon: Ei,
1998
+ icon: Fi,
1996
1999
  onClick: () => {
1997
2000
  s.value = "", c.value = null, i.value = !0;
1998
2001
  }
@@ -2001,10 +2004,10 @@ var ta = J({
2001
2004
  class: "markweave-image-toolbar-divider",
2002
2005
  "aria-hidden": "true"
2003
2006
  }),
2004
- Qi({
2007
+ sa({
2005
2008
  testId: "markweave-image-delete",
2006
2009
  label: _.value.delete,
2007
- icon: Bi,
2010
+ icon: Yi,
2008
2011
  onClick: () => e.deleteNode()
2009
2012
  })
2010
2013
  ]) : null,
@@ -2040,7 +2043,7 @@ var ta = J({
2040
2043
  title: _.value.preview,
2041
2044
  onMousedown: (e) => e.preventDefault(),
2042
2045
  onClick: N
2043
- }, [U(ri, {
2046
+ }, [U(fi, {
2044
2047
  size: 16,
2045
2048
  strokeWidth: 1.8
2046
2049
  }), U("span", {
@@ -2054,7 +2057,7 @@ var ta = J({
2054
2057
  "data-side": "left",
2055
2058
  "aria-label": _.value.resizeLeft,
2056
2059
  "data-markweave-image-ui": "true",
2057
- onPointerdown: (e) => V("left", e)
2060
+ onPointerdown: (e) => z("left", e)
2058
2061
  }) : null,
2059
2062
  h.value ? U("button", {
2060
2063
  type: "button",
@@ -2063,7 +2066,7 @@ var ta = J({
2063
2066
  "data-side": "right",
2064
2067
  "aria-label": _.value.resizeRight,
2065
2068
  "data-markweave-image-ui": "true",
2066
- onPointerdown: (e) => V("right", e)
2069
+ onPointerdown: (e) => z("right", e)
2067
2070
  }) : null
2068
2071
  ]),
2069
2072
  h.value && (f.value || j.value) ? U("input", {
@@ -2085,7 +2088,7 @@ var ta = J({
2085
2088
  }, j.value) : null
2086
2089
  ]);
2087
2090
  }
2088
- }), na = J({
2091
+ }), da = Y({
2089
2092
  name: "MarkweaveVueVideoNodeView",
2090
2093
  props: {
2091
2094
  editor: {
@@ -2118,21 +2121,25 @@ var ta = J({
2118
2121
  }
2119
2122
  },
2120
2123
  setup(e) {
2121
- let n = W(!1), r = W(""), i = W(null), a = W(!1), s = qi(e.editor), c = G(() => u(s.value)), l = G(() => e.extension.options?.messages ?? t("zh")), d = 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 = () => {
2124
+ let n = W(!1), r = W(""), i = W(null), a = W(!1), s = na(e.editor), c = K(() => u(s.value)), l = K(() => e.extension.options?.messages ?? t("zh")), d = K(() => l.value.video), f = K(() => e.node.attrs), p = K(() => F(f.value.src)), m = K(() => F(f.value.embedUrl)), h = K(() => F(f.value.provider)), g = K(() => m.value ? N(m.value, h.value) : null), _ = W("pending"), v = K(() => F(f.value.mimeType)), y = K(() => F(f.value.title));
2125
+ q(g, () => {
2126
+ _.value = "pending";
2127
+ });
2128
+ let b = () => {
2122
2129
  p.value || e.deleteNode(), r.value = "", i.value = null, n.value = !1;
2123
- }, b = async (t) => {
2130
+ }, x = async (t) => {
2124
2131
  if (!c.value) return;
2125
2132
  let o = e.extension.options;
2126
2133
  a.value = !0, i.value = null;
2127
2134
  try {
2128
- let n = await H(k(t), o?.onUpload);
2135
+ let n = await B(k(t), o?.onUpload);
2129
2136
  e.updateAttributes(T(n)), r.value = "";
2130
2137
  } catch (e) {
2131
2138
  i.value = e instanceof Error ? e.message : d.value.uploadFailedError;
2132
2139
  } finally {
2133
2140
  a.value = !1, n.value = !1;
2134
2141
  }
2135
- }, x = () => {
2142
+ }, S = () => {
2136
2143
  if (!c.value) return;
2137
2144
  let t = E(r.value);
2138
2145
  if (!t) {
@@ -2140,17 +2147,17 @@ var ta = J({
2140
2147
  return;
2141
2148
  }
2142
2149
  i.value = null, e.updateAttributes(t), r.value = "";
2143
- }, S = (e) => {
2144
- b({
2150
+ }, C = (e) => {
2151
+ x({
2145
2152
  type: "file",
2146
2153
  file: e,
2147
2154
  mimeType: e.type || "video/*"
2148
2155
  });
2149
- }, C = () => {
2156
+ }, w = () => {
2150
2157
  if (!c.value) return;
2151
2158
  let t = e.getPos();
2152
2159
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
2153
- }, w = (t) => {
2160
+ }, D = (t) => {
2154
2161
  c.value && e.selected && (t.key === "Backspace" || t.key === "Delete") && (t.preventDefault(), e.deleteNode());
2155
2162
  };
2156
2163
  return () => c.value && !p.value ? U(o, {
@@ -2159,7 +2166,7 @@ var ta = J({
2159
2166
  "data-testid": "markweave-video-node",
2160
2167
  "data-empty": "true",
2161
2168
  "data-selected": "false"
2162
- }, () => ea({
2169
+ }, () => la({
2163
2170
  messages: l.value,
2164
2171
  inputValue: r.value,
2165
2172
  error: i.value,
@@ -2168,9 +2175,9 @@ var ta = J({
2168
2175
  onInputValue: (e) => {
2169
2176
  r.value = e;
2170
2177
  },
2171
- onFile: S,
2172
- onSubmit: x,
2173
- onCancel: y,
2178
+ onFile: C,
2179
+ onSubmit: S,
2180
+ onCancel: b,
2174
2181
  onDragActive: (e) => {
2175
2182
  n.value = e;
2176
2183
  }
@@ -2183,21 +2190,29 @@ var ta = J({
2183
2190
  "data-selected": c.value && e.selected ? "true" : "false",
2184
2191
  "aria-label": d.value.nodeAriaLabel,
2185
2192
  tabindex: c.value ? 0 : void 0,
2186
- onFocus: C,
2187
- onKeydown: w,
2193
+ onFocus: w,
2194
+ onKeydown: D,
2188
2195
  onMousedown: (e) => {
2189
- c.value && !Yi(e.target) && (e.preventDefault(), C());
2196
+ c.value && !ia(e.target) && (e.preventDefault(), w());
2190
2197
  }
2191
2198
  }, () => [g.value ? U("div", { class: "markweave-video-embed" }, [U("iframe", {
2199
+ key: g.value,
2192
2200
  class: "markweave-video-iframe",
2193
2201
  src: g.value,
2194
- title: v.value ?? `${h.value ?? "Video"} embed`,
2202
+ title: y.value ?? `${h.value ?? "Video"} embed`,
2195
2203
  "data-markweave-video-embed": "true",
2196
2204
  "data-markweave-video-provider": h.value ?? void 0,
2197
2205
  "data-markweave-video-src": p.value ?? void 0,
2206
+ "data-markweave-iframe-state": _.value,
2198
2207
  allow: j,
2199
2208
  loading: "lazy",
2200
- allowfullscreen: "true"
2209
+ allowfullscreen: "true",
2210
+ onLoad: () => {
2211
+ _.value = "resolved";
2212
+ },
2213
+ onError: () => {
2214
+ _.value = "unreadable";
2215
+ }
2201
2216
  }), c.value ? U("button", {
2202
2217
  type: "button",
2203
2218
  class: "markweave-video-selection-layer",
@@ -2207,12 +2222,12 @@ var ta = J({
2207
2222
  }) : null]) : p.value ? U("div", { class: "markweave-video-box" }, [U("video", {
2208
2223
  class: "markweave-video",
2209
2224
  src: p.value,
2210
- title: v.value ?? void 0,
2225
+ title: y.value ?? void 0,
2211
2226
  preload: "metadata",
2212
2227
  autoplay: !1,
2213
2228
  controls: !0,
2214
2229
  "data-markweave-video": "true",
2215
- "data-markweave-mime-type": _.value ?? void 0
2230
+ "data-markweave-mime-type": v.value ?? void 0
2216
2231
  }), c.value ? U("button", {
2217
2232
  type: "button",
2218
2233
  class: "markweave-video-selection-layer",
@@ -2225,7 +2240,7 @@ var ta = J({
2225
2240
  "aria-hidden": "true"
2226
2241
  })]);
2227
2242
  }
2228
- }), ra = S.extend({
2243
+ }), fa = S.extend({
2229
2244
  addOptions() {
2230
2245
  return {
2231
2246
  ...this.parent?.(),
@@ -2236,7 +2251,7 @@ var ta = J({
2236
2251
  },
2237
2252
  addNodeView() {
2238
2253
  if (typeof document > "u") return null;
2239
- let e = s(ta, { stopEvent: ({ event: e }) => Ji(e.target) }), n = this.options.resolveMediaSource;
2254
+ let e = s(ua, { stopEvent: ({ event: e }) => ra(e.target) }), n = this.options.resolveMediaSource;
2240
2255
  if (!n) return e;
2241
2256
  let r = b({
2242
2257
  messages: this.options.messages ?? t("zh"),
@@ -2245,7 +2260,7 @@ var ta = J({
2245
2260
  });
2246
2261
  return (t) => F(t.node.attrs.src) ? r(t) : e(t);
2247
2262
  }
2248
- }), ia = C.extend({
2263
+ }), pa = C.extend({
2249
2264
  addOptions() {
2250
2265
  return {
2251
2266
  ...this.parent?.(),
@@ -2255,16 +2270,16 @@ var ta = J({
2255
2270
  };
2256
2271
  },
2257
2272
  addNodeView() {
2258
- return typeof document > "u" ? null : s(na, { stopEvent: ({ event: e }) => Yi(e.target) });
2273
+ return typeof document > "u" ? null : s(da, { stopEvent: ({ event: e }) => ia(e.target) });
2259
2274
  }
2260
2275
  });
2261
- function aa(e) {
2276
+ function ma(e) {
2262
2277
  return e instanceof Element && !!e.closest("[data-markweave-attachment-ui=\"true\"], .markweave-attachment-upload-placeholder, .markweave-attachment-uploading");
2263
2278
  }
2264
- function oa(e, t) {
2279
+ function ha(e, t) {
2265
2280
  return typeof t != "number" || !Number.isFinite(t) || t <= 0 ? null : Math.max(0, Math.min(100, Math.round(e / t * 100)));
2266
2281
  }
2267
- var sa = J({
2282
+ var ga = Y({
2268
2283
  name: "MarkweaveVueAttachmentNodeView",
2269
2284
  props: {
2270
2285
  editor: {
@@ -2297,7 +2312,7 @@ var sa = J({
2297
2312
  }
2298
2313
  },
2299
2314
  setup(e) {
2300
- let n = G(() => e.extension.options), r = G(() => n.value?.messages ?? t("zh")), i = qi(e.editor), a = G(() => u(i.value)), s = G(() => L(e.node.attrs ?? {})), c = G(() => s.value?.name ?? F(e.node.attrs?.src) ?? r.value.attachment.missingSrc), d = G(() => [F(e.node.attrs?.mimeType), te(typeof e.node.attrs?.size == "number" ? e.node.attrs.size : null)].filter(Boolean).join(" · ")), f = W(null), p = W(!1), m = W(!1), h = W(null), g = W(null), _ = W(null), v = W(null), y = () => {
2315
+ let n = K(() => e.extension.options), r = K(() => n.value?.messages ?? t("zh")), i = na(e.editor), a = K(() => u(i.value)), s = K(() => L(e.node.attrs ?? {})), c = K(() => s.value?.name ?? F(e.node.attrs?.src) ?? r.value.attachment.missingSrc), d = K(() => [F(e.node.attrs?.mimeType), ne(typeof e.node.attrs?.size == "number" ? e.node.attrs.size : null)].filter(Boolean).join(" · ")), f = W(null), p = W(!1), m = W(!1), h = W(null), g = W(null), _ = W(null), v = W(null), y = () => {
2301
2316
  if (!a.value) return;
2302
2317
  let t = e.getPos();
2303
2318
  typeof t == "number" && e.editor.chain().focus().setNodeSelection(t).run();
@@ -2307,14 +2322,14 @@ var sa = J({
2307
2322
  if (!(!a.value || !t || m.value)) {
2308
2323
  h.value = null, m.value = !0, g.value = t.name, _.value = t.size, v.value = null;
2309
2324
  try {
2310
- let r = await H({
2311
- ...R({
2325
+ let r = await B({
2326
+ ...te({
2312
2327
  type: "file",
2313
2328
  file: t,
2314
2329
  mimeType: t.type || void 0
2315
2330
  }),
2316
2331
  onProgress: (e) => {
2317
- v.value = oa(e.loaded, e.total);
2332
+ v.value = ha(e.loaded, e.total);
2318
2333
  }
2319
2334
  }, n.value?.onUpload);
2320
2335
  e.updateAttributes(ee(r));
@@ -2330,10 +2345,10 @@ var sa = J({
2330
2345
  event: t
2331
2346
  }, n.value?.onDownload);
2332
2347
  }, C = (e) => {
2333
- aa(e.target) || (e.preventDefault(), e.stopPropagation(), s.value && S(e));
2348
+ ma(e.target) || (e.preventDefault(), e.stopPropagation(), s.value && S(e));
2334
2349
  };
2335
2350
  return () => {
2336
- let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [te(_.value), v.value === null ? null : `${v.value}%`].filter(Boolean).join(" · ");
2351
+ let t = r.value.attachment, n = a.value && !s.value && !m.value, i = m.value, l = !!s.value && (p.value || e.selected), u = [ne(_.value), v.value === null ? null : `${v.value}%`].filter(Boolean).join(" · ");
2337
2352
  return n ? U(o, {
2338
2353
  as: "div",
2339
2354
  class: "markweave-attachment markweave-attachment-upload-placeholder",
@@ -2366,7 +2381,7 @@ var sa = J({
2366
2381
  U("span", {
2367
2382
  class: "markweave-attachment-icon",
2368
2383
  "aria-hidden": "true"
2369
- }, [Zi(Ui, t.uploadLabel)]),
2384
+ }, [oa(Qi, t.uploadLabel)]),
2370
2385
  U("span", { class: "markweave-attachment-upload-label" }, t.uploadLabel),
2371
2386
  h.value ? U("span", { class: "markweave-attachment-upload-error" }, h.value) : null
2372
2387
  ])]) : i ? U(o, {
@@ -2388,7 +2403,7 @@ var sa = J({
2388
2403
  }, [U("span", {
2389
2404
  class: "markweave-attachment-icon",
2390
2405
  "aria-hidden": "true"
2391
- }, [Zi(Ui, t.uploading)]), U("span", { class: "markweave-attachment-body" }, [U("span", { class: "markweave-attachment-name" }, g.value ?? t.uploading), U("span", { class: "markweave-attachment-meta" }, [U("span", {
2406
+ }, [oa(Qi, t.uploading)]), U("span", { class: "markweave-attachment-body" }, [U("span", { class: "markweave-attachment-name" }, g.value ?? t.uploading), U("span", { class: "markweave-attachment-meta" }, [U("span", {
2392
2407
  class: "markweave-attachment-spinner",
2393
2408
  "aria-hidden": "true"
2394
2409
  }), u || t.uploading])])]) : U(o, {
@@ -2407,7 +2422,7 @@ var sa = J({
2407
2422
  p.value = !1;
2408
2423
  },
2409
2424
  onMousedown: (e) => {
2410
- !a.value || aa(e.target) || (e.preventDefault(), y());
2425
+ !a.value || ma(e.target) || (e.preventDefault(), y());
2411
2426
  },
2412
2427
  onKeydown: (t) => {
2413
2428
  a.value && e.selected && (t.key === "Delete" || t.key === "Backspace") && (t.preventDefault(), e.deleteNode());
@@ -2417,7 +2432,7 @@ var sa = J({
2417
2432
  U("span", {
2418
2433
  class: "markweave-attachment-icon",
2419
2434
  "aria-hidden": "true"
2420
- }, [Zi(Si, t.nodeAriaLabel)]),
2435
+ }, [oa(ji, t.nodeAriaLabel)]),
2421
2436
  U("span", { class: "markweave-attachment-body" }, [U("span", { class: "markweave-attachment-name" }, c.value), d.value ? U("span", { class: "markweave-attachment-meta" }, d.value) : null]),
2422
2437
  l ? U("span", {
2423
2438
  class: "markweave-attachment-actions",
@@ -2430,7 +2445,7 @@ var sa = J({
2430
2445
  "aria-label": t.downloadAriaLabel,
2431
2446
  onMousedown: (e) => e.preventDefault(),
2432
2447
  onClick: S
2433
- }, [Zi(ni, t.download), U("span", {
2448
+ }, [oa(di, t.download), U("span", {
2434
2449
  class: "markweave-attachment-tooltip",
2435
2450
  role: "tooltip"
2436
2451
  }, t.download)]), a.value ? U("button", {
@@ -2443,14 +2458,14 @@ var sa = J({
2443
2458
  onClick: (t) => {
2444
2459
  t.preventDefault(), t.stopPropagation(), e.deleteNode();
2445
2460
  }
2446
- }, [Zi(Bi, t.delete), U("span", {
2461
+ }, [oa(Yi, t.delete), U("span", {
2447
2462
  class: "markweave-attachment-tooltip",
2448
2463
  role: "tooltip"
2449
2464
  }, t.delete)]) : null]) : null
2450
2465
  ]);
2451
2466
  };
2452
2467
  }
2453
- }), ca = z.extend({
2468
+ }), _a = R.extend({
2454
2469
  addOptions() {
2455
2470
  return {
2456
2471
  ...this.parent?.(),
@@ -2461,9 +2476,9 @@ var sa = J({
2461
2476
  };
2462
2477
  },
2463
2478
  addNodeView() {
2464
- return typeof document > "u" ? null : s(sa, { stopEvent: ({ event: e }) => aa(e.target) });
2479
+ return typeof document > "u" ? null : s(ga, { stopEvent: ({ event: e }) => ma(e.target) });
2465
2480
  }
2466
- }), la = J({
2481
+ }), va = Y({
2467
2482
  name: "MarkweaveVueLinkCardNodeView",
2468
2483
  props: {
2469
2484
  editor: {
@@ -2496,11 +2511,11 @@ var sa = J({
2496
2511
  }
2497
2512
  },
2498
2513
  setup(e) {
2499
- let n = e.extension.options, r = n.messages ?? t("zh"), i = qi(e.editor), a = W(!1), s = W(!1), c = W(!1), l = G(() => g(e.node.attrs ?? {})), d = W(l.value?.title ?? ""), f = W(l.value?.href ?? "");
2500
- K(l, (e) => {
2514
+ let n = e.extension.options, r = n.messages ?? t("zh"), i = na(e.editor), a = W(!1), s = W(!1), c = W(!1), l = K(() => g(e.node.attrs ?? {})), d = W(l.value?.title ?? ""), f = W(l.value?.href ?? "");
2515
+ q(l, (e) => {
2501
2516
  d.value = e?.title ?? "", f.value = e?.href ?? "", c.value = !1;
2502
2517
  });
2503
- let p = G(() => u(i.value)), m = G(() => {
2518
+ let p = K(() => u(i.value)), m = K(() => {
2504
2519
  try {
2505
2520
  return new URL(l.value?.href ?? "").host;
2506
2521
  } catch {
@@ -2531,7 +2546,7 @@ var sa = J({
2531
2546
  "data-testid": n,
2532
2547
  onMousedown: y,
2533
2548
  onClick: r
2534
- }, [Zi(t, e), U("span", { role: "tooltip" }, e)]);
2549
+ }, [oa(t, e), U("span", { role: "tooltip" }, e)]);
2535
2550
  return () => {
2536
2551
  let t = l.value;
2537
2552
  if (!t) return null;
@@ -2567,10 +2582,10 @@ var sa = J({
2567
2582
  a.value = !1;
2568
2583
  },
2569
2584
  onMousedown: (e) => {
2570
- Xi(e.target) || e.preventDefault();
2585
+ aa(e.target) || e.preventDefault();
2571
2586
  },
2572
2587
  onClick: (e) => {
2573
- Xi(e.target) || (e.preventDefault(), t.href && window.open(t.href, "_blank", "noopener,noreferrer"));
2588
+ aa(e.target) || (e.preventDefault(), t.href && window.open(t.href, "_blank", "noopener,noreferrer"));
2574
2589
  }
2575
2590
  }, () => [
2576
2591
  U("a", {
@@ -2590,9 +2605,9 @@ var sa = J({
2590
2605
  "data-markweave-link-card-ui": "true",
2591
2606
  "aria-label": r.linkCard.toolsAriaLabel
2592
2607
  }, [
2593
- C(r.linkCard.convertToLink, hi, "markweave-link-card-convert", x),
2594
- C(r.linkCard.copyAddress, ni, "markweave-link-card-copy", () => b(t.href)),
2595
- C(r.linkCard.edit, Ci, "markweave-link-card-edit", (i) => h({
2608
+ C(r.linkCard.convertToLink, wi, "markweave-link-card-convert", x),
2609
+ C(r.linkCard.copyAddress, di, "markweave-link-card-copy", () => b(t.href)),
2610
+ C(r.linkCard.edit, Mi, "markweave-link-card-edit", (i) => h({
2596
2611
  anchor: i.currentTarget,
2597
2612
  editor: e.editor,
2598
2613
  messages: r,
@@ -2602,7 +2617,7 @@ var sa = J({
2602
2617
  attrs: t
2603
2618
  }
2604
2619
  })),
2605
- C(r.linkCard.delete, Bi, "markweave-link-card-delete", () => e.deleteNode())
2620
+ C(r.linkCard.delete, Yi, "markweave-link-card-delete", () => e.deleteNode())
2606
2621
  ]) : null,
2607
2622
  p.value && s.value ? U("form", {
2608
2623
  class: "markweave-link-card-editor",
@@ -2630,12 +2645,12 @@ var sa = J({
2630
2645
  type: "submit",
2631
2646
  disabled: !_(f.value),
2632
2647
  "aria-label": r.linkCard.edit
2633
- }, [Zi(hi, r.linkCard.edit)])
2648
+ }, [oa(wi, r.linkCard.edit)])
2634
2649
  ]) : null
2635
2650
  ]);
2636
2651
  };
2637
2652
  }
2638
- }), ua = m.extend({
2653
+ }), ya = m.extend({
2639
2654
  addOptions() {
2640
2655
  return {
2641
2656
  ...this.parent?.(),
@@ -2644,12 +2659,12 @@ var sa = J({
2644
2659
  };
2645
2660
  },
2646
2661
  addNodeView() {
2647
- return typeof document > "u" ? null : s(la, { stopEvent: ({ event: e }) => Xi(e.target) });
2662
+ return typeof document > "u" ? null : s(va, { stopEvent: ({ event: e }) => aa(e.target) });
2648
2663
  }
2649
2664
  });
2650
2665
  //#endregion
2651
2666
  //#region src/create-editor-extensions.ts
2652
- function da(n = {}) {
2667
+ function ba(n = {}) {
2653
2668
  return e({
2654
2669
  lang: n.lang,
2655
2670
  revealLinkMarkdown: n.revealLinkMarkdown,
@@ -2657,15 +2672,15 @@ function da(n = {}) {
2657
2672
  tableCapabilities: n.tableCapabilities,
2658
2673
  referenceSuggestion: n.referenceSuggestion,
2659
2674
  internalLinkCard: n.internalLinkCard,
2660
- linkCardExtension: ua.configure({
2675
+ linkCardExtension: ya.configure({
2661
2676
  lang: n.lang,
2662
2677
  messages: t(n.lang),
2663
2678
  resolver: n.linkCardResolver
2664
2679
  }),
2665
2680
  mediaExtensions: r({
2666
- image: ra,
2667
- video: ia,
2668
- attachment: ca,
2681
+ image: fa,
2682
+ video: pa,
2683
+ attachment: _a,
2669
2684
  lang: n.lang,
2670
2685
  onImageUpload: n.onImageUpload,
2671
2686
  onVideoUpload: n.onVideoUpload,
@@ -2678,64 +2693,64 @@ function da(n = {}) {
2678
2693
  }
2679
2694
  //#endregion
2680
2695
  //#region ../../node_modules/.pnpm/@tiptap+vue-2@3.29.2_@floating-ui+dom@1.7.6_@tiptap+core@3.29.2_@tiptap+pm@3.29.2__@tiptap+pm@3.29.2_vue@2.6.12/node_modules/@tiptap/vue-2/dist/menus/index.js
2681
- var fa = [
2696
+ var xa = [
2682
2697
  "top",
2683
2698
  "right",
2684
2699
  "bottom",
2685
2700
  "left"
2686
- ], pa = ["start", "end"], ma = /* @__PURE__ */ fa.reduce((e, t) => e.concat(t, t + "-" + pa[0], t + "-" + pa[1]), []), ha = Math.min, X = Math.max, ga = Math.round, _a = (e) => ({
2701
+ ], Sa = ["start", "end"], Ca = /* @__PURE__ */ xa.reduce((e, t) => e.concat(t, t + "-" + Sa[0], t + "-" + Sa[1]), []), wa = Math.min, Z = Math.max, Ta = Math.round, Ea = (e) => ({
2687
2702
  x: e,
2688
2703
  y: e
2689
- }), va = {
2704
+ }), Da = {
2690
2705
  left: "right",
2691
2706
  right: "left",
2692
2707
  bottom: "top",
2693
2708
  top: "bottom"
2694
- }, ya = {
2709
+ }, Oa = {
2695
2710
  start: "end",
2696
2711
  end: "start"
2697
2712
  };
2698
- function ba(e, t, n) {
2699
- return X(e, ha(t, n));
2713
+ function ka(e, t, n) {
2714
+ return Z(e, wa(t, n));
2700
2715
  }
2701
- function xa(e, t) {
2716
+ function Aa(e, t) {
2702
2717
  return typeof e == "function" ? e(t) : e;
2703
2718
  }
2704
- function Sa(e) {
2719
+ function ja(e) {
2705
2720
  return e.split("-")[0];
2706
2721
  }
2707
- function Ca(e) {
2722
+ function Ma(e) {
2708
2723
  return e.split("-")[1];
2709
2724
  }
2710
- function wa(e) {
2725
+ function Na(e) {
2711
2726
  return e === "x" ? "y" : "x";
2712
2727
  }
2713
- function Ta(e) {
2728
+ function Pa(e) {
2714
2729
  return e === "y" ? "height" : "width";
2715
2730
  }
2716
- function Ea(e) {
2717
- return ["top", "bottom"].includes(Sa(e)) ? "y" : "x";
2731
+ function Fa(e) {
2732
+ return ["top", "bottom"].includes(ja(e)) ? "y" : "x";
2718
2733
  }
2719
- function Da(e) {
2720
- return wa(Ea(e));
2734
+ function Ia(e) {
2735
+ return Na(Fa(e));
2721
2736
  }
2722
- function Oa(e, t, n) {
2737
+ function La(e, t, n) {
2723
2738
  n === void 0 && (n = !1);
2724
- let r = Ca(e), i = Da(e), a = Ta(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
2725
- return t.reference[a] > t.floating[a] && (o = Na(o)), [o, Na(o)];
2739
+ let r = Ma(e), i = Ia(e), a = Pa(i), o = i === "x" ? r === (n ? "end" : "start") ? "right" : "left" : r === "start" ? "bottom" : "top";
2740
+ return t.reference[a] > t.floating[a] && (o = Ha(o)), [o, Ha(o)];
2726
2741
  }
2727
- function ka(e) {
2728
- let t = Na(e);
2742
+ function Ra(e) {
2743
+ let t = Ha(e);
2729
2744
  return [
2730
- Aa(e),
2745
+ za(e),
2731
2746
  t,
2732
- Aa(t)
2747
+ za(t)
2733
2748
  ];
2734
2749
  }
2735
- function Aa(e) {
2736
- return e.replace(/start|end/g, (e) => ya[e]);
2750
+ function za(e) {
2751
+ return e.replace(/start|end/g, (e) => Oa[e]);
2737
2752
  }
2738
- function ja(e, t, n) {
2753
+ function Ba(e, t, n) {
2739
2754
  let r = ["left", "right"], i = ["right", "left"], a = ["top", "bottom"], o = ["bottom", "top"];
2740
2755
  switch (e) {
2741
2756
  case "top":
@@ -2745,14 +2760,14 @@ function ja(e, t, n) {
2745
2760
  default: return [];
2746
2761
  }
2747
2762
  }
2748
- function Ma(e, t, n, r) {
2749
- let i = Ca(e), a = ja(Sa(e), n === "start", r);
2750
- return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(Aa)))), a;
2763
+ function Va(e, t, n, r) {
2764
+ let i = Ma(e), a = Ba(ja(e), n === "start", r);
2765
+ return i && (a = a.map((e) => e + "-" + i), t && (a = a.concat(a.map(za)))), a;
2751
2766
  }
2752
- function Na(e) {
2753
- return e.replace(/left|right|bottom|top/g, (e) => va[e]);
2767
+ function Ha(e) {
2768
+ return e.replace(/left|right|bottom|top/g, (e) => Da[e]);
2754
2769
  }
2755
- function Pa(e) {
2770
+ function Ua(e) {
2756
2771
  return {
2757
2772
  top: 0,
2758
2773
  right: 0,
@@ -2761,15 +2776,15 @@ function Pa(e) {
2761
2776
  ...e
2762
2777
  };
2763
2778
  }
2764
- function Fa(e) {
2779
+ function Wa(e) {
2765
2780
  return typeof e == "number" ? {
2766
2781
  top: e,
2767
2782
  right: e,
2768
2783
  bottom: e,
2769
2784
  left: e
2770
- } : Pa(e);
2785
+ } : Ua(e);
2771
2786
  }
2772
- function Ia(e) {
2787
+ function Ga(e) {
2773
2788
  let { x: t, y: n, width: r, height: i } = e;
2774
2789
  return {
2775
2790
  width: r,
@@ -2782,8 +2797,8 @@ function Ia(e) {
2782
2797
  y: n
2783
2798
  };
2784
2799
  }
2785
- function La(e, t, n) {
2786
- let { reference: r, floating: i } = e, a = Ea(t), o = Da(t), s = Ta(o), c = Sa(t), l = a === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2, p;
2800
+ function Ka(e, t, n) {
2801
+ let { reference: r, floating: i } = e, a = Fa(t), o = Ia(t), s = Pa(o), c = ja(t), l = a === "y", u = r.x + r.width / 2 - i.width / 2, d = r.y + r.height / 2 - i.height / 2, f = r[s] / 2 - i[s] / 2, p;
2787
2802
  switch (c) {
2788
2803
  case "top":
2789
2804
  p = {
@@ -2814,7 +2829,7 @@ function La(e, t, n) {
2814
2829
  y: r.y
2815
2830
  };
2816
2831
  }
2817
- switch (Ca(t)) {
2832
+ switch (Ma(t)) {
2818
2833
  case "start":
2819
2834
  p[o] -= f * (n && l ? -1 : 1);
2820
2835
  break;
@@ -2824,12 +2839,12 @@ function La(e, t, n) {
2824
2839
  }
2825
2840
  return p;
2826
2841
  }
2827
- var Ra = async (e, t, n) => {
2842
+ var qa = async (e, t, n) => {
2828
2843
  let { placement: r = "bottom", strategy: i = "absolute", middleware: a = [], platform: o } = n, s = a.filter(Boolean), c = await (o.isRTL == null ? void 0 : o.isRTL(t)), l = await o.getElementRects({
2829
2844
  reference: e,
2830
2845
  floating: t,
2831
2846
  strategy: i
2832
- }), { x: u, y: d } = La(l, r, c), f = r, p = {}, m = 0;
2847
+ }), { x: u, y: d } = Ka(l, r, c), f = r, p = {}, m = 0;
2833
2848
  for (let n = 0; n < s.length; n++) {
2834
2849
  let { name: a, fn: h } = s[n], { x: g, y: _, data: v, reset: y } = await h({
2835
2850
  x: u,
@@ -2855,7 +2870,7 @@ var Ra = async (e, t, n) => {
2855
2870
  reference: e,
2856
2871
  floating: t,
2857
2872
  strategy: i
2858
- }) : y.rects), {x: u, y: d} = La(l, f, c)), n = -1);
2873
+ }) : y.rects), {x: u, y: d} = Ka(l, f, c)), n = -1);
2859
2874
  }
2860
2875
  return {
2861
2876
  x: u,
@@ -2865,9 +2880,9 @@ var Ra = async (e, t, n) => {
2865
2880
  middlewareData: p
2866
2881
  };
2867
2882
  };
2868
- async function za(e, t) {
2883
+ async function Ja(e, t) {
2869
2884
  t === void 0 && (t = {});
2870
- let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } = xa(t, e), p = Fa(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = Ia(await i.getClippingRect({
2885
+ let { x: n, y: r, platform: i, rects: a, elements: o, strategy: s } = e, { boundary: c = "clippingAncestors", rootBoundary: l = "viewport", elementContext: u = "floating", altBoundary: d = !1, padding: f = 0 } = Aa(t, e), p = Wa(f), m = o[d ? u === "floating" ? "reference" : "floating" : u], h = Ga(await i.getClippingRect({
2871
2886
  element: await (i.isElement == null ? void 0 : i.isElement(m)) ?? !0 ? m : m.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(o.floating)),
2872
2887
  boundary: c,
2873
2888
  rootBoundary: l,
@@ -2880,7 +2895,7 @@ async function za(e, t) {
2880
2895
  } : a.reference, _ = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(o.floating)), v = await (i.isElement == null ? void 0 : i.isElement(_)) && await (i.getScale == null ? void 0 : i.getScale(_)) || {
2881
2896
  x: 1,
2882
2897
  y: 1
2883
- }, y = Ia(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
2898
+ }, y = Ga(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
2884
2899
  elements: o,
2885
2900
  rect: g,
2886
2901
  offsetParent: _,
@@ -2893,18 +2908,18 @@ async function za(e, t) {
2893
2908
  right: (y.right - h.right + p.right) / v.x
2894
2909
  };
2895
2910
  }
2896
- var Ba = (e) => ({
2911
+ var Ya = (e) => ({
2897
2912
  name: "arrow",
2898
2913
  options: e,
2899
2914
  async fn(t) {
2900
- let { x: n, y: r, placement: i, rects: a, platform: o, elements: s, middlewareData: c } = t, { element: l, padding: u = 0 } = xa(e, t) || {};
2915
+ let { x: n, y: r, placement: i, rects: a, platform: o, elements: s, middlewareData: c } = t, { element: l, padding: u = 0 } = Aa(e, t) || {};
2901
2916
  if (l == null) return {};
2902
- let d = Fa(u), f = {
2917
+ let d = Wa(u), f = {
2903
2918
  x: n,
2904
2919
  y: r
2905
- }, p = Da(i), m = Ta(p), h = await o.getDimensions(l), g = p === "y", _ = g ? "top" : "left", v = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", b = a.reference[m] + a.reference[p] - f[p] - a.floating[m], x = f[p] - a.reference[p], S = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l)), C = S ? S[y] : 0;
2920
+ }, p = Ia(i), m = Pa(p), h = await o.getDimensions(l), g = p === "y", _ = g ? "top" : "left", v = g ? "bottom" : "right", y = g ? "clientHeight" : "clientWidth", b = a.reference[m] + a.reference[p] - f[p] - a.floating[m], x = f[p] - a.reference[p], S = await (o.getOffsetParent == null ? void 0 : o.getOffsetParent(l)), C = S ? S[y] : 0;
2906
2921
  (!C || !await (o.isElement == null ? void 0 : o.isElement(S))) && (C = s.floating[y] || a.floating[m]);
2907
- let w = b / 2 - x / 2, T = C / 2 - h[m] / 2 - 1, E = ha(d[_], T), D = ha(d[v], T), O = E, k = C - h[m] - D, A = C / 2 - h[m] / 2 + w, j = ba(O, A, k), M = !c.arrow && Ca(i) != null && A !== j && a.reference[m] / 2 - (A < O ? E : D) - h[m] / 2 < 0, N = M ? A < O ? A - O : A - k : 0;
2922
+ let w = b / 2 - x / 2, T = C / 2 - h[m] / 2 - 1, E = wa(d[_], T), D = wa(d[v], T), O = E, k = C - h[m] - D, A = C / 2 - h[m] / 2 + w, j = ka(O, A, k), M = !c.arrow && Ma(i) != null && A !== j && a.reference[m] / 2 - (A < O ? E : D) - h[m] / 2 < 0, N = M ? A < O ? A - O : A - k : 0;
2908
2923
  return {
2909
2924
  [p]: f[p] + N,
2910
2925
  data: {
@@ -2916,20 +2931,20 @@ var Ba = (e) => ({
2916
2931
  };
2917
2932
  }
2918
2933
  });
2919
- function Va(e, t, n) {
2920
- return (e ? [...n.filter((t) => Ca(t) === e), ...n.filter((t) => Ca(t) !== e)] : n.filter((e) => Sa(e) === e)).filter((n) => e ? Ca(n) === e || (t ? Aa(n) !== n : !1) : !0);
2934
+ function Xa(e, t, n) {
2935
+ return (e ? [...n.filter((t) => Ma(t) === e), ...n.filter((t) => Ma(t) !== e)] : n.filter((e) => ja(e) === e)).filter((n) => e ? Ma(n) === e || (t ? za(n) !== n : !1) : !0);
2921
2936
  }
2922
- var Ha = function(e) {
2937
+ var Za = function(e) {
2923
2938
  return e === void 0 && (e = {}), {
2924
2939
  name: "autoPlacement",
2925
2940
  options: e,
2926
2941
  async fn(t) {
2927
- let { rects: n, middlewareData: r, placement: i, platform: a, elements: o } = t, { crossAxis: s = !1, alignment: c, allowedPlacements: l = ma, autoAlignment: u = !0, ...d } = xa(e, t), f = c !== void 0 || l === ma ? Va(c || null, u, l) : l, p = await za(t, d), m = r.autoPlacement?.index || 0, h = f[m];
2942
+ let { rects: n, middlewareData: r, placement: i, platform: a, elements: o } = t, { crossAxis: s = !1, alignment: c, allowedPlacements: l = Ca, autoAlignment: u = !0, ...d } = Aa(e, t), f = c !== void 0 || l === Ca ? Xa(c || null, u, l) : l, p = await Ja(t, d), m = r.autoPlacement?.index || 0, h = f[m];
2928
2943
  if (h == null) return {};
2929
- let g = Oa(h, n, await (a.isRTL == null ? void 0 : a.isRTL(o.floating)));
2944
+ let g = La(h, n, await (a.isRTL == null ? void 0 : a.isRTL(o.floating)));
2930
2945
  if (i !== h) return { reset: { placement: f[0] } };
2931
2946
  let _ = [
2932
- p[Sa(h)],
2947
+ p[ja(h)],
2933
2948
  p[g[0]],
2934
2949
  p[g[1]]
2935
2950
  ], v = [...r.autoPlacement?.overflows || [], {
@@ -2944,13 +2959,13 @@ var Ha = function(e) {
2944
2959
  reset: { placement: y }
2945
2960
  };
2946
2961
  let b = v.map((e) => {
2947
- let t = Ca(e.placement);
2962
+ let t = Ma(e.placement);
2948
2963
  return [
2949
2964
  e.placement,
2950
2965
  t && s ? e.overflows.slice(0, 2).reduce((e, t) => e + t, 0) : e.overflows[0],
2951
2966
  e.overflows
2952
2967
  ];
2953
- }).sort((e, t) => e[1] - t[1]), x = b.filter((e) => e[2].slice(0, Ca(e[0]) ? 2 : 3).every((e) => e <= 0))[0]?.[0] || b[0][0];
2968
+ }).sort((e, t) => e[1] - t[1]), x = b.filter((e) => e[2].slice(0, Ma(e[0]) ? 2 : 3).every((e) => e <= 0))[0]?.[0] || b[0][0];
2954
2969
  return x === i ? {} : {
2955
2970
  data: {
2956
2971
  index: m + 1,
@@ -2960,19 +2975,19 @@ var Ha = function(e) {
2960
2975
  };
2961
2976
  }
2962
2977
  };
2963
- }, Ua = function(e) {
2978
+ }, Qa = function(e) {
2964
2979
  return e === void 0 && (e = {}), {
2965
2980
  name: "flip",
2966
2981
  options: e,
2967
2982
  async fn(t) {
2968
2983
  var n;
2969
- let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } = xa(e, t);
2984
+ let { placement: r, middlewareData: i, rects: a, initialPlacement: o, platform: s, elements: c } = t, { mainAxis: l = !0, crossAxis: u = !0, fallbackPlacements: d, fallbackStrategy: f = "bestFit", fallbackAxisSideDirection: p = "none", flipAlignment: m = !0, ...h } = Aa(e, t);
2970
2985
  if ((n = i.arrow) != null && n.alignmentOffset) return {};
2971
- let g = Sa(r), _ = Ea(o), v = Sa(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [Na(o)] : ka(o)), x = p !== "none";
2972
- !d && x && b.push(...Ma(o, m, p, y));
2973
- let S = [o, ...b], C = await za(t, h), w = [], T = i.flip?.overflows || [];
2986
+ let g = ja(r), _ = Fa(o), v = ja(o) === o, y = await (s.isRTL == null ? void 0 : s.isRTL(c.floating)), b = d || (v || !m ? [Ha(o)] : Ra(o)), x = p !== "none";
2987
+ !d && x && b.push(...Va(o, m, p, y));
2988
+ let S = [o, ...b], C = await Ja(t, h), w = [], T = i.flip?.overflows || [];
2974
2989
  if (l && w.push(C[g]), u) {
2975
- let e = Oa(r, a, y);
2990
+ let e = La(r, a, y);
2976
2991
  w.push(C[e[0]], C[e[1]]);
2977
2992
  }
2978
2993
  if (T = [...T, {
@@ -2992,7 +3007,7 @@ var Ha = function(e) {
2992
3007
  case "bestFit": {
2993
3008
  let e = T.filter((e) => {
2994
3009
  if (x) {
2995
- let t = Ea(e.placement);
3010
+ let t = Fa(e.placement);
2996
3011
  return t === _ || t === "y";
2997
3012
  }
2998
3013
  return !0;
@@ -3010,7 +3025,7 @@ var Ha = function(e) {
3010
3025
  }
3011
3026
  };
3012
3027
  };
3013
- function Wa(e, t) {
3028
+ function $a(e, t) {
3014
3029
  return {
3015
3030
  top: e.top - t.height,
3016
3031
  right: e.right - t.width,
@@ -3018,34 +3033,34 @@ function Wa(e, t) {
3018
3033
  left: e.left - t.width
3019
3034
  };
3020
3035
  }
3021
- function Ga(e) {
3022
- return fa.some((t) => e[t] >= 0);
3036
+ function eo(e) {
3037
+ return xa.some((t) => e[t] >= 0);
3023
3038
  }
3024
- var Ka = function(e) {
3039
+ var to = function(e) {
3025
3040
  return e === void 0 && (e = {}), {
3026
3041
  name: "hide",
3027
3042
  options: e,
3028
3043
  async fn(t) {
3029
- let { rects: n } = t, { strategy: r = "referenceHidden", ...i } = xa(e, t);
3044
+ let { rects: n } = t, { strategy: r = "referenceHidden", ...i } = Aa(e, t);
3030
3045
  switch (r) {
3031
3046
  case "referenceHidden": {
3032
- let e = Wa(await za(t, {
3047
+ let e = $a(await Ja(t, {
3033
3048
  ...i,
3034
3049
  elementContext: "reference"
3035
3050
  }), n.reference);
3036
3051
  return { data: {
3037
3052
  referenceHiddenOffsets: e,
3038
- referenceHidden: Ga(e)
3053
+ referenceHidden: eo(e)
3039
3054
  } };
3040
3055
  }
3041
3056
  case "escaped": {
3042
- let e = Wa(await za(t, {
3057
+ let e = $a(await Ja(t, {
3043
3058
  ...i,
3044
3059
  altBoundary: !0
3045
3060
  }), n.floating);
3046
3061
  return { data: {
3047
3062
  escapedOffsets: e,
3048
- escaped: Ga(e)
3063
+ escaped: eo(e)
3049
3064
  } };
3050
3065
  }
3051
3066
  default: return {};
@@ -3053,8 +3068,8 @@ var Ka = function(e) {
3053
3068
  }
3054
3069
  };
3055
3070
  };
3056
- function qa(e) {
3057
- let t = ha(...e.map((e) => e.left)), n = ha(...e.map((e) => e.top)), r = X(...e.map((e) => e.right)), i = X(...e.map((e) => e.bottom));
3071
+ function no(e) {
3072
+ let t = wa(...e.map((e) => e.left)), n = wa(...e.map((e) => e.top)), r = Z(...e.map((e) => e.right)), i = Z(...e.map((e) => e.bottom));
3058
3073
  return {
3059
3074
  x: t,
3060
3075
  y: n,
@@ -3062,25 +3077,25 @@ function qa(e) {
3062
3077
  height: i - n
3063
3078
  };
3064
3079
  }
3065
- function Ja(e) {
3080
+ function ro(e) {
3066
3081
  let t = e.slice().sort((e, t) => e.y - t.y), n = [], r = null;
3067
3082
  for (let e = 0; e < t.length; e++) {
3068
3083
  let i = t[e];
3069
3084
  !r || i.y - r.y > r.height / 2 ? n.push([i]) : n[n.length - 1].push(i), r = i;
3070
3085
  }
3071
- return n.map((e) => Ia(qa(e)));
3086
+ return n.map((e) => Ga(no(e)));
3072
3087
  }
3073
- var Ya = function(e) {
3088
+ var io = function(e) {
3074
3089
  return e === void 0 && (e = {}), {
3075
3090
  name: "inline",
3076
3091
  options: e,
3077
3092
  async fn(t) {
3078
- let { placement: n, elements: r, rects: i, platform: a, strategy: o } = t, { padding: s = 2, x: c, y: l } = xa(e, t), u = Array.from(await (a.getClientRects == null ? void 0 : a.getClientRects(r.reference)) || []), d = Ja(u), f = Ia(qa(u)), p = Fa(s);
3093
+ let { placement: n, elements: r, rects: i, platform: a, strategy: o } = t, { padding: s = 2, x: c, y: l } = Aa(e, t), u = Array.from(await (a.getClientRects == null ? void 0 : a.getClientRects(r.reference)) || []), d = ro(u), f = Ga(no(u)), p = Wa(s);
3079
3094
  function m() {
3080
3095
  if (d.length === 2 && d[0].left > d[1].right && c != null && l != null) return d.find((e) => c > e.left - p.left && c < e.right + p.right && l > e.top - p.top && l < e.bottom + p.bottom) || f;
3081
3096
  if (d.length >= 2) {
3082
- if (Ea(n) === "y") {
3083
- let e = d[0], t = d[d.length - 1], r = Sa(n) === "top", i = e.top, a = t.bottom, o = r ? e.left : t.left, s = r ? e.right : t.right;
3097
+ if (Fa(n) === "y") {
3098
+ let e = d[0], t = d[d.length - 1], r = ja(n) === "top", i = e.top, a = t.bottom, o = r ? e.left : t.left, s = r ? e.right : t.right;
3084
3099
  return {
3085
3100
  top: i,
3086
3101
  bottom: a,
@@ -3092,7 +3107,7 @@ var Ya = function(e) {
3092
3107
  y: i
3093
3108
  };
3094
3109
  }
3095
- let e = Sa(n) === "left", t = X(...d.map((e) => e.right)), r = ha(...d.map((e) => e.left)), i = d.filter((n) => e ? n.left === r : n.right === t), a = i[0].top, o = i[i.length - 1].bottom, s = r, c = t;
3110
+ let e = ja(n) === "left", t = Z(...d.map((e) => e.right)), r = wa(...d.map((e) => e.left)), i = d.filter((n) => e ? n.left === r : n.right === t), a = i[0].top, o = i[i.length - 1].bottom, s = r, c = t;
3096
3111
  return {
3097
3112
  top: a,
3098
3113
  bottom: o,
@@ -3115,8 +3130,8 @@ var Ya = function(e) {
3115
3130
  }
3116
3131
  };
3117
3132
  };
3118
- async function Xa(e, t) {
3119
- let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = Sa(n), s = Ca(n), c = Ea(n) === "y", l = ["left", "top"].includes(o) ? -1 : 1, u = a && c ? -1 : 1, d = xa(t, e), { mainAxis: f, crossAxis: p, alignmentAxis: m } = typeof d == "number" ? {
3133
+ async function ao(e, t) {
3134
+ let { placement: n, platform: r, elements: i } = e, a = await (r.isRTL == null ? void 0 : r.isRTL(i.floating)), o = ja(n), s = Ma(n), c = Fa(n) === "y", l = ["left", "top"].includes(o) ? -1 : 1, u = a && c ? -1 : 1, d = Aa(t, e), { mainAxis: f, crossAxis: p, alignmentAxis: m } = typeof d == "number" ? {
3120
3135
  mainAxis: d,
3121
3136
  crossAxis: 0,
3122
3137
  alignmentAxis: null
@@ -3133,13 +3148,13 @@ async function Xa(e, t) {
3133
3148
  y: p * u
3134
3149
  };
3135
3150
  }
3136
- var Za = function(e) {
3151
+ var oo = function(e) {
3137
3152
  return e === void 0 && (e = 0), {
3138
3153
  name: "offset",
3139
3154
  options: e,
3140
3155
  async fn(t) {
3141
3156
  var n;
3142
- let { x: r, y: i, placement: a, middlewareData: o } = t, s = await Xa(t, e);
3157
+ let { x: r, y: i, placement: a, middlewareData: o } = t, s = await ao(t, e);
3143
3158
  return a === o.offset?.placement && (n = o.arrow) != null && n.alignmentOffset ? {} : {
3144
3159
  x: r + s.x,
3145
3160
  y: i + s.y,
@@ -3150,7 +3165,7 @@ var Za = function(e) {
3150
3165
  };
3151
3166
  }
3152
3167
  };
3153
- }, Qa = function(e) {
3168
+ }, so = function(e) {
3154
3169
  return e === void 0 && (e = {}), {
3155
3170
  name: "shift",
3156
3171
  options: e,
@@ -3161,17 +3176,17 @@ var Za = function(e) {
3161
3176
  x: t,
3162
3177
  y: n
3163
3178
  };
3164
- } }, ...c } = xa(e, t), l = {
3179
+ } }, ...c } = Aa(e, t), l = {
3165
3180
  x: n,
3166
3181
  y: r
3167
- }, u = await za(t, c), d = Ea(Sa(i)), f = wa(d), p = l[f], m = l[d];
3182
+ }, u = await Ja(t, c), d = Fa(ja(i)), f = Na(d), p = l[f], m = l[d];
3168
3183
  if (a) {
3169
3184
  let e = f === "y" ? "top" : "left", t = f === "y" ? "bottom" : "right", n = p + u[e], r = p - u[t];
3170
- p = ba(n, p, r);
3185
+ p = ka(n, p, r);
3171
3186
  }
3172
3187
  if (o) {
3173
3188
  let e = d === "y" ? "top" : "left", t = d === "y" ? "bottom" : "right", n = m + u[e], r = m - u[t];
3174
- m = ba(n, m, r);
3189
+ m = ka(n, m, r);
3175
3190
  }
3176
3191
  let h = s.fn({
3177
3192
  ...t,
@@ -3191,18 +3206,18 @@ var Za = function(e) {
3191
3206
  };
3192
3207
  }
3193
3208
  };
3194
- }, $a = function(e) {
3209
+ }, co = function(e) {
3195
3210
  return e === void 0 && (e = {}), {
3196
3211
  name: "size",
3197
3212
  options: e,
3198
3213
  async fn(t) {
3199
3214
  var n, r;
3200
- let { placement: i, rects: a, platform: o, elements: s } = t, { apply: c = () => {}, ...l } = xa(e, t), u = await za(t, l), d = Sa(i), f = Ca(i), p = Ea(i) === "y", { width: m, height: h } = a.floating, g, _;
3215
+ let { placement: i, rects: a, platform: o, elements: s } = t, { apply: c = () => {}, ...l } = Aa(e, t), u = await Ja(t, l), d = ja(i), f = Ma(i), p = Fa(i) === "y", { width: m, height: h } = a.floating, g, _;
3201
3216
  d === "top" || d === "bottom" ? (g = d, _ = f === (await (o.isRTL == null ? void 0 : o.isRTL(s.floating)) ? "start" : "end") ? "left" : "right") : (_ = d, g = f === "end" ? "top" : "bottom");
3202
- let v = h - u.top - u.bottom, y = m - u.left - u.right, b = ha(h - u[g], v), x = ha(m - u[_], y), S = !t.middlewareData.shift, C = b, w = x;
3217
+ let v = h - u.top - u.bottom, y = m - u.left - u.right, b = wa(h - u[g], v), x = wa(m - u[_], y), S = !t.middlewareData.shift, C = b, w = x;
3203
3218
  if ((n = t.middlewareData.shift) != null && n.enabled.x && (w = y), (r = t.middlewareData.shift) != null && r.enabled.y && (C = v), S && !f) {
3204
- let e = X(u.left, 0), t = X(u.right, 0), n = X(u.top, 0), r = X(u.bottom, 0);
3205
- p ? w = m - 2 * (e !== 0 || t !== 0 ? e + t : X(u.left, u.right)) : C = h - 2 * (n !== 0 || r !== 0 ? n + r : X(u.top, u.bottom));
3219
+ let e = Z(u.left, 0), t = Z(u.right, 0), n = Z(u.top, 0), r = Z(u.bottom, 0);
3220
+ p ? w = m - 2 * (e !== 0 || t !== 0 ? e + t : Z(u.left, u.right)) : C = h - 2 * (n !== 0 || r !== 0 ? n + r : Z(u.top, u.bottom));
3206
3221
  }
3207
3222
  await c({
3208
3223
  ...t,
@@ -3214,43 +3229,43 @@ var Za = function(e) {
3214
3229
  }
3215
3230
  };
3216
3231
  };
3217
- function eo() {
3232
+ function lo() {
3218
3233
  return typeof window < "u";
3219
3234
  }
3220
- function to(e) {
3221
- return ro(e) ? (e.nodeName || "").toLowerCase() : "#document";
3235
+ function uo(e) {
3236
+ return mo(e) ? (e.nodeName || "").toLowerCase() : "#document";
3222
3237
  }
3223
- function Z(e) {
3238
+ function fo(e) {
3224
3239
  var t;
3225
3240
  return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window;
3226
3241
  }
3227
- function no(e) {
3228
- return ((ro(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
3242
+ function po(e) {
3243
+ return ((mo(e) ? e.ownerDocument : e.document) || window.document)?.documentElement;
3229
3244
  }
3230
- function ro(e) {
3231
- return eo() ? e instanceof Node || e instanceof Z(e).Node : !1;
3245
+ function mo(e) {
3246
+ return lo() ? e instanceof Node || e instanceof fo(e).Node : !1;
3232
3247
  }
3233
- function io(e) {
3234
- return eo() ? e instanceof Element || e instanceof Z(e).Element : !1;
3248
+ function ho(e) {
3249
+ return lo() ? e instanceof Element || e instanceof fo(e).Element : !1;
3235
3250
  }
3236
- function ao(e) {
3237
- return eo() ? e instanceof HTMLElement || e instanceof Z(e).HTMLElement : !1;
3251
+ function go(e) {
3252
+ return lo() ? e instanceof HTMLElement || e instanceof fo(e).HTMLElement : !1;
3238
3253
  }
3239
- function oo(e) {
3240
- return !eo() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof Z(e).ShadowRoot;
3254
+ function _o(e) {
3255
+ return !lo() || typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof fo(e).ShadowRoot;
3241
3256
  }
3242
- function so(e) {
3243
- let { overflow: t, overflowX: n, overflowY: r, display: i } = ho(e);
3257
+ function vo(e) {
3258
+ let { overflow: t, overflowX: n, overflowY: r, display: i } = To(e);
3244
3259
  return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(i);
3245
3260
  }
3246
- function co(e) {
3261
+ function yo(e) {
3247
3262
  return [
3248
3263
  "table",
3249
3264
  "td",
3250
3265
  "th"
3251
- ].includes(to(e));
3266
+ ].includes(uo(e));
3252
3267
  }
3253
- function lo(e) {
3268
+ function bo(e) {
3254
3269
  return [":popover-open", ":modal"].some((t) => {
3255
3270
  try {
3256
3271
  return e.matches(t);
@@ -3259,8 +3274,8 @@ function lo(e) {
3259
3274
  }
3260
3275
  });
3261
3276
  }
3262
- function uo(e) {
3263
- let t = po(), n = io(e) ? ho(e) : e;
3277
+ function xo(e) {
3278
+ let t = Co(), n = ho(e) ? To(e) : e;
3264
3279
  return [
3265
3280
  "transform",
3266
3281
  "translate",
@@ -3281,30 +3296,30 @@ function uo(e) {
3281
3296
  "content"
3282
3297
  ].some((e) => (n.contain || "").includes(e));
3283
3298
  }
3284
- function fo(e) {
3285
- let t = _o(e);
3286
- for (; ao(t) && !mo(t);) {
3287
- if (uo(t)) return t;
3288
- if (lo(t)) return null;
3289
- t = _o(t);
3299
+ function So(e) {
3300
+ let t = Do(e);
3301
+ for (; go(t) && !wo(t);) {
3302
+ if (xo(t)) return t;
3303
+ if (bo(t)) return null;
3304
+ t = Do(t);
3290
3305
  }
3291
3306
  return null;
3292
3307
  }
3293
- function po() {
3308
+ function Co() {
3294
3309
  return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none");
3295
3310
  }
3296
- function mo(e) {
3311
+ function wo(e) {
3297
3312
  return [
3298
3313
  "html",
3299
3314
  "body",
3300
3315
  "#document"
3301
- ].includes(to(e));
3316
+ ].includes(uo(e));
3302
3317
  }
3303
- function ho(e) {
3304
- return Z(e).getComputedStyle(e);
3318
+ function To(e) {
3319
+ return fo(e).getComputedStyle(e);
3305
3320
  }
3306
- function go(e) {
3307
- return io(e) ? {
3321
+ function Eo(e) {
3322
+ return ho(e) ? {
3308
3323
  scrollLeft: e.scrollLeft,
3309
3324
  scrollTop: e.scrollTop
3310
3325
  } : {
@@ -3312,101 +3327,101 @@ function go(e) {
3312
3327
  scrollTop: e.scrollY
3313
3328
  };
3314
3329
  }
3315
- function _o(e) {
3316
- if (to(e) === "html") return e;
3317
- let t = e.assignedSlot || e.parentNode || oo(e) && e.host || no(e);
3318
- return oo(t) ? t.host : t;
3330
+ function Do(e) {
3331
+ if (uo(e) === "html") return e;
3332
+ let t = e.assignedSlot || e.parentNode || _o(e) && e.host || po(e);
3333
+ return _o(t) ? t.host : t;
3319
3334
  }
3320
- function vo(e) {
3321
- let t = _o(e);
3322
- return mo(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : ao(t) && so(t) ? t : vo(t);
3335
+ function Oo(e) {
3336
+ let t = Do(e);
3337
+ return wo(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : go(t) && vo(t) ? t : Oo(t);
3323
3338
  }
3324
- function yo(e, t, n) {
3339
+ function ko(e, t, n) {
3325
3340
  t === void 0 && (t = []), n === void 0 && (n = !0);
3326
- let r = vo(e), i = r === e.ownerDocument?.body, a = Z(r);
3341
+ let r = Oo(e), i = r === e.ownerDocument?.body, a = fo(r);
3327
3342
  if (i) {
3328
- let e = bo(a);
3329
- return t.concat(a, a.visualViewport || [], so(r) ? r : [], e && n ? yo(e) : []);
3343
+ let e = Ao(a);
3344
+ return t.concat(a, a.visualViewport || [], vo(r) ? r : [], e && n ? ko(e) : []);
3330
3345
  }
3331
- return t.concat(r, yo(r, [], n));
3346
+ return t.concat(r, ko(r, [], n));
3332
3347
  }
3333
- function bo(e) {
3348
+ function Ao(e) {
3334
3349
  return e.parent && Object.getPrototypeOf(e.parent) ? e.frameElement : null;
3335
3350
  }
3336
- function xo(e) {
3337
- let t = ho(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = ao(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = ga(n) !== a || ga(r) !== o;
3351
+ function jo(e) {
3352
+ let t = To(e), n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0, i = go(e), a = i ? e.offsetWidth : n, o = i ? e.offsetHeight : r, s = Ta(n) !== a || Ta(r) !== o;
3338
3353
  return s && (n = a, r = o), {
3339
3354
  width: n,
3340
3355
  height: r,
3341
3356
  $: s
3342
3357
  };
3343
3358
  }
3344
- function So(e) {
3345
- return io(e) ? e : e.contextElement;
3359
+ function Mo(e) {
3360
+ return ho(e) ? e : e.contextElement;
3346
3361
  }
3347
- function Co(e) {
3348
- let t = So(e);
3349
- if (!ao(t)) return _a(1);
3350
- let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = xo(t), o = (a ? ga(n.width) : n.width) / r, s = (a ? ga(n.height) : n.height) / i;
3362
+ function No(e) {
3363
+ let t = Mo(e);
3364
+ if (!go(t)) return Ea(1);
3365
+ let n = t.getBoundingClientRect(), { width: r, height: i, $: a } = jo(t), o = (a ? Ta(n.width) : n.width) / r, s = (a ? Ta(n.height) : n.height) / i;
3351
3366
  return (!o || !Number.isFinite(o)) && (o = 1), (!s || !Number.isFinite(s)) && (s = 1), {
3352
3367
  x: o,
3353
3368
  y: s
3354
3369
  };
3355
3370
  }
3356
- var wo = /* @__PURE__ */ _a(0);
3357
- function To(e) {
3358
- let t = Z(e);
3359
- return !po() || !t.visualViewport ? wo : {
3371
+ var Po = /* @__PURE__ */ Ea(0);
3372
+ function Fo(e) {
3373
+ let t = fo(e);
3374
+ return !Co() || !t.visualViewport ? Po : {
3360
3375
  x: t.visualViewport.offsetLeft,
3361
3376
  y: t.visualViewport.offsetTop
3362
3377
  };
3363
3378
  }
3364
- function Eo(e, t, n) {
3365
- return t === void 0 && (t = !1), !n || t && n !== Z(e) ? !1 : t;
3379
+ function Io(e, t, n) {
3380
+ return t === void 0 && (t = !1), !n || t && n !== fo(e) ? !1 : t;
3366
3381
  }
3367
- function Do(e, t, n, r) {
3382
+ function Lo(e, t, n, r) {
3368
3383
  t === void 0 && (t = !1), n === void 0 && (n = !1);
3369
- let i = e.getBoundingClientRect(), a = So(e), o = _a(1);
3370
- t && (r ? io(r) && (o = Co(r)) : o = Co(e));
3371
- let s = Eo(a, n, r) ? To(a) : _a(0), c = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, u = i.width / o.x, d = i.height / o.y;
3384
+ let i = e.getBoundingClientRect(), a = Mo(e), o = Ea(1);
3385
+ t && (r ? ho(r) && (o = No(r)) : o = No(e));
3386
+ let s = Io(a, n, r) ? Fo(a) : Ea(0), c = (i.left + s.x) / o.x, l = (i.top + s.y) / o.y, u = i.width / o.x, d = i.height / o.y;
3372
3387
  if (a) {
3373
- let e = Z(a), t = r && io(r) ? Z(r) : r, n = e, i = bo(n);
3388
+ let e = fo(a), t = r && ho(r) ? fo(r) : r, n = e, i = Ao(n);
3374
3389
  for (; i && r && t !== n;) {
3375
- let e = Co(i), t = i.getBoundingClientRect(), r = ho(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
3376
- c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = Z(i), i = bo(n);
3390
+ let e = No(i), t = i.getBoundingClientRect(), r = To(i), a = t.left + (i.clientLeft + parseFloat(r.paddingLeft)) * e.x, o = t.top + (i.clientTop + parseFloat(r.paddingTop)) * e.y;
3391
+ c *= e.x, l *= e.y, u *= e.x, d *= e.y, c += a, l += o, n = fo(i), i = Ao(n);
3377
3392
  }
3378
3393
  }
3379
- return Ia({
3394
+ return Ga({
3380
3395
  width: u,
3381
3396
  height: d,
3382
3397
  x: c,
3383
3398
  y: l
3384
3399
  });
3385
3400
  }
3386
- function Oo(e, t) {
3387
- let n = go(e).scrollLeft;
3388
- return t ? t.left + n : Do(no(e)).left + n;
3401
+ function Ro(e, t) {
3402
+ let n = Eo(e).scrollLeft;
3403
+ return t ? t.left + n : Lo(po(e)).left + n;
3389
3404
  }
3390
- function ko(e, t, n) {
3405
+ function zo(e, t, n) {
3391
3406
  n === void 0 && (n = !1);
3392
3407
  let r = e.getBoundingClientRect();
3393
3408
  return {
3394
- x: r.left + t.scrollLeft - (n ? 0 : Oo(e, r)),
3409
+ x: r.left + t.scrollLeft - (n ? 0 : Ro(e, r)),
3395
3410
  y: r.top + t.scrollTop
3396
3411
  };
3397
3412
  }
3398
- function Ao(e) {
3399
- let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = no(r), s = t ? lo(t.floating) : !1;
3413
+ function Bo(e) {
3414
+ let { elements: t, rect: n, offsetParent: r, strategy: i } = e, a = i === "fixed", o = po(r), s = t ? bo(t.floating) : !1;
3400
3415
  if (r === o || s && a) return n;
3401
3416
  let c = {
3402
3417
  scrollLeft: 0,
3403
3418
  scrollTop: 0
3404
- }, l = _a(1), u = _a(0), d = ao(r);
3405
- if ((d || !d && !a) && ((to(r) !== "body" || so(o)) && (c = go(r)), ao(r))) {
3406
- let e = Do(r);
3407
- l = Co(r), u.x = e.x + r.clientLeft, u.y = e.y + r.clientTop;
3419
+ }, l = Ea(1), u = Ea(0), d = go(r);
3420
+ if ((d || !d && !a) && ((uo(r) !== "body" || vo(o)) && (c = Eo(r)), go(r))) {
3421
+ let e = Lo(r);
3422
+ l = No(r), u.x = e.x + r.clientLeft, u.y = e.y + r.clientTop;
3408
3423
  }
3409
- let f = o && !d && !a ? ko(o, c, !0) : _a(0);
3424
+ let f = o && !d && !a ? zo(o, c, !0) : Ea(0);
3410
3425
  return {
3411
3426
  width: n.width * l.x,
3412
3427
  height: n.height * l.y,
@@ -3414,23 +3429,23 @@ function Ao(e) {
3414
3429
  y: n.y * l.y - c.scrollTop * l.y + u.y + f.y
3415
3430
  };
3416
3431
  }
3417
- function jo(e) {
3432
+ function Vo(e) {
3418
3433
  return Array.from(e.getClientRects());
3419
3434
  }
3420
- function Mo(e) {
3421
- let t = no(e), n = go(e), r = e.ownerDocument.body, i = X(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = X(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + Oo(e), s = -n.scrollTop;
3422
- return ho(r).direction === "rtl" && (o += X(t.clientWidth, r.clientWidth) - i), {
3435
+ function Ho(e) {
3436
+ let t = po(e), n = Eo(e), r = e.ownerDocument.body, i = Z(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), a = Z(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight), o = -n.scrollLeft + Ro(e), s = -n.scrollTop;
3437
+ return To(r).direction === "rtl" && (o += Z(t.clientWidth, r.clientWidth) - i), {
3423
3438
  width: i,
3424
3439
  height: a,
3425
3440
  x: o,
3426
3441
  y: s
3427
3442
  };
3428
3443
  }
3429
- function No(e, t) {
3430
- let n = Z(e), r = no(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
3444
+ function Uo(e, t) {
3445
+ let n = fo(e), r = po(e), i = n.visualViewport, a = r.clientWidth, o = r.clientHeight, s = 0, c = 0;
3431
3446
  if (i) {
3432
3447
  a = i.width, o = i.height;
3433
- let e = po();
3448
+ let e = Co();
3434
3449
  (!e || e && t === "fixed") && (s = i.offsetLeft, c = i.offsetTop);
3435
3450
  }
3436
3451
  return {
@@ -3440,8 +3455,8 @@ function No(e, t) {
3440
3455
  y: c
3441
3456
  };
3442
3457
  }
3443
- function Po(e, t) {
3444
- let n = Do(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = ao(e) ? Co(e) : _a(1);
3458
+ function Wo(e, t) {
3459
+ let n = Lo(e, !0, t === "fixed"), r = n.top + e.clientTop, i = n.left + e.clientLeft, a = go(e) ? No(e) : Ea(1);
3445
3460
  return {
3446
3461
  width: e.clientWidth * a.x,
3447
3462
  height: e.clientHeight * a.y,
@@ -3449,13 +3464,13 @@ function Po(e, t) {
3449
3464
  y: r * a.y
3450
3465
  };
3451
3466
  }
3452
- function Fo(e, t, n) {
3467
+ function Go(e, t, n) {
3453
3468
  let r;
3454
- if (t === "viewport") r = No(e, n);
3455
- else if (t === "document") r = Mo(no(e));
3456
- else if (io(t)) r = Po(t, n);
3469
+ if (t === "viewport") r = Uo(e, n);
3470
+ else if (t === "document") r = Ho(po(e));
3471
+ else if (ho(t)) r = Wo(t, n);
3457
3472
  else {
3458
- let n = To(e);
3473
+ let n = Fo(e);
3459
3474
  r = {
3460
3475
  x: t.x - n.x,
3461
3476
  y: t.y - n.y,
@@ -3463,27 +3478,27 @@ function Fo(e, t, n) {
3463
3478
  height: t.height
3464
3479
  };
3465
3480
  }
3466
- return Ia(r);
3481
+ return Ga(r);
3467
3482
  }
3468
- function Io(e, t) {
3469
- let n = _o(e);
3470
- return n === t || !io(n) || mo(n) ? !1 : ho(n).position === "fixed" || Io(n, t);
3483
+ function Ko(e, t) {
3484
+ let n = Do(e);
3485
+ return n === t || !ho(n) || wo(n) ? !1 : To(n).position === "fixed" || Ko(n, t);
3471
3486
  }
3472
- function Lo(e, t) {
3487
+ function qo(e, t) {
3473
3488
  let n = t.get(e);
3474
3489
  if (n) return n;
3475
- let r = yo(e, [], !1).filter((e) => io(e) && to(e) !== "body"), i = null, a = ho(e).position === "fixed", o = a ? _o(e) : e;
3476
- for (; io(o) && !mo(o);) {
3477
- let t = ho(o), n = uo(o);
3478
- !n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && ["absolute", "fixed"].includes(i.position) || so(o) && !n && Io(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = _o(o);
3490
+ let r = ko(e, [], !1).filter((e) => ho(e) && uo(e) !== "body"), i = null, a = To(e).position === "fixed", o = a ? Do(e) : e;
3491
+ for (; ho(o) && !wo(o);) {
3492
+ let t = To(o), n = xo(o);
3493
+ !n && t.position === "fixed" && (i = null), (a ? !n && !i : !n && t.position === "static" && i && ["absolute", "fixed"].includes(i.position) || vo(o) && !n && Ko(e, o)) ? r = r.filter((e) => e !== o) : i = t, o = Do(o);
3479
3494
  }
3480
3495
  return t.set(e, r), r;
3481
3496
  }
3482
- function Ro(e) {
3483
- let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? lo(t) ? [] : Lo(t, this._c) : [].concat(n), r], o = a[0], s = a.reduce((e, n) => {
3484
- let r = Fo(t, n, i);
3485
- return e.top = X(r.top, e.top), e.right = ha(r.right, e.right), e.bottom = ha(r.bottom, e.bottom), e.left = X(r.left, e.left), e;
3486
- }, Fo(t, o, i));
3497
+ function Jo(e) {
3498
+ let { element: t, boundary: n, rootBoundary: r, strategy: i } = e, a = [...n === "clippingAncestors" ? bo(t) ? [] : qo(t, this._c) : [].concat(n), r], o = a[0], s = a.reduce((e, n) => {
3499
+ let r = Go(t, n, i);
3500
+ return e.top = Z(r.top, e.top), e.right = wa(r.right, e.right), e.bottom = wa(r.bottom, e.bottom), e.left = Z(r.left, e.left), e;
3501
+ }, Go(t, o, i));
3487
3502
  return {
3488
3503
  width: s.right - s.left,
3489
3504
  height: s.bottom - s.top,
@@ -3491,23 +3506,23 @@ function Ro(e) {
3491
3506
  y: s.top
3492
3507
  };
3493
3508
  }
3494
- function zo(e) {
3495
- let { width: t, height: n } = xo(e);
3509
+ function Yo(e) {
3510
+ let { width: t, height: n } = jo(e);
3496
3511
  return {
3497
3512
  width: t,
3498
3513
  height: n
3499
3514
  };
3500
3515
  }
3501
- function Bo(e, t, n) {
3502
- let r = ao(t), i = no(t), a = n === "fixed", o = Do(e, !0, a, t), s = {
3516
+ function Xo(e, t, n) {
3517
+ let r = go(t), i = po(t), a = n === "fixed", o = Lo(e, !0, a, t), s = {
3503
3518
  scrollLeft: 0,
3504
3519
  scrollTop: 0
3505
- }, c = _a(0);
3506
- if (r || !r && !a) if ((to(t) !== "body" || so(i)) && (s = go(t)), r) {
3507
- let e = Do(t, !0, a, t);
3520
+ }, c = Ea(0);
3521
+ if (r || !r && !a) if ((uo(t) !== "body" || vo(i)) && (s = Eo(t)), r) {
3522
+ let e = Lo(t, !0, a, t);
3508
3523
  c.x = e.x + t.clientLeft, c.y = e.y + t.clientTop;
3509
- } else i && (c.x = Oo(i));
3510
- let l = i && !r && !a ? ko(i, s) : _a(0);
3524
+ } else i && (c.x = Ro(i));
3525
+ let l = i && !r && !a ? zo(i, s) : Ea(0);
3511
3526
  return {
3512
3527
  x: o.left + s.scrollLeft - c.x - l.x,
3513
3528
  y: o.top + s.scrollTop - c.y - l.y,
@@ -3515,34 +3530,34 @@ function Bo(e, t, n) {
3515
3530
  height: o.height
3516
3531
  };
3517
3532
  }
3518
- function Vo(e) {
3519
- return ho(e).position === "static";
3533
+ function Zo(e) {
3534
+ return To(e).position === "static";
3520
3535
  }
3521
- function Ho(e, t) {
3522
- if (!ao(e) || ho(e).position === "fixed") return null;
3536
+ function Qo(e, t) {
3537
+ if (!go(e) || To(e).position === "fixed") return null;
3523
3538
  if (t) return t(e);
3524
3539
  let n = e.offsetParent;
3525
- return no(e) === n && (n = n.ownerDocument.body), n;
3540
+ return po(e) === n && (n = n.ownerDocument.body), n;
3526
3541
  }
3527
- function Uo(e, t) {
3528
- let n = Z(e);
3529
- if (lo(e)) return n;
3530
- if (!ao(e)) {
3531
- let t = _o(e);
3532
- for (; t && !mo(t);) {
3533
- if (io(t) && !Vo(t)) return t;
3534
- t = _o(t);
3542
+ function $o(e, t) {
3543
+ let n = fo(e);
3544
+ if (bo(e)) return n;
3545
+ if (!go(e)) {
3546
+ let t = Do(e);
3547
+ for (; t && !wo(t);) {
3548
+ if (ho(t) && !Zo(t)) return t;
3549
+ t = Do(t);
3535
3550
  }
3536
3551
  return n;
3537
3552
  }
3538
- let r = Ho(e, t);
3539
- for (; r && co(r) && Vo(r);) r = Ho(r, t);
3540
- return r && mo(r) && Vo(r) && !uo(r) ? n : r || fo(e) || n;
3553
+ let r = Qo(e, t);
3554
+ for (; r && yo(r) && Zo(r);) r = Qo(r, t);
3555
+ return r && wo(r) && Zo(r) && !xo(r) ? n : r || So(e) || n;
3541
3556
  }
3542
- var Wo = async function(e) {
3543
- let t = this.getOffsetParent || Uo, n = this.getDimensions, r = await n(e.floating);
3557
+ var es = async function(e) {
3558
+ let t = this.getOffsetParent || $o, n = this.getDimensions, r = await n(e.floating);
3544
3559
  return {
3545
- reference: Bo(e.reference, await t(e.floating), e.strategy),
3560
+ reference: Xo(e.reference, await t(e.floating), e.strategy),
3546
3561
  floating: {
3547
3562
  x: 0,
3548
3563
  y: 0,
@@ -3551,38 +3566,38 @@ var Wo = async function(e) {
3551
3566
  }
3552
3567
  };
3553
3568
  };
3554
- function Go(e) {
3555
- return ho(e).direction === "rtl";
3569
+ function ts(e) {
3570
+ return To(e).direction === "rtl";
3556
3571
  }
3557
- var Ko = {
3558
- convertOffsetParentRelativeRectToViewportRelativeRect: Ao,
3559
- getDocumentElement: no,
3560
- getClippingRect: Ro,
3561
- getOffsetParent: Uo,
3562
- getElementRects: Wo,
3563
- getClientRects: jo,
3564
- getDimensions: zo,
3565
- getScale: Co,
3566
- isElement: io,
3567
- isRTL: Go
3568
- }, qo = Za, Jo = Ha, Yo = Qa, Xo = Ua, Zo = $a, Qo = Ka, $o = Ba, es = Ya, ts = (e, t, n) => {
3572
+ var ns = {
3573
+ convertOffsetParentRelativeRectToViewportRelativeRect: Bo,
3574
+ getDocumentElement: po,
3575
+ getClippingRect: Jo,
3576
+ getOffsetParent: $o,
3577
+ getElementRects: es,
3578
+ getClientRects: Vo,
3579
+ getDimensions: Yo,
3580
+ getScale: No,
3581
+ isElement: ho,
3582
+ isRTL: ts
3583
+ }, rs = oo, is = Za, as = so, os = Qa, ss = co, cs = to, ls = Ya, us = io, ds = (e, t, n) => {
3569
3584
  let r = /* @__PURE__ */ new Map(), i = {
3570
- platform: Ko,
3585
+ platform: ns,
3571
3586
  ...n
3572
3587
  }, a = {
3573
3588
  ...i.platform,
3574
3589
  _c: r
3575
3590
  };
3576
- return Ra(e, t, {
3591
+ return qa(e, t, {
3577
3592
  ...i,
3578
3593
  platform: a
3579
3594
  });
3580
3595
  };
3581
- function ns(e, t) {
3596
+ function fs(e, t) {
3582
3597
  let n = Math.min(e.top, t.top), r = Math.max(e.bottom, t.bottom), i = Math.min(e.left, t.left), a = Math.max(e.right, t.right) - i, o = r - n;
3583
3598
  return new DOMRect(i, n, a, o);
3584
3599
  }
3585
- var rs = class {
3600
+ var ps = class {
3586
3601
  constructor({ editor: e, element: t, view: n, pluginKey: r = "bubbleMenu", updateDelay: i = 250, resizeDelay: a = 60, shouldShow: o, appendTo: s, getReferencedVirtualElement: c, options: l }) {
3587
3602
  this.preventHide = !1, this.isVisible = !1, this.scrollTarget = window, this.floatingUIOptions = {
3588
3603
  strategy: "absolute",
@@ -3600,7 +3615,7 @@ var rs = class {
3600
3615
  onUpdate: void 0,
3601
3616
  onDestroy: void 0
3602
3617
  }, this.shouldShow = ({ view: e, state: t, from: n, to: r }) => {
3603
- let { doc: i, selection: a } = t, { empty: o } = a, s = !i.textBetween(n, r).length && re(t.selection), c = this.element.contains(document.activeElement);
3618
+ let { doc: i, selection: a } = t, { empty: o } = a, s = !i.textBetween(n, r).length && oe(t.selection), c = this.element.contains(document.activeElement);
3604
3619
  return !(!(e.hasFocus() || c) || o || s || !this.editor.isEditable);
3605
3620
  }, this.mousedownHandler = () => {
3606
3621
  this.preventHide = !0;
@@ -3646,27 +3661,27 @@ var rs = class {
3646
3661
  }
3647
3662
  get middlewares() {
3648
3663
  let e = [];
3649
- return this.floatingUIOptions.flip && e.push(Xo(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(Yo(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(qo(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push($o(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(Zo(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(Jo(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(Qo(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(es(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
3664
+ return this.floatingUIOptions.flip && e.push(os(typeof this.floatingUIOptions.flip == "boolean" ? void 0 : this.floatingUIOptions.flip)), this.floatingUIOptions.shift && e.push(as(typeof this.floatingUIOptions.shift == "boolean" ? void 0 : this.floatingUIOptions.shift)), this.floatingUIOptions.offset && e.push(rs(typeof this.floatingUIOptions.offset == "boolean" ? void 0 : this.floatingUIOptions.offset)), this.floatingUIOptions.arrow && e.push(ls(this.floatingUIOptions.arrow)), this.floatingUIOptions.size && e.push(ss(typeof this.floatingUIOptions.size == "boolean" ? void 0 : this.floatingUIOptions.size)), this.floatingUIOptions.autoPlacement && e.push(is(typeof this.floatingUIOptions.autoPlacement == "boolean" ? void 0 : this.floatingUIOptions.autoPlacement)), this.floatingUIOptions.hide && e.push(cs(typeof this.floatingUIOptions.hide == "boolean" ? void 0 : this.floatingUIOptions.hide)), this.floatingUIOptions.inline && e.push(us(typeof this.floatingUIOptions.inline == "boolean" ? void 0 : this.floatingUIOptions.inline)), e;
3650
3665
  }
3651
3666
  get virtualElement() {
3652
3667
  let { selection: e } = this.editor.state, t = this.getReferencedVirtualElement?.call(this);
3653
3668
  if (t) return t;
3654
3669
  if (!this.view?.dom?.parentNode) return;
3655
- let n = ie(this.view, e.from, e.to), r = {
3670
+ let n = V(this.view, e.from, e.to), r = {
3656
3671
  getBoundingClientRect: () => n,
3657
3672
  getClientRects: () => [n]
3658
3673
  };
3659
- if (e instanceof ae) {
3674
+ if (e instanceof se) {
3660
3675
  let t = this.view.nodeDOM(e.from), n = t.dataset.nodeViewWrapper ? t : t.querySelector("[data-node-view-wrapper]");
3661
3676
  n && (t = n), t && (r = {
3662
3677
  getBoundingClientRect: () => t.getBoundingClientRect(),
3663
3678
  getClientRects: () => [t.getBoundingClientRect()]
3664
3679
  });
3665
3680
  }
3666
- if (e instanceof ce) {
3681
+ if (e instanceof H) {
3667
3682
  let { $anchorCell: t, $headCell: n } = e, i = t ? t.pos : n.pos, a = n ? n.pos : t.pos, o = this.view.nodeDOM(i), s = this.view.nodeDOM(a);
3668
3683
  if (!o || !s) return;
3669
- let c = o === s ? o.getBoundingClientRect() : ns(o.getBoundingClientRect(), s.getBoundingClientRect());
3684
+ let c = o === s ? o.getBoundingClientRect() : fs(o.getBoundingClientRect(), s.getBoundingClientRect());
3670
3685
  r = {
3671
3686
  getBoundingClientRect: () => c,
3672
3687
  getClientRects: () => [c]
@@ -3677,7 +3692,7 @@ var rs = class {
3677
3692
  updatePosition() {
3678
3693
  if (!this.isVisible) return;
3679
3694
  let e = this.virtualElement;
3680
- e && ts(e, this.element, {
3695
+ e && ds(e, this.element, {
3681
3696
  placement: this.floatingUIOptions.placement,
3682
3697
  strategy: this.floatingUIOptions.strategy,
3683
3698
  middleware: this.middlewares
@@ -3731,13 +3746,13 @@ var rs = class {
3731
3746
  destroy() {
3732
3747
  this.hide(), this.element.removeEventListener("mousedown", this.mousedownHandler, { capture: !0 }), this.view.dom.removeEventListener("dragstart", this.dragstartHandler), window.removeEventListener("resize", this.resizeHandler), this.scrollTarget.removeEventListener("scroll", this.resizeHandler), this.editor.off("focus", this.focusHandler), this.editor.off("blur", this.blurHandler), this.editor.off("transaction", this.transactionHandler), this.floatingUIOptions.onDestroy && this.floatingUIOptions.onDestroy();
3733
3748
  }
3734
- }, is = (e) => new oe({
3735
- key: typeof e.pluginKey == "string" ? new se(e.pluginKey) : e.pluginKey,
3736
- view: (t) => new rs({
3749
+ }, ms = (e) => new ce({
3750
+ key: typeof e.pluginKey == "string" ? new le(e.pluginKey) : e.pluginKey,
3751
+ view: (t) => new ps({
3737
3752
  view: t,
3738
3753
  ...e
3739
3754
  })
3740
- }), as = {
3755
+ }), hs = {
3741
3756
  name: "BubbleMenu",
3742
3757
  inheritAttrs: !1,
3743
3758
  props: {
@@ -3767,7 +3782,7 @@ var rs = class {
3767
3782
  mounted() {
3768
3783
  let e = this.editor, t = this.$el;
3769
3784
  !e || !t || (t.style.visibility = "hidden", t.style.position = "absolute", t.remove(), this.$nextTick(() => {
3770
- e.registerPlugin(is({
3785
+ e.registerPlugin(ms({
3771
3786
  updateDelay: this.updateDelay,
3772
3787
  resizeDelay: this.resizeDelay,
3773
3788
  options: this.options,
@@ -3793,9 +3808,9 @@ var rs = class {
3793
3808
  this.editor.unregisterPlugin(this.getPluginKey());
3794
3809
  },
3795
3810
  methods: { getPluginKey() {
3796
- return this.generatedPluginKey ||= this.pluginKey ?? new se("bubbleMenu"), this.generatedPluginKey;
3811
+ return this.generatedPluginKey ||= this.pluginKey ?? new le("bubbleMenu"), this.generatedPluginKey;
3797
3812
  } }
3798
- }, os = {
3813
+ }, gs = {
3799
3814
  active: !1,
3800
3815
  mode: "outside",
3801
3816
  activeCellPos: null,
@@ -3803,17 +3818,17 @@ var rs = class {
3803
3818
  selectedCellCount: 0,
3804
3819
  selectionFrom: 0,
3805
3820
  selectionTo: 0
3806
- }, ss = {
3821
+ }, _s = {
3807
3822
  active: !1,
3808
- language: dt.defaultLanguage,
3823
+ language: xt.defaultLanguage,
3809
3824
  mermaidPreviewMode: "code",
3810
3825
  pos: null,
3811
3826
  text: ""
3812
3827
  };
3813
- function cs(e) {
3814
- return Mn.getState(e.state) ?? jn;
3828
+ function vs(e) {
3829
+ return Hn.getState(e.state) ?? Vn;
3815
3830
  }
3816
- function ls(e) {
3831
+ function ys(e) {
3817
3832
  if (!e || typeof window > "u") return null;
3818
3833
  let t = e.parentElement;
3819
3834
  for (; t;) {
@@ -3830,7 +3845,7 @@ function Q(e, t, n = 18, r = 1.8) {
3830
3845
  "aria-hidden": "true"
3831
3846
  }, { default: () => t });
3832
3847
  }
3833
- function us(e) {
3848
+ function bs(e) {
3834
3849
  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", {
3835
3850
  cx: "10",
3836
3851
  cy: "10",
@@ -3867,7 +3882,7 @@ function us(e) {
3867
3882
  U("path", { d: "m14 14 4 4" })
3868
3883
  ] : 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" })];
3869
3884
  }
3870
- function ds(e) {
3885
+ function xs(e) {
3871
3886
  return U("svg", {
3872
3887
  viewBox: "0 0 24 24",
3873
3888
  "aria-hidden": "true",
@@ -3878,65 +3893,66 @@ function ds(e) {
3878
3893
  "stroke-linecap": "round",
3879
3894
  "stroke-linejoin": "round",
3880
3895
  "stroke-width": "1.8"
3881
- }, us(e)));
3896
+ }, bs(e)));
3882
3897
  }
3883
3898
  function $(e) {
3884
3899
  e.preventDefault();
3885
3900
  }
3886
- function fs(e) {
3887
- let t = Ht(e);
3901
+ function Ss(e) {
3902
+ let t = Qt(e);
3888
3903
  return !t || typeof window > "u" || typeof window.open != "function" ? !1 : (window.open(t, "_blank", "noopener,noreferrer"), !0);
3889
3904
  }
3890
- var ps = {
3891
- bold: Wr,
3892
- italic: pi,
3893
- underline: Hi,
3894
- strike: Ni,
3895
- "inline-code": $r,
3896
- link: hi,
3897
- more: bi,
3898
- superscript: Fi,
3899
- subscript: Pi,
3900
- "inline-math": Oi,
3901
- "align-left": Or,
3902
- "align-center": Er,
3903
- "align-right": kr,
3904
- "align-justify": Dr,
3905
- "decrease-indent": ui,
3906
- "increase-indent": di
3907
- }, ms = {
3908
- type: zi,
3909
- "heading-1": ai,
3910
- "heading-2": oi,
3911
- "heading-3": si,
3912
- "bullet-list": gi,
3913
- "ordered-list": vi,
3914
- "task-list": _i,
3915
- blockquote: Ti,
3916
- "code-block": Gr,
3917
- info: fi,
3918
- tip: mi,
3919
- warning: Nr,
3920
- error: Qr,
3921
- success: Jr,
3922
- emoji: ki,
3923
- math: Oi,
3924
- table: Ii,
3925
- separator: yi,
3926
- image: ci,
3927
- video: Wi,
3928
- attachment: Si
3905
+ var Cs = {
3906
+ bold: $r,
3907
+ italic: Si,
3908
+ underline: Zi,
3909
+ strike: Hi,
3910
+ "inline-code": ci,
3911
+ link: wi,
3912
+ more: ki,
3913
+ superscript: Wi,
3914
+ subscript: Ui,
3915
+ "inline-math": Li,
3916
+ "align-left": Lr,
3917
+ "align-center": Fr,
3918
+ "align-right": Rr,
3919
+ "align-justify": Ir,
3920
+ "decrease-indent": yi,
3921
+ "increase-indent": bi
3922
+ }, ws = {
3923
+ type: Ji,
3924
+ "heading-1": mi,
3925
+ "heading-2": hi,
3926
+ "heading-3": gi,
3927
+ "bullet-list": Ti,
3928
+ "ordered-list": Di,
3929
+ "task-list": Ei,
3930
+ blockquote: Pi,
3931
+ "code-block": ei,
3932
+ details: ai,
3933
+ info: xi,
3934
+ tip: Ci,
3935
+ warning: Hr,
3936
+ error: si,
3937
+ success: ri,
3938
+ emoji: Ri,
3939
+ math: Li,
3940
+ table: Gi,
3941
+ separator: Oi,
3942
+ image: _i,
3943
+ video: $i,
3944
+ attachment: ji
3929
3945
  };
3930
- function hs(e) {
3946
+ function Ts(e) {
3931
3947
  if (typeof e != "string") {
3932
3948
  if (e.kind === "text") return U("span", {
3933
3949
  class: "markweave-slash-command-text-icon",
3934
- "data-icon-length": cn(e),
3950
+ "data-icon-length": vn(e),
3935
3951
  "aria-hidden": "true"
3936
3952
  }, e.text);
3937
3953
  e = e.name;
3938
3954
  }
3939
- let t = ms[e];
3955
+ let t = ws[e];
3940
3956
  return U(t, {
3941
3957
  size: 18,
3942
3958
  strokeWidth: 1.6,
@@ -3944,21 +3960,21 @@ function hs(e) {
3944
3960
  "aria-hidden": "true"
3945
3961
  });
3946
3962
  }
3947
- var gs = {
3948
- paragraph: Vi,
3949
- "heading-1": ai,
3950
- "heading-2": oi,
3951
- "heading-3": si,
3952
- "bullet-list": gi,
3953
- "numbered-list": vi,
3954
- "todo-list": _i,
3955
- quote: Ti,
3956
- "code-block": Gr
3963
+ var Es = {
3964
+ paragraph: Xi,
3965
+ "heading-1": mi,
3966
+ "heading-2": hi,
3967
+ "heading-3": gi,
3968
+ "bullet-list": Ti,
3969
+ "numbered-list": Di,
3970
+ "todo-list": Ei,
3971
+ quote: Pi,
3972
+ "code-block": ei
3957
3973
  };
3958
- function _s(e, t) {
3959
- return _e(e, t).label;
3974
+ function Ds(e, t) {
3975
+ return ye(e, t).label;
3960
3976
  }
3961
- var vs = J({
3977
+ var Os = Y({
3962
3978
  name: "MarkweaveVueFloatingToolbar",
3963
3979
  props: {
3964
3980
  editor: {
@@ -3983,32 +3999,32 @@ var vs = J({
3983
3999
  }
3984
4000
  },
3985
4001
  setup(e) {
3986
- let t = W(null), n = W("input"), r = W(""), i = W(""), a = W(""), o = W(""), s = xr(null), c = xr(null), l = W(null), u = W(null), d = "", f = G(() => 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 = G(() => Ht(p.value.trim())), x = G(() => e.messages.floatingToolbar), S = G(() => xe(e.messages).map((e) => [
4002
+ 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(() => Qt(p.value.trim())), x = K(() => e.messages.floatingToolbar), S = K(() => Ce(e.messages).map((e) => [
3987
4003
  e.id,
3988
4004
  e.label,
3989
- gs[e.id]
3990
- ])), C = G(() => be(e.messages).map((e) => [
4005
+ Es[e.id]
4006
+ ])), C = K(() => Se(e.messages).map((e) => [
3991
4007
  e.id,
3992
4008
  e.value,
3993
4009
  e.label
3994
- ])), w = G(() => ve(e.messages).map((e) => [
4010
+ ])), w = K(() => be(e.messages).map((e) => [
3995
4011
  e.id,
3996
4012
  e.value,
3997
4013
  e.label
3998
- ])), T = G(() => ye(e.messages).map((e) => e.id)), E = () => {
4014
+ ])), T = K(() => xe(e.messages).map((e) => e.id)), E = () => {
3999
4015
  b.value && (e.editor.chain().focus().extendMarkRange("link").setLink({ href: b.value }).run(), t.value = null);
4000
4016
  }, D = () => {
4001
4017
  e.editor.isActive("link") && e.editor.chain().focus().extendMarkRange("link").unsetLink().run(), p.value = "", t.value = null;
4002
4018
  }, O = (n) => {
4003
4019
  t.value = t.value === n ? null : n, n === "link" && (p.value = e.editor.getAttributes("link").href ?? "");
4004
- }, k = de(() => {
4005
- Je(e.editor, d), a.value = d;
4020
+ }, k = fe(() => {
4021
+ it(e.editor, d), a.value = d;
4006
4022
  }), A = (n = !0) => {
4007
- c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && Ke(e.editor), Re(e.editor), t.value = null, n && e.editor.commands.focus();
4023
+ c.value?.abort(), k.cancel(), d = "", c.value = null, l.value = null, n && nt(e.editor), Je(e.editor), t.value = null, n && e.editor.commands.focus(void 0, { scrollIntoView: !1 });
4008
4024
  }, j = () => {
4009
4025
  if (!f.value) return;
4010
- let r = Xe(e.editor);
4011
- r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", q(() => u.value?.focus()));
4026
+ let r = ot(e.editor);
4027
+ r && (s.value = r, n.value = "input", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus()));
4012
4028
  }, M = async (t) => {
4013
4029
  if (!f.value || e.askAi?.enabled !== !0 || !s.value) return;
4014
4030
  let u = (t ?? r.value).trim();
@@ -4016,40 +4032,40 @@ var vs = J({
4016
4032
  o.value = e.messages.askAi.emptyPrompt, n.value = "error";
4017
4033
  return;
4018
4034
  }
4019
- let p = Be(e.editor, s.value);
4035
+ let p = Xe(e.editor, s.value);
4020
4036
  if (!p) {
4021
4037
  n.value = "conflict";
4022
4038
  return;
4023
4039
  }
4024
- s.value = p, c.value?.abort(), Le(e.editor);
4025
- let m = new AbortController(), h = ze(p, u, e.lang, m.signal, void 0, He(e.editor)?.target);
4040
+ s.value = p, c.value?.abort(), qe(e.editor);
4041
+ let m = new AbortController(), h = Ye(p, u, e.lang, m.signal, void 0, Qe(e.editor)?.target);
4026
4042
  c.value = m, l.value = h.id, i.value = u, k.cancel(), d = "", a.value = "", o.value = "", n.value = "generating";
4027
4043
  try {
4028
- let t = await qe(e.askAi.handler, h, (e) => {
4044
+ let t = await rt(e.askAi.handler, h, (e) => {
4029
4045
  l.value === h.id && !m.signal.aborted && (d = e, k.schedule());
4030
4046
  });
4031
4047
  if (l.value !== h.id || m.signal.aborted) return;
4032
- if (k.cancel(), d = t, !Je(e.editor, t)) throw new Ne("invalid-output", "Ask AI output is incompatible with the selected content.");
4033
- a.value = t, r.value = "", n.value = He(e.editor)?.status === "target" ? "result" : "conflict";
4048
+ if (k.cancel(), d = t, !it(e.editor, t)) throw new Ue("invalid-output", "Ask AI output is incompatible with the selected content.");
4049
+ a.value = t, r.value = "", n.value = Qe(e.editor)?.status === "target" ? "result" : "conflict";
4034
4050
  } catch (t) {
4035
4051
  if (l.value !== h.id) return;
4036
4052
  if (k.cancel(), m.signal.aborted) {
4037
- Le(e.editor), n.value = He(e.editor)?.status === "conflict" ? "conflict" : "input";
4053
+ qe(e.editor), n.value = Qe(e.editor)?.status === "conflict" ? "conflict" : "input";
4038
4054
  return;
4039
4055
  }
4040
- Le(e.editor), o.value = t instanceof Ne ? 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";
4056
+ qe(e.editor), o.value = t instanceof Ue ? 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";
4041
4057
  }
4042
4058
  }, N = () => {
4043
- if (!Pe(e.editor, a.value)) {
4044
- n.value = He(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
4059
+ if (!We(e.editor, a.value)) {
4060
+ n.value = Qe(e.editor)?.status === "conflict" ? "conflict" : "error", o.value = e.messages.askAi.errorFallback;
4045
4061
  return;
4046
4062
  }
4047
- t.value = null, window.setTimeout(() => Re(e.editor), 560), e.editor.commands.focus();
4048
- }, P = de(() => {
4063
+ t.value = null, window.setTimeout(() => Je(e.editor), 560), e.editor.commands.focus(void 0, { scrollIntoView: !1 });
4064
+ }, P = fe(() => {
4049
4065
  let n = _.value, r = y.value, i = e.editor.view.dom.closest(".markweave-editor-frame");
4050
4066
  if (!t.value || !n || !r) return;
4051
4067
  if (t.value === "ask-ai") {
4052
- let t = Ue(e.editor), n = v.value?.getBoundingClientRect();
4068
+ let t = $e(e.editor), n = v.value?.getBoundingClientRect();
4053
4069
  if (!t || !n) return;
4054
4070
  let a = {
4055
4071
  anchorRect: n,
@@ -4059,18 +4075,18 @@ var vs = J({
4059
4075
  height: window.innerHeight
4060
4076
  },
4061
4077
  frameRect: i?.getBoundingClientRect() ?? null,
4062
- surfaceRect: Ve(e.editor.view.dom)
4063
- }, o = Fe({
4078
+ surfaceRect: Ze(e.editor.view.dom)
4079
+ }, o = Ge({
4064
4080
  ...a,
4065
4081
  panelSize: r.getBoundingClientRect()
4066
4082
  }), s = `${o.width}px`;
4067
- r.style.width !== s && (r.style.width = s, o = Fe({
4083
+ r.style.width !== s && (r.style.width = s, o = Ge({
4068
4084
  ...a,
4069
4085
  panelSize: r.getBoundingClientRect()
4070
4086
  })), 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;
4071
4087
  return;
4072
4088
  }
4073
- let a = Ee({
4089
+ let a = Fe({
4074
4090
  toolbarRect: n.getBoundingClientRect(),
4075
4091
  popoverSize: r.getBoundingClientRect(),
4076
4092
  viewport: {
@@ -4082,9 +4098,9 @@ var vs = J({
4082
4098
  });
4083
4099
  g.value = a.placement;
4084
4100
  }), F = () => {
4085
- let l = He(e.editor);
4101
+ let l = Qe(e.editor);
4086
4102
  if (l?.target.kind === "table" && l.status === "target" && t.value !== "ask-ai") {
4087
- s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", q(() => u.value?.focus());
4103
+ s.value = l.selection, n.value = "input", r.value = "", a.value = "", o.value = "", i.value = "", t.value = "ask-ai", J(() => u.value?.focus());
4088
4104
  return;
4089
4105
  }
4090
4106
  t.value === "ask-ai" && l?.status === "conflict" && (c.value?.abort(), k.cancel(), n.value = "conflict");
@@ -4099,26 +4115,26 @@ var vs = J({
4099
4115
  t.value = null;
4100
4116
  }
4101
4117
  };
4102
- K(() => [
4118
+ q(() => [
4103
4119
  t.value,
4104
4120
  n.value,
4105
4121
  a.value,
4106
4122
  o.value
4107
4123
  ], ([e]) => {
4108
- e && q(P.schedule);
4109
- }), Sr(() => {
4124
+ e && J(P.schedule);
4125
+ }), jr(() => {
4110
4126
  window.addEventListener("resize", P.schedule), window.addEventListener("scroll", P.schedule, !0), e.editor.on("transaction", F), document.addEventListener("pointerdown", ee, !0), document.addEventListener("keydown", I, !0);
4111
- }), Cr(() => {
4112
- P.cancel(), k.cancel(), window.removeEventListener("resize", P.schedule), window.removeEventListener("scroll", P.schedule, !0), e.editor.off("transaction", F), document.removeEventListener("pointerdown", ee, !0), document.removeEventListener("keydown", I, !0), c.value?.abort(), Re(e.editor);
4127
+ }), Mr(() => {
4128
+ P.cancel(), k.cancel(), window.removeEventListener("resize", P.schedule), window.removeEventListener("scroll", P.schedule, !0), e.editor.off("transaction", F), document.removeEventListener("pointerdown", ee, !0), document.removeEventListener("keydown", I, !0), c.value?.abort(), Je(e.editor);
4113
4129
  });
4114
- let L = (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, R = (e, t) => {
4130
+ let L = (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, te = (e, t) => {
4115
4131
  if (m.value = e, !e || !(t instanceof HTMLElement) || !v.value) {
4116
4132
  h.value = null;
4117
4133
  return;
4118
4134
  }
4119
4135
  let n = t.getBoundingClientRect(), r = v.value.getBoundingClientRect();
4120
4136
  h.value = n.left + n.width / 2 - r.left;
4121
- }, te = () => {
4137
+ }, ne = () => {
4122
4138
  let e = m.value;
4123
4139
  if (!e || t.value !== null) return null;
4124
4140
  let n = x.value.buttons[e];
@@ -4130,7 +4146,7 @@ var vs = J({
4130
4146
  "data-active": L(e),
4131
4147
  style: h.value === null ? void 0 : { "--markweave-floating-toolbar-tooltip-left": `${h.value}px` }
4132
4148
  }, n) : null;
4133
- }, z = (n, r, i, a, o = !1, s) => U("button", {
4149
+ }, R = (n, r, i, a, o = !1, s) => U("button", {
4134
4150
  type: "button",
4135
4151
  class: `markweave-floating-toolbar-button markweave-floating-toolbar-button--${n}`,
4136
4152
  "aria-label": r,
@@ -4144,16 +4160,16 @@ var vs = J({
4144
4160
  "data-active": o || t.value === n,
4145
4161
  "data-tooltip-active": m.value === n ? "true" : "false",
4146
4162
  "data-testid": `markweave-floating-toolbar-button-${n}`,
4147
- onBlur: () => R(null),
4148
- onFocus: (e) => R(n, e.currentTarget),
4163
+ onBlur: () => te(null),
4164
+ onFocus: (e) => te(n, e.currentTarget),
4149
4165
  onMousedown: $,
4150
- onMouseenter: (e) => R(n, e.currentTarget),
4151
- onMouseleave: () => R(null),
4166
+ onMouseenter: (e) => te(n, e.currentTarget),
4167
+ onMouseleave: () => te(null),
4152
4168
  onClick: a
4153
- }, 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" }, _s(e.editor, e.messages)), Q(t.value === "block-type" ? Zr : Yr, 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" ? Zr : Yr, r)])] : [Q(i, r)]), B = () => U("span", {
4169
+ }, 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" }, Ds(e.editor, e.messages)), Q(t.value === "block-type" ? oi : ii, 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" ? oi : ii, r)])] : [Q(i, r)]), re = () => U("span", {
4154
4170
  class: "markweave-floating-toolbar-divider",
4155
4171
  "aria-hidden": "true"
4156
- }), V = (n, r, i) => U("section", {
4172
+ }), z = (n, r, i) => U("section", {
4157
4173
  class: "markweave-floating-toolbar-color-section",
4158
4174
  "aria-label": n
4159
4175
  }, [U("div", { class: "markweave-floating-toolbar-menu-title" }, n), U("div", { class: "markweave-floating-toolbar-swatch-grid" }, i.map(([n, i, a]) => U("button", {
@@ -4172,7 +4188,7 @@ var vs = J({
4172
4188
  class: "markweave-floating-toolbar-highlight-swatch",
4173
4189
  style: { backgroundColor: i ?? "#ffffff" },
4174
4190
  "aria-hidden": "true"
4175
- })])))]), H = () => {
4191
+ })])))]), B = () => {
4176
4192
  if (t.value === "ask-ai") {
4177
4193
  let t = (e, t, n, r) => U("button", {
4178
4194
  type: "button",
@@ -4204,7 +4220,7 @@ var vs = J({
4204
4220
  onClick: () => {
4205
4221
  M();
4206
4222
  }
4207
- }, [Q(Rr, e.messages.askAi.send)])]) : null;
4223
+ }, [Q(qr, e.messages.askAi.send)])]) : null;
4208
4224
  return U("section", {
4209
4225
  ref: y,
4210
4226
  class: "markweave-floating-toolbar-popover markweave-ask-ai-popover",
@@ -4220,7 +4236,7 @@ var vs = J({
4220
4236
  U("span", {
4221
4237
  class: "markweave-ask-ai-sparkles",
4222
4238
  "aria-hidden": "true"
4223
- }, [Q(Ai, "")]),
4239
+ }, [Q(zi, "")]),
4224
4240
  U("span", { class: "markweave-ask-ai-progress-label" }, a.value ? e.messages.askAi.streaming : e.messages.askAi.generating),
4225
4241
  U("button", {
4226
4242
  type: "button",
@@ -4228,17 +4244,17 @@ var vs = J({
4228
4244
  "aria-label": e.messages.askAi.stop,
4229
4245
  onMousedown: $,
4230
4246
  onClick: () => {
4231
- c.value?.abort(), k.cancel(), Le(e.editor), n.value = "input";
4247
+ c.value?.abort(), k.cancel(), qe(e.editor), n.value = "input";
4232
4248
  }
4233
- }, [Q(ji, e.messages.askAi.stop)])
4249
+ }, [Q(Bi, e.messages.askAi.stop)])
4234
4250
  ]) : null,
4235
4251
  n.value === "result" ? U("div", { class: "markweave-ask-ai-action-bar" }, [
4236
4252
  t(e.messages.askAi.retry, () => {
4237
4253
  M(i.value);
4238
- }, "markweave-ask-ai-retry", Di),
4254
+ }, "markweave-ask-ai-retry", Ii),
4239
4255
  U("span", { class: "markweave-ask-ai-action-spacer" }),
4240
- t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Gi),
4241
- t(e.messages.askAi.accept, N, "markweave-ask-ai-accept", qr)
4256
+ t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", ea),
4257
+ t(e.messages.askAi.accept, N, "markweave-ask-ai-accept", ni)
4242
4258
  ]) : null,
4243
4259
  n.value === "error" || n.value === "conflict" ? U("div", {
4244
4260
  class: "markweave-ask-ai-error",
@@ -4246,9 +4262,9 @@ var vs = J({
4246
4262
  }, [n.value === "conflict" ? e.messages.askAi.conflict : o.value || e.messages.askAi.errorFallback, U("div", { class: "markweave-ask-ai-action-bar" }, [
4247
4263
  n.value === "error" ? t(e.messages.askAi.retry, () => {
4248
4264
  M(i.value);
4249
- }, "markweave-ask-ai-retry", Di) : null,
4265
+ }, "markweave-ask-ai-retry", Ii) : null,
4250
4266
  U("span", { class: "markweave-ask-ai-action-spacer" }),
4251
- t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", Gi)
4267
+ t(e.messages.askAi.discard, () => A(!0), "markweave-ask-ai-discard", ea)
4252
4268
  ])]) : null
4253
4269
  ]);
4254
4270
  }
@@ -4262,7 +4278,7 @@ var vs = J({
4262
4278
  "data-testid": `markweave-floating-toolbar-turn-${n}`,
4263
4279
  onMousedown: $,
4264
4280
  onClick: () => {
4265
- Ce(e.editor, n), t.value = null;
4281
+ Te(e.editor, n), t.value = null;
4266
4282
  }
4267
4283
  }, [U("span", { class: "markweave-floating-toolbar-menu-icon" }, [Q(i, r)]), U("span", null, r)]))]) : t.value === "link" ? U("form", {
4268
4284
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-link-popover",
@@ -4286,7 +4302,7 @@ var vs = J({
4286
4302
  "aria-label": x.value.applyLink,
4287
4303
  "data-testid": "markweave-floating-toolbar-link-apply",
4288
4304
  onMousedown: $
4289
- }, [Q(ei, x.value.applyLink)]),
4305
+ }, [Q(li, x.value.applyLink)]),
4290
4306
  U("span", {
4291
4307
  class: "markweave-floating-toolbar-link-divider",
4292
4308
  "aria-hidden": "true"
@@ -4297,20 +4313,20 @@ var vs = J({
4297
4313
  "aria-label": x.value.openLink,
4298
4314
  "data-testid": "markweave-floating-toolbar-link-open",
4299
4315
  onMousedown: $,
4300
- onClick: () => fs(p.value)
4301
- }, [Q(ii, x.value.openLink)]),
4316
+ onClick: () => Ss(p.value)
4317
+ }, [Q(pi, x.value.openLink)]),
4302
4318
  U("button", {
4303
4319
  type: "button",
4304
4320
  "aria-label": x.value.removeLink,
4305
4321
  "data-testid": "markweave-floating-toolbar-link-remove",
4306
4322
  onMousedown: $,
4307
4323
  onClick: D
4308
- }, [Q(Bi, x.value.removeLink)])
4324
+ }, [Q(Yi, x.value.removeLink)])
4309
4325
  ])]) : t.value === "color" ? U("div", {
4310
4326
  ref: y,
4311
4327
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-color-popover",
4312
4328
  "data-testid": "markweave-floating-toolbar-color-menu"
4313
- }, [V(x.value.textColorTitle, "text", C.value), V(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? U("div", {
4329
+ }, [z(x.value.textColorTitle, "text", C.value), z(x.value.highlightColorTitle, "highlight", w.value)]) : t.value === "more" ? U("div", {
4314
4330
  ref: y,
4315
4331
  class: "markweave-floating-toolbar-popover markweave-floating-toolbar-more-menu",
4316
4332
  "data-testid": "markweave-floating-toolbar-more-menu"
@@ -4330,25 +4346,25 @@ var vs = J({
4330
4346
  m.value = null;
4331
4347
  },
4332
4348
  onClick: () => {
4333
- Se(e.editor, n), t.value = null;
4349
+ we(e.editor, n), t.value = null;
4334
4350
  }
4335
- }, [Q(ps[n], x.value.moreActions[n])]), m.value === n ? U("div", {
4351
+ }, [Q(Cs[n], x.value.moreActions[n])]), m.value === n ? U("div", {
4336
4352
  class: "markweave-floating-toolbar-tooltip markweave-floating-toolbar-tooltip--more",
4337
4353
  role: "tooltip"
4338
4354
  }, x.value.moreActions[n]) : null]))) : null;
4339
4355
  };
4340
- return () => U(as, {
4356
+ return () => U(hs, {
4341
4357
  editor: e.editor,
4342
4358
  shouldShow: ({ editor: e }) => {
4343
- let t = He(e);
4344
- return ke(De(e), {
4359
+ let t = Qe(e);
4360
+ return Re(Ie(e), {
4345
4361
  editable: e.isEditable,
4346
- hasAskAiPreview: We(e.state),
4362
+ hasAskAiPreview: et(e.state),
4347
4363
  hasActiveAskAiTableTarget: t?.target.kind === "table" && t.status === "target"
4348
4364
  });
4349
4365
  },
4350
4366
  getReferencedVirtualElement: () => {
4351
- let t = He(e.editor)?.target.kind === "table" ? Ue(e.editor) : null;
4367
+ let t = Qe(e.editor)?.target.kind === "table" ? $e(e.editor) : null;
4352
4368
  return t ? {
4353
4369
  getBoundingClientRect: () => new DOMRect(t.left, t.top, t.width, t.height),
4354
4370
  getClientRects: () => [new DOMRect(t.left, t.top, t.width, t.height)]
@@ -4366,25 +4382,25 @@ var vs = J({
4366
4382
  class: "markweave-floating-toolbar-content",
4367
4383
  "data-menu": t.value ?? "none"
4368
4384
  }, [
4369
- f.value && Ge(e.editor) ? z("ask-ai", x.value.buttons["ask-ai"], Ai, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
4370
- f.value && Ge(e.editor) ? B() : null,
4371
- z("block-type", x.value.buttons["block-type"], Vi, () => O("block-type"), t.value === "block-type"),
4385
+ f.value && tt(e.editor) ? R("ask-ai", x.value.buttons["ask-ai"], zi, j, t.value === "ask-ai", x.value.buttons["ask-ai"]) : null,
4386
+ f.value && tt(e.editor) ? re() : null,
4387
+ R("block-type", x.value.buttons["block-type"], Xi, () => O("block-type"), t.value === "block-type"),
4388
+ re(),
4389
+ R("bold", x.value.buttons.bold, $r, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
4390
+ R("italic", x.value.buttons.italic, Si, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
4391
+ R("underline", x.value.buttons.underline, Zi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
4392
+ R("strike", x.value.buttons.strike, Hi, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
4393
+ R("inline-code", x.value.buttons["inline-code"], ci, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
4394
+ re(),
4395
+ R("link", x.value.buttons.link, wi, () => O("link"), e.editor.isActive("link")),
4396
+ R("color", x.value.buttons.color, Xi, () => O("color"), t.value === "color"),
4397
+ re(),
4398
+ R("more", x.value.buttons.more, ki, () => O("more"), t.value === "more"),
4372
4399
  B(),
4373
- z("bold", x.value.buttons.bold, Wr, () => e.editor.chain().focus().toggleBold().run(), e.editor.isActive("bold")),
4374
- z("italic", x.value.buttons.italic, pi, () => e.editor.chain().focus().toggleItalic().run(), e.editor.isActive("italic")),
4375
- z("underline", x.value.buttons.underline, Hi, () => e.editor.chain().focus().toggleUnderline().run(), e.editor.isActive("underline")),
4376
- z("strike", x.value.buttons.strike, Ni, () => e.editor.chain().focus().toggleStrike().run(), e.editor.isActive("strike")),
4377
- z("inline-code", x.value.buttons["inline-code"], $r, () => e.editor.chain().focus().toggleCode().run(), e.editor.isActive("code")),
4378
- B(),
4379
- z("link", x.value.buttons.link, hi, () => O("link"), e.editor.isActive("link")),
4380
- z("color", x.value.buttons.color, Vi, () => O("color"), t.value === "color"),
4381
- B(),
4382
- z("more", x.value.buttons.more, bi, () => O("more"), t.value === "more"),
4383
- H(),
4384
- te()
4400
+ ne()
4385
4401
  ])]) });
4386
4402
  }
4387
- }), ys = J({
4403
+ }), ks = Y({
4388
4404
  name: "MarkweaveVueMathEditorPopover",
4389
4405
  props: {
4390
4406
  editor: {
@@ -4405,17 +4421,17 @@ var vs = J({
4405
4421
  }
4406
4422
  },
4407
4423
  setup(e) {
4408
- let t = W(e.target.latex), n = xr(null), r = W(null), i = W(null), a = xr(qt(e.editor, e.target)), o = G(() => t.value === e.target.latex && a.value ? {
4424
+ let t = W(e.target.latex), n = G(null), r = W(null), i = W(null), a = G(rn(e.editor, e.target)), o = K(() => t.value === e.target.latex && a.value ? {
4409
4425
  html: a.value,
4410
4426
  error: !1
4411
- } : Zt(t.value, e.target.kind, e.editor)), s = G(() => t.value.trim().length > 0), c = G(() => e.messages.math), l = G(() => Kt(e.editor, e.target) ?? 1), u = () => {
4427
+ } : cn(t.value, e.target.kind, e.editor)), s = K(() => t.value.trim().length > 0), c = K(() => e.messages.math), l = K(() => nn(e.editor, e.target) ?? 1), u = () => {
4412
4428
  if (typeof window > "u") return;
4413
- let r = Gt(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
4429
+ let r = tn(e.editor, e.target), i = e.editor.view.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
4414
4430
  if (!r || !i) {
4415
4431
  e.onClose();
4416
4432
  return;
4417
4433
  }
4418
- n.value = Wt({
4434
+ n.value = en({
4419
4435
  anchorRect: r,
4420
4436
  frameRect: i,
4421
4437
  kind: e.target.kind,
@@ -4424,10 +4440,10 @@ var vs = J({
4424
4440
  viewportWidth: window.innerWidth
4425
4441
  });
4426
4442
  }, d = () => {
4427
- s.value && Ut(e.editor, e.target, t.value) && e.onClose();
4443
+ s.value && $t(e.editor, e.target, t.value) && e.onClose();
4428
4444
  }, f = (t) => {
4429
4445
  if (t.key === "Escape") {
4430
- t.preventDefault(), e.onClose(), e.editor.commands.focus();
4446
+ t.preventDefault(), e.onClose(), e.editor.commands.focus(void 0, { scrollIntoView: !1 });
4431
4447
  return;
4432
4448
  }
4433
4449
  t.key === "Enter" && (e.target.kind === "inline" || t.metaKey || t.ctrlKey) && (t.preventDefault(), d());
@@ -4435,14 +4451,14 @@ var vs = J({
4435
4451
  let n = t.target;
4436
4452
  n instanceof Node && (r.value?.contains(n) || n instanceof Element && n.closest(".tiptap-mathematics-render") || e.onClose());
4437
4453
  };
4438
- return K(() => [e.target.pos, e.target.latex], () => {
4439
- t.value = e.target.latex, a.value = qt(e.editor, e.target), q(u);
4440
- }), Sr(() => {
4441
- Qt(e.editor, e.target, !0), u(), q(() => {
4454
+ return q(() => [e.target.pos, e.target.latex], () => {
4455
+ t.value = e.target.latex, a.value = rn(e.editor, e.target), J(u);
4456
+ }), jr(() => {
4457
+ ln(e.editor, e.target, !0), u(), J(() => {
4442
4458
  i.value?.focus({ preventScroll: !0 }), i.value?.select(), u();
4443
4459
  }), window.addEventListener("resize", u), window.addEventListener("scroll", u, !0), document.addEventListener("mousedown", p);
4444
- }), Cr(() => {
4445
- Qt(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
4460
+ }), Mr(() => {
4461
+ ln(e.editor, e.target, !1), window.removeEventListener("resize", u), window.removeEventListener("scroll", u, !0), document.removeEventListener("mousedown", p);
4446
4462
  }), () => {
4447
4463
  let a = e.target.kind === "block" ? c.value.blockTitle : c.value.inlineTitle, u = {
4448
4464
  ref: i,
@@ -4503,14 +4519,14 @@ var vs = J({
4503
4519
  }, [
4504
4520
  U("div", { class: "markweave-math-block-toolbar" }, [
4505
4521
  U("span", null, c.value.label),
4506
- Q($r, c.value.label, 15, 1.75),
4522
+ Q(ci, c.value.label, 15, 1.75),
4507
4523
  U("button", {
4508
4524
  type: "submit",
4509
4525
  title: c.value.apply,
4510
4526
  "aria-label": c.value.apply,
4511
4527
  disabled: !s.value,
4512
4528
  "data-testid": "markweave-math-editor-apply"
4513
- }, [Q(Jr, c.value.apply, 16, 2)])
4529
+ }, [Q(ri, c.value.apply, 16, 2)])
4514
4530
  ]),
4515
4531
  U("label", {
4516
4532
  class: "markweave-math-block-source",
@@ -4533,7 +4549,7 @@ var vs = J({
4533
4549
  ]);
4534
4550
  };
4535
4551
  }
4536
- }), bs = J({
4552
+ }), As = Y({
4537
4553
  name: "MarkweaveVueSlashCommandMenu",
4538
4554
  props: {
4539
4555
  commands: {
@@ -4574,7 +4590,7 @@ var vs = J({
4574
4590
  }
4575
4591
  },
4576
4592
  setup(e) {
4577
- let t = W(""), n = W(null), r = W(null), i = W(!1), a = W(""), o = W(0), s = W(null), c = G(() => {
4593
+ let t = W(""), n = W(null), r = W(null), i = W(!1), a = W(""), o = W(0), s = W(null), c = K(() => {
4578
4594
  let t = a.value.trim().toLowerCase();
4579
4595
  return (t ? e.messages.slash.emojiItems.filter((e) => [
4580
4596
  e.emoji,
@@ -4582,16 +4598,16 @@ var vs = J({
4582
4598
  ...e.terms
4583
4599
  ].join(" ").toLowerCase().includes(t)) : e.messages.slash.emojiItems).slice(0, 12);
4584
4600
  });
4585
- K(() => [
4601
+ q(() => [
4586
4602
  e.state.name,
4587
4603
  e.state.activeIndex,
4588
4604
  e.commands.length,
4589
4605
  e.inputCommand?.id ?? null
4590
4606
  ], async () => {
4591
4607
  if (e.state.name !== "keyboard-selecting" || e.inputCommand || !e.commands.length) return;
4592
- await q();
4608
+ await J();
4593
4609
  let t = s.value, n = t?.querySelector("[data-active=\"true\"]");
4594
- t && n && dn(t, n);
4610
+ t && n && xn(t, n);
4595
4611
  }, { flush: "post" });
4596
4612
  let l = async () => {
4597
4613
  if (e.inputCommand) {
@@ -4608,13 +4624,13 @@ var vs = J({
4608
4624
  } : {
4609
4625
  kind: i,
4610
4626
  trigger: i === "attachment" ? "attachment-insert" : "slash-command",
4611
- source: B(t.value)
4627
+ source: re(t.value)
4612
4628
  };
4613
4629
  if (!n.value && !t.value.trim()) {
4614
4630
  r.value = e.messages.slash.uploadRequiredError;
4615
4631
  return;
4616
4632
  }
4617
- let o = await H(a, e.onUpload);
4633
+ let o = await B(a, e.onUpload);
4618
4634
  e.onSelect(e.inputCommand, { uploadResult: o }), e.onInputCommandChange(null), t.value = "", n.value = null;
4619
4635
  } catch (t) {
4620
4636
  r.value = t instanceof Error ? t.message : e.messages.slash.uploadFailedError;
@@ -4735,7 +4751,7 @@ var vs = J({
4735
4751
  class: "markweave-slash-group",
4736
4752
  "aria-label": t.group
4737
4753
  }, [U("div", { class: "markweave-slash-group-title" }, t.group), ...t.commands.map((t) => {
4738
- let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i = ln(t);
4754
+ let n = e.commands.indexOf(t), r = n === e.state.activeIndex, i = yn(t);
4739
4755
  return U("button", {
4740
4756
  key: t.id,
4741
4757
  id: `markweave-slash-command-option-${n}`,
@@ -4746,7 +4762,7 @@ var vs = J({
4746
4762
  "data-active": r,
4747
4763
  "data-disabled": t.disabled ? "true" : "false",
4748
4764
  "data-execution-kind": t.executionKind,
4749
- "data-text-icon-length": cn(t.icon) ?? void 0,
4765
+ "data-text-icon-length": vn(t.icon) ?? void 0,
4750
4766
  "data-testid": `markweave-slash-command-${t.id}`,
4751
4767
  title: t.disabledReason,
4752
4768
  onMousedown: $,
@@ -4760,7 +4776,7 @@ var vs = J({
4760
4776
  }
4761
4777
  }
4762
4778
  }, [
4763
- hs(t.icon),
4779
+ Ts(t.icon),
4764
4780
  U("span", null, t.label),
4765
4781
  t.disabledReason ? U("small", null, t.disabledReason) : null
4766
4782
  ]);
@@ -4776,34 +4792,34 @@ var vs = J({
4776
4792
  }, e.errorMessage ?? "")]);
4777
4793
  };
4778
4794
  }
4779
- }), xs = {
4780
- "ask-ai": Ai,
4781
- "move-left": Ir,
4782
- "move-right": Lr,
4783
- "move-up": Rr,
4784
- "move-down": Pr,
4785
- "insert-left": Ur,
4786
- "insert-right": Hr,
4787
- "insert-above": Vr,
4788
- "insert-below": Br,
4789
- "sort-asc": Fr,
4790
- "sort-desc": zr,
4791
- color: xi,
4792
- alignment: Or,
4793
- clear: Mi,
4794
- duplicate: ti,
4795
- copy: ti,
4796
- merge: Li,
4797
- split: Ri,
4798
- delete: Bi
4799
- }, Ss = {
4800
- left: Or,
4801
- center: Er,
4802
- right: kr,
4803
- top: Mr,
4804
- middle: Ar,
4805
- bottom: jr
4806
- }, Cs = J({
4795
+ }), js = {
4796
+ "ask-ai": zi,
4797
+ "move-left": Gr,
4798
+ "move-right": Kr,
4799
+ "move-up": qr,
4800
+ "move-down": Ur,
4801
+ "insert-left": Qr,
4802
+ "insert-right": Zr,
4803
+ "insert-above": Xr,
4804
+ "insert-below": Yr,
4805
+ "sort-asc": Wr,
4806
+ "sort-desc": Jr,
4807
+ color: Ai,
4808
+ alignment: Lr,
4809
+ clear: Vi,
4810
+ duplicate: ui,
4811
+ copy: ui,
4812
+ merge: Ki,
4813
+ split: qi,
4814
+ delete: Yi
4815
+ }, Ms = {
4816
+ left: Lr,
4817
+ center: Fr,
4818
+ right: Rr,
4819
+ top: Vr,
4820
+ middle: zr,
4821
+ bottom: Br
4822
+ }, Ns = Y({
4807
4823
  name: "MarkweaveVueTableControls",
4808
4824
  props: {
4809
4825
  editor: {
@@ -4840,12 +4856,12 @@ var vs = J({
4840
4856
  }
4841
4857
  },
4842
4858
  setup(e) {
4843
- 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 = G(() => e.askAi?.enabled === !0 && typeof e.askAi.handler == "function"), w = () => En(e.editor.state, "structure"), T = G(() => e.active ? kn(e.editor.state) : os), E = G(() => Jn(e.editor, e.interactionState, "row", T.value.activeCellPos)), D = G(() => Jn(e.editor, e.interactionState, "column", T.value.activeCellPos)), O = G(() => Wn(e.editor)), k = G(() => (O.value, T.value.active && Qn(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), A = G(() => t.value ? Qn(e.editor, t.value, { askAiEnabled: C.value }) : []), j = () => {
4859
+ 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 = () => In(e.editor.state, "structure"), T = K(() => e.active ? zn(e.editor.state) : gs), E = K(() => ir(e.editor, e.interactionState, "row", T.value.activeCellPos)), D = K(() => ir(e.editor, e.interactionState, "column", T.value.activeCellPos)), O = K(() => er(e.editor)), k = K(() => (O.value, T.value.active && cr(e.editor, "selection", { askAiEnabled: C.value }).length > 0)), A = K(() => t.value ? cr(e.editor, t.value, { askAiEnabled: C.value }) : []), j = () => {
4844
4860
  b === null || typeof window > "u" || (window.clearTimeout(b), b = null);
4845
4861
  }, M = (e) => {
4846
4862
  j(), d.value = e, !(!e || typeof window > "u") && (b = window.setTimeout(() => {
4847
4863
  d.value = null, b = null;
4848
- }, ir));
4864
+ }, mr));
4849
4865
  }, N = () => {
4850
4866
  if (!e.active) {
4851
4867
  i.value = null, a.value = null, o.value = null, s.value = null, c.value = null, M(null);
@@ -4856,26 +4872,26 @@ var vs = J({
4856
4872
  i.value = null, a.value = null, o.value = null, s.value = null, c.value = null;
4857
4873
  return;
4858
4874
  }
4859
- let l = n.getBoundingClientRect(), u = E.value ? qn(e.editor, E.value) : null, d = D.value ? qn(e.editor, D.value) : null, f = k.value ? $n(e.editor) : null, p = Un(e.editor)?.getBoundingClientRect() ?? null;
4860
- u ? i.value = Rn({
4875
+ let l = n.getBoundingClientRect(), u = E.value ? rr(e.editor, E.value) : null, d = D.value ? rr(e.editor, D.value) : null, f = k.value ? lr(e.editor) : null, p = $n(e.editor)?.getBoundingClientRect() ?? null;
4876
+ u ? i.value = Jn({
4861
4877
  targetRect: u,
4862
4878
  frameRect: l,
4863
4879
  kind: "row"
4864
- }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Rn({
4880
+ }) : t.value === "row" && r.value === "row-edge" || (i.value = null), d ? a.value = Jn({
4865
4881
  targetRect: d,
4866
4882
  frameRect: l,
4867
4883
  kind: "column"
4868
- }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Rn({
4884
+ }) : t.value === "column" && r.value === "column-edge" || (a.value = null), f ? o.value = Jn({
4869
4885
  targetRect: f,
4870
4886
  frameRect: l,
4871
4887
  kind: "selection"
4872
4888
  }) : t.value === "selection" && r.value === "selection-edge" || (o.value = null);
4873
4889
  let m = e.interactionState.hoverCellPos !== null && !!(E.value && E.value.index === E.value.visualHeight - 1), h = e.interactionState.hoverCellPos !== null && !!(D.value && D.value.index === D.value.visualWidth - 1);
4874
- s.value = p && m ? zn({
4890
+ s.value = p && m ? Yn({
4875
4891
  tableRect: p,
4876
4892
  frameRect: l,
4877
4893
  kind: "row"
4878
- }) : null, c.value = p && h ? zn({
4894
+ }) : null, c.value = p && h ? Yn({
4879
4895
  tableRect: p,
4880
4896
  frameRect: l,
4881
4897
  kind: "column"
@@ -4890,16 +4906,16 @@ var vs = J({
4890
4906
  l.value = null;
4891
4907
  return;
4892
4908
  }
4893
- let a = i.getBoundingClientRect(), o = t.value === "row" ? Un(e.editor)?.getBoundingClientRect() : null, s = o ? {
4909
+ let a = i.getBoundingClientRect(), o = t.value === "row" ? $n(e.editor)?.getBoundingClientRect() : null, s = o ? {
4894
4910
  left: a.left,
4895
4911
  top: o.top,
4896
4912
  width: a.width,
4897
4913
  height: a.height
4898
4914
  } : a, c = n.getBoundingClientRect(), u = _.value.getBoundingClientRect(), d = v.value?.scrollHeight ?? 0, f = d > 0 ? d + 12 : 0;
4899
- l.value = In({
4915
+ l.value = Kn({
4900
4916
  anchorRect: s,
4901
4917
  frameRect: c,
4902
- boundaryRect: Yn(n),
4918
+ boundaryRect: ar(n),
4903
4919
  menuSize: {
4904
4920
  width: u.width || 254,
4905
4921
  height: f || u.height || 410
@@ -4917,10 +4933,10 @@ var vs = J({
4917
4933
  return;
4918
4934
  }
4919
4935
  let a = y.value.getBoundingClientRect(), o = Math.max(y.value.scrollHeight + 2, a.height);
4920
- u.value = Ln({
4936
+ u.value = qn({
4921
4937
  triggerRect: i.getBoundingClientRect(),
4922
4938
  parentMenuRect: _.value.getBoundingClientRect(),
4923
- boundaryRect: Yn(r),
4939
+ boundaryRect: ar(r),
4924
4940
  submenuSize: {
4925
4941
  width: a.width || 238,
4926
4942
  height: o || 410
@@ -4929,35 +4945,35 @@ var vs = J({
4929
4945
  }, I = () => {
4930
4946
  N(), P(), F();
4931
4947
  }, ee = () => {
4932
- q(I);
4948
+ J(I);
4933
4949
  }, L = (e, i) => {
4934
4950
  let a = t.value === e && r.value === i;
4935
4951
  r.value = i, t.value = a ? null : e, n.value = null, u.value = null, ee();
4936
- }, R = () => {
4937
- e.editor.view.dispatch(Tn(e.editor.state.tr, null));
4938
- }, te = (t, n) => {
4952
+ }, te = () => {
4953
+ e.editor.view.dispatch(Fn(e.editor.state.tr, null));
4954
+ }, ne = (t, n) => {
4939
4955
  let r = e.interactionState.hoverCellPos ?? T.value.activeCellPos, i = e.interactionState.hoverCellPos === null ? null : t === "row" ? e.interactionState.hoverVisualRowIndex : e.interactionState.hoverVisualColumnIndex;
4940
- r !== null && nr(e.editor, r, t, { visualIndex: i }), L(t, n);
4941
- }, z = () => {
4942
- R(), L("selection", "selection-edge");
4943
- }, B = (r = !1) => {
4956
+ r !== null && fr(e.editor, r, t, { visualIndex: i }), L(t, n);
4957
+ }, R = () => {
4958
+ te(), L("selection", "selection-edge");
4959
+ }, re = (r = !1) => {
4944
4960
  t.value = null, n.value = null, l.value = null, u.value = null, r && e.editor.view.focus();
4945
- }, V = async (n, r) => {
4946
- let i = await Vn({
4961
+ }, z = async (n, r) => {
4962
+ let i = await Zn({
4947
4963
  editor: e.editor,
4948
4964
  commandId: n,
4949
4965
  menu: r ?? t.value ?? "selection",
4950
4966
  messages: e.messages
4951
4967
  });
4952
4968
  return i.copyFeedback ? (M(i.copyFeedback), i.copyPayload && e.onCopyPayload?.(i.copyPayload)) : M(null), e.onCommandResult?.(i.commandResult), i.success;
4953
- }, H = (t) => {
4954
- C.value && (Ye(e.editor, t), B(!1));
4955
- }, ne = (e) => {
4969
+ }, B = (t) => {
4970
+ C.value && (at(e.editor, t), re(!1));
4971
+ }, ie = (e) => {
4956
4972
  t.value !== "row" && t.value !== "column" || e(t.value) && (f.value += 1, ee());
4957
- }, re = (t) => {
4973
+ }, ae = (t) => {
4958
4974
  let n = t === "row" ? E.value : D.value, r = e.interactionState.hoverCellPos ?? T.value.activeCellPos;
4959
- !n || r === null || cr(e.editor, r, t, { visualIndex: n.index }) && V(t === "row" ? "add-row-after" : "add-column-after", t);
4960
- }, ie = (e, t, n) => {
4975
+ !n || r === null || vr(e.editor, r, t, { visualIndex: n.index }) && z(t === "row" ? "add-row-after" : "add-column-after", t);
4976
+ }, oe = (e, t, n) => {
4961
4977
  if (!w()) {
4962
4978
  n.preventDefault();
4963
4979
  return;
@@ -4966,37 +4982,37 @@ var vs = J({
4966
4982
  axis: e,
4967
4983
  index: t
4968
4984
  }, S = t, n.dataTransfer?.setData("application/x-markweave-table-axis", `${e}:${t}`), n.dataTransfer && (n.dataTransfer.effectAllowed = "move");
4969
- }, ae = (t) => {
4985
+ }, V = (t) => {
4970
4986
  if (!x) return;
4971
- let n = Gn(e.editor, x.axis, t.clientX, t.clientY);
4987
+ let n = tr(e.editor, x.axis, t.clientX, t.clientY);
4972
4988
  n !== null && (t.preventDefault(), S = n, t.dataTransfer && (t.dataTransfer.dropEffect = "move"));
4973
- }, oe = (t) => {
4989
+ }, se = (t) => {
4974
4990
  let n = x;
4975
4991
  if (!n) return;
4976
- let r = Gn(e.editor, n.axis, t.clientX, t.clientY) ?? S;
4977
- t.preventDefault(), x = null, S = null, r !== null && tr(e.editor, n.axis, n.index, r);
4978
- }, se = G(() => (f.value, t.value === "row" || t.value === "column" ? Kn(e.editor, t.value) : null)), ce = (e) => {
4992
+ let r = tr(e.editor, n.axis, t.clientX, t.clientY) ?? S;
4993
+ t.preventDefault(), x = null, S = null, r !== null && dr(e.editor, n.axis, n.index, r);
4994
+ }, ce = K(() => (f.value, t.value === "row" || t.value === "column" ? nr(e.editor, t.value) : null)), le = (e) => {
4979
4995
  if (!(!t.value || e.key !== "Escape")) {
4980
4996
  if (n.value) {
4981
4997
  n.value = null;
4982
4998
  return;
4983
4999
  }
4984
- B(!0);
5000
+ re(!0);
4985
5001
  }
4986
- }, le = (e) => {
5002
+ }, H = (e) => {
4987
5003
  if (e.key !== "ArrowDown" && e.key !== "ArrowUp") return;
4988
5004
  let t = e.currentTarget;
4989
5005
  if (!(t instanceof HTMLElement)) return;
4990
5006
  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));
4991
5007
  e.preventDefault(), e.stopPropagation(), r[o]?.focus();
4992
5008
  }, ue = (e) => {
4993
- t.value && (e.target instanceof Node && p.value?.contains(e.target) || B());
5009
+ t.value && (e.target instanceof Node && p.value?.contains(e.target) || re());
4994
5010
  };
4995
- Sr(() => {
4996
- I(), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown", ce), document.addEventListener("mousedown", ue), document.addEventListener("dragover", ae), document.addEventListener("drop", oe);
4997
- }), Cr(() => {
4998
- j(), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown", ce), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", ae), document.removeEventListener("drop", oe);
4999
- }), K(() => [
5011
+ jr(() => {
5012
+ I(), window.addEventListener("resize", I), window.addEventListener("scroll", I, !0), document.addEventListener("keydown", le), document.addEventListener("mousedown", ue), document.addEventListener("dragover", V), document.addEventListener("drop", se);
5013
+ }), Mr(() => {
5014
+ j(), window.removeEventListener("resize", I), window.removeEventListener("scroll", I, !0), document.removeEventListener("keydown", le), document.removeEventListener("mousedown", ue), document.removeEventListener("dragover", V), document.removeEventListener("drop", se);
5015
+ }), q(() => [
5000
5016
  e.active,
5001
5017
  T.value.activeCellPos,
5002
5018
  T.value.selectionFrom,
@@ -5011,7 +5027,7 @@ var vs = J({
5011
5027
  let de = () => {
5012
5028
  if (!t.value) return null;
5013
5029
  let r = A.value.map((r, i) => {
5014
- let a = Xn(r), o = i === 0 ? a : Xn(A.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 && Ie(e.editor, c) : Bn(e.editor, r.commandId), u = Zn(r, e.messages), d = xs[r.icon];
5030
+ let a = or(r), o = i === 0 ? a : or(A.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 && Ke(e.editor, c) : Xn(e.editor, r.commandId), u = sr(r, e.messages), d = js[r.icon];
5015
5031
  return U("button", {
5016
5032
  key: `${r.id}-${i}`,
5017
5033
  type: "button",
@@ -5028,7 +5044,7 @@ var vs = J({
5028
5044
  "data-submenu-trigger": r.submenuId ?? void 0,
5029
5045
  "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",
5030
5046
  onMousedown: (e) => {
5031
- $(e), l && r.id === "edit-with-ai" && H(c);
5047
+ $(e), l && r.id === "edit-with-ai" && B(c);
5032
5048
  },
5033
5049
  onMouseenter: () => {
5034
5050
  n.value = r.submenuId;
@@ -5040,10 +5056,10 @@ var vs = J({
5040
5056
  return;
5041
5057
  }
5042
5058
  if (r.commandId === null) {
5043
- e.detail === 0 && H(c);
5059
+ e.detail === 0 && B(c);
5044
5060
  return;
5045
5061
  }
5046
- V(r.commandId).finally(() => B());
5062
+ z(r.commandId).finally(() => re());
5047
5063
  }
5048
5064
  }
5049
5065
  }, [
@@ -5055,7 +5071,7 @@ var vs = J({
5055
5071
  strokeWidth: 1.8
5056
5072
  })]),
5057
5073
  U("span", { class: "markweave-table-menu-item-label" }, u),
5058
- r.submenuId ? U(Xr, {
5074
+ r.submenuId ? U(ai, {
5059
5075
  class: "markweave-table-menu-chevron",
5060
5076
  size: 16,
5061
5077
  "aria-hidden": "true"
@@ -5079,18 +5095,18 @@ var vs = J({
5079
5095
  top: `${u.value.top}px`,
5080
5096
  maxHeight: `${u.value.maxHeight}px`
5081
5097
  } : void 0,
5082
- onKeydown: le
5098
+ onKeydown: H
5083
5099
  }, [
5084
5100
  U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.textColor),
5085
- ...rr.map((t) => U("button", {
5101
+ ...pr.map((t) => U("button", {
5086
5102
  key: `text-${t.id}`,
5087
5103
  type: "button",
5088
5104
  role: "menuitemradio",
5089
- "aria-checked": se.value?.textColorId === t.id,
5090
- "data-active": se.value?.textColorId === t.id ? "true" : "false",
5105
+ "aria-checked": ce.value?.textColorId === t.id,
5106
+ "data-active": ce.value?.textColorId === t.id ? "true" : "false",
5091
5107
  "data-testid": `markweave-table-text-color-${t.id}`,
5092
5108
  onMousedown: $,
5093
- onClick: () => ne((n) => Fn(e.editor, n, t.id))
5109
+ onClick: () => ie((n) => Gn(e.editor, n, t.id))
5094
5110
  }, [U("span", {
5095
5111
  class: "markweave-table-color-swatch markweave-table-text-color-swatch",
5096
5112
  "aria-hidden": "true",
@@ -5098,15 +5114,15 @@ var vs = J({
5098
5114
  }), U("span", null, e.messages.table.colors[t.id].text)])),
5099
5115
  U("div", { class: "markweave-table-submenu-separator" }),
5100
5116
  U("div", { class: "markweave-table-submenu-title" }, e.messages.table.submenus.backgroundColor),
5101
- ...rr.map((t) => U("button", {
5117
+ ...pr.map((t) => U("button", {
5102
5118
  key: `background-${t.id}`,
5103
5119
  type: "button",
5104
5120
  role: "menuitemradio",
5105
- "aria-checked": se.value?.backgroundColorId === t.id,
5106
- "data-active": se.value?.backgroundColorId === t.id ? "true" : "false",
5121
+ "aria-checked": ce.value?.backgroundColorId === t.id,
5122
+ "data-active": ce.value?.backgroundColorId === t.id ? "true" : "false",
5107
5123
  "data-testid": `markweave-table-background-color-${t.id}`,
5108
5124
  onMousedown: $,
5109
- onClick: () => ne((n) => Pn(e.editor, n, t.id))
5125
+ onClick: () => ie((n) => Wn(e.editor, n, t.id))
5110
5126
  }, [U("span", {
5111
5127
  class: "markweave-table-color-swatch",
5112
5128
  "aria-hidden": "true",
@@ -5114,7 +5130,7 @@ var vs = J({
5114
5130
  }), U("span", null, e.messages.table.colors[t.id].background)]))
5115
5131
  ])), n.value === "alignment" && (t.value === "row" || t.value === "column")) {
5116
5132
  let t = (t, n) => {
5117
- let r = Ss[t];
5133
+ let r = Ms[t];
5118
5134
  return U("button", {
5119
5135
  key: t,
5120
5136
  type: "button",
@@ -5123,7 +5139,7 @@ var vs = J({
5123
5139
  "data-active": n ? "true" : "false",
5124
5140
  "data-testid": `markweave-table-alignment-${t}`,
5125
5141
  onMousedown: $,
5126
- onClick: () => ne((n) => Nn(e.editor, n, t))
5142
+ onClick: () => ie((n) => Un(e.editor, n, t))
5127
5143
  }, [U(r, {
5128
5144
  size: 18,
5129
5145
  strokeWidth: 1.8,
@@ -5143,18 +5159,18 @@ var vs = J({
5143
5159
  top: `${u.value.top}px`,
5144
5160
  maxHeight: `${u.value.maxHeight}px`
5145
5161
  } : void 0,
5146
- onKeydown: le
5162
+ onKeydown: H
5147
5163
  }, [
5148
- ...ar.map((e) => t(e, se.value?.textAlign === e)),
5164
+ ...hr.map((e) => t(e, ce.value?.textAlign === e)),
5149
5165
  U("div", { class: "markweave-table-submenu-separator" }),
5150
- ...sr.map((e) => t(e, se.value?.verticalAlign === e))
5166
+ ..._r.map((e) => t(e, ce.value?.verticalAlign === e))
5151
5167
  ]));
5152
5168
  }
5153
5169
  return U("div", {
5154
5170
  ref: _,
5155
5171
  class: "markweave-table-menu",
5156
5172
  role: "menu",
5157
- "aria-label": or(t.value, e.messages),
5173
+ "aria-label": gr(t.value, e.messages),
5158
5174
  "data-testid": "markweave-table-menu",
5159
5175
  "data-positioned": l.value ? "true" : "false",
5160
5176
  "data-placement": l.value?.placement,
@@ -5163,7 +5179,7 @@ var vs = J({
5163
5179
  left: `${l.value.left}px`,
5164
5180
  top: `${l.value.top}px`
5165
5181
  } : void 0,
5166
- onKeydown: le
5182
+ onKeydown: H
5167
5183
  }, i);
5168
5184
  };
5169
5185
  return () => e.active ? U("div", {
@@ -5173,7 +5189,7 @@ var vs = J({
5173
5189
  "aria-label": e.messages.table.controlsAriaLabel,
5174
5190
  "data-open-menu": t.value ?? "none",
5175
5191
  "data-positioned": i.value || a.value || o.value ? "true" : "false",
5176
- onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(Mn, { type: "clear-hover" }))
5192
+ onMouseleave: () => e.editor.view.dispatch(e.editor.state.tr.setMeta(Hn, { type: "clear-hover" }))
5177
5193
  }, [
5178
5194
  d.value ? U("div", {
5179
5195
  class: "markweave-table-copy-feedback",
@@ -5183,7 +5199,7 @@ var vs = J({
5183
5199
  "data-copy-kind": d.value.kind,
5184
5200
  "data-text-length": d.value.textLength,
5185
5201
  "data-html-length": d.value.htmlLength
5186
- }, Hn(d.value)) : null,
5202
+ }, Qn(d.value)) : null,
5187
5203
  i.value ? U("button", {
5188
5204
  ref: m,
5189
5205
  type: "button",
@@ -5205,12 +5221,12 @@ var vs = J({
5205
5221
  height: `${i.value.height}px`
5206
5222
  },
5207
5223
  onMousedown: $,
5208
- onClick: () => te("row", "row-edge"),
5209
- onDragstart: (e) => ie("row", E.value?.index ?? 0, e),
5224
+ onClick: () => ne("row", "row-edge"),
5225
+ onDragstart: (e) => oe("row", E.value?.index ?? 0, e),
5210
5226
  onDragend: () => {
5211
5227
  x = null, S = null;
5212
5228
  }
5213
- }, [U(bi, {
5229
+ }, [U(ki, {
5214
5230
  size: 14,
5215
5231
  "aria-hidden": "true"
5216
5232
  })]) : null,
@@ -5235,12 +5251,12 @@ var vs = J({
5235
5251
  height: `${a.value.height}px`
5236
5252
  },
5237
5253
  onMousedown: $,
5238
- onClick: () => te("column", "column-edge"),
5239
- onDragstart: (e) => ie("column", D.value?.index ?? 0, e),
5254
+ onClick: () => ne("column", "column-edge"),
5255
+ onDragstart: (e) => oe("column", D.value?.index ?? 0, e),
5240
5256
  onDragend: () => {
5241
5257
  x = null, S = null;
5242
5258
  }
5243
- }, [U(bi, {
5259
+ }, [U(ki, {
5244
5260
  size: 14,
5245
5261
  "aria-hidden": "true"
5246
5262
  })]) : null,
@@ -5260,8 +5276,8 @@ var vs = J({
5260
5276
  height: `${o.value.height}px`
5261
5277
  },
5262
5278
  onMousedown: $,
5263
- onClick: z
5264
- }, [U(bi, {
5279
+ onClick: R
5280
+ }, [U(ki, {
5265
5281
  size: 14,
5266
5282
  "aria-hidden": "true"
5267
5283
  })]) : null,
@@ -5278,8 +5294,8 @@ var vs = J({
5278
5294
  height: `${s.value.height}px`
5279
5295
  },
5280
5296
  onMousedown: $,
5281
- onClick: () => re("row")
5282
- }, [U(wi, {
5297
+ onClick: () => ae("row")
5298
+ }, [U(Ni, {
5283
5299
  size: 14,
5284
5300
  "aria-hidden": "true"
5285
5301
  })]) : null,
@@ -5296,15 +5312,15 @@ var vs = J({
5296
5312
  height: `${c.value.height}px`
5297
5313
  },
5298
5314
  onMousedown: $,
5299
- onClick: () => re("column")
5300
- }, [U(wi, {
5315
+ onClick: () => ae("column")
5316
+ }, [U(Ni, {
5301
5317
  size: 14,
5302
5318
  "aria-hidden": "true"
5303
5319
  })]) : null,
5304
5320
  de()
5305
5321
  ]) : null;
5306
5322
  }
5307
- }), ws = J({
5323
+ }), Ps = Y({
5308
5324
  name: "MarkweaveVueTableSelectionOverlay",
5309
5325
  props: {
5310
5326
  editor: {
@@ -5322,13 +5338,13 @@ var vs = J({
5322
5338
  t.value = null;
5323
5339
  return;
5324
5340
  }
5325
- t.value = er(e.editor, An(e.editor.state));
5341
+ t.value = ur(e.editor, Bn(e.editor.state));
5326
5342
  };
5327
- return Sr(() => {
5343
+ return jr(() => {
5328
5344
  n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0);
5329
- }), Cr(() => {
5345
+ }), Mr(() => {
5330
5346
  window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
5331
- }), K(() => [
5347
+ }), q(() => [
5332
5348
  e.focusState.activeCellPos,
5333
5349
  e.focusState.anchorCellPos,
5334
5350
  e.focusState.mode,
@@ -5336,7 +5352,7 @@ var vs = J({
5336
5352
  e.focusState.selectionFrom,
5337
5353
  e.focusState.selectionTo
5338
5354
  ], () => {
5339
- q(n);
5355
+ J(n);
5340
5356
  }, { flush: "post" }), () => {
5341
5357
  let e = t.value;
5342
5358
  return e ? U("div", {
@@ -5361,7 +5377,7 @@ var vs = J({
5361
5377
  }) : null;
5362
5378
  };
5363
5379
  }
5364
- }), Ts = J({
5380
+ }), Fs = Y({
5365
5381
  name: "MarkweaveVueCodeBlockControls",
5366
5382
  props: {
5367
5383
  editor: {
@@ -5394,49 +5410,49 @@ var vs = J({
5394
5410
  active: !1,
5395
5411
  lastX: 0,
5396
5412
  lastY: 0
5397
- }), b = W(0), x = W(0), S = W(0), C = null, w = G(() => (S.value, jt(e.editor, s.value))), T = G(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
5413
+ }), b = W(0), x = W(0), S = W(0), C = null, w = K(() => (S.value, Vt(e.editor, s.value))), T = K(() => !e.readOnly && e.active && e.state.active && e.state.pos !== null ? {
5398
5414
  ...e.state,
5399
5415
  pos: e.state.pos,
5400
5416
  active: !0
5401
- } : null), E = G(() => w.value ?? T.value), D = G(() => E.value !== null), O = G(() => E.value?.language === "mermaid"), k = G(() => It(e.editor, E.value)), A = G(() => D.value && E.value !== null && !k.value), j = G(() => !e.readOnly), M = G(() => E.value ? wt(E.value.language) : wt("text")), N = G(() => m.value?.status ?? "idle"), P = G(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), F = G(() => O.value && P.value === "preview"), I = G(() => (S.value, b.value, x.value, Pt(e.editor))), ee = G(() => `${x.value}|${I.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = G(() => Ot(f.value)), R = G(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), te = () => {
5417
+ } : null), E = K(() => w.value ?? T.value), D = K(() => E.value !== null), O = K(() => E.value?.language === "mermaid"), k = K(() => Kt(e.editor, E.value)), A = K(() => D.value && E.value !== null && !k.value), j = K(() => !e.readOnly), M = K(() => E.value ? Pt(E.value.language) : Pt("text")), N = K(() => m.value?.status ?? "idle"), P = K(() => E.value?.mermaidPreviewMode ?? e.mermaidMode), F = K(() => O.value && P.value === "preview"), I = K(() => (S.value, b.value, x.value, Wt(e.editor))), ee = K(() => `${x.value}|${I.value.map((e) => `${e.pos}:${e.mermaidPreviewMode}:${e.text.length}`).join("|")}`), L = K(() => Rt(f.value)), te = K(() => E.value ? `${E.value.pos}:${E.value.language}:${E.value.text}` : "none"), ne = () => {
5402
5418
  C !== null && (window.clearTimeout(C), C = null);
5403
- }, z = (e) => {
5404
- te(), m.value = e, e && (C = window.setTimeout(() => {
5419
+ }, R = (e) => {
5420
+ ne(), m.value = e, e && (C = window.setTimeout(() => {
5405
5421
  m.value = null, C = null;
5406
- }, _t));
5407
- }, B = () => {
5422
+ }, Dt));
5423
+ }, re = () => {
5408
5424
  g.value = null, _.value = null, v.value = !1, y.value = {
5409
5425
  active: !1,
5410
5426
  lastX: 0,
5411
5427
  lastY: 0
5412
5428
  }, e.editor.view.focus();
5413
- }, V = () => {
5429
+ }, z = () => {
5414
5430
  let n = t.value;
5415
5431
  if (!n) return;
5416
- if (!Mt(n) || I.value.length === 0) {
5432
+ if (!Ht(n) || I.value.length === 0) {
5417
5433
  l.value = [];
5418
5434
  return;
5419
5435
  }
5420
5436
  let r = n.getBoundingClientRect(), i = I.value.flatMap((t) => {
5421
- let n = Dt(Et(e.editor, t.pos, t.mermaidPreviewMode), r);
5422
- return n ? [St(t, n, r)] : [];
5437
+ let n = Lt(It(e.editor, t.pos, t.mermaidPreviewMode), r);
5438
+ return n ? [Mt(t, n, r)] : [];
5423
5439
  });
5424
- l.value = Lt(l.value, i, I.value.map((e) => e.pos));
5425
- }, H = () => {
5440
+ l.value = qt(l.value, i, I.value.map((e) => e.pos));
5441
+ }, B = () => {
5426
5442
  if (!A.value || !E.value) {
5427
5443
  c.value = null, u.value = null;
5428
5444
  return;
5429
5445
  }
5430
5446
  let i = t.value;
5431
5447
  if (!i) return;
5432
- let a = Et(e.editor, E.value.pos, P.value), o = i.getBoundingClientRect(), s = Dt(a, o);
5448
+ let a = It(e.editor, E.value.pos, P.value), o = i.getBoundingClientRect(), s = Lt(a, o);
5433
5449
  if (!s) {
5434
5450
  c.value = c.value?.pos === E.value.pos ? c.value : null, u.value = d.value ? u.value : null;
5435
5451
  return;
5436
5452
  }
5437
- if (c.value = bt(E.value.pos, s, o), d.value && n.value) {
5453
+ if (c.value = At(E.value.pos, s, o), d.value && n.value) {
5438
5454
  let e = n.value.getBoundingClientRect(), t = r.value?.getBoundingClientRect().height;
5439
- u.value = ht({
5455
+ u.value = Tt({
5440
5456
  overlayRect: o,
5441
5457
  buttonRect: e,
5442
5458
  menuHeight: t,
@@ -5444,60 +5460,60 @@ var vs = J({
5444
5460
  windowHeight: window.innerHeight
5445
5461
  });
5446
5462
  }
5447
- }, ne = async () => {
5463
+ }, ie = async () => {
5448
5464
  if (e.readOnly) {
5449
5465
  if (!E.value) return;
5450
- let e = await vt(E.value.text);
5451
- z(ut(E.value, e ? "copied" : "failed"));
5466
+ let e = await Ot(E.value.text);
5467
+ R(bt(E.value, e ? "copied" : "failed"));
5452
5468
  return;
5453
5469
  }
5454
- if (!Ct(e.editor, E.value)) return;
5455
- let t = await ct(e.editor);
5456
- z(ut(lt(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
5457
- }, re = (t, n) => {
5470
+ if (!Nt(e.editor, E.value)) return;
5471
+ let t = await vt(e.editor);
5472
+ R(bt(yt(e.editor), t ? "copied" : "failed")), e.editor.view.focus();
5473
+ }, ae = (t, n) => {
5458
5474
  if (e.readOnly) {
5459
- an(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
5475
+ hn(e.editor, t.pos, n) && (x.value += 1, S.value += 1);
5460
5476
  return;
5461
5477
  }
5462
5478
  let r = e.state.active && e.state.pos === t.pos;
5463
- mt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
5464
- }, ie = (t) => {
5479
+ wt(e.editor, t.pos, n) && (e.onMermaidModeChange(n), S.value += 1, r && e.editor.view.focus());
5480
+ }, oe = (t) => {
5465
5481
  if (e.readOnly || !E.value) return;
5466
5482
  let n = e.state.active && e.state.pos === E.value.pos;
5467
- pt(e.editor, E.value.pos, t) && (t === "mermaid" && mt(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());
5468
- }, ae = () => {
5469
- d.value = !d.value, d.value && o.value === null && (o.value = yt()), p.value = d.value ? Nt(L.value, E.value?.language ?? null) : -1;
5470
- }, oe = (e) => {
5471
- let t = Ot(e);
5472
- f.value = e, p.value = Nt(t, e.trim() ? null : E.value?.language ?? null);
5473
- }, se = (t) => {
5483
+ Ct(e.editor, E.value.pos, t) && (t === "mermaid" && wt(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());
5484
+ }, V = () => {
5485
+ d.value = !d.value, d.value && o.value === null && (o.value = kt()), p.value = d.value ? Ut(L.value, E.value?.language ?? null) : -1;
5486
+ }, se = (e) => {
5487
+ let t = Rt(e);
5488
+ f.value = e, p.value = Ut(t, e.trim() ? null : E.value?.language ?? null);
5489
+ }, ce = (t) => {
5474
5490
  if (!t.isComposing) {
5475
5491
  if (t.key === "ArrowDown" || t.key === "ArrowUp") {
5476
- t.preventDefault(), p.value = zt(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
5492
+ t.preventDefault(), p.value = Yt(p.value, L.value.length, t.key === "ArrowUp" ? "previous" : "next");
5477
5493
  return;
5478
5494
  }
5479
5495
  if (t.key === "Enter") {
5480
5496
  let e = L.value[p.value];
5481
- e && (t.preventDefault(), ie(e.language));
5497
+ e && (t.preventDefault(), oe(e.language));
5482
5498
  return;
5483
5499
  }
5484
5500
  t.key === "Escape" && (t.preventDefault(), d.value = !1, p.value = -1, e.editor.view.focus());
5485
5501
  }
5486
- }, ce = () => {
5487
- e.readOnly || !E.value || ft(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
5488
5502
  }, le = () => {
5503
+ e.readOnly || !E.value || St(e.editor, E.value.pos, !k.value) && (b.value += 1, S.value += 1, s.value = null);
5504
+ }, H = () => {
5489
5505
  if (!E.value) return;
5490
- let t = Ft(e.editor, E.value.pos);
5491
- t && ue({
5506
+ let t = Gt(e.editor, E.value.pos);
5507
+ t && de({
5492
5508
  data: new Blob([t], { type: "image/svg+xml" }),
5493
5509
  fileName: "markweave-mermaid.svg",
5494
5510
  onSettled: () => e.editor.view.focus(),
5495
5511
  ownerDocument: document
5496
5512
  });
5497
- }, de = () => {
5513
+ }, ue = () => {
5498
5514
  if (!E.value) return;
5499
- let t = Ft(e.editor, E.value.pos);
5500
- t && (g.value = xt(t), _.value = null, v.value = !1, y.value = {
5515
+ let t = Gt(e.editor, E.value.pos);
5516
+ t && (g.value = jt(t), _.value = null, v.value = !1, y.value = {
5501
5517
  active: !1,
5502
5518
  lastX: 0,
5503
5519
  lastY: 0
@@ -5505,16 +5521,16 @@ var vs = J({
5505
5521
  }, fe = (e) => {
5506
5522
  g.value = g.value ? {
5507
5523
  ...g.value,
5508
- scale: gt(g.value.scale + e)
5524
+ scale: Et(g.value.scale + e)
5509
5525
  } : null;
5510
5526
  }, pe = () => {
5511
- g.value = g.value ? xt(g.value.svg) : null, y.value = {
5527
+ g.value = g.value ? jt(g.value.svg) : null, y.value = {
5512
5528
  active: !1,
5513
5529
  lastX: 0,
5514
5530
  lastY: 0
5515
5531
  }, v.value = !1;
5516
5532
  }, me = (e) => {
5517
- e.preventDefault(), fe(e.deltaY < 0 ? Rt : -Rt);
5533
+ e.preventDefault(), fe(e.deltaY < 0 ? Jt : -Jt);
5518
5534
  }, he = (e) => {
5519
5535
  e.button === 0 && (e.preventDefault(), y.value = {
5520
5536
  active: !0,
@@ -5529,7 +5545,7 @@ var vs = J({
5529
5545
  active: !0,
5530
5546
  lastX: e.clientX,
5531
5547
  lastY: e.clientY
5532
- }, g.value = Bt(g.value, n, r);
5548
+ }, g.value = Xt(g.value, n, r);
5533
5549
  }, _e = () => {
5534
5550
  y.value = {
5535
5551
  active: !1,
@@ -5537,26 +5553,26 @@ var vs = J({
5537
5553
  lastY: 0
5538
5554
  }, v.value = !1;
5539
5555
  };
5540
- K(() => e.readOnly, (e) => {
5556
+ q(() => e.readOnly, (e) => {
5541
5557
  e && (d.value = !1, f.value = "");
5542
- }), K(R, () => {
5543
- z(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
5544
- }), K(d, async (e) => {
5558
+ }), q(te, () => {
5559
+ R(null), d.value = !1, f.value = "", p.value = -1, g.value = null, _.value = null, v.value = !1;
5560
+ }), q(d, async (e) => {
5545
5561
  if (!e) {
5546
5562
  p.value = -1;
5547
5563
  return;
5548
5564
  }
5549
- await q(), H(), i.value?.focus({ preventScroll: !0 });
5550
- }), K(() => [
5565
+ await J(), B(), i.value?.focus({ preventScroll: !0 });
5566
+ }), q(() => [
5551
5567
  d.value,
5552
5568
  f.value,
5553
5569
  p.value
5554
5570
  ], async () => {
5555
5571
  if (!d.value || p.value < 0) return;
5556
- await q();
5572
+ await J();
5557
5573
  let e = a.value, t = e?.querySelector(`[data-language-index="${p.value}"]`);
5558
- e && t && Vt(e, t);
5559
- }, { flush: "post" }), K(() => [
5574
+ e && t && Zt(e, t);
5575
+ }, { flush: "post" }), q(() => [
5560
5576
  A.value,
5561
5577
  b.value,
5562
5578
  E.value?.pos ?? null,
@@ -5564,29 +5580,29 @@ var vs = J({
5564
5580
  d.value,
5565
5581
  P.value
5566
5582
  ], async () => {
5567
- await q(), H();
5583
+ await J(), B();
5568
5584
  }, {
5569
5585
  flush: "post",
5570
5586
  immediate: !0
5571
- }), K(ee, async () => {
5572
- await q(), V(), window.requestAnimationFrame(V);
5587
+ }), q(ee, async () => {
5588
+ await J(), z(), window.requestAnimationFrame(z);
5573
5589
  }, {
5574
5590
  flush: "post",
5575
5591
  immediate: !0
5576
5592
  });
5577
5593
  let ve = null;
5578
- return Sr(() => {
5579
- q(() => {
5594
+ return jr(() => {
5595
+ J(() => {
5580
5596
  let n = e.editor.view.dom.closest(".markweave-editor-frame"), r = (n) => {
5581
5597
  if (n.target instanceof Node && t.value?.contains(n.target) || d.value) return;
5582
- let r = At(e.editor, n.target), i = jt(e.editor, r), a = i && !It(e.editor, i) ? i.pos : null;
5598
+ let r = Bt(e.editor, n.target), i = Vt(e.editor, r), a = i && !Kt(e.editor, i) ? i.pos : null;
5583
5599
  s.value = s.value === a ? s.value : a;
5584
5600
  }, i = () => {
5585
5601
  d.value || (s.value = null);
5586
5602
  }, a = (t) => {
5587
5603
  if (t.key === "Escape") {
5588
5604
  if (g.value) {
5589
- B();
5605
+ re();
5590
5606
  return;
5591
5607
  }
5592
5608
  d.value && (d.value = !1, p.value = -1, e.editor.view.focus());
@@ -5594,14 +5610,14 @@ var vs = J({
5594
5610
  }, o = (e) => {
5595
5611
  d.value && (e.target instanceof Node && t.value?.contains(e.target) || (d.value = !1, p.value = -1));
5596
5612
  }, c = ({ transaction: e }) => {
5597
- e.getMeta(st) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(st) || tn(e)) && (S.value += 1);
5613
+ e.getMeta(_t) && (b.value += 1), (e.docChanged || e.selectionSet || e.getMeta(_t) || fn(e)) && (S.value += 1);
5598
5614
  };
5599
- n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", H), window.addEventListener("scroll", H, !0), window.addEventListener("resize", V), window.addEventListener("scroll", V, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ve = () => {
5600
- n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", H), window.removeEventListener("scroll", H, !0), window.removeEventListener("resize", V), window.removeEventListener("scroll", V, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), te();
5615
+ n?.addEventListener("mousemove", r), n?.addEventListener("mouseleave", i), window.addEventListener("resize", B), window.addEventListener("scroll", B, !0), window.addEventListener("resize", z), window.addEventListener("scroll", z, !0), document.addEventListener("keydown", a), document.addEventListener("mousedown", o), e.editor.on("transaction", c), ve = () => {
5616
+ n?.removeEventListener("mousemove", r), n?.removeEventListener("mouseleave", i), window.removeEventListener("resize", B), window.removeEventListener("scroll", B, !0), window.removeEventListener("resize", z), window.removeEventListener("scroll", z, !0), document.removeEventListener("keydown", a), document.removeEventListener("mousedown", o), e.editor.off("transaction", c), ne();
5601
5617
  };
5602
5618
  });
5603
- }), Cr(() => {
5604
- ve?.(), ve = null, te();
5619
+ }), Mr(() => {
5620
+ ve?.(), ve = null, ne();
5605
5621
  }), () => {
5606
5622
  if (!A.value && I.value.length === 0 && !g.value) return null;
5607
5623
  let s = c.value ? {
@@ -5635,7 +5651,7 @@ var vs = J({
5635
5651
  "data-testid": `markweave-mermaid-mode-${t}`,
5636
5652
  "data-active": e.mermaidPreviewMode === t ? "true" : "false",
5637
5653
  onMousedown: $,
5638
- onClick: () => re(e, t)
5654
+ onClick: () => ae(e, t)
5639
5655
  }, t === "code" ? "Code" : "Preview")));
5640
5656
  }),
5641
5657
  A.value && E.value ? U("div", {
@@ -5660,8 +5676,8 @@ var vs = J({
5660
5676
  "aria-haspopup": "listbox",
5661
5677
  "data-testid": "markweave-codeblock-language",
5662
5678
  onMousedown: $,
5663
- onClick: ae
5664
- }, [U("span", null, M.value), ds("chevron")]),
5679
+ onClick: V
5680
+ }, [U("span", null, M.value), xs("chevron")]),
5665
5681
  j.value ? U("button", {
5666
5682
  type: "button",
5667
5683
  class: "markweave-codeblock-icon-button markweave-codeblock-collapse-button",
@@ -5670,8 +5686,8 @@ var vs = J({
5670
5686
  "data-testid": "markweave-codeblock-collapse",
5671
5687
  "data-collapsed": k.value ? "true" : "false",
5672
5688
  onMousedown: $,
5673
- onClick: ce
5674
- }, [ds("chevron")]) : null,
5689
+ onClick: le
5690
+ }, [xs("chevron")]) : null,
5675
5691
  U("span", { class: "markweave-codeblock-copy-wrap" }, [U("button", {
5676
5692
  type: "button",
5677
5693
  class: "markweave-codeblock-icon-button",
@@ -5692,9 +5708,9 @@ var vs = J({
5692
5708
  h.value = !1;
5693
5709
  },
5694
5710
  onClick: () => {
5695
- ne();
5711
+ ie();
5696
5712
  }
5697
- }, [ds(N.value === "copied" ? "check" : "clipboard")]), h.value ? U("span", {
5713
+ }, [xs(N.value === "copied" ? "check" : "clipboard")]), h.value ? U("span", {
5698
5714
  class: "markweave-codeblock-tooltip",
5699
5715
  role: "tooltip",
5700
5716
  "data-testid": "markweave-codeblock-copy-tooltip"
@@ -5709,16 +5725,16 @@ var vs = J({
5709
5725
  "data-testid": "markweave-mermaid-fullscreen",
5710
5726
  disabled: !F.value,
5711
5727
  onMousedown: $,
5712
- onClick: de
5713
- }, [ds("expand")]), U("button", {
5728
+ onClick: ue
5729
+ }, [xs("expand")]), U("button", {
5714
5730
  type: "button",
5715
5731
  class: "markweave-codeblock-icon-button",
5716
5732
  "aria-label": "Download Mermaid SVG",
5717
5733
  "data-testid": "markweave-mermaid-download",
5718
5734
  disabled: !F.value,
5719
5735
  onMousedown: $,
5720
- onClick: le
5721
- }, [ds("download")])]) : null
5736
+ onClick: H
5737
+ }, [xs("download")])]) : null
5722
5738
  ]) : null,
5723
5739
  j.value && A.value && d.value && E.value ? U("div", {
5724
5740
  ref: r,
@@ -5732,16 +5748,16 @@ var vs = J({
5732
5748
  "aria-autocomplete": "list",
5733
5749
  "aria-controls": o.value ?? void 0,
5734
5750
  "aria-expanded": "true",
5735
- "aria-activedescendant": o.value && L.value[p.value] ? kt(o.value, L.value[p.value].language) : void 0,
5751
+ "aria-activedescendant": o.value && L.value[p.value] ? zt(o.value, L.value[p.value].language) : void 0,
5736
5752
  "aria-label": "Search code block languages",
5737
5753
  value: f.value,
5738
5754
  placeholder: "Search...",
5739
5755
  "data-testid": "markweave-codeblock-language-search",
5740
5756
  onInput: (e) => {
5741
- oe(e.target.value);
5757
+ se(e.target.value);
5742
5758
  },
5743
- onKeydown: se
5744
- }), ds("search")]), U("div", {
5759
+ onKeydown: ce
5760
+ }), xs("search")]), U("div", {
5745
5761
  ref: a,
5746
5762
  id: o.value ?? void 0,
5747
5763
  class: "markweave-codeblock-language-list",
@@ -5751,7 +5767,7 @@ var vs = J({
5751
5767
  let n = E.value?.language === e.language, r = t === p.value;
5752
5768
  return U("button", {
5753
5769
  key: e.language,
5754
- id: o.value ? kt(o.value, e.language) : void 0,
5770
+ id: o.value ? zt(o.value, e.language) : void 0,
5755
5771
  type: "button",
5756
5772
  role: "option",
5757
5773
  "aria-selected": n ? "true" : "false",
@@ -5763,8 +5779,8 @@ var vs = J({
5763
5779
  onMouseenter: () => {
5764
5780
  p.value = t;
5765
5781
  },
5766
- onClick: () => ie(e.language)
5767
- }, [U("span", null, e.label), n ? ds("check") : null]);
5782
+ onClick: () => oe(e.language)
5783
+ }, [U("span", null, e.label), n ? xs("check") : null]);
5768
5784
  }))]) : null,
5769
5785
  g.value ? U("div", {
5770
5786
  class: "markweave-mermaid-fullscreen-layer",
@@ -5794,12 +5810,12 @@ var vs = J({
5794
5810
  onBlur: () => {
5795
5811
  _.value = null;
5796
5812
  },
5797
- onClick: () => fe(-Rt)
5798
- }, [ds("zoomOut")]),
5813
+ onClick: () => fe(-Jt)
5814
+ }, [xs("zoomOut")]),
5799
5815
  U("span", {
5800
5816
  class: "markweave-mermaid-fullscreen-zoom-label",
5801
5817
  "data-testid": "markweave-mermaid-fullscreen-zoom-label"
5802
- }, Tt(g.value.scale)),
5818
+ }, Ft(g.value.scale)),
5803
5819
  U("button", {
5804
5820
  type: "button",
5805
5821
  class: "markweave-mermaid-fullscreen-control",
@@ -5817,8 +5833,8 @@ var vs = J({
5817
5833
  onBlur: () => {
5818
5834
  _.value = null;
5819
5835
  },
5820
- onClick: () => fe(Rt)
5821
- }, [ds("zoomIn")]),
5836
+ onClick: () => fe(Jt)
5837
+ }, [xs("zoomIn")]),
5822
5838
  U("button", {
5823
5839
  type: "button",
5824
5840
  class: "markweave-mermaid-fullscreen-control",
@@ -5837,7 +5853,7 @@ var vs = J({
5837
5853
  _.value = null;
5838
5854
  },
5839
5855
  onClick: pe
5840
- }, [ds("reset")]),
5856
+ }, [xs("reset")]),
5841
5857
  _.value ? U("span", {
5842
5858
  class: "markweave-mermaid-fullscreen-tooltip",
5843
5859
  role: "tooltip",
@@ -5849,8 +5865,8 @@ var vs = J({
5849
5865
  class: "markweave-mermaid-fullscreen-close",
5850
5866
  "aria-label": "Close fullscreen Mermaid preview",
5851
5867
  "data-testid": "markweave-mermaid-fullscreen-close",
5852
- onClick: B
5853
- }, [ds("close")]),
5868
+ onClick: re
5869
+ }, [xs("close")]),
5854
5870
  U("div", {
5855
5871
  class: "markweave-mermaid-fullscreen-viewport",
5856
5872
  "data-testid": "markweave-mermaid-fullscreen-viewport",
@@ -5876,7 +5892,7 @@ var vs = J({
5876
5892
  ]);
5877
5893
  };
5878
5894
  }
5879
- }), Es = J({
5895
+ }), Is = Y({
5880
5896
  name: "MarkweaveVueInnerToc",
5881
5897
  props: {
5882
5898
  editor: {
@@ -5902,20 +5918,20 @@ var vs = J({
5902
5918
  },
5903
5919
  setup(e) {
5904
5920
  let t = W(null), n, r, i = () => {
5905
- n?.(), n = e.placement === "container" && t.value ? it(t.value) : void 0;
5921
+ n?.(), n = e.placement === "container" && t.value ? mt(t.value) : void 0;
5906
5922
  }, a = () => {
5907
- r?.(), r = t.value && e.state.items.length ? at(t.value, e.state.items.length) : void 0;
5923
+ r?.(), r = t.value && e.state.items.length ? ht(t.value, e.state.items.length) : void 0;
5908
5924
  };
5909
- return Sr(() => {
5925
+ return jr(() => {
5910
5926
  i(), a();
5911
- }), Cr(() => {
5927
+ }), Mr(() => {
5912
5928
  n?.(), r?.();
5913
- }), K(() => e.placement, i), K(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? U("nav", {
5929
+ }), q(() => e.placement, i), q(() => e.state.items.length, a, { flush: "post" }), () => e.state.items.length ? U("nav", {
5914
5930
  ref: t,
5915
5931
  class: "markweave-inner-toc",
5916
5932
  "data-testid": "markweave-inner-toc",
5917
5933
  "aria-label": e.messages.toc.ariaLabel,
5918
- style: { "--markweave-inner-toc-rail-height": et(e.state.items.length) }
5934
+ style: { "--markweave-inner-toc-rail-height": ut(e.state.items.length) }
5919
5935
  }, [U("div", {
5920
5936
  class: "markweave-inner-toc-rail",
5921
5937
  "aria-hidden": "true"
@@ -5932,89 +5948,111 @@ var vs = J({
5932
5948
  "aria-current": t.active ? "location" : void 0,
5933
5949
  "aria-label": `${e.messages.toc.itemAriaLabel}: ${t.text}`,
5934
5950
  title: t.text,
5935
- onClick: () => ot(e.editor, t, {
5951
+ onClick: () => gt(e.editor, t, {
5936
5952
  behavior: "smooth",
5937
5953
  focus: e.editable
5938
5954
  })
5939
5955
  }, t.text)))])]) : null;
5940
5956
  }
5941
5957
  });
5942
- function Ds(e = {}) {
5943
- let r = n(e.lang), a = t(r), o = G(() => Sn({
5958
+ function Ls(e = {}) {
5959
+ let r = n(e.lang), a = t(r), o = K(() => Mn({
5944
5960
  lang: r,
5945
5961
  commandGroups: e.commandGroups,
5946
5962
  commands: e.commands,
5947
5963
  builtinCommands: e.builtinCommands
5948
- })), s = W(d(e.mode)), c = G(() => je(e.theme)), l = G(() => s.value === "live" && e.editable !== !1), u = W(0), p = xr(null), m = W(Cn), h = xr(null), g = xr(null), _ = W(null), v = W("code"), y = xr(null), b = xr(jn), x = W(null), S = W(!1), C = xr(null), w = ge(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = typeof T == "string" && T.length >= 2e5, D = null;
5949
- function O() {
5950
- D !== null && (window.clearTimeout(D), D = null), u.value += 1;
5964
+ })), s = W(d(e.mode)), c = K(() => Be(e.theme)), l = W(0), u = G({
5965
+ state: "idle",
5966
+ pendingVisualWork: 0
5967
+ }), p = G(null), m = W(Nn), h = G(null), g = G(null), _ = W(null), v = W("code"), y = G(null), b = G(Vn), x = W(null), S = W(!1), C = G(null), w = ve(e.content === void 0 ? e.defaultContentFormat : e.contentFormat), T = e.content ?? e.defaultContent ?? "", E = e.performancePolicy ?? "auto", D = Ne(T, E), O = G(De({
5968
+ phase: D ? "parsing" : "ready",
5969
+ tier: E === "auto" ? Oe(T) >= 2e5 ? "large" : "standard" : E,
5970
+ progress: D ? null : 1
5971
+ })), k = K(() => s.value === "live" && e.editable !== !1 && O.value.phase === "ready"), A = K(() => O.value.tier !== "standard" || D), j = null, M = null;
5972
+ function N(e, t) {
5973
+ let n = je(e.state.doc, t ?? e.state.doc.content.size);
5974
+ O.value = {
5975
+ ...O.value,
5976
+ tier: Me(n, E),
5977
+ profile: n
5978
+ }, P(e);
5979
+ }
5980
+ function P(e) {
5981
+ e.view.dom.setAttribute("data-markweave-large-document", O.value.tier === "standard" ? "false" : "true"), e.view.dom.setAttribute("data-markweave-performance-tier", O.value.tier);
5951
5982
  }
5952
- function k() {
5953
- D !== null && window.clearTimeout(D), D = window.setTimeout(() => {
5954
- D = null, u.value += 1;
5955
- }, Oe);
5983
+ function F() {
5984
+ j !== null && (window.clearTimeout(j), j = null), l.value += 1;
5956
5985
  }
5957
- let A = e.onSlashCommandUpload, j = xr(null), M = !1;
5958
- j.value = new i({
5959
- extensions: da({
5986
+ function I() {
5987
+ j !== null && window.clearTimeout(j), j = window.setTimeout(() => {
5988
+ j = null, l.value += 1;
5989
+ }, Le);
5990
+ }
5991
+ let ee = e.onSlashCommandUpload, L = G(null), te = !1;
5992
+ L.value = new i({
5993
+ extensions: ba({
5960
5994
  lang: r,
5961
5995
  revealLinkMarkdown: e.revealLinkMarkdown !== !1,
5962
5996
  linkCardResolver: e.linkCardResolver,
5963
- onImageUpload: (e) => A?.(e) ?? V(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
5964
- onVideoUpload: (e) => A?.(e) ?? V(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
5965
- onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ?? V(t) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
5997
+ onImageUpload: (e) => ee?.(e) ?? z(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
5998
+ onVideoUpload: (e) => ee?.(e) ?? z(e) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
5999
+ onAttachmentUpload: (t) => e.onSlashCommandUpload?.(t) ?? z(t) ?? Promise.reject(/* @__PURE__ */ Error("File upload requires an upload handler.")),
5966
6000
  onAttachmentDownload: (t, n) => e.onAttachmentDownload?.(t, n),
5967
6001
  resolveMediaSource: e.resolveMediaSource,
5968
6002
  tableCapabilities: (t) => e.tableCapabilities?.(t),
6003
+ referenceSuggestion: e.referenceSuggestion,
6004
+ internalLinkCard: e.internalLinkCard,
5969
6005
  editorExtensions: e.editorExtensions
5970
6006
  }),
5971
- content: T,
5972
- contentType: pe(w),
5973
- editable: l.value,
5974
- autofocus: e.autofocus,
6007
+ content: D ? "" : T,
6008
+ contentType: he(w),
6009
+ editable: k.value,
6010
+ autofocus: D ? !1 : e.autofocus,
5975
6011
  editorProps: {
5976
6012
  attributes: {
5977
6013
  class: "markweave-editor-surface",
5978
6014
  "data-testid": "markweave-editor-surface",
5979
- "data-markweave-large-document": E ? "true" : "false",
6015
+ "data-markweave-large-document": A.value ? "true" : "false",
5980
6016
  autocapitalize: "off",
5981
6017
  autocorrect: "off",
5982
6018
  spellcheck: "false",
5983
6019
  translate: "no"
5984
6020
  },
5985
6021
  handleClick: (e, t, n) => {
5986
- if (!l.value) return !1;
5987
- let r = Yt(e, n);
5988
- return r ? (n.preventDefault(), n.stopPropagation(), R(), $t(e, r, !0), en(e, r), y.value = r, !0) : (y.value = null, !1);
6022
+ if (!k.value) return !1;
6023
+ let r = on(e, n);
6024
+ return r ? (n.preventDefault(), n.stopPropagation(), H(), un(e, r, !0), dn(e, r), y.value = r, !0) : (y.value = null, !1);
5989
6025
  },
5990
6026
  handleDOMEvents: {
5991
- compositionstart: () => l.value ? (m.value = wn(m.value, { type: "composition-start" }), h.value = null, !1) : !1,
5992
- compositionend: (e) => (l.value && window.setTimeout(() => te(e), 0), !1),
6027
+ compositionstart: () => k.value ? (m.value = Pn(m.value, { type: "composition-start" }), h.value = null, !1) : !1,
6028
+ compositionend: (e) => (k.value && window.setTimeout(() => de(e), 0), !1),
5993
6029
  click: (e, t) => {
5994
- if (!l.value) return !1;
5995
- let n = Yt(e, t);
5996
- return n ? (t.preventDefault(), t.stopPropagation(), R(), $t(e, n, !0), en(e, n), y.value = n, !0) : (y.value = null, !1);
6030
+ if (!k.value) return !1;
6031
+ let n = on(e, t);
6032
+ return n ? (t.preventDefault(), t.stopPropagation(), H(), un(e, n, !0), dn(e, n), y.value = n, !0) : (y.value = null, !1);
5997
6033
  }
5998
6034
  }
5999
6035
  },
6000
- onSelectionUpdate: ({ editor: e }) => B(e),
6036
+ onSelectionUpdate: ({ editor: e }) => be(e),
6001
6037
  onCreate: ({ editor: t }) => {
6002
- xn(t, o.value, (t) => {
6038
+ jn(t, o.value, (t) => {
6003
6039
  _.value = t.message, e.onCommandError?.(t);
6004
- }), bn(t, w), M = !0, e.onCommandControllerChange?.(vn(t)), f(t, {
6040
+ }), An(t, w), te = !0, e.onCommandControllerChange?.(On(t)), f(t, {
6005
6041
  mode: s.value,
6006
- editable: l.value
6007
- }), nn(t, c.value), rn(t, l.value ? "live" : "view"), e.autoFocusFirstTableBodyCell && l.value && On(t), H(t), B(t), O();
6042
+ editable: k.value
6043
+ }), pn(t, c.value), mn(t, k.value ? "live" : "view"), !D && e.autoFocusFirstTableBodyCell && k.value && Rn(t), xe(t), be(t), F();
6008
6044
  },
6009
6045
  onTransaction: ({ editor: e, transaction: t }) => {
6010
- if (H(e), (t.docChanged || tn(t)) && k(), t.docChanged && y.value) {
6011
- let t = Jt(e, y.value.pos);
6046
+ if (!ke(t) && (xe(e), (t.docChanged || fn(t)) && I(), t.docChanged && O.value.phase === "ready" && (M !== null && window.clearTimeout(M), M = window.setTimeout(() => {
6047
+ M = null, N(e);
6048
+ }, 250)), t.docChanged && y.value)) {
6049
+ let t = an(e, y.value.pos);
6012
6050
  y.value = t?.kind === y.value.kind ? t : null;
6013
6051
  }
6014
6052
  },
6015
6053
  onUpdate: ({ editor: t }) => {
6016
- B(t), l.value && z(t), S.value || e.onUpdate?.(fe(t, { onContentRead: (n, r) => {
6017
- let i = ge(e.contentFormat);
6054
+ be(t), k.value && ye(t), S.value || e.onUpdate?.(me(t, { onContentRead: (n, r) => {
6055
+ let i = ve(e.contentFormat);
6018
6056
  e.content !== void 0 && n === i && (C.value = {
6019
6057
  content: r,
6020
6058
  format: n,
@@ -6023,126 +6061,157 @@ function Ds(e = {}) {
6023
6061
  } }));
6024
6062
  }
6025
6063
  });
6026
- let N = j.value;
6027
- xn(N, o.value, (t) => {
6064
+ let ne = L.value;
6065
+ jn(ne, o.value, (t) => {
6028
6066
  _.value = t.message, e.onCommandError?.(t);
6029
- }), bn(N, w), K(o, (t) => {
6030
- j.value && xn(j.value, t, (t) => {
6067
+ }), An(ne, w), q(o, (t) => {
6068
+ L.value && jn(L.value, t, (t) => {
6031
6069
  _.value = t.message, e.onCommandError?.(t);
6032
6070
  });
6033
- }), K(() => [e.content === void 0 ? e.defaultContentFormat : e.contentFormat, e.content], () => {
6034
- j.value && bn(j.value, ge(e.content === void 0 ? e.defaultContentFormat : e.contentFormat));
6071
+ }), q(() => [e.content === void 0 ? e.defaultContentFormat : e.contentFormat, e.content], () => {
6072
+ L.value && An(L.value, ve(e.content === void 0 ? e.defaultContentFormat : e.contentFormat));
6035
6073
  });
6036
- let P = j.value, F = Me(P), I = !1, ee = !1;
6037
- q(() => {
6038
- I || j.value !== P || (ee = !0, e.onAiEditControllerChange?.(F));
6074
+ let R = L.value, re = Ve(R), B = !1, ie = !1;
6075
+ J(() => {
6076
+ B || L.value !== R || (ie = !0, e.onAiEditControllerChange?.(re));
6039
6077
  });
6040
- let L = G(() => j.value ?? null);
6041
- function R() {
6042
- h.value = null, g.value = null, m.value = Cn;
6078
+ let ae = He(R), oe = !1;
6079
+ J(() => {
6080
+ B || L.value !== R || (oe = !0, e.onSearchControllerChange?.(ae));
6081
+ });
6082
+ let V = K(() => L.value ?? null), se = null, ce = () => void 0;
6083
+ q(V, (e) => {
6084
+ ce(), se?.destroy(), se = e ? pe(e) : null, ce = se?.subscribe((e) => {
6085
+ u.value = e;
6086
+ }) ?? (() => void 0);
6087
+ }, { immediate: !0 });
6088
+ let le = D ? new AbortController() : null;
6089
+ D && L.value && le ? (S.value = !0, Ae(L.value, {
6090
+ content: T,
6091
+ format: w,
6092
+ performancePolicy: E,
6093
+ allowProgressiveMount: !e.editorExtensions?.length || e.editorExtensionsLoadPolicy === "transactional-safe",
6094
+ allowBuiltInMarkdownWorker: !e.editorExtensions?.length,
6095
+ signal: le.signal,
6096
+ onStateChange: (t) => {
6097
+ O.value = t, L.value && P(L.value), e.onDocumentLoadStateChange?.(t);
6098
+ }
6099
+ }).then(() => {
6100
+ le.signal.aborted || !L.value || (be(L.value), xe(L.value), F(), e.autoFocusFirstTableBodyCell && k.value ? Rn(L.value) : e.autofocus && k.value && L.value.commands.focus("start", { scrollIntoView: !1 }));
6101
+ }).catch(() => void 0).finally(() => {
6102
+ le.signal.aborted || (S.value = !1);
6103
+ })) : (L.value && N(L.value, Oe(T)), e.onDocumentLoadStateChange?.(O.value));
6104
+ function H() {
6105
+ h.value = null, g.value = null, m.value = Nn;
6043
6106
  }
6044
- function te(e) {
6045
- let t = hn(e.state);
6107
+ function de(e) {
6108
+ let t = Tn(e.state);
6046
6109
  if (!t) {
6047
- m.value = m.value.name === "idle" ? m.value : Cn, h.value = null, g.value = null;
6110
+ m.value = m.value.name === "idle" ? m.value : Nn, h.value = null, g.value = null;
6048
6111
  return;
6049
6112
  }
6050
6113
  let n = e.coordsAtPos(t.cursor), r = e.coordsAtPos(t.triggerFrom), i = e.dom.closest(".markweave-editor-frame")?.getBoundingClientRect();
6051
- if (!_n(r, { frameRect: i })) {
6052
- R();
6114
+ if (!Dn(r, { frameRect: i })) {
6115
+ H();
6053
6116
  return;
6054
6117
  }
6055
- let a = mn(n, {
6118
+ let a = wn(n, {
6056
6119
  frameRect: i,
6057
6120
  triggerRect: r
6058
6121
  });
6059
- fn(h.value, a) || (h.value = a), m.value = pn(m.value, t);
6122
+ Sn(h.value, a) || (h.value = a), m.value = Cn(m.value, t);
6060
6123
  }
6061
- function z(e) {
6062
- te(e.view);
6124
+ function ye(e) {
6125
+ de(e.view);
6063
6126
  }
6064
- function B(e) {
6065
- let t = De(e);
6066
- Te(p.value, t) || (p.value = t);
6067
- let n = Xt(e);
6068
- n && (Qt(e, n, !0), y.value = n);
6069
- let r = lt(e);
6127
+ function be(e) {
6128
+ let t = Ie(e);
6129
+ Pe(p.value, t) || (p.value = t);
6130
+ let n = sn(e);
6131
+ n && (ln(e, n, !0), y.value = n);
6132
+ let r = yt(e);
6070
6133
  r.active && r.language === "mermaid" && (v.value = r.mermaidPreviewMode);
6071
6134
  }
6072
- function H(e) {
6073
- b.value = cs(e);
6135
+ function xe(e) {
6136
+ b.value = vs(e);
6074
6137
  }
6075
- let ne = G(() => L.value ? lt(L.value) : ss), re = G(() => L.value ? kn(L.value.state) : os), ie = G(() => p.value?.currentNode === "codeBlock"), ae = G(() => ie.value && ne.value.language === "mermaid"), oe = G(() => L.value ? on({
6076
- active: ae.value,
6138
+ let Se = K(() => V.value ? yt(V.value) : _s), Ce = K(() => V.value ? zn(V.value.state) : gs), we = K(() => p.value?.currentNode === "codeBlock"), Te = K(() => we.value && Se.value.language === "mermaid"), Fe = K(() => V.value ? gn({
6139
+ active: Te.value,
6077
6140
  mode: v.value,
6078
- source: ne.value.text
6079
- }) : on({
6141
+ source: Se.value.text
6142
+ }) : gn({
6080
6143
  active: !1,
6081
6144
  mode: "code",
6082
6145
  source: ""
6083
- })), se = G(() => L.value && e.onRuntimeStateChange ? Dn(L.value.state) : null), ce = G(() => L.value ? tt(L.value.state) : Qe.items), ue = G(() => nt(ce.value, x.value)), _e = G(() => Ze(ce.value, ue.value)), ve = G(() => {
6084
- u.value, p.value, l.value;
6085
- let e = L.value;
6086
- return sn(e ? vn(e).getCommands({
6146
+ })), Re = K(() => V.value && e.onRuntimeStateChange ? Ln(V.value.state) : null), ze = K(() => V.value ? dt(V.value.state) : ct.items), Ue = K(() => ft(ze.value, x.value)), We = K(() => st(ze.value, Ue.value)), Ge = K(() => {
6147
+ l.value, p.value, k.value;
6148
+ let e = V.value;
6149
+ return _n(e ? On(e).getCommands({
6087
6150
  surface: "slash",
6088
6151
  query: m.value.query
6089
6152
  }) : o.value.commands, r);
6090
- }), ye = G(() => we({
6091
- revision: u.value,
6153
+ }), Ke = K(() => Ee({
6154
+ revision: l.value,
6092
6155
  mode: s.value,
6093
- editable: l.value,
6094
- toc: _e.value,
6156
+ editable: k.value,
6157
+ toc: We.value,
6095
6158
  selection: p.value,
6096
6159
  slash: m.value,
6097
- table: re.value,
6160
+ table: Ce.value,
6098
6161
  tableInteraction: b.value,
6099
- codeBlock: ne.value,
6100
- mermaid: oe.value,
6101
- tableDebugSnapshot: se.value
6102
- })), be = {
6103
- closeSlashMenu: R,
6104
- focusFirstTableBodyCell: () => L.value ? On(L.value) : !1,
6162
+ codeBlock: Se.value,
6163
+ mermaid: Fe.value,
6164
+ tableDebugSnapshot: Re.value,
6165
+ performance: {
6166
+ tier: O.value.tier,
6167
+ loadPhase: O.value.phase,
6168
+ viewportState: u.value.state,
6169
+ pendingVisualWork: u.value.pendingVisualWork
6170
+ }
6171
+ })), qe = {
6172
+ closeSlashMenu: H,
6173
+ focusFirstTableBodyCell: () => V.value ? Rn(V.value) : !1,
6105
6174
  setContent: (e, t = {}) => {
6106
- if (!L.value) return !1;
6107
- let n = ge(t.format);
6108
- return L.value.commands.setContent(e, {
6109
- contentType: pe(n),
6175
+ if (!V.value) return !1;
6176
+ let n = ve(t.format);
6177
+ return V.value.commands.setContent(e, {
6178
+ contentType: he(n),
6110
6179
  emitUpdate: t.emitUpdate ?? !1
6111
- }), t.focusFirstTableBodyCell && On(L.value), B(L.value), l.value && z(L.value), H(L.value), O(), !0;
6180
+ }), t.focusFirstTableBodyCell && Rn(V.value), be(V.value), k.value && ye(V.value), xe(V.value), N(V.value, Oe(e)), F(), !0;
6112
6181
  }
6113
6182
  };
6114
- function xe(e, t) {
6115
- if (!L.value || !l.value || !ln(e)) return;
6183
+ function Je(e, t) {
6184
+ if (!V.value || !k.value || !yn(e)) return;
6116
6185
  if (e.inputKind && !t?.emoji && !t?.uploadResult) {
6117
6186
  g.value = e;
6118
6187
  return;
6119
6188
  }
6120
- let n = hn(L.value.state);
6189
+ let n = Tn(V.value.state);
6121
6190
  if (!n) return;
6122
- _.value = null, m.value = wn(m.value, { type: "execute" }), g.value = null;
6123
- let r = L.value;
6124
- yn(r, e.id, n, t).then((e) => {
6191
+ _.value = null, m.value = Pn(m.value, { type: "execute" }), g.value = null;
6192
+ let r = V.value;
6193
+ kn(r, e.id, n, t).then((e) => {
6125
6194
  if (e.ok && e.outcome === "applied") {
6126
- R();
6195
+ H();
6127
6196
  return;
6128
6197
  }
6129
- e.ok || (_.value = e.message), z(r), r.commands.focus();
6198
+ e.ok || (_.value = e.message), ye(r), r.commands.focus(void 0, { scrollIntoView: !1 });
6130
6199
  });
6131
6200
  }
6132
- function Se(e) {
6133
- if (!L.value || g.value || !l.value) return;
6201
+ function Ye(e) {
6202
+ if (!V.value || g.value || !k.value) return;
6134
6203
  if (m.value.name === "executing" && e.key === "Escape") {
6135
- e.preventDefault(), vn(L.value).cancel(), R();
6204
+ e.preventDefault(), On(V.value).cancel(), H();
6136
6205
  return;
6137
6206
  }
6138
- let t = un(m.value, ve.value, e.key, { isComposing: e.isComposing || le(L.value.state) });
6207
+ let t = bn(m.value, Ge.value, e.key, { isComposing: e.isComposing || ue(V.value.state) });
6139
6208
  if (t.type !== "ignore") {
6140
6209
  if (e.preventDefault(), t.type === "close") {
6141
- vn(L.value).cancel(), m.value = wn(m.value, { type: "escape" }), R();
6210
+ On(V.value).cancel(), m.value = Pn(m.value, { type: "escape" }), H();
6142
6211
  return;
6143
6212
  }
6144
6213
  if (t.type === "move-active") {
6145
- m.value = wn(m.value, {
6214
+ m.value = Pn(m.value, {
6146
6215
  type: "move-active",
6147
6216
  delta: t.delta,
6148
6217
  optionCount: t.optionCount
@@ -6150,102 +6219,115 @@ function Ds(e = {}) {
6150
6219
  return;
6151
6220
  }
6152
6221
  if (t.type === "set-active") {
6153
- m.value = wn(m.value, t);
6222
+ m.value = Pn(m.value, t);
6154
6223
  return;
6155
6224
  }
6156
- xe(t.command);
6225
+ Je(t.command);
6157
6226
  }
6158
6227
  }
6159
- K(() => [e.mode, e.editable], () => {
6160
- s.value = d(e.mode), L.value && (L.value.setEditable(l.value), f(L.value, {
6228
+ q(() => [
6229
+ e.mode,
6230
+ e.editable,
6231
+ O.value.phase
6232
+ ], () => {
6233
+ s.value = d(e.mode), V.value && (V.value.setEditable(k.value, !1), f(V.value, {
6161
6234
  mode: s.value,
6162
- editable: l.value
6163
- }), rn(L.value, l.value ? "live" : "view"), O(), l.value || R());
6164
- }, { immediate: !0 }), K(() => e.theme, () => {
6165
- L.value && nn(L.value, c.value);
6166
- }, { immediate: !0 }), K(() => e.content, (t) => {
6167
- let n = ge(e.contentFormat);
6168
- if (!(!L.value || t === void 0)) {
6169
- if (he(L.value, C.value, t, n)) {
6235
+ editable: k.value
6236
+ }), mn(V.value, k.value ? "live" : "view"), F(), k.value || H());
6237
+ }, { immediate: !0 }), q(() => e.theme, () => {
6238
+ V.value && pn(V.value, c.value);
6239
+ }, { immediate: !0 }), q(() => [e.content, O.value.phase], ([t]) => {
6240
+ let n = ve(e.contentFormat);
6241
+ if (!(!V.value || t === void 0) && !(D && ![
6242
+ "ready",
6243
+ "error",
6244
+ "cancelled"
6245
+ ].includes(O.value.phase))) {
6246
+ if (_e(V.value, C.value, t, n)) {
6170
6247
  C.value = null;
6171
6248
  return;
6172
6249
  }
6173
- C.value = null, !me(L.value, t, n) && (S.value = !0, L.value.commands.setContent(t, {
6174
- contentType: pe(n),
6250
+ C.value = null, !ge(V.value, t, n) && (S.value = !0, V.value.commands.setContent(t, {
6251
+ contentType: he(n),
6175
6252
  emitUpdate: !1
6176
- }), S.value = !1, B(L.value), l.value && z(L.value), H(L.value), O());
6253
+ }), S.value = !1, O.value.phase !== "ready" && (O.value = {
6254
+ ...O.value,
6255
+ phase: "ready",
6256
+ progress: 1,
6257
+ error: null
6258
+ }), be(V.value), k.value && ye(V.value), xe(V.value), N(V.value, Oe(t)), F());
6177
6259
  }
6178
- }), K(ye, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), K(_e, (t) => e.onTocChange?.(t), { immediate: !0 }), K(ce, (e) => {
6179
- let t = nt(e, x.value);
6260
+ }), q(Ke, (t) => e.onRuntimeStateChange?.(t), { immediate: !0 }), q(We, (t) => e.onTocChange?.(t), { immediate: !0 }), q(ze, (e) => {
6261
+ let t = ft(e, x.value);
6180
6262
  x.value !== t && (x.value = t);
6181
6263
  });
6182
- let Ce = de(() => {
6183
- L.value && h.value && te(L.value.view);
6184
- }), Ee = (e) => {
6185
- e?.type === "scroll" && gn(e.target) || h.value && Ce.schedule();
6264
+ let Xe = fe(() => {
6265
+ V.value && h.value && de(V.value.view);
6266
+ }), Ze = (e) => {
6267
+ e?.type === "scroll" && En(e.target) || h.value && Xe.schedule();
6186
6268
  };
6187
- K(h, (e) => {
6188
- e ? Ee() : Ce.cancel();
6189
- }), Sr(() => {
6190
- window.addEventListener("resize", Ee), window.addEventListener("scroll", Ee, !0);
6191
- }), Cr(() => {
6192
- Ce.cancel(), window.removeEventListener("resize", Ee), window.removeEventListener("scroll", Ee, !0);
6269
+ q(h, (e) => {
6270
+ e ? Ze() : Xe.cancel();
6271
+ }), jr(() => {
6272
+ window.addEventListener("resize", Ze), window.addEventListener("scroll", Ze, !0);
6273
+ }), Mr(() => {
6274
+ Xe.cancel(), window.removeEventListener("resize", Ze), window.removeEventListener("scroll", Ze, !0);
6193
6275
  });
6194
- let ke = null;
6195
- return Cr(() => {
6196
- D !== null && window.clearTimeout(D);
6197
- }), Sr(() => {
6276
+ let Qe = null;
6277
+ return Mr(() => {
6278
+ j !== null && window.clearTimeout(j), M !== null && window.clearTimeout(M), le?.abort(), ce(), se?.destroy();
6279
+ }), jr(() => {
6198
6280
  let e = () => {
6199
- if (!L.value || !ce.value.length) {
6281
+ if (!V.value || !ze.value.length) {
6200
6282
  x.value = null;
6201
6283
  return;
6202
6284
  }
6203
6285
  let e = null;
6204
6286
  try {
6205
- e = $e(L.value, ce.value);
6287
+ e = lt(V.value, ze.value);
6206
6288
  } catch {
6207
6289
  return;
6208
6290
  }
6209
6291
  x.value !== e && (x.value = e);
6210
- }, t = () => window.requestAnimationFrame(e), n = ls(L.value?.view.dom ?? null);
6211
- window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), ke = () => {
6292
+ }, t = () => window.requestAnimationFrame(e), n = ys(V.value?.view.dom ?? null);
6293
+ window.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), n?.addEventListener("scroll", t, { passive: !0 }), t(), Qe = () => {
6212
6294
  window.removeEventListener("scroll", t), window.removeEventListener("resize", t), n?.removeEventListener("scroll", t);
6213
6295
  };
6214
- }), Cr(() => {
6215
- ke?.(), I = !0, ee && e.onAiEditControllerChange?.(null), M && e.onCommandControllerChange?.(null);
6216
- let t = j.value;
6217
- j.value = null, q(() => t?.destroy());
6296
+ }), Mr(() => {
6297
+ Qe?.(), B = !0, ie && e.onAiEditControllerChange?.(null), oe && e.onSearchControllerChange?.(null), te && e.onCommandControllerChange?.(null);
6298
+ let t = L.value;
6299
+ L.value = null, J(() => t?.destroy());
6218
6300
  }), {
6219
- editor: L,
6220
- runtimeSnapshot: ye,
6221
- actions: be,
6301
+ editor: V,
6302
+ runtimeSnapshot: Ke,
6303
+ actions: qe,
6222
6304
  __render: {
6223
6305
  messages: a,
6224
- effectiveEditable: l,
6225
- tableFocusState: re,
6306
+ effectiveEditable: k,
6307
+ tableFocusState: Ce,
6226
6308
  tableInteractionState: b,
6227
- codeBlockState: ne,
6228
- isCodeBlockActive: ie,
6309
+ codeBlockState: Se,
6310
+ isCodeBlockActive: we,
6229
6311
  mermaidMode: v,
6230
6312
  mathTarget: y,
6231
6313
  setMermaidMode: (e) => {
6232
6314
  v.value = e;
6233
6315
  },
6234
- tocState: _e,
6235
- filteredSlashCommands: ve,
6316
+ tocState: We,
6317
+ filteredSlashCommands: Ge,
6236
6318
  slashState: m,
6237
6319
  slashMenuPosition: h,
6238
6320
  slashInputCommand: g,
6239
6321
  slashCommandError: _,
6240
- runSlashCommand: xe,
6241
- handleEditorKeyDown: Se,
6322
+ runSlashCommand: Je,
6323
+ handleEditorKeyDown: Ye,
6242
6324
  setSlashInputCommand: (e) => {
6243
6325
  g.value = e;
6244
6326
  }
6245
6327
  }
6246
6328
  };
6247
6329
  }
6248
- var Os = J({
6330
+ var Rs = Y({
6249
6331
  name: "MarkweaveEditor",
6250
6332
  props: {
6251
6333
  defaultContent: {
@@ -6292,6 +6374,18 @@ var Os = J({
6292
6374
  type: Boolean,
6293
6375
  default: !1
6294
6376
  },
6377
+ performancePolicy: {
6378
+ type: String,
6379
+ default: "auto"
6380
+ },
6381
+ editorExtensionsLoadPolicy: {
6382
+ type: String,
6383
+ default: "atomic"
6384
+ },
6385
+ onDocumentLoadStateChange: {
6386
+ type: Function,
6387
+ default: void 0
6388
+ },
6295
6389
  lang: {
6296
6390
  type: String,
6297
6391
  default: void 0
@@ -6316,6 +6410,14 @@ var Os = J({
6316
6410
  type: Function,
6317
6411
  default: void 0
6318
6412
  },
6413
+ referenceSuggestion: {
6414
+ type: Object,
6415
+ default: void 0
6416
+ },
6417
+ internalLinkCard: {
6418
+ type: Object,
6419
+ default: void 0
6420
+ },
6319
6421
  className: {
6320
6422
  type: String,
6321
6423
  default: void 0
@@ -6368,6 +6470,10 @@ var Os = J({
6368
6470
  type: Function,
6369
6471
  default: void 0
6370
6472
  },
6473
+ onSearchControllerChange: {
6474
+ type: Function,
6475
+ default: void 0
6476
+ },
6371
6477
  commandGroups: {
6372
6478
  type: Array,
6373
6479
  default: void 0
@@ -6398,36 +6504,38 @@ var Os = J({
6398
6504
  }
6399
6505
  },
6400
6506
  setup(e) {
6401
- let t = Ds(e);
6507
+ let t = Ls(e);
6402
6508
  return () => {
6403
6509
  let r = t.editor.value;
6404
6510
  if (!r) return null;
6405
- let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = Ae(e.canvasColor);
6511
+ let i = t.__render, o = ["markweave-editor-frame", e.className].filter(Boolean).join(" "), s = ze(e.canvasColor);
6406
6512
  return U("section", {
6407
6513
  class: o,
6408
- role: "combobox",
6514
+ role: i.slashMenuPosition.value !== null && i.slashState.value.name !== "executing" ? "combobox" : void 0,
6409
6515
  "aria-label": e.ariaLabel ?? i.messages.common.editorAriaLabel,
6410
6516
  "aria-expanded": i.slashMenuPosition.value !== null && i.slashState.value.name !== "executing",
6411
- "aria-controls": "markweave-slash-command-listbox",
6412
- "aria-activedescendant": i.filteredSlashCommands.value.length && i.slashState.value.name !== "executing" ? `markweave-slash-command-option-${Math.min(i.filteredSlashCommands.value.length - 1, Math.max(0, i.slashState.value.activeIndex))}` : void 0,
6413
- "aria-busy": i.slashState.value.name === "executing",
6517
+ "aria-controls": i.slashMenuPosition.value !== null && i.slashState.value.name !== "executing" ? "markweave-slash-command-listbox" : void 0,
6518
+ "aria-activedescendant": i.slashMenuPosition.value !== null && i.filteredSlashCommands.value.length && i.slashState.value.name !== "executing" ? `markweave-slash-command-option-${Math.min(i.filteredSlashCommands.value.length - 1, Math.max(0, i.slashState.value.activeIndex))}` : void 0,
6519
+ "aria-busy": t.runtimeSnapshot.value.performance?.loadPhase !== "ready" || i.slashState.value.name === "executing",
6414
6520
  "data-testid": "markweave-editor-frame",
6415
6521
  "data-markweave-mode": t.runtimeSnapshot.value.mode,
6416
- "data-markweave-theme": je(e.theme),
6522
+ "data-markweave-document-loading": t.runtimeSnapshot.value.performance?.loadPhase === "ready" ? "false" : "true",
6523
+ "data-markweave-performance-tier": t.runtimeSnapshot.value.performance?.tier ?? "standard",
6524
+ "data-markweave-theme": Be(e.theme),
6417
6525
  style: s ? { "--markweave-canvas": s } : void 0,
6418
6526
  "data-markweave-inner-toc": e.innerToc ? "true" : "false",
6419
- "data-markweave-inner-toc-placement": rt(e.innerTocPlacement),
6527
+ "data-markweave-inner-toc-placement": pt(e.innerTocPlacement),
6420
6528
  "data-mermaid-mode": t.runtimeSnapshot.value.mermaid.mode,
6421
6529
  "data-table-focus-mode": i.tableFocusState.value.mode,
6422
6530
  onKeydownCapture: i.handleEditorKeyDown
6423
6531
  }, [
6424
- i.effectiveEditable.value ? U(vs, {
6532
+ i.effectiveEditable.value ? U(Os, {
6425
6533
  editor: r,
6426
6534
  lang: n(e.lang),
6427
6535
  messages: i.messages,
6428
6536
  askAi: e.askAi
6429
6537
  }) : null,
6430
- i.effectiveEditable.value ? U(bs, {
6538
+ i.effectiveEditable.value ? U(As, {
6431
6539
  commands: i.filteredSlashCommands.value,
6432
6540
  state: i.slashState.value,
6433
6541
  position: i.slashMenuPosition.value,
@@ -6438,7 +6546,7 @@ var Os = J({
6438
6546
  onInputCommandChange: i.setSlashInputCommand,
6439
6547
  onUpload: e.onSlashCommandUpload
6440
6548
  }) : null,
6441
- i.effectiveEditable.value ? U(Cs, {
6549
+ i.effectiveEditable.value ? U(Ns, {
6442
6550
  editor: r,
6443
6551
  active: i.tableFocusState.value.active,
6444
6552
  interactionState: i.tableInteractionState.value,
@@ -6448,11 +6556,11 @@ var Os = J({
6448
6556
  onCommandResult: e.onTableCommandResult,
6449
6557
  onEditWithAi: e.onEditWithAi
6450
6558
  }) : null,
6451
- i.effectiveEditable.value ? U(ws, {
6559
+ i.effectiveEditable.value ? U(Ps, {
6452
6560
  editor: r,
6453
6561
  focusState: i.tableFocusState.value
6454
6562
  }) : null,
6455
- U(Ts, {
6563
+ U(Fs, {
6456
6564
  editor: r,
6457
6565
  state: i.codeBlockState.value,
6458
6566
  active: i.effectiveEditable.value && i.isCodeBlockActive.value,
@@ -6460,14 +6568,14 @@ var Os = J({
6460
6568
  onMermaidModeChange: i.setMermaidMode,
6461
6569
  readOnly: !i.effectiveEditable.value
6462
6570
  }),
6463
- e.innerToc && i.tocState.value.items.length ? U(Es, {
6571
+ e.innerToc && i.tocState.value.items.length ? U(Is, {
6464
6572
  editor: r,
6465
6573
  state: i.tocState.value,
6466
6574
  messages: i.messages,
6467
6575
  editable: i.effectiveEditable.value,
6468
- placement: rt(e.innerTocPlacement)
6576
+ placement: pt(e.innerTocPlacement)
6469
6577
  }) : null,
6470
- i.effectiveEditable.value && i.mathTarget.value ? U(ys, {
6578
+ i.effectiveEditable.value && i.mathTarget.value ? U(ks, {
6471
6579
  editor: r,
6472
6580
  messages: i.messages,
6473
6581
  target: i.mathTarget.value,
@@ -6479,4 +6587,4 @@ var Os = J({
6479
6587
  }
6480
6588
  });
6481
6589
  //#endregion
6482
- export { Os as MarkweaveEditor, ne as createMarkweaveAiEditController, da as createMarkweaveEditorExtensions, da as createMarkweaveVue2EditorExtensions, Ds as useMarkweaveEditorController };
6590
+ export { Rs as MarkweaveEditor, ie as createMarkweaveAiEditController, ba as createMarkweaveEditorExtensions, ba as createMarkweaveVue2EditorExtensions, ae as prepareMarkweaveEditorForOutput, Ls as useMarkweaveEditorController };