@wireapp/react-ui-kit 8.17.8 → 8.17.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.
- package/package.json +3 -2
- package/src/Form/Button.js +8 -8
- package/src/Form/Button.js.map +1 -1
- package/src/Form/SelectStyles.d.js.map +1 -1
- package/src/Form/SelectStyles.d.ts +796 -768
- package/src/GlobalCssVariables.js +4 -1
- package/src/GlobalCssVariables.js.map +1 -1
- package/src/Layout/Theme.d.js.map +1 -1
- package/src/Layout/Theme.d.ts +3 -0
- package/src/Layout/Theme.js +9 -0
- package/src/Layout/Theme.js.map +1 -1
package/package.json
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@testing-library/jest-dom": "5.16.5",
|
|
22
22
|
"@testing-library/react": "13.4.0",
|
|
23
23
|
"@types/jest": "^29.2.0",
|
|
24
|
+
"@types/node": "^18.11.5",
|
|
24
25
|
"@types/react": "18.0.21",
|
|
25
26
|
"@types/webpack-env": "1.18.0",
|
|
26
27
|
"babel-jest": "29.2.1",
|
|
@@ -68,6 +69,6 @@
|
|
|
68
69
|
"test:watch": "jest --watch",
|
|
69
70
|
"test:update": "jest --updateSnapshot"
|
|
70
71
|
},
|
|
71
|
-
"version": "8.17.
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"version": "8.17.10",
|
|
73
|
+
"gitHead": "af33af823fb4ec62c3fc0ba2c6d4ec9456d7ae3c"
|
|
73
74
|
}
|
package/src/Form/Button.js
CHANGED
|
@@ -101,20 +101,20 @@ var buttonStyle = function buttonStyle(theme, _ref) {
|
|
|
101
101
|
color: _Identity.COLOR.WHITE
|
|
102
102
|
}
|
|
103
103
|
})), variant === ButtonVariant.SECONDARY && _objectSpread({
|
|
104
|
-
backgroundColor: backgroundColor || (disabled ?
|
|
105
|
-
border: "1px solid ".concat(
|
|
106
|
-
color: disabled ?
|
|
104
|
+
backgroundColor: backgroundColor || (disabled ? theme.IconButton.primaryDisabledBgColor : theme.IconButton.primaryBgColor),
|
|
105
|
+
border: "1px solid ".concat(theme.IconButton.primaryBorderColor),
|
|
106
|
+
color: disabled ? theme.Input.placeholderColor : theme.general.color
|
|
107
107
|
}, !disabled && {
|
|
108
108
|
'&:hover, &:focus': {
|
|
109
|
-
border: "1px solid ".concat(
|
|
109
|
+
border: "1px solid ".concat(theme.Button.secondaryHoverBorder)
|
|
110
110
|
},
|
|
111
111
|
'&:focus': {
|
|
112
|
-
color:
|
|
112
|
+
color: theme.IconButton.primaryActiveFillColor
|
|
113
113
|
},
|
|
114
114
|
'&:active': {
|
|
115
|
-
backgroundColor:
|
|
116
|
-
border: "1px solid ".concat(
|
|
117
|
-
color:
|
|
115
|
+
backgroundColor: theme.Button.secondaryActiveBg,
|
|
116
|
+
border: "1px solid ".concat(theme.Button.secondaryActiveBorder),
|
|
117
|
+
color: theme.general.primaryColor
|
|
118
118
|
}
|
|
119
119
|
})), variant === ButtonVariant.TERTIARY && _objectSpread({
|
|
120
120
|
backgroundColor: backgroundColor || (disabled ? theme.Button.tertiarydisabledBg : theme.Button.tertiaryBg),
|
package/src/Form/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["ButtonVariant","buttonStyle","theme","variant","PRIMARY","backgroundColor","block","disabled","noCapital","bold","center","color","COLOR","WHITE","fontSize","noWrap","textTransform","truncate","props","textStyle","border","cursor","display","alignItems","justifyContent","marginBottom","padding","outline","textDecoration","touchAction","transition","defaultTransition","width","TERTIARY","borderRadius","SEND","height","lineHeight","maxWidth","minWidth","Button","primaryDisabledBg","primaryBg","primaryDisabledText","general","contrastColor","primaryHoverBg","primaryFocusBorder","primaryActiveBg","primaryActiveBorder","SECONDARY","COLOR_V2","GRAY_20","GRAY_40","GRAY_60","BLACK","BLUE","BLUE_LIGHT_50","tertiarydisabledBg","tertiaryBg","tertiaryDisabledBorder","tertiaryBorder","Input","placeholderColor","fontWeight","fill","tertiaryHoverBg","tertiaryHoverBorder","focusColor","tertiaryActiveBg","IconButton","primaryActiveFillColor","QUATERNARY","GRAY_50","GREEN","GRAY_80","GREEN_LIGHT_600","GREEN_LIGHT_700","GRAY_70","BLUE_LIGHT_600","BLUE_LIGHT_800","BLUE_LIGHT_700","showLoading","children","loadingColor","filterButtonProps","margin","filterProps","filterTextProps"],"sources":["Button.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\n\nimport {COLOR, COLOR_V2} from '../Identity';\nimport {defaultTransition} from '../Identity/motions';\nimport {Theme} from '../Layout';\nimport {Loading} from '../Misc';\nimport {TextProps, filterTextProps, textStyle} from '../Text';\nimport {filterProps} from '../util';\n\nexport enum ButtonVariant {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n TERTIARY = 'tertiary',\n QUATERNARY = 'quaternary',\n SEND = 'send',\n}\n\nexport interface ButtonProps<T = HTMLButtonElement> extends TextProps<T> {\n variant?: ButtonVariant;\n backgroundColor?: string;\n loadingColor?: string;\n noCapital?: boolean;\n showLoading?: boolean;\n}\n\nexport const buttonStyle: <T>(theme: Theme, props: ButtonProps<T>) => CSSObject = (\n theme,\n {\n variant = ButtonVariant.PRIMARY,\n backgroundColor,\n block = false,\n disabled = false,\n noCapital = false,\n bold = true,\n center = true,\n color = COLOR.WHITE,\n fontSize = '16px',\n noWrap = true,\n textTransform = 'none',\n truncate = true,\n ...props\n },\n) => ({\n ...textStyle(theme, {\n block,\n bold,\n center,\n disabled,\n fontSize,\n noWrap,\n textTransform,\n truncate,\n ...props,\n }),\n border: 0,\n cursor: disabled ? 'default' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n marginBottom: '16px',\n padding: 0,\n outline: 'none',\n textDecoration: 'none',\n touchAction: 'manipulation',\n transition: defaultTransition,\n width: block ? '100%' : 'auto',\n '&:hover, &:focus': {\n textDecoration: 'none',\n },\n ...(variant !== ButtonVariant.TERTIARY && {\n borderRadius: variant === ButtonVariant.SEND ? '100%' : '16px',\n height: variant === ButtonVariant.SEND ? '40px' : '48px',\n lineHeight: variant === ButtonVariant.SEND ? '40px' : '48px',\n ...(variant !== ButtonVariant.SEND && {\n maxWidth: '100%',\n minWidth: '125px',\n padding: '0 16px',\n }),\n }),\n ...(variant === ButtonVariant.PRIMARY && {\n backgroundColor: backgroundColor || (disabled ? theme.Button.primaryDisabledBg : theme.Button.primaryBg),\n color: disabled ? theme.Button.primaryDisabledText : theme.general.contrastColor,\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: theme.Button.primaryHoverBg,\n },\n '&:focus': {\n border: `1px solid ${theme.Button.primaryFocusBorder}`,\n },\n '&:active': {\n backgroundColor: theme.Button.primaryActiveBg,\n border: `1px solid ${theme.Button.primaryActiveBorder}`,\n color: COLOR.WHITE,\n },\n }),\n }),\n ...(variant === ButtonVariant.SECONDARY && {\n backgroundColor: backgroundColor || (disabled ? COLOR_V2.GRAY_20 : COLOR_V2.WHITE),\n border: `1px solid ${COLOR_V2.GRAY_40}`,\n color: disabled ? COLOR_V2.GRAY_60 : COLOR_V2.BLACK,\n ...(!disabled && {\n '&:hover, &:focus': {\n border: `1px solid ${COLOR_V2.BLUE}`,\n },\n '&:focus': {\n color: COLOR_V2.BLUE,\n },\n '&:active': {\n backgroundColor: COLOR_V2.BLUE_LIGHT_50,\n border: `1px solid ${COLOR_V2.BLUE}`,\n color: COLOR_V2.BLUE,\n },\n }),\n }),\n ...(variant === ButtonVariant.TERTIARY && {\n backgroundColor: backgroundColor || (disabled ? theme.Button.tertiarydisabledBg : theme.Button.tertiaryBg),\n border: disabled ? `1px solid ${theme.Button.tertiaryDisabledBorder}` : `1px solid ${theme.Button.tertiaryBorder}`,\n borderRadius: '12px',\n color: disabled ? theme.Input.placeholderColor : theme.general.color,\n fontSize: '14px',\n fontWeight: 700,\n lineHeight: '24px',\n padding: '4px 8px',\n '& > svg > path': {\n fill: disabled ? theme.Input.placeholderColor : theme.general.color,\n },\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: theme.Button.tertiaryHoverBg,\n border: `1px solid ${theme.Button.tertiaryHoverBorder}`,\n },\n '&:focus': {\n border: `1px solid ${theme.general.focusColor}`,\n },\n '&:active': {\n backgroundColor: theme.Button.tertiaryActiveBg,\n color: theme.IconButton.primaryActiveFillColor,\n '& > svg > path': {\n fill: theme.IconButton.primaryActiveFillColor,\n },\n },\n }),\n }),\n ...(variant === ButtonVariant.QUATERNARY && {\n backgroundColor: backgroundColor || (disabled ? COLOR_V2.GRAY_50 : COLOR_V2.GREEN),\n color: disabled ? COLOR_V2.GRAY_80 : COLOR_V2.WHITE,\n lineHeight: '24px',\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: COLOR_V2.GREEN_LIGHT_600,\n },\n '&:focus': {\n border: `1px solid ${COLOR_V2.GREEN_LIGHT_700}`,\n },\n '&:active': {\n backgroundColor: COLOR_V2.GREEN_LIGHT_700,\n },\n }),\n }),\n ...(variant === ButtonVariant.SEND && {\n backgroundColor: backgroundColor || (disabled ? COLOR_V2.GRAY_70 : COLOR_V2.BLUE),\n width: '40px',\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: COLOR_V2.BLUE_LIGHT_600,\n },\n '&:focus': {\n border: `1px solid ${COLOR_V2.BLUE_LIGHT_800}`,\n },\n '&:active': {\n backgroundColor: COLOR_V2.BLUE_LIGHT_700,\n },\n }),\n }),\n});\n\nexport const Button = ({showLoading, children, loadingColor = COLOR.WHITE, ...props}: ButtonProps) => (\n <button css={(theme: Theme) => buttonStyle(theme, props)} {...filterButtonProps(props)}>\n {showLoading ? <Loading size={30} color={loadingColor} style={{display: 'flex', margin: 'auto'}} /> : children}\n </button>\n);\n\nexport const filterButtonProps = (props: ButtonProps) => {\n return filterProps(filterTextProps(props) as ButtonProps, ['backgroundColor', 'noCapital']);\n};\n"],"mappings":";;;;;;AAoBA;AAEA;AACA;AAEA;AACA;AACA;AAAoC;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAExBA,aAAa;AAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,6BAAbA,aAAa;AAgBlB,IAAMC,WAAkE,GAAG,SAArEA,WAAkE,CAC7EC,KAAK;EAAA,wBAEHC,OAAO;IAAPA,OAAO,6BAAGH,aAAa,CAACI,OAAO;IAC/BC,eAAe,QAAfA,eAAe;IAAA,kBACfC,KAAK;IAALA,KAAK,2BAAG,KAAK;IAAA,qBACbC,QAAQ;IAARA,QAAQ,8BAAG,KAAK;IAAA,sBAChBC,SAAS;IAATA,SAAS,+BAAG,KAAK;IAAA,iBACjBC,IAAI;IAAJA,IAAI,0BAAG,IAAI;IAAA,mBACXC,MAAM;IAANA,MAAM,4BAAG,IAAI;IAAA,kBACbC,KAAK;IAALA,KAAK,2BAAGC,eAAK,CAACC,KAAK;IAAA,qBACnBC,QAAQ;IAARA,QAAQ,8BAAG,MAAM;IAAA,mBACjBC,MAAM;IAANA,MAAM,4BAAG,IAAI;IAAA,0BACbC,aAAa;IAAbA,aAAa,mCAAG,MAAM;IAAA,qBACtBC,QAAQ;IAARA,QAAQ,8BAAG,IAAI;IACZC,KAAK;EAAA,6GAGP,IAAAC,eAAS,EAACjB,KAAK;IAChBI,KAAK,EAALA,KAAK;IACLG,IAAI,EAAJA,IAAI;IACJC,MAAM,EAANA,MAAM;IACNH,QAAQ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K;EACvD,OAAO,IAAAqE,iBAAW,EAAC,IAAAC,qBAAe,EAACtE,KAAK,CAAC,EAAiB,CAAC,iBAAiB,EAAE,WAAW,CAAC,CAAC;AAC7F,CAAC;AAAC"}
|
|
1
|
+
{"version":3,"file":"Button.js","names":["ButtonVariant","buttonStyle","theme","variant","PRIMARY","backgroundColor","block","disabled","noCapital","bold","center","color","COLOR","WHITE","fontSize","noWrap","textTransform","truncate","props","textStyle","border","cursor","display","alignItems","justifyContent","marginBottom","padding","outline","textDecoration","touchAction","transition","defaultTransition","width","TERTIARY","borderRadius","SEND","height","lineHeight","maxWidth","minWidth","Button","primaryDisabledBg","primaryBg","primaryDisabledText","general","contrastColor","primaryHoverBg","primaryFocusBorder","primaryActiveBg","primaryActiveBorder","SECONDARY","IconButton","primaryDisabledBgColor","primaryBgColor","primaryBorderColor","Input","placeholderColor","secondaryHoverBorder","primaryActiveFillColor","secondaryActiveBg","secondaryActiveBorder","primaryColor","tertiarydisabledBg","tertiaryBg","tertiaryDisabledBorder","tertiaryBorder","fontWeight","fill","tertiaryHoverBg","tertiaryHoverBorder","focusColor","tertiaryActiveBg","QUATERNARY","COLOR_V2","GRAY_50","GREEN","GRAY_80","GREEN_LIGHT_600","GREEN_LIGHT_700","GRAY_70","BLUE","BLUE_LIGHT_600","BLUE_LIGHT_800","BLUE_LIGHT_700","showLoading","children","loadingColor","filterButtonProps","margin","filterProps","filterTextProps"],"sources":["Button.tsx"],"sourcesContent":["/*\n * Wire\n * Copyright (C) 2018 Wire Swiss GmbH\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see http://www.gnu.org/licenses/.\n *\n */\n\n/** @jsx jsx */\nimport {CSSObject, jsx} from '@emotion/react';\n\nimport {COLOR, COLOR_V2} from '../Identity';\nimport {defaultTransition} from '../Identity/motions';\nimport {Theme} from '../Layout';\nimport {Loading} from '../Misc';\nimport {TextProps, filterTextProps, textStyle} from '../Text';\nimport {filterProps} from '../util';\n\nexport enum ButtonVariant {\n PRIMARY = 'primary',\n SECONDARY = 'secondary',\n TERTIARY = 'tertiary',\n QUATERNARY = 'quaternary',\n SEND = 'send',\n}\n\nexport interface ButtonProps<T = HTMLButtonElement> extends TextProps<T> {\n variant?: ButtonVariant;\n backgroundColor?: string;\n loadingColor?: string;\n noCapital?: boolean;\n showLoading?: boolean;\n}\n\nexport const buttonStyle: <T>(theme: Theme, props: ButtonProps<T>) => CSSObject = (\n theme,\n {\n variant = ButtonVariant.PRIMARY,\n backgroundColor,\n block = false,\n disabled = false,\n noCapital = false,\n bold = true,\n center = true,\n color = COLOR.WHITE,\n fontSize = '16px',\n noWrap = true,\n textTransform = 'none',\n truncate = true,\n ...props\n },\n) => ({\n ...textStyle(theme, {\n block,\n bold,\n center,\n disabled,\n fontSize,\n noWrap,\n textTransform,\n truncate,\n ...props,\n }),\n border: 0,\n cursor: disabled ? 'default' : 'pointer',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n marginBottom: '16px',\n padding: 0,\n outline: 'none',\n textDecoration: 'none',\n touchAction: 'manipulation',\n transition: defaultTransition,\n width: block ? '100%' : 'auto',\n '&:hover, &:focus': {\n textDecoration: 'none',\n },\n ...(variant !== ButtonVariant.TERTIARY && {\n borderRadius: variant === ButtonVariant.SEND ? '100%' : '16px',\n height: variant === ButtonVariant.SEND ? '40px' : '48px',\n lineHeight: variant === ButtonVariant.SEND ? '40px' : '48px',\n ...(variant !== ButtonVariant.SEND && {\n maxWidth: '100%',\n minWidth: '125px',\n padding: '0 16px',\n }),\n }),\n ...(variant === ButtonVariant.PRIMARY && {\n backgroundColor: backgroundColor || (disabled ? theme.Button.primaryDisabledBg : theme.Button.primaryBg),\n color: disabled ? theme.Button.primaryDisabledText : theme.general.contrastColor,\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: theme.Button.primaryHoverBg,\n },\n '&:focus': {\n border: `1px solid ${theme.Button.primaryFocusBorder}`,\n },\n '&:active': {\n backgroundColor: theme.Button.primaryActiveBg,\n border: `1px solid ${theme.Button.primaryActiveBorder}`,\n color: COLOR.WHITE,\n },\n }),\n }),\n ...(variant === ButtonVariant.SECONDARY && {\n backgroundColor:\n backgroundColor || (disabled ? theme.IconButton.primaryDisabledBgColor : theme.IconButton.primaryBgColor),\n border: `1px solid ${theme.IconButton.primaryBorderColor}`,\n color: disabled ? theme.Input.placeholderColor : theme.general.color,\n ...(!disabled && {\n '&:hover, &:focus': {\n border: `1px solid ${theme.Button.secondaryHoverBorder}`,\n },\n '&:focus': {\n color: theme.IconButton.primaryActiveFillColor,\n },\n '&:active': {\n backgroundColor: theme.Button.secondaryActiveBg,\n border: `1px solid ${theme.Button.secondaryActiveBorder}`,\n color: theme.general.primaryColor,\n },\n }),\n }),\n ...(variant === ButtonVariant.TERTIARY && {\n backgroundColor: backgroundColor || (disabled ? theme.Button.tertiarydisabledBg : theme.Button.tertiaryBg),\n border: disabled ? `1px solid ${theme.Button.tertiaryDisabledBorder}` : `1px solid ${theme.Button.tertiaryBorder}`,\n borderRadius: '12px',\n color: disabled ? theme.Input.placeholderColor : theme.general.color,\n fontSize: '14px',\n fontWeight: 700,\n lineHeight: '24px',\n padding: '4px 8px',\n '& > svg > path': {\n fill: disabled ? theme.Input.placeholderColor : theme.general.color,\n },\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: theme.Button.tertiaryHoverBg,\n border: `1px solid ${theme.Button.tertiaryHoverBorder}`,\n },\n '&:focus': {\n border: `1px solid ${theme.general.focusColor}`,\n },\n '&:active': {\n backgroundColor: theme.Button.tertiaryActiveBg,\n color: theme.IconButton.primaryActiveFillColor,\n '& > svg > path': {\n fill: theme.IconButton.primaryActiveFillColor,\n },\n },\n }),\n }),\n ...(variant === ButtonVariant.QUATERNARY && {\n backgroundColor: backgroundColor || (disabled ? COLOR_V2.GRAY_50 : COLOR_V2.GREEN),\n color: disabled ? COLOR_V2.GRAY_80 : COLOR_V2.WHITE,\n lineHeight: '24px',\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: COLOR_V2.GREEN_LIGHT_600,\n },\n '&:focus': {\n border: `1px solid ${COLOR_V2.GREEN_LIGHT_700}`,\n },\n '&:active': {\n backgroundColor: COLOR_V2.GREEN_LIGHT_700,\n },\n }),\n }),\n ...(variant === ButtonVariant.SEND && {\n backgroundColor: backgroundColor || (disabled ? COLOR_V2.GRAY_70 : COLOR_V2.BLUE),\n width: '40px',\n ...(!disabled && {\n '&:hover, &:focus': {\n backgroundColor: COLOR_V2.BLUE_LIGHT_600,\n },\n '&:focus': {\n border: `1px solid ${COLOR_V2.BLUE_LIGHT_800}`,\n },\n '&:active': {\n backgroundColor: COLOR_V2.BLUE_LIGHT_700,\n },\n }),\n }),\n});\n\nexport const Button = ({showLoading, children, loadingColor = COLOR.WHITE, ...props}: ButtonProps) => (\n <button css={(theme: Theme) => buttonStyle(theme, props)} {...filterButtonProps(props)}>\n {showLoading ? <Loading size={30} color={loadingColor} style={{display: 'flex', margin: 'auto'}} /> : children}\n </button>\n);\n\nexport const filterButtonProps = (props: ButtonProps) => {\n return filterProps(filterTextProps(props) as ButtonProps, ['backgroundColor', 'noCapital']);\n};\n"],"mappings":";;;;;;AAoBA;AAEA;AACA;AAEA;AACA;AACA;AAAoC;EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAExBA,aAAa;AAAA;AAAA,WAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;EAAbA,aAAa;AAAA,GAAbA,aAAa,6BAAbA,aAAa;AAgBlB,IAAMC,WAAkE,GAAG,SAArEA,WAAkE,CAC7EC,KAAK;EAAA,wB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