@runtypelabs/persona 4.30.0 → 4.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/README.md +22 -1
  2. package/dist/activity-ui.d.cts +3 -3
  3. package/dist/activity-ui.d.ts +3 -3
  4. package/dist/animations/glyph-cycle.d.cts +1 -1
  5. package/dist/animations/glyph-cycle.d.ts +1 -1
  6. package/dist/animations/wipe.d.cts +1 -1
  7. package/dist/animations/wipe.d.ts +1 -1
  8. package/dist/approval-ui.d.cts +2 -2
  9. package/dist/approval-ui.d.ts +2 -2
  10. package/dist/artifacts-ui.d.cts +3 -3
  11. package/dist/artifacts-ui.d.ts +3 -3
  12. package/dist/background-runtime.d.cts +1 -1
  13. package/dist/background-runtime.d.ts +1 -1
  14. package/dist/{chunk-gayfbmEU.js → chunk-BBtVdcKU.js} +1 -1
  15. package/dist/chunk-C2IbR39s.js +1 -0
  16. package/dist/chunk-CjhA_5Jk.js +1 -0
  17. package/dist/{chunk-n96BB0YH.js → chunk-Co4LmTFv.js} +1 -1
  18. package/dist/chunk-DABqu7C3.js +2 -0
  19. package/dist/chunk-DbD5qyBw.js +3 -0
  20. package/dist/{chunk-UyZbbbz3.js → chunk-MdlQetfC.js} +2 -2
  21. package/dist/{chunk-CqEWCkJt.js → chunk-WA9UucGf.js} +1 -1
  22. package/dist/client-dispatch.js +1 -1
  23. package/dist/client-history.js +1 -1
  24. package/dist/codegen.cjs +1 -1
  25. package/dist/codegen.js +1 -1
  26. package/dist/composer-actions-runtime.d.cts +2 -2
  27. package/dist/composer-actions-runtime.d.ts +2 -2
  28. package/dist/{composer-input-C76gfIoK.d.cts → composer-input-C2_WizXV.d.cts} +1 -1
  29. package/dist/{composer-input-C76gfIoK.d.ts → composer-input-C2_WizXV.d.ts} +1 -1
  30. package/dist/{composer-store-C7tvaz90.d.cts → composer-store-BV6kTlKv.d.cts} +1 -1
  31. package/dist/{composer-store-C7tvaz90.d.ts → composer-store-BV6kTlKv.d.ts} +1 -1
  32. package/dist/{context-mention-manager-IfT4JHma.d.cts → context-mention-manager-BfZzcydV.d.cts} +2 -2
  33. package/dist/{context-mention-manager-IfT4JHma.d.ts → context-mention-manager-BfZzcydV.d.ts} +2 -2
  34. package/dist/context-mentions-inline.d.cts +2 -2
  35. package/dist/context-mentions-inline.d.ts +2 -2
  36. package/dist/context-mentions.d.cts +3 -3
  37. package/dist/context-mentions.d.ts +3 -3
  38. package/dist/{defaults-Cc_p0PGM.d.cts → defaults-DiTeXyr3.d.cts} +1 -1
  39. package/dist/{defaults-Cc_p0PGM.d.ts → defaults-DiTeXyr3.d.ts} +1 -1
  40. package/dist/dictation-runtime.d.cts +2 -2
  41. package/dist/dictation-runtime.d.ts +2 -2
  42. package/dist/event-stream-view.d.cts +1 -1
  43. package/dist/event-stream-view.d.ts +1 -1
  44. package/dist/{fallback-speech-engine-CSxWpG0A.d.cts → fallback-speech-engine-DZ6Of7VU.d.cts} +1 -1
  45. package/dist/{fallback-speech-engine-CSxWpG0A.d.ts → fallback-speech-engine-DZ6Of7VU.d.ts} +1 -1
  46. package/dist/{feature-preferences-eeSOmDxg.d.cts → feature-preferences-BT549D_E.d.cts} +1 -1
  47. package/dist/{feature-preferences-eeSOmDxg.d.ts → feature-preferences-BT549D_E.d.ts} +1 -1
  48. package/dist/forms-ui.d.cts +2 -2
  49. package/dist/forms-ui.d.ts +2 -2
  50. package/dist/{history-confirm-dialog-DXkuAgh-.d.cts → history-confirm-dialog-Cm4oK4am.d.cts} +1 -1
  51. package/dist/{history-confirm-dialog-DXkuAgh-.d.ts → history-confirm-dialog-Cm4oK4am.d.ts} +1 -1
  52. package/dist/history-shell.d.cts +6 -6
  53. package/dist/history-shell.d.ts +6 -6
  54. package/dist/history-view.d.cts +1 -1
  55. package/dist/history-view.d.ts +1 -1
  56. package/dist/index.cjs +48 -47
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.cts +9 -9
  59. package/dist/index.d.ts +9 -9
  60. package/dist/index.global.js +1 -1
  61. package/dist/index.global.js.map +1 -1
  62. package/dist/index.js +42 -41
  63. package/dist/index.js.map +1 -1
  64. package/dist/{loading-label-runtime-loader-C53YyPJ-.d.cts → loading-label-runtime-loader-DmiPDkBu.d.cts} +1 -1
  65. package/dist/{loading-label-runtime-loader-C53YyPJ-.d.ts → loading-label-runtime-loader-DmiPDkBu.d.ts} +1 -1
  66. package/dist/loading-label-runtime.d.cts +1 -1
  67. package/dist/loading-label-runtime.d.ts +1 -1
  68. package/dist/markdown-parsers.js +18 -15
  69. package/dist/{message-bubble-Cg_sTXUN.d.cts → message-bubble-D0rosKuK.d.cts} +1 -1
  70. package/dist/{message-bubble-Cg_sTXUN.d.ts → message-bubble-D0rosKuK.d.ts} +1 -1
  71. package/dist/preferences-runtime.d.cts +1 -1
  72. package/dist/preferences-runtime.d.ts +1 -1
  73. package/dist/{preview-BeMKALry.d.cts → preview-DRU27q-X.d.cts} +2 -2
  74. package/dist/{preview-BeMKALry.d.ts → preview-DRU27q-X.d.ts} +2 -2
  75. package/dist/{registry-BBe-Lesw.d.ts → registry-DRk3VMFc.d.cts} +3 -1
  76. package/dist/{registry-BBe-Lesw.d.cts → registry-DRk3VMFc.d.ts} +3 -1
  77. package/dist/{session-C0fSteA4.d.cts → session-Dj4bOm5y.d.cts} +18 -9
  78. package/dist/{session-C0fSteA4.d.ts → session-Dj4bOm5y.d.ts} +18 -9
  79. package/dist/session-reconnect.d.cts +2 -2
  80. package/dist/session-reconnect.d.ts +2 -2
  81. package/dist/smart-dom-reader.d.cts +1 -1
  82. package/dist/smart-dom-reader.d.ts +1 -1
  83. package/dist/theme-editor-preview.cjs +46 -45
  84. package/dist/theme-editor-preview.d.cts +1 -1
  85. package/dist/theme-editor-preview.d.ts +1 -1
  86. package/dist/theme-editor-preview.js +17 -19
  87. package/dist/theme-editor.d.cts +2 -2
  88. package/dist/theme-editor.d.ts +2 -2
  89. package/dist/theme-reference.d.cts +2 -2
  90. package/dist/theme-reference.d.ts +2 -2
  91. package/dist/{tool-loading-animation-BvdaZfwh.d.cts → tool-loading-animation-D1MS5Ace.d.cts} +1 -1
  92. package/dist/{tool-loading-animation-BvdaZfwh.d.ts → tool-loading-animation-D1MS5Ace.d.ts} +1 -1
  93. package/dist/{turn-activity-ui-BYBlInZQ.d.cts → turn-activity-ui-CorwdlI0.d.cts} +2 -2
  94. package/dist/{turn-activity-ui-BYBlInZQ.d.ts → turn-activity-ui-CorwdlI0.d.ts} +2 -2
  95. package/dist/turn-activity-ui.d.cts +1 -1
  96. package/dist/turn-activity-ui.d.ts +1 -1
  97. package/dist/{types-CiXi4ICM.d.cts → types-CSXHl5cN.d.cts} +5 -0
  98. package/dist/{types-CiXi4ICM.d.ts → types-CSXHl5cN.d.ts} +5 -0
  99. package/dist/voice-client-tools.d.cts +1 -1
  100. package/dist/voice-client-tools.d.ts +1 -1
  101. package/dist/voice-runtime.cjs +1 -1
  102. package/dist/voice-runtime.d.cts +2 -2
  103. package/dist/voice-runtime.d.ts +2 -2
  104. package/dist/voice-runtime.js +1 -1
  105. package/dist/voice-worklet-player.d.cts +2 -2
  106. package/dist/voice-worklet-player.d.ts +2 -2
  107. package/dist/{webmcp-runtime-entry-BTbOg3Au.d.cts → webmcp-runtime-entry-DpDN6k-6.d.cts} +1 -1
  108. package/dist/{webmcp-runtime-entry-BTbOg3Au.d.ts → webmcp-runtime-entry-DpDN6k-6.d.ts} +1 -1
  109. package/dist/webmcp-runtime.d.cts +1 -1
  110. package/dist/webmcp-runtime.d.ts +1 -1
  111. package/package.json +2 -2
  112. package/src/index-core.ts +1 -0
  113. package/src/markdown-parsers-eager.ts +2 -1
  114. package/src/markdown-parsers-entry.ts +1 -0
  115. package/src/markdown-parsers-loader.ts +2 -0
  116. package/src/postprocessors.ts +14 -0
  117. package/src/session.ts +3 -0
  118. package/src/types.ts +5 -0
  119. package/src/ui.background-conversations.test.ts +6 -0
  120. package/src/ui.page-cache.test.ts +268 -0
  121. package/src/ui.postprocess.test.ts +80 -1
  122. package/src/ui.ts +95 -27
  123. package/src/utils/actions.ts +3 -0
  124. package/src/utils/streaming-markdown.test.ts +103 -0
  125. package/src/utils/streaming-markdown.ts +186 -0
  126. package/dist/chunk-18tPmsiJ.js +0 -1
  127. package/dist/chunk-Dp2vWE9V.js +0 -1
  128. package/dist/chunk-VloQ2dnh.js +0 -1
