@attabot/complaint-app 1.0.0

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.
@@ -0,0 +1,2095 @@
1
+ import { jsx as e, jsxs as c, Fragment as Se } from "react/jsx-runtime";
2
+ import ce, { createContext as J, useEffect as U, useMemo as H, useContext as se, useState as E, useCallback as Z } from "react";
3
+ import { useNavigate as oe, useParams as xe, useSearchParams as Ce, BrowserRouter as Ae, Routes as De, Route as G } from "react-router-dom";
4
+ import de from "axios";
5
+ import F from "js-cookie";
6
+ const Te = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
7
+ let $ = "";
8
+ try {
9
+ if (typeof import.meta < "u" && Te?.VITE_API_URL)
10
+ $ = void 0;
11
+ else {
12
+ const t = typeof process < "u" ? process : null;
13
+ t?.env?.VITE_API_URL && ($ = t.env.VITE_API_URL);
14
+ }
15
+ } catch {
16
+ }
17
+ const Be = (t) => {
18
+ $ = t || "", q.defaults.baseURL = $;
19
+ }, Re = (t) => {
20
+ t ? F.set("token", t, { secure: !0, sameSite: "Strict" }) : F.remove("token");
21
+ }, Ee = () => F.get("token") || null, q = de.create({
22
+ baseURL: $,
23
+ transformRequest: [
24
+ function(t, a) {
25
+ const n = Ee();
26
+ return n ? a.Authorization = `Bearer ${n}` : delete a.Authorization, t == null || typeof t == "string" ? t : JSON.stringify(t);
27
+ }
28
+ ],
29
+ headers: {
30
+ Accept: "application/json",
31
+ "Content-Type": "application/json"
32
+ }
33
+ });
34
+ let K = !1, Q = null;
35
+ q.interceptors.response.use(
36
+ (t) => t,
37
+ async (t) => {
38
+ const a = t.config, n = t.response;
39
+ if (n && (n.status === 401 || n.status === 402)) {
40
+ const i = F.get("refreshToken");
41
+ if (i)
42
+ try {
43
+ K || (K = !0, Q = de.post(
44
+ `${$}/api/v1/auth/refresh`,
45
+ {},
46
+ {
47
+ headers: {
48
+ Authorization: `Bearer ${i}`
49
+ }
50
+ }
51
+ ));
52
+ const r = await Q, { token: l, refreshToken: u } = r.data;
53
+ return F.set("token", l, { secure: !0, sameSite: "Strict" }), u && F.set("refreshToken", u), a.headers.Authorization = `Bearer ${l}`, q(a);
54
+ } catch {
55
+ F.remove("token"), F.remove("refreshToken");
56
+ } finally {
57
+ K = !1, Q = null;
58
+ }
59
+ }
60
+ return Promise.reject(t);
61
+ }
62
+ );
63
+ const Me = J(null), Le = ({ children: t, apiUrl: a, authToken: n }) => (U(() => {
64
+ a && Be(a);
65
+ }, [a]), U(() => {
66
+ Re(n || null);
67
+ }, [n]), /* @__PURE__ */ e(Me.Provider, { value: { apiUrl: a, authToken: n }, children: t })), S = {
68
+ mode: "light",
69
+ colors: {
70
+ primary: "#2D64B8",
71
+ primaryHover: "#2557A3",
72
+ text: "#111827",
73
+ textSecondary: "#6B7280",
74
+ textMuted: "#9CA3AF",
75
+ border: "#E5E7EB",
76
+ borderLight: "#F3F4F6",
77
+ background: "#F5F5F5",
78
+ surface: "#FFFFFF",
79
+ white: "#FFFFFF",
80
+ onPrimary: "#FFFFFF",
81
+ activeBg: "#ECFDF5",
82
+ activeBorder: "#A7F3D0",
83
+ activeText: "#059669",
84
+ inactiveBg: "#F3F4F6",
85
+ inactiveBorder: "#D1D5DB",
86
+ inactiveText: "#6B7280",
87
+ link: "#2D64B8",
88
+ divider: "#E5E7EB",
89
+ accentBorder: "#C5D7F0",
90
+ accentBg: "#EEF4FB",
91
+ stepDone: "#D6E4F7",
92
+ success: "#22C55E",
93
+ danger: "#EF4444",
94
+ secondaryBtn: "#D1D5DB",
95
+ secondaryBtnHover: "#C4C9D1",
96
+ inputBg: "#FFFFFF",
97
+ tableHeadBg: "#EEF4FB",
98
+ sidebarBg: "#FAFBFD",
99
+ overlay: "rgba(16, 24, 40, 0.06)"
100
+ },
101
+ radii: {
102
+ sm: "6px",
103
+ md: "8px",
104
+ lg: "12px",
105
+ xl: "16px",
106
+ pill: "999px"
107
+ },
108
+ spacing: {
109
+ xs: "4px",
110
+ sm: "8px",
111
+ md: "12px",
112
+ lg: "16px",
113
+ xl: "24px",
114
+ xxl: "32px"
115
+ },
116
+ typography: {
117
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
118
+ h1Size: "28px",
119
+ h2Size: "16px",
120
+ bodySize: "14px",
121
+ labelSize: "13px",
122
+ valueSize: "22px",
123
+ smallSize: "13px"
124
+ },
125
+ shadow: {
126
+ card: "0 1px 2px rgba(16, 24, 40, 0.04)",
127
+ settings: "0 1px 3px rgba(16, 24, 40, 0.06)"
128
+ }
129
+ }, V = {
130
+ mode: "dark",
131
+ colors: {
132
+ primary: "#5B8DEF",
133
+ primaryHover: "#7BA3F3",
134
+ text: "#F3F4F6",
135
+ textSecondary: "#A1A1AA",
136
+ textMuted: "#71717A",
137
+ border: "#3F3F46",
138
+ borderLight: "#27272A",
139
+ background: "#0F1115",
140
+ surface: "#18181B",
141
+ white: "#FFFFFF",
142
+ onPrimary: "#FFFFFF",
143
+ activeBg: "#052E1C",
144
+ activeBorder: "#166534",
145
+ activeText: "#4ADE80",
146
+ inactiveBg: "#27272A",
147
+ inactiveBorder: "#3F3F46",
148
+ inactiveText: "#A1A1AA",
149
+ link: "#7BA3F3",
150
+ divider: "#3F3F46",
151
+ accentBorder: "#2A3A55",
152
+ accentBg: "#1A2333",
153
+ stepDone: "#1E3A5F",
154
+ success: "#22C55E",
155
+ danger: "#F87171",
156
+ secondaryBtn: "#3F3F46",
157
+ secondaryBtnHover: "#52525B",
158
+ inputBg: "#18181B",
159
+ tableHeadBg: "#1A2333",
160
+ sidebarBg: "#12141A",
161
+ overlay: "rgba(0, 0, 0, 0.35)"
162
+ },
163
+ radii: {
164
+ sm: "6px",
165
+ md: "8px",
166
+ lg: "12px",
167
+ xl: "16px",
168
+ pill: "999px"
169
+ },
170
+ spacing: {
171
+ xs: "4px",
172
+ sm: "8px",
173
+ md: "12px",
174
+ lg: "16px",
175
+ xl: "24px",
176
+ xxl: "32px"
177
+ },
178
+ typography: {
179
+ fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
180
+ h1Size: "28px",
181
+ h2Size: "16px",
182
+ bodySize: "14px",
183
+ labelSize: "13px",
184
+ valueSize: "22px",
185
+ smallSize: "13px"
186
+ },
187
+ shadow: {
188
+ card: "0 1px 2px rgba(0, 0, 0, 0.35)",
189
+ settings: "0 1px 3px rgba(0, 0, 0, 0.4)"
190
+ }
191
+ }, $e = {
192
+ light: S,
193
+ dark: V
194
+ };
195
+ function L(t) {
196
+ return t != null && typeof t == "object" && !Array.isArray(t);
197
+ }
198
+ function O(t, a) {
199
+ if (!L(a)) return t;
200
+ const n = { ...t };
201
+ return Object.keys(a).forEach((i) => {
202
+ const r = a[i];
203
+ L(r) && L(t[i]) ? n[i] = O(t[i], r) : r !== void 0 && (n[i] = r);
204
+ }), n;
205
+ }
206
+ function Pe(t) {
207
+ return !t || !L(t) ? { light: S, dark: V } : L(t.light) || L(t.dark) ? {
208
+ light: O(S, t.light || {}),
209
+ dark: O(V, t.dark || {})
210
+ } : {
211
+ light: O(S, t),
212
+ dark: O(V, t)
213
+ };
214
+ }
215
+ function Ie(t, a = !1) {
216
+ const n = Pe(t);
217
+ return {
218
+ ...a ? n.dark : n.light,
219
+ mode: a ? "dark" : "light",
220
+ __pack: n
221
+ };
222
+ }
223
+ const ze = {
224
+ primary: "--ca-primary",
225
+ primaryHover: "--ca-primary-hover",
226
+ text: "--ca-text",
227
+ textSecondary: "--ca-text-secondary",
228
+ textMuted: "--ca-text-muted",
229
+ border: "--ca-border",
230
+ borderLight: "--ca-border-light",
231
+ background: "--ca-bg",
232
+ surface: "--ca-surface",
233
+ white: "--ca-white",
234
+ onPrimary: "--ca-on-primary",
235
+ activeBg: "--ca-active-bg",
236
+ activeBorder: "--ca-active-border",
237
+ activeText: "--ca-active-text",
238
+ inactiveBg: "--ca-inactive-bg",
239
+ inactiveBorder: "--ca-inactive-border",
240
+ inactiveText: "--ca-inactive-text",
241
+ link: "--ca-link",
242
+ divider: "--ca-divider",
243
+ accentBorder: "--ca-accent-border",
244
+ accentBg: "--ca-accent-bg",
245
+ stepDone: "--ca-step-done",
246
+ success: "--ca-success",
247
+ danger: "--ca-danger",
248
+ secondaryBtn: "--ca-secondary-btn",
249
+ secondaryBtnHover: "--ca-secondary-btn-hover",
250
+ inputBg: "--ca-input-bg",
251
+ tableHeadBg: "--ca-table-head-bg",
252
+ sidebarBg: "--ca-sidebar-bg",
253
+ overlay: "--ca-overlay"
254
+ }, Oe = {
255
+ sm: "--ca-radius-sm",
256
+ md: "--ca-radius-md",
257
+ lg: "--ca-radius-lg",
258
+ xl: "--ca-radius-xl",
259
+ pill: "--ca-radius-pill"
260
+ }, He = {
261
+ fontFamily: "--ca-font",
262
+ h1Size: "--ca-h1-size",
263
+ h2Size: "--ca-h2-size",
264
+ bodySize: "--ca-body-size",
265
+ labelSize: "--ca-label-size",
266
+ valueSize: "--ca-value-size",
267
+ smallSize: "--ca-small-size"
268
+ }, We = {
269
+ card: "--ca-shadow-card",
270
+ settings: "--ca-shadow-settings"
271
+ };
272
+ function je(t) {
273
+ const a = {};
274
+ return t?.colors && Object.entries(ze).forEach(([n, i]) => {
275
+ t.colors[n] != null && (a[i] = t.colors[n]);
276
+ }), t?.radii && Object.entries(Oe).forEach(([n, i]) => {
277
+ t.radii[n] != null && (a[i] = t.radii[n]);
278
+ }), t?.typography && Object.entries(He).forEach(([n, i]) => {
279
+ t.typography[n] != null && (a[i] = t.typography[n]);
280
+ }), t?.shadow && Object.entries(We).forEach(([n, i]) => {
281
+ t.shadow[n] != null && (a[i] = t.shadow[n]);
282
+ }), a["--ca-on-primary"] && !a["--ca-white"] && (a["--ca-white"] = a["--ca-on-primary"]), a;
283
+ }
284
+ const ue = J({
285
+ darkMode: !1,
286
+ theme: null,
287
+ themeFile: $e,
288
+ cssVars: {}
289
+ });
290
+ function Ve({ theme: t, darkMode: a = !1, children: n }) {
291
+ const i = H(() => {
292
+ const r = Ie(t, !!a), l = je(r);
293
+ return {
294
+ darkMode: !!a,
295
+ theme: r,
296
+ themeFile: r.__pack,
297
+ cssVars: l,
298
+ mode: r.mode
299
+ };
300
+ }, [t, a]);
301
+ return /* @__PURE__ */ e(ue.Provider, { value: i, children: n });
302
+ }
303
+ function Ue() {
304
+ return se(ue);
305
+ }
306
+ function k({
307
+ children: t,
308
+ variant: a = "primary",
309
+ size: n = "md",
310
+ startIcon: i,
311
+ endIcon: r,
312
+ className: l = "",
313
+ type: u = "button",
314
+ disabled: o = !1,
315
+ onClick: p,
316
+ ...m
317
+ }) {
318
+ const d = [
319
+ "ca-btn",
320
+ `ca-btn--${a}`,
321
+ n === "sm" ? "ca-btn--sm" : "",
322
+ n === "lg" ? "ca-btn--lg" : "",
323
+ l
324
+ ].filter(Boolean).join(" ");
325
+ return /* @__PURE__ */ c(
326
+ "button",
327
+ {
328
+ type: u,
329
+ className: d,
330
+ disabled: o,
331
+ onClick: p,
332
+ ...m,
333
+ children: [
334
+ i ? /* @__PURE__ */ e("span", { className: "ca-btn__icon", children: i }) : null,
335
+ t,
336
+ r ? /* @__PURE__ */ e("span", { className: "ca-btn__icon", children: r }) : null
337
+ ]
338
+ }
339
+ );
340
+ }
341
+ function pe({ size: t = 16, color: a = "currentColor", ...n }) {
342
+ return /* @__PURE__ */ e(
343
+ "svg",
344
+ {
345
+ width: t,
346
+ height: t,
347
+ viewBox: "0 0 24 24",
348
+ fill: "none",
349
+ xmlns: "http://www.w3.org/2000/svg",
350
+ "aria-hidden": "true",
351
+ ...n,
352
+ children: /* @__PURE__ */ e(
353
+ "path",
354
+ {
355
+ d: "M12 5v14M5 12h14",
356
+ stroke: a,
357
+ strokeWidth: "2",
358
+ strokeLinecap: "round"
359
+ }
360
+ )
361
+ }
362
+ );
363
+ }
364
+ const te = {
365
+ h1: "ca-h1",
366
+ h2: "ca-h2",
367
+ body: "ca-body",
368
+ label: "ca-label",
369
+ value: "ca-value",
370
+ small: "ca-small",
371
+ link: "ca-link"
372
+ }, qe = {
373
+ h1: "h1",
374
+ h2: "h2",
375
+ body: "p",
376
+ label: "span",
377
+ value: "span",
378
+ small: "span",
379
+ link: "button"
380
+ };
381
+ function D({
382
+ variant: t = "body",
383
+ as: a,
384
+ className: n = "",
385
+ children: i,
386
+ ...r
387
+ }) {
388
+ const l = a || qe[t] || "p", u = te[t] || te.body;
389
+ return /* @__PURE__ */ e(l, { className: `${u} ${n}`.trim(), ...r, children: i });
390
+ }
391
+ function he(t) {
392
+ return /* @__PURE__ */ e(D, { variant: "h1", ...t });
393
+ }
394
+ function x(t) {
395
+ return /* @__PURE__ */ e(D, { variant: "h2", ...t });
396
+ }
397
+ function N(t) {
398
+ return /* @__PURE__ */ e(D, { variant: "body", ...t });
399
+ }
400
+ function X(t) {
401
+ return /* @__PURE__ */ e(D, { variant: "label", ...t });
402
+ }
403
+ function Ye(t) {
404
+ return /* @__PURE__ */ e(D, { variant: "value", ...t });
405
+ }
406
+ function Ge(t) {
407
+ return /* @__PURE__ */ e(D, { variant: "link", type: "button", ...t });
408
+ }
409
+ function Ke({
410
+ title: t = "Complaint Management",
411
+ description: a,
412
+ actionLabel: n = "Create New Form",
413
+ onAction: i,
414
+ className: r = ""
415
+ }) {
416
+ return /* @__PURE__ */ c("header", { className: `ca-page-header ${r}`.trim(), children: [
417
+ /* @__PURE__ */ c("div", { className: "ca-page-header__text", children: [
418
+ /* @__PURE__ */ e(he, { children: t }),
419
+ a ? /* @__PURE__ */ e(N, { children: a }) : null
420
+ ] }),
421
+ /* @__PURE__ */ e("div", { className: "ca-page-header__actions", children: /* @__PURE__ */ e(k, { startIcon: /* @__PURE__ */ e(pe, {}), onClick: i, children: n }) })
422
+ ] });
423
+ }
424
+ function me({ status: t = "inactive", label: a, className: n = "" }) {
425
+ const r = String(t).toLowerCase() === "active", l = a ?? (r ? "Active" : "Inactive");
426
+ return /* @__PURE__ */ e(
427
+ "span",
428
+ {
429
+ className: `ca-badge ca-badge--${r ? "active" : "inactive"} ${n}`.trim(),
430
+ children: l
431
+ }
432
+ );
433
+ }
434
+ function Qe({
435
+ title: t,
436
+ status: a,
437
+ statusLabel: n,
438
+ titleAsLink: i = !1,
439
+ onTitleClick: r,
440
+ className: l = ""
441
+ }) {
442
+ return /* @__PURE__ */ c("div", { className: `ca-system-card__header ${l}`.trim(), children: [
443
+ /* @__PURE__ */ e("div", { className: "ca-system-card__title-wrap", children: i ? /* @__PURE__ */ e(
444
+ "button",
445
+ {
446
+ type: "button",
447
+ className: "ca-h2 ca-h2--link",
448
+ onClick: r,
449
+ children: t
450
+ }
451
+ ) : /* @__PURE__ */ e(x, { children: t }) }),
452
+ /* @__PURE__ */ e(me, { status: a, label: n })
453
+ ] });
454
+ }
455
+ function Y({ size: t = 16, color: a = "currentColor", ...n }) {
456
+ return /* @__PURE__ */ e(
457
+ "svg",
458
+ {
459
+ width: t,
460
+ height: t,
461
+ viewBox: "0 0 24 24",
462
+ fill: "none",
463
+ xmlns: "http://www.w3.org/2000/svg",
464
+ "aria-hidden": "true",
465
+ ...n,
466
+ children: /* @__PURE__ */ e(
467
+ "path",
468
+ {
469
+ d: "M9 6l6 6-6 6",
470
+ stroke: a,
471
+ strokeWidth: "2",
472
+ strokeLinecap: "round",
473
+ strokeLinejoin: "round"
474
+ }
475
+ )
476
+ }
477
+ );
478
+ }
479
+ function Ze({
480
+ updatedOn: t,
481
+ configureLabel: a = "Configure",
482
+ onConfigure: n,
483
+ className: i = ""
484
+ }) {
485
+ return /* @__PURE__ */ c("div", { className: `ca-system-card__footer ${i}`.trim(), children: [
486
+ /* @__PURE__ */ e(D, { variant: "small", as: "span", children: t ? `Updated on ${t}` : "" }),
487
+ /* @__PURE__ */ e(
488
+ k,
489
+ {
490
+ size: "sm",
491
+ onClick: n,
492
+ endIcon: /* @__PURE__ */ e(Y, { size: 14, color: "#fff" }),
493
+ children: a
494
+ }
495
+ )
496
+ ] });
497
+ }
498
+ function Je({ label: t, value: a, className: n = "" }) {
499
+ const i = a == null ? "—" : typeof a == "number" ? String(a).padStart(2, "0") : a;
500
+ return /* @__PURE__ */ c("div", { className: `ca-data-point ${n}`.trim(), children: [
501
+ /* @__PURE__ */ e(X, { children: t }),
502
+ /* @__PURE__ */ e(Ye, { children: i })
503
+ ] });
504
+ }
505
+ function Xe({ className: t = "" }) {
506
+ return /* @__PURE__ */ e("div", { className: `ca-divider ${t}`.trim(), role: "separator", "aria-orientation": "vertical" });
507
+ }
508
+ function et({
509
+ id: t,
510
+ title: a,
511
+ status: n = "inactive",
512
+ statusLabel: i,
513
+ description: r,
514
+ descriptionHref: l,
515
+ departments: u,
516
+ workflows: o,
517
+ fields: p,
518
+ formsFilled: m,
519
+ updatedOn: d,
520
+ titleAsLink: s = !1,
521
+ onTitleClick: h,
522
+ onDescriptionClick: g,
523
+ onConfigure: f,
524
+ className: v = ""
525
+ }) {
526
+ const b = () => {
527
+ f?.({
528
+ id: t,
529
+ title: a,
530
+ status: n,
531
+ departments: u,
532
+ workflows: o,
533
+ fields: p,
534
+ formsFilled: m,
535
+ updatedOn: d
536
+ });
537
+ }, T = () => {
538
+ if (g) {
539
+ g({ id: t, title: a, descriptionHref: l });
540
+ return;
541
+ }
542
+ l && typeof window < "u" && window.open(l, "_blank", "noopener,noreferrer");
543
+ }, B = [
544
+ { label: "Departments", value: u },
545
+ { label: "Workflows", value: o },
546
+ { label: "Fields", value: p },
547
+ { label: "Forms Filled", value: m }
548
+ ];
549
+ return /* @__PURE__ */ c("article", { className: `ca-system-card ${v}`.trim(), children: [
550
+ /* @__PURE__ */ e(
551
+ Qe,
552
+ {
553
+ title: a,
554
+ status: n,
555
+ statusLabel: i,
556
+ titleAsLink: s,
557
+ onTitleClick: () => h?.({ id: t, title: a })
558
+ }
559
+ ),
560
+ r ? /* @__PURE__ */ e(Ge, { onClick: T, children: r }) : null,
561
+ /* @__PURE__ */ e("div", { className: "ca-system-card__stats", children: B.map((w, z) => /* @__PURE__ */ c(ce.Fragment, { children: [
562
+ z > 0 ? /* @__PURE__ */ e(Xe, {}) : null,
563
+ /* @__PURE__ */ e(Je, { label: w.label, value: w.value })
564
+ ] }, w.label)) }),
565
+ /* @__PURE__ */ e(Ze, { updatedOn: d, onConfigure: b })
566
+ ] });
567
+ }
568
+ function tt({
569
+ systems: t = [],
570
+ onConfigure: a,
571
+ onTitleClick: n,
572
+ onDescriptionClick: i,
573
+ emptyMessage: r = "No systems found.",
574
+ className: l = ""
575
+ }) {
576
+ return t.length ? /* @__PURE__ */ e("div", { className: `ca-system-grid ${l}`.trim(), children: t.map((u) => /* @__PURE__ */ e(
577
+ et,
578
+ {
579
+ ...u,
580
+ onConfigure: a,
581
+ onTitleClick: n,
582
+ onDescriptionClick: i
583
+ },
584
+ u.id ?? u.title
585
+ )) }) : /* @__PURE__ */ e("div", { className: `ca-system-grid ${l}`.trim(), children: /* @__PURE__ */ e("div", { className: "ca-empty", children: /* @__PURE__ */ e(N, { children: r }) }) });
586
+ }
587
+ function C({
588
+ value: t,
589
+ onChange: a,
590
+ placeholder: n,
591
+ type: i = "text",
592
+ icon: r,
593
+ className: l = "",
594
+ inputClassName: u = "",
595
+ ...o
596
+ }) {
597
+ return /* @__PURE__ */ c("div", { className: `ca-input-wrap ${l}`.trim(), children: [
598
+ r ? /* @__PURE__ */ e("span", { className: "ca-input-wrap__icon", children: r }) : null,
599
+ /* @__PURE__ */ e(
600
+ "input",
601
+ {
602
+ type: i,
603
+ className: `ca-input ${r ? "ca-input--with-icon" : ""} ${u}`.trim(),
604
+ value: t,
605
+ onChange: a,
606
+ placeholder: n,
607
+ ...o
608
+ }
609
+ )
610
+ ] });
611
+ }
612
+ function at({ size: t = 18, color: a = "currentColor", ...n }) {
613
+ return /* @__PURE__ */ c(
614
+ "svg",
615
+ {
616
+ width: t,
617
+ height: t,
618
+ viewBox: "0 0 24 24",
619
+ fill: "none",
620
+ xmlns: "http://www.w3.org/2000/svg",
621
+ "aria-hidden": "true",
622
+ ...n,
623
+ children: [
624
+ /* @__PURE__ */ e(
625
+ "path",
626
+ {
627
+ d: "M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15Z",
628
+ stroke: a,
629
+ strokeWidth: "1.75"
630
+ }
631
+ ),
632
+ /* @__PURE__ */ e(
633
+ "path",
634
+ {
635
+ d: "M16.5 16.5 21 21",
636
+ stroke: a,
637
+ strokeWidth: "1.75",
638
+ strokeLinecap: "round"
639
+ }
640
+ )
641
+ ]
642
+ }
643
+ );
644
+ }
645
+ function nt({
646
+ value: t,
647
+ onChange: a,
648
+ onSearch: n,
649
+ placeholder: i = "Search",
650
+ className: r = ""
651
+ }) {
652
+ const l = (u) => {
653
+ u.key === "Enter" && n && n(t);
654
+ };
655
+ return /* @__PURE__ */ e("div", { className: `ca-search ${r}`.trim(), children: /* @__PURE__ */ e(
656
+ C,
657
+ {
658
+ value: t,
659
+ onChange: a,
660
+ onKeyDown: l,
661
+ placeholder: i,
662
+ icon: /* @__PURE__ */ e(at, {}),
663
+ "aria-label": i
664
+ }
665
+ ) });
666
+ }
667
+ function it({ text: t = "Loading", fullScreen: a = !1 }) {
668
+ return /* @__PURE__ */ c(
669
+ "div",
670
+ {
671
+ className: "ca-loading",
672
+ style: a ? { minHeight: "calc(100vh - 80px)" } : void 0,
673
+ role: "status",
674
+ "aria-live": "polite",
675
+ children: [
676
+ /* @__PURE__ */ e("span", { className: "ca-loading__spinner" }),
677
+ /* @__PURE__ */ c("span", { children: [
678
+ t,
679
+ "…"
680
+ ] })
681
+ ]
682
+ }
683
+ );
684
+ }
685
+ const rt = [
686
+ {
687
+ id: "qms",
688
+ title: "QMS - Query Management System",
689
+ status: "active",
690
+ description: "Description of the template",
691
+ departments: 3,
692
+ workflows: 12,
693
+ fields: 55,
694
+ formsFilled: 234,
695
+ updatedOn: "12 Mar 2024",
696
+ titleAsLink: !0
697
+ },
698
+ {
699
+ id: "cms",
700
+ title: "CMS - Complaint Management System",
701
+ status: "active",
702
+ description: "Description of the template",
703
+ departments: 5,
704
+ workflows: 8,
705
+ fields: 42,
706
+ formsFilled: 189,
707
+ updatedOn: "08 Mar 2024"
708
+ },
709
+ {
710
+ id: "fms",
711
+ title: "FMS - Feedback Management System",
712
+ status: "inactive",
713
+ description: "Description of the template",
714
+ departments: 2,
715
+ workflows: 4,
716
+ fields: 28,
717
+ formsFilled: 56,
718
+ updatedOn: "01 Feb 2024"
719
+ },
720
+ {
721
+ id: "rms",
722
+ title: "RMS - Request Management System",
723
+ status: "active",
724
+ description: "Description of the template",
725
+ departments: 4,
726
+ workflows: 10,
727
+ fields: 61,
728
+ formsFilled: 312,
729
+ updatedOn: "20 Mar 2024"
730
+ }
731
+ ], lt = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi.";
732
+ function ae(t = []) {
733
+ return t.map((a, n) => ({
734
+ id: a.id ?? a._id ?? `system-${n}`,
735
+ title: a.title ?? a.name ?? "Untitled",
736
+ status: a.status ?? "inactive",
737
+ statusLabel: a.statusLabel,
738
+ description: a.description ?? a.templateDescription,
739
+ descriptionHref: a.descriptionHref ?? a.url,
740
+ departments: a.departments ?? a.departmentCount ?? 0,
741
+ workflows: a.workflows ?? a.workflowCount ?? 0,
742
+ fields: a.fields ?? a.fieldCount ?? 0,
743
+ formsFilled: a.formsFilled ?? a.formFilledCount ?? a.forms_filled ?? 0,
744
+ updatedOn: a.updatedOn ?? a.updatedAt ?? a.updated_on,
745
+ titleAsLink: !!(a.titleAsLink ?? a.isLink)
746
+ }));
747
+ }
748
+ function ne({
749
+ title: t = "Complaint Management",
750
+ description: a = lt,
751
+ systems: n,
752
+ systemsEndpoint: i,
753
+ useDemoData: r = !0,
754
+ createLabel: l = "Create New Form",
755
+ onCreateForm: u,
756
+ onConfigure: o,
757
+ onTitleClick: p,
758
+ onDescriptionClick: m,
759
+ onSearch: d
760
+ }) {
761
+ const s = oe(), [h, g] = E(""), [f, v] = E(null), [b, T] = E(null), [B, w] = E(
762
+ i && !n ? "loading" : "idle"
763
+ );
764
+ U(() => {
765
+ if (!i || n)
766
+ return;
767
+ const y = new AbortController();
768
+ return q.get(i, { signal: y.signal }).then((_) => {
769
+ const R = _?.data, Fe = Array.isArray(R) ? R : R?.data ?? R?.systems ?? R?.results ?? [];
770
+ v(ae(Fe)), T(null), w("success");
771
+ }).catch((_) => {
772
+ y.signal.aborted || (T(_?.message || "Failed to load systems"), v([]), w("error"));
773
+ }), () => y.abort();
774
+ }, [i, n]);
775
+ const z = H(() => n ? ae(n) : f || (r ? rt : []), [n, f, r]), ke = H(() => {
776
+ const y = h.trim().toLowerCase();
777
+ return y ? z.filter((_) => `${_.title} ${_.description ?? ""} ${_.status ?? ""}`.toLowerCase().includes(y)) : z;
778
+ }, [z, h]);
779
+ return /* @__PURE__ */ c(Se, { children: [
780
+ /* @__PURE__ */ e(
781
+ Ke,
782
+ {
783
+ title: t,
784
+ description: a,
785
+ actionLabel: l,
786
+ onAction: u
787
+ }
788
+ ),
789
+ /* @__PURE__ */ e(nt, { value: h, onChange: (y) => {
790
+ const _ = y.target.value;
791
+ g(_), d?.(_);
792
+ }, placeholder: "Search" }),
793
+ B === "loading" ? /* @__PURE__ */ e(it, { text: "Loading systems" }) : b ? /* @__PURE__ */ e("div", { className: "ca-empty", children: /* @__PURE__ */ e("p", { className: "ca-body", children: b }) }) : /* @__PURE__ */ e(
794
+ tt,
795
+ {
796
+ systems: ke,
797
+ onConfigure: (y) => {
798
+ o?.(y), s(`/settings/${y.id ?? "new"}?step=1`);
799
+ },
800
+ onTitleClick: p,
801
+ onDescriptionClick: m,
802
+ emptyMessage: h ? "No systems match your search." : "No systems found."
803
+ }
804
+ )
805
+ ] });
806
+ }
807
+ function fe({
808
+ steps: t = [],
809
+ currentStep: a = 1,
810
+ onStepClick: n,
811
+ className: i = "",
812
+ size: r = "md"
813
+ }) {
814
+ return /* @__PURE__ */ e(
815
+ "nav",
816
+ {
817
+ className: `ca-stepper ca-stepper--${r} ${i}`.trim(),
818
+ "aria-label": "Progress",
819
+ children: t.map((l, u) => {
820
+ const o = l.id ?? u + 1, p = o === a, m = o < a, d = !!n && (m || p);
821
+ return /* @__PURE__ */ c(ce.Fragment, { children: [
822
+ u > 0 ? /* @__PURE__ */ e(
823
+ "div",
824
+ {
825
+ className: `ca-stepper__line ${m || p ? "ca-stepper__line--active" : ""}`
826
+ }
827
+ ) : null,
828
+ /* @__PURE__ */ c(
829
+ "button",
830
+ {
831
+ type: "button",
832
+ className: [
833
+ "ca-stepper__item",
834
+ p ? "ca-stepper__item--active" : "",
835
+ m ? "ca-stepper__item--done" : ""
836
+ ].filter(Boolean).join(" "),
837
+ onClick: () => d && n?.(o),
838
+ disabled: !d,
839
+ "aria-current": p ? "step" : void 0,
840
+ children: [
841
+ /* @__PURE__ */ e("span", { className: "ca-stepper__circle", children: o }),
842
+ /* @__PURE__ */ e("span", { className: "ca-stepper__label", children: l.label })
843
+ ]
844
+ }
845
+ )
846
+ ] }, o);
847
+ })
848
+ }
849
+ );
850
+ }
851
+ const ge = J(null), ct = {
852
+ categoryType: "qms",
853
+ active: !0,
854
+ description: "",
855
+ roles: ["Store Staff", "HR Executive", "HR Manager"],
856
+ departmentRows: [
857
+ { id: "1", department: "", subDepartment: "", roles: "" }
858
+ ],
859
+ priorityDraft: "",
860
+ priorities: [],
861
+ defaultPriorityId: null,
862
+ selectedDeptNode: "payroll",
863
+ workflow: {
864
+ name: "",
865
+ tatMinutes: "",
866
+ description: "",
867
+ statuses: [],
868
+ steps: []
869
+ },
870
+ fieldDraft: { name: "", type: "" },
871
+ formFields: []
872
+ };
873
+ function st({ children: t, initialValues: a }) {
874
+ const [n, i] = E({ ...ct, ...a }), r = Z((o) => {
875
+ i((p) => ({ ...p, ...o }));
876
+ }, []), l = Z((o) => {
877
+ i((p) => ({
878
+ ...p,
879
+ workflow: { ...p.workflow, ...o }
880
+ }));
881
+ }, []), u = H(
882
+ () => ({ state: n, setState: i, update: r, updateWorkflow: l }),
883
+ [n, r, l]
884
+ );
885
+ return /* @__PURE__ */ e(ge.Provider, { value: u, children: t });
886
+ }
887
+ function P() {
888
+ const t = se(ge);
889
+ if (!t)
890
+ throw new Error("useSettingsWizard must be used within SettingsWizardProvider");
891
+ return t;
892
+ }
893
+ const M = [
894
+ {
895
+ id: 1,
896
+ key: "category",
897
+ label: "Category Type",
898
+ title: "Category Type",
899
+ description: "Define the type and basic details for this category type."
900
+ },
901
+ {
902
+ id: 2,
903
+ key: "departments",
904
+ label: "Departments",
905
+ title: "Departments",
906
+ description: "----"
907
+ },
908
+ {
909
+ id: 3,
910
+ key: "priorities",
911
+ label: "Priorities",
912
+ title: "Priorities",
913
+ description: "----"
914
+ },
915
+ {
916
+ id: 4,
917
+ key: "workflow",
918
+ label: "Workflow",
919
+ title: "Workflow",
920
+ description: "----"
921
+ },
922
+ {
923
+ id: 5,
924
+ key: "formFields",
925
+ label: "Form Fields",
926
+ title: "Form Fields",
927
+ description: "----"
928
+ },
929
+ {
930
+ id: 6,
931
+ key: "review",
932
+ label: "Review & Publish",
933
+ title: "Review & Publish",
934
+ description: "Review your configuration and publish."
935
+ }
936
+ ], ie = [
937
+ { id: 1, label: "Create Workflow" },
938
+ { id: 2, label: "Statuses" },
939
+ { id: 3, label: "Workflow Steps" }
940
+ ], ot = ["Urgent", "High", "Medium", "Low"], ve = [
941
+ { id: "short", label: "Textfield / Short Answer", icon: "text" },
942
+ { id: "long", label: "Description / Long Answer", icon: "doc" },
943
+ { id: "date", label: "Date", icon: "calendar" },
944
+ { id: "time", label: "Time", icon: "clock" },
945
+ { id: "single", label: "Dropdown - Single Select", icon: "chevron" },
946
+ { id: "multi", label: "Dropdown - Multiple Select", icon: "chevron" }
947
+ ], be = [
948
+ "Store Staff",
949
+ "HR Executive",
950
+ "HR Manager",
951
+ "Store Manager",
952
+ "Admin"
953
+ ], ye = [
954
+ { value: "qms", label: "QMS - Query Management System" },
955
+ { value: "cms", label: "CMS - Complaint Management System" },
956
+ { value: "fms", label: "FMS - Feedback Management System" },
957
+ { value: "rms", label: "RMS - Request Management System" }
958
+ ], dt = [
959
+ {
960
+ id: "hr",
961
+ name: "HR",
962
+ children: [
963
+ { id: "payroll", name: "Payroll" },
964
+ { id: "recruitment", name: "Recruitment" }
965
+ ]
966
+ },
967
+ {
968
+ id: "finance",
969
+ name: "Finance",
970
+ children: [{ id: "ap", name: "Accounts Payable" }]
971
+ },
972
+ {
973
+ id: "it",
974
+ name: "IT",
975
+ children: []
976
+ }
977
+ ], ut = [
978
+ { value: "#EF4444", label: "Red" },
979
+ { value: "#F59E0B", label: "Orange" },
980
+ { value: "#EAB308", label: "Yellow" },
981
+ { value: "#22C55E", label: "Green" },
982
+ { value: "#3B82F6", label: "Blue" },
983
+ { value: "#8B5CF6", label: "Purple" }
984
+ ];
985
+ function pt({ size: t = 28, color: a = "currentColor", ...n }) {
986
+ return /* @__PURE__ */ c(
987
+ "svg",
988
+ {
989
+ width: t,
990
+ height: t,
991
+ viewBox: "0 0 24 24",
992
+ fill: "none",
993
+ "aria-hidden": "true",
994
+ style: { color: "var(--ca-primary)" },
995
+ ...n,
996
+ children: [
997
+ /* @__PURE__ */ e(
998
+ "path",
999
+ {
1000
+ d: "M12 3 3 8l9 5 9-5-9-5Z",
1001
+ stroke: a,
1002
+ strokeWidth: "1.6",
1003
+ strokeLinejoin: "round"
1004
+ }
1005
+ ),
1006
+ /* @__PURE__ */ e(
1007
+ "path",
1008
+ {
1009
+ d: "M3 12.5 12 17.5l9-5",
1010
+ stroke: a,
1011
+ strokeWidth: "1.6",
1012
+ strokeLinejoin: "round",
1013
+ strokeLinecap: "round"
1014
+ }
1015
+ ),
1016
+ /* @__PURE__ */ e(
1017
+ "path",
1018
+ {
1019
+ d: "M3 16.5 12 21.5l9-5",
1020
+ stroke: a,
1021
+ strokeWidth: "1.6",
1022
+ strokeLinejoin: "round",
1023
+ strokeLinecap: "round"
1024
+ }
1025
+ )
1026
+ ]
1027
+ }
1028
+ );
1029
+ }
1030
+ function ht({
1031
+ title: t,
1032
+ description: a,
1033
+ nextLabel: n = "Next",
1034
+ onNext: i,
1035
+ showNext: r = !0,
1036
+ nextDisabled: l = !1,
1037
+ nextVariant: u = "primary",
1038
+ className: o = ""
1039
+ }) {
1040
+ return /* @__PURE__ */ c("div", { className: `ca-settings-card__header ${o}`.trim(), children: [
1041
+ /* @__PURE__ */ c("div", { className: "ca-settings-card__heading", children: [
1042
+ /* @__PURE__ */ e(pt, {}),
1043
+ /* @__PURE__ */ c("div", { children: [
1044
+ /* @__PURE__ */ e(x, { children: t }),
1045
+ a ? /* @__PURE__ */ e(N, { className: "ca-settings-card__desc", children: a }) : null
1046
+ ] })
1047
+ ] }),
1048
+ r ? /* @__PURE__ */ e(
1049
+ k,
1050
+ {
1051
+ variant: u,
1052
+ disabled: l,
1053
+ onClick: i,
1054
+ endIcon: /* @__PURE__ */ e(Y, { size: 14, color: "currentColor" }),
1055
+ children: n
1056
+ }
1057
+ ) : null
1058
+ ] });
1059
+ }
1060
+ function I({
1061
+ title: t,
1062
+ description: a,
1063
+ onNext: n,
1064
+ nextLabel: i,
1065
+ showNext: r = !0,
1066
+ nextDisabled: l,
1067
+ nextVariant: u,
1068
+ children: o,
1069
+ footer: p,
1070
+ className: m = ""
1071
+ }) {
1072
+ return /* @__PURE__ */ c("section", { className: `ca-settings-card ${m}`.trim(), children: [
1073
+ /* @__PURE__ */ e(
1074
+ ht,
1075
+ {
1076
+ title: t,
1077
+ description: a,
1078
+ onNext: n,
1079
+ nextLabel: i,
1080
+ showNext: r,
1081
+ nextDisabled: l,
1082
+ nextVariant: u
1083
+ }
1084
+ ),
1085
+ /* @__PURE__ */ e("div", { className: "ca-settings-card__divider" }),
1086
+ /* @__PURE__ */ e("div", { className: "ca-settings-card__body", children: o }),
1087
+ p ? /* @__PURE__ */ e("div", { className: "ca-settings-card__footer", children: p }) : null
1088
+ ] });
1089
+ }
1090
+ function W({ children: t, hint: a, htmlFor: n, className: i = "" }) {
1091
+ return /* @__PURE__ */ c("div", { className: `ca-field-label ${i}`.trim(), children: [
1092
+ /* @__PURE__ */ e("label", { className: "ca-label", htmlFor: n, children: t }),
1093
+ a != null ? /* @__PURE__ */ e("span", { className: "ca-field-label__hint", children: a }) : null
1094
+ ] });
1095
+ }
1096
+ function mt({ size: t = 16, color: a = "currentColor", ...n }) {
1097
+ return /* @__PURE__ */ e("svg", { width: t, height: t, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", ...n, children: /* @__PURE__ */ e(
1098
+ "path",
1099
+ {
1100
+ d: "M6 9l6 6 6-6",
1101
+ stroke: a,
1102
+ strokeWidth: "2",
1103
+ strokeLinecap: "round",
1104
+ strokeLinejoin: "round"
1105
+ }
1106
+ ) });
1107
+ }
1108
+ function A({
1109
+ value: t,
1110
+ onChange: a,
1111
+ options: n = [],
1112
+ placeholder: i = "Select",
1113
+ className: r = "",
1114
+ disabled: l = !1,
1115
+ ...u
1116
+ }) {
1117
+ return /* @__PURE__ */ c("div", { className: `ca-select ${r}`.trim(), children: [
1118
+ /* @__PURE__ */ c(
1119
+ "select",
1120
+ {
1121
+ className: "ca-select__control",
1122
+ value: t ?? "",
1123
+ onChange: a,
1124
+ disabled: l,
1125
+ ...u,
1126
+ children: [
1127
+ /* @__PURE__ */ e("option", { value: "", disabled: !0, children: i }),
1128
+ n.map((o) => {
1129
+ const p = typeof o == "string" ? o : o.value, m = typeof o == "string" ? o : o.label;
1130
+ return /* @__PURE__ */ e("option", { value: p, children: m }, p);
1131
+ })
1132
+ ]
1133
+ }
1134
+ ),
1135
+ /* @__PURE__ */ e("span", { className: "ca-select__chevron", children: /* @__PURE__ */ e(mt, { size: 16 }) })
1136
+ ] });
1137
+ }
1138
+ function ft({
1139
+ value: t,
1140
+ onChange: a,
1141
+ placeholder: n,
1142
+ maxLength: i,
1143
+ rows: r = 4,
1144
+ className: l = "",
1145
+ ...u
1146
+ }) {
1147
+ return /* @__PURE__ */ e(
1148
+ "textarea",
1149
+ {
1150
+ className: `ca-textarea ${l}`.trim(),
1151
+ value: t,
1152
+ onChange: a,
1153
+ placeholder: n,
1154
+ maxLength: i,
1155
+ rows: r,
1156
+ ...u
1157
+ }
1158
+ );
1159
+ }
1160
+ function ee({
1161
+ label: t,
1162
+ hint: a,
1163
+ children: n,
1164
+ className: i = "",
1165
+ htmlFor: r
1166
+ }) {
1167
+ return /* @__PURE__ */ c("div", { className: `ca-form-field ${i}`.trim(), children: [
1168
+ t != null ? /* @__PURE__ */ e(W, { htmlFor: r, hint: a, children: t }) : null,
1169
+ n
1170
+ ] });
1171
+ }
1172
+ function re({ label: t, hint: a, ...n }) {
1173
+ return /* @__PURE__ */ e(ee, { label: t, hint: a, htmlFor: n.id, children: /* @__PURE__ */ e(C, { ...n }) });
1174
+ }
1175
+ function gt({ label: t, hint: a, ...n }) {
1176
+ return /* @__PURE__ */ e(ee, { label: t, hint: a, htmlFor: n.id, children: /* @__PURE__ */ e(A, { ...n }) });
1177
+ }
1178
+ function _e({ label: t, hint: a, maxLength: n, value: i = "", ...r }) {
1179
+ const l = a ?? (n != null ? `${String(i).length}/${n}` : void 0);
1180
+ return /* @__PURE__ */ e(ee, { label: t, hint: l, htmlFor: r.id, children: /* @__PURE__ */ e(ft, { value: i, maxLength: n, ...r }) });
1181
+ }
1182
+ function we({
1183
+ checked: t = !1,
1184
+ onChange: a,
1185
+ disabled: n = !1,
1186
+ "aria-label": i = "Toggle",
1187
+ className: r = ""
1188
+ }) {
1189
+ return /* @__PURE__ */ e(
1190
+ "button",
1191
+ {
1192
+ type: "button",
1193
+ role: "switch",
1194
+ "aria-checked": t,
1195
+ "aria-label": i,
1196
+ disabled: n,
1197
+ className: `ca-toggle ${t ? "ca-toggle--on" : ""} ${r}`.trim(),
1198
+ onClick: () => a?.(!t),
1199
+ children: /* @__PURE__ */ e("span", { className: "ca-toggle__thumb" })
1200
+ }
1201
+ );
1202
+ }
1203
+ function vt({
1204
+ label: t = "Active",
1205
+ checked: a,
1206
+ onChange: n,
1207
+ className: i = ""
1208
+ }) {
1209
+ return /* @__PURE__ */ c("div", { className: `ca-toggle-field ${i}`.trim(), children: [
1210
+ /* @__PURE__ */ e(X, { children: t }),
1211
+ /* @__PURE__ */ e(we, { checked: a, onChange: n, "aria-label": t })
1212
+ ] });
1213
+ }
1214
+ function bt({ size: t = 12, color: a = "currentColor", ...n }) {
1215
+ return /* @__PURE__ */ e("svg", { width: t, height: t, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", ...n, children: /* @__PURE__ */ e(
1216
+ "path",
1217
+ {
1218
+ d: "M6 6l12 12M18 6L6 18",
1219
+ stroke: a,
1220
+ strokeWidth: "2",
1221
+ strokeLinecap: "round"
1222
+ }
1223
+ ) });
1224
+ }
1225
+ function yt({ label: t, onRemove: a, className: n = "" }) {
1226
+ return /* @__PURE__ */ c("span", { className: `ca-tag ${n}`.trim(), children: [
1227
+ t,
1228
+ a ? /* @__PURE__ */ e(
1229
+ "button",
1230
+ {
1231
+ type: "button",
1232
+ className: "ca-tag__remove",
1233
+ onClick: a,
1234
+ "aria-label": `Remove ${t}`,
1235
+ children: /* @__PURE__ */ e(bt, { size: 10 })
1236
+ }
1237
+ ) : null
1238
+ ] });
1239
+ }
1240
+ function _t({
1241
+ label: t = "Select Roles",
1242
+ options: a = [],
1243
+ value: n = [],
1244
+ onChange: i,
1245
+ placeholder: r = "Select roles",
1246
+ className: l = ""
1247
+ }) {
1248
+ const [u, o] = E(""), p = a.filter((s) => {
1249
+ const h = typeof s == "string" ? s : s.value;
1250
+ return !n.includes(h);
1251
+ }), m = (s) => {
1252
+ const h = s.target.value;
1253
+ h && (i?.([...n, h]), o(""));
1254
+ }, d = (s) => {
1255
+ i?.(n.filter((h) => h !== s));
1256
+ };
1257
+ return /* @__PURE__ */ c("div", { className: `ca-role-select ${l}`.trim(), children: [
1258
+ /* @__PURE__ */ e(W, { children: t }),
1259
+ /* @__PURE__ */ e(
1260
+ A,
1261
+ {
1262
+ value: u,
1263
+ onChange: m,
1264
+ options: p,
1265
+ placeholder: r
1266
+ }
1267
+ ),
1268
+ n.length > 0 ? /* @__PURE__ */ e("div", { className: "ca-tag-list", children: n.map((s) => /* @__PURE__ */ e(yt, { label: s, onRemove: () => d(s) }, s)) }) : null
1269
+ ] });
1270
+ }
1271
+ function wt({ onNext: t, stepMeta: a }) {
1272
+ const { state: n, update: i } = P();
1273
+ return /* @__PURE__ */ c(
1274
+ I,
1275
+ {
1276
+ title: a.title,
1277
+ description: a.description,
1278
+ onNext: t,
1279
+ children: [
1280
+ /* @__PURE__ */ e("div", { className: "ca-step-section", children: /* @__PURE__ */ c("div", { className: "ca-step-row ca-step-row--category", children: [
1281
+ /* @__PURE__ */ e(
1282
+ gt,
1283
+ {
1284
+ label: "Category Type",
1285
+ className: "ca-step-row__grow",
1286
+ value: n.categoryType,
1287
+ onChange: (r) => i({ categoryType: r.target.value }),
1288
+ options: ye,
1289
+ placeholder: "Select category type"
1290
+ }
1291
+ ),
1292
+ /* @__PURE__ */ e(
1293
+ vt,
1294
+ {
1295
+ checked: n.active,
1296
+ onChange: (r) => i({ active: r })
1297
+ }
1298
+ )
1299
+ ] }) }),
1300
+ /* @__PURE__ */ e("div", { className: "ca-step-section", children: /* @__PURE__ */ e(
1301
+ _e,
1302
+ {
1303
+ label: "Description",
1304
+ placeholder: "Enter description",
1305
+ maxLength: 500,
1306
+ value: n.description,
1307
+ onChange: (r) => i({ description: r.target.value }),
1308
+ rows: 5
1309
+ }
1310
+ ) }),
1311
+ /* @__PURE__ */ e("div", { className: "ca-step-section ca-step-section--last", children: /* @__PURE__ */ e(
1312
+ _t,
1313
+ {
1314
+ options: be,
1315
+ value: n.roles,
1316
+ onChange: (r) => i({ roles: r })
1317
+ }
1318
+ ) })
1319
+ ]
1320
+ }
1321
+ );
1322
+ }
1323
+ const Nt = ["HR", "Finance", "IT", "Operations", "Sales"];
1324
+ function kt() {
1325
+ return {
1326
+ id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
1327
+ department: "",
1328
+ subDepartment: "",
1329
+ roles: ""
1330
+ };
1331
+ }
1332
+ function Ft({ onNext: t, stepMeta: a }) {
1333
+ const { state: n, update: i } = P(), r = n.departmentRows, l = (o, p) => {
1334
+ i({
1335
+ departmentRows: r.map((m) => m.id === o ? { ...m, ...p } : m)
1336
+ });
1337
+ }, u = () => {
1338
+ i({ departmentRows: [...r, kt()] });
1339
+ };
1340
+ return /* @__PURE__ */ e(I, { title: a.title, description: a.description, onNext: t, children: /* @__PURE__ */ c("div", { className: "ca-dept-table", children: [
1341
+ /* @__PURE__ */ c("div", { className: "ca-dept-table__head", children: [
1342
+ /* @__PURE__ */ e("div", { children: "Department" }),
1343
+ /* @__PURE__ */ e("div", { children: "Sub-department" }),
1344
+ /* @__PURE__ */ e("div", { children: "Roles" }),
1345
+ /* @__PURE__ */ e("div", {})
1346
+ ] }),
1347
+ r.map((o) => /* @__PURE__ */ c("div", { className: "ca-dept-table__row", children: [
1348
+ /* @__PURE__ */ e(
1349
+ A,
1350
+ {
1351
+ value: o.department,
1352
+ onChange: (p) => l(o.id, { department: p.target.value }),
1353
+ options: Nt,
1354
+ placeholder: "Select or add department"
1355
+ }
1356
+ ),
1357
+ /* @__PURE__ */ c("div", { className: "ca-input-with-action", children: [
1358
+ /* @__PURE__ */ e(
1359
+ C,
1360
+ {
1361
+ value: o.subDepartment,
1362
+ onChange: (p) => l(o.id, { subDepartment: p.target.value }),
1363
+ placeholder: "Add sub-department"
1364
+ }
1365
+ ),
1366
+ /* @__PURE__ */ e(
1367
+ "button",
1368
+ {
1369
+ type: "button",
1370
+ className: "ca-input-with-action__btn",
1371
+ "aria-label": "Add sub-department",
1372
+ onClick: () => {
1373
+ o.subDepartment.trim();
1374
+ },
1375
+ children: /* @__PURE__ */ e(pe, { size: 14, color: "currentColor" })
1376
+ }
1377
+ )
1378
+ ] }),
1379
+ /* @__PURE__ */ e(
1380
+ A,
1381
+ {
1382
+ value: o.roles,
1383
+ onChange: (p) => l(o.id, { roles: p.target.value }),
1384
+ options: be,
1385
+ placeholder: "Select roles"
1386
+ }
1387
+ ),
1388
+ /* @__PURE__ */ e(k, { variant: "link", size: "sm", onClick: u, children: "+ Add" })
1389
+ ] }, o.id))
1390
+ ] }) });
1391
+ }
1392
+ function St({ children: t, onClick: a, className: n = "", active: i = !1 }) {
1393
+ return /* @__PURE__ */ e(
1394
+ "button",
1395
+ {
1396
+ type: "button",
1397
+ className: `ca-chip ${i ? "ca-chip--active" : ""} ${n}`.trim(),
1398
+ onClick: a,
1399
+ children: t
1400
+ }
1401
+ );
1402
+ }
1403
+ function xt({
1404
+ checked: t = !1,
1405
+ onChange: a,
1406
+ name: n,
1407
+ value: i,
1408
+ "aria-label": r,
1409
+ className: l = ""
1410
+ }) {
1411
+ return /* @__PURE__ */ c("label", { className: `ca-radio ${l}`.trim(), children: [
1412
+ /* @__PURE__ */ e(
1413
+ "input",
1414
+ {
1415
+ type: "radio",
1416
+ className: "ca-radio__input",
1417
+ name: n,
1418
+ value: i,
1419
+ checked: t,
1420
+ onChange: a,
1421
+ "aria-label": r
1422
+ }
1423
+ ),
1424
+ /* @__PURE__ */ e("span", { className: "ca-radio__mark" })
1425
+ ] });
1426
+ }
1427
+ function Ne({ size: t = 16, color: a = "#9CA3AF", ...n }) {
1428
+ return /* @__PURE__ */ c("svg", { width: t, height: t, viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", ...n, children: [
1429
+ /* @__PURE__ */ e("circle", { cx: "5", cy: "4", r: "1.2", fill: a }),
1430
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "4", r: "1.2", fill: a }),
1431
+ /* @__PURE__ */ e("circle", { cx: "5", cy: "8", r: "1.2", fill: a }),
1432
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "8", r: "1.2", fill: a }),
1433
+ /* @__PURE__ */ e("circle", { cx: "5", cy: "12", r: "1.2", fill: a }),
1434
+ /* @__PURE__ */ e("circle", { cx: "11", cy: "12", r: "1.2", fill: a })
1435
+ ] });
1436
+ }
1437
+ function le(t) {
1438
+ return {
1439
+ id: `${Date.now()}-${Math.random().toString(36).slice(2, 7)}`,
1440
+ name: t,
1441
+ color: ""
1442
+ };
1443
+ }
1444
+ function Ct({ onNext: t, stepMeta: a }) {
1445
+ const { state: n, update: i } = P(), { priorityDraft: r, priorities: l, defaultPriorityId: u } = n, o = (d) => {
1446
+ const s = (d ?? r).trim();
1447
+ if (!s) return;
1448
+ if (l.some((g) => g.name.toLowerCase() === s.toLowerCase())) {
1449
+ i({ priorityDraft: "" });
1450
+ return;
1451
+ }
1452
+ const h = [...l, le(s)];
1453
+ i({
1454
+ priorities: h,
1455
+ priorityDraft: "",
1456
+ defaultPriorityId: u ?? h[0].id
1457
+ });
1458
+ }, p = (d, s) => {
1459
+ i({
1460
+ priorities: l.map((h) => h.id === d ? { ...h, ...s } : h)
1461
+ });
1462
+ }, m = ut.map((d) => ({
1463
+ value: d.value,
1464
+ label: d.label
1465
+ }));
1466
+ return /* @__PURE__ */ c(I, { title: a.title, description: a.description, onNext: t, children: [
1467
+ /* @__PURE__ */ c("div", { className: "ca-priority-add", children: [
1468
+ /* @__PURE__ */ e(W, { children: "Priorities" }),
1469
+ /* @__PURE__ */ c("div", { className: "ca-priority-add__row", children: [
1470
+ /* @__PURE__ */ e(
1471
+ C,
1472
+ {
1473
+ value: r,
1474
+ onChange: (d) => i({ priorityDraft: d.target.value }),
1475
+ placeholder: "Add priority",
1476
+ onKeyDown: (d) => {
1477
+ d.key === "Enter" && (d.preventDefault(), o());
1478
+ }
1479
+ }
1480
+ ),
1481
+ /* @__PURE__ */ e(k, { variant: "outline", onClick: () => o(), children: "+ Add" })
1482
+ ] }),
1483
+ /* @__PURE__ */ e("div", { className: "ca-chip-row", children: ot.map((d) => /* @__PURE__ */ c(St, { onClick: () => o(d), children: [
1484
+ "+ ",
1485
+ d
1486
+ ] }, d)) })
1487
+ ] }),
1488
+ /* @__PURE__ */ c("div", { className: "ca-priority-table", children: [
1489
+ /* @__PURE__ */ c("div", { className: "ca-priority-table__head", children: [
1490
+ /* @__PURE__ */ e("div", { children: "Priority" }),
1491
+ /* @__PURE__ */ e("div", { children: "Color" }),
1492
+ /* @__PURE__ */ e("div", { children: "Default" })
1493
+ ] }),
1494
+ (l.length ? l : [le("")]).map((d, s) => {
1495
+ const h = !l.length;
1496
+ return /* @__PURE__ */ c("div", { className: "ca-priority-table__row", children: [
1497
+ /* @__PURE__ */ c("div", { className: "ca-priority-table__name", children: [
1498
+ /* @__PURE__ */ e(Ne, {}),
1499
+ /* @__PURE__ */ e(
1500
+ C,
1501
+ {
1502
+ value: h ? r : d.name,
1503
+ onChange: (g) => {
1504
+ h ? i({ priorityDraft: g.target.value }) : p(d.id, { name: g.target.value });
1505
+ },
1506
+ placeholder: "Add priority"
1507
+ }
1508
+ )
1509
+ ] }),
1510
+ /* @__PURE__ */ e(
1511
+ A,
1512
+ {
1513
+ value: d.color,
1514
+ onChange: (g) => {
1515
+ h || p(d.id, { color: g.target.value });
1516
+ },
1517
+ options: m,
1518
+ placeholder: "Select color"
1519
+ }
1520
+ ),
1521
+ /* @__PURE__ */ e(
1522
+ xt,
1523
+ {
1524
+ name: "default-priority",
1525
+ value: d.id,
1526
+ checked: !h && u === d.id,
1527
+ onChange: () => !h && i({ defaultPriorityId: d.id }),
1528
+ "aria-label": "Default priority"
1529
+ }
1530
+ )
1531
+ ] }, d.id || s);
1532
+ })
1533
+ ] })
1534
+ ] });
1535
+ }
1536
+ function At({
1537
+ onNext: t,
1538
+ stepMeta: a,
1539
+ substep: n = 1,
1540
+ onSubstepChange: i
1541
+ }) {
1542
+ const { state: r, update: l, updateWorkflow: u } = P(), { selectedDeptNode: o, workflow: p } = r, m = () => {
1543
+ if (n < ie.length) {
1544
+ i?.(n + 1);
1545
+ return;
1546
+ }
1547
+ t?.();
1548
+ };
1549
+ return /* @__PURE__ */ e(
1550
+ I,
1551
+ {
1552
+ title: a.title,
1553
+ description: a.description,
1554
+ onNext: t,
1555
+ nextVariant: "secondary",
1556
+ children: /* @__PURE__ */ c("div", { className: "ca-workflow", children: [
1557
+ /* @__PURE__ */ c("aside", { className: "ca-workflow__sidebar", children: [
1558
+ /* @__PURE__ */ e("h3", { className: "ca-workflow__sidebar-title", children: "Select Department" }),
1559
+ /* @__PURE__ */ e("p", { className: "ca-small", children: "Add workflow for selected department" }),
1560
+ /* @__PURE__ */ e("ul", { className: "ca-dept-tree", children: dt.map((d) => /* @__PURE__ */ c("li", { className: "ca-dept-tree__group", children: [
1561
+ /* @__PURE__ */ e(
1562
+ "button",
1563
+ {
1564
+ type: "button",
1565
+ className: `ca-dept-tree__item ${o === d.id ? "ca-dept-tree__item--active" : ""}`,
1566
+ onClick: () => l({ selectedDeptNode: d.id }),
1567
+ children: d.name
1568
+ }
1569
+ ),
1570
+ d.children?.length ? /* @__PURE__ */ e("ul", { className: "ca-dept-tree__children", children: d.children.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
1571
+ "button",
1572
+ {
1573
+ type: "button",
1574
+ className: `ca-dept-tree__item ca-dept-tree__item--child ${o === s.id ? "ca-dept-tree__item--active" : ""}`,
1575
+ onClick: () => l({ selectedDeptNode: s.id }),
1576
+ children: [
1577
+ /* @__PURE__ */ e("span", { className: "ca-dept-tree__branch", "aria-hidden": "true", children: "└" }),
1578
+ s.name
1579
+ ]
1580
+ }
1581
+ ) }, s.id)) }) : null
1582
+ ] }, d.id)) })
1583
+ ] }),
1584
+ /* @__PURE__ */ c("div", { className: "ca-workflow__main", children: [
1585
+ /* @__PURE__ */ e(
1586
+ fe,
1587
+ {
1588
+ steps: ie,
1589
+ currentStep: n,
1590
+ onStepClick: i,
1591
+ size: "sm",
1592
+ className: "ca-workflow__substepper"
1593
+ }
1594
+ ),
1595
+ n === 1 ? /* @__PURE__ */ c("div", { className: "ca-workflow__form", children: [
1596
+ /* @__PURE__ */ c("div", { className: "ca-step-row", children: [
1597
+ /* @__PURE__ */ e(
1598
+ re,
1599
+ {
1600
+ className: "ca-step-row__grow",
1601
+ label: "Name",
1602
+ placeholder: "Enter name",
1603
+ value: p.name,
1604
+ onChange: (d) => u({ name: d.target.value })
1605
+ }
1606
+ ),
1607
+ /* @__PURE__ */ e(
1608
+ re,
1609
+ {
1610
+ className: "ca-step-row__grow",
1611
+ label: "TAT Minutes",
1612
+ placeholder: "Enter here",
1613
+ value: p.tatMinutes,
1614
+ onChange: (d) => u({ tatMinutes: d.target.value })
1615
+ }
1616
+ )
1617
+ ] }),
1618
+ /* @__PURE__ */ e(
1619
+ _e,
1620
+ {
1621
+ label: "Description",
1622
+ placeholder: "Enter description",
1623
+ value: p.description,
1624
+ onChange: (d) => u({ description: d.target.value }),
1625
+ rows: 5
1626
+ }
1627
+ )
1628
+ ] }) : null,
1629
+ n === 2 ? /* @__PURE__ */ e("div", { className: "ca-workflow__placeholder", children: /* @__PURE__ */ e("p", { className: "ca-body", children: "Configure workflow statuses for the selected department." }) }) : null,
1630
+ n === 3 ? /* @__PURE__ */ e("div", { className: "ca-workflow__placeholder", children: /* @__PURE__ */ e("p", { className: "ca-body", children: "Define ordered workflow steps and assignees." }) }) : null,
1631
+ /* @__PURE__ */ e("div", { className: "ca-workflow__actions", children: /* @__PURE__ */ e(
1632
+ k,
1633
+ {
1634
+ onClick: m,
1635
+ endIcon: /* @__PURE__ */ e(Y, { size: 14, color: "#fff" }),
1636
+ children: "Next Step"
1637
+ }
1638
+ ) })
1639
+ ] })
1640
+ ] })
1641
+ }
1642
+ );
1643
+ }
1644
+ function Dt({ size: t = 16, color: a = "#9CA3AF", ...n }) {
1645
+ return /* @__PURE__ */ e("svg", { width: t, height: t, viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", ...n, children: /* @__PURE__ */ e(
1646
+ "path",
1647
+ {
1648
+ d: "M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m2 0v12a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V7h12Z",
1649
+ stroke: a,
1650
+ strokeWidth: "1.6",
1651
+ strokeLinecap: "round",
1652
+ strokeLinejoin: "round"
1653
+ }
1654
+ ) });
1655
+ }
1656
+ const j = ve.map((t) => ({
1657
+ value: t.id,
1658
+ label: t.label
1659
+ }));
1660
+ function Tt({ type: t }) {
1661
+ return /* @__PURE__ */ e("span", { className: "ca-field-lib__glyph", children: {
1662
+ text: "A",
1663
+ doc: "¶",
1664
+ calendar: "口",
1665
+ clock: "◷",
1666
+ chevron: "▾"
1667
+ }[t] || "▾" });
1668
+ }
1669
+ function Bt({ onNext: t, stepMeta: a }) {
1670
+ const { state: n, update: i } = P(), { fieldDraft: r, formFields: l } = n, u = (s) => i({ fieldDraft: { ...r, ...s } }), o = () => {
1671
+ if (!r.name.trim() || !r.type) return;
1672
+ const s = j.find((h) => h.value === r.type)?.label || r.type;
1673
+ i({
1674
+ formFields: [
1675
+ ...l,
1676
+ {
1677
+ id: `${Date.now()}`,
1678
+ name: r.name.trim(),
1679
+ type: r.type,
1680
+ typeLabel: s,
1681
+ required: !1
1682
+ }
1683
+ ],
1684
+ fieldDraft: { name: "", type: "" }
1685
+ });
1686
+ }, p = (s, h) => {
1687
+ i({
1688
+ formFields: l.map((g) => g.id === s ? { ...g, ...h } : g)
1689
+ });
1690
+ }, m = (s) => {
1691
+ i({ formFields: l.filter((h) => h.id !== s) });
1692
+ }, d = (s) => {
1693
+ u({ type: s.id });
1694
+ };
1695
+ return /* @__PURE__ */ e(
1696
+ I,
1697
+ {
1698
+ title: a.title,
1699
+ description: a.description,
1700
+ showNext: !1,
1701
+ footer: /* @__PURE__ */ e(
1702
+ k,
1703
+ {
1704
+ onClick: t,
1705
+ endIcon: /* @__PURE__ */ e(Y, { size: 14, color: "#fff" }),
1706
+ children: "Next"
1707
+ }
1708
+ ),
1709
+ children: /* @__PURE__ */ c("div", { className: "ca-form-fields", children: [
1710
+ /* @__PURE__ */ c("aside", { className: "ca-field-lib", children: [
1711
+ /* @__PURE__ */ e("h3", { className: "ca-field-lib__title", children: "Field Library" }),
1712
+ /* @__PURE__ */ e("p", { className: "ca-small", children: "Drag and drop the fields to add." }),
1713
+ /* @__PURE__ */ e("ul", { className: "ca-field-lib__list", children: ve.map((s) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ c(
1714
+ "button",
1715
+ {
1716
+ type: "button",
1717
+ className: "ca-field-lib__item",
1718
+ draggable: !0,
1719
+ onDragStart: (h) => {
1720
+ h.dataTransfer.setData("text/plain", s.id);
1721
+ },
1722
+ onClick: () => d(s),
1723
+ children: [
1724
+ /* @__PURE__ */ e(Tt, { type: s.icon }),
1725
+ /* @__PURE__ */ e("span", { children: s.label })
1726
+ ]
1727
+ }
1728
+ ) }, s.id)) })
1729
+ ] }),
1730
+ /* @__PURE__ */ c("div", { className: "ca-form-fields__main", children: [
1731
+ /* @__PURE__ */ c(
1732
+ "div",
1733
+ {
1734
+ className: "ca-add-fields",
1735
+ onDragOver: (s) => s.preventDefault(),
1736
+ onDrop: (s) => {
1737
+ s.preventDefault();
1738
+ const h = s.dataTransfer.getData("text/plain");
1739
+ h && u({ type: h });
1740
+ },
1741
+ children: [
1742
+ /* @__PURE__ */ c("div", { className: "ca-add-fields__top", children: [
1743
+ /* @__PURE__ */ e("h3", { className: "ca-add-fields__title", children: "Add Fields" }),
1744
+ /* @__PURE__ */ e(k, { onClick: o, children: "Add Field" })
1745
+ ] }),
1746
+ /* @__PURE__ */ c("div", { className: "ca-step-row", children: [
1747
+ /* @__PURE__ */ c("div", { className: "ca-step-row__grow", children: [
1748
+ /* @__PURE__ */ e(W, { children: "Name of Field" }),
1749
+ /* @__PURE__ */ e(
1750
+ C,
1751
+ {
1752
+ value: r.name,
1753
+ onChange: (s) => u({ name: s.target.value }),
1754
+ placeholder: "Enter name of the field."
1755
+ }
1756
+ )
1757
+ ] }),
1758
+ /* @__PURE__ */ c("div", { className: "ca-step-row__grow", children: [
1759
+ /* @__PURE__ */ e(W, { children: "Type of Field" }),
1760
+ /* @__PURE__ */ e(
1761
+ A,
1762
+ {
1763
+ value: r.type,
1764
+ onChange: (s) => u({ type: s.target.value }),
1765
+ options: j,
1766
+ placeholder: "Select type of the field."
1767
+ }
1768
+ )
1769
+ ] })
1770
+ ] })
1771
+ ]
1772
+ }
1773
+ ),
1774
+ /* @__PURE__ */ c("div", { className: "ca-fields-table", children: [
1775
+ /* @__PURE__ */ c("div", { className: "ca-fields-table__head", children: [
1776
+ /* @__PURE__ */ e("div", { children: "Field Name" }),
1777
+ /* @__PURE__ */ e("div", { children: "Field Type" }),
1778
+ /* @__PURE__ */ e("div", { children: "Required" }),
1779
+ /* @__PURE__ */ e("div", {})
1780
+ ] }),
1781
+ l.length === 0 ? /* @__PURE__ */ e("div", { className: "ca-fields-table__empty", children: /* @__PURE__ */ e("p", { className: "ca-small", children: "No fields added yet." }) }) : l.map((s) => /* @__PURE__ */ c("div", { className: "ca-fields-table__row", children: [
1782
+ /* @__PURE__ */ c("div", { className: "ca-fields-table__name", children: [
1783
+ /* @__PURE__ */ e(Ne, {}),
1784
+ /* @__PURE__ */ e(
1785
+ C,
1786
+ {
1787
+ value: s.name,
1788
+ onChange: (h) => p(s.id, { name: h.target.value })
1789
+ }
1790
+ )
1791
+ ] }),
1792
+ /* @__PURE__ */ e(
1793
+ A,
1794
+ {
1795
+ value: s.type,
1796
+ onChange: (h) => {
1797
+ const g = h.target.value, f = j.find((v) => v.value === g)?.label || g;
1798
+ p(s.id, { type: g, typeLabel: f });
1799
+ },
1800
+ options: j,
1801
+ placeholder: "Select type"
1802
+ }
1803
+ ),
1804
+ /* @__PURE__ */ e(
1805
+ we,
1806
+ {
1807
+ checked: s.required,
1808
+ onChange: (h) => p(s.id, { required: h }),
1809
+ "aria-label": "Required"
1810
+ }
1811
+ ),
1812
+ /* @__PURE__ */ e(
1813
+ "button",
1814
+ {
1815
+ type: "button",
1816
+ className: "ca-icon-btn",
1817
+ "aria-label": "Delete field",
1818
+ onClick: () => m(s.id),
1819
+ children: /* @__PURE__ */ e(Dt, {})
1820
+ }
1821
+ )
1822
+ ] }, s.id))
1823
+ ] })
1824
+ ] })
1825
+ ] })
1826
+ }
1827
+ );
1828
+ }
1829
+ function Rt({ onPublish: t, stepMeta: a }) {
1830
+ const { state: n } = P(), i = ye.find((r) => r.value === n.categoryType)?.label || n.categoryType;
1831
+ return /* @__PURE__ */ e(
1832
+ I,
1833
+ {
1834
+ title: a.title,
1835
+ description: a.description,
1836
+ nextLabel: "Publish",
1837
+ onNext: t,
1838
+ children: /* @__PURE__ */ c("div", { className: "ca-review", children: [
1839
+ /* @__PURE__ */ c("section", { className: "ca-review__block", children: [
1840
+ /* @__PURE__ */ e(x, { children: "Category Type" }),
1841
+ /* @__PURE__ */ c("div", { className: "ca-review__row", children: [
1842
+ /* @__PURE__ */ e(X, { children: i }),
1843
+ /* @__PURE__ */ e(me, { status: n.active ? "active" : "inactive" })
1844
+ ] }),
1845
+ n.description ? /* @__PURE__ */ e(N, { children: n.description }) : null,
1846
+ n.roles.length ? /* @__PURE__ */ c(N, { children: [
1847
+ "Roles: ",
1848
+ n.roles.join(", ")
1849
+ ] }) : null
1850
+ ] }),
1851
+ /* @__PURE__ */ c("section", { className: "ca-review__block", children: [
1852
+ /* @__PURE__ */ e(x, { children: "Departments" }),
1853
+ /* @__PURE__ */ c(N, { children: [
1854
+ n.departmentRows.filter((r) => r.department).length,
1855
+ " department row(s) configured"
1856
+ ] })
1857
+ ] }),
1858
+ /* @__PURE__ */ c("section", { className: "ca-review__block", children: [
1859
+ /* @__PURE__ */ e(x, { children: "Priorities" }),
1860
+ /* @__PURE__ */ e(N, { children: n.priorities.length ? n.priorities.map((r) => r.name).join(", ") : "No priorities added" })
1861
+ ] }),
1862
+ /* @__PURE__ */ c("section", { className: "ca-review__block", children: [
1863
+ /* @__PURE__ */ e(x, { children: "Workflow" }),
1864
+ /* @__PURE__ */ e(N, { children: n.workflow.name ? `${n.workflow.name} (TAT: ${n.workflow.tatMinutes || "—"} min)` : "No workflow created yet" })
1865
+ ] }),
1866
+ /* @__PURE__ */ c("section", { className: "ca-review__block ca-review__block--last", children: [
1867
+ /* @__PURE__ */ e(x, { children: "Form Fields" }),
1868
+ /* @__PURE__ */ e(N, { children: n.formFields.length ? n.formFields.map((r) => r.name).join(", ") : "No form fields added" })
1869
+ ] }),
1870
+ /* @__PURE__ */ e("div", { className: "ca-workflow__actions", children: /* @__PURE__ */ e(k, { onClick: t, children: "Publish" }) })
1871
+ ] })
1872
+ }
1873
+ );
1874
+ }
1875
+ function Et(t) {
1876
+ const a = Number(t);
1877
+ return !Number.isFinite(a) || a < 1 ? 1 : a > M.length ? M.length : Math.floor(a);
1878
+ }
1879
+ function Mt(t) {
1880
+ const a = Number(t);
1881
+ return !Number.isFinite(a) || a < 1 ? 1 : a > 3 ? 3 : Math.floor(a);
1882
+ }
1883
+ function Lt({
1884
+ title: t = "Complaint Management Settings",
1885
+ onPublish: a,
1886
+ onStepChange: n
1887
+ }) {
1888
+ const i = oe(), { systemId: r } = xe(), [l, u] = Ce(), o = Et(l.get("step") || 1), p = Mt(l.get("substep") || 1);
1889
+ U(() => {
1890
+ if (!l.get("step")) {
1891
+ const f = new URLSearchParams(l);
1892
+ f.set("step", "1"), u(f, { replace: !0 });
1893
+ }
1894
+ }, [l, u]);
1895
+ const m = H(
1896
+ () => M.find((f) => f.id === o) || M[0],
1897
+ [o]
1898
+ ), d = Z(
1899
+ (f, v) => {
1900
+ const b = new URLSearchParams(l);
1901
+ b.set("step", String(f)), f === 4 ? b.set("substep", String(v ?? (f === o ? p : 1))) : b.delete("substep"), u(b, { replace: !1 }), n?.({ systemId: r, step: f, substep: v });
1902
+ },
1903
+ [l, u, n, r, o, p]
1904
+ ), s = () => {
1905
+ o < M.length && d(o + 1, 1);
1906
+ };
1907
+ return /* @__PURE__ */ e(st, { children: /* @__PURE__ */ c("div", { className: "ca-settings-page", children: [
1908
+ /* @__PURE__ */ e(he, { children: t }),
1909
+ /* @__PURE__ */ e(
1910
+ fe,
1911
+ {
1912
+ steps: M,
1913
+ currentStep: o,
1914
+ onStepClick: (f) => d(f, f === 4 ? 1 : void 0),
1915
+ className: "ca-settings-page__stepper"
1916
+ }
1917
+ ),
1918
+ o === 1 ? /* @__PURE__ */ e(wt, { onNext: s, stepMeta: m }) : null,
1919
+ o === 2 ? /* @__PURE__ */ e(Ft, { onNext: s, stepMeta: m }) : null,
1920
+ o === 3 ? /* @__PURE__ */ e(Ct, { onNext: s, stepMeta: m }) : null,
1921
+ o === 4 ? /* @__PURE__ */ e(
1922
+ At,
1923
+ {
1924
+ onNext: s,
1925
+ stepMeta: m,
1926
+ substep: p,
1927
+ onSubstepChange: (f) => {
1928
+ d(4, f);
1929
+ }
1930
+ }
1931
+ ) : null,
1932
+ o === 5 ? /* @__PURE__ */ e(Bt, { onNext: s, stepMeta: m }) : null,
1933
+ o === 6 ? /* @__PURE__ */ e(Rt, { onPublish: () => {
1934
+ a?.({ systemId: r, step: o });
1935
+ }, stepMeta: m }) : null,
1936
+ /* @__PURE__ */ e(
1937
+ "button",
1938
+ {
1939
+ type: "button",
1940
+ className: "ca-back-link",
1941
+ onClick: () => i("/"),
1942
+ children: "← Back to Complaint Management"
1943
+ }
1944
+ )
1945
+ ] }) });
1946
+ }
1947
+ function $t({ children: t }) {
1948
+ const { cssVars: a, darkMode: n, mode: i } = Ue();
1949
+ return /* @__PURE__ */ e(
1950
+ "div",
1951
+ {
1952
+ className: `ca-root ${n ? "ca-root--dark" : "ca-root--light"}`,
1953
+ "data-ca-theme": i,
1954
+ style: a,
1955
+ children: t
1956
+ }
1957
+ );
1958
+ }
1959
+ const Ut = ({
1960
+ apiUrl: t,
1961
+ authToken: a,
1962
+ basePath: n = "/",
1963
+ theme: i,
1964
+ darkMode: r = !1,
1965
+ title: l,
1966
+ description: u,
1967
+ systems: o,
1968
+ systemsEndpoint: p,
1969
+ useDemoData: m = !0,
1970
+ createLabel: d,
1971
+ onCreateForm: s,
1972
+ onConfigure: h,
1973
+ onTitleClick: g,
1974
+ onDescriptionClick: f,
1975
+ onSearch: v,
1976
+ onPublish: b,
1977
+ onStepChange: T,
1978
+ children: B
1979
+ }) => {
1980
+ const w = {
1981
+ title: l,
1982
+ description: u,
1983
+ systems: o,
1984
+ systemsEndpoint: p,
1985
+ useDemoData: m,
1986
+ createLabel: d,
1987
+ onCreateForm: s,
1988
+ onConfigure: h,
1989
+ onTitleClick: g,
1990
+ onDescriptionClick: f,
1991
+ onSearch: v
1992
+ };
1993
+ return /* @__PURE__ */ e(Ve, { theme: i, darkMode: r, children: /* @__PURE__ */ e($t, { children: /* @__PURE__ */ e(Le, { apiUrl: t, authToken: a, children: /* @__PURE__ */ e(Ae, { basename: n, children: /* @__PURE__ */ c(De, { children: [
1994
+ /* @__PURE__ */ e(
1995
+ G,
1996
+ {
1997
+ path: "/",
1998
+ element: B ?? /* @__PURE__ */ e(ne, { ...w })
1999
+ }
2000
+ ),
2001
+ /* @__PURE__ */ e(
2002
+ G,
2003
+ {
2004
+ path: "/settings/:systemId",
2005
+ element: /* @__PURE__ */ e(
2006
+ Lt,
2007
+ {
2008
+ onPublish: b,
2009
+ onStepChange: T
2010
+ }
2011
+ )
2012
+ }
2013
+ ),
2014
+ /* @__PURE__ */ e(
2015
+ G,
2016
+ {
2017
+ path: "*",
2018
+ element: B ?? /* @__PURE__ */ e(ne, { ...w })
2019
+ }
2020
+ )
2021
+ ] }) }) }) }) });
2022
+ }, qt = S.colors, Yt = S.radii, Gt = S.spacing, Kt = S.typography;
2023
+ export {
2024
+ Le as ApiProvider,
2025
+ N as BodyText,
2026
+ k as Button,
2027
+ Ze as CardFooter,
2028
+ Qe as CardHeader,
2029
+ mt as ChevronDownIcon,
2030
+ Y as ChevronRightIcon,
2031
+ St as Chip,
2032
+ bt as CloseIcon,
2033
+ Ut as ComplaintApp,
2034
+ ne as ComplaintManagementPage,
2035
+ Lt as ComplaintSettingsPage,
2036
+ lt as DEFAULT_PAGE_DESCRIPTION,
2037
+ rt as DEMO_SYSTEMS,
2038
+ Je as DataPoint,
2039
+ Xe as Divider,
2040
+ Ne as DragHandleIcon,
2041
+ W as FieldLabel,
2042
+ ee as FormField,
2043
+ re as FormInput,
2044
+ gt as FormSelect,
2045
+ _e as FormTextarea,
2046
+ he as Heading1,
2047
+ x as Heading2,
2048
+ C as Input,
2049
+ X as LabelText,
2050
+ pt as LayersIcon,
2051
+ Ge as LinkText,
2052
+ it as Loading,
2053
+ Ke as PageHeader,
2054
+ pe as PlusIcon,
2055
+ xt as Radio,
2056
+ _t as RoleMultiSelect,
2057
+ M as SETTINGS_STEPS,
2058
+ nt as SearchBar,
2059
+ at as SearchIcon,
2060
+ A as Select,
2061
+ I as SettingsCard,
2062
+ ht as SettingsCardHeader,
2063
+ st as SettingsWizardProvider,
2064
+ me as StatusBadge,
2065
+ fe as Stepper,
2066
+ et as SystemCard,
2067
+ tt as SystemCardGrid,
2068
+ yt as Tag,
2069
+ ft as Textarea,
2070
+ Ve as ThemeProvider,
2071
+ we as Toggle,
2072
+ vt as ToggleField,
2073
+ Dt as TrashIcon,
2074
+ D as Typography,
2075
+ Ye as ValueText,
2076
+ ie as WORKFLOW_SUBSTEPS,
2077
+ q as api,
2078
+ qt as colors,
2079
+ V as darkTheme,
2080
+ O as deepMerge,
2081
+ Ut as default,
2082
+ $e as defaultThemeFile,
2083
+ S as lightTheme,
2084
+ Pe as normalizeThemeFile,
2085
+ Yt as radii,
2086
+ Ie as resolveActiveTheme,
2087
+ Re as setAuthToken,
2088
+ Be as setBaseUrl,
2089
+ Gt as spacing,
2090
+ je as themeToCssVars,
2091
+ Kt as typography,
2092
+ P as useSettingsWizard,
2093
+ Ue as useTheme
2094
+ };
2095
+ //# sourceMappingURL=complaint-app.js.map