@cuemath/leap 3.5.64 → 3.5.66-link0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/dist/features/cue-canvas/bottombar/homework-controls.js.map +1 -1
  2. package/dist/features/cue-canvas/sidebar/sidebar.js +4 -4
  3. package/dist/features/cue-canvas/sidebar/sidebar.js.map +1 -1
  4. package/dist/features/cue-canvas/toolbar/toolbar.js +21 -17
  5. package/dist/features/cue-canvas/toolbar/toolbar.js.map +1 -1
  6. package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js +23 -13
  7. package/dist/features/cue-canvas/toolbar/whiteboard-toolbar.js.map +1 -1
  8. package/dist/features/milestone/create/api/milestone-config.js.map +1 -1
  9. package/dist/features/parent-dashboard/modals/trial-report/trial-report.js +1 -1
  10. package/dist/features/parent-dashboard/modals/trial-report/trial-report.js.map +1 -1
  11. package/dist/features/sheets/constants/sheet.js +1 -0
  12. package/dist/features/sheets/constants/sheet.js.map +1 -1
  13. package/dist/features/timeline/daily-timeline/daily-timeline.js +40 -40
  14. package/dist/features/timeline/daily-timeline/daily-timeline.js.map +1 -1
  15. package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js +1 -1
  16. package/dist/features/timeline/monthly-timeline/monthly-report/monthly-report-types.js.map +1 -1
  17. package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js +8 -5
  18. package/dist/features/timeline/monthly-timeline/monthly-timeline-styled.js.map +1 -1
  19. package/dist/features/timeline/monthly-timeline/monthly-timeline.js +35 -35
  20. package/dist/features/timeline/monthly-timeline/monthly-timeline.js.map +1 -1
  21. package/dist/features/trial-session/api/trial-home.js +10 -16
  22. package/dist/features/trial-session/api/trial-home.js.map +1 -1
  23. package/dist/features/trial-session/api/trial-session-report.js +16 -0
  24. package/dist/features/trial-session/api/trial-session-report.js.map +1 -0
  25. package/dist/features/trial-session/api/trial-topics.js +9 -0
  26. package/dist/features/trial-session/api/trial-topics.js.map +1 -0
  27. package/dist/features/trial-session/comps/background-grid/background-grid-utils.js +62 -50
  28. package/dist/features/trial-session/comps/background-grid/background-grid-utils.js.map +1 -1
  29. package/dist/features/trial-session/comps/class-preference/class-preference-styled.js +5 -14
  30. package/dist/features/trial-session/comps/class-preference/class-preference-styled.js.map +1 -1
  31. package/dist/features/trial-session/comps/class-preference/class-preference.js +55 -53
  32. package/dist/features/trial-session/comps/class-preference/class-preference.js.map +1 -1
  33. package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js +3 -2
  34. package/dist/features/trial-session/comps/communication-slide/communication-slide-constants.js.map +1 -1
  35. package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js +27 -27
  36. package/dist/features/trial-session/comps/confirmation-modal/hooks/use-confirmation-modal.js.map +1 -1
  37. package/dist/features/trial-session/comps/learning-session/learning-session-styled.js +19 -18
  38. package/dist/features/trial-session/comps/learning-session/learning-session-styled.js.map +1 -1
  39. package/dist/features/trial-session/comps/learning-session/learning-session.js +34 -43
  40. package/dist/features/trial-session/comps/learning-session/learning-session.js.map +1 -1
  41. package/dist/features/trial-session/comps/navigation-bar/index.js +56 -58
  42. package/dist/features/trial-session/comps/navigation-bar/index.js.map +1 -1
  43. package/dist/features/trial-session/comps/offering-information/offering-information-constants.js +29 -6
  44. package/dist/features/trial-session/comps/offering-information/offering-information-constants.js.map +1 -1
  45. package/dist/features/trial-session/comps/offering-information/offering-information.js +74 -64
  46. package/dist/features/trial-session/comps/offering-information/offering-information.js.map +1 -1
  47. package/dist/features/trial-session/comps/school-goals/school-goals-styled.js +10 -9
  48. package/dist/features/trial-session/comps/school-goals/school-goals-styled.js.map +1 -1
  49. package/dist/features/trial-session/comps/school-goals/school-goals-view.js +40 -39
  50. package/dist/features/trial-session/comps/school-goals/school-goals-view.js.map +1 -1
  51. package/dist/features/trial-session/comps/school-goals/school-goals.js +39 -37
  52. package/dist/features/trial-session/comps/school-goals/school-goals.js.map +1 -1
  53. package/dist/features/trial-session/comps/session-insights/session-insights-styled.js +12 -20
  54. package/dist/features/trial-session/comps/session-insights/session-insights-styled.js.map +1 -1
  55. package/dist/features/trial-session/comps/session-insights/session-insights.js +64 -63
  56. package/dist/features/trial-session/comps/session-insights/session-insights.js.map +1 -1
  57. package/dist/features/trial-session/comps/session-overview/session-overview-styled.js +13 -13
  58. package/dist/features/trial-session/comps/session-overview/session-overview-styled.js.map +1 -1
  59. package/dist/features/trial-session/comps/session-overview/session-overview-utils.js +23 -4
  60. package/dist/features/trial-session/comps/session-overview/session-overview-utils.js.map +1 -1
  61. package/dist/features/trial-session/comps/session-overview/session-overview.js +20 -20
  62. package/dist/features/trial-session/comps/session-overview/session-overview.js.map +1 -1
  63. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js +61 -0
  64. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-styled.js.map +1 -0
  65. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js +5 -0
  66. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-types.js.map +1 -0
  67. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js +135 -0
  68. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary-view.js.map +1 -0
  69. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js +53 -0
  70. package/dist/features/trial-session/comps/session-progress-summary/session-progress-summary.js.map +1 -0
  71. package/dist/features/trial-session/comps/session-report/report-404/report-404.js +15 -16
  72. package/dist/features/trial-session/comps/session-report/report-404/report-404.js.map +1 -1
  73. package/dist/features/trial-session/comps/session-report/session-report.js +35 -33
  74. package/dist/features/trial-session/comps/session-report/session-report.js.map +1 -1
  75. package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js +9 -16
  76. package/dist/features/trial-session/comps/student-enrichment/student-enrichment-styled.js.map +1 -1
  77. package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js +39 -37
  78. package/dist/features/trial-session/comps/student-enrichment/student-enrichment.js.map +1 -1
  79. package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js +10 -9
  80. package/dist/features/trial-session/comps/student-feedback/student-feedback-styled.js.map +1 -1
  81. package/dist/features/trial-session/comps/student-info/student-info-constants.js +35 -0
  82. package/dist/features/trial-session/comps/student-info/student-info-constants.js.map +1 -0
  83. package/dist/features/trial-session/comps/student-info/student-info-helpers.js +12 -0
  84. package/dist/features/trial-session/comps/student-info/student-info-helpers.js.map +1 -0
  85. package/dist/features/trial-session/comps/student-info/student-info-styled.js +26 -11
  86. package/dist/features/trial-session/comps/student-info/student-info-styled.js.map +1 -1
  87. package/dist/features/trial-session/comps/student-info/student-info.js +113 -78
  88. package/dist/features/trial-session/comps/student-info/student-info.js.map +1 -1
  89. package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js +3 -12
  90. package/dist/features/trial-session/comps/student-personalization/student-personalization-styled.js.map +1 -1
  91. package/dist/features/trial-session/comps/student-personalization/student-personalization.js +34 -33
  92. package/dist/features/trial-session/comps/student-personalization/student-personalization.js.map +1 -1
  93. package/dist/features/trial-session/comps/student-profile/student-profile.js +45 -44
  94. package/dist/features/trial-session/comps/student-profile/student-profile.js.map +1 -1
  95. package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js +9 -8
  96. package/dist/features/trial-session/comps/teacher-intro/teacher-intro.js.map +1 -1
  97. package/dist/features/trial-session/comps/test-prep/test-prep-styled.js +11 -19
  98. package/dist/features/trial-session/comps/test-prep/test-prep-styled.js.map +1 -1
  99. package/dist/features/trial-session/comps/test-prep/test-prep.js +31 -29
  100. package/dist/features/trial-session/comps/test-prep/test-prep.js.map +1 -1
  101. package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js +42 -0
  102. package/dist/features/trial-session/comps/topic-selection/topic-selection-styled.js.map +1 -0
  103. package/dist/features/trial-session/comps/topic-selection/topic-selection.js +84 -0
  104. package/dist/features/trial-session/comps/topic-selection/topic-selection.js.map +1 -0
  105. package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js +21 -0
  106. package/dist/features/trial-session/comps/whiteboard/whiteboard-styled.js.map +1 -0
  107. package/dist/features/trial-session/comps/whiteboard/whiteboard.js +99 -0
  108. package/dist/features/trial-session/comps/whiteboard/whiteboard.js.map +1 -0
  109. package/dist/features/trial-session/comps/worksheet/worksheet.js +35 -33
  110. package/dist/features/trial-session/comps/worksheet/worksheet.js.map +1 -1
  111. package/dist/features/trial-session/context/trial-session-context.js +2 -0
  112. package/dist/features/trial-session/context/trial-session-context.js.map +1 -1
  113. package/dist/features/trial-session/helper.js +70 -64
  114. package/dist/features/trial-session/helper.js.map +1 -1
  115. package/dist/features/trial-session/hooks/use-trial-session-navigation.js +190 -158
  116. package/dist/features/trial-session/hooks/use-trial-session-navigation.js.map +1 -1
  117. package/dist/features/trial-session/right-panel/right-panel-styled.js +8 -8
  118. package/dist/features/trial-session/right-panel/right-panel-styled.js.map +1 -1
  119. package/dist/features/trial-session/right-panel/slide-components-map.js +42 -36
  120. package/dist/features/trial-session/right-panel/slide-components-map.js.map +1 -1
  121. package/dist/features/trial-session/trial-session-constants.js +22 -18
  122. package/dist/features/trial-session/trial-session-constants.js.map +1 -1
  123. package/dist/features/trial-session/trial-session-types.js.map +1 -1
  124. package/dist/features/trial-session/trial-session-view.js +82 -77
  125. package/dist/features/trial-session/trial-session-view.js.map +1 -1
  126. package/dist/features/trial-session/trial-session.js +38 -38
  127. package/dist/features/trial-session/trial-session.js.map +1 -1
  128. package/dist/features/ui/inputs/checkbox-input/checkbox-input.js +21 -21
  129. package/dist/features/ui/inputs/checkbox-input/checkbox-input.js.map +1 -1
  130. package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js +12 -12
  131. package/dist/features/ui/inputs/checkbox-input-list/checkbox-input-list.js.map +1 -1
  132. package/dist/features/ui/theme/clrs.js +1 -0
  133. package/dist/features/ui/theme/clrs.js.map +1 -1
  134. package/dist/features/worksheet/worksheet/mocks/activity.js +6 -0
  135. package/dist/features/worksheet/worksheet/mocks/activity.js.map +1 -0
  136. package/dist/features/worksheet/worksheet/mocks/signed-requests.js +5 -0
  137. package/dist/features/worksheet/worksheet/mocks/signed-requests.js.map +1 -0
  138. package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js +57 -0
  139. package/dist/features/worksheet/worksheet/stories/use-canvas-sync-broker-story.js.map +1 -0
  140. package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js +263 -0
  141. package/dist/features/worksheet/worksheet/stories/worksheet-story-container.js.map +1 -0
  142. package/dist/features/worksheet/worksheet/stories/worksheet-student.js +177 -0
  143. package/dist/features/worksheet/worksheet/stories/worksheet-student.js.map +1 -0
  144. package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js +268 -0
  145. package/dist/features/worksheet/worksheet/stories/worksheet-teacher.js.map +1 -0
  146. package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js +51 -32
  147. package/dist/features/worksheet/worksheet/worksheet-behavior-helper.js.map +1 -1
  148. package/dist/features/worksheet/worksheet/worksheet-helpers.js +38 -37
  149. package/dist/features/worksheet/worksheet/worksheet-helpers.js.map +1 -1
  150. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js +36 -35
  151. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-computed-properties.js.map +1 -1
  152. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js +61 -58
  153. package/dist/features/worksheet/worksheet/worksheet-store/helpers/get-questions-from-items.js.map +1 -1
  154. package/dist/features/worksheet/worksheet/worksheet-types.js.map +1 -1
  155. package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js +32 -30
  156. package/dist/features/worksheet/worksheet-preview/hooks/use-worksheet-layout.js.map +1 -1
  157. package/dist/index.d.ts +12 -6
  158. package/dist/index.js +148 -150
  159. package/dist/index.js.map +1 -1
  160. package/dist/node_modules/uuid/dist/esm-browser/regex.js +5 -0
  161. package/dist/node_modules/uuid/dist/esm-browser/regex.js.map +1 -0
  162. package/dist/node_modules/uuid/dist/esm-browser/rng.js +2 -3
  163. package/dist/node_modules/uuid/dist/esm-browser/rng.js.map +1 -1
  164. package/dist/node_modules/uuid/dist/esm-browser/stringify.js +10 -6
  165. package/dist/node_modules/uuid/dist/esm-browser/stringify.js.map +1 -1
  166. package/dist/node_modules/uuid/dist/esm-browser/v4.js +9 -12
  167. package/dist/node_modules/uuid/dist/esm-browser/v4.js.map +1 -1
  168. package/dist/node_modules/uuid/dist/esm-browser/validate.js +8 -0
  169. package/dist/node_modules/uuid/dist/esm-browser/validate.js.map +1 -0
  170. package/dist/types/models/worksheet.js +1 -1
  171. package/dist/types/models/worksheet.js.map +1 -1
  172. package/package.json +1 -1
  173. package/dist/features/sheets/utils/is-v3-worksheet.js +0 -55
  174. package/dist/features/sheets/utils/is-v3-worksheet.js.map +0 -1
  175. package/dist/node_modules/uuid/dist/esm-browser/native.js +0 -7
  176. package/dist/node_modules/uuid/dist/esm-browser/native.js.map +0 -1
