@zag-js/types 0.1.1 → 0.2.1

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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type * as React from "react";
1
+ import type { JSX } from "./jsx";
2
2
  export declare type Direction = "ltr" | "rtl";
3
3
  export declare type Orientation = "horizontal" | "vertical";
4
4
  export declare type MaybeElement<T extends HTMLElement = HTMLElement> = T | null;
@@ -33,9 +33,6 @@ export declare type Context<T> = T & RootProperties & {
33
33
  */
34
34
  pointerdownNode?: HTMLElement | null;
35
35
  };
36
- export declare type Style = React.CSSProperties & {
37
- [prop: string]: string | number | undefined;
38
- };
36
+ export declare type Style = JSX.CSSProperties;
39
37
  export * from "./prop-types";
40
- export * from "./controls";
41
- //# sourceMappingURL=index.d.ts.map
38
+ export type { JSX };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -19,20 +20,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
20
  // src/index.ts
20
21
  var src_exports = {};
21
22
  __export(src_exports, {
22
- createNormalizer: () => createNormalizer,
23
- defineControls: () => defineControls,
24
- normalizeProp: () => normalizeProp
23
+ createNormalizer: () => createNormalizer
25
24
  });
26
25
  module.exports = __toCommonJS(src_exports);
27
26
 
28
27
  // src/prop-types.ts
29
28
  function createNormalizer(fn) {
30
- return { button: fn, label: fn, input: fn, output: fn, element: fn };
29
+ return new Proxy({}, {
30
+ get() {
31
+ return fn;
32
+ }
33
+ });
31
34
  }
32
- var normalizeProp = createNormalizer((v) => v);
33
-
34
- // src/controls.ts
35
- function defineControls(config) {
36
- return config;
37
- }
38
- //# sourceMappingURL=index.js.map
package/dist/index.mjs CHANGED
@@ -1,16 +1,11 @@
1
1
  // src/prop-types.ts
2
2
  function createNormalizer(fn) {
3
- return { button: fn, label: fn, input: fn, output: fn, element: fn };
4
- }
5
- var normalizeProp = createNormalizer((v) => v);
6
-
7
- // src/controls.ts
8
- function defineControls(config) {
9
- return config;
3
+ return new Proxy({}, {
4
+ get() {
5
+ return fn;
6
+ }
7
+ });
10
8
  }
11
9
  export {
12
- createNormalizer,
13
- defineControls,
14
- normalizeProp
10
+ createNormalizer
15
11
  };
16
- //# sourceMappingURL=index.mjs.map
@@ -1,69 +1,44 @@
1
- import type * as React from "react";
1
+ import type { JSX } from "./jsx";
2
2
  declare type Dict<T = any> = Record<string, T>;
3
3
  declare type Booleanish = boolean | "true" | "false";
4
- declare type Omit<T, K extends keyof T> = {
5
- [P in Exclude<keyof T, K>]?: T[P];
6
- };
7
- declare type WithStyle<T extends {
8
- style?: any;
9
- }> = Omit<T, "style"> & {
10
- style?: T["style"] & {
11
- [prop: string]: string | number | undefined;
12
- };
13
- };
14
4
  declare type DataAttr = {
15
- "data-uid"?: string;
16
- "data-name"?: string;
17
- "data-ownedby"?: string;
18
5
  "data-selected"?: Booleanish;
19
6
  "data-expanded"?: Booleanish;
20
7
  "data-highlighted"?: Booleanish;
21
8
  "data-readonly"?: Booleanish;
9
+ "data-indeterminate"?: Booleanish;
22
10
  "data-invalid"?: Booleanish;
23
11
  "data-hover"?: Booleanish;
24
12
  "data-active"?: Booleanish;
25
13
  "data-focus"?: Booleanish;
26
14
  "data-disabled"?: Booleanish;
27
- "data-type"?: string;
28
- "data-value"?: string | number;
29
- "data-valuetext"?: string;
30
15
  "data-open"?: Booleanish;
31
- "data-placement"?: string;
32
- "data-orientation"?: "horizontal" | "vertical";
33
- "data-label"?: string;
34
16
  "data-checked"?: Booleanish;
35
17
  "data-pressed"?: Booleanish;
36
- "data-state"?: string | null;
18
+ "data-complete"?: Booleanish;
19
+ "data-empty"?: Booleanish;
20
+ "data-placeholder-shown"?: Booleanish;
37
21
  "data-half"?: Booleanish;
38
- "data-count"?: number;
22
+ "data-uid"?: string;
23
+ "data-name"?: string;
24
+ "data-ownedby"?: string;
25
+ "data-type"?: string;
26
+ "data-valuetext"?: string;
27
+ "data-placement"?: string;
39
28
  "data-controls"?: string;
40
29
  "data-part"?: string;
30
+ "data-label"?: string;
31
+ "data-state"?: string | null;
32
+ "data-value"?: string | number;
33
+ "data-orientation"?: "horizontal" | "vertical";
34
+ "data-count"?: number;
41
35
  "data-index"?: number;
42
- "data-complete"?: Booleanish;
43
- "data-empty"?: Booleanish;
44
- "data-placeholder-shown"?: Booleanish;
45
36
  };
