mario-education 2.0.161-staging → 2.0.162-staging

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 (28) hide show
  1. package/dist/FrequencyAndSetupV2-BiG9uOKx.js +2896 -0
  2. package/dist/FrequencyAndSetupV2-C4JFgktD.cjs +1 -0
  3. package/dist/containers/FrequencyAndSetupV2/components/ComprehensiveTabContent.d.ts +2 -10
  4. package/dist/containers/FrequencyAndSetupV2/components/DeleteQuestionModal.d.ts +2 -6
  5. package/dist/containers/FrequencyAndSetupV2/components/EmailPreviewBox.d.ts +2 -7
  6. package/dist/containers/FrequencyAndSetupV2/components/LaunchModal.d.ts +2 -6
  7. package/dist/containers/FrequencyAndSetupV2/components/ModeTabs.d.ts +2 -5
  8. package/dist/containers/FrequencyAndSetupV2/components/OneOffTabContent.d.ts +2 -15
  9. package/dist/containers/FrequencyAndSetupV2/components/QuestionRow.d.ts +2 -13
  10. package/dist/containers/FrequencyAndSetupV2/components/QuestionSectionCard.d.ts +2 -22
  11. package/dist/containers/FrequencyAndSetupV2/components/RestoreDefaultsModal.d.ts +2 -7
  12. package/dist/containers/FrequencyAndSetupV2/components/ReviewQuestionsV2.d.ts +2 -11
  13. package/dist/containers/FrequencyAndSetupV2/components/RoutineTabContent.d.ts +2 -10
  14. package/dist/containers/FrequencyAndSetupV2/components/SavedView.d.ts +2 -13
  15. package/dist/containers/FrequencyAndSetupV2/components/SendItAgainModal.d.ts +2 -8
  16. package/dist/containers/FrequencyAndSetupV2/components/SortableClusterCard.d.ts +2 -19
  17. package/dist/containers/FrequencyAndSetupV2/components/ViewOneOffModal.d.ts +2 -8
  18. package/dist/containers/FrequencyAndSetupV2/components/WellbeingSnackbar.d.ts +0 -2
  19. package/dist/containers/FrequencyAndSetupV2/components/wellbeingSnackbarHelper.d.ts +11 -0
  20. package/dist/containers/FrequencyAndSetupV2/constants.d.ts +13 -1
  21. package/dist/containers/FrequencyAndSetupV2/hooks/useFrequencyAndSetupV2.d.ts +5 -1
  22. package/dist/containers/FrequencyAndSetupV2/index.d.ts +2 -0
  23. package/dist/containers/FrequencyAndSetupV2/types.d.ts +141 -0
  24. package/dist/containers/FrequencyAndSetupV2/utils.d.ts +147 -0
  25. package/dist/index.js +1 -1
  26. package/dist/index.modern.js +1 -1
  27. package/dist/mario-education.css +1 -1
  28. package/package.json +1 -1
