@elevasis/ui 2.75.0 → 2.76.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.
Files changed (105) hide show
  1. package/dist/api/index.js +3 -3
  2. package/dist/app/index.d.ts +277 -249
  3. package/dist/app/index.js +12 -11
  4. package/dist/auth/index.js +6 -7
  5. package/dist/charts/index.js +6 -7
  6. package/dist/{chunk-CRPH5AAB.js → chunk-2GIHWU5O.js} +4 -3
  7. package/dist/chunk-2Y6AKWGU.js +42 -0
  8. package/dist/chunk-3QYRZSHP.js +854 -0
  9. package/dist/{chunk-L3NBMLRN.js → chunk-3RK2NNJX.js} +1 -1
  10. package/dist/{chunk-R6NMRXNO.js → chunk-4WLAVUPS.js} +1 -1
  11. package/dist/{chunk-DTEGVSJ6.js → chunk-5R4I2PAN.js} +9 -43
  12. package/dist/chunk-6B4ZPBQJ.js +7 -0
  13. package/dist/{chunk-QFS2GZMV.js → chunk-73G3I5HJ.js} +160 -160
  14. package/dist/{chunk-7OOFMEX6.js → chunk-BFLYDVEN.js} +28 -41
  15. package/dist/{chunk-VWGCURZF.js → chunk-BG6PWDJ3.js} +381 -381
  16. package/dist/{chunk-5VF5LPYS.js → chunk-BV2RNLPP.js} +1 -1
  17. package/dist/{chunk-NMHQAYZU.js → chunk-CTT4RDXE.js} +150 -151
  18. package/dist/chunk-E2LJ3FRA.js +237 -0
  19. package/dist/{chunk-5RH6NYZH.js → chunk-EFQLXRYT.js} +1 -2
  20. package/dist/{chunk-M6VAZAQW.js → chunk-EVNLJHDD.js} +3 -3
  21. package/dist/{chunk-NYIIRZSA.js → chunk-GDQQX5SL.js} +4 -42
  22. package/dist/{chunk-IYATYH5I.js → chunk-GFSOQH3N.js} +1 -1
  23. package/dist/{chunk-G7O4CBMC.js → chunk-H5AEYSVX.js} +164 -3
  24. package/dist/{chunk-ZFISGKYW.js → chunk-IIEZXXDD.js} +1 -1
  25. package/dist/{chunk-5SLRGUC4.js → chunk-INCEZAM3.js} +1 -1
  26. package/dist/{chunk-ZG6YJUT4.js → chunk-JZQNUQE4.js} +1 -1
  27. package/dist/{chunk-SB3IHM5Y.js → chunk-K55TU6CC.js} +2023 -1700
  28. package/dist/chunk-KB5CAN5D.js +33 -0
  29. package/dist/{chunk-OGHTJKBV.js → chunk-KMA4FOSV.js} +5682 -5675
  30. package/dist/{chunk-ICHDIVQO.js → chunk-KXNRTJAE.js} +1 -1
  31. package/dist/{chunk-MLHZUN2X.js → chunk-MGAELVTZ.js} +12 -12
  32. package/dist/chunk-MKH2KOAO.js +39 -0
  33. package/dist/{chunk-6BJ5HMMC.js → chunk-NAPXMYFW.js} +35 -362
  34. package/dist/{chunk-GDTK33QT.js → chunk-OGG3QJYW.js} +14 -5
  35. package/dist/{chunk-SN7X5N2A.js → chunk-P6HHXMLJ.js} +1 -1
  36. package/dist/{chunk-SEYOVNS5.js → chunk-QAILYRC2.js} +1 -1
  37. package/dist/{chunk-RBGVNPA6.js → chunk-RXZ3XDBM.js} +1 -1
  38. package/dist/{chunk-2ZRY3ARL.js → chunk-SPW6UA6B.js} +1 -1
  39. package/dist/{chunk-3H5DIJN7.js → chunk-SVZR4GYA.js} +1 -1
  40. package/dist/{chunk-47YJVIZE.js → chunk-UEY4AB3R.js} +789 -66
  41. package/dist/{chunk-LFLM723H.js → chunk-UL6MPMKY.js} +1 -1
  42. package/dist/{chunk-TX3UHDL5.js → chunk-WELN7DDV.js} +2 -2
  43. package/dist/{chunk-D3XXPCCK.js → chunk-WJN2VVVJ.js} +1 -1
  44. package/dist/{chunk-DMSTDZCJ.js → chunk-XODQUPFW.js} +11 -11
  45. package/dist/components/index.d.ts +135 -25
  46. package/dist/components/index.js +2165 -1996
  47. package/dist/components/navigation/index.js +7 -8
  48. package/dist/features/auth/index.d.ts +35 -3716
  49. package/dist/features/auth/index.js +9 -10
  50. package/dist/features/clients/index.js +18 -12
  51. package/dist/features/content/index.js +27 -27
  52. package/dist/features/crm/index.css +59 -59
  53. package/dist/features/crm/index.d.ts +18 -1
  54. package/dist/features/crm/index.js +13 -11
  55. package/dist/features/dashboard/index.css +59 -59
  56. package/dist/features/dashboard/index.js +8 -9
  57. package/dist/features/delivery/index.d.ts +3 -0
  58. package/dist/features/delivery/index.js +21 -20
  59. package/dist/features/knowledge/index.js +6 -7
  60. package/dist/features/lead-gen/index.css +59 -59
  61. package/dist/features/lead-gen/index.d.ts +3903 -2
  62. package/dist/features/lead-gen/index.js +15 -13
  63. package/dist/features/monitoring/index.js +10 -11
  64. package/dist/features/monitoring/requests/index.css +59 -59
  65. package/dist/features/monitoring/requests/index.js +8 -9
  66. package/dist/features/notes/index.js +4 -4
  67. package/dist/features/operations/index.css +59 -59
  68. package/dist/features/operations/index.js +13 -15
  69. package/dist/features/seo/index.css +659 -0
  70. package/dist/features/seo/index.d.ts +3962 -1
  71. package/dist/features/seo/index.js +31 -2
  72. package/dist/features/settings/index.css +59 -59
  73. package/dist/features/settings/index.d.ts +79 -3742
  74. package/dist/features/settings/index.js +10 -12
  75. package/dist/hooks/access/index.js +6 -7
  76. package/dist/hooks/delivery/index.css +59 -59
  77. package/dist/hooks/delivery/index.d.ts +13 -4
  78. package/dist/hooks/delivery/index.js +3 -3
  79. package/dist/hooks/published.d.ts +63 -25
  80. package/dist/hooks/published.js +19 -19
  81. package/dist/initialization/index.d.ts +35 -3716
  82. package/dist/knowledge/index.js +11 -11
  83. package/dist/layout/index.d.ts +55 -2
  84. package/dist/layout/index.js +10 -10
  85. package/dist/organization/index.css +59 -59
  86. package/dist/profile/index.d.ts +64 -3716
  87. package/dist/provider/index.d.ts +3 -0
  88. package/dist/provider/index.js +6 -7
  89. package/dist/provider/published.d.ts +3 -0
  90. package/dist/provider/published.js +6 -7
  91. package/dist/test-utils/index.js +3 -3
  92. package/dist/theme/index.js +3 -3
  93. package/dist/theme/presets/index.js +1 -1
  94. package/dist/types/index.d.ts +298 -251
  95. package/dist/utils/index.d.ts +1 -1
  96. package/dist/utils/index.js +1 -1
  97. package/package.json +5 -9
  98. package/src/hooks/README.md +22 -23
  99. package/dist/chunk-6ZAP3FOA.js +0 -93
  100. package/dist/chunk-AH52XQB7.js +0 -1
  101. package/dist/chunk-DVAOCHIF.js +0 -165
  102. package/dist/chunk-MISHPEJX.js +0 -244
  103. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +0 -879
  104. package/dist/hooks/operations/command-view/utils/transformCommandViewData.js +0 -2
  105. /package/dist/{chunk-A2SB32YV.js → chunk-5ZK7K7YP.js} +0 -0
@@ -1,8 +1,7 @@
1
- import { mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-R6NMRXNO.js';
2
- import { PRESETS, getPreset, AppBackground, generateShades } from './chunk-RBGVNPA6.js';
3
- import { HTTP_HEADERS, ApiClientProvider, useApiClient } from './chunk-ZG6YJUT4.js';
4
- import { showApiErrorNotification, showSuccessNotification } from './chunk-ICHDIVQO.js';
5
- import { topbarHeight, sidebarTransitionDuration, sidebarBottomSectionHeight, SubshellSidebarSection, sidebarItemPadding, sidebarItemHeight, sidebarIconSize, sidebarIconStroke, sidebarIconInnerSize, SubshellNavItem } from './chunk-MISHPEJX.js';
1
+ import { mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-4WLAVUPS.js';
2
+ import { PRESETS, getPreset, AppBackground, generateShades } from './chunk-RXZ3XDBM.js';
3
+ import { HTTP_HEADERS, ApiClientProvider, useApiClient } from './chunk-JZQNUQE4.js';
4
+ import { showApiErrorNotification, showSuccessNotification } from './chunk-KXNRTJAE.js';
6
5
  import { CardHeader } from './chunk-62GVNH5U.js';
7
6
  import { InitializationContext, useInitialization, InitializationProvider } from './chunk-P45GQ3ZW.js';
8
7
  import { SessionIdParamSchema, CreateSessionSchema } from './chunk-2GIJBHZT.js';
@@ -11,24 +10,24 @@ import { getStatusIcon } from './chunk-BLXJEIQS.js';
11
10
  import { invalidateOrgScopedQueries, OrganizationProvider } from './chunk-UD657ICS.js';
12
11
  import { OrganizationContext, useOrganization } from './chunk-DD3CCMCZ.js';
13
12
  import { ProfileProvider } from './chunk-RT4KRGZT.js';
14
- import { LabelSchema, DescriptionSchema, PathSchema, ModelIdSchema, IconNameSchema, SystemLifecycleSchema, OntologyIdSchema, SystemPathSchema, ActionInvocationSchema, SystemIdSchema, NodeIdStringSchema, JsonValueSchema, SystemInterfaceRefSchema, EntitiesDomainSchema, ActionsDomainSchema, DEFAULT_ORGANIZATION_MODEL_ACTIONS, OntologyScopeSchema, DEFAULT_ONTOLOGY_SCOPE, SystemsDomainSchema, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, formatOntologyId, isSystemLifecycleVisible, listResolvedOntologyRecords, getErrorInfo, getErrorTitle, formatErrorMessage, compileOrganizationOntology, listAllSystems, ontologyGraphNodeId, parseOntologyId, getSystem, STALE_TIME_DEFAULT, GC_TIME_SHORT, STALE_TIME_MONITORING, getResourceIcon, formatTimeAgo, resolveReadinessRemedy, getResourcesForSystem, formatRelativeTime, PAGE_SIZE_DEFAULT, devOnlyFor, topLevel, parentOf, ancestorsOf, childrenOf, findById, findByPath, systemLifecycleAllowsAccess, resolveSystemConfig, defaultPathFor } from './chunk-A2SB32YV.js';
15
- import { getTimeRangeLabel, getTimeRangeDates, formatBucketTime, REFETCH_INTERVAL_DASHBOARD, debounce } from './chunk-Y6I3IC45.js';
13
+ import { LabelSchema, DescriptionSchema, PathSchema, ModelIdSchema, IconNameSchema, SystemLifecycleSchema, OntologyIdSchema, SystemPathSchema, ActionInvocationSchema, SystemIdSchema, NodeIdStringSchema, JsonValueSchema, SystemInterfaceRefSchema, EntitiesDomainSchema, ActionsDomainSchema, DEFAULT_ORGANIZATION_MODEL_ACTIONS, OntologyScopeSchema, DEFAULT_ONTOLOGY_SCOPE, SystemsDomainSchema, DEFAULT_ORGANIZATION_MODEL_SYSTEMS, formatOntologyId, isSystemLifecycleVisible, listResolvedOntologyRecords, getErrorInfo, getErrorTitle, formatErrorMessage, compileOrganizationOntology, listAllSystems, ontologyGraphNodeId, parseOntologyId, getSystem, STALE_TIME_DEFAULT, GC_TIME_SHORT, STALE_TIME_MONITORING, getResourceIcon, formatTimeAgo, resolveReadinessRemedy, getResourcesForSystem, formatRelativeTime, PAGE_SIZE_DEFAULT, devOnlyFor, topLevel, parentOf, ancestorsOf, childrenOf, findById, findByPath, systemLifecycleAllowsAccess, resolveSystemConfig, defaultPathFor } from './chunk-5ZK7K7YP.js';
14
+ import { getTimeRangeLabel, getTimeRangeDates, formatBucketTime, REFETCH_INTERVAL_RUNNING, REFETCH_INTERVAL_DASHBOARD, debounce } from './chunk-Y6I3IC45.js';
16
15
  import { ResourceStatusColors } from './chunk-6SSQGWK7.js';
17
16
  import { ElevasisServiceContext, useElevasisServices, ElevasisServiceProvider } from './chunk-BI5VDO2K.js';
18
- import { brandWorkOsOrgId } from './chunk-MQZE7SUI.js';
17
+ import { brandWorkOsOrgId, brandSupabaseOrgId } from './chunk-MQZE7SUI.js';
19
18
  import { useAuthContext } from './chunk-BRJ3QZ4E.js';
20
19
  import { useRouterContext } from './chunk-Q7DJKLEN.js';
21
- import { createContext, lazy, forwardRef, useContext, useRef, useState, useMemo, cloneElement, useLayoutEffect, useEffect, useCallback, useId, Suspense } from 'react';
20
+ import { createContext, lazy, forwardRef, useContext, useRef, useState, useMemo, useEffect, useCallback, Children, Fragment as Fragment$1, cloneElement, useLayoutEffect, useId, Suspense } from 'react';
22
21
  import { QueryClientProvider, useQuery, useQueryClient, useMutation, useQueries, QueryClient } from '@tanstack/react-query';
23
22
  import { z } from 'zod';
24
23
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
25
24
  import { IconListDetails, IconChecklist, IconShare, IconLayoutGrid, IconColumns, IconFileInvoice, IconList, IconBuilding, IconAddressBook, IconArticle, IconBriefcase, IconBrain, IconTarget, IconActivity, IconCode, IconSettings, IconMail, IconSend, IconFileText, IconClock, IconArrowUp, IconMessageCircle, IconRocket, IconEye, IconEdit, IconAlertTriangle, IconRefresh, IconX, IconCheck, IconShieldLock, IconTopologyStar3, IconApps, IconBolt, IconSearch, IconChartBar, IconUsers, IconInfoCircle, IconMessagePlus, IconDatabase, IconGitBranch, IconDashboard, IconBuildingStore, IconUser, IconPlug, IconTargetArrow, IconBook, IconArchive, IconTool, IconCalendar, IconPencil, IconRoute, IconLock, IconMinus, IconTrendingUp, IconTrendingDown, IconChevronUp, IconChevronDown, IconChevronRight, IconAlertCircle, IconBan, IconInbox, IconHeartHandshake, IconUserOff, IconMailForward, IconBell, IconCalendarEvent, IconCalendarCancel, IconMessageReply, IconCircleCheck, IconCreditCard, IconArrowRight, IconPlus, IconDownload, IconChartLine, IconPlayerPlay, IconFilter, IconCategory, IconTrophy, IconClockExclamation, IconAdjustmentsHorizontal, IconCircleX, IconCircleDashed, IconMessage, IconTrash, IconExclamationMark, IconCheckbox, IconPhone, IconSitemap, IconFolder, IconHistory, IconCopy, IconStarFilled, IconStar, IconCircleCheckFilled } from '@tabler/icons-react';
26
- import { Box, Center, Stack, Title, Text, Modal, Space, Button, TextInput, useComputedColorScheme, Group, Loader, Badge, Collapse, ScrollArea, Card, UnstyledButton, ThemeIcon, Select, Alert, Code, Popover, Tooltip as Tooltip$1, ActionIcon, Paper, Grid, Timeline, NumberFormatter, SimpleGrid, SegmentedControl, useMantineTheme, RangeSlider, Textarea, Divider, useTree, Tree, mergeThemeOverrides, MantineProvider, Checkbox, Tabs, Pagination } from '@mantine/core';
27
- import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine as ReferenceLine$1, Area, PieChart, Pie, Cell } from 'recharts';
25
+ import { UnstyledButton, Box, Group, ThemeIcon, Center, Stack, Title, Text, Modal, Button, Loader, Badge, Collapse, ScrollArea, Card, Select, Alert, Code, Popover, Tooltip, ActionIcon, Paper, Grid, Timeline, Divider, Space, TextInput, useComputedColorScheme, NumberFormatter, SimpleGrid, SegmentedControl, useMantineTheme, RangeSlider, Textarea, useTree, Tree, mergeThemeOverrides, MantineProvider, Checkbox, Tabs, Pagination } from '@mantine/core';
28
26
  import { useDisclosure, useClipboard } from '@mantine/hooks';
29
27
  import { Prism } from 'react-syntax-highlighter';
30
28
  import { oneDark } from 'react-syntax-highlighter/dist/esm/styles/prism';
31
29
  import { useNavigate, useLocation, useSearch } from '@tanstack/react-router';
30
+ import { ResponsiveContainer, AreaChart, CartesianGrid, XAxis, YAxis, Tooltip as Tooltip$1, ReferenceLine as ReferenceLine$1, Area, PieChart, Pie, Cell } from 'recharts';
32
31
  import { create } from 'zustand';
33
32
  import { persist, createJSONStorage } from 'zustand/middleware';
34
33
  import { useForm } from '@mantine/form';
@@ -3594,6 +3593,28 @@ var clientsManifest = {
3594
3593
  key: "clients",
3595
3594
  systemId: "client-management"
3596
3595
  };
3596
+
3597
+ // src/components/layout/constants.ts
3598
+ var sidebarWidth = 240;
3599
+ var sidebarCollapsedWidth = 72;
3600
+ var sidebarTransitionDuration = 200;
3601
+ var sidebarHoverDelay = 100;
3602
+ var topbarHeight = 54;
3603
+ var sidebarBottomSectionHeight = 71;
3604
+ var sidebarBottomSectionCollapsedHeight = 59;
3605
+ var sidebarItemHeight = 42;
3606
+ var sidebarItemPadding = 10;
3607
+ var sidebarItemGap = 4;
3608
+ var sidebarSectionPadding = "var(--mantine-spacing-sm)";
3609
+ var sidebarSubLinkIndent = 44;
3610
+ var sidebarIconSize = 24;
3611
+ var sidebarIconStroke = 1.6;
3612
+ var sidebarIconInnerSize = 20;
3613
+ var sidebarToggleIconSize = 20;
3614
+ var sidebarSubLinkPaddingY = 6;
3615
+ var sidebarSubLinkPaddingX = 10;
3616
+ var sidebarGroupChevronSize = 14;
3617
+ var subshellNavItemIconSize = 14;
3597
3618
  var VIEWPORT_SLACK = 4;
3598
3619
  var SCROLL_SLACK = 1;
3599
3620
  function detectUnboundedScroll(metrics) {
@@ -3833,6 +3854,185 @@ var SubshellSidebar = ({
3833
3854
  }
3834
3855
  );
3835
3856
  };
3857
+ var activeColor = "var(--color-primary)";
3858
+ var defaultColor = "var(--color-text-subtle)";
3859
+ var hoverColor = "var(--color-text)";
3860
+ var activeBg = `color-mix(in srgb, ${activeColor} 10%, transparent)`;
3861
+ var SubshellNavItem = ({
3862
+ icon: Icon,
3863
+ label,
3864
+ isActive = false,
3865
+ onClick,
3866
+ description,
3867
+ badge,
3868
+ disabled = false,
3869
+ href
3870
+ }) => {
3871
+ const handleAnchorClick = disabled ? void 0 : (event) => {
3872
+ if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) {
3873
+ return;
3874
+ }
3875
+ event.preventDefault();
3876
+ onClick();
3877
+ };
3878
+ const sharedStyle = {
3879
+ width: "100%",
3880
+ padding: "var(--mantine-spacing-xs)",
3881
+ backgroundColor: isActive ? activeBg : "transparent",
3882
+ borderRadius: "var(--mantine-radius-default)",
3883
+ transition: `all var(--duration-fast) var(--easing)`,
3884
+ cursor: disabled ? "not-allowed" : "pointer",
3885
+ opacity: disabled ? 0.5 : 1,
3886
+ color: "inherit",
3887
+ textDecoration: "none",
3888
+ display: "block"
3889
+ };
3890
+ const handleMouseEnter = (e) => {
3891
+ if (!isActive && !disabled) {
3892
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
3893
+ const textElements = e.currentTarget.querySelectorAll("[data-text-element]");
3894
+ textElements.forEach((el) => {
3895
+ el.style.color = hoverColor;
3896
+ });
3897
+ }
3898
+ };
3899
+ const handleMouseLeave = (e) => {
3900
+ if (!isActive && !disabled) {
3901
+ e.currentTarget.style.backgroundColor = "transparent";
3902
+ const textElements = e.currentTarget.querySelectorAll("[data-text-element]");
3903
+ textElements.forEach((el) => {
3904
+ el.style.color = defaultColor;
3905
+ });
3906
+ }
3907
+ };
3908
+ const inner = /* @__PURE__ */ jsxs(Stack, { gap: 2, children: [
3909
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", children: [
3910
+ /* @__PURE__ */ jsx(
3911
+ Icon,
3912
+ {
3913
+ size: subshellNavItemIconSize,
3914
+ style: {
3915
+ flexShrink: 0,
3916
+ opacity: isActive ? 1 : 0.6,
3917
+ color: isActive ? activeColor : defaultColor
3918
+ }
3919
+ }
3920
+ ),
3921
+ /* @__PURE__ */ jsx(
3922
+ Text,
3923
+ {
3924
+ size: "sm",
3925
+ fw: isActive ? 600 : 400,
3926
+ style: {
3927
+ overflow: "hidden",
3928
+ textOverflow: "ellipsis",
3929
+ whiteSpace: "nowrap",
3930
+ flex: 1,
3931
+ fontFamily: "var(--elevasis-font-family-subtitle)",
3932
+ color: isActive ? activeColor : defaultColor,
3933
+ transition: `color var(--duration-fast) var(--easing)`
3934
+ },
3935
+ "data-text-element": true,
3936
+ children: label
3937
+ }
3938
+ ),
3939
+ badge && /* @__PURE__ */ jsx("div", { style: { flexShrink: 0 }, children: badge })
3940
+ ] }),
3941
+ description && /* @__PURE__ */ jsx(
3942
+ Text,
3943
+ {
3944
+ size: "xs",
3945
+ c: "dimmed",
3946
+ style: {
3947
+ paddingLeft: "22px",
3948
+ lineHeight: 1.2,
3949
+ color: isActive ? activeColor : defaultColor,
3950
+ opacity: isActive ? 0.8 : 0.6,
3951
+ transition: `all var(--duration-fast) var(--easing)`,
3952
+ display: "-webkit-box",
3953
+ WebkitLineClamp: 2,
3954
+ WebkitBoxOrient: "vertical",
3955
+ overflow: "hidden",
3956
+ textOverflow: "ellipsis"
3957
+ },
3958
+ "data-text-element": true,
3959
+ children: description
3960
+ }
3961
+ )
3962
+ ] });
3963
+ if (href) {
3964
+ return /* @__PURE__ */ jsx(
3965
+ UnstyledButton,
3966
+ {
3967
+ component: "a",
3968
+ href,
3969
+ onClick: handleAnchorClick,
3970
+ style: sharedStyle,
3971
+ onMouseEnter: handleMouseEnter,
3972
+ onMouseLeave: handleMouseLeave,
3973
+ children: inner
3974
+ }
3975
+ );
3976
+ }
3977
+ return /* @__PURE__ */ jsx(
3978
+ UnstyledButton,
3979
+ {
3980
+ onClick: disabled ? void 0 : onClick,
3981
+ disabled,
3982
+ style: sharedStyle,
3983
+ onMouseEnter: handleMouseEnter,
3984
+ onMouseLeave: handleMouseLeave,
3985
+ children: inner
3986
+ }
3987
+ );
3988
+ };
3989
+ var SubshellSidebarSection = ({
3990
+ icon: Icon,
3991
+ label,
3992
+ rightSection,
3993
+ withTopBorder = false
3994
+ }) => {
3995
+ return /* @__PURE__ */ jsx(
3996
+ Box,
3997
+ {
3998
+ p: "sm",
3999
+ style: {
4000
+ borderTop: withTopBorder ? "1px solid var(--color-border)" : void 0,
4001
+ borderBottom: "1px solid var(--color-border)"
4002
+ },
4003
+ children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
4004
+ /* @__PURE__ */ jsx(
4005
+ ThemeIcon,
4006
+ {
4007
+ variant: "light",
4008
+ size: sidebarIconSize,
4009
+ style: {
4010
+ backgroundColor: "var(--color-surface)",
4011
+ color: "var(--color-primary)",
4012
+ flexShrink: 0
4013
+ },
4014
+ children: /* @__PURE__ */ jsx(Icon, { size: sidebarIconInnerSize, stroke: sidebarIconStroke })
4015
+ }
4016
+ ),
4017
+ /* @__PURE__ */ jsx(
4018
+ Box,
4019
+ {
4020
+ c: "var(--color-text)",
4021
+ style: {
4022
+ fontFamily: "var(--elevasis-font-family-subtitle)",
4023
+ flex: 1,
4024
+ fontSize: "var(--mantine-font-size-md)",
4025
+ fontWeight: 500,
4026
+ lineHeight: 1.2
4027
+ },
4028
+ children: label
4029
+ }
4030
+ ),
4031
+ rightSection
4032
+ ] })
4033
+ }
4034
+ );
4035
+ };
3836
4036
  var AppearanceContext = createContext(null);
