@pablo2410/shared-ui 0.18.1 → 0.19.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 (44) hide show
  1. package/README.md +18 -15
  2. package/dist/{HealthFooter-C5K9s38i.d.ts → HealthFooter-BoOozbWG.d.ts} +4 -4
  3. package/dist/{chunk-G7XJLTNY.js → chunk-5RY3AJKI.js} +8 -9
  4. package/dist/{chunk-G7XJLTNY.js.map → chunk-5RY3AJKI.js.map} +1 -1
  5. package/dist/{chunk-3G43UG63.js → chunk-A6UTXAPS.js} +11 -3
  6. package/dist/chunk-A6UTXAPS.js.map +1 -0
  7. package/dist/{chunk-R4NOLCSI.js → chunk-BKGUIIN2.js} +1 -1
  8. package/dist/{chunk-R4NOLCSI.js.map → chunk-BKGUIIN2.js.map} +1 -1
  9. package/dist/{chunk-IEBZGU6X.js → chunk-DMUQ5WNO.js} +2 -4
  10. package/dist/chunk-DMUQ5WNO.js.map +1 -0
  11. package/dist/{chunk-PLCWXXUE.js → chunk-K6FHU4HN.js} +9 -15
  12. package/dist/chunk-K6FHU4HN.js.map +1 -0
  13. package/dist/{chunk-KXUNOSMZ.js → chunk-NLQ45OYS.js} +193 -91
  14. package/dist/chunk-NLQ45OYS.js.map +1 -0
  15. package/dist/{chunk-WTR6SNOE.js → chunk-VJEXXX2P.js} +158 -40
  16. package/dist/chunk-VJEXXX2P.js.map +1 -0
  17. package/dist/components/index.d.ts +7 -8
  18. package/dist/components/index.js +85 -63
  19. package/dist/components/index.js.map +1 -1
  20. package/dist/hierarchy/core.js +1 -1
  21. package/dist/hierarchy/index.d.ts +3 -3
  22. package/dist/hierarchy/index.js +5 -5
  23. package/dist/insights/index.d.ts +8 -8
  24. package/dist/insights/index.js +150 -61
  25. package/dist/insights/index.js.map +1 -1
  26. package/dist/layout/index.d.ts +8 -8
  27. package/dist/layout/index.js +6 -6
  28. package/dist/primitives/index.d.ts +288 -289
  29. package/dist/primitives/index.js +2 -2
  30. package/dist/rbac/index.js.map +1 -1
  31. package/dist/reporting/index.d.ts +101 -43
  32. package/dist/reporting/index.js +208 -187
  33. package/dist/reporting/index.js.map +1 -1
  34. package/dist/services/index.js +2 -2
  35. package/dist/shell/index.d.ts +2 -3
  36. package/dist/shell/index.js +7 -7
  37. package/dist/shell/oplytics-shell.css +2 -2
  38. package/dist/theme/oplytics-theme.css +4 -4
  39. package/package.json +48 -46
  40. package/dist/chunk-3G43UG63.js.map +0 -1
  41. package/dist/chunk-IEBZGU6X.js.map +0 -1
  42. package/dist/chunk-KXUNOSMZ.js.map +0 -1
  43. package/dist/chunk-PLCWXXUE.js.map +0 -1
  44. package/dist/chunk-WTR6SNOE.js.map +0 -1
package/README.md CHANGED
@@ -12,41 +12,44 @@ pnpm add @oplytics/shared-ui
12
12
 
13
13
  ## Modules
14
14
 
15
- | Module | Import | Description |
16
- |--------|--------|-------------|
17
- | **Layout** | `@oplytics/shared-ui/layout` | Config-driven sidebar, page header, footer, layout factory |
18
- | **Hierarchy** | `@oplytics/shared-ui/hierarchy` | Org hierarchy types, selection state, enterprise override |
19
- | **RBAC** | `@oplytics/shared-ui/rbac` | 7-role model, permission checks, error constants |
20
- | **Reporting** | `@oplytics/shared-ui/reporting` | Incident reporting and feedback toolbar types/config |
15
+ | Module | Import | Description |
16
+ | -------------- | -------------------------------- | ---------------------------------------------------------- |
17
+ | **Layout** | `@oplytics/shared-ui/layout` | Config-driven sidebar, page header, footer, layout factory |
18
+ | **Hierarchy** | `@oplytics/shared-ui/hierarchy` | Org hierarchy types, selection state, enterprise override |
19
+ | **RBAC** | `@oplytics/shared-ui/rbac` | 7-role model, permission checks, error constants |
20
+ | **Reporting** | `@oplytics/shared-ui/reporting` | Incident reporting and feedback toolbar types/config |
21
21
  | **Components** | `@oplytics/shared-ui/components` | SharedFooter, NotFound, ErrorBoundary, ViewOnlyBadge types |
22
- | **Hooks** | `@oplytics/shared-ui/hooks` | useMobile, useComposition, usePersistFn |
23
- | **Theme** | `@oplytics/shared-ui/theme` | Design tokens, color palette, typography, CSS variables |
22
+ | **Hooks** | `@oplytics/shared-ui/hooks` | useMobile, useComposition, usePersistFn |
23
+ | **Theme** | `@oplytics/shared-ui/theme` | Design tokens, color palette, typography, CSS variables |
24
24
 
25
25
  ## Quick Start
26
26
 
27
27
  ```tsx
28
28
  // RBAC — check permissions
29
- import { hasMinimumRole, ALL_ROLES } from '@oplytics/shared-ui/rbac';
29
+ import { hasMinimumRole, ALL_ROLES } from "@oplytics/shared-ui/rbac";
30
30
 
31
- if (hasMinimumRole(user.role, 'enterprise_admin')) {
31
+ if (hasMinimumRole(user.role, "enterprise_admin")) {
32
32
  // show admin features
33
33
  }
34
34
 
35
35
  // Hierarchy — enterprise override
36
- import { applyEnterpriseOverride } from '@oplytics/shared-ui/hierarchy';
36
+ import { applyEnterpriseOverride } from "@oplytics/shared-ui/hierarchy";
37
37
 
38
38
  const resolvedUser = applyEnterpriseOverride(user, req.headers.cookie);
39
39
 
40
40
  // Layout — service config
41
- import { SERVICE_CONFIGS, defineServiceLayout } from '@oplytics/shared-ui/layout';
41
+ import {
42
+ SERVICE_CONFIGS,
43
+ defineServiceLayout,
44
+ } from "@oplytics/shared-ui/layout";
42
45
 
43
46
  const myConfig = SERVICE_CONFIGS.sqdcp;
44
47
 
45
48
  // Theme — design tokens
46
- import { OPLYTICS_COLORS, OPLYTICS_FONTS } from '@oplytics/shared-ui/theme';
49
+ import { OPLYTICS_COLORS, OPLYTICS_FONTS } from "@oplytics/shared-ui/theme";
47
50
 
48
51
  // Hooks
49
- import { useMobile, usePersistFn } from '@oplytics/shared-ui/hooks';
52
+ import { useMobile, usePersistFn } from "@oplytics/shared-ui/hooks";
50
53
  ```
51
54
 
52
55
  ## Theme CSS
@@ -54,7 +57,7 @@ import { useMobile, usePersistFn } from '@oplytics/shared-ui/hooks';
54
57
  Import the canonical Oplytics theme variables:
55
58
 
56
59
  ```css
57
- @import '@oplytics/shared-ui/theme/oplytics-theme.css';
60
+ @import "@oplytics/shared-ui/theme/oplytics-theme.css";
58
61
  ```
59
62
 
60
63
  This provides all `--oplytics-*` CSS custom properties for backgrounds, text, accents, borders, spacing, radius, and shadows.
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as React from 'react';
2
2
  import React__default, { ReactNode, CSSProperties } from 'react';
3
3
  import { C as CrossServiceLink } from './crossNav-Bz0RXU_F.js';
4
4
 
@@ -216,7 +216,7 @@ interface DashboardLayoutProps {
216
216
  /** Main content. */
217
217
  children: ReactNode;
218
218
  }
219
- declare function DashboardLayout(props: DashboardLayoutProps): react_jsx_runtime.JSX.Element;
219
+ declare function DashboardLayout(props: DashboardLayoutProps): React.JSX.Element;
220
220
 