@@ -0,0 +1,2896 @@
1
+ import { jsx as t, jsxs as s, Fragment as pe } from "react/jsx-runtime";
2
+ import { useState as N, useRef as Ve, useEffect as de, useCallback as le } from "react";
3
+ import { b as We, c as Ue, d as qe, e as Ce, L as He, f as Fe, g as he, h as je, a as pt, i as kt, j as De, k as wt, l as Ke, m as Se, n as Ge, o as Ie, p as Je, q as ve, r as gt, s as Xe, t as yt, u as Nt, v as xt } from "./index-BsE4CebT.js";
4
+ import { a as Te, e as ue, f as Ze, F as zt } from "./index-C7FfGNJT.js";
5
+ import { useSensors as qt, useSensor as Ct, PointerSensor as Dt, DndContext as St, rectIntersection as It } from "@dnd-kit/core";
6
+ import { useSortable as Tt, SortableContext as Ot, verticalListSortingStrategy as At, arrayMove as Et } from "@dnd-kit/sortable";
7
+ import et from "react-dom";
8
+ import p from "moment";
9
+ import { t as Mt, b as Ye, d as $t, c as Bt, o as Lt, r as tt, e as Qe, f as ce, h as Rt, i as Ft } from "./wellbeingService-Bom7MO8x.js";
10
+ import { C as Yt } from "./utilities.esm-Dnyerk6a.js";
11
+ import { LocalizationProvider as Oe, DatePicker as Ae } from "@mui/x-date-pickers";
12
+ import { A as Ee } from "./AdapterMoment-CeMS9jLD.js";
13
+ import { useNavigate as Qt } from "react-router-dom";
14
+ import { L as ge } from "./Loading-9Xhwui4j.js";
15
+ import { useSelector as Pt } from "react-redux";
16
+ import { Snackbar as Vt, Alert as Wt } from "@mui/material";
17
+ const e = {
18
+ "v2-container": "_v2-container_1tvkz_4",
19
+ "v2-header": "_v2-header_1tvkz_16",
20
+ "v2-header-row": "_v2-header-row_1tvkz_22",
21
+ "v2-btn-back-overview": "_v2-btn-back-overview_1tvkz_29",
22
+ "v2-title": "_v2-title_1tvkz_49",
23
+ "v2-description": "_v2-description_1tvkz_57",
24
+ "v2-mode-tabs": "_v2-mode-tabs_1tvkz_66",
25
+ "v2-mode-tabs__btn": "_v2-mode-tabs__btn_1tvkz_77",
26
+ "v2-mode-tabs__btn--active": "_v2-mode-tabs__btn--active_1tvkz_95",
27
+ "v2-power-card": "_v2-power-card_1tvkz_100",
28
+ "v2-power-card--active": "_v2-power-card--active_1tvkz_110",
29
+ "v2-power-card__icon": "_v2-power-card__icon_1tvkz_114",
30
+ "v2-power-card__content": "_v2-power-card__content_1tvkz_124",
31
+ "v2-power-card__title": "_v2-power-card__title_1tvkz_128",
32
+ "v2-power-card__sub": "_v2-power-card__sub_1tvkz_133",
33
+ "v2-power-card__state-text": "_v2-power-card__state-text_1tvkz_138",
34
+ "v2-power-card__state-text--active": "_v2-power-card__state-text--active_1tvkz_143",
35
+ "v2-power-card__switch": "_v2-power-card__switch_1tvkz_146",
36
+ "v2-power-card__switch--active": "_v2-power-card__switch--active_1tvkz_157",
37
+ "v2-power-card__knob": "_v2-power-card__knob_1tvkz_160",
38
+ "v2-power-card__knob--active": "_v2-power-card__knob--active_1tvkz_171",
39
+ "v2-info-callout": "_v2-info-callout_1tvkz_175",
40
+ "v2-info-callout__icon": "_v2-info-callout__icon_1tvkz_184",
41
+ "v2-info-callout__text": "_v2-info-callout__text_1tvkz_192",
42
+ "v2-section-box": "_v2-section-box_1tvkz_200",
43
+ "v2-section-box__header": "_v2-section-box__header_1tvkz_208",
44
+ "v2-section-box__num": "_v2-section-box__num_1tvkz_213",
45
+ "v2-section-box__title": "_v2-section-box__title_1tvkz_225",
46
+ "v2-section-box__sub": "_v2-section-box__sub_1tvkz_230",
47
+ "v2-section-box__body": "_v2-section-box__body_1tvkz_236",
48
+ "v2-field-label": "_v2-field-label_1tvkz_243",
49
+ "v2-cadence-grid": "_v2-cadence-grid_1tvkz_252",
50
+ "v2-cadence-card": "_v2-cadence-card_1tvkz_258",
51
+ "v2-cadence-card--selected": "_v2-cadence-card--selected_1tvkz_273",
52
+ "v2-cadence-card__top": "_v2-cadence-card__top_1tvkz_277",
53
+ "v2-cadence-card__radio": "_v2-cadence-card__radio_1tvkz_282",
54
+ "v2-cadence-card__radio--selected": "_v2-cadence-card__radio--selected_1tvkz_291",
55
+ "v2-cadence-card__title": "_v2-cadence-card__title_1tvkz_301",
56
+ "v2-cadence-card__badge": "_v2-cadence-card__badge_1tvkz_306",
57
+ "v2-cadence-card__sub": "_v2-cadence-card__sub_1tvkz_316",
58
+ "v2-days-row": "_v2-days-row_1tvkz_322",
59
+ "v2-day-pill": "_v2-day-pill_1tvkz_328",
60
+ "v2-day-pill--selected": "_v2-day-pill--selected_1tvkz_343",
61
+ "v2-rotation-box": "_v2-rotation-box_1tvkz_352",
62
+ "v2-rotation-box__head": "_v2-rotation-box__head_1tvkz_358",
63
+ "v2-rotation-box__desc": "_v2-rotation-box__desc_1tvkz_367",
64
+ "v2-rotation-box__list": "_v2-rotation-box__list_1tvkz_373",
65
+ "v2-rotation-box__item": "_v2-rotation-box__item_1tvkz_378",
66
+ "v2-rotation-box__cycle": "_v2-rotation-box__cycle_1tvkz_387",
67
+ "v2-rotation-box__title": "_v2-rotation-box__title_1tvkz_394",
68
+ "v2-rotation-box__tag": "_v2-rotation-box__tag_1tvkz_400",
69
+ "v2-email-box": "_v2-email-box_1tvkz_409",
70
+ "v2-email-box--active": "_v2-email-box--active_1tvkz_419",
71
+ "v2-email-box__icon": "_v2-email-box__icon_1tvkz_423",
72
+ "v2-email-box__content": "_v2-email-box__content_1tvkz_432",
73
+ "v2-email-box__title": "_v2-email-box__title_1tvkz_436",
74
+ "v2-email-box__sub": "_v2-email-box__sub_1tvkz_441",
75
+ "v2-email-box__state-text": "_v2-email-box__state-text_1tvkz_446",
76
+ "v2-email-box__state-text--active": "_v2-email-box__state-text--active_1tvkz_451",
77
+ "v2-email-box__switch": "_v2-email-box__switch_1tvkz_454",
78
+ "v2-email-box__switch--active": "_v2-email-box__switch--active_1tvkz_465",
79
+ "v2-email-box__knob": "_v2-email-box__knob_1tvkz_468",
80
+ "v2-email-box__knob--active": "_v2-email-box__knob--active_1tvkz_479",
81
+ "v2-email-preview-wrapper": "_v2-email-preview-wrapper_1tvkz_483",
82
+ "v2-btn-preview-email": "_v2-btn-preview-email_1tvkz_489",
83
+ "v2-email-preview-popover": "_v2-email-preview-popover_1tvkz_509",
84
+ "v2-email-preview-popover__head": "_v2-email-preview-popover__head_1tvkz_522",
85
+ "v2-email-preview-popover__logo-wrap": "_v2-email-preview-popover__logo-wrap_1tvkz_530",
86
+ "v2-email-preview-popover__logo-circle": "_v2-email-preview-popover__logo-circle_1tvkz_535",
87
+ "v2-email-preview-popover__logo-text": "_v2-email-preview-popover__logo-text_1tvkz_546",
88
+ "v2-email-preview-popover__brand": "_v2-email-preview-popover__brand_1tvkz_552",
89
+ "v2-email-preview-popover__body": "_v2-email-preview-popover__body_1tvkz_557",
90
+ "v2-email-preview-popover__to": "_v2-email-preview-popover__to_1tvkz_564",
91
+ "v2-email-preview-popover__title": "_v2-email-preview-popover__title_1tvkz_569",
92
+ "v2-email-preview-popover__desc": "_v2-email-preview-popover__desc_1tvkz_576",
93
+ "v2-email-preview-popover__btn-start": "_v2-email-preview-popover__btn-start_1tvkz_582",
94
+ "v2-send-warning-box": "_v2-send-warning-box_1tvkz_602",
95
+ "v2-send-warning-box__icon": "_v2-send-warning-box__icon_1tvkz_616",
96
+ "v2-btn-primary": "_v2-btn-primary_1tvkz_620",
97
+ "v2-stat-banner": "_v2-stat-banner_1tvkz_647",
98
+ "v2-stat-banner__left": "_v2-stat-banner__left_1tvkz_657",
99
+ "v2-stat-banner__icon": "_v2-stat-banner__icon_1tvkz_662",
100
+ "v2-stat-banner__label": "_v2-stat-banner__label_1tvkz_671",
101
+ "v2-stat-banner__num": "_v2-stat-banner__num_1tvkz_676",
102
+ "v2-stat-banner__right": "_v2-stat-banner__right_1tvkz_682",
103
+ "v2-stat-banner__meta-sub": "_v2-stat-banner__meta-sub_1tvkz_686",
104
+ "v2-stat-banner__meta-num": "_v2-stat-banner__meta-num_1tvkz_690",
105
+ "v2-cluster-card": "_v2-cluster-card_1tvkz_695",
106
+ "v2-cluster-card--collapsed": "_v2-cluster-card--collapsed_1tvkz_705",
107
+ "v2-cluster-card__head": "_v2-cluster-card__head_1tvkz_710",
108
+ "v2-cluster-card__num": "_v2-cluster-card__num_1tvkz_715",
109
+ "v2-cluster-card__info": "_v2-cluster-card__info_1tvkz_727",
110
+ "v2-cluster-card__title": "_v2-cluster-card__title_1tvkz_731",
111
+ "v2-cluster-card__count": "_v2-cluster-card__count_1tvkz_736",
112
+ "v2-cluster-card__pill": "_v2-cluster-card__pill_1tvkz_741",
113
+ "v2-cluster-card-ext__bottom-actions": "_v2-cluster-card-ext__bottom-actions_1tvkz_752",
114
+ "v2-cluster-card-ext__btn-add-cluster": "_v2-cluster-card-ext__btn-add-cluster_1tvkz_756",
115
+ "v2-cluster-card-ext__btn-toggle-bank": "_v2-cluster-card-ext__btn-toggle-bank_1tvkz_756",
116
+ "v2-cluster-card-ext__bank-panel": "_v2-cluster-card-ext__bank-panel_1tvkz_777",
117
+ "v2-cluster-card-ext__bank-empty": "_v2-cluster-card-ext__bank-empty_1tvkz_789",
118
+ "v2-cluster-card-ext__bank-item": "_v2-cluster-card-ext__bank-item_1tvkz_795",
119
+ "v2-cluster-card-ext__bank-icon-circle": "_v2-cluster-card-ext__bank-icon-circle_1tvkz_811",
120
+ "v2-cluster-card-ext__bank-text-wrap": "_v2-cluster-card-ext__bank-text-wrap_1tvkz_820",
121
+ "v2-cluster-card-ext__bank-item-title": "_v2-cluster-card-ext__bank-item-title_1tvkz_827",
122
+ "v2-cluster-card-ext__bank-item-desc": "_v2-cluster-card-ext__bank-item-desc_1tvkz_833",
123
+ "v2-cluster-card-ext__bank-divider": "_v2-cluster-card-ext__bank-divider_1tvkz_838",
124
+ "v2-cluster-card-ext__btn-write-custom": "_v2-cluster-card-ext__btn-write-custom_1tvkz_843",
125
+ "v2-cluster-card-ext__drag-handle": "_v2-cluster-card-ext__drag-handle_1tvkz_863",
126
+ "v2-cluster-card-ext__drag-handle--disabled": "_v2-cluster-card-ext__drag-handle--disabled_1tvkz_873",
127
+ "v2-cluster-card-ext__guidance-box": "_v2-cluster-card-ext__guidance-box_1tvkz_877",
128
+ "v2-cluster-card-ext__questions-list": "_v2-cluster-card-ext__questions-list_1tvkz_887",
129
+ "v2-cluster-card-ext__empty": "_v2-cluster-card-ext__empty_1tvkz_892",
130
+ "v2-question-row": "_v2-question-row_1tvkz_902",
131
+ "v2-question-row--disabled": "_v2-question-row--disabled_1tvkz_910",
132
+ "v2-question-row__title": "_v2-question-row__title_1tvkz_914",
133
+ "v2-question-row__desc": "_v2-question-row__desc_1tvkz_917",
134
+ "v2-question-row__cluster-badge": "_v2-question-row__cluster-badge_1tvkz_920",
135
+ "v2-question-row__type-text": "_v2-question-row__type-text_1tvkz_924",
136
+ "v2-question-row__top": "_v2-question-row__top_1tvkz_927",
137
+ "v2-question-row__left": "_v2-question-row__left_1tvkz_933",
138
+ "v2-question-row__head-row": "_v2-question-row__head-row_1tvkz_937",
139
+ "v2-question-row__checkbox-label": "_v2-question-row__checkbox-label_1tvkz_948",
140
+ "v2-question-row__checkbox-text": "_v2-question-row__checkbox-text_1tvkz_954",
141
+ "v2-question-row__checkbox": "_v2-question-row__checkbox_1tvkz_948",
142
+ "v2-question-row__enabled-text": "_v2-question-row__enabled-text_1tvkz_965",
143
+ "v2-question-row__enabled-text--active": "_v2-question-row__enabled-text--active_1tvkz_970",
144
+ "v2-question-row__enabled-text--disabled": "_v2-question-row__enabled-text--disabled_1tvkz_973",
145
+ "v2-question-row__right": "_v2-question-row__right_1tvkz_982",
146
+ "v2-question-row__actions": "_v2-question-row__actions_1tvkz_1003",
147
+ "v2-question-row__btn-action": "_v2-question-row__btn-action_1tvkz_1007",
148
+ "v2-question-row__btn-action--active": "_v2-question-row__btn-action--active_1tvkz_1022",
149
+ "v2-question-form": "_v2-question-form_1tvkz_1027",
150
+ "v2-question-form__field": "_v2-question-form__field_1tvkz_1035",
151
+ "v2-question-form__label": "_v2-question-form__label_1tvkz_1040",
152
+ "v2-question-form__label--spaced": "_v2-question-form__label--spaced_1tvkz_1047",
153
+ "v2-question-form__input": "_v2-question-form__input_1tvkz_1050",
154
+ "v2-question-form__hint": "_v2-question-form__hint_1tvkz_1069",
155
+ "v2-question-form__descriptors-grid": "_v2-question-form__descriptors-grid_1tvkz_1075",
156
+ "v2-question-form__descriptor-item": "_v2-question-form__descriptor-item_1tvkz_1080",
157
+ "v2-question-form__descriptor-num": "_v2-question-form__descriptor-num_1tvkz_1085",
158
+ "v2-question-form__descriptor-input": "_v2-question-form__descriptor-input_1tvkz_1090",
159
+ "v2-question-form__meta-row": "_v2-question-form__meta-row_1tvkz_1105",
160
+ "v2-question-form__select-label": "_v2-question-form__select-label_1tvkz_1112",
161
+ "v2-question-form__select": "_v2-question-form__select_1tvkz_1112",
162
+ "v2-question-form__actions": "_v2-question-form__actions_1tvkz_1133",
163
+ "v2-question-form__btn-cancel": "_v2-question-form__btn-cancel_1tvkz_1142",
164
+ "v2-question-form__btn-save": "_v2-question-form__btn-save_1tvkz_1155",
165
+ "v2-dates-list": "_v2-dates-list_1tvkz_1174",
166
+ "v2-date-row": "_v2-date-row_1tvkz_1180",
167
+ "v2-date-row--past": "_v2-date-row--past_1tvkz_1185",
168
+ "v2-date-row__idx": "_v2-date-row__idx_1tvkz_1188",
169
+ "v2-date-row__idx--past": "_v2-date-row__idx--past_1tvkz_1200",
170
+ "v2-date-row__past-badge": "_v2-date-row__past-badge_1tvkz_1204",
171
+ "v2-date-row__btn-remove": "_v2-date-row__btn-remove_1tvkz_1230",
172
+ "v2-saved-wrapper": "_v2-saved-wrapper_1tvkz_1248",
173
+ "v2-saved-card": "_v2-saved-card_1tvkz_1257",
174
+ "v2-saved-badge": "_v2-saved-badge_1tvkz_1284",
175
+ "v2-saved-title": "_v2-saved-title_1tvkz_1301",
176
+ "v2-saved-desc": "_v2-saved-desc_1tvkz_1315",
177
+ "v2-saved-list": "_v2-saved-list_1tvkz_1336",
178
+ "v2-saved-item": "_v2-saved-item_1tvkz_1343",
179
+ "v2-saved-item__icon": "_v2-saved-item__icon_1tvkz_1359",
180
+ "v2-saved-item__icon--routine": "_v2-saved-item__icon--routine_1tvkz_1367",
181
+ "v2-saved-item__icon--comprehensive": "_v2-saved-item__icon--comprehensive_1tvkz_1370",
182
+ "v2-saved-item__icon--oneoff": "_v2-saved-item__icon--oneoff_1tvkz_1373",
183
+ "v2-saved-item__info": "_v2-saved-item__info_1tvkz_1376",
184
+ "v2-saved-item__title": "_v2-saved-item__title_1tvkz_1380",
185
+ "v2-saved-item__sub": "_v2-saved-item__sub_1tvkz_1387",
186
+ "v2-saved-item__actions": "_v2-saved-item__actions_1tvkz_1401",
187
+ "v2-saved-item__switch-box": "_v2-saved-item__switch-box_1tvkz_1407",
188
+ "v2-saved-item__switch": "_v2-saved-item__switch_1tvkz_1407",
189
+ "v2-saved-item__switch--on": "_v2-saved-item__switch--on_1tvkz_1427",
190
+ "v2-saved-item__knob": "_v2-saved-item__knob_1tvkz_1430",
191
+ "v2-saved-item__knob--on": "_v2-saved-item__knob--on_1tvkz_1441",
192
+ "v2-saved-item__btn-edit": "_v2-saved-item__btn-edit_1tvkz_1444",
193
+ "v2-saved-loading-wrap": "_v2-saved-loading-wrap_1tvkz_1481",
194
+ "v2-saved-loading-wrap__text": "_v2-saved-loading-wrap__text_1tvkz_1488",
195
+ "v2-saved-retry-btn": "_v2-saved-retry-btn_1tvkz_1493",
196
+ "v2-saved-item-loading": "_v2-saved-item-loading_1tvkz_1504",
197
+ "v2-saved-item-loading__text": "_v2-saved-item-loading__text_1tvkz_1509",
198
+ "v2-saved-item-spinner": "_v2-saved-item-spinner_1tvkz_1514",
199
+ "v2-saved-item-dash": "_v2-saved-item-dash_1tvkz_1522",
200
+ "v2-saved-btn-dashboard": "_v2-saved-btn-dashboard_1tvkz_1527",
201
+ "v2-oneoff-container": "_v2-oneoff-container_1tvkz_1553",
202
+ "v2-oneoff-accordion": "_v2-oneoff-accordion_1tvkz_1560",
203
+ "v2-oneoff-accordion__header": "_v2-oneoff-accordion__header_1tvkz_1566",
204
+ "v2-oneoff-accordion__icon-box": "_v2-oneoff-accordion__icon-box_1tvkz_1581",
205
+ "v2-oneoff-accordion__title-group": "_v2-oneoff-accordion__title-group_1tvkz_1590",
206
+ "v2-oneoff-accordion__title": "_v2-oneoff-accordion__title_1tvkz_1590",
207
+ "v2-oneoff-accordion__subtitle": "_v2-oneoff-accordion__subtitle_1tvkz_1599",
208
+ "v2-oneoff-accordion__body": "_v2-oneoff-accordion__body_1tvkz_1604",
209
+ "v2-oneoff-accordion__empty": "_v2-oneoff-accordion__empty_1tvkz_1609",
210
+ "v2-oneoff-accordion__item": "_v2-oneoff-accordion__item_1tvkz_1615",
211
+ "v2-oneoff-accordion__item-info": "_v2-oneoff-accordion__item-info_1tvkz_1625",
212
+ "v2-oneoff-accordion__item-name": "_v2-oneoff-accordion__item-name_1tvkz_1629",
213
+ "v2-oneoff-accordion__item-meta": "_v2-oneoff-accordion__item-meta_1tvkz_1634",
214
+ "v2-oneoff-accordion__item-actions": "_v2-oneoff-accordion__item-actions_1tvkz_1639",
215
+ "v2-oneoff-accordion__btn-view": "_v2-oneoff-accordion__btn-view_1tvkz_1644",
216
+ "v2-oneoff-accordion__btn-send-again": "_v2-oneoff-accordion__btn-send-again_1tvkz_1662",
217
+ "v2-name-box": "_v2-name-box_1tvkz_1681",
218
+ "v2-name-box__label": "_v2-name-box__label_1tvkz_1687",
219
+ "v2-name-box__input": "_v2-name-box__input_1tvkz_1694",
220
+ "v2-name-box__hint": "_v2-name-box__hint_1tvkz_1712",
221
+ "v2-sendagain-modal__icon-box": "_v2-sendagain-modal__icon-box_1tvkz_1717",
222
+ "v2-comprehensive-container": "_v2-comprehensive-container_1tvkz_1769",
223
+ "v2-comprehensive-body": "_v2-comprehensive-body_1tvkz_1776",
224
+ "v2-comprehensive-body--disabled": "_v2-comprehensive-body--disabled_1tvkz_1782",
225
+ "v2-comprehensive-date-picker-wrap": "_v2-comprehensive-date-picker-wrap_1tvkz_1787",
226
+ "v2-comprehensive-btn-add-date": "_v2-comprehensive-btn-add-date_1tvkz_1792",
227
+ "v2-comprehensive-note-box": "_v2-comprehensive-note-box_1tvkz_1814",
228
+ "v2-comprehensive-note-box__icon": "_v2-comprehensive-note-box__icon_1tvkz_1824",
229
+ "v2-comprehensive-note-box__text": "_v2-comprehensive-note-box__text_1tvkz_1828",
230
+ "v2-delete-modal-overlay": "_v2-delete-modal-overlay_1tvkz_1841",
231
+ "v2-delete-modal": "_v2-delete-modal_1tvkz_1841",
232
+ "v2-delete-modal__title": "_v2-delete-modal__title_1tvkz_1861",
233
+ "v2-delete-modal__message": "_v2-delete-modal__message_1tvkz_1866",
234
+ "v2-delete-modal__actions": "_v2-delete-modal__actions_1tvkz_1872",
235
+ "v2-delete-modal__btn-cancel": "_v2-delete-modal__btn-cancel_1tvkz_1878",
236
+ "v2-delete-modal__btn-delete": "_v2-delete-modal__btn-delete_1tvkz_1893",
237
+ "v2-restore-modal-overlay": "_v2-restore-modal-overlay_1tvkz_1911",
238
+ "v2-restore-modal": "_v2-restore-modal_1tvkz_1911",
239
+ "v2-restore-modal__icon-box": "_v2-restore-modal__icon-box_1tvkz_1933",
240
+ "v2-restore-modal__title": "_v2-restore-modal__title_1tvkz_1943",
241
+ "v2-restore-modal__message": "_v2-restore-modal__message_1tvkz_1948",
242
+ "v2-restore-modal__actions": "_v2-restore-modal__actions_1tvkz_1954",
243
+ "v2-restore-modal__btn-cancel": "_v2-restore-modal__btn-cancel_1tvkz_1960",
244
+ "v2-restore-modal__btn-confirm": "_v2-restore-modal__btn-confirm_1tvkz_1979",
245
+ "v2-launch-modal-overlay": "_v2-launch-modal-overlay_1tvkz_2004",
246
+ "v2-launch-modal": "_v2-launch-modal_1tvkz_2004",
247
+ "v2-launch-modal__btn-close": "_v2-launch-modal__btn-close_1tvkz_2024",
248
+ "v2-launch-modal__icon-box": "_v2-launch-modal__icon-box_1tvkz_2042",
249
+ "v2-launch-modal__title": "_v2-launch-modal__title_1tvkz_2051",
250
+ "v2-launch-modal__sub": "_v2-launch-modal__sub_1tvkz_2056",
251
+ "v2-launch-modal__form": "_v2-launch-modal__form_1tvkz_2062",
252
+ "v2-launch-modal__field-label": "_v2-launch-modal__field-label_1tvkz_2068",
253
+ "v2-launch-modal__warning-box": "_v2-launch-modal__warning-box_1tvkz_2093",
254
+ "v2-launch-modal__warning-icon": "_v2-launch-modal__warning-icon_1tvkz_2103",
255
+ "v2-launch-modal__warning-text": "_v2-launch-modal__warning-text_1tvkz_2108",
256
+ "v2-launch-modal__actions": "_v2-launch-modal__actions_1tvkz_2114",
257
+ "v2-launch-modal__btn-cancel": "_v2-launch-modal__btn-cancel_1tvkz_2119",
258
+ "v2-launch-modal__btn-start": "_v2-launch-modal__btn-start_1tvkz_2135",
259
+ "v2-launch-modal__btn-start--valid": "_v2-launch-modal__btn-start--valid_1tvkz_2151",
260
+ "v2-view-modal": "_v2-view-modal_1tvkz_2162",
261
+ "v2-view-modal__header": "_v2-view-modal__header_1tvkz_2176",
262
+ "v2-view-modal__btn-close": "_v2-view-modal__btn-close_1tvkz_2185",
263
+ "v2-view-modal__icon-box": "_v2-view-modal__icon-box_1tvkz_2203",
264
+ "v2-view-modal__title-wrap": "_v2-view-modal__title-wrap_1tvkz_2212",
265
+ "v2-view-modal__title": "_v2-view-modal__title_1tvkz_2212",
266
+ "v2-view-modal__meta": "_v2-view-modal__meta_1tvkz_2221",
267
+ "v2-view-modal__body": "_v2-view-modal__body_1tvkz_2226",
268
+ "v2-view-modal__section-label": "_v2-view-modal__section-label_1tvkz_2253",
269
+ "v2-view-modal__sent-section": "_v2-view-modal__sent-section_1tvkz_2262",
270
+ "v2-view-modal__sent-badges-list": "_v2-view-modal__sent-badges-list_1tvkz_2266",
271
+ "v2-view-modal__sent-badge": "_v2-view-modal__sent-badge_1tvkz_2266",
272
+ "v2-view-modal__sent-badge--past": "_v2-view-modal__sent-badge--past_1tvkz_2284",
273
+ "v2-view-modal__sent-badge--future": "_v2-view-modal__sent-badge--future_1tvkz_2289",
274
+ "v2-view-modal__questions-section": "_v2-view-modal__questions-section_1tvkz_2294",
275
+ "v2-view-modal__cluster-group": "_v2-view-modal__cluster-group_1tvkz_2298",
276
+ "v2-view-modal__cluster-header": "_v2-view-modal__cluster-header_1tvkz_2308",
277
+ "v2-view-modal__questions-list": "_v2-view-modal__questions-list_1tvkz_2316",
278
+ "v2-view-modal__question-row": "_v2-view-modal__question-row_1tvkz_2322",
279
+ "v2-view-modal__question-num": "_v2-view-modal__question-num_1tvkz_2332",
280
+ "v2-view-modal__question-text": "_v2-view-modal__question-text_1tvkz_2338",
281
+ "v2-view-modal__empty": "_v2-view-modal__empty_1tvkz_2344",
282
+ "v2-view-modal__footer-single": "_v2-view-modal__footer-single_1tvkz_2350",
283
+ "v2-view-modal__btn-close-footer": "_v2-view-modal__btn-close-footer_1tvkz_2358",
284
+ "v2-review-questions": "_v2-review-questions_1tvkz_2378",
285
+ "v2-review-questions__builder-card": "_v2-review-questions__builder-card_1tvkz_2383",
286
+ "v2-review-questions__builder-card--transparent": "_v2-review-questions__builder-card--transparent_1tvkz_2392",
287
+ "v2-review-questions__reorder-bar": "_v2-review-questions__reorder-bar_1tvkz_2397",
288
+ "v2-review-questions__reorder-hint": "_v2-review-questions__reorder-hint_1tvkz_2405",
289
+ "v2-review-questions__btn-restore": "_v2-review-questions__btn-restore_1tvkz_2409",
290
+ "v2-review-questions__cluster-list": "_v2-review-questions__cluster-list_1tvkz_2427",
291
+ "v2-review-questions__cluster-list--dragging": "_v2-review-questions__cluster-list--dragging_1tvkz_2432",
292
+ "v2-routine-container": "_v2-routine-container_1tvkz_2439",
293
+ "v2-routine-body": "_v2-routine-body_1tvkz_2446",
294
+ "v2-routine-body--disabled": "_v2-routine-body--disabled_1tvkz_2452",
295
+ "v2-snackbar-wrap": "_v2-snackbar-wrap_1tvkz_2460",
296
+ "v2-snackbar-alert": "_v2-snackbar-alert_1tvkz_2464"
297
+ }, Ut = [
298
+ { id: "routine", label: "Routine check-in", icon: /* @__PURE__ */ t(We, { size: 18 }) },
299
+ { id: "comprehensive", label: "Comprehensive check-in", icon: /* @__PURE__ */ t(Ue, { size: 18 }) },
300
+ { id: "oneoff", label: "One-off check-in", icon: /* @__PURE__ */ t(qe, { size: 18 }) }
301
+ ], Ht = ({ activeTab: n, onSelectTab: a }) => /* @__PURE__ */ t("div", { className: e["v2-mode-tabs"], children: Ut.map((o) => {
302
+ const i = n === o.id;
303
+ return /* @__PURE__ */ s(
304
+ "button",
305
+ {
306
+ type: "button",
307
+ onClick: () => a(o.id),
308
+ className: `${e["v2-mode-tabs__btn"]} ${i ? e["v2-mode-tabs__btn--active"] : ""}`,
309
+ children: [
310
+ o.icon,
311
+ /* @__PURE__ */ t("span", { children: o.label })
312
+ ]
313
+ },
314
+ o.id
315
+ );
316
+ }) }), jt = ({ open: n, onClose: a, onDelete: o }) => {
317
+ if (!n) return null;
318
+ const i = /* @__PURE__ */ t(
319
+ "div",
320
+ {
321
+ onClick: a,
322
+ className: e["v2-delete-modal-overlay"],
323
+ children: /* @__PURE__ */ s(
324
+ "div",
325
+ {
326
+ onClick: (l) => l.stopPropagation(),
327
+ className: e["v2-delete-modal"],
328
+ children: [
329
+ /* @__PURE__ */ t("div", { className: e["v2-delete-modal__title"], children: "Delete question?" }),
330
+ /* @__PURE__ */ t("p", { className: e["v2-delete-modal__message"], children: "Are you sure you want to remove this question?" }),
331
+ /* @__PURE__ */ s("div", { className: e["v2-delete-modal__actions"], children: [
332
+ /* @__PURE__ */ t(
333
+ "button",
334
+ {
335
+ type: "button",
336
+ onClick: a,
337
+ className: e["v2-delete-modal__btn-cancel"],
338
+ children: "Cancel"
339
+ }
340
+ ),
341
+ /* @__PURE__ */ t(
342
+ "button",
343
+ {
344
+ type: "button",
345
+ onClick: o,
346
+ className: e["v2-delete-modal__btn-delete"],
347
+ children: "Delete"
348
+ }
349
+ )
350
+ ] })
351
+ ]
352
+ }
353
+ )
354
+ }
355
+ );
356
+ return typeof document < "u" ? et.createPortal(i, document.body) : i;
357
+ }, fe = [], D = (n, a = "success") => {
358
+ fe.forEach((o) => o({ open: !0, message: n, severity: a }));
359
+ }, Kt = (n) => (fe.push(n), () => {
360
+ const a = fe.indexOf(n);
361
+ a >= 0 && fe.splice(a, 1);
362
+ }), S = "YYYY-MM-DD", Gt = "MMM DD, YYYY", be = "MMMM DD, YYYY", Jt = "Your comprehensive well-being check-in is coming", Xt = "Hi Educator, the comprehensive check-in is coming up. Take some time to answer the full set of questions about your well-being. Your voice helps shape the support we provide.", Zt = ["Strongly disagree", "Disagree", "Neutral", "Agree", "Strongly agree"], en = 4e3, tn = [
363
+ { id: "weekly", title: "Weekly", sub: "Every 7 days" },
364
+ { id: "biweekly", title: "Bi-weekly", sub: "Every 14 days", rec: !0 },
365
+ { id: "monthly", title: "Monthly", sub: "Every 30 days" }
366
+ ], nn = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], sn = [
367
+ ["Week 1", "Physical well-being", "4 questions"],
368
+ ["Week 2", "Emotional well-being", "4 questions"],
369
+ ["Week 3", "Environmental well-being", "4 questions"]
370
+ ], ie = [
371
+ { id: 1, name: "Physical", label: "Physical well-being", icon: "Dumbbell", order: 1, kind: "indicator", questions: [] },
372
+ { id: 2, name: "Emotional", label: "Emotional well-being", icon: "Heart", order: 2, kind: "indicator", questions: [] },
373
+ { id: 3, name: "Environmental", label: "Environmental well-being", icon: "Leaf", order: 3, kind: "indicator", questions: [] },
374
+ { id: 4, name: "Spiritual", label: "Spiritual well-being", icon: "Sparkles", order: 4, kind: "indicator", questions: [] },
375
+ { id: 5, name: "Social", label: "Social (relationships) well-being", icon: "Users", order: 5, kind: "indicator", questions: [] },
376
+ { id: 6, name: "Intellectual", label: "Intellectual well-being", icon: "Brain", order: 6, kind: "indicator", questions: [] },
377
+ { id: 7, name: "Open", label: "Open field well-being", icon: "PenLine", order: 7, kind: "open", questions: [] }
378
+ ], ye = {
379
+ routine: {
380
+ isEnabled: !1,
381
+ frequency: "biweekly",
382
+ dayOfWeek: "Monday",
383
+ emailNotify: !1
384
+ },
385
+ comprehensive: {
386
+ isEnabled: !1,
387
+ frequency: "quarterly",
388
+ sendDates: [],
389
+ durationDays: 14,
390
+ emailNotify: !1
391
+ },
392
+ pastOneOffs: []
393
+ }, Me = (n) => n ? n.replace(/&rsquo;/g, "'").replace(/&lsquo;/g, "'").replace(/&rdquo;/g, '"').replace(/&ldquo;/g, '"').replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&amp;/g, "&").replace(/&nbsp;/g, " ") : "", nt = (n) => {
394
+ const a = Me(n), o = a.indexOf(":"), i = o >= 0 ? a.slice(0, o).trim() : a, l = o >= 0 ? a.slice(o + 1).trim() : "";
395
+ return { title: i, desc: l };
396
+ }, on = (n, a, o, i) => {
397
+ const l = a.find((v) => v.id === o);
398
+ if (n)
399
+ return l?.name || "Cluster";
400
+ if (!!i.includedInBulk) return "All clusters";
401
+ const c = i.clusterId ? a.find((v) => String(v.id) === String(i.clusterId)) : null;
402
+ return c ? c.label || c.name : l?.name || "Open field";
403
+ }, _e = (n) => n && n.length === 5 ? [...n] : [...Zt], an = (n, a) => {
404
+ const o = (n || a || "").trim(), i = o.toLowerCase();
405
+ return i.startsWith("open") ? "Open field well-being" : i.startsWith("social") ? "Social (relationships) well-being" : i.includes("well-being") ? o : `${o} well-being`;
406
+ }, rn = (n = [], a = []) => {
407
+ const o = new Set(a.map((i) => i.text));
408
+ return n.filter((i) => !o.has(i.text));
409
+ }, ln = (n) => {
410
+ const a = n.filter((i) => i.kind !== "open" && !i.name.toLowerCase().includes("open")), o = n.find((i) => i.kind === "open" || i.name.toLowerCase().includes("open"));
411
+ return { draggableClusters: a, openCluster: o };
412
+ }, cn = (n, a, o, i) => n.map((l) => {
413
+ if (l.id === a) {
414
+ const d = [...l.questions];
415
+ return d[o] = i, { ...l, questions: d };
416
+ }
417
+ return l;
418
+ }), dn = (n, a, o) => n.map((i) => {
419
+ if (i.id === a) {
420
+ const l = [...i.questions];
421
+ return l.splice(o, 1), { ...i, questions: l };
422
+ }
423
+ return i;
424
+ }), Pe = (n, a, o) => n.map((i) => i.id === a ? {
425
+ ...i,
426
+ questions: [...i.questions || [], o]
427
+ } : i), _n = (n, a, o, i) => {
428
+ let l = null;
429
+ const d = n.map((c) => {
430
+ if (c.id === a) {
431
+ const v = [...c.questions];
432
+ return l = { ...v[o], clusterId: i }, v.splice(o, 1), { ...c, questions: v };
433
+ }
434
+ return c;
435
+ });
436
+ return l ? d.map((c) => c.id === i ? {
437
+ ...c,
438
+ questions: [...c.questions || [], l]
439
+ } : c) : n;
440
+ }, vn = (n, a = "biweekly") => {
441
+ const o = !n.isEnabled;
442
+ return {
443
+ ...n,
444
+ isEnabled: o,
445
+ frequency: o && (!n.frequency || n.frequency === "monthly") ? a : n.frequency || a
446
+ };
447
+ }, un = (n) => n === "biweekly" ? "two weeks" : n === "monthly" ? "month" : "week", mn = (n, a) => {
448
+ if (!n.isEnabled) return "Paused — no check-ins are being sent";
449
+ const o = n.frequency === "weekly" ? "Weekly (every 7 days)" : n.frequency === "monthly" ? "Monthly (every 30 days)" : "Bi-weekly (every 14 days)", i = a && p(a, S).isValid() ? ` · Starts ${p(a, S).format("MMM D, YYYY")}` : "";
450
+ return `Per cluster · ${o}${i}`;
451
+ }, hn = (n, a) => {
452
+ if (!n.isEnabled) return "Paused — no check-ins are being sent";
453
+ const o = n.frequency === "yearly" ? "Yearly (once a year)" : n.frequency === "semesterly" ? "Semesterly (every ~6 months)" : n.frequency === "monthly" ? "Monthly (every 30 days)" : "Quarterly (every term (~3 months))", i = a && p(a, S).isValid() ? ` · First launch ${p(a, S).format("MMM D, YYYY")}` : "";
454
+ return `Comprehensive · ${o}${i}`;
455
+ }, fn = (n) => n.routine?.isEnabled && n.routineLaunchDate && p(n.routineLaunchDate, S).isValid() ? p(n.routineLaunchDate, S).format("dddd, MMMM D, YYYY") : n.comprehensive?.isEnabled && n.comprehensiveLaunchDate && p(n.comprehensiveLaunchDate, S).isValid() ? p(n.comprehensiveLaunchDate, S).format("dddd, MMMM D, YYYY") : n.launchDate && p(n.launchDate, S).isValid() ? p(n.launchDate, S).format("dddd, MMMM D, YYYY") : "Monday, September 7, 2026", bn = (n) => {
456
+ const a = /* @__PURE__ */ new Set();
457
+ return n && (n.sentDate && p(n.sentDate, S).isValid() && a.add(p(n.sentDate, S).format(S)), n.sendDates && Array.isArray(n.sendDates) && n.sendDates.forEach((o) => {
458
+ o && p(o, S).isValid() && a.add(p(o, S).format(S));
459
+ })), a;
460
+ }, pn = (n) => {
461
+ if (!n) return [];
462
+ const a = [];
463
+ return n.sendDates && Array.isArray(n.sendDates) && n.sendDates.length > 0 ? n.sendDates.forEach((o) => {
464
+ o && !a.includes(o) && a.push(o);
465
+ }) : n.sentDate && a.push(n.sentDate), xe(a);
466
+ }, kn = (n) => n == null ? "" : typeof n == "object" ? String(n.id || n.Id || n.questionId || n.QuestionId || n.value || "") : String(n).trim(), wn = (n, a = []) => {
467
+ const o = (a || []).flatMap((u) => u.questions || []);
468
+ let i = [];
469
+ if (n.questions && n.questions.length > 0)
470
+ i = n.questions;
471
+ else {
472
+ const u = new Set(
473
+ (n.questionIds || []).map(kn).filter(Boolean)
474
+ );
475
+ if (i = o.filter((h) => u.has(String(h.id))), i.length === 0 && u.size > 0 && (i = Array.from(u).map((h) => {
476
+ const _ = Number(h);
477
+ if (!isNaN(_)) {
478
+ if (o[_ - 1]) return o[_ - 1];
479
+ if (o[_]) return o[_];
480
+ }
481
+ return null;
482
+ }).filter(Boolean)), i.length === 0 && (n.questionCount > 0 || u.size > 0) && o.length > 0) {
483
+ const h = n.questionCount > 0 ? Math.min(n.questionCount, o.length) : Math.min(u.size, o.length);
484
+ i = o.slice(0, h);
485
+ }
486
+ }
487
+ const l = i.filter((u) => u.kind !== "open"), d = i.filter((u) => u.kind === "open"), c = [], v = (a || []).filter((u) => u.kind !== "open");
488
+ for (const u of v) {
489
+ const h = l.filter(
490
+ (C) => String(C.clusterId) === String(u.id)
491
+ ), _ = d.filter(
492
+ (C) => !C.isAppliedToAllClusters && C.clusterId && C.clusterId !== 999 && String(C.clusterId) === String(u.id)
493
+ ), w = h.length > 0 || _.length > 0 ? d.filter((C) => C.isAppliedToAllClusters) : [], q = [...h, ..._, ...w];
494
+ q.length > 0 && c.push({
495
+ cluster: u,
496
+ questions: q
497
+ });
498
+ }
499
+ const k = (a || []).find((u) => u.kind === "open");
500
+ if (k && d.length > 0) {
501
+ const u = new Set(c.flatMap((_) => _.questions.map((w) => String(w.id)))), h = d.filter((_) => !u.has(String(_.id)));
502
+ (h.length > 0 || c.length === 0) && c.push({
503
+ cluster: k,
504
+ questions: h.length > 0 ? h : d
505
+ });
506
+ }
507
+ if (c.length === 0 && i.length > 0) {
508
+ const u = /* @__PURE__ */ new Map();
509
+ i.forEach((h) => {
510
+ const _ = h.clusterId || 1;
511
+ u.has(_) || u.set(_, []), u.get(_).push(h);
512
+ }), u.forEach((h, _) => {
513
+ const w = (a || []).find((q) => String(q.id) === String(_)) || {
514
+ id: Number(_) || 1,
515
+ name: "Well-being Cluster",
516
+ label: "Well-being Cluster",
517
+ icon: "dumbbell",
518
+ order: 1,
519
+ kind: "indicator",
520
+ questions: []
521
+ };
522
+ c.push({
523
+ cluster: w,
524
+ questions: h
525
+ });
526
+ });
527
+ }
528
+ return c;
529
+ }, Ne = (n) => {
530
+ if (!n) return "";
531
+ try {
532
+ return (/* @__PURE__ */ new Date(n + (n.includes("T") ? "" : "T00:00:00"))).toLocaleDateString("en-US", {
533
+ month: "short",
534
+ day: "numeric",
535
+ year: "numeric"
536
+ });
537
+ } catch {
538
+ return n;
539
+ }
540
+ }, st = (n) => n.reduce((a, o) => a + (o.questions?.length || 0), 0), ot = (n) => n.questions && n.questions.length > 0 ? n.questions.length : n.questionCount ? n.questionCount : n.questionIds && n.questionIds.length > 0 ? n.questionIds.length : 0, gn = (n) => Array.from(
541
+ /* @__PURE__ */ new Set([
542
+ ...n.sendDates || [],
543
+ ...n.sentDate ? [n.sentDate] : []
544
+ ])
545
+ ).filter(Boolean).sort((i, l) => p(i, S).valueOf() - p(l, S).valueOf()).map((i) => Ne(i)).join(", ") || Ne(n.sentDate), xe = (n) => [...n].sort((a, o) => a ? o ? p(a, "YYYY-MM-DD").valueOf() - p(o, "YYYY-MM-DD").valueOf() : -1 : 1), at = (n) => !n || !p(n, "YYYY-MM-DD").isValid() ? !1 : p(n, "YYYY-MM-DD").isBefore(p().startOf("day")), ze = (n, a = S) => !!(n && p(n, a).isValid()), yn = (n, a = S) => ze(n, a) ? p(n, a) : null, Nn = (n = "weekly", a = !1, o, i) => {
546
+ const l = a ? "comprehensive" : n === "biweekly" ? "weekly" : n === "monthly" ? "monthly" : "weekly", d = a ? "this term" : n === "monthly" ? "this month" : "this week", c = o || (a ? Jt : `Time for your ${l} well-being check-in`), v = i || (a ? Xt : `Hi Educator, take care of yourself and complete ${d}'s check-in for Physical well-being. It only takes a couple of minutes, and your responses help us support you.`);
547
+ return { title: c, body: v };
548
+ }, xn = (n, a, o) => {
549
+ if (n === "routine") {
550
+ const l = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"].findIndex((k) => k.toLowerCase() === a.dayOfWeek?.toLowerCase());
551
+ if (l === -1) return p().format(S);
552
+ const d = p().startOf("day"), c = d.day(), v = (l - c + 7) % 7;
553
+ return d.add(v, "days").format(S);
554
+ }
555
+ if (n === "comprehensive") {
556
+ const l = [...(o.sendDates || []).filter((c) => c && p(c, S).isValid())].sort((c, v) => p(c).valueOf() - p(v).valueOf()), d = l.filter((c) => !p(c, S).isBefore(p().startOf("day")));
557
+ return d.length > 0 ? d[0] : l.length > 0 ? l[0] : p().format(S);
558
+ }
559
+ }, zn = (n, a, o) => {
560
+ if (a !== "comprehensive" || !n || !p(n, S).isValid())
561
+ return null;
562
+ const l = [...(o || []).filter((u) => u && p(u, S).isValid())].sort((u, h) => p(u).valueOf() - p(h).valueOf()), d = l.filter((u) => !p(u, S).isBefore(p().startOf("day"))), c = d.length > 0 ? d[0] : l.length > 0 ? l[0] : null;
563
+ if (!c || n === c)
564
+ return null;
565
+ const v = l.includes(n), k = p(n).isBefore(p(c));
566
+ if (!v && k) {
567
+ const u = [...l, n].sort((h, _) => p(h).valueOf() - p(_).valueOf());
568
+ return {
569
+ type: "earlier_than_scheduled",
570
+ message: `The date you selected (${p(n).format("MMMM D, YYYY")}) is earlier than your first scheduled check-in date (${p(c).format("MMMM D, YYYY")}). It will become the new first check-in date.`,
571
+ updatedSendDates: u
572
+ };
573
+ }
574
+ if (!k) {
575
+ const h = d.filter((w) => p(w).isBefore(p(n))).map((w) => p(w).format("MMMM D, YYYY")).join(", "), _ = v ? o : [...l, n].sort((w, q) => p(w).valueOf() - p(q).valueOf());
576
+ return {
577
+ type: "skipping_dates",
578
+ message: `${p(n).format("MMMM D, YYYY")} will be the first comprehensive check-in date sent to teachers.${h ? ` The scheduled date(s): ${h} will not be sent.` : ""}`,
579
+ updatedSendDates: _
580
+ };
581
+ }
582
+ return null;
583
+ }, qn = ({
584
+ item: n,
585
+ kind: a,
586
+ clusterId: o,
587
+ clusters: i,
588
+ onChange: l,
589
+ onMove: d,
590
+ onDelete: c,
591
+ isOneOff: v = !1,
592
+ scope: k
593
+ }) => {
594
+ const [u, h] = N(!1), [_, w] = N(!1), [q, C] = N(!1), I = a !== "open", z = i.find((f) => f.kind === "open") || { id: 999 }, B = () => I ? o : n.isAppliedToAllClusters || n.includedInBulk || !n.clusterId ? z.id : Number(n.clusterId), R = () => I ? !1 : !!n.includedInBulk, [L, F] = N(n.text), [A, X] = N(
595
+ _e(n.descriptors)
596
+ ), [T, Q] = N(B()), [H, W] = N(R()), j = Me(n.text), { title: Y, desc: P } = nt(n.text), G = i.find((f) => f.id === o), J = on(I, i, o, n), U = I ? "Scale 1–5" : "Open text", m = n.isEnabled !== !1, b = () => {
597
+ F(j), X(_e(n.descriptors)), Q(B()), W(!!n.includedInBulk), h(!0);
598
+ }, $ = () => {
599
+ h(!1);
600
+ }, O = (f) => {
601
+ Q(f), I || (f !== z.id ? W(!1) : W(!0));
602
+ }, E = (f) => {
603
+ W(f), f && Q(z.id);
604
+ }, K = async () => {
605
+ if (L.trim())
606
+ if (I) {
607
+ const f = {
608
+ ...n,
609
+ text: L.trim(),
610
+ descriptors: A,
611
+ clusterId: T
612
+ };
613
+ if (l(f), T !== o && d(T), h(!1), n.id && typeof n.id == "number")
614
+ try {
615
+ C(!0), await Ye(n.id, {
616
+ text: L.trim(),
617
+ clusterId: T,
618
+ descriptors: A
619
+ }), D("Question updated successfully", "success");
620
+ } catch (M) {
621
+ console.error("Failed to update question via API", M), D("Failed to update question", "error");
622
+ } finally {
623
+ C(!1);
624
+ }
625
+ } else {
626
+ const f = H, M = T !== z.id, V = M ? T : null, re = {
627
+ ...n,
628
+ text: L.trim(),
629
+ descriptors: null,
630
+ includedInBulk: f,
631
+ isAppliedToAllClusters: f,
632
+ clusterId: V,
633
+ sectionName: f ? "All clusters" : M ? i.find((te) => String(te.id) === String(V))?.name || "Cluster" : G?.name || "Open field"
634
+ };
635
+ if (l(re), h(!1), n.id && typeof n.id == "number")
636
+ try {
637
+ C(!0), await Ye(n.id, {
638
+ text: L.trim(),
639
+ clusterId: V,
640
+ descriptors: null,
641
+ isAppliedToAllClusters: f,
642
+ includedInBulk: f
643
+ }), D("Question updated successfully", "success");
644
+ } catch (te) {
645
+ console.error("Failed to update question via API", te), D("Failed to update question", "error");
646
+ } finally {
647
+ C(!1);
648
+ }
649
+ }
650
+ }, ee = async (f) => {
651
+ if (l({ ...n, isEnabled: f }), n.id && typeof n.id == "number")
652
+ try {
653
+ await Mt(n.id, f, k), D(f ? "Question enabled" : "Question disabled", "success");
654
+ } catch (M) {
655
+ console.error("Failed to toggle question status via API", M), D("Failed to update question status", "error");
656
+ }
657
+ }, ae = async () => {
658
+ if (c(), w(!1), n.id && typeof n.id == "number")
659
+ try {
660
+ await $t(n.id), D("Question removed from cluster", "success");
661
+ } catch (f) {
662
+ console.error("Failed to delete question via API", f), D("Failed to remove question", "error");
663
+ }
664
+ }, g = (f, M) => {
665
+ const V = [...A];
666
+ V[f] = M, X(V);
667
+ };
668
+ return /* @__PURE__ */ s("div", { className: `${e["v2-question-row"]} ${m ? "" : e["v2-question-row--disabled"]}`, children: [
669
+ /* @__PURE__ */ s("div", { className: e["v2-question-row__top"], children: [
670
+ /* @__PURE__ */ s("div", { className: e["v2-question-row__left"], children: [
671
+ /* @__PURE__ */ s("div", { className: e["v2-question-row__head-row"], children: [
672
+ /* @__PURE__ */ t("span", { className: e["v2-question-row__title"], children: Y || "Untitled question" }),
673
+ /* @__PURE__ */ s("label", { className: e["v2-question-row__checkbox-label"], children: [
674
+ /* @__PURE__ */ t(
675
+ "input",
676
+ {
677
+ type: "checkbox",
678
+ checked: m,
679
+ onChange: (f) => ee(f.target.checked),
680
+ className: e["v2-question-row__checkbox"]
681
+ }
682
+ ),
683
+ /* @__PURE__ */ t("span", { className: `${e["v2-question-row__enabled-text"]} ${m ? e["v2-question-row__enabled-text--active"] : e["v2-question-row__enabled-text--disabled"]}`, children: m ? "Enabled" : "Disabled" })
684
+ ] })
685
+ ] }),
686
+ P && /* @__PURE__ */ t("div", { className: e["v2-question-row__desc"], children: P })
687
+ ] }),
688
+ /* @__PURE__ */ s("div", { className: e["v2-question-row__right"], children: [
689
+ k !== "comprehensive" && /* @__PURE__ */ t("span", { className: e["v2-question-row__cluster-badge"], children: J }),
690
+ /* @__PURE__ */ t("span", { className: e["v2-question-row__type-text"], children: U }),
691
+ /* @__PURE__ */ s("div", { className: e["v2-question-row__actions"], children: [
692
+ /* @__PURE__ */ t(
693
+ "button",
694
+ {
695
+ type: "button",
696
+ onClick: () => u ? $() : b(),
697
+ title: "Edit question",
698
+ className: `${e["v2-question-row__btn-action"]} ${u ? e["v2-question-row__btn-action--active"] : ""}`,
699
+ children: u ? /* @__PURE__ */ t(Te, { size: 16, color: "#316CD9" }) : /* @__PURE__ */ t(Ce, { size: 16, color: "#316CD9" })
700
+ }
701
+ ),
702
+ /* @__PURE__ */ t(
703
+ "button",
704
+ {
705
+ type: "button",
706
+ onClick: () => {
707
+ v ? (c(), D("Question returned to question bank", "info")) : w(!0);
708
+ },
709
+ title: v ? "Remove question (returns to bank)" : "Delete question",
710
+ className: e["v2-question-row__btn-action"],
711
+ children: /* @__PURE__ */ t(He, { size: 16, color: "#C44140" })
712
+ }
713
+ )
714
+ ] })
715
+ ] })
716
+ ] }),
717
+ u && /* @__PURE__ */ s("div", { className: e["v2-question-form"], children: [
718
+ /* @__PURE__ */ s("label", { className: e["v2-question-form__field"], children: [
719
+ /* @__PURE__ */ t("span", { className: e["v2-question-form__label"], children: "QUESTION TEXT" }),
720
+ /* @__PURE__ */ t(
721
+ "input",
722
+ {
723
+ value: L,
724
+ onChange: (f) => F(f.target.value),
725
+ placeholder: "Short title: full question?",
726
+ className: e["v2-question-form__input"]
727
+ }
728
+ ),
729
+ /* @__PURE__ */ t("span", { className: e["v2-question-form__hint"], children: "Format as “Short title: full question?” — the title shows bold and the rest becomes the prompt." })
730
+ ] }),
731
+ I && /* @__PURE__ */ s("div", { children: [
732
+ /* @__PURE__ */ t("div", { className: `${e["v2-question-form__label"]} ${e["v2-question-form__label--spaced"]}`, children: "LINKED DESCRIPTORS (SCORE 1 ➜ 5)" }),
733
+ /* @__PURE__ */ t("div", { className: e["v2-question-form__descriptors-grid"], children: A.map((f, M) => /* @__PURE__ */ s("label", { className: e["v2-question-form__descriptor-item"], children: [
734
+ /* @__PURE__ */ t("span", { className: e["v2-question-form__descriptor-num"], children: M + 1 }),
735
+ /* @__PURE__ */ t(
736
+ "input",
737
+ {
738
+ value: f,
739
+ onChange: (V) => g(M, V.target.value),
740
+ className: e["v2-question-form__descriptor-input"]
741
+ }
742
+ )
743
+ ] }, M)) })
744
+ ] }),
745
+ !I && k !== "comprehensive" && /* @__PURE__ */ s("div", { className: e["v2-question-form__meta-row"], children: [
746
+ /* @__PURE__ */ s("label", { className: e["v2-question-form__select-label"], children: [
747
+ /* @__PURE__ */ t("span", { children: "Well-being cluster" }),
748
+ /* @__PURE__ */ t(
749
+ "select",
750
+ {
751
+ value: T,
752
+ onChange: (f) => O(Number(f.target.value)),
753
+ className: e["v2-question-form__select"],
754
+ children: i.map((f) => {
755
+ const M = f.kind === "open" ? "Open field" : f.label || f.name;
756
+ return /* @__PURE__ */ t("option", { value: f.id, children: M }, f.id);
757
+ })
758
+ }
759
+ )
760
+ ] }),
761
+ /* @__PURE__ */ s("label", { className: e["v2-question-row__checkbox-label"], children: [
762
+ /* @__PURE__ */ t(
763
+ "input",
764
+ {
765
+ type: "checkbox",
766
+ checked: H,
767
+ onChange: (f) => E(f.target.checked),
768
+ className: e["v2-question-row__checkbox"]
769
+ }
770
+ ),
771
+ /* @__PURE__ */ t("span", { className: e["v2-question-row__checkbox-text"], children: "Include in bulk check-in" })
772
+ ] })
773
+ ] }),
774
+ /* @__PURE__ */ s("div", { className: e["v2-question-form__actions"], children: [
775
+ /* @__PURE__ */ t(
776
+ "button",
777
+ {
778
+ type: "button",
779
+ onClick: $,
780
+ className: e["v2-question-form__btn-cancel"],
781
+ children: "Cancel"
782
+ }
783
+ ),
784
+ /* @__PURE__ */ t(
785
+ "button",
786
+ {
787
+ type: "button",
788
+ onClick: K,
789
+ disabled: !L.trim() || q,
790
+ className: e["v2-question-form__btn-save"],
791
+ children: q ? "Saving..." : "Save Question"
792
+ }
793
+ )
794
+ ] })
795
+ ] }),
796
+ /* @__PURE__ */ t(
797
+ jt,
798
+ {
799
+ open: _,
800
+ onClose: () => w(!1),
801
+ onDelete: ae
802
+ }
803
+ )
804
+ ] });
805
+ }, it = ({
806
+ cluster: n,
807
+ clusterIndex: a,
808
+ clusters: o,
809
+ onUpdateQuestion: i,
810
+ onDeleteQuestion: l,
811
+ onAddQuestion: d,
812
+ onMoveQuestion: c,
813
+ bankQuestions: v,
814
+ onAddFromBank: k,
815
+ isDraggable: u = !1,
816
+ dragHandleProps: h,
817
+ cardRef: _,
818
+ cardStyle: w,
819
+ isCollapsed: q = !1,
820
+ isOneOff: C = !1,
821
+ scope: I,
822
+ isBankOpen: z,
823
+ onToggleBank: B
824
+ }) => {
825
+ const [R, L] = N(!1), F = z !== void 0 ? z : R, A = (g) => {
826
+ B ? B(g) : L((f) => !f);
827
+ }, [X, T] = N(!1), [Q, H] = N(""), [W, j] = N(_e()), Y = o.find((g) => g.kind === "open") || { id: 999 }, [P, G] = N(Y.id), [J, U] = N(!0), m = n.questions || [], b = n.kind !== "open", $ = (g) => {
828
+ G(g), b || (g !== Y.id ? U(!1) : U(!0));
829
+ }, O = (g) => {
830
+ U(g), g && G(Y.id);
831
+ }, E = rn(v, m), K = b ? 0 : m.filter((g) => g.includedInBulk).length, ee = async () => {
832
+ const g = b ? !1 : J, f = !b && P !== Y.id, M = b ? n.id : f ? P : null;
833
+ let V = Date.now();
834
+ try {
835
+ const te = await Bt({
836
+ text: Q.trim(),
837
+ clusterId: M,
838
+ descriptors: b ? W : null,
839
+ kind: n.kind,
840
+ scope: I || null,
841
+ isAppliedToAllClusters: b ? void 0 : g,
842
+ includedInBulk: b ? void 0 : g
843
+ });
844
+ te?.data?.id && (V = te.data.id), D("Custom question created successfully", "success");
845
+ } catch (te) {
846
+ console.error("Failed to create question via API", te), D("Failed to create custom question", "error");
847
+ }
848
+ const re = {
849
+ id: V,
850
+ text: Q.trim(),
851
+ isEnabled: !0,
852
+ clusterId: M,
853
+ kind: n.kind,
854
+ scope: I || null,
855
+ descriptors: b ? W : null,
856
+ includedInBulk: b ? void 0 : g,
857
+ isAppliedToAllClusters: b ? void 0 : g,
858
+ sectionName: b ? void 0 : g ? "All clusters" : f ? o.find((te) => String(te.id) === String(M))?.name || "Cluster" : n.name || "Open field"
859
+ };
860
+ d(re), H(""), j(_e()), G(Y.id), U(!0), T(!1);
861
+ }, ae = () => {
862
+ H(""), j(_e()), G(Y.id), U(!0), T(!1);
863
+ };
864
+ return /* @__PURE__ */ s(
865
+ "div",
866
+ {
867
+ ref: _,
868
+ style: w,
869
+ className: `${e["v2-cluster-card"]} ${q ? e["v2-cluster-card--collapsed"] : ""}`,
870
+ children: [
871
+ /* @__PURE__ */ s("div", { className: e["v2-cluster-card__head"], children: [
872
+ u ? /* @__PURE__ */ t("span", { ...h, className: e["v2-cluster-card-ext__drag-handle"], title: "Drag to reorder cluster", children: /* @__PURE__ */ t(Fe, { size: 20, color: "#94A3B8" }) }) : /* @__PURE__ */ t("span", { className: `${e["v2-cluster-card-ext__drag-handle"]} ${e["v2-cluster-card-ext__drag-handle--disabled"]}`, title: "Open field questions cannot be reordered", children: /* @__PURE__ */ t(Fe, { size: 20, color: "#94A3B8" }) }),
873
+ /* @__PURE__ */ t("span", { className: e["v2-cluster-card__num"], children: a }),
874
+ /* @__PURE__ */ s("div", { className: e["v2-cluster-card__info"], children: [
875
+ /* @__PURE__ */ t("div", { className: e["v2-cluster-card__title"], children: an(n.label, n.name) }),
876
+ /* @__PURE__ */ s("div", { className: e["v2-cluster-card__count"], children: [
877
+ m.length,
878
+ " question",
879
+ m.length === 1 ? "" : "s"
880
+ ] })
881
+ ] }),
882
+ /* @__PURE__ */ s("span", { className: e["v2-cluster-card__pill"], children: [
883
+ "Cluster ",
884
+ a
885
+ ] })
886
+ ] }),
887
+ !q && /* @__PURE__ */ s(pe, { children: [
888
+ !b && I !== "comprehensive" && /* @__PURE__ */ s("div", { className: e["v2-cluster-card-ext__guidance-box"], children: [
889
+ /* @__PURE__ */ t(ue, { size: 16, color: "#1F5FB8" }),
890
+ /* @__PURE__ */ s("span", { children: [
891
+ "Tick 1 - 2 open field questions (in a question's edit panel) to include in the bulk check-in. ",
892
+ /* @__PURE__ */ s("strong", { children: [
893
+ K,
894
+ " selected."
895
+ ] })
896
+ ] })
897
+ ] }),
898
+ /* @__PURE__ */ s("div", { className: e["v2-cluster-card-ext__questions-list"], children: [
899
+ m.map((g, f) => /* @__PURE__ */ t(
900
+ qn,
901
+ {
902
+ item: g,
903
+ kind: n.kind,
904
+ clusterId: n.id,
905
+ clusters: o,
906
+ onChange: (M) => i(f, M),
907
+ onMove: (M) => c(f, M),
908
+ onDelete: () => l(f),
909
+ isOneOff: C || !!v,
910
+ scope: I
911
+ },
912
+ g.id || f
913
+ )),
914
+ m.length === 0 && /* @__PURE__ */ t("div", { className: e["v2-cluster-card-ext__empty"], children: "No questions yet. Add one below." })
915
+ ] }),
916
+ X && /* @__PURE__ */ s("div", { className: `${e["v2-question-form"]} ${e["v2-cluster-card-ext__custom-form-card"]}`, children: [
917
+ /* @__PURE__ */ t("div", { className: e["v2-cluster-card-ext__custom-form-title"], children: "Write custom question" }),
918
+ /* @__PURE__ */ s("label", { className: e["v2-question-form__field"], children: [
919
+ /* @__PURE__ */ t("span", { className: e["v2-question-form__label"], children: "QUESTION TEXT" }),
920
+ /* @__PURE__ */ t(
921
+ "input",
922
+ {
923
+ value: Q,
924
+ onChange: (g) => H(g.target.value),
925
+ placeholder: "Short title: full question?",
926
+ className: e["v2-question-form__input"],
927
+ autoFocus: !0
928
+ }
929
+ ),
930
+ /* @__PURE__ */ t("span", { className: e["v2-question-form__hint"], children: "Format as “Short title: full question?” — the title shows bold and the rest becomes the prompt." })
931
+ ] }),
932
+ b && /* @__PURE__ */ s("div", { children: [
933
+ /* @__PURE__ */ t("div", { className: `${e["v2-question-form__label"]} ${e["v2-question-form__label--spaced"]}`, children: "LINKED DESCRIPTORS (SCORE 1 ➜ 5)" }),
934
+ /* @__PURE__ */ t("div", { className: e["v2-question-form__descriptors-grid"], children: W.map((g, f) => /* @__PURE__ */ s("label", { className: e["v2-question-form__descriptor-item"], children: [
935
+ /* @__PURE__ */ t("span", { className: e["v2-question-form__descriptor-num"], children: f + 1 }),
936
+ /* @__PURE__ */ t(
937
+ "input",
938
+ {
939
+ value: g,
940
+ onChange: (M) => {
941
+ const V = [...W];
942
+ V[f] = M.target.value, j(V);
943
+ },
944
+ className: e["v2-question-form__descriptor-input"]
945
+ }
946
+ )
947
+ ] }, f)) })
948
+ ] }),
949
+ !b && I !== "comprehensive" && /* @__PURE__ */ s("div", { className: e["v2-question-form__meta-row"], children: [
950
+ /* @__PURE__ */ s("label", { className: e["v2-question-form__select-label"], children: [
951
+ /* @__PURE__ */ t("span", { children: "Well-being cluster" }),
952
+ /* @__PURE__ */ t(
953
+ "select",
954
+ {
955
+ value: P,
956
+ onChange: (g) => $(Number(g.target.value)),
957
+ className: e["v2-question-form__select"],
958
+ children: o.map((g) => {
959
+ const f = g.kind === "open" ? "Open field" : g.label || g.name;
960
+ return /* @__PURE__ */ t("option", { value: g.id, children: f }, g.id);
961
+ })
962
+ }
963
+ )
964
+ ] }),
965
+ /* @__PURE__ */ s("label", { className: e["v2-question-row__checkbox-label"], children: [
966
+ /* @__PURE__ */ t(
967
+ "input",
968
+ {
969
+ type: "checkbox",
970
+ checked: J,
971
+ onChange: (g) => O(g.target.checked),
972
+ className: e["v2-question-row__checkbox"]
973
+ }
974
+ ),
975
+ /* @__PURE__ */ t("span", { className: e["v2-question-row__checkbox-text"], children: "Include in bulk check-in" })
976
+ ] })
977
+ ] }),
978
+ /* @__PURE__ */ s("div", { className: e["v2-question-form__actions"], children: [
979
+ /* @__PURE__ */ t(
980
+ "button",
981
+ {
982
+ type: "button",
983
+ onClick: ae,
984
+ className: e["v2-question-form__btn-cancel"],
985
+ children: "Cancel"
986
+ }
987
+ ),
988
+ /* @__PURE__ */ t(
989
+ "button",
990
+ {
991
+ type: "button",
992
+ onClick: ee,
993
+ disabled: !Q.trim(),
994
+ className: e["v2-question-form__btn-save"],
995
+ children: "Save Question"
996
+ }
997
+ )
998
+ ] })
999
+ ] }),
1000
+ v ? /* @__PURE__ */ s("div", { children: [
1001
+ /* @__PURE__ */ s(
1002
+ "button",
1003
+ {
1004
+ type: "button",
1005
+ onClick: () => A(),
1006
+ className: e["v2-cluster-card-ext__btn-toggle-bank"],
1007
+ children: [
1008
+ F ? /* @__PURE__ */ t(Te, { size: 18 }) : /* @__PURE__ */ t(he, { size: 18 }),
1009
+ F ? "Close question bank" : `Add from question bank (${E.length} available)`
1010
+ ]
1011
+ }
1012
+ ),
1013
+ F && /* @__PURE__ */ s("div", { className: e["v2-cluster-card-ext__bank-panel"], children: [
1014
+ E.length === 0 ? /* @__PURE__ */ s("div", { className: e["v2-cluster-card-ext__bank-empty"], children: [
1015
+ "All ",
1016
+ n.name.toLowerCase(),
1017
+ " bank questions have been added."
1018
+ ] }) : E.map((g, f) => {
1019
+ const { title: M, desc: V } = nt(g.text);
1020
+ return /* @__PURE__ */ s(
1021
+ "button",
1022
+ {
1023
+ type: "button",
1024
+ onClick: () => k && k(g),
1025
+ className: e["v2-cluster-card-ext__bank-item"],
1026
+ children: [
1027
+ /* @__PURE__ */ t("span", { className: e["v2-cluster-card-ext__bank-icon-circle"], children: /* @__PURE__ */ t(he, { size: 15, color: "#316CD9" }) }),
1028
+ /* @__PURE__ */ s("span", { className: e["v2-cluster-card-ext__bank-text-wrap"], children: [
1029
+ /* @__PURE__ */ t("span", { className: e["v2-cluster-card-ext__bank-item-title"], children: M }),
1030
+ V && /* @__PURE__ */ t("span", { className: e["v2-cluster-card-ext__bank-item-desc"], children: V })
1031
+ ] })
1032
+ ]
1033
+ },
1034
+ g.id || f
1035
+ );
1036
+ }),
1037
+ /* @__PURE__ */ t("div", { className: e["v2-cluster-card-ext__bank-divider"] }),
1038
+ /* @__PURE__ */ s(
1039
+ "button",
1040
+ {
1041
+ type: "button",
1042
+ onClick: () => T(!0),
1043
+ className: e["v2-cluster-card-ext__btn-write-custom"],
1044
+ children: [
1045
+ /* @__PURE__ */ t(Ce, { size: 16, color: "#316CD9" }),
1046
+ /* @__PURE__ */ t("span", { children: "Write a custom question instead" })
1047
+ ]
1048
+ }
1049
+ )
1050
+ ] })
1051
+ ] }) : /* @__PURE__ */ t("div", { className: e["v2-cluster-card-ext__bottom-actions"], children: /* @__PURE__ */ s(
1052
+ "button",
1053
+ {
1054
+ type: "button",
1055
+ onClick: () => T(!0),
1056
+ className: e["v2-cluster-card-ext__btn-add-cluster"],
1057
+ children: [
1058
+ /* @__PURE__ */ t(he, { size: 16 }),
1059
+ " Add question to this cluster"
1060
+ ]
1061
+ }
1062
+ ) })
1063
+ ] })
1064
+ ]
1065
+ }
1066
+ );
1067
+ }, Cn = ({
1068
+ cluster: n,
1069
+ isDraggable: a = !0,
1070
+ isCollapsed: o = !1,
1071
+ ...i
1072
+ }) => {
1073
+ const {
1074
+ attributes: l,
1075
+ listeners: d,
1076
+ setNodeRef: c,
1077
+ transform: v,
1078
+ transition: k,
1079
+ isDragging: u
1080
+ } = Tt({
1081
+ id: n.id,
1082
+ disabled: !a
1083
+ }), h = {
1084
+ transform: Yt.Transform.toString(v),
1085
+ transition: k,
1086
+ opacity: u ? 0.6 : 1,
1087
+ zIndex: u ? 999 : void 0,
1088
+ position: "relative"
1089
+ };
1090
+ return /* @__PURE__ */ t(
1091
+ it,
1092
+ {
1093
+ ...i,
1094
+ cluster: n,
1095
+ isDraggable: a,
1096
+ isCollapsed: o,
1097
+ cardRef: c,
1098
+ cardStyle: h,
1099
+ dragHandleProps: a ? { ...l, ...d } : void 0
1100
+ }
1101
+ );
1102
+ }, Dn = ({ open: n, onClose: a, onConfirm: o, loading: i = !1 }) => {
1103
+ if (!n) return null;
1104
+ const l = /* @__PURE__ */ t(
1105
+ "div",
1106
+ {
1107
+ onClick: i ? void 0 : a,
1108
+ className: e["v2-restore-modal-overlay"],
1109
+ children: /* @__PURE__ */ s(
1110
+ "div",
1111
+ {
1112
+ onClick: (d) => d.stopPropagation(),
1113
+ className: e["v2-restore-modal"],
1114
+ children: [
1115
+ /* @__PURE__ */ t("div", { className: e["v2-restore-modal__icon-box"], children: /* @__PURE__ */ t(je, { size: 26, color: "#316CD9" }) }),
1116
+ /* @__PURE__ */ t("div", { className: e["v2-restore-modal__title"], children: "Restore the default question set?" }),
1117
+ /* @__PURE__ */ t("p", { className: e["v2-restore-modal__message"], children: "This replaces the current questions in every cluster with the MARIO defaults. Any custom edits or deletions will be lost." }),
1118
+ /* @__PURE__ */ s("div", { className: e["v2-restore-modal__actions"], children: [
1119
+ /* @__PURE__ */ t(
1120
+ "button",
1121
+ {
1122
+ type: "button",
1123
+ onClick: a,
1124
+ disabled: i,
1125
+ className: e["v2-restore-modal__btn-cancel"],
1126
+ children: "Cancel"
1127
+ }
1128
+ ),
1129
+ /* @__PURE__ */ t(
1130
+ "button",
1131
+ {
1132
+ type: "button",
1133
+ onClick: o,
1134
+ disabled: i,
1135
+ className: e["v2-restore-modal__btn-confirm"],
1136
+ children: i ? "Restoring..." : "Restore defaults"
1137
+ }
1138
+ )
1139
+ ] })
1140
+ ]
1141
+ }
1142
+ )
1143
+ }
1144
+ );
1145
+ return typeof document < "u" ? et.createPortal(l, document.body) : l;
1146
+ }, $e = ({
1147
+ clusters: n,
1148
+ onChangeClusters: a,
1149
+ blank: o = !1,
1150
+ embedded: i = !1,
1151
+ masterBankClusters: l = ie,
1152
+ scope: d = "routine",
1153
+ onRestoreDefaults: c
1154
+ }) => {
1155
+ const [v, k] = N(!1), [u, h] = N(null), _ = Ve(null), [w, q] = N(null);
1156
+ de(() => {
1157
+ if (w === null) return;
1158
+ const m = (b) => {
1159
+ if (!_.current) return;
1160
+ if (b.composedPath) {
1161
+ const O = b.composedPath();
1162
+ if (O && O.includes(_.current)) return;
1163
+ }
1164
+ const $ = b.target;
1165
+ $ && !document.body.contains($) || $ && _.current.contains($) || q(null);
1166
+ };
1167
+ return document.addEventListener("click", m), () => {
1168
+ document.removeEventListener("click", m);
1169
+ };
1170
+ }, [w]);
1171
+ const [C, I] = N(!1), [z, B] = N(!1), R = u !== null, L = st(n), { draggableClusters: F, openCluster: A } = ln(n), X = qt(
1172
+ Ct(Dt, {
1173
+ activationConstraint: {
1174
+ distance: 5
1175
+ }
1176
+ })
1177
+ ), T = (m) => {
1178
+ h(m.active.id);
1179
+ }, Q = async (m) => {
1180
+ h(null);
1181
+ const { active: b, over: $ } = m;
1182
+ if (!$ || b.id === $.id) return;
1183
+ const O = F.findIndex((g) => g.id === b.id), E = F.findIndex((g) => g.id === $.id);
1184
+ if (O < 0 || E < 0) return;
1185
+ const K = [...n], ee = Et(F, O, E), ae = A ? [...ee, A] : ee;
1186
+ if (a(ae), !o)
1187
+ try {
1188
+ const g = ee.filter((f) => f.id && f.id !== 999).map((f) => ({ id: f.id, name: f.name }));
1189
+ g.length > 0 && (await Lt({ sections: g }), D("Cluster order saved successfully", "success"));
1190
+ } catch (g) {
1191
+ console.error("Failed to auto-save cluster order, reverting", g), a(K), D("Failed to update cluster order on server. Reverted.", "error");
1192
+ }
1193
+ }, H = (m, b, $) => {
1194
+ a(cn(n, m, b, $));
1195
+ }, W = (m, b) => {
1196
+ a(dn(n, m, b));
1197
+ }, j = (m, b) => {
1198
+ a(Pe(n, m, b));
1199
+ }, Y = (m, b, $) => {
1200
+ a(_n(n, m, b, $));
1201
+ }, P = (m, b) => {
1202
+ const $ = { ...b, isEnabled: !0, clusterId: m };
1203
+ a(Pe(n, m, $)), D(`Added "${b.text.slice(0, 30)}..." to cluster`, "success");
1204
+ }, G = () => {
1205
+ I(!0);
1206
+ }, J = async () => {
1207
+ try {
1208
+ if (B(!0), c)
1209
+ await c();
1210
+ else {
1211
+ const b = (await tt(d)).data;
1212
+ b && (d === "routine" && b.routineClusters ? a(b.routineClusters) : d === "comprehensive" && b.comprehensiveClusters ? a(b.comprehensiveClusters) : (b.clusters || b.masterBankClusters) && a(b.clusters || b.masterBankClusters)), D("Default questions restored successfully", "success");
1213
+ }
1214
+ I(!1);
1215
+ } catch (m) {
1216
+ console.error("Failed to restore default questions", m), D("Failed to restore default questions", "error");
1217
+ } finally {
1218
+ B(!1);
1219
+ }
1220
+ }, U = o || i || v;
1221
+ return /* @__PURE__ */ s("div", { ref: _, className: e["v2-review-questions"], children: [
1222
+ !o && !i && /* @__PURE__ */ s(pe, { children: [
1223
+ /* @__PURE__ */ s("div", { className: e["v2-stat-banner"], children: [
1224
+ /* @__PURE__ */ s("div", { className: e["v2-stat-banner__left"], children: [
1225
+ /* @__PURE__ */ t("span", { className: e["v2-stat-banner__icon"], children: /* @__PURE__ */ t(pt, { size: 26, color: "#fff" }) }),
1226
+ /* @__PURE__ */ s("div", { children: [
1227
+ /* @__PURE__ */ t("div", { className: e["v2-stat-banner__label"], children: "Total available questions" }),
1228
+ /* @__PURE__ */ t("div", { className: e["v2-stat-banner__num"], children: L })
1229
+ ] })
1230
+ ] }),
1231
+ /* @__PURE__ */ s("div", { className: e["v2-stat-banner__right"], children: [
1232
+ /* @__PURE__ */ t("div", { className: e["v2-stat-banner__meta-sub"], children: "Across" }),
1233
+ /* @__PURE__ */ t("div", { className: e["v2-stat-banner__meta-num"], children: n.length }),
1234
+ /* @__PURE__ */ t("div", { className: e["v2-stat-banner__meta-sub"], children: "clusters" })
1235
+ ] })
1236
+ ] }),
1237
+ /* @__PURE__ */ s(
1238
+ "button",
1239
+ {
1240
+ type: "button",
1241
+ onClick: () => k((m) => !m),
1242
+ className: e["v2-btn-primary"],
1243
+ children: [
1244
+ v ? /* @__PURE__ */ t(kt, { size: 20 }) : /* @__PURE__ */ t(De, { size: 20 }),
1245
+ /* @__PURE__ */ t("span", { children: v ? "Hide all questions" : "View & edit all questions" })
1246
+ ]
1247
+ }
1248
+ )
1249
+ ] }),
1250
+ o && /* @__PURE__ */ s("div", { className: e["v2-info-callout"], children: [
1251
+ /* @__PURE__ */ t(ue, { size: 18, color: "#316CD9", className: e["v2-info-callout__icon"] }),
1252
+ /* @__PURE__ */ t("p", { className: e["v2-info-callout__text"], children: "Build your one-off check-in from scratch. Add questions to any cluster below and set their details — nothing is included until you add it." })
1253
+ ] }),
1254
+ U && /* @__PURE__ */ s("div", { className: `${e["v2-review-questions__builder-card"]} ${o || i ? e["v2-review-questions__builder-card--transparent"] : ""}`, children: [
1255
+ !o && /* @__PURE__ */ s("div", { className: e["v2-review-questions__reorder-bar"], children: [
1256
+ /* @__PURE__ */ t("span", { className: e["v2-review-questions__reorder-hint"], children: "Deleted a question by mistake? Restore the full default set at any time." }),
1257
+ /* @__PURE__ */ s(
1258
+ "button",
1259
+ {
1260
+ type: "button",
1261
+ onClick: G,
1262
+ className: e["v2-review-questions__btn-restore"],
1263
+ children: [
1264
+ /* @__PURE__ */ t(je, { size: 16, color: "#316CD9" }),
1265
+ " Restore default questions"
1266
+ ]
1267
+ }
1268
+ )
1269
+ ] }),
1270
+ /* @__PURE__ */ t(
1271
+ St,
1272
+ {
1273
+ sensors: X,
1274
+ collisionDetection: It,
1275
+ onDragStart: T,
1276
+ onDragEnd: Q,
1277
+ onDragCancel: () => h(null),
1278
+ children: /* @__PURE__ */ t(
1279
+ Ot,
1280
+ {
1281
+ items: F.map((m) => m.id),
1282
+ strategy: At,
1283
+ children: /* @__PURE__ */ t("div", { className: `${e["v2-review-questions__cluster-list"]} ${R ? e["v2-review-questions__cluster-list--dragging"] : ""}`, children: F.map((m, b) => {
1284
+ const $ = l.find((O) => O.id === m.id || O.name === m.name)?.questions || [];
1285
+ return /* @__PURE__ */ t(
1286
+ Cn,
1287
+ {
1288
+ cluster: m,
1289
+ clusterIndex: b + 1,
1290
+ clusters: n,
1291
+ isDraggable: !0,
1292
+ isCollapsed: R,
1293
+ onUpdateQuestion: (O, E) => H(m.id, O, E),
1294
+ onDeleteQuestion: (O) => W(m.id, O),
1295
+ onAddQuestion: (O) => j(m.id, O),
1296
+ onMoveQuestion: (O, E) => Y(m.id, O, E),
1297
+ bankQuestions: o ? $ : void 0,
1298
+ onAddFromBank: (O) => P(m.id, O),
1299
+ isOneOff: o,
1300
+ scope: d,
1301
+ isBankOpen: w === m.id,
1302
+ onToggleBank: (O) => {
1303
+ q(O === !1 ? (E) => E === m.id ? null : E : (E) => E === m.id ? null : m.id);
1304
+ }
1305
+ },
1306
+ m.id || b
1307
+ );
1308
+ }) })
1309
+ }
1310
+ )
1311
+ }
1312
+ ),
1313
+ A && /* @__PURE__ */ t(
1314
+ it,
1315
+ {
1316
+ cluster: A,
1317
+ clusterIndex: F.length + 1,
1318
+ clusters: n,
1319
+ isDraggable: !1,
1320
+ isCollapsed: R,
1321
+ onUpdateQuestion: (m, b) => H(A.id, m, b),
1322
+ onDeleteQuestion: (m) => W(A.id, m),
1323
+ onAddQuestion: (m) => j(A.id, m),
1324
+ onMoveQuestion: (m, b) => Y(A.id, m, b),
1325
+ bankQuestions: o ? l.find((m) => m.id === A.id || m.name === A.name)?.questions || [] : void 0,
1326
+ onAddFromBank: (m) => P(A.id, m),
1327
+ isOneOff: o,
1328
+ scope: d,
1329
+ isBankOpen: w === A.id,
1330
+ onToggleBank: (m) => {
1331
+ q(m === !1 ? (b) => b === A.id ? null : b : (b) => b === A.id ? null : A.id);
1332
+ }
1333
+ },
1334
+ A.id || "open"
1335
+ )
1336
+ ] }),
1337
+ /* @__PURE__ */ t(
1338
+ Dn,
1339
+ {
1340
+ open: C,
1341
+ onClose: () => I(!1),
1342
+ onConfirm: J,
1343
+ loading: z
1344
+ }
1345
+ )
1346
+ ] });
1347
+ }, rt = ({
1348
+ frequency: n = "weekly",
1349
+ isComprehensive: a = !1,
1350
+ subject: o,
1351
+ body: i
1352
+ }) => {
1353
+ const [l, d] = N(!1), { title: c, body: v } = Nn(n, a, o, i);
1354
+ return /* @__PURE__ */ s("div", { className: e["v2-email-preview-wrapper"], children: [
1355
+ /* @__PURE__ */ s(
1356
+ "button",
1357
+ {
1358
+ type: "button",
1359
+ onMouseEnter: () => d(!0),
1360
+ onMouseLeave: () => d(!1),
1361
+ onClick: () => d((k) => !k),
1362
+ className: e["v2-btn-preview-email"],
1363
+ children: [
1364
+ /* @__PURE__ */ t(De, { size: 16 }),
1365
+ /* @__PURE__ */ t("span", { children: "Preview email" })
1366
+ ]
1367
+ }
1368
+ ),
1369
+ l && /* @__PURE__ */ s(
1370
+ "div",
1371
+ {
1372
+ className: e["v2-email-preview-popover"],
1373
+ onMouseEnter: () => d(!0),
1374
+ onMouseLeave: () => d(!1),
1375
+ children: [
1376
+ /* @__PURE__ */ s("div", { className: e["v2-email-preview-popover__head"], children: [
1377
+ /* @__PURE__ */ s("div", { className: e["v2-email-preview-popover__logo-wrap"], children: [
1378
+ /* @__PURE__ */ t("span", { className: e["v2-email-preview-popover__logo-circle"], children: "M" }),
1379
+ /* @__PURE__ */ t("span", { className: e["v2-email-preview-popover__logo-text"], children: "MARIO" })
1380
+ ] }),
1381
+ /* @__PURE__ */ t("span", { className: e["v2-email-preview-popover__brand"], children: "MARIO for Me" })
1382
+ ] }),
1383
+ /* @__PURE__ */ s("div", { className: e["v2-email-preview-popover__body"], children: [
1384
+ /* @__PURE__ */ t("div", { className: e["v2-email-preview-popover__to"], children: "To: All educators" }),
1385
+ /* @__PURE__ */ t("h4", { className: e["v2-email-preview-popover__title"], children: c }),
1386
+ /* @__PURE__ */ t("p", { className: e["v2-email-preview-popover__desc"], children: v }),
1387
+ /* @__PURE__ */ s("button", { type: "button", className: e["v2-email-preview-popover__btn-start"], children: [
1388
+ /* @__PURE__ */ t("span", { children: "Start check-in" }),
1389
+ /* @__PURE__ */ t(wt, { size: 14 })
1390
+ ] })
1391
+ ] })
1392
+ ]
1393
+ }
1394
+ )
1395
+ ] });
1396
+ }, Sn = ({
1397
+ config: n,
1398
+ onChangeConfig: a,
1399
+ clusters: o,
1400
+ onChangeClusters: i,
1401
+ onSave: l,
1402
+ onRestoreDefaults: d
1403
+ }) => {
1404
+ const c = n.isEnabled, v = () => {
1405
+ a(vn(n));
1406
+ }, k = (_) => {
1407
+ a({ ...n, frequency: _ });
1408
+ }, u = (_) => {
1409
+ a({ ...n, dayOfWeek: _ });
1410
+ }, h = () => {
1411
+ a({ ...n, emailNotify: !n.emailNotify });
1412
+ };
1413
+ return /* @__PURE__ */ s("div", { className: e["v2-routine-container"], children: [
1414
+ /* @__PURE__ */ s("div", { className: `${e["v2-power-card"]} ${c ? e["v2-power-card--active"] : ""}`, children: [
1415
+ /* @__PURE__ */ t("span", { className: e["v2-power-card__icon"], children: /* @__PURE__ */ t(Ke, { size: 22, color: c ? "#316CD9" : "#858585" }) }),
1416
+ /* @__PURE__ */ s("div", { className: e["v2-power-card__content"], children: [
1417
+ /* @__PURE__ */ s("div", { className: e["v2-power-card__title"], children: [
1418
+ "Routine check-in is ",
1419
+ c ? "on" : "off"
1420
+ ] }),
1421
+ /* @__PURE__ */ t("div", { className: e["v2-power-card__sub"], children: c ? "This check-in is active and will be sent on the schedule below." : "This check-in is turned off. Turn it on to configure and send it." })
1422
+ ] }),
1423
+ /* @__PURE__ */ t("span", { className: `${e["v2-power-card__state-text"]} ${c ? e["v2-power-card__state-text--active"] : ""}`, children: c ? "On" : "Off" }),
1424
+ /* @__PURE__ */ t(
1425
+ "button",
1426
+ {
1427
+ type: "button",
1428
+ onClick: v,
1429
+ className: `${e["v2-power-card__switch"]} ${c ? e["v2-power-card__switch--active"] : ""}`,
1430
+ children: /* @__PURE__ */ t("span", { className: `${e["v2-power-card__knob"]} ${c ? e["v2-power-card__knob--active"] : ""}` })
1431
+ }
1432
+ )
1433
+ ] }),
1434
+ /* @__PURE__ */ s("div", { className: `${e["v2-routine-body"]} ${c ? "" : e["v2-routine-body--disabled"]}`, children: [
1435
+ /* @__PURE__ */ s("div", { className: e["v2-info-callout"], children: [
1436
+ /* @__PURE__ */ t(ue, { size: 20, color: "#316CD9", className: e["v2-info-callout__icon"] }),
1437
+ /* @__PURE__ */ t("p", { className: e["v2-info-callout__text"], children: "MARIO recommends running the primary check-in on a bi-weekly basis, sending a smaller section of questions that rotate each time so teachers get a quick, focused pulse." })
1438
+ ] }),
1439
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
1440
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
1441
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "1" }),
1442
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "How often it is sent" })
1443
+ ] }),
1444
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "Questions are grouped per section (a rotating cluster each time). Choose the cadence and the day of the week it goes out." }),
1445
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__body"], children: [
1446
+ /* @__PURE__ */ t("div", { className: e["v2-cadence-grid"], children: tn.map((_) => {
1447
+ const w = n.frequency === _.id;
1448
+ return /* @__PURE__ */ s(
1449
+ "button",
1450
+ {
1451
+ type: "button",
1452
+ onClick: () => k(_.id),
1453
+ className: `${e["v2-cadence-card"]} ${w ? e["v2-cadence-card--selected"] : ""}`,
1454
+ children: [
1455
+ /* @__PURE__ */ s("span", { className: e["v2-cadence-card__top"], children: [
1456
+ /* @__PURE__ */ t("span", { className: `${e["v2-cadence-card__radio"]} ${w ? e["v2-cadence-card__radio--selected"] : ""}` }),
1457
+ /* @__PURE__ */ t("span", { className: e["v2-cadence-card__title"], children: _.title }),
1458
+ _.rec && /* @__PURE__ */ t("span", { className: e["v2-cadence-card__badge"], children: "Recommended" })
1459
+ ] }),
1460
+ /* @__PURE__ */ t("span", { className: e["v2-cadence-card__sub"], children: _.sub })
1461
+ ]
1462
+ },
1463
+ _.id
1464
+ );
1465
+ }) }),
1466
+ /* @__PURE__ */ s("div", { children: [
1467
+ /* @__PURE__ */ t("div", { className: e["v2-field-label"], children: "DAY OF THE WEEK IT GOES OUT" }),
1468
+ /* @__PURE__ */ t("div", { className: e["v2-days-row"], children: nn.map((_) => {
1469
+ const w = n.dayOfWeek === _;
1470
+ return /* @__PURE__ */ t(
1471
+ "button",
1472
+ {
1473
+ type: "button",
1474
+ onClick: () => u(_),
1475
+ className: `${e["v2-day-pill"]} ${w ? e["v2-day-pill--selected"] : ""}`,
1476
+ children: _
1477
+ },
1478
+ _
1479
+ );
1480
+ }) })
1481
+ ] }),
1482
+ /* @__PURE__ */ s("div", { className: e["v2-rotation-box"], children: [
1483
+ /* @__PURE__ */ s("div", { className: e["v2-rotation-box__head"], children: [
1484
+ /* @__PURE__ */ t(ue, { size: 17, color: "#316CD9" }),
1485
+ /* @__PURE__ */ t("span", { children: "How the rotation works" })
1486
+ ] }),
1487
+ /* @__PURE__ */ s("p", { className: e["v2-rotation-box__desc"], children: [
1488
+ "Each ",
1489
+ un(n.frequency),
1490
+ ", educators receive one well-being section to answer. The next cycle rotates to the following section, and so on. For example:"
1491
+ ] }),
1492
+ /* @__PURE__ */ t("div", { className: e["v2-rotation-box__list"], children: sn.map((_, w) => /* @__PURE__ */ s("div", { className: e["v2-rotation-box__item"], children: [
1493
+ /* @__PURE__ */ t("span", { className: e["v2-rotation-box__cycle"], children: _[0] }),
1494
+ /* @__PURE__ */ t("span", { className: e["v2-rotation-box__title"], children: _[1] }),
1495
+ /* @__PURE__ */ t("span", { className: e["v2-rotation-box__tag"], children: _[2] })
1496
+ ] }, w)) })
1497
+ ] })
1498
+ ] })
1499
+ ] }),
1500
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
1501
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
1502
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "2" }),
1503
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "Review & edit questions" })
1504
+ ] }),
1505
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "Review and customize the questions sent in this check-in across all well-being sections." }),
1506
+ /* @__PURE__ */ t(
1507
+ $e,
1508
+ {
1509
+ clusters: o,
1510
+ onChangeClusters: i,
1511
+ scope: "routine",
1512
+ onRestoreDefaults: d
1513
+ }
1514
+ )
1515
+ ] }),
1516
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
1517
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
1518
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "3" }),
1519
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "Notify by email" })
1520
+ ] }),
1521
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "Send an email to educators when this check-in goes out. Hover the preview to see the message." }),
1522
+ /* @__PURE__ */ s("div", { className: `${e["v2-email-box"]} ${n.emailNotify ? e["v2-email-box--active"] : ""}`, children: [
1523
+ /* @__PURE__ */ t("span", { className: e["v2-email-box__icon"], children: /* @__PURE__ */ t(Ze, { size: 20, color: n.emailNotify ? "#316CD9" : "#858585" }) }),
1524
+ /* @__PURE__ */ s("div", { className: e["v2-email-box__content"], children: [
1525
+ /* @__PURE__ */ t("div", { className: e["v2-email-box__title"], children: "Notify educators by email" }),
1526
+ /* @__PURE__ */ t("div", { className: e["v2-email-box__sub"], children: n.emailNotify ? "An email is sent to each educator when this check-in goes out." : "No email is sent. Educators see it in the app only." })
1527
+ ] }),
1528
+ /* @__PURE__ */ t("span", { className: `${e["v2-email-box__state-text"]} ${n.emailNotify ? e["v2-email-box__state-text--active"] : ""}`, children: n.emailNotify ? "On" : "Off" }),
1529
+ /* @__PURE__ */ t(
1530
+ "button",
1531
+ {
1532
+ type: "button",
1533
+ onClick: h,
1534
+ className: `${e["v2-email-box__switch"]} ${n.emailNotify ? e["v2-email-box__switch--active"] : ""}`,
1535
+ children: /* @__PURE__ */ t("span", { className: `${e["v2-email-box__knob"]} ${n.emailNotify ? e["v2-email-box__knob--active"] : ""}` })
1536
+ }
1537
+ )
1538
+ ] }),
1539
+ /* @__PURE__ */ t(rt, { frequency: n.frequency })
1540
+ ] }),
1541
+ /* @__PURE__ */ s(
1542
+ "button",
1543
+ {
1544
+ type: "button",
1545
+ onClick: l,
1546
+ className: e["v2-btn-primary"],
1547
+ children: [
1548
+ /* @__PURE__ */ t(Se, { size: 20, color: "#fff" }),
1549
+ " Save configuration"
1550
+ ]
1551
+ }
1552
+ )
1553
+ ] })
1554
+ ] });
1555
+ }, In = ({
1556
+ config: n,
1557
+ onChangeConfig: a,
1558
+ clusters: o,
1559
+ onChangeClusters: i,
1560
+ onSave: l,
1561
+ onRestoreDefaults: d
1562
+ }) => {
1563
+ const c = n.isEnabled, v = () => {
1564
+ a({ ...n, isEnabled: !n.isEnabled });
1565
+ }, k = (w, q) => {
1566
+ if (q && n.sendDates.some((z, B) => B !== w && z === q)) {
1567
+ D("This date has already been added to the schedule.", "warning");
1568
+ return;
1569
+ }
1570
+ const C = [...n.sendDates];
1571
+ C[w] = q;
1572
+ const I = xe(C);
1573
+ a({ ...n, sendDates: I });
1574
+ }, u = () => {
1575
+ a({ ...n, sendDates: [...n.sendDates, ""] });
1576
+ }, h = (w) => {
1577
+ const q = n.sendDates.filter((C, I) => I !== w);
1578
+ a({
1579
+ ...n,
1580
+ sendDates: xe(q)
1581
+ });
1582
+ }, _ = () => {
1583
+ a({ ...n, emailNotify: !n.emailNotify });
1584
+ };
1585
+ return /* @__PURE__ */ s("div", { className: e["v2-comprehensive-container"], children: [
1586
+ /* @__PURE__ */ s("div", { className: `${e["v2-power-card"]} ${c ? e["v2-power-card--active"] : ""}`, children: [
1587
+ /* @__PURE__ */ t("span", { className: e["v2-power-card__icon"], children: /* @__PURE__ */ t(Ke, { size: 22, color: c ? "#316CD9" : "#858585" }) }),
1588
+ /* @__PURE__ */ s("div", { className: e["v2-power-card__content"], children: [
1589
+ /* @__PURE__ */ s("div", { className: e["v2-power-card__title"], children: [
1590
+ "Comprehensive check-in is ",
1591
+ c ? "on" : "off"
1592
+ ] }),
1593
+ /* @__PURE__ */ t("div", { className: e["v2-power-card__sub"], children: c ? "This check-in is active and will be sent on the schedule below." : "This check-in is turned off. Turn it on to configure and send it." })
1594
+ ] }),
1595
+ /* @__PURE__ */ t("span", { className: `${e["v2-power-card__state-text"]} ${c ? e["v2-power-card__state-text--active"] : ""}`, children: c ? "On" : "Off" }),
1596
+ /* @__PURE__ */ t(
1597
+ "button",
1598
+ {
1599
+ type: "button",
1600
+ onClick: v,
1601
+ className: `${e["v2-power-card__switch"]} ${c ? e["v2-power-card__switch--active"] : ""}`,
1602
+ children: /* @__PURE__ */ t("span", { className: `${e["v2-power-card__knob"]} ${c ? e["v2-power-card__knob--active"] : ""}` })
1603
+ }
1604
+ )
1605
+ ] }),
1606
+ /* @__PURE__ */ s("div", { className: `${e["v2-comprehensive-body"]} ${c ? "" : e["v2-comprehensive-body--disabled"]}`, children: [
1607
+ /* @__PURE__ */ s("div", { className: e["v2-info-callout"], children: [
1608
+ /* @__PURE__ */ t(ue, { size: 20, color: "#316CD9", className: e["v2-info-callout__icon"] }),
1609
+ /* @__PURE__ */ t("p", { className: e["v2-info-callout__text"], children: "The comprehensive check-in sends all of the questions at once for a complete picture of staff well-being. The question bank is long, around 29 questions, so we recommend spacing it out over longer periods and not repeating it too often. Sending it too frequently tends to lower how thoughtfully teachers engage. When a comprehensive check-in is running, the routine check-in is paused for that period so teachers only receive one check-in at a time." })
1610
+ ] }),
1611
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
1612
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
1613
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "1" }),
1614
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "How often it is sent" })
1615
+ ] }),
1616
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "A comprehensive check-in that sends all of the questions at once. Choose the dates it is sent. Each one stays open for 14 days." }),
1617
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__body"], children: [
1618
+ /* @__PURE__ */ s("div", { children: [
1619
+ /* @__PURE__ */ t("div", { className: e["v2-field-label"], children: "DATES IT IS SENT" }),
1620
+ /* @__PURE__ */ t(Oe, { dateAdapter: Ee, children: /* @__PURE__ */ s("div", { className: e["v2-dates-list"], children: [
1621
+ n.sendDates.map((w, q) => {
1622
+ const C = w && p(w, S).isValid() ? p(w, S) : null, I = at(w);
1623
+ return /* @__PURE__ */ s("div", { className: `${e["v2-date-row"]} ${I ? e["v2-date-row--past"] : ""}`, children: [
1624
+ /* @__PURE__ */ t("span", { className: `${e["v2-date-row__idx"]} ${I ? e["v2-date-row__idx--past"] : ""}`, children: q + 1 }),
1625
+ /* @__PURE__ */ t("div", { className: e["v2-comprehensive-date-picker-wrap"], children: /* @__PURE__ */ t(
1626
+ Ae,
1627
+ {
1628
+ value: C,
1629
+ shouldDisableDate: (z) => {
1630
+ if (!z || !z.isValid()) return !1;
1631
+ const B = z.format(S);
1632
+ return n.sendDates.some((R, L) => L !== q && R === B);
1633
+ },
1634
+ onChange: (z) => {
1635
+ const B = z && p(z).isValid() ? p(z).format(S) : "";
1636
+ k(q, B);
1637
+ },
1638
+ format: Gt,
1639
+ slotProps: {
1640
+ textField: {
1641
+ size: "small",
1642
+ fullWidth: !0,
1643
+ variant: "outlined",
1644
+ sx: {
1645
+ background: I ? "#F5F6F8" : "#fff",
1646
+ "& .MuiOutlinedInput-root": {
1647
+ borderRadius: "10px",
1648
+ fontSize: "14.5px",
1649
+ fontWeight: 500,
1650
+ color: I ? "#6B7280" : "#242424",
1651
+ height: 42,
1652
+ "& fieldset": {
1653
+ borderColor: I ? "#E5E7EB" : "#D3D3D3"
1654
+ },
1655
+ "&:hover fieldset": {
1656
+ borderColor: "#316CD9"
1657
+ },
1658
+ "&.Mui-focused fieldset": {
1659
+ borderColor: "#316CD9"
1660
+ }
1661
+ },
1662
+ "& .MuiInputBase-input": {
1663
+ padding: "8px 12px"
1664
+ }
1665
+ }
1666
+ }
1667
+ }
1668
+ }
1669
+ ) }),
1670
+ I && /* @__PURE__ */ t("span", { className: e["v2-date-row__past-badge"], children: "Past date" }),
1671
+ n.sendDates.length > 1 && /* @__PURE__ */ t(
1672
+ "button",
1673
+ {
1674
+ type: "button",
1675
+ onClick: () => h(q),
1676
+ title: "Remove date",
1677
+ className: e["v2-date-row__btn-remove"],
1678
+ children: /* @__PURE__ */ t(He, { size: 16, color: "#C44140" })
1679
+ }
1680
+ )
1681
+ ] }, q);
1682
+ }),
1683
+ /* @__PURE__ */ s(
1684
+ "button",
1685
+ {
1686
+ type: "button",
1687
+ onClick: u,
1688
+ className: e["v2-comprehensive-btn-add-date"],
1689
+ children: [
1690
+ /* @__PURE__ */ t(he, { size: 17, color: "#316CD9" }),
1691
+ " Add send date"
1692
+ ]
1693
+ }
1694
+ )
1695
+ ] }) })
1696
+ ] }),
1697
+ /* @__PURE__ */ s("div", { className: e["v2-comprehensive-note-box"], children: [
1698
+ /* @__PURE__ */ t(Ge, { size: 20, color: "#316CD9", className: e["v2-comprehensive-note-box__icon"] }),
1699
+ /* @__PURE__ */ s("p", { className: e["v2-comprehensive-note-box__text"], children: [
1700
+ "Each check-in stays open for ",
1701
+ /* @__PURE__ */ t("strong", { children: "14 days" }),
1702
+ " from the date you set. Add a date at the end of every quarter for a quarterly rhythm, a single date at year end for a yearly one, or combine both. For example: send on Oct 15, Jan 15, Mar 30 and Jun 15 for a quarterly cadence, or just Jun 15 for a yearly one."
1703
+ ] })
1704
+ ] })
1705
+ ] })
1706
+ ] }),
1707
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
1708
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
1709
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "2" }),
1710
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "Review & edit questions" })
1711
+ ] }),
1712
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "Review and customize the questions sent in this comprehensive check-in across all well-being sections." }),
1713
+ /* @__PURE__ */ t(
1714
+ $e,
1715
+ {
1716
+ clusters: o,
1717
+ onChangeClusters: i,
1718
+ scope: "comprehensive",
1719
+ onRestoreDefaults: d
1720
+ }
1721
+ )
1722
+ ] }),
1723
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
1724
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
1725
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "3" }),
1726
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "Notify by email" })
1727
+ ] }),
1728
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "Send an email to educators when this check-in goes out. Hover the preview to see the message." }),
1729
+ /* @__PURE__ */ s("div", { className: `${e["v2-email-box"]} ${n.emailNotify ? e["v2-email-box--active"] : ""}`, children: [
1730
+ /* @__PURE__ */ t("span", { className: e["v2-email-box__icon"], children: /* @__PURE__ */ t(Ze, { size: 20, color: n.emailNotify ? "#316CD9" : "#858585" }) }),
1731
+ /* @__PURE__ */ s("div", { className: e["v2-email-box__content"], children: [
1732
+ /* @__PURE__ */ t("div", { className: e["v2-email-box__title"], children: "Notify educators by email" }),
1733
+ /* @__PURE__ */ t("div", { className: e["v2-email-box__sub"], children: n.emailNotify ? "An email is sent to each educator when this check-in goes out." : "No email is sent. Educators see it in the app only." })
1734
+ ] }),
1735
+ /* @__PURE__ */ t("span", { className: `${e["v2-email-box__state-text"]} ${n.emailNotify ? e["v2-email-box__state-text--active"] : ""}`, children: n.emailNotify ? "On" : "Off" }),
1736
+ /* @__PURE__ */ t(
1737
+ "button",
1738
+ {
1739
+ type: "button",
1740
+ onClick: _,
1741
+ className: `${e["v2-email-box__switch"]} ${n.emailNotify ? e["v2-email-box__switch--active"] : ""}`,
1742
+ children: /* @__PURE__ */ t("span", { className: `${e["v2-email-box__knob"]} ${n.emailNotify ? e["v2-email-box__knob--active"] : ""}` })
1743
+ }
1744
+ )
1745
+ ] }),
1746
+ /* @__PURE__ */ t(rt, { isComprehensive: !0 })
1747
+ ] }),
1748
+ /* @__PURE__ */ s(
1749
+ "button",
1750
+ {
1751
+ type: "button",
1752
+ onClick: l,
1753
+ className: e["v2-btn-primary"],
1754
+ children: [
1755
+ /* @__PURE__ */ t(Se, { size: 20, color: "#fff" }),
1756
+ " Save configuration"
1757
+ ]
1758
+ }
1759
+ )
1760
+ ] })
1761
+ ] });
1762
+ }, Tn = ({
1763
+ open: n,
1764
+ onClose: a,
1765
+ pastOneOff: o,
1766
+ masterBankClusters: i
1767
+ }) => {
1768
+ if (!n || !o) return null;
1769
+ const l = pn(o), d = wn(o, i), c = d.reduce((v, k) => v + k.questions.length, 0);
1770
+ return /* @__PURE__ */ t("div", { onClick: a, className: e["v2-launch-modal-overlay"], children: /* @__PURE__ */ s("div", { onClick: (v) => v.stopPropagation(), className: e["v2-view-modal"], children: [
1771
+ /* @__PURE__ */ s("div", { className: e["v2-view-modal__header"], children: [
1772
+ /* @__PURE__ */ t(
1773
+ "button",
1774
+ {
1775
+ type: "button",
1776
+ onClick: a,
1777
+ className: e["v2-view-modal__btn-close"],
1778
+ title: "Close modal",
1779
+ children: /* @__PURE__ */ t(Ie, { size: 18, color: "#6B6B6B" })
1780
+ }
1781
+ ),
1782
+ /* @__PURE__ */ t("div", { className: e["v2-view-modal__icon-box"], children: /* @__PURE__ */ t(Je, { size: 22, color: "#A56F1A" }) }),
1783
+ /* @__PURE__ */ s("div", { className: e["v2-view-modal__title-wrap"], children: [
1784
+ /* @__PURE__ */ t("div", { className: e["v2-view-modal__title"], children: o.name || "One-off check-in" }),
1785
+ /* @__PURE__ */ t("div", { className: e["v2-view-modal__meta"], children: `${c || o.questionCount} questions · ${o.responseCount} of ${o.totalTeachers} responded` })
1786
+ ] })
1787
+ ] }),
1788
+ /* @__PURE__ */ s("div", { className: e["v2-view-modal__body"], children: [
1789
+ l.length > 0 && /* @__PURE__ */ s("div", { className: e["v2-view-modal__sent-section"], children: [
1790
+ /* @__PURE__ */ t("span", { className: e["v2-view-modal__section-label"], children: l.length > 1 ? "SCHEDULED & SENT DATES" : "SENT ON" }),
1791
+ /* @__PURE__ */ t("div", { className: e["v2-view-modal__sent-badges-list"], children: l.map((v, k) => {
1792
+ const u = at(v);
1793
+ return /* @__PURE__ */ s(
1794
+ "div",
1795
+ {
1796
+ className: `${e["v2-view-modal__sent-badge"]} ${u ? e["v2-view-modal__sent-badge--past"] : e["v2-view-modal__sent-badge--future"]}`,
1797
+ children: [
1798
+ /* @__PURE__ */ t(Ge, { size: 15, color: u ? "#9CA3AF" : "#2563EB" }),
1799
+ /* @__PURE__ */ t("span", { children: Ne(v) })
1800
+ ]
1801
+ },
1802
+ v || k
1803
+ );
1804
+ }) })
1805
+ ] }),
1806
+ /* @__PURE__ */ s("div", { className: e["v2-view-modal__questions-section"], children: [
1807
+ /* @__PURE__ */ t("span", { className: e["v2-view-modal__section-label"], children: "QUESTIONS" }),
1808
+ d.length === 0 ? /* @__PURE__ */ t("div", { className: e["v2-view-modal__empty"], children: "No question details found for this check-in." }) : d.map(({ cluster: v, questions: k }) => /* @__PURE__ */ s("div", { className: e["v2-view-modal__cluster-group"], children: [
1809
+ /* @__PURE__ */ t("div", { className: e["v2-view-modal__cluster-header"], children: v.label || v.name }),
1810
+ /* @__PURE__ */ t("div", { className: e["v2-view-modal__questions-list"], children: k.map((u, h) => /* @__PURE__ */ s("div", { className: e["v2-view-modal__question-row"], children: [
1811
+ /* @__PURE__ */ t("span", { className: e["v2-view-modal__question-num"], children: h + 1 }),
1812
+ /* @__PURE__ */ t("span", { className: e["v2-view-modal__question-text"], children: Me(u.text) })
1813
+ ] }, u.id || h)) })
1814
+ ] }, v.id))
1815
+ ] })
1816
+ ] }),
1817
+ /* @__PURE__ */ t("div", { className: e["v2-view-modal__footer-single"], children: /* @__PURE__ */ t(
1818
+ "button",
1819
+ {
1820
+ type: "button",
1821
+ onClick: a,
1822
+ className: e["v2-view-modal__btn-close-footer"],
1823
+ children: "Close"
1824
+ }
1825
+ ) })
1826
+ ] }) });
1827
+ }, On = ({
1828
+ open: n,
1829
+ onClose: a,
1830
+ pastOneOff: o,
1831
+ onConfirm: i
1832
+ }) => {
1833
+ const [l, d] = N("");
1834
+ if (!n || !o) return null;
1835
+ const c = bn(o), v = l && p(l, S).isValid() ? p(l, S) : null, k = !!(l && p(l, S).isValid() && !c.has(l)), u = ot(o), h = () => {
1836
+ if (k) {
1837
+ if (c.has(l)) {
1838
+ D("This check-in has already been scheduled or sent on this date.", "warning");
1839
+ return;
1840
+ }
1841
+ i ? i(o, l) : D(`Scheduled "${o.name}" to send on ${p(l).format(be)}`, "success"), a();
1842
+ }
1843
+ };
1844
+ return /* @__PURE__ */ t("div", { onClick: a, className: e["v2-launch-modal-overlay"], children: /* @__PURE__ */ s("div", { onClick: (_) => _.stopPropagation(), className: e["v2-launch-modal"], children: [
1845
+ /* @__PURE__ */ t(
1846
+ "button",
1847
+ {
1848
+ type: "button",
1849
+ onClick: a,
1850
+ className: e["v2-launch-modal__btn-close"],
1851
+ children: /* @__PURE__ */ t(Ie, { size: 18, color: "#6B6B6B" })
1852
+ }
1853
+ ),
1854
+ /* @__PURE__ */ t("div", { className: e["v2-sendagain-modal__icon-box"], children: /* @__PURE__ */ t(ve, { size: 24, color: "#316CD9" }) }),
1855
+ /* @__PURE__ */ t("div", { className: e["v2-launch-modal__title"], children: "Send it again" }),
1856
+ /* @__PURE__ */ s("p", { className: e["v2-launch-modal__sub"], children: [
1857
+ "“",
1858
+ o.name,
1859
+ "” will be sent again with the same ",
1860
+ u,
1861
+ " question",
1862
+ u > 1 ? "s" : "",
1863
+ ". Choose the date it should go out."
1864
+ ] }),
1865
+ /* @__PURE__ */ t("div", { className: e["v2-launch-modal__form"], children: /* @__PURE__ */ s("div", { children: [
1866
+ /* @__PURE__ */ t("span", { className: e["v2-launch-modal__field-label"], children: "SEND DATE" }),
1867
+ /* @__PURE__ */ t(Oe, { dateAdapter: Ee, children: /* @__PURE__ */ t(
1868
+ Ae,
1869
+ {
1870
+ value: v,
1871
+ minDate: p().startOf("day"),
1872
+ shouldDisableDate: (_) => {
1873
+ if (!_ || !_.isValid()) return !1;
1874
+ const w = _.format(S);
1875
+ return c.has(w);
1876
+ },
1877
+ onChange: (_) => {
1878
+ const w = _ && p(_).isValid() ? p(_).format(S) : "";
1879
+ if (w && c.has(w)) {
1880
+ D("This check-in has already been scheduled or sent on this date.", "warning");
1881
+ return;
1882
+ }
1883
+ d(w);
1884
+ },
1885
+ format: be,
1886
+ slotProps: {
1887
+ textField: {
1888
+ fullWidth: !0,
1889
+ variant: "outlined",
1890
+ placeholder: "mm/dd/yyyy",
1891
+ sx: {
1892
+ background: "#fff",
1893
+ "& .MuiOutlinedInput-root": {
1894
+ borderRadius: "12px",
1895
+ fontSize: "15px",
1896
+ fontWeight: 500,
1897
+ color: "#242424",
1898
+ height: 48,
1899
+ "& fieldset": {
1900
+ borderColor: "#D3D3D3"
1901
+ },
1902
+ "&:hover fieldset": {
1903
+ borderColor: "#316CD9"
1904
+ },
1905
+ "&.Mui-focused fieldset": {
1906
+ borderColor: "#316CD9"
1907
+ }
1908
+ },
1909
+ "& .MuiInputBase-input": {
1910
+ padding: "12px 14px"
1911
+ }
1912
+ }
1913
+ }
1914
+ }
1915
+ }
1916
+ ) })
1917
+ ] }) }),
1918
+ /* @__PURE__ */ s("div", { className: e["v2-launch-modal__actions"], children: [
1919
+ /* @__PURE__ */ t(
1920
+ "button",
1921
+ {
1922
+ type: "button",
1923
+ onClick: a,
1924
+ className: e["v2-launch-modal__btn-cancel"],
1925
+ children: "Cancel"
1926
+ }
1927
+ ),
1928
+ /* @__PURE__ */ s(
1929
+ "button",
1930
+ {
1931
+ type: "button",
1932
+ onClick: h,
1933
+ disabled: !k,
1934
+ className: `${e["v2-launch-modal__btn-start"]} ${k ? e["v2-launch-modal__btn-start--valid"] : ""}`,
1935
+ children: [
1936
+ /* @__PURE__ */ t(ve, { size: 18, color: "#fff" }),
1937
+ " Schedule send"
1938
+ ]
1939
+ }
1940
+ )
1941
+ ] })
1942
+ ] }) });
1943
+ }, An = ({
1944
+ clusters: n,
1945
+ onChangeClusters: a,
1946
+ pastOneOffs: o,
1947
+ masterBankClusters: i = ie,
1948
+ onSaveAndContinue: l,
1949
+ onSendItAgain: d,
1950
+ isOn: c = !0,
1951
+ onToggle: v
1952
+ }) => {
1953
+ const [k, u] = N(!0), h = c !== void 0 ? c : k, _ = () => {
1954
+ v ? v(!h) : u((T) => !T);
1955
+ }, [w, q] = N(!1), [C, I] = N(""), [z, B] = N(null), [R, L] = N(null), F = (T, Q) => {
1956
+ d ? d(T, Q) : D(`Scheduled "${T.name}" to send on ${p(Q).format(be)}`, "success"), L(null);
1957
+ }, A = st(n), X = !C.trim() || A === 0;
1958
+ return /* @__PURE__ */ s("div", { className: e["v2-oneoff-container"], children: [
1959
+ /* @__PURE__ */ s("div", { className: `${e["v2-power-card"]} ${h ? e["v2-power-card--active"] : ""}`, children: [
1960
+ /* @__PURE__ */ t("span", { className: e["v2-power-card__icon"], children: /* @__PURE__ */ t(qe, { size: 22, color: h ? "#316CD9" : "#858585" }) }),
1961
+ /* @__PURE__ */ s("div", { className: e["v2-power-card__content"], children: [
1962
+ /* @__PURE__ */ t("div", { className: e["v2-power-card__title"], children: "One-off check-in" }),
1963
+ /* @__PURE__ */ t("div", { className: e["v2-power-card__sub"], children: "Turn this on to build and send a single check-in. It does not repeat, and it does not affect your routine or comprehensive schedules." })
1964
+ ] }),
1965
+ /* @__PURE__ */ t("span", { className: `${e["v2-power-card__state-text"]} ${h ? e["v2-power-card__state-text--active"] : ""}`, children: h ? "On" : "Off" }),
1966
+ /* @__PURE__ */ t(
1967
+ "button",
1968
+ {
1969
+ type: "button",
1970
+ onClick: _,
1971
+ className: `${e["v2-power-card__switch"]} ${h ? e["v2-power-card__switch--active"] : ""}`,
1972
+ children: /* @__PURE__ */ t("span", { className: `${e["v2-power-card__knob"]} ${h ? e["v2-power-card__knob--active"] : ""}` })
1973
+ }
1974
+ )
1975
+ ] }),
1976
+ /* @__PURE__ */ s("div", { className: e["v2-oneoff-accordion"], children: [
1977
+ /* @__PURE__ */ s(
1978
+ "button",
1979
+ {
1980
+ type: "button",
1981
+ onClick: () => q((T) => !T),
1982
+ className: e["v2-oneoff-accordion__header"],
1983
+ children: [
1984
+ /* @__PURE__ */ t("span", { className: e["v2-oneoff-accordion__icon-box"], children: /* @__PURE__ */ t(Je, { size: 20, color: "#A56F1A" }) }),
1985
+ /* @__PURE__ */ s("div", { className: e["v2-oneoff-accordion__title-group"], children: [
1986
+ /* @__PURE__ */ t("div", { className: e["v2-oneoff-accordion__title"], children: "Previous one-off check-ins" }),
1987
+ /* @__PURE__ */ s("div", { className: e["v2-oneoff-accordion__subtitle"], children: [
1988
+ o.length,
1989
+ " sent. Review what went out and reuse it as a starting point."
1990
+ ] })
1991
+ ] }),
1992
+ w ? /* @__PURE__ */ t(Te, { size: 18, color: "#6B6B6B" }) : /* @__PURE__ */ t(zt, { size: 18, color: "#6B6B6B" })
1993
+ ]
1994
+ }
1995
+ ),
1996
+ w && /* @__PURE__ */ t("div", { className: e["v2-oneoff-accordion__body"], children: o.length === 0 ? /* @__PURE__ */ t("div", { className: e["v2-oneoff-accordion__empty"], children: "No previous one-off check-ins found." }) : o.map((T, Q) => {
1997
+ const H = gn(T);
1998
+ return /* @__PURE__ */ s(
1999
+ "div",
2000
+ {
2001
+ className: e["v2-oneoff-accordion__item"],
2002
+ children: [
2003
+ /* @__PURE__ */ s("div", { className: e["v2-oneoff-accordion__item-info"], children: [
2004
+ /* @__PURE__ */ t("div", { className: e["v2-oneoff-accordion__item-name"], children: T.name }),
2005
+ /* @__PURE__ */ t("div", { className: e["v2-oneoff-accordion__item-meta"], children: `Sent ${H} · ${ot(T)} questions · ${T.responseCount || 0} of ${T.totalTeachers || 0} responded` })
2006
+ ] }),
2007
+ /* @__PURE__ */ s("div", { className: e["v2-oneoff-accordion__item-actions"], children: [
2008
+ /* @__PURE__ */ s(
2009
+ "button",
2010
+ {
2011
+ type: "button",
2012
+ onClick: () => B(T),
2013
+ className: e["v2-oneoff-accordion__btn-view"],
2014
+ children: [
2015
+ /* @__PURE__ */ t(De, { size: 15, color: "#4B5563" }),
2016
+ " View"
2017
+ ]
2018
+ }
2019
+ ),
2020
+ /* @__PURE__ */ s(
2021
+ "button",
2022
+ {
2023
+ type: "button",
2024
+ onClick: () => L(T),
2025
+ className: e["v2-oneoff-accordion__btn-send-again"],
2026
+ children: [
2027
+ /* @__PURE__ */ t(ve, { size: 14, color: "#316CD9" }),
2028
+ " Send it again"
2029
+ ]
2030
+ }
2031
+ )
2032
+ ] })
2033
+ ]
2034
+ },
2035
+ T.id || Q
2036
+ );
2037
+ }) })
2038
+ ] }),
2039
+ /* @__PURE__ */ t(
2040
+ Tn,
2041
+ {
2042
+ open: !!z,
2043
+ onClose: () => B(null),
2044
+ pastOneOff: z,
2045
+ masterBankClusters: i
2046
+ }
2047
+ ),
2048
+ R && /* @__PURE__ */ t(
2049
+ On,
2050
+ {
2051
+ open: !!R,
2052
+ onClose: () => L(null),
2053
+ pastOneOff: R,
2054
+ onConfirm: F
2055
+ },
2056
+ R.id
2057
+ ),
2058
+ h && /* @__PURE__ */ s(pe, { children: [
2059
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
2060
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
2061
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "1" }),
2062
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "Name this check-in" })
2063
+ ] }),
2064
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "Give it a name so you can find it later. The name appears in the list of previous one-off check-ins and is not shown to staff." }),
2065
+ /* @__PURE__ */ s("div", { className: e["v2-name-box"], children: [
2066
+ /* @__PURE__ */ t("span", { className: e["v2-name-box__label"], children: "CHECK-IN NAME" }),
2067
+ /* @__PURE__ */ t(
2068
+ "input",
2069
+ {
2070
+ type: "text",
2071
+ value: C,
2072
+ onChange: (T) => I(T.target.value),
2073
+ placeholder: "e.g. Start of term pulse",
2074
+ className: e["v2-name-box__input"]
2075
+ }
2076
+ ),
2077
+ /* @__PURE__ */ t("span", { className: e["v2-name-box__hint"], children: "Required before sending." })
2078
+ ] })
2079
+ ] }),
2080
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
2081
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
2082
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: "2" }),
2083
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "Build your questions" })
2084
+ ] }),
2085
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: "A one-off check-in starts blank. Add questions to any cluster, tag them, and set their descriptors before sending." }),
2086
+ /* @__PURE__ */ t(
2087
+ $e,
2088
+ {
2089
+ clusters: n,
2090
+ onChangeClusters: a,
2091
+ blank: !0,
2092
+ masterBankClusters: i,
2093
+ scope: "oneoff"
2094
+ }
2095
+ )
2096
+ ] }),
2097
+ /* @__PURE__ */ s("div", { className: e["v2-section-box"], children: [
2098
+ /* @__PURE__ */ s("div", { className: e["v2-section-box__header"], children: [
2099
+ /* @__PURE__ */ t("span", { className: e["v2-section-box__num"], children: /* @__PURE__ */ t(ve, { size: 16, color: "#fff" }) }),
2100
+ /* @__PURE__ */ t("div", { className: e["v2-section-box__title"], children: "Send the check-in" })
2101
+ ] }),
2102
+ /* @__PURE__ */ t("p", { className: e["v2-section-box__sub"], children: C.trim() ? `“${C.trim()}” will be sent once to all teachers. You'll choose the start date next.` : "Send this one-time staff check-in to all teachers. You'll choose the start date next." }),
2103
+ !C.trim() && /* @__PURE__ */ s("div", { className: e["v2-send-warning-box"], children: [
2104
+ /* @__PURE__ */ t(gt, { size: 16, color: "#B45309", className: e["v2-send-warning-box__icon"] }),
2105
+ /* @__PURE__ */ t("span", { children: "Add a name above before sending, so this check-in shows correctly in your list." })
2106
+ ] }),
2107
+ /* @__PURE__ */ s(
2108
+ "button",
2109
+ {
2110
+ type: "button",
2111
+ onClick: () => l(C.trim()),
2112
+ disabled: X,
2113
+ className: e["v2-btn-primary"],
2114
+ title: C.trim() ? A === 0 ? "Please add at least 1 question to continue" : "" : "Please enter a check-in name to continue",
2115
+ children: [
2116
+ /* @__PURE__ */ t(Se, { size: 20, color: "#fff" }),
2117
+ "Save & continue"
2118
+ ]
2119
+ }
2120
+ )
2121
+ ] })
2122
+ ] })
2123
+ ] });
2124
+ }, En = ({
2125
+ size: n = 40,
2126
+ color: a = "#0F9655",
2127
+ ...o
2128
+ }) => /* @__PURE__ */ s(
2129
+ "svg",
2130
+ {
2131
+ xmlns: "http://www.w3.org/2000/svg",
2132
+ width: n,
2133
+ height: n,
2134
+ viewBox: "0 0 24 24",
2135
+ fill: "none",
2136
+ stroke: a,
2137
+ strokeWidth: "2.2",
2138
+ strokeLinecap: "round",
2139
+ strokeLinejoin: "round",
2140
+ ...o,
2141
+ children: [
2142
+ /* @__PURE__ */ t("circle", { cx: "12", cy: "12", r: "10" }),
2143
+ /* @__PURE__ */ t("path", { d: "m9 12 2 2 4-4" })
2144
+ ]
2145
+ }
2146
+ ), Mn = ({
2147
+ data: n,
2148
+ loading: a = !1,
2149
+ hasError: o = !1,
2150
+ onRetry: i,
2151
+ onEditMode: l,
2152
+ onToggleRoutine: d,
2153
+ onToggleComprehensive: c,
2154
+ onToggleOneOff: v,
2155
+ isOneOffEnabled: k
2156
+ }) => {
2157
+ const u = Qt(), h = n.routine, _ = n.comprehensive, w = k !== void 0 ? k : n.isOneOffEnabled !== !1, q = () => mn(h, n.routineLaunchDate), C = () => hn(_, n.comprehensiveLaunchDate), I = [
2158
+ {
2159
+ id: "routine",
2160
+ title: "Routine check-in",
2161
+ icon: /* @__PURE__ */ t(We, { size: 20, color: "#316CD9" }),
2162
+ iconModifierClass: e["v2-saved-item__icon--routine"],
2163
+ subText: q(),
2164
+ loadingText: "Loading routine status...",
2165
+ errorText: "Unable to load routine status",
2166
+ isEnabled: !!h.isEnabled,
2167
+ onToggle: () => d && d(!h.isEnabled)
2168
+ },
2169
+ {
2170
+ id: "comprehensive",
2171
+ title: "Comprehensive check-in",
2172
+ icon: /* @__PURE__ */ t(Ue, { size: 20, color: "#0284C7" }),
2173
+ iconModifierClass: e["v2-saved-item__icon--comprehensive"],
2174
+ subText: C(),
2175
+ loadingText: "Loading survey status...",
2176
+ errorText: "Unable to load survey status",
2177
+ isEnabled: !!_.isEnabled,
2178
+ onToggle: () => c && c(!_.isEnabled)
2179
+ },
2180
+ {
2181
+ id: "oneoff",
2182
+ title: "One-off check-in",
2183
+ icon: /* @__PURE__ */ t(qe, { size: 20, color: "#D97706" }),
2184
+ iconModifierClass: e["v2-saved-item__icon--oneoff"],
2185
+ subText: "Off — turn on to build and send a one-time check-in",
2186
+ loadingText: "Loading one-off status...",
2187
+ errorText: void 0,
2188
+ isEnabled: !!w,
2189
+ onToggle: () => v ? v(!w) : l("oneoff")
2190
+ }
2191
+ ];
2192
+ return /* @__PURE__ */ t("div", { className: e["v2-saved-wrapper"], children: /* @__PURE__ */ s("div", { className: e["v2-saved-card"], children: [
2193
+ /* @__PURE__ */ t("div", { className: `${e["v2-saved-badge"]} ${o ? e["v2-saved-error-badge"] : ""}`, children: o ? /* @__PURE__ */ t(Xe, { size: 36, color: "#DC2626" }) : /* @__PURE__ */ t(En, { size: 38, color: "#0F9655" }) }),
2194
+ /* @__PURE__ */ t("h2", { className: e["v2-saved-title"], children: o ? "Unable to load settings" : "Staff check-in saved" }),
2195
+ a ? /* @__PURE__ */ s("div", { className: e["v2-saved-loading-wrap"], children: [
2196
+ /* @__PURE__ */ t(ge, { size: 18 }),
2197
+ /* @__PURE__ */ t("span", { className: e["v2-saved-loading-wrap__text"], children: "Loading staff check-in configuration..." })
2198
+ ] }) : o ? /* @__PURE__ */ s("p", { className: e["v2-saved-desc"], children: [
2199
+ "Failed to fetch setup configuration from server.",
2200
+ " ",
2201
+ i && /* @__PURE__ */ t(
2202
+ "button",
2203
+ {
2204
+ type: "button",
2205
+ onClick: i,
2206
+ className: e["v2-saved-retry-btn"],
2207
+ children: "Click here to retry"
2208
+ }
2209
+ )
2210
+ ] }) : /* @__PURE__ */ s("p", { className: e["v2-saved-desc"], children: [
2211
+ "Your staff check-in is scheduled and will start launching on",
2212
+ " ",
2213
+ /* @__PURE__ */ s("strong", { children: [
2214
+ fn(n),
2215
+ "."
2216
+ ] }),
2217
+ " Teachers will be notified when it goes live."
2218
+ ] }),
2219
+ /* @__PURE__ */ t("div", { className: e["v2-saved-list"], children: I.map((z) => /* @__PURE__ */ s("div", { className: e["v2-saved-item"], children: [
2220
+ /* @__PURE__ */ t("div", { className: `${e["v2-saved-item__icon"]} ${z.iconModifierClass}`, children: z.icon }),
2221
+ /* @__PURE__ */ s("div", { className: e["v2-saved-item__info"], children: [
2222
+ /* @__PURE__ */ t("div", { className: e["v2-saved-item__title"], children: z.title }),
2223
+ /* @__PURE__ */ t("div", { className: e["v2-saved-item__sub"], children: a ? /* @__PURE__ */ s("div", { className: e["v2-saved-item-loading"], children: [
2224
+ /* @__PURE__ */ t(ge, { size: 14, defaultColor: !1 }),
2225
+ /* @__PURE__ */ t("span", { className: e["v2-saved-item-loading__text"], children: z.loadingText })
2226
+ ] }) : o && z.errorText ? /* @__PURE__ */ t("span", { className: e["v2-saved-error-text"], children: z.errorText }) : z.subText })
2227
+ ] }),
2228
+ /* @__PURE__ */ s("div", { className: e["v2-saved-item__actions"], children: [
2229
+ a ? /* @__PURE__ */ t("div", { className: e["v2-saved-item-spinner"], children: /* @__PURE__ */ t(ge, { size: 16 }) }) : o && z.errorText ? /* @__PURE__ */ t("span", { className: e["v2-saved-item-dash"], children: "—" }) : /* @__PURE__ */ s("div", { className: e["v2-saved-item__switch-box"], children: [
2230
+ /* @__PURE__ */ t("span", { children: z.isEnabled ? "On" : "Off" }),
2231
+ /* @__PURE__ */ t(
2232
+ "button",
2233
+ {
2234
+ type: "button",
2235
+ onClick: z.onToggle,
2236
+ className: `${e["v2-saved-item__switch"]} ${z.isEnabled ? e["v2-saved-item__switch--on"] : ""}`,
2237
+ children: /* @__PURE__ */ t("span", { className: `${e["v2-saved-item__knob"]} ${z.isEnabled ? e["v2-saved-item__knob--on"] : ""}` })
2238
+ }
2239
+ )
2240
+ ] }),
2241
+ /* @__PURE__ */ s(
2242
+ "button",
2243
+ {
2244
+ type: "button",
2245
+ disabled: a || o,
2246
+ onClick: () => l(z.id),
2247
+ className: e["v2-saved-item__btn-edit"],
2248
+ children: [
2249
+ /* @__PURE__ */ t(Ce, { size: 14 }),
2250
+ /* @__PURE__ */ t("span", { children: "Edit" })
2251
+ ]
2252
+ }
2253
+ )
2254
+ ] })
2255
+ ] }, z.id)) }),
2256
+ /* @__PURE__ */ s(
2257
+ "button",
2258
+ {
2259
+ type: "button",
2260
+ onClick: () => u("/admin/well-being-dashboard"),
2261
+ className: e["v2-saved-btn-dashboard"],
2262
+ children: [
2263
+ /* @__PURE__ */ t(yt, { size: 18 }),
2264
+ /* @__PURE__ */ t("span", { children: "Go to dashboard" })
2265
+ ]
2266
+ }
2267
+ )
2268
+ ] }) });
2269
+ }, ne = (n, a) => {
2270
+ if (!a || !n) return n;
2271
+ const o = /* @__PURE__ */ new Map();
2272
+ return a.forEach((i) => {
2273
+ i.questions?.forEach((l) => {
2274
+ l.id && o.set(l.id, { question: l, clusterId: i.id });
2275
+ });
2276
+ }), n.map((i) => {
2277
+ let l = [...i.questions || []];
2278
+ return l = l.map((d) => {
2279
+ if (d.id && o.has(d.id)) {
2280
+ const v = o.get(d.id).question;
2281
+ return {
2282
+ ...d,
2283
+ text: v.text,
2284
+ descriptors: v.descriptors !== void 0 ? v.descriptors : d.descriptors,
2285
+ includedInBulk: v.includedInBulk !== void 0 ? v.includedInBulk : d.includedInBulk,
2286
+ isAppliedToAllClusters: v.isAppliedToAllClusters !== void 0 ? v.isAppliedToAllClusters : d.isAppliedToAllClusters,
2287
+ clusterId: v.clusterId !== void 0 ? v.clusterId : d.clusterId,
2288
+ sectionName: v.sectionName !== void 0 ? v.sectionName : d.sectionName,
2289
+ kind: v.kind || d.kind
2290
+ };
2291
+ }
2292
+ return d;
2293
+ }), a.forEach((d) => {
2294
+ d.questions?.forEach((c) => {
2295
+ c.id && c.kind !== "open" && (d.id === i.id ? l.some((k) => k.id === c.id) || n.some(
2296
+ (u) => u.id !== i.id && u.questions?.some((h) => h.id === c.id)
2297
+ ) && l.push({ ...c }) : a.some(
2298
+ (k) => k.id !== i.id && k.questions?.some((u) => u.id === c.id)
2299
+ ) && (l = l.filter((k) => k.id !== c.id)));
2300
+ });
2301
+ }), {
2302
+ ...i,
2303
+ questions: l
2304
+ };
2305
+ });
2306
+ }, $n = () => {
2307
+ const o = `WELLBEING_ONE_OFF_DRAFT_${Pt((r) => r.common?.user)?.id || localStorage.getItem("USER_EMAIL") || "default_user"}`, [i, l] = N(!0), [d, c] = N(!1), [v, k] = N(!1), [u, h] = N("routine"), [_, w] = N(!0), [q, C] = N(!1), [I, z] = N("routine"), [B, R] = N(null), [L, F] = N(null), [A, X] = N(null), [T, Q] = N(1), [H, W] = N(!0), [j, Y] = N(ye.routine), [P, G] = N(ye.comprehensive), [J, U] = N(ie), [m, b] = N(ie), [$, O] = N(ie), [E, K] = N(() => {
2308
+ try {
2309
+ const r = localStorage.getItem(o);
2310
+ if (r) {
2311
+ const y = JSON.parse(r);
2312
+ if (localStorage.removeItem(o), y?.clusters && Array.isArray(y.clusters) && y.clusters.reduce((Z, se) => Z + (se.questions?.length || 0), 0) > 0)
2313
+ return y.clusters;
2314
+ }
2315
+ } catch {
2316
+ }
2317
+ return ie.map((r) => ({ ...r, questions: [] }));
2318
+ }), [ee, ae] = N(!1), [g, f] = N(null), M = Ve(!0);
2319
+ de(() => {
2320
+ if (M.current) {
2321
+ M.current = !1;
2322
+ return;
2323
+ }
2324
+ try {
2325
+ if (E.reduce((y, x) => y + (x.questions?.length || 0), 0) > 0) {
2326
+ const y = (/* @__PURE__ */ new Date()).toISOString();
2327
+ localStorage.setItem(o, JSON.stringify({
2328
+ clusters: E,
2329
+ updatedAt: y
2330
+ }));
2331
+ } else
2332
+ localStorage.removeItem(o);
2333
+ } catch (r) {
2334
+ console.error("Error saving one-off draft to storage", r);
2335
+ }
2336
+ }, [E, o]), de(() => {
2337
+ const r = () => {
2338
+ try {
2339
+ E.reduce((x, Z) => x + (Z.questions?.length || 0), 0) > 0 && localStorage.setItem(o, JSON.stringify({
2340
+ clusters: E,
2341
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
2342
+ }));
2343
+ } catch {
2344
+ }
2345
+ };
2346
+ return window.addEventListener("beforeunload", r), () => window.removeEventListener("beforeunload", r);
2347
+ }, [E, o]);
2348
+ const V = () => {
2349
+ try {
2350
+ localStorage.removeItem(o), ae(!1), f(null), K($.map((r) => ({ ...r, questions: [] }))), D("Draft cleared. Starting with a blank form.", "info");
2351
+ } catch (r) {
2352
+ console.error("Error clearing draft", r);
2353
+ }
2354
+ }, [re, te] = N(ye.pastOneOffs), me = le((r) => {
2355
+ if (Q(r.setupId || 1), r.isOneOffEnabled !== void 0 && W(r.isOneOffEnabled), r.launchDate && R(r.launchDate), r.routineLaunchDate && F(r.routineLaunchDate), r.comprehensiveLaunchDate && X(r.comprehensiveLaunchDate), r.routine && Y(r.routine), r.comprehensive) {
2356
+ const se = [...r.comprehensive.sendDates || []].sort((oe, bt) => new Date(oe).getTime() - new Date(bt).getTime());
2357
+ G({ ...r.comprehensive, sendDates: se });
2358
+ }
2359
+ const y = r.routineClusters && r.routineClusters.length > 0 ? r.routineClusters : r.clusters || ie, x = r.comprehensiveClusters && r.comprehensiveClusters.length > 0 ? r.comprehensiveClusters : r.clusters || ie, Z = r.masterBankClusters && r.masterBankClusters.length > 0 ? r.masterBankClusters : r.clusters || ie;
2360
+ U(y), b(x), O(Z);
2361
+ try {
2362
+ localStorage.getItem(o) || K(Z.map((oe) => ({ ...oe, questions: [] })));
2363
+ } catch {
2364
+ }
2365
+ r.pastOneOffs && r.pastOneOffs.length > 0 && te(r.pastOneOffs);
2366
+ }, [o]), ke = le(async () => {
2367
+ try {
2368
+ l(!0), c(!1);
2369
+ const r = await Qe();
2370
+ r.data && me(r.data);
2371
+ } catch (r) {
2372
+ console.error("Failed to load wellbeing setup v2, using defaults", r), c(!0);
2373
+ } finally {
2374
+ l(!1);
2375
+ }
2376
+ }, [me]);
2377
+ de(() => {
2378
+ let r = !0;
2379
+ return (async () => {
2380
+ try {
2381
+ const x = await Qe();
2382
+ r && x.data && me(x.data);
2383
+ } catch (x) {
2384
+ r && (console.error("Failed to load wellbeing setup v2, using defaults", x), c(!0));
2385
+ } finally {
2386
+ r && l(!1);
2387
+ }
2388
+ })(), () => {
2389
+ r = !1;
2390
+ };
2391
+ }, [me]);
2392
+ const lt = (r) => {
2393
+ u !== r && (h(r), w(!1));
2394
+ }, ct = () => {
2395
+ w(!0);
2396
+ }, dt = async (r) => {
2397
+ try {
2398
+ k(!0), await ce({
2399
+ scope: "routine",
2400
+ routine: j,
2401
+ clusters: J,
2402
+ routineLaunchDate: r,
2403
+ launchDate: r
2404
+ }), F(r), R(r), D("Routine check-in configuration saved successfully", "success"), C(!1), w(!0);
2405
+ } catch (y) {
2406
+ console.error("Failed to save routine setup", y), D("Failed to save configuration", "error");
2407
+ } finally {
2408
+ k(!1);
2409
+ }
2410
+ }, _t = async (r, y) => {
2411
+ try {
2412
+ k(!0);
2413
+ const x = y || P.sendDates, Z = {
2414
+ ...P,
2415
+ sendDates: x
2416
+ };
2417
+ await ce({
2418
+ scope: "comprehensive",
2419
+ comprehensive: Z,
2420
+ clusters: m,
2421
+ comprehensiveLaunchDate: r,
2422
+ launchDate: r
2423
+ }), G(Z), X(r), R(r), D("Comprehensive survey configuration saved successfully", "success"), C(!1), w(!0);
2424
+ } catch (x) {
2425
+ console.error("Failed to save comprehensive setup", x), D("Failed to save configuration", "error");
2426
+ } finally {
2427
+ k(!1);
2428
+ }
2429
+ }, vt = async (r, y) => {
2430
+ try {
2431
+ k(!0);
2432
+ const x = [];
2433
+ if (E.forEach((se) => {
2434
+ se.questions.forEach((oe) => {
2435
+ oe.isEnabled && x.push(Number(oe.id));
2436
+ });
2437
+ }), x.length === 0) {
2438
+ D("Please select at least one question before launching.", "warning");
2439
+ return;
2440
+ }
2441
+ const Z = y?.trim() || `One-off pulse (${r})`;
2442
+ await Ft({
2443
+ name: Z,
2444
+ startDate: r,
2445
+ questionIds: x,
2446
+ questions: E.flatMap(
2447
+ (se) => se.questions.map((oe) => ({
2448
+ id: Number(oe.id),
2449
+ text: oe.text,
2450
+ clusterId: se.id,
2451
+ kind: oe.kind,
2452
+ descriptors: oe.descriptors || null
2453
+ }))
2454
+ )
2455
+ }), await ke();
2456
+ try {
2457
+ localStorage.removeItem(o), ae(!1), f(null), K($.map((se) => ({ ...se, questions: [] })));
2458
+ } catch {
2459
+ }
2460
+ D("One-off check-in launched successfully", "success"), C(!1), w(!0);
2461
+ } catch (x) {
2462
+ console.error("Failed to create one-off check-in", x), D("Failed to launch one-off check-in", "error");
2463
+ } finally {
2464
+ k(!1);
2465
+ }
2466
+ }, ut = async (r, y) => {
2467
+ try {
2468
+ k(!0), await Rt({ oneOffId: r.id, sendDate: y }), D(`Scheduled "${r.name}" to send on ${y}`, "success"), await ke();
2469
+ } catch (x) {
2470
+ console.error("Failed to schedule send it again", x), D("Failed to schedule send", "error");
2471
+ } finally {
2472
+ k(!1);
2473
+ }
2474
+ }, mt = async (r) => {
2475
+ const y = { ...j, isEnabled: r };
2476
+ Y(y);
2477
+ try {
2478
+ await ce({
2479
+ scope: "routine",
2480
+ routine: y,
2481
+ clusters: J
2482
+ }), D(r ? "Routine check-in enabled" : "Routine check-in disabled", "info");
2483
+ } catch (x) {
2484
+ console.error("Failed to toggle routine", x), D("Failed to update routine status", "error");
2485
+ }
2486
+ }, ht = async (r) => {
2487
+ const y = { ...P, isEnabled: r };
2488
+ G(y);
2489
+ try {
2490
+ await ce({
2491
+ scope: "comprehensive",
2492
+ comprehensive: y,
2493
+ clusters: m
2494
+ }), D(r ? "Comprehensive survey enabled" : "Comprehensive survey disabled", "info");
2495
+ } catch (x) {
2496
+ console.error("Failed to toggle comprehensive", x), D("Failed to update comprehensive status", "error");
2497
+ }
2498
+ }, ft = async (r) => {
2499
+ W(r);
2500
+ try {
2501
+ await ce({
2502
+ scope: "oneoff",
2503
+ isOneOffEnabled: r
2504
+ }), D(r ? "One-off check-in enabled" : "One-off check-in disabled", "info");
2505
+ } catch (y) {
2506
+ console.error("Failed to toggle one-off", y), D("Failed to update one-off status", "error");
2507
+ }
2508
+ }, we = le((r) => {
2509
+ U(r), b((y) => ne(y, r)), O((y) => ne(y, r)), K((y) => ne(y, r));
2510
+ }, []), Be = le((r) => {
2511
+ b(r), U((y) => ne(y, r)), O((y) => ne(y, r)), K((y) => ne(y, r));
2512
+ }, []), Le = le((r) => {
2513
+ O(r), U((y) => ne(y, r)), b((y) => ne(y, r)), K((y) => ne(y, r));
2514
+ }, []), Re = le((r) => {
2515
+ K(r);
2516
+ const y = r.reduce((x, Z) => x + (Z.questions?.length || 0), 0);
2517
+ f(y > 0 ? (/* @__PURE__ */ new Date()).toISOString() : null), U((x) => ne(x, r)), b((x) => ne(x, r)), O((x) => ne(x, r));
2518
+ }, []);
2519
+ return {
2520
+ loading: i,
2521
+ hasError: d,
2522
+ refetch: ke,
2523
+ saving: v,
2524
+ activeTab: u,
2525
+ setActiveTab: h,
2526
+ isSavedView: _,
2527
+ setIsSavedView: w,
2528
+ isLaunchModalOpen: q,
2529
+ setIsLaunchModalOpen: C,
2530
+ launchScope: I,
2531
+ setLaunchScope: z,
2532
+ launchDate: B,
2533
+ setLaunchDate: R,
2534
+ routineLaunchDate: L,
2535
+ setRoutineLaunchDate: F,
2536
+ comprehensiveLaunchDate: A,
2537
+ setComprehensiveLaunchDate: X,
2538
+ isOneOffEnabled: H,
2539
+ setIsOneOffEnabled: W,
2540
+ routineConfig: j,
2541
+ setRoutineConfig: Y,
2542
+ comprehensiveConfig: P,
2543
+ setComprehensiveConfig: G,
2544
+ clusters: J,
2545
+ setClusters: we,
2546
+ routineClusters: J,
2547
+ setRoutineClusters: we,
2548
+ comprehensiveClusters: m,
2549
+ setComprehensiveClusters: Be,
2550
+ masterBankClusters: $,
2551
+ setMasterBankClusters: Le,
2552
+ oneOffClusters: E,
2553
+ setOneOffClusters: Re,
2554
+ handleRoutineClustersChange: we,
2555
+ handleComprehensiveClustersChange: Be,
2556
+ handleMasterBankClustersChange: Le,
2557
+ handleOneOffClustersChange: Re,
2558
+ hasDraft: ee,
2559
+ draftSavedAt: g,
2560
+ handleClearDraft: V,
2561
+ pastOneOffs: re,
2562
+ fullSetupData: {
2563
+ setupId: T,
2564
+ isOneOffEnabled: H,
2565
+ launchDate: B,
2566
+ routineLaunchDate: L,
2567
+ comprehensiveLaunchDate: A,
2568
+ routine: j,
2569
+ comprehensive: P,
2570
+ clusters: J,
2571
+ routineClusters: J,
2572
+ comprehensiveClusters: m,
2573
+ masterBankClusters: $,
2574
+ pastOneOffs: re
2575
+ },
2576
+ handleSelectTab: lt,
2577
+ handleBackToOverview: ct,
2578
+ handleSaveRoutine: dt,
2579
+ handleSaveComprehensive: _t,
2580
+ handleLaunchOneOff: vt,
2581
+ handleSendItAgain: ut,
2582
+ handleToggleRoutine: mt,
2583
+ handleToggleComprehensive: ht,
2584
+ handleToggleOneOff: ft,
2585
+ handleRestoreDefaults: async (r) => {
2586
+ try {
2587
+ l(!0);
2588
+ const x = (await tt(r)).data;
2589
+ x && (x.routineClusters && U(x.routineClusters), x.comprehensiveClusters && b(x.comprehensiveClusters), x.masterBankClusters && O(x.masterBankClusters)), D("Default questions restored successfully", "success");
2590
+ } catch (y) {
2591
+ console.error("Failed to restore default questions", y), D("Failed to restore default questions", "error");
2592
+ } finally {
2593
+ l(!1);
2594
+ }
2595
+ }
2596
+ };
2597
+ }, Bn = ({
2598
+ onClose: n,
2599
+ onStart: a,
2600
+ initialDate: o,
2601
+ scope: i,
2602
+ comprehensiveSendDates: l
2603
+ }) => {
2604
+ const [d, c] = N(() => ze(o) ? o : ""), v = yn(d), k = ze(d), u = zn(d, i, l), h = () => {
2605
+ k && a(d, u?.updatedSendDates);
2606
+ };
2607
+ return /* @__PURE__ */ t(
2608
+ "div",
2609
+ {
2610
+ onClick: n,
2611
+ className: e["v2-launch-modal-overlay"],
2612
+ children: /* @__PURE__ */ s(
2613
+ "div",
2614
+ {
2615
+ onClick: (_) => _.stopPropagation(),
2616
+ className: e["v2-launch-modal"],
2617
+ children: [
2618
+ /* @__PURE__ */ t(
2619
+ "button",
2620
+ {
2621
+ type: "button",
2622
+ onClick: n,
2623
+ className: e["v2-launch-modal__btn-close"],
2624
+ children: /* @__PURE__ */ t(Ie, { size: 18, color: "#6B6B6B" })
2625
+ }
2626
+ ),
2627
+ /* @__PURE__ */ t("div", { className: e["v2-launch-modal__icon-box"], children: /* @__PURE__ */ t(Nt, { size: 30, color: "#316CD9" }) }),
2628
+ /* @__PURE__ */ t("div", { className: e["v2-launch-modal__title"], children: "Your staff check-in is launching" }),
2629
+ /* @__PURE__ */ t("p", { className: e["v2-launch-modal__sub"], children: "Choose the date this check-in starts sending to teachers. You can change it any time before it goes out." }),
2630
+ /* @__PURE__ */ s("div", { className: e["v2-launch-modal__form"], children: [
2631
+ /* @__PURE__ */ s("div", { children: [
2632
+ /* @__PURE__ */ t("span", { className: e["v2-launch-modal__field-label"], children: "START DATE *" }),
2633
+ /* @__PURE__ */ t(Oe, { dateAdapter: Ee, children: /* @__PURE__ */ t(
2634
+ Ae,
2635
+ {
2636
+ value: v,
2637
+ minDate: p().startOf("day"),
2638
+ onChange: (_) => {
2639
+ const w = _ && p(_).isValid() ? p(_).format(S) : "";
2640
+ c(w);
2641
+ },
2642
+ format: be,
2643
+ slotProps: {
2644
+ textField: {
2645
+ fullWidth: !0,
2646
+ variant: "outlined",
2647
+ placeholder: "Select a date",
2648
+ sx: {
2649
+ background: "#fff",
2650
+ "& .MuiOutlinedInput-root": {
2651
+ borderRadius: "12px",
2652
+ fontSize: "15px",
2653
+ fontWeight: 500,
2654
+ color: "#242424",
2655
+ height: 48,
2656
+ "& fieldset": {
2657
+ borderColor: "#D3D3D3"
2658
+ },
2659
+ "&:hover fieldset": {
2660
+ borderColor: "#316CD9"
2661
+ },
2662
+ "&.Mui-focused fieldset": {
2663
+ borderColor: "#316CD9"
2664
+ }
2665
+ },
2666
+ "& .MuiInputBase-input": {
2667
+ padding: "12px 14px"
2668
+ }
2669
+ }
2670
+ }
2671
+ }
2672
+ }
2673
+ ) })
2674
+ ] }),
2675
+ u && /* @__PURE__ */ s("div", { className: e["v2-launch-modal__warning-box"], children: [
2676
+ /* @__PURE__ */ t(Xe, { size: 18, className: e["v2-launch-modal__warning-icon"] }),
2677
+ /* @__PURE__ */ t("div", { className: e["v2-launch-modal__warning-text"], children: u.message })
2678
+ ] })
2679
+ ] }),
2680
+ /* @__PURE__ */ s("div", { className: e["v2-launch-modal__actions"], children: [
2681
+ /* @__PURE__ */ t(
2682
+ "button",
2683
+ {
2684
+ type: "button",
2685
+ onClick: n,
2686
+ className: e["v2-launch-modal__btn-cancel"],
2687
+ children: "Cancel"
2688
+ }
2689
+ ),
2690
+ /* @__PURE__ */ s(
2691
+ "button",
2692
+ {
2693
+ type: "button",
2694
+ onClick: h,
2695
+ disabled: !k,
2696
+ className: `${e["v2-launch-modal__btn-start"]} ${k ? e["v2-launch-modal__btn-start--valid"] : ""}`,
2697
+ children: [
2698
+ /* @__PURE__ */ t(ve, { size: 18, color: "#fff" }),
2699
+ " Start check-in"
2700
+ ]
2701
+ }
2702
+ )
2703
+ ] })
2704
+ ]
2705
+ }
2706
+ )
2707
+ }
2708
+ );
2709
+ }, Ln = () => {
2710
+ const [n, a] = N({
2711
+ open: !1,
2712
+ message: "",
2713
+ severity: "success"
2714
+ });
2715
+ de(() => Kt((l) => a(l)), []);
2716
+ const o = (i, l) => {
2717
+ l !== "clickaway" && a((d) => ({ ...d, open: !1 }));
2718
+ };
2719
+ return /* @__PURE__ */ t(
2720
+ Vt,
2721
+ {
2722
+ open: n.open,
2723
+ autoHideDuration: en,
2724
+ onClose: o,
2725
+ anchorOrigin: { vertical: "top", horizontal: "right" },
2726
+ className: e["v2-snackbar-wrap"],
2727
+ children: /* @__PURE__ */ t(
2728
+ Wt,
2729
+ {
2730
+ onClose: o,
2731
+ severity: n.severity,
2732
+ variant: "filled",
2733
+ elevation: 6,
2734
+ className: e["v2-snackbar-alert"],
2735
+ children: n.message
2736
+ }
2737
+ )
2738
+ }
2739
+ );
2740
+ }, ss = () => {
2741
+ const [n, a] = N(""), {
2742
+ loading: o,
2743
+ hasError: i,
2744
+ refetch: l,
2745
+ activeTab: d,
2746
+ setActiveTab: c,
2747
+ isSavedView: v,
2748
+ setIsSavedView: k,
2749
+ isLaunchModalOpen: u,
2750
+ setIsLaunchModalOpen: h,
2751
+ routineConfig: _,
2752
+ setRoutineConfig: w,
2753
+ comprehensiveConfig: q,
2754
+ setComprehensiveConfig: C,
2755
+ routineClusters: I,
2756
+ setRoutineClusters: z,
2757
+ comprehensiveClusters: B,
2758
+ setComprehensiveClusters: R,
2759
+ masterBankClusters: L,
2760
+ oneOffClusters: F,
2761
+ setOneOffClusters: A,
2762
+ hasDraft: X,
2763
+ draftSavedAt: T,
2764
+ handleClearDraft: Q,
2765
+ pastOneOffs: H,
2766
+ fullSetupData: W,
2767
+ isOneOffEnabled: j,
2768
+ launchScope: Y,
2769
+ setLaunchScope: P,
2770
+ handleSelectTab: G,
2771
+ handleBackToOverview: J,
2772
+ handleSaveRoutine: U,
2773
+ handleSaveComprehensive: m,
2774
+ handleLaunchOneOff: b,
2775
+ handleSendItAgain: $,
2776
+ handleToggleRoutine: O,
2777
+ handleToggleComprehensive: E,
2778
+ handleToggleOneOff: K,
2779
+ handleRestoreDefaults: ee
2780
+ } = $n(), ae = (g, f) => {
2781
+ if (Y === "routine") {
2782
+ U(g);
2783
+ return;
2784
+ }
2785
+ if (Y === "oneoff") {
2786
+ b(g, n);
2787
+ return;
2788
+ }
2789
+ if (Y === "comprehensive") {
2790
+ m(g, f);
2791
+ return;
2792
+ }
2793
+ };
2794
+ return /* @__PURE__ */ s("div", { className: v ? "" : e["v2-container"], children: [
2795
+ v ? /* @__PURE__ */ t(
2796
+ Mn,
2797
+ {
2798
+ data: W,
2799
+ loading: o,
2800
+ hasError: i,
2801
+ onRetry: l,
2802
+ onEditMode: (g) => {
2803
+ c(g), k(!1);
2804
+ },
2805
+ onToggleRoutine: O,
2806
+ onToggleComprehensive: E,
2807
+ onToggleOneOff: K,
2808
+ isOneOffEnabled: j
2809
+ }
2810
+ ) : /* @__PURE__ */ s(pe, { children: [
2811
+ /* @__PURE__ */ s("div", { className: e["v2-header"], children: [
2812
+ /* @__PURE__ */ s("div", { className: e["v2-header-row"], children: [
2813
+ /* @__PURE__ */ t("h1", { className: e["v2-title"], children: "Staff Well-being Setup" }),
2814
+ /* @__PURE__ */ s(
2815
+ "button",
2816
+ {
2817
+ type: "button",
2818
+ onClick: J,
2819
+ className: e["v2-btn-back-overview"],
2820
+ children: [
2821
+ /* @__PURE__ */ t(xt, { size: 16 }),
2822
+ " Back to Overview"
2823
+ ]
2824
+ }
2825
+ )
2826
+ ] }),
2827
+ /* @__PURE__ */ t("p", { className: e["v2-description"], children: "Configure your staff check-in by reviewing questions, choosing how they are grouped, arranging clusters, and setting how often check-ins are sent." }),
2828
+ /* @__PURE__ */ t(
2829
+ Ht,
2830
+ {
2831
+ activeTab: d,
2832
+ onSelectTab: G
2833
+ }
2834
+ )
2835
+ ] }),
2836
+ d === "routine" && /* @__PURE__ */ t(
2837
+ Sn,
2838
+ {
2839
+ config: _,
2840
+ onChangeConfig: w,
2841
+ clusters: I,
2842
+ onChangeClusters: z,
2843
+ onSave: () => {
2844
+ P("routine"), h(!0);
2845
+ },
2846
+ onRestoreDefaults: () => ee("routine")
2847
+ }
2848
+ ),
2849
+ d === "comprehensive" && /* @__PURE__ */ t(
2850
+ In,
2851
+ {
2852
+ config: q,
2853
+ onChangeConfig: C,
2854
+ clusters: B,
2855
+ onChangeClusters: R,
2856
+ onSave: () => {
2857
+ P("comprehensive"), h(!0);
2858
+ },
2859
+ onRestoreDefaults: () => ee("comprehensive")
2860
+ }
2861
+ ),
2862
+ d === "oneoff" && /* @__PURE__ */ t(
2863
+ An,
2864
+ {
2865
+ clusters: F,
2866
+ onChangeClusters: A,
2867
+ pastOneOffs: H,
2868
+ masterBankClusters: L,
2869
+ hasDraft: X,
2870
+ draftSavedAt: T,
2871
+ onClearDraft: Q,
2872
+ isOn: j,
2873
+ onToggle: K,
2874
+ onSaveAndContinue: (g) => {
2875
+ a(g), P("oneoff"), h(!0);
2876
+ },
2877
+ onSendItAgain: $
2878
+ }
2879
+ )
2880
+ ] }),
2881
+ u && /* @__PURE__ */ t(
2882
+ Bn,
2883
+ {
2884
+ initialDate: xn(Y, _, q),
2885
+ scope: Y,
2886
+ comprehensiveSendDates: q.sendDates,
2887
+ onClose: () => h(!1),
2888
+ onStart: ae
2889
+ }
2890
+ ),
2891
+ /* @__PURE__ */ t(Ln, {})
2892
+ ] });
2893
+ };
2894
+ export {
2895
+ ss as default
2896
+ };