@burdenoff/microfe-govcitizenhub 2026.720.7 → 2026.730.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 (155) hide show
  1. package/dist/govcitizenhub/GovCitizenHubRoot.d.ts.map +1 -1
  2. package/dist/govcitizenhub/GovCitizenHubRoot.js +44 -36
  3. package/dist/govcitizenhub/GovCitizenHubRoot.js.map +1 -1
  4. package/dist/govcitizenhub/GovCitizenHubRoutes.d.ts.map +1 -1
  5. package/dist/govcitizenhub/GovCitizenHubRoutes.js +134 -6
  6. package/dist/govcitizenhub/GovCitizenHubRoutes.js.map +1 -1
  7. package/dist/govcitizenhub/components/DocumentUploadField.d.ts +17 -11
  8. package/dist/govcitizenhub/components/DocumentUploadField.d.ts.map +1 -1
  9. package/dist/govcitizenhub/components/DocumentUploadField.js +45 -42
  10. package/dist/govcitizenhub/components/DocumentUploadField.js.map +1 -1
  11. package/dist/govcitizenhub/components/GovCharts.js +127 -51
  12. package/dist/govcitizenhub/components/GovCharts.js.map +1 -1
  13. package/dist/govcitizenhub/hooks/index.d.ts +1 -0
  14. package/dist/govcitizenhub/hooks/index.d.ts.map +1 -1
  15. package/dist/govcitizenhub/hooks/index.js +1 -0
  16. package/dist/govcitizenhub/hooks/useGovApi.d.ts +3 -0
  17. package/dist/govcitizenhub/hooks/useGovApi.d.ts.map +1 -1
  18. package/dist/govcitizenhub/hooks/useGovApi.js +1 -1
  19. package/dist/govcitizenhub/hooks/useGovApi.js.map +1 -1
  20. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts +214 -0
  21. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts.map +1 -0
  22. package/dist/govcitizenhub/hooks/useIntelligenceApi.js +1140 -0
  23. package/dist/govcitizenhub/hooks/useIntelligenceApi.js.map +1 -0
  24. package/dist/govcitizenhub/index.d.ts +1 -0
  25. package/dist/govcitizenhub/index.d.ts.map +1 -1
  26. package/dist/govcitizenhub/index.js +18 -0
  27. package/dist/govcitizenhub/pages/agencies/AgenciesPage.js +7 -7
  28. package/dist/govcitizenhub/pages/agencies/AgencyFormDialog.js +6 -6
  29. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +16 -16
  30. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +35 -35
  31. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
  32. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +1 -1
  33. package/dist/govcitizenhub/pages/documents/DocumentsPage.js +5 -5
  34. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js +30 -30
  35. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js.map +1 -1
  36. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +15 -15
  37. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts +4 -0
  38. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts.map +1 -0
  39. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js +634 -0
  40. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -0
  41. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts +20 -0
  42. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts.map +1 -0
  43. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js +537 -0
  44. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -0
  45. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts +11 -0
  46. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts.map +1 -0
  47. package/dist/govcitizenhub/pages/intelligence/AssetImage.js +25 -0
  48. package/dist/govcitizenhub/pages/intelligence/AssetImage.js.map +1 -0
  49. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts +15 -0
  50. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts.map +1 -0
  51. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js +203 -0
  52. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js.map +1 -0
  53. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts +4 -0
  54. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts.map +1 -0
  55. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js +497 -0
  56. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -0
  57. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts +4 -0
  58. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts.map +1 -0
  59. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js +1084 -0
  60. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -0
  61. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts +13 -0
  62. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts.map +1 -0
  63. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js +581 -0
  64. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -0
  65. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts +11 -0
  66. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts.map +1 -0
  67. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js +429 -0
  68. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -0
  69. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts +8 -0
  70. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts.map +1 -0
  71. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js +235 -0
  72. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js.map +1 -0
  73. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts +4 -0
  74. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts.map +1 -0
  75. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js +534 -0
  76. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -0
  77. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts +4 -0
  78. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts.map +1 -0
  79. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js +723 -0
  80. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -0
  81. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts +5 -0
  82. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts.map +1 -0
  83. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js +1029 -0
  84. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js.map +1 -0
  85. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts +5 -0
  86. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts.map +1 -0
  87. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js +1545 -0
  88. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js.map +1 -0
  89. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts +4 -0
  90. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts.map +1 -0
  91. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js +960 -0
  92. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -0
  93. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts +13 -0
  94. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts.map +1 -0
  95. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js +927 -0
  96. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js.map +1 -0
  97. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts +4 -0
  98. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts.map +1 -0
  99. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js +620 -0
  100. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -0
  101. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts +20 -0
  102. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts.map +1 -0
  103. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js +183 -0
  104. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -0
  105. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts +4 -0
  106. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts.map +1 -0
  107. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js +629 -0
  108. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -0
  109. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts +4 -0
  110. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts.map +1 -0
  111. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +1124 -0
  112. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -0
  113. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts +4 -0
  114. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts.map +1 -0
  115. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js +1518 -0
  116. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -0
  117. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts +4 -0
  118. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts.map +1 -0
  119. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js +577 -0
  120. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -0
  121. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts +4 -0
  122. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts.map +1 -0
  123. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js +534 -0
  124. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -0
  125. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts +5 -0
  126. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts.map +1 -0
  127. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js +538 -0
  128. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js.map +1 -0
  129. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts +53 -0
  130. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts.map +1 -0
  131. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js +138 -0
  132. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js.map +1 -0
  133. package/dist/govcitizenhub/pages/intelligence/index.d.ts +27 -0
  134. package/dist/govcitizenhub/pages/intelligence/index.d.ts.map +1 -0
  135. package/dist/govcitizenhub/pages/intelligence/index.js +17 -0
  136. package/dist/govcitizenhub/pages/payments/PaymentsPage.js +11 -11
  137. package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
  138. package/dist/govcitizenhub/pages/permits/PermitsPage.js +6 -6
  139. package/dist/govcitizenhub/pages/services/ServiceDetailPage.js +8 -8
  140. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +98 -98
  141. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
  142. package/dist/govcitizenhub/types/index.d.ts +1 -0
  143. package/dist/govcitizenhub/types/index.d.ts.map +1 -1
  144. package/dist/govcitizenhub/types/intelligence.d.ts +1559 -0
  145. package/dist/govcitizenhub/types/intelligence.d.ts.map +1 -0
  146. package/dist/govcitizenhub/types/intelligence.js +125 -0
  147. package/dist/govcitizenhub/types/intelligence.js.map +1 -0
  148. package/dist/index.js +19 -2
  149. package/dist/node_modules/recharts/es6/chart/BarChart.js +24 -0
  150. package/dist/node_modules/recharts/es6/chart/BarChart.js.map +1 -0
  151. package/dist/utils/pageContext.d.ts +1 -0
  152. package/dist/utils/pageContext.d.ts.map +1 -1
  153. package/dist/utils/pageContext.js +44 -17
  154. package/dist/utils/pageContext.js.map +1 -1
  155. package/package.json +1 -1
