@vworlds/vecs 1.0.3 → 1.0.5
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 +153 -14
- package/dist/component.d.ts +5 -0
- package/dist/component.js +5 -0
- package/dist/component.js.map +1 -1
- package/dist/dsl.d.ts +71 -0
- package/dist/dsl.js +58 -0
- package/dist/dsl.js.map +1 -0
- package/dist/entity.d.ts +29 -10
- package/dist/entity.js +50 -24
- package/dist/entity.js.map +1 -1
- package/dist/filter.d.ts +59 -0
- package/dist/filter.js +53 -0
- package/dist/filter.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/query.d.ts +217 -0
- package/dist/query.js +238 -0
- package/dist/query.js.map +1 -0
- package/dist/system.d.ts +16 -169
- package/dist/system.js +49 -198
- package/dist/system.js.map +1 -1
- package/dist/world.d.ts +88 -29
- package/dist/world.js +87 -54
- package/dist/world.js.map +1 -1
- package/package.json +1 -1
package/dist/world.d.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import { Component, ComponentClassOrType, ComponentMeta, Hook } from "./component.js";
|
|
2
2
|
import { Entity } from "./entity.js";
|
|
3
|
+
import { Query } from "./query.js";
|
|
3
4
|
import { System } from "./system.js";
|
|
5
|
+
import { Filter } from "./filter.js";
|
|
6
|
+
import { type QueryDSL, type ExtractRequired } from "./dsl.js";
|
|
4
7
|
import { IPhase } from "./phase.js";
|
|
5
8
|
/**
|
|
6
9
|
* The central ECS container.
|
|
7
10
|
*
|
|
8
|
-
* A `World` owns all entities, components, systems, and the update
|
|
9
|
-
* Typical lifecycle:
|
|
11
|
+
* A `World` owns all entities, components, systems, queries, and the update
|
|
12
|
+
* pipeline. Typical lifecycle:
|
|
10
13
|
*
|
|
11
14
|
* 1. **Register components** — call {@link registerComponent} (and optionally
|
|
12
15
|
* {@link registerComponentType}) for every component class.
|
|
13
|
-
* 2. **Register systems** — call {@link system}
|
|
14
|
-
* create and configure
|
|
15
|
-
* 3. **Start** — call {@link start} to freeze registration and
|
|
16
|
-
* into their phases.
|
|
16
|
+
* 2. **Register systems and queries** — call {@link system} and {@link query}
|
|
17
|
+
* to create and configure them.
|
|
18
|
+
* 3. **Start** — call {@link start} to freeze component registration and
|
|
19
|
+
* distribute systems into their phases.
|
|
17
20
|
* 4. **Run loop** — call {@link runPhase} once per frame for each phase.
|
|
18
21
|
*
|
|
19
22
|
* ```ts
|
|
@@ -37,14 +40,12 @@ export declare class World {
|
|
|
37
40
|
private componentNameTypeMap;
|
|
38
41
|
private archChangeQueue;
|
|
39
42
|
private destroyedEntities;
|
|
40
|
-
private
|
|
41
|
-
private allSystems;
|
|
43
|
+
private allQueries;
|
|
42
44
|
private Class2Meta;
|
|
43
45
|
private Type2Meta;
|
|
44
46
|
private updatedComponents;
|
|
45
47
|
private localComponentCounter;
|
|
46
48
|
private componentRegistrationDisabled;
|
|
47
|
-
private systemRegistrationDisabled;
|
|
48
49
|
private pipeline;
|
|
49
50
|
private eidCounter;
|
|
50
51
|
constructor();
|
|
@@ -96,7 +97,6 @@ export declare class World {
|
|
|
96
97
|
* @throws If called after registration has been disabled.
|
|
97
98
|
*/
|
|
98
99
|
setEntityIdRange(min: number): void;
|
|
99
|
-
private getComponentInstance;
|
|
100
100
|
/**
|
|
101
101
|
* Retrieve the {@link ComponentMeta} record for a registered component.
|
|
102
102
|
*
|
|
@@ -167,22 +167,15 @@ export declare class World {
|
|
|
167
167
|
* @param type - The numeric type id assigned by the server.
|
|
168
168
|
*/
|
|
169
169
|
registerComponentType(componentName: string, type: number): void;
|
|
170
|
-
/**
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
*
|
|
177
|
-
* @param s - The system to add.
|
|
178
|
-
* @throws If system registration is disabled (after {@link start}).
|
|
179
|
-
*/
|
|
180
|
-
addSystem(s: System): void;
|
|
170
|
+
/** @internal Called by the {@link Query} constructor to register itself. */
|
|
171
|
+
_addQuery(q: Query): void;
|
|
172
|
+
/** @internal Called by {@link Query.destroy} to unregister a query and remove it from all entities. */
|
|
173
|
+
_removeQuery(q: Query): void;
|
|
174
|
+
/** @internal Iterate over all entities currently in the world. */
|
|
175
|
+
_forEachEntity(callback: (e: Entity) => void): void;
|
|
181
176
|
/**
|
|
182
177
|
* Create a new {@link System}, register it, and return it for configuration.
|
|
183
178
|
*
|
|
184
|
-
* This is the primary way to define systems:
|
|
185
|
-
*
|
|
186
179
|
* ```ts
|
|
187
180
|
* world.system("Render")
|
|
188
181
|
* .phase("update")
|
|
@@ -195,6 +188,57 @@ export declare class World {
|
|
|
195
188
|
* @returns The new `System` instance.
|
|
196
189
|
*/
|
|
197
190
|
system(name: string): System<[]>;
|
|
191
|
+
/**
|
|
192
|
+
* Create a standalone {@link Query}, register it, and return it for
|
|
193
|
+
* configuration.
|
|
194
|
+
*
|
|
195
|
+
* Unlike a {@link System}, a standalone query has no phase and no per-tick
|
|
196
|
+
* callbacks — it is a reactive, always-updated entity set that can be read
|
|
197
|
+
* at any time after {@link start}. Standalone queries can also be created
|
|
198
|
+
* after {@link start}; existing matched entities are backfilled immediately.
|
|
199
|
+
*
|
|
200
|
+
* ```ts
|
|
201
|
+
* const enemies = world.query("Enemies")
|
|
202
|
+
* .requires(Enemy, Health)
|
|
203
|
+
* .enter((e) => console.log("enemy spawned", e.eid));
|
|
204
|
+
*
|
|
205
|
+
* world.start();
|
|
206
|
+
* // enemies.entities is kept up-to-date automatically
|
|
207
|
+
* ```
|
|
208
|
+
*
|
|
209
|
+
* @param name - A unique display name for the query.
|
|
210
|
+
* @returns The new `Query` instance.
|
|
211
|
+
*/
|
|
212
|
+
query(name: string): Query<[]>;
|
|
213
|
+
/**
|
|
214
|
+
* Create a non-reactive {@link Filter} that matches entities satisfying `q`.
|
|
215
|
+
*
|
|
216
|
+
* Unlike {@link query}, the returned filter holds no tracked entity set and
|
|
217
|
+
* registers nothing with the world. Each call to {@link Filter.forEach} walks
|
|
218
|
+
* all current world entities and invokes the callback for matching ones.
|
|
219
|
+
*
|
|
220
|
+
* Component classes guaranteed present on every matched entity are inferred
|
|
221
|
+
* automatically from the DSL where possible (plain arrays, `HAS`, `HAS_ONLY`,
|
|
222
|
+
* and `AND` of those forms). For cases the type extractor cannot see through
|
|
223
|
+
* (`OR`, `NOT`, `PARENT`, custom `EntityTestFunc`), pass a `_guaranteed`
|
|
224
|
+
* tuple as a type-level override:
|
|
225
|
+
*
|
|
226
|
+
* ```ts
|
|
227
|
+
* // Auto-deduced — pos and vel are non-nullable
|
|
228
|
+
* world.filter([Position, Velocity])
|
|
229
|
+
* .forEach([Position, Velocity], (e, [pos, vel]) => { ... });
|
|
230
|
+
*
|
|
231
|
+
* // Manual override for an opaque query
|
|
232
|
+
* world.filter(myTestFunc, [Position])
|
|
233
|
+
* .forEach([Position], (e, [pos]) => pos.x);
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
236
|
+
* @param q - A {@link QueryDSL} expression.
|
|
237
|
+
* @param _guaranteed - Optional type hint declaring which components are
|
|
238
|
+
* guaranteed present (not validated at runtime).
|
|
239
|
+
*/
|
|
240
|
+
filter<Q extends QueryDSL>(q: Q): Filter<ExtractRequired<Q>>;
|
|
241
|
+
filter<T extends (typeof Component)[]>(q: QueryDSL, _guaranteed: readonly [...T]): Filter<T>;
|
|
198
242
|
/**
|
|
199
243
|
* Prevent any further calls to {@link registerComponent}.
|
|
200
244
|
*
|
|
@@ -203,14 +247,14 @@ export declare class World {
|
|
|
203
247
|
*/
|
|
204
248
|
disableComponentRegistration(): void;
|
|
205
249
|
/**
|
|
206
|
-
* Freeze registration and prepare the world for running.
|
|
250
|
+
* Freeze component registration and prepare the world for running.
|
|
207
251
|
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
252
|
+
* Distributes all systems registered so far into their pipeline phases
|
|
253
|
+
* (defaulting to `"update"`) and logs the phase → system order to the
|
|
254
|
+
* console. Systems and queries can still be created after this call —
|
|
255
|
+
* standalone queries will immediately backfill existing matched entities.
|
|
211
256
|
*
|
|
212
|
-
* Call this once
|
|
213
|
-
* the first {@link runPhase} call.
|
|
257
|
+
* Call this once before the first {@link runPhase} call.
|
|
214
258
|
*/
|
|
215
259
|
start(): void;
|
|
216
260
|
private reindexSystems;
|
|
@@ -269,6 +313,21 @@ export declare class World {
|
|
|
269
313
|
* @param delta - Milliseconds elapsed since the previous tick.
|
|
270
314
|
*/
|
|
271
315
|
progress(now: number, delta: number): void;
|
|
316
|
+
/**
|
|
317
|
+
* Declare a group of mutually exclusive components.
|
|
318
|
+
*
|
|
319
|
+
* After this call, adding any component in the group to an entity that
|
|
320
|
+
* already has another component from the same group will throw.
|
|
321
|
+
*
|
|
322
|
+
* ```ts
|
|
323
|
+
* world.setExclusiveComponents(Walking, Running, Idle);
|
|
324
|
+
* // entity.add(Running) throws if entity already has Walking or Idle
|
|
325
|
+
* ```
|
|
326
|
+
*
|
|
327
|
+
* @param components - Two or more component classes that cannot coexist.
|
|
328
|
+
* @throws If any class has not been registered.
|
|
329
|
+
*/
|
|
330
|
+
setExclusiveComponents(...components: (typeof Component)[]): void;
|
|
272
331
|
/**
|
|
273
332
|
* Destroy every entity currently tracked by the world.
|
|
274
333
|
*
|
package/dist/world.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { ComponentMeta, } from "./component.js";
|
|
2
2
|
import { Entity } from "./entity.js";
|
|
3
|
+
import { Query } from "./query.js";
|
|
3
4
|
import { System } from "./system.js";
|
|
5
|
+
import { Filter } from "./filter.js";
|
|
4
6
|
import { ArrayMap } from "./util/array_map.js";
|
|
5
7
|
import { Phase } from "./phase.js";
|
|
6
8
|
const LOCAL_COMPONENT_MIN = 256;
|
|
7
9
|
/**
|
|
8
10
|
* The central ECS container.
|
|
9
11
|
*
|
|
10
|
-
* A `World` owns all entities, components, systems, and the update
|
|
11
|
-
* Typical lifecycle:
|
|
12
|
+
* A `World` owns all entities, components, systems, queries, and the update
|
|
13
|
+
* pipeline. Typical lifecycle:
|
|
12
14
|
*
|
|
13
15
|
* 1. **Register components** — call {@link registerComponent} (and optionally
|
|
14
16
|
* {@link registerComponentType}) for every component class.
|
|
15
|
-
* 2. **Register systems** — call {@link system}
|
|
16
|
-
* create and configure
|
|
17
|
-
* 3. **Start** — call {@link start} to freeze registration and
|
|
18
|
-
* into their phases.
|
|
17
|
+
* 2. **Register systems and queries** — call {@link system} and {@link query}
|
|
18
|
+
* to create and configure them.
|
|
19
|
+
* 3. **Start** — call {@link start} to freeze component registration and
|
|
20
|
+
* distribute systems into their phases.
|
|
19
21
|
* 4. **Run loop** — call {@link runPhase} once per frame for each phase.
|
|
20
22
|
*
|
|
21
23
|
* ```ts
|
|
@@ -40,14 +42,12 @@ export class World {
|
|
|
40
42
|
this.componentNameTypeMap = new Map();
|
|
41
43
|
this.archChangeQueue = [];
|
|
42
44
|
this.destroyedEntities = [];
|
|
43
|
-
this.
|
|
44
|
-
this.allSystems = [];
|
|
45
|
+
this.allQueries = [];
|
|
45
46
|
this.Class2Meta = new Map();
|
|
46
47
|
this.Type2Meta = new ArrayMap();
|
|
47
48
|
this.updatedComponents = [];
|
|
48
49
|
this.localComponentCounter = LOCAL_COMPONENT_MIN;
|
|
49
50
|
this.componentRegistrationDisabled = false;
|
|
50
|
-
this.systemRegistrationDisabled = false;
|
|
51
51
|
this.pipeline = new Map();
|
|
52
52
|
this.eidCounter = 0;
|
|
53
53
|
}
|
|
@@ -119,14 +119,6 @@ export class World {
|
|
|
119
119
|
throw "setEntityIdRange must be called before component registration is disabled";
|
|
120
120
|
this.eidCounter = min;
|
|
121
121
|
}
|
|
122
|
-
getComponentInstance(typeOrClass, entity) {
|
|
123
|
-
const meta = this.getComponentMeta(typeOrClass);
|
|
124
|
-
const c = new meta.Class(entity, meta);
|
|
125
|
-
const hook = meta["onAddHandler"];
|
|
126
|
-
if (hook)
|
|
127
|
-
hook(c);
|
|
128
|
-
return c;
|
|
129
|
-
}
|
|
130
122
|
/**
|
|
131
123
|
* Retrieve the {@link ComponentMeta} record for a registered component.
|
|
132
124
|
*
|
|
@@ -197,13 +189,13 @@ export class World {
|
|
|
197
189
|
}
|
|
198
190
|
updateArchetypes() {
|
|
199
191
|
if (this.archChangeQueue.length > 0) {
|
|
200
|
-
this.
|
|
192
|
+
this.allQueries.forEach((q) => {
|
|
201
193
|
this.archChangeQueue.forEach((e) => {
|
|
202
|
-
if (
|
|
203
|
-
e.
|
|
194
|
+
if (q.belongs(e)) {
|
|
195
|
+
e._addQuery(q);
|
|
204
196
|
}
|
|
205
197
|
else {
|
|
206
|
-
e.
|
|
198
|
+
e._removeQuery(q);
|
|
207
199
|
}
|
|
208
200
|
});
|
|
209
201
|
});
|
|
@@ -223,7 +215,7 @@ export class World {
|
|
|
223
215
|
c["dirty"] = false;
|
|
224
216
|
});
|
|
225
217
|
this.archChangeQueue.forEach((e) => {
|
|
226
|
-
e.
|
|
218
|
+
e._updateQueries();
|
|
227
219
|
e._archetypeChanged = false;
|
|
228
220
|
});
|
|
229
221
|
this.archChangeQueue.length = 0;
|
|
@@ -285,26 +277,24 @@ export class World {
|
|
|
285
277
|
registerComponentType(componentName, type) {
|
|
286
278
|
this.componentNameTypeMap.set(componentName, type);
|
|
287
279
|
}
|
|
288
|
-
/**
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
this.
|
|
280
|
+
/** @internal Called by the {@link Query} constructor to register itself. */
|
|
281
|
+
_addQuery(q) {
|
|
282
|
+
this.allQueries.push(q);
|
|
283
|
+
}
|
|
284
|
+
/** @internal Called by {@link Query.destroy} to unregister a query and remove it from all entities. */
|
|
285
|
+
_removeQuery(q) {
|
|
286
|
+
const idx = this.allQueries.indexOf(q);
|
|
287
|
+
if (idx !== -1)
|
|
288
|
+
this.allQueries.splice(idx, 1);
|
|
289
|
+
this.entities.forEach((e) => e._purgeQuery(q));
|
|
290
|
+
}
|
|
291
|
+
/** @internal Iterate over all entities currently in the world. */
|
|
292
|
+
_forEachEntity(callback) {
|
|
293
|
+
this.entities.forEach(callback);
|
|
302
294
|
}
|
|
303
295
|
/**
|
|
304
296
|
* Create a new {@link System}, register it, and return it for configuration.
|
|
305
297
|
*
|
|
306
|
-
* This is the primary way to define systems:
|
|
307
|
-
*
|
|
308
298
|
* ```ts
|
|
309
299
|
* world.system("Render")
|
|
310
300
|
* .phase("update")
|
|
@@ -317,9 +307,34 @@ export class World {
|
|
|
317
307
|
* @returns The new `System` instance.
|
|
318
308
|
*/
|
|
319
309
|
system(name) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
310
|
+
return new System(name, this);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Create a standalone {@link Query}, register it, and return it for
|
|
314
|
+
* configuration.
|
|
315
|
+
*
|
|
316
|
+
* Unlike a {@link System}, a standalone query has no phase and no per-tick
|
|
317
|
+
* callbacks — it is a reactive, always-updated entity set that can be read
|
|
318
|
+
* at any time after {@link start}. Standalone queries can also be created
|
|
319
|
+
* after {@link start}; existing matched entities are backfilled immediately.
|
|
320
|
+
*
|
|
321
|
+
* ```ts
|
|
322
|
+
* const enemies = world.query("Enemies")
|
|
323
|
+
* .requires(Enemy, Health)
|
|
324
|
+
* .enter((e) => console.log("enemy spawned", e.eid));
|
|
325
|
+
*
|
|
326
|
+
* world.start();
|
|
327
|
+
* // enemies.entities is kept up-to-date automatically
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* @param name - A unique display name for the query.
|
|
331
|
+
* @returns The new `Query` instance.
|
|
332
|
+
*/
|
|
333
|
+
query(name) {
|
|
334
|
+
return new Query(name, this);
|
|
335
|
+
}
|
|
336
|
+
filter(q, _guaranteed) {
|
|
337
|
+
return new Filter(this, q);
|
|
323
338
|
}
|
|
324
339
|
/**
|
|
325
340
|
* Prevent any further calls to {@link registerComponent}.
|
|
@@ -331,18 +346,17 @@ export class World {
|
|
|
331
346
|
this.componentRegistrationDisabled = true;
|
|
332
347
|
}
|
|
333
348
|
/**
|
|
334
|
-
* Freeze registration and prepare the world for running.
|
|
349
|
+
* Freeze component registration and prepare the world for running.
|
|
335
350
|
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
351
|
+
* Distributes all systems registered so far into their pipeline phases
|
|
352
|
+
* (defaulting to `"update"`) and logs the phase → system order to the
|
|
353
|
+
* console. Systems and queries can still be created after this call —
|
|
354
|
+
* standalone queries will immediately backfill existing matched entities.
|
|
339
355
|
*
|
|
340
|
-
* Call this once
|
|
341
|
-
* the first {@link runPhase} call.
|
|
356
|
+
* Call this once before the first {@link runPhase} call.
|
|
342
357
|
*/
|
|
343
358
|
start() {
|
|
344
359
|
this.componentRegistrationDisabled = true;
|
|
345
|
-
this.systemRegistrationDisabled = true;
|
|
346
360
|
this.reindexSystems();
|
|
347
361
|
}
|
|
348
362
|
reindexSystems() {
|
|
@@ -352,18 +366,17 @@ export class World {
|
|
|
352
366
|
this.pipeline.set(_defaultPhase.name, _defaultPhase);
|
|
353
367
|
}
|
|
354
368
|
const defaultPhase = _defaultPhase;
|
|
355
|
-
this.
|
|
356
|
-
|
|
369
|
+
this.allQueries.forEach((q) => {
|
|
370
|
+
if (!(q instanceof System))
|
|
371
|
+
return;
|
|
372
|
+
let phase = q._phase;
|
|
357
373
|
if (typeof phase === "string") {
|
|
358
374
|
phase = this.pipeline.get(phase);
|
|
359
375
|
}
|
|
360
376
|
phase = phase || defaultPhase;
|
|
361
|
-
phase.systems.push(
|
|
377
|
+
phase.systems.push(q);
|
|
362
378
|
});
|
|
363
|
-
this.pendingSystems.length = 0;
|
|
364
|
-
this.allSystems.length = 0;
|
|
365
379
|
this.pipeline.forEach((phase) => {
|
|
366
|
-
this.allSystems.push(...phase.systems);
|
|
367
380
|
console.log("Phase %s : %s", phase.name, phase.systems.map((s) => s.name).join(" -> "));
|
|
368
381
|
});
|
|
369
382
|
}
|
|
@@ -437,6 +450,26 @@ export class World {
|
|
|
437
450
|
this.runPhase(phase, now, delta);
|
|
438
451
|
});
|
|
439
452
|
}
|
|
453
|
+
/**
|
|
454
|
+
* Declare a group of mutually exclusive components.
|
|
455
|
+
*
|
|
456
|
+
* After this call, adding any component in the group to an entity that
|
|
457
|
+
* already has another component from the same group will throw.
|
|
458
|
+
*
|
|
459
|
+
* ```ts
|
|
460
|
+
* world.setExclusiveComponents(Walking, Running, Idle);
|
|
461
|
+
* // entity.add(Running) throws if entity already has Walking or Idle
|
|
462
|
+
* ```
|
|
463
|
+
*
|
|
464
|
+
* @param components - Two or more component classes that cannot coexist.
|
|
465
|
+
* @throws If any class has not been registered.
|
|
466
|
+
*/
|
|
467
|
+
setExclusiveComponents(...components) {
|
|
468
|
+
const types = components.map((C) => this.getComponentType(C));
|
|
469
|
+
for (let i = 0; i < components.length; i++) {
|
|
470
|
+
this.getComponentMeta(components[i]).exclusive = types.filter((_, j) => j !== i);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
440
473
|
/**
|
|
441
474
|
* Destroy every entity currently tracked by the world.
|
|
442
475
|
*
|
package/dist/world.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"world.js","sourceRoot":"","sources":["../src/world.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,aAAa,GAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAU,KAAK,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,mBAAmB,GAAG,GAAG,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;A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