catchup-library-web 1.0.0 → 1.0.2

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 (51) hide show
  1. package/dist/index.d.mts +239 -2
  2. package/dist/index.d.ts +239 -2
  3. package/dist/index.js +4686 -2
  4. package/dist/index.mjs +4621 -1
  5. package/package.json +10 -2
  6. package/src/components/activities/DropdownActivityContent.tsx +73 -0
  7. package/src/components/activities/FillInTheBlanksActivityContent.tsx +102 -0
  8. package/src/components/activities/GroupingActivityContent.tsx +62 -0
  9. package/src/components/activities/MCMAActivityContent.tsx +65 -0
  10. package/src/components/activities/MCSAActivityContent.tsx +58 -0
  11. package/src/components/activities/MatchingActivityContent.tsx +57 -0
  12. package/src/components/activities/OpenEndedActivityContent.tsx +92 -0
  13. package/src/components/activities/OrderingActivityContent.tsx +59 -0
  14. package/src/components/activities/TrueFalseActivityContent.tsx +98 -0
  15. package/src/components/activities/body-content/ActivityBodyContent.tsx +108 -0
  16. package/src/components/activities/body-content/ShowBodyMediaByContentType.tsx +404 -0
  17. package/src/components/activities/empty-content/ActivityEmptyContent.tsx +15 -0
  18. package/src/components/activities/material-content/DropdownActivityMaterialContent.tsx +227 -0
  19. package/src/components/activities/material-content/FillInTheBlanksActivityMaterialContent.tsx +270 -0
  20. package/src/components/activities/material-content/GroupingActivityMaterialContent.tsx +359 -0
  21. package/src/components/activities/material-content/MCMAActivityMaterialContent.tsx +166 -0
  22. package/src/components/activities/material-content/MCSAActivityMaterialContent.tsx +165 -0
  23. package/src/components/activities/material-content/MatchingActivityMaterialContent.tsx +332 -0
  24. package/src/components/activities/material-content/OpenEndedActivityMaterialContent.tsx +818 -0
  25. package/src/components/activities/material-content/OrderingActivityMaterialContent.tsx +216 -0
  26. package/src/components/activities/material-content/ShowMaterialMediaByContentType.tsx +172 -0
  27. package/src/components/activities/material-content/TrueFalseActivityMaterialContent.tsx +217 -0
  28. package/src/components/activities/solution-content/ActivitySolutionContent.tsx +86 -0
  29. package/src/components/dividers/BlueVerticalDividerLine.tsx +13 -0
  30. package/src/components/dividers/DividerLine.tsx +5 -0
  31. package/src/components/dividers/VerticalDividerLine.tsx +5 -0
  32. package/src/components/dnds/DraggableDroppableItem.tsx +62 -0
  33. package/src/components/dnds/DraggableItem.tsx +41 -0
  34. package/src/components/dnds/DroppableItem.tsx +38 -0
  35. package/src/components/dropdowns/MediaDropdown.tsx +51 -0
  36. package/src/components/groups/InputGroup.tsx +330 -0
  37. package/src/hooks/useScreenSize.ts +40 -0
  38. package/src/index.ts +24 -0
  39. package/src/language/i18n.ts +10 -0
  40. package/src/properties/ActivityProperties.ts +204 -0
  41. package/src/properties/ButtonProperties.ts +1 -1
  42. package/src/properties/CommonProperties.ts +1 -1
  43. package/src/properties/DividerLineProperties.ts +3 -0
  44. package/src/properties/DnDProperties.ts +28 -0
  45. package/src/properties/DropdownProperties.ts +5 -0
  46. package/src/properties/EnumProperties.ts +11 -0
  47. package/src/properties/GroupProperties.ts +19 -0
  48. package/src/utilization/AppUtilization.ts +56 -0
  49. package/src/utilization/CatchtivityUtilization.ts +1566 -0
  50. package/src/utilization/StorageUtilization.ts +35 -0
  51. package/tsconfig.json +2 -1
package/dist/index.js CHANGED
@@ -1,8 +1,27 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
3
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
7
  var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
5
10
  var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
6
25
  var __export = (target, all) => {
7
26
  for (var name in all)
8
27
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -15,6 +34,14 @@ var __copyProps = (to, from, except, desc) => {
15
34
  }
16
35
  return to;
17
36
  };
