jazz-tools 0.7.0-alpha.6 → 0.7.0-alpha.8
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/coValues/account.js +62 -29
- package/dist/coValues/account.js.map +1 -1
- package/dist/coValues/coList.js +139 -89
- package/dist/coValues/coList.js.map +1 -1
- package/dist/coValues/coMap.js +135 -151
- package/dist/coValues/coMap.js.map +1 -1
- package/dist/coValues/coStream.js +131 -57
- package/dist/coValues/coStream.js.map +1 -1
- package/dist/coValues/extensions/imageDef.js +10 -7
- package/dist/coValues/extensions/imageDef.js.map +1 -1
- package/dist/coValues/group.js +8 -30
- package/dist/coValues/group.js.map +1 -1
- package/dist/coValues/interfaces.js +6 -2
- package/dist/coValues/interfaces.js.map +1 -1
- package/dist/implementation/encoding.js +21 -0
- package/dist/implementation/encoding.js.map +1 -1
- package/dist/implementation/refs.js +10 -9
- package/dist/implementation/refs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tests/coList.test.js +5 -9
- package/dist/tests/coList.test.js.map +1 -1
- package/dist/tests/coMap.test.js +99 -36
- package/dist/tests/coMap.test.js.map +1 -1
- package/dist/tests/coStream.test.js +46 -51
- package/dist/tests/coStream.test.js.map +1 -1
- package/package.json +2 -2
- package/src/coValues/account.ts +82 -52
- package/src/coValues/coList.ts +170 -107
- package/src/coValues/coMap.ts +196 -230
- package/src/coValues/coStream.ts +169 -91
- package/src/coValues/extensions/imageDef.ts +7 -11
- package/src/coValues/group.ts +16 -63
- package/src/coValues/interfaces.ts +9 -8
- package/src/implementation/encoding.ts +55 -16
- package/src/implementation/refs.ts +12 -10
- package/src/index.ts +1 -1
- package/src/tests/coList.test.ts +5 -9
- package/src/tests/coMap.test.ts +77 -51
- package/src/tests/coStream.test.ts +61 -66
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# jazz-autosub
|
2
2
|
|
3
|
+
## 0.7.0-alpha.8
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- More subclass-friendly types in CoMap
|
8
|
+
|
9
|
+
## 0.7.0-alpha.7
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- Consistent proxy based API
|
14
|
+
- Updated dependencies
|
15
|
+
- cojson@0.7.0-alpha.7
|
16
|
+
|
3
17
|
## 0.7.0-alpha.6
|
4
18
|
|
5
19
|
### Patch Changes
|
package/dist/coValues/account.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
var _a;
|
2
2
|
import { LocalNode } from "cojson";
|
3
3
|
import { Context } from "effect";
|
4
|
-
import { CoValueBase, Profile, Ref, inspect } from "../internal.js";
|
4
|
+
import { CoValueBase, Profile, Ref, SchemaInit, inspect, subscriptionsScopes, } from "../internal.js";
|
5
5
|
export class Account extends CoValueBase {
|
6
6
|
get _encoding() {
|
7
7
|
return this.constructor._encoding;
|
@@ -18,9 +18,10 @@ export class Account extends CoValueBase {
|
|
18
18
|
const profileID = this._raw.get("profile");
|
19
19
|
const rootID = this._raw.get("root");
|
20
20
|
return {
|
21
|
-
profile: profileID &&
|
21
|
+
profile: profileID &&
|
22
|
+
new Ref(profileID, this._loadedAs, this._encoding.profile),
|
22
23
|
root: rootID &&
|
23
|
-
new Ref(rootID, this._loadedAs, this._encoding.root
|
24
|
+
new Ref(rootID, this._loadedAs, this._encoding.root),
|
24
25
|
};
|
25
26
|
}
|
26
27
|
constructor(init, options) {
|
@@ -44,33 +45,12 @@ export class Account extends CoValueBase {
|
|
44
45
|
enumerable: false,
|
45
46
|
},
|
46
47
|
_raw: { value: options.fromRaw, enumerable: false },
|
47
|
-
profile: {
|
48
|
-
get: () => {
|
49
|
-
const ref = this._refs.profile;
|
50
|
-
return ref ? ref.accessFrom(this) : undefined;
|
51
|
-
},
|
52
|
-
set: (value) => {
|
53
|
-
if (value) {
|
54
|
-
this._raw.set("profile", value.id);
|
55
|
-
}
|
56
|
-
},
|
57
|
-
},
|
58
|
-
root: {
|
59
|
-
get: () => {
|
60
|
-
const ref = this._refs.root;
|
61
|
-
return ref ? ref.accessFrom(this) : undefined;
|
62
|
-
},
|
63
|
-
set: (value) => {
|
64
|
-
if (value) {
|
65
|
-
this._raw.set("root", value.id);
|
66
|
-
}
|
67
|
-
},
|
68
|
-
},
|
69
48
|
});
|
70
49
|
if (this.isMe) {
|
71
50
|
this.sessionID =
|
72
51
|
options.fromRaw.core.node.currentSessionID;
|
73
52
|
}
|
53
|
+
return new Proxy(this, AccountAndGroupProxyHandler);
|
74
54
|
}
|
75
55
|
myRole() {
|
76
56
|
if (this.isMe) {
|
@@ -118,10 +98,6 @@ export class Account extends CoValueBase {
|
|
118
98
|
[inspect]() {
|
119
99
|
return this.toJSON();
|
120
100
|
}
|
121
|
-
static encoding(fields) {
|
122
|
-
this._encoding || (this._encoding = {});
|
123
|
-
Object.assign(this._encoding, fields);
|
124
|
-
}
|
125
101
|
}
|
126
102
|
_a = Account;
|
127
103
|
(() => {
|
@@ -130,6 +106,63 @@ _a = Account;
|
|
130
106
|
root: { json: true },
|
131
107
|
};
|
132
108
|
})();
|
109
|
+
export const AccountAndGroupProxyHandler = {
|
110
|
+
get(target, key, receiver) {
|
111
|
+
if (key === "profile") {
|
112
|
+
const ref = target._refs.profile;
|
113
|
+
return ref ? ref.accessFrom(receiver) : undefined;
|
114
|
+
}
|
115
|
+
else if (key === "root") {
|
116
|
+
const ref = target._refs.root;
|
117
|
+
return ref ? ref.accessFrom(receiver) : undefined;
|
118
|
+
}
|
119
|
+
else {
|
120
|
+
return Reflect.get(target, key, receiver);
|
121
|
+
}
|
122
|
+
},
|
123
|
+
set(target, key, value, receiver) {
|
124
|
+
var _b;
|
125
|
+
if ((key === "profile" || key === "root") &&
|
126
|
+
typeof value === "object" &&
|
127
|
+
SchemaInit in value) {
|
128
|
+
(_b = target.constructor)._encoding || (_b._encoding = {});
|
129
|
+
target.constructor._encoding[key] =
|
130
|
+
value[SchemaInit];
|
131
|
+
return true;
|
132
|
+
}
|
133
|
+
else if (key === "profile") {
|
134
|
+
if (value) {
|
135
|
+
target._raw.set("profile", value.id);
|
136
|
+
}
|
137
|
+
subscriptionsScopes.get(receiver)?.onRefAccessedOrSet(value.id);
|
138
|
+
return true;
|
139
|
+
}
|
140
|
+
else if (key === "root") {
|
141
|
+
if (value) {
|
142
|
+
target._raw.set("root", value.id);
|
143
|
+
}
|
144
|
+
subscriptionsScopes.get(receiver)?.onRefAccessedOrSet(value.id);
|
145
|
+
return true;
|
146
|
+
}
|
147
|
+
else {
|
148
|
+
return Reflect.set(target, key, value, receiver);
|
149
|
+
}
|
150
|
+
},
|
151
|
+
defineProperty(target, key, descriptor) {
|
152
|
+
var _b;
|
153
|
+
if ((key === "profile" || key === "root") &&
|
154
|
+
typeof descriptor.value === "object" &&
|
155
|
+
SchemaInit in descriptor.value) {
|
156
|
+
(_b = target.constructor)._encoding || (_b._encoding = {});
|
157
|
+
target.constructor._encoding[key] =
|
158
|
+
descriptor.value[SchemaInit];
|
159
|
+
return true;
|
160
|
+
}
|
161
|
+
else {
|
162
|
+
return Reflect.defineProperty(target, key, descriptor);
|
163
|
+
}
|
164
|
+
},
|
165
|
+
};
|
133
166
|
export class AccountCtx extends Context.Tag("Account")() {
|
134
167
|
}
|
135
168
|
export function isControlledAccount(account) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/coValues/account.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAYnC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAYjC,OAAO,
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/coValues/account.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAYnC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAYjC,OAAO,EACH,WAAW,EACX,OAAO,EACP,GAAG,EACH,UAAU,EACV,OA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;
|
2
2
|
import { RawAccount } from "cojson";
|
3
|
-
import { Account, CoValueBase, Group, Ref, inspect, makeRefs, } from "../internal.js";
|
3
|
+
import { Account, CoValueBase, Group, InitValues, ItemsSym, Ref, SchemaInit, val, inspect, makeRefs, } from "../internal.js";
|
4
4
|
import { Schema } from "@effect/schema";
|
5
5
|
export class CoList extends Array {
|
6
|
+
static Of(item) {
|
7
|
+
var _b, _c;
|
8
|
+
return _c = class CoListOf extends _a {
|
9
|
+
constructor() {
|
10
|
+
super(...arguments);
|
11
|
+
this[_b] = item;
|
12
|
+
}
|
13
|
+
},
|
14
|
+
_b = val.items,
|
15
|
+
_c;
|
16
|
+
}
|
17
|
+
/** @deprecated Use UPPERCASE `CoList.Of` instead! */
|
18
|
+
static of(..._args) {
|
19
|
+
throw new Error("Can't use Array.of with CoLists");
|
20
|
+
}
|
6
21
|
get _encoding() {
|
7
22
|
return this.constructor._encoding;
|
8
23
|
}
|
@@ -12,7 +27,7 @@ export class CoList extends Array {
|
|
12
27
|
: Group.fromRaw(this._raw.group);
|
13
28
|
}
|
14
29
|
get _refs() {
|
15
|
-
return makeRefs((idx) => this._raw.get(idx), () => Array.from({ length: this._raw.entries().length }, (_, idx) => idx), this._loadedAs, (_idx) => this._encoding
|
30
|
+
return makeRefs((idx) => this._raw.get(idx), () => Array.from({ length: this._raw.entries().length }, (_, idx) => idx), this._loadedAs, (_idx) => this._encoding[ItemsSym]);
|
16
31
|
}
|
17
32
|
get _edits() {
|
18
33
|
throw new Error("Not implemented");
|
@@ -20,56 +35,39 @@ export class CoList extends Array {
|
|
20
35
|
get _loadedAs() {
|
21
36
|
return Account.fromNode(this._raw.core.node);
|
22
37
|
}
|
38
|
+
static get [Symbol.species]() {
|
39
|
+
return Array;
|
40
|
+
}
|
23
41
|
constructor(init, options) {
|
24
|
-
if (typeof init === "number") {
|
25
|
-
// this might be called from an intrinsic, like map, trying to create an empty array
|
26
|
-
// passing `0` as the only parameter
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
28
|
-
return new Array(init);
|
29
|
-
}
|
30
42
|
super();
|
31
43
|
if (!options) {
|
32
44
|
throw new Error("Must provide options");
|
33
45
|
}
|
34
|
-
|
35
|
-
|
36
|
-
|
46
|
+
if (init && "owner" in options) {
|
47
|
+
this[InitValues] = {
|
48
|
+
init,
|
49
|
+
owner: options.owner,
|
50
|
+
};
|
37
51
|
}
|
38
|
-
else {
|
39
|
-
|
40
|
-
|
41
|
-
|
52
|
+
else if ("fromRaw" in options) {
|
53
|
+
Object.defineProperties(this, {
|
54
|
+
id: {
|
55
|
+
value: options.fromRaw.id,
|
56
|
+
enumerable: false,
|
57
|
+
},
|
58
|
+
_raw: { value: options.fromRaw, enumerable: false },
|
59
|
+
});
|
42
60
|
}
|
43
|
-
|
44
|
-
id: {
|
45
|
-
value: raw.id,
|
46
|
-
enumerable: false,
|
47
|
-
},
|
48
|
-
_raw: { value: raw, enumerable: false },
|
49
|
-
});
|
50
|
-
return new Proxy(this, CoListProxyHandler(this._encoding._item));
|
51
|
-
}
|
52
|
-
toRawItems(items) {
|
53
|
-
const itemDescriptor = this._encoding._item;
|
54
|
-
const rawItems = itemDescriptor === "json"
|
55
|
-
? items
|
56
|
-
: "encoded" in itemDescriptor
|
57
|
-
? items?.map((e) => Schema.encodeSync(itemDescriptor.encoded)(e))
|
58
|
-
: "ref" in itemDescriptor
|
59
|
-
? items?.map((v) => v.id)
|
60
|
-
: (() => {
|
61
|
-
throw new Error("Invalid element descriptor");
|
62
|
-
})();
|
63
|
-
return rawItems;
|
61
|
+
return new Proxy(this, CoListProxyHandler);
|
64
62
|
}
|
65
63
|
push(...items) {
|
66
|
-
for (const item of
|
64
|
+
for (const item of toRawItems(items, this._encoding[ItemsSym])) {
|
67
65
|
this._raw.append(item);
|
68
66
|
}
|
69
67
|
return this._raw.entries().length;
|
70
68
|
}
|
71
69
|
unshift(...items) {
|
72
|
-
for (const item of
|
70
|
+
for (const item of toRawItems(items, this._encoding[ItemsSym])) {
|
73
71
|
this._raw.prepend(item);
|
74
72
|
}
|
75
73
|
return this._raw.entries().length;
|
@@ -90,14 +88,14 @@ export class CoList extends Array {
|
|
90
88
|
this._raw.delete(idxToDelete);
|
91
89
|
}
|
92
90
|
let appendAfter = start;
|
93
|
-
for (const item of
|
91
|
+
for (const item of toRawItems(items, this._encoding[ItemsSym])) {
|
94
92
|
this._raw.append(item, appendAfter);
|
95
93
|
appendAfter++;
|
96
94
|
}
|
97
95
|
return deleted;
|
98
96
|
}
|
99
97
|
toJSON() {
|
100
|
-
const itemDescriptor = this._encoding
|
98
|
+
const itemDescriptor = this._encoding[ItemsSym];
|
101
99
|
if (itemDescriptor === "json") {
|
102
100
|
return this._raw.asArray();
|
103
101
|
}
|
@@ -138,59 +136,111 @@ CoList.loadEf = CoValueBase.loadEf;
|
|
138
136
|
CoList.load = CoValueBase.load;
|
139
137
|
CoList.subscribeEf = CoValueBase.subscribeEf;
|
140
138
|
CoList.subscribe = CoValueBase.subscribe;
|
141
|
-
function
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
139
|
+
function toRawItems(items, itemDescriptor) {
|
140
|
+
const rawItems = itemDescriptor === "json"
|
141
|
+
? items
|
142
|
+
: "encoded" in itemDescriptor
|
143
|
+
? items?.map((e) => Schema.encodeSync(itemDescriptor.encoded)(e))
|
144
|
+
: "ref" in itemDescriptor
|
145
|
+
? items?.map((v) => v.id)
|
146
|
+
: (() => {
|
147
|
+
throw new Error("Invalid element descriptor");
|
148
|
+
})();
|
149
|
+
return rawItems;
|
150
|
+
}
|
151
|
+
function init(list) {
|
152
|
+
if (list[InitValues]) {
|
153
|
+
const { init, owner } = list[InitValues];
|
154
|
+
const raw = owner._raw.createList(toRawItems(init, list._encoding[ItemsSym]));
|
155
|
+
Object.defineProperties(list, {
|
156
|
+
id: {
|
157
|
+
value: raw.id,
|
158
|
+
enumerable: false,
|
159
|
+
},
|
160
|
+
_raw: { value: raw, enumerable: false },
|
161
|
+
});
|
162
|
+
delete list[InitValues];
|
163
|
+
}
|
164
|
+
}
|
165
|
+
const CoListProxyHandler = {
|
166
|
+
get(target, key, receiver) {
|
167
|
+
if (typeof key === "string" && !isNaN(+key)) {
|
168
|
+
const itemDescriptor = target._encoding[ItemsSym];
|
169
|
+
const rawValue = target._raw.get(Number(key));
|
170
|
+
if (itemDescriptor === "json") {
|
171
|
+
return rawValue;
|
162
172
|
}
|
163
|
-
else {
|
164
|
-
return
|
173
|
+
else if ("encoded" in itemDescriptor) {
|
174
|
+
return rawValue === undefined
|
175
|
+
? undefined
|
176
|
+
: Schema.decodeSync(itemDescriptor.encoded)(rawValue);
|
165
177
|
}
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
if (itemDescriptor === "json") {
|
171
|
-
rawValue = value;
|
172
|
-
}
|
173
|
-
else if ("encoded" in itemDescriptor) {
|
174
|
-
rawValue = Schema.encodeSync(itemDescriptor.encoded)(value);
|
175
|
-
}
|
176
|
-
else if ("ref" in itemDescriptor) {
|
177
|
-
rawValue = value.id;
|
178
|
-
}
|
179
|
-
target._raw.replace(Number(key), rawValue);
|
180
|
-
return true;
|
178
|
+
else if ("ref" in itemDescriptor) {
|
179
|
+
return rawValue === undefined
|
180
|
+
? undefined
|
181
|
+
: new Ref(rawValue, target._loadedAs, itemDescriptor).accessFrom(receiver);
|
181
182
|
}
|
182
|
-
|
183
|
-
|
183
|
+
}
|
184
|
+
else if (key === "length") {
|
185
|
+
return target._raw.entries().length;
|
186
|
+
}
|
187
|
+
else {
|
188
|
+
return Reflect.get(target, key, receiver);
|
189
|
+
}
|
190
|
+
},
|
191
|
+
set(target, key, value, receiver) {
|
192
|
+
var _b;
|
193
|
+
if (key === ItemsSym &&
|
194
|
+
typeof value === "object" &&
|
195
|
+
SchemaInit in value) {
|
196
|
+
(_b = target.constructor)._encoding || (_b._encoding = {});
|
197
|
+
target.constructor._encoding[ItemsSym] =
|
198
|
+
value[SchemaInit];
|
199
|
+
init(target);
|
200
|
+
return true;
|
201
|
+
}
|
202
|
+
if (typeof key === "string" && !isNaN(+key)) {
|
203
|
+
const itemDescriptor = target._encoding[ItemsSym];
|
204
|
+
let rawValue;
|
205
|
+
if (itemDescriptor === "json") {
|
206
|
+
rawValue = value;
|
184
207
|
}
|
185
|
-
|
186
|
-
|
187
|
-
if (typeof key === "string" && !isNaN(+key)) {
|
188
|
-
return Number(key) < target._raw.entries().length;
|
208
|
+
else if ("encoded" in itemDescriptor) {
|
209
|
+
rawValue = Schema.encodeSync(itemDescriptor.encoded)(value);
|
189
210
|
}
|
190
|
-
else {
|
191
|
-
|
211
|
+
else if ("ref" in itemDescriptor) {
|
212
|
+
rawValue = value.id;
|
192
213
|
}
|
193
|
-
|
194
|
-
|
195
|
-
}
|
214
|
+
target._raw.replace(Number(key), rawValue);
|
215
|
+
return true;
|
216
|
+
}
|
217
|
+
else {
|
218
|
+
return Reflect.set(target, key, value, receiver);
|
219
|
+
}
|
220
|
+
},
|
221
|
+
defineProperty(target, key, descriptor) {
|
222
|
+
var _b;
|
223
|
+
if (descriptor.value &&
|
224
|
+
key === ItemsSym &&
|
225
|
+
typeof descriptor.value === "object" &&
|
226
|
+
SchemaInit in descriptor.value) {
|
227
|
+
(_b = target.constructor)._encoding || (_b._encoding = {});
|
228
|
+
target.constructor._encoding[ItemsSym] =
|
229
|
+
descriptor.value[SchemaInit];
|
230
|
+
init(target);
|
231
|
+
return true;
|
232
|
+
}
|
233
|
+
else {
|
234
|
+
return Reflect.defineProperty(target, key, descriptor);
|
235
|
+
}
|
236
|
+
},
|
237
|
+
has(target, key) {
|
238
|
+
if (typeof key === "string" && !isNaN(+key)) {
|
239
|
+
return Number(key) < target._raw.entries().length;
|
240
|
+
}
|
241
|
+
else {
|
242
|
+
return Reflect.has(target, key);
|
243
|
+
}
|
244
|
+
},
|
245
|
+
};
|
196
246
|
//# sourceMappingURL=coList.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;
|
1
|
+
{"version":3,"file":"coList.js","sourceRoot":"","sources":["../../src/coValues/coList.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAcpC,OAAO,EACH,OAAO,EACP,WAAW,EACX,KAAK,EACL,UAAU,EACV,QAAQ,EACR,GAAG,EACH,UAAU,EACV,GAAG,EACH,OAAO,EACP,QAAQ,GACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,MAAM,OAAO,MACT,SAAQ,KAAW;IAGnB,MAAM,CAAC,EAAE,CACL,IAAuB;;QAEvB,YAAO,MAAM,QAAS,SAAQ,EAAY;gBAAnC;;oBACH,QAAW,GAAG,IAAI,CAAC;gBACvB,CAAC;aAAA;iBADI,GAAG,CAAC,KAAK;eACZ;IACN,CAAC;IAED,qDAAqD;IACrD,MAAM,CAAC,EAAE,CAAC,GAAG,KAAY;QACrB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;IACvD,CAAC;IAYD,IAAI,SAAS;QAGT,OAAQ,IAAI,CAAC,WAA6B,CAAC,SAAS,CAAC;IACzD,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,YAAY,UAAU;YACxC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;YAClC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK;QAUL,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