ts-ag 1.0.4 → 1.0.6

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 (92) hide show
  1. package/README.md +2 -5
  2. package/dist/browser.d.ts +1 -0
  3. package/dist/browser.d.ts.map +1 -1
  4. package/dist/browser.js +1 -0
  5. package/dist/cognito/errors.d.ts +15 -0
  6. package/dist/cognito/errors.d.ts.map +1 -1
  7. package/dist/cognito/errors.js +16 -43
  8. package/dist/cognito/password.d.ts +146 -17
  9. package/dist/cognito/password.d.ts.map +1 -1
  10. package/dist/cognito/password.js +178 -58
  11. package/dist/cognito/user.d.ts +12 -2
  12. package/dist/cognito/user.d.ts.map +1 -1
  13. package/dist/cognito/user.js +17 -9
  14. package/dist/dynamo/errors.d.ts.map +1 -1
  15. package/dist/dynamo/errors.js +2 -4
  16. package/dist/lambda/client-types.d.ts +17 -17
  17. package/dist/lambda/client-types.d.ts.map +1 -1
  18. package/dist/lambda/client-types.js +1 -9
  19. package/dist/lambda/client.d.ts.map +1 -1
  20. package/dist/lambda/client.js +4 -5
  21. package/dist/lambda/deserializer.d.ts +1 -2
  22. package/dist/lambda/deserializer.d.ts.map +1 -1
  23. package/dist/lambda/deserializer.js +12 -11
  24. package/dist/lambda/errors.d.ts +3 -3
  25. package/dist/lambda/errors.d.ts.map +1 -1
  26. package/dist/lambda/errors.js +3 -12
  27. package/dist/lambda/handlerUtils.d.ts.map +1 -1
  28. package/dist/lambda/handlerUtils.js +1 -4
  29. package/dist/lambda/response.d.ts.map +1 -1
  30. package/dist/lambda/response.js +8 -69
  31. package/dist/lambda/serializer.d.ts +1 -6
  32. package/dist/lambda/serializer.d.ts.map +1 -1
  33. package/dist/lambda/serializer.js +15 -15
  34. package/dist/lambda/server/authentication.d.ts +1 -1
  35. package/dist/lambda/server/authentication.js +1 -1
  36. package/dist/rehype/browser.d.ts.map +1 -1
  37. package/dist/rehype/flat-toc.d.ts.map +1 -1
  38. package/dist/rehype/flat-toc.js +1 -7
  39. package/dist/rehype/index.d.ts.map +1 -1
  40. package/dist/s3/errors.d.ts +2 -0
  41. package/dist/s3/errors.d.ts.map +1 -1
  42. package/dist/s3/errors.js +2 -6
  43. package/dist/scripts/clean-dist.d.ts +3 -0
  44. package/dist/scripts/clean-dist.d.ts.map +1 -0
  45. package/dist/scripts/{clean.js → clean-dist.js} +6 -4
  46. package/dist/scripts/ts-alias.js +16 -26
  47. package/dist/ses/errors.d.ts.map +1 -1
  48. package/dist/ses/errors.js +1 -3
  49. package/dist/utils/browser.d.ts +3 -0
  50. package/dist/utils/browser.d.ts.map +1 -0
  51. package/dist/utils/browser.js +2 -0
  52. package/dist/utils/index.d.ts +1 -0
  53. package/dist/utils/index.d.ts.map +1 -1
  54. package/dist/utils/index.js +1 -0
  55. package/dist/utils/object.d.ts +16 -0
  56. package/dist/utils/object.d.ts.map +1 -0
  57. package/dist/utils/object.js +43 -0
  58. package/dist/utils/valibot.d.ts +12 -0
  59. package/dist/utils/valibot.d.ts.map +1 -0
  60. package/dist/utils/valibot.js +142 -0
  61. package/package.json +68 -55
  62. package/src/browser.ts +2 -0
  63. package/src/cognito/errors.ts +15 -42
  64. package/src/cognito/password.ts +207 -60
  65. package/src/cognito/user.ts +26 -10
  66. package/src/dynamo/errors.ts +1 -3
  67. package/src/lambda/client-types.ts +26 -64
  68. package/src/lambda/client.ts +3 -5
  69. package/src/lambda/deserializer.ts +11 -11
  70. package/src/lambda/errors.ts +3 -12
  71. package/src/lambda/handlerUtils.ts +4 -21
  72. package/src/lambda/response.ts +8 -69
  73. package/src/lambda/serializer.ts +14 -14
  74. package/src/rehype/browser.ts +1 -1
  75. package/src/rehype/flat-toc.ts +5 -21
  76. package/src/rehype/index.ts +1 -1
  77. package/src/s3/errors.ts +5 -6
  78. package/src/scripts/{clean.ts → clean-dist.ts} +8 -6
  79. package/src/scripts/ts-alias.ts +18 -27
  80. package/src/ses/errors.ts +1 -3
  81. package/src/utils/browser.ts +2 -0
  82. package/src/utils/index.ts +3 -1
  83. package/src/utils/object.ts +45 -0
  84. package/src/utils/valibot.ts +163 -0
  85. package/dist/lambda/authentication.d.ts +0 -2
  86. package/dist/lambda/authentication.d.ts.map +0 -1
  87. package/dist/lambda/authentication.js +0 -1
  88. package/dist/scripts/clean.d.ts +0 -3
  89. package/dist/scripts/clean.d.ts.map +0 -1
  90. package/dist/ts-alias.d.ts +0 -3
  91. package/dist/ts-alias.d.ts.map +0 -1
  92. package/dist/ts-alias.js +0 -167
