@sharpee/engine 0.9.113 → 1.0.8
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/action-context-factory.d.ts +12 -4
- package/action-context-factory.d.ts.map +1 -1
- package/action-context-factory.js +32 -8
- package/action-context-factory.js.map +1 -1
- package/capability-dispatch-helper.d.ts +3 -3
- package/capability-dispatch-helper.d.ts.map +1 -1
- package/capability-dispatch-helper.js +1 -1
- package/command-executor.d.ts +7 -6
- package/command-executor.d.ts.map +1 -1
- package/command-executor.js +5 -5
- package/command-executor.js.map +1 -1
- package/events/event-emitter.d.ts +2 -2
- package/events/event-emitter.d.ts.map +1 -1
- package/game-engine.d.ts +93 -10
- package/game-engine.d.ts.map +1 -1
- package/game-engine.js +245 -14
- package/game-engine.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/language-provider-interface.d.ts +1 -1
- package/language-provider-interface.d.ts.map +1 -1
- package/narrative/index.d.ts.map +1 -1
- package/narrative/narrative-settings.d.ts +1 -1
- package/narrative/narrative-settings.d.ts.map +1 -1
- package/package.json +12 -12
- package/parser-interface.d.ts +2 -2
- package/parser-interface.d.ts.map +1 -1
- package/platform-operations.d.ts +2 -2
- package/platform-operations.d.ts.map +1 -1
- package/platform-operations.js +1 -1
- package/prose-pipeline/assemble.d.ts +77 -0
- package/prose-pipeline/assemble.d.ts.map +1 -0
- package/prose-pipeline/assemble.js +96 -0
- package/prose-pipeline/assemble.js.map +1 -0
- package/prose-pipeline/decorations/index.d.ts +18 -0
- package/prose-pipeline/decorations/index.d.ts.map +1 -0
- package/prose-pipeline/decorations/index.js +24 -0
- package/prose-pipeline/decorations/index.js.map +1 -0
- package/prose-pipeline/decorations/parser.d.ts +34 -0
- package/prose-pipeline/decorations/parser.d.ts.map +1 -0
- package/prose-pipeline/decorations/parser.js +195 -0
- package/prose-pipeline/decorations/parser.js.map +1 -0
- package/prose-pipeline/decorations/platform-vocabulary.d.ts +35 -0
- package/prose-pipeline/decorations/platform-vocabulary.d.ts.map +1 -0
- package/prose-pipeline/decorations/platform-vocabulary.js +81 -0
- package/prose-pipeline/decorations/platform-vocabulary.js.map +1 -0
- package/prose-pipeline/decorations/resolver.d.ts +28 -0
- package/prose-pipeline/decorations/resolver.d.ts.map +1 -0
- package/prose-pipeline/decorations/resolver.js +39 -0
- package/prose-pipeline/decorations/resolver.js.map +1 -0
- package/prose-pipeline/decorations/types.d.ts +16 -0
- package/prose-pipeline/decorations/types.d.ts.map +1 -0
- package/prose-pipeline/decorations/types.js +17 -0
- package/prose-pipeline/decorations/types.js.map +1 -0
- package/prose-pipeline/handlers/about.d.ts +31 -0
- package/prose-pipeline/handlers/about.d.ts.map +1 -0
- package/prose-pipeline/handlers/about.js +50 -0
- package/prose-pipeline/handlers/about.js.map +1 -0
- package/prose-pipeline/handlers/audibility.d.ts +46 -0
- package/prose-pipeline/handlers/audibility.d.ts.map +1 -0
- package/prose-pipeline/handlers/audibility.js +79 -0
- package/prose-pipeline/handlers/audibility.js.map +1 -0
- package/prose-pipeline/handlers/banner.d.ts +44 -0
- package/prose-pipeline/handlers/banner.d.ts.map +1 -0
- package/prose-pipeline/handlers/banner.js +88 -0
- package/prose-pipeline/handlers/banner.js.map +1 -0
- package/prose-pipeline/handlers/client-query.d.ts +22 -0
- package/prose-pipeline/handlers/client-query.d.ts.map +1 -0
- package/prose-pipeline/handlers/client-query.js +55 -0
- package/prose-pipeline/handlers/client-query.js.map +1 -0
- package/prose-pipeline/handlers/command-failed.d.ts +24 -0
- package/prose-pipeline/handlers/command-failed.d.ts.map +1 -0
- package/prose-pipeline/handlers/command-failed.js +46 -0
- package/prose-pipeline/handlers/command-failed.js.map +1 -0
- package/prose-pipeline/handlers/domain-message.d.ts +31 -0
- package/prose-pipeline/handlers/domain-message.d.ts.map +1 -0
- package/prose-pipeline/handlers/domain-message.js +66 -0
- package/prose-pipeline/handlers/domain-message.js.map +1 -0
- package/prose-pipeline/handlers/game.d.ts +31 -0
- package/prose-pipeline/handlers/game.d.ts.map +1 -0
- package/prose-pipeline/handlers/game.js +35 -0
- package/prose-pipeline/handlers/game.js.map +1 -0
- package/prose-pipeline/handlers/generic.d.ts +27 -0
- package/prose-pipeline/handlers/generic.d.ts.map +1 -0
- package/prose-pipeline/handlers/generic.js +67 -0
- package/prose-pipeline/handlers/generic.js.map +1 -0
- package/prose-pipeline/handlers/help.d.ts +21 -0
- package/prose-pipeline/handlers/help.d.ts.map +1 -0
- package/prose-pipeline/handlers/help.js +68 -0
- package/prose-pipeline/handlers/help.js.map +1 -0
- package/prose-pipeline/handlers/implicit-take.d.ts +20 -0
- package/prose-pipeline/handlers/implicit-take.d.ts.map +1 -0
- package/prose-pipeline/handlers/implicit-take.js +26 -0
- package/prose-pipeline/handlers/implicit-take.js.map +1 -0
- package/prose-pipeline/handlers/index.d.ts +24 -0
- package/prose-pipeline/handlers/index.d.ts.map +1 -0
- package/prose-pipeline/handlers/index.js +40 -0
- package/prose-pipeline/handlers/index.js.map +1 -0
- package/prose-pipeline/handlers/revealed.d.ts +24 -0
- package/prose-pipeline/handlers/revealed.d.ts.map +1 -0
- package/prose-pipeline/handlers/revealed.js +54 -0
- package/prose-pipeline/handlers/revealed.js.map +1 -0
- package/prose-pipeline/handlers/room.d.ts +25 -0
- package/prose-pipeline/handlers/room.d.ts.map +1 -0
- package/prose-pipeline/handlers/room.js +78 -0
- package/prose-pipeline/handlers/room.js.map +1 -0
- package/prose-pipeline/handlers/types.d.ts +47 -0
- package/prose-pipeline/handlers/types.d.ts.map +1 -0
- package/prose-pipeline/handlers/types.js +15 -0
- package/prose-pipeline/handlers/types.js.map +1 -0
- package/prose-pipeline/index.d.ts +20 -0
- package/prose-pipeline/index.d.ts.map +1 -0
- package/prose-pipeline/index.js +50 -0
- package/prose-pipeline/index.js.map +1 -0
- package/prose-pipeline/pipeline.d.ts +58 -0
- package/prose-pipeline/pipeline.d.ts.map +1 -0
- package/prose-pipeline/pipeline.js +120 -0
- package/prose-pipeline/pipeline.js.map +1 -0
- package/prose-pipeline/stages/filter.d.ts +26 -0
- package/prose-pipeline/stages/filter.d.ts.map +1 -0
- package/prose-pipeline/stages/filter.js +38 -0
- package/prose-pipeline/stages/filter.js.map +1 -0
- package/prose-pipeline/stages/index.d.ts +13 -0
- package/prose-pipeline/stages/index.d.ts.map +1 -0
- package/prose-pipeline/stages/index.js +19 -0
- package/prose-pipeline/stages/index.js.map +1 -0
- package/prose-pipeline/stages/sort.d.ts +38 -0
- package/prose-pipeline/stages/sort.d.ts.map +1 -0
- package/prose-pipeline/stages/sort.js +94 -0
- package/prose-pipeline/stages/sort.js.map +1 -0
- package/prose-pipeline/types.d.ts +45 -0
- package/prose-pipeline/types.d.ts.map +1 -0
- package/prose-pipeline/types.js +23 -0
- package/prose-pipeline/types.js.map +1 -0
- package/save-restore-service.d.ts +3 -3
- package/save-restore-service.d.ts.map +1 -1
- package/save-restore-service.js +1 -1
- package/scene-evaluation-plugin.d.ts +2 -2
- package/scene-evaluation-plugin.d.ts.map +1 -1
- package/scene-evaluation-plugin.js +1 -1
- package/shared-data-keys.d.ts +3 -3
- package/shared-data-keys.d.ts.map +1 -1
- package/sound/dispatcher.d.ts +75 -0
- package/sound/dispatcher.d.ts.map +1 -0
- package/sound/dispatcher.js +122 -0
- package/sound/dispatcher.js.map +1 -0
- package/sound/index.d.ts +26 -0
- package/sound/index.d.ts.map +1 -0
- package/sound/index.js +34 -0
- package/sound/index.js.map +1 -0
- package/sound/propagation.d.ts +69 -0
- package/sound/propagation.d.ts.map +1 -0
- package/sound/propagation.js +219 -0
- package/sound/propagation.js.map +1 -0
- package/story.d.ts +31 -4
- package/story.d.ts.map +1 -1
- package/story.js.map +1 -1
- package/test-helpers/mock-prose-pipeline.d.ts +22 -0
- package/test-helpers/mock-prose-pipeline.d.ts.map +1 -0
- package/test-helpers/mock-prose-pipeline.js +56 -0
- package/test-helpers/mock-prose-pipeline.js.map +1 -0
- package/turn-event-processor.d.ts +3 -3
- package/turn-event-processor.d.ts.map +1 -1
- package/turn-event-processor.js +1 -1
- package/types.d.ts +4 -4
- package/types.d.ts.map +1 -1
- package/vocabulary-manager.d.ts +1 -1
- package/vocabulary-manager.d.ts.map +1 -1
- package/vocabulary-manager.js +1 -1
- package/event-adapter.d.ts +0 -44
- package/event-adapter.d.ts.map +0 -1
- package/event-adapter.js +0 -127
- package/event-adapter.js.map +0 -1
- package/event-sequencer.d.ts +0 -73
- package/event-sequencer.d.ts.map +0 -1
- package/event-sequencer.js +0 -134
- package/event-sequencer.js.map +0 -1
- package/test-helpers/mock-text-service.d.ts +0 -11
- package/test-helpers/mock-text-service.d.ts.map +0 -1
- package/test-helpers/mock-text-service.js +0 -47
- package/test-helpers/mock-text-service.js.map +0 -1
package/event-sequencer.js
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Event Sequencer - Manages event ordering within turns
|
|
4
|
-
*
|
|
5
|
-
* Ensures all events have proper sequence numbers for ordering
|
|
6
|
-
* and grouping within a turn.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.eventSequencer = exports.EventSequenceUtils = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* Event sequencer class
|
|
12
|
-
*/
|
|
13
|
-
class EventSequencer {
|
|
14
|
-
counter = Date.now();
|
|
15
|
-
/**
|
|
16
|
-
* Get next sequence number
|
|
17
|
-
*/
|
|
18
|
-
next() {
|
|
19
|
-
return ++this.counter;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Reset turn counter (optional, for testing)
|
|
23
|
-
*/
|
|
24
|
-
resetTurn(turn) {
|
|
25
|
-
// No-op in this implementation
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Sequence a single event
|
|
29
|
-
*/
|
|
30
|
-
sequence(event, turn) {
|
|
31
|
-
return {
|
|
32
|
-
...event,
|
|
33
|
-
sequence: this.next(),
|
|
34
|
-
timestamp: new Date(),
|
|
35
|
-
turn,
|
|
36
|
-
scope: 'turn'
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Sequence multiple events
|
|
41
|
-
*/
|
|
42
|
-
sequenceAll(events, turn) {
|
|
43
|
-
return events.map(event => this.sequence(event, turn));
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Event sequence utilities
|
|
48
|
-
*/
|
|
49
|
-
class EventSequenceUtils {
|
|
50
|
-
/**
|
|
51
|
-
* Sort events by sequence number
|
|
52
|
-
*/
|
|
53
|
-
static sort(events) {
|
|
54
|
-
return [...events].sort((a, b) => a.sequence - b.sequence);
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Filter events by type
|
|
58
|
-
*/
|
|
59
|
-
static filterByType(events, type) {
|
|
60
|
-
return events.filter(e => e.type === type);
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Filter events by turn
|
|
64
|
-
*/
|
|
65
|
-
static filterByTurn(events, turn) {
|
|
66
|
-
return events.filter(e => e.turn === turn);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Filter events by scope
|
|
70
|
-
*/
|
|
71
|
-
static filterByScope(events, scope) {
|
|
72
|
-
return events.filter(e => e.scope === scope);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Group events by type
|
|
76
|
-
*/
|
|
77
|
-
static groupByType(events) {
|
|
78
|
-
const groups = {};
|
|
79
|
-
for (const event of events) {
|
|
80
|
-
if (!groups[event.type]) {
|
|
81
|
-
groups[event.type] = [];
|
|
82
|
-
}
|
|
83
|
-
groups[event.type].push(event);
|
|
84
|
-
}
|
|
85
|
-
return groups;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Group events by turn
|
|
89
|
-
*/
|
|
90
|
-
static groupByTurn(events) {
|
|
91
|
-
const groups = {};
|
|
92
|
-
for (const event of events) {
|
|
93
|
-
if (!groups[event.turn]) {
|
|
94
|
-
groups[event.turn] = [];
|
|
95
|
-
}
|
|
96
|
-
groups[event.turn].push(event);
|
|
97
|
-
}
|
|
98
|
-
return groups;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Get latest event by type
|
|
102
|
-
*/
|
|
103
|
-
static getLatestByType(events, type) {
|
|
104
|
-
const filtered = this.filterByType(events, type);
|
|
105
|
-
if (filtered.length === 0)
|
|
106
|
-
return undefined;
|
|
107
|
-
return filtered.reduce((latest, current) => current.sequence > latest.sequence ? current : latest);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Count events by type
|
|
111
|
-
*/
|
|
112
|
-
static countByType(events) {
|
|
113
|
-
const counts = {};
|
|
114
|
-
for (const event of events) {
|
|
115
|
-
counts[event.type] = (counts[event.type] || 0) + 1;
|
|
116
|
-
}
|
|
117
|
-
return counts;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Get events in sequence range
|
|
121
|
-
*/
|
|
122
|
-
static getInRange(events, start, end, inclusive = true) {
|
|
123
|
-
if (inclusive) {
|
|
124
|
-
return events.filter(e => e.sequence >= start && e.sequence <= end);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
return events.filter(e => e.sequence > start && e.sequence < end);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.EventSequenceUtils = EventSequenceUtils;
|
|
132
|
-
// Export singleton instance
|
|
133
|
-
exports.eventSequencer = new EventSequencer();
|
|
134
|
-
//# sourceMappingURL=event-sequencer.js.map
|
package/event-sequencer.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-sequencer.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/event-sequencer.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAIH;;GAEG;AACH,MAAM,cAAc;IACV,OAA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,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CACtD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,MAAwB;QACzC,MAAM,MAAM,GAA2B,EAAE,CAAC;QAE1C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACrD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CACf,MAAwB,EACxB,KAAa,EACb,GAAW,EACX,YAAqB,IAAI;QAEzB,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,KAAK,IAAI,CAAC,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,KAAK,IAAI,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,CAAC;QACpE,CAAC;IACH,CAAC;CACF;AArGD,gDAqGC;AAED,4BAA4B;AACf,QAAA,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mock text service for testing
|
|
3
|
-
*/
|
|
4
|
-
import type { ITextService } from "../../text-service/index";
|
|
5
|
-
import type { ITextBlock } from "../../text-blocks/index";
|
|
6
|
-
import type { ISemanticEvent } from "../../core/index";
|
|
7
|
-
export declare class MockTextService implements ITextService {
|
|
8
|
-
processTurn(events: ISemanticEvent[]): ITextBlock[];
|
|
9
|
-
}
|
|
10
|
-
export declare function createMockTextService(): ITextService;
|
|
11
|
-
//# sourceMappingURL=mock-text-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-text-service.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/test-helpers/mock-text-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,qBAAa,eAAgB,YAAW,YAAY;IAClD,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE;CAkCpD;AAED,wBAAgB,qBAAqB,IAAI,YAAY,CAEpD"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Mock text service for testing
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MockTextService = void 0;
|
|
7
|
-
exports.createMockTextService = createMockTextService;
|
|
8
|
-
class MockTextService {
|
|
9
|
-
processTurn(events) {
|
|
10
|
-
const blocks = [];
|
|
11
|
-
// Process events
|
|
12
|
-
for (const event of events) {
|
|
13
|
-
const data = event.data;
|
|
14
|
-
if (event.type === 'action.error') {
|
|
15
|
-
blocks.push({
|
|
16
|
-
key: 'error',
|
|
17
|
-
content: [String(data?.message || 'Error occurred')],
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
else if (data?.messageId) {
|
|
21
|
-
blocks.push({
|
|
22
|
-
key: 'action.result',
|
|
23
|
-
content: [String(data.messageId)],
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
else if (event.type === 'room.described') {
|
|
27
|
-
blocks.push({
|
|
28
|
-
key: 'room.description',
|
|
29
|
-
content: [String(data?.description || 'You are in a room.')],
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
// Default message if no events
|
|
34
|
-
if (blocks.length === 0) {
|
|
35
|
-
blocks.push({
|
|
36
|
-
key: 'game.message',
|
|
37
|
-
content: ['Nothing happened.'],
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return blocks;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.MockTextService = MockTextService;
|
|
44
|
-
function createMockTextService() {
|
|
45
|
-
return new MockTextService();
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=mock-text-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock-text-service.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/test-helpers/mock-text-service.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AA2CH,sDAEC;AAvCD,MAAa,eAAe;IAC1B,WAAW,CAAC,MAAwB;QAClC,MAAM,MAAM,GAAiB,EAAE,CAAC;QAEhC,iBAAiB;QACjB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,IAA2B,CAAC;YAC/C,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBAClC,MAAM,CAAC,IAAI,CAAC;oBACV,GAAG,EAAE,OAAO;oBACZ,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,IAAI,gBAAgB,CAAC,CAAC;iBACrD,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,IAAI,EAAE,SAAS,EAAE,CAAC;gBAC3B,MAAM,CAAC,IAAI,CAAC;oBACV,GAAG,EAAE,eAAe;oBACpB,OAAO,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBAClC,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;gBAC3C,MAAM,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