@hexaijs/plugin-contracts-generator 0.1.1 → 0.2.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/README.md +5 -2
- package/dist/cli-CPg-O4OY.d.ts +214 -0
- package/dist/cli.d.ts +1 -35
- package/dist/cli.js +2479 -232
- package/dist/cli.js.map +1 -1
- package/dist/decorators/index.d.ts +12 -11
- package/dist/decorators/index.js +21 -116
- package/dist/decorators/index.js.map +1 -1
- package/dist/index.d.ts +533 -40
- package/dist/index.js +2738 -91
- package/dist/index.js.map +1 -1
- package/dist/runtime/index.d.ts +23 -2
- package/dist/runtime/index.js +38 -5
- package/dist/runtime/index.js.map +1 -1
- package/package.json +10 -14
- package/dist/ast-utils.d.ts +0 -6
- package/dist/ast-utils.d.ts.map +0 -1
- package/dist/ast-utils.js +0 -111
- package/dist/ast-utils.js.map +0 -1
- package/dist/class-analyzer.d.ts +0 -16
- package/dist/class-analyzer.d.ts.map +0 -1
- package/dist/class-analyzer.js +0 -155
- package/dist/class-analyzer.js.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/config-loader.d.ts +0 -34
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/config-loader.js +0 -188
- package/dist/config-loader.js.map +0 -1
- package/dist/decorators/index.d.ts.map +0 -1
- package/dist/domain/index.d.ts +0 -2
- package/dist/domain/index.d.ts.map +0 -1
- package/dist/domain/index.js +0 -18
- package/dist/domain/index.js.map +0 -1
- package/dist/domain/types.d.ts +0 -182
- package/dist/domain/types.d.ts.map +0 -1
- package/dist/domain/types.js +0 -65
- package/dist/domain/types.js.map +0 -1
- package/dist/errors.d.ts +0 -79
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -138
- package/dist/errors.js.map +0 -1
- package/dist/file-copier.d.ts +0 -84
- package/dist/file-copier.d.ts.map +0 -1
- package/dist/file-copier.js +0 -758
- package/dist/file-copier.js.map +0 -1
- package/dist/file-graph-resolver.d.ts +0 -47
- package/dist/file-graph-resolver.d.ts.map +0 -1
- package/dist/file-graph-resolver.js +0 -230
- package/dist/file-graph-resolver.js.map +0 -1
- package/dist/file-system.d.ts +0 -26
- package/dist/file-system.d.ts.map +0 -1
- package/dist/file-system.js +0 -34
- package/dist/file-system.js.map +0 -1
- package/dist/hexai-plugin.d.ts +0 -16
- package/dist/hexai-plugin.d.ts.map +0 -1
- package/dist/hexai-plugin.js +0 -59
- package/dist/hexai-plugin.js.map +0 -1
- package/dist/import-analyzer.d.ts +0 -6
- package/dist/import-analyzer.d.ts.map +0 -1
- package/dist/import-analyzer.js +0 -77
- package/dist/import-analyzer.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/logger.d.ts +0 -21
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js +0 -47
- package/dist/logger.js.map +0 -1
- package/dist/parser.d.ts +0 -32
- package/dist/parser.d.ts.map +0 -1
- package/dist/parser.js +0 -209
- package/dist/parser.js.map +0 -1
- package/dist/pipeline.d.ts +0 -56
- package/dist/pipeline.d.ts.map +0 -1
- package/dist/pipeline.js +0 -152
- package/dist/pipeline.js.map +0 -1
- package/dist/reexport-generator.d.ts +0 -81
- package/dist/reexport-generator.d.ts.map +0 -1
- package/dist/reexport-generator.js +0 -208
- package/dist/reexport-generator.js.map +0 -1
- package/dist/registry-generator.d.ts +0 -27
- package/dist/registry-generator.d.ts.map +0 -1
- package/dist/registry-generator.js +0 -108
- package/dist/registry-generator.js.map +0 -1
- package/dist/runtime/index.d.ts.map +0 -1
- package/dist/runtime/message-registry.d.ts +0 -23
- package/dist/runtime/message-registry.d.ts.map +0 -1
- package/dist/runtime/message-registry.js +0 -39
- package/dist/runtime/message-registry.js.map +0 -1
- package/dist/scanner.d.ts +0 -21
- package/dist/scanner.d.ts.map +0 -1
- package/dist/scanner.js +0 -53
- package/dist/scanner.js.map +0 -1
- package/dist/test-utils.d.ts +0 -23
- package/dist/test-utils.d.ts.map +0 -1
- package/dist/test-utils.js +0 -198
- package/dist/test-utils.js.map +0 -1
- package/dist/tsconfig-loader.d.ts +0 -8
- package/dist/tsconfig-loader.d.ts.map +0 -1
- package/dist/tsconfig-loader.js +0 -64
- package/dist/tsconfig-loader.js.map +0 -1
package/dist/test-utils.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSourceFile = createSourceFile;
|
|
4
|
-
exports.createTypeDefinition = createTypeDefinition;
|
|
5
|
-
exports.createEventWithReferenceField = createEventWithReferenceField;
|
|
6
|
-
exports.createCommandWithReferenceField = createCommandWithReferenceField;
|
|
7
|
-
exports.createEventWithPrimitiveField = createEventWithPrimitiveField;
|
|
8
|
-
exports.createField = createField;
|
|
9
|
-
exports.createClassDefinition = createClassDefinition;
|
|
10
|
-
exports.createInMemoryFileSystem = createInMemoryFileSystem;
|
|
11
|
-
function createSourceFile(path = "test.ts", absolutePath) {
|
|
12
|
-
return {
|
|
13
|
-
absolutePath: absolutePath ?? `/project/src/${path}`,
|
|
14
|
-
relativePath: path,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function isSourceFile(obj) {
|
|
18
|
-
return (typeof obj === "object" &&
|
|
19
|
-
obj !== null &&
|
|
20
|
-
"absolutePath" in obj &&
|
|
21
|
-
"relativePath" in obj);
|
|
22
|
-
}
|
|
23
|
-
function isTypeRefBody(obj) {
|
|
24
|
-
return typeof obj === "object" && obj !== null && "kind" in obj;
|
|
25
|
-
}
|
|
26
|
-
function createTypeDefinition(name, sourceFileOrBody, bodyArg) {
|
|
27
|
-
let sourceFile;
|
|
28
|
-
let body;
|
|
29
|
-
if (sourceFileOrBody === undefined) {
|
|
30
|
-
// createTypeDefinition(name)
|
|
31
|
-
sourceFile = createSourceFile(`${name}.ts`);
|
|
32
|
-
body = { kind: "primitive", name: "string" };
|
|
33
|
-
}
|
|
34
|
-
else if (isSourceFile(sourceFileOrBody)) {
|
|
35
|
-
// createTypeDefinition(name, sourceFile) or createTypeDefinition(name, sourceFile, body)
|
|
36
|
-
sourceFile = sourceFileOrBody;
|
|
37
|
-
body =
|
|
38
|
-
bodyArg ?? { kind: "primitive", name: "string" };
|
|
39
|
-
}
|
|
40
|
-
else if (isTypeRefBody(sourceFileOrBody)) {
|
|
41
|
-
// createTypeDefinition(name, body)
|
|
42
|
-
sourceFile = createSourceFile(`${name}.ts`);
|
|
43
|
-
body = sourceFileOrBody;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
// Fallback to defaults
|
|
47
|
-
sourceFile = createSourceFile(`${name}.ts`);
|
|
48
|
-
body = { kind: "primitive", name: "string" };
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
name,
|
|
52
|
-
kind: "type",
|
|
53
|
-
sourceFile,
|
|
54
|
-
body,
|
|
55
|
-
exported: true,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
function createEventWithReferenceField(eventName, fieldName, referencedTypeName) {
|
|
59
|
-
return {
|
|
60
|
-
messageType: "event",
|
|
61
|
-
name: eventName,
|
|
62
|
-
sourceFile: createSourceFile("events.ts"),
|
|
63
|
-
fields: [
|
|
64
|
-
{
|
|
65
|
-
name: fieldName,
|
|
66
|
-
type: {
|
|
67
|
-
kind: "reference",
|
|
68
|
-
name: referencedTypeName,
|
|
69
|
-
},
|
|
70
|
-
optional: false,
|
|
71
|
-
readonly: true,
|
|
72
|
-
},
|
|
73
|
-
],
|
|
74
|
-
sourceText: `export class ${eventName} extends Message<{ ${fieldName}: ${referencedTypeName} }> {}`,
|
|
75
|
-
imports: [],
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
function createCommandWithReferenceField(commandName, fieldName, referencedTypeName) {
|
|
79
|
-
return {
|
|
80
|
-
messageType: "command",
|
|
81
|
-
name: commandName,
|
|
82
|
-
sourceFile: createSourceFile("commands.ts"),
|
|
83
|
-
fields: [
|
|
84
|
-
{
|
|
85
|
-
name: fieldName,
|
|
86
|
-
type: {
|
|
87
|
-
kind: "reference",
|
|
88
|
-
name: referencedTypeName,
|
|
89
|
-
},
|
|
90
|
-
optional: false,
|
|
91
|
-
readonly: true,
|
|
92
|
-
},
|
|
93
|
-
],
|
|
94
|
-
sourceText: `export class ${commandName} extends Message<{ ${fieldName}: ${referencedTypeName} }> {}`,
|
|
95
|
-
imports: [],
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
function createEventWithPrimitiveField(eventName, fieldName, primitiveName) {
|
|
99
|
-
return {
|
|
100
|
-
messageType: "event",
|
|
101
|
-
name: eventName,
|
|
102
|
-
sourceFile: createSourceFile("events.ts"),
|
|
103
|
-
fields: [
|
|
104
|
-
{
|
|
105
|
-
name: fieldName,
|
|
106
|
-
type: {
|
|
107
|
-
kind: "primitive",
|
|
108
|
-
name: primitiveName,
|
|
109
|
-
},
|
|
110
|
-
optional: false,
|
|
111
|
-
readonly: true,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
sourceText: `export class ${eventName} extends Message<{ ${fieldName}: ${primitiveName} }> {}`,
|
|
115
|
-
imports: [],
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function createField(name, type, optional = false, readonly = false) {
|
|
119
|
-
return {
|
|
120
|
-
name,
|
|
121
|
-
type,
|
|
122
|
-
optional,
|
|
123
|
-
readonly,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function createClassDefinition(name, options = {}) {
|
|
127
|
-
const sourceFile = options.sourceFile ?? createSourceFile(`${name}.ts`);
|
|
128
|
-
const sourceText = options.sourceText ?? `export class ${name} { constructor() {} }`;
|
|
129
|
-
return {
|
|
130
|
-
name,
|
|
131
|
-
kind: "class",
|
|
132
|
-
sourceFile,
|
|
133
|
-
sourceText,
|
|
134
|
-
imports: options.imports ?? [],
|
|
135
|
-
dependencies: options.dependencies ?? [],
|
|
136
|
-
baseClass: options.baseClass,
|
|
137
|
-
exported: options.exported ?? true,
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
function createInMemoryFileSystem() {
|
|
141
|
-
const files = new Map();
|
|
142
|
-
const directories = new Set();
|
|
143
|
-
return {
|
|
144
|
-
files,
|
|
145
|
-
directories,
|
|
146
|
-
async readFile(filePath) {
|
|
147
|
-
const content = files.get(filePath);
|
|
148
|
-
if (content === undefined) {
|
|
149
|
-
throw new Error(`File not found: ${filePath}`);
|
|
150
|
-
}
|
|
151
|
-
return content;
|
|
152
|
-
},
|
|
153
|
-
async readdir(dirPath) {
|
|
154
|
-
const entries = [];
|
|
155
|
-
const normalizedDir = dirPath.endsWith("/") ? dirPath : dirPath + "/";
|
|
156
|
-
for (const filePath of files.keys()) {
|
|
157
|
-
if (filePath.startsWith(normalizedDir)) {
|
|
158
|
-
const relativePath = filePath.slice(normalizedDir.length);
|
|
159
|
-
const firstPart = relativePath.split("/")[0];
|
|
160
|
-
if (firstPart && !entries.includes(firstPart)) {
|
|
161
|
-
entries.push(firstPart);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
for (const dir of directories) {
|
|
166
|
-
if (dir.startsWith(normalizedDir)) {
|
|
167
|
-
const relativePath = dir.slice(normalizedDir.length);
|
|
168
|
-
const firstPart = relativePath.split("/")[0];
|
|
169
|
-
if (firstPart && !entries.includes(firstPart)) {
|
|
170
|
-
entries.push(firstPart);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return entries;
|
|
175
|
-
},
|
|
176
|
-
async writeFile(filePath, content) {
|
|
177
|
-
files.set(filePath, content);
|
|
178
|
-
},
|
|
179
|
-
async mkdir(dirPath, _options) {
|
|
180
|
-
directories.add(dirPath);
|
|
181
|
-
},
|
|
182
|
-
async exists(filePath) {
|
|
183
|
-
return files.has(filePath) || directories.has(filePath);
|
|
184
|
-
},
|
|
185
|
-
async stat(filePath) {
|
|
186
|
-
const isDir = directories.has(filePath);
|
|
187
|
-
const isFile = files.has(filePath);
|
|
188
|
-
if (!isDir && !isFile) {
|
|
189
|
-
throw new Error(`Path not found: ${filePath}`);
|
|
190
|
-
}
|
|
191
|
-
return {
|
|
192
|
-
isDirectory: () => isDir,
|
|
193
|
-
isFile: () => isFile,
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
//# sourceMappingURL=test-utils.js.map
|
package/dist/test-utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":";;AAeA,4CAQC;AAeD,oDAkCC;AAED,sEAuBC;AAED,0EAuBC;AAED,sEAuBC;AAED,kCAYC;AAWD,sDAkBC;AAOD,4DAqEC;AA3PD,SAAgB,gBAAgB,CAC5B,OAAe,SAAS,EACxB,YAAqB;IAErB,OAAO;QACH,YAAY,EAAE,YAAY,IAAI,gBAAgB,IAAI,EAAE;QACpD,YAAY,EAAE,IAAI;KACrB,CAAC;AACN,CAAC;AAED,SAAS,YAAY,CAAC,GAAY;IAC9B,OAAO,CACH,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,cAAc,IAAI,GAAG;QACrB,cAAc,IAAI,GAAG,CACxB,CAAC;AACN,CAAC;AAED,SAAS,aAAa,CAAC,GAAY;IAC/B,OAAO,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,IAAI,MAAM,IAAI,GAAG,CAAC;AACpE,CAAC;AAED,SAAgB,oBAAoB,CAChC,IAAY,EACZ,gBAAsD,EACtD,OAAgC;IAEhC,IAAI,UAAsB,CAAC;IAC3B,IAAI,IAA4B,CAAC;IAEjC,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACjC,6BAA6B;QAC7B,UAAU,GAAG,gBAAgB,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC;QAC5C,IAAI,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAm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gBACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAC;YACnD,CAAC;YAED,OAAO;gBACH,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK;gBACxB,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM;aACvB,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-loader.d.ts","sourceRoot":"","sources":["../src/tsconfig-loader.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACzC;AAED,qBAAa,cAAc;IACjB,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAwC7D"}
|
package/dist/tsconfig-loader.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.TsconfigLoader = void 0;
|
|
37
|
-
const ts = __importStar(require("typescript"));
|
|
38
|
-
const path_1 = require("path");
|
|
39
|
-
class TsconfigLoader {
|
|
40
|
-
async load(tsconfigPath) {
|
|
41
|
-
const absolutePath = (0, path_1.resolve)(tsconfigPath);
|
|
42
|
-
const configDir = (0, path_1.dirname)(absolutePath);
|
|
43
|
-
const parsed = ts.getParsedCommandLineOfConfigFile(absolutePath, {}, {
|
|
44
|
-
...ts.sys,
|
|
45
|
-
onUnRecoverableConfigFileDiagnostic: (diagnostic) => {
|
|
46
|
-
throw new Error(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
if (!parsed) {
|
|
50
|
-
throw new Error(`Failed to parse tsconfig: ${absolutePath}`);
|
|
51
|
-
}
|
|
52
|
-
const baseUrl = parsed.options.baseUrl ?? configDir;
|
|
53
|
-
const paths = new Map();
|
|
54
|
-
if (parsed.options.paths) {
|
|
55
|
-
for (const [alias, targets] of Object.entries(parsed.options.paths)) {
|
|
56
|
-
const resolvedTargets = targets.map((target) => (0, path_1.join)(baseUrl, target));
|
|
57
|
-
paths.set(alias, resolvedTargets);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return { baseUrl, paths };
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.TsconfigLoader = TsconfigLoader;
|
|
64
|
-
//# sourceMappingURL=tsconfig-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tsconfig-loader.js","sourceRoot":"","sources":["../src/tsconfig-loader.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,+BAA8C;AAO9C,MAAa,cAAc;IACvB,KAAK,CAAC,IAAI,CAAC,YAAoB;QAC3B,MAAM,YAAY,GAAG,IAAA,cAAO,EAAC,YAAY,CAAC,CAAC;QAC3C,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,YAAY,CAAC,CAAC;QAExC,MAAM,MAAM,GAAG,EAAE,CAAC,gCAAgC,CAC9C,YAAY,EACZ,EAAE,EACF;YACI,GAAG,EAAE,CAAC,GAAG;YACT,mCAAmC,EAAE,CAAC,UAAU,EAAE,EAAE;gBAChD,MAAM,IAAI,KAAK,CACX,EAAE,CAAC,4BAA4B,CAC3B,UAAU,CAAC,WAAW,EACtB,IAAI,CACP,CACJ,CAAC;YACN,CAAC;SACJ,CACJ,CAAC;QAEF,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,6BAA6B,YAAY,EAAE,CAAC,CAAC;QACjE,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,GAAG,EAAoB,CAAC;QAE1C,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACvB,KAAK,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CACzC,MAAM,CAAC,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