@loxia-labs/loxia-autopilot-one 1.0.1 → 1.0.4

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 (120) hide show
  1. package/README.md +44 -54
  2. package/bin/cli.js +1 -115
  3. package/bin/loxia-terminal-v2.js +3 -0
  4. package/bin/loxia-terminal.js +3 -0
  5. package/bin/start-with-terminal.js +3 -0
  6. package/package.json +15 -15
  7. package/scripts/install-scanners.js +1 -235
  8. package/src/analyzers/CSSAnalyzer.js +1 -297
  9. package/src/analyzers/ConfigValidator.js +1 -690
  10. package/src/analyzers/ESLintAnalyzer.js +1 -320
  11. package/src/analyzers/JavaScriptAnalyzer.js +1 -261
  12. package/src/analyzers/PrettierFormatter.js +1 -247
  13. package/src/analyzers/PythonAnalyzer.js +1 -266
  14. package/src/analyzers/SecurityAnalyzer.js +1 -729
  15. package/src/analyzers/TypeScriptAnalyzer.js +1 -247
  16. package/src/analyzers/codeCloneDetector/analyzer.js +1 -344
  17. package/src/analyzers/codeCloneDetector/detector.js +1 -203
  18. package/src/analyzers/codeCloneDetector/index.js +1 -160
  19. package/src/analyzers/codeCloneDetector/parser.js +1 -199
  20. package/src/analyzers/codeCloneDetector/reporter.js +1 -148
  21. package/src/analyzers/codeCloneDetector/scanner.js +1 -59
  22. package/src/core/agentPool.js +1 -1474
  23. package/src/core/agentScheduler.js +1 -2147
  24. package/src/core/contextManager.js +1 -709
  25. package/src/core/messageProcessor.js +1 -732
  26. package/src/core/orchestrator.js +1 -548
  27. package/src/core/stateManager.js +1 -877
  28. package/src/index.js +1 -631
  29. package/src/interfaces/cli.js +1 -549
  30. package/src/interfaces/terminal/__tests__/smoke/advancedFeatures.test.js +1 -0
  31. package/src/interfaces/terminal/__tests__/smoke/agentControl.test.js +1 -0
  32. package/src/interfaces/terminal/__tests__/smoke/agents.test.js +1 -0
  33. package/src/interfaces/terminal/__tests__/smoke/components.test.js +1 -0
  34. package/src/interfaces/terminal/__tests__/smoke/connection.test.js +1 -0
  35. package/src/interfaces/terminal/__tests__/smoke/enhancements.test.js +1 -0
  36. package/src/interfaces/terminal/__tests__/smoke/imports.test.js +1 -0
  37. package/src/interfaces/terminal/__tests__/smoke/messages.test.js +1 -0
  38. package/src/interfaces/terminal/__tests__/smoke/tools.test.js +1 -0
  39. package/src/interfaces/terminal/api/apiClient.js +1 -0
  40. package/src/interfaces/terminal/api/messageRouter.js +1 -0
  41. package/src/interfaces/terminal/api/session.js +1 -0
  42. package/src/interfaces/terminal/api/websocket.js +1 -0
  43. package/src/interfaces/terminal/components/AgentCreator.js +1 -0
  44. package/src/interfaces/terminal/components/AgentEditor.js +1 -0
  45. package/src/interfaces/terminal/components/AgentSwitcher.js +1 -0
  46. package/src/interfaces/terminal/components/ErrorBoundary.js +1 -0
  47. package/src/interfaces/terminal/components/ErrorPanel.js +1 -0
  48. package/src/interfaces/terminal/components/Header.js +1 -0
  49. package/src/interfaces/terminal/components/HelpPanel.js +1 -0
  50. package/src/interfaces/terminal/components/InputBox.js +1 -0
  51. package/src/interfaces/terminal/components/Layout.js +1 -0
  52. package/src/interfaces/terminal/components/LoadingSpinner.js +1 -0
  53. package/src/interfaces/terminal/components/MessageList.js +1 -0
  54. package/src/interfaces/terminal/components/MultilineTextInput.js +1 -0
  55. package/src/interfaces/terminal/components/SearchPanel.js +1 -0
  56. package/src/interfaces/terminal/components/SettingsPanel.js +1 -0
  57. package/src/interfaces/terminal/components/StatusBar.js +1 -0
  58. package/src/interfaces/terminal/components/TextInput.js +1 -0
  59. package/src/interfaces/terminal/config/agentEditorConstants.js +1 -0
  60. package/src/interfaces/terminal/config/constants.js +1 -0
  61. package/src/interfaces/terminal/index.js +1 -0
  62. package/src/interfaces/terminal/state/useAgentControl.js +1 -0
  63. package/src/interfaces/terminal/state/useAgents.js +1 -0
  64. package/src/interfaces/terminal/state/useConnection.js +1 -0
  65. package/src/interfaces/terminal/state/useMessages.js +1 -0
  66. package/src/interfaces/terminal/state/useTools.js +1 -0
  67. package/src/interfaces/terminal/utils/debugLogger.js +1 -0
  68. package/src/interfaces/terminal/utils/settingsStorage.js +1 -0
  69. package/src/interfaces/terminal/utils/theme.js +1 -0
  70. package/src/interfaces/webServer.js +1 -2162
  71. package/src/modules/fileExplorer/controller.js +1 -280
  72. package/src/modules/fileExplorer/index.js +1 -37
  73. package/src/modules/fileExplorer/middleware.js +1 -92
  74. package/src/modules/fileExplorer/routes.js +1 -125
  75. package/src/modules/fileExplorer/types.js +1 -44
  76. package/src/services/aiService.js +1 -1232
  77. package/src/services/apiKeyManager.js +1 -164
  78. package/src/services/benchmarkService.js +1 -366
  79. package/src/services/budgetService.js +1 -539
  80. package/src/services/contextInjectionService.js +1 -247
  81. package/src/services/conversationCompactionService.js +1 -637
  82. package/src/services/errorHandler.js +1 -810
  83. package/src/services/fileAttachmentService.js +1 -544
  84. package/src/services/modelRouterService.js +1 -366
  85. package/src/services/modelsService.js +1 -322
  86. package/src/services/qualityInspector.js +1 -796
  87. package/src/services/tokenCountingService.js +1 -536
  88. package/src/tools/agentCommunicationTool.js +1 -1344
  89. package/src/tools/agentDelayTool.js +1 -485
  90. package/src/tools/asyncToolManager.js +1 -604
  91. package/src/tools/baseTool.js +1 -800
  92. package/src/tools/browserTool.js +1 -920
  93. package/src/tools/cloneDetectionTool.js +1 -621
  94. package/src/tools/dependencyResolverTool.js +1 -1215
  95. package/src/tools/fileContentReplaceTool.js +1 -875
  96. package/src/tools/fileSystemTool.js +1 -1107
  97. package/src/tools/fileTreeTool.js +1 -853
  98. package/src/tools/imageTool.js +1 -901
  99. package/src/tools/importAnalyzerTool.js +1 -1060
  100. package/src/tools/jobDoneTool.js +1 -248
  101. package/src/tools/seekTool.js +1 -956
  102. package/src/tools/staticAnalysisTool.js +1 -1778
  103. package/src/tools/taskManagerTool.js +1 -2873
  104. package/src/tools/terminalTool.js +1 -2304
  105. package/src/tools/webTool.js +1 -1430
  106. package/src/types/agent.js +1 -519
  107. package/src/types/contextReference.js +1 -972
  108. package/src/types/conversation.js +1 -730
  109. package/src/types/toolCommand.js +1 -747
  110. package/src/utilities/attachmentValidator.js +1 -292
  111. package/src/utilities/configManager.js +1 -582
  112. package/src/utilities/constants.js +1 -722
  113. package/src/utilities/directoryAccessManager.js +1 -535
  114. package/src/utilities/fileProcessor.js +1 -307
  115. package/src/utilities/logger.js +1 -436
  116. package/src/utilities/tagParser.js +1 -1246
  117. package/src/utilities/toolConstants.js +1 -317
  118. package/web-ui/build/index.html +2 -2
  119. package/web-ui/build/static/{index-Dy2bYbOa.css → index-CClD1090.css} +1 -1
  120. package/web-ui/build/static/{index-CjkkcnFA.js → index-lCBai6dX.js} +66 -67
