@trismegisto/spine 3.3.5 → 3.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +4 -2
  2. package/fesm2022/trismegisto-spine-audit.mjs +20 -2
  3. package/fesm2022/trismegisto-spine-audit.mjs.map +1 -1
  4. package/fesm2022/{trismegisto-spine-auto-service-auto-service-audit.component-D8HUpZtA.mjs → trismegisto-spine-auto-service-auto-service-audit.component-CszXNvSs.mjs} +2 -2
  5. package/fesm2022/{trismegisto-spine-auto-service-auto-service-audit.component-D8HUpZtA.mjs.map → trismegisto-spine-auto-service-auto-service-audit.component-CszXNvSs.mjs.map} +1 -1
  6. package/fesm2022/{trismegisto-spine-auto-service-auto-service-client-picker.component-NawbfdLW.mjs → trismegisto-spine-auto-service-auto-service-client-picker.component-CknHYd_P.mjs} +7 -3
  7. package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-CknHYd_P.mjs.map +1 -0
  8. package/fesm2022/{trismegisto-spine-auto-service-auto-service-client.component-kAXaCM5W.mjs → trismegisto-spine-auto-service-auto-service-client.component-Dg3mJrpz.mjs} +24 -5
  9. package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-Dg3mJrpz.mjs.map +1 -0
  10. package/fesm2022/{trismegisto-spine-auto-service-auto-service-delete-CV_t9vxm.mjs → trismegisto-spine-auto-service-auto-service-delete-BWY5G-xe.mjs} +2 -2
  11. package/fesm2022/trismegisto-spine-auto-service-auto-service-delete-BWY5G-xe.mjs.map +1 -0
  12. package/fesm2022/{trismegisto-spine-auto-service-auto-service-groups.component-DE2QIGRH.mjs → trismegisto-spine-auto-service-auto-service-groups.component-DQqzfq0M.mjs} +21 -5
  13. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-DQqzfq0M.mjs.map +1 -0
  14. package/fesm2022/{trismegisto-spine-auto-service-auto-service-login-attempts.component-DoyhkSYc.mjs → trismegisto-spine-auto-service-auto-service-login-attempts.component-CjxKYv-y.mjs} +2 -2
  15. package/fesm2022/{trismegisto-spine-auto-service-auto-service-login-attempts.component-DoyhkSYc.mjs.map → trismegisto-spine-auto-service-auto-service-login-attempts.component-CjxKYv-y.mjs.map} +1 -1
  16. package/fesm2022/{trismegisto-spine-auto-service-auto-service-news-page.component-BW7BJ0oD.mjs → trismegisto-spine-auto-service-auto-service-news-page.component-Cbaszx4F.mjs} +21 -5
  17. package/fesm2022/trismegisto-spine-auto-service-auto-service-news-page.component-Cbaszx4F.mjs.map +1 -0
  18. package/fesm2022/{trismegisto-spine-auto-service-auto-service-ratings-page.component-CHPU-QLJ.mjs → trismegisto-spine-auto-service-auto-service-ratings-page.component-CJRIDWXi.mjs} +22 -4
  19. package/fesm2022/trismegisto-spine-auto-service-auto-service-ratings-page.component-CJRIDWXi.mjs.map +1 -0
  20. package/fesm2022/{trismegisto-spine-auto-service-auto-service-suggestions-page.component-CkiCTmXD.mjs → trismegisto-spine-auto-service-auto-service-suggestions-page.component-Bu8YX554.mjs} +46 -4
  21. package/fesm2022/trismegisto-spine-auto-service-auto-service-suggestions-page.component-Bu8YX554.mjs.map +1 -0
  22. package/fesm2022/{trismegisto-spine-auto-service-auto-service.component-D58Ht9PH.mjs → trismegisto-spine-auto-service-auto-service.component-BLkLHp6J.mjs} +23 -5
  23. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-BLkLHp6J.mjs.map +1 -0
  24. package/fesm2022/{trismegisto-spine-auto-service-home.component-9WvXOH3l.mjs → trismegisto-spine-auto-service-home.component-BYMiTZp6.mjs} +6 -3
  25. package/fesm2022/trismegisto-spine-auto-service-home.component-BYMiTZp6.mjs.map +1 -0
  26. package/fesm2022/trismegisto-spine-auto-service.mjs +10 -10
  27. package/fesm2022/trismegisto-spine-auto-service.mjs.map +1 -1
  28. package/fesm2022/trismegisto-spine-layout-ai-agent-chat.component-LlxtxNA5.mjs +294 -0
  29. package/fesm2022/trismegisto-spine-layout-ai-agent-chat.component-LlxtxNA5.mjs.map +1 -0
  30. package/fesm2022/trismegisto-spine-layout-ai-agent-transcript-BNcgbrV_.mjs +438 -0
  31. package/fesm2022/trismegisto-spine-layout-ai-agent-transcript-BNcgbrV_.mjs.map +1 -0
  32. package/fesm2022/{trismegisto-spine-layout-suggestions-page.component-CEKMqera.mjs → trismegisto-spine-layout-suggestions-page.component-BEGFNlvw.mjs} +18 -4
  33. package/fesm2022/trismegisto-spine-layout-suggestions-page.component-BEGFNlvw.mjs.map +1 -0
  34. package/fesm2022/{trismegisto-spine-layout-trismegisto-spine-layout-DiAfxIGP.mjs → trismegisto-spine-layout-trismegisto-spine-layout-D3vetDC_.mjs} +1075 -57
  35. package/fesm2022/trismegisto-spine-layout-trismegisto-spine-layout-D3vetDC_.mjs.map +1 -0
  36. package/fesm2022/trismegisto-spine-layout.mjs +1 -1
  37. package/fesm2022/trismegisto-spine-modal.mjs +4 -1
  38. package/fesm2022/trismegisto-spine-modal.mjs.map +1 -1
  39. package/fesm2022/trismegisto-spine-notification.mjs +1 -1
  40. package/fesm2022/trismegisto-spine-notification.mjs.map +1 -1
  41. package/fesm2022/trismegisto-spine-routing.mjs +2 -2
  42. package/fesm2022/trismegisto-spine-routing.mjs.map +1 -1
  43. package/fesm2022/trismegisto-spine-shell.mjs +2 -1
  44. package/fesm2022/trismegisto-spine-shell.mjs.map +1 -1
  45. package/fesm2022/trismegisto-spine-side-panel.mjs +4 -1
  46. package/fesm2022/trismegisto-spine-side-panel.mjs.map +1 -1
  47. package/fesm2022/trismegisto-spine.mjs +218 -69
  48. package/fesm2022/trismegisto-spine.mjs.map +1 -1
  49. package/package.json +6 -6
  50. package/types/trismegisto-spine-audit.d.ts +11 -4
  51. package/types/trismegisto-spine-audit.d.ts.map +1 -1
  52. package/types/trismegisto-spine-auto-service.d.ts.map +1 -1
  53. package/types/trismegisto-spine-layout.d.ts +124 -105
  54. package/types/trismegisto-spine-layout.d.ts.map +1 -1
  55. package/types/trismegisto-spine-modal.d.ts +2 -1
  56. package/types/trismegisto-spine-modal.d.ts.map +1 -1
  57. package/types/trismegisto-spine-shell.d.ts.map +1 -1
  58. package/types/trismegisto-spine-side-panel.d.ts +2 -1
  59. package/types/trismegisto-spine-side-panel.d.ts.map +1 -1
  60. package/types/trismegisto-spine.d.ts +110 -28
  61. package/types/trismegisto-spine.d.ts.map +1 -1
  62. package/fesm2022/trismegisto-spine-auto-service-auto-service-client-picker.component-NawbfdLW.mjs.map +0 -1
  63. package/fesm2022/trismegisto-spine-auto-service-auto-service-client.component-kAXaCM5W.mjs.map +0 -1
  64. package/fesm2022/trismegisto-spine-auto-service-auto-service-delete-CV_t9vxm.mjs.map +0 -1
  65. package/fesm2022/trismegisto-spine-auto-service-auto-service-groups.component-DE2QIGRH.mjs.map +0 -1
  66. package/fesm2022/trismegisto-spine-auto-service-auto-service-news-page.component-BW7BJ0oD.mjs.map +0 -1
  67. package/fesm2022/trismegisto-spine-auto-service-auto-service-ratings-page.component-CHPU-QLJ.mjs.map +0 -1
  68. package/fesm2022/trismegisto-spine-auto-service-auto-service-suggestions-page.component-CkiCTmXD.mjs.map +0 -1
  69. package/fesm2022/trismegisto-spine-auto-service-auto-service.component-D58Ht9PH.mjs.map +0 -1
  70. package/fesm2022/trismegisto-spine-auto-service-home.component-9WvXOH3l.mjs.map +0 -1
  71. package/fesm2022/trismegisto-spine-layout-suggestions-page.component-CEKMqera.mjs.map +0 -1
  72. package/fesm2022/trismegisto-spine-layout-trismegisto-spine-layout-DiAfxIGP.mjs.map +0 -1
