@genispace/geniapp 0.1.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 (258) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -0
  3. package/dist/CrossAppRecordPicker-BXchXcK5.js +624 -0
  4. package/dist/CrossAppRecordPicker-BXchXcK5.js.map +1 -0
  5. package/dist/Page-wHZrMN17.js +24 -0
  6. package/dist/Page-wHZrMN17.js.map +1 -0
  7. package/dist/ai/adopt/AiSuggestionPanel.d.ts +30 -0
  8. package/dist/ai/adopt/BusinessGuidancePanel.d.ts +31 -0
  9. package/dist/ai/adopt/DetailPageAiLayout.d.ts +7 -0
  10. package/dist/ai/adopt/adoptPresets.d.ts +11 -0
  11. package/dist/ai/adopt/guidanceContent.d.ts +27 -0
  12. package/dist/ai/adopt/parseAiSummary.d.ts +7 -0
  13. package/dist/ai/components/AgentJobProgress.d.ts +124 -0
  14. package/dist/ai/components/AsyncCombobox.d.ts +44 -0
  15. package/dist/ai/components/BulkActionBar.d.ts +44 -0
  16. package/dist/ai/components/EntityRef.d.ts +39 -0
  17. package/dist/ai/components/JobProgress.d.ts +64 -0
  18. package/dist/ai/components/ServerDataTable.d.ts +89 -0
  19. package/dist/ai/components/Timeline.d.ts +35 -0
  20. package/dist/ai/components/useInfiniteRows.d.ts +25 -0
  21. package/dist/ai/errors/userFacingError.d.ts +14 -0
  22. package/dist/ai/errors/userFacingError.js +48 -0
  23. package/dist/ai/errors/userFacingError.js.map +1 -0
  24. package/dist/ai/index.d.ts +34 -0
  25. package/dist/ai/integrations/partner/createPartnerRecordPickerHook.d.ts +15 -0
  26. package/dist/ai/integrations/partner/partnerRecordPicker.d.ts +20 -0
  27. package/dist/ai/layout/ModalWithAiLayout.d.ts +11 -0
  28. package/dist/ai/layout/aiUi.d.ts +16 -0
  29. package/dist/ai/layout/layoutConstants.d.ts +19 -0
  30. package/dist/ai/layout/modalSizeForAi.d.ts +5 -0
  31. package/dist/ai/locales/sharedAiCopy.d.ts +6 -0
  32. package/dist/ai/managed-data/DatasourceReadonlyTable.d.ts +11 -0
  33. package/dist/ai/managed-data/createTableClient.d.ts +7 -0
  34. package/dist/ai/managed-data/emitManagedEvent.d.ts +18 -0
  35. package/dist/ai/managed-data/executeManagedDatasource.d.ts +21 -0
  36. package/dist/ai/managed-data/queryManagedDatasource.d.ts +28 -0
  37. package/dist/ai/providers/AppUiProviders.d.ts +6 -0
  38. package/dist/ai/types/app-ai.types.d.ts +29 -0
  39. package/dist/ai/types/index.d.ts +1 -0
  40. package/dist/ai.d.ts +1 -0
  41. package/dist/ai.js +1817 -0
  42. package/dist/ai.js.map +1 -0
  43. package/dist/case-workspace/domain.d.ts +41 -0
  44. package/dist/case-workspace/domain.js +24 -0
  45. package/dist/case-workspace/domain.js.map +1 -0
  46. package/dist/case-workspace/index.d.ts +91 -0
  47. package/dist/case-workspace.d.ts +1 -0
  48. package/dist/case-workspace.js +392 -0
  49. package/dist/case-workspace.js.map +1 -0
  50. package/dist/cn-B6yFEsav.js +9 -0
  51. package/dist/cn-B6yFEsav.js.map +1 -0
  52. package/dist/components/ui/calendar.css +7 -0
  53. package/dist/cookieSettings-D_v3KS02.js +97 -0
  54. package/dist/cookieSettings-D_v3KS02.js.map +1 -0
  55. package/dist/dashboard/index.d.ts +16 -0
  56. package/dist/dashboard/src/ChartFrame.d.ts +18 -0
  57. package/dist/dashboard/src/ChartTooltip.d.ts +38 -0
  58. package/dist/dashboard/src/FilterBar.d.ts +23 -0
  59. package/dist/dashboard/src/KpiStatCard.d.ts +29 -0
  60. package/dist/dashboard/src/StatGrid.d.ts +15 -0
  61. package/dist/dashboard/src/TimeRangePicker.d.ts +14 -0
  62. package/dist/dashboard/src/chart.d.ts +10 -0
  63. package/dist/dashboard/src/format.d.ts +16 -0
  64. package/dist/dashboard/src/links.d.ts +2 -0
  65. package/dist/dashboard/src/useDashboardRange.d.ts +27 -0
  66. package/dist/dashboard.d.ts +1 -0
  67. package/dist/dashboard.js +361 -0
  68. package/dist/dashboard.js.map +1 -0
  69. package/dist/fonts.css +15 -0
  70. package/dist/hooks/access/AppAccessGate.d.ts +20 -0
  71. package/dist/hooks/access/AppAccessNotice.d.ts +8 -0
  72. package/dist/hooks/access/useAppAccess.d.ts +26 -0
  73. package/dist/hooks/config/businessLocale.d.ts +12 -0
  74. package/dist/hooks/config/currencies.d.ts +9 -0
  75. package/dist/hooks/index.d.ts +17 -0
  76. package/dist/hooks/picker/CrossAppRecordPicker.d.ts +37 -0
  77. package/dist/hooks/picker/managedAppPicker.d.ts +21 -0
  78. package/dist/hooks/picker/partnerPayload.d.ts +6 -0
  79. package/dist/hooks/routing/draftEntityId.d.ts +5 -0
  80. package/dist/hooks/routing/useRefetchOnRouteMatch.d.ts +6 -0
  81. package/dist/hooks/shell/resolveApiRoot.d.ts +13 -0
  82. package/dist/hooks/shell/shell.d.ts +4 -0
  83. package/dist/hooks/shell/useGenispacePlatformClient.d.ts +7 -0
  84. package/dist/hooks.d.ts +1 -0
  85. package/dist/hooks.js +42 -0
  86. package/dist/hooks.js.map +1 -0
  87. package/dist/index.d.ts +3 -0
  88. package/dist/index.js +77 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/kit.d.ts +50 -0
  91. package/dist/kit.js +2067 -0
  92. package/dist/kit.js.map +1 -0
  93. package/dist/page.d.ts +1 -0
  94. package/dist/page.js +5 -0
  95. package/dist/page.js.map +1 -0
  96. package/dist/shell-DIHnXIUb.js +6 -0
  97. package/dist/shell-DIHnXIUb.js.map +1 -0
  98. package/dist/shell.d.ts +30 -0
  99. package/dist/shell.js +104 -0
  100. package/dist/shell.js.map +1 -0
  101. package/dist/storage/assetPreview.d.ts +12 -0
  102. package/dist/storage/components/AssetThumbnail.d.ts +15 -0
  103. package/dist/storage/components/CopyStorageLinkButton.d.ts +13 -0
  104. package/dist/storage/components/StorageImage.d.ts +9 -0
  105. package/dist/storage/components/StoragePreviewContent.d.ts +22 -0
  106. package/dist/storage/components/StorageVideo.d.ts +9 -0
  107. package/dist/storage/copyTextToClipboard.d.ts +5 -0
  108. package/dist/storage/hooks/useAuthenticatedStorageBlobs.d.ts +3 -0
  109. package/dist/storage/hooks/useImageThumbnailBlobs.d.ts +4 -0
  110. package/dist/storage/hooks/useShareableStorageLink.d.ts +7 -0
  111. package/dist/storage/index.d.ts +12 -0
  112. package/dist/storage/openUrlInNewTab.d.ts +6 -0
  113. package/dist/storage/platformStorage.d.ts +43 -0
  114. package/dist/storage.d.ts +1 -0
  115. package/dist/storage.js +605 -0
  116. package/dist/storage.js.map +1 -0
  117. package/dist/style.css +1 -0
  118. package/dist/styles/base.css +616 -0
  119. package/dist/styles/reduced-motion.css +14 -0
  120. package/dist/styles/tailwind-preset.js +269 -0
  121. package/dist/task-workspace/domain.d.ts +35 -0
  122. package/dist/task-workspace/domain.js +45 -0
  123. package/dist/task-workspace/domain.js.map +1 -0
  124. package/dist/task-workspace/experience.d.ts +50 -0
  125. package/dist/task-workspace/index.d.ts +172 -0
  126. package/dist/task-workspace.d.ts +1 -0
  127. package/dist/task-workspace.js +626 -0
  128. package/dist/task-workspace.js.map +1 -0
  129. package/dist/ui/components/features/app/AppCheckboxInput.d.ts +9 -0
  130. package/dist/ui/components/features/app/AppConfirmDialog.d.ts +12 -0
  131. package/dist/ui/components/features/app/AppDashboardSkeleton.d.ts +9 -0
  132. package/dist/ui/components/features/app/AppDatePicker.d.ts +69 -0
  133. package/dist/ui/components/features/app/AppModal.d.ts +27 -0
  134. package/dist/ui/components/features/app/AppPageStates.d.ts +17 -0
  135. package/dist/ui/components/features/app/AppSelectInput.d.ts +10 -0
  136. package/dist/ui/components/features/app/AppTemporalInput.d.ts +19 -0
  137. package/dist/ui/components/features/app/Page.d.ts +14 -0
  138. package/dist/ui/components/features/app/QueryErrorAlert.d.ts +7 -0
  139. package/dist/ui/components/features/app/Sidebar.d.ts +47 -0
  140. package/dist/ui/components/features/app/index.d.ts +17 -0
  141. package/dist/ui/components/features/user/UserAvatar.d.ts +17 -0
  142. package/dist/ui/components/features/user/UserDisplay.d.ts +10 -0
  143. package/dist/ui/components/features/user/UserSelect.d.ts +14 -0
  144. package/dist/ui/components/features/user/useUserDirectory.d.ts +13 -0
  145. package/dist/ui/components/features/user/userDirectoryTypes.d.ts +18 -0
  146. package/dist/ui/components/patterns/form-section.d.ts +11 -0
  147. package/dist/ui/components/primitives/feedback/index.d.ts +2 -0
  148. package/dist/ui/components/primitives/feedback/toaster.d.ts +1 -0
  149. package/dist/ui/components/primitives/feedback/use-toast.d.ts +46 -0
  150. package/dist/ui/components/primitives/page-skeleton/ChartAreaSkeleton.d.ts +13 -0
  151. package/dist/ui/components/primitives/page-skeleton/ChartEmptyState.d.ts +14 -0
  152. package/dist/ui/components/primitives/page-skeleton/ComponentSkeletonShell.d.ts +16 -0
  153. package/dist/ui/components/primitives/page-skeleton/ConfigEditorSkeleton.d.ts +5 -0
  154. package/dist/ui/components/primitives/page-skeleton/DetailTabsSkeleton.d.ts +6 -0
  155. package/dist/ui/components/primitives/page-skeleton/EmptyStateBadge.d.ts +13 -0
  156. package/dist/ui/components/primitives/page-skeleton/FormCardSkeleton.d.ts +7 -0
  157. package/dist/ui/components/primitives/page-skeleton/FormFieldSkeleton.d.ts +6 -0
  158. package/dist/ui/components/primitives/page-skeleton/FormPageSkeleton.d.ts +6 -0
  159. package/dist/ui/components/primitives/page-skeleton/GridCardsSkeleton.d.ts +6 -0
  160. package/dist/ui/components/primitives/page-skeleton/ListSkeleton.d.ts +26 -0
  161. package/dist/ui/components/primitives/page-skeleton/PageHeaderSkeleton.d.ts +6 -0
  162. package/dist/ui/components/primitives/page-skeleton/SplitPaneSkeleton.d.ts +4 -0
  163. package/dist/ui/components/primitives/page-skeleton/StatsRowSkeleton.d.ts +5 -0
  164. package/dist/ui/components/primitives/page-skeleton/TableEmptyState.d.ts +27 -0
  165. package/dist/ui/components/primitives/page-skeleton/TablePageSkeleton.d.ts +8 -0
  166. package/dist/ui/components/primitives/page-skeleton/TabsBarSkeleton.d.ts +6 -0
  167. package/dist/ui/components/primitives/page-skeleton/index.d.ts +24 -0
  168. package/dist/ui/components/primitives/page-skeleton/skeletonMetrics.d.ts +9 -0
  169. package/dist/ui/components/primitives/page-skeleton/useVisibleCenter.d.ts +34 -0
  170. package/dist/ui/components/ui/accordion.d.ts +7 -0
  171. package/dist/ui/components/ui/ai-draft-banner.d.ts +21 -0
  172. package/dist/ui/components/ui/alert-dialog.d.ts +48 -0
  173. package/dist/ui/components/ui/alert.d.ts +8 -0
  174. package/dist/ui/components/ui/avatar.d.ts +6 -0
  175. package/dist/ui/components/ui/badge.d.ts +9 -0
  176. package/dist/ui/components/ui/breadcrumb.d.ts +19 -0
  177. package/dist/ui/components/ui/button.d.ts +11 -0
  178. package/dist/ui/components/ui/calendar.d.ts +8 -0
  179. package/dist/ui/components/ui/card.d.ts +8 -0
  180. package/dist/ui/components/ui/chart.d.ts +16 -0
  181. package/dist/ui/components/ui/checkbox.d.ts +4 -0
  182. package/dist/ui/components/ui/collapsible.d.ts +5 -0
  183. package/dist/ui/components/ui/column-config.d.ts +42 -0
  184. package/dist/ui/components/ui/date-picker.d.ts +9 -0
  185. package/dist/ui/components/ui/date-range-filter.d.ts +32 -0
  186. package/dist/ui/components/ui/date-range-picker.d.ts +11 -0
  187. package/dist/ui/components/ui/dialog-input.d.ts +17 -0
  188. package/dist/ui/components/ui/dialog-safe-select.d.ts +13 -0
  189. package/dist/ui/components/ui/dialog.d.ts +25 -0
  190. package/dist/ui/components/ui/dropdown-menu.d.ts +27 -0
  191. package/dist/ui/components/ui/feature-guide.d.ts +43 -0
  192. package/dist/ui/components/ui/form.d.ts +25 -0
  193. package/dist/ui/components/ui/help-tip.d.ts +29 -0
  194. package/dist/ui/components/ui/hint-notice.d.ts +22 -0
  195. package/dist/ui/components/ui/index.d.ts +6 -0
  196. package/dist/ui/components/ui/input.d.ts +3 -0
  197. package/dist/ui/components/ui/label.d.ts +5 -0
  198. package/dist/ui/components/ui/modal-container.d.ts +56 -0
  199. package/dist/ui/components/ui/modal-templates.d.ts +46 -0
  200. package/dist/ui/components/ui/multi-select.d.ts +20 -0
  201. package/dist/ui/components/ui/pagination.d.ts +28 -0
  202. package/dist/ui/components/ui/popover.d.ts +7 -0
  203. package/dist/ui/components/ui/progress.d.ts +7 -0
  204. package/dist/ui/components/ui/radio-button-group.d.ts +18 -0
  205. package/dist/ui/components/ui/radio-group.d.ts +5 -0
  206. package/dist/ui/components/ui/scroll-area.d.ts +5 -0
  207. package/dist/ui/components/ui/select.d.ts +16 -0
  208. package/dist/ui/components/ui/separator.d.ts +7 -0
  209. package/dist/ui/components/ui/sheet.d.ts +25 -0
  210. package/dist/ui/components/ui/sidebar-rail.d.ts +9 -0
  211. package/dist/ui/components/ui/skeleton.d.ts +2 -0
  212. package/dist/ui/components/ui/slider.d.ts +13 -0
  213. package/dist/ui/components/ui/switch.d.ts +4 -0
  214. package/dist/ui/components/ui/table.d.ts +10 -0
  215. package/dist/ui/components/ui/tabs.d.ts +10 -0
  216. package/dist/ui/components/ui/textarea.d.ts +3 -0
  217. package/dist/ui/components/ui/toast.d.ts +21 -0
  218. package/dist/ui/components/ui/toggle-group.d.ts +12 -0
  219. package/dist/ui/components/ui/toggle.d.ts +12 -0
  220. package/dist/ui/components/ui/tooltip.d.ts +7 -0
  221. package/dist/ui/components/ui/typography.d.ts +15 -0
  222. package/dist/ui/components/ui/underline-tabs.d.ts +13 -0
  223. package/dist/ui/components/ui/view-mode-toggle.d.ts +9 -0
  224. package/dist/ui/hooks/useIsMobile.d.ts +16 -0
  225. package/dist/ui/styles/design-tokens.d.ts +189 -0
  226. package/dist/ui/styles/z-index-layers.d.ts +46 -0
  227. package/dist/ui.d.ts +2 -0
  228. package/dist/ui.js +35 -0
  229. package/dist/ui.js.map +1 -0
  230. package/dist/useUserDirectory-CqkyCQoR.js +2377 -0
  231. package/dist/useUserDirectory-CqkyCQoR.js.map +1 -0
  232. package/dist/utils/cookieSettings.d.ts +12 -0
  233. package/dist/utils/data/countryCodes.d.ts +26 -0
  234. package/dist/utils/index.d.ts +18 -0
  235. package/dist/utils/utils/appPath.d.ts +5 -0
  236. package/dist/utils/utils/chunkLoadRecovery.d.ts +7 -0
  237. package/dist/utils/utils/cn.d.ts +3 -0
  238. package/dist/utils/utils/crossApp.d.ts +71 -0
  239. package/dist/utils/utils/debounce.d.ts +1 -0
  240. package/dist/utils/utils/formatUserLabel.d.ts +8 -0
  241. package/dist/utils/utils/formatting.d.ts +18 -0
  242. package/dist/utils/utils/logoutNotification.d.ts +28 -0
  243. package/dist/utils/utils/operatorLocale.d.ts +32 -0
  244. package/dist/utils/utils/routeLocalePrefetch.d.ts +5 -0
  245. package/dist/utils/utils/shellIframeUrl.d.ts +20 -0
  246. package/dist/utils/utils/spaceSettings.d.ts +20 -0
  247. package/dist/utils/utils/sso.d.ts +42 -0
  248. package/dist/utils/utils/throttle.d.ts +1 -0
  249. package/dist/utils/utils/timezones.d.ts +14 -0
  250. package/dist/utils/utils/toDateInputValue.d.ts +5 -0
  251. package/dist/utils/utils/watermark.d.ts +1 -0
  252. package/dist/utils.d.ts +1 -0
  253. package/dist/utils.js +1334 -0
  254. package/dist/utils.js.map +1 -0
  255. package/dist/vite.d.ts +22 -0
  256. package/dist/vite.js +74 -0
  257. package/dist/vite.js.map +1 -0
  258. package/package.json +191 -0
