@elevasis/ui 2.31.0 → 2.33.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 (169) hide show
  1. package/dist/{CoreAuthKitInner-KSEGSB67.js → CoreAuthKitInner-QC62UHTZ.js} +1 -1
  2. package/dist/api/index.js +3 -3
  3. package/dist/app/index.css +38 -0
  4. package/dist/app/index.d.ts +69 -9
  5. package/dist/app/index.js +7 -6
  6. package/dist/auth/context.js +1 -1
  7. package/dist/auth/index.js +1 -1
  8. package/dist/charts/index.js +5 -6
  9. package/dist/{chunk-JKSUN5GN.js → chunk-2GMF5IRF.js} +81 -746
  10. package/dist/{chunk-XQHZBA65.js → chunk-2RJMVWFJ.js} +1 -6
  11. package/dist/{chunk-CW3UNAF2.js → chunk-4DYOXEH6.js} +410 -5
  12. package/dist/{chunk-HQGF4ATG.js → chunk-52NLZN6Z.js} +118 -141
  13. package/dist/chunk-AHCKOU2M.js +13 -0
  14. package/dist/chunk-CLDCYJQT.js +1 -0
  15. package/dist/chunk-DWXDNT7P.js +145 -0
  16. package/dist/chunk-E4T2N7P7.js +124 -0
  17. package/dist/{chunk-HYNYEBHM.js → chunk-E7C4XEWH.js} +3 -3
  18. package/dist/{chunk-L3BVJWML.js → chunk-EPTHX4VZ.js} +1 -1
  19. package/dist/{chunk-QDEETKYT.js → chunk-FFPHJBJC.js} +9 -9
  20. package/dist/chunk-GNRMB6DC.js +5126 -0
  21. package/dist/{chunk-DZTG5IAC.js → chunk-I2KLQ2HA.js} +1 -7
  22. package/dist/{chunk-Q6OYNEGR.js → chunk-IUKFNASA.js} +5 -6
  23. package/dist/{chunk-QHEWXU7I.js → chunk-JFL3GRD4.js} +1 -1
  24. package/dist/{chunk-T3IPHEYJ.js → chunk-JHT5JIJ3.js} +4410 -566
  25. package/dist/{chunk-L2NVFLXU.js → chunk-MHLZ4F4N.js} +4 -4
  26. package/dist/{chunk-XQQEKWTL.js → chunk-N55DVMAG.js} +6 -2
  27. package/dist/{chunk-TOIXUWR6.js → chunk-ND5TDV2J.js} +1 -1
  28. package/dist/{chunk-5LJAEZMA.js → chunk-NOIRGGW2.js} +5 -6
  29. package/dist/{chunk-7KC4P3AU.js → chunk-QNOVUCSV.js} +2 -12
  30. package/dist/{chunk-3BAPR3KA.js → chunk-RQA2EVN3.js} +5 -15
  31. package/dist/{chunk-ND42LPY4.js → chunk-TKF5S4XP.js} +6 -6
  32. package/dist/{chunk-DWK2QIAK.js → chunk-TYRUKGGD.js} +1 -1
  33. package/dist/{chunk-Y4FWCG7Y.js → chunk-UVFOURXR.js} +8 -7
  34. package/dist/chunk-UW7IV2Y3.js +447 -0
  35. package/dist/{chunk-P55BJZZW.js → chunk-V6SZ4ECN.js} +20 -5
  36. package/dist/{chunk-6YT4IKJ7.js → chunk-VNAZTCHA.js} +15 -0
  37. package/dist/chunk-XG57WXOL.js +85 -0
  38. package/dist/{chunk-SHQXMW4F.js → chunk-XOFSMJLF.js} +46 -28
  39. package/dist/{chunk-7HMCB26R.js → chunk-XZGSCABI.js} +1 -1
  40. package/dist/chunk-YAQ25UNM.js +2126 -0
  41. package/dist/chunk-ZGTDKH3P.js +467 -0
  42. package/dist/components/chat/index.js +1 -1
  43. package/dist/components/index.css +38 -0
  44. package/dist/components/index.d.ts +262 -51
  45. package/dist/components/index.js +37 -39
  46. package/dist/components/navigation/index.css +38 -0
  47. package/dist/components/navigation/index.js +5 -3
  48. package/dist/execution/index.d.ts +11 -2
  49. package/dist/execution/index.js +1 -1
  50. package/dist/features/auth/index.css +38 -0
  51. package/dist/features/auth/index.d.ts +91 -14
  52. package/dist/features/auth/index.js +42 -10
  53. package/dist/features/clients/index.css +38 -0
  54. package/dist/features/clients/index.d.ts +1 -1
  55. package/dist/features/clients/index.js +17 -15
  56. package/dist/features/crm/index.css +38 -0
  57. package/dist/features/crm/index.d.ts +80 -18
  58. package/dist/features/crm/index.js +17 -15
  59. package/dist/features/dashboard/index.css +38 -0
  60. package/dist/features/dashboard/index.d.ts +174 -25
  61. package/dist/features/dashboard/index.js +17 -16
  62. package/dist/features/delivery/index.css +38 -0
  63. package/dist/features/delivery/index.d.ts +80 -18
  64. package/dist/features/delivery/index.js +16 -15
  65. package/dist/features/knowledge/index.css +38 -0
  66. package/dist/features/knowledge/index.d.ts +20 -18
  67. package/dist/features/knowledge/index.js +114 -609
  68. package/dist/features/lead-gen/index.css +38 -0
  69. package/dist/features/lead-gen/index.d.ts +45 -43
  70. package/dist/features/lead-gen/index.js +17 -16
  71. package/dist/features/monitoring/index.css +38 -0
  72. package/dist/features/monitoring/index.d.ts +20 -18
  73. package/dist/features/monitoring/index.js +18 -17
  74. package/dist/features/monitoring/requests/index.css +38 -0
  75. package/dist/features/monitoring/requests/index.d.ts +23 -21
  76. package/dist/features/monitoring/requests/index.js +16 -14
  77. package/dist/features/operations/index.css +38 -0
  78. package/dist/features/operations/index.d.ts +1299 -66
  79. package/dist/features/operations/index.js +22 -24
  80. package/dist/features/seo/index.d.ts +20 -18
  81. package/dist/features/seo/index.js +2 -2
  82. package/dist/features/settings/index.css +38 -0
  83. package/dist/features/settings/index.d.ts +80 -18
  84. package/dist/features/settings/index.js +17 -15
  85. package/dist/graph/index.js +1 -1
  86. package/dist/hooks/delivery/index.css +38 -0
  87. package/dist/hooks/delivery/index.d.ts +60 -0
  88. package/dist/hooks/delivery/index.js +3 -3
  89. package/dist/hooks/index.css +38 -0
  90. package/dist/hooks/index.d.ts +492 -89
  91. package/dist/hooks/index.js +15 -13
  92. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +332 -33
  93. package/dist/hooks/operations/command-view/utils/transformCommandViewData.js +1 -1
  94. package/dist/hooks/published.css +38 -0
  95. package/dist/hooks/published.d.ts +492 -89
  96. package/dist/hooks/published.js +15 -13
  97. package/dist/index.css +38 -0
  98. package/dist/index.d.ts +1353 -1349
  99. package/dist/index.js +16 -14
  100. package/dist/initialization/index.d.ts +60 -0
  101. package/dist/initialization/index.js +1 -1
  102. package/dist/knowledge/index.d.ts +1217 -1292
  103. package/dist/knowledge/index.js +6538 -2198
  104. package/dist/knowledge-search-index-P7PR626V.js +1514 -0
  105. package/dist/layout/index.js +3 -4
  106. package/dist/organization/index.css +38 -0
  107. package/dist/organization/index.js +1 -1
  108. package/dist/profile/index.d.ts +60 -0
  109. package/dist/profile/index.js +1 -1
  110. package/dist/provider/ElevasisServiceContext.js +1 -1
  111. package/dist/provider/index.css +38 -0
  112. package/dist/provider/index.d.ts +1068 -1246
  113. package/dist/provider/index.js +12 -10
  114. package/dist/provider/published.css +38 -0
  115. package/dist/provider/published.d.ts +1065 -1243
  116. package/dist/provider/published.js +9 -7
  117. package/dist/router/context.js +1 -1
  118. package/dist/router/index.js +1 -1
  119. package/dist/sse/index.js +1 -1
  120. package/dist/supabase/index.d.ts +117 -0
  121. package/dist/supabase/index.js +1 -1
  122. package/dist/test-utils/index.d.ts +16 -9
  123. package/dist/test-utils/index.js +40 -33
  124. package/dist/test-utils/setup-integration.js +1 -1
  125. package/dist/test-utils/setup.js +1 -1
  126. package/dist/theme/index.js +3 -3
  127. package/dist/theme/presets/index.js +1 -1
  128. package/dist/typeform/index.js +1 -1
  129. package/dist/typeform/schemas.js +1 -1
  130. package/dist/types/index.d.ts +394 -35
  131. package/dist/utils/index.d.ts +174 -25
  132. package/dist/utils/index.js +2 -2
  133. package/dist/vite/index.js +1 -1
  134. package/dist/vite-plugin-knowledge/index.js +1 -1
  135. package/dist/zustand/index.js +1 -1
  136. package/package.json +10 -9
  137. package/src/README.md +29 -29
  138. package/src/api/README.md +18 -18
  139. package/src/app/README.md +24 -24
  140. package/src/auth/README.md +18 -18
  141. package/src/components/README.md +24 -24
  142. package/src/execution/README.md +16 -16
  143. package/src/features/README.md +28 -28
  144. package/src/graph/README.md +16 -16
  145. package/src/hooks/README.md +23 -23
  146. package/src/initialization/README.md +19 -19
  147. package/src/knowledge/README.md +31 -31
  148. package/src/organization/README.md +18 -18
  149. package/src/profile/README.md +19 -19
  150. package/src/provider/README.md +32 -32
  151. package/src/router/README.md +18 -18
  152. package/src/sse/README.md +13 -13
  153. package/src/test-utils/README.md +7 -7
  154. package/src/theme/README.md +23 -23
  155. package/src/theme/presets/README.md +19 -19
  156. package/src/types/README.md +16 -16
  157. package/src/utils/README.md +18 -18
  158. package/src/zustand/README.md +18 -18
  159. package/dist/chunk-542WPQU2.js +0 -413
  160. package/dist/chunk-6IXOKUBC.js +0 -347
  161. package/dist/chunk-CQZ3DNQY.js +0 -740
  162. package/dist/chunk-ECNNI3NT.js +0 -6
  163. package/dist/chunk-GRDLB6LM.js +0 -160
  164. package/dist/chunk-JDNEWB5F.js +0 -10
  165. package/dist/chunk-MVFCLZSK.js +0 -4337
  166. package/dist/chunk-O2QOPJI5.js +0 -2235
  167. package/dist/chunk-OAVTMITG.js +0 -13
  168. package/dist/chunk-TVRQ6AQI.js +0 -476
  169. package/dist/chunk-WF227UBV.js +0 -48
