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.
@@ -858,6 +858,14 @@ class LoroCounter {
858
858
  const ret = wasm.lorocounter_getAttached(this.__wbg_ptr);
859
859
  return takeObject(ret);
860
860
  }
861
+ /**
862
+ * Get the value of the counter.
863
+ * @returns {number}
864
+ */
865
+ getShallowValue() {
866
+ const ret = wasm.lorocounter_getShallowValue(this.__wbg_ptr);
867
+ return ret;
868
+ }
861
869
  }
862
870
  module.exports.LoroCounter = LoroCounter;
863
871
 
@@ -1805,18 +1813,13 @@ class LoroDoc {
1805
1813
  * // get updates from specific version to the latest version
1806
1814
  * const updates2 = doc.exportFrom(version);
1807
1815
  * ```
1808
- * @param {VersionVector | undefined} [vv]
1816
+ * @param {any} vv
1809
1817
  * @returns {Uint8Array}
1810
1818
  */
1811
1819
  exportFrom(vv) {
1812
1820
  try {
1813
1821
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1814
- let ptr0 = 0;
1815
- if (!isLikeNone(vv)) {
1816
- _assertClass(vv, VersionVector);
1817
- ptr0 = vv.__destroy_into_raw();
1818
- }
1819
- wasm.lorodoc_exportFrom(retptr, this.__wbg_ptr, ptr0);
1822
+ wasm.lorodoc_exportFrom(retptr, this.__wbg_ptr, addHeapObject(vv));
1820
1823
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1821
1824
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1822
1825
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1824,9 +1827,9 @@ class LoroDoc {
1824
1827
  if (r3) {
1825
1828
  throw takeObject(r2);
1826
1829
  }
1827
- var v2 = getArrayU8FromWasm0(r0, r1).slice();
1830
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
1828
1831
  wasm.__wbindgen_export_5(r0, r1 * 1, 1);
1829
- return v2;
1832
+ return v1;
1830
1833
  } finally {
1831
1834
  wasm.__wbindgen_add_to_stack_pointer(16);
1832
1835
  }
@@ -1890,24 +1893,14 @@ class LoroDoc {
1890
1893
  }
1891
1894
  /**
1892
1895
  * Export updates in the given range in JSON format.
1893
- * @param {VersionVector | undefined} [start_vv]
1894
- * @param {VersionVector | undefined} [end_vv]
1896
+ * @param {any} start_vv
1897
+ * @param {any} end_vv
1895
1898
  * @returns {JsonSchema}
1896
1899
  */
1897
1900
  exportJsonUpdates(start_vv, end_vv) {
1898
1901
  try {
1899
1902
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1900
- let ptr0 = 0;
1901
- if (!isLikeNone(start_vv)) {
1902
- _assertClass(start_vv, VersionVector);
1903
- ptr0 = start_vv.__destroy_into_raw();
1904
- }
1905
- let ptr1 = 0;
1906
- if (!isLikeNone(end_vv)) {
1907
- _assertClass(end_vv, VersionVector);
1908
- ptr1 = end_vv.__destroy_into_raw();
1909
- }
1910
- wasm.lorodoc_exportJsonUpdates(retptr, this.__wbg_ptr, ptr0, ptr1);
1903
+ wasm.lorodoc_exportJsonUpdates(retptr, this.__wbg_ptr, addHeapObject(start_vv), addHeapObject(end_vv));
1911
1904
  var r0 = getInt32Memory0()[retptr / 4 + 0];
1912
1905
  var r1 = getInt32Memory0()[retptr / 4 + 1];
1913
1906
  var r2 = getInt32Memory0()[retptr / 4 + 2];
@@ -1985,10 +1978,12 @@ class LoroDoc {
1985
1978
  }
1986
1979
  }
1987
1980
  /**
1988
- * Import a batch of updates.
1981
+ * Import a batch of updates and snapshots.
1989
1982
  *
1990
1983
  * It's more efficient than importing updates one by one.
1991
1984
  *
1985
+ * @deprecated Use `importBatch` instead.
1986
+ *
1992
1987
  * @example
1993
1988
  * ```ts
1994
1989
  * import { LoroDoc } from "loro-crdt";
@@ -1999,9 +1994,9 @@ class LoroDoc {
1999
1994
  * const updates = doc.export({ mode: "update" });
2000
1995
  * const snapshot = doc.export({ mode: "snapshot" });
2001
1996
  * const doc2 = new LoroDoc();
2002
- * doc2.importUpdateBatch([snapshot, updates]);
1997
+ * doc2.importBatch([snapshot, updates]);
2003
1998
  * ```
2004
- * @param {Array<any>} data
1999
+ * @param {Uint8Array[]} data
2005
2000
  * @returns {ImportStatus}
2006
2001
  */
2007
2002
  importUpdateBatch(data) {
@@ -2020,8 +2015,46 @@ class LoroDoc {
2020
2015
  }
2021
2016
  }
2022
2017
  /**
2018
+ * Import a batch of updates or snapshots.
2019
+ *
2020
+ * It's more efficient than importing updates one by one.
2021
+ *
2022
+ * @example
2023
+ * ```ts
2024
+ * import { LoroDoc } from "loro-crdt";
2025
+ *
2026
+ * const doc = new LoroDoc();
2027
+ * const text = doc.getText("text");
2028
+ * text.insert(0, "Hello");
2029
+ * const updates = doc.export({ mode: "update" });
2030
+ * const snapshot = doc.export({ mode: "snapshot" });
2031
+ * const doc2 = new LoroDoc();
2032
+ * doc2.importBatch([snapshot, updates]);
2033
+ * ```
2034
+ * @param {Uint8Array[]} data
2035
+ * @returns {ImportStatus}
2036
+ */
2037
+ importBatch(data) {
2038
+ try {
2039
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2040
+ wasm.lorodoc_importBatch(retptr, this.__wbg_ptr, addHeapObject(data));
2041
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
2042
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
2043
+ var r2 = getInt32Memory0()[retptr / 4 + 2];
2044
+ if (r2) {
2045
+ throw takeObject(r1);
2046
+ }
2047
+ return takeObject(r0);
2048
+ } finally {
2049
+ wasm.__wbindgen_add_to_stack_pointer(16);
2050
+ }
2051
+ }
2052
+ /**
2023
2053
  * Get the shallow json format of the document state.
2024
2054
  *
2055
+ * Unlike `toJSON()` which recursively resolves all containers to their values,
2056
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
2057
+ *
2025
2058
  * @example
2026
2059
  * ```ts
2027
2060
  * import { LoroDoc } from "loro-crdt";
@@ -2031,12 +2064,17 @@ class LoroDoc {
2031
2064
  * const tree = doc.getTree("tree");
2032
2065
  * const map = doc.getMap("map");
2033
2066
  * const shallowValue = doc.getShallowValue();
2034
- * /*
2035
- * {"list": ..., "tree": ..., "map": ...}
2036
- * *\/
2037
2067
  * console.log(shallowValue);
2068
+ * // {
2069
+ * // list: 'cid:root-list:List',
2070
+ * // tree: 'cid:root-tree:Tree',
2071
+ * // map: 'cid:root-map:Map'
2072
+ * // }
2073
+ *
2074
+ * // It points to the same container as `list`
2075
+ * const listB = doc.getContainerById(shallowValue.list);
2038
2076
  * ```
2039
- * @returns {any}
2077
+ * @returns {Record<string, ContainerID>}
2040
2078
  */
2041
2079
  getShallowValue() {
2042
2080
  try {
@@ -2056,9 +2094,12 @@ class LoroDoc {
2056
2094
  /**
2057
2095
  * Get the json format of the entire document state.
2058
2096
  *
2097
+ * Unlike `getShallowValue()` which returns container IDs as strings,
2098
+ * `toJSON()` recursively resolves all containers to their actual values.
2099
+ *
2059
2100
  * @example
2060
2101
  * ```ts
2061
- * import { LoroDoc, LoroText, LoroMap } from "loro-crdt";
2102
+ * import { LoroDoc, LoroText } from "loro-crdt";
2062
2103
  *
2063
2104
  * const doc = new LoroDoc();
2064
2105
  * const list = doc.getList("list");
@@ -2067,10 +2108,8 @@ class LoroDoc {
2067
2108
  * text.insert(0, "Hello");
2068
2109
  * const map = list.insertContainer(1, new LoroMap());
2069
2110
  * map.set("foo", "bar");
2070
- * /*
2071
- * {"list": ["Hello", {"foo": "bar"}]}
2072
- * *\/
2073
2111
  * console.log(doc.toJSON());
2112
+ * // {"list": ["Hello", {"foo": "bar"}]}
2074
2113
  * ```
2075
2114
  * @returns {any}
2076
2115
  */
@@ -2826,6 +2865,29 @@ class LoroList {
2826
2865
  const ret = wasm.lorolist_isDeleted(this.__wbg_ptr);
2827
2866
  return ret !== 0;
2828
2867
  }
2868
+ /**
2869
+ * Get the shallow value of the list.
2870
+ *
2871
+ * Unlike `toJSON()` which recursively resolves all containers to their values,
2872
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
2873
+ *
2874
+ * ```js
2875
+ * const doc = new LoroDoc();
2876
+ * doc.setPeerId("1");
2877
+ * const list = doc.getList("list");
2878
+ * list.insert(0, 1);
2879
+ * list.insert(1, "two");
2880
+ * const subList = list.insertContainer(2, new LoroList());
2881
+ * subList.insert(0, "sub");
2882
+ * list.getShallowValue(); // [1, "two", "cid:2@1:List"]
2883
+ * list.toJSON(); // [1, "two", ["sub"]]
2884
+ * ```
2885
+ * @returns {Value[]}
2886
+ */
2887
+ getShallowValue() {
2888
+ const ret = wasm.lorolist_getShallowValue(this.__wbg_ptr);
2889
+ return takeObject(ret);
2890
+ }
2829
2891
  }
2830
2892
  module.exports.LoroList = LoroList;
2831
2893
 
@@ -3277,6 +3339,37 @@ 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
  module.exports.LoroMap = LoroMap;
3282
3375
 
@@ -3785,6 +3878,29 @@ class LoroMovableList {
3785
3878
  const ret = wasm.loromovablelist_isDeleted(this.__wbg_ptr);
3786
3879
  return ret !== 0;
3787
3880
  }
3881
+ /**
3882
+ * Get the shallow value of the movable list.
3883
+ *
3884
+ * Unlike `toJSON()` which recursively resolves all containers to their values,
3885
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
3886
+ *
3887
+ * ```js
3888
+ * const doc = new LoroDoc();
3889
+ * doc.setPeerId("1");
3890
+ * const list = doc.getMovableList("list");
3891
+ * list.insert(0, 1);
3892
+ * list.insert(1, "two");
3893
+ * const subList = list.insertContainer(2, new LoroList());
3894
+ * subList.insert(0, "sub");
3895
+ * list.getShallowValue(); // [1, "two", "cid:2@1:List"]
3896
+ * list.toJSON(); // [1, "two", ["sub"]]
3897
+ * ```
3898
+ * @returns {Value[]}
3899
+ */
3900
+ getShallowValue() {
3901
+ const ret = wasm.loromovablelist_getShallowValue(this.__wbg_ptr);
3902
+ return takeObject(ret);
3903
+ }
3788
3904
  }
3789
3905
  module.exports.LoroMovableList = LoroMovableList;
3790
3906
 
@@ -4441,6 +4557,26 @@ class LoroText {
4441
4557
  const ret = wasm.lorotext_isDeleted(this.__wbg_ptr);
4442
4558
  return ret !== 0;
4443
4559
  }
4560
+ /**
4561
+ * Get the shallow value of the text. This equals to `text.toString()`.
4562
+ * @returns {string}
4563
+ */
4564
+ getShallowValue() {
4565
+ let deferred1_0;
4566
+ let deferred1_1;
4567
+ try {
4568
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
4569
+ wasm.lorotext_getShallowValue(retptr, this.__wbg_ptr);
4570
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
4571
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
4572
+ deferred1_0 = r0;
4573
+ deferred1_1 = r1;
4574
+ return getStringFromWasm0(r0, r1);
4575
+ } finally {
4576
+ wasm.__wbindgen_add_to_stack_pointer(16);
4577
+ wasm.__wbindgen_export_5(deferred1_0, deferred1_1, 1);
4578
+ }
4579
+ }
4444
4580
  }
4445
4581
  module.exports.LoroText = LoroText;
4446
4582
 
@@ -4889,6 +5025,51 @@ class LoroTree {
4889
5025
  const ret = wasm.lorotree_isDeleted(this.__wbg_ptr);
4890
5026
  return ret !== 0;
4891
5027
  }
5028
+ /**
5029
+ * Get the shallow value of the tree.
5030
+ *
5031
+ * Unlike `toJSON()` which recursively resolves nested containers to their values,
5032
+ * `getShallowValue()` returns container IDs as strings for any nested containers.
5033
+ *
5034
+ * @example
5035
+ * ```ts
5036
+ * const doc = new LoroDoc();
5037
+ * doc.setPeerId("1");
5038
+ * const tree = doc.getTree("tree");
5039
+ * const root = tree.createNode();
5040
+ * root.data.set("name", "root");
5041
+ * const text = root.data.setContainer("content", new LoroText());
5042
+ * text.insert(0, "Hello");
5043
+ *
5044
+ * console.log(tree.getShallowValue());
5045
+ * // [{
5046
+ * // id: "0@1",
5047
+ * // parent: null,
5048
+ * // index: 0,
5049
+ * // fractional_index: "80",
5050
+ * // meta: "cid:0@1:Map",
5051
+ * // children: []
5052
+ * // }]
5053
+ *
5054
+ * console.log(tree.toJSON());
5055
+ * // [{
5056
+ * // id: "0@1",
5057
+ * // parent: null,
5058
+ * // index: 0,
5059
+ * // fractional_index: "80",
5060
+ * // meta: {
5061
+ * // name: "root",
5062
+ * // content: "Hello"
5063
+ * // },
5064
+ * // children: []
5065
+ * // }]
5066
+ * ```
5067
+ * @returns {TreeNodeShallowValue[]}
5068
+ */
5069
+ getShallowValue() {
5070
+ const ret = wasm.lorotree_getShallowValue(this.__wbg_ptr);
5071
+ return takeObject(ret);
5072
+ }
4892
5073
  }
4893
5074
  module.exports.LoroTree = LoroTree;
4894
5075
 
@@ -5787,6 +5968,11 @@ module.exports.__wbindgen_is_string = function(arg0) {
5787
5968
  return ret;
5788
5969
  };
5789
5970
 
5971
+ module.exports.__wbindgen_is_null = function(arg0) {
5972
+ const ret = getObject(arg0) === null;
5973
+ return ret;
5974
+ };
5975
+
5790
5976
  module.exports.__wbindgen_number_new = function(arg0) {
5791
5977
  const ret = arg0;
5792
5978
  return addHeapObject(ret);
@@ -5797,11 +5983,6 @@ module.exports.__wbindgen_typeof = function(arg0) {
5797
5983
  return addHeapObject(ret);
5798
5984
  };
5799
5985
 
5800
- module.exports.__wbindgen_is_null = function(arg0) {
5801
- const ret = getObject(arg0) === null;
5802
- return ret;
5803
- };
5804
-
5805
5986
  module.exports.__wbg_error_c8c2cca30a630316 = function(arg0, arg1) {
5806
5987
  console.error(getStringFromWasm0(arg0, arg1));
5807
5988
  };
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loro-crdt",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Loro CRDTs is a high-performance CRDT framework that makes your app state synchronized, collaborative and maintainable effortlessly.",
5
5
  "keywords": [
6
6
  "crdt",
package/web/index.js CHANGED
@@ -152,6 +152,53 @@ class Awareness {
152
152
  }, this.timeout / 2);
153
153
  }
154
154
  }
155
+ 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
  export { Awareness, Loro, getType, isContainer, isContainerId, newContainerID, newRootContainerID };
157
204
  //# sourceMappingURL=index.js.map
package/web/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAmBA;;AAEG;AACG,MAAO,IAAK,SAAQ,OAAO,CAAA;AAAI,CAAA;AAErC,MAAM,eAAe,GAAG;IACpB,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,aAAa;IACb,SA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