@vitnode/core 1.2.0-canary.48 → 1.2.0-canary.49

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 (125) hide show
  1. package/dist/scripts/plugin.d.ts.map +1 -1
  2. package/dist/scripts/prepare-database.d.ts.map +1 -1
  3. package/dist/scripts/prepare-plugins-files.d.ts +1 -1
  4. package/dist/scripts/prepare-plugins-files.d.ts.map +1 -1
  5. package/dist/scripts/scripts.js +4 -4
  6. package/dist/src/api/config.d.ts.map +1 -1
  7. package/dist/src/api/config.js +3 -1
  8. package/dist/src/api/lib/check-plugin-id.d.ts.map +1 -1
  9. package/dist/src/api/lib/check-plugin-id.js +2 -0
  10. package/dist/src/api/lib/with-pagination.d.ts +2 -24
  11. package/dist/src/api/lib/with-pagination.d.ts.map +1 -1
  12. package/dist/src/api/middlewares/global.middleware.d.ts +7 -1
  13. package/dist/src/api/middlewares/global.middleware.d.ts.map +1 -1
  14. package/dist/src/api/middlewares/global.middleware.js +6 -2
  15. package/dist/src/api/models/email.d.ts +3 -1
  16. package/dist/src/api/models/email.d.ts.map +1 -1
  17. package/dist/src/api/models/email.js +25 -2
  18. package/dist/src/api/modules/admin/admin.module.d.ts +41 -288
  19. package/dist/src/api/modules/admin/admin.module.d.ts.map +1 -1
  20. package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts +23 -131
  21. package/dist/src/api/modules/admin/debug/debug.admin.module.d.ts.map +1 -1
  22. package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts +23 -131
  23. package/dist/src/api/modules/admin/debug/routes/logs.route.d.ts.map +1 -1
  24. package/dist/src/api/modules/admin/routes/session.route.d.ts +2 -52
  25. package/dist/src/api/modules/admin/routes/session.route.d.ts.map +1 -1
  26. package/dist/src/api/modules/admin/users/routes/list.route.d.ts +16 -105
  27. package/dist/src/api/modules/admin/users/routes/list.route.d.ts.map +1 -1
  28. package/dist/src/api/modules/admin/users/routes/users.route.d.ts +18 -105
  29. package/dist/src/api/modules/admin/users/routes/users.route.d.ts.map +1 -1
  30. package/dist/src/api/modules/admin/users/users.admin.module.d.ts +16 -105
  31. package/dist/src/api/modules/admin/users/users.admin.module.d.ts.map +1 -1
  32. package/dist/src/api/modules/middleware/middleware.module.d.ts +7 -36
  33. package/dist/src/api/modules/middleware/middleware.module.d.ts.map +1 -1
  34. package/dist/src/api/modules/middleware/route.d.ts +14 -72
  35. package/dist/src/api/modules/middleware/route.d.ts.map +1 -1
  36. package/dist/src/api/modules/users/routes/session.route.d.ts +2 -54
  37. package/dist/src/api/modules/users/routes/session.route.d.ts.map +1 -1
  38. package/dist/src/api/modules/users/routes/sign-in.route.d.ts +5 -27
  39. package/dist/src/api/modules/users/routes/sign-in.route.d.ts.map +1 -1
  40. package/dist/src/api/modules/users/routes/sign-in.route.js +1 -1
  41. package/dist/src/api/modules/users/routes/sign-out.route.d.ts +1 -5
  42. package/dist/src/api/modules/users/routes/sign-out.route.d.ts.map +1 -1
  43. package/dist/src/api/modules/users/routes/sign-up.route.d.ts +8 -36
  44. package/dist/src/api/modules/users/routes/sign-up.route.d.ts.map +1 -1
  45. package/dist/src/api/modules/users/routes/sign-up.route.js +2 -2
  46. package/dist/src/api/modules/users/routes/test.route.js +1 -1
  47. package/dist/src/api/modules/users/sso/routes/callback.route.d.ts +3 -19
  48. package/dist/src/api/modules/users/sso/routes/callback.route.d.ts.map +1 -1
  49. package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts +2 -10
  50. package/dist/src/api/modules/users/sso/routes/create-url.route.d.ts.map +1 -1
  51. package/dist/src/api/modules/users/sso/sso.module.d.ts +5 -29
  52. package/dist/src/api/modules/users/sso/sso.module.d.ts.map +1 -1
  53. package/dist/src/api/modules/users/users.module.d.ts +16 -128
  54. package/dist/src/api/modules/users/users.module.d.ts.map +1 -1
  55. package/dist/src/components/form/auto-form.d.ts +28 -6
  56. package/dist/src/components/form/auto-form.d.ts.map +1 -1
  57. package/dist/src/components/form/auto-form.js +46 -12
  58. package/dist/src/components/form/fields/checkbox.d.ts +3 -7
  59. package/dist/src/components/form/fields/checkbox.d.ts.map +1 -1
  60. package/dist/src/components/form/fields/checkbox.js +5 -4
  61. package/dist/src/components/form/fields/combobox-async.d.ts +3 -6
  62. package/dist/src/components/form/fields/combobox-async.d.ts.map +1 -1
  63. package/dist/src/components/form/fields/combobox-async.js +4 -4
  64. package/dist/src/components/form/fields/combobox.d.ts +3 -6
  65. package/dist/src/components/form/fields/combobox.d.ts.map +1 -1
  66. package/dist/src/components/form/fields/combobox.js +4 -5
  67. package/dist/src/components/form/fields/input.d.ts +3 -8
  68. package/dist/src/components/form/fields/input.d.ts.map +1 -1
  69. package/dist/src/components/form/fields/input.js +8 -4
  70. package/dist/src/components/form/fields/radio-group.d.ts +3 -6
  71. package/dist/src/components/form/fields/radio-group.d.ts.map +1 -1
  72. package/dist/src/components/form/fields/radio-group.js +4 -5
  73. package/dist/src/components/form/fields/select.d.ts +3 -6
  74. package/dist/src/components/form/fields/select.d.ts.map +1 -1
  75. package/dist/src/components/form/fields/select.js +4 -5
  76. package/dist/src/components/form/fields/switch.d.ts +2 -6
  77. package/dist/src/components/form/fields/switch.d.ts.map +1 -1
  78. package/dist/src/components/form/fields/switch.js +9 -9
  79. package/dist/src/components/form/fields/textarea.d.ts +3 -4
  80. package/dist/src/components/form/fields/textarea.d.ts.map +1 -1
  81. package/dist/src/components/form/fields/textarea.js +5 -3
  82. package/dist/src/components/ui/button-client.d.ts +3 -0
  83. package/dist/src/components/ui/button-client.d.ts.map +1 -0
  84. package/dist/src/components/ui/button-client.js +57 -0
  85. package/dist/src/components/ui/button.d.ts +2 -3
  86. package/dist/src/components/ui/button.d.ts.map +1 -1
  87. package/dist/src/components/ui/button.js +5 -39
  88. package/dist/src/components/ui/form.d.ts +2 -2
  89. package/dist/src/components/ui/form.d.ts.map +1 -1
  90. package/dist/src/components/ui/form.js +2 -2
  91. package/dist/src/components/ui/loader.js +1 -1
  92. package/dist/src/emails/default-template.d.ts +5 -1
  93. package/dist/src/emails/default-template.d.ts.map +1 -1
  94. package/dist/src/emails/default-template.js +10 -11
  95. package/dist/src/lib/api/get-middleware-api.d.ts +1 -1
  96. package/dist/src/lib/api/get-session-admin-api.d.ts +2 -2
  97. package/dist/src/lib/api/get-session-api.d.ts +2 -2
  98. package/dist/src/lib/helpers/auto-form.d.ts +18 -8
  99. package/dist/src/lib/helpers/auto-form.d.ts.map +1 -1
  100. package/dist/src/lib/helpers/auto-form.js +90 -86
  101. package/dist/src/lib/helpers/auto-form.test.js +299 -138
  102. package/dist/src/lib/navigation.d.ts +5 -5
  103. package/dist/src/views/admin/views/core/debug/system-logs/actions/more/more.d.ts +9 -9
  104. package/dist/src/views/admin/views/core/debug/system-logs/system-logs-view.d.ts +10 -10
  105. package/dist/src/views/admin/views/core/test.d.ts.map +1 -1
  106. package/dist/src/views/admin/views/core/test.js +6 -6
  107. package/dist/src/views/auth/components/password-input.d.ts +2 -1
  108. package/dist/src/views/auth/components/password-input.d.ts.map +1 -1
  109. package/dist/src/views/auth/components/password-input.js +15 -8
  110. package/dist/src/views/auth/sign-in/form/use-form.d.ts +4 -16
  111. package/dist/src/views/auth/sign-in/form/use-form.d.ts.map +1 -1
  112. package/dist/src/views/auth/sign-in/form/use-form.js +1 -1
  113. package/dist/src/views/auth/sign-up/form/form.d.ts.map +1 -1
  114. package/dist/src/views/auth/sign-up/form/form.js +22 -9
  115. package/dist/src/views/auth/sign-up/form/mutation-api.d.ts +1 -1
  116. package/dist/src/views/auth/sign-up/form/use-form.d.ts +18 -36
  117. package/dist/src/views/auth/sign-up/form/use-form.d.ts.map +1 -1
  118. package/dist/src/views/auth/sign-up/form/use-form.js +10 -7
  119. package/dist/src/vitnode.config.d.ts +3 -0
  120. package/dist/src/vitnode.config.d.ts.map +1 -1
  121. package/dist/tsconfig.tsbuildinfo +1 -1
  122. package/package.json +21 -18
  123. package/dist/src/components/form/fields/item.d.ts +0 -14
  124. package/dist/src/components/form/fields/item.d.ts.map +0 -1
  125. package/dist/src/components/form/fields/item.js +0 -22
