codebuff 1.0.251 → 1.0.252
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/background-process-manager.d.ts +50 -0
- package/dist/background-process-manager.js +359 -0
- package/dist/background-process-manager.js.map +1 -0
- package/dist/browser-runner.d.ts +35 -0
- package/dist/browser-runner.js +680 -0
- package/dist/browser-runner.js.map +1 -0
- package/dist/chat-storage.d.ts +2 -0
- package/dist/chat-storage.js +93 -0
- package/dist/chat-storage.js.map +1 -0
- package/dist/checkpoints/checkpoint-manager.d.ts +94 -0
- package/dist/checkpoints/checkpoint-manager.js +280 -0
- package/dist/checkpoints/checkpoint-manager.js.map +1 -0
- package/dist/checkpoints/file-manager.d.ts +72 -0
- package/dist/checkpoints/file-manager.js +311 -0
- package/dist/checkpoints/file-manager.js.map +1 -0
- package/dist/cli-handlers/api-key.d.ts +25 -0
- package/dist/cli-handlers/api-key.js +66 -0
- package/dist/cli-handlers/api-key.js.map +1 -0
- package/dist/cli-handlers/checkpoint.d.ts +18 -0
- package/dist/cli-handlers/checkpoint.js +195 -0
- package/dist/cli-handlers/checkpoint.js.map +1 -0
- package/dist/cli-handlers/diff.d.ts +2 -0
- package/dist/cli-handlers/diff.js +31 -0
- package/dist/cli-handlers/diff.js.map +1 -0
- package/dist/cli-handlers/easter-egg.d.ts +1 -0
- package/dist/cli-handlers/easter-egg.js +126 -0
- package/dist/cli-handlers/easter-egg.js.map +1 -0
- package/dist/cli-handlers/inititalization-flow.d.ts +1 -0
- package/dist/cli-handlers/inititalization-flow.js +24 -0
- package/dist/cli-handlers/inititalization-flow.js.map +1 -0
- package/dist/cli.d.ts +44 -0
- package/dist/cli.js +478 -0
- package/dist/cli.js.map +1 -0
- package/dist/client.d.ts +157 -0
- package/dist/client.js +836 -0
- package/dist/client.js.map +1 -0
- package/dist/code-map/tsconfig.tsbuildinfo +1 -1
- package/dist/config.d.ts +4 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/create-template-project.d.ts +1 -0
- package/dist/create-template-project.js +107 -0
- package/dist/create-template-project.js.map +1 -0
- package/dist/credentials.d.ts +4 -0
- package/dist/credentials.js +38 -0
- package/dist/credentials.js.map +1 -0
- package/dist/dev-process-manager.d.ts +10 -0
- package/dist/dev-process-manager.js +54 -0
- package/dist/dev-process-manager.js.map +1 -0
- package/dist/fingerprint.d.ts +1 -0
- package/dist/fingerprint.js +48 -0
- package/dist/fingerprint.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +117 -0
- package/dist/index.js.map +1 -0
- package/dist/menu.d.ts +3 -0
- package/dist/menu.js +126 -0
- package/dist/menu.js.map +1 -0
- package/dist/project-files.d.ts +114 -0
- package/dist/project-files.js +513 -0
- package/dist/project-files.js.map +1 -0
- package/dist/startup-process-handler.d.ts +2 -0
- package/dist/startup-process-handler.js +21 -0
- package/dist/startup-process-handler.js.map +1 -0
- package/dist/tool-handlers.d.ts +28 -0
- package/dist/tool-handlers.js +240 -0
- package/dist/tool-handlers.js.map +1 -0
- package/dist/types.d.ts +15 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/update-codebuff.d.ts +1 -0
- package/dist/update-codebuff.js +160 -0
- package/dist/update-codebuff.js.map +1 -0
- package/dist/utils/__tests__/background-process-manager.test.d.ts +1 -0
- package/dist/utils/__tests__/background-process-manager.test.js +289 -0
- package/dist/utils/__tests__/background-process-manager.test.js.map +1 -0
- package/dist/utils/__tests__/tool-renderers.test.d.ts +1 -0
- package/dist/utils/__tests__/tool-renderers.test.js +51 -0
- package/dist/utils/__tests__/tool-renderers.test.js.map +1 -0
- package/dist/utils/__tests__/xml-stream-parser.test.d.ts +1 -0
- package/dist/utils/__tests__/xml-stream-parser.test.js +229 -0
- package/dist/utils/__tests__/xml-stream-parser.test.js.map +1 -0
- package/dist/utils/analytics.d.ts +6 -0
- package/dist/utils/analytics.js +59 -0
- package/dist/utils/analytics.js.map +1 -0
- package/dist/utils/detect-shell.d.ts +1 -0
- package/dist/utils/detect-shell.js +60 -0
- package/dist/utils/detect-shell.js.map +1 -0
- package/dist/utils/logger.d.ts +21 -0
- package/dist/utils/logger.js +105 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/spinner.d.ts +11 -0
- package/dist/utils/spinner.js +87 -0
- package/dist/utils/spinner.js.map +1 -0
- package/dist/utils/system-info.d.ts +8 -0
- package/dist/utils/system-info.js +22 -0
- package/dist/utils/system-info.js.map +1 -0
- package/dist/utils/terminal.d.ts +41 -0
- package/dist/utils/terminal.js +474 -0
- package/dist/utils/terminal.js.map +1 -0
- package/dist/utils/tool-renderers.d.ts +16 -0
- package/dist/utils/tool-renderers.js +145 -0
- package/dist/utils/tool-renderers.js.map +1 -0
- package/dist/utils/xml-stream-parser.d.ts +9 -0
- package/dist/utils/xml-stream-parser.js +128 -0
- package/dist/utils/xml-stream-parser.js.map +1 -0
- package/dist/web-scraper.d.ts +3 -0
- package/dist/web-scraper.js +57 -0
- package/dist/web-scraper.js.map +1 -0
- package/dist/workers/checkpoint-worker.d.ts +1 -0
- package/dist/workers/checkpoint-worker.js +48 -0
- package/dist/workers/checkpoint-worker.js.map +1 -0
- package/dist/workers/project-context.d.ts +1 -0
- package/dist/workers/project-context.js +17 -0
- package/dist/workers/project-context.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Saxy } from '../common/util/saxy';
|
|
2
|
+
import { ToolCallRenderer } from './tool-renderers';
|
|
3
|
+
/**
|
|
4
|
+
* Creates a transform stream that processes XML tool calls
|
|
5
|
+
* @param renderer Custom renderer for tool calls or a map of renderers per tool
|
|
6
|
+
* @param callback Optional callback function to receive processed chunks
|
|
7
|
+
* @returns Transform stream
|
|
8
|
+
*/
|
|
9
|
+
export declare function createXMLStreamParser(renderer: Record<string, ToolCallRenderer>, callback?: (chunk: string) => void): Saxy;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createXMLStreamParser = createXMLStreamParser;
|
|
4
|
+
const tools_1 = require("../common/constants/tools");
|
|
5
|
+
const saxy_1 = require("../common/util/saxy");
|
|
6
|
+
const tool_renderers_1 = require("./tool-renderers");
|
|
7
|
+
/**
|
|
8
|
+
* Creates a transform stream that processes XML tool calls
|
|
9
|
+
* @param renderer Custom renderer for tool calls or a map of renderers per tool
|
|
10
|
+
* @param callback Optional callback function to receive processed chunks
|
|
11
|
+
* @returns Transform stream
|
|
12
|
+
*/
|
|
13
|
+
function createXMLStreamParser(renderer, callback) {
|
|
14
|
+
// Create parser with tool schema validation
|
|
15
|
+
const parser = new saxy_1.Saxy(tools_1.toolSchema);
|
|
16
|
+
// Current state
|
|
17
|
+
let currentTool = null;
|
|
18
|
+
let currentParam = null;
|
|
19
|
+
let params = {};
|
|
20
|
+
let paramContent = '';
|
|
21
|
+
// Helper to get the appropriate renderer for the current tool
|
|
22
|
+
const getRenderer = (toolName) => {
|
|
23
|
+
if (!renderer)
|
|
24
|
+
return tool_renderers_1.defaultToolCallRenderer;
|
|
25
|
+
// If renderer is a map of tool-specific renderers
|
|
26
|
+
if (typeof renderer === 'object' && !('onToolStart' in renderer)) {
|
|
27
|
+
return (renderer[toolName] ||
|
|
28
|
+
tool_renderers_1.defaultToolCallRenderer);
|
|
29
|
+
}
|
|
30
|
+
// If renderer is a single renderer
|
|
31
|
+
return renderer;
|
|
32
|
+
};
|
|
33
|
+
// Set up event handlers
|
|
34
|
+
parser.on('tagopen', (tag) => {
|
|
35
|
+
const { name } = tag;
|
|
36
|
+
// Check if this is a tool tag
|
|
37
|
+
if (tools_1.TOOL_LIST.includes(name)) {
|
|
38
|
+
currentTool = name;
|
|
39
|
+
params = {};
|
|
40
|
+
// Call renderer if available
|
|
41
|
+
const toolRenderer = getRenderer(name);
|
|
42
|
+
if (toolRenderer.onToolStart) {
|
|
43
|
+
const output = toolRenderer.onToolStart(name, saxy_1.Saxy.parseAttrs(tag.attrs));
|
|
44
|
+
if (output !== null) {
|
|
45
|
+
parser.push(output);
|
|
46
|
+
if (callback)
|
|
47
|
+
callback(output);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// Check if this is a parameter tag inside a tool
|
|
52
|
+
else if (currentTool && !currentParam) {
|
|
53
|
+
currentParam = name;
|
|
54
|
+
paramContent = '';
|
|
55
|
+
// Call renderer if available
|
|
56
|
+
const toolRenderer = getRenderer(currentTool);
|
|
57
|
+
if (toolRenderer.onParamStart) {
|
|
58
|
+
const output = toolRenderer.onParamStart(name, currentTool);
|
|
59
|
+
if (output !== null) {
|
|
60
|
+
parser.push(output);
|
|
61
|
+
if (callback)
|
|
62
|
+
callback(output);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
parser.on('text', (data) => {
|
|
68
|
+
if (currentTool && currentParam) {
|
|
69
|
+
paramContent += data.contents;
|
|
70
|
+
// Call renderer if available
|
|
71
|
+
const toolRenderer = getRenderer(currentTool);
|
|
72
|
+
if (toolRenderer.onParamChunk) {
|
|
73
|
+
const output = toolRenderer.onParamChunk(data.contents, currentParam, currentTool);
|
|
74
|
+
if (output !== null) {
|
|
75
|
+
parser.push(output);
|
|
76
|
+
if (callback)
|
|
77
|
+
callback(output);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// Text outside of tool tags
|
|
83
|
+
parser.push(data.contents);
|
|
84
|
+
if (callback)
|
|
85
|
+
callback(data.contents);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
parser.on('tagclose', (tag) => {
|
|
89
|
+
const { name } = tag;
|
|
90
|
+
// Check if this is a parameter tag closing
|
|
91
|
+
if (currentTool && currentParam && name === currentParam) {
|
|
92
|
+
// Store parameter content
|
|
93
|
+
params[currentParam] = paramContent;
|
|
94
|
+
// Call renderer if available
|
|
95
|
+
const toolRenderer = getRenderer(currentTool);
|
|
96
|
+
if (toolRenderer.onParamEnd) {
|
|
97
|
+
const output = toolRenderer.onParamEnd(currentParam, currentTool, paramContent);
|
|
98
|
+
if (output !== null) {
|
|
99
|
+
parser.push(output);
|
|
100
|
+
if (callback)
|
|
101
|
+
callback(output);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
currentParam = null;
|
|
105
|
+
paramContent = '';
|
|
106
|
+
}
|
|
107
|
+
// Check if this is a tool tag closing
|
|
108
|
+
else if (currentTool && name === currentTool) {
|
|
109
|
+
// Call renderer if available
|
|
110
|
+
const toolRenderer = getRenderer(currentTool);
|
|
111
|
+
if (toolRenderer.onToolEnd) {
|
|
112
|
+
const output = toolRenderer.onToolEnd(currentTool, params);
|
|
113
|
+
if (output !== null) {
|
|
114
|
+
parser.push(output);
|
|
115
|
+
if (callback)
|
|
116
|
+
callback(output);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
currentTool = null;
|
|
120
|
+
params = {};
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
parser.on('end', () => {
|
|
124
|
+
parser.end();
|
|
125
|
+
});
|
|
126
|
+
return parser;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=xml-stream-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xml-stream-parser.js","sourceRoot":"","sources":["../../src/utils/xml-stream-parser.ts"],"names":[],"mappings":";;AAUA,sDA2IC;AArJD,kDAAwE;AACxE,2CAAuC;AACvC,qDAA4E;AAE5E;;;;;GAKG;AACH,SAAgB,qBAAqB,CACnC,QAA0C,EAC1C,QAAkC;IAElC,4CAA4C;IAC5C,MAAM,MAAM,GAAG,IAAI,WAAI,CAAC,kBAAU,CAAC,CAAA;IAEnC,gBAAgB;IAChB,IAAI,WAAW,GAAkB,IAAI,CAAA;IACrC,IAAI,YAAY,GAAkB,IAAI,CAAA;IACtC,IAAI,MAAM,GAA2B,EAAE,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AAG,EAAE,CAAA;IACd,CAAC,CAAC,CAAA;IAEF,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.scrapeWebPage = scrapeWebPage;
|
|
4
|
+
exports.parseUrlsFromContent = parseUrlsFromContent;
|
|
5
|
+
exports.getScrapedContentBlocks = getScrapedContentBlocks;
|
|
6
|
+
const string_1 = require("./common/util/string");
|
|
7
|
+
// Global cache for scraped web pages
|
|
8
|
+
const scrapedPagesCache = {};
|
|
9
|
+
async function scrapeWebPage(url) {
|
|
10
|
+
// Check if the page is already in the cache
|
|
11
|
+
if (scrapedPagesCache[url] !== undefined) {
|
|
12
|
+
return scrapedPagesCache[url];
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
let content = '';
|
|
16
|
+
const fullUrl = (0, string_1.ensureUrlProtocol)(url);
|
|
17
|
+
if (fullUrl.startsWith('https://raw.githubusercontent.com/')) {
|
|
18
|
+
const response = await fetch(url);
|
|
19
|
+
content = await response.text();
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
const response = await fetch(`https://r.jina.ai/${url}`);
|
|
23
|
+
content = await response.text();
|
|
24
|
+
}
|
|
25
|
+
// Store the scraped content in the cache
|
|
26
|
+
scrapedPagesCache[url] = content;
|
|
27
|
+
return content;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
// console.error(
|
|
31
|
+
// `Error scraping web page ${url}:`,
|
|
32
|
+
// error instanceof Error ? error.message : error
|
|
33
|
+
// )
|
|
34
|
+
scrapedPagesCache[url] = '';
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function parseUrlsFromContent(content) {
|
|
39
|
+
const urlRegex = /https?:\/\/[^\s]+/g;
|
|
40
|
+
return content.match(urlRegex) || [];
|
|
41
|
+
}
|
|
42
|
+
const MAX_SCRAPED_CONTENT_LENGTH = 75_000;
|
|
43
|
+
async function getScrapedContentBlocks(urls) {
|
|
44
|
+
const blocks = [];
|
|
45
|
+
for (const url of urls) {
|
|
46
|
+
const scrapedContent = await scrapeWebPage(url);
|
|
47
|
+
const truncatedScrapedContent = scrapedContent.length > MAX_SCRAPED_CONTENT_LENGTH
|
|
48
|
+
? scrapedContent.slice(0, MAX_SCRAPED_CONTENT_LENGTH) +
|
|
49
|
+
'[...TRUNCATED: WEB PAGE CONTENT TOO LONG...]'
|
|
50
|
+
: scrapedContent;
|
|
51
|
+
if (truncatedScrapedContent) {
|
|
52
|
+
blocks.push(`<web_scraped_content url="${url}">\n${truncatedScrapedContent}\n</web_scraped_content>`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return blocks;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=web-scraper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"web-scraper.js","sourceRoot":"","sources":["../src/web-scraper.ts"],"names":[],"mappings":";;AAKA,sCA4BC;AAED,oDAGC;AAGD,0DAgBC;AAzDD,+CAAsD;AAEtD,qCAAqC;AACrC,MAAM,iBAAiB,GAA2B,EAAE,CAAA;AAE7C,KAAK,UAAU,aAAa,CAAC,GAAW;IAC7C,4CAA4C;IAC5C,IAAI,iBAAiB,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QACzC,OAAO,iBAAiB,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;IAED,IAAI,CAAC;QACH,IAAI,OAAO,GAAG,EAAE,CAAA;QAChB,MAAM,OAAO,GAAG,IAAA,0BAAiB,EAAC,GAAG,CAAC,CAAA;QACtC,IAAI,OAAO,CAAC,UAAU,CAAC,oCAAoC,CAAC,EAAE,CAAC;YAC7D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAA;YACjC,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;QACjC,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|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const worker_threads_1 = require("worker_threads");
|
|
4
|
+
const file_manager_1 = require("../checkpoints/file-manager");
|
|
5
|
+
if (worker_threads_1.parentPort) {
|
|
6
|
+
const parentPort = worker_threads_1.parentPort;
|
|
7
|
+
/**
|
|
8
|
+
* Handle incoming messages from the main thread.
|
|
9
|
+
* Executes git operations for storing or restoring checkpoints.
|
|
10
|
+
*/
|
|
11
|
+
parentPort.on('message', async (message) => {
|
|
12
|
+
const { id, type, projectDir, bareRepoPath, commit, message: commitMessage, relativeFilepaths, } = message;
|
|
13
|
+
try {
|
|
14
|
+
let result;
|
|
15
|
+
if (type === 'store') {
|
|
16
|
+
// Store the current state as a git commit
|
|
17
|
+
result = await (0, file_manager_1.storeFileState)({
|
|
18
|
+
projectDir,
|
|
19
|
+
bareRepoPath,
|
|
20
|
+
message: commitMessage,
|
|
21
|
+
relativeFilepaths,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
else if (type === 'restore') {
|
|
25
|
+
// Restore files to a previous git commit state
|
|
26
|
+
await (0, file_manager_1.restoreFileState)({
|
|
27
|
+
projectDir,
|
|
28
|
+
bareRepoPath,
|
|
29
|
+
commit: commit,
|
|
30
|
+
relativeFilepaths,
|
|
31
|
+
});
|
|
32
|
+
result = true;
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
throw new Error(`Unknown operation type: ${type}`);
|
|
36
|
+
}
|
|
37
|
+
parentPort.postMessage({ id, success: true, result });
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
parentPort.postMessage({
|
|
41
|
+
id,
|
|
42
|
+
success: false,
|
|
43
|
+
error: error instanceof Error ? error.message : String(error),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=checkpoint-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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AAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAA;QACJ,CAAC;IACH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const worker_threads_1 = require("worker_threads");
|
|
4
|
+
const project_files_1 = require("../project-files");
|
|
5
|
+
const file_manager_1 = require("../checkpoints/file-manager");
|
|
6
|
+
const project_file_tree_1 = require("../common/project-file-tree");
|
|
7
|
+
if (worker_threads_1.parentPort) {
|
|
8
|
+
const parentPort = worker_threads_1.parentPort;
|
|
9
|
+
parentPort.on('message', async ({ dir }) => {
|
|
10
|
+
(0, project_files_1.setProjectRoot)(dir);
|
|
11
|
+
const initFileContext = await (0, project_files_1.getProjectFileContext)(dir, {});
|
|
12
|
+
const relativeFilepaths = (0, project_file_tree_1.getAllFilePaths)(initFileContext.fileTree);
|
|
13
|
+
await (0, file_manager_1.initializeCheckpointFileManager)({ projectDir: dir, relativeFilepaths });
|
|
14
|
+
parentPort.postMessage(initFileContext);
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=project-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-context.js","sourceRoot":"","sources":["../../src/workers/project-context.ts"],"names":[],"mappings":";;AAAA,mDAA8D;AAC9D,oDAAwE;AACxE,8DAA6E;AAC7E,gEAA0D;AAE1D,IAAI,2BAAe,EAAE,CAAC;IACpB,MAAM,UAAU,GAAG,2BAAe,CAAA;IAElC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE;QACzC,IAAA,8BAAc,EAAC,GAAG,CAAC,CAAA;QACnB,MAAM,eAAe,GAAG,MAAM,IAAA,qCAAqB,EAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAE5D,MAAM,iBAAiB,GAAG,IAAA,mCAAe,EAAC,eAAe,CAAC,QAAQ,CAAC,CAAA;QACnE,MAAM,IAAA,8CAA+B,EAAC,EAAE,UAAU,EAAE,GAAG,EAAE,iBAAiB,EAAE,CAAC,CAAA;QAE7E,UAAU,CAAC,WAAW,CAAC,eAAe,CAAC,CAAA;IACzC,CAAC,CAAC,CAAA;AACJ,CAAC"}
|