@bikdotai/bik-component-library 0.0.852 → 0.0.853

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.
Files changed (79) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
  4. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
  6. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
  8. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  10. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/MentionPicker.js +24 -24
  12. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +2 -2
  16. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +1 -1
  18. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  20. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  22. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
  24. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  25. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  26. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  27. package/dist/cjs/components/agent-listing/AiAgentsEmptyState.js +1 -1
  28. package/dist/cjs/components/agent-listing/AiAgentsEmptyState.js.map +1 -1
  29. package/dist/cjs/components/zeroState/ZeroState.js +3 -3
  30. package/dist/cjs/components/zeroState/ZeroState.js.map +1 -1
  31. package/dist/cjs/editor/BikEditor.js +1 -1
  32. package/dist/cjs/editor/BikEditor.js.map +1 -1
  33. package/dist/cjs/editor/BikEditor.styles.js +22 -16
  34. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  35. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
  36. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  37. package/dist/esm/components/agent-builder/AgentBuilder.js +146 -136
  38. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  39. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +7 -2
  40. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.d.ts +2 -0
  41. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +29 -26
  42. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  43. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +30 -29
  44. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  45. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +9 -0
  46. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +199 -184
  47. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  48. package/dist/esm/components/agent-builder/components/GoLiveModal.js +11 -13
  49. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  50. package/dist/esm/components/agent-builder/components/MentionPicker.js +174 -150
  51. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  52. package/dist/esm/components/agent-builder/components/RequireVerificationModal.js +8 -8
  53. package/dist/esm/components/agent-builder/components/RequireVerificationModal.js.map +1 -1
  54. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +54 -51
  55. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  56. package/dist/esm/components/agent-builder/components/SelectableListSection.js +73 -69
  57. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  58. package/dist/esm/components/agent-builder/constants/tools.d.ts +20 -0
  59. package/dist/esm/components/agent-builder/constants/tools.js +34 -23
  60. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  61. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +270 -255
  62. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  63. package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +6 -6
  64. package/dist/esm/components/agent-builder/utils/sourceIcons.js +21 -19
  65. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  66. package/dist/esm/components/agent-listing/AgentTableRow.js +26 -23
  67. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  68. package/dist/esm/components/agent-listing/AiAgentsEmptyState.js +3 -2
  69. package/dist/esm/components/agent-listing/AiAgentsEmptyState.js.map +1 -1
  70. package/dist/esm/components/zeroState/ZeroState.d.ts +2 -0
  71. package/dist/esm/components/zeroState/ZeroState.js +18 -17
  72. package/dist/esm/components/zeroState/ZeroState.js.map +1 -1
  73. package/dist/esm/editor/BikEditor.js +236 -223
  74. package/dist/esm/editor/BikEditor.js.map +1 -1
  75. package/dist/esm/editor/BikEditor.styles.js +18 -12
  76. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  77. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +62 -60
  78. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  79. package/package.json +1 -1
@@ -1,90 +1,90 @@
1
1
  import { jsxs as u, jsx as d } from "react/jsx-runtime";