3837
4037
  function AppearanceProvider({ value, children }) {
3838
4038
  return /* @__PURE__ */ jsx(AppearanceContext.Provider, { value, children });
@@ -3987,7 +4187,7 @@ function membershipPermissions(membership) {
3987
4187
  }
3988
4188
  function resolveOrganizationId(organization) {
3989
4189
  const membership = organization?.currentMembership;
3990
- return organization?.currentSupabaseOrganizationId ?? membership?.organizationId ?? membership?.organization?.id ?? null;
4190
+ return organization?.currentSupabaseOrganizationId ?? brandSupabaseOrgId(membership?.organizationId ?? membership?.organization?.id ?? null);
3991
4191
  }
3992
4192
  function toAccessMembership(membership, organizationId, permissions) {
3993
4193
  if (!membership || !organizationId) return null;
@@ -4063,6 +4263,12 @@ var executionsKeys = {
4063
4263
  ],
4064
4264
  execution: (orgId, resourceId, executionId) => [...executionsKeys.all, "execution", orgId, resourceId, executionId]
4065
4265
  };
4266
+
4267
+ // src/hooks/executions/executionStatus.ts
4268
+ var TERMINAL_EXECUTION_STATUSES = ["completed", "failed", "warning"];
4269
+ function isExecutionInFlight(status) {
4270
+ return status !== void 0 && status !== null && !TERMINAL_EXECUTION_STATUSES.includes(status);
4271
+ }
4066
4272
  function useExecutions(resourceId, resourceStatus, limit, offset) {
4067
4273
  const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
4068
4274
  return useQuery({
@@ -4112,1792 +4318,1860 @@ var CustomModal = ({ children, opened, onClose, loading, style, size }) => {
4112
4318
  }
4113
4319
  );
4114
4320
  };
4115
- var ConfirmationModal = ({
4116
- opened,
4117
- onClose,
4118
- loading,
4119
- icon,
4120
- confirmationHandler,
4121
- style,
4321
+ function EmptyState({ icon: Icon, title, description, action, py = "xl" }) {
4322
+ return /* @__PURE__ */ jsx(Center, { py, children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
4323
+ /* @__PURE__ */ jsx(Icon, { size: 48, style: { opacity: 0.5 } }),
4324
+ /* @__PURE__ */ jsx(Title, { order: 4, children: title }),
4325
+ description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", children: description }),
4326
+ action && /* @__PURE__ */ jsx(Button, { variant: "light", onClick: action.onClick, leftSection: action.icon, mt: "sm", children: action.label })
4327
+ ] }) });
4328
+ }
4329
+ function TabCountBadge({ count, isLoading }) {
4330
+ return /* @__PURE__ */ jsx(Box, { miw: 20, h: 20, style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: isLoading ? /* @__PURE__ */ jsx(Loader, { size: 12 }) : /* @__PURE__ */ jsx(Badge, { size: "sm", variant: "light", circle: count < 10, children: count }) });
4331
+ }
4332
+ function TrendIndicator({ current, previous, inverse }) {
4333
+ const change = previous === 0 ? 0 : (current - previous) / previous * 100;
4334
+ const isPositive = inverse ? change < 0 : change > 0;
4335
+ const isFlat = Math.abs(change) < 0.1;
4336
+ const color = isFlat ? "gray" : isPositive ? "green" : "red";
4337
+ const Icon = isFlat ? IconMinus : change > 0 ? IconTrendingUp : IconTrendingDown;
4338
+ return /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
4339
+ /* @__PURE__ */ jsx(Icon, { size: 12 }),
4340
+ /* @__PURE__ */ jsx(Badge, { size: "sm", color, variant: "light", children: isFlat ? "No change" : `${isPositive ? "+" : ""}${Math.abs(change).toFixed(1)}%` })
4341
+ ] });
4342
+ }
4343
+ function CollapsibleSection({
4122
4344
  title,
4123
- text,
4124
- buttonText,
4125
- buttonColor,
4126
- centerText
4127
- }) => {
4128
- const styledIcon = cloneElement(icon, {
4129
- size: 55,
4130
- strokeWidth: 1.5
4131
- });
4132
- return /* @__PURE__ */ jsxs(CustomModal, { opened, onClose, loading, style, children: [
4133
- /* @__PURE__ */ jsx(Center, { children: styledIcon }),
4134
- /* @__PURE__ */ jsx(Space, { h: 16 }),
4135
- /* @__PURE__ */ jsx(Center, { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx(Text, { size: "lg", c: "var(--color-text)", children: title }) }),
4136
- /* @__PURE__ */ jsx(Space, { h: 16 }),
4137
- text && /* @__PURE__ */ jsxs(Fragment, { children: [
4138
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text-dimmed)", style: { textAlign: centerText ? "center" : "left" }, children: text }),
4139
- /* @__PURE__ */ jsx(Space, { h: 16 })
4140
- ] }),
4141
- /* @__PURE__ */ jsx(Button, { color: buttonColor, fullWidth: true, onClick: confirmationHandler, loading, children: buttonText || "Confirm" })
4345
+ count,
4346
+ countLabel,
4347
+ children,
4348
+ emptyMessage,
4349
+ defaultExpanded = true,
4350
+ maxHeight = 300
4351
+ }) {
4352
+ const [expanded, setExpanded] = useState(defaultExpanded);
4353
+ const isEmpty = count === 0;
4354
+ return /* @__PURE__ */ jsxs(
4355
+ "div",
4356
+ {
4357
+ style: {
4358
+ borderRadius: "8px",
4359
+ padding: "8px",
4360
+ border: "1px solid var(--color-border)",
4361
+ boxShadow: "var(--standard-box-shadow)"
4362
+ },
4363
+ children: [
4364
+ /* @__PURE__ */ jsxs(
4365
+ Group,
4366
+ {
4367
+ gap: "xs",
4368
+ mb: expanded ? "xs" : 0,
4369
+ justify: "space-between",
4370
+ align: "center",
4371
+ style: { cursor: "pointer" },
4372
+ onClick: () => setExpanded(!expanded),
4373
+ children: [
4374
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", style: { flex: 1 }, children: [
4375
+ typeof title === "string" ? /* @__PURE__ */ jsx(
4376
+ Text,
4377
+ {
4378
+ fw: 600,
4379
+ size: "sm",
4380
+ c: "var(--color-text)",
4381
+ style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
4382
+ children: title
4383
+ }
4384
+ ) : title,
4385
+ count !== void 0 && countLabel && /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
4386
+ count,
4387
+ " ",
4388
+ count === 1 ? countLabel.replace(/s$/, "") : countLabel
4389
+ ] })
4390
+ ] }),
4391
+ expanded ? /* @__PURE__ */ jsx(IconChevronUp, { size: 16 }) : /* @__PURE__ */ jsx(IconChevronDown, { size: 16 })
4392
+ ]
4393
+ }
4394
+ ),
4395
+ /* @__PURE__ */ jsx(Collapse, { in: expanded, children: isEmpty && emptyMessage ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: emptyMessage }) : /* @__PURE__ */ jsx(ScrollArea, { h: maxHeight, type: "scroll", offsetScrollbars: true, children }) })
4396
+ ]
4397
+ }
4398
+ );
4399
+ }
4400
+ var PageTitleCaption = ({ title, caption, rightSection }) => {
4401
+ const renderCaption = () => {
4402
+ if (!caption) return null;
4403
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Text, { style: { fontFamily: "var(--elevasis-font-family-subtitle)", color: "var(--color-text-dimmed)" }, children: caption }) });
4404
+ };
4405
+ const titleContent = /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
4406
+ /* @__PURE__ */ jsx(Title, { order: 1, children: title }),
4407
+ /* @__PURE__ */ jsx(Space, { h: "4" }),
4408
+ renderCaption()
4409
+ ] });
4410
+ if (!rightSection) {
4411
+ return titleContent;
4412
+ }
4413
+ return /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "end", children: [
4414
+ titleContent,
4415
+ rightSection
4142
4416
  ] });
4143
4417
  };
4144
- var ConfirmationInputModal = ({
4145
- opened,
4146
- onClose,
4147
- loading,
4148
- icon,
4149
- confirmationHandler,
4418
+ function StatsCardSkeleton({ chartHeight = 200 }) {
4419
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: chartHeight, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
4420
+ }
4421
+ function ListSkeleton({ rows = 3, rowHeight = 50 }) {
4422
+ return /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Center, { mih: rows * rowHeight, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
4423
+ }
4424
+ function DetailCardSkeleton({ rows = 3 }) {
4425
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: rows * 60 + 100, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
4426
+ }
4427
+ var NavigationButton = ({
4428
+ icon: Icon,
4429
+ label,
4430
+ isCollapsed = false,
4431
+ hasSubItems = false,
4432
+ isExpanded = false,
4433
+ isActive = false,
4434
+ hasActiveBackground = false,
4435
+ onClick,
4150
4436
  style,
4151
- title,
4152
- text,
4153
- buttonText,
4154
- buttonColor,
4155
- inputValue,
4156
- onInputChange,
4157
- expectedValue,
4158
- placeholder
4437
+ transitionDuration = 200
4159
4438
  }) => {
4160
- const styledIcon = cloneElement(icon, {
4161
- size: 55,
4162
- strokeWidth: 1.5
4163
- });
4164
- return /* @__PURE__ */ jsxs(CustomModal, { opened, onClose, loading, style, children: [
4165
- /* @__PURE__ */ jsx(Center, { children: styledIcon }),
4166
- /* @__PURE__ */ jsx(Space, { h: 16 }),
4167
- /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Title, { order: 3, children: title }) }),
4168
- /* @__PURE__ */ jsx(Space, { h: 16 }),
4169
- text && /* @__PURE__ */ jsxs(Fragment, { children: [
4170
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text-dimmed)", children: text }),
4171
- /* @__PURE__ */ jsx(Space, { h: 8 })
4172
- ] }),
4173
- /* @__PURE__ */ jsx(
4174
- TextInput,
4175
- {
4176
- placeholder: placeholder || "Enter confirmation text",
4177
- value: inputValue,
4178
- onChange: (event) => onInputChange(event.currentTarget.value)
4179
- }
4180
- ),
4181
- /* @__PURE__ */ jsx(Space, { h: 16 }),
4182
- /* @__PURE__ */ jsx(
4183
- Button,
4184
- {
4185
- color: buttonColor,
4186
- fullWidth: true,
4187
- onClick: confirmationHandler,
4188
- loading,
4189
- disabled: inputValue !== expectedValue,
4190
- children: buttonText || "Confirm"
4439
+ const activeColor2 = "var(--color-primary)";
4440
+ const textColor = isActive ? activeColor2 : "var(--color-text)";
4441
+ const bgColor = hasActiveBackground ? `color-mix(in srgb, ${activeColor2} 10%, transparent)` : "transparent";
4442
+ return /* @__PURE__ */ jsx(
4443
+ UnstyledButton,
4444
+ {
4445
+ onClick: (event) => {
4446
+ event.preventDefault();
4447
+ event.stopPropagation();
4448
+ onClick?.();
4449
+ },
4450
+ style: {
4451
+ height: sidebarItemHeight,
4452
+ display: "flex",
4453
+ alignItems: "center",
4454
+ width: "100%",
4455
+ padding: sidebarItemPadding,
4456
+ color: textColor,
4457
+ backgroundColor: bgColor,
4458
+ transition: `all ${transitionDuration}ms var(--easing)`,
4459
+ cursor: "pointer",
4460
+ overflow: "hidden",
4461
+ borderRadius: "var(--mantine-radius-default)",
4462
+ ...style
4463
+ },
4464
+ onMouseEnter: (e) => {
4465
+ if (!hasActiveBackground) {
4466
+ e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
4467
+ }
4468
+ },
4469
+ onMouseLeave: (e) => {
4470
+ if (!hasActiveBackground) {
4471
+ e.currentTarget.style.backgroundColor = "transparent";
4472
+ }
4473
+ },
4474
+ children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", gap: 0, style: { width: "100%", overflow: "hidden" }, children: [
4475
+ /* @__PURE__ */ jsxs(
4476
+ Box,
4477
+ {
4478
+ style: {
4479
+ display: "flex",
4480
+ alignItems: "center",
4481
+ flex: hasSubItems && !isCollapsed ? 1 : "initial",
4482
+ minWidth: 0,
4483
+ overflow: "hidden"
4484
+ },
4485
+ children: [
4486
+ /* @__PURE__ */ jsx(
4487
+ ThemeIcon,
4488
+ {
4489
+ variant: "light",
4490
+ size: sidebarIconSize,
4491
+ style: {
4492
+ backgroundColor: isActive ? activeColor2 : "var(--color-surface)",
4493
+ color: isActive ? "white" : activeColor2,
4494
+ marginRight: isCollapsed ? 0 : "var(--mantine-spacing-sm)",
4495
+ transition: `margin ${transitionDuration}ms var(--easing)`,
4496
+ flexShrink: 0
4497
+ },
4498
+ children: /* @__PURE__ */ jsx(Icon, { size: sidebarIconInnerSize, stroke: sidebarIconStroke })
4499
+ }
4500
+ ),
4501
+ !isCollapsed && /* @__PURE__ */ jsx(
4502
+ Box,
4503
+ {
4504
+ style: {
4505
+ fontFamily: "var(--elevasis-font-family-subtitle)",
4506
+ fontSize: "var(--mantine-font-size-md)",
4507
+ fontWeight: isActive ? 600 : 500,
4508
+ color: textColor,
4509
+ transition: `opacity ${transitionDuration}ms var(--easing)`,
4510
+ whiteSpace: "nowrap",
4511
+ overflow: "hidden",
4512
+ textOverflow: "ellipsis"
4513
+ },
4514
+ children: label
4515
+ }
4516
+ )
4517
+ ]
4518
+ }
4519
+ ),
4520
+ hasSubItems && !isCollapsed && /* @__PURE__ */ jsx(
4521
+ IconChevronRight,
4522
+ {
4523
+ size: 14,
4524
+ stroke: 1.5,
4525
+ style: {
4526
+ transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)",
4527
+ transition: `transform var(--duration-fast) var(--easing)`,
4528
+ color: "var(--color-text-subtle)",
4529
+ flexShrink: 0,
4530
+ marginLeft: "auto"
4531
+ }
4532
+ }
4533
+ )
4534
+ ] })
4535
+ }
4536
+ );
4537
+ };
4538
+ function CustomSelector({
4539
+ value,
4540
+ onChange,
4541
+ data,
4542
+ leftSection,
4543
+ placeholder,
4544
+ w,
4545
+ withCheckIcon = false,
4546
+ disabled
4547
+ }) {
4548
+ return /* @__PURE__ */ jsx(
4549
+ Select,
4550
+ {
4551
+ value,
4552
+ onChange,
4553
+ data,
4554
+ leftSection,
4555
+ placeholder,
4556
+ w,
4557
+ size: "xs",
4558
+ variant: "unstyled",
4559
+ withCheckIcon,
4560
+ disabled,
4561
+ styles: {
4562
+ wrapper: {
4563
+ border: "1px solid var(--color-border)",
4564
+ borderRadius: "var(--mantine-radius-default)",
4565
+ backgroundColor: "var(--color-surface)",
4566
+ transition: "border-color 150ms ease, background-color 150ms ease",
4567
+ "&:hover": {
4568
+ borderColor: "var(--color-border-hover, var(--mantine-color-dark-3))"
4569
+ }
4570
+ },
4571
+ input: {
4572
+ fontSize: "var(--mantine-font-size-xs)",
4573
+ fontWeight: 500,
4574
+ height: "30px",
4575
+ minHeight: "30px",
4576
+ paddingLeft: leftSection ? "30px" : void 0,
4577
+ borderRadius: "var(--mantine-radius-default)",
4578
+ cursor: "pointer"
4579
+ },
4580
+ section: {
4581
+ color: "var(--color-text-subtle)"
4582
+ },
4583
+ dropdown: {
4584
+ border: "1px solid var(--color-border)",
4585
+ backgroundColor: "var(--color-surface)",
4586
+ boxShadow: "var(--card-shadow)"
4587
+ },
4588
+ option: {
4589
+ fontSize: "var(--mantine-font-size-xs)"
4590
+ }
4191
4591
  }
4192
- )
4592
+ }
4593
+ );
4594
+ }
4595
+ function APIErrorAlert({
4596
+ error,
4597
+ title,
4598
+ showRequestId = true,
4599
+ icon = /* @__PURE__ */ jsx(IconAlertCircle, {}),
4600
+ color = "red"
4601
+ }) {
4602
+ const { message, code, requestId, retryAfter } = getErrorInfo(error);
4603
+ const alertTitle = title || getErrorTitle(code);
4604
+ return /* @__PURE__ */ jsxs(Alert, { icon, title: alertTitle, color, variant: "light", children: [
4605
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: message }),
4606
+ retryAfter && /* @__PURE__ */ jsxs(Text, { size: "sm", mt: "xs", children: [
4607
+ "Please wait ",
4608
+ retryAfter,
4609
+ " seconds before retrying."
4610
+ ] }),
4611
+ showRequestId && requestId && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", mt: "xs", children: [
4612
+ "Request ID: ",
4613
+ /* @__PURE__ */ jsx(Code, { children: requestId })
4614
+ ] })
4193
4615
  ] });
4194
- };
4195
- function ChartFrame({ h, debounceMs = 150, children }) {
4196
- const ref = useRef(null);
4197
- const [width, setWidth] = useState(0);
4198
- useLayoutEffect(() => {
4199
- const el = ref.current;
4200
- if (!el) return;
4201
- const w = el.getBoundingClientRect().width;
4202
- if (w > 0) setWidth(w);
4203
- }, []);
4616
+ }
4617
+ async function hashOrganizationModel(model) {
4618
+ if (typeof globalThis.crypto?.subtle?.digest !== "function") return null;
4619
+ const parsed = OrganizationModelSchema.safeParse(model);
4620
+ if (!parsed.success) return null;
4621
+ const bytes = new TextEncoder().encode(canonicalStringifyOrganizationModel(parsed.data));
4622
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
4623
+ return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
4624
+ }
4625
+ function useOrganizationModelDrift(organizationModel) {
4626
+ const { apiRequest, isReady } = useElevasisServices();
4627
+ const [buildTimeHash, setBuildTimeHash] = useState(null);
4204
4628
  useEffect(() => {
4205
- const el = ref.current;
4206
- if (!el) return;
4207
- let timeout;
4208
- const ro = new ResizeObserver((entries) => {
4209
- if (timeout !== void 0) window.clearTimeout(timeout);
4210
- const nextWidth = entries[0]?.contentRect.width ?? 0;
4211
- timeout = window.setTimeout(() => {
4212
- if (nextWidth > 0) setWidth(nextWidth);
4213
- }, debounceMs);
4629
+ let cancelled = false;
4630
+ void hashOrganizationModel(organizationModel).then((hash) => {
4631
+ if (!cancelled) setBuildTimeHash(hash);
4214
4632
  });
4215
- ro.observe(el);
4216
4633
  return () => {
4217
- ro.disconnect();
4218
- if (timeout !== void 0) window.clearTimeout(timeout);
4634
+ cancelled = true;
4219
4635
  };
4220
- }, [debounceMs]);
4221
- return /* @__PURE__ */ jsx("div", { ref, style: { width: "100%", height: h, position: "relative" }, children: width > 0 && /* @__PURE__ */ jsx("div", { style: { width, height: h }, children }) });
4636
+ }, [organizationModel]);
4637
+ const { data, isLoading } = useQuery({
4638
+ queryKey: ["organization-model-snapshot"],
4639
+ queryFn: () => apiRequest("/organization-model/snapshot"),
4640
+ enabled: isReady,
4641
+ staleTime: STALE_TIME_MONITORING,
4642
+ gcTime: GC_TIME_SHORT,
4643
+ refetchOnWindowFocus: false,
4644
+ // An org with no active deployment 503s here. That is a real condition with
4645
+ // its own surfaces; retrying it on every mount would only add noise.
4646
+ retry: false
4647
+ });
4648
+ const deployedHash = data?.snapshotHash ?? null;
4649
+ return {
4650
+ hasDrifted: Boolean(buildTimeHash && deployedHash && buildTimeHash !== deployedHash),
4651
+ buildTimeHash,
4652
+ deployedHash,
4653
+ activeDeploymentId: data?.activeDeploymentId ?? null,
4654
+ isLoading: isLoading || buildTimeHash === null
4655
+ };
4222
4656
  }
4223
- var THEME_DERIVED = {
4224
- grid: "var(--color-border)",
4225
- gridLine: "var(--color-border)",
4226
- tickText: "var(--mantine-color-dimmed)",
4227
- tooltipBg: "var(--glass-background)",
4228
- tooltipBorder: "var(--color-border)",
4229
- tooltipText: "var(--mantine-color-dimmed)",
4230
- dotStroke: "var(--mantine-color-body)"
4231
- };
4232
- var DARK = {
4233
- cyan: "#00e5ff",
4234
- cyanDim: "#00b8d4",
4235
- blue: "#448aff",
4236
- green: "#00ff88",
4237
- greenDim: "#00c853",
4238
- red: "#ff1744",
4239
- redDim: "#d50000",
4240
- yellow: "#ffab00",
4241
- magenta: "#ff4081",
4242
- ...THEME_DERIVED,
4243
- cardGlow: "0 0 30px rgba(0, 229, 255, 0.06)"
4657
+ function OrganizationModelDriftActionIcon({
4658
+ organizationModel,
4659
+ message
4660
+ }) {
4661
+ const { hasDrifted, buildTimeHash, deployedHash } = useOrganizationModelDrift(organizationModel);
4662
+ const [opened, { toggle, close }] = useDisclosure(false);
4663
+ if (!hasDrifted) return null;
4664
+ const label = "Organization model out of date";
4665
+ return /* @__PURE__ */ jsxs(Popover, { opened, onChange: close, onDismiss: close, width: 340, position: "bottom-end", withArrow: true, shadow: "md", children: [
4666
+ /* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsx(Tooltip, { label, disabled: opened, children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "lg", onClick: toggle, "aria-label": label, children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, color: "var(--color-warning)" }) }) }) }),
4667
+ /* @__PURE__ */ jsx(Popover.Dropdown, { children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
4668
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, children: label }),
4669
+ /* @__PURE__ */ jsx(Text, { size: "sm", children: message ?? "This app was built against an older organization model than the one currently deployed. Navigation, knowledge, and systems pages may not match what the platform is running. Redeploy the app to catch up." }),
4670
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
4671
+ "built ",
4672
+ /* @__PURE__ */ jsx(Code, { children: buildTimeHash?.slice(0, 12) }),
4673
+ " \xB7 deployed ",
4674
+ /* @__PURE__ */ jsx(Code, { children: deployedHash?.slice(0, 12) })
4675
+ ] })
4676
+ ] }) })
4677
+ ] });
4678
+ }
4679
+ function CenteredErrorState({ error, title, h = 300, py }) {
4680
+ return /* @__PURE__ */ jsx(Center, { h, py, children: /* @__PURE__ */ jsx(APIErrorAlert, { error, title }) });
4681
+ }
4682
+
4683
+ // src/components/display/StatCard.module.css.js
4684
+ var StatCard_module_css_default = { "heroCard": "heroCard", "iconRing": "iconRing", "iconRingSm": "iconRingSm", "heroValue": "heroValue", "heroValueSm": "heroValueSm", "heroLabel": "heroLabel", "heroLabelSm": "heroLabelSm" };
4685
+ function StatCard(props) {
4686
+ if (props.variant === "hero") {
4687
+ return /* @__PURE__ */ jsx(HeroStatCard, { ...props });
4688
+ }
4689
+ const { label, value, icon: IconComponent, color } = props;
4690
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
4691
+ /* @__PURE__ */ jsx(ThemeIcon, { size: "lg", variant: "light", color, children: /* @__PURE__ */ jsx(IconComponent, { size: 18 }) }),
4692
+ /* @__PURE__ */ jsxs("div", { children: [
4693
+ /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: label }),
4694
+ /* @__PURE__ */ jsx(Text, { size: "lg", fw: 600, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: value })
4695
+ ] })
4696
+ ] }) });
4697
+ }
4698
+ function HeroStatCard({
4699
+ icon: IconComponent,
4700
+ value,
4701
+ label,
4702
+ valueColor,
4703
+ isLoading,
4704
+ size = "sm",
4705
+ children
4706
+ }) {
4707
+ const sm = size === "sm";
4708
+ const iconSize = sm ? 36 : 46;
4709
+ if (isLoading) {
4710
+ return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_module_css_default.heroCard, children: /* @__PURE__ */ jsx(Center, { mih: iconSize + 16, children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) }) });
4711
+ }
4712
+ return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_module_css_default.heroCard, children: /* @__PURE__ */ jsxs(Group, { gap: sm ? "sm" : "md", wrap: "nowrap", children: [
4713
+ /* @__PURE__ */ jsx("div", { className: sm ? StatCard_module_css_default.iconRingSm : StatCard_module_css_default.iconRing, children: /* @__PURE__ */ jsx(IconComponent, { size: sm ? 18 : 22 }) }),
4714
+ /* @__PURE__ */ jsxs(Stack, { gap: 2, style: { flex: children ? 1 : void 0 }, children: [
4715
+ /* @__PURE__ */ jsx(
4716
+ "span",
4717
+ {
4718
+ className: sm ? StatCard_module_css_default.heroValueSm : StatCard_module_css_default.heroValue,
4719
+ style: valueColor ? { color: valueColor } : void 0,
4720
+ children: value
4721
+ }
4722
+ ),
4723
+ children ? /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", style: { flex: 1 }, children: [
4724
+ /* @__PURE__ */ jsx("span", { className: sm ? StatCard_module_css_default.heroLabelSm : StatCard_module_css_default.heroLabel, children: label }),
4725
+ /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children })
4726
+ ] }) : /* @__PURE__ */ jsx("span", { className: sm ? StatCard_module_css_default.heroLabelSm : StatCard_module_css_default.heroLabel, children: label })
4727
+ ] })
4728
+ ] }) });
4729
+ }
4730
+ function StatCardSkeleton() {
4731
+ return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: 60, children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) }) });
4732
+ }
4733
+ var jsonTheme = Object.fromEntries(
4734
+ Object.entries(oneDark).map(([key, value]) => [
4735
+ key,
4736
+ typeof value === "object" && value !== null ? { ...value, background: "none", backgroundColor: "none" } : value
4737
+ ])
4738
+ );
4739
+ function JsonViewer({ data, maxHeight, fontSize = "0.8rem" }) {
4740
+ const jsonString = typeof data === "string" ? data : JSON.stringify(data, null, 2);
4741
+ return /* @__PURE__ */ jsx(
4742
+ Prism,
4743
+ {
4744
+ language: "json",
4745
+ style: jsonTheme,
4746
+ customStyle: {
4747
+ margin: 0,
4748
+ fontSize,
4749
+ maxHeight,
4750
+ overflow: maxHeight ? "auto" : void 0,
4751
+ overflowX: "auto"
4752
+ },
4753
+ children: jsonString
4754
+ }
4755
+ );
4756
+ }
4757
+ var subtleMarkdownComponents = {
4758
+ p: ({ children }) => /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children })
4244
4759
  };