46
- declare type JSXElementAttributes = DataAttr & React.HTMLAttributes<HTMLElement>;
47
- declare type JSXButtonAttributes = DataAttr & React.ButtonHTMLAttributes<HTMLButtonElement>;
48
- declare type JSXInputAttributes = DataAttr & React.InputHTMLAttributes<HTMLInputElement>;
49
- declare type JSXLabelAttributes = DataAttr & React.LabelHTMLAttributes<HTMLLabelElement>;
50
- declare type JSXOutputAttributes = DataAttr & React.OutputHTMLAttributes<HTMLOutputElement>;
51
37
  export declare type PropTypes = Record<"button" | "label" | "input" | "output" | "element", Dict>;
52
- export declare type ReactPropTypes = {
53
- button: JSXButtonAttributes;
54
- label: JSXLabelAttributes;
55
- input: JSXInputAttributes;
56
- output: JSXOutputAttributes;
57
- element: JSXElementAttributes;
58
- };
59
- export declare type NormalizeProps = {
60
- button<T extends PropTypes>(props: WithStyle<JSXButtonAttributes>): T["button"];
61
- label<T extends PropTypes>(props: WithStyle<JSXLabelAttributes>): T["label"];
62
- input<T extends PropTypes>(props: WithStyle<JSXInputAttributes>): T["input"];
63
- output<T extends PropTypes>(props: WithStyle<JSXOutputAttributes>): T["output"];
64
- element<T extends PropTypes>(props: WithStyle<JSXElementAttributes>): T["element"];
38
+ export declare type NormalizeProps<T extends PropTypes> = {
39
+ [K in keyof T]: (props: K extends keyof JSX.IntrinsicElements ? DataAttr & JSX.IntrinsicElements[K] : never) => T[K];
40
+ } & {
41
+ element(props: DataAttr & JSX.HTMLAttributes<HTMLElement>): T["element"];
65
42
  };
66
- export declare function createNormalizer(fn: (props: Dict) => Dict): NormalizeProps;
67
- export declare const normalizeProp: NormalizeProps;
43
+ export declare function createNormalizer<T extends PropTypes>(fn: (props: Dict) => Dict): NormalizeProps<T>;
68
44
  export {};
69
- //# sourceMappingURL=prop-types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/types",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "keywords": [
5
5
  "js",
6
6
  "utils",
@@ -23,6 +23,9 @@
23
23
  "bugs": {
24
24
  "url": "https://github.com/chakra-ui/zag/issues"
25
25
  },
26
+ "dependencies": {
27
+ "csstype": "3.1.0"
28
+ },
26
29
  "scripts": {
27
30
  "build:fast": "zag build",
28
31
  "start": "zag build --watch",
@@ -32,4 +35,4 @@
32
35
  "test:ci": "yarn test --ci --runInBand",
33
36
  "test:watch": "yarn test --watch --updateSnapshot"
34
37
  }
35
- }
38
+ }
@@ -1,42 +0,0 @@
1
- export declare type ControlProp = {
2
- type: "boolean";
3
- label?: string;
4
- defaultValue: boolean;
5
- } | {
6
- type: "string";
7
- label?: string;
8
- defaultValue: string;
9
- placeholder?: string;
10
- } | {
11
- type: "select";
12
- options: readonly string[];
13
- defaultValue: string;
14
- label?: string;
15
- } | {
16
- type: "multiselect";
17
- options: readonly string[];
18
- defaultValue: string[];
19
- label?: string;
20
- } | {
21
- type: "number";
22
- label?: string;
23
- defaultValue: number;
24
- min?: number;
25
- max?: number;
26
- };
27
- export declare type ControlRecord = Record<string, ControlProp>;
28
- export declare type ControlValue<T extends ControlRecord> = {
29
- [K in keyof T]: T[K] extends {
30
- type: "boolean";
31
- } ? boolean : T[K] extends {
32
- type: "string";
33
- } ? string : T[K] extends {
34
- type: "select";
35
- } ? T[K]["options"][number] : T[K] extends {
36
- type: "multiselect";
37
- } ? T[K]["options"][number][] : T[K] extends {
38
- type: "number";
39
- } ? number : never;
40
- };
41
- export declare function defineControls<T extends ControlRecord>(config: T): T;
42
- //# sourceMappingURL=controls.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"controls.d.ts","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW,GACnB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,OAAO,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9E;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GACpF;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3F;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAExF,oBAAY,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;AAEvD,oBAAY,YAAY,CAAC,CAAC,SAAS,aAAa,IAAI;KACjD,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,GAC5C,OAAO,GACP,CAAC,CAAC,CAAC,CAAC,SAAS;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAC/B,MAA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GAAG;IACxC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAC5C,CAAA;AAED,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA"}
package/dist/index.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts", "../src/prop-types.ts", "../src/controls.ts"],
4
- "sourcesContent": ["import type * as React from \"react\"\n\nexport type Direction = \"ltr\" | \"rtl\"\n\nexport type Orientation = \"horizontal\" | \"vertical\"\n\nexport type MaybeElement<T extends HTMLElement = HTMLElement> = T | null\n\nexport type DirectionProperty = {\n /**\n * The document's text/writing direction.\n */\n dir?: Direction\n}\n\nexport type RootProperties = {\n /**\n * @internal\n * The owner document of the machine.\n */\n doc?: Document\n /**\n * @internal\n * The root node of the machine. Useful for shadow DOM.\n */\n rootNode?: ShadowRoot\n}\n\nexport type Context<T> = T &\n RootProperties & {\n /**\n * @internal\n * The unique identifier of the machine.\n */\n uid: string\n /**\n * @internal\n * The related target when the element is blurred.\n * Used as a polyfill for `e.relatedTarget`\n */\n pointerdownNode?: HTMLElement | null\n }\n\nexport type Style = React.CSSProperties & {\n [prop: string]: string | number | undefined\n}\n\nexport * from \"./prop-types\"\nexport * from \"./controls\"\n", "import type * as React from \"react\"\n\ntype Dict<T = any> = Record<string, T>\n\ntype Booleanish = boolean | \"true\" | \"false\"\n\ntype Omit<T, K extends keyof T> = { [P in Exclude<keyof T, K>]?: T[P] }\n\ntype WithStyle<T extends { style?: any }> = Omit<T, \"style\"> & {\n style?: T[\"style\"] & {\n [prop: string]: string | number | undefined\n }\n}\n\ntype DataAttr = {\n \"data-uid\"?: string\n \"data-name\"?: string\n \"data-ownedby\"?: string\n \"data-selected\"?: Booleanish\n \"data-expanded\"?: Booleanish\n \"data-highlighted\"?: Booleanish\n \"data-readonly\"?: Booleanish\n \"data-invalid\"?: Booleanish\n \"data-hover\"?: Booleanish\n \"data-active\"?: Booleanish\n \"data-focus\"?: Booleanish\n \"data-disabled\"?: Booleanish\n \"data-type\"?: string\n \"data-value\"?: string | number\n \"data-valuetext\"?: string\n \"data-open\"?: Booleanish\n \"data-placement\"?: string\n \"data-orientation\"?: \"horizontal\" | \"vertical\"\n \"data-label\"?: string\n \"data-checked\"?: Booleanish\n \"data-pressed\"?: Booleanish\n \"data-state\"?: string | null\n \"data-half\"?: Booleanish\n \"data-count\"?: number\n \"data-controls\"?: string\n \"data-part\"?: string\n \"data-index\"?: number\n \"data-complete\"?: Booleanish\n \"data-empty\"?: Booleanish\n \"data-placeholder-shown\"?: Booleanish\n}\n\ntype JSXElementAttributes = DataAttr & React.HTMLAttributes<HTMLElement>\ntype JSXButtonAttributes = DataAttr & React.ButtonHTMLAttributes<HTMLButtonElement>\ntype JSXInputAttributes = DataAttr & React.InputHTMLAttributes<HTMLInputElement>\ntype JSXLabelAttributes = DataAttr & React.LabelHTMLAttributes<HTMLLabelElement>\ntype JSXOutputAttributes = DataAttr & React.OutputHTMLAttributes<HTMLOutputElement>\n\nexport type PropTypes = Record<\"button\" | \"label\" | \"input\" | \"output\" | \"element\", Dict>\n\nexport type ReactPropTypes = {\n button: JSXButtonAttributes\n label: JSXLabelAttributes\n input: JSXInputAttributes\n output: JSXOutputAttributes\n element: JSXElementAttributes\n}\n\nexport type NormalizeProps = {\n button<T extends PropTypes>(props: WithStyle<JSXButtonAttributes>): T[\"button\"]\n label<T extends PropTypes>(props: WithStyle<JSXLabelAttributes>): T[\"label\"]\n input<T extends PropTypes>(props: WithStyle<JSXInputAttributes>): T[\"input\"]\n output<T extends PropTypes>(props: WithStyle<JSXOutputAttributes>): T[\"output\"]\n element<T extends PropTypes>(props: WithStyle<JSXElementAttributes>): T[\"element\"]\n}\n\nexport function createNormalizer(fn: (props: Dict) => Dict): NormalizeProps {\n return { button: fn, label: fn, input: fn, output: fn, element: fn }\n}\n\nexport const normalizeProp = createNormalizer((v) => v)\n", "export type ControlProp =\n | { type: \"boolean\"; label?: string; defaultValue: boolean }\n | { type: \"string\"; label?: string; defaultValue: string; placeholder?: string }\n | { type: \"select\"; options: readonly string[]; defaultValue: string; label?: string }\n | { type: \"multiselect\"; options: readonly string[]; defaultValue: string[]; label?: string }\n | { type: \"number\"; label?: string; defaultValue: number; min?: number; max?: number }\n\nexport type ControlRecord = Record<string, ControlProp>\n\nexport type ControlValue<T extends ControlRecord> = {\n [K in keyof T]: T[K] extends { type: \"boolean\" }\n ? boolean\n : T[K] extends { type: \"string\" }\n ? string\n : T[K] extends { type: \"select\" }\n ? T[K][\"options\"][number]\n : T[K] extends { type: \"multiselect\" }\n ? T[K][\"options\"][number][]\n : T[K] extends { type: \"number\" }\n ? number\n : never\n}\n\nexport function defineControls<T extends ControlRecord>(config: T) {\n return config\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACuEO,0BAA0B,IAA2C;AAC1E,SAAO,EAAE,QAAQ,IAAI,OAAO,IAAI,OAAO,IAAI,QAAQ,IAAI,SAAS,GAAG;AACrE;AAEO,IAAM,gBAAgB,iBAAiB,CAAC,MAAM,CAAC;;;ACpD/C,wBAAiD,QAAW;AACjE,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/prop-types.ts", "../src/controls.ts"],
4
- "sourcesContent": ["import type * as React from \"react\"\n\ntype Dict<T = any> = Record<string, T>\n\ntype Booleanish = boolean | \"true\" | \"false\"\n\ntype Omit<T, K extends keyof T> = { [P in Exclude<keyof T, K>]?: T[P] }\n\ntype WithStyle<T extends { style?: any }> = Omit<T, \"style\"> & {\n style?: T[\"style\"] & {\n [prop: string]: string | number | undefined\n }\n}\n\ntype DataAttr = {\n \"data-uid\"?: string\n \"data-name\"?: string\n \"data-ownedby\"?: string\n \"data-selected\"?: Booleanish\n \"data-expanded\"?: Booleanish\n \"data-highlighted\"?: Booleanish\n \"data-readonly\"?: Booleanish\n \"data-invalid\"?: Booleanish\n \"data-hover\"?: Booleanish\n \"data-active\"?: Booleanish\n \"data-focus\"?: Booleanish\n \"data-disabled\"?: Booleanish\n \"data-type\"?: string\n \"data-value\"?: string | number\n \"data-valuetext\"?: string\n \"data-open\"?: Booleanish\n \"data-placement\"?: string\n \"data-orientation\"?: \"horizontal\" | \"vertical\"\n \"data-label\"?: string\n \"data-checked\"?: Booleanish\n \"data-pressed\"?: Booleanish\n \"data-state\"?: string | null\n \"data-half\"?: Booleanish\n \"data-count\"?: number\n \"data-controls\"?: string\n \"data-part\"?: string\n \"data-index\"?: number\n \"data-complete\"?: Booleanish\n \"data-empty\"?: Booleanish\n \"data-placeholder-shown\"?: Booleanish\n}\n\ntype JSXElementAttributes = DataAttr & React.HTMLAttributes<HTMLElement>\ntype JSXButtonAttributes = DataAttr & React.ButtonHTMLAttributes<HTMLButtonElement>\ntype JSXInputAttributes = DataAttr & React.InputHTMLAttributes<HTMLInputElement>\ntype JSXLabelAttributes = DataAttr & React.LabelHTMLAttributes<HTMLLabelElement>\ntype JSXOutputAttributes = DataAttr & React.OutputHTMLAttributes<HTMLOutputElement>\n\nexport type PropTypes = Record<\"button\" | \"label\" | \"input\" | \"output\" | \"element\", Dict>\n\nexport type ReactPropTypes = {\n button: JSXButtonAttributes\n label: JSXLabelAttributes\n input: JSXInputAttributes\n output: JSXOutputAttributes\n element: JSXElementAttributes\n}\n\nexport type NormalizeProps = {\n button<T extends PropTypes>(props: WithStyle<JSXButtonAttributes>): T[\"button\"]\n label<T extends PropTypes>(props: WithStyle<JSXLabelAttributes>): T[\"label\"]\n input<T extends PropTypes>(props: WithStyle<JSXInputAttributes>): T[\"input\"]\n output<T extends PropTypes>(props: WithStyle<JSXOutputAttributes>): T[\"output\"]\n element<T extends PropTypes>(props: WithStyle<JSXElementAttributes>): T[\"element\"]\n}\n\nexport function createNormalizer(fn: (props: Dict) => Dict): NormalizeProps {\n return { button: fn, label: fn, input: fn, output: fn, element: fn }\n}\n\nexport const normalizeProp = createNormalizer((v) => v)\n", "export type ControlProp =\n | { type: \"boolean\"; label?: string; defaultValue: boolean }\n | { type: \"string\"; label?: string; defaultValue: string; placeholder?: string }\n | { type: \"select\"; options: readonly string[]; defaultValue: string; label?: string }\n | { type: \"multiselect\"; options: readonly string[]; defaultValue: string[]; label?: string }\n | { type: \"number\"; label?: string; defaultValue: number; min?: number; max?: number }\n\nexport type ControlRecord = Record<string, ControlProp>\n\nexport type ControlValue<T extends ControlRecord> = {\n [K in keyof T]: T[K] extends { type: \"boolean\" }\n ? boolean\n : T[K] extends { type: \"string\" }\n ? string\n : T[K] extends { type: \"select\" }\n ? T[K][\"options\"][number]\n : T[K] extends { type: \"multiselect\" }\n ? T[K][\"options\"][number][]\n : T[K] extends { type: \"number\" }\n ? number\n : never\n}\n\nexport function defineControls<T extends ControlRecord>(config: T) {\n return config\n}\n"],
5
- "mappings": ";AAuEO,0BAA0B,IAA2C;AAC1E,SAAO,EAAE,QAAQ,IAAI,OAAO,IAAI,OAAO,IAAI,QAAQ,IAAI,SAAS,GAAG;AACrE;AAEO,IAAM,gBAAgB,iBAAiB,CAAC,MAAM,CAAC;;;ACpD/C,wBAAiD,QAAW;AACjE,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"prop-types.d.ts","sourceRoot":"","sources":["../src/prop-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,aAAK,IAAI,CAAC,CAAC,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;AAEtC,aAAK,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;AAE5C,aAAK,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI;KAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAA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