@cuemath/leap 3.0.25-j → 3.0.25-j1
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.
@@ -1,31 +1,31 @@
|
|
1
|
-
import { jsx as e, jsxs as d, Fragment as
|
2
|
-
import { memo as
|
3
|
-
import
|
4
|
-
import
|
5
|
-
import
|
6
|
-
import
|
1
|
+
import { jsx as e, jsxs as d, Fragment as X } from "react/jsx-runtime";
|
2
|
+
import { memo as j, useRef as G, useCallback as m } from "react";
|
3
|
+
import z from "../../../../../assets/line-icons/icons/eye2.js";
|
4
|
+
import F from "../../../../../assets/line-icons/icons/redo.js";
|
5
|
+
import P from "../../../../ui/arrow-tooltip/arrow-tooltip.js";
|
6
|
+
import U from "../../../../ui/context-menu/context-menu.js";
|
7
7
|
import Y from "../../../../ui/lottie-animation/lottie-animation.js";
|
8
8
|
import Z from "../../../../ui/text/text.js";
|
9
9
|
import { BLOCK_TYPE as q } from "../../../constants/block-constants.js";
|
10
10
|
import { NODE_CARD_STATES as J } from "../../../constants/node-constants.js";
|
11
11
|
import { getNodeTypeBasedBgImage as Q } from "../../../utils/index.js";
|
12
|
-
import { getNodeCardBasedIcon as
|
13
|
-
import { NodeCardContainer as
|
14
|
-
import
|
15
|
-
import
|
16
|
-
const
|
12
|
+
import { getNodeCardBasedIcon as V } from "../../../utils/node-card-utils.js";
|
13
|
+
import { NodeCardContainer as ee, NodeCardInfoWrapper as te, IconWrapper as re, StyledImportantIcon as ne, NodeCardContentWrapper as oe, NodeCardTitle as ae } from "../node-card-styled.js";
|
14
|
+
import ie from "../node-card-tags.js";
|
15
|
+
import ce from "../node-menu-options/node-menu-options.js";
|
16
|
+
const se = { renderer: "canvas", autoplay: !1 }, ye = j((O) => {
|
17
17
|
const {
|
18
18
|
nodeData: t,
|
19
19
|
imageHue: b,
|
20
|
-
blockType:
|
20
|
+
blockType: S,
|
21
21
|
onNodeAttempt: a,
|
22
22
|
onNodeReattempt: i,
|
23
23
|
onNodeReview: c,
|
24
24
|
onNodeView: r,
|
25
|
-
isStudent:
|
25
|
+
isStudent: y
|
26
26
|
} = O, {
|
27
|
-
accuracy:
|
28
|
-
attempt_location:
|
27
|
+
accuracy: A,
|
28
|
+
attempt_location: L,
|
29
29
|
node_type: l,
|
30
30
|
card_header: E,
|
31
31
|
title: T,
|
@@ -39,8 +39,9 @@ const ce = { renderer: "canvas", autoplay: !1 }, ye = X((O) => {
|
|
39
39
|
can_review: s,
|
40
40
|
can_start: p,
|
41
41
|
can_resume: u,
|
42
|
-
can_reset:
|
43
|
-
|
42
|
+
can_reset: k,
|
43
|
+
can_un_skip: v
|
44
|
+
} = R, w = S === q.GOAL, o = C === J.LOCKED, B = L === "INCLASS", f = !(p || u) && (k || s), h = G(null), M = Q(l), { lottie: W } = V(l), I = m(
|
44
45
|
(n) => {
|
45
46
|
switch (n) {
|
46
47
|
case "node-card-review":
|
@@ -54,7 +55,7 @@ const ce = { renderer: "canvas", autoplay: !1 }, ye = X((O) => {
|
|
54
55
|
}
|
55
56
|
},
|
56
57
|
[s, t, i, c, r, _]
|
57
|
-
),
|
58
|
+
), N = m(() => {
|
58
59
|
f || o || (p || u ? a == null || a(t) : g && (r == null || r(t)));
|
59
60
|
}, [
|
60
61
|
u,
|
@@ -65,39 +66,39 @@ const ce = { renderer: "canvas", autoplay: !1 }, ye = X((O) => {
|
|
65
66
|
f,
|
66
67
|
o,
|
67
68
|
g
|
68
|
-
]),
|
69
|
+
]), D = m(() => {
|
69
70
|
var n;
|
70
71
|
o || (n = h.current) == null || n.play();
|
71
|
-
}, [o]),
|
72
|
+
}, [o]), H = m(() => {
|
72
73
|
var n;
|
73
74
|
(n = h.current) == null || n.stop();
|
74
|
-
}, []),
|
75
|
+
}, []), K = [
|
75
76
|
{
|
76
77
|
id: "node-card-review",
|
77
78
|
label: "Review",
|
78
|
-
icon:
|
79
|
+
icon: z,
|
79
80
|
disabled: !s,
|
80
|
-
onClick:
|
81
|
+
onClick: I
|
81
82
|
},
|
82
83
|
{
|
83
84
|
id: "node-card-reattempt",
|
84
85
|
label: "Reattempt",
|
85
|
-
icon:
|
86
|
-
disabled: !
|
87
|
-
onClick:
|
86
|
+
icon: F,
|
87
|
+
disabled: !k,
|
88
|
+
onClick: I
|
88
89
|
}
|
89
90
|
];
|
90
|
-
return /* @__PURE__ */ e(
|
91
|
-
|
91
|
+
return v ? null : /* @__PURE__ */ e(
|
92
|
+
U,
|
92
93
|
{
|
93
94
|
targetElement: /* @__PURE__ */ e(
|
94
|
-
|
95
|
+
ee,
|
95
96
|
{
|
96
97
|
$background: `${b}_2`,
|
97
98
|
$disabled: o,
|
98
|
-
onClick:
|
99
|
+
onClick: N,
|
99
100
|
children: /* @__PURE__ */ d(
|
100
|
-
|
101
|
+
P,
|
101
102
|
{
|
102
103
|
renderAs: "primary",
|
103
104
|
tooltipItem: $,
|
@@ -108,20 +109,20 @@ const ce = { renderer: "canvas", autoplay: !1 }, ye = X((O) => {
|
|
108
109
|
widthX: 11.25,
|
109
110
|
children: [
|
110
111
|
/* @__PURE__ */ d(
|
111
|
-
|
112
|
+
te,
|
112
113
|
{
|
113
114
|
$flexDirection: "row",
|
114
115
|
$alignItems: "center",
|
115
116
|
$heightX: 3.5,
|
116
|
-
$bgImage:
|
117
|
+
$bgImage: M,
|
117
118
|
$gutterX: 0.78125,
|
118
119
|
$flexGap: 8.5,
|
119
120
|
$opacity: o ? 0.5 : 1,
|
120
|
-
onMouseEnter:
|
121
|
-
onMouseLeave:
|
121
|
+
onMouseEnter: D,
|
122
|
+
onMouseLeave: H,
|
122
123
|
children: [
|
123
124
|
/* @__PURE__ */ d(
|
124
|
-
|
125
|
+
re,
|
125
126
|
{
|
126
127
|
$width: 31,
|
127
128
|
$height: 31,
|
@@ -133,34 +134,34 @@ const ce = { renderer: "canvas", autoplay: !1 }, ye = X((O) => {
|
|
133
134
|
/* @__PURE__ */ e(
|
134
135
|
Y,
|
135
136
|
{
|
136
|
-
src:
|
137
|
+
src: W,
|
137
138
|
ref: h,
|
138
|
-
settings:
|
139
|
+
settings: se
|
139
140
|
}
|
140
141
|
),
|
141
|
-
!x && /* @__PURE__ */ e(
|
142
|
+
!x && /* @__PURE__ */ e(ne, {})
|
142
143
|
]
|
143
144
|
}
|
144
145
|
),
|
145
146
|
/* @__PURE__ */ d(Z, { $renderAs: "ac4-black", $color: "BLACK", children: [
|
146
147
|
E,
|
147
148
|
" ",
|
148
|
-
|
149
|
+
B && "• CW"
|
149
150
|
] })
|
150
151
|
]
|
151
152
|
}
|
152
153
|
),
|
153
154
|
/* @__PURE__ */ e(
|
154
|
-
|
155
|
+
ie,
|
155
156
|
{
|
156
157
|
nodeType: l,
|
157
158
|
state: C,
|
158
|
-
accuracy:
|
159
|
-
isStudent:
|
159
|
+
accuracy: A,
|
160
|
+
isStudent: y
|
160
161
|
}
|
161
162
|
),
|
162
|
-
!
|
163
|
-
|
163
|
+
!w && /* @__PURE__ */ e(oe, { $background: "WHITE_1", $heightX: 4, children: /* @__PURE__ */ e(
|
164
|
+
ae,
|
164
165
|
{
|
165
166
|
$renderAs: "ab3",
|
166
167
|
$color: "BLACK_1",
|
@@ -177,7 +178,7 @@ const ce = { renderer: "canvas", autoplay: !1 }, ye = X((O) => {
|
|
177
178
|
menuWidth: "100%",
|
178
179
|
menuZIndex: 6,
|
179
180
|
menuOffset: 2,
|
180
|
-
menuElement: f ? /* @__PURE__ */ e(
|
181
|
+
menuElement: f ? /* @__PURE__ */ e(ce, { options: K }) : /* @__PURE__ */ e(X, {})
|
181
182
|
}
|
182
183
|
);
|
183
184
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"student-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport type { INodeCardProps } from '../node-card-types';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\n\nimport { memo, useCallback, useRef, type FC } from 'react';\n\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport RedoIcon from '../../../../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport ContextMenu from '../../../../ui/context-menu/context-menu';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\n\nconst renderSettings = { renderer: 'canvas', autoplay: false };\n\nconst StudentActions: FC<Omit<INodeCardProps, 'userType'>> = memo(props => {\n const {\n nodeData,\n imageHue,\n blockType,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n isStudent,\n } = props;\n const {\n accuracy,\n attempt_location: attemptLocation,\n node_type: nodeType,\n card_header: cardHeader,\n title,\n state,\n is_optional: isOptional,\n sheet_statement: sheetStatement,\n permissions,\n marked_as_completed: teacherMarkedAsCompleted,\n user_attempt_id: userAttemptId,\n } = nodeData;\n const {\n can_review: canReview,\n can_start: canStart,\n can_resume: canResume,\n can_reset: canReset,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const inClassSheet = attemptLocation === 'INCLASS';\n const canStartOrResume = canStart || canResume;\n\n const renderOptions = !canStartOrResume && (canReset || canReview);\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const { lottie: nodeCardLottie } = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-review':\n if (canReview && userAttemptId) {\n onNodeReview?.(nodeData);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-reattempt':\n onNodeReattempt?.(nodeData);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [canReview, nodeData, onNodeReattempt, onNodeReview, onNodeView, userAttemptId],\n );\n\n const handleOnNodeCardClick = useCallback(() => {\n if (renderOptions || sheetLocked) return;\n\n if (canStart || canResume) {\n onNodeAttempt?.(nodeData);\n } else if (teacherMarkedAsCompleted) {\n onNodeView?.(nodeData);\n }\n }, [\n canResume,\n canStart,\n nodeData,\n onNodeAttempt,\n onNodeView,\n renderOptions,\n sheetLocked,\n teacherMarkedAsCompleted,\n ]);\n\n const handleOnMouseEnter = useCallback(() => {\n if (sheetLocked) return;\n animationRef.current?.play();\n }, [sheetLocked]);\n\n const handleOnMouseLeave = useCallback(() => {\n animationRef.current?.stop();\n }, []);\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-review',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n return (\n <ContextMenu\n targetElement={\n <Styled.NodeCardContainer\n $background={`${imageHue}_2`}\n $disabled={sheetLocked}\n onClick={handleOnNodeCardClick}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={!sheetStatement}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n $opacity={sheetLocked ? 0.5 : 1}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n <LottieAnimation\n src={nodeCardLottie}\n ref={animationRef}\n settings={renderSettings}\n />\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\">\n {cardHeader} {inClassSheet && `• CW`}\n </Text>\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags\n nodeType={nodeType}\n state={state}\n accuracy={accuracy}\n isStudent={isStudent}\n />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper $background=\"WHITE_1\" $heightX={4}>\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n </Styled.NodeCardContainer>\n }\n startLeft\n menuWidth=\"100%\"\n menuZIndex={6}\n menuOffset={2}\n menuElement={renderOptions ? <NodeMenuOptions options={menuOptions} /> : <></>}\n />\n );\n});\n\nexport default StudentActions;\n"],"names":["renderSettings","StudentActions","memo","props","nodeData","imageHue","blockType","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeView","isStudent","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","teacherMarkedAsCompleted","userAttemptId","canReview","canStart","canResume","canReset","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","inClassSheet","renderOptions","animationRef","useRef","nodeBgImage","getNodeTypeBasedBgImage","nodeCardLottie","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","handleOnNodeCardClick","handleOnMouseEnter","_a","handleOnMouseLeave","menuOptions","Eye2Icon","RedoIcon","jsx","ContextMenu","Styled.NodeCardContainer","jsxs","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","LottieAnimation","Styled.StyledImportantIcon","Text","NodeCardTags","Styled.N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QAAA;AAAA,MACF;AAAA,MAEF,WAAS;AAAA,MACT,WAAU;AAAA,MACV,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAagB,IAAgB,gBAAAiB,EAACa,MAAgB,SAAShB,EAAA,CAAa,IAAO,gBAAAG,EAAAc,GAAA,EAAA;AAAA,IAAA;AAAA,EAAA;AAGjF,CAAC;"}
|
1
|
+
{"version":3,"file":"student-actions.js","sources":["../../../../../../src/features/chapters-v2/comps/node-card/student-actions/student-actions.tsx"],"sourcesContent":["import type { ILottieAnimationRef } from '../../../../ui/lottie-animation/types';\nimport type { INodeCardProps } from '../node-card-types';\nimport type { INodeMenuOption } from '../node-menu-options/node-menu-options-types';\n\nimport { memo, useCallback, useRef, type FC } from 'react';\n\nimport Eye2Icon from '../../../../../assets/line-icons/icons/eye2';\nimport RedoIcon from '../../../../../assets/line-icons/icons/redo';\nimport ArrowTooltip from '../../../../ui/arrow-tooltip/arrow-tooltip';\nimport ContextMenu from '../../../../ui/context-menu/context-menu';\nimport LottieAnimation from '../../../../ui/lottie-animation/lottie-animation';\nimport Text from '../../../../ui/text/text';\nimport { BLOCK_TYPE } from '../../../constants/block-constants';\nimport { NODE_CARD_STATES } from '../../../constants/node-constants';\nimport { getNodeTypeBasedBgImage } from '../../../utils';\nimport { getNodeCardBasedIcon } from '../../../utils/node-card-utils';\nimport * as Styled from '../node-card-styled';\nimport NodeCardTags from '../node-card-tags';\nimport NodeMenuOptions from '../node-menu-options/node-menu-options';\n\nconst renderSettings = { renderer: 'canvas', autoplay: false };\n\nconst StudentActions: FC<Omit<INodeCardProps, 'userType'>> = memo(props => {\n const {\n nodeData,\n imageHue,\n blockType,\n onNodeAttempt,\n onNodeReattempt,\n onNodeReview,\n onNodeView,\n isStudent,\n } = props;\n const {\n accuracy,\n attempt_location: attemptLocation,\n node_type: nodeType,\n card_header: cardHeader,\n title,\n state,\n is_optional: isOptional,\n sheet_statement: sheetStatement,\n permissions,\n marked_as_completed: teacherMarkedAsCompleted,\n user_attempt_id: userAttemptId,\n } = nodeData;\n const {\n can_review: canReview,\n can_start: canStart,\n can_resume: canResume,\n can_reset: canReset,\n can_un_skip: canUnSkip,\n } = permissions;\n\n const isGoalBlock = blockType === BLOCK_TYPE.GOAL;\n const sheetLocked = state === NODE_CARD_STATES.LOCKED;\n const inClassSheet = attemptLocation === 'INCLASS';\n const canStartOrResume = canStart || canResume;\n\n const renderOptions = !canStartOrResume && (canReset || canReview);\n const animationRef = useRef<ILottieAnimationRef | null>(null);\n const nodeBgImage = getNodeTypeBasedBgImage(nodeType);\n const { lottie: nodeCardLottie } = getNodeCardBasedIcon(nodeType);\n\n const handleOnMenuOptionClick = useCallback(\n (optionId: string) => {\n switch (optionId) {\n case 'node-card-review':\n if (canReview && userAttemptId) {\n onNodeReview?.(nodeData);\n } else {\n onNodeView?.(nodeData);\n }\n\n return;\n\n case 'node-card-reattempt':\n onNodeReattempt?.(nodeData);\n\n return;\n\n default:\n throw new Error(`No callback function for ${optionId}`);\n }\n },\n [canReview, nodeData, onNodeReattempt, onNodeReview, onNodeView, userAttemptId],\n );\n\n const handleOnNodeCardClick = useCallback(() => {\n if (renderOptions || sheetLocked) return;\n\n if (canStart || canResume) {\n onNodeAttempt?.(nodeData);\n } else if (teacherMarkedAsCompleted) {\n onNodeView?.(nodeData);\n }\n }, [\n canResume,\n canStart,\n nodeData,\n onNodeAttempt,\n onNodeView,\n renderOptions,\n sheetLocked,\n teacherMarkedAsCompleted,\n ]);\n\n const handleOnMouseEnter = useCallback(() => {\n if (sheetLocked) return;\n animationRef.current?.play();\n }, [sheetLocked]);\n\n const handleOnMouseLeave = useCallback(() => {\n animationRef.current?.stop();\n }, []);\n\n const menuOptions: INodeMenuOption[] = [\n {\n id: 'node-card-review',\n label: 'Review',\n icon: Eye2Icon,\n disabled: !canReview,\n onClick: handleOnMenuOptionClick,\n },\n {\n id: 'node-card-reattempt',\n label: 'Reattempt',\n icon: RedoIcon,\n disabled: !canReset,\n onClick: handleOnMenuOptionClick,\n },\n ];\n\n if (canUnSkip) return null;\n\n return (\n <ContextMenu\n targetElement={\n <Styled.NodeCardContainer\n $background={`${imageHue}_2`}\n $disabled={sheetLocked}\n onClick={handleOnNodeCardClick}\n >\n <ArrowTooltip\n renderAs=\"primary\"\n tooltipItem={sheetStatement}\n position=\"bottom\"\n zIndex={5}\n hidden={!sheetStatement}\n parentWidth=\"100%\"\n widthX={11.25}\n >\n <Styled.NodeCardInfoWrapper\n $flexDirection=\"row\"\n $alignItems=\"center\"\n $heightX={3.5}\n $bgImage={nodeBgImage}\n $gutterX={0.78125}\n $flexGap={8.5}\n $opacity={sheetLocked ? 0.5 : 1}\n onMouseEnter={handleOnMouseEnter}\n onMouseLeave={handleOnMouseLeave}\n >\n <Styled.IconWrapper\n $width={31}\n $height={31}\n $background=\"WHITE_1\"\n $position=\"relative\"\n $alignItems=\"center\"\n $justifyContent=\"center\"\n >\n <LottieAnimation\n src={nodeCardLottie}\n ref={animationRef}\n settings={renderSettings}\n />\n {!isOptional && <Styled.StyledImportantIcon />}\n </Styled.IconWrapper>\n\n <Text $renderAs=\"ac4-black\" $color=\"BLACK\">\n {cardHeader} {inClassSheet && `• CW`}\n </Text>\n </Styled.NodeCardInfoWrapper>\n\n <NodeCardTags\n nodeType={nodeType}\n state={state}\n accuracy={accuracy}\n isStudent={isStudent}\n />\n\n {!isGoalBlock && (\n <Styled.NodeCardContentWrapper $background=\"WHITE_1\" $heightX={4}>\n <Styled.NodeCardTitle\n $renderAs=\"ab3\"\n $color=\"BLACK_1\"\n $opacity={sheetLocked ? 0.5 : 1}\n >\n {title}\n </Styled.NodeCardTitle>\n </Styled.NodeCardContentWrapper>\n )}\n </ArrowTooltip>\n </Styled.NodeCardContainer>\n }\n startLeft\n menuWidth=\"100%\"\n menuZIndex={6}\n menuOffset={2}\n menuElement={renderOptions ? <NodeMenuOptions options={menuOptions} /> : <></>}\n />\n );\n});\n\nexport default StudentActions;\n"],"names":["renderSettings","StudentActions","memo","props","nodeData","imageHue","blockType","onNodeAttempt","onNodeReattempt","onNodeReview","onNodeView","isStudent","accuracy","attemptLocation","nodeType","cardHeader","title","state","isOptional","sheetStatement","permissions","teacherMarkedAsCompleted","userAttemptId","canReview","canStart","canResume","canReset","canUnSkip","isGoalBlock","BLOCK_TYPE","sheetLocked","NODE_CARD_STATES","inClassSheet","renderOptions","animationRef","useRef","nodeBgImage","getNodeTypeBasedBgImage","nodeCardLottie","getNodeCardBasedIcon","handleOnMenuOptionClick","useCallback","optionId","handleOnNodeCardClick","handleOnMouseEnter","_a","handleOnMouseLeave","menuOptions","Eye2Icon","RedoIcon","jsx","ContextMenu","Styled.NodeCardContainer","jsxs","ArrowTooltip","Styled.NodeCardInfoWrapper","Styled.IconWrapper","LottieAnimation","Styled.StyledImportantIcon","Text","NodeCardTags","Styled.NodeCardContentWrapper","Styled.NodeCardTitle","NodeMenuOptions","Fragment"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAMA,KAAiB,EAAE,UAAU,UAAU,UAAU,GAAM,GAEvDC,KAAuDC,EAAK,CAASC,MAAA;AACnE,QAAA;AAAA,IACJ,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,eAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,EACE,IAAAR,GACE;AAAA,IACJ,UAAAS;AAAA,IACA,kBAAkBC;AAAA,IAClB,WAAWC;AAAA,IACX,aAAaC;AAAA,IACb,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAaC;AAAA,IACb,iBAAiBC;AAAA,IACjB,aAAAC;AAAA,IACA,qBAAqBC;AAAA,IACrB,iBAAiBC;AAAA,EACf,IAAAlB,GACE;AAAA,IACJ,YAAYmB;AAAA,IACZ,WAAWC;AAAA,IACX,YAAYC;AAAA,IACZ,WAAWC;AAAA,IACX,aAAaC;AAAA,EACX,IAAAP,GAEEQ,IAActB,MAAcuB,EAAW,MACvCC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