loro-crdt 1.2.1 → 1.2.3

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.
@@ -861,6 +861,14 @@ export class LoroCounter {
861
861
  const ret = wasm.lorocounter_getAttached(this.__wbg_ptr);
862
862
  return takeObject(ret);
863
863
  }
864
+ /**
865
+ * Get the value of the counter.
866
+ * @returns {number}
867
+ */
868
+ getShallowValue() {
869
+ const ret = wasm.lorocounter_getShallowValue(this.__wbg_ptr);
870
+ return ret;
871
+ }
864
872
  }
865
873
 
866
874
  const LoroDocFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -1807,18 +1815,13 @@ export class LoroDoc {
1807
1815
  * // get updates from specific version to the latest version
1808
1816
  * const updates2 = doc.exportFrom(version);
1809
1817
  * ```
1810
- * @param {VersionVector | undefined} [vv]
1818
+ * @param {any} vv
1811
1819
  * @returns {Uint8Array}
1812
1820
  */
1813
1821
  exportFrom(vv) {
1814
1822
  try {
1815
1823
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1816
- let ptr0 = 0;
1817
- if (!isLikeNone(vv)) {
1818
- _assertClass(vv, VersionVector);
1819
- ptr0 = vv.__destroy_into_raw();
1820
- }
1821
- wasm.lorodoc_exportFrom(retptr, this.__wbg_ptr, ptr0);
1824
+ wasm.lorodoc_exportFrom(retptr, this.__wbg_ptr, addHeapObject(vv));
1822
1825
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1823
1826
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1824
1827
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1826,9 +1829,9 @@ export class LoroDoc {
1826
1829
  if (r3) {
1827
1830
  throw takeObject(r2);
1828
1831
  }
1829
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
1832
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1830
1833
  wasm.__wbindgen_export_5(r0, r1 * 1, 1);
1831
- return v2;
1834
+ return v1;
1832
1835
  } finally {
1833
1836
  wasm.__wbindgen_add_to_stack_pointer(16);
1834
1837
  }
@@ -1892,24 +1895,14 @@ export class LoroDoc {
1892
1895
  }
1893
1896
  /**
1894
1897
  * Export updates in the given range in JSON format.
1895
- * @param {VersionVector | undefined} [start_vv]
1896
- * @param {VersionVector | undefined} [end_vv]
1898
+ * @param {any} start_vv
1899
+ * @param {any} end_vv
1897
1900
  * @returns {JsonSchema}
1898
1901
  */
1899
1902
  exportJsonUpdates(start_vv, end_vv) {
1900
1903
  try {
1901
1904
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1902
- let ptr0 = 0;
1903
- if (!isLikeNone(start_vv)) {
1904
- _assertClass(start_vv, VersionVector);
1905
- ptr0 = start_vv.__destroy_into_raw();
1906
- }
1907
- let ptr1 = 0;
1908
- if (!isLikeNone(end_vv)) {
1909
- _assertClass(end_vv, VersionVector);
1910
- ptr1 = end_vv.__destroy_into_raw();
1911
- }
1912
- wasm.lorodoc_exportJsonUpdates(retptr, this.__wbg_ptr, ptr0, ptr1);
1905
+ wasm.lorodoc_exportJsonUpdates(retptr, this.__wbg_ptr, addHeapObject(start_vv), addHeapObject(end_vv));
1913
1906
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1914
1907
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1915
1908
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1987,10 +1980,12 @@ export class LoroDoc {
1987
1980
  }
1988
1981
  }
1989
1982
  /**
1990
- * Import a batch of updates.
1983
+ * Import a batch of updates and snapshots.
1991
1984
  *
1992
1985
  * It's more efficient than importing updates one by one.
1993
1986
  *
1987
+ * @deprecated Use `importBatch` instead.
1988
+ *
1994
1989
  * @example
1995
1990
  * ```ts
1996
1991
  * import { LoroDoc } from "loro-crdt";
@@ -2001,9 +1996,9 @@ export class LoroDoc {
2001
1996
  * const updates = doc.export({ mode: "update" });
2002
1997
  * const snapshot = doc.export({ mode: "snapshot" });
2003
1998
  * const doc2 = new LoroDoc();
2004
- * doc2.importUpdateBatch([snapshot, updates]);
1999
+ * doc2.importBatch([snapshot, updates]);
2005
2000
  * ```
2006
- * @param {Array<any>} data
2001
+ * @param {Uint8Array[]} data
2007
2002
  * @returns {ImportStatus}
2008
2003
  */
2009
2004
  importUpdateBatch(data) {
@@ -2022,8 +2017,46 @@ export class LoroDoc {
2022
2017
  }
2023
2018
  }
2024
2019
  /**
2020
+ * Import a batch of updates or snapshots.
2021
+ *
2022
+ * It's more efficient than importing updates one by one.
2023
+ *
2024
+ * @example
2025
+ * ```ts
2026
+ * import { LoroDoc } from "loro-crdt";
2027
+ *
2028
+ * const doc = new LoroDoc();
2029
+ * const text = doc.getText("text");
2030
+ * text.insert(0, "Hello");
2031
+ * const updates = doc.export({ mode: "update" });
2032
+ * const snapshot = doc.export({ mode: "snapshot" });
2033
+ * const doc2 = new LoroDoc();
2034
+ * doc2.importBatch([snapshot, updates]);
2035
+ * ```
2036
+ * @param {Uint8Array[]} data
2037
+ * @returns {ImportStatus}
2038
+ */
2039
+ importBatch(data) {
2040
+ try {
2041
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2042
+ wasm.lorodoc_importBatch(retptr, this.__wbg_ptr, addHeapObject(data));
2043
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2044
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2045
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2046
+ if (r2) {
2047
+ throw takeObject(r1);
2048
+ }
2049
+ return takeObject(r0);
2050
+ } finally {
2051
+ wasm.__wbindgen_add_to_stack_pointer(16);
2052
+ }
2053
+ }
2054
+ /**
2025
2055
  * Get the shallow json format of the document state.
2026
2056
  *
2057
+ * Unlike `toJSON()` which recursively resolves all containers to their values,
2058
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
2059
+ *
2027
2060
  * @example
2028
2061
  * ```ts
2029
2062
  * import { LoroDoc } from "loro-crdt";
@@ -2033,12 +2066,17 @@ export class LoroDoc {
2033
2066
  * const tree = doc.getTree("tree");
2034
2067
  * const map = doc.getMap("map");
2035
2068
  * const shallowValue = doc.getShallowValue();
2036
- * /*
2037
- * {"list": ..., "tree": ..., "map": ...}
2038
- * *\/
2039
2069
  * console.log(shallowValue);
2070
+ * // {
2071
+ * // list: 'cid:root-list:List',
2072
+ * // tree: 'cid:root-tree:Tree',
2073
+ * // map: 'cid:root-map:Map'
2074
+ * // }
2075
+ *
2076
+ * // It points to the same container as `list`
2077
+ * const listB = doc.getContainerById(shallowValue.list);
2040
2078
  * ```
2041
- * @returns {any}
2079
+ * @returns {Record<string, ContainerID>}
2042
2080
  */
2043
2081
  getShallowValue() {
2044
2082
  try {
@@ -2058,9 +2096,12 @@ export class LoroDoc {
2058
2096
  /**
2059
2097
  * Get the json format of the entire document state.
2060
2098
  *
2099
+ * Unlike `getShallowValue()` which returns container IDs as strings,
2100
+ * `toJSON()` recursively resolves all containers to their actual values.
2101
+ *
2061
2102
  * @example
2062
2103
  * ```ts
2063
- * import { LoroDoc, LoroText, LoroMap } from "loro-crdt";
2104
+ * import { LoroDoc, LoroText } from "loro-crdt";
2064
2105
  *
2065
2106
  * const doc = new LoroDoc();
2066
2107
  * const list = doc.getList("list");
@@ -2069,10 +2110,8 @@ export class LoroDoc {
2069
2110
  * text.insert(0, "Hello");
2070
2111
  * const map = list.insertContainer(1, new LoroMap());
2071
2112
  * map.set("foo", "bar");
2072
- * /*
2073
- * {"list": ["Hello", {"foo": "bar"}]}
2074
- * *\/
2075
2113
  * console.log(doc.toJSON());
2114
+ * // {"list": ["Hello", {"foo": "bar"}]}
2076
2115
  * ```
2077
2116
  * @returns {any}
2078
2117
  */
@@ -2827,6 +2866,29 @@ export class LoroList {
2827
2866
  const ret = wasm.lorolist_isDeleted(this.__wbg_ptr);
2828
2867
  return ret !== 0;
2829
2868
  }
2869
+ /**
2870
+ * Get the shallow value of the list.
2871
+ *
2872
+ * Unlike `toJSON()` which recursively resolves all containers to their values,
2873
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
2874
+ *
2875
+ * ```js
2876
+ * const doc = new LoroDoc();
2877
+ * doc.setPeerId("1");
2878
+ * const list = doc.getList("list");
2879
+ * list.insert(0, 1);
2880
+ * list.insert(1, "two");
2881
+ * const subList = list.insertContainer(2, new LoroList());
2882
+ * subList.insert(0, "sub");
2883
+ * list.getShallowValue(); // [1, "two", "cid:2@1:List"]
2884
+ * list.toJSON(); // [1, "two", ["sub"]]
2885
+ * ```
2886
+ * @returns {Value[]}
2887
+ */
2888
+ getShallowValue() {
2889
+ const ret = wasm.lorolist_getShallowValue(this.__wbg_ptr);
2890
+ return takeObject(ret);
2891
+ }
2830
2892
  }
2831
2893
 
2832
2894
  const LoroMapFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -3277,6 +3339,37 @@ export class LoroMap {
3277
3339
  const ret = wasm.loromap_isDeleted(this.__wbg_ptr);
3278
3340
  return ret !== 0;
3279
3341
  }
3342
+ /**
3343
+ * Get the shallow value of the map.
3344
+ *
3345
+ * Unlike `toJSON()` which recursively resolves all containers to their values,
3346
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
3347
+ *
3348
+ * @example
3349
+ * ```ts
3350
+ * import { LoroDoc } from "loro-crdt";
3351
+ *
3352
+ * const doc = new LoroDoc();
3353
+ * doc.setPeerId("1");
3354
+ * const map = doc.getMap("map");
3355
+ * map.set("key", "value");
3356
+ * const subText = map.setContainer("text", new LoroText());
3357
+ * subText.insert(0, "Hello");
3358
+ *
3359
+ * // Get shallow value - nested containers are represented by their IDs
3360
+ * console.log(map.getShallowValue());
3361
+ * // Output: { key: "value", text: "cid:1@1:Text" }
3362
+ *
3363
+ * // Get full value with nested containers resolved by `toJSON()`
3364
+ * console.log(map.toJSON());
3365
+ * // Output: { key: "value", text: "Hello" }
3366
+ * ```
3367
+ * @returns {Record<string, Value>}
3368
+ */
3369
+ getShallowValue() {
3370
+ const ret = wasm.loromap_getShallowValue(this.__wbg_ptr);
3371
+ return takeObject(ret);
3372
+ }
3280
3373
  }
3281
3374
 
3282
3375
  const LoroMovableListFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -3784,6 +3877,29 @@ export class LoroMovableList {
3784
3877
  const ret = wasm.loromovablelist_isDeleted(this.__wbg_ptr);
3785
3878
  return ret !== 0;
3786
3879
  }
3880
+ /**
3881
+ * Get the shallow value of the movable list.
3882
+ *
3883
+ * Unlike `toJSON()` which recursively resolves all containers to their values,
3884
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
3885
+ *
3886
+ * ```js
3887
+ * const doc = new LoroDoc();
3888
+ * doc.setPeerId("1");
3889
+ * const list = doc.getMovableList("list");
3890
+ * list.insert(0, 1);
3891
+ * list.insert(1, "two");
3892
+ * const subList = list.insertContainer(2, new LoroList());
3893
+ * subList.insert(0, "sub");
3894
+ * list.getShallowValue(); // [1, "two", "cid:2@1:List"]
3895
+ * list.toJSON(); // [1, "two", ["sub"]]
3896
+ * ```
3897
+ * @returns {Value[]}
3898
+ */
3899
+ getShallowValue() {
3900
+ const ret = wasm.loromovablelist_getShallowValue(this.__wbg_ptr);
3901
+ return takeObject(ret);
3902
+ }
3787
3903
  }
3788
3904
 
3789
3905
  const LoroTextFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -4439,6 +4555,26 @@ export class LoroText {
4439
4555
  const ret = wasm.lorotext_isDeleted(this.__wbg_ptr);
4440
4556
  return ret !== 0;
4441
4557
  }
4558
+ /**
4559
+ * Get the shallow value of the text. This equals to `text.toString()`.
4560
+ * @returns {string}
4561
+ */
4562
+ getShallowValue() {
4563
+ let deferred1_0;
4564
+ let deferred1_1;
4565
+ try {
4566
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4567
+ wasm.lorotext_getShallowValue(retptr, this.__wbg_ptr);
4568
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4569
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4570
+ deferred1_0 = r0;
4571
+ deferred1_1 = r1;
4572
+ return getStringFromWasm0(r0, r1);
4573
+ } finally {
4574
+ wasm.__wbindgen_add_to_stack_pointer(16);
4575
+ wasm.__wbindgen_export_5(deferred1_0, deferred1_1, 1);
4576
+ }
4577
+ }
4442
4578
  }
4443
4579
 
4444
4580
  const LoroTreeFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -4886,6 +5022,51 @@ export class LoroTree {
4886
5022
  const ret = wasm.lorotree_isDeleted(this.__wbg_ptr);
4887
5023
  return ret !== 0;
4888
5024
  }
5025
+ /**
5026
+ * Get the shallow value of the tree.
5027
+ *
5028
+ * Unlike `toJSON()` which recursively resolves nested containers to their values,
5029
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
5030
+ *
5031
+ * @example
5032
+ * ```ts
5033
+ * const doc = new LoroDoc();
5034
+ * doc.setPeerId("1");
5035
+ * const tree = doc.getTree("tree");
5036
+ * const root = tree.createNode();
5037
+ * root.data.set("name", "root");
5038
+ * const text = root.data.setContainer("content", new LoroText());
5039
+ * text.insert(0, "Hello");
5040
+ *
5041
+ * console.log(tree.getShallowValue());
5042
+ * // [{
5043
+ * // id: "0@1",
5044
+ * // parent: null,
5045
+ * // index: 0,
5046
+ * // fractional_index: "80",
5047
+ * // meta: "cid:0@1:Map",
5048
+ * // children: []
5049
+ * // }]
5050
+ *
5051
+ * console.log(tree.toJSON());
5052
+ * // [{
5053
+ * // id: "0@1",
5054
+ * // parent: null,
5055
+ * // index: 0,
5056
+ * // fractional_index: "80",
5057
+ * // meta: {
5058
+ * // name: "root",
5059
+ * // content: "Hello"
5060
+ * // },
5061
+ * // children: []
5062
+ * // }]
5063
+ * ```
5064
+ * @returns {TreeNodeShallowValue[]}
5065
+ */
5066
+ getShallowValue() {
5067
+ const ret = wasm.lorotree_getShallowValue(this.__wbg_ptr);
5068
+ return takeObject(ret);
5069
+ }
4889
5070
  }
4890
5071
 
4891
5072
  const LoroTreeNodeFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -5780,6 +5961,11 @@ export function __wbindgen_is_string(arg0) {
5780
5961
  return ret;
5781
5962
  };
5782
5963
 
5964
+ export function __wbindgen_is_null(arg0) {
5965
+ const ret = getObject(arg0) === null;
5966
+ return ret;
5967
+ };
5968
+
5783
5969
  export function __wbindgen_number_new(arg0) {
5784
5970
  const ret = arg0;
5785
5971
  return addHeapObject(ret);
@@ -5790,11 +5976,6 @@ export function __wbindgen_typeof(arg0) {
5790
5976
  return addHeapObject(ret);
5791
5977
  };
5792
5978
 
5793
- export function __wbindgen_is_null(arg0) {
5794
- const ret = getObject(arg0) === null;
5795
- return ret;
5796
- };
5797
-
5798
5979
  export function __wbg_error_c8c2cca30a630316(arg0, arg1) {
5799
5980
  console.error(getStringFromWasm0(arg0, arg1));
5800
5981
  };
Binary file
@@ -10,6 +10,7 @@ export function lorocounter_subscribe(a: number, b: number, c: number): void;
10
10
  export function lorocounter_parent(a: number): number;
11
11
  export function lorocounter_isAttached(a: number): number;
12
12
  export function lorocounter_getAttached(a: number): number;
13
+ export function lorocounter_getShallowValue(a: number): number;
13
14
  export function __wbg_awarenesswasm_free(a: number): void;
14
15
  export function awarenesswasm_new(a: number, b: number): number;
15
16
  export function awarenesswasm_encode(a: number, b: number, c: number): void;
@@ -76,6 +77,7 @@ export function lorodoc_exportJsonUpdates(a: number, b: number, c: number, d: nu
76
77
  export function lorodoc_importJsonUpdates(a: number, b: number, c: number): void;
77
78
  export function lorodoc_import(a: number, b: number, c: number, d: number): void;
78
79
  export function lorodoc_importUpdateBatch(a: number, b: number, c: number): void;
80
+ export function lorodoc_importBatch(a: number, b: number, c: number): void;
79
81
  export function lorodoc_getShallowValue(a: number, b: number): void;
80
82
  export function lorodoc_toJSON(a: number, b: number): void;
81
83
  export function lorodoc_subscribe(a: number, b: number): number;
@@ -119,6 +121,7 @@ export function lorotext_getCursor(a: number, b: number, c: number): number;
119
121
  export function lorotext_push(a: number, b: number, c: number, d: number): void;
120
122
  export function lorotext_getEditorOf(a: number, b: number): number;
121
123
  export function lorotext_isDeleted(a: number): number;
124
+ export function lorotext_getShallowValue(a: number, b: number): void;
122
125
  export function __wbg_loromap_free(a: number): void;
123
126
  export function loromap_new(): number;
124
127
  export function loromap_kind(a: number): number;
@@ -139,6 +142,7 @@ export function loromap_getAttached(a: number): number;
139
142
  export function loromap_clear(a: number, b: number): void;
140
143
  export function loromap_getLastEditor(a: number, b: number, c: number): number;
141
144
  export function loromap_isDeleted(a: number): number;
145
+ export function loromap_getShallowValue(a: number): number;
142
146
  export function __wbg_lorolist_free(a: number): void;
143
147
  export function lorolist_new(): number;
144
148
  export function lorolist_kind(a: number): number;
@@ -161,6 +165,7 @@ export function lorolist_pop(a: number, b: number): void;
161
165
  export function lorolist_clear(a: number, b: number): void;
162
166
  export function lorolist_getIdAt(a: number, b: number): number;
163
167
  export function lorolist_isDeleted(a: number): number;
168
+ export function lorolist_getShallowValue(a: number): number;
164
169
  export function loromovablelist_new(): number;
165
170
  export function loromovablelist_kind(a: number): number;
166
171
  export function loromovablelist_insert(a: number, b: number, c: number, d: number): void;
@@ -185,6 +190,7 @@ export function loromovablelist_getCreatorAt(a: number, b: number): number;
185
190
  export function loromovablelist_getLastMoverAt(a: number, b: number): number;
186
191
  export function loromovablelist_getLastEditorAt(a: number, b: number): number;
187
192
  export function loromovablelist_isDeleted(a: number): number;
193
+ export function loromovablelist_getShallowValue(a: number): number;
188
194
  export function __wbg_lorotree_free(a: number): void;
189
195
  export function lorotreenode___getClassname(a: number, b: number): void;
190
196
  export function __wbg_lorotreenode_free(a: number): void;
@@ -225,6 +231,7 @@ export function lorotree_enableFractionalIndex(a: number, b: number): void;
225
231
  export function lorotree_disableFractionalIndex(a: number): void;
226
232
  export function lorotree_isFractionalIndexEnabled(a: number): number;
227
233
  export function lorotree_isDeleted(a: number): number;
234
+ export function lorotree_getShallowValue(a: number): number;
228
235
  export function __wbg_cursor_free(a: number): void;
229
236
  export function cursor_containerId(a: number): number;
230
237
  export function cursor_pos(a: number): number;
package/nodejs/index.js CHANGED
@@ -152,6 +152,53 @@ class Awareness {
152
152
  }, this.timeout / 2);
153
153
  }
154
154
  }
