tiptap-markdown-react 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,341 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { useState, useRef, useEffect, useLayoutEffect } from "react";
4
- import { c as styles$1, R as ReportContent, p as parseChartFenceBody } from "./ReportContent-B7okwVW0.js";
2
+ import { jsxs, jsx } from "react/jsx-runtime";
3
+ import { useRef, useState, useEffect, useLayoutEffect } from "react";
4
+ import { l as normalizeImageCrop, m as cropImageBox, o as styles$2, R as ReportContent, p as parseChartFenceBody } from "./ReportContent-Bc5q1bYp.js";
5
5
  import { Chart, CategoryScale, LinearScale, PointElement, LineElement, BarElement, ArcElement, LineController, BarController, PieController, DoughnutController, Filler, Legend, Tooltip } from "chart.js";
6
+ import { createPortal } from "react-dom";
7
+ function Svg({ size = "1em", children, ...rest }) {
8
+ return /* @__PURE__ */ jsx(
9
+ "svg",
10
+ {
11
+ xmlns: "http://www.w3.org/2000/svg",
12
+ width: size,
13
+ height: size,
14
+ viewBox: "0 0 24 24",
15
+ fill: "none",
16
+ stroke: "currentColor",
17
+ strokeWidth: 2,
18
+ strokeLinecap: "round",
19
+ strokeLinejoin: "round",
20
+ "aria-hidden": "true",
21
+ focusable: "false",
22
+ ...rest,
23
+ children
24
+ }
25
+ );
26
+ }
27
+ const BoldIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
28
+ /* @__PURE__ */ jsx("path", { d: "M6 4h8a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" }),
29
+ /* @__PURE__ */ jsx("path", { d: "M6 12h9a4 4 0 0 1 4 4 4 4 0 0 1-4 4H6z" })
30
+ ] });
31
+ const ItalicIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
32
+ /* @__PURE__ */ jsx("line", { x1: "19", x2: "10", y1: "4", y2: "4" }),
33
+ /* @__PURE__ */ jsx("line", { x1: "14", x2: "5", y1: "20", y2: "20" }),
34
+ /* @__PURE__ */ jsx("line", { x1: "15", x2: "9", y1: "4", y2: "20" })
35
+ ] });
36
+ const UnderlineIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
37
+ /* @__PURE__ */ jsx("path", { d: "M6 4v6a6 6 0 0 0 12 0V4" }),
38
+ /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "20", y2: "20" })
39
+ ] });
40
+ const StrikethroughIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
41
+ /* @__PURE__ */ jsx("path", { d: "M16 4H9a3 3 0 0 0-2.83 4" }),
42
+ /* @__PURE__ */ jsx("path", { d: "M14 12a4 4 0 0 1 0 8H6" }),
43
+ /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "12", y2: "12" })
44
+ ] });
45
+ const CodeIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
46
+ /* @__PURE__ */ jsx("polyline", { points: "16 18 22 12 16 6" }),
47
+ /* @__PURE__ */ jsx("polyline", { points: "8 6 2 12 8 18" })
48
+ ] });
49
+ const LinkIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
50
+ /* @__PURE__ */ jsx("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }),
51
+ /* @__PURE__ */ jsx("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })
52
+ ] });
53
+ const EraserIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
54
+ /* @__PURE__ */ jsx("path", { d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21" }),
55
+ /* @__PURE__ */ jsx("path", { d: "M22 21H7" }),
56
+ /* @__PURE__ */ jsx("path", { d: "m5 11 9 9" })
57
+ ] });
58
+ const RotateCcwIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
59
+ /* @__PURE__ */ jsx("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
60
+ /* @__PURE__ */ jsx("path", { d: "M3 3v5h5" })
61
+ ] });
62
+ const ExternalLinkIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
63
+ /* @__PURE__ */ jsx("path", { d: "M15 3h6v6" }),
64
+ /* @__PURE__ */ jsx("path", { d: "M10 14 21 3" }),
65
+ /* @__PURE__ */ jsx("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
66
+ ] });
67
+ const ImageIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
68
+ /* @__PURE__ */ jsx("rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2" }),
69
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "9", r: "2" }),
70
+ /* @__PURE__ */ jsx("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
71
+ ] });
72
+ const BlockSvg = ({ size = "1em", children, ...rest }) => /* @__PURE__ */ jsx(
73
+ "svg",
74
+ {
75
+ xmlns: "http://www.w3.org/2000/svg",
76
+ width: size,
77
+ height: size,
78
+ viewBox: "0 0 24 24",
79
+ fill: "currentColor",
80
+ stroke: "none",
81
+ "aria-hidden": "true",
82
+ focusable: "false",
83
+ ...rest,
84
+ children
85
+ }
86
+ );
87
+ const AlignLeftIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
88
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
89
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "8.6", width: "12", height: "2.4", rx: "1.2" }),
90
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
91
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "19", width: "12", height: "2.4", rx: "1.2" })
92
+ ] });
93
+ const AlignCenterIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
94
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
95
+ /* @__PURE__ */ jsx("rect", { x: "6", y: "8.6", width: "12", height: "2.4", rx: "1.2" }),
96
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
97
+ /* @__PURE__ */ jsx("rect", { x: "6", y: "19", width: "12", height: "2.4", rx: "1.2" })
98
+ ] });
99
+ const AlignRightIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
100
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
101
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "8.6", width: "12", height: "2.4", rx: "1.2" }),
102
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
103
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "19", width: "12", height: "2.4", rx: "1.2" })
104
+ ] });
105
+ const AlignJustifyIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
106
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "3.4", width: "18", height: "2.4", rx: "1.2" }),
107
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "8.6", width: "18", height: "2.4", rx: "1.2" }),
108
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "13.8", width: "18", height: "2.4", rx: "1.2" }),
109
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "19", width: "18", height: "2.4", rx: "1.2" })
110
+ ] });
111
+ const IndentIncreaseIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
112
+ /* @__PURE__ */ jsx("path", { d: "M3 6.6 8.5 10.8 3 15 Z" }),
113
+ /* @__PURE__ */ jsx("rect", { x: "10.5", y: "3.6", width: "10.5", height: "2.4", rx: "1.2" }),
114
+ /* @__PURE__ */ jsx("rect", { x: "10.5", y: "10.8", width: "10.5", height: "2.4", rx: "1.2" }),
115
+ /* @__PURE__ */ jsx("rect", { x: "10.5", y: "18", width: "10.5", height: "2.4", rx: "1.2" })
116
+ ] });
117
+ const IndentDecreaseIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
118
+ /* @__PURE__ */ jsx("path", { d: "M8.5 6.6 3 10.8 8.5 15 Z" }),
119
+ /* @__PURE__ */ jsx("rect", { x: "10.5", y: "3.6", width: "10.5", height: "2.4", rx: "1.2" }),
120
+ /* @__PURE__ */ jsx("rect", { x: "10.5", y: "10.8", width: "10.5", height: "2.4", rx: "1.2" }),
121
+ /* @__PURE__ */ jsx("rect", { x: "10.5", y: "18", width: "10.5", height: "2.4", rx: "1.2" })
122
+ ] });
123
+ const LineHeightIcon = (p) => /* @__PURE__ */ jsxs(BlockSvg, { ...p, children: [
124
+ /* @__PURE__ */ jsx("rect", { x: "1.8", y: "4.4", width: "2.4", height: "15.2", rx: "1.2" }),
125
+ /* @__PURE__ */ jsx("path", { d: "M3 2.4 5.4 5.8 H0.6 Z" }),
126
+ /* @__PURE__ */ jsx("path", { d: "M3 21.6 0.6 18.2 H5.4 Z" }),
127
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "5.6", width: "12", height: "2.4", rx: "1.2" }),
128
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "16", width: "12", height: "2.4", rx: "1.2" })
129
+ ] });
130
+ const CaptionsIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
131
+ /* @__PURE__ */ jsx("rect", { width: "18", height: "14", x: "3", y: "5", rx: "2", ry: "2" }),
132
+ /* @__PURE__ */ jsx("path", { d: "M7 15h4" }),
133
+ /* @__PURE__ */ jsx("path", { d: "M15 15h2" }),
134
+ /* @__PURE__ */ jsx("path", { d: "M7 11h2" }),
135
+ /* @__PURE__ */ jsx("path", { d: "M13 11h4" })
136
+ ] });
137
+ const CropIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
138
+ /* @__PURE__ */ jsx("path", { d: "M6 2v14a2 2 0 0 0 2 2h14" }),
139
+ /* @__PURE__ */ jsx("path", { d: "M18 22V8a2 2 0 0 0-2-2H2" })
140
+ ] });
141
+ const ImportIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
142
+ /* @__PURE__ */ jsx("path", { d: "M12 3v12" }),
143
+ /* @__PURE__ */ jsx("path", { d: "m8 11 4 4 4-4" }),
144
+ /* @__PURE__ */ jsx("path", { d: "M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4" })
145
+ ] });
146
+ const ListUnorderedIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
147
+ /* @__PURE__ */ jsx("line", { x1: "8", x2: "21", y1: "6", y2: "6" }),
148
+ /* @__PURE__ */ jsx("line", { x1: "8", x2: "21", y1: "12", y2: "12" }),
149
+ /* @__PURE__ */ jsx("line", { x1: "8", x2: "21", y1: "18", y2: "18" }),
150
+ /* @__PURE__ */ jsx("line", { x1: "3", x2: "3.01", y1: "6", y2: "6" }),
151
+ /* @__PURE__ */ jsx("line", { x1: "3", x2: "3.01", y1: "12", y2: "12" }),
152
+ /* @__PURE__ */ jsx("line", { x1: "3", x2: "3.01", y1: "18", y2: "18" })
153
+ ] });
154
+ const ListOrderedIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
155
+ /* @__PURE__ */ jsx("line", { x1: "10", x2: "21", y1: "6", y2: "6" }),
156
+ /* @__PURE__ */ jsx("line", { x1: "10", x2: "21", y1: "12", y2: "12" }),
157
+ /* @__PURE__ */ jsx("line", { x1: "10", x2: "21", y1: "18", y2: "18" }),
158
+ /* @__PURE__ */ jsx("path", { d: "M4 6h1v4" }),
159
+ /* @__PURE__ */ jsx("path", { d: "M4 10h2" }),
160
+ /* @__PURE__ */ jsx("path", { d: "M6 18H4c0-1 2-2 2-3s-1-1.5-2-1" })
161
+ ] });
162
+ const DetailsIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
163
+ /* @__PURE__ */ jsx("path", { d: "m9 7 4 5-4 5" }),
164
+ /* @__PURE__ */ jsx("path", { d: "M15 7h5" }),
165
+ /* @__PURE__ */ jsx("path", { d: "M15 12h5" }),
166
+ /* @__PURE__ */ jsx("path", { d: "M15 17h5" })
167
+ ] });
168
+ const ListChecksIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
169
+ /* @__PURE__ */ jsx("path", { d: "m3 17 2 2 4-4" }),
170
+ /* @__PURE__ */ jsx("path", { d: "m3 7 2 2 4-4" }),
171
+ /* @__PURE__ */ jsx("path", { d: "M13 6h8" }),
172
+ /* @__PURE__ */ jsx("path", { d: "M13 12h8" }),
173
+ /* @__PURE__ */ jsx("path", { d: "M13 18h8" })
174
+ ] });
175
+ const UndoIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
176
+ /* @__PURE__ */ jsx("path", { d: "M9 14 4 9l5-5" }),
177
+ /* @__PURE__ */ jsx("path", { d: "M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5 5.5 5.5 0 0 1-5.5 5.5H11" })
178
+ ] });
179
+ const RedoIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
180
+ /* @__PURE__ */ jsx("path", { d: "m15 14 5-5-5-5" }),
181
+ /* @__PURE__ */ jsx("path", { d: "M20 9H9.5A5.5 5.5 0 0 0 4 14.5 5.5 5.5 0 0 0 9.5 20H13" })
182
+ ] });
183
+ const ChevronDownIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" }) });
184
+ const CheckIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "M20 6 9 17l-5-5" }) });
185
+ const TrashIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
186
+ /* @__PURE__ */ jsx("path", { d: "M3 6h18" }),
187
+ /* @__PURE__ */ jsx("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6" }),
188
+ /* @__PURE__ */ jsx("path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
189
+ /* @__PURE__ */ jsx("line", { x1: "10", x2: "10", y1: "11", y2: "17" }),
190
+ /* @__PURE__ */ jsx("line", { x1: "14", x2: "14", y1: "11", y2: "17" })
191
+ ] });
192
+ const LockIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
193
+ /* @__PURE__ */ jsx("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
194
+ /* @__PURE__ */ jsx("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
195
+ ] });
196
+ const MenuIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
197
+ /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "12", y2: "12" }),
198
+ /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "6", y2: "6" }),
199
+ /* @__PURE__ */ jsx("line", { x1: "4", x2: "20", y1: "18", y2: "18" })
200
+ ] });
201
+ const SearchIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
202
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
203
+ /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" })
204
+ ] });
205
+ const XIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
206
+ /* @__PURE__ */ jsx("path", { d: "M18 6 6 18" }),
207
+ /* @__PURE__ */ jsx("path", { d: "m6 6 12 12" })
208
+ ] });
209
+ const ChevronLeftIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "m15 18-6-6 6-6" }) });
210
+ const ChevronRightIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" }) });
211
+ const ZoomInIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
212
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
213
+ /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" }),
214
+ /* @__PURE__ */ jsx("path", { d: "M11 8v6" }),
215
+ /* @__PURE__ */ jsx("path", { d: "M8 11h6" })
216
+ ] });
217
+ const ZoomOutIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
218
+ /* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
219
+ /* @__PURE__ */ jsx("path", { d: "m21 21-4.3-4.3" }),
220
+ /* @__PURE__ */ jsx("path", { d: "M8 11h6" })
221
+ ] });
222
+ const RotateCwIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
223
+ /* @__PURE__ */ jsx("path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8" }),
224
+ /* @__PURE__ */ jsx("path", { d: "M21 3v5h-5" })
225
+ ] });
226
+ const FitIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
227
+ /* @__PURE__ */ jsx("path", { d: "m15 15 6 6" }),
228
+ /* @__PURE__ */ jsx("path", { d: "m15 9 6-6" }),
229
+ /* @__PURE__ */ jsx("path", { d: "M21 16v5h-5" }),
230
+ /* @__PURE__ */ jsx("path", { d: "M21 8V3h-5" }),
231
+ /* @__PURE__ */ jsx("path", { d: "M3 16v5h5" }),
232
+ /* @__PURE__ */ jsx("path", { d: "m3 21 6-6" }),
233
+ /* @__PURE__ */ jsx("path", { d: "M3 8V3h5" }),
234
+ /* @__PURE__ */ jsx("path", { d: "M9 9 3 3" })
235
+ ] });
236
+ const ExpandIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
237
+ /* @__PURE__ */ jsx("path", { d: "M15 3h6v6" }),
238
+ /* @__PURE__ */ jsx("path", { d: "m21 3-7 7" }),
239
+ /* @__PURE__ */ jsx("path", { d: "M9 21H3v-6" }),
240
+ /* @__PURE__ */ jsx("path", { d: "m3 21 7-7" })
241
+ ] });
242
+ const ChevronUpIcon = (p) => /* @__PURE__ */ jsx(Svg, { ...p, children: /* @__PURE__ */ jsx("path", { d: "m18 15-6-6-6 6" }) });
243
+ const ReplaceIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
244
+ /* @__PURE__ */ jsx("path", { d: "M14 4a1 1 0 0 1 1-1" }),
245
+ /* @__PURE__ */ jsx("path", { d: "M15 10a1 1 0 0 1-1-1" }),
246
+ /* @__PURE__ */ jsx("path", { d: "M21 4a1 1 0 0 0-1-1" }),
247
+ /* @__PURE__ */ jsx("path", { d: "M21 9a1 1 0 0 1-1 1" }),
248
+ /* @__PURE__ */ jsx("path", { d: "m3 7 3 3 3-3" }),
249
+ /* @__PURE__ */ jsx("path", { d: "M6 10V5a2 2 0 0 1 2-2h2" }),
250
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" })
251
+ ] });
252
+ const ReplaceAllIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
253
+ /* @__PURE__ */ jsx("path", { d: "M14 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1" }),
254
+ /* @__PURE__ */ jsx("path", { d: "M14 4a1 1 0 0 1 1-1" }),
255
+ /* @__PURE__ */ jsx("path", { d: "M15 10a1 1 0 0 1-1-1" }),
256
+ /* @__PURE__ */ jsx("path", { d: "M19 14a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1" }),
257
+ /* @__PURE__ */ jsx("path", { d: "M21 4a1 1 0 0 0-1-1" }),
258
+ /* @__PURE__ */ jsx("path", { d: "M21 9a1 1 0 0 1-1 1" }),
259
+ /* @__PURE__ */ jsx("path", { d: "m3 7 3 3 3-3" }),
260
+ /* @__PURE__ */ jsx("path", { d: "M6 10V5a2 2 0 0 1 2-2h2" }),
261
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "14", width: "7", height: "7", rx: "1" })
262
+ ] });
263
+ const ColumnBeforeIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
264
+ /* @__PURE__ */ jsx("rect", { x: "10", y: "4", width: "11", height: "16", rx: "1" }),
265
+ /* @__PURE__ */ jsx("path", { d: "M14 4v16" }),
266
+ /* @__PURE__ */ jsx("path", { d: "M5 9v6" }),
267
+ /* @__PURE__ */ jsx("path", { d: "M2 12h6" })
268
+ ] });
269
+ const ColumnAfterIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
270
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "11", height: "16", rx: "1" }),
271
+ /* @__PURE__ */ jsx("path", { d: "M10 4v16" }),
272
+ /* @__PURE__ */ jsx("path", { d: "M19 9v6" }),
273
+ /* @__PURE__ */ jsx("path", { d: "M16 12h6" })
274
+ ] });
275
+ const ColumnDeleteIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
276
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
277
+ /* @__PURE__ */ jsx("path", { d: "M12 4v16" }),
278
+ /* @__PURE__ */ jsx("path", { d: "m8 9 8 6" }),
279
+ /* @__PURE__ */ jsx("path", { d: "m16 9-8 6" })
280
+ ] });
281
+ const RowBeforeIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
282
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "10", width: "16", height: "11", rx: "1" }),
283
+ /* @__PURE__ */ jsx("path", { d: "M4 14h16" }),
284
+ /* @__PURE__ */ jsx("path", { d: "M9 5h6" }),
285
+ /* @__PURE__ */ jsx("path", { d: "M12 2v6" })
286
+ ] });
287
+ const RowAfterIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
288
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "3", width: "16", height: "11", rx: "1" }),
289
+ /* @__PURE__ */ jsx("path", { d: "M4 10h16" }),
290
+ /* @__PURE__ */ jsx("path", { d: "M9 19h6" }),
291
+ /* @__PURE__ */ jsx("path", { d: "M12 16v6" })
292
+ ] });
293
+ const RowDeleteIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
294
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "16", height: "16", rx: "1" }),
295
+ /* @__PURE__ */ jsx("path", { d: "M4 12h16" }),
296
+ /* @__PURE__ */ jsx("path", { d: "m9 8 6 8" }),
297
+ /* @__PURE__ */ jsx("path", { d: "m15 8-6 8" })
298
+ ] });
299
+ const TableDeleteIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
300
+ /* @__PURE__ */ jsx("rect", { x: "3", y: "5", width: "18", height: "14", rx: "1" }),
301
+ /* @__PURE__ */ jsx("path", { d: "M3 9h18" }),
302
+ /* @__PURE__ */ jsx("path", { d: "M9 5v14" }),
303
+ /* @__PURE__ */ jsx("path", { d: "M15 5v14" }),
304
+ /* @__PURE__ */ jsx("path", { d: "m7 2 10 20" })
305
+ ] });
306
+ const CopyIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
307
+ /* @__PURE__ */ jsx("rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }),
308
+ /* @__PURE__ */ jsx("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })
309
+ ] });
310
+ const ChevronsUpDownIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
311
+ /* @__PURE__ */ jsx("path", { d: "m7 15 5 5 5-5" }),
312
+ /* @__PURE__ */ jsx("path", { d: "m7 9 5-5 5 5" })
313
+ ] });
314
+ const GripIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, fill: "currentColor", strokeWidth: 0, children: [
315
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "6", r: "1.25" }),
316
+ /* @__PURE__ */ jsx("circle", { cx: "15", cy: "6", r: "1.25" }),
317
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "12", r: "1.25" }),
318
+ /* @__PURE__ */ jsx("circle", { cx: "15", cy: "12", r: "1.25" }),
319
+ /* @__PURE__ */ jsx("circle", { cx: "9", cy: "18", r: "1.25" }),
320
+ /* @__PURE__ */ jsx("circle", { cx: "15", cy: "18", r: "1.25" })
321
+ ] });
322
+ const DownloadIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
323
+ /* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
324
+ /* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
325
+ /* @__PURE__ */ jsx("line", { x1: "12", x2: "12", y1: "15", y2: "3" })
326
+ ] });
327
+ const KeyboardIcon = (p) => /* @__PURE__ */ jsxs(Svg, { ...p, children: [
328
+ /* @__PURE__ */ jsx("rect", { width: "20", height: "16", x: "2", y: "4", rx: "2" }),
329
+ /* @__PURE__ */ jsx("path", { d: "M6 8h.01" }),
330
+ /* @__PURE__ */ jsx("path", { d: "M10 8h.01" }),
331
+ /* @__PURE__ */ jsx("path", { d: "M14 8h.01" }),
332
+ /* @__PURE__ */ jsx("path", { d: "M18 8h.01" }),
333
+ /* @__PURE__ */ jsx("path", { d: "M6 12h.01" }),
334
+ /* @__PURE__ */ jsx("path", { d: "M10 12h.01" }),
335
+ /* @__PURE__ */ jsx("path", { d: "M14 12h.01" }),
336
+ /* @__PURE__ */ jsx("path", { d: "M18 12h.01" }),
337
+ /* @__PURE__ */ jsx("path", { d: "M7 16h10" })
338
+ ] });
6
339
  const defaultChartLabels = {
7
340
  tabLabel: (chartType, index) => `${chartType} ${index + 1}`,
8
341
  done: "Done",
@@ -56,6 +389,18 @@ const defaultToolbarLabels = {
56
389
  imageAlignRight: "Align right",
57
390
  imageCaption: "Caption",
58
391
  imageCaptionPlaceholder: "Add a caption…",
392
+ imageCrop: "Crop",
393
+ imageCropApply: "Apply",
394
+ imageCropCancel: "Cancel",
395
+ imageCropReset: "Reset crop",
396
+ imagePreview: "Preview",
397
+ imagePreviewClose: "Close",
398
+ imagePreviewPrev: "Previous image",
399
+ imagePreviewNext: "Next image",
400
+ imagePreviewZoomOut: "Zoom out",
401
+ imagePreviewZoomIn: "Zoom in",
402
+ imagePreviewFit: "Fit",
403
+ imagePreviewRotate: "Rotate",
59
404
  importMarkdownFailed: "Markdown import failed",
60
405
  importDocument: "Import",
61
406
  importDocumentHint: "Import a file",
@@ -178,8 +523,8 @@ const defaultShortcutLabels = {
178
523
  };
179
524
  const defaultCharacterCountLabels = {
180
525
  label: "Document statistics",
181
- characters: (count) => `${count} ${count === 1 ? "character" : "characters"}`,
182
- words: (count) => `${count} ${count === 1 ? "word" : "words"}`
526
+ characters: (count2) => `${count2} ${count2 === 1 ? "character" : "characters"}`,
527
+ words: (count2) => `${count2} ${count2 === 1 ? "word" : "words"}`
183
528
  };
184
529
  const defaultEmojiSuggestionLabels = {
185
530
  menuLabel: "Emoji"
@@ -227,10 +572,10 @@ const defaultImageUploadLabels = {
227
572
  dropzoneClick: "Click to upload",
228
573
  dropzoneRest: " or drag and drop",
229
574
  dropzoneLimits: (limit, maxSizeMb) => {
230
- const count = `Maximum ${limit} file${limit === 1 ? "" : "s"}`;
231
- return maxSizeMb == null ? `${count}.` : `${count}, ${maxSizeMb}MB each.`;
575
+ const count2 = `Maximum ${limit} file${limit === 1 ? "" : "s"}`;
576
+ return maxSizeMb == null ? `${count2}.` : `${count2}, ${maxSizeMb}MB each.`;
232
577
  },
233
- uploadingCount: (count) => `Uploading ${count} files`,
578
+ uploadingCount: (count2) => `Uploading ${count2} files`,
234
579
  clearAll: "Clear all",
235
580
  remove: "Remove",
236
581
  failed: "Upload failed",
@@ -282,6 +627,18 @@ const zh = {
282
627
  imageAlignRight: "右对齐",
283
628
  imageCaption: "图片描述",
284
629
  imageCaptionPlaceholder: "添加描述…",
630
+ imageCrop: "图片剪裁",
631
+ imageCropApply: "应用",
632
+ imageCropCancel: "取消",
633
+ imageCropReset: "重置剪裁",
634
+ imagePreview: "图片预览",
635
+ imagePreviewClose: "关闭",
636
+ imagePreviewPrev: "上一张",
637
+ imagePreviewNext: "下一张",
638
+ imagePreviewZoomOut: "缩小",
639
+ imagePreviewZoomIn: "放大",
640
+ imagePreviewFit: "自适应",
641
+ imagePreviewRotate: "旋转",
285
642
  importMarkdownFailed: "Markdown 导入失败",
286
643
  importDocument: "导入",
287
644
  importDocumentHint: "导入文件",
@@ -412,8 +769,8 @@ const zh = {
412
769
  },
413
770
  characterCount: {
414
771
  label: "字数统计",
415
- characters: (count) => `${count} 字符`,
416
- words: (count) => `${count} 词`
772
+ characters: (count2) => `${count2} 字符`,
773
+ words: (count2) => `${count2} 词`
417
774
  },
418
775
  emoji: {
419
776
  menuLabel: "表情"
@@ -461,10 +818,10 @@ const zh = {
461
818
  dropzoneClick: "点击上传",
462
819
  dropzoneRest: ",或拖拽到此处",
463
820
  dropzoneLimits: (limit, maxSizeMb) => {
464
- const count = `最多 ${limit} 个文件`;
465
- return maxSizeMb == null ? `${count}。` : `${count},每个 ${maxSizeMb}MB。`;
821
+ const count2 = `最多 ${limit} 个文件`;
822
+ return maxSizeMb == null ? `${count2}。` : `${count2},每个 ${maxSizeMb}MB。`;
466
823
  },
467
- uploadingCount: (count) => `正在上传 ${count} 个文件`,
824
+ uploadingCount: (count2) => `正在上传 ${count2} 个文件`,
468
825
  clearAll: "全部清除",
469
826
  remove: "移除",
470
827
  failed: "上传失败",
@@ -490,6 +847,403 @@ const bundles = { en, zh };
490
847
  function getLocaleBundle(locale = "en") {
491
848
  return bundles[locale] ?? en;
492
849
  }
850
+ const IMAGE_PREVIEW_EVENT = "tmr-image-preview";
851
+ const ZOOM_STEP = 1.25;
852
+ const ZOOM_MIN = 0.25;
853
+ const ZOOM_MAX = 8;
854
+ const PAD_X = 48;
855
+ const PAD_Y = 88;
856
+ function requestImagePreview(img) {
857
+ img.dispatchEvent(
858
+ new CustomEvent(IMAGE_PREVIEW_EVENT, { bubbles: true, detail: { img } })
859
+ );
860
+ }
861
+ function listPreviewImages(root2) {
862
+ return [...root2.querySelectorAll("img")].filter((node) => {
863
+ if (!(node instanceof HTMLImageElement)) return false;
864
+ if (!node.getAttribute("src")) return false;
865
+ if (node.closest("[data-image-lightbox]")) return false;
866
+ return true;
867
+ });
868
+ }
869
+ function toPreviewImage(img) {
870
+ return {
871
+ src: img.getAttribute("src") ?? "",
872
+ alt: img.getAttribute("alt") ?? "",
873
+ crop: normalizeImageCrop(img.getAttribute("data-crop"))
874
+ };
875
+ }
876
+ function previewImageFromTarget(target) {
877
+ if (!(target instanceof Element)) return null;
878
+ if (target.closest("[data-image-lightbox], [data-resize-handle], [data-image-cropping]")) {
879
+ return null;
880
+ }
881
+ const frame2 = target.closest(".tmr-image-crop");
882
+ const node = frame2 ? frame2.querySelector("img") : target.closest("img");
883
+ if (!(node instanceof HTMLImageElement)) return null;
884
+ if (!node.getAttribute("src")) return null;
885
+ if (node.closest("[data-image-lightbox]")) return null;
886
+ return node;
887
+ }
888
+ function previewPixelSize(naturalWidth, naturalHeight, crop) {
889
+ if (naturalWidth <= 0 || naturalHeight <= 0) return { width: 0, height: 0 };
890
+ if (!crop) return { width: naturalWidth, height: naturalHeight };
891
+ return { width: naturalWidth * crop.w, height: naturalHeight * crop.h };
892
+ }
893
+ function fitPreviewBox(input) {
894
+ const { imageWidth, imageHeight } = input;
895
+ if (imageWidth <= 0 || imageHeight <= 0) return null;
896
+ const quarter = (input.rotation % 360 + 360) % 360;
897
+ const swapped = quarter === 90 || quarter === 270;
898
+ const screenW = swapped ? imageHeight : imageWidth;
899
+ const screenH = swapped ? imageWidth : imageHeight;
900
+ const availW = Math.max(64, input.viewportWidth - PAD_X * 2);
901
+ const availH = Math.max(64, input.viewportHeight - PAD_Y * 2);
902
+ const fitScale = Math.min(availW / screenW, availH / screenH);
903
+ if (!Number.isFinite(fitScale) || fitScale <= 0) return null;
904
+ return {
905
+ width: imageWidth * fitScale,
906
+ height: imageHeight * fitScale,
907
+ actualZoom: 1 / fitScale
908
+ };
909
+ }
910
+ function nextPreviewZoom(action, zoom, actualZoom) {
911
+ if (action === "fit") return 1;
912
+ const max = Math.max(ZOOM_MAX, actualZoom);
913
+ const min = Math.min(ZOOM_MIN, actualZoom);
914
+ const next = action === "in" ? zoom * ZOOM_STEP : zoom / ZOOM_STEP;
915
+ return Math.min(max, Math.max(min, next));
916
+ }
917
+ const root = "_root_21634_3";
918
+ const backdrop = "_backdrop_21634_13";
919
+ const stage = "_stage_21634_21";
920
+ const frame = "_frame_21634_31";
921
+ const close = "_close_21634_50";
922
+ const bar$1 = "_bar_21634_72";
923
+ const tool = "_tool_21634_88";
924
+ const count = "_count_21634_118";
925
+ const styles$1 = {
926
+ root,
927
+ backdrop,
928
+ stage,
929
+ frame,
930
+ close,
931
+ bar: bar$1,
932
+ tool,
933
+ count
934
+ };
935
+ function ImagePreviewHost({
936
+ children,
937
+ locale = "en",
938
+ activate = "click"
939
+ }) {
940
+ const ref = useRef(null);
941
+ const [session, setSession] = useState(
942
+ null
943
+ );
944
+ useEffect(() => {
945
+ const el = ref.current;
946
+ if (!el) return;
947
+ const openFrom = (img) => {
948
+ if (!el.contains(img)) return;
949
+ const nodes = listPreviewImages(el);
950
+ const index = nodes.indexOf(img);
951
+ if (index < 0) return;
952
+ setSession({ images: nodes.map(toPreviewImage), index });
953
+ };
954
+ const onActivate = (event) => {
955
+ const img = previewImageFromTarget(event.target);
956
+ if (!img) return;
957
+ event.preventDefault();
958
+ openFrom(img);
959
+ };
960
+ const onRequest = (event) => {
961
+ var _a;
962
+ const img = (_a = event.detail) == null ? void 0 : _a.img;
963
+ if (!(img instanceof HTMLImageElement)) return;
964
+ openFrom(img);
965
+ };
966
+ const eventName = activate === "dblclick" ? "dblclick" : "click";
967
+ el.addEventListener(eventName, onActivate);
968
+ el.addEventListener(IMAGE_PREVIEW_EVENT, onRequest);
969
+ return () => {
970
+ el.removeEventListener(eventName, onActivate);
971
+ el.removeEventListener(IMAGE_PREVIEW_EVENT, onRequest);
972
+ };
973
+ }, [activate]);
974
+ const labels = getLocaleBundle(locale).toolbar;
975
+ return /* @__PURE__ */ jsxs(
976
+ "div",
977
+ {
978
+ ref,
979
+ className: styles$1.root,
980
+ "data-image-preview": activate === "click" ? "click" : void 0,
981
+ children: [
982
+ children,
983
+ session && typeof document !== "undefined" ? createPortal(
984
+ /* @__PURE__ */ jsx(
985
+ ImageLightbox,
986
+ {
987
+ images: session.images,
988
+ index: session.index,
989
+ label: labels.imagePreview,
990
+ closeLabel: labels.imagePreviewClose,
991
+ prevLabel: labels.imagePreviewPrev,
992
+ nextLabel: labels.imagePreviewNext,
993
+ zoomOutLabel: labels.imagePreviewZoomOut,
994
+ zoomInLabel: labels.imagePreviewZoomIn,
995
+ fitLabel: labels.imagePreviewFit,
996
+ rotateLabel: labels.imagePreviewRotate,
997
+ onIndex: (index) => setSession((current) => current ? { ...current, index } : current),
998
+ onClose: () => setSession(null)
999
+ }
1000
+ ),
1001
+ document.body
1002
+ ) : null
1003
+ ]
1004
+ }
1005
+ );
1006
+ }
1007
+ function ImageLightbox({
1008
+ images,
1009
+ index,
1010
+ label,
1011
+ closeLabel,
1012
+ prevLabel,
1013
+ nextLabel,
1014
+ zoomOutLabel,
1015
+ zoomInLabel,
1016
+ fitLabel,
1017
+ rotateLabel,
1018
+ onIndex,
1019
+ onClose
1020
+ }) {
1021
+ const image = images[index];
1022
+ const dialogRef = useRef(null);
1023
+ const imgRef = useRef(null);
1024
+ const [natural, setNatural] = useState(null);
1025
+ const [viewport, setViewport] = useState(() => ({
1026
+ w: typeof window === "undefined" ? 0 : window.innerWidth,
1027
+ h: typeof window === "undefined" ? 0 : window.innerHeight
1028
+ }));
1029
+ const [zoom, setZoom] = useState(1);
1030
+ const [rotation, setRotation] = useState(0);
1031
+ useEffect(() => {
1032
+ setZoom(1);
1033
+ setRotation(0);
1034
+ setNatural(null);
1035
+ }, [index, image == null ? void 0 : image.src]);
1036
+ useEffect(() => {
1037
+ const node = imgRef.current;
1038
+ if (!node) return;
1039
+ const read = () => {
1040
+ if (node.naturalWidth > 0) {
1041
+ setNatural({ w: node.naturalWidth, h: node.naturalHeight });
1042
+ }
1043
+ };
1044
+ read();
1045
+ node.addEventListener("load", read);
1046
+ return () => node.removeEventListener("load", read);
1047
+ }, [index, image == null ? void 0 : image.src]);
1048
+ useEffect(() => {
1049
+ const onResize = () => setViewport({ w: window.innerWidth, h: window.innerHeight });
1050
+ window.addEventListener("resize", onResize);
1051
+ return () => window.removeEventListener("resize", onResize);
1052
+ }, []);
1053
+ useEffect(() => {
1054
+ var _a;
1055
+ const prev = document.body.style.overflow;
1056
+ document.body.style.overflow = "hidden";
1057
+ (_a = dialogRef.current) == null ? void 0 : _a.focus();
1058
+ return () => {
1059
+ document.body.style.overflow = prev;
1060
+ };
1061
+ }, []);
1062
+ const pixels = image ? previewPixelSize((natural == null ? void 0 : natural.w) ?? 0, (natural == null ? void 0 : natural.h) ?? 0, image.crop) : { width: 0, height: 0 };
1063
+ const fit = fitPreviewBox({
1064
+ viewportWidth: viewport.w,
1065
+ viewportHeight: viewport.h,
1066
+ imageWidth: pixels.width,
1067
+ imageHeight: pixels.height,
1068
+ rotation
1069
+ });
1070
+ const actualZoom = (fit == null ? void 0 : fit.actualZoom) ?? 1;
1071
+ useEffect(() => {
1072
+ const onKey = (event) => {
1073
+ if (event.key === "Escape") {
1074
+ event.preventDefault();
1075
+ event.stopPropagation();
1076
+ onClose();
1077
+ return;
1078
+ }
1079
+ if (event.key === "ArrowLeft") {
1080
+ event.preventDefault();
1081
+ event.stopPropagation();
1082
+ if (index > 0) onIndex(index - 1);
1083
+ return;
1084
+ }
1085
+ if (event.key === "ArrowRight") {
1086
+ event.preventDefault();
1087
+ event.stopPropagation();
1088
+ if (index < images.length - 1) onIndex(index + 1);
1089
+ return;
1090
+ }
1091
+ };
1092
+ document.addEventListener("keydown", onKey, true);
1093
+ return () => document.removeEventListener("keydown", onKey, true);
1094
+ }, [images.length, index, onClose, onIndex]);
1095
+ if (!image) return null;
1096
+ const applyZoom = (action) => {
1097
+ setZoom(nextPreviewZoom(action, zoom, actualZoom));
1098
+ };
1099
+ const cropStyle = image.crop ? cropImageBox(image.crop) : null;
1100
+ return /* @__PURE__ */ jsxs(
1101
+ "div",
1102
+ {
1103
+ ref: dialogRef,
1104
+ className: styles$1.backdrop,
1105
+ "data-image-lightbox": "",
1106
+ role: "dialog",
1107
+ "aria-modal": "true",
1108
+ "aria-label": label,
1109
+ tabIndex: -1,
1110
+ children: [
1111
+ /* @__PURE__ */ jsx(
1112
+ "button",
1113
+ {
1114
+ type: "button",
1115
+ className: styles$1.close,
1116
+ "data-image-preview-action": "close",
1117
+ title: closeLabel,
1118
+ "aria-label": closeLabel,
1119
+ onClick: onClose,
1120
+ children: /* @__PURE__ */ jsx(XIcon, { size: 22 })
1121
+ }
1122
+ ),
1123
+ /* @__PURE__ */ jsx(
1124
+ "div",
1125
+ {
1126
+ className: styles$1.stage,
1127
+ onClick: (event) => {
1128
+ if (event.target === event.currentTarget) onClose();
1129
+ },
1130
+ children: /* @__PURE__ */ jsx(
1131
+ "div",
1132
+ {
1133
+ className: styles$1.frame,
1134
+ style: {
1135
+ width: fit ? `${fit.width}px` : void 0,
1136
+ height: fit ? `${fit.height}px` : void 0,
1137
+ visibility: fit ? "visible" : "hidden",
1138
+ transform: `rotate(${rotation}deg) scale(${zoom})`
1139
+ },
1140
+ children: /* @__PURE__ */ jsx(
1141
+ "img",
1142
+ {
1143
+ ref: imgRef,
1144
+ src: image.src,
1145
+ alt: image.alt,
1146
+ draggable: false,
1147
+ style: cropStyle ? {
1148
+ position: "absolute",
1149
+ maxWidth: "none",
1150
+ width: cropStyle.width,
1151
+ height: cropStyle.height,
1152
+ left: cropStyle.left,
1153
+ top: cropStyle.top
1154
+ } : void 0
1155
+ }
1156
+ )
1157
+ }
1158
+ )
1159
+ }
1160
+ ),
1161
+ /* @__PURE__ */ jsxs("div", { className: styles$1.bar, role: "toolbar", "aria-label": label, children: [
1162
+ /* @__PURE__ */ jsx(
1163
+ "button",
1164
+ {
1165
+ type: "button",
1166
+ className: styles$1.tool,
1167
+ "data-image-preview-action": "prev",
1168
+ title: prevLabel,
1169
+ "aria-label": prevLabel,
1170
+ disabled: index <= 0,
1171
+ onClick: () => onIndex(index - 1),
1172
+ children: /* @__PURE__ */ jsx(ChevronLeftIcon, { size: 16 })
1173
+ }
1174
+ ),
1175
+ /* @__PURE__ */ jsxs("span", { className: styles$1.count, children: [
1176
+ index + 1,
1177
+ "/",
1178
+ images.length
1179
+ ] }),
1180
+ /* @__PURE__ */ jsx(
1181
+ "button",
1182
+ {
1183
+ type: "button",
1184
+ className: styles$1.tool,
1185
+ "data-image-preview-action": "next",
1186
+ title: nextLabel,
1187
+ "aria-label": nextLabel,
1188
+ disabled: index >= images.length - 1,
1189
+ onClick: () => onIndex(index + 1),
1190
+ children: /* @__PURE__ */ jsx(ChevronRightIcon, { size: 16 })
1191
+ }
1192
+ ),
1193
+ /* @__PURE__ */ jsx(
1194
+ "button",
1195
+ {
1196
+ type: "button",
1197
+ className: styles$1.tool,
1198
+ "data-image-preview-action": "zoom-out",
1199
+ title: zoomOutLabel,
1200
+ "aria-label": zoomOutLabel,
1201
+ onClick: () => applyZoom("out"),
1202
+ children: /* @__PURE__ */ jsx(ZoomOutIcon, { size: 16 })
1203
+ }
1204
+ ),
1205
+ /* @__PURE__ */ jsx(
1206
+ "button",
1207
+ {
1208
+ type: "button",
1209
+ className: styles$1.tool,
1210
+ "data-image-preview-action": "zoom-in",
1211
+ title: zoomInLabel,
1212
+ "aria-label": zoomInLabel,
1213
+ onClick: () => applyZoom("in"),
1214
+ children: /* @__PURE__ */ jsx(ZoomInIcon, { size: 16 })
1215
+ }
1216
+ ),
1217
+ /* @__PURE__ */ jsx(
1218
+ "button",
1219
+ {
1220
+ type: "button",
1221
+ className: styles$1.tool,
1222
+ "data-image-preview-action": "fit",
1223
+ title: fitLabel,
1224
+ "aria-label": fitLabel,
1225
+ "aria-pressed": Math.abs(zoom - 1) < 0.02,
1226
+ onClick: () => applyZoom("fit"),
1227
+ children: /* @__PURE__ */ jsx(FitIcon, { size: 16 })
1228
+ }
1229
+ ),
1230
+ /* @__PURE__ */ jsx(
1231
+ "button",
1232
+ {
1233
+ type: "button",
1234
+ className: styles$1.tool,
1235
+ "data-image-preview-action": "rotate",
1236
+ title: rotateLabel,
1237
+ "aria-label": rotateLabel,
1238
+ onClick: () => setRotation((current) => (current + 90) % 360),
1239
+ children: /* @__PURE__ */ jsx(RotateCwIcon, { size: 16 })
1240
+ }
1241
+ )
1242
+ ] })
1243
+ ]
1244
+ }
1245
+ );
1246
+ }
493
1247
  function toNumber(value) {
494
1248
  if (typeof value === "number" && !Number.isNaN(value)) return value;
495
1249
  if (typeof value === "string") {
@@ -1060,8 +1814,8 @@ function sameTocItems(a, b) {
1060
1814
  }
1061
1815
  );
1062
1816
  }
1063
- function readTocItems(root) {
1064
- const nodes = root.querySelectorAll("[data-toc-id]");
1817
+ function readTocItems(root2) {
1818
+ const nodes = root2.querySelectorAll("[data-toc-id]");
1065
1819
  const items = [];
1066
1820
  nodes.forEach((el) => {
1067
1821
  const id = el.getAttribute("data-toc-id");
@@ -1073,7 +1827,7 @@ function readTocItems(root) {
1073
1827
  });
1074
1828
  return items;
1075
1829
  }
1076
- function findCitationRefElement(target, root) {
1830
+ function findCitationRefElement(target, root2) {
1077
1831
  let node = null;
1078
1832
  if (target instanceof Element) node = target;
1079
1833
  else if (target instanceof Text) node = target.parentElement;
@@ -1081,7 +1835,7 @@ function findCitationRefElement(target, root) {
1081
1835
  if (!(node instanceof Element)) return null;
1082
1836
  const el = node.closest(".citation-ref");
1083
1837
  if (!(el instanceof HTMLElement)) return null;
1084
- if (!root.contains(el)) return null;
1838
+ if (!root2.contains(el)) return null;
1085
1839
  return el;
1086
1840
  }
1087
1841
  function readCitationAttrs(el) {
@@ -1102,8 +1856,8 @@ function CitationInteractive({
1102
1856
  enterRef.current = onCitationEnter;
1103
1857
  leaveRef.current = onCitationLeave;
1104
1858
  useEffect(() => {
1105
- const root = containerRef.current;
1106
- if (!root) return;
1859
+ const root2 = containerRef.current;
1860
+ if (!root2) return;
1107
1861
  let currentEl = null;
1108
1862
  const emitEnter = (el) => {
1109
1863
  currentEl = el;
@@ -1117,7 +1871,7 @@ function CitationInteractive({
1117
1871
  };
1118
1872
  const ACTIVE_ATTR = "data-tmr-citation-active";
1119
1873
  const onClick = (e) => {
1120
- const el = findCitationRefElement(e.target, root);
1874
+ const el = findCitationRefElement(e.target, root2);
1121
1875
  if (el) {
1122
1876
  e.preventDefault();
1123
1877
  e.stopPropagation();
@@ -1133,10 +1887,10 @@ function CitationInteractive({
1133
1887
  const onKeyDown = (e) => {
1134
1888
  if (e.key === "Escape") emitLeave();
1135
1889
  };
1136
- root.addEventListener("click", onClick, true);
1890
+ root2.addEventListener("click", onClick, true);
1137
1891
  document.addEventListener("keydown", onKeyDown);
1138
1892
  return () => {
1139
- root.removeEventListener("click", onClick, true);
1893
+ root2.removeEventListener("click", onClick, true);
1140
1894
  document.removeEventListener("keydown", onKeyDown);
1141
1895
  };
1142
1896
  }, [containerRef]);
@@ -1170,11 +1924,11 @@ function ContentOutline({
1170
1924
  });
1171
1925
  return () => observer.disconnect();
1172
1926
  }, [toc, watch]);
1173
- const root = ref.current;
1174
- const show = toc && !mobile && items.length > 0 && root !== null;
1175
- return /* @__PURE__ */ jsxs("div", { className: styles$1.editorHost, children: [
1176
- show && root ? /* @__PURE__ */ jsx(EditorToc, { items, editorDom: root, locale }) : null,
1177
- /* @__PURE__ */ jsx("div", { ref, className: show ? styles$1.withToc : void 0, children })
1927
+ const root2 = ref.current;
1928
+ const show = toc && !mobile && items.length > 0 && root2 !== null;
1929
+ return /* @__PURE__ */ jsxs("div", { className: styles$2.editorHost, children: [
1930
+ show && root2 ? /* @__PURE__ */ jsx(EditorToc, { items, editorDom: root2, locale }) : null,
1931
+ /* @__PURE__ */ jsx("div", { ref, className: show ? styles$2.withToc : void 0, children })
1178
1932
  ] });
1179
1933
  }
1180
1934
  function ReaderReportContent({
@@ -1184,7 +1938,7 @@ function ReaderReportContent({
1184
1938
  locale = "en",
1185
1939
  ...rest
1186
1940
  }) {
1187
- return /* @__PURE__ */ jsx(ContentOutline, { toc, locale, watch: html, children: /* @__PURE__ */ jsx(ReportContent, { html, className, ...rest }) });
1941
+ return /* @__PURE__ */ jsx(ContentOutline, { toc, locale, watch: html, children: /* @__PURE__ */ jsx(ImagePreviewHost, { locale, activate: "click", children: /* @__PURE__ */ jsx(ReportContent, { html, className, ...rest }) }) });
1188
1942
  }
1189
1943
  function ReportContentInteractive({
1190
1944
  onCitationEnter,
@@ -1334,20 +2088,77 @@ function ReportContentWithCharts({
1334
2088
  ] });
1335
2089
  }
1336
2090
  export {
2091
+ LinkIcon as $,
2092
+ AlignRightIcon as A,
2093
+ RotateCcwIcon as B,
1337
2094
  ChartMount as C,
1338
- EditorToc as E,
2095
+ DownloadIcon as D,
2096
+ EraserIcon as E,
2097
+ ExternalLinkIcon as F,
2098
+ GripIcon as G,
2099
+ TableDeleteIcon as H,
2100
+ ImagePreviewHost as I,
2101
+ ColumnBeforeIcon as J,
2102
+ KeyboardIcon as K,
2103
+ ColumnAfterIcon as L,
2104
+ ColumnDeleteIcon as M,
2105
+ RowBeforeIcon as N,
2106
+ RowAfterIcon as O,
2107
+ RowDeleteIcon as P,
2108
+ RedoIcon as Q,
1339
2109
  ReaderReportContent as R,
2110
+ SearchIcon as S,
2111
+ TrashIcon as T,
2112
+ UndoIcon as U,
2113
+ BoldIcon as V,
2114
+ ItalicIcon as W,
2115
+ XIcon as X,
2116
+ UnderlineIcon as Y,
2117
+ StrikethroughIcon as Z,
2118
+ CodeIcon as _,
1340
2119
  CitationInteractive as a,
2120
+ ImageIcon as a0,
2121
+ DetailsIcon as a1,
2122
+ AlignJustifyIcon as a2,
2123
+ IndentIncreaseIcon as a3,
2124
+ IndentDecreaseIcon as a4,
2125
+ LineHeightIcon as a5,
2126
+ ListUnorderedIcon as a6,
2127
+ ListOrderedIcon as a7,
2128
+ ListChecksIcon as a8,
2129
+ ChevronLeftIcon as a9,
2130
+ ChevronRightIcon as aa,
2131
+ FitIcon as ab,
2132
+ ImportIcon as ac,
2133
+ LockIcon as ad,
2134
+ MenuIcon as ae,
2135
+ RotateCwIcon as af,
2136
+ ZoomInIcon as ag,
2137
+ ZoomOutIcon as ah,
1341
2138
  ReportContentInteractive as b,
1342
2139
  ReportContentWithCharts as c,
1343
- renderOrUpdateChart as d,
1344
- destroyChart as e,
2140
+ ChevronUpIcon as d,
2141
+ ChevronDownIcon as e,
1345
2142
  findCitationRefElement as f,
1346
2143
  getLocaleBundle as g,
1347
- sameTocItems as h,
2144
+ ReplaceIcon as h,
2145
+ ReplaceAllIcon as i,
2146
+ renderOrUpdateChart as j,
2147
+ destroyChart as k,
2148
+ CheckIcon as l,
1348
2149
  mountChartsInContainer as m,
2150
+ CopyIcon as n,
2151
+ ChevronsUpDownIcon as o,
2152
+ EditorToc as p,
2153
+ sameTocItems as q,
1349
2154
  readCitationAttrs as r,
1350
2155
  scrollToTocHeading as s,
1351
- useIsMobile as u
2156
+ AlignCenterIcon as t,
2157
+ useIsMobile as u,
2158
+ AlignLeftIcon as v,
2159
+ CropIcon as w,
2160
+ CaptionsIcon as x,
2161
+ ExpandIcon as y,
2162
+ requestImagePreview as z
1352
2163
  };
1353
- //# sourceMappingURL=ReportContentWithCharts-BMpzNVsX.js.map
2164
+ //# sourceMappingURL=ReportContentWithCharts-cjidlvfi.js.map