coaia-visualizer 1.6.3 → 1.6.5

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 (54) hide show
  1. package/Dockerfile +61 -0
  2. package/Dockerfile.app +50 -0
  3. package/README.md +2 -1
  4. package/cli.ts +11 -5
  5. package/components/asterion-foundation-card.tsx +175 -0
  6. package/components/asterion-session-context-badge.tsx +122 -0
  7. package/components/asterion-session-lineage-card.tsx +119 -0
  8. package/components/chart-detail-editable.tsx +2 -0
  9. package/components/chart-detail.tsx +9 -1
  10. package/components/edit-action-step.tsx +2 -0
  11. package/components/github-provenance.tsx +226 -0
  12. package/components/metadata-projections.tsx +50 -16
  13. package/components/narrative-beats.tsx +16 -3
  14. package/components/relation-graph.tsx +91 -27
  15. package/dist/cli.js +9 -5
  16. package/docker-build-push.sh +20 -0
  17. package/docker-entrypoint.sh +27 -0
  18. package/index.tsx +39 -2
  19. package/lib/asterion-metadata.ts +673 -0
  20. package/lib/chart-editor.ts +8 -3
  21. package/lib/github-provenance.ts +316 -0
  22. package/lib/jsonl-parser.ts +7 -2
  23. package/lib/types.ts +112 -2
  24. package/mcp/test_mcp/.gemini/settings.json +18 -0
  25. package/next-env.d.ts +1 -1
  26. package/package.json +14 -13
  27. package/rispecs/README.md +170 -0
  28. package/rispecs/accountability-responsibility.rispec.md +110 -0
  29. package/rispecs/api-mcp-interface.spec.md +287 -0
  30. package/rispecs/app.spec.md +364 -0
  31. package/rispecs/chart-editing-workflow.spec.md +297 -0
  32. package/rispecs/chart-visualization-hierarchy.spec.md +235 -0
  33. package/rispecs/cli-mode.spec.md +224 -0
  34. package/rispecs/github-project-runtime-memory-integration.spec.md +381 -0
  35. package/rispecs/jsonl-parsing-data-types.spec.md +243 -0
  36. package/rispecs/narrative-beats-display.spec.md +189 -0
  37. package/rispecs/pde-integration.spec.md +280 -0
  38. package/rispecs/planning-integration.spec.md +329 -0
  39. package/rispecs/relation-graph-visualization.spec.md +171 -0
  40. package/rispecs/relation-to-mcp-structural-thinking.kin.md +65 -0
  41. package/rispecs/ui-component-library.spec.md +258 -0
  42. package/mcp/dist/api-client.d.ts +0 -138
  43. package/mcp/dist/api-client.d.ts.map +0 -1
  44. package/mcp/dist/api-client.js +0 -115
  45. package/mcp/dist/api-client.js.map +0 -1
  46. package/mcp/dist/index.d.ts +0 -2
  47. package/mcp/dist/index.d.ts.map +0 -1
  48. package/mcp/dist/index.js +0 -286
  49. package/mcp/dist/index.js.map +0 -1
  50. package/mcp/dist/tools/index.d.ts +0 -18
  51. package/mcp/dist/tools/index.d.ts.map +0 -1
  52. package/mcp/dist/tools/index.js +0 -322
  53. package/mcp/dist/tools/index.js.map +0 -1
  54. package/mcp/package-lock.json +0 -210