4245
- var LIGHT = {
4246
- cyan: "#0091ea",
4247
- cyanDim: "#0277bd",
4248
- blue: "#4d8af0",
4249
- green: "#00a854",
4250
- greenDim: "#00873e",
4251
- red: "#d32f2f",
4252
- redDim: "#b71c1c",
4253
- yellow: "#f9a825",
4254
- magenta: "#c51162",
4255
- ...THEME_DERIVED,
4256
- cardGlow: "0 0 20px rgba(0, 145, 234, 0.06)"
4760
+ var subtleMarkdownWrapperStyle = {
4761
+ display: "flex",
4762
+ flexDirection: "column",
4763
+ gap: 8
4257
4764
  };
4258
- function useCyberColors() {
4259
- const scheme = useComputedColorScheme("dark");
4260
- return useMemo(() => scheme === "dark" ? DARK : LIGHT, [scheme]);
4765
+ function ContextViewer({ data }) {
4766
+ return /* @__PURE__ */ jsx(ContextNode, { data, depth: 0 });
4261
4767
  }
4262
- function getSeriesColor(key, colors) {
4263
- switch (key) {
4264
- case "Success Rate":
4265
- return colors.cyan;
4266
- case "Executions":
4267
- return colors.blue;
4268
- case "Success Count":
4269
- return colors.green;
4270
- case "Error Count":
4271
- return colors.red;
4272
- default:
4273
- return colors.cyan;
4768
+ function ContextNode({ data, depth }) {
4769
+ if (data === null || data === void 0) {
4770
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No context provided" });
4771
+ }
4772
+ if (typeof data === "string") {
4773
+ return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, style: subtleMarkdownWrapperStyle, children: data });
4774
+ }
4775
+ if (typeof data === "number" || typeof data === "boolean") {
4776
+ return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
4274
4777
  }
4778
+ if (Array.isArray(data)) {
4779
+ return /* @__PURE__ */ jsx(ArrayView, { items: data, depth });
4780
+ }
4781
+ if (typeof data === "object") {
4782
+ return /* @__PURE__ */ jsx(ObjectView, { data, depth });
4783
+ }
4784
+ return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
4275
4785
  }
4276
- var ReferenceLine = ReferenceLine$1;
4277
- function CyberDefs({ colors, isLight }) {
4278
- const gradMul = isLight ? 0.5 : 1;
4279
- const gradients = [
4280
- { id: "gradCyan", color: colors.cyan, opacity: 0.35 * gradMul },
4281
- { id: "gradBlue", color: colors.blue, opacity: 0.3 * gradMul },
4282
- { id: "gradGreen", color: colors.green, opacity: 0.3 * gradMul },
4283
- { id: "gradRed", color: colors.red, opacity: 0.3 * gradMul },
4284
- { id: "gradYellow", color: colors.yellow, opacity: 0.3 * gradMul }
4285
- ];
4286
- const glowMul = isLight ? 0.25 : 1;
4287
- const filters = [
4288
- { id: "glowCyan", std: 3 * glowMul },
4289
- { id: "glowBlue", std: 3 * glowMul },
4290
- { id: "glowGreen", std: 2.5 * glowMul },
4291
- { id: "glowRed", std: 2.5 * glowMul },
4292
- { id: "glowYellow", std: 2.5 * glowMul }
4293
- ];
4294
- return /* @__PURE__ */ jsxs("defs", { children: [
4295
- gradients.map((g) => /* @__PURE__ */ jsxs("linearGradient", { id: g.id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
4296
- /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: g.color, stopOpacity: g.opacity }),
4297
- /* @__PURE__ */ jsx("stop", { offset: "60%", stopColor: g.color, stopOpacity: g.opacity * 0.2 }),
4298
- /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: g.color, stopOpacity: 0 })
4299
- ] }, g.id)),
4300
- filters.map((f) => /* @__PURE__ */ jsxs("filter", { id: f.id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
4301
- /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: f.std, result: "blur" }),
4302
- /* @__PURE__ */ jsxs("feMerge", { children: [
4303
- /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
4304
- /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
4305
- ] })
4306
- ] }, f.id)),
4307
- /* @__PURE__ */ jsxs("filter", { id: "dotGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
4308
- /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
4309
- /* @__PURE__ */ jsxs("feMerge", { children: [
4310
- /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
4311
- /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
4312
- /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
4313
- ] })
4314
- ] }),
4315
- /* @__PURE__ */ jsxs("filter", { id: "pulseGlow", x: "-30%", y: "-30%", width: "160%", height: "160%", children: [
4316
- /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "5", result: "blur" }),
4317
- /* @__PURE__ */ jsxs("feMerge", { children: [
4318
- /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
4319
- /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
4320
- /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
4321
- ] })
4322
- ] })
4323
- ] });
4786
+ var ACRONYMS = ["AI", "URL", "UUID", "ID", "API", "HTTP", "JSON"];
4787
+ function formatLabel(key) {
4788
+ const titleCased = key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
4789
+ return titleCased.replace(
4790
+ new RegExp(`\\b(${ACRONYMS.map((a) => a[0] + a.slice(1).toLowerCase()).join("|")})\\b`, "g"),
4791
+ (match) => match.toUpperCase()
4792
+ );
4324
4793
  }
4325
- function PulseDefs({ series, colors, isLight }) {
4326
- return /* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
4327
- const color = colors[s.color ?? "cyan"];
4328
- const dur = "6s";
4329
- const delay = "0s";
4330
- const keyTimes = "0;0.3;1";
4331
- const keySplines = "0.33 0 0.67 1;0 0 1 1";
4332
- const animateProps = {
4333
- dur,
4334
- keyTimes,
4335
- keySplines,
4336
- repeatCount: "indefinite",
4337
- calcMode: "spline",
4338
- begin: delay
4339
- };
4340
- return /* @__PURE__ */ jsxs("linearGradient", { id: `pulse-${i}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
4341
- /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.15;1.0;1.0", ...animateProps }) }),
4342
- /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: isLight ? "white" : color, stopOpacity: isLight ? 0.6 : 0.9, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.075;1.075;1.075", ...animateProps }) }),
4343
- /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "0;1.15;1.15", ...animateProps }) })
4344
- ] }, i);
4345
- }) });
4794
+ function hasMarkdown(value) {
4795
+ return /(\*\*.+\*\*|^#{1,6}\s|^\s*[-*]\s|\[.+\]\(.+\)|^\|.+\|$|^>\s|```)/.test(value);
4346
4796
  }
4347
- function CyberActiveDot({
4348
- cx,
4349
- cy,
4350
- color,
4351
- dotStroke
4352
- }) {
4353
- if (cx == null || cy == null) return null;
4354
- return /* @__PURE__ */ jsxs("g", { filter: "url(#dotGlow)", children: [
4355
- /* @__PURE__ */ jsxs("circle", { cx, cy, r: 6, fill: "none", stroke: color, strokeWidth: 2, opacity: 0.5, children: [
4356
- /* @__PURE__ */ jsx("animate", { attributeName: "r", from: "4", to: "10", dur: "1.2s", repeatCount: "indefinite" }),
4357
- /* @__PURE__ */ jsx("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: "1.2s", repeatCount: "indefinite" })
4797
+ function NestedSection({ title, children }) {
4798
+ const [expanded, setExpanded] = useState(true);
4799
+ return /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
4800
+ /* @__PURE__ */ jsxs(Group, { gap: 4, style: { cursor: "pointer", userSelect: "none" }, onClick: () => setExpanded((v) => !v), children: [
4801
+ expanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: 14, color: "var(--color-primary)", style: { flexShrink: 0 } }) : /* @__PURE__ */ jsx(IconChevronRight, { size: 14, color: "var(--color-primary)", style: { flexShrink: 0 } }),
4802
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: title })
4358
4803
  ] }),
4359
- /* @__PURE__ */ jsx("circle", { cx, cy, r: 4, fill: color, stroke: dotStroke, strokeWidth: 2 })
4804
+ expanded && /* @__PURE__ */ jsx(Box, { pl: "sm", style: { borderLeft: "2px solid var(--color-border)" }, children })
4360
4805
  ] });
4361
4806
  }
4362
- function CyberTooltipContent({
4363
- active,
4364
- payload,
4365
- label,
4366
- colors,
4367
- labelFormatter,
4368
- valueFormatter
4369
- }) {
4370
- if (!active || !payload?.length) return null;
4371
- const filtered = payload.filter((entry) => !entry.name?.startsWith("_pulse_"));
4372
- if (!filtered.length) return null;
4373
- const displayLabel = label && labelFormatter ? labelFormatter(label) : label;
4374
- return /* @__PURE__ */ jsxs(
4375
- "div",
4807
+ function PrimitiveValue({ value }) {
4808
+ if (value === null || value === void 0) {
4809
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "\u2014" });
4810
+ }
4811
+ if (typeof value === "boolean") {
4812
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value ? "Yes" : "No" });
4813
+ }
4814
+ if (typeof value === "number") {
4815
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value.toLocaleString() });
4816
+ }
4817
+ const str = String(value);
4818
+ if (hasMarkdown(str)) {
4819
+ return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, children: str });
4820
+ }
4821
+ return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children: str });
4822
+ }
4823
+ function ArrayView({ items, depth }) {
4824
+ if (items.length === 0) {
4825
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty list" });
4826
+ }
4827
+ const allPrimitive = items.every((item) => typeof item !== "object" || item === null);
4828
+ if (allPrimitive) {
4829
+ return /* @__PURE__ */ jsx(Stack, { gap: 2, children: items.map((item, i) => /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "flex-start", children: [
4830
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { userSelect: "none" }, children: "\u2022" }),
4831
+ /* @__PURE__ */ jsx(PrimitiveValue, { value: item })
4832
+ ] }, i)) });
4833
+ }
4834
+ return /* @__PURE__ */ jsx(Stack, { gap: "sm", children: items.map((item, i) => /* @__PURE__ */ jsx(Paper, { p: "sm", style: { border: "1px solid var(--color-border)" }, children: /* @__PURE__ */ jsx(ContextNode, { data: item, depth: depth + 1 }) }, i)) });
4835
+ }
4836
+ function ObjectView({ data, depth }) {
4837
+ const entries = Object.entries(data);
4838
+ if (entries.length === 0) {
4839
+ return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty" });
4840
+ }
4841
+ const simpleEntries = [];
4842
+ const complexEntries = [];
4843
+ for (const [key, value] of entries) {
4844
+ if (value === null || value === void 0 || typeof value === "boolean" || typeof value === "number") {
4845
+ simpleEntries.push([key, value]);
4846
+ } else if (typeof value === "string") {
4847
+ if (hasMarkdown(value) || value.length > 120) {
4848
+ complexEntries.push([key, value]);
4849
+ } else {
4850
+ simpleEntries.push([key, value]);
4851
+ }
4852
+ } else {
4853
+ complexEntries.push([key, value]);
4854
+ }
4855
+ }
4856
+ return /* @__PURE__ */ jsxs(Stack, { gap: 10, children: [
4857
+ simpleEntries.length > 0 && /* @__PURE__ */ jsx(Stack, { gap: 6, children: simpleEntries.map(([key, value]) => /* @__PURE__ */ jsxs(Group, { gap: "sm", align: "flex-start", wrap: "nowrap", children: [
4858
+ /* @__PURE__ */ jsx(
4859
+ Text,
4860
+ {
4861
+ size: "sm",
4862
+ style: { minWidth: 140, flexShrink: 0, fontFamily: "var(--mantine-font-family-headings)" },
4863
+ children: formatLabel(key)
4864
+ }
4865
+ ),
4866
+ /* @__PURE__ */ jsx(PrimitiveValue, { value })
4867
+ ] }, key)) }),
4868
+ complexEntries.map(([key, value]) => /* @__PURE__ */ jsx(NestedSection, { title: formatLabel(key), children: /* @__PURE__ */ jsx(ContextNode, { data: value, depth: depth + 1 }) }, key))
4869
+ ] });
4870
+ }
4871
+ var TIME_RANGE_OPTIONS = [
4872
+ { value: "1h", label: "Last 1 hour" },
4873
+ { value: "24h", label: "Last 24 hours" },
4874
+ { value: "7d", label: "Last 7 days" },
4875
+ { value: "30d", label: "Last 30 days" }
4876
+ ];
4877
+ function TimeRangeSelector({ value, onChange, width = 180 }) {
4878
+ return /* @__PURE__ */ jsx(
4879
+ CustomSelector,
4376
4880
  {
4377
- style: {
4378
- background: colors.tooltipBg,
4379
- border: `1px solid ${colors.tooltipBorder}`,
4380
- borderRadius: 8,
4381
- padding: "10px 14px",
4382
- backdropFilter: "var(--glass-blur)",
4383
- WebkitBackdropFilter: "var(--glass-blur)",
4384
- boxShadow: "var(--standard-box-shadow)",
4385
- fontFamily: "var(--mantine-font-family-monospace, monospace)",
4386
- minWidth: 160
4387
- },
4388
- children: [
4389
- /* @__PURE__ */ jsx(
4390
- "div",
4391
- {
4392
- style: {
4393
- fontSize: 11,
4394
- color: colors.tickText,
4395
- marginBottom: 8,
4396
- letterSpacing: "0.05em",
4397
- textTransform: "uppercase",
4398
- borderBottom: `1px solid ${colors.tooltipBorder}`,
4399
- paddingBottom: 6
4400
- },
4401
- children: displayLabel
4402
- }
4403
- ),
4404
- filtered.map((entry) => {
4405
- const color = entry.color || getSeriesColor(entry.dataKey, colors);
4406
- return /* @__PURE__ */ jsxs(
4407
- "div",
4408
- {
4409
- style: {
4410
- display: "flex",
4411
- justifyContent: "space-between",
4412
- alignItems: "center",
4413
- gap: 16,
4414
- padding: "3px 0",
4415
- fontSize: 12
4416
- },
4417
- children: [
4418
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
4419
- /* @__PURE__ */ jsx(
4420
- "div",
4421
- {
4422
- style: {
4423
- width: 8,
4424
- height: 8,
4425
- borderRadius: "50%",
4426
- backgroundColor: color,
4427
- boxShadow: `0 0 6px ${color}`
4428
- }
4429
- }
4430
- ),
4431
- /* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText }, children: entry.name ?? entry.dataKey })
4432
- ] }),
4433
- /* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children: entry.value != null && valueFormatter ? valueFormatter(entry.value) : String(entry.value) })
4434
- ]
4435
- },
4436
- entry.dataKey
4437
- );
4438
- })
4439
- ]
4881
+ value,
4882
+ onChange: (newValue) => newValue && onChange(newValue),
4883
+ data: TIME_RANGE_OPTIONS,
4884
+ leftSection: /* @__PURE__ */ jsx(IconClock, { size: 16, color: "var(--color-text-subtle)" }),
4885
+ w: width,
4886
+ withCheckIcon: true
4440
4887
  }
4441
4888
  );
4442
4889
  }
4443
- function CyberLegendItem({ color, label }) {
4444
- return /* @__PURE__ */ jsxs(Group, { gap: 8, children: [
4445
- /* @__PURE__ */ jsx(
4446
- "div",
4447
- {
4448
- style: {
4449
- width: 10,
4450
- height: 10,
4451
- borderRadius: "50%",
4452
- backgroundColor: color,
4453
- boxShadow: `0 0 8px ${color}, 0 0 16px ${color}40`
4890
+ function useStableAccessToken() {
4891
+ const { getAccessToken } = useAuthContext();
4892
+ const getAccessTokenRef = useRef(getAccessToken);
4893
+ getAccessTokenRef.current = getAccessToken;
4894
+ return useCallback(() => {
4895
+ return getAccessTokenRef.current();
4896
+ }, []);
4897
+ }
4898
+ function useSessionCheck() {
4899
+ const { user } = useAuthContext();
4900
+ const queryClient = useQueryClient();
4901
+ const organization = useContext(OrganizationContext);
4902
+ const currentWorkOSOrganizationId = organization?.currentWorkOSOrganizationId ?? null;
4903
+ const currentSupabaseOrganizationId = organization?.currentSupabaseOrganizationId ?? null;
4904
+ const isCheckingRef = useRef(false);
4905
+ const hadUserRef = useRef(false);
4906
+ if (user) {
4907
+ hadUserRef.current = true;
4908
+ }
4909
+ useEffect(() => {
4910
+ const handleVisibilityChange = async () => {
4911
+ if (isCheckingRef.current || document.visibilityState !== "visible") {
4912
+ return;
4913
+ }
4914
+ isCheckingRef.current = true;
4915
+ try {
4916
+ if (!user && hadUserRef.current) {
4917
+ window.location.replace("/login");
4918
+ return;
4919
+ }
4920
+ if (user) {
4921
+ await queryClient.cancelQueries();
4922
+ invalidateOrgScopedQueries(queryClient, [currentWorkOSOrganizationId, currentSupabaseOrganizationId]);
4454
4923
  }
4924
+ } finally {
4925
+ isCheckingRef.current = false;
4455
4926
  }
4456
- ),
4457
- /* @__PURE__ */ jsx(Text, { size: "xs", style: { color: "var(--color-text-subtle)", letterSpacing: "0.03em" }, children: label })
4458
- ] });
4927
+ };
4928
+ document.addEventListener("visibilitychange", handleVisibilityChange);
4929
+ window.addEventListener("focus", handleVisibilityChange);
4930
+ return () => {
4931
+ document.removeEventListener("visibilitychange", handleVisibilityChange);
4932
+ window.removeEventListener("focus", handleVisibilityChange);
4933
+ };
4934
+ }, [user, queryClient, currentWorkOSOrganizationId, currentSupabaseOrganizationId]);
4459
4935
  }
4460
- var COLOR_MAP = {
4461
- cyan: { gradient: "url(#gradCyan)", filter: "url(#glowCyan)", key: "cyan" },
4462
- blue: { gradient: "url(#gradBlue)", filter: "url(#glowBlue)", key: "blue" },
4463
- green: { gradient: "url(#gradGreen)", filter: "url(#glowGreen)", key: "green" },
4464
- red: { gradient: "url(#gradRed)", filter: "url(#glowRed)", key: "red" },
4465
- yellow: { gradient: "url(#gradYellow)", filter: "url(#glowYellow)", key: "yellow" }
4466
- };
4467
- function CyberAreaChart({
4468
- data,
4469
- series,
4470
- xDataKey = "time",
4471
- height = 300,
4472
- yAxisLabel,
4473
- yDomain,
4474
- yTickFormatter,
4475
- showGrid = true,
4476
- showZeroBaseline = true,
4477
- baselineColor,
4478
- lineOnly = false,
4479
- margin = { top: 8, right: 20, left: 0, bottom: 0 },
4480
- xTickFormatter,
4481
- tooltipFormatter
4936
+
4937
+ // src/auth/guards/computeProtectedRouteGate.ts
4938
+ var DEFAULT_WAIT_FOR_ORGANIZATION = true;
4939
+ function computeProtectedRouteGate({
4940
+ isInitializing,
4941
+ userReady,
4942
+ allReady,
4943
+ error,
4944
+ waitForOrganization
4482
4945
  }) {
4483
- const isLight = useComputedColorScheme("dark") === "light";
4484
- const colors = useCyberColors();
4485
- const [ready, setReady] = useState(false);
4486
- useEffect(() => {
4487
- const frame = requestAnimationFrame(() => setReady(true));
4488
- return () => cancelAnimationFrame(frame);
4489
- }, []);
4490
- const allZero = useMemo(() => {
4491
- if (!showZeroBaseline || !data.length) return false;
4492
- return data.every((row) => series.every((s) => row[s.dataKey] === 0));
4493
- }, [data, series, showZeroBaseline]);
4494
- if (!ready || !data.length) return /* @__PURE__ */ jsx(Box, { style: { height } });
4495
- const gridProps = {
4496
- stroke: colors.gridLine,
4497
- strokeDasharray: "3 6",
4498
- strokeOpacity: 1
4499
- };
4500
- const xAxisConfig = {
4501
- stroke: "none",
4502
- tick: {
4503
- fill: colors.tickText,
4504
- fontSize: 11,
4505
- fontFamily: "var(--mantine-font-family-monospace, monospace)"
4506
- },
4507
- tickLine: false,
4508
- axisLine: { stroke: colors.grid, strokeWidth: 1 }
4509
- };
4510
- const yTickStyle = {
4511
- fill: colors.tickText,
4512
- fontSize: 11,
4513
- fontFamily: "var(--mantine-font-family-monospace, monospace)"
4514
- };
4515
- return /* @__PURE__ */ jsx(Box, { style: { width: "100%", height }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(AreaChart, { data, margin, children: [
4516
- /* @__PURE__ */ jsx(CyberDefs, { colors, isLight }),
4517
- /* @__PURE__ */ jsx(PulseDefs, { series, colors, isLight }),
4518
- showGrid && /* @__PURE__ */ jsx(CartesianGrid, { ...gridProps }),
4519
- /* @__PURE__ */ jsx(XAxis, { dataKey: xDataKey, ...xAxisConfig, tickFormatter: xTickFormatter }),
4520
- /* @__PURE__ */ jsx(
4521
- YAxis,
4522
- {
4523
- domain: yDomain ?? [0, (max) => Math.max(max, 1)],
4524
- stroke: "none",
4525
- tick: yTickStyle,
4526
- tickFormatter: yTickFormatter,
4527
- tickLine: false,
4528
- axisLine: { stroke: colors.grid, strokeWidth: 1 },
4529
- label: yAxisLabel ? {
4530
- value: yAxisLabel,
4531
- angle: -90,
4532
- position: "insideLeft",
4533
- offset: 0,
4534
- style: { fill: colors.tickText, fontSize: 11 }
4535
- } : void 0
4536
- }
4537
- ),
4538
- /* @__PURE__ */ jsx(
4539
- Tooltip,
4540
- {
4541
- content: /* @__PURE__ */ jsx(CyberTooltipContent, { colors, labelFormatter: xTickFormatter, valueFormatter: tooltipFormatter }),
4542
- cursor: { stroke: colors.cyan, strokeOpacity: 0.2 }
4946
+ const unauthenticated = !isInitializing && !userReady && error?.layer !== "profile";
4947
+ const blockingError = !isInitializing && !!error && error.layer !== "organization";
4948
+ const waitingForOrg = !isInitializing && waitForOrganization && !allReady && error?.layer !== "organization";
4949
+ const showFallback = isInitializing || !blockingError && (unauthenticated || waitingForOrg);
4950
+ return { unauthenticated, blockingError, showFallback };
4951
+ }
4952
+ function ProtectedRoute({
4953
+ children,
4954
+ redirectTo = "/login",
4955
+ fallback = null,
4956
+ errorFallback,
4957
+ waitForOrganization = DEFAULT_WAIT_FOR_ORGANIZATION
4958
+ }) {
4959
+ const { userReady, allReady, isInitializing, error, retry } = useInitialization();
4960
+ const { signIn, canRecover } = useAuthContext();
4961
+ const navigate = useNavigate();
4962
+ const location = useLocation();
4963
+ const hasRedirected = useRef(false);
4964
+ const { unauthenticated, blockingError, showFallback } = computeProtectedRouteGate({
4965
+ isInitializing,
4966
+ userReady,
4967
+ allReady,
4968
+ error,
4969
+ waitForOrganization
4970
+ });
4971
+ useEffect(() => {
4972
+ if (unauthenticated && !hasRedirected.current) {
4973
+ hasRedirected.current = true;
4974
+ const searchStr = location.searchStr ?? "";
4975
+ const returnTo = location.pathname + searchStr;
4976
+ if (canRecover()) {
4977
+ signIn({ state: { returnTo: returnTo !== "/" ? returnTo : void 0 } });
4978
+ } else {
4979
+ navigate({
4980
+ to: redirectTo,
4981
+ search: returnTo !== "/" ? { returnTo } : {}
4982
+ });
4543
4983
  }
4544
- ),
4545
- allZero && (() => {
4546
- const bColor = colors[baselineColor ?? series[0]?.color ?? "cyan"];
4547
- const glow = isLight ? `drop-shadow(0 0 2px ${bColor})` : `drop-shadow(0 0 4px ${bColor}) drop-shadow(0 0 8px ${bColor})`;
4548
- return /* @__PURE__ */ jsx(ReferenceLine, { y: 0, stroke: bColor, strokeWidth: isLight ? 1.5 : 2, style: { filter: glow } });
4549
- })(),
4550
- series.map((s) => {
4551
- const cm = COLOR_MAP[s.color ?? "cyan"];
4552
- const strokeColor = colors[cm.key];
4553
- return /* @__PURE__ */ jsx(
4554
- Area,
4555
- {
4556
- type: "monotone",
4557
- dataKey: s.dataKey,
4558
- name: s.name ?? s.dataKey,
4559
- stroke: strokeColor,
4560
- strokeWidth: lineOnly ? 3 : 2,
4561
- fill: lineOnly ? "transparent" : cm.gradient,
4562
- filter: cm.filter,
4563
- dot: false,
4564
- activeDot: /* @__PURE__ */ jsx(CyberActiveDot, { color: strokeColor, dotStroke: colors.dotStroke }),
4565
- animationBegin: 100,
4566
- animationDuration: s.animationDuration ?? 1200,
4567
- animationEasing: "ease-out"
4568
- },
4569
- s.dataKey
4570
- );
4571
- }),
4572
- !isLight && series.map((s, i) => /* @__PURE__ */ jsx(
4573
- Area,
4574
- {
4575
- type: "monotone",
4576
- dataKey: s.dataKey,
4577
- name: `_pulse_${s.dataKey}`,
4578
- stroke: `url(#pulse-${i})`,
4579
- strokeWidth: 3,
4580
- fill: "none",
4581
- filter: "url(#pulseGlow)",
4582
- dot: false,
4583
- activeDot: false,
4584
- tooltipType: "none",
4585
- isAnimationActive: false,
4586
- style: { pointerEvents: "none" }
4587
- },
4588
- `pulse-${s.dataKey}`
4589
- ))
4590
- ] }) }) });
4984
+ }
4985
+ }, [unauthenticated, signIn, canRecover, navigate, redirectTo, location]);
4986
+ if (blockingError) {
4987
+ return errorFallback ? /* @__PURE__ */ jsx(Fragment, { children: errorFallback(error, retry) }) : null;
4988
+ }
4989
+ if (showFallback) {
4990
+ return /* @__PURE__ */ jsx(Fragment, { children: fallback });
4991
+ }
4992
+ return /* @__PURE__ */ jsx(Fragment, { children });
4591
4993
  }
4592
- function CyberDonutTooltip({
4593
- active,
4594
- payload,
4595
- colors
4994
+ function useOptionalNavigate() {
4995
+ try {
4996
+ return useNavigate();
4997
+ } catch {
4998
+ return null;
4999
+ }
5000
+ }
5001
+ function renderFallback(fallback, answer) {
5002
+ return typeof fallback === "function" ? fallback(answer) : fallback ?? null;
5003
+ }
5004
+ function AccessGuard({
5005
+ accessKey,
5006
+ children,
5007
+ fallback = null,
5008
+ loadingFallback = null,
5009
+ redirectTo = null
4596
5010
  }) {
4597
- if (!active || !payload?.length) return null;
4598
- const entry = payload[0];
4599
- if (!entry) return null;
4600
- const color = entry.payload?.color ?? colors.cyan;
4601
- return /* @__PURE__ */ jsxs(
4602
- "div",
5011
+ const answer = useAccess(accessKey);
5012
+ const navigate = useOptionalNavigate();
5013
+ const hasRedirected = useRef(false);
5014
+ useEffect(() => {
5015
+ if (!answer.isReady || answer.allowed || !redirectTo || hasRedirected.current) return;
5016
+ hasRedirected.current = true;
5017
+ if (navigate) {
5018
+ navigate({ to: redirectTo });
5019
+ return;
5020
+ }
5021
+ if (typeof window !== "undefined") {
5022
+ window.location.assign(redirectTo);
5023
+ }
5024
+ }, [answer.allowed, answer.isReady, navigate, redirectTo]);
5025
+ if (!answer.isReady) return /* @__PURE__ */ jsx(Fragment, { children: loadingFallback });
5026
+ if (!answer.allowed) return /* @__PURE__ */ jsx(Fragment, { children: renderFallback(fallback, answer) });
5027
+ return /* @__PURE__ */ jsx(Fragment, { children });
5028
+ }
5029
+ function PageNotFound() {
5030
+ const { currentPath, navigate } = useRouterContext();
5031
+ const { user, isLoading } = useAuthContext();
5032
+ const isAuthPage = currentPath === "/login" || currentPath === "/auth-redirect";
5033
+ const shouldShowSidebar = user && !isLoading && !isAuthPage;
5034
+ const height = shouldShowSidebar ? "100%" : "100vh";
5035
+ return /* @__PURE__ */ jsx(Center, { h: height, bg: "var(--color-background)", children: /* @__PURE__ */ jsxs(Stack, { align: "center", justify: "center", children: [
5036
+ /* @__PURE__ */ jsx(IconInfoCircle, { size: 60, color: "var(--color-text-subtle)" }),
5037
+ /* @__PURE__ */ jsx(Title, { order: 1, children: "Page Not Found" }),
5038
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "lg", children: "The page you are looking for does not exist." }),
5039
+ /* @__PURE__ */ jsx(Group, { justify: "center", children: /* @__PURE__ */ jsx(Button, { size: "md", onClick: () => navigate("/"), children: "Go Home" }) })
5040
+ ] }) });
5041
+ }
5042
+ function FeatureUnavailableState({ path }) {
5043
+ const { navigate } = useRouterContext();
5044
+ return /* @__PURE__ */ jsx(
5045
+ Center,
4603
5046
  {
4604
5047
  style: {
4605
- background: colors.tooltipBg,
4606
- border: `1px solid ${colors.tooltipBorder}`,
4607
- borderRadius: 8,
4608
- padding: "8px 12px",
4609
- backdropFilter: "var(--glass-blur)",
4610
- WebkitBackdropFilter: "var(--glass-blur)",
4611
- boxShadow: "var(--standard-box-shadow)",
4612
- fontFamily: "var(--mantine-font-family-monospace, monospace)",
4613
- display: "flex",
4614
- alignItems: "center",
4615
- gap: 10
5048
+ flex: 1,
5049
+ minHeight: "100%",
5050
+ width: "100%",
5051
+ padding: 24,
5052
+ background: "linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 72%, transparent), transparent)"
4616
5053
  },
4617
- children: [
4618
- /* @__PURE__ */ jsx(
4619
- "div",
4620
- {
4621
- style: {
4622
- width: 8,
4623
- height: 8,
4624
- borderRadius: "50%",
4625
- backgroundColor: color,
4626
- boxShadow: `0 0 6px ${color}`
4627
- }
4628
- }
4629
- ),
4630
- /* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText, fontSize: 12 }, children: entry.name }),
4631
- /* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontSize: 12, fontVariantNumeric: "tabular-nums" }, children: entry.value })
4632
- ]
4633
- }
4634
- );
4635
- }
4636
- function CyberDonut({
4637
- title,
4638
- segments,
4639
- centerValue,
4640
- centerLabel,
4641
- centerValueColor = "var(--mantine-color-text)",
4642
- glowId,
4643
- colors,
4644
- size = 120,
4645
- innerRadius = 36,
4646
- outerRadius = 52,
4647
- isLoading,
4648
- showLegend = true
4649
- }) {
4650
- const filtered = segments.filter((s) => s.value > 0);
4651
- const isEmpty = filtered.length === 0;
4652
- const pieData = isEmpty ? [{ name: "Empty", value: 1, color: "var(--color-border)" }] : filtered;
4653
- return /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
4654
- title && /* @__PURE__ */ jsx(
4655
- Text,
4656
- {
4657
- size: "xs",
4658
- fw: 600,
4659
- style: { color: "var(--color-text)", letterSpacing: "0.03em", textTransform: "uppercase" },
4660
- children: title
4661
- }
4662
- ),
4663
- /* @__PURE__ */ jsxs(Box, { style: { width: size, height: size, position: "relative" }, children: [
4664
- /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(PieChart, { children: [
4665
- !isEmpty && /* @__PURE__ */ jsx("defs", { children: filtered.map((_, i) => /* @__PURE__ */ jsxs("filter", { id: `${glowId}-${i}`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
4666
- /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
4667
- /* @__PURE__ */ jsxs("feMerge", { children: [
4668
- /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
4669
- /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
4670
- ] })
4671
- ] }, i)) }),
4672
- /* @__PURE__ */ jsx(
4673
- Pie,
4674
- {
4675
- data: pieData,
4676
- cx: "50%",
4677
- cy: "50%",
4678
- innerRadius,
4679
- outerRadius,
4680
- paddingAngle: isEmpty ? 0 : 3,
4681
- dataKey: "value",
4682
- stroke: "none",
4683
- animationBegin: 100,
4684
- animationDuration: 1e3,
4685
- animationEasing: "ease-out",
4686
- isAnimationActive: !isEmpty,
4687
- children: pieData.map((entry, i) => /* @__PURE__ */ jsx(
4688
- Cell,
4689
- {
4690
- fill: entry.color,
4691
- style: {
4692
- filter: isEmpty ? void 0 : `url(#${glowId}-${i})`,
4693
- fillOpacity: isEmpty ? 0.3 : 0.9
4694
- }
4695
- },
4696
- entry.name
4697
- ))
4698
- }
4699
- ),
4700
- !isEmpty && /* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CyberDonutTooltip, { colors }) })
4701
- ] }) }),
4702
- /* @__PURE__ */ jsxs(
4703
- "div",
5054
+ children: /* @__PURE__ */ jsxs(
5055
+ Stack,
4704
5056
  {
5057
+ align: "center",
5058
+ gap: "md",
4705
5059
  style: {
4706
- position: "absolute",
4707
- top: "50%",
4708
- left: "50%",
4709
- transform: "translate(-50%, -50%)",
4710
- textAlign: "center",
4711
- pointerEvents: "none"
5060
+ maxWidth: 560,
5061
+ padding: "32px 28px",
5062
+ borderRadius: 24,
5063
+ border: "1px solid var(--color-border)",
5064
+ background: "color-mix(in srgb, var(--glass-background) 86%, transparent)",
5065
+ boxShadow: "var(--card-shadow)",
5066
+ backdropFilter: "var(--glass-blur)",
5067
+ textAlign: "center"
4712
5068
  },
4713
5069
  children: [
4714
- /* @__PURE__ */ jsx(
4715
- "div",
4716
- {
4717
- style: {
4718
- fontSize: 18,
4719
- fontWeight: 700,
4720
- fontFamily: "var(--mantine-font-family-monospace, monospace)",
4721
- color: centerValueColor,
4722
- lineHeight: 1
4723
- },
4724
- children: isLoading ? "-" : centerValue
4725
- }
4726
- ),
4727
- /* @__PURE__ */ jsx(
4728
- "div",
4729
- {
4730
- style: {
4731
- fontSize: 8,
4732
- color: "var(--mantine-color-dimmed)",
4733
- letterSpacing: "0.05em",
4734
- textTransform: "uppercase",
4735
- marginTop: 2
4736
- },
4737
- children: centerLabel
4738
- }
4739
- )
5070
+ /* @__PURE__ */ jsx(IconBan, { size: 44, stroke: 1.8, color: "var(--color-text-subtle)" }),
5071
+ /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
5072
+ /* @__PURE__ */ jsx(Title, { order: 2, children: "This section is unavailable" }),
5073
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", maw: 420, children: path ? `The requested route ${path} is currently disabled in this workspace.` : "The requested subsection is currently disabled in this workspace." })
5074
+ ] }),
5075
+ /* @__PURE__ */ jsx(Group, { gap: "sm", justify: "center", children: /* @__PURE__ */ jsx(Button, { onClick: () => navigate("/"), children: "Go home" }) })
4740
5076
  ]
4741
5077
  }
4742
5078
  )
4743
- ] }),
4744
- showLegend && /* @__PURE__ */ jsx(Stack, { gap: 4, style: { width: "100%" }, children: segments.map((seg) => /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", px: "xs", children: [
4745
- /* @__PURE__ */ jsx(CyberLegendItem, { color: seg.color, label: seg.name }),
4746
- /* @__PURE__ */ jsx(
4747
- Text,
4748
- {
4749
- size: "xs",
4750
- fw: 600,
4751
- style: {
4752
- fontFamily: "var(--mantine-font-family-monospace, monospace)",
4753
- fontVariantNumeric: "tabular-nums"
4754
- },
4755
- children: isLoading ? "-" : seg.value
4756
- }
4757
- )
4758
- ] }, seg.name)) })
4759
- ] });
4760
- }
4761
- function EmptyState({ icon: Icon, title, description, action, py = "xl" }) {
4762
- return /* @__PURE__ */ jsx(Center, { py, children: /* @__PURE__ */ jsxs(Stack, { align: "center", gap: "xs", children: [
4763
- /* @__PURE__ */ jsx(Icon, { size: 48, style: { opacity: 0.5 } }),
4764
- /* @__PURE__ */ jsx(Title, { order: 4, children: title }),
4765
- description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ta: "center", children: description }),
4766
- action && /* @__PURE__ */ jsx(Button, { variant: "light", onClick: action.onClick, leftSection: action.icon, mt: "sm", children: action.label })
4767
- ] }) });
4768
- }
4769
- function TabCountBadge({ count, isLoading }) {
4770
- return /* @__PURE__ */ jsx(Box, { miw: 20, h: 20, style: { display: "flex", alignItems: "center", justifyContent: "center" }, children: isLoading ? /* @__PURE__ */ jsx(Loader, { size: 12 }) : /* @__PURE__ */ jsx(Badge, { size: "sm", variant: "light", circle: count < 10, children: count }) });
5079
+ }
5080
+ );
4771
5081
  }
4772
- function TrendIndicator({ current, previous, inverse }) {
4773
- const change = previous === 0 ? 0 : (current - previous) / previous * 100;
4774
- const isPositive = inverse ? change < 0 : change > 0;
4775
- const isFlat = Math.abs(change) < 0.1;
4776
- const color = isFlat ? "gray" : isPositive ? "green" : "red";
4777
- const Icon = isFlat ? IconMinus : change > 0 ? IconTrendingUp : IconTrendingDown;
4778
- return /* @__PURE__ */ jsxs(Group, { gap: 4, children: [
4779
- /* @__PURE__ */ jsx(Icon, { size: 12 }),
4780
- /* @__PURE__ */ jsx(Badge, { size: "sm", color, variant: "light", children: isFlat ? "No change" : `${isPositive ? "+" : ""}${Math.abs(change).toFixed(1)}%` })
4781
- ] });
5082
+ function resolveSystemPath(accessKey) {
5083
+ try {
5084
+ return normalizeAccessKey(accessKey).systemPath;
5085
+ } catch {
5086
+ return typeof accessKey === "string" ? accessKey : accessKey.systemPath;
5087
+ }
4782
5088
  }
4783
- function CollapsibleSection({
5089
+ function UnavailableCard({
5090
+ icon,
4784
5091
  title,
4785
- count,
4786
- countLabel,
4787
- children,
4788
- emptyMessage,
4789
- defaultExpanded = true,
4790
- maxHeight = 300
5092
+ description,
5093
+ devHint
4791
5094
  }) {
4792
- const [expanded, setExpanded] = useState(defaultExpanded);
4793
- const isEmpty = count === 0;
4794
- return /* @__PURE__ */ jsxs(
4795
- "div",
5095
+ return /* @__PURE__ */ jsx(
5096
+ Center,
4796
5097
  {
4797
5098
  style: {
4798
- borderRadius: "8px",
4799
- padding: "8px",
4800
- border: "1px solid var(--color-border)",
4801
- boxShadow: "var(--standard-box-shadow)"
5099
+ flex: 1,
5100
+ minHeight: "100%",
5101
+ width: "100%",
5102
+ padding: 24,
5103
+ background: "linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 72%, transparent), transparent)"
4802
5104
  },
4803
- children: [
4804
- /* @__PURE__ */ jsxs(
4805
- Group,
4806
- {
4807
- gap: "xs",
4808
- mb: expanded ? "xs" : 0,
4809
- justify: "space-between",
4810
- align: "center",
4811
- style: { cursor: "pointer" },
4812
- onClick: () => setExpanded(!expanded),
4813
- children: [
4814
- /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", style: { flex: 1 }, children: [
4815
- typeof title === "string" ? /* @__PURE__ */ jsx(
4816
- Text,
4817
- {
4818
- fw: 600,
4819
- size: "sm",
4820
- c: "var(--color-text)",
4821
- style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
4822
- children: title
4823
- }
4824
- ) : title,
4825
- count !== void 0 && countLabel && /* @__PURE__ */ jsxs(Badge, { size: "sm", variant: "light", color: "gray", children: [
4826
- count,
4827
- " ",
4828
- count === 1 ? countLabel.replace(/s$/, "") : countLabel
4829
- ] })
4830
- ] }),
4831
- expanded ? /* @__PURE__ */ jsx(IconChevronUp, { size: 16 }) : /* @__PURE__ */ jsx(IconChevronDown, { size: 16 })
4832
- ]
4833
- }
4834
- ),
4835
- /* @__PURE__ */ jsx(Collapse, { in: expanded, children: isEmpty && emptyMessage ? /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: emptyMessage }) : /* @__PURE__ */ jsx(ScrollArea, { h: maxHeight, type: "scroll", offsetScrollbars: true, children }) })
4836
- ]
5105
+ children: /* @__PURE__ */ jsxs(
5106
+ Stack,
5107
+ {
5108
+ align: "center",
5109
+ gap: "md",
5110
+ style: {
5111
+ maxWidth: 560,
5112
+ padding: "32px 28px",
5113
+ borderRadius: 24,
5114
+ border: "1px solid var(--color-border)",
5115
+ background: "color-mix(in srgb, var(--glass-background) 86%, transparent)",
5116
+ boxShadow: "var(--card-shadow)",
5117
+ backdropFilter: "var(--glass-blur)",
5118
+ textAlign: "center"
5119
+ },
5120
+ children: [
5121
+ icon,
5122
+ /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
5123
+ /* @__PURE__ */ jsx(Title, { order: 2, children: title }),
5124
+ /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", maw: 420, children: description }),
5125
+ devHint ? /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", maw: 420, children: devHint }) : null
5126
+ ] })
5127
+ ]
5128
+ }
5129
+ )
4837
5130
  }
4838
5131
  );
4839
5132
  }
