@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,624 @@
1
+ import { useRef as I, useEffect as w, useState as g, useMemo as q, useCallback as F, useId as W } from "react";
2
+ import { useLocation as K } from "react-router-dom";
3
+ import Q from "genispace";
4
+ import { G as C, a as H } from "./shell-DIHnXIUb.js";
5
+ import { jsxs as u, jsx as a, Fragment as O } from "react/jsx-runtime";
6
+ function M(e) {
7
+ return e.replace(/\/$/, "") || "/";
8
+ }
9
+ function X(e, r) {
10
+ return M(e) === M(r);
11
+ }
12
+ function ge(e, r) {
13
+ const { pathname: t } = K(), n = I(r);
14
+ n.current = r;
15
+ const s = X(t, e);
16
+ w(() => {
17
+ s && n.current();
18
+ }, [s, t, e]);
19
+ }
20
+ const J = "new";
21
+ function Z(e) {
22
+ return !e?.trim() || e === J;
23
+ }
24
+ function xe(e) {
25
+ return !Z(e);
26
+ }
27
+ function ye(e) {
28
+ const r = e?.trim();
29
+ return !r || r === J ? crypto.randomUUID() : r;
30
+ }
31
+ const Ne = [
32
+ "USD",
33
+ "CNY",
34
+ "EUR",
35
+ "GBP",
36
+ "JPY",
37
+ "HKD",
38
+ "AUD",
39
+ "CAD",
40
+ "SGD",
41
+ "CHF"
42
+ ], j = /* @__PURE__ */ new Map();
43
+ function ee(e) {
44
+ let r = j.get(e);
45
+ return r || (r = new Intl.DisplayNames([e], { type: "currency" }), j.set(e, r)), r;
46
+ }
47
+ function we(e, r = "en") {
48
+ const t = e.trim().toUpperCase();
49
+ try {
50
+ return ee(r).of(t) ?? t;
51
+ } catch {
52
+ return t;
53
+ }
54
+ }
55
+ function re(e) {
56
+ if (Array.isArray(e))
57
+ return e.filter((r) => typeof r == "string").map((r) => r.trim().toUpperCase());
58
+ if (typeof e == "string" && e.trim())
59
+ try {
60
+ return re(JSON.parse(e));
61
+ } catch {
62
+ return [];
63
+ }
64
+ return [];
65
+ }
66
+ function Ae(e, r = {}) {
67
+ const t = (r.minOne ?? "USD").toUpperCase(), n = /* @__PURE__ */ new Set(), s = [];
68
+ for (const o of e ?? []) {
69
+ const c = o.trim().toUpperCase();
70
+ !c || n.has(c) || (n.add(c), s.push(c));
71
+ }
72
+ return s.length === 0 ? [t] : (n.has(t) || s.unshift(t), s);
73
+ }
74
+ const Ee = ["USD"];
75
+ function te() {
76
+ if (typeof window > "u") return null;
77
+ try {
78
+ return window.localStorage.getItem("i18nextLng") || window.localStorage.getItem("language");
79
+ } catch {
80
+ return null;
81
+ }
82
+ }
83
+ function B(e) {
84
+ return (e || te())?.trim().toLowerCase().replaceAll("_", "-").startsWith("zh") ? "zh-CN" : "en-US";
85
+ }
86
+ function ve(e, r, t = { timeStyle: "short" }) {
87
+ return z(e, r, t);
88
+ }
89
+ function z(e, r, t = { dateStyle: "medium" }) {
90
+ if (e == null || e === "") return "—";
91
+ const n = e instanceof Date ? e : new Date(String(e));
92
+ return Number.isNaN(n.getTime()) ? String(e) : new Intl.DateTimeFormat(B(r), t).format(n);
93
+ }
94
+ function Ce(e, r, t = { dateStyle: "medium", timeStyle: "short" }) {
95
+ return z(e, r, t);
96
+ }
97
+ function ke(e, r, t) {
98
+ const n = Number(e ?? 0);
99
+ return new Intl.NumberFormat(B(r), t).format(
100
+ Number.isFinite(n) ? n : 0
101
+ );
102
+ }
103
+ function Se(e, r, t) {
104
+ const n = Number(e ?? 0);
105
+ return new Intl.NumberFormat(B(t), {
106
+ style: "currency",
107
+ currency: String(r || "USD"),
108
+ maximumFractionDigits: 2
109
+ }).format(Number.isFinite(n) ? n : 0);
110
+ }
111
+ function ne() {
112
+ try {
113
+ return localStorage.getItem("token") ?? "";
114
+ } catch {
115
+ return "";
116
+ }
117
+ }
118
+ function Ue(e) {
119
+ const [r, t] = g(0);
120
+ return w(() => {
121
+ const n = () => t((s) => s + 1);
122
+ return window.addEventListener(C, n), () => window.removeEventListener(C, n);
123
+ }, []), q(() => {
124
+ const n = ne(), s = e().replace(/\/$/, "");
125
+ return new Q({
126
+ baseURL: s,
127
+ apiKey: n,
128
+ accessToken: n || void 0
129
+ });
130
+ }, [r, e]);
131
+ }
132
+ function se(e, r) {
133
+ try {
134
+ r ? sessionStorage.setItem(e, r) : sessionStorage.removeItem(e);
135
+ } catch {
136
+ }
137
+ }
138
+ function ae(e) {
139
+ try {
140
+ return sessionStorage.getItem(e);
141
+ } catch {
142
+ return null;
143
+ }
144
+ }
145
+ function oe(e, r) {
146
+ return e.length === 0 && !Y() ? !1 : e.includes(r);
147
+ }
148
+ function Y() {
149
+ try {
150
+ return !1;
151
+ } catch {
152
+ return !1;
153
+ }
154
+ }
155
+ function Ie(e, r, t, n) {
156
+ return e || n != null ? !1 : r.length === 0 ? Y() : r.includes(t);
157
+ }
158
+ function Re(e, r, t, n) {
159
+ return e || n != null ? !1 : oe(r, t);
160
+ }
161
+ function Le() {
162
+ try {
163
+ if (typeof sessionStorage < "u") {
164
+ const e = sessionStorage.getItem(H);
165
+ if (e && e.trim() !== "")
166
+ return `${new URL(e, typeof window < "u" ? window.location.origin : "http://localhost").origin}/api`;
167
+ }
168
+ } catch {
169
+ }
170
+ return typeof window < "u" ? `${window.location.origin}/api` : "";
171
+ }
172
+ function _e(e, r) {
173
+ return () => ce({ sessionStorageKey: e, getApiRoot: r });
174
+ }
175
+ async function ie(e, r) {
176
+ const t = ae(e);
177
+ if (!t)
178
+ return { isUser: !0, permissionCodes: [], accessError: null };
179
+ const n = r().replace(/\/$/, ""), s = { "Content-Type": "application/json" };
180
+ try {
181
+ const i = localStorage.getItem("token");
182
+ i && (s.Authorization = `Bearer ${i}`);
183
+ } catch {
184
+ }
185
+ const o = await fetch(`${n}/applications/${encodeURIComponent(t)}/users/me/access`, {
186
+ headers: s,
187
+ credentials: "include"
188
+ });
189
+ if (!o.ok) {
190
+ const i = await o.text().catch(() => "");
191
+ if (o.status === 404)
192
+ try {
193
+ (i ? JSON.parse(i) : null)?.code === "NOT_FOUND" && se(e, null);
194
+ } catch {
195
+ }
196
+ return o.status === 401 || o.status === 403 ? {
197
+ isUser: !1,
198
+ permissionCodes: [],
199
+ accessError: i || o.statusText || `Access denied (${o.status})`
200
+ } : {
201
+ isUser: !0,
202
+ permissionCodes: [],
203
+ accessError: i || o.statusText || `Access check failed (${o.status})`
204
+ };
205
+ }
206
+ const c = await o.json(), d = c?.data ?? c;
207
+ return {
208
+ isUser: !!d?.isUser,
209
+ permissionCodes: Array.isArray(d?.permissionCodes) ? d.permissionCodes : [],
210
+ accessError: null
211
+ };
212
+ }
213
+ function ce({ sessionStorageKey: e, getApiRoot: r }) {
214
+ const [t, n] = g({
215
+ isUser: !0,
216
+ permissionCodes: [],
217
+ loading: !0,
218
+ accessError: null,
219
+ reloadAccess: () => {
220
+ }
221
+ }), s = F(() => {
222
+ n((o) => ({ ...o, loading: !0, accessError: null })), ie(e, r).then((o) => {
223
+ n((c) => ({
224
+ ...c,
225
+ ...o,
226
+ loading: !1
227
+ }));
228
+ }).catch((o) => {
229
+ n((c) => ({
230
+ ...c,
231
+ isUser: !0,
232
+ permissionCodes: [],
233
+ loading: !1,
234
+ accessError: o instanceof Error ? o.message : String(o)
235
+ }));
236
+ });
237
+ }, [e, r]);
238
+ return w(() => {
239
+ s();
240
+ }, [s]), w(() => {
241
+ const o = () => s();
242
+ return window.addEventListener(C, o), () => window.removeEventListener(C, o);
243
+ }, [s]), w(() => {
244
+ n((o) => ({ ...o, reloadAccess: s }));
245
+ }, [s]), t;
246
+ }
247
+ function de({ access: e }) {
248
+ return e.loading || !e.accessError ? null : /* @__PURE__ */ u(
249
+ "div",
250
+ {
251
+ role: "alert",
252
+ className: "mb-4 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100",
253
+ children: [
254
+ /* @__PURE__ */ a("p", { className: "font-medium", children: "Unable to load permissions" }),
255
+ /* @__PURE__ */ a("p", { className: "mt-1 text-amber-800 dark:text-amber-200", children: e.accessError }),
256
+ /* @__PURE__ */ a(
257
+ "button",
258
+ {
259
+ type: "button",
260
+ onClick: e.reloadAccess,
261
+ className: "mt-2 rounded-lg border border-amber-300 bg-white px-3 py-1.5 text-xs font-medium text-amber-900 transition hover:bg-amber-100 dark:border-amber-800 dark:bg-neutral-900 dark:text-amber-100 dark:hover:bg-amber-900/30",
262
+ children: "Retry"
263
+ }
264
+ )
265
+ ]
266
+ }
267
+ );
268
+ }
269
+ function le({ variant: e = "table" }) {
270
+ return /* @__PURE__ */ u(
271
+ "div",
272
+ {
273
+ className: "w-full min-w-0 max-w-full animate-pulse px-4 py-4 sm:px-6 sm:py-6 lg:px-8",
274
+ role: "status",
275
+ "aria-busy": "true",
276
+ children: [
277
+ /* @__PURE__ */ u("div", { className: "mb-6 flex min-h-[52px] items-center justify-between gap-4 sm:min-h-[60px]", children: [
278
+ /* @__PURE__ */ u("div", { className: "min-w-0 flex-1 space-y-2", children: [
279
+ /* @__PURE__ */ a("div", { className: "h-7 w-48 max-w-full rounded-md bg-muted" }),
280
+ /* @__PURE__ */ a("div", { className: "h-4 w-80 max-w-[70%] rounded bg-muted" })
281
+ ] }),
282
+ /* @__PURE__ */ a("div", { className: "h-10 w-28 shrink-0 rounded-md bg-muted" })
283
+ ] }),
284
+ e === "dashboard" ? /* @__PURE__ */ u(O, { children: [
285
+ /* @__PURE__ */ a("div", { className: "grid gap-4 sm:grid-cols-2 xl:grid-cols-4", children: Array.from({ length: 4 }).map((r, t) => /* @__PURE__ */ a("div", { className: "h-28 rounded-xl border border-border bg-card" }, t)) }),
286
+ /* @__PURE__ */ u("div", { className: "mt-6 grid gap-6 xl:grid-cols-2", children: [
287
+ /* @__PURE__ */ a("div", { className: "h-72 rounded-xl border border-border bg-card" }),
288
+ /* @__PURE__ */ a("div", { className: "h-72 rounded-xl border border-border bg-card" })
289
+ ] })
290
+ ] }) : e === "detail" ? /* @__PURE__ */ u("div", { className: "grid gap-6 xl:grid-cols-[minmax(0,1fr)_22rem]", children: [
291
+ /* @__PURE__ */ a("div", { className: "h-[30rem] rounded-xl border border-border bg-card" }),
292
+ /* @__PURE__ */ a("div", { className: "h-72 rounded-xl border border-border bg-card" })
293
+ ] }) : /* @__PURE__ */ u(O, { children: [
294
+ /* @__PURE__ */ u("div", { className: "mb-4 flex gap-3", children: [
295
+ /* @__PURE__ */ a("div", { className: "h-10 flex-1 rounded-md bg-muted" }),
296
+ /* @__PURE__ */ a("div", { className: "h-10 w-36 rounded-md bg-muted" })
297
+ ] }),
298
+ /* @__PURE__ */ a("div", { className: "overflow-hidden rounded-xl border border-border bg-card", children: Array.from({ length: 7 }).map((r, t) => /* @__PURE__ */ a("div", { className: "grid grid-cols-[minmax(12rem,2fr)_repeat(3,minmax(7rem,1fr))] gap-4 border-b border-border px-4 py-4 last:border-b-0", children: Array.from({ length: 4 }).map((n, s) => /* @__PURE__ */ a("div", { className: `h-4 rounded bg-muted ${s === 0 ? "w-3/4" : "w-2/3"}` }, s)) }, t)) })
299
+ ] })
300
+ ]
301
+ }
302
+ );
303
+ }
304
+ function Pe({ access: e, children: r, showLoadingSkeleton: t = !0 }) {
305
+ return e.accessError ? /* @__PURE__ */ a(de, { access: e }) : t && e.loading && e.permissionCodes.length === 0 ? /* @__PURE__ */ a(le, {}) : /* @__PURE__ */ a(O, { children: r });
306
+ }
307
+ function ue(e) {
308
+ return e == null || e === "" ? null : e;
309
+ }
310
+ function $e(e, r, t = !1, n = null) {
311
+ if (t || n != null) return { ...e };
312
+ const s = { ...e };
313
+ return r ? (s.partner_id = ue(s.partner_id), s.partner_id == null && (s.partner_id = null, s.partner_name = null), s) : (delete s.partner_id, s.partner_name === "" && (s.partner_name = null), s);
314
+ }
315
+ function De(e = {}) {
316
+ return () => {
317
+ const r = e.dedicatedEnv;
318
+ if (typeof r == "string" && r.trim() !== "")
319
+ return r.replace(/\/$/, "");
320
+ const t = e.platformEnv;
321
+ if (typeof t == "string" && t.trim() !== "")
322
+ return t.replace(/\/$/, "");
323
+ try {
324
+ if (typeof sessionStorage < "u") {
325
+ const n = sessionStorage.getItem(H);
326
+ if (n && n.trim() !== "")
327
+ return `${new URL(n, typeof window < "u" ? window.location.origin : "http://localhost").origin}/api`;
328
+ }
329
+ } catch {
330
+ }
331
+ return typeof window < "u" ? `${window.location.origin}/api` : "";
332
+ };
333
+ }
334
+ function Te(e) {
335
+ function r() {
336
+ try {
337
+ return localStorage.getItem("token");
338
+ } catch {
339
+ return null;
340
+ }
341
+ }
342
+ function t() {
343
+ const d = { "Content-Type": "application/json" }, i = r();
344
+ return i && (d.Authorization = `Bearer ${i}`), d;
345
+ }
346
+ function n(d, i, l) {
347
+ const m = `${e()}/data/${encodeURIComponent(d)}/tables/${encodeURIComponent(i)}`;
348
+ return l ? `${m}/${encodeURIComponent(l)}` : m;
349
+ }
350
+ async function s(d, i, l) {
351
+ const b = await fetch(n(d, i, l), { headers: t() }), m = await b.text();
352
+ if (!b.ok) throw new Error(m || b.statusText);
353
+ const p = m ? JSON.parse(m) : {};
354
+ return p.data ?? p;
355
+ }
356
+ async function o(d, i, l) {
357
+ const b = new URLSearchParams();
358
+ l && b.set("filter", JSON.stringify(l));
359
+ const m = await fetch(`${n(d, i)}?${b}`, { headers: t() }), p = await m.text();
360
+ if (!m.ok) throw new Error(p || m.statusText);
361
+ const x = (p ? JSON.parse(p) : {}).data;
362
+ return Array.isArray(x) ? x : x?.items ?? [];
363
+ }
364
+ async function c(d, i, l, b) {
365
+ const m = await fetch(n(d, i, l), {
366
+ method: "PATCH",
367
+ headers: t(),
368
+ body: JSON.stringify(b)
369
+ });
370
+ if (!m.ok) {
371
+ const p = await m.text();
372
+ throw new Error(p || m.statusText);
373
+ }
374
+ }
375
+ return { scopeGet: s, scopeList: o, scopePatch: c };
376
+ }
377
+ function Oe(e) {
378
+ return function(t, n = []) {
379
+ const s = n.filter(Boolean).sort().join("\0"), [o, c] = g(!1), [d, i] = g([]), [l, b] = g(!1), [m, p] = g(null), h = I(0), x = F(async () => {
380
+ const y = ++h.current;
381
+ if (!t) {
382
+ if (y !== h.current) return;
383
+ c(!1), i([]), p(null), b(!1);
384
+ return;
385
+ }
386
+ const S = e.buildApiRoot(), k = e.readToken();
387
+ b(!0), p(null);
388
+ try {
389
+ const A = await e.probePicker(S, k);
390
+ if (y !== h.current) return;
391
+ if (!A) {
392
+ c(!1), i([]);
393
+ return;
394
+ }
395
+ try {
396
+ const N = await e.loadOptions(S, k, n.filter(Boolean));
397
+ if (y !== h.current) return;
398
+ c(!0), i(N);
399
+ } catch (N) {
400
+ if (y !== h.current) return;
401
+ p(N instanceof Error ? N.message : String(N)), c(!1), i([]);
402
+ }
403
+ } catch (A) {
404
+ if (y !== h.current) return;
405
+ p(A instanceof Error ? A.message : String(A)), c(!1), i([]);
406
+ } finally {
407
+ y === h.current && b(!1);
408
+ }
409
+ }, [t, s]);
410
+ return w(() => {
411
+ x();
412
+ }, [x]), w(() => {
413
+ const y = () => {
414
+ x();
415
+ };
416
+ return window.addEventListener(C, y), () => window.removeEventListener(C, y);
417
+ }, [x]), { pickerAvailable: o, options: d, loading: l, loadError: m, reload: x, providerGeniappId: e.providerGeniappId };
418
+ };
419
+ }
420
+ function Be({
421
+ label: e,
422
+ description: r,
423
+ placeholder: t = "",
424
+ emptyText: n,
425
+ unavailableText: s,
426
+ forbiddenText: o,
427
+ selected: c = null,
428
+ pageSize: d = 10,
429
+ disabled: i = !1,
430
+ providerState: l = "ready",
431
+ loadPage: b,
432
+ onSelect: m
433
+ }) {
434
+ const p = W(), h = I(0), x = I(b);
435
+ x.current = b;
436
+ const [y, S] = g(""), [k, A] = g(""), [N, R] = g(1), [G, L] = g([]), [_, P] = g(0), [E, $] = g(!1), [V, D] = g("");
437
+ w(() => {
438
+ const f = ++h.current;
439
+ if (l !== "ready") {
440
+ L([]), P(0), $(!1), D("");
441
+ return;
442
+ }
443
+ return $(!0), D(""), x.current({
444
+ search: k,
445
+ limit: d,
446
+ offset: (N - 1) * d
447
+ }).then((v) => {
448
+ h.current === f && (L(v.records), P(Math.max(0, v.total)));
449
+ }).catch((v) => {
450
+ h.current === f && (L([]), P(0), D(v instanceof Error ? v.message : String(v)));
451
+ }).finally(() => {
452
+ h.current === f && $(!1);
453
+ }), () => {
454
+ h.current += 1;
455
+ };
456
+ }, [k, N, d, l]);
457
+ const T = Math.max(1, Math.ceil(_ / d)), U = l === "unavailable" ? s : l === "forbidden" ? o : V;
458
+ return /* @__PURE__ */ u(
459
+ "section",
460
+ {
461
+ className: "rounded-xl border border-border p-4",
462
+ "aria-labelledby": `${p}-label`,
463
+ children: [
464
+ /* @__PURE__ */ u("div", { children: [
465
+ /* @__PURE__ */ a(
466
+ "label",
467
+ {
468
+ id: `${p}-label`,
469
+ htmlFor: `${p}-search`,
470
+ className: "block text-sm font-medium",
471
+ children: e
472
+ }
473
+ ),
474
+ r && /* @__PURE__ */ a("p", { className: "mt-1 text-xs leading-5 text-muted-foreground", children: r })
475
+ ] }),
476
+ c && /* @__PURE__ */ u("div", { className: "mt-3 flex items-start justify-between gap-3 rounded-lg border border-primary/30 bg-primary/5 p-3", children: [
477
+ /* @__PURE__ */ u("div", { className: "min-w-0", children: [
478
+ /* @__PURE__ */ a("p", { className: "truncate text-sm font-medium", children: c.primary }),
479
+ c.secondary && /* @__PURE__ */ a("p", { className: "mt-0.5 truncate text-xs text-muted-foreground", children: c.secondary })
480
+ ] }),
481
+ /* @__PURE__ */ a(
482
+ "button",
483
+ {
484
+ type: "button",
485
+ className: "min-h-[44px] rounded-lg border border-border bg-background px-3 text-xs",
486
+ disabled: i,
487
+ onClick: () => m(null),
488
+ children: "×"
489
+ }
490
+ )
491
+ ] }),
492
+ /* @__PURE__ */ u(
493
+ "form",
494
+ {
495
+ className: "mt-3 flex gap-2",
496
+ onSubmit: (f) => {
497
+ f.preventDefault(), R(1), A(y.trim());
498
+ },
499
+ children: [
500
+ /* @__PURE__ */ a(
501
+ "input",
502
+ {
503
+ id: `${p}-search`,
504
+ className: "h-[44px] min-w-0 flex-1 rounded-lg border border-input bg-background px-3 text-sm outline-none focus:border-primary focus:ring-2 focus:ring-primary/15",
505
+ value: y,
506
+ disabled: i || l !== "ready",
507
+ onChange: (f) => S(f.target.value),
508
+ placeholder: t
509
+ }
510
+ ),
511
+ /* @__PURE__ */ a(
512
+ "button",
513
+ {
514
+ type: "submit",
515
+ className: "min-h-[44px] rounded-lg border border-border bg-background px-4 text-sm font-medium disabled:opacity-50",
516
+ disabled: i || l !== "ready" || E,
517
+ children: "⌕"
518
+ }
519
+ )
520
+ ]
521
+ }
522
+ ),
523
+ U && /* @__PURE__ */ a(
524
+ "p",
525
+ {
526
+ role: "alert",
527
+ className: "mt-3 rounded-lg bg-muted px-3 py-2 text-xs text-muted-foreground",
528
+ children: U
529
+ }
530
+ ),
531
+ l === "ready" && !U && /* @__PURE__ */ u("div", { className: "mt-3 space-y-2", "aria-busy": E, children: [
532
+ E && /* @__PURE__ */ a("p", { className: "py-4 text-center text-xs text-muted-foreground", children: "…" }),
533
+ !E && G.map((f) => /* @__PURE__ */ u(
534
+ "button",
535
+ {
536
+ type: "button",
537
+ disabled: i,
538
+ onClick: () => m(f),
539
+ className: "flex min-h-[48px] w-full items-center justify-between gap-3 rounded-lg border border-border px-3 py-2 text-left hover:bg-accent disabled:opacity-50",
540
+ children: [
541
+ /* @__PURE__ */ u("span", { className: "min-w-0", children: [
542
+ /* @__PURE__ */ a("span", { className: "block truncate text-sm font-medium", children: f.primary }),
543
+ f.secondary && /* @__PURE__ */ a("span", { className: "mt-0.5 block truncate text-xs text-muted-foreground", children: f.secondary })
544
+ ] }),
545
+ f.status && /* @__PURE__ */ a("span", { className: "shrink-0 rounded-full bg-muted px-2 py-1 text-[11px] text-muted-foreground", children: f.status })
546
+ ]
547
+ },
548
+ f.id
549
+ )),
550
+ !E && !G.length && /* @__PURE__ */ a("p", { className: "py-4 text-center text-xs text-muted-foreground", children: n })
551
+ ] }),
552
+ l === "ready" && !E && !U && _ > d && /* @__PURE__ */ u("div", { className: "mt-3 flex items-center justify-between gap-3 text-xs text-muted-foreground", children: [
553
+ /* @__PURE__ */ u("span", { children: [
554
+ N,
555
+ "/",
556
+ T,
557
+ " · ",
558
+ _
559
+ ] }),
560
+ /* @__PURE__ */ u("div", { className: "flex gap-2", children: [
561
+ /* @__PURE__ */ a(
562
+ "button",
563
+ {
564
+ type: "button",
565
+ className: "min-h-[44px] rounded-lg border border-border px-3 disabled:opacity-40",
566
+ disabled: N <= 1,
567
+ onClick: () => R((f) => Math.max(1, f - 1)),
568
+ children: "‹"
569
+ }
570
+ ),
571
+ /* @__PURE__ */ a(
572
+ "button",
573
+ {
574
+ type: "button",
575
+ className: "min-h-[44px] rounded-lg border border-border px-3 disabled:opacity-40",
576
+ disabled: N >= T,
577
+ onClick: () => R((f) => Math.min(T, f + 1)),
578
+ children: "›"
579
+ }
580
+ )
581
+ ] })
582
+ ] })
583
+ ]
584
+ }
585
+ );
586
+ }
587
+ export {
588
+ Pe as A,
589
+ Le as B,
590
+ Ne as C,
591
+ Ee as D,
592
+ se as E,
593
+ ce as F,
594
+ Ue as G,
595
+ ge as H,
596
+ J as R,
597
+ de as a,
598
+ le as b,
599
+ Be as c,
600
+ $e as d,
601
+ Ie as e,
602
+ Re as f,
603
+ _e as g,
604
+ De as h,
605
+ Te as i,
606
+ Oe as j,
607
+ we as k,
608
+ Se as l,
609
+ z as m,
610
+ Ce as n,
611
+ ke as o,
612
+ ve as p,
613
+ ae as q,
614
+ oe as r,
615
+ Y as s,
616
+ X as t,
617
+ xe as u,
618
+ Z as v,
619
+ Ae as w,
620
+ re as x,
621
+ B as y,
622
+ ye as z
623
+ };
624
+ //# sourceMappingURL=CrossAppRecordPicker-BXchXcK5.js.map