react-native-reorderable-list 0.16.1 → 0.17.0
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/README.md +12 -5
- package/lib/commonjs/components/NestedReorderableList.js +6 -6
- package/lib/commonjs/components/NestedReorderableList.js.map +1 -1
- package/lib/commonjs/components/ReorderableList.js +3 -3
- package/lib/commonjs/components/ReorderableList.js.map +1 -1
- package/lib/commonjs/components/ReorderableListCell.js +20 -18
- package/lib/commonjs/components/ReorderableListCell.js.map +1 -1
- package/lib/commonjs/components/ReorderableListCore.js +169 -159
- package/lib/commonjs/components/ReorderableListCore.js.map +1 -1
- package/lib/commonjs/components/ScrollViewContainer.js +13 -12
- package/lib/commonjs/components/ScrollViewContainer.js.map +1 -1
- package/lib/commonjs/contexts/ReorderableListContext.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/NestedReorderableList.js +6 -6
- package/lib/module/components/NestedReorderableList.js.map +1 -1
- package/lib/module/components/ReorderableList.js +3 -3
- package/lib/module/components/ReorderableList.js.map +1 -1
- package/lib/module/components/ReorderableListCell.js +20 -18
- package/lib/module/components/ReorderableListCell.js.map +1 -1
- package/lib/module/components/ReorderableListCore.js +169 -159
- package/lib/module/components/ReorderableListCore.js.map +1 -1
- package/lib/module/components/ScrollViewContainer.js +13 -12
- package/lib/module/components/ScrollViewContainer.js.map +1 -1
- package/lib/module/contexts/ReorderableListContext.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/ReorderableListCell.d.ts +3 -3
- package/lib/typescript/components/ReorderableListCell.d.ts.map +1 -1
- package/lib/typescript/components/ReorderableListCore.d.ts +3 -3
- package/lib/typescript/components/ReorderableListCore.d.ts.map +1 -1
- package/lib/typescript/components/ScrollViewContainer.d.ts.map +1 -1
- package/lib/typescript/contexts/ReorderableListContext.d.ts +2 -1
- package/lib/typescript/contexts/ReorderableListContext.d.ts.map +1 -1
- package/lib/typescript/contexts/ScrollViewContainerContext.d.ts +3 -3
- package/lib/typescript/contexts/ScrollViewContainerContext.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types/props.d.ts +18 -4
- package/lib/typescript/types/props.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/NestedReorderableList.tsx +6 -6
- package/src/components/ReorderableList.tsx +3 -3
- package/src/components/ReorderableListCell.tsx +27 -19
- package/src/components/ReorderableListCore.tsx +278 -219
- package/src/components/ScrollViewContainer.tsx +27 -14
- package/src/contexts/ReorderableListContext.ts +2 -1
- package/src/contexts/ScrollViewContainerContext.ts +3 -3
- package/src/index.ts +2 -0
- package/src/types/props.ts +24 -5
package/README.md
CHANGED
|
@@ -2,15 +2,23 @@
|
|
|
2
2
|
[](https://github.com/omahili/react-native-reorderable-list?tab=MIT-1-ov-file#readme)
|
|
3
3
|
[](https://www.npmjs.com/package/react-native-reorderable-list?activeTab=versions)
|
|
4
4
|
<br />
|
|
5
|
-

|
|
6
|
-

|
|
5
|
+
[](https://developer.apple.com/ios)
|
|
6
|
+
[](https://www.android.com)
|
|
7
7
|
|
|
8
8
|
# React Native Reorderable List
|
|
9
9
|
|
|
10
|
-
A reorderable list for React Native applications, powered by Reanimated
|
|
10
|
+
A reorderable list for React Native applications, powered by Reanimated 🚀.
|
|
11
11
|
|
|
12
12
|

|
|
13
13
|
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- Drag & Drop FlatList
|
|
17
|
+
- Vertical & Horizontal Mode
|
|
18
|
+
- Layout Animations
|
|
19
|
+
- Nested Lists
|
|
20
|
+
- Custom Animations
|
|
21
|
+
|
|
14
22
|
## Index
|
|
15
23
|
|
|
16
24
|
- [Install](#install)
|
|
@@ -60,7 +68,7 @@ This component uses a [FlatList](https://reactnative.dev/docs/flatlist) and it e
|
|
|
60
68
|
| Props | Type | Required | Default | Description |
|
|
61
69
|
| ------------------------- | ------------------------------------------------ | -------- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
62
70
|
| autoscrollThreshold | `number` | No | `0.1` | Threshold at the extremity of the list that triggers autoscroll when an item is dragged to it. A value of `0.1` means that 10% of the area at the top and 10% at the bottom will trigger autoscroll. Min value: `0`. Max value: `0.4`. |
|
|
63
|
-
| autoscrollThresholdOffset | `{
|
|
71
|
+
| autoscrollThresholdOffset | `{start?: number; end?: number}` | No | `{start: 0, end: 0}` | Amount by which the threshold is offset at the extremety of the list. For example, setting `{start: 50}` will make the autoscroll trigger 50 pixels earlier at the start of the list. |
|
|
64
72
|
| autoscrollSpeedScale | `number` | No | `1` | Scales the autoscroll speed at which the list scrolls when an item is dragged to the scroll areas. |
|
|
65
73
|
| autoscrollDelay | `number` | No | `0` (Android), `100` (iOS) | Delay in between autoscroll triggers. Can be used to tune the autoscroll smoothness. Default values differ between platforms: `0` for Android and `100` for iOS. |
|
|
66
74
|
| autoscrollActivationDelta | `number` | No | `5` | Allows configuring the delta for autoscroll activation when dragging an item in the same direction as the autoscroll. This is particularly useful when an item is dragged within the autoscroll area to account for minor unintentional movements. |
|
|
@@ -78,7 +86,6 @@ This component uses a [FlatList](https://reactnative.dev/docs/flatlist) and it e
|
|
|
78
86
|
|
|
79
87
|
The following props from FlatList are not supported:
|
|
80
88
|
|
|
81
|
-
- horizontal
|
|
82
89
|
- scrollEventThrottle
|
|
83
90
|
- removeClippedSubviews
|
|
84
91
|
- CellRendererComponent
|
|
@@ -17,9 +17,9 @@ const NestedReorderableListWithRef = ({
|
|
|
17
17
|
}, ref) => {
|
|
18
18
|
const {
|
|
19
19
|
scrollViewContainerRef,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
scrollViewScrollOffsetXY,
|
|
21
|
+
scrollViewPageXY,
|
|
22
|
+
scrollViewSize,
|
|
23
23
|
scrollViewScrollEnabledProp,
|
|
24
24
|
outerScrollGesture,
|
|
25
25
|
setScrollViewForceDisableScroll
|
|
@@ -27,9 +27,9 @@ const NestedReorderableListWithRef = ({
|
|
|
27
27
|
return /*#__PURE__*/_react.default.createElement(_ReorderableListCore.ReorderableListCore, _extends({}, rest, {
|
|
28
28
|
ref: ref,
|
|
29
29
|
scrollViewContainerRef: scrollViewContainerRef,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
scrollViewScrollOffsetXY: scrollViewScrollOffsetXY,
|
|
31
|
+
scrollViewPageXY: scrollViewPageXY,
|
|
32
|
+
scrollViewSize: scrollViewSize,
|
|
33
33
|
outerScrollGesture: outerScrollGesture,
|
|
34
34
|
scrollViewScrollEnabledProp: scrollViewScrollEnabledProp,
|
|
35
35
|
setScrollViewForceDisableScroll: setScrollViewForceDisableScroll,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_ReorderableListCore","_contexts","_hooks","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","NestedReorderableListWithRef","scrollable","rest","ref","scrollViewContainerRef","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_ReorderableListCore","_contexts","_hooks","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","NestedReorderableListWithRef","scrollable","rest","ref","scrollViewContainerRef","scrollViewScrollOffsetXY","scrollViewPageXY","scrollViewSize","scrollViewScrollEnabledProp","outerScrollGesture","setScrollViewForceDisableScroll","useContext","ScrollViewContainerContext","createElement","ReorderableListCore","nestedScrollEnabled","NestedReorderableList","exports","forwardRef"],"sourceRoot":"../../../src","sources":["components/NestedReorderableList.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,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AAAS,MAAA,GAAAT,MAAA,CAAAS,MAAA,CAAAC,IAAA,eAAAb,CAAA,aAAAR,CAAA,MAAAA,CAAA,GAAAsB,SAAA,CAAAC,MAAA,EAAAvB,CAAA,UAAAG,CAAA,GAAAmB,SAAA,CAAAtB,CAAA,YAAAE,CAAA,IAAAC,CAAA,OAAAY,cAAA,CAAAC,IAAA,CAAAb,CAAA,EAAAD,CAAA,MAAAM,CAAA,CAAAN,CAAA,IAAAC,CAAA,CAAAD,CAAA,aAAAM,CAAA,KAAAW,QAAA,CAAAK,KAAA,OAAAF,SAAA;AAGpC,MAAMG,4BAA4B,GAAGA,CACnC;EAACC,UAAU;EAAE,GAAGC;AAAmC,CAAC,EACpDC,GAAqC,KAClC;EACH,MAAM;IACJC,sBAAsB;IACtBC,wBAAwB;IACxBC,gBAAgB;IAChBC,cAAc;IACdC,2BAA2B;IAC3BC,kBAAkB;IAClBC;EACF,CAAC,GAAG,IAAAC,iBAAU,EAACC,oCAA0B,CAAC;EAE1C,oBACE5C,MAAA,CAAAY,OAAA,CAAAiC,aAAA,CAAC1C,oBAAA,CAAA2C,mBAAmB,EAAApB,QAAA,KACdQ,IAAI;IACRC,GAAG,EAAEA,GAAI;IACTC,sBAAsB,EAAEA,sBAAuB;IAC/CC,wBAAwB,EAAEA,wBAAyB;IACnDC,gBAAgB,EAAEA,gBAAiB;IACnCC,cAAc,EAAEA,cAAe;IAC/BE,kBAAkB,EAAEA,kBAAmB;IACvCD,2BAA2B,EAAEA,2BAA4B;IACzDE,+BAA+B,EAAEA,+BAAgC;IACjET,UAAU,EAAEA,UAAW;IACvBc,mBAAmB;EAAA,EACpB,CAAC;AAEN,CAAC;AAEM,MAAMC,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,gBAAG,IAAAE,iBAAU,EAC7ClB,4BACF,CAEgB","ignoreList":[]}
|
|
@@ -12,9 +12,9 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
|
|
|
12
12
|
const ReorderableListWithRef = (props, ref) => /*#__PURE__*/_react.default.createElement(_ReorderableListCore.ReorderableListCore, _extends({}, props, {
|
|
13
13
|
ref: ref,
|
|
14
14
|
scrollViewContainerRef: undefined,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
scrollViewScrollOffsetXY: undefined,
|
|
16
|
+
scrollViewPageXY: undefined,
|
|
17
|
+
scrollViewSize: undefined,
|
|
18
18
|
outerScrollGesture: undefined,
|
|
19
19
|
scrollViewScrollEnabledProp: undefined,
|
|
20
20
|
setScrollViewForceDisableScroll: undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_ReorderableListCore","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","ReorderableListWithRef","props","ref","createElement","ReorderableListCore","scrollViewContainerRef","undefined","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_ReorderableListCore","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_extends","assign","bind","arguments","length","apply","ReorderableListWithRef","props","ref","createElement","ReorderableListCore","scrollViewContainerRef","undefined","scrollViewScrollOffsetXY","scrollViewPageXY","scrollViewSize","outerScrollGesture","scrollViewScrollEnabledProp","setScrollViewForceDisableScroll","scrollable","ReorderableList","exports","forwardRef"],"sourceRoot":"../../../src","sources":["components/ReorderableList.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAA0D,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG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M,CAAA,CAAAN,CAAA,IAAAC,CAAA,CAAAD,CAAA,aAAAM,CAAA,KAAAW,QAAA,CAAAK,KAAA,OAAAF,SAAA;AAG1D,MAAMG,sBAAsB,GAAGA,CAC7BC,KAA8B,EAC9BC,GAA2B,kBAE3BhC,MAAA,CAAAU,OAAA,CAAAuB,aAAA,CAAC9B,oBAAA,CAAA+B,mBAAmB,EAAAV,QAAA,KACdO,KAAK;EACTC,GAAG,EAAEA,GAAI;EACTG,sBAAsB,EAAEC,SAAU;EAClCC,wBAAwB,EAAED,SAAU;EACpCE,gBAAgB,EAAEF,SAAU;EAC5BG,cAAc,EAAEH,SAAU;EAC1BI,kBAAkB,EAAEJ,SAAU;EAC9BK,2BAA2B,EAAEL,SAAU;EACvCM,+BAA+B,EAAEN,SAAU;EAC3CO,UAAU;AAAA,EACX,CACF;AAEM,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,gBAAG,IAAAE,iBAAU,EAAChB,sBAAsB,CAEhD","ignoreList":[]}
|
|
@@ -17,17 +17,18 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
|
|
|
17
17
|
children,
|
|
18
18
|
onLayout,
|
|
19
19
|
itemOffset,
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
itemSize,
|
|
21
|
+
dragXY,
|
|
22
22
|
draggedIndex,
|
|
23
23
|
animationDuration
|
|
24
24
|
}) => {
|
|
25
25
|
const {
|
|
26
26
|
currentIndex,
|
|
27
|
-
|
|
27
|
+
draggedSize,
|
|
28
28
|
activeIndex,
|
|
29
29
|
cellAnimations,
|
|
30
|
-
itemLayoutAnimation
|
|
30
|
+
itemLayoutAnimation,
|
|
31
|
+
horizontal
|
|
31
32
|
} = (0, _hooks.useContext)(_contexts.ReorderableListContext);
|
|
32
33
|
const dragHandler = (0, _react.useCallback)(() => (0, _reactNativeReanimated.runOnUI)(startDrag)(index), [startDrag, index]);
|
|
33
34
|
const isActive = activeIndex === index;
|
|
@@ -38,14 +39,14 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
|
|
|
38
39
|
isActive
|
|
39
40
|
}), [index, dragHandler, draggedIndex, isActive]);
|
|
40
41
|
|
|
41
|
-
// Keep separate animated reactions that update
|
|
42
|
+
// Keep separate animated reactions that update itemTranslateXY
|
|
42
43
|
// otherwise animations might stutter if multiple are triggered
|
|
43
44
|
// (even in other cells, e.g. released item and reordering cells)
|
|
44
|
-
const
|
|
45
|
+
const itemTranslateXY = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
45
46
|
const isActiveCell = (0, _reactNativeReanimated.useDerivedValue)(() => draggedIndex.value === index);
|
|
46
|
-
(0, _reactNativeReanimated.useAnimatedReaction)(() =>
|
|
47
|
+
(0, _reactNativeReanimated.useAnimatedReaction)(() => dragXY.value, () => {
|
|
47
48
|
if (index === draggedIndex.value && currentIndex.value >= 0 && draggedIndex.value >= 0) {
|
|
48
|
-
|
|
49
|
+
itemTranslateXY.value = dragXY.value;
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
(0, _reactNativeReanimated.useAnimatedReaction)(() => currentIndex.value, () => {
|
|
@@ -55,10 +56,10 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
|
|
|
55
56
|
const endMove = Math.max(draggedIndex.value, currentIndex.value);
|
|
56
57
|
let newValue = 0;
|
|
57
58
|
if (index >= startMove && index <= endMove) {
|
|
58
|
-
newValue = moveUp ? -
|
|
59
|
+
newValue = moveUp ? -draggedSize.value : draggedSize.value;
|
|
59
60
|
}
|
|
60
|
-
if (newValue !==
|
|
61
|
-
|
|
61
|
+
if (newValue !== itemTranslateXY.value) {
|
|
62
|
+
itemTranslateXY.value = (0, _reactNativeReanimated.withTiming)(newValue, {
|
|
62
63
|
duration: animationDuration.value,
|
|
63
64
|
easing: _reactNativeReanimated.Easing.out(_reactNativeReanimated.Easing.ease)
|
|
64
65
|
});
|
|
@@ -66,9 +67,10 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
|
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
70
|
+
const translatePropName = horizontal.value ? 'translateX' : 'translateY';
|
|
69
71
|
if (isActiveCell.value) {
|
|
70
72
|
const transform = [{
|
|
71
|
-
|
|
73
|
+
[translatePropName]: itemTranslateXY.value
|
|
72
74
|
}];
|
|
73
75
|
if (Array.isArray(cellAnimations.transform)) {
|
|
74
76
|
const customTransform = cellAnimations.transform.map(x => (0, _helpers.applyAnimatedStyles)({}, x));
|
|
@@ -81,18 +83,18 @@ const ReorderableListCell = exports.ReorderableListCell = /*#__PURE__*/(0, _reac
|
|
|
81
83
|
}
|
|
82
84
|
return {
|
|
83
85
|
transform: [{
|
|
84
|
-
|
|
86
|
+
[translatePropName]: itemTranslateXY.value
|
|
85
87
|
}],
|
|
86
|
-
//
|
|
88
|
+
// We set zIndex here due to the following issue:
|
|
87
89
|
// https://github.com/software-mansion/react-native-reanimated/issues/6681#issuecomment-2514228447
|
|
88
90
|
zIndex: 0
|
|
89
91
|
};
|
|
90
92
|
});
|
|
91
93
|
const handleLayout = e => {
|
|
92
|
-
(0, _reactNativeReanimated.runOnUI)((y, height) => {
|
|
93
|
-
itemOffset.value[index] = y;
|
|
94
|
-
|
|
95
|
-
})(e.nativeEvent.layout.y, e.nativeEvent.layout.height);
|
|
94
|
+
(0, _reactNativeReanimated.runOnUI)((x, y, width, height) => {
|
|
95
|
+
itemOffset.value[index] = horizontal.value ? x : y;
|
|
96
|
+
itemSize.value[index] = horizontal.value ? width : height;
|
|
97
|
+
})(e.nativeEvent.layout.x, e.nativeEvent.layout.y, e.nativeEvent.layout.width, e.nativeEvent.layout.height);
|
|
96
98
|
onLayout === null || onLayout === void 0 || onLayout(e);
|
|
97
99
|
};
|
|
98
100
|
return /*#__PURE__*/_react.default.createElement(_contexts.ReorderableCellContext.Provider, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_contexts","_hooks","_helpers","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ReorderableListCell","exports","memo","index","startDrag","children","onLayout","itemOffset","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNativeReanimated","_contexts","_hooks","_helpers","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","ReorderableListCell","exports","memo","index","startDrag","children","onLayout","itemOffset","itemSize","dragXY","draggedIndex","animationDuration","currentIndex","draggedSize","activeIndex","cellAnimations","itemLayoutAnimation","horizontal","useContext","ReorderableListContext","dragHandler","useCallback","runOnUI","isActive","contextValue","useMemo","itemTranslateXY","useSharedValue","isActiveCell","useDerivedValue","value","useAnimatedReaction","moveUp","startMove","Math","min","endMove","max","newValue","withTiming","duration","easing","Easing","out","ease","animatedStyle","useAnimatedStyle","translatePropName","transform","Array","isArray","customTransform","map","x","applyAnimatedStyles","push","zIndex","handleLayout","y","width","height","nativeEvent","layout","createElement","ReorderableCellContext","Provider","View","style","current"],"sourceRoot":"../../../src","sources":["components/ReorderableListCell.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,sBAAA,GAAAF,uBAAA,CAAAC,OAAA;AAWA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAA8C,SAAAK,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,C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