@burdenoff/microfe-theglobalfuel 2026.528.1 → 2026.704.1

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 (209) hide show
  1. package/dist/dev/main.d.ts +2 -0
  2. package/dist/dev/main.d.ts.map +1 -0
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +6 -4
  6. package/dist/node_modules/{clsx → .bun/clsx@2.1.1/node_modules/clsx}/dist/clsx.js +1 -1
  7. package/dist/node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.js.map +1 -0
  8. package/dist/node_modules/{tailwind-merge → .bun/tailwind-merge@3.5.0/node_modules/tailwind-merge}/dist/bundle-mjs.js +170 -212
  9. package/dist/node_modules/.bun/tailwind-merge@3.5.0/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -0
  10. package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts +5 -0
  11. package/dist/theglobalfuel/TheGlobalFuelRoot.d.ts.map +1 -0
  12. package/dist/theglobalfuel/TheGlobalFuelRoot.js +109 -161
  13. package/dist/theglobalfuel/TheGlobalFuelRoot.js.map +1 -1
  14. package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts +4 -0
  15. package/dist/theglobalfuel/TheGlobalFuelRoutes.d.ts.map +1 -0
  16. package/dist/theglobalfuel/TheGlobalFuelRoutes.js +70 -85
  17. package/dist/theglobalfuel/TheGlobalFuelRoutes.js.map +1 -1
  18. package/dist/theglobalfuel/components/DataTable.d.ts +28 -0
  19. package/dist/theglobalfuel/components/DataTable.d.ts.map +1 -0
  20. package/dist/theglobalfuel/components/DataTable.js +71 -0
  21. package/dist/theglobalfuel/components/DataTable.js.map +1 -0
  22. package/dist/theglobalfuel/components/EmptyState.d.ts +18 -0
  23. package/dist/theglobalfuel/components/EmptyState.d.ts.map +1 -0
  24. package/dist/theglobalfuel/components/EmptyState.js +35 -0
  25. package/dist/theglobalfuel/components/EmptyState.js.map +1 -0
  26. package/dist/theglobalfuel/components/EvidenceUpload.d.ts +14 -0
  27. package/dist/theglobalfuel/components/EvidenceUpload.d.ts.map +1 -0
  28. package/dist/theglobalfuel/components/EvidenceUpload.js +93 -0
  29. package/dist/theglobalfuel/components/EvidenceUpload.js.map +1 -0
  30. package/dist/theglobalfuel/components/FileLink.d.ts +15 -0
  31. package/dist/theglobalfuel/components/FileLink.d.ts.map +1 -0
  32. package/dist/theglobalfuel/components/FileLink.js +36 -0
  33. package/dist/theglobalfuel/components/FileLink.js.map +1 -0
  34. package/dist/theglobalfuel/components/FilterTabs.d.ts +18 -0
  35. package/dist/theglobalfuel/components/FilterTabs.d.ts.map +1 -0
  36. package/dist/theglobalfuel/components/FilterTabs.js +27 -0
  37. package/dist/theglobalfuel/components/FilterTabs.js.map +1 -0
  38. package/dist/theglobalfuel/components/MetricsCard.d.ts +23 -0
  39. package/dist/theglobalfuel/components/MetricsCard.d.ts.map +1 -0
  40. package/dist/theglobalfuel/components/MetricsCard.js +64 -0
  41. package/dist/theglobalfuel/components/MetricsCard.js.map +1 -0
  42. package/dist/theglobalfuel/components/MiniBar.d.ts +16 -0
  43. package/dist/theglobalfuel/components/MiniBar.d.ts.map +1 -0
  44. package/dist/theglobalfuel/components/MiniBar.js +22 -0
  45. package/dist/theglobalfuel/components/MiniBar.js.map +1 -0
  46. package/dist/theglobalfuel/components/PageLayout.d.ts +16 -0
  47. package/dist/theglobalfuel/components/PageLayout.d.ts.map +1 -0
  48. package/dist/theglobalfuel/components/PageLayout.js +38 -0
  49. package/dist/theglobalfuel/components/PageLayout.js.map +1 -0
  50. package/dist/theglobalfuel/components/Pagination.d.ts +22 -0
  51. package/dist/theglobalfuel/components/Pagination.d.ts.map +1 -0
  52. package/dist/theglobalfuel/components/Pagination.js +50 -0
  53. package/dist/theglobalfuel/components/Pagination.js.map +1 -0
  54. package/dist/theglobalfuel/components/StateViews.d.ts +24 -0
  55. package/dist/theglobalfuel/components/StateViews.d.ts.map +1 -0
  56. package/dist/theglobalfuel/components/StateViews.js +49 -0
  57. package/dist/theglobalfuel/components/StateViews.js.map +1 -0
  58. package/dist/theglobalfuel/components/StatusBadge.d.ts +9 -0
  59. package/dist/theglobalfuel/components/StatusBadge.d.ts.map +1 -0
  60. package/dist/theglobalfuel/components/StatusBadge.js +73 -0
  61. package/dist/theglobalfuel/components/StatusBadge.js.map +1 -0
  62. package/dist/theglobalfuel/components/Tabs.d.ts +17 -0
  63. package/dist/theglobalfuel/components/Tabs.d.ts.map +1 -0
  64. package/dist/theglobalfuel/components/Tabs.js +31 -0
  65. package/dist/theglobalfuel/components/Tabs.js.map +1 -0
  66. package/dist/theglobalfuel/components/TheDiscussion.d.ts +18 -0
  67. package/dist/theglobalfuel/components/TheDiscussion.d.ts.map +1 -0
  68. package/dist/theglobalfuel/components/TheDiscussion.js +109 -0
  69. package/dist/theglobalfuel/components/TheDiscussion.js.map +1 -0
  70. package/dist/theglobalfuel/components/TheTags.d.ts +17 -0
  71. package/dist/theglobalfuel/components/TheTags.d.ts.map +1 -0
  72. package/dist/theglobalfuel/components/TheTags.js +149 -0
  73. package/dist/theglobalfuel/components/TheTags.js.map +1 -0
  74. package/dist/theglobalfuel/components/index.d.ts +19 -0
  75. package/dist/theglobalfuel/components/index.d.ts.map +1 -0
  76. package/dist/theglobalfuel/components/index.js +14 -0
  77. package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts +16 -0
  78. package/dist/theglobalfuel/context/TheGlobalFuelContext.d.ts.map +1 -0
  79. package/dist/theglobalfuel/context/TheGlobalFuelContext.js +85 -0
  80. package/dist/theglobalfuel/context/TheGlobalFuelContext.js.map +1 -0
  81. package/dist/theglobalfuel/context/index.d.ts +6 -0
  82. package/dist/theglobalfuel/context/index.d.ts.map +1 -0
  83. package/dist/theglobalfuel/context/index.js +1 -0
  84. package/dist/theglobalfuel/hooks/index.d.ts +10 -0
  85. package/dist/theglobalfuel/hooks/index.d.ts.map +1 -0
  86. package/dist/theglobalfuel/hooks/index.js +5 -0
  87. package/dist/theglobalfuel/hooks/useCursorPager.d.ts +33 -0
  88. package/dist/theglobalfuel/hooks/useCursorPager.d.ts.map +1 -0
  89. package/dist/theglobalfuel/hooks/useCursorPager.js +25 -0
  90. package/dist/theglobalfuel/hooks/useCursorPager.js.map +1 -0
  91. package/dist/theglobalfuel/hooks/useTheComments.d.ts +36 -0
  92. package/dist/theglobalfuel/hooks/useTheComments.d.ts.map +1 -0
  93. package/dist/theglobalfuel/hooks/useTheComments.js +45 -0
  94. package/dist/theglobalfuel/hooks/useTheComments.js.map +1 -0
  95. package/dist/theglobalfuel/hooks/useTheFiles.d.ts +47 -0
  96. package/dist/theglobalfuel/hooks/useTheFiles.d.ts.map +1 -0
  97. package/dist/theglobalfuel/hooks/useTheFiles.js +81 -0
  98. package/dist/theglobalfuel/hooks/useTheFiles.js.map +1 -0
  99. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts +75 -0
  100. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.d.ts.map +1 -0
  101. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js +353 -0
  102. package/dist/theglobalfuel/hooks/useTheGlobalFuelApi.js.map +1 -0
  103. package/dist/theglobalfuel/hooks/useTheTags.d.ts +44 -0
  104. package/dist/theglobalfuel/hooks/useTheTags.d.ts.map +1 -0
  105. package/dist/theglobalfuel/hooks/useTheTags.js +89 -0
  106. package/dist/theglobalfuel/hooks/useTheTags.js.map +1 -0
  107. package/dist/theglobalfuel/index.d.ts +9 -0
  108. package/dist/theglobalfuel/index.d.ts.map +1 -0
  109. package/dist/theglobalfuel/index.js +5 -2
  110. package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts +13 -0
  111. package/dist/theglobalfuel/pages/assets/AssetDetailPage.d.ts.map +1 -0
  112. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js +869 -0
  113. package/dist/theglobalfuel/pages/assets/AssetDetailPage.js.map +1 -0
  114. package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts +10 -0
  115. package/dist/theglobalfuel/pages/assets/AssetsPage.d.ts.map +1 -0
  116. package/dist/theglobalfuel/pages/assets/AssetsPage.js +547 -0
  117. package/dist/theglobalfuel/pages/assets/AssetsPage.js.map +1 -0
  118. package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts +11 -0
  119. package/dist/theglobalfuel/pages/compliance/CompliancePage.d.ts.map +1 -0
  120. package/dist/theglobalfuel/pages/compliance/CompliancePage.js +511 -0
  121. package/dist/theglobalfuel/pages/compliance/CompliancePage.js.map +1 -0
  122. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts +9 -0
  123. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.d.ts.map +1 -0
  124. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js +878 -0
  125. package/dist/theglobalfuel/pages/contracts/ContractDetailPage.js.map +1 -0
  126. package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts +8 -0
  127. package/dist/theglobalfuel/pages/contracts/ContractsPage.d.ts.map +1 -0
  128. package/dist/theglobalfuel/pages/contracts/ContractsPage.js +588 -0
  129. package/dist/theglobalfuel/pages/contracts/ContractsPage.js.map +1 -0
  130. package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts +13 -0
  131. package/dist/theglobalfuel/pages/dashboard/DashboardPage.d.ts.map +1 -0
  132. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js +507 -0
  133. package/dist/theglobalfuel/pages/dashboard/DashboardPage.js.map +1 -0
  134. package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts +12 -0
  135. package/dist/theglobalfuel/pages/emissions/EmissionsPage.d.ts.map +1 -0
  136. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js +479 -0
  137. package/dist/theglobalfuel/pages/emissions/EmissionsPage.js.map +1 -0
  138. package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts +11 -0
  139. package/dist/theglobalfuel/pages/inventory/InventoryPage.d.ts.map +1 -0
  140. package/dist/theglobalfuel/pages/inventory/InventoryPage.js +592 -0
  141. package/dist/theglobalfuel/pages/inventory/InventoryPage.js.map +1 -0
  142. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts +11 -0
  143. package/dist/theglobalfuel/pages/production/ProductionPage.d.ts.map +1 -0
  144. package/dist/theglobalfuel/pages/production/ProductionPage.js +421 -0
  145. package/dist/theglobalfuel/pages/production/ProductionPage.js.map +1 -0
  146. package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts +10 -0
  147. package/dist/theglobalfuel/pages/reserves/ReservesPage.d.ts.map +1 -0
  148. package/dist/theglobalfuel/pages/reserves/ReservesPage.js +439 -0
  149. package/dist/theglobalfuel/pages/reserves/ReservesPage.js.map +1 -0
  150. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts +10 -0
  151. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.d.ts.map +1 -0
  152. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js +550 -0
  153. package/dist/theglobalfuel/pages/shipments/ShipmentsPage.js.map +1 -0
  154. package/dist/theglobalfuel/types/index.d.ts +376 -0
  155. package/dist/theglobalfuel/types/index.d.ts.map +1 -0
  156. package/dist/theglobalfuel/utils/cn.d.ts +4 -0
  157. package/dist/theglobalfuel/utils/cn.d.ts.map +1 -0
  158. package/dist/theglobalfuel/utils/cn.js +2 -2
  159. package/dist/theglobalfuel/utils/formatters.d.ts +36 -0
  160. package/dist/theglobalfuel/utils/formatters.d.ts.map +1 -0
  161. package/dist/theglobalfuel/utils/formatters.js +94 -0
  162. package/dist/theglobalfuel/utils/formatters.js.map +1 -0
  163. package/dist/theglobalfuel/utils/i18n.d.ts +6 -0
  164. package/dist/theglobalfuel/utils/i18n.d.ts.map +1 -0
  165. package/dist/theglobalfuel/utils/index.d.ts +9 -0
  166. package/dist/theglobalfuel/utils/index.d.ts.map +1 -0
  167. package/dist/theglobalfuel/utils/navigation.d.ts +14 -0
  168. package/dist/theglobalfuel/utils/navigation.d.ts.map +1 -0
  169. package/dist/theglobalfuel/utils/navigation.js +2 -1
  170. package/dist/theglobalfuel/utils/navigation.js.map +1 -1
  171. package/package.json +3 -3
  172. package/dist/node_modules/clsx/dist/clsx.js.map +0 -1
  173. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +0 -1
  174. package/dist/theglobalfuel/pages/AiIntelligencePage.js +0 -190
  175. package/dist/theglobalfuel/pages/AiIntelligencePage.js.map +0 -1
  176. package/dist/theglobalfuel/pages/AnalyticsPage.js +0 -241
  177. package/dist/theglobalfuel/pages/AnalyticsPage.js.map +0 -1
  178. package/dist/theglobalfuel/pages/CompliancePage.js +0 -173
  179. package/dist/theglobalfuel/pages/CompliancePage.js.map +0 -1
  180. package/dist/theglobalfuel/pages/DashboardPage.js +0 -145
  181. package/dist/theglobalfuel/pages/DashboardPage.js.map +0 -1
  182. package/dist/theglobalfuel/pages/FinancialPage.js +0 -204
  183. package/dist/theglobalfuel/pages/FinancialPage.js.map +0 -1
  184. package/dist/theglobalfuel/pages/FleetManagementPage.js +0 -244
  185. package/dist/theglobalfuel/pages/FleetManagementPage.js.map +0 -1
  186. package/dist/theglobalfuel/pages/MarketplacePage.js +0 -260
  187. package/dist/theglobalfuel/pages/MarketplacePage.js.map +0 -1
  188. package/dist/theglobalfuel/pages/OperationsPage.js +0 -190
  189. package/dist/theglobalfuel/pages/OperationsPage.js.map +0 -1
  190. package/dist/theglobalfuel/pages/QualityControlPage.js +0 -215
  191. package/dist/theglobalfuel/pages/QualityControlPage.js.map +0 -1
  192. package/dist/theglobalfuel/pages/ReportsPage.js +0 -247
  193. package/dist/theglobalfuel/pages/ReportsPage.js.map +0 -1
  194. package/dist/theglobalfuel/pages/ResourcesPage.js +0 -225
  195. package/dist/theglobalfuel/pages/ResourcesPage.js.map +0 -1
  196. package/dist/theglobalfuel/pages/RiskManagementPage.js +0 -230
  197. package/dist/theglobalfuel/pages/RiskManagementPage.js.map +0 -1
  198. package/dist/theglobalfuel/pages/SupplyChainPage.js +0 -214
  199. package/dist/theglobalfuel/pages/SupplyChainPage.js.map +0 -1
  200. package/dist/theglobalfuel/pages/SustainabilityPage.js +0 -261
  201. package/dist/theglobalfuel/pages/SustainabilityPage.js.map +0 -1
  202. package/dist/theglobalfuel/pages/TrainingPage.js +0 -253
  203. package/dist/theglobalfuel/pages/TrainingPage.js.map +0 -1
  204. package/dist/theglobalfuel/providers/TheGlobalFuelProvider.js +0 -27
  205. package/dist/theglobalfuel/providers/TheGlobalFuelProvider.js.map +0 -1
  206. package/dist/theglobalfuel/store/theglobalfuelStore.js +0 -712
  207. package/dist/theglobalfuel/store/theglobalfuelStore.js.map +0 -1
  208. package/dist/theglobalfuel/utils/i18n.js +0 -15
  209. package/dist/theglobalfuel/utils/i18n.js.map +0 -1
