@public-ui/react 1.1.7-rc.10

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 (101) hide show
  1. package/LICENSE +287 -0
  2. package/README.md +7 -0
  3. package/cjs/index.d.ts +46 -0
  4. package/cjs/index.js +49 -0
  5. package/cjs/index.js.map +1 -0
  6. package/cjs/react-component-lib/createComponent.d.ts +10 -0
  7. package/cjs/react-component-lib/createComponent.js +92 -0
  8. package/cjs/react-component-lib/createComponent.js.map +1 -0
  9. package/cjs/react-component-lib/createOverlayComponent.d.ts +21 -0
  10. package/cjs/react-component-lib/createOverlayComponent.js +105 -0
  11. package/cjs/react-component-lib/createOverlayComponent.js.map +1 -0
  12. package/cjs/react-component-lib/index.d.ts +2 -0
  13. package/cjs/react-component-lib/index.js +8 -0
  14. package/cjs/react-component-lib/index.js.map +1 -0
  15. package/cjs/react-component-lib/interfaces.d.ts +29 -0
  16. package/cjs/react-component-lib/interfaces.js +3 -0
  17. package/cjs/react-component-lib/interfaces.js.map +1 -0
  18. package/cjs/react-component-lib/utils/attachProps.d.ts +8 -0
  19. package/cjs/react-component-lib/utils/attachProps.js +92 -0
  20. package/cjs/react-component-lib/utils/attachProps.js.map +1 -0
  21. package/cjs/react-component-lib/utils/case.d.ts +2 -0
  22. package/cjs/react-component-lib/utils/case.js +12 -0
  23. package/cjs/react-component-lib/utils/case.js.map +1 -0
  24. package/cjs/react-component-lib/utils/dev.d.ts +2 -0
  25. package/cjs/react-component-lib/utils/dev.js +18 -0
  26. package/cjs/react-component-lib/utils/dev.js.map +1 -0
  27. package/cjs/react-component-lib/utils/index.d.ts +10 -0
  28. package/cjs/react-component-lib/utils/index.js +57 -0
  29. package/cjs/react-component-lib/utils/index.js.map +1 -0
  30. package/esm/index.d.ts +46 -0
  31. package/esm/index.js +46 -0
  32. package/esm/index.js.map +1 -0
  33. package/esm/react-component-lib/createComponent.d.ts +10 -0
  34. package/esm/react-component-lib/createComponent.js +65 -0
  35. package/esm/react-component-lib/createComponent.js.map +1 -0
  36. package/esm/react-component-lib/createOverlayComponent.d.ts +21 -0
  37. package/esm/react-component-lib/createOverlayComponent.js +98 -0
  38. package/esm/react-component-lib/createOverlayComponent.js.map +1 -0
  39. package/esm/react-component-lib/index.d.ts +2 -0
  40. package/esm/react-component-lib/index.js +3 -0
  41. package/esm/react-component-lib/index.js.map +1 -0
  42. package/esm/react-component-lib/interfaces.d.ts +29 -0
  43. package/esm/react-component-lib/interfaces.js +2 -0
  44. package/esm/react-component-lib/interfaces.js.map +1 -0
  45. package/esm/react-component-lib/utils/attachProps.d.ts +8 -0
  46. package/esm/react-component-lib/utils/attachProps.js +85 -0
  47. package/esm/react-component-lib/utils/attachProps.js.map +1 -0
  48. package/esm/react-component-lib/utils/case.d.ts +2 -0
  49. package/esm/react-component-lib/utils/case.js +7 -0
  50. package/esm/react-component-lib/utils/case.js.map +1 -0
  51. package/esm/react-component-lib/utils/dev.d.ts +2 -0
  52. package/esm/react-component-lib/utils/dev.js +13 -0
  53. package/esm/react-component-lib/utils/dev.js.map +1 -0
  54. package/esm/react-component-lib/utils/index.d.ts +10 -0
  55. package/esm/react-component-lib/utils/index.js +33 -0
  56. package/esm/react-component-lib/utils/index.js.map +1 -0
  57. package/package.json +73 -0
  58. package/types/index.d.ts +46 -0
  59. package/types/react-component-lib/createComponent.d.ts +10 -0
  60. package/types/react-component-lib/createOverlayComponent.d.ts +21 -0
  61. package/types/react-component-lib/index.d.ts +2 -0
  62. package/types/react-component-lib/interfaces.d.ts +29 -0
  63. package/types/react-component-lib/utils/attachProps.d.ts +8 -0
  64. package/types/react-component-lib/utils/attachProps.js +85 -0
  65. package/types/react-component-lib/utils/attachProps.js.map +1 -0
  66. package/types/react-component-lib/utils/case.d.ts +2 -0
  67. package/types/react-component-lib/utils/case.js +7 -0
  68. package/types/react-component-lib/utils/case.js.map +1 -0
  69. package/types/react-component-lib/utils/dev.d.ts +2 -0
  70. package/types/react-component-lib/utils/dev.js +13 -0
  71. package/types/react-component-lib/utils/dev.js.map +1 -0
  72. package/types/react-component-lib/utils/index.d.ts +10 -0
  73. package/types/react-component-lib/utils/index.js +33 -0
  74. package/types/react-component-lib/utils/index.js.map +1 -0
  75. package/umd/index.d.ts +46 -0
  76. package/umd/index.js +59 -0
  77. package/umd/index.js.map +1 -0
  78. package/umd/react-component-lib/createComponent.d.ts +10 -0
  79. package/umd/react-component-lib/createComponent.js +102 -0
  80. package/umd/react-component-lib/createComponent.js.map +1 -0
  81. package/umd/react-component-lib/createOverlayComponent.d.ts +21 -0
  82. package/umd/react-component-lib/createOverlayComponent.js +115 -0
  83. package/umd/react-component-lib/createOverlayComponent.js.map +1 -0
  84. package/umd/react-component-lib/index.d.ts +2 -0
  85. package/umd/react-component-lib/index.js +18 -0
  86. package/umd/react-component-lib/index.js.map +1 -0
  87. package/umd/react-component-lib/interfaces.d.ts +29 -0
  88. package/umd/react-component-lib/interfaces.js +13 -0
  89. package/umd/react-component-lib/interfaces.js.map +1 -0
  90. package/umd/react-component-lib/utils/attachProps.d.ts +8 -0
  91. package/umd/react-component-lib/utils/attachProps.js +102 -0
  92. package/umd/react-component-lib/utils/attachProps.js.map +1 -0
  93. package/umd/react-component-lib/utils/case.d.ts +2 -0
  94. package/umd/react-component-lib/utils/case.js +22 -0
  95. package/umd/react-component-lib/utils/case.js.map +1 -0
  96. package/umd/react-component-lib/utils/dev.d.ts +2 -0
  97. package/umd/react-component-lib/utils/dev.js +28 -0
  98. package/umd/react-component-lib/utils/dev.js.map +1 -0
  99. package/umd/react-component-lib/utils/index.d.ts +10 -0
  100. package/umd/react-component-lib/utils/index.js +67 -0
  101. package/umd/react-component-lib/utils/index.js.map +1 -0