4840
- var PageTitleCaption = ({ title, caption, rightSection }) => {
4841
- const renderCaption = () => {
4842
- if (!caption) return null;
4843
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Text, { style: { fontFamily: "var(--elevasis-font-family-subtitle)", color: "var(--color-text-dimmed)" }, children: caption }) });
4844
- };
4845
- const titleContent = /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [
4846
- /* @__PURE__ */ jsx(Title, { order: 1, children: title }),
4847
- /* @__PURE__ */ jsx(Space, { h: "4" }),
4848
- renderCaption()
4849
- ] });
4850
- if (!rightSection) {
4851
- return titleContent;
5133
+ function SystemUnavailableState({ accessKey, reason }) {
5134
+ const systems = useOptionalElevasisSystems();
5135
+ const systemPath2 = resolveSystemPath(accessKey);
5136
+ if (reason === "unknown-access-key") {
5137
+ const isDev = import.meta.env?.DEV ?? false;
5138
+ return /* @__PURE__ */ jsx(
5139
+ UnavailableCard,
5140
+ {
5141
+ icon: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 44, stroke: 1.8, color: "var(--color-warning)" }),
5142
+ title: "System not declared",
5143
+ description: `"${systemPath2}" is not declared in this organization's model, so this route cannot resolve.`,
5144
+ devHint: isDev ? "Dev: declare this System in core/config/organization-model/systems.ts." : null
5145
+ }
5146
+ );
4852
5147
  }
4853
- return /* @__PURE__ */ jsxs(Group, { justify: "space-between", align: "end", children: [
4854
- titleContent,
4855
- rightSection
4856
- ] });
4857
- };
4858
- function StatsCardSkeleton({ chartHeight = 200 }) {
4859
- return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: chartHeight, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
4860
- }
4861
- function ListSkeleton({ rows = 3, rowHeight = 50 }) {
4862
- return /* @__PURE__ */ jsx(Stack, { children: /* @__PURE__ */ jsx(Center, { mih: rows * rowHeight, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
4863
- }
4864
- function DetailCardSkeleton({ rows = 3 }) {
4865
- return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: rows * 60 + 100, children: /* @__PURE__ */ jsx(Loader, { size: "md" }) }) });
5148
+ if (reason === "system-not-active") {
5149
+ const system = systems?.organizationModel ? getSystem(systems.organizationModel, systemPath2) : void 0;
5150
+ const lifecycle = system?.lifecycle ?? "inactive";
5151
+ return /* @__PURE__ */ jsx(
5152
+ UnavailableCard,
5153
+ {
5154
+ icon: /* @__PURE__ */ jsx(IconBan, { size: 44, stroke: 1.8, color: "var(--color-text-subtle)" }),
5155
+ title: "System unavailable",
5156
+ description: `${system?.label ?? systemPath2} (${systemPath2}) is currently "${lifecycle}" and not reachable in this workspace.`
5157
+ }
5158
+ );
5159
+ }
5160
+ return /* @__PURE__ */ jsx(NoAccessState, {});
4866
5161
  }
4867
- var NavigationButton = ({
4868
- icon: Icon,
4869
- label,
4870
- isCollapsed = false,
4871
- hasSubItems = false,
4872
- isExpanded = false,
4873
- isActive = false,
4874
- hasActiveBackground = false,
5162
+ function ResourceCard({
5163
+ resource,
4875
5164
  onClick,
5165
+ layout = "stack",
5166
+ rightSection,
5167
+ topSection,
5168
+ lastRunLabel,
4876
5169
  style,
4877
- transitionDuration = 200
4878
- }) => {
4879
- const activeColor = "var(--color-primary)";
4880
- const textColor = isActive ? activeColor : "var(--color-text)";
4881
- const bgColor = hasActiveBackground ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent";
4882
- return /* @__PURE__ */ jsx(
4883
- UnstyledButton,
4884
- {
4885
- onClick: (event) => {
4886
- event.preventDefault();
4887
- event.stopPropagation();
4888
- onClick?.();
4889
- },
4890
- style: {
4891
- height: sidebarItemHeight,
4892
- display: "flex",
4893
- alignItems: "center",
4894
- width: "100%",
4895
- padding: sidebarItemPadding,
4896
- color: textColor,
4897
- backgroundColor: bgColor,
4898
- transition: `all ${transitionDuration}ms var(--easing)`,
4899
- cursor: "pointer",
4900
- overflow: "hidden",
4901
- borderRadius: "var(--mantine-radius-default)",
4902
- ...style
4903
- },
4904
- onMouseEnter: (e) => {
4905
- if (!hasActiveBackground) {
4906
- e.currentTarget.style.backgroundColor = "var(--color-surface-hover)";
4907
- }
4908
- },
4909
- onMouseLeave: (e) => {
4910
- if (!hasActiveBackground) {
4911
- e.currentTarget.style.backgroundColor = "transparent";
4912
- }
4913
- },
4914
- children: /* @__PURE__ */ jsxs(Group, { justify: "space-between", gap: 0, style: { width: "100%", overflow: "hidden" }, children: [
4915
- /* @__PURE__ */ jsxs(
4916
- Box,
5170
+ ...rest
5171
+ }) {
5172
+ const Icon = getResourceIcon(resource.type);
5173
+ if (!Icon) {
5174
+ return /* @__PURE__ */ jsx(Card, { shadow: "sm", withBorder: true, children: /* @__PURE__ */ jsxs(Text, { children: [
5175
+ "Invalid resource type: ",
5176
+ resource.type
5177
+ ] }) });
5178
+ }
5179
+ const cardStyle = {
5180
+ cursor: "pointer",
5181
+ ...layout === "grid" || layout === "card" ? { transition: "box-shadow var(--duration-fast) var(--easing)" } : {},
5182
+ ...style
5183
+ };
5184
+ const iconSize = layout === "grid" ? 28 : 20;
5185
+ const details = /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", children: [
5186
+ /* @__PURE__ */ jsx(Icon, { size: iconSize, color: "var(--color-primary)" }),
5187
+ /* @__PURE__ */ jsxs(Stack, { gap: 4, style: { flex: 1, minWidth: 0 }, children: [
5188
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", children: [
5189
+ /* @__PURE__ */ jsx(
5190
+ Text,
5191
+ {
5192
+ fw: 600,
5193
+ size: "sm",
5194
+ style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
5195
+ ...layout === "stack" ? { lineClamp: 1 } : { truncate: true },
5196
+ children: resource.name
5197
+ }
5198
+ ),
5199
+ /* @__PURE__ */ jsx(Badge, { variant: "light", size: layout === "grid" ? "xs" : "sm", children: resource.type })
5200
+ ] }),
5201
+ resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ...layout === "stack" ? { lineClamp: 1 } : { truncate: true }, children: resource.description }),
5202
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
5203
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "outline", size: "xs", children: [
5204
+ "v",
5205
+ resource.version
5206
+ ] }),
5207
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "outline", size: layout === "grid" ? "xs" : "sm", children: resource.status.toUpperCase() })
5208
+ ] }),
5209
+ lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: lastRunLabel }),
5210
+ /* @__PURE__ */ jsx(Text, { size: layout === "grid" ? "sm" : "xs", c: "dimmed", ff: "monospace", children: resource.resourceId })
5211
+ ] })
5212
+ ] });
5213
+ if (layout === "card") {
5214
+ return /* @__PURE__ */ jsx(
5215
+ Card,
5216
+ {
5217
+ withBorder: true,
5218
+ padding: 0,
5219
+ style: cardStyle,
5220
+ onClick: () => onClick(resource),
5221
+ "data-resource-id": rest["data-resource-id"],
5222
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 8, p: "sm", pb: "xs", children: [
5223
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", justify: "space-between", children: [
5224
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", style: { minWidth: 0 }, children: [
5225
+ /* @__PURE__ */ jsx(Icon, { size: 20, color: "var(--color-primary)", style: { flexShrink: 0 } }),
5226
+ /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, truncate: true, children: resource.name })
5227
+ ] }),
5228
+ /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", style: { flexShrink: 0 }, children: [
5229
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
5230
+ "v",
5231
+ resource.version
5232
+ ] }),
5233
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
5234
+ ] })
5235
+ ] }),
5236
+ resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, children: resource.description }),
5237
+ /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", wrap: "nowrap", children: [
5238
+ rightSection || /* @__PURE__ */ jsx("span", {}),
5239
+ lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: lastRunLabel })
5240
+ ] }),
5241
+ topSection
5242
+ ] })
5243
+ }
5244
+ );
5245
+ }
5246
+ if (layout === "row") {
5247
+ const [hovered, setHovered] = useState(false);
5248
+ return /* @__PURE__ */ jsx(
5249
+ Card,
5250
+ {
5251
+ padding: 0,
5252
+ style: {
5253
+ cursor: "pointer",
5254
+ border: "1px solid var(--color-border)",
5255
+ transition: "background 150ms ease",
5256
+ background: hovered ? "var(--active-background)" : "var(--color-surface)",
5257
+ ...style
5258
+ },
5259
+ onClick: () => onClick(resource),
5260
+ onMouseEnter: () => setHovered(true),
5261
+ onMouseLeave: () => setHovered(false),
5262
+ "data-resource-id": rest["data-resource-id"],
5263
+ children: /* @__PURE__ */ jsxs(
5264
+ "div",
4917
5265
  {
4918
5266
  style: {
4919
- display: "flex",
5267
+ display: "grid",
5268
+ gridTemplateColumns: "18px 200px 120px 1fr 180px 200px 14px",
4920
5269
  alignItems: "center",
4921
- flex: hasSubItems && !isCollapsed ? 1 : "initial",
4922
- minWidth: 0,
4923
- overflow: "hidden"
5270
+ gap: "var(--mantine-spacing-sm)"
4924
5271
  },
4925
5272
  children: [
5273
+ /* @__PURE__ */ jsx(Icon, { size: 18, color: "var(--color-primary)" }),
5274
+ /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", truncate: true, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: resource.name }),
5275
+ /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", children: [
5276
+ resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
5277
+ "v",
5278
+ resource.version
5279
+ ] }),
5280
+ /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
5281
+ ] }),
5282
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, style: { minWidth: 0 }, children: resource.description || "" }),
5283
+ /* @__PURE__ */ jsx("div", { style: { whiteSpace: "nowrap" }, children: rightSection }),
5284
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap", textAlign: "right" }, children: lastRunLabel || "" }),
4926
5285
  /* @__PURE__ */ jsx(
4927
- ThemeIcon,
4928
- {
4929
- variant: "light",
4930
- size: sidebarIconSize,
4931
- style: {
4932
- backgroundColor: isActive ? activeColor : "var(--color-surface)",
4933
- color: isActive ? "white" : activeColor,
4934
- marginRight: isCollapsed ? 0 : "var(--mantine-spacing-sm)",
4935
- transition: `margin ${transitionDuration}ms var(--easing)`,
4936
- flexShrink: 0
4937
- },
4938
- children: /* @__PURE__ */ jsx(Icon, { size: sidebarIconInnerSize, stroke: sidebarIconStroke })
4939
- }
4940
- ),
4941
- !isCollapsed && /* @__PURE__ */ jsx(
4942
- Box,
5286
+ IconChevronRight,
4943
5287
  {
5288
+ size: 14,
4944
5289
  style: {
4945
- fontFamily: "var(--elevasis-font-family-subtitle)",
4946
- fontSize: "var(--mantine-font-size-md)",
4947
- fontWeight: isActive ? 600 : 500,
4948
- color: textColor,
4949
- transition: `opacity ${transitionDuration}ms var(--easing)`,
4950
- whiteSpace: "nowrap",
4951
- overflow: "hidden",
4952
- textOverflow: "ellipsis"
4953
- },
4954
- children: label
5290
+ opacity: hovered ? 0.7 : 0,
5291
+ transition: "opacity 150ms ease"
5292
+ }
4955
5293
  }
4956
5294
  )
4957
5295
  ]
4958
5296
  }
4959
- ),
4960
- hasSubItems && !isCollapsed && /* @__PURE__ */ jsx(
4961
- IconChevronRight,
4962
- {
4963
- size: 14,
4964
- stroke: 1.5,
4965
- style: {
4966
- transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)",
4967
- transition: `transform var(--duration-fast) var(--easing)`,
4968
- color: "var(--color-text-subtle)",
4969
- flexShrink: 0,
4970
- marginLeft: "auto"
4971
- }
4972
- }
4973
5297
  )
