@kubuild/schema 0.1.0 → 0.3.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.
@@ -1,4 +1,6 @@
1
1
  import { z } from 'zod';
2
+ import { ActionPipeline } from './actions';
3
+ import { FormConfig } from './form';
2
4
  export declare const SCHEMA_NAME: "stora.page";
3
5
  export declare const CURRENT_SCHEMA_VERSION: "1.0.0";
4
6
  /**
@@ -33,14 +35,63 @@ export declare const ActionBindingSchema: z.ZodObject<{
33
35
  }, z.core.$strip>;
34
36
  export type ActionBinding = z.infer<typeof ActionBindingSchema>;
35
37
  export declare const StyleValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>;
36
- export declare const StyleDefinitionSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>;
37
- export type StyleDefinition = Record<string, string | number | boolean | null | undefined>;
38
+ export type StyleValue = z.infer<typeof StyleValueSchema>;
39
+ /**
40
+ * Standard CSS style definition supporting Flexbox (STORA-101), Sizing constraints (STORA-101),
41
+ * Effects & rounded corners (STORA-101), CSS Grid (STORA-110), and arbitrary CSS properties/tokens.
42
+ */
43
+ export interface StyleDefinition extends Record<string, StyleValue> {
44
+ display?: string;
45
+ flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse' | (string & {});
46
+ flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse' | (string & {});
47
+ justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'start' | 'end' | 'left' | 'right' | (string & {});
48
+ alignItems?: 'stretch' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'start' | 'end' | 'self-start' | 'self-end' | (string & {});
49
+ alignContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | 'stretch' | 'start' | 'end' | (string & {});
50
+ gap?: string | number;
51
+ rowGap?: string | number;
52
+ columnGap?: string | number;
53
+ flexGrow?: number | string;
54
+ flexShrink?: number | string;
55
+ flexBasis?: string | number;
56
+ alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch' | (string & {});
57
+ width?: string | number;
58
+ height?: string | number;
59
+ minWidth?: string | number;
60
+ maxWidth?: string | number;
61
+ minHeight?: string | number;
62
+ maxHeight?: string | number;
63
+ objectFit?: 'fill' | 'contain' | 'cover' | 'none' | 'scale-down' | (string & {});
64
+ objectPosition?: string;
65
+ borderRadius?: string | number;
66
+ borderTopLeftRadius?: string | number;
67
+ borderTopRightRadius?: string | number;
68
+ borderBottomRightRadius?: string | number;
69
+ borderBottomLeftRadius?: string | number;
70
+ backdropFilter?: string;
71
+ filter?: string;
72
+ boxShadow?: string;
73
+ gridTemplateColumns?: string;
74
+ gridTemplateRows?: string;
75
+ gridAutoFlow?: string;
76
+ gridAutoColumns?: string;
77
+ gridAutoRows?: string;
78
+ gridColumn?: string | number;
79
+ gridRow?: string | number;
80
+ gridColumnStart?: string | number;
81
+ gridColumnEnd?: string | number;
82
+ gridRowStart?: string | number;
83
+ gridRowEnd?: string | number;
84
+ colSpan?: number | string;
85
+ rowSpan?: number | string;
86
+ justifySelf?: string;
87
+ }
88
+ export declare const StyleDefinitionSchema: z.ZodType<StyleDefinition>;
38
89
  /**
39
90
  * Pseudo-state style definitions keyed by CSS pseudo-class selector
40
91
  * (e.g. `:hover`, `:focus`, `:active`). Each entry is a style layer applied
41
92
  * on top of the resolved breakpoint styles when the state is active.
42
93
  */
43
- export declare const PseudoStateStylesSchema: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
94
+ export declare const PseudoStateStylesSchema: z.ZodRecord<z.ZodString, z.ZodType<StyleDefinition, unknown, z.core.$ZodTypeInternals<StyleDefinition, unknown>>>;
44
95
  export type PseudoStateStyles = Record<string, StyleDefinition>;
