@quantbrasil/cli 0.1.0-beta.12 → 0.1.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/cli/client.js +15 -0
- package/dist/cli/index.d.ts +4 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +16 -0
- package/dist/commands/backtests.d.ts +132 -0
- package/dist/commands/backtests.d.ts.map +1 -0
- package/dist/commands/backtests.js +445 -0
- package/dist/commands/news.d.ts +48 -0
- package/dist/commands/news.d.ts.map +1 -0
- package/dist/commands/news.js +85 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/vendor/core/capabilities/backtests.d.ts +173 -0
- package/dist/vendor/core/capabilities/backtests.d.ts.map +1 -0
- package/dist/vendor/core/capabilities/backtests.js +203 -0
- package/dist/vendor/core/capabilities/index.d.ts +2 -0
- package/dist/vendor/core/capabilities/index.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/index.js +2 -0
- package/dist/vendor/core/capabilities/news.d.ts +54 -0
- package/dist/vendor/core/capabilities/news.d.ts.map +1 -0
- package/dist/vendor/core/capabilities/news.js +65 -0
- package/dist/vendor/core/capabilities/registry.d.ts +444 -0
- package/dist/vendor/core/capabilities/registry.d.ts.map +1 -1
- package/dist/vendor/core/capabilities/registry.js +4 -0
- package/dist/vendor/core/capabilities/types.d.ts +1 -1
- package/dist/vendor/core/capabilities/types.d.ts.map +1 -1
- package/package.json +3 -3
- package/skills/quantbrasil/SKILL.md +8 -4
- package/skills/quantbrasil/references/backtests.md +170 -0
- package/skills/quantbrasil/references/cli.md +42 -0
- package/skills/quantbrasil/references/costs.md +6 -1
- package/skills/quantbrasil/references/quality-eval-queries.json +30 -0
- package/skills/quantbrasil/references/unsupported.md +5 -0
- package/skills/quantbrasil/references/workflows.md +43 -0
package/README.md
CHANGED
|
@@ -84,6 +84,11 @@ quantbrasil screening indicators
|
|
|
84
84
|
quantbrasil screening run --system acoes-mais-liquidas --query-file ./screening.json
|
|
85
85
|
quantbrasil screening run --watchlist 93 --query-file ./screening.json --limit 25
|
|
86
86
|
cat ./screening.json | quantbrasil screening run --holding 182 --query-file -
|
|
87
|
+
quantbrasil backtests strategies
|
|
88
|
+
quantbrasil backtests info ifr2
|
|
89
|
+
quantbrasil backtests run ifr2 PETR4 --timeframe D1 --from 2025-01-01 --to 2026-01-01
|
|
90
|
+
quantbrasil backtests run ifr2 PRIO3 --timeframe D1 --param rsi=15
|
|
91
|
+
quantbrasil backtests run ifr2 PETR4 --timeframe D1 --param rsi=30 --param window=2 --json
|
|
87
92
|
```
|
|
88
93
|
|
|
89
94
|
Example `screening.json`:
|
package/dist/cli/client.js
CHANGED
|
@@ -92,14 +92,29 @@ function resolveErrorDetail(payload) {
|
|
|
92
92
|
return validationDetails.join("; ");
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
+
const nestedDetailMessage = resolveObjectMessage(detail);
|
|
96
|
+
if (nestedDetailMessage) {
|
|
97
|
+
return nestedDetailMessage;
|
|
98
|
+
}
|
|
95
99
|
if (typeof message === "string" && message.trim()) {
|
|
96
100
|
return message;
|
|
97
101
|
}
|
|
98
102
|
if (typeof error === "string" && error.trim()) {
|
|
99
103
|
return error;
|
|
100
104
|
}
|
|
105
|
+
const nestedErrorMessage = resolveObjectMessage(error);
|
|
106
|
+
if (nestedErrorMessage) {
|
|
107
|
+
return nestedErrorMessage;
|
|
108
|
+
}
|
|
101
109
|
return null;
|
|
102
110
|
}
|
|
111
|
+
function resolveObjectMessage(value) {
|
|
112
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const message = value.message;
|
|
116
|
+
return typeof message === "string" && message.trim() ? message : null;
|
|
117
|
+
}
|
|
103
118
|
function formatValidationDetail(value) {
|
|
104
119
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
105
120
|
return null;
|
package/dist/cli/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Command } from "commander";
|
|
2
|
+
import { runBacktestsInfoCommand, runBacktestsRunCommand, runBacktestsStrategiesCommand } from "../commands/backtests.js";
|
|
2
3
|
import { type CapabilitiesCommandIO, runCapabilitiesCommand } from "../commands/capabilities.js";
|
|
3
4
|
import { runCointegrationPairCommand } from "../commands/cointegration.js";
|
|
4
5
|
import { runMarketAssetsCommand, runMarketPriceCommand } from "../commands/market.js";
|
|
6
|
+
import { runAssetNewsCommand } from "../commands/news.js";
|
|
5
7
|
import { runInitCommand } from "../commands/init.js";
|
|
6
8
|
import { runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand } from "../commands/portfolios.js";
|
|
7
9
|
import { runRankingsCurrentCommand, runRankingsListCommand, runRankingsReturnCommand } from "../commands/rankings.js";
|
|
@@ -28,9 +30,11 @@ export declare function createCliProgram(options?: CliProgramOptions): Command;
|
|
|
28
30
|
export declare function run(argv?: string[], options?: CliRunOptions): Promise<void>;
|
|
29
31
|
export { runAuthLoginCommand, runAuthLogoutCommand, runAuthWhoamiCommand, } from "../commands/auth.js";
|
|
30
32
|
export { runAssetOverviewCommand } from "../commands/assets.js";
|
|
33
|
+
export { runBacktestsInfoCommand, runBacktestsRunCommand, runBacktestsStrategiesCommand, };
|
|
31
34
|
export { runCapabilitiesCommand, runStatusCommand };
|
|
32
35
|
export { runInitCommand };
|
|
33
36
|
export { runMarketAssetsCommand, runMarketPriceCommand };
|
|
37
|
+
export { runAssetNewsCommand };
|
|
34
38
|
export { runRankingsCurrentCommand, runRankingsListCommand, runRankingsReturnCommand, };
|
|
35
39
|
export { runCointegrationPairCommand };
|
|
36
40
|
export { runScreeningIndicatorsCommand, runScreeningRunCommand, runScreeningUniversesCommand, };
|
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,OAAO,EACL,KAAK,qBAAqB,EAE1B,sBAAsB,EACvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,2BAA2B,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,cAAc,EACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAGL,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAGL,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAGL,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEL,gBAAgB,EAEhB,KAAK,mBAAmB,EACzB,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAQvE,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,E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AAqB,CAAC;AAC7B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,GAC9B,CAAC;AACF,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,wBAAwB,GACzB,CAAC;AACF,OAAO,EAAE,2BAA2B,EAAE,CAAC;AACvC,OAAO,EACL,6BAA6B,EAC7B,sBAAsB,EACtB,4BAA4B,GAC7B,CAAC;AACF,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,iCAAiC,EACjC,qBAAqB,EACrB,uBAAuB,EACvB,6BAA6B,EAC7B,2BAA2B,EAC3B,oBAAoB,EACpB,4BAA4B,EAC5B,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,+BAA+B,EAC/B,yBAAyB,GAC1B,CAAC;AACF,OAAO,EAAE,uBAAuB,EAAE,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -2,9 +2,11 @@ import { createRequire } from "node:module";
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import { registerAssetsCommands, } from "../commands/assets.js";
|
|
4
4
|
import { registerAuthCommands, runAuthWhoamiCommand, } from "../commands/auth.js";
|
|
5
|
+
import { registerBacktestsCommands, runBacktestsInfoCommand, runBacktestsRunCommand, runBacktestsStrategiesCommand, } from "../commands/backtests.js";
|
|
5
6
|
import { registerCapabilitiesCommand, runCapabilitiesCommand, } from "../commands/capabilities.js";
|
|
6
7
|
import { registerCointegrationCommands, runCointegrationPairCommand, } from "../commands/cointegration.js";
|
|
7
8
|
import { registerMarketCommands, runMarketAssetsCommand, runMarketPriceCommand, } from "../commands/market.js";
|
|
9
|
+
import { registerNewsCommands, runAssetNewsCommand, } from "../commands/news.js";
|
|
8
10
|
import { registerInitCommand, runInitCommand, } from "../commands/init.js";
|
|
9
11
|
import { registerPortfoliosCommands, runHoldingCreateCommand, runHoldingBetaCommand, runHoldingGetCommand, runHoldingHistoricalReturnCommand, runHoldingListCommand, runHoldingRenameCommand, runHoldingSetPositionsCommand, runHoldingSetTargetsCommand, runHoldingVarCommand, runWatchlistAddAssetsCommand, runWatchlistCreateCommand, runWatchlistGetCommand, runWatchlistListCommand, runWatchlistRemoveAssetsCommand, runWatchlistRenameCommand, } from "../commands/portfolios.js";
|
|
10
12
|
import { registerRankingsCommands, runRankingsCurrentCommand, runRankingsListCommand, runRankingsReturnCommand, } from "../commands/rankings.js";
|
|
@@ -29,11 +31,21 @@ export function createCliProgram(options = {}) {
|
|
|
29
31
|
env: options.env,
|
|
30
32
|
fetch: options.fetch,
|
|
31
33
|
};
|
|
34
|
+
const backtestsContext = {
|
|
35
|
+
io: options.io,
|
|
36
|
+
env: options.env,
|
|
37
|
+
fetch: options.fetch,
|
|
38
|
+
};
|
|
32
39
|
const marketContext = {
|
|
33
40
|
io: options.io,
|
|
34
41
|
env: options.env,
|
|
35
42
|
fetch: options.fetch,
|
|
36
43
|
};
|
|
44
|
+
const newsContext = {
|
|
45
|
+
io: options.io,
|
|
46
|
+
env: options.env,
|
|
47
|
+
fetch: options.fetch,
|
|
48
|
+
};
|
|
37
49
|
const initContext = {
|
|
38
50
|
io: options.io,
|
|
39
51
|
env: options.env,
|
|
@@ -89,8 +101,10 @@ export function createCliProgram(options = {}) {
|
|
|
89
101
|
registerAuthCommands(program, authContext);
|
|
90
102
|
registerWhoamiCommand(program, authContext);
|
|
91
103
|
registerAssetsCommands(program, assetsContext);
|
|
104
|
+
registerBacktestsCommands(program, backtestsContext);
|
|
92
105
|
registerInitCommand(program, initContext);
|
|
93
106
|
registerMarketCommands(program, marketContext);
|
|
107
|
+
registerNewsCommands(program, newsContext);
|
|
94
108
|
registerPortfoliosCommands(program, portfoliosContext);
|
|
95
109
|
registerRankingsCommands(program, rankingsContext);
|
|
96
110
|
registerCointegrationCommands(program, cointegrationContext);
|
|
@@ -159,9 +173,11 @@ function isCommanderDisplayExit(error) {
|
|
|
159
173
|
}
|
|
160
174
|
export { runAuthLoginCommand, runAuthLogoutCommand, runAuthWhoamiCommand, } from "../commands/auth.js";
|
|
161
175
|
export { runAssetOverviewCommand } from "../commands/assets.js";
|
|
176
|
+
export { runBacktestsInfoCommand, runBacktestsRunCommand, runBacktestsStrategiesCommand, };
|
|
162
177
|
export { runCapabilitiesCommand, runStatusCommand };
|
|
163
178
|
export { runInitCommand };
|
|
164
179
|
export { runMarketAssetsCommand, runMarketPriceCommand };
|
|
180
|
+
export { runAssetNewsCommand };
|
|
165
181
|
export { runRankingsCurrentCommand, runRankingsListCommand, runRankingsReturnCommand, };
|
|
166
182
|
export { runCointegrationPairCommand };
|
|
167
183
|
export { runScreeningIndicatorsCommand, runScreeningRunCommand, runScreeningUniversesCommand, };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import type { JsonValue } from "../vendor/core/index.js";
|
|
3
|
+
import { type CliInvokeContext } from "../cli/client.js";
|
|
4
|
+
import { type TerminalWriter } from "../cli/terminal.js";
|
|
5
|
+
export interface BacktestsCommandIO {
|
|
6
|
+
stdout: TerminalWriter;
|
|
7
|
+
}
|
|
8
|
+
export interface BacktestsStrategiesCommandOptions {
|
|
9
|
+
json?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface BacktestsInfoCommandOptions {
|
|
12
|
+
json?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface BacktestsRunCommandOptions {
|
|
15
|
+
timeframe?: string;
|
|
16
|
+
from?: string;
|
|
17
|
+
to?: string;
|
|
18
|
+
param?: string[];
|
|
19
|
+
paramsJson?: string;
|
|
20
|
+
capital?: string;
|
|
21
|
+
maxRisk?: string;
|
|
22
|
+
contracts?: string;
|
|
23
|
+
json?: boolean;
|
|
24
|
+
}
|
|
25
|
+
export type BacktestParameterValue = string | number | boolean;
|
|
26
|
+
export interface BacktestParameterOptionOut {
|
|
27
|
+
[key: string]: JsonValue;
|
|
28
|
+
value: string;
|
|
29
|
+
label: string;
|
|
30
|
+
}
|
|
31
|
+
export interface BacktestParameterOut {
|
|
32
|
+
[key: string]: JsonValue;
|
|
33
|
+
name: string;
|
|
34
|
+
label: string;
|
|
35
|
+
type: "boolean" | "enum" | "integer" | "number" | "string";
|
|
36
|
+
required: boolean;
|
|
37
|
+
default: BacktestParameterValue | null;
|
|
38
|
+
description: string;
|
|
39
|
+
format: "time" | null;
|
|
40
|
+
value_hint: string | null;
|
|
41
|
+
agent_guidance: string | null;
|
|
42
|
+
options: BacktestParameterOptionOut[] | null;
|
|
43
|
+
}
|
|
44
|
+
export interface BacktestStrategyOut {
|
|
45
|
+
[key: string]: JsonValue;
|
|
46
|
+
id: string;
|
|
47
|
+
label: string;
|
|
48
|
+
family: string;
|
|
49
|
+
description: string;
|
|
50
|
+
selection_guidance: string;
|
|
51
|
+
timeframe_guidance: string;
|
|
52
|
+
side: "long" | "short";
|
|
53
|
+
allowed_timeframes: string[];
|
|
54
|
+
requires_timeframe: boolean;
|
|
55
|
+
fixed_risk: boolean;
|
|
56
|
+
day_trade_only: boolean;
|
|
57
|
+
blocked_in_crypto: boolean;
|
|
58
|
+
default_parameters: Record<string, BacktestParameterValue>;
|
|
59
|
+
parameters: BacktestParameterOut[];
|
|
60
|
+
}
|
|
61
|
+
export interface BacktestStrategiesResponse {
|
|
62
|
+
[key: string]: JsonValue;
|
|
63
|
+
ok: boolean;
|
|
64
|
+
strategies: BacktestStrategyOut[];
|
|
65
|
+
total: number;
|
|
66
|
+
}
|
|
67
|
+
export interface BacktestStrategyResponse {
|
|
68
|
+
[key: string]: JsonValue;
|
|
69
|
+
ok: boolean;
|
|
70
|
+
strategy: BacktestStrategyOut;
|
|
71
|
+
}
|
|
72
|
+
export interface ScorePercentiles {
|
|
73
|
+
[key: string]: JsonValue;
|
|
74
|
+
percentile_5: number | null;
|
|
75
|
+
percentile_25: number | null;
|
|
76
|
+
percentile_50: number | null;
|
|
77
|
+
percentile_75: number | null;
|
|
78
|
+
percentile_95: number | null;
|
|
79
|
+
}
|
|
80
|
+
export interface SaveBacktestResponse {
|
|
81
|
+
[key: string]: JsonValue;
|
|
82
|
+
id: number | null;
|
|
83
|
+
setup_id: number;
|
|
84
|
+
timeframe_id: string;
|
|
85
|
+
strategy_id: string;
|
|
86
|
+
ticker: string;
|
|
87
|
+
asset_type: string;
|
|
88
|
+
can_monitor: boolean;
|
|
89
|
+
start_date: string;
|
|
90
|
+
end_date: string;
|
|
91
|
+
initial_capital: number;
|
|
92
|
+
parameters: Record<string, JsonValue>;
|
|
93
|
+
score: number | null;
|
|
94
|
+
score_percentiles: ScorePercentiles | null;
|
|
95
|
+
suspicious: boolean;
|
|
96
|
+
num_operations: number;
|
|
97
|
+
num_gains: number | null;
|
|
98
|
+
pct_gains: number;
|
|
99
|
+
avg_gains: number | null;
|
|
100
|
+
avg_losses: number | null;
|
|
101
|
+
avg_candles: number | null;
|
|
102
|
+
profit_factor: number | null;
|
|
103
|
+
pct_profit: number;
|
|
104
|
+
drawdown: number;
|
|
105
|
+
ev: number;
|
|
106
|
+
trade_history: JsonValue[];
|
|
107
|
+
best_win_streak: number | null;
|
|
108
|
+
worst_loss_streak: number | null;
|
|
109
|
+
}
|
|
110
|
+
export interface BacktestRunResponse {
|
|
111
|
+
[key: string]: JsonValue;
|
|
112
|
+
ok: boolean;
|
|
113
|
+
summary_markdown: string;
|
|
114
|
+
backtest: SaveBacktestResponse;
|
|
115
|
+
}
|
|
116
|
+
export interface BacktestsCommandContext extends CliInvokeContext {
|
|
117
|
+
io?: BacktestsCommandIO;
|
|
118
|
+
}
|
|
119
|
+
type JsonRecord = {
|
|
120
|
+
[key: string]: JsonValue;
|
|
121
|
+
};
|
|
122
|
+
export declare function registerBacktestsCommands(program: Command, context?: BacktestsCommandContext): void;
|
|
123
|
+
export declare function runBacktestsStrategiesCommand(options: BacktestsStrategiesCommandOptions, context?: BacktestsCommandContext): Promise<void>;
|
|
124
|
+
export declare function runBacktestsInfoCommand(strategyId: string, options: BacktestsInfoCommandOptions, context?: BacktestsCommandContext): Promise<void>;
|
|
125
|
+
export declare function runBacktestsRunCommand(strategyId: string, ticker: string, options: BacktestsRunCommandOptions, context?: BacktestsCommandContext): Promise<void>;
|
|
126
|
+
export declare function buildBacktestsInfoInput(strategyId: string): JsonRecord;
|
|
127
|
+
export declare function buildBacktestsRunInput(strategyId: string, ticker: string, options: BacktestsRunCommandOptions): JsonRecord;
|
|
128
|
+
export declare function formatBacktestStrategiesHuman(data: BacktestStrategiesResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
|
|
129
|
+
export declare function formatBacktestStrategyHuman(data: BacktestStrategyResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
|
|
130
|
+
export declare function formatBacktestRunHuman(data: BacktestRunResponse, theme?: import("../cli/terminal.js").TerminalTheme): string;
|
|
131
|
+
export {};
|
|
132
|
+
//# sourceMappingURL=backtests.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backtests.d.ts","sourceRoot":"","sources":["../../src/commands/backtests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAuB,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE9E,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAE9E,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,cAAc,CAAC;CACxB;AAED,MAAM,WAAW,iCAAiC;IAChD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,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