@burdenoff/microfe-support 2026.625.1 → 2026.625.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,8 @@
1
1
  import { cn as e } from "../utils/cn.js";
2
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
+ import { Fragment as t, jsx as n, jsxs as r } from "react/jsx-runtime";
3
+ import { AuroraBackground as i, GradientText as a, IllustratedEmptyState as o } from "@burdenoff/fe-libs/ui";
3
4
  //#region src/support/components/PageLayout.tsx
4
- var r = {
5
+ var s = {
5
6
  sm: "max-w-screen-sm",
6
7
  md: "max-w-screen-md",
7
8
  lg: "max-w-screen-lg",
@@ -10,78 +11,90 @@ var r = {
10
11
  "3xl": "max-w-[1600px]",
11
12
  full: "max-w-full"
12
13
  };
13
- function i({ children: i, title: a, subtitle: o, icon: s, headerActions: c, headerContent: l, maxWidth: u = "xl", showHeader: d = !0, className: f, contentClassName: p }) {
14
- return /* @__PURE__ */ t("div", {
15
- className: e("min-size-full", "px-4 sm:px-6 lg:px-8 xl:px-12", "py-6 sm:py-8 lg:py-10", "animate-in fade-in-0 slide-in-from-bottom-4 duration-200", f),
16
- children: /* @__PURE__ */ n("div", {
17
- className: e("mx-auto w-full", r[u], p),
18
- children: [d && (a || c) && /* @__PURE__ */ n("header", {
19
- className: "mb-6 sm:mb-8",
20
- children: [/* @__PURE__ */ n("div", {
21
- className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
22
- children: [/* @__PURE__ */ n("div", {
23
- className: "space-y-1",
24
- children: [(a || s) && /* @__PURE__ */ n("div", {
25
- className: "flex items-center gap-3",
26
- children: [s && /* @__PURE__ */ t("div", {
27
- className: "flex-shrink-0 p-2.5 rounded-xl bg-action-primary-bg/10 text-primary",
28
- children: s
29
- }), a && /* @__PURE__ */ t("h1", {
30
- className: "text-2xl sm:text-3xl font-bold tracking-tight text-text-primary",
31
- children: a
14
+ function c({ children: o, title: c, subtitle: l, icon: u, headerActions: d, headerContent: f, maxWidth: p = "xl", showHeader: m = !0, className: h, contentClassName: g, aurora: _ = !1, titleAccent: v }) {
15
+ let y = v && c && c.endsWith(v) ? c.slice(0, c.length - v.length) : null;
16
+ return /* @__PURE__ */ n("div", {
17
+ className: e("min-size-full", "px-4 sm:px-6 lg:px-8 xl:px-12", "py-6 sm:py-8 lg:py-10", "animate-in fade-in-0 slide-in-from-bottom-4 duration-200", h),
18
+ children: /* @__PURE__ */ r("div", {
19
+ className: e("mx-auto w-full", s[p], g),
20
+ children: [m && (c || d) && /* @__PURE__ */ r("header", {
21
+ className: e("mb-6 sm:mb-8", _ && "relative overflow-hidden rounded-2xl border border-border-seam bg-bg-surface/40 p-4 sm:p-6 backdrop-blur-[var(--blur-glass)]"),
22
+ children: [
23
+ _ && /* @__PURE__ */ n(i, { intensity: "subtle" }),
24
+ /* @__PURE__ */ r("div", {
25
+ className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
26
+ children: [/* @__PURE__ */ r("div", {
27
+ className: "space-y-1",
28
+ children: [(c || u) && /* @__PURE__ */ r("div", {
29
+ className: "flex items-center gap-3",
30
+ children: [u && /* @__PURE__ */ n("div", {
31
+ className: "flex-shrink-0 p-2.5 rounded-xl bg-action-primary-bg/10 text-primary",
32
+ children: u
33
+ }), c && /* @__PURE__ */ n("h1", {
34
+ className: "text-2xl sm:text-3xl font-bold tracking-tight text-text-primary",
35
+ children: y === null ? c : /* @__PURE__ */ r(t, { children: [y, /* @__PURE__ */ n(a, { children: v })] })
36
+ })]
37
+ }), l && /* @__PURE__ */ n("p", {
38
+ className: "text-sm sm:text-base text-text-secondary max-w-2xl",
39
+ children: l
32
40
  })]
33
- }), o && /* @__PURE__ */ t("p", {
34
- className: "text-sm sm:text-base text-text-secondary max-w-2xl",
35
- children: o
41
+ }), d && /* @__PURE__ */ n("div", {
42
+ className: "flex items-center gap-2 flex-shrink-0",
43
+ children: d
36
44
  })]
37
- }), c && /* @__PURE__ */ t("div", {
38
- className: "flex items-center gap-2 flex-shrink-0",
39
- children: c
40
- })]
41
- }), l && /* @__PURE__ */ t("div", {
42
- className: "mt-4",
43
- children: l
44
- })]
45
- }), /* @__PURE__ */ t("div", {
45
+ }),
46
+ f && /* @__PURE__ */ n("div", {
47
+ className: "mt-4",
48
+ children: f
49
+ })
50
+ ]
51
+ }), /* @__PURE__ */ n("div", {
46
52
  className: "space-y-6",
47
- children: i
53
+ children: o
48
54
  })]
49
55
  })
50
56
  });
51
57
  }
52
- function a({ icon: r, title: i, description: a, action: o, className: s }) {
53
- return /* @__PURE__ */ n("div", {
54
- className: e("flex flex-col items-center justify-center", "py-12 sm:py-16 px-4", "text-center", "animate-in fade-in-0 zoom-in-95 duration-200", s),
58
+ function l({ icon: t, illustration: i, illustrationAlt: a, title: s, description: c, action: l, className: u }) {
59
+ return i ? /* @__PURE__ */ n(o, {
60
+ illustration: i,
61
+ alt: a,
62
+ title: s,
63
+ description: c,
64
+ action: l,
65
+ className: e("animate-in fade-in-0 zoom-in-95 duration-200", u)
66
+ }) : /* @__PURE__ */ r("div", {
67
+ className: e("flex flex-col items-center justify-center", "py-12 sm:py-16 px-4", "text-center", "animate-in fade-in-0 zoom-in-95 duration-200", u),
55
68
  children: [
56
- r && /* @__PURE__ */ t("div", {
69
+ t && /* @__PURE__ */ n("div", {
57
70
  className: "mb-4 p-4 rounded-2xl bg-bg-sunken/50 text-text-secondary",
58
- children: r
71
+ children: t
59
72
  }),
60
- /* @__PURE__ */ t("h3", {
73
+ /* @__PURE__ */ n("h3", {
61
74
  className: "text-lg font-semibold text-text-primary mb-1",
62
- children: i
75
+ children: s
63
76
  }),
64
- a && /* @__PURE__ */ t("p", {
77
+ c && /* @__PURE__ */ n("p", {
65
78
  className: "text-sm text-text-secondary max-w-sm mb-4",
66
- children: a
79
+ children: c
67
80
  }),
68
- o
81
+ l
69
82
  ]
70
83
  });
71
84
  }
72
- function o({ message: r = "Loading...", className: i }) {
73
- return /* @__PURE__ */ n("div", {
85
+ function u({ message: t = "Loading...", className: i }) {
86
+ return /* @__PURE__ */ r("div", {
74
87
  className: e("flex flex-col items-center justify-center py-20", i),
75
- children: [/* @__PURE__ */ n("div", {
88
+ children: [/* @__PURE__ */ r("div", {
76
89
  className: "relative",
77
- children: [/* @__PURE__ */ t("div", { className: "absolute inset-0 bg-action-primary-bg/20 rounded-full blur-xl animate-pulse" }), /* @__PURE__ */ t("div", { className: "relative size-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin" })]
78
- }), /* @__PURE__ */ t("span", {
90
+ children: [/* @__PURE__ */ n("div", { className: "absolute inset-0 bg-action-primary-bg/20 rounded-full blur-xl animate-pulse" }), /* @__PURE__ */ n("div", { className: "relative size-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin" })]
91
+ }), /* @__PURE__ */ n("span", {
79
92
  className: "mt-6 text-sm font-medium text-text-secondary",
80
- children: r
93
+ children: t
81
94
  })]
82
95
  });
83
96
  }
84
97
  //#endregion
85
- export { a as EmptyState, o as LoadingState, i as PageLayout };
98
+ export { l as EmptyState, u as LoadingState, c as PageLayout };
86
99
 
87
100
  //# sourceMappingURL=PageLayout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PageLayout.js","names":[],"sources":["../../../src/support/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm', // 640px\n md: 'max-w-screen-md', // 768px\n lg: 'max-w-screen-lg', // 1024px\n xl: 'max-w-screen-xl', // 1280px\n '2xl': 'max-w-screen-2xl', // 1536px\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design for Support module\n *\n * Features:\n * - Proper max-width constraints\n * - Responsive padding\n * - Animated entrance\n * - Consistent header styling\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n}: PageLayoutProps) {\n return (\n <div\n className={cn(\n // Base styles - full width container with padding\n 'min-size-full',\n // Responsive horizontal padding\n 'px-4 sm:px-6 lg:px-8 xl:px-12',\n // Responsive vertical padding\n 'py-6 sm:py-8 lg:py-10',\n // Entrance animation\n 'animate-in fade-in-0 slide-in-from-bottom-4 duration-200',\n className\n )}\n >\n {/* Max-width constrained content container */}\n <div className={cn('mx-auto w-full', maxWidthClasses[maxWidth], contentClassName)}>\n {/* Page Header */}\n {showHeader && (title || headerActions) && (\n <header className=\"mb-6 sm:mb-8\">\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n {/* Title Section */}\n <div className=\"space-y-1\">\n {(title || icon) && (\n <div className=\"flex items-center gap-3\">\n {icon && (\n <div className=\"flex-shrink-0 p-2.5 rounded-xl bg-action-primary-bg/10 text-primary\">\n {icon}\n </div>\n )}\n {title && (\n <h1 className=\"text-2xl sm:text-3xl font-bold tracking-tight text-text-primary\">\n {title}\n </h1>\n )}\n </div>\n )}\n {subtitle && (\n <p className=\"text-sm sm:text-base text-text-secondary max-w-2xl\">{subtitle}</p>\n )}\n </div>\n\n {/* Header Actions */}\n {headerActions && (\n <div className=\"flex items-center gap-2 flex-shrink-0\">{headerActions}</div>\n )}\n </div>\n\n {/* Additional Header Content */}\n {headerContent && <div className=\"mt-4\">{headerContent}</div>}\n </header>\n )}\n\n {/* Page content — must not use a <main> landmark here because the\n host shell (AppShellLayout) already renders one; nesting <main>\n elements is invalid HTML and an a11y violation. */}\n <div className=\"space-y-6\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * EmptyState - A consistent empty state component\n */\nexport function EmptyState({\n icon,\n title,\n description,\n action,\n className,\n}: {\n icon?: ReactNode;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}) {\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center',\n 'py-12 sm:py-16 px-4',\n 'text-center',\n 'animate-in fade-in-0 zoom-in-95 duration-200',\n className\n )}\n >\n {icon && (\n <div className=\"mb-4 p-4 rounded-2xl bg-bg-sunken/50 text-text-secondary\">{icon}</div>\n )}\n <h3 className=\"text-lg font-semibold text-text-primary mb-1\">{title}</h3>\n {description && <p className=\"text-sm text-text-secondary max-w-sm mb-4\">{description}</p>}\n {action}\n </div>\n );\n}\n\n/**\n * LoadingState - A consistent loading state component\n */\nexport function LoadingState({\n message = 'Loading...',\n className,\n}: {\n message?: string;\n className?: string;\n}) {\n return (\n <div className={cn('flex flex-col items-center justify-center py-20', className)}>\n <div className=\"relative\">\n <div className=\"absolute inset-0 bg-action-primary-bg/20 rounded-full blur-xl animate-pulse\" />\n <div className=\"relative size-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin\" />\n </div>\n <span className=\"mt-6 text-sm font-medium text-text-secondary\">{message}</span>\n </div>\n );\n}\n"],"mappings":";;;AAyBA,IAAM,IAAkB;CACtB,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,OAAO;CACP,OAAO;CACP,MAAM;CACP;AAWD,SAAgB,EAAW,EACzB,aACA,UACA,aACA,SACA,kBACA,kBACA,cAAW,MACX,gBAAa,IACb,cACA,uBACkB;AAClB,QACE,kBAAC,OAAD;EACE,WAAW,EAET,iBAEA,iCAEA,yBAEA,4DACA,EACD;YAGD,kBAAC,OAAD;GAAK,WAA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sources":["../../../src/support/components/PageLayout.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { AuroraBackground, GradientText, IllustratedEmptyState } from '@burdenoff/fe-libs/ui';\nimport { cn } from '../utils/cn';\n\ninterface PageLayoutProps {\n children: ReactNode;\n /** Page title */\n title?: string;\n /** Page subtitle/description */\n subtitle?: string;\n /** Icon component to display next to title */\n icon?: ReactNode;\n /** Actions to display in header (buttons, etc.) */\n headerActions?: ReactNode;\n /** Additional header content below title */\n headerContent?: ReactNode;\n /** Maximum width of content: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full' */\n maxWidth?: 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | 'full';\n /** Whether to show the header section */\n showHeader?: boolean;\n /** Additional CSS classes for the container */\n className?: string;\n /** Additional CSS classes for the content area */\n contentClassName?: string;\n /**\n * Boff UI 2.0 living-glass hero backdrop. When true, the header zone is wrapped\n * in a `relative overflow-hidden` container with a subtle drifting AuroraBackground\n * behind it (sits at -z-10, never moves content, reduced-motion safe). Reserve for\n * the MFE's primary landing page — ONE aurora per MFE.\n */\n aurora?: boolean;\n /**\n * When provided, the title is split so this trailing noun is rendered with a\n * brand GradientText fill (one hero heading accent per page). The remaining\n * leading text stays in the plain title colour.\n */\n titleAccent?: string;\n}\n\nconst maxWidthClasses = {\n sm: 'max-w-screen-sm', // 640px\n md: 'max-w-screen-md', // 768px\n lg: 'max-w-screen-lg', // 1024px\n xl: 'max-w-screen-xl', // 1280px\n '2xl': 'max-w-screen-2xl', // 1536px\n '3xl': 'max-w-[1600px]',\n full: 'max-w-full',\n};\n\n/**\n * PageLayout - A consistent page wrapper with responsive design for Support module\n *\n * Features:\n * - Proper max-width constraints\n * - Responsive padding\n * - Animated entrance\n * - Consistent header styling\n */\nexport function PageLayout({\n children,\n title,\n subtitle,\n icon,\n headerActions,\n headerContent,\n maxWidth = 'xl',\n showHeader = true,\n className,\n contentClassName,\n aurora = false,\n titleAccent,\n}: PageLayoutProps) {\n // Split the title so the trailing accent noun can be gradient-filled while the\n // leading portion stays plain. Falls back to the full title when no accent or\n // when the accent isn't a trailing substring of the title.\n const accentLead =\n titleAccent && title && title.endsWith(titleAccent)\n ? title.slice(0, title.length - titleAccent.length)\n : null;\n return (\n <div\n className={cn(\n // Base styles - full width container with padding\n 'min-size-full',\n // Responsive horizontal padding\n 'px-4 sm:px-6 lg:px-8 xl:px-12',\n // Responsive vertical padding\n 'py-6 sm:py-8 lg:py-10',\n // Entrance animation\n 'animate-in fade-in-0 slide-in-from-bottom-4 duration-200',\n className\n )}\n >\n {/* Max-width constrained content container */}\n <div className={cn('mx-auto w-full', maxWidthClasses[maxWidth], contentClassName)}>\n {/* Page Header */}\n {showHeader && (title || headerActions) && (\n <header\n className={cn(\n 'mb-6 sm:mb-8',\n // Living-glass hero backdrop: contain the aurora and give it room to breathe.\n aurora &&\n 'relative overflow-hidden rounded-2xl border border-border-seam bg-bg-surface/40 p-4 sm:p-6 backdrop-blur-[var(--blur-glass)]'\n )}\n >\n {aurora && <AuroraBackground intensity=\"subtle\" />}\n <div className=\"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between\">\n {/* Title Section */}\n <div className=\"space-y-1\">\n {(title || icon) && (\n <div className=\"flex items-center gap-3\">\n {icon && (\n <div className=\"flex-shrink-0 p-2.5 rounded-xl bg-action-primary-bg/10 text-primary\">\n {icon}\n </div>\n )}\n {title && (\n <h1 className=\"text-2xl sm:text-3xl font-bold tracking-tight text-text-primary\">\n {accentLead !== null ? (\n <>\n {accentLead}\n <GradientText>{titleAccent}</GradientText>\n </>\n ) : (\n title\n )}\n </h1>\n )}\n </div>\n )}\n {subtitle && (\n <p className=\"text-sm sm:text-base text-text-secondary max-w-2xl\">{subtitle}</p>\n )}\n </div>\n\n {/* Header Actions */}\n {headerActions && (\n <div className=\"flex items-center gap-2 flex-shrink-0\">{headerActions}</div>\n )}\n </div>\n\n {/* Additional Header Content */}\n {headerContent && <div className=\"mt-4\">{headerContent}</div>}\n </header>\n )}\n\n {/* Page content — must not use a <main> landmark here because the\n host shell (AppShellLayout) already renders one; nesting <main>\n elements is invalid HTML and an a11y violation. */}\n <div className=\"space-y-6\">{children}</div>\n </div>\n </div>\n );\n}\n\n/**\n * EmptyState - A consistent empty state component\n */\nexport function EmptyState({\n icon,\n illustration,\n illustrationAlt,\n title,\n description,\n action,\n className,\n}: {\n icon?: ReactNode;\n /**\n * Boff UI 2.0 on-brand illustration name (served by the host shell at\n * /illustrations/<name>.webp). When provided, the empty state renders the\n * richer IllustratedEmptyState instead of the plain icon variant. Reserve for\n * genuine zero/no-results states — keep gate/permission states on the icon.\n */\n illustration?: string;\n illustrationAlt?: string;\n title: string;\n description?: string;\n action?: ReactNode;\n className?: string;\n}) {\n if (illustration) {\n return (\n <IllustratedEmptyState\n illustration={illustration}\n alt={illustrationAlt}\n title={title}\n description={description}\n action={action}\n className={cn('animate-in fade-in-0 zoom-in-95 duration-200', className)}\n />\n );\n }\n return (\n <div\n className={cn(\n 'flex flex-col items-center justify-center',\n 'py-12 sm:py-16 px-4',\n 'text-center',\n 'animate-in fade-in-0 zoom-in-95 duration-200',\n className\n )}\n >\n {icon && (\n <div className=\"mb-4 p-4 rounded-2xl bg-bg-sunken/50 text-text-secondary\">{icon}</div>\n )}\n <h3 className=\"text-lg font-semibold text-text-primary mb-1\">{title}</h3>\n {description && <p className=\"text-sm text-text-secondary max-w-sm mb-4\">{description}</p>}\n {action}\n </div>\n );\n}\n\n/**\n * LoadingState - A consistent loading state component\n */\nexport function LoadingState({\n message = 'Loading...',\n className,\n}: {\n message?: string;\n className?: string;\n}) {\n return (\n <div className={cn('flex flex-col items-center justify-center py-20', className)}>\n <div className=\"relative\">\n <div className=\"absolute inset-0 bg-action-primary-bg/20 rounded-full blur-xl animate-pulse\" />\n <div className=\"relative size-12 border-4 border-primary/30 border-t-primary rounded-full animate-spin\" />\n </div>\n <span className=\"mt-6 text-sm font-medium text-text-secondary\">{message}</span>\n </div>\n );\n}\n"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,EACzB,SACA,iBACA,oBACA,UACA,gBACA,WACA,gBAeC;AAaD,QAZI,IAEA,kBAAC,GAAD;EACgB;EACd,KAAK;EACE;EACM;EACL;EACR,WAAW,EAAG,gDAAgD,EAAU;EACxE,CAAA,GAIJ,kBAAC,OAAD;EACE,WAAW,EACT,6CACA,uBACA,eACA,gDACA,EACD;YAPH;GASG,KACC,kBAAC,OAAD;IAAK,WAAU;cAA4D;IAAW,CAAA;GAExF,kBAAC,MAAD;IAAI,WAAU;cAAgD;IAAW,CAAA;GACxE,KAAe,kBAAC,KAAD;IAAG,WAAU;cAA6C;IAAgB,CAAA;GACzF;GACG;;;AAOV,SAAgB,EAAa,EAC3B,aAAU,cACV,gBAIC;AACD,QACE,kBAAC,OAAD;EAAK,WAAW,EAAG,mDAAmD,EAAU;YAAhF,CACE,kBAAC,OAAD;GAAK,WAAU;aAAf,CACE,kBAAC,OAAD,EAAK,WAAU,+EAAgF,CAAA,EAC/F,kBAAC,OAAD,EAAK,WAAU,0FAA2F,CAAA,CACtG;MACN,kBAAC,QAAD;GAAM,WAAU;aAAgD;GAAe,CAAA,CAC3E"}
@@ -59,7 +59,7 @@ function D() {
59
59
  subtitle: O("support.analytics.subtitle", "View support performance metrics"),
60
60
  icon: /* @__PURE__ */ S(m, { size: 24 }),
61
61
  children: /* @__PURE__ */ S(n, {
62
- icon: /* @__PURE__ */ S(m, { size: 48 }),
62
+ illustration: "empty-data",
63
63
  title: O("support.analytics.noData.title", "No analytics data available"),
64
64
  description: O("support.analytics.noData.description", "Analytics data will appear once there's ticket activity to report.")
65
65
  })
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsPage.js","names":[],"sources":["../../../src/support/pages/AnalyticsPage.tsx"],"sourcesContent":["import {\n BarChart3,\n TrendingUp,\n Clock,\n CheckCircle,\n Calendar,\n Download,\n ThumbsUp,\n ShieldAlert,\n} from 'lucide-react';\nimport { Button, EmphasisPanel } from '../components/ui';\nimport { useAnalyticsOperations, type TimePeriod } from '../hooks/useAnalyticsOperations';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { tWithFallback } from '../utils/i18n';\nimport { MetricCard } from '../components/analytics/MetricCard';\nimport { TrendChart } from '../components/analytics/TrendChart';\nimport { PriorityBreakdown } from '../components/analytics/PriorityBreakdown';\nimport { CategoryBreakdown } from '../components/analytics/CategoryBreakdown';\nimport { SLAReport } from '../components/analytics/SLAReport';\nimport { TopAgents } from '../components/analytics/TopAgents';\nimport { SatisfactionDistribution } from '../components/analytics/SatisfactionDistribution';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\n\n// Helper to check if error is a permission/authorization error\nfunction isPermissionError(error: unknown): boolean {\n if (!error) return false;\n const errorMessage = String(error).toLowerCase();\n return (\n errorMessage.includes('forbidden') ||\n errorMessage.includes('not authorized') ||\n errorMessage.includes('permission denied') ||\n errorMessage.includes('admin')\n );\n}\n\nconst periodOptions: { value: TimePeriod; label: string }[] = [\n { value: 'LAST_7_DAYS' as TimePeriod, label: 'Last 7 Days' },\n { value: 'LAST_30_DAYS' as TimePeriod, label: 'Last 30 Days' },\n { value: 'LAST_90_DAYS' as TimePeriod, label: 'Last 90 Days' },\n { value: 'LAST_YEAR' as TimePeriod, label: 'Last Year' },\n];\n\nexport function AnalyticsPage() {\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => tWithFallback(t, key, fallback);\n const {\n analytics,\n trends,\n slaReport,\n satisfaction,\n agentLeaderboard,\n period,\n analyticsLoading,\n trendsLoading,\n updatePeriod,\n exportReport,\n analyticsError,\n slaReportError,\n satisfactionError,\n } = useAnalyticsOperations();\n\n // Check for permission errors across all analytics queries\n const hasPermissionError =\n isPermissionError(analyticsError) ||\n isPermissionError(slaReportError) ||\n isPermissionError(satisfactionError);\n\n if (hasPermissionError) {\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={tr('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title={tr('support.analytics.adminRequired.title', 'Admin Access Required')}\n description={tr(\n 'support.analytics.adminRequired.description',\n 'You need administrator privileges to view support analytics. Please contact your workspace admin for access.'\n )}\n />\n </PageLayout>\n );\n }\n\n if (analyticsLoading || trendsLoading) {\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={tr('support.analytics.loadingSubtitle', 'Loading analytics data...')}\n icon={<BarChart3 size={24} />}\n >\n <LoadingState message={tr('support.analytics.loading', 'Loading analytics...')} />\n </PageLayout>\n );\n }\n\n if (!analytics || analytics.stats.totalTickets === 0) {\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={tr('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n icon={<BarChart3 size={48} />}\n title={tr('support.analytics.noData.title', 'No analytics data available')}\n description={tr(\n 'support.analytics.noData.description',\n \"Analytics data will appear once there's ticket activity to report.\"\n )}\n />\n </PageLayout>\n );\n }\n\n const periodLabel = periodOptions.find((option) => option.value === period)?.label || 'Custom';\n const periodRange = {\n startDate: slaReport?.startDate ?? satisfaction?.startDate ?? new Date().toISOString(),\n endDate: slaReport?.endDate ?? satisfaction?.endDate ?? new Date().toISOString(),\n label: periodLabel,\n };\n const ticketStats = {\n total: analytics.stats.totalTickets,\n open: analytics.stats.openTickets,\n resolved: analytics.stats.resolvedTickets,\n avgResponseTimeHours: analytics.stats.averageFirstResponseTimeHours || 0,\n avgResolutionTimeHours: analytics.stats.averageResolutionTimeHours || 0,\n byPriority: analytics.priorityBreakdown,\n };\n const transformedSlaReport = {\n period: periodRange,\n totalTickets: slaReport?.totalTickets ?? analytics.stats.totalTickets,\n firstResponseCompliance:\n slaReport?.firstResponseCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n resolutionCompliance: slaReport?.resolutionCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n avgFirstResponseTime: slaReport?.averageFirstResponseMinutes || 0,\n avgResolutionTime: slaReport?.averageResolutionMinutes || 0,\n breachedTickets: slaReport?.totalBreaches ?? 0,\n byPriority: (slaReport?.byPriority ?? []).map(\n (item: { priority: string; totalTickets: number; resolutionCompliance: number }) => ({\n priority: item.priority,\n tickets: item.totalTickets,\n compliance: item.resolutionCompliance,\n })\n ),\n };\n const ratingDistribution = satisfaction?.ratingDistribution ?? [];\n const satisfactionMetrics = {\n period: periodRange,\n totalResponses: satisfaction?.totalResponses ?? 0,\n averageRating: satisfaction?.averageRating || 0,\n csat: satisfaction?.csatScore || 0,\n nps: satisfaction?.npsScore || 0,\n ratings: {\n rating1:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 1)\n ?.count || 0,\n rating2:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 2)\n ?.count || 0,\n rating3:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 3)\n ?.count || 0,\n rating4:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 4)\n ?.count || 0,\n rating5:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 5)\n ?.count || 0,\n },\n };\n const topAgents = (agentLeaderboard?.agents ?? []).map(\n (item: {\n rank: number;\n ticketsResolved: number;\n averageRating?: number | null;\n agent: { id: string; userId: string };\n }) => ({\n rank: item.rank,\n ticketsResolved: item.ticketsResolved,\n avgRating: item.averageRating || 0,\n agent: {\n id: item.agent.id,\n user: {\n id: item.agent.userId,\n name: item.agent.userId,\n email: item.agent.userId,\n },\n },\n })\n );\n const trendSource = trends.length > 0 ? trends : analytics.ticketTrends;\n const trendChartData = trendSource.map(\n (trend: { date: string; count: number; groupBy: string }) => ({\n timestamp: trend.date,\n value: trend.count,\n label: trend.groupBy,\n })\n );\n\n return (\n <PageLayout\n title=\"Support Analytics\"\n subtitle={periodLabel}\n icon={<BarChart3 size={24} />}\n headerActions={\n <div className=\"flex items-center gap-3\">\n {/* Period Selector */}\n <div className=\"flex items-center gap-2\">\n <Calendar size={20} className=\"text-text-secondary\" />\n <select\n value={period}\n onChange={(e) => updatePeriod(e.target.value as TimePeriod)}\n className=\"px-3 py-2 rounded-lg border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n {periodOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n </div>\n\n {/* Export Button */}\n <Button onClick={() => exportReport('PDF')}>\n <Download size={18} />\n {tr('support.analytics.export', 'Export')}\n </Button>\n </div>\n }\n >\n <div className=\"space-y-6\">\n {/* Key Metrics — the single emphasis zone of the analytics page */}\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4\">\n <MetricCard\n title=\"Total Tickets\"\n value={ticketStats.total.toString()}\n icon={TrendingUp}\n iconColor=\"text-primary\"\n subtitle={`${ticketStats.open} open, ${ticketStats.resolved} resolved`}\n />\n <MetricCard\n title=\"Avg Response Time\"\n value={`${ticketStats.avgResponseTimeHours.toFixed(1)}h`}\n icon={Clock}\n iconColor=\"text-accent\"\n subtitle={`Resolution: ${ticketStats.avgResolutionTimeHours.toFixed(1)}h`}\n />\n <MetricCard\n title=\"SLA Compliance\"\n value={`${transformedSlaReport.firstResponseCompliance.toFixed(1)}%`}\n icon={CheckCircle}\n iconColor={\n transformedSlaReport.firstResponseCompliance >= 90 ? 'text-success' : 'text-warning'\n }\n subtitle={`${transformedSlaReport.breachedTickets} breached`}\n />\n <MetricCard\n title=\"Satisfaction\"\n value={satisfactionMetrics.averageRating.toFixed(1)}\n icon={ThumbsUp}\n iconColor=\"text-success\"\n subtitle={`CSAT: ${satisfactionMetrics.csat.toFixed(0)}%, NPS: ${satisfactionMetrics.nps.toFixed(0)}`}\n />\n </div>\n </EmphasisPanel>\n\n {/* Ticket Trends Chart */}\n <TrendChart trends={trendChartData} period={satisfactionMetrics.period} />\n\n {/* Breakdowns Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <PriorityBreakdown data={ticketStats.byPriority} />\n <CategoryBreakdown data={analytics.categoryBreakdown} />\n </div>\n\n {/* SLA Report */}\n <SLAReport report={transformedSlaReport} />\n\n {/* Bottom Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <SatisfactionDistribution metrics={satisfactionMetrics} />\n <TopAgents agents={topAgents} />\n </div>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAS,EAAkB,GAAyB;AAClD,KAAI,CAAC,EAAO,QAAO;CACnB,IAAM,IAAe,OAAO,EAAM,CAAC,aAAa;AAChD,QACE,EAAa,SAAS,YAAY,IAClC,EAAa,SAAS,iBAAiB,IACvC,EAAa,SAAS,oBAAoB,IAC1C,EAAa,SAAS,QAAQ;;AAIlC,IAAM,IAAwD;CAC5D;EAAE,OAAO;EAA6B,OAAO;EAAe;CAC5D;EAAE,OAAO;EAA8B,OAAO;EAAgB;CAC9D;EAAE,OAAO;EAA8B,OAAO;EAAgB;CAC9D;EAAE,OAAO;EAA2B,OAAO;EAAa;CACzD;AAED,SAAgB,IAAgB;CAC9B,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAAqB,EAAc,GAAG,GAAK,EAAS,EACvE,EACJ,cACA,WACA,cACA,iBACA,qBACA,WACA,qBACA,kBACA,iBACA,iBACA,mBACA,mBACA,yBACE,GAAwB;AAQ5B,KAJE,EAAkB,EAAe,IACjC,EAAkB,EAAe,IACjC,EAAkB,EAAkB,CAGpC,QACE,kBAAC,GAAD;EACE,OAAO,EAAG,2BAA2B,oBAAoB;EACzD,UAAU,EAAG,8BAA8B,mCAAmC;EAC9E,MAAM,kBAAC,GAAD,EAAW,MAAM,IAAM,CAAA;YAE7B,kBAAC,GAAD;GACE,MAAM,kBAAC,GAAD,EAAa,MAAM,IAAM,CAAA;GAC/B,OAAO,EAAG,yCAAyC,wBAAwB;GAC3E,aAAa,E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WAAU;eAAf,CACE,kBAAC,GAAD,EAAmB,MAAM,EAAY,YAAc,CAAA,EACnD,kBAAC,GAAD,EAAmB,MAAM,EAAU,mBAAqB,CAAA,CACpD;;IAGN,kBAAC,GAAD,EAAW,QAAQ,GAAwB,CAAA;IAG3C,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,GAAD,EAA0B,SAAS,GAAuB,CAAA,EAC1D,kBAAC,GAAD,EAAW,QAAQ,GAAa,CAAA,CAC5B;;IACF;;EACK,CAAA"}
1
+ {"version":3,"file":"AnalyticsPage.js","names":[],"sources":["../../../src/support/pages/AnalyticsPage.tsx"],"sourcesContent":["import {\n BarChart3,\n TrendingUp,\n Clock,\n CheckCircle,\n Calendar,\n Download,\n ThumbsUp,\n ShieldAlert,\n} from 'lucide-react';\nimport { Button, EmphasisPanel } from '../components/ui';\nimport { useAnalyticsOperations, type TimePeriod } from '../hooks/useAnalyticsOperations';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { tWithFallback } from '../utils/i18n';\nimport { MetricCard } from '../components/analytics/MetricCard';\nimport { TrendChart } from '../components/analytics/TrendChart';\nimport { PriorityBreakdown } from '../components/analytics/PriorityBreakdown';\nimport { CategoryBreakdown } from '../components/analytics/CategoryBreakdown';\nimport { SLAReport } from '../components/analytics/SLAReport';\nimport { TopAgents } from '../components/analytics/TopAgents';\nimport { SatisfactionDistribution } from '../components/analytics/SatisfactionDistribution';\nimport { PageLayout, LoadingState, EmptyState } from '../components/PageLayout';\n\n// Helper to check if error is a permission/authorization error\nfunction isPermissionError(error: unknown): boolean {\n if (!error) return false;\n const errorMessage = String(error).toLowerCase();\n return (\n errorMessage.includes('forbidden') ||\n errorMessage.includes('not authorized') ||\n errorMessage.includes('permission denied') ||\n errorMessage.includes('admin')\n );\n}\n\nconst periodOptions: { value: TimePeriod; label: string }[] = [\n { value: 'LAST_7_DAYS' as TimePeriod, label: 'Last 7 Days' },\n { value: 'LAST_30_DAYS' as TimePeriod, label: 'Last 30 Days' },\n { value: 'LAST_90_DAYS' as TimePeriod, label: 'Last 90 Days' },\n { value: 'LAST_YEAR' as TimePeriod, label: 'Last Year' },\n];\n\nexport function AnalyticsPage() {\n const { t } = useI18n();\n const tr = (key: string, fallback: string) => tWithFallback(t, key, fallback);\n const {\n analytics,\n trends,\n slaReport,\n satisfaction,\n agentLeaderboard,\n period,\n analyticsLoading,\n trendsLoading,\n updatePeriod,\n exportReport,\n analyticsError,\n slaReportError,\n satisfactionError,\n } = useAnalyticsOperations();\n\n // Check for permission errors across all analytics queries\n const hasPermissionError =\n isPermissionError(analyticsError) ||\n isPermissionError(slaReportError) ||\n isPermissionError(satisfactionError);\n\n if (hasPermissionError) {\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={tr('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n icon={<ShieldAlert size={48} />}\n title={tr('support.analytics.adminRequired.title', 'Admin Access Required')}\n description={tr(\n 'support.analytics.adminRequired.description',\n 'You need administrator privileges to view support analytics. Please contact your workspace admin for access.'\n )}\n />\n </PageLayout>\n );\n }\n\n if (analyticsLoading || trendsLoading) {\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={tr('support.analytics.loadingSubtitle', 'Loading analytics data...')}\n icon={<BarChart3 size={24} />}\n >\n <LoadingState message={tr('support.analytics.loading', 'Loading analytics...')} />\n </PageLayout>\n );\n }\n\n if (!analytics || analytics.stats.totalTickets === 0) {\n return (\n <PageLayout\n title={tr('support.analytics.title', 'Support Analytics')}\n subtitle={tr('support.analytics.subtitle', 'View support performance metrics')}\n icon={<BarChart3 size={24} />}\n >\n <EmptyState\n illustration=\"empty-data\"\n title={tr('support.analytics.noData.title', 'No analytics data available')}\n description={tr(\n 'support.analytics.noData.description',\n \"Analytics data will appear once there's ticket activity to report.\"\n )}\n />\n </PageLayout>\n );\n }\n\n const periodLabel = periodOptions.find((option) => option.value === period)?.label || 'Custom';\n const periodRange = {\n startDate: slaReport?.startDate ?? satisfaction?.startDate ?? new Date().toISOString(),\n endDate: slaReport?.endDate ?? satisfaction?.endDate ?? new Date().toISOString(),\n label: periodLabel,\n };\n const ticketStats = {\n total: analytics.stats.totalTickets,\n open: analytics.stats.openTickets,\n resolved: analytics.stats.resolvedTickets,\n avgResponseTimeHours: analytics.stats.averageFirstResponseTimeHours || 0,\n avgResolutionTimeHours: analytics.stats.averageResolutionTimeHours || 0,\n byPriority: analytics.priorityBreakdown,\n };\n const transformedSlaReport = {\n period: periodRange,\n totalTickets: slaReport?.totalTickets ?? analytics.stats.totalTickets,\n firstResponseCompliance:\n slaReport?.firstResponseCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n resolutionCompliance: slaReport?.resolutionCompliance ?? analytics.stats.slaComplianceRate ?? 0,\n avgFirstResponseTime: slaReport?.averageFirstResponseMinutes || 0,\n avgResolutionTime: slaReport?.averageResolutionMinutes || 0,\n breachedTickets: slaReport?.totalBreaches ?? 0,\n byPriority: (slaReport?.byPriority ?? []).map(\n (item: { priority: string; totalTickets: number; resolutionCompliance: number }) => ({\n priority: item.priority,\n tickets: item.totalTickets,\n compliance: item.resolutionCompliance,\n })\n ),\n };\n const ratingDistribution = satisfaction?.ratingDistribution ?? [];\n const satisfactionMetrics = {\n period: periodRange,\n totalResponses: satisfaction?.totalResponses ?? 0,\n averageRating: satisfaction?.averageRating || 0,\n csat: satisfaction?.csatScore || 0,\n nps: satisfaction?.npsScore || 0,\n ratings: {\n rating1:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 1)\n ?.count || 0,\n rating2:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 2)\n ?.count || 0,\n rating3:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 3)\n ?.count || 0,\n rating4:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 4)\n ?.count || 0,\n rating5:\n ratingDistribution.find((item: { rating: number; count: number }) => item.rating === 5)\n ?.count || 0,\n },\n };\n const topAgents = (agentLeaderboard?.agents ?? []).map(\n (item: {\n rank: number;\n ticketsResolved: number;\n averageRating?: number | null;\n agent: { id: string; userId: string };\n }) => ({\n rank: item.rank,\n ticketsResolved: item.ticketsResolved,\n avgRating: item.averageRating || 0,\n agent: {\n id: item.agent.id,\n user: {\n id: item.agent.userId,\n name: item.agent.userId,\n email: item.agent.userId,\n },\n },\n })\n );\n const trendSource = trends.length > 0 ? trends : analytics.ticketTrends;\n const trendChartData = trendSource.map(\n (trend: { date: string; count: number; groupBy: string }) => ({\n timestamp: trend.date,\n value: trend.count,\n label: trend.groupBy,\n })\n );\n\n return (\n <PageLayout\n title=\"Support Analytics\"\n subtitle={periodLabel}\n icon={<BarChart3 size={24} />}\n headerActions={\n <div className=\"flex items-center gap-3\">\n {/* Period Selector */}\n <div className=\"flex items-center gap-2\">\n <Calendar size={20} className=\"text-text-secondary\" />\n <select\n value={period}\n onChange={(e) => updatePeriod(e.target.value as TimePeriod)}\n className=\"px-3 py-2 rounded-lg border border-border-subtle bg-bg-surface text-text-primary focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary\"\n >\n {periodOptions.map((option) => (\n <option key={option.value} value={option.value}>\n {option.label}\n </option>\n ))}\n </select>\n </div>\n\n {/* Export Button */}\n <Button onClick={() => exportReport('PDF')}>\n <Download size={18} />\n {tr('support.analytics.export', 'Export')}\n </Button>\n </div>\n }\n >\n <div className=\"space-y-6\">\n {/* Key Metrics — the single emphasis zone of the analytics page */}\n <EmphasisPanel className=\"p-4 sm:p-5\">\n <div className=\"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4\">\n <MetricCard\n title=\"Total Tickets\"\n value={ticketStats.total.toString()}\n icon={TrendingUp}\n iconColor=\"text-primary\"\n subtitle={`${ticketStats.open} open, ${ticketStats.resolved} resolved`}\n />\n <MetricCard\n title=\"Avg Response Time\"\n value={`${ticketStats.avgResponseTimeHours.toFixed(1)}h`}\n icon={Clock}\n iconColor=\"text-accent\"\n subtitle={`Resolution: ${ticketStats.avgResolutionTimeHours.toFixed(1)}h`}\n />\n <MetricCard\n title=\"SLA Compliance\"\n value={`${transformedSlaReport.firstResponseCompliance.toFixed(1)}%`}\n icon={CheckCircle}\n iconColor={\n transformedSlaReport.firstResponseCompliance >= 90 ? 'text-success' : 'text-warning'\n }\n subtitle={`${transformedSlaReport.breachedTickets} breached`}\n />\n <MetricCard\n title=\"Satisfaction\"\n value={satisfactionMetrics.averageRating.toFixed(1)}\n icon={ThumbsUp}\n iconColor=\"text-success\"\n subtitle={`CSAT: ${satisfactionMetrics.csat.toFixed(0)}%, NPS: ${satisfactionMetrics.nps.toFixed(0)}`}\n />\n </div>\n </EmphasisPanel>\n\n {/* Ticket Trends Chart */}\n <TrendChart trends={trendChartData} period={satisfactionMetrics.period} />\n\n {/* Breakdowns Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <PriorityBreakdown data={ticketStats.byPriority} />\n <CategoryBreakdown data={analytics.categoryBreakdown} />\n </div>\n\n {/* SLA Report */}\n <SLAReport report={transformedSlaReport} />\n\n {/* Bottom Row */}\n <div className=\"grid grid-cols-1 lg:grid-cols-2 gap-6\">\n <SatisfactionDistribution metrics={satisfactionMetrics} />\n <TopAgents agents={topAgents} />\n </div>\n </div>\n </PageLayout>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,SAAS,EAAkB,GAAyB;AAClD,KAAI,CAAC,EAAO,QAAO;CACnB,IAAM,IAAe,OAAO,EAAM,CAAC,aAAa;AAChD,QACE,EAAa,SAAS,YAAY,IAClC,EAAa,SAAS,iBAAiB,IACvC,EAAa,SAAS,oBAAoB,IAC1C,EAAa,SAAS,QAAQ;;AAIlC,IAAM,IAAwD;CAC5D;EAAE,OAAO;EAA6B,OAAO;EAAe;CAC5D;EAAE,OAAO;EAA8B,OAAO;EAAgB;CAC9D;EAAE,OAAO;EAA8B,OAAO;EAAgB;CAC9D;EAA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