@@ -22,11 +22,7 @@ export declare const createUrlRoute: {
22
22
  request: {
23
23
  params: z.ZodObject<{
24
24
  providerId: z.ZodString;
25
- }, "strip", z.ZodTypeAny, {
26
- providerId: string;
27
- }, {
28
- providerId: string;
29
- }>;
25
+ }, z.core.$strip>;
30
26
  };
31
27
  responses: {
32
28
  200: {
@@ -34,11 +30,7 @@ export declare const createUrlRoute: {
34
30
  'application/json': {
35
31
  schema: z.ZodObject<{
36
32
  url: z.ZodString;
37
- }, "strip", z.ZodTypeAny, {
38
- url: string;
39
- }, {
40
- url: string;
41
- }>;
33
+ }, z.core.$strip>;
42
34
  };
43
35
  };
44
36
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"create-url.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/users/sso/routes/create-url.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BzB,CAAC"}
1
+ {"version":3,"file":"create-url.route.d.ts","sourceRoot":"","sources":["../../../../../../../src/api/modules/users/sso/routes/create-url.route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BzB,CAAC"}
@@ -35,21 +35,11 @@ export declare const ssoUserModule: import("../../../../api/lib/module").BuildMo
35
35
  request: {
36
36
  params: import("zod").ZodObject<{
37
37
  providerId: import("zod").ZodString;
38
- }, "strip", import("zod").ZodTypeAny, {
39
- providerId: string;
40
- }, {
41
- providerId: string;
42
- }>;
38
+ }, import("zod/v4/core").$strip>;
43
39
  query: import("zod").ZodObject<{
44
40
  code: import("zod").ZodString;
45
41
  state: import("zod").ZodString;
46
- }, "strip", import("zod").ZodTypeAny, {
47
- code: string;
48
- state: string;
49
- }, {
50
- code: string;
51
- state: string;
52
- }>;
42
+ }, import("zod/v4/core").$strip>;
53
43
  };