@@ -0,0 +1,438 @@
1
+ import { Marked } from 'marked';
2
+
3
+ const PAGE_WIDTH = 595;
4
+ const PAGE_HEIGHT = 842;
5
+ const MARGIN = 48;
6
+ const CONTENT_WIDTH = PAGE_WIDTH - 2 * MARGIN;
7
+ const BOTTOM = PAGE_HEIGHT - MARGIN - 14;
8
+ const BODY_SIZE = 10;
9
+ const BODY_LEADING = 14;
10
+ const TABLE_SIZE = 8.5;
11
+ const TABLE_LEADING = 11;
12
+ const TABLE_PADDING = 4;
13
+ const INK = 0.13;
14
+ const MUTED = 0.42;
15
+ const RULE = 0.8;
16
+ const SHADE = 0.95;
17
+ // Larguras das fontes padrão (AFM da Adobe), de 32 a 126, em milésimos do corpo.
18
+ const REGULAR = [
19
+ 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556,
20
+ 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778,
21
+ 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556,
22
+ 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584,
23
+ ];
24
+ const BOLD = [
25
+ 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556,
26
+ 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778,
27
+ 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611,
28
+ 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584,
29
+ ];
30
+ const COURIER_WIDTH = 600;
31
+ // O trecho de 0x80 a 0x9F do WinAnsi; o resto até 0xFF coincide com o Unicode.
32
+ const WIN_ANSI = {
33
+ '€': 0x80, '‚': 0x82, 'ƒ': 0x83, '„': 0x84, '…': 0x85, '†': 0x86, '‡': 0x87, 'ˆ': 0x88, '‰': 0x89, 'Š': 0x8a, '‹': 0x8b,
34
+ 'Œ': 0x8c, 'Ž': 0x8e, '‘': 0x91, '’': 0x92, '“': 0x93, '”': 0x94, '•': 0x95, '–': 0x96, '—': 0x97, '˜': 0x98, '™': 0x99,
35
+ 'š': 0x9a, '›': 0x9b, 'œ': 0x9c, 'ž': 0x9e, 'Ÿ': 0x9f,
36
+ };
37
+ const REPLACEMENTS = {
38
+ '→': '->', '←': '<-', '⇒': '=>', '≥': '>=', '≤': '<=', '≠': '!=', '✓': 'OK', '✔': 'OK', '✅': 'OK', '✗': 'X', '✘': 'X', '❌': 'X', '⚠': '!',
39
+ '\u00a0': ' ', '\u2009': ' ', '\u202f': ' ', '\u200b': '',
40
+ };
41
+ const WIDE_PUNCTUATION = { '—': 1000, '…': 1000, '•': 350, '‰': 1000, '™': 1000, '‘': 222, '’': 222, '“': 333, '”': 333 };
42
+ const ENTITIES = { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '"', '&#39;': "'" };
43
+ /** Só o que as fontes padrão desenham: troca o que tem equivalente, tira emoji e marca o resto com `?`. */
44
+ function printable(raw) {
45
+ let result = '';
46
+ for (const char of raw.normalize('NFC')) {
47
+ const code = char.codePointAt(0);
48
+ if (REPLACEMENTS[char] !== undefined)
49
+ result += REPLACEMENTS[char];
50
+ else if (char === '\t')
51
+ result += ' ';
52
+ else if (code < 32 || code === 127)
53
+ continue;
54
+ else if (code <= 255 && !(code >= 0x80 && code <= 0x9f))
55
+ result += char;
56
+ else if (WIN_ANSI[char])
57
+ result += char;
58
+ // Modificadores e seletores de variação de emoji somem junto com ele.
59
+ else if (code >= 0x1f000 || (code >= 0x2600 && code <= 0x27bf) || code === 0xfe0f || code === 0x200d)
60
+ continue;
61
+ else
62
+ result += '?';
63
+ }
64
+ return result;
65
+ }
66
+ function charWidth(char, font) {
67
+ if (font === 'F3')
68
+ return COURIER_WIDTH;
69
+ const table = font === 'F2' ? BOLD : REGULAR;
70
+ const direct = table[char.charCodeAt(0) - 32];
71
+ if (direct !== undefined)
72
+ return direct;
73
+ if (WIDE_PUNCTUATION[char])
74
+ return WIDE_PUNCTUATION[char];
75
+ // Acentuada: a largura é a da letra base.
76
+ return table[char.normalize('NFD').charCodeAt(0) - 32] ?? 556;
77
+ }
78
+ function textWidth(text, font, size) {
79
+ let total = 0;
80
+ for (const char of text)
81
+ total += charWidth(char, font);
82
+ return (total * size) / 1000;
83
+ }
84
+ /** Quebra em linhas no espaço disponível. Palavra maior que a linha é cortada, para nunca passar da borda. */
85
+ function wrap(runs, width, size) {
86
+ const lines = [];
87
+ let line = [];
88
+ let used = 0;
89
+ const flush = () => {
90
+ lines.push(line);
91
+ line = [];
92
+ used = 0;
93
+ };
94
+ const push = (text, font) => {
95
+ const last = line[line.length - 1];
96
+ if (last && last.font === font)
97
+ last.text += text;
98
+ else
99
+ line.push({ text, font });
100
+ used += textWidth(text, font, size);
101
+ };
102
+ for (const run of runs) {
103
+ for (const piece of run.text.split(/(\n|\s+)/)) {
104
+ if (!piece)
105
+ continue;
106
+ if (piece === '\n') {
107
+ flush();
108
+ }
109
+ else if (!piece.trim()) {
110
+ if (used > 0)
111
+ push(' ', run.font);
112
+ }
113
+ else {
114
+ let word = piece;
115
+ if (used + textWidth(word, run.font, size) > width && used > 0)
116
+ flush();
117
+ while (textWidth(word, run.font, size) > width) {
118
+ let end = 1;
119
+ while (end < word.length && textWidth(word.slice(0, end + 1), run.font, size) <= width)
120
+ end += 1;
121
+ push(word.slice(0, end), run.font);
122
+ flush();
123
+ word = word.slice(end);
124
+ }
125
+ push(word, run.font);
126
+ }
127
+ }
128
+ }
129
+ flush();
130
+ return lines.map((current) => {
131
+ // O espaço que sobrou no fim da linha não conta.
132
+ const last = current[current.length - 1];
133
+ if (last)
134
+ last.text = last.text.replace(/ +$/, '');
135
+ return current.filter((run) => run.text);
136
+ });
137
+ }
138
+ function escapePdfText(text) {
139
+ let result = '';
140
+ for (const char of text) {
141
+ const code = WIN_ANSI[char] ?? char.charCodeAt(0);
142
+ if (char === '(' || char === ')' || char === '\\')
143
+ result += `\\${char}`;
144
+ else if (code < 32 || code > 126)
145
+ result += `\\${code.toString(8).padStart(3, '0')}`;
146
+ else
147
+ result += char;
148
+ }
149
+ return result;
150
+ }
151
+ function inlineRuns(tokens, font = 'F1') {
152
+ const runs = [];
153
+ for (const token of tokens ?? []) {
154
+ const item = token;
155
+ switch (token.type) {
156
+ case 'strong':
157
+ runs.push(...inlineRuns(item.tokens, 'F2'));
158
+ break;
159
+ case 'em':
160
+ case 'del':
161
+ runs.push(...inlineRuns(item.tokens, font));
162
+ break;
163
+ case 'codespan':
164
+ runs.push({ text: printable(decodeEntities(item['text'])), font: 'F3' });
165
+ break;
166
+ case 'br':
167
+ runs.push({ text: '\n', font });
168
+ break;
169
+ case 'link': {
170
+ const label = inlineRuns(item.tokens, font);
171
+ runs.push(...label);
172
+ if (label.map((run) => run.text).join('') !== item['href'])
173
+ runs.push({ text: ` (${printable(item['href'])})`, font });
174
+ break;
175
+ }
176
+ case 'image':
177
+ runs.push({ text: printable(item['text'] || item['href']), font });
178
+ break;
179
+ default:
180
+ if (item.tokens?.length)
181
+ runs.push(...inlineRuns(item.tokens, font));
182
+ else
183
+ runs.push({ text: printable(decodeEntities(String(item['text'] ?? item.raw ?? ''))), font });
184
+ }
185
+ }
186
+ return runs;
187
+ }
188
+ function decodeEntities(text) {
189
+ return text.replace(/&(amp|lt|gt|quot|#39);/g, (entity) => ENTITIES[entity] ?? entity);
190
+ }
191
+ class PdfDocument {
192
+ constructor() {
193
+ this.pages = [[]];
194
+ this.y = MARGIN;
195
+ }
196
+ get page() {
197
+ return this.pages[this.pages.length - 1];
198
+ }
199
+ newPage() {
200
+ this.pages.push([]);
201
+ this.y = MARGIN;
202
+ }
203
+ /** Garante espaço para o que vem a seguir, ou passa para a próxima página. */
204
+ reserve(height) {
205
+ if (this.y + height > BOTTOM)
206
+ this.newPage();
207
+ }
208
+ rect(x, top, width, height, gray) {
209
+ this.page.push(`${gray} g ${x.toFixed(2)} ${(PAGE_HEIGHT - top - height).toFixed(2)} ${width.toFixed(2)} ${height.toFixed(2)} re f`);
210
+ }
211
+ rule(x1, top1, x2, top2) {
212
+ this.page.push(`${RULE} G 0.5 w ${x1.toFixed(2)} ${(PAGE_HEIGHT - top1).toFixed(2)} m ${x2.toFixed(2)} ${(PAGE_HEIGHT - top2).toFixed(2)} l S`);
213
+ }
214
+ /** `baseline` conta do alto da página. */
215
+ write(line, x, baseline, size, gray = INK) {
216
+ let cursor = x;
217
+ for (const run of line) {
218
+ this.page.push(`BT /${run.font} ${size} Tf ${gray} g 1 0 0 1 ${cursor.toFixed(2)} ${(PAGE_HEIGHT - baseline).toFixed(2)} Tm (${escapePdfText(run.text)}) Tj ET`);
219
+ cursor += textWidth(run.text, run.font, size);
220
+ }
221
+ }
222
+ paragraph(runs, x, options = {}) {
223
+ const size = options.size ?? BODY_SIZE;
224
+ const leading = options.leading ?? BODY_LEADING;
225
+ const width = PAGE_WIDTH - MARGIN - x;
226
+ for (const line of wrap(runs, width - (options.shade ? 2 * TABLE_PADDING : 0), size)) {
227
+ this.reserve(leading);
228
+ if (options.shade)
229
+ this.rect(MARGIN, this.y, CONTENT_WIDTH, leading, SHADE);
230
+ this.write(line, options.shade ? x + TABLE_PADDING : x, this.y + leading - 3.5, size, options.gray);
231
+ this.y += leading;
232
+ }
233
+ }
234
+ blocks(tokens, x) {
235
+ for (const token of tokens) {
236
+ const item = token;
237
+ switch (token.type) {
238
+ case 'space':
239
+ break;
240
+ case 'heading': {
241
+ const size = item['depth'] <= 2 ? 12 : 11;
242
+ this.reserve(size + BODY_LEADING * 2);
243
+ this.y += 4;
244
+ this.paragraph(inlineRuns(item.tokens, 'F2'), x, { size, leading: size + 4 });
245
+ this.y += 2;
246
+ break;
247
+ }
248
+ case 'paragraph':
249
+ case 'text':
250
+ this.paragraph(item.tokens?.length ? inlineRuns(item.tokens) : [{ text: printable(decodeEntities(String(item['text'] ?? ''))), font: 'F1' }], x);
251
+ this.y += token.type === 'paragraph' ? 5 : 0;
252
+ break;
253
+ case 'list':
254
+ this.list(token, x);
255
+ this.y += 5;
256
+ break;
257
+ case 'code':
258
+ this.code(String(item['text'] ?? ''), x);
259
+ break;
260
+ case 'table':
261
+ this.table(token);
262
+ break;
263
+ case 'blockquote':
264
+ this.blocks(item.tokens ?? [], x + 12);
265
+ break;
266
+ case 'hr':
267
+ this.reserve(10);
268
+ this.rule(x, this.y + 4, PAGE_WIDTH - MARGIN, this.y + 4);
269
+ this.y += 10;
270
+ break;
271
+ default:
272
+ this.paragraph([{ text: printable(String(item.raw ?? '')), font: 'F1' }], x);
273
+ }
274
+ }
275
+ }
276
+ list(list, x) {
277
+ list.items.forEach((item, index) => {
278
+ const marker = list.ordered ? `${Number(list.start || 1) + index}.` : '•';
279
+ this.reserve(BODY_LEADING);
280
+ this.write([{ text: marker, font: 'F1' }], x + 2, this.y + BODY_LEADING - 3.5, BODY_SIZE);
281
+ this.blocks(item.tokens, x + 16);
282
+ });
283
+ }
284
+ code(text, x) {
285
+ const size = 8.5;
286
+ this.y += 2;
287
+ for (const source of text.split('\n')) {
288
+ for (const line of wrap([{ text: printable(source) || ' ', font: 'F3' }], PAGE_WIDTH - MARGIN - x - 2 * TABLE_PADDING, size)) {
289
+ this.reserve(TABLE_LEADING);
290
+ this.rect(x, this.y, PAGE_WIDTH - MARGIN - x, TABLE_LEADING, SHADE);
291
+ this.write(line, x + TABLE_PADDING, this.y + TABLE_LEADING - 2.5, size);
292
+ this.y += TABLE_LEADING;
293
+ }
294
+ }
295
+ this.y += 6;
296
+ }
297
+ table(table) {
298
+ const header = table.header.map((cell) => inlineRuns(cell.tokens, 'F2'));
299
+ const rows = table.rows.map((row) => row.map((cell) => inlineRuns(cell.tokens)));
300
+ const columns = Math.max(header.length, ...rows.map((row) => row.length));
301
+ const widths = this.columnWidths([header, ...rows], columns);
302
+ const inner = (column) => Math.max(widths[column] - 2 * TABLE_PADDING, 8);
303
+ const wrapRow = (row) => widths.map((_, column) => wrap(row[column] ?? [], inner(column), TABLE_SIZE));
304
+ const headerLines = wrapRow(header);
305
+ const drawRow = (cells, from, count, shaded) => {
306
+ const height = count * TABLE_LEADING + 2 * TABLE_PADDING - 2;
307
+ if (shaded)
308
+ this.rect(MARGIN, this.y, CONTENT_WIDTH, height, SHADE);
309
+ let x = MARGIN;
310
+ cells.forEach((lines, column) => {
311
+ lines.slice(from, from + count).forEach((line, index) => {
312
+ this.write(line, x + TABLE_PADDING, this.y + TABLE_PADDING + (index + 1) * TABLE_LEADING - 4, TABLE_SIZE);
313
+ });
314
+ x += widths[column];
315
+ });
316
+ this.y += height;
317
+ this.rule(MARGIN, this.y, PAGE_WIDTH - MARGIN, this.y);
318
+ };
319
+ const lineCount = (cells) => Math.max(1, ...cells.map((lines) => lines.length));
320
+ const drawHeader = () => drawRow(headerLines, 0, lineCount(headerLines), true);
321
+ const headerHeight = lineCount(headerLines) * TABLE_LEADING + 2 * TABLE_PADDING;
322
+ this.y += 2;
323
+ this.reserve(headerHeight + 2 * TABLE_LEADING + 2 * TABLE_PADDING);
324
+ drawHeader();
325
+ for (const row of rows) {
326
+ const cells = wrapRow(row);
327
+ const total = lineCount(cells);
328
+ let done = 0;
329
+ while (done < total) {
330
+ const fits = Math.floor((BOTTOM - this.y - 2 * TABLE_PADDING) / TABLE_LEADING);
331
+ // Linha que cabe inteira na página seguinte não é partida; só a que é maior que uma página.
332
+ if (fits < 1 || (done === 0 && fits < total && total * TABLE_LEADING < BOTTOM - MARGIN - headerHeight * 2)) {
333
+ this.newPage();
334
+ drawHeader();
335
+ continue;
336
+ }
337
+ const count = Math.min(fits, total - done);
338
+ drawRow(cells, done, count, false);
339
+ done += count;
340
+ }
341
+ }
342
+ this.y += 8;
343
+ }
344
+ /** Proporcional ao conteúdo, com um mínimo por coluna, para coluna curta não roubar nem sobrar demais. */
345
+ columnWidths(rows, columns) {
346
+ const natural = Array.from({ length: columns }, (_, column) => Math.max(24, ...rows.map((row) => (row[column] ?? []).reduce((sum, run) => sum + textWidth(run.text, run.font, TABLE_SIZE), 0) + 2 * TABLE_PADDING)));
347
+ const total = natural.reduce((sum, width) => sum + width, 0);
348
+ if (total <= CONTENT_WIDTH) {
349
+ const spare = (CONTENT_WIDTH - total) / columns;
350
+ return natural.map((width) => width + spare);
351
+ }
352
+ const floor = Math.min(36, CONTENT_WIDTH / columns);
353
+ const capped = natural.map((width) => Math.max(floor, (width / total) * CONTENT_WIDTH));
354
+ const scale = CONTENT_WIDTH / capped.reduce((sum, width) => sum + width, 0);
355
+ return capped.map((width) => width * scale);
356
+ }
357
+ serialize(title, pageLabel) {
358
+ const total = this.pages.length;
359
+ this.pages.forEach((content, index) => {
360
+ const text = printable(`${pageLabel} ${index + 1} / ${total}`);
361
+ const x = PAGE_WIDTH - MARGIN - textWidth(text, 'F1', 8);
362
+ content.push(`BT /F1 8 Tf ${MUTED} g 1 0 0 1 ${x.toFixed(2)} 28.00 Tm (${escapePdfText(text)}) Tj ET`);
363
+ });
364
+ // 1 catálogo, 2 árvore, 3 a 5 fontes, 6 metadados; depois, página e conteúdo de cada uma.
365
+ const firstPage = 7;
366
+ const objects = [
367
+ '<< /Type /Catalog /Pages 2 0 R >>',
368
+ `<< /Type /Pages /Count ${total} /Kids [${this.pages.map((_, index) => `${firstPage + index * 2} 0 R`).join(' ')}] >>`,
369
+ '<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>',
370
+ '<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>',
371
+ '<< /Type /Font /Subtype /Type1 /BaseFont /Courier /Encoding /WinAnsiEncoding >>',
372
+ `<< /Title (${escapePdfText(printable(title))}) >>`,
373
+ ];
374
+ this.pages.forEach((content, index) => {
375
+ const stream = content.join('\n');
376
+ objects.push(`<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${PAGE_WIDTH} ${PAGE_HEIGHT}] /Resources << /Font << /F1 3 0 R /F2 4 0 R /F3 5 0 R >> >> /Contents ${firstPage + index * 2 + 1} 0 R >>`, `<< /Length ${stream.length} >>\nstream\n${stream}\nendstream`);
377
+ });
378
+ // O texto já saiu escapado: o arquivo é todo ASCII, então a posição em caracteres é a posição em bytes.
379
+ let body = '%PDF-1.4\n';
380
+ const offsets = [];
381
+ objects.forEach((object, index) => {
382
+ offsets.push(body.length);
383
+ body += `${index + 1} 0 obj\n${object}\nendobj\n`;
384
+ });
385
+ const xref = body.length;
386
+ const count = objects.length + 1;
387
+ body += `xref\n0 ${count}\n0000000000 65535 f \n${offsets.map((offset) => `${String(offset).padStart(10, '0')} 00000 n \n`).join('')}`;
388
+ body += `trailer\n<< /Size ${count} /Root 1 0 R /Info 6 0 R >>\nstartxref\n${xref}\n%%EOF\n`;
389
+ return new TextEncoder().encode(body);
390
+ }
391
+ }
392
+ function buildTranscriptPdf(transcript) {
393
+ const parser = new Marked({ gfm: true, breaks: false });
394
+ const pdf = new PdfDocument();
395
+ pdf.paragraph([{ text: printable(transcript.title), font: 'F2' }], MARGIN, { size: 16, leading: 22 });
396
+ pdf.paragraph([{ text: printable(transcript.subtitle), font: 'F1' }], MARGIN, { size: 9, leading: 13, gray: MUTED });
397
+ pdf.y += 6;
398
+ pdf.rule(MARGIN, pdf.y, PAGE_WIDTH - MARGIN, pdf.y);
399
+ pdf.y += 10;
400
+ for (const entry of transcript.entries) {
401
+ const label = entry.role === 'person' ? transcript.personLabel : transcript.agentLabel;
402
+ // O rótulo não fica sozinho no pé da página.
403
+ pdf.reserve(BODY_LEADING * 3);
404
+ pdf.paragraph([{ text: printable(label), font: 'F2' }], MARGIN, { size: 9, leading: 13, gray: MUTED });
405
+ if (entry.role === 'person') {
406
+ // A pergunta é o que a pessoa escreveu, sem interpretar como Markdown.
407
+ pdf.paragraph([{ text: entry.text.split(/\r?\n/).map(printable).join('\n'), font: 'F1' }], MARGIN, { shade: true });
408
+ pdf.y += 8;
409
+ }
410
+ else {
411
+ if (entry.error)
412
+ pdf.paragraph([{ text: printable(entry.text), font: 'F1' }], MARGIN, { gray: MUTED });
413
+ else
414
+ pdf.blocks(parser.lexer(entry.text), MARGIN);
415
+ if (entry.steps.length) {
416
+ pdf.y += 2;
417
+ pdf.reserve(13 * 2);
418
+ pdf.paragraph([{ text: printable(transcript.queriesLabel), font: 'F2' }], MARGIN, { size: 8.5, leading: 12, gray: MUTED });
419
+ for (const step of entry.steps) {
420
+ const failed = step.failed ? ` (${transcript.failedLabel})` : '';
421
+ const detail = step.detail ? `: ${step.detail}` : '';
422
+ pdf.paragraph([{ text: printable(`• ${step.title}${failed}${detail}`), font: 'F1' }], MARGIN, { size: 8.5, leading: 12, gray: MUTED });
423
+ }
424
+ }
425
+ pdf.y += 12;
426
+ }
427
+ }
428
+ return pdf.serialize(transcript.title, transcript.pageLabel);
429
+ }
430
+ /** `dudu-conversa-2026-11-05.pdf`: sem acento nem espaço, para qualquer sistema aceitar. */
431
+ function transcriptFileName(title, word, now) {
432
+ const slug = (value) => value.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
433
+ const day = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;
434
+ return `${[slug(title), slug(word)].filter(Boolean).join('-')}-${day}.pdf`;
435
+ }
436
+
437
+ export { buildTranscriptPdf, transcriptFileName };
438
+ //# sourceMappingURL=trismegisto-spine-layout-ai-agent-transcript-BNcgbrV_.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trismegisto-spine-layout-ai-agent-transcript-BNcgbrV_.mjs","sources":["../../../projects/ui/layout/src/ai-agent/ai-agent-transcript.ts"],"sourcesContent":["import { Marked, Token, Tokens } from 'marked';\n\n/**\n * Transcrição da conversa em PDF, gerada no navegador e carregada só no clique. Um gerador pequeno em vez de uma\n * biblioteca: a conversa é texto e tabela, e as fontes padrão do PDF cobrem o português sem embutir arquivo nenhum.\n * O que não existe nessas fontes (WinAnsi) vira um equivalente em texto ou `?`, nunca erro.\n */\nexport interface SpineTranscriptStep {\n title: string;\n detail?: string;\n failed?: boolean;\n}\n\nexport interface SpineTranscriptEntry {\n role: 'person' | 'agent';\n text: string;\n steps: readonly SpineTranscriptStep[];\n error: boolean;\n}\n\nexport interface SpineTranscript {\n title: string;\n /** Linha abaixo do título: aplicação, pessoa e data. */\n subtitle: string;\n personLabel: string;\n agentLabel: string;\n queriesLabel: string;\n failedLabel: string;\n pageLabel: string;\n entries: readonly SpineTranscriptEntry[];\n}\n\ntype Font = 'F1' | 'F2' | 'F3';\n\ninterface Run {\n text: string;\n font: Font;\n}\n\ntype Line = Run[];\n\nconst PAGE_WIDTH = 595;\nconst PAGE_HEIGHT = 842;\nconst MARGIN = 48;\nconst CONTENT_WIDTH = PAGE_WIDTH - 2 * MARGIN;\nconst BOTTOM = PAGE_HEIGHT - MARGIN - 14;\nconst BODY_SIZE = 10;\nconst BODY_LEADING = 14;\nconst TABLE_SIZE = 8.5;\nconst TABLE_LEADING = 11;\nconst TABLE_PADDING = 4;\nconst INK = 0.13;\nconst MUTED = 0.42;\nconst RULE = 0.8;\nconst SHADE = 0.95;\n\n// Larguras das fontes padrão (AFM da Adobe), de 32 a 126, em milésimos do corpo.\nconst REGULAR = [\n 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556,\n 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778,\n 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556,\n 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584,\n];\nconst BOLD = [\n 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556,\n 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778,\n 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611,\n 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584,\n];\nconst COURIER_WIDTH = 600;\n\n// O trecho de 0x80 a 0x9F do WinAnsi; o resto até 0xFF coincide com o Unicode.\nconst WIN_ANSI: Readonly<Record<string, number>> = {\n '€': 0x80, '‚': 0x82, 'ƒ': 0x83, '„': 0x84, '…': 0x85, '†': 0x86, '‡': 0x87, 'ˆ': 0x88, '‰': 0x89, 'Š': 0x8a, '‹': 0x8b,\n 'Œ': 0x8c, 'Ž': 0x8e, '‘': 0x91, '’': 0x92, '“': 0x93, '”': 0x94, '•': 0x95, '–': 0x96, '—': 0x97, '˜': 0x98, '™': 0x99,\n 'š': 0x9a, '›': 0x9b, 'œ': 0x9c, 'ž': 0x9e, 'Ÿ': 0x9f,\n};\nconst REPLACEMENTS: Readonly<Record<string, string>> = {\n '→': '->', '←': '<-', '⇒': '=>', '≥': '>=', '≤': '<=', '≠': '!=', '✓': 'OK', '✔': 'OK', '✅': 'OK', '✗': 'X', '✘': 'X', '❌': 'X', '⚠': '!',\n '\\u00a0': ' ', '\\u2009': ' ', '\\u202f': ' ', '\\u200b': '',\n};\nconst WIDE_PUNCTUATION: Readonly<Record<string, number>> = { '—': 1000, '…': 1000, '•': 350, '‰': 1000, '™': 1000, '‘': 222, '’': 222, '“': 333, '”': 333 };\nconst ENTITIES: Readonly<Record<string, string>> = { '&amp;': '&', '&lt;': '<', '&gt;': '>', '&quot;': '\"', '&#39;': \"'\" };\n\n/** Só o que as fontes padrão desenham: troca o que tem equivalente, tira emoji e marca o resto com `?`. */\nfunction printable(raw: string): string {\n let result = '';\n for (const char of raw.normalize('NFC')) {\n const code = char.codePointAt(0)!;\n if (REPLACEMENTS[char] !== undefined) result += REPLACEMENTS[char];\n else if (char === '\\t') result += ' ';\n else if (code < 32 || code === 127) continue;\n else if (code <= 255 && !(code >= 0x80 && code <= 0x9f)) result += char;\n else if (WIN_ANSI[char]) result += char;\n // Modificadores e seletores de variação de emoji somem junto com ele.\n else if (code >= 0x1f000 || (code >= 0x2600 && code <= 0x27bf) || code === 0xfe0f || code === 0x200d) continue;\n else result += '?';\n }\n return result;\n}\n\nfunction charWidth(char: string, font: Font): number {\n if (font === 'F3') return COURIER_WIDTH;\n const table = font === 'F2' ? BOLD : REGULAR;\n const direct = table[char.charCodeAt(0) - 32];\n if (direct !== undefined) return direct;\n if (WIDE_PUNCTUATION[char]) return WIDE_PUNCTUATION[char];\n // Acentuada: a largura é a da letra base.\n return table[char.normalize('NFD').charCodeAt(0) - 32] ?? 556;\n}\n\nfunction textWidth(text: string, font: Font, size: number): number {\n let total = 0;\n for (const char of text) total += charWidth(char, font);\n return (total * size) / 1000;\n}\n\n/** Quebra em linhas no espaço disponível. Palavra maior que a linha é cortada, para nunca passar da borda. */\nfunction wrap(runs: readonly Run[], width: number, size: number): Line[] {\n const lines: Line[] = [];\n let line: Line = [];\n let used = 0;\n const flush = () => {\n lines.push(line);\n line = [];\n used = 0;\n };\n const push = (text: string, font: Font) => {\n const last = line[line.length - 1];\n if (last && last.font === font) last.text += text;\n else line.push({ text, font });\n used += textWidth(text, font, size);\n };\n for (const run of runs) {\n for (const piece of run.text.split(/(\\n|\\s+)/)) {\n if (!piece) continue;\n if (piece === '\\n') {\n flush();\n } else if (!piece.trim()) {\n if (used > 0) push(' ', run.font);\n } else {\n let word = piece;\n if (used + textWidth(word, run.font, size) > width && used > 0) flush();\n while (textWidth(word, run.font, size) > width) {\n let end = 1;\n while (end < word.length && textWidth(word.slice(0, end + 1), run.font, size) <= width) end += 1;\n push(word.slice(0, end), run.font);\n flush();\n word = word.slice(end);\n }\n push(word, run.font);\n }\n }\n }\n flush();\n return lines.map((current) => {\n // O espaço que sobrou no fim da linha não conta.\n const last = current[current.length - 1];\n if (last) last.text = last.text.replace(/ +$/, '');\n return current.filter((run) => run.text);\n });\n}\n\nfunction escapePdfText(text: string): string {\n let result = '';\n for (const char of text) {\n const code = WIN_ANSI[char] ?? char.charCodeAt(0);\n if (char === '(' || char === ')' || char === '\\\\') result += `\\\\${char}`;\n else if (code < 32 || code > 126) result += `\\\\${code.toString(8).padStart(3, '0')}`;\n else result += char;\n }\n return result;\n}\n\nfunction inlineRuns(tokens: readonly Token[] | undefined, font: Font = 'F1'): Run[] {\n const runs: Run[] = [];\n for (const token of tokens ?? []) {\n const item = token as Tokens.Generic;\n switch (token.type) {\n case 'strong':\n runs.push(...inlineRuns(item.tokens, 'F2'));\n break;\n case 'em':\n case 'del':\n runs.push(...inlineRuns(item.tokens, font));\n break;\n case 'codespan':\n runs.push({ text: printable(decodeEntities(item['text'])), font: 'F3' });\n break;\n case 'br':\n runs.push({ text: '\\n', font });\n break;\n case 'link': {\n const label = inlineRuns(item.tokens, font);\n runs.push(...label);\n if (label.map((run) => run.text).join('') !== item['href']) runs.push({ text: ` (${printable(item['href'])})`, font });\n break;\n }\n case 'image':\n runs.push({ text: printable(item['text'] || item['href']), font });\n break;\n default:\n if (item.tokens?.length) runs.push(...inlineRuns(item.tokens, font));\n else runs.push({ text: printable(decodeEntities(String(item['text'] ?? item.raw ?? ''))), font });\n }\n }\n return runs;\n}\n\nfunction decodeEntities(text: string): string {\n return text.replace(/&(amp|lt|gt|quot|#39);/g, (entity) => ENTITIES[entity] ?? entity);\n}\n\nclass PdfDocument {\n readonly pages: string[][] = [[]];\n y = MARGIN;\n\n private get page(): string[] {\n return this.pages[this.pages.length - 1];\n }\n\n newPage(): void {\n this.pages.push([]);\n this.y = MARGIN;\n }\n\n /** Garante espaço para o que vem a seguir, ou passa para a próxima página. */\n reserve(height: number): void {\n if (this.y + height > BOTTOM) this.newPage();\n }\n\n rect(x: number, top: number, width: number, height: number, gray: number): void {\n this.page.push(`${gray} g ${x.toFixed(2)} ${(PAGE_HEIGHT - top - height).toFixed(2)} ${width.toFixed(2)} ${height.toFixed(2)} re f`);\n }\n\n rule(x1: number, top1: number, x2: number, top2: number): void {\n this.page.push(`${RULE} G 0.5 w ${x1.toFixed(2)} ${(PAGE_HEIGHT - top1).toFixed(2)} m ${x2.toFixed(2)} ${(PAGE_HEIGHT - top2).toFixed(2)} l S`);\n }\n\n /** `baseline` conta do alto da página. */\n write(line: readonly Run[], x: number, baseline: number, size: number, gray = INK): void {\n let cursor = x;\n for (const run of line) {\n this.page.push(`BT /${run.font} ${size} Tf ${gray} g 1 0 0 1 ${cursor.toFixed(2)} ${(PAGE_HEIGHT - baseline).toFixed(2)} Tm (${escapePdfText(run.text)}) Tj ET`);\n cursor += textWidth(run.text, run.font, size);\n }\n }\n\n paragraph(runs: readonly Run[], x: number, options: { size?: number; leading?: number; gray?: number; shade?: boolean } = {}): void {\n const size = options.size ?? BODY_SIZE;\n const leading = options.leading ?? BODY_LEADING;\n const width = PAGE_WIDTH - MARGIN - x;\n for (const line of wrap(runs, width - (options.shade ? 2 * TABLE_PADDING : 0), size)) {\n this.reserve(leading);\n if (options.shade) this.rect(MARGIN, this.y, CONTENT_WIDTH, leading, SHADE);\n this.write(line, options.shade ? x + TABLE_PADDING : x, this.y + leading - 3.5, size, options.gray);\n this.y += leading;\n }\n }\n\n blocks(tokens: readonly Token[], x: number): void {\n for (const token of tokens) {\n const item = token as Tokens.Generic;\n switch (token.type) {\n case 'space':\n break;\n case 'heading': {\n const size = (item['depth'] as number) <= 2 ? 12 : 11;\n this.reserve(size + BODY_LEADING * 2);\n this.y += 4;\n this.paragraph(inlineRuns(item.tokens, 'F2'), x, { size, leading: size + 4 });\n this.y += 2;\n break;\n }\n case 'paragraph':\n case 'text':\n this.paragraph(item.tokens?.length ? inlineRuns(item.tokens) : [{ text: printable(decodeEntities(String(item['text'] ?? ''))), font: 'F1' }], x);\n this.y += token.type === 'paragraph' ? 5 : 0;\n break;\n case 'list':\n this.list(token as Tokens.List, x);\n this.y += 5;\n break;\n case 'code':\n this.code(String(item['text'] ?? ''), x);\n break;\n case 'table':\n this.table(token as Tokens.Table);\n break;\n case 'blockquote':\n this.blocks(item.tokens ?? [], x + 12);\n break;\n case 'hr':\n this.reserve(10);\n this.rule(x, this.y + 4, PAGE_WIDTH - MARGIN, this.y + 4);\n this.y += 10;\n break;\n default:\n this.paragraph([{ text: printable(String(item.raw ?? '')), font: 'F1' }], x);\n }\n }\n }\n\n private list(list: Tokens.List, x: number): void {\n list.items.forEach((item, index) => {\n const marker = list.ordered ? `${Number(list.start || 1) + index}.` : '•';\n this.reserve(BODY_LEADING);\n this.write([{ text: marker, font: 'F1' }], x + 2, this.y + BODY_LEADING - 3.5, BODY_SIZE);\n this.blocks(item.tokens, x + 16);\n });\n }\n\n private code(text: string, x: number): void {\n const size = 8.5;\n this.y += 2;\n for (const source of text.split('\\n')) {\n for (const line of wrap([{ text: printable(source) || ' ', font: 'F3' }], PAGE_WIDTH - MARGIN - x - 2 * TABLE_PADDING, size)) {\n this.reserve(TABLE_LEADING);\n this.rect(x, this.y, PAGE_WIDTH - MARGIN - x, TABLE_LEADING, SHADE);\n this.write(line, x + TABLE_PADDING, this.y + TABLE_LEADING - 2.5, size);\n this.y += TABLE_LEADING;\n }\n }\n this.y += 6;\n }\n\n private table(table: Tokens.Table): void {\n const header = table.header.map((cell) => inlineRuns(cell.tokens, 'F2'));\n const rows = table.rows.map((row) => row.map((cell) => inlineRuns(cell.tokens)));\n const columns = Math.max(header.length, ...rows.map((row) => row.length));\n const widths = this.columnWidths([header, ...rows], columns);\n const inner = (column: number) => Math.max(widths[column] - 2 * TABLE_PADDING, 8);\n const wrapRow = (row: readonly Run[][]) => widths.map((_, column) => wrap(row[column] ?? [], inner(column), TABLE_SIZE));\n const headerLines = wrapRow(header);\n\n const drawRow = (cells: readonly Line[][], from: number, count: number, shaded: boolean) => {\n const height = count * TABLE_LEADING + 2 * TABLE_PADDING - 2;\n if (shaded) this.rect(MARGIN, this.y, CONTENT_WIDTH, height, SHADE);\n let x = MARGIN;\n cells.forEach((lines, column) => {\n lines.slice(from, from + count).forEach((line, index) => {\n this.write(line, x + TABLE_PADDING, this.y + TABLE_PADDING + (index + 1) * TABLE_LEADING - 4, TABLE_SIZE);\n });\n x += widths[column];\n });\n this.y += height;\n this.rule(MARGIN, this.y, PAGE_WIDTH - MARGIN, this.y);\n };\n const lineCount = (cells: readonly Line[][]) => Math.max(1, ...cells.map((lines) => lines.length));\n const drawHeader = () => drawRow(headerLines, 0, lineCount(headerLines), true);\n const headerHeight = lineCount(headerLines) * TABLE_LEADING + 2 * TABLE_PADDING;\n\n this.y += 2;\n this.reserve(headerHeight + 2 * TABLE_LEADING + 2 * TABLE_PADDING);\n drawHeader();\n for (const row of rows) {\n const cells = wrapRow(row);\n const total = lineCount(cells);\n let done = 0;\n while (done < total) {\n const fits = Math.floor((BOTTOM - this.y - 2 * TABLE_PADDING) / TABLE_LEADING);\n // Linha que cabe inteira na página seguinte não é partida; só a que é maior que uma página.\n if (fits < 1 || (done === 0 && fits < total && total * TABLE_LEADING < BOTTOM - MARGIN - headerHeight * 2)) {\n this.newPage();\n drawHeader();\n continue;\n }\n const count = Math.min(fits, total - done);\n drawRow(cells, done, count, false);\n done += count;\n }\n }\n this.y += 8;\n }\n\n /** Proporcional ao conteúdo, com um mínimo por coluna, para coluna curta não roubar nem sobrar demais. */\n private columnWidths(rows: readonly (readonly Run[][])[], columns: number): number[] {\n const natural = Array.from({ length: columns }, (_, column) => Math.max(\n 24,\n ...rows.map((row) => (row[column] ?? []).reduce((sum, run) => sum + textWidth(run.text, run.font, TABLE_SIZE), 0) + 2 * TABLE_PADDING),\n ));\n const total = natural.reduce((sum, width) => sum + width, 0);\n if (total <= CONTENT_WIDTH) {\n const spare = (CONTENT_WIDTH - total) / columns;\n return natural.map((width) => width + spare);\n }\n const floor = Math.min(36, CONTENT_WIDTH / columns);\n const capped = natural.map((width) => Math.max(floor, (width / total) * CONTENT_WIDTH));\n const scale = CONTENT_WIDTH / capped.reduce((sum, width) => sum + width, 0);\n return capped.map((width) => width * scale);\n }\n\n serialize(title: string, pageLabel: string): Uint8Array {\n const total = this.pages.length;\n this.pages.forEach((content, index) => {\n const text = printable(`${pageLabel} ${index + 1} / ${total}`);\n const x = PAGE_WIDTH - MARGIN - textWidth(text, 'F1', 8);\n content.push(`BT /F1 8 Tf ${MUTED} g 1 0 0 1 ${x.toFixed(2)} 28.00 Tm (${escapePdfText(text)}) Tj ET`);\n });\n\n // 1 catálogo, 2 árvore, 3 a 5 fontes, 6 metadados; depois, página e conteúdo de cada uma.\n const firstPage = 7;\n const objects: string[] = [\n '<< /Type /Catalog /Pages 2 0 R >>',\n `<< /Type /Pages /Count ${total} /Kids [${this.pages.map((_, index) => `${firstPage + index * 2} 0 R`).join(' ')}] >>`,\n '<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica /Encoding /WinAnsiEncoding >>',\n '<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding >>',\n '<< /Type /Font /Subtype /Type1 /BaseFont /Courier /Encoding /WinAnsiEncoding >>',\n `<< /Title (${escapePdfText(printable(title))}) >>`,\n ];\n this.pages.forEach((content, index) => {\n const stream = content.join('\\n');\n objects.push(\n `<< /Type /Page /Parent 2 0 R /MediaBox [0 0 ${PAGE_WIDTH} ${PAGE_HEIGHT}] /Resources << /Font << /F1 3 0 R /F2 4 0 R /F3 5 0 R >> >> /Contents ${firstPage + index * 2 + 1} 0 R >>`,\n `<< /Length ${stream.length} >>\\nstream\\n${stream}\\nendstream`,\n );\n });\n\n // O texto já saiu escapado: o arquivo é todo ASCII, então a posição em caracteres é a posição em bytes.\n let body = '%PDF-1.4\\n';\n const offsets: number[] = [];\n objects.forEach((object, index) => {\n offsets.push(body.length);\n body += `${index + 1} 0 obj\\n${object}\\nendobj\\n`;\n });\n const xref = body.length;\n const count = objects.length + 1;\n body += `xref\\n0 ${count}\\n0000000000 65535 f \\n${offsets.map((offset) => `${String(offset).padStart(10, '0')} 00000 n \\n`).join('')}`;\n body += `trailer\\n<< /Size ${count} /Root 1 0 R /Info 6 0 R >>\\nstartxref\\n${xref}\\n%%EOF\\n`;\n return new TextEncoder().encode(body);\n }\n}\n\nexport function buildTranscriptPdf(transcript: SpineTranscript): Uint8Array {\n const parser = new Marked({ gfm: true, breaks: false });\n const pdf = new PdfDocument();\n\n pdf.paragraph([{ text: printable(transcript.title), font: 'F2' }], MARGIN, { size: 16, leading: 22 });\n pdf.paragraph([{ text: printable(transcript.subtitle), font: 'F1' }], MARGIN, { size: 9, leading: 13, gray: MUTED });\n pdf.y += 6;\n pdf.rule(MARGIN, pdf.y, PAGE_WIDTH - MARGIN, pdf.y);\n pdf.y += 10;\n\n for (const entry of transcript.entries) {\n const label = entry.role === 'person' ? transcript.personLabel : transcript.agentLabel;\n // O rótulo não fica sozinho no pé da página.\n pdf.reserve(BODY_LEADING * 3);\n pdf.paragraph([{ text: printable(label), font: 'F2' }], MARGIN, { size: 9, leading: 13, gray: MUTED });\n if (entry.role === 'person') {\n // A pergunta é o que a pessoa escreveu, sem interpretar como Markdown.\n pdf.paragraph([{ text: entry.text.split(/\\r?\\n/).map(printable).join('\\n'), font: 'F1' }], MARGIN, { shade: true });\n pdf.y += 8;\n } else {\n if (entry.error) pdf.paragraph([{ text: printable(entry.text), font: 'F1' }], MARGIN, { gray: MUTED });\n else pdf.blocks(parser.lexer(entry.text), MARGIN);\n if (entry.steps.length) {\n pdf.y += 2;\n pdf.reserve(13 * 2);\n pdf.paragraph([{ text: printable(transcript.queriesLabel), font: 'F2' }], MARGIN, { size: 8.5, leading: 12, gray: MUTED });\n for (const step of entry.steps) {\n const failed = step.failed ? ` (${transcript.failedLabel})` : '';\n const detail = step.detail ? `: ${step.detail}` : '';\n pdf.paragraph([{ text: printable(`• ${step.title}${failed}${detail}`), font: 'F1' }], MARGIN, { size: 8.5, leading: 12, gray: MUTED });\n }\n }\n pdf.y += 12;\n }\n }\n return pdf.serialize(transcript.title, transcript.pageLabel);\n}\n\n/** `dudu-conversa-2026-11-05.pdf`: sem acento nem espaço, para qualquer sistema aceitar. */\nexport function transcriptFileName(title: string, word: string, now: Date): string {\n const slug = (value: string) => value.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');\n const day = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}-${String(now.getDate()).padStart(2, '0')}`;\n return `${[slug(title), slug(word)].filter(Boolean).join('-')}-${day}.pdf`;\n}\n"],"names":[],"mappings":";;AAyCA,MAAM,UAAU,GAAG,GAAG;AACtB,MAAM,WAAW,GAAG,GAAG;AACvB,MAAM,MAAM,GAAG,EAAE;AACjB,MAAM,aAAa,GAAG,UAAU,GAAG,CAAC,GAAG,MAAM;AAC7C,MAAM,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,EAAE;AACxC,MAAM,SAAS,GAAG,EAAE;AACpB,MAAM,YAAY,GAAG,EAAE;AACvB,MAAM,UAAU,GAAG,GAAG;AACtB,MAAM,aAAa,GAAG,EAAE;AACxB,MAAM,aAAa,GAAG,CAAC;AACvB,MAAM,GAAG,GAAG,IAAI;AAChB,MAAM,KAAK,GAAG,IAAI;AAClB,MAAM,IAAI,GAAG,GAAG;AAChB,MAAM,KAAK,GAAG,IAAI;AAElB;AACA,MAAM,OAAO,GAAG;IACd,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;IACtH,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE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AAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gBACxI;YACF;AACA,YAAA,GAAG,CAAC,CAAC,IAAI,EAAE;QACb;IACF;AACA,IAAA,OAAO,GAAG,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC;AAC9D;AAEA;SACgB,kBAAkB,CAAC,KAAa,EAAE,IAAY,EAAE,GAAS,EAAA;AACvE,IAAA,MAAM,IAAI,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;AAC5I,IAAA,MAAM,GAAG,GAAG,CAAA,EAAG,GAAG,CAAC,WAAW,EAAE,CAAA,CAAA,EAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA,CAAA,EAAI,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;IAC3H,OAAO,CAAA,EAAG,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,CAAA,EAAI,GAAG,CAAA,IAAA,CAAM;AAC5E;;"}
@@ -2,10 +2,24 @@ import * as i0 from '@angular/core';
2
2
  import { inject, viewChild, computed, signal, effect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
3
3
  import { Router } from '@angular/router';
4
4
  import { ViewService } from '@orfeu/angular/core';
5
- import { HermesToastService, AccountAvatarComponent, AlertComponent, ButtonComponent, DrawerComponent, EmptyComponent, FilterBarComponent, IconComponent, MenuButtonComponent, PaginatorComponent, RichTextComponent, SearchFieldComponent, SegmentedControlComponent, TabComponent, TabsComponent, TagComponent } from '@trismegisto/angular';
6
- import { pluralMessage, formatMessage } from '@trismegisto/primitives';
5
+ import { AccountAvatarComponent } from '@trismegisto/angular/account-avatar';
6
+ import { AlertComponent } from '@trismegisto/angular/alert';
7
+ import { ButtonComponent } from '@trismegisto/angular/button';
8
+ import { DrawerComponent } from '@trismegisto/angular/drawer';
9
+ import { EmptyComponent } from '@trismegisto/angular/empty';
10
+ import { FilterBarComponent } from '@trismegisto/angular/filter-bar';
11
+ import { IconComponent } from '@trismegisto/angular/icon';
12
+ import { MenuButtonComponent } from '@trismegisto/angular/menu-button';
13
+ import { PaginatorComponent } from '@trismegisto/angular/paginator';
14
+ import { RichTextComponent } from '@trismegisto/angular/rich-text';
15
+ import { SearchFieldComponent } from '@trismegisto/angular/search-field';
16
+ import { SegmentedControlComponent } from '@trismegisto/angular/segmented-control';
17
+ import { TabComponent, TabsComponent } from '@trismegisto/angular/tabs';
18
+ import { TagComponent } from '@trismegisto/angular/tag';
19
+ import { HermesToastService } from '@trismegisto/angular/toast';
20
+ import { pluralMessage, formatMessage } from '@trismegisto/primitives/i18n';
7
21
  import { SPINE_MESSAGES, SpinePreferencesService, SpineUserStorage, spineRoutesOf } from '@trismegisto/spine';
8
- import { S as SpineSuggestionsService, a as SpineInboxService, b as SpineSuggestionChatComponent, c as SPINE_SUGGESTION_STATUS_COLORS, d as SPINE_SUGGESTION_KIND_COLORS, e as SPINE_SUGGESTION_KIND_ICONS, f as SPINE_SUGGESTION_WAITING_COLORS, N as NEW_SCREEN_VALUE, g as SPINE_SUGGESTION_VISIBLE_SORTS, s as suggestionScreens, h as SPINE_SUGGESTION_REASONS, i as SPINE_SUGGESTION_STATUSES, j as SPINE_SUGGESTION_KINDS, k as SPINE_SUGGESTION_WAITING, l as SPINE_TAB, m as SPINE_SUGGESTION_PAGE_PARAM, n as SPINE_SUGGESTION_TAB_PARAM, o as SPINE_SUGGESTION_TAB_CONVERSATION, p as screenName, q as screenModule, r as SPINE_SUGGESTIONS_PAGE_PATH, t as SpineSuggestionsDialogComponent, u as SpineTagRowComponent } from './trismegisto-spine-layout-trismegisto-spine-layout-DiAfxIGP.mjs';
22
+ import { S as SpineSuggestionsService, a as SpineInboxService, b as SpineSuggestionChatComponent, c as SPINE_SUGGESTION_STATUS_COLORS, d as SPINE_SUGGESTION_KIND_COLORS, e as SPINE_SUGGESTION_KIND_ICONS, f as SPINE_SUGGESTION_WAITING_COLORS, N as NEW_SCREEN_VALUE, g as SPINE_SUGGESTION_VISIBLE_SORTS, s as suggestionScreens, h as SPINE_SUGGESTION_REASONS, i as SPINE_SUGGESTION_STATUSES, j as SPINE_SUGGESTION_KINDS, k as SPINE_SUGGESTION_WAITING, l as SPINE_TAB, m as SPINE_SUGGESTION_PAGE_PARAM, n as SPINE_SUGGESTION_TAB_PARAM, o as SPINE_SUGGESTION_TAB_CONVERSATION, p as screenName, q as screenModule, r as SPINE_SUGGESTIONS_PAGE_PATH, t as SpineSuggestionsDialogComponent, u as SpineTagRowComponent } from './trismegisto-spine-layout-trismegisto-spine-layout-D3vetDC_.mjs';
9
23
 
10
24
  const PAGE = 20;
11
25
  /** O recorte "Precisam da sua resposta" no seletor (não é um motivo: é a vez de quem pede). */
@@ -529,4 +543,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.24", ngImpo
529
543
  }], ctorParameters: () => [], propDecorators: { chat: [{ type: i0.ViewChild, args: [i0.forwardRef(() => SpineSuggestionChatComponent), { isSignal: true }] }] } });
530
544
 
531
545
  export { SpineSuggestionsPageComponent };
532
- //# sourceMappingURL=trismegisto-spine-layout-suggestions-page.component-CEKMqera.mjs.map
546
+ //# sourceMappingURL=trismegisto-spine-layout-suggestions-page.component-BEGFNlvw.mjs.map