easy-signal 4.1.3 → 4.1.4
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/.vscode/settings.json +6 -0
- package/README.md +1 -0
- package/dist/debounce.js +3 -3
- package/dist/debounce.js.map +1 -1
- package/dist/store.js +11 -13
- package/dist/store.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +1 -1
- package/src/debounce.ts +4 -4
- package/src/index.ts +0 -1
- package/src/store.ts +15 -15
- package/src/types.ts +4 -2
- package/dist/atom.d.ts +0 -40
- package/dist/atom.js +0 -132
- package/dist/atom.js.map +0 -1
package/README.md
CHANGED
|
@@ -141,6 +141,7 @@ subscribes to know when they are changed so that the function may be rerun.
|
|
|
141
141
|
|
|
142
142
|
Note that easy-signal provides 3 simple debounce functions to make it easy to have effects happen less often while still
|
|
143
143
|
allowing the stores to always be accurate:
|
|
144
|
+
|
|
144
145
|
- `onAnimationFrame`
|
|
145
146
|
- `onTick`
|
|
146
147
|
- `onTimeout`
|
package/dist/debounce.js
CHANGED
|
@@ -12,9 +12,9 @@ function debounce(scheduler, fn, ...args) {
|
|
|
12
12
|
nextArgs = args;
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
const tick =
|
|
16
|
-
const timeout =
|
|
17
|
-
const frame =
|
|
15
|
+
const tick = callback => Promise.resolve().then(callback);
|
|
16
|
+
const timeout = callback => setTimeout(callback);
|
|
17
|
+
const frame = callback => requestAnimationFrame(callback);
|
|
18
18
|
/**
|
|
19
19
|
* A function to debounce the execution of a function until the next microtask.
|
|
20
20
|
*/
|
package/dist/debounce.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"debounce.js","sourceRoot":"","sources":["../src/debounce.ts"],"names":[],"mappings":"AAEA,SAAS,QAAQ,CAAqC,SAAoB,EAAE,EAAK,EAAE,GAAG,IAAW;IAC/F,IAAI,QAAe,CAAC;IAEpB,OAAO,CAAC,CAAC,GAA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K;IAC9D,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAqC,EAAK,EAAE,KAAc;IACjF,OAAO,QAAQ,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAqC,EAAK;IACxE,OAAO,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/store.js
CHANGED
|
@@ -88,11 +88,7 @@ export function writable(value, start = noop) {
|
|
|
88
88
|
*/
|
|
89
89
|
export function observe(fn) {
|
|
90
90
|
const store = derived(fn);
|
|
91
|
-
|
|
92
|
-
if (store.get() instanceof Promise) {
|
|
93
|
-
throw new Error('observe() should not be used with async methods (it won’t update when dependant stores change).');
|
|
94
|
-
}
|
|
95
|
-
return unsubscribe;
|
|
91
|
+
return store.subscribe(noop);
|
|
96
92
|
}
|
|
97
93
|
/**
|
|
98
94
|
* Create a `Readable` store that derives its value from other stores and updates when those stores change.
|
|
@@ -106,9 +102,9 @@ export function derived(fn, value) {
|
|
|
106
102
|
const invalidate = () => {
|
|
107
103
|
pending++;
|
|
108
104
|
// Ensure derived stores that have multiple overlapping dependencies only trigger once after others
|
|
109
|
-
forExistsInBoth(subscribers, root.subscriberQueue, subscriber => {
|
|
105
|
+
forExistsInBoth(subscribers, new Map(root.subscriberQueue), subscriber => {
|
|
110
106
|
// move to the end of the queue
|
|
111
|
-
const value = root.subscriberQueue.
|
|
107
|
+
const value = root.subscriberQueue.get(subscriber);
|
|
112
108
|
root.subscriberQueue.delete(subscriber);
|
|
113
109
|
root.subscriberQueue.set(subscriber, value);
|
|
114
110
|
});
|
|
@@ -120,6 +116,9 @@ export function derived(fn, value) {
|
|
|
120
116
|
try {
|
|
121
117
|
// Run the effect collecting all the unsubscribes from the signals that are called when it is run
|
|
122
118
|
value = fn(value);
|
|
119
|
+
if (value instanceof Promise) {
|
|
120
|
+
throw new Error('derived() should not be used with async methods (it won’t update when dependant stores change).');
|
|
121
|
+
}
|
|
123
122
|
}
|
|
124
123
|
finally {
|
|
125
124
|
// Filter out unchanged unsubscribes, leaving only those which no longer apply
|
|
@@ -157,7 +156,7 @@ export function whenReadable(store) {
|
|
|
157
156
|
*/
|
|
158
157
|
export function whenMatches(store, matches) {
|
|
159
158
|
return {
|
|
160
|
-
then: (
|
|
159
|
+
then: (resolve) => {
|
|
161
160
|
const value = store.get();
|
|
162
161
|
if (matches(value))
|
|
163
162
|
return resolve(value);
|
|
@@ -167,7 +166,7 @@ export function whenMatches(store, matches) {
|
|
|
167
166
|
unsubscribe();
|
|
168
167
|
resolve(value);
|
|
169
168
|
});
|
|
170
|
-
}
|
|
169
|
+
},
|
|
171
170
|
catch() { },
|
|
172
171
|
finally() { },
|
|
173
172
|
};
|
|
@@ -180,7 +179,7 @@ export function afterChange(store) {
|
|
|
180
179
|
let init = true;
|
|
181
180
|
const unsubscribe = store.subscribe(value => {
|
|
182
181
|
if (init)
|
|
183
|
-
return init = false;
|
|
182
|
+
return (init = false);
|
|
184
183
|
unsubscribe();
|
|
185
184
|
resolve(value);
|
|
186
185
|
});
|
|
@@ -203,8 +202,7 @@ function queue(fn, batch) {
|
|
|
203
202
|
}
|
|
204
203
|
}
|
|
205
204
|
function forExistsInBoth(a, b, fn) {
|
|
206
|
-
const
|
|
207
|
-
|
|
208
|
-
smallest.forEach((_, key) => other.has(key) && fn(key));
|
|
205
|
+
const [smaller, larger] = a.size <= b.size ? [a, b] : [b, a];
|
|
206
|
+
smaller.forEach((_, key) => larger.has(key) && fn(key));
|
|
209
207
|
}
|
|
210
208
|
//# sourceMappingURL=store.js.map
|
package/dist/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAyCA,MAAM,IAAI,GAAG,GAAG,EAAE,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,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,CAAC"}
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
package/src/debounce.ts
CHANGED
|
@@ -16,9 +16,9 @@ function debounce<T extends (...args: any[]) => void>(scheduler: Scheduler, fn:
|
|
|
16
16
|
}) as T;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
const tick: Scheduler =
|
|
20
|
-
const timeout: Scheduler =
|
|
21
|
-
const frame: Scheduler =
|
|
19
|
+
const tick: Scheduler = callback => Promise.resolve().then(callback);
|
|
20
|
+
const timeout: Scheduler = callback => setTimeout(callback);
|
|
21
|
+
const frame: Scheduler = callback => requestAnimationFrame(callback);
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* A function to debounce the execution of a function until the next microtask.
|
|
@@ -31,7 +31,7 @@ export function onTick<T extends (...args: any[]) => void>(fn: T): T {
|
|
|
31
31
|
* A function to debounce the execution of a function until the next setTimeout(..., 0).
|
|
32
32
|
*/
|
|
33
33
|
export function onTimeout<T extends (...args: any[]) => void>(fn: T, delay?: number): T {
|
|
34
|
-
|
|
34
|
+
return debounce(timeout, fn, delay);
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
package/src/index.ts
CHANGED
package/src/store.ts
CHANGED
|
@@ -143,11 +143,7 @@ export function writable<T>(value: T, start: StartStopNotifier<T> = noop): Writa
|
|
|
143
143
|
*/
|
|
144
144
|
export function observe<T>(fn: () => T): Unsubscriber {
|
|
145
145
|
const store = derived(fn);
|
|
146
|
-
|
|
147
|
-
if (store.get() instanceof Promise) {
|
|
148
|
-
throw new Error('observe() should not be used with async methods (it won’t update when dependant stores change).');
|
|
149
|
-
}
|
|
150
|
-
return unsubscribe;
|
|
146
|
+
return store.subscribe(noop);
|
|
151
147
|
}
|
|
152
148
|
|
|
153
149
|
/**
|
|
@@ -163,9 +159,9 @@ export function derived<T>(fn: (priorValue: T) => T, value?: T): Readable<T> {
|
|
|
163
159
|
const invalidate = () => {
|
|
164
160
|
pending++;
|
|
165
161
|
// Ensure derived stores that have multiple overlapping dependencies only trigger once after others
|
|
166
|
-
forExistsInBoth(subscribers, root.subscriberQueue, subscriber => {
|
|
162
|
+
forExistsInBoth(subscribers, new Map(root.subscriberQueue), subscriber => {
|
|
167
163
|
// move to the end of the queue
|
|
168
|
-
const value = root.subscriberQueue.
|
|
164
|
+
const value = root.subscriberQueue.get(subscriber);
|
|
169
165
|
root.subscriberQueue.delete(subscriber);
|
|
170
166
|
root.subscriberQueue.set(subscriber, value);
|
|
171
167
|
});
|
|
@@ -180,6 +176,11 @@ export function derived<T>(fn: (priorValue: T) => T, value?: T): Readable<T> {
|
|
|
180
176
|
try {
|
|
181
177
|
// Run the effect collecting all the unsubscribes from the signals that are called when it is run
|
|
182
178
|
value = fn(value);
|
|
179
|
+
if (value instanceof Promise) {
|
|
180
|
+
throw new Error(
|
|
181
|
+
'derived() should not be used with async methods (it won’t update when dependant stores change).'
|
|
182
|
+
);
|
|
183
|
+
}
|
|
183
184
|
} finally {
|
|
184
185
|
// Filter out unchanged unsubscribes, leaving only those which no longer apply
|
|
185
186
|
root.context.unsubscribes.forEach(u => unsubscribes.delete(u));
|
|
@@ -224,7 +225,7 @@ export function whenReadable<T>(store: Readable<T>): Promise<T> {
|
|
|
224
225
|
*/
|
|
225
226
|
export function whenMatches<T>(store: Readable<T>, matches: (value: T) => boolean): Promise<T> {
|
|
226
227
|
return {
|
|
227
|
-
then: (
|
|
228
|
+
then: (resolve: (value: T) => any) => {
|
|
228
229
|
const value = store.get();
|
|
229
230
|
if (matches(value)) return resolve(value);
|
|
230
231
|
const unsubscribe = store.subscribe(value => {
|
|
@@ -232,9 +233,9 @@ export function whenMatches<T>(store: Readable<T>, matches: (value: T) => boolea
|
|
|
232
233
|
unsubscribe();
|
|
233
234
|
resolve(value);
|
|
234
235
|
});
|
|
235
|
-
}
|
|
236
|
-
catch(){},
|
|
237
|
-
finally(){},
|
|
236
|
+
},
|
|
237
|
+
catch() {},
|
|
238
|
+
finally() {},
|
|
238
239
|
} as Promise<T>;
|
|
239
240
|
}
|
|
240
241
|
|
|
@@ -245,7 +246,7 @@ export function afterChange<T>(store: Readable<T>): Promise<T> {
|
|
|
245
246
|
return new Promise(resolve => {
|
|
246
247
|
let init = true;
|
|
247
248
|
const unsubscribe = store.subscribe(value => {
|
|
248
|
-
if (init) return init = false;
|
|
249
|
+
if (init) return (init = false);
|
|
249
250
|
unsubscribe();
|
|
250
251
|
resolve(value);
|
|
251
252
|
});
|
|
@@ -272,7 +273,6 @@ function queue(fn: () => void, batch?: boolean) {
|
|
|
272
273
|
}
|
|
273
274
|
|
|
274
275
|
function forExistsInBoth<T>(a: Map<T, any>, b: Map<T, any>, fn: (value: T) => void) {
|
|
275
|
-
const
|
|
276
|
-
|
|
277
|
-
smallest.forEach((_, key) => other.has(key) && fn(key));
|
|
276
|
+
const [smaller, larger] = a.size <= b.size ? [a, b] : [b, a];
|
|
277
|
+
smaller.forEach((_, key) => larger.has(key) && fn(key));
|
|
278
278
|
}
|
package/src/types.ts
CHANGED
package/dist/atom.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Subscriber, Unsubscriber } from './types';
|
|
2
|
-
export type Invalidator = () => void;
|
|
3
|
-
export type StartStopNotifier<T> = (set: Atom<T>) => Unsubscriber | void;
|
|
4
|
-
export type { Subscriber, Unsubscriber };
|
|
5
|
-
export interface Derived<T> {
|
|
6
|
-
/**
|
|
7
|
-
* Return the current value.
|
|
8
|
-
*/
|
|
9
|
-
(): T;
|
|
10
|
-
/**
|
|
11
|
-
* Subscribe to changes with a callback. Returns an unsubscribe function.
|
|
12
|
-
*/
|
|
13
|
-
subscribe(callback: Subscriber<T>): Unsubscriber;
|
|
14
|
-
}
|
|
15
|
-
export interface Atom<T> extends Derived<T> {
|
|
16
|
-
/**
|
|
17
|
-
* Set the value and inform subscribers.
|
|
18
|
-
*/
|
|
19
|
-
(value: T): void;
|
|
20
|
-
/**
|
|
21
|
-
* @deprecated use atom(value) instead, kept for Svelte 3 compatibility (e.g. $store = value)
|
|
22
|
-
*/
|
|
23
|
-
set(value: T): void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Creates a `Readable` atom that allows reading by subscription.
|
|
27
|
-
*/
|
|
28
|
-
export declare function readable<T>(value?: T, start?: StartStopNotifier<T>): Derived<T>;
|
|
29
|
-
/**
|
|
30
|
-
* Create a `Writable` atom that allows both updating and reading by subscription.
|
|
31
|
-
*/
|
|
32
|
-
export declare function atom<T>(value: T, start?: StartStopNotifier<T>): Atom<T>;
|
|
33
|
-
/**
|
|
34
|
-
* Observe atoms and derived values by synchronizing one or more readable atoms within an aggregation function.
|
|
35
|
-
*/
|
|
36
|
-
export declare function observe<T>(fn: () => T): Unsubscriber;
|
|
37
|
-
/**
|
|
38
|
-
* Create a `Readable` atom that derives its value from other atoms and updates when those atoms change.
|
|
39
|
-
*/
|
|
40
|
-
export declare function derived<T>(fn: (priorValue: T) => T, value?: T): Derived<T>;
|
package/dist/atom.js
DELETED
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
const noop = () => { };
|
|
2
|
-
// Ensure 2 versions of the signal library can work together
|
|
3
|
-
const symbol = Symbol.for('reactiveAtoms');
|
|
4
|
-
const root = globalThis[symbol] ||
|
|
5
|
-
(globalThis[symbol] = {
|
|
6
|
-
context: null,
|
|
7
|
-
subscriberQueue: new Map(),
|
|
8
|
-
});
|
|
9
|
-
/**
|
|
10
|
-
* Creates a `Readable` atom that allows reading by subscription.
|
|
11
|
-
*/
|
|
12
|
-
export function readable(value, start) {
|
|
13
|
-
const core = atom(value, start);
|
|
14
|
-
const readable = () => core();
|
|
15
|
-
return Object.assign(readable, { subscribe: core.subscribe });
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Create a `Writable` atom that allows both updating and reading by subscription.
|
|
19
|
-
*/
|
|
20
|
-
export function atom(value, start = noop) {
|
|
21
|
-
let stop;
|
|
22
|
-
let started = false;
|
|
23
|
-
const subscribers = new Map();
|
|
24
|
-
function atom(newValue) {
|
|
25
|
-
if (newValue === undefined) {
|
|
26
|
-
if (root.context) {
|
|
27
|
-
const { subscriber, unsubscribes, invalidate } = root.context;
|
|
28
|
-
const unsubscribe = subscribe(subscriber, invalidate);
|
|
29
|
-
unsubscribes.add(unsubscribe);
|
|
30
|
-
}
|
|
31
|
-
if (!subscribers.size && !started) {
|
|
32
|
-
started = true;
|
|
33
|
-
try {
|
|
34
|
-
(start(atom) || noop)();
|
|
35
|
-
}
|
|
36
|
-
finally {
|
|
37
|
-
started = false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return value;
|
|
41
|
-
}
|
|
42
|
-
else if (value !== newValue) {
|
|
43
|
-
value = newValue;
|
|
44
|
-
if (stop) {
|
|
45
|
-
// atom is ready
|
|
46
|
-
const runQueue = !root.subscriberQueue.size;
|
|
47
|
-
subscribers.forEach(([, invalidate], subscriber) => {
|
|
48
|
-
if (!root.subscriberQueue.has(subscriber)) {
|
|
49
|
-
if (invalidate)
|
|
50
|
-
invalidate();
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
// move to the end of the queue
|
|
54
|
-
root.subscriberQueue.delete(subscriber);
|
|
55
|
-
}
|
|
56
|
-
root.subscriberQueue.set(subscriber, value);
|
|
57
|
-
});
|
|
58
|
-
if (runQueue) {
|
|
59
|
-
const iter = root.subscriberQueue.entries();
|
|
60
|
-
while (root.subscriberQueue.size > 0) {
|
|
61
|
-
const [subscriber, value] = iter.next().value;
|
|
62
|
-
root.subscriberQueue.delete(subscriber);
|
|
63
|
-
subscriber(value);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function subscribe(subscriber, invalidate) {
|
|
70
|
-
let unsubscribe = subscribers.get(subscriber)?.[0];
|
|
71
|
-
// If already subscribed, return the existing unsubscribe function
|
|
72
|
-
if (unsubscribe)
|
|
73
|
-
return unsubscribe;
|
|
74
|
-
unsubscribe = () => {
|
|
75
|
-
subscribers.delete(subscriber);
|
|
76
|
-
if (subscribers.size === 0) {
|
|
77
|
-
stop();
|
|
78
|
-
stop = null;
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
subscribers.set(subscriber, [unsubscribe, invalidate]);
|
|
82
|
-
if (subscribers.size === 1) {
|
|
83
|
-
stop = start(atom) || noop;
|
|
84
|
-
}
|
|
85
|
-
// If invalidate is provided, this comes from a derived atom and we should not call the subscriber immediately
|
|
86
|
-
if (!invalidate) {
|
|
87
|
-
subscriber(value);
|
|
88
|
-
}
|
|
89
|
-
return unsubscribe;
|
|
90
|
-
}
|
|
91
|
-
return Object.assign(atom, { subscribe, set: (value) => atom(value) });
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Observe atoms and derived values by synchronizing one or more readable atoms within an aggregation function.
|
|
95
|
-
*/
|
|
96
|
-
export function observe(fn) {
|
|
97
|
-
return derived(fn).subscribe(noop);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Create a `Readable` atom that derives its value from other atoms and updates when those atoms change.
|
|
101
|
-
*/
|
|
102
|
-
export function derived(fn, value) {
|
|
103
|
-
let unsubscribes = new Set();
|
|
104
|
-
return readable(value, set => {
|
|
105
|
-
let pending = 0;
|
|
106
|
-
const subscriber = () => --pending === 0 && sync();
|
|
107
|
-
const invalidate = () => pending++;
|
|
108
|
-
const sync = () => {
|
|
109
|
-
const prior = root.context;
|
|
110
|
-
// Set the context for the derived function
|
|
111
|
-
root.context = { subscriber, invalidate, unsubscribes: new Set() };
|
|
112
|
-
try {
|
|
113
|
-
// Run the effect collecting all the unsubscribes from the signals that are called when it is run
|
|
114
|
-
value = fn(value);
|
|
115
|
-
}
|
|
116
|
-
finally {
|
|
117
|
-
// Filter out unchanged unsubscribes, leaving only those which no longer apply
|
|
118
|
-
root.context.unsubscribes.forEach(u => unsubscribes.delete(u));
|
|
119
|
-
// Unsubscribe from all the signals that are no longer needed
|
|
120
|
-
unsubscribes.forEach(u => u());
|
|
121
|
-
// Set the new unsubscribes
|
|
122
|
-
unsubscribes = root.context.unsubscribes;
|
|
123
|
-
// Clear the context
|
|
124
|
-
root.context = prior;
|
|
125
|
-
}
|
|
126
|
-
set(value);
|
|
127
|
-
};
|
|
128
|
-
sync();
|
|
129
|
-
return () => unsubscribes.forEach(u => u());
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
//# sourceMappingURL=atom.js.map
|
package/dist/atom.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"atom.js","sourceRoot":"","sources":["../src/atom.ts"],"names":[],"mappings":"AAwCA,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AACtB,4DAA4D;AAC5D,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;AAC3C,MAAM,IAAI,GACR,UAAU,CAAC,MAAM,CAAC;IAClB,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG;QACpB,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,IAAI,GAAG,EAAE;KAC3B,CAAC,CAAC;AAEL;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAI,KAAS,EAAE,KAA4B;IACjE,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC;IAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAA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