@@ -0,0 +1,467 @@
1
+ import { getSemanticIconComponent } from './chunk-DWXDNT7P.js';
2
+ import { devOnlyFor, requiresAdminFor, topLevel, parentOf, ancestorsOf, childrenOf, findById, findByPath, listAllSystems, defaultPathFor, getSortedSidebarEntries } from './chunk-GNRMB6DC.js';
3
+ import { useInitialization } from './chunk-533DUEQY.js';
4
+ import { useOrganization } from './chunk-DD3CCMCZ.js';
5
+ import { createContext, useMemo, useCallback, useContext } from 'react';
6
+ import { jsx } from 'react/jsx-runtime';
7
+
8
+ function createFeatureAccessHook({
9
+ useInitialization: useInitialization2,
10
+ useOrganization: useOrganization2
11
+ }) {
12
+ return function useFeatureAccess2() {
13
+ const { profile, organizationReady } = useInitialization2();
14
+ const { currentMembership } = useOrganization2();
15
+ const { orgConfig, membershipConfig } = useMemo(() => {
16
+ const organizationConfig = currentMembership?.organization?.config;
17
+ const memberConfig = currentMembership?.config;
18
+ return { orgConfig: organizationConfig, membershipConfig: memberConfig };
19
+ }, [currentMembership]);
20
+ const userConfig = profile?.config;
21
+ const checkFeature = useCallback(
22
+ (featureKey) => {
23
+ if (profile?.is_platform_admin) {
24
+ return { allowed: true, restrictedBy: null };
25
+ }
26
+ const membershipValue = membershipConfig?.features?.[featureKey];
27
+ if (membershipValue === false) return { allowed: false, restrictedBy: "membership" };
28
+ return { allowed: true, restrictedBy: null };
29
+ },
30
+ [profile?.is_platform_admin, membershipConfig]
31
+ );
32
+ const hasFeature = useCallback((featureKey) => checkFeature(featureKey).allowed, [checkFeature]);
33
+ return {
34
+ orgConfig,
35
+ membershipConfig,
36
+ userConfig,
37
+ hasFeature,
38
+ checkFeature,
39
+ isReady: organizationReady
40
+ };
41
+ };
42
+ }
43
+
44
+ // src/provider/resolvers/RouteResolver.ts
45
+ function normalizeRoutePath(path) {
46
+ const trimmedPath = path.trim();
47
+ if (!trimmedPath || trimmedPath === "/") {
48
+ return "/";
49
+ }
50
+ return trimmedPath.replace(/\/+$/, "") || "/";
51
+ }
52
+ function isRouteMatch(currentPath, route) {
53
+ const normalizedCurrentPath = normalizeRoutePath(currentPath);
54
+ const normalizedRoute = normalizeRoutePath(route);
55
+ return normalizedCurrentPath === normalizedRoute || normalizedCurrentPath.startsWith(`${normalizedRoute}/`);
56
+ }
57
+
58
+ // src/provider/resolvers/NavResolver.ts
59
+ function uniqueIds(ids) {
60
+ return ids ? [...new Set(ids)] : [];
61
+ }
62
+
63
+ // src/provider/validateManifests.ts
64
+ function listSystemRefs(systems) {
65
+ const refs = [];
66
+ function walk(map, prefix = "") {
67
+ for (const [key, system] of Object.entries(map)) {
68
+ const path = prefix ? `${prefix}.${key}` : key;
69
+ refs.push(path, system.id);
70
+ const subsystems = system.subsystems;
71
+ if (subsystems) {
72
+ walk(subsystems, path);
73
+ }
74
+ }
75
+ }
76
+ walk(systems);
77
+ return refs;
78
+ }
79
+ function validateManifests(manifests, organizationModel) {
80
+ if (!organizationModel) {
81
+ return;
82
+ }
83
+ const validSystemIds = /* @__PURE__ */ new Set([
84
+ ...Object.keys(organizationModel.systems ?? {}),
85
+ ...listSystemRefs(organizationModel.systems ?? {})
86
+ ]);
87
+ const errors = [];
88
+ for (const manifest of manifests) {
89
+ const key = manifest.key;
90
+ const systemId = manifest.systemId;
91
+ if (!systemId) {
92
+ continue;
93
+ }
94
+ if (!validSystemIds.has(systemId)) {
95
+ errors.push(
96
+ `Manifest "${key}": systemId "${systemId}" is not a known system id. Valid values: ${[...validSystemIds].sort().join(", ")}`
97
+ );
98
+ }
99
+ }
100
+ if (errors.length > 0) {
101
+ throw new Error(
102
+ `System manifest validation failed with ${errors.length} error(s):
103
+ ` + errors.map((e, i) => ` ${i + 1}. ${e}`).join("\n")
104
+ );
105
+ }
106
+ }
107
+ var ElevasisSystemsContext = createContext(null);
108
+
109
+ // src/provider/sidebarProjection.ts
110
+ function isLifecycleEnabled(system) {
111
+ if (system.enabled === false) return false;
112
+ return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
113
+ }
114
+ function isSystemAccessible(systemId, context) {
115
+ const system = context.shellModel.findById(systemId);
116
+ if (!system || !isLifecycleEnabled(system)) return false;
117
+ if (!context.isSystemEnabled(systemId)) return false;
118
+ if (context.shellModel.requiresAdminFor(systemId) && !context.isPlatformAdmin) return false;
119
+ if (context.shellModel.devOnlyFor(systemId) && !context.isDev) return false;
120
+ return true;
121
+ }
122
+ function isSurfaceAccessible(node, context) {
123
+ if (node.devOnly && !context.isDev) return false;
124
+ if (node.requiresAdmin && !context.isPlatformAdmin) return false;
125
+ const systemTargets = node.targets?.systems ?? [];
126
+ if (systemTargets.length === 0) return true;
127
+ return systemTargets.some((systemId) => isSystemAccessible(systemId, context));
128
+ }
129
+ function iconForNode(node, context) {
130
+ if (node.type === "surface") {
131
+ const targetIcon = node.targets?.systems?.map((systemId) => context.shellModel.findById(systemId)?.iconComponent).find(Boolean);
132
+ if (targetIcon) return targetIcon;
133
+ }
134
+ return getSemanticIconComponent(node.icon);
135
+ }
136
+ function activeMatchPathsForSurface(node, context) {
137
+ const targets = node.targets?.systems ?? [];
138
+ if (targets.length !== 1) return void 0;
139
+ const paths = context.shellModel.childrenOf(targets[0]).map((child) => child.path).filter((path) => Boolean(path && path !== node.path));
140
+ return paths.length > 0 ? [...new Set(paths)] : void 0;
141
+ }
142
+ function surfaceToLinkItem(node, context, siblings) {
143
+ if (!isSurfaceAccessible(node, context)) return void 0;
144
+ const siblingShadows = siblings.some((sibling) => sibling !== node && sibling.path.startsWith(`${node.path}/`));
145
+ const activeMatchPaths = activeMatchPathsForSurface(node, context);
146
+ return {
147
+ label: node.label,
148
+ link: node.path,
149
+ ...siblingShadows ? { exact: true } : {},
150
+ ...activeMatchPaths ? { activeMatchPaths } : {}
151
+ };
152
+ }
153
+ function projectNode(node, context) {
154
+ if (node.type === "surface") {
155
+ if (!isSurfaceAccessible(node, context)) return void 0;
156
+ return {
157
+ label: node.label,
158
+ icon: iconForNode(node, context),
159
+ link: node.path
160
+ };
161
+ }
162
+ const childEntries = getSortedSidebarEntries(node.children);
163
+ const childSurfaces = childEntries.map(([, child]) => child).filter((child) => child.type === "surface");
164
+ const links = childEntries.flatMap(([, child]) => {
165
+ if (child.type === "surface") {
166
+ const link = surfaceToLinkItem(child, context, childSurfaces);
167
+ return link ? [link] : [];
168
+ }
169
+ const nestedGroup = projectNode(child, context);
170
+ return nestedGroup?.link ? [
171
+ {
172
+ label: nestedGroup.label,
173
+ link: nestedGroup.link
174
+ }
175
+ ] : nestedGroup?.links ?? [];
176
+ });
177
+ if (links.length === 0) return void 0;
178
+ return {
179
+ label: node.label,
180
+ icon: iconForNode(node, context),
181
+ links
182
+ };
183
+ }
184
+ function projectSection(section, context) {
185
+ const entries = getSortedSidebarEntries(section);
186
+ return entries.flatMap(([, node]) => {
187
+ const group = projectNode(node, context);
188
+ return group ? [group] : [];
189
+ });
190
+ }
191
+ function projectSidebarLinks({
192
+ shellModel,
193
+ organizationModel,
194
+ isSystemEnabled,
195
+ isPlatformAdmin = false,
196
+ isDev = false,
197
+ section
198
+ }) {
199
+ const context = {
200
+ shellModel,
201
+ isSystemEnabled,
202
+ isPlatformAdmin,
203
+ isDev
204
+ };
205
+ const sidebar = organizationModel?.navigation.sidebar;
206
+ if (!sidebar) return [];
207
+ if (section) {
208
+ return projectSection(sidebar[section], context);
209
+ }
210
+ return [...projectSection(sidebar.primary, context), ...projectSection(sidebar.bottom, context)];
211
+ }
212
+ var useFeatureAccess = createFeatureAccessHook({
213
+ useInitialization,
214
+ useOrganization
215
+ });
216
+ function useElevasisSystems() {
217
+ const context = useContext(ElevasisSystemsContext);
218
+ if (!context) {
219
+ throw new Error(
220
+ "useElevasisSystems must be used within an ElevasisSystemsProvider. Wrap your app (or the relevant subtree) with <ElevasisSystemsProvider>."
221
+ );
222
+ }
223
+ return context;
224
+ }
225
+ function useOptionalElevasisSystems() {
226
+ return useContext(ElevasisSystemsContext);
227
+ }
228
+ function defaultSystems(organizationModel) {
229
+ if (!organizationModel) return [];
230
+ return listAllSystems(organizationModel).map(({ path, system }) => ({ ...system, id: path }));
231
+ }
232
+ function systemPath(system) {
233
+ return system.ui?.path ?? system.path ?? defaultPathFor(system.id);
234
+ }
235
+ function systemLabel(system) {
236
+ return system.label ?? system.title ?? system.id;
237
+ }
238
+ function moduleSystemId(module) {
239
+ return module.systemId ?? module.key;
240
+ }
241
+ function isLifecycleEnabled2(system) {
242
+ if (system.enabled === false) return false;
243
+ return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
244
+ }
245
+ function isOrganizationModelSystemEnabled(organizationModel, systemId) {
246
+ const system = defaultSystems(organizationModel).find((candidate) => candidate.id === systemId);
247
+ return system ? isLifecycleEnabled2(system) : void 0;
248
+ }
249
+ function resolveSystemModules(systems, isSystemEnabled) {
250
+ return systems.map((system) => {
251
+ const systemId = system.systemId;
252
+ const accessKey = systemId ?? system.key;
253
+ return {
254
+ ...system,
255
+ systemId,
256
+ access: {
257
+ featureKey: system.key,
258
+ systemId,
259
+ enabled: isSystemEnabled(accessKey)
260
+ },
261
+ semantics: {
262
+ capabilityIds: uniqueIds(system.capabilityIds ?? [])
263
+ }
264
+ };
265
+ });
266
+ }
267
+ function buildShellSystems(organizationModel, modules) {
268
+ const iconBySystemId = new Map(
269
+ modules.flatMap((module) => module.systemId ? [[moduleSystemId(module), module.icon]] : [])
270
+ );
271
+ return defaultSystems(organizationModel).map((system) => ({
272
+ ...system,
273
+ label: systemLabel(system),
274
+ path: systemPath(system),
275
+ iconComponent: iconBySystemId.get(system.id)
276
+ }));
277
+ }
278
+ function createShellModel(systems) {
279
+ const systemsRecord = Object.fromEntries(systems.map((s) => [s.id, s]));
280
+ return {
281
+ systems,
282
+ findByPath: (path) => findByPath(systemsRecord, normalizeRoutePath(path)),
283
+ findById: (id) => findById(systemsRecord, id),
284
+ childrenOf: (id) => childrenOf(systemsRecord, id),
285
+ ancestorsOf: (id) => ancestorsOf(systemsRecord, id),
286
+ parentOf: (id) => parentOf(systemsRecord, id),
287
+ topLevel: () => topLevel(systemsRecord),
288
+ requiresAdminFor: (id) => requiresAdminFor(systemsRecord, id),
289
+ devOnlyFor: (id) => devOnlyFor(systemsRecord, id)
290
+ };
291
+ }
292
+ function resolveOrganizationGraphSystem(systems, shellModel) {
293
+ for (const system of systems) {
294
+ const graphBridge = system.organizationGraph;
295
+ if (!graphBridge) continue;
296
+ const systemId = graphBridge.systemId;
297
+ if (!systemId) continue;
298
+ const node = shellModel.findById(systemId);
299
+ return {
300
+ available: Boolean(node),
301
+ systemId,
302
+ systemPath: node ? systemPath(node) : void 0
303
+ };
304
+ }
305
+ return {
306
+ available: false
307
+ };
308
+ }
309
+ function findMatchingNode(shellModel, currentPath) {
310
+ const normalizedPath = normalizeRoutePath(currentPath);
311
+ const exact = shellModel.findByPath(normalizedPath);
312
+ if (exact) return exact;
313
+ return [...shellModel.systems].filter((system) => {
314
+ const path = normalizeRoutePath(systemPath(system));
315
+ return path !== "/" && isRouteMatch(normalizedPath, path);
316
+ }).sort((a, b) => systemPath(b).length - systemPath(a).length)[0];
317
+ }
318
+ function ownsNode(module, node) {
319
+ if (!node || !module.systemId) return false;
320
+ return node.id === module.systemId || node.id.startsWith(`${module.systemId}.`);
321
+ }
322
+ function ownsRoutePrefix(module, normalizedPath) {
323
+ return (module.routePrefixes ?? []).some((prefix) => isRouteMatch(normalizedPath, normalizeRoutePath(prefix)));
324
+ }
325
+ function resolveRoute(systems, shellModel, currentPath, disabledSubsectionPaths) {
326
+ const node = findMatchingNode(shellModel, currentPath);
327
+ const normalizedPath = normalizeRoutePath(currentPath);
328
+ if (disabledSubsectionPaths.some((disabledPath) => isRouteMatch(normalizedPath, disabledPath))) {
329
+ return {
330
+ status: "hidden",
331
+ path: currentPath,
332
+ node
333
+ };
334
+ }
335
+ const system = systems.find((candidate) => ownsNode(candidate, node)) ?? systems.filter((candidate) => ownsRoutePrefix(candidate, normalizedPath)).sort((a, b) => Math.max(...(b.routePrefixes ?? []).map((prefix) => prefix.length)) - Math.max(...(a.routePrefixes ?? []).map((prefix) => prefix.length)))[0];
336
+ if (!system) {
337
+ return {
338
+ status: "unmatched",
339
+ path: currentPath,
340
+ node
341
+ };
342
+ }
343
+ return {
344
+ status: "matched",
345
+ path: currentPath,
346
+ system,
347
+ node
348
+ };
349
+ }
350
+ function ElevasisSystemsProvider({
351
+ systems,
352
+ organizationModel,
353
+ timeRange,
354
+ operationsApiUrl,
355
+ operationsSSEManager,
356
+ deliveryApiUrl,
357
+ deliverySSEManager,
358
+ disabledSubsectionPaths = [],
359
+ children
360
+ }) {
361
+ const activeSystems = systems ?? [];
362
+ const resolvedOrganizationModel = useMemo(() => {
363
+ if (!organizationModel) {
364
+ return void 0;
365
+ }
366
+ return {
367
+ ...organizationModel,
368
+ knowledge: organizationModel.knowledge ?? {}
369
+ };
370
+ }, [organizationModel]);
371
+ useMemo(() => validateManifests(activeSystems, resolvedOrganizationModel), [activeSystems, resolvedOrganizationModel]);
372
+ const { hasFeature } = useFeatureAccess();
373
+ const hasResolvedSystem = useCallback(
374
+ (key) => {
375
+ if (!hasFeature(key)) {
376
+ return false;
377
+ }
378
+ const organizationModelSystemEnabled = isOrganizationModelSystemEnabled(resolvedOrganizationModel, key);
379
+ return organizationModelSystemEnabled ?? true;
380
+ },
381
+ [hasFeature, resolvedOrganizationModel]
382
+ );
383
+ const shellSystems = useMemo(
384
+ () => buildShellSystems(resolvedOrganizationModel, activeSystems),
385
+ [resolvedOrganizationModel, activeSystems]
386
+ );
387
+ const shellModel = useMemo(() => createShellModel(shellSystems), [shellSystems]);
388
+ const normalizedDisabledSubsectionPaths = useMemo(
389
+ () => [...new Set(disabledSubsectionPaths.map((path) => normalizeRoutePath(path)))],
390
+ [disabledSubsectionPaths]
391
+ );
392
+ const resolvedSystems = useMemo(
393
+ () => resolveSystemModules(activeSystems, hasResolvedSystem),
394
+ [activeSystems, hasResolvedSystem]
395
+ );
396
+ const enabledResolvedSystems = useMemo(
397
+ () => resolvedSystems.filter((system) => system.access.enabled),
398
+ [resolvedSystems]
399
+ );
400
+ const organizationGraph = useMemo(
401
+ () => resolveOrganizationGraphSystem(enabledResolvedSystems, shellModel),
402
+ [enabledResolvedSystems, shellModel]
403
+ );
404
+ const getResolvedSystem = useCallback(
405
+ (key) => resolvedSystems.find((system) => system.key === key),
406
+ [resolvedSystems]
407
+ );
408
+ const isSystemEnabled = useCallback((key) => hasResolvedSystem(key), [hasResolvedSystem]);
409
+ const getSidebarLinks = useCallback(
410
+ (options = {}) => projectSidebarLinks({
411
+ shellModel,
412
+ organizationModel: resolvedOrganizationModel,
413
+ isSystemEnabled,
414
+ ...options
415
+ }),
416
+ [shellModel, resolvedOrganizationModel, isSystemEnabled]
417
+ );
418
+ const resolveRouteByPath = useCallback(
419
+ (path) => resolveRoute(enabledResolvedSystems, shellModel, path, normalizedDisabledSubsectionPaths),
420
+ [enabledResolvedSystems, shellModel, normalizedDisabledSubsectionPaths]
421
+ );
422
+ const shellRuntime = useMemo(
423
+ () => ({
424
+ resolveRoute: resolveRouteByPath
425
+ }),
426
+ [resolveRouteByPath]
427
+ );
428
+ const value = useMemo(
429
+ () => ({
430
+ shellModel,
431
+ shellRuntime,
432
+ getSidebarLinks,
433
+ enabledResolvedSystems,
434
+ resolvedSystems,
435
+ organizationGraph,
436
+ organizationModel: resolvedOrganizationModel,
437
+ timeRange,
438
+ operationsApiUrl,
439
+ operationsSSEManager,
440
+ deliveryApiUrl,
441
+ deliverySSEManager,
442
+ disabledSubsectionPaths: normalizedDisabledSubsectionPaths,
443
+ isSystemEnabled,
444
+ getResolvedSystem
445
+ }),
446
+ [
447
+ shellModel,
448
+ shellRuntime,
449
+ enabledResolvedSystems,
450
+ resolvedSystems,
451
+ organizationGraph,
452
+ resolvedOrganizationModel,
453
+ timeRange,
454
+ operationsApiUrl,
455
+ operationsSSEManager,
456
+ deliveryApiUrl,
457
+ deliverySSEManager,
458
+ normalizedDisabledSubsectionPaths,
459
+ isSystemEnabled,
460
+ getResolvedSystem,
461
+ getSidebarLinks
462
+ ]
463
+ );
464
+ return /* @__PURE__ */ jsx(ElevasisSystemsContext.Provider, { value, children });
465
+ }
466
+
467
+ export { ElevasisSystemsProvider, createFeatureAccessHook, useElevasisSystems, useOptionalElevasisSystems };
@@ -1,3 +1,3 @@
1
1
  export { ChatHeader, ChatInputArea, ChatInterface, ChatSidebar, MessageBubble, ProcessingIndicator } from '../../chunk-CXY7FMUM.js';
