@y/y 14.0.0-16
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/LICENSE +23 -0
- package/README.md +1406 -0
- package/dist/Skip-j0kX7pdq.js +12173 -0
- package/dist/Skip-j0kX7pdq.js.map +1 -0
- package/dist/Skip-wRT7BKFP.js +11877 -0
- package/dist/Skip-wRT7BKFP.js.map +1 -0
- package/dist/index-DyTeTfmj.js +163 -0
- package/dist/index-DyTeTfmj.js.map +1 -0
- package/dist/index-R7GxO-36.js +165 -0
- package/dist/index-R7GxO-36.js.map +1 -0
- package/dist/internals.cjs +286 -0
- package/dist/internals.cjs.map +1 -0
- package/dist/internals.mjs +25 -0
- package/dist/internals.mjs.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/internals.d.ts +43 -0
- package/dist/src/internals.d.ts.map +1 -0
- package/dist/src/structs/AbstractStruct.d.ts +42 -0
- package/dist/src/structs/AbstractStruct.d.ts.map +1 -0
- package/dist/src/structs/ContentAny.d.ts +67 -0
- package/dist/src/structs/ContentAny.d.ts.map +1 -0
- package/dist/src/structs/ContentBinary.d.ts +64 -0
- package/dist/src/structs/ContentBinary.d.ts.map +1 -0
- package/dist/src/structs/ContentDeleted.d.ts +64 -0
- package/dist/src/structs/ContentDeleted.d.ts.map +1 -0
- package/dist/src/structs/ContentDoc.d.ts +72 -0
- package/dist/src/structs/ContentDoc.d.ts.map +1 -0
- package/dist/src/structs/ContentEmbed.d.ts +67 -0
- package/dist/src/structs/ContentEmbed.d.ts.map +1 -0
- package/dist/src/structs/ContentFormat.d.ts +69 -0
- package/dist/src/structs/ContentFormat.d.ts.map +1 -0
- package/dist/src/structs/ContentJSON.d.ts +70 -0
- package/dist/src/structs/ContentJSON.d.ts.map +1 -0
- package/dist/src/structs/ContentString.d.ts +70 -0
- package/dist/src/structs/ContentString.d.ts.map +1 -0
- package/dist/src/structs/ContentType.d.ts +83 -0
- package/dist/src/structs/ContentType.d.ts.map +1 -0
- package/dist/src/structs/GC.d.ts +31 -0
- package/dist/src/structs/GC.d.ts.map +1 -0
- package/dist/src/structs/Item.d.ts +212 -0
- package/dist/src/structs/Item.d.ts.map +1 -0
- package/dist/src/structs/Skip.d.ts +33 -0
- package/dist/src/structs/Skip.d.ts.map +1 -0
- package/dist/src/types/AbstractType.d.ts +239 -0
- package/dist/src/types/AbstractType.d.ts.map +1 -0
- package/dist/src/types/YArray.d.ts +128 -0
- package/dist/src/types/YArray.d.ts.map +1 -0
- package/dist/src/types/YMap.d.ts +112 -0
- package/dist/src/types/YMap.d.ts.map +1 -0
- package/dist/src/types/YText.d.ts +216 -0
- package/dist/src/types/YText.d.ts.map +1 -0
- package/dist/src/types/YXmlElement.d.ts +106 -0
- package/dist/src/types/YXmlElement.d.ts.map +1 -0
- package/dist/src/types/YXmlFragment.d.ts +143 -0
- package/dist/src/types/YXmlFragment.d.ts.map +1 -0
- package/dist/src/types/YXmlHook.d.ts +32 -0
- package/dist/src/types/YXmlHook.d.ts.map +1 -0
- package/dist/src/types/YXmlText.d.ts +34 -0
- package/dist/src/types/YXmlText.d.ts.map +1 -0
- package/dist/src/utils/AbstractConnector.d.ts +20 -0
- package/dist/src/utils/AbstractConnector.d.ts.map +1 -0
- package/dist/src/utils/AttributionManager.d.ts +224 -0
- package/dist/src/utils/AttributionManager.d.ts.map +1 -0
- package/dist/src/utils/Doc.d.ts +267 -0
- package/dist/src/utils/Doc.d.ts.map +1 -0
- package/dist/src/utils/EventHandler.d.ts +19 -0
- package/dist/src/utils/EventHandler.d.ts.map +1 -0
- package/dist/src/utils/ID.d.ts +26 -0
- package/dist/src/utils/ID.d.ts.map +1 -0
- package/dist/src/utils/IdMap.d.ts +161 -0
- package/dist/src/utils/IdMap.d.ts.map +1 -0
- package/dist/src/utils/IdSet.d.ts +163 -0
- package/dist/src/utils/IdSet.d.ts.map +1 -0
- package/dist/src/utils/RelativePosition.d.ts +91 -0
- package/dist/src/utils/RelativePosition.d.ts.map +1 -0
- package/dist/src/utils/Snapshot.d.ts +40 -0
- package/dist/src/utils/Snapshot.d.ts.map +1 -0
- package/dist/src/utils/StructSet.d.ts +27 -0
- package/dist/src/utils/StructSet.d.ts.map +1 -0
- package/dist/src/utils/StructStore.d.ts +41 -0
- package/dist/src/utils/StructStore.d.ts.map +1 -0
- package/dist/src/utils/Transaction.d.ts +136 -0
- package/dist/src/utils/Transaction.d.ts.map +1 -0
- package/dist/src/utils/UndoManager.d.ts +188 -0
- package/dist/src/utils/UndoManager.d.ts.map +1 -0
- package/dist/src/utils/UpdateDecoder.d.ts +167 -0
- package/dist/src/utils/UpdateDecoder.d.ts.map +1 -0
- package/dist/src/utils/UpdateEncoder.d.ts +164 -0
- package/dist/src/utils/UpdateEncoder.d.ts.map +1 -0
- package/dist/src/utils/YEvent.d.ts +120 -0
- package/dist/src/utils/YEvent.d.ts.map +1 -0
- package/dist/src/utils/delta-helpers.d.ts +6 -0
- package/dist/src/utils/delta-helpers.d.ts.map +1 -0
- package/dist/src/utils/encoding.d.ts +30 -0
- package/dist/src/utils/encoding.d.ts.map +1 -0
- package/dist/src/utils/isParentOf.d.ts +3 -0
- package/dist/src/utils/isParentOf.d.ts.map +1 -0
- package/dist/src/utils/logging.d.ts +3 -0
- package/dist/src/utils/logging.d.ts.map +1 -0
- package/dist/src/utils/types.d.ts +7 -0
- package/dist/src/utils/types.d.ts.map +1 -0
- package/dist/src/utils/updates.d.ts +89 -0
- package/dist/src/utils/updates.d.ts.map +1 -0
- package/dist/testHelper.cjs +780 -0
- package/dist/testHelper.cjs.map +1 -0
- package/dist/testHelper.mjs +617 -0
- package/dist/testHelper.mjs.map +1 -0
- package/dist/tests/IdMap.tests.d.ts +9 -0
- package/dist/tests/IdMap.tests.d.ts.map +1 -0
- package/dist/tests/IdSet.tests.d.ts +9 -0
- package/dist/tests/IdSet.tests.d.ts.map +1 -0
- package/dist/tests/attribution.tests.d.ts +8 -0
- package/dist/tests/attribution.tests.d.ts.map +1 -0
- package/dist/tests/compatibility.tests.d.ts +5 -0
- package/dist/tests/compatibility.tests.d.ts.map +1 -0
- package/dist/tests/delta.tests.d.ts +7 -0
- package/dist/tests/delta.tests.d.ts.map +1 -0
- package/dist/tests/doc.tests.d.ts +13 -0
- package/dist/tests/doc.tests.d.ts.map +1 -0
- package/dist/tests/encoding.tests.d.ts +5 -0
- package/dist/tests/encoding.tests.d.ts.map +1 -0
- package/dist/tests/index.d.ts +2 -0
- package/dist/tests/index.d.ts.map +1 -0
- package/dist/tests/relativePositions.tests.d.ts +11 -0
- package/dist/tests/relativePositions.tests.d.ts.map +1 -0
- package/dist/tests/snapshot.tests.d.ts +13 -0
- package/dist/tests/snapshot.tests.d.ts.map +1 -0
- package/dist/tests/testHelper.d.ts +167 -0
- package/dist/tests/testHelper.d.ts.map +1 -0
- package/dist/tests/undo-redo.tests.d.ts +27 -0
- package/dist/tests/undo-redo.tests.d.ts.map +1 -0
- package/dist/tests/updates.tests.d.ts +24 -0
- package/dist/tests/updates.tests.d.ts.map +1 -0
- package/dist/tests/y-array.tests.d.ts +45 -0
- package/dist/tests/y-array.tests.d.ts.map +1 -0
- package/dist/tests/y-map.tests.d.ts +45 -0
- package/dist/tests/y-map.tests.d.ts.map +1 -0
- package/dist/tests/y-text.tests.d.ts +49 -0
- package/dist/tests/y-text.tests.d.ts.map +1 -0
- package/dist/tests/y-xml.tests.d.ts +15 -0
- package/dist/tests/y-xml.tests.d.ts.map +1 -0
- package/dist/yjs.cjs +151 -0
- package/dist/yjs.cjs.map +1 -0
- package/dist/yjs.mjs +26 -0
- package/dist/yjs.mjs.map +1 -0
- package/package.json +101 -0
- package/src/index.js +153 -0
- package/src/internals.js +44 -0
- package/src/structs/AbstractStruct.js +59 -0
- package/src/structs/ContentAny.js +115 -0
- package/src/structs/ContentBinary.js +93 -0
- package/src/structs/ContentDeleted.js +101 -0
- package/src/structs/ContentDoc.js +141 -0
- package/src/structs/ContentEmbed.js +98 -0
- package/src/structs/ContentFormat.js +105 -0
- package/src/structs/ContentJSON.js +119 -0
- package/src/structs/ContentString.js +113 -0
- package/src/structs/ContentType.js +176 -0
- package/src/structs/GC.js +80 -0
- package/src/structs/Item.js +845 -0
- package/src/structs/Skip.js +75 -0
- package/src/types/AbstractType.js +1434 -0
- package/src/types/YArray.js +270 -0
- package/src/types/YMap.js +244 -0
- package/src/types/YText.js +934 -0
- package/src/types/YXmlElement.js +227 -0
- package/src/types/YXmlFragment.js +266 -0
- package/src/types/YXmlHook.js +68 -0
- package/src/types/YXmlText.js +66 -0
- package/src/utils/AbstractConnector.js +25 -0
- package/src/utils/AttributionManager.js +619 -0
- package/src/utils/Doc.js +372 -0
- package/src/utils/EventHandler.js +87 -0
- package/src/utils/ID.js +89 -0
- package/src/utils/IdMap.js +629 -0
- package/src/utils/IdSet.js +823 -0
- package/src/utils/RelativePosition.js +352 -0
- package/src/utils/Snapshot.js +220 -0
- package/src/utils/StructSet.js +137 -0
- package/src/utils/StructStore.js +289 -0
- package/src/utils/Transaction.js +489 -0
- package/src/utils/UndoManager.js +391 -0
- package/src/utils/UpdateDecoder.js +281 -0
- package/src/utils/UpdateEncoder.js +320 -0
- package/src/utils/YEvent.js +216 -0
- package/src/utils/delta-helpers.js +54 -0
- package/src/utils/encoding.js +623 -0
- package/src/utils/isParentOf.js +21 -0
- package/src/utils/logging.js +21 -0
- package/src/utils/types.js +28 -0
- package/src/utils/updates.js +715 -0
- package/tests/testHelper.js +600 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
export const attributionJsonSchema: s.Schema<{
|
|
2
|
+
insert?: string[] | undefined;
|
|
3
|
+
insertedAt?: number | undefined;
|
|
4
|
+
delete?: string[] | undefined;
|
|
5
|
+
deletedAt?: number | undefined;
|
|
6
|
+
format?: {
|
|
7
|
+
[x: string]: string[];
|
|
8
|
+
} | undefined;
|
|
9
|
+
formatAt?: number | undefined;
|
|
10
|
+
}>;
|
|
11
|
+
export function createAttributionFromAttributionItems(attrs: Array<import("./IdMap.js").AttributionItem<any>> | null, deleted: boolean): Attribution | null;
|
|
12
|
+
/**
|
|
13
|
+
* @template T
|
|
14
|
+
*/
|
|
15
|
+
export class AttributedContent<T> {
|
|
16
|
+
/**
|
|
17
|
+
* @param {AbstractContent} content
|
|
18
|
+
* @param {number} clock
|
|
19
|
+
* @param {boolean} deleted
|
|
20
|
+
* @param {Array<import('./IdMap.js').AttributionItem<T>> | null} attrs
|
|
21
|
+
* @param {0|1|2} renderBehavior
|
|
22
|
+
*/
|
|
23
|
+
constructor(content: AbstractContent, clock: number, deleted: boolean, attrs: Array<import("./IdMap.js").AttributionItem<T>> | null, renderBehavior: 0 | 1 | 2);
|
|
24
|
+
content: AbstractContent;
|
|
25
|
+
clock: number;
|
|
26
|
+
deleted: boolean;
|
|
27
|
+
attrs: import("./IdMap.js").AttributionItem<T>[] | null;
|
|
28
|
+
render: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Abstract class for associating Attributions to content / changes
|
|
32
|
+
*
|
|
33
|
+
* Should fire an event when the attributions changed _after_ the original change happens. This
|
|
34
|
+
* Event will be used to update the attribution on the current content.
|
|
35
|
+
*
|
|
36
|
+
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
|
37
|
+
*/
|
|
38
|
+
export class AbstractAttributionManager extends ObservableV2<{
|
|
39
|
+
change: (idset: IdSet, origin: any, local: boolean) => void;
|
|
40
|
+
}> {
|
|
41
|
+
constructor();
|
|
42
|
+
/**
|
|
43
|
+
* @param {Array<AttributedContent<any>>} _contents - where to write the result
|
|
44
|
+
* @param {number} _client
|
|
45
|
+
* @param {number} _clock
|
|
46
|
+
* @param {boolean} _deleted
|
|
47
|
+
* @param {AbstractContent} _content
|
|
48
|
+
* @param {0|1|2} _shouldRender - 0: if undeleted or attributed, render as a retain operation. 1: render only if undeleted or attributed. 2: render as insert operation (if unattributed and deleted, render as delete).
|
|
49
|
+
*/
|
|
50
|
+
readContent(_contents: Array<AttributedContent<any>>, _client: number, _clock: number, _deleted: boolean, _content: AbstractContent, _shouldRender: 0 | 1 | 2): void;
|
|
51
|
+
/**
|
|
52
|
+
* Calculate the length of the attributed content. This is used by iterators that walk through the
|
|
53
|
+
* content.
|
|
54
|
+
*
|
|
55
|
+
* If the content is not countable, it should return 0.
|
|
56
|
+
*
|
|
57
|
+
* @param {Item} _item
|
|
58
|
+
* @return {number}
|
|
59
|
+
*/
|
|
60
|
+
contentLength(_item: Item): number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @implements AbstractAttributionManager
|
|
64
|
+
*
|
|
65
|
+
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
|
66
|
+
*/
|
|
67
|
+
export class TwosetAttributionManager extends ObservableV2<{
|
|
68
|
+
change: (idset: IdSet, origin: any, local: boolean) => void;
|
|
69
|
+
}> implements AbstractAttributionManager {
|
|
70
|
+
/**
|
|
71
|
+
* @param {IdMap<any>} inserts
|
|
72
|
+
* @param {IdMap<any>} deletes
|
|
73
|
+
*/
|
|
74
|
+
constructor(inserts: IdMap<any>, deletes: IdMap<any>);
|
|
75
|
+
inserts: IdMap<any>;
|
|
76
|
+
deletes: IdMap<any>;
|
|
77
|
+
/**
|
|
78
|
+
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
|
79
|
+
* @param {number} client
|
|
80
|
+
* @param {number} clock
|
|
81
|
+
* @param {boolean} deleted
|
|
82
|
+
* @param {AbstractContent} content
|
|
83
|
+
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
|
|
84
|
+
*/
|
|
85
|
+
readContent(contents: Array<AttributedContent<any>>, client: number, clock: number, deleted: boolean, content: AbstractContent, shouldRender: 0 | 1 | 2): void;
|
|
86
|
+
/**
|
|
87
|
+
* @param {Item} item
|
|
88
|
+
* @return {number}
|
|
89
|
+
*/
|
|
90
|
+
contentLength(item: Item): number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Abstract class for associating Attributions to content / changes
|
|
94
|
+
*
|
|
95
|
+
* @implements AbstractAttributionManager
|
|
96
|
+
*
|
|
97
|
+
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
|
98
|
+
*/
|
|
99
|
+
export class NoAttributionsManager extends ObservableV2<{
|
|
100
|
+
change: (idset: IdSet, origin: any, local: boolean) => void;
|
|
101
|
+
}> implements AbstractAttributionManager {
|
|
102
|
+
constructor();
|
|
103
|
+
/**
|
|
104
|
+
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
|
105
|
+
* @param {number} _client
|
|
106
|
+
* @param {number} clock
|
|
107
|
+
* @param {boolean} deleted
|
|
108
|
+
* @param {AbstractContent} content
|
|
109
|
+
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
|
|
110
|
+
*/
|
|
111
|
+
readContent(contents: Array<AttributedContent<any>>, _client: number, clock: number, deleted: boolean, content: AbstractContent, shouldRender: 0 | 1 | 2): void;
|
|
112
|
+
/**
|
|
113
|
+
* @param {Item} item
|
|
114
|
+
* @return {number}
|
|
115
|
+
*/
|
|
116
|
+
contentLength(item: Item): number;
|
|
117
|
+
}
|
|
118
|
+
export const noAttributionsManager: NoAttributionsManager;
|
|
119
|
+
/**
|
|
120
|
+
* @implements AbstractAttributionManager
|
|
121
|
+
*
|
|
122
|
+
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
|
123
|
+
*/
|
|
124
|
+
export class DiffAttributionManager extends ObservableV2<{
|
|
125
|
+
change: (idset: IdSet, origin: any, local: boolean) => void;
|
|
126
|
+
}> implements AbstractAttributionManager {
|
|
127
|
+
/**
|
|
128
|
+
* @param {Doc} prevDoc
|
|
129
|
+
* @param {Doc} nextDoc
|
|
130
|
+
*/
|
|
131
|
+
constructor(prevDoc: Doc, nextDoc: Doc);
|
|
132
|
+
inserts: IdMap<any>;
|
|
133
|
+
deletes: IdMap<any>;
|
|
134
|
+
_prevDoc: Doc;
|
|
135
|
+
_prevDocStore: StructStore;
|
|
136
|
+
_nextDoc: Doc;
|
|
137
|
+
_nextBOH: (arg0: Transaction, arg1: Doc) => void;
|
|
138
|
+
_prevBOH: (arg0: Transaction, arg1: Doc) => void;
|
|
139
|
+
_prevUpdateListener: (arg0: Uint8Array<ArrayBuffer>, arg1: any, arg2: Doc, arg3: Transaction) => void;
|
|
140
|
+
_ndUpdateListener: (arg0: Uint8Array<ArrayBuffer>, arg1: any, arg2: Doc, arg3: Transaction) => void;
|
|
141
|
+
_afterTrListener: (arg0: Transaction, arg1: Doc) => void;
|
|
142
|
+
suggestionMode: boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Optionally limit origins that may sync changes to the main doc if suggestion-mode is
|
|
145
|
+
* disabled.
|
|
146
|
+
*
|
|
147
|
+
* @type {Array<any>?}
|
|
148
|
+
*/
|
|
149
|
+
suggestionOrigins: Array<any> | null;
|
|
150
|
+
_destroyHandler: (arg0: Doc) => void;
|
|
151
|
+
/**
|
|
152
|
+
* @param {ID} start
|
|
153
|
+
* @param {ID} end
|
|
154
|
+
*/
|
|
155
|
+
acceptChanges(start: ID, end?: ID): void;
|
|
156
|
+
/**
|
|
157
|
+
* @param {ID} start
|
|
158
|
+
* @param {ID} end
|
|
159
|
+
*/
|
|
160
|
+
rejectChanges(start: ID, end?: ID): void;
|
|
161
|
+
/**
|
|
162
|
+
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
|
163
|
+
* @param {number} client
|
|
164
|
+
* @param {number} clock
|
|
165
|
+
* @param {boolean} deleted
|
|
166
|
+
* @param {AbstractContent} _content
|
|
167
|
+
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
|
|
168
|
+
*/
|
|
169
|
+
readContent(contents: Array<AttributedContent<any>>, client: number, clock: number, deleted: boolean, _content: AbstractContent, shouldRender: 0 | 1 | 2): void;
|
|
170
|
+
/**
|
|
171
|
+
* @param {Item} item
|
|
172
|
+
* @return {number}
|
|
173
|
+
*/
|
|
174
|
+
contentLength(item: Item): number;
|
|
175
|
+
}
|
|
176
|
+
export function createAttributionManagerFromDiff(prevDoc: Doc, nextDoc: Doc): DiffAttributionManager;
|
|
177
|
+
/**
|
|
178
|
+
* Intended for projects that used the v13 snapshot feature. With this AttributionManager you can
|
|
179
|
+
* read content similar to the previous snapshot api. Requires that `ydoc.gc` is turned off.
|
|
180
|
+
*
|
|
181
|
+
* @implements AbstractAttributionManager
|
|
182
|
+
*
|
|
183
|
+
* @extends {ObservableV2<{change:(idset:IdSet,origin:any,local:boolean)=>void}>}
|
|
184
|
+
*/
|
|
185
|
+
export class SnapshotAttributionManager extends ObservableV2<{
|
|
186
|
+
change: (idset: IdSet, origin: any, local: boolean) => void;
|
|
187
|
+
}> implements AbstractAttributionManager {
|
|
188
|
+
/**
|
|
189
|
+
* @param {Snapshot} prevSnapshot
|
|
190
|
+
* @param {Snapshot} nextSnapshot
|
|
191
|
+
*/
|
|
192
|
+
constructor(prevSnapshot: Snapshot, nextSnapshot: Snapshot);
|
|
193
|
+
prevSnapshot: Snapshot;
|
|
194
|
+
nextSnapshot: Snapshot;
|
|
195
|
+
attrs: IdMap<any>;
|
|
196
|
+
/**
|
|
197
|
+
* @param {Array<AttributedContent<any>>} contents - where to write the result
|
|
198
|
+
* @param {number} client
|
|
199
|
+
* @param {number} clock
|
|
200
|
+
* @param {boolean} _deleted
|
|
201
|
+
* @param {AbstractContent} content
|
|
202
|
+
* @param {0|1|2} shouldRender - whether this should render or just result in a `retain` operation
|
|
203
|
+
*/
|
|
204
|
+
readContent(contents: Array<AttributedContent<any>>, client: number, clock: number, _deleted: boolean, content: AbstractContent, shouldRender: 0 | 1 | 2): void;
|
|
205
|
+
/**
|
|
206
|
+
* @param {Item} item
|
|
207
|
+
* @return {number}
|
|
208
|
+
*/
|
|
209
|
+
contentLength(item: Item): number;
|
|
210
|
+
}
|
|
211
|
+
export function createAttributionManagerFromSnapshots(prevSnapshot: Snapshot, nextSnapshot?: Snapshot): SnapshotAttributionManager;
|
|
212
|
+
export type Attribution = s.Unwrap<typeof attributionJsonSchema>;
|
|
213
|
+
import * as s from 'lib0/schema';
|
|
214
|
+
import { AbstractContent } from '../internals.js';
|
|
215
|
+
import { IdSet } from '../internals.js';
|
|
216
|
+
import { ObservableV2 } from 'lib0/observable';
|
|
217
|
+
import { Item } from '../internals.js';
|
|
218
|
+
import { IdMap } from '../internals.js';
|
|
219
|
+
import { Doc } from '../internals.js';
|
|
220
|
+
import { StructStore } from '../internals.js';
|
|
221
|
+
import { Transaction } from '../internals.js';
|
|
222
|
+
import { ID } from '../internals.js';
|
|
223
|
+
import { Snapshot } from '../internals.js';
|
|
224
|
+
//# sourceMappingURL=AttributionManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttributionManager.d.ts","sourceRoot":"","sources":["../../../src/utils/AttributionManager.js"],"names":[],"mappings":"AAmCA;;;;;;;;;GAOE;AAcK,6DAJI,KAAK,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,GAAG,CAAC,CAAC,OAAC,WACjD,OAAO,GACN,WAAW,OAAC,CAiCvB;AAED;;GAEG;AACH,+BAFa,CAAC;IAGZ;;;;;;OAMG;IACH,qBANW,eAAe,SACf,MAAM,WACN,OAAO,SACP,KAAK,CAAC,OAAO,YAAY,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,kBACrD,CAAC,GAAC,CAAC,GAAC,CAAC,EAQf;IALC,yBAAsB;IACtB,cAAkB;IAClB,iBAAsB;IACtB,wDAAkB;IAClB,gBAAwG;CAE3G;AAED;;;;;;;GAOG;AACH;YAFkC,CAAC,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,GAAG,EAAC,KAAK,EAAC,OAAO,KAAG,IAAI;;;IAG5E;;;;;;;OAOG;IACH,uBAPW,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,WAC7B,MAAM,UACN,MAAM,YACN,OAAO,YACP,eAAe,iBACf,CAAC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Id: typeof random.uint32;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {import('../utils/types.js').YTypeConstructors} YTypeConstructors
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('../utils/types.js').YType} YType
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} DocOpts
|
|
10
|
+
* @property {boolean} [DocOpts.gc=true] Disable garbage collection (default: gc=true)
|
|
11
|
+
* @property {function(Item):boolean} [DocOpts.gcFilter] Will be called before an Item is garbage collected. Return false to keep the Item.
|
|
12
|
+
* @property {string} [DocOpts.guid] Define a globally unique identifier for this document
|
|
13
|
+
* @property {string | null} [DocOpts.collectionid] Associate this document with a collection. This only plays a role if your provider has a concept of collection.
|
|
14
|
+
* @property {any} [DocOpts.meta] Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well.
|
|
15
|
+
* @property {boolean} [DocOpts.autoLoad] If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically.
|
|
16
|
+
* @property {boolean} [DocOpts.shouldLoad] Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load()
|
|
17
|
+
* @property {boolean} [DocOpts.isSuggestionDoc] Set to true if this document merely suggests
|
|
18
|
+
* changes. If this flag is not set in a suggestion document, automatic formatting changes will be
|
|
19
|
+
* displayed as suggestions, which might not be intended.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* @typedef {Object} DocEvents
|
|
23
|
+
* @property {function(Doc):void} DocEvents.destroy
|
|
24
|
+
* @property {function(Doc):void} DocEvents.load
|
|
25
|
+
* @property {function(boolean, Doc):void} DocEvents.sync
|
|
26
|
+
* @property {function(Uint8Array<ArrayBuffer>, any, Doc, Transaction):void} DocEvents.update
|
|
27
|
+
* @property {function(Uint8Array<ArrayBuffer>, any, Doc, Transaction):void} DocEvents.updateV2
|
|
28
|
+
* @property {function(Doc):void} DocEvents.beforeAllTransactions
|
|
29
|
+
* @property {function(Transaction, Doc):void} DocEvents.beforeTransaction
|
|
30
|
+
* @property {function(Transaction, Doc):void} DocEvents.beforeObserverCalls
|
|
31
|
+
* @property {function(Transaction, Doc):void} DocEvents.afterTransaction
|
|
32
|
+
* @property {function(Transaction, Doc):void} DocEvents.afterTransactionCleanup
|
|
33
|
+
* @property {function(Doc, Array<Transaction>):void} DocEvents.afterAllTransactions
|
|
34
|
+
* @property {function({ loaded: Set<Doc>, added: Set<Doc>, removed: Set<Doc> }, Doc, Transaction):void} DocEvents.subdocs
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* A Yjs instance handles the state of shared data.
|
|
38
|
+
* @extends ObservableV2<DocEvents>
|
|
39
|
+
*/
|
|
40
|
+
export class Doc extends ObservableV2<DocEvents> {
|
|
41
|
+
/**
|
|
42
|
+
* @param {DocOpts} opts configuration
|
|
43
|
+
*/
|
|
44
|
+
constructor({ guid, collectionid, gc, gcFilter, meta, autoLoad, shouldLoad, isSuggestionDoc }?: DocOpts);
|
|
45
|
+
gc: boolean;
|
|
46
|
+
gcFilter: (arg0: Item) => boolean;
|
|
47
|
+
clientID: number;
|
|
48
|
+
guid: string;
|
|
49
|
+
collectionid: string | null;
|
|
50
|
+
isSuggestionDoc: boolean;
|
|
51
|
+
cleanupFormatting: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* @type {Map<string, YType>}
|
|
54
|
+
*/
|
|
55
|
+
share: Map<string, YType>;
|
|
56
|
+
store: StructStore;
|
|
57
|
+
/**
|
|
58
|
+
* @type {Transaction | null}
|
|
59
|
+
*/
|
|
60
|
+
_transaction: Transaction | null;
|
|
61
|
+
/**
|
|
62
|
+
* @type {Array<Transaction>}
|
|
63
|
+
*/
|
|
64
|
+
_transactionCleanups: Array<Transaction>;
|
|
65
|
+
/**
|
|
66
|
+
* @type {Set<Doc>}
|
|
67
|
+
*/
|
|
68
|
+
subdocs: Set<Doc>;
|
|
69
|
+
/**
|
|
70
|
+
* If this document is a subdocument - a document integrated into another document - then _item is defined.
|
|
71
|
+
* @type {Item?}
|
|
72
|
+
*/
|
|
73
|
+
_item: Item | null;
|
|
74
|
+
shouldLoad: boolean;
|
|
75
|
+
autoLoad: boolean;
|
|
76
|
+
meta: any;
|
|
77
|
+
/**
|
|
78
|
+
* This is set to true when the persistence provider loaded the document from the database or when the `sync` event fires.
|
|
79
|
+
* Note that not all providers implement this feature. Provider authors are encouraged to fire the `load` event when the doc content is loaded from the database.
|
|
80
|
+
*
|
|
81
|
+
* @type {boolean}
|
|
82
|
+
*/
|
|
83
|
+
isLoaded: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* This is set to true when the connection provider has successfully synced with a backend.
|
|
86
|
+
* Note that when using peer-to-peer providers this event may not provide very useful.
|
|
87
|
+
* Also note that not all providers implement this feature. Provider authors are encouraged to fire
|
|
88
|
+
* the `sync` event when the doc has been synced (with `true` as a parameter) or if connection is
|
|
89
|
+
* lost (with false as a parameter).
|
|
90
|
+
*/
|
|
91
|
+
isSynced: boolean;
|
|
92
|
+
isDestroyed: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* Promise that resolves once the document has been loaded from a persistence provider.
|
|
95
|
+
*/
|
|
96
|
+
whenLoaded: Promise<any>;
|
|
97
|
+
whenSynced: Promise<any>;
|
|
98
|
+
/**
|
|
99
|
+
* Notify the parent document that you request to load data into this subdocument (if it is a subdocument).
|
|
100
|
+
*
|
|
101
|
+
* `load()` might be used in the future to request any provider to load the most current data.
|
|
102
|
+
*
|
|
103
|
+
* It is safe to call `load()` multiple times.
|
|
104
|
+
*/
|
|
105
|
+
load(): void;
|
|
106
|
+
getSubdocs(): Set<Doc>;
|
|
107
|
+
getSubdocGuids(): Set<string>;
|
|
108
|
+
/**
|
|
109
|
+
* Changes that happen inside of a transaction are bundled. This means that
|
|
110
|
+
* the observer fires _after_ the transaction is finished and that all changes
|
|
111
|
+
* that happened inside of the transaction are sent as one message to the
|
|
112
|
+
* other peers.
|
|
113
|
+
*
|
|
114
|
+
* @template T
|
|
115
|
+
* @param {function(Transaction):T} f The function that should be executed as a transaction
|
|
116
|
+
* @param {any} [origin] Origin of who started the transaction. Will be stored on transaction.origin
|
|
117
|
+
* @return T
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
public transact<T>(f: (arg0: Transaction) => T, origin?: any): T;
|
|
122
|
+
/**
|
|
123
|
+
* Define a shared data type.
|
|
124
|
+
*
|
|
125
|
+
* Multiple calls of `ydoc.get(name, TypeConstructor)` yield the same result
|
|
126
|
+
* and do not overwrite each other. I.e.
|
|
127
|
+
* `ydoc.get(name, Y.Array) === ydoc.get(name, Y.Array)`
|
|
128
|
+
*
|
|
129
|
+
* After this method is called, the type is also available on `ydoc.share.get(name)`.
|
|
130
|
+
*
|
|
131
|
+
* *Best Practices:*
|
|
132
|
+
* Define all types right after the Y.Doc instance is created and store them in a separate object.
|
|
133
|
+
* Also use the typed methods `getText(name)`, `getArray(name)`, ..
|
|
134
|
+
*
|
|
135
|
+
* @template {YTypeConstructors} [TypeC=typeof AbstractType]
|
|
136
|
+
* @example
|
|
137
|
+
* const ydoc = new Y.Doc(..)
|
|
138
|
+
* const appState = {
|
|
139
|
+
* document: ydoc.getText('document')
|
|
140
|
+
* comments: ydoc.getArray('comments')
|
|
141
|
+
* }
|
|
142
|
+
*
|
|
143
|
+
* @param {string} name
|
|
144
|
+
* @param {TypeC} TypeConstructor The constructor of the type definition. E.g. Y.Text, Y.Array, Y.Map, ...
|
|
145
|
+
* @return {AbstractType} The created type. Constructed with TypeConstructor
|
|
146
|
+
*
|
|
147
|
+
* @public
|
|
148
|
+
*/
|
|
149
|
+
public get<TypeC extends YTypeConstructors = typeof AbstractType>(name: string, TypeConstructor?: TypeC): AbstractType;
|
|
150
|
+
/**
|
|
151
|
+
* @template T
|
|
152
|
+
* @param {string} [name]
|
|
153
|
+
* @return {YArray<T>}
|
|
154
|
+
*
|
|
155
|
+
* @public
|
|
156
|
+
*/
|
|
157
|
+
public getArray<T>(name?: string): YArray<T>;
|
|
158
|
+
/**
|
|
159
|
+
* @param {string} [name]
|
|
160
|
+
* @return {YText}
|
|
161
|
+
*
|
|
162
|
+
* @public
|
|
163
|
+
*/
|
|
164
|
+
public getText(name?: string): YText;
|
|
165
|
+
/**
|
|
166
|
+
* @template T
|
|
167
|
+
* @param {string} [name]
|
|
168
|
+
* @return {YMap<T>}
|
|
169
|
+
*
|
|
170
|
+
* @public
|
|
171
|
+
*/
|
|
172
|
+
public getMap<T>(name?: string): YMap<T>;
|
|
173
|
+
/**
|
|
174
|
+
* @param {string} [name]
|
|
175
|
+
* @return {YXmlElement}
|
|
176
|
+
*
|
|
177
|
+
* @public
|
|
178
|
+
*/
|
|
179
|
+
public getXmlElement(name?: string): YXmlElement;
|
|
180
|
+
/**
|
|
181
|
+
* @param {string} [name]
|
|
182
|
+
* @return {YXmlFragment}
|
|
183
|
+
*
|
|
184
|
+
* @public
|
|
185
|
+
*/
|
|
186
|
+
public getXmlFragment(name?: string): YXmlFragment;
|
|
187
|
+
/**
|
|
188
|
+
* Converts the entire document into a js object, recursively traversing each yjs type
|
|
189
|
+
* Doesn't log types that have not been defined (using ydoc.getType(..)).
|
|
190
|
+
*
|
|
191
|
+
* @deprecated Do not use this method and rather call toJSON directly on the shared types.
|
|
192
|
+
*
|
|
193
|
+
* @return {Object<string, any>}
|
|
194
|
+
*/
|
|
195
|
+
toJSON(): {
|
|
196
|
+
[x: string]: any;
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
export function cloneDoc(ydoc: Doc, opts?: DocOpts): Doc;
|
|
200
|
+
export type YTypeConstructors = import("../utils/types.js").YTypeConstructors;
|
|
201
|
+
export type YType = import("../utils/types.js").YType;
|
|
202
|
+
export type DocOpts = {
|
|
203
|
+
/**
|
|
204
|
+
* Disable garbage collection (default: gc=true)
|
|
205
|
+
*/
|
|
206
|
+
gc?: boolean | undefined;
|
|
207
|
+
/**
|
|
208
|
+
* Will be called before an Item is garbage collected. Return false to keep the Item.
|
|
209
|
+
*/
|
|
210
|
+
gcFilter?: ((arg0: Item) => boolean) | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Define a globally unique identifier for this document
|
|
213
|
+
*/
|
|
214
|
+
guid?: string | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* Associate this document with a collection. This only plays a role if your provider has a concept of collection.
|
|
217
|
+
*/
|
|
218
|
+
collectionid?: string | null | undefined;
|
|
219
|
+
/**
|
|
220
|
+
* Any kind of meta information you want to associate with this document. If this is a subdocument, remote peers will store the meta information as well.
|
|
221
|
+
*/
|
|
222
|
+
meta?: any;
|
|
223
|
+
/**
|
|
224
|
+
* If a subdocument, automatically load document. If this is a subdocument, remote peers will load the document as well automatically.
|
|
225
|
+
*/
|
|
226
|
+
autoLoad?: boolean | undefined;
|
|
227
|
+
/**
|
|
228
|
+
* Whether the document should be synced by the provider now. This is toggled to true when you call ydoc.load()
|
|
229
|
+
*/
|
|
230
|
+
shouldLoad?: boolean | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* Set to true if this document merely suggests
|
|
233
|
+
* changes. If this flag is not set in a suggestion document, automatic formatting changes will be
|
|
234
|
+
* displayed as suggestions, which might not be intended.
|
|
235
|
+
*/
|
|
236
|
+
isSuggestionDoc?: boolean | undefined;
|
|
237
|
+
};
|
|
238
|
+
export type DocEvents = {
|
|
239
|
+
destroy: (arg0: Doc) => void;
|
|
240
|
+
load: (arg0: Doc) => void;
|
|
241
|
+
sync: (arg0: boolean, arg1: Doc) => void;
|
|
242
|
+
update: (arg0: Uint8Array<ArrayBuffer>, arg1: any, arg2: Doc, arg3: Transaction) => void;
|
|
243
|
+
updateV2: (arg0: Uint8Array<ArrayBuffer>, arg1: any, arg2: Doc, arg3: Transaction) => void;
|
|
244
|
+
beforeAllTransactions: (arg0: Doc) => void;
|
|
245
|
+
beforeTransaction: (arg0: Transaction, arg1: Doc) => void;
|
|
246
|
+
beforeObserverCalls: (arg0: Transaction, arg1: Doc) => void;
|
|
247
|
+
afterTransaction: (arg0: Transaction, arg1: Doc) => void;
|
|
248
|
+
afterTransactionCleanup: (arg0: Transaction, arg1: Doc) => void;
|
|
249
|
+
afterAllTransactions: (arg0: Doc, arg1: Array<Transaction>) => void;
|
|
250
|
+
subdocs: (arg0: {
|
|
251
|
+
loaded: Set<Doc>;
|
|
252
|
+
added: Set<Doc>;
|
|
253
|
+
removed: Set<Doc>;
|
|
254
|
+
}, arg1: Doc, arg2: Transaction) => void;
|
|
255
|
+
};
|
|
256
|
+
import * as random from 'lib0/random';
|
|
257
|
+
import { ObservableV2 } from 'lib0/observable';
|
|
258
|
+
import { Item } from '../internals.js';
|
|
259
|
+
import { StructStore } from '../internals.js';
|
|
260
|
+
import { Transaction } from '../internals.js';
|
|
261
|
+
import { AbstractType } from '../internals.js';
|
|
262
|
+
import { YArray } from '../internals.js';
|
|
263
|
+
import { YText } from '../internals.js';
|
|
264
|
+
import { YMap } from '../internals.js';
|
|
265
|
+
import { YXmlElement } from '../internals.js';
|
|
266
|
+
import { YXmlFragment } from '../internals.js';
|
|
267
|
+
//# sourceMappingURL=Doc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Doc.d.ts","sourceRoot":"","sources":["../../../src/utils/Doc.js"],"names":[],"mappings":"AAwBA,uDAAgD;AAEhD;;GAEG;AACH;;GAEG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;;;;;;;;GAcG;AAEH;;;GAGG;AACH;IACE;;OAEG;IACH,gGAFW,OAAO,EAwFjB;IApFC,YAAY;IACZ,iBAtCmB,IAAI,KAAE,OAAO,CAsCR;IACxB,iBAAqC;IACrC,aAAgB;IAChB,4BAAgC;IAChC,yBAAsC;IACtC,2BAAyC;IACzC;;OAEG;IACH,OAFU,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAEN;IACtB,mBAA8B;IAC9B;;OAEG;IACH,cAFU,WAAW,GAAG,IAAI,CAEJ;IACxB;;OAEG;IACH,sBAFU,KAAK,CAAC,WAAW,CAAC,C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|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export class EventHandler<ARG0, ARG1> {
|
|
9
|
+
/**
|
|
10
|
+
* @type {Array<function(ARG0, ARG1):void>}
|
|
11
|
+
*/
|
|
12
|
+
l: Array<(arg0: ARG0, arg1: ARG1) => void>;
|
|
13
|
+
}
|
|
14
|
+
export function createEventHandler<ARG0, ARG1>(): EventHandler<ARG0, ARG1>;
|
|
15
|
+
export function addEventHandlerListener<ARG0, ARG1>(eventHandler: EventHandler<ARG0, ARG1>, f: (arg0: ARG0, arg1: ARG1) => void): number;
|
|
16
|
+
export function removeEventHandlerListener<ARG0, ARG1>(eventHandler: EventHandler<ARG0, ARG1>, f: (arg0: ARG0, arg1: ARG1) => void): void;
|
|
17
|
+
export function removeAllEventHandlerListeners<ARG0, ARG1>(eventHandler: EventHandler<ARG0, ARG1>): void;
|
|
18
|
+
export function callEventHandlerListeners<ARG0, ARG1>(eventHandler: EventHandler<ARG0, ARG1>, arg0: ARG0, arg1: ARG1): void;
|
|
19
|
+
//# sourceMappingURL=EventHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EventHandler.d.ts","sourceRoot":"","sources":["../../../src/utils/EventHandler.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,0BAJa,IAAI,EAAE,IAAI;IAMnB;;OAEG;IACH,GAFU,KAAK,CAAC,CAAS,IAAI,EAAJ,IAAI,EAAE,IAAI,EAAJ,IAAI,KAAE,IAAI,CAAC,CAE/B;CAEd;AASM,mCANM,IAAI,EAAC,IAAI,KACT,YAAY,CAAC,IAAI,EAAC,IAAI,CAAC,CAKsB;AAanD,wCAPM,IAAI,EAAC,IAAI,gBACX,YAAY,CAAC,IAAI,EAAC,IAAI,CAAC,KACvB,CAAS,IAAI,EAAJ,IAAI,EAAC,IAAI,EAAJ,IAAI,KAAE,IAAI,UAMX;AAajB,2CARM,IAAI,EAAC,IAAI,gBACX,YAAY,CAAC,IAAI,EAAC,IAAI,CAAC,KACvB,CAAS,IAAI,EAAJ,IAAI,EAAC,IAAI,EAAJ,IAAI,KAAE,IAAI,QAalC;AAUM,+CANM,IAAI,EAAC,IAAI,gBACX,YAAY,CAAC,IAAI,EAAC,IAAI,CAAC,QAOjC;AAcM,0CARM,IAAI,EAAC,IAAI,gBACX,YAAY,CAAC,IAAI,EAAC,IAAI,CAAC,QACvB,IAAI,QACJ,IAAI,QAM0B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class ID {
|
|
2
|
+
/**
|
|
3
|
+
* @param {number} client client id
|
|
4
|
+
* @param {number} clock unique per client id, continuous number
|
|
5
|
+
*/
|
|
6
|
+
constructor(client: number, clock: number);
|
|
7
|
+
/**
|
|
8
|
+
* Client id
|
|
9
|
+
* @type {number}
|
|
10
|
+
*/
|
|
11
|
+
client: number;
|
|
12
|
+
/**
|
|
13
|
+
* unique per client id, continuous number
|
|
14
|
+
* @type {number}
|
|
15
|
+
*/
|
|
16
|
+
clock: number;
|
|
17
|
+
}
|
|
18
|
+
export function compareIDs(a: ID | null, b: ID | null): boolean;
|
|
19
|
+
export function createID(client: number, clock: number): ID;
|
|
20
|
+
export function writeID(encoder: encoding.Encoder, id: ID): void;
|
|
21
|
+
export function readID(decoder: decoding.Decoder): ID;
|
|
22
|
+
export function findRootTypeKey(type: AbstractType<any>): string;
|
|
23
|
+
import * as encoding from 'lib0/encoding';
|
|
24
|
+
import * as decoding from 'lib0/decoding';
|
|
25
|
+
import { AbstractType } from '../internals.js';
|
|
26
|
+
//# sourceMappingURL=ID.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ID.d.ts","sourceRoot":"","sources":["../../../src/utils/ID.js"],"names":[],"mappings":"AAMA;IACE;;;OAGG;IACH,oBAHW,MAAM,SACN,MAAM,EAahB;IAVC;;;OAGG;IACH,QAFU,MAAM,CAEI;IACpB;;;OAGG;IACH,OAFU,MAAM,CAEE;CAErB;AASM,8BANI,EAAE,GAAG,IAAI,KACT,EAAE,GAAG,IAAI,GACR,OAAO,CAIsG;AASlH,iCANI,MAAM,SACN,MAAM,MAK+C;AASzD,iCANI,QAAQ,CAAC,OAAO,MAChB,EAAE,QAQZ;AAaM,gCANI,QAAQ,CAAC,OAAO,GACf,EAAE,CAM0D;AAajE,sCANI,YAAY,CAAC,GAAG,CAAC,GAChB,MAAM,CAajB;0BArFyB,eAAe;0BADf,eAAe;6BAFZ,iBAAiB"}
|