@@ -0,0 +1,258 @@
1
+ # UI Component Library
2
+ ## RISE Specification for Shared UI Primitives, Theming, and Statistics Display
3
+
4
+ **Component Purpose**: Provide consistent, accessible, and themed UI primitives across the entire visualizer — built on Radix UI with shadcn patterns, supporting dark/light themes, and including statistical overview components.
5
+
6
+ **Source Files**: `components/ui/*.tsx`, `components/theme-provider.tsx`, `components/theme-toggle.tsx`, `components/data-stats.tsx`, `components/live-indicator.tsx`, `components/file-upload.tsx`, `lib/utils.ts`
7
+
8
+ ---
9
+
10
+ ## 🎯 What This Component Enables Users to Create
11
+
12
+ - A consistent visual language across all visualizer views
13
+ - Dark/light theme support with system preference detection
14
+ - Accessible UI interactions via Radix UI primitives
15
+ - At-a-glance data statistics for quick structural assessment
16
+ - Live polling status awareness
17
+ - Drag-and-drop file upload experience
18
+
19
+ ---
20
+
21
+ ## 🌊 Structural Tension Dynamics
22
+
23
+ ### Current Reality
24
+ The visualizer needs 12+ distinct UI primitive types (buttons, cards, dialogs, inputs, tabs, etc.) plus application-specific components (stats, live indicator, file upload, theme toggle). Without a unified component library, each feature would implement its own styling, creating inconsistency.
25
+
26
+ ### Desired Result
27
+ A coherent component library where:
28
+ - All primitives follow the same design tokens (colors, spacing, borders)
29
+ - Dark/light themes switch seamlessly without component-level overrides
30
+ - Accessibility is built into the foundation (Radix UI handles ARIA, focus management)
31
+ - Application-specific components (DataStats, LiveIndicator, FileUpload) use the same primitives
32
+
33
+ ### Natural Resolution
34
+ Radix UI provides headless, accessible primitives. shadcn patterns add consistent styling via Tailwind CSS class variants (CVA). The `cn()` utility merges class names safely. `next-themes` handles theme persistence.
35
+
36
+ ---
37
+
38
+ ## 📋 Utility: `cn()` (lib/utils.ts)
39
+
40
+ ```typescript
41
+ import { clsx, type ClassValue } from 'clsx'
42
+ import { twMerge } from 'tailwind-merge'
43
+
44
+ export function cn(...inputs: ClassValue[]): string {
45
+ return twMerge(clsx(inputs))
46
+ }
47
+ ```
48
+
49
+ Used throughout all components to safely combine Tailwind classes with conflict resolution.
50
+
51
+ ---
52
+
53
+ ## 📋 UI Primitives (components/ui/)
54
+
55
+ ### Badge
56
+ - **Variants**: default, secondary, destructive, outline
57
+ - **Usage**: Chart level indicators, relation type labels, universe tags, completion status
58
+
59
+ ### Button
60
+ - **Variants**: default, destructive, outline, secondary, ghost, link
61
+ - **Sizes**: default, sm, lg, icon, icon-sm, icon-lg
62
+ - **Usage**: All interactive triggers — save, edit, cancel, add, delete, navigate
63
+
64
+ ### Card (+ Header, Title, Description, Action, Content, Footer)
65
+ - **Structure**: Container → Header (grid layout) → Content → Footer
66
+ - **Usage**: Chart items, stat cards, narrative beat cards, form containers
67
+ - **Notable**: Container queries for responsive header layout
68
+
69
+ ### Dialog (+ Trigger, Content, Overlay, Header, Footer, Title, Description)
70
+ - **Behavior**: Modal with overlay, close button, fade/zoom animations
71
+ - **Usage**: AddMasterChart form, confirmation dialogs
72
+
73
+ ### Input
74
+ - **Features**: File input styling, focus rings, disabled states
75
+ - **Usage**: Date inputs, text fields
76
+
77
+ ### Label
78
+ - **Features**: Radix UI label with icon support, disabled/readonly states
79
+ - **Usage**: Form field labels
80
+
81
+ ### Textarea
82
+ - **Features**: Min-height 80px, focus rings, auto-resize support
83
+ - **Usage**: Desired outcome editing, current reality observations, action descriptions
84
+
85
+ ### Tabs (+ List, Trigger, Content)
86
+ - **Features**: Pill-styled triggers, active state highlighting
87
+ - **Usage**: Actions/Relations tabs in chart detail, Hierarchy/List view toggle, Upload/Create form toggle
88
+
89
+ ### Calendar
90
+ - **Features**: react-day-picker wrapper with custom styling
91
+ - **Usage**: Due date selection in popovers
92
+
93
+ ### Popover (+ Trigger, Content)
94
+ - **Features**: Radix UI popover with portal, positioned relative to trigger
95
+ - **Usage**: Date pickers, action toolbars
96
+
97
+ ### ScrollArea (+ Scrollbar)
98
+ - **Features**: Custom scrollbar styling, vertical/horizontal support
99
+ - **Usage**: Chart list panel scrolling
100
+
101
+ ### Separator
102
+ - **Features**: Horizontal/vertical, decorative by default
103
+ - **Usage**: Section dividers in chart detail
104
+
105
+ ---
106
+
107
+ ## 📋 Theme System
108
+
109
+ ### ThemeProvider (`components/theme-provider.tsx`)
110
+ - Wraps `next-themes` ThemeProvider
111
+ - Default theme: dark
112
+ - Attribute-based switching (`class` attribute on `<html>`)
113
+ - System preference detection
114
+
115
+ ### ThemeToggle (`components/theme-toggle.tsx`)
116
+ - Sun icon (in dark mode) / Moon icon (in light mode)
117
+ - Hydration-safe: renders placeholder before mount to avoid SSR mismatch
118
+ - Uses `useTheme()` hook from next-themes
119
+
120
+ ### Color Tokens
121
+ The visualizer uses `chart-1` through `chart-4` color themes for semantic distinction:
122
+ - **chart-1** (teal): Desired outcomes
123
+ - **chart-2** (amber): Current reality
124
+ - **chart-3**: Narrative beats, accents
125
+ - **chart-4**: Statistics, misc
126
+
127
+ ---
128
+
129
+ ## 📋 DataStats Component
130
+
131
+ ### Props
132
+ ```typescript
133
+ interface DataStatsProps {
134
+ data: ParsedData
135
+ }
136
+ ```
137
+
138
+ ### Render Structure
139
+ ```
140
+ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
141
+ │ 🎯 12 │ │ ✅ 8/15 │ │ 📄 47 │ │ 🔗 32 │
142
+ │ Charts │ │ Actions │ │ Entities│ │Relations│
143
+ └─────────┘ └─────────┘ └─────────┘ └─────────┘
144
+ ```
145
+
146
+ **Lucide Icons**: `Target` (Charts), `BarChart3` (Actions), `FileText` (Entities), `Network` (Relations)
147
+
148
+ **Computed Statistics**:
149
+ 1. **Charts**: `data.charts.length`
150
+ 2. **Actions**: `{completed}/{total}` — iterates all charts, sums action counts, counts completion status
151
+ 3. **Entities**: `data.entities.size`
152
+ 4. **Relations**: `data.relations.length`
153
+ 5. **Total Beats**: computed across all charts but currently unused in display
154
+
155
+ Each card shows Lucide icon (color-coded chart-1 through chart-4), value, and label.
156
+
157
+ > **Note**: Toast notifications use `sonner` (imported as `toast` from `sonner`), not the shadcn `use-toast` hook. Both exist in the codebase but `sonner` is the active integration.
158
+
159
+ ---
160
+
161
+ ## 📋 LiveIndicator Component
162
+
163
+ ### Props
164
+ ```typescript
165
+ { isLive: boolean }
166
+ ```
167
+
168
+ ### Render
169
+ ```
170
+ When isLive=true: ● LIVE (green pulse animation)
171
+ When isLive=false: ○ Monitoring (gray, no animation)
172
+ ```
173
+
174
+ - Animated green pulse dot when live data detected
175
+ - Tailwind pulse + shadow animations
176
+ - No interactivity — pure display
177
+
178
+ ### Integration
179
+ Driven by `useLivePolling` hook which polls `/api/watch` and flashes `isLive=true` for 2 seconds when new data detected.
180
+
181
+ ---
182
+
183
+ ## 📋 FileUpload Component
184
+
185
+ ### Props
186
+ ```typescript
187
+ interface FileUploadProps {
188
+ onFileLoad: (content: string, fileName: string) => void
189
+ }
190
+ ```
191
+
192
+ ### Render
193
+ ```
194
+ ┌────────────────────────────────────┐
195
+ │ 📁 Upload Icon │
196
+ │ │
197
+ │ Drag & drop your .jsonl file │
198
+ │ or click to browse │
199
+ │ │
200
+ │ Supports .jsonl and .txt files │
201
+ └────────────────────────────────────┘
202
+ ```
203
+
204
+ **Behavior**:
205
+ - Hidden `<input type="file" accept=".jsonl,.txt">` triggered by card click
206
+ - Drag-and-drop: `handleDragOver` prevents default, `handleDrop` reads first file
207
+ - `FileReader` API reads file as text
208
+ - Passes content and filename to parent via `onFileLoad`
209
+
210
+ ---
211
+
212
+ ## 📋 Technology Stack
213
+
214
+ | Library | Version | Purpose |
215
+ |:---|:---|:---|
216
+ | Radix UI | Various @radix-ui/* packages | Headless accessible primitives |
217
+ | Tailwind CSS | 4.1.9 | Utility-first styling |
218
+ | class-variance-authority (CVA) | — | Component variant management |
219
+ | clsx | — | Conditional class joining |
220
+ | tailwind-merge | — | Conflict-free class merging |
221
+ | next-themes | — | Dark/light theme provider |
222
+ | react-day-picker | — | Calendar date selection |
223
+ | lucide-react | — | Icon library |
224
+ | sonner | — | Toast notifications |
225
+ | recharts | 2.15.4 | Data visualization charts |
226
+
227
+ ---
228
+
229
+ ## ✅ Quality Criteria
230
+
231
+ ✅ **Consistency**
232
+ - All components use `cn()` for class management
233
+ - CVA variants ensure consistent styling across instances
234
+ - Color tokens used semantically (chart-1 for outcomes, chart-2 for reality)
235
+
236
+ ✅ **Accessibility**
237
+ - Radix UI provides ARIA attributes, keyboard navigation, and focus management
238
+ - Labels associate correctly with inputs
239
+ - Dialogs trap focus and handle escape key
240
+
241
+ ✅ **Theme Support**
242
+ - Dark mode is default, light mode available
243
+ - Hydration-safe theme toggle (no flash of wrong theme)
244
+ - All components respect theme context
245
+
246
+ ✅ **Responsive Design**
247
+ - Responsive typography (md: breakpoints)
248
+ - Container queries for card header layout
249
+ - ScrollArea for overflow handling
250
+
251
+ ---
252
+
253
+ ## 🔗 Related Components
254
+
255
+ - [chart-visualization-hierarchy.spec.md](./chart-visualization-hierarchy.spec.md) — uses Card, Badge, ScrollArea, Tabs extensively
256
+ - [chart-editing-workflow.spec.md](./chart-editing-workflow.spec.md) — uses Button, Textarea, Dialog, Calendar, Popover
257
+ - [narrative-beats-display.spec.md](./narrative-beats-display.spec.md) — uses Card, Badge
258
+ - [app.spec.md](./app.spec.md) — full application context for all UI components
@@ -1,138 +0,0 @@
1
- export interface Chart {
2
- id: string;
3
- desiredOutcome?: {
4
- observations: string[];
5
- metadata: any;
6
- };
7
- currentReality?: {
8
- observations: string[];
9
- metadata: any;
10
- };
11
- actions: Array<{
12
- name: string;
13
- observations: string[];
14
- metadata: any;
15
- }>;
16
- narrativeBeats: any[];
17
- subCharts: any[];
18
- level: number;
19
- parentChart?: string;
20
- }
21
- export interface ApiConfig {
22
- baseUrl: string;
23
- token: string;
24
- }
25
- export declare class CoaiaVisualizerClient {
26
- private config;
27
- constructor(config: ApiConfig);
28
- private fetch;
29
- private fetchJson;
30
- /**
31
- * List all charts
32
- */
33
- listCharts(options?: {
34
- level?: number;
35
- rootOnly?: boolean;
36
- }): Promise<{
37
- charts: Chart[];
38
- total: number;
39
- }>;
40
- /**
41
- * Get a specific chart
42
- */
43
- getChart(id: string): Promise<{
44
- chart: Chart;
45
- }>;
46
- /**
47
- * Create a new chart
48
- */
49
- createChart(data: {
50
- desiredOutcome: string;
51
- currentReality: string;
52
- dueDate?: string;
53
- parentChartId?: string;
54
- }): Promise<{
55
- chartId: string;
56
- message: string;
57
- backup: string;
58
- }>;
59
- /**
60
- * Update a chart
61
- */
62
- updateChart(id: string, updates: {
63
- updateDesiredOutcome?: string;
64
- addCurrentRealityObservation?: string;
65
- updateCurrentReality?: string[];
66
- updateCurrentRealityObservation?: {
67
- index: number;
68
- text: string;
69
- };
70
- deleteCurrentRealityObservation?: number;
71
- addActionStep?: {
72
- description: string;
73
- currentReality: string;
74
- dueDate?: string;
75
- };
76
- updateActionStep?: {
77
- actionName: string;
78
- description: string;
79
- };
80
- toggleActionCompletion?: string;
81
- markActionComplete?: string;
82
- updateActionProgress?: {
83
- actionStepName: string;
84
- progressObservation: string;
85
- updateCurrentReality?: boolean;
86
- };
87
- updateActionDueDate?: {
88
- actionName: string;
89
- dueDate: string | null;
90
- };
91
- deleteActionStep?: string;
92
- updateDueDate?: string | null;
93
- }): Promise<{
94
- chart: Chart;
95
- updates: string[];
96
- message: string;
97
- backup: string;
98
- }>;
99
- /**
100
- * Create telescoped chart from existing action
101
- */
102
- createTelescopedChart(chartId: string, actionName: string): Promise<{
103
- chart: Chart;
104
- updates: string[];
105
- message: string;
106
- backup: string;
107
- }>;
108
- /**
109
- * Delete a chart
110
- */
111
- deleteChart(id: string): Promise<{
112
- message: string;
113
- deletedEntities: string[];
114
- backup: string;
115
- }>;
116
- /**
117
- * Search charts
118
- */
119
- searchCharts(query: {
120
- q?: string;
121
- level?: number;
122
- completed?: boolean;
123
- hasActions?: boolean;
124
- }): Promise<{
125
- charts: Chart[];
126
- total: number;
127
- query: any;
128
- }>;
129
- /**
130
- * Calculate chart progress
131
- */
132
- getChartProgress(chart: Chart): number;
133
- /**
134
- * Get chart summary
135
- */
136
- getChartSummary(chart: Chart): string;
137
- }
138
- //# sourceMappingURL=api-client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,cAAc,CAAC,EAAE;QACf,YAAY,EAAE,MAAM,EAAE,CAAA;QACtB,QAAQ,EAAE,GAAG,CAAA;KACd,CAAA;IACD,cAAc,CAAC,EAAE;QACf,YAAY,EAAE,MAAM,EAAE,CAAA;QACtB,QAAQ,EAAE,GAAG,CAAA;KACd,CAAA;IACD,OAAO,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,YAAY,EAAE,MAAM,EAAE,CAAA;QACtB,QAAQ,EAAE,GAAG,CAAA;KACd,CAAC,CAAA;IACF,cAAc,EAAE,GAAG,EAAE,CAAA;IACrB,SAAS,EAAE,GAAG,EAAE,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,qBAAa,qBAAqB;IAChC,O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AAC;QAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAU3D;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;IAMtC;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM;CAItC"}
@@ -1,115 +0,0 @@
1
- // mcp/src/api-client.ts - API Client for COAIA Visualizer
2
- export class CoaiaVisualizerClient {
3
- config;
4
- constructor(config) {
5
- this.config = config;
6
- }
7
- async fetch(path, options = {}) {
8
- const url = `${this.config.baseUrl}${path}`;
9
- const headers = {
10
- 'Authorization': `Bearer ${this.config.token}`,
11
- 'Content-Type': 'application/json',
12
- ...options.headers,
13
- };
14
- const response = await fetch(url, {
15
- ...options,
16
- headers,
17
- });
18
- return response;
19
- }
20
- async fetchJson(path, options = {}) {
21
- const response = await this.fetch(path, options);
22
- if (!response.ok) {
23
- const error = await response.json().catch(() => ({ error: 'Unknown error' }));
24
- throw new Error(`API Error (${response.status}): ${error.error || error.message || 'Unknown error'}`);
25
- }
26
- return response.json();
27
- }
28
- /**
29
- * List all charts
30
- */
31
- async listCharts(options) {
32
- const params = new URLSearchParams();
33
- if (options?.level !== undefined)
34
- params.set('level', options.level.toString());
35
- if (options?.rootOnly)
36
- params.set('rootOnly', 'true');
37
- const query = params.toString();
38
- return this.fetchJson(`/api/charts${query ? `?${query}` : ''}`);
39
- }
40
- /**
41
- * Get a specific chart
42
- */
43
- async getChart(id) {
44
- return this.fetchJson(`/api/charts/${id}`);
45
- }
46
- /**
47
- * Create a new chart
48
- */
49
- async createChart(data) {
50
- return this.fetchJson('/api/charts', {
51
- method: 'POST',
52
- body: JSON.stringify(data),
53
- });
54
- }
55
- /**
56
- * Update a chart
57
- */
58
- async updateChart(id, updates) {
59
- return this.fetchJson(`/api/charts/${id}`, {
60
- method: 'POST',
61
- body: JSON.stringify(updates),
62
- });
63
- }
64
- /**
65
- * Create telescoped chart from existing action
66
- */
67
- async createTelescopedChart(chartId, actionName) {
68
- return this.fetchJson(`/api/charts/${chartId}`, {
69
- method: 'POST',
70
- body: JSON.stringify({
71
- createTelescopedChart: { actionName },
72
- }),
73
- });
74
- }
75
- /**
76
- * Delete a chart
77
- */
78
- async deleteChart(id) {
79
- return this.fetchJson(`/api/charts/${id}`, {
80
- method: 'DELETE',
81
- });
82
- }
83
- /**
84
- * Search charts
85
- */
86
- async searchCharts(query) {
87
- const params = new URLSearchParams();
88
- if (query.q)
89
- params.set('q', query.q);
90
- if (query.level !== undefined)
91
- params.set('level', query.level.toString());
92
- if (query.completed !== undefined)
93
- params.set('completed', query.completed.toString());
94
- if (query.hasActions !== undefined)
95
- params.set('hasActions', query.hasActions.toString());
96
- return this.fetchJson(`/api/charts/search?${params.toString()}`);
97
- }
98
- /**
99
- * Calculate chart progress
100
- */
101
- getChartProgress(chart) {
102
- if (chart.actions.length === 0)
103
- return 0;
104
- const completed = chart.actions.filter(a => a.metadata.completionStatus).length;
105
- return Math.round((completed / chart.actions.length) * 100);
106
- }
107
- /**
108
- * Get chart summary
109
- */
110
- getChartSummary(chart) {
111
- const outcome = chart.desiredOutcome?.observations[0] || 'No desired outcome';
112
- return outcome.length > 100 ? outcome.substring(0, 100) + '...' : outcome;
113
- }
114
- }
115
- //# sourceMappingURL=api-client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,0DAA0D;AA4B1D,MAAM,OAAO,qBAAqB;IACxB,MAAM,CAAW;IAEzB,YAAY,MAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEO,KAAK,CAAC,KAAK,CAAC,IAAY,EAAE,UAAuB,EAAE;QACzD,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,EAAE,CAAA;QAC3C,MAAM,OA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