@dotit/editor 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,23 +1,23 @@
1
- import { jsxs as h, jsx as i, Fragment as he } from "react/jsx-runtime";
2
- import { useState as B, useRef as P, useEffect as j, useCallback as R, useMemo as K, useLayoutEffect as be } from "react";
1
+ import { jsxs as b, jsx as a, Fragment as me } from "react/jsx-runtime";
2
+ import { useState as P, useRef as B, useEffect as j, useCallback as R, useMemo as Y, useLayoutEffect as be } from "react";
3
3
  import { useEditor as ye, EditorContent as ke } from "@tiptap/react";
4
4
  import Se from "@tiptap/starter-kit";
5
5
  import we from "@tiptap/extension-placeholder";
6
6
  import ve from "@tiptap/extension-underline";
7
7
  import { TextStyle as Te } from "@tiptap/extension-text-style";
8
8
  import xe from "@tiptap/extension-color";
9
- import Ae from "@tiptap/extension-highlight";
10
- import Ce from "@tiptap/extension-text-align";
11
- import Le from "@tiptap/extension-font-family";
12
- import $e from "@tiptap/extension-subscript";
13
- import Ne from "@tiptap/extension-superscript";
14
- import { Extension as vt, Node as E, mergeAttributes as z } from "@tiptap/core";
9
+ import Le from "@tiptap/extension-highlight";
10
+ import Ae from "@tiptap/extension-text-align";
11
+ import Ce from "@tiptap/extension-font-family";
12
+ import Ne from "@tiptap/extension-subscript";
13
+ import $e from "@tiptap/extension-superscript";
14
+ import { Extension as vt, Node as E, mergeAttributes as _ } from "@tiptap/core";
15
15
  import { Plugin as Xt, PluginKey as te } from "@tiptap/pm/state";
16
- import { DecorationSet as St, Decoration as $t } from "@tiptap/pm/view";
17
- import { parseIntentText as tt, listBuiltinThemes as ze, renderPrint as Me, cssContentValue as _e, LANGUAGE_REGISTRY as He, getBuiltinTheme as Re, generateThemeCSS as Ee, verifyDocument as Be, documentStyleCSS as Pe } from "@dotit/core";
16
+ import { DecorationSet as St, Decoration as Nt } from "@tiptap/pm/view";
17
+ import { parseIntentText as et, listBuiltinThemes as Me, renderPrint as ze, cssContentValue as _e, LANGUAGE_REGISTRY as He, getBuiltinTheme as Re, generateThemeCSS as Ee, verifyDocument as Pe, documentStyleCSS as Be } from "@dotit/core";
18
18
  import Ie from "@tiptap/extension-paragraph";