45
96
  /**
46
97
  * Responsive Styles Schema
@@ -48,11 +99,11 @@ export type PseudoStateStyles = Record<string, StyleDefinition>;
48
99
  * Optionally carries `states` — pseudo-class style layers (e.g. `:hover`).
49
100
  */
50
101
  export declare const ResponsiveStylesSchema: z.ZodDefault<z.ZodObject<{
51
- base: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
52
- desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
53
- tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
54
- mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>;
55
- states: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodUndefined]>>>>;
102
+ base: z.ZodOptional<z.ZodType<StyleDefinition, unknown, z.core.$ZodTypeInternals<StyleDefinition, unknown>>>;
103
+ desktop: z.ZodOptional<z.ZodType<StyleDefinition, unknown, z.core.$ZodTypeInternals<StyleDefinition, unknown>>>;
104
+ tablet: z.ZodOptional<z.ZodType<StyleDefinition, unknown, z.core.$ZodTypeInternals<StyleDefinition, unknown>>>;
105
+ mobile: z.ZodOptional<z.ZodType<StyleDefinition, unknown, z.core.$ZodTypeInternals<StyleDefinition, unknown>>>;
106
+ states: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<StyleDefinition, unknown, z.core.$ZodTypeInternals<StyleDefinition, unknown>>>>;
56
107
  }, z.core.$loose>>;
57
108
  export type ResponsiveStyles = z.infer<typeof ResponsiveStylesSchema>;