@@ -0,0 +1,29 @@
1
+ export interface EventEmitter<T = any> {
2
+ emit: (data?: T) => CustomEvent<T>;
3
+ }
4
+ export interface StyleReactProps {
5
+ class?: string;
6
+ className?: string;
7
+ style?: {
8
+ [key: string]: any;
9
+ };
10
+ }
11
+ export interface OverlayEventDetail<T = any> {
12
+ data?: T;
13
+ role?: string;
14
+ }
15
+ export interface OverlayInterface {
16
+ el: HTMLElement;
17
+ animated: boolean;
18
+ keyboardClose: boolean;
19
+ overlayIndex: number;
20
+ presented: boolean;
21
+ enterAnimation?: any;
22
+ leaveAnimation?: any;
23
+ didPresent: EventEmitter<void>;
24
+ willPresent: EventEmitter<void>;
25
+ willDismiss: EventEmitter<OverlayEventDetail>;
26
+ didDismiss: EventEmitter<OverlayEventDetail>;
27
+ present(): Promise<void>;
28
+ dismiss(data?: any, role?: string): Promise<boolean>;
29
+ }
@@ -0,0 +1,13 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ });
13
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/react-component-lib/interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export declare const attachProps: (node: HTMLElement, newProps: any, oldProps?: any) => void;
2
+ export declare const getClassName: (classList: DOMTokenList, newProps: any, oldProps: any) => string;
3
+ export declare const isCoveredByReact: (eventNameSuffix: string) => boolean;
4
+ export declare const syncEvent: (node: Element & {
5
+ __events?: {
6
+ [key: string]: ((e: Event) => any) | undefined;
7
+ } | undefined;
8
+ }, eventName: string, newEventHandler?: ((e: Event) => any) | undefined) => void;
@@ -0,0 +1,102 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports", "./case"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.syncEvent = exports.isCoveredByReact = exports.getClassName = exports.attachProps = void 0;
13
+ const case_1 = require("./case");
14
+ const attachProps = (node, newProps, oldProps = {}) => {
15
+ if (node instanceof Element) {
16
+ const className = (0, exports.getClassName)(node.classList, newProps, oldProps);
17
+ if (className !== '') {
18
+ node.className = className;
19
+ }
20
+ Object.keys(newProps).forEach((name) => {
21
+ if (name === 'children' ||
22
+ name === 'style' ||
23
+ name === 'ref' ||
24
+ name === 'class' ||
25
+ name === 'className' ||
26
+ name === 'forwardedRef') {
27
+ return;
28
+ }
29
+ if (name.indexOf('on') === 0 && name[2] === name[2].toUpperCase()) {
30
+ const eventName = name.substring(2);
31
+ const eventNameLc = eventName[0].toLowerCase() + eventName.substring(1);
32
+ if (!(0, exports.isCoveredByReact)(eventNameLc)) {
33
+ (0, exports.syncEvent)(node, eventNameLc, newProps[name]);
34
+ }
35
+ }
36
+ else {
37
+ node[name] = newProps[name];
38
+ const propType = typeof newProps[name];
39
+ if (propType === 'string') {
40
+ node.setAttribute((0, case_1.camelToDashCase)(name), newProps[name]);
41
+ }
42
+ }
43
+ });
44
+ }
45
+ };
46
+ exports.attachProps = attachProps;
47
+ const getClassName = (classList, newProps, oldProps) => {
48
+ const newClassProp = newProps.className || newProps.class;
49
+ const oldClassProp = oldProps.className || oldProps.class;
50
+ const currentClasses = arrayToMap(classList);
51
+ const incomingPropClasses = arrayToMap(newClassProp ? newClassProp.split(' ') : []);
52
+ const oldPropClasses = arrayToMap(oldClassProp ? oldClassProp.split(' ') : []);
53
+ const finalClassNames = [];
54
+ currentClasses.forEach((currentClass) => {
55
+ if (incomingPropClasses.has(currentClass)) {
56
+ finalClassNames.push(currentClass);
57
+ incomingPropClasses.delete(currentClass);
58
+ }
59
+ else if (!oldPropClasses.has(currentClass)) {
60
+ finalClassNames.push(currentClass);
61
+ }
62
+ });
63
+ incomingPropClasses.forEach((s) => finalClassNames.push(s));
64
+ return finalClassNames.join(' ');
65
+ };
66
+ exports.getClassName = getClassName;
67
+ const isCoveredByReact = (eventNameSuffix) => {
68
+ if (typeof document === 'undefined') {
69
+ return true;
70
+ }
71
+ else {
72
+ const eventName = 'on' + eventNameSuffix;
73
+ let isSupported = eventName in document;
74
+ if (!isSupported) {
75
+ const element = document.createElement('div');
76
+ element.setAttribute(eventName, 'return;');
77
+ isSupported = typeof element[eventName] === 'function';
78
+ }
79
+ return isSupported;
80
+ }
81
+ };
82
+ exports.isCoveredByReact = isCoveredByReact;
83
+ const syncEvent = (node, eventName, newEventHandler) => {
84
+ const eventStore = node.__events || (node.__events = {});
85
+ const oldEventHandler = eventStore[eventName];
86
+ if (oldEventHandler) {
87
+ node.removeEventListener(eventName, oldEventHandler);
88
+ }
89
+ node.addEventListener(eventName, (eventStore[eventName] = function handler(e) {
90
+ if (newEventHandler) {
91
+ newEventHandler.call(this, e);
92
+ }
93
+ }));
94
+ };
95
+ exports.syncEvent = syncEvent;
96
+ const arrayToMap = (arr) => {
97
+ const map = new Map();
98
+ arr.forEach((s) => map.set(s, s));
99
+ return map;
100
+ };
101
+ });
102
+ //# sourceMappingURL=attachProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachProps.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/attachProps.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,iCAAyC;IAElC,MAAM,WAAW,GAAG,CAAC,IAAiB,EAAE,QAAa,EAAE,WAAgB,EAAE,EAAE,EAAE;QAElF,IAAI,IAAI,YAAY,OAAO,EAAE;YAE3B,MAAM,SAAS,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACnE,IAAI,SAAS,KAAK,EAAE,EAAE;gBACpB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;aAC5B;YAED,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAA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,22 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.camelToDashCase = exports.dashToPascalCase = void 0;
13
+ const dashToPascalCase = (str) => str
14
+ .toLowerCase()
15
+ .split('-')
16
+ .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
17
+ .join('');
18
+ exports.dashToPascalCase = dashToPascalCase;
19
+ const camelToDashCase = (str) => str.replace(/([A-Z])/g, (m) => `-${m[0].toLowerCase()}`);
20
+ exports.camelToDashCase = camelToDashCase;
21
+ });
22
+ //# sourceMappingURL=case.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"case.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/case.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAO,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAE,EAAE,CAC9C,GAAG;SACA,WAAW,EAAE;SACb,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpE,IAAI,CAAC,EAAE,CAAC,CAAC;IALD,QAAA,gBAAgB,oBAKf;IACP,MAAM,eAAe,GAAG,CAAC,GAAW,EAAE,EAAE,CAC7C,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IADtD,QAAA,eAAe,mBACuC"}
@@ -0,0 +1,2 @@
1
+ export declare const isDevMode: () => boolean;
2
+ export declare const deprecationWarning: (key: string, message: string) => void;
@@ -0,0 +1,28 @@
1
+ (function (factory) {
2
+ if (typeof module === "object" && typeof module.exports === "object") {
3
+ var v = factory(require, exports);
4
+ if (v !== undefined) module.exports = v;
5
+ }
6
+ else if (typeof define === "function" && define.amd) {
7
+ define(["require", "exports"], factory);
8
+ }
9
+ })(function (require, exports) {
10
+ "use strict";
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.deprecationWarning = exports.isDevMode = void 0;
13
+ const isDevMode = () => {
14
+ return process && process.env && process.env.NODE_ENV === 'development';
15
+ };
16
+ exports.isDevMode = isDevMode;
17
+ const warnings = {};
18
+ const deprecationWarning = (key, message) => {
19
+ if ((0, exports.isDevMode)()) {
20
+ if (!warnings[key]) {
21
+ console.warn(message);
22
+ warnings[key] = true;
23
+ }
24
+ }
25
+ };
26
+ exports.deprecationWarning = deprecationWarning;
27
+ });
28
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/dev.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAO,MAAM,SAAS,GAAG,GAAG,EAAE;QAC5B,OAAO,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC;IAC1E,CAAC,CAAC;IAFW,QAAA,SAAS,aAEpB;IAEF,MAAM,QAAQ,GAA+B,EAAE,CAAC;IAEzC,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,OAAe,EAAE,EAAE;QACjE,IAAI,IAAA,iBAAS,GAAE,EAAE;YACf,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;gBAClB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;aACtB;SACF;IACH,CAAC,CAAC;IAPW,QAAA,kBAAkB,sBAO7B"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import type { StyleReactProps } from '../interfaces';
3
+ export declare type StencilReactExternalProps<PropType, ElementType> = PropType & Omit<React.HTMLAttributes<ElementType>, 'style'> & StyleReactProps;
4
+ export declare type StencilReactForwardedRef<T> = ((instance: T | null) => void) | React.MutableRefObject<T | null> | null;
5
+ export declare const setRef: (ref: StencilReactForwardedRef<any> | React.Ref<any> | undefined, value: any) => void;
6
+ export declare const mergeRefs: (...refs: (StencilReactForwardedRef<any> | React.Ref<any> | undefined)[]) => React.RefCallback<any>;
7
+ export declare const createForwardRef: <PropType, ElementType>(ReactComponent: any, displayName: string) => React.ForwardRefExoticComponent<React.PropsWithoutRef<StencilReactExternalProps<PropType, ElementType>> & React.RefAttributes<ElementType>>;
8
+ export declare const defineCustomElement: (tagName: string, customElement: any) => void;
9
+ export * from './attachProps';
10
+ export * from './case';
@@ -0,0 +1,67 @@
1
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2
+ if (k2 === undefined) k2 = k;
3
+ var desc = Object.getOwnPropertyDescriptor(m, k);
4
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5
+ desc = { enumerable: true, get: function() { return m[k]; } };
6
+ }
7
+ Object.defineProperty(o, k2, desc);
8
+ }) : (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ o[k2] = m[k];
11
+ }));
12
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
13
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
14
+ };
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ (function (factory) {
19
+ if (typeof module === "object" && typeof module.exports === "object") {
20
+ var v = factory(require, exports);
21
+ if (v !== undefined) module.exports = v;
22
+ }
23
+ else if (typeof define === "function" && define.amd) {
24
+ define(["require", "exports", "react", "./attachProps", "./case"], factory);
25
+ }
26
+ })(function (require, exports) {
27
+ "use strict";
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.defineCustomElement = exports.createForwardRef = exports.mergeRefs = exports.setRef = void 0;
30
+ const react_1 = __importDefault(require("react"));
31
+ const setRef = (ref, value) => {
32
+ if (typeof ref === 'function') {
33
+ ref(value);
34
+ }
35
+ else if (ref != null) {
36
+ ref.current = value;
37
+ }
38
+ };
39
+ exports.setRef = setRef;
40
+ const mergeRefs = (...refs) => {
41
+ return (value) => {
42
+ refs.forEach(ref => {
43
+ (0, exports.setRef)(ref, value);
44
+ });
45
+ };
46
+ };
47
+ exports.mergeRefs = mergeRefs;
48
+ const createForwardRef = (ReactComponent, displayName) => {
49
+ const forwardRef = (props, ref) => {
50
+ return react_1.default.createElement(ReactComponent, Object.assign({}, props, { forwardedRef: ref }));
51
+ };
52
+ forwardRef.displayName = displayName;
53
+ return react_1.default.forwardRef(forwardRef);
54
+ };
55
+ exports.createForwardRef = createForwardRef;
56
+ const defineCustomElement = (tagName, customElement) => {
57
+ if (customElement !== undefined &&
58
+ typeof customElements !== 'undefined' &&
59
+ !customElements.get(tagName)) {
60
+ customElements.define(tagName, customElement);
61
+ }
62
+ };
63
+ exports.defineCustomElement = defineCustomElement;
64
+ __exportStar(require("./attachProps"), exports);
65
+ __exportStar(require("./case"), exports);
66
+ });
67
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/react-component-lib/utils/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAA,kDAA0B;IAWnB,MAAM,MAAM,GAAG,CAAC,GAA+D,EAAE,KAAU,EAAE,EAAE;QACpG,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;YAC7B,GAAG,CAAC,KAAK,CAAC,CAAA;SACX;aAAM,IAAI,GAAG,IAAI,IAAI,EAAE;YAErB,GAAmC,CAAC,OAAO,GAAG,KAAK,CAAA;SACrD;IACH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