@chaos-overlords/kernel 0.9.5 → 0.9.7
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/LICENSE +21 -674
- package/NOTICE +9 -12
- package/README.md +1 -1
- package/dist/domain/entities.d.ts +13 -0
- package/dist/domain/entities.d.ts.map +1 -1
- package/dist/domain/entities.js.map +1 -1
- package/dist/logic/canonical-json.js +28 -11
- package/dist/logic/canonical-json.js.map +1 -1
- package/dist/ports/storage.d.ts +79 -9
- package/dist/ports/storage.d.ts.map +1 -1
- package/dist/services/EventPublisher.d.ts +11 -0
- package/dist/services/EventPublisher.d.ts.map +1 -1
- package/dist/services/EventPublisher.js +19 -1
- package/dist/services/EventPublisher.js.map +1 -1
- package/dist/services/LobbyService.d.ts.map +1 -1
- package/dist/services/LobbyService.js +5 -1
- package/dist/services/LobbyService.js.map +1 -1
- package/dist/services/MatchQueryService.d.ts +4 -1
- package/dist/services/MatchQueryService.d.ts.map +1 -1
- package/dist/services/MatchQueryService.js +5 -2
- package/dist/services/MatchQueryService.js.map +1 -1
- package/dist/services/SnapshotService.d.ts +16 -5
- package/dist/services/SnapshotService.d.ts.map +1 -1
- package/dist/services/SnapshotService.js +26 -7
- package/dist/services/SnapshotService.js.map +1 -1
- package/dist/services/TurnService.d.ts +74 -2
- package/dist/services/TurnService.d.ts.map +1 -1
- package/dist/services/TurnService.js +329 -85
- package/dist/services/TurnService.js.map +1 -1
- package/dist/testing/InMemoryStorage.d.ts +2 -0
- package/dist/testing/InMemoryStorage.d.ts.map +1 -1
- package/dist/testing/InMemoryStorage.js +91 -9
- package/dist/testing/InMemoryStorage.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MatchQueryService.js","sourceRoot":"","sources":["../../src/services/MatchQueryService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,GASZ,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,aAAa,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AK,IAAI,IAAI,GAAG,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBAC3D,MAAM,IAAI,KAAK,CAAC,eAAe,KAAK,CAAC,EAAE,IAAI,MAAM,0BAA0B,QAAQ,EAAE,CAAC,CAAA;YACxF,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAA;QAC/E,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;IACzE,CAAC;IAEO,WAAW,CAAC,OAAe,EAAE,MAAc;QACjD,OAAO,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACzD,CAAC;CACF;AAED,SAAS,aAAa,CAAC,KAAc;IAMnC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC7D,MAAM,SAAS,GAAG,KAAgC,CAAA;IAClD,OAAO,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC,KAAK,CAChD,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAK,SAAS,CAAC,GAAG,CAAY,IAAI,CAAC,CACjF,CAAA;AACH,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type GameSettings, type SnapshotView, type UploadSnapshotRequest } from '@chaos-overlords/contracts';
|
|
1
|
+
import { type AiSeatSummary, type GameSettings, type SnapshotView, type UploadSnapshotRequest } from '@chaos-overlords/contracts';
|
|
2
2
|
import type { Principal } from './AuthService';
|
|
3
3
|
import type { KernelDeps } from './deps';
|
|
4
4
|
import type { EventPublisher } from './EventPublisher';
|
|
@@ -38,7 +38,9 @@ export declare class SnapshotService {
|
|
|
38
38
|
* The merge is judged before anything is written: a refusal after the row landed would leave a
|
|
39
39
|
* stored snapshot the caller was told was rejected, with no `snapshot.available` and no verdict.
|
|
40
40
|
* Re-running the settings schema over the merge is what holds the blob to its cap, which is why
|
|
41
|
-
* every upload path comes through here before its write.
|
|
41
|
+
* every upload path comes through here before its write. It is judged once, against the blob as
|
|
42
|
+
* it is stored now rather than the copy read when the request was authenticated, and the write
|
|
43
|
+
* after the row only merges what was judged.
|
|
42
44
|
*/
|
|
43
45
|
private store;
|
|
44
46
|
private snapshotOf;
|
|
@@ -46,7 +48,7 @@ export declare class SnapshotService {
|
|
|
46
48
|
* Late-join hints are optional metadata; the snapshot the players are waiting on is not. A
|
|
47
49
|
* transient failure of this write is logged and never fails the upload that already succeeded.
|
|
48
50
|
*/
|
|
49
|
-
private
|
|
51
|
+
private writeSeatSummaries;
|
|
50
52
|
/**
|
|
51
53
|
* A repair must name the turn that actually diverged.
|
|
52
54
|
*
|
|
@@ -89,9 +91,18 @@ export declare class SnapshotService {
|
|
|
89
91
|
get(matchId: string, turn: number): Promise<SnapshotView>;
|
|
90
92
|
}
|
|
91
93
|
/**
|
|
92
|
-
*
|
|
94
|
+
* Write the host's seat summaries into the match's stored `gameSettings`.
|
|
93
95
|
*
|
|
94
|
-
*
|
|
96
|
+
* Only the summaries are written, and the storage merges them into the blob as it stands when the
|
|
97
|
+
* statement runs. The whole blob used to be replaced with the caller's copy, which was the one read
|
|
98
|
+
* when the request was authenticated — a report and an upload in flight together each put back the
|
|
99
|
+
* settings they started from. The cap is judged against the blob as it is now, for the same reason.
|
|
100
|
+
*/
|
|
101
|
+
export declare function publishSeatSummaries(deps: Pick<KernelDeps, 'storage' | 'clock'>, matchId: string, seatSummaries: readonly AiSeatSummary[]): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* The settings blob with the seat summaries merged in, or a refusal when it would not fit.
|
|
104
|
+
*
|
|
105
|
+
* `createMatch` holds `gameSettings` to 8 KiB and to a nesting depth; the summaries go in through
|
|
95
106
|
* `json_set` and would otherwise skip both, which would make the merge a way around a cap that is
|
|
96
107
|
* there because the blob is served on every match read and in every public listing. Re-running the
|
|
97
108
|
* schema over the merged object is what keeps the blob's cap the blob's cap. The array itself is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotService.d.ts","sourceRoot":"","sources":["../../src/services/SnapshotService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAA;AAKnC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAQhD;;;;GAIG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;IAHxB,YACmB,IAAI,EAAE,UAAU,EAChB,SAAS,EAAE,cAAc,EACzB,KAAK,EAAE,WAAW,EACjC;IAEE,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ChF;IAED;;;;;;;;;;;;;;;;OAgBG;YACW,eAAe;IAkB7B
|
|
1
|
+
{"version":3,"file":"SnapshotService.d.ts","sourceRoot":"","sources":["../../src/services/SnapshotService.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EAEjB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC3B,MAAM,4BAA4B,CAAA;AAKnC,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YAAY,EAAE,YAAY,EAC1B,aAAa,EAAE,qBAAqB,CAAC,eAAe,CAAC,GACpD,YAAY,CASd"}
|
|
@@ -103,12 +103,16 @@ export class SnapshotService {
|
|
|
103
103
|
* The merge is judged before anything is written: a refusal after the row landed would leave a
|
|
104
104
|
* stored snapshot the caller was told was rejected, with no `snapshot.available` and no verdict.
|
|
105
105
|
* Re-running the settings schema over the merge is what holds the blob to its cap, which is why
|
|
106
|
-
* every upload path comes through here before its write.
|
|
106
|
+
* every upload path comes through here before its write. It is judged once, against the blob as
|
|
107
|
+
* it is stored now rather than the copy read when the request was authenticated, and the write
|
|
108
|
+
* after the row only merges what was judged.
|
|
107
109
|
*/
|
|
108
110
|
async store(match, uploadedByPlayerId, request) {
|
|
109
|
-
const
|
|
111
|
+
const current = await this.deps.storage.matches.get(match.id);
|
|
112
|
+
if (current)
|
|
113
|
+
mergeSeatSummaries(current.settings.gameSettings, request.seatSummaries);
|
|
110
114
|
await this.deps.storage.snapshots.put(this.snapshotOf(match, uploadedByPlayerId, request));
|
|
111
|
-
await this.
|
|
115
|
+
await this.writeSeatSummaries(match.id, request.seatSummaries);
|
|
112
116
|
await this.pruneOldSnapshots(match.id);
|
|
113
117
|
}
|
|
114
118
|
snapshotOf(match, uploadedByPlayerId, request) {
|
|
@@ -128,9 +132,9 @@ export class SnapshotService {
|
|
|
128
132
|
* Late-join hints are optional metadata; the snapshot the players are waiting on is not. A
|
|
129
133
|
* transient failure of this write is logged and never fails the upload that already succeeded.
|
|
130
134
|
*/
|
|
131
|
-
async
|
|
135
|
+
async writeSeatSummaries(matchId, seatSummaries) {
|
|
132
136
|
try {
|
|
133
|
-
await this.deps.storage.matches.
|
|
137
|
+
await this.deps.storage.matches.updateSeatSummaries(matchId, seatSummaries, this.deps.clock.now());
|
|
134
138
|
}
|
|
135
139
|
catch (error) {
|
|
136
140
|
this.deps.logger.warn('could not publish seat summaries', { matchId, error: String(error) });
|
|
@@ -218,9 +222,24 @@ export class SnapshotService {
|
|
|
218
222
|
}
|
|
219
223
|
}
|
|
220
224
|
/**
|
|
221
|
-
*
|
|
225
|
+
* Write the host's seat summaries into the match's stored `gameSettings`.
|
|
222
226
|
*
|
|
223
|
-
*
|
|
227
|
+
* Only the summaries are written, and the storage merges them into the blob as it stands when the
|
|
228
|
+
* statement runs. The whole blob used to be replaced with the caller's copy, which was the one read
|
|
229
|
+
* when the request was authenticated — a report and an upload in flight together each put back the
|
|
230
|
+
* settings they started from. The cap is judged against the blob as it is now, for the same reason.
|
|
231
|
+
*/
|
|
232
|
+
export async function publishSeatSummaries(deps, matchId, seatSummaries) {
|
|
233
|
+
const current = await deps.storage.matches.get(matchId);
|
|
234
|
+
if (!current)
|
|
235
|
+
return;
|
|
236
|
+
mergeSeatSummaries(current.settings.gameSettings, [...seatSummaries]);
|
|
237
|
+
await deps.storage.matches.updateSeatSummaries(matchId, seatSummaries, deps.clock.now());
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* The settings blob with the seat summaries merged in, or a refusal when it would not fit.
|
|
241
|
+
*
|
|
242
|
+
* `createMatch` holds `gameSettings` to 8 KiB and to a nesting depth; the summaries go in through
|
|
224
243
|
* `json_set` and would otherwise skip both, which would make the merge a way around a cap that is
|
|
225
244
|
* there because the blob is served on every match read and in every public listing. Re-running the
|
|
226
245
|
* schema over the merged object is what keeps the blob's cap the blob's cap. The array itself is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SnapshotService.js","sourceRoot":"","sources":["../../src/services/SnapshotService.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"SnapshotService.js","sourceRoot":"","sources":["../../src/services/SnapshotService.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,kBAAkB,GAGnB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,kBAAkB,C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kB,CAChC,YAA0B,EAC1B,aAAqD;IAErD,MAAM,MAAM,GAAG,EAAE,GAAG,YAAY,EAAE,aAAa,EAAE,CAAA;IACjD,MAAM,OAAO,GAAG,SAAS,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAA;IACrD,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrB,MAAM,IAAI,aAAa,CAAC,yDAAyD,EAAE;YACjF,MAAM,EAAE,yBAAyB;SAClC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,MAAM,CAAA;AACvB,CAAC;AAED,SAAS,MAAM,CAAC,QAAkB;IAChC,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,aAAa,EAAE,QAAQ,CAAC,aAAa;QACrC,eAAe,EAAE,QAAQ,CAAC,eAAe;QACzC,cAAc,EAAE,QAAQ,CAAC,cAAc;QACvC,SAAS,EAAE,QAAQ,CAAC,SAAS;QAC7B,kBAAkB,EAAE,QAAQ,CAAC,kBAAkB;QAC/C,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,WAAW,EAAE;QAC7C,IAAI,EAAE,QAAQ,CAAC,IAAI;KACpB,CAAA;AACH,CAAC"}
|
|
@@ -45,6 +45,33 @@ export declare class TurnService {
|
|
|
45
45
|
topUpSeat(matchId: string, number: number, playerId: string): Promise<void>;
|
|
46
46
|
/** Seal `number` if its trigger condition holds. Returns whether THIS call sealed it. */
|
|
47
47
|
trySeal(matchId: string, number: number, trigger: SealTrigger): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* The CAS half of {@link trySeal}: move `number` from open to sealed if its trigger condition
|
|
50
|
+
* holds, and answer the match it was sealed in, or null when this call did not seal it. The
|
|
51
|
+
* caller owes the seal its `completeSeal`, which the sweep also finishes if the caller cannot.
|
|
52
|
+
*/
|
|
53
|
+
private claimSeal;
|
|
54
|
+
/**
|
|
55
|
+
* Seal the open turn of `match` if its deadline has already passed, and answer the match as it
|
|
56
|
+
* stands afterwards.
|
|
57
|
+
*
|
|
58
|
+
* The timer and the sweep are what normally seal a turn on its deadline, and either can come up
|
|
59
|
+
* short: a timer lost to a restart or replaced by a stale re-arm waits on the sweep, and on
|
|
60
|
+
* Cloudflare the sweep is a cron that runs every few minutes, if it was configured at all. For
|
|
61
|
+
* that whole time every client showed a countdown that had reached zero and a turn that never
|
|
62
|
+
* sealed, until somebody gave up and ended it themselves. A client that notices is resynchronising
|
|
63
|
+
* already, and the match view it reads to do so is the natural place to finish the job: a turn is
|
|
64
|
+
* never sealed early by this, only one the server is already late with.
|
|
65
|
+
*
|
|
66
|
+
* Best effort. A seal that fails here is still owed by the timer and the sweep, and the read the
|
|
67
|
+
* caller came for must not fail with it.
|
|
68
|
+
*
|
|
69
|
+
* The match is read again whenever the turn it names is no longer the open one: a seal that
|
|
70
|
+
* somebody else is finishing — the timer, the sweep, or a ready seal that won the race with this
|
|
71
|
+
* call — has moved the match on since the caller loaded it, and a view built from that copy
|
|
72
|
+
* would name the sealed turn as current beside a log that already carries its seal.
|
|
73
|
+
*/
|
|
74
|
+
sealIfOverdue(match: Match): Promise<Match>;
|
|
48
75
|
/**
|
|
49
76
|
* Put a deadline timer that fired before its deadline back on the clock.
|
|
50
77
|
*
|
|
@@ -74,6 +101,13 @@ export declare class TurnService {
|
|
|
74
101
|
* announce it, and open the next turn. Each step is conditional on its own predecessor, so a call
|
|
75
102
|
* on a turn that is already complete changes nothing and a call on one that stopped halfway
|
|
76
103
|
* finishes it. Orders are immutable from the CAS onwards, so the digest it derives is stable.
|
|
104
|
+
*
|
|
105
|
+
* The announcement is made by every caller that gets this far, not only by the one that froze
|
|
106
|
+
* the set, and it is keyed (`publishOnce`) so the log carries it once. The freeze's winner used to
|
|
107
|
+
* be the only publisher, so an append that threw after the freeze lost `turn.sealed` for good:
|
|
108
|
+
* the sweep found the stalled seal, saw the set frozen, opened the successor without announcing
|
|
109
|
+
* the seal, and every client waited on it forever. Announcing before `openTurn` also makes an
|
|
110
|
+
* open successor proof that its predecessor's seal is in the log, whichever caller opened it.
|
|
77
111
|
*/
|
|
78
112
|
private completeSeal;
|
|
79
113
|
/**
|
|
@@ -147,13 +181,51 @@ export declare class TurnService {
|
|
|
147
181
|
private announceDeadline;
|
|
148
182
|
/** Re-run the verdict of every unconfirmed turn and the auto-seal of the open one. */
|
|
149
183
|
reevaluate(matchId: string): Promise<void>;
|
|
150
|
-
/**
|
|
151
|
-
|
|
184
|
+
/**
|
|
185
|
+
* Decide turn `number` from the reports on file. Idempotent and race-safe through CAS. Returns
|
|
186
|
+
* whether this call finished anything a confirmation cut short (see `finishConfirmation`), which
|
|
187
|
+
* is what the sweep reports as a repair.
|
|
188
|
+
*/
|
|
189
|
+
settle(matchId: string, number: number): Promise<boolean>;
|
|
190
|
+
/**
|
|
191
|
+
* Tell clients a match is paused, unless the log's last word on its status already says so.
|
|
192
|
+
*
|
|
193
|
+
* The pause is one fact however many turns diverge behind it, and the turn whose verdict paused
|
|
194
|
+
* the match cannot be told from the others once that verdict is cut short, so the owed
|
|
195
|
+
* announcement is judged from the log rather than from the verdict. Only a match that is still
|
|
196
|
+
* paused is announced as paused; a pause lifted while this ran is announced as lifted as well,
|
|
197
|
+
* since the lift saw no pause to announce and so said nothing.
|
|
198
|
+
*/
|
|
199
|
+
private announcePause;
|
|
200
|
+
/**
|
|
201
|
+
* Log `match.statusChanged` for a pause or its lift when it is owed: a pause when the last status
|
|
202
|
+
* announced is anything but a pause, a lift only when it is the pause (a match never paused, or
|
|
203
|
+
* whose pause was never announced, has nothing to lift in any client's eyes). Keyed by the status
|
|
204
|
+
* event it follows, so racing callers who read the same last word log the change once. Returns
|
|
205
|
+
* whether this call logged it.
|
|
206
|
+
*/
|
|
207
|
+
private announceStatus;
|
|
208
|
+
/**
|
|
209
|
+
* Everything a confirmation owes after its compare-and-swap: announce it, lift a desync pause it
|
|
210
|
+
* ends, finish a match it completes, then stamp `settledAt`. Every step is conditional on its own
|
|
211
|
+
* state or keyed in the log, so a repeat — by the sweep, over a verdict cut short — finishes what
|
|
212
|
+
* the first attempt left and duplicates nothing. Returns whether this call logged or changed
|
|
213
|
+
* anything, which for a repeat means it found work the first attempt left.
|
|
214
|
+
*/
|
|
215
|
+
private finishConfirmation;
|
|
152
216
|
/**
|
|
153
217
|
* Lift a desync pause once nothing is unsettled. Orders were refused for the whole pause while
|
|
154
218
|
* the open turn's deadline kept running, so the turn would otherwise seal empty the moment the
|
|
155
219
|
* match resumes: its clock restarts here, and clients are told the new deadline.
|
|
220
|
+
*
|
|
221
|
+
* The lift's follow-ups are owed by the lift, not by the call that won its compare-and-swap. A
|
|
222
|
+
* call that finds the match already running while the log still says it is paused completes them
|
|
223
|
+
* for a lift that died half way; the announcement goes last, as their receipt. Returns whether
|
|
224
|
+
* this call lifted the pause or completed a lift.
|
|
156
225
|
*/
|
|
157
226
|
private resumeAfterDesync;
|
|
227
|
+
/** Whether the log's last status announcement is still the pause. */
|
|
228
|
+
private liftUnannounced;
|
|
229
|
+
private restartClockAfterPause;
|
|
158
230
|
}
|
|
159
231
|
//# sourceMappingURL=TurnService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TurnService.d.ts","sourceRoot":"","sources":["../../src/services/TurnService.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAGL,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"TurnService.d.ts","sourceRoot":"","sources":["../../src/services/TurnService.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAGL,KAAK,KAAK,EAIX,MAAM,oBAAoB,CAAA;AAW3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,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