@@ -0,0 +1,626 @@
1
+ import { jsxs as n, jsx as a, Fragment as ke } from "react/jsx-runtime";
2
+ import { formatBusinessDateTime as Fe, CrossAppRecordPicker as Se } from "@genispace/geniapp/hooks";
3
+ import { useState as g, useCallback as Ce, useEffect as ue, useMemo as L } from "react";
4
+ import { AlertCircle as qe, CheckCircle2 as Re, Search as Ae, FileCheck2 as Pe, ArrowRight as Le, ChevronDown as re, HelpCircle as je, RefreshCw as Ee, Settings2 as $e, Plus as Ke } from "lucide-react";
5
+ import { AppPage as Oe, AppSelectInput as oe, AppPageStates as De, AppCheckboxInput as He, AppModal as ze, AppDatePicker as Be, AppDateTimePicker as Ie } from "@genispace/geniapp/ui";
6
+ import { filterBusinessRecords as We, validateRecordDraft as Me, validateTransition as Ge, calculateReconciliation as Ue, createIdempotencyKey as X } from "./task-workspace/domain.js";
7
+ const Je = {
8
+ "enterprise-performance-management": {
9
+ basicTypes: ["budget", "forecast", "variance"],
10
+ advancedTypes: ["allocation", "consolidation", "profitability"],
11
+ reconcileTypes: ["budget", "forecast", "consolidation", "profitability", "variance"],
12
+ advancedFields: ["driver_value"],
13
+ compact: { driver: ["planning_basis", "legal_entity_code", "fiscal_period", "scenario_code", "driver_value"] }
14
+ },
15
+ "product-lifecycle-management": {
16
+ basicTypes: ["item_revision", "engineering_change", "specification"],
17
+ advancedTypes: ["cost_release", "retirement"],
18
+ reconcileTypes: ["bom", "routing", "cost_release"],
19
+ advancedFields: ["quantity", "unit"],
20
+ compact: { retirement: ["product_code", "revision", "effective_from", "change_reason"] }
21
+ },
22
+ "supply-chain-planning": {
23
+ basicTypes: ["demand_signal", "forecast", "demand_plan", "exception"],
24
+ advancedTypes: ["capacity_plan", "mrp_run", "accuracy_review"],
25
+ reconcileTypes: ["forecast", "demand_plan", "supply_plan", "capacity_plan", "accuracy_review"],
26
+ advancedFields: ["confidence"],
27
+ compact: { exception: ["market_code", "location_code", "product_code", "quantity", "unit"] }
28
+ },
29
+ "manufacturing-operations": {
30
+ basicTypes: ["production_order", "operation", "completion"],
31
+ advancedTypes: ["batch_genealogy", "cost_variance"],
32
+ reconcileTypes: ["material_issue", "material_return", "labor_report", "completion", "cost_variance"],
33
+ advancedFields: ["revision", "planned_end"],
34
+ compact: { labor_report: ["plant_code", "batch_number", "quantity", "unit", "planned_start"] }
35
+ },
36
+ "quality-management": {
37
+ basicTypes: ["inspection_plan", "inspection", "nonconformance"],
38
+ advancedTypes: ["supplier_quality", "capa", "verification"],
39
+ reconcileTypes: ["inspection", "nonconformance", "disposition", "verification"],
40
+ advancedFields: ["sample_size", "defect_quantity", "disposition_code"],
41
+ compact: { quarantine: ["product_code", "lot_number", "disposition_code"] }
42
+ },
43
+ "discovery-service-mapping": {
44
+ basicTypes: ["source_connection", "discovery_schedule", "discovery_run", "finding"],
45
+ advancedTypes: ["pattern", "identification_result", "topology_map", "retry"],
46
+ reconcileTypes: ["discovery_run", "identification_result", "topology_map"],
47
+ advancedFields: ["credential_reference", "timeout_minutes"],
48
+ compact: { finding: ["source_type", "scope", "service_code"] }
49
+ },
50
+ "event-management": {
51
+ basicTypes: ["raw_event", "normalized_event", "alert", "service_impact"],
52
+ advancedTypes: ["correlation_group", "suppression_rule", "post_event_review"],
53
+ reconcileTypes: ["correlation_group", "service_impact", "post_event_review"],
54
+ advancedFields: ["correlation_key"],
55
+ compact: { post_event_review: ["source_code", "service_code", "occurred_at", "summary"] }
56
+ },
57
+ "software-asset-management": {
58
+ basicTypes: ["software_model", "entitlement", "installation", "renewal"],
59
+ advancedTypes: ["usage_measurement", "license_position", "compliance_review"],
60
+ reconcileTypes: ["entitlement", "usage_measurement", "license_position", "renewal", "compliance_review"],
61
+ advancedFields: ["amount", "currency"],
62
+ compact: { installation: ["publisher", "product_name", "edition_version"] }
63
+ },
64
+ "field-service-management": {
65
+ basicTypes: ["work_order", "appointment", "dispatch", "work_log"],
66
+ advancedTypes: ["travel", "billing_handoff", "follow_up"],
67
+ reconcileTypes: ["part_usage", "billing_handoff"],
68
+ advancedFields: ["part_code"],
69
+ compact: { customer_signature: ["customer_or_site", "asset_tag", "resolution_target"] }
70
+ },
71
+ "security-operations": {
72
+ basicTypes: ["security_event", "security_incident", "vulnerability"],
73
+ advancedTypes: ["exposure", "evidence", "post_incident_review"],
74
+ reconcileTypes: ["recovery_task", "post_incident_review"],
75
+ advancedFields: ["evidence_reference"],
76
+ compact: { evidence: ["detection_source", "affected_service", "detected_at", "evidence_reference"] }
77
+ },
78
+ "risk-compliance-audit": {
79
+ basicTypes: ["risk", "control", "assessment", "remediation"],
80
+ advancedTypes: ["audit", "residual_risk", "continuity_plan"],
81
+ reconcileTypes: ["control_test", "audit", "remediation", "residual_risk"],
82
+ advancedFields: ["test_evidence", "remediation_due"],
83
+ compact: { policy: ["risk_domain", "business_entity", "control_code", "owner"] }
84
+ },
85
+ "sustainability-management": {
86
+ basicTypes: ["activity_data", "calculation", "target", "initiative"],
87
+ advancedTypes: ["allocation", "disclosure", "assurance_evidence"],
88
+ reconcileTypes: ["calculation", "allocation", "target", "disclosure"],
89
+ advancedFields: ["factor_version", "evidence_reference"],
90
+ compact: { emission_factor: ["scope", "activity_category", "unit", "factor_version", "reporting_period"] }
91
+ },
92
+ "service-configuration": {
93
+ basicTypes: ["configuration_item", "ci_relationship", "business_service", "quality_issue"],
94
+ advancedTypes: ["ci_class", "ci_model", "reconciliation_rule"],
95
+ reconcileTypes: ["reconciliation_rule", "quality_issue"],
96
+ advancedFields: ["correlation_key", "owner_group"],
97
+ compact: { business_service: ["service_code", "environment", "criticality", "owner_group"] }
98
+ },
99
+ "talent-management": {
100
+ basicTypes: ["requisition", "application", "offer", "onboarding", "goal", "review"],
101
+ advancedTypes: ["succession_slate", "appeal"],
102
+ reconcileTypes: ["goal", "review", "learning_assignment", "appeal"],
103
+ advancedFields: ["appeal_window_days", "evidence_reference"],
104
+ compact: { goal: ["process_stage", "effective_date", "accountable_owner", "target_outcome"] }
105
+ },
106
+ crm: {
107
+ basicTypes: ["customer_360", "consent", "opportunity_outcome", "service_relationship"],
108
+ advancedTypes: ["commercial_attribution", "quote_handoff", "order_handoff"],
109
+ reconcileTypes: ["opportunity_outcome", "quote_handoff", "order_handoff", "commercial_attribution"],
110
+ advancedFields: ["provider_receipt"],
111
+ compact: { consent: ["relationship_type", "customer_number", "consent_purpose", "consent_version"] }
112
+ },
113
+ product: {
114
+ basicTypes: ["commercial_variant", "assortment_release", "regional_effectivity", "lifecycle_event"],
115
+ advancedTypes: ["engineering_release", "quality_spec_link", "product_retirement"],
116
+ reconcileTypes: ["assortment_release", "engineering_release", "product_retirement"],
117
+ advancedFields: ["quality_specification", "retirement_reason"],
118
+ compact: { regional_effectivity: ["commercial_product_code", "variant_code", "market_scope", "effective_from"] }
119
+ },
120
+ "retail-crm": {
121
+ basicTypes: ["commerce_touchpoint", "consent_evidence", "service_outcome"],
122
+ advancedTypes: ["brand_access", "commercial_attribution", "pos_receipt"],
123
+ reconcileTypes: ["fulfillment_outcome", "pos_receipt", "service_outcome"],
124
+ advancedFields: ["consent_version", "attribution_rule"],
125
+ compact: { consent_evidence: ["channel_family", "member_number", "consent_purpose", "consent_version"] }
126
+ },
127
+ "short-drama": {
128
+ basicTypes: ["delivery_package", "acceptance", "revision_request"],
129
+ advancedTypes: ["rights_clearance", "distribution_receipt", "production_outcome"],
130
+ reconcileTypes: ["acceptance", "distribution_receipt", "production_outcome"],
131
+ advancedFields: ["provider_receipt", "expected_units", "accepted_units"],
132
+ compact: { rights_clearance: ["production_project_code", "delivery_version", "rights_reference"] }
133
+ }
134
+ };
135
+ function it(e, i, l, c) {
136
+ const r = Je[e], b = c.map((m) => m.key), u = new Set(r?.basicTypes ?? l.slice(0, 2).map((m) => m.value)), k = new Set(r?.advancedTypes ?? []), s = new Set(r?.reconcileTypes ?? []), R = new Set(r?.advancedFields ?? []), E = l.filter((m) => k.has(m.value)).map((m) => m.label), z = Object.fromEntries(l.map((m) => {
137
+ const P = r?.compact?.[m.value] ?? b, B = P.filter((w) => R.has(w)), I = c.filter((w) => w.required && P.includes(w.key) && !R.has(w.key)).map((w) => w.key), W = u.has(m.value) ? "basic" : k.has(m.value) ? "advanced" : "standard";
138
+ return [m.value, {
139
+ level: W,
140
+ fieldKeys: P,
141
+ advancedFieldKeys: B,
142
+ requiredFieldKeys: I,
143
+ supportsReconciliation: s.has(m.value),
144
+ capabilityKey: k.has(m.value) ? "specialized_scenarios" : void 0
145
+ }];
146
+ }));
147
+ return {
148
+ applicationId: e,
149
+ recordProfiles: z,
150
+ capabilities: k.size ? [{
151
+ key: "specialized_scenarios",
152
+ label: i === "zh" ? "启用特定业务场景" : "Enable specialized scenarios",
153
+ description: i === "zh" ? `仅在团队确实需要时启用:${E.join("、")}。已有记录不会被删除。` : `Enable only when the team needs: ${E.join(", ")}. Existing records are never deleted.`,
154
+ recordTypes: [...k],
155
+ defaultEnabled: !1
156
+ }] : [],
157
+ copy: i === "zh" ? {
158
+ advancedOptions: "更多选项",
159
+ advancedOptionsHint: "这些信息只在当前场景需要时填写,不影响基本流程。",
160
+ experienceLevel: "默认工作方式",
161
+ experienceLevelHint: "“基础”只提供最常用入口;“标准”适合多数团队;“高级”仍需单独启用特定场景。",
162
+ optionalCapabilities: "按需启用的场景",
163
+ optionalCapabilitiesHint: "这里只控制是否提供入口,不会扩大任何人的数据权限。",
164
+ basic: "基础",
165
+ standard: "标准(推荐)",
166
+ advanced: "高级",
167
+ featureDisabled: "该场景尚未由业务管理员启用。"
168
+ } : {
169
+ advancedOptions: "More options",
170
+ advancedOptionsHint: "Complete these only when this case needs them; the basic flow is unchanged.",
171
+ experienceLevel: "Default way of working",
172
+ experienceLevelHint: "Basic shows the most common entry points; Standard suits most teams; specialized scenarios still need explicit enablement.",
173
+ optionalCapabilities: "Scenarios enabled when needed",
174
+ optionalCapabilitiesHint: "This controls entry points only and never expands anyone's data access.",
175
+ basic: "Basic",
176
+ standard: "Standard (recommended)",
177
+ advanced: "Advanced",
178
+ featureDisabled: "A business administrator has not enabled this scenario."
179
+ }
180
+ };
181
+ }
182
+ function Qe(e, i) {
183
+ const l = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), c = e.filter((s) => s.state === "active" && (!s.effective_from || s.effective_from <= l)).map((s) => {
184
+ if (typeof s.configuration == "string")
185
+ try {
186
+ return { ...s, configuration: JSON.parse(s.configuration) };
187
+ } catch {
188
+ return { ...s, configuration: {} };
189
+ }
190
+ return { ...s, configuration: s.configuration && typeof s.configuration == "object" ? s.configuration : {} };
191
+ }).filter((s) => "experience_level" in s.configuration || "enabled_features" in s.configuration).at(-1), r = c?.configuration.experience_level, b = r === "basic" || r === "advanced" ? r : "standard", u = Array.isArray(c?.configuration.enabled_features) ? c.configuration.enabled_features.filter((s) => typeof s == "string") : [], k = new Set(i.capabilities.filter((s) => s.defaultEnabled).map((s) => s.key));
192
+ return u.forEach((s) => k.add(s)), { experienceLevel: b, enabledFeatures: k };
193
+ }
194
+ function me(e, i, l, c) {
195
+ const r = { basic: 0, standard: 1, advanced: 2 };
196
+ return e.filter((b) => {
197
+ const u = i.recordProfiles[b.value];
198
+ return u ? r[u.level] > r[l] ? !1 : !u.capabilityKey || c.has(u.capabilityKey) : !0;
199
+ });
200
+ }
201
+ function Ve(e, i, l) {
202
+ const c = l.capabilities.filter((u) => i.has(u.key)), r = e === "basic" ? /* @__PURE__ */ new Set(["basic"]) : e === "standard" ? /* @__PURE__ */ new Set(["basic", "standard"]) : /* @__PURE__ */ new Set(["basic", "standard", "advanced"]), b = Object.entries(l.recordProfiles).filter(([, u]) => r.has(u.level) && (!u.capabilityKey || i.has(u.capabilityKey))).map(([u]) => u);
203
+ return { experience_level: e, enabled_features: c.map((u) => u.key), enabled_record_types: b };
204
+ }
205
+ const ye = () => (/* @__PURE__ */ new Date()).toISOString().replace(/[^0-9]/g, "").slice(0, 14);
206
+ function rt({
207
+ spec: e,
208
+ api: i,
209
+ footer: l
210
+ }) {
211
+ const [c, r] = g([]), [b, u] = g([]), [k, s] = g(!0), [R, E] = g(!1), [z, m] = g(""), [P, B] = g(""), [I, W] = g(e.taskFlows[0]?.id || "work"), [w, x] = g(null), [N, Z] = g(null), [M, ge] = g(null), [F, G] = g({ search: "", recordType: "", state: "" }), [p, S] = g({
212
+ recordType: e.recordTypes[0]?.value || "work_item",
213
+ name: "",
214
+ description: "",
215
+ priority: "normal",
216
+ dueAt: "",
217
+ values: Object.fromEntries(e.fields.map((t) => [t.key, t.type === "select" && t.options?.[0]?.value || ""]))
218
+ }), [ee, te] = g(""), [U, ce] = g(""), [h, $] = g({ expected: "", actual: "", tolerance: "0", resolution: "" }), [d, C] = g({ policyType: e.policyTypes[0]?.value || "default", code: "", name: "", region: "GLOBAL", version: "1", effectiveFrom: "", threshold: "0", tolerance: "0" }), [K, le] = g("standard"), [O, se] = g(/* @__PURE__ */ new Set()), J = Ce(async () => {
219
+ s(!0), m("");
220
+ try {
221
+ const [t, o] = await Promise.all([i.queryRecords(), i.queryPolicies()]);
222
+ r(t), u(o), W((f) => {
223
+ const V = e.taskFlows.find((v) => v.id === f);
224
+ return V && t.some((v) => V.recordTypes.includes(v.record_type)) ? f : e.taskFlows.find((v) => t.some((ie) => v.recordTypes.includes(ie.record_type)))?.id || f;
225
+ });
226
+ const y = Qe(o, e.experience);
227
+ le(y.experienceLevel), se(y.enabledFeatures);
228
+ } catch (t) {
229
+ m(`${e.copy.loadError}: ${t.message}`);
230
+ } finally {
231
+ s(!1);
232
+ }
233
+ }, [i, e.copy.loadError, e.experience, e.taskFlows]);
234
+ ue(() => {
235
+ J();
236
+ }, [J]);
237
+ const Q = async (t) => {
238
+ E(!0), m(""), B("");
239
+ try {
240
+ await t(), B(e.copy.saved), x(null), Z(null), te(""), await J();
241
+ } catch (o) {
242
+ m(`${e.copy.saveError}: ${o.message}`);
243
+ } finally {
244
+ E(!1);
245
+ }
246
+ }, T = L(
247
+ () => e.taskFlows.find((t) => t.id === I) || e.taskFlows[0],
248
+ [I, e.taskFlows]
249
+ ), A = L(
250
+ () => c.filter((t) => !T || T.recordTypes.includes(t.record_type)),
251
+ [T, c]
252
+ ), de = L(
253
+ () => We(A, F),
254
+ [F, A]
255
+ ), D = L(
256
+ () => me(e.recordTypes, e.experience, K, O).filter((t) => !T || T.recordTypes.includes(t.value)),
257
+ [T, O, K, e.experience, e.recordTypes]
258
+ );
259
+ ue(() => {
260
+ D.length && !D.some((t) => t.value === p.recordType) && S((t) => ({ ...t, recordType: D[0].value }));
261
+ }, [D, p.recordType]);
262
+ const ae = L(() => b.filter((t) => t.state === "active" && Number(t.threshold || 0) > 0).map((t) => Number(t.threshold || 0)).at(-1) || 0, [b]), pe = L(() => ({
263
+ active: A.filter((t) => !e.finalStates.includes(t.state)).length,
264
+ review: A.filter((t) => ["review", "submitted", "assessed", "triaged", "calculated"].includes(t.state)).length,
265
+ exception: A.filter((t) => Number(t.open_reconciliations || 0) > 0 || ["exception", "quality_hold", "open"].includes(t.reconciliation_state || "") || ae > 0 && Number(t.amount || t.quantity || 0) > ae).length,
266
+ closed: A.filter((t) => e.finalStates.includes(t.state)).length
267
+ }), [ae, A, e.finalStates]), be = (t) => {
268
+ W(t.id), G({ search: "", recordType: "", state: "" });
269
+ const o = me(e.recordTypes, e.experience, K, O).find((y) => t.recordTypes.includes(y.value));
270
+ o && S((y) => ({ ...y, recordType: o.value }));
271
+ }, he = (t) => {
272
+ const o = e.transitions[t.state]?.[0] || "";
273
+ Z(t), ce(o), te(""), x("transition");
274
+ }, _e = (t) => {
275
+ Z(t);
276
+ const o = b.filter((y) => y.state === "active").map((y) => Number(y.tolerance || 0)).at(-1) || 0;
277
+ $({ expected: String(t.amount || t.quantity || ""), actual: "", tolerance: String(o), resolution: "" }), x("reconcile");
278
+ }, xe = () => {
279
+ const t = e.experience.recordProfiles[p.recordType], o = Me(p, t?.requiredFieldKeys || e.fields.filter((f) => f.required).map((f) => f.key));
280
+ if (!o.valid) {
281
+ m(`${e.copy.validation}: ${o.missing.join(", ")}`);
282
+ return;
283
+ }
284
+ const y = ye();
285
+ Q(() => i.createRecord({
286
+ record_type: p.recordType,
287
+ name: p.name.trim(),
288
+ description: p.description.trim(),
289
+ priority: p.priority,
290
+ due_at: p.dueAt || null,
291
+ values: p.values,
292
+ source_app: M && e.context?.providerApp || null,
293
+ source_object_ref: M?.id || null,
294
+ source_label: M?.primary || null,
295
+ idempotency_key: X("create", p.name, y)
296
+ }));
297
+ }, Te = () => {
298
+ if (!N) return;
299
+ if (!Ge(N.state, U, e.transitions).allowed || ee.trim().length < 10) {
300
+ m(e.copy.evidenceHint);
301
+ return;
302
+ }
303
+ Q(() => i.transitionRecord({
304
+ record_id: N.id,
305
+ target_state: U,
306
+ evidence_note: ee.trim(),
307
+ idempotency_key: X("transition", N.number, `${N.state}-${U}`)
308
+ }));
309
+ }, Ne = () => {
310
+ if (!N) return;
311
+ let t;
312
+ try {
313
+ t = Ue(Number(h.expected), Number(h.actual), Number(h.tolerance), h.resolution);
314
+ } catch (o) {
315
+ m(o.message);
316
+ return;
317
+ }
318
+ if (t.state === "open") {
319
+ m(e.copy.reconciliationHint);
320
+ return;
321
+ }
322
+ Q(() => i.reconcileRecord({
323
+ record_id: N.id,
324
+ reconciliation_type: N.record_type,
325
+ expected_value: Number(h.expected),
326
+ actual_value: Number(h.actual),
327
+ tolerance: Number(h.tolerance),
328
+ resolution: h.resolution.trim(),
329
+ idempotency_key: X("reconcile", N.number, ye())
330
+ }));
331
+ }, we = () => {
332
+ const t = d.code.trim() || `${d.policyType}-SETTINGS`;
333
+ if (d.name.trim().length < 3 || !d.effectiveFrom) {
334
+ m(e.copy.validation);
335
+ return;
336
+ }
337
+ Q(() => i.savePolicy({
338
+ policy_type: d.policyType,
339
+ code: t.toUpperCase(),
340
+ name: d.name.trim(),
341
+ region_code: d.region.trim().toUpperCase() || "GLOBAL",
342
+ version: Number(d.version),
343
+ effective_from: d.effectiveFrom,
344
+ threshold: Number(d.threshold),
345
+ tolerance: Number(d.tolerance),
346
+ configuration: Ve(K, O, e.experience),
347
+ idempotency_key: X("policy", t, d.version)
348
+ }));
349
+ };
350
+ return /* @__PURE__ */ n(
351
+ Oe,
352
+ {
353
+ title: e.title,
354
+ description: e.description,
355
+ icon: e.icon,
356
+ actions: /* @__PURE__ */ n("div", { className: "flex w-full flex-wrap gap-2 sm:w-auto sm:justify-end", children: [
357
+ /* @__PURE__ */ n(q, { onClick: () => x("help"), children: [
358
+ /* @__PURE__ */ a(je, { className: "h-4 w-4" }),
359
+ e.copy.help
360
+ ] }),
361
+ /* @__PURE__ */ n(q, { onClick: () => void J(), children: [
362
+ /* @__PURE__ */ a(Ee, { className: "h-4 w-4" }),
363
+ e.copy.refresh
364
+ ] }),
365
+ /* @__PURE__ */ n(q, { onClick: () => x("policy"), children: [
366
+ /* @__PURE__ */ a($e, { className: "h-4 w-4" }),
367
+ e.copy.createPolicy
368
+ ] }),
369
+ /* @__PURE__ */ n(q, { primary: !0, onClick: () => x("record"), children: [
370
+ /* @__PURE__ */ a(Ke, { className: "h-4 w-4" }),
371
+ T?.createLabel || e.copy.createRecord
372
+ ] })
373
+ ] }),
374
+ children: [
375
+ z && /* @__PURE__ */ n(ve, { tone: "error", children: [
376
+ /* @__PURE__ */ a(qe, { className: "h-4 w-4" }),
377
+ z
378
+ ] }),
379
+ P && /* @__PURE__ */ n(ve, { tone: "success", children: [
380
+ /* @__PURE__ */ a(Re, { className: "h-4 w-4" }),
381
+ P
382
+ ] }),
383
+ /* @__PURE__ */ a("nav", { className: "mb-5 grid gap-3 md:grid-cols-2 xl:grid-cols-3", "aria-label": e.title, children: e.taskFlows.map((t) => {
384
+ const o = t.id === T?.id, y = c.filter((f) => t.recordTypes.includes(f.record_type) && !e.finalStates.includes(f.state)).length;
385
+ return /* @__PURE__ */ n("button", { type: "button", "aria-current": o ? "page" : void 0, onClick: () => be(t), className: `min-h-[112px] rounded-xl border p-4 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ${o ? "border-primary bg-primary/5" : "bg-card hover:bg-muted/35"}`, children: [
386
+ /* @__PURE__ */ n("span", { className: "flex items-start justify-between gap-3", children: [
387
+ /* @__PURE__ */ a("strong", { className: "text-sm", children: t.title }),
388
+ /* @__PURE__ */ a("span", { className: "rounded-md bg-muted px-2 py-1 text-xs font-semibold tabular-nums", children: y })
389
+ ] }),
390
+ /* @__PURE__ */ a("span", { className: "mt-2 block text-sm leading-6 text-muted-foreground", children: t.description })
391
+ ] }, t.id);
392
+ }) }),
393
+ /* @__PURE__ */ a("section", { className: "grid grid-cols-2 gap-3 lg:grid-cols-4", "aria-label": e.copy.metricsLabel, children: Object.keys(pe).map((t) => /* @__PURE__ */ n("article", { className: "rounded-xl bg-muted/45 px-4 py-4", children: [
394
+ /* @__PURE__ */ a("strong", { className: "block text-2xl tabular-nums", children: pe[t] }),
395
+ /* @__PURE__ */ a("span", { className: "mt-1 block text-xs font-medium text-muted-foreground", children: e.copy.metrics[t] })
396
+ ] }, t)) }),
397
+ /* @__PURE__ */ a("section", { className: "mt-5 rounded-2xl border bg-card p-3 sm:p-4", children: /* @__PURE__ */ n("div", { className: "grid gap-3 lg:grid-cols-[minmax(14rem,1fr)_12rem_12rem]", children: [
398
+ /* @__PURE__ */ n("label", { className: "relative block", children: [
399
+ /* @__PURE__ */ a("span", { className: "sr-only", children: e.copy.search }),
400
+ /* @__PURE__ */ a(Ae, { className: "pointer-events-none absolute left-3 top-3.5 h-4 w-4 text-muted-foreground" }),
401
+ /* @__PURE__ */ a("input", { className: "enterprise-input min-h-[44px] pl-9", value: F.search, placeholder: e.copy.search, onChange: (t) => G({ ...F, search: t.target.value }) })
402
+ ] }),
403
+ /* @__PURE__ */ n(oe, { "aria-label": e.copy.allTypes, className: "enterprise-input min-h-[44px]", value: F.recordType, onChange: (t) => G({ ...F, recordType: t.target.value }), children: [
404
+ /* @__PURE__ */ a("option", { value: "", children: e.copy.allTypes }),
405
+ e.recordTypes.filter((t) => !T || T.recordTypes.includes(t.value)).map((t) => /* @__PURE__ */ a("option", { value: t.value, children: t.label }, t.value))
406
+ ] }),
407
+ /* @__PURE__ */ n(oe, { "aria-label": e.copy.allStates, className: "enterprise-input min-h-[44px]", value: F.state, onChange: (t) => G({ ...F, state: t.target.value }), children: [
408
+ /* @__PURE__ */ a("option", { value: "", children: e.copy.allStates }),
409
+ e.states.map((t) => /* @__PURE__ */ a("option", { value: t.value, children: t.label }, t.value))
410
+ ] })
411
+ ] }) }),
412
+ /* @__PURE__ */ a(De, { loading: k, error: null, children: /* @__PURE__ */ n("section", { className: "mt-4 grid gap-4", children: [
413
+ /* @__PURE__ */ n("div", { className: "min-w-0 overflow-hidden rounded-2xl border bg-card", children: [
414
+ /* @__PURE__ */ n("div", { className: "border-b px-4 py-3", children: [
415
+ /* @__PURE__ */ a("h2", { className: "font-semibold", children: T?.title || e.copy.queue }),
416
+ T?.description && /* @__PURE__ */ a("p", { className: "mt-1 text-sm leading-6 text-muted-foreground", children: T.description })
417
+ ] }),
418
+ de.length ? /* @__PURE__ */ a("div", { className: "divide-y", children: de.map((t) => {
419
+ const o = e.transitions[t.state] || [], y = e.experience.recordProfiles[t.record_type];
420
+ return /* @__PURE__ */ n("article", { className: "grid gap-3 px-4 py-4 transition-colors hover:bg-muted/30 lg:grid-cols-[minmax(0,1fr)_auto] lg:items-center", children: [
421
+ /* @__PURE__ */ n("div", { className: "min-w-0", children: [
422
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2 text-xs text-muted-foreground", children: [
423
+ /* @__PURE__ */ a("span", { className: "font-mono tabular-nums", children: t.number }),
424
+ /* @__PURE__ */ a("span", { children: e.recordTypes.find((f) => f.value === t.record_type)?.label || t.record_type }),
425
+ /* @__PURE__ */ a(fe, { label: e.states.find((f) => f.value === t.state)?.label || t.state })
426
+ ] }),
427
+ /* @__PURE__ */ a("h3", { className: "mt-1 truncate font-semibold", children: t.name }),
428
+ /* @__PURE__ */ a("p", { className: "mt-1 line-clamp-2 text-sm leading-6 text-muted-foreground", children: t.description }),
429
+ /* @__PURE__ */ n("p", { className: "mt-2 text-xs text-muted-foreground", children: [
430
+ t.source_label || "—",
431
+ " · ",
432
+ t.updated_at ? Fe(new Date(t.updated_at)) : "—"
433
+ ] })
434
+ ] }),
435
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap gap-2 lg:justify-end", children: [
436
+ y?.supportsReconciliation && /* @__PURE__ */ n(q, { onClick: () => _e(t), children: [
437
+ /* @__PURE__ */ a(Pe, { className: "h-4 w-4" }),
438
+ e.copy.actions.reconcile
439
+ ] }),
440
+ /* @__PURE__ */ n(q, { primary: !0, disabled: !o.length, onClick: () => he(t), children: [
441
+ o.length ? e.copy.actions.advance : e.copy.noNextAction,
442
+ /* @__PURE__ */ a(Le, { className: "h-4 w-4" })
443
+ ] })
444
+ ] })
445
+ ] }, t.id);
446
+ }) }) : /* @__PURE__ */ a("div", { className: "p-12 text-center text-sm text-muted-foreground", children: T?.emptyText || e.copy.empty })
447
+ ] }),
448
+ /* @__PURE__ */ n("details", { className: "group rounded-2xl border bg-card p-4", children: [
449
+ /* @__PURE__ */ n("summary", { className: "flex min-h-[44px] cursor-pointer list-none items-center justify-between gap-3 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [
450
+ /* @__PURE__ */ n("span", { children: [
451
+ /* @__PURE__ */ a("strong", { className: "block text-sm", children: e.copy.policies }),
452
+ /* @__PURE__ */ a("span", { className: "mt-1 block text-sm leading-6 text-muted-foreground", children: e.copy.policyIntro })
453
+ ] }),
454
+ /* @__PURE__ */ a(re, { className: "h-4 w-4 shrink-0 transition-transform group-open:rotate-180" })
455
+ ] }),
456
+ /* @__PURE__ */ n("div", { className: "mt-4 grid gap-3 border-t pt-4 md:grid-cols-2 xl:grid-cols-3", children: [
457
+ b.map((t) => /* @__PURE__ */ n("article", { className: "rounded-xl bg-muted/45 p-3", children: [
458
+ /* @__PURE__ */ n("div", { className: "flex items-center justify-between gap-2", children: [
459
+ /* @__PURE__ */ a("strong", { className: "text-sm", children: t.name }),
460
+ /* @__PURE__ */ a(fe, { label: t.state })
461
+ ] }),
462
+ /* @__PURE__ */ n("p", { className: "mt-1 text-xs text-muted-foreground", children: [
463
+ t.code,
464
+ " · ",
465
+ t.region_code,
466
+ " · v",
467
+ t.version
468
+ ] })
469
+ ] }, t.id)),
470
+ !b.length && /* @__PURE__ */ a("p", { className: "text-sm text-muted-foreground", children: e.copy.empty })
471
+ ] })
472
+ ] })
473
+ ] }) }),
474
+ l,
475
+ w === "record" && /* @__PURE__ */ a(H, { title: T?.createLabel || e.copy.createRecord, closeLabel: e.copy.close, close: () => x(null), children: /* @__PURE__ */ n("div", { className: "grid gap-4", children: [
476
+ /* @__PURE__ */ a(j, { label: e.copy.fields.type, value: p.recordType, options: D, set: (t) => S({ ...p, recordType: t }) }),
477
+ e.context && /* @__PURE__ */ a(Se, { label: e.context.label, description: e.context.description, placeholder: e.context.placeholder, emptyText: e.context.emptyText, unavailableText: e.context.unavailableText, forbiddenText: e.context.forbiddenText, loadPage: e.context.loadPage, selected: M, onSelect: ge }),
478
+ /* @__PURE__ */ a(_, { label: e.copy.fields.name, value: p.name, set: (t) => S({ ...p, name: t }), required: !0 }),
479
+ /* @__PURE__ */ a(_, { label: e.copy.fields.description, type: "textarea", value: p.description, set: (t) => S({ ...p, description: t }), required: !0 }),
480
+ (() => {
481
+ const t = e.experience.recordProfiles[p.recordType], o = new Set(t?.fieldKeys || e.fields.map((v) => v.key)), y = new Set(t?.advancedFieldKeys || []), f = e.fields.filter((v) => o.has(v.key) && !y.has(v.key)), V = e.fields.filter((v) => o.has(v.key) && y.has(v.key)), ne = (v) => /* @__PURE__ */ a(Xe, { locale: e.locale, field: { ...v, required: t?.requiredFieldKeys.includes(v.key) ?? v.required }, value: p.values[v.key], set: (ie) => S({ ...p, values: { ...p.values, [v.key]: ie } }) }, v.key);
482
+ return /* @__PURE__ */ n(ke, { children: [
483
+ f.map(ne),
484
+ /* @__PURE__ */ n("details", { className: "group rounded-xl border bg-muted/20 p-3", children: [
485
+ /* @__PURE__ */ n("summary", { className: "flex min-h-[44px] cursor-pointer list-none items-center justify-between gap-3 font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [
486
+ /* @__PURE__ */ n("span", { children: [
487
+ /* @__PURE__ */ a("span", { className: "block text-sm", children: e.experience.copy.advancedOptions }),
488
+ /* @__PURE__ */ a("span", { className: "mt-0.5 block text-xs font-normal text-muted-foreground", children: e.experience.copy.advancedOptionsHint })
489
+ ] }),
490
+ /* @__PURE__ */ a(re, { className: "h-4 w-4 shrink-0 transition-transform group-open:rotate-180" })
491
+ ] }),
492
+ /* @__PURE__ */ n("div", { className: "mt-3 grid gap-4 border-t pt-4", children: [
493
+ /* @__PURE__ */ n("div", { className: "grid gap-4 sm:grid-cols-2", children: [
494
+ /* @__PURE__ */ a(j, { label: e.copy.fields.priority, value: p.priority, options: e.copy.priorities, set: (v) => S({ ...p, priority: v }) }),
495
+ /* @__PURE__ */ a(_, { label: e.copy.fields.dueAt, type: "date", locale: e.locale, value: p.dueAt, set: (v) => S({ ...p, dueAt: v }) })
496
+ ] }),
497
+ V.map(ne)
498
+ ] })
499
+ ] })
500
+ ] });
501
+ })(),
502
+ /* @__PURE__ */ a(Y, { copy: e.copy, saving: R, cancel: () => x(null), save: xe })
503
+ ] }) }),
504
+ w === "policy" && /* @__PURE__ */ a(H, { title: e.copy.createPolicy, closeLabel: e.copy.close, close: () => x(null), children: /* @__PURE__ */ n("div", { className: "grid gap-4", children: [
505
+ /* @__PURE__ */ a(j, { label: e.copy.fields.policyType, value: d.policyType, options: e.policyTypes, set: (t) => C({ ...d, policyType: t }) }),
506
+ /* @__PURE__ */ a(_, { label: e.copy.fields.name, value: d.name, set: (t) => C({ ...d, name: t }), required: !0 }),
507
+ /* @__PURE__ */ a(_, { label: e.copy.fields.effectiveFrom, type: "date", locale: e.locale, value: d.effectiveFrom, set: (t) => C({ ...d, effectiveFrom: t }), required: !0 }),
508
+ /* @__PURE__ */ n("div", { className: "rounded-xl bg-muted/35 p-4", children: [
509
+ /* @__PURE__ */ a(j, { label: e.experience.copy.experienceLevel, value: K, options: [
510
+ { value: "basic", label: e.experience.copy.basic },
511
+ { value: "standard", label: e.experience.copy.standard },
512
+ { value: "advanced", label: e.experience.copy.advanced }
513
+ ], set: (t) => le(t) }),
514
+ /* @__PURE__ */ a("p", { className: "mt-2 text-xs leading-5 text-muted-foreground", children: e.experience.copy.experienceLevelHint })
515
+ ] }),
516
+ !!e.experience.capabilities.length && /* @__PURE__ */ n("fieldset", { className: "rounded-xl border p-4", children: [
517
+ /* @__PURE__ */ a("legend", { className: "px-1 text-sm font-semibold", children: e.experience.copy.optionalCapabilities }),
518
+ /* @__PURE__ */ a("p", { className: "mb-3 text-xs leading-5 text-muted-foreground", children: e.experience.copy.optionalCapabilitiesHint }),
519
+ /* @__PURE__ */ a("div", { className: "grid gap-3", children: e.experience.capabilities.map((t) => /* @__PURE__ */ n("label", { className: "flex min-h-[44px] items-start gap-3 rounded-lg bg-muted/35 p-3 text-sm", children: [
520
+ /* @__PURE__ */ a(He, { className: "mt-1", checked: O.has(t.key), onChange: (o) => se((y) => {
521
+ const f = new Set(y);
522
+ return o.target.checked ? f.add(t.key) : f.delete(t.key), f;
523
+ }) }),
524
+ /* @__PURE__ */ n("span", { children: [
525
+ /* @__PURE__ */ a("strong", { className: "block", children: t.label }),
526
+ /* @__PURE__ */ a("span", { className: "mt-1 block text-xs leading-5 text-muted-foreground", children: t.description })
527
+ ] })
528
+ ] }, t.key)) })
529
+ ] }),
530
+ /* @__PURE__ */ n("details", { className: "group rounded-xl border bg-muted/20 p-3", children: [
531
+ /* @__PURE__ */ n("summary", { className: "flex min-h-[44px] cursor-pointer list-none items-center justify-between gap-3 text-sm font-medium", children: [
532
+ /* @__PURE__ */ a("span", { children: e.experience.copy.advancedOptions }),
533
+ /* @__PURE__ */ a(re, { className: "h-4 w-4 transition-transform group-open:rotate-180" })
534
+ ] }),
535
+ /* @__PURE__ */ n("div", { className: "mt-3 grid gap-4 border-t pt-4 sm:grid-cols-2", children: [
536
+ /* @__PURE__ */ a(_, { label: e.copy.fields.region, value: d.region, set: (t) => C({ ...d, region: t }) }),
537
+ /* @__PURE__ */ a(_, { label: e.copy.fields.code, value: d.code, set: (t) => C({ ...d, code: t }) }),
538
+ /* @__PURE__ */ a(_, { label: e.copy.fields.version, type: "number", value: d.version, set: (t) => C({ ...d, version: t }) }),
539
+ /* @__PURE__ */ a(_, { label: e.copy.fields.threshold, type: "number", value: d.threshold, set: (t) => C({ ...d, threshold: t }) }),
540
+ /* @__PURE__ */ a(_, { label: e.copy.fields.tolerance, type: "number", value: d.tolerance, set: (t) => C({ ...d, tolerance: t }) })
541
+ ] })
542
+ ] }),
543
+ /* @__PURE__ */ a(Y, { copy: e.copy, saving: R, cancel: () => x(null), save: we })
544
+ ] }) }),
545
+ w === "transition" && N && /* @__PURE__ */ a(H, { title: `${e.copy.actions.advance} · ${N.number}`, closeLabel: e.copy.close, close: () => x(null), children: /* @__PURE__ */ n("div", { className: "grid gap-4", children: [
546
+ /* @__PURE__ */ a(j, { label: e.copy.fields.state, value: U, options: (e.transitions[N.state] || []).map((t) => ({ value: t, label: e.states.find((o) => o.value === t)?.label || t })), set: ce }),
547
+ /* @__PURE__ */ a(_, { label: e.copy.fields.evidence, type: "textarea", value: ee, set: te, required: !0 }),
548
+ /* @__PURE__ */ a("p", { className: "text-sm leading-6 text-muted-foreground", children: e.copy.evidenceHint }),
549
+ /* @__PURE__ */ a(Y, { copy: e.copy, saving: R, cancel: () => x(null), save: Te })
550
+ ] }) }),
551
+ w === "reconcile" && N && /* @__PURE__ */ a(H, { title: `${e.copy.actions.reconcile} · ${N.number}`, closeLabel: e.copy.close, close: () => x(null), children: /* @__PURE__ */ n("div", { className: "grid gap-4 sm:grid-cols-2", children: [
552
+ /* @__PURE__ */ a(_, { label: e.copy.fields.expected, type: "number", value: h.expected, set: (t) => $({ ...h, expected: t }), required: !0 }),
553
+ /* @__PURE__ */ a(_, { label: e.copy.fields.actual, type: "number", value: h.actual, set: (t) => $({ ...h, actual: t }), required: !0 }),
554
+ /* @__PURE__ */ a(_, { label: e.copy.fields.tolerance, type: "number", value: h.tolerance, set: (t) => $({ ...h, tolerance: t }), required: !0 }),
555
+ /* @__PURE__ */ a("div", {}),
556
+ /* @__PURE__ */ a("div", { className: "sm:col-span-2", children: /* @__PURE__ */ a(_, { label: e.copy.fields.resolution, type: "textarea", value: h.resolution, set: (t) => $({ ...h, resolution: t }) }) }),
557
+ /* @__PURE__ */ a("div", { className: "sm:col-span-2", children: /* @__PURE__ */ a(Y, { copy: e.copy, saving: R, cancel: () => x(null), save: Ne }) })
558
+ ] }) }),
559
+ w === "help" && /* @__PURE__ */ a(H, { title: e.copy.help, closeLabel: e.copy.close, close: () => x(null), children: /* @__PURE__ */ a("div", { className: "grid gap-5", children: e.help.map((t, o) => /* @__PURE__ */ n("section", { className: "rounded-xl bg-muted/35 p-4", children: [
560
+ /* @__PURE__ */ a("p", { className: "text-xs font-semibold text-muted-foreground", children: String(o + 1).padStart(2, "0") }),
561
+ /* @__PURE__ */ a("h2", { className: "mt-1 font-semibold", children: t.title }),
562
+ /* @__PURE__ */ a("p", { className: "mt-2 text-sm leading-6 text-muted-foreground", children: t.body }),
563
+ /* @__PURE__ */ a("ol", { className: "mt-3 grid gap-2 text-sm leading-6", children: t.steps.map((y) => /* @__PURE__ */ n("li", { className: "flex gap-2", children: [
564
+ /* @__PURE__ */ a("span", { className: "text-muted-foreground", children: "—" }),
565
+ /* @__PURE__ */ a("span", { children: y })
566
+ ] }, y)) })
567
+ ] }, t.title)) }) })
568
+ ]
569
+ }
570
+ );
571
+ }
572
+ function q({ children: e, onClick: i, primary: l = !1, disabled: c = !1 }) {
573
+ return /* @__PURE__ */ a("button", { type: "button", disabled: c, onClick: i, className: `inline-flex min-h-[44px] items-center justify-center gap-2 rounded-lg px-3 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 ${l ? "bg-primary text-primary-foreground hover:bg-primary/90" : "border bg-background hover:bg-accent"}`, children: e });
574
+ }
575
+ function ve({ children: e, tone: i }) {
576
+ return /* @__PURE__ */ a("div", { role: i === "error" ? "alert" : "status", className: `my-4 flex items-center gap-2 rounded-xl border p-4 text-sm ${i === "error" ? "border-destructive/30 bg-destructive/5 text-destructive" : "border-emerald-200 bg-emerald-50 text-emerald-800"}`, children: e });
577
+ }
578
+ function fe({ label: e }) {
579
+ return /* @__PURE__ */ a("span", { className: "inline-flex rounded-md bg-muted px-2 py-1 text-xs font-semibold text-foreground", children: e });
580
+ }
581
+ function H({ title: e, closeLabel: i, close: l, children: c }) {
582
+ return /* @__PURE__ */ a(ze, { open: !0, onClose: l, title: e, closeLabel: i, size: "lg", children: c });
583
+ }
584
+ function _({ label: e, value: i, set: l, type: c = "text", required: r = !1, locale: b = "en" }) {
585
+ return /* @__PURE__ */ n("label", { className: "grid gap-1.5 text-sm font-medium", children: [
586
+ /* @__PURE__ */ n("span", { children: [
587
+ e,
588
+ r ? " *" : ""
589
+ ] }),
590
+ c === "textarea" ? /* @__PURE__ */ a("textarea", { className: "enterprise-input min-h-[112px] resize-y", value: i, required: r, onChange: (u) => l(u.target.value) }) : c === "date" ? /* @__PURE__ */ a(Be, { value: i, onChange: l, locale: b, clearable: !r, "aria-label": e, popoverLayer: "aboveModal" }) : c === "datetime-local" ? /* @__PURE__ */ a(Ie, { value: i, onChange: l, locale: b, clearable: !r, "aria-label": e, popoverLayer: "aboveModal" }) : /* @__PURE__ */ a("input", { className: "enterprise-input min-h-[44px]", type: c, value: i, required: r, onChange: (u) => l(u.target.value) })
591
+ ] });
592
+ }
593
+ function j({ label: e, value: i, options: l, set: c }) {
594
+ return /* @__PURE__ */ n("label", { className: "grid gap-1.5 text-sm font-medium", children: [
595
+ /* @__PURE__ */ a("span", { children: e }),
596
+ /* @__PURE__ */ a(oe, { className: "enterprise-input min-h-[44px]", value: i, onChange: (r) => c(r.target.value), children: l.map((r) => /* @__PURE__ */ a("option", { value: r.value, children: r.label }, r.value)) })
597
+ ] });
598
+ }
599
+ function Xe({ field: e, value: i, set: l, locale: c }) {
600
+ return e.type === "select" ? /* @__PURE__ */ n("div", { children: [
601
+ /* @__PURE__ */ a(j, { label: e.label, value: String(i || e.options?.[0]?.value || ""), options: e.options || [], set: l }),
602
+ e.help && /* @__PURE__ */ a("p", { className: "mt-1 text-xs text-muted-foreground", children: e.help })
603
+ ] }) : /* @__PURE__ */ n("div", { children: [
604
+ /* @__PURE__ */ a(_, { label: e.label, type: e.type, locale: c, value: String(i ?? ""), set: (r) => l(e.type === "number" && r !== "" ? Number(r) : r), required: e.required }),
605
+ e.help && /* @__PURE__ */ a("p", { className: "mt-1 text-xs text-muted-foreground", children: e.help })
606
+ ] });
607
+ }
608
+ function Y({ copy: e, saving: i, cancel: l, save: c }) {
609
+ return /* @__PURE__ */ n("div", { className: "mt-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", children: [
610
+ /* @__PURE__ */ a(q, { onClick: l, children: e.actions.cancel }),
611
+ /* @__PURE__ */ a(q, { primary: !0, disabled: i, onClick: c, children: e.actions.save })
612
+ ] });
613
+ }
614
+ export {
615
+ rt as TaskWorkspace,
616
+ me as availableRecordTypes,
617
+ Ue as calculateReconciliation,
618
+ X as createIdempotencyKey,
619
+ it as createWorkspaceExperience,
620
+ Ve as experiencePolicyConfiguration,
621
+ We as filterBusinessRecords,
622
+ Qe as readExperienceConfiguration,
623
+ Me as validateRecordDraft,
624
+ Ge as validateTransition
625
+ };
626
+ //# sourceMappingURL=task-workspace.js.map