@mp3wizard/figma-console-mcp 1.22.5 → 1.23.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.
Files changed (51) hide show
  1. package/README.md +15 -38
  2. package/dist/cloudflare/core/cloud-websocket-connector.js +19 -17
  3. package/dist/cloudflare/core/design-code-tools.js +23 -39
  4. package/dist/cloudflare/core/diff/changelog-formatter.js +275 -0
  5. package/dist/cloudflare/core/diff/diff-engine.js +334 -0
  6. package/dist/cloudflare/core/diff/property-compare.js +36 -0
  7. package/dist/cloudflare/core/diff/version-cache.js +74 -0
  8. package/dist/cloudflare/core/figma-api.js +19 -0
  9. package/dist/cloudflare/core/figma-tools.js +15 -6
  10. package/dist/cloudflare/core/version-tools.js +1014 -0
  11. package/dist/cloudflare/core/websocket-connector.js +24 -18
  12. package/dist/cloudflare/index.js +17 -13
  13. package/dist/core/design-code-tools.d.ts +1 -12
  14. package/dist/core/design-code-tools.d.ts.map +1 -1
  15. package/dist/core/design-code-tools.js +23 -39
  16. package/dist/core/design-code-tools.js.map +1 -1
  17. package/dist/core/diff/changelog-formatter.d.ts +35 -0
  18. package/dist/core/diff/changelog-formatter.d.ts.map +1 -0
  19. package/dist/core/diff/changelog-formatter.js +276 -0
  20. package/dist/core/diff/changelog-formatter.js.map +1 -0
  21. package/dist/core/diff/diff-engine.d.ts +113 -0
  22. package/dist/core/diff/diff-engine.d.ts.map +1 -0
  23. package/dist/core/diff/diff-engine.js +335 -0
  24. package/dist/core/diff/diff-engine.js.map +1 -0
  25. package/dist/core/diff/property-compare.d.ts +19 -0
  26. package/dist/core/diff/property-compare.d.ts.map +1 -0
  27. package/dist/core/diff/property-compare.js +37 -0
  28. package/dist/core/diff/property-compare.js.map +1 -0
  29. package/dist/core/diff/version-cache.d.ts +40 -0
  30. package/dist/core/diff/version-cache.d.ts.map +1 -0
  31. package/dist/core/diff/version-cache.js +75 -0
  32. package/dist/core/diff/version-cache.js.map +1 -0
  33. package/dist/core/figma-api.d.ts +29 -0
  34. package/dist/core/figma-api.d.ts.map +1 -1
  35. package/dist/core/figma-api.js +19 -0
  36. package/dist/core/figma-api.js.map +1 -1
  37. package/dist/core/figma-tools.d.ts.map +1 -1
  38. package/dist/core/figma-tools.js +15 -6
  39. package/dist/core/figma-tools.js.map +1 -1
  40. package/dist/core/version-tools.d.ts +30 -0
  41. package/dist/core/version-tools.d.ts.map +1 -0
  42. package/dist/core/version-tools.js +1015 -0
  43. package/dist/core/version-tools.js.map +1 -0
  44. package/dist/core/websocket-connector.d.ts.map +1 -1
  45. package/dist/core/websocket-connector.js +24 -18
  46. package/dist/core/websocket-connector.js.map +1 -1
  47. package/dist/local.d.ts.map +1 -1
  48. package/dist/local.js +8 -0
  49. package/dist/local.js.map +1 -1
  50. package/figma-desktop-bridge/code.js +1 -1
  51. package/package.json +108 -1