4974
- ] })
4975
- }
4976
- );
4977
- };
4978
- function CustomSelector({
4979
- value,
4980
- onChange,
4981
- data,
4982
- leftSection,
4983
- placeholder,
4984
- w,
4985
- withCheckIcon = false,
4986
- disabled
4987
- }) {
4988
- return /* @__PURE__ */ jsx(
4989
- Select,
4990
- {
4991
- value,
4992
- onChange,
4993
- data,
4994
- leftSection,
4995
- placeholder,
4996
- w,
4997
- size: "xs",
4998
- variant: "unstyled",
4999
- withCheckIcon,
5000
- disabled,
5001
- styles: {
5002
- wrapper: {
5003
- border: "1px solid var(--color-border)",
5004
- borderRadius: "var(--mantine-radius-default)",
5005
- backgroundColor: "var(--color-surface)",
5006
- transition: "border-color 150ms ease, background-color 150ms ease",
5007
- "&:hover": {
5008
- borderColor: "var(--color-border-hover, var(--mantine-color-dark-3))"
5009
- }
5010
- },
5011
- input: {
5012
- fontSize: "var(--mantine-font-size-xs)",
5013
- fontWeight: 500,
5014
- height: "30px",
5015
- minHeight: "30px",
5016
- paddingLeft: leftSection ? "30px" : void 0,
5017
- borderRadius: "var(--mantine-radius-default)",
5018
- cursor: "pointer"
5019
- },
5020
- section: {
5021
- color: "var(--color-text-subtle)"
5022
- },
5023
- dropdown: {
5024
- border: "1px solid var(--color-border)",
5025
- backgroundColor: "var(--color-surface)",
5026
- boxShadow: "var(--card-shadow)"
5027
- },
5028
- option: {
5029
- fontSize: "var(--mantine-font-size-xs)"
5030
- }
5031
5298
  }
5032
- }
5033
- );
5034
- }
5035
- function APIErrorAlert({
5036
- error,
5037
- title,
5038
- showRequestId = true,
5039
- icon = /* @__PURE__ */ jsx(IconAlertCircle, {}),
5040
- color = "red"
5041
- }) {
5042
- const { message, code, requestId, retryAfter } = getErrorInfo(error);
5043
- const alertTitle = title || getErrorTitle(code);
5044
- return /* @__PURE__ */ jsxs(Alert, { icon, title: alertTitle, color, variant: "light", children: [
5045
- /* @__PURE__ */ jsx(Text, { size: "sm", children: message }),
5046
- retryAfter && /* @__PURE__ */ jsxs(Text, { size: "sm", mt: "xs", children: [
5047
- "Please wait ",
5048
- retryAfter,
5049
- " seconds before retrying."
5050
- ] }),
5051
- showRequestId && requestId && /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", mt: "xs", children: [
5052
- "Request ID: ",
5053
- /* @__PURE__ */ jsx(Code, { children: requestId })
5054
- ] })
5055
- ] });
5056
- }
5057
- async function hashOrganizationModel(model) {
5058
- if (typeof globalThis.crypto?.subtle?.digest !== "function") return null;
5059
- const parsed = OrganizationModelSchema.safeParse(model);
5060
- if (!parsed.success) return null;
5061
- const bytes = new TextEncoder().encode(canonicalStringifyOrganizationModel(parsed.data));
5062
- const digest = await globalThis.crypto.subtle.digest("SHA-256", bytes);
5063
- return Array.from(new Uint8Array(digest)).map((b) => b.toString(16).padStart(2, "0")).join("");
5064
- }
5065
- function useOrganizationModelDrift(organizationModel) {
5066
- const { apiRequest, isReady } = useElevasisServices();
5067
- const [buildTimeHash, setBuildTimeHash] = useState(null);
5068
- useEffect(() => {
5069
- let cancelled = false;
5070
- void hashOrganizationModel(organizationModel).then((hash) => {
5071
- if (!cancelled) setBuildTimeHash(hash);
5072
- });
5073
- return () => {
5074
- cancelled = true;
5075
- };
5076
- }, [organizationModel]);
5077
- const { data, isLoading } = useQuery({
5078
- queryKey: ["organization-model-snapshot"],
5079
- queryFn: () => apiRequest("/organization-model/snapshot"),
5080
- enabled: isReady,
5081
- staleTime: STALE_TIME_MONITORING,
5082
- gcTime: GC_TIME_SHORT,
5083
- refetchOnWindowFocus: false,
5084
- // An org with no active deployment 503s here. That is a real condition with
5085
- // its own surfaces; retrying it on every mount would only add noise.
5086
- retry: false
5087
- });
5088
- const deployedHash = data?.snapshotHash ?? null;
5089
- return {
5090
- hasDrifted: Boolean(buildTimeHash && deployedHash && buildTimeHash !== deployedHash),
5091
- buildTimeHash,
5092
- deployedHash,
5093
- activeDeploymentId: data?.activeDeploymentId ?? null,
5094
- isLoading: isLoading || buildTimeHash === null
5095
- };
5096
- }
5097
- function OrganizationModelDriftActionIcon({
5098
- organizationModel,
5099
- message
5100
- }) {
5101
- const { hasDrifted, buildTimeHash, deployedHash } = useOrganizationModelDrift(organizationModel);
5102
- const [opened, { toggle, close }] = useDisclosure(false);
5103
- if (!hasDrifted) return null;
5104
- const label = "Organization model out of date";
5105
- return /* @__PURE__ */ jsxs(Popover, { opened, onChange: close, onDismiss: close, width: 340, position: "bottom-end", withArrow: true, shadow: "md", children: [
5106
- /* @__PURE__ */ jsx(Popover.Target, { children: /* @__PURE__ */ jsx(Tooltip$1, { label, disabled: opened, children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", size: "lg", onClick: toggle, "aria-label": label, children: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 20, color: "var(--color-warning)" }) }) }) }),
5107
- /* @__PURE__ */ jsx(Popover.Dropdown, { children: /* @__PURE__ */ jsxs(Stack, { gap: "xs", children: [
5108
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, children: label }),
5109
- /* @__PURE__ */ jsx(Text, { size: "sm", children: message ?? "This app was built against an older organization model than the one currently deployed. Navigation, knowledge, and systems pages may not match what the platform is running. Redeploy the app to catch up." }),
5110
- /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
5111
- "built ",
5112
- /* @__PURE__ */ jsx(Code, { children: buildTimeHash?.slice(0, 12) }),
5113
- " \xB7 deployed ",
5114
- /* @__PURE__ */ jsx(Code, { children: deployedHash?.slice(0, 12) })
5115
- ] })
5116
- ] }) })
5117
- ] });
5118
- }
5119
- function CenteredErrorState({ error, title, h = 300, py }) {
5120
- return /* @__PURE__ */ jsx(Center, { h, py, children: /* @__PURE__ */ jsx(APIErrorAlert, { error, title }) });
5121
- }
5122
-
5123
- // src/components/display/StatCard.module.css.js
5124
- var StatCard_module_css_default = { "heroCard": "heroCard", "iconRing": "iconRing", "iconRingSm": "iconRingSm", "heroValue": "heroValue", "heroValueSm": "heroValueSm", "heroLabel": "heroLabel", "heroLabelSm": "heroLabelSm" };
5125
- function StatCard(props) {
5126
- if (props.variant === "hero") {
5127
- return /* @__PURE__ */ jsx(HeroStatCard, { ...props });
5299
+ );
5128
5300
  }
5129
- const { label, value, icon: IconComponent, color } = props;
5130
- return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
5131
- /* @__PURE__ */ jsx(ThemeIcon, { size: "lg", variant: "light", color, children: /* @__PURE__ */ jsx(IconComponent, { size: 18 }) }),
5132
- /* @__PURE__ */ jsxs("div", { children: [
5133
- /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: label }),
5134
- /* @__PURE__ */ jsx(Text, { size: "lg", fw: 600, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: value })
5135
- ] })
5136
- ] }) });
5137
- }
5138
- function HeroStatCard({
5139
- icon: IconComponent,
5140
- value,
5141
- label,
5142
- valueColor,
5143
- isLoading,
5144
- size = "sm",
5145
- children
5146
- }) {
5147
- const sm = size === "sm";
5148
- const iconSize = sm ? 36 : 46;
5149
- if (isLoading) {
5150
- return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_module_css_default.heroCard, children: /* @__PURE__ */ jsx(Center, { mih: iconSize + 16, children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) }) });
5301
+ if (layout === "grid") {
5302
+ return /* @__PURE__ */ jsx(
5303
+ Card,
5304
+ {
5305
+ withBorder: true,
5306
+ padding: "sm",
5307
+ style: cardStyle,
5308
+ onClick: () => onClick(resource),
5309
+ "data-resource-id": rest["data-resource-id"],
5310
+ children: /* @__PURE__ */ jsxs(Grid, { gutter: "sm", align: "center", children: [
5311
+ /* @__PURE__ */ jsx(Grid.Col, { span: 8, children: details }),
5312
+ rightSection && /* @__PURE__ */ jsx(Grid.Col, { span: 4, children: /* @__PURE__ */ jsx(Group, { justify: "flex-end", gap: "md", wrap: "nowrap", children: rightSection }) })
5313
+ ] })
5314
+ }
5315
+ );
5151
5316
  }
5152
- return /* @__PURE__ */ jsx(Paper, { p: sm ? "md" : "lg", className: StatCard_module_css_default.heroCard, children: /* @__PURE__ */ jsxs(Group, { gap: sm ? "sm" : "md", wrap: "nowrap", children: [
5153
- /* @__PURE__ */ jsx("div", { className: sm ? StatCard_module_css_default.iconRingSm : StatCard_module_css_default.iconRing, children: /* @__PURE__ */ jsx(IconComponent, { size: sm ? 18 : 22 }) }),
5154
- /* @__PURE__ */ jsxs(Stack, { gap: 2, style: { flex: children ? 1 : void 0 }, children: [
5155
- /* @__PURE__ */ jsx(
5156
- "span",
5157
- {
5158
- className: sm ? StatCard_module_css_default.heroValueSm : StatCard_module_css_default.heroValue,
5159
- style: valueColor ? { color: valueColor } : void 0,
5160
- children: value
5161
- }
5162
- ),
5163
- children ? /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", style: { flex: 1 }, children: [
5164
- /* @__PURE__ */ jsx("span", { className: sm ? StatCard_module_css_default.heroLabelSm : StatCard_module_css_default.heroLabel, children: label }),
5165
- /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children })
5166
- ] }) : /* @__PURE__ */ jsx("span", { className: sm ? StatCard_module_css_default.heroLabelSm : StatCard_module_css_default.heroLabel, children: label })
5167
- ] })
5168
- ] }) });
5169
- }
5170
- function StatCardSkeleton() {
5171
- return /* @__PURE__ */ jsx(Card, { withBorder: true, children: /* @__PURE__ */ jsx(Center, { mih: 60, children: /* @__PURE__ */ jsx(Loader, { size: "sm" }) }) });
5172
- }
5173
- var jsonTheme = Object.fromEntries(
5174
- Object.entries(oneDark).map(([key, value]) => [
5175
- key,
5176
- typeof value === "object" && value !== null ? { ...value, background: "none", backgroundColor: "none" } : value
5177
- ])
5178
- );
5179
- function JsonViewer({ data, maxHeight, fontSize = "0.8rem" }) {
5180
- const jsonString = typeof data === "string" ? data : JSON.stringify(data, null, 2);
5181
5317
  return /* @__PURE__ */ jsx(
5182
- Prism,
5318
+ Card,
5183
5319
  {
5184
- language: "json",
5185
- style: jsonTheme,
5186
- customStyle: {
5187
- margin: 0,
5188
- fontSize,
5189
- maxHeight,
5190
- overflow: maxHeight ? "auto" : void 0,
5191
- overflowX: "auto"
5192
- },
5193
- children: jsonString
5320
+ shadow: "sm",
5321
+ withBorder: true,
5322
+ style: cardStyle,
5323
+ onClick: () => onClick(resource),
5324
+ "data-resource-id": rest["data-resource-id"],
5325
+ children: /* @__PURE__ */ jsx(Stack, { children: details })
5194
5326
  }
5195
5327
  );
5196
5328
  }
5197
- var subtleMarkdownComponents = {
5198
- p: ({ children }) => /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children })
5199
- };
5200
- var subtleMarkdownWrapperStyle = {
5201
- display: "flex",
5202
- flexDirection: "column",
5203
- gap: 8
5329
+
5330
+ // src/components/display/ElevasisLoader.module.css.js
5331
+ var ElevasisLoader_module_css_default = { "wrapper": "wrapper", "loader": "loader", "chevron": "chevron", "c1": "c1", "c2": "c2", "c3": "c3" };
5332
+ var ElevasisLoader = forwardRef(({ style, className, ...others }, ref) => /* @__PURE__ */ jsx("div", { ref, style, className: `${ElevasisLoader_module_css_default.wrapper} ${className ?? ""}`, ...others, children: /* @__PURE__ */ jsxs("svg", { className: ElevasisLoader_module_css_default.loader, viewBox: "-10 -5 60 50", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
5333
+ /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c1}`, points: "5,36 20,25 35,36" }),
5334
+ /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c2}`, points: "9,23 20,14 31,23" }),
5335
+ /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c3}`, points: "13,11 20,5 27,11" })
5336
+ ] }) }));
5337
+ ElevasisLoader.displayName = "ElevasisLoader";
5338
+ var SIZE_MAP = {
5339
+ sm: { dot: 7, inner: 6, outer: 12 },
5340
+ md: { dot: 10, inner: 8, outer: 16 },
5341
+ lg: { dot: 12, inner: 10, outer: 20 }
5204
5342
  };
5205
- function ContextViewer({ data }) {
5206
- return /* @__PURE__ */ jsx(ContextNode, { data, depth: 0 });
5343
+ function GlowDot({ color, size = "md" }) {
5344
+ const { dot, inner, outer } = SIZE_MAP[size];
5345
+ return /* @__PURE__ */ jsx(
5346
+ "div",
5347
+ {
5348
+ style: {
5349
+ width: dot,
5350
+ height: dot,
5351
+ borderRadius: "50%",
5352
+ backgroundColor: color,
5353
+ boxShadow: `0 0 ${inner}px ${color}, 0 0 ${outer}px ${color}40`,
5354
+ flexShrink: 0
5355
+ }
5356
+ }
5357
+ );
5207
5358
  }
5208
- function ContextNode({ data, depth }) {
5209
- if (data === null || data === void 0) {
5210
- return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "No context provided" });
5211
- }
5212
- if (typeof data === "string") {
5213
- return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, style: subtleMarkdownWrapperStyle, children: data });
5214
- }
5215
- if (typeof data === "number" || typeof data === "boolean") {
5216
- return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
5217
- }
5218
- if (Array.isArray(data)) {
5219
- return /* @__PURE__ */ jsx(ArrayView, { items: data, depth });
5220
- }
5221
- if (typeof data === "object") {
5222
- return /* @__PURE__ */ jsx(ObjectView, { data, depth });
5223
- }
5224
- return /* @__PURE__ */ jsx(Text, { size: "sm", children: String(data) });
5225
- }
5226
- var ACRONYMS = ["AI", "URL", "UUID", "ID", "API", "HTTP", "JSON"];
5227
- function formatLabel(key) {
5228
- const titleCased = key.replace(/([a-z])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
5229
- return titleCased.replace(
5230
- new RegExp(`\\b(${ACRONYMS.map((a) => a[0] + a.slice(1).toLowerCase()).join("|")})\\b`, "g"),
5231
- (match) => match.toUpperCase()
5232
- );
5233
- }
5234
- function hasMarkdown(value) {
5235
- return /(\*\*.+\*\*|^#{1,6}\s|^\s*[-*]\s|\[.+\]\(.+\)|^\|.+\|$|^>\s|```)/.test(value);
5236
- }
5237
- function NestedSection({ title, children }) {
5238
- const [expanded, setExpanded] = useState(true);
5239
- return /* @__PURE__ */ jsxs(Stack, { gap: 6, children: [
5240
- /* @__PURE__ */ jsxs(Group, { gap: 4, style: { cursor: "pointer", userSelect: "none" }, onClick: () => setExpanded((v) => !v), children: [
5241
- expanded ? /* @__PURE__ */ jsx(IconChevronDown, { size: 14, color: "var(--color-primary)", style: { flexShrink: 0 } }) : /* @__PURE__ */ jsx(IconChevronRight, { size: 14, color: "var(--color-primary)", style: { flexShrink: 0 } }),
5242
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 600, style: { fontFamily: "var(--mantine-font-family-headings)" }, children: title })
5243
- ] }),
5244
- expanded && /* @__PURE__ */ jsx(Box, { pl: "sm", style: { borderLeft: "2px solid var(--color-border)" }, children })
5245
- ] });
5246
- }
5247
- function PrimitiveValue({ value }) {
5248
- if (value === null || value === void 0) {
5249
- return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "\u2014" });
5250
- }
5251
- if (typeof value === "boolean") {
5252
- return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value ? "Yes" : "No" });
5253
- }
5254
- if (typeof value === "number") {
5255
- return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, children: value.toLocaleString() });
5256
- }
5257
- const str = String(value);
5258
- if (hasMarkdown(str)) {
5259
- return /* @__PURE__ */ jsx(StyledMarkdown, { components: subtleMarkdownComponents, children: str });
5260
- }
5261
- return /* @__PURE__ */ jsx(Text, { size: "sm", m: 0, c: "var(--color-text-subtle)", style: { whiteSpace: "pre-wrap" }, children: str });
5359
+ var STATUS_COLORS = {
5360
+ // Project
5361
+ active: void 0,
5362
+ on_track: "green",
5363
+ at_risk: "yellow",
5364
+ blocked: "red",
5365
+ completed: "teal",
5366
+ paused: "gray",
5367
+ // Milestone
5368
+ upcoming: "gray",
5369
+ in_progress: void 0,
5370
+ overdue: "red",
5371
+ // Task
5372
+ pending: "gray",
5373
+ planned: "gray",
5374
+ submitted: "yellow",
5375
+ approved: "green",
5376
+ rejected: "red",
5377
+ revision_requested: "orange",
5378
+ cancelled: "gray",
5379
+ // Note
5380
+ call_note: void 0,
5381
+ status_update: "green",
5382
+ issue: "yellow",
5383
+ blocker: "red",
5384
+ agent_learning: "grape"
5385
+ };
5386
+ function StatusBadge({ status, ...props }) {
5387
+ const label = status.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
5388
+ const color = Object.prototype.hasOwnProperty.call(STATUS_COLORS, status) ? STATUS_COLORS[status] : "gray";
5389
+ return /* @__PURE__ */ jsx(Badge, { variant: "light", color, size: "sm", ...props, children: label });
5262
5390
  }
5263
- function ArrayView({ items, depth }) {
5264
- if (items.length === 0) {
5265
- return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty list" });
5266
- }
5267
- const allPrimitive = items.every((item) => typeof item !== "object" || item === null);
5268
- if (allPrimitive) {
5269
- return /* @__PURE__ */ jsx(Stack, { gap: 2, children: items.map((item, i) => /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "flex-start", children: [
5270
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { userSelect: "none" }, children: "\u2022" }),
5271
- /* @__PURE__ */ jsx(PrimitiveValue, { value: item })
5272
- ] }, i)) });
5391
+ var ICON_MAP = {
5392
+ deal_created: IconPlus,
5393
+ stage_change: IconArrowRight,
5394
+ discovery_submitted: IconFileText,
5395
+ proposal_generated: IconFileText,
5396
+ proposal_sent: IconSend,
5397
+ proposal_reviewed: IconEye,
5398
+ closed_lost: IconX,
5399
+ fees_updated: IconCreditCard,
5400
+ closed_won: IconCircleCheck,
5401
+ reply_received: IconMessageReply,
5402
+ booking_cancelled: IconCalendarCancel,
5403
+ booking_rescheduled: IconCalendarEvent,
5404
+ reminder_sent: IconBell,
5405
+ reply_sent_to_lead: IconMailForward,
5406
+ followup_email_sent: IconMailForward,
5407
+ no_show: IconUserOff,
5408
+ moved_to_nurturing: IconHeartHandshake
5409
+ };
5410
+ function ActivityTimeline({ activities }) {
5411
+ if (!activities.length) {
5412
+ return /* @__PURE__ */ jsx(EmptyState, { icon: IconInbox, title: "No activity events yet" });
5273
5413
  }
5274
- return /* @__PURE__ */ jsx(Stack, { gap: "sm", children: items.map((item, i) => /* @__PURE__ */ jsx(Paper, { p: "sm", style: { border: "1px solid var(--color-border)" }, children: /* @__PURE__ */ jsx(ContextNode, { data: item, depth: depth + 1 }) }, i)) });
5414
+ const sorted = [...activities].reverse();
5415
+ return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Timeline, { active: sorted.length - 1, bulletSize: 28, lineWidth: 2, color: "var(--color-primary)", children: sorted.map((activity, index) => {
5416
+ const Icon = ICON_MAP[activity.type] || IconActivity;
5417
+ return /* @__PURE__ */ jsx(
5418
+ Timeline.Item,
5419
+ {
5420
+ bullet: /* @__PURE__ */ jsx(ThemeIcon, { size: 28, variant: "filled", color: "var(--color-primary)", radius: "xl", children: /* @__PURE__ */ jsx(Icon, { size: 14 }) }),
5421
+ children: /* @__PURE__ */ jsxs(Stack, { gap: 2, children: [
5422
+ /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: activity.title }),
5423
+ activity.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: activity.description }),
5424
+ /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
5425
+ formatTimeAgo(activity.occurredAt),
5426
+ activity.actor && ` by ${activity.actor}`
5427
+ ] })
5428
+ ] })
5429
+ },
5430
+ index
5431
+ );
5432
+ }) }) });
5275
5433
  }
5276
- function ObjectView({ data, depth }) {
5277
- const entries = Object.entries(data);
5278
- if (entries.length === 0) {
5279
- return /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", fs: "italic", children: "Empty" });
5280
- }
5281
- const simpleEntries = [];
5282
- const complexEntries = [];
5283
- for (const [key, value] of entries) {
5284
- if (value === null || value === void 0 || typeof value === "boolean" || typeof value === "number") {
5285
- simpleEntries.push([key, value]);
5286
- } else if (typeof value === "string") {
5287
- if (hasMarkdown(value) || value.length > 120) {
5288
- complexEntries.push([key, value]);
5289
- } else {
5290
- simpleEntries.push([key, value]);
5291
- }
5292
- } else {
5293
- complexEntries.push([key, value]);
5434
+ var DEFAULT_META_COLUMN_WIDTH = 170;
5435
+ function OverviewListRow({
5436
+ icon,
5437
+ iconColor = "var(--color-primary)",
5438
+ iconBackground = "var(--surface-primary-faint)",
5439
+ iconTooltip,
5440
+ title,
5441
+ meta,
5442
+ metaWidth = DEFAULT_META_COLUMN_WIDTH,
5443
+ onClick
5444
+ }) {
5445
+ const themeIcon = /* @__PURE__ */ jsx(
5446
+ ThemeIcon,
5447
+ {
5448
+ size: "sm",
5449
+ variant: "light",
5450
+ style: {
5451
+ backgroundColor: iconBackground,
5452
+ color: iconColor,
5453
+ flexShrink: 0
5454
+ },
5455
+ children: icon
5294
5456
  }
5295
- }
5296
- return /* @__PURE__ */ jsxs(Stack, { gap: 10, children: [
5297
- simpleEntries.length > 0 && /* @__PURE__ */ jsx(Stack, { gap: 6, children: simpleEntries.map(([key, value]) => /* @__PURE__ */ jsxs(Group, { gap: "sm", align: "flex-start", wrap: "nowrap", children: [
5298
- /* @__PURE__ */ jsx(
5299
- Text,
5300
- {
5301
- size: "sm",
5302
- style: { minWidth: 140, flexShrink: 0, fontFamily: "var(--mantine-font-family-headings)" },
5303
- children: formatLabel(key)
5304
- }
5305
- ),
5306
- /* @__PURE__ */ jsx(PrimitiveValue, { value })
5307
- ] }, key)) }),
5308
- complexEntries.map(([key, value]) => /* @__PURE__ */ jsx(NestedSection, { title: formatLabel(key), children: /* @__PURE__ */ jsx(ContextNode, { data: value, depth: depth + 1 }) }, key))
5309
- ] });
5310
- }
5311
- var TIME_RANGE_OPTIONS = [
5312
- { value: "1h", label: "Last 1 hour" },
5313
- { value: "24h", label: "Last 24 hours" },
5314
- { value: "7d", label: "Last 7 days" },
5315
- { value: "30d", label: "Last 30 days" }
5316
- ];
5317
- function TimeRangeSelector({ value, onChange, width = 180 }) {
5318
- return /* @__PURE__ */ jsx(
5319
- CustomSelector,
5457
+ );
5458
+ return /* @__PURE__ */ jsxs(
5459
+ Group,
5320
5460
  {
5321
- value,
5322
- onChange: (newValue) => newValue && onChange(newValue),
5323
- data: TIME_RANGE_OPTIONS,
5324
- leftSection: /* @__PURE__ */ jsx(IconClock, { size: 16, color: "var(--color-text-subtle)" }),
5325
- w: width,
5326
- withCheckIcon: true
5461
+ gap: "sm",
5462
+ wrap: "nowrap",
5463
+ py: 7,
5464
+ px: "xs",
5465
+ justify: "space-between",
5466
+ onClick,
5467
+ style: {
5468
+ cursor: onClick ? "pointer" : "default",
5469
+ borderRadius: "var(--mantine-radius-sm)"
5470
+ },
5471
+ children: [
5472
+ /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", style: { flex: 1, minWidth: 0 }, children: [
5473
+ iconTooltip ? /* @__PURE__ */ jsx(Tooltip, { label: iconTooltip, withArrow: true, children: themeIcon }) : themeIcon,
5474
+ typeof title === "string" ? /* @__PURE__ */ jsx(
5475
+ Text,
5476
+ {
5477
+ size: "sm",
5478
+ fw: 600,
5479
+ style: {
5480
+ color: "var(--color-text)",
5481
+ overflow: "hidden",
5482
+ textOverflow: "ellipsis",
5483
+ whiteSpace: "nowrap",
5484
+ minWidth: 0
5485
+ },
5486
+ children: title
5487
+ }
5488
+ ) : title
5489
+ ] }),
5490
+ meta && /* @__PURE__ */ jsx(Group, { gap: 6, wrap: "nowrap", justify: "flex-end", style: { width: metaWidth, flexShrink: 0 }, children: meta })
5491
+ ]
5327
5492
  }
5328
5493
  );
5329
5494
  }
5330
- function useStableAccessToken() {
5331
- const { getAccessToken } = useAuthContext();
5332
- const getAccessTokenRef = useRef(getAccessToken);
5333
- getAccessTokenRef.current = getAccessToken;
5334
- return useCallback(() => {
5335
- return getAccessTokenRef.current();
5336
- }, []);
5337
- }
5338
- function useSessionCheck() {
5339
- const { user } = useAuthContext();
5340
- const queryClient = useQueryClient();
5341
- const organization = useContext(OrganizationContext);
5342
- const currentWorkOSOrganizationId = organization?.currentWorkOSOrganizationId ?? null;
5343
- const currentSupabaseOrganizationId = organization?.currentSupabaseOrganizationId ?? null;
5344
- const isCheckingRef = useRef(false);
5345
- const hadUserRef = useRef(false);
5346
- if (user) {
5347
- hadUserRef.current = true;
5348
- }
5349
- useEffect(() => {
5350
- const handleVisibilityChange = async () => {
5351
- if (isCheckingRef.current || document.visibilityState !== "visible") {
5352
- return;
5353
- }
5354
- isCheckingRef.current = true;
5355
- try {
5356
- if (!user && hadUserRef.current) {
5357
- window.location.replace("/login");
5358
- return;
5359
- }
5360
- if (user) {
5361
- await queryClient.cancelQueries();
5362
- invalidateOrgScopedQueries(queryClient, [currentWorkOSOrganizationId, currentSupabaseOrganizationId]);
5363
- }
5364
- } finally {
5365
- isCheckingRef.current = false;
5366
- }
5367
- };
5368
- document.addEventListener("visibilitychange", handleVisibilityChange);
5369
- window.addEventListener("focus", handleVisibilityChange);
5370
- return () => {
5371
- document.removeEventListener("visibilitychange", handleVisibilityChange);
5372
- window.removeEventListener("focus", handleVisibilityChange);
5373
- };
5374
- }, [user, queryClient, currentWorkOSOrganizationId, currentSupabaseOrganizationId]);
5495
+ function OverviewList({ children }) {
5496
+ const items = Children.toArray(children).filter(Boolean);
5497
+ return /* @__PURE__ */ jsx(Stack, { gap: 0, children: items.map((child, index) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
5498
+ child,
5499
+ index < items.length - 1 && /* @__PURE__ */ jsx(Divider, {})
5500
+ ] }, index)) });
5375
5501
  }
