@pagopa/io-app-design-system 5.11.4 → 5.11.5
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/lib/commonjs/components/templates/ForceScrollDownView.js +5 -13
- package/lib/commonjs/components/templates/ForceScrollDownView.js.map +1 -1
- package/lib/commonjs/components/templates/__test__/__snapshots__/ForceScrollDownView.test.tsx.snap +0 -1
- package/lib/module/components/templates/ForceScrollDownView.js +7 -15
- package/lib/module/components/templates/ForceScrollDownView.js.map +1 -1
- package/lib/module/components/templates/__test__/__snapshots__/ForceScrollDownView.test.tsx.snap +0 -1
- package/lib/typescript/components/templates/ForceScrollDownView.d.ts +1 -7
- package/lib/typescript/components/templates/ForceScrollDownView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/templates/ForceScrollDownView.tsx +8 -23
- package/src/components/templates/__test__/__snapshots__/ForceScrollDownView.test.tsx.snap +0 -1
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ForceScrollDownView = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
10
9
|
var _core = require("../../core");
|
|
11
10
|
var _buttons = require("../buttons");
|
|
12
11
|
var _ScaleInOutAnimation = require("../common/ScaleInOutAnimation");
|
|
@@ -26,11 +25,9 @@ const ForceScrollDownView = ({
|
|
|
26
25
|
style,
|
|
27
26
|
contentContainerStyle,
|
|
28
27
|
scrollEnabled = true,
|
|
29
|
-
onThresholdCrossed
|
|
30
|
-
animatedRef
|
|
28
|
+
onThresholdCrossed
|
|
31
29
|
}) => {
|
|
32
|
-
const
|
|
33
|
-
const scrollViewRef = animatedRef ?? internalAnimatedRef;
|
|
30
|
+
const scrollViewRef = (0, _react.useRef)(null);
|
|
34
31
|
const {
|
|
35
32
|
footerActionsInlineMeasurements,
|
|
36
33
|
handleFooterActionsInlineMeasurements
|
|
@@ -107,13 +104,8 @@ const ForceScrollDownView = ({
|
|
|
107
104
|
*/
|
|
108
105
|
const handleScrollDownPress = (0, _react.useCallback)(() => {
|
|
109
106
|
setButtonVisible(false);
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"worklet";
|
|
113
|
-
|
|
114
|
-
(0, _reactNativeReanimated.scrollTo)(scrollViewRef, 0, y, true);
|
|
115
|
-
})(targetY);
|
|
116
|
-
}, [scrollViewRef, contentHeight, scrollViewHeight]);
|
|
107
|
+
scrollViewRef.current?.scrollToEnd();
|
|
108
|
+
}, [scrollViewRef]);
|
|
117
109
|
|
|
118
110
|
/**
|
|
119
111
|
* Whether or not the "scroll to bottom" button needs to be displayed. It is only displayed
|
|
@@ -144,7 +136,7 @@ const ForceScrollDownView = ({
|
|
|
144
136
|
})
|
|
145
137
|
});
|
|
146
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
147
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
139
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.ScrollView, {
|
|
148
140
|
testID: "ScrollView",
|
|
149
141
|
ref: scrollViewRef,
|
|
150
142
|
scrollEnabled: scrollEnabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_core","_buttons","_ScaleInOutAnimation","_layout","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ForceScrollDownView","footerActions","children","threshold","customThreshold","style","contentContainerStyle","scrollEnabled","onThresholdCrossed","scrollViewRef","useRef","footerActionsInlineMeasurements","handleFooterActionsInlineMeasurements","useFooterActionsInlineMeasurements","safeBottomAreaHeight","scrollViewHeight","setScrollViewHeight","useState","contentHeight","setContentHeight","isThresholdCrossed","setThresholdCrossed","isButtonVisible","setButtonVisible","handleScroll","useCallback","event","layoutMeasurement","contentOffset","contentSize","nativeEvent","thresholdCrossed","height","y","useEffect","handleContentSizeChange","_contentWidth","handleLayout","layout","handleScrollDownPress","current","scrollToEnd","needsScroll","useMemo","shouldRenderScrollButton","scrollDownButton","jsx","ScaleInOutAnimation","springConfig","IOSpringValues","button","styles","visible","IconButtonSolid","testID","accessibilityLabel","icon","onPress","jsxs","Fragment","ScrollView","ref","onScroll","scrollEventThrottle","onLayout","onContentSizeChange","FooterActions","onMeasure","fixed","exports","StyleSheet","create","position","zIndex","right","IOVisualCostants","scrollDownButtonRight","bottom","scrollDownButtonBottom"],"sourceRoot":"../../../../src","sources":["components/templates/ForceScrollDownView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,oBAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAA8E,IAAAM,WAAA,GAAAN,OAAA;AAAA,SAAAD,wBAAAQ,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAQ,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,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BACZ,IAAArB,WAAA,CAAAkE,GAAA,EAACnE,OAAA,CAAAuF,aAAa;QAAA,GACRjE,aAAa;QACjBkE,SAAS,EAAEvD,qCAAsC;QACjDwD,KAAK,EAAE;MAAM,CACd,CACF;IAAA,CACS,CAAC,EACZvB,gBAAgB;EAAA,CACjB,CAAC;AAEP,CAAC;AAACwB,OAAA,CAAArE,mBAAA,GAAAA,mBAAA;AAEF,MAAMmD,MAAM,GAAGmB,uBAAU,CAACC,MAAM,CAAC;EAC/B1B,gBAAgB,EAAE;IAChB2B,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAEC,sBAAgB,CAACC,qBAAqB;IAC7CC,MAAM,EAAEF,sBAAgB,CAACG;EAC3B;AACF,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
4
|
-
import { StyleSheet } from "react-native";
|
|
5
|
-
import Animated, { runOnUI, scrollTo, useAnimatedRef } from "react-native-reanimated";
|
|
3
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { ScrollView, StyleSheet } from "react-native";
|
|
6
5
|
import { IOSpringValues, IOVisualCostants } from "../../core";
|
|
7
6
|
import { IconButtonSolid } from "../buttons";
|
|
8
7
|
import { ScaleInOutAnimation } from "../common/ScaleInOutAnimation";
|
|
@@ -21,11 +20,9 @@ const ForceScrollDownView = ({
|
|
|
21
20
|
style,
|
|
22
21
|
contentContainerStyle,
|
|
23
22
|
scrollEnabled = true,
|
|
24
|
-
onThresholdCrossed
|
|
25
|
-
animatedRef
|
|
23
|
+
onThresholdCrossed
|
|
26
24
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
const scrollViewRef = animatedRef ?? internalAnimatedRef;
|
|
25
|
+
const scrollViewRef = useRef(null);
|
|
29
26
|
const {
|
|
30
27
|
footerActionsInlineMeasurements,
|
|
31
28
|
handleFooterActionsInlineMeasurements
|
|
@@ -102,13 +99,8 @@ const ForceScrollDownView = ({
|
|
|
102
99
|
*/
|
|
103
100
|
const handleScrollDownPress = useCallback(() => {
|
|
104
101
|
setButtonVisible(false);
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"worklet";
|
|
108
|
-
|
|
109
|
-
scrollTo(scrollViewRef, 0, y, true);
|
|
110
|
-
})(targetY);
|
|
111
|
-
}, [scrollViewRef, contentHeight, scrollViewHeight]);
|
|
102
|
+
scrollViewRef.current?.scrollToEnd();
|
|
103
|
+
}, [scrollViewRef]);
|
|
112
104
|
|
|
113
105
|
/**
|
|
114
106
|
* Whether or not the "scroll to bottom" button needs to be displayed. It is only displayed
|
|
@@ -139,7 +131,7 @@ const ForceScrollDownView = ({
|
|
|
139
131
|
})
|
|
140
132
|
});
|
|
141
133
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
142
|
-
children: [/*#__PURE__*/_jsxs(
|
|
134
|
+
children: [/*#__PURE__*/_jsxs(ScrollView, {
|
|
143
135
|
testID: "ScrollView",
|
|
144
136
|
ref: scrollViewRef,
|
|
145
137
|
scrollEnabled: scrollEnabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","useEffect","useMemo","
|
|
1
|
+
{"version":3,"names":["React","useCallback","useEffect","useMemo","useRef","useState","ScrollView","StyleSheet","IOSpringValues","IOVisualCostants","IconButtonSolid","ScaleInOutAnimation","FooterActions","useFooterActionsInlineMeasurements","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","ForceScrollDownView","footerActions","children","threshold","customThreshold","style","contentContainerStyle","scrollEnabled","onThresholdCrossed","scrollViewRef","footerActionsInlineMeasurements","handleFooterActionsInlineMeasurements","safeBottomAreaHeight","scrollViewHeight","setScrollViewHeight","contentHeight","setContentHeight","isThresholdCrossed","setThresholdCrossed","isButtonVisible","setButtonVisible","handleScroll","event","layoutMeasurement","contentOffset","contentSize","nativeEvent","thresholdCrossed","height","y","handleContentSizeChange","_contentWidth","handleLayout","layout","handleScrollDownPress","current","scrollToEnd","needsScroll","shouldRenderScrollButton","scrollDownButton","springConfig","button","styles","visible","testID","accessibilityLabel","icon","onPress","ref","onScroll","scrollEventThrottle","onLayout","onContentSizeChange","onMeasure","fixed","create","position","zIndex","right","scrollDownButtonRight","bottom","scrollDownButtonBottom"],"sourceRoot":"../../../../src","sources":["components/templates/ForceScrollDownView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAGVC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SAIEC,UAAU,EAEVC,UAAU,QACL,cAAc;AACrB,SAASC,cAAc,EAAEC,gBAAgB,QAAQ,YAAY;AAC7D,SAASC,eAAe,QAAQ,YAAY;AAC5C,SAASC,mBAAmB,QAAQ,+BAA+B;AACnE,SAASC,aAAa,EAAEC,kCAAkC,QAAQ,WAAW;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA,EAAAC,QAAA,IAAAC,SAAA;AA0C9E;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAGA,CAAC;EAC3BC,aAAa;EACbC,QAAQ;EACRC,SAAS,EAAEC,eAAe;EAC1BC,KAAK;EACLC,qBAAqB;EACrBC,aAAa,GAAG,IAAI;EACpBC;AACmB,CAAC,KAAK;EACzB,MAAMC,aAAa,GAAGzB,MAAM,CAAa,IAAI,CAAC;EAE9C,MAAM;IACJ0B,+BAA+B;IAC/BC;EACF,CAAC,GAAGlB,kCAAkC,CAAC,CAAC;EAExC,MAAMU,SAAS,GAAGF,aAAa,GAC3BS,+BAA+B,CAACE,oBAAoB,GACpDR,eAAe;;EAEnB;AACF;AACA;AACA;EACE,MAAM,CAACS,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG7B,QAAQ,CAAS,CAAC,CAAC;;EAEnE;AACF;AACA;AACA;EACE,MAAM,CAAC8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ZN,IAAA,CAACH,aAAa;QAAA,GACRS,aAAa;QACjBoD,SAAS,EAAE1C,qCAAsC;QACjD2C,KAAK,EAAE;MAAM,CACd,CACF;IAAA,CACS,CAAC,EACZf,gBAAgB;EAAA,CACjB,CAAC;AAEP,CAAC;AAED,MAAMG,MAAM,GAAGvD,UAAU,CAACoE,MAAM,CAAC;EAC/BhB,gBAAgB,EAAE;IAChBiB,QAAQ,EAAE,UAAU;IACpBC,MAAM,EAAE,EAAE;IACVC,KAAK,EAAErE,gBAAgB,CAACsE,qBAAqB;IAC7CC,MAAM,EAAEvE,gBAAgB,CAACwE;EAC3B;AACF,CAAC,CAAC;AAEF,SAAS7D,mBAAmB","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { ScrollViewProps } from "react-native";
|
|
3
|
-
import Animated, { type AnimatedRef } from "react-native-reanimated";
|
|
4
3
|
import { FooterActions } from "../layout";
|
|
5
4
|
type ForceScrollDownViewActions = {
|
|
6
5
|
/**
|
|
@@ -28,11 +27,6 @@ export type ForceScrollDownView = {
|
|
|
28
27
|
* is passed a boolean indicating whether the threshold has been crossed (`true`) or not (`false`).
|
|
29
28
|
*/
|
|
30
29
|
onThresholdCrossed?: (crossed: boolean) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Optional Animated ref to be used with `useScrollViewOffset`
|
|
33
|
-
* (outside this component)
|
|
34
|
-
*/
|
|
35
|
-
animatedRef?: AnimatedRef<Animated.ScrollView>;
|
|
36
30
|
} & ForceScrollDownViewSlot & Pick<ScrollViewProps, "style" | "contentContainerStyle" | "scrollEnabled" | "testID">;
|
|
37
31
|
/**
|
|
38
32
|
* A React Native component that displays a scroll view with a button that scrolls to the bottom of the content
|
|
@@ -40,6 +34,6 @@ export type ForceScrollDownView = {
|
|
|
40
34
|
* configurable by the `threshold` prop. The button, and the scrolling, can also be disabled by setting the
|
|
41
35
|
* `scrollEnabled` prop to `false`.
|
|
42
36
|
*/
|
|
43
|
-
declare const ForceScrollDownView: ({ footerActions, children, threshold: customThreshold, style, contentContainerStyle, scrollEnabled, onThresholdCrossed
|
|
37
|
+
declare const ForceScrollDownView: ({ footerActions, children, threshold: customThreshold, style, contentContainerStyle, scrollEnabled, onThresholdCrossed }: ForceScrollDownView) => React.JSX.Element;
|
|
44
38
|
export { ForceScrollDownView };
|
|
45
39
|
//# sourceMappingURL=ForceScrollDownView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForceScrollDownView.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/ForceScrollDownView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,EACd,SAAS,
|
|
1
|
+
{"version":3,"file":"ForceScrollDownView.d.ts","sourceRoot":"","sources":["../../../../src/components/templates/ForceScrollDownView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,EACd,SAAS,EAMV,MAAM,OAAO,CAAC;AACf,OAAO,EAKL,eAAe,EAEhB,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,aAAa,EAAsC,MAAM,WAAW,CAAC;AAE9E,KAAK,0BAA0B,GAAG;IAChC;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAClB,aAAa,EAAE,IAAI,CACjB,cAAc,CAAC,OAAO,aAAa,CAAC,EACpC,OAAO,GAAG,WAAW,CACtB,CAAC;CACH,CAAC;AAEF,KAAK,6BAA6B,GAAG;IACnC;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,KAAK,CAAC;CACvB,CAAC;AAEF,KAAK,uBAAuB,GACxB,0BAA0B,GAC1B,6BAA6B,CAAC;AAElC,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACjD,GAAG,uBAAuB,GACzB,IAAI,CACF,eAAe,EACf,OAAO,GAAG,uBAAuB,GAAG,eAAe,GAAG,QAAQ,CAC/D,CAAC;AAEJ;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,GAAI,0HAQ1B,mBAAmB,sBA4JrB,CAAC;AAWF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -4,21 +4,17 @@ import React, {
|
|
|
4
4
|
useCallback,
|
|
5
5
|
useEffect,
|
|
6
6
|
useMemo,
|
|
7
|
+
useRef,
|
|
7
8
|
useState
|
|
8
9
|
} from "react";
|
|
9
10
|
import {
|
|
10
11
|
LayoutChangeEvent,
|
|
11
12
|
NativeScrollEvent,
|
|
12
13
|
NativeSyntheticEvent,
|
|
14
|
+
ScrollView,
|
|
13
15
|
ScrollViewProps,
|
|
14
16
|
StyleSheet
|
|
15
17
|
} from "react-native";
|
|
16
|
-
import Animated, {
|
|
17
|
-
runOnUI,
|
|
18
|
-
scrollTo,
|
|
19
|
-
useAnimatedRef,
|
|
20
|
-
type AnimatedRef
|
|
21
|
-
} from "react-native-reanimated";
|
|
22
18
|
import { IOSpringValues, IOVisualCostants } from "../../core";
|
|
23
19
|
import { IconButtonSolid } from "../buttons";
|
|
24
20
|
import { ScaleInOutAnimation } from "../common/ScaleInOutAnimation";
|
|
@@ -58,11 +54,6 @@ export type ForceScrollDownView = {
|
|
|
58
54
|
* is passed a boolean indicating whether the threshold has been crossed (`true`) or not (`false`).
|
|
59
55
|
*/
|
|
60
56
|
onThresholdCrossed?: (crossed: boolean) => void;
|
|
61
|
-
/**
|
|
62
|
-
* Optional Animated ref to be used with `useScrollViewOffset`
|
|
63
|
-
* (outside this component)
|
|
64
|
-
*/
|
|
65
|
-
animatedRef?: AnimatedRef<Animated.ScrollView>;
|
|
66
57
|
} & ForceScrollDownViewSlot &
|
|
67
58
|
Pick<
|
|
68
59
|
ScrollViewProps,
|
|
@@ -82,11 +73,9 @@ const ForceScrollDownView = ({
|
|
|
82
73
|
style,
|
|
83
74
|
contentContainerStyle,
|
|
84
75
|
scrollEnabled = true,
|
|
85
|
-
onThresholdCrossed
|
|
86
|
-
animatedRef
|
|
76
|
+
onThresholdCrossed
|
|
87
77
|
}: ForceScrollDownView) => {
|
|
88
|
-
const
|
|
89
|
-
const scrollViewRef = animatedRef ?? internalAnimatedRef;
|
|
78
|
+
const scrollViewRef = useRef<ScrollView>(null);
|
|
90
79
|
|
|
91
80
|
const {
|
|
92
81
|
footerActionsInlineMeasurements,
|
|
@@ -174,12 +163,8 @@ const ForceScrollDownView = ({
|
|
|
174
163
|
*/
|
|
175
164
|
const handleScrollDownPress = useCallback(() => {
|
|
176
165
|
setButtonVisible(false);
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"worklet";
|
|
180
|
-
scrollTo(scrollViewRef, 0, y, true);
|
|
181
|
-
})(targetY);
|
|
182
|
-
}, [scrollViewRef, contentHeight, scrollViewHeight]);
|
|
166
|
+
scrollViewRef.current?.scrollToEnd();
|
|
167
|
+
}, [scrollViewRef]);
|
|
183
168
|
|
|
184
169
|
/**
|
|
185
170
|
* Whether or not the "scroll to bottom" button needs to be displayed. It is only displayed
|
|
@@ -222,7 +207,7 @@ const ForceScrollDownView = ({
|
|
|
222
207
|
|
|
223
208
|
return (
|
|
224
209
|
<>
|
|
225
|
-
<
|
|
210
|
+
<ScrollView
|
|
226
211
|
testID={"ScrollView"}
|
|
227
212
|
ref={scrollViewRef}
|
|
228
213
|
scrollEnabled={scrollEnabled}
|
|
@@ -241,7 +226,7 @@ const ForceScrollDownView = ({
|
|
|
241
226
|
fixed={false}
|
|
242
227
|
/>
|
|
243
228
|
)}
|
|
244
|
-
</
|
|
229
|
+
</ScrollView>
|
|
245
230
|
{scrollDownButton}
|
|
246
231
|
</>
|
|
247
232
|
);
|