54
44
  responses: {
55
45
  200: {
@@ -58,13 +48,7 @@ export declare const ssoUserModule: import("../../../../api/lib/module").BuildMo
58
48
  schema: import("zod").ZodObject<{
59
49
  id: import("zod").ZodNumber;
60
50
  token: import("zod").ZodString;
61
- }, "strip", import("zod").ZodTypeAny, {
62
- token: string;
63
- id: number;
64
- }, {
65
- token: string;
66
- id: number;
67
- }>;
51
+ }, import("zod/v4/core").$strip>;
68
52
  };
69
53
  };
70
54
  description: string;
@@ -96,11 +80,7 @@ export declare const ssoUserModule: import("../../../../api/lib/module").BuildMo
96
80
  request: {
97
81
  params: import("zod").ZodObject<{
98
82
  providerId: import("zod").ZodString;
99
- }, "strip", import("zod").ZodTypeAny, {
100
- providerId: string;
101
- }, {
102
- providerId: string;
103
- }>;
83
+ }, import("zod/v4/core").$strip>;
104
84
  };
105
85
  responses: {
106
86
  200: {
@@ -108,11 +88,7 @@ export declare const ssoUserModule: import("../../../../api/lib/module").BuildMo
108
88
  'application/json': {
109
89
  schema: import("zod").ZodObject<{
110
90
  url: import("zod").ZodString;
111
- }, "strip", import("zod").ZodTypeAny, {
112
- url: string;
113
- }, {
114
- url: string;
115
- }>;
91
+ }, import("zod/v4/core").$strip>;
116
92
  };
117
93
  };
