@fluidframework/presence 2.91.0 → 2.93.0

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.
Files changed (259) hide show
  1. package/README.md +4 -4
  2. package/dist/alpha.d.ts +7 -5
  3. package/dist/beta.d.ts +6 -3
  4. package/dist/getPresence.d.ts +4 -9
  5. package/dist/getPresence.d.ts.map +1 -1
  6. package/dist/getPresence.js +6 -86
  7. package/dist/getPresence.js.map +1 -1
  8. package/dist/index.d.ts +4 -13
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +8 -8
  11. package/dist/index.js.map +1 -1
  12. package/dist/legacy.alpha.d.ts +7 -5
  13. package/dist/package.json +1 -15
  14. package/dist/public.d.ts +69 -0
  15. package/lib/alpha.d.ts +7 -5
  16. package/lib/beta.d.ts +6 -3
  17. package/lib/getPresence.d.ts +4 -9
  18. package/lib/getPresence.d.ts.map +1 -1
  19. package/lib/getPresence.js +6 -85
  20. package/lib/getPresence.js.map +1 -1
  21. package/lib/index.d.ts +4 -13
  22. package/lib/index.d.ts.map +1 -1
  23. package/lib/index.js +5 -4
  24. package/lib/index.js.map +1 -1
  25. package/lib/legacy.alpha.d.ts +7 -5
  26. package/lib/public.d.ts +69 -0
  27. package/package.json +31 -80
  28. package/dist/baseTypes.d.ts +0 -24
  29. package/dist/baseTypes.d.ts.map +0 -1
  30. package/dist/baseTypes.js +0 -7
  31. package/dist/baseTypes.js.map +0 -1
  32. package/dist/broadcastControls.d.ts +0 -37
  33. package/dist/broadcastControls.d.ts.map +0 -1
  34. package/dist/broadcastControls.js +0 -60
  35. package/dist/broadcastControls.js.map +0 -1
  36. package/dist/broadcastControlsTypes.d.ts +0 -38
  37. package/dist/broadcastControlsTypes.d.ts.map +0 -1
  38. package/dist/broadcastControlsTypes.js +0 -7
  39. package/dist/broadcastControlsTypes.js.map +0 -1
  40. package/dist/exposedInternalTypes.d.ts +0 -138
  41. package/dist/exposedInternalTypes.d.ts.map +0 -1
  42. package/dist/exposedInternalTypes.js +0 -19
  43. package/dist/exposedInternalTypes.js.map +0 -1
  44. package/dist/exposedUtilityTypes.d.ts +0 -108
  45. package/dist/exposedUtilityTypes.d.ts.map +0 -1
  46. package/dist/exposedUtilityTypes.js +0 -7
  47. package/dist/exposedUtilityTypes.js.map +0 -1
  48. package/dist/internalUtils.d.ts +0 -125
  49. package/dist/internalUtils.d.ts.map +0 -1
  50. package/dist/internalUtils.js +0 -99
  51. package/dist/internalUtils.js.map +0 -1
  52. package/dist/latestMapTypes.d.ts +0 -343
  53. package/dist/latestMapTypes.d.ts.map +0 -1
  54. package/dist/latestMapTypes.js +0 -7
  55. package/dist/latestMapTypes.js.map +0 -1
  56. package/dist/latestMapValueManager.d.ts +0 -52
  57. package/dist/latestMapValueManager.d.ts.map +0 -1
  58. package/dist/latestMapValueManager.js +0 -250
  59. package/dist/latestMapValueManager.js.map +0 -1
  60. package/dist/latestTypes.d.ts +0 -183
  61. package/dist/latestTypes.d.ts.map +0 -1
  62. package/dist/latestTypes.js +0 -7
  63. package/dist/latestTypes.js.map +0 -1
  64. package/dist/latestValueManager.d.ts +0 -10
  65. package/dist/latestValueManager.d.ts.map +0 -1
  66. package/dist/latestValueManager.js +0 -117
  67. package/dist/latestValueManager.js.map +0 -1
  68. package/dist/latestValueTypes.d.ts +0 -108
  69. package/dist/latestValueTypes.d.ts.map +0 -1
  70. package/dist/latestValueTypes.js +0 -7
  71. package/dist/latestValueTypes.js.map +0 -1
  72. package/dist/notificationsManager.d.ts +0 -27
  73. package/dist/notificationsManager.d.ts.map +0 -1
  74. package/dist/notificationsManager.js +0 -98
  75. package/dist/notificationsManager.js.map +0 -1
  76. package/dist/notificationsManagerTypes.d.ts +0 -144
  77. package/dist/notificationsManagerTypes.d.ts.map +0 -1
  78. package/dist/notificationsManagerTypes.js +0 -7
  79. package/dist/notificationsManagerTypes.js.map +0 -1
  80. package/dist/packageVersion.d.ts +0 -9
  81. package/dist/packageVersion.d.ts.map +0 -1
  82. package/dist/packageVersion.js +0 -12
  83. package/dist/packageVersion.js.map +0 -1
  84. package/dist/presence.d.ts +0 -229
  85. package/dist/presence.d.ts.map +0 -1
  86. package/dist/presence.js +0 -23
  87. package/dist/presence.js.map +0 -1
  88. package/dist/presenceDatastoreManager.d.ts +0 -149
  89. package/dist/presenceDatastoreManager.d.ts.map +0 -1
  90. package/dist/presenceDatastoreManager.js +0 -667
  91. package/dist/presenceDatastoreManager.js.map +0 -1
  92. package/dist/presenceManager.d.ts +0 -16
  93. package/dist/presenceManager.d.ts.map +0 -1
  94. package/dist/presenceManager.js +0 -140
  95. package/dist/presenceManager.js.map +0 -1
  96. package/dist/presenceStates.d.ts +0 -102
  97. package/dist/presenceStates.d.ts.map +0 -1
  98. package/dist/presenceStates.js +0 -231
  99. package/dist/presenceStates.js.map +0 -1
  100. package/dist/protocol.d.ts +0 -111
  101. package/dist/protocol.d.ts.map +0 -1
  102. package/dist/protocol.js +0 -20
  103. package/dist/protocol.js.map +0 -1
  104. package/dist/runtimeTypes.d.ts +0 -26
  105. package/dist/runtimeTypes.d.ts.map +0 -1
  106. package/dist/runtimeTypes.js +0 -7
  107. package/dist/runtimeTypes.js.map +0 -1
  108. package/dist/stateDatastore.d.ts +0 -56
  109. package/dist/stateDatastore.d.ts.map +0 -1
  110. package/dist/stateDatastore.js +0 -22
  111. package/dist/stateDatastore.js.map +0 -1
  112. package/dist/stateFactory.d.ts +0 -18
  113. package/dist/stateFactory.d.ts.map +0 -1
  114. package/dist/stateFactory.js +0 -23
  115. package/dist/stateFactory.js.map +0 -1
  116. package/dist/statesManagerTypes.d.ts +0 -27
  117. package/dist/statesManagerTypes.d.ts.map +0 -1
  118. package/dist/statesManagerTypes.js +0 -7
  119. package/dist/statesManagerTypes.js.map +0 -1
  120. package/dist/systemWorkspace.d.ts +0 -58
  121. package/dist/systemWorkspace.d.ts.map +0 -1
  122. package/dist/systemWorkspace.js +0 -265
  123. package/dist/systemWorkspace.js.map +0 -1
  124. package/dist/timerManager.d.ts +0 -37
  125. package/dist/timerManager.d.ts.map +0 -1
  126. package/dist/timerManager.js +0 -65
  127. package/dist/timerManager.js.map +0 -1
  128. package/dist/types.d.ts +0 -132
  129. package/dist/types.d.ts.map +0 -1
  130. package/dist/types.js +0 -7
  131. package/dist/types.js.map +0 -1
  132. package/dist/validatableTypes.d.ts +0 -69
  133. package/dist/validatableTypes.d.ts.map +0 -1
  134. package/dist/validatableTypes.js +0 -7
  135. package/dist/validatableTypes.js.map +0 -1
  136. package/dist/validatedGetter.d.ts +0 -18
  137. package/dist/validatedGetter.d.ts.map +0 -1
  138. package/dist/validatedGetter.js +0 -43
  139. package/dist/validatedGetter.js.map +0 -1
  140. package/dist/valueManager.d.ts +0 -15
  141. package/dist/valueManager.d.ts.map +0 -1
  142. package/dist/valueManager.js +0 -22
  143. package/dist/valueManager.js.map +0 -1
  144. package/lib/baseTypes.d.ts +0 -24
  145. package/lib/baseTypes.d.ts.map +0 -1
  146. package/lib/baseTypes.js +0 -6
  147. package/lib/baseTypes.js.map +0 -1
  148. package/lib/broadcastControls.d.ts +0 -37
  149. package/lib/broadcastControls.d.ts.map +0 -1
  150. package/lib/broadcastControls.js +0 -55
  151. package/lib/broadcastControls.js.map +0 -1
  152. package/lib/broadcastControlsTypes.d.ts +0 -38
  153. package/lib/broadcastControlsTypes.d.ts.map +0 -1
  154. package/lib/broadcastControlsTypes.js +0 -6
  155. package/lib/broadcastControlsTypes.js.map +0 -1
  156. package/lib/exposedInternalTypes.d.ts +0 -138
  157. package/lib/exposedInternalTypes.d.ts.map +0 -1
  158. package/lib/exposedInternalTypes.js +0 -16
  159. package/lib/exposedInternalTypes.js.map +0 -1
  160. package/lib/exposedUtilityTypes.d.ts +0 -108
  161. package/lib/exposedUtilityTypes.d.ts.map +0 -1
  162. package/lib/exposedUtilityTypes.js +0 -6
  163. package/lib/exposedUtilityTypes.js.map +0 -1
  164. package/lib/internalUtils.d.ts +0 -125
  165. package/lib/internalUtils.d.ts.map +0 -1
  166. package/lib/internalUtils.js +0 -90
  167. package/lib/internalUtils.js.map +0 -1
  168. package/lib/latestMapTypes.d.ts +0 -343
  169. package/lib/latestMapTypes.d.ts.map +0 -1
  170. package/lib/latestMapTypes.js +0 -6
  171. package/lib/latestMapTypes.js.map +0 -1
  172. package/lib/latestMapValueManager.d.ts +0 -52
  173. package/lib/latestMapValueManager.d.ts.map +0 -1
  174. package/lib/latestMapValueManager.js +0 -246
  175. package/lib/latestMapValueManager.js.map +0 -1
  176. package/lib/latestTypes.d.ts +0 -183
  177. package/lib/latestTypes.d.ts.map +0 -1
  178. package/lib/latestTypes.js +0 -6
  179. package/lib/latestTypes.js.map +0 -1
  180. package/lib/latestValueManager.d.ts +0 -10
  181. package/lib/latestValueManager.d.ts.map +0 -1
  182. package/lib/latestValueManager.js +0 -113
  183. package/lib/latestValueManager.js.map +0 -1
  184. package/lib/latestValueTypes.d.ts +0 -108
  185. package/lib/latestValueTypes.d.ts.map +0 -1
  186. package/lib/latestValueTypes.js +0 -6
  187. package/lib/latestValueTypes.js.map +0 -1
  188. package/lib/notificationsManager.d.ts +0 -27
  189. package/lib/notificationsManager.d.ts.map +0 -1
  190. package/lib/notificationsManager.js +0 -94
  191. package/lib/notificationsManager.js.map +0 -1
  192. package/lib/notificationsManagerTypes.d.ts +0 -144
  193. package/lib/notificationsManagerTypes.d.ts.map +0 -1
  194. package/lib/notificationsManagerTypes.js +0 -6
  195. package/lib/notificationsManagerTypes.js.map +0 -1
  196. package/lib/packageVersion.d.ts +0 -9
  197. package/lib/packageVersion.d.ts.map +0 -1
  198. package/lib/packageVersion.js +0 -9
  199. package/lib/packageVersion.js.map +0 -1
  200. package/lib/presence.d.ts +0 -229
  201. package/lib/presence.d.ts.map +0 -1
  202. package/lib/presence.js +0 -20
  203. package/lib/presence.js.map +0 -1
  204. package/lib/presenceDatastoreManager.d.ts +0 -149
  205. package/lib/presenceDatastoreManager.d.ts.map +0 -1
  206. package/lib/presenceDatastoreManager.js +0 -663
  207. package/lib/presenceDatastoreManager.js.map +0 -1
  208. package/lib/presenceManager.d.ts +0 -16
  209. package/lib/presenceManager.d.ts.map +0 -1
  210. package/lib/presenceManager.js +0 -136
  211. package/lib/presenceManager.js.map +0 -1
  212. package/lib/presenceStates.d.ts +0 -102
  213. package/lib/presenceStates.d.ts.map +0 -1
  214. package/lib/presenceStates.js +0 -225
  215. package/lib/presenceStates.js.map +0 -1
  216. package/lib/protocol.d.ts +0 -111
  217. package/lib/protocol.d.ts.map +0 -1
  218. package/lib/protocol.js +0 -17
  219. package/lib/protocol.js.map +0 -1
  220. package/lib/runtimeTypes.d.ts +0 -26
  221. package/lib/runtimeTypes.d.ts.map +0 -1
  222. package/lib/runtimeTypes.js +0 -6
  223. package/lib/runtimeTypes.js.map +0 -1
  224. package/lib/stateDatastore.d.ts +0 -56
  225. package/lib/stateDatastore.d.ts.map +0 -1
  226. package/lib/stateDatastore.js +0 -17
  227. package/lib/stateDatastore.js.map +0 -1
  228. package/lib/stateFactory.d.ts +0 -18
  229. package/lib/stateFactory.d.ts.map +0 -1
  230. package/lib/stateFactory.js +0 -20
  231. package/lib/stateFactory.js.map +0 -1
  232. package/lib/statesManagerTypes.d.ts +0 -27
  233. package/lib/statesManagerTypes.d.ts.map +0 -1
  234. package/lib/statesManagerTypes.js +0 -6
  235. package/lib/statesManagerTypes.js.map +0 -1
  236. package/lib/systemWorkspace.d.ts +0 -58
  237. package/lib/systemWorkspace.d.ts.map +0 -1
  238. package/lib/systemWorkspace.js +0 -261
  239. package/lib/systemWorkspace.js.map +0 -1
  240. package/lib/timerManager.d.ts +0 -37
  241. package/lib/timerManager.d.ts.map +0 -1
  242. package/lib/timerManager.js +0 -61
  243. package/lib/timerManager.js.map +0 -1
  244. package/lib/types.d.ts +0 -132
  245. package/lib/types.d.ts.map +0 -1
  246. package/lib/types.js +0 -6
  247. package/lib/types.js.map +0 -1
  248. package/lib/validatableTypes.d.ts +0 -69
  249. package/lib/validatableTypes.d.ts.map +0 -1
  250. package/lib/validatableTypes.js +0 -6
  251. package/lib/validatableTypes.js.map +0 -1
  252. package/lib/validatedGetter.d.ts +0 -18
  253. package/lib/validatedGetter.d.ts.map +0 -1
  254. package/lib/validatedGetter.js +0 -39
  255. package/lib/validatedGetter.js.map +0 -1
  256. package/lib/valueManager.d.ts +0 -15
  257. package/lib/valueManager.d.ts.map +0 -1
  258. package/lib/valueManager.js +0 -17
  259. package/lib/valueManager.js.map +0 -1