@@ -0,0 +1,1124 @@
1
+ import { cn as e } from "../../utils/cn.js";
2
+ import { formatDate as t, formatDateTime as n, formatNumber as r } from "../../utils/formatters.js";
3
+ import { StatusBadge as i } from "../../components/StatusBadge.js";
4
+ import { EmptyState as ee } from "../../components/EmptyState.js";
5
+ import { useGovCreateDataset as te, useGovDataset as a, useGovDatasets as o, useGovDeleteDataset as ne, useGovPublishDataset as s, useGovRecordDatasetDownload as re, useGovUpdateDataset as c } from "../../hooks/useIntelligenceApi.js";
6
+ import { useCursorPager as l } from "../../hooks/useCursorPager.js";
7
+ import { useFileUrl as ie } from "../../hooks/useFiles.js";
8
+ import "../../hooks/index.js";
9
+ import { ErrorView as u } from "../../components/StateViews.js";
10
+ import { SectionCard as d } from "../../components/SectionCard.js";
11
+ import { Pagination as f } from "../../components/Pagination.js";
12
+ import { describeError as ae, notify as p } from "../../lib/toast.js";
13
+ import { GOV_INDICATOR_DOMAIN_LABELS as oe } from "../../types/intelligence.js";
14
+ import { JurisdictionLayout as m } from "./JurisdictionLayout.js";
15
+ import { ConfirmDialog as h } from "../../components/ConfirmDialog.js";
16
+ import { KeyValueList as g } from "../../components/KeyValueList.js";
17
+ import { TagInput as _ } from "../../components/TagInput.js";
18
+ import { DocumentUploadField as v } from "../../components/DocumentUploadField.js";
19
+ import { useState as y } from "react";
20
+ import { Database as b, Download as se, ExternalLink as x, Filter as S, Globe as C, Info as ce, Mail as w, Pencil as T, Plus as E, Search as le, Send as D, Trash2 as O, X as k } from "lucide-react";
21
+ import { useParams as ue } from "react-router-dom";
22
+ import { jsx as A, jsxs as j } from "react/jsx-runtime";
23
+ import { Button as M, GlassCard as N, Input as P, Label as F, ResponsiveDialog as de, ResponsiveDialogContent as fe, ResponsiveDialogDescription as I, ResponsiveDialogFooter as pe, ResponsiveDialogHeader as me, ResponsiveDialogTitle as he, Select as L, SelectContent as R, SelectItem as z, SelectTrigger as B, SelectValue as V, Skeleton as H, Textarea as ge } from "@burdenoff/fe-libs/ui";
24
+ //#region src/govcitizenhub/pages/intelligence/OpenDataPage.tsx
25
+ var U = 20, _e = "/GovCitizenHub/Open Data", ve = [
26
+ "DEMOGRAPHICS",
27
+ "ECONOMY",
28
+ "EDUCATION",
29
+ "HEALTHCARE",
30
+ "INFRASTRUCTURE",
31
+ "PUBLIC_SAFETY",
32
+ "ENVIRONMENT",
33
+ "SOCIAL_WELFARE",
34
+ "UTILITIES",
35
+ "TRANSPORT",
36
+ "HOUSING",
37
+ "GOVERNANCE",
38
+ "DIGITAL",
39
+ "TOURISM",
40
+ "FINANCE"
41
+ ], ye = [
42
+ "CSV",
43
+ "JSON",
44
+ "GEOJSON",
45
+ "XLSX",
46
+ "PDF",
47
+ "XML",
48
+ "API"
49
+ ], be = {
50
+ CSV: "CSV",
51
+ JSON: "JSON",
52
+ GEOJSON: "GeoJSON",
53
+ XLSX: "XLSX",
54
+ PDF: "PDF",
55
+ XML: "XML",
56
+ API: "API"
57
+ }, xe = [
58
+ "CC0",
59
+ "CC_BY",
60
+ "CC_BY_SA",
61
+ "ODBL",
62
+ "OGL",
63
+ "PUBLIC_DOMAIN",
64
+ "PROPRIETARY",
65
+ "OTHER"
66
+ ], W = {
67
+ CC0: "CC0",
68
+ CC_BY: "CC BY",
69
+ CC_BY_SA: "CC BY-SA",
70
+ ODBL: "ODbL",
71
+ OGL: "OGL",
72
+ PUBLIC_DOMAIN: "Public domain",
73
+ PROPRIETARY: "Proprietary",
74
+ OTHER: "Other"
75
+ }, Se = [
76
+ "DRAFT",
77
+ "PUBLISHED",
78
+ "DEPRECATED",
79
+ "ARCHIVED"
80
+ ], Ce = [
81
+ "ANNUAL",
82
+ "QUARTERLY",
83
+ "MONTHLY",
84
+ "WEEKLY",
85
+ "DAILY",
86
+ "ADHOC"
87
+ ], we = {
88
+ ANNUAL: "Annual",
89
+ QUARTERLY: "Quarterly",
90
+ MONTHLY: "Monthly",
91
+ WEEKLY: "Weekly",
92
+ DAILY: "Daily",
93
+ ADHOC: "Ad hoc"
94
+ }, G = "ALL", K = [
95
+ "B",
96
+ "KB",
97
+ "MB",
98
+ "GB",
99
+ "TB",
100
+ "PB"
101
+ ];
102
+ function Te(e) {
103
+ if (e == null || !Number.isFinite(e) || e < 0) return "—";
104
+ if (e < 1024) return `${r(e)} B`;
105
+ let t = e, n = 0;
106
+ for (; t >= 1024 && n < K.length - 1;) t /= 1024, n += 1;
107
+ return `${t.toFixed(t >= 100 ? 0 : 1)} ${K[n]}`;
108
+ }
109
+ function q(e, n) {
110
+ return e && n ? `${t(e)} – ${t(n)}` : e ? `From ${t(e)}` : n ? `Until ${t(n)}` : "—";
111
+ }
112
+ var Ee = (e) => e ? e.slice(0, 10) : "", J = (e) => {
113
+ let t = e.trim();
114
+ if (!t) return null;
115
+ let n = /* @__PURE__ */ new Date(`${t}T00:00:00.000Z`);
116
+ return Number.isNaN(n.getTime()) ? null : n.toISOString();
117
+ }, Y = (e) => {
118
+ let t = e.trim();
119
+ if (!t) return null;
120
+ let n = Number(t);
121
+ return Number.isFinite(n) ? n : null;
122
+ }, X = (e) => e.trim() || null;
123
+ function Z(e) {
124
+ let t = !!(e.fileId && e.fileId.trim()), n = !!(e.externalUrl && e.externalUrl.trim());
125
+ return t && n ? "This dataset carries both an uploaded file and an external URL. A published entry must have exactly one source of truth — remove one before publishing." : !t && !n ? "This dataset has nothing to download. Upload a file or record the publisher’s external URL before publishing." : null;
126
+ }
127
+ function Q() {
128
+ let { jurisdictionId: t } = ue(), n = l(), [te, a] = y(""), [s, re] = y(""), [c, ie] = y(G), [g, _] = y(G), [v, se] = y(G), [x, C] = y(G), [w, T] = y(null), [D, O] = y(!1), [de, fe] = y(null), [I, pe] = y(null), { data: me, isLoading: he, isError: ge, refetch: _e } = o({
129
+ jurisdictionId: t,
130
+ search: s || void 0,
131
+ domain: c === G ? void 0 : c,
132
+ format: g === G ? void 0 : g,
133
+ license: v === G ? void 0 : v,
134
+ status: x === G ? void 0 : x
135
+ }, {
136
+ limit: U,
137
+ cursor: n.cursor
138
+ }), Ce = ne(), K = me?.items ?? [], Ee = K.find((e) => e.id === w) ?? null, J = () => {
139
+ n.reset(), T(null);
140
+ }, Y = (e) => (t) => {
141
+ e(t), J();
142
+ }, X = !!s || c !== G || g !== G || v !== G || x !== G, Z = () => {
143
+ a(""), re(""), ie(G), _(G), se(G), C(G), J();
144
+ }, Q = () => {
145
+ fe(null), O(!0);
146
+ };
147
+ return /* @__PURE__ */ j(m, {
148
+ actions: /* @__PURE__ */ j(M, {
149
+ onClick: Q,
150
+ children: [/* @__PURE__ */ A(E, {
151
+ className: "mr-1.5 h-4 w-4",
152
+ "aria-hidden": "true"
153
+ }), " New dataset"]
154
+ }),
155
+ children: [
156
+ /* @__PURE__ */ j("div", {
157
+ className: "mb-4 flex items-start gap-2.5 rounded-card border border-border-seam bg-bg-sunken px-4 py-3",
158
+ children: [/* @__PURE__ */ A(ce, {
159
+ className: "mt-0.5 size-4 shrink-0 text-text-muted",
160
+ "aria-hidden": "true"
161
+ }), /* @__PURE__ */ j("p", {
162
+ className: "text-sm text-text-secondary",
163
+ children: [
164
+ "This catalogue holds dataset ",
165
+ /* @__PURE__ */ A("span", {
166
+ className: "font-medium",
167
+ children: "metadata"
168
+ }),
169
+ "; the files themselves live in the platform file service. Bulk export of the whole catalogue is handled by the platform export service — download individual datasets here."
170
+ ]
171
+ })]
172
+ }),
173
+ /* @__PURE__ */ j(d, {
174
+ title: "Find a dataset",
175
+ icon: /* @__PURE__ */ A(S, {}),
176
+ className: "mb-4 border-border-seam",
177
+ children: [
178
+ /* @__PURE__ */ j("form", {
179
+ className: "relative mb-3",
180
+ onSubmit: (e) => {
181
+ e.preventDefault(), re(te.trim()), J();
182
+ },
183
+ children: [
184
+ /* @__PURE__ */ A(le, {
185
+ className: "pointer-events-none absolute left-3.5 top-1/2 size-4 -translate-y-1/2 text-text-muted",
186
+ "aria-hidden": "true"
187
+ }),
188
+ /* @__PURE__ */ A(P, {
189
+ value: te,
190
+ onChange: (e) => a(e.target.value),
191
+ placeholder: "Search datasets, then press Enter…",
192
+ "aria-label": "Search datasets",
193
+ className: "h-11 pl-10 pr-24"
194
+ }),
195
+ /* @__PURE__ */ A(M, {
196
+ type: "submit",
197
+ size: "sm",
198
+ className: "absolute right-1.5 top-1/2 -translate-y-1/2",
199
+ children: "Search"
200
+ })
201
+ ]
202
+ }),
203
+ /* @__PURE__ */ j("div", {
204
+ className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-4",
205
+ children: [
206
+ /* @__PURE__ */ j("div", {
207
+ className: "grid gap-1.5",
208
+ children: [/* @__PURE__ */ A(F, {
209
+ htmlFor: "dataset-domain",
210
+ children: "Domain"
211
+ }), /* @__PURE__ */ j(L, {
212
+ value: c,
213
+ onValueChange: Y(ie),
214
+ children: [/* @__PURE__ */ A(B, {
215
+ id: "dataset-domain",
216
+ "aria-label": "Filter by domain",
217
+ children: /* @__PURE__ */ A(V, {})
218
+ }), /* @__PURE__ */ j(R, { children: [/* @__PURE__ */ A(z, {
219
+ value: G,
220
+ children: "All domains"
221
+ }), ve.map((e) => /* @__PURE__ */ A(z, {
222
+ value: e,
223
+ children: oe[e]
224
+ }, e))] })]
225
+ })]
226
+ }),
227
+ /* @__PURE__ */ j("div", {
228
+ className: "grid gap-1.5",
229
+ children: [/* @__PURE__ */ A(F, {
230
+ htmlFor: "dataset-format",
231
+ children: "Format"
232
+ }), /* @__PURE__ */ j(L, {
233
+ value: g,
234
+ onValueChange: Y(_),
235
+ children: [/* @__PURE__ */ A(B, {
236
+ id: "dataset-format",
237
+ "aria-label": "Filter by format",
238
+ children: /* @__PURE__ */ A(V, {})
239
+ }), /* @__PURE__ */ j(R, { children: [/* @__PURE__ */ A(z, {
240
+ value: G,
241
+ children: "All formats"
242
+ }), ye.map((e) => /* @__PURE__ */ A(z, {
243
+ value: e,
244
+ children: be[e]
245
+ }, e))] })]
246
+ })]
247
+ }),
248
+ /* @__PURE__ */ j("div", {
249
+ className: "grid gap-1.5",
250
+ children: [/* @__PURE__ */ A(F, {
251
+ htmlFor: "dataset-license",
252
+ children: "Licence"
253
+ }), /* @__PURE__ */ j(L, {
254
+ value: v,
255
+ onValueChange: Y(se),
256
+ children: [/* @__PURE__ */ A(B, {
257
+ id: "dataset-license",
258
+ "aria-label": "Filter by licence",
259
+ children: /* @__PURE__ */ A(V, {})
260
+ }), /* @__PURE__ */ j(R, { children: [/* @__PURE__ */ A(z, {
261
+ value: G,
262
+ children: "All licences"
263
+ }), xe.map((e) => /* @__PURE__ */ A(z, {
264
+ value: e,
265
+ children: W[e]
266
+ }, e))] })]
267
+ })]
268
+ }),
269
+ /* @__PURE__ */ j("div", {
270
+ className: "grid gap-1.5",
271
+ children: [/* @__PURE__ */ A(F, {
272
+ htmlFor: "dataset-status",
273
+ children: "Status"
274
+ }), /* @__PURE__ */ j(L, {
275
+ value: x,
276
+ onValueChange: Y(C),
277
+ children: [/* @__PURE__ */ A(B, {
278
+ id: "dataset-status",
279
+ "aria-label": "Filter by status",
280
+ children: /* @__PURE__ */ A(V, {})
281
+ }), /* @__PURE__ */ j(R, { children: [/* @__PURE__ */ A(z, {
282
+ value: G,
283
+ children: "All statuses"
284
+ }), Se.map((e) => /* @__PURE__ */ A(z, {
285
+ value: e,
286
+ children: e.charAt(0) + e.slice(1).toLowerCase()
287
+ }, e))] })]
288
+ })]
289
+ })
290
+ ]
291
+ }),
292
+ X && /* @__PURE__ */ A("div", {
293
+ className: "mt-3",
294
+ children: /* @__PURE__ */ j(M, {
295
+ variant: "outline",
296
+ size: "sm",
297
+ onClick: Z,
298
+ children: [/* @__PURE__ */ A(k, {
299
+ className: "mr-1.5 h-4 w-4",
300
+ "aria-hidden": "true"
301
+ }), " Clear filters"]
302
+ })
303
+ })
304
+ ]
305
+ }),
306
+ he ? /* @__PURE__ */ A("div", {
307
+ className: "space-y-3",
308
+ children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ A(H, { className: "h-14 w-full rounded-card" }, t))
309
+ }) : ge ? /* @__PURE__ */ A(u, {
310
+ message: "We couldn't load the open-data catalogue.",
311
+ onRetry: () => {
312
+ _e();
313
+ }
314
+ }) : K.length === 0 && n.page === 0 ? /* @__PURE__ */ A(ee, {
315
+ illustration: "empty-data",
316
+ title: X ? "No datasets match these filters" : "No datasets published yet",
317
+ description: X ? "Widen or clear the filters to see the rest of the catalogue." : "Publish the region’s first open dataset so residents and researchers can use it.",
318
+ action: X ? /* @__PURE__ */ A(M, {
319
+ variant: "outline",
320
+ onClick: Z,
321
+ children: "Clear filters"
322
+ }) : /* @__PURE__ */ j(M, {
323
+ onClick: Q,
324
+ children: [/* @__PURE__ */ A(E, {
325
+ className: "mr-1.5 h-4 w-4",
326
+ "aria-hidden": "true"
327
+ }), " New dataset"]
328
+ })
329
+ }) : /* @__PURE__ */ j("div", {
330
+ className: "grid gap-4 xl:grid-cols-3",
331
+ children: [/* @__PURE__ */ j("div", {
332
+ className: "min-w-0 xl:col-span-2",
333
+ children: [/* @__PURE__ */ A(N, {
334
+ treatment: "plain",
335
+ className: "overflow-hidden border-border-seam p-0",
336
+ children: /* @__PURE__ */ A("div", {
337
+ className: "overflow-x-auto",
338
+ children: /* @__PURE__ */ j("table", {
339
+ className: "w-full text-left text-sm",
340
+ children: [/* @__PURE__ */ A("thead", { children: /* @__PURE__ */ j("tr", {
341
+ className: "border-b border-border-seam text-xs uppercase tracking-wide text-text-muted",
342
+ children: [
343
+ /* @__PURE__ */ A("th", {
344
+ className: "px-4 py-3 font-medium",
345
+ children: "Dataset"
346
+ }),
347
+ /* @__PURE__ */ A("th", {
348
+ className: "px-4 py-3 font-medium",
349
+ children: "Domain"
350
+ }),
351
+ /* @__PURE__ */ A("th", {
352
+ className: "px-4 py-3 font-medium",
353
+ children: "Format"
354
+ }),
355
+ /* @__PURE__ */ A("th", {
356
+ className: "px-4 py-3 font-medium",
357
+ children: "Licence"
358
+ }),
359
+ /* @__PURE__ */ A("th", {
360
+ className: "px-4 py-3 font-medium",
361
+ children: "Version"
362
+ }),
363
+ /* @__PURE__ */ A("th", {
364
+ className: "px-4 py-3 font-medium",
365
+ children: "Coverage"
366
+ }),
367
+ /* @__PURE__ */ A("th", {
368
+ className: "px-4 py-3 font-medium",
369
+ children: "Updated"
370
+ }),
371
+ /* @__PURE__ */ A("th", {
372
+ className: "px-4 py-3 text-right font-medium",
373
+ children: "Rows"
374
+ }),
375
+ /* @__PURE__ */ A("th", {
376
+ className: "px-4 py-3 text-right font-medium",
377
+ children: "Size"
378
+ }),
379
+ /* @__PURE__ */ A("th", {
380
+ className: "px-4 py-3 text-right font-medium",
381
+ children: "Downloads"
382
+ })
383
+ ]
384
+ }) }), /* @__PURE__ */ A("tbody", {
385
+ className: "divide-y divide-border-subtle",
386
+ children: K.map((t) => /* @__PURE__ */ j("tr", {
387
+ role: "button",
388
+ tabIndex: 0,
389
+ "aria-label": `Open ${t.name}`,
390
+ "aria-current": t.id === w ? "true" : void 0,
391
+ onClick: () => T(t.id),
392
+ onKeyDown: (e) => {
393
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), T(t.id));
394
+ },
395
+ className: e("cursor-pointer transition-colors outline-none hover:bg-bg-sunken focus-visible:bg-bg-sunken", t.id === w && "bg-bg-sunken"),
396
+ children: [
397
+ /* @__PURE__ */ A("td", {
398
+ className: "px-4 py-3",
399
+ children: /* @__PURE__ */ j("div", {
400
+ className: "flex min-w-0 items-center gap-2",
401
+ children: [/* @__PURE__ */ A("span", {
402
+ className: "truncate font-medium text-text-primary",
403
+ children: t.name
404
+ }), /* @__PURE__ */ A(i, { status: t.status })]
405
+ })
406
+ }),
407
+ /* @__PURE__ */ A("td", {
408
+ className: "whitespace-nowrap px-4 py-3",
409
+ children: t.domain ? /* @__PURE__ */ A("span", {
410
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
411
+ children: oe[t.domain]
412
+ }) : /* @__PURE__ */ A("span", {
413
+ className: "text-text-muted",
414
+ children: "—"
415
+ })
416
+ }),
417
+ /* @__PURE__ */ A("td", {
418
+ className: "whitespace-nowrap px-4 py-3",
419
+ children: /* @__PURE__ */ A("span", {
420
+ className: "inline-flex items-center rounded-md border border-border-seam px-2 py-0.5 text-xs font-medium text-text-secondary",
421
+ children: be[t.format]
422
+ })
423
+ }),
424
+ /* @__PURE__ */ A("td", {
425
+ className: "whitespace-nowrap px-4 py-3",
426
+ children: /* @__PURE__ */ A("span", {
427
+ className: "inline-flex items-center rounded-md border border-border-seam px-2 py-0.5 text-xs font-medium text-text-secondary",
428
+ children: W[t.license]
429
+ })
430
+ }),
431
+ /* @__PURE__ */ A("td", {
432
+ className: "whitespace-nowrap px-4 py-3 text-text-secondary tabular-nums",
433
+ children: t.version
434
+ }),
435
+ /* @__PURE__ */ A("td", {
436
+ className: "whitespace-nowrap px-4 py-3 text-text-secondary",
437
+ children: q(t.periodStart, t.periodEnd)
438
+ }),
439
+ /* @__PURE__ */ A("td", {
440
+ className: "whitespace-nowrap px-4 py-3 text-text-secondary",
441
+ children: t.updateFrequency ? we[t.updateFrequency] : "—"
442
+ }),
443
+ /* @__PURE__ */ A("td", {
444
+ className: "whitespace-nowrap px-4 py-3 text-right text-text-secondary tabular-nums",
445
+ children: t.rowCount == null ? "—" : r(t.rowCount)
446
+ }),
447
+ /* @__PURE__ */ A("td", {
448
+ className: "whitespace-nowrap px-4 py-3 text-right text-text-secondary tabular-nums",
449
+ children: Te(t.sizeBytes)
450
+ }),
451
+ /* @__PURE__ */ A("td", {
452
+ className: "whitespace-nowrap px-4 py-3 text-right text-text-secondary tabular-nums",
453
+ children: r(t.downloadCount)
454
+ })
455
+ ]
456
+ }, t.id))
457
+ })]
458
+ })
459
+ })
460
+ }), /* @__PURE__ */ A(f, {
461
+ page: n.page,
462
+ pageSize: U,
463
+ itemCount: K.length,
464
+ hasMore: me?.pageInfo.hasMore ?? !1,
465
+ onPageChange: (e) => {
466
+ n.onPageChange(e, me?.pageInfo.cursor), T(null);
467
+ }
468
+ })]
469
+ }), /* @__PURE__ */ A("div", {
470
+ className: "min-w-0",
471
+ children: w ? /* @__PURE__ */ A(De, {
472
+ datasetId: w,
473
+ fallback: Ee,
474
+ onClose: () => T(null),
475
+ onEdit: (e) => {
476
+ fe(e), O(!0);
477
+ },
478
+ onDelete: pe
479
+ }, w) : /* @__PURE__ */ A(d, {
480
+ title: "Dataset details",
481
+ icon: /* @__PURE__ */ A(b, {}),
482
+ className: "border-border-seam",
483
+ children: /* @__PURE__ */ A("p", {
484
+ className: "text-sm text-text-secondary",
485
+ children: "Select a dataset to see its description, publisher, licence and download link."
486
+ })
487
+ })
488
+ })]
489
+ }),
490
+ D && t && /* @__PURE__ */ A(Oe, {
491
+ jurisdictionId: t,
492
+ dataset: de,
493
+ onClose: () => O(!1),
494
+ onSaved: (e) => {
495
+ O(!1), T(e.id);
496
+ }
497
+ }, de?.id ?? "new-dataset"),
498
+ I && /* @__PURE__ */ A(h, {
499
+ open: !0,
500
+ onOpenChange: (e) => {
501
+ e || pe(null);
502
+ },
503
+ title: `Remove “${I.name}”?`,
504
+ description: "The catalogue entry is removed. The underlying file in the platform file service is left untouched.",
505
+ confirmLabel: "Remove dataset",
506
+ destructive: !0,
507
+ onConfirm: async () => {
508
+ if (I) try {
509
+ await Ce.mutateAsync(I.id), p.success("Dataset removed", I.name), w === I.id && T(null), pe(null);
510
+ } catch (e) {
511
+ p.error("Could not remove the dataset", ae(e));
512
+ }
513
+ }
514
+ })
515
+ ]
516
+ });
517
+ }
518
+ var De = ({ datasetId: e, fallback: t, onClose: ee, onEdit: te, onDelete: o }) => {
519
+ let { data: ne, isError: c, refetch: l } = a(e), f = ne ?? t, m = ie(f?.fileId), h = s(), _ = re();
520
+ if (!f) return /* @__PURE__ */ A(d, {
521
+ title: "Dataset details",
522
+ icon: /* @__PURE__ */ A(b, {}),
523
+ className: "border-border-seam",
524
+ children: c ? /* @__PURE__ */ A(u, {
525
+ message: "We couldn't load this dataset.",
526
+ onRetry: () => {
527
+ l();
528
+ }
529
+ }) : /* @__PURE__ */ j("div", {
530
+ className: "space-y-3",
531
+ children: [
532
+ /* @__PURE__ */ A(H, { className: "h-5 w-2/3 rounded" }),
533
+ /* @__PURE__ */ A(H, { className: "h-4 w-full rounded" }),
534
+ /* @__PURE__ */ A(H, { className: "h-4 w-5/6 rounded" })
535
+ ]
536
+ })
537
+ });
538
+ let v = f.externalUrl?.trim() ?? "", y = m.data ?? (v || null), S = Z(f), ce = async () => {
539
+ if (y && (window.open(y, "_blank", "noopener,noreferrer"), f.status === "PUBLISHED")) try {
540
+ await _.mutateAsync(f.id);
541
+ } catch (e) {
542
+ p.warning("Download started", `The download counter was not updated: ${ae(e)}`);
543
+ }
544
+ }, E = async () => {
545
+ if (!S) try {
546
+ await h.mutateAsync(f.id), p.success("Dataset published", f.name);
547
+ } catch (e) {
548
+ p.error("Could not publish the dataset", ae(e));
549
+ }
550
+ }, le = [
551
+ {
552
+ label: "Publisher",
553
+ value: f.publisher ?? ""
554
+ },
555
+ {
556
+ label: "Contact",
557
+ value: f.contactEmail ? /* @__PURE__ */ j("a", {
558
+ href: `mailto:${f.contactEmail}`,
559
+ className: "inline-flex items-center gap-1.5 text-action-primary-text hover:underline",
560
+ children: [
561
+ /* @__PURE__ */ A(w, {
562
+ className: "size-3.5",
563
+ "aria-hidden": "true"
564
+ }),
565
+ " ",
566
+ f.contactEmail
567
+ ]
568
+ }) : ""
569
+ },
570
+ {
571
+ label: "Licence",
572
+ value: f.licenseUrl ? /* @__PURE__ */ j("a", {
573
+ href: f.licenseUrl,
574
+ target: "_blank",
575
+ rel: "noopener noreferrer",
576
+ className: "inline-flex items-center gap-1.5 text-action-primary-text hover:underline",
577
+ children: [W[f.license], /* @__PURE__ */ A(x, {
578
+ className: "size-3.5",
579
+ "aria-hidden": "true"
580
+ })]
581
+ }) : W[f.license]
582
+ },
583
+ {
584
+ label: "Format",
585
+ value: be[f.format]
586
+ },
587
+ {
588
+ label: "Version",
589
+ value: f.version
590
+ },
591
+ {
592
+ label: "Coverage",
593
+ value: q(f.periodStart, f.periodEnd)
594
+ },
595
+ {
596
+ label: "Update frequency",
597
+ value: f.updateFrequency ? we[f.updateFrequency] : ""
598
+ },
599
+ {
600
+ label: "Rows",
601
+ value: f.rowCount == null ? "" : r(f.rowCount)
602
+ },
603
+ {
604
+ label: "Size",
605
+ value: f.sizeBytes == null ? "" : Te(f.sizeBytes)
606
+ },
607
+ {
608
+ label: "Downloads",
609
+ value: r(f.downloadCount)
610
+ },
611
+ {
612
+ label: "Published",
613
+ value: f.publishedAt ? n(f.publishedAt) : ""
614
+ },
615
+ {
616
+ label: "Last updated",
617
+ value: n(f.updatedAt)
618
+ }
619
+ ];
620
+ return /* @__PURE__ */ j(d, {
621
+ title: f.name,
622
+ icon: /* @__PURE__ */ A(b, {}),
623
+ className: "border-border-seam",
624
+ actions: /* @__PURE__ */ A(M, {
625
+ variant: "outline",
626
+ size: "sm",
627
+ onClick: ee,
628
+ "aria-label": "Close dataset details",
629
+ children: /* @__PURE__ */ A(k, {
630
+ className: "h-4 w-4",
631
+ "aria-hidden": "true"
632
+ })
633
+ }),
634
+ children: [
635
+ /* @__PURE__ */ j("div", {
636
+ className: "mb-3 flex flex-wrap items-center gap-2",
637
+ children: [
638
+ /* @__PURE__ */ A(i, {
639
+ status: f.status,
640
+ size: "md"
641
+ }),
642
+ f.domain && /* @__PURE__ */ A("span", {
643
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
644
+ children: oe[f.domain]
645
+ }),
646
+ f.tags.map((e) => /* @__PURE__ */ A("span", {
647
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs text-text-secondary",
648
+ children: e
649
+ }, e))
650
+ ]
651
+ }),
652
+ f.description ? /* @__PURE__ */ A("p", {
653
+ className: "mb-4 whitespace-pre-wrap text-sm text-text-secondary",
654
+ children: f.description
655
+ }) : /* @__PURE__ */ A("p", {
656
+ className: "mb-4 text-sm text-text-muted",
657
+ children: "No description published for this dataset."
658
+ }),
659
+ /* @__PURE__ */ A(g, { items: le }),
660
+ /* @__PURE__ */ j("div", {
661
+ className: "mt-4 border-t border-border-seam pt-4",
662
+ children: [/* @__PURE__ */ A("p", {
663
+ className: "mb-2 text-xs font-medium uppercase tracking-wide text-text-muted",
664
+ children: "Source"
665
+ }), f.fileId ? /* @__PURE__ */ j("p", {
666
+ className: "text-sm text-text-secondary",
667
+ children: ["Hosted on the platform file service.", m.isError && /* @__PURE__ */ A("span", {
668
+ className: "ml-1 text-status-error-text",
669
+ children: "The download link could not be resolved."
670
+ })]
671
+ }) : v ? /* @__PURE__ */ j("a", {
672
+ href: v,
673
+ target: "_blank",
674
+ rel: "noopener noreferrer",
675
+ className: "inline-flex items-center gap-1.5 break-all text-sm text-action-primary-text hover:underline",
676
+ children: [/* @__PURE__ */ A(C, {
677
+ className: "size-3.5 shrink-0",
678
+ "aria-hidden": "true"
679
+ }), v]
680
+ }) : /* @__PURE__ */ A("p", {
681
+ className: "text-sm text-text-muted",
682
+ children: "No file or external URL recorded yet."
683
+ })]
684
+ }),
685
+ f.status !== "PUBLISHED" && S && /* @__PURE__ */ A("p", {
686
+ className: "mt-4 rounded-lg bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text",
687
+ children: S
688
+ }),
689
+ /* @__PURE__ */ j("div", {
690
+ className: "mt-4 flex flex-wrap gap-2 border-t border-border-seam pt-4",
691
+ children: [
692
+ /* @__PURE__ */ j(M, {
693
+ onClick: () => {
694
+ ce();
695
+ },
696
+ disabled: !y || m.isLoading || _.isPending,
697
+ children: [/* @__PURE__ */ A(se, {
698
+ className: "mr-1.5 h-4 w-4",
699
+ "aria-hidden": "true"
700
+ }), m.isLoading ? "Preparing…" : "Download"]
701
+ }),
702
+ f.status !== "PUBLISHED" && /* @__PURE__ */ j(M, {
703
+ variant: "outline",
704
+ onClick: () => {
705
+ E();
706
+ },
707
+ disabled: !!S || h.isPending,
708
+ children: [/* @__PURE__ */ A(D, {
709
+ className: "mr-1.5 h-4 w-4",
710
+ "aria-hidden": "true"
711
+ }), " Publish"]
712
+ }),
713
+ /* @__PURE__ */ j(M, {
714
+ variant: "outline",
715
+ onClick: () => te(f),
716
+ children: [/* @__PURE__ */ A(T, {
717
+ className: "mr-1.5 h-4 w-4",
718
+ "aria-hidden": "true"
719
+ }), " Edit"]
720
+ }),
721
+ /* @__PURE__ */ j(M, {
722
+ variant: "outline",
723
+ onClick: () => o(f),
724
+ children: [/* @__PURE__ */ A(O, {
725
+ className: "mr-1.5 h-4 w-4",
726
+ "aria-hidden": "true"
727
+ }), " Remove"]
728
+ })
729
+ ]
730
+ })
731
+ ]
732
+ });
733
+ }, $ = "NONE", Oe = ({ jurisdictionId: e, dataset: t, onClose: n, onSaved: r }) => {
734
+ let i = !!t, ee = te(), a = c(), [o, ne] = y(t?.name ?? ""), [s, re] = y(t?.slug ?? ""), [l, ie] = y(t?.description ?? ""), [u, d] = y(t?.domain ?? $), [f, m] = y(t?.format ?? "CSV"), [h, g] = y(t?.license ?? "CC_BY"), [b, se] = y(t?.licenseUrl ?? ""), [x, S] = y(t?.version ?? "1.0.0"), [C, ce] = y(t?.fileId ?? ""), [w, T] = y(""), [E, le] = y(t?.externalUrl ?? ""), [D, O] = y(Ee(t?.periodStart)), [k, ue] = y(Ee(t?.periodEnd)), [N, H] = y(t?.updateFrequency ?? $), [U, G] = y(t?.rowCount == null ? "" : String(t.rowCount)), [K, Te] = y(t?.sizeBytes == null ? "" : String(t.sizeBytes)), [q, Z] = y(t?.publisher ?? ""), [Q, De] = y(t?.contactEmail ?? ""), [Oe, ke] = y(t?.status ?? "DRAFT"), [Ae, je] = y(t?.tags ?? []), [Me, Ne] = y(null), Pe = ee.isPending || a.isPending, Fe = !!C.trim(), Ie = !!E.trim(), Le = Fe && Ie ? "both" : !Fe && !Ie ? "neither" : null, Re = async () => {
735
+ if (!o.trim()) {
736
+ Ne("Give the dataset a name.");
737
+ return;
738
+ }
739
+ Ne(null);
740
+ try {
741
+ if (t) {
742
+ let n = await a.mutateAsync({
743
+ id: t.id,
744
+ input: {
745
+ jurisdictionId: e,
746
+ name: o.trim(),
747
+ description: X(l),
748
+ domain: u === $ ? null : u,
749
+ format: f,
750
+ license: h,
751
+ licenseUrl: X(b),
752
+ version: x.trim() || "1.0.0",
753
+ fileId: X(C),
754
+ externalUrl: X(E),
755
+ periodStart: J(D),
756
+ periodEnd: J(k),
757
+ updateFrequency: N === $ ? null : N,
758
+ rowCount: Y(U),
759
+ sizeBytes: Y(K),
760
+ publisher: X(q),
761
+ contactEmail: X(Q),
762
+ status: Oe,
763
+ tags: Ae
764
+ }
765
+ });
766
+ p.success("Dataset updated", n.name), r(n);
767
+ } else {
768
+ let t = await ee.mutateAsync({
769
+ jurisdictionId: e,
770
+ name: o.trim(),
771
+ slug: X(s),
772
+ description: X(l),
773
+ domain: u === $ ? null : u,
774
+ format: f,
775
+ license: h,
776
+ licenseUrl: X(b),
777
+ version: x.trim() || "1.0.0",
778
+ fileId: X(C),
779
+ externalUrl: X(E),
780
+ periodStart: J(D),
781
+ periodEnd: J(k),
782
+ updateFrequency: N === $ ? null : N,
783
+ rowCount: Y(U),
784
+ sizeBytes: Y(K),
785
+ publisher: X(q),
786
+ contactEmail: X(Q),
787
+ tags: Ae
788
+ });
789
+ p.success("Dataset created", t.name), r(t);
790
+ }
791
+ } catch (e) {
792
+ Ne(ae(e));
793
+ }
794
+ };
795
+ return /* @__PURE__ */ A(de, {
796
+ open: !0,
797
+ onOpenChange: (e) => {
798
+ !e && !Pe && n();
799
+ },
800
+ children: /* @__PURE__ */ j(fe, {
801
+ className: "sm:max-w-2xl",
802
+ children: [
803
+ /* @__PURE__ */ j(me, { children: [/* @__PURE__ */ A(he, { children: i ? "Edit dataset" : "New dataset" }), /* @__PURE__ */ A(I, { children: "Catalogue metadata for a dataset published by this region. Only fill in what the publisher actually documents — blank stays blank." })] }),
804
+ /* @__PURE__ */ j("div", {
805
+ className: "grid max-h-[60vh] gap-4 overflow-y-auto py-2 sm:grid-cols-2",
806
+ children: [
807
+ /* @__PURE__ */ j("div", {
808
+ className: "grid gap-1.5 sm:col-span-2",
809
+ children: [/* @__PURE__ */ A(F, {
810
+ htmlFor: "dataset-name",
811
+ children: "Name"
812
+ }), /* @__PURE__ */ A(P, {
813
+ id: "dataset-name",
814
+ value: o,
815
+ onChange: (e) => ne(e.target.value),
816
+ placeholder: "e.g. Ward-level water supply hours"
817
+ })]
818
+ }),
819
+ !i && /* @__PURE__ */ j("div", {
820
+ className: "grid gap-1.5 sm:col-span-2",
821
+ children: [/* @__PURE__ */ A(F, {
822
+ htmlFor: "dataset-slug",
823
+ children: "Slug (optional)"
824
+ }), /* @__PURE__ */ A(P, {
825
+ id: "dataset-slug",
826
+ value: s,
827
+ onChange: (e) => re(e.target.value),
828
+ placeholder: "Derived from the name when left blank"
829
+ })]
830
+ }),
831
+ /* @__PURE__ */ j("div", {
832
+ className: "grid gap-1.5 sm:col-span-2",
833
+ children: [/* @__PURE__ */ A(F, {
834
+ htmlFor: "dataset-description",
835
+ children: "Description"
836
+ }), /* @__PURE__ */ A(ge, {
837
+ id: "dataset-description",
838
+ value: l,
839
+ onChange: (e) => ie(e.target.value),
840
+ rows: 3,
841
+ placeholder: "What the dataset contains, how it was collected, known caveats…"
842
+ })]
843
+ }),
844
+ /* @__PURE__ */ j("div", {
845
+ className: "grid gap-1.5",
846
+ children: [/* @__PURE__ */ A(F, {
847
+ htmlFor: "dataset-form-domain",
848
+ children: "Domain"
849
+ }), /* @__PURE__ */ j(L, {
850
+ value: u,
851
+ onValueChange: d,
852
+ children: [/* @__PURE__ */ A(B, {
853
+ id: "dataset-form-domain",
854
+ children: /* @__PURE__ */ A(V, {})
855
+ }), /* @__PURE__ */ j(R, { children: [/* @__PURE__ */ A(z, {
856
+ value: $,
857
+ children: "Not classified"
858
+ }), ve.map((e) => /* @__PURE__ */ A(z, {
859
+ value: e,
860
+ children: oe[e]
861
+ }, e))] })]
862
+ })]
863
+ }),
864
+ /* @__PURE__ */ j("div", {
865
+ className: "grid gap-1.5",
866
+ children: [/* @__PURE__ */ A(F, {
867
+ htmlFor: "dataset-form-format",
868
+ children: "Format"
869
+ }), /* @__PURE__ */ j(L, {
870
+ value: f,
871
+ onValueChange: (e) => m(e),
872
+ children: [/* @__PURE__ */ A(B, {
873
+ id: "dataset-form-format",
874
+ children: /* @__PURE__ */ A(V, {})
875
+ }), /* @__PURE__ */ A(R, { children: ye.map((e) => /* @__PURE__ */ A(z, {
876
+ value: e,
877
+ children: be[e]
878
+ }, e)) })]
879
+ })]
880
+ }),
881
+ /* @__PURE__ */ j("div", {
882
+ className: "grid gap-1.5",
883
+ children: [/* @__PURE__ */ A(F, {
884
+ htmlFor: "dataset-form-license",
885
+ children: "Licence"
886
+ }), /* @__PURE__ */ j(L, {
887
+ value: h,
888
+ onValueChange: (e) => g(e),
889
+ children: [/* @__PURE__ */ A(B, {
890
+ id: "dataset-form-license",
891
+ children: /* @__PURE__ */ A(V, {})
892
+ }), /* @__PURE__ */ A(R, { children: xe.map((e) => /* @__PURE__ */ A(z, {
893
+ value: e,
894
+ children: W[e]
895
+ }, e)) })]
896
+ })]
897
+ }),
898
+ /* @__PURE__ */ j("div", {
899
+ className: "grid gap-1.5",
900
+ children: [/* @__PURE__ */ A(F, {
901
+ htmlFor: "dataset-license-url",
902
+ children: "Licence URL"
903
+ }), /* @__PURE__ */ A(P, {
904
+ id: "dataset-license-url",
905
+ value: b,
906
+ onChange: (e) => se(e.target.value),
907
+ placeholder: "https://…"
908
+ })]
909
+ }),
910
+ /* @__PURE__ */ j("div", {
911
+ className: "grid gap-2 sm:col-span-2",
912
+ children: [
913
+ /* @__PURE__ */ A(F, { children: "Source" }),
914
+ /* @__PURE__ */ j("p", {
915
+ className: "text-xs text-text-muted",
916
+ children: [
917
+ "A published dataset must carry ",
918
+ /* @__PURE__ */ A("span", {
919
+ className: "font-medium",
920
+ children: "exactly one"
921
+ }),
922
+ " source: either a file uploaded here, or the publisher’s external URL."
923
+ ]
924
+ }),
925
+ C ? /* @__PURE__ */ j("div", {
926
+ className: "flex flex-wrap items-center justify-between gap-2 rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5",
927
+ children: [/* @__PURE__ */ j("div", {
928
+ className: "min-w-0",
929
+ children: [/* @__PURE__ */ A("p", {
930
+ className: "truncate text-sm font-medium text-text-primary",
931
+ children: w || "File attached"
932
+ }), /* @__PURE__ */ A("p", {
933
+ className: "truncate font-mono text-xs text-text-muted",
934
+ children: C
935
+ })]
936
+ }), /* @__PURE__ */ A(M, {
937
+ variant: "outline",
938
+ size: "sm",
939
+ onClick: () => {
940
+ ce(""), T("");
941
+ },
942
+ children: "Remove file"
943
+ })]
944
+ }) : /* @__PURE__ */ A(v, {
945
+ folder: _e,
946
+ hint: "Upload the dataset file — it is stored in the platform file service",
947
+ onUploaded: (e) => {
948
+ ce(e.id), T(e.name);
949
+ }
950
+ }),
951
+ /* @__PURE__ */ j("div", {
952
+ className: "grid gap-1.5",
953
+ children: [/* @__PURE__ */ A(F, {
954
+ htmlFor: "dataset-external-url",
955
+ children: "External URL"
956
+ }), /* @__PURE__ */ A(P, {
957
+ id: "dataset-external-url",
958
+ value: E,
959
+ onChange: (e) => le(e.target.value),
960
+ placeholder: "https://…"
961
+ })]
962
+ }),
963
+ Le && /* @__PURE__ */ A("p", {
964
+ className: "rounded-lg bg-status-warning-bg-subtle px-3 py-2 text-xs text-status-warning-text",
965
+ children: Le === "both" ? "Both a file and an external URL are set. The dataset can be saved as a draft, but publishing will be refused until exactly one remains." : "Neither a file nor an external URL is set. The dataset can be saved as a draft, but publishing will be refused until one is supplied."
966
+ })
967
+ ]
968
+ }),
969
+ /* @__PURE__ */ j("div", {
970
+ className: "grid gap-1.5",
971
+ children: [/* @__PURE__ */ A(F, {
972
+ htmlFor: "dataset-version",
973
+ children: "Version"
974
+ }), /* @__PURE__ */ A(P, {
975
+ id: "dataset-version",
976
+ value: x,
977
+ onChange: (e) => S(e.target.value)
978
+ })]
979
+ }),
980
+ /* @__PURE__ */ j("div", {
981
+ className: "grid gap-1.5",
982
+ children: [/* @__PURE__ */ A(F, {
983
+ htmlFor: "dataset-frequency",
984
+ children: "Update frequency"
985
+ }), /* @__PURE__ */ j(L, {
986
+ value: N,
987
+ onValueChange: H,
988
+ children: [/* @__PURE__ */ A(B, {
989
+ id: "dataset-frequency",
990
+ children: /* @__PURE__ */ A(V, {})
991
+ }), /* @__PURE__ */ j(R, { children: [/* @__PURE__ */ A(z, {
992
+ value: $,
993
+ children: "Not stated"
994
+ }), Ce.map((e) => /* @__PURE__ */ A(z, {
995
+ value: e,
996
+ children: we[e]
997
+ }, e))] })]
998
+ })]
999
+ }),
1000
+ /* @__PURE__ */ j("div", {
1001
+ className: "grid gap-1.5",
1002
+ children: [/* @__PURE__ */ A(F, {
1003
+ htmlFor: "dataset-period-start",
1004
+ children: "Coverage from"
1005
+ }), /* @__PURE__ */ A(P, {
1006
+ id: "dataset-period-start",
1007
+ type: "date",
1008
+ value: D,
1009
+ onChange: (e) => O(e.target.value)
1010
+ })]
1011
+ }),
1012
+ /* @__PURE__ */ j("div", {
1013
+ className: "grid gap-1.5",
1014
+ children: [/* @__PURE__ */ A(F, {
1015
+ htmlFor: "dataset-period-end",
1016
+ children: "Coverage to"
1017
+ }), /* @__PURE__ */ A(P, {
1018
+ id: "dataset-period-end",
1019
+ type: "date",
1020
+ value: k,
1021
+ onChange: (e) => ue(e.target.value)
1022
+ })]
1023
+ }),
1024
+ /* @__PURE__ */ j("div", {
1025
+ className: "grid gap-1.5",
1026
+ children: [/* @__PURE__ */ A(F, {
1027
+ htmlFor: "dataset-rows",
1028
+ children: "Row count"
1029
+ }), /* @__PURE__ */ A(P, {
1030
+ id: "dataset-rows",
1031
+ type: "number",
1032
+ min: "0",
1033
+ step: "1",
1034
+ value: U,
1035
+ onChange: (e) => G(e.target.value)
1036
+ })]
1037
+ }),
1038
+ /* @__PURE__ */ j("div", {
1039
+ className: "grid gap-1.5",
1040
+ children: [/* @__PURE__ */ A(F, {
1041
+ htmlFor: "dataset-size",
1042
+ children: "Size in bytes"
1043
+ }), /* @__PURE__ */ A(P, {
1044
+ id: "dataset-size",
1045
+ type: "number",
1046
+ min: "0",
1047
+ step: "1",
1048
+ value: K,
1049
+ onChange: (e) => Te(e.target.value)
1050
+ })]
1051
+ }),
1052
+ /* @__PURE__ */ j("div", {
1053
+ className: "grid gap-1.5",
1054
+ children: [/* @__PURE__ */ A(F, {
1055
+ htmlFor: "dataset-publisher",
1056
+ children: "Publisher"
1057
+ }), /* @__PURE__ */ A(P, {
1058
+ id: "dataset-publisher",
1059
+ value: q,
1060
+ onChange: (e) => Z(e.target.value)
1061
+ })]
1062
+ }),
1063
+ /* @__PURE__ */ j("div", {
1064
+ className: "grid gap-1.5",
1065
+ children: [/* @__PURE__ */ A(F, {
1066
+ htmlFor: "dataset-contact",
1067
+ children: "Contact email"
1068
+ }), /* @__PURE__ */ A(P, {
1069
+ id: "dataset-contact",
1070
+ type: "email",
1071
+ value: Q,
1072
+ onChange: (e) => De(e.target.value)
1073
+ })]
1074
+ }),
1075
+ i && /* @__PURE__ */ j("div", {
1076
+ className: "grid gap-1.5",
1077
+ children: [/* @__PURE__ */ A(F, {
1078
+ htmlFor: "dataset-form-status",
1079
+ children: "Status"
1080
+ }), /* @__PURE__ */ j(L, {
1081
+ value: Oe,
1082
+ onValueChange: (e) => ke(e),
1083
+ children: [/* @__PURE__ */ A(B, {
1084
+ id: "dataset-form-status",
1085
+ children: /* @__PURE__ */ A(V, {})
1086
+ }), /* @__PURE__ */ A(R, { children: Se.map((e) => /* @__PURE__ */ A(z, {
1087
+ value: e,
1088
+ children: e.charAt(0) + e.slice(1).toLowerCase()
1089
+ }, e)) })]
1090
+ })]
1091
+ }),
1092
+ /* @__PURE__ */ j("div", {
1093
+ className: "grid gap-1.5 sm:col-span-2",
1094
+ children: [/* @__PURE__ */ A(F, { children: "Tags" }), /* @__PURE__ */ A(_, {
1095
+ value: Ae,
1096
+ onChange: je
1097
+ })]
1098
+ }),
1099
+ Me && /* @__PURE__ */ A("p", {
1100
+ className: "rounded-lg bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text sm:col-span-2",
1101
+ children: Me
1102
+ })
1103
+ ]
1104
+ }),
1105
+ /* @__PURE__ */ j(pe, { children: [/* @__PURE__ */ A(M, {
1106
+ variant: "outline",
1107
+ onClick: n,
1108
+ disabled: Pe,
1109
+ children: "Cancel"
1110
+ }), /* @__PURE__ */ A(M, {
1111
+ onClick: () => {
1112
+ Re();
1113
+ },
1114
+ disabled: Pe || !o.trim(),
1115
+ children: Pe ? "Saving…" : i ? "Save changes" : "Create dataset"
1116
+ })] })
1117
+ ]
1118
+ })
1119
+ });
1120
+ };
1121
+ //#endregion
1122
+ export { Q as OpenDataPage };
1123
+
1124
+ //# sourceMappingURL=OpenDataPage.js.map