118
94
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"sso.module.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/sso/sso.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAIxB,CAAC"}
1
+ {"version":3,"file":"sso.module.d.ts","sourceRoot":"","sources":["../../../../../../src/api/modules/users/sso/sso.module.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAIxB,CAAC"}
@@ -36,60 +36,8 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
36
36
  roleId: import("zod").ZodNumber;
37
37
  birthday: import("zod").ZodNullable<import("zod").ZodDate>;
38
38
  isAdmin: import("zod").ZodBoolean;
39
- }, "strip", import("zod").ZodTypeAny, {
40
- email: string;
41
- id: number;
42
- name: string;
43
- createdAt: Date;
44
- nameCode: string;
45
- newsletter: boolean;
46
- avatarColor: string;
47
- emailVerified: boolean;
48
- roleId: number;
49
- birthday: Date | null;
50
- isAdmin: boolean;
51
- }, {
52
- email: string;
53
- id: number;
54
- name: string;
55
- createdAt: Date;
56
- nameCode: string;
57
- newsletter: boolean;
58
- avatarColor: string;
59
- emailVerified: boolean;
60
- roleId: number;
61
- birthday: Date | null;
62
- isAdmin: boolean;
63
- }>>;
64
- }, "strip", import("zod").ZodTypeAny, {
65
- user: {
66
- email: string;
67
- id: number;
68
- name: string;
69
- createdAt: Date;
70
- nameCode: string;
71
- newsletter: boolean;
72
- avatarColor: string;
73
- emailVerified: boolean;
74
- roleId: number;
75
- birthday: Date | null;
76
- isAdmin: boolean;
77
- } | null;
78
- }, {
79
- user: {
80
- email: string;
81
- id: number;
82
- name: string;
83
- createdAt: Date;
84
- nameCode: string;
85
- newsletter: boolean;
86
- avatarColor: string;
87
- emailVerified: boolean;
88
- roleId: number;
89
- birthday: Date | null;
90
- isAdmin: boolean;
91
- } | null;
92
- }>;
39
+ }, import("zod/v4/core").$strip>>;
40
+ }, import("zod/v4/core").$strip>;
93
41
  };
94
42
  };
95
43
  description: string;
@@ -129,18 +77,10 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
129
77
  content: {
130
78
  'application/json': {
131
79
  schema: import("zod").ZodObject<{
132
- email: import("zod").ZodString;
80
+ email: import("zod").ZodEmail;
133
81
  password: import("zod").ZodString;
134
82
  isAdmin: import("zod").ZodOptional<import("zod").ZodBoolean>;
135
- }, "strip", import("zod").ZodTypeAny, {
136
- email: string;
137
- password: string;
138
- isAdmin?: boolean | undefined;
139
- }, {
140
- email: string;
141
- password: string;
142
- isAdmin?: boolean | undefined;
143
- }>;
83
+ }, import("zod/v4/core").$strip>;
144
84
  };
145
85
  };
146
86
  };
@@ -155,13 +95,7 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
155
95
  schema: import("zod").ZodObject<{
156
96
  id: import("zod").ZodNumber;
157
97
  token: import("zod").ZodString;
158
- }, "strip", import("zod").ZodTypeAny, {
159
- token: string;
160
- id: number;
161
- }, {
162
- token: string;
163
- id: number;
164
- }>;
98
+ }, import("zod/v4/core").$strip>;
165
99
  };
166
100
  };
167
101
  description: string;
@@ -194,11 +128,7 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
194
128
  'application/json': {
195
129
  schema: import("zod").ZodObject<{
196
130
  isAdmin: import("zod").ZodOptional<import("zod").ZodBoolean>;
197
- }, "strip", import("zod").ZodTypeAny, {
198
- isAdmin?: boolean | undefined;
199
- }, {
200
- isAdmin?: boolean | undefined;
201
- }>;
131
+ }, import("zod/v4/core").$strip>;
202
132
  };
203
133
  };
204
134
  };
@@ -249,21 +179,11 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
249
179
  content: {
250
180
  'application/json': {
251
181
  schema: import("zod").ZodObject<{
252
- email: import("zod").ZodString;
253
- name: import("zod").ZodEffects<import("zod").ZodString, string, string>;
182
+ email: import("zod").ZodEmail;
183
+ name: import("zod").ZodString;
254
184
  password: import("zod").ZodString;
255
185
  newsletter: import("zod").ZodOptional<import("zod").ZodDefault<import("zod").ZodBoolean>>;
256
- }, "strip", import("zod").ZodTypeAny, {
257
- email: string;
258
- name: string;
259
- password: string;
260
- newsletter?: boolean | undefined;
261
- }, {
262
- email: string;
263
- name: string;
264
- password: string;
265
- newsletter?: boolean | undefined;
266
- }>;
186
+ }, import("zod/v4/core").$strip>;
267
187
  };
268
188
  };
269
189
  };
@@ -275,16 +195,8 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
275
195
  schema: import("zod").ZodObject<{
276
196
  id: import("zod").ZodNumber;
277
197
  emailVerified: import("zod").ZodBoolean;
278
- email: import("zod").ZodString;
279
- }, "strip", import("zod").ZodTypeAny, {
280
- email: string;
281
- id: number;
282
- emailVerified: boolean;
283
- }, {
284
- email: string;
285
- id: number;
286
- emailVerified: boolean;
287
- }>;
198
+ email: import("zod").ZodEmail;
199
+ }, import("zod/v4/core").$strip>;
288
200
  };
289
201
  };
290
202
  description: string;
