@empline/preflight 1.1.48 → 1.1.50
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/bin/init.d.ts +18 -0
- package/dist/bin/init.d.ts.map +1 -0
- package/dist/bin/init.js +369 -0
- package/dist/bin/init.js.map +1 -0
- package/dist/bin/preflight.js +201 -0
- package/dist/bin/preflight.js.map +1 -1
- package/dist/bin/preinstall.js +7 -0
- package/dist/bin/preinstall.js.map +1 -1
- package/dist/checks/react/nextjs-optimization.d.ts +42 -0
- package/dist/checks/react/nextjs-optimization.d.ts.map +1 -0
- package/dist/checks/react/nextjs-optimization.js +415 -0
- package/dist/checks/react/nextjs-optimization.js.map +1 -0
- package/dist/checks/react/vercel-react-best-practices.d.ts +38 -0
- package/dist/checks/react/vercel-react-best-practices.d.ts.map +1 -0
- package/dist/checks/react/vercel-react-best-practices.js +548 -0
- package/dist/checks/react/vercel-react-best-practices.js.map +1 -0
- package/dist/checks/system/preflight-actionable-output.d.ts +18 -0
- package/dist/checks/system/preflight-actionable-output.d.ts.map +1 -0
- package/dist/checks/system/preflight-actionable-output.js +216 -0
- package/dist/checks/system/preflight-actionable-output.js.map +1 -0
- package/dist/checks/ui/web-design-guidelines.d.ts +37 -0
- package/dist/checks/ui/web-design-guidelines.d.ts.map +1 -0
- package/dist/checks/ui/web-design-guidelines.js +545 -0
- package/dist/checks/ui/web-design-guidelines.js.map +1 -0
- package/dist/lib/activation.d.ts +18 -0
- package/dist/lib/activation.d.ts.map +1 -0
- package/dist/lib/activation.js +283 -0
- package/dist/lib/activation.js.map +1 -0
- package/dist/lib/ai-commands.d.ts +72 -0
- package/dist/lib/ai-commands.d.ts.map +1 -0
- package/dist/lib/ai-commands.js +393 -0
- package/dist/lib/ai-commands.js.map +1 -0
- package/dist/runner.d.ts +18 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +66 -8
- package/dist/runner.js.map +1 -1
- package/dist/utils/console-chars.d.ts +6 -6
- package/package.json +2 -1
- package/templates/domain-specific/trading-card-system/missing-page-layout.ts +377 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* License Activation Module
|
|
4
|
+
*
|
|
5
|
+
* Validates license with API and manages grace period.
|
|
6
|
+
* If activation fails beyond grace period, silently self-destructs.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.checkActivation = checkActivation;
|
|
43
|
+
exports.initializeActivation = initializeActivation;
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const path = __importStar(require("node:path"));
|
|
46
|
+
// =============================================================================
|
|
47
|
+
// CONSTANTS
|
|
48
|
+
// =============================================================================
|
|
49
|
+
const LICENSE_FILE = ".preflight-license";
|
|
50
|
+
const GRACE_PERIOD_DAYS = 30;
|
|
51
|
+
const GRACE_PERIOD_MS = GRACE_PERIOD_DAYS * 24 * 60 * 60 * 1000;
|
|
52
|
+
// API endpoint for license validation
|
|
53
|
+
const ACTIVATION_API_URL = process.env.PREFLIGHT_ACTIVATION_URL || "https://empline.com/api/preflight/validate";
|
|
54
|
+
// =============================================================================
|
|
55
|
+
// HELPERS
|
|
56
|
+
// =============================================================================
|
|
57
|
+
/**
|
|
58
|
+
* Get the path to the license state file.
|
|
59
|
+
* Stored in the package directory itself.
|
|
60
|
+
*/
|
|
61
|
+
function getLicenseFilePath() {
|
|
62
|
+
return path.join(__dirname, "..", "..", LICENSE_FILE);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Load the current license state from disk.
|
|
66
|
+
*/
|
|
67
|
+
function loadLicenseState() {
|
|
68
|
+
const filePath = getLicenseFilePath();
|
|
69
|
+
try {
|
|
70
|
+
if (fs.existsSync(filePath)) {
|
|
71
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
72
|
+
return JSON.parse(content);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
// Corrupted file, treat as no state
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Save the license state to disk.
|
|
82
|
+
*/
|
|
83
|
+
function saveLicenseState(state) {
|
|
84
|
+
const filePath = getLicenseFilePath();
|
|
85
|
+
try {
|
|
86
|
+
fs.writeFileSync(filePath, JSON.stringify(state, null, 2), "utf-8");
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
// Silently fail - don't interrupt operation
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Check if we're within the grace period since last successful check.
|
|
94
|
+
*/
|
|
95
|
+
function isWithinGracePeriod(lastSuccessfulCheck) {
|
|
96
|
+
const lastCheck = new Date(lastSuccessfulCheck).getTime();
|
|
97
|
+
const now = Date.now();
|
|
98
|
+
return now - lastCheck < GRACE_PERIOD_MS;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Get the package directory path.
|
|
102
|
+
* This is the directory that will be deleted on deactivation.
|
|
103
|
+
*/
|
|
104
|
+
function getPackageDirectory() {
|
|
105
|
+
// __dirname is dist/lib, package root is two levels up
|
|
106
|
+
return path.resolve(__dirname, "..", "..");
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Silently remove the package directory.
|
|
110
|
+
*/
|
|
111
|
+
async function selfDestruct() {
|
|
112
|
+
const packageDir = getPackageDirectory();
|
|
113
|
+
// Safety check - make sure we're deleting a preflight package
|
|
114
|
+
const packageJsonPath = path.join(packageDir, "package.json");
|
|
115
|
+
try {
|
|
116
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
117
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
118
|
+
if (pkg.name !== "@empline/preflight") {
|
|
119
|
+
// Not our package, abort
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// No package.json, abort for safety
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch {
|
|
129
|
+
// Can't verify, abort for safety
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// Perform the deletion
|
|
133
|
+
try {
|
|
134
|
+
fs.rmSync(packageDir, { recursive: true, force: true });
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
// Silently fail - might be locked or permission issues
|
|
138
|
+
}
|
|
139
|
+
// Exit the process silently
|
|
140
|
+
process.exit(0);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get the current project path.
|
|
144
|
+
*/
|
|
145
|
+
function getProjectPath() {
|
|
146
|
+
return process.cwd();
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Get the machine hostname.
|
|
150
|
+
*/
|
|
151
|
+
function getMachineName() {
|
|
152
|
+
try {
|
|
153
|
+
return require("node:os").hostname();
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return "unknown";
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Validate license with the API.
|
|
161
|
+
*/
|
|
162
|
+
async function validateWithApi(licenseKey) {
|
|
163
|
+
try {
|
|
164
|
+
const controller = new AbortController();
|
|
165
|
+
const timeout = setTimeout(() => controller.abort(), 10000); // 10s timeout
|
|
166
|
+
const response = await fetch(ACTIVATION_API_URL, {
|
|
167
|
+
method: "POST",
|
|
168
|
+
headers: {
|
|
169
|
+
"Content-Type": "application/json",
|
|
170
|
+
"X-License-Key": licenseKey,
|
|
171
|
+
},
|
|
172
|
+
body: JSON.stringify({
|
|
173
|
+
key: licenseKey,
|
|
174
|
+
package: "@empline/preflight",
|
|
175
|
+
projectPath: getProjectPath(),
|
|
176
|
+
machineName: getMachineName(),
|
|
177
|
+
timestamp: new Date().toISOString(),
|
|
178
|
+
}),
|
|
179
|
+
signal: controller.signal,
|
|
180
|
+
});
|
|
181
|
+
clearTimeout(timeout);
|
|
182
|
+
if (response.ok) {
|
|
183
|
+
const data = await response.json();
|
|
184
|
+
return {
|
|
185
|
+
valid: data.valid === true,
|
|
186
|
+
reason: data.reason,
|
|
187
|
+
expiresAt: data.expiresAt,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
// Non-OK response
|
|
191
|
+
if (response.status === 401 || response.status === 403) {
|
|
192
|
+
// Explicitly unauthorized/forbidden = invalid license
|
|
193
|
+
return { valid: false, reason: "unauthorized" };
|
|
194
|
+
}
|
|
195
|
+
// Other errors treated as network issues (use grace period)
|
|
196
|
+
throw new Error(`HTTP ${response.status}`);
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
// Network error - return undefined to trigger grace period logic
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
// =============================================================================
|
|
204
|
+
// MAIN EXPORT
|
|
205
|
+
// =============================================================================
|
|
206
|
+
/**
|
|
207
|
+
* Check activation status.
|
|
208
|
+
* Returns true if activation is valid, false otherwise.
|
|
209
|
+
* If activation is invalid and grace period expired, triggers self-destruct.
|
|
210
|
+
*/
|
|
211
|
+
async function checkActivation() {
|
|
212
|
+
// Get license key from environment
|
|
213
|
+
const licenseKey = process.env.PREFLIGHT_LICENSE_KEY;
|
|
214
|
+
// No license key = skip activation check entirely
|
|
215
|
+
// This allows the package to work without licensing in development
|
|
216
|
+
if (!licenseKey) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
const currentState = loadLicenseState();
|
|
220
|
+
try {
|
|
221
|
+
// Attempt API validation
|
|
222
|
+
const result = await validateWithApi(licenseKey);
|
|
223
|
+
if (result.valid) {
|
|
224
|
+
// Update last successful check
|
|
225
|
+
saveLicenseState({
|
|
226
|
+
licenseKey,
|
|
227
|
+
lastSuccessfulCheck: new Date().toISOString(),
|
|
228
|
+
installPath: getPackageDirectory(),
|
|
229
|
+
});
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
// API explicitly said invalid - self-destruct
|
|
233
|
+
await selfDestruct();
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
// Network error - check grace period
|
|
238
|
+
if (currentState && currentState.licenseKey === licenseKey) {
|
|
239
|
+
if (isWithinGracePeriod(currentState.lastSuccessfulCheck)) {
|
|
240
|
+
// Within grace period, allow operation
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// No previous state or grace period expired - self-destruct
|
|
245
|
+
await selfDestruct();
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Initialize activation on first install.
|
|
251
|
+
* Called from preinstall hook.
|
|
252
|
+
*/
|
|
253
|
+
async function initializeActivation() {
|
|
254
|
+
const licenseKey = process.env.PREFLIGHT_LICENSE_KEY;
|
|
255
|
+
if (!licenseKey) {
|
|
256
|
+
// No license key during install - allow (development mode)
|
|
257
|
+
return true;
|
|
258
|
+
}
|
|
259
|
+
try {
|
|
260
|
+
const result = await validateWithApi(licenseKey);
|
|
261
|
+
if (result.valid) {
|
|
262
|
+
saveLicenseState({
|
|
263
|
+
licenseKey,
|
|
264
|
+
lastSuccessfulCheck: new Date().toISOString(),
|
|
265
|
+
installPath: getPackageDirectory(),
|
|
266
|
+
});
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
// Invalid license - block installation
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
catch {
|
|
273
|
+
// Network error during install - allow with warning
|
|
274
|
+
// Grace period starts from install time
|
|
275
|
+
saveLicenseState({
|
|
276
|
+
licenseKey,
|
|
277
|
+
lastSuccessfulCheck: new Date().toISOString(),
|
|
278
|
+
installPath: getPackageDirectory(),
|
|
279
|
+
});
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=activation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activation.js","sourceRoot":"","sources":["../../src/lib/activation.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyMH,0CA0CC;AAMD,oDAgCC;AAvRD,4CAA8B;AAC9B,gDAAk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uC;gBACvC,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QAED,4DAA4D;QAC5D,MAAM,YAAY,EAAE,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,oBAAoB;IACxC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAErD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,2DAA2D;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;QAEjD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;YACjB,gBAAgB,CAAC;gBACf,UAAU;gBACV,mBAAmB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;gBAC7C,WAAW,EAAE,mBAAmB,EAAE;aACnC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QACd,CAAC;QAED,uCAAuC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;IAAC,MAAM,CAAC;QACP,oDAAoD;QACpD,wCAAwC;QACxC,gBAAgB,CAAC;YACf,UAAU;YACV,mBAAmB,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YAC7C,WAAW,EAAE,mBAAmB,EAAE;SACnC,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-Friendly Commands for Preflight
|
|
3
|
+
*
|
|
4
|
+
* Provides commands optimized for AI consumption:
|
|
5
|
+
* - --list-categories: List all available categories
|
|
6
|
+
* - --list-checks: List all available checks
|
|
7
|
+
* - --check <name>: Run a single check by name
|
|
8
|
+
* - --explain <name>: Get detailed info about a check
|
|
9
|
+
* - --recheck <name>: Re-run a single check for verification
|
|
10
|
+
*/
|
|
11
|
+
export interface CheckInfo {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
category: string;
|
|
15
|
+
blocking: boolean;
|
|
16
|
+
description: string;
|
|
17
|
+
source: "core" | "app";
|
|
18
|
+
filePath: string;
|
|
19
|
+
requires?: string[];
|
|
20
|
+
priority?: number;
|
|
21
|
+
complexity?: "simple" | "moderate" | "complex";
|
|
22
|
+
estimatedFixTime?: string;
|
|
23
|
+
commonFixes?: string[];
|
|
24
|
+
affectedFiles?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface CategoryInfo {
|
|
27
|
+
name: string;
|
|
28
|
+
checkCount: number;
|
|
29
|
+
blockingCount: number;
|
|
30
|
+
checks: string[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Discover all available checks
|
|
34
|
+
*/
|
|
35
|
+
export declare function discoverAllChecks(checksRoot: string, appRoot?: string): Promise<CheckInfo[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Group checks by category
|
|
38
|
+
*/
|
|
39
|
+
export declare function groupByCategory(checks: CheckInfo[]): CategoryInfo[];
|
|
40
|
+
/**
|
|
41
|
+
* Find a check by name (fuzzy match)
|
|
42
|
+
*/
|
|
43
|
+
export declare function findCheck(checks: CheckInfo[], searchName: string): CheckInfo | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Find checks by category
|
|
46
|
+
*/
|
|
47
|
+
export declare function findChecksByCategory(checks: CheckInfo[], category: string): CheckInfo[];
|
|
48
|
+
/**
|
|
49
|
+
* Format check list for human output
|
|
50
|
+
*/
|
|
51
|
+
export declare function formatCheckListHuman(checks: CheckInfo[]): string;
|
|
52
|
+
/**
|
|
53
|
+
* Format check list for AI/JSON output
|
|
54
|
+
*/
|
|
55
|
+
export declare function formatCheckListAI(checks: CheckInfo[]): object;
|
|
56
|
+
/**
|
|
57
|
+
* Format category list for human output
|
|
58
|
+
*/
|
|
59
|
+
export declare function formatCategoryListHuman(categories: CategoryInfo[]): string;
|
|
60
|
+
/**
|
|
61
|
+
* Format category list for AI/JSON output
|
|
62
|
+
*/
|
|
63
|
+
export declare function formatCategoryListAI(categories: CategoryInfo[]): object;
|
|
64
|
+
/**
|
|
65
|
+
* Format check explanation for human output
|
|
66
|
+
*/
|
|
67
|
+
export declare function formatExplainHuman(check: CheckInfo): string;
|
|
68
|
+
/**
|
|
69
|
+
* Format check explanation for AI/JSON output
|
|
70
|
+
*/
|
|
71
|
+
export declare function formatExplainAI(check: CheckInfo): object;
|
|
72
|
+
//# sourceMappingURL=ai-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-commands.d.ts","sourceRoot":"","sources":["../../src/lib/ai-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAEpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAyFD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,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