37
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
+ // If the importer is in node compatibility mode or this is not an ESM
39
+ // file that has been converted to a CommonJS file using a Babel-
40
+ // compatible transform (i.e. "__esModule" has not been set), then set
41
+ // "default" to the CommonJS "module.exports" for node compatibility.
42
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
+ mod
44
+ ));
18
45
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
46
  var __async = (__this, __arguments, generator) => {
20
47
  return new Promise((resolve, reject) => {
@@ -43,11 +70,67 @@ __export(index_exports, {
43
70
  ApproveButton: () => ApproveButton_default,
44
71
  BaseImage: () => BaseImage_default,
45
72
  BaseLoading: () => BaseLoading_default,
73
+ BlueVerticalDividerLine: () => BlueVerticalDividerLine_default,
46
74
  CancelButton: () => CancelButton_default,
47
75
  CreateButton: () => CreateButton_default,
48
76
  DeleteButton: () => DeleteButton_default,
77
+ DividerLine: () => DividerLine_default,
78
+ DropdownActivityContent: () => DropdownActivityContent_default,
79
+ FillInTheBlanksActivityContent: () => FillInTheBlanksActivityContent_default,
80
+ GroupingActivityContent: () => GroupingActivityContent_default,
81
+ InputGroup: () => InputGroup_default,
82
+ MCMAActivityContent: () => MCMAActivityContent_default,
83
+ MCSAActivityContent: () => MCSAActivityContent_default,
84
+ MatchingActivityContent: () => MatchingActivityContent_default,
85
+ OpenEndedActivityContent: () => OpenEndedActivityContent_default,
86
+ OrderingActivityContent: () => OrderingActivityContent_default,
49
87
  PrimaryButton: () => PrimaryButton_default,
50
- SecondaryButton: () => SecondaryButton_default
88
+ SecondaryButton: () => SecondaryButton_default,
89
+ TrueFalseActivityContent: () => TrueFalseActivityContent_default,
90
+ VerticalDividerLine: () => VerticalDividerLine_default,
91
+ checkActivityAnswerState: () => checkActivityAnswerState,
92
+ checkIfAnswerIsEmpty: () => checkIfAnswerIsEmpty,
93
+ constructActivityAnswerMap: () => constructActivityAnswerMap,
94
+ constructActivityAnswerStateList: () => constructActivityAnswerStateList,
95
+ constructActivityItemListWithAnswersForAI: () => constructActivityItemListWithAnswersForAI,
96
+ constructActivityItemListWithSolutionForAI: () => constructActivityItemListWithSolutionForAI,
97
+ constructInputWithSpecialExpressionList: () => constructInputWithSpecialExpressionList,
98
+ convertDataURLtoFile: () => convertDataURLtoFile,
99
+ findBestFitActivity: () => findBestFitActivity,
100
+ getColorByIndex: () => getColorByIndex,
101
+ i18n: () => i18n_default,
102
+ ignoreMathematicalExpression: () => ignoreMathematicalExpression,
103
+ parseBodyMapFromData: () => parseBodyMapFromData,
104
+ parseContentMapFromData: () => parseContentMapFromData,
105
+ parseMaterialMapFromData: () => parseMaterialMapFromData,
106
+ retrieveActivityAnswerFromAnswerList: () => retrieveActivityAnswerFromAnswerList,
107
+ retrieveActivityTemplateDTOOptionList: () => retrieveActivityTemplateDTOOptionList,
108
+ retrieveClockTimeLeft: () => retrieveClockTimeLeft,
109
+ retrieveColorByScore: () => retrieveColorByScore,
110
+ retrieveContentTypeOptionList: () => retrieveContentTypeOptionList,
111
+ retrieveContestTypeOptionList: () => retrieveContestTypeOptionList,
112
+ retrieveCoterieTypeFromStandardExamCoterieType: () => retrieveCoterieTypeFromStandardExamCoterieType,
113
+ retrieveCurrentDefaultDataMap: () => retrieveCurrentDefaultDataMap,
114
+ retrieveDistintCoterieTypeFromCatchtivityApplicationDTO: () => retrieveDistintCoterieTypeFromCatchtivityApplicationDTO,
115
+ retrieveDocumentTypeFromAcceptedFormat: () => retrieveDocumentTypeFromAcceptedFormat,
116
+ retrieveDocumentTypeFromExtension: () => retrieveDocumentTypeFromExtension,
117
+ retrieveDurationInMinutesOptionList: () => retrieveDurationInMinutesOptionList,
118
+ retrieveDurationInSecondsOptionList: () => retrieveDurationInSecondsOptionList,
119
+ retrieveDurationTypeOptionList: () => retrieveDurationTypeOptionList,
120
+ retrieveEachTimeSpentInSeconds: () => retrieveEachTimeSpentInSeconds,
121
+ retrieveFrequencyTypeOptionList: () => retrieveFrequencyTypeOptionList,
122
+ retrieveStandardExamCoterieTypeOptionListByStandardExamType: () => retrieveStandardExamCoterieTypeOptionListByStandardExamType,
123
+ retrieveStandardExamTypeIcon: () => retrieveStandardExamTypeIcon,
124
+ retrieveStandardExamTypeOptionList: () => retrieveStandardExamTypeOptionList,
125
+ retrieveStatusOptionList: () => retrieveStatusOptionList,
126
+ retrieveTaxonomyGroupName: () => retrieveTaxonomyGroupName,
127
+ retrieveTaxonomyName: () => retrieveTaxonomyName,
128
+ retrieveTaxonomyType: () => retrieveTaxonomyType,
129
+ retrieveTotalTimeSpentInMinutes: () => retrieveTotalTimeSpentInMinutes,
130
+ retrieveTotalTimeSpentInSeconds: () => retrieveTotalTimeSpentInSeconds,
131
+ retrieveValidationRequirementList: () => retrieveValidationRequirementList,
132
+ shuffleArray: () => shuffleArray,
133
+ useScreenSize: () => useScreenSize_default
51
134
  });
52
135
  module.exports = __toCommonJS(index_exports);
53
136
 
@@ -661,14 +744,4615 @@ var ApproveButton = ({
661
744
  );
662
745
  };
663
746
  var ApproveButton_default = ApproveButton;
747
+
748
+ // src/language/i18n.ts
749
+ var import_i18next = __toESM(require("i18next"));
750
+ var import_react_i18next = require("react-i18next");
751
+ import_i18next.default.use(import_react_i18next.initReactI18next);
752
+ var i18n_default = import_i18next.default;
753
+
754
+ // src/utilization/CatchtivityUtilization.ts
755
+ var retrieveColorByScore = (score) => {
756
+ if (score <= 25) {
757
+ return "#F96666";
758
+ } else if (score > 25 && score <= 50) {
759
+ return "#f98d66";
760
+ } else if (score > 50 && score <= 75) {
761
+ return "#cbd357";
762
+ } else {
763
+ return "#ABD357";
764
+ }
765
+ };
766
+ var retrieveContentTypeOptionList = (textOnly) => {
767
+ if (textOnly) {
768
+ return [
769
+ {
770
+ id: "TEXT",
771
+ value: "TEXT",
772
+ text: i18n_default.t("TEXT"),
773
+ icon: "/icons/text-gray.png"
774
+ }
775
+ ];
776
+ } else {
777
+ return [
778
+ {
779
+ id: "TEXT",
780
+ value: "TEXT",
781
+ text: i18n_default.t("TEXT"),
782
+ icon: "/icons/text-gray.png"
783
+ },
784
+ {
785
+ id: "IMAGE",
786
+ value: "IMAGE",
787
+ text: i18n_default.t("IMAGE"),
788
+ icon: "/icons/image-gray.png"
789
+ },
790
+ {
791
+ id: "VIDEO",
792
+ value: "VIDEO",
793
+ text: i18n_default.t("VIDEO"),
794
+ icon: "/icons/video-gray.png"
795
+ },
796
+ {
797
+ id: "AUDIO",
798
+ value: "AUDIO",
799
+ text: i18n_default.t("AUDIO"),
800
+ icon: "/icons/audio-gray.png"
801
+ }
802
+ ];
803
+ }
804
+ };
805
+ var retrieveStatusOptionList = () => {
806
+ return [
807
+ {
808
+ value: "ACTIVE",
809
+ text: i18n_default.t("ACTIVE")
810
+ },
811
+ {
812
+ value: "PASSIVE",
813
+ text: i18n_default.t("PASSIVE")
814
+ }
815
+ ];
816
+ };
817
+ var retrieveDurationTypeOptionList = () => {
818
+ return [
819
+ { value: "NONE", text: i18n_default.t("NONE") },
820
+ { value: "ALL", text: i18n_default.t("ALL") },
821
+ { value: "EACH", text: i18n_default.t("EACH") }
822
+ ];
823
+ };
824
+ var retrieveDurationInMinutesOptionList = (durationType) => {
825
+ if (durationType === "ALL") {
826
+ return [
827
+ { value: 15, text: 15 },
828
+ { value: 30, text: 30 },
829
+ { value: 45, text: 45 },
830
+ { value: 60, text: 60 },
831
+ { value: 75, text: 75 },
832
+ { value: 90, text: 90 },
833
+ { value: 105, text: 105 },
834
+ { value: 120, text: 120 }
835
+ ];
836
+ } else if (durationType === "EACH") {
837
+ return [
838
+ { value: 1, text: 1 },
839
+ { value: 2, text: 2 },
840
+ { value: 3, text: 3 },
841
+ { value: 5, text: 5 },
842
+ { value: 10, text: 10 }
843
+ ];
844
+ }
845
+ return [];
846
+ };
847
+ var retrieveDurationInSecondsOptionList = () => {
848
+ return [
849
+ { value: 15, text: `15 ${i18n_default.t("seconds")}` },
850
+ { value: 20, text: `20 ${i18n_default.t("seconds")}` },
851
+ { value: 25, text: `25 ${i18n_default.t("seconds")}` },
852
+ { value: 30, text: `30 ${i18n_default.t("seconds")}` },
853
+ { value: 35, text: `35 ${i18n_default.t("seconds")}` },
854
+ { value: 40, text: `40 ${i18n_default.t("seconds")}` },
855
+ { value: 45, text: `45 ${i18n_default.t("seconds")}` }
856
+ ];
857
+ };
858
+ var retrieveTaxonomyType = () => {
859
+ return [
860
+ {
861
+ value: "BLOOM",
862
+ text: i18n_default.t("BLOOM")
863
+ }
864
+ ];
865
+ };
866
+ var retrieveTaxonomyGroupName = () => {
867
+ return [
868
+ {
869
+ type: "BLOOM",
870
+ value: "BLOOM",
871
+ text: i18n_default.t("BLOOM")
872
+ }
873
+ ];
874
+ };
875
+ var retrieveTaxonomyName = () => {
876
+ return [
877
+ {
878
+ stage: 1,
879
+ groupName: "BLOOM",
880
+ value: "REMEMBER",
881
+ text: i18n_default.t("REMEMBER")
882
+ },
883
+ {
884
+ stage: 2,
885
+ groupName: "BLOOM",
886
+ value: "UNDERSTAND",
887
+ text: i18n_default.t("UNDERSTAND")
888
+ },
889
+ {
890
+ stage: 3,
891
+ groupName: "BLOOM",
892
+ value: "APPLY",
893
+ text: i18n_default.t("APPLY")
894
+ },
895
+ {
896
+ stage: 4,
897
+ groupName: "BLOOM",
898
+ value: "ANALYZE",
899
+ text: i18n_default.t("ANALYZE")
900
+ },
901
+ {
902
+ stage: 5,
903
+ groupName: "BLOOM",
904
+ value: "EVALUATE",
905
+ text: i18n_default.t("EVALUATE")
906
+ },
907
+ {
908
+ stage: 6,
909
+ groupName: "BLOOM",
910
+ value: "CREATE",
911
+ text: i18n_default.t("CREATE")
912
+ }
913
+ ];
914
+ };
915
+ var constructInputWithSpecialExpressionList = (inputText) => {
916
+ const inputPartList = [];
917
+ if (!inputText) return [];
918
+ const splittedBold = inputText.split("**");
919
+ let isBold = false;
920
+ for (let i = 0; i < splittedBold.length; i++) {
921
+ let isUnderline = false;
922
+ const splittedUnderline = splittedBold[i].split("__");
923
+ for (let j = 0; j < splittedUnderline.length; j++) {
924
+ let isEquation = false;
925
+ const splittedEquation = splittedUnderline[j].split("`");
926
+ for (let k = 0; k < splittedEquation.length; k++) {
927
+ inputPartList.push({
928
+ value: splittedEquation[k],
929
+ isEquation,
930
+ isUnderline,
931
+ isBold
932
+ });
933
+ isEquation = !isEquation;
934
+ }
935
+ isUnderline = !isUnderline;
936
+ }
937
+ isBold = !isBold;
938
+ }
939
+ return inputPartList;
940
+ };
941
+ var retrieveStandardExamTypeOptionList = () => {
942
+ return [
943
+ { value: "AYT", text: "AYT" },
944
+ { value: "TYT", text: "TYT" },
945
+ { value: "LGS", text: "LGS" }
946
+ ];
947
+ };
948
+ var retrieveStandardExamTypeIcon = (baseReportType) => {
949
+ if (baseReportType === "TYT") {
950
+ return "/icons/tyt.png";
951
+ } else if (baseReportType === "AYT") {
952
+ return "/icons/ayt.png";
953
+ } else if (baseReportType === "LGS") {
954
+ return "/icons/lgs.png";
955
+ }
956
+ };
957
+ var retrieveCoterieTypeFromStandardExamCoterieType = (standardExamType, standardExamCoterieType) => {
958
+ if (standardExamCoterieType === "TURKISH") {
959
+ return "TURKISH";
960
+ } else if (standardExamCoterieType === "SCIENCE") {
961
+ return "SCIENCE";
962
+ } else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "PHYSICS") {
963
+ return "PHYSICS";
964
+ } else if (standardExamType === "LGS" && standardExamCoterieType === "PHYSICS") {
965
+ return "SOCIAL_STUDIES";
966
+ } else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "CHEMISTRY") {
967
+ return "CHEMISTRY";
968
+ } else if (standardExamType === "LGS" && standardExamCoterieType === "CHEMISTRY") {
969
+ return "SOCIAL_STUDIES";
970
+ } else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "BIOLOGY") {
971
+ return "BIOLOGY";
972
+ } else if (standardExamType === "LGS" && standardExamCoterieType === "BIOLOGY") {
973
+ return "SOCIAL_STUDIES";
974
+ } else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "HISTORY") {
975
+ return "HISTORY";
976
+ } else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "GEOGRAPHY") {
977
+ return "GEOGRAPHY";
978
+ } else if (standardExamType === "LGS" && standardExamCoterieType === "HISTORY" || standardExamType === "LGS" && standardExamCoterieType === "GEOGRAPHY" || standardExamCoterieType === "REVOLUTION_HISTORY") {
979
+ return "SOCIAL_STUDIES";
980
+ } else if (standardExamCoterieType === "HISTORY_I" || standardExamCoterieType === "HISTORY_II") {
981
+ return "HISTORY";
982
+ } else if (standardExamCoterieType === "GEOGRAPHY_I" || standardExamCoterieType === "GEOGRAPHY_II") {
983
+ return "GEOGRAPHY";
984
+ } else if (standardExamCoterieType === "MATHEMATICS" || standardExamCoterieType === "GEOMETRY") {
985
+ return "MATHEMATICS";
986
+ } else if (standardExamCoterieType === "PHILOSOPHY" || standardExamCoterieType === "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE") {
987
+ return "PHILOSOPHY";
988
+ } else if ((standardExamType === "TYT" || standardExamType === "AYT") && standardExamCoterieType === "CULTURE_AND_RELIGION_KNOWLEDGE") {
989
+ return "CULTURE_AND_RELIGION_KNOWLEDGE";
990
+ } else if (standardExamType === "LGS" && standardExamCoterieType === "CULTURE_AND_RELIGION_KNOWLEDGE") {
991
+ return "CULTURE_AND_RELIGION_KNOWLEDGE";
992
+ } else if (standardExamCoterieType === "ENGLISH") {
993
+ return "ENGLISH";
994
+ } else if (standardExamCoterieType === "LITERATURE") {
995
+ return "LITERATURE";
996
+ }
997
+ };
998
+ var retrieveStandardExamCoterieTypeOptionListByStandardExamType = (standardExamType) => {
999
+ if (standardExamType === "TYT") {
1000
+ return retrieveStandardExamCoterieTypeOptionList().filter(
1001
+ (item) => item.value === "TURKISH" || item.value === "HISTORY" || item.value === "GEOGRAPHY" || item.value === "PHILOSOPHY" || item.value === "CULTURE_AND_RELIGION_KNOWLEDGE" || item.value === "MATHEMATICS" || item.value === "GEOMETRY" || item.value === "PHYSICS" || item.value === "CHEMISTRY" || item.value === "BIOLOGY"
1002
+ );
1003
+ } else if (standardExamType === "AYT") {
1004
+ return retrieveStandardExamCoterieTypeOptionList().filter(
1005
+ (item) => item.value === "LITERATURE" || item.value === "HISTORY_I" || item.value === "HISTORY_II" || item.value === "GEOGRAPHY_I" || item.value === "GEOGRAPHY_II" || item.value === "PHILOSOPHY" || item.value === "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE" || item.value === "MATHEMATICS" || item.value === "GEOMETRY" || item.value === "PHYSICS" || item.value === "CHEMISTRY" || item.value === "BIOLOGY" || item.value === "ENGLISH"
1006
+ );
1007
+ } else if (standardExamType === "LGS") {
1008
+ return retrieveStandardExamCoterieTypeOptionList().filter(
1009
+ (item) => item.value === "TURKISH" || item.value === "REVOLUTION_HISTORY" || item.value === "CULTURE_AND_RELIGION_KNOWLEDGE" || item.value === "MATHEMATICS" || item.value === "SCIENCE" || item.value === "ENGLISH"
1010
+ );
1011
+ } else return [];
1012
+ };
1013
+ var retrieveStandardExamCoterieTypeOptionList = () => {
1014
+ return [
1015
+ { value: "TURKISH", text: i18n_default.t("TURKISH") },
1016
+ { value: "SCIENCE", text: i18n_default.t("SCIENCE") },
1017
+ { value: "HISTORY", text: i18n_default.t("HISTORY") },
1018
+ { value: "GEOGRAPHY", text: i18n_default.t("GEOGRAPHY") },
1019
+ { value: "PHILOSOPHY", text: i18n_default.t("PHILOSOPHY") },
1020
+ {
1021
+ value: "CULTURE_AND_RELIGION_KNOWLEDGE",
1022
+ text: i18n_default.t("CULTURE_AND_RELIGION_KNOWLEDGE")
1023
+ },
1024
+ { value: "MATHEMATICS", text: i18n_default.t("MATHEMATICS") },
1025
+ { value: "GEOMETRY", text: i18n_default.t("GEOMETRY") },
1026
+ { value: "PHYSICS", text: i18n_default.t("PHYSICS") },
1027
+ { value: "CHEMISTRY", text: i18n_default.t("CHEMISTRY") },
1028
+ { value: "BIOLOGY", text: i18n_default.t("BIOLOGY") },
1029
+ { value: "LITERATURE", text: i18n_default.t("LITERATURE") },
1030
+ { value: "HISTORY_I", text: i18n_default.t("HISTORY_I") },
1031
+ { value: "HISTORY_II", text: i18n_default.t("HISTORY_II") },
1032
+ { value: "GEOGRAPHY_I", text: i18n_default.t("GEOGRAPHY_I") },
1033
+ { value: "GEOGRAPHY_II", text: i18n_default.t("GEOGRAPHY_II") },
1034
+ {
1035
+ value: "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE",
1036
+ text: i18n_default.t("PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE")
1037
+ },
1038
+ { value: "ENGLISH", text: i18n_default.t("ENGLISH") },
1039
+ { value: "REVOLUTION_HISTORY", text: i18n_default.t("REVOLUTION_HISTORY") }
1040
+ ];
1041
+ };
1042
+ var retrieveValidationRequirementList_AYT = () => {
1043
+ return [
1044
+ {
1045
+ value: "LITERATURE",
1046
+ count: 24
1047
+ },
1048
+ {
1049
+ value: "HISTORY_I",
1050
+ count: 10
1051
+ },
1052
+ {
1053
+ value: "HISTORY_II",
1054
+ count: 11
1055
+ },
1056
+ {
1057
+ value: "GEOGRAPHY_I",
1058
+ count: 6
1059
+ },
1060
+ {
1061
+ value: "GEOGRAPHY_II",
1062
+ count: 11
1063
+ },
1064
+ {
1065
+ value: "PHILOSOPHY",
1066
+ count: 12
1067
+ },
1068
+ {
1069
+ value: "PHILOSOPHY_OR_CULTURE_AND_RELIGION_KNOWLEDGE",
1070
+ count: 6
1071
+ },
1072
+ {
1073
+ value: "MATHEMATICS",
1074
+ count: 30
1075
+ },
1076
+ {
1077
+ value: "GEOMETRY",
1078
+ count: 10
1079
+ },
1080
+ {
1081
+ value: "PHYSICS",
1082
+ count: 14
1083
+ },
1084
+ {
1085
+ value: "CHEMISTRY",
1086
+ count: 13
1087
+ },
1088
+ {
1089
+ value: "BIOLOGY",
1090
+ count: 13
1091
+ },
1092
+ {
1093
+ value: "ENGLISH",
1094
+ count: 80
1095
+ }
1096
+ ];
1097
+ };
1098
+ var retrieveValidationRequirementList_TYT = () => {
1099
+ return [
1100
+ {
1101
+ value: "TURKISH",
1102
+ count: 40
1103
+ },
1104
+ {
1105
+ value: "HISTORY",
1106
+ count: 5
1107
+ },
1108
+ {
1109
+ value: "GEOGRAPHY",
1110
+ count: 5
1111
+ },
1112
+ {
1113
+ value: "PHILOSOPHY",
1114
+ count: 5
1115
+ },
1116
+ {
1117
+ value: "CULTURE_AND_RELIGION_KNOWLEDGE",
1118
+ count: 5
1119
+ },
1120
+ {
1121
+ value: "MATHEMATICS",
1122
+ count: 30
1123
+ },
1124
+ {
1125
+ value: "GEOMETRY",
1126
+ count: 10
1127
+ },
1128
+ {
1129
+ value: "PHYSICS",
1130
+ count: 7
1131
+ },
1132
+ {
1133
+ value: "CHEMISTRY",
1134
+ count: 7
1135
+ },
1136
+ {
1137
+ value: "BIOLOGY",
1138
+ count: 6
1139
+ }
1140
+ ];
1141
+ };
1142
+ var retrieveValidationRequirementList_LGS = () => {
1143
+ return [
1144
+ {
1145
+ value: "TURKISH",
1146
+ count: 20
1147
+ },
1148
+ {
1149
+ value: "REVOLUTION_HISTORY",
1150
+ count: 10
1151
+ },
1152
+ {
1153
+ value: "CULTURE_AND_RELIGION_KNOWLEDGE",
1154
+ count: 10
1155
+ },
1156
+ {
1157
+ value: "MATHEMATICS",
1158
+ count: 20
1159
+ },
1160
+ {
1161
+ value: "SCIENCE",
1162
+ count: 20
1163
+ },
1164
+ {
1165
+ value: "ENGLISH",
1166
+ count: 10
1167
+ }
1168
+ ];
1169
+ };
1170
+ var retrieveValidationRequirementList = (selectedStandardExamType) => {
1171
+ if (selectedStandardExamType === "TYT") {
1172
+ return retrieveValidationRequirementList_TYT();
1173
+ } else if (selectedStandardExamType === "AYT") {
1174
+ return retrieveValidationRequirementList_AYT();
1175
+ } else if (selectedStandardExamType === "LGS") {
1176
+ return retrieveValidationRequirementList_LGS();
1177
+ }
1178
+ return [];
1179
+ };
1180
+ var constructActivityItemListWithSolutionForAI = (bodyMap, materialMap, type, imageContentList) => {
1181
+ const itemList = [];
1182
+ Object.keys(bodyMap).forEach((key) => {
1183
+ const bodyItem = bodyMap[key];
1184
+ if (bodyItem.type === "IMAGE") {
1185
+ if (imageContentList && imageContentList.length > 0) {
1186
+ const foundImageContent = imageContentList.find(
1187
+ (imageContent) => imageContent.url === bodyItem.value
1188
+ );
1189
+ itemList.push({
1190
+ type: "text",
1191
+ text: foundImageContent.content
1192
+ });
1193
+ } else {
1194
+ itemList.push({
1195
+ type: "image_url",
1196
+ imageUrl: bodyItem.value
1197
+ });
1198
+ }
1199
+ } else {
1200
+ itemList.push({
1201
+ type: "text",
1202
+ text: bodyItem.value.replaceAll("@@", "___________")
1203
+ });
1204
+ }
1205
+ });
1206
+ if (type === "ORDERING") {
1207
+ if (Object.keys(materialMap).length > 0) {
1208
+ itemList.push({
1209
+ type: "text",
1210
+ text: `${i18n_default.t("correct_order")}: `
1211
+ });
1212
+ Object.keys(materialMap).forEach((key) => {
1213
+ itemList.push({
1214
+ type: "text",
1215
+ text: materialMap[key]
1216
+ });
1217
+ });
1218
+ }
1219
+ } else if (type === "DROPDOWN") {
1220
+ if (Object.keys(materialMap).length > 0) {
1221
+ itemList.push({
1222
+ type: "text",
1223
+ text: `${i18n_default.t("correct_blanks")}: `
1224
+ });
1225
+ Object.keys(materialMap).forEach((key, index) => {
1226
+ itemList.push({
1227
+ type: "text",
1228
+ text: `${i18n_default.t("blank")} ${index + 1}: ${Object.keys(materialMap[key])[0]}`
1229
+ });
1230
+ });
1231
+ }
1232
+ } else if (type === "MCSA") {
1233
+ if (Object.keys(materialMap).length > 0) {
1234
+ const answer = Object.keys(materialMap)[0];
1235
+ materialMap[answer].forEach((option) => {
1236
+ itemList.push({
1237
+ type: "text",
1238
+ text: option
1239
+ });
1240
+ });
1241
+ materialMap[answer].forEach((option) => {
1242
+ if (option === answer) {
1243
+ itemList.push({
1244
+ type: "text",
1245
+ text: `[${i18n_default.t("answer").toUpperCase()}]${option}`
1246
+ });
1247
+ }
1248
+ });
1249
+ }
1250
+ } else if (type === "MCMA") {
1251
+ if (Object.keys(materialMap).length > 0) {
1252
+ const answer = Object.keys(materialMap)[0];
1253
+ materialMap[answer].forEach((option) => {
1254
+ itemList.push({
1255
+ type: "text",
1256
+ text: option
1257
+ });
1258
+ });
1259
+ const splittedTextList = answer.split("\xA7");
1260
+ materialMap[answer].forEach((option) => {
1261
+ if (splittedTextList.includes(option)) {
1262
+ itemList.push({
1263
+ type: "text",
1264
+ text: `[${i18n_default.t("answer").toUpperCase()}]${option}`
1265
+ });
1266
+ }
1267
+ });
1268
+ }
1269
+ } else if (type === "MATCHING") {
1270
+ if (Object.keys(materialMap).length > 0) {
1271
+ itemList.push({
1272
+ type: "text",
1273
+ text: `${i18n_default.t("correct_matching")}: `
1274
+ });
1275
+ Object.keys(materialMap).forEach((key, index) => {
1276
+ const matchingKey = Object.keys(materialMap[key])[0];
1277
+ const matchingValue = materialMap[key][matchingKey];
1278
+ itemList.push({
1279
+ type: "text",
1280
+ text: `${matchingKey}: ${matchingValue}`
1281
+ });
1282
+ });
1283
+ }
1284
+ } else if (type === "GROUPING") {
1285
+ if (Object.keys(materialMap).length > 0) {
1286
+ itemList.push({
1287
+ type: "text",
1288
+ text: `${i18n_default.t("correct_grouping")}: `
1289
+ });
1290
+ Object.keys(materialMap).forEach((key, index) => {
1291
+ let text = `${i18n_default.t("group")} ${index + 1}: `;
1292
+ itemList.push({
1293
+ type: "text",
1294
+ text
1295
+ });
1296
+ const groupName = Object.keys(materialMap[key])[0];
1297
+ let currentText = "";
1298
+ materialMap[key][groupName].forEach((item) => {
1299
+ currentText += `${item}, `;
1300
+ });
1301
+ currentText = currentText.substring(0, currentText.length - 2);
1302
+ itemList.push({
1303
+ type: "text",
1304
+ text: `${groupName}: ${currentText}`
1305
+ });
1306
+ });
1307
+ }
1308
+ } else if (type === "FILL_IN_THE_BLANKS") {
1309
+ if (Object.keys(materialMap).length > 0) {
1310
+ itemList.push({
1311
+ type: "text",
1312
+ text: `${i18n_default.t("correct_blanks")}: `
1313
+ });
1314
+ Object.keys(materialMap).forEach((key, index) => {
1315
+ materialMap[key].forEach((item) => {
1316
+ itemList.push({
1317
+ type: "text",
1318
+ text: `${i18n_default.t("blank")} ${index + 1}: ${item}`
1319
+ });
1320
+ });
1321
+ });
1322
+ }
1323
+ } else if (type === "OPEN_ENDED") {
1324
+ } else if (type === "TRUE_FALSE") {
1325
+ if (materialMap.trueList && Object.keys(materialMap.trueList).length > 0) {
1326
+ materialMap.trueList.forEach((item) => {
1327
+ itemList.push({
1328
+ type: "text",
1329
+ text: `[${i18n_default.t("correct").toUpperCase()}]${item}`
1330
+ });
1331
+ });
1332
+ }
1333
+ if (materialMap.falseList && Object.keys(materialMap.falseList).length > 0) {
1334
+ materialMap.falseList.forEach((item) => {
1335
+ itemList.push({
1336
+ type: "text",
1337
+ text: `[${i18n_default.t("incorrect").toUpperCase()}]${item}`
1338
+ });
1339
+ });
1340
+ }
1341
+ }
1342
+ return itemList;
1343
+ };
1344
+ var constructActivityItemListWithAnswersForAI = (bodyMap, materialMap, type) => {
1345
+ const itemList = [];
1346
+ if (type === "ORDERING") {
1347
+ Object.keys(bodyMap).forEach((key) => {
1348
+ const bodyItem = JSON.parse(bodyMap[key]);
1349
+ if (bodyItem.type === "IMAGE") {
1350
+ itemList.push({
1351
+ type: "image_url",
1352
+ imageUrl: bodyItem.value
1353
+ });
1354
+ } else {
1355
+ itemList.push({
1356
+ type: "text",
1357
+ text: bodyItem.value
1358
+ });
1359
+ }
1360
+ });
1361
+ if (Object.keys(materialMap).length > 0) {
1362
+ itemList.push({
1363
+ type: "text",
1364
+ text: `${i18n_default.t("correct_order")}: `
1365
+ });
1366
+ Object.keys(materialMap).forEach((key) => {
1367
+ itemList.push({
1368
+ type: "text",
1369
+ text: materialMap[key]
1370
+ });
1371
+ });
1372
+ }
1373
+ } else if (type === "DROPDOWN") {
1374
+ Object.keys(bodyMap).forEach((key) => {
1375
+ const bodyItem = JSON.parse(bodyMap[key]);
1376
+ if (bodyItem.type === "IMAGE") {
1377
+ itemList.push({
1378
+ type: "image_url",
1379
+ imageUrl: bodyItem.value
1380
+ });
1381
+ } else {
1382
+ itemList.push({
1383
+ type: "text",
1384
+ text: bodyItem.value.replaceAll("@@", "___________")
1385
+ });
1386
+ }
1387
+ });
1388
+ if (Object.keys(materialMap).length > 0) {
1389
+ itemList.push({
1390
+ type: "text",
1391
+ text: `${i18n_default.t("correct_blanks")}: `
1392
+ });
1393
+ Object.keys(materialMap).forEach((key, index) => {
1394
+ itemList.push({
1395
+ type: "text",
1396
+ text: `${index + 1}. ${Object.keys(materialMap[key])[0]}`
1397
+ });
1398
+ });
1399
+ }
1400
+ } else if (type === "MCSA") {
1401
+ Object.keys(bodyMap).forEach((key) => {
1402
+ const bodyItem = JSON.parse(bodyMap[key]);
1403
+ if (bodyItem.type === "IMAGE") {
1404
+ itemList.push({
1405
+ type: "image_url",
1406
+ imageUrl: bodyItem.value
1407
+ });
1408
+ } else {
1409
+ itemList.push({
1410
+ type: "text",
1411
+ text: bodyItem.value
1412
+ });
1413
+ }
1414
+ });
1415
+ if (Object.keys(materialMap).length > 0) {
1416
+ itemList.push({
1417
+ type: "text",
1418
+ text: `${i18n_default.t("correct_answer")}: `
1419
+ });
1420
+ Object.keys(materialMap).forEach((key) => {
1421
+ itemList.push({
1422
+ type: "text",
1423
+ text: key
1424
+ });
1425
+ });
1426
+ }
1427
+ } else if (type === "MCMA") {
1428
+ Object.keys(bodyMap).forEach((key) => {
1429
+ const bodyItem = JSON.parse(bodyMap[key]);
1430
+ if (bodyItem.type === "IMAGE") {
1431
+ itemList.push({
1432
+ type: "image_url",
1433
+ imageUrl: bodyItem.value
1434
+ });
1435
+ } else {
1436
+ itemList.push({
1437
+ type: "text",
1438
+ text: bodyItem.value
1439
+ });
1440
+ }
1441
+ });
1442
+ if (Object.keys(materialMap).length > 0) {
1443
+ itemList.push({
1444
+ type: "text",
1445
+ text: `${i18n_default.t("correct_answers")}: `
1446
+ });
1447
+ const splittedTextList = Object.keys(materialMap)[0].split("\xA7");
1448
+ splittedTextList.forEach((item) => {
1449
+ const parsedItemList = JSON.parse(item);
1450
+ for (const parsedItem of parsedItemList) {
1451
+ itemList.push({
1452
+ type: "text",
1453
+ text: parsedItem
1454
+ });
1455
+ }
1456
+ });
1457
+ }
1458
+ } else if (type === "MATCHING") {
1459
+ Object.keys(bodyMap).forEach((key) => {
1460
+ const bodyItem = JSON.parse(bodyMap[key]);
1461
+ if (bodyItem.type === "IMAGE") {
1462
+ itemList.push({
1463
+ type: "image_url",
1464
+ imageUrl: bodyItem.value
1465
+ });
1466
+ } else {
1467
+ itemList.push({
1468
+ type: "text",
1469
+ text: bodyItem.value
1470
+ });
1471
+ }
1472
+ });
1473
+ if (Object.keys(materialMap).length > 0) {
1474
+ itemList.push({
1475
+ type: "text",
1476
+ text: `${i18n_default.t("correct_answers")}: `
1477
+ });
1478
+ Object.keys(materialMap).forEach((key, index) => {
1479
+ itemList.push({
1480
+ type: "text",
1481
+ text: `${i18n_default.t("match")} ${index + 1}:`
1482
+ });
1483
+ itemList.push({
1484
+ type: "text",
1485
+ text: `${key}: ${materialMap[key]}`
1486
+ });
1487
+ });
1488
+ }
1489
+ } else if (type === "GROUPING") {
1490
+ Object.keys(bodyMap).forEach((key) => {
1491
+ const bodyItem = JSON.parse(bodyMap[key]);
1492
+ if (bodyItem.type === "IMAGE") {
1493
+ itemList.push({
1494
+ type: "image_url",
1495
+ imageUrl: bodyItem.value
1496
+ });
1497
+ } else {
1498
+ itemList.push({
1499
+ type: "text",
1500
+ text: bodyItem.value
1501
+ });
1502
+ }
1503
+ });
1504
+ if (Object.keys(materialMap).length > 0) {
1505
+ itemList.push({
1506
+ type: "text",
1507
+ text: `${i18n_default.t("correct_answers")}: `
1508
+ });
1509
+ Object.keys(materialMap).forEach((key, index) => {
1510
+ let text = `${i18n_default.t("group")} ${index + 1}: `;
1511
+ itemList.push({
1512
+ type: "text",
1513
+ text
1514
+ });
1515
+ const groupName = key;
1516
+ let currentText = "";
1517
+ materialMap[groupName].forEach((item) => {
1518
+ currentText += `${item}, `;
1519
+ });
1520
+ currentText = currentText.substring(0, currentText.length - 2);
1521
+ itemList.push({
1522
+ type: "text",
1523
+ text: `${groupName}: [${currentText}]`
1524
+ });
1525
+ });
1526
+ }
1527
+ } else if (type === "FILL_IN_THE_BLANKS") {
1528
+ Object.keys(bodyMap).forEach((key) => {
1529
+ const bodyItem = JSON.parse(bodyMap[key]);
1530
+ if (bodyItem.type === "IMAGE") {
1531
+ itemList.push({
1532
+ type: "image_url",
1533
+ imageUrl: bodyItem.value
1534
+ });
1535
+ } else {
1536
+ itemList.push({
1537
+ type: "text",
1538
+ text: bodyItem.value.replaceAll("@@", "___________")
1539
+ });
1540
+ }
1541
+ });
1542
+ if (Object.keys(materialMap).length > 0) {
1543
+ itemList.push({
1544
+ type: "text",
1545
+ text: `${i18n_default.t("correct_blanks")}: `
1546
+ });
1547
+ Object.keys(materialMap).forEach((key, index) => {
1548
+ JSON.parse(materialMap[key]).forEach((item) => {
1549
+ itemList.push({
1550
+ type: "text",
1551
+ text: `${index + 1}. ${item}`
1552
+ });
1553
+ });
1554
+ });
1555
+ }
1556
+ } else if (type === "OPEN_ENDED") {
1557
+ Object.keys(bodyMap).forEach((key) => {
1558
+ const bodyItem = JSON.parse(bodyMap[key]);
1559
+ if (bodyItem.type === "IMAGE") {
1560
+ itemList.push({
1561
+ type: "image_url",
1562
+ imageUrl: bodyItem.value
1563
+ });
1564
+ } else {
1565
+ itemList.push({
1566
+ type: "text",
1567
+ text: bodyItem.value
1568
+ });
1569
+ }
1570
+ });
1571
+ } else if (type === "TRUE_FALSE") {
1572
+ Object.keys(bodyMap).forEach((key) => {
1573
+ const bodyItem = JSON.parse(bodyMap[key]);
1574
+ if (bodyItem.type === "IMAGE") {
1575
+ itemList.push({
1576
+ type: "image_url",
1577
+ imageUrl: bodyItem.value
1578
+ });
1579
+ } else {
1580
+ itemList.push({
1581
+ type: "text",
1582
+ text: bodyItem.value
1583
+ });
1584
+ }
1585
+ });
1586
+ if (materialMap.trueList && Object.keys(materialMap.trueList).length > 0) {
1587
+ itemList.push({
1588
+ type: "text",
1589
+ text: `${i18n_default.t("correct_answers")}: `
1590
+ });
1591
+ materialMap.trueList.forEach((item) => {
1592
+ itemList.push({
1593
+ type: "text",
1594
+ text: item
1595
+ });
1596
+ });
1597
+ }
1598
+ if (materialMap.falseList && Object.keys(materialMap.falseList).length > 0) {
1599
+ itemList.push({
1600
+ type: "text",
1601
+ text: `${i18n_default.t("incorrect_answers")}: `
1602
+ });
1603
+ materialMap.falseList.forEach((item) => {
1604
+ itemList.push({
1605
+ type: "text",
1606
+ text: item
1607
+ });
1608
+ });
1609
+ }
1610
+ }
1611
+ return itemList;
1612
+ };
1613
+ var retrieveActivityTemplateDTOOptionList = (activityTemplateSet) => {
1614
+ return activityTemplateSet.map((activityTemplateDTO) => ({
1615
+ id: activityTemplateDTO.id,
1616
+ value: activityTemplateDTO.id,
1617
+ text: i18n_default.t(activityTemplateDTO.type)
1618
+ }));
1619
+ };
1620
+ var retrieveDefaultOrderingDataMap = (orderingMaterialMap) => {
1621
+ const dataMap = {};
1622
+ Object.keys(orderingMaterialMap).sort(() => 0.5 - Math.random()).forEach((key, index) => {
1623
+ dataMap[index] = key;
1624
+ });
1625
+ return dataMap;
1626
+ };
1627
+ var retrieveDefaultDropdownMap = (dropdownMaterialMap) => {
1628
+ const dataMap = {};
1629
+ Object.keys(dropdownMaterialMap).forEach((key) => {
1630
+ dataMap[key] = "DEFAULT_OPTION";
1631
+ });
1632
+ return dataMap;
1633
+ };
1634
+ var retrieveDefaultMCSAMap = (MCSAMaterialMap) => {
1635
+ const dataMap = {};
1636
+ Object.keys(MCSAMaterialMap).forEach((key, index) => {
1637
+ dataMap[key] = "ANSWER_KEY";
1638
+ });
1639
+ return dataMap;
1640
+ };
1641
+ var retrieveDefaultMCMAMap = (MCMAMaterialMap) => {
1642
+ const dataMap = {};
1643
+ Object.keys(MCMAMaterialMap).forEach((key, index) => {
1644
+ dataMap[key] = [];
1645
+ });
1646
+ return dataMap;
1647
+ };
1648
+ var retrieveDefaultMatchingMap = (matchingMaterialMap) => {
1649
+ const dataMap = {};
1650
+ Object.keys(matchingMaterialMap).forEach((key, index) => {
1651
+ dataMap[key] = "";
1652
+ });
1653
+ return dataMap;
1654
+ };
1655
+ var retrieveDefaultGroupingMap = (groupingMaterialMap) => {
1656
+ const dataMap = {};
1657
+ Object.keys(groupingMaterialMap).forEach((key, index) => {
1658
+ dataMap[key] = [];
1659
+ });
1660
+ return dataMap;
1661
+ };
1662
+ var retrieveDefaultFillInTheBlanksMap = (fillInTheBlanksMaterialMap) => {
1663
+ const dataMap = {};
1664
+ Object.keys(fillInTheBlanksMaterialMap).forEach((key) => {
1665
+ dataMap[key] = "";
1666
+ });
1667
+ return dataMap;
1668
+ };
1669
+ var retrieveDefaultOpenEndedMap = () => {
1670
+ return { ANSWER: "" };
1671
+ };
1672
+ var retrieveDefaultTrueFalseMap = () => {
1673
+ return { trueList: [], falseList: [] };
1674
+ };
1675
+ var retrieveCurrentDefaultDataMap = (activityTemplate, activityData) => {
1676
+ const defaultDataMap = {
1677
+ activityTemplateId: activityTemplate.id,
1678
+ type: activityTemplate.type
1679
+ };
1680
+ if (activityTemplate.type === "ORDERING") {
1681
+ defaultDataMap.answerMap = retrieveDefaultOrderingDataMap(
1682
+ activityData.orderingMaterialMap
1683
+ );
1684
+ } else if (activityTemplate.type === "DROPDOWN") {
1685
+ defaultDataMap.answerMap = retrieveDefaultDropdownMap(
1686
+ activityData.dropdownMaterialMap
1687
+ );
1688
+ } else if (activityTemplate.type === "MCSA") {
1689
+ defaultDataMap.answerMap = retrieveDefaultMCSAMap(
1690
+ activityData.MCSAMaterialMap
1691
+ );
1692
+ } else if (activityTemplate.type === "MCMA") {
1693
+ defaultDataMap.answerMap = retrieveDefaultMCMAMap(
1694
+ activityData.MCMAMaterialMap
1695
+ );
1696
+ } else if (activityTemplate.type === "MATCHING") {
1697
+ defaultDataMap.answerMap = retrieveDefaultMatchingMap(
1698
+ activityData.matchingMaterialMap
1699
+ );
1700
+ } else if (activityTemplate.type === "GROUPING") {
1701
+ defaultDataMap.answerMap = retrieveDefaultGroupingMap(
1702
+ activityData.groupingMaterialMap
1703
+ );
1704
+ } else if (activityTemplate.type === "FILL_IN_THE_BLANKS") {
1705
+ defaultDataMap.answerMap = retrieveDefaultFillInTheBlanksMap(
1706
+ activityData.fillInTheBlanksMaterialMap
1707
+ );
1708
+ } else if (activityTemplate.type === "OPEN_ENDED") {
1709
+ defaultDataMap.answerMap = retrieveDefaultOpenEndedMap();
1710
+ } else if (activityTemplate.type === "TRUE_FALSE") {
1711
+ defaultDataMap.answerMap = retrieveDefaultTrueFalseMap();
1712
+ }
1713
+ return defaultDataMap;
1714
+ };
1715
+ var constructActivityAnswerMap = (activityTemplate, activityData) => {
1716
+ if (activityTemplate.type === "ORDERING") {
1717
+ activityData.orderingMaterialMap = JSON.parse(
1718
+ activityData.orderingMaterialMap
1719
+ );
1720
+ } else if (activityTemplate.type === "DROPDOWN") {
1721
+ activityData.dropdownMaterialMap = JSON.parse(
1722
+ activityData.dropdownMaterialMap
1723
+ );
1724
+ } else if (activityTemplate.type === "MCSA") {
1725
+ activityData.MCSAMaterialMap = JSON.parse(activityData.MCSAMaterialMap);
1726
+ } else if (activityTemplate.type === "MCMA") {
1727
+ activityData.MCMAMaterialMap = JSON.parse(activityData.MCMAMaterialMap);
1728
+ } else if (activityTemplate.type === "MATCHING") {
1729
+ activityData.matchingMaterialMap = JSON.parse(
1730
+ activityData.matchingMaterialMap
1731
+ );
1732
+ } else if (activityTemplate.type === "GROUPING") {
1733
+ activityData.groupingMaterialMap = JSON.parse(
1734
+ activityData.groupingMaterialMap
1735
+ );
1736
+ } else if (activityTemplate.type === "FILL_IN_THE_BLANKS") {
1737
+ activityData.fillInTheBlanksMaterialMap = JSON.parse(
1738
+ activityData.fillInTheBlanksMaterialMap
1739
+ );
1740
+ } else if (activityTemplate.type === "OPEN_ENDED") {
1741
+ activityData.openEndedMaterialMap = {};
1742
+ } else if (activityTemplate.type === "TRUE_FALSE") {
1743
+ activityData.trueFalseMaterialMap = { trueList: [], falseList: [] };
1744
+ }
1745
+ return retrieveCurrentDefaultDataMap(activityTemplate, activityData);
1746
+ };
1747
+ var ignoreMathematicalExpression = (inputText) => {
1748
+ return inputText.replaceAll("{", "").replaceAll("}", "").replaceAll("_", "").replaceAll("^", "").replaceAll("\\frac", "").replaceAll("\\text", "").replaceAll("\\sqrt", "");
1749
+ };
1750
+ var checkIfAnswerIsEmpty = (answer) => {
1751
+ const { data } = answer;
1752
+ if (data && data.length > 0) {
1753
+ const foundAnswer = data[0];
1754
+ const { type, answerMap } = foundAnswer;
1755
+ if (type === "ORDERING") {
1756
+ return false;
1757
+ } else if (type === "DROPDOWN") {
1758
+ for (const key of Object.keys(answerMap)) {
1759
+ if (answerMap[key] !== "DEFAULT_OPTION") {
1760
+ return false;
1761
+ }
1762
+ }
1763
+ } else if (type === "MCSA") {
1764
+ const key = Object.keys(answerMap)[0];
1765
+ if (answerMap[key] !== "ANSWER_KEY") {
1766
+ return false;
1767
+ }
1768
+ } else if (type === "MCMA") {
1769
+ const key = Object.keys(answerMap)[0];
1770
+ if (answerMap[key].length !== 0) {
1771
+ return false;
1772
+ }
1773
+ } else if (type === "MATCHING") {
1774
+ for (const key of Object.keys(answerMap)) {
1775
+ if (answerMap[key]) {
1776
+ return false;
1777
+ }
1778
+ }
1779
+ } else if (type === "GROUPING") {
1780
+ for (const key of Object.keys(answerMap)) {
1781
+ if (answerMap[key].length !== 0) {
1782
+ return false;
1783
+ }
1784
+ }
1785
+ } else if (type === "FILL_IN_THE_BLANKS") {
1786
+ for (const key of Object.keys(answerMap)) {
1787
+ if (answerMap[key]) {
1788
+ return false;
1789
+ }
1790
+ }
1791
+ } else if (type === "OPEN_ENDED") {
1792
+ const key = Object.keys(answerMap)[0];
1793
+ if (answerMap[key]) {
1794
+ return false;
1795
+ }
1796
+ } else if (type === "TRUE_FALSE") {
1797
+ return answerMap.trueList.length === 0 && answerMap.falseList.length === 0;
1798
+ }
1799
+ }
1800
+ return true;
1801
+ };
1802
+ var constructActivityAnswerStateList = (answerList, activityList) => {
1803
+ const stateList = [];
1804
+ activityList.forEach((activity, index) => {
1805
+ stateList.push({
1806
+ index,
1807
+ id: activity.id,
1808
+ state: checkActivityAnswerState(answerList, activity)
1809
+ });
1810
+ });
1811
+ return stateList;
1812
+ };
1813
+ var retrieveActivityAnswerFromAnswerList = (answerList, activity) => {
1814
+ return answerList.find(
1815
+ (answer) => parseFloat(answer.activityDTO.id) === parseFloat(activity.id)
1816
+ );
1817
+ };
1818
+ var checkActivityAnswerState = (answerList, activity) => {
1819
+ const activityAnswer = retrieveActivityAnswerFromAnswerList(
1820
+ answerList,
1821
+ activity
1822
+ );
1823
+ if (!activityAnswer) {
1824
+ return "NOT_EXISTS";
1825
+ }
1826
+ const { data } = activityAnswer;
1827
+ if (!data) return "NOT_EXISTS";
1828
+ const parsedData = JSON.parse(data);
1829
+ if (parsedData.filter((item) => !item.isEmpty).length === parsedData.length) {
1830
+ return "ANSWERED";
1831
+ } else {
1832
+ return "EMPTY";
1833
+ }
1834
+ };
1835
+ var findBestFitActivity = (activity, individualModelList, outcomeModelList) => {
1836
+ const { activityTemplateDTOList, data, coterieType, categoryIdList } = activity;
1837
+ const parsedData = JSON.parse(data);
1838
+ const {
1839
+ orderingTaxonomyMap,
1840
+ dropdownTaxonomyMap,
1841
+ MCSATaxonomyMap,
1842
+ MCMATaxonomyMap,
1843
+ matchingTaxonomyMap,
1844
+ groupingTaxonomyMap,
1845
+ fillInTheBlanksTaxonomyMap,
1846
+ openEndedTaxonomyMap,
1847
+ trueFalseTaxonomyMap
1848
+ } = parsedData;
1849
+ const taxonomyMap = {};
1850
+ if (orderingTaxonomyMap) {
1851
+ taxonomyMap["orderingTaxonomyMap"] = JSON.parse(orderingTaxonomyMap);
1852
+ }
1853
+ if (dropdownTaxonomyMap) {
1854
+ taxonomyMap["dropdownTaxonomyMap"] = JSON.parse(dropdownTaxonomyMap);
1855
+ }
1856
+ if (MCSATaxonomyMap) {
1857
+ taxonomyMap["MCSATaxonomyMap"] = JSON.parse(MCSATaxonomyMap);
1858
+ }
1859
+ if (MCMATaxonomyMap) {
1860
+ taxonomyMap["MCMATaxonomyMap"] = JSON.parse(MCMATaxonomyMap);
1861
+ }
1862
+ if (matchingTaxonomyMap) {
1863
+ taxonomyMap["matchingTaxonomyMap"] = JSON.parse(matchingTaxonomyMap);
1864
+ }
1865
+ if (groupingTaxonomyMap) {
1866
+ taxonomyMap["groupingTaxonomyMap"] = JSON.parse(groupingTaxonomyMap);
1867
+ }
1868
+ if (fillInTheBlanksTaxonomyMap) {
1869
+ taxonomyMap["fillInTheBlanksTaxonomyMap"] = JSON.parse(
1870
+ fillInTheBlanksTaxonomyMap
1871
+ );
1872
+ }
1873
+ if (trueFalseTaxonomyMap) {
1874
+ taxonomyMap["trueFalseTaxonomyMap"] = JSON.parse(trueFalseTaxonomyMap);
1875
+ }
1876
+ if (openEndedTaxonomyMap) {
1877
+ taxonomyMap["openEndedTaxonomyMap"] = JSON.parse(openEndedTaxonomyMap);
1878
+ }
1879
+ let coterieField = "VERBAL";
1880
+ if (coterieType === "MATHEMATICS" || coterieType === "BIOLOGY" || coterieType === "PHYSICS" || coterieType === "CHEMISTRY" || coterieType === "SCIENCE") {
1881
+ coterieField = "NUMERIC";
1882
+ }
1883
+ let foundModel;
1884
+ let isOutcomeFound = true;
1885
+ if (categoryIdList.length > 0) {
1886
+ const categoryId = categoryIdList[0];
1887
+ foundModel = outcomeModelList.find(
1888
+ (outcomeModel) => outcomeModel.outcomeId === categoryId
1889
+ );
1890
+ if (!foundModel) isOutcomeFound = false;
1891
+ } else {
1892
+ isOutcomeFound = false;
1893
+ }
1894
+ if (!isOutcomeFound) {
1895
+ foundModel = individualModelList.find(
1896
+ (individualModel) => individualModel.coterieField === coterieField
1897
+ );
1898
+ }
1899
+ let bestScore = Number.MAX_SAFE_INTEGER;
1900
+ let bestActivityTemplate;
1901
+ let bestActivityTemplateList = [];
1902
+ const activityTemplateValueMap = {};
1903
+ for (const activityTemplateDTO of activityTemplateDTOList) {
1904
+ const { type } = activityTemplateDTO;
1905
+ let currentTaxonomyMap;
1906
+ if (type === "ORDERING") {
1907
+ currentTaxonomyMap = taxonomyMap["orderingTaxonomyMap"];
1908
+ } else if (type === "DROPDOWN") {
1909
+ currentTaxonomyMap = taxonomyMap["dropdownTaxonomyMap"];
1910
+ } else if (type === "MCSA") {
1911
+ currentTaxonomyMap = taxonomyMap["MCSATaxonomyMap"];
1912
+ } else if (type === "MCMA") {
1913
+ currentTaxonomyMap = taxonomyMap["MCMATaxonomyMap"];
1914
+ } else if (type === "MATCHING") {
1915
+ currentTaxonomyMap = taxonomyMap["matchingTaxonomyMap"];
1916
+ } else if (type === "GROUPING") {
1917
+ currentTaxonomyMap = taxonomyMap["groupingTaxonomyMap"];
1918
+ } else if (type === "FILL_IN_THE_BLANKS") {
1919
+ currentTaxonomyMap = taxonomyMap["fillInTheBlanksTaxonomyMap"];
1920
+ } else if (type === "OPEN_ENDED") {
1921
+ currentTaxonomyMap = taxonomyMap["openEndedTaxonomyMap"];
1922
+ } else if (type === "TRUE_FALSE") {
1923
+ currentTaxonomyMap = taxonomyMap["trueFalseTaxonomyMap"];
1924
+ }
1925
+ const {
1926
+ type: taxonomyType,
1927
+ groupName: taxonomyGroupName,
1928
+ name: taxonomyName
1929
+ } = currentTaxonomyMap;
1930
+ const taxonomyString = taxonomyType.toLowerCase() + taxonomyGroupName.toLowerCase().charAt(0).toUpperCase() + taxonomyGroupName.toLowerCase().substring(1) + taxonomyName.toLowerCase().charAt(0).toUpperCase() + taxonomyName.toLowerCase().substring(1);
1931
+ const currentTaxonomyScore = foundModel[taxonomyString];
1932
+ const splittedTypeList = type.split("_");
1933
+ let activityTemplateString = "";
1934
+ for (let i = 0; i < splittedTypeList.length; i++) {
1935
+ const currentType = splittedTypeList[i].toLowerCase();
1936
+ if (i === 0) {
1937
+ activityTemplateString += currentType;
1938
+ } else {
1939
+ activityTemplateString += currentType.charAt(0).toUpperCase() + currentType.substring(1);
1940
+ }
1941
+ }
1942
+ const currentActivityTemplateScore = foundModel[activityTemplateString];
1943
+ const currentScore = currentTaxonomyScore * currentActivityTemplateScore;
1944
+ activityTemplateValueMap[type] = currentScore;
1945
+ if (currentScore < bestScore) {
1946
+ bestScore = currentScore;
1947
+ bestActivityTemplate = type;
1948
+ bestActivityTemplateList = [type];
1949
+ } else if (currentScore === bestScore) {
1950
+ bestActivityTemplateList.push(type);
1951
+ }
1952
+ }
1953
+ return {
1954
+ bestScore,
1955
+ bestActivityTemplate,
1956
+ bestActivityTemplateList,
1957
+ activityTemplateValueMap
1958
+ };
1959
+ };
1960
+ var retrieveContestTypeOptionList = () => {
1961
+ return [
1962
+ {
1963
+ value: "QUIZ",
1964
+ text: i18n_default.t("QUIZ")
1965
+ }
1966
+ ];
1967
+ };
1968
+ var retrieveFrequencyTypeOptionList = () => {
1969
+ return [
1970
+ {
1971
+ value: "WEEKLY",
1972
+ text: i18n_default.t("WEEKLY")
1973
+ }
1974
+ ];
1975
+ };
1976
+ var retrieveDistintCoterieTypeFromCatchtivityApplicationDTO = (catchtivityApplicationDTOList) => {
1977
+ const coterieTypeList = [];
1978
+ for (const catchtivityApplicationDTO of catchtivityApplicationDTOList) {
1979
+ const { catchtivityDTO } = catchtivityApplicationDTO;
1980
+ const { coterieType } = catchtivityDTO;
1981
+ if (coterieTypeList.findIndex(
1982
+ (foundCoterieType) => foundCoterieType === coterieType
1983
+ ) === -1) {
1984
+ coterieTypeList.push(coterieType);
1985
+ }
1986
+ }
1987
+ return coterieTypeList;
1988
+ };
1989
+ var retrieveClockTimeLeft = (type, value, durationType, durationInMinutes, activityProgressDTOSet, activity) => {
1990
+ if (type === "CATCHTIVITY" || type === "CATCHXAM" || type === "CONTEST") {
1991
+ if (durationType === "ALL") {
1992
+ return durationInMinutes ? durationInMinutes * 60 - retrieveTotalTimeSpentInSeconds(activityProgressDTOSet) : 0;
1993
+ } else if (durationType === "EACH") {
1994
+ return durationInMinutes ? durationInMinutes * 60 - retrieveEachTimeSpentInSeconds(activityProgressDTOSet, activity) : 0;
1995
+ } else return 0;
1996
+ } else if (type === "ACTIVITY") {
1997
+ return value - retrieveEachTimeSpentInSeconds(activityProgressDTOSet, activity);
1998
+ }
1999
+ return 0;
2000
+ };
2001
+ var retrieveEachTimeSpentInSeconds = (activityProgressList, activity) => {
2002
+ if (!activityProgressList || !activity) return 0;
2003
+ const foundActivityProgress = activityProgressList.find(
2004
+ (activityProgress) => parseFloat(activityProgress.activityDTO.id) === parseFloat(activity.id)
2005
+ );
2006
+ if (foundActivityProgress) {
2007
+ return foundActivityProgress.timeSpent / 1e3;
2008
+ }
2009
+ return 0;
2010
+ };
2011
+ var retrieveTotalTimeSpentInSeconds = (activityProgressList) => {
2012
+ let timeSpent = 0;
2013
+ if (!activityProgressList) return 0;
2014
+ activityProgressList.forEach((activityProgress) => {
2015
+ timeSpent += activityProgress.timeSpent;
2016
+ });
2017
+ return timeSpent / 1e3;
2018
+ };
2019
+ var retrieveTotalTimeSpentInMinutes = (activityProgressList) => {
2020
+ return retrieveTotalTimeSpentInSeconds(activityProgressList) / 60;
2021
+ };
2022
+ var parseContentMapFromData = (data) => {
2023
+ return JSON.parse(data.contentMap);
2024
+ };
2025
+ var parseBodyMapFromData = (data, type) => {
2026
+ if (type === "ORDERING") {
2027
+ return JSON.parse(data.orderingBodyMap);
2028
+ } else if (type === "DROPDOWN") {
2029
+ return JSON.parse(data.dropdownBodyMap);
2030
+ } else if (type === "MCSA") {
2031
+ return JSON.parse(data.MCSABodyMap);
2032
+ } else if (type === "MCMA") {
2033
+ return JSON.parse(data.MCMABodyMap);
2034
+ } else if (type === "MATCHING") {
2035
+ return JSON.parse(data.matchingBodyMap);
2036
+ } else if (type === "GROUPING") {
2037
+ return JSON.parse(data.groupingBodyMap);
2038
+ } else if (type === "FILL_IN_THE_BLANKS") {
2039
+ return JSON.parse(data.fillInTheBlanksBodyMap);
2040
+ } else if (type === "OPEN_ENDED") {
2041
+ return JSON.parse(data.openEndedBodyMap);
2042
+ } else if (type === "TRUE_FALSE") {
2043
+ return JSON.parse(data.trueFalseBodyMap);
2044
+ }
2045
+ };
2046
+ var parseMaterialMapFromData = (data, type) => {
2047
+ if (type === "ORDERING") {
2048
+ return JSON.parse(data.orderingMaterialMap);
2049
+ } else if (type === "DROPDOWN") {
2050
+ const dropdownMaterialMap = JSON.parse(data.dropdownMaterialMap);
2051
+ Object.keys(dropdownMaterialMap).forEach((materialKey) => {
2052
+ dropdownMaterialMap[materialKey] = JSON.parse(
2053
+ dropdownMaterialMap[materialKey]
2054
+ );
2055
+ const answerKey = Object.keys(dropdownMaterialMap[materialKey])[0];
2056
+ dropdownMaterialMap[materialKey][answerKey] = JSON.parse(
2057
+ dropdownMaterialMap[materialKey][answerKey]
2058
+ );
2059
+ });
2060
+ return dropdownMaterialMap;
2061
+ } else if (type === "MCSA") {
2062
+ const MCSAMaterialMap = JSON.parse(data.MCSAMaterialMap);
2063
+ Object.keys(MCSAMaterialMap).forEach((key) => {
2064
+ MCSAMaterialMap[key] = JSON.parse(MCSAMaterialMap[key]);
2065
+ });
2066
+ return MCSAMaterialMap;
2067
+ } else if (type === "MCMA") {
2068
+ const MCMAMaterialMap = JSON.parse(data.MCMAMaterialMap);
2069
+ Object.keys(MCMAMaterialMap).forEach((key) => {
2070
+ MCMAMaterialMap[key] = JSON.parse(MCMAMaterialMap[key]);
2071
+ });
2072
+ return MCMAMaterialMap;
2073
+ } else if (type === "MATCHING") {
2074
+ return JSON.parse(data.matchingMaterialMap);
2075
+ } else if (type === "GROUPING") {
2076
+ const groupingMaterialMap = JSON.parse(data.groupingMaterialMap);
2077
+ Object.keys(groupingMaterialMap).forEach((key) => {
2078
+ groupingMaterialMap[key] = JSON.parse(groupingMaterialMap[key]);
2079
+ });
2080
+ return groupingMaterialMap;
2081
+ } else if (type === "FILL_IN_THE_BLANKS") {
2082
+ return JSON.parse(data.fillInTheBlanksMaterialMap);
2083
+ } else if (type === "OPEN_ENDED") {
2084
+ return {};
2085
+ } else if (type === "TRUE_FALSE") {
2086
+ const trueFalseMaterialMap = JSON.parse(data.trueFalseMaterialMap);
2087
+ Object.keys(trueFalseMaterialMap).forEach((key) => {
2088
+ trueFalseMaterialMap[key] = JSON.parse(trueFalseMaterialMap[key]);
2089
+ });
2090
+ return trueFalseMaterialMap;
2091
+ }
2092
+ };
2093
+
2094
+ // src/components/dividers/DividerLine.tsx
2095
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2096
+ var DividerLine = () => {
2097
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "bg-catchup-gray-50 h-[1px] w-full my-3" });
2098
+ };
2099
+ var DividerLine_default = DividerLine;
2100
+
2101
+ // src/components/dividers/VerticalDividerLine.tsx
2102
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2103
+ var VerticalDividerLine = () => {
2104
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "bg-catchup-gray-50 h-full w-[1px] mx-3" });
2105
+ };
2106
+ var VerticalDividerLine_default = VerticalDividerLine;
2107
+
2108
+ // src/components/activities/body-content/ShowBodyMediaByContentType.tsx
2109
+ var import_react8 = require("react");
2110
+ var import_react_modal = __toESM(require("react-modal"));
2111
+ var import_react_katex = require("react-katex");
2112
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2113
+ var ShowBodyMediaByContentType = ({
2114
+ index,
2115
+ type,
2116
+ value,
2117
+ size
2118
+ }) => {
2119
+ const [showFullScreen, setShowFullScreen] = (0, import_react8.useState)(false);
2120
+ const [selectedFullScreenItem, setSelectedFullScreenItem] = (0, import_react8.useState)("");
2121
+ const convertToPercentage = (size2) => {
2122
+ if (size2 === "1/3") {
2123
+ return "w-small-media";
2124
+ } else if (size2 === "1/2") {
2125
+ return "w-medium-media";
2126
+ } else if (size2 === "1") {
2127
+ return "w-large-media";
2128
+ }
2129
+ };
2130
+ const retrieveValueParts = (value2) => {
2131
+ let currentIndex = 0;
2132
+ const valuePartList = [];
2133
+ let copyValue = JSON.parse(JSON.stringify(value2));
2134
+ currentIndex = 0;
2135
+ let checkText = "--TEXT--";
2136
+ while (copyValue.includes(checkText)) {
2137
+ const firstIndex = copyValue.indexOf(checkText);
2138
+ let textValue = copyValue.substring(0, firstIndex);
2139
+ let addition = 0;
2140
+ if (textValue.trim() !== "") {
2141
+ if ((textValue.split("__").length - 1) % 2 === 1) {
2142
+ textValue = textValue + "__";
2143
+ addition += 2;
2144
+ }
2145
+ if ((textValue.split("**").length - 1) % 2 === 1) {
2146
+ textValue = textValue + "**";
2147
+ addition += 2;
2148
+ }
2149
+ if ((textValue.split("`").length - 1) % 2 === 1) {
2150
+ textValue = textValue + "`";
2151
+ addition += 1;
2152
+ }
2153
+ valuePartList.push(
2154
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2155
+ "span",
2156
+ {
2157
+ className: "text-xl whitespace-pre-wrap",
2158
+ children: constructInputWithSpecialExpressionList(textValue).map(
2159
+ (inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2160
+ "span",
2161
+ {
2162
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
2163
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_katex.InlineMath, { math: inputPart.value }) }) : inputPart.value
2164
+ },
2165
+ index2
2166
+ )
2167
+ )
2168
+ },
2169
+ `${index}-${currentIndex}`
2170
+ )
2171
+ );
2172
+ }
2173
+ const subValue = copyValue.substring(firstIndex + checkText.length);
2174
+ const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length - addition;
2175
+ currentIndex++;
2176
+ valuePartList.push(
2177
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2178
+ "span",
2179
+ {
2180
+ className: `text-xl font-bold whitespace-pre-wrap`,
2181
+ children: constructInputWithSpecialExpressionList(
2182
+ copyValue.substring(firstIndex + checkText.length, secondIndex)
2183
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2184
+ "span",
2185
+ {
2186
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
2187
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_katex.InlineMath, { math: inputPart.value }) }) : inputPart.value
2188
+ },
2189
+ index2
2190
+ ))
2191
+ },
2192
+ `${index}-${currentIndex}`
2193
+ )
2194
+ );
2195
+ copyValue = copyValue.substring(secondIndex + checkText.length);
2196
+ if ((copyValue.split("`").length - 1) % 2 === 1) {
2197
+ copyValue = "`" + copyValue;
2198
+ }
2199
+ }
2200
+ checkText = "--IMAGE--";
2201
+ while (copyValue.includes(checkText)) {
2202
+ const firstIndex = copyValue.indexOf(checkText);
2203
+ const textValue = copyValue.substring(0, firstIndex);
2204
+ if (textValue.trim() !== "") {
2205
+ currentIndex++;
2206
+ valuePartList.push(
2207
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-xl", children: textValue }, `${index}_${currentIndex}`)
2208
+ );
2209
+ }
2210
+ const subValue = copyValue.substring(firstIndex + checkText.length);
2211
+ const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length;
2212
+ const imageSource = copyValue.substring(
2213
+ firstIndex + checkText.length,
2214
+ secondIndex
2215
+ );
2216
+ currentIndex++;
2217
+ valuePartList.push(
2218
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "relative w-[200px]", children: [
2219
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2220
+ BaseImage_default,
2221
+ {
2222
+ src: imageSource,
2223
+ alt: "media",
2224
+ size: "custom",
2225
+ className: "rounded-catchup-xlarge"
2226
+ }
2227
+ ),
2228
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2229
+ "div",
2230
+ {
2231
+ className: "absolute flex items-center justify-center top-2 right-2 h-6 w-6 cursor-pointer border rounded-catchup-xlarge border-catchup-blue p-1",
2232
+ onClick: (event) => {
2233
+ setShowFullScreen(true);
2234
+ setSelectedFullScreenItem(imageSource);
2235
+ },
2236
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2237
+ BaseImage_default,
2238
+ {
2239
+ src: "/icons/arrow-up.png",
2240
+ alt: "arrow-up",
2241
+ size: "custom",
2242
+ className: "w-full"
2243
+ }
2244
+ )
2245
+ }
2246
+ )
2247
+ ] }, `${index}-${currentIndex}`)
2248
+ );
2249
+ copyValue = copyValue.substring(secondIndex + checkText.length);
2250
+ }
2251
+ checkText = "--VIDEO--";
2252
+ while (copyValue.includes(checkText)) {
2253
+ const firstIndex = copyValue.indexOf(checkText);
2254
+ const textValue = copyValue.substring(0, firstIndex);
2255
+ if (textValue.trim() !== "") {
2256
+ currentIndex++;
2257
+ valuePartList.push(
2258
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-xl", children: textValue }, `${index}-${currentIndex}`)
2259
+ );
2260
+ }
2261
+ const subValue = copyValue.substring(firstIndex + checkText.length);
2262
+ const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length;
2263
+ const videoSource = copyValue.substring(
2264
+ firstIndex + checkText.length,
2265
+ secondIndex
2266
+ );
2267
+ currentIndex++;
2268
+ valuePartList.push(
2269
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2270
+ "video",
2271
+ {
2272
+ src: videoSource,
2273
+ className: `w-[200px] rounded-catchup-xlarge`
2274
+ },
2275
+ `${index}-${currentIndex}`
2276
+ )
2277
+ );
2278
+ copyValue = copyValue.substring(secondIndex + checkText.length);
2279
+ }
2280
+ checkText = "--AUDIO--";
2281
+ while (copyValue.includes(checkText)) {
2282
+ const firstIndex = copyValue.indexOf(checkText);
2283
+ const textValue = copyValue.substring(0, firstIndex);
2284
+ if (textValue.trim() !== "") {
2285
+ currentIndex++;
2286
+ valuePartList.push(
2287
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "text-xl", children: textValue }, `${index}-${currentIndex}`)
2288
+ );
2289
+ }
2290
+ const subValue = copyValue.substring(firstIndex + checkText.length);
2291
+ const secondIndex = subValue.indexOf(checkText) + checkText.length + textValue.length;
2292
+ const audioSource = copyValue.substring(
2293
+ firstIndex + checkText.length,
2294
+ secondIndex
2295
+ );
2296
+ currentIndex++;
2297
+ valuePartList.push(
2298
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2299
+ "audio",
2300
+ {
2301
+ src: audioSource,
2302
+ className: `w-[200px] rounded-catchup-xlarge`
2303
+ },
2304
+ `${index}-${currentIndex}`
2305
+ )
2306
+ );
2307
+ copyValue = copyValue.substring(secondIndex + checkText.length);
2308
+ }
2309
+ if (copyValue.trim() !== "") {
2310
+ currentIndex++;
2311
+ if ((copyValue.split("__").length - 1) % 2 === 1) {
2312
+ copyValue = "__" + copyValue;
2313
+ }
2314
+ if ((copyValue.split("**").length - 1) % 2 === 1) {
2315
+ copyValue = "**" + copyValue;
2316
+ }
2317
+ if ((copyValue.split("`").length - 1) % 2 === 1) {
2318
+ copyValue = "`" + copyValue;
2319
+ }
2320
+ const regexMatchImageText = copyValue.match(/<image>([\s\S]*?)<\/image>/);
2321
+ if (regexMatchImageText) {
2322
+ const imageText = regexMatchImageText[1];
2323
+ valuePartList.push(
2324
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "bg-catchup-gray-50 relative px-4 py-4 rounded-catchup-small mt-2", children: [
2325
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "absolute -top-3 bg-catchup-white border rounded-catchup-small px-2 left-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "font-bold", children: i18n_default.t("image_description") }) }),
2326
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2327
+ "span",
2328
+ {
2329
+ className: "text-xl whitespace-pre-wrap ",
2330
+ children: imageText
2331
+ },
2332
+ `${index}-${currentIndex}`
2333
+ )
2334
+ ] })
2335
+ );
2336
+ } else {
2337
+ valuePartList.push(
2338
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2339
+ "span",
2340
+ {
2341
+ className: "text-xl whitespace-pre-wrap",
2342
+ children: constructInputWithSpecialExpressionList(copyValue).map(
2343
+ (inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2344
+ "span",
2345
+ {
2346
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
2347
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_katex.InlineMath, { math: inputPart.value }) }) : inputPart.value
2348
+ },
2349
+ index2
2350
+ )
2351
+ )
2352
+ },
2353
+ `${index}-${currentIndex}`
2354
+ )
2355
+ );
2356
+ }
2357
+ }
2358
+ return valuePartList;
2359
+ };
2360
+ const RenderShowFullScreenItem = () => {
2361
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2362
+ import_react_modal.default,
2363
+ {
2364
+ isOpen: showFullScreen,
2365
+ onAfterOpen: () => {
2366
+ },
2367
+ onRequestClose: () => {
2368
+ setShowFullScreen(false);
2369
+ setSelectedFullScreenItem("");
2370
+ },
2371
+ style: {
2372
+ content: {
2373
+ top: "50%",
2374
+ left: "50%",
2375
+ right: "auto",
2376
+ bottom: "auto",
2377
+ marginRight: "-50%",
2378
+ transform: "translate(-50%, -50%)",
2379
+ padding: 0,
2380
+ borderRadius: 20,
2381
+ background: "",
2382
+ border: "",
2383
+ width: "900px",
2384
+ maxHeight: "70%",
2385
+ overflow: "auto"
2386
+ },
2387
+ overlay: {
2388
+ background: "rgba(0, 0, 0, 0.6)"
2389
+ }
2390
+ },
2391
+ contentLabel: "",
2392
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex-1 flex flex-col", children: [
2393
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "ml-auto px-5 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2394
+ BaseImage_default,
2395
+ {
2396
+ src: "/icons/cross-red.png",
2397
+ alt: "cross-red",
2398
+ size: "medium",
2399
+ onClick: () => {
2400
+ setShowFullScreen(false);
2401
+ setSelectedFullScreenItem("");
2402
+ }
2403
+ }
2404
+ ) }),
2405
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex items-center justify-center h-[500]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2406
+ BaseImage_default,
2407
+ {
2408
+ src: selectedFullScreenItem,
2409
+ alt: "selected-fullscreen-item",
2410
+ size: "custom",
2411
+ className: "w-full"
2412
+ }
2413
+ ) })
2414
+ ] })
2415
+ }
2416
+ );
2417
+ };
2418
+ const RenderMainContent = () => {
2419
+ if (type === "TEXT") {
2420
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-3 flex flex-row flex-wrap items-center mx-auto w-full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: retrieveValueParts(value) }) });
2421
+ } else if (type === "IMAGE") {
2422
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-3 flex flex-col items-center relative", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
2423
+ "div",
2424
+ {
2425
+ className: `${size ? `${convertToPercentage(size)}` : ""} rounded-catchup-xlarge relative`,
2426
+ children: [
2427
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2428
+ BaseImage_default,
2429
+ {
2430
+ src: value,
2431
+ alt: "body-image",
2432
+ size: "custom",
2433
+ className: "w-full rounded-catchup-xlarge"
2434
+ }
2435
+ ),
2436
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2437
+ "div",
2438
+ {
2439
+ className: "absolute flex items-center justify-center top-2 right-2 h-6 w-6 cursor-pointer border rounded-catchup-xlarge border-catchup-blue p-1",
2440
+ onClick: () => {
2441
+ setShowFullScreen(true);
2442
+ setSelectedFullScreenItem(value);
2443
+ },
2444
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2445
+ BaseImage_default,
2446
+ {
2447
+ src: "/icons/arrow-up.png",
2448
+ alt: "arrow-up",
2449
+ size: "custom",
2450
+ className: "w-full"
2451
+ }
2452
+ )
2453
+ }
2454
+ )
2455
+ ]
2456
+ }
2457
+ ) });
2458
+ } else if (type === "VIDEO") {
2459
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-3 flex flex-col items-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2460
+ "video",
2461
+ {
2462
+ src: value,
2463
+ className: `${size ? `${convertToPercentage(size)}` : ""} rounded-catchup-xlarge`,
2464
+ controls: true
2465
+ }
2466
+ ) });
2467
+ } else if (type === "AUDIO") {
2468
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "mb-3 flex flex-col items-center", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("audio", { src: value, controls: true, className: `rounded-catchup-xlarge` }) });
2469
+ }
2470
+ };
2471
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "w-full", children: [
2472
+ RenderShowFullScreenItem(),
2473
+ RenderMainContent()
2474
+ ] }, index);
2475
+ };
2476
+ var ShowBodyMediaByContentType_default = ShowBodyMediaByContentType;
2477
+
2478
+ // src/components/activities/body-content/ActivityBodyContent.tsx
2479
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2480
+ var ActivityBodyContent = ({
2481
+ templateType,
2482
+ bodyMap,
2483
+ contentMap,
2484
+ answerMap
2485
+ }) => {
2486
+ let currentQQIndex = 0;
2487
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "flex flex-col justify-center items-center", children: Object.keys(bodyMap).map((key, index) => {
2488
+ const body = JSON.parse(bodyMap[key]);
2489
+ if (templateType === "DROPDOWN") {
2490
+ while (body.value.includes("@@")) {
2491
+ if (answerMap[currentQQIndex].trim() === "" || answerMap[currentQQIndex].trim() === "DEFAULT_OPTION") {
2492
+ body.value = body.value.replace(
2493
+ "@@",
2494
+ `----(${currentQQIndex + 1})----`
2495
+ );
2496
+ } else {
2497
+ if (contentMap["type"] === "TEXT") {
2498
+ body.value = body.value.replace(
2499
+ "@@",
2500
+ `--TEXT--${answerMap[currentQQIndex]}--TEXT--`
2501
+ );
2502
+ } else if (contentMap["type"] === "IMAGE") {
2503
+ body.value = body.value.replace(
2504
+ "@@",
2505
+ `--IMAGE--${answerMap[currentQQIndex]}--IMAGE--`
2506
+ );
2507
+ } else if (contentMap["type"] === "VIDEO") {
2508
+ body.value = body.value.replace(
2509
+ "@@",
2510
+ `--VIDEO--${answerMap[currentQQIndex]}--VIDEO--`
2511
+ );
2512
+ } else if (contentMap["type"] === "AUDIO") {
2513
+ body.value = body.value.replace(
2514
+ "@@",
2515
+ `--AUDIO--${answerMap[currentQQIndex]}--AUDIO--`
2516
+ );
2517
+ } else {
2518
+ body.value = body.value.replace(
2519
+ "@@",
2520
+ answerMap[currentQQIndex]
2521
+ );
2522
+ }
2523
+ }
2524
+ currentQQIndex++;
2525
+ }
2526
+ } else if (templateType === "FILL_IN_THE_BLANKS") {
2527
+ while (body.value.includes("@@")) {
2528
+ if (answerMap[currentQQIndex].trim() === "") {
2529
+ body.value = body.value.replace(
2530
+ "@@",
2531
+ `----(${currentQQIndex + 1})----`
2532
+ );
2533
+ } else {
2534
+ if (contentMap["type"] === "TEXT") {
2535
+ body.value = body.value.replace(
2536
+ "@@",
2537
+ `--TEXT--${answerMap[currentQQIndex]}--TEXT--`
2538
+ );
2539
+ } else if (contentMap["type"] === "IMAGE") {
2540
+ body.value = body.value.replace(
2541
+ "@@",
2542
+ `--IMAGE--${answerMap[currentQQIndex]}--IMAGE--`
2543
+ );
2544
+ } else if (contentMap["type"] === "VIDEO") {
2545
+ body.value = body.value.replace(
2546
+ "@@",
2547
+ `--VIDEO--${answerMap[currentQQIndex]}--VIDEO--`
2548
+ );
2549
+ } else if (contentMap["type"] === "AUDIO") {
2550
+ body.value = body.value.replace(
2551
+ "@@",
2552
+ `--AUDIO--${answerMap[currentQQIndex]}--AUDIO--`
2553
+ );
2554
+ } else {
2555
+ body.value = body.value.replace(
2556
+ "@@",
2557
+ answerMap[currentQQIndex]
2558
+ );
2559
+ }
2560
+ }
2561
+ currentQQIndex++;
2562
+ }
2563
+ }
2564
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2565
+ ShowBodyMediaByContentType_default,
2566
+ {
2567
+ index,
2568
+ type: body.type,
2569
+ value: body.value,
2570
+ size: body.size
2571
+ }
2572
+ );
2573
+ }) });
2574
+ };
2575
+ var ActivityBodyContent_default = ActivityBodyContent;
2576
+
2577
+ // src/components/activities/material-content/DropdownActivityMaterialContent.tsx
2578
+ var import_react_katex2 = require("react-katex");
2579
+
2580
+ // src/components/groups/InputGroup.tsx
2581
+ var import_react_select = __toESM(require("react-select"));
2582
+ var import_react9 = require("react");
2583
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2584
+ var InputGroup = ({
2585
+ type,
2586
+ title,
2587
+ defaultValue,
2588
+ placeholder,
2589
+ value,
2590
+ onFocus,
2591
+ onChange,
2592
+ onClick,
2593
+ onKeyDown,
2594
+ optionList,
2595
+ errorText,
2596
+ multiple,
2597
+ accept,
2598
+ theme,
2599
+ useMinHeight,
2600
+ disabled,
2601
+ limit
2602
+ }) => {
2603
+ const textAreaRef = (0, import_react9.useRef)(null);
2604
+ (0, import_react9.useEffect)(() => {
2605
+ if (!textAreaRef) return;
2606
+ if (!textAreaRef.current) return;
2607
+ if (value) {
2608
+ textAreaRef.current.style.height = `${textAreaRef.current.scrollHeight}px`;
2609
+ } else {
2610
+ textAreaRef.current.style.height = `44px`;
2611
+ }
2612
+ }, [textAreaRef, value]);
2613
+ const retrieveNullableOptionList = () => {
2614
+ if (!optionList) return [];
2615
+ const currentOptionList = {
2616
+ text: i18n_default.t("option_please_select"),
2617
+ value: "DEFAULT_OPTION"
2618
+ };
2619
+ return [currentOptionList, ...optionList];
2620
+ };
2621
+ const convertOptionListToSelectComponent = (optionList2) => {
2622
+ return optionList2.map((option) => ({
2623
+ value: option.value,
2624
+ label: option.text
2625
+ }));
2626
+ };
2627
+ const handleTextAreaOnChange = (e) => {
2628
+ if (!textAreaRef) return;
2629
+ if (!textAreaRef.current) return;
2630
+ textAreaRef.current.style.height = `30px`;
2631
+ textAreaRef.current.style.height = `${e.target.scrollHeight + 6}px`;
2632
+ if (limit) {
2633
+ if (e.target.value.length <= limit) {
2634
+ onChange && onChange(e);
2635
+ }
2636
+ } else {
2637
+ onChange && onChange(e);
2638
+ }
2639
+ };
2640
+ const CheckboxInputGroup = () => {
2641
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
2642
+ "div",
2643
+ {
2644
+ className: "flex flex-row items-center gap-x-1 cursor-pointer",
2645
+ onClick,
2646
+ children: [
2647
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2648
+ BaseImage_default,
2649
+ {
2650
+ src: value ? "/icons/checkbox.png" : "/icons/checkbox-empty.png",
2651
+ alt: "checkbox",
2652
+ size: "xsmall",
2653
+ onClick: () => {
2654
+ }
2655
+ }
2656
+ ),
2657
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "", children: title })
2658
+ ]
2659
+ }
2660
+ );
2661
+ };
2662
+ const FileInputGroup = () => {
2663
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "my-1", children: [
2664
+ title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
2665
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2666
+ "input",
2667
+ {
2668
+ className: "w-full py-2 px-4 border border-catchup-gray-100 placeholder-catchup-gray-200 rounded-catchup-large text-black focus:outline-none focus:border-catchup-blue-400 focus:shadow-input",
2669
+ type,
2670
+ defaultValue,
2671
+ placeholder,
2672
+ value,
2673
+ onChange,
2674
+ onClick,
2675
+ multiple,
2676
+ accept
2677
+ }
2678
+ )
2679
+ ] });
2680
+ };
2681
+ const DateInputGroup = () => {
2682
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "my-1", children: [
2683
+ title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
2684
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2685
+ "input",
2686
+ {
2687
+ className: `w-full py-2 px-4 border ${errorText ? "border-catchup-red shadow-error" : theme === "red" ? "border-catchup-red bg-catchup-red text-catchup-white focus:border-catchup-red" : "border-catchup-gray-100 placeholder-catchup-gray-200 focus:border-catchup-blue-400"} rounded-catchup-large text-black focus:outline-none focus:shadow-input`,
2688
+ type,
2689
+ defaultValue,
2690
+ placeholder,
2691
+ value,
2692
+ onChange,
2693
+ disabled
2694
+ }
2695
+ )
2696
+ ] });
2697
+ };
2698
+ const SearchableSelectInputGroup = () => {
2699
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "my-1", children: [
2700
+ title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400 ", children: title }) : null,
2701
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2702
+ import_react_select.default,
2703
+ {
2704
+ options: convertOptionListToSelectComponent(
2705
+ retrieveNullableOptionList()
2706
+ ),
2707
+ className: `w-full`,
2708
+ styles: {
2709
+ control: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
2710
+ borderWidth: 1,
2711
+ borderStyle: "solid",
2712
+ borderRadius: 16,
2713
+ borderColor: errorText ? "#ff6b6b" : theme === "red" ? "#ff6b6b" : state.isFocused ? "#73d7e6" : state.isActive ? "#d2dde1" : "#d2dde1",
2714
+ backgroundColor: theme !== "red" ? "#ffffff" : "#ff6b6b",
2715
+ paddingRight: 6,
2716
+ paddingLeft: 6,
2717
+ paddingTop: 2,
2718
+ paddingBottom: 2,
2719
+ outline: "none",
2720
+ margin: 0,
2721
+ text: theme === "red" ? "#ffffff" : "#55777f",
2722
+ boxShadow: errorText ? "0px 0px 7px 0px rgba(255, 107, 107, 1)" : state.isFocused ? "0px 0px 7px 0px rgba(115, 215, 230, 100)" : "none",
2723
+ "&:hover": {
2724
+ outline: "none"
2725
+ }
2726
+ }),
2727
+ menu: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
2728
+ borderRadius: 16,
2729
+ paddingTop: 10,
2730
+ paddingBottom: 10,
2731
+ boxShadow: "0px 0px 6px 0px rgba(0, 0, 0, 0.25)"
2732
+ }),
2733
+ option: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
2734
+ color: state.isSelected ? "#2b3a41" : "#2b3a41",
2735
+ backgroundColor: state.isSelected ? "#eaecf1" : "",
2736
+ "&:hover": {
2737
+ backgroundColor: "#eaecf1"
2738
+ },
2739
+ paddingLeft: 20,
2740
+ paddingRight: 20
2741
+ }),
2742
+ dropdownIndicator: (baseStyles, state) => __spreadProps(__spreadValues({}, baseStyles), {
2743
+ color: state.isFocused ? "#57c2d3" : "#55777f",
2744
+ "&:hover": {
2745
+ color: state.isFocused ? "#57c2d3" : "#55777f"
2746
+ }
2747
+ })
2748
+ },
2749
+ components: {
2750
+ IndicatorSeparator: () => null
2751
+ },
2752
+ value: convertOptionListToSelectComponent(
2753
+ retrieveNullableOptionList()
2754
+ ).find((option) => option.value === value),
2755
+ onChange: (target) => {
2756
+ const event = { target };
2757
+ onChange && onChange(event);
2758
+ }
2759
+ }
2760
+ )
2761
+ ] });
2762
+ };
2763
+ const TextAreaInputGroup = () => {
2764
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "my-1 flex-1 flex flex-col relative", children: [
2765
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "flex flex-row justify-between items-center", children: [
2766
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null }),
2767
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: limit ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { className: "text-md font-semibold pr-2 py-1 text-catchup-gray-400", children: [
2768
+ value.length,
2769
+ " / ",
2770
+ limit
2771
+ ] }) : null })
2772
+ ] }),
2773
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2774
+ "textarea",
2775
+ {
2776
+ ref: textAreaRef,
2777
+ disabled,
2778
+ className: `w-full ${useMinHeight ? "min-h-[250px]" : ""} resize-none overflow-hidden py-2 px-4 border ${errorText ? "border-catchup-red shadow-error placeholder:text-catchup-red placeholder:opacity-80" : "border-catchup-gray-100"} placeholder-catchup-gray-200 rounded-catchup-large focus:outline-none focus:border-catchup-blue-400 ${disabled ? "bg-catchup-lighter-gray" : null} focus:shadow-input`,
2779
+ placeholder: errorText ? errorText : placeholder,
2780
+ value,
2781
+ onLoad: (e) => {
2782
+ console.log(e);
2783
+ },
2784
+ onChange: handleTextAreaOnChange,
2785
+ onFocus,
2786
+ onKeyDown
2787
+ }
2788
+ )
2789
+ ] });
2790
+ };
2791
+ const TextInputGroup = () => {
2792
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "my-1 relative", children: [
2793
+ title ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "text-md font-semibold pl-2 py-1 text-catchup-gray-400", children: title }) : null,
2794
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2795
+ "input",
2796
+ {
2797
+ disabled,
2798
+ className: `w-full py-2 px-4 border ${errorText ? "border-catchup-red shadow-error placeholder:text-catchup-red placeholder:opacity-80" : "border-catchup-gray-100"} rounded-catchup-large focus:outline-none placeholder-catchup-gray-200 focus:border-catchup-blue-400 ${disabled ? "bg-catchup-lighter-gray" : null} focus:shadow-input`,
2799
+ type,
2800
+ defaultValue,
2801
+ placeholder: errorText ? errorText : placeholder,
2802
+ value,
2803
+ onChange,
2804
+ onFocus,
2805
+ onKeyDown
2806
+ }
2807
+ )
2808
+ ] });
2809
+ };
2810
+ const RenderMainContent = () => {
2811
+ if (type === "text" || type === "number") {
2812
+ return TextInputGroup();
2813
+ } else if (type === "textarea") {
2814
+ return TextAreaInputGroup();
2815
+ } else if (type === "password") {
2816
+ return TextInputGroup();
2817
+ } else if (type === "select") {
2818
+ return SearchableSelectInputGroup();
2819
+ } else if (type === "date" || type === "datetime-local") {
2820
+ return DateInputGroup();
2821
+ } else if (type === "file") {
2822
+ return FileInputGroup();
2823
+ } else if (type === "checkbox") {
2824
+ return CheckboxInputGroup();
2825
+ }
2826
+ };
2827
+ return RenderMainContent();
2828
+ };
2829
+ var InputGroup_default = InputGroup;
2830
+
2831
+ // src/components/activities/material-content/DropdownActivityMaterialContent.tsx
2832
+ var import_react12 = require("react");
2833
+ var import_react13 = require("react");
2834
+
2835
+ // src/utilization/AppUtilization.ts
2836
+ var colors = [
2837
+ "#FF5733",
2838
+ // Fiery Red
2839
+ "#3357FF",
2840
+ // Royal Blue
2841
+ "#FF33A1",
2842
+ // Fuchsia Pink
2843
+ "#33FFF0",
2844
+ // Aqua Blue
2845
+ "#FF9633",
2846
+ // Tangerine
2847
+ "#8D33FF",
2848
+ // Violet
2849
+ "#FFD733",
2850
+ // Sunny Yellow
2851
+ "#33FF6D",
2852
+ // Mint Green
2853
+ "#FFB833",
2854
+ // Amber
2855
+ "#33C7FF",
2856
+ // Sky Blue
2857
+ "#FF33E4",
2858
+ // Magenta
2859
+ "#5EFF33",
2860
+ // Neon Green
2861
+ "#FF3380",
2862
+ // Hot Pink
2863
+ "#33FFAF",
2864
+ // Seafoam Green
2865
+ "#3383FF",
2866
+ // Dodger Blue
2867
+ "#FF9533",
2868
+ // Pumpkin Orange
2869
+ "#BF33FF",
2870
+ // Electric Purple
2871
+ "#FFDA33",
2872
+ // Golden Yellow
2873
+ "#33FF89",
2874
+ // Turquoise
2875
+ "#FF3333",
2876
+ // Red
2877
+ "#33BFFF",
2878
+ // Light Blue
2879
+ "#FF33B3",
2880
+ // Pink
2881
+ "#5BFF33",
2882
+ // Light Green
2883
+ "#FF3385",
2884
+ // Rose
2885
+ "#33FFC9",
2886
+ // Aquamarine
2887
+ "#33A1FF",
2888
+ // Azure
2889
+ "#FF7A33",
2890
+ // Cantaloupe
2891
+ "#A533FF",
2892
+ // Lavender
2893
+ "#FFE033",
2894
+ // Mustard Yellow
2895
+ "#33FF7A",
2896
+ // Apple Green
2897
+ "#FF4D33",
2898
+ // Bright Red
2899
+ "#33FF95",
2900
+ // Light Turquoise
2901
+ "#FFC433",
2902
+ // Peach
2903
+ "#33FF7D",
2904
+ // Green Apple
2905
+ "#FF338A",
2906
+ // Raspberry Pink
2907
+ "#33FFE4",
2908
+ // Light Aqua
2909
+ "#336AFF",
2910
+ // Cobalt Blue
2911
+ "#FF3370",
2912
+ // Raspberry
2913
+ "#33FF95",
2914
+ // Light Green
2915
+ "#FFA633",
2916
+ // Orange
2917
+ "#33FF57"
2918
+ // Lime Green
2919
+ ];
2920
+ var shuffleArray = (array) => {
2921
+ const copyArray = JSON.parse(JSON.stringify(array));
2922
+ for (let i = copyArray.length - 1; i > 0; i--) {
2923
+ const j = Math.floor(Math.random() * (i + 1));
2924
+ [copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
2925
+ }
2926
+ return copyArray;
2927
+ };
2928
+ var getColorByIndex = (index) => {
2929
+ return colors[index];
2930
+ };
2931
+
2932
+ // src/components/dropdowns/MediaDropdown.tsx
2933
+ var import_react10 = require("react");
2934
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2935
+ var MediaDropdown = ({ id, answer, optionList }) => {
2936
+ const [showDropdown, setShowDropdown] = (0, import_react10.useState)(false);
2937
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2938
+ "div",
2939
+ {
2940
+ className: "w-full relative",
2941
+ onMouseEnter: () => {
2942
+ setShowDropdown(true);
2943
+ },
2944
+ onMouseLeave: () => {
2945
+ setShowDropdown(false);
2946
+ },
2947
+ children: [
2948
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-full flex flex-col items-center justify-center", children: answer }),
2949
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2950
+ "ul",
2951
+ {
2952
+ className: `absolute ${showDropdown ? "opacity-100 visible" : "opacity-0 invisible"} flex flex-col items-center w-[300px] rounded-catchup-xlarge border-3 transition-all duration-300 border-catchup-blue bg-catchup-white px-4 py-4 translate-x-1/2 right-1/2 mt-2 z-10`,
2953
+ children: optionList.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
2954
+ "li",
2955
+ {
2956
+ className: `${option.listItemClassNames ? option.listItemClassNames : ""}`,
2957
+ children: [
2958
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2959
+ "div",
2960
+ {
2961
+ className: `w-full flex flex-col my-2 ${option.divClassNames ? option.divClassNames : ""}`,
2962
+ onClick: option.onClick,
2963
+ children: option.media
2964
+ }
2965
+ ),
2966
+ index !== optionList.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "w-full border my-1 border-catchup-light-blue rounded-catchup-full" }) : null
2967
+ ]
2968
+ },
2969
+ option.id
2970
+ ))
2971
+ }
2972
+ )
2973
+ ]
2974
+ },
2975
+ id
2976
+ );
2977
+ };
2978
+ var MediaDropdown_default = MediaDropdown;
2979
+
2980
+ // src/components/activities/material-content/ShowMaterialMediaByContentType.tsx
2981
+ var import_react11 = require("react");
2982
+ var import_react_modal2 = __toESM(require("react-modal"));
2983
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2984
+ var ShowMaterialMediaByContentType = ({
2985
+ key,
2986
+ contentType,
2987
+ src,
2988
+ canFullScreen
2989
+ }) => {
2990
+ const [showFullScreen, setShowFullScreen] = (0, import_react11.useState)(false);
2991
+ const [selectedFullScreenItem, setSelectedFullScreenItem] = (0, import_react11.useState)(null);
2992
+ const [isLoaded, setIsLoaded] = (0, import_react11.useState)(false);
2993
+ const [isFullHeight, setIsFullHeight] = (0, import_react11.useState)(false);
2994
+ const imageRef = (0, import_react11.useRef)(null);
2995
+ (0, import_react11.useEffect)(() => {
2996
+ setIsLoaded(false);
2997
+ }, []);
2998
+ (0, import_react11.useEffect)(() => {
2999
+ if (!isLoaded) return;
3000
+ if (!imageRef) return;
3001
+ if (!imageRef.current) return;
3002
+ const w = imageRef.current.naturalWidth;
3003
+ const h = imageRef.current.naturalHeight;
3004
+ if (w >= h) {
3005
+ setIsFullHeight(false);
3006
+ } else {
3007
+ setIsFullHeight(true);
3008
+ }
3009
+ }, [isLoaded, key]);
3010
+ const RenderShowFullScreenItem = () => {
3011
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3012
+ import_react_modal2.default,
3013
+ {
3014
+ isOpen: showFullScreen,
3015
+ onAfterOpen: () => {
3016
+ },
3017
+ onRequestClose: () => {
3018
+ setShowFullScreen(false);
3019
+ setSelectedFullScreenItem(null);
3020
+ },
3021
+ style: {
3022
+ content: {
3023
+ top: "50%",
3024
+ left: "50%",
3025
+ right: "auto",
3026
+ bottom: "auto",
3027
+ marginRight: "-50%",
3028
+ transform: "translate(-50%, -50%)",
3029
+ padding: 0,
3030
+ borderRadius: 20,
3031
+ background: "",
3032
+ border: "",
3033
+ width: "900px",
3034
+ maxHeight: "70%",
3035
+ overflow: "auto"
3036
+ },
3037
+ overlay: {
3038
+ background: "rgba(0, 0, 0, 0.6)"
3039
+ }
3040
+ },
3041
+ contentLabel: "",
3042
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "flex-1 flex flex-col", children: [
3043
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "ml-auto px-5 py-3", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3044
+ BaseImage_default,
3045
+ {
3046
+ src: "/icons/cross-red.png",
3047
+ alt: "cross-red",
3048
+ size: "medium",
3049
+ onClick: () => {
3050
+ setShowFullScreen(false);
3051
+ setSelectedFullScreenItem(null);
3052
+ }
3053
+ }
3054
+ ) }),
3055
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center h-[500px]", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3056
+ BaseImage_default,
3057
+ {
3058
+ src: selectedFullScreenItem,
3059
+ alt: "selected-fullscreen-item",
3060
+ size: "custom",
3061
+ className: "w-full"
3062
+ }
3063
+ ) })
3064
+ ] })
3065
+ }
3066
+ );
3067
+ };
3068
+ return contentType === "IMAGE" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
3069
+ RenderShowFullScreenItem(),
3070
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "my-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full flex flex-row flex-wrap items-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
3071
+ "div",
3072
+ {
3073
+ className: `${isFullHeight ? "h-catchup-activity-box-item" : "max-w-catchup-activity-box-item"} flex flex-col justify-center items-center relative`,
3074
+ children: [
3075
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3076
+ BaseImage_default,
3077
+ {
3078
+ src,
3079
+ alt: "image",
3080
+ ref: imageRef,
3081
+ size: "custom",
3082
+ className: "h-full rounded-catchup-xlarge",
3083
+ onLoad: () => {
3084
+ setIsLoaded(true);
3085
+ }
3086
+ }
3087
+ ),
3088
+ src !== null && src !== "" && src !== "DEFAULT_OPTION" && canFullScreen ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3089
+ "div",
3090
+ {
3091
+ className: "absolute flex items-center justify-center top-2 right-2 h-6 w-6 cursor-pointer border rounded-catchup-xlarge border-catchup-blue p-1",
3092
+ onMouseEnter: (e) => {
3093
+ e.preventDefault();
3094
+ },
3095
+ onClick: (e) => {
3096
+ e.preventDefault();
3097
+ setShowFullScreen(true);
3098
+ setSelectedFullScreenItem(src);
3099
+ },
3100
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3101
+ BaseImage_default,
3102
+ {
3103
+ src: "/icons/arrow-up.png",
3104
+ alt: "arrow-up",
3105
+ size: "custom",
3106
+ className: "w-full"
3107
+ }
3108
+ )
3109
+ }
3110
+ ) : null
3111
+ ]
3112
+ }
3113
+ ) }) })
3114
+ ] }, key) : contentType === "VIDEO" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "my-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full flex flex-row flex-wrap items-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full flex flex-col justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3115
+ "video",
3116
+ {
3117
+ className: "h-catchup-activity-box-item rounded-catchup-xlarge",
3118
+ src,
3119
+ controls: true,
3120
+ onClick: () => {
3121
+ }
3122
+ }
3123
+ ) }) }) }) : contentType === "AUDIO" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "my-2", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full flex flex-row flex-wrap items-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "h-full flex flex-col justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
3124
+ "audio",
3125
+ {
3126
+ className: "h-catchup-activity-box-item rounded-catchup-xlarge",
3127
+ src,
3128
+ controls: true,
3129
+ onClick: () => {
3130
+ }
3131
+ }
3132
+ ) }) }) }) : null;
3133
+ };
3134
+ var ShowMaterialMediaByContentType_default = ShowMaterialMediaByContentType;
3135
+
3136
+ // src/components/activities/material-content/DropdownActivityMaterialContent.tsx
3137
+ var import_jsx_runtime16 = require("react/jsx-runtime");
3138
+ var DropdownActivityMaterialContent = ({
3139
+ uniqueValue,
3140
+ answer,
3141
+ materialMap,
3142
+ contentMap,
3143
+ checkCanAnswerQuestion,
3144
+ onChange,
3145
+ isPreview,
3146
+ showCorrectAnswer
3147
+ }) => {
3148
+ const [updated, setUpdated] = (0, import_react13.useState)(false);
3149
+ (0, import_react12.useEffect)(() => {
3150
+ if (!showCorrectAnswer) return;
3151
+ const foundAnswer = answer.data.find(
3152
+ (answerData) => answerData.type === "DROPDOWN"
3153
+ );
3154
+ if (foundAnswer.answerMap.length === 0) return;
3155
+ foundAnswer.answerMap = Object.keys(materialMap).map(
3156
+ (materialMapKey, index) => Object.keys(materialMap[materialMapKey])[0]
3157
+ );
3158
+ onChange(answer, 0, Object.keys(materialMap[0])[0]);
3159
+ setUpdated(true);
3160
+ }, [showCorrectAnswer]);
3161
+ (0, import_react12.useEffect)(() => {
3162
+ if (!updated) return;
3163
+ setUpdated(false);
3164
+ }, [updated]);
3165
+ const retrieveAnswerMap = () => {
3166
+ const foundIndex = answer.data.findIndex(
3167
+ (answerData) => answerData.type === "DROPDOWN"
3168
+ );
3169
+ return answer.data[foundIndex].answerMap;
3170
+ };
3171
+ const checkAnswerState = (correctAnswer, learnerAnswer) => {
3172
+ if (!isPreview) return "HIDDEN";
3173
+ if (correctAnswer === learnerAnswer) {
3174
+ return "CORRECT";
3175
+ }
3176
+ return "INCORRECT";
3177
+ };
3178
+ const answerMap = retrieveAnswerMap();
3179
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex flex-row flex-wrap items-center", children: [
3180
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_dropdown_text") }) }),
3181
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DividerLine_default, {}) }),
3182
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-full flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
3183
+ const answerKey = Object.keys(materialMap[materialKey])[0];
3184
+ const learnerAnswerState = checkAnswerState(
3185
+ answerKey,
3186
+ answerMap[materialKey]
3187
+ );
3188
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
3189
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { className: "text-xl", children: [
3190
+ parseFloat(materialKey) + 1,
3191
+ "."
3192
+ ] }) }),
3193
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "w-full relative", children: [
3194
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3195
+ InputGroup_default,
3196
+ {
3197
+ type: "select",
3198
+ value: answerMap[materialKey],
3199
+ optionList: shuffleArray(
3200
+ materialMap[materialKey][answerKey]
3201
+ ).map((materialOption) => ({
3202
+ text: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
3203
+ materialOption
3204
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3205
+ "span",
3206
+ {
3207
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
3208
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3209
+ import_react_katex2.InlineMath,
3210
+ {
3211
+ math: inputPart.value
3212
+ }
3213
+ ) }) : inputPart.value
3214
+ },
3215
+ index2
3216
+ )) }),
3217
+ value: materialOption
3218
+ })),
3219
+ onChange: (e) => {
3220
+ onChange(answer, materialKey, e.target.value);
3221
+ }
3222
+ }
3223
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3224
+ MediaDropdown_default,
3225
+ {
3226
+ id: materialKey,
3227
+ answer: answerMap[materialKey] === "DEFAULT_OPTION" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "w-catchup-activity-box-item border h-catchup-activity-box-item rounded-catchup-xlarge border-dashed border-catchup-blue", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "italic", children: i18n_default.t("please_select") }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3228
+ ShowMaterialMediaByContentType_default,
3229
+ {
3230
+ contentType: contentMap.type,
3231
+ src: answerMap[materialKey],
3232
+ canFullScreen: false
3233
+ },
3234
+ `${uniqueValue}-${index}`
3235
+ ),
3236
+ optionList: materialMap[materialKey][answerKey].map(
3237
+ (materialOption, index2) => ({
3238
+ id: index2,
3239
+ media: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3240
+ ShowMaterialMediaByContentType_default,
3241
+ {
3242
+ contentType: contentMap.type,
3243
+ src: materialOption,
3244
+ canFullScreen: false
3245
+ },
3246
+ `${uniqueValue}-${index2}`
3247
+ ) }, index2),
3248
+ onClick: (e) => {
3249
+ onChange(
3250
+ answer,
3251
+ materialKey,
3252
+ e.target.currentSrc
3253
+ );
3254
+ }
3255
+ })
3256
+ )
3257
+ }
3258
+ ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
3259
+ answerMap[materialKey]
3260
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3261
+ "span",
3262
+ {
3263
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
3264
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react_katex2.InlineMath, { math: inputPart.value }) }) : inputPart.value
3265
+ },
3266
+ index2
3267
+ )) }) }),
3268
+ learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute top-[0px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3269
+ BaseImage_default,
3270
+ {
3271
+ src: "/icons/checkbox.png",
3272
+ alt: "chekbbox",
3273
+ size: "small"
3274
+ }
3275
+ ) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "absolute top-[0px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
3276
+ BaseImage_default,
3277
+ {
3278
+ src: "/icons/cross-red.png",
3279
+ alt: "cross-red",
3280
+ size: "small"
3281
+ }
3282
+ ) }) : null
3283
+ ] })
3284
+ ] }) }) }, index);
3285
+ }) })
3286
+ ] });
3287
+ };
3288
+ var DropdownActivityMaterialContent_default = DropdownActivityMaterialContent;
3289
+
3290
+ // src/components/activities/DropdownActivityContent.tsx
3291
+ var import_jsx_runtime17 = require("react/jsx-runtime");
3292
+ var DropdownActivityContent = ({
3293
+ answer,
3294
+ data,
3295
+ canAnswerQuestion,
3296
+ changeAnswer,
3297
+ isPreview,
3298
+ showCorrectAnswer
3299
+ }) => {
3300
+ const contentMap = parseContentMapFromData(data);
3301
+ const dropdownBodyMap = parseBodyMapFromData(data, "DROPDOWN");
3302
+ const dropdownMaterialMap = parseMaterialMapFromData(data, "DROPDOWN");
3303
+ const retrieveCurrentAnswerMap = () => {
3304
+ let foundIndex = answer.data.findIndex(
3305
+ (answerData) => answerData.type === "DROPDOWN"
3306
+ );
3307
+ return answer.data[foundIndex].answerMap;
3308
+ };
3309
+ const handleDropdownAnswerOnChange = (answer2, key, value) => {
3310
+ const answerMap = retrieveCurrentAnswerMap();
3311
+ answerMap[key] = value;
3312
+ changeAnswer(answer2);
3313
+ };
3314
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
3315
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3316
+ ActivityBodyContent_default,
3317
+ {
3318
+ bodyMap: dropdownBodyMap,
3319
+ answerMap: retrieveCurrentAnswerMap(),
3320
+ contentMap,
3321
+ templateType: "DROPDOWN"
3322
+ }
3323
+ ) }),
3324
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "contents md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DividerLine_default, {}) }),
3325
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(VerticalDividerLine_default, {}) }),
3326
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
3327
+ DropdownActivityMaterialContent_default,
3328
+ {
3329
+ uniqueValue: JSON.stringify(data.contentMap),
3330
+ answer,
3331
+ materialMap: dropdownMaterialMap,
3332
+ contentMap,
3333
+ checkCanAnswerQuestion: canAnswerQuestion,
3334
+ onChange: handleDropdownAnswerOnChange,
3335
+ isPreview,
3336
+ showCorrectAnswer
3337
+ }
3338
+ ) })
3339
+ ] });
3340
+ };
3341
+ var DropdownActivityContent_default = DropdownActivityContent;
3342
+
3343
+ // src/components/activities/material-content/FillInTheBlanksActivityMaterialContent.tsx
3344
+ var import_react_katex3 = require("react-katex");
3345
+ var import_react15 = require("react");
3346
+ var import_react16 = require("react");
3347
+ var import_react_dnd3 = require("react-dnd");
3348
+
3349
+ // src/components/dnds/DraggableItem.tsx
3350
+ var import_react_dnd = require("react-dnd");
3351
+ var import_jsx_runtime18 = require("react/jsx-runtime");
3352
+ var DraggableItem = ({
3353
+ key,
3354
+ item,
3355
+ type,
3356
+ component,
3357
+ moveCardHandler
3358
+ }) => {
3359
+ const [{ isDragging }, drag] = (0, import_react_dnd.useDrag)({
3360
+ type,
3361
+ item,
3362
+ end: (item2, monitor) => {
3363
+ const dropResult = monitor.getDropResult();
3364
+ if (dropResult) {
3365
+ moveCardHandler();
3366
+ }
3367
+ },
3368
+ collect: (monitor) => ({
3369
+ isDragging: monitor.isDragging()
3370
+ })
3371
+ });
3372
+ const opacity = isDragging ? 0.4 : 1;
3373
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3374
+ "div",
3375
+ {
3376
+ className: `${isDragging ? "w-[0px] opacity-0" : "opacity-100"} transition-all duration-500`,
3377
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: drag, className: "", style: { opacity }, children: component })
3378
+ },
3379
+ key
3380
+ );
3381
+ };
3382
+ var DraggableItem_default = DraggableItem;
3383
+
3384
+ // src/components/dnds/DroppableItem.tsx
3385
+ var import_react14 = require("react");
3386
+ var import_react_dnd2 = require("react-dnd");
3387
+ var import_jsx_runtime19 = require("react/jsx-runtime");
3388
+ var DroppableItem = ({
3389
+ key,
3390
+ item,
3391
+ type,
3392
+ component,
3393
+ dropRef,
3394
+ target,
3395
+ setTarget
3396
+ }) => {
3397
+ const ref = (0, import_react14.useRef)(null);
3398
+ const [, drop] = (0, import_react_dnd2.useDrop)({
3399
+ accept: type,
3400
+ hover() {
3401
+ if (item.index !== null && target !== item.index) {
3402
+ setTarget(item.index);
3403
+ }
3404
+ }
3405
+ });
3406
+ dropRef(drop(ref));
3407
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3408
+ "div",
3409
+ {
3410
+ className: `w-full transition-all duration-500 h-full`,
3411
+ ref,
3412
+ children: component
3413
+ },
3414
+ key
3415
+ );
3416
+ };
3417
+ var DroppableItem_default = DroppableItem;
3418
+
3419
+ // src/components/activities/material-content/FillInTheBlanksActivityMaterialContent.tsx
3420
+ var import_jsx_runtime20 = require("react/jsx-runtime");
3421
+ var FillInTheBlanksActivityMaterialContent = ({
3422
+ uniqueValue,
3423
+ answer,
3424
+ optionList,
3425
+ materialMap,
3426
+ contentMap,
3427
+ checkCanAnswerQuestion,
3428
+ onChange,
3429
+ isPreview,
3430
+ showCorrectAnswer
3431
+ }) => {
3432
+ const [shuffleOptionList, setShuffleOptionList] = (0, import_react15.useState)([]);
3433
+ const [selectedOption, setSelectedOption] = (0, import_react15.useState)(null);
3434
+ const [pasteOptionIndex, setPasteOptionIndex] = (0, import_react15.useState)(null);
3435
+ const [{ isOver, canDrop }, drop] = (0, import_react_dnd3.useDrop)({
3436
+ accept: "FILL_IN_THE_BLANKS",
3437
+ drop: () => {
3438
+ },
3439
+ collect: (monitor) => ({
3440
+ isOver: monitor.isOver(),
3441
+ canDrop: monitor.canDrop()
3442
+ })
3443
+ });
3444
+ (0, import_react16.useEffect)(() => {
3445
+ setShuffleOptionList(shuffleArray(optionList));
3446
+ }, []);
3447
+ (0, import_react16.useEffect)(() => {
3448
+ if (!showCorrectAnswer) return;
3449
+ const foundAnswer = answer.data.find(
3450
+ (answerData) => answerData.type === "FILL_IN_THE_BLANKS"
3451
+ );
3452
+ if (foundAnswer.answerMap.length === 0) return;
3453
+ foundAnswer.answerMap = Object.keys(materialMap).map(
3454
+ (materialMapKey, index) => JSON.parse(materialMap[materialMapKey])[0]
3455
+ );
3456
+ onChange(answer, 0, JSON.parse(materialMap[0])[0]);
3457
+ }, [showCorrectAnswer]);
3458
+ const retrieveAnswerMap = () => {
3459
+ const foundIndex = answer.data.findIndex(
3460
+ (answerData) => answerData.type === "FILL_IN_THE_BLANKS"
3461
+ );
3462
+ return answer.data[foundIndex].answerMap;
3463
+ };
3464
+ const checkAnswerState = (correctAnswerList, learnerAnswer) => {
3465
+ if (!isPreview) return "HIDDEN";
3466
+ const foundIndex = correctAnswerList.findIndex(
3467
+ (correctAnswer) => correctAnswer === learnerAnswer
3468
+ );
3469
+ if (foundIndex !== -1) {
3470
+ return "CORRECT";
3471
+ }
3472
+ return "INCORRECT";
3473
+ };
3474
+ const checkAnswerProvided = (answerMap2, option) => {
3475
+ return Object.keys(answerMap2).findIndex((key) => answerMap2[key] === option) !== -1;
3476
+ };
3477
+ const answerMap = retrieveAnswerMap();
3478
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-row flex-wrap items-center", onMouseUp: () => {
3479
+ }, children: [
3480
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_fill_in_the_blanks_text") }) }),
3481
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DividerLine_default, {}) }),
3482
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-full flex flex-row flex-wrap gap-x-2 gap-y-2 my-2", children: shuffleOptionList.map(
3483
+ (option, index) => checkAnswerProvided(answerMap, option) ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "opacity-30", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3484
+ ShowMaterialMediaByContentType_default,
3485
+ {
3486
+ contentType: contentMap.type,
3487
+ src: option,
3488
+ canFullScreen: true
3489
+ },
3490
+ `${uniqueValue}-${index}`
3491
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3492
+ DraggableItem_default,
3493
+ {
3494
+ item: { index: option },
3495
+ type: "FILL_IN_THE_BLANKS",
3496
+ component: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3497
+ "div",
3498
+ {
3499
+ className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge cursor-pointer",
3500
+ onMouseDown: () => {
3501
+ setSelectedOption(option);
3502
+ setPasteOptionIndex(null);
3503
+ },
3504
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "italic whitespace-pre-wrap", children: option })
3505
+ }
3506
+ ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3507
+ "div",
3508
+ {
3509
+ className: "border-catchup-blue border-2 px-2 py-1 rounded-catchup-xlarge cursor-pointer",
3510
+ onMouseDown: () => {
3511
+ setSelectedOption(option);
3512
+ setPasteOptionIndex(null);
3513
+ },
3514
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3515
+ ShowMaterialMediaByContentType_default,
3516
+ {
3517
+ contentType: contentMap.type,
3518
+ src: option,
3519
+ canFullScreen: true
3520
+ },
3521
+ `${uniqueValue}-${index}`
3522
+ )
3523
+ }
3524
+ ),
3525
+ moveCardHandler: () => {
3526
+ onChange(answer, pasteOptionIndex, selectedOption);
3527
+ }
3528
+ },
3529
+ index
3530
+ )
3531
+ ) }),
3532
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
3533
+ const learnerAnswerState = checkAnswerState(
3534
+ JSON.parse(materialMap[materialKey]),
3535
+ answerMap[materialKey]
3536
+ );
3537
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "w-full md:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "mx-2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3538
+ DroppableItem_default,
3539
+ {
3540
+ item: { index },
3541
+ type: "FILL_IN_THE_BLANKS",
3542
+ target: pasteOptionIndex,
3543
+ setTarget: setPasteOptionIndex,
3544
+ dropRef: drop,
3545
+ component: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "w-full flex flex-row my-2 gap-x-2", children: [
3546
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "my-auto", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("p", { className: "text-xl", children: [
3547
+ parseFloat(materialKey) + 1,
3548
+ "."
3549
+ ] }) }),
3550
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1", children: checkCanAnswerQuestion() ? contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "relative", children: [
3551
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3552
+ InputGroup_default,
3553
+ {
3554
+ type: "textarea",
3555
+ value: answerMap[materialKey],
3556
+ useMinHeight: false,
3557
+ onChange: (e) => {
3558
+ onChange(
3559
+ answer,
3560
+ materialKey,
3561
+ e.target.value
3562
+ );
3563
+ }
3564
+ }
3565
+ ) }),
3566
+ learnerAnswerState === "CORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3567
+ BaseImage_default,
3568
+ {
3569
+ src: "/icons/checkbox.png",
3570
+ alt: "checkbox",
3571
+ size: "small"
3572
+ }
3573
+ ) }) : learnerAnswerState === "INCORRECT" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "absolute -top-[10px] right-4 bg-catchup-white", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3574
+ BaseImage_default,
3575
+ {
3576
+ src: "/icons/cross-red.png",
3577
+ alt: "cross-red",
3578
+ size: "small"
3579
+ }
3580
+ ) }) : null
3581
+ ] }) : answerMap[materialKey] === "" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3582
+ "div",
3583
+ {
3584
+ className: `w-catchup-activity-box-item border h-catchup-activity-box-item rounded-catchup-xlarge border-dashed ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
3585
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-full flex flex-col items-center justify-center px-4 py-2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "italic", children: i18n_default.t("please_drop_here") }) })
3586
+ }
3587
+ ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3588
+ "div",
3589
+ {
3590
+ className: "flex-1 cursor-pointer",
3591
+ onClick: () => {
3592
+ onChange(answer, materialKey, "");
3593
+ },
3594
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3595
+ ShowMaterialMediaByContentType_default,
3596
+ {
3597
+ contentType: contentMap.type,
3598
+ src: answerMap[materialKey],
3599
+ canFullScreen: true
3600
+ },
3601
+ `${uniqueValue}-${index}`
3602
+ )
3603
+ }
3604
+ ) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
3605
+ answerMap[materialKey]
3606
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3607
+ "span",
3608
+ {
3609
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
3610
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_katex3.InlineMath, { math: inputPart.value }) }) : inputPart.value
3611
+ },
3612
+ index2
3613
+ )) }, materialKey) })
3614
+ ] })
3615
+ },
3616
+ index
3617
+ ) }) }, index);
3618
+ }) })
3619
+ ] });
3620
+ };
3621
+ var FillInTheBlanksActivityMaterialContent_default = FillInTheBlanksActivityMaterialContent;
3622
+
3623
+ // src/components/activities/FillInTheBlanksActivityContent.tsx
3624
+ var import_jsx_runtime21 = require("react/jsx-runtime");
3625
+ var FillInTheBlanksActivityContent = ({
3626
+ answer,
3627
+ data,
3628
+ canAnswerQuestion,
3629
+ changeAnswer,
3630
+ isPreview,
3631
+ showCorrectAnswer
3632
+ }) => {
3633
+ const contentMap = parseContentMapFromData(data);
3634
+ const fillInTheBlanksBodyMap = parseBodyMapFromData(
3635
+ data,
3636
+ "FILL_IN_THE_BLANKS"
3637
+ );
3638
+ const fillInTheBlanksMaterialMap = parseMaterialMapFromData(
3639
+ data,
3640
+ "FILL_IN_THE_BLANKS"
3641
+ );
3642
+ const fillInTheBlanksIncorrectList = data.fillInTheBlanksIncorrectList ? JSON.parse(data.fillInTheBlanksIncorrectList) : [];
3643
+ const retrieveCurrentAnswerMap = () => {
3644
+ let foundIndex = answer.data.findIndex(
3645
+ (answerData) => answerData.type === "FILL_IN_THE_BLANKS"
3646
+ );
3647
+ return answer.data[foundIndex].answerMap;
3648
+ };
3649
+ const constructAnswerOptionList = () => {
3650
+ const optionList = [];
3651
+ Object.keys(fillInTheBlanksMaterialMap).forEach((key) => {
3652
+ const array = JSON.parse(fillInTheBlanksMaterialMap[key]);
3653
+ for (const item of array) {
3654
+ const foundIndex = optionList.findIndex(
3655
+ (option) => option === item
3656
+ );
3657
+ if (foundIndex === -1) {
3658
+ optionList.push(item);
3659
+ }
3660
+ }
3661
+ });
3662
+ fillInTheBlanksIncorrectList.forEach((value) => {
3663
+ optionList.push(value);
3664
+ });
3665
+ return optionList;
3666
+ };
3667
+ const handleFillInTheBlanksAnswerOnChange = (answer2, key, value) => {
3668
+ const answerMap = retrieveCurrentAnswerMap();
3669
+ answerMap[key] = value;
3670
+ changeAnswer(answer2);
3671
+ };
3672
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
3673
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3674
+ ActivityBodyContent_default,
3675
+ {
3676
+ bodyMap: fillInTheBlanksBodyMap,
3677
+ answerMap: retrieveCurrentAnswerMap(),
3678
+ contentMap,
3679
+ templateType: "FILL_IN_THE_BLANKS"
3680
+ }
3681
+ ) }),
3682
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "contents md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DividerLine_default, {}) }),
3683
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(VerticalDividerLine_default, {}) }),
3684
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3685
+ FillInTheBlanksActivityMaterialContent_default,
3686
+ {
3687
+ uniqueValue: JSON.stringify(data.contentMap),
3688
+ answer,
3689
+ optionList: constructAnswerOptionList(),
3690
+ materialMap: fillInTheBlanksMaterialMap,
3691
+ contentMap,
3692
+ checkCanAnswerQuestion: canAnswerQuestion,
3693
+ onChange: handleFillInTheBlanksAnswerOnChange,
3694
+ isPreview,
3695
+ showCorrectAnswer
3696
+ }
3697
+ ) })
3698
+ ] });
3699
+ };
3700
+ var FillInTheBlanksActivityContent_default = FillInTheBlanksActivityContent;
3701
+
3702
+ // src/components/activities/material-content/GroupingActivityMaterialContent.tsx
3703
+ var import_react18 = require("react");
3704
+ var import_react_dnd4 = require("react-dnd");
3705
+ var import_react_katex4 = require("react-katex");
3706
+
3707
+ // src/hooks/useScreenSize.ts
3708
+ var import_react17 = require("react");
3709
+ var useScreenSize = () => {
3710
+ const [containerSize, setContainerSize] = (0, import_react17.useState)({
3711
+ width: 0,
3712
+ height: 0
3713
+ });
3714
+ const [screenSize, setScreenSize] = (0, import_react17.useState)({
3715
+ width: window.innerWidth,
3716
+ height: window.innerHeight
3717
+ });
3718
+ (0, import_react17.useEffect)(() => {
3719
+ const handleResize = () => {
3720
+ setScreenSize({
3721
+ width: window.innerWidth,
3722
+ height: window.innerHeight
3723
+ });
3724
+ const container = document.getElementById("container");
3725
+ if (!container) return;
3726
+ const boundingClientRect = container.getBoundingClientRect();
3727
+ setContainerSize({
3728
+ width: boundingClientRect.width,
3729
+ height: boundingClientRect.height
3730
+ });
3731
+ };
3732
+ handleResize();
3733
+ window.addEventListener("resize", handleResize);
3734
+ return () => {
3735
+ window.removeEventListener("resize", handleResize);
3736
+ };
3737
+ }, []);
3738
+ return { screenSize, containerSize };
3739
+ };
3740
+ var useScreenSize_default = useScreenSize;
3741
+
3742
+ // src/components/activities/material-content/GroupingActivityMaterialContent.tsx
3743
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3744
+ var GroupingActivityMaterialContent = ({
3745
+ uniqueValue,
3746
+ answer,
3747
+ materialMap,
3748
+ contentMap,
3749
+ checkCanAnswerQuestion,
3750
+ onChange,
3751
+ isPreview,
3752
+ showCorrectAnswer
3753
+ }) => {
3754
+ const [selectedValue, setSelectedValue] = (0, import_react18.useState)(null);
3755
+ const [selectedTargetKey, setSelectedTargetKey] = (0, import_react18.useState)(null);
3756
+ const [isShuffled, setIsShuffled] = (0, import_react18.useState)(false);
3757
+ const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react18.useState)([]);
3758
+ const { screenSize, containerSize } = useScreenSize_default();
3759
+ const [{ isOver, canDrop }, drop] = (0, import_react_dnd4.useDrop)({
3760
+ accept: "GROUPING",
3761
+ drop: () => {
3762
+ },
3763
+ collect: (monitor) => ({
3764
+ isOver: monitor.isOver(),
3765
+ canDrop: monitor.canDrop()
3766
+ })
3767
+ });
3768
+ const ref = (0, import_react18.useRef)(null);
3769
+ const itemsRef = (0, import_react18.useRef)(null);
3770
+ const [maxWidth, setMaxWidth] = (0, import_react18.useState)(0);
3771
+ (0, import_react18.useEffect)(() => {
3772
+ if (!ref) return;
3773
+ if (!ref.current) return;
3774
+ if (!screenSize) return;
3775
+ setMaxWidth(ref.current.offsetWidth - 12);
3776
+ }, [ref, screenSize]);
3777
+ (0, import_react18.useEffect)(() => {
3778
+ if (!itemsRef) return;
3779
+ if (!itemsRef.current) return;
3780
+ if (!containerSize) return;
3781
+ itemsRef.current.style.width = `${containerSize.width - 200}px`;
3782
+ }, [itemsRef, containerSize]);
3783
+ (0, import_react18.useEffect)(() => {
3784
+ const shuffleArray2 = (array) => {
3785
+ if (!isShuffled) {
3786
+ const copyArray = JSON.parse(JSON.stringify(array));
3787
+ for (let i = copyArray.length - 1; i > 0; i--) {
3788
+ const j = Math.floor(Math.random() * (i + 1));
3789
+ [copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
3790
+ }
3791
+ setIsShuffled(true);
3792
+ return copyArray;
3793
+ }
3794
+ return array;
3795
+ };
3796
+ const materialList = [];
3797
+ Object.keys(materialMap).forEach((materialKey) => {
3798
+ for (const materialValue of materialMap[materialKey]) {
3799
+ materialList.push(materialValue);
3800
+ }
3801
+ });
3802
+ setShuffledMaterialList(shuffleArray2(materialList));
3803
+ }, []);
3804
+ (0, import_react18.useEffect)(() => {
3805
+ if (!showCorrectAnswer) return;
3806
+ answer.data.find(
3807
+ (answerData) => answerData.type === "GROUPING"
3808
+ ).answerMap = materialMap;
3809
+ }, [showCorrectAnswer]);
3810
+ const retrieveAnswerMap = () => {
3811
+ const foundIndex = answer.data.findIndex(
3812
+ (answerData) => answerData.type === "GROUPING"
3813
+ );
3814
+ const answerMap2 = answer.data[foundIndex].answerMap;
3815
+ return answerMap2;
3816
+ };
3817
+ const retrieveFilteredMaterialList = (answerMap2) => {
3818
+ const selectedValueList = [];
3819
+ Object.keys(answerMap2).forEach((key) => {
3820
+ answerMap2[key].forEach((value) => {
3821
+ selectedValueList.push(value);
3822
+ });
3823
+ });
3824
+ return shuffledMaterialList.filter(
3825
+ (material) => selectedValueList.findIndex((value) => material === value) === -1
3826
+ );
3827
+ };
3828
+ const checkAnswerState = (correctAnswerList, learnerAnswer) => {
3829
+ if (!isPreview) return "HIDDEN";
3830
+ if (!learnerAnswer) return "EMPTY";
3831
+ if (!correctAnswerList) return "EMPTY";
3832
+ const foundIndex = correctAnswerList.findIndex(
3833
+ (correctAnswer) => correctAnswer === learnerAnswer
3834
+ );
3835
+ if (foundIndex !== -1) {
3836
+ return "CORRECT";
3837
+ }
3838
+ return "INCORRECT";
3839
+ };
3840
+ const handleGroupingActivityItemOnChange = (selectedTargetKey2, selectedValue2) => {
3841
+ if (checkCanAnswerQuestion()) {
3842
+ onChange(answer, selectedTargetKey2, selectedValue2, null);
3843
+ setSelectedValue(null);
3844
+ }
3845
+ };
3846
+ const answerMap = retrieveAnswerMap();
3847
+ const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
3848
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
3849
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3850
+ "div",
3851
+ {
3852
+ ref: itemsRef,
3853
+ className: "flex-1 flex flex-row gap-x-4 gap-y-4 overflow-auto py-2",
3854
+ children: filteredMaterialList.map((materialValue, index) => {
3855
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3856
+ DraggableItem_default,
3857
+ {
3858
+ item: { index: materialValue },
3859
+ type: "GROUPING",
3860
+ component: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3861
+ "div",
3862
+ {
3863
+ className: `${selectedValue === materialValue ? "border-catchup-blue" : "border-catchup-lighter-gray"} h-catchup-activity-covering-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300`,
3864
+ onMouseDown: () => {
3865
+ if (checkCanAnswerQuestion()) {
3866
+ setSelectedValue(materialValue);
3867
+ }
3868
+ },
3869
+ onMouseUp: () => {
3870
+ if (checkCanAnswerQuestion()) {
3871
+ setSelectedValue(null);
3872
+ }
3873
+ },
3874
+ children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3875
+ "div",
3876
+ {
3877
+ className: `flex flex-col items-center justify-center m-4 min-h-[64px] min-w-[200px]`,
3878
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xl text-center whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
3879
+ materialValue
3880
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3881
+ "span",
3882
+ {
3883
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
3884
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_katex4.InlineMath, { math: inputPart.value }) }) : inputPart.value
3885
+ },
3886
+ index2
3887
+ )) })
3888
+ }
3889
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3890
+ ShowMaterialMediaByContentType_default,
3891
+ {
3892
+ contentType: contentMap.type,
3893
+ src: materialValue,
3894
+ canFullScreen: true
3895
+ },
3896
+ `${uniqueValue}-${index}`
3897
+ )
3898
+ }
3899
+ ),
3900
+ moveCardHandler: () => {
3901
+ if (!selectedTargetKey) return;
3902
+ if (!selectedValue) return;
3903
+ handleGroupingActivityItemOnChange(
3904
+ selectedTargetKey,
3905
+ selectedValue
3906
+ );
3907
+ }
3908
+ },
3909
+ index
3910
+ );
3911
+ })
3912
+ }
3913
+ ),
3914
+ filteredMaterialList.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DividerLine_default, {}) : null,
3915
+ Object.keys(answerMap).map((answerMapKey, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-row w-full", children: [
3916
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3917
+ "div",
3918
+ {
3919
+ className: `border-catchup-blue h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3`,
3920
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3921
+ "div",
3922
+ {
3923
+ className: `flex flex-col items-center justify-center transition-all duration-300 m-4`,
3924
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
3925
+ (inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3926
+ "span",
3927
+ {
3928
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
3929
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_katex4.InlineMath, { math: inputPart.value }) }) : inputPart.value
3930
+ },
3931
+ index2
3932
+ )
3933
+ ) })
3934
+ }
3935
+ )
3936
+ }
3937
+ ) }),
3938
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
3939
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "flex-1", ref, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-full py-3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3940
+ "div",
3941
+ {
3942
+ className: `${canDrop ? selectedTargetKey === answerMapKey ? "bg-catchup-light-blue" : "bg-catchup-light-blue opacity-40" : ""} flex-1 border-catchup-blue rounded-catchup-xlarge border-2 h-full p-1`,
3943
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3944
+ DroppableItem_default,
3945
+ {
3946
+ item: { index: answerMapKey },
3947
+ type: "GROUPING",
3948
+ target: selectedTargetKey,
3949
+ setTarget: setSelectedTargetKey,
3950
+ dropRef: drop,
3951
+ component: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3952
+ "div",
3953
+ {
3954
+ className: "h-full flex-1 flex flex-row items-center overflow-x-auto",
3955
+ style: {
3956
+ maxWidth
3957
+ },
3958
+ children: answerMap[answerMapKey].map(
3959
+ (answerMapValue, answerMapIndex) => {
3960
+ const learnerAnswerState = checkAnswerState(
3961
+ materialMap[answerMapKey],
3962
+ answerMapValue
3963
+ );
3964
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "p-1", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "h-catchup-activity-box-item", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3965
+ "div",
3966
+ {
3967
+ className: `${learnerAnswerState === "EMPTY" ? "border-catchup-lighter-gray" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"} border-2 rounded-catchup-xlarge h-full flex flex-col items-center justify-center transition-all duration-300 cursor-pointer`,
3968
+ onClick: (e) => {
3969
+ e.preventDefault();
3970
+ if (checkCanAnswerQuestion()) {
3971
+ onChange(
3972
+ answer,
3973
+ answerMapKey,
3974
+ null,
3975
+ answerMapIndex
3976
+ );
3977
+ setSelectedValue(null);
3978
+ }
3979
+ },
3980
+ children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3981
+ "div",
3982
+ {
3983
+ className: `flex flex-col items-center justify-center transition-all duration-300 min-h-[64px] min-w-[200px]`,
3984
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "m-2", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("p", { className: "text-xl text-center whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
3985
+ answerMapValue
3986
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3987
+ "span",
3988
+ {
3989
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
3990
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3991
+ import_react_katex4.InlineMath,
3992
+ {
3993
+ math: inputPart.value
3994
+ }
3995
+ ) }) : inputPart.value
3996
+ },
3997
+ index2
3998
+ )) }) })
3999
+ }
4000
+ ) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
4001
+ ShowMaterialMediaByContentType_default,
4002
+ {
4003
+ contentType: contentMap.type,
4004
+ src: answerMapValue,
4005
+ canFullScreen: false
4006
+ },
4007
+ `${uniqueValue}-${index}`
4008
+ )
4009
+ }
4010
+ ) }) });
4011
+ }
4012
+ )
4013
+ }
4014
+ )
4015
+ },
4016
+ index
4017
+ )
4018
+ }
4019
+ ) }) })
4020
+ ] }, index))
4021
+ ] });
4022
+ };
4023
+ var GroupingActivityMaterialContent_default = GroupingActivityMaterialContent;
4024
+
4025
+ // src/components/activities/GroupingActivityContent.tsx
4026
+ var import_jsx_runtime23 = require("react/jsx-runtime");
4027
+ var GroupingActivityContent = ({
4028
+ answer,
4029
+ data,
4030
+ canAnswerQuestion,
4031
+ changeAnswer,
4032
+ isPreview,
4033
+ showCorrectAnswer
4034
+ }) => {
4035
+ const contentMap = parseContentMapFromData(data);
4036
+ const groupingBodyMap = parseBodyMapFromData(data, "GROUPING");
4037
+ const groupingMaterialMap = parseMaterialMapFromData(data, "GROUPING");
4038
+ const handleGroupingAnswerOnChange = (answer2, key, value, index) => {
4039
+ let foundIndex = answer2.data.findIndex(
4040
+ (answerData) => answerData.type === "GROUPING"
4041
+ );
4042
+ const answerMap = answer2.data[foundIndex].answerMap;
4043
+ if (value) {
4044
+ answerMap[key].push(value);
4045
+ } else {
4046
+ answerMap[key].splice(index, 1);
4047
+ }
4048
+ changeAnswer(answer2);
4049
+ };
4050
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_jsx_runtime23.Fragment, { children: [
4051
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4052
+ ActivityBodyContent_default,
4053
+ {
4054
+ bodyMap: groupingBodyMap,
4055
+ templateType: "GROUPING"
4056
+ }
4057
+ ),
4058
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DividerLine_default, {}),
4059
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
4060
+ GroupingActivityMaterialContent_default,
4061
+ {
4062
+ uniqueValue: JSON.stringify(data.contentMap),
4063
+ answer,
4064
+ materialMap: groupingMaterialMap,
4065
+ contentMap,
4066
+ checkCanAnswerQuestion: canAnswerQuestion,
4067
+ onChange: handleGroupingAnswerOnChange,
4068
+ isPreview,
4069
+ showCorrectAnswer
4070
+ }
4071
+ )
4072
+ ] });
4073
+ };
4074
+ var GroupingActivityContent_default = GroupingActivityContent;
4075
+
4076
+ // src/components/activities/material-content/MatchingActivityMaterialContent.tsx
4077
+ var import_react19 = require("react");
4078
+ var import_react_dnd5 = require("react-dnd");
4079
+ var import_react_katex5 = require("react-katex");
4080
+ var import_jsx_runtime24 = require("react/jsx-runtime");
4081
+ var MatchingActivityMaterialContent = ({
4082
+ uniqueValue,
4083
+ answer,
4084
+ materialMap,
4085
+ contentMap,
4086
+ checkCanAnswerQuestion,
4087
+ onChange,
4088
+ isPreview,
4089
+ showCorrectAnswer
4090
+ }) => {
4091
+ const [selectedValue, setSelectedValue] = (0, import_react19.useState)(null);
4092
+ const [selectedTargetKey, setSelectedTargetKey] = (0, import_react19.useState)(null);
4093
+ const [isShuffled, setIsShuffled] = (0, import_react19.useState)(false);
4094
+ const [shuffledMaterialList, setShuffledMaterialList] = (0, import_react19.useState)([]);
4095
+ const [{ isOver, canDrop }, drop] = (0, import_react_dnd5.useDrop)({
4096
+ accept: "MATCHING",
4097
+ drop: () => {
4098
+ },
4099
+ collect: (monitor) => ({
4100
+ isOver: monitor.isOver(),
4101
+ canDrop: monitor.canDrop()
4102
+ })
4103
+ });
4104
+ const { containerSize } = useScreenSize_default();
4105
+ const itemsRef = (0, import_react19.useRef)(null);
4106
+ (0, import_react19.useEffect)(() => {
4107
+ const shuffleArray2 = (array) => {
4108
+ if (!isShuffled) {
4109
+ const copyArray = JSON.parse(JSON.stringify(array));
4110
+ for (let i = copyArray.length - 1; i > 0; i--) {
4111
+ const j = Math.floor(Math.random() * (i + 1));
4112
+ [copyArray[i], copyArray[j]] = [copyArray[j], copyArray[i]];
4113
+ }
4114
+ setIsShuffled(true);
4115
+ return copyArray;
4116
+ }
4117
+ return array;
4118
+ };
4119
+ const materialList = [];
4120
+ Object.keys(materialMap).forEach((materialKey) => {
4121
+ materialList.push(materialMap[materialKey]);
4122
+ });
4123
+ setShuffledMaterialList(shuffleArray2(materialList));
4124
+ }, []);
4125
+ (0, import_react19.useEffect)(() => {
4126
+ if (!showCorrectAnswer) return;
4127
+ answer.data.find(
4128
+ (answerData) => answerData.type === "MATCHING"
4129
+ ).answerMap = materialMap;
4130
+ }, [showCorrectAnswer]);
4131
+ (0, import_react19.useEffect)(() => {
4132
+ if (!itemsRef) return;
4133
+ if (!itemsRef.current) return;
4134
+ if (!containerSize) return;
4135
+ itemsRef.current.style.width = `${containerSize.width - 220}px`;
4136
+ }, [itemsRef, containerSize]);
4137
+ const retrieveAnswerMap = () => {
4138
+ const foundIndex = answer.data.findIndex(
4139
+ (answerData) => answerData.type === "MATCHING"
4140
+ );
4141
+ const answerMap2 = answer.data[foundIndex].answerMap;
4142
+ const sortedAnswerMapKeys = Object.keys(answerMap2).sort(
4143
+ (a, b) => answerMap2[a] ? answerMap2[b] ? answerMap2[a].localeCompare(answerMap2[b]) : 1 : -1
4144
+ );
4145
+ const sortedAnswerMap = {};
4146
+ for (const answerMapKey of sortedAnswerMapKeys) {
4147
+ sortedAnswerMap[answerMapKey] = answerMap2[answerMapKey];
4148
+ }
4149
+ return sortedAnswerMap;
4150
+ };
4151
+ const retrieveFilteredMaterialList = (answerMap2) => {
4152
+ const selectedValueList = [];
4153
+ Object.keys(answerMap2).forEach((key) => {
4154
+ selectedValueList.push(answerMap2[key]);
4155
+ });
4156
+ return shuffledMaterialList.filter(
4157
+ (material) => selectedValueList.findIndex((value) => material === value) === -1
4158
+ );
4159
+ };
4160
+ const checkAnswerState = (correctAnswer, learnerAnswer) => {
4161
+ if (!isPreview) return "HIDDEN";
4162
+ if (!learnerAnswer) return "EMPTY";
4163
+ if (correctAnswer === learnerAnswer) {
4164
+ return "CORRECT";
4165
+ }
4166
+ return "INCORRECT";
4167
+ };
4168
+ const handleMatchingActivityItemOnChange = (selectedTargetKey2, selectedValue2) => {
4169
+ if (checkCanAnswerQuestion()) {
4170
+ onChange(answer, selectedTargetKey2, selectedValue2);
4171
+ setSelectedValue(null);
4172
+ }
4173
+ };
4174
+ const answerMap = retrieveAnswerMap();
4175
+ const filteredMaterialList = retrieveFilteredMaterialList(answerMap);
4176
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
4177
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4178
+ "div",
4179
+ {
4180
+ ref: itemsRef,
4181
+ className: "flex-1 flex flex-row gap-x-4 gap-y-4 overflow-auto py-2",
4182
+ children: filteredMaterialList.map((materialValue, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4183
+ DraggableItem_default,
4184
+ {
4185
+ item: { index: materialValue },
4186
+ type: "MATCHING",
4187
+ component: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4188
+ "div",
4189
+ {
4190
+ className: `${selectedValue === materialValue ? "border-catchup-blue" : "border-catchup-lighter-gray"} h-catchup-activity-covering-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300`,
4191
+ onMouseDown: () => {
4192
+ if (checkCanAnswerQuestion()) {
4193
+ setSelectedValue(materialValue);
4194
+ }
4195
+ },
4196
+ onMouseUp: () => {
4197
+ if (checkCanAnswerQuestion()) {
4198
+ setSelectedValue(null);
4199
+ }
4200
+ },
4201
+ children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4202
+ "div",
4203
+ {
4204
+ className: `flex flex-col items-center justify-center m-4 min-h-[64px] min-w-[200px]`,
4205
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4206
+ materialValue
4207
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4208
+ "span",
4209
+ {
4210
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4211
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_katex5.InlineMath, { math: inputPart.value }) }) : inputPart.value
4212
+ },
4213
+ index2
4214
+ )) })
4215
+ }
4216
+ ) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4217
+ ShowMaterialMediaByContentType_default,
4218
+ {
4219
+ contentType: contentMap.type,
4220
+ src: materialValue,
4221
+ canFullScreen: true
4222
+ },
4223
+ `${uniqueValue}-${index}`
4224
+ )
4225
+ }
4226
+ ),
4227
+ moveCardHandler: () => {
4228
+ if (!selectedTargetKey) return;
4229
+ if (!selectedValue) return;
4230
+ handleMatchingActivityItemOnChange(
4231
+ selectedTargetKey,
4232
+ selectedValue
4233
+ );
4234
+ }
4235
+ },
4236
+ index
4237
+ ))
4238
+ }
4239
+ ),
4240
+ filteredMaterialList.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DividerLine_default, {}) : null,
4241
+ Object.keys(answerMap).map((answerMapKey, index) => {
4242
+ const learnerAnswerState = checkAnswerState(
4243
+ materialMap[answerMapKey],
4244
+ answerMap[answerMapKey]
4245
+ );
4246
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-row w-full", children: [
4247
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "w-1/3", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4248
+ "div",
4249
+ {
4250
+ className: `h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge transition-all duration-300 my-3 ${learnerAnswerState === "EMPTY" ? "border-catchup-blue" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
4251
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4252
+ "div",
4253
+ {
4254
+ className: `flex flex-col items-center justify-center transition-all duration-300 m-4`,
4255
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(answerMapKey).map(
4256
+ (inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4257
+ "span",
4258
+ {
4259
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4260
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_katex5.InlineMath, { math: inputPart.value }) }) : inputPart.value
4261
+ },
4262
+ index2
4263
+ )
4264
+ ) })
4265
+ }
4266
+ )
4267
+ }
4268
+ ) }),
4269
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mx-4 w-[2px] bg-catchup-lighter-gray" }),
4270
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4271
+ "div",
4272
+ {
4273
+ className: `${canDrop ? selectedTargetKey === answerMapKey ? "bg-catchup-light-blue" : "bg-catchup-light-blue opacity-40" : ""} h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300 my-3 ${learnerAnswerState === "EMPTY" ? "border-catchup-blue" : learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
4274
+ onClick: () => {
4275
+ if (checkCanAnswerQuestion()) {
4276
+ setSelectedValue(null);
4277
+ }
4278
+ },
4279
+ children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4280
+ DroppableItem_default,
4281
+ {
4282
+ item: { index: answerMapKey },
4283
+ type: "MATCHING",
4284
+ target: selectedTargetKey,
4285
+ setTarget: setSelectedTargetKey,
4286
+ dropRef: drop,
4287
+ component: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4288
+ "div",
4289
+ {
4290
+ className: `h-full flex-1 flex flex-row items-center justify-center `,
4291
+ onClick: (e) => {
4292
+ e.preventDefault();
4293
+ if (checkCanAnswerQuestion()) {
4294
+ handleMatchingActivityItemOnChange(
4295
+ answerMapKey,
4296
+ null
4297
+ );
4298
+ }
4299
+ },
4300
+ children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xl p-5 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4301
+ answerMap[answerMapKey]
4302
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4303
+ "span",
4304
+ {
4305
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4306
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_react_katex5.InlineMath, { math: inputPart.value }) }) : inputPart.value
4307
+ },
4308
+ index2
4309
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
4310
+ ShowMaterialMediaByContentType_default,
4311
+ {
4312
+ contentType: contentMap.type,
4313
+ src: answerMap[answerMapKey],
4314
+ canFullScreen: false
4315
+ },
4316
+ `${uniqueValue}-${index}`
4317
+ )
4318
+ }
4319
+ )
4320
+ },
4321
+ index
4322
+ )
4323
+ }
4324
+ ) })
4325
+ ] }, index);
4326
+ })
4327
+ ] });
4328
+ };
4329
+ var MatchingActivityMaterialContent_default = MatchingActivityMaterialContent;
4330
+
4331
+ // src/components/activities/MatchingActivityContent.tsx
4332
+ var import_jsx_runtime25 = require("react/jsx-runtime");
4333
+ var MatchingActivityContent = ({
4334
+ answer,
4335
+ data,
4336
+ canAnswerQuestion,
4337
+ changeAnswer,
4338
+ isPreview,
4339
+ showCorrectAnswer
4340
+ }) => {
4341
+ const contentMap = parseContentMapFromData(data);
4342
+ const matchingBodyMap = parseBodyMapFromData(data, "MATCHING");
4343
+ const matchingMaterialMap = parseMaterialMapFromData(data, "MATCHING");
4344
+ const handleMatchingAnswerOnChange = (answer2, key, value) => {
4345
+ let foundIndex = answer2.data.findIndex(
4346
+ (answerData) => answerData.type === "MATCHING"
4347
+ );
4348
+ const answerMap = answer2.data[foundIndex].answerMap;
4349
+ answerMap[key] = value;
4350
+ changeAnswer(answer2);
4351
+ };
4352
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
4353
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4354
+ ActivityBodyContent_default,
4355
+ {
4356
+ bodyMap: matchingBodyMap,
4357
+ templateType: "MATCHING"
4358
+ }
4359
+ ),
4360
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DividerLine_default, {}),
4361
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4362
+ MatchingActivityMaterialContent_default,
4363
+ {
4364
+ uniqueValue: JSON.stringify(data.contentMap),
4365
+ answer,
4366
+ materialMap: matchingMaterialMap,
4367
+ contentMap,
4368
+ checkCanAnswerQuestion: canAnswerQuestion,
4369
+ onChange: handleMatchingAnswerOnChange,
4370
+ isPreview,
4371
+ showCorrectAnswer
4372
+ }
4373
+ )
4374
+ ] });
4375
+ };
4376
+ var MatchingActivityContent_default = MatchingActivityContent;
4377
+
4378
+ // src/components/activities/material-content/MCMAActivityMaterialContent.tsx
4379
+ var import_react_katex6 = require("react-katex");
4380
+ var import_jsx_runtime26 = require("react/jsx-runtime");
4381
+ var MCMAActivityMaterialContent = ({
4382
+ uniqueValue,
4383
+ answer,
4384
+ materialMap,
4385
+ contentMap,
4386
+ checkCanAnswerQuestion,
4387
+ onChange,
4388
+ isPreview
4389
+ }) => {
4390
+ const retrieveAnswerMap = () => {
4391
+ const foundIndex = answer.data.findIndex(
4392
+ (answerData) => answerData.type === "MCMA"
4393
+ );
4394
+ return answer.data[foundIndex].answerMap;
4395
+ };
4396
+ const retrieveCorrectAnswerList = () => {
4397
+ return JSON.parse(Object.keys(materialMap)[0]);
4398
+ };
4399
+ const checkAnswerState = (correctAnswerList2, currentAnswer, learnerAnswer) => {
4400
+ if (!isPreview) return "HIDDEN";
4401
+ if (currentAnswer !== learnerAnswer) return "EMPTY";
4402
+ const foundIndex = correctAnswerList2.findIndex(
4403
+ (correctAnswer) => correctAnswer === learnerAnswer
4404
+ );
4405
+ if (foundIndex !== -1) {
4406
+ return "CORRECT";
4407
+ }
4408
+ return "INCORRECT";
4409
+ };
4410
+ const answerMap = retrieveAnswerMap();
4411
+ const correctAnswerList = retrieveCorrectAnswerList();
4412
+ return Object.keys(materialMap).map((materialKey, index) => {
4413
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-row items-center my-1", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 flex flex-col justify-center border-catchup-lighter-gray rounded-catchup-xlarge px-5", children: [
4414
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_mcma_text") }) }),
4415
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DividerLine_default, {}) }),
4416
+ checkCanAnswerQuestion() ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex flex-row w-full flex-wrap ", children: materialMap[materialKey].map(
4417
+ (materialSubKey, index2) => {
4418
+ const foundAnswer = answerMap[materialKey].find(
4419
+ (learnerAnswer) => learnerAnswer === materialSubKey
4420
+ );
4421
+ const learnerAnswerState = checkAnswerState(
4422
+ correctAnswerList,
4423
+ materialSubKey,
4424
+ foundAnswer
4425
+ );
4426
+ const foundIndex = correctAnswerList.findIndex(
4427
+ (correctAnswer) => correctAnswer === materialSubKey
4428
+ );
4429
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
4430
+ "div",
4431
+ {
4432
+ className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 gap-x-2 ${learnerAnswerState === "EMPTY" && foundIndex !== -1 || learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge" : ""}`,
4433
+ onClick: () => {
4434
+ onChange(answer, materialKey, materialSubKey);
4435
+ },
4436
+ children: [
4437
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4438
+ BaseImage_default,
4439
+ {
4440
+ src: answerMap[materialKey].includes(materialSubKey) ? "/icons/checkbox.png" : "/icons/empty-checkbox.png",
4441
+ alt: "checkbox-empty-checkbox",
4442
+ size: "small",
4443
+ onClick: () => {
4444
+ }
4445
+ }
4446
+ ) }),
4447
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1", children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4448
+ materialSubKey
4449
+ ).map((inputPart, index3) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4450
+ "span",
4451
+ {
4452
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4453
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_katex6.InlineMath, { math: inputPart.value }) }) : inputPart.value
4454
+ },
4455
+ index3
4456
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4457
+ ShowMaterialMediaByContentType_default,
4458
+ {
4459
+ contentType: contentMap.type,
4460
+ src: materialSubKey,
4461
+ canFullScreen: true
4462
+ },
4463
+ `${uniqueValue}-${index2}`
4464
+ ) })
4465
+ ]
4466
+ },
4467
+ index2
4468
+ );
4469
+ }
4470
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xl", children: constructInputWithSpecialExpressionList(
4471
+ answerMap[materialKey]
4472
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4473
+ "span",
4474
+ {
4475
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4476
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react_katex6.InlineMath, { math: inputPart.value }) }) : inputPart.value
4477
+ },
4478
+ index2
4479
+ )) }, materialKey)
4480
+ ] }) }, index);
4481
+ });
4482
+ };
4483
+ var MCMAActivityMaterialContent_default = MCMAActivityMaterialContent;
4484
+
4485
+ // src/components/activities/MCMAActivityContent.tsx
4486
+ var import_jsx_runtime27 = require("react/jsx-runtime");
4487
+ var MCMAActivityContent = ({
4488
+ answer,
4489
+ data,
4490
+ canAnswerQuestion,
4491
+ changeAnswer,
4492
+ isPreview
4493
+ }) => {
4494
+ const contentMap = parseContentMapFromData(data);
4495
+ const MCMABodyMap = parseBodyMapFromData(data, "MCMA");
4496
+ const MCMAMaterialMap = parseMaterialMapFromData(data, "MCMA");
4497
+ const handleMCMAAnswerOnChange = (answer2, key, value) => {
4498
+ let foundIndex = answer2.data.findIndex(
4499
+ (answerData) => answerData.type === "MCMA"
4500
+ );
4501
+ const answerMap = answer2.data[foundIndex].answerMap;
4502
+ const foundSubIndex = answerMap[key].findIndex(
4503
+ (answerMaterialKey) => answerMaterialKey === value
4504
+ );
4505
+ if (foundSubIndex === -1) {
4506
+ answerMap[key].push(value);
4507
+ } else {
4508
+ answerMap[key].splice(foundSubIndex, 1);
4509
+ }
4510
+ changeAnswer(answer2);
4511
+ };
4512
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
4513
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ActivityBodyContent_default, { bodyMap: MCMABodyMap, templateType: "MCMA" }) }),
4514
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "contents md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DividerLine_default, {}) }),
4515
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(VerticalDividerLine_default, {}) }),
4516
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4517
+ MCMAActivityMaterialContent_default,
4518
+ {
4519
+ uniqueValue: JSON.stringify(data.contentMap),
4520
+ answer,
4521
+ materialMap: MCMAMaterialMap,
4522
+ contentMap,
4523
+ checkCanAnswerQuestion: canAnswerQuestion,
4524
+ onChange: handleMCMAAnswerOnChange,
4525
+ isPreview
4526
+ }
4527
+ ) })
4528
+ ] });
4529
+ };
4530
+ var MCMAActivityContent_default = MCMAActivityContent;
4531
+
4532
+ // src/components/activities/material-content/MCSAActivityMaterialContent.tsx
4533
+ var import_react_katex7 = require("react-katex");
4534
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4535
+ var MCSAActivityMaterialContent = ({
4536
+ uniqueValue,
4537
+ answer,
4538
+ materialMap,
4539
+ contentMap,
4540
+ checkCanAnswerQuestion,
4541
+ onChange,
4542
+ isPreview
4543
+ }) => {
4544
+ const retrieveAnswerMap = () => {
4545
+ const foundIndex = answer.data.findIndex(
4546
+ (answerData) => answerData.type === "MCSA"
4547
+ );
4548
+ return answer.data[foundIndex].answerMap;
4549
+ };
4550
+ const retrieveCorrectAnswer = () => {
4551
+ return Object.keys(materialMap)[0];
4552
+ };
4553
+ const checkAnswerState = (correctAnswer2, currentAnswer, learnerAnswer) => {
4554
+ if (!isPreview) return "HIDDEN";
4555
+ if (currentAnswer !== learnerAnswer) return "EMPTY";
4556
+ if (correctAnswer2 === learnerAnswer) {
4557
+ return "CORRECT";
4558
+ }
4559
+ return "INCORRECT";
4560
+ };
4561
+ const answerMap = retrieveAnswerMap();
4562
+ const correctAnswer = retrieveCorrectAnswer();
4563
+ return Object.keys(materialMap).map((materialKey, index) => {
4564
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-row items-center my-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex-1 flex flex-col justify-center border-catchup-lighter-gray rounded-catchup-xlarge px-5", children: [
4565
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_mcsa_text") }) }),
4566
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DividerLine_default, {}) }),
4567
+ checkCanAnswerQuestion() ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4568
+ "div",
4569
+ {
4570
+ className: `flex flex-row w-full ${Object.keys(materialMap[materialKey]).length <= 4 ? "justify-center" : ""} flex-wrap`,
4571
+ children: materialMap[materialKey].map(
4572
+ (materialSubKey, index2) => {
4573
+ const learnerAnswerState = checkAnswerState(
4574
+ correctAnswer,
4575
+ materialSubKey,
4576
+ answerMap[materialKey]
4577
+ );
4578
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4579
+ "div",
4580
+ {
4581
+ className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 gap-x-2 ${learnerAnswerState === "EMPTY" && materialSubKey === correctAnswer || learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge" : ""}`,
4582
+ onClick: () => {
4583
+ onChange(answer, materialKey, materialSubKey);
4584
+ },
4585
+ children: [
4586
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4587
+ BaseImage_default,
4588
+ {
4589
+ src: answerMap[materialKey] === materialSubKey ? "/icons/item-element.png" : "/icons/not-selected-item-element.png",
4590
+ alt: "circle",
4591
+ size: "small",
4592
+ onClick: () => {
4593
+ }
4594
+ }
4595
+ ) }),
4596
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1", children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4597
+ materialSubKey
4598
+ ).map((inputPart, index3) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4599
+ "span",
4600
+ {
4601
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4602
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_katex7.InlineMath, { math: inputPart.value }) }) : inputPart.value
4603
+ },
4604
+ index3
4605
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4606
+ ShowMaterialMediaByContentType_default,
4607
+ {
4608
+ contentType: contentMap.type,
4609
+ src: materialSubKey,
4610
+ canFullScreen: true
4611
+ },
4612
+ `${uniqueValue}-${index2}`
4613
+ ) })
4614
+ ]
4615
+ },
4616
+ index2
4617
+ );
4618
+ }
4619
+ )
4620
+ }
4621
+ ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4622
+ answerMap[materialKey]
4623
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4624
+ "span",
4625
+ {
4626
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4627
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_katex7.InlineMath, { math: inputPart.value }) }) : inputPart.value
4628
+ },
4629
+ index2
4630
+ )) })
4631
+ ] }) }, index);
4632
+ });
4633
+ };
4634
+ var MCSAActivityMaterialContent_default = MCSAActivityMaterialContent;
4635
+
4636
+ // src/components/activities/MCSAActivityContent.tsx
4637
+ var import_jsx_runtime29 = require("react/jsx-runtime");
4638
+ var MCSAActivityContent = ({
4639
+ answer,
4640
+ data,
4641
+ canAnswerQuestion,
4642
+ changeAnswer,
4643
+ isPreview
4644
+ }) => {
4645
+ const contentMap = parseContentMapFromData(data);
4646
+ const MCSABodyMap = parseBodyMapFromData(data, "MCSA");
4647
+ const MCSAMaterialMap = parseMaterialMapFromData(data, "MCSA");
4648
+ const handleMCSAAnswerOnChange = (answer2, key, value) => {
4649
+ let foundIndex = answer2.data.findIndex(
4650
+ (answerData) => answerData.type === "MCSA"
4651
+ );
4652
+ const answerMap = answer2.data[foundIndex].answerMap;
4653
+ answerMap[key] = value;
4654
+ changeAnswer(answer2);
4655
+ };
4656
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
4657
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-full md:w-[60%]", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ActivityBodyContent_default, { bodyMap: MCSABodyMap, templateType: "MCSA" }) }),
4658
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "contents md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(DividerLine_default, {}) }),
4659
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(VerticalDividerLine_default, {}) }),
4660
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4661
+ MCSAActivityMaterialContent_default,
4662
+ {
4663
+ uniqueValue: JSON.stringify(data.contentMap),
4664
+ answer,
4665
+ materialMap: MCSAMaterialMap,
4666
+ contentMap,
4667
+ checkCanAnswerQuestion: canAnswerQuestion,
4668
+ onChange: handleMCSAAnswerOnChange,
4669
+ isPreview
4670
+ }
4671
+ ) })
4672
+ ] });
4673
+ };
4674
+ var MCSAActivityContent_default = MCSAActivityContent;
4675
+
4676
+ // src/components/activities/material-content/OpenEndedActivityMaterialContent.tsx
4677
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4678
+ var OpenEndedActivityMaterialContent = ({
4679
+ answer,
4680
+ contentMap,
4681
+ onChange
4682
+ }) => {
4683
+ const retrieveAnswer = () => {
4684
+ if (!answer)
4685
+ return {
4686
+ answerMap: {
4687
+ ANSWER: ""
4688
+ }
4689
+ };
4690
+ return answer.data.find(
4691
+ (answerData) => answerData.type === "OPEN_ENDED"
4692
+ );
4693
+ };
4694
+ const retrieveAnswerMap = () => {
4695
+ const { answerMap: answerMap2 } = retrieveAnswer();
4696
+ return answerMap2;
4697
+ };
4698
+ const checkShowContent = () => {
4699
+ return false;
4700
+ };
4701
+ const RenderTextContent = (answerMap2) => {
4702
+ const answerMapAnswer = answerMap2["ANSWER"];
4703
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4704
+ InputGroup_default,
4705
+ {
4706
+ type: "textarea",
4707
+ value: answerMapAnswer,
4708
+ useMinHeight: true,
4709
+ onChange: (e) => {
4710
+ onChange(answer, e.target.value);
4711
+ }
4712
+ }
4713
+ );
4714
+ };
4715
+ const answerMap = retrieveAnswerMap();
4716
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "", children: [
4717
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_open_ended_text") }) }),
4718
+ /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DividerLine_default, {}) }),
4719
+ contentMap.type === "TEXT" ? RenderTextContent(answerMap) : null
4720
+ ] }) });
4721
+ };
4722
+ var OpenEndedActivityMaterialContent_default = OpenEndedActivityMaterialContent;
4723
+
4724
+ // src/components/activities/OpenEndedActivityContent.tsx
4725
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4726
+ var OpenEndedActivityContent = ({
4727
+ answer,
4728
+ data,
4729
+ changeAnswer,
4730
+ showMaterialContent
4731
+ }) => {
4732
+ const contentMap = parseContentMapFromData(data);
4733
+ const openEndedBodyMap = parseBodyMapFromData(data, "OPEN_ENDED");
4734
+ const handleOpenEndedAnswerOnChange = (answer2, value) => {
4735
+ let foundIndex = answer2.data.findIndex(
4736
+ (answerData) => answerData.type === "OPEN_ENDED"
4737
+ );
4738
+ const answerMap = answer2.data[foundIndex].answerMap;
4739
+ answerMap["ANSWER"] = value;
4740
+ changeAnswer(answer2);
4741
+ };
4742
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
4743
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4744
+ "div",
4745
+ {
4746
+ className: `${showMaterialContent ? "w-full md:w-[40%]" : "w-full"}`,
4747
+ children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4748
+ ActivityBodyContent_default,
4749
+ {
4750
+ bodyMap: openEndedBodyMap,
4751
+ templateType: "OPEN_ENDED"
4752
+ }
4753
+ )
4754
+ }
4755
+ ),
4756
+ showMaterialContent ? /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
4757
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "contents md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DividerLine_default, {}) }),
4758
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(VerticalDividerLine_default, {}) }),
4759
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4760
+ OpenEndedActivityMaterialContent_default,
4761
+ {
4762
+ answer,
4763
+ contentMap,
4764
+ onChange: handleOpenEndedAnswerOnChange
4765
+ }
4766
+ ) })
4767
+ ] }) : null
4768
+ ] });
4769
+ };
4770
+ var OpenEndedActivityContent_default = OpenEndedActivityContent;
4771
+
4772
+ // src/components/activities/material-content/OrderingActivityMaterialContent.tsx
4773
+ var import_react21 = require("react");
4774
+ var import_react_dnd7 = require("react-dnd");
4775
+ var import_react_katex8 = require("react-katex");
4776
+
4777
+ // src/components/dnds/DraggableDroppableItem.tsx
4778
+ var import_react20 = require("react");
4779
+ var import_react_dnd6 = require("react-dnd");
4780
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4781
+ var DraggableDroppableItem = ({
4782
+ key,
4783
+ item,
4784
+ type,
4785
+ component,
4786
+ moveCardHandler,
4787
+ dropRef,
4788
+ target,
4789
+ setTarget
4790
+ }) => {
4791
+ const ref = (0, import_react20.useRef)(null);
4792
+ const [, drop] = (0, import_react_dnd6.useDrop)({
4793
+ accept: type,
4794
+ hover() {
4795
+ if (!ref.current) {
4796
+ return;
4797
+ }
4798
+ if (item.index && target !== item.index) {
4799
+ setTarget(item.index);
4800
+ }
4801
+ }
4802
+ });
4803
+ const [{ isDragging }, drag] = (0, import_react_dnd6.useDrag)({
4804
+ type,
4805
+ item,
4806
+ end: (item2, monitor) => {
4807
+ const dropResult = monitor.getDropResult();
4808
+ if (dropResult) {
4809
+ moveCardHandler();
4810
+ }
4811
+ },
4812
+ collect: (monitor) => ({
4813
+ isDragging: monitor.isDragging()
4814
+ })
4815
+ });
4816
+ const opacity = isDragging ? 0.4 : 1;
4817
+ drag(drop(ref));
4818
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4819
+ "div",
4820
+ {
4821
+ className: `${isDragging ? "w-[0px] opacity-0" : "w-full opacity-100"} transition-all duration-500`,
4822
+ ref: dropRef,
4823
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { ref, className: "w-full", style: { opacity }, children: component })
4824
+ },
4825
+ key
4826
+ );
4827
+ };
4828
+ var DraggableDroppableItem_default = DraggableDroppableItem;
4829
+
4830
+ // src/components/activities/material-content/OrderingActivityMaterialContent.tsx
4831
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4832
+ var OrderingActivityMaterialContent = ({
4833
+ uniqueValue,
4834
+ answer,
4835
+ materialMap,
4836
+ contentMap,
4837
+ checkCanAnswerQuestion,
4838
+ onChange,
4839
+ isPreview,
4840
+ showCorrectAnswer
4841
+ }) => {
4842
+ const [selectedTargetKey, setSelectedTargetKey] = (0, import_react21.useState)(null);
4843
+ const [selectedKey, setSelectedKey] = (0, import_react21.useState)(null);
4844
+ const { screenSize } = useScreenSize_default();
4845
+ const [view, setView] = (0, import_react21.useState)("PC");
4846
+ const [{ isOver, canDrop }, drop] = (0, import_react_dnd7.useDrop)({
4847
+ accept: "ORDERING",
4848
+ drop: () => {
4849
+ },
4850
+ collect: (monitor) => ({
4851
+ isOver: monitor.isOver(),
4852
+ canDrop: monitor.canDrop()
4853
+ })
4854
+ });
4855
+ (0, import_react21.useEffect)(() => {
4856
+ if (!screenSize) return;
4857
+ if (screenSize.width <= 768) {
4858
+ setView("TABLET");
4859
+ } else {
4860
+ setView("PC");
4861
+ }
4862
+ }, [screenSize]);
4863
+ (0, import_react21.useEffect)(() => {
4864
+ if (!showCorrectAnswer) return;
4865
+ const answerMap2 = answer.data.find(
4866
+ (answerData) => answerData.type === "ORDERING"
4867
+ ).answerMap;
4868
+ Object.keys(answerMap2).forEach((answerKey, index) => {
4869
+ answerMap2[answerKey] = index;
4870
+ });
4871
+ }, [showCorrectAnswer]);
4872
+ const retrieveAnswerMap = () => {
4873
+ const foundIndex = answer.data.findIndex(
4874
+ (answerData) => answerData.type === "ORDERING"
4875
+ );
4876
+ return answer.data[foundIndex].answerMap;
4877
+ };
4878
+ const checkAnswerState = (correctAnswer, learnerAnswer) => {
4879
+ if (!isPreview) return "HIDDEN";
4880
+ if (correctAnswer === learnerAnswer) {
4881
+ return "CORRECT";
4882
+ }
4883
+ return "INCORRECT";
4884
+ };
4885
+ const handleOrderingActivityItemChange = (selectedKey2, materialKey) => {
4886
+ if (checkCanAnswerQuestion()) {
4887
+ if (selectedKey2) {
4888
+ onChange(answer, selectedKey2, materialKey);
4889
+ setSelectedKey(null);
4890
+ } else {
4891
+ setSelectedKey(materialKey);
4892
+ }
4893
+ }
4894
+ };
4895
+ const calculateMarginTop = (index) => {
4896
+ if (index === 0) {
4897
+ return 0;
4898
+ } else if (index === 1) {
4899
+ return 150;
4900
+ } else if (index % 2 === 0) {
4901
+ return -150;
4902
+ } else if (index % 2 === 1) {
4903
+ return 0;
4904
+ }
4905
+ return 0;
4906
+ };
4907
+ const answerMap = retrieveAnswerMap();
4908
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-row flex-wrap", children: Object.keys(answerMap).map((materialKey, index) => {
4909
+ const learnerAnswerState = checkAnswerState(
4910
+ answerMap[materialKey] + "",
4911
+ index + ""
4912
+ );
4913
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "w-full lg:w-1/2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
4914
+ "div",
4915
+ {
4916
+ className: `flex flex-row items-center my-4 mx-2`,
4917
+ style: {
4918
+ marginTop: view === "PC" ? calculateMarginTop(parseFloat(materialKey)) : 0
4919
+ },
4920
+ children: [
4921
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "mr-3", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4922
+ "div",
4923
+ {
4924
+ className: `${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : selectedKey === materialKey ? "border-catchup-blue" : "border-catchup-lighter-gray"} min-h-catchup-activity-outer-box-item w-catchup-activity-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer transition-all duration-300`,
4925
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4926
+ "div",
4927
+ {
4928
+ className: `${selectedKey === materialKey ? "border-2 border-catchup-light-gray" : "border-2 border-catchup-blue"} flex flex-col items-center justify-center transition-all duration-300 rounded-catchup-full w-[50px] h-[50px]`,
4929
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "", children: parseFloat(materialKey) + 1 })
4930
+ }
4931
+ )
4932
+ }
4933
+ ) }),
4934
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4935
+ DraggableDroppableItem_default,
4936
+ {
4937
+ item: { index: materialKey },
4938
+ type: "ORDERING",
4939
+ dropRef: drop,
4940
+ component: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4941
+ "div",
4942
+ {
4943
+ className: `${canDrop ? selectedKey !== materialKey ? selectedTargetKey === materialKey ? "bg-catchup-light-blue rounded-catchup-xlarge" : "bg-catchup-light-blue rounded-catchup-xlarge opacity-40" : "" : ""} flex-1 min-h-catchup-activity-outer-box-item flex flex-col items-center justify-center border-2 rounded-catchup-xlarge cursor-pointer p-3 ${learnerAnswerState === "CORRECT" ? "border-catchup-green" : learnerAnswerState === "INCORRECT" ? "border-catchup-red" : "border-catchup-blue"}`,
4944
+ onMouseDown: () => {
4945
+ if (checkCanAnswerQuestion()) {
4946
+ setSelectedKey(materialKey);
4947
+ }
4948
+ },
4949
+ children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-xl whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
4950
+ materialMap[answerMap[materialKey]]
4951
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4952
+ "span",
4953
+ {
4954
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
4955
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_katex8.InlineMath, { math: inputPart.value }) }) : inputPart.value
4956
+ },
4957
+ index2
4958
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4959
+ ShowMaterialMediaByContentType_default,
4960
+ {
4961
+ contentType: contentMap.type,
4962
+ src: materialMap[answerMap[materialKey]],
4963
+ canFullScreen: true
4964
+ },
4965
+ `${uniqueValue}-${index}`
4966
+ )
4967
+ }
4968
+ ),
4969
+ target: selectedTargetKey,
4970
+ setTarget: setSelectedTargetKey,
4971
+ moveCardHandler: () => {
4972
+ if (!selectedKey) return;
4973
+ if (!selectedTargetKey) return;
4974
+ handleOrderingActivityItemChange(
4975
+ selectedKey,
4976
+ selectedTargetKey
4977
+ );
4978
+ }
4979
+ },
4980
+ index
4981
+ )
4982
+ ]
4983
+ }
4984
+ ) }, index);
4985
+ }) });
4986
+ };
4987
+ var OrderingActivityMaterialContent_default = OrderingActivityMaterialContent;
4988
+
4989
+ // src/components/activities/OrderingActivityContent.tsx
4990
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4991
+ var OrderingActivityContent = ({
4992
+ answer,
4993
+ data,
4994
+ canAnswerQuestion,
4995
+ changeAnswer,
4996
+ isPreview,
4997
+ showCorrectAnswer
4998
+ }) => {
4999
+ const contentMap = parseContentMapFromData(data);
5000
+ const orderingBodyMap = parseBodyMapFromData(data, "ORDERING");
5001
+ const orderingMaterialMap = parseMaterialMapFromData(data, "ORDERING");
5002
+ const handleOrderingAnswerOnChange = (answer2, primaryKey, secondaryKey) => {
5003
+ let foundIndex = answer2.data.findIndex(
5004
+ (answerData) => answerData.type === "ORDERING"
5005
+ );
5006
+ const answerMap = answer2.data[foundIndex].answerMap;
5007
+ const prevValue = answerMap[primaryKey];
5008
+ answerMap[primaryKey] = answerMap[secondaryKey];
5009
+ answerMap[secondaryKey] = prevValue;
5010
+ changeAnswer(answer2);
5011
+ };
5012
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
5013
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5014
+ ActivityBodyContent_default,
5015
+ {
5016
+ bodyMap: orderingBodyMap,
5017
+ templateType: "ORDERING"
5018
+ }
5019
+ ),
5020
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(DividerLine_default, {}),
5021
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
5022
+ OrderingActivityMaterialContent_default,
5023
+ {
5024
+ uniqueValue: JSON.stringify(data.contentMap),
5025
+ answer,
5026
+ materialMap: orderingMaterialMap,
5027
+ contentMap,
5028
+ checkCanAnswerQuestion: canAnswerQuestion,
5029
+ onChange: handleOrderingAnswerOnChange,
5030
+ isPreview,
5031
+ showCorrectAnswer
5032
+ }
5033
+ )
5034
+ ] });
5035
+ };
5036
+ var OrderingActivityContent_default = OrderingActivityContent;
5037
+
5038
+ // src/components/activities/material-content/TrueFalseActivityMaterialContent.tsx
5039
+ var import_react22 = require("react");
5040
+ var import_react_katex9 = require("react-katex");
5041
+ var import_jsx_runtime35 = require("react/jsx-runtime");
5042
+ var TrueFalseActivityMaterialContent = ({
5043
+ uniqueValue,
5044
+ answer,
5045
+ materialMap,
5046
+ contentMap,
5047
+ checkCanAnswerQuestion,
5048
+ onChange,
5049
+ isPreview,
5050
+ showCorrectAnswer
5051
+ }) => {
5052
+ const { screenSize } = useScreenSize_default();
5053
+ const [shuffleOptionList, setShuffleOptionList] = (0, import_react22.useState)([]);
5054
+ (0, import_react22.useEffect)(() => {
5055
+ const optionList = [];
5056
+ optionList.push(...materialMap.trueList);
5057
+ optionList.push(...materialMap.falseList);
5058
+ if (isPreview) {
5059
+ setShuffleOptionList(optionList);
5060
+ } else {
5061
+ setShuffleOptionList(shuffleArray(optionList));
5062
+ }
5063
+ }, []);
5064
+ (0, import_react22.useEffect)(() => {
5065
+ if (!showCorrectAnswer) return;
5066
+ answer.data.find(
5067
+ (answerData) => answerData.type === "TRUE_FALSE"
5068
+ ).answerMap = materialMap;
5069
+ }, [showCorrectAnswer]);
5070
+ const retrieveAnswer = () => {
5071
+ if (!answer)
5072
+ return {
5073
+ answerMap: {
5074
+ trueList: [],
5075
+ falseList: []
5076
+ }
5077
+ };
5078
+ return answer.data.find(
5079
+ (answerData) => answerData.type === "TRUE_FALSE"
5080
+ );
5081
+ };
5082
+ const retrieveAnswerMap = () => {
5083
+ const { answerMap: answerMap2 } = retrieveAnswer();
5084
+ return answerMap2;
5085
+ };
5086
+ const checkAnswerState = (correctAnswer, learnerAnswer) => {
5087
+ if (!isPreview) return "HIDDEN";
5088
+ if (correctAnswer === learnerAnswer) {
5089
+ return "CORRECT";
5090
+ }
5091
+ return "INCORRECT";
5092
+ };
5093
+ const answerMap = retrieveAnswerMap();
5094
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "", children: [
5095
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "font-semibold text-xl opacity-60", children: i18n_default.t("please_select_true_false_text") }) }),
5096
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "hidden md:contents", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DividerLine_default, {}) }),
5097
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-row justify-end items-center gap-x-2", children: [
5098
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "font-bold text-lg", children: i18n_default.t("true") }) }),
5099
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "font-bold text-lg", children: i18n_default.t("false") }) })
5100
+ ] }),
5101
+ checkCanAnswerQuestion() ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: `flex flex-row w-full justify-center flex-wrap`, children: shuffleOptionList.map((shuffleOption, index) => {
5102
+ const correctAnswer = materialMap.trueList.find(
5103
+ (trueItem) => trueItem === shuffleOption
5104
+ ) !== void 0 ? "TRUE" : "FALSE";
5105
+ const learnerAnswer = answerMap.trueList.find(
5106
+ (trueItem) => trueItem === shuffleOption
5107
+ ) !== void 0 ? "TRUE" : "FALSE";
5108
+ const learnerAnswerState = checkAnswerState(
5109
+ correctAnswer,
5110
+ learnerAnswer
5111
+ );
5112
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
5113
+ "div",
5114
+ {
5115
+ className: `w-full flex flex-row items-center justify-center cursor-pointer my-2 ${learnerAnswerState === "CORRECT" ? "border-2 border-catchup-green rounded-catchup-xlarge" : learnerAnswerState === "INCORRECT" ? "border-2 border-catchup-red rounded-catchup-xlarge" : ""}`,
5116
+ children: [
5117
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex-1", children: contentMap.type === "TEXT" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "text-xl p-2 whitespace-pre-wrap", children: constructInputWithSpecialExpressionList(
5118
+ shuffleOption
5119
+ ).map((inputPart, index2) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5120
+ "span",
5121
+ {
5122
+ className: `${inputPart.isBold ? "font-bold" : ""} ${inputPart.isUnderline ? "underline" : ""}`,
5123
+ children: inputPart.isEquation ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react_katex9.InlineMath, { math: inputPart.value }) }) : inputPart.value
5124
+ },
5125
+ index2
5126
+ )) }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5127
+ ShowMaterialMediaByContentType_default,
5128
+ {
5129
+ contentType: contentMap.type,
5130
+ src: shuffleOption,
5131
+ canFullScreen: true
5132
+ },
5133
+ `${uniqueValue}-${index}`
5134
+ ) }),
5135
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-row items-center gap-x-2", children: [
5136
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5137
+ BaseImage_default,
5138
+ {
5139
+ src: answerMap.trueList.includes(shuffleOption) ? "/icons/checkbox.png" : "/icons/empty-checkbox.png",
5140
+ alt: "checkbox-empty-checkbox",
5141
+ size: "small",
5142
+ onClick: () => {
5143
+ onChange(answer, "TRUE", shuffleOption);
5144
+ }
5145
+ }
5146
+ ) }) }),
5147
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex flex-col items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
5148
+ BaseImage_default,
5149
+ {
5150
+ src: answerMap.falseList.includes(shuffleOption) ? "/icons/checkbox.png" : "/icons/empty-checkbox.png",
5151
+ alt: "checkbox-empty-checkbox",
5152
+ size: "small",
5153
+ onClick: () => {
5154
+ onChange(answer, "FALSE", shuffleOption);
5155
+ }
5156
+ }
5157
+ ) }) })
5158
+ ] })
5159
+ ]
5160
+ },
5161
+ index
5162
+ );
5163
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
5164
+ answerMap.trueList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-row items-center gap-x-2", children: [
5165
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: item }) }),
5166
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "underline", children: i18n_default.t("true") }) })
5167
+ ] })),
5168
+ answerMap.falseList.map((item) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-row items-center gap-x-2", children: [
5169
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { children: item }) }),
5170
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-[50px]", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: "underline", children: i18n_default.t("false") }) })
5171
+ ] }))
5172
+ ] })
5173
+ ] });
5174
+ };
5175
+ var TrueFalseActivityMaterialContent_default = TrueFalseActivityMaterialContent;
5176
+
5177
+ // src/components/activities/TrueFalseActivityContent.tsx
5178
+ var import_jsx_runtime36 = require("react/jsx-runtime");
5179
+ var TrueFalseActivityContent = ({
5180
+ answer,
5181
+ data,
5182
+ canAnswerQuestion,
5183
+ changeAnswer,
5184
+ isPreview,
5185
+ showCorrectAnswer
5186
+ }) => {
5187
+ const contentMap = parseContentMapFromData(data);
5188
+ const trueFalseBodyMap = parseBodyMapFromData(data, "TRUE_FALSE");
5189
+ const trueFalseMaterialMap = parseMaterialMapFromData(data, "TRUE_FALSE");
5190
+ const retrieveCurrentAnswerMap = () => {
5191
+ let foundIndex = answer.data.findIndex(
5192
+ (answerData) => answerData.type === "TRUE_FALSE"
5193
+ );
5194
+ return answer.data[foundIndex].answerMap;
5195
+ };
5196
+ const handleTrueFalseAnswerOnChange = (answer2, key, value) => {
5197
+ const answerMap = retrieveCurrentAnswerMap();
5198
+ if (key === "TRUE") {
5199
+ const foundFalseIndex = answerMap.falseList.findIndex(
5200
+ (item) => item === value
5201
+ );
5202
+ if (foundFalseIndex !== -1) {
5203
+ answerMap.falseList.splice(foundFalseIndex, 1);
5204
+ }
5205
+ const foundTrueIndex = answerMap.falseList.findIndex(
5206
+ (item) => item === value
5207
+ );
5208
+ if (foundTrueIndex === -1) {
5209
+ answerMap.trueList.push(value);
5210
+ }
5211
+ } else if (key === "FALSE") {
5212
+ const foundTrueIndex = answerMap.trueList.findIndex(
5213
+ (item) => item === value
5214
+ );
5215
+ if (foundTrueIndex !== -1) {
5216
+ answerMap.trueList.splice(foundTrueIndex, 1);
5217
+ }
5218
+ const foundFalseIndex = answerMap.falseList.findIndex(
5219
+ (item) => item === value
5220
+ );
5221
+ if (foundFalseIndex === -1) {
5222
+ answerMap.falseList.push(value);
5223
+ }
5224
+ }
5225
+ changeAnswer(answer2);
5226
+ };
5227
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-row flex-wrap", children: [
5228
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-full md:w-[40%]", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5229
+ ActivityBodyContent_default,
5230
+ {
5231
+ bodyMap: trueFalseBodyMap,
5232
+ templateType: "GROUPING"
5233
+ }
5234
+ ) }),
5235
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "contents md:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(DividerLine_default, {}) }),
5236
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "hidden md:block", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(VerticalDividerLine_default, {}) }),
5237
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-full md:flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
5238
+ TrueFalseActivityMaterialContent_default,
5239
+ {
5240
+ uniqueValue: JSON.stringify(data.contentMap),
5241
+ answer,
5242
+ materialMap: trueFalseMaterialMap,
5243
+ contentMap,
5244
+ checkCanAnswerQuestion: canAnswerQuestion,
5245
+ onChange: handleTrueFalseAnswerOnChange,
5246
+ isPreview,
5247
+ showCorrectAnswer
5248
+ }
5249
+ ) })
5250
+ ] });
5251
+ };
5252
+ var TrueFalseActivityContent_default = TrueFalseActivityContent;
5253
+
5254
+ // src/components/dividers/BlueVerticalDividerLine.tsx
5255
+ var import_jsx_runtime37 = require("react/jsx-runtime");
5256
+ var BlueVerticalDividerLine = ({ opacity }) => {
5257
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
5258
+ "div",
5259
+ {
5260
+ className: `w-[2px] h-[40px] my-4 bg-catchup-blue ${opacity === "medium" ? "opacity-50" : ""}`
5261
+ }
5262
+ );
5263
+ };
5264
+ var BlueVerticalDividerLine_default = BlueVerticalDividerLine;
5265
+
5266
+ // src/utilization/StorageUtilization.ts
5267
+ var convertDataURLtoFile = (dataurl, filename) => {
5268
+ var arr = dataurl.split(","), mime = (arr[0].match(/:(.*?);/) || [])[1], bstr = atob(arr[arr.length - 1]), n = bstr.length, u8arr = new Uint8Array(n);
5269
+ while (n--) {
5270
+ u8arr[n] = bstr.charCodeAt(n);
5271
+ }
5272
+ return new File([u8arr], filename, { type: mime });
5273
+ };
5274
+ var retrieveDocumentTypeFromAcceptedFormat = (format) => {
5275
+ if (format === "application/pdf") {
5276
+ return "PDF";
5277
+ } else if (format === "image/jpeg" || format === "image/png" || format === "image/jpg") {
5278
+ return "IMAGE";
5279
+ } else if (format === "audio/mp3") {
5280
+ return "AUDIO";
5281
+ }
5282
+ };
5283
+ var retrieveDocumentTypeFromExtension = (format) => {
5284
+ if (format === "pdf") {
5285
+ return "PDF";
5286
+ } else if (format === "jpeg" || format === "png" || format === "jpg") {
5287
+ return "IMAGE";
5288
+ } else if (format === "mp3") {
5289
+ return "AUDIO";
5290
+ }
5291
+ };
664
5292
  // Annotate the CommonJS export names for ESM import in node:
