@space-uy/pulsar-ui 0.11.2 → 0.11.4

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 (41) hide show
  1. package/lib/module/components/CalendarPicker.js +13 -2
  2. package/lib/module/components/CalendarPicker.js.map +1 -1
  3. package/lib/module/components/Header.js +1 -1
  4. package/lib/module/components/Header.js.map +1 -1
  5. package/lib/module/components/Input.js +2 -0
  6. package/lib/module/components/Input.js.map +1 -1
  7. package/lib/module/components/InputContainer.js +3 -0
  8. package/lib/module/components/InputContainer.js.map +1 -1
  9. package/lib/module/components/OtpInput.js +173 -65
  10. package/lib/module/components/OtpInput.js.map +1 -1
  11. package/lib/module/components/TextArea.js +2 -0
  12. package/lib/module/components/TextArea.js.map +1 -1
  13. package/lib/module/index.js +0 -1
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/typescript/src/components/CalendarPicker.d.ts +18 -1
  16. package/lib/typescript/src/components/CalendarPicker.d.ts.map +1 -1
  17. package/lib/typescript/src/components/Header.d.ts +2 -1
  18. package/lib/typescript/src/components/Header.d.ts.map +1 -1
  19. package/lib/typescript/src/components/Input.d.ts +1 -0
  20. package/lib/typescript/src/components/Input.d.ts.map +1 -1
  21. package/lib/typescript/src/components/InputContainer.d.ts +2 -1
  22. package/lib/typescript/src/components/InputContainer.d.ts.map +1 -1
  23. package/lib/typescript/src/components/OtpInput.d.ts +9 -2
  24. package/lib/typescript/src/components/OtpInput.d.ts.map +1 -1
  25. package/lib/typescript/src/components/TextArea.d.ts +1 -0
  26. package/lib/typescript/src/components/TextArea.d.ts.map +1 -1
  27. package/lib/typescript/src/index.d.ts +0 -2
  28. package/lib/typescript/src/index.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/src/components/CalendarPicker.tsx +63 -32
  31. package/src/components/Header.tsx +3 -2
  32. package/src/components/Input.tsx +3 -0
  33. package/src/components/InputContainer.tsx +8 -0
  34. package/src/components/OtpInput.tsx +222 -93
  35. package/src/components/TextArea.tsx +3 -0
  36. package/src/index.tsx +0 -2
  37. package/lib/module/components/OtpInputContainer.js +0 -148
  38. package/lib/module/components/OtpInputContainer.js.map +0 -1
  39. package/lib/typescript/src/components/OtpInputContainer.d.ts +0 -17
  40. package/lib/typescript/src/components/OtpInputContainer.d.ts.map +0 -1
  41. package/src/components/OtpInputContainer.tsx +0 -196
@@ -1,109 +1,238 @@
1
- import {
2
- forwardRef,
3
- useCallback,
4
- useImperativeHandle,
5
- useRef,
6
- useState,
7
- } from 'react';
1
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
2
  import {
9
3
  type NativeSyntheticEvent,
10
4
  StyleSheet,
11
- TextInput,
12
- type TextInputProps,
5
+ TextInput as RNTextInput,
13
6
  type TextInputKeyPressEventData,
7
+ View,
14
8
  } from 'react-native';
15
- import { convertHexToRgba } from '../utils/uiUtils';
9
+
10
+ import InputContainer from './InputContainer';
11
+ import Text from './Text';
16
12
  import useTheme from '../hooks/useTheme';
17
13
 
