autor3search-typescript 0.1.1 → 0.1.2
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 +54 -13
- package/dist/cli/cmd-version.d.ts +13 -0
- package/dist/cli/cmd-version.js +25 -0
- package/dist/cli/cmd-version.js.map +1 -0
- package/dist/cli/main.js +23 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/version.d.ts +10 -2
- package/dist/version.js +32 -2
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,17 +63,13 @@ Two things worth knowing before you start it:
|
|
|
63
63
|
Limitations below for how much run-to-run noise a JS runtime can add even on an
|
|
64
64
|
idle machine.
|
|
65
65
|
|
|
66
|
-
##
|
|
66
|
+
## The idea
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- restores any test, spec or benchmark file the agent edited before running it, so a weakened test can never manufacture a KEEP;
|
|
72
|
-
- refuses (FAILs) a change that touches `package.json`, a lockfile, `tsconfig.json`, or a file outside the declared `scope`, before anything is even measured;
|
|
73
|
-
- refuses a change that adds a new test/bench file the baseline never saw, closing "add an easier benchmark";
|
|
74
|
-
- appends one row per experiment to `results.tsv`, and reports a cumulative, compounding speedup across the whole run.
|
|
68
|
+
You do not edit TypeScript to tune performance. You edit `program.md` — the
|
|
69
|
+
instructions that drive your agent. The agent edits the TypeScript. The harness
|
|
70
|
+
holds the metric, and the agent cannot reach it.
|
|
75
71
|
|
|
76
|
-
|
|
72
|
+
### Who owns what
|
|
77
73
|
|
|
78
74
|
| | you edit | the agent edits |
|
|
79
75
|
|---|---|---|
|
|
@@ -87,6 +83,16 @@ An unattended loop that, commit by commit:
|
|
|
87
83
|
|
|
88
84
|
The measurement state — baselines, locks, stop requests — lives outside the repository entirely (see "Where run state lives" below). If the agent could write any of it, it could grade its own work.
|
|
89
85
|
|
|
86
|
+
### What you get back
|
|
87
|
+
|
|
88
|
+
An unattended loop that, commit by commit:
|
|
89
|
+
|
|
90
|
+
- measures the agent's candidate against a frozen baseline with real, repeated, interleaved timing rounds and a rank-sum significance test — not a single before/after number;
|
|
91
|
+
- restores any test, spec or benchmark file the agent edited before running it, so a weakened test can never manufacture a KEEP;
|
|
92
|
+
- refuses (FAILs) a change that touches `package.json`, a lockfile, `tsconfig.json`, or a file outside the declared `scope`, before anything is even measured;
|
|
93
|
+
- refuses a change that adds a new test/bench file the baseline never saw, closing "add an easier benchmark";
|
|
94
|
+
- appends one row per experiment to `results.tsv`, and reports a cumulative, compounding speedup across the whole run.
|
|
95
|
+
|
|
90
96
|
## Quick start
|
|
91
97
|
|
|
92
98
|
```bash
|
|
@@ -104,7 +110,7 @@ To install from `main` ahead of a release instead of the last published version,
|
|
|
104
110
|
`npm install --save-dev g4lb/autor3search-typescript` — the GitHub form works too,
|
|
105
111
|
just builds the tool on the way in instead of using a prebuilt tarball.
|
|
106
112
|
|
|
107
|
-
## Watching and stopping
|
|
113
|
+
## Watching a run, and stopping it
|
|
108
114
|
|
|
109
115
|
```bash
|
|
110
116
|
npx autor3search-typescript status -tag <tag> # branch, commits, worktree, experiment counts, in-flight eval — read-only
|
|
@@ -127,14 +133,15 @@ npx autor3search-typescript stop -tag <tag> -clear # cancel a pending stop
|
|
|
127
133
|
| `stop` | Ask the agent to stop after its current experiment; `-clear` cancels, `-force` also signals the running eval |
|
|
128
134
|
| `report` | Summarize `results.tsv`: counts by status, cumulative speedup, largest individual wins |
|
|
129
135
|
| `profile` | Run the declared benchmarks under Node's CPU profiler and print the hottest functions |
|
|
136
|
+
| `version` | Print which build of the harness this is, and the Node runtime measuring with it |
|
|
130
137
|
|
|
131
138
|
Every command accepts a leading `-C <dir>` to run as if invoked from `<dir>` (its git repository root is resolved from there).
|
|
132
139
|
|
|
133
|
-
|
|
140
|
+
### Where run state lives
|
|
134
141
|
|
|
135
142
|
Everything the verdict depends on — the frozen manifest, the baseline record, the eval lock, stop requests — lives under the OS cache directory (`~/Library/Caches` on macOS, `$XDG_CACHE_HOME` or `~/.cache` on Linux, `%LOCALAPPDATA%` on Windows), keyed by the repository's own canonical path and the `-tag` you chose, never inside the repository itself. `results.tsv` and `run.log` also live in the repository but are gitignored and untracked — plain, human-readable output, not gated artifacts. `.autor3search/config.yaml` is the one exception: `init` writes `.autor3search/*` to `.gitignore` with a `!.autor3search/config.yaml` negation, so the run configuration itself is committed to version history (a KEEP has to stay reproducible and auditable later), while only its hash — not its content — is what the gate chain actually trusts; a hand-edit to it fails the next `eval` rather than silently loosening it.
|
|
136
143
|
|
|
137
|
-
##
|
|
144
|
+
## Worked example
|
|
138
145
|
|
|
139
146
|
This is one real, unmodified run of this tool against the demo fixture shipped in `testdata/demo/`: a `countWords` function whose hot loop rebuilds a whole new array on every character —
|
|
140
147
|
|
|
@@ -189,7 +196,18 @@ Each declared benchmark is measured `count` times per side (baseline and candida
|
|
|
189
196
|
|
|
190
197
|
`count` below 4 is refused outright at config-load time: with fewer than 4 rounds per side, the exact rank-sum test cannot report `p < 0.05` no matter how large the true effect is, so every experiment would DISCARD regardless of what changed. The shipped default is 10.
|
|
191
198
|
|
|
192
|
-
|
|
199
|
+
### When the measurement cannot carry the verdict
|
|
200
|
+
|
|
201
|
+
`eval` prints `WARNING:` lines above its verdict (and a `warnings` array in `--json`) when the statistics behind a result do not support reading it at face value. They never change the decision. Two matter:
|
|
202
|
+
|
|
203
|
+
- **Too few rounds for a confidence interval.** At 95% confidence the median's interval needs at least 6 observations per side; below that it is unbounded.
|
|
204
|
+
- **No KEEP was reachable.** The Mann-Whitney U test has a floor on the p-value it can produce for a given sample size — with `n` rounds per side the smallest attainable two-sided p is `2/C(2n,n)`, however far apart the two samples are. Rule 1 divides `ALPHA` by the number of benchmarks, so enough benchmarks push the corrected threshold below that floor and *every* experiment discards no matter what the agent does. The `count >= 4` floor cannot catch this: it does not know how many benchmarks a run will compare. The warning names the count to raise to, or says to compare fewer benchmarks when no count would clear it.
|
|
205
|
+
|
|
206
|
+
`base_ns` is **not** fixed for the whole run. `baseline` pins two things that are kept deliberately separate: a FROZEN commit that the frozen tests and the scope gate always compare against (so an agent cannot expand what it may edit by banking experiments), and a MEASUREMENT commit — what `base_ns` is actually measured against — that starts equal to the frozen one and **advances to the candidate's own commit after every KEEP**. So `score` always answers "did *this* experiment help, compared to the last thing that was kept," never "is the tree better than when the run started." Without this, once one real improvement was kept, every later experiment — however useless — would keep comparing against that same stale starting point, and a no-op could coast to a KEEP on an earlier win it did not contribute to.
|
|
207
|
+
|
|
208
|
+
One consequence: each kept `score` is only that experiment's own incremental contribution, so `report`'s cumulative speedup is the **product** of every kept score, not the latest one alone — successive real improvements compound the way percentage changes do.
|
|
209
|
+
|
|
210
|
+
## Limitations
|
|
193
211
|
|
|
194
212
|
**A KEEP is evidence, not proof.** Any fixed statistical threshold admits false positives; a KEEP means "this cleared the bar the config set," not "this change is definitely faster in production."
|
|
195
213
|
|
|
@@ -208,3 +226,26 @@ Each declared benchmark is measured `count` times per side (baseline and candida
|
|
|
208
226
|
**`count` below 4 can never reach significance,** for the reason given under Scoring above, which is why it is refused at config-load time rather than silently producing a run that can only ever DISCARD.
|
|
209
227
|
|
|
210
228
|
A performance tool that oversells its own certainty is worse than useless: it launders noise into a verdict a human then trusts. Every claim above is stated as plainly as it can be for exactly that reason.
|
|
229
|
+
|
|
230
|
+
### Repos with no benchmarks
|
|
231
|
+
|
|
232
|
+
`init` discovers benchmarks by scanning the repository for `*.bench.ts` files and looking for exported functions named `bench*`. If it finds none, it refuses to write `.autor3search/config.yaml` and exits with an error, rather than generating a config with an empty `benchmarks:` list that would silently optimize nothing.
|
|
233
|
+
|
|
234
|
+
That refusal is deliberate: this tool has no other notion of "faster." The verdict — KEEP, DISCARD, FAIL, CRASH — is entirely a function of the declared benchmarks' timings across a baseline and a candidate. No benchmarks means no signal to gate on, at which point every candidate would either be rejected for no reason or accepted for no reason.
|
|
235
|
+
|
|
236
|
+
To use `autor3search-typescript` on a repository like this:
|
|
237
|
+
|
|
238
|
+
1. Write at least one benchmark covering the code you actually want made faster — a plain exported function in a `*.bench.ts` file:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
export function benchThing(): void {
|
|
242
|
+
thing()
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
2. Benchmark the right thing. A benchmark that exercises a cold path, a trivial helper, or a function nobody calls under load produces numbers that are entirely real and entirely useless — confident percentages attached to work that was never the bottleneck. Benchmark the function, loop, or request path that actually dominates the workload you care about, ideally informed by `profile` or a profile of the real program rather than a guess.
|
|
247
|
+
3. Re-run `init` once the benchmark exists. It will pick it up and proceed normally.
|
|
248
|
+
|
|
249
|
+
## License
|
|
250
|
+
|
|
251
|
+
MIT © 2026 Gal Be
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RunCtx } from './runctx.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reports which build of the harness is running.
|
|
4
|
+
*
|
|
5
|
+
* Worth having for the same reason the Go sibling has it: a `results.tsv`
|
|
6
|
+
* row is only as reproducible as the harness that produced it, and "which
|
|
7
|
+
* version measured this" is otherwise unanswerable from an installed copy.
|
|
8
|
+
*
|
|
9
|
+
* Takes no flags, and says so rather than ignoring them -- a silently
|
|
10
|
+
* accepted typo here would be reported as a version by whatever script
|
|
11
|
+
* called it.
|
|
12
|
+
*/
|
|
13
|
+
export declare function cmdVersion(_ctx: RunCtx, argv: readonly string[]): Promise<number>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { parseArgs } from 'node:util';
|
|
2
|
+
import { formatVersion } from '../version.js';
|
|
3
|
+
/**
|
|
4
|
+
* Reports which build of the harness is running.
|
|
5
|
+
*
|
|
6
|
+
* Worth having for the same reason the Go sibling has it: a `results.tsv`
|
|
7
|
+
* row is only as reproducible as the harness that produced it, and "which
|
|
8
|
+
* version measured this" is otherwise unanswerable from an installed copy.
|
|
9
|
+
*
|
|
10
|
+
* Takes no flags, and says so rather than ignoring them -- a silently
|
|
11
|
+
* accepted typo here would be reported as a version by whatever script
|
|
12
|
+
* called it.
|
|
13
|
+
*/
|
|
14
|
+
export async function cmdVersion(_ctx, argv) {
|
|
15
|
+
try {
|
|
16
|
+
parseArgs({ args: [...argv], options: {}, strict: true, allowPositionals: false });
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
process.stderr.write('error: version takes no arguments\n');
|
|
20
|
+
return 2;
|
|
21
|
+
}
|
|
22
|
+
process.stdout.write(formatVersion());
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=cmd-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmd-version.js","sourceRoot":"","sources":["../../src/cli/cmd-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG7C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY,EAAE,IAAuB;IACpE,IAAI,CAAC;QACH,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC,CAAA;IACpF,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAA;QAC3D,OAAO,CAAC,CAAA;IACV,CAAC;IAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC,CAAA;IACrC,OAAO,CAAC,CAAA;AACV,CAAC"}
|
package/dist/cli/main.js
CHANGED
|
@@ -9,6 +9,7 @@ import { cmdProfile } from './cmd-profile.js';
|
|
|
9
9
|
import { cmdReport } from './cmd-report.js';
|
|
10
10
|
import { cmdStatus } from './cmd-status.js';
|
|
11
11
|
import { cmdStop } from './cmd-stop.js';
|
|
12
|
+
import { cmdVersion } from './cmd-version.js';
|
|
12
13
|
import { resolveCtx, splitDashC } from './runctx.js';
|
|
13
14
|
/**
|
|
14
15
|
* The command table.
|
|
@@ -31,6 +32,7 @@ export const COMMANDS = {
|
|
|
31
32
|
stop: cmdStop,
|
|
32
33
|
report: cmdReport,
|
|
33
34
|
profile: cmdProfile,
|
|
35
|
+
version: cmdVersion,
|
|
34
36
|
};
|
|
35
37
|
const HELP = `autor3search-typescript -- autonomous performance optimization for a TypeScript repository
|
|
36
38
|
|
|
@@ -45,11 +47,24 @@ Commands:
|
|
|
45
47
|
stop Ask the agent to stop after its current experiment; -clear cancels, -force also signals the running eval
|
|
46
48
|
report Summarize results.tsv: counts by status, cumulative speedup, largest individual wins
|
|
47
49
|
profile Run the declared benchmarks under Node's CPU profiler and print the hottest functions
|
|
50
|
+
version Print which build of the harness this is, and the Node runtime measuring with it
|
|
48
51
|
|
|
49
52
|
Global flags:
|
|
50
53
|
-C <dir> Run as if invoked from <dir> (resolves that directory's git repository root)
|
|
51
54
|
--help Print this message
|
|
52
55
|
`;
|
|
56
|
+
/**
|
|
57
|
+
* Stand-in context for the one command that must run outside a repository.
|
|
58
|
+
* Every field is a path `version` never touches; it exists only so the
|
|
59
|
+
* shared `(ctx, argv)` command signature holds without a `RunCtx | null`
|
|
60
|
+
* that all eight other commands would then have to narrow.
|
|
61
|
+
*/
|
|
62
|
+
const NO_REPO_CTX = {
|
|
63
|
+
repoRoot: '',
|
|
64
|
+
configPath: '',
|
|
65
|
+
resultsPath: '',
|
|
66
|
+
logPath: '',
|
|
67
|
+
};
|
|
53
68
|
function printHelp() {
|
|
54
69
|
process.stdout.write(HELP);
|
|
55
70
|
}
|
|
@@ -84,6 +99,14 @@ export async function main(argv) {
|
|
|
84
99
|
printHelp();
|
|
85
100
|
return 2;
|
|
86
101
|
}
|
|
102
|
+
// `version` reports the harness's own identity, which has nothing to do
|
|
103
|
+
// with any repository -- and "which version is installed?" is asked most
|
|
104
|
+
// often from outside one. Resolving a RunCtx first would make it fail
|
|
105
|
+
// with "not inside a git repository", so it dispatches without one, the
|
|
106
|
+
// way `--help` does. Every other command genuinely needs the repo.
|
|
107
|
+
if (name === 'version') {
|
|
108
|
+
return await command(NO_REPO_CTX, commandArgv);
|
|
109
|
+
}
|
|
87
110
|
const ctx = await resolveCtx(argv);
|
|
88
111
|
return await command(ctx, commandArgv);
|
|
89
112
|
}
|
package/dist/cli/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAe,MAAM,aAAa,CAAA;AAIjE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4B;IAC/C,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,WAAW;IACrB,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,UAAU;CACpB,CAAA;AAED,MAAM,IAAI,GAAG
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AAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;QAAE,OAAO,KAAK,CAAA;IAC/C,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAC9E,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC;AAED,IAAI,YAAY,EAAE,EAAE,CAAC;IACnB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACxC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAA;IACzB,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
export declare const VERSION: string;
|
|
2
|
+
/**
|
|
3
|
+
* Build identity for `version`, mirroring the Go sibling's reasoning: a
|
|
4
|
+
* results.tsv row is only as reproducible as the harness that produced it,
|
|
5
|
+
* and "which version measured this" is otherwise unanswerable from an
|
|
6
|
+
* installed copy. Go reports its toolchain and GOOS/GOARCH; the Node
|
|
7
|
+
* equivalents are the runtime version and platform/arch, which also decide
|
|
8
|
+
* whether two measurements are even comparable.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatVersion(): string;
|
package/dist/version.js
CHANGED
|
@@ -1,3 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
/**
|
|
3
|
+
* The running package's version, read from the package.json that ships in
|
|
4
|
+
* the tarball rather than kept in step with it by hand.
|
|
5
|
+
*
|
|
6
|
+
* The hand-synced constant this replaces drifted on the very first release:
|
|
7
|
+
* it still said 0.1.0 after package.json moved to 0.1.1, and its only test
|
|
8
|
+
* asserted the constant matched a semver regex -- which it did, wrongly.
|
|
9
|
+
* Reading the real file makes that class of drift impossible.
|
|
10
|
+
*
|
|
11
|
+
* `../package.json` resolves from this module's own location, which is one
|
|
12
|
+
* directory below the package root both as `src/version.ts` under tsx and
|
|
13
|
+
* as `dist/version.js` when installed.
|
|
14
|
+
*/
|
|
15
|
+
const require = createRequire(import.meta.url);
|
|
16
|
+
const pkg = require('../package.json');
|
|
17
|
+
if (typeof pkg.version !== 'string' || pkg.version === '') {
|
|
18
|
+
throw new Error('package.json has no version field');
|
|
19
|
+
}
|
|
20
|
+
export const VERSION = pkg.version;
|
|
21
|
+
/**
|
|
22
|
+
* Build identity for `version`, mirroring the Go sibling's reasoning: a
|
|
23
|
+
* results.tsv row is only as reproducible as the harness that produced it,
|
|
24
|
+
* and "which version measured this" is otherwise unanswerable from an
|
|
25
|
+
* installed copy. Go reports its toolchain and GOOS/GOARCH; the Node
|
|
26
|
+
* equivalents are the runtime version and platform/arch, which also decide
|
|
27
|
+
* whether two measurements are even comparable.
|
|
28
|
+
*/
|
|
29
|
+
export function formatVersion() {
|
|
30
|
+
return (`autor3search-typescript ${VERSION}\n` +
|
|
31
|
+
`running on ${process.version}, ${process.platform}/${process.arch}\n`);
|
|
32
|
+
}
|
|
3
33
|
//# sourceMappingURL=version.js.map
|
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9C,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAA0B,CAAA;AAE/D,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,KAAK,EAAE,EAAE,CAAC;IAC1D,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;AACtD,CAAC;AAED,MAAM,CAAC,MAAM,OAAO,GAAW,GAAG,CAAC,OAAO,CAAA;AAE1C;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,CACL,2BAA2B,OAAO,IAAI;QACtC,cAAc,OAAO,CAAC,OAAO,KAAK,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,IAAI,IAAI,CACvE,CAAA;AACH,CAAC"}
|