package/README.md CHANGED
@@ -1,6 +1,3 @@
1
- ### Typescript
1
+ # Typescript
2
2
 
3
- Although shadcn exists here in the repo it is not shipped. This is simply for tooling and nothing else, as such in the
4
- `svelte.config.js` the aliases are added just for typescript, so that they are not resolved by the packaging process.
5
-
6
- This allows consumers to bring their own shadcn components just so long as they resolve `$shadcn`
3
+ [![semantic-release: angular](https://img.shields.io/badge/semantic--release-angular-e10079?logo=semantic-release)](https://github.com/semantic-release/semantic-release)
package/dist/browser.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './lambda/browser.js';
2
2
  export * from './rehype/browser.js';
3
3
  export * from './types/index.js';
4
+ export * from './utils/browser.js';
4
5
  //# sourceMappingURL=browser.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,oBAAoB,CAAC"}
package/dist/browser.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './lambda/browser.js';
2
2
  export * from './rehype/browser.js';
3
3
  export * from './types/index.js';
4
+ export * from './utils/browser.js';
@@ -1,46 +1,61 @@
1
1
  export declare const error_cognito_forbidden: {
2
+ group: "cognito";
2
3
  type: "cognito_forbidden";
3
4
  };
4
5
  export declare const error_cognito_internal: {
6
+ group: "cognito";
5
7
  type: "cognito_internal";
6
8
  };
7
9
  export declare const error_cognito_role: {
10
+ group: "cognito";
8
11
  type: "cognito_role";
9
12
  };
10
13
  export declare const error_cognito_input: {
14
+ group: "cognito";
11
15
  type: "cognito_input";
12
16
  };
13
17
  export declare const error_cognito_auth: {
18
+ group: "cognito";
14
19
  type: "cognito_auth";
15
20
  };
16
21
  export declare const error_cognito_notFound: {
22
+ group: "cognito";
17
23
  type: "cognito_notFound";
18
24
  };
19
25
  export declare const error_cognito_userNotFound: {
26
+ group: "cognito";
20
27
  type: "cognito_userNotFound";
21
28
  };
22
29
  export declare const error_cognito_tooManyRequests: {
30
+ group: "cognito";
23
31
  type: "cognito_tooManyRequests";
24
32
  };
25
33
  export declare const error_cognito_passwordPolicy: {
34
+ group: "cognito";
26
35
  type: "cognito_passwordPolicy";
27
36
  };
28
37
  export declare const error_cognito_passwordHistory: {
38
+ group: "cognito";
29
39
  type: "cognito_passwordHistory";
30
40
  };
31
41
  export declare const error_cognito_passwordResetRequired: {
42
+ group: "cognito";
32
43
  type: "cognito_passwordResetRequired";
33
44
  };
34
45
  export declare const error_cognito_codeExpired: {
46
+ group: "cognito";
35
47
  type: "cognito_codeExpired";
36
48
  };
37
49
  export declare const error_cognito_codeMismatch: {
50
+ group: "cognito";
38
51
  type: "cognito_codeMismatch";
39
52
  };
40
53
  export declare const error_cognito_delivery: {
54
+ group: "cognito";
41
55
  type: "cognito_delivery";
42
56
  };
43
57
  export declare const error_cognito_userExists: {
58
+ group: "cognito";
44
59
  type: "cognito_userExists";
45
60
  };
46
61
  export type type_error_cognito_forbidden = typeof error_cognito_forbidden;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/cognito/errors.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,u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AC,CAAC,EAAE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EA4B7D"}
@@ -1,52 +1,25 @@
1
- import { error_lambda_badRequest, error_lambda_conflict, error_lambda_internal, error_lambda_unauthorized, error_lambda_forbidden, error_lambda_notFound } from '../lambda/errors.js';
2
- export const error_cognito_forbidden = {
3
- type: 'cognito_forbidden'
4
- };
5
- export const error_cognito_internal = {
6
- type: 'cognito_internal'
7
- };
8
- export const error_cognito_role = {
9
- type: 'cognito_role'
10
- };
11
- export const error_cognito_input = {
12
- type: 'cognito_input'
13
- };
14
- export const error_cognito_auth = {
15
- type: 'cognito_auth'
16
- };
17
- export const error_cognito_notFound = {
18
- type: 'cognito_notFound'
19
- };
20
- export const error_cognito_userNotFound = {
21
- type: 'cognito_userNotFound'
22
- };
23
- export const error_cognito_tooManyRequests = {
24
- type: 'cognito_tooManyRequests'
25
- };
26
- export const error_cognito_passwordPolicy = {
27
- type: 'cognito_passwordPolicy'
28
- };
29
- export const error_cognito_passwordHistory = {
30
- type: 'cognito_passwordHistory'
31
- };
1
+ import { error_lambda_badRequest, error_lambda_conflict, error_lambda_internal, error_lambda_unauthorized, error_lambda_forbidden, error_lambda_notFound } from '$lambda/errors.js';
2
+ export const error_cognito_forbidden = { group: 'cognito', type: 'cognito_forbidden' };
3
+ export const error_cognito_internal = { group: 'cognito', type: 'cognito_internal' };
4
+ export const error_cognito_role = { group: 'cognito', type: 'cognito_role' };
5
+ export const error_cognito_input = { group: 'cognito', type: 'cognito_input' };
6
+ export const error_cognito_auth = { group: 'cognito', type: 'cognito_auth' };
7
+ export const error_cognito_notFound = { group: 'cognito', type: 'cognito_notFound' };
8
+ export const error_cognito_userNotFound = { group: 'cognito', type: 'cognito_userNotFound' };
9
+ export const error_cognito_tooManyRequests = { group: 'cognito', type: 'cognito_tooManyRequests' };
10
+ export const error_cognito_passwordPolicy = { group: 'cognito', type: 'cognito_passwordPolicy' };
11
+ export const error_cognito_passwordHistory = { group: 'cognito', type: 'cognito_passwordHistory' };
32
12
  export const error_cognito_passwordResetRequired = {
13
+ group: 'cognito',
33
14
  type: 'cognito_passwordResetRequired'
34
15
  };
35
16
  // Confirm forgot password
36
- export const error_cognito_codeExpired = {
37
- type: 'cognito_codeExpired'
38
- };
39
- export const error_cognito_codeMismatch = {
40
- type: 'cognito_codeMismatch'
41
- };
17
+ export const error_cognito_codeExpired = { group: 'cognito', type: 'cognito_codeExpired' };
18
+ export const error_cognito_codeMismatch = { group: 'cognito', type: 'cognito_codeMismatch' };
42
19
  // Forgot password
43
- export const error_cognito_delivery = {
44
- type: 'cognito_delivery'
45
- };
20
+ export const error_cognito_delivery = { group: 'cognito', type: 'cognito_delivery' };
46
21
  // Confirm signup
47
- export const error_cognito_userExists = {
48
- type: 'cognito_userExists'
49
- };
22
+ export const error_cognito_userExists = { group: 'cognito', type: 'cognito_userExists' };
50
23
  const awsToCognitoErrorMap = {
51
24
  ForbiddenException: error_cognito_forbidden,
52
25
  NotAuthorizedException: error_cognito_auth,
@@ -1,53 +1,182 @@
1
1
  import type { type_error_cognito } from './errors.js';
2
2
  import { ResultAsync } from 'neverthrow';
3
+ /**
4
+ * Computes Cognito secret hash used for client-side authentication flows.
5
+ *
6
+ * @param username - Cognito username or alias.
7
+ * @param clientId - Cognito app client ID.
8
+ * @param clientSecret - Cognito app client secret.
9
+ */
3
10
  export declare function computeSecretHash(username: string, clientId: string, clientSecret: string): string;
4
11
  /**
5
- * Changes a users password
6
- * Wraps the cognito sdk to use neverthrow
12
+ * Changes a user's password given a valid access token.
13
+ *
14
+ * @param accessToken - Access token for the authenticated user.
15
+ * @param oldPassword - Current password.
16
+ * @param newPassword - New password to set.
7
17
  */
8
18
  export declare const changePassword: (accessToken: string, oldPassword: string, newPassword: string) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").ChangePasswordCommandOutput, type_error_cognito>;
9
19
  /**
10
- * Changes the password with the confirmation code sent to the email.
11
- * Assumes the existence of process.env.COGNITO_CLIENT_ID and COGNITO_CLIENT_SECRET
12
- * @param username - username or any of their alias attributes
13
- * @param confirmationCode
14
- * @param newPassword
20
+ * Completes a forgot-password flow by submitting the confirmation code and new password.
21
+ *
22
+ * @param a.username - Cognito username or alias.
23
+ * @param a.confirmationCode - Code sent by Cognito to the user.
24
+ * @param a.newPassword - New password to set.
25
+ * @param a.clientId - Cognito app client ID.
26
+ * @param a.clientSecret - Cognito app client secret.
15
27
  */
16
- export declare const confirmForgotPassword: (data: {
28
+ export declare const confirmForgotPassword: (a: {
17
29
  username: string;
18
30
  confirmationCode: string;
19
31
  newPassword: string;
32
+ clientId: string;
33
+ clientSecret: string;
20
34
  }) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").ConfirmForgotPasswordCommandOutput, type_error_cognito>;
21
35
  /**
22
- * Confirms signup
23
- * @param username - username or any alias attribute
36
+ * Confirms a user's signup using the confirmation code sent by Cognito.
37
+ *
38
+ * @param a.username - Cognito username or alias.
39
+ * @param a.confirmationCode - Code sent to the user after signup.
40
+ * @param a.clientId - Cognito app client ID.
41
+ * @param a.clientSecret - Cognito app client secret.
24
42
  */
25
- export declare const confirmSignup: (data: {
43
+ export declare const confirmSignup: (a: {
26
44
  username: string;
27
45
  confirmationCode: string;
46
+ clientId: string;
47
+ clientSecret: string;
28
48
  }) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").ConfirmSignUpCommandOutput, type_error_cognito>;
29
49
  /**
30
- * Sends an email for you to reset your password
50
+ * Starts a forgot-password flow by sending a reset code to the user.
51
+ *
52
+ * @param a.username - Cognito username or alias.
53
+ * @param a.clientId - Cognito app client ID.
54
+ * @param a.clientSecret - Cognito app client secret.
31
55
  */
32
- export declare const forgotPassword: (data: {
56
+ export declare const forgotPassword: (a: {
33
57
  username: string;
58
+ clientId: string;
59
+ clientSecret: string;
34
60
  }) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").ForgotPasswordCommandOutput, type_error_cognito>;
35
- export declare const login: (data: {
61
+ /**
62
+ * Signs a user in with ADMIN_USER_PASSWORD_AUTH.
63
+ *
64
+ * @param a.username - Cognito username or alias.
65
+ * @param a.password - User password.
66
+ * @param a.clientId - Cognito app client ID.
67
+ * @param a.clientSecret - Cognito app client secret.
68
+ * @param a.userPoolId - Cognito user pool ID.
69
+ */
70
+ export declare const login: (a: {
36
71
  username: string;
37
72
  password: string;
73
+ clientId: string;
74
+ clientSecret: string;
75
+ userPoolId: string;
38
76
  }) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").AdminInitiateAuthCommandOutput, type_error_cognito>;
39
- export declare const refreshTokens: (data: {
77
+ /**
78
+ * Exchanges a refresh token for new tokens.
79
+ *
80
+ * @param a.username - Cognito username or alias used to compute secret hash.
81
+ * @param a.refreshToken - Refresh token to exchange.
82
+ * @param a.clientId - Cognito app client ID.
83
+ * @param a.clientSecret - Cognito app client secret.
84
+ * @param a.userPoolId - Cognito user pool ID.
85
+ */
86
+ export declare const refreshTokens: (a: {
40
87
  username: string;
41
88
  refreshToken: string;
89
+ clientId: string;
90
+ clientSecret: string;
91
+ userPoolId: string;
42
92
  }) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").AdminInitiateAuthCommandOutput, type_error_cognito>;
93
+ /**
94
+ * Globally signs out a user by invalidating all refresh tokens.
95
+ *
96
+ * @param accessToken - Access token for the authenticated user.
97
+ */
43
98
  export declare const logout: (accessToken: string) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").GlobalSignOutCommandOutput, type_error_cognito>;
44
- export declare const resetPassword: (data: {
99
+ /**
100
+ * Completes a NEW_PASSWORD_REQUIRED challenge for users who must set a new password.
101
+ *
102
+ * @param a.session - Session returned from the auth challenge.
103
+ * @param a.newPassword - New password to set.
104
+ * @param a.username - Cognito username or alias.
105
+ * @param a.clientId - Cognito app client ID.
106
+ * @param a.clientSecret - Cognito app client secret.
107
+ */
108
+ export declare const resetPassword: (a: {
45
109
  session: string;
46
110
  newPassword: string;
47
111
  username: string;
112
+ clientId: string;
113
+ clientSecret: string;
48
114
  }) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").RespondToAuthChallengeCommandOutput, type_error_cognito>;
49
- export declare const signUp: (data: {
115
+ /**
116
+ * Registers a new user with Cognito and optional custom attributes.
117
+ *
118
+ * @param a.username - Cognito username.
119
+ * @param a.password - User password.
120
+ * @param a.clientId - Cognito app client ID.
121
+ * @param a.clientSecret - Cognito app client secret.
122
+ * @param a.<attribute> - Any additional user attributes to set.
123
+ */
124
+ export declare const signUp: (a: {
50
125
  username: string;
51
126
  password: string;
127
+ clientId: string;
128
+ clientSecret: string;
52
129
  } & Record<string, unknown>) => ResultAsync<import("@aws-sdk/client-cognito-identity-provider").SignUpCommandOutput, type_error_cognito>;
130
+ /**
131
+ * Exchanges an OAuth2 authorization code for Cognito tokens using the token endpoint.
132
+ * See https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html for request/response fields and grant details.
133
+ *
134
+ * @param a.code - Authorization code returned by the hosted UI.
135
+ * @param a.redirectUri - Redirect URI registered with the app client.
136
+ * @param a.clientId - Cognito app client ID.
137
+ * @param a.clientSecret - Cognito app client secret used for Basic Auth.
138
+ * @param a.cognitoDomain - Cognito domain URL (e.g., your-domain.auth.region.amazoncognito.com).
139
+ * @returns Parsed token payload containing `access_token`, `id_token`, `refresh_token`, token type, and expiry.
140
+ */
141
+ export declare const verifyOAuthToken: (a: {
142
+ code: string;
143
+ redirectUri: string;
144
+ clientId: string;
145
+ clientSecret: string;
146
+ cognitoDomain: string;
147
+ }) => ResultAsync<{
148
+ access_token: string;
149
+ id_token: string;
150
+ refresh_token: string;
151
+ token_type: string;
152
+ expires_in: number;
153
+ }, {
154
+ group: "cognito";
155
+ type: "cognito_auth";
156
+ }>;
157
+ /**
158
+ * Exchanges an OAuth2 refresh token for Cognito tokens using the oauth token endpoint.
159
+ * See https://docs.aws.amazon.com/cognito/latest/developerguide/token-endpoint.html for request/response fields and grant details.
160
+ *
161
+ * @param a.redirectUri - Redirect URI registered with the app client.
162
+ * @param a.clientId - Cognito app client ID.
163
+ * @param a.clientSecret - Cognito app client secret used for Basic Auth.
164
+ * @param a.cognitoDomain - Cognito domain URL (e.g., your-domain.auth.region.amazoncognito.com).
165
+ * @returns Parsed token payload containing `access_token`, `id_token`, `refresh_token`, token type, and expiry.
166
+ */
167
+ export declare const refreshOAuthToken: (a: {
168
+ clientId: string;
169
+ clientSecret: string;
170
+ cognitoDomain: string;
171
+ refreshToken: string;
172
+ }) => ResultAsync<{
173
+ access_token: string;
174
+ id_token: string;
175
+ refresh_token: string | undefined;
176
+ token_type: string;
177
+ expires_in: number;
178
+ }, {
179
+ group: "cognito";
180
+ type: "cognito_auth";
181
+ }>;
53
182
  //# sourceMappingURL=password.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"password.d.ts","sourceRoot":"","sources":["../../src/cognito/password.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAOzC,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAIlG;AAID;;;GAGG;AACH,eAAO,MAAM,cAAc,qLAe1B,CAAC;AAIF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;cACb,MAAM;sBAAoB,MAAM;iBAAe,MAAM;6HAgBzE,CAAC;AAIF;;;GAGG;AACH,eAAO,MAAM,aAAa;cACL,MAAM;sBAAoB,MAAM;qHAepD,CAAC;AAIF;;GAEG;AACH,eAAO,MAAM,cAAc;cACN,MAAM;sHAc1B,CAAC;AAIF,eAAO,MAAM,KAAK;cACG,MAAM;cAAY,MAAM;yHAmB5C,CAAC;AAIF,eAAO,MAAM,aAAa;cACL,MAAM;kBAAgB,MAAM;yHAkBhD,CAAC;AAGF,eAAO,MAAM,MAAM,0IAUlB,CAAC;AAIF,eAAO,MAAM,aAAa;aACN,MAAM;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