5376
-
5377
- // src/auth/guards/computeProtectedRouteGate.ts
5378
- var DEFAULT_WAIT_FOR_ORGANIZATION = true;
5379
- function computeProtectedRouteGate({
5380
- isInitializing,
5381
- userReady,
5382
- allReady,
5383
- error,
5384
- waitForOrganization
5502
+ function SystemReadinessAlert({
5503
+ ready,
5504
+ actionLabel,
5505
+ fallbackNote,
5506
+ reason,
5507
+ serverError
5385
5508
  }) {
5386
- const unauthenticated = !isInitializing && !userReady && error?.layer !== "profile";
5387
- const blockingError = !isInitializing && !!error && error.layer !== "organization";
5388
- const waitingForOrg = !isInitializing && waitForOrganization && !allReady && error?.layer !== "organization";
5389
- const showFallback = isInitializing || !blockingError && (unauthenticated || waitingForOrg);
5390
- return { unauthenticated, blockingError, showFallback };
5509
+ if (ready && !serverError) return null;
5510
+ const primaryIssue = serverError?.issues[0];
5511
+ const remedy = primaryIssue ? resolveReadinessRemedy(primaryIssue) : void 0;
5512
+ return /* @__PURE__ */ jsx(Alert, { icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), color: "yellow", variant: "light", children: /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
5513
+ /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
5514
+ actionLabel,
5515
+ " are disabled until System Interface readiness passes.",
5516
+ fallbackNote ? ` ${fallbackNote}` : "",
5517
+ reason ? ` ${reason}` : ""
5518
+ ] }),
5519
+ serverError?.issues.length ? /* @__PURE__ */ jsx(Stack, { gap: 2, children: serverError.issues.map((issue, index) => /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
5520
+ /* @__PURE__ */ jsxs(Text, { span: true, fw: 600, children: [
5521
+ issue.family,
5522
+ ":"
5523
+ ] }),
5524
+ " ",
5525
+ issue.message
5526
+ ] }, `${issue.family}-${issue.code}-${index}`)) }) : null,
5527
+ remedy ? /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: remedy }) : null
5528
+ ] }) });
5391
5529
  }
5392
- function ProtectedRoute({
5393
- children,
5394
- redirectTo = "/login",
5395
- fallback = null,
5396
- errorFallback,
5397
- waitForOrganization = DEFAULT_WAIT_FOR_ORGANIZATION
5398
- }) {
5399
- const { userReady, allReady, isInitializing, error, retry } = useInitialization();
5400
- const { signIn, canRecover } = useAuthContext();
5401
- const navigate = useNavigate();
5402
- const location = useLocation();
5403
- const hasRedirected = useRef(false);
5404
- const { unauthenticated, blockingError, showFallback } = computeProtectedRouteGate({
5405
- isInitializing,
5406
- userReady,
5407
- allReady,
5408
- error,
5409
- waitForOrganization
5530
+ var ConfirmationModal = ({
5531
+ opened,
5532
+ onClose,
5533
+ loading,
5534
+ icon,
5535
+ confirmationHandler,
5536
+ style,
5537
+ title,
5538
+ text,
5539
+ buttonText,
5540
+ buttonColor,
5541
+ centerText
5542
+ }) => {
5543
+ const styledIcon = cloneElement(icon, {
5544
+ size: 55,
5545
+ strokeWidth: 1.5
5410
5546
  });
5411
- useEffect(() => {
5412
- if (unauthenticated && !hasRedirected.current) {
5413
- hasRedirected.current = true;
5414
- const searchStr = location.searchStr ?? "";
5415
- const returnTo = location.pathname + searchStr;
5416
- if (canRecover()) {
5417
- signIn({ state: { returnTo: returnTo !== "/" ? returnTo : void 0 } });
5418
- } else {
5419
- navigate({
5420
- to: redirectTo,
5421
- search: returnTo !== "/" ? { returnTo } : {}
5422
- });
5547
+ return /* @__PURE__ */ jsxs(CustomModal, { opened, onClose, loading, style, children: [
5548
+ /* @__PURE__ */ jsx(Center, { children: styledIcon }),
5549
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
5550
+ /* @__PURE__ */ jsx(Center, { style: { textAlign: "center" }, children: /* @__PURE__ */ jsx(Text, { size: "lg", c: "var(--color-text)", children: title }) }),
5551
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
5552
+ text && /* @__PURE__ */ jsxs(Fragment, { children: [
5553
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text-dimmed)", style: { textAlign: centerText ? "center" : "left" }, children: text }),
5554
+ /* @__PURE__ */ jsx(Space, { h: 16 })
5555
+ ] }),
5556
+ /* @__PURE__ */ jsx(Button, { color: buttonColor, fullWidth: true, onClick: confirmationHandler, loading, children: buttonText || "Confirm" })
5557
+ ] });
5558
+ };
5559
+ var ConfirmationInputModal = ({
5560
+ opened,
5561
+ onClose,
5562
+ loading,
5563
+ icon,
5564
+ confirmationHandler,
5565
+ style,
5566
+ title,
5567
+ text,
5568
+ buttonText,
5569
+ buttonColor,
5570
+ inputValue,
5571
+ onInputChange,
5572
+ expectedValue,
5573
+ placeholder
5574
+ }) => {
5575
+ const styledIcon = cloneElement(icon, {
5576
+ size: 55,
5577
+ strokeWidth: 1.5
5578
+ });
5579
+ return /* @__PURE__ */ jsxs(CustomModal, { opened, onClose, loading, style, children: [
5580
+ /* @__PURE__ */ jsx(Center, { children: styledIcon }),
5581
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
5582
+ /* @__PURE__ */ jsx(Center, { children: /* @__PURE__ */ jsx(Title, { order: 3, children: title }) }),
5583
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
5584
+ text && /* @__PURE__ */ jsxs(Fragment, { children: [
5585
+ /* @__PURE__ */ jsx(Text, { size: "sm", c: "var(--color-text-dimmed)", children: text }),
5586
+ /* @__PURE__ */ jsx(Space, { h: 8 })
5587
+ ] }),
5588
+ /* @__PURE__ */ jsx(
5589
+ TextInput,
5590
+ {
5591
+ placeholder: placeholder || "Enter confirmation text",
5592
+ value: inputValue,
5593
+ onChange: (event) => onInputChange(event.currentTarget.value)
5423
5594
  }
5424
- }
5425
- }, [unauthenticated, signIn, canRecover, navigate, redirectTo, location]);
5426
- if (blockingError) {
5427
- return errorFallback ? /* @__PURE__ */ jsx(Fragment, { children: errorFallback(error, retry) }) : null;
5428
- }
5429
- if (showFallback) {
5430
- return /* @__PURE__ */ jsx(Fragment, { children: fallback });
5431
- }
5432
- return /* @__PURE__ */ jsx(Fragment, { children });
5433
- }
5434
- function useOptionalNavigate() {
5435
- try {
5436
- return useNavigate();
5437
- } catch {
5438
- return null;
5439
- }
5440
- }
5441
- function renderFallback(fallback, answer) {
5442
- return typeof fallback === "function" ? fallback(answer) : fallback ?? null;
5443
- }
5444
- function AccessGuard({
5445
- accessKey,
5446
- children,
5447
- fallback = null,
5448
- loadingFallback = null,
5449
- redirectTo = null
5450
- }) {
5451
- const answer = useAccess(accessKey);
5452
- const navigate = useOptionalNavigate();
5453
- const hasRedirected = useRef(false);
5595
+ ),
5596
+ /* @__PURE__ */ jsx(Space, { h: 16 }),
5597
+ /* @__PURE__ */ jsx(
5598
+ Button,
5599
+ {
5600
+ color: buttonColor,
5601
+ fullWidth: true,
5602
+ onClick: confirmationHandler,
5603
+ loading,
5604
+ disabled: inputValue !== expectedValue,
5605
+ children: buttonText || "Confirm"
5606
+ }
5607
+ )
5608
+ ] });
5609
+ };
5610
+ function ChartFrame({ h, debounceMs = 150, children }) {
5611
+ const ref = useRef(null);
5612
+ const [width, setWidth] = useState(0);
5613
+ useLayoutEffect(() => {
5614
+ const el = ref.current;
5615
+ if (!el) return;
5616
+ const w = el.getBoundingClientRect().width;
5617
+ if (w > 0) setWidth(w);
5618
+ }, []);
5454
5619
  useEffect(() => {
5455
- if (!answer.isReady || answer.allowed || !redirectTo || hasRedirected.current) return;
5456
- hasRedirected.current = true;
5457
- if (navigate) {
5458
- navigate({ to: redirectTo });
5459
- return;
5460
- }
5461
- if (typeof window !== "undefined") {
5462
- window.location.assign(redirectTo);
5463
- }
5464
- }, [answer.allowed, answer.isReady, navigate, redirectTo]);
5465
- if (!answer.isReady) return /* @__PURE__ */ jsx(Fragment, { children: loadingFallback });
5466
- if (!answer.allowed) return /* @__PURE__ */ jsx(Fragment, { children: renderFallback(fallback, answer) });
5467
- return /* @__PURE__ */ jsx(Fragment, { children });
5468
- }
5469
- function PageNotFound() {
5470
- const { currentPath, navigate } = useRouterContext();
5471
- const { user, isLoading } = useAuthContext();
5472
- const isAuthPage = currentPath === "/login" || currentPath === "/auth-redirect";
5473
- const shouldShowSidebar = user && !isLoading && !isAuthPage;
5474
- const height = shouldShowSidebar ? "100%" : "100vh";
5475
- return /* @__PURE__ */ jsx(Center, { h: height, bg: "var(--color-background)", children: /* @__PURE__ */ jsxs(Stack, { align: "center", justify: "center", children: [
5476
- /* @__PURE__ */ jsx(IconInfoCircle, { size: 60, color: "var(--color-text-subtle)" }),
5477
- /* @__PURE__ */ jsx(Title, { order: 1, children: "Page Not Found" }),
5478
- /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "lg", children: "The page you are looking for does not exist." }),
5479
- /* @__PURE__ */ jsx(Group, { justify: "center", children: /* @__PURE__ */ jsx(Button, { size: "md", onClick: () => navigate("/"), children: "Go Home" }) })
5480
- ] }) });
5620
+ const el = ref.current;
5621
+ if (!el) return;
5622
+ let timeout;
5623
+ const ro = new ResizeObserver((entries) => {
5624
+ if (timeout !== void 0) window.clearTimeout(timeout);
5625
+ const nextWidth = entries[0]?.contentRect.width ?? 0;
5626
+ timeout = window.setTimeout(() => {
5627
+ if (nextWidth > 0) setWidth(nextWidth);
5628
+ }, debounceMs);
5629
+ });
5630
+ ro.observe(el);
5631
+ return () => {
5632
+ ro.disconnect();
5633
+ if (timeout !== void 0) window.clearTimeout(timeout);
5634
+ };
5635
+ }, [debounceMs]);
5636
+ return /* @__PURE__ */ jsx("div", { ref, style: { width: "100%", height: h, position: "relative" }, children: width > 0 && /* @__PURE__ */ jsx("div", { style: { width, height: h }, children }) });
5481
5637
  }
5482
- function FeatureUnavailableState({ path }) {
5483
- const { navigate } = useRouterContext();
5484
- return /* @__PURE__ */ jsx(
5485
- Center,
5486
- {
5487
- style: {
5488
- flex: 1,
5489
- minHeight: "100%",
5490
- width: "100%",
5491
- padding: 24,
5492
- background: "linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 72%, transparent), transparent)"
5493
- },
5494
- children: /* @__PURE__ */ jsxs(
5495
- Stack,
5496
- {
5497
- align: "center",
5498
- gap: "md",
5499
- style: {
5500
- maxWidth: 560,
5501
- padding: "32px 28px",
5502
- borderRadius: 24,
5503
- border: "1px solid var(--color-border)",
5504
- background: "color-mix(in srgb, var(--glass-background) 86%, transparent)",
5505
- boxShadow: "var(--card-shadow)",
5506
- backdropFilter: "var(--glass-blur)",
5507
- textAlign: "center"
5508
- },
5509
- children: [
5510
- /* @__PURE__ */ jsx(IconBan, { size: 44, stroke: 1.8, color: "var(--color-text-subtle)" }),
5511
- /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
5512
- /* @__PURE__ */ jsx(Title, { order: 2, children: "This section is unavailable" }),
5513
- /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", maw: 420, children: path ? `The requested route ${path} is currently disabled in this workspace.` : "The requested subsection is currently disabled in this workspace." })
5514
- ] }),
5515
- /* @__PURE__ */ jsx(Group, { gap: "sm", justify: "center", children: /* @__PURE__ */ jsx(Button, { onClick: () => navigate("/"), children: "Go home" }) })
5516
- ]
5517
- }
5518
- )
5519
- }
5520
- );
5638
+ var THEME_DERIVED = {
5639
+ grid: "var(--color-border)",
5640
+ gridLine: "var(--color-border)",
5641
+ tickText: "var(--mantine-color-dimmed)",
5642
+ tooltipBg: "var(--glass-background)",
5643
+ tooltipBorder: "var(--color-border)",
5644
+ tooltipText: "var(--mantine-color-dimmed)",
5645
+ dotStroke: "var(--mantine-color-body)"
5646
+ };
5647
+ var DARK = {
5648
+ cyan: "#00e5ff",
5649
+ cyanDim: "#00b8d4",
5650
+ blue: "#448aff",
5651
+ green: "#00ff88",
5652
+ greenDim: "#00c853",
5653
+ red: "#ff1744",
5654
+ redDim: "#d50000",
5655
+ yellow: "#ffab00",
5656
+ magenta: "#ff4081",
5657
+ ...THEME_DERIVED,
5658
+ cardGlow: "0 0 30px rgba(0, 229, 255, 0.06)"
5659
+ };
5660
+ var LIGHT = {
5661
+ cyan: "#0091ea",
5662
+ cyanDim: "#0277bd",
5663
+ blue: "#4d8af0",
5664
+ green: "#00a854",
5665
+ greenDim: "#00873e",
5666
+ red: "#d32f2f",
5667
+ redDim: "#b71c1c",
5668
+ yellow: "#f9a825",
5669
+ magenta: "#c51162",
5670
+ ...THEME_DERIVED,
5671
+ cardGlow: "0 0 20px rgba(0, 145, 234, 0.06)"
5672
+ };
5673
+ function useCyberColors() {
5674
+ const scheme = useComputedColorScheme("dark");
5675
+ return useMemo(() => scheme === "dark" ? DARK : LIGHT, [scheme]);
5521
5676
  }
5522
- function resolveSystemPath(accessKey) {
5523
- try {
5524
- return normalizeAccessKey(accessKey).systemPath;
5525
- } catch {
5526
- return typeof accessKey === "string" ? accessKey : accessKey.systemPath;
5677
+ function getSeriesColor(key, colors) {
5678
+ switch (key) {
5679
+ case "Success Rate":
5680
+ return colors.cyan;
5681
+ case "Executions":
5682
+ return colors.blue;
5683
+ case "Success Count":
5684
+ return colors.green;
5685
+ case "Error Count":
5686
+ return colors.red;
5687
+ default:
5688
+ return colors.cyan;
5527
5689
  }
5528
5690
  }
5529
- function UnavailableCard({
5530
- icon,
5531
- title,
5532
- description,
5533
- devHint
5691
+ var ReferenceLine = ReferenceLine$1;
5692
+ function CyberDefs({ colors, isLight }) {
5693
+ const gradMul = isLight ? 0.5 : 1;
5694
+ const gradients = [
5695
+ { id: "gradCyan", color: colors.cyan, opacity: 0.35 * gradMul },
5696
+ { id: "gradBlue", color: colors.blue, opacity: 0.3 * gradMul },
5697
+ { id: "gradGreen", color: colors.green, opacity: 0.3 * gradMul },
5698
+ { id: "gradRed", color: colors.red, opacity: 0.3 * gradMul },
5699
+ { id: "gradYellow", color: colors.yellow, opacity: 0.3 * gradMul }
5700
+ ];
5701
+ const glowMul = isLight ? 0.25 : 1;
5702
+ const filters = [
5703
+ { id: "glowCyan", std: 3 * glowMul },
5704
+ { id: "glowBlue", std: 3 * glowMul },
5705
+ { id: "glowGreen", std: 2.5 * glowMul },
5706
+ { id: "glowRed", std: 2.5 * glowMul },
5707
+ { id: "glowYellow", std: 2.5 * glowMul }
5708
+ ];
5709
+ return /* @__PURE__ */ jsxs("defs", { children: [
5710
+ gradients.map((g) => /* @__PURE__ */ jsxs("linearGradient", { id: g.id, x1: "0", y1: "0", x2: "0", y2: "1", children: [
5711
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: g.color, stopOpacity: g.opacity }),
5712
+ /* @__PURE__ */ jsx("stop", { offset: "60%", stopColor: g.color, stopOpacity: g.opacity * 0.2 }),
5713
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: g.color, stopOpacity: 0 })
5714
+ ] }, g.id)),
5715
+ filters.map((f) => /* @__PURE__ */ jsxs("filter", { id: f.id, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
5716
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: f.std, result: "blur" }),
5717
+ /* @__PURE__ */ jsxs("feMerge", { children: [
5718
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
5719
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
5720
+ ] })
5721
+ ] }, f.id)),
5722
+ /* @__PURE__ */ jsxs("filter", { id: "dotGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
5723
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "4", result: "blur" }),
5724
+ /* @__PURE__ */ jsxs("feMerge", { children: [
5725
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
5726
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
5727
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
5728
+ ] })
5729
+ ] }),
5730
+ /* @__PURE__ */ jsxs("filter", { id: "pulseGlow", x: "-30%", y: "-30%", width: "160%", height: "160%", children: [
5731
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "5", result: "blur" }),
5732
+ /* @__PURE__ */ jsxs("feMerge", { children: [
5733
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
5734
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
5735
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
5736
+ ] })
5737
+ ] })
5738
+ ] });
5739
+ }
5740
+ function PulseDefs({ series, colors, isLight }) {
5741
+ return /* @__PURE__ */ jsx("defs", { children: series.map((s, i) => {
5742
+ const color = colors[s.color ?? "cyan"];
5743
+ const dur = "6s";
5744
+ const delay = "0s";
5745
+ const keyTimes = "0;0.3;1";
5746
+ const keySplines = "0.33 0 0.67 1;0 0 1 1";
5747
+ const animateProps = {
5748
+ dur,
5749
+ keyTimes,
5750
+ keySplines,
5751
+ repeatCount: "indefinite",
5752
+ calcMode: "spline",
5753
+ begin: delay
5754
+ };
5755
+ return /* @__PURE__ */ jsxs("linearGradient", { id: `pulse-${i}`, x1: "0", y1: "0", x2: "1", y2: "0", children: [
5756
+ /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.15;1.0;1.0", ...animateProps }) }),
5757
+ /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: isLight ? "white" : color, stopOpacity: isLight ? 0.6 : 0.9, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "-0.075;1.075;1.075", ...animateProps }) }),
5758
+ /* @__PURE__ */ jsx("stop", { offset: "0", stopColor: color, stopOpacity: 0, children: /* @__PURE__ */ jsx("animate", { attributeName: "offset", values: "0;1.15;1.15", ...animateProps }) })
5759
+ ] }, i);
5760
+ }) });
5761
+ }
5762
+ function CyberActiveDot({
5763
+ cx,
5764
+ cy,
5765
+ color,
5766
+ dotStroke
5534
5767
  }) {
5535
- return /* @__PURE__ */ jsx(
5536
- Center,
5768
+ if (cx == null || cy == null) return null;
5769
+ return /* @__PURE__ */ jsxs("g", { filter: "url(#dotGlow)", children: [
5770
+ /* @__PURE__ */ jsxs("circle", { cx, cy, r: 6, fill: "none", stroke: color, strokeWidth: 2, opacity: 0.5, children: [
5771
+ /* @__PURE__ */ jsx("animate", { attributeName: "r", from: "4", to: "10", dur: "1.2s", repeatCount: "indefinite" }),
5772
+ /* @__PURE__ */ jsx("animate", { attributeName: "opacity", from: "0.6", to: "0", dur: "1.2s", repeatCount: "indefinite" })
5773
+ ] }),
5774
+ /* @__PURE__ */ jsx("circle", { cx, cy, r: 4, fill: color, stroke: dotStroke, strokeWidth: 2 })
5775
+ ] });
5776
+ }
5777
+ function CyberTooltipContent({
5778
+ active,
5779
+ payload,
5780
+ label,
5781
+ colors,
5782
+ labelFormatter,
5783
+ valueFormatter
5784
+ }) {
5785
+ if (!active || !payload?.length) return null;
5786
+ const filtered = payload.filter((entry) => !entry.name?.startsWith("_pulse_"));
5787
+ if (!filtered.length) return null;
5788
+ const displayLabel = label && labelFormatter ? labelFormatter(label) : label;
5789
+ return /* @__PURE__ */ jsxs(
5790
+ "div",
5537
5791
  {
5538
5792
  style: {
5539
- flex: 1,
5540
- minHeight: "100%",
5541
- width: "100%",
5542
- padding: 24,
5543
- background: "linear-gradient(180deg, color-mix(in srgb, var(--color-surface) 72%, transparent), transparent)"
5793
+ background: colors.tooltipBg,
5794
+ border: `1px solid ${colors.tooltipBorder}`,
5795
+ borderRadius: 8,
5796
+ padding: "10px 14px",
5797
+ backdropFilter: "var(--glass-blur)",
5798
+ WebkitBackdropFilter: "var(--glass-blur)",
5799
+ boxShadow: "var(--standard-box-shadow)",
5800
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
5801
+ minWidth: 160
5544
5802
  },
5545
- children: /* @__PURE__ */ jsxs(
5546
- Stack,
5547
- {
5548
- align: "center",
5549
- gap: "md",
5550
- style: {
5551
- maxWidth: 560,
5552
- padding: "32px 28px",
5553
- borderRadius: 24,
5554
- border: "1px solid var(--color-border)",
5555
- background: "color-mix(in srgb, var(--glass-background) 86%, transparent)",
5556
- boxShadow: "var(--card-shadow)",
5557
- backdropFilter: "var(--glass-blur)",
5558
- textAlign: "center"
5559
- },
5560
- children: [
5561
- icon,
5562
- /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
5563
- /* @__PURE__ */ jsx(Title, { order: 2, children: title }),
5564
- /* @__PURE__ */ jsx(Text, { c: "dimmed", size: "sm", maw: 420, children: description }),
5565
- devHint ? /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", maw: 420, children: devHint }) : null
5566
- ] })
5567
- ]
5568
- }
5569
- )
5803
+ children: [
5804
+ /* @__PURE__ */ jsx(
5805
+ "div",
5806
+ {
5807
+ style: {
5808
+ fontSize: 11,
5809
+ color: colors.tickText,
5810
+ marginBottom: 8,
5811
+ letterSpacing: "0.05em",
5812
+ textTransform: "uppercase",
5813
+ borderBottom: `1px solid ${colors.tooltipBorder}`,
5814
+ paddingBottom: 6
5815
+ },
5816
+ children: displayLabel
5817
+ }
5818
+ ),
5819
+ filtered.map((entry) => {
5820
+ const color = entry.color || getSeriesColor(entry.dataKey, colors);
5821
+ return /* @__PURE__ */ jsxs(
5822
+ "div",
5823
+ {
5824
+ style: {
5825
+ display: "flex",
5826
+ justifyContent: "space-between",
5827
+ alignItems: "center",
5828
+ gap: 16,
5829
+ padding: "3px 0",
5830
+ fontSize: 12
5831
+ },
5832
+ children: [
5833
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
5834
+ /* @__PURE__ */ jsx(
5835
+ "div",
5836
+ {
5837
+ style: {
5838
+ width: 8,
5839
+ height: 8,
5840
+ borderRadius: "50%",
5841
+ backgroundColor: color,
5842
+ boxShadow: `0 0 6px ${color}`
5843
+ }
5844
+ }
5845
+ ),
5846
+ /* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText }, children: entry.name ?? entry.dataKey })
5847
+ ] }),
5848
+ /* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontVariantNumeric: "tabular-nums" }, children: entry.value != null && valueFormatter ? valueFormatter(entry.value) : String(entry.value) })
5849
+ ]
5850
+ },
5851
+ entry.dataKey
5852
+ );
5853
+ })
5854
+ ]
5570
5855
  }
5571
5856
  );
5572
5857
  }
5573
- function SystemUnavailableState({ accessKey, reason }) {
5574
- const systems = useOptionalElevasisSystems();
5575
- const systemPath2 = resolveSystemPath(accessKey);
5576
- if (reason === "unknown-access-key") {
5577
- const isDev = import.meta.env?.DEV ?? false;
5578
- return /* @__PURE__ */ jsx(
5579
- UnavailableCard,
5580
- {
5581
- icon: /* @__PURE__ */ jsx(IconAlertTriangle, { size: 44, stroke: 1.8, color: "var(--color-warning)" }),
5582
- title: "System not declared",
5583
- description: `"${systemPath2}" is not declared in this organization's model, so this route cannot resolve.`,
5584
- devHint: isDev ? "Dev: declare this System in core/config/organization-model/systems.ts." : null
5585
- }
5586
- );
5587
- }
5588
- if (reason === "system-not-active") {
5589
- const system = systems?.organizationModel ? getSystem(systems.organizationModel, systemPath2) : void 0;
5590
- const lifecycle = system?.lifecycle ?? "inactive";
5591
- return /* @__PURE__ */ jsx(
5592
- UnavailableCard,
5858
+ function CyberLegendItem({ color, label }) {
5859
+ return /* @__PURE__ */ jsxs(Group, { gap: 8, children: [
5860
+ /* @__PURE__ */ jsx(
5861
+ "div",
5593
5862
  {
5594
- icon: /* @__PURE__ */ jsx(IconBan, { size: 44, stroke: 1.8, color: "var(--color-text-subtle)" }),
5595
- title: "System unavailable",
5596
- description: `${system?.label ?? systemPath2} (${systemPath2}) is currently "${lifecycle}" and not reachable in this workspace.`
5863
+ style: {
5864
+ width: 10,
5865
+ height: 10,
5866
+ borderRadius: "50%",
5867
+ backgroundColor: color,
5868
+ boxShadow: `0 0 8px ${color}, 0 0 16px ${color}40`
5869
+ }
5597
5870
  }
5598
- );
5599
- }
5600
- return /* @__PURE__ */ jsx(NoAccessState, {});
5871
+ ),
5872
+ /* @__PURE__ */ jsx(Text, { size: "xs", style: { color: "var(--color-text-subtle)", letterSpacing: "0.03em" }, children: label })
5873
+ ] });
5601
5874
  }
5602
- function ResourceCard({
5603
- resource,
5604
- onClick,
5605
- layout = "stack",
5606
- rightSection,
5607
- topSection,
5608
- lastRunLabel,
5609
- style,
5610
- ...rest
5875
+ var COLOR_MAP = {
5876
+ cyan: { gradient: "url(#gradCyan)", filter: "url(#glowCyan)", key: "cyan" },
5877
+ blue: { gradient: "url(#gradBlue)", filter: "url(#glowBlue)", key: "blue" },
5878
+ green: { gradient: "url(#gradGreen)", filter: "url(#glowGreen)", key: "green" },
5879
+ red: { gradient: "url(#gradRed)", filter: "url(#glowRed)", key: "red" },
5880
+ yellow: { gradient: "url(#gradYellow)", filter: "url(#glowYellow)", key: "yellow" }
5881
+ };
5882
+ function CyberAreaChart({
5883
+ data,
5884
+ series,
5885
+ xDataKey = "time",
5886
+ height = 300,
5887
+ yAxisLabel,
5888
+ yDomain,
5889
+ yTickFormatter,
5890
+ showGrid = true,
5891
+ showZeroBaseline = true,
5892
+ baselineColor,
5893
+ lineOnly = false,
5894
+ margin = { top: 8, right: 20, left: 0, bottom: 0 },
5895
+ xTickFormatter,
5896
+ tooltipFormatter
5611
5897
  }) {
5612
- const Icon = getResourceIcon(resource.type);
5613
- if (!Icon) {
5614
- return /* @__PURE__ */ jsx(Card, { shadow: "sm", withBorder: true, children: /* @__PURE__ */ jsxs(Text, { children: [
5615
- "Invalid resource type: ",
5616
- resource.type
5617
- ] }) });
5618
- }
5619
- const cardStyle = {
5620
- cursor: "pointer",
5621
- ...layout === "grid" || layout === "card" ? { transition: "box-shadow var(--duration-fast) var(--easing)" } : {},
5622
- ...style
5623
- };
5624
- const iconSize = layout === "grid" ? 28 : 20;
5625
- const details = /* @__PURE__ */ jsxs(Group, { gap: "sm", wrap: "nowrap", children: [
5626
- /* @__PURE__ */ jsx(Icon, { size: iconSize, color: "var(--color-primary)" }),
5627
- /* @__PURE__ */ jsxs(Stack, { gap: 4, style: { flex: 1, minWidth: 0 }, children: [
5628
- /* @__PURE__ */ jsxs(Group, { gap: "xs", align: "center", children: [
5629
- /* @__PURE__ */ jsx(
5630
- Text,
5631
- {
5632
- fw: 600,
5633
- size: "sm",
5634
- style: { fontFamily: "var(--elevasis-font-family-subtitle)" },
5635
- ...layout === "stack" ? { lineClamp: 1 } : { truncate: true },
5636
- children: resource.name
5637
- }
5638
- ),
5639
- /* @__PURE__ */ jsx(Badge, { variant: "light", size: layout === "grid" ? "xs" : "sm", children: resource.type })
5640
- ] }),
5641
- resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", ...layout === "stack" ? { lineClamp: 1 } : { truncate: true }, children: resource.description }),
5642
- /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
5643
- resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "outline", size: "xs", children: [
5644
- "v",
5645
- resource.version
5646
- ] }),
5647
- /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "outline", size: layout === "grid" ? "xs" : "sm", children: resource.status.toUpperCase() })
5648
- ] }),
5649
- lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", children: lastRunLabel }),
5650
- /* @__PURE__ */ jsx(Text, { size: layout === "grid" ? "sm" : "xs", c: "dimmed", ff: "monospace", children: resource.resourceId })
5651
- ] })
5652
- ] });
5653
- if (layout === "card") {
5654
- return /* @__PURE__ */ jsx(
5655
- Card,
5898
+ const isLight = useComputedColorScheme("dark") === "light";
5899
+ const colors = useCyberColors();
5900
+ const [ready, setReady] = useState(false);
5901
+ useEffect(() => {
5902
+ const frame = requestAnimationFrame(() => setReady(true));
5903
+ return () => cancelAnimationFrame(frame);
5904
+ }, []);
5905
+ const allZero = useMemo(() => {
5906
+ if (!showZeroBaseline || !data.length) return false;
5907
+ return data.every((row) => series.every((s) => row[s.dataKey] === 0));
5908
+ }, [data, series, showZeroBaseline]);
5909
+ if (!ready || !data.length) return /* @__PURE__ */ jsx(Box, { style: { height } });
5910
+ const gridProps = {
5911
+ stroke: colors.gridLine,
5912
+ strokeDasharray: "3 6",
5913
+ strokeOpacity: 1
5914
+ };
5915
+ const xAxisConfig = {
5916
+ stroke: "none",
5917
+ tick: {
5918
+ fill: colors.tickText,
5919
+ fontSize: 11,
5920
+ fontFamily: "var(--mantine-font-family-monospace, monospace)"
5921
+ },
5922
+ tickLine: false,
5923
+ axisLine: { stroke: colors.grid, strokeWidth: 1 }
5924
+ };
5925
+ const yTickStyle = {
5926
+ fill: colors.tickText,
5927
+ fontSize: 11,
5928
+ fontFamily: "var(--mantine-font-family-monospace, monospace)"
5929
+ };
5930
+ return /* @__PURE__ */ jsx(Box, { style: { width: "100%", height }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(AreaChart, { data, margin, children: [
5931
+ /* @__PURE__ */ jsx(CyberDefs, { colors, isLight }),
5932
+ /* @__PURE__ */ jsx(PulseDefs, { series, colors, isLight }),
5933
+ showGrid && /* @__PURE__ */ jsx(CartesianGrid, { ...gridProps }),
5934
+ /* @__PURE__ */ jsx(XAxis, { dataKey: xDataKey, ...xAxisConfig, tickFormatter: xTickFormatter }),
5935
+ /* @__PURE__ */ jsx(
5936
+ YAxis,
5656
5937
  {
5657
- withBorder: true,
5658
- padding: 0,
5659
- style: cardStyle,
5660
- onClick: () => onClick(resource),
5661
- "data-resource-id": rest["data-resource-id"],
5662
- children: /* @__PURE__ */ jsxs(Stack, { gap: 8, p: "sm", pb: "xs", children: [
5663
- /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", justify: "space-between", children: [
5664
- /* @__PURE__ */ jsxs(Group, { gap: "xs", wrap: "nowrap", style: { minWidth: 0 }, children: [
5665
- /* @__PURE__ */ jsx(Icon, { size: 20, color: "var(--color-primary)", style: { flexShrink: 0 } }),
5666
- /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, truncate: true, children: resource.name })
5667
- ] }),
5668
- /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", style: { flexShrink: 0 }, children: [
5669
- resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
5670
- "v",
5671
- resource.version
5672
- ] }),
5673
- /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
5674
- ] })
5675
- ] }),
5676
- resource.description && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, children: resource.description }),
5677
- /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", wrap: "nowrap", children: [
5678
- rightSection || /* @__PURE__ */ jsx("span", {}),
5679
- lastRunLabel && /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap" }, children: lastRunLabel })
5680
- ] }),
5681
- topSection
5682
- ] })
5938
+ domain: yDomain ?? [0, (max) => Math.max(max, 1)],
5939
+ stroke: "none",
5940
+ tick: yTickStyle,
5941
+ tickFormatter: yTickFormatter,
5942
+ tickLine: false,
5943
+ axisLine: { stroke: colors.grid, strokeWidth: 1 },
5944
+ label: yAxisLabel ? {
5945
+ value: yAxisLabel,
5946
+ angle: -90,
5947
+ position: "insideLeft",
5948
+ offset: 0,
5949
+ style: { fill: colors.tickText, fontSize: 11 }
5950
+ } : void 0
5683
5951
  }
