@argusoft/medplat-core 1.0.32 → 1.0.33

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 (99) hide show
  1. package/dist/{AccessRights-DBjTQA1-.js → AccessRights-BC43Jhml.js} +264 -199
  2. package/dist/AccessRights-BC43Jhml.js.map +1 -0
  3. package/dist/{BrandsPage-CdcAvaml-ZtVTX6vX.js → BrandsPage-CdcAvaml-CYT80CMH.js} +3 -3
  4. package/dist/{BrandsPage-CdcAvaml-ZtVTX6vX.js.map → BrandsPage-CdcAvaml-CYT80CMH.js.map} +1 -1
  5. package/dist/{CategoriesPage-BprQEYJw-CclreTv1.js → CategoriesPage-BprQEYJw-BRAukJB1.js} +3 -3
  6. package/dist/{CategoriesPage-BprQEYJw-CclreTv1.js.map → CategoriesPage-BprQEYJw-BRAukJB1.js.map} +1 -1
  7. package/dist/ChangePasswordModalCore-rypTxA2O.js +238 -0
  8. package/dist/ChangePasswordModalCore-rypTxA2O.js.map +1 -0
  9. package/dist/{DashboardPage-CTiGSx71-CsYohJ5e.js → DashboardPage-CTiGSx71-DX-TzGOH.js} +3 -3
  10. package/dist/{DashboardPage-CTiGSx71-CsYohJ5e.js.map → DashboardPage-CTiGSx71-DX-TzGOH.js.map} +1 -1
  11. package/dist/{FacilityPicker-BXa2VF7i-Dab_Jwa5.js → FacilityPicker-BXa2VF7i-D0JUIqLv.js} +2 -2
  12. package/dist/{FacilityPicker-BXa2VF7i-Dab_Jwa5.js.map → FacilityPicker-BXa2VF7i-D0JUIqLv.js.map} +1 -1
  13. package/dist/FaqList-CeDEuhU_.js +237 -0
  14. package/dist/FaqList-CeDEuhU_.js.map +1 -0
  15. package/dist/FaqSkeletons-hLCEcRr-.js +19 -0
  16. package/dist/FaqSkeletons-hLCEcRr-.js.map +1 -0
  17. package/dist/FaqView-sDzBVyXV.js +617 -0
  18. package/dist/FaqView-sDzBVyXV.js.map +1 -0
  19. package/dist/{FeatureMenu-Kc73yPHH.js → FeatureMenu-CaI-ZhSZ.js} +2 -2
  20. package/dist/{FeatureMenu-Kc73yPHH.js.map → FeatureMenu-CaI-ZhSZ.js.map} +1 -1
  21. package/dist/{ImmunizationConfigurationBase-lKsJZMak.js → ImmunizationConfigurationBase-Clkk0-n6.js} +2352 -2332
  22. package/dist/{ImmunizationConfigurationBase-lKsJZMak.js.map → ImmunizationConfigurationBase-Clkk0-n6.js.map} +1 -1
  23. package/dist/{InventoryPage-JadYMCzU-CzJQfQ2A.js → InventoryPage-JadYMCzU-CWcCauMI.js} +4 -4
  24. package/dist/{InventoryPage-JadYMCzU-CzJQfQ2A.js.map → InventoryPage-JadYMCzU-CWcCauMI.js.map} +1 -1
  25. package/dist/ManageFaq-4cT6bntx.js +1583 -0
  26. package/dist/ManageFaq-4cT6bntx.js.map +1 -0
  27. package/dist/ManageFaq.css +1 -0
  28. package/dist/{ManageUser-Dm0l833u.js → ManageUser-DchUMAyC.js} +2 -2
  29. package/dist/{ManageUser-Dm0l833u.js.map → ManageUser-DchUMAyC.js.map} +1 -1
  30. package/dist/{MemberProfileCard-01d_jz3w-DYHtbgMX.js → MemberProfileCard-01d_jz3w-CQi_zu6x.js} +3 -3
  31. package/dist/{MemberProfileCard-01d_jz3w-DYHtbgMX.js.map → MemberProfileCard-01d_jz3w-CQi_zu6x.js.map} +1 -1
  32. package/dist/{PaymentCreatePage-D6NZBUC3-DxXf2kvH.js → PaymentCreatePage-D6NZBUC3-_98S21Sa.js} +4 -4
  33. package/dist/{PaymentCreatePage-D6NZBUC3-DxXf2kvH.js.map → PaymentCreatePage-D6NZBUC3-_98S21Sa.js.map} +1 -1
  34. package/dist/{PaymentsPage-CHieGNrn-BnYCtqHd.js → PaymentsPage-CHieGNrn-ChCXEyck.js} +3 -3
  35. package/dist/{PaymentsPage-CHieGNrn-BnYCtqHd.js.map → PaymentsPage-CHieGNrn-ChCXEyck.js.map} +1 -1
  36. package/dist/{PickupBatchLinesEditor-QPaqFtUO-CY7BShYh.js → PickupBatchLinesEditor-QPaqFtUO-BEtI5mIU.js} +2 -2
  37. package/dist/{PickupBatchLinesEditor-QPaqFtUO-CY7BShYh.js.map → PickupBatchLinesEditor-QPaqFtUO-BEtI5mIU.js.map} +1 -1
  38. package/dist/{PickupCreatePage-C7_67u_u-OId8-e2a.js → PickupCreatePage-C7_67u_u-DbDIZ1WC.js} +5 -5
  39. package/dist/{PickupCreatePage-C7_67u_u-OId8-e2a.js.map → PickupCreatePage-C7_67u_u-DbDIZ1WC.js.map} +1 -1
  40. package/dist/{PickupsPage-BWblMlic-CWkgeBw0.js → PickupsPage-BWblMlic-KehDMebm.js} +4 -4
  41. package/dist/{PickupsPage-BWblMlic-CWkgeBw0.js.map → PickupsPage-BWblMlic-KehDMebm.js.map} +1 -1
  42. package/dist/{PmGuard-BvUUbU80-BpYNaDzl.js → PmGuard-BvUUbU80-DJipZoSg.js} +2 -2
  43. package/dist/{PmGuard-BvUUbU80-BpYNaDzl.js.map → PmGuard-BvUUbU80-DJipZoSg.js.map} +1 -1
  44. package/dist/{ProductEditPage-Dbq4vUAA-BoBmTPPL.js → ProductEditPage-Dbq4vUAA-DusAdAvm.js} +4 -4
  45. package/dist/{ProductEditPage-Dbq4vUAA-BoBmTPPL.js.map → ProductEditPage-Dbq4vUAA-DusAdAvm.js.map} +1 -1
  46. package/dist/{ProductsPage-BI22nPb4-CQBjnc-n.js → ProductsPage-BI22nPb4-D3GnWz34.js} +4 -4
  47. package/dist/{ProductsPage-BI22nPb4-CQBjnc-n.js.map → ProductsPage-BI22nPb4-D3GnWz34.js.map} +1 -1
  48. package/dist/{PurchaseCreatePage-C0EK9z4w-BQMTsjE7.js → PurchaseCreatePage-C0EK9z4w-D4PlZsOH.js} +4 -4
  49. package/dist/{PurchaseCreatePage-C0EK9z4w-BQMTsjE7.js.map → PurchaseCreatePage-C0EK9z4w-D4PlZsOH.js.map} +1 -1
  50. package/dist/{PurchaseRequestDetailPage-DhBuOGHZ-CWZPqzt9.js → PurchaseRequestDetailPage-DhBuOGHZ-CAmlL4fP.js} +3 -3
  51. package/dist/{PurchaseRequestDetailPage-DhBuOGHZ-CWZPqzt9.js.map → PurchaseRequestDetailPage-DhBuOGHZ-CAmlL4fP.js.map} +1 -1
  52. package/dist/{PurchaseRequestsPage-Bj9HUMxb-B7-AxT8m.js → PurchaseRequestsPage-Bj9HUMxb-BCAhEEkL.js} +3 -3
  53. package/dist/{PurchaseRequestsPage-Bj9HUMxb-B7-AxT8m.js.map → PurchaseRequestsPage-Bj9HUMxb-BCAhEEkL.js.map} +1 -1
  54. package/dist/{PurchasesPage-Djl1AqD_-DXeYFMrX.js → PurchasesPage-Djl1AqD_-DxBRFRDy.js} +3 -3
  55. package/dist/{PurchasesPage-Djl1AqD_-DXeYFMrX.js.map → PurchasesPage-Djl1AqD_-DxBRFRDy.js.map} +1 -1
  56. package/dist/{SaleCreatePage-DHBLmlBr-BlgjVsq6.js → SaleCreatePage-DHBLmlBr-aEGmvJQq.js} +4 -4
  57. package/dist/{SaleCreatePage-DHBLmlBr-BlgjVsq6.js.map → SaleCreatePage-DHBLmlBr-aEGmvJQq.js.map} +1 -1
  58. package/dist/{SalesPage-eF9Yr42z-BQ9FlXC3.js → SalesPage-eF9Yr42z-CvOr82vo.js} +3 -3
  59. package/dist/{SalesPage-eF9Yr42z-BQ9FlXC3.js.map → SalesPage-eF9Yr42z-CvOr82vo.js.map} +1 -1
  60. package/dist/{SettingsPage-Cre-UE3r-9ntnLYsQ.js → SettingsPage-Cre-UE3r-CGTVp5Zw.js} +3 -3
  61. package/dist/{SettingsPage-Cre-UE3r-9ntnLYsQ.js.map → SettingsPage-Cre-UE3r-CGTVp5Zw.js.map} +1 -1
  62. package/dist/{StorageUnitsPage-CTEVuemZ-B4osG74N.js → StorageUnitsPage-CTEVuemZ-C7zkwKMz.js} +5 -5
  63. package/dist/{StorageUnitsPage-CTEVuemZ-B4osG74N.js.map → StorageUnitsPage-CTEVuemZ-C7zkwKMz.js.map} +1 -1
  64. package/dist/{SubMenu-OO2zhKiu.js → SubMenu-DZIhur09.js} +2 -2
  65. package/dist/{SubMenu-OO2zhKiu.js.map → SubMenu-DZIhur09.js.map} +1 -1
  66. package/dist/{TransactionsPage-Zuu7sjID-B-ACzvd1.js → TransactionsPage-Zuu7sjID-BDmUK7s1.js} +3 -3
  67. package/dist/{TransactionsPage-Zuu7sjID-B-ACzvd1.js.map → TransactionsPage-Zuu7sjID-BDmUK7s1.js.map} +1 -1
  68. package/dist/{TransferCreatePage-DlT0nCDj-B2SdPgYB.js → TransferCreatePage-DlT0nCDj-evHPJc99.js} +4 -4
  69. package/dist/{TransferCreatePage-DlT0nCDj-B2SdPgYB.js.map → TransferCreatePage-DlT0nCDj-evHPJc99.js.map} +1 -1
  70. package/dist/{TransfersPage-DqaSvHda-G2tFa5Jq.js → TransfersPage-DqaSvHda-DAUn5SSr.js} +3 -3
  71. package/dist/{TransfersPage-DqaSvHda-G2tFa5Jq.js.map → TransfersPage-DqaSvHda-DAUn5SSr.js.map} +1 -1
  72. package/dist/{VaccineEducation-T_UE57Ef.js → VaccineEducation-DWkNNasF.js} +2 -2
  73. package/dist/{VaccineEducation-T_UE57Ef.js.map → VaccineEducation-DWkNNasF.js.map} +1 -1
  74. package/dist/VaccineEducationConfigurator-BFCvu5Mw.js +1450 -0
  75. package/dist/VaccineEducationConfigurator-BFCvu5Mw.js.map +1 -0
  76. package/dist/VaccineEducationConfigurator.css +1 -4
  77. package/dist/{VaccineEducationList-Ok7_5EFb.js → VaccineEducationList-BxZHahCh.js} +2 -2
  78. package/dist/{VaccineEducationList-Ok7_5EFb.js.map → VaccineEducationList-BxZHahCh.js.map} +1 -1
  79. package/dist/{VialsPage-LoDaUqVv-DmMXbK8j.js → VialsPage-LoDaUqVv-Dw00Zc06.js} +4 -4
  80. package/dist/{VialsPage-LoDaUqVv-DmMXbK8j.js.map → VialsPage-LoDaUqVv-Dw00Zc06.js.map} +1 -1
  81. package/dist/{VaccineEducationConfigurator-CWc20_rv.js → ckeditor5-_x14lrzc.js} +4014 -5372
  82. package/dist/ckeditor5-_x14lrzc.js.map +1 -0
  83. package/dist/ckeditor5.css +4 -0
  84. package/dist/faqMedia-FDpje7v0.js +234 -0
  85. package/dist/faqMedia-FDpje7v0.js.map +1 -0
  86. package/dist/index.css +1 -1
  87. package/dist/index.js +1 -1
  88. package/dist/{index.lib-BySa9-Z-.js → index.lib-QDEODnRT.js} +343 -303
  89. package/dist/index.lib-QDEODnRT.js.map +1 -0
  90. package/dist/{listValueStore-5d4vNGQM-WclZ5nBG.js → listValueStore-5d4vNGQM-DB08drLf.js} +2 -2
  91. package/dist/{listValueStore-5d4vNGQM-WclZ5nBG.js.map → listValueStore-5d4vNGQM-DB08drLf.js.map} +1 -1
  92. package/dist/proxy-C4gcRXzG.js +5265 -0
  93. package/dist/proxy-C4gcRXzG.js.map +1 -0
  94. package/package.json +3 -2
  95. package/dist/AccessRights-DBjTQA1-.js.map +0 -1
  96. package/dist/ChangePasswordModalCore-DZGOkbRY.js +0 -5494
  97. package/dist/ChangePasswordModalCore-DZGOkbRY.js.map +0 -1
  98. package/dist/VaccineEducationConfigurator-CWc20_rv.js.map +0 -1
  99. package/dist/index.lib-BySa9-Z-.js.map +0 -1
