@gilav21/shadcn-angular-rte 0.1.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.
@@ -0,0 +1,423 @@
1
+ /**
2
+ * Renders a DocxParseResult into inline-styled HTML suitable for
3
+ * insertion into the rich text editor. Uses only inline styles
4
+ * (no Tailwind classes) so the editor sanitizer preserves them.
5
+ */
6
+ function renderDocxForEditor(result) {
7
+ return renderElements(result.elements);
8
+ }
9
+ function renderElements(elements) {
10
+ const parts = [];
11
+ let i = 0;
12
+ while (i < elements.length) {
13
+ const el = elements[i];
14
+ if (el.type === 'paragraph' && el.listLevel != null && el.listType) {
15
+ i = renderListGroup(elements, i, parts);
16
+ }
17
+ else if (el.type === 'paragraph') {
18
+ parts.push(renderParagraph(el));
19
+ i++;
20
+ }
21
+ else if (el.type === 'table') {
22
+ parts.push(renderTable(el));
23
+ i++;
24
+ }
25
+ else {
26
+ parts.push(renderImage(el));
27
+ i++;
28
+ }
29
+ }
30
+ return parts.join('');
31
+ }
32
+ // --- List grouping ---
33
+ function hasNestedListChild(elements, index, baseLevel) {
34
+ if (index + 1 >= elements.length)
35
+ return false;
36
+ const next = elements[index + 1];
37
+ return next.type === 'paragraph' &&
38
+ next.listLevel != null &&
39
+ next.listType != null &&
40
+ next.listLevel > baseLevel;
41
+ }
42
+ function renderListGroup(elements, startIndex, output) {
43
+ const first = elements[startIndex];
44
+ if (first.type !== 'paragraph')
45
+ return startIndex;
46
+ const listType = first.listType ?? 'bullet';
47
+ const baseLevel = first.listLevel ?? 0;
48
+ const tag = listType === 'numbered' ? 'ol' : 'ul';
49
+ output.push(`<${tag}>`);
50
+ let i = startIndex;
51
+ while (i < elements.length) {
52
+ const el = elements[i];
53
+ if (el.type !== 'paragraph' || el.listLevel == null || el.listType == null)
54
+ break;
55
+ if (el.listLevel < baseLevel)
56
+ break;
57
+ if (el.listLevel === baseLevel && el.listType === listType) {
58
+ i = renderListItem(elements, i, baseLevel, output);
59
+ }
60
+ else if (el.listLevel > baseLevel) {
61
+ i = renderListGroup(elements, i, output);
62
+ }
63
+ else {
64
+ break;
65
+ }
66
+ }
67
+ output.push(`</${tag}>`);
68
+ return i;
69
+ }
70
+ function renderListItem(elements, index, baseLevel, output) {
71
+ const el = elements[index];
72
+ if (el.type !== 'paragraph')
73
+ return index + 1;
74
+ output.push(`<li>${renderRuns(el.runs)}`);
75
+ if (hasNestedListChild(elements, index, baseLevel)) {
76
+ const nextIndex = renderListGroup(elements, index + 1, output);
77
+ output.push('</li>');
78
+ return nextIndex;
79
+ }
80
+ output.push('</li>');
81
+ return index + 1;
82
+ }
83
+ // --- Paragraph rendering ---
84
+ function renderParagraph(p) {
85
+ const pageBreak = p.runs.some(r => r.breakType === 'page');
86
+ let prefix = '';
87
+ if (pageBreak) {
88
+ prefix = '<hr>';
89
+ }
90
+ const dirAttr = p.rtl ? ' dir="rtl"' : '';
91
+ const content = renderRuns(p.runs) || '<br>';
92
+ const headingMatch = /^Heading(\d)$/i.exec(p.style);
93
+ if (headingMatch) {
94
+ const level = Math.min(Number(headingMatch[1]), 6);
95
+ const tag = `h${level}`;
96
+ const styleAttr = buildParagraphStyle(p);
97
+ const styleStr = styleAttr ? ` style="${styleAttr}"` : '';
98
+ return `${prefix}<${tag}${dirAttr}${styleStr}>${content}</${tag}>`;
99
+ }
100
+ const styleAttr = buildParagraphStyle(p);
101
+ const styleStr = styleAttr ? ` style="${styleAttr}"` : '';
102
+ return `${prefix}<p${dirAttr}${styleStr}>${content}</p>`;
103
+ }
104
+ function buildParagraphStyle(p) {
105
+ const styles = [];
106
+ if (p.alignment) {
107
+ styles.push(`text-align:${p.alignment}`);
108
+ }
109
+ if (p.spacingBefore != null) {
110
+ styles.push(`margin-top:${formatPt(p.spacingBefore)}pt`);
111
+ }
112
+ if (p.spacingAfter != null) {
113
+ styles.push(`margin-bottom:${formatPt(p.spacingAfter)}pt`);
114
+ }
115
+ if (p.indentLeft != null) {
116
+ styles.push(`margin-left:${formatPt(p.indentLeft)}pt`);
117
+ }
118
+ if (p.indentRight != null) {
119
+ styles.push(`margin-right:${formatPt(p.indentRight)}pt`);
120
+ }
121
+ if (p.indentFirstLine != null) {
122
+ styles.push(`text-indent:${formatPt(p.indentFirstLine)}pt`);
123
+ }
124
+ if (p.indentHanging != null && p.indentFirstLine == null) {
125
+ styles.push(`text-indent:-${formatPt(p.indentHanging)}pt`);
126
+ }
127
+ if (p.lineSpacing != null) {
128
+ if (p.lineSpacing > 4) {
129
+ styles.push(`line-height:${p.lineSpacing.toFixed(1)}pt`);
130
+ }
131
+ else {
132
+ styles.push(`line-height:${p.lineSpacing.toFixed(2)}`);
133
+ }
134
+ }
135
+ if (p.shading) {
136
+ styles.push(`background-color:${p.shading}`);
137
+ }
138
+ if (p.borders) {
139
+ appendParagraphBorders(styles, p.borders);
140
+ }
141
+ return styles.join(';');
142
+ }
143
+ function appendParagraphBorders(styles, borders) {
144
+ if (borders.top)
145
+ styles.push(`border-top:${formatBorder(borders.top)}`);
146
+ if (borders.bottom)
147
+ styles.push(`border-bottom:${formatBorder(borders.bottom)}`);
148
+ if (borders.left)
149
+ styles.push(`border-left:${formatBorder(borders.left)}`);
150
+ if (borders.right)
151
+ styles.push(`border-right:${formatBorder(borders.right)}`);
152
+ if (borders.top || borders.bottom || borders.left || borders.right) {
153
+ styles.push('padding:2pt 4pt');
154
+ }
155
+ }
156
+ function formatBorder(b) {
157
+ const widthPt = Math.max(b.size, 0.5);
158
+ const style = mapBorderStyle(b.style);
159
+ return `${widthPt}pt ${style} ${b.color}`;
160
+ }
161
+ const DASHED_BORDER_STYLES = new Set(['dashed', 'dashDotStroked', 'dashSmallGap']);
162
+ const DOTTED_BORDER_STYLES = new Set(['dotted', 'dotDash', 'dotDotDash']);
163
+ const DOUBLE_BORDER_STYLES = new Set([
164
+ 'double', 'triple', 'thinThickSmallGap', 'thickThinSmallGap',
165
+ 'thinThickMediumGap', 'thickThinMediumGap', 'thinThickLargeGap', 'thickThinLargeGap',
166
+ ]);
167
+ function mapBorderStyle(docxStyle) {
168
+ if (DASHED_BORDER_STYLES.has(docxStyle))
169
+ return 'dashed';
170
+ if (DOTTED_BORDER_STYLES.has(docxStyle))
171
+ return 'dotted';
172
+ if (DOUBLE_BORDER_STYLES.has(docxStyle))
173
+ return 'double';
174
+ if (docxStyle === 'none' || docxStyle === 'nil')
175
+ return 'none';
176
+ return 'solid';
177
+ }
178
+ // --- Run rendering ---
179
+ function renderRuns(runs) {
180
+ const parts = [];
181
+ for (const run of runs) {
182
+ if (run.style.hidden)
183
+ continue;
184
+ if (run.breakType === 'page')
185
+ continue;
186
+ if (run.breakType === 'textWrapping' || run.breakType === 'column') {
187
+ parts.push('<br>');
188
+ continue;
189
+ }
190
+ let html = escapeHtml(run.text);
191
+ html = applyRunFormatting(html, run.style);
192
+ html = applyTrackChanges(html, run);
193
+ html = applyHyperlink(html, run);
194
+ parts.push(html);
195
+ }
196
+ return parts.join('');
197
+ }
198
+ function applyRunFormatting(html, style) {
199
+ let result = html;
200
+ if (style.bold)
201
+ result = `<strong>${result}</strong>`;
202
+ if (style.italic)
203
+ result = `<em>${result}</em>`;
204
+ if (style.underline)
205
+ result = `<u>${result}</u>`;
206
+ if (style.strikethrough)
207
+ result = `<s>${result}</s>`;
208
+ if (style.doubleStrikethrough) {
209
+ result = `<s style="text-decoration-style:double">${result}</s>`;
210
+ }
211
+ if (style.vertAlign === 'superscript')
212
+ result = `<sup>${result}</sup>`;
213
+ if (style.vertAlign === 'subscript')
214
+ result = `<sub>${result}</sub>`;
215
+ const spanStyle = buildRunSpanStyle(style);
216
+ const dirAttr = style.rtl ? ' dir="rtl"' : '';
217
+ if (spanStyle || dirAttr) {
218
+ const styleAttr = spanStyle ? ` style="${spanStyle}"` : '';
219
+ result = `<span${dirAttr}${styleAttr}>${result}</span>`;
220
+ }
221
+ return result;
222
+ }
223
+ function buildRunSpanStyle(style) {
224
+ const parts = [];
225
+ if (style.color)
226
+ parts.push(`color:${style.color}`);
227
+ if (style.fontSize)
228
+ parts.push(`font-size:${style.fontSize}pt`);
229
+ if (style.fontFamily)
230
+ parts.push(`font-family:${escapeAttr(style.fontFamily)}`);
231
+ if (style.highlight)
232
+ parts.push(`background-color:${style.highlight}`);
233
+ if (style.backgroundColor)
234
+ parts.push(`background-color:${style.backgroundColor}`);
235
+ if (style.charSpacing)
236
+ parts.push(`letter-spacing:${formatPt(style.charSpacing)}pt`);
237
+ if (style.smallCaps)
238
+ parts.push('font-variant:small-caps');
239
+ if (style.caps)
240
+ parts.push('text-transform:uppercase');
241
+ return parts.join(';');
242
+ }
243
+ function applyTrackChanges(html, run) {
244
+ if (run.isInserted)
245
+ return `<ins>${html}</ins>`;
246
+ if (run.isDeleted)
247
+ return `<del>${html}</del>`;
248
+ return html;
249
+ }
250
+ function applyHyperlink(html, run) {
251
+ if (run.href) {
252
+ return `<a href="${escapeAttr(run.href)}" target="_blank" rel="noopener noreferrer">${html}</a>`;
253
+ }
254
+ return html;
255
+ }
256
+ // --- Image rendering ---
257
+ function renderImage(img) {
258
+ const widthAttr = img.width > 0 ? ` width="${img.width}"` : '';
259
+ const heightAttr = img.height > 0 ? ` height="${img.height}"` : '';
260
+ const alt = escapeAttr(img.altText || 'image');
261
+ return `<img src="${escapeAttr(img.dataUrl)}"${widthAttr}${heightAttr} alt="${alt}">`;
262
+ }
263
+ // --- Table rendering ---
264
+ function buildBorderFallbacks(table) {
265
+ return {
266
+ insideH: table.tableStyle?.borders?.insideH,
267
+ insideV: table.tableStyle?.borders?.insideV,
268
+ top: table.tableStyle?.borders?.top,
269
+ bottom: table.tableStyle?.borders?.bottom,
270
+ left: table.tableStyle?.borders?.left,
271
+ right: table.tableStyle?.borders?.right,
272
+ };
273
+ }
274
+ function splitTableRows(rows) {
275
+ const headerRows = [];
276
+ const bodyRows = [];
277
+ for (const row of rows) {
278
+ if (row.rowStyle?.isHeader) {
279
+ headerRows.push(row);
280
+ }
281
+ else {
282
+ bodyRows.push(row);
283
+ }
284
+ }
285
+ return { headerRows, bodyRows };
286
+ }
287
+ function renderTable(table) {
288
+ const tableStyle = buildTableStyle(table.tableStyle);
289
+ const styleStr = tableStyle ? ` style="${tableStyle}"` : '';
290
+ const borderFallbacks = buildBorderFallbacks(table);
291
+ const { headerRows, bodyRows } = splitTableRows(table.rows);
292
+ const totalRows = table.rows.length;
293
+ const parts = [`<table${styleStr}>`];
294
+ let rowIndex = 0;
295
+ if (headerRows.length > 0) {
296
+ parts.push('<thead>');
297
+ for (const row of headerRows) {
298
+ parts.push(renderTableRow(row, true, borderFallbacks, rowIndex, totalRows));
299
+ rowIndex++;
300
+ }
301
+ parts.push('</thead>');
302
+ }
303
+ parts.push('<tbody>');
304
+ for (const row of bodyRows) {
305
+ parts.push(renderTableRow(row, false, borderFallbacks, rowIndex, totalRows));
306
+ rowIndex++;
307
+ }
308
+ parts.push('</tbody>', '</table>');
309
+ return parts.join('');
310
+ }
311
+ function buildTableStyle(style) {
312
+ const parts = ['border-collapse:collapse'];
313
+ if (style?.width) {
314
+ const unit = style.widthUnit === 'pct' ? '%' : 'pt';
315
+ const value = unit === '%' ? (style.width / 50).toFixed(1) : twipsToPt(style.width);
316
+ parts.push(`width:${value}${unit}`);
317
+ }
318
+ return parts.join(';');
319
+ }
320
+ function renderTableRow(row, isHeader, fallbacks, rowIndex, totalRows) {
321
+ const heightStyle = row.rowStyle?.height
322
+ ? ` style="height:${formatPt(row.rowStyle.height)}pt"`
323
+ : '';
324
+ const tag = isHeader ? 'th' : 'td';
325
+ const totalCols = row.cells.reduce((sum, c) => sum + c.colSpan, 0);
326
+ let colIndex = 0;
327
+ const cellsHtml = [];
328
+ for (const cell of row.cells) {
329
+ cellsHtml.push(renderTableCell(cell, tag, fallbacks, rowIndex, colIndex, totalRows, totalCols));
330
+ colIndex += cell.colSpan;
331
+ }
332
+ return `<tr${heightStyle}>${cellsHtml.join('')}</tr>`;
333
+ }
334
+ function renderTableCell(cell, tag, fallbacks, rowIndex, colIndex, totalRows, totalCols) {
335
+ const attrs = [];
336
+ if (cell.colSpan > 1)
337
+ attrs.push(`colspan="${cell.colSpan}"`);
338
+ if (cell.rowSpan > 1)
339
+ attrs.push(`rowspan="${cell.rowSpan}"`);
340
+ const cellStyle = buildCellStyle(cell.cellStyle, fallbacks, rowIndex, colIndex, totalRows, totalCols);
341
+ if (cellStyle)
342
+ attrs.push(`style="${cellStyle}"`);
343
+ const attrStr = attrs.length > 0 ? ` ${attrs.join(' ')}` : '';
344
+ const content = renderCellContent(cell.elements);
345
+ return `<${tag}${attrStr}>${content}</${tag}>`;
346
+ }
347
+ function buildCellStyle(style, fallbacks, rowIndex, colIndex, totalRows, totalCols) {
348
+ const parts = [];
349
+ if (style?.backgroundColor)
350
+ parts.push(`background-color:${style.backgroundColor}`);
351
+ if (style?.verticalAlign)
352
+ parts.push(`vertical-align:${style.verticalAlign}`);
353
+ if (style?.width) {
354
+ const unit = style.widthUnit === 'pct' ? '%' : 'pt';
355
+ const value = unit === '%' ? (style.width / 50).toFixed(1) : twipsToPt(style.width);
356
+ parts.push(`width:${value}${unit}`);
357
+ }
358
+ appendCellBorders(parts, style, fallbacks, rowIndex, colIndex, totalRows, totalCols);
359
+ if (style)
360
+ appendCellPaddings(parts, style);
361
+ return parts.join(';');
362
+ }
363
+ function resolveCellBorder(own, isEdge, edgeFallback, innerFallback) {
364
+ return own ?? (isEdge ? edgeFallback : innerFallback);
365
+ }
366
+ function appendCellBorders(parts, style, fallbacks, rowIndex, colIndex, totalRows, totalCols) {
367
+ const top = resolveCellBorder(style?.borders?.top, rowIndex === 0, fallbacks.top, fallbacks.insideH);
368
+ const bottom = resolveCellBorder(style?.borders?.bottom, rowIndex === totalRows - 1, fallbacks.bottom, fallbacks.insideH);
369
+ const left = resolveCellBorder(style?.borders?.left, colIndex === 0, fallbacks.left, fallbacks.insideV);
370
+ const right = resolveCellBorder(style?.borders?.right, colIndex === totalCols - 1, fallbacks.right, fallbacks.insideV);
371
+ if (top)
372
+ parts.push(`border-top:${formatBorder(top)}`);
373
+ if (bottom)
374
+ parts.push(`border-bottom:${formatBorder(bottom)}`);
375
+ if (left)
376
+ parts.push(`border-left:${formatBorder(left)}`);
377
+ if (right)
378
+ parts.push(`border-right:${formatBorder(right)}`);
379
+ }
380
+ function appendCellPaddings(parts, style) {
381
+ if (!style.paddings)
382
+ return;
383
+ if (style.paddings.top != null)
384
+ parts.push(`padding-top:${formatPt(style.paddings.top)}pt`);
385
+ if (style.paddings.bottom != null)
386
+ parts.push(`padding-bottom:${formatPt(style.paddings.bottom)}pt`);
387
+ if (style.paddings.left != null)
388
+ parts.push(`padding-left:${formatPt(style.paddings.left)}pt`);
389
+ if (style.paddings.right != null)
390
+ parts.push(`padding-right:${formatPt(style.paddings.right)}pt`);
391
+ }
392
+ function renderCellContent(elements) {
393
+ return elements.map(el => {
394
+ if (el.type === 'table')
395
+ return renderTable(el);
396
+ return renderParagraph(el);
397
+ }).join('');
398
+ }
399
+ // --- Utilities ---
400
+ function formatPt(pts) {
401
+ return pts.toFixed(1).replace(/\.0$/, '');
402
+ }
403
+ function twipsToPt(twips) {
404
+ return (twips / 20).toFixed(1).replace(/\.0$/, '');
405
+ }
406
+ function escapeHtml(text) {
407
+ return text
408
+ .replaceAll('&', '&amp;')
409
+ .replaceAll('<', '&lt;')
410
+ .replaceAll('>', '&gt;')
411
+ .replaceAll('"', '&quot;')
412
+ .replaceAll('\t', '\u2003');
413
+ }
414
+ function escapeAttr(value) {
415
+ return value
416
+ .replaceAll('&', '&amp;')
417
+ .replaceAll('"', '&quot;')
418
+ .replaceAll('<', '&lt;')
419
+ .replaceAll('>', '&gt;');
420
+ }
421
+
422
+ export { renderDocxForEditor };
423
+ //# sourceMappingURL=gilav21-shadcn-angular-rte-docx-to-editor-html-Cl9eIhkC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gilav21-shadcn-angular-rte-docx-to-editor-html-Cl9eIhkC.mjs","sources":["../../../packages/rte-package/src/lib/parsers/docx-to-editor-html.ts"],"sourcesContent":["import type {\n DocxParseResult,\n DocxElement,\n DocxParagraph,\n DocxTable,\n DocxImage,\n DocxRun,\n DocxRunStyle,\n DocxTableCell,\n DocxTableRow,\n DocxBorder,\n DocxTableBorder,\n DocxParagraphBorders,\n DocxTableCellStyle,\n DocxTableStyle,\n} from './docx-parser';\n\n/**\n * Renders a DocxParseResult into inline-styled HTML suitable for\n * insertion into the rich text editor. Uses only inline styles\n * (no Tailwind classes) so the editor sanitizer preserves them.\n */\nexport function renderDocxForEditor(result: DocxParseResult): string {\n return renderElements(result.elements);\n}\n\nfunction renderElements(elements: ReadonlyArray<DocxElement>): string {\n const parts: string[] = [];\n let i = 0;\n\n while (i < elements.length) {\n const el = elements[i];\n\n if (el.type === 'paragraph' && el.listLevel != null && el.listType) {\n i = renderListGroup(elements, i, parts);\n } else if (el.type === 'paragraph') {\n parts.push(renderParagraph(el));\n i++;\n } else if (el.type === 'table') {\n parts.push(renderTable(el));\n i++;\n } else {\n parts.push(renderImage(el));\n i++;\n }\n }\n\n return parts.join('');\n}\n\n// --- List grouping ---\n\nfunction hasNestedListChild(\n elements: ReadonlyArray<DocxElement>,\n index: number,\n baseLevel: number,\n): boolean {\n if (index + 1 >= elements.length) return false;\n const next = elements[index + 1];\n return next.type === 'paragraph' &&\n next.listLevel != null &&\n next.listType != null &&\n next.listLevel > baseLevel;\n}\n\nfunction renderListGroup(\n elements: ReadonlyArray<DocxElement>,\n startIndex: number,\n output: string[],\n): number {\n const first = elements[startIndex];\n if (first.type !== 'paragraph') return startIndex;\n const listType = first.listType ?? 'bullet';\n const baseLevel = first.listLevel ?? 0;\n const tag = listType === 'numbered' ? 'ol' : 'ul';\n\n output.push(`<${tag}>`);\n let i = startIndex;\n\n while (i < elements.length) {\n const el = elements[i];\n if (el.type !== 'paragraph' || el.listLevel == null || el.listType == null) break;\n if (el.listLevel < baseLevel) break;\n\n if (el.listLevel === baseLevel && el.listType === listType) {\n i = renderListItem(elements, i, baseLevel, output);\n } else if (el.listLevel > baseLevel) {\n i = renderListGroup(elements, i, output);\n } else {\n break;\n }\n }\n\n output.push(`</${tag}>`);\n return i;\n}\n\nfunction renderListItem(\n elements: ReadonlyArray<DocxElement>,\n index: number,\n baseLevel: number,\n output: string[],\n): number {\n const el = elements[index];\n if (el.type !== 'paragraph') return index + 1;\n output.push(`<li>${renderRuns(el.runs)}`);\n\n if (hasNestedListChild(elements, index, baseLevel)) {\n const nextIndex = renderListGroup(elements, index + 1, output);\n output.push('</li>');\n return nextIndex;\n }\n\n output.push('</li>');\n return index + 1;\n}\n\n// --- Paragraph rendering ---\n\nfunction renderParagraph(p: DocxParagraph): string {\n const pageBreak = p.runs.some(r => r.breakType === 'page');\n let prefix = '';\n if (pageBreak) {\n prefix = '<hr>';\n }\n\n const dirAttr = p.rtl ? ' dir=\"rtl\"' : '';\n const content = renderRuns(p.runs) || '<br>';\n\n const headingMatch = /^Heading(\\d)$/i.exec(p.style);\n if (headingMatch) {\n const level = Math.min(Number(headingMatch[1]), 6);\n const tag = `h${level}`;\n const styleAttr = buildParagraphStyle(p);\n const styleStr = styleAttr ? ` style=\"${styleAttr}\"` : '';\n return `${prefix}<${tag}${dirAttr}${styleStr}>${content}</${tag}>`;\n }\n\n const styleAttr = buildParagraphStyle(p);\n const styleStr = styleAttr ? ` style=\"${styleAttr}\"` : '';\n return `${prefix}<p${dirAttr}${styleStr}>${content}</p>`;\n}\n\nfunction buildParagraphStyle(p: DocxParagraph): string {\n const styles: string[] = [];\n\n if (p.alignment) {\n styles.push(`text-align:${p.alignment}`);\n }\n if (p.spacingBefore != null) {\n styles.push(`margin-top:${formatPt(p.spacingBefore)}pt`);\n }\n if (p.spacingAfter != null) {\n styles.push(`margin-bottom:${formatPt(p.spacingAfter)}pt`);\n }\n if (p.indentLeft != null) {\n styles.push(`margin-left:${formatPt(p.indentLeft)}pt`);\n }\n if (p.indentRight != null) {\n styles.push(`margin-right:${formatPt(p.indentRight)}pt`);\n }\n if (p.indentFirstLine != null) {\n styles.push(`text-indent:${formatPt(p.indentFirstLine)}pt`);\n }\n if (p.indentHanging != null && p.indentFirstLine == null) {\n styles.push(`text-indent:-${formatPt(p.indentHanging)}pt`);\n }\n if (p.lineSpacing != null) {\n if (p.lineSpacing > 4) {\n styles.push(`line-height:${p.lineSpacing.toFixed(1)}pt`);\n } else {\n styles.push(`line-height:${p.lineSpacing.toFixed(2)}`);\n }\n }\n if (p.shading) {\n styles.push(`background-color:${p.shading}`);\n }\n if (p.borders) {\n appendParagraphBorders(styles, p.borders);\n }\n\n return styles.join(';');\n}\n\nfunction appendParagraphBorders(styles: string[], borders: DocxParagraphBorders): void {\n if (borders.top) styles.push(`border-top:${formatBorder(borders.top)}`);\n if (borders.bottom) styles.push(`border-bottom:${formatBorder(borders.bottom)}`);\n if (borders.left) styles.push(`border-left:${formatBorder(borders.left)}`);\n if (borders.right) styles.push(`border-right:${formatBorder(borders.right)}`);\n if (borders.top || borders.bottom || borders.left || borders.right) {\n styles.push('padding:2pt 4pt');\n }\n}\n\nfunction formatBorder(b: DocxBorder | DocxTableBorder): string {\n const widthPt = Math.max(b.size, 0.5);\n const style = mapBorderStyle(b.style);\n return `${widthPt}pt ${style} ${b.color}`;\n}\n\nconst DASHED_BORDER_STYLES = new Set(['dashed', 'dashDotStroked', 'dashSmallGap']);\nconst DOTTED_BORDER_STYLES = new Set(['dotted', 'dotDash', 'dotDotDash']);\nconst DOUBLE_BORDER_STYLES = new Set([\n 'double', 'triple', 'thinThickSmallGap', 'thickThinSmallGap',\n 'thinThickMediumGap', 'thickThinMediumGap', 'thinThickLargeGap', 'thickThinLargeGap',\n]);\n\nfunction mapBorderStyle(docxStyle: string): string {\n if (DASHED_BORDER_STYLES.has(docxStyle)) return 'dashed';\n if (DOTTED_BORDER_STYLES.has(docxStyle)) return 'dotted';\n if (DOUBLE_BORDER_STYLES.has(docxStyle)) return 'double';\n if (docxStyle === 'none' || docxStyle === 'nil') return 'none';\n return 'solid';\n}\n\n// --- Run rendering ---\n\nfunction renderRuns(runs: ReadonlyArray<DocxRun>): string {\n const parts: string[] = [];\n\n for (const run of runs) {\n if (run.style.hidden) continue;\n if (run.breakType === 'page') continue;\n if (run.breakType === 'textWrapping' || run.breakType === 'column') {\n parts.push('<br>');\n continue;\n }\n\n let html = escapeHtml(run.text);\n\n html = applyRunFormatting(html, run.style);\n html = applyTrackChanges(html, run);\n html = applyHyperlink(html, run);\n\n parts.push(html);\n }\n\n return parts.join('');\n}\n\nfunction applyRunFormatting(html: string, style: DocxRunStyle): string {\n let result = html;\n\n if (style.bold) result = `<strong>${result}</strong>`;\n if (style.italic) result = `<em>${result}</em>`;\n if (style.underline) result = `<u>${result}</u>`;\n if (style.strikethrough) result = `<s>${result}</s>`;\n if (style.doubleStrikethrough) {\n result = `<s style=\"text-decoration-style:double\">${result}</s>`;\n }\n if (style.vertAlign === 'superscript') result = `<sup>${result}</sup>`;\n if (style.vertAlign === 'subscript') result = `<sub>${result}</sub>`;\n\n const spanStyle = buildRunSpanStyle(style);\n const dirAttr = style.rtl ? ' dir=\"rtl\"' : '';\n if (spanStyle || dirAttr) {\n const styleAttr = spanStyle ? ` style=\"${spanStyle}\"` : '';\n result = `<span${dirAttr}${styleAttr}>${result}</span>`;\n }\n\n return result;\n}\n\nfunction buildRunSpanStyle(style: DocxRunStyle): string {\n const parts: string[] = [];\n\n if (style.color) parts.push(`color:${style.color}`);\n if (style.fontSize) parts.push(`font-size:${style.fontSize}pt`);\n if (style.fontFamily) parts.push(`font-family:${escapeAttr(style.fontFamily)}`);\n if (style.highlight) parts.push(`background-color:${style.highlight}`);\n if (style.backgroundColor) parts.push(`background-color:${style.backgroundColor}`);\n if (style.charSpacing) parts.push(`letter-spacing:${formatPt(style.charSpacing)}pt`);\n if (style.smallCaps) parts.push('font-variant:small-caps');\n if (style.caps) parts.push('text-transform:uppercase');\n\n return parts.join(';');\n}\n\nfunction applyTrackChanges(html: string, run: DocxRun): string {\n if (run.isInserted) return `<ins>${html}</ins>`;\n if (run.isDeleted) return `<del>${html}</del>`;\n return html;\n}\n\nfunction applyHyperlink(html: string, run: DocxRun): string {\n if (run.href) {\n return `<a href=\"${escapeAttr(run.href)}\" target=\"_blank\" rel=\"noopener noreferrer\">${html}</a>`;\n }\n return html;\n}\n\n// --- Image rendering ---\n\nfunction renderImage(img: DocxImage): string {\n const widthAttr = img.width > 0 ? ` width=\"${img.width}\"` : '';\n const heightAttr = img.height > 0 ? ` height=\"${img.height}\"` : '';\n const alt = escapeAttr(img.altText || 'image');\n return `<img src=\"${escapeAttr(img.dataUrl)}\"${widthAttr}${heightAttr} alt=\"${alt}\">`;\n}\n\n// --- Table rendering ---\n\nfunction buildBorderFallbacks(table: DocxTable): TableBorderFallbacks {\n return {\n insideH: table.tableStyle?.borders?.insideH,\n insideV: table.tableStyle?.borders?.insideV,\n top: table.tableStyle?.borders?.top,\n bottom: table.tableStyle?.borders?.bottom,\n left: table.tableStyle?.borders?.left,\n right: table.tableStyle?.borders?.right,\n };\n}\n\nfunction splitTableRows(rows: readonly DocxTableRow[]): { headerRows: DocxTableRow[]; bodyRows: DocxTableRow[] } {\n const headerRows: DocxTableRow[] = [];\n const bodyRows: DocxTableRow[] = [];\n for (const row of rows) {\n if (row.rowStyle?.isHeader) { headerRows.push(row); } else { bodyRows.push(row); }\n }\n return { headerRows, bodyRows };\n}\n\nfunction renderTable(table: DocxTable): string {\n const tableStyle = buildTableStyle(table.tableStyle);\n const styleStr = tableStyle ? ` style=\"${tableStyle}\"` : '';\n const borderFallbacks = buildBorderFallbacks(table);\n const { headerRows, bodyRows } = splitTableRows(table.rows);\n const totalRows = table.rows.length;\n const parts: string[] = [`<table${styleStr}>`];\n let rowIndex = 0;\n\n if (headerRows.length > 0) {\n parts.push('<thead>');\n for (const row of headerRows) {\n parts.push(renderTableRow(row, true, borderFallbacks, rowIndex, totalRows));\n rowIndex++;\n }\n parts.push('</thead>');\n }\n\n parts.push('<tbody>');\n for (const row of bodyRows) {\n parts.push(renderTableRow(row, false, borderFallbacks, rowIndex, totalRows));\n rowIndex++;\n }\n parts.push('</tbody>', '</table>');\n return parts.join('');\n}\n\nfunction buildTableStyle(style?: DocxTableStyle): string {\n const parts: string[] = ['border-collapse:collapse'];\n\n if (style?.width) {\n const unit = style.widthUnit === 'pct' ? '%' : 'pt';\n const value = unit === '%' ? (style.width / 50).toFixed(1) : twipsToPt(style.width);\n parts.push(`width:${value}${unit}`);\n }\n\n return parts.join(';');\n}\n\ninterface TableBorderFallbacks {\n readonly insideH?: DocxTableBorder;\n readonly insideV?: DocxTableBorder;\n readonly top?: DocxTableBorder;\n readonly bottom?: DocxTableBorder;\n readonly left?: DocxTableBorder;\n readonly right?: DocxTableBorder;\n}\n\nfunction renderTableRow(\n row: DocxTableRow, isHeader: boolean,\n fallbacks: TableBorderFallbacks, rowIndex: number, totalRows: number,\n): string {\n const heightStyle = row.rowStyle?.height\n ? ` style=\"height:${formatPt(row.rowStyle.height)}pt\"`\n : '';\n const tag = isHeader ? 'th' : 'td';\n const totalCols = row.cells.reduce((sum, c) => sum + c.colSpan, 0);\n\n let colIndex = 0;\n const cellsHtml: string[] = [];\n for (const cell of row.cells) {\n cellsHtml.push(renderTableCell(cell, tag, fallbacks, rowIndex, colIndex, totalRows, totalCols));\n colIndex += cell.colSpan;\n }\n return `<tr${heightStyle}>${cellsHtml.join('')}</tr>`;\n}\n\nfunction renderTableCell(\n cell: DocxTableCell, tag: string,\n fallbacks: TableBorderFallbacks, rowIndex: number, colIndex: number,\n totalRows: number, totalCols: number,\n): string {\n const attrs: string[] = [];\n\n if (cell.colSpan > 1) attrs.push(`colspan=\"${cell.colSpan}\"`);\n if (cell.rowSpan > 1) attrs.push(`rowspan=\"${cell.rowSpan}\"`);\n\n const cellStyle = buildCellStyle(cell.cellStyle, fallbacks, rowIndex, colIndex, totalRows, totalCols);\n if (cellStyle) attrs.push(`style=\"${cellStyle}\"`);\n\n const attrStr = attrs.length > 0 ? ` ${attrs.join(' ')}` : '';\n const content = renderCellContent(cell.elements);\n return `<${tag}${attrStr}>${content}</${tag}>`;\n}\n\nfunction buildCellStyle(\n style: DocxTableCellStyle | undefined,\n fallbacks: TableBorderFallbacks, rowIndex: number, colIndex: number,\n totalRows: number, totalCols: number,\n): string {\n const parts: string[] = [];\n\n if (style?.backgroundColor) parts.push(`background-color:${style.backgroundColor}`);\n if (style?.verticalAlign) parts.push(`vertical-align:${style.verticalAlign}`);\n if (style?.width) {\n const unit = style.widthUnit === 'pct' ? '%' : 'pt';\n const value = unit === '%' ? (style.width / 50).toFixed(1) : twipsToPt(style.width);\n parts.push(`width:${value}${unit}`);\n }\n\n appendCellBorders(parts, style, fallbacks, rowIndex, colIndex, totalRows, totalCols);\n if (style) appendCellPaddings(parts, style);\n\n return parts.join(';');\n}\n\nfunction resolveCellBorder(\n own: DocxTableBorder | undefined,\n isEdge: boolean,\n edgeFallback: DocxTableBorder | undefined,\n innerFallback: DocxTableBorder | undefined,\n): DocxTableBorder | undefined {\n return own ?? (isEdge ? edgeFallback : innerFallback);\n}\n\nfunction appendCellBorders(\n parts: string[], style: DocxTableCellStyle | undefined,\n fallbacks: TableBorderFallbacks, rowIndex: number, colIndex: number,\n totalRows: number, totalCols: number,\n): void {\n const top = resolveCellBorder(style?.borders?.top, rowIndex === 0, fallbacks.top, fallbacks.insideH);\n const bottom = resolveCellBorder(style?.borders?.bottom, rowIndex === totalRows - 1, fallbacks.bottom, fallbacks.insideH);\n const left = resolveCellBorder(style?.borders?.left, colIndex === 0, fallbacks.left, fallbacks.insideV);\n const right = resolveCellBorder(style?.borders?.right, colIndex === totalCols - 1, fallbacks.right, fallbacks.insideV);\n\n if (top) parts.push(`border-top:${formatBorder(top)}`);\n if (bottom) parts.push(`border-bottom:${formatBorder(bottom)}`);\n if (left) parts.push(`border-left:${formatBorder(left)}`);\n if (right) parts.push(`border-right:${formatBorder(right)}`);\n}\n\nfunction appendCellPaddings(parts: string[], style: DocxTableCellStyle): void {\n if (!style.paddings) return;\n if (style.paddings.top != null) parts.push(`padding-top:${formatPt(style.paddings.top)}pt`);\n if (style.paddings.bottom != null) parts.push(`padding-bottom:${formatPt(style.paddings.bottom)}pt`);\n if (style.paddings.left != null) parts.push(`padding-left:${formatPt(style.paddings.left)}pt`);\n if (style.paddings.right != null) parts.push(`padding-right:${formatPt(style.paddings.right)}pt`);\n}\n\nfunction renderCellContent(elements: ReadonlyArray<DocxParagraph | DocxTable>): string {\n return elements.map(el => {\n if (el.type === 'table') return renderTable(el);\n return renderParagraph(el);\n }).join('');\n}\n\n// --- Utilities ---\n\nfunction formatPt(pts: number): string {\n return pts.toFixed(1).replace(/\\.0$/, '');\n}\n\nfunction twipsToPt(twips: number): string {\n return (twips / 20).toFixed(1).replace(/\\.0$/, '');\n}\n\nfunction escapeHtml(text: string): string {\n return text\n .replaceAll('&', '&amp;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;')\n .replaceAll('\"', '&quot;')\n .replaceAll('\\t', '\\u2003');\n}\n\nfunction escapeAttr(value: string): string {\n return value\n .replaceAll('&', '&amp;')\n .replaceAll('\"', '&quot;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;');\n}\n"],"names":[],"mappings":"AAiBA;;;;AAIG;AACG,SAAU,mBAAmB,CAAC,MAAuB,EAAA;AACvD,IAAA,OAAO,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC;AAC1C;AAEA,SAAS,cAAc,CAAC,QAAoC,EAAA;IACxD,MAAM,KAAK,GAAa,EAAE;IAC1B,IAAI,CAAC,GAAG,CAAC;AAET,IAAA,OAAO,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE;AACxB,QAAA,MAAM,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC;AAEtB,QAAA,IAAI,EAAE,CAAC,IAAI,KAAK,WAAW,IAAI,EAAE,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE;YAChE,CAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,CAAC;QAC3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