@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260827101734 → 0.8.1-dev.20260829044749
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/CommentRendererClient-JBEXVDPU.mjs +948 -0
- package/dist/CommentRendererClient-LO3DHVJE.mjs +950 -0
- package/dist/{DataBindingControls-ESDLOHNB.mjs → DataBindingControls-JLAO3NJL.mjs} +1 -1
- package/dist/{DataBindingControls-WJAY5HFO.mjs → DataBindingControls-Y4JXUDZV.mjs} +1 -1
- package/dist/{InputControlClient-4M2BZXQO.mjs → InputControlClient-POQDFVL3.mjs} +4 -2
- package/dist/chunk-7OCDXSTR.mjs +44 -0
- package/dist/{chunk-GKI42H4B.mjs → chunk-GGG5MJLN.mjs} +1 -1
- package/dist/chunk-JDX47MFV.mjs +47 -0
- package/dist/chunk-UPCAOGEY.mjs +27 -0
- package/dist/{chunk-GJOJX2O3.mjs → chunk-XTG4JW2O.mjs} +0 -22
- package/dist/index.js +5574 -5079
- package/dist/index.mjs +389 -949
- package/dist/server.js +4871 -4376
- package/dist/server.mjs +186 -748
- package/package.json +1 -1
- package/dist/{InputControlClient-AORN4DRF.mjs → InputControlClient-XC24HYZX.mjs} +3 -3
|
@@ -0,0 +1,948 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
asElementNode,
|
|
4
|
+
isTextNode,
|
|
5
|
+
parseSerializedContent
|
|
6
|
+
} from "./chunk-7OCDXSTR.mjs";
|
|
7
|
+
import {
|
|
8
|
+
AssetUtility_default
|
|
9
|
+
} from "./chunk-TQ6BXQ3A.mjs";
|
|
10
|
+
|
|
11
|
+
// src/components/controls/view/CommentRendererClient.tsx
|
|
12
|
+
import React4 from "react";
|
|
13
|
+
|
|
14
|
+
// src/components/controls/view/commentImages.ts
|
|
15
|
+
var INDIVIDUAL_IMAGE_THRESHOLD = 1;
|
|
16
|
+
var MAX_VISIBLE_GALLERY_IMAGES = 4;
|
|
17
|
+
var isImageNode = (node) => !!node && !isTextNode(node) && asElementNode(node).type === "image";
|
|
18
|
+
var flattenText = (node) => {
|
|
19
|
+
if (!node) return "";
|
|
20
|
+
if (isTextNode(node)) return node.text ?? "";
|
|
21
|
+
return (asElementNode(node).children ?? []).map(flattenText).join("");
|
|
22
|
+
};
|
|
23
|
+
var isBlankFiller = (node) => {
|
|
24
|
+
if (!node || isTextNode(node)) return false;
|
|
25
|
+
const element = asElementNode(node);
|
|
26
|
+
if (element.type === "linebreak" || element.type === "line-break") return true;
|
|
27
|
+
if (element.type === "paragraph") return flattenText(node).trim() === "";
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
var groupConsecutiveImages = (nodes) => {
|
|
31
|
+
const groups = [];
|
|
32
|
+
let i = 0;
|
|
33
|
+
while (i < nodes.length) {
|
|
34
|
+
const node = nodes[i];
|
|
35
|
+
if (!isImageNode(node)) {
|
|
36
|
+
groups.push({ kind: "other", node });
|
|
37
|
+
i += 1;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
const runImages = [asElementNode(node)];
|
|
41
|
+
let cursor = i + 1;
|
|
42
|
+
while (cursor < nodes.length) {
|
|
43
|
+
if (isImageNode(nodes[cursor])) {
|
|
44
|
+
runImages.push(asElementNode(nodes[cursor]));
|
|
45
|
+
cursor += 1;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
if (isBlankFiller(nodes[cursor])) {
|
|
49
|
+
let peek = cursor + 1;
|
|
50
|
+
while (peek < nodes.length && isBlankFiller(nodes[peek])) {
|
|
51
|
+
peek += 1;
|
|
52
|
+
}
|
|
53
|
+
if (peek < nodes.length && isImageNode(nodes[peek])) {
|
|
54
|
+
cursor = peek;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
|
+
groups.push({ kind: "images", nodes: runImages });
|
|
61
|
+
i = cursor;
|
|
62
|
+
}
|
|
63
|
+
return groups;
|
|
64
|
+
};
|
|
65
|
+
var pickUrl = (node) => typeof node.url === "string" && node.url || typeof node.src === "string" && node.src || typeof node.assetUrl === "string" && node.assetUrl || "";
|
|
66
|
+
var pickAlt = (node) => typeof node.fileName === "string" && node.fileName || typeof node.altText === "string" && node.altText || typeof node.alt === "string" && node.alt || "";
|
|
67
|
+
var resolveCommentImageUrl = (node, assetBaseUrl) => {
|
|
68
|
+
const raw = pickUrl(node);
|
|
69
|
+
if (!raw) return void 0;
|
|
70
|
+
return AssetUtility_default.resolveUrl(assetBaseUrl, raw);
|
|
71
|
+
};
|
|
72
|
+
var collectCommentImages = (nodes, assetBaseUrl) => {
|
|
73
|
+
if (!nodes || nodes.length === 0) {
|
|
74
|
+
return [];
|
|
75
|
+
}
|
|
76
|
+
const images = [];
|
|
77
|
+
const walk = (list) => {
|
|
78
|
+
for (const node of list) {
|
|
79
|
+
if (!node || isTextNode(node)) continue;
|
|
80
|
+
const element = asElementNode(node);
|
|
81
|
+
if (element.type === "image") {
|
|
82
|
+
const src = resolveCommentImageUrl(element, assetBaseUrl);
|
|
83
|
+
if (src) {
|
|
84
|
+
images.push({ src, alt: pickAlt(element) });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (Array.isArray(element.children)) {
|
|
88
|
+
walk(element.children);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
walk(nodes);
|
|
93
|
+
return images;
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
// src/components/controls/view/CommentNodeRenderer.tsx
|
|
97
|
+
import React3 from "react";
|
|
98
|
+
|
|
99
|
+
// src/components/controls/view/CommentImagePreviewContext.tsx
|
|
100
|
+
import React2 from "react";
|
|
101
|
+
|
|
102
|
+
// src/components/controls/view/CommentImageLightbox.tsx
|
|
103
|
+
import { useEffect } from "react";
|
|
104
|
+
import { createPortal } from "react-dom";
|
|
105
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
106
|
+
var overlayStyle = {
|
|
107
|
+
position: "fixed",
|
|
108
|
+
inset: 0,
|
|
109
|
+
zIndex: 1e3,
|
|
110
|
+
display: "flex",
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
justifyContent: "center",
|
|
113
|
+
background: "rgba(0, 0, 0, 0.85)",
|
|
114
|
+
padding: "2rem",
|
|
115
|
+
cursor: "zoom-out"
|
|
116
|
+
};
|
|
117
|
+
var imgStyle = {
|
|
118
|
+
maxWidth: "100%",
|
|
119
|
+
maxHeight: "100%",
|
|
120
|
+
objectFit: "contain",
|
|
121
|
+
borderRadius: "0.25rem",
|
|
122
|
+
boxShadow: "0 10px 40px rgba(0, 0, 0, 0.4)",
|
|
123
|
+
cursor: "default",
|
|
124
|
+
zIndex: 1
|
|
125
|
+
};
|
|
126
|
+
var roundBtnStyle = {
|
|
127
|
+
position: "fixed",
|
|
128
|
+
display: "flex",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
justifyContent: "center",
|
|
131
|
+
borderRadius: "9999px",
|
|
132
|
+
background: "rgba(255, 255, 255, 0.12)",
|
|
133
|
+
color: "#fff",
|
|
134
|
+
border: "none",
|
|
135
|
+
cursor: "pointer",
|
|
136
|
+
lineHeight: 1,
|
|
137
|
+
zIndex: 2
|
|
138
|
+
};
|
|
139
|
+
var closeStyle = {
|
|
140
|
+
...roundBtnStyle,
|
|
141
|
+
top: "1rem",
|
|
142
|
+
right: "1.25rem",
|
|
143
|
+
width: "2.5rem",
|
|
144
|
+
height: "2.5rem",
|
|
145
|
+
fontSize: "1.5rem"
|
|
146
|
+
};
|
|
147
|
+
var navStyle = (side, disabled) => ({
|
|
148
|
+
...roundBtnStyle,
|
|
149
|
+
top: "50%",
|
|
150
|
+
transform: "translateY(-50%)",
|
|
151
|
+
[side]: "1rem",
|
|
152
|
+
width: "2.75rem",
|
|
153
|
+
height: "2.75rem",
|
|
154
|
+
fontSize: "1.75rem",
|
|
155
|
+
opacity: disabled ? 0.25 : 1,
|
|
156
|
+
cursor: disabled ? "default" : "pointer"
|
|
157
|
+
});
|
|
158
|
+
var counterStyle = {
|
|
159
|
+
position: "fixed",
|
|
160
|
+
bottom: "1.25rem",
|
|
161
|
+
left: "50%",
|
|
162
|
+
transform: "translateX(-50%)",
|
|
163
|
+
padding: "0.25rem 0.75rem",
|
|
164
|
+
borderRadius: "9999px",
|
|
165
|
+
background: "rgba(255, 255, 255, 0.12)",
|
|
166
|
+
color: "#fff",
|
|
167
|
+
fontSize: "0.75rem",
|
|
168
|
+
fontWeight: 500,
|
|
169
|
+
zIndex: 2
|
|
170
|
+
};
|
|
171
|
+
var CommentImageLightbox = ({
|
|
172
|
+
images,
|
|
173
|
+
index,
|
|
174
|
+
onIndexChange,
|
|
175
|
+
onClose
|
|
176
|
+
}) => {
|
|
177
|
+
const hasPrev = index > 0;
|
|
178
|
+
const hasNext = index < images.length - 1;
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
const handleKeyDown = (event) => {
|
|
181
|
+
if (event.key === "Escape") {
|
|
182
|
+
onClose();
|
|
183
|
+
} else if (event.key === "ArrowLeft" && hasPrev) {
|
|
184
|
+
onIndexChange(index - 1);
|
|
185
|
+
} else if (event.key === "ArrowRight" && hasNext) {
|
|
186
|
+
onIndexChange(index + 1);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
190
|
+
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
191
|
+
}, [onClose, onIndexChange, index, hasPrev, hasNext]);
|
|
192
|
+
const current = images[index];
|
|
193
|
+
if (typeof document === "undefined" || !current) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
return createPortal(
|
|
197
|
+
/* @__PURE__ */ jsxs(
|
|
198
|
+
"div",
|
|
199
|
+
{
|
|
200
|
+
className: "comment-image-lightbox",
|
|
201
|
+
role: "dialog",
|
|
202
|
+
"aria-modal": "true",
|
|
203
|
+
"aria-label": current.alt || "Image preview",
|
|
204
|
+
style: overlayStyle,
|
|
205
|
+
onClick: onClose,
|
|
206
|
+
children: [
|
|
207
|
+
/* @__PURE__ */ jsx(
|
|
208
|
+
"button",
|
|
209
|
+
{
|
|
210
|
+
type: "button",
|
|
211
|
+
"aria-label": "Close preview",
|
|
212
|
+
className: "comment-image-lightbox-close",
|
|
213
|
+
style: closeStyle,
|
|
214
|
+
onClick: onClose,
|
|
215
|
+
children: "\xD7"
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
images.length > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
219
|
+
/* @__PURE__ */ jsx(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
"aria-label": "Previous image",
|
|
224
|
+
disabled: !hasPrev,
|
|
225
|
+
className: "comment-image-lightbox-nav",
|
|
226
|
+
style: navStyle("left", !hasPrev),
|
|
227
|
+
onClick: (event) => {
|
|
228
|
+
event.stopPropagation();
|
|
229
|
+
if (hasPrev) {
|
|
230
|
+
onIndexChange(index - 1);
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
children: "\u2039"
|
|
234
|
+
}
|
|
235
|
+
),
|
|
236
|
+
/* @__PURE__ */ jsx(
|
|
237
|
+
"button",
|
|
238
|
+
{
|
|
239
|
+
type: "button",
|
|
240
|
+
"aria-label": "Next image",
|
|
241
|
+
disabled: !hasNext,
|
|
242
|
+
className: "comment-image-lightbox-nav",
|
|
243
|
+
style: navStyle("right", !hasNext),
|
|
244
|
+
onClick: (event) => {
|
|
245
|
+
event.stopPropagation();
|
|
246
|
+
if (hasNext) {
|
|
247
|
+
onIndexChange(index + 1);
|
|
248
|
+
}
|
|
249
|
+
},
|
|
250
|
+
children: "\u203A"
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
/* @__PURE__ */ jsxs("div", { className: "comment-image-lightbox-counter", style: counterStyle, children: [
|
|
254
|
+
index + 1,
|
|
255
|
+
" / ",
|
|
256
|
+
images.length
|
|
257
|
+
] })
|
|
258
|
+
] }) : null,
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
"img",
|
|
261
|
+
{
|
|
262
|
+
src: current.src,
|
|
263
|
+
alt: current.alt,
|
|
264
|
+
className: "comment-image-lightbox-img",
|
|
265
|
+
style: imgStyle,
|
|
266
|
+
onClick: (event) => event.stopPropagation()
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
document.body
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
var CommentImageLightbox_default = CommentImageLightbox;
|
|
276
|
+
|
|
277
|
+
// src/components/controls/view/CommentImagePreviewContext.tsx
|
|
278
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
279
|
+
var CommentImagePreviewContext = React2.createContext(null);
|
|
280
|
+
var useCommentImagePreview = () => React2.useContext(CommentImagePreviewContext);
|
|
281
|
+
var CommentImagePreviewProvider = ({ images, children }) => {
|
|
282
|
+
const [previewIndex, setPreviewIndex] = React2.useState(null);
|
|
283
|
+
const value = React2.useMemo(
|
|
284
|
+
() => ({
|
|
285
|
+
hasPreview: images.length > 0,
|
|
286
|
+
openPreview: (src) => {
|
|
287
|
+
const idx = images.findIndex((image) => image.src === src);
|
|
288
|
+
if (idx >= 0) {
|
|
289
|
+
setPreviewIndex(idx);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}),
|
|
293
|
+
[images]
|
|
294
|
+
);
|
|
295
|
+
return /* @__PURE__ */ jsxs2(CommentImagePreviewContext.Provider, { value, children: [
|
|
296
|
+
children,
|
|
297
|
+
previewIndex !== null ? /* @__PURE__ */ jsx2(
|
|
298
|
+
CommentImageLightbox_default,
|
|
299
|
+
{
|
|
300
|
+
images,
|
|
301
|
+
index: previewIndex,
|
|
302
|
+
onIndexChange: setPreviewIndex,
|
|
303
|
+
onClose: () => setPreviewIndex(null)
|
|
304
|
+
}
|
|
305
|
+
) : null
|
|
306
|
+
] });
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
// src/components/controls/view/CommentImageNode.tsx
|
|
310
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
311
|
+
var CommentImageNode = ({ node, assetBaseUrl }) => {
|
|
312
|
+
const preview = useCommentImagePreview();
|
|
313
|
+
const rawUrl = typeof node.url === "string" && node.url || typeof node.src === "string" && node.src || typeof node.assetUrl === "string" && node.assetUrl || "";
|
|
314
|
+
if (!rawUrl) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
const resolvedUrl = AssetUtility_default.resolveUrl(assetBaseUrl, rawUrl);
|
|
318
|
+
if (!resolvedUrl) {
|
|
319
|
+
return null;
|
|
320
|
+
}
|
|
321
|
+
const alt = typeof node.fileName === "string" && node.fileName || typeof node.altText === "string" && node.altText || typeof node.alt === "string" && node.alt || "";
|
|
322
|
+
const clickable = !!preview?.hasPreview;
|
|
323
|
+
return /* @__PURE__ */ jsx3(
|
|
324
|
+
"img",
|
|
325
|
+
{
|
|
326
|
+
className: "comment-node-image",
|
|
327
|
+
src: resolvedUrl,
|
|
328
|
+
alt,
|
|
329
|
+
loading: "lazy",
|
|
330
|
+
onClick: clickable ? () => preview?.openPreview(resolvedUrl) : void 0,
|
|
331
|
+
style: {
|
|
332
|
+
display: "block",
|
|
333
|
+
width: "auto",
|
|
334
|
+
height: "auto",
|
|
335
|
+
objectFit: "cover",
|
|
336
|
+
borderRadius: "0.375rem",
|
|
337
|
+
margin: "0.5rem 0",
|
|
338
|
+
cursor: clickable ? "zoom-in" : "default"
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
);
|
|
342
|
+
};
|
|
343
|
+
var CommentImageNode_default = CommentImageNode;
|
|
344
|
+
|
|
345
|
+
// src/components/controls/view/FileIcon.tsx
|
|
346
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
347
|
+
var PdfIcon = () => /* @__PURE__ */ jsxs3(
|
|
348
|
+
"svg",
|
|
349
|
+
{
|
|
350
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
351
|
+
viewBox: "0 0 48 48",
|
|
352
|
+
className: "w-10 h-10",
|
|
353
|
+
children: [
|
|
354
|
+
/* @__PURE__ */ jsx4(
|
|
355
|
+
"path",
|
|
356
|
+
{
|
|
357
|
+
fill: "#e53935",
|
|
358
|
+
d: "M38,42H10c-2.209,0-4-1.791-4-4V10c0-2.209,1.791-4,4-4h28c2.209,0,4,1.791,4,4v28 C42,40.209,40.209,42,38,42z"
|
|
359
|
+
}
|
|
360
|
+
),
|
|
361
|
+
/* @__PURE__ */ jsx4(
|
|
362
|
+
"path",
|
|
363
|
+
{
|
|
364
|
+
fill: "#fff",
|
|
365
|
+
d: "M34.841,26.799c-1.692-1.757-6.314-1.041-7.42-0.911c-1.627-1.562-2.734-3.45-3.124-4.101 c0.586-1.757,0.976-3.515,1.041-5.402c0-1.627-0.651-3.385-2.473-3.385c-0.651,0-1.237,0.391-1.562,0.911 c-0.781,1.367-0.456,4.101,0.781,6.899c-0.716,2.018-1.367,3.97-3.189,7.42c-1.888,0.781-5.858,2.604-6.183,4.556 c-0.13,0.586,0.065,1.172,0.521,1.627C13.688,34.805,14.273,35,14.859,35c2.408,0,4.751-3.32,6.379-6.118 c1.367-0.456,3.515-1.107,5.663-1.497c2.538,2.213,4.751,2.538,5.923,2.538c1.562,0,2.148-0.651,2.343-1.237 C35.492,28.036,35.297,27.32,34.841,26.799z M33.214,27.905c-0.065,0.456-0.651,0.911-1.692,0.651 c-1.237-0.325-2.343-0.911-3.32-1.692c0.846-0.13,2.734-0.325,4.101-0.065C32.824,26.929,33.344,27.254,33.214,27.905z M22.344,14.497c0.13-0.195,0.325-0.325,0.521-0.325c0.586,0,0.716,0.716,0.716,1.302c-0.065,1.367-0.325,2.734-0.781,4.036 C21.824,16.905,22.019,15.083,22.344,14.497z M22.214,27.124c0.521-1.041,1.237-2.864,1.497-3.645 c0.586,0.976,1.562,2.148,2.083,2.669C25.794,26.213,23.776,26.604,22.214,27.124z M18.374,29.728 c-1.497,2.473-3.059,4.036-3.905,4.036c-0.13,0-0.26-0.065-0.391-0.13c-0.195-0.13-0.26-0.325-0.195-0.586 C14.078,32.136,15.77,30.899,18.374,29.728z"
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
]
|
|
369
|
+
}
|
|
370
|
+
);
|
|
371
|
+
var ExcelIcon = () => /* @__PURE__ */ jsxs3(
|
|
372
|
+
"svg",
|
|
373
|
+
{
|
|
374
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
375
|
+
viewBox: "0 0 48 48",
|
|
376
|
+
className: "w-10 h-10",
|
|
377
|
+
children: [
|
|
378
|
+
/* @__PURE__ */ jsx4(
|
|
379
|
+
"path",
|
|
380
|
+
{
|
|
381
|
+
fill: "#169154",
|
|
382
|
+
d: "M29,6H15.744C14.781,6,14,6.781,14,7.744v7.259h15V6z"
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
/* @__PURE__ */ jsx4(
|
|
386
|
+
"path",
|
|
387
|
+
{
|
|
388
|
+
fill: "#18482a",
|
|
389
|
+
d: "M14,33.054v7.202C14,41.219,14.781,42,15.743,42H29v-8.946H14z"
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
/* @__PURE__ */ jsx4("path", { fill: "#0c8045", d: "M14 15.003H29V24.005000000000003H14z" }),
|
|
393
|
+
/* @__PURE__ */ jsx4("path", { fill: "#17472a", d: "M14 24.005H29V33.055H14z" }),
|
|
394
|
+
/* @__PURE__ */ jsxs3("g", { children: [
|
|
395
|
+
/* @__PURE__ */ jsx4(
|
|
396
|
+
"path",
|
|
397
|
+
{
|
|
398
|
+
fill: "#29c27f",
|
|
399
|
+
d: "M42.256,6H29v9.003h15V7.744C44,6.781,43.219,6,42.256,6z"
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ jsx4(
|
|
403
|
+
"path",
|
|
404
|
+
{
|
|
405
|
+
fill: "#27663f",
|
|
406
|
+
d: "M29,33.054V42h13.257C43.219,42,44,41.219,44,40.257v-7.202H29z"
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
/* @__PURE__ */ jsx4("path", { fill: "#19ac65", d: "M29 15.003H44V24.005000000000003H29z" }),
|
|
410
|
+
/* @__PURE__ */ jsx4("path", { fill: "#129652", d: "M29 24.005H44V33.055H29z" })
|
|
411
|
+
] }),
|
|
412
|
+
/* @__PURE__ */ jsx4(
|
|
413
|
+
"path",
|
|
414
|
+
{
|
|
415
|
+
fill: "#0c7238",
|
|
416
|
+
d: "M22.319,34H5.681C4.753,34,4,33.247,4,32.319V15.681C4,14.753,4.753,14,5.681,14h16.638 C23.247,14,24,14.753,24,15.681v16.638C24,33.247,23.247,34,22.319,34z"
|
|
417
|
+
}
|
|
418
|
+
),
|
|
419
|
+
/* @__PURE__ */ jsx4(
|
|
420
|
+
"path",
|
|
421
|
+
{
|
|
422
|
+
fill: "#fff",
|
|
423
|
+
d: "M9.807 19L12.193 19 14.129 22.754 16.175 19 18.404 19 15.333 24 18.474 29 16.123 29 14.013 25.07 11.912 29 9.526 29 12.719 23.982z"
|
|
424
|
+
}
|
|
425
|
+
)
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
var WordIcon = () => /* @__PURE__ */ jsxs3(
|
|
430
|
+
"svg",
|
|
431
|
+
{
|
|
432
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
433
|
+
viewBox: "0 0 48 48",
|
|
434
|
+
className: "w-10 h-10",
|
|
435
|
+
baseProfile: "basic",
|
|
436
|
+
children: [
|
|
437
|
+
/* @__PURE__ */ jsx4(
|
|
438
|
+
"path",
|
|
439
|
+
{
|
|
440
|
+
fill: "#283593",
|
|
441
|
+
d: "M9,33.595l14.911-18.706L41,26v13.306C41,41.346,39.346,43,37.306,43H15.332 C11.835,43,9,40.164,9,36.667C9,36.667,9,33.595,9,33.595z"
|
|
442
|
+
}
|
|
443
|
+
),
|
|
444
|
+
/* @__PURE__ */ jsxs3(
|
|
445
|
+
"linearGradient",
|
|
446
|
+
{
|
|
447
|
+
id: "qh2LT5tehRDFkLLfb-odWa",
|
|
448
|
+
x1: "9",
|
|
449
|
+
x2: "33.506",
|
|
450
|
+
y1: "364.445",
|
|
451
|
+
y2: "364.445",
|
|
452
|
+
gradientTransform: "translate(0 -339.89)",
|
|
453
|
+
gradientUnits: "userSpaceOnUse",
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ jsx4("stop", { offset: "0", "stop-color": "#66c0ff" }),
|
|
456
|
+
/* @__PURE__ */ jsx4("stop", { offset: ".26", "stop-color": "#0094f0" })
|
|
457
|
+
]
|
|
458
|
+
}
|
|
459
|
+
),
|
|
460
|
+
/* @__PURE__ */ jsx4(
|
|
461
|
+
"path",
|
|
462
|
+
{
|
|
463
|
+
fill: "url(#qh2LT5tehRDFkLLfb-odWa)",
|
|
464
|
+
d: "M9,20.208c0-2.624,2.126-4.75,4.749-4.75h21.857L41,12.778v13.527 C41,28.346,39.346,30,37.306,30H15.332C11.835,30,9,32.836,9,36.333L9,20.208L9,20.208z"
|
|
465
|
+
}
|
|
466
|
+
),
|
|
467
|
+
/* @__PURE__ */ jsx4(
|
|
468
|
+
"path",
|
|
469
|
+
{
|
|
470
|
+
fill: "#1e88e5",
|
|
471
|
+
"fill-opacity": ".6",
|
|
472
|
+
d: "M9,20.208c0-2.624,2.126-4.75,4.749-4.75h21.857L41,12.778v13.527 C41,28.346,39.346,30,37.306,30H15.332C11.835,30,9,32.836,9,36.333L9,20.208L9,20.208z"
|
|
473
|
+
}
|
|
474
|
+
),
|
|
475
|
+
/* @__PURE__ */ jsx4(
|
|
476
|
+
"path",
|
|
477
|
+
{
|
|
478
|
+
fill: "#00e5ff",
|
|
479
|
+
d: "M9,10.333C9,6.836,11.835,4,15.332,4h21.975C39.346,4,41,5.654,41,7.694v5.611 C41,15.346,39.346,17,37.306,17H15.332C11.835,17,9,19.836,9,23.333C9,23.333,9,10.333,9,10.333z"
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
/* @__PURE__ */ jsx4(
|
|
483
|
+
"path",
|
|
484
|
+
{
|
|
485
|
+
fill: "#1565c0",
|
|
486
|
+
d: "M7.5,23h10c1.933,0,3.5,1.567,3.5,3.5v10c0,1.933-1.567,3.5-3.5,3.5h-10C5.567,40,4,38.433,4,36.5 v-10C4,24.567,5.567,23,7.5,23z"
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
/* @__PURE__ */ jsx4(
|
|
490
|
+
"path",
|
|
491
|
+
{
|
|
492
|
+
fill: "#fff",
|
|
493
|
+
d: "M18.327,26.643l-2.092,9.713l-2.501,0.002L12.5,30.529l-1.293,5.829H8.683l-2.01-9.713h2.062 l1.24,6.41l1.232-6.41h2.528l1.291,6.41l1.21-6.41L18.327,26.643L18.327,26.643z"
|
|
494
|
+
}
|
|
495
|
+
)
|
|
496
|
+
]
|
|
497
|
+
}
|
|
498
|
+
);
|
|
499
|
+
var StandardIcon = () => /* @__PURE__ */ jsxs3(
|
|
500
|
+
"svg",
|
|
501
|
+
{
|
|
502
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
503
|
+
viewBox: "0 0 48 48",
|
|
504
|
+
className: "w-10 h-10",
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ jsx4("path", { fill: "#90CAF9", d: "M40 45L8 45 8 3 30 3 40 13z" }),
|
|
507
|
+
/* @__PURE__ */ jsx4("path", { fill: "#E1F5FE", d: "M38.5 14L29 14 29 4.5z" })
|
|
508
|
+
]
|
|
509
|
+
}
|
|
510
|
+
);
|
|
511
|
+
var PowerPointIcon = () => /* @__PURE__ */ jsxs3(
|
|
512
|
+
"svg",
|
|
513
|
+
{
|
|
514
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
515
|
+
viewBox: "0 0 48 48",
|
|
516
|
+
className: "w-10 h-10",
|
|
517
|
+
children: [
|
|
518
|
+
/* @__PURE__ */ jsx4(
|
|
519
|
+
"path",
|
|
520
|
+
{
|
|
521
|
+
fill: "#dc4c2c",
|
|
522
|
+
d: "M8,24c0,9.941,8.059,18,18,18s18-8.059,18-18H26H8z"
|
|
523
|
+
}
|
|
524
|
+
),
|
|
525
|
+
/* @__PURE__ */ jsx4("path", { fill: "#f7a278", d: "M26,6v18h18C44,14.059,35.941,6,26,6z" }),
|
|
526
|
+
/* @__PURE__ */ jsx4("path", { fill: "#c06346", d: "M26,6C16.059,6,8,14.059,8,24h18V6z" }),
|
|
527
|
+
/* @__PURE__ */ jsx4(
|
|
528
|
+
"path",
|
|
529
|
+
{
|
|
530
|
+
fill: "#9b341f",
|
|
531
|
+
d: "M22.319,34H5.681C4.753,34,4,33.247,4,32.319V15.681C4,14.753,4.753,14,5.681,14h16.638 C23.247,14,24,14.753,24,15.681v16.638C24,33.247,23.247,34,22.319,34z"
|
|
532
|
+
}
|
|
533
|
+
),
|
|
534
|
+
/* @__PURE__ */ jsx4(
|
|
535
|
+
"path",
|
|
536
|
+
{
|
|
537
|
+
fill: "#fff",
|
|
538
|
+
d: "M14.673,19.012H10v10h2.024v-3.521H14.3c1.876,0,3.397-1.521,3.397-3.397v-0.058 C17.697,20.366,16.343,19.012,14.673,19.012z M15.57,22.358c0,0.859-0.697,1.556-1.556,1.556h-1.99v-3.325h1.99 c0.859,0,1.556,0.697,1.556,1.556V22.358z"
|
|
539
|
+
}
|
|
540
|
+
)
|
|
541
|
+
]
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
var TextIcon = () => /* @__PURE__ */ jsxs3(
|
|
545
|
+
"svg",
|
|
546
|
+
{
|
|
547
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
548
|
+
viewBox: "0 0 48 48",
|
|
549
|
+
className: "w-10 h-10",
|
|
550
|
+
children: [
|
|
551
|
+
/* @__PURE__ */ jsx4("path", { fill: "#90CAF9", d: "M40 45L8 45 8 3 30 3 40 13z" }),
|
|
552
|
+
/* @__PURE__ */ jsx4("path", { fill: "#E1F5FE", d: "M38.5 14L29 14 29 4.5z" }),
|
|
553
|
+
/* @__PURE__ */ jsx4(
|
|
554
|
+
"path",
|
|
555
|
+
{
|
|
556
|
+
fill: "#1976D2",
|
|
557
|
+
d: "M16 21H33V23H16zM16 25H29V27H16zM16 29H33V31H16zM16 33H29V35H16z"
|
|
558
|
+
}
|
|
559
|
+
)
|
|
560
|
+
]
|
|
561
|
+
}
|
|
562
|
+
);
|
|
563
|
+
var ArchiveIcon = () => /* @__PURE__ */ jsxs3(
|
|
564
|
+
"svg",
|
|
565
|
+
{
|
|
566
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
567
|
+
zoomAndPan: "magnify",
|
|
568
|
+
viewBox: "0 0 75 74.999997",
|
|
569
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
570
|
+
version: "1.0",
|
|
571
|
+
className: "w-10 h-10",
|
|
572
|
+
children: [
|
|
573
|
+
/* @__PURE__ */ jsx4("defs", { children: /* @__PURE__ */ jsx4("clipPath", { id: "273d29c8a6", children: /* @__PURE__ */ jsx4(
|
|
574
|
+
"path",
|
|
575
|
+
{
|
|
576
|
+
d: "M 8.90625 0 L 65.90625 0 L 65.90625 75 L 8.90625 75 Z M 8.90625 0 ",
|
|
577
|
+
"clip-rule": "nonzero"
|
|
578
|
+
}
|
|
579
|
+
) }) }),
|
|
580
|
+
/* @__PURE__ */ jsx4("g", { "clip-path": "url(#273d29c8a6)", children: /* @__PURE__ */ jsx4(
|
|
581
|
+
"path",
|
|
582
|
+
{
|
|
583
|
+
fill: "#ff9100",
|
|
584
|
+
d: "M 65.882812 75 L 8.929688 75 L 8.929688 0 L 48.085938 0 L 65.882812 17.855469 Z M 65.882812 75 ",
|
|
585
|
+
"fill-opacity": "1",
|
|
586
|
+
"fill-rule": "nonzero"
|
|
587
|
+
}
|
|
588
|
+
) }),
|
|
589
|
+
/* @__PURE__ */ jsx4(
|
|
590
|
+
"path",
|
|
591
|
+
{
|
|
592
|
+
fill: "#fbe9e7",
|
|
593
|
+
d: "M 63.214844 19.644531 L 46.304688 19.644531 L 46.304688 2.679688 Z M 63.214844 19.644531 ",
|
|
594
|
+
"fill-opacity": "1",
|
|
595
|
+
"fill-rule": "nonzero"
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
/* @__PURE__ */ jsx4(
|
|
599
|
+
"path",
|
|
600
|
+
{
|
|
601
|
+
fill: "#ffe0b2",
|
|
602
|
+
d: "M 26.523438 50.59375 L 33.824219 50.59375 L 33.824219 53.570312 L 22.339844 53.570312 L 22.339844 51.410156 L 29.566406 38.789062 L 22.265625 38.789062 L 22.265625 35.796875 L 33.691406 35.796875 L 33.691406 37.910156 Z M 26.523438 50.59375 ",
|
|
603
|
+
"fill-opacity": "1",
|
|
604
|
+
"fill-rule": "nonzero"
|
|
605
|
+
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ jsx4(
|
|
608
|
+
"path",
|
|
609
|
+
{
|
|
610
|
+
fill: "#ffe0b2",
|
|
611
|
+
d: "M 36.183594 35.796875 L 39.757812 35.796875 L 39.757812 53.570312 L 36.183594 53.570312 Z M 36.183594 35.796875 ",
|
|
612
|
+
"fill-opacity": "1",
|
|
613
|
+
"fill-rule": "nonzero"
|
|
614
|
+
}
|
|
615
|
+
),
|
|
616
|
+
/* @__PURE__ */ jsx4(
|
|
617
|
+
"path",
|
|
618
|
+
{
|
|
619
|
+
fill: "#ffe0b2",
|
|
620
|
+
d: "M 46.34375 47.320312 L 46.34375 53.570312 L 42.765625 53.570312 L 42.765625 35.796875 L 48.800781 35.796875 C 50.550781 35.796875 51.953125 36.34375 52.992188 37.433594 C 54.035156 38.523438 54.554688 39.9375 54.554688 41.683594 C 54.554688 43.425781 54.039062 44.796875 53.011719 45.808594 C 51.980469 46.820312 50.550781 47.320312 48.726562 47.320312 Z M 46.34375 44.332031 L 48.800781 44.332031 C 49.484375 44.332031 50.007812 44.105469 50.382812 43.660156 C 50.757812 43.210938 50.941406 42.5625 50.941406 41.707031 C 50.941406 40.816406 50.753906 40.113281 50.371094 39.585938 C 49.988281 39.0625 49.476562 38.796875 48.839844 38.789062 L 46.34375 38.789062 Z M 46.34375 44.332031 ",
|
|
621
|
+
"fill-opacity": "1",
|
|
622
|
+
"fill-rule": "nonzero"
|
|
623
|
+
}
|
|
624
|
+
)
|
|
625
|
+
]
|
|
626
|
+
}
|
|
627
|
+
);
|
|
628
|
+
var getFileDetails = (url) => {
|
|
629
|
+
const extMatch = url.match(/\.([a-zA-Z0-9]+)(?:[\?#]|$)/);
|
|
630
|
+
const ext = extMatch ? extMatch[1].toLowerCase() : "";
|
|
631
|
+
let Icon = StandardIcon;
|
|
632
|
+
let extLabel = "FILE";
|
|
633
|
+
if (ext === "pdf") {
|
|
634
|
+
Icon = PdfIcon;
|
|
635
|
+
extLabel = "PDF";
|
|
636
|
+
} else if (["xls", "xlsx", "csv"].includes(ext)) {
|
|
637
|
+
Icon = ExcelIcon;
|
|
638
|
+
extLabel = "Excel";
|
|
639
|
+
} else if (["doc", "docx"].includes(ext)) {
|
|
640
|
+
Icon = WordIcon;
|
|
641
|
+
extLabel = "Word";
|
|
642
|
+
} else if (["ppt", "pptx"].includes(ext)) {
|
|
643
|
+
Icon = PowerPointIcon;
|
|
644
|
+
extLabel = "PowerPoint";
|
|
645
|
+
} else if (["txt", "rtf"].includes(ext)) {
|
|
646
|
+
Icon = TextIcon;
|
|
647
|
+
extLabel = "Text";
|
|
648
|
+
} else if (["zip", "rar", "7z"].includes(ext)) {
|
|
649
|
+
Icon = ArchiveIcon;
|
|
650
|
+
extLabel = "Archive";
|
|
651
|
+
} else if (ext) {
|
|
652
|
+
extLabel = ext.toUpperCase();
|
|
653
|
+
}
|
|
654
|
+
return { Icon, extLabel };
|
|
655
|
+
};
|
|
656
|
+
var FileIcon = ({ fileName, className }) => {
|
|
657
|
+
const { Icon } = getFileDetails(fileName);
|
|
658
|
+
return /* @__PURE__ */ jsx4("span", { className, children: /* @__PURE__ */ jsx4(Icon, {}) });
|
|
659
|
+
};
|
|
660
|
+
var FileIcon_default = FileIcon;
|
|
661
|
+
|
|
662
|
+
// src/components/controls/view/CommentFileNode.tsx
|
|
663
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
664
|
+
var formatFileSize = (sizeBytes) => {
|
|
665
|
+
const bytes = typeof sizeBytes === "number" ? sizeBytes : Number(sizeBytes);
|
|
666
|
+
if (!Number.isFinite(bytes) || bytes <= 0) {
|
|
667
|
+
return "";
|
|
668
|
+
}
|
|
669
|
+
if (bytes < 1024) {
|
|
670
|
+
return `${bytes} B`;
|
|
671
|
+
}
|
|
672
|
+
const units = ["KB", "MB", "GB"];
|
|
673
|
+
let value = bytes / 1024;
|
|
674
|
+
let unitIndex = 0;
|
|
675
|
+
while (value >= 1024 && unitIndex < units.length - 1) {
|
|
676
|
+
value /= 1024;
|
|
677
|
+
unitIndex += 1;
|
|
678
|
+
}
|
|
679
|
+
return `${value.toFixed(value < 10 ? 1 : 0)} ${units[unitIndex]}`;
|
|
680
|
+
};
|
|
681
|
+
var CommentFileNode = ({ node, assetBaseUrl }) => {
|
|
682
|
+
const rawUrl = typeof node.url === "string" && node.url || typeof node.src === "string" && node.src || typeof node.assetUrl === "string" && node.assetUrl || "";
|
|
683
|
+
if (!rawUrl) {
|
|
684
|
+
return null;
|
|
685
|
+
}
|
|
686
|
+
const href = AssetUtility_default.resolveUrl(assetBaseUrl, rawUrl);
|
|
687
|
+
if (!href) {
|
|
688
|
+
return null;
|
|
689
|
+
}
|
|
690
|
+
const fileName = typeof node.fileName === "string" && node.fileName || typeof node.name === "string" && node.name || rawUrl.split("/").pop() || "file";
|
|
691
|
+
const sizeLabel = formatFileSize(node.fileSize);
|
|
692
|
+
return /* @__PURE__ */ jsxs4(
|
|
693
|
+
"a",
|
|
694
|
+
{
|
|
695
|
+
href,
|
|
696
|
+
target: "_blank",
|
|
697
|
+
rel: "noopener noreferrer",
|
|
698
|
+
download: fileName,
|
|
699
|
+
className: "comment-node-file",
|
|
700
|
+
style: {
|
|
701
|
+
display: "inline-flex",
|
|
702
|
+
alignItems: "center",
|
|
703
|
+
gap: "8px",
|
|
704
|
+
padding: "8px 12px",
|
|
705
|
+
border: "1px solid rgba(0,0,0,0.12)",
|
|
706
|
+
borderRadius: "8px",
|
|
707
|
+
textDecoration: "none",
|
|
708
|
+
color: "inherit",
|
|
709
|
+
maxWidth: "100%"
|
|
710
|
+
},
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ jsx5(FileIcon_default, { fileName, className: "comment-node-file-icon" }),
|
|
713
|
+
/* @__PURE__ */ jsxs4(
|
|
714
|
+
"span",
|
|
715
|
+
{
|
|
716
|
+
className: "comment-node-file-text",
|
|
717
|
+
style: { display: "flex", flexDirection: "column", minWidth: 0 },
|
|
718
|
+
children: [
|
|
719
|
+
/* @__PURE__ */ jsx5(
|
|
720
|
+
"span",
|
|
721
|
+
{
|
|
722
|
+
className: "comment-node-file-name",
|
|
723
|
+
style: { overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" },
|
|
724
|
+
children: fileName
|
|
725
|
+
}
|
|
726
|
+
),
|
|
727
|
+
sizeLabel ? /* @__PURE__ */ jsx5("span", { className: "comment-node-file-size", style: { fontSize: "0.8em", opacity: 0.7 }, children: sizeLabel }) : null
|
|
728
|
+
]
|
|
729
|
+
}
|
|
730
|
+
)
|
|
731
|
+
]
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
};
|
|
735
|
+
var CommentFileNode_default = CommentFileNode;
|
|
736
|
+
|
|
737
|
+
// src/components/controls/view/CommentNodeRenderer.tsx
|
|
738
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
739
|
+
var TextLeafNode = ({ node }) => {
|
|
740
|
+
let content = node.text;
|
|
741
|
+
if (node.code) content = /* @__PURE__ */ jsx6("code", { className: "comment-node-code", children: content });
|
|
742
|
+
if (node.bold) content = /* @__PURE__ */ jsx6("strong", { children: content });
|
|
743
|
+
if (node.italic) content = /* @__PURE__ */ jsx6("em", { children: content });
|
|
744
|
+
if (node.underline) content = /* @__PURE__ */ jsx6("u", { children: content });
|
|
745
|
+
if (node.strikethrough) content = /* @__PURE__ */ jsx6("s", { children: content });
|
|
746
|
+
return /* @__PURE__ */ jsx6(React3.Fragment, { children: content });
|
|
747
|
+
};
|
|
748
|
+
var renderChildren = (children, keyPrefix, assetBaseUrl) => {
|
|
749
|
+
if (!children || children.length === 0) {
|
|
750
|
+
return null;
|
|
751
|
+
}
|
|
752
|
+
return children.map((child, index) => {
|
|
753
|
+
const childKey = isTextNode(child) ? void 0 : asElementNode(child).id;
|
|
754
|
+
return /* @__PURE__ */ jsx6(
|
|
755
|
+
CommentNodeRenderer,
|
|
756
|
+
{
|
|
757
|
+
node: child,
|
|
758
|
+
assetBaseUrl
|
|
759
|
+
},
|
|
760
|
+
childKey ?? `${keyPrefix}-${index}`
|
|
761
|
+
);
|
|
762
|
+
});
|
|
763
|
+
};
|
|
764
|
+
var headingLevelFromTag = (tag) => {
|
|
765
|
+
const match = typeof tag === "string" ? tag.match(/\d/) : null;
|
|
766
|
+
const parsed = match ? Number(match[0]) : Number(tag);
|
|
767
|
+
return Number.isFinite(parsed) && parsed >= 1 && parsed <= 6 ? parsed : 3;
|
|
768
|
+
};
|
|
769
|
+
var CommentNodeRenderer = ({ node, assetBaseUrl }) => {
|
|
770
|
+
if (!node || typeof node !== "object") {
|
|
771
|
+
return null;
|
|
772
|
+
}
|
|
773
|
+
if (isTextNode(node)) {
|
|
774
|
+
return /* @__PURE__ */ jsx6(TextLeafNode, { node });
|
|
775
|
+
}
|
|
776
|
+
const element = asElementNode(node);
|
|
777
|
+
const key = element.id ?? element.type;
|
|
778
|
+
switch (element.type) {
|
|
779
|
+
case "paragraph":
|
|
780
|
+
return /* @__PURE__ */ jsx6("p", { className: "comment-node-paragraph", children: renderChildren(element.children, key, assetBaseUrl) ?? /* @__PURE__ */ jsx6("br", {}) });
|
|
781
|
+
case "heading": {
|
|
782
|
+
const level = headingLevelFromTag(element.tag ?? element.level);
|
|
783
|
+
const HeadingTag = `h${level}`;
|
|
784
|
+
return /* @__PURE__ */ jsx6(HeadingTag, { className: "comment-node-heading", children: renderChildren(element.children, key, assetBaseUrl) });
|
|
785
|
+
}
|
|
786
|
+
case "list": {
|
|
787
|
+
const ordered = element.listType === "number" || element.ordered === true;
|
|
788
|
+
const ListTag = ordered ? "ol" : "ul";
|
|
789
|
+
return /* @__PURE__ */ jsx6(ListTag, { className: "comment-node-list", children: renderChildren(element.children, key, assetBaseUrl) });
|
|
790
|
+
}
|
|
791
|
+
case "listitem":
|
|
792
|
+
case "list-item":
|
|
793
|
+
return /* @__PURE__ */ jsx6("li", { className: "comment-node-listitem", children: renderChildren(element.children, key, assetBaseUrl) });
|
|
794
|
+
case "quote":
|
|
795
|
+
case "blockquote":
|
|
796
|
+
return /* @__PURE__ */ jsx6("blockquote", { className: "comment-node-quote", children: renderChildren(element.children, key, assetBaseUrl) });
|
|
797
|
+
case "code":
|
|
798
|
+
case "code-block":
|
|
799
|
+
return /* @__PURE__ */ jsx6("pre", { className: "comment-node-codeblock", children: /* @__PURE__ */ jsx6("code", { children: renderChildren(element.children, key, assetBaseUrl) }) });
|
|
800
|
+
case "image":
|
|
801
|
+
return /* @__PURE__ */ jsx6(CommentImageNode_default, { node: element, assetBaseUrl });
|
|
802
|
+
case "file":
|
|
803
|
+
return /* @__PURE__ */ jsx6(CommentFileNode_default, { node: element, assetBaseUrl });
|
|
804
|
+
case "link": {
|
|
805
|
+
const url = typeof element.url === "string" ? element.url : "#";
|
|
806
|
+
return /* @__PURE__ */ jsx6("a", { href: url, target: "_blank", rel: "noopener noreferrer", className: "comment-node-link", children: renderChildren(element.children, key, assetBaseUrl) });
|
|
807
|
+
}
|
|
808
|
+
case "mention": {
|
|
809
|
+
const label = element.label ?? element.mentionName ?? element.text ?? "";
|
|
810
|
+
return /* @__PURE__ */ jsxs5("span", { className: "comment-node-mention", children: [
|
|
811
|
+
"@",
|
|
812
|
+
label
|
|
813
|
+
] });
|
|
814
|
+
}
|
|
815
|
+
case "linebreak":
|
|
816
|
+
case "line-break":
|
|
817
|
+
return /* @__PURE__ */ jsx6("br", {});
|
|
818
|
+
default:
|
|
819
|
+
return /* @__PURE__ */ jsx6(React3.Fragment, { children: renderChildren(element.children, key, assetBaseUrl) });
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
var CommentNodeRenderer_default = CommentNodeRenderer;
|
|
823
|
+
|
|
824
|
+
// src/components/controls/view/CommentImageGallery.tsx
|
|
825
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
826
|
+
var gridStyle = {
|
|
827
|
+
display: "grid",
|
|
828
|
+
gridTemplateColumns: "repeat(2, 1fr)",
|
|
829
|
+
gap: "2px",
|
|
830
|
+
borderRadius: "0.375rem",
|
|
831
|
+
overflow: "hidden",
|
|
832
|
+
margin: "0.5rem 0"
|
|
833
|
+
};
|
|
834
|
+
var cellStyle = {
|
|
835
|
+
position: "relative",
|
|
836
|
+
display: "block",
|
|
837
|
+
aspectRatio: "1",
|
|
838
|
+
width: "100%",
|
|
839
|
+
padding: 0,
|
|
840
|
+
border: "none",
|
|
841
|
+
background: "none",
|
|
842
|
+
cursor: "zoom-in",
|
|
843
|
+
overflow: "hidden"
|
|
844
|
+
};
|
|
845
|
+
var cellImgStyle = {
|
|
846
|
+
display: "block",
|
|
847
|
+
width: "100%",
|
|
848
|
+
height: "100%",
|
|
849
|
+
objectFit: "cover"
|
|
850
|
+
};
|
|
851
|
+
var moreOverlayStyle = {
|
|
852
|
+
position: "absolute",
|
|
853
|
+
inset: 0,
|
|
854
|
+
display: "flex",
|
|
855
|
+
alignItems: "center",
|
|
856
|
+
justifyContent: "center",
|
|
857
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
858
|
+
color: "#fff",
|
|
859
|
+
fontSize: "1.25rem",
|
|
860
|
+
fontWeight: 600
|
|
861
|
+
};
|
|
862
|
+
var CommentImageGallery = ({ nodes, assetBaseUrl }) => {
|
|
863
|
+
const preview = useCommentImagePreview();
|
|
864
|
+
const cells = nodes.map((node) => ({
|
|
865
|
+
id: typeof node.id === "string" && node.id || void 0,
|
|
866
|
+
src: resolveCommentImageUrl(node, assetBaseUrl),
|
|
867
|
+
alt: typeof node.fileName === "string" && node.fileName || typeof node.alt === "string" && node.alt || ""
|
|
868
|
+
})).filter((cell) => !!cell.src);
|
|
869
|
+
if (cells.length === 0) {
|
|
870
|
+
return null;
|
|
871
|
+
}
|
|
872
|
+
const visibleCount = Math.min(cells.length, MAX_VISIBLE_GALLERY_IMAGES);
|
|
873
|
+
const remaining = cells.length - MAX_VISIBLE_GALLERY_IMAGES;
|
|
874
|
+
return /* @__PURE__ */ jsx7("div", { className: "comment-image-gallery", style: gridStyle, children: cells.slice(0, visibleCount).map((cell, i) => {
|
|
875
|
+
const isLastVisible = i === visibleCount - 1;
|
|
876
|
+
const showMoreOverlay = isLastVisible && remaining > 0;
|
|
877
|
+
return /* @__PURE__ */ jsxs6(
|
|
878
|
+
"button",
|
|
879
|
+
{
|
|
880
|
+
type: "button",
|
|
881
|
+
className: "comment-image-gallery-cell",
|
|
882
|
+
style: cellStyle,
|
|
883
|
+
"aria-label": showMoreOverlay ? `Show ${remaining} more photo${remaining === 1 ? "" : "s"}` : cell.alt || "View image",
|
|
884
|
+
onClick: () => preview?.openPreview(cell.src),
|
|
885
|
+
children: [
|
|
886
|
+
/* @__PURE__ */ jsx7("img", { src: cell.src, alt: cell.alt, loading: "lazy", style: cellImgStyle }),
|
|
887
|
+
showMoreOverlay ? /* @__PURE__ */ jsxs6("span", { className: "comment-image-gallery-more-overlay", style: moreOverlayStyle, children: [
|
|
888
|
+
"+",
|
|
889
|
+
remaining
|
|
890
|
+
] }) : null
|
|
891
|
+
]
|
|
892
|
+
},
|
|
893
|
+
cell.id ?? `comment-gallery-${i}`
|
|
894
|
+
);
|
|
895
|
+
}) });
|
|
896
|
+
};
|
|
897
|
+
var CommentImageGallery_default = CommentImageGallery;
|
|
898
|
+
|
|
899
|
+
// src/components/controls/view/CommentRendererClient.tsx
|
|
900
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
901
|
+
var CommentRendererClient = ({ value, className, assetBaseUrl, apiBaseUrl }) => {
|
|
902
|
+
const nodes = React4.useMemo(() => parseSerializedContent(value), [value]);
|
|
903
|
+
const resolvedAssetBaseUrl = assetBaseUrl ?? apiBaseUrl;
|
|
904
|
+
const images = React4.useMemo(
|
|
905
|
+
() => collectCommentImages(nodes, resolvedAssetBaseUrl),
|
|
906
|
+
[nodes, resolvedAssetBaseUrl]
|
|
907
|
+
);
|
|
908
|
+
const groups = React4.useMemo(() => groupConsecutiveImages(nodes), [nodes]);
|
|
909
|
+
if (!nodes || nodes.length === 0) {
|
|
910
|
+
return null;
|
|
911
|
+
}
|
|
912
|
+
return /* @__PURE__ */ jsx8(CommentImagePreviewProvider, { images, children: /* @__PURE__ */ jsx8("div", { className: className ?? "comment-renderer", children: groups.map((group, groupIndex) => {
|
|
913
|
+
if (group.kind === "images") {
|
|
914
|
+
const key = group.nodes[0]?.id ?? `comment-group-${groupIndex}`;
|
|
915
|
+
if (group.nodes.length <= INDIVIDUAL_IMAGE_THRESHOLD) {
|
|
916
|
+
return group.nodes.map((node2, i) => /* @__PURE__ */ jsx8(
|
|
917
|
+
CommentNodeRenderer_default,
|
|
918
|
+
{
|
|
919
|
+
node: node2,
|
|
920
|
+
assetBaseUrl: resolvedAssetBaseUrl
|
|
921
|
+
},
|
|
922
|
+
node2.id ?? `${key}-${i}`
|
|
923
|
+
));
|
|
924
|
+
}
|
|
925
|
+
return /* @__PURE__ */ jsx8(
|
|
926
|
+
CommentImageGallery_default,
|
|
927
|
+
{
|
|
928
|
+
nodes: group.nodes,
|
|
929
|
+
assetBaseUrl: resolvedAssetBaseUrl
|
|
930
|
+
},
|
|
931
|
+
key
|
|
932
|
+
);
|
|
933
|
+
}
|
|
934
|
+
const node = group.node;
|
|
935
|
+
return /* @__PURE__ */ jsx8(
|
|
936
|
+
CommentNodeRenderer_default,
|
|
937
|
+
{
|
|
938
|
+
node,
|
|
939
|
+
assetBaseUrl: resolvedAssetBaseUrl
|
|
940
|
+
},
|
|
941
|
+
node.id ?? `comment-group-${groupIndex}`
|
|
942
|
+
);
|
|
943
|
+
}) }) });
|
|
944
|
+
};
|
|
945
|
+
var CommentRendererClient_default = CommentRendererClient;
|
|
946
|
+
export {
|
|
947
|
+
CommentRendererClient_default as default
|
|
948
|
+
};
|