@@ -0,0 +1,1583 @@
1
+ import './ManageFaq.css';var pt = Object.defineProperty;
2
+ var gt = (n, e, i) => e in n ? pt(n, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : n[e] = i;
3
+ var _e = (n, e, i) => gt(n, typeof e != "symbol" ? e + "" : e, i);
4
+ import { jsxs as f, jsx as t, Fragment as he } from "react/jsx-runtime";
5
+ import { useState as E, useRef as ft, useMemo as Le, useEffect as $e } from "react";
6
+ import ue from "@mui/material/Grid2";
7
+ import { Typography as M, Dialog as Pe, DialogTitle as Me, Box as C, IconButton as He, DialogContent as Fe, Button as U, DialogActions as Ne, Tooltip as ht, CircularProgress as be, useTheme as bt, Stack as ne, Chip as Se, Paper as yt, Divider as we, Alert as xt } from "@mui/material";
8
+ import { useNavigate as vt, useParams as Ct } from "react-router";
9
+ import { useSearchParams as kt } from "react-router-dom";
10
+ import { useSelector as qt } from "react-redux";
11
+ import { useForm as De } from "react-hook-form";
12
+ import { yupResolver as Tt } from "@hookform/resolvers/yup";
13
+ import * as me from "yup";
14
+ import { FontAwesomeIcon as Q } from "@fortawesome/react-fontawesome";
15
+ import { faCirclePlus as Ue, faPen as _t, faBars as Lt, faPlus as ze, faXmark as Ve, faVideo as Oe, faImage as We, faPenToSquare as $t, faHeartPulse as wt, faTag as It, faLayerGroup as Bt, faSliders as At, faGlobe as Et, faCircleCheck as Qt, faFloppyDisk as Pt } from "@fortawesome/free-solid-svg-icons";
16
+ import { api as je } from "@/common/interceptors/AxiosInterceptor";
17
+ import { getAssignedFeatures as Mt } from "@/utils/feature";
18
+ import { showToast as I } from "@/common/toaster/toaster";
19
+ import { useTranslateProvider as se } from "@/common/languageTranslator/TranslationContext";
20
+ import ae from "@/views/custom-components/CustomTextField";
21
+ import Ht from "@/views/custom-components/CustomDropdown";
22
+ import Ft from "@/views/custom-components/SegmentedTabs";
23
+ import { execute as D } from "@/common/services/GlobalApis";
24
+ import Nt from "@/common/services/util/GeneralUtil";
25
+ import y from "prop-types";
26
+ import St from "@/views/custom-components/CustomizedTable/CustomizedTableV2";
27
+ import Dt from "@/common/fontAwesomeIcons/FontAwesomeIcons";
28
+ import { p as ye, C as Ut, a as zt, s as Vt, M as Ot, g as Wt, u as jt, b as Ge, c as Ie, d as Gt } from "./faqMedia-FDpje7v0.js";
29
+ import { C as Kt } from "./index-mfoqII2U.js";
30
+ import { b as X, c as Xt, D as Yt, d as Jt, M as Ke, q as Zt, e as Xe, f as pe, P as Ye, p as Rt, g as ei, h as ti, i as ii, j as ni, k as ai, l as oi, m as si, C as ri, E as li, A as ci, B as di, I as ui, U as mi, L as pi, a as gi } from "./ckeditor5-_x14lrzc.js";
31
+ /**
32
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
33
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
34
+ */
35
+ class fi extends Xe {
36
+ /**
37
+ * @inheritDoc
38
+ */
39
+ refresh() {
40
+ this.value = this._getValue(), this.isEnabled = this._checkEnabled();
41
+ }
42
+ /**
43
+ * Executes the command. When the command {@link #value is on}, all top-most block quotes within
44
+ * the selection will be removed. If it is off, all selected blocks will be wrapped with
45
+ * a block quote.
46
+ *
47
+ * @fires execute
48
+ * @param options Command options.
49
+ * @param options.forceValue If set, it will force the command behavior. If `true`, the command will apply a block quote,
50
+ * otherwise the command will remove the block quote. If not set, the command will act basing on its current value.
51
+ */
52
+ execute(e = {}) {
53
+ const i = this.editor.model, o = i.schema, s = i.document.selection, a = Array.from(s.getSelectedBlocks()), d = e.forceValue === void 0 ? !this.value : e.forceValue;
54
+ i.change((c) => {
55
+ if (!d)
56
+ this._removeQuote(c, a.filter(ee));
57
+ else {
58
+ const l = a.filter((u) => ee(u) || Ae(o, u));
59
+ this._applyQuote(c, l);
60
+ }
61
+ });
62
+ }
63
+ /**
64
+ * Checks the command's {@link #value}.
65
+ */
66
+ _getValue() {
67
+ const e = this.editor.model.document.selection, i = pe(e.getSelectedBlocks());
68
+ return !!(i && ee(i));
69
+ }
70
+ /**
71
+ * Checks whether the command can be enabled in the current context.
72
+ *
73
+ * @returns Whether the command should be enabled.
74
+ */
75
+ _checkEnabled() {
76
+ if (this.value)
77
+ return !0;
78
+ const e = this.editor.model.document.selection, i = this.editor.model.schema, o = pe(e.getSelectedBlocks());
79
+ return o ? Ae(i, o) : !1;
80
+ }
81
+ /**
82
+ * Removes the quote from given blocks.
83
+ *
84
+ * If blocks which are supposed to be "unquoted" are in the middle of a quote,
85
+ * start it or end it, then the quote will be split (if needed) and the blocks
86
+ * will be moved out of it, so other quoted blocks remained quoted.
87
+ */
88
+ _removeQuote(e, i) {
89
+ Be(e, i).reverse().forEach((o) => {
90
+ if (o.start.isAtStart && o.end.isAtEnd) {
91
+ e.unwrap(o.start.parent);
92
+ return;
93
+ }
94
+ if (o.start.isAtStart) {
95
+ const a = e.createPositionBefore(o.start.parent);
96
+ e.move(o, a);
97
+ return;
98
+ }
99
+ o.end.isAtEnd || e.split(o.end);
100
+ const s = e.createPositionAfter(o.end.parent);
101
+ e.move(o, s);
102
+ });
103
+ }
104
+ /**
105
+ * Applies the quote to given blocks.
106
+ */
107
+ _applyQuote(e, i) {
108
+ const o = [];
109
+ Be(e, i).reverse().forEach((s) => {
110
+ let a = ee(s.start);
111
+ a || (a = e.createElement("blockQuote"), e.wrap(s, a)), o.push(a);
112
+ }), o.reverse().reduce((s, a) => s.nextSibling == a ? (e.merge(e.createPositionAfter(s)), s) : a);
113
+ }
114
+ }
115
+ function ee(n) {
116
+ return n.parent.name == "blockQuote" ? n.parent : null;
117
+ }
118
+ function Be(n, e) {
119
+ let i, o = 0;
120
+ const s = [];
121
+ for (; o < e.length; ) {
122
+ const a = e[o], d = e[o + 1];
123
+ i || (i = n.createPositionBefore(a)), (!d || a.nextSibling != d) && (s.push(n.createRange(i, n.createPositionAfter(a))), i = null), o++;
124
+ }
125
+ return s;
126
+ }
127
+ function Ae(n, e) {
128
+ const i = n.checkChild(e.parent, "blockQuote"), o = n.checkChild([
129
+ "$root",
130
+ "blockQuote"
131
+ ], e);
132
+ return i && o;
133
+ }
134
+ class hi extends X {
135
+ /**
136
+ * @inheritDoc
137
+ */
138
+ static get pluginName() {
139
+ return "BlockQuoteEditing";
140
+ }
141
+ /**
142
+ * @inheritDoc
143
+ */
144
+ static get isOfficialPlugin() {
145
+ return !0;
146
+ }
147
+ /**
148
+ * @inheritDoc
149
+ */
150
+ static get requires() {
151
+ return [
152
+ Xt,
153
+ Yt
154
+ ];
155
+ }
156
+ /**
157
+ * @inheritDoc
158
+ */
159
+ init() {
160
+ const e = this.editor, i = e.model.schema;
161
+ e.commands.add("blockQuote", new fi(e)), i.register("blockQuote", {
162
+ inheritAllFrom: "$container"
163
+ }), e.conversion.elementToElement({
164
+ model: "blockQuote",
165
+ view: "blockquote"
166
+ }), e.model.document.registerPostFixer((d) => {
167
+ const c = e.model.document.differ.getChanges();
168
+ for (const l of c)
169
+ if (l.type == "insert") {
170
+ const u = l.position.nodeAfter;
171
+ if (!u)
172
+ continue;
173
+ if (u.is("element", "blockQuote") && u.isEmpty)
174
+ return d.remove(u), !0;
175
+ if (u.is("element", "blockQuote") && !i.checkChild(l.position, u))
176
+ return d.unwrap(u), !0;
177
+ if (u.is("element")) {
178
+ const _ = d.createRangeIn(u);
179
+ for (const q of _.getItems())
180
+ if (q.is("element", "blockQuote") && !i.checkChild(d.createPositionBefore(q), q))
181
+ return d.unwrap(q), !0;
182
+ }
183
+ } else if (l.type == "remove") {
184
+ const u = l.position.parent;
185
+ if (u.is("element", "blockQuote") && u.isEmpty)
186
+ return d.remove(u), !0;
187
+ }
188
+ return !1;
189
+ });
190
+ const o = this.editor.editing.view.document, s = e.model.document.selection, a = e.commands.get("blockQuote");
191
+ this.listenTo(o, "enter", (d, c) => {
192
+ if (!s.isCollapsed || !a.value)
193
+ return;
194
+ s.getLastPosition().parent.isEmpty && (e.execute("blockQuote"), e.editing.view.scrollToTheSelection(), c.preventDefault(), d.stop());
195
+ }, {
196
+ context: "blockquote"
197
+ }), this.listenTo(o, "delete", (d, c) => {
198
+ if (c.direction != "backward" || !s.isCollapsed || !a.value)
199
+ return;
200
+ const l = s.getLastPosition().parent;
201
+ l.isEmpty && !l.previousSibling && (e.execute("blockQuote"), e.editing.view.scrollToTheSelection(), c.preventDefault(), d.stop());
202
+ }, {
203
+ context: "blockquote"
204
+ });
205
+ }
206
+ }
207
+ class bi extends X {
208
+ /**
209
+ * @inheritDoc
210
+ */
211
+ static get pluginName() {
212
+ return "BlockQuoteUI";
213
+ }
214
+ /**
215
+ * @inheritDoc
216
+ */
217
+ static get isOfficialPlugin() {
218
+ return !0;
219
+ }
220
+ /**
221
+ * @inheritDoc
222
+ */
223
+ init() {
224
+ const e = this.editor;
225
+ e.ui.componentFactory.add("blockQuote", () => {
226
+ const i = this._createButton(Jt);
227
+ return i.set({
228
+ tooltip: !0
229
+ }), i;
230
+ }), e.ui.componentFactory.add("menuBar:blockQuote", () => {
231
+ const i = this._createButton(Ke);
232
+ return i.set({
233
+ role: "menuitemcheckbox"
234
+ }), i;
235
+ });
236
+ }
237
+ /**
238
+ * Creates a button for block quote command to use either in toolbar or in menu bar.
239
+ */
240
+ _createButton(e) {
241
+ const i = this.editor, o = i.locale, s = i.commands.get("blockQuote"), a = new e(i.locale), d = o.t;
242
+ return a.set({
243
+ label: d("Block quote"),
244
+ icon: Zt,
245
+ isToggleable: !0
246
+ }), a.bind("isEnabled").to(s, "isEnabled"), a.bind("isOn").to(s, "value"), this.listenTo(a, "execute", () => {
247
+ i.execute("blockQuote"), i.editing.view.focus();
248
+ }), a;
249
+ }
250
+ }
251
+ class yi extends X {
252
+ /**
253
+ * @inheritDoc
254
+ */
255
+ static get requires() {
256
+ return [
257
+ hi,
258
+ bi
259
+ ];
260
+ }
261
+ /**
262
+ * @inheritDoc
263
+ */
264
+ static get pluginName() {
265
+ return "BlockQuote";
266
+ }
267
+ /**
268
+ * @inheritDoc
269
+ */
270
+ static get isOfficialPlugin() {
271
+ return !0;
272
+ }
273
+ }
274
+ /**
275
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
276
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
277
+ */
278
+ class xi extends Xe {
279
+ /**
280
+ * Creates an instance of the command.
281
+ *
282
+ * @param editor Editor instance.
283
+ * @param modelElements Names of the element which this command can apply in the model.
284
+ */
285
+ constructor(i, o) {
286
+ super(i);
287
+ /**
288
+ * Set of defined model's elements names that this command support.
289
+ * See {@link module:heading/headingconfig~HeadingOption}.
290
+ */
291
+ _e(this, "modelElements");
292
+ this.modelElements = o;
293
+ }
294
+ /**
295
+ * @inheritDoc
296
+ */
297
+ refresh() {
298
+ const i = pe(this.editor.model.document.selection.getSelectedBlocks());
299
+ this.value = !!i && this.modelElements.includes(i.name) && i.name, this.isEnabled = !!i && this.modelElements.some((o) => Ee(i, o, this.editor.model.schema));
300
+ }
301
+ /**
302
+ * Executes the command. Applies the heading to the selected blocks or, if the first selected
303
+ * block is a heading already, turns selected headings (of this level only) to paragraphs.
304
+ *
305
+ * @param options.value Name of the element which this command will apply in the model.
306
+ * @fires execute
307
+ */
308
+ execute(i) {
309
+ const o = this.editor.model, s = o.document, a = i.value;
310
+ o.change((d) => {
311
+ const c = Array.from(s.selection.getSelectedBlocks()).filter((l) => Ee(l, a, o.schema));
312
+ for (const l of c)
313
+ l.is("element", a) || d.rename(l, a);
314
+ });
315
+ }
316
+ }
317
+ function Ee(n, e, i) {
318
+ return i.checkChild(n.parent, e) && !i.isObject(n);
319
+ }
320
+ const Qe = "paragraph";
321
+ class vi extends X {
322
+ /**
323
+ * @inheritDoc
324
+ */
325
+ static get pluginName() {
326
+ return "HeadingEditing";
327
+ }
328
+ /**
329
+ * @inheritDoc
330
+ */
331
+ static get isOfficialPlugin() {
332
+ return !0;
333
+ }
334
+ /**
335
+ * @inheritDoc
336
+ */
337
+ constructor(e) {
338
+ super(e), e.config.define("heading", {
339
+ options: [
340
+ {
341
+ model: "paragraph",
342
+ title: "Paragraph",
343
+ class: "ck-heading_paragraph"
344
+ },
345
+ {
346
+ model: "heading1",
347
+ view: "h2",
348
+ title: "Heading 1",
349
+ class: "ck-heading_heading1"
350
+ },
351
+ {
352
+ model: "heading2",
353
+ view: "h3",
354
+ title: "Heading 2",
355
+ class: "ck-heading_heading2"
356
+ },
357
+ {
358
+ model: "heading3",
359
+ view: "h4",
360
+ title: "Heading 3",
361
+ class: "ck-heading_heading3"
362
+ }
363
+ ]
364
+ });
365
+ }
366
+ /**
367
+ * @inheritDoc
368
+ */
369
+ static get requires() {
370
+ return [
371
+ Ye
372
+ ];
373
+ }
374
+ /**
375
+ * @inheritDoc
376
+ */
377
+ init() {
378
+ const e = this.editor, i = e.config.get("heading.options"), o = [];
379
+ for (const s of i)
380
+ s.model !== "paragraph" && (e.model.schema.register(s.model, {
381
+ inheritAllFrom: "$block"
382
+ }), e.conversion.elementToElement(s), o.push(s.model));
383
+ this._addDefaultH1Conversion(e), e.commands.add("heading", new xi(e, o));
384
+ }
385
+ /**
386
+ * @inheritDoc
387
+ */
388
+ afterInit() {
389
+ const e = this.editor, i = e.commands.get("enter"), o = e.config.get("heading.options");
390
+ i && this.listenTo(i, "afterExecute", (s, a) => {
391
+ const d = e.model.document.selection.getFirstPosition().parent;
392
+ o.some((l) => d.is("element", l.model)) && !d.is("element", Qe) && d.childCount === 0 && a.writer.rename(d, Qe);
393
+ });
394
+ }
395
+ /**
396
+ * Adds default conversion for `h1` -> `heading1` with a low priority.
397
+ *
398
+ * @param editor Editor instance on which to add the `h1` conversion.
399
+ */
400
+ _addDefaultH1Conversion(e) {
401
+ e.conversion.for("upcast").elementToElement({
402
+ model: "heading1",
403
+ view: "h1",
404
+ // With a `low` priority, `paragraph` plugin autoparagraphing mechanism is executed. Make sure
405
+ // this listener is called before it. If not, `h1` will be transformed into a paragraph.
406
+ converterPriority: Rt.low + 1
407
+ });
408
+ }
409
+ }
410
+ /**
411
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
412
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
413
+ */
414
+ function Ci(n) {
415
+ const e = n.t, i = {
416
+ Paragraph: e("Paragraph"),
417
+ "Heading 1": e("Heading 1"),
418
+ "Heading 2": e("Heading 2"),
419
+ "Heading 3": e("Heading 3"),
420
+ "Heading 4": e("Heading 4"),
421
+ "Heading 5": e("Heading 5"),
422
+ "Heading 6": e("Heading 6")
423
+ };
424
+ return n.config.get("heading.options").map((o) => {
425
+ const s = i[o.title];
426
+ return s && s != o.title && (o.title = s), o;
427
+ });
428
+ }
429
+ class ki extends X {
430
+ /**
431
+ * @inheritDoc
432
+ */
433
+ static get pluginName() {
434
+ return "HeadingUI";
435
+ }
436
+ /**
437
+ * @inheritDoc
438
+ */
439
+ static get isOfficialPlugin() {
440
+ return !0;
441
+ }
442
+ /**
443
+ * @inheritDoc
444
+ */
445
+ init() {
446
+ const e = this.editor, i = e.t, o = Ci(e), s = i("Choose heading"), a = i("Heading");
447
+ e.ui.componentFactory.add("heading", (d) => {
448
+ const c = {}, l = new ei(), u = e.commands.get("heading"), _ = e.commands.get("paragraph"), q = [
449
+ u
450
+ ];
451
+ for (const h of o) {
452
+ const v = {
453
+ type: "button",
454
+ model: new ti({
455
+ label: h.title,
456
+ class: h.class,
457
+ role: "menuitemradio",
458
+ withText: !0
459
+ })
460
+ };
461
+ h.model === "paragraph" ? (v.model.bind("isOn").to(_, "value"), v.model.set("commandName", "paragraph"), q.push(_)) : (v.model.bind("isOn").to(u, "value", (k) => k === h.model), v.model.set({
462
+ commandName: "heading",
463
+ commandValue: h.model
464
+ })), l.add(v), c[h.model] = h.title;
465
+ }
466
+ const m = ii(d);
467
+ return ni(m, l, {
468
+ ariaLabel: a,
469
+ role: "menu"
470
+ }), m.buttonView.set({
471
+ ariaLabel: a,
472
+ ariaLabelledBy: void 0,
473
+ isOn: !1,
474
+ withText: !0,
475
+ tooltip: a
476
+ }), m.extendTemplate({
477
+ attributes: {
478
+ class: [
479
+ "ck-heading-dropdown"
480
+ ]
481
+ }
482
+ }), m.bind("isEnabled").toMany(q, "isEnabled", (...h) => h.some((v) => v)), m.buttonView.bind("label").to(u, "value", _, "value", (h, v) => {
483
+ const k = v ? "paragraph" : h;
484
+ return typeof k == "boolean" || !c[k] ? s : c[k];
485
+ }), m.buttonView.bind("ariaLabel").to(u, "value", _, "value", (h, v) => {
486
+ const k = v ? "paragraph" : h;
487
+ return typeof k == "boolean" || !c[k] ? a : `${c[k]}, ${a}`;
488
+ }), this.listenTo(m, "execute", (h) => {
489
+ const { commandName: v, commandValue: k } = h.source;
490
+ e.execute(v, k ? {
491
+ value: k
492
+ } : void 0), e.editing.view.focus();
493
+ }), m;
494
+ }), e.ui.componentFactory.add("menuBar:heading", (d) => {
495
+ const c = new ai(d), l = e.commands.get("heading"), u = e.commands.get("paragraph"), _ = [
496
+ l
497
+ ], q = new oi(d);
498
+ c.set({
499
+ class: "ck-heading-dropdown"
500
+ }), q.set({
501
+ ariaLabel: i("Heading"),
502
+ role: "menu"
503
+ }), c.buttonView.set({
504
+ label: i("Heading")
505
+ }), c.panelView.children.add(q);
506
+ for (const m of o) {
507
+ const h = new si(d, c), v = new Ke(d);
508
+ h.children.add(v), q.items.add(h), v.set({
509
+ isToggleable: !0,
510
+ label: m.title,
511
+ role: "menuitemradio",
512
+ class: m.class
513
+ }), v.delegate("execute").to(c), v.on("execute", () => {
514
+ const k = m.model === "paragraph" ? "paragraph" : "heading";
515
+ e.execute(k, {
516
+ value: m.model
517
+ }), e.editing.view.focus();
518
+ }), m.model === "paragraph" ? (v.bind("isOn").to(u, "value"), _.push(u)) : v.bind("isOn").to(l, "value", (k) => k === m.model);
519
+ }
520
+ return c.bind("isEnabled").toMany(_, "isEnabled", (...m) => m.some((h) => h)), c;
521
+ });
522
+ }
523
+ }
524
+ class qi extends X {
525
+ /**
526
+ * @inheritDoc
527
+ */
528
+ static get requires() {
529
+ return [
530
+ vi,
531
+ ki
532
+ ];
533
+ }
534
+ /**
535
+ * @inheritDoc
536
+ */
537
+ static get pluginName() {
538
+ return "Heading";
539
+ }
540
+ /**
541
+ * @inheritDoc
542
+ */
543
+ static get isOfficialPlugin() {
544
+ return !0;
545
+ }
546
+ }
547
+ const Ti = (n) => je.post("/faq/addquestion", n), _i = (n) => je.post("/faq/updatequestion", n);
548
+ function N({ children: n, required: e, icon: i }) {
549
+ return /* @__PURE__ */ f(
550
+ M,
551
+ {
552
+ variant: "body2",
553
+ component: "label",
554
+ sx: {
555
+ display: "flex",
556
+ alignItems: "center",
557
+ gap: 0.75,
558
+ fontWeight: 600,
559
+ color: "text.primary",
560
+ mb: 0.75
561
+ },
562
+ children: [
563
+ i && /* @__PURE__ */ t(Q, { icon: i, size: "xs", opacity: 0.6 }),
564
+ n,
565
+ e && /* @__PURE__ */ t(M, { component: "span", sx: { color: "error.main", lineHeight: 1 }, children: "*" })
566
+ ]
567
+ }
568
+ );
569
+ }
570
+ N.propTypes = {
571
+ children: y.node,
572
+ required: y.bool,
573
+ icon: y.any
574
+ };
575
+ function oe({ children: n }) {
576
+ return /* @__PURE__ */ t(M, { variant: "caption", sx: { display: "block", mt: 0.75, color: "text.disabled" }, children: n });
577
+ }
578
+ oe.propTypes = { children: y.node };
579
+ const ge = ({ row: n, onClose: e, isEdit: i, audience: o }) => {
580
+ const { translate: s } = se(), { control: a, getValues: d } = De({
581
+ defaultValues: { category: i ? n == null ? void 0 : n.value : "" }
582
+ }), [c, l] = E(() => i ? ye(n == null ? void 0 : n.additional_detail) : null), u = async () => {
583
+ const _ = d("category");
584
+ if (!(_ != null && _.trim())) {
585
+ I({ type: "error", message: s("Category name is required") });
586
+ return;
587
+ }
588
+ const q = Vt({ ...c, audience: o });
589
+ try {
590
+ i ? (await D({
591
+ code: "mytecho_update_category_value",
592
+ parameters: { id: n == null ? void 0 : n.id, value: _, additionalDetail: q }
593
+ }), I({ type: "success", message: s("Category updated successfully") })) : (await D({
594
+ code: "mytecho_add_faq_category",
595
+ parameters: { value: _, additionalDetail: q }
596
+ }), I({ type: "success", message: s("Category added successfully") })), e();
597
+ } catch (m) {
598
+ I({ type: "error", message: (m == null ? void 0 : m.message) || s("Unable to save category") });
599
+ }
600
+ };
601
+ return /* @__PURE__ */ f(C, { sx: { display: "flex", flexDirection: "column", gap: 2.5 }, children: [
602
+ /* @__PURE__ */ f(C, { children: [
603
+ /* @__PURE__ */ t(N, { required: !0, children: s("Category Name") }),
604
+ /* @__PURE__ */ t(
605
+ ae,
606
+ {
607
+ control: a,
608
+ name: "category",
609
+ placeholder: s("e.g. Vaccination, Billing, Appointments"),
610
+ dataTestId: "category-name-input"
611
+ }
612
+ )
613
+ ] }),
614
+ /* @__PURE__ */ f(C, { children: [
615
+ /* @__PURE__ */ t(N, { children: s("Icon") }),
616
+ /* @__PURE__ */ t(zt, { value: c, onChange: l }),
617
+ /* @__PURE__ */ t(M, { variant: "caption", sx: { display: "block", mt: 0.75, color: "text.disabled" }, children: s("Optional — shown next to this category wherever it's listed.") })
618
+ ] }),
619
+ /* @__PURE__ */ f(C, { sx: { display: "flex", justifyContent: "flex-end", gap: 1.5, pt: 1 }, children: [
620
+ /* @__PURE__ */ t(U, { variant: "outlined", color: "inherit", onClick: e, sx: { textTransform: "none" }, children: s("Cancel") }),
621
+ /* @__PURE__ */ t(U, { variant: "contained", onClick: u, sx: { textTransform: "none" }, children: s(i ? "Update" : "Add") })
622
+ ] })
623
+ ] });
624
+ };
625
+ ge.propTypes = {
626
+ row: y.object,
627
+ onClose: y.func.isRequired,
628
+ isEdit: y.bool,
629
+ audience: y.string.isRequired
630
+ };
631
+ function Je({ open: n, onClose: e, allCategoryList: i, getCategoryType: o, audience: s }) {
632
+ const { translate: a } = se(), [d, c] = E({}), [l, u] = E(!1), [_, q] = E(!1), m = [
633
+ {
634
+ field: "icon",
635
+ label: "",
636
+ width: 48,
637
+ render: (p) => {
638
+ const P = ye(p.additional_detail);
639
+ return P ? /* @__PURE__ */ t(Ut, { value: P }) : null;
640
+ }
641
+ },
642
+ { field: "value", label: "Name", align: "left" },
643
+ { field: "Actions", label: "Actions" }
644
+ ], h = (p) => [
645
+ {
646
+ icon: /* @__PURE__ */ t(Q, { icon: _t }),
647
+ onClick: () => {
648
+ c(p), q(!0);
649
+ }
650
+ },
651
+ {
652
+ icon: /* @__PURE__ */ t(Q, { icon: Lt }),
653
+ menuItems: [
654
+ {
655
+ label: a(`Mark as ${p != null && p.is_active ? "Inactive" : "Active"}`),
656
+ onClick: () => v(p)
657
+ }
658
+ ]
659
+ }
660
+ ], v = async (p) => {
661
+ try {
662
+ const { data: P } = await D({
663
+ code: "mytecho_get_faq_categorywise",
664
+ parameters: { id: p == null ? void 0 : p.id }
665
+ });
666
+ if (P.result.length > 0) {
667
+ I({
668
+ type: "error",
669
+ message: a("Move all questions out of this category before deactivating it")
670
+ });
671
+ return;
672
+ }
673
+ await D({
674
+ code: "mytecho_delete_faq_category",
675
+ parameters: p != null && p.is_active ? { is_active: !1, is_archive: !0, id: p == null ? void 0 : p.id } : { is_active: !0, is_archive: !1, id: p == null ? void 0 : p.id }
676
+ }), I({
677
+ type: "success",
678
+ message: `${a("Category")} ${a(p != null && p.is_active ? "deactivated" : "activated")}`
679
+ }), o();
680
+ } catch (P) {
681
+ I({ type: "error", message: (P == null ? void 0 : P.message) || a("Unable to change status") });
682
+ }
683
+ }, k = () => {
684
+ u(!1), q(!1), o();
685
+ }, x = l || _;
686
+ return /* @__PURE__ */ f(Pe, { open: n, onClose: e, fullWidth: !0, maxWidth: "sm", "data-testid": "manage-category-modal", children: [
687
+ /* @__PURE__ */ f(
688
+ Me,
689
+ {
690
+ sx: {
691
+ display: "flex",
692
+ alignItems: "flex-start",
693
+ justifyContent: "space-between",
694
+ gap: 2,
695
+ py: 1.5,
696
+ borderBottom: "1px solid",
697
+ borderColor: "divider"
698
+ },
699
+ children: [
700
+ /* @__PURE__ */ f(C, { children: [
701
+ /* @__PURE__ */ t(M, { variant: "subtitle1", component: "span", sx: { fontWeight: 700, display: "block" }, children: a(x ? _ ? "Edit Category" : "Add Category" : "Manage Categories") }),
702
+ /* @__PURE__ */ t(M, { variant: "body2", color: "text.secondary", children: a(
703
+ x ? "Give it a name and, optionally, an icon." : "Categories group related questions in the FAQ list."
704
+ ) })
705
+ ] }),
706
+ /* @__PURE__ */ t(He, { size: "small", onClick: e, "aria-label": a("Close"), children: /* @__PURE__ */ t(Dt, { iconName: "faXmark" }) })
707
+ ]
708
+ }
709
+ ),
710
+ /* @__PURE__ */ f(Fe, { sx: { pt: 2.5 }, children: [
711
+ !x && /* @__PURE__ */ f(he, { children: [
712
+ /* @__PURE__ */ t(C, { sx: { display: "flex", justifyContent: "flex-end", mb: 2 }, children: /* @__PURE__ */ t(
713
+ U,
714
+ {
715
+ variant: "contained",
716
+ size: "small",
717
+ startIcon: /* @__PURE__ */ t(Q, { icon: Ue, size: "xs" }),
718
+ onClick: () => u(!0),
719
+ sx: { textTransform: "none" },
720
+ children: a("Add New Category")
721
+ }
722
+ ) }),
723
+ /* @__PURE__ */ t(
724
+ St,
725
+ {
726
+ tableData: i,
727
+ columns: m,
728
+ paginationConfig: { pagination: !1 },
729
+ actions: h
730
+ }
731
+ )
732
+ ] }),
733
+ l && /* @__PURE__ */ t(ge, { onClose: k, audience: s }),
734
+ _ && /* @__PURE__ */ t(ge, { row: d, isEdit: !0, onClose: k, audience: s })
735
+ ] }),
736
+ !x && /* @__PURE__ */ t(Ne, { sx: { px: 3, py: 2, borderTop: "1px solid", borderColor: "divider" }, children: /* @__PURE__ */ t(U, { variant: "outlined", color: "inherit", size: "small", onClick: e, sx: { textTransform: "none" }, children: a("Close") }) })
737
+ ] });
738
+ }
739
+ Je.propTypes = {
740
+ open: y.bool,
741
+ onClose: y.func.isRequired,
742
+ allCategoryList: y.array,
743
+ getCategoryType: y.func.isRequired,
744
+ audience: y.string.isRequired
745
+ };
746
+ function fe({ mediaType: n, items: e, onChange: i }) {
747
+ const o = ft(null), [s, a] = E(!1), [d, c] = E(null), l = Ot[n], u = e || [], _ = u.length >= l.maxItems, q = async (m) => {
748
+ var v;
749
+ const h = (v = m.target.files) == null ? void 0 : v[0];
750
+ if (m.target.value = "", !!h) {
751
+ if (!l.extensions.has(Wt(h.name))) {
752
+ I({ message: `Only ${l.allowedLabel} files are allowed`, type: "error" });
753
+ return;
754
+ }
755
+ if (h.size > l.maxFileMb * 1024 * 1024) {
756
+ I({ message: `File must be under ${l.maxFileMb}MB`, type: "error" });
757
+ return;
758
+ }
759
+ a(!0);
760
+ try {
761
+ const k = await jt(h, n);
762
+ i([...u, k]), I({ message: "File uploaded", type: "success" });
763
+ } catch (k) {
764
+ console.error(k), I({ message: "Upload failed, please try again", type: "error" });
765
+ } finally {
766
+ a(!1);
767
+ }
768
+ }
769
+ };
770
+ return /* @__PURE__ */ f(C, { children: [
771
+ /* @__PURE__ */ f(C, { className: "faq-media-grid", children: [
772
+ u.map((m) => /* @__PURE__ */ t(
773
+ Ze,
774
+ {
775
+ item: m,
776
+ mediaType: n,
777
+ onOpen: () => c(m),
778
+ onRemove: () => i(u.filter((h) => h.uuid !== m.uuid))
779
+ },
780
+ m.uuid
781
+ )),
782
+ !_ && /* @__PURE__ */ t(
783
+ ht,
784
+ {
785
+ title: `${l.allowedLabel} · up to ${l.maxFileMb}MB each`,
786
+ arrow: !0,
787
+ placement: "top",
788
+ children: /* @__PURE__ */ f(
789
+ C,
790
+ {
791
+ className: "faq-media-tile add",
792
+ role: "button",
793
+ tabIndex: 0,
794
+ "aria-label": `Add ${n}`,
795
+ onClick: () => {
796
+ var m;
797
+ return !s && ((m = o.current) == null ? void 0 : m.click());
798
+ },
799
+ onKeyDown: (m) => {
800
+ var h;
801
+ (m.key === "Enter" || m.key === " ") && ((h = o.current) == null || h.click());
802
+ },
803
+ children: [
804
+ s ? /* @__PURE__ */ t(be, { size: 18 }) : /* @__PURE__ */ f(he, { children: [
805
+ /* @__PURE__ */ t(Q, { icon: ze }),
806
+ /* @__PURE__ */ t(M, { variant: "caption", children: "Add" })
807
+ ] }),
808
+ /* @__PURE__ */ t(
809
+ "input",
810
+ {
811
+ ref: o,
812
+ type: "file",
813
+ hidden: !0,
814
+ accept: l.accept,
815
+ onChange: q
816
+ }
817
+ )
818
+ ]
819
+ }
820
+ )
821
+ }
822
+ )
823
+ ] }),
824
+ /* @__PURE__ */ t(M, { variant: "caption", sx: { display: "block", mt: 0.75, color: "text.disabled" }, children: _ ? `Limit of ${l.maxItems} reached — remove one to add another.` : `Up to ${l.maxItems} ${n}s, ${l.maxFileMb}MB each (${l.allowedLabel}).` }),
825
+ d && /* @__PURE__ */ t(Re, { item: d, mediaType: n, onClose: () => c(null) })
826
+ ] });
827
+ }
828
+ fe.propTypes = {
829
+ mediaType: y.oneOf(["image", "video"]).isRequired,
830
+ items: y.arrayOf(y.shape({ uuid: y.string, fileName: y.string })),
831
+ onChange: y.func.isRequired
832
+ };
833
+ function Ze({ item: n, mediaType: e, onOpen: i, onRemove: o }) {
834
+ const { dataUrl: s, isLoading: a } = Ge(e === "image" ? n.uuid : null);
835
+ return /* @__PURE__ */ f(C, { className: "faq-media-tile", title: `${n.fileName} — click to view`, onClick: i, children: [
836
+ /* @__PURE__ */ t(
837
+ He,
838
+ {
839
+ size: "small",
840
+ className: "faq-media-remove",
841
+ "aria-label": `Remove ${n.fileName}`,
842
+ disableRipple: !0,
843
+ onClick: (d) => {
844
+ d.stopPropagation(), o();
845
+ },
846
+ children: /* @__PURE__ */ t(Q, { icon: Ve, size: "2xs" })
847
+ }
848
+ ),
849
+ e === "image" && a ? /* @__PURE__ */ t(be, { size: 16 }) : e === "image" && s ? /* @__PURE__ */ t(C, { component: "img", src: s, alt: n.fileName, className: "faq-media-thumb" }) : /* @__PURE__ */ t(
850
+ Q,
851
+ {
852
+ icon: e === "video" ? Oe : We,
853
+ className: "faq-media-icon"
854
+ }
855
+ ),
856
+ /* @__PURE__ */ t(M, { variant: "caption", className: "faq-media-caption", title: n.fileName, children: n.fileName })
857
+ ] });
858
+ }
859
+ Ze.propTypes = {
860
+ item: y.shape({ uuid: y.string, fileName: y.string }).isRequired,
861
+ mediaType: y.oneOf(["image", "video"]).isRequired,
862
+ onOpen: y.func.isRequired,
863
+ onRemove: y.func.isRequired
864
+ };
865
+ function Re({ item: n, mediaType: e, onClose: i }) {
866
+ const { dataUrl: o, isLoading: s } = Ge(n.uuid);
867
+ return /* @__PURE__ */ f(Pe, { open: !0, onClose: i, maxWidth: "md", fullWidth: !0, children: [
868
+ /* @__PURE__ */ t(Me, { sx: { pr: 6, wordBreak: "break-all" }, children: n.fileName }),
869
+ /* @__PURE__ */ t(Fe, { dividers: !0, sx: { display: "flex", justifyContent: "center", minHeight: 160 }, children: s ? /* @__PURE__ */ t(be, { size: 26, sx: { alignSelf: "center" } }) : o ? e === "video" ? /* @__PURE__ */ t("video", { src: o, controls: !0, autoPlay: !0, style: { width: "100%", maxHeight: "70vh" } }) : /* @__PURE__ */ t(
870
+ C,
871
+ {
872
+ component: "img",
873
+ src: o,
874
+ alt: n.fileName,
875
+ sx: { maxWidth: "100%", maxHeight: "70vh", objectFit: "contain" }
876
+ }
877
+ ) : /* @__PURE__ */ t(
878
+ M,
879
+ {
880
+ variant: "body2",
881
+ sx: { color: "error.main", alignSelf: "center", textAlign: "center" },
882
+ children: "Couldn't load this file. It may be missing from storage — try removing it and uploading again."
883
+ }
884
+ ) }),
885
+ /* @__PURE__ */ t(Ne, { children: /* @__PURE__ */ t(U, { onClick: i, sx: { textTransform: "none" }, children: "Close" }) })
886
+ ] });
887
+ }
888
+ Re.propTypes = {
889
+ item: y.shape({ uuid: y.string, fileName: y.string }).isRequired,
890
+ mediaType: y.oneOf(["image", "video"]).isRequired,
891
+ onClose: y.func.isRequired
892
+ };
893
+ class xe extends ri {
894
+ }
895
+ xe.builtinPlugins = [
896
+ li,
897
+ ci,
898
+ Ye,
899
+ qi,
900
+ di,
901
+ ui,
902
+ mi,
903
+ pi,
904
+ gi,
905
+ yi
906
+ ];
907
+ xe.defaultConfig = {
908
+ licenseKey: "GPL",
909
+ toolbar: {
910
+ items: [
911
+ "undo",
912
+ "redo",
913
+ "|",
914
+ "heading",
915
+ "|",
916
+ "bold",
917
+ "italic",
918
+ "underline",
919
+ "|",
920
+ "bulletedList",
921
+ "numberedList",
922
+ "|",
923
+ "link",
924
+ "blockQuote"
925
+ ]
926
+ },
927
+ link: {
928
+ addTargetToExternalLinks: !0,
929
+ defaultProtocol: "https://"
930
+ },
931
+ language: "en"
932
+ };
933
+ const te = 10;
934
+ function et({ langCode: n, control: e, getValues: i, setValue: o, errors: s, dataTestId: a }) {
935
+ const d = bt(), c = d.palette.mode === "dark", { translate: l } = se(), [u, _] = E(() => {
936
+ const x = i(`${n}.tags`);
937
+ return x ? x.split(",").map((p) => p.trim()).filter(Boolean) : [];
938
+ }), [q, m] = E(() => i(`${n}.media`) || []), h = (x) => {
939
+ _(x), o(`${n}.tags`, x.join(", "));
940
+ }, v = (x) => {
941
+ m(x), o(`${n}.media`, x);
942
+ }, k = () => {
943
+ const x = (i(`${n}.tagDraft`) || "").split(",").map((P) => P.trim()).filter(Boolean);
944
+ if (x.length === 0) {
945
+ I({ type: "error", message: l("Enter a tag first") });
946
+ return;
947
+ }
948
+ const p = x.filter((P) => !u.includes(P));
949
+ if (p.length === 0) {
950
+ I({ type: "error", message: l("Tag already exists") });
951
+ return;
952
+ }
953
+ if (u.length + p.length > te) {
954
+ I({ type: "error", message: `You can add up to ${te} tags` });
955
+ return;
956
+ }
957
+ h([...u, ...p]), o(`${n}.tagDraft`, "");
958
+ };
959
+ return /* @__PURE__ */ f(ne, { spacing: 2.5, "data-testid": a, children: [
960
+ /* @__PURE__ */ f(C, { children: [
961
+ /* @__PURE__ */ t(N, { required: !0, children: l("Question") }),
962
+ /* @__PURE__ */ t(
963
+ ae,
964
+ {
965
+ control: e,
966
+ name: `${n}.Question`,
967
+ errors: s,
968
+ placeholder: l("What will people be asking?"),
969
+ dataTestId: `${a}-question-input`
970
+ }
971
+ )
972
+ ] }),
973
+ /* @__PURE__ */ f(C, { children: [
974
+ /* @__PURE__ */ t(N, { required: !0, children: l("Answer") }),
975
+ /* @__PURE__ */ t(
976
+ C,
977
+ {
978
+ "data-testid": `${a}-description-editor`,
979
+ sx: {
980
+ borderRadius: 2,
981
+ overflow: "hidden",
982
+ border: "1px solid",
983
+ borderColor: "divider",
984
+ "& .ck-editor__main > .ck-editor__editable": {
985
+ backgroundColor: `${d.palette.background.paper} !important`,
986
+ color: `${d.palette.text.primary} !important`,
987
+ minHeight: "160px",
988
+ fontSize: "14px",
989
+ "&.ck-focused": {
990
+ borderColor: `${d.palette.primary.main} !important`
991
+ }
992
+ },
993
+ "& .ck.ck-toolbar": {
994
+ backgroundColor: c ? `${d.palette.background.default} !important` : "var(--color-gray4) !important",
995
+ borderColor: `${d.palette.divider} !important`
996
+ },
997
+ "& .ck.ck-toolbar .ck-button": {
998
+ color: `${d.palette.text.primary} !important`,
999
+ cursor: "pointer",
1000
+ "&:hover": {
1001
+ backgroundColor: `${d.palette.action.hover} !important`
1002
+ },
1003
+ "&.ck-on": {
1004
+ color: `${d.palette.primary.main} !important`
1005
+ }
1006
+ },
1007
+ "& .ck.ck-label": {
1008
+ color: `${d.palette.text.secondary} !important`
1009
+ }
1010
+ },
1011
+ children: /* @__PURE__ */ t(
1012
+ Kt,
1013
+ {
1014
+ editor: xe,
1015
+ data: i(`${n}.description`) || "",
1016
+ config: { placeholder: l("Write the answer people will see") },
1017
+ onChange: (x, p) => o(`${n}.description`, p.getData())
1018
+ }
1019
+ )
1020
+ }
1021
+ ),
1022
+ /* @__PURE__ */ t(oe, { children: l("Images and videos are added below, not inside the answer text.") })
1023
+ ] }),
1024
+ /* @__PURE__ */ f(C, { children: [
1025
+ /* @__PURE__ */ t(N, { icon: We, children: l("Images") }),
1026
+ /* @__PURE__ */ t(
1027
+ fe,
1028
+ {
1029
+ mediaType: "image",
1030
+ items: q.filter((x) => x.type === "image"),
1031
+ onChange: (x) => v([...q.filter((p) => p.type !== "image"), ...x])
1032
+ }
1033
+ )
1034
+ ] }),
1035
+ /* @__PURE__ */ f(C, { children: [
1036
+ /* @__PURE__ */ t(N, { icon: Oe, children: l("Videos") }),
1037
+ /* @__PURE__ */ t(
1038
+ fe,
1039
+ {
1040
+ mediaType: "video",
1041
+ items: q.filter((x) => x.type === "video"),
1042
+ onChange: (x) => v([...q.filter((p) => p.type !== "video"), ...x])
1043
+ }
1044
+ )
1045
+ ] }),
1046
+ /* @__PURE__ */ f(C, { children: [
1047
+ /* @__PURE__ */ t(N, { children: l("Tags") }),
1048
+ /* @__PURE__ */ f(C, { sx: { display: "flex", gap: 1, alignItems: "flex-start" }, children: [
1049
+ /* @__PURE__ */ t(C, { sx: { flex: 1 }, children: /* @__PURE__ */ t(
1050
+ ae,
1051
+ {
1052
+ control: e,
1053
+ name: `${n}.tagDraft`,
1054
+ placeholder: l("Add a tag and press Enter"),
1055
+ onKeyDown: (x) => {
1056
+ x.key === "Enter" && (x.preventDefault(), k());
1057
+ },
1058
+ dataTestId: `${a}-tag-input`
1059
+ }
1060
+ ) }),
1061
+ /* @__PURE__ */ t(
1062
+ U,
1063
+ {
1064
+ variant: "outlined",
1065
+ onClick: k,
1066
+ disabled: u.length >= te,
1067
+ sx: { textTransform: "none", height: 40, flexShrink: 0 },
1068
+ startIcon: /* @__PURE__ */ t(Q, { icon: ze, size: "xs" }),
1069
+ "data-testid": `${a}-add-tag-button`,
1070
+ children: l("Add")
1071
+ }
1072
+ )
1073
+ ] }),
1074
+ u.length > 0 && /* @__PURE__ */ t(
1075
+ C,
1076
+ {
1077
+ sx: { display: "flex", flexWrap: "wrap", gap: 0.75, mt: 1.25 },
1078
+ "data-testid": `${a}-tag-list`,
1079
+ children: u.map((x) => /* @__PURE__ */ t(
1080
+ Se,
1081
+ {
1082
+ label: x,
1083
+ size: "small",
1084
+ onDelete: () => h(u.filter((p) => p !== x)),
1085
+ deleteIcon: /* @__PURE__ */ t(Q, { icon: Ve, size: "2xs" }),
1086
+ "data-testid": `${a}-tag-${x}`
1087
+ },
1088
+ x
1089
+ ))
1090
+ }
1091
+ ),
1092
+ /* @__PURE__ */ f(oe, { children: [
1093
+ l("Tags help people find this answer in search."),
1094
+ " ",
1095
+ u.length,
1096
+ "/",
1097
+ te
1098
+ ] })
1099
+ ] })
1100
+ ] });
1101
+ }
1102
+ et.propTypes = {
1103
+ langCode: y.string.isRequired,
1104
+ control: y.any,
1105
+ getValues: y.func.isRequired,
1106
+ setValue: y.func.isRequired,
1107
+ errors: y.any,
1108
+ dataTestId: y.string
1109
+ };
1110
+ const Li = me.object().shape({
1111
+ questionTitle: me.string().required("Question title is required").trim(),
1112
+ categoryType: me.string().required("Category is required")
1113
+ }), ie = (n) => (n || "").replace(/<[^>]*>/g, " ").trim();
1114
+ function en() {
1115
+ const [n, e] = E([]), [i, o] = E([]), s = vt(), { id: a } = Ct(), [d] = kt(), { translate: c } = se(), { user: l } = qt((r) => r.Authenticate), [u, _] = E(!1), [q, m] = E(() => a ? null : d.get("audience") || "HCW"), [h, v] = E(0), [k, x] = E([]), [p, P] = E([]), [V, re] = E(null), [tt, le] = E(0), {
1116
+ control: ce,
1117
+ handleSubmit: it,
1118
+ getValues: j,
1119
+ setValue: O,
1120
+ formState: { errors: de, isSubmitting: ve }
1121
+ } = De({
1122
+ resolver: Tt(Li)
1123
+ }), F = Le(() => ((a ? k : p) || []).map((g) => ({
1124
+ code: (g.language_code || g.languagecode || "").toUpperCase(),
1125
+ name: g.name || g.language_code || g.languagecode || ""
1126
+ })).filter((g) => g.code), [a, k, p]);
1127
+ $e(() => {
1128
+ !V && F.length > 0 && re(F[0].code);
1129
+ }, [F, V]);
1130
+ const Y = Le(() => {
1131
+ const r = {};
1132
+ return F.forEach(({ code: g }) => {
1133
+ const $ = (j(`${g}.Question`) || "").trim(), T = ie(j(`${g}.description`));
1134
+ r[g] = { question: !!$, answer: !!T };
1135
+ }), r;
1136
+ }, [F, tt, j]), nt = Object.values(Y).filter((r) => r.question && r.answer).length, Ce = q || "HCW", ke = (r) => {
1137
+ var g;
1138
+ return (((g = ye(r == null ? void 0 : r.additional_detail)) == null ? void 0 : g.audience) || "HCW") === Ce;
1139
+ }, at = n.filter(ke), ot = i.filter(ke), Z = async () => {
1140
+ try {
1141
+ const {
1142
+ data: { result: r }
1143
+ } = await D({ code: "mytecho_faq_get_category_type" });
1144
+ e(r);
1145
+ const {
1146
+ data: { result: g }
1147
+ } = await D({ code: "mytecho_get_all_category_type" });
1148
+ o(g);
1149
+ } catch (r) {
1150
+ I({ type: "error", message: (r == null ? void 0 : r.message) || "Unable to load categories" });
1151
+ }
1152
+ }, st = (r) => r ? r.split(",") : void 0, rt = async () => {
1153
+ try {
1154
+ await Z(), a ? (_(!0), await lt(parseInt(a))) : await qe();
1155
+ } catch (r) {
1156
+ console.error(r);
1157
+ }
1158
+ }, lt = async (r) => {
1159
+ var g, $, T;
1160
+ try {
1161
+ n.length === 0 && await Z();
1162
+ const {
1163
+ data: { result: L }
1164
+ } = await D({ code: "faq_retrive_question_by_id", parameters: { id: r } }), {
1165
+ data: { result: B }
1166
+ } = await D({ code: "faq_get_title_from_master", parameters: { id: r } });
1167
+ O("questionTitle", ((g = B[0]) == null ? void 0 : g.title) || ""), O("categoryType", ($ = L[0]) == null ? void 0 : $.category_id), m(((T = B[0]) == null ? void 0 : T.audience) || "HCW");
1168
+ const A = L.map((H) => ({
1169
+ ...H,
1170
+ tags: st(H.tags)
1171
+ }));
1172
+ await qe(A);
1173
+ } catch (L) {
1174
+ console.error(L);
1175
+ }
1176
+ }, qe = async (r = []) => {
1177
+ try {
1178
+ const {
1179
+ data: { result: g }
1180
+ } = await D({ code: "faq_language_list" }), $ = g.map((T) => {
1181
+ var L;
1182
+ return {
1183
+ ...T,
1184
+ languagecode: (L = T == null ? void 0 : T.languagecode) == null ? void 0 : L.toUpperCase()
1185
+ };
1186
+ });
1187
+ await ct($, r);
1188
+ } catch (g) {
1189
+ console.error(g);
1190
+ }
1191
+ }, ct = async (r = [], g = []) => {
1192
+ var $, T;
1193
+ try {
1194
+ const { data: L } = await Mt("techo.manage.faqs"), B = JSON.parse(L), A = [], H = (b) => {
1195
+ var w;
1196
+ return ((w = r.find(
1197
+ (K) => {
1198
+ var Te;
1199
+ return ((Te = K == null ? void 0 : K.languagecode) == null ? void 0 : Te.toUpperCase()) === (b == null ? void 0 : b.toUpperCase());
1200
+ }
1201
+ )) == null ? void 0 : w.name) || "";
1202
+ }, S = (b) => Nt.isTecho ? `update.manage.manage${b}Question` : `update.manage.managefaq${b}Question`;
1203
+ if (!a) {
1204
+ P(
1205
+ r.filter((b) => B[S(b.name)] === !0)
1206
+ );
1207
+ return;
1208
+ }
1209
+ const z = g.map((b) => {
1210
+ var w;
1211
+ return {
1212
+ ...b,
1213
+ language_code: (w = b.language_code) == null ? void 0 : w.toUpperCase()
1214
+ };
1215
+ }).map((b) => {
1216
+ const w = H(b.language_code);
1217
+ return B[S(w)] ? { ...b, name: w } : null;
1218
+ }).filter(Boolean), W = z.map(
1219
+ (b) => {
1220
+ var w;
1221
+ return (w = b == null ? void 0 : b.language_code) == null ? void 0 : w.toUpperCase();
1222
+ }
1223
+ ), R = {
1224
+ question: "",
1225
+ content: "",
1226
+ tags: [],
1227
+ media: null,
1228
+ title: (($ = g[0]) == null ? void 0 : $.title) || "",
1229
+ category_id: ((T = g[0]) == null ? void 0 : T.category_id) || ""
1230
+ };
1231
+ r.forEach((b) => {
1232
+ var K;
1233
+ const w = (K = b == null ? void 0 : b.languagecode) == null ? void 0 : K.toUpperCase();
1234
+ !W.includes(w) && B[S(b.name)] && A.push({
1235
+ ...R,
1236
+ name: b.name,
1237
+ language_code: w
1238
+ });
1239
+ });
1240
+ const J = [...z, ...A].sort(
1241
+ (b, w) => b.name.localeCompare(w.name)
1242
+ );
1243
+ J.forEach((b) => {
1244
+ const w = b.language_code;
1245
+ O(`${w}.Question`, b.question || ""), O(`${w}.description`, b.content || ""), O(
1246
+ `${w}.tags`,
1247
+ Array.isArray(b.tags) ? b.tags.join(", ") : b.tags || ""
1248
+ ), O(`${w}.media`, Gt(b.media));
1249
+ }), x(J), _(!0), le((b) => b + 1);
1250
+ } catch (L) {
1251
+ I({ type: "error", message: (L == null ? void 0 : L.message) || "Unable to load permissions" });
1252
+ }
1253
+ }, dt = () => {
1254
+ const g = F.map(({ code: T, name: L }) => ({
1255
+ code: T,
1256
+ name: L,
1257
+ question: !!(j(`${T}.Question`) || "").trim(),
1258
+ answer: !!ie(j(`${T}.description`))
1259
+ })).filter((T) => T.question || T.answer);
1260
+ if (g.length === 0)
1261
+ return { message: c("Add a question and answer for at least one language") };
1262
+ const $ = g.find((T) => !T.question || !T.answer);
1263
+ return $ ? {
1264
+ code: $.code,
1265
+ message: `${$.name} ${c("needs both a question and an answer")}`
1266
+ } : null;
1267
+ }, ut = async (r) => {
1268
+ var $, T;
1269
+ le((L) => L + 1);
1270
+ const g = dt();
1271
+ if (g) {
1272
+ g.code && re(g.code), I({ type: "error", message: g.message });
1273
+ return;
1274
+ }
1275
+ try {
1276
+ if (!a) {
1277
+ const B = p.map((A) => {
1278
+ var S, G, z, W;
1279
+ const H = A.languagecode;
1280
+ return {
1281
+ languageCode: H.toLowerCase(),
1282
+ title: r == null ? void 0 : r.questionTitle,
1283
+ categoryId: r == null ? void 0 : r.categoryType,
1284
+ audience: q,
1285
+ question: ((S = r[H]) == null ? void 0 : S.Question) || "",
1286
+ content: ((G = r[H]) == null ? void 0 : G.description) || "",
1287
+ tags: ((z = r[H]) == null ? void 0 : z.tags) || "",
1288
+ media: Ie((W = r[H]) == null ? void 0 : W.media)
1289
+ };
1290
+ }).filter((A) => A.question && ie(A.content));
1291
+ await Ti(B), I({ type: "success", message: c("Question added successfully") }), s(-1);
1292
+ return;
1293
+ }
1294
+ const L = k.map((B) => {
1295
+ var H, S, G, z, W, R, J;
1296
+ const A = B.language_code;
1297
+ return {
1298
+ id: B.id,
1299
+ faqMasterId: B.faq_master_id || Number(a),
1300
+ languageCode: A == null ? void 0 : A.toLowerCase(),
1301
+ title: r == null ? void 0 : r.questionTitle,
1302
+ categoryId: r == null ? void 0 : r.categoryType,
1303
+ createdBy: l == null ? void 0 : l.id,
1304
+ question: ((S = (H = r[A]) == null ? void 0 : H.Question) == null ? void 0 : S.trim()) || null,
1305
+ content: ((z = (G = r[A]) == null ? void 0 : G.description) == null ? void 0 : z.trim()) || null,
1306
+ tags: ((R = (W = r[A]) == null ? void 0 : W.tags) == null ? void 0 : R.trim()) || null,
1307
+ media: Ie((J = r[A]) == null ? void 0 : J.media)
1308
+ };
1309
+ }).filter((B) => B.question && ie(B.content));
1310
+ await _i(L), I({ type: "success", message: c("Question updated successfully") }), s(-1);
1311
+ } catch (L) {
1312
+ console.error("Error in onsubmit:", L), I({
1313
+ type: "error",
1314
+ message: ((T = ($ = L == null ? void 0 : L.response) == null ? void 0 : $.data) == null ? void 0 : T.message) || "Unable to save data"
1315
+ });
1316
+ }
1317
+ };
1318
+ $e(() => {
1319
+ rt();
1320
+ }, []);
1321
+ const mt = F.map(({ code: r, name: g }) => {
1322
+ var $, T, L, B;
1323
+ return {
1324
+ value: r,
1325
+ label: g || r,
1326
+ icon: ($ = Y[r]) != null && $.question && ((T = Y[r]) != null && T.answer) ? "faCircleCheck" : void 0,
1327
+ ariaLabel: `${g || r}${(L = Y[r]) != null && L.question && ((B = Y[r]) != null && B.answer) ? " (complete)" : " (incomplete)"}`,
1328
+ dataTestId: `faq-language-tab-${r}`
1329
+ };
1330
+ });
1331
+ return /* @__PURE__ */ f(
1332
+ yt,
1333
+ {
1334
+ elevation: 0,
1335
+ sx: {
1336
+ p: { xs: 2.5, md: 3 },
1337
+ mt: 2,
1338
+ mb: 3,
1339
+ border: "1px solid",
1340
+ borderColor: "divider",
1341
+ borderRadius: 3,
1342
+ backgroundColor: "background.paper"
1343
+ },
1344
+ "data-testid": "faq-form-card",
1345
+ children: [
1346
+ /* @__PURE__ */ t(
1347
+ Je,
1348
+ {
1349
+ open: h === 1,
1350
+ onClose: () => {
1351
+ v(0), Z();
1352
+ },
1353
+ allCategoryList: ot,
1354
+ getCategoryType: Z,
1355
+ audience: Ce
1356
+ }
1357
+ ),
1358
+ /* @__PURE__ */ f(ne, { spacing: 3, children: [
1359
+ /* @__PURE__ */ f(C, { sx: { display: "flex", alignItems: "center", gap: 1.75 }, "data-testid": "faq-form-header", children: [
1360
+ /* @__PURE__ */ t(
1361
+ C,
1362
+ {
1363
+ sx: {
1364
+ width: 44,
1365
+ height: 44,
1366
+ borderRadius: 2.5,
1367
+ flexShrink: 0,
1368
+ display: "flex",
1369
+ alignItems: "center",
1370
+ justifyContent: "center",
1371
+ color: "primary.main",
1372
+ backgroundColor: "action.hover"
1373
+ },
1374
+ children: /* @__PURE__ */ t(Q, { icon: a ? $t : Ue })
1375
+ }
1376
+ ),
1377
+ /* @__PURE__ */ f(C, { sx: { minWidth: 0 }, children: [
1378
+ /* @__PURE__ */ f(C, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
1379
+ /* @__PURE__ */ t(
1380
+ M,
1381
+ {
1382
+ variant: "h5",
1383
+ component: "h1",
1384
+ sx: { fontWeight: 800, color: "text.primary", mb: 0.25 },
1385
+ "data-testid": "faq-form-title",
1386
+ children: c(a ? "Update Question" : "Add Question")
1387
+ }
1388
+ ),
1389
+ q === "PATIENT" && /* @__PURE__ */ t(
1390
+ Se,
1391
+ {
1392
+ size: "small",
1393
+ icon: /* @__PURE__ */ t(Q, { icon: wt, size: "2xs" }),
1394
+ label: c("Patient Portal"),
1395
+ "data-testid": "faq-form-audience-chip"
1396
+ }
1397
+ )
1398
+ ] }),
1399
+ /* @__PURE__ */ t(M, { variant: "body2", color: "text.secondary", children: c(
1400
+ "Write one answer per language, with optional images and videos people can open."
1401
+ ) })
1402
+ ] })
1403
+ ] }),
1404
+ /* @__PURE__ */ t(we, {}),
1405
+ /* @__PURE__ */ f(ue, { container: !0, spacing: { xs: 3, md: 4 }, alignItems: "flex-start", children: [
1406
+ /* @__PURE__ */ t(ue, { size: { xs: 12, md: 5 }, "data-testid": "faq-form-left-panel", children: /* @__PURE__ */ f(ne, { spacing: 2.5, children: [
1407
+ /* @__PURE__ */ f(C, { children: [
1408
+ /* @__PURE__ */ t(N, { required: !0, icon: It, children: c("Question Title") }),
1409
+ /* @__PURE__ */ t(
1410
+ ae,
1411
+ {
1412
+ control: ce,
1413
+ name: "questionTitle",
1414
+ errors: de,
1415
+ placeholder: c("A short name for this FAQ"),
1416
+ dataTestId: "question-title-input"
1417
+ }
1418
+ ),
1419
+ /* @__PURE__ */ t(oe, { children: c("Used to identify this entry in the list — not shown as the question.") })
1420
+ ] }),
1421
+ /* @__PURE__ */ f(C, { children: [
1422
+ /* @__PURE__ */ t(N, { required: !0, icon: Bt, children: c("Category") }),
1423
+ /* @__PURE__ */ t(
1424
+ Ht,
1425
+ {
1426
+ control: ce,
1427
+ name: "categoryType",
1428
+ options: at,
1429
+ displayName: "value",
1430
+ optionValue: "id",
1431
+ errors: de,
1432
+ dataTestId: "category-type-dropdown"
1433
+ }
1434
+ ),
1435
+ /* @__PURE__ */ t(C, { sx: { display: "flex", justifyContent: "flex-end", mt: 1 }, children: /* @__PURE__ */ t(
1436
+ U,
1437
+ {
1438
+ size: "small",
1439
+ onClick: () => v(1),
1440
+ startIcon: /* @__PURE__ */ t(Q, { icon: At, size: "xs" }),
1441
+ sx: { textTransform: "none" },
1442
+ "data-testid": "manage-category-button",
1443
+ children: c("Manage Categories")
1444
+ }
1445
+ ) })
1446
+ ] })
1447
+ ] }) }),
1448
+ /* @__PURE__ */ t(
1449
+ ue,
1450
+ {
1451
+ size: { xs: 12, md: 7 },
1452
+ sx: {
1453
+ borderLeft: { xs: "none", md: "1px solid" },
1454
+ borderColor: { md: "divider" },
1455
+ pl: { xs: 0, md: 4 }
1456
+ },
1457
+ "data-testid": "language-editor-section",
1458
+ children: /* @__PURE__ */ f(ne, { spacing: 2, children: [
1459
+ /* @__PURE__ */ f(
1460
+ C,
1461
+ {
1462
+ sx: {
1463
+ display: "flex",
1464
+ alignItems: "center",
1465
+ justifyContent: "space-between",
1466
+ gap: 2,
1467
+ flexWrap: "wrap"
1468
+ },
1469
+ children: [
1470
+ /* @__PURE__ */ f(
1471
+ M,
1472
+ {
1473
+ variant: "subtitle1",
1474
+ sx: { fontWeight: 700, display: "flex", alignItems: "center", gap: 1 },
1475
+ children: [
1476
+ /* @__PURE__ */ t(Q, { icon: Et, size: "sm", opacity: 0.6 }),
1477
+ c("Language-wise Questions")
1478
+ ]
1479
+ }
1480
+ ),
1481
+ F.length > 0 && /* @__PURE__ */ f(
1482
+ M,
1483
+ {
1484
+ variant: "caption",
1485
+ sx: { display: "flex", alignItems: "center", gap: 0.5, color: "text.secondary" },
1486
+ children: [
1487
+ /* @__PURE__ */ t(Q, { icon: Qt, size: "xs" }),
1488
+ nt,
1489
+ "/",
1490
+ F.length,
1491
+ " ",
1492
+ c("completed")
1493
+ ]
1494
+ }
1495
+ )
1496
+ ]
1497
+ }
1498
+ ),
1499
+ F.length === 0 ? /* @__PURE__ */ t(xt, { severity: "warning", variant: "outlined", children: c(
1500
+ "You don't have permission to manage any language. Ask an administrator to grant language access for FAQs."
1501
+ ) }) : /* @__PURE__ */ f(he, { children: [
1502
+ /* @__PURE__ */ t(
1503
+ Ft,
1504
+ {
1505
+ tabs: mt,
1506
+ value: V,
1507
+ onChange: (r, g) => {
1508
+ le(($) => $ + 1), re(g);
1509
+ },
1510
+ collapseLabels: !1,
1511
+ ariaLabel: c("Languages"),
1512
+ panelId: "faq-language-panel",
1513
+ dataTestId: "faq-language-tabs",
1514
+ sx: { maxWidth: "100%" }
1515
+ }
1516
+ ),
1517
+ /* @__PURE__ */ t(
1518
+ C,
1519
+ {
1520
+ id: "faq-language-panel",
1521
+ role: "tabpanel",
1522
+ sx: { pt: 0.5 },
1523
+ children: V && /* @__PURE__ */ t(
1524
+ et,
1525
+ {
1526
+ langCode: V,
1527
+ control: ce,
1528
+ getValues: j,
1529
+ setValue: O,
1530
+ errors: de,
1531
+ dataTestId: `language-editor-${V}`
1532
+ },
1533
+ V
1534
+ )
1535
+ }
1536
+ )
1537
+ ] })
1538
+ ] })
1539
+ }
1540
+ )
1541
+ ] }),
1542
+ /* @__PURE__ */ t(we, {}),
1543
+ /* @__PURE__ */ f(
1544
+ C,
1545
+ {
1546
+ sx: { display: "flex", justifyContent: "flex-end", gap: 1.5, flexWrap: "wrap" },
1547
+ "data-testid": "faq-form-buttons",
1548
+ children: [
1549
+ /* @__PURE__ */ t(
1550
+ U,
1551
+ {
1552
+ variant: "outlined",
1553
+ color: "inherit",
1554
+ onClick: () => s(-1),
1555
+ sx: { textTransform: "none" },
1556
+ "data-testid": "faq-cancel-button",
1557
+ children: c("Cancel")
1558
+ }
1559
+ ),
1560
+ /* @__PURE__ */ t(
1561
+ U,
1562
+ {
1563
+ variant: "contained",
1564
+ onClick: it(ut),
1565
+ disabled: ve || F.length === 0,
1566
+ startIcon: /* @__PURE__ */ t(Q, { icon: Pt, size: "xs" }),
1567
+ sx: { textTransform: "none" },
1568
+ "data-testid": "faq-submit-button",
1569
+ children: c(ve ? "Saving…" : u && a ? "Update" : "Save")
1570
+ }
1571
+ )
1572
+ ]
1573
+ }
1574
+ )
1575
+ ] })
1576
+ ]
1577
+ }
1578
+ );
1579
+ }
1580
+ export {
1581
+ en as default
1582
+ };
1583
+ //# sourceMappingURL=ManageFaq-4cT6bntx.js.map