58
109
  /**
@@ -80,6 +131,8 @@ export type Node = {
80
131
  props?: Record<string, unknown>;
81
132
  styles?: ResponsiveStyles;
82
133
  animation?: AnimationConfig;
134
+ actions?: ActionPipeline[];
135
+ formConfig?: FormConfig;
83
136
  children?: Node[];
84
137
  };
85
138
  /**
@@ -137,6 +190,133 @@ export declare const PageDocumentSchema: z.ZodObject<{
137
190
  document: z.ZodType<RootPageNode, unknown, z.core.$ZodTypeInternals<RootPageNode, unknown>>;
138
191
  }, z.core.$strip>;
139
192
  export type PageDocument = z.infer<typeof PageDocumentSchema>;
193
+ export declare const PROJECT_SCHEMA_NAME: "stora.project";
194
+ export declare const CURRENT_PROJECT_SCHEMA_VERSION: "1.0.0";
195
+ /**
196
+ * Node type used as the in-tree placeholder left behind when a subtree is detached
197
+ * into its own artboard. It carries no children — the real content lives in the
198
+ * artboard named by `props.artboardId`.
199
+ */
200
+ export declare const ARTBOARD_REFERENCE_NODE_TYPE: "artboard-reference";
201
+ /**
202
+ * Artboard Type Schema
203
+ * - 'page': a routable page surface (has a slug)
204
+ * - 'component': a detached surface rendered as an overlay/portal at runtime
205
+ * (modal, drawer, collapsible, or any block the author detached), reached by `triggerId`
206
+ */
207
+ export declare const ArtboardTypeSchema: z.ZodEnum<{
208
+ page: "page";
209
+ component: "component";
210
+ }>;
211
+ export type ArtboardType = z.infer<typeof ArtboardTypeSchema>;
212
+ /**
213
+ * Artboard Schema
214
+ * One top-level surface on the builder canvas. Each artboard embeds a complete
215
+ * PageDocument so that every existing document command, tree utility, validator,
216
+ * and history engine keeps operating on exactly the shape it already understands.
217
+ *
218
+ * Component artboards always wrap their detached node as the sole child of a
219
+ * synthetic `type: 'page'` root, so the root-type constraint never has to be relaxed.
220
+ */
221
+ export declare const ArtboardSchema: z.ZodObject<{
222
+ id: z.ZodString;
223
+ name: z.ZodString;
224
+ artboardType: z.ZodEnum<{
225
+ page: "page";
226
+ component: "component";
227
+ }>;
228
+ slug: z.ZodOptional<z.ZodString>;
229
+ triggerId: z.ZodOptional<z.ZodString>;
230
+ viewport: z.ZodOptional<z.ZodEnum<{
231
+ mobile: "mobile";
232
+ desktop: "desktop";
233
+ tablet: "tablet";
234
+ }>>;
235
+ width: z.ZodOptional<z.ZodNumber>;
236
+ position: z.ZodOptional<z.ZodObject<{
237
+ x: z.ZodNumber;
238
+ y: z.ZodNumber;
239
+ }, z.core.$strip>>;
240
+ document: z.ZodObject<{
241
+ schema: z.ZodLiteral<"stora.page">;
242
+ version: z.ZodDefault<z.ZodString>;
243
+ metadata: z.ZodOptional<z.ZodObject<{
244
+ title: z.ZodDefault<z.ZodString>;
245
+ description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
246
+ author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
247
+ createdAt: z.ZodOptional<z.ZodString>;
248
+ updatedAt: z.ZodOptional<z.ZodString>;
249
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
250
+ category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
251
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
252
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
253
+ }, z.core.$strip>>;
254
+ document: z.ZodType<RootPageNode, unknown, z.core.$ZodTypeInternals<RootPageNode, unknown>>;
255
+ }, z.core.$strip>;
256
+ }, z.core.$strip>;
257
+ export type Artboard = z.infer<typeof ArtboardSchema>;
258
+ /**
259
+ * Project Document Schema
260
+ * Root portable structure holding many artboards:
261
+ * - schema: strictly "stora.project" (distinct from the single-page "stora.page")
262
+ * - version: project schema version string
263
+ * - metadata: serializable metadata
264
+ * - artboards: one or more page/component surfaces
265
+ * - activeArtboardId: which artboard the editor should open
266
+ */
267
+ export declare const ProjectDocumentSchema: z.ZodObject<{
268
+ schema: z.ZodLiteral<"stora.project">;
269
+ version: z.ZodDefault<z.ZodString>;
270
+ metadata: z.ZodOptional<z.ZodObject<{
271
+ title: z.ZodDefault<z.ZodString>;
272
+ description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
273
+ author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
274
+ createdAt: z.ZodOptional<z.ZodString>;
275
+ updatedAt: z.ZodOptional<z.ZodString>;
276
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
277
+ category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
278
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
279
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
280
+ }, z.core.$strip>>;
281
+ artboards: z.ZodArray<z.ZodObject<{
282
+ id: z.ZodString;
283
+ name: z.ZodString;
284
+ artboardType: z.ZodEnum<{
285
+ page: "page";
286
+ component: "component";
287
+ }>;
288
+ slug: z.ZodOptional<z.ZodString>;
289
+ triggerId: z.ZodOptional<z.ZodString>;
290
+ viewport: z.ZodOptional<z.ZodEnum<{
291
+ mobile: "mobile";
292
+ desktop: "desktop";
293
+ tablet: "tablet";
294
+ }>>;
295
+ width: z.ZodOptional<z.ZodNumber>;
296
+ position: z.ZodOptional<z.ZodObject<{
297
+ x: z.ZodNumber;
298
+ y: z.ZodNumber;
299
+ }, z.core.$strip>>;
300
+ document: z.ZodObject<{
301
+ schema: z.ZodLiteral<"stora.page">;
302
+ version: z.ZodDefault<z.ZodString>;
303
+ metadata: z.ZodOptional<z.ZodObject<{
304
+ title: z.ZodDefault<z.ZodString>;
305
+ description: z.ZodDefault<z.ZodOptional<z.ZodString>>;
306
+ author: z.ZodDefault<z.ZodOptional<z.ZodString>>;
307
+ createdAt: z.ZodOptional<z.ZodString>;
308
+ updatedAt: z.ZodOptional<z.ZodString>;
309
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
310
+ category: z.ZodDefault<z.ZodOptional<z.ZodString>>;
311
+ version: z.ZodDefault<z.ZodOptional<z.ZodString>>;
312
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
313
+ }, z.core.$strip>>;
314
+ document: z.ZodType<RootPageNode, unknown, z.core.$ZodTypeInternals<RootPageNode, unknown>>;
315
+ }, z.core.$strip>;
316
+ }, z.core.$strip>>;
317
+ activeArtboardId: z.ZodOptional<z.ZodString>;
318
+ }, z.core.$strip>;
319
+ export type ProjectDocument = z.infer<typeof ProjectDocumentSchema>;
140
320
  /**
141
321
  * Type guards
142
322
  */