@@ -1,52 +1,54 @@
1
- import { jsx as l } from "react/jsx-runtime";
2
- import { useState as h, useMemo as k, useCallback as G, useEffect as H } from "react";
3
- import M from "../../../ui/error/error.js";
4
- import N from "../../../ui/loader/app-loader/app-loader.js";
5
- import { useResumeTrialWorksheet as x } from "../../api/trial-nodes.js";
6
- import { useTrialSessionContext as D } from "../../context/use-trial-session-context.js";
7
- import { GOAL_CATEGORY as U } from "../../../milestone/constants.js";
8
- import { HIGH_ENROLLMENT_PROGRAMS_MAP as W } from "../../trial-session-constants.js";
9
- const F = () => {
10
- const { isTeacher: n, studentId: i, worksheet: a, formData: S, updateSlideConfig: g, trialHomeData: C } = D(), [y, c] = h(!1), [d, A] = h(!1), { goals: o, resetAttempt: t } = S || {}, { demo_info: I } = C, { region_data: T, course: m } = I || {}, { opportunity_country: f = "US" } = T || {}, { program_code: u = "" } = k(
11
- () => (o == null ? void 0 : o.find((e) => e.goal_category === U.SCHOOL_SUCCESS)) ?? {},
1
+ import { jsx as h } from "react/jsx-runtime";
2
+ import { useState as S, useMemo as G, useCallback as H, useEffect as M } from "react";
3
+ import N from "../../../ui/error/error.js";
4
+ import x from "../../../ui/loader/app-loader/app-loader.js";
5
+ import { useResumeTrialWorksheet as D } from "../../api/trial-nodes.js";
6
+ import { useTrialSessionContext as U } from "../../context/use-trial-session-context.js";
7
+ import { GOAL_CATEGORY as W } from "../../../milestone/constants.js";
8
+ import { HIGH_ENROLLMENT_PROGRAMS_MAP as b } from "../../trial-session-constants.js";
9
+ const J = () => {
10
+ const { isTeacher: n, studentId: i, worksheet: a, formData: g, demoType: c, updateSlideConfig: y, trialHomeData: C } = U(), [T, d] = S(!1), [m, A] = S(!1), { goals: o, resetAttempt: t } = g || {}, { demo_info: I } = C, { region_data: E, course: p } = I || {}, { opportunity_country: f = "US" } = E || {}, { program_code: u = "" } = G(
11
+ () => (o == null ? void 0 : o.find((e) => e.goal_category === W.SCHOOL_SUCCESS)) ?? {},
12
12
  [o]
13
- ), E = (e, _) => {
14
- if (e && c(!0), _) {
13
+ ), P = (e, l) => {
14
+ if (e && d(!0), l) {
15
15
  const {
16
- user_node_id: P,
17
- node_id: O,
18
- user_attempt_id: L,
19
- node_type: R
20
- } = _;
21
- A(!0), g({ userNodeId: P, nodeId: O, attemptId: L, nodeType: R, resetAttempt: !1 });
16
+ user_node_id: O,
17
+ node_id: L,
18
+ user_attempt_id: R,
19
+ node_type: k
20
+ } = l;
21
+ A(!0), y({ userNodeId: O, nodeId: L, attemptId: R, nodeType: k, resetAttempt: !1 });
22
22
  }
23
- }, { patch: p, isProcessing: r } = x({
24
- onComplete: E
25
- }), s = G(() => {
26
- if (n && !r && !d) {
27
- const e = W[u] || m;
28
- c(!1), p(i, {
23
+ }, { patch: _, isProcessing: r } = D({
24
+ onComplete: P
25
+ }), s = H(() => {
26
+ if (n && !r && !m) {
27
+ const e = b[u] || p;
28
+ d(!1), _(i, {
29
29
  course: e,
30
30
  country_code: f,
31
+ demo_type: c,
31
32
  reset_attempt: t === void 0 || t
32
33
  });
33
34
  }
34
35
  }, [
35
- f,
36
+ n,
37
+ r,
36
38
  m,
37
39
  u,
38
- n,
39
40
  p,
41
+ _,
40
42
  i,
41
- t,
42
- r,
43
- d
43
+ f,
44
+ c,
45
+ t
44
46
  ]);
45
- return H(() => {
47
+ return M(() => {
46
48
  s();
47
- }, [s]), y ? /* @__PURE__ */ l(M, { height: "100%", onTryAgain: s }) : r || !a ? /* @__PURE__ */ l(N, { height: "100%" }) : a;
49
+ }, [s]), T ? /* @__PURE__ */ h(N, { height: "100%", onTryAgain: s }) : r || !a ? /* @__PURE__ */ h(x, { height: "100%" }) : a;
48
50
  };
49
51
  export {
50
- F as default
52
+ J as default
51
53
  };
52
54
  //# sourceMappingURL=worksheet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worksheet.js","sources":["../../../../../src/features/trial-session/comps/worksheet/worksheet.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\n\nimport type { IResumeWorksheetModel } from '../../../../types/models/worksheet';\nimport Error from '../../../ui/error/error';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport { useResumeTrialWorksheet } from '../../api/trial-nodes';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { HIGH_ENROLLMENT_PROGRAMS_MAP } from '../../trial-session-constants';\n\nconst SessionWorksheet: FC = () => {\n const { isTeacher, studentId, worksheet, formData, updateSlideConfig, trialHomeData } =\n useTrialSessionContext();\n const [isError, setIserror] = useState<boolean>(false);\n const [isPatchProcessed, setIsPatchProcessed] = useState(false);\n\n const { goals, resetAttempt } = formData || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { region_data: regionData, course } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const { program_code: programCode = '' } = useMemo(\n () => goals?.find(goal => goal.goal_category === GOAL_CATEGORY.SCHOOL_SUCCESS) ?? {},\n [goals],\n );\n\n const onComplete = (error: string | null, sheetData?: IResumeWorksheetModel) => {\n if (error) {\n setIserror(true);\n }\n\n if (sheetData) {\n const {\n user_node_id: userNodeId,\n node_id: nodeId,\n user_attempt_id: attemptId,\n node_type: nodeType,\n } = sheetData;\n\n setIsPatchProcessed(true);\n updateSlideConfig({ userNodeId, nodeId, attemptId, nodeType, resetAttempt: false });\n }\n };\n\n const { patch: resumeNode, isProcessing } = useResumeTrialWorksheet({\n onComplete,\n });\n\n const fetchData = useCallback(() => {\n if (isTeacher && !isProcessing && !isPatchProcessed) {\n const courseToSend =\n HIGH_ENROLLMENT_PROGRAMS_MAP[programCode as keyof typeof HIGH_ENROLLMENT_PROGRAMS_MAP] ||\n course;\n\n setIserror(false);\n resumeNode(studentId, {\n course: courseToSend,\n country_code: countryCode,\n reset_attempt: resetAttempt === undefined || resetAttempt,\n });\n }\n }, [\n countryCode,\n course,\n programCode,\n isTeacher,\n resumeNode,\n studentId,\n resetAttempt,\n isProcessing,\n isPatchProcessed,\n ]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isError) {\n return <Error height=\"100%\" onTryAgain={fetchData} />;\n }\n\n if (isProcessing || !worksheet) {\n return <AppLoader height=\"100%\" />;\n }\n\n return worksheet;\n};\n\nexport default SessionWorksheet;\n"],"names":["SessionWorksheet","isTeacher","studentId","worksheet","formData","updateSlideConfig","trialHomeData","useTrialSessionContext","isError","setIserror","useState","isPatchProcessed","setIsPatchProcessed","goals","resetAttempt","demoInfo","regionData","course","countryCode","programCode","useMemo","goal","GOAL_CATEGORY","onComplete","error","sheetData","userNodeId","nodeId","attemptId","nodeType","resumeNode","isProcessing","useResumeTrialWorksheet","fetchData","useCallback","courseToSend","HIGH_ENROLLMENT_PROGRAMS_MAP","useEffect","jsx","Error","AppLoader"],"mappings":";;;;;;;;AAUA,MAAMA,IAAuB,MAAM;AAC3B,QAAA,EAAE,WAAAC,GAAW,WAAAC,GAAW,WAAAC,GAAW,UAAAC,GAAU,mBAAAC,GAAmB,eAAAC,MACpEC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;AAAA,IACA5B;AAAA,IACAY;AAAA,IACAiB;AAAA,IACApB;AAAA,EAAA,CACD;AAMD,SAJA0B,EAAU,MAAM;AACJ,IAAAJ;EAAA,GACT,CAACA,CAAS,CAAC,GAEVzB,IACM,gBAAA8B,EAAAC,GAAA,EAAM,QAAO,QAAO,YAAYN,EAAW,CAAA,IAGjDF,KAAgB,CAAC5B,IACZ,gBAAAmC,EAACE,GAAU,EAAA,QAAO,OAAO,CAAA,IAG3BrC;AACT;"}
1
+ {"version":3,"file":"worksheet.js","sources":["../../../../../src/features/trial-session/comps/worksheet/worksheet.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState, type FC } from 'react';\n\nimport type { IResumeWorksheetModel } from '../../../../types/models/worksheet';\nimport Error from '../../../ui/error/error';\nimport AppLoader from '../../../ui/loader/app-loader/app-loader';\nimport { useResumeTrialWorksheet } from '../../api/trial-nodes';\nimport { useTrialSessionContext } from '../../context/use-trial-session-context';\nimport { GOAL_CATEGORY } from '../../../milestone/constants';\nimport { HIGH_ENROLLMENT_PROGRAMS_MAP } from '../../trial-session-constants';\n\nconst SessionWorksheet: FC = () => {\n const { isTeacher, studentId, worksheet, formData, demoType, updateSlideConfig, trialHomeData } =\n useTrialSessionContext();\n const [isError, setIserror] = useState<boolean>(false);\n const [isPatchProcessed, setIsPatchProcessed] = useState(false);\n\n const { goals, resetAttempt } = formData || {};\n const { demo_info: demoInfo } = trialHomeData;\n const { region_data: regionData, course } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const { program_code: programCode = '' } = useMemo(\n () => goals?.find(goal => goal.goal_category === GOAL_CATEGORY.SCHOOL_SUCCESS) ?? {},\n [goals],\n );\n\n const onComplete = (error: string | null, sheetData?: IResumeWorksheetModel) => {\n if (error) {\n setIserror(true);\n }\n\n if (sheetData) {\n const {\n user_node_id: userNodeId,\n node_id: nodeId,\n user_attempt_id: attemptId,\n node_type: nodeType,\n } = sheetData;\n\n setIsPatchProcessed(true);\n updateSlideConfig({ userNodeId, nodeId, attemptId, nodeType, resetAttempt: false });\n }\n };\n\n const { patch: resumeNode, isProcessing } = useResumeTrialWorksheet({\n onComplete,\n });\n\n const fetchData = useCallback(() => {\n if (isTeacher && !isProcessing && !isPatchProcessed) {\n const courseToSend =\n HIGH_ENROLLMENT_PROGRAMS_MAP[programCode as keyof typeof HIGH_ENROLLMENT_PROGRAMS_MAP] ||\n course;\n\n setIserror(false);\n resumeNode(studentId, {\n course: courseToSend,\n country_code: countryCode,\n demo_type: demoType,\n reset_attempt: resetAttempt === undefined || resetAttempt,\n });\n }\n }, [\n isTeacher,\n isProcessing,\n isPatchProcessed,\n programCode,\n course,\n resumeNode,\n studentId,\n countryCode,\n demoType,\n resetAttempt,\n ]);\n\n useEffect(() => {\n fetchData();\n }, [fetchData]);\n\n if (isError) {\n return <Error height=\"100%\" onTryAgain={fetchData} />;\n }\n\n if (isProcessing || !worksheet) {\n return <AppLoader height=\"100%\" />;\n }\n\n return worksheet;\n};\n\nexport default SessionWorksheet;\n"],"names":["SessionWorksheet","isTeacher","studentId","worksheet","formData","demoType","updateSlideConfig","trialHomeData","useTrialSessionContext","isError","setIserror","useState","isPatchProcessed","setIsPatchProcessed","goals","resetAttempt","demoInfo","regionData","course","countryCode","programCode","useMemo","goal","GOAL_CATEGORY","onComplete","error","sheetData","userNodeId","nodeId","attemptId","nodeType","resumeNode","isProcessing","useResumeTrialWorksheet","fetchData","useCallback","courseToSend","HIGH_ENROLLMENT_PROGRAMS_MAP","useEffect","jsx","Error","AppLoader"],"mappings":";;;;;;;;AAUA,MAAMA,IAAuB,MAAM;AAC3B,QAAA,EAAE,WAAAC,GAAW,WAAAC,GAAW,WAAAC,GAAW,UAAAC,GAAU,UAAAC,GAAU,mBAAAC,GAAmB,eAAAC,MAC9EC,KACI,CAACC,GAASC,CAAU,IAAIC,EAAkB,EAAK,GAC/C,CAACC,GAAkBC,CAAmB,IAAIF,EAAS,EAAK,GAExD,EAAE,OAAAG,GAAO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,MAAM;AACJ,IAAAJ;EAAA,GACT,CAACA,CAAS,CAAC,GAEVzB,IACM,gBAAA8B,EAAAC,GAAA,EAAM,QAAO,QAAO,YAAYN,EAAW,CAAA,IAGjDF,KAAgB,CAAC7B,IACZ,gBAAAoC,EAACE,GAAU,EAAA,QAAO,OAAO,CAAA,IAG3BtC;AACT;"}
@@ -4,6 +4,8 @@ const s = e({
4
4
  isTeacher: !1,
5
5
  slideConfig: {},
6
6
  formData: void 0,
7
+ demoType: "",
8
+ teacherClassroomId: "",
7
9
  milestoneConfig: {},
8
10
  updateSlideConfig: () => {
9
11
  },
@@ -1 +1 @@
1
- {"version":3,"file":"trial-session-context.js","sources":["../../../../src/features/trial-session/context/trial-session-context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { IMilestoneConfig } from '../../milestone/create/milestone-create-types';\nimport type { ITrialCircleGameParams } from '../comps/trial-circle-game/trial-circle-game-types';\nimport { DEFAULT_BUTTON_STATE } from '../trial-session-constants';\nimport type {\n IClassTimeAlertConfig,\n ISlide,\n ITrialHomeData,\n ITrialSessionContext,\n} from '../trial-session-types';\n\nconst TrialSessionContext = createContext<ITrialSessionContext>({\n isTeacher: false,\n slideConfig: {} as ISlide,\n formData: undefined,\n milestoneConfig: {} as IMilestoneConfig,\n updateSlideConfig: () => undefined,\n buttonState: DEFAULT_BUTTON_STATE,\n updateButtonState: () => undefined,\n teacherId: '',\n studentId: '',\n trialHomeData: {} as ITrialHomeData,\n openEndClassModal: () => undefined,\n studentAbsentInClass: false,\n circleGames: {} as ITrialCircleGameParams,\n trialGameUrl: '',\n handleInfoMessage: () => undefined,\n classTimeAlertConfig: {} as IClassTimeAlertConfig,\n classDuration: 0,\n});\n\nexport default TrialSessionContext;\n"],"names":["TrialSessionContext","createContext","DEFAULT_BUTTON_STATE"],"mappings":";;AAYA,MAAMA,IAAsBC,EAAoC;AAAA,EAC9D,WAAW;AAAA,EACX,aAAa,CAAC;AAAA,EACd,UAAU;AAAA,EACV,iBAAiB,CAAC;AAAA,EAClB,mBAAmB,MAAM;AAAA;AAAA,EACzB,aAAaC;AAAA,EACb,mBAAmB,MAAM;AAAA;AAAA,EACzB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe,CAAC;AAAA,EAChB,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB;AAAA,EACtB,aAAa,CAAC;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB,CAAC;AAAA,EACvB,eAAe;AACjB,CAAC;"}
1
+ {"version":3,"file":"trial-session-context.js","sources":["../../../../src/features/trial-session/context/trial-session-context.tsx"],"sourcesContent":["import { createContext } from 'react';\n\nimport type { IMilestoneConfig } from '../../milestone/create/milestone-create-types';\nimport type { ITrialCircleGameParams } from '../comps/trial-circle-game/trial-circle-game-types';\nimport { DEFAULT_BUTTON_STATE } from '../trial-session-constants';\nimport type {\n IClassTimeAlertConfig,\n ISlide,\n ITrialHomeData,\n ITrialSessionContext,\n} from '../trial-session-types';\n\nconst TrialSessionContext = createContext<ITrialSessionContext>({\n isTeacher: false,\n slideConfig: {} as ISlide,\n formData: undefined,\n demoType: '',\n teacherClassroomId: '',\n milestoneConfig: {} as IMilestoneConfig,\n updateSlideConfig: () => undefined,\n buttonState: DEFAULT_BUTTON_STATE,\n updateButtonState: () => undefined,\n teacherId: '',\n studentId: '',\n trialHomeData: {} as ITrialHomeData,\n openEndClassModal: () => undefined,\n studentAbsentInClass: false,\n circleGames: {} as ITrialCircleGameParams,\n trialGameUrl: '',\n handleInfoMessage: () => undefined,\n classTimeAlertConfig: {} as IClassTimeAlertConfig,\n classDuration: 0,\n});\n\nexport default TrialSessionContext;\n"],"names":["TrialSessionContext","createContext","DEFAULT_BUTTON_STATE"],"mappings":";;AAYA,MAAMA,IAAsBC,EAAoC;AAAA,EAC9D,WAAW;AAAA,EACX,aAAa,CAAC;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,EACV,oBAAoB;AAAA,EACpB,iBAAiB,CAAC;AAAA,EAClB,mBAAmB,MAAM;AAAA;AAAA,EACzB,aAAaC;AAAA,EACb,mBAAmB,MAAM;AAAA;AAAA,EACzB,WAAW;AAAA,EACX,WAAW;AAAA,EACX,eAAe,CAAC;AAAA,EAChB,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB;AAAA,EACtB,aAAa,CAAC;AAAA,EACd,cAAc;AAAA,EACd,mBAAmB,MAAM;AAAA;AAAA,EACzB,sBAAsB,CAAC;AAAA,EACvB,eAAe;AACjB,CAAC;"}
@@ -1,93 +1,99 @@
1
- import { DAYS as R } from "../../constants/date-time.js";
2
- import { getOffsetBetweenTimezone as D, convertEpochToDateTime as x, getTimeUnits as H, convertToMilliseconds as M } from "../../helpers/date-time.js";
3
- import { GOAL_CATEGORY as L } from "../milestone/constants.js";
1
+ import { DAYS as C } from "../../constants/date-time.js";
2
+ import { getOffsetBetweenTimezone as D, convertEpochToDateTime as H, getTimeUnits as M, convertToMilliseconds as w } from "../../helpers/date-time.js";
3
+ import { GOAL_CATEGORY as O } from "../milestone/constants.js";
4
4
  import { getGoalsFromConfig as G } from "../milestone/create/milestone-create-helpers.js";
5
- import { HIGH_ENROLLMENT_PROGRAMS_MAP as v, TrialPageId as s, TEACHER_TIMEZONE as w } from "./trial-session-constants.js";
6
- const V = (n) => n === "PLA", j = (n, t, r) => {
7
- const e = n ? [...n] : [], o = e.findIndex((i) => i.goal_category === t), c = {
8
- ...r,
5
+ import { HIGH_ENROLLMENT_PROGRAMS_MAP as v, TrialPageId as i, TEACHER_TIMEZONE as U } from "./trial-session-constants.js";
6
+ const j = (n) => n === "PLA", B = (n, t, a) => {
7
+ const e = n ? [...n] : [], r = e.findIndex((c) => c.goal_category === t), d = {
8
+ ...a,
9
9
  goal_category: t
10
10
  };
11
- return o === -1 ? e.push(c) : e[o] = {
12
- ...e[o],
13
- ...c
14
- }, e.filter((i) => i.goal_code);
15
- }, B = (n, t) => {
11
+ return r === -1 ? e.push(d) : e[r] = {
12
+ ...e[r],
13
+ ...d
14
+ }, e.filter((c) => c.goal_code);
15
+ }, W = (n, t) => {
16
16
  if (!t) return [];
17
- const r = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), e = D(w, t), o = r + e, { day: c = "" } = x(o, t), i = R.indexOf(c);
18
- return n.length > 0 ? n.filter((g) => g.selectedDay && g.selectedTime).map((g) => {
19
- const { selectedDay: p, selectedTime: P } = g, { hours: y, minutes: m, period: u } = H(P), E = (R.indexOf(p) - i + 7) % 7;
17
+ const a = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0), e = D(U, t), r = a + e, { day: d = "" } = H(r, t), c = C.indexOf(d);
18
+ return n.length > 0 ? n.filter((l) => l.selectedDay && l.selectedTime).map((l) => {
19
+ const { selectedDay: E, selectedTime: I } = l, { hours: N, minutes: _, period: f } = M(I), u = (C.indexOf(E) - c + 7) % 7;
20
20
  return {
21
- id: r + e + M({ days: E, hours: y, minutes: m }),
22
- value: `${p}, ${P} - ${y + 1}:${m < 10 ? "0" : ""}${m} ${u}`
21
+ id: a + e + w({ days: u, hours: N, minutes: _ }),
22
+ value: `${E}, ${I} - ${N + 1}:${_ < 10 ? "0" : ""}${_} ${f}`
23
23
  // Formatted the value string as required
24
24
  };
25
25
  }) : [];
26
- }, W = (n) => n.filter((t) => typeof t.id == "number" && !isNaN(t.id)).map((t) => {
27
- const r = new Date(t.id), e = R[r.getDay()], o = e ? e.toLowerCase() : "unknown", c = r.getHours(), i = r.getMinutes(), g = `${c.toString().padStart(2, "0")}:${i.toString().padStart(2, "0")}:00`;
28
- return { weekday: o, start_time: g };
29
- }), Y = ({
26
+ }, Y = (n) => n.filter((t) => typeof t.id == "number" && !isNaN(t.id)).map((t) => {
27
+ const a = new Date(t.id), e = C[a.getDay()], r = e ? e.toLowerCase() : "unknown", d = a.getHours(), c = a.getMinutes(), l = `${d.toString().padStart(2, "0")}:${c.toString().padStart(2, "0")}:00`;
28
+ return { weekday: r, start_time: l };
29
+ }), Z = ({
30
30
  milestoneConfigData: n,
31
31
  trialHomeData: t,
32
- grade: r,
32
+ grade: a,
33
33
  goal: e
34
34
  }) => {
35
- var O, h;
36
- const { student: o, demo_info: c } = t, { grade: i, enrollment_type: g } = o || {}, { stream: p, region_data: P } = c || {}, { opportunity_country: y = "US" } = P || {}, m = (d) => G(n, {
37
- countryCode: y,
38
- grade: r || i || "",
39
- goalCategory: d,
40
- courseStream: p,
41
- enrollmentType: g
42
- }), u = m(L.TEST_PREP), l = m(L.ENRICHMENT), E = m(L.SCHOOL_SUCCESS).some(
43
- (d) => d.id === e && Object.keys(v).includes(d.programCode ?? "")
35
+ const { student: r, demo_info: d } = t, {
36
+ grade: c,
37
+ enrollment_type: l,
38
+ can_show_topic_selection: E = !0
39
+ } = r || {}, { stream: I, region_data: N } = d || {}, { opportunity_country: _ = "US" } = N || {}, f = (s) => G(n, {
40
+ countryCode: _,
41
+ grade: a || c || "",
42
+ goalCategory: s,
43
+ courseStream: I,
44
+ enrollmentType: l
45
+ }), m = f(O.TEST_PREP), u = f(O.ENRICHMENT), S = f(O.SCHOOL_SUCCESS).some(
46
+ (s) => s.id === e && Object.keys(v).includes(s.programCode ?? "")
44
47
  );
45
- if ((u == null ? void 0 : u.length) > 0 && (l == null ? void 0 : l.length) > 0 && !E)
48
+ if ((m == null ? void 0 : m.length) > 0 && (u == null ? void 0 : u.length) > 0 && !S && E)
46
49
  return t;
47
- const f = { ...t }, T = Object.fromEntries(f.pages.map((d) => [d.id, d])), _ = (() => {
48
- var d, N, a, S, A, C;
49
- return ((N = (d = T[s.SCHOOL_GOALS]) == null ? void 0 : d.nextPage) == null ? void 0 : N.pageId) === s.TEST_PREP && u.length === 0 ? s.SCHOOL_GOALS : u.length > 0 && ((S = (a = T[s.TEST_PREP]) == null ? void 0 : a.nextPage) == null ? void 0 : S.pageId) === s.STUDENT_ENRICHMENT && l.length === 0 ? s.TEST_PREP : E ? ((C = (A = T[s.LEARNING_LEVEL]) == null ? void 0 : A.prevPage) == null ? void 0 : C.pageId) ?? null : null;
50
- })(), I = _ ? E ? (O = T[s.LEARNING_LEVEL]) == null ? void 0 : O.nextPage : (h = T[(l == null ? void 0 : l.length) === 0 ? s.STUDENT_ENRICHMENT : s.TEST_PREP]) == null ? void 0 : h.nextPage : null;
51
- if (I && _) {
52
- const d = (a) => u.length === 0 && a === s.TEST_PREP || l.length === 0 && a === s.STUDENT_ENRICHMENT || E && a === s.LEARNING_LEVEL, N = f.pages.filter((a) => !d(a.id));
53
- f.pages = N.map((a) => {
54
- var S;
55
- return a.id === _ ? { ...a, nextPage: I } : a.id === I.pageId ? {
56
- ...a,
50
+ const y = { ...t }, g = Object.fromEntries(y.pages.map((s) => [s.id, s])), P = (() => {
51
+ var s, T, o, p, h, R, x, A;
52
+ return ((T = (s = g[i.SCHOOL_GOALS]) == null ? void 0 : s.nextPage) == null ? void 0 : T.pageId) === i.TEST_PREP && m.length === 0 ? i.SCHOOL_GOALS : m.length > 0 && ((p = (o = g[i.TEST_PREP]) == null ? void 0 : o.nextPage) == null ? void 0 : p.pageId) === i.STUDENT_ENRICHMENT && u.length === 0 ? i.TEST_PREP : S ? ((R = (h = g[i.LEARNING_LEVEL]) == null ? void 0 : h.prevPage) == null ? void 0 : R.pageId) ?? null : E ? null : ((A = (x = g[i.TOPIC_SELECTION]) == null ? void 0 : x.prevPage) == null ? void 0 : A.pageId) ?? null;
53
+ })(), L = (() => {
54
+ var s, T, o;
55
+ return P ? S ? ((s = g[i.LEARNING_LEVEL]) == null ? void 0 : s.nextPage) ?? null : E ? (o = g[(u == null ? void 0 : u.length) === 0 ? i.STUDENT_ENRICHMENT : i.TEST_PREP]) == null ? void 0 : o.nextPage : ((T = g[i.TOPIC_SELECTION]) == null ? void 0 : T.nextPage) ?? null : null;
56
+ })();
57
+ if (L && P) {
58
+ const s = (o) => m.length === 0 && o === i.TEST_PREP || u.length === 0 && o === i.STUDENT_ENRICHMENT || S && o === i.LEARNING_LEVEL || !E && o === i.TOPIC_SELECTION, T = y.pages.filter((o) => !s(o.id));
59
+ y.pages = T.map((o) => {
60
+ var p;
61
+ return o.id === P ? { ...o, nextPage: L } : o.id === L.pageId ? {
62
+ ...o,
57
63
  prevPage: {
58
- buttonLabel: ((S = T[_]) == null ? void 0 : S.navigationLabel) ?? "",
59
- pageId: _
64
+ buttonLabel: ((p = g[P]) == null ? void 0 : p.navigationLabel) ?? "",
65
+ pageId: P
60
66
  }
61
- } : a;
67
+ } : o;
62
68
  });
63
69
  }
64
- return f;
65
- }, Z = (n, t) => {
70
+ return y;
71
+ }, q = (n, t) => {
66
72
  var e;
67
- const { preference_config: r } = n;
68
- return t.length > 0 ? ((e = r == null ? void 0 : r.filter((o) => t.includes(o.preference_code))) == null ? void 0 : e.map(
69
- ({ preference_code: o, preference_name: c, preference_category: i, preference_description: g }) => ({
70
- preference_code: o,
71
- preference_name: c,
72
- preference_category: i,
73
- preference_description: g
73
+ const { preference_config: a } = n;
74
+ return t.length > 0 ? ((e = a == null ? void 0 : a.filter((r) => t.includes(r.preference_code))) == null ? void 0 : e.map(
75
+ ({ preference_code: r, preference_name: d, preference_category: c, preference_description: l }) => ({
76
+ preference_code: r,
77
+ preference_name: d,
78
+ preference_category: c,
79
+ preference_description: l
74
80
  })
75
81
  )) || [] : [];
76
- }, q = (n, t, r = !1) => {
82
+ }, z = (n, t, a = !1) => {
77
83
  if (!(n != null && n.length)) return [];
78
- if (r) {
79
- const e = n.find((o) => (o == null ? void 0 : o.preference_category) === t);
84
+ if (a) {
85
+ const e = n.find((r) => (r == null ? void 0 : r.preference_category) === t);
80
86
  return e ? [e.preference_code] : [];
81
87
  }
82
88
  return n.filter((e) => (e == null ? void 0 : e.preference_category) === t).map((e) => e.preference_code);
83
89
  };
84
90
  export {
85
- Y as filterAndUpdateSlideNavigation,
86
- B as getFormattedPreferences,
87
- Z as getFormattedStudentPersonalizedPreference,
88
- q as getPreferenceCodesByCategory,
89
- W as getWeekdayAndStartTimeFromPreference,
90
- V as isPLASource,
91
- j as updateGoalInFormData
91
+ Z as filterAndUpdateSlideNavigation,
92
+ W as getFormattedPreferences,
93
+ q as getFormattedStudentPersonalizedPreference,
94
+ z as getPreferenceCodesByCategory,
95
+ Y as getWeekdayAndStartTimeFromPreference,
96
+ j as isPLASource,
97
+ B as updateGoalInFormData
92
98
  };
93
99
  //# sourceMappingURL=helper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helper.js","sources":["../../../src/features/trial-session/helper.ts"],"sourcesContent":["import { DAYS } from '../../constants/date-time';\nimport {\n convertEpochToDateTime,\n convertToMilliseconds,\n getOffsetBetweenTimezone,\n getTimeUnits,\n} from '../../helpers/date-time';\nimport { GOAL_CATEGORY } from '../milestone/constants';\nimport { getGoalsFromConfig } from '../milestone/create/milestone-create-helpers';\nimport type { IMilestoneConfig } from '../milestone/create/milestone-create-types';\nimport type { TPreference } from './comps/class-preference/class-preference-types';\nimport {\n TrialPageId,\n TEACHER_TIMEZONE,\n HIGH_ENROLLMENT_PROGRAMS_MAP,\n} from './trial-session-constants';\nimport type { ITrialHomeData, TGoals, TPreferenceSchema } from './trial-session-types';\n\nconst isPLASource = (source?: string): boolean => {\n return source === 'PLA';\n};\n\nconst updateGoalInFormData = (goals: TGoals[] | undefined, goalCategory: string, data: TGoals) => {\n const updatedGoals = goals ? [...goals] : [];\n const goalIndex = updatedGoals.findIndex(goal => goal.goal_category === goalCategory);\n\n const goalWithCategory = {\n ...data,\n goal_category: goalCategory,\n };\n\n if (goalIndex === -1) {\n // Add new goal if it doesn't exist\n updatedGoals.push(goalWithCategory);\n } else {\n // Update existing goal\n updatedGoals[goalIndex] = {\n ...updatedGoals[goalIndex],\n ...goalWithCategory,\n };\n }\n\n // Filter out any goals without goal_code (cleanup existing data)\n return updatedGoals.filter(goal => goal.goal_code);\n};\n\nconst getFormattedPreferences = (preferences: TPreference[], studentTimezone?: string) => {\n if (!studentTimezone) return [];\n\n const todayTimestamp = new Date().setHours(0, 0, 0, 0); // Set the current date to midnight.\n const timestampOffset = getOffsetBetweenTimezone(TEACHER_TIMEZONE, studentTimezone); // Offset between the teacher's and student's timezone.\n const studentTimestamp = todayTimestamp + timestampOffset; // Adjusting the current date to the student's timezone.\n const { day: today = '' } = convertEpochToDateTime(studentTimestamp, studentTimezone); // Current day at student's timezone.\n const currentDayIndex = DAYS.indexOf(today); // Current day index.\n\n return preferences.length > 0\n ? preferences\n .filter(preference => preference.selectedDay && preference.selectedTime)\n .map(preference => {\n const { selectedDay, selectedTime } = preference;\n // Extracting hours, minutes, and period from the selected time.\n const { hours, minutes, period } = getTimeUnits(selectedTime);\n\n // Calculating the index of the selected day in the DAYS array.\n const selectedDayIndex = DAYS.indexOf(selectedDay);\n const dayDifference = (selectedDayIndex - currentDayIndex + 7) % 7;\n\n // Calculate the epoch timestamp for the selected day and time in the student's timezone.\n const epochTimestamp =\n todayTimestamp +\n timestampOffset +\n convertToMilliseconds({ days: dayDifference, hours, minutes });\n\n return {\n id: epochTimestamp,\n value: `${selectedDay}, ${selectedTime} - ${hours + 1}:${\n minutes < 10 ? '0' : ''\n }${minutes} ${period}`, // Formatted the value string as required\n };\n })\n : [];\n};\n\n/**\n * Converts a list of epoch timestamps to normalized weekday and start_time.\n * @param epochs Array of epoch timestamps (number)\n * @returns Array of { weekday, start_time }\n */\nconst getWeekdayAndStartTimeFromPreference = (\n preference: Array<{ id: number; value: string }>,\n): Array<{ weekday: string; start_time: string }> => {\n return preference\n .filter(pref => typeof pref.id === 'number' && !isNaN(pref.id))\n .map(pref => {\n const date = new Date(pref.id);\n // Get weekday in lowercase\n const weekdayRaw = DAYS[date.getDay()];\n const weekday = weekdayRaw ? weekdayRaw.toLowerCase() : 'unknown';\n // Get time in HH:MM:SS format\n const hour = date.getHours();\n const minute = date.getMinutes();\n const start_time = `${hour.toString().padStart(2, '0')}:${minute\n .toString()\n .padStart(2, '0')}:00`;\n\n return { weekday, start_time };\n });\n};\n\nconst filterAndUpdateSlideNavigation = ({\n milestoneConfigData,\n trialHomeData,\n grade,\n goal,\n}: {\n milestoneConfigData: IMilestoneConfig;\n trialHomeData: ITrialHomeData;\n grade?: string;\n goal?: string;\n}) => {\n const { student, demo_info: demoInfo } = trialHomeData;\n const { grade: studentGrade, enrollment_type: enrollmentType } = student || {};\n const { stream, region_data: regionData } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const getGoals = (goalCategory: keyof typeof GOAL_CATEGORY) =>\n getGoalsFromConfig(milestoneConfigData, {\n countryCode,\n grade: grade || studentGrade || '',\n goalCategory,\n courseStream: stream,\n enrollmentType: enrollmentType,\n });\n\n const testPrepGoals = getGoals(GOAL_CATEGORY.TEST_PREP);\n const enrichmentGoals = getGoals(GOAL_CATEGORY.ENRICHMENT);\n const isHighEnrollmentProgramSelected = getGoals(GOAL_CATEGORY.SCHOOL_SUCCESS).some(\n g => g.id === goal && Object.keys(HIGH_ENROLLMENT_PROGRAMS_MAP).includes(g.programCode ?? ''),\n );\n\n if (\n testPrepGoals?.length > 0 &&\n enrichmentGoals?.length > 0 &&\n !isHighEnrollmentProgramSelected\n ) {\n return trialHomeData;\n }\n\n const updatedTrialHomeData = { ...trialHomeData };\n\n const pagesMap = Object.fromEntries(updatedTrialHomeData.pages.map(page => [page.id, page]));\n\n //slide whose nextPage reference needs to be updated\n const slideIdToUpdate = (() => {\n if (\n pagesMap[TrialPageId.SCHOOL_GOALS]?.nextPage?.pageId === TrialPageId.TEST_PREP &&\n testPrepGoals.length === 0\n ) {\n return TrialPageId.SCHOOL_GOALS;\n }\n\n if (\n testPrepGoals.length > 0 &&\n pagesMap[TrialPageId.TEST_PREP]?.nextPage?.pageId === TrialPageId.STUDENT_ENRICHMENT &&\n enrichmentGoals.length === 0\n ) {\n return TrialPageId.TEST_PREP;\n }\n\n if (isHighEnrollmentProgramSelected) {\n return pagesMap[TrialPageId.LEARNING_LEVEL]?.prevPage?.pageId ?? null;\n }\n\n return null;\n })();\n\n // the new next page reference for slideIdToUpdate\n const updatedNextPageInfo = slideIdToUpdate\n ? isHighEnrollmentProgramSelected\n ? pagesMap[TrialPageId.LEARNING_LEVEL]?.nextPage\n : pagesMap[\n enrichmentGoals?.length === 0 ? TrialPageId.STUDENT_ENRICHMENT : TrialPageId.TEST_PREP\n ]?.nextPage\n : null;\n\n // updating the nextPage and prevPage references\n if (updatedNextPageInfo && slideIdToUpdate) {\n const shouldRemoveSlide = (slideId: TrialPageId) =>\n (testPrepGoals.length === 0 && slideId === TrialPageId.TEST_PREP) ||\n (enrichmentGoals.length === 0 && slideId === TrialPageId.STUDENT_ENRICHMENT) ||\n (isHighEnrollmentProgramSelected && slideId === TrialPageId.LEARNING_LEVEL);\n\n const filteredSlides = updatedTrialHomeData.pages.filter(page => !shouldRemoveSlide(page.id));\n\n updatedTrialHomeData.pages = filteredSlides.map(page => {\n if (page.id === slideIdToUpdate) {\n return { ...page, nextPage: updatedNextPageInfo };\n }\n\n if (page.id === updatedNextPageInfo.pageId) {\n return {\n ...page,\n prevPage: {\n buttonLabel: pagesMap[slideIdToUpdate]?.navigationLabel ?? '',\n pageId: slideIdToUpdate,\n },\n };\n }\n\n return page;\n });\n }\n\n return updatedTrialHomeData;\n};\n\nconst getFormattedStudentPersonalizedPreference = (\n config: IMilestoneConfig,\n selectedCodes: string[],\n) => {\n const { preference_config: preferenceConfig } = config;\n\n if (selectedCodes.length > 0) {\n return (\n preferenceConfig\n ?.filter(pref => selectedCodes.includes(pref.preference_code))\n ?.map(\n ({ preference_code, preference_name, preference_category, preference_description }) => ({\n preference_code,\n preference_name,\n preference_category,\n preference_description,\n }),\n ) || []\n );\n }\n\n return [];\n};\n\nconst getPreferenceCodesByCategory = (\n preferences: TPreferenceSchema[],\n category: string,\n returnFirstOnly: boolean = false,\n): string[] => {\n if (!preferences?.length) return [];\n\n if (returnFirstOnly) {\n const firstMatch = preferences.find(pref => pref?.preference_category === category);\n\n return firstMatch ? [firstMatch.preference_code] : [];\n }\n\n return preferences\n .filter(pref => pref?.preference_category === category)\n .map(pref => pref.preference_code);\n};\n\nexport {\n isPLASource,\n filterAndUpdateSlideNavigation,\n updateGoalInFormData,\n getFormattedPreferences,\n getWeekdayAndStartTimeFromPreference,\n getFormattedStudentPersonalizedPreference,\n getPreferenceCodesByCategory,\n};\n"],"names":["isPLASource","source","updateGoalInFormData","goals","goalCategory","data","updatedGoals","goalIndex","goal","goalWithCategory","getFormattedPreferences","preferences","studentTimezone","todayTimestamp","timestampOffset","getOffsetBetweenTimezone","TEACHER_TIMEZONE","studentTimestamp","today","convertEpochToDateTime","currentDayIndex","DAYS","preference","selectedDay","selectedTime","hours","minutes","period","getTimeUnits","dayDifference","convertToMilliseconds","getWeekdayAndStartTimeFromPreference","pref","date","weekdayRaw","weekday","hour","minute","start_time","filterAndUpdateSlideNavigation","milestoneConfigData","trialHomeData","grade","student","demoInfo","studentGrade","enrollmentType","stream","regionData","countryCode","getGoals","getGoalsFromConfig","testPrepGoals","GOAL_CATEGORY","enrichmentGoals","isHighEnrollmentProgramSelected","g","HIGH_ENROLLMENT_PROGRAMS_MAP","updatedTrialHomeData","pagesMap","page","slideIdToUpdate","_b","_a","TrialPageId","_d","_c","_f","_e","updatedNextPageInfo","shouldRemoveSlide","slideId","filteredSlides","getFormattedStudentPersonalizedPreference","config","selectedCodes","preferenceConfig","preference_code","preference_name","preference_category","preference_description","getPreferenceCodesByCategory","category","returnFirstOnly","firstMatch"],"mappings":";;;;;AAkBM,MAAAA,IAAc,CAACC,MACZA,MAAW,OAGdC,IAAuB,CAACC,GAA6BC,GAAsBC,MAAiB;AAChG,QAAMC,IAAeH,IAAQ,CAAC,GAAGA,CAAK,IAAI,CAAA,GACpCI,IAAYD,EAAa,UAAU,CAAQE,MAAAA,EAAK,kBAAkBJ,CAAY,GAE9EK,IAAmB;AAAA,IACvB,GAAGJ;AAAA,IACH,eAAeD;AAAA,EAAA;AAGjB,SAAIG,MAAc,KAEhBD,EAAa,KAAKG,CAAgB,IAGlCH,EAAaC,CAAS,IAAI;AAAA,IACxB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E5C,SAAAC,EAAc,SAAS,MAEvBZ,IAAAa,KAAA,gBAAAA,EACI,OAAO,CAAQ5C,MAAA2C,EAAc,SAAS3C,EAAK,eAAe,OAD9D,gBAAA+B,EAEI;AAAA,IACA,CAAC,EAAE,iBAAAc,GAAiB,iBAAAC,GAAiB,qBAAAC,GAAqB,wBAAAC,SAA8B;AAAA,MACtF,iBAAAH;AAAA,MACA,iBAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,wBAAAC;AAAA,IAAA;AAAA,QAEC,KAIJ;AACT,GAEMC,IAA+B,CACnCtE,GACAuE,GACAC,IAA2B,OACd;AACb,MAAI,EAACxE,KAAA,QAAAA,EAAa,QAAQ,QAAO;AAEjC,MAAIwE,GAAiB;AACnB,UAAMC,IAAazE,EAAY,KAAK,CAAQqB,OAAAA,KAAA,gBAAAA,EAAM,yBAAwBkD,CAAQ;AAElF,WAAOE,IAAa,CAACA,EAAW,eAAe,IAAI,CAAA;AAAA,EACrD;AAEO,SAAAzE,EACJ,OAAO,CAAAqB,OAAQA,KAAA,gBAAAA,EAAM,yBAAwBkD,CAAQ,EACrD,IAAI,CAAQlD,MAAAA,EAAK,eAAe;AACrC;"}
1
+ {"version":3,"file":"helper.js","sources":["../../../src/features/trial-session/helper.ts"],"sourcesContent":["import { DAYS } from '../../constants/date-time';\nimport {\n convertEpochToDateTime,\n convertToMilliseconds,\n getOffsetBetweenTimezone,\n getTimeUnits,\n} from '../../helpers/date-time';\nimport { GOAL_CATEGORY } from '../milestone/constants';\nimport { getGoalsFromConfig } from '../milestone/create/milestone-create-helpers';\nimport type { IMilestoneConfig } from '../milestone/create/milestone-create-types';\nimport type { TPreference } from './comps/class-preference/class-preference-types';\nimport {\n TrialPageId,\n TEACHER_TIMEZONE,\n HIGH_ENROLLMENT_PROGRAMS_MAP,\n} from './trial-session-constants';\nimport type { ITrialHomeData, TGoals, TPreferenceSchema } from './trial-session-types';\n\nconst isPLASource = (source?: string): boolean => {\n return source === 'PLA';\n};\n\nconst updateGoalInFormData = (goals: TGoals[] | undefined, goalCategory: string, data: TGoals) => {\n const updatedGoals = goals ? [...goals] : [];\n const goalIndex = updatedGoals.findIndex(goal => goal.goal_category === goalCategory);\n\n const goalWithCategory = {\n ...data,\n goal_category: goalCategory,\n };\n\n if (goalIndex === -1) {\n // Add new goal if it doesn't exist\n updatedGoals.push(goalWithCategory);\n } else {\n // Update existing goal\n updatedGoals[goalIndex] = {\n ...updatedGoals[goalIndex],\n ...goalWithCategory,\n };\n }\n\n // Filter out any goals without goal_code (cleanup existing data)\n return updatedGoals.filter(goal => goal.goal_code);\n};\n\nconst getFormattedPreferences = (preferences: TPreference[], studentTimezone?: string) => {\n if (!studentTimezone) return [];\n\n const todayTimestamp = new Date().setHours(0, 0, 0, 0); // Set the current date to midnight.\n const timestampOffset = getOffsetBetweenTimezone(TEACHER_TIMEZONE, studentTimezone); // Offset between the teacher's and student's timezone.\n const studentTimestamp = todayTimestamp + timestampOffset; // Adjusting the current date to the student's timezone.\n const { day: today = '' } = convertEpochToDateTime(studentTimestamp, studentTimezone); // Current day at student's timezone.\n const currentDayIndex = DAYS.indexOf(today); // Current day index.\n\n return preferences.length > 0\n ? preferences\n .filter(preference => preference.selectedDay && preference.selectedTime)\n .map(preference => {\n const { selectedDay, selectedTime } = preference;\n // Extracting hours, minutes, and period from the selected time.\n const { hours, minutes, period } = getTimeUnits(selectedTime);\n\n // Calculating the index of the selected day in the DAYS array.\n const selectedDayIndex = DAYS.indexOf(selectedDay);\n const dayDifference = (selectedDayIndex - currentDayIndex + 7) % 7;\n\n // Calculate the epoch timestamp for the selected day and time in the student's timezone.\n const epochTimestamp =\n todayTimestamp +\n timestampOffset +\n convertToMilliseconds({ days: dayDifference, hours, minutes });\n\n return {\n id: epochTimestamp,\n value: `${selectedDay}, ${selectedTime} - ${hours + 1}:${\n minutes < 10 ? '0' : ''\n }${minutes} ${period}`, // Formatted the value string as required\n };\n })\n : [];\n};\n\n/**\n * Converts a list of epoch timestamps to normalized weekday and start_time.\n * @param epochs Array of epoch timestamps (number)\n * @returns Array of { weekday, start_time }\n */\nconst getWeekdayAndStartTimeFromPreference = (\n preference: Array<{ id: number; value: string }>,\n): Array<{ weekday: string; start_time: string }> => {\n return preference\n .filter(pref => typeof pref.id === 'number' && !isNaN(pref.id))\n .map(pref => {\n const date = new Date(pref.id);\n // Get weekday in lowercase\n const weekdayRaw = DAYS[date.getDay()];\n const weekday = weekdayRaw ? weekdayRaw.toLowerCase() : 'unknown';\n // Get time in HH:MM:SS format\n const hour = date.getHours();\n const minute = date.getMinutes();\n const start_time = `${hour.toString().padStart(2, '0')}:${minute\n .toString()\n .padStart(2, '0')}:00`;\n\n return { weekday, start_time };\n });\n};\n\nconst filterAndUpdateSlideNavigation = ({\n milestoneConfigData,\n trialHomeData,\n grade,\n goal,\n}: {\n milestoneConfigData: IMilestoneConfig;\n trialHomeData: ITrialHomeData;\n grade?: string;\n goal?: string;\n}) => {\n const { student, demo_info: demoInfo } = trialHomeData;\n const {\n grade: studentGrade,\n enrollment_type: enrollmentType,\n can_show_topic_selection: canShowTopicSelection = true,\n } = student || {};\n const { stream, region_data: regionData } = demoInfo || {};\n const { opportunity_country: countryCode = 'US' } = regionData || {};\n\n const getGoals = (goalCategory: keyof typeof GOAL_CATEGORY) =>\n getGoalsFromConfig(milestoneConfigData, {\n countryCode,\n grade: grade || studentGrade || '',\n goalCategory,\n courseStream: stream,\n enrollmentType: enrollmentType,\n });\n\n const testPrepGoals = getGoals(GOAL_CATEGORY.TEST_PREP);\n const enrichmentGoals = getGoals(GOAL_CATEGORY.ENRICHMENT);\n const isHighEnrollmentProgramSelected = getGoals(GOAL_CATEGORY.SCHOOL_SUCCESS).some(\n g => g.id === goal && Object.keys(HIGH_ENROLLMENT_PROGRAMS_MAP).includes(g.programCode ?? ''),\n );\n\n if (\n testPrepGoals?.length > 0 &&\n enrichmentGoals?.length > 0 &&\n !isHighEnrollmentProgramSelected &&\n canShowTopicSelection\n ) {\n return trialHomeData;\n }\n\n const updatedTrialHomeData = { ...trialHomeData };\n\n const pagesMap = Object.fromEntries(updatedTrialHomeData.pages.map(page => [page.id, page]));\n\n //slide whose nextPage reference needs to be updated\n const slideIdToUpdate = (() => {\n if (\n pagesMap[TrialPageId.SCHOOL_GOALS]?.nextPage?.pageId === TrialPageId.TEST_PREP &&\n testPrepGoals.length === 0\n ) {\n return TrialPageId.SCHOOL_GOALS;\n }\n\n if (\n testPrepGoals.length > 0 &&\n pagesMap[TrialPageId.TEST_PREP]?.nextPage?.pageId === TrialPageId.STUDENT_ENRICHMENT &&\n enrichmentGoals.length === 0\n ) {\n return TrialPageId.TEST_PREP;\n }\n\n if (isHighEnrollmentProgramSelected) {\n return pagesMap[TrialPageId.LEARNING_LEVEL]?.prevPage?.pageId ?? null;\n }\n\n if (!canShowTopicSelection) {\n return pagesMap[TrialPageId.TOPIC_SELECTION]?.prevPage?.pageId ?? null;\n }\n\n return null;\n })();\n\n // the new next page reference for slideIdToUpdate\n const updatedNextPageInfo = (() => {\n if (!slideIdToUpdate) return null;\n\n if (isHighEnrollmentProgramSelected) {\n return pagesMap[TrialPageId.LEARNING_LEVEL]?.nextPage ?? null;\n }\n\n if (!canShowTopicSelection) {\n return pagesMap[TrialPageId.TOPIC_SELECTION]?.nextPage ?? null;\n }\n\n return pagesMap[\n enrichmentGoals?.length === 0 ? TrialPageId.STUDENT_ENRICHMENT : TrialPageId.TEST_PREP\n ]?.nextPage;\n })();\n\n // updating the nextPage and prevPage references\n if (updatedNextPageInfo && slideIdToUpdate) {\n const shouldRemoveSlide = (slideId: TrialPageId) =>\n (testPrepGoals.length === 0 && slideId === TrialPageId.TEST_PREP) ||\n (enrichmentGoals.length === 0 && slideId === TrialPageId.STUDENT_ENRICHMENT) ||\n (isHighEnrollmentProgramSelected && slideId === TrialPageId.LEARNING_LEVEL) ||\n (!canShowTopicSelection && slideId === TrialPageId.TOPIC_SELECTION);\n\n const filteredSlides = updatedTrialHomeData.pages.filter(page => !shouldRemoveSlide(page.id));\n\n updatedTrialHomeData.pages = filteredSlides.map(page => {\n if (page.id === slideIdToUpdate) {\n return { ...page, nextPage: updatedNextPageInfo };\n }\n\n if (page.id === updatedNextPageInfo.pageId) {\n return {\n ...page,\n prevPage: {\n buttonLabel: pagesMap[slideIdToUpdate]?.navigationLabel ?? '',\n pageId: slideIdToUpdate,\n },\n };\n }\n\n return page;\n });\n }\n\n return updatedTrialHomeData;\n};\n\nconst getFormattedStudentPersonalizedPreference = (\n config: IMilestoneConfig,\n selectedCodes: string[],\n) => {\n const { preference_config: preferenceConfig } = config;\n\n if (selectedCodes.length > 0) {\n return (\n preferenceConfig\n ?.filter(pref => selectedCodes.includes(pref.preference_code))\n ?.map(\n ({ preference_code, preference_name, preference_category, preference_description }) => ({\n preference_code,\n preference_name,\n preference_category,\n preference_description,\n }),\n ) || []\n );\n }\n\n return [];\n};\n\nconst getPreferenceCodesByCategory = (\n preferences: TPreferenceSchema[],\n category: string,\n returnFirstOnly: boolean = false,\n): string[] => {\n if (!preferences?.length) return [];\n\n if (returnFirstOnly) {\n const firstMatch = preferences.find(pref => pref?.preference_category === category);\n\n return firstMatch ? [firstMatch.preference_code] : [];\n }\n\n return preferences\n .filter(pref => pref?.preference_category === category)\n .map(pref => pref.preference_code);\n};\n\nexport {\n isPLASource,\n filterAndUpdateSlideNavigation,\n updateGoalInFormData,\n getFormattedPreferences,\n getWeekdayAndStartTimeFromPreference,\n getFormattedStudentPersonalizedPreference,\n getPreferenceCodesByCategory,\n};\n"],"names":["isPLASource","source","updateGoalInFormData","goals","goalCategory","data","updatedGoals","goalIndex","goal","goalWithCategory","getFormattedPreferences","preferences","studentTimezone","todayTimestamp","timestampOffset","getOffsetBetweenTimezone","TEACHER_TIMEZONE","studentTimestamp","today","convertEpochToDateTime","currentDayIndex","DAYS","preference","selectedDay","selectedTime","hours","minutes","period","getTimeUnits","dayDifference","convertToMilliseconds","getWeekdayAndStartTimeFromPreference","pref","date","weekdayRaw","weekday","hour","minute","start_time","filterAndUpdateSlideNavigation","milestoneConfigData","trialHomeData","grade","student","demoInfo","studentGrade","enrollmentType","canShowTopicSelection","stream","regionData","countryCode","getGoals","getGoalsFromConfig","testPrepGoals","GOAL_CATEGORY","enrichmentGoals","isHighEnrollmentProgramSelected","g","HIGH_ENROLLMENT_PROGRAMS_MAP","updatedTrialHomeData","pagesMap","page","slideIdToUpdate","_b","_a","TrialPageId","_d","_c","_f","_e","_h","_g","updatedNextPageInfo","shouldRemoveSlide","slideId","filteredSlides","getFormattedStudentPersonalizedPreference","config","selectedCodes","preferenceConfig","preference_code","preference_name","preference_category","preference_description","getPreferenceCodesByCategory","category","returnFirstOnly","firstMatch"],"mappings":";;;;;AAkBM,MAAAA,IAAc,CAACC,MACZA,MAAW,OAGdC,IAAuB,CAACC,GAA6BC,GAAsBC,MAAiB;AAChG,QAAMC,IAAeH,IAAQ,CAAC,GAAGA,CAAK,IAAI,CAAA,GACpCI,IAAYD,EAAa,UAAU,CAAQE,MAAAA,EAAK,kBAAkBJ,CAAY,GAE9EK,IAAmB;AAAA,IACvB,GAAGJ;AAAA,IACH,eAAeD;AAAA,EAAA;AAGjB,SAAIG,MAAc,KAEhBD,EAAa,KAAKG,CAAgB,IAGlCH,EAAaC,CAAS,IAAI;AAAA,IACxB,GAAGD,EAAaC,CAAS;AAAA,IACzB,GAAGE;AAAA,EAAA,GAKAH,EAAa,OAAO,CAAQE,MAAAA,EAAK,SAAS;AACnD,GAEME,IAA0B,CAACC,GAA4BC,MAA6B;AACpF,MAAA,CAACA,EAAiB,QAAO;AAEvB,QAAAC,yBAAqB,QAAO,SAAS,GAAG,GAAG,GAAG,CAAC,GAC/CC,IAAkBC,EAAyBC,GAAkBJ,CAAe,GAC5EK,IAAmBJ,IAAiBC,GACpC,EAAE,KAAKI,IAAQ,GAAO,IAAAC,EAAuBF,GAAkBL,CAAe,GAC9EQ,IAAkBC,EAAK,QAAQH,CAAK;AAE1C,SAAOP,EAAY,SAAS,IACxBA,EACG,OAAO,CAA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