document-model 3.2.0-dev.9 → 3.2.0-staging.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 (68) hide show
  1. package/dist/index.d.ts +2 -4
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +1 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/document/actions/creators.d.ts +1 -3
  6. package/dist/src/document/actions/creators.d.ts.map +1 -1
  7. package/dist/src/document/actions/creators.js +1 -1
  8. package/dist/src/document/actions/creators.js.map +1 -1
  9. package/dist/src/document/actions/operations.d.ts +1 -16
  10. package/dist/src/document/actions/operations.d.ts.map +1 -1
  11. package/dist/src/document/actions/operations.js +2 -3
  12. package/dist/src/document/actions/operations.js.map +1 -1
  13. package/dist/src/document/object.d.ts +4 -0
  14. package/dist/src/document/object.d.ts.map +1 -1
  15. package/dist/src/document/object.js +11 -5
  16. package/dist/src/document/object.js.map +1 -1
  17. package/dist/src/document/reducer.d.ts.map +1 -1
  18. package/dist/src/document/reducer.js +4 -8
  19. package/dist/src/document/reducer.js.map +1 -1
  20. package/dist/src/document/schema/zod.d.ts.map +1 -1
  21. package/dist/src/document/signal.d.ts +1 -9
  22. package/dist/src/document/signal.d.ts.map +1 -1
  23. package/dist/src/document/types.d.ts +41 -32
  24. package/dist/src/document/types.d.ts.map +1 -1
  25. package/dist/src/document/utils/base.d.ts +3 -8
  26. package/dist/src/document/utils/base.d.ts.map +1 -1
  27. package/dist/src/document/utils/base.js +27 -31
  28. package/dist/src/document/utils/base.js.map +1 -1
  29. package/dist/src/document/utils/file.d.ts.map +1 -1
  30. package/dist/src/document/utils/file.js +12 -6
  31. package/dist/src/document/utils/file.js.map +1 -1
  32. package/dist/src/document-model/gen/utils.d.ts.map +1 -1
  33. package/dist/src/document-model/gen/utils.js +2 -5
  34. package/dist/src/document-model/gen/utils.js.map +1 -1
  35. package/dist/test/document/crypto.test.js +5 -40
  36. package/dist/test/document/crypto.test.js.map +1 -1
  37. package/dist/test/document/event-vs-command.test.js +4 -4
  38. package/dist/test/document/event-vs-command.test.js.map +1 -1
  39. package/dist/test/document/local.test.js +19 -18
  40. package/dist/test/document/local.test.js.map +1 -1
  41. package/dist/test/document/operation-id.test.js +2 -1
  42. package/dist/test/document/operation-id.test.js.map +1 -1
  43. package/dist/test/document/prune.test.js +20 -15
  44. package/dist/test/document/prune.test.js.map +1 -1
  45. package/dist/test/document/reducer.test.js +7 -5
  46. package/dist/test/document/reducer.test.js.map +1 -1
  47. package/dist/test/document/skip-operations.test.js +16 -6
  48. package/dist/test/document/skip-operations.test.js.map +1 -1
  49. package/dist/test/document/undo-redo.test.js +12 -9
  50. package/dist/test/document/undo-redo.test.js.map +1 -1
  51. package/dist/test/document/utils.test.js +4 -2
  52. package/dist/test/document/utils.test.js.map +1 -1
  53. package/dist/test/document-model/object.test.js +1 -1
  54. package/dist/test/document-model/object.test.js.map +1 -1
  55. package/dist/test/document-model/replay.test.js +25 -19
  56. package/dist/test/document-model/replay.test.js.map +1 -1
  57. package/dist/test/document-model/skip-operations.test.js +16 -13
  58. package/dist/test/document-model/skip-operations.test.js.map +1 -1
  59. package/dist/tsconfig.tsbuildinfo +1 -1
  60. package/package.json +1 -1
  61. package/dist/src/document/ph-types.d.ts +0 -66
  62. package/dist/src/document/ph-types.d.ts.map +0 -1
  63. package/dist/src/document/ph-types.js +0 -2
  64. package/dist/src/document/ph-types.js.map +0 -1
  65. package/dist/src/document/utils/header.d.ts +0 -99
  66. package/dist/src/document/utils/header.d.ts.map +0 -1
  67. package/dist/src/document/utils/header.js +0 -200
  68. package/dist/src/document/utils/header.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-model",