5684
- );
5685
- }
5686
- if (layout === "row") {
5687
- const [hovered, setHovered] = useState(false);
5688
- return /* @__PURE__ */ jsx(
5689
- Card,
5952
+ ),
5953
+ /* @__PURE__ */ jsx(
5954
+ Tooltip$1,
5690
5955
  {
5691
- padding: 0,
5692
- style: {
5693
- cursor: "pointer",
5694
- border: "1px solid var(--color-border)",
5695
- transition: "background 150ms ease",
5696
- background: hovered ? "var(--active-background)" : "var(--color-surface)",
5697
- ...style
5698
- },
5699
- onClick: () => onClick(resource),
5700
- onMouseEnter: () => setHovered(true),
5701
- onMouseLeave: () => setHovered(false),
5702
- "data-resource-id": rest["data-resource-id"],
5703
- children: /* @__PURE__ */ jsxs(
5704
- "div",
5705
- {
5706
- style: {
5707
- display: "grid",
5708
- gridTemplateColumns: "18px 200px 120px 1fr 180px 200px 14px",
5709
- alignItems: "center",
5710
- gap: "var(--mantine-spacing-sm)"
5711
- },
5712
- children: [
5713
- /* @__PURE__ */ jsx(Icon, { size: 18, color: "var(--color-primary)" }),
5714
- /* @__PURE__ */ jsx(Text, { fw: 600, size: "md", truncate: true, style: { fontFamily: "var(--elevasis-font-family-subtitle)" }, children: resource.name }),
5715
- /* @__PURE__ */ jsxs(Group, { gap: 6, wrap: "nowrap", children: [
5716
- resource.version && /* @__PURE__ */ jsxs(Badge, { variant: "light", size: "sm", children: [
5717
- "v",
5718
- resource.version
5719
- ] }),
5720
- /* @__PURE__ */ jsx(Badge, { color: ResourceStatusColors[resource.status], variant: "light", size: "sm", children: resource.status.toUpperCase() })
5721
- ] }),
5722
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", truncate: true, style: { minWidth: 0 }, children: resource.description || "" }),
5723
- /* @__PURE__ */ jsx("div", { style: { whiteSpace: "nowrap" }, children: rightSection }),
5724
- /* @__PURE__ */ jsx(Text, { size: "sm", c: "dimmed", style: { whiteSpace: "nowrap", textAlign: "right" }, children: lastRunLabel || "" }),
5725
- /* @__PURE__ */ jsx(
5726
- IconChevronRight,
5727
- {
5728
- size: 14,
5729
- style: {
5730
- opacity: hovered ? 0.7 : 0,
5731
- transition: "opacity 150ms ease"
5732
- }
5733
- }
5734
- )
5735
- ]
5736
- }
5737
- )
5956
+ content: /* @__PURE__ */ jsx(CyberTooltipContent, { colors, labelFormatter: xTickFormatter, valueFormatter: tooltipFormatter }),
5957
+ cursor: { stroke: colors.cyan, strokeOpacity: 0.2 }
5738
5958
  }
5739
- );
5740
- }
5741
- if (layout === "grid") {
5742
- return /* @__PURE__ */ jsx(
5743
- Card,
5959
+ ),
5960
+ allZero && (() => {
5961
+ const bColor = colors[baselineColor ?? series[0]?.color ?? "cyan"];
5962
+ const glow = isLight ? `drop-shadow(0 0 2px ${bColor})` : `drop-shadow(0 0 4px ${bColor}) drop-shadow(0 0 8px ${bColor})`;
5963
+ return /* @__PURE__ */ jsx(ReferenceLine, { y: 0, stroke: bColor, strokeWidth: isLight ? 1.5 : 2, style: { filter: glow } });
5964
+ })(),
5965
+ series.map((s) => {
5966
+ const cm = COLOR_MAP[s.color ?? "cyan"];
5967
+ const strokeColor = colors[cm.key];
5968
+ return /* @__PURE__ */ jsx(
5969
+ Area,
5970
+ {
5971
+ type: "monotone",
5972
+ dataKey: s.dataKey,
5973
+ name: s.name ?? s.dataKey,
5974
+ stroke: strokeColor,
5975
+ strokeWidth: lineOnly ? 3 : 2,
5976
+ fill: lineOnly ? "transparent" : cm.gradient,
5977
+ filter: cm.filter,
5978
+ dot: false,
5979
+ activeDot: /* @__PURE__ */ jsx(CyberActiveDot, { color: strokeColor, dotStroke: colors.dotStroke }),
5980
+ animationBegin: 100,
5981
+ animationDuration: s.animationDuration ?? 1200,
5982
+ animationEasing: "ease-out"
5983
+ },
5984
+ s.dataKey
5985
+ );
5986
+ }),
5987
+ !isLight && series.map((s, i) => /* @__PURE__ */ jsx(
5988
+ Area,
5744
5989
  {
5745
- withBorder: true,
5746
- padding: "sm",
5747
- style: cardStyle,
5748
- onClick: () => onClick(resource),
5749
- "data-resource-id": rest["data-resource-id"],
5750
- children: /* @__PURE__ */ jsxs(Grid, { gutter: "sm", align: "center", children: [
5751
- /* @__PURE__ */ jsx(Grid.Col, { span: 8, children: details }),
5752
- rightSection && /* @__PURE__ */ jsx(Grid.Col, { span: 4, children: /* @__PURE__ */ jsx(Group, { justify: "flex-end", gap: "md", wrap: "nowrap", children: rightSection }) })
5753
- ] })
5754
- }
5755
- );
5756
- }
5757
- return /* @__PURE__ */ jsx(
5758
- Card,
5759
- {
5760
- shadow: "sm",
5761
- withBorder: true,
5762
- style: cardStyle,
5763
- onClick: () => onClick(resource),
5764
- "data-resource-id": rest["data-resource-id"],
5765
- children: /* @__PURE__ */ jsx(Stack, { children: details })
5766
- }
5767
- );
5990
+ type: "monotone",
5991
+ dataKey: s.dataKey,
5992
+ name: `_pulse_${s.dataKey}`,
5993
+ stroke: `url(#pulse-${i})`,
5994
+ strokeWidth: 3,
5995
+ fill: "none",
5996
+ filter: "url(#pulseGlow)",
5997
+ dot: false,
5998
+ activeDot: false,
5999
+ tooltipType: "none",
6000
+ isAnimationActive: false,
6001
+ style: { pointerEvents: "none" }
6002
+ },
6003
+ `pulse-${s.dataKey}`
6004
+ ))
6005
+ ] }) }) });
5768
6006
  }
5769
-
5770
- // src/components/display/ElevasisLoader.module.css.js
5771
- var ElevasisLoader_module_css_default = { "wrapper": "wrapper", "loader": "loader", "chevron": "chevron", "c1": "c1", "c2": "c2", "c3": "c3" };
5772
- var ElevasisLoader = forwardRef(({ style, className, ...others }, ref) => /* @__PURE__ */ jsx("div", { ref, style, className: `${ElevasisLoader_module_css_default.wrapper} ${className ?? ""}`, ...others, children: /* @__PURE__ */ jsxs("svg", { className: ElevasisLoader_module_css_default.loader, viewBox: "-10 -5 60 50", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
5773
- /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c1}`, points: "5,36 20,25 35,36" }),
5774
- /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c2}`, points: "9,23 20,14 31,23" }),
5775
- /* @__PURE__ */ jsx("polyline", { className: `${ElevasisLoader_module_css_default.chevron} ${ElevasisLoader_module_css_default.c3}`, points: "13,11 20,5 27,11" })
5776
- ] }) }));
5777
- ElevasisLoader.displayName = "ElevasisLoader";
5778
- var SIZE_MAP = {
5779
- sm: { dot: 7, inner: 6, outer: 12 },
5780
- md: { dot: 10, inner: 8, outer: 16 },
5781
- lg: { dot: 12, inner: 10, outer: 20 }
5782
- };
5783
- function GlowDot({ color, size = "md" }) {
5784
- const { dot, inner, outer } = SIZE_MAP[size];
5785
- return /* @__PURE__ */ jsx(
6007
+ function CyberDonutTooltip({
6008
+ active,
6009
+ payload,
6010
+ colors
6011
+ }) {
6012
+ if (!active || !payload?.length) return null;
6013
+ const entry = payload[0];
6014
+ if (!entry) return null;
6015
+ const color = entry.payload?.color ?? colors.cyan;
6016
+ return /* @__PURE__ */ jsxs(
5786
6017
  "div",
5787
6018
  {
5788
6019
  style: {
5789
- width: dot,
5790
- height: dot,
5791
- borderRadius: "50%",
5792
- backgroundColor: color,
5793
- boxShadow: `0 0 ${inner}px ${color}, 0 0 ${outer}px ${color}40`,
5794
- flexShrink: 0
5795
- }
6020
+ background: colors.tooltipBg,
6021
+ border: `1px solid ${colors.tooltipBorder}`,
6022
+ borderRadius: 8,
6023
+ padding: "8px 12px",
6024
+ backdropFilter: "var(--glass-blur)",
6025
+ WebkitBackdropFilter: "var(--glass-blur)",
6026
+ boxShadow: "var(--standard-box-shadow)",
6027
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
6028
+ display: "flex",
6029
+ alignItems: "center",
6030
+ gap: 10
6031
+ },
6032
+ children: [
6033
+ /* @__PURE__ */ jsx(
6034
+ "div",
6035
+ {
6036
+ style: {
6037
+ width: 8,
6038
+ height: 8,
6039
+ borderRadius: "50%",
6040
+ backgroundColor: color,
6041
+ boxShadow: `0 0 6px ${color}`
6042
+ }
6043
+ }
6044
+ ),
6045
+ /* @__PURE__ */ jsx("span", { style: { color: colors.tooltipText, fontSize: 12 }, children: entry.name }),
6046
+ /* @__PURE__ */ jsx("span", { style: { color, fontWeight: 600, fontSize: 12, fontVariantNumeric: "tabular-nums" }, children: entry.value })
6047
+ ]
5796
6048
  }
5797
6049
  );
5798
6050
  }
5799
- var STATUS_COLORS = {
5800
- // Project
5801
- active: void 0,
5802
- on_track: "green",
5803
- at_risk: "yellow",
5804
- blocked: "red",
5805
- completed: "teal",
5806
- paused: "gray",
5807
- // Milestone
5808
- upcoming: "gray",
5809
- in_progress: void 0,
5810
- overdue: "red",
5811
- // Task
5812
- pending: "gray",
5813
- planned: "gray",
5814
- submitted: "yellow",
5815
- approved: "green",
5816
- rejected: "red",
5817
- revision_requested: "orange",
5818
- cancelled: "gray",
5819
- // Note
5820
- call_note: void 0,
5821
- status_update: "green",
5822
- issue: "yellow",
5823
- blocker: "red",
5824
- agent_learning: "grape"
5825
- };
5826
- function StatusBadge({ status, ...props }) {
5827
- const label = status.split("_").map((w) => w.charAt(0).toUpperCase() + w.slice(1)).join(" ");
5828
- const color = Object.prototype.hasOwnProperty.call(STATUS_COLORS, status) ? STATUS_COLORS[status] : "gray";
5829
- return /* @__PURE__ */ jsx(Badge, { variant: "light", color, size: "sm", ...props, children: label });
5830
- }
5831
- var ICON_MAP = {
5832
- deal_created: IconPlus,
5833
- stage_change: IconArrowRight,
5834
- discovery_submitted: IconFileText,
5835
- proposal_generated: IconFileText,
5836
- proposal_sent: IconSend,
5837
- proposal_reviewed: IconEye,
5838
- closed_lost: IconX,
5839
- fees_updated: IconCreditCard,
5840
- closed_won: IconCircleCheck,
5841
- reply_received: IconMessageReply,
5842
- booking_cancelled: IconCalendarCancel,
5843
- booking_rescheduled: IconCalendarEvent,
5844
- reminder_sent: IconBell,
5845
- reply_sent_to_lead: IconMailForward,
5846
- followup_email_sent: IconMailForward,
5847
- no_show: IconUserOff,
5848
- moved_to_nurturing: IconHeartHandshake
5849
- };
5850
- function ActivityTimeline({ activities }) {
5851
- if (!activities.length) {
5852
- return /* @__PURE__ */ jsx(EmptyState, { icon: IconInbox, title: "No activity events yet" });
5853
- }
5854
- const sorted = [...activities].reverse();
5855
- return /* @__PURE__ */ jsx(Paper, { withBorder: true, children: /* @__PURE__ */ jsx(Timeline, { active: sorted.length - 1, bulletSize: 28, lineWidth: 2, color: "var(--color-primary)", children: sorted.map((activity, index) => {
5856
- const Icon = ICON_MAP[activity.type] || IconActivity;
5857
- return /* @__PURE__ */ jsx(
5858
- Timeline.Item,
6051
+ function CyberDonut({
6052
+ title,
6053
+ segments,
6054
+ centerValue,
6055
+ centerLabel,
6056
+ centerValueColor = "var(--mantine-color-text)",
6057
+ glowId,
6058
+ colors,
6059
+ size = 120,
6060
+ innerRadius = 36,
6061
+ outerRadius = 52,
6062
+ isLoading,
6063
+ showLegend = true
6064
+ }) {
6065
+ const filtered = segments.filter((s) => s.value > 0);
6066
+ const isEmpty = filtered.length === 0;
6067
+ const pieData = isEmpty ? [{ name: "Empty", value: 1, color: "var(--color-border)" }] : filtered;
6068
+ return /* @__PURE__ */ jsxs(Stack, { gap: 6, align: "center", children: [
6069
+ title && /* @__PURE__ */ jsx(
6070
+ Text,
5859
6071
  {
5860
- bullet: /* @__PURE__ */ jsx(ThemeIcon, { size: 28, variant: "filled", color: "var(--color-primary)", radius: "xl", children: /* @__PURE__ */ jsx(Icon, { size: 14 }) }),
5861
- children: /* @__PURE__ */ jsxs(Stack, { gap: 2, children: [
5862
- /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: activity.title }),
5863
- activity.description && /* @__PURE__ */ jsx(Text, { size: "xs", c: "dimmed", children: activity.description }),
5864
- /* @__PURE__ */ jsxs(Text, { size: "xs", c: "dimmed", children: [
5865
- formatTimeAgo(activity.occurredAt),
5866
- activity.actor && ` by ${activity.actor}`
6072
+ size: "xs",
6073
+ fw: 600,
6074
+ style: { color: "var(--color-text)", letterSpacing: "0.03em", textTransform: "uppercase" },
6075
+ children: title
6076
+ }
6077
+ ),
6078
+ /* @__PURE__ */ jsxs(Box, { style: { width: size, height: size, position: "relative" }, children: [
6079
+ /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(PieChart, { children: [
6080
+ !isEmpty && /* @__PURE__ */ jsx("defs", { children: filtered.map((_, i) => /* @__PURE__ */ jsxs("filter", { id: `${glowId}-${i}`, x: "-20%", y: "-20%", width: "140%", height: "140%", children: [
6081
+ /* @__PURE__ */ jsx("feGaussianBlur", { in: "SourceGraphic", stdDeviation: "2", result: "blur" }),
6082
+ /* @__PURE__ */ jsxs("feMerge", { children: [
6083
+ /* @__PURE__ */ jsx("feMergeNode", { in: "blur" }),
6084
+ /* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
5867
6085
  ] })
5868
- ] })
5869
- },
5870
- index
5871
- );
5872
- }) }) });
5873
- }
5874
- function SystemReadinessAlert({
5875
- ready,
5876
- actionLabel,
5877
- fallbackNote,
5878
- reason,
5879
- serverError
5880
- }) {
5881
- if (ready && !serverError) return null;
5882
- const primaryIssue = serverError?.issues[0];
5883
- const remedy = primaryIssue ? resolveReadinessRemedy(primaryIssue) : void 0;
5884
- return /* @__PURE__ */ jsx(Alert, { icon: /* @__PURE__ */ jsx(IconAlertCircle, { size: 16 }), color: "yellow", variant: "light", children: /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
5885
- /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
5886
- actionLabel,
5887
- " are disabled until System Interface readiness passes.",
5888
- fallbackNote ? ` ${fallbackNote}` : "",
5889
- reason ? ` ${reason}` : ""
6086
+ ] }, i)) }),
6087
+ /* @__PURE__ */ jsx(
6088
+ Pie,
6089
+ {
6090
+ data: pieData,
6091
+ cx: "50%",
6092
+ cy: "50%",
6093
+ innerRadius,
6094
+ outerRadius,
6095
+ paddingAngle: isEmpty ? 0 : 3,
6096
+ dataKey: "value",
6097
+ stroke: "none",
6098
+ animationBegin: 100,
6099
+ animationDuration: 1e3,
6100
+ animationEasing: "ease-out",
6101
+ isAnimationActive: !isEmpty,
6102
+ children: pieData.map((entry, i) => /* @__PURE__ */ jsx(
6103
+ Cell,
6104
+ {
6105
+ fill: entry.color,
6106
+ style: {
6107
+ filter: isEmpty ? void 0 : `url(#${glowId}-${i})`,
6108
+ fillOpacity: isEmpty ? 0.3 : 0.9
6109
+ }
6110
+ },
6111
+ entry.name
6112
+ ))
6113
+ }
6114
+ ),
6115
+ !isEmpty && /* @__PURE__ */ jsx(Tooltip$1, { content: /* @__PURE__ */ jsx(CyberDonutTooltip, { colors }) })
6116
+ ] }) }),
6117
+ /* @__PURE__ */ jsxs(
6118
+ "div",
6119
+ {
6120
+ style: {
6121
+ position: "absolute",
6122
+ top: "50%",
6123
+ left: "50%",
6124
+ transform: "translate(-50%, -50%)",
6125
+ textAlign: "center",
6126
+ pointerEvents: "none"
6127
+ },
6128
+ children: [
6129
+ /* @__PURE__ */ jsx(
6130
+ "div",
6131
+ {
6132
+ style: {
6133
+ fontSize: 18,
6134
+ fontWeight: 700,
6135
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
6136
+ color: centerValueColor,
6137
+ lineHeight: 1
6138
+ },
6139
+ children: isLoading ? "-" : centerValue
6140
+ }
6141
+ ),
6142
+ /* @__PURE__ */ jsx(
6143
+ "div",
6144
+ {
6145
+ style: {
6146
+ fontSize: 8,
6147
+ color: "var(--mantine-color-dimmed)",
6148
+ letterSpacing: "0.05em",
6149
+ textTransform: "uppercase",
6150
+ marginTop: 2
6151
+ },
6152
+ children: centerLabel
6153
+ }
6154
+ )
6155
+ ]
6156
+ }
6157
+ )
5890
6158
  ] }),
5891
- serverError?.issues.length ? /* @__PURE__ */ jsx(Stack, { gap: 2, children: serverError.issues.map((issue, index) => /* @__PURE__ */ jsxs(Text, { size: "sm", children: [
5892
- /* @__PURE__ */ jsxs(Text, { span: true, fw: 600, children: [
5893
- issue.family,
5894
- ":"
5895
- ] }),
5896
- " ",
5897
- issue.message
5898
- ] }, `${issue.family}-${issue.code}-${index}`)) }) : null,
5899
- remedy ? /* @__PURE__ */ jsx(Text, { size: "sm", fw: 500, children: remedy }) : null
5900
- ] }) });
6159
+ showLegend && /* @__PURE__ */ jsx(Stack, { gap: 4, style: { width: "100%" }, children: segments.map((seg) => /* @__PURE__ */ jsxs(Group, { gap: "xs", justify: "space-between", px: "xs", children: [
6160
+ /* @__PURE__ */ jsx(CyberLegendItem, { color: seg.color, label: seg.name }),
6161
+ /* @__PURE__ */ jsx(
6162
+ Text,
6163
+ {
6164
+ size: "xs",
6165
+ fw: 600,
6166
+ style: {
6167
+ fontFamily: "var(--mantine-font-family-monospace, monospace)",
6168
+ fontVariantNumeric: "tabular-nums"
6169
+ },
6170
+ children: isLoading ? "-" : seg.value
6171
+ }
6172
+ )
6173
+ ] }, seg.name)) })
6174
+ ] });
5901
6175
  }
5902
6176
  var GRANULARITY_MAP = {
5903
6177
  "1h": "hour",
@@ -6053,7 +6327,7 @@ function CostTrendChart({ data, summaryData, isLoading, error }) {
6053
6327
  " ",
6054
6328
  /* @__PURE__ */ jsx(NumberFormatter, { prefix: "$", value: projectedMonthlyCost, thousandSeparator: true, decimalScale: 2 })
6055
6329
  ] }),
6056
- /* @__PURE__ */ jsx(Tooltip$1, { label: `Projection confidence: ${confidence}`, children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 12, color: "var(--color-text-subtle)" }) })
6330
+ /* @__PURE__ */ jsx(Tooltip, { label: `Projection confidence: ${confidence}`, children: /* @__PURE__ */ jsx(IconInfoCircle, { size: 12, color: "var(--color-text-subtle)" }) })
6057
6331
  ] }),
6058
6332
  /* @__PURE__ */ jsxs(
6059
6333
  Text,
@@ -6654,11 +6928,11 @@ function useResources() {
6654
6928
  }
6655
6929
  function CheckpointGroup({ name, count, isActive, onClick }) {
6656
6930
  const theme = useMantineTheme();
6657
- const activeColor = theme.colors[theme.primaryColor][6];
6931
+ const activeColor2 = theme.colors[theme.primaryColor][6];
6658
6932
  const defaultTextColor = "var(--color-text)";
6659
- const textColor = isActive ? activeColor : defaultTextColor;
6933
+ const textColor = isActive ? activeColor2 : defaultTextColor;
6660
6934
  const fontWeight = isActive ? 600 : 500;
6661
- const activeBg = `color-mix(in srgb, ${activeColor} 10%, transparent)`;
6935
+ const activeBg2 = `color-mix(in srgb, ${activeColor2} 10%, transparent)`;
6662
6936
  return /* @__PURE__ */ jsx(
6663
6937
  UnstyledButton,
6664
6938
  {
@@ -6669,7 +6943,7 @@ function CheckpointGroup({ name, count, isActive, onClick }) {
6669
6943
  width: "100%",
6670
6944
  padding: theme.spacing.xs,
6671
6945
  borderRadius: theme.radius.sm,
6672
- backgroundColor: isActive ? activeBg : "transparent",
6946
+ backgroundColor: isActive ? activeBg2 : "transparent",
6673
6947
  transition: `all var(--duration-fast) var(--easing)`,
6674
6948
  cursor: "pointer"
6675
6949
  },
@@ -7359,12 +7633,7 @@ function TaskRow({ task, onClick }) {
7359
7633
  }
7360
7634
  );
7361
7635
  }
7362
- function MyTasksPanel({
7363
- onTaskClick,
7364
- onSeeAll,
7365
- footer,
7366
- showSectionLabel = true
7367
- }) {
7636
+ function MyTasksPanel({ onTaskClick, onSeeAll, footer, showSectionLabel = true }) {
7368
7637
  const { data, isLoading, isError } = useDealTasksDue({ window: "today_and_overdue" });
7369
7638
  const tasks = data ?? [];
7370
7639
  const total = tasks.length;
@@ -7641,6 +7910,43 @@ var leadGenManifest = {
7641
7910
  icon: IconTarget,
7642
7911
  sidebar: SalesSidebar
7643
7912
  };
7913
+ var SEOSidebarTop = () => {
7914
+ return /* @__PURE__ */ jsx(SubshellSidebarSection, { icon: IconSearch, label: "SEO" });
7915
+ };
7916
+ var NAV_ITEMS = [
7917
+ { label: "SEO Pages", to: "/seo", icon: IconChartBar, exact: true },
7918
+ { label: "Metrics", to: "/seo/metrics", icon: IconTrendingUp, exact: false }
7919
+ ];
7920
+ var SEOSidebarMiddle = () => {
7921
+ const { currentPath, navigate } = useRouterContext();
7922
+ return /* @__PURE__ */ jsx(Stack, { gap: "xs", p: "sm", style: { flex: 1, overflowY: "auto" }, children: NAV_ITEMS.map((item) => {
7923
+ const isActive = item.exact ? currentPath === item.to || currentPath === `${item.to}/` : currentPath.startsWith(item.to);
7924
+ return /* @__PURE__ */ jsx(
7925
+ SubshellNavItem,
7926
+ {
7927
+ icon: item.icon,
7928
+ label: item.label,
7929
+ isActive,
7930
+ href: item.to,
7931
+ onClick: () => navigate(item.to)
7932
+ },
7933
+ item.to
7934
+ );
7935
+ }) });
7936
+ };
7937
+ var SEOSidebar = () => {
7938
+ return /* @__PURE__ */ jsxs(Stack, { gap: 0, style: { height: "100%", display: "flex", flexDirection: "column" }, children: [
7939
+ /* @__PURE__ */ jsx(SEOSidebarTop, {}),
7940
+ /* @__PURE__ */ jsx(SEOSidebarMiddle, {})
7941
+ ] });
7942
+ };
7943
+
7944
+ // src/features/seo/manifest.ts
7945
+ var seoManifest = {
7946
+ key: "seo",
7947
+ systemId: "seo",
7948
+ sidebar: SEOSidebar
7949
+ };
7644
7950
  var deliveryManifest = {
7645
7951
  key: "delivery",
7646
7952
  systemId: PROJECTS_SYSTEM_ID,
@@ -8045,6 +8351,7 @@ var DEFAULT_ORGANIZATION_GRAPH_FILTERS = {
8045
8351
  showIntegrations: true,
8046
8352
  domainFilters: {}
8047
8353
  };
8354
+ var ORGANIZATION_NODE_ID = "organization-model";
8048
8355
 
8049
8356
  // src/hooks/operations/shared/queryKeys.ts
8050
8357
  var operationsKeys = {
@@ -8614,7 +8921,16 @@ var ExecutionLogsSidebar = () => {
8614
8921
  label: "Recent Executions",
8615
8922
  rightSection: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
8616
8923
  runningCount > 0 && /* @__PURE__ */ jsx(Badge, { variant: "filled", size: "sm", children: runningCount }),
8617
- filteredExecutions.length > 0 && /* @__PURE__ */ jsx(ActionIcon, { onClick: () => setDeleteModalOpen(true), variant: "subtle", color: "var(--color-error)", size: "sm", children: /* @__PURE__ */ jsx(IconTrash, { size: 16 }) })
8924
+ filteredExecutions.length > 0 && /* @__PURE__ */ jsx(
8925
+ ActionIcon,
8926
+ {
8927
+ onClick: () => setDeleteModalOpen(true),
8928
+ variant: "subtle",
8929
+ color: "var(--color-error)",
8930
+ size: "sm",
8931
+ children: /* @__PURE__ */ jsx(IconTrash, { size: 16 })
8932
+ }
8933
+ )
8618
8934
  ] })
8619
8935
  }
8620
8936
  ),
@@ -8819,7 +9135,8 @@ function filterSystems(model, searchQuery, statusFilter, resourceKinds, rollupMo
8819
9135
  return { path, system, metrics, resources };
8820
9136
  }).filter((entry) => {
8821
9137
  if (statusFilter !== "all" && statusForCounts(entry.metrics.resourceCount) !== statusFilter) return false;
8822
- if (resourceKinds.length > 0 && !entry.resources.some((resource) => resourceKinds.includes(resource.kind))) return false;
9138
+ if (resourceKinds.length > 0 && !entry.resources.some((resource) => resourceKinds.includes(resource.kind)))
9139
+ return false;
8823
9140
  if (!query) return true;
8824
9141
  const haystack = [
8825
9142
  entry.path,
@@ -8971,7 +9288,17 @@ function SystemsSidebar() {
8971
9288
  /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
8972
9289
  /* @__PURE__ */ jsx(Button, { component: "a", href: "/operations/resources", variant: "subtle", size: "xs", justify: "flex-start", children: "Resources" }),
8973
9290
  /* @__PURE__ */ jsx(Button, { component: "a", href: "/knowledge/command-view", variant: "subtle", size: "xs", justify: "flex-start", children: "Command View" }),
8974
- /* @__PURE__ */ jsx(Button, { component: "a", href: activePath ? `/knowledge/by-system/${activePath}` : "/knowledge", variant: "subtle", size: "xs", justify: "flex-start", children: "Knowledge" })
9291
+ /* @__PURE__ */ jsx(
9292
+ Button,
9293
+ {
9294
+ component: "a",
9295
+ href: activePath ? `/knowledge/by-system/${activePath}` : "/knowledge",
9296
+ variant: "subtle",
9297
+ size: "xs",
9298
+ justify: "flex-start",
9299
+ children: "Knowledge"
9300
+ }
9301
+ )
8975
9302
  ] })
8976
9303
  ] }) })
8977
9304
  ] });
