@rool-dev/client 0.1.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.
package/dist/graph.js ADDED
@@ -0,0 +1,573 @@
1
+ // =============================================================================
2
+ // Graph
3
+ // First-class Graph object with node/edge operations, undo/redo, and events
4
+ // =============================================================================
5
+ import { immutableJSONPatch } from 'immutable-json-patch';
6
+ import { EventEmitter } from './event-emitter.js';
7
+ const MAX_UNDO_STACK_SIZE = 50;
8
+ // 6-character alphanumeric ID (62^6 = 56.8 billion possible values)
9
+ const ID_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
10
+ export function generateEntityId() {
11
+ let result = '';
12
+ for (let i = 0; i < 6; i++) {
13
+ result += ID_CHARS[Math.floor(Math.random() * ID_CHARS.length)];
14
+ }
15
+ return result;
16
+ }
17
+ /**
18
+ * First-class Graph object.
19
+ *
20
+ * Features:
21
+ * - High-level node/edge operations
22
+ * - Built-in undo/redo with checkpoints
23
+ * - Metadata management
24
+ * - Event emission for state changes
25
+ * - Real-time subscription support
26
+ */
27
+ export class RoolGraph extends EventEmitter {
28
+ _id;
29
+ _name;
30
+ _role;
31
+ _data;
32
+ graphqlClient;
33
+ mediaClient;
34
+ onRegisterForEvents;
35
+ onUnregisterFromEvents;
36
+ // Undo/redo stacks
37
+ undoStack = [];
38
+ redoStack = [];
39
+ // Patch batching
40
+ pendingPatch = [];
41
+ patchScheduled = false;
42
+ // Subscription state
43
+ _isSubscribed = false;
44
+ constructor(config) {
45
+ super();
46
+ this._id = config.id;
47
+ this._name = config.name;
48
+ this._role = config.role;
49
+ this._data = config.initialData;
50
+ this.graphqlClient = config.graphqlClient;
51
+ this.mediaClient = config.mediaClient;
52
+ this.onRegisterForEvents = config.onRegisterForEvents;
53
+ this.onUnregisterFromEvents = config.onUnregisterFromEvents;
54
+ }
55
+ // ===========================================================================
56
+ // Properties
57
+ // ===========================================================================
58
+ get id() {
59
+ return this._id;
60
+ }
61
+ get name() {
62
+ return this._name;
63
+ }
64
+ get role() {
65
+ return this._role;
66
+ }
67
+ get isReadOnly() {
68
+ return this._role === 'viewer';
69
+ }
70
+ get isSubscribed() {
71
+ return this._isSubscribed;
72
+ }
73
+ // ===========================================================================
74
+ // Graph Lifecycle
75
+ // ===========================================================================
76
+ /**
77
+ * Rename this graph.
78
+ */
79
+ async rename(newName) {
80
+ const oldName = this._name;
81
+ this._name = newName;
82
+ try {
83
+ await this.graphqlClient.renameGraph(this._id, newName);
84
+ }
85
+ catch (error) {
86
+ this._name = oldName;
87
+ throw error;
88
+ }
89
+ }
90
+ /**
91
+ * Subscribe to real-time updates for this graph.
92
+ * Registers with the client for event routing.
93
+ */
94
+ subscribe() {
95
+ if (this._isSubscribed)
96
+ return;
97
+ this._isSubscribed = true;
98
+ this.onRegisterForEvents(this._id, this);
99
+ }
100
+ /**
101
+ * Unsubscribe from real-time updates.
102
+ */
103
+ unsubscribe() {
104
+ if (!this._isSubscribed)
105
+ return;
106
+ this._isSubscribed = false;
107
+ this.onUnregisterFromEvents(this._id);
108
+ }
109
+ /**
110
+ * Close this graph and clean up resources.
111
+ */
112
+ close() {
113
+ this.unsubscribe();
114
+ this.undoStack = [];
115
+ this.redoStack = [];
116
+ this.pendingPatch = [];
117
+ this.removeAllListeners();
118
+ }
119
+ // ===========================================================================
120
+ // Undo / Redo
121
+ // ===========================================================================
122
+ /**
123
+ * Create a checkpoint for undo.
124
+ * Call this before a user action to capture the current state.
125
+ */
126
+ checkpoint(label = 'Change') {
127
+ const entry = {
128
+ timestamp: Date.now(),
129
+ label,
130
+ data: JSON.parse(JSON.stringify(this._data)),
131
+ };
132
+ this.undoStack.push(entry);
133
+ // Limit stack size
134
+ if (this.undoStack.length > MAX_UNDO_STACK_SIZE) {
135
+ this.undoStack.shift();
136
+ }
137
+ // Clear redo stack (new action invalidates redo)
138
+ this.redoStack = [];
139
+ }
140
+ /**
141
+ * Check if undo is available.
142
+ */
143
+ canUndo() {
144
+ return this.undoStack.length > 0;
145
+ }
146
+ /**
147
+ * Check if redo is available.
148
+ */
149
+ canRedo() {
150
+ return this.redoStack.length > 0;
151
+ }
152
+ /**
153
+ * Undo to the previous checkpoint.
154
+ * @returns true if undo was performed
155
+ */
156
+ async undo() {
157
+ if (!this.canUndo())
158
+ return false;
159
+ // Save current state to redo stack
160
+ const currentEntry = {
161
+ timestamp: Date.now(),
162
+ label: 'Redo point',
163
+ data: JSON.parse(JSON.stringify(this._data)),
164
+ };
165
+ this.redoStack.push(currentEntry);
166
+ // Restore previous state
167
+ const previousEntry = this.undoStack.pop();
168
+ this._data = previousEntry.data;
169
+ // Sync to server - resync on failure
170
+ try {
171
+ await this.graphqlClient.setGraph(this._id, this._data);
172
+ this.emit('changed', this._data);
173
+ }
174
+ catch (error) {
175
+ console.error('[Graph] Failed to sync undo to server:', error);
176
+ await this.resyncFromServer(error instanceof Error ? error : new Error(String(error)));
177
+ }
178
+ return true;
179
+ }
180
+ /**
181
+ * Redo a previously undone action.
182
+ * @returns true if redo was performed
183
+ */
184
+ async redo() {
185
+ if (!this.canRedo())
186
+ return false;
187
+ // Save current state to undo stack
188
+ const currentEntry = {
189
+ timestamp: Date.now(),
190
+ label: 'Undo point',
191
+ data: JSON.parse(JSON.stringify(this._data)),
192
+ };
193
+ this.undoStack.push(currentEntry);
194
+ // Restore next state
195
+ const nextEntry = this.redoStack.pop();
196
+ this._data = nextEntry.data;
197
+ // Sync to server - resync on failure
198
+ try {
199
+ await this.graphqlClient.setGraph(this._id, this._data);
200
+ this.emit('changed', this._data);
201
+ }
202
+ catch (error) {
203
+ console.error('[Graph] Failed to sync redo to server:', error);
204
+ await this.resyncFromServer(error instanceof Error ? error : new Error(String(error)));
205
+ }
206
+ return true;
207
+ }
208
+ /**
209
+ * Clear undo/redo history.
210
+ * Called when external changes invalidate local history.
211
+ */
212
+ clearHistory() {
213
+ this.undoStack = [];
214
+ this.redoStack = [];
215
+ }
216
+ // ===========================================================================
217
+ // Node Operations
218
+ // ===========================================================================
219
+ /**
220
+ * Get a node by ID.
221
+ * @throws Error if node not found
222
+ */
223
+ getNode(nodeId) {
224
+ const node = this._data.nodes[nodeId];
225
+ if (!node) {
226
+ throw new Error(`Node ${nodeId} not found`);
227
+ }
228
+ return node;
229
+ }
230
+ /**
231
+ * Get a node by ID, or undefined if not found.
232
+ */
233
+ getNodeOrUndefined(nodeId) {
234
+ return this._data.nodes[nodeId];
235
+ }
236
+ /**
237
+ * Get all nodes of a specific type.
238
+ */
239
+ getNodesByType(type) {
240
+ return Object.values(this._data.nodes).filter(node => node.type === type);
241
+ }
242
+ /**
243
+ * Get all node IDs.
244
+ */
245
+ getNodeIds() {
246
+ return Object.keys(this._data.nodes);
247
+ }
248
+ /**
249
+ * Add a new node.
250
+ */
251
+ addNode(nodeId, node) {
252
+ this._data.nodes[nodeId] = node;
253
+ this.sendPatch([{ op: 'add', path: `/nodes/${nodeId}`, value: node }]);
254
+ this.emit('nodeAdded', nodeId, node);
255
+ }
256
+ /**
257
+ * Update an existing node.
258
+ * @param updates - Partial node data to merge
259
+ * @param persist - If false, update local state only (for drag/animation)
260
+ */
261
+ updateNode(nodeId, updates, persist = true) {
262
+ const node = this._data.nodes[nodeId];
263
+ if (!node) {
264
+ throw new Error(`Node ${nodeId} not found for update`);
265
+ }
266
+ // Merge updates
267
+ Object.assign(node, updates);
268
+ if (persist) {
269
+ this.sendPatch([{ op: 'replace', path: `/nodes/${nodeId}`, value: node }]);
270
+ }
271
+ this.emit('nodeUpdated', nodeId, node);
272
+ }
273
+ /**
274
+ * Delete nodes by IDs.
275
+ * Also removes any edges connected to the deleted nodes.
276
+ */
277
+ deleteNodes(nodeIds) {
278
+ const patch = [];
279
+ const nodeIdSet = new Set(nodeIds);
280
+ // Remove edges connected to any deleted node
281
+ for (const [edgeId, edge] of Object.entries(this._data.edges)) {
282
+ const hasDeletedSource = edge.sources.some(s => nodeIdSet.has(s));
283
+ const hasDeletedTarget = edge.targets.some(t => nodeIdSet.has(t));
284
+ if (hasDeletedSource || hasDeletedTarget) {
285
+ delete this._data.edges[edgeId];
286
+ patch.push({ op: 'remove', path: `/edges/${edgeId}` });
287
+ }
288
+ }
289
+ // Remove nodes
290
+ for (const nodeId of nodeIds) {
291
+ if (this._data.nodes[nodeId]) {
292
+ delete this._data.nodes[nodeId];
293
+ patch.push({ op: 'remove', path: `/nodes/${nodeId}` });
294
+ }
295
+ }
296
+ if (patch.length > 0) {
297
+ this.sendPatch(patch);
298
+ this.emit('nodesDeleted', nodeIds);
299
+ }
300
+ }
301
+ // ===========================================================================
302
+ // Edge Operations
303
+ // ===========================================================================
304
+ /**
305
+ * Create an edge between nodes.
306
+ * @returns The generated edge ID
307
+ */
308
+ linkNodes(sourceId, targetId, edgeType) {
309
+ const edgeId = generateEntityId();
310
+ const edge = {
311
+ sources: [sourceId],
312
+ targets: [targetId],
313
+ type: edgeType,
314
+ _meta: {},
315
+ };
316
+ this._data.edges[edgeId] = edge;
317
+ this.sendPatch([{ op: 'add', path: `/edges/${edgeId}`, value: edge }]);
318
+ this.emit('edgeAdded', edgeId, edge);
319
+ return edgeId;
320
+ }
321
+ /**
322
+ * Remove edges between two nodes.
323
+ * @returns true if any edges were removed
324
+ */
325
+ unlinkNodes(sourceId, targetId) {
326
+ const patch = [];
327
+ const removedEdgeIds = [];
328
+ for (const [edgeId, edge] of Object.entries(this._data.edges)) {
329
+ if (edge.sources.includes(sourceId) && edge.targets.includes(targetId)) {
330
+ delete this._data.edges[edgeId];
331
+ patch.push({ op: 'remove', path: `/edges/${edgeId}` });
332
+ removedEdgeIds.push(edgeId);
333
+ }
334
+ }
335
+ if (patch.length > 0) {
336
+ this.sendPatch(patch);
337
+ for (const edgeId of removedEdgeIds) {
338
+ this.emit('edgeRemoved', edgeId);
339
+ }
340
+ return true;
341
+ }
342
+ return false;
343
+ }
344
+ /**
345
+ * Get parent node IDs (nodes that have edges pointing TO this node).
346
+ * @param edgeType - Optional filter by edge type
347
+ */
348
+ getParents(nodeId, edgeType) {
349
+ return Object.values(this._data.edges)
350
+ .filter(edge => edge.targets.includes(nodeId) &&
351
+ (!edgeType || edge.type === edgeType))
352
+ .flatMap(edge => edge.sources);
353
+ }
354
+ /**
355
+ * Get child node IDs (nodes that this node has edges pointing TO).
356
+ * @param edgeType - Optional filter by edge type
357
+ */
358
+ getChildren(nodeId, edgeType) {
359
+ return Object.values(this._data.edges)
360
+ .filter(edge => edge.sources.includes(nodeId) &&
361
+ (!edgeType || edge.type === edgeType))
362
+ .flatMap(edge => edge.targets);
363
+ }
364
+ /**
365
+ * Get an edge by ID.
366
+ */
367
+ getEdge(edgeId) {
368
+ return this._data.edges[edgeId];
369
+ }
370
+ /**
371
+ * Get all edge IDs.
372
+ */
373
+ getEdgeIds() {
374
+ return Object.keys(this._data.edges);
375
+ }
376
+ // ===========================================================================
377
+ // Metadata Operations
378
+ // ===========================================================================
379
+ /**
380
+ * Set a metadata value.
381
+ * Metadata is stored in _meta and hidden from AI operations.
382
+ */
383
+ setMetadata(key, value) {
384
+ if (!this._data._meta) {
385
+ this._data._meta = {};
386
+ }
387
+ this._data._meta[key] = value;
388
+ this.sendPatch([{ op: 'replace', path: '/_meta', value: this._data._meta }]);
389
+ }
390
+ /**
391
+ * Get a metadata value.
392
+ */
393
+ getMetadata(key) {
394
+ return this._data._meta?.[key];
395
+ }
396
+ /**
397
+ * Get all metadata.
398
+ */
399
+ getAllMetadata() {
400
+ return this._data._meta ?? {};
401
+ }
402
+ // ===========================================================================
403
+ // AI Operations
404
+ // ===========================================================================
405
+ /**
406
+ * Send a prompt to the AI agent for graph manipulation.
407
+ */
408
+ async prompt(prompt, options) {
409
+ return this.graphqlClient.promptGraph(this._id, prompt, options);
410
+ }
411
+ /**
412
+ * Generate an AI image.
413
+ */
414
+ async generateImage(prompt, aspectRatio) {
415
+ return this.graphqlClient.generateImage(this._id, prompt, aspectRatio);
416
+ }
417
+ /**
418
+ * Edit an existing image using AI.
419
+ */
420
+ async editImage(prompt, url) {
421
+ return this.graphqlClient.editImage(this._id, prompt, url);
422
+ }
423
+ // ===========================================================================
424
+ // Collaboration
425
+ // ===========================================================================
426
+ /**
427
+ * List users with access to this graph.
428
+ */
429
+ async listUsers() {
430
+ return this.graphqlClient.listGraphUsers(this._id);
431
+ }
432
+ /**
433
+ * Add a user to this graph with specified role.
434
+ */
435
+ async addUser(userId, role) {
436
+ return this.graphqlClient.addGraphUser(this._id, userId, role);
437
+ }
438
+ /**
439
+ * Remove a user from this graph.
440
+ */
441
+ async removeUser(userId) {
442
+ return this.graphqlClient.removeGraphUser(this._id, userId);
443
+ }
444
+ // ===========================================================================
445
+ // Media Operations
446
+ // ===========================================================================
447
+ /**
448
+ * List all media files for this graph.
449
+ */
450
+ async listMedia() {
451
+ return this.mediaClient.list(this._id);
452
+ }
453
+ /**
454
+ * Upload a file to this graph.
455
+ */
456
+ async uploadMedia(file) {
457
+ return this.mediaClient.upload(this._id, file);
458
+ }
459
+ /**
460
+ * Get the URL for a media file.
461
+ */
462
+ getMediaUrl(uuid) {
463
+ return this.mediaClient.getUrl(this._id, uuid);
464
+ }
465
+ /**
466
+ * Download a media file as a Blob.
467
+ */
468
+ async downloadMedia(uuid) {
469
+ return this.mediaClient.download(this._id, uuid);
470
+ }
471
+ /**
472
+ * Delete a media file.
473
+ */
474
+ async deleteMedia(uuid) {
475
+ return this.mediaClient.delete(this._id, uuid);
476
+ }
477
+ // ===========================================================================
478
+ // Low-level Operations
479
+ // ===========================================================================
480
+ /**
481
+ * Get the full graph data.
482
+ * Use sparingly - prefer specific operations.
483
+ */
484
+ getData() {
485
+ return this._data;
486
+ }
487
+ /**
488
+ * Apply a raw JSON patch.
489
+ * Use sparingly - prefer semantic operations.
490
+ */
491
+ patch(operations) {
492
+ try {
493
+ this._data = immutableJSONPatch(this._data, operations);
494
+ }
495
+ catch (error) {
496
+ console.error('[Graph] Failed to apply patch:', error);
497
+ return;
498
+ }
499
+ this.sendPatch(operations);
500
+ this.emit('changed', this._data);
501
+ }
502
+ // ===========================================================================
503
+ // Event Handlers (called by RoolClient for routing)
504
+ // ===========================================================================
505
+ /**
506
+ * Handle a patch event from another client.
507
+ * @internal
508
+ */
509
+ handleRemotePatch(patch) {
510
+ try {
511
+ this._data = immutableJSONPatch(this._data, patch);
512
+ }
513
+ catch (error) {
514
+ console.error('[Graph] Failed to apply remote patch:', error);
515
+ return;
516
+ }
517
+ // Clear undo history on external change
518
+ this.clearHistory();
519
+ this.emit('changed', this._data);
520
+ }
521
+ /**
522
+ * Handle a full graph reload from server.
523
+ * @internal
524
+ */
525
+ handleRemoteChange(newData) {
526
+ this._data = newData;
527
+ this.clearHistory();
528
+ this.emit('changed', this._data);
529
+ }
530
+ /**
531
+ * Update the name from external source.
532
+ * @internal
533
+ */
534
+ handleRemoteRename(newName) {
535
+ this._name = newName;
536
+ }
537
+ // ===========================================================================
538
+ // Private Methods
539
+ // ===========================================================================
540
+ sendPatch(patch) {
541
+ this.pendingPatch.push(...patch);
542
+ if (!this.patchScheduled) {
543
+ this.patchScheduled = true;
544
+ queueMicrotask(() => {
545
+ const batch = this.pendingPatch;
546
+ this.pendingPatch = [];
547
+ this.patchScheduled = false;
548
+ if (batch.length > 0) {
549
+ this.graphqlClient.patch(this._id, batch).catch((error) => {
550
+ console.error('[Graph] Failed to send patch:', error);
551
+ this.resyncFromServer(error instanceof Error ? error : new Error(String(error)));
552
+ });
553
+ }
554
+ });
555
+ }
556
+ }
557
+ async resyncFromServer(originalError) {
558
+ console.warn('[Graph] Resyncing from server after sync failure');
559
+ try {
560
+ const freshData = await this.graphqlClient.getGraph(this._id);
561
+ this._data = freshData;
562
+ this.clearHistory();
563
+ this.emit('syncError', originalError ?? new Error('Sync failed'));
564
+ this.emit('changed', this._data);
565
+ }
566
+ catch (error) {
567
+ console.error('[Graph] Failed to resync from server:', error);
568
+ // Still emit syncError with the original error
569
+ this.emit('syncError', originalError ?? new Error('Sync failed'));
570
+ }
571
+ }
572
+ }
573
+ //# sourceMappingUR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BACnF,CAAC,CAAC,CAAC;gBACL,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,aAAqB;QAClD,OAAO,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;QACjE,IAAI,CAAC;YACH,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC9D,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;YACvB,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;YAClE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;YAC9D,+CAA+C;YAC/C,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,33 @@
1
+ import type { RoolGraphData, RoolGraphInfo, JSONPatchOp, Account, UserResult, RoolGraphUser, PromptOptions, ImageResult, ImageAspectRatio } from './types.js';
2
+ import type { AuthManager } from './auth.js';
3
+ export interface GraphQLClientConfig {
4
+ baseUrl: string;
5
+ authManager: AuthManager;
6
+ getConnectionId: () => string;
7
+ }
8
+ export declare class GraphQLClient {
9
+ private config;
10
+ constructor(config: GraphQLClientConfig);
11
+ private get graphqlUrl();
12
+ listGraphs(): Promise<RoolGraphInfo[]>;
13
+ getGraph(graphId: string): Promise<RoolGraphData>;
14
+ setGraph(graphId: string, graph: RoolGraphData): Promise<void>;
15
+ deleteGraph(graphId: string): Promise<void>;
16
+ renameGraph(graphId: string, name: string): Promise<void>;
17
+ patch(graphId: string, patch: JSONPatchOp[]): Promise<void>;
18
+ promptGraph(graphId: string, prompt: string, options?: PromptOptions): Promise<string | null>;
19
+ generateImage(graphId: string, prompt: string, aspectRatio?: ImageAspectRatio): Promise<ImageResult>;
20
+ editImage(graphId: string, prompt: string, url: string): Promise<ImageResult>;
21
+ getAccount(): Promise<Account>;
22
+ searchUser(email: string): Promise<UserResult | null>;
23
+ listGraphUsers(graphId: string): Promise<RoolGraphUser[]>;
24
+ addGraphUser(graphId: string, userId: string, role: string): Promise<void>;
25
+ removeGraphUser(graphId: string, userId: string): Promise<void>;
26
+ /**
27
+ * Execute an arbitrary GraphQL query or mutation.
28
+ * Use this for app-specific operations not covered by the typed methods.
29
+ */
30
+ query<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
31
+ private request;
32
+ }
33
+ //# sourceMappingURL=graphql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql.d.ts","sourceRoot":"","sources":["../src/graphql.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,OAAO,EACP,UAAU,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAI7C,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;IACzB,eAAe,EAAE,MAAM,MAAM,CAAC;CAC/B;AAOD,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAsB;gBAExB,MAAM,EAAE,mBAAmB;IAIvC,OAAO,KAAK,UAAU,GAErB;IAMK,UAAU,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;IActC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAUjD,QAAQ,CAAC,OAAO,EAAE,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