@@ -1,343 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { Listenable } from "@fluidframework/core-interfaces";
6
- import type { DeepReadonly, JsonDeserialized, JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
7
- import type { BroadcastControls, BroadcastControlSettings } from "./broadcastControlsTypes.js";
8
- import type { InternalTypes } from "./exposedInternalTypes.js";
9
- import type { LatestClientData, LatestData, LatestMetadata, ProxiedValueAccessor, RawValueAccessor, StateSchemaValidator, ValueAccessor } from "./latestValueTypes.js";
10
- import type { Attendee, AttendeeId, Presence } from "./presence.js";
11
- /**
12
- * A validator function that can optionally be provided to do runtime validation
13
- * of the custom key listed in a {@link LatestMap}.
14
- *
15
- * @param unvalidatedKey - The unknown key that should be validated.
16
- *
17
- * @returns True if the key is valid.
18
- *
19
- * @beta
20
- */
21
- export type KeySchemaValidator<Keys extends string> = (unvalidatedKey: string) => unvalidatedKey is Keys;
22
- /**
23
- * Collection of latest known values for a specific {@link Attendee}.
24
- *
25
- * @sealed
26
- * @beta
27
- */
28
- export interface LatestMapClientData<T, Keys extends string, TValueAccessor extends ValueAccessor<T>, SpecificAttendeeId extends AttendeeId = AttendeeId> {
29
- /**
30
- * Associated {@link Attendee}.
31
- */
32
- attendee: Attendee<SpecificAttendeeId>;
33
- /**
34
- * Map of items for the state.
35
- *
36
- * @privateRemarks This could be regular map currently as no Map is
37
- * stored internally and a new instance is created for every request.
38
- */
39
- items: ReadonlyMap<Keys, LatestData<T, TValueAccessor>>;
40
- }
41
- /**
42
- * State of a single item value, its key, and its metadata.
43
- *
44
- * @sealed
45
- * @beta
46
- */
47
- export interface LatestMapItemUpdatedClientData<T, K extends string, TValueAccessor extends ValueAccessor<T>> extends LatestClientData<T, TValueAccessor> {
48
- /**
49
- * Key of the updated item.
50
- */
51
- key: K;
52
- }
53
- /**
54
- * Identifier and metadata for a removed item.
55
- *
56
- * @sealed
57
- * @beta
58
- */
59
- export interface LatestMapItemRemovedClientData<K extends string> {
60
- /**
61
- * Associated {@link Attendee}.
62
- */
63
- attendee: Attendee;
64
- /**
65
- * Key of the removed item.
66
- */
67
- key: K;
68
- /**
69
- * Metadata associated with the removal of the item.
70
- */
71
- metadata: LatestMetadata;
72
- }
73
- /**
74
- * Events from {@link LatestMapRaw}.
75
- *
76
- * @sealed
77
- * @beta
78
- */
79
- export interface LatestMapEvents<T, K extends string, TRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
80
- /**
81
- * Raised when any item's value for remote client is updated.
82
- * @param updates - Map of one or more values updated.
83
- *
84
- * @remarks The event does not include item removals.
85
- *
86
- * @eventProperty
87
- */
88
- remoteUpdated: (updates: LatestMapClientData<T, K, TRemoteValueAccessor>) => void;
89
- /**
90
- * Raised when specific item's value of remote client is updated.
91
- * @param updatedItem - Updated item value.
92
- *
93
- * @eventProperty
94
- */
95
- remoteItemUpdated: (updatedItem: LatestMapItemUpdatedClientData<T, K, TRemoteValueAccessor>) => void;
96
- /**
97
- * Raised when specific item of remote client is removed.
98
- * @param removedItem - Removed item.
99
- *
100
- * @eventProperty
101
- */
102
- remoteItemRemoved: (removedItem: LatestMapItemRemovedClientData<K>) => void;
103
- /**
104
- * Raised when specific local item's value is updated.
105
- * @param updatedItem - Updated item value.
106
- *
107
- * @eventProperty
108
- */
109
- localItemUpdated: (updatedItem: {
110
- value: DeepReadonly<JsonSerializable<T>>;
111
- key: K;
112
- }) => void;
113
- /**
114
- * Raised when specific local item is removed.
115
- * @param removedItem - Removed item.
116
- *
117
- * @eventProperty
118
- */
119
- localItemRemoved: (removedItem: {
120
- key: K;
121
- }) => void;
122
- }
123
- /**
124
- * Events from {@link LatestMapRaw}.
125
- *
126
- * @sealed
127
- * @beta
128
- */
129
- export type LatestMapRawEvents<T, K extends string> = LatestMapEvents<T, K, RawValueAccessor<T>>;
130
- /**
131
- * Map of local client's values. Modifications are transmitted to all other connected clients.
132
- *
133
- * @sealed
134
- * @beta
135
- */
136
- export interface StateMap<K extends string, V> {
137
- /**
138
- * ${@link StateMap.delete}s all elements in the StateMap.
139
- * @remarks This is not yet implemented.
140
- */
141
- clear(): void;
142
- /**
143
- * Removes the element with the specified key from the StateMap, if it exists.
144
- *
145
- * @returns true if an element in the StateMap existed and has been removed, or false if
146
- * the element does not exist.
147
- * @remarks No entry is fully removed. Instead an undefined placeholder is locally and
148
- * transmitted to all other clients. For better performance limit the number of deleted
149
- * entries and reuse keys when possible.
150
- * @privateRemarks In the future we may add a mechanism to remove the placeholder, at least
151
- * from transmissions after sufficient time has passed.
152
- */
153
- delete(key: K): boolean;
154
- /**
155
- * Executes a provided function once per each key/value pair in the StateMap, in arbitrary order.
156
- */
157
- forEach(callbackfn: (value: DeepReadonly<JsonDeserialized<V>>, key: K, map: StateMap<K, V>) => void, thisArg?: unknown): void;
158
- /**
159
- * Returns the element with the specified key from the StateMap, if it exists.
160
- *
161
- * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
162
- */
163
- get(key: K): DeepReadonly<JsonDeserialized<V>> | undefined;
164
- /**
165
- * Checks if an element with the specified key exists in the StateMap.
166
- * @returns boolean indicating whether an element with the specified key exists or not.
167
- */
168
- has(key: K): boolean;
169
- /**
170
- * Adds a new element with a specified key and value to the StateMap. If an element with the same key already exists, the element will be updated.
171
- * The value will be transmitted to all other connected clients.
172
- *
173
- * @remarks Manager assumes ownership of the value and its references.
174
- * Make a deep clone before setting, if needed. No comparison is done to detect changes; all
175
- * sets are transmitted.
176
- */
177
- set(key: K, value: JsonSerializable<V>): this;
178
- /**
179
- * The number of elements in the StateMap.
180
- */
181
- readonly size: number;
182
- /**
183
- * Returns an iterable of entries in the map.
184
- */
185
- /**
186
- * Returns an iterable of key, value pairs for every entry in the map.
187
- */
188
- /**
189
- * Returns an iterable of keys in the map.
190
- */
191
- keys(): IterableIterator<K>;
192
- }
193
- /**
194
- * State that provides a `Map` of latest known values from this client to
195
- * others and read access to their values.
196
- * Entries in the map may vary over time and by client, but all values are expected to
197
- * be of the same type, which may be a union type.
198
- *
199
- * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.
200
- *
201
- * @sealed
202
- * @beta
203
- */
204
- export interface LatestMap<T, Keys extends string = string, TRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>> {
205
- /**
206
- * Containing {@link Presence}
207
- */
208
- readonly presence: Presence;
209
- /**
210
- * Events for LatestMap.
211
- */
212
- readonly events: Listenable<LatestMapEvents<T, Keys, TRemoteAccessor>>;
213
- /**
214
- * Controls for management of sending updates.
215
- */
216
- readonly controls: BroadcastControls;
217
- /**
218
- * Current value map for this client.
219
- */
220
- readonly local: StateMap<Keys, T>;
221
- /**
222
- * Iterable access to remote clients' map of values.
223
- */
224
- getRemotes(): IterableIterator<LatestMapClientData<T, Keys, TRemoteAccessor>>;
225
- /**
226
- * Array of {@link Attendee}s that have provided states.
227
- */
228
- getStateAttendees(): Attendee[];
229
- /**
230
- * Access to a specific client's map of values.
231
- */
232
- getRemote(attendee: Attendee): ReadonlyMap<Keys, LatestData<T, TRemoteAccessor>>;
233
- }
234
- /**
235
- * State that provides a `Map` of latest known values from this client to
236
- * others and read access to their values.
237
- * Entries in the map may vary over time and by client, but all values are expected to
238
- * be of the same type, which may be a union type.
239
- *
240
- * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.
241
- *
242
- * @sealed
243
- * @beta
244
- */
245
- export type LatestMapRaw<T, Keys extends string = string> = LatestMap<T, Keys, RawValueAccessor<T>>;
246
- /**
247
- * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.
248
- *
249
- * @input
250
- * @beta
251
- */
252
- export interface LatestMapArgumentsRaw<T, Keys extends string = string> {
253
- /**
254
- * The initial value of the local state.
255
- */
256
- local?: {
257
- [K in Keys]: JsonSerializable<T>;
258
- };
259
- /**
260
- * See {@link BroadcastControlSettings}.
261
- */
262
- settings?: BroadcastControlSettings | undefined;
263
- }
264
- /**
265
- * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.
266
- *
267
- * @input
268
- * @beta
269
- */
270
- export interface LatestMapArguments<T, Keys extends string = string> extends LatestMapArgumentsRaw<T, Keys> {
271
- /**
272
- * An optional function that will be called at runtime to validate data value
273
- * under a key. A runtime validator is strongly recommended.
274
- * @see {@link StateSchemaValidator}.
275
- */
276
- validator: StateSchemaValidator<T>;
277
- /**
278
- * An optional function that will be called at runtime to validate the presence
279
- * data key. A runtime validator is strongly recommended when key type is not
280
- * simply `string`.
281
- * @see {@link KeySchemaValidator}.
282
- */
283
- keyValidator?: KeySchemaValidator<Keys>;
284
- }
285
- /**
286
- * Type alias for the return type of {@link LatestMapFactory} when called with
287
- * {@link LatestMapArguments}.
288
- *
289
- * @remarks
290
- * Use this type instead of any InternalPresenceTypes that may be revealed from
291
- * examining factory return type.
292
- *
293
- * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
294
- * allowed registration keys for this State object within a workspace.
295
- * Specification is recommended to highlight connection between schema and
296
- * factory when spread across modules.
297
- *
298
- * @beta
299
- * @sealed
300
- */
301
- export type LatestMapConfiguration<T, Keys extends string, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.MapValueState<T, Keys>, LatestMap<T, Keys>>;
302
- /**
303
- * Type alias for the return type of {@link LatestMapFactory} when called with
304
- * {@link LatestMapArgumentsRaw}.
305
- *
306
- * @remarks
307
- * Use this type instead of any InternalPresenceTypes that may be revealed from
308
- * examining factory return type.
309
- *
310
- * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain
311
- * allowed registration keys for this State object within a workspace.
312
- * Specification is recommended to highlight connection between schema and
313
- * factory when spread across modules.
314
- *
315
- * @beta
316
- * @sealed
317
- */
318
- export type LatestMapRawConfiguration<T, Keys extends string, RegistrationKeyRestrictions extends string = string> = InternalTypes.ManagerFactory<RegistrationKeyRestrictions, InternalTypes.MapValueState<T, Keys>, LatestMapRaw<T, Keys>>;
319
- /**
320
- * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
321
- *
322
- * @beta
323
- * @sealed
324
- */
325
- export interface LatestMapFactory {
326
- /**
327
- * Factory for creating a {@link LatestMap} State object.
328
- *
329
- * @remarks
330
- * This overload is used when called with {@link LatestMapArguments}.
331
- * That is, if a validator function is provided.
332
- */
333
- <T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(args: LatestMapArguments<T, Keys>): LatestMapConfiguration<T, Keys, RegistrationKeyRestrictions>;
334
- /**
335
- * Factory for creating a {@link LatestMapRaw} State object.
336
- *
337
- * @remarks
338
- * This overload is used when called with {@link LatestMapArgumentsRaw}.
339
- * That is, if a validator function is _not_ provided.
340
- */
341
- <T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(args?: LatestMapArgumentsRaw<T, Keys>): LatestMapRawConfiguration<T, Keys, RegistrationKeyRestrictions>;
342
- }
343
- //# sourceMappingURL=latestMapTypes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latestMapTypes.d.ts","sourceRoot":"","sources":["../src/latestMapTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,KAAK,EACX,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,EAAE,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S,MAAM,GAAG,MAAM,IAChD,aAAa,CAAC,cAAc,CAC/B,2BAA2B,EAC3B,aAAa,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,EACpC,YAAY,CAAC,CAAC,EAAE,IAAI,CAAC,CACrB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,2BAA2B,SAAS,MAAM,GAAG,MAAM,EACpF,IAAI,EAAE,kBAAkB,CAAC,CAAC,EAAE,IAAI,CAAC,GAC/B,sBAAsB,CAAC,CAAC,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAC;IAEhE;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,2BAA2B,SAAS,MAAM,GAAG,MAAM,EACpF,IAAI,CAAC,EAAE,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC,GACnC,yBAAyB,CAAC,CAAC,EAAE,IAAI,EAAE,2BAA2B,CAAC,CAAC;CACnE"}
@@ -1,6 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- export {};
6
- //# sourceMappingURL=latestMapTypes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latestMapTypes.js","sourceRoot":"","sources":["../src/latestMapTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { Listenable } from \"@fluidframework/core-interfaces\";\nimport type {\n\tDeepReadonly,\n\tJsonDeserialized,\n\tJsonSerializable,\n} from \"@fluidframework/core-interfaces/internal/exposedUtilityTypes\";\n\nimport type { BroadcastControls, BroadcastControlSettings } from \"./broadcastControlsTypes.js\";\nimport type { InternalTypes } from \"./exposedInternalTypes.js\";\nimport type {\n\tLatestClientData,\n\tLatestData,\n\tLatestMetadata,\n\tProxiedValueAccessor,\n\tRawValueAccessor,\n\tStateSchemaValidator,\n\tValueAccessor,\n} from \"./latestValueTypes.js\";\nimport type { Attendee, AttendeeId, Presence } from \"./presence.js\";\n\n/**\n * A validator function that can optionally be provided to do runtime validation\n * of the custom key listed in a {@link LatestMap}.\n *\n * @param unvalidatedKey - The unknown key that should be validated.\n *\n * @returns True if the key is valid.\n *\n * @beta\n */\nexport type KeySchemaValidator<Keys extends string> = (\n\tunvalidatedKey: string,\n) => unvalidatedKey is Keys;\n\n/**\n * Collection of latest known values for a specific {@link Attendee}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapClientData<\n\tT,\n\tKeys extends string,\n\tTValueAccessor extends ValueAccessor<T>,\n\tSpecificAttendeeId extends AttendeeId = AttendeeId,\n> {\n\t/**\n\t * Associated {@link Attendee}.\n\t */\n\tattendee: Attendee<SpecificAttendeeId>;\n\n\t/**\n\t * Map of items for the state.\n\t *\n\t * @privateRemarks This could be regular map currently as no Map is\n\t * stored internally and a new instance is created for every request.\n\t */\n\titems: ReadonlyMap<Keys, LatestData<T, TValueAccessor>>;\n}\n\n/**\n * State of a single item value, its key, and its metadata.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapItemUpdatedClientData<\n\tT,\n\tK extends string,\n\tTValueAccessor extends ValueAccessor<T>,\n> extends LatestClientData<T, TValueAccessor> {\n\t/**\n\t * Key of the updated item.\n\t */\n\tkey: K;\n}\n\n/**\n * Identifier and metadata for a removed item.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapItemRemovedClientData<K extends string> {\n\t/**\n\t * Associated {@link Attendee}.\n\t */\n\tattendee: Attendee;\n\n\t/**\n\t * Key of the removed item.\n\t */\n\tkey: K;\n\n\t/**\n\t * Metadata associated with the removal of the item.\n\t */\n\tmetadata: LatestMetadata;\n}\n\n/**\n * Events from {@link LatestMapRaw}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMapEvents<\n\tT,\n\tK extends string,\n\tTRemoteValueAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>,\n> {\n\t/**\n\t * Raised when any item's value for remote client is updated.\n\t * @param updates - Map of one or more values updated.\n\t *\n\t * @remarks The event does not include item removals.\n\t *\n\t * @eventProperty\n\t */\n\tremoteUpdated: (updates: LatestMapClientData<T, K, TRemoteValueAccessor>) => void;\n\n\t/**\n\t * Raised when specific item's value of remote client is updated.\n\t * @param updatedItem - Updated item value.\n\t *\n\t * @eventProperty\n\t */\n\tremoteItemUpdated: (\n\t\tupdatedItem: LatestMapItemUpdatedClientData<T, K, TRemoteValueAccessor>,\n\t) => void;\n\n\t/**\n\t * Raised when specific item of remote client is removed.\n\t * @param removedItem - Removed item.\n\t *\n\t * @eventProperty\n\t */\n\tremoteItemRemoved: (removedItem: LatestMapItemRemovedClientData<K>) => void;\n\n\t/**\n\t * Raised when specific local item's value is updated.\n\t * @param updatedItem - Updated item value.\n\t *\n\t * @eventProperty\n\t */\n\tlocalItemUpdated: (updatedItem: {\n\t\tvalue: DeepReadonly<JsonSerializable<T>>;\n\t\tkey: K;\n\t}) => void;\n\n\t/**\n\t * Raised when specific local item is removed.\n\t * @param removedItem - Removed item.\n\t *\n\t * @eventProperty\n\t */\n\tlocalItemRemoved: (removedItem: { key: K }) => void;\n}\n\n/**\n * Events from {@link LatestMapRaw}.\n *\n * @sealed\n * @beta\n */\nexport type LatestMapRawEvents<T, K extends string> = LatestMapEvents<\n\tT,\n\tK,\n\tRawValueAccessor<T>\n>;\n\n/**\n * Map of local client's values. Modifications are transmitted to all other connected clients.\n *\n * @sealed\n * @beta\n */\nexport interface StateMap<K extends string, V> {\n\t/**\n\t * ${@link StateMap.delete}s all elements in the StateMap.\n\t * @remarks This is not yet implemented.\n\t */\n\tclear(): void;\n\n\t/**\n\t * Removes the element with the specified key from the StateMap, if it exists.\n\t *\n\t * @returns true if an element in the StateMap existed and has been removed, or false if\n\t * the element does not exist.\n\t * @remarks No entry is fully removed. Instead an undefined placeholder is locally and\n\t * transmitted to all other clients. For better performance limit the number of deleted\n\t * entries and reuse keys when possible.\n\t * @privateRemarks In the future we may add a mechanism to remove the placeholder, at least\n\t * from transmissions after sufficient time has passed.\n\t */\n\tdelete(key: K): boolean;\n\n\t/**\n\t * Executes a provided function once per each key/value pair in the StateMap, in arbitrary order.\n\t */\n\tforEach(\n\t\tcallbackfn: (\n\t\t\tvalue: DeepReadonly<JsonDeserialized<V>>,\n\t\t\tkey: K,\n\t\t\tmap: StateMap<K, V>,\n\t\t) => void,\n\t\tthisArg?: unknown,\n\t): void;\n\n\t/**\n\t * Returns the element with the specified key from the StateMap, if it exists.\n\t *\n\t * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.\n\t */\n\tget(key: K): DeepReadonly<JsonDeserialized<V>> | undefined;\n\n\t/**\n\t * Checks if an element with the specified key exists in the StateMap.\n\t * @returns boolean indicating whether an element with the specified key exists or not.\n\t */\n\thas(key: K): boolean;\n\n\t/**\n\t * Adds a new element with a specified key and value to the StateMap. If an element with the same key already exists, the element will be updated.\n\t * The value will be transmitted to all other connected clients.\n\t *\n\t * @remarks Manager assumes ownership of the value and its references.\n\t * Make a deep clone before setting, if needed. No comparison is done to detect changes; all\n\t * sets are transmitted.\n\t */\n\tset(key: K, value: JsonSerializable<V>): this;\n\n\t/**\n\t * The number of elements in the StateMap.\n\t */\n\treadonly size: number;\n\n\t/**\n\t * Returns an iterable of entries in the map.\n\t */\n\t// [Symbol.iterator](): IterableIterator<[K, DeepReadonly<JsonDeserialized<V>>]>;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t */\n\t// entries(): IterableIterator<[K, DeepReadonly<JsonDeserialized<V>>]>;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t */\n\tkeys(): IterableIterator<K>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t */\n\t// values(): IterableIterator<DeepReadonly<JsonDeserialized<V>>>;\n}\n\n/**\n * State that provides a `Map` of latest known values from this client to\n * others and read access to their values.\n * Entries in the map may vary over time and by client, but all values are expected to\n * be of the same type, which may be a union type.\n *\n * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport interface LatestMap<\n\tT,\n\tKeys extends string = string,\n\tTRemoteAccessor extends ValueAccessor<T> = ProxiedValueAccessor<T>,\n> {\n\t/**\n\t * Containing {@link Presence}\n\t */\n\treadonly presence: Presence;\n\n\t/**\n\t * Events for LatestMap.\n\t */\n\treadonly events: Listenable<LatestMapEvents<T, Keys, TRemoteAccessor>>;\n\n\t/**\n\t * Controls for management of sending updates.\n\t */\n\treadonly controls: BroadcastControls;\n\n\t/**\n\t * Current value map for this client.\n\t */\n\treadonly local: StateMap<Keys, T>;\n\n\t/**\n\t * Iterable access to remote clients' map of values.\n\t */\n\tgetRemotes(): IterableIterator<LatestMapClientData<T, Keys, TRemoteAccessor>>;\n\n\t/**\n\t * Array of {@link Attendee}s that have provided states.\n\t */\n\tgetStateAttendees(): Attendee[];\n\n\t/**\n\t * Access to a specific client's map of values.\n\t */\n\tgetRemote(attendee: Attendee): ReadonlyMap<Keys, LatestData<T, TRemoteAccessor>>;\n}\n\n/**\n * State that provides a `Map` of latest known values from this client to\n * others and read access to their values.\n * Entries in the map may vary over time and by client, but all values are expected to\n * be of the same type, which may be a union type.\n *\n * @remarks Create using {@link StateFactory}.{@link LatestMapFactory|latestMap} registered to {@link StatesWorkspace}.\n *\n * @sealed\n * @beta\n */\nexport type LatestMapRaw<T, Keys extends string = string> = LatestMap<\n\tT,\n\tKeys,\n\tRawValueAccessor<T>\n>;\n\n/**\n * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.\n *\n * @input\n * @beta\n */\nexport interface LatestMapArgumentsRaw<T, Keys extends string = string> {\n\t/**\n\t * The initial value of the local state.\n\t */\n\tlocal?: {\n\t\t[K in Keys]: JsonSerializable<T>;\n\t};\n\n\t/**\n\t * See {@link BroadcastControlSettings}.\n\t */\n\tsettings?: BroadcastControlSettings | undefined;\n}\n\n/**\n * Arguments that are passed to the {@link StateFactory}.{@link LatestMapFactory|latestMap} function.\n *\n * @input\n * @beta\n */\nexport interface LatestMapArguments<T, Keys extends string = string>\n\textends LatestMapArgumentsRaw<T, Keys> {\n\t/**\n\t * An optional function that will be called at runtime to validate data value\n\t * under a key. A runtime validator is strongly recommended.\n\t * @see {@link StateSchemaValidator}.\n\t */\n\tvalidator: StateSchemaValidator<T>;\n\n\t/**\n\t * An optional function that will be called at runtime to validate the presence\n\t * data key. A runtime validator is strongly recommended when key type is not\n\t * simply `string`.\n\t * @see {@link KeySchemaValidator}.\n\t */\n\tkeyValidator?: KeySchemaValidator<Keys>;\n}\n\n/**\n * Type alias for the return type of {@link LatestMapFactory} when called with\n * {@link LatestMapArguments}.\n *\n * @remarks\n * Use this type instead of any InternalPresenceTypes that may be revealed from\n * examining factory return type.\n *\n * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain\n * allowed registration keys for this State object within a workspace.\n * Specification is recommended to highlight connection between schema and\n * factory when spread across modules.\n *\n * @beta\n * @sealed\n */\nexport type LatestMapConfiguration<\n\tT,\n\tKeys extends string,\n\tRegistrationKeyRestrictions extends string = string,\n> = InternalTypes.ManagerFactory<\n\tRegistrationKeyRestrictions,\n\tInternalTypes.MapValueState<T, Keys>,\n\tLatestMap<T, Keys>\n>;\n\n/**\n * Type alias for the return type of {@link LatestMapFactory} when called with\n * {@link LatestMapArgumentsRaw}.\n *\n * @remarks\n * Use this type instead of any InternalPresenceTypes that may be revealed from\n * examining factory return type.\n *\n * @typeparam RegistrationKeyRestrictions - Optional type parameter to constrain\n * allowed registration keys for this State object within a workspace.\n * Specification is recommended to highlight connection between schema and\n * factory when spread across modules.\n *\n * @beta\n * @sealed\n */\nexport type LatestMapRawConfiguration<\n\tT,\n\tKeys extends string,\n\tRegistrationKeyRestrictions extends string = string,\n> = InternalTypes.ManagerFactory<\n\tRegistrationKeyRestrictions,\n\tInternalTypes.MapValueState<T, Keys>,\n\tLatestMapRaw<T, Keys>\n>;\n\n/**\n * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.\n *\n * @beta\n * @sealed\n */\nexport interface LatestMapFactory {\n\t/**\n\t * Factory for creating a {@link LatestMap} State object.\n\t *\n\t * @remarks\n\t * This overload is used when called with {@link LatestMapArguments}.\n\t * That is, if a validator function is provided.\n\t */\n\t<T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(\n\t\targs: LatestMapArguments<T, Keys>,\n\t): LatestMapConfiguration<T, Keys, RegistrationKeyRestrictions>;\n\n\t/**\n\t * Factory for creating a {@link LatestMapRaw} State object.\n\t *\n\t * @remarks\n\t * This overload is used when called with {@link LatestMapArgumentsRaw}.\n\t * That is, if a validator function is _not_ provided.\n\t */\n\t<T, Keys extends string = string, RegistrationKeyRestrictions extends string = string>(\n\t\targs?: LatestMapArgumentsRaw<T, Keys>,\n\t): LatestMapRawConfiguration<T, Keys, RegistrationKeyRestrictions>;\n}\n"]}
@@ -1,52 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { JsonSerializable } from "@fluidframework/core-interfaces/internal/exposedUtilityTypes";
6
- import type { BroadcastControlSettings } from "./broadcastControlsTypes.js";
7
- import type { KeySchemaValidator, LatestMapFactory } from "./latestMapTypes.js";
8
- import type { StateSchemaValidator } from "./latestValueTypes.js";
9
- /**
10
- * Arguments that are passed to the {@link StateFactory.latestMap} function.
11
- *
12
- * @input
13
- * @beta
14
- */
15
- export interface LatestMapArgumentsRaw<T, Keys extends string = string> {
16
- /**
17
- * The initial value of the local state.
18
- */
19
- local?: {
20
- [K in Keys]: JsonSerializable<T>;
21
- };
22
- /**
23
- * See {@link BroadcastControlSettings}.
24
- */
25
- settings?: BroadcastControlSettings | undefined;
26
- }
27
- /**
28
- * Arguments that are passed to the {@link StateFactory.latestMap} function.
29
- *
30
- * @input
31
- * @beta
32
- */
33
- export interface LatestMapArguments<T, Keys extends string = string> extends LatestMapArgumentsRaw<T, Keys> {
34
- /**
35
- * An optional function that will be called at runtime to validate data value
36
- * under a key. A runtime validator is strongly recommended.
37
- * @see {@link StateSchemaValidator}.
38
- */
39
- validator: StateSchemaValidator<T>;
40
- /**
41
- * An optional function that will be called at runtime to validate the presence
42
- * data key. A runtime validator is strongly recommended when key type is not
43
- * simply `string`.
44
- * @see {@link KeySchemaValidator}.
45
- */
46
- keyValidator?: KeySchemaValidator<Keys>;
47
- }
48
- /**
49
- * Factory for creating a {@link LatestMap} or {@link LatestMapRaw} State object.
50
- */
51
- export declare const latestMap: LatestMapFactory;
52
- //# sourceMappingURL=latestMapValueManager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"latestMapValueManager.d.ts","sourceRoot":"","sources":["../src/latestMapValueManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAGX,gBAAgB,EAChB,MAAM,8DAA8D,CAAC;AAGtE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAU5E,OAAO,KAAK,EACX,kBAAkB,EAIlB,gBAAgB,EAIhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAc,oBAAoB,EAAiB,MAAM,uBAAuB,CAAC;AAgS7F;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM;IACrE;;OAEG;IACH,KAAK,CAAC,EAAE;SACN,CAAC,IAAI,IAAI,GAAG,gBAAgB,CAAC,CAAC,CAAC;KAChC,CAAC;IAEF;;OAEG;IACH,QAAQ,CAAC,EAAE,wBAAwB,GAAG,SAAS,CAAC;CAChD;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,CAClE,SAAQ,qBAAqB,CAAC,CAAC,EAAE,IAAI,CAAC;IACtC;;;;OAIG;IACH,SAAS,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IACnC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC;CACxC;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,gBA6DvB,CAAC"}