2
2
  import '../../chunk-3KMDHCAR.js';
3
- import '../../chunk-DZTG5IAC.js';
3
+ import '../../chunk-I2KLQ2HA.js';
@@ -534,6 +534,14 @@
534
534
  .mantine-Accordion-control:hover {
535
535
  background-color: var(--color-surface-hover);
536
536
  }
537
+ [data-mantine-color-scheme] .mantine-Accordion-root .mantine-Accordion-item {
538
+ --item-filled-color: var(--color-surface);
539
+ --item-border-color: var(--color-border);
540
+ }
541
+ [data-mantine-color-scheme] .mantine-Accordion-root[data-variant=separated] .mantine-Accordion-item[data-active] {
542
+ background-color: var(--color-surface);
543
+ border-color: var(--color-border);
544
+ }
537
545
  .mantine-Menu-item:hover:not([data-disabled]) {
538
546
  background-color: var(--color-surface-hover);
539
547
  }
@@ -599,6 +607,36 @@
599
607
  background-color: var(--color-primary);
600
608
  border-color: var(--color-primary);
601
609
  }
610
+ .mantine-Tree-node:focus-visible > [data-value] {
611
+ outline: 2px solid color-mix(in srgb, var(--color-primary) 55%, transparent);
612
+ outline-offset: 2px;
613
+ }
614
+ .mantine-Tree-label[data-hovered] {
615
+ background-color: var(--color-surface-hover);
616
+ border-color: var(--color-border);
617
+ }
618
+ .mantine-Tree-label[data-selected] {
619
+ background-color: color-mix(in srgb, var(--color-primary) 12%, transparent);
620
+ border-color: color-mix(in srgb, var(--color-primary) 38%, var(--color-border));
621
+ color: var(--color-primary);
622
+ }
623
+ [data-knowledge-article] pre {
624
+ white-space: pre-wrap;
625
+ word-break: break-word;
626
+ overflow-x: auto;
627
+ max-width: 100%;
628
+ padding: var(--mantine-spacing-sm);
629
+ background-color: var(--color-surface);
630
+ border: 1px solid var(--color-border);
631
+ border-radius: var(--mantine-radius-sm);
632
+ }
633
+ [data-knowledge-article] pre code {
634
+ background: transparent;
635
+ border: none;
636
+ padding: 0;
637
+ white-space: inherit;
638
+ word-break: inherit;
639
+ }
602
640
  .recharts-surface:focus {
603
641
  outline: none;
604
642
  }