2
- import { getMarkRange as vt } from "../node_modules/@tiptap/core/dist/index.js";
3
- import { useEditor as bt, EditorContent as X } from "@tiptap/react";
4
- import { forwardRef as Et, useState as A, useRef as a, useEffect as At, useImperativeHandle as Tt } from "react";
5
- import { BodyCaption as Y } from "../components/TypographyStyle.js";
6
- import { BikEditorShell as It, BikJsonHeader as Rt, BikJsonBody as Jt, BikJsonEmptyState as Lt, BikJsonError as Mt } from "./BikEditor.styles.js";
7
- import { DEFAULT_FORMAT_STATE as tt } from "./BikEditor.types.js";
8
- import { buildJsonCodeBlockHtml as Ot, buildSectionedContent as et, normalizeHtml as s, extractActiveFormats as nt, extractContent as ot, getCodeBlockText as g, parseJson as p, extractBodyContent as Ft, extractSectionContent as zt, setCodeBlockText as x, findSectionEndPos as rt, findSectionStartPos as Nt, setSectionContentInEditor as T, insertInlineHtml as jt } from "./BikEditor.utils.js";
9
- import { buildExtensions as Ht } from "./extensions/buildExtensions.js";
10
- import { LinkBubbleMenu as wt } from "./floating/LinkBubbleMenu.js";
11
- import Pt from "../icons/BIK AI specific/WandSparkles.js";
12
- import Dt from "../icons/Actions/Formatting/Copy.js";
13
- import qt from "../icons/Actions/Common actions/Code.js";
14
- import Ut from "../icons/Informational/General/Info.js";
15
- function $t(k) {
2
+ import { getMarkRange as Ee } from "../node_modules/@tiptap/core/dist/index.js";
3
+ import { useEditor as Ae, EditorContent as ee } from "@tiptap/react";
4
+ import { forwardRef as Te, useState as x, useRef as a, useEffect as Ie, useImperativeHandle as Je } from "react";
5
+ import { BodyCaption as te } from "../components/TypographyStyle.js";
6
+ import { BikEditorShell as Re, BikJsonHeader as Le, BikJsonBody as Me, BikJsonEmptyState as Oe, BikJsonError as Fe } from "./BikEditor.styles.js";
7
+ import { DEFAULT_FORMAT_STATE as ne } from "./BikEditor.types.js";
8
+ import { buildJsonCodeBlockHtml as je, buildSectionedContent as oe, normalizeHtml as i, extractActiveFormats as re, extractContent as se, getCodeBlockText as g, parseJson as p, extractBodyContent as ze, extractSectionContent as Ne, setCodeBlockText as b, findSectionEndPos as ie, findSectionStartPos as He, setSectionContentInEditor as I, insertInlineHtml as we } from "./BikEditor.utils.js";
9
+ import { buildExtensions as Pe } from "./extensions/buildExtensions.js";
10
+ import { LinkBubbleMenu as De } from "./floating/LinkBubbleMenu.js";
11
+ import qe from "../icons/BIK AI specific/WandSparkles.js";
12
+ import Ue from "../icons/Actions/Formatting/Copy.js";
13
+ import $e from "../icons/Actions/Common actions/Code.js";
14
+ import We from "../icons/Informational/General/Info.js";
15
+ function Ve(k) {
16
16
  return Object.entries(k).map(
17
17
  ([v, C]) => `${v.replace(/([A-Z])/g, (y) => `-${y.toLowerCase()}`)}:${C}`
18
18
  ).join(";");
19
19
  }
20
- const Wt = (k, v) => {
20
+ const _e = (k, v) => {
21
21
  const {
22
22
  initialContent: C,
23
23
  sections: y,
24
24
  features: B,
25
- disabled: it,
26
- maxCharacters: I,
27
- characterLimit: st,
28
- characterLimitHard: ct,
29
- shortcuts: at,
30
- sendShortcut: lt,
25
+ disabled: ce,
26
+ maxCharacters: J,
27
+ characterLimit: ae,
28
+ characterLimitHard: le,
29
+ shortcuts: de,
30
+ sendShortcut: ue,
31
31
  mentions: l,
32
32
  slashCommands: S,
33
- link: dt,
34
- onPaste: ut,
33
+ link: me,
34
+ onPaste: fe,
35
35
  onReady: R,
36
- onChange: J,
37
- onSend: b,
38
- onFocus: L,
39
- onBlur: M,
40
- onSelectionChange: O,
41
- minHeight: mt,
42
- maxHeight: ft,
43
- style: gt,
44
- className: ht,
45
- editorClassName: F,
36
+ onChange: L,
37
+ onSend: E,
38
+ onFocus: M,
39
+ onBlur: O,
40
+ onSelectionChange: F,
41
+ minHeight: ge,
42
+ maxHeight: he,
43
+ style: pe,
44
+ className: Ce,
45
+ editorClassName: j,
46
46
  editorStyle: z,
47
47
  renderJsonError: N
48
- } = k, m = !!B?.jsonMode, [f, j] = A(null), [pt, H] = A(!1), [Ct, w] = A(
48
+ } = k, m = !!B?.jsonMode, [f, H] = x(null), [Se, w] = x(!1), [A, P] = x(
49
49
  m && !(C ?? "").trim()
50
- ), St = m ? Ot(C ?? "") : y?.length ? et(
51
- s(C ?? ""),
52
- y.map((t) => ({ ...t, content: s(t.content) }))
53
- ) : s(C ?? ""), E = a([]), P = a(!1), D = a(R);
54
- D.current = R;
55
- const q = a(J);
56
- q.current = J;
57
- const U = a(O);
58
- U.current = O;
59
- const $ = a(tt), W = a(L);
60
- W.current = L;
61
- const V = a(M);
62
- V.current = M;
63
- const _ = a(b);
64
- _.current = b;
65
- const Q = a(l?.agents ?? []);
66
- Q.current = l?.agents ?? [];
67
- const Z = a(l?.teams ?? []);
68
- Z.current = l?.teams ?? [];
69
- const G = a(S?.items ?? []);
70
- G.current = S?.items ?? [];
71
- const n = bt({
72
- extensions: Ht({
50
+ ), [ke, D] = x(!1), ye = m ? je(C ?? "") : y?.length ? oe(
51
+ i(C ?? ""),
52
+ y.map((e) => ({ ...e, content: i(e.content) }))
53
+ ) : i(C ?? ""), T = a([]), q = a(!1), U = a(R);
54
+ U.current = R;
55
+ const $ = a(L);
56
+ $.current = L;
57
+ const W = a(F);
58
+ W.current = F;
59
+ const V = a(ne), _ = a(M);
60
+ _.current = M;
61
+ const Q = a(O);
62
+ Q.current = O;
63
+ const Z = a(E);
64
+ Z.current = E;
65
+ const G = a(l?.agents ?? []);
66
+ G.current = l?.agents ?? [];
67
+ const K = a(l?.teams ?? []);
68
+ K.current = l?.teams ?? [];
69
+ const X = a(S?.items ?? []);
70
+ X.current = S?.items ?? [];
71
+ const n = Ae({
72
+ extensions: Pe({
73
73
  features: B,
74
74
  placeholder: k.placeholder,
75
- maxCharacters: I,
76
- characterLimit: st,
77
- characterLimitHard: ct,
75
+ maxCharacters: J,
76
+ characterLimit: ae,
77
+ characterLimitHard: le,
78
78
  hasSections: (y?.length ?? 0) > 0,
79
79
  mentions: {
80
- agents: l ? Q : void 0,
81
- teams: l ? Z : void 0
80
+ agents: l ? G : void 0,
81
+ teams: l ? K : void 0
82
82
  },
83
- slashCommands: S ? G : void 0,
84
- onPaste: ut,
85
- onSend: b ? (t) => _.current?.(t) : void 0,
86
- sendShortcut: lt,
87
- shortcuts: at,
83
+ slashCommands: S ? X : void 0,
84
+ onPaste: fe,
85
+ onSend: E ? (e) => Z.current?.(e) : void 0,
86
+ sendShortcut: ue,
87
+ shortcuts: de,
88
88
  onMentionSelected: l?.onSelect,
89
89
  onSlashCommandSelected: S?.onSelect,
90
90
  renderMentionItem: l?.renderItem,
@@ -94,183 +94,187 @@ const Wt = (k, v) => {
94
94
  renderSlashCommandItem: S?.renderItem,
95
95
  renderSlashCommandDropdown: S?.renderDropdown
96
96
  }),
97
- content: St,
98
- editable: !it,
97
+ content: ye,
98
+ editable: !ce,
99
99
  immediatelyRender: !1,
100
100
  // SSR-safe — NEVER remove this
101
101
  editorProps: {
102
102
  attributes: {
103
- ...F ? { class: F } : {},
104
- ...z ? { style: $t(z) } : {}
103
+ ...j ? { class: j } : {},
104
+ ...z ? { style: Ve(z) } : {}
105
105
  }
106
106
  },
107
- onUpdate: ({ editor: t }) => {
108
- if (q.current?.(ot(t)), m) {
109
- const e = g(t), o = p(e);
110
- j(o.valid ? null : o), w(!e.trim());
107
+ onUpdate: ({ editor: e }) => {
108
+ if ($.current?.(se(e)), m) {
109
+ const t = g(e), o = p(t);
110
+ H(o.valid ? null : o), P(!t.trim());
111
111
  }
112
112
  },
113
- onTransaction: ({ editor: t }) => {
114
- const e = nt(t), o = $.current;
115
- (o.bold !== e.bold || o.italic !== e.italic || o.underline !== e.underline || o.strike !== e.strike || o.bulletList !== e.bulletList || o.orderedList !== e.orderedList || o.blockquote !== e.blockquote || o.codeBlock !== e.codeBlock || o.superscript !== e.superscript || o.subscript !== e.subscript || o.textAlign !== e.textAlign || o.fontFamily !== e.fontFamily || o.fontSize !== e.fontSize || o.color !== e.color || o.highlight !== e.highlight || o.link?.href !== e.link?.href) && ($.current = e, U.current?.(e));
113
+ onTransaction: ({ editor: e }) => {
114
+ const t = re(e), o = V.current;
115
+ (o.bold !== t.bold || o.italic !== t.italic || o.underline !== t.underline || o.strike !== t.strike || o.bulletList !== t.bulletList || o.orderedList !== t.orderedList || o.blockquote !== t.blockquote || o.codeBlock !== t.codeBlock || o.superscript !== t.superscript || o.subscript !== t.subscript || o.textAlign !== t.textAlign || o.fontFamily !== t.fontFamily || o.fontSize !== t.fontSize || o.color !== t.color || o.highlight !== t.highlight || o.link?.href !== t.link?.href) && (V.current = t, W.current?.(t));
116
116
  },
117
- onFocus: () => W.current?.(),
118
- onBlur: () => V.current?.()
117
+ onFocus: () => {
118
+ D(!0), _.current?.();
119
+ },
120
+ onBlur: () => {
121
+ D(!1), Q.current?.();
122
+ }
119
123
  });
120
- function i(t) {
121
- n ? t(n) : E.current.push(t);
124
+ function s(e) {
125
+ n ? e(n) : T.current.push(e);
122
126
  }
123
- At(() => {
124
- if (n && (E.current.length > 0 && E.current.splice(0).forEach((e) => e(n)), P.current || (P.current = !0, D.current?.()), m)) {
125
- const t = g(n), e = p(t);
126
- j(e.valid ? null : e), w(!t.trim());
127
+ Ie(() => {
128
+ if (n && (T.current.length > 0 && T.current.splice(0).forEach((t) => t(n)), q.current || (q.current = !0, U.current?.()), m)) {
129
+ const e = g(n), t = p(e);
130
+ H(t.valid ? null : t), P(!e.trim());
127
131
  }
128
- }, [n, m]), Tt(
132
+ }, [n, m]), Je(
129
133
  v,
130
134
  () => ({
131
135
  // ── Focus ────────────────────────────────────────────────────────
132
- focus: (t) => i((e) => e.commands.focus(t)),
133
- blur: () => i((t) => t.commands.blur()),
136
+ focus: (e) => s((t) => t.commands.focus(e)),
137
+ blur: () => s((e) => e.commands.blur()),
134
138
  // ── Content ──────────────────────────────────────────────────────
135
- clearContent: () => i((t) => t.commands.clearContent(!0)),
136
- setContent: (t) => {
137
- const e = s(t);
138
- i((o) => o.commands.setContent(e, { emitUpdate: !0 }));
139
+ clearContent: () => s((e) => e.commands.clearContent(!0)),
140
+ setContent: (e) => {
141
+ const t = i(e);
142
+ s((o) => o.commands.setContent(t, { emitUpdate: !0 }));
139
143
  },
140
- insertContent: (t) => {
141
- const e = s(t);
142
- i((o) => o.commands.insertContent(e));
144
+ insertContent: (e) => {
145
+ const t = i(e);
146
+ s((o) => o.commands.insertContent(t));
143
147
  },
144
- insertInlineContent: (t) => {
145
- i((e) => jt(e, t));
148
+ insertInlineContent: (e) => {
149
+ s((t) => we(t, e));
146
150
  },
147
- insertAtStart: (t) => {
148
- const e = s(t);
149
- i((o) => o.commands.insertContentAt(1, e));
151
+ insertAtStart: (e) => {
152
+ const t = i(e);
153
+ s((o) => o.commands.insertContentAt(1, t));
150
154
  },
151
- insertBlock: (t) => {
152
- const e = s(t);
153
- i(
154
- (o) => o.commands.insertContentAt(o.state.doc.content.size, e)
155
+ insertBlock: (e) => {
156
+ const t = i(e);
157
+ s(
158
+ (o) => o.commands.insertContentAt(o.state.doc.content.size, t)
155
159
  );
156
160
  },
157
- appendInline: (t) => {
158
- const e = s(t);
159
- i(
160
- (o) => o.commands.insertContentAt(o.state.doc.content.size - 1, e)
161
+ appendInline: (e) => {
162
+ const t = i(e);
163
+ s(
164
+ (o) => o.commands.insertContentAt(o.state.doc.content.size - 1, t)
161
165
  );
162
166
  },
163
167
  // Backwards-compatible aliases
164
- insertAtEnd(t) {
165
- this.insertBlock(t);
168
+ insertAtEnd(e) {
169
+ this.insertBlock(e);
166
170
  },
167
- appendContent(t) {
168
- this.appendInline(t);
171
+ appendContent(e) {
172
+ this.appendInline(e);
169
173
  },
170
- getContent: () => n ? ot(n) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
174
+ getContent: () => n ? se(n) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
171
175
  getJSON: () => n?.getJSON() ?? null,
172
176
  getMentions: () => {
173
- const t = /* @__PURE__ */ new Set(), e = /* @__PURE__ */ new Set();
177
+ const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
174
178
  return n ? (n.state.doc.descendants((o) => {
175
- o.type.name === "mentionAgent" && o.attrs.id != null ? t.add(String(o.attrs.id)) : o.type.name === "mentionTeam" && o.attrs.id != null && e.add(String(o.attrs.id));
176
- }), { agentIds: Array.from(t), teamIds: Array.from(e) }) : { agentIds: [], teamIds: [] };
179
+ o.type.name === "mentionAgent" && o.attrs.id != null ? e.add(String(o.attrs.id)) : o.type.name === "mentionTeam" && o.attrs.id != null && t.add(String(o.attrs.id));
180
+ }), { agentIds: Array.from(e), teamIds: Array.from(t) }) : { agentIds: [], teamIds: [] };
177
181
  },
178
182
  // ── Selection ────────────────────────────────────────────────────
179
183
  getCursorPosition: () => {
180
184
  if (!n) return { from: 0, to: 0 };
181
- const { from: t, to: e } = n.state.selection;
182
- return { from: t, to: e };
185
+ const { from: e, to: t } = n.state.selection;
186
+ return { from: e, to: t };
183
187
  },
184
- insertAtPosition: (t, e) => {
185
- const o = s(e);
186
- i((r) => r.commands.insertContentAt(t, o));
188
+ insertAtPosition: (e, t) => {
189
+ const o = i(t);
190
+ s((r) => r.commands.insertContentAt(e, o));
187
191
  },
188
192
  getSelectedText: () => {
189
193
  if (!n) return "";
190
- const { state: t } = n, { from: e, to: o, empty: r } = t.selection;
194
+ const { state: e } = n, { from: t, to: o, empty: r } = e.selection;
191
195
  if (!r)
192
- return t.doc.textBetween(e, o, " ");
193
- const c = t.schema.marks.link;
196
+ return e.doc.textBetween(t, o, " ");
197
+ const c = e.schema.marks.link;
194
198
  if (c) {
195
- const h = vt(t.doc.resolve(e), c);
199
+ const h = Ee(e.doc.resolve(t), c);
196
200
  if (h)
197
- return t.doc.textBetween(h.from, h.to, " ");
201
+ return e.doc.textBetween(h.from, h.to, " ");
198
202
  }
199
203
  return "";
200
204
  },
201
205
  // ── Character count ───────────────────────────────────────────────
202
206
  getCharacterCount: () => ({
203
207
  count: n?.storage.characterCount?.characters?.() ?? n?.getText().length ?? 0,
204
- limit: I ?? null
208
+ limit: J ?? null
205
209
  }),
206
210
  // ── Sections ─────────────────────────────────────────────────────
207
- getSectionContent: (t) => n ? zt(n, t) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
208
- setSectionContent: (t, e) => {
209
- const o = s(e);
210
- i((r) => T(r, t, o));
211
+ getSectionContent: (e) => n ? Ne(n, e) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
212
+ setSectionContent: (e, t) => {
213
+ const o = i(t);
214
+ s((r) => I(r, e, o));
211
215
  },
212
- focusSection: (t) => {
213
- i((e) => {
214
- if (t === "body") {
215
- let r = e.state.doc.content.size - 1;
216
- e.state.doc.descendants((c, h) => (c.type.name === "sectionDivider" && r === e.state.doc.content.size - 1 && (r = h - 1), r === e.state.doc.content.size - 1)), r < 1 && (r = 1), e.chain().focus().setTextSelection(r).run();
216
+ focusSection: (e) => {
217
+ s((t) => {
218
+ if (e === "body") {
219
+ let r = t.state.doc.content.size - 1;
220
+ t.state.doc.descendants((c, h) => (c.type.name === "sectionDivider" && r === t.state.doc.content.size - 1 && (r = h - 1), r === t.state.doc.content.size - 1)), r < 1 && (r = 1), t.chain().focus().setTextSelection(r).run();
217
221
  return;
218
222
  }
219
223
  let o = -1;
220
- e.state.doc.descendants((r, c) => {
224
+ t.state.doc.descendants((r, c) => {
221
225
  if (o !== -1) return !1;
222
- r.type.name === "sectionDivider" && r.attrs.sectionId === t && (o = c + r.nodeSize + 1);
223
- }), o !== -1 && e.chain().focus().setTextSelection(o).run();
226
+ r.type.name === "sectionDivider" && r.attrs.sectionId === e && (o = c + r.nodeSize + 1);
227
+ }), o !== -1 && t.chain().focus().setTextSelection(o).run();
224
228
  });
225
229
  },
226
- clearSection: (t) => {
227
- i((e) => T(e, t, "<p></p>"));
230
+ clearSection: (e) => {
231
+ s((t) => I(t, e, "<p></p>"));
228
232
  },
229
233
  // ── Convenience body shorthands ───────────────────────────────────
230
- getBodyContent: () => n ? Ft(n) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
231
- setBodyContent: (t) => {
232
- const e = s(t);
233
- i((o) => T(o, "body", e));
234
+ getBodyContent: () => n ? ze(n) : { html: "", text: "", isEmpty: !0, characterCount: 0 },
235
+ setBodyContent: (e) => {
236
+ const t = i(e);
237
+ s((o) => I(o, "body", t));
234
238
  },
235
- setBodyAndSections: (t, e) => {
236
- const o = et(
237
- s(t),
238
- e.map((r) => ({
239
+ setBodyAndSections: (e, t) => {
240
+ const o = oe(
241
+ i(e),
242
+ t.map((r) => ({
239
243
  id: r.id,
240
- content: s(r.content)
244
+ content: i(r.content)
241
245
  }))
242
246
  );
243
- i((r) => r.commands.setContent(o, { emitUpdate: !0 }));
247
+ s((r) => r.commands.setContent(o, { emitUpdate: !0 }));
244
248
  },
245
- appendBodyContent: (t) => {
246
- const e = s(t);
247
- i((o) => {
248
- const r = rt(o, "body");
249
- o.commands.insertContentAt(r - 1, e, {
249
+ appendBodyContent: (e) => {
250
+ const t = i(e);
251
+ s((o) => {
252
+ const r = ie(o, "body");
253
+ o.commands.insertContentAt(r - 1, t, {
250
254
  parseOptions: { preserveWhitespace: !0 }
251
255
  });
252
256
  });
253
257
  },
254
- insertAtSectionStart: (t, e) => {
255
- const o = s(e);
256
- i((r) => {
257
- const c = Nt(r, t);
258
+ insertAtSectionStart: (e, t) => {
259
+ const o = i(t);
260
+ s((r) => {
261
+ const c = He(r, e);
258
262
  c !== -1 && r.commands.insertContentAt(c, o, {
259
263
  parseOptions: { preserveWhitespace: !0 }
260
264
  });
261
265
  });
262
266
  },
263
- insertAtSectionEnd: (t, e) => {
264
- const o = s(e);
265
- i((r) => {
266
- const c = rt(r, t);
267
+ insertAtSectionEnd: (e, t) => {
268
+ const o = i(t);
269
+ s((r) => {
270
+ const c = ie(r, e);
267
271
  r.commands.insertContentAt(c, o, {
268
272
  parseOptions: { preserveWhitespace: !0 }
269
273
  });
270
274
  });
271
275
  },
272
276
  // ── Formats & actions ─────────────────────────────────────────────
273
- getActiveFormats: () => n ? nt(n) : tt,
277
+ getActiveFormats: () => n ? re(n) : ne,
274
278
  actions: {
275
279
  toggleBold: () => n?.chain().focus().toggleBold().run(),
276
280
  toggleItalic: () => n?.chain().focus().toggleItalic().run(),
@@ -280,104 +284,113 @@ const Wt = (k, v) => {
280
284
  toggleOrderedList: () => n?.chain().focus().toggleOrderedList().run(),
281
285
  toggleBlockquote: () => n?.chain().focus().toggleBlockquote().run(),
282
286
  toggleCodeBlock: () => n?.chain().focus().toggleCodeBlock().run(),
283
- setTextAlign: (t) => n?.chain().focus().setTextAlign(t).run(),
284
- setFontFamily: (t) => n?.chain().focus().setFontFamily(t).run(),
285
- setFontSize: (t) => n?.chain().focus().setFontSize(t).run(),
286
- setColor: (t) => n?.chain().focus().setColor(t).run(),
287
- setHighlight: (t) => n?.chain().focus().toggleHighlight({ color: t }).run(),
287
+ setTextAlign: (e) => n?.chain().focus().setTextAlign(e).run(),
288
+ setFontFamily: (e) => n?.chain().focus().setFontFamily(e).run(),
289
+ setFontSize: (e) => n?.chain().focus().setFontSize(e).run(),
290
+ setColor: (e) => n?.chain().focus().setColor(e).run(),
291
+ setHighlight: (e) => n?.chain().focus().toggleHighlight({ color: e }).run(),
288
292
  unsetColor: () => n?.chain().focus().unsetColor().run(),
289
293
  unsetHighlight: () => n?.chain().focus().unsetHighlight().run(),
290
- setLink: (t, e) => {
291
- n && (e !== void 0 ? n.chain().focus().extendMarkRange("link").command(({ tr: o, state: r }) => {
292
- const { from: c, to: h } = o.selection, K = r.schema.marks.link;
293
- if (!K) return !1;
294
- const Bt = r.schema.text(e, [
295
- K.create({ href: t })
296
- ]), xt = r.schema.text(" ");
297
- return o.replaceWith(c, h, [Bt, xt]), !0;
298
- }).run() : n.chain().focus().extendMarkRange("link").setLink({ href: t }).insertContent(" ").run());
294
+ setLink: (e, t) => {
295
+ n && (t !== void 0 ? n.chain().focus().extendMarkRange("link").command(({ tr: o, state: r }) => {
296
+ const { from: c, to: h } = o.selection, Y = r.schema.marks.link;
297
+ if (!Y) return !1;
298
+ const be = r.schema.text(t, [
299
+ Y.create({ href: e })
300
+ ]), ve = r.schema.text(" ");
301
+ return o.replaceWith(c, h, [be, ve]), !0;
302
+ }).run() : n.chain().focus().extendMarkRange("link").setLink({ href: e }).insertContent(" ").run());
299
303
  },
300
- updateLink: (t) => n?.chain().focus().extendMarkRange("link").setLink({ href: t }).run(),
304
+ updateLink: (e) => n?.chain().focus().extendMarkRange("link").setLink({ href: e }).run(),
301
305
  removeLink: () => n?.chain().focus().extendMarkRange("link").unsetLink().run(),
302
- insertEmoji: (t) => n?.chain().focus().insertContent(t).run(),
303
- insertVariable: (t) => n?.chain().focus().insertContent(`{{${t}}}`).run(),
304
- insertHtml: (t) => n?.commands.insertContent(s(t)),
306
+ insertEmoji: (e) => n?.chain().focus().insertContent(e).run(),
307
+ insertVariable: (e) => n?.chain().focus().insertContent(`{{${e}}}`).run(),
308
+ insertHtml: (e) => n?.commands.insertContent(i(e)),
305
309
  undo: () => n?.chain().focus().undo().run(),
306
310
  redo: () => n?.chain().focus().redo().run(),
307
311
  canUndo: () => n?.can().undo() ?? !1,
308
312
  canRedo: () => n?.can().redo() ?? !1,
309
313
  toggleSuperscript: () => n?.chain().focus().toggleSuperscript().run(),
310
314
  toggleSubscript: () => n?.chain().focus().toggleSubscript().run(),
311
- insertImage: (t) => n?.chain().focus().setImage({ src: t }).run()
315
+ insertImage: (e) => n?.chain().focus().setImage({ src: e }).run()
312
316
  },
313
317
  // ── JSON body ─────────────────────────────────────────────────────
314
318
  json: B?.jsonMode ? {
315
319
  getText: () => n ? g(n) : "",
316
- setText: (t) => i((e) => x(e, t)),
320
+ setText: (e) => s((t) => b(t, e)),
317
321
  parse: () => p(n ? g(n) : ""),
318
322
  isValid: () => p(n ? g(n) : "").valid,
319
- format: (t = 2) => i((e) => {
320
- const { valid: o, value: r } = p(g(e));
321
- !o || r === null || x(e, JSON.stringify(r, null, t));
323
+ format: (e = 2) => s((t) => {
324
+ const { valid: o, value: r } = p(g(t));
325
+ !o || r === null || b(t, JSON.stringify(r, null, e));
322
326
  }),
323
- minify: () => i((t) => {
324
- const { valid: e, value: o } = p(g(t));
325
- !e || o === null || x(t, JSON.stringify(o));
327
+ minify: () => s((e) => {
328
+ const { valid: t, value: o } = p(g(e));
329
+ !t || o === null || b(e, JSON.stringify(o));
326
330
  })
327
331
  } : void 0
328
332
  }),
329
333
  // eslint-disable-next-line react-hooks/exhaustive-deps
330
334
  [n]
331
335
  );
332
- const kt = () => {
336
+ const Be = () => {
333
337
  if (!n) return;
334
- const { valid: t, value: e } = p(g(n));
335
- !t || e === null || x(n, JSON.stringify(e, null, 2));
336
- }, yt = () => {
337
- n && (navigator.clipboard?.writeText(g(n)), H(!0), setTimeout(() => H(!1), 1500));
338
+ const { valid: e, value: t } = p(g(n));
339
+ !e || t === null || b(n, JSON.stringify(t, null, 2));
340
+ }, xe = () => {
341
+ n && (navigator.clipboard?.writeText(g(n)), w(!0), setTimeout(() => w(!1), 1500));
338
342
  };
339
343
  return n ? /* @__PURE__ */ u(
340
- It,
344
+ Re,
341
345
  {
342
- minHeight: mt,
343
- maxHeight: ft,
346
+ minHeight: ge,
347
+ maxHeight: he,
344
348
  tightParagraphs: !B?.richPaste,
345
349
  jsonMode: m,
346
- style: gt,
347
- className: ht,
350
+ style: pe,
351
+ className: Ce,
348
352
  children: [
349
- m && /* @__PURE__ */ u(Rt, { children: [
353
+ m && /* @__PURE__ */ u(Le, { children: [
350
354
  /* @__PURE__ */ d("span", { className: "bik-json-header-label", children: "JSON" }),
351
355
  /* @__PURE__ */ u("div", { className: "bik-json-header-actions", children: [
352
356
  /* @__PURE__ */ u(
353
357
  "button",
354
358
  {
355
359
  type: "button",
356
- onClick: kt,
357
- disabled: !!f,
360
+ onClick: Be,
361
+ disabled: !!f || A,
358
362
  title: "Format JSON",
359
363
  children: [
360
- /* @__PURE__ */ d(Pt, { size: 16 }),
361
- /* @__PURE__ */ d(Y, { children: "Beautify" })
364
+ /* @__PURE__ */ d(qe, { size: 16 }),
365
+ /* @__PURE__ */ d(te, { children: "Beautify" })
362
366
  ]
363
367
  }
364
368
  ),
365
- /* @__PURE__ */ u("button", { type: "button", onClick: yt, title: "Copy JSON", children: [
366
- /* @__PURE__ */ d(Dt, { size: 16 }),
367
- pt && /* @__PURE__ */ d(Y, { children: "Copied" })
368
- ] })
369
+ /* @__PURE__ */ u(
370
+ "button",
371
+ {
372
+ type: "button",
373
+ onClick: xe,
374
+ disabled: A,
375
+ title: "Copy JSON",
376
+ children: [
377
+ /* @__PURE__ */ d(Ue, { size: 16 }),
378
+ Se && /* @__PURE__ */ d(te, { children: "Copied" })
379
+ ]
380
+ }
381
+ )
369
382
  ] })
370
383
  ] }),
371
- m ? /* @__PURE__ */ u(Jt, { $error: !!f, children: [
372
- /* @__PURE__ */ d(X, { editor: n }),
373
- Ct && /* @__PURE__ */ u(Lt, { "aria-hidden": !0, children: [
374
- /* @__PURE__ */ d(qt, { size: 20 }),
384
+ m ? /* @__PURE__ */ u(Me, { $error: !!f, children: [
385
+ /* @__PURE__ */ d(ee, { editor: n }),
386
+ A && !ke && /* @__PURE__ */ u(Oe, { "aria-hidden": !0, children: [
387
+ /* @__PURE__ */ d($e, { size: 20 }),
375
388
  /* @__PURE__ */ d("span", { children: k.placeholder ?? "Type or paste JSON here" })
376
389
  ] })
377
- ] }) : /* @__PURE__ */ d(X, { editor: n }),
378
- /* @__PURE__ */ d(wt, { editor: n, renderLinkTooltip: dt?.renderTooltip }),
379
- m && f ? N ? N(f) : /* @__PURE__ */ u(Mt, { children: [
380
- /* @__PURE__ */ d(Ut, { size: 16 }),
390
+ ] }) : /* @__PURE__ */ d(ee, { editor: n }),
391
+ /* @__PURE__ */ d(De, { editor: n, renderLinkTooltip: me?.renderTooltip }),
392
+ m && f ? N ? N(f) : /* @__PURE__ */ u(Fe, { children: [
393
+ /* @__PURE__ */ d(We, { size: 16 }),
381
394
  /* @__PURE__ */ u("span", { children: [
382
395
  f.line != null && /* @__PURE__ */ u("strong", { children: [
383
396
  "Line ",
@@ -392,11 +405,11 @@ const Wt = (k, v) => {
392
405
  ]
393
406
  }
394
407
  ) : null;
395
- }, Vt = Et(
396
- Wt
408
+ }, Qe = Te(
409
+ _e
397
410
  );
398
- Vt.displayName = "BikEditor";
411
+ Qe.displayName = "BikEditor";
399
412
  export {
400
- Vt as BikEditor
413
+ Qe as BikEditor
401
414
  };
402
415
  //# sourceMappingURL=BikEditor.js.map