3
- "version": "3.2.0-dev.9",
3
+ "version": "3.2.0-staging.0",
4
4
  "license": "AGPL-3.0-only",
5
5
  "private": false,
6
6
  "files": [
@@ -1,66 +0,0 @@
1
- export type JsonSerializable = string | number | boolean | null | undefined | JsonSerializable[] | {
2
- [key: string]: JsonSerializable;
3
- };
4
- export type PHDocumentSignatureInfo = {
5
- /**
6
- * The public key of the document creator.
7
- **/
8
- publicKey: JsonWebKey;
9
- /** The nonce that was appended to the message to create the signature. */
10
- nonce: string;
11
- };
12
- export type PHDocumentHeader = {
13
- /**
14
- * The id of the document.
15
- *
16
- * This is a Ed25519 signature and is immutable.
17
- **/
18
- id: string;
19
- /**
20
- * Information to verify the document creator.
21
- *
22
- * This is immutable.
23
- **/
24
- sig: PHDocumentSignatureInfo;
25
- /**
26
- * The type of the document.
27
- *
28
- * This is used as part of the signature payload and thus, cannot be changed
29
- * after the document header has been created.
30
- **/
31
- documentType: string;
32
- /**
33
- * The timestamp of the creation date of the document, in UTC ISO format.
34
- *
35
- * This is used as part of the signature payload and thus, cannot be changed
36
- * after the document header has been created.
37
- **/
38
- createdAtUtcIso: string;
39
- /** The slug of the document. */
40
- slug: string;
41
- /** The name of the document. */
42
- name: string;
43
- /** The branch of this document. */
44
- branch: string;
45
- /**
46
- * The revision of each scope of the document. This object is updated every
47
- * time any _other_ scope is updated.
48
- */
49
- revision: {
50
- [scope: string]: number;
51
- };
52
- /**
53
- * The timestamp of the last change in the document, in UTC ISO format.
54
- **/
55
- lastModifiedAtUtcIso: string;
56
- /** Meta information about the document. */
57
- meta?: {
58
- /** The preferred editor for the document. */
59
- preferredEditor?: string;
60
- };
61
- };
62
- export type PHBaseState<TDocumentState = JsonSerializable> = {
63
- document?: TDocumentState;
64
- };
65
- export type PHDocumentHistory = {};
66
- //# sourceMappingURL=ph-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ph-types.d.ts","sourceRoot":"","sources":["../../../src/document/ph-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,GACT,gBAAgB,EAAE,GAClB;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAA;CAAE,CAAC;AAExC,MAAM,MAAM,uBAAuB,GAAG;IACpC;;QAEI;IACJ,SAAS,EAAE,UAAU,CAAC;IAEtB,0EAA0E;IAC1E,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;;QAII;IACJ,EAAE,EAAE,MAAM,CAAC;IAEX;;;;QAII;IACJ,GAAG,EAAE,uBAAuB,CAAC;IAE7B;;;;;QAKI;IACJ,YAAY,EAAE,MAAM,CAAC;IAErB;;;;;QAKI;IACJ,eAAe,EAAE,MAAM,CAAC;IAExB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IAEb,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,QAAQ,EAAE;QACR,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;KACzB,CAAC;IAEF;;QAEI;IACJ,oBAAoB,EAAE,MAAM,CAAC;IAE7B,2CAA2C;IAC3C,IAAI,CAAC,EAAE;QACL,6CAA6C;QAC7C,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,WAAW,CAAC,cAAc,GAAG,gBAAgB,IAAI;IAE3D,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,EAAE,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ph-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ph-types.js","sourceRoot":"","sources":["../../../src/document/ph-types.ts"],"names":[],"mappings":""}
@@ -1,99 +0,0 @@
1
- import { type PHDocumentHeader } from "#document/ph-types.js";
2
- /**
3
- * Parameters used in a document signature.
4
- */
5
- export type SigningParameters = {
6
- documentType: string;
7
- createdAtUtcIso: string;
8
- /**
9
- * The nonce can act as both a salt and a typical nonce.
10
- */
11
- nonce: string;
12
- };
13
- /**
14
- * Describes a signer. This may only have a public key for verification.
15
- */
16
- export interface ISigner {
17
- /** The corresponding public key */
18
- publicKey(): Promise<JsonWebKey>;
19
- /**
20
- * Signs data.
21
- *
22
- * @param data - The data to sign.
23
- *
24
- * @returns The signature of the data.
25
- */
26
- sign: (data: Uint8Array) => Promise<Uint8Array>;
27
- /**
28
- * Verifies a signature.
29
- *
30
- * @param data - The data to verify.
31
- * @param signature - The signature to verify.
32
- */
33
- verify: (data: Uint8Array, signature: Uint8Array) => Promise<void>;
34
- }
35
- /**
36
- * A signer that uses a public key to verify data.
37
- */
38
- export declare class PublicKeySigner implements ISigner {
39
- #private;
40
- protected readonly subtleCrypto: Promise<SubtleCrypto>;
41
- protected publicCryptoKey: CryptoKey | undefined;
42
- constructor(publicKey: JsonWebKey);
43
- publicKey(): Promise<JsonWebKey>;
44
- sign(data: Uint8Array): Promise<Uint8Array>;
45
- verify(data: Uint8Array, signature: Uint8Array): Promise<void>;
46
- }
47
- /**
48
- * Signs a header. Generally, this is not called directly, but rather through
49
- * {@link createSignedHeader}.
50
- *
51
- * @param parameters - The parameters used to sign the header.
52
- * @param signer - The signer of the document.
53
- *
54
- * @returns The signature of the header.
55
- */
56
- export declare const sign: (parameters: SigningParameters, signer: ISigner) => Promise<string>;
57
- /**
58
- * Verifies a header signature. Generally, this is not called directly, but
59
- * rather through {@link validateHeader}.
60
- *
61
- * @param parameters - The parameters used to sign the header.
62
- * @param signature - The signature to verify.
63
- * @param signer - The signer of the document.
64
- */
65
- export declare const verify: (parameters: SigningParameters, signature: string, signer: ISigner) => Promise<void>;
66
- /**
67
- * Validates a header signature.
68
- */
69
- export declare const validateHeader: (header: PHDocumentHeader) => Promise<void>;
70
- /**
71
- * Creates a header that has yet to be signed. This header is not valid, but
72
- * can be input into {@link createSignedHeader} to create a signed header.
73
- *
74
- * @returns An unsigned header for a document.
75
- */
76
- export declare const createUnsignedHeader: () => PHDocumentHeader;
77
- /**
78
- * Creates a new, signed header for a document. This will replace the id of the
79
- * document.
80
- *
81
- * @param unsignedHeader - The unsigned header to created the signed header from.
82
- * @param signer - The signer of the document.
83
- *
84
- * @returns A new signed header for a document. Some fields are mutable and
85
- * some are not. See the PHDocumentHeader type for more information.
86
- */
87
- export declare const createSignedHeader: (unsignedHeader: PHDocumentHeader, documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
88
- /**
89
- * Creates a signed header for a document. The document header requires a signer
90
- * as the document id is a Ed25519 signature.
91
- *
92
- * @param documentType - The type of the document.
93
- * @param signer - The signer of the document.
94
- *
95
- * @returns The signed header for a document. Some fields are mutable and
96
- * some are not. See the PHDocumentHeader type for more information.
97
- */
98
- export declare const createSignedHeaderForSigner: (documentType: string, signer: ISigner) => Promise<PHDocumentHeader>;
99
- //# sourceMappingURL=header.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../../../src/document/utils/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAG9D;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,mCAAmC;IACnC,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAEjC;;;;;;OAMG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAEhD;;;;;OAKG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE;AAQD;;GAEG;AACH,qBAAa,eAAgB,YAAW,OAAO;;IAG7C,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACvD,SAAS,CAAC,eAAe,EAAE,SAAS,GAAG,SAAS,CAAC;gBAErC,SAAS,EAAE,UAAU;IAuB3B,SAAS,IAAI,OAAO,CAAC,UAAU,CAAC;IAIhC,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAI3C,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CA+BrE;AAeD;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,GACf,YAAY,iBAAiB,EAC7B,QAAQ,OAAO,KACd,OAAO,CAAC,MAAM,CAehB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,MAAM,GACjB,YAAY,iBAAiB,EAC7B,WAAW,MAAM,EACjB,QAAQ,OAAO,KACd,OAAO,CAAC,IAAI,CAcd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,gBAAgB,KACvB,OAAO,CAAC,IAAI,CAYd,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,QAAO,gBAkBvC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,gBAAgB,gBAAgB,EAChC,cAAc,MAAM,EACpB,QAAQ,OAAO,KACd,OAAO,CAAC,gBAAgB,CA8B1B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,GACtC,cAAc,MAAM,EACpB,QAAQ,OAAO,KACd,OAAO,CAAC,gBAAgB,CAS1B,CAAC"}
@@ -1,200 +0,0 @@
1
- import { generateUUID } from "#utils/env";
2
- /**
3
- * Generates a deterministic payload from signing parameters
4
- */
5
- const generateStablePayload = (parameters) => `${parameters.documentType}:${parameters.createdAtUtcIso}:${parameters.nonce}`;
6
- /**
7
- * A signer that uses a public key to verify data.
8
- */
9
- export class PublicKeySigner {
10
- #publicKey;
11
- subtleCrypto;
12
- publicCryptoKey;
13
- constructor(publicKey) {
14
- this.#publicKey = publicKey;
15
- this.subtleCrypto = this.#initCrypto();
16
- }
17
- #initCrypto() {
18
- return new Promise((resolve, reject) => {
19
- if (typeof window === "undefined") {
20
- import("node:crypto")
21
- .then((module) => {
22
- resolve(module.webcrypto.subtle);
23
- })
24
- .catch(reject);
25
- }
26
- else {
27
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
28
- if (!window.crypto?.subtle) {
29
- reject(new Error("Crypto module not available"));
30
- }
31
- resolve(window.crypto.subtle);
32
- }
33
- });
34
- }
35
- async publicKey() {
36
- return this.#publicKey;
37
- }
38
- async sign(data) {
39
- throw new Error("PublicKeySigner only supports verification");
40
- }
41
- async verify(data, signature) {
42
- const subtleCrypto = await this.subtleCrypto;
43
- if (!this.publicCryptoKey) {
44
- this.publicCryptoKey = await subtleCrypto.importKey("jwk", this.#publicKey, {
45
- name: "Ed25519",
46
- namedCurve: "Ed25519",
47
- }, true, ["verify"]);
48
- }
49
- let isValid;
50
- try {
51
- isValid = await subtleCrypto.verify("Ed25519", this.publicCryptoKey, signature, data);
52
- }
53
- catch (error) {
54
- throw new Error("invalid signature");
55
- }
56
- if (!isValid) {
57
- throw new Error("invalid signature");
58
- }
59
- }
60
- }
61
- /**
62
- * Creates a signer from a header.
63
- *
64
- * @param header - The header to create a signer from.
65
- *
66
- * @returns A signer for the header.
67
- */
68
- const createSignerFromHeader = async (header) => {
69
- return new PublicKeySigner(header.sig.publicKey);
70
- };
71
- /**
72
- * Signs a header. Generally, this is not called directly, but rather through
73
- * {@link createSignedHeader}.
74
- *
75
- * @param parameters - The parameters used to sign the header.
76
- * @param signer - The signer of the document.
77
- *
78
- * @returns The signature of the header.
79
- */
80
- export const sign = async (parameters, signer) => {
81
- // Generate stable payload
82
- const payload = generateStablePayload(parameters);
83
- // Convert payload to Uint8Array for signing
84
- const encoder = new TextEncoder();
85
- const data = encoder.encode(payload);
86
- // Create signature using Web Crypto API with Ed25519
87
- const signature = await signer.sign(data);
88
- // Convert signature to base64 string for JSON serialization
89
- const signatureArray = new Uint8Array(signature);
90
- const signatureBase64 = btoa(String.fromCharCode(...signatureArray));
91
- return signatureBase64;
92
- };
93
- /**
94
- * Verifies a header signature. Generally, this is not called directly, but
95
- * rather through {@link validateHeader}.
96
- *
97
- * @param parameters - The parameters used to sign the header.
98
- * @param signature - The signature to verify.
99
- * @param signer - The signer of the document.
100
- */
101
- export const verify = async (parameters, signature, signer) => {
102
- // Generate the same stable payload that was signed
103
- const payload = generateStablePayload(parameters);
104
- // Convert payload to Uint8Array for verification
105
- const encoder = new TextEncoder();
106
- const data = encoder.encode(payload);
107
- // Decode the base64 signature back to binary
108
- const signatureBytes = Uint8Array.from(atob(signature), (c) => c.charCodeAt(0));
109
- await signer.verify(data, signatureBytes);
110
- };
111
- /**
112
- * Validates a header signature.
113
- */
114
- export const validateHeader = async (header) => {
115
- const signer = await createSignerFromHeader(header);
116
- return await verify({
117
- documentType: header.documentType,
118
- createdAtUtcIso: header.createdAtUtcIso,
119
- nonce: header.sig.nonce,
120
- }, header.id, signer);
121
- };
122
- /**
123
- * Creates a header that has yet to be signed. This header is not valid, but
124
- * can be input into {@link createSignedHeader} to create a signed header.
125
- *
126
- * @returns An unsigned header for a document.
127
- */
128
- export const createUnsignedHeader = () => {
129
- return {
130
- id: generateUUID(),
131
- sig: {
132
- publicKey: {},
133
- nonce: "",
134
- },
135
- documentType: "",
136
- createdAtUtcIso: new Date().toISOString(),
137
- slug: "",
138
- name: "",
139
- branch: "main",
140
- revision: {
141
- document: 0,
142
- },
143
- lastModifiedAtUtcIso: new Date().toISOString(),
144
- meta: {},
145
- };
146
- };
147
- /**
148
- * Creates a new, signed header for a document. This will replace the id of the
149
- * document.
150
- *
151
- * @param unsignedHeader - The unsigned header to created the signed header from.
152
- * @param signer - The signer of the document.
153
- *
154
- * @returns A new signed header for a document. Some fields are mutable and
155
- * some are not. See the PHDocumentHeader type for more information.
156
- */
157
- export const createSignedHeader = async (unsignedHeader, documentType, signer) => {
158
- const parameters = {
159
- documentType,
160
- createdAtUtcIso: unsignedHeader.createdAtUtcIso,
161
- nonce: generateUUID(),
162
- };
163
- const signature = await sign(parameters, signer);
164
- const publicKey = await signer.publicKey();
165
- return {
166
- // immutable fields
167
- id: signature,
168
- sig: {
169
- publicKey,
170
- nonce: parameters.nonce,
171
- },
172
- documentType,
173
- createdAtUtcIso: unsignedHeader.createdAtUtcIso,
174
- // mutable fields
175
- slug: "",
176
- name: "",
177
- branch: "",
178
- revision: {
179
- document: 0,
180
- },
181
- lastModifiedAtUtcIso: unsignedHeader.lastModifiedAtUtcIso,
182
- meta: {},
183
- };
184
- };
185
- /**
186
- * Creates a signed header for a document. The document header requires a signer
187
- * as the document id is a Ed25519 signature.
188
- *
189
- * @param documentType - The type of the document.
190
- * @param signer - The signer of the document.
191
- *
192
- * @returns The signed header for a document. Some fields are mutable and
193
- * some are not. See the PHDocumentHeader type for more information.
194
- */
195
- export const createSignedHeaderForSigner = async (documentType, signer) => {
196
- const unsignedHeader = createUnsignedHeader();
197
- const signedHeader = await createSignedHeader(unsignedHeader, documentType, signer);
198
- return signedHeader;
199
- };
200
- //# sourceMappingURL=header.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"header.js","sourceRoot":"","sources":["../../../../src/document/utils/header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAwC1C;;GAEG;AACH,MAAM,qBAAqB,GAAG,CAAC,UAA6B,EAAU,EAAE,CACtE,GAAG,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,eAAe,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;AAEjF;;GAEG;AACH,MAAM,OAAO,eAAe;IACjB,UAAU,CAAa;IAEb,YAAY,CAAwB;IAC7C,eAAe,CAAwB;IAEjD,YAAY,SAAqB;QAC/B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,I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