@@ -358,21 +270,11 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
358
270
  request: {
359
271
  params: import("zod").ZodObject<{
360
272
  providerId: import("zod").ZodString;
361
- }, "strip", import("zod").ZodTypeAny, {
362
- providerId: string;
363
- }, {
364
- providerId: string;
365
- }>;
273
+ }, import("zod/v4/core").$strip>;
366
274
  query: import("zod").ZodObject<{
367
275
  code: import("zod").ZodString;
368
276
  state: import("zod").ZodString;
369
- }, "strip", import("zod").ZodTypeAny, {
370
- code: string;
371
- state: string;
372
- }, {
373
- code: string;
374
- state: string;
375
- }>;
277
+ }, import("zod/v4/core").$strip>;
376
278
  };
377
279
  responses: {
378
280
  200: {
@@ -381,13 +283,7 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
381
283
  schema: import("zod").ZodObject<{
382
284
  id: import("zod").ZodNumber;
383
285
  token: import("zod").ZodString;
384
- }, "strip", import("zod").ZodTypeAny, {
385
- token: string;
386
- id: number;
387
- }, {
388
- token: string;
389
- id: number;
390
- }>;
286
+ }, import("zod/v4/core").$strip>;
391
287
  };
392
288
  };
393
289
  description: string;
@@ -419,11 +315,7 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
419
315
  request: {
420
316
  params: import("zod").ZodObject<{
421
317
  providerId: import("zod").ZodString;
422
- }, "strip", import("zod").ZodTypeAny, {
423
- providerId: string;
424
- }, {
425
- providerId: string;
426
- }>;
318
+ }, import("zod/v4/core").$strip>;
427
319
  };
428
320
  responses: {
429
321
  200: {
@@ -431,11 +323,7 @@ export declare const usersModule: import("../../../api/lib/module").BuildModuleR
431
323
  'application/json': {
432
324
  schema: import("zod").ZodObject<{
433
325
  url: import("zod").ZodString;
434
- }, "strip", import("zod").ZodTypeAny, {
435
- url: string;
436
- }, {
437
- url: string;
438
- }>;
326
+ }, import("zod/v4/core").$strip>;
439
327
  };
440
328
  };