155
+ loroWasm.LoroDoc.prototype.toJsonWithReplacer = function (replacer) {
156
+ const doc = this;
157
+ const m = (key, value) => {
158
+ if (typeof value === "string") {
159
+ if (isContainerId(value)) {
160
+ const container = doc.getContainerById(value);
161
+ if (container == null) {
162
+ throw new Error(`ContainerID not found: ${value}`);
163
+ }
164
+ const ans = replacer(key, container);
165
+ if (ans === container) {
166
+ const ans = container.getShallowValue();
167
+ if (typeof ans === "object") {
168
+ return run(ans);
169
+ }
170
+ return ans;
171
+ }
172
+ if (isContainer(ans)) {
173
+ throw new Error("Using new container is not allowed in toJsonWithReplacer");
174
+ }
175
+ return ans;
176
+ }
177
+ }
178
+ const ans = replacer(key, value);
179
+ if (isContainer(ans)) {
180
+ throw new Error("Using new container is not allowed in toJsonWithReplacer");
181
+ }
182
+ return ans;
183
+ };
184
+ const run = (layer) => {
185
+ if (Array.isArray(layer)) {
186
+ return layer.map((item, index) => {
187
+ return m(index, item);
188
+ }).filter((item) => item !== undefined);
189
+ }
190
+ const result = {};
191
+ for (const [key, value] of Object.entries(layer)) {
192
+ const ans = m(key, value);
193
+ if (ans !== undefined) {
194
+ result[key] = ans;
195
+ }
196
+ }
197
+ return result;
198
+ };
199
+ const layer = this.getShallowValue();
200
+ return run(layer);
201
+ };
155
202
 
156
203
  exports.Awareness = Awareness;
157
204
  exports.Loro = Loro;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../index.ts"],"sourcesContent":[null],"names":["LoroDoc","AwarenessWasm"],"mappings":";;;;AAmBA;;AAEG;AACG,MAAO,IAAK,SAAQA,gBAAO,CAAA;AAAI,CAAA;AAErC,MAAM,eAAe,GAAG;IACpB,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,aAAa;IACb,SAAS;CACZ,CAAC;AAEI,SAAU,aAAa,CAAC,CAAS,EAAA;AACnC,IAAA,OAAO,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAChC,CAAC;AAED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