221
221
  interface CrossServiceNavProps {
222
222
  /** Display-ready links from buildCrossServiceLinks. Renders nothing when empty. */
@@ -224,7 +224,7 @@ interface CrossServiceNavProps {
224
224
  /** Section label above the links (hidden when the sidebar is collapsed). */
225
225
  label?: string;
226
226
  }
227
- declare function CrossServiceNav({ links, label, }: CrossServiceNavProps): react_jsx_runtime.JSX.Element | null;
227
+ declare function CrossServiceNav({ links, label, }: CrossServiceNavProps): React.JSX.Element | null;
228
228
 
229
229
  interface HealthFooterUser {
230
230
  /** JWT role string (e.g. "platform_admin"). */
@@ -255,6 +255,6 @@ interface HealthFooterProps {
255
255
  /** Override the deployed commit hash (default: build-time __COMMIT_HASH__). */
256
256
  commitHash?: string;
257
257
  }
258
- declare function HealthFooter({ user, enterprise, className, style, buildVersion, buildDate, commitHash, }: HealthFooterProps): react_jsx_runtime.JSX.Element;
258
+ declare function HealthFooter({ user, enterprise, className, style, buildVersion, buildDate, commitHash, }: HealthFooterProps): React.JSX.Element;
259
259
 
260
260
  export { CrossServiceNav as C, DashboardLayout as D, HealthFooter as H, type MenuItem as M, type SharedSidebarConfig as S, type DashboardLayoutEnterprise as a, type DashboardLayoutProps as b, type DashboardLayoutUser as c, type CrossServiceNavProps as d, type HealthFooterEnterprise as e, type HealthFooterProps as f, type HealthFooterUser as g, type MenuSection as h, type SharedSidebarProps as i, getInitials as j, isAdminRole as k, isMenuItemActive as l, useSidebarResize as u };
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-4QJMLQSH.js";
4
4
  import {
5
5
  appendSelectionParam
6
- } from "./chunk-IEBZGU6X.js";
6
+ } from "./chunk-DMUQ5WNO.js";
7
7
 
8
8
  // src/services/catalog.ts
9
9
  var SERVICE_CATALOG = [
@@ -98,13 +98,9 @@ var SERVICE_CATALOG = [
98
98
  subdomainLabel: null
99
99
  }
100
100
  ];
101
- var coreServices = SERVICE_CATALOG.filter(
102
- (s) => s.category === "core"
103
- );
101
+ var coreServices = SERVICE_CATALOG.filter((s) => s.category === "core");
104
102
  var hubServices = SERVICE_CATALOG.filter((s) => s.category === "hub");
105
- var liveServices = SERVICE_CATALOG.filter(
106
- (s) => s.status === "live"
107
- );
103
+ var liveServices = SERVICE_CATALOG.filter((s) => s.status === "live");
108
104
  var inDevServices = SERVICE_CATALOG.filter(
109
105
  (s) => s.status === "in-development"
110
106
  );
@@ -122,7 +118,10 @@ function getServiceUrl(service) {
122
118
  }
123
119
 
124
120
  // src/services/crossNav.ts
125
- var ADMIN_SEE_ALL_ROLES = ["platform_admin", "enterprise_admin"];
121
+ var ADMIN_SEE_ALL_ROLES = [
122
+ "platform_admin",
123
+ "enterprise_admin"
124
+ ];
126
125
  var SLUG_ALIASES = {
127
126
  "sqdcp-logic": "sqdcp"
128
127
  };
@@ -159,4 +158,4 @@ export {
159
158
  normalizeServiceSlug,
160
159
  buildCrossServiceLinks
161
160
  };
162
- //# sourceMappingURL=chunk-G7XJLTNY.js.map
161
+ //# sourceMappingURL=chunk-5RY3AJKI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/services/catalog.ts","../src/services/crossNav.ts"],"sourcesContent":["/**\n * Shared Service Catalog — Single source of truth for all Oplytics.digital services.\n *\n * Consumed by:\n * - oplytics-subdomains (ServiceHub.tsx) — service cards, access gating\n * - oplytics-marketing-site (services.ts) — marketing pages, hero sections\n *\n * Each consumer extends with context-specific fields locally:\n * - Platform adds: route, external URL, React icon component\n * - Marketing adds: heroImage, demoImage, problem, howItWorks, results, aiFeatures\n */\n\nimport { platformUrl } from \"./platformDomain\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ServiceStatus = \"live\" | \"in-development\" | \"coming-soon\";\nexport type ServiceCategory = \"core\" | \"hub\";\n\nexport interface ServiceDefinition {\n /** Unique identifier used for DB lookups, URL slugs, and cross-referencing */\n slug: string;\n /** Display name shown in cards, headers, and navigation */\n name: string;\n /** Short one-line value proposition */\n tagline: string;\n /** Longer description (1-2 sentences) for cards and summaries */\n description: string;\n /** Lucide icon name (string) — consumers resolve to component locally */\n icon: string;\n /** Hex accent color for cards, badges, and theming */\n accentColor: string;\n /** Current availability status */\n status: ServiceStatus;\n /** Core = standalone product, Hub = extension/add-on module */\n category: ServiceCategory;\n /**\n * Subdomain label on the platform domain (e.g. \"sqdcp\") — null if hosted\n * on portal. Full URLs are built via getServiceUrl(), which resolves the\n * platform domain at runtime (see ./platformDomain).\n */\n subdomainLabel: string | null;\n}\n\n// ---------------------------------------------------------------------------\n// Catalog\n// ---------------------------------------------------------------------------\n\nexport const SERVICE_CATALOG: ServiceDefinition[] = [\n // ─── CORE SERVICES ───\n {\n slug: \"policy-deployment\",\n name: \"Policy Deployment\",\n tagline: \"Align strategy to execution\",\n description:\n \"Hoshin Kanri and X-matrix planning. Cascade strategic objectives through every level of your organisation with live tracking and bowling charts.\",\n icon: \"Target\",\n accentColor: \"#F59E0B\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"policy\",\n },\n {\n slug: \"sqdcp\",\n name: \"SQDCP Dashboard\",\n tagline: \"Daily management boards, digitised\",\n description:\n \"Digital SQDCP boards that drive daily accountability. Safety, Quality, Delivery, Cost, and People metrics at a glance for every team.\",\n icon: \"LayoutGrid\",\n accentColor: \"#1DB8CE\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"sqdcp\",\n },\n {\n slug: \"oee-manager\",\n name: \"OEE Manager\",\n tagline: \"Real-time equipment effectiveness tracking\",\n description:\n \"Monitor Overall Equipment Effectiveness in real-time. Track availability, performance, and quality metrics across your entire production line.\",\n icon: \"Gauge\",\n accentColor: \"#8C34E9\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"oeemanager\",\n },\n {\n slug: \"action-manager\",\n name: \"Action Manager\",\n tagline: \"Track every action to closure\",\n description:\n \"Capture, assign, and track corrective and preventive actions from any source. Ensure nothing falls through the cracks.\",\n icon: \"ClipboardCheck\",\n accentColor: \"#22C55E\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"actionmanager\",\n },\n {\n slug: \"connect\",\n name: \"OplyticsConnect\",\n tagline: \"Integrate machines, sensors, and systems\",\n description:\n \"Industrial IoT connectivity layer. Connect PLCs, sensors, and legacy systems to the Oplytics platform with zero-code configuration.\",\n icon: \"Plug\",\n accentColor: \"#1DB8CE\",\n status: \"in-development\",\n category: \"core\",\n subdomainLabel: \"connect\",\n },\n\n // ─── HUB SERVICES ───\n {\n slug: \"safety-manager\",\n name: \"Safety Manager\",\n tagline: \"Proactive safety culture, powered by data\",\n description:\n \"Incident reporting, hazard tracking, safety observations, and compliance management in one unified platform.\",\n icon: \"Shield\",\n accentColor: \"#EF4444\",\n status: \"coming-soon\",\n category: \"hub\",\n subdomainLabel: \"safetymanager\",\n },\n {\n slug: \"quality-manager\",\n name: \"Quality Manager\",\n tagline: \"End-to-end quality assurance\",\n description:\n \"Non-conformance tracking, CAPA management, audit scheduling, and quality metrics dashboards.\",\n icon: \"CheckCircle\",\n accentColor: \"#22C55E\",\n status: \"coming-soon\",\n category: \"hub\",\n subdomainLabel: null,\n },\n {\n slug: \"certification-manager\",\n name: \"Certification Manager\",\n tagline: \"Stay audit-ready, always\",\n description:\n \"Manage ISO, IATF, and other certification requirements. Document control, audit trails, and compliance tracking.\",\n icon: \"Award\",\n accentColor: \"#F97316\",\n status: \"coming-soon\",\n category: \"hub\",\n subdomainLabel: null,\n },\n];\n\n// ---------------------------------------------------------------------------\n// Derived helpers\n// ---------------------------------------------------------------------------\n\nexport const coreServices = SERVICE_CATALOG.filter(\n (s) => s.category === \"core\",\n);\nexport const hubServices = SERVICE_CATALOG.filter((s) => s.category === \"hub\");\nexport const liveServices = SERVICE_CATALOG.filter(\n (s) => s.status === \"live\",\n);\nexport const inDevServices = SERVICE_CATALOG.filter(\n (s) => s.status === \"in-development\",\n);\nexport const comingSoonServices = SERVICE_CATALOG.filter(\n (s) => s.status === \"coming-soon\",\n);\n\nexport function getServiceBySlug(\n slug: string,\n): ServiceDefinition | undefined {\n return SERVICE_CATALOG.find((s) => s.slug === slug);\n}\n\nexport function getServiceUrl(service: ServiceDefinition): string | null {\n if (service.subdomainLabel) {\n return platformUrl(service.subdomainLabel);\n }\n return null;\n}\n","/**\n * crossNav — build the sidebar cross-service links (service → service jump\n * without going through the Portal Service Hub).\n *\n * Visibility mirrors the Portal ServiceHub rule: platform_admin and\n * enterprise_admin see every live service; everyone else only sees the\n * services granted in the portal `user_services` table. The current service\n * never links to itself. Each link URL carries the caller's current\n * org-hierarchy selection (?oh=…) so the breadcrumb arrives pre-aligned.\n */\nimport type { OrgHierarchySelection } from \"../hierarchy/orgHierarchy\";\nimport { appendSelectionParam } from \"../hierarchy/selectionParams\";\nimport { SERVICE_CATALOG, getServiceUrl } from \"./catalog\";\n\n/** Roles that see every live service regardless of individual grants. */\nexport const ADMIN_SEE_ALL_ROLES = [\"platform_admin\", \"enterprise_admin\"] as const;\n\n/**\n * Legacy grant slugs → canonical catalog slugs. Auto-provisioned accounts\n * were granted \"sqdcp-logic\" while the catalog slug is \"sqdcp\".\n */\nexport const SLUG_ALIASES: Record<string, string> = {\n \"sqdcp-logic\": \"sqdcp\",\n};\n\nexport function normalizeServiceSlug(slug: string): string {\n return SLUG_ALIASES[slug] ?? slug;\n}\n\n/** Display-ready cross-service link entry. */\nexport interface CrossServiceLink {\n slug: string;\n name: string;\n /** Lucide icon name from the service catalog (consumers resolve locally). */\n icon: string;\n accentColor: string;\n /** Absolute URL including the ?oh= hierarchy selection param. */\n url: string;\n}\n\nexport interface BuildCrossServiceLinksOptions {\n /** Catalog slug of the service doing the rendering (excluded from links). */\n currentSlug: string;\n /** Grant slugs from the portal (raw — aliases are normalized here). */\n grantedSlugs: string[];\n /** Portal role of the current user (drives the admin see-all rule). */\n role?: string | null;\n /** Current org-hierarchy selection to carry across (may be empty/null). */\n selection?: OrgHierarchySelection | null;\n}\n\nexport function buildCrossServiceLinks(\n options: BuildCrossServiceLinksOptions,\n): CrossServiceLink[] {\n const { currentSlug, grantedSlugs, role, selection } = options;\n\n const isAdmin =\n !!role && (ADMIN_SEE_ALL_ROLES as readonly string[]).includes(role);\n const granted = new Set(grantedSlugs.map(normalizeServiceSlug));\n const current = normalizeServiceSlug(currentSlug);\n\n return SERVICE_CATALOG.filter(\n (svc) =>\n svc.status === \"live\" &&\n svc.subdomainLabel !== null &&\n svc.slug !== current &&\n (isAdmin || granted.has(svc.slug)),\n ).map((svc) => ({\n slug: svc.slug,\n name: svc.name,\n icon: svc.icon,\n accentColor: svc.accentColor,\n url: appendSelectionParam(getServiceUrl(svc)!, selection),\n }));\n}\n"],"mappings":";;;;;;;;AAkDO,IAAM,kBAAuC;AAAA;AAAA,EAElD;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACE;AAAA,IACF,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACE;AAAA,IACF,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,MA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EAAE,WAAW;AACtB;AACO,IAAM,gBAAgB,gBAAgB;AAAA,EAC3C,CAAC,MAAM,EAAE,WAAW;AACtB;AACO,IAAM,qBAAqB,gBAAgB;AAAA,EAChD,CAAC,MAAM,EAAE,WAAW;AACtB;AAEO,SAAS,iBACd,MAC+B;AAC/B,SAAO,gBAAgB,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI;AACpD;AAEO,SAAS,cAAc,SAA2C;AACvE,MAAI,QAAQ,gBAAgB;AAC1B,WAAO,YAAY,QAAQ,cAAc;AAAA,EAC3C;AACA,SAAO;AACT;;;ACtKO,IAAM,sBAAsB,CAAC,kBAAkB,kBAAkB;AAMjE,IAAM,eAAuC;AAAA,EAClD,eAAe;AACjB;AAEO,SAAS,qBAAqB,MAAsB;AACzD,SAAO,aAAa,IAAI,KAAK;AAC/B;AAwBO,SAAS,uBACd,SACoB;AACpB,QAAM,EAAE,aAAa,cAAc,MAAM,UAAU,IAAI;AAEvD,QAAM,UACJ,CAAC,CAAC,QAAS,oBAA0C,SAAS,IAAI;AACpE,QAAM,UAAU,IAAI,IAAI,aAAa,IAAI,oBAAoB,CAAC;AAC9D,QAAM,UAAU,qBAAqB,WAAW;AAEhD,SAAO,gBAAgB;AAAA,IACrB,CAAC,QACC,IAAI,WAAW,UACf,IAAI,mBAAmB,QACvB,IAAI,SAAS,YACZ,WAAW,QAAQ,IAAI,IAAI,IAAI;AAAA,EACpC,EAAE,IAAI,CAAC,SAAS;AAAA,IACd,MAAM,IAAI;AAAA,IACV,MAAM,IAAI;AAAA,IACV,MAAM,IAAI;AAAA,IACV,aAAa,IAAI;AAAA,IACjB,KAAK,qBAAqB,cAAc,GAAG,GAAI,SAAS;AAAA,EAC1D,EAAE;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/services/catalog.ts","../src/services/crossNav.ts"],"sourcesContent":["/**\n * Shared Service Catalog — Single source of truth for all Oplytics.digital services.\n *\n * Consumed by:\n * - oplytics-subdomains (ServiceHub.tsx) — service cards, access gating\n * - oplytics-marketing-site (services.ts) — marketing pages, hero sections\n *\n * Each consumer extends with context-specific fields locally:\n * - Platform adds: route, external URL, React icon component\n * - Marketing adds: heroImage, demoImage, problem, howItWorks, results, aiFeatures\n */\n\nimport { platformUrl } from \"./platformDomain\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport type ServiceStatus = \"live\" | \"in-development\" | \"coming-soon\";\nexport type ServiceCategory = \"core\" | \"hub\";\n\nexport interface ServiceDefinition {\n /** Unique identifier used for DB lookups, URL slugs, and cross-referencing */\n slug: string;\n /** Display name shown in cards, headers, and navigation */\n name: string;\n /** Short one-line value proposition */\n tagline: string;\n /** Longer description (1-2 sentences) for cards and summaries */\n description: string;\n /** Lucide icon name (string) — consumers resolve to component locally */\n icon: string;\n /** Hex accent color for cards, badges, and theming */\n accentColor: string;\n /** Current availability status */\n status: ServiceStatus;\n /** Core = standalone product, Hub = extension/add-on module */\n category: ServiceCategory;\n /**\n * Subdomain label on the platform domain (e.g. \"sqdcp\") — null if hosted\n * on portal. Full URLs are built via getServiceUrl(), which resolves the\n * platform domain at runtime (see ./platformDomain).\n */\n subdomainLabel: string | null;\n}\n\n// ---------------------------------------------------------------------------\n// Catalog\n// ---------------------------------------------------------------------------\n\nexport const SERVICE_CATALOG: ServiceDefinition[] = [\n // ─── CORE SERVICES ───\n {\n slug: \"policy-deployment\",\n name: \"Policy Deployment\",\n tagline: \"Align strategy to execution\",\n description:\n \"Hoshin Kanri and X-matrix planning. Cascade strategic objectives through every level of your organisation with live tracking and bowling charts.\",\n icon: \"Target\",\n accentColor: \"#F59E0B\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"policy\",\n },\n {\n slug: \"sqdcp\",\n name: \"SQDCP Dashboard\",\n tagline: \"Daily management boards, digitised\",\n description:\n \"Digital SQDCP boards that drive daily accountability. Safety, Quality, Delivery, Cost, and People metrics at a glance for every team.\",\n icon: \"LayoutGrid\",\n accentColor: \"#1DB8CE\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"sqdcp\",\n },\n {\n slug: \"oee-manager\",\n name: \"OEE Manager\",\n tagline: \"Real-time equipment effectiveness tracking\",\n description:\n \"Monitor Overall Equipment Effectiveness in real-time. Track availability, performance, and quality metrics across your entire production line.\",\n icon: \"Gauge\",\n accentColor: \"#8C34E9\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"oeemanager\",\n },\n {\n slug: \"action-manager\",\n name: \"Action Manager\",\n tagline: \"Track every action to closure\",\n description:\n \"Capture, assign, and track corrective and preventive actions from any source. Ensure nothing falls through the cracks.\",\n icon: \"ClipboardCheck\",\n accentColor: \"#22C55E\",\n status: \"live\",\n category: \"core\",\n subdomainLabel: \"actionmanager\",\n },\n {\n slug: \"connect\",\n name: \"OplyticsConnect\",\n tagline: \"Integrate machines, sensors, and systems\",\n description:\n \"Industrial IoT connectivity layer. Connect PLCs, sensors, and legacy systems to the Oplytics platform with zero-code configuration.\",\n icon: \"Plug\",\n accentColor: \"#1DB8CE\",\n status: \"in-development\",\n category: \"core\",\n subdomainLabel: \"connect\",\n },\n\n // ─── HUB SERVICES ───\n {\n slug: \"safety-manager\",\n name: \"Safety Manager\",\n tagline: \"Proactive safety culture, powered by data\",\n description:\n \"Incident reporting, hazard tracking, safety observations, and compliance management in one unified platform.\",\n icon: \"Shield\",\n accentColor: \"#EF4444\",\n status: \"coming-soon\",\n category: \"hub\",\n subdomainLabel: \"safetymanager\",\n },\n {\n slug: \"quality-manager\",\n name: \"Quality Manager\",\n tagline: \"End-to-end quality assurance\",\n description:\n \"Non-conformance tracking, CAPA management, audit scheduling, and quality metrics dashboards.\",\n icon: \"CheckCircle\",\n accentColor: \"#22C55E\",\n status: \"coming-soon\",\n category: \"hub\",\n subdomainLabel: null,\n },\n {\n slug: \"certification-manager\",\n name: \"Certification Manager\",\n tagline: \"Stay audit-ready, always\",\n description:\n \"Manage ISO, IATF, and other certification requirements. Document control, audit trails, and compliance tracking.\",\n icon: \"Award\",\n accentColor: \"#F97316\",\n status: \"coming-soon\",\n category: \"hub\",\n subdomainLabel: null,\n },\n];\n\n// ---------------------------------------------------------------------------\n// Derived helpers\n// ---------------------------------------------------------------------------\n\nexport const coreServices = SERVICE_CATALOG.filter(s => s.category === \"core\");\nexport const hubServices = SERVICE_CATALOG.filter(s => s.category === \"hub\");\nexport const liveServices = SERVICE_CATALOG.filter(s => s.status === \"live\");\nexport const inDevServices = SERVICE_CATALOG.filter(\n s => s.status === \"in-development\"\n);\nexport const comingSoonServices = SERVICE_CATALOG.filter(\n s => s.status === \"coming-soon\"\n);\n\nexport function getServiceBySlug(slug: string): ServiceDefinition | undefined {\n return SERVICE_CATALOG.find(s => s.slug === slug);\n}\n\nexport function getServiceUrl(service: ServiceDefinition): string | null {\n if (service.subdomainLabel) {\n return platformUrl(service.subdomainLabel);\n }\n return null;\n}\n","/**\n * crossNav — build the sidebar cross-service links (service → service jump\n * without going through the Portal Service Hub).\n *\n * Visibility mirrors the Portal ServiceHub rule: platform_admin and\n * enterprise_admin see every live service; everyone else only sees the\n * services granted in the portal `user_services` table. The current service\n * never links to itself. Each link URL carries the caller's current\n * org-hierarchy selection (?oh=…) so the breadcrumb arrives pre-aligned.\n */\nimport type { OrgHierarchySelection } from \"../hierarchy/orgHierarchy\";\nimport { appendSelectionParam } from \"../hierarchy/selectionParams\";\nimport { SERVICE_CATALOG, getServiceUrl } from \"./catalog\";\n\n/** Roles that see every live service regardless of individual grants. */\nexport const ADMIN_SEE_ALL_ROLES = [\n \"platform_admin\",\n \"enterprise_admin\",\n] as const;\n\n/**\n * Legacy grant slugs → canonical catalog slugs. Auto-provisioned accounts\n * were granted \"sqdcp-logic\" while the catalog slug is \"sqdcp\".\n */\nexport const SLUG_ALIASES: Record<string, string> = {\n \"sqdcp-logic\": \"sqdcp\",\n};\n\nexport function normalizeServiceSlug(slug: string): string {\n return SLUG_ALIASES[slug] ?? slug;\n}\n\n/** Display-ready cross-service link entry. */\nexport interface CrossServiceLink {\n slug: string;\n name: string;\n /** Lucide icon name from the service catalog (consumers resolve locally). */\n icon: string;\n accentColor: string;\n /** Absolute URL including the ?oh= hierarchy selection param. */\n url: string;\n}\n\nexport interface BuildCrossServiceLinksOptions {\n /** Catalog slug of the service doing the rendering (excluded from links). */\n currentSlug: string;\n /** Grant slugs from the portal (raw — aliases are normalized here). */\n grantedSlugs: string[];\n /** Portal role of the current user (drives the admin see-all rule). */\n role?: string | null;\n /** Current org-hierarchy selection to carry across (may be empty/null). */\n selection?: OrgHierarchySelection | null;\n}\n\nexport function buildCrossServiceLinks(\n options: BuildCrossServiceLinksOptions\n): CrossServiceLink[] {\n const { currentSlug, grantedSlugs, role, selection } = options;\n\n const isAdmin =\n !!role && (ADMIN_SEE_ALL_ROLES as readonly string[]).includes(role);\n const granted = new Set(grantedSlugs.map(normalizeServiceSlug));\n const current = normalizeServiceSlug(currentSlug);\n\n return SERVICE_CATALOG.filter(\n svc =>\n svc.status === \"live\" &&\n svc.subdomainLabel !== null &&\n svc.slug !== current &&\n (isAdmin || granted.has(svc.slug))\n ).map(svc => ({\n slug: svc.slug,\n name: svc.name,\n icon: svc.icon,\n accentColor: svc.accentColor,\n url: appendSelectionParam(getServiceUrl(svc)!, selection),\n }));\n}\n"],"mappings":";;;;;;;;AAkDO,IAAM,kBAAuC;AAAA;AAAA,EAElD;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACE;AAAA,IACF,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aACE;AAAA,IACF,MAAM;AAAA,IACN,aAAa;AAAA,IACb,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,gBAAgB;AAAA,EAClB;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SA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,EAAE,WAAW;AACpB;AACO,IAAM,qBAAqB,gBAAgB;AAAA,EAChD,OAAK,EAAE,WAAW;AACpB;AAEO,SAAS,iBAAiB,MAA6C;AAC5E,SAAO,gBAAgB,KAAK,OAAK,EAAE,SAAS,IAAI;AAClD;AAEO,SAAS,cAAc,SAA2C;AACvE,MAAI,QAAQ,gBAAgB;AAC1B,WAAO,YAAY,QAAQ,cAAc;AAAA,EAC3C;AACA,SAAO;AACT;;;AChKO,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AACF;AAMO,IAAM,eAAuC;AAAA,EAClD,eAAe;AACjB;AAEO,SAAS,qBAAqB,MAAsB;AACzD,SAAO,aAAa,IAAI,KAAK;AAC/B;AAwBO,SAAS,uBACd,SACoB;AACpB,QAAM,EAAE,aAAa,cAAc,MAAM,UAAU,IAAI;AAEvD,QAAM,UACJ,CAAC,CAAC,QAAS,oBAA0C,SAAS,IAAI;AACpE,QAAM,UAAU,IAAI,IAAI,aAAa,IAAI,oBAAoB,CAAC;AAC9D,QAAM,UAAU,qBAAqB,WAAW;AAEhD,SAAO,gBAAgB;AAAA,IACrB,SACE,IAAI,WAAW,UACf,IAAI,mBAAmB,QACvB,IAAI,SAAS,YACZ,WAAW,QAAQ,IAAI,IAAI,IAAI;AAAA,EACpC,EAAE,IAAI,UAAQ;AAAA,IACZ,MAAM,IAAI;AAAA,IACV,MAAM,IAAI;AAAA,IACV,MAAM,IAAI;AAAA,IACV,aAAa,IAAI;AAAA,IACjB,KAAK,qBAAqB,cAAc,GAAG,GAAI,SAAS;AAAA,EAC1D,EAAE;AACJ;","names":[]}
@@ -20,13 +20,21 @@ function applyEnterpriseOverride(user, cookieHeader) {
20
20
  // src/hierarchy/scopeHierarchy.ts
21
21
  function scopeHierarchyToEnterprise(data, enterpriseId) {
22
22
  if (!data || enterpriseId === null) {
23
- return { enterprises: [], businessUnits: [], sites: [], areas: [], assets: [] };
23
+ return {
24
+ enterprises: [],
25
+ businessUnits: [],
26
+ sites: [],
27
+ areas: [],
28
+ assets: []
29
+ };
24
30
  }
25
31
  const sites = data.sites.filter((s) => s.enterpriseId === enterpriseId);
26
32
  const siteIds = new Set(sites.map((s) => s.id));
27
33
  return {
28
34
  enterprises: data.enterprises.filter((e) => e.id === enterpriseId),
29
- businessUnits: data.businessUnits.filter((bu) => bu.enterpriseId === enterpriseId),
35
+ businessUnits: data.businessUnits.filter(
36
+ (bu) => bu.enterpriseId === enterpriseId
37
+ ),
30
38
  sites,
31
39
  areas: data.areas.filter((a) => siteIds.has(a.siteId)),
32
40
  assets: data.assets.filter((a) => siteIds.has(a.siteId))
@@ -38,4 +46,4 @@ export {
38
46
  applyEnterpriseOverride,
39
47
  scopeHierarchyToEnterprise
40
48
  };
41
- //# sourceMappingURL=chunk-3G43UG63.js.map
49
+ //# sourceMappingURL=chunk-A6UTXAPS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hierarchy/enterpriseOverride.ts","../src/hierarchy/scopeHierarchy.ts"],"sourcesContent":["/**\n * Enterprise Override — shared helper for platform_admin enterprise switching.\n *\n * When a platform_admin switches enterprise in the Portal UI, a cookie\n * `oplytics-active-enterprise` is set with the selected enterprise ID.\n * This cookie is shared across all *.oplytics.digital subdomains.\n *\n * Each subdomain's createContext should call applyEnterpriseOverride()\n * to override the user's DB-stored enterpriseId with the cookie value.\n *\n * Used by: Portal, SQDCP, OEE Manager, Action Manager, Business Hub, Connect\n */\n\n/**\n * Cookie name for the platform_admin active enterprise override.\n * Shared across all *.oplytics.digital subdomains via the .oplytics.digital domain.\n */\nexport const ACTIVE_ENTERPRISE_COOKIE = \"oplytics-active-enterprise\";\n\n/**\n * Parse a single cookie value from a cookie header string.\n */\nfunction parseCookieValue(cookieHeader: string, name: string): string | null {\n const match = cookieHeader\n .split(\";\")\n .map(c => c.trim())\n .find(c => c.startsWith(`${name}=`));\n if (!match) return null;\n return decodeURIComponent(match.slice(name.length + 1));\n}\n\n/**\n * Apply the enterprise override for platform_admin users.\n *\n * If the user is a platform_admin and has the active enterprise cookie set,\n * returns a shallow copy of the user with the overridden enterpriseId.\n * Otherwise returns the user unchanged.\n *\n * @param user - The authenticated user (or null)\n * @param cookieHeader - The raw Cookie header string from the request\n * @returns The user with potentially overridden enterpriseId\n */\nexport function applyEnterpriseOverride<\n T extends { role: string; enterpriseId?: number | null },\n>(user: T | null, cookieHeader: string): T | null {\n if (!user || user.role !== \"platform_admin\") return user;\n\n const activeEnterprise = parseCookieValue(\n cookieHeader,\n ACTIVE_ENTERPRISE_COOKIE\n );\n if (!activeEnterprise) return user;\n\n const parsedId = parseInt(activeEnterprise, 10);\n if (isNaN(parsedId) || parsedId <= 0) return user;\n\n // Return a shallow copy with the overridden enterpriseId\n return { ...user, enterpriseId: parsedId };\n}\n","/**\n * scopeHierarchyToEnterprise — the single source of truth for enterprise isolation.\n *\n * The Portal Service API (`GET /api/service/hierarchy`) is called with a\n * platform-level service key, so it returns every enterprise's hierarchy. This\n * function filters that payload down to ONE enterprise before it reaches a\n * subdomain client. It is pure and isomorphic (no I/O), so the same rule runs in\n * the fetch service, in tests, and anywhere else scoping is needed.\n *\n * Policy (deliberate — do not \"helpfully\" relax it):\n * - `null` data → empty hierarchy.\n * - `null` enterpriseId → empty hierarchy. Enterprise selection is owned solely\n * by the Portal switcher; a caller with no resolved enterprise (e.g. a\n * platform admin who hasn't picked one in Portal yet) sees nothing until they\n * select. Every non-admin always has exactly one enterprise, so they are\n * unaffected. Admin/Portal tooling that genuinely needs the full tree must use\n * the unscoped fetch, never this function.\n */\nimport type { OrgHierarchyData } from \"./orgHierarchy\";\n\nexport function scopeHierarchyToEnterprise(\n data: OrgHierarchyData | null,\n enterpriseId: number | null\n): OrgHierarchyData {\n if (!data || enterpriseId === null) {\n return {\n enterprises: [],\n businessUnits: [],\n sites: [],\n areas: [],\n assets: [],\n };\n }\n\n const sites = data.sites.filter(s => s.enterpriseId === enterpriseId);\n const siteIds = new Set(sites.map(s => s.id));\n\n return {\n enterprises: data.enterprises.filter(e => e.id === enterpriseId),\n businessUnits: data.businessUnits.filter(\n bu => bu.enterpriseId === enterpriseId\n ),\n sites,\n areas: data.areas.filter(a => siteIds.has(a.siteId)),\n assets: data.assets.filter(a => siteIds.has(a.siteId)),\n };\n}\n"],"mappings":";AAiBO,IAAM,2BAA2B;AAKxC,SAAS,iBAAiB,cAAsB,MAA6B;AAC3E,QAAM,QAAQ,aACX,MAAM,GAAG,EACT,IAAI,OAAK,EAAE,KAAK,CAAC,EACjB,KAAK,OAAK,EAAE,WAAW,GAAG,IAAI,GAAG,CAAC;AACrC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,mBAAmB,MAAM,MAAM,KAAK,SAAS,CAAC,CAAC;AACxD;AAaO,SAAS,wBAEd,MAAgB,cAAgC;AAChD,MAAI,CAAC,QAAQ,KAAK,SAAS,iBAAkB,QAAO;AAEpD,QAAM,mBAAmB;AAAA,IACvB;AAAA,IACA;AAAA,EACF;AACA,MAAI,CAAC,iBAAkB,QAAO;AAE9B,QAAM,WAAW,SAAS,kBAAkB,EAAE;AAC9C,MAAI,MAAM,QAAQ,KAAK,YAAY,EAAG,QAAO;AAG7C,SAAO,EAAE,GAAG,MAAM,cAAc,SAAS;AAC3C;;;ACtCO,SAAS,2BACd,MACA,cACkB;AAClB,MAAI,CAAC,QAAQ,iBAAiB,MAAM;AAClC,WAAO;AAAA,MACL,aAAa,CAAC;AAAA,MACd,eAAe,CAAC;AAAA,MAChB,OAAO,CAAC;AAAA,MACR,OAAO,CAAC;AAAA,MACR,QAAQ,CAAC;AAAA,IACX;AAAA,EACF;AAEA,QAAM,QAAQ,KAAK,MAAM,OAAO,OAAK,EAAE,iBAAiB,YAAY;AACpE,QAAM,UAAU,IAAI,IAAI,MAAM,IAAI,OAAK,EAAE,EAAE,CAAC;AAE5C,SAAO;AAAA,IACL,aAAa,KAAK,YAAY,OAAO,OAAK,EAAE,OAAO,YAAY;AAAA,IAC/D,eAAe,KAAK,cAAc;AAAA,MAChC,QAAM,GAAG,iBAAiB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA,OAAO,KAAK,MAAM,OAAO,OAAK,QAAQ,IAAI,EAAE,MAAM,CAAC;AAAA,IACnD,QAAQ,KAAK,OAAO,OAAO,OAAK,QAAQ,IAAI,EAAE,MAAM,CAAC;AAAA,EACvD;AACF;","names":[]}
@@ -305,4 +305,4 @@ export {
305
305
  RadioGroup,
306
306
  RadioGroupItem
307
307
  };
308
- //# sourceMappingURL=chunk-R4NOLCSI.js.map
308
+ //# sourceMappingURL=chunk-BKGUIIN2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/primitives/cn.ts","../src/primitives/button.tsx","../src/primitives/dialog.tsx","../src/primitives/label.tsx","../src/primitives/radio-group.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"./cn\";\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60\",\n outline:\n \"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n sm: \"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\nexport { Button, buttonVariants };\n","import { cn } from \"./cn\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { XIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\n// Context to track composition state across dialog children\nconst DialogCompositionContext = React.createContext<{\n isComposing: () => boolean;\n setComposing: (composing: boolean) => void;\n justEndedComposing: () => boolean;\n markCompositionEnd: () => void;\n}>({\n isComposing: () => false,\n setComposing: () => {},\n justEndedComposing: () => false,\n markCompositionEnd: () => {},\n});\n\nexport const useDialogComposition = () =>\n React.useContext(DialogCompositionContext);\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n const composingRef = React.useRef(false);\n const justEndedRef = React.useRef(false);\n const endTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const contextValue = React.useMemo(\n () => ({\n isComposing: () => composingRef.current,\n setComposing: (composing: boolean) => {\n composingRef.current = composing;\n },\n justEndedComposing: () => justEndedRef.current,\n markCompositionEnd: () => {\n justEndedRef.current = true;\n if (endTimerRef.current) {\n clearTimeout(endTimerRef.current);\n }\n endTimerRef.current = setTimeout(() => {\n justEndedRef.current = false;\n }, 150);\n },\n }),\n []\n );\n\n return (\n <DialogCompositionContext.Provider value={contextValue}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n </DialogCompositionContext.Provider>\n );\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...props}\n />\n );\n}\n\nDialogOverlay.displayName = \"DialogOverlay\";\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n onEscapeKeyDown,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n const { isComposing } = useDialogComposition();\n\n const handleEscapeKeyDown = React.useCallback(\n (e: KeyboardEvent) => {\n // Check both the native isComposing property and our context state\n // This handles Safari's timing issues with composition events\n const isCurrentlyComposing = (e as any).isComposing || isComposing();\n\n // If IME is composing, prevent dialog from closing\n if (isCurrentlyComposing) {\n e.preventDefault();\n return;\n }\n\n // Call user's onEscapeKeyDown if provided\n onEscapeKeyDown?.(e);\n },\n [isComposing, onEscapeKeyDown]\n );\n\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg\",\n className\n )}\n onEscapeKeyDown={handleEscapeKeyDown}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\"text-lg leading-none font-semibold\", className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger\n};\n\n","import * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cn } from \"./cn\";\n\nfunction Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n \"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n","import * as React from \"react\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport { CircleIcon } from \"lucide-react\";\n\nimport { cn } from \"./cn\";\n\nfunction RadioGroup({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n return (\n <RadioGroupPrimitive.Root\n data-slot=\"radio-group\"\n className={cn(\"grid gap-3\", className)}\n {...props}\n />\n );\n}\n\nfunction RadioGroupItem({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n return (\n <RadioGroupPrimitive.Item\n data-slot=\"radio-group-item\"\n className={cn(\n \"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-group-indicator\"\n className=\"relative flex items-center justify-center\"\n >\n <CircleIcon className=\"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n );\n}\n\nex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src/primitives/cn.ts","../src/primitives/button.tsx","../src/primitives/dialog.tsx","../src/primitives/label.tsx","../src/primitives/radio-group.tsx"],"sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"./cn\";\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60\",\n outline:\n \"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80\",\n ghost:\n \"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-9 px-4 py-2 has-[>svg]:px-3\",\n sm: \"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5\",\n lg: \"h-10 rounded-md px-6 has-[>svg]:px-4\",\n icon: \"size-9\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\nfunction Button({\n className,\n variant,\n size,\n asChild = false,\n ...props\n}: React.ComponentProps<\"button\"> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n }) {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n data-slot=\"button\"\n className={cn(buttonVariants({ variant, size, className }))}\n {...props}\n />\n );\n}\nexport { Button, buttonVariants };\n","import { cn } from \"./cn\";\nimport * as DialogPrimitive from \"@radix-ui/react-dialog\";\nimport { XIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\n// Context to track composition state across dialog children\nconst DialogCompositionContext = React.createContext<{\n isComposing: () => boolean;\n setComposing: (composing: boolean) => void;\n justEndedComposing: () => boolean;\n markCompositionEnd: () => void;\n}>({\n isComposing: () => false,\n setComposing: () => {},\n justEndedComposing: () => false,\n markCompositionEnd: () => {},\n});\n\nexport const useDialogComposition = () =>\n React.useContext(DialogCompositionContext);\n\nfunction Dialog({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Root>) {\n const composingRef = React.useRef(false);\n const justEndedRef = React.useRef(false);\n const endTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const contextValue = React.useMemo(\n () => ({\n isComposing: () => composingRef.current,\n setComposing: (composing: boolean) => {\n composingRef.current = composing;\n },\n justEndedComposing: () => justEndedRef.current,\n markCompositionEnd: () => {\n justEndedRef.current = true;\n if (endTimerRef.current) {\n clearTimeout(endTimerRef.current);\n }\n endTimerRef.current = setTimeout(() => {\n justEndedRef.current = false;\n }, 150);\n },\n }),\n []\n );\n\n return (\n <DialogCompositionContext.Provider value={contextValue}>\n <DialogPrimitive.Root data-slot=\"dialog\" {...props} />\n </DialogCompositionContext.Provider>\n );\n}\n\nfunction DialogTrigger({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Trigger>) {\n return <DialogPrimitive.Trigger data-slot=\"dialog-trigger\" {...props} />;\n}\n\nfunction DialogPortal({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Portal>) {\n return <DialogPrimitive.Portal data-slot=\"dialog-portal\" {...props} />;\n}\n\nfunction DialogClose({\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Close>) {\n return <DialogPrimitive.Close data-slot=\"dialog-close\" {...props} />;\n}\n\nfunction DialogOverlay({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Overlay>) {\n return (\n <DialogPrimitive.Overlay\n data-slot=\"dialog-overlay\"\n className={cn(\n \"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50\",\n className\n )}\n {...props}\n />\n );\n}\n\nDialogOverlay.displayName = \"DialogOverlay\";\n\nfunction DialogContent({\n className,\n children,\n showCloseButton = true,\n onEscapeKeyDown,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Content> & {\n showCloseButton?: boolean;\n}) {\n const { isComposing } = useDialogComposition();\n\n const handleEscapeKeyDown = React.useCallback(\n (e: KeyboardEvent) => {\n // Check both the native isComposing property and our context state\n // This handles Safari's timing issues with composition events\n const isCurrentlyComposing = (e as any).isComposing || isComposing();\n\n // If IME is composing, prevent dialog from closing\n if (isCurrentlyComposing) {\n e.preventDefault();\n return;\n }\n\n // Call user's onEscapeKeyDown if provided\n onEscapeKeyDown?.(e);\n },\n [isComposing, onEscapeKeyDown]\n );\n\n return (\n <DialogPortal data-slot=\"dialog-portal\">\n <DialogOverlay />\n <DialogPrimitive.Content\n data-slot=\"dialog-content\"\n className={cn(\n \"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg\",\n className\n )}\n onEscapeKeyDown={handleEscapeKeyDown}\n {...props}\n >\n {children}\n {showCloseButton && (\n <DialogPrimitive.Close\n data-slot=\"dialog-close\"\n className=\"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\"\n >\n <XIcon />\n <span className=\"sr-only\">Close</span>\n </DialogPrimitive.Close>\n )}\n </DialogPrimitive.Content>\n </DialogPortal>\n );\n}\n\nfunction DialogHeader({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-header\"\n className={cn(\"flex flex-col gap-2 text-center sm:text-left\", className)}\n {...props}\n />\n );\n}\n\nfunction DialogFooter({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n data-slot=\"dialog-footer\"\n className={cn(\n \"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end\",\n className\n )}\n {...props}\n />\n );\n}\n\nfunction DialogTitle({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Title>) {\n return (\n <DialogPrimitive.Title\n data-slot=\"dialog-title\"\n className={cn(\"text-lg leading-none font-semibold\", className)}\n {...props}\n />\n );\n}\n\nfunction DialogDescription({\n className,\n ...props\n}: React.ComponentProps<typeof DialogPrimitive.Description>) {\n return (\n <DialogPrimitive.Description\n data-slot=\"dialog-description\"\n className={cn(\"text-muted-foreground text-sm\", className)}\n {...props}\n />\n );\n}\n\nexport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogOverlay,\n DialogPortal,\n DialogTitle,\n DialogTrigger,\n};\n","import * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cn } from \"./cn\";\n\nfunction Label({\n className,\n ...props\n}: React.ComponentProps<typeof LabelPrimitive.Root>) {\n return (\n <LabelPrimitive.Root\n data-slot=\"label\"\n className={cn(\n \"flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50\",\n className\n )}\n {...props}\n />\n );\n}\n\nexport { Label };\n","import * as React from \"react\";\nimport * as RadioGroupPrimitive from \"@radix-ui/react-radio-group\";\nimport { CircleIcon } from \"lucide-react\";\n\nimport { cn } from \"./cn\";\n\nfunction RadioGroup({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {\n return (\n <RadioGroupPrimitive.Root\n data-slot=\"radio-group\"\n className={cn(\"grid gap-3\", className)}\n {...props}\n />\n );\n}\n\nfunction RadioGroupItem({\n className,\n ...props\n}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {\n return (\n <RadioGroupPrimitive.Item\n data-slot=\"radio-group-item\"\n className={cn(\n \"border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n >\n <RadioGroupPrimitive.Indicator\n data-slot=\"radio-group-indicator\"\n className=\"relative flex items-center justify-center\"\n >\n <CircleIcon className=\"fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2\" />\n </RadioGroupPrimitive.Indicator>\n </RadioGroupPrimitive.Item>\n );\n}\n\nexport { RadioGroup, RadioGroupItem };\n"],"mappings":";AAAA,SAAS,YAA6B;AACtC,SAAS,eAAe;AACjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ACHA,SAAS,YAAY;AACrB,SAAS,WAA8B;AA4CnC;AA1CJ,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OACE;AAAA,QACF,MAAM;AAAA,MACR;AAAA,MAC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,EACb;AAAA,EACA,GAAG;AACL,GAAqD;AACnD,SACE,gBAAAA;AAAA,IAAgB;AAAA,IAAf;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;;;ACjBA,YAAY,yBAAyB;AACrC,SAAS,kBAAkB;AASvB,gBAAAC,YAAA;AALJ,SAAS,WAAW;AAAA,EAClB;AAAA,EACA,GAAG;AACL,GAA0D;AACxD,SACE,gBAAAA;AAAA,IAAqB;AAAA,IAApB;AAAA,MACC,aAAU;AAAA,MACV,WAAW,GAAG,cAAc,SAAS;AAAA,MACpC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,SAAS,eAAe;AAAA,EACtB;AAAA,EACA,GAAG;AACL,GAA0D;AACxD,SACE,gBAAAA;AAAA,IAAqB;AAAA,IAApB;AAAA,MACC,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEJ,0BAAAA;AAAA,QAAqB;AAAA,QAApB;AAAA,UACC,aAAU;AAAA,UACV,WAAU;AAAA,UAEV,0BAAAA,KAAC,cAAW,WAAU,mFAAkF;AAAA;AAAA,MAC1G;AAAA;AAAA,EACF;AAEJ;","names":["jsx","jsx","jsx"]}
@@ -91,9 +91,7 @@ function resolveSelectionFromIds(ids, hierarchy) {
91
91
  const area = ids.areaId ? hierarchy.areas.find((a) => a.id === ids.areaId && a.siteId === site.id) : void 0;
92
92
  if (!area) return selection;
93
93
  selection.area = { id: area.id, name: area.name, code: area.code };
94
- const asset = ids.assetId ? hierarchy.assets.find(
95
- (a) => a.id === ids.assetId && a.areaId === area.id
96
- ) : void 0;
94
+ const asset = ids.assetId ? hierarchy.assets.find((a) => a.id === ids.assetId && a.areaId === area.id) : void 0;
97
95
  if (asset) {
98
96
  selection.asset = { id: asset.id, name: asset.name, code: asset.code };
99
97
  }
@@ -109,4 +107,4 @@ export {
109
107
  stripSelectionParamFromLocation,
110
108
  resolveSelectionFromIds
111
109
  };
112
- //# sourceMappingURL=chunk-IEBZGU6X.js.map
110
+ //# sourceMappingURL=chunk-DMUQ5WNO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hierarchy/selectionParams.ts"],"sourcesContent":["/**\n * selectionParams — serialize/deserialize the org-hierarchy selection through\n * a URL query param so it can travel across subdomains (cross-service links).\n *\n * Format: ?oh=<entId>.<buId>.<siteId>.<areaId>.<assetId>, dot-joined ids\n * top-down, truncated at the first unselected level (the cascade setters\n * guarantee the selection is always a contiguous chain, so no gaps occur).\n * e.g. ?oh=3.7.12 = enterprise 3 > business unit 7 > site 12.\n *\n * Node ids come from the Portal DB and are identical across every service,\n * which is what makes this transport valid.\n */\nimport type { OrgHierarchyData, OrgHierarchySelection } from \"./orgHierarchy\";\nimport { ORG_HIERARCHY_EMPTY } from \"./orgHierarchy\";\n\n/** Query-param key carrying the org-hierarchy selection between services. */\nexport const ORG_HIERARCHY_PARAM = \"oh\";\n\n/** Selection expressed as raw ids (what the URL param decodes to). */\nexport interface OrgSelectionIds {\n enterpriseId: number | null;\n businessUnitId: number | null;\n siteId: number | null;\n areaId: number | null;\n assetId: number | null;\n}\n\n/**\n * Serialize a selection to the compact param value.\n * Returns null when there is nothing meaningful to carry (no enterprise).\n */\nexport function serializeSelectionParam(\n selection: OrgHierarchySelection\n): string | null {\n if (!selection.enterprise) return null;\n const ids: number[] = [selection.enterprise.id];\n for (const node of [\n selection.businessUnit,\n selection.site,\n selection.area,\n selection.asset,\n ]) {\n if (!node) break; // contiguous chain — stop at the first unselected level\n ids.push(node.id);\n }\n return ids.join(\".\");\n}\n\n/**\n * Parse a param value back to ids. Returns null for anything malformed\n * (empty, non-numeric, negative, or too many segments).\n */\nexport function parseSelectionParam(value: string): OrgSelectionIds | null {\n const segments = value.split(\".\");\n if (segments.length === 0 || segments.length > 5) return null;\n const ids: number[] = [];\n for (const seg of segments) {\n if (!/^\\d+$/.test(seg)) return null;\n const n = Number(seg);\n if (!Number.isSafeInteger(n) || n <= 0) return null;\n ids.push(n);\n }\n return {\n enterpriseId: ids[0] ?? null,\n businessUnitId: ids[1] ?? null,\n siteId: ids[2] ?? null,\n areaId: ids[3] ?? null,\n assetId: ids[4] ?? null,\n };\n}\n\n/**\n * Append the selection param to an absolute URL (used when building\n * cross-service links). Returns the URL unchanged when there is no selection\n * or the URL is unparseable.\n */\nexport function appendSelectionParam(\n url: string,\n selection: OrgHierarchySelection | null | undefined\n): string {\n const value = selection ? serializeSelectionParam(selection) : null;\n if (!value) return url;\n try {\n const parsed = new URL(url);\n parsed.searchParams.set(ORG_HIERARCHY_PARAM, value);\n return parsed.toString();\n } catch {\n return url;\n }\n}\n\n/** Read (without modifying) the selection param from the current location. */\nexport function readSelectionParamFromLocation(): OrgSelectionIds | null {\n if (typeof window === \"undefined\") return null;\n const value = new URLSearchParams(window.location.search).get(\n ORG_HIERARCHY_PARAM\n );\n return value ? parseSelectionParam(value) : null;\n}\n\n/**\n * Remove ONLY the selection param from the address bar (history.replaceState),\n * preserving every other query param and the hash.\n */\nexport function stripSelectionParamFromLocation(): void {\n if (typeof window === \"undefined\") return;\n const params = new URLSearchParams(window.location.search);\n if (!params.has(ORG_HIERARCHY_PARAM)) return;\n params.delete(ORG_HIERARCHY_PARAM);\n const query = params.toString();\n const next =\n window.location.pathname +\n (query ? `?${query}` : \"\") +\n window.location.hash;\n window.history.replaceState(window.history.state, \"\", next);\n}\n\n/**\n * Resolve raw ids against the (already enterprise-scoped) hierarchy data,\n * validating existence AND parent-child integrity level by level. Returns the\n * deepest valid prefix as full nodes; an invalid enterprise yields the empty\n * selection so callers fall back to their normal default behaviour.\n */\nexport function resolveSelectionFromIds(\n ids: OrgSelectionIds,\n hierarchy: OrgHierarchyData\n): OrgHierarchySelection {\n const selection: OrgHierarchySelection = { ...ORG_HIERARCHY_EMPTY };\n\n const enterprise = ids.enterpriseId\n ? hierarchy.enterprises.find(e => e.id === ids.enterpriseId)\n : undefined;\n if (!enterprise) return selection;\n selection.enterprise = {\n id: enterprise.id,\n name: enterprise.name,\n code: enterprise.code,\n };\n\n const businessUnit = ids.businessUnitId\n ? hierarchy.businessUnits.find(\n bu => bu.id === ids.businessUnitId && bu.enterpriseId === enterprise.id\n )\n : undefined;\n // A provided-but-invalid id breaks the chain: everything below it is\n // discarded so the result is always a contiguous, internally consistent\n // prefix of the requested selection.\n if (ids.businessUnitId && !businessUnit) return selection;\n if (businessUnit) {\n selection.businessUnit = {\n id: businessUnit.id,\n name: businessUnit.name,\n code: businessUnit.code,\n };\n }\n\n const site = ids.siteId\n ? hierarchy.sites.find(\n s =>\n s.id === ids.siteId &&\n s.enterpriseId === enterprise.id &&\n (!businessUnit || s.businessUnitId === businessUnit.id)\n )\n : undefined;\n if (!site) return selection;\n selection.site = { id: site.id, name: site.name, code: site.code };\n\n const area = ids.areaId\n ? hierarchy.areas.find(a => a.id === ids.areaId && a.siteId === site.id)\n : undefined;\n if (!area) return selection;\n selection.area = { id: area.id, name: area.name, code: area.code };\n\n const asset = ids.assetId\n ? hierarchy.assets.find(a => a.id === ids.assetId && a.areaId === area.id)\n : undefined;\n if (asset) {\n selection.asset = { id: asset.id, name: asset.name, code: asset.code };\n }\n\n return selection;\n}\n"],"mappings":";;;;;AAgBO,IAAM,sBAAsB;AAe5B,SAAS,wBACd,WACe;AACf,MAAI,CAAC,UAAU,WAAY,QAAO;AAClC,QAAM,MAAgB,CAAC,UAAU,WAAW,EAAE;AAC9C,aAAW,QAAQ;AAAA,IACjB,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,IACV,UAAU;AAAA,EACZ,GAAG;AACD,QAAI,CAAC,KAAM;AACX,QAAI,KAAK,KAAK,EAAE;AAAA,EAClB;AACA,SAAO,IAAI,KAAK,GAAG;AACrB;AAMO,SAAS,oBAAoB,OAAuC;AACzE,QAAM,WAAW,MAAM,MAAM,GAAG;AAChC,MAAI,SAAS,WAAW,KAA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AU,QAAQ,EAAE,IAAI,MAAM,IAAI,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK;AAAA,EACvE;AAEA,SAAO;AACT;","names":[]}
@@ -9,7 +9,7 @@ import {
9
9
  buttonVariants,
10
10
  cn,
11
11
  useDialogComposition
12
- } from "./chunk-R4NOLCSI.js";
12
+ } from "./chunk-BKGUIIN2.js";
13
13
 
14
14
  // src/primitives/accordion.tsx
15
15
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
@@ -628,7 +628,7 @@ function Calendar({
628
628
  captionLayout === "label" ? "text-sm" : "rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",
629
629
  defaultClassNames.caption_label
630
630
  ),
631
- table: "w-full border-collapse",
631
+ month_grid: cn("w-full border-collapse", defaultClassNames.month_grid),
632
632
  weekdays: cn("flex", defaultClassNames.weekdays),
633
633
  weekday: cn(
634
634
  "text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",
@@ -3612,31 +3612,25 @@ function Progress({
3612
3612
 
3613
3613
  // src/primitives/resizable.tsx
3614
3614
  import { GripVerticalIcon } from "lucide-react";
3615
- import {
3616
- PanelGroup,
3617
- Panel,
3618
- PanelResizeHandle
3619
- } from "react-resizable-panels";
3615
+ import { Group as Group4, Panel, Separator as Separator5 } from "react-resizable-panels";
3620
3616
  import { jsx as jsx35 } from "react/jsx-runtime";
3621
3617
  function ResizablePanelGroup({
3622
3618
  className,
3623
3619
  ...props
3624
3620
  }) {
3625
3621
  return /* @__PURE__ */ jsx35(
3626
- PanelGroup,
3622
+ Group4,
3627
3623
  {
3628
3624
  "data-slot": "resizable-panel-group",
3629
3625
  className: cn(
3630
- "flex h-full w-full data-[panel-group-direction=vertical]:flex-col",
3626
+ "flex h-full w-full aria-[orientation=vertical]:flex-col",
3631
3627
  className
3632
3628
  ),
3633
3629
  ...props
3634
3630
  }
3635
3631
  );
3636
3632
  }
3637
- function ResizablePanel({
3638
- ...props
3639
- }) {
3633
+ function ResizablePanel({ ...props }) {
3640
3634
  return /* @__PURE__ */ jsx35(Panel, { "data-slot": "resizable-panel", ...props });
3641
3635
  }
3642
3636
  function ResizableHandle({
@@ -3645,11 +3639,11 @@ function ResizableHandle({
3645
3639
  ...props
3646
3640
  }) {
3647
3641
  return /* @__PURE__ */ jsx35(
3648
- PanelResizeHandle,
3642
+ Separator5,
3649
3643
  {
3650
3644
  "data-slot": "resizable-handle",
3651
3645
  className: cn(
3652
- "bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:translate-x-0 data-[panel-group-direction=vertical]:after:-translate-y-1/2 [&[data-panel-group-direction=vertical]>div]:rotate-90",
3646
+ "bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-offset-1 focus-visible:outline-hidden aria-[orientation=vertical]:h-px aria-[orientation=vertical]:w-full aria-[orientation=vertical]:after:left-0 aria-[orientation=vertical]:after:h-1 aria-[orientation=vertical]:after:w-full aria-[orientation=vertical]:after:translate-x-0 aria-[orientation=vertical]:after:-translate-y-1/2 [&[aria-orientation=vertical]>div]:rotate-90",
3653
3647
  className
3654
3648
  ),
3655
3649
  ...props,
@@ -5346,4 +5340,4 @@ export {
5346
5340
  ToggleGroup,
5347
5341
  ToggleGroupItem
5348
5342
  };
5349
- //# sourceMappingURL=chunk-PLCWXXUE.js.map
5343
+ //# sourceMappingURL=chunk-K6FHU4HN.js.map