@@ -0,0 +1,149 @@
1
+ import { useTheAssignTag as e, useTheCreateAndAssignTag as t, useTheEntityTags as n, useTheRemoveTagAssignment as r, useTheTagSearch as i } from "../hooks/useTheTags.js";
2
+ import "../hooks/index.js";
3
+ import { useEffect as a, useState as o } from "react";
4
+ import { Loader2 as s, Plus as c, Tag as l, X as u } from "lucide-react";
5
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
6
+ import { Button as m, Input as h, Popover as g, PopoverContent as _, PopoverTrigger as v, Spinner as y } from "@burdenoff/fe-libs/ui";
7
+ //#region src/theglobalfuel/components/TheTags.tsx
8
+ function b({ entityType: b, entityId: x, label: S = "Tags" }) {
9
+ let C = n(b, x), w = e(b, x), T = r(b, x), E = t(b, x), [D, O] = o(!1), [k, A] = o(""), [j, M] = o(""), [N, P] = o(null);
10
+ a(() => {
11
+ let e = setTimeout(() => M(k), 250);
12
+ return () => clearTimeout(e);
13
+ }, [k]);
14
+ let F = i(j), I = C.data ?? [], L = new Set(I.map((e) => e.tag.id)), R = j.trim(), z = (F.data ?? []).filter((e) => !L.has(e.id)), B = R.length > 0 && [...I.map((e) => e.tag.label), ...(F.data ?? []).map((e) => e.label)].some((e) => e.toLowerCase() === R.toLowerCase()), V = R.length > 0 && !B, H = w.isPending || E.isPending, U = () => {
15
+ A(""), M(""), P(null);
16
+ }, W = async (e) => {
17
+ P(null);
18
+ try {
19
+ await w.mutateAsync(e), U(), O(!1);
20
+ } catch (e) {
21
+ P(e instanceof Error ? e.message : "Failed to add tag.");
22
+ }
23
+ }, G = async () => {
24
+ if (R) {
25
+ P(null);
26
+ try {
27
+ await E.mutateAsync(R), U(), O(!1);
28
+ } catch (e) {
29
+ P(e instanceof Error ? e.message : "Failed to create tag.");
30
+ }
31
+ }
32
+ }, K = async (e) => {
33
+ P(null);
34
+ try {
35
+ await T.mutateAsync(e);
36
+ } catch (e) {
37
+ P(e instanceof Error ? e.message : "Failed to remove tag.");
38
+ }
39
+ };
40
+ return /* @__PURE__ */ p("div", { children: [
41
+ /* @__PURE__ */ f("p", {
42
+ className: "mb-1.5 text-xs text-text-tertiary",
43
+ children: S
44
+ }),
45
+ /* @__PURE__ */ p("div", {
46
+ className: "flex flex-wrap items-center gap-2",
47
+ children: [C.isLoading ? /* @__PURE__ */ p("span", {
48
+ className: "inline-flex items-center gap-1.5 text-sm text-text-tertiary",
49
+ children: [/* @__PURE__ */ f(s, { className: "h-3.5 w-3.5 animate-spin" }), " Loading tags…"]
50
+ }) : I.map((e) => /* @__PURE__ */ p("span", {
51
+ className: "inline-flex items-center gap-1.5 rounded-full border border-border-seam bg-bg-sunken px-2.5 py-1 text-xs text-text-secondary",
52
+ children: [
53
+ e.tag.color ? /* @__PURE__ */ f("span", {
54
+ className: "h-2 w-2 shrink-0 rounded-full",
55
+ style: { backgroundColor: e.tag.color },
56
+ "aria-hidden": !0
57
+ }) : /* @__PURE__ */ f(l, { className: "h-3 w-3 text-text-tertiary" }),
58
+ /* @__PURE__ */ f("span", {
59
+ className: "max-w-[10rem] truncate",
60
+ children: e.tag.label
61
+ }),
62
+ /* @__PURE__ */ f("button", {
63
+ type: "button",
64
+ onClick: () => K(e.id),
65
+ disabled: T.isPending,
66
+ "aria-label": `Remove tag ${e.tag.label}`,
67
+ className: "rounded-full p-0.5 text-text-tertiary hover:bg-bg-canvas hover:text-text-primary",
68
+ children: /* @__PURE__ */ f(u, { className: "h-3 w-3" })
69
+ })
70
+ ]
71
+ }, e.id)), /* @__PURE__ */ p(g, {
72
+ open: D,
73
+ onOpenChange: (e) => {
74
+ O(e), e || U();
75
+ },
76
+ children: [/* @__PURE__ */ f(v, {
77
+ asChild: !0,
78
+ children: /* @__PURE__ */ p(m, {
79
+ size: "sm",
80
+ variant: "outline",
81
+ className: "h-7 gap-1 px-2 text-xs",
82
+ children: [/* @__PURE__ */ f(c, { className: "h-3.5 w-3.5" }), " Add tag"]
83
+ })
84
+ }), /* @__PURE__ */ p(_, {
85
+ align: "start",
86
+ className: "w-64 p-2",
87
+ children: [/* @__PURE__ */ f(h, {
88
+ autoFocus: !0,
89
+ value: k,
90
+ onChange: (e) => A(e.target.value),
91
+ placeholder: "Search or create a tag…",
92
+ className: "h-8"
93
+ }), /* @__PURE__ */ f("div", {
94
+ className: "mt-2 max-h-56 overflow-y-auto",
95
+ children: F.isFetching && R.length > 0 ? /* @__PURE__ */ p("div", {
96
+ className: "flex items-center gap-2 px-1 py-2 text-sm text-text-tertiary",
97
+ children: [/* @__PURE__ */ f(y, { size: "sm" }), " Searching…"]
98
+ }) : /* @__PURE__ */ p(d, { children: [
99
+ z.map((e) => /* @__PURE__ */ p("button", {
100
+ type: "button",
101
+ onClick: () => W(e.id),
102
+ disabled: H,
103
+ className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-text-secondary hover:bg-bg-sunken disabled:opacity-60",
104
+ children: [e.color ? /* @__PURE__ */ f("span", {
105
+ className: "h-2 w-2 shrink-0 rounded-full",
106
+ style: { backgroundColor: e.color },
107
+ "aria-hidden": !0
108
+ }) : /* @__PURE__ */ f(l, { className: "h-3.5 w-3.5 text-text-tertiary" }), /* @__PURE__ */ f("span", {
109
+ className: "truncate",
110
+ children: e.label
111
+ })]
112
+ }, e.id)),
113
+ V && /* @__PURE__ */ p("button", {
114
+ type: "button",
115
+ onClick: G,
116
+ disabled: H,
117
+ className: "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-action-primary-bg hover:bg-bg-sunken disabled:opacity-60",
118
+ children: [/* @__PURE__ */ f(c, { className: "h-3.5 w-3.5 shrink-0" }), /* @__PURE__ */ p("span", {
119
+ className: "truncate",
120
+ children: [
121
+ "Create “",
122
+ R,
123
+ "”"
124
+ ]
125
+ })]
126
+ }),
127
+ !V && z.length === 0 && R.length > 0 && /* @__PURE__ */ f("p", {
128
+ className: "px-2 py-2 text-sm text-text-tertiary",
129
+ children: "Already added."
130
+ }),
131
+ R.length === 0 && /* @__PURE__ */ f("p", {
132
+ className: "px-2 py-2 text-sm text-text-tertiary",
133
+ children: "Type to search existing tags or create a new one."
134
+ })
135
+ ] })
136
+ })]
137
+ })]
138
+ })]
139
+ }),
140
+ N && /* @__PURE__ */ f("p", {
141
+ className: "mt-1.5 text-xs text-status-error-text",
142
+ children: N
143
+ })
144
+ ] });
145
+ }
146
+ //#endregion
147
+ export { b as TheTags };
148
+
149
+ //# sourceMappingURL=TheTags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TheTags.js","names":[],"sources":["../../../src/theglobalfuel/components/TheTags.tsx"],"sourcesContent":["/**\n * TheTags — a lightweight tag control for eco entities (Integration C).\n * @module theglobalfuel/components/TheTags\n *\n * The eco svc exposes no tags field, so this drives the platform tag store\n * directly: `getEntityTags` (display), `searchTags` (+ `createTag`) to pick or\n * create, `assignTag`/`removeTagAssignment` to link — all via the workspace\n * gateway. No eco-svc change.\n */\n\nimport { useEffect, useState } from 'react';\nimport { Loader2, Plus, Tag as TagIcon, X } from 'lucide-react';\nimport {\n Button,\n Input,\n Popover,\n PopoverContent,\n PopoverTrigger,\n Spinner,\n} from '@burdenoff/fe-libs/ui';\nimport {\n useTheEntityTags,\n useTheTagSearch,\n useTheAssignTag,\n useTheRemoveTagAssignment,\n useTheCreateAndAssignTag,\n} from '../hooks';\n\ninterface TheTagsProps {\n entityType: string;\n entityId: string;\n label?: string;\n}\n\nexport function TheTags({ entityType, entityId, label = 'Tags' }: TheTagsProps) {\n const tags = useTheEntityTags(entityType, entityId);\n const assign = useTheAssignTag(entityType, entityId);\n const remove = useTheRemoveTagAssignment(entityType, entityId);\n const createAndAssign = useTheCreateAndAssignTag(entityType, entityId);\n\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState('');\n const [debounced, setDebounced] = useState('');\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n const timer = setTimeout(() => setDebounced(query), 250);\n return () => clearTimeout(timer);\n }, [query]);\n\n const search = useTheTagSearch(debounced);\n\n const assignments = tags.data ?? [];\n const assignedIds = new Set(assignments.map((a) => a.tag.id));\n const q = debounced.trim();\n const searchResults = (search.data ?? []).filter((t) => !assignedIds.has(t.id));\n const hasExact =\n q.length > 0 &&\n [...assignments.map((a) => a.tag.label), ...(search.data ?? []).map((t) => t.label)].some(\n (l) => l.toLowerCase() === q.toLowerCase()\n );\n const showCreate = q.length > 0 && !hasExact;\n const busy = assign.isPending || createAndAssign.isPending;\n\n const resetInput = () => {\n setQuery('');\n setDebounced('');\n setError(null);\n };\n\n const handleAssign = async (tagId: string) => {\n setError(null);\n try {\n await assign.mutateAsync(tagId);\n resetInput();\n setOpen(false);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to add tag.');\n }\n };\n\n const handleCreate = async () => {\n if (!q) return;\n setError(null);\n try {\n await createAndAssign.mutateAsync(q);\n resetInput();\n setOpen(false);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to create tag.');\n }\n };\n\n const handleRemove = async (assignmentId: string) => {\n setError(null);\n try {\n await remove.mutateAsync(assignmentId);\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Failed to remove tag.');\n }\n };\n\n return (\n <div>\n <p className=\"mb-1.5 text-xs text-text-tertiary\">{label}</p>\n <div className=\"flex flex-wrap items-center gap-2\">\n {tags.isLoading ? (\n <span className=\"inline-flex items-center gap-1.5 text-sm text-text-tertiary\">\n <Loader2 className=\"h-3.5 w-3.5 animate-spin\" /> Loading tags…\n </span>\n ) : (\n assignments.map((assignment) => (\n <span\n key={assignment.id}\n className=\"inline-flex items-center gap-1.5 rounded-full border border-border-seam bg-bg-sunken px-2.5 py-1 text-xs text-text-secondary\"\n >\n {assignment.tag.color ? (\n <span\n className=\"h-2 w-2 shrink-0 rounded-full\"\n style={{ backgroundColor: assignment.tag.color }}\n aria-hidden\n />\n ) : (\n <TagIcon className=\"h-3 w-3 text-text-tertiary\" />\n )}\n <span className=\"max-w-[10rem] truncate\">{assignment.tag.label}</span>\n <button\n type=\"button\"\n onClick={() => handleRemove(assignment.id)}\n disabled={remove.isPending}\n aria-label={`Remove tag ${assignment.tag.label}`}\n className=\"rounded-full p-0.5 text-text-tertiary hover:bg-bg-canvas hover:text-text-primary\"\n >\n <X className=\"h-3 w-3\" />\n </button>\n </span>\n ))\n )}\n\n <Popover\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) resetInput();\n }}\n >\n <PopoverTrigger asChild>\n <Button size=\"sm\" variant=\"outline\" className=\"h-7 gap-1 px-2 text-xs\">\n <Plus className=\"h-3.5 w-3.5\" /> Add tag\n </Button>\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-64 p-2\">\n <Input\n autoFocus\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search or create a tag…\"\n className=\"h-8\"\n />\n <div className=\"mt-2 max-h-56 overflow-y-auto\">\n {search.isFetching && q.length > 0 ? (\n <div className=\"flex items-center gap-2 px-1 py-2 text-sm text-text-tertiary\">\n <Spinner size=\"sm\" /> Searching…\n </div>\n ) : (\n <>\n {searchResults.map((tag) => (\n <button\n key={tag.id}\n type=\"button\"\n onClick={() => handleAssign(tag.id)}\n disabled={busy}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-text-secondary hover:bg-bg-sunken disabled:opacity-60\"\n >\n {tag.color ? (\n <span\n className=\"h-2 w-2 shrink-0 rounded-full\"\n style={{ backgroundColor: tag.color }}\n aria-hidden\n />\n ) : (\n <TagIcon className=\"h-3.5 w-3.5 text-text-tertiary\" />\n )}\n <span className=\"truncate\">{tag.label}</span>\n </button>\n ))}\n\n {showCreate && (\n <button\n type=\"button\"\n onClick={handleCreate}\n disabled={busy}\n className=\"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm text-action-primary-bg hover:bg-bg-sunken disabled:opacity-60\"\n >\n <Plus className=\"h-3.5 w-3.5 shrink-0\" />\n <span className=\"truncate\">Create “{q}”</span>\n </button>\n )}\n\n {!showCreate && searchResults.length === 0 && q.length > 0 && (\n <p className=\"px-2 py-2 text-sm text-text-tertiary\">Already added.</p>\n )}\n {q.length === 0 && (\n <p className=\"px-2 py-2 text-sm text-text-tertiary\">\n Type to search existing tags or create a new one.\n </p>\n )}\n </>\n )}\n </div>\n </PopoverContent>\n </Popover>\n </div>\n\n {error && <p className=\"mt-1.5 text-xs text-status-error-text\">{error}</p>}\n </div>\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Components index
3
+ * @module theglobalfuel/components
4
+ */
5
+ export { PageLayout } from './PageLayout';
6
+ export { MetricsCard } from './MetricsCard';
7
+ export { StatusBadge } from './StatusBadge';
8
+ export { EmptyState } from './EmptyState';
9
+ export { LoadingView, ErrorView, Section } from './StateViews';
10
+ export { DataTable, type Column } from './DataTable';
11
+ export { FilterTabs, type FilterOption } from './FilterTabs';
12
+ export { Tabs, type TabItem } from './Tabs';
13
+ export { Pagination } from './Pagination';
14
+ export { MiniBar } from './MiniBar';
15
+ export { EvidenceUpload } from './EvidenceUpload';
16
+ export { FileLink } from './FileLink';
17
+ export { TheDiscussion } from './TheDiscussion';
18
+ export { TheTags } from './TheTags';
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/components/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,KAAK,OAAO,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,14 @@
1
+ import "./PageLayout.js";
2
+ import "./MetricsCard.js";
3
+ import "./StatusBadge.js";
4
+ import "./MiniBar.js";
5
+ import "./DataTable.js";
6
+ import "./StateViews.js";
7
+ import "./EmptyState.js";
8
+ import "./FilterTabs.js";
9
+ import "./Tabs.js";
10
+ import "./Pagination.js";
11
+ import "./EvidenceUpload.js";
12
+ import "./FileLink.js";
13
+ import "./TheDiscussion.js";
14
+ import "./TheTags.js";
@@ -0,0 +1,16 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { TheGlobalFuelRootProps } from '../types';
3
+
4
+ interface TheGlobalFuelContextValue extends Omit<TheGlobalFuelRootProps, 'registerNavItems' | 'registerFooterItems' | 'navigate'> {
5
+ isStandalone: boolean;
6
+ /** Shell's navigate function (only available in integrated mode). */
7
+ navigate?: (path: string) => void;
8
+ /** Navigate to a path relative to basePath. */
9
+ navigateTo: (relativePath: string) => void;
10
+ /** Get the full path for a relative path. */
11
+ getPath: (relativePath: string) => string;
12
+ }
13
+ export declare function useTheGlobalFuel(): TheGlobalFuelContextValue;
14
+ export declare const TheGlobalFuelProvider: FC<PropsWithChildren<TheGlobalFuelRootProps>>;
15
+ export {};
16
+ //# sourceMappingURL=TheGlobalFuelContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TheGlobalFuelContext.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/context/TheGlobalFuelContext.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAGvD,UAAU,yBAA0B,SAAQ,IAAI,CAC9C,sBAAsB,EACtB,kBAAkB,GAAG,qBAAqB,GAAG,UAAU,CACxD;IACC,YAAY,EAAE,OAAO,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,+CAA+C;IAC/C,UAAU,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,6CAA6C;IAC7C,OAAO,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;CAC3C;AAID,wBAAgB,gBAAgB,IAAI,yBAAyB,CAM5D;AAqHD,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAmB/E,CAAC"}
@@ -0,0 +1,85 @@
1
+ import { joinPath as e } from "../utils/navigation.js";
2
+ import { createContext as t, useCallback as n, useContext as r, useMemo as i } from "react";
3
+ import { MemoryRouter as a, useNavigate as o } from "react-router-dom";
4
+ import { jsx as s } from "react/jsx-runtime";
5
+ //#region src/theglobalfuel/context/TheGlobalFuelContext.tsx
6
+ var c = t(null);
7
+ function l() {
8
+ let e = r(c);
9
+ if (!e) throw Error("useTheGlobalFuel must be used within an TheGlobalFuelProvider");
10
+ return e;
11
+ }
12
+ var u = ({ children: t, basePath: r, currentUser: a, tenantId: l, workspaceId: u, apiGatewayUrl: d, authToken: f }) => {
13
+ let p = o(), m = r || "/", h = n((t) => e(m, t), [m]), g = n((t) => {
14
+ p(e(m, t));
15
+ }, [m, p]), _ = i(() => ({
16
+ basePath: m,
17
+ navigate: void 0,
18
+ currentUser: a,
19
+ tenantId: l,
20
+ workspaceId: u,
21
+ apiGatewayUrl: d,
22
+ authToken: f,
23
+ isStandalone: !0,
24
+ navigateTo: g,
25
+ getPath: h
26
+ }), [
27
+ m,
28
+ a,
29
+ l,
30
+ u,
31
+ d,
32
+ f,
33
+ g,
34
+ h
35
+ ]);
36
+ return /* @__PURE__ */ s(c.Provider, {
37
+ value: _,
38
+ children: t
39
+ });
40
+ }, d = ({ children: t, basePath: r, navigate: a, currentUser: o, tenantId: l, workspaceId: u, apiGatewayUrl: d, authToken: f }) => {
41
+ let p = r || "/", m = n((t) => e(p, t), [p]), h = n((t) => {
42
+ a(e(p, t));
43
+ }, [p, a]), g = i(() => ({
44
+ basePath: p,
45
+ navigate: a,
46
+ currentUser: o,
47
+ tenantId: l,
48
+ workspaceId: u,
49
+ apiGatewayUrl: d,
50
+ authToken: f,
51
+ isStandalone: !1,
52
+ navigateTo: h,
53
+ getPath: m
54
+ }), [
55
+ p,
56
+ a,
57
+ o,
58
+ l,
59
+ u,
60
+ d,
61
+ f,
62
+ h,
63
+ m
64
+ ]);
65
+ return /* @__PURE__ */ s(c.Provider, {
66
+ value: g,
67
+ children: t
68
+ });
69
+ }, f = (e) => {
70
+ let { children: t, navigate: n } = e;
71
+ return n ? /* @__PURE__ */ s(d, {
72
+ ...e,
73
+ navigate: n,
74
+ isStandalone: !1,
75
+ children: t
76
+ }) : /* @__PURE__ */ s(a, { children: /* @__PURE__ */ s(u, {
77
+ ...e,
78
+ isStandalone: !0,
79
+ children: t
80
+ }) });
81
+ };
82
+ //#endregion
83
+ export { f as TheGlobalFuelProvider, l as useTheGlobalFuel };
84
+
85
+ //# sourceMappingURL=TheGlobalFuelContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TheGlobalFuelContext.js","names":[],"sources":["../../../src/theglobalfuel/context/TheGlobalFuelContext.tsx"],"sourcesContent":["/**\n * TheGlobalFuel Context Provider\n * @module theglobalfuel/context\n *\n * Splits standalone mode (wraps its own MemoryRouter + useNavigate) from\n * integrated mode (the host shell supplies `navigate`). Exposes gateway/auth\n * context + relative navigation helpers to every page.\n */\n\nimport type { FC, PropsWithChildren } from 'react';\nimport { createContext, useContext, useMemo, useCallback } from 'react';\nimport { MemoryRouter, useNavigate as useRouterNavigate } from 'react-router-dom';\nimport type { TheGlobalFuelRootProps } from '../types';\nimport { joinPath } from '../utils/navigation';\n\ninterface TheGlobalFuelContextValue extends Omit<\n TheGlobalFuelRootProps,\n 'registerNavItems' | 'registerFooterItems' | 'navigate'\n> {\n isStandalone: boolean;\n /** Shell's navigate function (only available in integrated mode). */\n navigate?: (path: string) => void;\n /** Navigate to a path relative to basePath. */\n navigateTo: (relativePath: string) => void;\n /** Get the full path for a relative path. */\n getPath: (relativePath: string) => string;\n}\n\nconst TheGlobalFuelContext = createContext<TheGlobalFuelContextValue | null>(null);\n\nexport function useTheGlobalFuel(): TheGlobalFuelContextValue {\n const context = useContext(TheGlobalFuelContext);\n if (!context) {\n throw new Error('useTheGlobalFuel must be used within an TheGlobalFuelProvider');\n }\n return context;\n}\n\ntype ProviderProps = Omit<TheGlobalFuelRootProps, 'registerNavItems' | 'registerFooterItems'> & {\n isStandalone: boolean;\n};\n\nconst StandaloneProviderInner: FC<PropsWithChildren<ProviderProps>> = ({\n children,\n basePath,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n}) => {\n const routerNavigate = useRouterNavigate();\n const effectiveBasePath = basePath || '/';\n\n const getPath = useCallback(\n (relativePath: string) => joinPath(effectiveBasePath, relativePath),\n [effectiveBasePath]\n );\n\n const navigateTo = useCallback(\n (relativePath: string) => {\n routerNavigate(joinPath(effectiveBasePath, relativePath));\n },\n [effectiveBasePath, routerNavigate]\n );\n\n const contextValue = useMemo<TheGlobalFuelContextValue>(\n () => ({\n basePath: effectiveBasePath,\n navigate: undefined,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n isStandalone: true,\n navigateTo,\n getPath,\n }),\n [\n effectiveBasePath,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigateTo,\n getPath,\n ]\n );\n\n return (\n <TheGlobalFuelContext.Provider value={contextValue}>{children}</TheGlobalFuelContext.Provider>\n );\n};\n\nconst IntegratedProviderInner: FC<\n PropsWithChildren<ProviderProps & { navigate: (path: string) => void }>\n> = ({\n children,\n basePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n}) => {\n const effectiveBasePath = basePath || '/';\n\n const getPath = useCallback(\n (relativePath: string) => joinPath(effectiveBasePath, relativePath),\n [effectiveBasePath]\n );\n\n const navigateTo = useCallback(\n (relativePath: string) => {\n navigate(joinPath(effectiveBasePath, relativePath));\n },\n [effectiveBasePath, navigate]\n );\n\n const contextValue = useMemo<TheGlobalFuelContextValue>(\n () => ({\n basePath: effectiveBasePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n isStandalone: false,\n navigateTo,\n getPath,\n }),\n [\n effectiveBasePath,\n navigate,\n currentUser,\n tenantId,\n workspaceId,\n apiGatewayUrl,\n authToken,\n navigateTo,\n getPath,\n ]\n );\n\n return (\n <TheGlobalFuelContext.Provider value={contextValue}>{children}</TheGlobalFuelContext.Provider>\n );\n};\n\nexport const TheGlobalFuelProvider: FC<PropsWithChildren<TheGlobalFuelRootProps>> = (props) => {\n const { children, navigate } = props;\n const isStandalone = !navigate;\n\n if (isStandalone) {\n return (\n <MemoryRouter>\n <StandaloneProviderInner {...props} isStandalone={true}>\n {children}\n </StandaloneProviderInner>\n </MemoryRouter>\n );\n }\n\n return (\n <IntegratedProviderInner {...props} navigate={navigate} isStandalone={false}>\n {children}\n </IntegratedProviderInner>\n );\n};\n"],"mappings":";;;;;AA4BA,IAAM,IAAuB,EAAgD,KAAK;AAElF,SAAgB,IAA8C;CAC5D,IAAM,IAAU,EAAW,EAAqB;AAChD,KAAI,CAAC,EACH,OAAU,MAAM,gEAAgE;AAElF,QAAO;;AAOT,IAAM,KAAiE,EACrE,aACA,aACA,gBACA,aACA,gBACA,kBACA,mBACI;CACJ,IAAM,IAAiB,GAAmB,EACpC,IAAoB,KAAY,KAEhC,IAAU,GACb,MAAyB,EAAS,GAAmB,EAAa,EACnE,CAAC,EAAkB,CACpB,EAEK,IAAa,GAChB,MAAyB;AACxB,IAAe,EAAS,GAAmB,EAAa,CAAC;IAE3D,CAAC,GAAmB,EAAe,CACpC,EAEK,IAAe,SACZ;EACL,UAAU;EACV,UAAU,KAAA;EACV;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAED,QACE,kBAAC,EAAqB,UAAtB;EAA+B,OAAO;EAAe;EAAyC,CAAA;GAI5F,KAED,EACH,aACA,aACA,aACA,gBACA,aACA,gBACA,kBACA,mBACI;CACJ,IAAM,IAAoB,KAAY,KAEhC,IAAU,GACb,MAAyB,EAAS,GAAmB,EAAa,EACnE,CAAC,EAAkB,CACpB,EAEK,IAAa,GAChB,MAAyB;AACxB,IAAS,EAAS,GAAmB,EAAa,CAAC;IAErD,CAAC,GAAmB,EAAS,CAC9B,EAEK,IAAe,SACZ;EACL,UAAU;EACV;EACA;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACD,GACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CACF;AAED,QACE,kBAAC,EAAqB,UAAtB;EAA+B,OAAO;EAAe;EAAyC,CAAA;GAIrF,KAAwE,MAAU;CAC7F,IAAM,EAAE,aAAU,gBAAa;AAa/B,QAZsB,IAapB,kBAAC,GAAD;EAAyB,GAAI;EAAiB;EAAU,cAAc;EACnE;EACuB,CAAA,GAXxB,kBAAC,GAAD,EAAA,UACE,kBAAC,GAAD;EAAyB,GAAI;EAAO,cAAc;EAC/C;EACuB,CAAA,EACb,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Context index
3
+ * @module theglobalfuel/context
4
+ */
5
+ export { TheGlobalFuelProvider, useTheGlobalFuel } from './TheGlobalFuelContext';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/context/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1 @@
1
+ import "./TheGlobalFuelContext.js";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Hooks index
3
+ * @module theglobalfuel/hooks
4
+ */
5
+ export * from './useTheGlobalFuelApi';
6
+ export * from './useCursorPager';
7
+ export * from './useTheFiles';
8
+ export * from './useTheComments';
9
+ export * from './useTheTags';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ import "./useTheGlobalFuelApi.js";
2
+ import "./useCursorPager.js";
3
+ import "./useTheFiles.js";
4
+ import "./useTheComments.js";
5
+ import "./useTheTags.js";
@@ -0,0 +1,33 @@
1
+ /**
2
+ * useCursorPager — forward/back cursor pagination for Eco* list connections.
3
+ * @module theglobalfuel/hooks
4
+ *
5
+ * The svc paginates by cursor only (`PaginationInput.offset` is a no-op — the
6
+ * resolver never sets Prisma `skip` from it). So a page must send
7
+ * `pagination.cursor = the previous page's pageInfo.cursor` to advance. This
8
+ * hook keeps a stack of the cursors that opened each visited page so Prev/Next
9
+ * are exact, and exposes a 0-indexed `page` for display.
10
+ */
11
+ export interface CursorPager {
12
+ /** 0-indexed page number for display. */
13
+ page: number;
14
+ /**
15
+ * Cursor that opens the current page — `undefined` on the first page so it is
16
+ * OMITTED from the GraphQL variables (the svc rejects an explicit `cursor: null`;
17
+ * a first page must send no cursor at all, per cursor-pagination convention).
18
+ */
19
+ cursor: string | undefined;
20
+ /** Advance to the next page using the current page's end cursor. No-op if null. */
21
+ next: (endCursor: string | null | undefined) => void;
22
+ /** Go back one page. No-op on the first page. */
23
+ prev: () => void;
24
+ /** Reset to the first page (call when filters change). */
25
+ reset: () => void;
26
+ /**
27
+ * Adapter for `<Pagination onPageChange>` — compares the requested page to the
28
+ * current one and calls next()/prev() accordingly.
29
+ */
30
+ onPageChange: (targetPage: number, endCursor: string | null | undefined) => void;
31
+ }
32
+ export declare function useCursorPager(): CursorPager;
33
+ //# sourceMappingURL=useCursorPager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCursorPager.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useCursorPager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,WAAW;IAC1B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,mFAAmF;IACnF,IAAI,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IACrD,iDAAiD;IACjD,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,0DAA0D;IAC1D,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;OAGG;IACH,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;CAClF;AAED,wBAAgB,cAAc,IAAI,WAAW,CA4B5C"}
@@ -0,0 +1,25 @@
1
+ import { useCallback as e, useState as t } from "react";
2
+ //#region src/theglobalfuel/hooks/useCursorPager.ts
3
+ function n() {
4
+ let [n, r] = t([null]), i = n.length - 1;
5
+ return {
6
+ page: i,
7
+ cursor: n[i] ?? void 0,
8
+ next: e((e) => {
9
+ e && r((t) => [...t, e]);
10
+ }, []),
11
+ prev: e(() => {
12
+ r((e) => e.length > 1 ? e.slice(0, -1) : e);
13
+ }, []),
14
+ reset: e(() => {
15
+ r([null]);
16
+ }, []),
17
+ onPageChange: e((e, t) => {
18
+ r((n) => e > n.length - 1 ? t ? [...n, t] : n : n.length > 1 ? n.slice(0, -1) : n);
19
+ }, [])
20
+ };
21
+ }
22
+ //#endregion
23
+ export { n as useCursorPager };
24
+
25
+ //# sourceMappingURL=useCursorPager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCursorPager.js","names":[],"sources":["../../../src/theglobalfuel/hooks/useCursorPager.ts"],"sourcesContent":["/**\n * useCursorPager — forward/back cursor pagination for Eco* list connections.\n * @module theglobalfuel/hooks\n *\n * The svc paginates by cursor only (`PaginationInput.offset` is a no-op — the\n * resolver never sets Prisma `skip` from it). So a page must send\n * `pagination.cursor = the previous page's pageInfo.cursor` to advance. This\n * hook keeps a stack of the cursors that opened each visited page so Prev/Next\n * are exact, and exposes a 0-indexed `page` for display.\n */\n\nimport { useCallback, useState } from 'react';\n\nexport interface CursorPager {\n /** 0-indexed page number for display. */\n page: number;\n /**\n * Cursor that opens the current page — `undefined` on the first page so it is\n * OMITTED from the GraphQL variables (the svc rejects an explicit `cursor: null`;\n * a first page must send no cursor at all, per cursor-pagination convention).\n */\n cursor: string | undefined;\n /** Advance to the next page using the current page's end cursor. No-op if null. */\n next: (endCursor: string | null | undefined) => void;\n /** Go back one page. No-op on the first page. */\n prev: () => void;\n /** Reset to the first page (call when filters change). */\n reset: () => void;\n /**\n * Adapter for `<Pagination onPageChange>` — compares the requested page to the\n * current one and calls next()/prev() accordingly.\n */\n onPageChange: (targetPage: number, endCursor: string | null | undefined) => void;\n}\n\nexport function useCursorPager(): CursorPager {\n const [stack, setStack] = useState<(string | null)[]>([null]);\n const page = stack.length - 1;\n const cursor = stack[page] ?? undefined;\n\n const next = useCallback((endCursor: string | null | undefined) => {\n if (endCursor) setStack((s) => [...s, endCursor]);\n }, []);\n\n const prev = useCallback(() => {\n setStack((s) => (s.length > 1 ? s.slice(0, -1) : s));\n }, []);\n\n const reset = useCallback(() => {\n setStack([null]);\n }, []);\n\n const onPageChange = useCallback((targetPage: number, endCursor: string | null | undefined) => {\n setStack((s) => {\n const current = s.length - 1;\n if (targetPage > current) {\n return endCursor ? [...s, endCursor] : s;\n }\n return s.length > 1 ? s.slice(0, -1) : s;\n });\n }, []);\n\n return { page, cursor, next, prev, reset, onPageChange };\n}\n"],"mappings":";;AAmCA,SAAgB,IAA8B;CAC5C,IAAM,CAAC,GAAO,KAAY,EAA4B,CAAC,KAAK,CAAC,EACvD,IAAO,EAAM,SAAS;AAyB5B,QAAO;EAAE;EAAM,QAxBA,EAAM,MAAS,KAAA;EAwBP,MAtBV,GAAa,MAAyC;AACjE,GAAI,KAAW,GAAU,MAAM,CAAC,GAAG,GAAG,EAAU,CAAC;KAChD,EAAE,CAAC;EAoBuB,MAlBhB,QAAkB;AAC7B,MAAU,MAAO,EAAE,SAAS,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,EAAG;KACnD,EAAE,CAAC;EAgB6B,OAdrB,QAAkB;AAC9B,KAAS,CAAC,KAAK,CAAC;KACf,EAAE,CAAC;EAYoC,cAVrB,GAAa,GAAoB,MAAyC;AAC7F,MAAU,MAEJ,IADY,EAAE,SAAS,IAElB,IAAY,CAAC,GAAG,GAAG,EAAU,GAAG,IAElC,EAAE,SAAS,IAAI,EAAE,MAAM,GAAG,GAAG,GAAG,EACvC;KACD,EAAE,CAAC;EAEkD"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * TheGlobalFuel — wspace-conversations-svc EntityComment REUSE hooks (Integration B).
3
+ * @module theglobalfuel/hooks/useTheComments
4
+ *
5
+ * Adds a discussion surface to theglobalfuel entities WITHOUT any eco-svc change by
6
+ * reusing the generic EntityComment API composed into the WORKSPACE supergraph.
7
+ * Comments attach to any entity by `(entityType, entityId)`:
8
+ * - `getEntityComments(input): EntityCommentConnection!`
9
+ * - `createEntityComment(input): EntityComment!`
10
+ *
11
+ * Transport reuses `wspaceFetch` from `useTheFiles` (workspace gateway +
12
+ * workspace token). Lives in a separate file; `useTheGlobalFuelApi.ts` is
13
+ * untouched.
14
+ */
15
+ export interface TheComment {
16
+ id: string;
17
+ authorId: string;
18
+ authorType: string;
19
+ content: {
20
+ text: string | null;
21
+ markdown: string | null;
22
+ };
23
+ createdAt: string;
24
+ edited: boolean;
25
+ parentCommentId: string | null;
26
+ replyCount: number;
27
+ }
28
+ /** Top-level (root) comments for an eco entity, oldest first. */
29
+ export declare const useTheComments: (entityType: string, entityId: string | undefined) => import('@tanstack/react-query').UseQueryResult<{
30
+ items: TheComment[];
31
+ total: number;
32
+ }, Error>;
33
+ export declare const useTheCreateComment: (entityType: string, entityId: string) => import('@tanstack/react-query').UseMutationResult<{
34
+ id: string;
35
+ }, Error, string, unknown>;
36
+ //# sourceMappingURL=useTheComments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheComments.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useTheComments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAOH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;KACzB,CAAC;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB;AAKD,iEAAiE;AACjE,eAAO,MAAM,cAAc,GAAI,YAAY,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS;;;SAwC9E,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,YAAY,MAAM,EAAE,UAAU,MAAM;QAKN,MAAM;0BAmBvE,CAAC"}
@@ -0,0 +1,45 @@
1
+ import { useTheGlobalFuel as e } from "../context/TheGlobalFuelContext.js";
2
+ import "../context/index.js";
3
+ import { wspaceFetch as t } from "./useTheFiles.js";
4
+ import { useMutation as n, useQuery as r, useQueryClient as i } from "@tanstack/react-query";
5
+ //#region src/theglobalfuel/hooks/useTheComments.ts
6
+ var a = (e, t) => [
7
+ "theglobalfuel",
8
+ "comments",
9
+ e,
10
+ t
11
+ ], o = (n, i) => {
12
+ let { apiGatewayUrl: o } = e();
13
+ return r({
14
+ queryKey: a(n, i ?? ""),
15
+ enabled: !!i,
16
+ queryFn: async () => {
17
+ let e = await t("query TheGetEntityComments($input: GetCommentsInput!) {\n getEntityComments(input: $input) {\n total\n items {\n id\n authorId\n authorType\n content { text markdown }\n createdAt\n edited\n parentCommentId\n replyCount\n }\n }\n }", { input: {
18
+ entityType: n,
19
+ entityId: i,
20
+ take: 100,
21
+ parentCommentId: null
22
+ } }, o), r = e.getEntityComments.items.filter((e) => !e.parentCommentId);
23
+ return r.sort((e, t) => new Date(e.createdAt).getTime() - new Date(t.createdAt).getTime()), {
24
+ items: r,
25
+ total: e.getEntityComments.total
26
+ };
27
+ }
28
+ });
29
+ }, s = (r, o) => {
30
+ let { apiGatewayUrl: s } = e(), c = i();
31
+ return n({
32
+ mutationFn: async (e) => (await t("mutation TheCreateEntityComment($input: CreateEntityCommentInput!) {\n createEntityComment(input: $input) { id }\n }", { input: {
33
+ entityType: r,
34
+ entityId: o,
35
+ content: { text: e }
36
+ } }, s)).createEntityComment,
37
+ onSuccess: () => {
38
+ c.invalidateQueries({ queryKey: a(r, o) });
39
+ }
40
+ });
41
+ };
42
+ //#endregion
43
+ export { o as useTheComments, s as useTheCreateComment };
44
+
45
+ //# sourceMappingURL=useTheComments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheComments.js","names":[],"sources":["../../../src/theglobalfuel/hooks/useTheComments.ts"],"sourcesContent":["/**\n * TheGlobalFuel — wspace-conversations-svc EntityComment REUSE hooks (Integration B).\n * @module theglobalfuel/hooks/useTheComments\n *\n * Adds a discussion surface to theglobalfuel entities WITHOUT any eco-svc change by\n * reusing the generic EntityComment API composed into the WORKSPACE supergraph.\n * Comments attach to any entity by `(entityType, entityId)`:\n * - `getEntityComments(input): EntityCommentConnection!`\n * - `createEntityComment(input): EntityComment!`\n *\n * Transport reuses `wspaceFetch` from `useTheFiles` (workspace gateway +\n * workspace token). Lives in a separate file; `useTheGlobalFuelApi.ts` is\n * untouched.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useTheGlobalFuel } from '../context';\nimport { wspaceFetch } from './useTheFiles';\n\nexport interface TheComment {\n id: string;\n authorId: string;\n authorType: string;\n content: {\n text: string | null;\n markdown: string | null;\n };\n createdAt: string;\n edited: boolean;\n parentCommentId: string | null;\n replyCount: number;\n}\n\nconst commentsKey = (entityType: string, entityId: string) =>\n ['theglobalfuel', 'comments', entityType, entityId] as const;\n\n/** Top-level (root) comments for an eco entity, oldest first. */\nexport const useTheComments = (entityType: string, entityId: string | undefined) => {\n const { apiGatewayUrl } = useTheGlobalFuel();\n return useQuery({\n queryKey: commentsKey(entityType, entityId ?? ''),\n enabled: Boolean(entityId),\n queryFn: async () => {\n const data = await wspaceFetch<{\n getEntityComments: { items: TheComment[]; total: number };\n }>(\n `query TheGetEntityComments($input: GetCommentsInput!) {\n getEntityComments(input: $input) {\n total\n items {\n id\n authorId\n authorType\n content { text markdown }\n createdAt\n edited\n parentCommentId\n replyCount\n }\n }\n }`,\n {\n input: {\n entityType,\n entityId,\n take: 100,\n parentCommentId: null,\n },\n },\n apiGatewayUrl\n );\n // Render root comments oldest-first (server order is not guaranteed).\n const roots = data.getEntityComments.items.filter((c) => !c.parentCommentId);\n roots.sort((a, b) => new Date(a.createdAt).getTime() - new Date(b.createdAt).getTime());\n return { items: roots, total: data.getEntityComments.total };\n },\n });\n};\n\nexport const useTheCreateComment = (entityType: string, entityId: string) => {\n const { apiGatewayUrl } = useTheGlobalFuel();\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (text: string) => {\n const data = await wspaceFetch<{ createEntityComment: { id: string } }>(\n `mutation TheCreateEntityComment($input: CreateEntityCommentInput!) {\n createEntityComment(input: $input) { id }\n }`,\n {\n input: {\n entityType,\n entityId,\n content: { text },\n },\n },\n apiGatewayUrl\n );\n return data.createEntityComment;\n },\n onSuccess: () => {\n qc.invalidateQueries({ queryKey: commentsKey(entityType, entityId) });\n },\n });\n};\n"],"mappings":";;;;;AAkCA,IAAM,KAAe,GAAoB,MACvC;CAAC;CAAiB;CAAY;CAAY;CAAS,EAGxC,KAAkB,GAAoB,MAAiC;CAClF,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU,EAAY,GAAY,KAAY,GAAG;EACjD,SAAS,EAAQ;EACjB,SAAS,YAAY;GACnB,IAAM,IAAO,MAAM,EAGjB,6YAeA,EACE,OAAO;IACL;IACA;IACA,MAAM;IACN,iBAAiB;IAClB,EACF,EACD,EACD,EAEK,IAAQ,EAAK,kBAAkB,MAAM,QAAQ,MAAM,CAAC,EAAE,gBAAgB;AAE5E,UADA,EAAM,MAAM,GAAG,MAAM,IAAI,KAAK,EAAE,UAAU,CAAC,SAAS,GAAG,IAAI,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,EAChF;IAAE,OAAO;IAAO,OAAO,EAAK,kBAAkB;IAAO;;EAE/D,CAAC;GAGS,KAAuB,GAAoB,MAAqB;CAC3E,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAK,GAAgB;AAC3B,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,wIAGA,EACE,OAAO;GACL;GACA;GACA,SAAS,EAAE,SAAM;GAClB,EACF,EACD,EACD,EACW;EAEd,iBAAiB;AACf,KAAG,kBAAkB,EAAE,UAAU,EAAY,GAAY,EAAS,EAAE,CAAC;;EAExE,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * TheGlobalFuel — wspace-files-svc REUSE hooks (Integration A).
3
+ * @module theglobalfuel/hooks/useTheFiles
4
+ *
5
+ * Reuses the platform file store (`wspace-files-svc`) WITHOUT any eco-svc
6
+ * change: the theglobalfuel schema already exposes `TheObservation.evidenceFileId` /
7
+ * `TheReport.fileId`; this module lets the UI actually produce a `fileId` via
8
+ * the canonical 3-step upload flow composed into the WORKSPACE supergraph:
9
+ * 1. `initiateUpload(input)` → `{ uploadUrl, session { id } }`
10
+ * 2. HTTP `PUT` the bytes to the returned signed `uploadUrl`
11
+ * 3. `completeUpload(input: { sessionId })` → `{ fileId }`
12
+ * plus `getFile(id)` to resolve an existing evidence/report file's name + URL.
13
+ *
14
+ * Transport mirrors `useTheGlobalFuelApi` exactly — `graphqlFetch({ gateway:
15
+ * 'workspace', workspaceToken: true })` — so no ApolloProvider is required.
16
+ * These hooks live in a SEPARATE file by design; `useTheGlobalFuelApi.ts` is
17
+ * left untouched.
18
+ */
19
+ /** Execute a workspace-gateway GraphQL operation with the workspace token. */
20
+ export declare const wspaceFetch: <TData>(query: string, variables: Record<string, unknown>, baseUrl?: string) => Promise<TData>;
21
+ export interface UploadedTheFile {
22
+ fileId: string;
23
+ fileName: string;
24
+ }
25
+ export interface UseTheFileUploadResult {
26
+ upload: (file: File) => Promise<UploadedTheFile>;
27
+ isUploading: boolean;
28
+ /** 0–100 byte-progress of the signed-URL PUT. */
29
+ progress: number;
30
+ error: string | null;
31
+ reset: () => void;
32
+ }
33
+ /**
34
+ * Imperative upload hook: `await upload(file)` runs the platform 3-step flow and
35
+ * resolves to `{ fileId, fileName }`. `fileId` is what the theglobalfuel mutations accept
36
+ * (`ecoRecordObservation.evidenceFileId`, `ecoPublishReport.fileId`).
37
+ */
38
+ export declare const useTheFileUpload: () => UseTheFileUploadResult;
39
+ export interface TheFileMeta {
40
+ id: string;
41
+ name: string;
42
+ downloadUrl: string | null;
43
+ mimeType: string;
44
+ size: string;
45
+ }
46
+ export declare const useTheFile: (id: string | null | undefined) => import('@tanstack/react-query').UseQueryResult<TheFileMeta | null, Error>;
47
+ //# sourceMappingURL=useTheFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheFiles.d.ts","sourceRoot":"","sources":["../../../src/theglobalfuel/hooks/useTheFiles.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AA8BH,8EAA8E;AAC9E,eAAO,MAAM,WAAW,GAAU,KAAK,EACrC,OAAO,MAAM,EACb,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,UAAU,MAAM,KACf,OAAO,CAAC,KAAK,CAmBf,CAAC;AAMF,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AA+BD,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;IACjD,WAAW,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAO,sBAoFnC,CAAC;AAMF,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,GAAG,IAAI,GAAG,SAAS,8EAsBvD,CAAC"}