@@ -0,0 +1,103 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { stabilizeStreamingMarkdown as stabilize } from "./streaming-markdown";
3
+ import { createMarkdownProcessor } from "../postprocessors";
4
+
5
+ const markdown = createMarkdownProcessor();
6
+
7
+ describe("streaming Markdown display", () => {
8
+ it.each(["**bold**", "*italic*", "_italic_", "__bold__", "***both***", "**bold *italic***", "*italic **bold***", "`a*b`", "``a`b``"])("renders every nonempty content prefix of %s without raw delimiters", (source) => {
9
+ for (let length = 1; length <= source.length; length++) {
10
+ const html = markdown(stabilize(`Start ${source.slice(0, length)}`));
11
+ const text = html.replace(/<[^>]*>/g, "");
12
+ if (!source.includes("`")) expect(text).not.toMatch(/[*_]/);
13
+ }
14
+ expect(markdown(stabilize(source))).toBe(markdown(source));
15
+ });
16
+
17
+ it("stabilizes every character boundary across multiple completed and new spans", () => {
18
+ const source = "Watch **bold**, *italic*, and `inline code`. Try **nested *emphasis*** and _more_ with __bold__ afterward.";
19
+ for (let length = 1; length <= source.length; length++) {
20
+ const html = markdown(stabilize(source.slice(0, length)));
21
+ expect(html.replace(/<[^>]*>/g, "")).not.toMatch(/[*_`]/);
22
+ }
23
+ expect(markdown(stabilize(source))).toBe(markdown(source));
24
+ });
25
+
26
+ it.each([
27
+ "* list item", "_ literal _", "foo_bar_baz", "2 * 3", "2*3", "foo*bar", "<https://example.com/a_b>", '<span data-label="**hello">text</span>', "***", "*", "\\*literal", "\\`literal", "\\[literal", "[ordinary] prose",
28
+ "[x](https://example.com/it's)", "[x](https://example.com/a_(b))", '[x](https://example.com "a title")', "![x](image.png)",
29
+ "```md\n**literal\n| a | b |\n| -\n```", "> ```\n*literal\n> ```", "- ```\n**literal\n ```", " **literal"
30
+ ])("preserves completed or ambiguous input %j", (source) => {
31
+ expect(stabilize(source)).toBe(source);
32
+ });
33
+
34
+ it("shows incomplete link labels as text and only activates complete destinations", () => {
35
+ const source = "[read more](https://example.com/a_(b))";
36
+ for (let length = 1; length < source.length; length++) {
37
+ const html = markdown(stabilize(source.slice(0, length)));
38
+ expect(html).not.toContain("<a ");
39
+ expect(html.replace(/<[^>]*>/g, "")).not.toMatch(/[[\]()]/);
40
+ }
41
+ expect(markdown(stabilize(source))).toContain('<a href="https://example.com/a_(b)">read more</a>');
42
+ });
43
+
44
+ it.each([
45
+ "Use `[` here", "Use `]` here", "Use ``[`]`` here", "Use ``]`[`` here",
46
+ "Use `]``[` here", "Use \\[ and \\] here",
47
+ ])("keeps code brackets inert while streaming link label %s", (label) => {
48
+ const source = `[${label}](https://example.com)`;
49
+ for (let length = 1; length < source.length; length++) {
50
+ const html = markdown(stabilize(source.slice(0, length)));
51
+ expect(html).not.toContain("<a ");
52
+ expect(html).not.toContain("https:");
53
+ }
54
+ expect(stabilize(source)).toBe(source);
55
+ expect(markdown(stabilize(source))).toBe(markdown(source));
56
+ expect(markdown(stabilize(source))).toContain('<a href="https://example.com">');
57
+ const image = `![${label}](image.png)`;
58
+ for (let length = 2; length < image.length; length++) {
59
+ const display = stabilize(image.slice(0, length));
60
+ expect(markdown(display)).not.toContain("<img ");
61
+ if (length >= label.length + 2) expect(display).toBe("");
62
+ }
63
+ expect(stabilize(image)).toBe(image);
64
+ });
65
+
66
+ it.each(["Use ` here", "Use `` here", "Use `` unmatched ` here", "Use ``[nested] ` here", "Use ` [nested] `` here"])("treats unmatched code runs as literal link label text: %s", (label) => {
67
+ const source = `[${label}](https://example.com)`;
68
+ expect(stabilize(source)).toBe(source);
69
+ expect(markdown(stabilize(source))).toBe(markdown(source));
70
+ expect(markdown(stabilize(source))).toContain('<a href="https://example.com">');
71
+ expect(stabilize(`[${label}](https://example`)).not.toContain("https:");
72
+ });
73
+
74
+ it("holds incomplete images, including escaped brackets and nested URL parentheses", () => {
75
+ const source = "![an \\] image](https://example.com/a_(b).png)";
76
+ for (let length = 2; length < source.length; length++) {
77
+ expect(stabilize(`Before ${source.slice(0, length)}`)).toBe("Before ");
78
+ }
79
+ expect(stabilize(source)).toBe(source);
80
+ expect(stabilize("Before ![image](url\\")).toBe("Before ");
81
+ expect(stabilize("Before [link](url\\")).toBe("Before link");
82
+ });
83
+
84
+ it("stabilizes formatting inside unfinished link labels", () => {
85
+ expect(markdown(stabilize("[**hello"))).toContain("<strong>hello</strong>");
86
+ expect(markdown(stabilize("[**hello**](https://example"))).toContain("<strong>hello</strong>");
87
+ });
88
+
89
+ it("keeps inline code contents and escapes inert", () => {
90
+ expect(markdown(stabilize("Here `**[x](url)"))).toContain("<code>**[x](url)</code>");
91
+ expect(stabilize("\\\\**bold")).toBe("\\\\**bold**");
92
+ expect(markdown(stabilize("**hello\\"))).toContain("<strong>hello\\</strong>");
93
+ });
94
+
95
+ it("preserves whitespace outside a temporarily completed emphasis span", () => {
96
+ expect(stabilize("**hello ")).toBe("**hello** ");
97
+ expect(stabilize("**hello\n\nNext")).toBe("**hello**\n\nNext");
98
+ });
99
+
100
+ it("continues table completion outside code fences", () => {
101
+ expect(markdown(stabilize("| A | B |\n| -"))).toContain("<table>");
102
+ });
103
+ });
@@ -0,0 +1,186 @@
1
+ import { stabilizeStreamingTables } from "./streaming-table";
2
+
3
+ const whitespace = (char: string): boolean => !char || /\s/.test(char);
4
+ const punctuation = (char: string): boolean => !!char && /[\p{P}\p{S}]/u.test(char);
5
+
6
+ // Code delimiters close only on a backtick run of exactly the same length.
7
+ const codeSpanEnd = (source: string, start: number, end: number): number => {
8
+ const marker = source.slice(start, end);
9
+ let closing = end;
10
+ while ((closing = source.indexOf(marker, closing)) !== -1) {
11
+ if (source[closing - 1] !== "`" && source[closing + marker.length] !== "`") return closing + marker.length;
12
+ closing += marker.length;
13
+ }
14
+ return -1;
15
+ };
16
+
17
+ /** Display-only completion for the ordinary inline syntax arriving at the stream tail.
18
+ * This is deliberately not a Markdown parser: ambiguous literals and block syntax
19
+ * remain Marked's responsibility. Never persist this result or use it at completion.
20
+ */
21
+ const stabilizeInline = (source: string, links = true): string => {
22
+ const pending: { marker: string }[] = [];
23
+ const literalMarkers = new Set<string>();
24
+ let output = "";
25
+ for (let i = 0; i < source.length;) {
26
+ const char = source[i];
27
+ if (char === "\\") {
28
+ output += source.slice(i, i + 2);
29
+ i += 2;
30
+ continue;
31
+ }
32
+ if (char === "`") {
33
+ let end = i + 1;
34
+ while (source[end] === "`") end++;
35
+ const marker = source.slice(i, end);
36
+ const closing = codeSpanEnd(source, i, end);
37
+ if (closing !== -1) {
38
+ output += source.slice(i, closing);
39
+ i = closing;
40
+ } else {
41
+ const body = source.slice(end);
42
+ // An empty run could still become a fence or literal. Hold it briefly.
43
+ output += body ? `${marker}${body}${body.endsWith("`") ? " " : ""}${marker}` : "";
44
+ i = source.length;
45
+ }
46
+ continue;
47
+ }
48
+ if (char === "<") {
49
+ const end = source.indexOf(">", i + 1);
50
+ output += source.slice(i, end < 0 ? source.length : end + 1);
51
+ i = end < 0 ? source.length : end + 1;
52
+ continue;
53
+ }
54
+ if (links && (char === "[" || (char === "!" && source[i + 1] === "["))) {
55
+ const image = char === "!";
56
+ const start = i + (image ? 2 : 1);
57
+ let depth = 1;
58
+ let end = start;
59
+ for (; end < source.length; end++) {
60
+ if (source[end] === "\\") { end++; continue; }
61
+ if (source[end] === "`") {
62
+ let runEnd = end + 1;
63
+ while (source[runEnd] === "`") runEnd++;
64
+ const closing = codeSpanEnd(source, end, runEnd);
65
+ // Unmatched runs are literal Markdown, so their brackets still count.
66
+ end = (closing < 0 ? runEnd : closing) - 1;
67
+ continue;
68
+ }
69
+ if (source[end] === "[") depth++;
70
+ if (source[end] === "]" && --depth === 0) break;
71
+ }
72
+ if (end >= source.length) {
73
+ output += image ? "" : stabilizeInline(source.slice(start), false);
74
+ break;
75
+ }
76
+ if (source[end + 1] === "(") {
77
+ let parentheses = 1;
78
+ let quote = "";
79
+ let angle = false;
80
+ let destination = end + 2;
81
+ for (; destination < source.length; destination++) {
82
+ const next = source[destination];
83
+ if (next === "\\") { destination++; continue; }
84
+ if (quote) { if (next === quote) quote = ""; continue; }
85
+ if ((next === '"' || next === "'") && whitespace(source[destination - 1])) { quote = next; continue; }
86
+ if (next === "<") angle = true;
87
+ if (next === ">") angle = false;
88
+ if (!angle && next === "(") parentheses++;
89
+ if (!angle && next === ")" && --parentheses === 0) break;
90
+ }
91
+ if (destination >= source.length) {
92
+ output += image ? "" : stabilizeInline(source.slice(start, end), false);
93
+ break;
94
+ }
95
+ output += source.slice(i, destination + 1);
96
+ i = destination + 1;
97
+ continue;
98
+ }
99
+ if (end === source.length - 1) {
100
+ output += image ? "" : stabilizeInline(source.slice(start, end), false);
101
+ break;
102
+ }
103
+ // Reference links and ordinary bracketed prose are left to Marked.
104
+ output += source.slice(i, end + 1);
105
+ i = end + 1;
106
+ continue;
107
+ }
108
+ if (char === "*" || char === "_") {
109
+ let end = i + 1;
110
+ while (source[end] === char) end++;
111
+ const marker = source.slice(i, end);
112
+ const before = source[i - 1] ?? "";
113
+ const after = source[end] ?? "";
114
+ const left = !whitespace(after) && (!punctuation(after) || whitespace(before) || punctuation(before));
115
+ const right = !whitespace(before) && (!punctuation(before) || whitespace(after) || punctuation(after));
116
+ let remaining = marker.length;
117
+ if (right && (char !== "_" || !left || punctuation(after))) {
118
+ while (remaining && pending[pending.length - 1]?.marker[0] === char) {
119
+ const top = pending[pending.length - 1];
120
+ const consumed = Math.min(remaining, top.marker.length);
121
+ remaining -= consumed;
122
+ top.marker = top.marker.slice(consumed);
123
+ if (!top.marker) pending.pop();
124
+ }
125
+ }
126
+ if (remaining && marker.length <= 3 && left && !right) {
127
+ pending.push({ marker: char.repeat(remaining) });
128
+ } else if (remaining === marker.length && end === source.length && whitespace(before)
129
+ && source.slice(source.lastIndexOf("\n", i) + 1, i).trim()
130
+ && (pending.length > 0 || !literalMarkers.has(char))) {
131
+ // Hold an opening run after prose, but preserve ambiguous list/rule lines.
132
+ i = end;
133
+ continue;
134
+ }
135
+ // Whitespace on both sides makes this punctuation literal, as in
136
+ // `_ literal _`. Completed emphasis earlier in the paragraph does not
137
+ // make a later opening run literal.
138
+ if (whitespace(before) && whitespace(after) && end < source.length) literalMarkers.add(char);
139
+ output += marker;
140
+ i = end;
141
+ continue;
142
+ }
143
+ output += char;
144
+ i++;
145
+ }
146
+ // Trailing whitespace cannot precede a Markdown closing delimiter. Keep the
147
+ // whitespace outside the temporary span, preserving it for the next chunk.
148
+ const trailing = output.match(/\s*$/)?.[0] ?? "";
149
+ output = output.slice(0, output.length - trailing.length);
150
+ // A final escape must not swallow the first synthetic closing delimiter.
151
+ if (pending.length && (output.match(/\\+$/)?.[0].length ?? 0) % 2) output += "\\";
152
+ for (let i = pending.length - 1; i >= 0; i--) output += pending[i].marker;
153
+ return output + trailing;
154
+ };
155
+
156
+ export const stabilizeStreamingMarkdown = (source: string): string => {
157
+ let output = "";
158
+ let prose = "";
159
+ let fence = "";
160
+ const flush = (): void => {
161
+ // Restrict inline repairs to the current paragraph, so literal unmatched
162
+ // punctuation earlier in the response cannot style subsequent blocks.
163
+ output += stabilizeStreamingTables(prose).split(/(\n\s*\n)/).map((part) =>
164
+ /^\n\s*\n$/.test(part) ? part : stabilizeInline(part)
165
+ ).join("");
166
+ prose = "";
167
+ };
168
+ for (const line of source.match(/[^\n]*\n|[^\n]+$/g) ?? []) {
169
+ const match = /^(?: {0,3}> ?)* {0,3}(?:[-+*] )?(`{3,}|~{3,})(.*)/.exec(line);
170
+ if (fence) {
171
+ output += line;
172
+ if (match && match[1][0] === fence[0] && match[1].length >= fence.length && !match[2].trim()) fence = "";
173
+ } else if (match) {
174
+ flush();
175
+ fence = match[1];
176
+ output += line;
177
+ } else if (/^(?: {4}|\t)/.test(line)) {
178
+ flush();
179
+ output += line;
180
+ } else {
181
+ prose += line;
182
+ }
183
+ }
184
+ flush();
185
+ return output;
186
+ };
@@ -1 +0,0 @@
1
- const e=`4.30.0`;export{e as t};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-CHAwCqpk.js";import{r as t}from"./chunk-BnfM7-qg.js";const{setLoader:n,load:r,provide:i,getSync:a}=t({fallbackImport:()=>import(`./chunk-VloQ2dnh.js`)}),o=/* @__PURE__ */ new Set,s=()=>{let e=[...o];o.clear();for(let t of e)try{t()}catch{}},c=()=>{let e=a();return e?Promise.resolve(e):r().then(e=>(s(),e))},l=e=>a()?()=>{}:(o.add(e),()=>{o.delete(e)}),u=e=>{i(e),s()},d=a,f=new class{#e=/* @__PURE__ */ new Map;#t=/* @__PURE__ */ new Map;register(e,t,n){this.#e.has(e)&&console.warn(`[ComponentRegistry] Component "${e}" is already registered. Overwriting.`),this.#e.set(e,t),n?this.#t.set(e,n):this.#t.delete(e)}unregister(e){this.#e.delete(e),this.#t.delete(e)}get(e){return this.#e.get(e)}has(e){return this.#e.has(e)}getOptions(e){return this.#t.get(e)}getAllNames(){return Array.from(this.#e.keys())}clear(){this.#e.clear(),this.#t.clear()}registerAll(e){Object.entries(e).forEach(([e,t])=>{this.register(e,t)})}};function p(e,t){return e.components&&Object.prototype.hasOwnProperty.call(e.components,t)?e.components[t]:f.get(t)}function m(e,t){return e.components&&Object.prototype.hasOwnProperty.call(e.components,t)?void 0:f.getOptions(t)}const h=e=>{if(!e)return;let t={},n=e;if(n.heading){let e=n.heading;t.heading=(t,n,r)=>e({type:`heading`,raw:r,depth:n,text:t,tokens:[]})}if(n.code){let e=n.code;t.code=(t,n,r)=>e({type:`code`,raw:``,text:t,lang:n,escaped:r})}if(n.blockquote){let e=n.blockquote;t.blockquote=t=>e({type:`blockquote`,raw:``,text:t,tokens:[]})}if(n.table){let e=n.table;t.table=(t,n)=>e({type:`table`,raw:``,header:[],rows:[],align:[],headerHtml:t,bodyHtml:n})}if(n.link){let e=n.link;t.link=(t,n,r)=>e({type:`link`,raw:``,href:t,title:n??null,text:r,tokens:[]})}if(n.image){let e=n.image;t.image=(t,n,r)=>e({type:`image`,raw:``,href:t,title:n??null,text:r})}if(n.list){let e=n.list;t.list=(t,n,r)=>e({type:`list`,raw:``,ordered:n,start:r,loose:!1,items:[],itemsHtml:t})}if(n.listitem){let e=n.listitem;t.listitem=(t,n,r)=>e({type:`list_item`,raw:``,task:n,checked:r,loose:!1,text:t,tokens:[]})}if(n.paragraph){let e=n.paragraph;t.paragraph=t=>e({type:`paragraph`,raw:``,text:t,tokens:[]})}if(n.codespan){let e=n.codespan;t.codespan=t=>e({type:`codespan`,raw:``,text:t})}if(n.strong){let e=n.strong;t.strong=t=>e({type:`strong`,raw:``,text:t,tokens:[]})}if(n.em){let e=n.em;t.em=t=>e({type:`em`,raw:``,text:t,tokens:[]})}if(n.del){let e=n.del;t.del=t=>e({type:`del`,raw:``,text:t,tokens:[]})}if(n.html){let e=n.html;t.html=t=>e({type:`html`,raw:t,text:t})}if(n.text){let e=n.text;t.text=t=>e({type:`text`,raw:t,text:t})}if(n.checkbox){let e=n.checkbox;t.checkbox=t=>e({checked:t})}return n.hr&&(t.hr=n.hr),n.br&&(t.br=n.br),t},g=e=>{let t=null;return n=>{let r=d();if(!r)return v(n);if(!t){let{Marked:n}=r,i=e?.markedOptions;t=new n({gfm:i?.gfm??!0,breaks:i?.breaks??!0,pedantic:i?.pedantic,silent:i?.silent});let a=h(e?.renderer);a&&t.use({renderer:a})}return t.parse(n)}},_=e=>e?g({markedOptions:e.options,renderer:e.renderer}):g(),v=e=>e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`),y={ALLOWED_TAGS:/* @__PURE__ */ `h1.h2.h3.h4.h5.h6.p.br.hr.div.span.ul.ol.li.dl.dt.dd.strong.em.b.i.u.s.del.ins.mark.small.sub.sup.abbr.kbd.var.samp.code.a.img.blockquote.pre.details.summary.table.thead.tbody.tfoot.tr.th.td.caption.colgroup.col.input.label.select.option.textarea.button`.split(`.`),ALLOWED_ATTR:/* @__PURE__ */ `href.src.alt.title.target.rel.loading.width.height.colspan.rowspan.scope.class.id.type.name.value.placeholder.disabled.checked.for.aria-label.aria-hidden.aria-expanded.role.tabindex.data-tv-form.data-message-id.data-persona-component-directive.data-preserve-animation.data-persona-instance`.split(`.`)},b=/^data:image\/(?:png|jpe?g|gif|webp|bmp|x-icon|avif)/i,x=()=>{let e=null;return t=>{let n=d();if(!n)return v(t);if(!e){let{DOMPurify:t}=n;e=t(typeof window<`u`?window:void 0),e.addHook(`uponSanitizeAttribute`,(e,t)=>{if(t.attrName===`src`||t.attrName===`href`){let e=t.attrValue;e.toLowerCase().startsWith(`data:`)&&!b.test(e)&&(t.attrValue=``,t.keepAttr=!1)}})}return e.sanitize(t,y)}},S=e=>e===!1?null:typeof e==`function`?e:x();function C(t,n,r){return n?.trim()||(e(t,`artifact.${r}`)?`var(--persona-components-artifact-${r.split(`.`).join(`-`)})`:void 0)}function w(e){return e?.features?.artifacts?.enabled===!0}function T(e,t){if(e.classList.remove(`persona-artifact-border-full`,`persona-artifact-border-left`),e.style.removeProperty(`--persona-artifact-pane-border`),e.style.removeProperty(`--persona-artifact-pane-border-left`),!w(t))return;let n=t.features?.artifacts?.layout,r=C(t,n?.paneBorder,`pane.border`),i=C(t,n?.paneBorderLeft,`pane.borderLeft`);r?(e.classList.add(`persona-artifact-border-full`),e.style.setProperty(`--persona-artifact-pane-border`,r)):i&&(e.classList.add(`persona-artifact-border-left`),e.style.setProperty(`--persona-artifact-pane-border-left`,i))}function E(e){e.style.removeProperty(`--persona-artifact-doc-toolbar-icon-color`),e.style.removeProperty(`--persona-artifact-doc-toggle-active-bg`),e.style.removeProperty(`--persona-artifact-doc-toggle-active-border`),e.style.removeProperty(`--persona-artifact-doc-toggle-active-color`)}const D=[`panel`,`seamless`,`detached`];function O(e){let t=e.features?.artifacts?.layout?.paneAppearance;return t&&D.includes(t)?t:t?`panel`:e.launcher?.detachedPanel?`detached`:`panel`}function k(e){return!e||!w(e)?!1:O(e)===`detached`}function A(e,t){if(!w(t)){e.style.removeProperty(`--persona-artifact-split-gap`),e.style.removeProperty(`--persona-artifact-pane-width`),e.style.removeProperty(`--persona-artifact-pane-max-width`),e.style.removeProperty(`--persona-artifact-pane-min-width`),e.style.removeProperty(`--persona-artifact-drawer-width`),e.style.removeProperty(`--persona-artifact-pane-bg`),e.style.removeProperty(`--persona-artifact-pane-padding`),E(e),T(e,t);return}let n=t.features?.artifacts?.layout,r=O(t)===`detached`?`var(--persona-panel-inset)`:`0`;e.style.setProperty(`--persona-artifact-split-gap`,n?.splitGap??r),e.style.setProperty(`--persona-artifact-pane-width`,n?.paneWidth??`40%`),e.style.setProperty(`--persona-artifact-pane-max-width`,n?.paneMaxWidth??`28rem`),n?.drawerWidth?e.style.setProperty(`--persona-artifact-drawer-width`,n.drawerWidth):e.style.removeProperty(`--persona-artifact-drawer-width`),n?.paneMinWidth?e.style.setProperty(`--persona-artifact-pane-min-width`,n.paneMinWidth):e.style.removeProperty(`--persona-artifact-pane-min-width`);let i=C(t,n?.paneBackground,`pane.background`);i?e.style.setProperty(`--persona-artifact-pane-bg`,i):e.style.removeProperty(`--persona-artifact-pane-bg`);let a=C(t,n?.panePadding,`pane.padding`);a?e.style.setProperty(`--persona-artifact-pane-padding`,a):e.style.removeProperty(`--persona-artifact-pane-padding`);let o=[[C(t,n?.documentToolbarIconColor,`toolbar.iconColor`),`--persona-artifact-doc-toolbar-icon-color`],[C(t,n?.documentToolbarToggleActiveBackground,`toolbar.toggleActiveBackground`),`--persona-artifact-doc-toggle-active-bg`],[C(t,n?.documentToolbarToggleActiveBorderColor,`toolbar.toggleActiveBorderColor`),`--persona-artifact-doc-toggle-active-border`],[C(t,n?.documentToolbarToggleActiveColor,`toolbar.toggleActiveColor`),`--persona-artifact-doc-toggle-active-color`]];for(let[t,n]of o){let r=t?.trim();r?e.style.setProperty(n,r):e.style.removeProperty(n)}T(e,t)}function j(e,t){for(let t of D)e.classList.remove(`persona-artifact-appearance-${t}`);if(e.style.removeProperty(`--persona-artifact-pane-radius`),e.style.removeProperty(`--persona-artifact-pane-shadow`),e.style.removeProperty(`--persona-artifact-chat-shadow`),!w(t))return;let n=t.features?.artifacts?.layout,r=O(t);e.classList.add(`persona-artifact-appearance-${r}`);let i=C(t,n?.paneBorderRadius,`pane.borderRadius`);i&&e.style.setProperty(`--persona-artifact-pane-radius`,i);let a=C(t,n?.paneShadow,`pane.shadow`);a&&e.style.setProperty(`--persona-artifact-pane-shadow`,a);let o=C(t,n?.chatShadow,`chat.shadow`);o&&e.style.setProperty(`--persona-artifact-chat-shadow`,o)}function M(e,t){return!t||!w(e)?!1:e.features?.artifacts?.layout?.expandLauncherPanelWhenOpen!==!1}function N(e,t){if(!e?.trim())return t;let n=/^(\d+(?:\.\d+)?)px\s*$/i.exec(e.trim());return n?Math.max(0,Number(n[1])):t}function P(e){if(!e?.trim())return null;let t=/^(\d+(?:\.\d+)?)px\s*$/i.exec(e.trim());return t?Math.max(0,Number(t[1])):null}function F(e,t,n){return n<t?t:Math.min(n,Math.max(t,e))}function I(e,t,n,r){let i=e-r-2*t-n;return Math.max(0,i)}function L(e,t){let n=(t.getComputedStyle(e).gap||`0px`).trim().split(/\s+/)[0]??`0px`,r=/^([\d.]+)px$/i.exec(n);if(r)return Number(r[1]);let i=/^([\d.]+)/.exec(n);return i?Number(i[1]):8}function R(e,t,n,r,i,a,o=200){let s=N(i,200),c=I(t,n,r,o);c=Math.max(s,c);let l=P(a);return l!==null&&(c=Math.min(c,l)),F(e,s,c)}export{l as _,C as a,M as c,v as d,f,c as g,d as h,j as i,S as l,p as m,R as n,w as o,m as p,A as r,k as s,L as t,_ as u,u as v};
@@ -1 +0,0 @@
1
- import{Marked as e}from"marked";import t from"dompurify";export{t as DOMPurify,e as Marked};