@@ -9305,7 +9632,6 @@ function useInFlightExecutions(resourceId, options = {}) {
9305
9632
  refetchInterval: options.refetchInterval
9306
9633
  });
9307
9634
  }
9308
- var REFETCH_INTERVAL_RUNNING = 2e3;
9309
9635
  function useExecution(resourceId, executionId) {
9310
9636
  const { apiRequest, workOSOrganizationId, isReady } = useElevasisServices();
9311
9637
  return useQuery({
@@ -9314,7 +9640,7 @@ function useExecution(resourceId, executionId) {
9314
9640
  enabled: isReady && !!resourceId && !!executionId,
9315
9641
  refetchInterval: (query) => {
9316
9642
  const data = query.state.data;
9317
- return data?.status === "running" ? REFETCH_INTERVAL_RUNNING : false;
9643
+ return isExecutionInFlight(data?.status) ? REFETCH_INTERVAL_RUNNING : false;
9318
9644
  }
9319
9645
  });
9320
9646
  }
@@ -13125,7 +13451,7 @@ function TrailingCopySlot({ command, label, showCopy, favorite, hovered, concept
13125
13451
  );
13126
13452
  }
13127
13453
  function ConceptInfoControl({ description }) {
13128
- return /* @__PURE__ */ jsx(Tooltip$1, { label: description, withArrow: true, multiline: true, maw: 260, position: "right", openDelay: 200, children: /* @__PURE__ */ jsx(
13454
+ return /* @__PURE__ */ jsx(Tooltip, { label: description, withArrow: true, multiline: true, maw: 260, position: "right", openDelay: 200, children: /* @__PURE__ */ jsx(
13129
13455
  "span",
13130
13456
  {
13131
13457
  "aria-label": "Concept definition",
@@ -13568,7 +13894,7 @@ function RequestActionIcon({
13568
13894
  }) {
13569
13895
  const [opened, { open, close }] = useDisclosure(false);
13570
13896
  return /* @__PURE__ */ jsxs(Fragment, { children: [
13571
- /* @__PURE__ */ jsx(Tooltip$1, { label: tooltip, children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", onClick: open, "aria-label": tooltip, children: /* @__PURE__ */ jsx(IconMessagePlus, { size: 18, color: "var(--color-text-subtle)" }) }) }),
13897
+ /* @__PURE__ */ jsx(Tooltip, { label: tooltip, children: /* @__PURE__ */ jsx(ActionIcon, { variant: "subtle", onClick: open, "aria-label": tooltip, children: /* @__PURE__ */ jsx(IconMessagePlus, { size: 18, color: "var(--color-text-subtle)" }) }) }),
13572
13898
  /* @__PURE__ */ jsx(RequestModal, { opened, onClose: close, affectedPage })
13573
13899
  ] });
13574
13900
  }
@@ -13887,12 +14213,12 @@ function SystemShell({ children }) {
13887
14213
  return /* @__PURE__ */ jsx(Fragment, { children });
13888
14214
  }
13889
14215
  const SidebarComponent = routeMatch.system.sidebar;
13890
- const sidebarWidth = typeof routeMatch.system.sidebarWidth === "function" ? routeMatch.system.sidebarWidth({ currentPath }) : routeMatch.system.sidebarWidth ?? defaultSystemSidebarWidth;
13891
- if (sidebarWidth === 0) {
14216
+ const sidebarWidth2 = typeof routeMatch.system.sidebarWidth === "function" ? routeMatch.system.sidebarWidth({ currentPath }) : routeMatch.system.sidebarWidth ?? defaultSystemSidebarWidth;
14217
+ if (sidebarWidth2 === 0) {
13892
14218
  return /* @__PURE__ */ jsx(Fragment, { children });
13893
14219
  }
13894
14220
  return /* @__PURE__ */ jsxs(SubshellContainer, { children: [
13895
- /* @__PURE__ */ jsx(SubshellSidebar, { width: sidebarWidth, children: /* @__PURE__ */ jsx(SidebarComponent, {}) }),
14221
+ /* @__PURE__ */ jsx(SubshellSidebar, { width: sidebarWidth2, children: /* @__PURE__ */ jsx(SidebarComponent, {}) }),
13896
14222
  /* @__PURE__ */ jsx(SubshellRightSideContainer, { children })
13897
14223
  ] });
13898
14224
  }
@@ -13976,13 +14302,10 @@ function ElevasisUIProvider({ theme, children, ...coreProps }) {
13976
14302
  }
13977
14303
  );
13978
14304
  }
13979
- function createTestSystemsProvider({
13980
- organizationModel,
13981
- systems = []
13982
- } = {}) {
14305
+ function createTestSystemsProvider({ organizationModel, systems = [] } = {}) {
13983
14306
  return function TestSystemsProvider({ children }) {
13984
14307
  return /* @__PURE__ */ jsx(ElevasisSystemsProvider, { systems, organizationModel, children });
13985
14308
  };
13986
14309
  }
13987
14310
 
13988
- export { APIErrorAlert, AccessGuard, AccessKeys, ActivityTimeline, ActivityTrendChart, AgentResourceEntrySchema, AppearanceContext, AppearanceProvider, CONTENT_ITEMS, CRM_ITEMS, CenteredErrorState, ChartFrame, CheckpointGroup, CollapsibleSection, CombinedTrendChart, CommandQueueSidebar, CommandQueueSidebarMiddle, CommandQueueSidebarTop, ConfirmationInputModal, ConfirmationModal, ContentSidebar, ContentSidebarMiddle, ContextViewer, CostTrendChart, CrmActionsProvider, CrmSidebarMiddle, CustomModal, CustomSelector, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, DEFAULT_CONTENT_VOCABULARY, DEFAULT_ORGANIZATION_GRAPH_FILTERS, DEFAULT_WAIT_FOR_ORGANIZATION, DetailCardSkeleton, EMPTY_LIST_ACTIONS, ElevasisCoreProvider, ElevasisLoader, ElevasisSystemsProvider, ElevasisUIProvider, EmptyState, FILTERABLE_DOMAIN_KEYS, FeatureUnavailableState, GlowDot, HeroStatsRow, IdentityDomainSchema, IntegrationResourceEntrySchema, JsonViewer, KNOWLEDGE_DOMAINS_WITH_PANELS, KNOWLEDGE_ICON_TOKEN_BY_KIND, KnowledgeSearchBar, KnowledgeTree, LEAD_GEN_ITEMS, LeadGenSidebarMiddle, ListActionsProvider, ListSkeleton, MyReviewQueuePanel, MyTasksPanel, NavigationButton, NoAccessState, NotificationProvider, OM_NESTED_TREE_GROUPS, OM_TREE_GROUPS, ORGANIZATION_GRAPH_EDGE_KIND_LABELS, ORGANIZATION_GRAPH_EDGE_KIND_MEANINGS, ORGANIZATION_GRAPH_NODE_KIND_DETAIL_LABELS, ORGANIZATION_GRAPH_NODE_KIND_LABELS, ORGANIZATION_GRAPH_NODE_KIND_MEANINGS, ORGANIZATION_GRAPH_NODE_KIND_ORDER, OperationsService, OperationsSidebar, OperationsSidebarMiddle, OperationsSidebarTop, OrganizationModelDriftActionIcon, PageNotFound, PageTitleCaption, ProtectedRoute, QuickCreateActions, RequestActionIcon, RequestModal, ResourceCard, ResourcesSidebar, RoleSchema, SAVED_VIEW_PRESETS, SYSTEM_RESOURCE_KINDS, SavedViewsPanel, ScriptResourceEntrySchema, SemanticIcon, SessionListItem, SessionsSidebar, StatCard, StatCardSkeleton, StatsCardSkeleton, StatusBadge, SubshellContainer, SubshellContentContainer, SubshellRightSideContainer, SubshellSidebar, SubshellSidebarLoader, SurfaceDefinitionSchema, SystemReadinessAlert, SystemShell, SystemUnavailableState, TabCountBadge, TimeRangeSelector, TrendIndicator, WorkflowResourceEntrySchema, acquisitionListKeys, aggregateSystemMetrics, buildKnowledgeOmTreeData, buildOrganizationGraph, clientsManifest, collectResourceFilterFacets, computeProtectedRouteGate, contentKeys, contentManifest, createTestSystemsProvider, crmManifest, dealKeys, dealTaskKeys, deliveryManifest, deriveContentBoard, executionsKeys, extendSemanticIconRegistry, filterByDomainFilters, findKnowledgeTreeNodeByValue, findListActionByAction, findOmTreeGroup, formatResourceAttribution, getAllBuildTemplates, getConceptDefinition, getContentItemIdentity, getCrmPipelineCatalog, getKnowledgeDomainFolderCommand, getKnowledgeGraphNodeCommand, getKnowledgeIconToken, getKnowledgeNodeReadCommand, getKnowledgeOntologyProjection, getKnowledgeTreeFolderCommand, getLeadGenStageCatalog, getListActionWorkflowId, getOntologyDomainLabel, getPrimaryOntologyItemsForDomain, getResourceFilterFacetIds, getSemanticIconComponent, getSeriesColor, getSessionView, getSharedOrganizationGraph, isAwaitingReview, isSessionCapable, joinSourceAssetDetails, knowledgeManifest, labelResourceFilterFacet, leadGenManifest, monitoringManifest, normaliseConceptKey, observabilityKeys, operationsKeys, operationsManifest, pickCoverSourceAsset, pickLatestRunAt, projectNavigationGroups, projectNavigationSurfaces, readItemSourceAssets, requestTopbarActionManifest, requestsKeys, resolveContentStepResource, resolveContentVocabulary, resolveContentWorkspaceRoute, resolveCurrentContentStep, resolveReviewTarget, resolveSemanticIconComponent, selectDeclaredSystems, sessionsKeys, settingsManifest, submittedRequestsManifest, sumStatusCounts, useAccess, useAddContentItemSourceAsset, useAppearance, useArchiveSession, useArchivedLogs, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCommandQueue, useCommandQueueTask, useCommandQueueTotals, useCommandViewDomainFilters, useCompleteDealTask, useContentConfig, useContentDistribution, useContentDistributionMetrics, useContentDistributions, useContentItem, useContentItemAttempts, useContentItemSourceAssetDetails, useContentItemSourceAssets, useContentItems, useContentPipelineSummary, useContentSourceAsset, useContentSourceAssets, useCostBreakdown, useCostByModel, useCostTrends, useCreateContentDistribution, useCreateContentItem, useCreateContentSourceAsset, useCreateDealTask, useCreateList, useCreateSession, useCrmActions, useCyberColors, useDashboardMetrics, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteDeal, useDeleteExecution, useDeleteList, useDeleteSession, useDeleteTask, useElevasisSystems, useEndSession, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorTrends, useExecuteAsync, useExecuteResource, useExecution, useExecutionLogSSE, useExecutionPanelState, useExecutionSSE, useExecutions, useInFlightExecutions, useLeadGenActionRegistry, useLeadGenBulkActions, useLeadGenHeaderActions, useLeadGenRowActions, useList, useListActions, useListExecutions, useListProgress, useListRecords, useLists, useListsTelemetry, useNotificationAdapter, useOptionalElevasisSystems, useOrganizationModelDrift, usePaginationState, usePatchTask, useRecentExecutionsByResource, useRemoveContentItemSourceAsset, useReorderContentItemSourceAssets, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResolvedOrganizationModel, useResourceDefinition, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useRetryExecution, useReviewContentItem, useSSEConnection, useSession, useSessionCheck, useSessions, useStableAccessToken, useStatusFilter, useSubmitAction, useSubmitRequest, useSystemHealth, useSystemsViewState, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateContentDistribution, useUpdateContentItem, useUpdateContentItemSourceAsset, useUpdateContentSourceAsset, useUpdateList, useUpdateListConfig, useWorkflowExecution };
14311
+ export { APIErrorAlert, AccessGuard, AccessKeys, ActivityTimeline, ActivityTrendChart, AgentResourceEntrySchema, AppearanceContext, AppearanceProvider, CONTENT_ITEMS, CRM_ITEMS, CenteredErrorState, ChartFrame, CheckpointGroup, CollapsibleSection, CombinedTrendChart, CommandQueueSidebar, CommandQueueSidebarMiddle, CommandQueueSidebarTop, ConfirmationInputModal, ConfirmationModal, ContentSidebar, ContentSidebarMiddle, ContextViewer, CostTrendChart, CrmActionsProvider, CrmSidebarMiddle, CustomModal, CustomSelector, CyberAreaChart, CyberDonut, CyberDonutTooltip, CyberLegendItem, DEFAULT_CONTENT_VOCABULARY, DEFAULT_ORGANIZATION_GRAPH_FILTERS, DEFAULT_WAIT_FOR_ORGANIZATION, DetailCardSkeleton, EMPTY_LIST_ACTIONS, ElevasisCoreProvider, ElevasisLoader, ElevasisSystemsProvider, ElevasisUIProvider, EmptyState, FILTERABLE_DOMAIN_KEYS, FeatureUnavailableState, GlowDot, HeroStatsRow, IdentityDomainSchema, IntegrationResourceEntrySchema, JsonViewer, KNOWLEDGE_DOMAINS_WITH_PANELS, KNOWLEDGE_ICON_TOKEN_BY_KIND, KnowledgeSearchBar, KnowledgeTree, LEAD_GEN_ITEMS, LeadGenSidebarMiddle, ListActionsProvider, ListSkeleton, MyReviewQueuePanel, MyTasksPanel, NavigationButton, NoAccessState, NotificationProvider, OM_NESTED_TREE_GROUPS, OM_TREE_GROUPS, ORGANIZATION_GRAPH_EDGE_KIND_LABELS, ORGANIZATION_GRAPH_EDGE_KIND_MEANINGS, ORGANIZATION_GRAPH_NODE_KIND_DETAIL_LABELS, ORGANIZATION_GRAPH_NODE_KIND_LABELS, ORGANIZATION_GRAPH_NODE_KIND_MEANINGS, ORGANIZATION_GRAPH_NODE_KIND_ORDER, ORGANIZATION_NODE_ID, OperationsService, OperationsSidebar, OperationsSidebarMiddle, OperationsSidebarTop, OrganizationModelDriftActionIcon, OverviewList, OverviewListRow, PageNotFound, PageTitleCaption, ProtectedRoute, QuickCreateActions, RequestActionIcon, RequestModal, ResourceCard, ResourcesSidebar, RoleSchema, SAVED_VIEW_PRESETS, SEOSidebar, SEOSidebarMiddle, SEOSidebarTop, SYSTEM_RESOURCE_KINDS, SavedViewsPanel, ScriptResourceEntrySchema, SemanticIcon, SessionListItem, SessionsSidebar, StatCard, StatCardSkeleton, StatsCardSkeleton, StatusBadge, SubshellContainer, SubshellContentContainer, SubshellNavItem, SubshellRightSideContainer, SubshellSidebar, SubshellSidebarLoader, SubshellSidebarSection, SurfaceDefinitionSchema, SystemReadinessAlert, SystemShell, SystemUnavailableState, TERMINAL_EXECUTION_STATUSES, TabCountBadge, TimeRangeSelector, TrendIndicator, WorkflowResourceEntrySchema, acquisitionListKeys, aggregateSystemMetrics, buildKnowledgeOmTreeData, buildOrganizationGraph, clientsManifest, collectResourceFilterFacets, computeProtectedRouteGate, contentKeys, contentManifest, createTestSystemsProvider, crmManifest, dealKeys, dealTaskKeys, deliveryManifest, deriveContentBoard, executionsKeys, extendSemanticIconRegistry, filterByDomainFilters, findKnowledgeTreeNodeByValue, findListActionByAction, findOmTreeGroup, formatResourceAttribution, getAllBuildTemplates, getConceptDefinition, getContentItemIdentity, getCrmPipelineCatalog, getKnowledgeDomainFolderCommand, getKnowledgeGraphNodeCommand, getKnowledgeIconToken, getKnowledgeNodeReadCommand, getKnowledgeOntologyProjection, getKnowledgeTreeFolderCommand, getLeadGenStageCatalog, getListActionWorkflowId, getOntologyDomainLabel, getPrimaryOntologyItemsForDomain, getResourceFilterFacetIds, getSemanticIconComponent, getSeriesColor, getSessionView, getSharedOrganizationGraph, isAwaitingReview, isExecutionInFlight, isSessionCapable, joinSourceAssetDetails, knowledgeManifest, labelResourceFilterFacet, leadGenManifest, monitoringManifest, normaliseConceptKey, observabilityKeys, operationsKeys, operationsManifest, pickCoverSourceAsset, pickLatestRunAt, projectNavigationGroups, projectNavigationSurfaces, readItemSourceAssets, requestTopbarActionManifest, requestsKeys, resolveContentStepResource, resolveContentVocabulary, resolveContentWorkspaceRoute, resolveCurrentContentStep, resolveReviewTarget, resolveSemanticIconComponent, selectDeclaredSystems, seoManifest, sessionsKeys, settingsManifest, sidebarBottomSectionCollapsedHeight, sidebarBottomSectionHeight, sidebarCollapsedWidth, sidebarGroupChevronSize, sidebarHoverDelay, sidebarIconInnerSize, sidebarIconSize, sidebarIconStroke, sidebarItemGap, sidebarItemHeight, sidebarItemPadding, sidebarSectionPadding, sidebarSubLinkIndent, sidebarSubLinkPaddingX, sidebarSubLinkPaddingY, sidebarToggleIconSize, sidebarTransitionDuration, sidebarWidth, submittedRequestsManifest, subshellNavItemIconSize, sumStatusCounts, topbarHeight, useAccess, useAddContentItemSourceAsset, useAppearance, useArchiveSession, useArchivedLogs, useBatchedResourcesHealth, useBulkDeleteExecutions, useBusinessImpact, useCancelExecution, useCommandQueue, useCommandQueueTask, useCommandQueueTotals, useCommandViewDomainFilters, useCompleteDealTask, useContentConfig, useContentDistribution, useContentDistributionMetrics, useContentDistributions, useContentItem, useContentItemAttempts, useContentItemSourceAssetDetails, useContentItemSourceAssets, useContentItems, useContentPipelineSummary, useContentSourceAsset, useContentSourceAssets, useCostBreakdown, useCostByModel, useCostTrends, useCreateContentDistribution, useCreateContentItem, useCreateContentSourceAsset, useCreateDealTask, useCreateList, useCreateSession, useCrmActions, useCyberColors, useDashboardMetrics, useDealTasks, useDealTasksDue, useDeals, useDealsLookup, useDealsSummary, useDeleteDeal, useDeleteExecution, useDeleteList, useDeleteSession, useDeleteTask, useElevasisSystems, useEndSession, useErrorAnalysis, useErrorDetail, useErrorDetails, useErrorDistribution, useErrorTrends, useExecuteAsync, useExecuteResource, useExecution, useExecutionLogSSE, useExecutionPanelState, useExecutionSSE, useExecutions, useInFlightExecutions, useLeadGenActionRegistry, useLeadGenBulkActions, useLeadGenHeaderActions, useLeadGenRowActions, useList, useListActions, useListExecutions, useListProgress, useListRecords, useLists, useListsTelemetry, useNotificationAdapter, useOptionalElevasisSystems, useOrganizationModelDrift, usePaginationState, usePatchTask, useRecentExecutionsByResource, useRemoveContentItemSourceAsset, useReorderContentItemSourceAssets, useResolveAllErrors, useResolveError, useResolveErrorsByExecution, useResolvedOrganizationModel, useResourceDefinition, useResourceSearch, useResources, useResourcesDomainFilters, useResourcesHealth, useRetryExecution, useReviewContentItem, useSSEConnection, useSession, useSessionCheck, useSessions, useStableAccessToken, useStatusFilter, useSubmitAction, useSubmitRequest, useSystemHealth, useSystemsViewState, useTopFailingResources, useUnresolveError, useUnresolvedErrors, useUpdateContentDistribution, useUpdateContentItem, useUpdateContentItemSourceAsset, useUpdateContentSourceAsset, useUpdateList, useUpdateListConfig, useWorkflowExecution };