441
329
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAKtB,CAAC"}
1
+ {"version":3,"file":"users.module.d.ts","sourceRoot":"","sources":["../../../../../src/api/modules/users/users.module.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mQAKtB,CAAC"}
@@ -1,17 +1,39 @@
1
- import type { Mode, UseFormReturn } from 'react-hook-form';
2
- import type { z } from 'zod';
1
+ import { type ControllerRenderProps, type FieldPath, type FieldValues, type Mode, type UseFormReturn } from 'react-hook-form';
2
+ import * as z from 'zod';
3
3
  import type { routeMiddlewareSchema } from '../../api/modules/middleware/route';
4
- import type { ItemAutoFormProps } from './fields/item';
5
4
  import { Button } from '../ui/button';
6
- export type AutoFormOnSubmit<T extends z.ZodTypeAny> = (values: z.infer<T>, form: UseFormReturn<z.infer<T>>, options: {
5
+ export interface ItemAutoFormComponentProps {
6
+ description?: React.ReactNode;
7
+ field: ControllerRenderProps<FieldValues, string>;
8
+ label?: React.ReactNode;
9
+ otherProps: {
10
+ enum?: string[];
11
+ isOptional?: boolean;
12
+ maxLength?: number;
13
+ minLength?: number;
14
+ pattern?: string;
15
+ type?: string;
16
+ };
17
+ }
18
+ type ItemAutoFormProps<T extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>, TName extends FieldPath<z.infer<T>> = FieldPath<z.infer<T>>> = {
19
+ component: (props: ItemAutoFormComponentProps) => React.ReactNode;
20
+ id: TName;
21
+ } | {
22
+ component?: never;
23
+ description?: React.ReactNode;
24
+ id: TName;
25
+ label?: React.ReactNode;
26
+ };
27
+ export type AutoFormOnSubmit<T extends z.ZodObject<z.ZodRawShape>, TContext = unknown> = (values: z.infer<T>, form: UseFormReturn<z.input<T>, TContext, z.output<T>>, options: {
7
28
  captchaToken: string;
8
29
  }) => Promise<void> | void;
9
- export declare function AutoForm<T extends z.ZodEffects<z.ZodObject<z.ZodRawShape>> | z.ZodObject<z.ZodRawShape>, TContext = unknown>({ formSchema, onSubmit: onSubmitProp, fields, submitButtonProps, mode, captcha, ...props }: Omit<React.ComponentProps<'form'>, 'onSubmit'> & {
30
+ export declare function AutoForm<T extends z.ZodObject<z.ZodRawShape>, TContext = unknown>({ formSchema, mode, onSubmit: onSubmitProp, captcha, fields, submitButtonProps, ...props }: Omit<React.ComponentProps<'form'>, 'onSubmit'> & {
10
31
  captcha?: z.infer<typeof routeMiddlewareSchema>['captcha'];
11
32
  fields: ItemAutoFormProps<T>[];
12
33
  formSchema: T;
13
34
  mode?: Mode;
14
- onSubmit?: AutoFormOnSubmit<T>;
35
+ onSubmit?: AutoFormOnSubmit<T, TContext>;
15
36
  submitButtonProps?: Omit<React.ComponentProps<typeof Button>, 'isLoading' | 'type'>;
16
37
  }): import("react/jsx-runtime").JSX.Element;
38
+ export {};
17
39
  //# sourceMappingURL=auto-form.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auto-form.d.ts","sourceRoot":"","sources":["../../../../src/components/form/auto-form.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,IAAI,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQ7B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAKtC,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,IAAI,CACrD,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAClB,IAAI,EAA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,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAClB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EACtD,OAAO,EAAE;IACP,YAAY,EAAE,MAAM,CAAC;CACtB,KACE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE1B,wBAAgB,QAAQ,CACtB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,EACpC,QAAQ,GAAG,OAAO,EAClB,EACA,UAAU,EACV,IAAI,EACJ,QAAQ,EAAE,YAAY,EACtB,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IAClD,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC;IAC3D,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,UAAU,EAAE,CAAC,CAAC;IACd,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,gBAAgB,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IACzC,iBAAiB,CAAC,EAAE,IAAI,CACtB,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EACnC,WAAW,GAAG,MAAM,CACrB,CAAC;CACH,2CA2HA"}
@@ -1,23 +1,23 @@
1
1
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { zodResolver } from "@hookform/resolvers/zod";
4
4
  import { useTranslations } from "next-intl";
5
5
  import { useForm } from "react-hook-form";
6
- import { getDefaultValues, getObjectFormSchema } from "../../lib/helpers/auto-form.js";
6
+ import * as z from "zod";
7
7
  import { useCaptcha } from "../../hooks/use-captcha.js";
8
+ import { getDefaults, getNestedParam, getZodInputParams } from "../../lib/helpers/auto-form.js";
8
9
  import { Button } from "../ui/button.js";
9
10
  import { DialogClose, DialogFooter, useDialog } from "../ui/dialog.js";
10
- import { Form } from "../ui/form.js";
11
- import { ItemAutoForm } from "./fields/item.js";
12
- export function AutoForm({ formSchema, onSubmit: onSubmitProp, fields, submitButtonProps, mode, captcha, ...props }) {
11
+ import { Form, FormField } from "../ui/form.js";
12
+ export function AutoForm({ formSchema, mode, onSubmit: onSubmitProp, captcha, fields, submitButtonProps, ...props }) {
13
13
  const { isReady, getToken: getTokenCaptcha, onReset: onResetCaptcha } = useCaptcha(captcha);
14
14
  const { setIsDirty } = useDialog();
15
- const objectFormSchema = getObjectFormSchema(formSchema);
16
- const defaultValues = getDefaultValues(objectFormSchema);
17
15
  const t = useTranslations('core.global');
16
+ const jsonSchema = z.toJSONSchema(formSchema);
17
+ const inputParams = getZodInputParams(jsonSchema);
18
18
  const form = useForm({
19
19
  resolver: zodResolver(formSchema),
20
- defaultValues,
20
+ defaultValues: getDefaults(jsonSchema),
21
21
  mode
22
22
  });
23
23
  const onSubmit = async (values)=>{
@@ -44,10 +44,44 @@ export function AutoForm({ formSchema, onSubmit: onSubmitProp, fields, submitBut
44
44
  onSubmit: onSubmit,
45
45
  ...props,
46
46
  children: [
47
- fields.map((field)=>/*#__PURE__*/ _jsx(ItemAutoForm, {
48
- formSchema: formSchema,
49
- ...field
50
- }, field.id)),
47
+ fields.map((item)=>{
48
+ const params = getNestedParam(inputParams, item.id);
49
+ if (!params) return null;
50
+ if (!item.component && (item.label || item.description)) {
51
+ return /*#__PURE__*/ _jsxs("div", {
52
+ children: [
53
+ item.label && /*#__PURE__*/ _jsx("span", {
54
+ className: "text-xl font-semibold leading-none tracking-tight",
55
+ children: item.label
56
+ }),
57
+ item.description && /*#__PURE__*/ _jsx("div", {
58
+ className: "text-muted-foreground text-sm",
59
+ children: item.description
60
+ })
61
+ ]
62
+ }, item.id);
63
+ }
64
+ if (!item.component) return null;
65
+ return /*#__PURE__*/ _jsx(FormField, {
66
+ name: item.id,
67
+ render: ({ field })=>{
68
+ return /*#__PURE__*/ _jsx(_Fragment, {
69
+ children: item.component({
70
+ field,
71
+ description: typeof params.description === 'string' ? params.description : '',
72
+ otherProps: {
73
+ isOptional: !params.required,
74
+ enum: Array.isArray(params.enum) ? params.enum : undefined,
75
+ maxLength: typeof params.maxLength === 'number' ? params.maxLength : undefined,
76
+ minLength: typeof params.minLength === 'number' ? params.minLength : undefined,
77
+ pattern: typeof params.pattern === 'string' ? params.pattern : undefined,
78
+ type: params.type === 'string' ? params.type : undefined
79
+ }
80
+ })
81
+ });
82
+ }
83
+ }, item.id);
84
+ }),
51
85
  captcha && /*#__PURE__*/ _jsx("div", {
52
86
  id: "vitnode_captcha"
53
87
  }),
@@ -1,8 +1,4 @@
1
- import type { z } from 'zod';
2
- import { Checkbox } from '../../../components/ui/checkbox';
3
- import type { ItemAutoFormComponentProps } from './item';
4
- export declare function AutoFormCheckbox<T extends z.ZodTypeAny>({ label, field, shape: _, description, ...props }: ItemAutoFormComponentProps<T> & Omit<React.ComponentProps<typeof Checkbox>, 'checked'> & {
5
- description?: React.ReactNode;
6
- label?: React.ReactNode;
7
- }): import("react/jsx-runtime").JSX.Element;
1
+ import type { ItemAutoFormComponentProps } from '../auto-form';
2
+ import { Checkbox } from '../../ui/checkbox';
3
+ export declare const AutoFormCheckbox: ({ label, description, otherProps: { isOptional }, field, ...props }: ItemAutoFormComponentProps & Omit<React.ComponentProps<typeof Checkbox>, "checked">) => import("react/jsx-runtime").JSX.Element;
8
4
  //# sourceMappingURL=checkbox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAKzD,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EACvD,KAAK,EACL,KAAK,EAEL,KAAK,EAAE,CAAC,EACR,WAAW,EACX,GAAG,KAAK,EACT,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAC9B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,EAAE,SAAS,CAAC,GAAG;IACvD,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB,2CAuBF"}
1
+ {"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAK7C,eAAO,MAAM,gBAAgB,GAAI,qEAM9B,0BAA0B,GAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,EAAE,SAAS,CAAC,4CA0BvD,CAAC"}
@@ -3,18 +3,18 @@ import { Checkbox } from "../../ui/checkbox.js";
3
3
  import { FormControl, FormItem, FormMessage } from "../../ui/form.js";
4
4
  import { AutoFormDesc } from "../common/desc.js";
5
5
  import { AutoFormLabel } from "../common/label.js";
6
- export function AutoFormCheckbox({ label, field, // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- shape: _, description, ...props }) {
6
+ export const AutoFormCheckbox = ({ label, description, otherProps: { isOptional }, field, ...props })=>{
8
7
  return /*#__PURE__*/ _jsxs(FormItem, {
9
8
  className: "flex flex-row items-start space-x-3 space-y-0 rounded-md border p-4",
10
9
  children: [
11
10
  /*#__PURE__*/ _jsx(FormControl, {
12
11
  children: /*#__PURE__*/ _jsx(Checkbox, {
13
- checked: field.value || false,
12
+ checked: field.value ?? false,
14
13
  onCheckedChange: (e)=>{
15
14
  field.onChange(e);
16
15
  props.onCheckedChange?.(e);
17
16
  },
17
+ ...field,
18
18
  ...props
19
19
  })
20
20
  }),
@@ -22,6 +22,7 @@ shape: _, description, ...props }) {
22
22
  className: "space-y-1 leading-none",
23
23
  children: [
24
24
  label && /*#__PURE__*/ _jsx(AutoFormLabel, {
25
+ isOptional: isOptional,
25
26
  children: label
26
27
  }),
27
28
  description && /*#__PURE__*/ _jsx(AutoFormDesc, {
@@ -32,4 +33,4 @@ shape: _, description, ...props }) {
32
33
  })
33
34
  ]
34
35
  });
35
- }
36
+ };
@@ -1,9 +1,7 @@
1
- import type { z } from 'zod';
2
1
  import React from 'react';
3
2
  import { Button } from '../../../components/ui/button';
4
- import type { ItemAutoFormComponentProps } from './item';
5
- export declare function AutoFormComboboxAsync<T extends z.ZodTypeAny>({ label, field, description, shape: _s, placeholder, className, id, searchPlaceholder, fetchData, ...props }: ItemAutoFormComponentProps<T> & Omit<React.ComponentProps<typeof Button>, 'role' | 'variant'> & {
6
- description?: React.ReactNode;
3
+ import type { ItemAutoFormComponentProps } from '../auto-form';
4
+ export declare const AutoFormComboboxAsync: ({ label, field, description, placeholder, className, id, otherProps: { isOptional }, searchPlaceholder, fetchData, ...props }: ItemAutoFormComponentProps & Omit<React.ComponentProps<typeof Button>, "role" | "variant"> & {
7
5
  fetchData: (params: {
8
6
  search: string;
9
7
  }) => Promise<{
@@ -14,8 +12,7 @@ export declare function AutoFormComboboxAsync<T extends z.ZodTypeAny>({ label, f
14
12
  value: string;
15
13
  }[];
16
14
  id: string;
17
- label?: React.ReactNode;
18
15
  placeholder?: string;
19
16
  searchPlaceholder?: string;
20
- }): import("react/jsx-runtime").JSX.Element;
17
+ }) => import("react/jsx-runtime").JSX.Element;
21
18
  //# sourceMappingURL=combobox-async.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combobox-async.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/combobox-async.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAK7B,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAiBhD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,QAAQ,CAAC;AAMzD,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,EAC5D,KAAK,EACL,KAAK,EACL,WAAW,EAEX,KAAK,EAAE,EAAE,EACT,WAAW,EACX,SAAS,EACT,EAAE,EACF,iBAAiB,EACjB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,0BAA0B,CAAC,CAAC,CAAC,GAC9B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG;IAC9D,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAClC,OAAO,CACL;QACE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CACJ,GACD;QACE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACR,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,2CAgGF"}
1
+ {"version":3,"file":"combobox-async.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/combobox-async.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAiBhD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAM/D,eAAO,MAAM,qBAAqB,GAAI,+HAWnC,0BAA0B,GAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG;IAC9D,SAAS,EAAE,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAClC,OAAO,CACL;QACE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CACJ,GACD;QACE,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACR,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,4CA8FF,CAAC"}
@@ -12,8 +12,7 @@ import { cn } from "../../../lib/utils.js";
12
12
  import { Skeleton } from "../../ui/skeleton.js";
13
13
  import { AutoFormDesc } from "../common/desc.js";
14
14
  import { AutoFormLabel } from "../common/label.js";
15
- export function AutoFormComboboxAsync({ label, field, description, // eslint-disable-next-line @typescript-eslint/no-unused-vars
16
- shape: _s, placeholder, className, id, searchPlaceholder, fetchData, ...props }) {
15
+ export const AutoFormComboboxAsync = ({ label, field, description, placeholder, className, id, otherProps: { isOptional }, searchPlaceholder, fetchData, ...props })=>{
17
16
  const t = useTranslations('core.global');
18
17
  const [search, setSearch] = React.useState('');
19
18
  const { data, isLoading } = useQuery({
@@ -36,6 +35,7 @@ shape: _s, placeholder, className, id, searchPlaceholder, fetchData, ...props })
36
35
  className: "flex flex-col",
37
36
  children: [
38
37
  label && /*#__PURE__*/ _jsx(AutoFormLabel, {
38
+ isOptional: isOptional,
39
39
  children: label
40
40
  }),
41
41
  /*#__PURE__*/ _jsxs(Popover, {
@@ -50,7 +50,7 @@ shape: _s, placeholder, className, id, searchPlaceholder, fetchData, ...props })
50
50
  variant: "outline",
51
51
  ...props,
52
52
  children: [
53
- field.value && field.value.label ? field.value.label : placeholder ?? t('select_option'),
53
+ field.value?.label ?? placeholder ?? t('select_option'),
54
54
  /*#__PURE__*/ _jsx(ChevronsUpDown, {
55
55
  className: "ml-2 size-4 shrink-0 opacity-50"
56
56
  })
@@ -113,4 +113,4 @@ shape: _s, placeholder, className, id, searchPlaceholder, fetchData, ...props })
113
113
  /*#__PURE__*/ _jsx(FormMessage, {})
114
114
  ]
115
115
  });
116
- }
116
+ };
@@ -1,15 +1,12 @@
1
- import type { z } from 'zod';
2
1
  import React from 'react';
3
2
  import { Button } from '../../../components/ui/button';
4
- import type { ItemAutoFormComponentProps } from './item';
5
- export declare function AutoFormCombobox<T extends z.ZodTypeAny>({ label, field, description, shape, placeholder, className, labels, searchPlaceholder, ...props }: ItemAutoFormComponentProps<T> & Omit<React.ComponentProps<typeof Button>, 'role' | 'variant'> & {
6
- description?: React.ReactNode;
7
- label?: React.ReactNode;
3
+ import type { ItemAutoFormComponentProps } from '../auto-form';
4
+ export declare const AutoFormCombobox: ({ label, field, description, placeholder, className, otherProps: { enum: enumValues, isOptional }, labels, searchPlaceholder, ...props }: ItemAutoFormComponentProps & Omit<React.ComponentProps<typeof Button>, "role" | "variant"> & {
8
5
  labels?: {
9
6
  label: string;
10
7
  value: string;
11
8
  }[];
12
9
  placeholder?: string;
13
10
  searchPlaceholder?: string;
14
- }): import("react/jsx-runtime").JSX.Element;
11
+ }) => import("react/jsx-runtime").JSX.Element;
15
12
  //# sourceMappingURL=combobox.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/fields/combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAI7B,OAAO,KAAK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