stated-protocol 5.0.1 → 5.2.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.
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +15 -17
- package/dist/constants.js.map +1 -1
- package/dist/hash.js +8 -16
- package/dist/hash.js.map +1 -1
- package/dist/index.js +5 -21
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +3 -3
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +54 -106
- package/dist/protocol.js.map +1 -1
- package/dist/signature.js +21 -63
- package/dist/signature.js.map +1 -1
- package/dist/types.d.ts +2 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +4 -8
- package/dist/types.js.map +1 -1
- package/dist/utils.js +34 -49
- package/dist/utils.js.map +1 -1
- package/package.json +3 -13
- package/src/constants.ts +4 -3
- package/src/fixtures.test.ts +1 -5
- package/src/organisation-verification.test.ts +0 -3
- package/src/person-verification.test.ts +1 -4
- package/src/protocol.ts +11 -30
- package/src/types.ts +4 -6
- package/dist/esm/constants.d.ts +0 -225
- package/dist/esm/constants.d.ts.map +0 -1
- package/dist/esm/hash.d.ts +0 -37
- package/dist/esm/hash.d.ts.map +0 -1
- package/dist/esm/index.d.ts +0 -6
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -2104
- package/dist/esm/index.js.map +0 -7
- package/dist/esm/protocol.d.ts +0 -30
- package/dist/esm/protocol.d.ts.map +0 -1
- package/dist/esm/signature.d.ts +0 -49
- package/dist/esm/signature.d.ts.map +0 -1
- package/dist/esm/types.d.ts +0 -115
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/utils.d.ts +0 -14
- package/dist/esm/utils.d.ts.map +0 -1
package/dist/constants.d.ts
CHANGED
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;CAMtB,CAAC;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;CAY1B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;CAS9B,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuLrB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE7F,eAAO,MAAM,SAAS,EAAE,MACmG,CAAC;AAE5H,eAAO,MAAM,QAAQ,QAC6V,CAAC;AAEnX,eAAO,MAAM,4BAA4B,QAC4S,CAAC;AAEtV,eAAO,MAAM,sBAAsB,QACoN,CAAC;AAExP,eAAO,MAAM,QAAQ,QAAwC,CAAC;AAE9D,eAAO,MAAM,uBAAuB,QACwD,CAAC;AAE7F,eAAO,MAAM,kBAAkB,QAC6D,CAAC;AAE7F,eAAO,MAAM,YAAY,QAAuD,CAAC;AAEjF,eAAO,MAAM,cAAc,QAA4B,CAAC;AAExD,eAAO,MAAM,UAAU,QACiH,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ratingKeys = exports.PDFSigningKeys = exports.responseKeys = exports.disputeContentKeys = exports.disputeAuthenticityKeys = exports.voteKeys = exports.personVerificationKeys = exports.organisationVerificationKeys = exports.pollKeys = exports.UTCFormat = exports.supportedLanguages = exports.peopleCountBuckets = exports.statementTypes = exports.legalForms = void 0;
|
|
4
|
-
exports.legalForms = {
|
|
1
|
+
export const legalForms = {
|
|
5
2
|
local_government: 'local government',
|
|
6
3
|
state_government: 'state government',
|
|
7
4
|
foreign_affairs_ministry: 'foreign affairs ministry',
|
|
8
5
|
corporation: 'corporation',
|
|
6
|
+
sole_proprietorship: 'sole proprietorship',
|
|
9
7
|
};
|
|
10
|
-
|
|
8
|
+
export const statementTypes = {
|
|
11
9
|
statement: 'statement',
|
|
12
10
|
organisationVerification: 'organisation_verification',
|
|
13
11
|
personVerification: 'person_verification',
|
|
@@ -20,7 +18,7 @@ exports.statementTypes = {
|
|
|
20
18
|
signPdf: 'sign_pdf',
|
|
21
19
|
unsupported: 'unsupported',
|
|
22
20
|
};
|
|
23
|
-
|
|
21
|
+
export const peopleCountBuckets = {
|
|
24
22
|
'0': '0-10',
|
|
25
23
|
'10': '10-100',
|
|
26
24
|
'100': '100-1000',
|
|
@@ -30,7 +28,7 @@ exports.peopleCountBuckets = {
|
|
|
30
28
|
'1000000': '1,000,000+',
|
|
31
29
|
'10000000': '10,000,000+',
|
|
32
30
|
};
|
|
33
|
-
|
|
31
|
+
export const supportedLanguages = {
|
|
34
32
|
aa: 'aa',
|
|
35
33
|
ab: 'ab',
|
|
36
34
|
af: 'af',
|
|
@@ -214,14 +212,14 @@ exports.supportedLanguages = {
|
|
|
214
212
|
zh: 'zh',
|
|
215
213
|
zu: 'zu',
|
|
216
214
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
215
|
+
export const UTCFormat = /(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT/;
|
|
216
|
+
export const pollKeys = /(Type: |The poll outcome is finalized when the following nodes agree: |Voting deadline: |Poll: |Option 1: |Option 2: |Option 3: |Option 4: |Option 5: |Allow free text votes: |Who can vote: |Description: |Country scope: |City scope: |Legal form scope: |Domain scope: |All entities with the following property: |As observed by: |Link to query defining who can vote: )/g;
|
|
217
|
+
export const organisationVerificationKeys = /(Type: |Description: |Name: |English name: |Country: |Legal entity: |Legal form: |Department using the domain: |Owner of the domain: |Foreign domain used for publishing statements: |Province or state: |Business register number: |City: |Longitude: |Latitude: |Population: |Employee count: |Reliability policy: |Confidence: |Public key: )/g;
|
|
218
|
+
export const personVerificationKeys = /(Type: |Description: |Name: |Date of birth: |City of birth: |Country of birth: |Job title: |Employer: |Owner of the domain: |Foreign domain used for publishing statements: |Verification method: |Confidence: |Reliability policy: |Public key: )/g;
|
|
219
|
+
export const voteKeys = /(Type: |Poll id: |Poll: |Option: )/g;
|
|
220
|
+
export const disputeAuthenticityKeys = /(Type: |Description: |Hash of referenced statement: |Confidence: |Reliability policy: )/g;
|
|
221
|
+
export const disputeContentKeys = /(Type: |Description: |Hash of referenced statement: |Confidence: |Reliability policy: )/g;
|
|
222
|
+
export const responseKeys = /(Type: |Hash of referenced statement: |Response: )/;
|
|
223
|
+
export const PDFSigningKeys = /(Type: |Description: )/g;
|
|
224
|
+
export const ratingKeys = /(Type: |Subject type: |Subject name: |URL that identifies the subject: |Document file hash: |Rated quality: |Our rating: |Comment: )/;
|
|
227
225
|
//# sourceMappingURL=constants.js.map
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,gBAAgB,EAAE,kBAAkB;IACpC,gBAAgB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,SAAS,GACpB,yHAAyH,CAAC;AAE5H,MAAM,CAAC,MAAM,QAAQ,GACnB,gXAAgX,CAAC;AAEnX,MAAM,CAAC,MAAM,4BAA4B,GACvC,mVAAmV,CAAC;AAEtV,MAAM,CAAC,MAAM,sBAAsB,GACjC,qPAAqP,CAAC;AAExP,MAAM,CAAC,MAAM,QAAQ,GAAG,qCAAqC,CAAC;AAE9D,MAAM,CAAC,MAAM,uBAAuB,GAClC,0FAA0F,CAAC;AAE7F,MAAM,CAAC,MAAM,kBAAkB,GAC7B,0FAA0F,CAAC;AAE7F,MAAM,CAAC,MAAM,YAAY,GAAG,oDAAoD,CAAC;AAEjF,MAAM,CAAC,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAExD,MAAM,CAAC,MAAM,UAAU,GACrB,sIAAsI,CAAC"}
|
package/dist/hash.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Universal hash utilities using @noble/hashes
|
|
4
3
|
* Works in both browser and Node.js environments
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
exports.toUrlSafeBase64 = exports.fromUrlSafeBase64 = exports.verify = exports.sha256 = void 0;
|
|
8
|
-
exports.base64ToBytes = base64ToBytes;
|
|
9
|
-
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
5
|
+
import { sha256 as nobleSha256 } from '@noble/hashes/sha2.js';
|
|
10
6
|
/**
|
|
11
7
|
* Compute SHA-256 hash of a string and return it as URL-safe base64
|
|
12
8
|
* Works in both browser and Node.js environments
|
|
13
9
|
* @param input - The string or buffer to hash
|
|
14
10
|
* @returns URL-safe base64 encoded hash
|
|
15
11
|
*/
|
|
16
|
-
const sha256 = (input) => {
|
|
12
|
+
export const sha256 = (input) => {
|
|
17
13
|
let data;
|
|
18
14
|
if (typeof input === 'string') {
|
|
19
15
|
const encoder = new TextEncoder();
|
|
@@ -23,46 +19,42 @@ const sha256 = (input) => {
|
|
|
23
19
|
data = input;
|
|
24
20
|
}
|
|
25
21
|
// Use @noble/hashes for consistent cross-platform hashing
|
|
26
|
-
const hashArray = (
|
|
22
|
+
const hashArray = nobleSha256(data);
|
|
27
23
|
// Convert to base64
|
|
28
24
|
const base64 = bytesToBase64(hashArray);
|
|
29
25
|
// Make URL-safe: remove padding and replace + with - and / with _
|
|
30
26
|
const urlSafe = base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
31
27
|
return urlSafe;
|
|
32
28
|
};
|
|
33
|
-
exports.sha256 = sha256;
|
|
34
29
|
/**
|
|
35
30
|
* Verify that content matches a given hash
|
|
36
31
|
* @param content - The content to verify
|
|
37
32
|
* @param hash - The expected hash
|
|
38
33
|
* @returns True if the hash matches
|
|
39
34
|
*/
|
|
40
|
-
const verify = (content, hash) => {
|
|
41
|
-
const computed =
|
|
35
|
+
export const verify = (content, hash) => {
|
|
36
|
+
const computed = sha256(content);
|
|
42
37
|
return computed === hash;
|
|
43
38
|
};
|
|
44
|
-
exports.verify = verify;
|
|
45
39
|
/**
|
|
46
40
|
* Convert URL-safe base64 back to standard base64
|
|
47
41
|
* @param urlSafe - URL-safe base64 string
|
|
48
42
|
* @returns Standard base64 string with padding
|
|
49
43
|
*/
|
|
50
|
-
const fromUrlSafeBase64 = (urlSafe) => {
|
|
44
|
+
export const fromUrlSafeBase64 = (urlSafe) => {
|
|
51
45
|
const base64 = urlSafe.replace(/-/g, '+').replace(/_/g, '/');
|
|
52
46
|
// Add padding if needed
|
|
53
47
|
const padding = '='.repeat((4 - (base64.length % 4)) % 4);
|
|
54
48
|
return base64 + padding;
|
|
55
49
|
};
|
|
56
|
-
exports.fromUrlSafeBase64 = fromUrlSafeBase64;
|
|
57
50
|
/**
|
|
58
51
|
* Convert standard base64 to URL-safe base64
|
|
59
52
|
* @param base64 - Standard base64 string
|
|
60
53
|
* @returns URL-safe base64 string without padding
|
|
61
54
|
*/
|
|
62
|
-
const toUrlSafeBase64 = (base64) => {
|
|
55
|
+
export const toUrlSafeBase64 = (base64) => {
|
|
63
56
|
return base64.replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
64
57
|
};
|
|
65
|
-
exports.toUrlSafeBase64 = toUrlSafeBase64;
|
|
66
58
|
/**
|
|
67
59
|
* Convert bytes to base64 string
|
|
68
60
|
* @param bytes - Uint8Array to convert
|
|
@@ -82,7 +74,7 @@ function bytesToBase64(bytes) {
|
|
|
82
74
|
* @param base64 - Base64 string to convert
|
|
83
75
|
* @returns Uint8Array
|
|
84
76
|
*/
|
|
85
|
-
function base64ToBytes(base64) {
|
|
77
|
+
export function base64ToBytes(base64) {
|
|
86
78
|
// Use atob if available (browser), otherwise use Buffer (Node.js)
|
|
87
79
|
if (typeof atob !== 'undefined') {
|
|
88
80
|
const binaryString = atob(base64);
|
package/dist/hash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hash.js","sourceRoot":"","sources":["../src/hash.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,KAA0B,EAAU,EAAE;IAC3D,IAAI,IAAgB,CAAC;IAErB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,KAAK,CAAC;IACf,CAAC;IAED,0DAA0D;IAC1D,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IAEpC,oBAAoB;IACpB,MAAM,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAAC;IA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AG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,kEAAkE;IAClE,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;QAChC,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7C,KAAK,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QACxC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvD,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./protocol"), exports);
|
|
18
|
-
__exportStar(require("./hash"), exports);
|
|
19
|
-
__exportStar(require("./signature"), exports);
|
|
20
|
-
__exportStar(require("./constants"), exports);
|
|
21
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * from './protocol';
|
|
2
|
+
export * from './hash';
|
|
3
|
+
export * from './signature';
|
|
4
|
+
export * from './constants';
|
|
5
|
+
export * from './types';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
package/dist/protocol.d.ts
CHANGED
|
@@ -11,9 +11,9 @@ export declare const parseStatement: ({ statement: input, }: {
|
|
|
11
11
|
};
|
|
12
12
|
export declare const buildPollContent: ({ deadline, poll, scopeDescription, options, allowArbitraryVote, }: Poll) => string;
|
|
13
13
|
export declare const parsePoll: (content: string, version?: string) => Poll;
|
|
14
|
-
export declare const buildOrganisationVerificationContent: ({ name, englishName, country, city, province, legalForm, department, domain, foreignDomain, serialNumber, confidence, reliabilityPolicy, employeeCount,
|
|
14
|
+
export declare const buildOrganisationVerificationContent: ({ name, englishName, country, city, province, legalForm, department, domain, foreignDomain, serialNumber, confidence, reliabilityPolicy, employeeCount, latitude, longitude, population, publicKey, }: OrganisationVerification) => string;
|
|
15
15
|
export declare const parseOrganisationVerification: (content: string) => OrganisationVerification;
|
|
16
|
-
export declare const buildPersonVerificationContent: ({ name, countryOfBirth, cityOfBirth, ownDomain, foreignDomain, dateOfBirth, jobTitle, employer, verificationMethod, confidence,
|
|
16
|
+
export declare const buildPersonVerificationContent: ({ name, countryOfBirth, cityOfBirth, ownDomain, foreignDomain, dateOfBirth, jobTitle, employer, verificationMethod, confidence, reliabilityPolicy, publicKey, }: PersonVerification) => string;
|
|
17
17
|
export declare const parsePersonVerification: (content: string) => PersonVerification;
|
|
18
18
|
export declare const buildVoteContent: ({ pollHash, poll, vote }: Vote) => string;
|
|
19
19
|
export declare const parseVote: (content: string) => Vote;
|
|
@@ -23,7 +23,7 @@ export declare const buildDisputeContentContent: ({ hash, confidence, reliabilit
|
|
|
23
23
|
export declare const parseDisputeContent: (content: string) => DisputeContent;
|
|
24
24
|
export declare const buildResponseContent: ({ hash, response }: ResponseContent) => string;
|
|
25
25
|
export declare const parseResponseContent: (content: string) => ResponseContent;
|
|
26
|
-
export declare const buildPDFSigningContent: (
|
|
26
|
+
export declare const buildPDFSigningContent: (_params: PDFSigning) => string;
|
|
27
27
|
export declare const parsePDFSigning: (content: string) => PDFSigning;
|
|
28
28
|
export declare const buildRating: ({ subjectName, subjectType, subjectReference, documentFileHash, rating, quality, comment, }: Rating) => string;
|
|
29
29
|
export declare const parseRating: (content: string) => Rating;
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,SAAS,EACT,IAAI,EACJ,wBAAwB,EACxB,kBAAkB,EAClB,IAAI,EACJ,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,UAAU,EACV,MAAM,EAEP,MAAM,SAAS,CAAC;AAKjB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AAExB,eAAO,MAAM,cAAc,GAAI,0GAU5B,SAAS,WA4FX,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,uBAE5B;IACD,SAAS,EAAE,MAAM,CAAC;CACnB,KA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