19
- import { Undo2 as Oe, Redo2 as De, Printer as Fe, FileCode2 as je, Droplets as We, ChevronDown as yt, Minus as Ge, Plus as Pt, Bold as Ue, Italic as Ye, Underline as Ke, Strikethrough as qe, Palette as Je, RemoveFormatting as It, Highlighter as Ve, Subscript as Qe, Superscript as Ze, Code as Xe, AlignLeft as tn, AlignCenter as en, AlignRight as nn, AlignJustify as rn, Rows3 as on, List as sn, ListOrdered as an, AlignHorizontalSpaceBetween as Ot, FileLock2 as cn, PenTool as ln, ShieldCheck as dn } from "lucide-react";
20
- const un = vt.create({
19
+ import { Undo2 as Oe, Redo2 as De, Printer as Fe, FileCode2 as je, Droplets as We, ChevronDown as yt, Minus as Ge, Plus as Bt, Bold as Ue, Italic as Ye, Underline as Ke, Strikethrough as qe, Palette as Je, RemoveFormatting as It, Highlighter as Ve, Code as Qe, AlignLeft as Ze, AlignCenter as Xe, AlignRight as tn, AlignJustify as en, Rows3 as nn, List as rn, ListOrdered as on, AlignHorizontalSpaceBetween as Ot, FileLock2 as sn, PenTool as an, ShieldCheck as cn } from "lucide-react";
20
+ const ln = vt.create({
21
21
  name: "fontSize",
22
22
  addOptions() {
23
23
  return { types: ["textStyle"] };
@@ -42,23 +42,30 @@ const un = vt.create({
42
42
  unsetFontSize: () => ({ chain: t }) => t().setMark("textStyle", { fontSize: null }).removeEmptyTextStyle().run()
43
43
  };
44
44
  }
45
- }), X = 96 / 25.4, kt = {
45
+ }), tt = 96 / 25.4, kt = {
46
46
  A4: [210, 297],
47
47
  A5: [148, 210],
48
48
  A3: [297, 420],
49
49
  Letter: [215.9, 279.4],
50
50
  Legal: [215.9, 355.6],
51
51
  Tabloid: [279.4, 431.8]
52
- }, pn = 20, fn = 4, gn = 120;
53
- function Nt(t) {
52
+ }, dn = {
53
+ A4: "cm",
54
+ A5: "cm",
55
+ A3: "cm",
56
+ LETTER: "in",
57
+ LEGAL: "in",
58
+ TABLOID: "in"
59
+ }, un = 20, pn = 4, fn = 120;
60
+ function $t(t) {
54
61
  const e = /^(-?\d+(?:\.\d+)?)\s*(mm|cm|in|px|pt)?$/.exec(t.trim());
55
62
  if (!e) return null;
56
63
  const n = parseFloat(e[1]);
57
64
  switch (e[2] || "mm") {
58
65
  case "mm":
59
- return n * X;
66
+ return n * tt;
60
67
  case "cm":
61
- return n * 10 * X;
68
+ return n * 10 * tt;
62
69
  case "in":
63
70
  return n * 96;
64
71
  case "pt":
@@ -69,45 +76,46 @@ function Nt(t) {
69
76
  return null;
70
77
  }
71
78
  }
72
- function mn(t, e) {
73
- const n = t.trim().split(/\s+/).map(Nt);
79
+ function gn(t, e) {
80
+ const n = t.trim().split(/\s+/).map($t);
74
81
  if (n.some((o) => o === null) || n.length === 0)
75
82
  return [e, e, e, e];
76
83
  const r = n;
77
84
  return r.length === 1 ? [r[0], r[0], r[0], r[0]] : r.length === 2 ? [r[0], r[1], r[0], r[1]] : r.length === 3 ? [r[0], r[1], r[2], r[1]] : [r[0], r[1], r[2], r[3]];
78
85
  }
79
- function zt(t) {
86
+ function Mt(t) {
80
87
  let e = "A4", n, r = "", o = "";
81
88
  try {
82
- const T = tt(t), S = T.blocks.find((v) => v.type === "page")?.properties || {};
83
- S.size && (e = String(S.size)), n = S.margin ?? S.margins, r = T.blocks.find((v) => v.type === "header")?.content || String(S.header || ""), o = T.blocks.find((v) => v.type === "footer")?.content || String(S.footer || "");
89
+ const C = et(t), w = C.blocks.find((I) => I.type === "page")?.properties || {};
90
+ w.size && (e = String(w.size)), n = w.margin ?? w.margins, r = C.blocks.find((I) => I.type === "header")?.content || String(w.header || ""), o = C.blocks.find((I) => I.type === "footer")?.content || String(w.footer || "");
84
91
  } catch {
85
92
  }
86
- let l = kt.A4[0] * X, a = kt.A4[1] * X, u = !1;
87
- const c = kt[e] || kt[e.toUpperCase?.()];
88
- if (c)
89
- l = c[0] * X, a = c[1] * X;
93
+ let l = kt.A4[0] * tt, c = kt.A4[1] * tt, d = !1, s = "cm";
94
+ const f = kt[e] || kt[e.toUpperCase?.()];
95
+ if (f)
96
+ l = f[0] * tt, c = f[1] * tt, s = dn[e.toUpperCase()] || "cm";
90
97
  else {
91
- const T = e.trim().split(/\s+/), M = T[0] ? Nt(T[0]) : null;
92
- if (M && (l = M), T[1] === "auto")
93
- u = !0, a = 1 / 0;
98
+ const C = e.trim().split(/\s+/), v = C[0] ? $t(C[0]) : null;
99
+ if (v && (l = v), /(\d)\s*in\b/.test(e) && (s = "in"), C[1] === "auto")
100
+ d = !0, c = 1 / 0;
94
101
  else {
95
- const S = T[1] ? Nt(T[1]) : null;
96
- S && (a = S);
102
+ const w = C[1] ? $t(C[1]) : null;
103
+ w && (c = w);
97
104
  }
98
105
  }
99
- const g = (l <= gn * X ? fn : pn) * X, [p, b, f, k] = n ? mn(n, g) : [g, g, g, g];
106
+ const p = (l <= fn * tt ? pn : un) * tt, [h, g, k, M] = n ? gn(n, p) : [p, p, p, p];
100
107
  return {
101
108
  width: l,
102
- height: a,
103
- autoHeight: u,
104
- marginTop: p,
105
- marginRight: b,
106
- marginBottom: f,
107
- marginLeft: k,
108
- contentHeight: u ? 1 / 0 : a - p - f,
109
+ height: c,
110
+ autoHeight: d,
111
+ marginTop: h,
112
+ marginRight: g,
113
+ marginBottom: k,
114
+ marginLeft: M,
115
+ contentHeight: d ? 1 / 0 : c - h - k,
109
116
  header: r,
110
- footer: o
117
+ footer: o,
118
+ unit: s
111
119
  };
112
120
  }
113
121
  function ee(t, e, n) {
@@ -123,7 +131,7 @@ function xt(t, e, n, r) {
123
131
  function hn(t) {
124
132
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
125
133
  }
126
- const bn = vt.create({
134
+ const mn = vt.create({
127
135
  name: "pagination",
128
136
  addOptions() {
129
137
  return {
@@ -162,96 +170,96 @@ const bn = vt.create({
162
170
  },
163
171
  view(e) {
164
172
  let n = 0, r = "";
165
- const o = (c, g, p, b) => {
166
- const f = document.createElement("div");
167
- return f.className = "docs-page-spacer", f.contentEditable = "false", f.setAttribute("data-it-spacer", ""), f.style.setProperty("--pb-mx-l", `${c.marginLeft}px`), f.style.setProperty("--pb-mx-r", `${c.marginRight}px`), f.innerHTML = `
168
- <div class="docs-pb-fill" style="height:${g}px"></div>
169
- <div class="docs-pb-margin docs-pb-margin-bottom" style="height:${c.marginBottom}px">
170
- ${xt("footer", c.footer, p, b)}
173
+ const o = (s, f, p, h) => {
174
+ const g = document.createElement("div");
175
+ return g.className = "docs-page-spacer", g.contentEditable = "false", g.setAttribute("data-it-spacer", ""), g.style.setProperty("--pb-mx-l", `${s.marginLeft}px`), g.style.setProperty("--pb-mx-r", `${s.marginRight}px`), g.innerHTML = `
176
+ <div class="docs-pb-fill" style="height:${f}px"></div>
177
+ <div class="docs-pb-margin docs-pb-margin-bottom" style="height:${s.marginBottom}px">
178
+ ${xt("footer", s.footer, p, h)}
171
179
  </div>
172
180
  <div class="docs-pb-gap" style="height:${t.gap}px"></div>
173
- <div class="docs-pb-margin docs-pb-margin-top" style="height:${c.marginTop}px">
174
- ${xt("header", c.header, p + 1, b)}
175
- </div>`, f;
176
- }, l = (c, g, p, b) => {
177
- const f = document.createElement("div");
178
- return f.className = "docs-page-spacer docs-page-tail", f.contentEditable = "false", f.setAttribute("data-it-spacer", ""), f.style.setProperty("--pb-mx-l", `${c.marginLeft}px`), f.style.setProperty("--pb-mx-r", `${c.marginRight}px`), f.innerHTML = `
179
- <div class="docs-pb-fill" style="height:${g}px"></div>
180
- <div class="docs-pb-margin docs-pb-margin-bottom" style="height:${c.marginBottom}px">
181
- ${xt("footer", c.footer, p, b)}
182
- </div>`, f;
183
- }, a = () => {
184
- const c = t.geometry(), g = e.dom, p = e.state.doc;
185
- if (c.autoHeight) {
181
+ <div class="docs-pb-margin docs-pb-margin-top" style="height:${s.marginTop}px">
182
+ ${xt("header", s.header, p + 1, h)}
183
+ </div>`, g;
184
+ }, l = (s, f, p, h) => {
185
+ const g = document.createElement("div");
186
+ return g.className = "docs-page-spacer docs-page-tail", g.contentEditable = "false", g.setAttribute("data-it-spacer", ""), g.style.setProperty("--pb-mx-l", `${s.marginLeft}px`), g.style.setProperty("--pb-mx-r", `${s.marginRight}px`), g.innerHTML = `
187
+ <div class="docs-pb-fill" style="height:${f}px"></div>
188
+ <div class="docs-pb-margin docs-pb-margin-bottom" style="height:${s.marginBottom}px">
189
+ ${xt("footer", s.footer, p, h)}
190
+ </div>`, g;
191
+ }, c = () => {
192
+ const s = t.geometry(), f = e.dom, p = e.state.doc;
193
+ if (s.autoHeight) {
186
194
  r !== "auto" && (r = "auto", e.dispatch(
187
195
  e.state.tr.setMeta(ft, St.empty)
188
196
  ), t.onPages?.(1));
189
197
  return;
190
198
  }
191
- const b = g.getBoundingClientRect().top, f = Array.from(g.children), k = [];
192
- let T = 0;
193
- for (const N of f) {
199
+ const h = f.getBoundingClientRect().top, g = Array.from(f.children), k = [];
200
+ let M = 0;
201
+ for (const N of g) {
194
202
  if (N.hasAttribute?.("data-it-spacer")) {
195
- T += N.offsetHeight;
203
+ M += N.offsetHeight;
196
204
  continue;
197
205
  }
198
206
  const H = N.getBoundingClientRect();
199
207
  k.push({
200
- natTop: H.top - b - T,
201
- natBottom: H.bottom - b - T
208
+ natTop: H.top - h - M,
209
+ natBottom: H.bottom - h - M
202
210
  });
203
211
  }
204
- const M = [];
205
- let S = 0, v = k.length ? k[0].natTop : 0, nt = v;
212
+ const C = [];
213
+ let v = 0, w = k.length ? k[0].natTop : 0, I = w;
206
214
  for (let N = 0; N < k.length && N < p.childCount; N++) {
207
215
  const H = k[N], ot = p.child(N).nodeSize;
208
- H.natTop > v && // never break before the page's first block
209
- H.natBottom - v > c.contentHeight && (M.push({
210
- pos: S,
211
- rest: Math.max(0, c.contentHeight - (H.natTop - v))
212
- }), v = H.natTop), nt = H.natBottom, S += ot;
216
+ H.natTop > w && // never break before the page's first block
217
+ H.natBottom - w > s.contentHeight && (C.push({
218
+ pos: v,
219
+ rest: Math.max(0, s.contentHeight - (H.natTop - w))
220
+ }), w = H.natTop), I = H.natBottom, v += ot;
213
221
  }
214
- const I = M.length + 1, G = Math.max(
222
+ const O = C.length + 1, K = Math.max(
215
223
  0,
216
- c.contentHeight - (nt - v)
217
- ), U = M.map((N) => `${N.pos}:${Math.round(N.rest)}`).join(",") + `|${Math.round(G)}|${I}|${c.header}|${c.footer}|${Math.round(c.contentHeight)}`;
218
- if (U === r) return;
219
- r = U;
220
- const F = M.map(
221
- (N, H) => $t.widget(
224
+ s.contentHeight - (I - w)
225
+ ), q = C.map((N) => `${N.pos}:${Math.round(N.rest)}`).join(",") + `|${Math.round(K)}|${O}|${s.header}|${s.footer}|${Math.round(s.contentHeight)}`;
226
+ if (q === r) return;
227
+ r = q;
228
+ const W = C.map(
229
+ (N, H) => Nt.widget(
222
230
  N.pos,
223
- () => o(c, N.rest, H + 1, I),
231
+ () => o(s, N.rest, H + 1, O),
224
232
  { side: -1, key: `pb-${H + 1}-${Math.round(N.rest)}` }
225
233
  )
226
234
  );
227
- F.push(
228
- $t.widget(
235
+ W.push(
236
+ Nt.widget(
229
237
  p.content.size,
230
- () => l(c, G, I, I),
231
- { side: 1, key: `pb-tail-${I}-${Math.round(G)}` }
238
+ () => l(s, K, O, O),
239
+ { side: 1, key: `pb-tail-${O}-${Math.round(K)}` }
232
240
  )
233
241
  );
234
- const rt = St.create(e.state.doc, F);
235
- e.dispatch(e.state.tr.setMeta(ft, rt)), t.onPages?.(I);
236
- }, u = () => {
237
- cancelAnimationFrame(n), n = requestAnimationFrame(a);
242
+ const rt = St.create(e.state.doc, W);
243
+ e.dispatch(e.state.tr.setMeta(ft, rt)), t.onPages?.(O);
244
+ }, d = () => {
245
+ cancelAnimationFrame(n), n = requestAnimationFrame(c);
238
246
  };
239
- return u(), {
240
- update: u,
247
+ return d(), {
248
+ update: d,
241
249
  destroy: () => cancelAnimationFrame(n)
242
250
  };
243
251
  }
244
252
  })
245
253
  ];
246
254
  }
247
- }), Dt = /* @__PURE__ */ new Set(["tip", "info", "warning", "danger", "success"]), yn = /* @__PURE__ */ new Set([
255
+ }), Dt = /* @__PURE__ */ new Set(["tip", "info", "warning", "danger", "success"]), bn = /* @__PURE__ */ new Set([
248
256
  "page",
249
257
  "meta",
250
258
  "font",
251
259
  "header",
252
260
  "footer",
253
261
  "watermark"
254
- ]), kn = /* @__PURE__ */ new Set([
262
+ ]), yn = /* @__PURE__ */ new Set([
255
263
  "sign",
256
264
  "seal",
257
265
  "approve",
@@ -262,10 +270,10 @@ const bn = vt.create({
262
270
  title: "itTitle",
263
271
  section: "itSection",
264
272
  sub: "itSub"
265
- }, Sn = {
273
+ }, kn = {
266
274
  note: "text",
267
275
  "body-text": "text"
268
- }, wn = /* @__PURE__ */ new Set([
276
+ }, Sn = /* @__PURE__ */ new Set([
269
277
  "weight",
270
278
  "italic",
271
279
  "underline",
@@ -281,7 +289,7 @@ const bn = vt.create({
281
289
  "font",
282
290
  "bgcolor"
283
291
  ]);
284
- function vn(t) {
292
+ function wn(t) {
285
293
  if (!t || t === "{}") return {};
286
294
  try {
287
295
  return typeof t == "string" ? JSON.parse(t) : t || {};
@@ -289,20 +297,20 @@ function vn(t) {
289
297
  return {};
290
298
  }
291
299
  }
292
- function D(t, e) {
300
+ function F(t, e) {
293
301
  const n = Object.entries(t).filter(
294
302
  ([r, o]) => o !== void 0 && o !== "" && (!e || !e.has(r))
295
303
  );
296
304
  return n.length === 0 ? "" : " | " + n.map(([r, o]) => `${r}: ${o}`).join(" | ");
297
305
  }
298
- function Mt(t) {
306
+ function zt(t) {
299
307
  if (!t) return [];
300
308
  const e = t.split("\\n"), n = [];
301
309
  return e.forEach((r, o) => {
302
310
  r && n.push({ type: "text", text: r }), o < e.length - 1 && n.push({ type: "hardBreak" });
303
311
  }), n;
304
312
  }
305
- function Tn(t) {
313
+ function vn(t) {
306
314
  switch (t.type) {
307
315
  case "bold":
308
316
  return [{ type: "bold" }];
@@ -322,7 +330,7 @@ function Tn(t) {
322
330
  return null;
323
331
  }
324
332
  }
325
- const xn = /* @__PURE__ */ new Set([
333
+ const Tn = /* @__PURE__ */ new Set([
326
334
  "text",
327
335
  "bold",
328
336
  "italic",
@@ -330,23 +338,23 @@ const xn = /* @__PURE__ */ new Set([
330
338
  "highlight",
331
339
  "styled"
332
340
  ]);
333
- function An(t, e) {
334
- if (!t || t.length === 0 || t.every((r) => r.type === "text") || !t.every((r) => xn.has(r.type)))
335
- return Mt(e);
341
+ function xn(t, e) {
342
+ if (!t || t.length === 0 || t.every((r) => r.type === "text") || !t.every((r) => Tn.has(r.type)))
343
+ return zt(e);
336
344
  const n = [];
337
345
  for (const r of t) {
338
- const o = Tn(r), a = (r.value ?? "").split("\\n");
339
- a.forEach((u, c) => {
340
- u && n.push(o ? { type: "text", text: u, marks: o } : { type: "text", text: u }), c < a.length - 1 && n.push({ type: "hardBreak" });
346
+ const o = vn(r), c = (r.value ?? "").split("\\n");
347
+ c.forEach((d, s) => {
348
+ d && n.push(o ? { type: "text", text: d, marks: o } : { type: "text", text: d }), s < c.length - 1 && n.push({ type: "hardBreak" });
341
349
  });
342
350
  }
343
- return n.length ? n : Mt(e);
351
+ return n.length ? n : zt(e);
344
352
  }
345
- function Cn(t, e) {
353
+ function Ln(t, e) {
346
354
  if (!e || t.length === 0) return t;
347
- const n = [], r = {}, o = e, l = o.family ?? o.font, a = o.bg ?? o.bgcolor;
348
- return String(o.weight || "").toLowerCase() === "bold" && n.push({ type: "bold" }), (String(o.italic || "") === "true" || String(o.style || "").toLowerCase() === "italic") && n.push({ type: "italic" }), String(o.underline || "") === "true" && n.push({ type: "underline" }), String(o.strike || "") === "true" && n.push({ type: "strike" }), String(o.valign || "") === "sub" && n.push({ type: "subscript" }), String(o.valign || "") === "super" && n.push({ type: "superscript" }), o.color && (r.color = String(o.color)), l && (r.fontFamily = String(l)), o.size && (r.fontSize = String(o.size)), a && n.push({ type: "highlight", attrs: { color: String(a) } }), Object.keys(r).length > 0 && n.push({ type: "textStyle", attrs: r }), n.length === 0 ? t : t.map(
349
- (u) => u.type === "text" ? { ...u, marks: [...u.marks || [], ...n] } : u
355
+ const n = [], r = {}, o = e, l = o.family ?? o.font, c = o.bg ?? o.bgcolor;
356
+ return String(o.weight || "").toLowerCase() === "bold" && n.push({ type: "bold" }), (String(o.italic || "") === "true" || String(o.style || "").toLowerCase() === "italic") && n.push({ type: "italic" }), String(o.underline || "") === "true" && n.push({ type: "underline" }), String(o.strike || "") === "true" && n.push({ type: "strike" }), String(o.valign || "") === "sub" && n.push({ type: "subscript" }), String(o.valign || "") === "super" && n.push({ type: "superscript" }), o.color && (r.color = String(o.color)), l && (r.fontFamily = String(l)), o.size && (r.fontSize = String(o.size)), c && n.push({ type: "highlight", attrs: { color: String(c) } }), Object.keys(r).length > 0 && n.push({ type: "textStyle", attrs: r }), n.length === 0 ? t : t.map(
357
+ (d) => d.type === "text" ? { ...d, marks: [...d.marks || [], ...n] } : d
350
358
  );
351
359
  }
352
360
  function ne(t) {
@@ -380,30 +388,30 @@ function ne(t) {
380
388
  }
381
389
  return e;
382
390
  }
383
- function Ln(t) {
391
+ function An(t) {
384
392
  if (t.type === "hardBreak") return "\\n";
385
393
  if (t.type !== "text") return Ht(t);
386
394
  const e = t.text || "";
387
395
  if (!e) return "";
388
396
  const n = t.marks || [];
389
397
  if (!n.length) return e;
390
- const r = new Set(n.map((b) => b.type)), o = n.find((b) => b.type === "link");
398
+ const r = new Set(n.map((h) => h.type)), o = n.find((h) => h.type === "link");
391
399
  if (o?.attrs?.href) return `[${e}](${o.attrs.href})`;
392
- const l = n.find((b) => b.type === "textStyle")?.attrs || {}, a = n.find((b) => b.type === "highlight")?.attrs || {}, u = !!(l.color || l.fontFamily || l.fontSize || a.color), c = ["bold", "italic", "strike", "underline", "code"].filter(
393
- (b) => r.has(b)
400
+ const l = n.find((h) => h.type === "textStyle")?.attrs || {}, c = n.find((h) => h.type === "highlight")?.attrs || {}, d = !!(l.color || l.fontFamily || l.fontSize || c.color), s = ["bold", "italic", "strike", "underline", "code"].filter(
401
+ (h) => r.has(h)
394
402
  ).length;
395
- if (!u && c === 1 && !r.has("underline")) {
403
+ if (!d && s === 1 && !r.has("underline")) {
396
404
  if (r.has("bold")) return `*${e}*`;
397
405
  if (r.has("italic")) return `_${e}_`;
398
406
  if (r.has("strike")) return `~${e}~`;
399
407
  if (r.has("code")) return `\`${e}\``;
400
408
  }
401
- if (!u && c === 0 && r.has("highlight") && !a.color)
409
+ if (!d && s === 0 && r.has("highlight") && !c.color)
402
410
  return `^${e}^`;
403
- const g = ne(n), p = [];
404
- return g.color && p.push(`color: ${g.color}`), g.family && p.push(`family: ${g.family}`), g.size && p.push(`size: ${g.size}`), g.weight && p.push(`weight: ${g.weight}`), g.italic === "true" && p.push("italic: true"), g.underline && p.push("underline: true"), g.strike && p.push("strike: true"), g.bg && p.push(`bg: ${g.bg}`), g.valign && p.push(`valign: ${g.valign}`), p.length ? `[${e}]{ ${p.join("; ")} }` : e;
411
+ const f = ne(n), p = [];
412
+ return f.color && p.push(`color: ${f.color}`), f.family && p.push(`family: ${f.family}`), f.size && p.push(`size: ${f.size}`), f.weight && p.push(`weight: ${f.weight}`), f.italic === "true" && p.push("italic: true"), f.underline && p.push("underline: true"), f.strike && p.push("strike: true"), f.bg && p.push(`bg: ${f.bg}`), f.valign && p.push(`valign: ${f.valign}`), p.length ? `[${e}]{ ${p.join("; ")} }` : e;
405
413
  }
406
- const $n = /* @__PURE__ */ new Set([
414
+ const Cn = /* @__PURE__ */ new Set([
407
415
  "bold",
408
416
  "italic",
409
417
  "underline",
@@ -418,7 +426,7 @@ const $n = /* @__PURE__ */ new Set([
418
426
  function Nn(t) {
419
427
  const e = /* @__PURE__ */ new Set(), n = (r) => {
420
428
  for (const o of r.marks || [])
421
- $n.has(o.type) || e.add(o.type);
429
+ Cn.has(o.type) || e.add(o.type);
422
430
  for (const o of r.content || []) n(o);
423
431
  };
424
432
  return n(t), [...e].sort();
@@ -428,20 +436,20 @@ function _t(t) {
428
436
  return e.length === 1 && e[0].type === "text" ? {
429
437
  text: e[0].text || "",
430
438
  props: { ...ne(e[0].marks), ...n }
431
- } : { text: e.map(Ln).join(""), props: { ...n } };
439
+ } : { text: e.map(An).join(""), props: { ...n } };
432
440
  }
433
441
  function Ht(t) {
434
442
  return t.content ? t.content.map((e) => e.type === "text" ? e.text || "" : e.type === "hardBreak" ? "\\n" : Ht(e)).join("") : "";
435
443
  }
436
444
  function it(t, e, n) {
437
- const r = vn(t);
438
- for (const o of wn) delete r[o];
445
+ const r = wn(t);
446
+ for (const o of Sn) delete r[o];
439
447
  if (n) for (const o of n) delete r[o];
440
448
  return { ...r, ...e };
441
449
  }
442
450
  function Rt(t) {
443
451
  const e = t.toLowerCase();
444
- return Sn[e] || e;
452
+ return kn[e] || e;
445
453
  }
446
454
  function jt(t) {
447
455
  if (t === "---") return "divider";
@@ -454,18 +462,18 @@ function ct(t) {
454
462
  function lt(t, e) {
455
463
  return !!(t === e || t === "info" && ["tip", "warning", "danger", "success"].includes(e) || e === "info" && ["tip", "warning", "danger", "success"].includes(t));
456
464
  }
457
- function zn(t) {
465
+ function $n(t) {
458
466
  if (!t) return { content: "", properties: {} };
459
467
  const e = t.split(" | ");
460
468
  let n = e[0] || "";
461
469
  const r = {};
462
470
  for (let o = 1; o < e.length; o++) {
463
- const l = e[o], a = l.match(/^([a-zA-Z_][\w-]*)\s*:\s*(.*)$/);
464
- if (!a) {
471
+ const l = e[o], c = l.match(/^([a-zA-Z_][\w-]*)\s*:\s*(.*)$/);
472
+ if (!c) {
465
473
  n += ` | ${l}`;
466
474
  continue;
467
475
  }
468
- r[a[1]] = a[2];
476
+ r[c[1]] = c[2];
469
477
  }
470
478
  return { content: n, properties: r };
471
479
  }
@@ -473,14 +481,14 @@ function Wt(t) {
473
481
  if (t === "---") return { type: "divider" };
474
482
  const e = t.match(/^([a-zA-Z][\w-]*):\s*(.*)$/);
475
483
  if (!e) return null;
476
- const n = Rt(e[1]), r = e[2] || "", { content: o, properties: l } = zn(r);
477
- let a;
484
+ const n = Rt(e[1]), r = e[2] || "", { content: o, properties: l } = $n(r);
485
+ let c;
478
486
  try {
479
- a = tt(`text: ${o}`).blocks[0]?.inline;
487
+ c = et(`text: ${o}`).blocks[0]?.inline;
480
488
  } catch {
481
- a = void 0;
489
+ c = void 0;
482
490
  }
483
- return { type: n, content: o, properties: l, inline: a };
491
+ return { type: n, content: o, properties: l, inline: c };
484
492
  }
485
493
  function Gt(t) {
486
494
  const e = t.match(/^[-*]\s+(.*)$/);
@@ -491,7 +499,7 @@ function Gt(t) {
491
499
  function Mn(t) {
492
500
  return {
493
501
  type: "listItem",
494
- content: [{ type: "paragraph", content: Mt(t) }]
502
+ content: [{ type: "paragraph", content: zt(t) }]
495
503
  };
496
504
  }
497
505
  function Ut(t) {
@@ -500,106 +508,106 @@ function Ut(t) {
500
508
  type: "doc",
501
509
  content: [{ type: "paragraph" }]
502
510
  };
503
- const e = tt(t), n = [];
504
- for (const a of e.blocks) {
505
- const u = At(a);
506
- u && n.push(u);
511
+ const e = et(t), n = [];
512
+ for (const c of e.blocks) {
513
+ const d = Lt(c);
514
+ d && n.push(d);
507
515
  }
508
516
  const r = t.split(`
509
517
  `);
510
518
  let o = 0;
511
519
  const l = [];
512
- for (let a = 0; a < r.length; a++) {
513
- const c = r[a].trim();
514
- if (!c) continue;
520
+ for (let c = 0; c < r.length; c++) {
521
+ const s = r[c].trim();
522
+ if (!s) continue;
515
523
  {
516
- const f = jt(c);
517
- if (f && yn.has(f)) {
518
- l.push({ type: "itMeta", attrs: { raw: c } });
524
+ const g = jt(s);
525
+ if (g && bn.has(g)) {
526
+ l.push({ type: "itMeta", attrs: { raw: s } });
519
527
  const k = e.blocks[o]?.type;
520
- k && lt(f, ct(k)) && o++;
528
+ k && lt(g, ct(k)) && o++;
521
529
  continue;
522
530
  }
523
- if (f && kn.has(f)) {
524
- l.push({ type: "itTrust", attrs: { raw: c, keyword: f } });
531
+ if (g && yn.has(g)) {
532
+ l.push({ type: "itTrust", attrs: { raw: s, keyword: g } });
525
533
  const k = e.blocks[o]?.type;
526
- k && lt(f, ct(k)) && o++;
534
+ k && lt(g, ct(k)) && o++;
527
535
  continue;
528
536
  }
529
- if (f === "metric") {
530
- l.push({ type: "itMetric", attrs: { raw: c } });
537
+ if (g === "metric") {
538
+ l.push({ type: "itMetric", attrs: { raw: s } });
531
539
  const k = e.blocks[o]?.type;
532
- k && lt(f, ct(k)) && o++;
540
+ k && lt(g, ct(k)) && o++;
533
541
  continue;
534
542
  }
535
- if (f === "style") {
536
- l.push({ type: "itStyleRule", attrs: { raw: c } });
543
+ if (g === "style") {
544
+ l.push({ type: "itStyleRule", attrs: { raw: s } });
537
545
  const k = e.blocks[o]?.type;
538
- k && lt(f, ct(k)) && o++;
546
+ k && lt(g, ct(k)) && o++;
539
547
  continue;
540
548
  }
541
549
  }
542
- const g = Gt(c);
543
- if (g) {
544
- const f = g.ordered, k = [];
545
- let T = a;
546
- for (; T < r.length; ) {
547
- const M = r[T].trim(), S = M ? Gt(M) : null;
548
- if (!S || S.ordered !== f) break;
549
- k.push(Mn(S.text));
550
- const v = e.blocks[o]?.type;
551
- (v === "list-item" || v === "step-item") && o++, T++;
550
+ const f = Gt(s);
551
+ if (f) {
552
+ const g = f.ordered, k = [];
553
+ let M = c;
554
+ for (; M < r.length; ) {
555
+ const C = r[M].trim(), v = C ? Gt(C) : null;
556
+ if (!v || v.ordered !== g) break;
557
+ k.push(Mn(v.text));
558
+ const w = e.blocks[o]?.type;
559
+ (w === "list-item" || w === "step-item") && o++, M++;
552
560
  }
553
561
  l.push({
554
- type: f ? "orderedList" : "bulletList",
562
+ type: g ? "orderedList" : "bulletList",
555
563
  content: k
556
- }), a = T - 1;
564
+ }), c = M - 1;
557
565
  continue;
558
566
  }
559
- if (c.startsWith("|") && c.endsWith("|") && (c.match(/\|/g) || []).length >= 3) {
560
- const f = [];
561
- let k = a;
567
+ if (s.startsWith("|") && s.endsWith("|") && (s.match(/\|/g) || []).length >= 3) {
568
+ const g = [];
569
+ let k = c;
562
570
  for (; k < r.length; ) {
563
- const T = r[k].trim();
564
- if (!(T.startsWith("|") && T.endsWith("|"))) break;
565
- f.push(
566
- T.slice(1, -1).split("|").map((M) => M.trim())
571
+ const M = r[k].trim();
572
+ if (!(M.startsWith("|") && M.endsWith("|"))) break;
573
+ g.push(
574
+ M.slice(1, -1).split("|").map((C) => C.trim())
567
575
  ), k++;
568
576
  }
569
- l.push({ type: "itTable", attrs: { rows: JSON.stringify(f) } }), a = k - 1;
577
+ l.push({ type: "itTable", attrs: { rows: JSON.stringify(g) } }), c = k - 1;
570
578
  continue;
571
579
  }
572
- if (c.startsWith("//")) {
580
+ if (s.startsWith("//")) {
573
581
  l.push({
574
582
  type: "itComment",
575
- content: c.slice(2).trim() ? [{ type: "text", text: c.slice(2).trim() }] : []
583
+ content: s.slice(2).trim() ? [{ type: "text", text: s.slice(2).trim() }] : []
576
584
  });
577
585
  continue;
578
586
  }
579
- if (c.startsWith("```")) continue;
580
- const p = jt(c);
581
- if (p && (p === "text" || c.includes("{{"))) {
582
- const f = Wt(c);
583
- if (f) {
584
- const k = At(f);
587
+ if (s.startsWith("```")) continue;
588
+ const p = jt(s);
589
+ if (p && (p === "text" || s.includes("{{"))) {
590
+ const g = Wt(s);
591
+ if (g) {
592
+ const k = Lt(g);
585
593
  if (k && l.push(k), o < e.blocks.length) {
586
- const T = ct(e.blocks[o].type);
587
- lt(p, T) && o++;
594
+ const M = ct(e.blocks[o].type);
595
+ lt(p, M) && o++;
588
596
  }
589
597
  continue;
590
598
  }
591
599
  }
592
600
  if (o < n.length && p) {
593
- const f = e.blocks[o], k = ct(f.type);
601
+ const g = e.blocks[o], k = ct(g.type);
594
602
  if (lt(p, k)) {
595
603
  l.push(n[o]), o++;
596
604
  continue;
597
605
  }
598
606
  }
599
- const b = Wt(c);
600
- if (b) {
601
- const f = At(b);
602
- f && l.push(f);
607
+ const h = Wt(s);
608
+ if (h) {
609
+ const g = Lt(h);
610
+ g && l.push(g);
603
611
  continue;
604
612
  }
605
613
  o < n.length && (l.push(n[o]), o++);
@@ -611,41 +619,41 @@ function Ut(t) {
611
619
  content: l.length > 0 ? l : [{ type: "paragraph" }]
612
620
  };
613
621
  }
614
- function At(t) {
622
+ function Lt(t) {
615
623
  const { type: e, content: n, properties: r, inline: o } = t, l = n || "";
616
- let a = An(o, l);
617
- a = Cn(a, r);
618
- const u = r ? JSON.stringify(
624
+ let c = xn(o, l);
625
+ c = Ln(c, r);
626
+ const d = r ? JSON.stringify(
619
627
  Object.fromEntries(
620
- Object.entries(r).map(([p, b]) => [p, String(b)])
628
+ Object.entries(r).map(([p, h]) => [p, String(h)])
621
629
  )
622
- ) : "{}", c = r?.align ? String(r.align) : void 0;
630
+ ) : "{}", s = r?.align ? String(r.align) : void 0;
623
631
  if (e in Ft)
624
632
  return {
625
633
  type: Ft[e],
626
- attrs: { props: u, ...c && { textAlign: c } },
627
- content: a.length ? a : void 0
634
+ attrs: { props: d, ...s && { textAlign: s } },
635
+ content: c.length ? c : void 0
628
636
  };
629
637
  if (e === "summary")
630
638
  return {
631
639
  type: "itSummary",
632
- attrs: { props: u, ...c && { textAlign: c } },
633
- content: a.length ? a : void 0
640
+ attrs: { props: d, ...s && { textAlign: s } },
641
+ content: c.length ? c : void 0
634
642
  };
635
643
  if (e === "text" || e === "body-text") {
636
644
  const p = {};
637
- return c && (p.textAlign = c), r?.end && (p.end = String(r.end)), r?.leading && (p.leading = String(r.leading)), r?.["space-before"] && (p.spaceBefore = String(r["space-before"])), r?.["space-after"] && (p.spaceAfter = String(r["space-after"])), {
645
+ return s && (p.textAlign = s), r?.end && (p.end = String(r.end)), r?.leading && (p.leading = String(r.leading)), r?.["space-before"] && (p.spaceBefore = String(r["space-before"])), r?.["space-after"] && (p.spaceAfter = String(r["space-after"])), {
638
646
  type: "paragraph",
639
647
  ...Object.keys(p).length && { attrs: p },
640
- content: a.length ? a : void 0
648
+ content: c.length ? c : void 0
641
649
  };
642
650
  }
643
651
  if (Dt.has(e)) {
644
652
  const p = e === "info" ? String(r?.type || "info").toLowerCase() : e;
645
653
  return {
646
654
  type: "itCallout",
647
- attrs: { variant: Dt.has(p) ? p : "info", props: u },
648
- content: a.length ? a : void 0
655
+ attrs: { variant: Dt.has(p) ? p : "info", props: d },
656
+ content: c.length ? c : void 0
649
657
  };
650
658
  }
651
659
  if (e === "quote")
@@ -653,17 +661,17 @@ function At(t) {
653
661
  type: "itQuote",
654
662
  attrs: {
655
663
  by: r?.by ? String(r.by) : "",
656
- props: u,
657
- ...c && { textAlign: c }
664
+ props: d,
665
+ ...s && { textAlign: s }
658
666
  },
659
- content: a.length ? a : void 0
667
+ content: c.length ? c : void 0
660
668
  };
661
669
  if (e === "code")
662
670
  return {
663
671
  type: "itCode",
664
672
  attrs: {
665
673
  lang: r?.lang ? String(r.lang) : "",
666
- props: u
674
+ props: d
667
675
  },
668
676
  content: l ? [{ type: "text", text: l }] : void 0
669
677
  };
@@ -671,59 +679,59 @@ function At(t) {
671
679
  return { type: "itDivider" };
672
680
  if (e === "break")
673
681
  return { type: "itBreak" };
674
- const g = r ? Object.entries(r).filter(([, p]) => p !== void 0 && p !== "").map(([p, b]) => `${p}: ${b}`).join(" | ") : "";
682
+ const f = r ? Object.entries(r).filter(([, p]) => p !== void 0 && p !== "").map(([p, h]) => `${p}: ${h}`).join(" | ") : "";
675
683
  return {
676
684
  type: "itGenericBlock",
677
- attrs: { keyword: e, properties: g, props: u },
678
- content: a.length ? a : void 0
685
+ attrs: { keyword: e, properties: f, props: d },
686
+ content: c.length ? c : void 0
679
687
  };
680
688
  }
681
- function _n(t) {
689
+ function zn(t) {
682
690
  if (!t.content) return "";
683
691
  const e = [];
684
692
  for (const n of t.content)
685
- e.push(...Hn(n));
693
+ e.push(..._n(n));
686
694
  return e.join(`
687
695
  `);
688
696
  }
689
- function Hn(t) {
697
+ function _n(t) {
690
698
  if (t.type === "bulletList" && t.content)
691
699
  return t.content.flatMap((n) => n.content ? n.content.map((r) => {
692
700
  const { text: o, props: l } = _t(r);
693
- return `- ${o}${D(l)}`;
701
+ return `- ${o}${F(l)}`;
694
702
  }) : []);
695
703
  if (t.type === "orderedList" && t.content) {
696
704
  let n = 1;
697
705
  return t.content.flatMap((r) => r.content ? r.content.map((o) => {
698
- const { text: l, props: a } = _t(o);
699
- return `${n++}. ${l}${D(a)}`;
706
+ const { text: l, props: c } = _t(o);
707
+ return `${n++}. ${l}${F(c)}`;
700
708
  }) : []);
701
709
  }
702
- const e = Rn(t);
710
+ const e = Hn(t);
703
711
  return e !== null ? [e] : [];
704
712
  }
705
- function Rn(t) {
713
+ function Hn(t) {
706
714
  const { text: e, props: n } = _t(t);
707
715
  switch (t.type) {
708
716
  case "itTitle": {
709
717
  const r = it(t.attrs?.props, n);
710
- return `title: ${e}${D(r)}`;
718
+ return `title: ${e}${F(r)}`;
711
719
  }
712
720
  case "itSummary": {
713
721
  const r = it(t.attrs?.props, n);
714
- return `summary: ${e}${D(r)}`;
722
+ return `summary: ${e}${F(r)}`;
715
723
  }
716
724
  case "itSection": {
717
725
  const r = it(t.attrs?.props, n);
718
- return `section: ${e}${D(r)}`;
726
+ return `section: ${e}${F(r)}`;
719
727
  }
720
728
  case "itSub": {
721
729
  const r = it(t.attrs?.props, n);
722
- return `sub: ${e}${D(r)}`;
730
+ return `sub: ${e}${F(r)}`;
723
731
  }
724
732
  case "paragraph": {
725
733
  const r = t.attrs || {}, o = {};
726
- return r.end && (o.end = String(r.end)), r.leading && (o.leading = String(r.leading)), r.spaceBefore && (o["space-before"] = String(r.spaceBefore)), r.spaceAfter && (o["space-after"] = String(r.spaceAfter)), `text: ${e}${D({ ...o, ...n })}`;
734
+ return r.end && (o.end = String(r.end)), r.leading && (o.leading = String(r.leading)), r.spaceBefore && (o["space-before"] = String(r.spaceBefore)), r.spaceAfter && (o["space-after"] = String(r.spaceAfter)), `text: ${e}${F({ ...o, ...n })}`;
727
735
  }
728
736
  case "itCallout": {
729
737
  const r = t.attrs?.variant || "tip", o = it(
@@ -731,11 +739,11 @@ function Rn(t) {
731
739
  n,
732
740
  /* @__PURE__ */ new Set(["variant"])
733
741
  );
734
- return r === "info" ? `info: ${e}${D(o)}` : `info: ${e} | type: ${r}${D(o, /* @__PURE__ */ new Set(["type"]))}`;
742
+ return r === "info" ? `info: ${e}${F(o)}` : `info: ${e} | type: ${r}${F(o, /* @__PURE__ */ new Set(["type"]))}`;
735
743
  }
736
744
  case "itQuote": {
737
745
  const r = t.attrs?.by, o = r ? ` | by: ${r}` : "", l = it(t.attrs?.props, n, /* @__PURE__ */ new Set(["by"]));
738
- return `quote: ${e}${o}${D(l)}`;
746
+ return `quote: ${e}${o}${F(l)}`;
739
747
  }
740
748
  case "itCode":
741
749
  return `\`\`\`${t.attrs?.lang || ""}
@@ -767,131 +775,131 @@ ${Ht(t)}
767
775
  return e ? `// ${e}` : "//";
768
776
  case "itGenericBlock": {
769
777
  const r = t.attrs?.keyword || "text", o = it(t.attrs?.props, n);
770
- return `${r}: ${e}${D(o)}`;
778
+ return `${r}: ${e}${F(o)}`;
771
779
  }
772
780
  default:
773
- return e ? `text: ${e}${D(n)}` : null;
781
+ return e ? `text: ${e}${F(n)}` : null;
774
782
  }
775
783
  }
776
- function s(t, e) {
784
+ function i(t, e) {
777
785
  return { property: t, css: e };
778
786
  }
779
- const En = [
780
- s("align", "textAlign"),
781
- s("color", "color"),
782
- s("size", "fontSize"),
783
- s("weight", "fontWeight"),
787
+ const Rn = [
788
+ i("align", "textAlign"),
789
+ i("color", "color"),
790
+ i("size", "fontSize"),
791
+ i("weight", "fontWeight"),
784
792
  { property: "style", css: "fontStyle" },
785
- s("bgcolor", "backgroundColor"),
786
- s("padding", "padding"),
787
- s("indent", "paddingLeft"),
788
- s("opacity", "opacity")
793
+ i("bgcolor", "backgroundColor"),
794
+ i("padding", "padding"),
795
+ i("indent", "paddingLeft"),
796
+ i("opacity", "opacity")
789
797
  ], gt = [
790
- s("bgcolor", "backgroundColor"),
791
- s("color", "color"),
792
- s("border", "borderLeft")
793
- ], L = [
794
- s("color", "borderColor"),
795
- s("bgcolor", "backgroundColor")
796
- ], Bn = {
798
+ i("bgcolor", "backgroundColor"),
799
+ i("color", "color"),
800
+ i("border", "borderLeft")
801
+ ], A = [
802
+ i("color", "borderColor"),
803
+ i("bgcolor", "backgroundColor")
804
+ ], En = {
797
805
  // ── Identity ──
798
806
  title: [
799
- s("align", "textAlign"),
800
- s("color", "color"),
801
- s("size", "fontSize"),
802
- s("weight", "fontWeight"),
803
- s("font", "fontFamily")
807
+ i("align", "textAlign"),
808
+ i("color", "color"),
809
+ i("size", "fontSize"),
810
+ i("weight", "fontWeight"),
811
+ i("font", "fontFamily")
804
812
  ],
805
813
  summary: [
806
- s("align", "textAlign"),
807
- s("color", "color"),
808
- s("size", "fontSize"),
814
+ i("align", "textAlign"),
815
+ i("color", "color"),
816
+ i("size", "fontSize"),
809
817
  { property: "style", css: "fontStyle" }
810
818
  ],
811
819
  // ── Structure ──
812
820
  section: [
813
- s("align", "textAlign"),
814
- s("color", "color"),
815
- s("size", "fontSize"),
816
- s("weight", "fontWeight"),
817
- s("border", "borderBottom"),
818
- s("spacing", "marginTop")
821
+ i("align", "textAlign"),
822
+ i("color", "color"),
823
+ i("size", "fontSize"),
824
+ i("weight", "fontWeight"),
825
+ i("border", "borderBottom"),
826
+ i("spacing", "marginTop")
819
827
  ],
820
828
  sub: [
821
- s("align", "textAlign"),
822
- s("color", "color"),
823
- s("size", "fontSize"),
824
- s("weight", "fontWeight")
829
+ i("align", "textAlign"),
830
+ i("color", "color"),
831
+ i("size", "fontSize"),
832
+ i("weight", "fontWeight")
825
833
  ],
826
834
  divider: [
827
835
  { property: "style", css: "borderStyle" },
828
- s("color", "borderColor"),
829
- s("width", "borderTopWidth"),
830
- s("spacing", "margin")
836
+ i("color", "borderColor"),
837
+ i("width", "borderTopWidth"),
838
+ i("spacing", "margin")
831
839
  ],
832
840
  // ── Content ──
833
- text: [...En],
841
+ text: [...Rn],
834
842
  tip: [...gt],
835
843
  info: [...gt],
836
844
  warning: [...gt],
837
845
  danger: [...gt],
838
846
  success: [...gt],
839
847
  quote: [
840
- s("align", "textAlign"),
841
- s("color", "color"),
842
- s("size", "fontSize"),
848
+ i("align", "textAlign"),
849
+ i("color", "color"),
850
+ i("size", "fontSize"),
843
851
  { property: "style", css: "fontStyle" },
844
- s("border", "borderLeft"),
845
- s("padding", "paddingLeft"),
846
- s("bgcolor", "backgroundColor")
852
+ i("border", "borderLeft"),
853
+ i("padding", "paddingLeft"),
854
+ i("bgcolor", "backgroundColor")
847
855
  ],
848
856
  cite: [
849
- s("align", "textAlign"),
850
- s("color", "color"),
851
- s("size", "fontSize"),
857
+ i("align", "textAlign"),
858
+ i("color", "color"),
859
+ i("size", "fontSize"),
852
860
  { property: "style", css: "fontStyle" }
853
861
  ],
854
862
  def: [
855
- s("color", "color"),
856
- s("bgcolor", "backgroundColor"),
857
- s("border", "borderLeft"),
858
- s("padding", "paddingLeft")
863
+ i("color", "color"),
864
+ i("bgcolor", "backgroundColor"),
865
+ i("border", "borderLeft"),
866
+ i("padding", "paddingLeft")
859
867
  ],
860
868
  caption: [
861
- s("align", "textAlign"),
862
- s("color", "color"),
863
- s("size", "fontSize"),
869
+ i("align", "textAlign"),
870
+ i("color", "color"),
871
+ i("size", "fontSize"),
864
872
  { property: "style", css: "fontStyle" }
865
873
  ],
866
- footnote: [s("color", "color"), s("size", "fontSize")],
874
+ footnote: [i("color", "color"), i("size", "fontSize")],
867
875
  byline: [
868
- s("align", "textAlign"),
869
- s("color", "color"),
870
- s("size", "fontSize"),
876
+ i("align", "textAlign"),
877
+ i("color", "color"),
878
+ i("size", "fontSize"),
871
879
  { property: "style", css: "fontStyle" },
872
- s("weight", "fontWeight")
880
+ i("weight", "fontWeight")
873
881
  ],
874
882
  epigraph: [
875
- s("align", "textAlign"),
876
- s("color", "color"),
877
- s("size", "fontSize"),
883
+ i("align", "textAlign"),
884
+ i("color", "color"),
885
+ i("size", "fontSize"),
878
886
  { property: "style", css: "fontStyle" },
879
- s("padding", "padding")
887
+ i("padding", "padding")
880
888
  ],
881
889
  dedication: [
882
- s("align", "textAlign"),
883
- s("color", "color"),
890
+ i("align", "textAlign"),
891
+ i("color", "color"),
884
892
  { property: "style", css: "fontStyle" },
885
- s("padding", "padding")
893
+ i("padding", "padding")
886
894
  ],
887
895
  // ── Media ──
888
896
  image: [
889
- s("width", "width"),
890
- s("height", "height"),
891
- s("radius", "borderRadius"),
892
- s("border", "border"),
893
- s("opacity", "opacity"),
894
- s("bgcolor", "backgroundColor"),
897
+ i("width", "width"),
898
+ i("height", "height"),
899
+ i("radius", "borderRadius"),
900
+ i("border", "border"),
901
+ i("opacity", "opacity"),
902
+ i("bgcolor", "backgroundColor"),
895
903
  {
896
904
  property: "shadow",
897
905
  css: "boxShadow",
@@ -899,134 +907,134 @@ const En = [
899
907
  }
900
908
  ],
901
909
  figure: [
902
- s("width", "width"),
903
- s("align", "textAlign"),
904
- s("border", "border"),
905
- s("padding", "padding"),
906
- s("bgcolor", "backgroundColor"),
910
+ i("width", "width"),
911
+ i("align", "textAlign"),
912
+ i("border", "border"),
913
+ i("padding", "padding"),
914
+ i("bgcolor", "backgroundColor"),
907
915
  {
908
916
  property: "shadow",
909
917
  css: "boxShadow",
910
918
  transform: () => "0 4px 12px rgba(0,0,0,0.15)"
911
919
  }
912
920
  ],
913
- link: [s("color", "color"), s("weight", "fontWeight")],
914
- ref: [s("color", "color"), { property: "style", css: "fontStyle" }],
921
+ link: [i("color", "color"), i("weight", "fontWeight")],
922
+ ref: [i("color", "color"), { property: "style", css: "fontStyle" }],
915
923
  embed: [
916
- s("width", "width"),
917
- s("height", "height"),
918
- s("border", "border"),
919
- s("radius", "borderRadius")
924
+ i("width", "width"),
925
+ i("height", "height"),
926
+ i("border", "border"),
927
+ i("radius", "borderRadius")
920
928
  ],
921
929
  // ── Data ──
922
930
  metric: [
923
- s("color", "color"),
924
- s("size", "fontSize"),
925
- s("align", "textAlign"),
926
- s("bgcolor", "backgroundColor"),
927
- s("border", "border"),
928
- s("padding", "padding")
931
+ i("color", "color"),
932
+ i("size", "fontSize"),
933
+ i("align", "textAlign"),
934
+ i("bgcolor", "backgroundColor"),
935
+ i("border", "border"),
936
+ i("padding", "padding")
929
937
  ],
930
938
  columns: [
931
- s("border", "border"),
932
- s("bgcolor", "backgroundColor"),
933
- s("padding", "padding"),
934
- s("size", "fontSize"),
935
- s("align", "textAlign")
939
+ i("border", "border"),
940
+ i("bgcolor", "backgroundColor"),
941
+ i("padding", "padding"),
942
+ i("size", "fontSize"),
943
+ i("align", "textAlign")
936
944
  ],
937
945
  row: [
938
- s("border", "border"),
939
- s("bgcolor", "backgroundColor"),
940
- s("padding", "padding"),
941
- s("size", "fontSize"),
942
- s("align", "textAlign")
946
+ i("border", "border"),
947
+ i("bgcolor", "backgroundColor"),
948
+ i("padding", "padding"),
949
+ i("size", "fontSize"),
950
+ i("align", "textAlign")
943
951
  ],
944
952
  input: [
945
- s("color", "color"),
946
- s("bgcolor", "backgroundColor"),
947
- s("border", "borderLeft"),
948
- s("size", "fontSize")
953
+ i("color", "color"),
954
+ i("bgcolor", "backgroundColor"),
955
+ i("border", "borderLeft"),
956
+ i("size", "fontSize")
949
957
  ],
950
958
  output: [
951
- s("color", "color"),
952
- s("bgcolor", "backgroundColor"),
953
- s("border", "borderLeft"),
954
- s("size", "fontSize")
959
+ i("color", "color"),
960
+ i("bgcolor", "backgroundColor"),
961
+ i("border", "borderLeft"),
962
+ i("size", "fontSize")
955
963
  ],
956
964
  // ── Code ──
957
965
  code: [
958
- s("size", "fontSize"),
959
- s("bgcolor", "backgroundColor"),
960
- s("color", "color"),
961
- s("padding", "padding"),
962
- s("radius", "borderRadius"),
963
- s("border", "border")
966
+ i("size", "fontSize"),
967
+ i("bgcolor", "backgroundColor"),
968
+ i("color", "color"),
969
+ i("padding", "padding"),
970
+ i("radius", "borderRadius"),
971
+ i("border", "border")
964
972
  ],
965
973
  // ── Contact ──
966
974
  contact: [
967
- s("color", "color"),
968
- s("bgcolor", "backgroundColor"),
969
- s("border", "border"),
970
- s("padding", "padding"),
971
- s("size", "fontSize")
975
+ i("color", "color"),
976
+ i("bgcolor", "backgroundColor"),
977
+ i("border", "border"),
978
+ i("padding", "padding"),
979
+ i("size", "fontSize")
972
980
  ],
973
981
  deadline: [
974
- s("color", "color"),
975
- s("bgcolor", "backgroundColor"),
976
- s("weight", "fontWeight"),
977
- s("size", "fontSize")
982
+ i("color", "color"),
983
+ i("bgcolor", "backgroundColor"),
984
+ i("weight", "fontWeight"),
985
+ i("size", "fontSize")
978
986
  ],
979
987
  // ── Agent workflow chips ──
980
- step: [...L],
981
- decision: [...L],
982
- gate: [...L],
983
- trigger: [...L],
984
- loop: [...L],
985
- parallel: [...L],
986
- call: [...L],
987
- wait: [...L],
988
- checkpoint: [...L],
989
- error: [...L],
990
- result: [...L],
991
- audit: [...L],
992
- signal: [...L],
993
- handoff: [...L],
994
- retry: [...L],
995
- progress: [...L],
996
- tool: [...L],
997
- prompt: [...L],
998
- memory: [...L],
999
- policy: [...L],
1000
- context: [...L],
988
+ step: [...A],
989
+ decision: [...A],
990
+ gate: [...A],
991
+ trigger: [...A],
992
+ loop: [...A],
993
+ parallel: [...A],
994
+ call: [...A],
995
+ wait: [...A],
996
+ checkpoint: [...A],
997
+ error: [...A],
998
+ result: [...A],
999
+ audit: [...A],
1000
+ signal: [...A],
1001
+ handoff: [...A],
1002
+ retry: [...A],
1003
+ progress: [...A],
1004
+ tool: [...A],
1005
+ prompt: [...A],
1006
+ memory: [...A],
1007
+ policy: [...A],
1008
+ context: [...A],
1001
1009
  // ── Trust badges ──
1002
- track: [...L],
1003
- approve: [...L],
1004
- sign: [...L],
1005
- freeze: [...L],
1006
- revision: [...L],
1007
- amendment: [...L],
1008
- history: [s("color", "borderColor")],
1010
+ track: [...A],
1011
+ approve: [...A],
1012
+ sign: [...A],
1013
+ freeze: [...A],
1014
+ revision: [...A],
1015
+ amendment: [...A],
1016
+ history: [i("color", "borderColor")],
1009
1017
  // ── v2.13 ──
1010
1018
  assert: [
1011
- s("color", "borderColor"),
1012
- s("bgcolor", "backgroundColor"),
1013
- s("border", "borderLeft")
1019
+ i("color", "borderColor"),
1020
+ i("bgcolor", "backgroundColor"),
1021
+ i("border", "borderLeft")
1014
1022
  ],
1015
1023
  secret: [
1016
- s("color", "color"),
1017
- s("bgcolor", "backgroundColor"),
1018
- s("blur", "filter")
1024
+ i("color", "color"),
1025
+ i("bgcolor", "backgroundColor"),
1026
+ i("blur", "filter")
1019
1027
  ],
1020
1028
  // ── Layout ──
1021
1029
  watermark: [
1022
- s("color", "color"),
1023
- s("size", "fontSize"),
1024
- s("opacity", "opacity")
1030
+ i("color", "color"),
1031
+ i("size", "fontSize"),
1032
+ i("opacity", "opacity")
1025
1033
  ],
1026
- signline: [s("color", "color"), s("width", "width")]
1034
+ signline: [i("color", "color"), i("width", "width")]
1027
1035
  };
1028
1036
  function Pn(t, e) {
1029
- const n = Bn[t];
1037
+ const n = En[t];
1030
1038
  if (!n) return {};
1031
1039
  const r = {};
1032
1040
  for (const o of n) {
@@ -1035,14 +1043,14 @@ function Pn(t, e) {
1035
1043
  }
1036
1044
  return r;
1037
1045
  }
1038
- function q(t, e) {
1046
+ function J(t, e) {
1039
1047
  const n = Pn(t, e);
1040
1048
  return e.leading && (n.lineHeight = e.leading), e["space-before"] && (n.marginTop = e["space-before"]), e["space-after"] && (n.marginBottom = e["space-after"]), Object.entries(n).map(([r, o]) => `${r.replace(/([A-Z])/g, "-$1").toLowerCase()}:${o}`).join(";");
1041
1049
  }
1042
1050
  function Et(t) {
1043
1051
  return t.end ? { "data-it-end": t.end } : {};
1044
1052
  }
1045
- const In = E.create({
1053
+ const Bn = E.create({
1046
1054
  name: "itTitle",
1047
1055
  group: "block",
1048
1056
  content: "inline*",
@@ -1059,15 +1067,15 @@ const In = E.create({
1059
1067
  return [{ tag: 'h1[data-it-type="title"]' }];
1060
1068
  },
1061
1069
  renderHTML({ HTMLAttributes: t, node: e }) {
1062
- const n = et(e.attrs.props), r = z(t, {
1070
+ const n = nt(e.attrs.props), r = _(t, {
1063
1071
  "data-it-type": "title",
1064
1072
  class: "it-doc-title",
1065
- style: q("title", n),
1073
+ style: J("title", n),
1066
1074
  ...Et(n)
1067
1075
  });
1068
1076
  return n.end ? ["h1", r, ["span", { class: "it-split-main" }, 0]] : ["h1", r, 0];
1069
1077
  }
1070
- }), On = E.create({
1078
+ }), In = E.create({
1071
1079
  name: "itSummary",
1072
1080
  group: "block",
1073
1081
  content: "inline*",
@@ -1081,18 +1089,18 @@ const In = E.create({
1081
1089
  return [{ tag: 'p[data-it-type="summary"]' }];
1082
1090
  },
1083
1091
  renderHTML({ HTMLAttributes: t, node: e }) {
1084
- const n = et(e.attrs.props);
1092
+ const n = nt(e.attrs.props);
1085
1093
  return [
1086
1094
  "p",
1087
- z(t, {
1095
+ _(t, {
1088
1096
  "data-it-type": "summary",
1089
1097
  class: "it-doc-summary",
1090
- style: q("summary", n)
1098
+ style: J("summary", n)
1091
1099
  }),
1092
1100
  0
1093
1101
  ];
1094
1102
  }
1095
- }), Dn = E.create({
1103
+ }), On = E.create({
1096
1104
  name: "itSection",
1097
1105
  group: "block",
1098
1106
  content: "inline*",
@@ -1106,15 +1114,15 @@ const In = E.create({
1106
1114
  return [{ tag: 'h2[data-it-type="section"]' }];
1107
1115
  },
1108
1116
  renderHTML({ HTMLAttributes: t, node: e }) {
1109
- const n = et(e.attrs.props), r = z(t, {
1117
+ const n = nt(e.attrs.props), r = _(t, {
1110
1118
  "data-it-type": "section",
1111
1119
  class: "it-doc-section",
1112
- style: q("section", n),
1120
+ style: J("section", n),
1113
1121
  ...Et(n)
1114
1122
  });
1115
1123
  return n.end ? ["h2", r, ["span", { class: "it-split-main" }, 0]] : ["h2", r, 0];
1116
1124
  }
1117
- }), Fn = E.create({
1125
+ }), Dn = E.create({
1118
1126
  name: "itSub",
1119
1127
  group: "block",
1120
1128
  content: "inline*",
@@ -1128,15 +1136,15 @@ const In = E.create({
1128
1136
  return [{ tag: 'h3[data-it-type="sub"]' }];
1129
1137
  },
1130
1138
  renderHTML({ HTMLAttributes: t, node: e }) {
1131
- const n = et(e.attrs.props), r = z(t, {
1139
+ const n = nt(e.attrs.props), r = _(t, {
1132
1140
  "data-it-type": "sub",
1133
1141
  class: "it-doc-sub",
1134
- style: q("sub", n),
1142
+ style: J("sub", n),
1135
1143
  ...Et(n)
1136
1144
  });
1137
1145
  return n.end ? ["h3", r, ["span", { class: "it-split-main" }, 0]] : ["h3", r, 0];
1138
1146
  }
1139
- }), jn = E.create({
1147
+ }), Fn = E.create({
1140
1148
  name: "itCallout",
1141
1149
  group: "block",
1142
1150
  content: "inline*",
@@ -1155,7 +1163,7 @@ const In = E.create({
1155
1163
  return [{ tag: 'div[data-it-type="callout"]' }];
1156
1164
  },
1157
1165
  renderHTML({ HTMLAttributes: t, node: e }) {
1158
- const n = e.attrs.variant || "tip", r = et(e.attrs.props), o = {
1166
+ const n = e.attrs.variant || "tip", r = nt(e.attrs.props), o = {
1159
1167
  tip: "tip",
1160
1168
  info: "info",
1161
1169
  warning: "warning",
@@ -1164,11 +1172,11 @@ const In = E.create({
1164
1172
  };
1165
1173
  return [
1166
1174
  "div",
1167
- z(t, {
1175
+ _(t, {
1168
1176
  "data-it-type": "callout",
1169
1177
  "data-variant": n,
1170
1178
  class: `it-doc-callout it-doc-callout-${n}`,
1171
- style: q(n, r)
1179
+ style: J(n, r)
1172
1180
  }),
1173
1181
  [
1174
1182
  "span",
@@ -1181,7 +1189,7 @@ const In = E.create({
1181
1189
  ["span", { class: "it-doc-callout-text" }, 0]
1182
1190
  ];
1183
1191
  }
1184
- }), Wn = E.create({
1192
+ }), jn = E.create({
1185
1193
  name: "itQuote",
1186
1194
  group: "block",
1187
1195
  content: "inline*",
@@ -1196,18 +1204,18 @@ const In = E.create({
1196
1204
  return [{ tag: 'blockquote[data-it-type="quote"]' }];
1197
1205
  },
1198
1206
  renderHTML({ HTMLAttributes: t, node: e }) {
1199
- const n = et(e.attrs.props);
1207
+ const n = nt(e.attrs.props);
1200
1208
  return [
1201
1209
  "blockquote",
1202
- z(t, {
1210
+ _(t, {
1203
1211
  "data-it-type": "quote",
1204
1212
  class: "it-doc-quote",
1205
- style: q("quote", n)
1213
+ style: J("quote", n)
1206
1214
  }),
1207
1215
  0
1208
1216
  ];
1209
1217
  }
1210
- }), Gn = E.create({
1218
+ }), Wn = E.create({
1211
1219
  name: "itCode",
1212
1220
  group: "block",
1213
1221
  content: "text*",
@@ -1224,19 +1232,19 @@ const In = E.create({
1224
1232
  return [{ tag: "pre" }];
1225
1233
  },
1226
1234
  renderHTML({ HTMLAttributes: t, node: e }) {
1227
- const n = et(e.attrs.props);
1235
+ const n = nt(e.attrs.props);
1228
1236
  return [
1229
1237
  "pre",
1230
- z(t, {
1238
+ _(t, {
1231
1239
  "data-it-type": "code",
1232
1240
  class: "it-doc-code",
1233
1241
  "data-lang": e.attrs.lang || "",
1234
- style: q("code", n)
1242
+ style: J("code", n)
1235
1243
  }),
1236
1244
  ["code", 0]
1237
1245
  ];
1238
1246
  }
1239
- }), Un = E.create({
1247
+ }), Gn = E.create({
1240
1248
  name: "itDivider",
1241
1249
  group: "block",
1242
1250
  atom: !0,
@@ -1244,9 +1252,9 @@ const In = E.create({
1244
1252
  return [{ tag: "hr" }];
1245
1253
  },
1246
1254
  renderHTML({ HTMLAttributes: t }) {
1247
- return ["hr", z(t, { class: "it-doc-divider" })];
1255
+ return ["hr", _(t, { class: "it-doc-divider" })];
1248
1256
  }
1249
- }), Yn = E.create({
1257
+ }), Un = E.create({
1250
1258
  name: "itMeta",
1251
1259
  group: "block",
1252
1260
  atom: !0,
@@ -1266,11 +1274,11 @@ const In = E.create({
1266
1274
  const n = String(e.attrs.raw || "").replace(/\s*\|\s*/g, " · ");
1267
1275
  return [
1268
1276
  "div",
1269
- z(t, { "data-it-meta": "", class: "it-doc-meta" }),
1277
+ _(t, { "data-it-meta": "", class: "it-doc-meta" }),
1270
1278
  `⚙ ${n}`
1271
1279
  ];
1272
1280
  }
1273
- }), Kn = E.create({
1281
+ }), Yn = E.create({
1274
1282
  name: "itTable",
1275
1283
  group: "block",
1276
1284
  atom: !0,
@@ -1296,7 +1304,7 @@ const In = E.create({
1296
1304
  const r = n[0] || [], o = n.slice(1);
1297
1305
  return [
1298
1306
  "table",
1299
- z(t, {
1307
+ _(t, {
1300
1308
  "data-it-table": "",
1301
1309
  class: "it-doc-table"
1302
1310
  }),
@@ -1308,7 +1316,7 @@ const In = E.create({
1308
1316
  "tbody",
1309
1317
  ...o.map((l) => [
1310
1318
  "tr",
1311
- ...l.map((a) => ["td", Yt(a), String(a)])
1319
+ ...l.map((c) => ["td", Yt(c), String(c)])
1312
1320
  ])
1313
1321
  ]
1314
1322
  ];
@@ -1317,15 +1325,15 @@ const In = E.create({
1317
1325
  function Yt(t) {
1318
1326
  return /\{\{[^}]+\}\}|^each:/.test(String(t).trim()) ? { class: "it-doc-var-cell" } : {};
1319
1327
  }
1320
- function Bt(t) {
1321
- const e = t.indexOf(":"), n = (e >= 0 ? t.slice(0, e) : t).trim().toLowerCase(), o = (e >= 0 ? t.slice(e + 1).trim() : "").split("|").map((u) => u.trim()), l = o.shift() || "", a = {};
1322
- for (const u of o) {
1323
- const c = u.indexOf(":");
1324
- c > 0 && (a[u.slice(0, c).trim().toLowerCase()] = u.slice(c + 1).trim());
1328
+ function Pt(t) {
1329
+ const e = t.indexOf(":"), n = (e >= 0 ? t.slice(0, e) : t).trim().toLowerCase(), o = (e >= 0 ? t.slice(e + 1).trim() : "").split("|").map((d) => d.trim()), l = o.shift() || "", c = {};
1330
+ for (const d of o) {
1331
+ const s = d.indexOf(":");
1332
+ s > 0 && (c[d.slice(0, s).trim().toLowerCase()] = d.slice(s + 1).trim());
1325
1333
  }
1326
- return { keyword: n, content: l, props: a };
1334
+ return { keyword: n, content: l, props: c };
1327
1335
  }
1328
- const qn = E.create({
1336
+ const Kn = E.create({
1329
1337
  name: "itTrust",
1330
1338
  group: "block",
1331
1339
  atom: !0,
@@ -1347,68 +1355,44 @@ const qn = E.create({
1347
1355
  return [{ tag: "div[data-it-trust]" }];
1348
1356
  },
1349
1357
  renderHTML({ HTMLAttributes: t, node: e }) {
1350
- const { keyword: n, content: r, props: o } = Bt(
1358
+ const { keyword: n, content: r, props: o } = Pt(
1351
1359
  String(e.attrs.raw || "")
1352
- ), l = o.role || o.title || "", a = o.at || o.date || o.time || "", u = [];
1353
- if (n === "seal") {
1354
- const c = r || o.hash || "", g = o.algo || "sha-256";
1355
- u.push(
1356
- ["span", { class: "it-doc-trust__icon" }, "🔒"],
1357
- ["span", { class: "it-doc-trust__label" }, "Sealed"],
1358
- ["span", { class: "it-doc-trust__meta" }, g],
1359
- ...c ? [["code", { class: "it-doc-trust__hash" }, c.slice(0, 16) + "…"]] : []
1360
- );
1361
- } else if (n === "approve")
1362
- u.push(
1363
- ["span", { class: "it-doc-trust__icon" }, "✓"],
1364
- ["span", { class: "it-doc-trust__label" }, "Approved"],
1365
- ["span", { class: "it-doc-trust__name" }, r],
1366
- ...l ? [["span", { class: "it-doc-trust__role" }, l]] : [],
1367
- ...a ? [["span", { class: "it-doc-trust__date" }, a]] : []
1368
- );
1369
- else if (n === "freeze")
1370
- u.push(
1371
- ["span", { class: "it-doc-trust__icon" }, ""],
1372
- ["span", { class: "it-doc-trust__label" }, "Frozen"],
1373
- ...r ? [["span", { class: "it-doc-trust__name" }, r]] : [],
1374
- ...a ? [["span", { class: "it-doc-trust__date" }, a]] : []
1375
- );
1376
- else if (n === "amend" || n === "amendment")
1377
- u.push(
1378
- ["span", { class: "it-doc-trust__icon" }, "✎"],
1379
- ["span", { class: "it-doc-trust__label" }, "Amendment"],
1380
- ["span", { class: "it-doc-trust__name" }, r],
1381
- ...a ? [["span", { class: "it-doc-trust__date" }, a]] : []
1382
- );
1383
- else
1384
- return [
1385
- "div",
1386
- z(t, {
1387
- "data-it-trust": "",
1388
- "data-trust": n,
1389
- class: "it-doc-trust it-doc-sign"
1390
- }),
1391
- ["div", { class: "it-doc-sign__script" }, r || " "],
1392
- ["div", { class: "it-doc-sign__rule" }],
1393
- [
1394
- "div",
1395
- { class: "it-doc-sign__row" },
1396
- ["span", { class: "it-doc-sign__name" }, r],
1397
- ...l ? [["span", { class: "it-doc-sign__role" }, l]] : [],
1398
- ...a ? [["span", { class: "it-doc-sign__date" }, a]] : []
1399
- ]
1400
- ];
1360
+ ), l = o.role || o.title || "", c = (o.at || o.date || o.time || "").slice(0, 10), d = [];
1361
+ if (n === "seal" || n === "freeze") {
1362
+ const s = n === "seal" && r || o.hash || "";
1363
+ d.push(["span", { class: "it-doc-trust__label" }, "Sealed document"]), c && d.push(["span", { class: "it-doc-trust__date" }, c]), s && d.push([
1364
+ "code",
1365
+ { class: "it-doc-trust__hash" },
1366
+ s.length > 20 ? s.slice(0, 20) + "..." : s
1367
+ ]);
1368
+ } else if (n === "approve") {
1369
+ const s = o.by || r, f = o.by ? r : "";
1370
+ d.push(["span", { class: "it-doc-trust__label" }, "Approved"]), f && d.push(["span", { class: "it-doc-trust__what" }, f]), s && d.push([
1371
+ "span",
1372
+ { class: "it-doc-trust__who" },
1373
+ l ? `${s}, ${l}` : s
1374
+ ]), c && d.push(["span", { class: "it-doc-trust__date" }, c]);
1375
+ } else if (n === "amend" || n === "amendment")
1376
+ d.push(["span", { class: "it-doc-trust__label" }, "Amendment"]), r && d.push(["span", { class: "it-doc-trust__what" }, r]), c && d.push(["span", { class: "it-doc-trust__date" }, c]);
1377
+ else {
1378
+ const s = r || o.by || "", f = !!o.hash;
1379
+ d.push(["span", { class: "it-doc-trust__name" }, s]), l && d.push(["span", { class: "it-doc-trust__role" }, l]), c && d.push(["span", { class: "it-doc-trust__date" }, c]), d.push([
1380
+ "span",
1381
+ { class: "it-doc-trust__status" },
1382
+ f ? "Signed · verified" : "Signed"
1383
+ ]);
1384
+ }
1401
1385
  return [
1402
1386
  "div",
1403
- z(t, {
1387
+ _(t, {
1404
1388
  "data-it-trust": "",
1405
1389
  "data-trust": n,
1406
1390
  class: `it-doc-trust it-doc-trust--${n}`
1407
1391
  }),
1408
- ...u
1392
+ ...d
1409
1393
  ];
1410
1394
  }
1411
- }), Jn = E.create({
1395
+ }), qn = E.create({
1412
1396
  name: "itMetric",
1413
1397
  group: "block",
1414
1398
  atom: !0,
@@ -1425,22 +1409,22 @@ const qn = E.create({
1425
1409
  return [{ tag: "div[data-it-metric]" }];
1426
1410
  },
1427
1411
  renderHTML({ HTMLAttributes: t, node: e }) {
1428
- const { content: n, props: r } = Bt(String(e.attrs.raw || "")), o = [r.value, r.unit].filter(Boolean).join(" "), l = /\b(total|balance due|amount due|grand)\b/i.test(n), a = /\{\{[^}]+\}\}/.test(o);
1412
+ const { content: n, props: r } = Pt(String(e.attrs.raw || "")), o = [r.value, r.unit].filter(Boolean).join(" "), l = /\b(total|balance due|amount due|grand)\b/i.test(n), c = /\{\{[^}]+\}\}/.test(o);
1429
1413
  return [
1430
1414
  "div",
1431
- z(t, {
1415
+ _(t, {
1432
1416
  "data-it-metric": "",
1433
1417
  class: `it-doc-metric${l ? " it-doc-metric--total" : ""}`
1434
1418
  }),
1435
1419
  ["span", { class: "it-doc-metric__label" }, n],
1436
1420
  [
1437
1421
  "span",
1438
- { class: `it-doc-metric__value${a ? " it-doc-var" : ""}` },
1422
+ { class: `it-doc-metric__value${c ? " it-doc-var" : ""}` },
1439
1423
  o
1440
1424
  ]
1441
1425
  ];
1442
1426
  }
1443
- }), Vn = E.create({
1427
+ }), Jn = E.create({
1444
1428
  name: "itStyleRule",
1445
1429
  group: "block",
1446
1430
  atom: !0,
@@ -1457,10 +1441,10 @@ const qn = E.create({
1457
1441
  return [{ tag: "div[data-it-style-rule]" }];
1458
1442
  },
1459
1443
  renderHTML({ HTMLAttributes: t, node: e }) {
1460
- const { content: n, props: r } = Bt(String(e.attrs.raw || "")), o = Object.entries(r).map(([l, a]) => `${l}: ${a}`).join(" · ");
1444
+ const { content: n, props: r } = Pt(String(e.attrs.raw || "")), o = Object.entries(r).map(([l, c]) => `${l}: ${c}`).join(" · ");
1461
1445
  return [
1462
1446
  "div",
1463
- z(t, {
1447
+ _(t, {
1464
1448
  "data-it-style-rule": "",
1465
1449
  class: "it-doc-stylerule"
1466
1450
  }),
@@ -1469,7 +1453,7 @@ const qn = E.create({
1469
1453
  ["span", { class: "it-doc-stylerule__decl" }, o]
1470
1454
  ];
1471
1455
  }
1472
- }), Qn = E.create({
1456
+ }), Vn = E.create({
1473
1457
  name: "itBreak",
1474
1458
  group: "block",
1475
1459
  atom: !0,
@@ -1479,13 +1463,13 @@ const qn = E.create({
1479
1463
  renderHTML({ HTMLAttributes: t }) {
1480
1464
  return [
1481
1465
  "div",
1482
- z(t, {
1466
+ _(t, {
1483
1467
  "data-it-type": "break",
1484
1468
  class: "it-doc-break"
1485
1469
  })
1486
1470
  ];
1487
1471
  }
1488
- }), Zn = E.create({
1472
+ }), Qn = E.create({
1489
1473
  name: "itGenericBlock",
1490
1474
  group: "block",
1491
1475
  content: "inline*",
@@ -1501,16 +1485,16 @@ const qn = E.create({
1501
1485
  return [{ tag: '[data-it-type="generic"]' }];
1502
1486
  },
1503
1487
  renderHTML({ HTMLAttributes: t, node: e }) {
1504
- const n = e.attrs.keyword, r = et(e.attrs.props), o = String(
1488
+ const n = e.attrs.keyword, r = nt(e.attrs.props), o = String(
1505
1489
  r.to || r.url || r.href || r.file || ""
1506
1490
  ).trim();
1507
1491
  return (n === "link" || n === "ref") && o ? [
1508
1492
  "p",
1509
- z(t, {
1493
+ _(t, {
1510
1494
  "data-it-type": "generic",
1511
1495
  "data-keyword": n,
1512
1496
  class: `it-doc-generic it-doc-kw-${n}`,
1513
- style: q(n, r)
1497
+ style: J(n, r)
1514
1498
  }),
1515
1499
  [
1516
1500
  "a",
@@ -1524,16 +1508,16 @@ const qn = E.create({
1524
1508
  ]
1525
1509
  ] : [
1526
1510
  "p",
1527
- z(t, {
1511
+ _(t, {
1528
1512
  "data-it-type": "generic",
1529
1513
  "data-keyword": n,
1530
1514
  class: `it-doc-generic it-doc-kw-${n}`,
1531
- style: q(n, r)
1515
+ style: J(n, r)
1532
1516
  }),
1533
1517
  ["span", { class: "it-doc-generic-content" }, 0]
1534
1518
  ];
1535
1519
  }
1536
- }), Xn = E.create({
1520
+ }), Zn = E.create({
1537
1521
  name: "itComment",
1538
1522
  group: "block",
1539
1523
  content: "inline*",
@@ -1544,7 +1528,7 @@ const qn = E.create({
1544
1528
  renderHTML({ HTMLAttributes: t }) {
1545
1529
  return [
1546
1530
  "p",
1547
- z(t, {
1531
+ _(t, {
1548
1532
  "data-it-type": "comment",
1549
1533
  class: "it-doc-comment"
1550
1534
  }),
@@ -1552,7 +1536,7 @@ const qn = E.create({
1552
1536
  ];
1553
1537
  }
1554
1538
  });
1555
- function et(t) {
1539
+ function nt(t) {
1556
1540
  try {
1557
1541
  return typeof t == "string" ? JSON.parse(t) : t || {};
1558
1542
  } catch {
@@ -1564,7 +1548,7 @@ const re = {
1564
1548
  "space-before": "spaceBefore",
1565
1549
  "space-after": "spaceAfter",
1566
1550
  end: "end"
1567
- }, tr = /* @__PURE__ */ new Set([
1551
+ }, Xn = /* @__PURE__ */ new Set([
1568
1552
  "itTitle",
1569
1553
  "itSummary",
1570
1554
  "itSection",
@@ -1572,7 +1556,7 @@ const re = {
1572
1556
  "itQuote",
1573
1557
  "itCallout",
1574
1558
  "itGenericBlock"
1575
- ]), er = /* @__PURE__ */ new Set(["itTitle", "itSection", "itSub"]);
1559
+ ]), tr = /* @__PURE__ */ new Set(["itTitle", "itSection", "itSub"]);
1576
1560
  function oe(t) {
1577
1561
  try {
1578
1562
  return typeof t == "string" ? JSON.parse(t) : t || {};
@@ -1581,9 +1565,9 @@ function oe(t) {
1581
1565
  }
1582
1566
  }
1583
1567
  function se(t, e) {
1584
- return t === "paragraph" ? !0 : e === "end" ? er.has(t) : tr.has(t);
1568
+ return t === "paragraph" ? !0 : e === "end" ? tr.has(t) : Xn.has(t);
1585
1569
  }
1586
- const nr = Ie.extend({
1570
+ const er = Ie.extend({
1587
1571
  addAttributes() {
1588
1572
  return {
1589
1573
  ...this.parent?.(),
@@ -1612,52 +1596,52 @@ const nr = Ie.extend({
1612
1596
  renderHTML({ node: t, HTMLAttributes: e }) {
1613
1597
  return t.attrs.end ? [
1614
1598
  "p",
1615
- z(e),
1599
+ _(e),
1616
1600
  ["span", { class: "it-split-main" }, 0]
1617
- ] : ["p", z(e), 0];
1601
+ ] : ["p", _(e), 0];
1618
1602
  }
1619
- }), rr = vt.create({
1603
+ }), nr = vt.create({
1620
1604
  name: "blockProps",
1621
1605
  addCommands() {
1622
1606
  return {
1623
1607
  setBlockProp: (t, e) => ({ state: n, tr: r, dispatch: o }) => {
1624
- const { from: l, to: a } = n.selection;
1625
- let u = !1;
1626
- return n.doc.nodesBetween(l, a, (c, g) => {
1627
- const p = c.type.name;
1628
- if (p === "bulletList" || p === "orderedList" || !c.isBlock || c.isAtom) return !1;
1608
+ const { from: l, to: c } = n.selection;
1609
+ let d = !1;
1610
+ return n.doc.nodesBetween(l, c, (s, f) => {
1611
+ const p = s.type.name;
1612
+ if (p === "bulletList" || p === "orderedList" || !s.isBlock || s.isAtom) return !1;
1629
1613
  if (!se(p, t)) return !0;
1630
1614
  if (p === "paragraph")
1631
- r.setNodeMarkup(g, void 0, {
1632
- ...c.attrs,
1615
+ r.setNodeMarkup(f, void 0, {
1616
+ ...s.attrs,
1633
1617
  [re[t]]: e
1634
1618
  });
1635
1619
  else {
1636
- const b = oe(c.attrs.props);
1637
- e == null || e === "" ? delete b[t] : b[t] = e, r.setNodeMarkup(g, void 0, {
1638
- ...c.attrs,
1639
- props: JSON.stringify(b)
1620
+ const h = oe(s.attrs.props);
1621
+ e == null || e === "" ? delete h[t] : h[t] = e, r.setNodeMarkup(f, void 0, {
1622
+ ...s.attrs,
1623
+ props: JSON.stringify(h)
1640
1624
  });
1641
1625
  }
1642
- return u = !0, !1;
1643
- }), u && o && o(r), u;
1626
+ return d = !0, !1;
1627
+ }), d && o && o(r), d;
1644
1628
  }
1645
1629
  };
1646
1630
  }
1647
1631
  });
1648
- function Z(t, e) {
1632
+ function X(t, e) {
1649
1633
  if (!t) return null;
1650
1634
  const { state: n } = t, { from: r, to: o } = n.selection;
1651
1635
  let l = null;
1652
- return n.doc.nodesBetween(r, o, (a) => {
1636
+ return n.doc.nodesBetween(r, o, (c) => {
1653
1637
  if (l !== null) return !1;
1654
- const u = a.type.name;
1655
- if (!se(u, e)) return !0;
1656
- if (u === "paragraph") {
1657
- const c = a.attrs[re[e]];
1658
- l = c != null ? String(c) : "";
1638
+ const d = c.type.name;
1639
+ if (!se(d, e)) return !0;
1640
+ if (d === "paragraph") {
1641
+ const s = c.attrs[re[e]];
1642
+ l = s != null ? String(s) : "";
1659
1643
  } else
1660
- l = oe(a.attrs.props)[e] ?? "";
1644
+ l = oe(c.attrs.props)[e] ?? "";
1661
1645
  return !1;
1662
1646
  }), l;
1663
1647
  }
@@ -1670,7 +1654,7 @@ const Kt = {
1670
1654
  trust: { label: "Trust", icon: "Tr", color: "#eab308" },
1671
1655
  layout: { label: "Layout", icon: "Pg", color: "#64748b" }
1672
1656
  };
1673
- function or(t) {
1657
+ function rr(t) {
1674
1658
  const e = document.createElement("iframe");
1675
1659
  e.setAttribute("aria-hidden", "true"), e.style.cssText = "position:fixed;right:0;bottom:0;width:210mm;height:297mm;border:0;visibility:hidden;", document.body.appendChild(e);
1676
1660
  let n = !1;
@@ -1688,21 +1672,21 @@ function or(t) {
1688
1672
  const o = e.contentWindow.document;
1689
1673
  o.open(), o.write(t), o.close(), o.readyState === "complete" && window.setTimeout(r, 250);
1690
1674
  }
1691
- function sr(t, e) {
1675
+ function or(t, e) {
1692
1676
  return t.includes("</head>") ? t.replace("</head>", `<style>${e}</style></head>`) : t;
1693
1677
  }
1694
1678
  const ie = ".it-doc-callout{background:none!important;border:1px solid #ccc!important}", qt = _e;
1695
- function ir(t, e) {
1679
+ function sr(t, e) {
1696
1680
  const n = document.querySelector(".docs-page .tiptap");
1697
1681
  if (!n) return null;
1698
1682
  const r = n.cloneNode(!0);
1699
- r.querySelectorAll("[data-it-spacer]").forEach((b) => b.remove());
1683
+ r.querySelectorAll("[data-it-spacer]").forEach((h) => h.remove());
1700
1684
  const o = r.innerHTML, l = Array.from(
1701
1685
  document.querySelectorAll('style, link[rel="stylesheet"]')
1702
- ).map((b) => b.outerHTML).join(`
1703
- `), a = zt(t), u = a.autoHeight ? `${a.width}px auto` : `${a.width}px ${a.height}px`, c = `${a.marginTop}px ${a.marginRight}px ${a.marginBottom}px ${a.marginLeft}px`;
1704
- let g = `@page{size:${u};margin:${c};}`;
1705
- a.header && (g += `@page{@top-center{content:${qt(a.header)};font:10px -apple-system,sans-serif;color:#9aa0a6;}}`), a.footer && (g += `@page{@bottom-center{content:${qt(a.footer)};font:10px -apple-system,sans-serif;color:#9aa0a6;}}`);
1686
+ ).map((h) => h.outerHTML).join(`
1687
+ `), c = Mt(t), d = c.autoHeight ? `${c.width}px auto` : `${c.width}px ${c.height}px`, s = `${c.marginTop}px ${c.marginRight}px ${c.marginBottom}px ${c.marginLeft}px`;
1688
+ let f = `@page{size:${d};margin:${s};}`;
1689
+ c.header && (f += `@page{@top-center{content:${qt(c.header)};font:10px -apple-system,sans-serif;color:#9aa0a6;}}`), c.footer && (f += `@page{@bottom-center{content:${qt(c.footer)};font:10px -apple-system,sans-serif;color:#9aa0a6;}}`);
1706
1690
  const p = `
1707
1691
  html,body{margin:0;background:#fff;}
1708
1692
  .docs-page,.docs-page.docs-sheet{box-shadow:none;border-radius:0;margin:0;width:auto;min-height:0;padding:0;background:#fff;}
@@ -1710,29 +1694,29 @@ function ir(t, e) {
1710
1694
  [data-it-spacer]{display:none!important;}
1711
1695
  ${e === "minimal-ink" ? ie : ""}
1712
1696
  `;
1713
- return `<!doctype html><html><head><meta charset="utf-8">${l}<style>${g}${p}</style></head><body><div class="docs-page docs-sheet"><div class="tiptap">${o}</div></div></body></html>`;
1697
+ return `<!doctype html><html><head><meta charset="utf-8">${l}<style>${f}${p}</style></head><body><div class="docs-page docs-sheet"><div class="tiptap">${o}</div></div></body></html>`;
1714
1698
  }
1715
- function ar(t, e, n) {
1699
+ function ir(t, e, n) {
1716
1700
  const r = new Blob([t], { type: n }), o = URL.createObjectURL(r), l = document.createElement("a");
1717
1701
  l.href = o, l.download = e, l.click(), URL.revokeObjectURL(o);
1718
1702
  }
1719
1703
  function ae(t, e, n) {
1720
- let r = ir(t, n);
1704
+ let r = sr(t, n);
1721
1705
  if (!r) {
1722
- const o = tt(t);
1723
- r = Me(o, { theme: e }), n === "minimal-ink" && (r = sr(r, ie));
1706
+ const o = et(t);
1707
+ r = ze(o, { theme: e }), n === "minimal-ink" && (r = or(r, ie));
1724
1708
  }
1725
1709
  return r;
1726
1710
  }
1727
- function cr(t, e, n = "normal") {
1711
+ function ar(t, e, n = "normal") {
1728
1712
  try {
1729
- or(ae(t, e, n));
1713
+ rr(ae(t, e, n));
1730
1714
  } catch {
1731
1715
  }
1732
1716
  }
1733
- function lr(t, e, n = "normal") {
1717
+ function cr(t, e, n = "normal") {
1734
1718
  try {
1735
- ar(
1719
+ ir(
1736
1720
  ae(t, e, n),
1737
1721
  "document.html",
1738
1722
  "text/html"
@@ -1740,28 +1724,28 @@ function lr(t, e, n = "normal") {
1740
1724
  } catch {
1741
1725
  }
1742
1726
  }
1743
- function dr() {
1744
- return ze();
1727
+ function lr() {
1728
+ return Me();
1745
1729
  }
1746
- const Ct = [
1730
+ const At = [
1747
1731
  { label: "Normal text", node: "paragraph" },
1748
1732
  { label: "Title", node: "itTitle" },
1749
1733
  { label: "Section", node: "itSection" },
1750
1734
  { label: "Subsection", node: "itSub" },
1751
1735
  { label: "Summary", node: "itSummary" },
1752
1736
  { label: "Quote", node: "itQuote" }
1753
- ], ur = /* @__PURE__ */ new Set([
1737
+ ], dr = /* @__PURE__ */ new Set([
1754
1738
  "history",
1755
1739
  "revision",
1756
1740
  "track",
1757
1741
  "freeze"
1758
- ]), pr = /* @__PURE__ */ new Set([
1742
+ ]), ur = /* @__PURE__ */ new Set([
1759
1743
  "agent",
1760
1744
  "model",
1761
1745
  "meta",
1762
1746
  "context",
1763
1747
  "history"
1764
- ]), fr = [
1748
+ ]), pr = [
1765
1749
  "identity",
1766
1750
  "structure",
1767
1751
  "content",
@@ -1777,7 +1761,7 @@ const Ct = [
1777
1761
  { label: "Courier New", value: "Courier New" },
1778
1762
  { label: "Verdana", value: "Verdana" },
1779
1763
  { label: "Trebuchet MS", value: "Trebuchet MS" }
1780
- ], gr = ["1", "1.15", "1.5", "2", "2.5", "3"], mr = "12px", hr = [
1764
+ ], fr = ["1", "1.15", "1.5", "2", "2.5", "3"], gr = "12px", hr = [
1781
1765
  "#000000",
1782
1766
  "#434343",
1783
1767
  "#666666",
@@ -1828,7 +1812,7 @@ const Ct = [
1828
1812
  "#6fa8dc",
1829
1813
  "#8e7cc3",
1830
1814
  "#c27ba0"
1831
- ], br = [
1815
+ ], mr = [
1832
1816
  "#ffffff",
1833
1817
  "#cfe2f3",
1834
1818
  "#d9ead3",
@@ -1847,7 +1831,7 @@ function $({
1847
1831
  title: r,
1848
1832
  children: o
1849
1833
  }) {
1850
- return /* @__PURE__ */ i(
1834
+ return /* @__PURE__ */ a(
1851
1835
  "button",
1852
1836
  {
1853
1837
  className: `docs-tb-btn${e ? " active" : ""}`,
@@ -1863,288 +1847,293 @@ function dt({
1863
1847
  children: e,
1864
1848
  className: n = ""
1865
1849
  }) {
1866
- return /* @__PURE__ */ h("div", { className: `ribbon-group ${n}`.trim(), children: [
1867
- /* @__PURE__ */ i("div", { className: "ribbon-group-row", children: e }),
1868
- /* @__PURE__ */ i("div", { className: "ribbon-group-label", children: t })
1869
- ] });
1850
+ return /* @__PURE__ */ a(
1851
+ "div",
1852
+ {
1853
+ className: `ribbon-group ${n}`.trim(),
1854
+ role: "group",
1855
+ "aria-label": t,
1856
+ children: e
1857
+ }
1858
+ );
1870
1859
  }
1871
- function mt() {
1872
- return /* @__PURE__ */ i("div", { className: "ribbon-sep" });
1860
+ function ht() {
1861
+ return /* @__PURE__ */ a("div", { className: "ribbon-sep" });
1873
1862
  }
1874
- function yr({
1863
+ function br({
1875
1864
  editor: t,
1876
1865
  isRtl: e = !1,
1877
1866
  onToggleRtl: n,
1878
1867
  content: r,
1879
1868
  theme: o,
1880
1869
  onThemeChange: l,
1881
- onTrustAction: a,
1882
- locked: u = !1
1870
+ onTrustAction: c,
1871
+ locked: d = !1
1883
1872
  }) {
1884
- const [c, g] = B(!1), [p, b] = B(!1), [f, k] = B(!1), [T, M] = B(!1), [S, v] = B(!1), [nt, I] = B(!1), [G, U] = B(!1), F = P(null), rt = P(null), N = P(null), H = P(null), ot = P(null), Y = P(null);
1873
+ const [s, f] = P(!1), [p, h] = P(!1), [g, k] = P(!1), [M, C] = P(!1), [v, w] = P(!1), [I, O] = P(!1), [K, q] = P(!1), W = B(null), rt = B(null), N = B(null), H = B(null), ot = B(null), G = B(null);
1885
1874
  j(() => {
1886
- const d = (A) => {
1887
- const w = A.target;
1888
- F.current && !F.current.contains(w) && g(!1), rt.current && !rt.current.contains(w) && b(!1), N.current && !N.current.contains(w) && k(!1), H.current && !H.current.contains(w) && M(!1), ot.current && !ot.current.contains(w) && v(!1), Y.current && !Y.current.contains(w) && I(!1);
1875
+ const u = (x) => {
1876
+ const S = x.target;
1877
+ W.current && !W.current.contains(S) && f(!1), rt.current && !rt.current.contains(S) && h(!1), N.current && !N.current.contains(S) && k(!1), H.current && !H.current.contains(S) && C(!1), ot.current && !ot.current.contains(S) && w(!1), G.current && !G.current.contains(S) && O(!1);
1889
1878
  };
1890
- return document.addEventListener("mousedown", d), () => document.removeEventListener("mousedown", d);
1879
+ return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
1891
1880
  }, []);
1892
- const C = () => {
1893
- g(!1), b(!1), k(!1), M(!1), v(!1), I(!1);
1881
+ const L = () => {
1882
+ f(!1), h(!1), k(!1), C(!1), w(!1), O(!1);
1894
1883
  }, st = R(() => {
1895
1884
  if (!t) return "Normal text";
1896
- for (const d of Ct)
1897
- if (d.node === "paragraph" && t.isActive("paragraph")) {
1898
- if (!Ct.some(
1899
- (w) => w.node !== "paragraph" && t.isActive(w.node)
1900
- )) return d.label;
1901
- } else if (t.isActive(d.node))
1902
- return d.label;
1885
+ for (const u of At)
1886
+ if (u.node === "paragraph" && t.isActive("paragraph")) {
1887
+ if (!At.some(
1888
+ (S) => S.node !== "paragraph" && t.isActive(S.node)
1889
+ )) return u.label;
1890
+ } else if (t.isActive(u.node))
1891
+ return u.label;
1903
1892
  return "Normal text";
1904
1893
  }, [t]), ut = R(() => {
1905
1894
  if (!t) return "Default";
1906
- const d = t.getAttributes("textStyle")?.fontFamily;
1907
- if (!d) return "Default";
1908
- const A = Jt.find((w) => w.value === d);
1909
- return A ? A.label : "Default";
1910
- }, [t]), [J, pt] = B(11), [, at] = B(0), m = K(() => {
1911
- const d = /* @__PURE__ */ new Map();
1912
- for (const w of He) {
1913
- if (w.status !== "stable" || pr.has(w.canonical) || w.category === "agent") continue;
1914
- const Q = w.category, bt = d.get(Q) || [];
1895
+ const u = t.getAttributes("textStyle")?.fontFamily;
1896
+ if (!u) return "Default";
1897
+ const x = Jt.find((S) => S.value === u);
1898
+ return x ? x.label : "Default";
1899
+ }, [t]), [V, pt] = P(11), [, at] = P(0), m = Y(() => {
1900
+ const u = /* @__PURE__ */ new Map();
1901
+ for (const S of He) {
1902
+ if (S.status !== "stable" || ur.has(S.canonical) || S.category === "agent") continue;
1903
+ const Z = S.category, bt = u.get(Z) || [];
1915
1904
  bt.push({
1916
- label: w.canonical,
1917
- keyword: w.canonical,
1918
- category: Q,
1919
- description: w.description,
1920
- isReadOnly: ur.has(w.canonical)
1921
- }), d.set(Q, bt);
1905
+ label: S.canonical,
1906
+ keyword: S.canonical,
1907
+ category: Z,
1908
+ description: S.description,
1909
+ isReadOnly: dr.has(S.canonical)
1910
+ }), u.set(Z, bt);
1922
1911
  }
1923
- const A = [];
1924
- for (const w of fr) {
1925
- const Q = d.get(w);
1926
- !Q || Q.length === 0 || (Q.sort((bt, me) => bt.keyword.localeCompare(me.keyword)), A.push({
1927
- category: Kt[w]?.label || w,
1928
- items: Q
1912
+ const x = [];
1913
+ for (const S of pr) {
1914
+ const Z = u.get(S);
1915
+ !Z || Z.length === 0 || (Z.sort((bt, he) => bt.keyword.localeCompare(he.keyword)), x.push({
1916
+ category: Kt[S]?.label || S,
1917
+ items: Z
1929
1918
  }));
1930
1919
  }
1931
- return A;
1920
+ return x;
1932
1921
  }, []);
1933
1922
  j(() => {
1934
1923
  if (!t) return;
1935
- const d = () => {
1936
- const A = t.getAttributes("textStyle");
1937
- if (A?.fontSize) {
1938
- const w = parseInt(A.fontSize, 10);
1939
- isNaN(w) || pt(w);
1924
+ const u = () => {
1925
+ const x = t.getAttributes("textStyle");
1926
+ if (x?.fontSize) {
1927
+ const S = parseInt(x.fontSize, 10);
1928
+ isNaN(S) || pt(S);
1940
1929
  }
1941
- at((w) => w + 1);
1930
+ at((S) => S + 1);
1942
1931
  };
1943
- return t.on("selectionUpdate", d), t.on("transaction", d), () => {
1944
- t.off("selectionUpdate", d), t.off("transaction", d);
1932
+ return t.on("selectionUpdate", u), t.on("transaction", u), () => {
1933
+ t.off("selectionUpdate", u), t.off("transaction", u);
1945
1934
  };
1946
1935
  }, [t]);
1947
1936
  const y = R(
1948
- (d) => {
1949
- t && (d === "paragraph" ? t.chain().focus().setParagraph().run() : d === "itQuote" ? t.chain().focus().setNode("itQuote").run() : t.chain().focus().setNode(d).run(), C());
1937
+ (u) => {
1938
+ t && (u === "paragraph" ? t.chain().focus().setParagraph().run() : u === "itQuote" ? t.chain().focus().setNode("itQuote").run() : t.chain().focus().setNode(u).run(), L());
1950
1939
  },
1951
1940
  [t]
1952
- ), x = R(
1953
- (d) => {
1941
+ ), T = R(
1942
+ (u) => {
1954
1943
  if (!t) return;
1955
- const A = t.chain().focus();
1956
- d === "divider" ? A.setNode("itDivider").run() : d === "break" ? A.setNode("itBreak").run() : d === "code" ? A.setNode("itCode", { lang: "" }).run() : ["tip", "info", "warning", "danger", "success"].includes(d) ? A.setNode("itCallout", { variant: d }).run() : A.setNode("itGenericBlock", { keyword: d, properties: "" }).run(), C();
1944
+ const x = t.chain().focus();
1945
+ u === "divider" ? x.setNode("itDivider").run() : u === "break" ? x.setNode("itBreak").run() : u === "code" ? x.setNode("itCode", { lang: "" }).run() : ["tip", "info", "warning", "danger", "success"].includes(u) ? x.setNode("itCallout", { variant: u }).run() : x.setNode("itGenericBlock", { keyword: u, properties: "" }).run(), L();
1957
1946
  },
1958
1947
  [t]
1959
- ), O = R(
1960
- (d) => {
1961
- const A = Math.min(96, Math.max(8, J + d));
1962
- pt(A), t?.chain().focus().setFontSize(`${A}pt`).run();
1948
+ ), D = R(
1949
+ (u) => {
1950
+ const x = Math.min(96, Math.max(8, V + u));
1951
+ pt(x), t?.chain().focus().setFontSize(`${x}pt`).run();
1963
1952
  },
1964
- [t, J]
1965
- ), V = R(
1966
- (d) => {
1967
- t?.chain().focus().setBlockProp("leading", d).run(), C();
1953
+ [t, V]
1954
+ ), Q = R(
1955
+ (u) => {
1956
+ t?.chain().focus().setBlockProp("leading", u).run(), L();
1968
1957
  },
1969
1958
  [t]
1970
- ), W = R(
1971
- (d) => {
1959
+ ), U = R(
1960
+ (u) => {
1972
1961
  if (!t) return;
1973
- const A = Z(t, d);
1974
- t.chain().focus().setBlockProp(d, A ? null : mr).run(), C();
1962
+ const x = X(t, u);
1963
+ t.chain().focus().setBlockProp(u, x ? null : gr).run(), L();
1975
1964
  },
1976
1965
  [t]
1977
1966
  ), ce = R(() => {
1978
1967
  if (!t) return;
1979
- const d = window.prompt(
1968
+ const u = window.prompt(
1980
1969
  "Space before block (e.g. 12px, 1em — empty for none):",
1981
- Z(t, "space-before") || ""
1970
+ X(t, "space-before") || ""
1982
1971
  );
1983
- if (d === null) return;
1984
- const A = window.prompt(
1972
+ if (u === null) return;
1973
+ const x = window.prompt(
1985
1974
  "Space after block (e.g. 12px, 1em — empty for none):",
1986
- Z(t, "space-after") || ""
1975
+ X(t, "space-after") || ""
1987
1976
  );
1988
- A !== null && (t.chain().focus().setBlockProp("space-before", d.trim() || null).setBlockProp("space-after", A.trim() || null).run(), C());
1977
+ x !== null && (t.chain().focus().setBlockProp("space-before", u.trim() || null).setBlockProp("space-after", x.trim() || null).run(), L());
1989
1978
  }, [t]), le = R(() => {
1990
1979
  if (!t) return;
1991
- const d = Z(t, "end"), A = window.prompt(
1980
+ const u = X(t, "end"), x = window.prompt(
1992
1981
  "Line-end text (shown at the end of the line — empty to remove):",
1993
- d || ""
1982
+ u || ""
1994
1983
  );
1995
- A !== null && t.chain().focus().setBlockProp("end", A.trim() || null).run();
1984
+ x !== null && t.chain().focus().setBlockProp("end", x.trim() || null).run();
1996
1985
  }, [t]), de = R(() => {
1997
1986
  t && (t.chain().focus().insertContent({
1998
1987
  type: "paragraph",
1999
1988
  attrs: { end: "End text" },
2000
1989
  content: [{ type: "text", text: "Start text" }]
2001
- }).run(), C());
2002
- }, [t]), ue = K(() => dr(), []), ht = G ? "minimal-ink" : "normal", pe = R(
2003
- () => cr(r, o, ht),
2004
- [r, o, ht]
1990
+ }).run(), L());
1991
+ }, [t]), ue = Y(() => lr(), []), mt = K ? "minimal-ink" : "normal", pe = R(
1992
+ () => ar(r, o, mt),
1993
+ [r, o, mt]
2005
1994
  ), fe = R(
2006
- () => lr(r, o, ht),
2007
- [r, o, ht]
1995
+ () => cr(r, o, mt),
1996
+ [r, o, mt]
2008
1997
  );
2009
1998
  if (!t) return null;
2010
- const Tt = Z(t, "leading"), ge = !!Z(t, "end");
2011
- return /* @__PURE__ */ h("div", { className: "docs-toolbar docs-ribbon", children: [
2012
- /* @__PURE__ */ h(dt, { label: "Edit", children: [
2013
- /* @__PURE__ */ i(
1999
+ const Tt = X(t, "leading"), ge = !!X(t, "end");
2000
+ return /* @__PURE__ */ b("div", { className: "docs-toolbar docs-ribbon", children: [
2001
+ /* @__PURE__ */ b(dt, { label: "Edit", children: [
2002
+ /* @__PURE__ */ a(
2014
2003
  $,
2015
2004
  {
2016
2005
  onClick: () => t.chain().focus().undo().run(),
2017
- disabled: u || !t.can().undo(),
2006
+ disabled: d || !t.can().undo(),
2018
2007
  title: "Undo (⌘Z)",
2019
- children: /* @__PURE__ */ i(Oe, { size: 16 })
2008
+ children: /* @__PURE__ */ a(Oe, { size: 16 })
2020
2009
  }
2021
2010
  ),
2022
- /* @__PURE__ */ i(
2011
+ /* @__PURE__ */ a(
2023
2012
  $,
2024
2013
  {
2025
2014
  onClick: () => t.chain().focus().redo().run(),
2026
- disabled: u || !t.can().redo(),
2015
+ disabled: d || !t.can().redo(),
2027
2016
  title: "Redo (⌘⇧Z)",
2028
- children: /* @__PURE__ */ i(De, { size: 16 })
2017
+ children: /* @__PURE__ */ a(De, { size: 16 })
2029
2018
  }
2030
2019
  )
2031
2020
  ] }),
2032
- /* @__PURE__ */ i(mt, {}),
2033
- /* @__PURE__ */ h(dt, { label: "File", children: [
2034
- /* @__PURE__ */ h($, { onClick: pe, title: "Print / Export PDF (WYSIWYG)", children: [
2035
- /* @__PURE__ */ i(Fe, { size: 16 }),
2036
- /* @__PURE__ */ i("span", { className: "ribbon-btn-text", children: "PDF" })
2021
+ /* @__PURE__ */ a(ht, {}),
2022
+ /* @__PURE__ */ b(dt, { label: "File", children: [
2023
+ /* @__PURE__ */ b($, { onClick: pe, title: "Print / Export PDF (WYSIWYG)", children: [
2024
+ /* @__PURE__ */ a(Fe, { size: 16 }),
2025
+ /* @__PURE__ */ a("span", { className: "ribbon-btn-text", children: "PDF" })
2037
2026
  ] }),
2038
- /* @__PURE__ */ h($, { onClick: fe, title: "Export HTML", children: [
2039
- /* @__PURE__ */ i(je, { size: 16 }),
2040
- /* @__PURE__ */ i("span", { className: "ribbon-btn-text", children: "HTML" })
2027
+ /* @__PURE__ */ b($, { onClick: fe, title: "Export HTML", children: [
2028
+ /* @__PURE__ */ a(je, { size: 16 }),
2029
+ /* @__PURE__ */ a("span", { className: "ribbon-btn-text", children: "HTML" })
2041
2030
  ] }),
2042
- /* @__PURE__ */ i(
2031
+ /* @__PURE__ */ a(
2043
2032
  $,
2044
2033
  {
2045
- onClick: () => U((d) => !d),
2046
- active: G,
2034
+ onClick: () => q((u) => !u),
2035
+ active: K,
2047
2036
  title: "Minimal ink mode (plain callouts when printing)",
2048
- children: /* @__PURE__ */ i(We, { size: 16 })
2037
+ children: /* @__PURE__ */ a(We, { size: 16 })
2049
2038
  }
2050
2039
  ),
2051
- /* @__PURE__ */ i(
2040
+ /* @__PURE__ */ a(
2052
2041
  "select",
2053
2042
  {
2054
2043
  className: "ribbon-theme-select",
2055
2044
  value: o,
2056
- onChange: (d) => l(d.target.value),
2045
+ onChange: (u) => l(u.target.value),
2057
2046
  title: "Document theme (used by print/export)",
2058
- children: ue.map((d) => /* @__PURE__ */ i("option", { value: d, children: d.charAt(0).toUpperCase() + d.slice(1) }, d))
2047
+ children: ue.map((u) => /* @__PURE__ */ a("option", { value: u, children: u.charAt(0).toUpperCase() + u.slice(1) }, u))
2059
2048
  }
2060
2049
  )
2061
2050
  ] }),
2062
- /* @__PURE__ */ i(mt, {}),
2063
- /* @__PURE__ */ h("div", { className: u ? "ribbon-locked" : "ribbon-editing", children: [
2064
- /* @__PURE__ */ h(dt, { label: "Text", children: [
2065
- /* @__PURE__ */ h("div", { className: "docs-tb-dropdown", ref: N, children: [
2066
- /* @__PURE__ */ h(
2051
+ /* @__PURE__ */ a(ht, {}),
2052
+ /* @__PURE__ */ b("div", { className: d ? "ribbon-locked" : "ribbon-editing", children: [
2053
+ /* @__PURE__ */ b(dt, { label: "Text", children: [
2054
+ /* @__PURE__ */ b("div", { className: "docs-tb-dropdown", ref: N, children: [
2055
+ /* @__PURE__ */ b(
2067
2056
  "button",
2068
2057
  {
2069
2058
  className: "docs-tb-select docs-tb-font-select",
2070
2059
  onClick: () => {
2071
- C(), k(!f);
2060
+ L(), k(!g);
2072
2061
  },
2073
2062
  children: [
2074
- /* @__PURE__ */ i("span", { className: "docs-tb-select-label", children: ut() }),
2075
- /* @__PURE__ */ i(yt, { size: 14 })
2063
+ /* @__PURE__ */ a("span", { className: "docs-tb-select-label", children: ut() }),
2064
+ /* @__PURE__ */ a(yt, { size: 14 })
2076
2065
  ]
2077
2066
  }
2078
2067
  ),
2079
- f && /* @__PURE__ */ i("div", { className: "docs-tb-dropdown-menu docs-font-menu", children: Jt.map((d) => /* @__PURE__ */ i(
2068
+ g && /* @__PURE__ */ a("div", { className: "docs-tb-dropdown-menu docs-font-menu", children: Jt.map((u) => /* @__PURE__ */ a(
2080
2069
  "button",
2081
2070
  {
2082
- className: `docs-tb-dropdown-item${ut() === d.label ? " active" : ""}`,
2083
- style: { fontFamily: d.value || "inherit" },
2071
+ className: `docs-tb-dropdown-item${ut() === u.label ? " active" : ""}`,
2072
+ style: { fontFamily: u.value || "inherit" },
2084
2073
  onClick: () => {
2085
- d.value ? t.chain().focus().setFontFamily(d.value).run() : t.chain().focus().unsetFontFamily().run(), C();
2074
+ u.value ? t.chain().focus().setFontFamily(u.value).run() : t.chain().focus().unsetFontFamily().run(), L();
2086
2075
  },
2087
- children: d.label
2076
+ children: u.label
2088
2077
  },
2089
- d.value || "default"
2078
+ u.value || "default"
2090
2079
  )) })
2091
2080
  ] }),
2092
- /* @__PURE__ */ i($, { onClick: () => O(-1), title: "Decrease font size", children: /* @__PURE__ */ i(Ge, { size: 14 }) }),
2093
- /* @__PURE__ */ i("span", { className: "docs-tb-fontsize", children: J }),
2094
- /* @__PURE__ */ i($, { onClick: () => O(1), title: "Increase font size", children: /* @__PURE__ */ i(Pt, { size: 14 }) }),
2095
- /* @__PURE__ */ i(
2081
+ /* @__PURE__ */ a($, { onClick: () => D(-1), title: "Decrease font size", children: /* @__PURE__ */ a(Ge, { size: 14 }) }),
2082
+ /* @__PURE__ */ a("span", { className: "docs-tb-fontsize", children: V }),
2083
+ /* @__PURE__ */ a($, { onClick: () => D(1), title: "Increase font size", children: /* @__PURE__ */ a(Bt, { size: 14 }) }),
2084
+ /* @__PURE__ */ a(
2096
2085
  $,
2097
2086
  {
2098
2087
  onClick: () => t.chain().focus().toggleBold().run(),
2099
2088
  active: t.isActive("bold"),
2100
2089
  title: "Bold (⌘B)",
2101
- children: /* @__PURE__ */ i(Ue, { size: 16 })
2090
+ children: /* @__PURE__ */ a(Ue, { size: 16 })
2102
2091
  }
2103
2092
  ),
2104
- /* @__PURE__ */ i(
2093
+ /* @__PURE__ */ a(
2105
2094
  $,
2106
2095
  {
2107
2096
  onClick: () => t.chain().focus().toggleItalic().run(),
2108
2097
  active: t.isActive("italic"),
2109
2098
  title: "Italic (⌘I)",
2110
- children: /* @__PURE__ */ i(Ye, { size: 16 })
2099
+ children: /* @__PURE__ */ a(Ye, { size: 16 })
2111
2100
  }
2112
2101
  ),
2113
- /* @__PURE__ */ i(
2102
+ /* @__PURE__ */ a(
2114
2103
  $,
2115
2104
  {
2116
2105
  onClick: () => t.chain().focus().toggleUnderline().run(),
2117
2106
  active: t.isActive("underline"),
2118
2107
  title: "Underline (⌘U)",
2119
- children: /* @__PURE__ */ i(Ke, { size: 16 })
2108
+ children: /* @__PURE__ */ a(Ke, { size: 16 })
2120
2109
  }
2121
2110
  ),
2122
- /* @__PURE__ */ i(
2111
+ /* @__PURE__ */ a(
2123
2112
  $,
2124
2113
  {
2125
2114
  onClick: () => t.chain().focus().toggleStrike().run(),
2126
2115
  active: t.isActive("strike"),
2127
2116
  title: "Strikethrough (⌘⇧X)",
2128
- children: /* @__PURE__ */ i(qe, { size: 16 })
2117
+ children: /* @__PURE__ */ a(qe, { size: 16 })
2129
2118
  }
2130
2119
  ),
2131
- /* @__PURE__ */ h(
2120
+ /* @__PURE__ */ b(
2132
2121
  "div",
2133
2122
  {
2134
2123
  className: "docs-tb-dropdown docs-tb-color-dropdown",
2135
2124
  ref: H,
2136
2125
  children: [
2137
- /* @__PURE__ */ h(
2126
+ /* @__PURE__ */ b(
2138
2127
  "button",
2139
2128
  {
2140
2129
  className: "docs-tb-btn docs-tb-color-btn",
2141
2130
  onClick: () => {
2142
- C(), M(!T);
2131
+ L(), C(!M);
2143
2132
  },
2144
2133
  title: "Text color",
2145
2134
  children: [
2146
- /* @__PURE__ */ i(Je, { size: 16 }),
2147
- /* @__PURE__ */ i(
2135
+ /* @__PURE__ */ a(Je, { size: 16 }),
2136
+ /* @__PURE__ */ a(
2148
2137
  "span",
2149
2138
  {
2150
2139
  className: "docs-tb-color-indicator",
@@ -2156,29 +2145,29 @@ function yr({
2156
2145
  ]
2157
2146
  }
2158
2147
  ),
2159
- T && /* @__PURE__ */ h("div", { className: "docs-tb-dropdown-menu docs-color-grid-menu", children: [
2160
- /* @__PURE__ */ i("div", { className: "docs-color-grid-label", children: "Text color" }),
2161
- /* @__PURE__ */ i("div", { className: "docs-color-grid", children: hr.map((d) => /* @__PURE__ */ i(
2148
+ M && /* @__PURE__ */ b("div", { className: "docs-tb-dropdown-menu docs-color-grid-menu", children: [
2149
+ /* @__PURE__ */ a("div", { className: "docs-color-grid-label", children: "Text color" }),
2150
+ /* @__PURE__ */ a("div", { className: "docs-color-grid", children: hr.map((u) => /* @__PURE__ */ a(
2162
2151
  "button",
2163
2152
  {
2164
2153
  className: "docs-color-swatch",
2165
- style: { background: d },
2166
- title: d,
2154
+ style: { background: u },
2155
+ title: u,
2167
2156
  onClick: () => {
2168
- t.chain().focus().setColor(d).run(), C();
2157
+ t.chain().focus().setColor(u).run(), L();
2169
2158
  }
2170
2159
  },
2171
- d
2160
+ u
2172
2161
  )) }),
2173
- /* @__PURE__ */ h(
2162
+ /* @__PURE__ */ b(
2174
2163
  "button",
2175
2164
  {
2176
2165
  className: "docs-tb-dropdown-item",
2177
2166
  onClick: () => {
2178
- t.chain().focus().unsetColor().run(), C();
2167
+ t.chain().focus().unsetColor().run(), L();
2179
2168
  },
2180
2169
  children: [
2181
- /* @__PURE__ */ i(It, { size: 14 }),
2170
+ /* @__PURE__ */ a(It, { size: 14 }),
2182
2171
  " Reset"
2183
2172
  ]
2184
2173
  }
@@ -2187,23 +2176,23 @@ function yr({
2187
2176
  ]
2188
2177
  }
2189
2178
  ),
2190
- /* @__PURE__ */ h(
2179
+ /* @__PURE__ */ b(
2191
2180
  "div",
2192
2181
  {
2193
2182
  className: "docs-tb-dropdown docs-tb-color-dropdown",
2194
2183
  ref: ot,
2195
2184
  children: [
2196
- /* @__PURE__ */ h(
2185
+ /* @__PURE__ */ b(
2197
2186
  "button",
2198
2187
  {
2199
2188
  className: "docs-tb-btn docs-tb-color-btn",
2200
2189
  onClick: () => {
2201
- C(), v(!S);
2190
+ L(), w(!v);
2202
2191
  },
2203
2192
  title: "Highlight color",
2204
2193
  children: [
2205
- /* @__PURE__ */ i(Ve, { size: 16 }),
2206
- /* @__PURE__ */ i(
2194
+ /* @__PURE__ */ a(Ve, { size: 16 }),
2195
+ /* @__PURE__ */ a(
2207
2196
  "span",
2208
2197
  {
2209
2198
  className: "docs-tb-color-indicator",
@@ -2215,135 +2204,117 @@ function yr({
2215
2204
  ]
2216
2205
  }
2217
2206
  ),
2218
- S && /* @__PURE__ */ h("div", { className: "docs-tb-dropdown-menu docs-color-grid-menu", children: [
2219
- /* @__PURE__ */ i("div", { className: "docs-color-grid-label", children: "Highlight color" }),
2220
- /* @__PURE__ */ i("div", { className: "docs-color-grid docs-highlight-grid", children: br.map((d) => /* @__PURE__ */ i(
2207
+ v && /* @__PURE__ */ b("div", { className: "docs-tb-dropdown-menu docs-color-grid-menu", children: [
2208
+ /* @__PURE__ */ a("div", { className: "docs-color-grid-label", children: "Highlight color" }),
2209
+ /* @__PURE__ */ a("div", { className: "docs-color-grid docs-highlight-grid", children: mr.map((u) => /* @__PURE__ */ a(
2221
2210
  "button",
2222
2211
  {
2223
2212
  className: "docs-color-swatch",
2224
- style: { background: d },
2225
- title: d,
2213
+ style: { background: u },
2214
+ title: u,
2226
2215
  onClick: () => {
2227
- d === "#ffffff" ? t.chain().focus().unsetHighlight().run() : t.chain().focus().toggleHighlight({ color: d }).run(), C();
2216
+ u === "#ffffff" ? t.chain().focus().unsetHighlight().run() : t.chain().focus().toggleHighlight({ color: u }).run(), L();
2228
2217
  }
2229
2218
  },
2230
- d
2219
+ u
2231
2220
  )) })
2232
2221
  ] })
2233
2222
  ]
2234
2223
  }
2235
2224
  ),
2236
- /* @__PURE__ */ i(
2237
- $,
2238
- {
2239
- onClick: () => t.chain().focus().toggleSubscript().run(),
2240
- active: t.isActive("subscript"),
2241
- title: "Subscript",
2242
- children: /* @__PURE__ */ i(Qe, { size: 16 })
2243
- }
2244
- ),
2245
- /* @__PURE__ */ i(
2246
- $,
2247
- {
2248
- onClick: () => t.chain().focus().toggleSuperscript().run(),
2249
- active: t.isActive("superscript"),
2250
- title: "Superscript",
2251
- children: /* @__PURE__ */ i(Ze, { size: 16 })
2252
- }
2253
- ),
2254
- /* @__PURE__ */ i(
2225
+ /* @__PURE__ */ a(
2255
2226
  $,
2256
2227
  {
2257
2228
  onClick: () => t.chain().focus().toggleCode().run(),
2258
2229
  active: t.isActive("code"),
2259
2230
  title: "Inline code",
2260
- children: /* @__PURE__ */ i(Xe, { size: 16 })
2231
+ children: /* @__PURE__ */ a(Qe, { size: 16 })
2261
2232
  }
2262
2233
  ),
2263
- /* @__PURE__ */ i(
2234
+ /* @__PURE__ */ a(
2264
2235
  $,
2265
2236
  {
2266
2237
  onClick: () => t.chain().focus().unsetAllMarks().clearNodes().run(),
2267
2238
  title: "Clear formatting",
2268
- children: /* @__PURE__ */ i(It, { size: 16 })
2239
+ children: /* @__PURE__ */ a(It, { size: 16 })
2269
2240
  }
2270
2241
  )
2271
2242
  ] }),
2272
- /* @__PURE__ */ i(mt, {}),
2273
- /* @__PURE__ */ h(dt, { label: "Paragraph", children: [
2274
- /* @__PURE__ */ h("div", { className: "docs-tb-dropdown", ref: F, children: [
2275
- /* @__PURE__ */ h(
2243
+ /* @__PURE__ */ a(ht, {}),
2244
+ /* @__PURE__ */ b(dt, { label: "Paragraph", children: [
2245
+ /* @__PURE__ */ b("div", { className: "docs-tb-dropdown", ref: W, children: [
2246
+ /* @__PURE__ */ b(
2276
2247
  "button",
2277
2248
  {
2278
2249
  className: "docs-tb-select docs-tb-paragraph-select",
2279
2250
  onClick: () => {
2280
- C(), g(!c);
2251
+ L(), f(!s);
2281
2252
  },
2282
2253
  children: [
2283
- /* @__PURE__ */ i("span", { className: "docs-tb-select-label", children: st() }),
2284
- /* @__PURE__ */ i(yt, { size: 14 })
2254
+ /* @__PURE__ */ a("span", { className: "docs-tb-select-label", children: st() }),
2255
+ /* @__PURE__ */ a(yt, { size: 14 })
2285
2256
  ]
2286
2257
  }
2287
2258
  ),
2288
- c && /* @__PURE__ */ i("div", { className: "docs-tb-dropdown-menu docs-style-menu", children: Ct.map((d) => /* @__PURE__ */ i(
2259
+ s && /* @__PURE__ */ a("div", { className: "docs-tb-dropdown-menu docs-style-menu", children: At.map((u) => /* @__PURE__ */ a(
2289
2260
  "button",
2290
2261
  {
2291
- className: `docs-tb-dropdown-item${st() === d.label ? " active" : ""}`,
2292
- onClick: () => y(d.node),
2293
- children: /* @__PURE__ */ i(
2262
+ className: `docs-tb-dropdown-item${st() === u.label ? " active" : ""}`,
2263
+ onClick: () => y(u.node),
2264
+ children: /* @__PURE__ */ a(
2294
2265
  "span",
2295
2266
  {
2296
- className: `docs-style-preview docs-style-${d.node}`,
2297
- children: d.label
2267
+ className: `docs-style-preview docs-style-${u.node}`,
2268
+ children: u.label
2298
2269
  }
2299
2270
  )
2300
2271
  },
2301
- d.node
2272
+ u.node
2302
2273
  )) })
2303
2274
  ] }),
2304
- /* @__PURE__ */ i(
2275
+ /* @__PURE__ */ a(
2305
2276
  $,
2306
2277
  {
2307
2278
  onClick: () => t.chain().focus().setTextAlign("left").run(),
2308
2279
  active: t.isActive({ textAlign: "left" }),
2309
2280
  title: "Align left",
2310
- children: /* @__PURE__ */ i(tn, { size: 16 })
2281
+ children: /* @__PURE__ */ a(Ze, { size: 16 })
2311
2282
  }
2312
2283
  ),
2313
- /* @__PURE__ */ i(
2284
+ /* @__PURE__ */ a(
2314
2285
  $,
2315
2286
  {
2316
2287
  onClick: () => t.chain().focus().setTextAlign("center").run(),
2317
2288
  active: t.isActive({ textAlign: "center" }),
2318
2289
  title: "Align center",
2319
- children: /* @__PURE__ */ i(en, { size: 16 })
2290
+ children: /* @__PURE__ */ a(Xe, { size: 16 })
2320
2291
  }
2321
2292
  ),
2322
- /* @__PURE__ */ i(
2293
+ /* @__PURE__ */ a(
2323
2294
  $,
2324
2295
  {
2325
2296
  onClick: () => t.chain().focus().setTextAlign("right").run(),
2326
2297
  active: t.isActive({ textAlign: "right" }),
2327
2298
  title: "Align right",
2328
- children: /* @__PURE__ */ i(nn, { size: 16 })
2299
+ children: /* @__PURE__ */ a(tn, { size: 16 })
2329
2300
  }
2330
2301
  ),
2331
- /* @__PURE__ */ i(
2302
+ /* @__PURE__ */ a(
2332
2303
  $,
2333
2304
  {
2334
2305
  onClick: () => t.chain().focus().setTextAlign("justify").run(),
2335
2306
  active: t.isActive({ textAlign: "justify" }),
2336
2307
  title: "Justify",
2337
- children: /* @__PURE__ */ i(rn, { size: 16 })
2308
+ children: /* @__PURE__ */ a(en, { size: 16 })
2338
2309
  }
2339
2310
  ),
2340
- /* @__PURE__ */ i(
2311
+ /* @__PURE__ */ a(
2341
2312
  $,
2342
2313
  {
2343
2314
  onClick: () => n?.(),
2344
2315
  active: e,
2345
2316
  title: e ? "Switch to LTR (left-to-right)" : "Switch to RTL (right-to-left)",
2346
- children: /* @__PURE__ */ i(
2317
+ children: /* @__PURE__ */ a(
2347
2318
  "span",
2348
2319
  {
2349
2320
  style: {
@@ -2357,59 +2328,59 @@ function yr({
2357
2328
  )
2358
2329
  }
2359
2330
  ),
2360
- /* @__PURE__ */ h("div", { className: "docs-tb-dropdown", ref: Y, children: [
2361
- /* @__PURE__ */ h(
2331
+ /* @__PURE__ */ b("div", { className: "docs-tb-dropdown", ref: G, children: [
2332
+ /* @__PURE__ */ b(
2362
2333
  "button",
2363
2334
  {
2364
2335
  className: `docs-tb-btn${Tt ? " active" : ""}`,
2365
2336
  onClick: () => {
2366
- C(), I(!nt);
2337
+ L(), O(!I);
2367
2338
  },
2368
2339
  title: "Line & paragraph spacing",
2369
2340
  children: [
2370
- /* @__PURE__ */ i(on, { size: 16 }),
2371
- /* @__PURE__ */ i(yt, { size: 12 })
2341
+ /* @__PURE__ */ a(nn, { size: 16 }),
2342
+ /* @__PURE__ */ a(yt, { size: 12 })
2372
2343
  ]
2373
2344
  }
2374
2345
  ),
2375
- nt && /* @__PURE__ */ h("div", { className: "docs-tb-dropdown-menu docs-spacing-menu", children: [
2376
- /* @__PURE__ */ i("div", { className: "docs-insert-category", children: "Line spacing" }),
2377
- /* @__PURE__ */ i(
2346
+ I && /* @__PURE__ */ b("div", { className: "docs-tb-dropdown-menu docs-spacing-menu", children: [
2347
+ /* @__PURE__ */ a("div", { className: "docs-insert-category", children: "Line spacing" }),
2348
+ /* @__PURE__ */ a(
2378
2349
  "button",
2379
2350
  {
2380
2351
  className: `docs-tb-dropdown-item${Tt ? "" : " active"}`,
2381
- onClick: () => V(null),
2352
+ onClick: () => Q(null),
2382
2353
  children: "Default"
2383
2354
  }
2384
2355
  ),
2385
- gr.map((d) => /* @__PURE__ */ i(
2356
+ fr.map((u) => /* @__PURE__ */ a(
2386
2357
  "button",
2387
2358
  {
2388
- className: `docs-tb-dropdown-item${Tt === d ? " active" : ""}`,
2389
- onClick: () => V(d),
2390
- children: d === "1" ? "Single" : d === "2" ? "Double" : d
2359
+ className: `docs-tb-dropdown-item${Tt === u ? " active" : ""}`,
2360
+ onClick: () => Q(u),
2361
+ children: u === "1" ? "Single" : u === "2" ? "Double" : u
2391
2362
  },
2392
- d
2363
+ u
2393
2364
  )),
2394
- /* @__PURE__ */ i("div", { className: "docs-insert-divider" }),
2395
- /* @__PURE__ */ i("div", { className: "docs-insert-category", children: "Paragraph spacing" }),
2396
- /* @__PURE__ */ i(
2365
+ /* @__PURE__ */ a("div", { className: "docs-insert-divider" }),
2366
+ /* @__PURE__ */ a("div", { className: "docs-insert-category", children: "Paragraph spacing" }),
2367
+ /* @__PURE__ */ a(
2397
2368
  "button",
2398
2369
  {
2399
2370
  className: "docs-tb-dropdown-item",
2400
- onClick: () => W("space-before"),
2401
- children: Z(t, "space-before") ? "Remove space before block" : "Add space before block"
2371
+ onClick: () => U("space-before"),
2372
+ children: X(t, "space-before") ? "Remove space before block" : "Add space before block"
2402
2373
  }
2403
2374
  ),
2404
- /* @__PURE__ */ i(
2375
+ /* @__PURE__ */ a(
2405
2376
  "button",
2406
2377
  {
2407
2378
  className: "docs-tb-dropdown-item",
2408
- onClick: () => W("space-after"),
2409
- children: Z(t, "space-after") ? "Remove space after block" : "Add space after block"
2379
+ onClick: () => U("space-after"),
2380
+ children: X(t, "space-after") ? "Remove space after block" : "Add space after block"
2410
2381
  }
2411
2382
  ),
2412
- /* @__PURE__ */ i(
2383
+ /* @__PURE__ */ a(
2413
2384
  "button",
2414
2385
  {
2415
2386
  className: "docs-tb-dropdown-item",
@@ -2419,123 +2390,123 @@ function yr({
2419
2390
  )
2420
2391
  ] })
2421
2392
  ] }),
2422
- /* @__PURE__ */ i(
2393
+ /* @__PURE__ */ a(
2423
2394
  $,
2424
2395
  {
2425
2396
  onClick: () => t.chain().focus().toggleBulletList().run(),
2426
2397
  active: t.isActive("bulletList"),
2427
2398
  title: "Bullet list",
2428
- children: /* @__PURE__ */ i(sn, { size: 16 })
2399
+ children: /* @__PURE__ */ a(rn, { size: 16 })
2429
2400
  }
2430
2401
  ),
2431
- /* @__PURE__ */ i(
2402
+ /* @__PURE__ */ a(
2432
2403
  $,
2433
2404
  {
2434
2405
  onClick: () => t.chain().focus().toggleOrderedList().run(),
2435
2406
  active: t.isActive("orderedList"),
2436
2407
  title: "Numbered list",
2437
- children: /* @__PURE__ */ i(an, { size: 16 })
2408
+ children: /* @__PURE__ */ a(on, { size: 16 })
2438
2409
  }
2439
2410
  )
2440
2411
  ] }),
2441
- /* @__PURE__ */ i(mt, {}),
2442
- /* @__PURE__ */ h(dt, { label: "Insert", children: [
2443
- /* @__PURE__ */ h("div", { className: "docs-tb-dropdown", ref: rt, children: [
2444
- /* @__PURE__ */ h(
2412
+ /* @__PURE__ */ a(ht, {}),
2413
+ /* @__PURE__ */ b(dt, { label: "Insert", children: [
2414
+ /* @__PURE__ */ b("div", { className: "docs-tb-dropdown", ref: rt, children: [
2415
+ /* @__PURE__ */ b(
2445
2416
  "button",
2446
2417
  {
2447
2418
  className: "docs-tb-select docs-tb-insert-select",
2448
2419
  onClick: () => {
2449
- C(), b(!p);
2420
+ L(), h(!p);
2450
2421
  },
2451
2422
  children: [
2452
- /* @__PURE__ */ i(Pt, { size: 15 }),
2453
- /* @__PURE__ */ i("span", { children: "Insert" }),
2454
- /* @__PURE__ */ i(yt, { size: 14 })
2423
+ /* @__PURE__ */ a(Bt, { size: 15 }),
2424
+ /* @__PURE__ */ a("span", { children: "Insert" }),
2425
+ /* @__PURE__ */ a(yt, { size: 14 })
2455
2426
  ]
2456
2427
  }
2457
2428
  ),
2458
- p && /* @__PURE__ */ h("div", { className: "docs-tb-dropdown-menu docs-insert-menu", children: [
2459
- /* @__PURE__ */ h(
2429
+ p && /* @__PURE__ */ b("div", { className: "docs-tb-dropdown-menu docs-insert-menu", children: [
2430
+ /* @__PURE__ */ b(
2460
2431
  "button",
2461
2432
  {
2462
2433
  className: "docs-tb-dropdown-item docs-insert-item",
2463
2434
  onClick: de,
2464
2435
  title: "Two-sided row — content at the line start, value at the line end (text: … | end: …)",
2465
2436
  children: [
2466
- /* @__PURE__ */ i("span", { className: "docs-insert-icon", children: /* @__PURE__ */ i(Ot, { size: 13 }) }),
2467
- /* @__PURE__ */ i("span", { className: "docs-insert-label", children: "two-sided row" }),
2468
- /* @__PURE__ */ i("span", { className: "docs-insert-kw", children: "end:" })
2437
+ /* @__PURE__ */ a("span", { className: "docs-insert-icon", children: /* @__PURE__ */ a(Ot, { size: 13 }) }),
2438
+ /* @__PURE__ */ a("span", { className: "docs-insert-label", children: "two-sided row" }),
2439
+ /* @__PURE__ */ a("span", { className: "docs-insert-kw", children: "end:" })
2469
2440
  ]
2470
2441
  }
2471
2442
  ),
2472
- /* @__PURE__ */ i("div", { className: "docs-insert-divider" }),
2473
- m.map((d, A) => /* @__PURE__ */ h("div", { children: [
2474
- A > 0 && /* @__PURE__ */ i("div", { className: "docs-insert-divider" }),
2475
- /* @__PURE__ */ i("div", { className: "docs-insert-category", children: d.category }),
2476
- d.items.map((w) => /* @__PURE__ */ h(
2443
+ /* @__PURE__ */ a("div", { className: "docs-insert-divider" }),
2444
+ m.map((u, x) => /* @__PURE__ */ b("div", { children: [
2445
+ x > 0 && /* @__PURE__ */ a("div", { className: "docs-insert-divider" }),
2446
+ /* @__PURE__ */ a("div", { className: "docs-insert-category", children: u.category }),
2447
+ u.items.map((S) => /* @__PURE__ */ b(
2477
2448
  "button",
2478
2449
  {
2479
2450
  className: "docs-tb-dropdown-item docs-insert-item",
2480
- onClick: () => x(w.keyword),
2481
- disabled: w.isReadOnly,
2482
- title: w.description,
2451
+ onClick: () => T(S.keyword),
2452
+ disabled: S.isReadOnly,
2453
+ title: S.description,
2483
2454
  children: [
2484
- /* @__PURE__ */ i("span", { className: "docs-insert-icon", children: Kt[w.category]?.icon || "•" }),
2485
- /* @__PURE__ */ i("span", { className: "docs-insert-label", children: w.label }),
2486
- /* @__PURE__ */ i("span", { className: "docs-insert-kw", children: w.isReadOnly ? "locked" : `.${w.keyword}` })
2455
+ /* @__PURE__ */ a("span", { className: "docs-insert-icon", children: Kt[S.category]?.icon || "•" }),
2456
+ /* @__PURE__ */ a("span", { className: "docs-insert-label", children: S.label }),
2457
+ /* @__PURE__ */ a("span", { className: "docs-insert-kw", children: S.isReadOnly ? "locked" : `.${S.keyword}` })
2487
2458
  ]
2488
2459
  },
2489
- w.keyword
2460
+ S.keyword
2490
2461
  ))
2491
- ] }, d.category))
2462
+ ] }, u.category))
2492
2463
  ] })
2493
2464
  ] }),
2494
- /* @__PURE__ */ i(
2465
+ /* @__PURE__ */ a(
2495
2466
  $,
2496
2467
  {
2497
2468
  onClick: le,
2498
2469
  active: ge,
2499
2470
  title: "Two-sided row — set the text shown at the END of this line (end: property)",
2500
- children: /* @__PURE__ */ i(Ot, { size: 16 })
2471
+ children: /* @__PURE__ */ a(Ot, { size: 16 })
2501
2472
  }
2502
2473
  )
2503
2474
  ] })
2504
2475
  ] }),
2505
- a && /* @__PURE__ */ h(he, { children: [
2506
- /* @__PURE__ */ i(mt, {}),
2507
- /* @__PURE__ */ h(dt, { label: "Trust", children: [
2508
- /* @__PURE__ */ h(
2476
+ c && /* @__PURE__ */ b(me, { children: [
2477
+ /* @__PURE__ */ a(ht, {}),
2478
+ /* @__PURE__ */ b(dt, { label: "Trust", children: [
2479
+ /* @__PURE__ */ b(
2509
2480
  $,
2510
2481
  {
2511
- onClick: () => a("seal"),
2512
- disabled: u,
2513
- title: u ? "Document is already sealed" : "Seal — freeze the document with a tamper-evident hash",
2482
+ onClick: () => c("seal"),
2483
+ disabled: d,
2484
+ title: d ? "Document is already sealed" : "Seal — freeze the document with a tamper-evident hash",
2514
2485
  children: [
2515
- /* @__PURE__ */ i(cn, { size: 16 }),
2516
- /* @__PURE__ */ i("span", { className: "ribbon-btn-text", children: "Seal" })
2486
+ /* @__PURE__ */ a(sn, { size: 16 }),
2487
+ /* @__PURE__ */ a("span", { className: "ribbon-btn-text", children: "Seal" })
2517
2488
  ]
2518
2489
  }
2519
2490
  ),
2520
- /* @__PURE__ */ h(
2491
+ /* @__PURE__ */ b(
2521
2492
  $,
2522
2493
  {
2523
- onClick: () => a("sign"),
2494
+ onClick: () => c("sign"),
2524
2495
  title: "Sign — add a signature",
2525
2496
  children: [
2526
- /* @__PURE__ */ i(ln, { size: 16 }),
2527
- /* @__PURE__ */ i("span", { className: "ribbon-btn-text", children: "Sign" })
2497
+ /* @__PURE__ */ a(an, { size: 16 }),
2498
+ /* @__PURE__ */ a("span", { className: "ribbon-btn-text", children: "Sign" })
2528
2499
  ]
2529
2500
  }
2530
2501
  ),
2531
- /* @__PURE__ */ h(
2502
+ /* @__PURE__ */ b(
2532
2503
  $,
2533
2504
  {
2534
- onClick: () => a("verify"),
2505
+ onClick: () => c("verify"),
2535
2506
  title: "Verify — check the document hash and signatures",
2536
2507
  children: [
2537
- /* @__PURE__ */ i(dn, { size: 16 }),
2538
- /* @__PURE__ */ i("span", { className: "ribbon-btn-text", children: "Verify" })
2508
+ /* @__PURE__ */ a(cn, { size: 16 }),
2509
+ /* @__PURE__ */ a("span", { className: "ribbon-btn-text", children: "Verify" })
2539
2510
  ]
2540
2511
  }
2541
2512
  )
@@ -2543,65 +2514,128 @@ function yr({
2543
2514
  ] })
2544
2515
  ] });
2545
2516
  }
2546
- function Lt(t, e) {
2517
+ const yr = { in: 96, cm: 96 / 2.54 }, kr = { in: 0.25, cm: 0.5 };
2518
+ function Sr({ geometry: t, zoom: e, scrollEl: n }) {
2519
+ const [r, o] = P(0);
2520
+ j(() => {
2521
+ const d = n.current;
2522
+ if (!d) return;
2523
+ const s = () => o(d.scrollLeft);
2524
+ return s(), d.addEventListener("scroll", s, { passive: !0 }), () => d.removeEventListener("scroll", s);
2525
+ }, [n]);
2526
+ const l = Y(() => {
2527
+ const d = yr[t.unit], s = kr[t.unit], f = [], p = t.width / d;
2528
+ for (let h = 0; h <= p + 1e-6; h += s) {
2529
+ const g = Math.abs(h - Math.round(h)) < 1e-6;
2530
+ f.push({
2531
+ x: h * d,
2532
+ kind: g ? "major" : "minor",
2533
+ label: g && h > 0 ? String(Math.round(h)) : void 0
2534
+ });
2535
+ }
2536
+ return f;
2537
+ }, [t.width, t.unit]), c = t.width * e;
2538
+ return /* @__PURE__ */ a("div", { className: "docs-ruler", "aria-hidden": "true", children: /* @__PURE__ */ b(
2539
+ "div",
2540
+ {
2541
+ className: "docs-ruler-track",
2542
+ style: { width: c, transform: `translateX(${-r}px)` },
2543
+ children: [
2544
+ /* @__PURE__ */ a(
2545
+ "div",
2546
+ {
2547
+ className: "docs-ruler-margin",
2548
+ style: { left: 0, width: t.marginLeft * e }
2549
+ }
2550
+ ),
2551
+ /* @__PURE__ */ a(
2552
+ "div",
2553
+ {
2554
+ className: "docs-ruler-margin",
2555
+ style: { right: 0, width: t.marginRight * e }
2556
+ }
2557
+ ),
2558
+ l.map(
2559
+ (d, s) => d.label ? /* @__PURE__ */ a(
2560
+ "span",
2561
+ {
2562
+ className: "docs-ruler-num",
2563
+ style: { left: d.x * e },
2564
+ children: d.label
2565
+ },
2566
+ s
2567
+ ) : /* @__PURE__ */ a(
2568
+ "span",
2569
+ {
2570
+ className: `docs-ruler-tick docs-ruler-tick--${d.kind}`,
2571
+ style: { left: d.x * e }
2572
+ },
2573
+ s
2574
+ )
2575
+ )
2576
+ ]
2577
+ }
2578
+ ) });
2579
+ }
2580
+ function Ct(t, e) {
2547
2581
  return e ? `${t} (${e})` : t;
2548
2582
  }
2549
- function kr({ trust: t, intact: e }) {
2583
+ function wr({ trust: t, intact: e }) {
2550
2584
  if (t.isSealed) {
2551
2585
  const n = t.sealedBy || "unknown", r = t.signatures[t.signatures.length - 1]?.role;
2552
- return /* @__PURE__ */ h("div", { className: "docs-trust-banner docs-trust-banner--sealed", role: "status", children: [
2553
- /* @__PURE__ */ i("span", { className: "docs-trust-banner__icon", children: "🔒" }),
2554
- /* @__PURE__ */ i("span", { className: "docs-trust-banner__title", children: "Sealed" }),
2555
- /* @__PURE__ */ h("span", { className: "docs-trust-banner__text", children: [
2586
+ return /* @__PURE__ */ b("div", { className: "docs-trust-banner docs-trust-banner--sealed", role: "status", children: [
2587
+ /* @__PURE__ */ a("span", { className: "docs-trust-banner__icon", children: "🔒" }),
2588
+ /* @__PURE__ */ a("span", { className: "docs-trust-banner__title", children: "Sealed" }),
2589
+ /* @__PURE__ */ b("span", { className: "docs-trust-banner__text", children: [
2556
2590
  "signed by ",
2557
- Lt(n, r),
2591
+ Ct(n, r),
2558
2592
  t.sealedAt ? ` on ${t.sealedAt}` : "",
2559
2593
  " · read-only"
2560
2594
  ] }),
2561
- e === !0 && /* @__PURE__ */ i("span", { className: "docs-trust-banner__verify docs-trust-banner__verify--ok", children: "hash verified ✓" }),
2562
- e === !1 && /* @__PURE__ */ i("span", { className: "docs-trust-banner__verify docs-trust-banner__verify--bad", children: "⚠ hash mismatch — content changed after sealing" })
2595
+ e === !0 && /* @__PURE__ */ a("span", { className: "docs-trust-banner__verify docs-trust-banner__verify--ok", children: "hash verified ✓" }),
2596
+ e === !1 && /* @__PURE__ */ a("span", { className: "docs-trust-banner__verify docs-trust-banner__verify--bad", children: "⚠ hash mismatch — content changed after sealing" })
2563
2597
  ] });
2564
2598
  }
2565
- return t.signatures.length > 0 ? /* @__PURE__ */ h("div", { className: "docs-trust-banner docs-trust-banner--signed", role: "status", children: [
2566
- /* @__PURE__ */ i("span", { className: "docs-trust-banner__icon", children: "✍" }),
2567
- /* @__PURE__ */ i("span", { className: "docs-trust-banner__title", children: "Signed" }),
2568
- /* @__PURE__ */ h("span", { className: "docs-trust-banner__text", children: [
2599
+ return t.signatures.length > 0 ? /* @__PURE__ */ b("div", { className: "docs-trust-banner docs-trust-banner--signed", role: "status", children: [
2600
+ /* @__PURE__ */ a("span", { className: "docs-trust-banner__icon", children: "✍" }),
2601
+ /* @__PURE__ */ a("span", { className: "docs-trust-banner__title", children: "Signed" }),
2602
+ /* @__PURE__ */ b("span", { className: "docs-trust-banner__text", children: [
2569
2603
  "by",
2570
2604
  " ",
2571
- t.signatures.map((n) => `${Lt(n.by, n.role)}${n.at ? ` on ${n.at}` : ""}`).join(" · ")
2605
+ t.signatures.map((n) => `${Ct(n.by, n.role)}${n.at ? ` on ${n.at}` : ""}`).join(" · ")
2572
2606
  ] })
2573
- ] }) : t.approvals.length > 0 ? /* @__PURE__ */ h(
2607
+ ] }) : t.approvals.length > 0 ? /* @__PURE__ */ b(
2574
2608
  "div",
2575
2609
  {
2576
2610
  className: "docs-trust-banner docs-trust-banner--approved",
2577
2611
  role: "status",
2578
2612
  children: [
2579
- /* @__PURE__ */ i("span", { className: "docs-trust-banner__icon", children: "✓" }),
2580
- /* @__PURE__ */ i("span", { className: "docs-trust-banner__title", children: "Approved" }),
2581
- /* @__PURE__ */ h("span", { className: "docs-trust-banner__text", children: [
2613
+ /* @__PURE__ */ a("span", { className: "docs-trust-banner__icon", children: "✓" }),
2614
+ /* @__PURE__ */ a("span", { className: "docs-trust-banner__title", children: "Approved" }),
2615
+ /* @__PURE__ */ b("span", { className: "docs-trust-banner__text", children: [
2582
2616
  "by",
2583
2617
  " ",
2584
- t.approvals.map((n) => `${Lt(n.by, n.role)}${n.at ? ` on ${n.at}` : ""}`).join(" · ")
2618
+ t.approvals.map((n) => `${Ct(n.by, n.role)}${n.at ? ` on ${n.at}` : ""}`).join(" · ")
2585
2619
  ] })
2586
2620
  ]
2587
2621
  }
2588
2622
  ) : null;
2589
2623
  }
2590
- function Sr(t) {
2624
+ function vr(t) {
2591
2625
  let e;
2592
2626
  try {
2593
- e = tt(t);
2627
+ e = et(t);
2594
2628
  } catch {
2595
2629
  return [];
2596
2630
  }
2597
2631
  const n = [], r = (o, l) => {
2598
- const a = l == null ? "" : String(l).trim();
2599
- a && n.push({ key: o, value: a });
2632
+ const c = l == null ? "" : String(l).trim();
2633
+ c && n.push({ key: o, value: c });
2600
2634
  };
2601
2635
  for (const o of e.blocks)
2602
2636
  switch (o.type) {
2603
2637
  case "meta":
2604
- for (const [l, a] of Object.entries(o.properties || {})) r(l, a);
2638
+ for (const [l, c] of Object.entries(o.properties || {})) r(l, c);
2605
2639
  break;
2606
2640
  case "track":
2607
2641
  r("tracked", o.properties?.id ?? o.content);
@@ -2635,32 +2669,32 @@ function Sr(t) {
2635
2669
  }
2636
2670
  return n;
2637
2671
  }
2638
- function wr({ source: t }) {
2639
- const [e, n] = B(!1), r = K(() => Sr(t), [t]);
2672
+ function Tr({ source: t }) {
2673
+ const [e, n] = P(!1), r = Y(() => vr(t), [t]);
2640
2674
  if (r.length === 0) return null;
2641
2675
  const o = r.slice(0, 4).map((l) => `${l.key}: ${l.value}`).join(" · ");
2642
- return /* @__PURE__ */ h("div", { className: `docs-props-bar${e ? " open" : ""}`, children: [
2643
- /* @__PURE__ */ h(
2676
+ return /* @__PURE__ */ b("div", { className: `docs-props-bar${e ? " open" : ""}`, children: [
2677
+ /* @__PURE__ */ b(
2644
2678
  "button",
2645
2679
  {
2646
2680
  className: "docs-props-toggle",
2647
2681
  onClick: () => n((l) => !l),
2648
2682
  title: e ? "Hide document properties" : "Show document properties",
2649
2683
  children: [
2650
- /* @__PURE__ */ i("span", { className: "docs-props-caret", children: e ? "▾" : "▸" }),
2684
+ /* @__PURE__ */ a("span", { className: "docs-props-caret", children: e ? "▾" : "▸" }),
2651
2685
  "Document properties",
2652
- !e && /* @__PURE__ */ i("span", { className: "docs-props-summary", children: o })
2686
+ !e && /* @__PURE__ */ a("span", { className: "docs-props-summary", children: o })
2653
2687
  ]
2654
2688
  }
2655
2689
  ),
2656
- e && /* @__PURE__ */ i("div", { className: "docs-props-chips", children: r.map((l, a) => /* @__PURE__ */ h("span", { className: "docs-props-chip", children: [
2657
- /* @__PURE__ */ i("b", { children: l.key }),
2690
+ e && /* @__PURE__ */ a("div", { className: "docs-props-chips", children: r.map((l, c) => /* @__PURE__ */ b("span", { className: "docs-props-chip", children: [
2691
+ /* @__PURE__ */ a("b", { children: l.key }),
2658
2692
  " ",
2659
2693
  l.value
2660
- ] }, `${l.key}-${a}`)) })
2694
+ ] }, `${l.key}-${c}`)) })
2661
2695
  ] });
2662
2696
  }
2663
- function _(t, e, n = "") {
2697
+ function z(t, e, n = "") {
2664
2698
  const r = t?.properties?.[e];
2665
2699
  return r != null ? String(r) : n;
2666
2700
  }
@@ -2678,44 +2712,44 @@ function Vt(t) {
2678
2712
  amendments: []
2679
2713
  };
2680
2714
  if (!t) return e;
2681
- const n = t.blocks, r = n.find((c) => c.type === "track");
2715
+ const n = t.blocks, r = n.find((s) => s.type === "track");
2682
2716
  r && (e.isTracked = !0, e.lifecycle = "tracked", e.trackBlock = {
2683
- id: _(r, "id", r.content ?? ""),
2684
- by: _(r, "by"),
2685
- at: _(r, "at")
2717
+ id: z(r, "id", r.content ?? ""),
2718
+ by: z(r, "by"),
2719
+ at: z(r, "at")
2686
2720
  });
2687
- const o = n.filter((c) => c.type === "approve");
2688
- for (const c of o)
2721
+ const o = n.filter((s) => s.type === "approve");
2722
+ for (const s of o)
2689
2723
  e.approvals.push({
2690
- by: _(c, "by", c.content ?? ""),
2691
- role: _(c, "role"),
2692
- at: _(c, "at"),
2693
- note: _(c, "note") || void 0
2724
+ by: z(s, "by", s.content ?? ""),
2725
+ role: z(s, "role"),
2726
+ at: z(s, "at"),
2727
+ note: z(s, "note") || void 0
2694
2728
  });
2695
2729
  e.approvals.length > 0 && (e.lifecycle = "approved");
2696
- const l = n.filter((c) => c.type === "sign");
2697
- for (const c of l)
2730
+ const l = n.filter((s) => s.type === "sign");
2731
+ for (const s of l)
2698
2732
  e.signatures.push({
2699
- by: _(c, "by", c.content ?? ""),
2700
- role: _(c, "role"),
2701
- at: _(c, "at")
2733
+ by: z(s, "by", s.content ?? ""),
2734
+ role: z(s, "role"),
2735
+ at: z(s, "at")
2702
2736
  });
2703
2737
  e.signatures.length > 0 && (e.lifecycle = "signed");
2704
- const a = n.find((c) => c.type === "freeze");
2705
- if (a) {
2738
+ const c = n.find((s) => s.type === "freeze");
2739
+ if (c) {
2706
2740
  e.isSealed = !0, e.lifecycle = "sealed";
2707
- const c = e.signatures[e.signatures.length - 1];
2708
- e.sealedBy = c?.by || _(a, "by", a.content ?? ""), e.sealedAt = _(a, "at") || c?.at || "", e.sealHash = _(a, "hash");
2741
+ const s = e.signatures[e.signatures.length - 1];
2742
+ e.sealedBy = s?.by || z(c, "by", c.content ?? ""), e.sealedAt = z(c, "at") || s?.at || "", e.sealHash = z(c, "hash");
2709
2743
  }
2710
- const u = n.filter((c) => c.type === "amendment");
2711
- for (const c of u)
2744
+ const d = n.filter((s) => s.type === "amendment");
2745
+ for (const s of d)
2712
2746
  e.amendments.push({
2713
- section: _(c, "section", c.content ?? ""),
2714
- was: _(c, "was"),
2715
- now: _(c, "now"),
2716
- by: _(c, "by"),
2717
- ref: _(c, "ref"),
2718
- at: _(c, "at")
2747
+ section: z(s, "section", s.content ?? ""),
2748
+ was: z(s, "was"),
2749
+ now: z(s, "now"),
2750
+ by: z(s, "by"),
2751
+ ref: z(s, "ref"),
2752
+ at: z(s, "at")
2719
2753
  });
2720
2754
  return e;
2721
2755
  }
@@ -2728,13 +2762,13 @@ function Zt(t) {
2728
2762
  let o;
2729
2763
  for (; o = wt.exec(n.text); )
2730
2764
  e.push(
2731
- $t.inline(r + o.index, r + o.index + o[0].length, {
2765
+ Nt.inline(r + o.index, r + o.index + o[0].length, {
2732
2766
  class: "it-doc-var"
2733
2767
  })
2734
2768
  );
2735
2769
  }), St.create(t, e);
2736
2770
  }
2737
- const vr = vt.create({
2771
+ const xr = vt.create({
2738
2772
  name: "templateHighlight",
2739
2773
  addProseMirrorPlugins() {
2740
2774
  return [
@@ -2753,7 +2787,7 @@ const vr = vt.create({
2753
2787
  ];
2754
2788
  }
2755
2789
  });
2756
- function Yr(t) {
2790
+ function qr(t) {
2757
2791
  const e = /* @__PURE__ */ new Set(), n = [];
2758
2792
  wt.lastIndex = 0;
2759
2793
  let r;
@@ -2763,19 +2797,19 @@ function Yr(t) {
2763
2797
  }
2764
2798
  return n;
2765
2799
  }
2766
- function Kr(t) {
2800
+ function Jr(t) {
2767
2801
  const e = {};
2768
2802
  for (const n of t) {
2769
2803
  const r = n.split(".");
2770
2804
  let o = e;
2771
2805
  for (let l = 0; l < r.length; l++) {
2772
- const a = r[l];
2773
- l === r.length - 1 ? a in o || (o[a] = "") : ((!(a in o) || typeof o[a] != "object" || o[a] === null) && (o[a] = {}), o = o[a]);
2806
+ const c = r[l];
2807
+ l === r.length - 1 ? c in o || (o[c] = "") : ((!(c in o) || typeof o[c] != "object" || o[c] === null) && (o[c] = {}), o = o[c]);
2774
2808
  }
2775
2809
  }
2776
2810
  return e;
2777
2811
  }
2778
- const Tr = 28, xr = {
2812
+ const Lr = 28, Ar = {
2779
2813
  title: [".it-doc-title"],
2780
2814
  summary: [".it-doc-summary"],
2781
2815
  section: [".it-doc-section"],
@@ -2790,22 +2824,22 @@ const Tr = 28, xr = {
2790
2824
  contact: ['.it-doc-generic[data-keyword="contact"]'],
2791
2825
  divider: [".it-doc-divider"]
2792
2826
  };
2793
- function Ar({
2827
+ function Cr({
2794
2828
  value: t,
2795
2829
  onChange: e,
2796
2830
  theme: n,
2797
2831
  onThemeChange: r,
2798
2832
  readOnly: o = !1,
2799
2833
  showRibbon: l = !0,
2800
- showTrustBanner: a = !0,
2801
- onTrustAction: u
2834
+ showTrustBanner: c = !0,
2835
+ onTrustAction: d
2802
2836
  }) {
2803
- const c = P(""), g = P(!1), p = P(!0), [b, f] = B([]), k = P(zt("")), [T, M] = B(1), S = ye({
2837
+ const s = B(""), f = B(!1), p = B(!0), [h, g] = P([]), k = B(Mt("")), [M, C] = P(1), v = ye({
2804
2838
  extensions: [
2805
- bn.configure({
2839
+ mn.configure({
2806
2840
  geometry: () => k.current,
2807
- gap: Tr,
2808
- onPages: M
2841
+ gap: Lr,
2842
+ onPages: C
2809
2843
  }),
2810
2844
  Se.configure({
2811
2845
  heading: !1,
@@ -2815,8 +2849,8 @@ function Ar({
2815
2849
  // Replaced by ITParagraph (core block props: end/leading/space-…).
2816
2850
  paragraph: !1
2817
2851
  }),
2852
+ er,
2818
2853
  nr,
2819
- rr,
2820
2854
  we.configure({
2821
2855
  // Professional behavior: a new empty line shows just the cursor.
2822
2856
  // The hint appears only on a completely empty document.
@@ -2825,14 +2859,15 @@ function Ar({
2825
2859
  ve,
2826
2860
  Te,
2827
2861
  xe,
2828
- Ae.configure({ multicolor: !0 }),
2829
- Ce.configure({
2862
+ Le.configure({ multicolor: !0 }),
2863
+ Ae.configure({
2830
2864
  types: ["paragraph", "itTitle", "itSummary", "itSection", "itSub"]
2831
2865
  }),
2832
- Le,
2833
- un,
2834
- $e,
2866
+ Ce,
2867
+ ln,
2835
2868
  Ne,
2869
+ $e,
2870
+ Bn,
2836
2871
  In,
2837
2872
  On,
2838
2873
  Dn,
@@ -2840,22 +2875,21 @@ function Ar({
2840
2875
  jn,
2841
2876
  Wn,
2842
2877
  Gn,
2878
+ Yn,
2843
2879
  Un,
2844
2880
  Kn,
2845
- Yn,
2846
2881
  qn,
2847
2882
  Jn,
2848
2883
  Vn,
2849
2884
  Qn,
2850
2885
  Zn,
2851
- Xn,
2852
- vr
2886
+ xr
2853
2887
  ],
2854
2888
  content: Ut(t),
2855
2889
  onUpdate: ({ editor: m }) => {
2856
2890
  if (p.current) return;
2857
- const y = m.getJSON(), x = _n(y);
2858
- c.current = x, g.current = !0, f(Nn(y)), e(x);
2891
+ const y = m.getJSON(), T = zn(y);
2892
+ s.current = T, f.current = !0, g(Nn(y)), e(T);
2859
2893
  },
2860
2894
  editorProps: {
2861
2895
  attributes: {
@@ -2866,33 +2900,33 @@ function Ar({
2866
2900
  });
2867
2901
  j(() => {
2868
2902
  const m = window.setTimeout(() => {
2869
- p.current = !1, c.current = t;
2903
+ p.current = !1, s.current = t;
2870
2904
  }, 0);
2871
2905
  return () => window.clearTimeout(m);
2872
2906
  }, []), j(() => {
2873
- if (S) {
2874
- if (g.current) {
2875
- g.current = !1;
2907
+ if (v) {
2908
+ if (f.current) {
2909
+ f.current = !1;
2876
2910
  return;
2877
2911
  }
2878
- if (t !== c.current) {
2912
+ if (t !== s.current) {
2879
2913
  const m = Ut(t);
2880
- S.commands.setContent(m), c.current = t;
2914
+ v.commands.setContent(m), s.current = t;
2881
2915
  }
2882
2916
  }
2883
- }, [t, S]), j(() => {
2884
- if (!S) return;
2917
+ }, [t, v]), j(() => {
2918
+ if (!v) return;
2885
2919
  const m = (y) => {
2886
- const x = y.detail;
2887
- x && S.chain().focus().insertContent(x).run();
2920
+ const T = y.detail;
2921
+ T && v.chain().focus().insertContent(T).run();
2888
2922
  };
2889
2923
  return window.addEventListener("it-insert-text", m), () => window.removeEventListener("it-insert-text", m);
2890
- }, [S]);
2891
- const v = K(() => zt(t), [t]);
2924
+ }, [v]);
2925
+ const w = Y(() => Mt(t), [t]);
2892
2926
  j(() => {
2893
- k.current = v, S?.view.dispatch(S.state.tr);
2894
- }, [v, S]);
2895
- const nt = P(null), I = R(() => S ? S.storage.characterCount?.words?.() ?? S.getText().split(/\s+/).filter(Boolean).length : 0, [S]), G = K(() => {
2927
+ k.current = w, v?.view.dispatch(v.state.tr);
2928
+ }, [w, v]);
2929
+ const I = B(null), O = R(() => v ? v.storage.characterCount?.words?.() ?? v.getText().split(/\s+/).filter(Boolean).length : 0, [v]), K = Y(() => {
2896
2930
  if (!n) return "";
2897
2931
  try {
2898
2932
  const m = Re(n);
@@ -2900,35 +2934,35 @@ function Ar({
2900
2934
  } catch {
2901
2935
  return "";
2902
2936
  }
2903
- }, [n]), U = K(() => {
2937
+ }, [n]), q = Y(() => {
2904
2938
  try {
2905
- const m = tt(t), y = m.blocks.find((W) => W.type === "header")?.content || "", x = m.blocks.find((W) => W.type === "footer")?.content || "", O = m.blocks.find((W) => W.type === "meta"), V = String(O?.properties?.dir || "ltr").toLowerCase();
2906
- return { header: y, footer: x, dir: V };
2939
+ const m = et(t), y = m.blocks.find((U) => U.type === "header")?.content || "", T = m.blocks.find((U) => U.type === "footer")?.content || "", D = m.blocks.find((U) => U.type === "meta"), Q = String(D?.properties?.dir || "ltr").toLowerCase();
2940
+ return { header: y, footer: T, dir: Q };
2907
2941
  } catch {
2908
2942
  return { header: "", footer: "", dir: "ltr" };
2909
2943
  }
2910
- }, [t]), F = K(() => {
2944
+ }, [t]), W = Y(() => {
2911
2945
  try {
2912
- return Vt(tt(t));
2946
+ return Vt(et(t));
2913
2947
  } catch {
2914
2948
  return Vt(null);
2915
2949
  }
2916
- }, [t]), rt = K(() => {
2917
- if (!F.isSealed) return null;
2950
+ }, [t]), rt = Y(() => {
2951
+ if (!W.isSealed) return null;
2918
2952
  try {
2919
- return Be(t).intact;
2953
+ return Pe(t).intact;
2920
2954
  } catch {
2921
2955
  return null;
2922
2956
  }
2923
- }, [t, F.isSealed]), N = F.isSealed || o;
2957
+ }, [t, W.isSealed]), N = W.isSealed || o;
2924
2958
  j(() => {
2925
- S && S.isEditable !== !N && S.setEditable(!N);
2926
- }, [S, N]);
2927
- const H = K(() => {
2959
+ v && v.isEditable !== !N && v.setEditable(!N);
2960
+ }, [v, N]);
2961
+ const H = Y(() => {
2928
2962
  try {
2929
- return Pe(
2930
- tt(t),
2931
- xr,
2963
+ return Be(
2964
+ et(t),
2965
+ Ar,
2932
2966
  ".docs-page .tiptap "
2933
2967
  );
2934
2968
  } catch {
@@ -2942,15 +2976,15 @@ function Ar({
2942
2976
  m || (m = document.createElement("style"), m.id = "it-doc-style-rules", document.head.appendChild(m)), m.textContent = H;
2943
2977
  }, [H]);
2944
2978
  const ot = R(() => {
2945
- if (U.dir === "rtl") {
2979
+ if (q.dir === "rtl") {
2946
2980
  const y = t.split(`
2947
- `).map((x) => {
2948
- if (/^meta:/i.test(x.trim())) {
2949
- const O = x.replace(/\s*\|\s*dir:\s*rtl/gi, "").trim();
2950
- return O === "meta:" ? null : O;
2981
+ `).map((T) => {
2982
+ if (/^meta:/i.test(T.trim())) {
2983
+ const D = T.replace(/\s*\|\s*dir:\s*rtl/gi, "").trim();
2984
+ return D === "meta:" ? null : D;
2951
2985
  }
2952
- return x;
2953
- }).filter((x) => x !== null).join(`
2986
+ return T;
2987
+ }).filter((T) => T !== null).join(`
2954
2988
  `);
2955
2989
  e(y);
2956
2990
  } else {
@@ -2961,114 +2995,115 @@ meta: | dir: rtl`)
2961
2995
  ) : e(`meta: | dir: rtl
2962
2996
  ${t}`);
2963
2997
  }
2964
- }, [t, e, U.dir]);
2998
+ }, [t, e, q.dir]);
2965
2999
  j(() => {
2966
3000
  const m = "it-editor-theme-css";
2967
3001
  let y = document.getElementById(m);
2968
- y || (y = document.createElement("style"), y.id = m, document.head.appendChild(y)), y.textContent = G;
2969
- }, [G]);
2970
- const Y = P(null), [C, st] = B(1), ut = P(C), J = P(null), pt = R(
3002
+ y || (y = document.createElement("style"), y.id = m, document.head.appendChild(y)), y.textContent = K;
3003
+ }, [K]);
3004
+ const G = B(null), [L, st] = P(1), ut = B(L), V = B(null), pt = R(
2971
3005
  (m) => {
2972
- const y = Y.current;
3006
+ const y = G.current;
2973
3007
  if (!y) return;
2974
- const x = y.getBoundingClientRect();
2975
- J.current = {
2976
- cx: y.scrollLeft + (m.clientX - x.left),
2977
- cy: y.scrollTop + (m.clientY - x.top)
3008
+ const T = y.getBoundingClientRect();
3009
+ V.current = {
3010
+ cx: y.scrollLeft + (m.clientX - T.left),
3011
+ cy: y.scrollTop + (m.clientY - T.top)
2978
3012
  };
2979
3013
  },
2980
3014
  []
2981
3015
  ), at = R(() => {
2982
- const m = Y.current;
2983
- m && (J.current = {
3016
+ const m = G.current;
3017
+ m && (V.current = {
2984
3018
  cx: m.scrollLeft + m.clientWidth / 2,
2985
3019
  cy: m.scrollTop + m.clientHeight / 2
2986
3020
  });
2987
3021
  }, []);
2988
3022
  return be(() => {
2989
- const m = Y.current, y = J.current, x = ut.current;
2990
- if (!m || !y || x === C) return;
2991
- const O = C / x;
3023
+ const m = G.current, y = V.current, T = ut.current;
3024
+ if (!m || !y || T === L) return;
3025
+ const D = L / T;
2992
3026
  m.getBoundingClientRect();
2993
- const V = y.cx - m.scrollLeft, W = y.cy - m.scrollTop;
2994
- m.scrollLeft = y.cx * O - V, m.scrollTop = y.cy * O - W, J.current = null, ut.current = C;
2995
- }, [C]), j(() => {
3027
+ const Q = y.cx - m.scrollLeft, U = y.cy - m.scrollTop;
3028
+ m.scrollLeft = y.cx * D - Q, m.scrollTop = y.cy * D - U, V.current = null, ut.current = L;
3029
+ }, [L]), j(() => {
2996
3030
  const m = (y) => {
2997
- (y.metaKey || y.ctrlKey) && (y.key === "=" || y.key === "+" ? (y.preventDefault(), at(), st((x) => Math.min(2, +(x + 0.1).toFixed(2)))) : y.key === "-" ? (y.preventDefault(), at(), st((x) => Math.max(0.25, +(x - 0.1).toFixed(2)))) : y.key === "0" && (y.preventDefault(), at(), st(1)));
3031
+ (y.metaKey || y.ctrlKey) && (y.key === "=" || y.key === "+" ? (y.preventDefault(), at(), st((T) => Math.min(2, +(T + 0.1).toFixed(2)))) : y.key === "-" ? (y.preventDefault(), at(), st((T) => Math.max(0.25, +(T - 0.1).toFixed(2)))) : y.key === "0" && (y.preventDefault(), at(), st(1)));
2998
3032
  };
2999
3033
  return window.addEventListener("keydown", m), () => window.removeEventListener("keydown", m);
3000
3034
  }, [at]), j(() => {
3001
- const m = Y.current;
3035
+ const m = G.current;
3002
3036
  if (!m) return;
3003
- const y = (x) => {
3004
- if (x.ctrlKey || x.metaKey) {
3005
- x.preventDefault();
3006
- const O = x.deltaY > 0 ? -0.1 : 0.1;
3007
- pt(x), st((V) => Math.min(2, Math.max(0.25, +(V + O).toFixed(2))));
3037
+ const y = (T) => {
3038
+ if (T.ctrlKey || T.metaKey) {
3039
+ T.preventDefault();
3040
+ const D = T.deltaY > 0 ? -0.1 : 0.1;
3041
+ pt(T), st((Q) => Math.min(2, Math.max(0.25, +(Q + D).toFixed(2))));
3008
3042
  }
3009
3043
  };
3010
3044
  return m.addEventListener("wheel", y, { passive: !1 }), () => m.removeEventListener("wheel", y);
3011
- }, [pt]), /* @__PURE__ */ h("div", { className: "docs-container", children: [
3012
- l && /* @__PURE__ */ i(
3013
- yr,
3045
+ }, [pt]), /* @__PURE__ */ b("div", { className: "docs-container", children: [
3046
+ l && /* @__PURE__ */ a(
3047
+ br,
3014
3048
  {
3015
- editor: S,
3016
- isRtl: U.dir === "rtl",
3049
+ editor: v,
3050
+ isRtl: q.dir === "rtl",
3017
3051
  onToggleRtl: ot,
3018
3052
  content: t,
3019
3053
  theme: n,
3020
3054
  onThemeChange: r,
3021
- onTrustAction: u,
3055
+ onTrustAction: d,
3022
3056
  locked: N
3023
3057
  }
3024
3058
  ),
3025
- a && /* @__PURE__ */ i(kr, { trust: F, intact: rt }),
3026
- a && /* @__PURE__ */ i(wr, { source: t }),
3027
- b.length > 0 && /* @__PURE__ */ h("div", { className: "docs-fidelity-warning", role: "status", children: [
3059
+ c && /* @__PURE__ */ a(wr, { trust: W, intact: rt }),
3060
+ c && /* @__PURE__ */ a(Tr, { source: t }),
3061
+ h.length > 0 && /* @__PURE__ */ b("div", { className: "docs-fidelity-warning", role: "status", children: [
3028
3062
  "⚠ Some formatting (",
3029
- b.join(", "),
3063
+ h.join(", "),
3030
3064
  ") can’t be saved to",
3031
3065
  " ",
3032
- /* @__PURE__ */ i("code", { children: ".it" }),
3066
+ /* @__PURE__ */ a("code", { children: ".it" }),
3033
3067
  " and won’t appear when printed through the template — remove it or use the toolbar’s color/size/style controls instead."
3034
3068
  ] }),
3035
- /* @__PURE__ */ h("div", { className: "docs-canvas", ref: Y, children: [
3036
- /* @__PURE__ */ i(
3069
+ /* @__PURE__ */ a(Sr, { geometry: w, zoom: L, scrollEl: G }),
3070
+ /* @__PURE__ */ b("div", { className: "docs-canvas", ref: G, children: [
3071
+ /* @__PURE__ */ a(
3037
3072
  "div",
3038
3073
  {
3039
3074
  className: "docs-page-scaler",
3040
- style: { width: v.width * C },
3041
- children: /* @__PURE__ */ i(
3075
+ style: { width: w.width * L },
3076
+ children: /* @__PURE__ */ a(
3042
3077
  "div",
3043
3078
  {
3044
3079
  className: "docs-page-flow",
3045
- dir: U.dir,
3080
+ dir: q.dir,
3046
3081
  style: {
3047
- transform: C !== 1 ? `scale(${C})` : void 0,
3082
+ transform: L !== 1 ? `scale(${L})` : void 0,
3048
3083
  transformOrigin: "top left"
3049
3084
  },
3050
- children: /* @__PURE__ */ h(
3085
+ children: /* @__PURE__ */ b(
3051
3086
  "div",
3052
3087
  {
3053
3088
  className: "docs-page docs-sheet",
3054
- ref: nt,
3089
+ ref: I,
3055
3090
  style: {
3056
- width: v.width,
3057
- minHeight: v.autoHeight ? v.width : void 0,
3058
- "--page-mx-l": `${v.marginLeft}px`,
3059
- "--page-mx-r": `${v.marginRight}px`
3091
+ width: w.width,
3092
+ minHeight: w.autoHeight ? w.width : void 0,
3093
+ "--page-mx-l": `${w.marginLeft}px`,
3094
+ "--page-mx-r": `${w.marginRight}px`
3060
3095
  },
3061
3096
  children: [
3062
- /* @__PURE__ */ i(
3097
+ /* @__PURE__ */ a(
3063
3098
  "div",
3064
3099
  {
3065
3100
  className: "docs-sheet-header",
3066
3101
  "data-it-spacer": "",
3067
- style: { height: v.autoHeight ? void 0 : v.marginTop },
3068
- children: /* @__PURE__ */ i("div", { className: "docs-pb-header", children: /* @__PURE__ */ i("span", { className: "docs-pb-text", children: v.autoHeight ? "" : ee(v.header, 1, T) }) })
3102
+ style: { height: w.autoHeight ? void 0 : w.marginTop },
3103
+ children: /* @__PURE__ */ a("div", { className: "docs-pb-header", children: /* @__PURE__ */ a("span", { className: "docs-pb-text", children: w.autoHeight ? "" : ee(w.header, 1, M) }) })
3069
3104
  }
3070
3105
  ),
3071
- /* @__PURE__ */ i(ke, { editor: S })
3106
+ /* @__PURE__ */ a(ke, { editor: v })
3072
3107
  ]
3073
3108
  }
3074
3109
  )
@@ -3076,66 +3111,66 @@ ${t}`);
3076
3111
  )
3077
3112
  }
3078
3113
  ),
3079
- /* @__PURE__ */ h("div", { className: "docs-page-footer", children: [
3080
- T,
3114
+ /* @__PURE__ */ b("div", { className: "docs-page-footer", children: [
3115
+ M,
3081
3116
  " ",
3082
- T === 1 ? "page" : "pages",
3117
+ M === 1 ? "page" : "pages",
3083
3118
  " ·",
3084
3119
  " ",
3085
- I(),
3120
+ O(),
3086
3121
  " words",
3087
- C !== 1 && /* @__PURE__ */ h("span", { className: "zoom-indicator", children: [
3122
+ L !== 1 && /* @__PURE__ */ b("span", { className: "zoom-indicator", children: [
3088
3123
  " ",
3089
3124
  "· ",
3090
- Math.round(C * 100),
3125
+ Math.round(L * 100),
3091
3126
  "%"
3092
3127
  ] })
3093
3128
  ] })
3094
3129
  ] })
3095
3130
  ] });
3096
3131
  }
3097
- const Cr = "corporate";
3098
- function qr({
3132
+ const Nr = "corporate";
3133
+ function Vr({
3099
3134
  value: t,
3100
3135
  onChange: e,
3101
3136
  theme: n,
3102
3137
  onThemeChange: r,
3103
3138
  readOnly: o = !1,
3104
3139
  showRibbon: l = !0,
3105
- showTrustBanner: a = !0,
3106
- onTrustAction: u
3140
+ showTrustBanner: c = !0,
3141
+ onTrustAction: d
3107
3142
  }) {
3108
- const [c, g] = B(n ?? Cr), p = n ?? c, b = R(
3109
- (f) => {
3110
- g(f), r?.(f);
3143
+ const [s, f] = P(n ?? Nr), p = n ?? s, h = R(
3144
+ (g) => {
3145
+ f(g), r?.(g);
3111
3146
  },
3112
3147
  [r]
3113
3148
  );
3114
- return /* @__PURE__ */ i(
3115
- Ar,
3149
+ return /* @__PURE__ */ a(
3150
+ Cr,
3116
3151
  {
3117
3152
  value: t,
3118
3153
  onChange: e,
3119
3154
  theme: p,
3120
- onThemeChange: b,
3155
+ onThemeChange: h,
3121
3156
  readOnly: o,
3122
3157
  showRibbon: l,
3123
- showTrustBanner: a,
3124
- onTrustAction: u
3158
+ showTrustBanner: c,
3159
+ onTrustAction: d
3125
3160
  }
3126
3161
  );
3127
3162
  }
3128
3163
  export {
3129
- qr as IntentTextEditor,
3130
- Kr as buildSampleSkeleton,
3131
- dr as builtinThemes,
3132
- _n as docToSource,
3133
- lr as exportDocumentHTML,
3134
- cr as exportDocumentPDF,
3135
- Yr as extractTemplateVariables,
3164
+ Vr as IntentTextEditor,
3165
+ Jr as buildSampleSkeleton,
3166
+ lr as builtinThemes,
3167
+ zn as docToSource,
3168
+ cr as exportDocumentHTML,
3169
+ ar as exportDocumentPDF,
3170
+ qr as extractTemplateVariables,
3136
3171
  Vt as extractTrustState,
3137
- zt as getPageGeometry,
3138
- or as printHtmlViaIframe,
3172
+ Mt as getPageGeometry,
3173
+ rr as printHtmlViaIframe,
3139
3174
  ee as resolvePageTokens,
3140
3175
  Ut as sourceToDoc
3141
3176
  };