@@ -0,0 +1,276 @@
1
+ /**
2
+ * Pure-function markdown formatter for version diff results.
3
+ *
4
+ * Takes a diff payload (the structured response from figma_diff_versions)
5
+ * plus optional author/label metadata for the from/to versions, and produces
6
+ * a release-notes-style markdown string.
7
+ *
8
+ * Mode-aware:
9
+ * summary — header + a single line of counts
10
+ * standard — header + page section + per-component counts
11
+ * detailed — header + page section + per-component property/binding details
12
+ *
13
+ * Pure: no I/O, no side effects. Trivially testable.
14
+ */
15
+ export function formatChangelogMarkdown(input, mode = "standard") {
16
+ const lines = [];
17
+ // Header
18
+ const title = input.file_name ? `${input.file_name} — Change Log` : "Figma File Change Log";
19
+ lines.push(`# ${title}`);
20
+ lines.push("");
21
+ lines.push(`**From:** ${formatVersionRef(input.from_meta, input.from_version_id, false)}`);
22
+ lines.push(`**To:** ${formatVersionRef(input.to_meta, input.to_version_id, true)}`);
23
+ const span = computeSpanDays(input.from_meta?.created_at, input.to_meta?.created_at);
24
+ if (span !== null) {
25
+ lines.push(`**Span:** ${span} day${span === 1 ? "" : "s"}`);
26
+ }
27
+ lines.push("");
28
+ // Summary mode: one-line punch line
29
+ if (mode === "summary") {
30
+ lines.push(formatSummaryLine(input));
31
+ lines.push("");
32
+ appendNotes(lines, input.notes);
33
+ return lines.join("\n").trimEnd() + "\n";
34
+ }
35
+ // Page Structure section (always for standard/detailed)
36
+ appendPageStructureSection(lines, input.page_structure);
37
+ // Components section
38
+ if (input.scoped_nodes && input.scoped_nodes.length > 0) {
39
+ appendComponentsSection(lines, input.scoped_nodes, mode);
40
+ }
41
+ else {
42
+ lines.push("## Components");
43
+ lines.push("");
44
+ lines.push("_No components were scoped for this changelog. Pass `component_ids` to include per-component changes._");
45
+ lines.push("");
46
+ }
47
+ appendNotes(lines, input.notes);
48
+ return lines.join("\n").trimEnd() + "\n";
49
+ }
50
+ // ============================================================================
51
+ // Section formatters
52
+ // ============================================================================
53
+ function appendPageStructureSection(lines, page) {
54
+ const total = page.summary.added + page.summary.removed + page.summary.renamed;
55
+ lines.push("## Page Structure");
56
+ lines.push("");
57
+ if (total === 0) {
58
+ lines.push("_No page-level changes._");
59
+ lines.push("");
60
+ return;
61
+ }
62
+ if (page.pages_added.length > 0) {
63
+ lines.push(`**Added (${page.pages_added.length}):**`);
64
+ for (const p of page.pages_added)
65
+ lines.push(`- ${escapeMd(p.name)} \`${p.id}\``);
66
+ lines.push("");
67
+ }
68
+ if (page.pages_removed.length > 0) {
69
+ lines.push(`**Removed (${page.pages_removed.length}):**`);
70
+ for (const p of page.pages_removed)
71
+ lines.push(`- ${escapeMd(p.name)} \`${p.id}\``);
72
+ lines.push("");
73
+ }
74
+ if (page.pages_renamed.length > 0) {
75
+ lines.push(`**Renamed (${page.pages_renamed.length}):**`);
76
+ for (const r of page.pages_renamed) {
77
+ lines.push(`- \`${r.id}\`: ${escapeMd(r.old_name)} → ${escapeMd(r.new_name)}`);
78
+ }
79
+ lines.push("");
80
+ }
81
+ }
82
+ function appendComponentsSection(lines, scoped, mode) {
83
+ lines.push("## Components");
84
+ lines.push("");
85
+ const withChanges = scoped.filter((n) => n.change_count > 0);
86
+ const unchanged = scoped.filter((n) => n.change_count === 0 && n.notes.length === 0);
87
+ const notFound = scoped.filter((n) => n.notes.some((note) => note.toLowerCase().includes("not found")));
88
+ if (withChanges.length === 0 && unchanged.length === 0 && notFound.length === 0) {
89
+ lines.push("_No scoped components had changes._");
90
+ lines.push("");
91
+ return;
92
+ }
93
+ for (const n of withChanges) {
94
+ appendComponentBlock(lines, n, mode);
95
+ }
96
+ if (unchanged.length > 0) {
97
+ lines.push(`**No changes:** ${unchanged.map((n) => `\`${n.node_name || n.node_id}\``).join(", ")}`);
98
+ lines.push("");
99
+ }
100
+ if (notFound.length > 0) {
101
+ lines.push(`**Not found in either version:** ${notFound.map((n) => `\`${n.node_id || "(empty)"}\``).join(", ")}`);
102
+ lines.push("");
103
+ }
104
+ }
105
+ function appendComponentBlock(lines, n, mode) {
106
+ const heading = n.node_name ? `${n.node_name}` : "(unnamed)";
107
+ lines.push(`### ${escapeMd(heading)} — \`${n.node_id}\``);
108
+ lines.push(`**${n.change_count} change${n.change_count === 1 ? "" : "s"}**`);
109
+ // Each subsequent sub-section adds its own single-blank-line separator so
110
+ // we don't end up with two consecutive blank lines when one of these
111
+ // sub-sections is empty. (Earlier versions unconditionally pushed a blank
112
+ // after the change count then again before each sub-section, producing
113
+ // double-blanks in the common case.)
114
+ const bullets = [];
115
+ if (n.name_changed) {
116
+ bullets.push(`- Renamed: \`${escapeMd(n.name_changed.from)}\` → \`${escapeMd(n.name_changed.to)}\``);
117
+ }
118
+ if (n.description_changed) {
119
+ const fromLen = n.description_changed.from.length;
120
+ const toLen = n.description_changed.to.length;
121
+ bullets.push(`- Description changed (${fromLen} → ${toLen} chars)`);
122
+ }
123
+ if (n.children_added.length > 0) {
124
+ const inline = n.children_added.map((c) => `\`${escapeMd(c.name || c.id)}\``).join(", ");
125
+ bullets.push(`- Children added (${n.children_added.length}): ${inline}`);
126
+ }
127
+ if (n.children_removed.length > 0) {
128
+ const inline = n.children_removed.map((c) => `\`${escapeMd(c.name || c.id)}\``).join(", ");
129
+ bullets.push(`- Children removed (${n.children_removed.length}): ${inline}`);
130
+ }
131
+ if (bullets.length > 0) {
132
+ lines.push("");
133
+ lines.push(...bullets);
134
+ }
135
+ if (n.component_properties && hasAnyPropChanges(n.component_properties.summary)) {
136
+ const s = n.component_properties.summary;
137
+ const parts = [];
138
+ if (s.added > 0)
139
+ parts.push(`${s.added} added`);
140
+ if (s.removed > 0)
141
+ parts.push(`${s.removed} removed`);
142
+ if (s.type_changed > 0)
143
+ parts.push(`${s.type_changed} type changed`);
144
+ if (s.default_changed > 0)
145
+ parts.push(`${s.default_changed} default changed`);
146
+ lines.push("");
147
+ lines.push(`**Component properties:** ${parts.join(", ")}`);
148
+ if (mode === "detailed") {
149
+ for (const p of n.component_properties.added) {
150
+ lines.push(`- ➕ \`${escapeMd(p.name)}\` (${p.type}, default: \`${stringifyValue(p.default_value)}\`)`);
151
+ }
152
+ for (const p of n.component_properties.removed) {
153
+ lines.push(`- ➖ \`${escapeMd(p.name)}\` (${p.type})`);
154
+ }
155
+ for (const t of n.component_properties.type_changed) {
156
+ lines.push(`- 🔄 \`${escapeMd(t.name)}\`: ${t.from_type} → ${t.to_type}`);
157
+ }
158
+ for (const d of n.component_properties.default_changed) {
159
+ lines.push(`- ⚙️ \`${escapeMd(d.name)}\`: \`${stringifyValue(d.from_default)}\` → \`${stringifyValue(d.to_default)}\``);
160
+ }
161
+ }
162
+ }
163
+ if (n.binding_changes.length > 0) {
164
+ lines.push("");
165
+ lines.push(`**Variable bindings (${n.binding_changes.length}):**`);
166
+ if (mode === "detailed") {
167
+ for (const b of n.binding_changes) {
168
+ const arrow = b.change_kind === "added"
169
+ ? `→ \`${b.to_variable_id}\``
170
+ : b.change_kind === "removed"
171
+ ? `(removed, was \`${b.from_variable_id}\`)`
172
+ : `\`${b.from_variable_id}\` → \`${b.to_variable_id}\``;
173
+ lines.push(`- ${escapeMd(b.node_name || b.node_id)} — \`${b.property}\` ${arrow}`);
174
+ }
175
+ }
176
+ else {
177
+ // standard mode: group by change_kind, give counts
178
+ const counts = { added: 0, removed: 0, rebound: 0 };
179
+ for (const b of n.binding_changes)
180
+ counts[b.change_kind]++;
181
+ const parts = [];
182
+ if (counts.added > 0)
183
+ parts.push(`${counts.added} added`);
184
+ if (counts.removed > 0)
185
+ parts.push(`${counts.removed} removed`);
186
+ if (counts.rebound > 0)
187
+ parts.push(`${counts.rebound} rebound`);
188
+ lines.push(`_${parts.join(", ")}._`);
189
+ }
190
+ }
191
+ lines.push("");
192
+ }
193
+ function appendNotes(lines, notes) {
194
+ if (!notes || notes.length === 0)
195
+ return;
196
+ lines.push("## Notes");
197
+ lines.push("");
198
+ for (const n of notes)
199
+ lines.push(`- ${n}`);
200
+ lines.push("");
201
+ }
202
+ // ============================================================================
203
+ // Helpers
204
+ // ============================================================================
205
+ function formatVersionRef(meta, versionId, isTo) {
206
+ if (meta?.is_head || versionId === "current") {
207
+ const date = meta?.created_at ? formatDate(meta.created_at) : "current state";
208
+ const user = meta?.user_handle ? ` by ${meta.user_handle}` : "";
209
+ return `Current state (last modified ${date}${user})`;
210
+ }
211
+ if (!meta) {
212
+ return `\`${versionId}\` _(metadata not available)_`;
213
+ }
214
+ const label = meta.label && meta.label.trim() !== "" ? `"${meta.label}"` : "_(unlabeled)_";
215
+ const date = meta.created_at ? formatDate(meta.created_at) : "";
216
+ const user = meta.user_handle ? `by ${meta.user_handle}` : "";
217
+ const parts = [label, date, user].filter(Boolean).join(" — ");
218
+ return `${parts} \`${versionId}\``;
219
+ }
220
+ function formatSummaryLine(input) {
221
+ const p = input.page_structure.summary;
222
+ const componentCount = input.scoped_nodes?.filter((n) => n.change_count > 0).length ?? 0;
223
+ const totalComponentChanges = input.scoped_nodes?.reduce((acc, n) => acc + n.change_count, 0) ?? 0;
224
+ const parts = [];
225
+ if (p.added > 0)
226
+ parts.push(`${p.added} page${p.added === 1 ? "" : "s"} added`);
227
+ if (p.removed > 0)
228
+ parts.push(`${p.removed} page${p.removed === 1 ? "" : "s"} removed`);
229
+ if (p.renamed > 0)
230
+ parts.push(`${p.renamed} page${p.renamed === 1 ? "" : "s"} renamed`);
231
+ if (componentCount > 0) {
232
+ parts.push(`${componentCount} component${componentCount === 1 ? "" : "s"} with ${totalComponentChanges} change${totalComponentChanges === 1 ? "" : "s"}`);
233
+ }
234
+ if (parts.length === 0)
235
+ return "_No structural changes detected._";
236
+ return parts.join("; ") + ".";
237
+ }
238
+ function computeSpanDays(fromIso, toIso) {
239
+ if (!fromIso || !toIso)
240
+ return null;
241
+ const from = new Date(fromIso).getTime();
242
+ const to = new Date(toIso).getTime();
243
+ if (isNaN(from) || isNaN(to))
244
+ return null;
245
+ return Math.max(0, Math.round((to - from) / (1000 * 60 * 60 * 24)));
246
+ }
247
+ function formatDate(iso) {
248
+ // ISO 8601 is fine as-is for release notes; trim time if it's midnight UTC for cleaner output
249
+ const d = new Date(iso);
250
+ if (isNaN(d.getTime()))
251
+ return iso;
252
+ return d.toISOString().slice(0, 10);
253
+ }
254
+ function escapeMd(s) {
255
+ // Escape characters that would break markdown. Keep light — release notes
256
+ // should be readable, not over-escaped.
257
+ return s.replace(/([\\`*_{}\[\]<>])/g, "\\$1");
258
+ }
259
+ function stringifyValue(v) {
260
+ if (v === undefined)
261
+ return "?"; // standard mode strips defaults; render placeholder
262
+ if (v === null)
263
+ return "null";
264
+ if (typeof v === "string")
265
+ return v;
266
+ try {
267
+ return JSON.stringify(v);
268
+ }
269
+ catch {
270
+ return String(v);
271
+ }
272
+ }
273
+ function hasAnyPropChanges(s) {
274
+ return s.added > 0 || s.removed > 0 || s.type_changed > 0 || s.default_changed > 0;
275
+ }
276
+ //# sourceMappingURL=changelog-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog-formatter.js","sourceRoot":"","sources":["../../../src/core/diff/changelog-formatter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAwBH,MAAM,UAAU,uBAAuB,CAAC,KAAqB,EAAE,OAAiB,UAAU;IACzF,MAAM,K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,CAAC;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACF,CAAC;AAED,SAAS,iBAAiB,CAAC,CAAoF;IAC9G,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,YAAY,GAAG,CAAC,IAAI,CAAC,CAAC,eAAe,GAAG,CAAC,CAAC;AACpF,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Diff engine — pure functions for comparing Figma file/node snapshots
3
+ * across two versions.
4
+ *
5
+ * Scope (v1):
6
+ * - Page-structure diff (added/removed/renamed pages) from depth=1 file fetches
7
+ * - Per-node diff for scoped fetches: name, description, children added/removed,
8
+ * componentPropertyDefinitions changes (for COMPONENT_SET), boundVariables changes
9
+ *
10
+ * NOT in scope (deferred):
11
+ * - Variable VALUE history (Figma REST does not expose this; planned forward
12
+ * ledger will fill the gap going forward, never retroactively)
13
+ * - Style-content diffs (only style add/remove via reachable styles map)
14
+ * - Inside-fills/strokes binding diffs (top-level boundVariables only for v1)
15
+ */
16
+ export type DiffMode = "summary" | "standard" | "detailed";
17
+ export interface PageEntry {
18
+ id: string;
19
+ name: string;
20
+ }
21
+ export interface PageStructureDiff {
22
+ pages_added: PageEntry[];
23
+ pages_removed: PageEntry[];
24
+ pages_renamed: Array<{
25
+ id: string;
26
+ old_name: string;
27
+ new_name: string;
28
+ }>;
29
+ summary: {
30
+ added: number;
31
+ removed: number;
32
+ renamed: number;
33
+ };
34
+ }
35
+ /**
36
+ * Compare two file documents (from /v1/files/:key?version=X with depth=1 or higher).
37
+ * Both arguments should be the `document` field of a Figma file response.
38
+ */
39
+ export declare function diffPageStructure(fromDoc: any, toDoc: any): PageStructureDiff;
40
+ export interface PropertyDefSummary {
41
+ name: string;
42
+ type: string;
43
+ default_value: any;
44
+ }
45
+ export interface ComponentPropertyDefDiff {
46
+ added: PropertyDefSummary[];
47
+ removed: PropertyDefSummary[];
48
+ type_changed: Array<{
49
+ name: string;
50
+ from_type: string;
51
+ to_type: string;
52
+ }>;
53
+ default_changed: Array<{
54
+ name: string;
55
+ from_default: any;
56
+ to_default: any;
57
+ }>;
58
+ summary: {
59
+ added: number;
60
+ removed: number;
61
+ type_changed: number;
62
+ default_changed: number;
63
+ };
64
+ }
65
+ /**
66
+ * Diff a COMPONENT_SET's componentPropertyDefinitions map.
67
+ * Each definition is keyed by `propName#nodeId` in Figma's response.
68
+ */
69
+ export declare function diffComponentPropertyDefinitions(fromDefs: Record<string, any> | undefined, toDefs: Record<string, any> | undefined): ComponentPropertyDefDiff;
70
+ export interface BindingChange {
71
+ node_id: string;
72
+ node_name: string;
73
+ property: string;
74
+ from_variable_id: string | null;
75
+ to_variable_id: string | null;
76
+ change_kind: "added" | "removed" | "rebound";
77
+ }
78
+ /**
79
+ * Walk both node trees in parallel (matched by node id), comparing top-level
80
+ * boundVariables. Inside-fills/strokes binding diffs are explicitly NOT included
81
+ * in v1 — they add complexity for marginal additional value over node-level deltas.
82
+ */
83
+ export declare function collectBindingChanges(fromNode: any, toNode: any): BindingChange[];
84
+ export interface NodeChildSummary {
85
+ id: string;
86
+ name: string;
87
+ type: string;
88
+ }
89
+ export interface NodeDiff {
90
+ node_id: string;
91
+ node_name: string;
92
+ node_type: string;
93
+ name_changed: {
94
+ from: string;
95
+ to: string;
96
+ } | null;
97
+ description_changed: {
98
+ from: string;
99
+ to: string;
100
+ } | null;
101
+ children_added: NodeChildSummary[];
102
+ children_removed: NodeChildSummary[];
103
+ component_properties: ComponentPropertyDefDiff | null;
104
+ binding_changes: BindingChange[];
105
+ change_count: number;
106
+ notes: string[];
107
+ }
108
+ /**
109
+ * Diff a single node (typically a COMPONENT_SET) at depth=2. Either side may be
110
+ * null/undefined to represent "newly added" or "removed entirely."
111
+ */
112
+ export declare function diffNode(fromNode: any, toNode: any, mode?: DiffMode): NodeDiff;
113
+ //# sourceMappingURL=diff-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-engine.d.ts","sourceRoot":"","sources":["../../../src/core/diff/diff-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAM3D,MAAM,WAAW,SAAS;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,iBAAiB;IACjC,WAAW,EAAE,SAAS,EAAE,CAAC;IACzB,aAAa,EAAE,SAAS,EAAE,CAAC;IAC3B,aAAa,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACzE,OAAO,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KAChB,CAAC;CACF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,GAAG,iBAAiB,CAoC7E;AAcD,MAAM,WAAW,kBAAkB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,GAAG,CAAC;CACnB;AAED,MAAM,WAAW,wBAAwB;IACxC,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAC9B,YAAY,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,eAAe,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM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