@@ -1,1060 +1 @@
1
- /**
2
- * @file tools/importAnalyzerTool.js
3
- * @description Modern tool for analyzing and detecting broken imports/exports in Node.js projects
4
- */
5
-
6
- import { promises as fs } from 'fs';
7
- import path from 'path';
8
- import { BaseTool } from './baseTool.js';
9
- import TagParser from '../utilities/tagParser.js';
10
-
11
- /**
12
- * Configuration constants for the import analyzer
13
- */
14
- const ANALYZER_CONFIG = {
15
- DEFAULT_MODE: 'full',
16
- VALID_MODES: ['full', 'quick', 'fix'],
17
- DEFAULT_OUTPUT: 'summary',
18
- VALID_OUTPUTS: ['summary', 'detailed', 'json'],
19
- DEFAULT_IGNORE_FILE: '.gitignore',
20
- MAX_FILES: 10000, // Safety limit for file count
21
- SUPPORTED_EXTENSIONS: ['.js', '.mjs', '.ts', '.jsx', '.tsx'],
22
- DEFAULT_IGNORE_PATTERNS: ['node_modules', '.git', 'dist', 'build', 'coverage'],
23
- FILE_READ_TIMEOUT: 5000 // Timeout for reading large files
24
- };
25
-
26
- /**
27
- * ImportAnalyzerTool - Modern implementation
28
- * Analyzes JavaScript/TypeScript projects to detect broken imports, missing exports, and dependency issues
29
- */
30
- export class ImportAnalyzerTool extends BaseTool {
31
- /**
32
- * Get tool description for agent system prompt
33
- * @returns {string} Formatted tool description
34
- */
35
- getDescription() {
36
- return `Tool: Import Analyzer - Analyze JavaScript/TypeScript imports and exports
37
-
38
- **Purpose:** Analyzes JavaScript/TypeScript projects to detect broken imports, missing exports, circular dependencies, and unused exports.
39
-
40
- **Invocation Syntax:**
41
-
42
- XML Format:
43
- \`\`\`xml
44
- <import-analyzer>
45
- <path>./src</path>
46
- <mode>full</mode>
47
- <output>summary</output>
48
- <ignore-file>.gitignore</ignore-file>
49
- </import-analyzer>
50
- \`\`\`
51
-
52
- JSON Format:
53
- \`\`\`json
54
- {
55
- "toolId": "import-analyzer",
56
- "parameters": {
57
- "path": "./src",
58
- "mode": "full",
59
- "output": "summary",
60
- "ignoreFile": ".gitignore"
61
- }
62
- }
63
- \`\`\`
64
-
65
- **Parameters:**
66
- - **path** (string, optional): Path to directory to analyze. Default: "."
67
- - **mode** (string, optional): Analysis mode. Options:
68
- - "full" - Complete analysis (default)
69
- - "quick" - Fast scan for missing files only
70
- - "fix" - Includes fix suggestions
71
- - **output** (string, optional): Output format. Options:
72
- - "summary" - Concise summary (default)
73
- - "detailed" - Full report with fixes
74
- - "json" - Machine-readable format
75
- - **ignoreFile** (string, optional): Ignore file name. Default: ".gitignore"
76
-
77
- **What It Detects:**
78
- - Missing files (imports pointing to non-existent files)
79
- - Missing exports (symbols not exported from target files)
80
- - Circular dependencies (files that depend on each other in a loop)
81
- - Unused exports (exports never imported anywhere)
82
-
83
- **Examples:**
84
-
85
- 1. Quick project scan:
86
- \`\`\`xml
87
- <import-analyzer>
88
- <mode>quick</mode>
89
- </import-analyzer>
90
- \`\`\`
91
-
92
- 2. Full analysis with detailed report:
93
- \`\`\`xml
94
- <import-analyzer>
95
- <mode>full</mode>
96
- <output>detailed</output>
97
- </import-analyzer>
98
- \`\`\`
99
-
100
- 3. Analyze specific directory:
101
- \`\`\`json
102
- {
103
- "toolId": "import-analyzer",
104
- "parameters": { "path": "./src/components", "mode": "full" }
105
- }
106
- \`\`\`
107
-
108
- **Notes:**
109
- - Supports ES6 modules (import/export) and CommonJS (require/module.exports)
110
- - Respects .gitignore patterns
111
- - Correctly handles commented imports and multi-line statements
112
- - Works with .js, .mjs, .ts, .jsx, .tsx files`;
113
- }
114
-
115
- /**
116
- * Parse tool parameters from raw content (XML or JSON)
117
- * @param {string|Object} content - Raw tool content or parsed object
118
- * @returns {Object} Parsed parameters
119
- */
120
- parseParameters(content) {
121
- // If already an object, validate and return
122
- if (typeof content === 'object' && content !== null) {
123
- return {
124
- path: content.path || '.',
125
- mode: content.mode || ANALYZER_CONFIG.DEFAULT_MODE,
126
- output: content.output || ANALYZER_CONFIG.DEFAULT_OUTPUT,
127
- ignoreFile: content.ignoreFile || ANALYZER_CONFIG.DEFAULT_IGNORE_FILE
128
- };
129
- }
130
-
131
- // Parse XML content
132
- if (typeof content === 'string') {
133
- // Try modern XML format first: <import-analyzer>...</import-analyzer>
134
- const modernPattern = /<import-analyzer([^>]*)>([\s\S]*?)<\/import-analyzer>/i;
135
- const modernMatch = modernPattern.exec(content);
136
-
137
- if (modernMatch) {
138
- const attributesStr = modernMatch[1];
139
- const innerContent = modernMatch[2];
140
-
141
- // Parse attributes from opening tag
142
- const pathAttr = /path=["']([^"']*)["']/i.exec(attributesStr);
143
- const modeAttr = /mode=["']([^"']*)["']/i.exec(attributesStr);
144
- const outputAttr = /output=["']([^"']*)["']/i.exec(attributesStr);
145
- const ignoreFileAttr = /ignore-file=["']([^"']*)["']/i.exec(attributesStr);
146
-
147
- // Extract from inner content
148
- const pathPattern = /<path>(.*?)<\/path>/i;
149
- const pathMatch = pathPattern.exec(innerContent);
150
-
151
- const modePattern = /<mode>(.*?)<\/mode>/i;
152
- const modeMatch = modePattern.exec(innerContent);
153
-
154
- const outputPattern = /<output>(.*?)<\/output>/i;
155
- const outputMatch = outputPattern.exec(innerContent);
156
-
157
- const ignoreFilePattern = /<ignore-file>(.*?)<\/ignore-file>/i;
158
- const ignoreFileMatch = ignoreFilePattern.exec(innerContent);
159
-
160
- // Content takes precedence over attributes
161
- const extractedPath = (pathMatch ? pathMatch[1].trim() : null) || (pathAttr ? pathAttr[1] : '.');
162
- const extractedMode = (modeMatch ? modeMatch[1].trim() : null) || (modeAttr ? modeAttr[1] : ANALYZER_CONFIG.DEFAULT_MODE);
163
- const extractedOutput = (outputMatch ? outputMatch[1].trim() : null) || (outputAttr ? outputAttr[1] : ANALYZER_CONFIG.DEFAULT_OUTPUT);
164
- const extractedIgnoreFile = (ignoreFileMatch ? ignoreFileMatch[1].trim() : null) || (ignoreFileAttr ? ignoreFileAttr[1] : ANALYZER_CONFIG.DEFAULT_IGNORE_FILE);
165
-
166
- return {
167
- path: extractedPath,
168
- mode: extractedMode,
169
- output: extractedOutput,
170
- ignoreFile: extractedIgnoreFile
171
- };
172
- }
173
-
174
- // Try legacy format with TagParser
175
- try {
176
- const parsed = TagParser.parseTags(content, 'analyze');
177
-
178
- if (parsed && parsed.length > 0) {
179
- const analyzeCommand = parsed[0];
180
-
181
- return {
182
- path: analyzeCommand.attributes.path || '.',
183
- mode: analyzeCommand.attributes.mode || ANALYZER_CONFIG.DEFAULT_MODE,
184
- output: analyzeCommand.attributes.output || ANALYZER_CONFIG.DEFAULT_OUTPUT,
185
- ignoreFile: analyzeCommand.attributes['ignore-file'] || ANALYZER_CONFIG.DEFAULT_IGNORE_FILE
186
- };
187
- }
188
- } catch (error) {
189
- // Fall through to error
190
- }
191
-
192
- throw new Error('Invalid import-analyzer format. Use <import-analyzer> tags or JSON format.');
193
- }
194
-
195
- throw new Error('Invalid parameter format. Expected string (XML) or object (JSON).');
196
- }
197
-
198
- /**
199
- * Validate parameters
200
- * @param {Object} params - Parameters to validate
201
- * @throws {Error} If validation fails
202
- * @private
203
- */
204
- _validateParameters(params) {
205
- if (!params || typeof params !== 'object') {
206
- throw new Error('Parameters must be an object');
207
- }
208
-
209
- if (params.path && typeof params.path !== 'string') {
210
- throw new Error('path must be a string');
211
- }
212
-
213
- if (params.mode && !ANALYZER_CONFIG.VALID_MODES.includes(params.mode)) {
214
- throw new Error(`Invalid mode: ${params.mode}. Must be one of: ${ANALYZER_CONFIG.VALID_MODES.join(', ')}`);
215
- }
216
-
217
- if (params.output && !ANALYZER_CONFIG.VALID_OUTPUTS.includes(params.output)) {
218
- throw new Error(`Invalid output: ${params.output}. Must be one of: ${ANALYZER_CONFIG.VALID_OUTPUTS.join(', ')}`);
219
- }
220
-
221
- if (params.ignoreFile && typeof params.ignoreFile !== 'string') {
222
- throw new Error('ignoreFile must be a string');
223
- }
224
- }
225
-
226
- /**
227
- * Validate and resolve file path
228
- * @param {string} targetPath - Target path from parameters
229
- * @param {Object} context - Execution context
230
- * @returns {string} Resolved absolute path
231
- * @throws {Error} If path is invalid or inaccessible
232
- * @private
233
- */
234
- _resolveAndValidatePath(targetPath, context) {
235
- const { projectDir, directoryAccess } = context;
236
-
237
- // Determine working directory
238
- let workingDirectory = projectDir || process.cwd();
239
-
240
- if (directoryAccess && directoryAccess.workingDirectory) {
241
- workingDirectory = directoryAccess.workingDirectory;
242
- }
243
-
244
- // Resolve the target path
245
- const resolvedPath = path.isAbsolute(targetPath)
246
- ? path.normalize(targetPath)
247
- : path.normalize(path.join(workingDirectory, targetPath));
248
-
249
- // Security: Check for path traversal
250
- const realWorkingDir = path.normalize(workingDirectory);
251
- if (!resolvedPath.startsWith(realWorkingDir)) {
252
- throw new Error(`Path traversal detected: ${targetPath} resolves outside working directory`);
253
- }
254
-
255
- return resolvedPath;
256
- }
257
-
258
- /**
259
- * Execute tool with parsed parameters
260
- * @param {Object} params - Parsed parameters
261
- * @param {Object} context - Execution context
262
- * @returns {Promise<Object>} Execution result
263
- */
264
- async execute(params, context = {}) {
265
- try {
266
- // Validate parameters
267
- this._validateParameters(params);
268
-
269
- const { path: targetPath, mode, output, ignoreFile } = params;
270
- const { projectDir, agentId, directoryAccess } = context;
271
-
272
- // Resolve and validate path
273
- const resolvedPath = this._resolveAndValidatePath(targetPath, context);
274
-
275
- this.logger?.info('Import analyzer executing', {
276
- mode,
277
- resolvedPath,
278
- output,
279
- agentId
280
- });
281
-
282
- const outputLines = [];
283
- outputLines.push(`🔍 Analyzing imports in: ${resolvedPath}`);
284
- outputLines.push(`Mode: ${mode}`);
285
- outputLines.push(`Output: ${output}\n`);
286
-
287
- // Check if path exists
288
- try {
289
- await fs.access(resolvedPath);
290
- } catch {
291
- return {
292
- success: false,
293
- error: `Path does not exist: ${resolvedPath}`,
294
- output: outputLines.join('\n')
295
- };
296
- }
297
-
298
- // Run analysis
299
- const analyzer = new ImportExportAnalyzer(resolvedPath, ignoreFile, this.logger);
300
- const results = await analyzer.analyze(mode);
301
-
302
- // Format output based on requested format
303
- let formattedOutput;
304
- switch (output) {
305
- case 'json':
306
- // For JSON output, don't include header lines
307
- formattedOutput = JSON.stringify(results, null, 2);
308
- break;
309
- case 'detailed':
310
- formattedOutput = this._formatDetailedOutput(results);
311
- outputLines.push(formattedOutput);
312
- break;
313
- case 'summary':
314
- default:
315
- formattedOutput = this._formatSummaryOutput(results);
316
- outputLines.push(formattedOutput);
317
- break;
318
- }
319
-
320
- return {
321
- success: true,
322
- mode,
323
- message: 'Import analysis completed',
324
- statistics: {
325
- totalFiles: results.summary.totalFiles,
326
- totalImports: results.summary.totalImports,
327
- totalExports: results.summary.totalExports,
328
- issuesFound: results.fileNotFoundImports.length + Object.values(results.missingExports).reduce((sum, arr) => sum + arr.length, 0)
329
- },
330
- output: output === 'json' ? formattedOutput : outputLines.join('\n'),
331
- results
332
- };
333
-
334
- } catch (error) {
335
- this.logger?.error('Import analyzer error:', error);
336
-
337
- return {
338
- success: false,
339
- error: error.message,
340
- output: error.message
341
- };
342
- }
343
- }
344
-
345
- /**
346
- * Format summary output
347
- * @param {Object} results - Analysis results
348
- * @returns {string} Formatted output
349
- * @private
350
- */
351
- _formatSummaryOutput(results) {
352
- const lines = [];
353
-
354
- lines.push('📊 Import/Export Analysis Summary');
355
- lines.push('================================\n');
356
-
357
- lines.push(`📁 Files analyzed: ${results.summary.totalFiles}`);
358
- lines.push(`📥 Total imports: ${results.summary.totalImports}`);
359
- lines.push(`📤 Total exports: ${results.summary.totalExports}\n`);
360
-
361
- // Critical issues
362
- const missingFilesCount = results.fileNotFoundImports.length;
363
- const missingExportsCount = Object.values(results.missingExports).reduce((sum, arr) => sum + arr.length, 0);
364
- const circularDepsCount = results.circularDependencies ? results.circularDependencies.length : 0;
365
-
366
- if (missingFilesCount > 0) {
367
- lines.push(`❌ Missing files: ${missingFilesCount} imports pointing to non-existent files`);
368
- }
369
-
370
- if (missingExportsCount > 0) {
371
- lines.push(`⚠️ Missing exports: ${missingExportsCount} symbols not exported from their sources`);
372
- }
373
-
374
- if (circularDepsCount > 0) {
375
- lines.push(`🔄 Circular dependencies: ${circularDepsCount} circular dependency chains detected`);
376
- }
377
-
378
- if (missingFilesCount === 0 && missingExportsCount === 0 && circularDepsCount === 0) {
379
- lines.push('✅ No import/export issues detected!');
380
- } else {
381
- lines.push('\n🔍 Top Issues to Fix:');
382
-
383
- // Show top 5 files with issues
384
- if (Object.keys(results.missingFiles || {}).length > 0) {
385
- lines.push('\n Missing Files:');
386
- Object.entries(results.missingFiles).slice(0, 3).forEach(([file, issues]) => {
387
- lines.push(` • ${file} has ${issues.length} broken import(s)`);
388
- });
389
- }
390
-
391
- if (Object.keys(results.missingExports).length > 0) {
392
- lines.push('\n Missing Exports:');
393
- Object.entries(results.missingExports).slice(0, 3).forEach(([file, issues]) => {
394
- lines.push(` • ${file} imports ${issues.length} non-existent symbol(s)`);
395
- });
396
- }
397
-
398
- lines.push('\n💡 Run with output="detailed" for complete analysis and fix suggestions');
399
- }
400
-
401
- return lines.join('\n');
402
- }
403
-
404
- /**
405
- * Format detailed output
406
- * @param {Object} results - Analysis results
407
- * @returns {string} Formatted output
408
- * @private
409
- */
410
- _formatDetailedOutput(results) {
411
- const lines = [];
412
-
413
- lines.push('📊 Detailed Import/Export Analysis Report');
414
- lines.push('=========================================\n');
415
-
416
- lines.push('📈 Statistics:');
417
- lines.push(` • Files analyzed: ${results.summary.totalFiles}`);
418
- lines.push(` • Total imports: ${results.summary.totalImports}`);
419
- lines.push(` • Total exports: ${results.summary.totalExports}\n`);
420
-
421
- // Missing files section
422
- if (results.fileNotFoundImports.length > 0) {
423
- lines.push('❌ MISSING FILES');
424
- lines.push('─────────────────');
425
-
426
- const fileGroups = {};
427
- results.fileNotFoundImports.forEach(item => {
428
- if (!fileGroups[item.importingFile]) {
429
- fileGroups[item.importingFile] = [];
430
- }
431
- fileGroups[item.importingFile].push(item);
432
- });
433
-
434
- Object.entries(fileGroups).forEach(([file, imports]) => {
435
- lines.push(`\n📄 ${file}:`);
436
- imports.forEach(imp => {
437
- const importType = imp.isDefault ? 'default' : imp.isNamespace ? 'namespace' : 'named';
438
- lines.push(` ⚠️ Cannot find file: ${imp.importedFromFile}`);
439
- lines.push(` Trying to import: ${imp.importedSymbol} (${importType})`);
440
- lines.push(` 💡 Fix: Check if file exists or correct the import path`);
441
- });
442
- });
443
- }
444
-
445
- // Missing exports section
446
- if (Object.keys(results.missingExports).length > 0) {
447
- lines.push('\n⚠️ MISSING EXPORTS');
448
- lines.push('──────────────────');
449
-
450
- Object.entries(results.missingExports).forEach(([file, issues]) => {
451
- lines.push(`\n📄 ${file}:`);
452
- issues.forEach(issue => {
453
- const importType = issue.isDefault ? 'default' : issue.isNamespace ? 'namespace' : 'named';
454
- lines.push(` ❌ Symbol not exported: "${issue.importedSymbol}" (${importType})`);
455
- lines.push(` From file: ${issue.importedFromFile}`);
456
-
457
- if (issue.availableExports.length > 0) {
458
- lines.push(` 📤 Available exports: ${issue.availableExports.join(', ')}`);
459
-
460
- // Suggest potential fixes
461
- if (issue.isDefault && issue.availableExports.includes('default')) {
462
- lines.push(` 💡 Fix: Default export exists, check import syntax`);
463
- } else if (issue.isDefault && !issue.availableExports.includes('default')) {
464
- lines.push(` 💡 Fix: No default export. Use named import: { ${issue.availableExports[0] || 'symbolName'} }`);
465
- } else {
466
- // Check for similar names
467
- const similar = issue.availableExports.find(exp =>
468
- exp.toLowerCase() === issue.importedSymbol.toLowerCase()
469
- );
470
- if (similar) {
471
- lines.push(` 💡 Fix: Did you mean "${similar}"? (case mismatch)`);
472
- } else {
473
- lines.push(` 💡 Fix: Add export for "${issue.importedSymbol}" or use one of the available exports`);
474
- }
475
- }
476
- } else {
477
- lines.push(` 📤 No exports found in target file`);
478
- lines.push(` 💡 Fix: Add exports to ${issue.importedFromFile} or check if it's the correct file`);
479
- }
480
- });
481
- });
482
- }
483
-
484
- // Circular dependencies
485
- if (results.circularDependencies && results.circularDependencies.length > 0) {
486
- lines.push('\n🔄 CIRCULAR DEPENDENCIES');
487
- lines.push('────────────────────────');
488
-
489
- results.circularDependencies.forEach((cycle, index) => {
490
- lines.push(`\n Cycle ${index + 1}:`);
491
- cycle.forEach((file, i) => {
492
- if (i < cycle.length - 1) {
493
- lines.push(` ${file} → ${cycle[i + 1]}`);
494
- }
495
- });
496
- lines.push(` 💡 Fix: Refactor to break the circular dependency`);
497
- });
498
- }
499
-
500
- // Unused exports (if available)
501
- if (results.unusedExports && Object.keys(results.unusedExports).length > 0) {
502
- lines.push('\n🗑️ POTENTIALLY UNUSED EXPORTS');
503
- lines.push('──────────────────────────────');
504
-
505
- Object.entries(results.unusedExports).slice(0, 10).forEach(([file, exports]) => {
506
- lines.push(`\n📄 ${file}:`);
507
- lines.push(` Unused: ${exports.join(', ')}`);
508
- });
509
-
510
- lines.push('\n 💡 Note: These exports are not imported within this project');
511
- lines.push(' They might be used by external packages or could be removed');
512
- }
513
-
514
- // Summary and recommendations
515
- lines.push('\n📋 RECOMMENDATIONS');
516
- lines.push('──────────────────');
517
-
518
- const totalIssues = results.fileNotFoundImports.length +
519
- Object.values(results.missingExports).reduce((sum, arr) => sum + arr.length, 0);
520
-
521
- if (totalIssues === 0) {
522
- lines.push('✅ Your import/export structure looks good!');
523
- } else {
524
- lines.push(`Found ${totalIssues} issue(s) that need attention:`);
525
-
526
- if (results.fileNotFoundImports.length > 0) {
527
- lines.push(` 1. Fix ${results.fileNotFoundImports.length} missing file reference(s)`);
528
- }
529
-
530
- if (Object.keys(results.missingExports).length > 0) {
531
- lines.push(` 2. Resolve ${Object.values(results.missingExports).reduce((sum, arr) => sum + arr.length, 0)} missing export(s)`);
532
- }
533
-
534
- if (results.circularDependencies && results.circularDependencies.length > 0) {
535
- lines.push(` 3. Refactor ${results.circularDependencies.length} circular dependency chain(s)`);
536
- }
537
- }
538
-
539
- return lines.join('\n');
540
- }
541
- }
542
-
543
- /**
544
- * Internal analyzer class
545
- */
546
- class ImportExportAnalyzer {
547
- constructor(rootDir, ignoreFile = '.gitignore', logger = null) {
548
- this.rootDir = path.resolve(rootDir);
549
- this.ignoreFile = ignoreFile;
550
- this.logger = logger;
551
- this.ignorePatterns = [...ANALYZER_CONFIG.DEFAULT_IGNORE_PATTERNS];
552
- this.imports = [];
553
- this.exports = new Map();
554
- this.dependencies = new Map(); // For circular dependency detection
555
- }
556
-
557
- async loadIgnoreFile() {
558
- try {
559
- const ignoreFilePath = path.join(this.rootDir, this.ignoreFile);
560
- const content = await fs.readFile(ignoreFilePath, 'utf-8');
561
- const patterns = content
562
- .split('\n')
563
- .map(line => line.trim())
564
- .filter(line => line && !line.startsWith('#'));
565
-
566
- this.ignorePatterns.push(...patterns);
567
- this.logger?.debug('Loaded ignore patterns', { count: patterns.length });
568
- } catch {
569
- // Ignore file doesn't exist, use defaults
570
- this.logger?.debug('No ignore file found, using defaults');
571
- }
572
- }
573
-
574
- shouldIgnoreFile(filePath) {
575
- const relativePath = path.relative(this.rootDir, filePath);
576
- return this.ignorePatterns.some(pattern => {
577
- if (pattern.includes('*')) {
578
- const regex = new RegExp(pattern.replace(/\*/g, '.*'));
579
- return regex.test(relativePath) || regex.test(path.basename(filePath));
580
- }
581
- return relativePath.includes(pattern) || path.basename(filePath) === pattern;
582
- });
583
- }
584
-
585
- async getAllFiles(dir) {
586
- const files = [];
587
-
588
- const traverse = async (currentDir) => {
589
- try {
590
- const entries = await fs.readdir(currentDir, { withFileTypes: true });
591
-
592
- for (const entry of entries) {
593
- const fullPath = path.join(currentDir, entry.name);
594
-
595
- if (this.shouldIgnoreFile(fullPath)) {
596
- continue;
597
- }
598
-
599
- if (entry.isDirectory()) {
600
- await traverse(fullPath);
601
- } else if (entry.isFile()) {
602
- const ext = path.extname(entry.name);
603
- if (ANALYZER_CONFIG.SUPPORTED_EXTENSIONS.includes(ext)) {
604
- files.push(fullPath);
605
- }
606
- }
607
- }
608
- } catch (error) {
609
- // Skip directories we can't read
610
- this.logger?.warn('Cannot read directory', { dir: currentDir, error: error.message });
611
- }
612
- };
613
-
614
- await traverse(dir);
615
-
616
- // Safety check
617
- if (files.length > ANALYZER_CONFIG.MAX_FILES) {
618
- this.logger?.warn(`File count exceeds limit: ${files.length} > ${ANALYZER_CONFIG.MAX_FILES}`);
619
- throw new Error(`Too many files to analyze: ${files.length} (max: ${ANALYZER_CONFIG.MAX_FILES})`);
620
- }
621
-
622
- return files;
623
- }
624
-
625
- async parseImports(content, filePath) {
626
- const imports = [];
627
- const lines = content.split('\n');
628
- const relativePath = this.getRelativePath(filePath);
629
-
630
- // Track dependencies for circular detection
631
- if (!this.dependencies.has(relativePath)) {
632
- this.dependencies.set(relativePath, new Set());
633
- }
634
-
635
- for (let i = 0; i < lines.length; i++) {
636
- const line = lines[i].trim();
637
-
638
- if (line.startsWith('//') || line.startsWith('/*')) continue;
639
-
640
- // Build multi-line statements
641
- let fullStatement = line;
642
- let j = i;
643
- while (!fullStatement.includes(';') && !fullStatement.match(/from\s+['"`][^'"`]+['"`]/) && j < lines.length - 1) {
644
- j++;
645
- const nextLine = lines[j].trim();
646
- // Skip commented lines when building multi-line statements
647
- if (nextLine.startsWith('//') || nextLine.startsWith('/*')) {
648
- continue;
649
- }
650
- fullStatement += ' ' + nextLine;
651
- }
652
-
653
- // ES6 imports
654
- const importRegex = /import\s+(?:(?:\{([^}]+)\})|(?:([^,\s]+)(?:\s*,\s*\{([^}]+)\})?)|(?:\*\s+as\s+([^,\s]+)))\s+from\s+['"`]([^'"`]+)['"`]/g;
655
- let match;
656
-
657
- while ((match = importRegex.exec(fullStatement)) !== null) {
658
- const [, namedImports, defaultImport, additionalNamed, namespaceImport, source] = match;
659
- const resolvedSource = await this.resolveImportPath(source, filePath);
660
-
661
- // Track dependency
662
- if (!resolvedSource.isExternal && resolvedSource.exists) {
663
- this.dependencies.get(relativePath).add(resolvedSource.path);
664
- }
665
-
666
- if (defaultImport) {
667
- imports.push({
668
- importingFile: relativePath,
669
- importedSymbol: defaultImport.trim(),
670
- importedFromFile: resolvedSource.path,
671
- fileExists: resolvedSource.exists,
672
- isExternal: resolvedSource.isExternal || false,
673
- isDefault: true
674
- });
675
- }
676
-
677
- if (namespaceImport) {
678
- imports.push({
679
- importingFile: relativePath,
680
- importedSymbol: namespaceImport.trim(),
681
- importedFromFile: resolvedSource.path,
682
- fileExists: resolvedSource.exists,
683
- isExternal: resolvedSource.isExternal || false,
684
- isNamespace: true
685
- });
686
- }
687
-
688
- const allNamedImports = [namedImports, additionalNamed].filter(Boolean).join(',');
689
- if (allNamedImports) {
690
- const symbols = allNamedImports.split(',').map(s => {
691
- const parts = s.trim().split(/\s+as\s+/);
692
- return parts[0].trim();
693
- });
694
-
695
- symbols.forEach(symbol => {
696
- if (symbol) {
697
- imports.push({
698
- importingFile: relativePath,
699
- importedSymbol: symbol,
700
- importedFromFile: resolvedSource.path,
701
- fileExists: resolvedSource.exists,
702
- isExternal: resolvedSource.isExternal || false,
703
- isDefault: false
704
- });
705
- }
706
- });
707
- }
708
- }
709
-
710
- // CommonJS requires
711
- const requireRegex = /(?:const|let|var)\s+(?:\{([^}]+)\}|([^=\s]+))\s*=\s*require\(['"`]([^'"`]+)['"`]\)/g;
712
- while ((match = requireRegex.exec(fullStatement)) !== null) {
713
- const [, destructured, variable, source] = match;
714
- const resolvedSource = await this.resolveImportPath(source, filePath);
715
-
716
- // Track dependency
717
- if (!resolvedSource.isExternal && resolvedSource.exists) {
718
- this.dependencies.get(relativePath).add(resolvedSource.path);
719
- }
720
-
721
- if (destructured) {
722
- const symbols = destructured.split(',').map(s => s.trim().split(':')[0].trim());
723
- symbols.forEach(symbol => {
724
- if (symbol) {
725
- imports.push({
726
- importingFile: relativePath,
727
- importedSymbol: symbol,
728
- importedFromFile: resolvedSource.path,
729
- fileExists: resolvedSource.exists,
730
- isExternal: resolvedSource.isExternal || false,
731
- isDefault: false
732
- });
733
- }
734
- });
735
- } else if (variable) {
736
- imports.push({
737
- importingFile: relativePath,
738
- importedSymbol: variable.trim(),
739
- importedFromFile: resolvedSource.path,
740
- fileExists: resolvedSource.exists,
741
- isExternal: resolvedSource.isExternal || false,
742
- isDefault: true
743
- });
744
- }
745
- }
746
-
747
- // Skip lines that were already processed as part of multi-line statement
748
- i = j;
749
- }
750
-
751
- return imports;
752
- }
753
-
754
- parseExports(content) {
755
- const exports = new Set();
756
- const lines = content.split('\n');
757
-
758
- for (const line of lines) {
759
- const trimmedLine = line.trim();
760
-
761
- if (trimmedLine.startsWith('//') || trimmedLine.startsWith('/*')) continue;
762
-
763
- // Export default
764
- if (/export\s+default\s+/.test(trimmedLine)) {
765
- exports.add('default');
766
- }
767
-
768
- // Named exports
769
- const namedExportMatch = trimmedLine.match(/export\s+\{([^}]+)\}/);
770
- if (namedExportMatch) {
771
- const symbols = namedExportMatch[1].split(',').map(s => {
772
- const parts = s.trim().split(/\s+as\s+/);
773
- return parts[parts.length - 1].trim();
774
- });
775
- symbols.forEach(symbol => exports.add(symbol));
776
- }
777
-
778
- // Direct exports
779
- const directExportMatch = trimmedLine.match(/export\s+(?:const|let|var|function|class|async\s+function)\s+([^=\s(]+)/);
780
- if (directExportMatch) {
781
- exports.add(directExportMatch[1]);
782
- }
783
-
784
- // Export from
785
- const exportFromMatch = trimmedLine.match(/export\s+\{([^}]+)\}\s+from/);
786
- if (exportFromMatch) {
787
- const symbols = exportFromMatch[1].split(',').map(s => {
788
- const parts = s.trim().split(/\s+as\s+/);
789
- return parts[parts.length - 1].trim();
790
- });
791
- symbols.forEach(symbol => exports.add(symbol));
792
- }
793
-
794
- // Export all
795
- if (/export\s+\*\s+from/.test(trimmedLine)) {
796
- exports.add('*');
797
- }
798
-
799
- // CommonJS exports
800
- const moduleExportsMatch = trimmedLine.match(/module\.exports\s*=\s*\{([^}]+)\}/);
801
- if (moduleExportsMatch) {
802
- const symbols = moduleExportsMatch[1].split(',').map(s => {
803
- const parts = s.trim().split(':');
804
- return parts[0].trim();
805
- });
806
- symbols.forEach(symbol => exports.add(symbol));
807
- }
808
-
809
- if (/module\.exports\s*=\s*[^{]/.test(trimmedLine)) {
810
- exports.add('default');
811
- }
812
-
813
- const moduleExportsPropMatch = trimmedLine.match(/module\.exports\.([^=\s]+)\s*=/);
814
- if (moduleExportsPropMatch) {
815
- exports.add(moduleExportsPropMatch[1]);
816
- }
817
-
818
- const exportsPropMatch = trimmedLine.match(/exports\.([^=\s]+)\s*=/);
819
- if (exportsPropMatch) {
820
- exports.add(exportsPropMatch[1]);
821
- }
822
- }
823
-
824
- return exports;
825
- }
826
-
827
- async resolveImportPath(importPath, currentFile) {
828
- if (importPath.startsWith('.')) {
829
- const currentDir = path.dirname(currentFile);
830
- const resolved = path.resolve(currentDir, importPath);
831
-
832
- // Try with extension first if provided
833
- if (path.extname(importPath)) {
834
- try {
835
- const stat = await fs.stat(resolved);
836
- if (stat.isFile()) {
837
- return {
838
- path: this.getRelativePath(resolved),
839
- exists: true
840
- };
841
- }
842
- } catch {
843
- // File doesn't exist
844
- }
845
- }
846
-
847
- // Try different extensions
848
- const extensions = ['', '.js', '.mjs', '.ts', '.jsx', '.tsx', '/index.js', '/index.ts', '/index.jsx', '/index.tsx'];
849
- for (const ext of extensions) {
850
- const withExt = resolved + ext;
851
- try {
852
- const stat = await fs.stat(withExt);
853
- if (stat.isFile()) {
854
- return {
855
- path: this.getRelativePath(withExt),
856
- exists: true
857
- };
858
- }
859
- } catch {
860
- // Try next
861
- }
862
- }
863
-
864
- return {
865
- path: this.getRelativePath(resolved),
866
- exists: false
867
- };
868
- }
869
-
870
- // Node modules or absolute imports
871
- return {
872
- path: importPath,
873
- exists: true,
874
- isExternal: true
875
- };
876
- }
877
-
878
- getRelativePath(filePath) {
879
- return path.relative(this.rootDir, filePath).replace(/\\/g, '/');
880
- }
881
-
882
- findCircularDependencies() {
883
- const cycles = [];
884
- const visited = new Set();
885
- const recursionStack = new Set();
886
-
887
- const dfs = (node, path = []) => {
888
- if (recursionStack.has(node)) {
889
- const cycleStart = path.indexOf(node);
890
- if (cycleStart !== -1) {
891
- cycles.push([...path.slice(cycleStart), node]);
892
- }
893
- return;
894
- }
895
-
896
- if (visited.has(node)) {
897
- return;
898
- }
899
-
900
- visited.add(node);
901
- recursionStack.add(node);
902
- path.push(node);
903
-
904
- const deps = this.dependencies.get(node) || new Set();
905
- for (const dep of deps) {
906
- dfs(dep, [...path]);
907
- }
908
-
909
- recursionStack.delete(node);
910
- };
911
-
912
- for (const node of this.dependencies.keys()) {
913
- if (!visited.has(node)) {
914
- dfs(node);
915
- }
916
- }
917
-
918
- return cycles;
919
- }
920
-
921
- findUnusedExports() {
922
- const usedExports = new Map();
923
-
924
- // Track which exports are actually imported
925
- for (const imp of this.imports) {
926
- if (!imp.isExternal) {
927
- if (!usedExports.has(imp.importedFromFile)) {
928
- usedExports.set(imp.importedFromFile, new Set());
929
- }
930
- usedExports.get(imp.importedFromFile).add(imp.importedSymbol);
931
- }
932
- }
933
-
934
- // Find exports that are never imported
935
- const unusedExports = {};
936
- for (const [file, exports] of this.exports.entries()) {
937
- const used = usedExports.get(file) || new Set();
938
- const unused = Array.from(exports).filter(exp => !used.has(exp) && exp !== '*');
939
-
940
- if (unused.length > 0) {
941
- unusedExports[file] = unused;
942
- }
943
- }
944
-
945
- return unusedExports;
946
- }
947
-
948
- async analyze(mode = 'full') {
949
- this.logger?.info('Starting import analysis', { mode, rootDir: this.rootDir });
950
-
951
- await this.loadIgnoreFile();
952
-
953
- const files = await this.getAllFiles(this.rootDir);
954
- this.logger?.info('Found files', { count: files.length });
955
-
956
- // Parse all files
957
- for (const file of files) {
958
- try {
959
- const content = await fs.readFile(file, 'utf-8');
960
- const relativeFile = this.getRelativePath(file);
961
-
962
- const fileImports = await this.parseImports(content, file);
963
- this.imports.push(...fileImports);
964
-
965
- const fileExports = this.parseExports(content);
966
- this.exports.set(relativeFile, fileExports);
967
- } catch (error) {
968
- // Skip files with errors
969
- this.logger?.warn('Error parsing file', { file, error: error.message });
970
- }
971
- }
972
-
973
- this.logger?.info('Parsed all files', { imports: this.imports.length, exports: this.exports.size });
974
-
975
- // Analyze issues
976
- const results = {
977
- summary: {
978
- totalFiles: files.length,
979
- totalImports: this.imports.length,
980
- totalExports: Array.from(this.exports.values()).reduce((sum, exports) => sum + exports.size, 0)
981
- },
982
- missingExports: {},
983
- missingFiles: {},
984
- fileNotFoundImports: []
985
- };
986
-
987
- // Check imports
988
- for (const importEntry of this.imports) {
989
- const { importingFile, importedSymbol, importedFromFile, isDefault, isNamespace, fileExists, isExternal } = importEntry;
990
-
991
- if (!fileExists && !isExternal) {
992
- results.fileNotFoundImports.push({
993
- importingFile,
994
- importedSymbol,
995
- importedFromFile,
996
- isDefault: isDefault || false,
997
- isNamespace: isNamespace || false
998
- });
999
-
1000
- if (!results.missingFiles[importingFile]) {
1001
- results.missingFiles[importingFile] = [];
1002
- }
1003
-
1004
- results.missingFiles[importingFile].push({
1005
- missingFile: importedFromFile,
1006
- importedSymbol,
1007
- isDefault: isDefault || false,
1008
- isNamespace: isNamespace || false
1009
- });
1010
-
1011
- continue;
1012
- }
1013
-
1014
- if (isExternal) continue;
1015
-
1016
- const exportingFileExports = this.exports.get(importedFromFile);
1017
- let exists = false;
1018
-
1019
- if (exportingFileExports) {
1020
- if (isNamespace) {
1021
- exists = exportingFileExports.size > 0;
1022
- } else if (isDefault) {
1023
- exists = exportingFileExports.has('default');
1024
- } else {
1025
- exists = exportingFileExports.has(importedSymbol) || exportingFileExports.has('*');
1026
- }
1027
- }
1028
-
1029
- if (!exists) {
1030
- if (!results.missingExports[importingFile]) {
1031
- results.missingExports[importingFile] = [];
1032
- }
1033
-
1034
- results.missingExports[importingFile].push({
1035
- importedSymbol,
1036
- importedFromFile,
1037
- availableExports: exportingFileExports ? Array.from(exportingFileExports) : [],
1038
- isDefault: isDefault || false,
1039
- isNamespace: isNamespace || false
1040
- });
1041
- }
1042
- }
1043
-
1044
- // Additional analysis for full mode
1045
- if (mode === 'full' || mode === 'fix') {
1046
- this.logger?.info('Running full analysis');
1047
- results.circularDependencies = this.findCircularDependencies();
1048
- results.unusedExports = this.findUnusedExports();
1049
- }
1050
-
1051
- this.logger?.info('Analysis complete', {
1052
- missingFiles: results.fileNotFoundImports.length,
1053
- missingExports: Object.keys(results.missingExports).length
1054
- });
1055
-
1056
- return results;
1057
- }
1058
- }
1059
-
1060
- export default ImportAnalyzerTool;
1
+ function a0_0x3332(){const _0x3eaacf=['B3v0Chv0','CgfYC2vjBxbVCNrZ','Cgf0AcbTDxn0igjLigeGC3rYAw5N','DhjPBq','lMDPDgLNBM9Yzq','z2v0uMvSyxrPDMvqyxrO','rMLSzsbJB3vUDcbLEgnLzwrZigXPBwL0oIa','l2LUzgv4lMPZ','C3rYAw5NAwz5','AM9PBG','ugfYC2vKigfSBcbMAwXLCW','rxjYB3iGCgfYC2LUzYbMAwXL','AxneAxjLy3rVCNK','icaGicaG8j+sOsbgAxG6ierLzMf1BhqGzxHWB3j0igv4Axn0CYWGy2HLy2SGAw1WB3j0ihn5BNrHEa','CMvHzezPBgu','C3rHCNrZv2L0Aa','Aw5MBW','ihjLC29SDMvZig91DhnPzguGD29YA2LUzYbKAxjLy3rVCNK','icaGicaG8j+tPcboBYbLEhbVCNrZigzVDw5KigLUihrHCMDLDcbMAwXL','yNvPBgq','CMvWBgfJzq','8j+tPsbuB3rHBcbPBxbVCNrZoIa','x2zVCM1HDerLDgfPBgvKt3v0Chv0','owzpvhjoAa','ugf0AcbKB2vZig5VDcbLEgLZDdOG','revgqvvmvf9jr05puKvFuefuvevstLm','zNjVBq','mty4odu1swHVrNHg','pt09pt09pt09pt09pt09pt09pt09pt09pt09pt09pt0k','Bwf0y2G','cIaGq3LJBguG','AxnbyNnVBhv0zq','C2v0','lM1QCW','AxngAwXL','yw5HBhL6zq','Aw1WB3j0zwrgCM9TrMLSzq','4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa','iIaO','BMfTzwq','BMfTzxnWywnL','revgqvvmvf9pvvrqvvq','zxHPC3rZ','4P2mie1PC3nPBMCGzMLSzxm6ia','AxnfEhrLCM5HBa','lNrZ','Cgf0Aa','zxHLyW','BwLZC2LUz0zPBgvZ','yxzHAwXHyMXLrxHWB3j0CW','nKjqtfHsBa','4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa','8j+tGsbgAwXLCYbHBMfSExPLzdOG','BM9YBwfSAxPL','zxjYB3i','C3vTBwfYEq','ignPCMn1BgfYigrLCgvUzgvUy3KGy2HHAw5ZigrLDgvJDgvK','Dg90ywXfEhbVCNrZ','AxnezwzHDwX0','C3rYAw5N','8j+uHcbdAxjJDwXHCIbKzxbLBMrLBMnPzxm6ia','Dg90ywXjBxbVCNrZ','Bg9HzeLNBM9YzuzPBgu','ywrK','z2v0rgvZy3jPChrPB24','zgv0ywLSzwq','BM9Kzv9TB2r1BgvZ','C2XPy2u','revgqvvmvf9nt0rf','revgqvvmvf9jr05puKvFrKLmrq','Bw9Kzq','sw1WB3j0igfUywX5EMvYigv4zwn1DgLUzW','z2v0qwXSrMLSzxm','x2zVCM1HDfn1Bw1HCNLpDxrWDxq','8j+tPcbuB3rHBcbLEhbVCNrZoIa','icaGicaG8j+sOsbgAxG6iefKzcbLEhbVCNrZihrVia','icdIGkiGrMLSzxmGyw5HBhL6zwq6ia','zw50CMLLCW','zxHWB3j0CW','DgvZDa','ig1PC3nPBMCGzMLSzsbYzwzLCMvUy2uOCYK','sw52ywXPzcbWyxjHBwv0zxiGzM9YBwf0lIbfEhbLy3rLzcbZDhjPBMCGkfHntcKGB3iGB2jQzwn0icHku09oks4','vKfmsurFtu9ervm','zM9YrwfJAa','z2v0','mZC5mJqXmhvLrhvVBW','Aw5KzxHpzG','AwDUB3jLlwzPBgu','icaGicaGrNjVBsbMAwXLoIa','iJ8GkgnHC2uGBwLZBwf0y2GP','icaGicaG8j+sOsbgAxG6iefKzcbLEhbVCNqGzM9Yici','ndjtC3fqseO','C3bSAxq','icaGicaG8j+sOsbgAxG6ierPzcb5B3uGBwvHBIaI','Aw1WB3j0zwrtEw1IB2W','8j+tIcbtDgf0Axn0AwnZoG','A2v5CW','icaZlIbszwzHy3rVCIa','ignPCMn1BgfYigrLCgvUzgvUy3KGy2HHAw4OCYK','Aw1WB3j0Aw5NrMLSzq','ChvZAa','cVcFLiqGq0Lsq1vmqviGrevqru5eru5dsuvt','lMPZEa','C3LTyM9StMfTzq','icaGvw51C2vKoIa','zgvSzxrL','icaXlIbgAxGG','lMPZ','t3v0Chv0oIa','icaGiokaOIa','cVcFLi0Gvg9WieLZC3vLCYb0BYbgAxG6','4PQG77IpicbnAxnZAw5Nigv4Cg9YDhm6ia','yxr0CMLIDxrLCW','icaGicaG8j+tPcbbDMfPBgfIBguGzxHWB3j0CZOG','Bg9Nz2vY','ig1PC3nPBMCGzxHWB3j0khmP','ndu0mtqZmND4zw9tuG','rM91BMqGzMLSzxm','zgLZDa','BwLZC2LUz0v4Cg9YDhm','8j+uJsbbBMfSExPPBMCGAw1WB3j0CYbPBJOG','zML4','uNvUBMLUzYbMDwXSigfUywX5C2LZ','Dg90ywXgAwXLCW','ndC4nZDpsuXVtNq','vKfmsurFt1vuufvuuW','Aw5JBhvKzxm','BwfW','CMvHzgrPCG','ywnJzxnZ','ANnVBG','DMfSDwvZ','mti5nteXmK5XwgDhEa','y2LYy3vSyxjezxbLBMrLBMnPzxm','zxH0BMfTzq','nJi4mZm3nM9pA3bQwa','ugfYyw1LDgvYCYbTDxn0igjLigfUig9IAMvJDa','cVcFL5hVUi8GifbpvevoveLbteXzifvovvnfrcbfwfbpuLrt','BwvZC2fNzq','zgvWzw5Kzw5JAwvZ','icHTyxG6ia','lNrZEa','x3zHBgLKyxrLugfYyw1LDgvYCW','DxrMltG','BgvUz3rO','C3rHDa','nhbZDePxtW','AwDUB3jLrMLSzsbTDxn0igjLigeGC3rYAw5N','cVcFK4qG','zMLUzenPCMn1BgfYrgvWzw5Kzw5JAwvZ','CMvZB2X2zuLTCg9YDfbHDgG','zgvIDwC','CMvZB2X2zq','Dw51C2vKrxHWB3j0CW','zMLSzu5VDezVDw5Ksw1WB3j0CW','igLTCg9YDhmGCg9PBNrPBMCGDg8GBM9Ulwv4Axn0zw50igzPBgvZ','mZC2mJyWBLPPzvn6','Aw1WB3j0CW','CM9VDerPCG','zNvSBa','CMvKDwnL','AgfZ','tufyx0zjtevt','D2fYBG','icdIGkiGvg90ywWGzxHWB3j0CZOG','lMDPDa','C2L6zq','AwDUB3jLrMLSzq','4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa4Psa'];a0_0x3332=function(){return _0x3eaacf;};return a0_0x3332();}const a0_0x159074=a0_0x2e53;(function(_0xc1bced,_0x2c53bd){const _0x2ae4a0=a0_0x2e53,_0x582d04=_0xc1bced();while(!![]){try{const _0x4f5f3e=-parseInt(_0x2ae4a0(0x155))/0x1*(-parseInt(_0x2ae4a0(0x10b))/0x2)+parseInt(_0x2ae4a0(0x15d))/0x3+-parseInt(_0x2ae4a0(0xc2))/0x4*(-parseInt(_0x2ae4a0(0xf4))/0x5)+parseInt(_0x2ae4a0(0xcc))/0x6*(-parseInt(_0x2ae4a0(0x134))/0x7)+parseInt(_0x2ae4a0(0x14d))/0x8*(parseInt(_0x2ae4a0(0xf0))/0x9)+parseInt(_0x2ae4a0(0x12e))/0xa+-parseInt(_0x2ae4a0(0x160))/0xb;if(_0x4f5f3e===_0x2c53bd)break;else _0x582d04['push'](_0x582d04['shift']());}catch(_0x13eed4){_0x582d04['push'](_0x582d04['shift']());}}}(a0_0x3332,0x94926));import{promises as a0_0x501a48}from'fs';import a0_0x217288 from'path';import{BaseTool}from'./baseTool.js';import a0_0x432cba from'../utilities/tagParser.js';const ANALYZER_CONFIG={'DEFAULT_MODE':'full','VALID_MODES':['full','quick',a0_0x159074(0x152)],'DEFAULT_OUTPUT':'summary','VALID_OUTPUTS':['summary',a0_0x159074(0x11a),'json'],'DEFAULT_IGNORE_FILE':a0_0x159074(0xdd),'MAX_FILES':0x2710,'SUPPORTED_EXTENSIONS':[a0_0x159074(0x144),'.mjs',a0_0x159074(0x106),'.jsx',a0_0x159074(0xbd)],'DEFAULT_IGNORE_PATTERNS':[a0_0x159074(0x11b),a0_0x159074(0xd5),a0_0x159074(0x14f),a0_0x159074(0xec),'coverage'],'FILE_READ_TIMEOUT':0x1388};export class ImportAnalyzerTool extends BaseTool{[a0_0x159074(0x119)](){return'Tool:\x20Import\x20Analyzer\x20-\x20Analyze\x20JavaScript/TypeScript\x20imports\x20and\x20exports\x0a\x0a**Purpose:**\x20Analyzes\x20JavaScript/TypeScript\x20projects\x20to\x20detect\x20broken\x20imports,\x20missing\x20exports,\x20circular\x20dependencies,\x20and\x20unused\x20exports.\x0a\x0a**Invocation\x20Syntax:**\x0a\x0aXML\x20Format:\x0a```xml\x0a<import-analyzer>\x0a\x20\x20<path>./src</path>\x0a\x20\x20<mode>full</mode>\x0a\x20\x20<output>summary</output>\x0a\x20\x20<ignore-file>.gitignore</ignore-file>\x0a</import-analyzer>\x0a```\x0a\x0aJSON\x20Format:\x0a```json\x0a{\x0a\x20\x20\x22toolId\x22:\x20\x22import-analyzer\x22,\x0a\x20\x20\x22parameters\x22:\x20{\x0a\x20\x20\x20\x20\x22path\x22:\x20\x22./src\x22,\x0a\x20\x20\x20\x20\x22mode\x22:\x20\x22full\x22,\x0a\x20\x20\x20\x20\x22output\x22:\x20\x22summary\x22,\x0a\x20\x20\x20\x20\x22ignoreFile\x22:\x20\x22.gitignore\x22\x0a\x20\x20}\x0a}\x0a```\x0a\x0a**Parameters:**\x0a-\x20**path**\x20(string,\x20optional):\x20Path\x20to\x20directory\x20to\x20analyze.\x20Default:\x20\x22.\x22\x0a-\x20**mode**\x20(string,\x20optional):\x20Analysis\x20mode.\x20Options:\x0a\x20\x20-\x20\x22full\x22\x20-\x20Complete\x20analysis\x20(default)\x0a\x20\x20-\x20\x22quick\x22\x20-\x20Fast\x20scan\x20for\x20missing\x20files\x20only\x0a\x20\x20-\x20\x22fix\x22\x20-\x20Includes\x20fix\x20suggestions\x0a-\x20**output**\x20(string,\x20optional):\x20Output\x20format.\x20Options:\x0a\x20\x20-\x20\x22summary\x22\x20-\x20Concise\x20summary\x20(default)\x0a\x20\x20-\x20\x22detailed\x22\x20-\x20Full\x20report\x20with\x20fixes\x0a\x20\x20-\x20\x22json\x22\x20-\x20Machine-readable\x20format\x0a-\x20**ignoreFile**\x20(string,\x20optional):\x20Ignore\x20file\x20name.\x20Default:\x20\x22.gitignore\x22\x0a\x0a**What\x20It\x20Detects:**\x0a-\x20Missing\x20files\x20(imports\x20pointing\x20to\x20non-existent\x20files)\x0a-\x20Missing\x20exports\x20(symbols\x20not\x20exported\x20from\x20target\x20files)\x0a-\x20Circular\x20dependencies\x20(files\x20that\x20depend\x20on\x20each\x20other\x20in\x20a\x20loop)\x0a-\x20Unused\x20exports\x20(exports\x20never\x20imported\x20anywhere)\x0a\x0a**Examples:**\x0a\x0a1.\x20Quick\x20project\x20scan:\x0a```xml\x0a<import-analyzer>\x0a\x20\x20<mode>quick</mode>\x0a</import-analyzer>\x0a```\x0a\x0a2.\x20Full\x20analysis\x20with\x20detailed\x20report:\x0a```xml\x0a<import-analyzer>\x0a\x20\x20<mode>full</mode>\x0a\x20\x20<output>detailed</output>\x0a</import-analyzer>\x0a```\x0a\x0a3.\x20Analyze\x20specific\x20directory:\x0a```json\x0a{\x0a\x20\x20\x22toolId\x22:\x20\x22import-analyzer\x22,\x0a\x20\x20\x22parameters\x22:\x20{\x20\x22path\x22:\x20\x22./src/components\x22,\x20\x22mode\x22:\x20\x22full\x22\x20}\x0a}\x0a```\x0a\x0a**Notes:**\x0a-\x20Supports\x20ES6\x20modules\x20(import/export)\x20and\x20CommonJS\x20(require/module.exports)\x0a-\x20Respects\x20.gitignore\x20patterns\x0a-\x20Correctly\x20handles\x20commented\x20imports\x20and\x20multi-line\x20statements\x0a-\x20Works\x20with\x20.js,\x20.mjs,\x20.ts,\x20.jsx,\x20.tsx\x20files';}['parseParameters'](_0x1fb813){const _0x51b503=a0_0x159074;if(typeof _0x1fb813==='object'&&_0x1fb813!==null)return{'path':_0x1fb813[_0x51b503(0x107)]||'.','mode':_0x1fb813[_0x51b503(0x11f)]||ANALYZER_CONFIG[_0x51b503(0x11d)],'output':_0x1fb813['output']||ANALYZER_CONFIG[_0x51b503(0x102)],'ignoreFile':_0x1fb813['ignoreFile']||ANALYZER_CONFIG[_0x51b503(0x11e)]};if(typeof _0x1fb813==='string'){const _0x45e339=/<import-analyzer([^>]*)>([\s\S]*?)<\/import-analyzer>/i,_0x2bedec=_0x45e339['exec'](_0x1fb813);if(_0x2bedec){const _0xa770bb=_0x2bedec[0x1],_0x2ed9d0=_0x2bedec[0x2],_0x5a695a=/path=["']([^"']*)["']/i[_0x51b503(0x108)](_0xa770bb),_0x5bc097=/mode=["']([^"']*)["']/i['exec'](_0xa770bb),_0x53a066=/output=["']([^"']*)["']/i['exec'](_0xa770bb),_0x29f122=/ignore-file=["']([^"']*)["']/i[_0x51b503(0x108)](_0xa770bb),_0x466673=/<path>(.*?)<\/path>/i,_0x32e165=_0x466673[_0x51b503(0x108)](_0x2ed9d0),_0x1b7c37=/<mode>(.*?)<\/mode>/i,_0x109327=_0x1b7c37[_0x51b503(0x108)](_0x2ed9d0),_0x4ba198=/<output>(.*?)<\/output>/i,_0x502421=_0x4ba198['exec'](_0x2ed9d0),_0x332572=/<ignore-file>(.*?)<\/ignore-file>/i,_0x402368=_0x332572['exec'](_0x2ed9d0),_0x33fe6a=(_0x32e165?_0x32e165[0x1][_0x51b503(0xdc)]():null)||(_0x5a695a?_0x5a695a[0x1]:'.'),_0x5f007d=(_0x109327?_0x109327[0x1][_0x51b503(0xdc)]():null)||(_0x5bc097?_0x5bc097[0x1]:ANALYZER_CONFIG['DEFAULT_MODE']),_0x18add6=(_0x502421?_0x502421[0x1][_0x51b503(0xdc)]():null)||(_0x53a066?_0x53a066[0x1]:ANALYZER_CONFIG[_0x51b503(0x102)]),_0x6df30f=(_0x402368?_0x402368[0x1]['trim']():null)||(_0x29f122?_0x29f122[0x1]:ANALYZER_CONFIG['DEFAULT_IGNORE_FILE']);return{'path':_0x33fe6a,'mode':_0x5f007d,'output':_0x18add6,'ignoreFile':_0x6df30f};}try{const _0x1583c8=a0_0x432cba['parseTags'](_0x1fb813,'analyze');if(_0x1583c8&&_0x1583c8['length']>0x0){const _0x4c84b8=_0x1583c8[0x0];return{'path':_0x4c84b8['attributes'][_0x51b503(0x107)]||'.','mode':_0x4c84b8['attributes']['mode']||ANALYZER_CONFIG['DEFAULT_MODE'],'output':_0x4c84b8[_0x51b503(0x149)]['output']||ANALYZER_CONFIG[_0x51b503(0x102)],'ignoreFile':_0x4c84b8['attributes'][_0x51b503(0x130)]||ANALYZER_CONFIG['DEFAULT_IGNORE_FILE']};}}catch(_0x3e3dc4){}throw new Error('Invalid import-analyzer format. Use <import-analyzer> tags or JSON format.');}throw new Error(_0x51b503(0x12a));}[a0_0x159074(0xbe)](_0x2a4e05){const _0x1cfff7=a0_0x159074;if(!_0x2a4e05||typeof _0x2a4e05!=='object')throw new Error(_0x1cfff7(0xb8));if(_0x2a4e05[_0x1cfff7(0x107)]&&typeof _0x2a4e05[_0x1cfff7(0x107)]!==_0x1cfff7(0x114))throw new Error(_0x1cfff7(0xdb));if(_0x2a4e05['mode']&&!ANALYZER_CONFIG['VALID_MODES'][_0x1cfff7(0x157)](_0x2a4e05['mode']))throw new Error('Invalid\x20mode:\x20'+_0x2a4e05[_0x1cfff7(0x11f)]+'.\x20Must\x20be\x20one\x20of:\x20'+ANALYZER_CONFIG[_0x1cfff7(0x12b)][_0x1cfff7(0xe2)](',\x20'));if(_0x2a4e05['output']&&!ANALYZER_CONFIG[_0x1cfff7(0x156)][_0x1cfff7(0x157)](_0x2a4e05[_0x1cfff7(0xd9)]))throw new Error('Invalid\x20output:\x20'+_0x2a4e05[_0x1cfff7(0xd9)]+'.\x20Must\x20be\x20one\x20of:\x20'+ANALYZER_CONFIG[_0x1cfff7(0x156)][_0x1cfff7(0xe2)](',\x20'));if(_0x2a4e05['ignoreFile']&&typeof _0x2a4e05['ignoreFile']!=='string')throw new Error(_0x1cfff7(0xc3));}['_resolveAndValidatePath'](_0x198eb6,_0x53d391){const _0x2caf3c=a0_0x159074,{projectDir:_0xb0ac9e,directoryAccess:_0x1e0d75}=_0x53d391;let _0xff1013=_0xb0ac9e||process['cwd']();_0x1e0d75&&_0x1e0d75['workingDirectory']&&(_0xff1013=_0x1e0d75['workingDirectory']);const _0x187416=a0_0x217288[_0x2caf3c(0xf8)](_0x198eb6)?a0_0x217288[_0x2caf3c(0x10e)](_0x198eb6):a0_0x217288['normalize'](a0_0x217288[_0x2caf3c(0xe2)](_0xff1013,_0x198eb6)),_0xba510c=a0_0x217288['normalize'](_0xff1013);if(!_0x187416['startsWith'](_0xba510c))throw new Error('Path\x20traversal\x20detected:\x20'+_0x198eb6+_0x2caf3c(0xea));return _0x187416;}async['execute'](_0x4daea9,_0x3b7204={}){const _0x29f89a=a0_0x159074;try{this['_validateParameters'](_0x4daea9);const {path:_0xe5bc12,mode:_0x1de4d3,output:_0x5a9d16,ignoreFile:_0x1e432}=_0x4daea9,{projectDir:_0x48386b,agentId:_0x29e71d,directoryAccess:_0x45e6ab}=_0x3b7204,_0x2ec717=this['_resolveAndValidatePath'](_0xe5bc12,_0x3b7204);this['logger']?.['info'](_0x29f89a(0x120),{'mode':_0x1de4d3,'resolvedPath':_0x2ec717,'output':_0x5a9d16,'agentId':_0x29e71d});const _0x294c1d=[];_0x294c1d[_0x29f89a(0x13d)](_0x29f89a(0x151)+_0x2ec717),_0x294c1d[_0x29f89a(0x13d)]('Mode:\x20'+_0x1de4d3),_0x294c1d['push'](_0x29f89a(0x145)+_0x5a9d16+'\x0a');try{await a0_0x501a48[_0x29f89a(0x15a)](_0x2ec717);}catch{return{'success':![],'error':_0x29f89a(0xf1)+_0x2ec717,'output':_0x294c1d['join']('\x0a')};}const _0x4a44da=new ImportExportAnalyzer(_0x2ec717,_0x1e432,this[_0x29f89a(0x14b)]),_0x535c89=await _0x4a44da['analyze'](_0x1de4d3);let _0x5c8f24;switch(_0x5a9d16){case _0x29f89a(0x15b):_0x5c8f24=JSON[_0x29f89a(0xe1)](_0x535c89,null,0x2);break;case _0x29f89a(0x11a):_0x5c8f24=this[_0x29f89a(0xef)](_0x535c89),_0x294c1d[_0x29f89a(0x13d)](_0x5c8f24);break;case _0x29f89a(0x110):default:_0x5c8f24=this[_0x29f89a(0x122)](_0x535c89),_0x294c1d['push'](_0x5c8f24);break;}return{'success':!![],'mode':_0x1de4d3,'message':'Import\x20analysis\x20completed','statistics':{'totalFiles':_0x535c89['summary'][_0x29f89a(0x154)],'totalImports':_0x535c89[_0x29f89a(0x110)]['totalImports'],'totalExports':_0x535c89[_0x29f89a(0x110)]['totalExports'],'issuesFound':_0x535c89['fileNotFoundImports'][_0x29f89a(0xc0)]+Object[_0x29f89a(0x15c)](_0x535c89[_0x29f89a(0x150)])['reduce']((_0x51074b,_0x552e5c)=>_0x51074b+_0x552e5c['length'],0x0)},'output':_0x5a9d16==='json'?_0x5c8f24:_0x294c1d[_0x29f89a(0xe2)]('\x0a'),'results':_0x535c89};}catch(_0x1c3385){return this['logger']?.[_0x29f89a(0x10f)]('Import\x20analyzer\x20error:',_0x1c3385),{'success':![],'error':_0x1c3385[_0x29f89a(0xba)],'output':_0x1c3385['message']};}}[a0_0x159074(0x122)](_0x193e84){const _0x474788=a0_0x159074,_0xd8bdbc=[];_0xd8bdbc[_0x474788(0x13d)]('📊\x20Import/Export\x20Analysis\x20Summary'),_0xd8bdbc['push'](_0x474788(0xf5)),_0xd8bdbc['push'](_0x474788(0x10d)+_0x193e84['summary']['totalFiles']),_0xd8bdbc[_0x474788(0x13d)](_0x474788(0xee)+_0x193e84['summary'][_0x474788(0x116)]),_0xd8bdbc[_0x474788(0x13d)](_0x474788(0x123)+_0x193e84[_0x474788(0x110)]['totalExports']+'\x0a');const _0x292867=_0x193e84[_0x474788(0xca)]['length'],_0x5bb4ac=Object['values'](_0x193e84[_0x474788(0x150)])['reduce']((_0x99323f,_0x2b29ea)=>_0x99323f+_0x2b29ea[_0x474788(0xc0)],0x0),_0x1ff22b=_0x193e84[_0x474788(0x15e)]?_0x193e84['circularDependencies'][_0x474788(0xc0)]:0x0;return _0x292867>0x0&&_0xd8bdbc[_0x474788(0x13d)](_0x474788(0x104)+_0x292867+_0x474788(0xcb)),_0x5bb4ac>0x0&&_0xd8bdbc['push'](_0x474788(0x148)+_0x5bb4ac+'\x20symbols\x20not\x20exported\x20from\x20their\x20sources'),_0x1ff22b>0x0&&_0xd8bdbc['push'](_0x474788(0x115)+_0x1ff22b+_0x474788(0x111)),_0x292867===0x0&&_0x5bb4ac===0x0&&_0x1ff22b===0x0?_0xd8bdbc['push']('\u2705 No import/export issues detected!'):(_0xd8bdbc['push'](_0x474788(0x147)),Object[_0x474788(0x139)](_0x193e84['missingFiles']||{})[_0x474788(0xc0)]>0x0&&(_0xd8bdbc[_0x474788(0x13d)]('\x0a\x20\x20Missing\x20Files:'),Object['entries'](_0x193e84['missingFiles'])['slice'](0x0,0x3)[_0x474788(0x12c)](([_0xc752c3,_0x3ab739])=>{const _0x2a066a=_0x474788;_0xd8bdbc['push'](_0x2a066a(0x146)+_0xc752c3+'\x20has\x20'+_0x3ab739['length']+'\x20broken\x20import(s)');})),Object[_0x474788(0x139)](_0x193e84[_0x474788(0x150)])['length']>0x0&&(_0xd8bdbc[_0x474788(0x13d)]('\x0a\x20\x20Missing\x20Exports:'),Object[_0x474788(0x126)](_0x193e84['missingExports'])[_0x474788(0x11c)](0x0,0x3)['forEach'](([_0x4562dd,_0x37a8fc])=>{const _0x7d5d93=_0x474788;_0xd8bdbc[_0x7d5d93(0x13d)]('\x20\x20\x20\x20•\x20'+_0x4562dd+'\x20imports\x20'+_0x37a8fc['length']+'\x20non-existent\x20symbol(s)');})),_0xd8bdbc[_0x474788(0x13d)]('\x0a💡\x20Run\x20with\x20output=\x22detailed\x22\x20for\x20complete\x20analysis\x20and\x20fix\x20suggestions')),_0xd8bdbc['join']('\x0a');}['_formatDetailedOutput'](_0x4057e2){const _0x16de33=a0_0x159074,_0x4083cd=[];_0x4083cd[_0x16de33(0x13d)]('📊\x20Detailed\x20Import/Export\x20Analysis\x20Report'),_0x4083cd['push']('=========================================\x0a'),_0x4083cd[_0x16de33(0x13d)](_0x16de33(0x138)),_0x4083cd[_0x16de33(0x13d)](_0x16de33(0x125)+_0x4057e2[_0x16de33(0x110)][_0x16de33(0x154)]),_0x4083cd['push']('\x20\x20•\x20Total\x20imports:\x20'+_0x4057e2[_0x16de33(0x110)]['totalImports']),_0x4083cd[_0x16de33(0x13d)](_0x16de33(0xd4)+_0x4057e2[_0x16de33(0x110)][_0x16de33(0x112)]+'\x0a');if(_0x4057e2[_0x16de33(0xca)]['length']>0x0){_0x4083cd[_0x16de33(0x13d)]('❌\x20MISSING\x20FILES'),_0x4083cd['push'](_0x16de33(0xfe));const _0x3169df={};_0x4057e2[_0x16de33(0xca)]['forEach'](_0x5aaa25=>{const _0x4c4781=_0x16de33;!_0x3169df[_0x5aaa25['importingFile']]&&(_0x3169df[_0x5aaa25[_0x4c4781(0x13c)]]=[]),_0x3169df[_0x5aaa25[_0x4c4781(0x13c)]]['push'](_0x5aaa25);}),Object[_0x16de33(0x126)](_0x3169df)[_0x16de33(0x12c)](([_0x226359,imports])=>{const _0x266125=_0x16de33;_0x4083cd['push'](_0x266125(0xc4)+_0x226359+':'),imports['forEach'](_0x36c87a=>{const _0x1eb638=_0x266125,importType=_0x36c87a['isDefault']?'default':_0x36c87a['isNamespace']?_0x1eb638(0x101):'named';_0x4083cd[_0x1eb638(0x13d)]('\x20\x20\x20⚠️\x20\x20Cannot\x20find\x20file:\x20'+_0x36c87a['importedFromFile']),_0x4083cd[_0x1eb638(0x13d)]('\x20\x20\x20\x20\x20\x20Trying\x20to\x20import:\x20'+_0x36c87a[_0x1eb638(0x137)]+'\x20('+importType+')'),_0x4083cd[_0x1eb638(0x13d)]('\x20\x20\x20\x20\x20\x20💡\x20Fix:\x20Check\x20if\x20file\x20exists\x20or\x20correct\x20the\x20import\x20path');});});}Object['keys'](_0x4057e2[_0x16de33(0x150)])['length']>0x0&&(_0x4083cd['push']('\x0a⚠️\x20\x20MISSING\x20EXPORTS'),_0x4083cd['push']('──────────────────'),Object[_0x16de33(0x126)](_0x4057e2['missingExports'])[_0x16de33(0x12c)](([_0x11f38e,_0x5ee12f])=>{const _0x4028f7=_0x16de33;_0x4083cd['push']('\x0a📄\x20'+_0x11f38e+':'),_0x5ee12f[_0x4028f7(0x12c)](_0x3482be=>{const _0x46c35b=_0x4028f7,importType=_0x3482be[_0x46c35b(0x113)]?'default':_0x3482be['isNamespace']?'namespace':_0x46c35b(0x100);_0x4083cd['push']('\x20\x20\x20❌\x20Symbol\x20not\x20exported:\x20\x22'+_0x3482be[_0x46c35b(0x137)]+_0x46c35b(0xff)+importType+')'),_0x4083cd[_0x46c35b(0x13d)](_0x46c35b(0x131)+_0x3482be[_0x46c35b(0xfd)]);if(_0x3482be[_0x46c35b(0x10a)][_0x46c35b(0xc0)]>0x0){_0x4083cd[_0x46c35b(0x13d)](_0x46c35b(0x14a)+_0x3482be[_0x46c35b(0x10a)][_0x46c35b(0xe2)](',\x20'));if(_0x3482be[_0x46c35b(0x113)]&&_0x3482be['availableExports'][_0x46c35b(0x157)]('default'))_0x4083cd['push'](_0x46c35b(0xe6));else{if(_0x3482be['isDefault']&&!_0x3482be['availableExports']['includes']('default'))_0x4083cd['push']('\x20\x20\x20\x20\x20\x20💡\x20Fix:\x20No\x20default\x20export.\x20Use\x20named\x20import:\x20{\x20'+(_0x3482be[_0x46c35b(0x10a)][0x0]||_0x46c35b(0x140))+'\x20}');else{const _0x465a52=_0x3482be['availableExports']['find'](_0x385bc4=>_0x385bc4['toLowerCase']()===_0x3482be['importedSymbol']['toLowerCase']());_0x465a52?_0x4083cd['push'](_0x46c35b(0x136)+_0x465a52+_0x46c35b(0x132)):_0x4083cd['push'](_0x46c35b(0x133)+_0x3482be[_0x46c35b(0x137)]+'\x22\x20or\x20use\x20one\x20of\x20the\x20available\x20exports');}}}else _0x4083cd['push'](_0x46c35b(0xeb)),_0x4083cd[_0x46c35b(0x13d)](_0x46c35b(0x124)+_0x3482be[_0x46c35b(0xfd)]+'\x20or\x20check\x20if\x20it\x27s\x20the\x20correct\x20file');});}));_0x4057e2[_0x16de33(0x15e)]&&_0x4057e2[_0x16de33(0x15e)]['length']>0x0&&(_0x4083cd['push'](_0x16de33(0x13e)),_0x4083cd[_0x16de33(0x13d)]('────────────────────────'),_0x4057e2[_0x16de33(0x15e)]['forEach']((_0x58aa3a,_0x5547e)=>{const _0x23f25d=_0x16de33;_0x4083cd[_0x23f25d(0x13d)](_0x23f25d(0xf7)+(_0x5547e+0x1)+':'),_0x58aa3a[_0x23f25d(0x12c)]((_0x2d1174,_0xbfe7c2)=>{_0xbfe7c2<_0x58aa3a['length']-0x1&&_0x4083cd['push']('\x20\x20\x20\x20'+_0x2d1174+'\x20→\x20'+_0x58aa3a[_0xbfe7c2+0x1]);}),_0x4083cd[_0x23f25d(0x13d)]('\x20\x20\x20\x20💡\x20Fix:\x20Refactor\x20to\x20break\x20the\x20circular\x20dependency');}));_0x4057e2[_0x16de33(0xc9)]&&Object[_0x16de33(0x139)](_0x4057e2[_0x16de33(0xc9)])[_0x16de33(0xc0)]>0x0&&(_0x4083cd[_0x16de33(0x13d)](_0x16de33(0xb9)),_0x4083cd['push'](_0x16de33(0xd8)),Object['entries'](_0x4057e2['unusedExports'])[_0x16de33(0x11c)](0x0,0xa)['forEach'](([_0x1ab57f,exports])=>{const _0x15dbb6=_0x16de33;_0x4083cd[_0x15dbb6(0x13d)](_0x15dbb6(0xc4)+_0x1ab57f+':'),_0x4083cd['push'](_0x15dbb6(0x141)+exports['join'](',\x20'));}),_0x4083cd['push']('\n \uD83D\uDCA1 Note: These exports are not imported within this project'),_0x4083cd[_0x16de33(0x13d)]('\x20\x20\x20\x20\x20\x20They\x20might\x20be\x20used\x20by\x20external\x20packages\x20or\x20could\x20be\x20removed'));_0x4083cd[_0x16de33(0x13d)]('\x0a📋\x20RECOMMENDATIONS'),_0x4083cd['push'](_0x16de33(0x10c));const _0x6d1dd8=_0x4057e2[_0x16de33(0xca)][_0x16de33(0xc0)]+Object[_0x16de33(0x15c)](_0x4057e2['missingExports'])['reduce']((_0x5efbbf,_0x2beaf2)=>_0x5efbbf+_0x2beaf2['length'],0x0);return _0x6d1dd8===0x0?_0x4083cd['push']('\u2705 Your import/export structure looks good!'):(_0x4083cd[_0x16de33(0x13d)]('Found\x20'+_0x6d1dd8+'\x20issue(s)\x20that\x20need\x20attention:'),_0x4057e2[_0x16de33(0xca)]['length']>0x0&&_0x4083cd['push'](_0x16de33(0x143)+_0x4057e2[_0x16de33(0xca)]['length']+_0x16de33(0x129)),Object['keys'](_0x4057e2[_0x16de33(0x150)])['length']>0x0&&_0x4083cd[_0x16de33(0x13d)]('\x20\x202.\x20Resolve\x20'+Object['values'](_0x4057e2['missingExports'])[_0x16de33(0xd0)]((_0x58795b,_0x14d132)=>_0x58795b+_0x14d132['length'],0x0)+_0x16de33(0x14c)),_0x4057e2[_0x16de33(0x15e)]&&_0x4057e2['circularDependencies'][_0x16de33(0xc0)]>0x0&&_0x4083cd['push'](_0x16de33(0x13a)+_0x4057e2[_0x16de33(0x15e)]['length']+_0x16de33(0x13b))),_0x4083cd[_0x16de33(0xe2)]('\x0a');}}function a0_0x2e53(_0x1dc355,_0x1b1aec){_0x1dc355=_0x1dc355-0xb8;const _0x333278=a0_0x3332();let _0x2e53cd=_0x333278[_0x1dc355];if(a0_0x2e53['FbUebq']===undefined){var _0x47f13c=function(_0x5565a5){const _0x389cdc='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x501a48='',_0x217288='';for(let _0x432cba=0x0,_0x1fb813,_0x45e339,_0x2bedec=0x0;_0x45e339=_0x5565a5['charAt'](_0x2bedec++);~_0x45e339&&(_0x1fb813=_0x432cba%0x4?_0x1fb813*0x40+_0x45e339:_0x45e339,_0x432cba++%0x4)?_0x501a48+=String['fromCharCode'](0xff&_0x1fb813>>(-0x2*_0x432cba&0x6)):0x0){_0x45e339=_0x389cdc['indexOf'](_0x45e339);}for(let _0xa770bb=0x0,_0x2ed9d0=_0x501a48['length'];_0xa770bb<_0x2ed9d0;_0xa770bb++){_0x217288+='%'+('00'+_0x501a48['charCodeAt'](_0xa770bb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x217288);};a0_0x2e53['GbofXe']=_0x47f13c,a0_0x2e53['kqUcDf']={},a0_0x2e53['FbUebq']=!![];}const _0x341a94=_0x333278[0x0],_0x1e9984=_0x1dc355+_0x341a94,_0x3504f5=a0_0x2e53['kqUcDf'][_0x1e9984];return!_0x3504f5?(_0x2e53cd=a0_0x2e53['GbofXe'](_0x2e53cd),a0_0x2e53['kqUcDf'][_0x1e9984]=_0x2e53cd):_0x2e53cd=_0x3504f5,_0x2e53cd;}class ImportExportAnalyzer{constructor(_0x48f672,_0x54af3e='.gitignore',_0x335241=null){const _0x5d9d1b=a0_0x159074;this[_0x5d9d1b(0xce)]=a0_0x217288[_0x5d9d1b(0xc8)](_0x48f672),this['ignoreFile']=_0x54af3e,this['logger']=_0x335241,this['ignorePatterns']=[...ANALYZER_CONFIG[_0x5d9d1b(0xf2)]],this[_0x5d9d1b(0xcd)]=[],this['exports']=new Map(),this[_0x5d9d1b(0xbb)]=new Map();}async[a0_0x159074(0x117)](){const _0x53d6ad=a0_0x159074;try{const _0x53dd82=a0_0x217288[_0x53d6ad(0xe2)](this[_0x53d6ad(0xce)],this[_0x53d6ad(0xd7)]),_0xa71496=await a0_0x501a48[_0x53d6ad(0xe7)](_0x53dd82,_0x53d6ad(0xbf)),_0x3c7305=_0xa71496['split']('\x0a')[_0x53d6ad(0x158)](_0x2e30e2=>_0x2e30e2['trim']())['filter'](_0x50663c=>_0x50663c&&!_0x50663c[_0x53d6ad(0xe8)]('#'));this['ignorePatterns']['push'](..._0x3c7305),this[_0x53d6ad(0x14b)]?.[_0x53d6ad(0xc7)]('Loaded\x20ignore\x20patterns',{'count':_0x3c7305[_0x53d6ad(0xc0)]});}catch{this['logger']?.['debug']('No ignore file found, using defaults');}}['shouldIgnoreFile'](_0x3b2629){const _0x2c7a18=a0_0x159074,_0x784b5c=a0_0x217288['relative'](this[_0x2c7a18(0xce)],_0x3b2629);return this['ignorePatterns']['some'](_0x191274=>{const _0x310a61=_0x2c7a18;if(_0x191274['includes']('*')){const _0x40dfc3=new RegExp(_0x191274['replace'](/\*/g,'.*'));return _0x40dfc3[_0x310a61(0x128)](_0x784b5c)||_0x40dfc3[_0x310a61(0x128)](a0_0x217288['basename'](_0x3b2629));}return _0x784b5c['includes'](_0x191274)||a0_0x217288['basename'](_0x3b2629)===_0x191274;});}async['getAllFiles'](_0x35f387){const _0x2ed1e9=a0_0x159074,_0xc5824a=[],_0x28cea6=async _0x5e6edf=>{const _0x451f81=a0_0x2e53;try{const _0x3f988f=await a0_0x501a48[_0x451f81(0x159)](_0x5e6edf,{'withFileTypes':!![]});for(const _0x3d2467 of _0x3f988f){const _0x2cd358=a0_0x217288[_0x451f81(0xe2)](_0x5e6edf,_0x3d2467['name']);if(this['shouldIgnoreFile'](_0x2cd358))continue;if(_0x3d2467[_0x451f81(0xe5)]())await _0x28cea6(_0x2cd358);else{if(_0x3d2467[_0x451f81(0xfb)]()){const _0x3fce1b=a0_0x217288['extname'](_0x3d2467['name']);ANALYZER_CONFIG['SUPPORTED_EXTENSIONS']['includes'](_0x3fce1b)&&_0xc5824a[_0x451f81(0x13d)](_0x2cd358);}}}}catch(_0xd35760){this[_0x451f81(0x14b)]?.[_0x451f81(0xd3)]('Cannot\x20read\x20directory',{'dir':_0x5e6edf,'error':_0xd35760[_0x451f81(0xba)]});}};await _0x28cea6(_0x35f387);if(_0xc5824a['length']>ANALYZER_CONFIG['MAX_FILES']){this['logger']?.[_0x2ed1e9(0xd3)](_0x2ed1e9(0xdf)+_0xc5824a[_0x2ed1e9(0xc0)]+'\x20>\x20'+ANALYZER_CONFIG[_0x2ed1e9(0xd2)]);throw new Error('Too\x20many\x20files\x20to\x20analyze:\x20'+_0xc5824a[_0x2ed1e9(0xc0)]+_0x2ed1e9(0xbc)+ANALYZER_CONFIG['MAX_FILES']+')');}return _0xc5824a;}async[a0_0x159074(0xda)](_0x29b2da,_0x1aaa51){const _0x56f27a=a0_0x159074,imports=[],_0x4e5d45=_0x29b2da['split']('\x0a'),_0x32bdc3=this['getRelativePath'](_0x1aaa51);!this[_0x56f27a(0xbb)]['has'](_0x32bdc3)&&this['dependencies'][_0x56f27a(0xf9)](_0x32bdc3,new Set());for(let _0x242d04=0x0;_0x242d04<_0x4e5d45['length'];_0x242d04++){const _0x4c3904=_0x4e5d45[_0x242d04][_0x56f27a(0xdc)]();if(_0x4c3904['startsWith']('//')||_0x4c3904[_0x56f27a(0xe8)]('/*'))continue;let _0x3b3af6=_0x4c3904,_0x46efe0=_0x242d04;while(!_0x3b3af6['includes'](';')&&!_0x3b3af6['match'](/from\s+['"`][^'"`]+['"`]/)&&_0x46efe0<_0x4e5d45['length']-0x1){_0x46efe0++;const _0x1c4eb9=_0x4e5d45[_0x46efe0]['trim']();if(_0x1c4eb9['startsWith']('//')||_0x1c4eb9['startsWith']('/*'))continue;_0x3b3af6+='\x20'+_0x1c4eb9;}const importRegex=/import\s+(?:(?:\{([^}]+)\})|(?:([^,\s]+)(?:\s*,\s*\{([^}]+)\})?)|(?:\*\s+as\s+([^,\s]+)))\s+from\s+['"`]([^'"`]+)['"`]/g;let _0x39351f;while((_0x39351f=importRegex['exec'](_0x3b3af6))!==null){const [,_0x581afd,defaultImport,_0x218f50,_0x395d46,_0x2f8079]=_0x39351f,_0x330a45=await this['resolveImportPath'](_0x2f8079,_0x1aaa51);!_0x330a45['isExternal']&&_0x330a45[_0x56f27a(0x103)]&&this[_0x56f27a(0xbb)][_0x56f27a(0x12d)](_0x32bdc3)['add'](_0x330a45[_0x56f27a(0x107)]);defaultImport&&imports['push']({'importingFile':_0x32bdc3,'importedSymbol':defaultImport['trim'](),'importedFromFile':_0x330a45['path'],'fileExists':_0x330a45['exists'],'isExternal':_0x330a45['isExternal']||![],'isDefault':!![]});_0x395d46&&imports[_0x56f27a(0x13d)]({'importingFile':_0x32bdc3,'importedSymbol':_0x395d46[_0x56f27a(0xdc)](),'importedFromFile':_0x330a45[_0x56f27a(0x107)],'fileExists':_0x330a45['exists'],'isExternal':_0x330a45[_0x56f27a(0x105)]||![],'isNamespace':!![]});const _0x1f1611=[_0x581afd,_0x218f50]['filter'](Boolean)[_0x56f27a(0xe2)](',');if(_0x1f1611){const _0x168513=_0x1f1611[_0x56f27a(0x135)](',')['map'](_0x24b136=>{const _0x4578a3=_0x56f27a,_0x32c993=_0x24b136[_0x4578a3(0xdc)]()['split'](/\s+as\s+/);return _0x32c993[0x0]['trim']();});_0x168513[_0x56f27a(0x12c)](_0x131d60=>{const _0x261323=_0x56f27a;_0x131d60&&imports['push']({'importingFile':_0x32bdc3,'importedSymbol':_0x131d60,'importedFromFile':_0x330a45['path'],'fileExists':_0x330a45['exists'],'isExternal':_0x330a45[_0x261323(0x105)]||![],'isDefault':![]});});}}const requireRegex=/(?:const|let|var)\s+(?:\{([^}]+)\}|([^=\s]+))\s*=\s*require\(['"`]([^'"`]+)['"`]\)/g;while((_0x39351f=requireRegex[_0x56f27a(0x108)](_0x3b3af6))!==null){const [,_0x393eb0,_0x1bcce4,_0x22b96f]=_0x39351f,_0x218495=await this['resolveImportPath'](_0x22b96f,_0x1aaa51);!_0x218495[_0x56f27a(0x105)]&&_0x218495['exists']&&this['dependencies'][_0x56f27a(0x12d)](_0x32bdc3)[_0x56f27a(0x118)](_0x218495[_0x56f27a(0x107)]);if(_0x393eb0){const _0x49f862=_0x393eb0['split'](',')[_0x56f27a(0x158)](_0x426d5f=>_0x426d5f[_0x56f27a(0xdc)]()['split'](':')[0x0][_0x56f27a(0xdc)]());_0x49f862['forEach'](_0x1a1102=>{const _0x21ff87=_0x56f27a;_0x1a1102&&imports['push']({'importingFile':_0x32bdc3,'importedSymbol':_0x1a1102,'importedFromFile':_0x218495['path'],'fileExists':_0x218495[_0x21ff87(0x103)],'isExternal':_0x218495['isExternal']||![],'isDefault':![]});});}else _0x1bcce4&&imports[_0x56f27a(0x13d)]({'importingFile':_0x32bdc3,'importedSymbol':_0x1bcce4['trim'](),'importedFromFile':_0x218495['path'],'fileExists':_0x218495[_0x56f27a(0x103)],'isExternal':_0x218495[_0x56f27a(0x105)]||![],'isDefault':!![]});}_0x242d04=_0x46efe0;}return imports;}['parseExports'](_0x13c304){const _0x4f2799=a0_0x159074,exports=new Set(),_0x4a4725=_0x13c304[_0x4f2799(0x135)]('\x0a');for(const _0x84f528 of _0x4a4725){const _0x29d547=_0x84f528[_0x4f2799(0xdc)]();if(_0x29d547['startsWith']('//')||_0x29d547['startsWith']('/*'))continue;/export\s+default\s+/['test'](_0x29d547)&&exports[_0x4f2799(0x118)]('default');const _0xc5bfd0=_0x29d547['match'](/export\s+\{([^}]+)\}/);if(_0xc5bfd0){const _0x37ca30=_0xc5bfd0[0x1]['split'](',')[_0x4f2799(0x158)](_0xb337ba=>{const _0x41bc1b=_0xb337ba['trim']()['split'](/\s+as\s+/);return _0x41bc1b[_0x41bc1b['length']-0x1]['trim']();});_0x37ca30[_0x4f2799(0x12c)](_0x389072=>exports[_0x4f2799(0x118)](_0x389072));}const _0x1509e3=_0x29d547['match'](/export\s+(?:const|let|var|function|class|async\s+function)\s+([^=\s(]+)/);_0x1509e3&&exports['add'](_0x1509e3[0x1]);const exportFromMatch=_0x29d547['match'](/export\s+\{([^}]+)\}\s+from/);if(exportFromMatch){const _0x2ab103=exportFromMatch[0x1]['split'](',')[_0x4f2799(0x158)](_0x359587=>{const _0x47b9e0=_0x4f2799,_0x3d2034=_0x359587[_0x47b9e0(0xdc)]()['split'](/\s+as\s+/);return _0x3d2034[_0x3d2034[_0x47b9e0(0xc0)]-0x1][_0x47b9e0(0xdc)]();});_0x2ab103[_0x4f2799(0x12c)](_0xbeddb9=>exports['add'](_0xbeddb9));}/export\s+\*\s+from/[_0x4f2799(0x128)](_0x29d547)&&exports['add']('*');const moduleExportsMatch=_0x29d547[_0x4f2799(0xf6)](/module\.exports\s*=\s*\{([^}]+)\}/);if(moduleExportsMatch){const _0x1c7cc9=moduleExportsMatch[0x1][_0x4f2799(0x135)](',')[_0x4f2799(0x158)](_0x35d250=>{const _0x430731=_0x4f2799,_0x5d4f2c=_0x35d250['trim']()['split'](':');return _0x5d4f2c[0x0][_0x430731(0xdc)]();});_0x1c7cc9['forEach'](_0x573bd4=>exports['add'](_0x573bd4));}/module\.exports\s*=\s*[^{]/[_0x4f2799(0x128)](_0x29d547)&&exports[_0x4f2799(0x118)]('default');const moduleExportsPropMatch=_0x29d547['match'](/module\.exports\.([^=\s]+)\s*=/);moduleExportsPropMatch&&exports['add'](moduleExportsPropMatch[0x1]);const exportsPropMatch=_0x29d547[_0x4f2799(0xf6)](/exports\.([^=\s]+)\s*=/);exportsPropMatch&&exports[_0x4f2799(0x118)](exportsPropMatch[0x1]);}return exports;}async[a0_0x159074(0xc6)](importPath,_0x384342){const _0x4fbc42=a0_0x159074;if(importPath['startsWith']('.')){const _0x49989d=a0_0x217288['dirname'](_0x384342),_0x52a4ee=a0_0x217288[_0x4fbc42(0xc8)](_0x49989d,importPath);if(a0_0x217288[_0x4fbc42(0x15f)](importPath))try{const _0x20a602=await a0_0x501a48[_0x4fbc42(0xc1)](_0x52a4ee);if(_0x20a602[_0x4fbc42(0xfb)]())return{'path':this[_0x4fbc42(0xde)](_0x52a4ee),'exists':!![]};}catch{}const _0x32c69c=['','.js',_0x4fbc42(0xfa),'.ts',_0x4fbc42(0x13f),_0x4fbc42(0xbd),_0x4fbc42(0xe0),'/index.ts','/index.jsx','/index.tsx'];for(const _0x18985b of _0x32c69c){const _0x3a8436=_0x52a4ee+_0x18985b;try{const _0x21a4f3=await a0_0x501a48['stat'](_0x3a8436);if(_0x21a4f3['isFile']())return{'path':this[_0x4fbc42(0xde)](_0x3a8436),'exists':!![]};}catch{}}return{'path':this[_0x4fbc42(0xde)](_0x52a4ee),'exists':![]};}return{'path':importPath,'exists':!![],'isExternal':!![]};}[a0_0x159074(0xde)](_0x159d1a){const _0x4b6a21=a0_0x159074;return a0_0x217288['relative'](this[_0x4b6a21(0xce)],_0x159d1a)[_0x4b6a21(0xed)](/\\/g,'/');}['findCircularDependencies'](){const _0x12e277=a0_0x159074,_0x1eda3f=[],_0x224abe=new Set(),_0x463114=new Set(),_0x2c72ee=(_0x2b86aa,_0x7c5f00=[])=>{const _0x2800dd=a0_0x2e53;if(_0x463114['has'](_0x2b86aa)){const _0x15656e=_0x7c5f00[_0x2800dd(0x12f)](_0x2b86aa);_0x15656e!==-0x1&&_0x1eda3f[_0x2800dd(0x13d)]([..._0x7c5f00['slice'](_0x15656e),_0x2b86aa]);return;}if(_0x224abe['has'](_0x2b86aa))return;_0x224abe['add'](_0x2b86aa),_0x463114['add'](_0x2b86aa),_0x7c5f00['push'](_0x2b86aa);const _0x56faa1=this[_0x2800dd(0xbb)]['get'](_0x2b86aa)||new Set();for(const _0x2c8ea4 of _0x56faa1){_0x2c72ee(_0x2c8ea4,[..._0x7c5f00]);}_0x463114[_0x2800dd(0x142)](_0x2b86aa);};for(const _0x797198 of this['dependencies']['keys']()){!_0x224abe[_0x12e277(0xd1)](_0x797198)&&_0x2c72ee(_0x797198);}return _0x1eda3f;}['findUnusedExports'](){const _0x4e9a5b=a0_0x159074,_0x4d68fb=new Map();for(const _0x26a4f8 of this['imports']){!_0x26a4f8['isExternal']&&(!_0x4d68fb[_0x4e9a5b(0xd1)](_0x26a4f8['importedFromFile'])&&_0x4d68fb[_0x4e9a5b(0xf9)](_0x26a4f8['importedFromFile'],new Set()),_0x4d68fb[_0x4e9a5b(0x12d)](_0x26a4f8[_0x4e9a5b(0xfd)])['add'](_0x26a4f8['importedSymbol']));}const _0x503042={};for(const [_0x53bad4,exports]of this['exports']['entries']()){const _0x448c4e=_0x4d68fb['get'](_0x53bad4)||new Set(),_0x2ab410=Array['from'](exports)['filter'](_0x38a554=>!_0x448c4e[_0x4e9a5b(0xd1)](_0x38a554)&&_0x38a554!=='*');_0x2ab410['length']>0x0&&(_0x503042[_0x53bad4]=_0x2ab410);}return _0x503042;}async[a0_0x159074(0xfc)](_0x207b8e=a0_0x159074(0xcf)){const _0x56338f=a0_0x159074;this[_0x56338f(0x14b)]?.[_0x56338f(0xe9)]('Starting import analysis',{'mode':_0x207b8e,'rootDir':this[_0x56338f(0xce)]}),await this[_0x56338f(0x117)]();const _0x106016=await this[_0x56338f(0x121)](this['rootDir']);this['logger']?.['info'](_0x56338f(0x14e),{'count':_0x106016['length']});for(const _0x5048ff of _0x106016){try{const _0x14f190=await a0_0x501a48[_0x56338f(0xe7)](_0x5048ff,_0x56338f(0xbf)),_0x57b3b4=this['getRelativePath'](_0x5048ff),_0x4faee2=await this[_0x56338f(0xda)](_0x14f190,_0x5048ff);this[_0x56338f(0xcd)]['push'](..._0x4faee2);const _0xe2b5b4=this['parseExports'](_0x14f190);this[_0x56338f(0x127)][_0x56338f(0xf9)](_0x57b3b4,_0xe2b5b4);}catch(_0x2740a3){this[_0x56338f(0x14b)]?.['warn'](_0x56338f(0xe4),{'file':_0x5048ff,'error':_0x2740a3[_0x56338f(0xba)]});}}this['logger']?.['info'](_0x56338f(0xe3),{'imports':this[_0x56338f(0xcd)]['length'],'exports':this['exports']['size']});const _0x276952={'summary':{'totalFiles':_0x106016[_0x56338f(0xc0)],'totalImports':this[_0x56338f(0xcd)]['length'],'totalExports':Array['from'](this['exports']['values']())['reduce']((_0xa1edd3,exports)=>_0xa1edd3+exports['size'],0x0)},'missingExports':{},'missingFiles':{},'fileNotFoundImports':[]};for(const importEntry of this['imports']){const {importingFile:importingFile,importedSymbol:importedSymbol,importedFromFile:importedFromFile,isDefault:_0x5e763d,isNamespace:_0x359351,fileExists:_0x3c6e61,isExternal:_0x3ca662}=importEntry;if(!_0x3c6e61&&!_0x3ca662){_0x276952[_0x56338f(0xca)][_0x56338f(0x13d)]({'importingFile':importingFile,'importedSymbol':importedSymbol,'importedFromFile':importedFromFile,'isDefault':_0x5e763d||![],'isNamespace':_0x359351||![]});!_0x276952[_0x56338f(0x109)][importingFile]&&(_0x276952[_0x56338f(0x109)][importingFile]=[]);_0x276952['missingFiles'][importingFile][_0x56338f(0x13d)]({'missingFile':importedFromFile,'importedSymbol':importedSymbol,'isDefault':_0x5e763d||![],'isNamespace':_0x359351||![]});continue;}if(_0x3ca662)continue;const exportingFileExports=this['exports']['get'](importedFromFile);let _0x269250=![];if(exportingFileExports){if(_0x359351)_0x269250=exportingFileExports[_0x56338f(0xd6)]>0x0;else _0x5e763d?_0x269250=exportingFileExports['has']('default'):_0x269250=exportingFileExports['has'](importedSymbol)||exportingFileExports[_0x56338f(0xd1)]('*');}!_0x269250&&(!_0x276952['missingExports'][importingFile]&&(_0x276952['missingExports'][importingFile]=[]),_0x276952[_0x56338f(0x150)][importingFile][_0x56338f(0x13d)]({'importedSymbol':importedSymbol,'importedFromFile':importedFromFile,'availableExports':exportingFileExports?Array[_0x56338f(0xf3)](exportingFileExports):[],'isDefault':_0x5e763d||![],'isNamespace':_0x359351||![]}));}return(_0x207b8e==='full'||_0x207b8e==='fix')&&(this['logger']?.[_0x56338f(0xe9)](_0x56338f(0x153)),_0x276952['circularDependencies']=this[_0x56338f(0xc5)](),_0x276952[_0x56338f(0xc9)]=this['findUnusedExports']()),this[_0x56338f(0x14b)]?.[_0x56338f(0xe9)]('Analysis\x20complete',{'missingFiles':_0x276952['fileNotFoundImports'][_0x56338f(0xc0)],'missingExports':Object[_0x56338f(0x139)](_0x276952['missingExports'])[_0x56338f(0xc0)]}),_0x276952;}}export default ImportAnalyzerTool;