@vibe-tiptap/shadcn-ui 1.0.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4,113 +4,114 @@ import { PRESET_HIGHLIGHT_COLORS as e, PRESET_TEXT_COLORS as t, TOOLBAR_HEADING_
4
4
  import { TOOLBAR_MARKDOWN_IMPORT_ACCEPT as a, TOOLBAR_MARKDOWN_OPTIONS as o, TOOLBAR_MARKDOWN_OPTIONS as s, copyMarkdown as c, copyMarkdown as l, exportMarkdownFile as u, exportMarkdownFile as d, importMarkdownFile as f, importMarkdownFile as p, resolveMarkdownFileOptions as m } from "@vibe-tiptap/editor-ui/markdown-file";
5
5
  import { printEditorContent as h, printEditorContent as g } from "@vibe-tiptap/editor-ui/print-editor-content";
6
6
  import { DEFAULT_CODE_BLOCK_LANGUAGES as _, DEFAULT_HORIZONTAL_RULES as v, NAIVE_UI_DEFAULT_TOOLBAR as y, TOOLBAR_ALIGN_OPTIONS as b, TOOLBAR_ALIGN_OPTIONS as x, TOOLBAR_HEADING_OPTIONS as S, TOOLBAR_HEADING_OPTIONS as C, TOOLBAR_TABLE_GRID as w, normalizeToolbarConfig as T, normalizeToolbarConfig as E, resolveToolbarMenuOptions as ee } from "@vibe-tiptap/editor-ui/toolbar-config";
7
- import { BubbleMenu as D, EditorContent as O, canSetMediaDisplay as k, createImageDropPasteHandlers as A, detectFileAttachmentType as j, exitSlashCommand as te, formatFileSize as M, getActiveHeadingLevel as ne, getActiveLinkRange as re, getActiveTextAlign as ie, getMediaInsertionNodeType as N, getNativeMarkdownManager as P, getSelectedFileAttachment as F, isFindReplaceOpenTransaction as I, isToolbarCommandActive as ae, isToolbarCommandEnabled as L, normalizeHttpUrl as oe, normalizeSlashCommandInput as se, notifyAssetUploadFailure as R, resolveEditorBehaviorOptions as ce, runSlashCommandItem as z, runToolbarCommand as B, slashCommandPluginKey as le, startWhiteboardDrawing as ue, trackUploadRange as de, useReactEditor as fe, useReactEditorState as V, validateAssetFile as pe } from "@vibe-tiptap/react-adapter";
8
- import { Fragment as me, jsx as H, jsxs as U } from "react/jsx-runtime";
9
- import { getMarkRange as he } from "@tiptap/core";
10
- import { cloneElement as ge, createContext as _e, createElement as ve, forwardRef as ye, memo as be, useCallback as xe, useContext as Se, useEffect as W, useId as Ce, useLayoutEffect as G, useMemo as we, useRef as K, useState as q } from "react";
11
- import { NodeSelection as Te, TextSelection as Ee } from "@tiptap/pm/state";
12
- import { AlignCenter as De, AlignJustify as Oe, AlignLeft as ke, AlignRight as Ae, ArrowDown as je, ArrowLeft as Me, ArrowRight as Ne, ArrowUp as Pe, Bold as Fe, Captions as Ie, CaseSensitive as Le, ChevronDown as Re, ChevronLeft as ze, ChevronRight as Be, ChevronUp as Ve, Code as He, CodeXml as Ue, Copy as We, Download as Ge, Ellipsis as Ke, EllipsisVertical as qe, Eraser as Je, ExternalLink as Ye, Eye as Xe, Film as Ze, Heading1 as Qe, Heading2 as $e, Heading3 as et, Heading4 as tt, Heading5 as nt, Heading6 as rt, Highlighter as it, Image as at, ImagePlay as ot, ImagePlus as st, ImageUp as ct, IndentDecrease as lt, IndentIncrease as ut, Italic as dt, Link as ft, List as pt, ListChecks as mt, ListOrdered as ht, LoaderCircle as gt, Maximize2 as _t, Minimize2 as vt, Minus as yt, Music as bt, Palette as xt, Paperclip as St, Pencil as Ct, PencilRuler as wt, Pilcrow as Tt, Plus as Et, Printer as Dt, Quote as Ot, Redo2 as kt, Replace as At, ReplaceAll as jt, RotateCcw as Mt, RotateCw as Nt, Search as Pt, Strikethrough as Ft, Subscript as It, Superscript as Lt, Table as Rt, TableProperties as zt, Trash2 as Bt, TvMinimalPlay as Vt, Underline as Ht, Undo2 as Ut, Unlink as Wt, Video as Gt, Workflow as Kt, X as qt, ZoomIn as Jt, ZoomOut as Yt } from "lucide-react";
13
- import { twMerge as J } from "tailwind-merge";
14
- import { FIRST_LINE_INDENT_ICON as Xt, MARKDOWN_ACTION_ICON_PATHS as Zt, MARKDOWN_ACTION_ICON_TRANSFORM as Qt, MARKDOWN_ICON as $t, TOOLBAR_ICON_VIEW_BOX as en } from "@vibe-tiptap/editor-ui/custom-icons";
15
- import { TransformComponent as tn, TransformWrapper as nn } from "react-zoom-pan-pinch";
16
- import { createPortal as rn } from "react-dom";
17
- import { TableMap as an, cellAround as on } from "@tiptap/pm/tables";
7
+ import { BubbleMenu as D, EditorContent as O, canSetMediaDisplay as k, createImageDropPasteHandlers as A, detectFileAttachmentType as j, exitMention as te, exitSlashCommand as ne, formatFileSize as M, getActiveHeadingLevel as N, getActiveLinkRange as P, getActiveTextAlign as re, getMediaInsertionNodeType as ie, getMentionTarget as ae, getNativeMarkdownManager as oe, getSelectedFileAttachment as F, isFindReplaceOpenTransaction as I, isToolbarCommandActive as se, isToolbarCommandEnabled as L, normalizeHttpUrl as ce, normalizeSlashCommandInput as R, notifyAssetUploadFailure as le, resolveEditorBehaviorOptions as z, resolveMediaResourcePath as B, runSlashCommandItem as ue, runToolbarCommand as de, slashCommandPluginKey as V, startWhiteboardDrawing as fe, trackUploadRange as pe, useReactEditor as me, useReactEditorState as H, validateAssetFile as he } from "@vibe-tiptap/react-adapter";
8
+ import { Fragment as ge, jsx as U, jsxs as W } from "react/jsx-runtime";
9
+ import { getMarkRange as _e } from "@tiptap/core";
10
+ import { cloneElement as ve, createContext as ye, createElement as be, forwardRef as xe, memo as Se, useCallback as Ce, useContext as we, useEffect as G, useId as Te, useLayoutEffect as K, useMemo as Ee, useRef as q, useState as J } from "react";
11
+ import { NodeSelection as De, TextSelection as Oe } from "@tiptap/pm/state";
12
+ import { AlignCenter as ke, AlignJustify as Ae, AlignLeft as je, AlignRight as Me, ArrowDown as Ne, ArrowLeft as Pe, ArrowRight as Fe, ArrowUp as Ie, Bold as Le, Captions as Re, CaseSensitive as ze, ChevronDown as Be, ChevronLeft as Ve, ChevronRight as He, ChevronUp as Ue, Code as We, CodeXml as Ge, Copy as Ke, Download as qe, Ellipsis as Je, EllipsisVertical as Ye, Eraser as Xe, ExternalLink as Ze, Eye as Qe, Film as $e, Heading1 as et, Heading2 as tt, Heading3 as nt, Heading4 as rt, Heading5 as it, Heading6 as at, Highlighter as ot, Image as st, ImagePlay as ct, ImagePlus as lt, ImageUp as ut, IndentDecrease as dt, IndentIncrease as ft, Italic as pt, Link as mt, List as ht, ListChecks as gt, ListOrdered as _t, LoaderCircle as vt, Maximize2 as yt, Minimize2 as bt, Minus as xt, Music as St, Palette as Ct, Paperclip as wt, Pencil as Tt, PencilRuler as Et, Pilcrow as Dt, Plus as Ot, Printer as kt, Quote as At, Redo2 as jt, Replace as Mt, ReplaceAll as Nt, RotateCcw as Pt, RotateCw as Ft, Search as It, Strikethrough as Lt, Subscript as Rt, Superscript as zt, Table as Bt, TableProperties as Vt, Trash2 as Ht, TvMinimalPlay as Ut, Underline as Wt, Undo2 as Gt, Unlink as Kt, Video as qt, Workflow as Jt, X as Yt, ZoomIn as Xt, ZoomOut as Zt } from "lucide-react";
13
+ import { twMerge as Y } from "tailwind-merge";
14
+ import { FIRST_LINE_INDENT_ICON as Qt, MARKDOWN_ACTION_ICON_PATHS as $t, MARKDOWN_ACTION_ICON_TRANSFORM as en, MARKDOWN_ICON as tn, TOOLBAR_ICON_VIEW_BOX as nn } from "@vibe-tiptap/editor-ui/custom-icons";
15
+ import { TransformComponent as rn, TransformWrapper as an } from "react-zoom-pan-pinch";
16
+ import { createPortal as on } from "react-dom";
17
+ import { bindMentionHover as sn } from "@vibe-tiptap/editor-ui/mention-hover";
18
+ import { TableMap as cn, cellAround as ln } from "@tiptap/pm/tables";
18
19
  // src/editor-content.tsx
19
- function sn({ context: e, className: t, ...n }) {
20
- return /* @__PURE__ */ H(O, {
20
+ function un({ context: e, className: t, ...n }) {
21
+ return /* @__PURE__ */ U(O, {
21
22
  ...n,
22
23
  editor: e.editor,
23
24
  className: ["vibe-shadcn-tiptap__content", t].filter(Boolean).join(" ")
24
25
  });
25
26
  }
26
- function cn({ context: e }) {
27
- let t = V(e, (e) => e.wordCount.characters) ?? 0;
28
- return /* @__PURE__ */ H("div", {
27
+ function dn({ context: e }) {
28
+ let t = H(e, (e) => e.wordCount.characters) ?? 0;
29
+ return /* @__PURE__ */ U("div", {
29
30
  className: "vibe-shadcn-tiptap__status",
30
31
  "aria-live": "polite",
31
32
  children: e.t("wordCount.characters", { count: t })
32
33
  });
33
34
  }
34
35
  // src/components.ts
35
- var ln = _e(void 0), un = ln.Provider;
36
- function Y() {
37
- let e = Se(ln);
36
+ var fn = ye(void 0), pn = fn.Provider;
37
+ function X() {
38
+ let e = we(fn);
38
39
  if (!e) throw Error("ShadcnTiptap requires a components mapping.");
39
40
  return e;
40
41
  }
41
42
  // src/ui-styles.ts
42
- var X = "flex flex-wrap items-center gap-1", dn = "rounded-md border border-border bg-[var(--popover,var(--vibe-tiptap-bg))] text-[color:var(--popover-foreground,var(--vibe-tiptap-text))] shadow-md", fn = {
43
+ var Z = "flex flex-wrap items-center gap-1", mn = "rounded-md border border-border bg-[var(--popover,var(--vibe-tiptap-bg))] text-[color:var(--popover-foreground,var(--vibe-tiptap-text))] shadow-md", hn = {
43
44
  default: void 0,
44
45
  outline: "border border-input bg-background dark:bg-background",
45
46
  ghost: "border-transparent bg-transparent shadow-none dark:bg-transparent"
46
- }, pn = _e(void 0), Z = pn.Provider;
47
- function mn(e) {
48
- let t = Se(pn);
47
+ }, gn = ye(void 0), _n = gn.Provider;
48
+ function vn(e) {
49
+ let t = we(gn);
49
50
  return {
50
51
  size: e?.size ?? t?.size,
51
52
  variant: e?.variant ?? t?.variant,
52
- className: J(t?.className, e?.className)
53
+ className: Y(t?.className, e?.className)
53
54
  };
54
55
  }
55
- var Q = ye(function({ appearance: e, className: t, defaultSizeClassName: n, size: r, variant: i, ...a }, o) {
56
- let { Button: s } = Y(), c = mn(e);
57
- return /* @__PURE__ */ H(s, {
56
+ var Q = xe(function({ appearance: e, className: t, defaultSizeClassName: n, size: r, variant: i, ...a }, o) {
57
+ let { Button: s } = X(), c = vn(e);
58
+ return /* @__PURE__ */ U(s, {
58
59
  ...a,
59
60
  ref: o,
60
61
  size: c.size ?? r,
61
62
  variant: c.variant ?? i,
62
- className: J(t, c.size === void 0 && n, c.className)
63
+ className: Y(t, c.size === void 0 && n, c.className)
63
64
  });
64
65
  });
65
- function hn({ appearance: e, children: t }) {
66
- let { className: n, size: r, variant: i } = mn(e);
67
- return r === void 0 && i === void 0 ? ge(t, { className: J(t.props.className, n) }) : /* @__PURE__ */ H(Q, {
66
+ function yn({ appearance: e, children: t }) {
67
+ let { className: n, size: r, variant: i } = vn(e);
68
+ return r === void 0 && i === void 0 ? ve(t, { className: Y(t.props.className, n) }) : /* @__PURE__ */ U(Q, {
68
69
  asChild: !0,
69
70
  appearance: e,
70
71
  children: t
71
72
  });
72
73
  }
73
- var $ = ye(function({ label: e, overlayTarget: t, className: n, size: r = "icon", variant: i = "ghost", ...a }, o) {
74
- let { Tooltip: s } = Y();
75
- return /* @__PURE__ */ U(s.Root, {
74
+ var $ = xe(function({ label: e, overlayTarget: t, className: n, size: r = "icon", variant: i = "ghost", ...a }, o) {
75
+ let { Tooltip: s } = X();
76
+ return /* @__PURE__ */ W(s.Root, {
76
77
  disableHoverableContent: !0,
77
- children: [/* @__PURE__ */ H(s.Trigger, {
78
+ children: [/* @__PURE__ */ U(s.Trigger, {
78
79
  asChild: !0,
79
- children: /* @__PURE__ */ H(Q, {
80
+ children: /* @__PURE__ */ U(Q, {
80
81
  type: "button",
81
82
  size: r,
82
83
  variant: i,
83
84
  ...a,
84
85
  ref: o,
85
86
  "aria-label": e,
86
- className: J("vibe-shadcn-tiptap__button", n)
87
+ className: Y("vibe-shadcn-tiptap__button", n)
87
88
  })
88
- }), t && /* @__PURE__ */ H(s.Content, {
89
+ }), t && /* @__PURE__ */ U(s.Content, {
89
90
  container: t,
90
91
  className: "vibe-shadcn-tiptap__tooltip",
91
92
  sideOffset: 5,
92
93
  children: e
93
94
  })]
94
95
  });
95
- }), gn = [
96
+ }), bn = [
96
97
  ["small", .25],
97
98
  ["medium", .5],
98
99
  ["large", .75],
99
100
  ["original", null]
100
- ], _n = {
101
- left: ke,
102
- center: De,
103
- right: Ae
104
- }, vn = [
101
+ ], xn = {
102
+ left: je,
103
+ center: ke,
104
+ right: Me
105
+ }, Sn = [
105
106
  "left",
106
107
  "center",
107
108
  "right"
108
- ], yn = {
109
- image: at,
110
- audio: bt,
111
- video: Ze
109
+ ], Cn = {
110
+ image: st,
111
+ audio: St,
112
+ video: $e
112
113
  };
113
- function bn(e, t) {
114
+ function wn(e, t) {
114
115
  if (typeof e == "string" && e) try {
115
116
  let n = new URL(e, t);
116
117
  if ([
@@ -123,10 +124,10 @@ function bn(e, t) {
123
124
  return;
124
125
  }
125
126
  }
126
- function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhiteboardEdit: i, behaviorOptions: a, onCaptionFocus: o, onCopyUrl: s }) {
127
- let { editor: c, commands: l, t: u } = e, { node: d } = t, f = d.type.name, p = c.view.dom.ownerDocument.baseURI, m = K(null), [h, g] = q(!1), _ = f === "image", v = f === "whiteboard", y = f === "audio", b = f === "video", x = bn(d.attrs.src, p), S = c.view.nodeDOM(t.from), C = S instanceof HTMLElement ? S.querySelector(".vibe-tiptap-img-caption, .vibe-tiptap-media-caption") : null;
127
+ function Tn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhiteboardEdit: i, behaviorOptions: a, onCaptionFocus: o, onCopyUrl: s }) {
128
+ let { editor: c, commands: l, t: u } = e, { node: d } = t, f = d.type.name, p = c.view.dom.ownerDocument.baseURI, m = q(null), [h, g] = J(!1), _ = f === "image", v = f === "whiteboard", y = f === "audio", b = f === "video", x = wn(B(c, f, d.attrs), p), S = c.view.nodeDOM(t.from), C = S instanceof HTMLElement ? S.querySelector(".vibe-tiptap-img-caption, .vibe-tiptap-media-caption") : null;
128
129
  function w(e, t, r, i) {
129
- return /* @__PURE__ */ H($, {
130
+ return /* @__PURE__ */ U($, {
130
131
  ...i,
131
132
  label: u(e),
132
133
  overlayTarget: n,
@@ -140,17 +141,17 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
140
141
  if (f === "fileAttachment") {
141
142
  let t = F(c);
142
143
  if (!t) return null;
143
- let n = bn(t.href, p), r = j(t.attrs), i = r === "video" || r === "audio" || r === "pdf", a = H(i ? Ye : Ge, {
144
+ let n = wn(t.href, p), r = j(t.attrs), i = r === "video" || r === "audio" || r === "pdf", a = U(i ? Ze : qe, {
144
145
  size: 16,
145
146
  "aria-hidden": !0
146
- }), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o && yn[o];
147
- return /* @__PURE__ */ U("div", {
148
- className: J("vibe-shadcn-tiptap__actions", X),
147
+ }), o = r === "image" || r === "audio" || r === "video" ? r : void 0, d = o && Cn[o];
148
+ return /* @__PURE__ */ W("div", {
149
+ className: Y("vibe-shadcn-tiptap__actions", Z),
149
150
  children: [
150
- n && (i || e.fileAttachmentDownload) && /* @__PURE__ */ H(Q, {
151
+ n && (i || e.fileAttachmentDownload) && /* @__PURE__ */ U(Q, {
151
152
  asChild: !0,
152
153
  className: "vibe-shadcn-tiptap__button",
153
- children: /* @__PURE__ */ H("a", {
154
+ children: /* @__PURE__ */ U("a", {
154
155
  href: n,
155
156
  "aria-label": u(i ? "file.action.open" : "file.action.download"),
156
157
  download: i ? void 0 : t.attrs.name ? t.name : "",
@@ -159,7 +160,7 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
159
160
  children: a
160
161
  })
161
162
  }),
162
- n && w("file.action.copy", /* @__PURE__ */ H(We, {
163
+ n && w("file.action.copy", /* @__PURE__ */ U(Ke, {
163
164
  size: 16,
164
165
  "aria-hidden": !0
165
166
  }), () => s(n, !0)),
@@ -167,7 +168,7 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
167
168
  image: "file.action.showAsImage",
168
169
  audio: "file.action.showAsAudio",
169
170
  video: "file.action.showAsVideo"
170
- }[o], /* @__PURE__ */ H(d, {
171
+ }[o], /* @__PURE__ */ U(d, {
171
172
  size: 16,
172
173
  "aria-hidden": !0
173
174
  }), {
@@ -175,7 +176,7 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
175
176
  audio: () => l.setAudioDisplay("player"),
176
177
  video: () => l.setVideoDisplay("player")
177
178
  }[o]),
178
- w("file.action.delete", /* @__PURE__ */ H(Bt, {
179
+ w("file.action.delete", /* @__PURE__ */ U(Ht, {
179
180
  size: 16,
180
181
  "aria-hidden": !0
181
182
  }), T)
@@ -197,11 +198,11 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
197
198
  function ee(e) {
198
199
  _ ? l.setImageAlign(e) : v ? c.chain().focus().updateAttributes("whiteboard", { align: e }).run() : y ? l.setAudioAlign(e) : l.setVideoAlign(e);
199
200
  }
200
- let D = y || b ? d.attrs.size : gn.find(([, e]) => e !== null && Math.round(c.view.dom.clientWidth * e) === d.attrs.width)?.[0] ?? (d.attrs.width ? void 0 : "original");
201
- return /* @__PURE__ */ U("div", {
202
- className: J("vibe-shadcn-tiptap__actions", X),
201
+ let D = y || b ? d.attrs.size : bn.find(([, e]) => e !== null && Math.round(c.view.dom.clientWidth * e) === d.attrs.width)?.[0] ?? (d.attrs.width ? void 0 : "original");
202
+ return /* @__PURE__ */ W("div", {
203
+ className: Y("vibe-shadcn-tiptap__actions", Z),
203
204
  children: [
204
- gn.map(([e, t]) => /* @__PURE__ */ H(Q, {
205
+ bn.map(([e, t]) => /* @__PURE__ */ U(Q, {
205
206
  type: "button",
206
207
  className: "vibe-shadcn-tiptap__button",
207
208
  title: u(`image.size.${e}Tooltip`),
@@ -209,42 +210,42 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
209
210
  onClick: () => E(e, t),
210
211
  children: u(`image.size.${e}`)
211
212
  }, e)),
212
- /* @__PURE__ */ H("span", {
213
+ /* @__PURE__ */ U("span", {
213
214
  className: "vibe-shadcn-tiptap__bubble-divider",
214
215
  "aria-hidden": "true"
215
216
  }),
216
- vn.map((e) => {
217
- let t = _n[e];
218
- return /* @__PURE__ */ H($, {
217
+ Sn.map((e) => {
218
+ let t = xn[e];
219
+ return /* @__PURE__ */ U($, {
219
220
  label: u(`image.align.${e}`),
220
221
  "aria-pressed": (d.attrs.align ?? "center") === e,
221
222
  overlayTarget: n,
222
223
  onClick: () => ee(e),
223
- children: /* @__PURE__ */ H(t, {
224
+ children: /* @__PURE__ */ U(t, {
224
225
  size: 16,
225
226
  "aria-hidden": !0
226
227
  })
227
228
  }, e);
228
229
  }),
229
- /* @__PURE__ */ H("span", {
230
+ /* @__PURE__ */ U("span", {
230
231
  className: "vibe-shadcn-tiptap__bubble-divider",
231
232
  "aria-hidden": "true"
232
233
  }),
233
- C && w("image.caption", /* @__PURE__ */ H(Ie, {
234
+ C && w("image.caption", /* @__PURE__ */ U(Re, {
234
235
  size: 16,
235
236
  "aria-hidden": !0
236
237
  }), () => {
237
238
  C.readOnly || (C.hidden = !1, C.focus(), o());
238
239
  }),
239
- v && r && w("whiteboard.edit", /* @__PURE__ */ H(wt, {
240
+ v && r && w("whiteboard.edit", /* @__PURE__ */ U(Et, {
240
241
  size: 16,
241
242
  "aria-hidden": !0
242
243
  }), i),
243
- _ && r && /* @__PURE__ */ U(me, { children: [/* @__PURE__ */ H("input", {
244
+ _ && r && /* @__PURE__ */ W(ge, { children: [/* @__PURE__ */ U("input", {
244
245
  ref: m,
245
246
  type: "file",
246
247
  hidden: !0,
247
- accept: ce(a).image.accept,
248
+ accept: z(a).image.accept,
248
249
  onChange: async (t) => {
249
250
  let n = t.currentTarget.files?.[0];
250
251
  if (t.currentTarget.value = "", n && !h) {
@@ -252,31 +253,31 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
252
253
  try {
253
254
  await l.uploadAndReplaceImage(n);
254
255
  } catch {
255
- c.isDestroyed || R(e.notify, u, "image");
256
+ c.isDestroyed || le(e.notify, u, "image");
256
257
  } finally {
257
258
  g(!1);
258
259
  }
259
260
  }
260
261
  }
261
- }), w("image.replace", /* @__PURE__ */ H(ct, {
262
+ }), w("image.replace", /* @__PURE__ */ U(ut, {
262
263
  size: 16,
263
264
  "aria-hidden": !0
264
265
  }), () => m.current?.click(), { disabled: h })] }),
265
- x && !v && w("toolbar.link.copy", /* @__PURE__ */ H(We, {
266
+ x && !v && w("toolbar.link.copy", /* @__PURE__ */ U(Ke, {
266
267
  size: 16,
267
268
  "aria-hidden": !0
268
269
  }), () => s(x)),
269
- x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ H(St, {
270
+ x && !v && k(c, _ ? "image" : y ? "audio" : "video", "file") && w("video.showAsFile", /* @__PURE__ */ U(wt, {
270
271
  size: 16,
271
272
  "aria-hidden": !0
272
273
  }), () => {
273
274
  _ ? l.setImageDisplay("file") : y ? l.setAudioDisplay("file") : l.setVideoDisplay("file");
274
275
  }),
275
- (y || b) && x && /* @__PURE__ */ H("span", {
276
+ (y || b) && x && /* @__PURE__ */ U("span", {
276
277
  className: "vibe-shadcn-tiptap__bubble-divider",
277
278
  "aria-hidden": "true"
278
279
  }),
279
- w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ H(Bt, {
280
+ w(_ ? "image.delete" : v ? "whiteboard.delete" : y ? "audio.delete" : "video.delete", /* @__PURE__ */ U(Ht, {
280
281
  size: 16,
281
282
  "aria-hidden": !0
282
283
  }), _ ? l.removeImage : y ? l.removeAudio : b ? l.removeVideo : T)
@@ -284,50 +285,50 @@ function xn({ context: e, selection: t, overlayTarget: n, uploadAsset: r, onWhit
284
285
  });
285
286
  }
286
287
  // src/color-picker.tsx
287
- var Sn = /^(#[\da-f]{6})ff$/;
288
- function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, disabled: o, bubble: s, open: c, onOpenChange: l }) {
289
- let { Popover: u } = Y(), d = mn(), f = {
288
+ var En = /^(#[\da-f]{6})ff$/;
289
+ function Dn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, disabled: o, bubble: s, open: c, onOpenChange: l }) {
290
+ let { Popover: u } = X(), d = vn(), f = {
290
291
  size: e?.button?.size ?? d?.size,
291
292
  variant: e?.button?.variant ?? d?.variant,
292
- className: J(d?.className, e?.button?.className)
293
- }, { editor: p, t: m, notify: h } = t, g = p.view.dom.ownerDocument, _ = r === "color" ? "textStyle" : "highlight", { selection: v, storedMarks: y } = p.state, b = v.empty && y ? y.find((e) => e.type.name === _)?.attrs.color : p.getAttributes(_).color, x = typeof b == "string" ? b.trim() : void 0, S = i(x, g), C = S?.replace(Sn, "$1"), w = we(() => {
293
+ className: Y(d?.className, e?.button?.className)
294
+ }, { editor: p, t: m, notify: h } = t, g = p.view.dom.ownerDocument, _ = r === "color" ? "textStyle" : "highlight", { selection: v, storedMarks: y } = p.state, b = v.empty && y ? y.find((e) => e.type.name === _)?.attrs.color : p.getAttributes(_).color, x = typeof b == "string" ? b.trim() : void 0, S = i(x, g), C = S?.replace(En, "$1"), w = Ee(() => {
294
295
  let e = /* @__PURE__ */ new Set();
295
296
  return n.flatMap((t) => {
296
- let n = i(t, g)?.replace(Sn, "$1"), r = n ?? t.trim();
297
+ let n = i(t, g)?.replace(En, "$1"), r = n ?? t.trim();
297
298
  return e.has(r) ? [] : (e.add(r), [{
298
299
  value: t,
299
300
  canonical: n
300
301
  }]);
301
302
  });
302
- }, [n, g]), T = r === "color" ? xt : it;
303
+ }, [n, g]), T = r === "color" ? Ct : ot;
303
304
  function E(e) {
304
- !o && L(t, r, e) && B(t, r, e);
305
+ !o && L(t, r, e) && de(t, r, e);
305
306
  }
306
- return /* @__PURE__ */ H(Z, {
307
+ return /* @__PURE__ */ U(_n, {
307
308
  value: f,
308
- children: /* @__PURE__ */ U(u.Root, {
309
+ children: /* @__PURE__ */ W(u.Root, {
309
310
  open: c,
310
311
  onOpenChange: l,
311
- children: [/* @__PURE__ */ H(u.Trigger, {
312
+ children: [/* @__PURE__ */ U(u.Trigger, {
312
313
  asChild: !0,
313
- children: /* @__PURE__ */ H($, {
314
+ children: /* @__PURE__ */ U($, {
314
315
  size: "icon",
315
316
  label: m(`command.${r}`),
316
317
  overlayTarget: a,
317
318
  "data-toolbar-key": s ? void 0 : r,
318
319
  disabled: o,
319
320
  onMouseDown: (e) => e.preventDefault(),
320
- children: /* @__PURE__ */ U("span", {
321
+ children: /* @__PURE__ */ W("span", {
321
322
  className: "vibe-shadcn-tiptap__color-icon",
322
- children: [/* @__PURE__ */ H(T, {
323
+ children: [/* @__PURE__ */ U(T, {
323
324
  size: 16,
324
325
  "aria-hidden": !0
325
- }), x && /* @__PURE__ */ H("span", { style: { backgroundColor: x } })]
326
+ }), x && /* @__PURE__ */ U("span", { style: { backgroundColor: x } })]
326
327
  })
327
328
  })
328
- }), a && /* @__PURE__ */ U(u.Content, {
329
+ }), a && /* @__PURE__ */ W(u.Content, {
329
330
  container: a,
330
- className: J("z-3", e?.className),
331
+ className: Y("z-3", e?.className),
331
332
  align: "start",
332
333
  sideOffset: 4,
333
334
  "aria-label": m(`command.${r}`),
@@ -339,13 +340,13 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
339
340
  e.target === p.view.dom && e.preventDefault();
340
341
  },
341
342
  onMouseDown: (e) => e.preventDefault(),
342
- children: [/* @__PURE__ */ H("div", {
343
- className: J("vibe-shadcn-tiptap__color-grid grid grid-cols-[repeat(8,max-content)] justify-between gap-1.5 px-2 py-2", e?.gridClassName),
344
- children: w.map(({ value: t, canonical: n }) => /* @__PURE__ */ H(Q, {
343
+ children: [/* @__PURE__ */ U("div", {
344
+ className: Y("vibe-shadcn-tiptap__color-grid grid grid-cols-[repeat(8,max-content)] justify-between gap-1.5 px-2 py-2", e?.gridClassName),
345
+ children: w.map(({ value: t, canonical: n }) => /* @__PURE__ */ U(Q, {
345
346
  type: "button",
346
347
  appearance: {
347
348
  ...e?.swatch,
348
- className: J(e?.swatchClassName, e?.swatch?.className)
349
+ className: Y(e?.swatchClassName, e?.swatch?.className)
349
350
  },
350
351
  defaultSizeClassName: "size-5 p-0",
351
352
  className: "vibe-shadcn-tiptap__swatch rounded-sm border border-border aria-pressed:outline-2 aria-pressed:outline-solid aria-pressed:outline-ring",
@@ -355,9 +356,9 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
355
356
  "aria-pressed": x === t || C !== void 0 && C === n,
356
357
  onClick: () => E(t)
357
358
  }, t))
358
- }), /* @__PURE__ */ U("div", {
359
- className: J("vibe-shadcn-tiptap__color-footer flex items-center justify-between gap-2 px-2 text-muted-foreground", e?.footerClassName),
360
- children: [S ? /* @__PURE__ */ U($, {
359
+ }), /* @__PURE__ */ W("div", {
360
+ className: Y("vibe-shadcn-tiptap__color-footer flex items-center justify-between gap-2 px-2 text-muted-foreground", e?.footerClassName),
361
+ children: [S ? /* @__PURE__ */ W($, {
361
362
  size: "sm",
362
363
  label: m("toolbar.color.copyHex", { hex: S }),
363
364
  overlayTarget: a,
@@ -370,11 +371,11 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
370
371
  h(m("notify.clipboardUnavailable"), "warning");
371
372
  }
372
373
  },
373
- children: [/* @__PURE__ */ H(We, {
374
+ children: [/* @__PURE__ */ U(Ke, {
374
375
  size: 14,
375
376
  "aria-hidden": !0
376
377
  }), S]
377
- }) : /* @__PURE__ */ H("span", { children: m(r === "color" ? "toolbar.color.default" : "toolbar.highlight.none") }), /* @__PURE__ */ H(Q, {
378
+ }) : /* @__PURE__ */ U("span", { children: m(r === "color" ? "toolbar.color.default" : "toolbar.highlight.none") }), /* @__PURE__ */ U(Q, {
378
379
  type: "button",
379
380
  size: "sm",
380
381
  className: "vibe-shadcn-tiptap__button",
@@ -388,20 +389,20 @@ function Cn({ appearance: e, context: t, colors: n, kind: r, overlayTarget: a, d
388
389
  });
389
390
  }
390
391
  // src/insertion-popover.tsx
391
- function wn(e) {
392
- return /* @__PURE__ */ H(Z, {
392
+ function On(e) {
393
+ return /* @__PURE__ */ U(_n, {
393
394
  value: e.appearance?.button,
394
- children: e.request.kind === "link" ? /* @__PURE__ */ H(En, {
395
+ children: e.request.kind === "link" ? /* @__PURE__ */ U(An, {
395
396
  ...e,
396
397
  request: e.request
397
- }) : /* @__PURE__ */ H(kn, {
398
+ }) : /* @__PURE__ */ U(Nn, {
398
399
  ...e,
399
400
  request: e.request
400
401
  })
401
402
  });
402
403
  }
403
- function Tn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, onClose: a, children: o }) {
404
- let { Popover: s } = Y(), { editor: c } = t, l = K(c.state.selection.from), u = we(() => ({ current: {
404
+ function kn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, onClose: a, children: o }) {
405
+ let { Popover: s } = X(), { editor: c } = t, l = q(c.state.selection.from), u = Ee(() => ({ current: {
405
406
  contextElement: n ?? c.view.dom,
406
407
  getBoundingClientRect() {
407
408
  if (n) return n.getBoundingClientRect();
@@ -412,14 +413,14 @@ function Tn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
412
413
  function d() {
413
414
  a(), (n ?? c.view.dom).focus({ preventScroll: !0 });
414
415
  }
415
- return /* @__PURE__ */ U(s.Root, {
416
+ return /* @__PURE__ */ W(s.Root, {
416
417
  open: !0,
417
418
  onOpenChange: (e) => {
418
419
  e || a();
419
420
  },
420
- children: [/* @__PURE__ */ H(s.Anchor, { virtualRef: u }), /* @__PURE__ */ H(s.Content, {
421
+ children: [/* @__PURE__ */ U(s.Anchor, { virtualRef: u }), /* @__PURE__ */ U(s.Content, {
421
422
  container: r,
422
- className: J("z-3 vibe-shadcn-tiptap__insertion w-[min(22rem,calc(100vw-2rem))] p-3", e),
423
+ className: Y("z-3 vibe-shadcn-tiptap__insertion w-[min(22rem,calc(100vw-2rem))] p-3", e),
423
424
  "aria-label": i,
424
425
  side: n ? "top" : "bottom",
425
426
  align: "start",
@@ -447,15 +448,15 @@ function Tn({ className: e, context: t, anchor: n, overlayTarget: r, title: i, o
447
448
  })]
448
449
  });
449
450
  }
450
- function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose: i }) {
451
- let { Input: a, Checkbox: o } = Y(), s = J(fn[e?.input?.variant ?? "default"], e?.input?.className), { editor: c, commands: l, t: u, notify: d } = t, f = Ce(), p = Ce(), m = Ce(), [h] = q(() => r.link ?? re(c)), [g] = q(() => h ? {
451
+ function An({ appearance: e, context: t, overlayTarget: n, request: r, onClose: i }) {
452
+ let { Input: a, Checkbox: o } = X(), s = Y(hn[e?.input?.variant ?? "default"], e?.input?.className), { editor: c, commands: l, t: u, notify: d } = t, f = Te(), p = Te(), m = Te(), [h] = J(() => r.link ?? P(c)), [g] = J(() => h ? {
452
453
  from: h.from,
453
454
  to: h.to
454
455
  } : {
455
456
  from: c.state.selection.from,
456
457
  to: c.state.selection.to
457
- }), [_, v] = q(() => h?.text ?? c.state.doc.textBetween(g.from, g.to)), [y] = q(() => !!(h || _)), [b, x] = q(h?.href ?? ""), [S, C] = q((h ? h.target : t.defaultLinkTarget) !== "_self");
458
- G(() => {
458
+ }), [_, v] = J(() => h?.text ?? c.state.doc.textBetween(g.from, g.to)), [y] = J(() => !!(h || _)), [b, x] = J(h?.href ?? ""), [S, C] = J((h ? h.target : t.defaultLinkTarget) !== "_self");
459
+ K(() => {
459
460
  let e = ({ transaction: e, appendedTransactions: t }) => {
460
461
  (e.docChanged || t.some(({ docChanged: e }) => e)) && i();
461
462
  };
@@ -465,29 +466,29 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
465
466
  }, [c, i]);
466
467
  function w() {
467
468
  if (!c.isEditable) return;
468
- let e = oe(b);
469
+ let e = ce(b);
469
470
  e ? (l.insertLinkText(e, _, {
470
471
  target: S ? "_blank" : "_self",
471
472
  range: g
472
473
  }), i()) : d(u(b.trim() ? "notify.linkInvalid" : "notify.linkEmpty"), "warning");
473
474
  }
474
- return /* @__PURE__ */ H(Tn, {
475
+ return /* @__PURE__ */ U(kn, {
475
476
  className: e?.className,
476
477
  context: t,
477
478
  anchor: r.anchor,
478
479
  overlayTarget: n,
479
480
  title: u(y ? "command.link" : "toolbar.link.popoverLabel"),
480
481
  onClose: i,
481
- children: /* @__PURE__ */ U("form", {
482
+ children: /* @__PURE__ */ W("form", {
482
483
  className: "vibe-shadcn-tiptap__fields vibe-shadcn-tiptap__compact-fields grid gap-2.5",
483
484
  onSubmit: (e) => {
484
485
  e.preventDefault(), w();
485
486
  },
486
487
  children: [
487
- /* @__PURE__ */ U("label", {
488
+ /* @__PURE__ */ W("label", {
488
489
  htmlFor: p,
489
490
  className: "grid gap-1.5",
490
- children: [/* @__PURE__ */ H("span", { children: u("toolbar.link.textLabel") }), /* @__PURE__ */ H(a, {
491
+ children: [/* @__PURE__ */ U("span", { children: u("toolbar.link.textLabel") }), /* @__PURE__ */ U(a, {
491
492
  className: s,
492
493
  id: p,
493
494
  value: _,
@@ -495,10 +496,10 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
495
496
  onChange: (e) => v(e.currentTarget.value)
496
497
  })]
497
498
  }),
498
- /* @__PURE__ */ U("label", {
499
+ /* @__PURE__ */ W("label", {
499
500
  htmlFor: m,
500
501
  className: "grid gap-1.5",
501
- children: [/* @__PURE__ */ H("span", { children: u("toolbar.link.hrefLabel") }), /* @__PURE__ */ H(a, {
502
+ children: [/* @__PURE__ */ U("span", { children: u("toolbar.link.hrefLabel") }), /* @__PURE__ */ U(a, {
502
503
  className: s,
503
504
  id: m,
504
505
  "data-initial-focus": !0,
@@ -507,31 +508,31 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
507
508
  onChange: (e) => x(e.currentTarget.value)
508
509
  })]
509
510
  }),
510
- /* @__PURE__ */ U("div", {
511
+ /* @__PURE__ */ W("div", {
511
512
  className: "vibe-shadcn-tiptap__checkbox-field flex items-center gap-1.5",
512
- children: [/* @__PURE__ */ H(hn, {
513
+ children: [/* @__PURE__ */ U(yn, {
513
514
  appearance: e?.checkbox,
514
- children: /* @__PURE__ */ H(o, {
515
+ children: /* @__PURE__ */ U(o, {
515
516
  id: f,
516
517
  checked: S,
517
518
  onCheckedChange: (e) => C(e === !0)
518
519
  })
519
- }), /* @__PURE__ */ H("label", {
520
+ }), /* @__PURE__ */ U("label", {
520
521
  htmlFor: f,
521
522
  children: u("toolbar.link.openInNewWindow")
522
523
  })]
523
524
  }),
524
- /* @__PURE__ */ U("div", {
525
- className: J("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions justify-end", X),
525
+ /* @__PURE__ */ W("div", {
526
+ className: Y("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions justify-end", Z),
526
527
  children: [
527
- h && /* @__PURE__ */ H(Q, {
528
+ h && /* @__PURE__ */ U(Q, {
528
529
  type: "button",
529
530
  onClick: () => {
530
531
  c.isEditable && (l.setLink("", { range: g }), d(u("notify.linkRemoved"), "success"), i());
531
532
  },
532
533
  children: u("toolbar.link.remove")
533
534
  }),
534
- /* @__PURE__ */ H(Q, {
535
+ /* @__PURE__ */ U(Q, {
535
536
  type: "button",
536
537
  className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
537
538
  onClick: () => {
@@ -539,7 +540,7 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
539
540
  },
540
541
  children: u("toolbar.action.cancel")
541
542
  }),
542
- /* @__PURE__ */ H(Q, {
543
+ /* @__PURE__ */ U(Q, {
543
544
  type: "submit",
544
545
  children: u("toolbar.action.confirm")
545
546
  })
@@ -549,27 +550,27 @@ function En({ appearance: e, context: t, overlayTarget: n, request: r, onClose:
549
550
  })
550
551
  });
551
552
  }
552
- var Dn = {
553
+ var jn = {
553
554
  image: "notify.invalidImageUrl",
554
555
  video: "notify.invalidVideoUrl",
555
556
  audio: "notify.invalidAudioUrl",
556
557
  attachment: "notify.invalidFileUrl"
557
- }, On = {
558
- image: at,
559
- video: Ze,
560
- audio: bt,
561
- attachment: St
558
+ }, Mn = {
559
+ image: st,
560
+ video: $e,
561
+ audio: St,
562
+ attachment: wt
562
563
  };
563
- function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload: i, behaviorOptions: a, onClose: o }) {
564
- let { Input: s, Tabs: c } = Y(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h = On[p], g = Ce(), _ = p === "attachment" ? "file" : p, v = ce(a), y = _ === "image" ? v.image : v.media[_], b = !!l.schema.nodes[N(_)], x = b && i, S = b && (p !== "image" || v.image.allowUrl), C = x || S, [w, T] = q(n.tab ?? (x ? "upload" : "url")), E = w === "upload" ? x ? "upload" : "url" : S ? "url" : "upload", [ee, D] = q(""), O = K(void 0), k = K(o);
565
- G(() => {
564
+ function Nn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload: i, behaviorOptions: a, onClose: o }) {
565
+ let { Input: s, Tabs: c } = X(), { editor: l, commands: u, t: d, notify: f } = t, { kind: p, anchor: m } = n, h = Mn[p], g = Te(), _ = p === "attachment" ? "file" : p, v = z(a), y = _ === "image" ? v.image : v.media[_], b = !!l.schema.nodes[ie(_)], x = b && i, S = b && (p !== "image" || v.image.allowUrl), C = x || S, [w, T] = J(n.tab ?? (x ? "upload" : "url")), E = w === "upload" ? x ? "upload" : "url" : S ? "url" : "upload", [ee, D] = J(""), O = q(void 0), k = q(o);
566
+ K(() => {
566
567
  k.current = o;
567
- }, [o]), G(() => {
568
+ }, [o]), K(() => {
568
569
  if (!C) {
569
570
  k.current();
570
571
  return;
571
572
  }
572
- let e = de(l, () => k.current());
573
+ let e = pe(l, () => k.current());
573
574
  return O.current = e, () => {
574
575
  e.dispose(), O.current = void 0;
575
576
  };
@@ -584,66 +585,66 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
584
585
  attachment: u.uploadAndInsertFile
585
586
  }[p];
586
587
  o(), n(y.multiple ? e : e.slice(0, 1), t).catch(() => {
587
- l.isDestroyed || R(f, d, _);
588
+ l.isDestroyed || le(f, d, _);
588
589
  });
589
590
  }
590
591
  function j() {
591
592
  let e = O.current?.range;
592
593
  if (!e || !l.isEditable || !S) return;
593
- let t = oe(ee);
594
- if (!t) f(d(Dn[p]), "warning");
594
+ let t = ce(ee);
595
+ if (!t) f(d(jn[p]), "warning");
595
596
  else {
596
597
  if (p === "video" || p === "audio") {
597
598
  if (!(p === "video" ? u.insertVideoUrl : u.insertAudioUrl)(t, e)) {
598
- f(d(Dn[p]), "warning");
599
+ f(d(jn[p]), "warning");
599
600
  return;
600
601
  }
601
602
  } else l.commands.setTextSelection(e), p === "image" ? u.setImage(t) : u.insertFile(t);
602
603
  o();
603
604
  }
604
605
  }
605
- return C ? /* @__PURE__ */ U(Tn, {
606
+ return C ? /* @__PURE__ */ W(kn, {
606
607
  className: e?.className,
607
608
  context: t,
608
609
  anchor: m,
609
610
  overlayTarget: r,
610
611
  title: d(`toolbar.${p}.${E}`),
611
612
  onClose: o,
612
- children: [/* @__PURE__ */ U(c.Root, {
613
+ children: [/* @__PURE__ */ W(c.Root, {
613
614
  className: e?.tabs?.className,
614
615
  value: E,
615
616
  onValueChange: (e) => {
616
617
  (e === "upload" || e === "url") && T(e);
617
618
  },
618
619
  children: [
619
- x && S && /* @__PURE__ */ U(c.List, {
620
- className: J("vibe-shadcn-tiptap__media-tabs mb-2 grid w-full grid-cols-2 gap-1", e?.tabs?.listClassName),
620
+ x && S && /* @__PURE__ */ W(c.List, {
621
+ className: Y("vibe-shadcn-tiptap__media-tabs mb-2 grid w-full grid-cols-2 gap-1", e?.tabs?.listClassName),
621
622
  "aria-label": d(`command.${p}`),
622
- children: [/* @__PURE__ */ H(hn, {
623
+ children: [/* @__PURE__ */ U(yn, {
623
624
  appearance: e?.tabs?.trigger,
624
- children: /* @__PURE__ */ H(c.Trigger, {
625
+ children: /* @__PURE__ */ U(c.Trigger, {
625
626
  value: "upload",
626
627
  children: d(`toolbar.${p}.upload`)
627
628
  })
628
- }), /* @__PURE__ */ H(hn, {
629
+ }), /* @__PURE__ */ U(yn, {
629
630
  appearance: e?.tabs?.trigger,
630
- children: /* @__PURE__ */ H(c.Trigger, {
631
+ children: /* @__PURE__ */ U(c.Trigger, {
631
632
  value: "url",
632
633
  children: d(`toolbar.${p}.url`)
633
634
  })
634
635
  })]
635
636
  }),
636
- x && E === "upload" && /* @__PURE__ */ H(c.Content, {
637
+ x && E === "upload" && /* @__PURE__ */ U(c.Content, {
637
638
  value: "upload",
638
639
  className: e?.tabs?.contentClassName,
639
- children: /* @__PURE__ */ U("label", {
640
- className: J("vibe-shadcn-tiptap__drop relative my-2 grid justify-items-center gap-2 rounded-md border-2 border-dashed border-muted-foreground bg-muted p-4 text-center text-foreground hover:border-primary hover:bg-accent has-[:focus-visible]:border-ring", e?.uploadClassName),
640
+ children: /* @__PURE__ */ W("label", {
641
+ className: Y("vibe-shadcn-tiptap__drop relative my-2 grid justify-items-center gap-2 rounded-md border-2 border-dashed border-muted-foreground bg-muted p-4 text-center text-foreground hover:border-primary hover:bg-accent has-[:focus-visible]:border-ring", e?.uploadClassName),
641
642
  onDragOver: (e) => e.preventDefault(),
642
643
  onDrop: (e) => {
643
644
  e.preventDefault(), A(Array.from(e.dataTransfer.files));
644
645
  },
645
646
  children: [
646
- /* @__PURE__ */ H("input", {
647
+ /* @__PURE__ */ U("input", {
647
648
  className: "absolute inset-0 size-full cursor-pointer opacity-0",
648
649
  type: "file",
649
650
  "data-initial-focus": !0,
@@ -651,26 +652,26 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
651
652
  multiple: y.multiple,
652
653
  onChange: (e) => A(Array.from(e.currentTarget.files ?? []))
653
654
  }),
654
- /* @__PURE__ */ H(h, {
655
+ /* @__PURE__ */ U(h, {
655
656
  size: 28,
656
657
  className: "text-muted-foreground",
657
658
  "aria-hidden": "true"
658
659
  }),
659
- /* @__PURE__ */ H("span", { children: d(`toolbar.${p}.dropHint`) })
660
+ /* @__PURE__ */ U("span", { children: d(`toolbar.${p}.dropHint`) })
660
661
  ]
661
662
  })
662
663
  }),
663
- S && E === "url" && /* @__PURE__ */ H(c.Content, {
664
+ S && E === "url" && /* @__PURE__ */ U(c.Content, {
664
665
  value: "url",
665
666
  className: e?.tabs?.contentClassName,
666
- children: /* @__PURE__ */ H("form", {
667
+ children: /* @__PURE__ */ U("form", {
667
668
  id: g,
668
669
  className: "vibe-shadcn-tiptap__fields vibe-shadcn-tiptap__compact-fields grid gap-2.5",
669
670
  onSubmit: (e) => {
670
671
  e.preventDefault(), j();
671
672
  },
672
- children: /* @__PURE__ */ H(s, {
673
- className: J(fn[e?.input?.variant ?? "default"], e?.input?.className),
673
+ children: /* @__PURE__ */ U(s, {
674
+ className: Y(hn[e?.input?.variant ?? "default"], e?.input?.className),
674
675
  "data-initial-focus": !0,
675
676
  "aria-label": d(`toolbar.${p}.url`),
676
677
  placeholder: d(`toolbar.${p}.urlPlaceholder`),
@@ -680,16 +681,16 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
680
681
  })
681
682
  })
682
683
  ]
683
- }), /* @__PURE__ */ U("div", {
684
- className: J("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions vibe-shadcn-tiptap__media-actions mt-2.5 justify-end", X),
685
- children: [/* @__PURE__ */ H(Q, {
684
+ }), /* @__PURE__ */ W("div", {
685
+ className: Y("vibe-shadcn-tiptap__actions vibe-shadcn-tiptap__insertion-actions vibe-shadcn-tiptap__media-actions mt-2.5 justify-end", Z),
686
+ children: [/* @__PURE__ */ U(Q, {
686
687
  type: "button",
687
688
  className: "vibe-shadcn-tiptap__insertion-cancel ms-auto",
688
689
  onClick: () => {
689
690
  o(), (m ?? l.view.dom).focus({ preventScroll: !0 });
690
691
  },
691
692
  children: d("toolbar.action.cancel")
692
- }), E === "url" && /* @__PURE__ */ H(Q, {
693
+ }), E === "url" && /* @__PURE__ */ U(Q, {
693
694
  type: "submit",
694
695
  form: g,
695
696
  children: d("toolbar.action.confirm")
@@ -698,10 +699,10 @@ function kn({ appearance: e, context: t, request: n, overlayTarget: r, canUpload
698
699
  }) : null;
699
700
  }
700
701
  // src/table-picker.tsx
701
- var An = be(function({ row: e, col: t, active: n, current: r, className: i, grid: a, onHover: o, onSelect: s }) {
702
- return /* @__PURE__ */ H("button", {
702
+ var Pn = Se(function({ row: e, col: t, active: n, current: r, className: i, grid: a, onHover: o, onSelect: s }) {
703
+ return /* @__PURE__ */ U("button", {
703
704
  type: "button",
704
- className: J("size-[1.125rem] rounded-xs border border-border bg-background p-0 hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-active:bg-accent", i),
705
+ className: Y("size-[1.125rem] rounded-xs border border-border bg-background p-0 hover:bg-accent focus-visible:outline-2 focus-visible:outline-ring data-active:bg-accent", i),
705
706
  "aria-label": `${e} × ${t}`,
706
707
  "data-cell": `${e}-${t}`,
707
708
  "data-active": n || void 0,
@@ -715,14 +716,14 @@ var An = be(function({ row: e, col: t, active: n, current: r, className: i, grid
715
716
  }
716
717
  });
717
718
  });
718
- function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options: i, disabled: a }) {
719
- let { Popover: o } = Y(), { editor: s, commands: c, t: l } = t, [u, d] = q(!1), [f, p] = q({
719
+ function Fn({ appearance: e, context: t, trigger: n, overlayTarget: r, options: i, disabled: a }) {
720
+ let { Popover: o } = X(), { editor: s, commands: c, t: l } = t, [u, d] = J(!1), [f, p] = J({
720
721
  row: 1,
721
722
  col: 1
722
- }), m = K(void 0), h = K(!1), g = K(null), { maxRows: _, maxCols: v } = i;
723
- G(() => {
723
+ }), m = q(void 0), h = q(!1), g = q(null), { maxRows: _, maxCols: v } = i;
724
+ K(() => {
724
725
  if (!u || a) return;
725
- let e = de(s, () => d(!1));
726
+ let e = pe(s, () => d(!1));
726
727
  return m.current = e, () => {
727
728
  e.dispose(), m.current = void 0;
728
729
  };
@@ -731,12 +732,12 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
731
732
  s,
732
733
  u
733
734
  ]);
734
- let y = xe((e, t) => {
735
+ let y = Ce((e, t) => {
735
736
  p((n) => n.row === e && n.col === t ? n : {
736
737
  row: e,
737
738
  col: t
738
739
  });
739
- }, []), b = xe((e, t) => {
740
+ }, []), b = Ce((e, t) => {
740
741
  let n = m.current?.range;
741
742
  n && s.isEditable && !a && (h.current = !0, s.commands.setTextSelection(n), c.insertTable(e, t), d(!1));
742
743
  }, [
@@ -744,7 +745,7 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
744
745
  a,
745
746
  s
746
747
  ]);
747
- return /* @__PURE__ */ U(o.Root, {
748
+ return /* @__PURE__ */ W(o.Root, {
748
749
  open: u && !a,
749
750
  onOpenChange: (e) => {
750
751
  e && (h.current = !1, p({
@@ -752,32 +753,32 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
752
753
  col: 1
753
754
  })), d(e);
754
755
  },
755
- children: [/* @__PURE__ */ H(o.Trigger, {
756
+ children: [/* @__PURE__ */ U(o.Trigger, {
756
757
  asChild: !0,
757
758
  children: n
758
- }), r && /* @__PURE__ */ U(o.Content, {
759
+ }), r && /* @__PURE__ */ W(o.Content, {
759
760
  container: r,
760
- className: J("z-3 box-border max-w-[calc(100dvw-1rem)]", e?.className),
761
+ className: Y("z-3 box-border max-w-[calc(100dvw-1rem)]", e?.className),
761
762
  "aria-label": l("command.table"),
762
763
  align: "start",
763
764
  sideOffset: 4,
764
765
  onCloseAutoFocus: (e) => {
765
766
  h.current && e.preventDefault();
766
767
  },
767
- children: [/* @__PURE__ */ U("div", {
768
+ children: [/* @__PURE__ */ W("div", {
768
769
  "aria-live": "polite",
769
770
  children: [
770
771
  f.row,
771
772
  " × ",
772
773
  f.col
773
774
  ]
774
- }), /* @__PURE__ */ H("div", {
775
+ }), /* @__PURE__ */ U("div", {
775
776
  ref: g,
776
777
  className: "vibe-shadcn-tiptap__table-picker grid min-w-0 gap-1 overflow-x-auto p-1",
777
778
  style: { gridTemplateColumns: `repeat(${v}, max-content)` },
778
779
  children: Array.from({ length: _ * v }, (t, n) => {
779
780
  let r = Math.floor(n / v) + 1, i = n % v + 1;
780
- return /* @__PURE__ */ H(An, {
781
+ return /* @__PURE__ */ U(Pn, {
781
782
  row: r,
782
783
  col: i,
783
784
  active: r <= f.row && i <= f.col,
@@ -793,8 +794,8 @@ function jn({ appearance: e, context: t, trigger: n, overlayTarget: r, options:
793
794
  });
794
795
  }
795
796
  // src/vibe-tiptap-provider.tsx
796
- var Mn = _e({});
797
- function Nn(e, t) {
797
+ var In = ye({});
798
+ function Ln(e, t) {
798
799
  return {
799
800
  components: t.components ?? e.components,
800
801
  ui: t.ui ?? e.ui,
@@ -807,15 +808,21 @@ function Nn(e, t) {
807
808
  showWordCount: t.showWordCount ?? e.showWordCount
808
809
  };
809
810
  }
810
- function Pn({ children: e, ...t }) {
811
- let n = Nn(Se(Mn), t);
812
- return /* @__PURE__ */ H(Mn.Provider, {
813
- value: n,
811
+ function Rn({ children: e, mediaResources: t, ...n }) {
812
+ let r = we(In), i = {
813
+ ...Ln(r, n),
814
+ mediaResources: t ?? r.mediaResources
815
+ };
816
+ return /* @__PURE__ */ U(In.Provider, {
817
+ value: i,
814
818
  children: e
815
819
  });
816
820
  }
817
- function Fn(e) {
818
- let { components: t, ...n } = Nn(Se(Mn), e);
821
+ function zn() {
822
+ return we(In).mediaResources;
823
+ }
824
+ function Bn(e) {
825
+ let { components: t, ...n } = Ln(we(In), e);
819
826
  if (!t) throw Error("Pass a components mapping to VibeTiptapProvider or directly to the editor or toolbar.");
820
827
  return {
821
828
  components: t,
@@ -823,20 +830,20 @@ function Fn(e) {
823
830
  };
824
831
  }
825
832
  // src/whiteboard-dialog.tsx
826
- function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit: i = !1, onClose: a }) {
827
- let { Dialog: o } = Y(), { editor: s, t: c } = t, [l, u] = q(null), [d, f] = q(), [p, m] = q(!1), [h, g] = q(""), [_] = q(() => i ? s.state.doc.nodeAt(s.state.selection.from)?.attrs.sceneData : void 0), v = K(void 0), y = K(a), b = K(!1), x = K(null), S = K(!1);
828
- G(() => {
829
- y.current = a;
830
- }, [a]), W(() => {
833
+ function Vn({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit: i = !1, onClose: a }) {
834
+ let { Dialog: o } = X(), { editor: s, t: c } = t, [l, u] = J(null), [d, f] = J(), [p, m] = J(!1), [h, g] = J(""), [_] = J(() => i ? s.state.doc.nodeAt(s.state.selection.from)?.attrs : void 0), v = _?.sceneData, y = _?.caption, b = typeof y == "string" && y.trim() || c("command.whiteboard"), x = q(void 0), S = q(a), C = q(!1), w = q(null), T = q(!1);
835
+ K(() => {
836
+ S.current = a;
837
+ }, [a]), G(() => {
831
838
  if (!l) return;
832
839
  let e = l, n = new AbortController(), r = /* @__PURE__ */ new Map(), a, o;
833
840
  async function u() {
834
841
  if (n.signal.aborted) return;
835
842
  o = t.holdWhiteboardSession();
836
- let l = () => y.current(), u = i ? de(s, l) : void 0, d = i ? void 0 : ue(s, l);
843
+ let l = () => S.current(), u = i ? pe(s, l) : void 0, d = i ? void 0 : fe(s, l);
837
844
  if (!(u?.range || d?.active)) l();
838
845
  else {
839
- v.current = {
846
+ x.current = {
840
847
  requests: n,
841
848
  imageUrls: r,
842
849
  target: u,
@@ -845,8 +852,8 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
845
852
  try {
846
853
  let { mountWhiteboard: t } = await import("@vibe-tiptap/editor-ui/whiteboard-canvas");
847
854
  if (n.signal.aborted) return;
848
- if (i && typeof _ != "string") throw Error();
849
- let o = await t(e, typeof _ == "string" ? _ : void 0, r, n.signal, (e) => {
855
+ if (i && typeof v != "string") throw Error();
856
+ let o = await t(e, typeof v == "string" ? v : void 0, r, n.signal, (e) => {
850
857
  n.signal.aborted || f(e);
851
858
  });
852
859
  n.signal.aborted ? o?.() : a = o;
@@ -857,28 +864,28 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
857
864
  }
858
865
  return queueMicrotask(() => void u()), () => {
859
866
  n.abort();
860
- let e = v.current;
861
- e?.requests === n && (v.current = void 0, e.target?.dispose(), e.draft?.cancel()), a && queueMicrotask(a), o?.();
867
+ let e = x.current;
868
+ e?.requests === n && (x.current = void 0, e.target?.dispose(), e.draft?.cancel()), a && queueMicrotask(a), o?.();
862
869
  };
863
870
  }, [
864
871
  l,
865
872
  t,
866
873
  i,
867
874
  s,
868
- _,
875
+ v,
869
876
  c
870
877
  ]);
871
- async function C() {
872
- let e = v.current;
873
- if (!e || !d || b.current || !s.isEditable) return;
878
+ async function E() {
879
+ let e = x.current;
880
+ if (!e || !d || C.current || !s.isEditable) return;
874
881
  let { requests: { signal: r }, imageUrls: a, target: o, draft: l } = e, u = () => !r.aborted && !s.isDestroyed && s.isEditable && !!(i ? o?.range : l?.active);
875
- b.current = !0, m(!0), g("");
882
+ C.current = !0, m(!0), g("");
876
883
  try {
877
884
  let { exportWhiteboard: e } = await import("@vibe-tiptap/editor-ui/whiteboard-canvas");
878
885
  if (!u()) return;
879
886
  let f = s.view.dom.ownerDocument.baseURI, { sceneData: p, file: m } = await e(d, a, n, f, r);
880
887
  if (!u()) return;
881
- let h = pe(m, "whiteboard", { maxSize: t.whiteboardPreviewMaxSize });
888
+ let h = he(m, "whiteboard", { maxSize: t.whiteboardPreviewMaxSize });
882
889
  if (h?.reason === "too-large") {
883
890
  g(c("notify.assetFileTooLarge", {
884
891
  size: M(h.size),
@@ -886,37 +893,37 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
886
893
  }));
887
894
  return;
888
895
  }
889
- let v = await n(m, "whiteboard"), b = (typeof v == "string" ? v : v?.url)?.trim();
896
+ let _ = await n(m, "whiteboard"), y = (typeof _ == "string" ? _ : _?.url)?.trim();
890
897
  if (!u()) return;
891
- if (!b || new URL(b, f).protocol === "data:") throw Error();
898
+ if (!y || new URL(y, f).protocol === "data:") throw Error();
892
899
  if (i) {
893
900
  let e = o?.range;
894
901
  if (!e) return;
895
902
  let { doc: t, tr: n } = s.state, r = t.nodeAt(e.from);
896
- if (r?.type.name !== "whiteboard" || r.attrs.sceneData !== _) throw Error();
897
- s.view.dispatch(n.setNodeAttribute(e.from, "src", b).setNodeAttribute(e.from, "sceneData", p));
903
+ if (r?.type.name !== "whiteboard" || r.attrs.sceneData !== v) throw Error();
904
+ s.view.dispatch(n.setNodeAttribute(e.from, "src", y).setNodeAttribute(e.from, "sceneData", p));
898
905
  } else if (!l?.complete({
899
- src: b,
906
+ src: y,
900
907
  sceneData: p
901
908
  })) throw Error();
902
- S.current = !0, y.current(), s.commands.focus();
909
+ T.current = !0, S.current(), s.commands.focus();
903
910
  } catch {
904
911
  r.aborted || g(c("whiteboard.saveFailed"));
905
912
  } finally {
906
- b.current = !1, r.aborted || m(!1);
913
+ C.current = !1, r.aborted || m(!1);
907
914
  }
908
915
  }
909
- return /* @__PURE__ */ H(Z, {
916
+ return /* @__PURE__ */ U(_n, {
910
917
  value: e?.button,
911
- children: /* @__PURE__ */ H(o.Root, {
918
+ children: /* @__PURE__ */ U(o.Root, {
912
919
  open: !0,
913
920
  onOpenChange: (e) => {
914
921
  !e && !p && a();
915
922
  },
916
- children: /* @__PURE__ */ U(o.Content, {
923
+ children: /* @__PURE__ */ W(o.Content, {
917
924
  container: r,
918
925
  overlayClassName: "vibe-shadcn-tiptap__backdrop",
919
- className: J("vibe-shadcn-tiptap__whiteboard", e?.className),
926
+ className: Y("vibe-shadcn-tiptap__whiteboard", e?.className),
920
927
  "data-excalidraw-modal-root": !0,
921
928
  "aria-describedby": void 0,
922
929
  onInteractOutside: (e) => e.preventDefault(),
@@ -925,25 +932,31 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
925
932
  },
926
933
  onOpenAutoFocus: () => {
927
934
  let e = r.ownerDocument.activeElement;
928
- e instanceof HTMLElement && (x.current = e);
935
+ e instanceof HTMLElement && (w.current = e);
929
936
  },
930
937
  onCloseAutoFocus: (e) => {
931
- if (e.preventDefault(), !S.current && !s.isDestroyed) {
932
- let e = x.current;
938
+ if (e.preventDefault(), !T.current && !s.isDestroyed) {
939
+ let e = w.current;
933
940
  (e && r.parentElement?.contains(e) ? e : s.view.dom).focus();
934
941
  }
935
942
  },
936
- children: [/* @__PURE__ */ U("header", {
937
- className: J("vibe-shadcn-tiptap__actions", X),
943
+ children: [/* @__PURE__ */ W("header", {
944
+ className: Y("vibe-shadcn-tiptap__actions", Z),
938
945
  children: [
939
- /* @__PURE__ */ H(o.Title, { children: c("command.whiteboard") }),
940
- h && /* @__PURE__ */ H("span", {
946
+ /* @__PURE__ */ W(o.Title, {
947
+ className: "vibe-shadcn-tiptap__whiteboard-title",
948
+ children: [/* @__PURE__ */ U(Et, {
949
+ size: 16,
950
+ "aria-hidden": "true"
951
+ }), /* @__PURE__ */ U("span", { children: b })]
952
+ }),
953
+ h && /* @__PURE__ */ U("span", {
941
954
  role: "alert",
942
955
  children: h
943
956
  }),
944
- /* @__PURE__ */ H(o.Close, {
957
+ /* @__PURE__ */ U(o.Close, {
945
958
  asChild: !0,
946
- children: /* @__PURE__ */ H(Q, {
959
+ children: /* @__PURE__ */ U(Q, {
947
960
  type: "button",
948
961
  className: "vibe-shadcn-tiptap__button",
949
962
  defaultSizeClassName: "px-2 py-1",
@@ -951,21 +964,21 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
951
964
  children: c("toolbar.action.cancel")
952
965
  })
953
966
  }),
954
- /* @__PURE__ */ U(Q, {
967
+ /* @__PURE__ */ W(Q, {
955
968
  type: "button",
956
969
  variant: "default",
957
970
  className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__whiteboard-save",
958
971
  disabled: !d || p,
959
972
  "aria-busy": p || void 0,
960
- onClick: () => void C(),
961
- children: [p && /* @__PURE__ */ H(gt, {
973
+ onClick: () => void E(),
974
+ children: [p && /* @__PURE__ */ U(vt, {
962
975
  "aria-hidden": "true",
963
976
  className: "vibe-shadcn-tiptap__spinner",
964
977
  size: 16
965
978
  }), c("whiteboard.save")]
966
979
  })
967
980
  ]
968
- }), /* @__PURE__ */ H("div", {
981
+ }), /* @__PURE__ */ U("div", {
969
982
  ref: u,
970
983
  className: "vibe-shadcn-tiptap__whiteboard-canvas",
971
984
  inert: p
@@ -975,133 +988,133 @@ function In({ appearance: e, context: t, uploadAsset: n, overlayTarget: r, edit:
975
988
  });
976
989
  }
977
990
  // src/shadcn-tiptap-toolbar.tsx
978
- var Ln = {
979
- undo: Ut,
980
- redo: kt,
981
- bold: Fe,
982
- italic: dt,
983
- underline: Ht,
984
- strike: Ft,
985
- code: He,
986
- superscript: Lt,
987
- subscript: It,
988
- color: xt,
989
- highlight: it,
990
- clearFormat: Je,
991
- align: ke,
992
- decreaseIndent: lt,
993
- increaseIndent: ut,
994
- firstLineIndent: Bn,
995
- bulletList: pt,
996
- orderedList: ht,
997
- taskList: mt,
998
- blockquote: Ot,
999
- codeBlock: Ue,
1000
- link: ft,
1001
- image: at,
1002
- video: Ze,
1003
- audio: bt,
1004
- attachment: St,
1005
- table: Rt,
1006
- whiteboard: wt,
1007
- hr: yt,
1008
- findReplace: Pt,
1009
- markdown: Vn,
1010
- print: Dt,
1011
- preview: Xe,
1012
- fullscreen: _t
1013
- }, Rn = {
1014
- left: ke,
1015
- center: De,
1016
- right: Ae,
1017
- justify: Oe
1018
- }, zn = {
1019
- 0: Tt,
1020
- 1: Qe,
1021
- 2: $e,
1022
- 3: et,
1023
- 4: tt,
1024
- 5: nt,
1025
- 6: rt
991
+ var Hn = {
992
+ undo: Gt,
993
+ redo: jt,
994
+ bold: Le,
995
+ italic: pt,
996
+ underline: Wt,
997
+ strike: Lt,
998
+ code: We,
999
+ superscript: zt,
1000
+ subscript: Rt,
1001
+ color: Ct,
1002
+ highlight: ot,
1003
+ clearFormat: Xe,
1004
+ align: je,
1005
+ decreaseIndent: dt,
1006
+ increaseIndent: ft,
1007
+ firstLineIndent: Gn,
1008
+ bulletList: ht,
1009
+ orderedList: _t,
1010
+ taskList: gt,
1011
+ blockquote: At,
1012
+ codeBlock: Ge,
1013
+ link: mt,
1014
+ image: st,
1015
+ video: $e,
1016
+ audio: St,
1017
+ attachment: wt,
1018
+ table: Bt,
1019
+ whiteboard: Et,
1020
+ hr: xt,
1021
+ findReplace: It,
1022
+ markdown: Kn,
1023
+ print: kt,
1024
+ preview: Qe,
1025
+ fullscreen: yt
1026
+ }, Un = {
1027
+ left: je,
1028
+ center: ke,
1029
+ right: Me,
1030
+ justify: Ae
1031
+ }, Wn = {
1032
+ 0: Dt,
1033
+ 1: et,
1034
+ 2: tt,
1035
+ 3: nt,
1036
+ 4: rt,
1037
+ 5: it,
1038
+ 6: at
1026
1039
  };
1027
- function Bn({ size: e }) {
1028
- return /* @__PURE__ */ H("svg", {
1040
+ function Gn({ size: e }) {
1041
+ return /* @__PURE__ */ U("svg", {
1029
1042
  width: e,
1030
1043
  height: e,
1031
- viewBox: en,
1044
+ viewBox: nn,
1032
1045
  fill: "none",
1033
1046
  stroke: "currentColor",
1034
- strokeWidth: Xt.strokeWidth,
1047
+ strokeWidth: Qt.strokeWidth,
1035
1048
  strokeLinecap: "round",
1036
1049
  strokeLinejoin: "round",
1037
1050
  "aria-hidden": "true",
1038
1051
  focusable: "false",
1039
- children: Xt.paths.map((e) => /* @__PURE__ */ H("path", { d: e }, e))
1052
+ children: Qt.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
1040
1053
  });
1041
1054
  }
1042
- function Vn({ size: e, action: t }) {
1043
- return /* @__PURE__ */ U("svg", {
1055
+ function Kn({ size: e, action: t }) {
1056
+ return /* @__PURE__ */ W("svg", {
1044
1057
  width: e,
1045
1058
  height: e,
1046
- viewBox: en,
1059
+ viewBox: nn,
1047
1060
  fill: "none",
1048
1061
  stroke: "currentColor",
1049
- strokeWidth: $t.strokeWidth,
1062
+ strokeWidth: tn.strokeWidth,
1050
1063
  strokeLinecap: "round",
1051
1064
  strokeLinejoin: "round",
1052
1065
  "aria-hidden": "true",
1053
1066
  focusable: "false",
1054
- children: [/* @__PURE__ */ H("g", {
1055
- transform: t ? Qt : void 0,
1056
- children: $t.paths.map((e) => /* @__PURE__ */ H("path", { d: e }, e))
1057
- }), t && Zt[t].map((e) => /* @__PURE__ */ H("path", { d: e }, e))]
1067
+ children: [/* @__PURE__ */ U("g", {
1068
+ transform: t ? en : void 0,
1069
+ children: tn.paths.map((e) => /* @__PURE__ */ U("path", { d: e }, e))
1070
+ }), t && $t[t].map((e) => /* @__PURE__ */ U("path", { d: e }, e))]
1058
1071
  });
1059
1072
  }
1060
- function Hn(e) {
1073
+ function qn(e) {
1061
1074
  let { components: t, showWordCount: n, ...r } = {
1062
1075
  ...e,
1063
- ...Fn(e)
1076
+ ...Bn(e)
1064
1077
  }, { Tooltip: i } = t;
1065
- return /* @__PURE__ */ H(un, {
1078
+ return /* @__PURE__ */ U(pn, {
1066
1079
  value: t,
1067
- children: /* @__PURE__ */ H(i.Provider, {
1080
+ children: /* @__PURE__ */ U(i.Provider, {
1068
1081
  delayDuration: 500,
1069
1082
  skipDelayDuration: 0,
1070
- children: /* @__PURE__ */ H(Un, { ...r }, r.context.editor.instanceId)
1083
+ children: /* @__PURE__ */ U(Jn, { ...r }, r.context.editor.instanceId)
1071
1084
  })
1072
1085
  });
1073
1086
  }
1074
- function Un(e) {
1075
- let { DropdownMenu: t, Select: n } = Y(), i = e.bubble ? void 0 : e.ui?.toolbar, { context: a, preview: o, fullscreen: c, uploadAsset: u } = e, { editor: f, commands: h, t: _ } = a;
1076
- V(a, (e) => e.getToolbarRevision());
1077
- let [v, y] = q(null), [b, S] = q(), [w, T] = q(!1), [D, O] = q(!1), k = K(null), A = e.overlayTarget ?? v ?? void 0, j = f.isEditable, te = ce(e.editorBehaviorOptions), M = ee(e.toolbarOptions, e.codeBlockLanguages, e.horizontalRules), re = we(() => r(e.colors, e.highlights), [e.colors, e.highlights]), F = P(f), I = m(e.markdownOptions), oe = /* @__PURE__ */ new Map(), se = E(e.toolbar).map((e) => {
1078
- let t = e.join(" "), n = oe.get(t) ?? 0;
1079
- return oe.set(t, n + 1), {
1087
+ function Jn(e) {
1088
+ let { DropdownMenu: t, Select: n } = X(), i = e.bubble ? void 0 : e.ui?.toolbar, { context: a, preview: o, fullscreen: c, uploadAsset: u } = e, { editor: f, commands: h, t: _ } = a;
1089
+ H(a, (e) => e.getToolbarRevision());
1090
+ let [v, y] = J(null), [b, S] = J(), [w, T] = J(!1), [D, O] = J(!1), k = q(null), A = e.overlayTarget ?? v ?? void 0, j = f.isEditable, te = z(e.editorBehaviorOptions), ne = ee(e.toolbarOptions, e.codeBlockLanguages, e.horizontalRules), M = Ee(() => r(e.colors, e.highlights), [e.colors, e.highlights]), P = oe(f), ae = m(e.markdownOptions), F = /* @__PURE__ */ new Map(), I = E(e.toolbar).map((e) => {
1091
+ let t = e.join(" "), n = F.get(t) ?? 0;
1092
+ return F.set(t, n + 1), {
1080
1093
  id: `${t}:${n}`,
1081
- buttons: e.filter(R)
1094
+ buttons: e.filter(ce)
1082
1095
  };
1083
1096
  }).filter(({ buttons: e }) => e.length > 0);
1084
- W(() => {
1097
+ G(() => {
1085
1098
  j || (S(void 0), O(!1));
1086
1099
  }, [j]);
1087
- function R(e) {
1088
- return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!F : e === "preview" ? o !== void 0 : e === "fullscreen" ? c !== void 0 : o ? e === "print" : e === "whiteboard" ? !!(u && f.schema.nodes.whiteboard) : e === "image" && !u && !te.image.allowUrl ? !1 : e === "image" || e === "video" || e === "audio" || e === "attachment" ? !!f.schema.nodes[N(e === "attachment" ? "file" : e)] : !0;
1100
+ function ce(e) {
1101
+ return e === "findReplace" ? typeof f.commands.openFindReplace == "function" : e === "markdown" ? !!P : e === "preview" ? o !== void 0 : e === "fullscreen" ? c !== void 0 : o ? e === "print" : e === "whiteboard" ? !!(u && f.schema.nodes.whiteboard) : e === "image" && !u && !te.image.allowUrl ? !1 : e === "image" || e === "video" || e === "audio" || e === "attachment" ? !!f.schema.nodes[ie(e === "attachment" ? "file" : e)] : !0;
1089
1102
  }
1090
- function z(e, t) {
1103
+ function R(e, t) {
1091
1104
  return f.isDestroyed ? !0 : e === "print" || e === "fullscreen" || e === "markdown" ? !1 : e === "preview" ? !o && !j : !j && e !== "findReplace" || e !== "whiteboard" && !L(a, e, t);
1092
1105
  }
1093
1106
  function le(e, t) {
1094
1107
  if (e === "preview") return o;
1095
1108
  if (e === "fullscreen") return c;
1096
- if (e !== "print" && e !== "markdown" && e !== "whiteboard") return ae(a, e, t);
1109
+ if (e !== "print" && e !== "markdown" && e !== "whiteboard") return se(a, e, t);
1097
1110
  }
1098
- function ue(t, n) {
1099
- z(t, n) || (t === "preview" ? e.onPreviewChange?.(!o) : t === "fullscreen" ? e.onFullscreenChange?.(!c) : t === "print" ? g(a.getHTML(), {
1111
+ function B(t, n) {
1112
+ R(t, n) || (t === "preview" ? e.onPreviewChange?.(!o) : t === "fullscreen" ? e.onFullscreenChange?.(!c) : t === "print" ? g(a.getHTML(), {
1100
1113
  ...e.printOptions,
1101
1114
  t: _
1102
- }) : t === "whiteboard" ? e.openWhiteboard ? e.openWhiteboard() : O(!0) : t === "link" ? e.openLinkPopover?.() : t === "image" ? e.openImagePopover?.() : t === "video" ? e.openVideoPopover?.() : t === "audio" ? e.openAudioPopover?.() : t === "findReplace" && a.findReplaceState.open ? h.closeFindReplace() : t !== "markdown" && B(a, t, n));
1115
+ }) : t === "whiteboard" ? e.openWhiteboard ? e.openWhiteboard() : O(!0) : t === "link" ? e.openLinkPopover?.() : t === "image" ? e.openImagePopover?.() : t === "video" ? e.openVideoPopover?.() : t === "audio" ? e.openAudioPopover?.() : t === "findReplace" && a.findReplaceState.open ? h.closeFindReplace() : t !== "markdown" && de(a, t, n));
1103
1116
  }
1104
- function de(t, n, r) {
1117
+ function ue(t, n, r) {
1105
1118
  let i = {
1106
1119
  link: e.openLinkPopover,
1107
1120
  image: e.openImagePopover,
@@ -1110,7 +1123,7 @@ function Un(e) {
1110
1123
  attachment: void 0
1111
1124
  };
1112
1125
  if (t === "link" || t === "image" || t === "video" || t === "audio" || t === "attachment") {
1113
- if (z(t)) return;
1126
+ if (R(t)) return;
1114
1127
  let e = i[t];
1115
1128
  e ? e() : S((e) => e?.triggerId === r ? void 0 : {
1116
1129
  triggerId: r,
@@ -1119,62 +1132,62 @@ function Un(e) {
1119
1132
  anchor: n
1120
1133
  }
1121
1134
  });
1122
- } else ue(t);
1135
+ } else B(t);
1123
1136
  }
1124
- function fe(r, u) {
1137
+ function V(r, u) {
1125
1138
  let p = `${u}:${r}`;
1126
- if (r === "color" || r === "highlight") return /* @__PURE__ */ H(Cn, {
1139
+ if (r === "color" || r === "highlight") return /* @__PURE__ */ U(Dn, {
1127
1140
  appearance: e.ui?.colorPicker,
1128
1141
  context: a,
1129
1142
  kind: r,
1130
- disabled: z(r),
1131
- colors: r === "color" ? re.colors : re.highlights,
1143
+ disabled: R(r),
1144
+ colors: r === "color" ? M.colors : M.highlights,
1132
1145
  overlayTarget: A,
1133
1146
  bubble: e.bubble,
1134
1147
  open: e.bubble ? e.openPalette === r : void 0,
1135
1148
  onOpenChange: (t) => e.onPaletteOpenChange?.(r, t)
1136
1149
  }, r);
1137
1150
  if (r === "heading") {
1138
- let t = i?.heading, o = ne(a), s = zn[o], c = o || f.isActive("paragraph") ? String(o) : "", l = (e) => e ? _("toolbar.heading.level", { level: e }) : _("toolbar.heading.body"), u = /* @__PURE__ */ U("span", {
1139
- className: J("vibe-shadcn-tiptap__heading-value inline-flex items-center gap-2 whitespace-nowrap", t?.valueClassName),
1140
- children: [/* @__PURE__ */ H(s, {
1151
+ let t = i?.heading, o = N(a), s = Wn[o], c = o || f.isActive("paragraph") ? String(o) : "", l = (e) => e ? _("toolbar.heading.level", { level: e }) : _("toolbar.heading.body"), u = /* @__PURE__ */ W("span", {
1152
+ className: Y("vibe-shadcn-tiptap__heading-value inline-flex items-center gap-2 whitespace-nowrap", t?.valueClassName),
1153
+ children: [/* @__PURE__ */ U(s, {
1141
1154
  size: 16,
1142
1155
  "aria-hidden": !0
1143
1156
  }), l(o)]
1144
1157
  });
1145
- return /* @__PURE__ */ U(n.Root, {
1158
+ return /* @__PURE__ */ W(n.Root, {
1146
1159
  value: c,
1147
- disabled: z(r),
1148
- onValueChange: (e) => ue(r, Number(e)),
1149
- children: [/* @__PURE__ */ H(n.Trigger, {
1160
+ disabled: R(r),
1161
+ onValueChange: (e) => B(r, Number(e)),
1162
+ children: [/* @__PURE__ */ U(n.Trigger, {
1150
1163
  asChild: !0,
1151
- children: /* @__PURE__ */ U(Q, {
1164
+ children: /* @__PURE__ */ W(Q, {
1152
1165
  appearance: t?.button,
1153
1166
  type: "button",
1154
1167
  className: "vibe-shadcn-tiptap__button",
1155
1168
  "aria-label": _("command.heading"),
1156
1169
  "data-toolbar-key": e.bubble ? void 0 : r,
1157
1170
  onMouseDown: (e) => e.preventDefault(),
1158
- children: [/* @__PURE__ */ H(n.Value, {
1171
+ children: [/* @__PURE__ */ U(n.Value, {
1159
1172
  placeholder: u,
1160
1173
  children: u
1161
- }), /* @__PURE__ */ H(Re, { size: 12 })]
1174
+ }), /* @__PURE__ */ U(Be, { size: 12 })]
1162
1175
  })
1163
- }), A && /* @__PURE__ */ H(n.Content, {
1176
+ }), A && /* @__PURE__ */ U(n.Content, {
1164
1177
  container: A,
1165
1178
  position: "item-aligned",
1166
- className: J("z-3", t?.contentClassName),
1179
+ className: Y("z-3", t?.contentClassName),
1167
1180
  onCloseAutoFocus: (e) => {
1168
1181
  f.isFocused && e.preventDefault();
1169
1182
  },
1170
1183
  children: C.map(({ level: e }) => {
1171
- let i = zn[e], a = String(e) === c;
1172
- return /* @__PURE__ */ U(n.Item, {
1184
+ let i = Wn[e], a = String(e) === c;
1185
+ return /* @__PURE__ */ W(n.Item, {
1173
1186
  value: String(e),
1174
- className: J("vibe-shadcn-tiptap__menu-item", t?.itemClassName),
1175
- disabled: !a && z(r, e),
1187
+ className: Y("vibe-shadcn-tiptap__menu-item", t?.itemClassName),
1188
+ disabled: !a && R(r, e),
1176
1189
  "data-active": a || void 0,
1177
- children: [/* @__PURE__ */ H(i, {
1190
+ children: [/* @__PURE__ */ U(i, {
1178
1191
  size: 16,
1179
1192
  "aria-hidden": !0
1180
1193
  }), l(e)]
@@ -1183,48 +1196,48 @@ function Un(e) {
1183
1196
  })]
1184
1197
  }, r);
1185
1198
  }
1186
- let m = r === "preview" && o ? Ct : r === "fullscreen" && c ? vt : r === "align" ? Rn[ie(a)] : Ln[r], h = _(r === "preview" && o ? "toolbar.preview.edit" : r === "fullscreen" && c ? "toolbar.fullscreen.exit" : `command.${r}`), g = /* @__PURE__ */ H($, {
1199
+ let m = r === "preview" && o ? Tt : r === "fullscreen" && c ? bt : r === "align" ? Un[re(a)] : Hn[r], h = _(r === "preview" && o ? "toolbar.preview.edit" : r === "fullscreen" && c ? "toolbar.fullscreen.exit" : `command.${r}`), g = /* @__PURE__ */ U($, {
1187
1200
  size: "icon",
1188
1201
  label: h,
1189
1202
  overlayTarget: A,
1190
1203
  "data-toolbar-key": e.bubble ? void 0 : r,
1191
- disabled: z(r),
1204
+ disabled: R(r),
1192
1205
  "aria-pressed": r === "findReplace" ? void 0 : le(r),
1193
1206
  "aria-expanded": r === "findReplace" ? a.findReplaceState.open : r === "link" || r === "image" || r === "video" || r === "audio" || r === "attachment" ? b?.triggerId === p : void 0,
1194
1207
  onMouseDown: (e) => e.preventDefault(),
1195
- children: /* @__PURE__ */ H(m, {
1208
+ children: /* @__PURE__ */ U(m, {
1196
1209
  size: 16,
1197
1210
  "aria-hidden": !0
1198
1211
  })
1199
1212
  });
1200
- if (r === "table") return /* @__PURE__ */ H(jn, {
1213
+ if (r === "table") return /* @__PURE__ */ U(Fn, {
1201
1214
  appearance: e.ui?.tablePicker,
1202
1215
  context: a,
1203
1216
  trigger: g,
1204
1217
  overlayTarget: A,
1205
- options: M.tableGrid,
1206
- disabled: z(r)
1218
+ options: ne.tableGrid,
1219
+ disabled: R(r)
1207
1220
  }, r);
1208
- if (r === "markdown") return /* @__PURE__ */ U(t.Root, {
1221
+ if (r === "markdown") return /* @__PURE__ */ W(t.Root, {
1209
1222
  modal: !1,
1210
- children: [/* @__PURE__ */ H(t.Trigger, {
1223
+ children: [/* @__PURE__ */ U(t.Trigger, {
1211
1224
  asChild: !0,
1212
1225
  children: g
1213
- }), A && /* @__PURE__ */ H(t.Content, {
1226
+ }), A && /* @__PURE__ */ U(t.Content, {
1214
1227
  container: A,
1215
1228
  className: "z-3",
1216
1229
  sideOffset: 4,
1217
1230
  align: "start",
1218
- children: s.map(({ value: e }) => /* @__PURE__ */ U(t.Item, {
1231
+ children: s.map(({ value: e }) => /* @__PURE__ */ W(t.Item, {
1219
1232
  className: "vibe-shadcn-tiptap__menu-item",
1220
- disabled: e === "import" ? o || !j || w || !F?.parse : !F?.serialize,
1233
+ disabled: e === "import" ? o || !j || w || !P?.parse : !P?.serialize,
1221
1234
  onSelect: () => {
1222
1235
  e === "import" ? k.current?.click() : e === "export" ? d(a, {
1223
- filename: I.exportFilename,
1236
+ filename: ae.exportFilename,
1224
1237
  t: _
1225
1238
  }) : l(a, { t: _ });
1226
1239
  },
1227
- children: [/* @__PURE__ */ H(Vn, {
1240
+ children: [/* @__PURE__ */ U(Kn, {
1228
1241
  size: 16,
1229
1242
  action: e
1230
1243
  }), _(`toolbar.markdown.${e}`)]
@@ -1233,32 +1246,32 @@ function Un(e) {
1233
1246
  }, r);
1234
1247
  let v = (() => {
1235
1248
  if (r === "align") return x.map(({ value: e }) => {
1236
- let t = Rn[e];
1249
+ let t = Un[e];
1237
1250
  return {
1238
1251
  value: e,
1239
1252
  label: _(`toolbar.align.${e}`),
1240
- icon: /* @__PURE__ */ H(t, {
1253
+ icon: /* @__PURE__ */ U(t, {
1241
1254
  size: 16,
1242
1255
  "aria-hidden": !0
1243
1256
  })
1244
1257
  };
1245
1258
  });
1246
- if (r === "codeBlock") return M.codeBlockLanguages;
1247
- if (r === "hr") return M.horizontalRules.map((e) => ({
1259
+ if (r === "codeBlock") return ne.codeBlockLanguages;
1260
+ if (r === "hr") return ne.horizontalRules.map((e) => ({
1248
1261
  ...e,
1249
- icon: /* @__PURE__ */ H("span", {
1262
+ icon: /* @__PURE__ */ U("span", {
1250
1263
  className: "vibe-shadcn-tiptap__divider-icon",
1251
1264
  "data-style": e.value,
1252
1265
  "aria-hidden": !0
1253
1266
  })
1254
1267
  }));
1255
1268
  })();
1256
- return v ? /* @__PURE__ */ U(t.Root, {
1269
+ return v ? /* @__PURE__ */ W(t.Root, {
1257
1270
  modal: !1,
1258
- children: [/* @__PURE__ */ H(t.Trigger, {
1271
+ children: [/* @__PURE__ */ U(t.Trigger, {
1259
1272
  asChild: !0,
1260
1273
  children: g
1261
- }), A && /* @__PURE__ */ H(t.Content, {
1274
+ }), A && /* @__PURE__ */ U(t.Content, {
1262
1275
  container: A,
1263
1276
  align: "start",
1264
1277
  sideOffset: 4,
@@ -1266,40 +1279,40 @@ function Un(e) {
1266
1279
  onCloseAutoFocus: (e) => {
1267
1280
  f.isFocused && e.preventDefault();
1268
1281
  },
1269
- children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */ U(t.Item, {
1282
+ children: v.map(({ value: e, label: n, icon: i }) => /* @__PURE__ */ W(t.Item, {
1270
1283
  className: "vibe-shadcn-tiptap__menu-item",
1271
- disabled: z(r, e),
1284
+ disabled: R(r, e),
1272
1285
  "data-active": le(r, e) || void 0,
1273
- onSelect: () => ue(r, e),
1286
+ onSelect: () => B(r, e),
1274
1287
  children: [i, n]
1275
1288
  }, e))
1276
1289
  })]
1277
- }, r) : /* @__PURE__ */ ve($, {
1290
+ }, r) : /* @__PURE__ */ be($, {
1278
1291
  ...g.props,
1279
1292
  key: r,
1280
- onClick: (e) => de(r, e.currentTarget, p)
1293
+ onClick: (e) => ue(r, e.currentTarget, p)
1281
1294
  });
1282
1295
  }
1283
- return /* @__PURE__ */ H(Z, {
1296
+ return /* @__PURE__ */ U(_n, {
1284
1297
  value: e.bubble ? e.ui?.bubble?.button : i?.button,
1285
- children: /* @__PURE__ */ U("div", {
1298
+ children: /* @__PURE__ */ W("div", {
1286
1299
  ref: y,
1287
- className: J("vibe-shadcn-tiptap__toolbar", X, !e.bubble && "border-b border-border p-1.5", i?.className),
1300
+ className: Y("vibe-shadcn-tiptap__toolbar", Z, !e.bubble && "border-b border-border p-1.5", i?.className),
1288
1301
  role: "toolbar",
1289
1302
  "aria-label": e.bubble ? void 0 : "Editor toolbar",
1290
1303
  children: [
1291
- F && !e.bubble && /* @__PURE__ */ H("input", {
1304
+ P && !e.bubble && /* @__PURE__ */ U("input", {
1292
1305
  ref: k,
1293
1306
  type: "file",
1294
1307
  hidden: !0,
1295
- accept: I.importAccept,
1308
+ accept: ae.importAccept,
1296
1309
  onChange: async (e) => {
1297
1310
  let t = e.currentTarget, n = t.files?.[0];
1298
- if (t.value = "", n && j && F?.parse && !w) {
1311
+ if (t.value = "", n && j && P?.parse && !w) {
1299
1312
  T(!0);
1300
1313
  try {
1301
1314
  await p(a, n, {
1302
- strict: I.importStrict,
1315
+ strict: ae.importStrict,
1303
1316
  t: _,
1304
1317
  canImport: () => k.current === t && f.isEditable && !f.isDestroyed
1305
1318
  });
@@ -1309,11 +1322,11 @@ function Un(e) {
1309
1322
  }
1310
1323
  }
1311
1324
  }),
1312
- se.map(({ id: e, buttons: t }, n) => /* @__PURE__ */ H("div", {
1313
- className: J("vibe-shadcn-tiptap__toolbar-group", X, n > 0 && "border-s border-border ps-1", i?.groupClassName),
1314
- children: t.map((t) => fe(t, e))
1325
+ I.map(({ id: e, buttons: t }, n) => /* @__PURE__ */ U("div", {
1326
+ className: Y("vibe-shadcn-tiptap__toolbar-group", Z, n > 0 && "border-s border-border ps-1", i?.groupClassName),
1327
+ children: t.map((t) => V(t, e))
1315
1328
  }, e)),
1316
- j && b && A && /* @__PURE__ */ H(wn, {
1329
+ j && b && A && /* @__PURE__ */ U(On, {
1317
1330
  appearance: e.ui?.insertionPopover,
1318
1331
  context: a,
1319
1332
  request: b.request,
@@ -1322,7 +1335,7 @@ function Un(e) {
1322
1335
  behaviorOptions: e.editorBehaviorOptions,
1323
1336
  onClose: () => S(void 0)
1324
1337
  }, b.triggerId),
1325
- j && D && u && A && /* @__PURE__ */ H(In, {
1338
+ j && D && u && A && /* @__PURE__ */ U(Vn, {
1326
1339
  appearance: e.ui?.whiteboard,
1327
1340
  context: a,
1328
1341
  uploadAsset: u,
@@ -1334,7 +1347,7 @@ function Un(e) {
1334
1347
  });
1335
1348
  }
1336
1349
  // src/editor-bubble.tsx
1337
- var Wn = "vibeRadixBubble", Gn = 8, Kn = [
1350
+ var Yn = "vibeRadixBubble", Xn = 8, Zn = [
1338
1351
  "bold",
1339
1352
  "italic",
1340
1353
  "underline",
@@ -1343,19 +1356,19 @@ var Wn = "vibeRadixBubble", Gn = 8, Kn = [
1343
1356
  "color",
1344
1357
  "highlight",
1345
1358
  "clearFormat"
1346
- ], qn = /* @__PURE__ */ new Set([
1359
+ ], Qn = /* @__PURE__ */ new Set([
1347
1360
  "image",
1348
1361
  "video",
1349
1362
  "audio",
1350
1363
  "fileAttachment",
1351
1364
  "whiteboard"
1352
1365
  ]);
1353
- function Jn(e) {
1366
+ function $n(e) {
1354
1367
  let { selection: t, schema: n, doc: r } = e.state, i = n.marks.link;
1355
- if (!(t instanceof Ee) || !i) return;
1368
+ if (!(t instanceof Oe) || !i) return;
1356
1369
  let a = i.isInSet(t.$from.nodeAfter?.marks ?? []), o = a?.attrs.href, s = a?.attrs.target;
1357
1370
  if (!a || typeof o != "string" || !o) return;
1358
- let c = he(t.$from, i, a.attrs);
1371
+ let c = _e(t.$from, i, a.attrs);
1359
1372
  if (!(!c || t.to > c.to || t.from < c.from)) return {
1360
1373
  ...c,
1361
1374
  href: o,
@@ -1363,16 +1376,16 @@ function Jn(e) {
1363
1376
  target: typeof s == "string" ? s : void 0
1364
1377
  };
1365
1378
  }
1366
- function Yn({ editor: e, element: t }) {
1379
+ function er({ editor: e, element: t }) {
1367
1380
  if (e.isDestroyed || !e.isEditable) return !1;
1368
1381
  let { view: n, state: { selection: r } } = e, i = n.dom.ownerDocument.activeElement;
1369
- return !n.hasFocus() && !t.contains(i) && i?.closest("[data-bubble-palette]")?.getAttribute("data-bubble-palette") !== String(e.instanceId) || e.isActive("codeBlock") ? !1 : r instanceof Te ? qn.has(r.node.type.name) && r.node.attrs.uploadStatus !== "uploading" : !!Jn(e) || Xn(e);
1382
+ return !n.hasFocus() && !t.contains(i) && i?.closest("[data-bubble-palette]")?.getAttribute("data-bubble-palette") !== String(e.instanceId) || e.isActive("codeBlock") ? !1 : r instanceof De ? Qn.has(r.node.type.name) && r.node.attrs.uploadStatus !== "uploading" : !!$n(e) || tr(e);
1370
1383
  }
1371
- function Xn(e) {
1384
+ function tr(e) {
1372
1385
  let { selection: t, doc: n } = e.state;
1373
- return t instanceof Ee && !t.empty && !e.isActive("table") && !e.isActive("codeBlock") && !!n.textBetween(t.from, t.to);
1386
+ return t instanceof Oe && !t.empty && !e.isActive("table") && !e.isActive("codeBlock") && !!n.textBetween(t.from, t.to);
1374
1387
  }
1375
- async function Zn(e, t, n = !1) {
1388
+ async function nr(e, t, n = !1) {
1376
1389
  let { editor: r, notify: i, t: a } = e;
1377
1390
  try {
1378
1391
  let e = r.view.dom.ownerDocument.defaultView?.navigator.clipboard;
@@ -1382,17 +1395,17 @@ async function Zn(e, t, n = !1) {
1382
1395
  i(a("notify.clipboardUnavailable"), "warning");
1383
1396
  }
1384
1397
  }
1385
- function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, uploadAsset: a, behaviorOptions: o, onLink: s, onWhiteboardEdit: c, onPaletteOpenChange: l }) {
1398
+ function rr({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, uploadAsset: a, behaviorOptions: o, onLink: s, onWhiteboardEdit: c, onPaletteOpenChange: l }) {
1386
1399
  let { editor: u, t: d, commands: f, notify: p } = t;
1387
- V(t, (e) => e.getToolbarRevision());
1388
- let [m, h] = q(), [g, _] = q(null), v = K(null);
1389
- G(() => {
1400
+ H(t, (e) => e.getToolbarRevision());
1401
+ let [m, h] = J(), [g, _] = J(null), v = q(null);
1402
+ K(() => {
1390
1403
  _(u.view.dom.parentElement);
1391
- }, [u]), G(() => {
1404
+ }, [u]), K(() => {
1392
1405
  let e = v.current, t = e?.ownerDocument.defaultView?.ResizeObserver;
1393
1406
  if (!g || !e) return;
1394
1407
  let n = () => {
1395
- e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(Wn, "updatePosition"));
1408
+ e.isConnected && !u.isDestroyed && u.view.dispatch(u.state.tr.setMeta(Yn, "updatePosition"));
1396
1409
  }, r = t && new t(n);
1397
1410
  r?.observe(e), r?.observe(g);
1398
1411
  let i = g.ownerDocument, a = ({ target: e }) => {
@@ -1402,14 +1415,14 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1402
1415
  r?.disconnect(), i.removeEventListener("scroll", a, !0);
1403
1416
  };
1404
1417
  }, [u, g]);
1405
- let y = we(() => {
1418
+ let y = Ee(() => {
1406
1419
  if (!g) return;
1407
1420
  let e = {
1408
1421
  boundary: g,
1409
- padding: Gn
1422
+ padding: Xn
1410
1423
  };
1411
1424
  return {
1412
- offset: Gn,
1425
+ offset: Xn,
1413
1426
  flip: e,
1414
1427
  shift: {
1415
1428
  ...e,
@@ -1427,15 +1440,15 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1427
1440
  },
1428
1441
  scrollTarget: g
1429
1442
  };
1430
- }, [g, l]), { selection: b } = u.state, x = Jn(u), S = !x && Xn(u);
1431
- G(() => {
1443
+ }, [g, l]), { selection: b } = u.state, x = $n(u), S = !x && tr(u);
1444
+ K(() => {
1432
1445
  !S && m && (h(void 0), l(!1));
1433
1446
  }, [
1434
1447
  S,
1435
1448
  m,
1436
1449
  l
1437
1450
  ]);
1438
- let C = Kn.filter((e) => e === "clearFormat" || !!u.schema.marks[e === "color" ? "textStyle" : e]), w;
1451
+ let C = Zn.filter((e) => e === "clearFormat" || !!u.schema.marks[e === "color" ? "textStyle" : e]), w;
1439
1452
  if (x) try {
1440
1453
  let e = new URL(x.href, u.view.dom.ownerDocument.baseURI);
1441
1454
  [
@@ -1448,84 +1461,84 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1448
1461
  } catch {
1449
1462
  w = void 0;
1450
1463
  }
1451
- return g ? /* @__PURE__ */ H(Z, {
1464
+ return g ? /* @__PURE__ */ U(_n, {
1452
1465
  value: e?.bubble?.button,
1453
- children: /* @__PURE__ */ H(D, {
1466
+ children: /* @__PURE__ */ U(D, {
1454
1467
  editor: u,
1455
- pluginKey: Wn,
1468
+ pluginKey: Yn,
1456
1469
  appendTo: n,
1457
1470
  updateDelay: 0,
1458
1471
  resizeDelay: 0,
1459
1472
  options: y,
1460
- shouldShow: Yn,
1473
+ shouldShow: er,
1461
1474
  className: "vibe-shadcn-tiptap__bubble-host",
1462
- children: /* @__PURE__ */ H("div", {
1475
+ children: /* @__PURE__ */ U("div", {
1463
1476
  ref: v,
1464
1477
  role: "toolbar",
1465
1478
  "aria-label": "Selection toolbar",
1466
- className: J("z-3 vibe-shadcn-tiptap__bubble p-0.5", dn, e?.bubble?.className),
1479
+ className: Y("z-3 vibe-shadcn-tiptap__bubble p-0.5", mn, e?.bubble?.className),
1467
1480
  onMouseDown: (e) => e.preventDefault(),
1468
- children: b instanceof Te ? /* @__PURE__ */ H(xn, {
1481
+ children: b instanceof De ? /* @__PURE__ */ U(Tn, {
1469
1482
  context: t,
1470
1483
  selection: b,
1471
1484
  overlayTarget: n,
1472
1485
  uploadAsset: a,
1473
1486
  behaviorOptions: o,
1474
- onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(Wn, "hide")),
1475
- onCopyUrl: (e, n) => void Zn(t, e, n),
1487
+ onCaptionFocus: () => u.view.dispatch(u.state.tr.setMeta(Yn, "hide")),
1488
+ onCopyUrl: (e, n) => void nr(t, e, n),
1476
1489
  onWhiteboardEdit: c
1477
- }) : x ? /* @__PURE__ */ U("div", {
1478
- className: J("vibe-shadcn-tiptap__actions", X),
1490
+ }) : x ? /* @__PURE__ */ W("div", {
1491
+ className: Y("vibe-shadcn-tiptap__actions", Z),
1479
1492
  children: [
1480
- /* @__PURE__ */ H($, {
1493
+ /* @__PURE__ */ U($, {
1481
1494
  label: d("toolbar.link.edit"),
1482
1495
  overlayTarget: n,
1483
1496
  onClick: () => s({
1484
1497
  kind: "link",
1485
1498
  link: x
1486
1499
  }),
1487
- children: /* @__PURE__ */ H(Ct, {
1500
+ children: /* @__PURE__ */ U(Tt, {
1488
1501
  size: 16,
1489
1502
  "aria-hidden": !0
1490
1503
  })
1491
1504
  }),
1492
- /* @__PURE__ */ H(Q, {
1505
+ /* @__PURE__ */ U(Q, {
1493
1506
  asChild: !0,
1494
1507
  className: "vibe-shadcn-tiptap__button",
1495
- children: /* @__PURE__ */ H("a", {
1508
+ children: /* @__PURE__ */ U("a", {
1496
1509
  "aria-label": d("toolbar.link.open"),
1497
1510
  href: w,
1498
1511
  "aria-disabled": !w || void 0,
1499
1512
  target: x.target || "_blank",
1500
1513
  rel: "noopener noreferrer",
1501
- children: /* @__PURE__ */ H(Ye, {
1514
+ children: /* @__PURE__ */ U(Ze, {
1502
1515
  size: 16,
1503
1516
  "aria-hidden": !0
1504
1517
  })
1505
1518
  })
1506
1519
  }),
1507
- /* @__PURE__ */ H($, {
1520
+ /* @__PURE__ */ U($, {
1508
1521
  label: d("toolbar.link.copy"),
1509
1522
  overlayTarget: n,
1510
- onClick: () => void Zn(t, x.href),
1511
- children: /* @__PURE__ */ H(We, {
1523
+ onClick: () => void nr(t, x.href),
1524
+ children: /* @__PURE__ */ U(Ke, {
1512
1525
  size: 16,
1513
1526
  "aria-hidden": !0
1514
1527
  })
1515
1528
  }),
1516
- /* @__PURE__ */ H($, {
1529
+ /* @__PURE__ */ U($, {
1517
1530
  label: d("toolbar.link.remove"),
1518
1531
  overlayTarget: n,
1519
1532
  onClick: () => {
1520
1533
  f.setLink("", { range: x }), p(d("notify.linkRemoved"), "success");
1521
1534
  },
1522
- children: /* @__PURE__ */ H(Wt, {
1535
+ children: /* @__PURE__ */ U(Kt, {
1523
1536
  size: 16,
1524
1537
  "aria-hidden": !0
1525
1538
  })
1526
1539
  })
1527
1540
  ]
1528
- }) : S ? /* @__PURE__ */ H(Un, {
1541
+ }) : S ? /* @__PURE__ */ U(Jn, {
1529
1542
  context: t,
1530
1543
  ui: e,
1531
1544
  toolbar: [C],
@@ -1544,16 +1557,16 @@ function Qn({ ui: e, context: t, overlayTarget: n, colors: r, highlights: i, upl
1544
1557
  }) : null;
1545
1558
  }
1546
1559
  // src/find-replace.tsx
1547
- function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1548
- let { InputGroup: i } = Y(), { editor: a, commands: o, t: s } = t, c = V(t, (e) => e.findReplaceState), l = K(null), u = K(null), [d, f] = q(0);
1549
- if (W(() => {
1560
+ function ir({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1561
+ let { InputGroup: i } = X(), { editor: a, commands: o, t: s } = t, c = H(t, (e) => e.findReplaceState), l = q(null), u = q(null), [d, f] = J(0);
1562
+ if (G(() => {
1550
1563
  let e = ({ transaction: e }) => {
1551
1564
  I(e) && f((e) => e + 1);
1552
1565
  };
1553
1566
  return a.on("transaction", e), () => {
1554
1567
  a.off("transaction", e);
1555
1568
  };
1556
- }, [a]), G(() => {
1569
+ }, [a]), K(() => {
1557
1570
  if (!c?.open) {
1558
1571
  u.current?.focus({ preventScroll: !0 }), u.current = null;
1559
1572
  return;
@@ -1564,28 +1577,28 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1564
1577
  function p(e, t) {
1565
1578
  e ? o.findReplacePrevious() : o.findReplaceNext(), t.focus({ preventScroll: !0 });
1566
1579
  }
1567
- let m = c.matches.length > 0, h = J("vibe-shadcn-tiptap__find-field h-8 min-w-0 flex-1", fn[e?.input?.variant ?? "default"], e?.inputGroupClassName), g = J("h-full", e?.input?.className);
1568
- return /* @__PURE__ */ H(Z, {
1580
+ let m = c.matches.length > 0, h = Y("vibe-shadcn-tiptap__find-field h-8 min-w-0 flex-1", hn[e?.input?.variant ?? "default"], e?.inputGroupClassName), g = Y("h-full", e?.input?.className);
1581
+ return /* @__PURE__ */ U(_n, {
1569
1582
  value: e?.button,
1570
- children: /* @__PURE__ */ U("div", {
1571
- className: J("vibe-shadcn-tiptap__find vibe-shadcn-tiptap__compact-fields absolute top-2 right-2 z-2 box-border grid w-[min(400px,calc(100%-16px))] gap-1.5 p-1.5", dn, e?.className),
1583
+ children: /* @__PURE__ */ W("div", {
1584
+ className: Y("vibe-shadcn-tiptap__find vibe-shadcn-tiptap__compact-fields absolute top-2 right-2 z-2 box-border grid w-[min(400px,calc(100%-16px))] gap-1.5 p-1.5", mn, e?.className),
1572
1585
  role: "search",
1573
1586
  "aria-label": s("command.findReplace"),
1574
1587
  onKeyDown: (e) => {
1575
1588
  !e.nativeEvent.isComposing && e.key === "Escape" && (e.preventDefault(), e.stopPropagation(), o.closeFindReplace());
1576
1589
  },
1577
- children: [/* @__PURE__ */ U("div", {
1578
- className: J("vibe-shadcn-tiptap__find-row", X),
1590
+ children: [/* @__PURE__ */ W("div", {
1591
+ className: Y("vibe-shadcn-tiptap__find-row", Z),
1579
1592
  children: [
1580
- /* @__PURE__ */ U(i.Root, {
1593
+ /* @__PURE__ */ W(i.Root, {
1581
1594
  className: h,
1582
1595
  children: [
1583
- /* @__PURE__ */ H(i.Addon, {
1596
+ /* @__PURE__ */ U(i.Addon, {
1584
1597
  align: "inline-start",
1585
1598
  "aria-hidden": !0,
1586
- children: /* @__PURE__ */ H(Pt, { size: 16 })
1599
+ children: /* @__PURE__ */ U(It, { size: 16 })
1587
1600
  }),
1588
- /* @__PURE__ */ H(i.Input, {
1601
+ /* @__PURE__ */ U(i.Input, {
1589
1602
  className: g,
1590
1603
  ref: l,
1591
1604
  "aria-label": s("findReplace.query"),
@@ -1596,15 +1609,15 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1596
1609
  e.key !== "Enter" || e.nativeEvent.isComposing || (e.preventDefault(), m && p(e.shiftKey, e.currentTarget));
1597
1610
  }
1598
1611
  }),
1599
- /* @__PURE__ */ H(i.Addon, {
1612
+ /* @__PURE__ */ U(i.Addon, {
1600
1613
  align: "inline-end",
1601
- children: /* @__PURE__ */ H($, {
1614
+ children: /* @__PURE__ */ U($, {
1602
1615
  size: "icon-sm",
1603
1616
  label: s("findReplace.caseSensitive"),
1604
1617
  overlayTarget: r,
1605
1618
  "aria-pressed": c.caseSensitive,
1606
1619
  onClick: () => o.setFindReplaceCaseSensitive(!c.caseSensitive),
1607
- children: /* @__PURE__ */ H(Le, {
1620
+ children: /* @__PURE__ */ U(ze, {
1608
1621
  size: 16,
1609
1622
  "aria-hidden": !0
1610
1623
  })
@@ -1612,56 +1625,56 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1612
1625
  })
1613
1626
  ]
1614
1627
  }),
1615
- /* @__PURE__ */ H("span", {
1628
+ /* @__PURE__ */ U("span", {
1616
1629
  role: "status",
1617
1630
  children: s("findReplace.count", {
1618
1631
  current: m ? c.activeIndex + 1 : 0,
1619
1632
  total: c.matches.length
1620
1633
  })
1621
1634
  }),
1622
- /* @__PURE__ */ H($, {
1635
+ /* @__PURE__ */ U($, {
1623
1636
  size: "icon-sm",
1624
1637
  label: s("findReplace.previous"),
1625
1638
  overlayTarget: r,
1626
1639
  disabled: !m,
1627
1640
  onClick: (e) => p(!0, e.currentTarget),
1628
- children: /* @__PURE__ */ H(Ve, {
1641
+ children: /* @__PURE__ */ U(Ue, {
1629
1642
  size: 16,
1630
1643
  "aria-hidden": !0
1631
1644
  })
1632
1645
  }),
1633
- /* @__PURE__ */ H($, {
1646
+ /* @__PURE__ */ U($, {
1634
1647
  size: "icon-sm",
1635
1648
  label: s("findReplace.next"),
1636
1649
  overlayTarget: r,
1637
1650
  disabled: !m,
1638
1651
  onClick: (e) => p(!1, e.currentTarget),
1639
- children: /* @__PURE__ */ H(Re, {
1652
+ children: /* @__PURE__ */ U(Be, {
1640
1653
  size: 16,
1641
1654
  "aria-hidden": !0
1642
1655
  })
1643
1656
  }),
1644
- /* @__PURE__ */ H($, {
1657
+ /* @__PURE__ */ U($, {
1645
1658
  size: "icon-sm",
1646
1659
  label: s("findReplace.close"),
1647
1660
  overlayTarget: r,
1648
1661
  onClick: () => o.closeFindReplace(),
1649
- children: /* @__PURE__ */ H(qt, {
1662
+ children: /* @__PURE__ */ U(Yt, {
1650
1663
  size: 16,
1651
1664
  "aria-hidden": !0
1652
1665
  })
1653
1666
  })
1654
1667
  ]
1655
- }), n && /* @__PURE__ */ U("div", {
1656
- className: J("vibe-shadcn-tiptap__find-row", "flex flex-wrap items-center gap-1"),
1668
+ }), n && /* @__PURE__ */ W("div", {
1669
+ className: Y("vibe-shadcn-tiptap__find-row", "flex flex-wrap items-center gap-1"),
1657
1670
  children: [
1658
- /* @__PURE__ */ U(i.Root, {
1671
+ /* @__PURE__ */ W(i.Root, {
1659
1672
  className: h,
1660
- children: [/* @__PURE__ */ H(i.Addon, {
1673
+ children: [/* @__PURE__ */ U(i.Addon, {
1661
1674
  align: "inline-start",
1662
1675
  "aria-hidden": !0,
1663
- children: /* @__PURE__ */ H(At, { size: 16 })
1664
- }), /* @__PURE__ */ H(i.Input, {
1676
+ children: /* @__PURE__ */ U(Mt, { size: 16 })
1677
+ }), /* @__PURE__ */ U(i.Input, {
1665
1678
  className: g,
1666
1679
  "aria-label": s("findReplace.replacement"),
1667
1680
  placeholder: s("findReplace.replacement"),
@@ -1672,24 +1685,24 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1672
1685
  }
1673
1686
  })]
1674
1687
  }),
1675
- /* @__PURE__ */ H($, {
1688
+ /* @__PURE__ */ U($, {
1676
1689
  size: "icon-sm",
1677
1690
  label: s("findReplace.replace"),
1678
1691
  overlayTarget: r,
1679
1692
  disabled: !m,
1680
1693
  onClick: () => o.replaceFindReplaceCurrent(),
1681
- children: /* @__PURE__ */ H(At, {
1694
+ children: /* @__PURE__ */ U(Mt, {
1682
1695
  size: 16,
1683
1696
  "aria-hidden": !0
1684
1697
  })
1685
1698
  }),
1686
- /* @__PURE__ */ H($, {
1699
+ /* @__PURE__ */ U($, {
1687
1700
  size: "icon-sm",
1688
1701
  label: s("findReplace.replaceAll"),
1689
1702
  overlayTarget: r,
1690
1703
  disabled: !m,
1691
1704
  onClick: () => o.replaceFindReplaceAll(),
1692
- children: /* @__PURE__ */ H(jt, {
1705
+ children: /* @__PURE__ */ U(Nt, {
1693
1706
  size: 16,
1694
1707
  "aria-hidden": !0
1695
1708
  })
@@ -1700,7 +1713,7 @@ function $n({ appearance: e, context: t, editable: n, overlayTarget: r }) {
1700
1713
  });
1701
1714
  }
1702
1715
  // src/image-preview-dialog.tsx
1703
- function er(e, t) {
1716
+ function ar(e, t) {
1704
1717
  if (!e) return {};
1705
1718
  let n;
1706
1719
  try {
@@ -1721,18 +1734,18 @@ function er(e, t) {
1721
1734
  name: i
1722
1735
  };
1723
1736
  }
1724
- function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, imagePreview: i, onClose: a }) {
1725
- let { Dialog: o } = Y(), { urls: s } = i, [c, l] = q(i.index), [u, d] = q(0), [f, p] = q(100), m = K(null), h = K(null), g = K(null), _ = K(null), v = s.length > 1, y = s[c], { href: b, name: x } = er(y, r.ownerDocument.baseURI), S = i.names?.[c] || x, C = S || n("command.image");
1737
+ function or({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, imagePreview: i, onClose: a }) {
1738
+ let { Dialog: o } = X(), { urls: s } = i, [c, l] = J(i.index), [u, d] = J(0), [f, p] = J(100), m = q(null), h = q(null), g = q(null), _ = q(null), v = s.length > 1, y = s[c], { href: b, name: x } = ar(y, r.ownerDocument.baseURI), S = i.names?.[c] || x, C = S || n("command.image");
1726
1739
  function w(e) {
1727
1740
  v && (m.current = null, d(0), p(100), l((t) => (t + e + s.length) % s.length));
1728
1741
  }
1729
- return /* @__PURE__ */ H(o.Root, {
1742
+ return /* @__PURE__ */ U(o.Root, {
1730
1743
  open: !0,
1731
1744
  onOpenChange: (e) => !e && a(),
1732
- children: /* @__PURE__ */ U(o.Content, {
1745
+ children: /* @__PURE__ */ W(o.Content, {
1733
1746
  container: r,
1734
1747
  overlayClassName: "vibe-shadcn-tiptap__backdrop",
1735
- className: J("vibe-shadcn-tiptap__image-preview", e?.className),
1748
+ className: Y("vibe-shadcn-tiptap__image-preview", e?.className),
1736
1749
  "aria-describedby": void 0,
1737
1750
  onOpenAutoFocus: (e) => {
1738
1751
  let t = r.ownerDocument.activeElement;
@@ -1746,33 +1759,33 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1746
1759
  onKeyDown: (e) => {
1747
1760
  (e.key === "ArrowLeft" || e.key === "ArrowRight") && (e.preventDefault(), w(e.key === "ArrowLeft" ? -1 : 1));
1748
1761
  },
1749
- children: [/* @__PURE__ */ U("header", { children: [/* @__PURE__ */ U("div", {
1762
+ children: [/* @__PURE__ */ W("header", { children: [/* @__PURE__ */ W("div", {
1750
1763
  className: "vibe-shadcn-tiptap__image-title",
1751
- children: [/* @__PURE__ */ H(ot, {
1764
+ children: [/* @__PURE__ */ U(ct, {
1752
1765
  size: 16,
1753
1766
  "aria-hidden": "true"
1754
- }), /* @__PURE__ */ H(o.Title, {
1767
+ }), /* @__PURE__ */ U(o.Title, {
1755
1768
  title: C,
1756
1769
  children: C
1757
1770
  })]
1758
- }), /* @__PURE__ */ U("div", {
1771
+ }), /* @__PURE__ */ W("div", {
1759
1772
  className: "vibe-shadcn-tiptap__image-controls",
1760
1773
  children: [
1761
- v && /* @__PURE__ */ U("div", {
1774
+ v && /* @__PURE__ */ W("div", {
1762
1775
  className: "vibe-shadcn-tiptap__image-controls-group",
1763
1776
  children: [
1764
- /* @__PURE__ */ H($, {
1777
+ /* @__PURE__ */ U($, {
1765
1778
  appearance: e?.iconButton,
1766
1779
  size: "icon",
1767
1780
  label: n("image.preview.previous"),
1768
1781
  overlayTarget: r,
1769
1782
  onClick: () => w(-1),
1770
- children: /* @__PURE__ */ H(ze, {
1783
+ children: /* @__PURE__ */ U(Ve, {
1771
1784
  size: 16,
1772
1785
  "aria-hidden": "true"
1773
1786
  })
1774
1787
  }),
1775
- /* @__PURE__ */ U("span", {
1788
+ /* @__PURE__ */ W("span", {
1776
1789
  "aria-live": "polite",
1777
1790
  children: [
1778
1791
  c + 1,
@@ -1780,34 +1793,34 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1780
1793
  s.length
1781
1794
  ]
1782
1795
  }),
1783
- /* @__PURE__ */ H($, {
1796
+ /* @__PURE__ */ U($, {
1784
1797
  appearance: e?.iconButton,
1785
1798
  size: "icon",
1786
1799
  label: n("image.preview.next"),
1787
1800
  overlayTarget: r,
1788
1801
  onClick: () => w(1),
1789
- children: /* @__PURE__ */ H(Be, {
1802
+ children: /* @__PURE__ */ U(He, {
1790
1803
  size: 16,
1791
1804
  "aria-hidden": "true"
1792
1805
  })
1793
1806
  })
1794
1807
  ]
1795
1808
  }),
1796
- /* @__PURE__ */ U("div", {
1809
+ /* @__PURE__ */ W("div", {
1797
1810
  className: "vibe-shadcn-tiptap__image-controls-group",
1798
1811
  children: [
1799
- /* @__PURE__ */ H($, {
1812
+ /* @__PURE__ */ U($, {
1800
1813
  appearance: e?.iconButton,
1801
1814
  size: "icon",
1802
1815
  label: n("image.preview.zoomOut"),
1803
1816
  overlayTarget: r,
1804
1817
  onClick: () => void h.current?.zoomOut(.1),
1805
- children: /* @__PURE__ */ H(Yt, {
1818
+ children: /* @__PURE__ */ U(Zt, {
1806
1819
  size: 16,
1807
1820
  "aria-hidden": "true"
1808
1821
  })
1809
1822
  }),
1810
- /* @__PURE__ */ U($, {
1823
+ /* @__PURE__ */ W($, {
1811
1824
  appearance: e?.button,
1812
1825
  size: "sm",
1813
1826
  label: `${f}% · ${n("image.preview.reset")}`,
@@ -1817,69 +1830,69 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1817
1830
  onClick: () => void h.current?.centerView(1),
1818
1831
  children: [f, "%"]
1819
1832
  }),
1820
- /* @__PURE__ */ H($, {
1833
+ /* @__PURE__ */ U($, {
1821
1834
  appearance: e?.iconButton,
1822
1835
  size: "icon",
1823
1836
  label: n("image.preview.zoomIn"),
1824
1837
  overlayTarget: r,
1825
1838
  onClick: () => void h.current?.zoomIn(.1),
1826
- children: /* @__PURE__ */ H(Jt, {
1839
+ children: /* @__PURE__ */ U(Xt, {
1827
1840
  size: 16,
1828
1841
  "aria-hidden": "true"
1829
1842
  })
1830
1843
  })
1831
1844
  ]
1832
1845
  }),
1833
- /* @__PURE__ */ U("div", {
1846
+ /* @__PURE__ */ W("div", {
1834
1847
  className: "vibe-shadcn-tiptap__image-controls-group",
1835
1848
  children: [
1836
- /* @__PURE__ */ H($, {
1849
+ /* @__PURE__ */ U($, {
1837
1850
  appearance: e?.iconButton,
1838
1851
  size: "icon",
1839
1852
  label: n("image.preview.rotateLeft"),
1840
1853
  overlayTarget: r,
1841
1854
  onClick: () => d((e) => (e - 90) % 360),
1842
- children: /* @__PURE__ */ H(Mt, {
1855
+ children: /* @__PURE__ */ U(Pt, {
1843
1856
  size: 16,
1844
1857
  "aria-hidden": "true"
1845
1858
  })
1846
1859
  }),
1847
- /* @__PURE__ */ H($, {
1860
+ /* @__PURE__ */ U($, {
1848
1861
  appearance: e?.iconButton,
1849
1862
  size: "icon",
1850
1863
  label: n("image.preview.rotateRight"),
1851
1864
  overlayTarget: r,
1852
1865
  onClick: () => d((e) => (e + 90) % 360),
1853
- children: /* @__PURE__ */ H(Nt, {
1866
+ children: /* @__PURE__ */ U(Ft, {
1854
1867
  size: 16,
1855
1868
  "aria-hidden": "true"
1856
1869
  })
1857
1870
  }),
1858
- /* @__PURE__ */ H(Q, {
1871
+ /* @__PURE__ */ U(Q, {
1859
1872
  appearance: e?.button,
1860
1873
  asChild: !0,
1861
1874
  className: "vibe-shadcn-tiptap__button vibe-shadcn-tiptap__image-download",
1862
- children: /* @__PURE__ */ U("a", {
1875
+ children: /* @__PURE__ */ W("a", {
1863
1876
  href: b,
1864
1877
  download: S ?? "",
1865
1878
  "aria-disabled": !b || void 0,
1866
1879
  target: "_blank",
1867
1880
  rel: "noreferrer",
1868
- children: [/* @__PURE__ */ H(Ge, {
1881
+ children: [/* @__PURE__ */ U(qe, {
1869
1882
  size: 16,
1870
1883
  "aria-hidden": "true"
1871
1884
  }), n("image.preview.download")]
1872
1885
  })
1873
1886
  }),
1874
- /* @__PURE__ */ H(o.Close, {
1887
+ /* @__PURE__ */ U(o.Close, {
1875
1888
  asChild: !0,
1876
- children: /* @__PURE__ */ H($, {
1889
+ children: /* @__PURE__ */ U($, {
1877
1890
  appearance: e?.iconButton,
1878
1891
  ref: _,
1879
1892
  size: "icon",
1880
1893
  label: n("image.preview.close"),
1881
1894
  overlayTarget: r,
1882
- children: /* @__PURE__ */ H(qt, {
1895
+ children: /* @__PURE__ */ U(Yt, {
1883
1896
  size: 16,
1884
1897
  "aria-hidden": "true"
1885
1898
  })
@@ -1888,7 +1901,7 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1888
1901
  ]
1889
1902
  })
1890
1903
  ]
1891
- })] }), /* @__PURE__ */ H("div", {
1904
+ })] }), /* @__PURE__ */ U("div", {
1892
1905
  className: "vibe-shadcn-tiptap__image-stage",
1893
1906
  onPointerDown: (e) => {
1894
1907
  e.shiftKey && e.button === 0 && e.isPrimary && (m.current = {
@@ -1904,7 +1917,7 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1904
1917
  onLostPointerCapture: (e) => {
1905
1918
  m.current?.pointerId === e.pointerId && (m.current = null);
1906
1919
  },
1907
- children: /* @__PURE__ */ H(nn, {
1920
+ children: /* @__PURE__ */ U(an, {
1908
1921
  ref: h,
1909
1922
  centerOnInit: !0,
1910
1923
  centerZoomedOut: !0,
@@ -1919,10 +1932,10 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1919
1932
  activationKeys: (e) => !e.includes("Shift")
1920
1933
  },
1921
1934
  onTransform: (e, { scale: t }) => p(Math.round(t * 100)),
1922
- children: /* @__PURE__ */ H(tn, {
1935
+ children: /* @__PURE__ */ U(rn, {
1923
1936
  wrapperClass: "vibe-shadcn-tiptap__image-viewport",
1924
1937
  contentClass: "vibe-shadcn-tiptap__image-plane",
1925
- children: /* @__PURE__ */ H("img", {
1938
+ children: /* @__PURE__ */ U("img", {
1926
1939
  src: y,
1927
1940
  alt: S ?? "",
1928
1941
  draggable: !1,
@@ -1934,33 +1947,128 @@ function tr({ appearance: e, context: { editor: t, t: n }, overlayTarget: r, ima
1934
1947
  })
1935
1948
  });
1936
1949
  }
1950
+ // src/mention-menu.tsx
1951
+ function sr({ appearance: e, state: t, target: n, t: r, renderItem: i }) {
1952
+ let { editor: a, items: o, groups: s, selectedIndex: c, mount: l, loading: u } = t, d = `vibe-tiptap-mention-${a.instanceId}`, f = q(null);
1953
+ return K(() => {
1954
+ let e = f.current;
1955
+ if (e) return l(e);
1956
+ }, [l, n]), K(() => {
1957
+ let e = a.view.dom, t = f.current;
1958
+ if (!o[c] || !t) return;
1959
+ let n = `${d}-${c}`, r = e.getAttribute("aria-activedescendant"), i = e.getAttribute("aria-controls");
1960
+ e.setAttribute("aria-activedescendant", n), e.setAttribute("aria-controls", d);
1961
+ let s = e.ownerDocument.getElementById(n);
1962
+ return s && s.offsetTop < t.scrollTop && (t.scrollTop = s.offsetTop), s && s.offsetTop + s.offsetHeight > t.scrollTop + t.clientHeight && (t.scrollTop = s.offsetTop + s.offsetHeight - t.clientHeight), () => {
1963
+ r === null ? e.removeAttribute("aria-activedescendant") : e.setAttribute("aria-activedescendant", r), i === null ? e.removeAttribute("aria-controls") : e.setAttribute("aria-controls", i);
1964
+ };
1965
+ }, [
1966
+ a,
1967
+ d,
1968
+ o,
1969
+ c
1970
+ ]), on(/* @__PURE__ */ U("div", {
1971
+ ref: f,
1972
+ className: Y("z-3 vibe-shadcn-tiptap__mention", e?.className),
1973
+ children: o.length ? /* @__PURE__ */ U("div", {
1974
+ id: d,
1975
+ role: "listbox",
1976
+ "aria-label": r("mention.label"),
1977
+ children: s.map(({ name: n, label: r, items: a, startIndex: o }) => /* @__PURE__ */ W("div", {
1978
+ className: n === void 0 ? void 0 : e?.groupClassName,
1979
+ ...r ? {
1980
+ role: "group",
1981
+ "aria-label": r
1982
+ } : {},
1983
+ children: [r && /* @__PURE__ */ U("div", {
1984
+ className: Y("px-3 py-1 text-xs font-medium text-muted-foreground", e?.groupLabelClassName),
1985
+ children: r
1986
+ }), a.map((n, r) => /* @__PURE__ */ U("button", {
1987
+ id: `${d}-${o + r}`,
1988
+ type: "button",
1989
+ role: "option",
1990
+ tabIndex: -1,
1991
+ "aria-label": n.label,
1992
+ "aria-selected": o + r === c,
1993
+ className: Y("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium hover:bg-accent hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground", e?.button?.className),
1994
+ onMouseDown: (e) => e.preventDefault(),
1995
+ onClick: () => t.command(n),
1996
+ children: i ? i(n) : /* @__PURE__ */ W(ge, { children: [n.avatar && /* @__PURE__ */ U("img", {
1997
+ src: n.avatar,
1998
+ alt: "",
1999
+ className: "vibe-tiptap-mention-avatar"
2000
+ }), /* @__PURE__ */ U("span", { children: n.label })] })
2001
+ }, n.id))]
2002
+ }, n === void 0 ? "ungrouped" : `group-${n}`))
2003
+ }) : /* @__PURE__ */ U("div", {
2004
+ className: Y("px-3 py-1 text-sm", e?.statusClassName),
2005
+ role: "status",
2006
+ children: r(u ? "mention.loading" : "mention.empty")
2007
+ })
2008
+ }), n);
2009
+ }
2010
+ // src/mention-popover.tsx
2011
+ function cr({ editor: e, container: t, render: n, hoverDelay: r }) {
2012
+ let { Popover: i } = X(), [a, o] = J(), s = q(void 0), c = Ee(() => ({ current: {
2013
+ contextElement: e,
2014
+ getBoundingClientRect: () => a?.element.getBoundingClientRect() ?? new DOMRect()
2015
+ } }), [e, a]);
2016
+ return G(() => {
2017
+ let t = sn(e, o, r);
2018
+ return s.current = t, () => {
2019
+ t.destroy(), s.current = void 0;
2020
+ };
2021
+ }, [e, r]), /* @__PURE__ */ W(i.Root, {
2022
+ open: !!a,
2023
+ onOpenChange: (e) => {
2024
+ e || s.current?.close();
2025
+ },
2026
+ children: [/* @__PURE__ */ U(i.Anchor, { virtualRef: c }), /* @__PURE__ */ U(i.Content, {
2027
+ container: t ?? e.ownerDocument.body,
2028
+ side: "top",
2029
+ align: "center",
2030
+ sideOffset: 6,
2031
+ collisionPadding: 8,
2032
+ className: "z-3 p-2",
2033
+ onOpenAutoFocus: (e) => e.preventDefault(),
2034
+ onCloseAutoFocus: (e) => e.preventDefault(),
2035
+ onFocusOutside: (e) => e.preventDefault(),
2036
+ onPointerDownOutside: (t) => {
2037
+ ae(e, t.target) && t.preventDefault();
2038
+ },
2039
+ onMouseEnter: () => s.current?.keepOpen(),
2040
+ onMouseLeave: () => s.current?.leave(),
2041
+ children: a && n(a)
2042
+ })]
2043
+ });
2044
+ }
1937
2045
  // src/slash-menu.tsx
1938
- var nr = {
1939
- heading1: Qe,
1940
- heading: $e,
1941
- heading3: et,
1942
- heading4: tt,
1943
- todo: mt,
1944
- bulletList: pt,
1945
- orderedList: ht,
1946
- blockquote: Ot,
1947
- table: Rt,
1948
- image: ct,
1949
- imageUrl: st,
1950
- whiteboard: wt,
1951
- video: Gt,
1952
- videoUrl: Vt,
1953
- audio: bt,
1954
- audioUrl: bt,
1955
- upload: St,
1956
- link: ft,
1957
- codeBlock: He,
1958
- mermaid: Kt,
2046
+ var lr = {
2047
+ heading1: et,
2048
+ heading: tt,
2049
+ heading3: nt,
2050
+ heading4: rt,
2051
+ todo: gt,
2052
+ bulletList: ht,
2053
+ orderedList: _t,
2054
+ blockquote: At,
2055
+ table: Bt,
2056
+ image: ut,
2057
+ imageUrl: lt,
2058
+ whiteboard: Et,
2059
+ video: qt,
2060
+ videoUrl: Ut,
2061
+ audio: St,
2062
+ audioUrl: St,
2063
+ upload: wt,
2064
+ link: mt,
2065
+ codeBlock: We,
2066
+ mermaid: Jt,
1959
2067
  divider: "solid",
1960
2068
  dividerThick: "thick",
1961
2069
  dividerDashed: "dashed",
1962
2070
  dividerDotted: "dotted"
1963
- }, rr = {
2071
+ }, ur = {
1964
2072
  heading1: "slashCommand.group.headings",
1965
2073
  heading: "slashCommand.group.headings",
1966
2074
  heading3: "slashCommand.group.headings",
@@ -1986,9 +2094,9 @@ var nr = {
1986
2094
  dividerDashed: "slashCommand.group.dividers",
1987
2095
  dividerDotted: "slashCommand.group.dividers"
1988
2096
  };
1989
- function ir({ appearance: e, state: t, target: n, t: r }) {
1990
- let { editor: i, items: a, query: o, selectedIndex: s, mount: c } = t, l = `vibe-shadcn-tiptap-slash-${i.instanceId}`, u = K(null), d = a[s], f = d && !d.disabledReason ? `${l}-${d.id}` : void 0;
1991
- G(() => {
2097
+ function dr({ appearance: e, state: t, target: n, t: r }) {
2098
+ let { editor: i, items: a, query: o, selectedIndex: s, mount: c } = t, l = `vibe-shadcn-tiptap-slash-${i.instanceId}`, u = q(null), d = a[s], f = d && !d.disabledReason ? `${l}-${d.id}` : void 0;
2099
+ K(() => {
1992
2100
  let e = u.current;
1993
2101
  if (e) return e.style.visibility = "hidden", c(e, { onPosition: ({ x: t, y: n, strategy: r }) => {
1994
2102
  Object.assign(e.style, {
@@ -1998,7 +2106,7 @@ function ir({ appearance: e, state: t, target: n, t: r }) {
1998
2106
  visibility: ""
1999
2107
  });
2000
2108
  } });
2001
- }, [c, n]), G(() => {
2109
+ }, [c, n]), K(() => {
2002
2110
  let e = i.view.dom;
2003
2111
  if (!f) return;
2004
2112
  let t = e.getAttribute("aria-activedescendant"), n = e.getAttribute("aria-controls");
@@ -2013,30 +2121,30 @@ function ir({ appearance: e, state: t, target: n, t: r }) {
2013
2121
  l
2014
2122
  ]);
2015
2123
  let p = [];
2016
- if (se(o)) p.push({ items: a });
2124
+ if (R(o)) p.push({ items: a });
2017
2125
  else for (let e of a) {
2018
- let t = e.disabledReason ? "slashCommand.group.unavailable" : rr[e.id], n = p.at(-1);
2126
+ let t = e.disabledReason ? "slashCommand.group.unavailable" : ur[e.id], n = p.at(-1);
2019
2127
  n?.label === t ? n.items.push(e) : p.push({
2020
2128
  label: t,
2021
2129
  items: [e]
2022
2130
  });
2023
2131
  }
2024
- return rn(/* @__PURE__ */ H("div", {
2132
+ return on(/* @__PURE__ */ U("div", {
2025
2133
  ref: u,
2026
- className: J("z-3 vibe-shadcn-tiptap__slash", e?.className),
2027
- children: a.length ? /* @__PURE__ */ H("div", {
2134
+ className: Y("z-3 vibe-shadcn-tiptap__slash", e?.className),
2135
+ children: a.length ? /* @__PURE__ */ U("div", {
2028
2136
  id: l,
2029
2137
  role: "listbox",
2030
2138
  "aria-label": r("slashCommand.label"),
2031
- children: p.map(({ label: n, items: i }) => /* @__PURE__ */ U("div", {
2139
+ children: p.map(({ label: n, items: i }) => /* @__PURE__ */ W("div", {
2032
2140
  ...n ? {
2033
2141
  role: "group",
2034
2142
  "aria-label": r(n)
2035
2143
  } : {},
2036
- children: [n && /* @__PURE__ */ H("div", {
2144
+ children: [n && /* @__PURE__ */ U("div", {
2037
2145
  className: "vibe-shadcn-tiptap__slash-label",
2038
2146
  children: r(n)
2039
- }), i.map((n) => /* @__PURE__ */ U("button", {
2147
+ }), i.map((n) => /* @__PURE__ */ W("button", {
2040
2148
  id: `${l}-${n.id}`,
2041
2149
  type: "button",
2042
2150
  role: "option",
@@ -2045,94 +2153,94 @@ function ir({ appearance: e, state: t, target: n, t: r }) {
2045
2153
  "aria-selected": n === d && !n.disabledReason,
2046
2154
  "aria-describedby": n.disabledReason || n.hint ? `${l}-${n.id}-hint` : void 0,
2047
2155
  disabled: !!n.disabledReason,
2048
- className: J("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium whitespace-nowrap enabled:hover:bg-accent enabled:hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground disabled:opacity-40", e?.button?.className),
2156
+ className: Y("vibe-shadcn-tiptap__menu-item flex min-h-8 w-full items-center gap-1.5 rounded-sm px-3 py-1 text-start text-xs font-medium whitespace-nowrap enabled:hover:bg-accent enabled:hover:text-accent-foreground aria-selected:bg-accent aria-selected:text-accent-foreground disabled:opacity-40", e?.button?.className),
2049
2157
  onMouseDown: (e) => e.preventDefault(),
2050
2158
  onClick: () => t.command(n),
2051
2159
  children: [
2052
- /* @__PURE__ */ H(ar, { command: n.id }),
2160
+ /* @__PURE__ */ U(fr, { command: n.id }),
2053
2161
  n.label,
2054
- (n.disabledReason || n.hint) && /* @__PURE__ */ H("small", {
2162
+ (n.disabledReason || n.hint) && /* @__PURE__ */ U("small", {
2055
2163
  id: `${l}-${n.id}-hint`,
2056
2164
  children: n.disabledReason || n.hint
2057
2165
  })
2058
2166
  ]
2059
2167
  }, n.id))]
2060
2168
  }, i[0]?.id ?? "results"))
2061
- }) : !t.loading && /* @__PURE__ */ H("div", {
2169
+ }) : !t.loading && /* @__PURE__ */ U("div", {
2062
2170
  role: "status",
2063
2171
  children: r("slashCommand.empty")
2064
2172
  })
2065
2173
  }), n);
2066
2174
  }
2067
- function ar({ command: e }) {
2068
- let t = nr[e];
2069
- return /* @__PURE__ */ H("span", {
2175
+ function fr({ command: e }) {
2176
+ let t = lr[e];
2177
+ return /* @__PURE__ */ U("span", {
2070
2178
  className: "vibe-shadcn-tiptap__slash-icon",
2071
2179
  "aria-hidden": !0,
2072
- children: typeof t == "string" ? /* @__PURE__ */ H("span", {
2180
+ children: typeof t == "string" ? /* @__PURE__ */ U("span", {
2073
2181
  className: "vibe-shadcn-tiptap__divider-icon",
2074
2182
  "data-style": t
2075
- }) : /* @__PURE__ */ H(t, { size: 18 })
2183
+ }) : /* @__PURE__ */ U(t, { size: 18 })
2076
2184
  });
2077
2185
  }
2078
2186
  // src/table-grips.tsx
2079
- var or = ["row", "column"], sr = {
2187
+ var pr = ["row", "column"], mr = {
2080
2188
  row: [
2081
2189
  [
2082
2190
  "addRowBefore",
2083
2191
  "table.insertAbove",
2084
- Et
2192
+ Ot
2085
2193
  ],
2086
2194
  [
2087
2195
  "addRowAfter",
2088
2196
  "table.insertBelow",
2089
- Et
2197
+ Ot
2090
2198
  ],
2091
2199
  [
2092
2200
  "moveRowUp",
2093
2201
  "table.moveUp",
2094
- Pe
2202
+ Ie
2095
2203
  ],
2096
2204
  [
2097
2205
  "moveRowDown",
2098
2206
  "table.moveDown",
2099
- je
2207
+ Ne
2100
2208
  ]
2101
2209
  ],
2102
2210
  column: [
2103
2211
  [
2104
2212
  "addColumnBefore",
2105
2213
  "table.insertLeft",
2106
- Et
2214
+ Ot
2107
2215
  ],
2108
2216
  [
2109
2217
  "addColumnAfter",
2110
2218
  "table.insertRight",
2111
- Et
2219
+ Ot
2112
2220
  ],
2113
2221
  [
2114
2222
  "moveColumnLeft",
2115
2223
  "table.moveLeft",
2116
- Me
2224
+ Pe
2117
2225
  ],
2118
2226
  [
2119
2227
  "moveColumnRight",
2120
2228
  "table.moveRight",
2121
- Ne
2229
+ Fe
2122
2230
  ]
2123
2231
  ]
2124
2232
  };
2125
- function cr({ appearance: e, context: t, overlayTarget: n }) {
2126
- let { DropdownMenu: r } = Y(), { editor: i, commands: a, t: o } = t, s = V(t, (e) => e.getToolbarRevision()), [c, l] = q(), [u, d] = q(), [f, p] = q(), m = K(void 0), h = K(!1);
2233
+ function hr({ appearance: e, context: t, overlayTarget: n }) {
2234
+ let { DropdownMenu: r } = X(), { editor: i, commands: a, t: o } = t, s = H(t, (e) => e.getToolbarRevision()), [c, l] = J(), [u, d] = J(), [f, p] = J(), m = q(void 0), h = q(!1);
2127
2235
  function g(e) {
2128
2236
  let { view: t, state: n } = i;
2129
- if (t.dom.contains(e)) return on(n.doc.resolve(t.posAtDOM(e, 0)));
2237
+ if (t.dom.contains(e)) return ln(n.doc.resolve(t.posAtDOM(e, 0)));
2130
2238
  }
2131
2239
  function _(e, t) {
2132
2240
  let n = g(t.cell);
2133
2241
  return !!(n && a.selectTableLineAt(e, n.pos, t[e]));
2134
2242
  }
2135
- if (W(() => {
2243
+ if (G(() => {
2136
2244
  let e = i.view.dom.parentElement, t = e?.parentElement;
2137
2245
  if (!t) return;
2138
2246
  function n() {
@@ -2156,10 +2264,10 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2156
2264
  }
2157
2265
  let o = a.closest("table");
2158
2266
  if (!o || !e?.contains(o) || i.isDestroyed) return;
2159
- let s = on(i.state.doc.resolve(i.view.posAtDOM(a, 0)));
2267
+ let s = ln(i.state.doc.resolve(i.view.posAtDOM(a, 0)));
2160
2268
  if (!s) return;
2161
2269
  n();
2162
- let { left: c, right: d, top: f } = an.get(s.node(-1)).findCell(s.pos - s.start(-1)), p = o.querySelectorAll(":scope > colgroup > col"), m = a.getBoundingClientRect(), h = m.width > 0 ? (t.clientX - m.left) / m.width : 0, g = Math.min(d - 1, Math.max(c, c + Math.floor(h * (d - c))));
2270
+ let { left: c, right: d, top: f } = cn.get(s.node(-1)).findCell(s.pos - s.start(-1)), p = o.querySelectorAll(":scope > colgroup > col"), m = a.getBoundingClientRect(), h = m.width > 0 ? (t.clientX - m.left) / m.width : 0, g = Math.min(d - 1, Math.max(c, c + Math.floor(h * (d - c))));
2163
2271
  for (let e = c; e < d; e += 1) {
2164
2272
  let n = p[e]?.getBoundingClientRect();
2165
2273
  if (n && n.width > 0 && t.clientX < n.right) {
@@ -2177,7 +2285,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2177
2285
  return t.addEventListener("pointermove", a), t.addEventListener("pointerleave", r), () => {
2178
2286
  n(), t.removeEventListener("pointermove", a), t.removeEventListener("pointerleave", r);
2179
2287
  };
2180
- }, [u, i]), G(() => {
2288
+ }, [u, i]), K(() => {
2181
2289
  let e = i.view.dom.parentElement, t = e?.parentElement, n = t?.ownerDocument.defaultView;
2182
2290
  if (!c || !t || !e || !n) {
2183
2291
  p(void 0);
@@ -2186,7 +2294,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2186
2294
  let r = t, a = e, o = c;
2187
2295
  function s() {
2188
2296
  if (i.isDestroyed) return;
2189
- let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ? on(i.state.doc.resolve(i.view.posAtDOM(e, 0))) : void 0;
2297
+ let { cell: e, table: t, row: n, column: s } = o, c = t.rows[n], u = a.contains(e) ? ln(i.state.doc.resolve(i.view.posAtDOM(e, 0))) : void 0;
2190
2298
  if (!c || !u) {
2191
2299
  l(void 0), d(void 0);
2192
2300
  return;
@@ -2196,7 +2304,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2196
2304
  l(void 0), d(void 0);
2197
2305
  return;
2198
2306
  }
2199
- let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } = an.get(u.node(-1)).findCell(u.pos - u.start(-1)), x = _ && _.width > 0 ? _.left + _.width / 2 : v.left + (s - y + .5) * v.width / (b - y);
2307
+ let g = c.getBoundingClientRect(), _ = t.querySelectorAll(":scope > colgroup > col")[s]?.getBoundingClientRect(), v = e.getBoundingClientRect(), { left: y, right: b } = cn.get(u.node(-1)).findCell(u.pos - u.start(-1)), x = _ && _.width > 0 ? _.left + _.width / 2 : v.left + (s - y + .5) * v.width / (b - y);
2200
2308
  p({
2201
2309
  row: {
2202
2310
  left: Math.max(m.left + 11, h.left - 11) - f.left,
@@ -2219,7 +2327,7 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2219
2327
  function v(e, t) {
2220
2328
  let n = g(t.cell);
2221
2329
  if (!n) return !1;
2222
- let r = n.node(-1), i = an.get(r);
2330
+ let r = n.node(-1), i = cn.get(r);
2223
2331
  return i.cellsInRect({
2224
2332
  left: 0,
2225
2333
  top: 0,
@@ -2227,20 +2335,20 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2227
2335
  bottom: e === "column" ? i.height : 1
2228
2336
  }).every((e) => r.nodeAt(e)?.type.spec.tableRole === "header_cell");
2229
2337
  }
2230
- return or.map((t) => {
2231
- let s = t === "row" ? qe : Ke, p = o(t === "row" ? "table.rowMenu" : "table.columnMenu");
2338
+ return pr.map((t) => {
2339
+ let s = t === "row" ? Ye : Je, p = o(t === "row" ? "table.rowMenu" : "table.columnMenu");
2232
2340
  function m(e) {
2233
2341
  c && i.isEditable && _(t, c) && (h.current = !0, e(), l(void 0), d(void 0));
2234
2342
  }
2235
- return /* @__PURE__ */ U(r.Root, {
2343
+ return /* @__PURE__ */ W(r.Root, {
2236
2344
  modal: !1,
2237
2345
  open: u === t,
2238
2346
  onOpenChange: (e) => {
2239
2347
  e ? (h.current = !1, _(t, c) && d(t)) : d(void 0);
2240
2348
  },
2241
- children: [/* @__PURE__ */ H(r.Trigger, {
2349
+ children: [/* @__PURE__ */ U(r.Trigger, {
2242
2350
  asChild: !0,
2243
- children: /* @__PURE__ */ H($, {
2351
+ children: /* @__PURE__ */ U($, {
2244
2352
  label: p,
2245
2353
  appearance: e?.button,
2246
2354
  defaultSizeClassName: "size-5 p-0",
@@ -2248,40 +2356,40 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2248
2356
  style: f[t],
2249
2357
  overlayTarget: n,
2250
2358
  onMouseDown: (e) => e.preventDefault(),
2251
- children: /* @__PURE__ */ H(s, {
2359
+ children: /* @__PURE__ */ U(s, {
2252
2360
  size: 16,
2253
2361
  "aria-hidden": !0
2254
2362
  })
2255
2363
  })
2256
- }), /* @__PURE__ */ U(r.Content, {
2364
+ }), /* @__PURE__ */ W(r.Content, {
2257
2365
  container: n,
2258
- className: J("z-3", e?.className),
2366
+ className: Y("z-3", e?.className),
2259
2367
  align: "start",
2260
2368
  side: t === "row" ? "right" : "top",
2261
2369
  onCloseAutoFocus: (e) => {
2262
2370
  h.current && e.preventDefault();
2263
2371
  },
2264
2372
  children: [
2265
- sr[t].map(([e, t, n]) => /* @__PURE__ */ U(r.Item, {
2373
+ mr[t].map(([e, t, n]) => /* @__PURE__ */ W(r.Item, {
2266
2374
  className: "vibe-shadcn-tiptap__menu-item",
2267
2375
  onSelect: () => m(a[e]),
2268
- children: [/* @__PURE__ */ H(n, {
2376
+ children: [/* @__PURE__ */ U(n, {
2269
2377
  size: 15,
2270
2378
  "aria-hidden": !0
2271
2379
  }), o(t)]
2272
2380
  }, e)),
2273
- c[t] === 0 && /* @__PURE__ */ U(r.Item, {
2381
+ c[t] === 0 && /* @__PURE__ */ W(r.Item, {
2274
2382
  className: "vibe-shadcn-tiptap__menu-item",
2275
2383
  onSelect: () => m(t === "row" ? a.toggleHeaderRow : a.toggleHeaderColumn),
2276
- children: [/* @__PURE__ */ H(zt, {
2384
+ children: [/* @__PURE__ */ U(Vt, {
2277
2385
  size: 15,
2278
2386
  "aria-hidden": !0
2279
2387
  }), o(v(t, c) ? "table.unsetHeader" : "table.setHeader")]
2280
2388
  }),
2281
- /* @__PURE__ */ U(r.Item, {
2389
+ /* @__PURE__ */ W(r.Item, {
2282
2390
  className: "vibe-shadcn-tiptap__menu-item",
2283
2391
  onSelect: () => m(() => t === "row" ? a.deleteRow(c.row) : a.deleteColumn(c.column)),
2284
- children: [/* @__PURE__ */ H(Bt, {
2392
+ children: [/* @__PURE__ */ U(Ht, {
2285
2393
  size: 15,
2286
2394
  "aria-hidden": !0
2287
2395
  }), o("table.deleteLine")]
@@ -2292,174 +2400,198 @@ function cr({ appearance: e, context: t, overlayTarget: n }) {
2292
2400
  });
2293
2401
  }
2294
2402
  // src/use-vibe-tiptap.ts
2295
- var lr = Symbol();
2296
- function ur(e = {}) {
2297
- let [t] = q(() => ({ ...e })), [n, r] = q(!1), i = K(void 0), a = K(e), o = K(void 0), s = K(void 0), [c] = q(() => {
2403
+ var gr = Symbol();
2404
+ function _r(e = {}) {
2405
+ let t = zn(), [n] = J(() => ({
2406
+ ...e,
2407
+ mediaResources: e.mediaResources ?? t
2408
+ })), [r, i] = J(!1), a = q(void 0), o = q(e), s = q(void 0), c = q(void 0), l = q(void 0), [u] = J(() => {
2298
2409
  function e() {
2299
- let e = s.current;
2300
- s.current = void 0, i.current?.onSlash(void 0), e && !e.editor.isDestroyed && te(e.editor.view, (t.slashCommand || void 0)?.pluginKey ?? le);
2410
+ let e = c.current;
2411
+ c.current = void 0, a.current?.onSlash(void 0), e && !e.editor.isDestroyed && ne(e.editor.view, (n.slashCommand || void 0)?.pluginKey ?? V);
2412
+ }
2413
+ function t() {
2414
+ l.current && te(l.current.editor);
2301
2415
  }
2302
2416
  return {
2303
- bind(t) {
2304
- if (i.current) throw Error("useVibeTiptap already has a mounted editor view");
2305
- return e(), i.current = t, () => {
2306
- i.current = void 0, e(), r(!1);
2417
+ bind(n) {
2418
+ if (a.current) throw Error("useVibeTiptap already has a mounted editor view");
2419
+ return e(), t(), a.current = n, () => {
2420
+ a.current = void 0, e(), t(), i(!1);
2307
2421
  };
2308
2422
  },
2309
2423
  closeSlashMenu: e
2310
2424
  };
2311
- }), l = {
2312
- onOpen: u,
2313
- onUpdate: u,
2314
- onClose: () => u(void 0),
2315
- onExecute: (e) => i.current?.onExecute(e)
2425
+ }), d = {
2426
+ onOpen: f,
2427
+ onUpdate: f,
2428
+ onClose: () => f(void 0),
2429
+ onExecute: (e) => a.current?.onExecute(e)
2316
2430
  };
2317
- function u(e) {
2318
- s.current = e, i.current?.onSlash(e);
2431
+ function f(e) {
2432
+ c.current = e, a.current?.onSlash(e);
2319
2433
  }
2320
- function d() {
2321
- let e = o.current;
2322
- if (e?.editor.schema.nodes.image) return A(e, () => a.current.uploadAsset, () => a.current.editorBehaviorOptions);
2434
+ function p(e) {
2435
+ l.current = e, a.current?.onMention(e);
2323
2436
  }
2324
- W(() => {
2325
- a.current = e;
2437
+ let m = n.mention || void 0, h = m && {
2438
+ ...m,
2439
+ onOpen(e) {
2440
+ p(e), m.onOpen?.(e);
2441
+ },
2442
+ onUpdate(e) {
2443
+ p(e), m.onUpdate?.(e);
2444
+ },
2445
+ onClose() {
2446
+ p(void 0), m.onClose?.();
2447
+ }
2448
+ };
2449
+ function g() {
2450
+ let e = s.current;
2451
+ if (e?.editor.schema.nodes.image) return A(e, () => o.current.uploadAsset, () => o.current.editorBehaviorOptions);
2452
+ }
2453
+ G(() => {
2454
+ o.current = e;
2326
2455
  }, [e]);
2327
- let f = fe({
2328
- ...t,
2329
- content: t.initialContent,
2330
- editable: (e.editable ?? !0) && !n,
2456
+ let _ = me({
2457
+ ...n,
2458
+ content: n.initialContent,
2459
+ editable: (e.editable ?? !0) && !r,
2331
2460
  uploadAsset: e.uploadAsset,
2332
2461
  editorBehaviorOptions: e.editorBehaviorOptions,
2333
- slashCommand: t.slashCommand ?? {},
2462
+ slashCommand: n.slashCommand ?? {},
2463
+ mention: h,
2334
2464
  editorProps: {
2335
- ...t.editorProps,
2465
+ ...n.editorProps,
2336
2466
  handleDOMEvents: {
2337
- ...t.editorProps?.handleDOMEvents,
2467
+ ...n.editorProps?.handleDOMEvents,
2338
2468
  paste(e, t) {
2339
- return a.current.editorProps?.handleDOMEvents?.paste?.(e, t) ? !0 : (d()?.onPaste(t), t.defaultPrevented);
2469
+ return o.current.editorProps?.handleDOMEvents?.paste?.(e, t) ? !0 : (g()?.onPaste(t), t.defaultPrevented);
2340
2470
  },
2341
2471
  drop(e, t) {
2342
- return a.current.editorProps?.handleDOMEvents?.drop?.(e, t) ? !0 : (d()?.onDrop(t), t.defaultPrevented);
2472
+ return o.current.editorProps?.handleDOMEvents?.drop?.(e, t) ? !0 : (g()?.onDrop(t), t.defaultPrevented);
2343
2473
  }
2344
2474
  }
2345
2475
  },
2346
2476
  onUpdate: e.onUpdate,
2347
2477
  onImagePreview(t) {
2348
- i.current?.onImagePreview(t), e.onImagePreview?.(t);
2478
+ a.current?.onImagePreview(t), e.onImagePreview?.(t);
2349
2479
  },
2350
2480
  notify(t, n = "info") {
2351
- (e.notify ?? i.current?.notify)?.(t, n);
2481
+ (e.notify ?? a.current?.notify)?.(t, n);
2352
2482
  }
2353
- }, t.slashCommand === !1 ? void 0 : l);
2354
- return W(() => (o.current = f, () => {
2355
- o.current = void 0;
2356
- }), [f]), {
2357
- context: f,
2358
- [lr]: {
2359
- bridge: c,
2360
- preview: n,
2361
- setPreview: r,
2483
+ }, n.slashCommand === !1 ? void 0 : d);
2484
+ return G(() => (s.current = _, () => {
2485
+ s.current = void 0;
2486
+ }), [_]), {
2487
+ context: _,
2488
+ [gr]: {
2489
+ bridge: u,
2490
+ preview: r,
2491
+ setPreview: i,
2362
2492
  editable: e.editable ?? !0,
2363
- codeBlockLanguages: t.codeBlockLanguages,
2364
- horizontalRules: t.horizontalRules,
2493
+ mentionHoverDelay: m?.hoverDelay,
2494
+ codeBlockLanguages: n.codeBlockLanguages,
2495
+ horizontalRules: n.horizontalRules,
2365
2496
  uploadAsset: e.uploadAsset,
2366
2497
  editorBehaviorOptions: e.editorBehaviorOptions
2367
2498
  }
2368
2499
  };
2369
2500
  }
2370
2501
  // src/shadcn-tiptap-editor.tsx
2371
- function dr(e) {
2372
- let t = Fn(e), { components: n, editor: r, showWordCount: i = !0, toolbar: a, toolbarOptions: o, colors: s, highlights: c, ui: l, markdownOptions: u, printOptions: d, className: f, onKeyDown: p, ...m } = {
2502
+ function vr(e) {
2503
+ let t = Bn(e), { components: n, editor: r, showWordCount: i = !0, toolbar: a, toolbarOptions: o, colors: s, highlights: c, ui: l, markdownOptions: u, renderMentionItem: d, renderMentionPopover: f, printOptions: p, className: m, onKeyDown: h, ...g } = {
2373
2504
  ...e,
2374
2505
  ...t
2375
- }, { context: h } = r, { editable: g, preview: _, setPreview: v, codeBlockLanguages: y, horizontalRules: b, uploadAsset: x, editorBehaviorOptions: S, bridge: C } = r[lr], { Tooltip: w } = n, [T, ee] = q(null), [D, O] = q(null), [k, A] = q(!1), [j, te] = q(), [M, ne] = q(), [re, ie] = q(!1), [N, P] = q(), [F, I] = q(), [ae, L] = q([]), oe = K(0), se = K(/* @__PURE__ */ new Map()), R = K(!1), ce = E(a).some((e) => e.includes("preview")), B = V(h, (e) => e.editor.isEditable) ?? g, le = T?.ownerDocument.fullscreenEnabled && typeof T.requestFullscreen == "function";
2376
- W(() => {
2377
- let e = C.bind({
2378
- onSlash: ne,
2506
+ }, { context: _ } = r, { editable: v, preview: y, setPreview: b, codeBlockLanguages: x, horizontalRules: S, uploadAsset: C, editorBehaviorOptions: w, bridge: T } = r[gr], { Tooltip: ee } = n, [D, O] = J(null), [k, A] = J(null), [j, te] = J(!1), [ne, M] = J(), [N, P] = J(), [re, ie] = J(), [ae, oe] = J(!1), [F, I] = J(), [se, L] = J(), [ce, R] = J([]), le = q(0), z = q(/* @__PURE__ */ new Map()), B = q(!1), de = E(a).some((e) => e.includes("preview")), V = H(_, (e) => e.editor.isEditable) ?? v, fe = D?.ownerDocument.fullscreenEnabled && typeof D.requestFullscreen == "function";
2507
+ G(() => {
2508
+ let e = T.bind({
2509
+ onSlash: P,
2510
+ onMention: ie,
2379
2511
  onExecute: ({ item: e }) => {
2380
- h && z(h, e, {
2381
- onImage: () => P({
2512
+ _ && ue(_, e, {
2513
+ onImage: () => I({
2382
2514
  kind: "image",
2383
2515
  tab: "upload"
2384
2516
  }),
2385
- onImageUrl: () => P({
2517
+ onImageUrl: () => I({
2386
2518
  kind: "image",
2387
2519
  tab: "url"
2388
2520
  }),
2389
- onVideo: () => P({
2521
+ onVideo: () => I({
2390
2522
  kind: "video",
2391
2523
  tab: "upload"
2392
2524
  }),
2393
- onVideoUrl: () => P({
2525
+ onVideoUrl: () => I({
2394
2526
  kind: "video",
2395
2527
  tab: "url"
2396
2528
  }),
2397
- onAudio: () => P({
2529
+ onAudio: () => I({
2398
2530
  kind: "audio",
2399
2531
  tab: "upload"
2400
2532
  }),
2401
- onAudioUrl: () => P({
2533
+ onAudioUrl: () => I({
2402
2534
  kind: "audio",
2403
2535
  tab: "url"
2404
2536
  }),
2405
- onUpload: () => P({
2537
+ onUpload: () => I({
2406
2538
  kind: "attachment",
2407
2539
  tab: "upload"
2408
2540
  }),
2409
- onLink: () => P({ kind: "link" }),
2410
- onWhiteboard: () => I("new")
2541
+ onLink: () => I({ kind: "link" }),
2542
+ onWhiteboard: () => L("new")
2411
2543
  });
2412
2544
  },
2413
2545
  onImagePreview(e) {
2414
- te({
2546
+ M({
2415
2547
  ...e,
2416
2548
  urls: [...e.urls],
2417
2549
  names: e.names?.slice()
2418
2550
  });
2419
2551
  },
2420
2552
  notify(e, t = "info") {
2421
- let n = ++oe.current;
2422
- L((r) => [...r, {
2553
+ let n = ++le.current;
2554
+ R((r) => [...r, {
2423
2555
  id: n,
2424
2556
  message: e,
2425
2557
  type: t
2426
- }]), se.current.set(n, setTimeout(() => {
2427
- se.current.delete(n), L((e) => e.filter((e) => e.id !== n));
2558
+ }]), z.current.set(n, setTimeout(() => {
2559
+ z.current.delete(n), R((e) => e.filter((e) => e.id !== n));
2428
2560
  }, 3e3));
2429
2561
  }
2430
- }), t = se.current;
2562
+ }), t = z.current;
2431
2563
  return () => {
2432
2564
  e();
2433
2565
  for (let e of t.values()) clearTimeout(e);
2434
- t.clear(), L([]), ne(void 0), te(void 0), P(void 0), I(void 0), ie(!1);
2566
+ t.clear(), R([]), P(void 0), ie(void 0), M(void 0), I(void 0), L(void 0), oe(!1);
2435
2567
  };
2436
- }, [C, h]), W(() => {
2437
- ce || v(!1);
2438
- }, [ce, v]), W(() => {
2439
- if (!T) return;
2440
- let e = T.ownerDocument, t = () => A(e.fullscreenElement === T);
2568
+ }, [T, _]), G(() => {
2569
+ de || b(!1);
2570
+ }, [de, b]), G(() => {
2571
+ if (!D) return;
2572
+ let e = D.ownerDocument, t = () => te(e.fullscreenElement === D);
2441
2573
  return e.addEventListener("fullscreenchange", t), () => e.removeEventListener("fullscreenchange", t);
2442
- }, [T]), W(() => {
2443
- B || (P(void 0), I(void 0), ie(!1)), !B && M && C.closeSlashMenu();
2574
+ }, [D]), G(() => {
2575
+ V || (I(void 0), L(void 0), oe(!1)), !V && N && T.closeSlashMenu();
2444
2576
  }, [
2445
- C,
2446
- B,
2447
- M
2577
+ T,
2578
+ V,
2579
+ N
2448
2580
  ]);
2449
- async function ue(e) {
2450
- if (T && !R.current && e !== k) {
2451
- R.current = !0;
2581
+ async function pe(e) {
2582
+ if (D && !B.current && e !== j) {
2583
+ B.current = !0;
2452
2584
  try {
2453
- e ? await T.requestFullscreen() : await T.ownerDocument.exitFullscreen();
2585
+ e ? await D.requestFullscreen() : await D.ownerDocument.exitFullscreen();
2454
2586
  } catch {
2455
- h && !h.editor.isDestroyed && h.notify(h.t("notify.fullscreenFailed"), "warning");
2587
+ _ && !_.editor.isDestroyed && _.notify(_.t("notify.fullscreenFailed"), "warning");
2456
2588
  } finally {
2457
- R.current = !1;
2589
+ B.current = !1;
2458
2590
  }
2459
2591
  }
2460
2592
  }
2461
- function de(e) {
2462
- let t = h?.editor;
2593
+ function me(e) {
2594
+ let t = _?.editor;
2463
2595
  if (!t?.isEditable || e.defaultPrevented || e.button !== 0 || e.shiftKey || e.ctrlKey || e.metaKey || e.altKey || !(e.target instanceof Element)) return;
2464
2596
  let n = e.target.closest("a[href]"), { view: r, state: i } = t, a = i.schema.marks.link;
2465
2597
  if (!n || !r.dom.contains(n) || !a) return;
@@ -2467,125 +2599,138 @@ function dr(e) {
2467
2599
  if (!o.nodeAfter?.isText) return;
2468
2600
  let s = a.isInSet(o.nodeAfter.marks);
2469
2601
  if (!s || s.attrs.href !== n.getAttribute("href")) return;
2470
- let c = he(o, a, s.attrs);
2602
+ let c = _e(o, a, s.attrs);
2471
2603
  if (!c) return;
2472
2604
  e.preventDefault();
2473
2605
  let { from: l, to: u } = i.selection;
2474
2606
  (l < c.from || l >= c.to || u > c.to) && t.commands.setTextSelection(c), r.focus();
2475
2607
  }
2476
- return /* @__PURE__ */ H(un, {
2608
+ return /* @__PURE__ */ U(pn, {
2477
2609
  value: n,
2478
- children: /* @__PURE__ */ H(w.Provider, {
2610
+ children: /* @__PURE__ */ U(ee.Provider, {
2479
2611
  delayDuration: 500,
2480
2612
  skipDelayDuration: 0,
2481
- children: /* @__PURE__ */ U("div", {
2482
- ...m,
2483
- ref: ee,
2484
- className: ["vibe-shadcn-tiptap", f].filter(Boolean).join(" "),
2485
- "data-scroll-locked": B && !!(M || N || re) || void 0,
2613
+ children: /* @__PURE__ */ W("div", {
2614
+ ...g,
2615
+ ref: O,
2616
+ className: ["vibe-shadcn-tiptap", m].filter(Boolean).join(" "),
2617
+ "data-scroll-locked": V && !!(N || re || F || ae) || void 0,
2486
2618
  onKeyDown: (e) => {
2487
- if (p?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing || e.altKey || e.shiftKey || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "f" || typeof h?.editor.commands.openFindReplace != "function")) {
2619
+ if (h?.(e), !(e.defaultPrevented || e.nativeEvent.isComposing || e.altKey || e.shiftKey || !(e.ctrlKey || e.metaKey) || e.key.toLowerCase() !== "f" || typeof _?.editor.commands.openFindReplace != "function")) {
2488
2620
  if (e.preventDefault(), e.target instanceof Element && e.target.closest(".vibe-shadcn-tiptap__find")) {
2489
- let e = T?.querySelector(".vibe-shadcn-tiptap__find input");
2621
+ let e = D?.querySelector(".vibe-shadcn-tiptap__find input");
2490
2622
  e instanceof HTMLInputElement && (e.focus(), e.select());
2491
- } else h.commands.openFindReplace();
2623
+ } else _.commands.openFindReplace();
2492
2624
  }
2493
2625
  },
2494
- children: [h && /* @__PURE__ */ U(me, { children: [
2495
- a !== !1 && /* @__PURE__ */ H(Un, {
2496
- context: h,
2626
+ children: [_ && /* @__PURE__ */ W(ge, { children: [
2627
+ a !== !1 && /* @__PURE__ */ U(Jn, {
2628
+ context: _,
2497
2629
  toolbar: a,
2498
2630
  toolbarOptions: o,
2499
- codeBlockLanguages: y,
2500
- horizontalRules: b,
2631
+ codeBlockLanguages: x,
2632
+ horizontalRules: S,
2501
2633
  colors: s,
2502
2634
  highlights: c,
2503
2635
  ui: l,
2504
2636
  markdownOptions: u,
2505
- printOptions: d,
2506
- uploadAsset: x,
2507
- openWhiteboard: () => I("new"),
2508
- editorBehaviorOptions: S,
2509
- preview: _,
2510
- onPreviewChange: v,
2511
- fullscreen: le || k ? k : void 0,
2512
- onFullscreenChange: ue,
2513
- overlayTarget: D ?? void 0
2514
- }, h.editor.instanceId),
2515
- /* @__PURE__ */ U("div", {
2637
+ printOptions: p,
2638
+ uploadAsset: C,
2639
+ openWhiteboard: () => L("new"),
2640
+ editorBehaviorOptions: w,
2641
+ preview: y,
2642
+ onPreviewChange: b,
2643
+ fullscreen: fe || j ? j : void 0,
2644
+ onFullscreenChange: pe,
2645
+ overlayTarget: k ?? void 0
2646
+ }, _.editor.instanceId),
2647
+ /* @__PURE__ */ W("div", {
2516
2648
  className: "vibe-shadcn-tiptap__body",
2517
2649
  children: [
2518
- /* @__PURE__ */ H($n, {
2519
- context: h,
2650
+ /* @__PURE__ */ U(ir, {
2651
+ context: _,
2520
2652
  appearance: l?.findReplace,
2521
- editable: B,
2522
- overlayTarget: D ?? void 0
2653
+ editable: V,
2654
+ overlayTarget: k ?? void 0
2523
2655
  }),
2524
- /* @__PURE__ */ H(sn, {
2525
- context: h,
2526
- tabIndex: !B && typeof h.editor.commands.openFindReplace == "function" ? 0 : void 0,
2527
- onClick: de,
2656
+ /* @__PURE__ */ U(un, {
2657
+ context: _,
2658
+ tabIndex: !V && typeof _.editor.commands.openFindReplace == "function" ? 0 : void 0,
2659
+ onClick: me,
2528
2660
  onBlur: (e) => {
2529
- !e.currentTarget.contains(e.relatedTarget) && M && !h.editor.isDestroyed && C.closeSlashMenu();
2661
+ !e.currentTarget.contains(e.relatedTarget) && N && !_.editor.isDestroyed && T.closeSlashMenu();
2530
2662
  }
2531
2663
  }),
2532
- B && D && /* @__PURE__ */ H(cr, {
2664
+ V && k && /* @__PURE__ */ U(hr, {
2533
2665
  appearance: l?.tableGrips,
2534
- context: h,
2535
- overlayTarget: D
2666
+ context: _,
2667
+ overlayTarget: k
2536
2668
  })
2537
2669
  ]
2538
2670
  }),
2539
- i && /* @__PURE__ */ H(cn, { context: h }),
2540
- B && D && /* @__PURE__ */ H(Qn, {
2541
- context: h,
2671
+ i && /* @__PURE__ */ U(dn, { context: _ }),
2672
+ V && k && /* @__PURE__ */ U(rr, {
2673
+ context: _,
2542
2674
  ui: l,
2543
- overlayTarget: D,
2675
+ overlayTarget: k,
2544
2676
  colors: s,
2545
2677
  highlights: c,
2546
- uploadAsset: x,
2547
- behaviorOptions: S,
2548
- onLink: P,
2549
- onWhiteboardEdit: () => I("edit"),
2550
- onPaletteOpenChange: ie
2678
+ uploadAsset: C,
2679
+ behaviorOptions: w,
2680
+ onLink: I,
2681
+ onWhiteboardEdit: () => L("edit"),
2682
+ onPaletteOpenChange: oe
2551
2683
  }),
2552
- B && D && x && F && /* @__PURE__ */ H(In, {
2684
+ V && k && C && se && /* @__PURE__ */ U(Vn, {
2553
2685
  appearance: l?.whiteboard,
2554
- context: h,
2555
- uploadAsset: x,
2556
- overlayTarget: D,
2557
- edit: F === "edit",
2558
- onClose: () => I(void 0)
2686
+ context: _,
2687
+ uploadAsset: C,
2688
+ overlayTarget: k,
2689
+ edit: se === "edit",
2690
+ onClose: () => L(void 0)
2559
2691
  }),
2560
- B && M && D && /* @__PURE__ */ H(ir, {
2692
+ V && N && k && /* @__PURE__ */ U(dr, {
2561
2693
  appearance: l?.slashMenu,
2562
- state: M,
2563
- target: D,
2564
- t: h.t
2694
+ state: N,
2695
+ target: k,
2696
+ t: _.t
2565
2697
  }),
2566
- B && N && D && /* @__PURE__ */ H(wn, {
2698
+ V && re && k && /* @__PURE__ */ U(sr, {
2699
+ appearance: l?.mentionMenu,
2700
+ state: re,
2701
+ target: k,
2702
+ t: _.t,
2703
+ renderItem: d
2704
+ }),
2705
+ f && k && /* @__PURE__ */ U(cr, {
2706
+ editor: _.editor.view.dom,
2707
+ container: k,
2708
+ hoverDelay: r[gr].mentionHoverDelay,
2709
+ render: f
2710
+ }, _.editor.instanceId),
2711
+ V && F && k && /* @__PURE__ */ U(On, {
2567
2712
  appearance: l?.insertionPopover,
2568
- context: h,
2569
- request: N,
2570
- overlayTarget: D,
2571
- canUpload: !!x,
2572
- behaviorOptions: S,
2573
- onClose: () => P(void 0)
2574
- }, N.kind),
2575
- D && j && /* @__PURE__ */ H(tr, {
2713
+ context: _,
2714
+ request: F,
2715
+ overlayTarget: k,
2716
+ canUpload: !!C,
2717
+ behaviorOptions: w,
2718
+ onClose: () => I(void 0)
2719
+ }, F.kind),
2720
+ k && ne && /* @__PURE__ */ U(or, {
2576
2721
  appearance: l?.imagePreview,
2577
- context: h,
2578
- overlayTarget: D,
2579
- imagePreview: j,
2580
- onClose: () => te(void 0)
2722
+ context: _,
2723
+ overlayTarget: k,
2724
+ imagePreview: ne,
2725
+ onClose: () => M(void 0)
2581
2726
  })
2582
- ] }), /* @__PURE__ */ H("div", {
2583
- ref: O,
2727
+ ] }), /* @__PURE__ */ U("div", {
2728
+ ref: A,
2584
2729
  className: "vibe-shadcn-tiptap__overlays",
2585
- children: /* @__PURE__ */ H("div", {
2730
+ children: /* @__PURE__ */ U("div", {
2586
2731
  className: "vibe-shadcn-tiptap__notices",
2587
2732
  "aria-live": "polite",
2588
- children: ae.map(({ id: e, message: t, type: n }) => /* @__PURE__ */ H("div", {
2733
+ children: ce.map(({ id: e, message: t, type: n }) => /* @__PURE__ */ U("div", {
2589
2734
  role: n === "error" ? "alert" : "status",
2590
2735
  "data-type": n,
2591
2736
  children: t
@@ -2596,4 +2741,4 @@ function dr(e) {
2596
2741
  })
2597
2742
  });
2598
2743
  }
2599
- export { _ as DEFAULT_CODE_BLOCK_LANGUAGES, v as DEFAULT_HORIZONTAL_RULES, e as PRESET_HIGHLIGHT_COLORS, t as PRESET_TEXT_COLORS, y as SHADCN_UI_DEFAULT_TOOLBAR, sn as ShadcnTiptapContent, dr as ShadcnTiptapEditor, dr as VibeTiptap, cn as ShadcnTiptapStatusBar, Hn as ShadcnTiptapToolbar, b as TOOLBAR_ALIGN_OPTIONS, S as TOOLBAR_HEADING_OPTIONS, n as TOOLBAR_HEADING_PREVIEW_STYLES, a as TOOLBAR_MARKDOWN_IMPORT_ACCEPT, o as TOOLBAR_MARKDOWN_OPTIONS, w as TOOLBAR_TABLE_GRID, Pn as VibeTiptapProvider, c as copyMarkdown, u as exportMarkdownFile, f as importMarkdownFile, T as normalizeToolbarConfig, h as printEditorContent, ur as useVibeTiptap };
2744
+ export { _ as DEFAULT_CODE_BLOCK_LANGUAGES, v as DEFAULT_HORIZONTAL_RULES, e as PRESET_HIGHLIGHT_COLORS, t as PRESET_TEXT_COLORS, y as SHADCN_UI_DEFAULT_TOOLBAR, un as ShadcnTiptapContent, vr as ShadcnTiptapEditor, vr as VibeTiptap, dn as ShadcnTiptapStatusBar, qn as ShadcnTiptapToolbar, b as TOOLBAR_ALIGN_OPTIONS, S as TOOLBAR_HEADING_OPTIONS, n as TOOLBAR_HEADING_PREVIEW_STYLES, a as TOOLBAR_MARKDOWN_IMPORT_ACCEPT, o as TOOLBAR_MARKDOWN_OPTIONS, w as TOOLBAR_TABLE_GRID, Rn as VibeTiptapProvider, c as copyMarkdown, u as exportMarkdownFile, f as importMarkdownFile, T as normalizeToolbarConfig, h as printEditorContent, _r as useVibeTiptap };