@cuemath/leap 3.3.8-m → 3.3.8
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/dist/features/ui/arrow-tooltip/arrow-tooltip-styled.js +3 -8
- package/dist/features/ui/arrow-tooltip/arrow-tooltip-styled.js.map +1 -1
- package/dist/features/ui/arrow-tooltip/arrow-tooltip.js +40 -40
- package/dist/features/ui/arrow-tooltip/arrow-tooltip.js.map +1 -1
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js +75 -88
- package/dist/features/ui/dot-lottie-animations/dot-lottie-animation.js.map +1 -1
- package/dist/features/ui/lottie-animation/lottie-animation.js +31 -36
- package/dist/features/ui/lottie-animation/lottie-animation.js.map +1 -1
- package/dist/features/ui/modals/modal-styled.js +15 -48
- package/dist/features/ui/modals/modal-styled.js.map +1 -1
- package/dist/features/ui/modals/modal.js +38 -46
- package/dist/features/ui/modals/modal.js.map +1 -1
- package/dist/features/{stickers/sticker-selector/sticker-selector-styles.js → ui/sticker-grid/sticker-grid-styles.js} +31 -23
- package/dist/features/ui/sticker-grid/sticker-grid-styles.js.map +1 -0
- package/dist/features/ui/sticker-grid/sticker-grid.js +24 -0
- package/dist/features/ui/sticker-grid/sticker-grid.js.map +1 -0
- package/dist/features/ui/sticker-grid/sticker.js +57 -0
- package/dist/features/ui/sticker-grid/sticker.js.map +1 -0
- package/dist/features/ui/stickers/constants.js +6 -0
- package/dist/features/ui/stickers/constants.js.map +1 -0
- package/dist/features/ui/stickers/stickers-effects.js +64 -0
- package/dist/features/ui/stickers/stickers-effects.js.map +1 -0
- package/dist/features/ui/stickers/stickers-styled.js +29 -0
- package/dist/features/ui/stickers/stickers-styled.js.map +1 -0
- package/dist/features/ui/stickers/stickers-utils.js +91 -0
- package/dist/features/ui/stickers/stickers-utils.js.map +1 -0
- package/dist/features/ui/stickers/stickers.js +40 -0
- package/dist/features/ui/stickers/stickers.js.map +1 -0
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js +38 -38
- package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/worksheet-questions-controller.js +128 -126
- package/dist/features/worksheet/worksheet/worksheet-questions-controller/worksheet-questions-controller.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-sidebar/question-guide.js +52 -98
- package/dist/features/worksheet/worksheet/worksheet-sidebar/question-guide.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-sidebar/sidebar.js +17 -21
- package/dist/features/worksheet/worksheet/worksheet-sidebar/sidebar.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-sidebar/worksheet-sidebar-styled.js +27 -33
- package/dist/features/worksheet/worksheet/worksheet-sidebar/worksheet-sidebar-styled.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
- package/dist/features/worksheet/worksheet/worksheet.js +132 -141
- package/dist/features/worksheet/worksheet/worksheet.js.map +1 -1
- package/dist/index.d.ts +34 -90
- package/dist/index.js +373 -375
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/stickers/sticker-data.js +0 -234
- package/dist/features/stickers/sticker-data.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker-selector-grid.js +0 -39
- package/dist/features/stickers/sticker-selector/sticker-selector-grid.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker-selector-styles.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker-selector.js +0 -76
- package/dist/features/stickers/sticker-selector/sticker-selector.js.map +0 -1
- package/dist/features/stickers/sticker-selector/sticker.js +0 -60
- package/dist/features/stickers/sticker-selector/sticker.js.map +0 -1
- package/dist/features/stickers/stickers-effects/effects.js +0 -82
- package/dist/features/stickers/stickers-effects/effects.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-cache.js +0 -19
- package/dist/features/stickers/stickers-effects/stickers-cache.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js +0 -105
- package/dist/features/stickers/stickers-effects/stickers-effects-helper.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js +0 -37
- package/dist/features/stickers/stickers-effects/stickers-effects-styled.js.map +0 -1
- package/dist/features/stickers/stickers-effects/stickers-effects.js +0 -67
- package/dist/features/stickers/stickers-effects/stickers-effects.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
1
|
+
import o from "styled-components";
|
|
2
|
+
const i = o.div`
|
|
3
3
|
position: absolute;
|
|
4
4
|
top: 0;
|
|
5
5
|
left: 0;
|
|
@@ -8,13 +8,8 @@ const e = i.div`
|
|
|
8
8
|
width: 100%;
|
|
9
9
|
height: 100%;
|
|
10
10
|
z-index: ${({ theme: t }) => t.zIndex.JOURNEY_OVERLAY};
|
|
11
|
-
`, n = i.div`
|
|
12
|
-
visibility: ${({ $visible: t }) => t ? "visible" : "hidden"};
|
|
13
|
-
opacity: ${({ $visible: t }) => t ? 1 : 0};
|
|
14
|
-
pointer-events: ${({ $visible: t }) => t ? "auto" : "none"};
|
|
15
11
|
`;
|
|
16
12
|
export {
|
|
17
|
-
|
|
18
|
-
n as TooltipWrapper
|
|
13
|
+
i as BackgroundOverlay
|
|
19
14
|
};
|
|
20
15
|
//# sourceMappingURL=arrow-tooltip-styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-tooltip-styled.js","sources":["../../../../src/features/ui/arrow-tooltip/arrow-tooltip-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nexport const BackgroundOverlay = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n z-index: ${({ theme }) => theme.zIndex.JOURNEY_OVERLAY};\n`;\n
|
|
1
|
+
{"version":3,"file":"arrow-tooltip-styled.js","sources":["../../../../src/features/ui/arrow-tooltip/arrow-tooltip-styled.tsx"],"sourcesContent":["import styled from 'styled-components';\n\nexport const BackgroundOverlay = styled.div`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n width: 100%;\n height: 100%;\n z-index: ${({ theme }) => theme.zIndex.JOURNEY_OVERLAY};\n`;\n"],"names":["BackgroundOverlay","styled","theme"],"mappings":";AAEO,MAAMA,IAAoBC,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAQ3B,CAAC,EAAE,OAAAC,EAAA,MAAYA,EAAM,OAAO,eAAe;AAAA;"}
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { memo as Y, useRef as H, useState as
|
|
1
|
+
import { jsxs as D, Fragment as U, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import W from "../../../node_modules/lodash.throttle/index.js";
|
|
3
|
+
import { memo as Y, useRef as H, useState as f, useCallback as p, useEffect as m } from "react";
|
|
4
4
|
import $ from "../layout/flex-view.js";
|
|
5
5
|
import P from "../portal/portal.js";
|
|
6
6
|
import { THROTTLE_DURATION as Z, DEFAULT_ARROW_SIZE as q } from "./arrow-tooltip-constants.js";
|
|
7
|
-
import {
|
|
8
|
-
import { computeTooltipNewCoOrdinates as
|
|
9
|
-
import
|
|
10
|
-
const
|
|
7
|
+
import { BackgroundOverlay as G } from "./arrow-tooltip-styled.js";
|
|
8
|
+
import { computeTooltipNewCoOrdinates as J } from "./arrow-tooltip-util.js";
|
|
9
|
+
import K from "./comps/tooltip-body.js";
|
|
10
|
+
const Q = ({
|
|
11
11
|
isAnimated: C,
|
|
12
12
|
alwaysVisible: o = !1,
|
|
13
13
|
arrowColor: O,
|
|
14
14
|
arrowSize: w = q,
|
|
15
|
-
arrowXCoOrdinates:
|
|
16
|
-
arrowYCoOrdinates:
|
|
17
|
-
backgroundColor:
|
|
18
|
-
borderColor:
|
|
19
|
-
children:
|
|
15
|
+
arrowXCoOrdinates: E,
|
|
16
|
+
arrowYCoOrdinates: T,
|
|
17
|
+
backgroundColor: v,
|
|
18
|
+
borderColor: R,
|
|
19
|
+
children: h,
|
|
20
20
|
hidden: t,
|
|
21
21
|
position: l,
|
|
22
22
|
renderAs: A,
|
|
23
23
|
textVariant: L,
|
|
24
24
|
tooltipItem: g,
|
|
25
25
|
tooltipOffset: x,
|
|
26
|
-
tooltipXCoOrdinates:
|
|
27
|
-
tooltipYCoOrdinates:
|
|
28
|
-
width:
|
|
26
|
+
tooltipXCoOrdinates: z,
|
|
27
|
+
tooltipYCoOrdinates: I,
|
|
28
|
+
width: b,
|
|
29
29
|
widthX: k,
|
|
30
30
|
zIndex: B,
|
|
31
31
|
parentWidth: F,
|
|
32
32
|
isBlocking: M = !1
|
|
33
33
|
}) => {
|
|
34
|
-
const
|
|
34
|
+
const u = H(null), [N, d] = f(o), [S, X] = f(
|
|
35
35
|
null
|
|
36
|
-
), s =
|
|
36
|
+
), s = p(
|
|
37
37
|
(n, i) => {
|
|
38
|
-
|
|
38
|
+
X(n), d(i);
|
|
39
39
|
},
|
|
40
40
|
[]
|
|
41
|
-
),
|
|
41
|
+
), _ = p(() => {
|
|
42
42
|
if (t || o)
|
|
43
43
|
return null;
|
|
44
44
|
s(null, !1);
|
|
45
|
-
}, [o, s, t]), r =
|
|
46
|
-
var
|
|
47
|
-
const { current: n } =
|
|
45
|
+
}, [o, s, t]), r = W(() => {
|
|
46
|
+
var a;
|
|
47
|
+
const { current: n } = u;
|
|
48
48
|
if (t || !n) return null;
|
|
49
|
-
const i = (
|
|
50
|
-
return s(
|
|
49
|
+
const i = (a = n.children[0]) == null ? void 0 : a.getBoundingClientRect(), j = i ? J(l, i) : null;
|
|
50
|
+
return s(j, !0), null;
|
|
51
51
|
}, Z);
|
|
52
52
|
m(() => {
|
|
53
53
|
if (!(!o || t))
|
|
@@ -55,46 +55,46 @@ const V = ({
|
|
|
55
55
|
window.removeEventListener("scroll", r, !0), window.removeEventListener("resize", r);
|
|
56
56
|
};
|
|
57
57
|
}, [o, t, l, r]), m(() => {
|
|
58
|
-
t &&
|
|
58
|
+
t && d(!1), o && r();
|
|
59
59
|
}, [o, t]);
|
|
60
60
|
const c = /* @__PURE__ */ e(
|
|
61
|
-
|
|
61
|
+
K,
|
|
62
62
|
{
|
|
63
63
|
$arrowSize: w,
|
|
64
|
-
$arrowXCoOrdinates:
|
|
65
|
-
$arrowYCoOrdinates:
|
|
64
|
+
$arrowXCoOrdinates: E,
|
|
65
|
+
$arrowYCoOrdinates: T,
|
|
66
66
|
$position: l,
|
|
67
67
|
$renderAs: A,
|
|
68
68
|
$tooltipCoOrdinates: S,
|
|
69
69
|
$tooltipOffset: x,
|
|
70
|
-
$tooltipXCoOrdinates:
|
|
71
|
-
$tooltipYCoOrdinates:
|
|
70
|
+
$tooltipXCoOrdinates: z,
|
|
71
|
+
$tooltipYCoOrdinates: I,
|
|
72
72
|
$zIndex: B,
|
|
73
|
-
$backgroundColor:
|
|
73
|
+
$backgroundColor: v,
|
|
74
74
|
$arrowColor: O,
|
|
75
|
-
$borderColor:
|
|
75
|
+
$borderColor: R,
|
|
76
76
|
$isAnimated: C,
|
|
77
|
-
$width:
|
|
77
|
+
$width: b,
|
|
78
78
|
$widthX: k,
|
|
79
79
|
textVariant: L || "body3",
|
|
80
80
|
children: g
|
|
81
81
|
}
|
|
82
82
|
);
|
|
83
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ D(U, { children: [
|
|
84
84
|
/* @__PURE__ */ e(
|
|
85
85
|
$,
|
|
86
86
|
{
|
|
87
87
|
$width: F || "fit-content",
|
|
88
|
-
ref:
|
|
88
|
+
ref: u,
|
|
89
89
|
onMouseEnter: r,
|
|
90
|
-
onMouseLeave:
|
|
91
|
-
children: /* @__PURE__ */ e($, { children:
|
|
90
|
+
onMouseLeave: _,
|
|
91
|
+
children: /* @__PURE__ */ e($, { children: h })
|
|
92
92
|
}
|
|
93
93
|
),
|
|
94
|
-
/* @__PURE__ */ e(P, { portalId: "tooltip-root", children:
|
|
94
|
+
N && /* @__PURE__ */ e(P, { portalId: "tooltip-root", children: M ? /* @__PURE__ */ e(G, { children: c }) : c })
|
|
95
95
|
] });
|
|
96
|
-
},
|
|
96
|
+
}, so = Y(Q);
|
|
97
97
|
export {
|
|
98
|
-
|
|
98
|
+
so as default
|
|
99
99
|
};
|
|
100
100
|
//# sourceMappingURL=arrow-tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arrow-tooltip.js","sources":["../../../../src/features/ui/arrow-tooltip/arrow-tooltip.tsx"],"sourcesContent":["import type {\n IArrowTooltipProps,\n THandleVisibleNCoOrdinatesProps,\n TTooltipCoOrdinatesProps,\n} from './arrow-tooltip-types';\n\nimport throttle from 'lodash.throttle';\nimport { useState, type FC, useCallback, useRef, useEffect, memo } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport Portal from '../portal/portal';\nimport { DEFAULT_ARROW_SIZE, THROTTLE_DURATION } from './arrow-tooltip-constants';\nimport * as Styled from './arrow-tooltip-styled';\nimport { computeTooltipNewCoOrdinates } from './arrow-tooltip-util';\nimport TooltipBody from './comps/tooltip-body';\n\nconst ArrowTooltip: FC<IArrowTooltipProps> = ({\n isAnimated,\n alwaysVisible = false,\n arrowColor,\n arrowSize = DEFAULT_ARROW_SIZE,\n arrowXCoOrdinates,\n arrowYCoOrdinates,\n backgroundColor,\n borderColor,\n children,\n hidden,\n position,\n renderAs,\n textVariant,\n tooltipItem,\n tooltipOffset,\n tooltipXCoOrdinates,\n tooltipYCoOrdinates,\n width,\n widthX,\n zIndex,\n parentWidth,\n isBlocking = false,\n}) => {\n const tooltipWrapperRef = useRef<HTMLDivElement>(null);\n const [visible, setVisible] = useState(alwaysVisible);\n const [tooltipCoOrdinates, setTooltipCoOrdinates] = useState<TTooltipCoOrdinatesProps | null>(\n null,\n );\n\n const handleVisibleNCoOrdinates: THandleVisibleNCoOrdinatesProps = useCallback(\n (newCoOrdinates, visibility) => {\n setTooltipCoOrdinates(newCoOrdinates);\n setVisible(visibility);\n },\n [],\n );\n\n const handleVisibility = useCallback(() => {\n if (hidden || alwaysVisible) {\n return null;\n }\n\n handleVisibleNCoOrdinates(null, false);\n\n return;\n }, [alwaysVisible, handleVisibleNCoOrdinates, hidden]);\n\n const handleOnMouseEnter = throttle(() => {\n const { current } = tooltipWrapperRef;\n\n if (hidden || !current) return null;\n\n const boundingClientRect = current.children[0]?.getBoundingClientRect();\n const newCoOrdinates = boundingClientRect\n ? computeTooltipNewCoOrdinates(position, boundingClientRect)\n : null;\n\n handleVisibleNCoOrdinates(newCoOrdinates, true);\n\n return null;\n }, THROTTLE_DURATION);\n\n useEffect(() => {\n if (!alwaysVisible || hidden) return;\n\n window.addEventListener('scroll', handleOnMouseEnter, true);\n window.addEventListener('resize', handleOnMouseEnter);\n\n return () => {\n window.removeEventListener('scroll', handleOnMouseEnter, true);\n window.removeEventListener('resize', handleOnMouseEnter);\n };\n }, [alwaysVisible, hidden, position, handleOnMouseEnter]);\n\n useEffect(() => {\n if (hidden) {\n setVisible(false);\n }\n\n if (alwaysVisible) {\n handleOnMouseEnter();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [alwaysVisible, hidden]);\n\n const tooltipContent = (\n <TooltipBody\n $arrowSize={arrowSize}\n $arrowXCoOrdinates={arrowXCoOrdinates}\n $arrowYCoOrdinates={arrowYCoOrdinates}\n $position={position}\n $renderAs={renderAs}\n $tooltipCoOrdinates={tooltipCoOrdinates}\n $tooltipOffset={tooltipOffset}\n $tooltipXCoOrdinates={tooltipXCoOrdinates}\n $tooltipYCoOrdinates={tooltipYCoOrdinates}\n $zIndex={zIndex}\n $backgroundColor={backgroundColor}\n $arrowColor={arrowColor}\n $borderColor={borderColor}\n $isAnimated={isAnimated}\n $width={width}\n $widthX={widthX}\n textVariant={textVariant || 'body3'}\n >\n {tooltipItem}\n </TooltipBody>\n );\n\n return (\n <>\n <FlexView\n $width={parentWidth || 'fit-content'}\n ref={tooltipWrapperRef}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleVisibility}\n >\n <FlexView>{children}</FlexView>\n </FlexView>\n\n <Portal portalId=\"tooltip-root\">\n
|
|
1
|
+
{"version":3,"file":"arrow-tooltip.js","sources":["../../../../src/features/ui/arrow-tooltip/arrow-tooltip.tsx"],"sourcesContent":["import type {\n IArrowTooltipProps,\n THandleVisibleNCoOrdinatesProps,\n TTooltipCoOrdinatesProps,\n} from './arrow-tooltip-types';\n\nimport throttle from 'lodash.throttle';\nimport { useState, type FC, useCallback, useRef, useEffect, memo } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport Portal from '../portal/portal';\nimport { DEFAULT_ARROW_SIZE, THROTTLE_DURATION } from './arrow-tooltip-constants';\nimport * as Styled from './arrow-tooltip-styled';\nimport { computeTooltipNewCoOrdinates } from './arrow-tooltip-util';\nimport TooltipBody from './comps/tooltip-body';\n\nconst ArrowTooltip: FC<IArrowTooltipProps> = ({\n isAnimated,\n alwaysVisible = false,\n arrowColor,\n arrowSize = DEFAULT_ARROW_SIZE,\n arrowXCoOrdinates,\n arrowYCoOrdinates,\n backgroundColor,\n borderColor,\n children,\n hidden,\n position,\n renderAs,\n textVariant,\n tooltipItem,\n tooltipOffset,\n tooltipXCoOrdinates,\n tooltipYCoOrdinates,\n width,\n widthX,\n zIndex,\n parentWidth,\n isBlocking = false,\n}) => {\n const tooltipWrapperRef = useRef<HTMLDivElement>(null);\n const [visible, setVisible] = useState(alwaysVisible);\n const [tooltipCoOrdinates, setTooltipCoOrdinates] = useState<TTooltipCoOrdinatesProps | null>(\n null,\n );\n\n const handleVisibleNCoOrdinates: THandleVisibleNCoOrdinatesProps = useCallback(\n (newCoOrdinates, visibility) => {\n setTooltipCoOrdinates(newCoOrdinates);\n setVisible(visibility);\n },\n [],\n );\n\n const handleVisibility = useCallback(() => {\n if (hidden || alwaysVisible) {\n return null;\n }\n\n handleVisibleNCoOrdinates(null, false);\n\n return;\n }, [alwaysVisible, handleVisibleNCoOrdinates, hidden]);\n\n const handleOnMouseEnter = throttle(() => {\n const { current } = tooltipWrapperRef;\n\n if (hidden || !current) return null;\n\n const boundingClientRect = current.children[0]?.getBoundingClientRect();\n const newCoOrdinates = boundingClientRect\n ? computeTooltipNewCoOrdinates(position, boundingClientRect)\n : null;\n\n handleVisibleNCoOrdinates(newCoOrdinates, true);\n\n return null;\n }, THROTTLE_DURATION);\n\n useEffect(() => {\n if (!alwaysVisible || hidden) return;\n\n window.addEventListener('scroll', handleOnMouseEnter, true);\n window.addEventListener('resize', handleOnMouseEnter);\n\n return () => {\n window.removeEventListener('scroll', handleOnMouseEnter, true);\n window.removeEventListener('resize', handleOnMouseEnter);\n };\n }, [alwaysVisible, hidden, position, handleOnMouseEnter]);\n\n useEffect(() => {\n if (hidden) {\n setVisible(false);\n }\n\n if (alwaysVisible) {\n handleOnMouseEnter();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [alwaysVisible, hidden]);\n\n const tooltipContent = (\n <TooltipBody\n $arrowSize={arrowSize}\n $arrowXCoOrdinates={arrowXCoOrdinates}\n $arrowYCoOrdinates={arrowYCoOrdinates}\n $position={position}\n $renderAs={renderAs}\n $tooltipCoOrdinates={tooltipCoOrdinates}\n $tooltipOffset={tooltipOffset}\n $tooltipXCoOrdinates={tooltipXCoOrdinates}\n $tooltipYCoOrdinates={tooltipYCoOrdinates}\n $zIndex={zIndex}\n $backgroundColor={backgroundColor}\n $arrowColor={arrowColor}\n $borderColor={borderColor}\n $isAnimated={isAnimated}\n $width={width}\n $widthX={widthX}\n textVariant={textVariant || 'body3'}\n >\n {tooltipItem}\n </TooltipBody>\n );\n\n return (\n <>\n <FlexView\n $width={parentWidth || 'fit-content'}\n ref={tooltipWrapperRef}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleVisibility}\n >\n <FlexView>{children}</FlexView>\n </FlexView>\n\n {visible && (\n <Portal portalId=\"tooltip-root\">\n {isBlocking ? (\n <Styled.BackgroundOverlay>{tooltipContent}</Styled.BackgroundOverlay>\n ) : (\n tooltipContent\n )}\n </Portal>\n )}\n </>\n );\n};\n\nexport default memo(ArrowTooltip);\n"],"names":["ArrowTooltip","isAnimated","alwaysVisible","arrowColor","arrowSize","DEFAULT_ARROW_SIZE","arrowXCoOrdinates","arrowYCoOrdinates","backgroundColor","borderColor","children","hidden","position","renderAs","textVariant","tooltipItem","tooltipOffset","tooltipXCoOrdinates","tooltipYCoOrdinates","width","widthX","zIndex","parentWidth","isBlocking","tooltipWrapperRef","useRef","visible","setVisible","useState","tooltipCoOrdinates","setTooltipCoOrdinates","handleVisibleNCoOrdinates","useCallback","newCoOrdinates","visibility","handleVisibility","handleOnMouseEnter","throttle","current","boundingClientRect","_a","computeTooltipNewCoOrdinates","THROTTLE_DURATION","useEffect","tooltipContent","jsx","TooltipBody","jsxs","Fragment","FlexView","Portal","Styled.BackgroundOverlay","ArrowTooltip$1","memo"],"mappings":";;;;;;;;;AAgBA,MAAMA,IAAuC,CAAC;AAAA,EAC5C,YAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,YAAAC;AAAA,EACA,WAAAC,IAAYC;AAAA,EACZ,mBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC,IAAa;AACf,MAAM;AACE,QAAAC,IAAoBC,EAAuB,IAAI,GAC/C,CAACC,GAASC,CAAU,IAAIC,EAAS1B,CAAa,GAC9C,CAAC2B,GAAoBC,CAAqB,IAAIF;AAAA,IAClD;AAAA,EAAA,GAGIG,IAA6DC;AAAA,IACjE,CAACC,GAAgBC,MAAe;AAC9B,MAAAJ,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b,cAAcM;AAAA,MACd,aAAaR;AAAA,MACb,QAAQkB;AAAA,MACR,SAASC;AAAA,MACT,aAAaN,KAAe;AAAA,MAE3B,UAAAC;AAAA,IAAA;AAAA,EAAA;AAIL,SAEI,gBAAAgC,EAAAC,GAAA,EAAA,UAAA;AAAA,IAAA,gBAAAH;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,QAAQ3B,KAAe;AAAA,QACvB,KAAKE;AAAA,QACL,cAAcY;AAAA,QACd,cAAcD;AAAA,QAEd,UAAA,gBAAAU,EAACI,KAAU,UAAAvC,EAAS,CAAA;AAAA,MAAA;AAAA,IACtB;AAAA,IAECgB,KACC,gBAAAmB,EAACK,GAAO,EAAA,UAAS,gBACd,UAAA3B,IACE,gBAAAsB,EAAAM,GAAA,EAA0B,UAAeP,EAAA,CAAA,IAE1CA,EAEJ,CAAA;AAAA,EAEJ,EAAA,CAAA;AAEJ,GAEeQ,KAAAC,EAAKrD,CAAY;"}
|
|
@@ -1,93 +1,80 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import { DotLottieWorker as v } from "../../../node_modules/@lottiefiles/dotlottie-web/dist/index.js";
|
|
3
|
-
import { memo as w, forwardRef as x, useRef as p, useImperativeHandle as
|
|
4
|
-
import
|
|
5
|
-
import { Canvas as
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var e;
|
|
27
|
-
(e = t.current) == null || e.pause();
|
|
28
|
-
},
|
|
29
|
-
playSegments: (e) => {
|
|
30
|
-
var r, n;
|
|
31
|
-
(r = t.current) == null || r.setSegment(e[0], e[1]), (n = t.current) == null || n.play();
|
|
32
|
-
},
|
|
33
|
-
setFrame: (e) => {
|
|
34
|
-
var r;
|
|
35
|
-
(r = t.current) == null || r.setFrame(e);
|
|
36
|
-
}
|
|
37
|
-
}),
|
|
38
|
-
[]
|
|
39
|
-
), h(() => {
|
|
40
|
-
if (!m.current) return;
|
|
41
|
-
let e = !1;
|
|
42
|
-
return (() => {
|
|
43
|
-
try {
|
|
44
|
-
t.current = new v({
|
|
45
|
-
src: s,
|
|
46
|
-
data: f,
|
|
47
|
-
canvas: m.current,
|
|
48
|
-
autoplay: !0,
|
|
49
|
-
loop: !1,
|
|
50
|
-
renderConfig: {
|
|
51
|
-
autoResize: !0,
|
|
52
|
-
devicePixelRatio: window.devicePixelRatio,
|
|
53
|
-
freezeOnOffscreen: !0
|
|
54
|
-
},
|
|
55
|
-
...l
|
|
56
|
-
}), requestAnimationFrame(() => {
|
|
57
|
-
e || u == null || u();
|
|
58
|
-
});
|
|
59
|
-
} catch (n) {
|
|
60
|
-
console.log(n), c == null || c();
|
|
61
|
-
}
|
|
62
|
-
})(), () => {
|
|
63
|
-
e = !0, t.current && (t.current.destroy(), t.current = null);
|
|
64
|
-
};
|
|
65
|
-
}, [s, l, u, c, f]), h(() => (o == null || o.forEach(
|
|
66
|
-
({ name: e, callback: r }) => {
|
|
67
|
-
var n;
|
|
68
|
-
return (n = t.current) == null ? void 0 : n.addEventListener(e, r);
|
|
69
|
-
}
|
|
70
|
-
), () => {
|
|
71
|
-
o == null || o.forEach(
|
|
72
|
-
({ name: e, callback: r }) => {
|
|
73
|
-
var n;
|
|
74
|
-
return (n = t.current) == null ? void 0 : n.removeEventListener(e, r);
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
}), [o]), /* @__PURE__ */ d(R, { $width: i, $height: a, children: /* @__PURE__ */ d(
|
|
78
|
-
$,
|
|
79
|
-
{
|
|
80
|
-
ref: m,
|
|
81
|
-
$renderWidth: i,
|
|
82
|
-
$renderHeight: a,
|
|
83
|
-
width: typeof i == "number" ? i : void 0,
|
|
84
|
-
height: typeof a == "number" ? a : void 0
|
|
3
|
+
import { memo as w, forwardRef as x, useRef as p, useImperativeHandle as R, useEffect as h } from "react";
|
|
4
|
+
import E from "../layout/flex-view.js";
|
|
5
|
+
import { Canvas as H } from "./dot-lottie-animation-styled.js";
|
|
6
|
+
const N = x((y, g) => {
|
|
7
|
+
const {
|
|
8
|
+
src: m,
|
|
9
|
+
width: i = "100%",
|
|
10
|
+
height: a = "100%",
|
|
11
|
+
settings: f,
|
|
12
|
+
eventListeners: r,
|
|
13
|
+
onRender: u,
|
|
14
|
+
onError: c
|
|
15
|
+
} = y, s = p(null), t = p(null);
|
|
16
|
+
return R(
|
|
17
|
+
g,
|
|
18
|
+
() => ({
|
|
19
|
+
playSegments: (e) => {
|
|
20
|
+
var n, o;
|
|
21
|
+
(n = t.current) == null || n.setSegment(e[0], e[1]), (o = t.current) == null || o.play();
|
|
22
|
+
},
|
|
23
|
+
play: () => {
|
|
24
|
+
var e;
|
|
25
|
+
(e = t.current) == null || e.play();
|
|
85
26
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
27
|
+
pause: () => {
|
|
28
|
+
var e;
|
|
29
|
+
(e = t.current) == null || e.pause();
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
[]
|
|
33
|
+
), h(() => {
|
|
34
|
+
if (s.current)
|
|
35
|
+
try {
|
|
36
|
+
t.current = new v({
|
|
37
|
+
src: m,
|
|
38
|
+
canvas: s.current,
|
|
39
|
+
autoplay: !0,
|
|
40
|
+
loop: !1,
|
|
41
|
+
renderConfig: {
|
|
42
|
+
autoResize: !0,
|
|
43
|
+
devicePixelRatio: window.devicePixelRatio,
|
|
44
|
+
freezeOnOffscreen: !0
|
|
45
|
+
},
|
|
46
|
+
...f
|
|
47
|
+
}), requestAnimationFrame(() => {
|
|
48
|
+
u == null || u();
|
|
49
|
+
});
|
|
50
|
+
} catch (e) {
|
|
51
|
+
console.log(e), c == null || c();
|
|
52
|
+
}
|
|
53
|
+
}, [m, f, u, c]), h(() => (r == null || r.forEach(
|
|
54
|
+
({ name: e, callback: n }) => {
|
|
55
|
+
var o;
|
|
56
|
+
return (o = t.current) == null ? void 0 : o.addEventListener(e, n);
|
|
57
|
+
}
|
|
58
|
+
), () => {
|
|
59
|
+
var e;
|
|
60
|
+
r == null || r.forEach(
|
|
61
|
+
({ name: n, callback: o }) => {
|
|
62
|
+
var d;
|
|
63
|
+
return (d = t.current) == null ? void 0 : d.removeEventListener(n, o);
|
|
64
|
+
}
|
|
65
|
+
), (e = t.current) == null || e.destroy();
|
|
66
|
+
}), [r]), /* @__PURE__ */ l(E, { $width: i, $height: a, children: /* @__PURE__ */ l(
|
|
67
|
+
H,
|
|
68
|
+
{
|
|
69
|
+
ref: s,
|
|
70
|
+
$renderWidth: i,
|
|
71
|
+
$renderHeight: a,
|
|
72
|
+
width: typeof i == "number" ? i : void 0,
|
|
73
|
+
height: typeof a == "number" ? a : void 0
|
|
74
|
+
}
|
|
75
|
+
) });
|
|
76
|
+
}), F = w(N);
|
|
90
77
|
export {
|
|
91
|
-
|
|
78
|
+
F as default
|
|
92
79
|
};
|
|
93
80
|
//# sourceMappingURL=dot-lottie-animation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dot-lottie-animation.js","sources":["../../../../src/features/ui/dot-lottie-animations/dot-lottie-animation.tsx"],"sourcesContent":["import type {\n AnimationSegment,\n
|
|
1
|
+
{"version":3,"file":"dot-lottie-animation.js","sources":["../../../../src/features/ui/dot-lottie-animations/dot-lottie-animation.tsx"],"sourcesContent":["import type {\n AnimationSegment,\n ILottieAnimationProps,\n ILottieAnimationRef,\n} from './dot-lottie-types';\n\nimport { DotLottieWorker } from '@lottiefiles/dotlottie-web';\nimport { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport * as Styled from './dot-lottie-animation-styled';\n\nconst DotLottieAnimation = forwardRef<ILottieAnimationRef, ILottieAnimationProps>((props, ref) => {\n const {\n src,\n width = '100%',\n height = '100%',\n settings,\n eventListeners,\n onRender,\n onError,\n } = props;\n\n const canvasRef = useRef<HTMLCanvasElement>(null);\n const animationInstance = useRef<DotLottieWorker | null>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n playSegments: (segments: AnimationSegment) => {\n animationInstance.current?.setSegment(segments[0], segments[1]);\n animationInstance.current?.play();\n },\n play: () => {\n animationInstance.current?.play();\n },\n pause: () => {\n animationInstance.current?.pause();\n },\n }),\n [],\n );\n\n useEffect(() => {\n if (!canvasRef.current) return;\n\n try {\n animationInstance.current = new DotLottieWorker({\n src,\n canvas: canvasRef.current,\n autoplay: true,\n loop: false,\n renderConfig: {\n autoResize: true,\n devicePixelRatio: window.devicePixelRatio,\n freezeOnOffscreen: true,\n },\n ...settings,\n });\n\n requestAnimationFrame(() => {\n onRender?.();\n });\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log(err);\n onError?.();\n }\n }, [src, settings, onRender, onError]);\n\n useEffect(() => {\n eventListeners?.forEach(\n ({ name, callback }) => animationInstance.current?.addEventListener(name, callback),\n );\n\n return () => {\n eventListeners?.forEach(\n ({ name, callback }) => animationInstance.current?.removeEventListener(name, callback),\n );\n animationInstance.current?.destroy();\n };\n }, [eventListeners]);\n\n const isNumW = typeof width === 'number';\n const isNumH = typeof height === 'number';\n\n return (\n <FlexView $width={width} $height={height}>\n <Styled.Canvas\n ref={canvasRef}\n $renderWidth={width}\n $renderHeight={height}\n width={isNumW ? width : undefined}\n height={isNumH ? height : undefined}\n />\n </FlexView>\n );\n});\n\nexport default memo(DotLottieAnimation);\n"],"names":["DotLottieAnimation","forwardRef","props","ref","src","width","height","settings","eventListeners","onRender","onError","canvasRef","useRef","animationInstance","useImperativeHandle","segments","_a","_b","useEffect","DotLottieWorker","err","name","callback","jsx","FlexView","Styled.Canvas","dotLottieAnimation","memo"],"mappings":";;;;;AAYA,MAAMA,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AAA,IACd,CAAC,EAAE,MAAAa,GAAM,UAAAC,QAAe;;AAAA,cAAAN,IAAAH,EAAkB,YAAlB,gBAAAG,EAA2B,iBAAiBK,GAAMC;AAAA;AAAA,KAGrE,MAAM;;AACK,IAAAd,KAAA,QAAAA,EAAA;AAAA,MACd,CAAC,EAAE,MAAAa,GAAM,UAAAC,QAAe;;AAAA,gBAAAN,IAAAH,EAAkB,YAAlB,gBAAAG,EAA2B,oBAAoBK,GAAMC;AAAA;AAAA,QAE/EN,IAAAH,EAAkB,YAAlB,QAAAG,EAA2B;AAAA,EAAQ,IAEpC,CAACR,CAAc,CAAC,GAMhB,gBAAAe,EAAAC,GAAA,EAAS,QAAQnB,GAAO,SAASC,GAChC,UAAA,gBAAAiB;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,KAAKd;AAAA,MACL,cAAcN;AAAA,MACd,eAAeC;AAAA,MACf,OATS,OAAOD,KAAU,WASVA,IAAQ;AAAA,MACxB,QATS,OAAOC,KAAW,WASVA,IAAS;AAAA,IAAA;AAAA,EAE9B,EAAA,CAAA;AAEJ,CAAC,GAEcoB,IAAAC,EAAK3B,CAAkB;"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { memo as w, forwardRef as
|
|
1
|
+
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
+
import g from "lottie-web";
|
|
3
|
+
import { memo as w, forwardRef as A, useRef as u, useImperativeHandle as b, useEffect as I } from "react";
|
|
4
4
|
import $ from "../layout/flex-view.js";
|
|
5
5
|
import { fetchLottie as x } from "./helper.js";
|
|
6
|
-
const O =
|
|
6
|
+
const O = A((v, L) => {
|
|
7
7
|
const {
|
|
8
|
-
src:
|
|
9
|
-
width:
|
|
8
|
+
src: m,
|
|
9
|
+
width: h = "100%",
|
|
10
10
|
height: y = "100%",
|
|
11
|
-
settings:
|
|
12
|
-
eventListener:
|
|
11
|
+
settings: l,
|
|
12
|
+
eventListener: n,
|
|
13
13
|
onRender: i,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
h,
|
|
14
|
+
animateOnIntersect: c
|
|
15
|
+
} = v, a = u(null), r = u(null), s = u(null);
|
|
16
|
+
return b(
|
|
17
|
+
L,
|
|
19
18
|
() => ({
|
|
20
|
-
playSegments: (e,
|
|
19
|
+
playSegments: (e, o) => {
|
|
21
20
|
var t;
|
|
22
|
-
return (t = r.current) == null ? void 0 : t.playSegments(e,
|
|
21
|
+
return (t = r.current) == null ? void 0 : t.playSegments(e, o);
|
|
23
22
|
},
|
|
24
|
-
addEventListener: (e,
|
|
23
|
+
addEventListener: (e, o) => {
|
|
25
24
|
var t;
|
|
26
|
-
return (t = r.current) == null ? void 0 : t.addEventListener(e,
|
|
25
|
+
return (t = r.current) == null ? void 0 : t.addEventListener(e, o);
|
|
27
26
|
},
|
|
28
|
-
removeEventListener: (e,
|
|
27
|
+
removeEventListener: (e, o) => {
|
|
29
28
|
var t;
|
|
30
|
-
return (t = r.current) == null ? void 0 : t.removeEventListener(e,
|
|
29
|
+
return (t = r.current) == null ? void 0 : t.removeEventListener(e, o);
|
|
31
30
|
},
|
|
32
31
|
play: () => {
|
|
33
32
|
var e;
|
|
@@ -39,41 +38,37 @@ const O = b((L, h) => {
|
|
|
39
38
|
},
|
|
40
39
|
setLoop: (e) => {
|
|
41
40
|
r.current && (r.current.loop = e);
|
|
42
|
-
},
|
|
43
|
-
goToAndStop: (e, n) => {
|
|
44
|
-
var t;
|
|
45
|
-
return (t = r.current) == null ? void 0 : t.goToAndStop(e, n);
|
|
46
41
|
}
|
|
47
42
|
}),
|
|
48
43
|
[]
|
|
49
|
-
),
|
|
44
|
+
), I(() => {
|
|
50
45
|
let e = !1;
|
|
51
46
|
return (async () => {
|
|
52
47
|
try {
|
|
53
|
-
const t = await x(
|
|
48
|
+
const t = await x(m);
|
|
54
49
|
requestAnimationFrame(() => {
|
|
55
|
-
!
|
|
56
|
-
container:
|
|
50
|
+
!a.current || e || (r.current = g.loadAnimation({
|
|
51
|
+
container: a.current,
|
|
57
52
|
animationData: t,
|
|
58
53
|
loop: !0,
|
|
59
54
|
autoplay: !0,
|
|
60
|
-
...
|
|
61
|
-
}),
|
|
62
|
-
([
|
|
63
|
-
var
|
|
64
|
-
|
|
55
|
+
...l
|
|
56
|
+
}), c && (s.current = new IntersectionObserver(
|
|
57
|
+
([f]) => {
|
|
58
|
+
var d, p;
|
|
59
|
+
f && f.isIntersecting ? (d = r.current) == null || d.play() : (p = r.current) == null || p.pause();
|
|
65
60
|
},
|
|
66
61
|
{ threshold: 0 }
|
|
67
|
-
),
|
|
62
|
+
), s.current.observe(a.current)), i == null || i(), n && r.current.addEventListener(n.name, n.callback));
|
|
68
63
|
});
|
|
69
64
|
} catch (t) {
|
|
70
|
-
throw
|
|
65
|
+
throw Error(`Error loading Lottie animation: ${t}`);
|
|
71
66
|
}
|
|
72
67
|
})(), () => {
|
|
73
68
|
var t;
|
|
74
|
-
e = !0, r.current && (
|
|
69
|
+
e = !0, r.current && (n && r.current.removeEventListener(n.name, n.callback), c && ((t = s.current) == null || t.disconnect()), r.current.destroy());
|
|
75
70
|
};
|
|
76
|
-
}, [
|
|
71
|
+
}, [m, n, i, c, l]), /* @__PURE__ */ E($, { ref: a, $width: h, $height: y });
|
|
77
72
|
}), D = w(O);
|
|
78
73
|
export {
|
|
79
74
|
D as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lottie-animation.js","sources":["../../../../src/features/ui/lottie-animation/lottie-animation.tsx"],"sourcesContent":["import type { ILottieAnimationProps, ILottieAnimationRef } from './types';\nimport type { AnimationEventName, AnimationItem, AnimationSegment } from 'lottie-web';\n\nimport lottie from 'lottie-web';\nimport { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport { fetchLottie } from './helper';\n\nconst LottieAnimation = forwardRef<ILottieAnimationRef, ILottieAnimationProps>((props, ref) => {\n const {\n src,\n width = '100%',\n height = '100%',\n settings,\n eventListener,\n onRender,\n
|
|
1
|
+
{"version":3,"file":"lottie-animation.js","sources":["../../../../src/features/ui/lottie-animation/lottie-animation.tsx"],"sourcesContent":["import type { ILottieAnimationProps, ILottieAnimationRef } from './types';\nimport type { AnimationEventName, AnimationItem, AnimationSegment } from 'lottie-web';\n\nimport lottie from 'lottie-web';\nimport { forwardRef, memo, useEffect, useImperativeHandle, useRef } from 'react';\n\nimport FlexView from '../layout/flex-view';\nimport { fetchLottie } from './helper';\n\nconst LottieAnimation = forwardRef<ILottieAnimationRef, ILottieAnimationProps>((props, ref) => {\n const {\n src,\n width = '100%',\n height = '100%',\n settings,\n eventListener,\n onRender,\n animateOnIntersect,\n } = props;\n\n const container = useRef<HTMLDivElement>(null);\n const animationInstance = useRef<AnimationItem | null>(null);\n const intersectionObserver = useRef<IntersectionObserver | null>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n playSegments: (segments: AnimationSegment, forceFlag?: boolean) =>\n animationInstance.current?.playSegments(segments, forceFlag),\n addEventListener: (eventName: string, callback: () => void) =>\n animationInstance.current?.addEventListener(eventName as AnimationEventName, callback),\n removeEventListener: (eventName: string, callback: () => void) =>\n animationInstance.current?.removeEventListener(eventName as AnimationEventName, callback),\n play: () => animationInstance.current?.play(),\n stop: () => animationInstance.current?.stop(),\n setLoop: (loop: boolean) => {\n if (animationInstance.current) {\n animationInstance.current.loop = loop;\n }\n },\n }),\n [],\n );\n\n useEffect(() => {\n let destroyed = false;\n\n const loadAnimation = async () => {\n try {\n const animationData = await fetchLottie(src);\n\n // Wait for layout\n // NOTE: Do not remove this as this is needed to fix canvas rendering on first layout.\n requestAnimationFrame(() => {\n if (!container.current || destroyed) return;\n\n animationInstance.current = lottie.loadAnimation({\n container: container.current,\n animationData,\n loop: true,\n autoplay: true,\n ...settings,\n });\n\n if (animateOnIntersect) {\n intersectionObserver.current = new IntersectionObserver(\n ([entry]) => {\n if (entry && entry.isIntersecting) {\n animationInstance.current?.play();\n } else {\n animationInstance.current?.pause();\n }\n },\n { threshold: 0 },\n );\n\n intersectionObserver.current.observe(container.current);\n }\n\n onRender?.();\n if (eventListener) {\n animationInstance.current.addEventListener(eventListener.name, eventListener.callback);\n }\n });\n } catch (error) {\n throw Error(`Error loading Lottie animation: ${error}`);\n }\n };\n\n loadAnimation();\n\n return () => {\n destroyed = true;\n if (animationInstance.current) {\n if (eventListener) {\n animationInstance.current.removeEventListener(eventListener.name, eventListener.callback);\n }\n\n if (animateOnIntersect) {\n intersectionObserver.current?.disconnect();\n }\n animationInstance.current.destroy();\n }\n };\n }, [src, eventListener, onRender, animateOnIntersect, settings]);\n\n return <FlexView ref={container} $width={width} $height={height} />;\n});\n\nexport default memo(LottieAnimation);\n"],"names":["LottieAnimation","forwardRef","props","ref","src","width","height","settings","eventListener","onRender","animateOnIntersect","container","useRef","animationInstance","intersectionObserver","useImperativeHandle","segments","forceFlag","_a","eventName","callback","loop","useEffect","destroyed","animationData","fetchLottie","lottie","entry","_b","error","FlexView","LottieAnimation$1","memo"],"mappings":";;;;;AASA,MAAMA,IAAkBC,EAAuD,CAACC,GAAOC,MAAQ;AACvF,QAAA;AAAA,IACJ,KAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,QAAAC,IAAS;AAAA,IACT,UAAAC;AAAA,IACA,eAAAC;AAAA,IACA,UAAAC;AAAA,IACA,oBAAAC;AAAA,EACE,IAAAR,GAEES,IAAYC,EAAuB,IAAI,GACvCC,IAAoBD,EAA6B,IAAI,GACrDE,IAAuBF,EAAoC,IAAI;AAErE,SAAAG;AAAA,IACEZ;AAAA,IACA,OAAO;AAAA,MACL,cAAc,CAACa,GAA4BC,MACzC;;AAAA,gBAAAC,IAAAL,EAAkB,YAAlB,gBAAAK,EAA2B,aAAaF,GAAUC;AAAA;AAAA,MACpD,kBAAkB,CAACE,GAAmBC,MACpC;;AAAA,gBAAAF,IAAAL,EAAkB,YAAlB,gBAAAK,EAA2B,iBAAi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