665
5293
  0 && (module.exports = {
666
5294
  ApproveButton,
667
5295
  BaseImage,
668
5296
  BaseLoading,
5297
+ BlueVerticalDividerLine,
669
5298
  CancelButton,
670
5299
  CreateButton,
671
5300
  DeleteButton,
5301
+ DividerLine,
5302
+ DropdownActivityContent,
5303
+ FillInTheBlanksActivityContent,
5304
+ GroupingActivityContent,
5305
+ InputGroup,
5306
+ MCMAActivityContent,
5307
+ MCSAActivityContent,
5308
+ MatchingActivityContent,
5309
+ OpenEndedActivityContent,
5310
+ OrderingActivityContent,
672
5311
  PrimaryButton,
673
- SecondaryButton
5312
+ SecondaryButton,
5313
+ TrueFalseActivityContent,
5314
+ VerticalDividerLine,
5315
+ checkActivityAnswerState,
5316
+ checkIfAnswerIsEmpty,
5317
+ constructActivityAnswerMap,
5318
+ constructActivityAnswerStateList,
5319
+ constructActivityItemListWithAnswersForAI,
5320
+ constructActivityItemListWithSolutionForAI,
5321
+ constructInputWithSpecialExpressionList,
5322
+ convertDataURLtoFile,
5323
+ findBestFitActivity,
5324
+ getColorByIndex,
5325
+ i18n,
5326
+ ignoreMathematicalExpression,
5327
+ parseBodyMapFromData,
5328
+ parseContentMapFromData,
5329
+ parseMaterialMapFromData,
5330
+ retrieveActivityAnswerFromAnswerList,
5331
+ retrieveActivityTemplateDTOOptionList,
5332
+ retrieveClockTimeLeft,
5333
+ retrieveColorByScore,
5334
+ retrieveContentTypeOptionList,
5335
+ retrieveContestTypeOptionList,
5336
+ retrieveCoterieTypeFromStandardExamCoterieType,
5337
+ retrieveCurrentDefaultDataMap,
5338
+ retrieveDistintCoterieTypeFromCatchtivityApplicationDTO,
5339
+ retrieveDocumentTypeFromAcceptedFormat,
5340
+ retrieveDocumentTypeFromExtension,
5341
+ retrieveDurationInMinutesOptionList,
5342
+ retrieveDurationInSecondsOptionList,
5343
+ retrieveDurationTypeOptionList,
5344
+ retrieveEachTimeSpentInSeconds,
5345
+ retrieveFrequencyTypeOptionList,
5346
+ retrieveStandardExamCoterieTypeOptionListByStandardExamType,
5347
+ retrieveStandardExamTypeIcon,
5348
+ retrieveStandardExamTypeOptionList,
5349
+ retrieveStatusOptionList,
5350
+ retrieveTaxonomyGroupName,
5351
+ retrieveTaxonomyName,
5352
+ retrieveTaxonomyType,
5353
+ retrieveTotalTimeSpentInMinutes,
5354
+ retrieveTotalTimeSpentInSeconds,
5355
+ retrieveValidationRequirementList,
5356
+ shuffleArray,
5357
+ useScreenSize
674
5358
  });