@@ -144,6 +324,18 @@ export declare function isAssetReference(value: unknown): value is AssetReferenc
144
324
  export declare function isVariableBinding(value: unknown): value is VariableBinding;
145
325
  export declare function isActionBinding(value: unknown): value is ActionBinding;
146
326
  export declare function isAnimationConfig(value: unknown): value is AnimationConfig;
327
+ export declare function isProjectDocument(value: unknown): value is ProjectDocument;
328
+ /**
329
+ * Cheap structural sniff used by the loader to route a raw payload to either the
330
+ * project pipeline or the legacy single-page pipeline, before any parsing happens.
331
+ * Intentionally does not validate — a malformed project must still be routed to the
332
+ * project parser so its own errors surface, rather than being silently treated as a page.
333
+ */
334
+ export declare function looksLikeProjectDocument(value: unknown): boolean;
335
+ /**
336
+ * Node type guard for the in-tree placeholder that points at a detached artboard.
337
+ */
338
+ export declare function isArtboardReferenceNode(node: Node): boolean;
147
339
  /**
148
340
  * Deterministic Node ID Generator
149
341
  * Generates predictable IDs based on prefix and an index/identifier (not bound to React keys).
@@ -1 +1 @@
1
- {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../src/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,WAAW,EAAG,YAAqB,CAAC;AACjD,eAAO,MAAM,sBAAsB,EAAG,OAAgB,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;;iBAM/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB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,EAAE,OAAO,GAAG,OAAO,CAIhE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAE3D;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAG/F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,CAQnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,IAAI,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAiB/F"}
package/dist/form.d.ts ADDED
@@ -0,0 +1,129 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Validation Rule Types
4
+ * Supported validation primitives for form inputs in KUBUILD.
5
+ */
6
+ export declare const ValidationRuleTypeSchema: z.ZodEnum<{
7
+ required: "required";
8
+ url: "url";
9
+ pattern: "pattern";
10
+ email: "email";
11
+ max_length: "max_length";
12
+ min_length: "min_length";
13
+ numeric_min: "numeric_min";
14
+ numeric_max: "numeric_max";
15
+ match_field: "match_field";
16
+ custom_regex: "custom_regex";
17
+ }>;
18
+ export type ValidationRuleType = z.infer<typeof ValidationRuleTypeSchema>;
19
+ /**
20
+ * Validation Trigger Timing
21
+ * Controls when field validation is evaluated.
22
+ */
23
+ export declare const ValidateOnEventSchema: z.ZodEnum<{
24
+ change: "change";
25
+ blur: "blur";
26
+ submit: "submit";
27
+ }>;
28
+ export type ValidateOnEvent = z.infer<typeof ValidateOnEventSchema>;
29
+ /**
30
+ * Validation Rule Schema
31
+ * Defines an individual validation condition and its custom error message.
32
+ */
33
+ export declare const ValidationRuleSchema: z.ZodObject<{
34
+ type: z.ZodEnum<{
35
+ required: "required";
36
+ url: "url";
37
+ pattern: "pattern";
38
+ email: "email";
39
+ max_length: "max_length";
40
+ min_length: "min_length";
41
+ numeric_min: "numeric_min";
42
+ numeric_max: "numeric_max";
43
+ match_field: "match_field";
44
+ custom_regex: "custom_regex";
45
+ }>;
46
+ value: z.ZodOptional<z.ZodUnknown>;
47
+ message: z.ZodString;
48
+ }, z.core.$strip>;
49
+ export type ValidationRule = z.infer<typeof ValidationRuleSchema>;
50
+ /**
51
+ * Form Field Binding Schema
52
+ * Connects an input component to the form state runtime with validation rules and initial values.
53
+ */
54
+ export declare const FormFieldBindingSchema: z.ZodObject<{
55
+ name: z.ZodString;
56
+ label: z.ZodOptional<z.ZodString>;
57
+ defaultValue: z.ZodOptional<z.ZodUnknown>;
58
+ rules: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodObject<{
59
+ type: z.ZodEnum<{
60
+ required: "required";
61
+ url: "url";
62
+ pattern: "pattern";
63
+ email: "email";
64
+ max_length: "max_length";
65
+ min_length: "min_length";
66
+ numeric_min: "numeric_min";
67
+ numeric_max: "numeric_max";
68
+ match_field: "match_field";
69
+ custom_regex: "custom_regex";
70
+ }>;
71
+ value: z.ZodOptional<z.ZodUnknown>;
72
+ message: z.ZodString;
73
+ }, z.core.$strip>>>>;
74
+ validateOn: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
75
+ change: "change";
76
+ blur: "blur";
77
+ submit: "submit";
78
+ }>>>;
79
+ transform: z.ZodOptional<z.ZodEnum<{
80
+ number: "number";
81
+ trim: "trim";
82
+ lowercase: "lowercase";
83
+ uppercase: "uppercase";
84
+ }>>;
85
+ disabled: z.ZodOptional<z.ZodBoolean>;
86
+ required: z.ZodOptional<z.ZodBoolean>;
87
+ }, z.core.$strip>;
88
+ export type FormFieldBinding = z.infer<typeof FormFieldBindingSchema>;
89
+ /**
90
+ * Form Container Configuration Schema
91
+ * Configuration for form boundaries, submission behavior, and error focus.
92
+ */
93
+ export declare const FormConfigSchema: z.ZodObject<{
94
+ formId: z.ZodString;
95
+ resetOnSubmit: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
96
+ scrollToFirstError: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
97
+ validateOn: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
98
+ change: "change";
99
+ blur: "blur";
100
+ submit: "submit";
101
+ }>>>;
102
+ initialValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
103
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
104
+ type: z.ZodEnum<{
105
+ required: "required";
106
+ url: "url";
107
+ pattern: "pattern";
108
+ email: "email";
109
+ max_length: "max_length";
110
+ min_length: "min_length";
111
+ numeric_min: "numeric_min";
112
+ numeric_max: "numeric_max";
113
+ match_field: "match_field";
114
+ custom_regex: "custom_regex";
115
+ }>;
116
+ value: z.ZodOptional<z.ZodUnknown>;
117
+ message: z.ZodString;
118
+ }, z.core.$strip>>>;
119
+ }, z.core.$strip>;
120
+ export type FormConfig = z.infer<typeof FormConfigSchema>;
121
+ /**
122
+ * Type Guards
123
+ */
124
+ export declare function isValidationRuleType(value: unknown): value is ValidationRuleType;
125
+ export declare function isValidationRule(value: unknown): value is ValidationRule;
126
+ export declare function isValidateOnEvent(value: unknown): value is ValidateOnEvent;
127
+ export declare function isFormFieldBinding(value: unknown): value is FormFieldBinding;
128
+ export declare function isFormConfig(value: unknown): value is FormConfig;
129
+ //# sourceMappingURL=form.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;EAWnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;EAAuC,CAAC;AAC1E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB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