18
- export const OtpInput = forwardRef<TextInput, TextInputProps>(
19
- (
20
- {
21
- placeholder = '*',
22
- style,
23
- onChangeText,
24
- onKeyPress,
25
- editable = true,
26
- ...rest
27
- }: TextInputProps,
28
- ref
29
- ) => {
30
- const innerRef = useRef<TextInput>(null);
31
- const [value, setValue] = useState<string>('');
32
- const [innerPlaceholder, setInnerPlaceholder] =
33
- useState<string>(placeholder);
34
- const { colors } = useTheme();
35
-
36
- useImperativeHandle(ref, () => innerRef.current as TextInput);
37
-
38
- const onFocus = useCallback(() => setInnerPlaceholder(''), []);
39
-
40
- const onBlur = useCallback(() => {
41
- if (!value?.length) {
42
- setInnerPlaceholder(placeholder);
14
+ type OtpInputProps = {
15
+ length?: number;
16
+ value?: string;
17
+ onChange?: (code: string) => void;
18
+ secure?: boolean;
19
+ variant?: 'default' | 'alternative';
20
+ };
21
+
22
+ export function OtpInput({
23
+ length = 4,
24
+ value,
25
+ onChange,
26
+ secure = false,
27
+ variant = 'default',
28
+ }: OtpInputProps) {
29
+ const { colors } = useTheme();
30
+ const inputRefs = useRef<Array<RNTextInput | null>>([]);
31
+ const [values, setValues] = useState<string[]>(() =>
32
+ new Array(length).fill('')
33
+ );
34
+ const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
35
+
36
+ const safeLength = useMemo(() => Math.max(1, length), [length]);
37
+
38
+ // Sync internal state when `value` or `length` changes from outside.
39
+ useEffect(() => {
40
+ const nextValues = new Array(safeLength).fill('');
41
+ if (value) {
42
+ const digits = value.replace(/\D/g, '').slice(0, safeLength).split('');
43
+ for (let i = 0; i < digits.length; i += 1) {
44
+ nextValues[i] = digits[i];
45
+ }
46
+ }
47
+ setValues(nextValues);
48
+ }, [safeLength, value]);
49
+
50
+ const emitChange = useCallback(
51
+ (nextValues: string[]) => {
52
+ onChange?.(nextValues.join(''));
53
+ },
54
+ [onChange]
55
+ );
56
+
57
+ const focusCell = useCallback(
58
+ (index: number | null) => {
59
+ if (index == null) return;
60
+ const clampedIndex = Math.min(Math.max(index, 0), safeLength - 1);
61
+ inputRefs.current[clampedIndex]?.focus();
62
+ setFocusedIndex(clampedIndex);
63
+ },
64
+ [safeLength]
65
+ );
66
+
67
+ const focusFirstEmpty = useCallback(
68
+ (nextValues: string[]) => {
69
+ const emptyIndex = nextValues.findIndex((v) => v === '');
70
+ if (emptyIndex !== -1) {
71
+ focusCell(emptyIndex);
72
+ } else {
73
+ // Si todas las celdas están llenas, focuseamos la última
74
+ focusCell(safeLength - 1);
75
+ }
76
+ },
77
+ [focusCell, safeLength]
78
+ );
79
+
80
+ const handleChangeText = useCallback(
81
+ (text: string, index: number) => {
82
+ const digits = text.replace(/\D/g, '');
83
+
84
+ // If nothing meaningful, just clear this cell.
85
+ if (!digits.length) {
86
+ const nextValues = [...values];
87
+ nextValues[index] = '';
88
+ setValues(nextValues);
89
+ emitChange(nextValues);
90
+ focusFirstEmpty(nextValues);
91
+ return;
43
92
  }
44
- }, [placeholder, value?.length]);
45
-
46
- const handleChangeText = useCallback(
47
- (text: string) => {
48
- const regex = /^\d+$/;
49
- if (regex.test(text)) {
50
- setValue(text);
51
- onChangeText?.(text);
52
- } else {
53
- innerRef.current?.setNativeProps({ text: '' });
93
+
94
+ // Más de un dígito a la vez (paste o autofill).
95
+ if (digits.length > 1) {
96
+ const hasEmpty = values.some((v) => v === '');
97
+
98
+ // Si todas las celdas ya están completas, solo sobreescribimos la última.
99
+ if (!hasEmpty) {
100
+ const lastIndex = safeLength - 1;
101
+ const nextValues = [...values];
102
+ nextValues[lastIndex] = digits[digits.length - 1] ?? '';
103
+ setValues(nextValues);
104
+ emitChange(nextValues);
105
+ focusCell(lastIndex);
106
+ return;
54
107
  }
55
- },
56
- [onChangeText]
57
- );
58
-
59
- const handleKeyPress = useCallback(
60
- (event: NativeSyntheticEvent<TextInputKeyPressEventData>) => {
61
- if (event.nativeEvent.key === 'Backspace') {
62
- setValue('');
63
- innerRef.current?.setNativeProps({ text: '' });
64
- if (!innerRef?.current?.isFocused()) {
65
- innerRef.current?.setNativeProps({ placeholder: innerPlaceholder });
66
- }
108
+
109
+ // Paste “normal”: distribuimos los dígitos desde el principio.
110
+ inputRefs.current[index]?.setNativeProps({ text: '' });
111
+ const nextValues = new Array(safeLength).fill('');
112
+ const toFill = digits.slice(0, safeLength).split('');
113
+ for (let i = 0; i < toFill.length; i += 1) {
114
+ nextValues[i] = toFill[i];
67
115
  }
68
- onKeyPress?.(event);
69
- },
70
- [innerPlaceholder, onKeyPress]
71
- );
72
-
73
- return (
74
- <TextInput
75
- ref={innerRef}
76
- {...rest}
77
- placeholderTextColor={convertHexToRgba(colors.foreground, 0.5)}
78
- style={[
79
- styles.container,
80
- style,
81
- { backgroundColor: colors.background },
82
- ]}
83
- placeholder={innerPlaceholder}
84
- onFocus={onFocus}
85
- onBlur={onBlur}
86
- onChangeText={handleChangeText}
87
- maxLength={1}
88
- onKeyPress={handleKeyPress}
89
- keyboardType="number-pad"
90
- editable={editable}
91
- textAlignVertical="center"
92
- textAlign="center"
93
- />
94
- );
95
- }
96
- );
116
+ setValues(nextValues);
117
+ emitChange(nextValues);
118
+ focusFirstEmpty(nextValues);
119
+ return;
120
+ }
121
+
122
+ // Single digit typed.
123
+ const nextValues = [...values];
124
+ nextValues[index] = digits[0] ?? '';
125
+ setValues(nextValues);
126
+ emitChange(nextValues);
127
+
128
+ // Move focus to the first empty cell (typically the next one).
129
+ focusFirstEmpty(nextValues);
130
+ },
131
+ [emitChange, focusCell, focusFirstEmpty, safeLength, values]
132
+ );
133
+
134
+ const handleKeyPress = useCallback(
135
+ (event: NativeSyntheticEvent<TextInputKeyPressEventData>) => {
136
+ if (event.nativeEvent.key !== 'Backspace') return;
137
+
138
+ const lastFilledIndex = [...values]
139
+ .map((v, i) => ({ v, i }))
140
+ .filter((item) => item.v !== '')
141
+ .map((item) => item.i)
142
+ .pop();
143
+
144
+ if (lastFilledIndex == null) return;
145
+
146
+ const nextValues = [...values];
147
+ nextValues[lastFilledIndex] = '';
148
+ setValues(nextValues);
149
+ emitChange(nextValues);
150
+ focusCell(lastFilledIndex);
151
+ },
152
+ [emitChange, focusCell, values]
153
+ );
154
+
155
+ const cells = useMemo(
156
+ () => new Array(safeLength).fill(0).map((_, i) => i),
157
+ [safeLength]
158
+ );
159
+
160
+ return (
161
+ <View style={styles.root}>
162
+ {cells.map((cellIndex) => (
163
+ <InputContainer
164
+ key={cellIndex}
165
+ onPress={() => focusCell(cellIndex)}
166
+ focused={focusedIndex === cellIndex}
167
+ style={styles.cellWrapper}
168
+ contentContainerStyle={styles.inputContainer}
169
+ variant={variant}
170
+ size="default"
171
+ >
172
+ <View style={styles.inputWrapper}>
173
+ <RNTextInput
174
+ ref={(ref) => {
175
+ inputRefs.current[cellIndex] = ref;
176
+ }}
177
+ value={values[cellIndex]}
178
+ style={styles.hiddenInput}
179
+ keyboardType="number-pad"
180
+ secureTextEntry={secure}
181
+ onFocus={() => {
182
+ // Siempre focuseamos la primera celda vacía (o la última si están todas llenas)
183
+ focusFirstEmpty(values);
184
+ }}
185
+ onBlur={() => {
186
+ if (focusedIndex === cellIndex) {
187
+ setFocusedIndex(null);
188
+ }
189
+ }}
190
+ onChangeText={(text) => handleChangeText(text, cellIndex)}
191
+ onKeyPress={handleKeyPress}
192
+ autoCorrect={false}
193
+ autoCapitalize="none"
194
+ textContentType="oneTimeCode"
195
+ />
196
+ <Text
197
+ style={[styles.displayText, { color: colors.foreground }]}
198
+ variant="h3"
199
+ >
200
+ {secure && values[cellIndex] ? '●' : values[cellIndex] || ' '}
201
+ </Text>
202
+ </View>
203
+ </InputContainer>
204
+ ))}
205
+ </View>
206
+ );
207
+ }
97
208
 
98
209
  const styles = StyleSheet.create({
99
- container: {
210
+ root: {
211
+ flexDirection: 'row',
100
212
  alignItems: 'center',
101
213
  justifyContent: 'center',
102
- fontSize: 10,
103
- fontWeight: 'normal',
104
- borderWidth: 1,
105
- borderRadius: 8,
106
- height: 71,
107
- width: 80,
214
+ },
215
+ cellWrapper: {
216
+ flexShrink: 0,
217
+ width: 40,
218
+ marginHorizontal: 6,
219
+ },
220
+ inputContainer: {
221
+ paddingHorizontal: 0,
222
+ justifyContent: 'center',
223
+ },
224
+ inputWrapper: {
225
+ flex: 1,
226
+ justifyContent: 'center',
227
+ alignItems: 'center',
228
+ position: 'relative',
229
+ },
230
+ hiddenInput: {
231
+ ...StyleSheet.absoluteFillObject,
232
+ opacity: 0,
233
+ },
234
+ displayText: {
235
+ textAlign: 'center',
236
+ fontSize: 18,
108
237
  },
109
238
  });
@@ -32,6 +32,7 @@ type Props = TextInputProps & {
32
32
  numberOfLines?: number;
33
33
  maxLength?: number;
34
34
  onChangeText?: (text: string) => void;
35
+ containerVariant?: 'default' | 'alternative';
35
36
  };
36
37
 
37
38
  export type InputRef = { focus: () => void; blur: () => void };
@@ -44,6 +45,7 @@ export const TextArea = forwardRef<InputRef, Props>(
44
45
  error,
45
46
  label,
46
47
  hint,
48
+ containerVariant = 'default',
47
49
  onBlur,
48
50
  onFocus,
49
51
  numberOfLines = 4,
@@ -90,6 +92,7 @@ export const TextArea = forwardRef<InputRef, Props>(
90
92
  focused={focused}
91
93
  disabled={!editable}
92
94
  height={numberOfLines * 22}
95
+ variant={containerVariant}
93
96
  >
94
97
  <TextInput
95
98
  {...rest}
package/src/index.tsx CHANGED
@@ -21,9 +21,7 @@ export {
21
21
  export { convertHexToRgba } from './utils/uiUtils';
22
22
  export { default as BottomSheet } from './components/BottomSheet';
23
23
  export { default as TextArea } from './components/TextArea';
24
- export { OtpInputContainer } from './components/OtpInputContainer';
25
24
  export { OtpInput } from './components/OtpInput';
26
- export { type OtpInputContainerRef } from './components/OtpInputContainer';
27
25
  export { default as CalendarPicker } from './components/CalendarPicker';
28
26
  export { default as Accordion, AccordionItem } from './components/Accordion';
29
27
  export { CopyToClipboard } from './components/CopyToClipboard';
@@ -1,148 +0,0 @@
1
- "use strict";
2
-
3
- import { forwardRef, useCallback, useRef, useState, createElement as _createElement } from 'react';
4
- import { Platform, StyleSheet } from 'react-native';
5
- import { View, Keyboard } from 'react-native';
6
- import { OtpInput } from "./OtpInput.js";
7
- import useTheme from "../hooks/useTheme.js";
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- export const OtpInputContainer = /*#__PURE__*/forwardRef(({
10
- length = 4,
11
- inputProps,
12
- inputStyle,
13
- containerProps,
14
- containerStyle,
15
- onFillEnded,
16
- autoFocus = true,
17
- editable = true
18
- }, _) => {
19
- const isIOS = Platform.OS === 'ios';
20
- const pins = Array.from({
21
- length
22
- }).map((__, i) => i);
23
- const inputRefs = useRef([]);
24
- const pinsValues = useRef([]);
25
- const iosOTP = useRef({
26
- key: '',
27
- index: null
28
- });
29
- const timeoutRefs = useRef([]);
30
- const [maskedPins, setMaskedPins] = useState(new Array(length).fill(false));
31
- const {
32
- colors
33
- } = useTheme();
34
- const maskPin = useCallback(index => {
35
- setMaskedPins(prev => {
36
- const newMasked = [...prev];
37
- newMasked[index] = true;
38
- return newMasked;
39
- });
40
- }, []);
41
- const handleOTP = useCallback(otp => {
42
- const regexp = new RegExp(`[0-9]{${length}}`);
43
- const otps = otp.match(regexp);
44
- if (otps?.length) {
45
- const otpSplits = otp.split('');
46
- otpSplits.forEach((otpSplit, i) => inputRefs?.current[i]?.setNativeProps({
47
- text: otpSplit
48
- }));
49
- onFillEnded?.(otp);
50
- iosOTP.current = {
51
- key: '',
52
- index: null
53
- };
54
- Keyboard.dismiss();
55
- return true;
56
- }
57
- return false;
58
- }, [length, onFillEnded]);
59
- const handleChangeText = useCallback(async (text, index) => {
60
- pinsValues.current[index] = text;
61
- if (timeoutRefs.current[index]) {
62
- clearTimeout(timeoutRefs.current[index]);
63
- }
64
- setMaskedPins(prev => {
65
- const newMasked = [...prev];
66
- newMasked[index] = false;
67
- return newMasked;
68
- });
69
- timeoutRefs.current[index] = setTimeout(() => {
70
- maskPin(index);
71
- }, 500);
72
- if (index + 1 <= pins.length - 1) {
73
- inputRefs?.current[index + 1]?.focus();
74
- } else {
75
- onFillEnded?.(pinsValues.current.join(''));
76
- Keyboard.dismiss();
77
- }
78
- }, [maskPin, pins.length, onFillEnded]);
79
- const onKeyPress = useCallback((event, index) => {
80
- event.persist();
81
- if (isIOS && Number.isInteger(Number(event.nativeEvent.key))) {
82
- if (iosOTP.current.index === null) {
83
- iosOTP.current = {
84
- key: event.nativeEvent.key,
85
- index
86
- };
87
- } else {
88
- if (iosOTP.current.index === index) {
89
- iosOTP.current = {
90
- key: `${iosOTP.current.key}${event.nativeEvent.key}`,
91
- index
92
- };
93
- } else {
94
- iosOTP.current = {
95
- key: '',
96
- index: null
97
- };
98
- }
99
- }
100
- if (iosOTP.current.key.length === length) {
101
- handleOTP(iosOTP.current.key);
102
- return;
103
- }
104
- }
105
- if (event.nativeEvent.key === 'Backspace') {
106
- onFillEnded?.('');
107
- iosOTP.current = {
108
- key: '',
109
- index: null
110
- };
111
- if (index - 1 >= 0) {
112
- inputRefs?.current[index - 1]?.focus();
113
- }
114
- }
115
- }, [handleOTP, length, onFillEnded, isIOS]);
116
- return /*#__PURE__*/_jsx(View, {
117
- style: [styles.container, containerStyle],
118
- ...containerProps,
119
- children: pins.map(pin => {
120
- return /*#__PURE__*/_createElement(OtpInput, {
121
- ...inputProps,
122
- autoFocus: autoFocus && pin === 0,
123
- ref: input => inputRefs?.current.push(input),
124
- key: pin,
125
- style: [inputStyle, {
126
- borderColor: colors.border,
127
- color: colors.foreground
128
- }],
129
- onChangeText: text => handleChangeText(text, pin),
130
- onKeyPress: event => onKeyPress(event, pin),
131
- autoComplete: "sms-otp",
132
- textContentType: "oneTimeCode",
133
- keyboardType: "numeric",
134
- secureTextEntry: maskedPins[pin],
135
- editable: editable
136
- });
137
- })
138
- });
139
- });
140
- const styles = StyleSheet.create({
141
- container: {
142
- display: 'flex',
143
- flexDirection: 'row',
144
- alignItems: 'center',
145
- justifyContent: 'center'
146
- }
147
- });
148
- //# sourceMappingURL=OtpInputContainer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["forwardRef","useCallback","useRef","useState","createElement","_createElement","Platform","StyleSheet","View","Keyboard","OtpInput","useTheme","jsx","_jsx","OtpInputContainer","length","inputProps","inputStyle","containerProps","containerStyle","onFillEnded","autoFocus","editable","_","isIOS","OS","pins","Array","from","map","__","i","inputRefs","pinsValues","iosOTP","key","index","timeoutRefs","maskedPins","setMaskedPins","fill","colors","maskPin","prev","newMasked","handleOTP","otp","regexp","RegExp","otps","match","otpSplits","split","forEach","otpSplit","current","setNativeProps","text","dismiss","handleChangeText","clearTimeout","setTimeout","focus","join","onKeyPress","event","persist","Number","isInteger","nativeEvent","style","styles","container","children","pin","ref","input","push","borderColor","border","color","foreground","onChangeText","autoComplete","textContentType","keyboardType","secureTextEntry","create","display","flexDirection","alignItems","justifyContent"],"sourceRoot":"../../../src","sources":["components/OtpInputContainer.tsx"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,WAAW,EAAEC,MAAM,EAAEC,QAAQ,EAAAC,aAAA,IAAAC,cAAA,QAAQ,OAAO;AACj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,EAAGC,KAAK,IAAKD,UAAU,CAACC,KAAK,EAAES,GAAG,CAAE;QAC9CS,YAAY,EAAC,SAAS;QACtBC,eAAe,EAAC,aAAa;QAC7BC,YAAY,EAAC,SAAS;QACtBC,eAAe,EAAEhD,UAAU,CAACoC,GAAG,CAAE;QACjCpD,QAAQ,EAAEA;MAAS,CACpB,CAAC;IAEN,CAAC;EAAC,CACE,CAAC;AAEX,CACF,CAAC;AAED,MAAMiD,MAAM,GAAGhE,UAAU,CAACgF,MAAM,CAAC;EAC/Bf,SAAS,EAAE;IACTgB,OAAO,EAAE,MAAM;IACfC,aAAa,EAAE,KAAK;IACpBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE;EAClB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -1,17 +0,0 @@
1
- import { type ViewProps, type TextInputProps } from 'react-native';
2
- export type OtpInputContainerRef = {
3
- clear: () => void;
4
- };
5
- type OtpInputContainerProps = {
6
- inputProps?: Omit<TextInputProps, 'style' | 'onChangeText' | 'onKeyPress' | 'autoComplete' | 'keyboardType' | 'autoFocus'>;
7
- inputStyle?: TextInputProps['style'];
8
- containerProps?: Omit<ViewProps, 'style'>;
9
- containerStyle?: ViewProps['style'];
10
- length?: number;
11
- onFillEnded?: (otp: string) => void;
12
- autoFocus?: boolean;
13
- editable?: boolean;
14
- };
15
- export declare const OtpInputContainer: import("react").ForwardRefExoticComponent<OtpInputContainerProps & import("react").RefAttributes<OtpInputContainerRef>>;
16
- export {};
17
- //# sourceMappingURL=OtpInputContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OtpInputContainer.d.ts","sourceRoot":"","sources":["../../../../src/components/OtpInputContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,SAAS,EACd,KAAK,cAAc,EAEpB,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,UAAU,CAAC,EAAE,IAAI,CACf,cAAc,EACZ,OAAO,GACP,cAAc,GACd,YAAY,GACZ,cAAc,GACd,cAAc,GACd,WAAW,CACd,CAAC;IACF,UAAU,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACrC,cAAc,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1C,cAAc,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,iBAAiB,yHAsJ7B,CAAC"}