@burdenoff/microfe-govcitizenhub 2026.720.6 → 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 (171) 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 +2 -0
  14. package/dist/govcitizenhub/hooks/index.d.ts.map +1 -1
  15. package/dist/govcitizenhub/hooks/index.js +2 -0
  16. package/dist/govcitizenhub/hooks/useGovApi.d.ts +23 -0
  17. package/dist/govcitizenhub/hooks/useGovApi.d.ts.map +1 -1
  18. package/dist/govcitizenhub/hooks/useGovApi.js +18 -7
  19. package/dist/govcitizenhub/hooks/useGovApi.js.map +1 -1
  20. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.d.ts +24 -0
  21. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.d.ts.map +1 -0
  22. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.js +40 -0
  23. package/dist/govcitizenhub/hooks/useGovCitizenHubAnalytics.js.map +1 -0
  24. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts +214 -0
  25. package/dist/govcitizenhub/hooks/useIntelligenceApi.d.ts.map +1 -0
  26. package/dist/govcitizenhub/hooks/useIntelligenceApi.js +1140 -0
  27. package/dist/govcitizenhub/hooks/useIntelligenceApi.js.map +1 -0
  28. package/dist/govcitizenhub/index.d.ts +1 -0
  29. package/dist/govcitizenhub/index.d.ts.map +1 -1
  30. package/dist/govcitizenhub/index.js +18 -0
  31. package/dist/govcitizenhub/pages/agencies/AgenciesPage.js +7 -7
  32. package/dist/govcitizenhub/pages/agencies/AgencyFormDialog.js +6 -6
  33. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.d.ts.map +1 -1
  34. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js +178 -172
  35. package/dist/govcitizenhub/pages/applications/ApplicationDetailPage.js.map +1 -1
  36. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js +35 -35
  37. package/dist/govcitizenhub/pages/applications/ApplicationsPage.js.map +1 -1
  38. package/dist/govcitizenhub/pages/applications/NewApplicationPage.d.ts.map +1 -1
  39. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js +151 -147
  40. package/dist/govcitizenhub/pages/applications/NewApplicationPage.js.map +1 -1
  41. package/dist/govcitizenhub/pages/documents/DocumentsPage.js +5 -5
  42. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js +30 -30
  43. package/dist/govcitizenhub/pages/grievances/GrievanceDetailPage.js.map +1 -1
  44. package/dist/govcitizenhub/pages/grievances/GrievancesPage.d.ts.map +1 -1
  45. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js +176 -172
  46. package/dist/govcitizenhub/pages/grievances/GrievancesPage.js.map +1 -1
  47. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts +4 -0
  48. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.d.ts.map +1 -0
  49. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js +634 -0
  50. package/dist/govcitizenhub/pages/intelligence/AdminLevelsPage.js.map +1 -0
  51. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts +20 -0
  52. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.d.ts.map +1 -0
  53. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js +537 -0
  54. package/dist/govcitizenhub/pages/intelligence/AssetFormDialog.js.map +1 -0
  55. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts +11 -0
  56. package/dist/govcitizenhub/pages/intelligence/AssetImage.d.ts.map +1 -0
  57. package/dist/govcitizenhub/pages/intelligence/AssetImage.js +25 -0
  58. package/dist/govcitizenhub/pages/intelligence/AssetImage.js.map +1 -0
  59. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts +15 -0
  60. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.d.ts.map +1 -0
  61. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js +203 -0
  62. package/dist/govcitizenhub/pages/intelligence/AssetMapPanel.js.map +1 -0
  63. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts +4 -0
  64. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.d.ts.map +1 -0
  65. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js +497 -0
  66. package/dist/govcitizenhub/pages/intelligence/BenchmarkPage.js.map +1 -0
  67. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts +4 -0
  68. package/dist/govcitizenhub/pages/intelligence/BudgetPage.d.ts.map +1 -0
  69. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js +1084 -0
  70. package/dist/govcitizenhub/pages/intelligence/BudgetPage.js.map +1 -0
  71. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts +13 -0
  72. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.d.ts.map +1 -0
  73. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js +581 -0
  74. package/dist/govcitizenhub/pages/intelligence/ConsultationFormDialog.js.map +1 -0
  75. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts +11 -0
  76. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.d.ts.map +1 -0
  77. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js +429 -0
  78. package/dist/govcitizenhub/pages/intelligence/ConsultationParticipateDialog.js.map +1 -0
  79. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts +8 -0
  80. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.d.ts.map +1 -0
  81. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js +235 -0
  82. package/dist/govcitizenhub/pages/intelligence/ConsultationResultsPanel.js.map +1 -0
  83. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts +4 -0
  84. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.d.ts.map +1 -0
  85. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js +534 -0
  86. package/dist/govcitizenhub/pages/intelligence/ConsultationsPage.js.map +1 -0
  87. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts +4 -0
  88. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.d.ts.map +1 -0
  89. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js +723 -0
  90. package/dist/govcitizenhub/pages/intelligence/CorrectionsPage.js.map +1 -0
  91. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts +5 -0
  92. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.d.ts.map +1 -0
  93. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js +1029 -0
  94. package/dist/govcitizenhub/pages/intelligence/ElectionsPage.js.map +1 -0
  95. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts +5 -0
  96. package/dist/govcitizenhub/pages/intelligence/GovernancePage.d.ts.map +1 -0
  97. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js +1545 -0
  98. package/dist/govcitizenhub/pages/intelligence/GovernancePage.js.map +1 -0
  99. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts +4 -0
  100. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.d.ts.map +1 -0
  101. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js +960 -0
  102. package/dist/govcitizenhub/pages/intelligence/IndicatorCatalogPage.js.map +1 -0
  103. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts +13 -0
  104. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.d.ts.map +1 -0
  105. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js +927 -0
  106. package/dist/govcitizenhub/pages/intelligence/IndicatorsPage.js.map +1 -0
  107. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts +4 -0
  108. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.d.ts.map +1 -0
  109. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js +620 -0
  110. package/dist/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.js.map +1 -0
  111. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts +20 -0
  112. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.d.ts.map +1 -0
  113. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js +183 -0
  114. package/dist/govcitizenhub/pages/intelligence/JurisdictionLayout.js.map +1 -0
  115. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts +4 -0
  116. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.d.ts.map +1 -0
  117. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js +629 -0
  118. package/dist/govcitizenhub/pages/intelligence/JurisdictionProfilePage.js.map +1 -0
  119. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts +4 -0
  120. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.d.ts.map +1 -0
  121. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js +1124 -0
  122. package/dist/govcitizenhub/pages/intelligence/OpenDataPage.js.map +1 -0
  123. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts +4 -0
  124. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.d.ts.map +1 -0
  125. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js +1518 -0
  126. package/dist/govcitizenhub/pages/intelligence/ProjectsPage.js.map +1 -0
  127. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts +4 -0
  128. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.d.ts.map +1 -0
  129. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js +577 -0
  130. package/dist/govcitizenhub/pages/intelligence/PublicAssetsPage.js.map +1 -0
  131. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts +4 -0
  132. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.d.ts.map +1 -0
  133. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js +534 -0
  134. package/dist/govcitizenhub/pages/intelligence/ServicePerformancePage.js.map +1 -0
  135. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts +5 -0
  136. package/dist/govcitizenhub/pages/intelligence/TimelinePage.d.ts.map +1 -0
  137. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js +538 -0
  138. package/dist/govcitizenhub/pages/intelligence/TimelinePage.js.map +1 -0
  139. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts +53 -0
  140. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.d.ts.map +1 -0
  141. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js +138 -0
  142. package/dist/govcitizenhub/pages/intelligence/consultationQuestions.js.map +1 -0
  143. package/dist/govcitizenhub/pages/intelligence/index.d.ts +27 -0
  144. package/dist/govcitizenhub/pages/intelligence/index.d.ts.map +1 -0
  145. package/dist/govcitizenhub/pages/intelligence/index.js +17 -0
  146. package/dist/govcitizenhub/pages/payments/PaymentsPage.d.ts.map +1 -1
  147. package/dist/govcitizenhub/pages/payments/PaymentsPage.js +53 -49
  148. package/dist/govcitizenhub/pages/payments/PaymentsPage.js.map +1 -1
  149. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.d.ts.map +1 -1
  150. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js +82 -76
  151. package/dist/govcitizenhub/pages/permits/IssuePermitDialog.js.map +1 -1
  152. package/dist/govcitizenhub/pages/permits/PermitsPage.d.ts.map +1 -1
  153. package/dist/govcitizenhub/pages/permits/PermitsPage.js +174 -120
  154. package/dist/govcitizenhub/pages/permits/PermitsPage.js.map +1 -1
  155. package/dist/govcitizenhub/pages/services/ServiceDetailPage.js +8 -8
  156. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js +98 -98
  157. package/dist/govcitizenhub/pages/services/ServiceFormDialog.js.map +1 -1
  158. package/dist/govcitizenhub/types/index.d.ts +1 -0
  159. package/dist/govcitizenhub/types/index.d.ts.map +1 -1
  160. package/dist/govcitizenhub/types/intelligence.d.ts +1559 -0
  161. package/dist/govcitizenhub/types/intelligence.d.ts.map +1 -0
  162. package/dist/govcitizenhub/types/intelligence.js +125 -0
  163. package/dist/govcitizenhub/types/intelligence.js.map +1 -0
  164. package/dist/index.js +19 -2
  165. package/dist/node_modules/recharts/es6/chart/BarChart.js +24 -0
  166. package/dist/node_modules/recharts/es6/chart/BarChart.js.map +1 -0
  167. package/dist/utils/pageContext.d.ts +1 -0
  168. package/dist/utils/pageContext.d.ts.map +1 -1
  169. package/dist/utils/pageContext.js +44 -17
  170. package/dist/utils/pageContext.js.map +1 -1
  171. package/package.json +1 -1
@@ -0,0 +1,1545 @@
1
+ import { cn as e } from "../../utils/cn.js";
2
+ import { formatDate as t, formatNumber as n } from "../../utils/formatters.js";
3
+ import { EmptyState as r } from "../../components/EmptyState.js";
4
+ import { useGovCreateOfficial as i, useGovCreateOfficialCommitment as a, useGovDeleteOfficial as o, useGovDeleteOfficialCommitment as s, useGovOfficial as c, useGovOfficials as l, useGovUpdateOfficial as u, useGovUpdateOfficialCommitment as d } from "../../hooks/useIntelligenceApi.js";
5
+ import { useCursorPager as f } from "../../hooks/useCursorPager.js";
6
+ import { useFileUrl as p } from "../../hooks/useFiles.js";
7
+ import "../../hooks/index.js";
8
+ import { ErrorView as m, LoadingView as ee } from "../../components/StateViews.js";
9
+ import { Avatar as h } from "../../components/Avatar.js";
10
+ import { SectionCard as g } from "../../components/SectionCard.js";
11
+ import { Pagination as _ } from "../../components/Pagination.js";
12
+ import { describeError as v, notify as y } from "../../lib/toast.js";
13
+ import { GOV_COMMITMENT_STATUS_LABELS as b, GOV_INDICATOR_DOMAIN_LABELS as x, GOV_VERIFICATION_LABELS as te } from "../../types/intelligence.js";
14
+ import { JurisdictionLayout as S, VerificationChip as C } from "./JurisdictionLayout.js";
15
+ import { ConfirmDialog as w } from "../../components/ConfirmDialog.js";
16
+ import { KeyValueList as T } from "../../components/KeyValueList.js";
17
+ import { TagInput as ne } from "../../components/TagInput.js";
18
+ import { useMemo as E, useState as D } from "react";
19
+ import { BadgeCheck as re, Building2 as O, CalendarClock as ie, ExternalLink as k, FileText as ae, Gavel as A, Landmark as oe, Link2 as j, Mail as M, MapPin as se, Pencil as ce, Phone as N, Plus as P, Search as le, Target as ue, Trash2 as de, UserRound as F, Users as fe, Vote as I } from "lucide-react";
20
+ import { useParams as pe } from "react-router-dom";
21
+ import { Fragment as me, jsx as L, jsxs as R } from "react/jsx-runtime";
22
+ import { Button as z, GlassCard as B, Input as V, Label as H, ResponsiveDialog as U, ResponsiveDialogContent as W, ResponsiveDialogDescription as he, ResponsiveDialogFooter as ge, ResponsiveDialogHeader as _e, ResponsiveDialogTitle as ve, Select as G, SelectContent as K, SelectItem as q, SelectTrigger as J, SelectValue as ye, Skeleton as be, Switch as xe, Textarea as Se } from "@burdenoff/fe-libs/ui";
23
+ //#region src/govcitizenhub/pages/intelligence/GovernancePage.tsx
24
+ var Ce = 24, we = "NONE", Te = [
25
+ "ELECTED",
26
+ "ADMINISTRATIVE",
27
+ "JUDICIAL",
28
+ "ADVISORY"
29
+ ], Ee = {
30
+ ELECTED: "Elected",
31
+ ADMINISTRATIVE: "Administrative",
32
+ JUDICIAL: "Judicial",
33
+ ADVISORY: "Advisory"
34
+ }, De = {
35
+ ADMINISTRATIVE: {
36
+ title: "Administration",
37
+ icon: /* @__PURE__ */ L(O, {})
38
+ },
39
+ JUDICIAL: {
40
+ title: "Judiciary",
41
+ icon: /* @__PURE__ */ L(A, {})
42
+ },
43
+ ADVISORY: {
44
+ title: "Advisory",
45
+ icon: /* @__PURE__ */ L(fe, {})
46
+ }
47
+ }, Oe = [
48
+ "ADMINISTRATIVE",
49
+ "JUDICIAL",
50
+ "ADVISORY"
51
+ ], ke = [
52
+ "PROMISED",
53
+ "IN_PROGRESS",
54
+ "DELIVERED",
55
+ "STALLED",
56
+ "ABANDONED"
57
+ ], Ae = {
58
+ PROMISED: "bg-bg-sunken text-text-secondary",
59
+ IN_PROGRESS: "bg-status-warning-bg-subtle text-status-warning-text",
60
+ DELIVERED: "bg-status-success-bg-subtle text-status-success-text",
61
+ STALLED: "bg-status-warning-bg-subtle text-status-warning-text",
62
+ ABANDONED: "bg-status-error-bg-subtle text-status-error-text"
63
+ }, je = [
64
+ "DEMOGRAPHICS",
65
+ "ECONOMY",
66
+ "EDUCATION",
67
+ "HEALTHCARE",
68
+ "INFRASTRUCTURE",
69
+ "PUBLIC_SAFETY",
70
+ "ENVIRONMENT",
71
+ "SOCIAL_WELFARE",
72
+ "UTILITIES",
73
+ "TRANSPORT",
74
+ "HOUSING",
75
+ "GOVERNANCE",
76
+ "DIGITAL",
77
+ "TOURISM",
78
+ "FINANCE"
79
+ ], Me = [
80
+ "UNVERIFIED",
81
+ "OFFICIAL",
82
+ "COMMUNITY_VERIFIED",
83
+ "DISPUTED"
84
+ ];
85
+ function Y(e) {
86
+ return e ? /^https?:\/\//i.test(e.trim()) : !1;
87
+ }
88
+ function Ne(e) {
89
+ if (!Array.isArray(e)) return [];
90
+ let t = [];
91
+ for (let n of e) {
92
+ if (typeof n != "object" || !n || Array.isArray(n)) continue;
93
+ let e = n, r = typeof e.url == "string" ? e.url.trim() : "";
94
+ if (!Y(r)) continue;
95
+ let i = typeof e.platform == "string" ? e.platform.trim() : "";
96
+ t.push({
97
+ platform: i || r,
98
+ url: r
99
+ });
100
+ }
101
+ return t;
102
+ }
103
+ function X(e) {
104
+ if (!e) return "";
105
+ let t = new Date(e);
106
+ return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
107
+ }
108
+ function Z(e) {
109
+ if (!e) return null;
110
+ let t = new Date(e);
111
+ return Number.isNaN(t.getTime()) ? null : t.toISOString();
112
+ }
113
+ function Q(e) {
114
+ let t = e.trim();
115
+ return t === "" ? null : t;
116
+ }
117
+ function Pe(e) {
118
+ if (e.trim() === "") return null;
119
+ let t = Number(e);
120
+ return Number.isFinite(t) ? t : null;
121
+ }
122
+ function Fe(e) {
123
+ return `${n(e, { maximumFractionDigits: 1 })}%`;
124
+ }
125
+ function Ie(e) {
126
+ return !e.termStart && !e.termEnd ? null : `${e.termStart ? t(e.termStart) : "Start not published"} → ${e.termEnd ? t(e.termEnd) : "Ongoing"}`;
127
+ }
128
+ var $ = ({ label: e, percent: t, hint: n }) => {
129
+ let r = Math.min(100, Math.max(0, t));
130
+ return /* @__PURE__ */ R("div", { children: [
131
+ /* @__PURE__ */ R("div", {
132
+ className: "flex items-baseline justify-between gap-2",
133
+ children: [/* @__PURE__ */ L("span", {
134
+ className: "text-xs text-text-muted",
135
+ children: e
136
+ }), /* @__PURE__ */ L("span", {
137
+ className: "text-xs font-semibold tabular-nums text-text-primary",
138
+ children: Fe(t)
139
+ })]
140
+ }),
141
+ /* @__PURE__ */ L("div", {
142
+ className: "mt-1 h-1.5 w-full overflow-hidden rounded-full bg-bg-sunken",
143
+ role: "meter",
144
+ "aria-label": e,
145
+ "aria-valuenow": Math.round(r),
146
+ "aria-valuemin": 0,
147
+ "aria-valuemax": 100,
148
+ children: /* @__PURE__ */ L("span", {
149
+ className: "block h-full rounded-full bg-[var(--color-action-primary-bg)]",
150
+ style: { width: `${r}%` }
151
+ })
152
+ }),
153
+ n && /* @__PURE__ */ L("p", {
154
+ className: "mt-1 text-xs text-text-muted",
155
+ children: n
156
+ })
157
+ ] });
158
+ }, Le = ({ official: e }) => e.isIndependent ? /* @__PURE__ */ L("span", {
159
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
160
+ children: "Independent"
161
+ }) : e.party ? /* @__PURE__ */ L("span", {
162
+ className: "inline-flex items-center rounded-full bg-[var(--color-accent-soft)] px-2.5 py-0.5 text-xs font-medium text-action-primary-text",
163
+ children: e.party
164
+ }) : null, Re = ({ url: e, label: t }) => Y(e) ? /* @__PURE__ */ R("a", {
165
+ href: e ?? void 0,
166
+ target: "_blank",
167
+ rel: "noreferrer noopener",
168
+ className: "inline-flex items-center gap-1 text-sm font-medium text-action-primary-text underline-offset-2 hover:underline",
169
+ children: [
170
+ t,
171
+ " ",
172
+ /* @__PURE__ */ L(k, {
173
+ className: "size-3.5",
174
+ "aria-hidden": "true"
175
+ })
176
+ ]
177
+ }) : null, ze = ({ fileId: e, index: t }) => {
178
+ let { data: n, isLoading: r } = p(e);
179
+ return r ? /* @__PURE__ */ L(be, { className: "h-5 w-24 rounded" }) : Y(n) ? /* @__PURE__ */ R("a", {
180
+ href: n ?? void 0,
181
+ target: "_blank",
182
+ rel: "noreferrer noopener",
183
+ className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary hover:text-text-primary",
184
+ children: [
185
+ /* @__PURE__ */ L(ae, {
186
+ className: "size-3",
187
+ "aria-hidden": "true"
188
+ }),
189
+ " Evidence ",
190
+ t + 1
191
+ ]
192
+ }) : null;
193
+ }, Be = ({ official: n, selected: r, onSelect: i }) => {
194
+ let { data: a } = p(n.photoFileId), o = Ie(n);
195
+ return /* @__PURE__ */ R(B, {
196
+ treatment: "plain",
197
+ role: "button",
198
+ tabIndex: 0,
199
+ "aria-pressed": r,
200
+ "aria-label": `Open ${n.fullName}`,
201
+ onClick: i,
202
+ onKeyDown: (e) => {
203
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), i());
204
+ },
205
+ className: e("flex cursor-pointer flex-col p-5 outline-none transition-shadow duration-200 hover:shadow-elevation-1 focus-visible:ring-1 focus-visible:ring-border-focus", r ? "border-border-strong shadow-elevation-1" : "border-border-seam"),
206
+ children: [
207
+ /* @__PURE__ */ R("div", {
208
+ className: "flex items-start gap-3",
209
+ children: [/* @__PURE__ */ L(h, {
210
+ name: n.fullName,
211
+ src: a,
212
+ size: "lg"
213
+ }), /* @__PURE__ */ R("div", {
214
+ className: "min-w-0 flex-1",
215
+ children: [
216
+ /* @__PURE__ */ L("h3", {
217
+ className: "truncate text-base font-semibold text-text-primary",
218
+ children: n.fullName
219
+ }),
220
+ /* @__PURE__ */ L("p", {
221
+ className: "truncate text-sm text-text-secondary",
222
+ children: n.officeTitle
223
+ }),
224
+ n.department && /* @__PURE__ */ L("p", {
225
+ className: "truncate text-xs text-text-muted",
226
+ children: n.department
227
+ })
228
+ ]
229
+ })]
230
+ }),
231
+ /* @__PURE__ */ R("div", {
232
+ className: "mt-3 flex flex-wrap items-center gap-2",
233
+ children: [
234
+ /* @__PURE__ */ L(Le, { official: n }),
235
+ !n.isCurrent && /* @__PURE__ */ L("span", {
236
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
237
+ children: "Former office holder"
238
+ }),
239
+ /* @__PURE__ */ L(C, { status: n.verification })
240
+ ]
241
+ }),
242
+ (o || n.nextElectionOn) && /* @__PURE__ */ R("dl", {
243
+ className: "mt-3 space-y-1 text-xs",
244
+ children: [o && /* @__PURE__ */ R("div", {
245
+ className: "flex items-center gap-1.5 text-text-secondary",
246
+ children: [
247
+ /* @__PURE__ */ L(ie, {
248
+ className: "size-3.5 shrink-0 text-text-muted",
249
+ "aria-hidden": "true"
250
+ }),
251
+ /* @__PURE__ */ L("dt", {
252
+ className: "sr-only",
253
+ children: "Term"
254
+ }),
255
+ /* @__PURE__ */ L("dd", {
256
+ className: "truncate",
257
+ children: o
258
+ })
259
+ ]
260
+ }), n.nextElectionOn && /* @__PURE__ */ R("div", {
261
+ className: "flex items-center gap-1.5 text-text-secondary",
262
+ children: [
263
+ /* @__PURE__ */ L(I, {
264
+ className: "size-3.5 shrink-0 text-text-muted",
265
+ "aria-hidden": "true"
266
+ }),
267
+ /* @__PURE__ */ L("dt", {
268
+ className: "sr-only",
269
+ children: "Next election"
270
+ }),
271
+ /* @__PURE__ */ R("dd", {
272
+ className: "truncate",
273
+ children: ["Next election ", t(n.nextElectionOn)]
274
+ })
275
+ ]
276
+ })]
277
+ }),
278
+ (n.attendancePercent != null || n.commitmentDeliveryRate != null) && /* @__PURE__ */ R("div", {
279
+ className: "mt-4 space-y-3 border-t border-border-seam pt-3",
280
+ children: [n.attendancePercent != null && /* @__PURE__ */ L($, {
281
+ label: "Attendance",
282
+ percent: n.attendancePercent
283
+ }), n.commitmentDeliveryRate != null && /* @__PURE__ */ L($, {
284
+ label: "Commitments delivered",
285
+ percent: n.commitmentDeliveryRate
286
+ })]
287
+ })
288
+ ]
289
+ });
290
+ }, Ve = ({ commitment: n, onEdit: r, onDelete: i }) => /* @__PURE__ */ R("li", {
291
+ className: "rounded-lg border border-border-seam bg-bg-surface px-3 py-3",
292
+ children: [
293
+ /* @__PURE__ */ R("div", {
294
+ className: "flex items-start justify-between gap-2",
295
+ children: [/* @__PURE__ */ L("p", {
296
+ className: "min-w-0 text-sm font-medium text-text-primary",
297
+ children: n.title
298
+ }), /* @__PURE__ */ R("div", {
299
+ className: "flex shrink-0 items-center gap-1",
300
+ children: [/* @__PURE__ */ L(z, {
301
+ size: "sm",
302
+ variant: "ghost",
303
+ onClick: r,
304
+ "aria-label": `Edit ${n.title}`,
305
+ children: /* @__PURE__ */ L(ce, { className: "h-3.5 w-3.5" })
306
+ }), /* @__PURE__ */ L(z, {
307
+ size: "sm",
308
+ variant: "ghost",
309
+ onClick: i,
310
+ "aria-label": `Delete ${n.title}`,
311
+ children: /* @__PURE__ */ L(de, { className: "h-3.5 w-3.5" })
312
+ })]
313
+ })]
314
+ }),
315
+ /* @__PURE__ */ R("div", {
316
+ className: "mt-1.5 flex flex-wrap items-center gap-2",
317
+ children: [
318
+ /* @__PURE__ */ L("span", {
319
+ className: e("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium", Ae[n.status]),
320
+ children: b[n.status]
321
+ }),
322
+ n.isOverdue && /* @__PURE__ */ L("span", {
323
+ className: "inline-flex items-center rounded-full bg-status-error-bg-subtle px-2.5 py-0.5 text-xs font-medium text-status-error-text",
324
+ children: "Overdue"
325
+ }),
326
+ n.domain && /* @__PURE__ */ L("span", {
327
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
328
+ children: x[n.domain]
329
+ })
330
+ ]
331
+ }),
332
+ n.description && /* @__PURE__ */ L("p", {
333
+ className: "mt-2 whitespace-pre-wrap text-sm text-text-secondary",
334
+ children: n.description
335
+ }),
336
+ /* @__PURE__ */ L("div", {
337
+ className: "mt-2.5",
338
+ children: /* @__PURE__ */ L($, {
339
+ label: "Progress",
340
+ percent: n.progressPercent
341
+ })
342
+ }),
343
+ /* @__PURE__ */ R("div", {
344
+ className: "mt-2 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-text-muted",
345
+ children: [
346
+ n.promisedOn && /* @__PURE__ */ R("span", { children: ["Promised ", t(n.promisedOn)] }),
347
+ n.targetDate && /* @__PURE__ */ R("span", { children: ["Target ", t(n.targetDate)] }),
348
+ n.sourceName && /* @__PURE__ */ R("span", { children: ["Source: ", n.sourceName] })
349
+ ]
350
+ }),
351
+ (Y(n.evidenceUrl) || Y(n.sourceUrl) || n.evidenceFileIds.length > 0) && /* @__PURE__ */ R("div", {
352
+ className: "mt-2 flex flex-wrap items-center gap-3",
353
+ children: [
354
+ /* @__PURE__ */ L(Re, {
355
+ url: n.evidenceUrl,
356
+ label: "Evidence"
357
+ }),
358
+ /* @__PURE__ */ L(Re, {
359
+ url: n.sourceUrl,
360
+ label: "Source"
361
+ }),
362
+ n.evidenceFileIds.map((e, t) => /* @__PURE__ */ L(ze, {
363
+ fileId: e,
364
+ index: t
365
+ }, e))
366
+ ]
367
+ })
368
+ ]
369
+ }), He = ({ officialId: e, onEditOfficial: n, onDeleteOfficial: i, onAddCommitment: a, onEditCommitment: o, onDeleteCommitment: s }) => {
370
+ let { data: l, isLoading: u, isError: d, refetch: f } = c(e), { data: _ } = p(l?.photoFileId);
371
+ if (u) return /* @__PURE__ */ L(g, {
372
+ title: "Office holder",
373
+ icon: /* @__PURE__ */ L(F, {}),
374
+ className: "border-border-seam",
375
+ children: /* @__PURE__ */ L(ee, {
376
+ label: "Loading office holder…",
377
+ className: "min-h-[16rem]"
378
+ })
379
+ });
380
+ if (d || !l) return /* @__PURE__ */ L(g, {
381
+ title: "Office holder",
382
+ icon: /* @__PURE__ */ L(F, {}),
383
+ className: "border-border-seam",
384
+ children: /* @__PURE__ */ L(m, {
385
+ className: "min-h-[16rem]",
386
+ message: "We couldn't load this office holder.",
387
+ onRetry: () => {
388
+ f();
389
+ }
390
+ })
391
+ });
392
+ let v = Ne(l.socialProfiles), y = l.commitments ?? [], b = Ie(l), x = [];
393
+ return l.officeHours && x.push({
394
+ label: "Office hours",
395
+ value: l.officeHours
396
+ }), l.officeAddress && x.push({
397
+ label: "Office address",
398
+ value: /* @__PURE__ */ R("span", {
399
+ className: "inline-flex items-start gap-1.5",
400
+ children: [/* @__PURE__ */ L(se, {
401
+ className: "mt-0.5 size-3.5 shrink-0 text-text-muted",
402
+ "aria-hidden": "true"
403
+ }), /* @__PURE__ */ L("span", {
404
+ className: "whitespace-pre-wrap",
405
+ children: l.officeAddress
406
+ })]
407
+ })
408
+ }), l.contactEmail && x.push({
409
+ label: "Email",
410
+ value: /* @__PURE__ */ R("a", {
411
+ href: `mailto:${l.contactEmail}`,
412
+ className: "inline-flex items-center gap-1 text-action-primary-text underline-offset-2 hover:underline",
413
+ children: [
414
+ /* @__PURE__ */ L(M, {
415
+ className: "size-3.5",
416
+ "aria-hidden": "true"
417
+ }),
418
+ " ",
419
+ l.contactEmail
420
+ ]
421
+ })
422
+ }), l.contactPhone && x.push({
423
+ label: "Phone",
424
+ value: /* @__PURE__ */ R("span", {
425
+ className: "inline-flex items-center gap-1",
426
+ children: [
427
+ /* @__PURE__ */ L(N, {
428
+ className: "size-3.5 text-text-muted",
429
+ "aria-hidden": "true"
430
+ }),
431
+ " ",
432
+ l.contactPhone
433
+ ]
434
+ })
435
+ }), b && x.push({
436
+ label: "Term",
437
+ value: b
438
+ }), l.electedOn && x.push({
439
+ label: "Elected on",
440
+ value: t(l.electedOn)
441
+ }), l.nextElectionOn && x.push({
442
+ label: "Next election",
443
+ value: t(l.nextElectionOn)
444
+ }), l.sourceName && x.push({
445
+ label: "Source",
446
+ value: l.sourceName
447
+ }), /* @__PURE__ */ R("div", {
448
+ className: "space-y-4 lg:sticky lg:top-4",
449
+ children: [/* @__PURE__ */ R(g, {
450
+ title: "Office holder",
451
+ icon: /* @__PURE__ */ L(F, {}),
452
+ className: "border-border-seam",
453
+ actions: /* @__PURE__ */ R("div", {
454
+ className: "flex items-center gap-1",
455
+ children: [/* @__PURE__ */ L(z, {
456
+ size: "sm",
457
+ variant: "ghost",
458
+ onClick: () => n(l),
459
+ "aria-label": `Edit ${l.fullName}`,
460
+ children: /* @__PURE__ */ L(ce, { className: "h-4 w-4" })
461
+ }), /* @__PURE__ */ L(z, {
462
+ size: "sm",
463
+ variant: "ghost",
464
+ onClick: () => i(l),
465
+ "aria-label": `Delete ${l.fullName}`,
466
+ children: /* @__PURE__ */ L(de, { className: "h-4 w-4" })
467
+ })]
468
+ }),
469
+ children: [
470
+ /* @__PURE__ */ R("div", {
471
+ className: "flex items-start gap-3",
472
+ children: [/* @__PURE__ */ L(h, {
473
+ name: l.fullName,
474
+ src: _,
475
+ size: "lg"
476
+ }), /* @__PURE__ */ R("div", {
477
+ className: "min-w-0",
478
+ children: [
479
+ /* @__PURE__ */ L("h3", {
480
+ className: "text-base font-semibold text-text-primary",
481
+ children: l.fullName
482
+ }),
483
+ l.localName && /* @__PURE__ */ L("p", {
484
+ className: "text-sm text-text-secondary",
485
+ children: l.localName
486
+ }),
487
+ /* @__PURE__ */ L("p", {
488
+ className: "text-sm text-text-secondary",
489
+ children: l.officeTitle
490
+ }),
491
+ l.department && /* @__PURE__ */ L("p", {
492
+ className: "text-xs text-text-muted",
493
+ children: l.department
494
+ })
495
+ ]
496
+ })]
497
+ }),
498
+ /* @__PURE__ */ R("div", {
499
+ className: "mt-3 flex flex-wrap items-center gap-2",
500
+ children: [
501
+ /* @__PURE__ */ L("span", {
502
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
503
+ children: Ee[l.officeType]
504
+ }),
505
+ /* @__PURE__ */ L(Le, { official: l }),
506
+ /* @__PURE__ */ L(C, { status: l.verification })
507
+ ]
508
+ }),
509
+ (l.attendancePercent != null || l.commitmentDeliveryRate != null) && /* @__PURE__ */ R("div", {
510
+ className: "mt-4 space-y-3",
511
+ children: [l.attendancePercent != null && /* @__PURE__ */ L($, {
512
+ label: "Attendance",
513
+ percent: l.attendancePercent
514
+ }), l.commitmentDeliveryRate != null && /* @__PURE__ */ L($, {
515
+ label: "Commitments delivered",
516
+ percent: l.commitmentDeliveryRate,
517
+ hint: "Delivered as a share of all non-abandoned commitments."
518
+ })]
519
+ }),
520
+ l.biography && /* @__PURE__ */ R("div", {
521
+ className: "mt-4 border-t border-border-seam pt-3",
522
+ children: [/* @__PURE__ */ L("h4", {
523
+ className: "text-xs font-semibold uppercase tracking-wide text-text-muted",
524
+ children: "Biography"
525
+ }), /* @__PURE__ */ L("p", {
526
+ className: "mt-1.5 whitespace-pre-wrap text-sm text-text-secondary",
527
+ children: l.biography
528
+ })]
529
+ }),
530
+ l.responsibilities && /* @__PURE__ */ R("div", {
531
+ className: "mt-4 border-t border-border-seam pt-3",
532
+ children: [/* @__PURE__ */ L("h4", {
533
+ className: "text-xs font-semibold uppercase tracking-wide text-text-muted",
534
+ children: "Responsibilities"
535
+ }), /* @__PURE__ */ L("p", {
536
+ className: "mt-1.5 whitespace-pre-wrap text-sm text-text-secondary",
537
+ children: l.responsibilities
538
+ })]
539
+ }),
540
+ l.committees.length > 0 && /* @__PURE__ */ R("div", {
541
+ className: "mt-4 border-t border-border-seam pt-3",
542
+ children: [/* @__PURE__ */ L("h4", {
543
+ className: "text-xs font-semibold uppercase tracking-wide text-text-muted",
544
+ children: "Committees"
545
+ }), /* @__PURE__ */ L("ul", {
546
+ className: "mt-1.5 flex flex-wrap gap-1.5",
547
+ children: l.committees.map((e) => /* @__PURE__ */ L("li", {
548
+ className: "inline-flex items-center rounded-full bg-bg-sunken px-2.5 py-0.5 text-xs font-medium text-text-secondary",
549
+ children: e
550
+ }, e))
551
+ })]
552
+ }),
553
+ x.length > 0 && /* @__PURE__ */ L("div", {
554
+ className: "mt-4 border-t border-border-seam pt-3",
555
+ children: /* @__PURE__ */ L(T, { items: x })
556
+ }),
557
+ (v.length > 0 || Y(l.votingRecordUrl) || Y(l.sourceUrl)) && /* @__PURE__ */ R("div", {
558
+ className: "mt-4 flex flex-wrap items-center gap-3 border-t border-border-seam pt-3",
559
+ children: [
560
+ v.map((e) => /* @__PURE__ */ R("a", {
561
+ href: e.url,
562
+ target: "_blank",
563
+ rel: "noreferrer noopener",
564
+ className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-1 text-xs font-medium text-text-secondary hover:text-text-primary",
565
+ children: [
566
+ /* @__PURE__ */ L(j, {
567
+ className: "size-3",
568
+ "aria-hidden": "true"
569
+ }),
570
+ " ",
571
+ e.platform
572
+ ]
573
+ }, e.url)),
574
+ /* @__PURE__ */ L(Re, {
575
+ url: l.votingRecordUrl,
576
+ label: "Voting record"
577
+ }),
578
+ /* @__PURE__ */ L(Re, {
579
+ url: l.sourceUrl,
580
+ label: "Source"
581
+ })
582
+ ]
583
+ })
584
+ ]
585
+ }), /* @__PURE__ */ L(g, {
586
+ title: "Commitments",
587
+ icon: /* @__PURE__ */ L(ue, {}),
588
+ className: "border-border-seam",
589
+ actions: /* @__PURE__ */ L(z, {
590
+ size: "sm",
591
+ variant: "outline",
592
+ onClick: () => a(l.id),
593
+ "aria-label": "Add commitment",
594
+ children: /* @__PURE__ */ L(P, { className: "h-4 w-4" })
595
+ }),
596
+ children: y.length === 0 ? /* @__PURE__ */ L(r, {
597
+ title: "No commitments tracked yet",
598
+ description: `Nothing has been recorded against ${l.fullName}. Add the first public promise to start tracking delivery.`,
599
+ action: /* @__PURE__ */ R(z, {
600
+ onClick: () => a(l.id),
601
+ children: [/* @__PURE__ */ L(P, { className: "mr-1.5 h-4 w-4" }), " Add commitment"]
602
+ })
603
+ }) : /* @__PURE__ */ L("ul", {
604
+ className: "space-y-2.5",
605
+ children: y.map((e) => /* @__PURE__ */ L(Ve, {
606
+ commitment: e,
607
+ onEdit: () => o(e),
608
+ onDelete: () => s(e)
609
+ }, e.id))
610
+ })
611
+ })]
612
+ });
613
+ }, Ue = ({ official: e, busy: t, onCancel: n, onSubmit: r }) => {
614
+ let [i, a] = D(e?.fullName ?? ""), [o, s] = D(e?.localName ?? ""), [c, l] = D(e?.officeTitle ?? ""), [u, d] = D(e?.officeType ?? "ELECTED"), [f, p] = D(e?.department ?? ""), [m, ee] = D(e?.party ?? ""), [h, g] = D(e?.isIndependent ?? !1), [_, y] = D(e?.biography ?? ""), [b, x] = D(e?.responsibilities ?? ""), [S, C] = D(e?.committees ?? []), [w, T] = D(e?.contactEmail ?? ""), [E, re] = D(e?.contactPhone ?? ""), [O, ie] = D(e?.officeAddress ?? ""), [k, ae] = D(e?.officeHours ?? ""), [A, oe] = D(X(e?.termStart)), [j, M] = D(X(e?.termEnd)), [se, ce] = D(X(e?.electedOn)), [N, le] = D(X(e?.nextElectionOn)), [ue, F] = D(e?.attendancePercent == null ? "" : String(e.attendancePercent)), [fe, I] = D(e?.votingRecordUrl ?? ""), [pe, B] = D(() => Ne(e?.socialProfiles)), [U, W] = D(e?.isCurrent ?? !0), [be, Ce] = D(String(e?.displayOrder ?? 0)), [we, De] = D(e?.sourceName ?? ""), [Oe, ke] = D(e?.sourceUrl ?? ""), [Ae, je] = D(e?.verification ?? "UNVERIFIED"), [Y, Fe] = D(null), Ie = (e, t) => {
615
+ B((n) => n.map((n, r) => r === e ? {
616
+ ...n,
617
+ ...t
618
+ } : n));
619
+ }, $ = async () => {
620
+ if (!i.trim()) {
621
+ Fe("A full name is required.");
622
+ return;
623
+ }
624
+ if (!c.trim()) {
625
+ Fe("An office title is required.");
626
+ return;
627
+ }
628
+ let e = pe.map((e) => ({
629
+ platform: e.platform.trim(),
630
+ url: e.url.trim()
631
+ })).filter((e) => e.url !== ""), t = {
632
+ fullName: i.trim(),
633
+ localName: Q(o),
634
+ officeTitle: c.trim(),
635
+ officeType: u,
636
+ department: Q(f),
637
+ party: h ? null : Q(m),
638
+ isIndependent: h,
639
+ biography: Q(_),
640
+ responsibilities: Q(b),
641
+ committees: S,
642
+ contactEmail: Q(w),
643
+ contactPhone: Q(E),
644
+ officeAddress: Q(O),
645
+ officeHours: Q(k),
646
+ socialProfiles: e.length > 0 ? e : null,
647
+ termStart: Z(A),
648
+ termEnd: Z(j),
649
+ electedOn: Z(se),
650
+ nextElectionOn: Z(N),
651
+ attendancePercent: Pe(ue),
652
+ votingRecordUrl: Q(fe),
653
+ isCurrent: U,
654
+ displayOrder: Pe(be) ?? 0,
655
+ sourceName: Q(we),
656
+ sourceUrl: Q(Oe),
657
+ verification: Ae
658
+ };
659
+ try {
660
+ await r({
661
+ create: {
662
+ jurisdictionId: "",
663
+ ...t
664
+ },
665
+ update: t
666
+ });
667
+ } catch (e) {
668
+ Fe(v(e));
669
+ }
670
+ };
671
+ return /* @__PURE__ */ R(me, { children: [
672
+ /* @__PURE__ */ R(_e, { children: [/* @__PURE__ */ L(ve, { children: e ? "Edit office holder" : "Add an office holder" }), /* @__PURE__ */ L(he, { children: "Publish who holds this office, how they can be reached, and the provenance of the record." })] }),
673
+ /* @__PURE__ */ R("div", {
674
+ className: "flex flex-col gap-4 py-2",
675
+ children: [
676
+ /* @__PURE__ */ R("div", {
677
+ className: "grid gap-4 sm:grid-cols-2",
678
+ children: [/* @__PURE__ */ R("div", {
679
+ className: "grid gap-1.5",
680
+ children: [/* @__PURE__ */ L(H, {
681
+ htmlFor: "official-name",
682
+ children: "Full name"
683
+ }), /* @__PURE__ */ L(V, {
684
+ id: "official-name",
685
+ value: i,
686
+ onChange: (e) => a(e.target.value)
687
+ })]
688
+ }), /* @__PURE__ */ R("div", {
689
+ className: "grid gap-1.5",
690
+ children: [/* @__PURE__ */ L(H, {
691
+ htmlFor: "official-local-name",
692
+ children: "Local-language name (optional)"
693
+ }), /* @__PURE__ */ L(V, {
694
+ id: "official-local-name",
695
+ value: o,
696
+ onChange: (e) => s(e.target.value)
697
+ })]
698
+ })]
699
+ }),
700
+ /* @__PURE__ */ R("div", {
701
+ className: "grid gap-4 sm:grid-cols-2",
702
+ children: [/* @__PURE__ */ R("div", {
703
+ className: "grid gap-1.5",
704
+ children: [/* @__PURE__ */ L(H, {
705
+ htmlFor: "official-title",
706
+ children: "Office title"
707
+ }), /* @__PURE__ */ L(V, {
708
+ id: "official-title",
709
+ value: c,
710
+ onChange: (e) => l(e.target.value)
711
+ })]
712
+ }), /* @__PURE__ */ R("div", {
713
+ className: "grid gap-1.5",
714
+ children: [/* @__PURE__ */ L(H, { children: "Office type" }), /* @__PURE__ */ R(G, {
715
+ value: u,
716
+ onValueChange: (e) => d(e),
717
+ children: [/* @__PURE__ */ L(J, {
718
+ "aria-label": "Office type",
719
+ children: /* @__PURE__ */ L(ye, {})
720
+ }), /* @__PURE__ */ L(K, { children: Te.map((e) => /* @__PURE__ */ L(q, {
721
+ value: e,
722
+ children: Ee[e]
723
+ }, e)) })]
724
+ })]
725
+ })]
726
+ }),
727
+ /* @__PURE__ */ R("div", {
728
+ className: "grid gap-4 sm:grid-cols-2",
729
+ children: [/* @__PURE__ */ R("div", {
730
+ className: "grid gap-1.5",
731
+ children: [/* @__PURE__ */ L(H, {
732
+ htmlFor: "official-department",
733
+ children: "Department (optional)"
734
+ }), /* @__PURE__ */ L(V, {
735
+ id: "official-department",
736
+ value: f,
737
+ onChange: (e) => p(e.target.value)
738
+ })]
739
+ }), /* @__PURE__ */ R("div", {
740
+ className: "grid gap-1.5",
741
+ children: [/* @__PURE__ */ L(H, {
742
+ htmlFor: "official-party",
743
+ children: "Party (optional)"
744
+ }), /* @__PURE__ */ L(V, {
745
+ id: "official-party",
746
+ value: m,
747
+ disabled: h,
748
+ placeholder: h ? "Independent" : void 0,
749
+ onChange: (e) => ee(e.target.value)
750
+ })]
751
+ })]
752
+ }),
753
+ /* @__PURE__ */ R("div", {
754
+ className: "flex flex-wrap items-center gap-6",
755
+ children: [/* @__PURE__ */ R("div", {
756
+ className: "flex items-center gap-2",
757
+ children: [/* @__PURE__ */ L(xe, {
758
+ id: "official-independent",
759
+ checked: h,
760
+ onCheckedChange: g
761
+ }), /* @__PURE__ */ L(H, {
762
+ htmlFor: "official-independent",
763
+ children: "Independent"
764
+ })]
765
+ }), /* @__PURE__ */ R("div", {
766
+ className: "flex items-center gap-2",
767
+ children: [/* @__PURE__ */ L(xe, {
768
+ id: "official-current",
769
+ checked: U,
770
+ onCheckedChange: W
771
+ }), /* @__PURE__ */ L(H, {
772
+ htmlFor: "official-current",
773
+ children: "Currently in office"
774
+ })]
775
+ })]
776
+ }),
777
+ /* @__PURE__ */ R("div", {
778
+ className: "grid gap-1.5",
779
+ children: [/* @__PURE__ */ L(H, {
780
+ htmlFor: "official-bio",
781
+ children: "Biography (optional)"
782
+ }), /* @__PURE__ */ L(Se, {
783
+ id: "official-bio",
784
+ rows: 3,
785
+ value: _,
786
+ onChange: (e) => y(e.target.value)
787
+ })]
788
+ }),
789
+ /* @__PURE__ */ R("div", {
790
+ className: "grid gap-1.5",
791
+ children: [/* @__PURE__ */ L(H, {
792
+ htmlFor: "official-responsibilities",
793
+ children: "Responsibilities (optional)"
794
+ }), /* @__PURE__ */ L(Se, {
795
+ id: "official-responsibilities",
796
+ rows: 2,
797
+ value: b,
798
+ onChange: (e) => x(e.target.value)
799
+ })]
800
+ }),
801
+ /* @__PURE__ */ R("div", {
802
+ className: "grid gap-1.5",
803
+ children: [/* @__PURE__ */ L(H, {
804
+ htmlFor: "official-committees",
805
+ children: "Committees"
806
+ }), /* @__PURE__ */ L(ne, {
807
+ id: "official-committees",
808
+ value: S,
809
+ onChange: C,
810
+ placeholder: "Add a committee…"
811
+ })]
812
+ }),
813
+ /* @__PURE__ */ R("div", {
814
+ className: "grid gap-4 sm:grid-cols-2",
815
+ children: [/* @__PURE__ */ R("div", {
816
+ className: "grid gap-1.5",
817
+ children: [/* @__PURE__ */ L(H, {
818
+ htmlFor: "official-email",
819
+ children: "Contact email (optional)"
820
+ }), /* @__PURE__ */ L(V, {
821
+ id: "official-email",
822
+ type: "email",
823
+ value: w,
824
+ onChange: (e) => T(e.target.value)
825
+ })]
826
+ }), /* @__PURE__ */ R("div", {
827
+ className: "grid gap-1.5",
828
+ children: [/* @__PURE__ */ L(H, {
829
+ htmlFor: "official-phone",
830
+ children: "Contact phone (optional)"
831
+ }), /* @__PURE__ */ L(V, {
832
+ id: "official-phone",
833
+ value: E,
834
+ onChange: (e) => re(e.target.value)
835
+ })]
836
+ })]
837
+ }),
838
+ /* @__PURE__ */ R("div", {
839
+ className: "grid gap-4 sm:grid-cols-2",
840
+ children: [/* @__PURE__ */ R("div", {
841
+ className: "grid gap-1.5",
842
+ children: [/* @__PURE__ */ L(H, {
843
+ htmlFor: "official-hours",
844
+ children: "Office hours (optional)"
845
+ }), /* @__PURE__ */ L(V, {
846
+ id: "official-hours",
847
+ value: k,
848
+ onChange: (e) => ae(e.target.value)
849
+ })]
850
+ }), /* @__PURE__ */ R("div", {
851
+ className: "grid gap-1.5",
852
+ children: [/* @__PURE__ */ L(H, {
853
+ htmlFor: "official-order",
854
+ children: "Display order"
855
+ }), /* @__PURE__ */ L(V, {
856
+ id: "official-order",
857
+ type: "number",
858
+ value: be,
859
+ onChange: (e) => Ce(e.target.value)
860
+ })]
861
+ })]
862
+ }),
863
+ /* @__PURE__ */ R("div", {
864
+ className: "grid gap-1.5",
865
+ children: [/* @__PURE__ */ L(H, {
866
+ htmlFor: "official-address",
867
+ children: "Office address (optional)"
868
+ }), /* @__PURE__ */ L(Se, {
869
+ id: "official-address",
870
+ rows: 2,
871
+ value: O,
872
+ onChange: (e) => ie(e.target.value)
873
+ })]
874
+ }),
875
+ /* @__PURE__ */ R("div", {
876
+ className: "grid gap-4 sm:grid-cols-2",
877
+ children: [
878
+ /* @__PURE__ */ R("div", {
879
+ className: "grid gap-1.5",
880
+ children: [/* @__PURE__ */ L(H, {
881
+ htmlFor: "official-term-start",
882
+ children: "Term start (optional)"
883
+ }), /* @__PURE__ */ L(V, {
884
+ id: "official-term-start",
885
+ type: "date",
886
+ value: A,
887
+ onChange: (e) => oe(e.target.value)
888
+ })]
889
+ }),
890
+ /* @__PURE__ */ R("div", {
891
+ className: "grid gap-1.5",
892
+ children: [/* @__PURE__ */ L(H, {
893
+ htmlFor: "official-term-end",
894
+ children: "Term end (optional)"
895
+ }), /* @__PURE__ */ L(V, {
896
+ id: "official-term-end",
897
+ type: "date",
898
+ value: j,
899
+ onChange: (e) => M(e.target.value)
900
+ })]
901
+ }),
902
+ /* @__PURE__ */ R("div", {
903
+ className: "grid gap-1.5",
904
+ children: [/* @__PURE__ */ L(H, {
905
+ htmlFor: "official-elected-on",
906
+ children: "Elected on (optional)"
907
+ }), /* @__PURE__ */ L(V, {
908
+ id: "official-elected-on",
909
+ type: "date",
910
+ value: se,
911
+ onChange: (e) => ce(e.target.value)
912
+ })]
913
+ }),
914
+ /* @__PURE__ */ R("div", {
915
+ className: "grid gap-1.5",
916
+ children: [/* @__PURE__ */ L(H, {
917
+ htmlFor: "official-next-election",
918
+ children: "Next election (optional)"
919
+ }), /* @__PURE__ */ L(V, {
920
+ id: "official-next-election",
921
+ type: "date",
922
+ value: N,
923
+ onChange: (e) => le(e.target.value)
924
+ })]
925
+ })
926
+ ]
927
+ }),
928
+ /* @__PURE__ */ R("div", {
929
+ className: "grid gap-4 sm:grid-cols-2",
930
+ children: [/* @__PURE__ */ R("div", {
931
+ className: "grid gap-1.5",
932
+ children: [/* @__PURE__ */ L(H, {
933
+ htmlFor: "official-attendance",
934
+ children: "Published attendance % (optional)"
935
+ }), /* @__PURE__ */ L(V, {
936
+ id: "official-attendance",
937
+ type: "number",
938
+ min: "0",
939
+ max: "100",
940
+ step: "0.1",
941
+ value: ue,
942
+ onChange: (e) => F(e.target.value)
943
+ })]
944
+ }), /* @__PURE__ */ R("div", {
945
+ className: "grid gap-1.5",
946
+ children: [/* @__PURE__ */ L(H, {
947
+ htmlFor: "official-voting-record",
948
+ children: "Voting-record URL (optional)"
949
+ }), /* @__PURE__ */ L(V, {
950
+ id: "official-voting-record",
951
+ value: fe,
952
+ placeholder: "https://",
953
+ onChange: (e) => I(e.target.value)
954
+ })]
955
+ })]
956
+ }),
957
+ /* @__PURE__ */ R("div", {
958
+ className: "grid gap-1.5",
959
+ children: [/* @__PURE__ */ L(H, { children: "Social profiles (optional)" }), /* @__PURE__ */ R("div", {
960
+ className: "space-y-2",
961
+ children: [pe.map((e, t) => /* @__PURE__ */ R("div", {
962
+ className: "flex flex-wrap items-center gap-2",
963
+ children: [
964
+ /* @__PURE__ */ L(V, {
965
+ className: "w-full sm:w-40",
966
+ value: e.platform,
967
+ placeholder: "Platform",
968
+ "aria-label": `Social platform ${t + 1}`,
969
+ onChange: (e) => Ie(t, { platform: e.target.value })
970
+ }),
971
+ /* @__PURE__ */ L(V, {
972
+ className: "w-full flex-1 sm:w-auto",
973
+ value: e.url,
974
+ placeholder: "https://",
975
+ "aria-label": `Social URL ${t + 1}`,
976
+ onChange: (e) => Ie(t, { url: e.target.value })
977
+ }),
978
+ /* @__PURE__ */ L(z, {
979
+ type: "button",
980
+ size: "sm",
981
+ variant: "ghost",
982
+ "aria-label": `Remove social profile ${t + 1}`,
983
+ onClick: () => B((e) => e.filter((e, n) => n !== t)),
984
+ children: /* @__PURE__ */ L(de, { className: "h-4 w-4" })
985
+ })
986
+ ]
987
+ }, t)), /* @__PURE__ */ R(z, {
988
+ type: "button",
989
+ size: "sm",
990
+ variant: "outline",
991
+ onClick: () => B((e) => [...e, {
992
+ platform: "",
993
+ url: ""
994
+ }]),
995
+ children: [/* @__PURE__ */ L(P, { className: "mr-1.5 h-4 w-4" }), " Add profile"]
996
+ })]
997
+ })]
998
+ }),
999
+ /* @__PURE__ */ R("div", {
1000
+ className: "grid gap-4 sm:grid-cols-2",
1001
+ children: [/* @__PURE__ */ R("div", {
1002
+ className: "grid gap-1.5",
1003
+ children: [/* @__PURE__ */ L(H, {
1004
+ htmlFor: "official-source-name",
1005
+ children: "Source name (optional)"
1006
+ }), /* @__PURE__ */ L(V, {
1007
+ id: "official-source-name",
1008
+ value: we,
1009
+ onChange: (e) => De(e.target.value)
1010
+ })]
1011
+ }), /* @__PURE__ */ R("div", {
1012
+ className: "grid gap-1.5",
1013
+ children: [/* @__PURE__ */ L(H, {
1014
+ htmlFor: "official-source-url",
1015
+ children: "Source URL (optional)"
1016
+ }), /* @__PURE__ */ L(V, {
1017
+ id: "official-source-url",
1018
+ value: Oe,
1019
+ placeholder: "https://",
1020
+ onChange: (e) => ke(e.target.value)
1021
+ })]
1022
+ })]
1023
+ }),
1024
+ /* @__PURE__ */ R("div", {
1025
+ className: "grid gap-1.5",
1026
+ children: [/* @__PURE__ */ L(H, { children: "Provenance" }), /* @__PURE__ */ R(G, {
1027
+ value: Ae,
1028
+ onValueChange: (e) => je(e),
1029
+ children: [/* @__PURE__ */ L(J, {
1030
+ "aria-label": "Provenance",
1031
+ children: /* @__PURE__ */ L(ye, {})
1032
+ }), /* @__PURE__ */ L(K, { children: Me.map((e) => /* @__PURE__ */ L(q, {
1033
+ value: e,
1034
+ children: te[e]
1035
+ }, e)) })]
1036
+ })]
1037
+ }),
1038
+ Y && /* @__PURE__ */ L("p", {
1039
+ className: "text-sm text-status-error-text",
1040
+ children: Y
1041
+ })
1042
+ ]
1043
+ }),
1044
+ /* @__PURE__ */ R(ge, { children: [/* @__PURE__ */ L(z, {
1045
+ variant: "outline",
1046
+ onClick: n,
1047
+ disabled: t,
1048
+ children: "Cancel"
1049
+ }), /* @__PURE__ */ L(z, {
1050
+ onClick: () => {
1051
+ $();
1052
+ },
1053
+ disabled: t,
1054
+ children: e ? "Save changes" : "Add office holder"
1055
+ })] })
1056
+ ] });
1057
+ }, We = ({ open: e, onOpenChange: t, jurisdictionId: n, official: r, onSaved: a }) => {
1058
+ let o = i(), s = u(), c = o.isPending || s.isPending;
1059
+ return /* @__PURE__ */ L(U, {
1060
+ open: e,
1061
+ onOpenChange: (e) => c ? void 0 : t(e),
1062
+ children: /* @__PURE__ */ L(W, {
1063
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-2xl",
1064
+ children: e && /* @__PURE__ */ L(Ue, {
1065
+ official: r,
1066
+ busy: c,
1067
+ onCancel: () => t(!1),
1068
+ onSubmit: async ({ create: e, update: i }) => {
1069
+ if (r) {
1070
+ let e = await s.mutateAsync({
1071
+ id: r.id,
1072
+ input: i
1073
+ });
1074
+ y.success("Office holder updated", e.fullName), a(e);
1075
+ } else {
1076
+ let t = await o.mutateAsync({
1077
+ ...e,
1078
+ jurisdictionId: n
1079
+ });
1080
+ y.success("Office holder added", t.fullName), a(t);
1081
+ }
1082
+ t(!1);
1083
+ }
1084
+ })
1085
+ })
1086
+ });
1087
+ }, Ge = ({ commitment: e, busy: t, onCancel: n, onSubmit: r }) => {
1088
+ let [i, a] = D(e?.title ?? ""), [o, s] = D(e?.description ?? ""), [c, l] = D(e?.domain ?? we), [u, d] = D(e?.status ?? "PROMISED"), [f, p] = D(String(e?.progressPercent ?? 0)), [m, ee] = D(X(e?.promisedOn)), [h, g] = D(X(e?.targetDate)), [_, y] = D(e?.evidenceUrl ?? ""), [S, C] = D(e?.sourceName ?? ""), [w, T] = D(e?.sourceUrl ?? ""), [ne, E] = D(e?.verification ?? "UNVERIFIED"), [re, O] = D(null), ie = async () => {
1089
+ if (!i.trim()) {
1090
+ O("A commitment title is required.");
1091
+ return;
1092
+ }
1093
+ let e = Pe(f) ?? 0;
1094
+ if (e < 0 || e > 100) {
1095
+ O("Progress must be between 0 and 100.");
1096
+ return;
1097
+ }
1098
+ let t = {
1099
+ title: i.trim(),
1100
+ description: Q(o),
1101
+ domain: c === we ? null : c,
1102
+ status: u,
1103
+ progressPercent: Math.round(e),
1104
+ promisedOn: Z(m),
1105
+ targetDate: Z(h),
1106
+ evidenceUrl: Q(_),
1107
+ sourceName: Q(S),
1108
+ sourceUrl: Q(w),
1109
+ verification: ne
1110
+ };
1111
+ try {
1112
+ await r({
1113
+ create: {
1114
+ officialId: "",
1115
+ ...t
1116
+ },
1117
+ update: t
1118
+ });
1119
+ } catch (e) {
1120
+ O(v(e));
1121
+ }
1122
+ };
1123
+ return /* @__PURE__ */ R(me, { children: [
1124
+ /* @__PURE__ */ R(_e, { children: [/* @__PURE__ */ L(ve, { children: e ? "Edit commitment" : "Add a commitment" }), /* @__PURE__ */ L(he, { children: "Track a public promise from the moment it is made to the evidence that it was delivered." })] }),
1125
+ /* @__PURE__ */ R("div", {
1126
+ className: "flex flex-col gap-4 py-2",
1127
+ children: [
1128
+ /* @__PURE__ */ R("div", {
1129
+ className: "grid gap-1.5",
1130
+ children: [/* @__PURE__ */ L(H, {
1131
+ htmlFor: "commitment-title",
1132
+ children: "Title"
1133
+ }), /* @__PURE__ */ L(V, {
1134
+ id: "commitment-title",
1135
+ value: i,
1136
+ onChange: (e) => a(e.target.value)
1137
+ })]
1138
+ }),
1139
+ /* @__PURE__ */ R("div", {
1140
+ className: "grid gap-1.5",
1141
+ children: [/* @__PURE__ */ L(H, {
1142
+ htmlFor: "commitment-description",
1143
+ children: "Description (optional)"
1144
+ }), /* @__PURE__ */ L(Se, {
1145
+ id: "commitment-description",
1146
+ rows: 3,
1147
+ value: o,
1148
+ onChange: (e) => s(e.target.value)
1149
+ })]
1150
+ }),
1151
+ /* @__PURE__ */ R("div", {
1152
+ className: "grid gap-4 sm:grid-cols-2",
1153
+ children: [/* @__PURE__ */ R("div", {
1154
+ className: "grid gap-1.5",
1155
+ children: [/* @__PURE__ */ L(H, { children: "Domain" }), /* @__PURE__ */ R(G, {
1156
+ value: c,
1157
+ onValueChange: l,
1158
+ children: [/* @__PURE__ */ L(J, {
1159
+ "aria-label": "Domain",
1160
+ children: /* @__PURE__ */ L(ye, {})
1161
+ }), /* @__PURE__ */ R(K, { children: [/* @__PURE__ */ L(q, {
1162
+ value: we,
1163
+ children: "No domain"
1164
+ }), je.map((e) => /* @__PURE__ */ L(q, {
1165
+ value: e,
1166
+ children: x[e]
1167
+ }, e))] })]
1168
+ })]
1169
+ }), /* @__PURE__ */ R("div", {
1170
+ className: "grid gap-1.5",
1171
+ children: [/* @__PURE__ */ L(H, { children: "Status" }), /* @__PURE__ */ R(G, {
1172
+ value: u,
1173
+ onValueChange: (e) => d(e),
1174
+ children: [/* @__PURE__ */ L(J, {
1175
+ "aria-label": "Status",
1176
+ children: /* @__PURE__ */ L(ye, {})
1177
+ }), /* @__PURE__ */ L(K, { children: ke.map((e) => /* @__PURE__ */ L(q, {
1178
+ value: e,
1179
+ children: b[e]
1180
+ }, e)) })]
1181
+ })]
1182
+ })]
1183
+ }),
1184
+ /* @__PURE__ */ R("div", {
1185
+ className: "grid gap-4 sm:grid-cols-3",
1186
+ children: [
1187
+ /* @__PURE__ */ R("div", {
1188
+ className: "grid gap-1.5",
1189
+ children: [/* @__PURE__ */ L(H, {
1190
+ htmlFor: "commitment-progress",
1191
+ children: "Progress %"
1192
+ }), /* @__PURE__ */ L(V, {
1193
+ id: "commitment-progress",
1194
+ type: "number",
1195
+ min: "0",
1196
+ max: "100",
1197
+ value: f,
1198
+ onChange: (e) => p(e.target.value)
1199
+ })]
1200
+ }),
1201
+ /* @__PURE__ */ R("div", {
1202
+ className: "grid gap-1.5",
1203
+ children: [/* @__PURE__ */ L(H, {
1204
+ htmlFor: "commitment-promised",
1205
+ children: "Promised on (optional)"
1206
+ }), /* @__PURE__ */ L(V, {
1207
+ id: "commitment-promised",
1208
+ type: "date",
1209
+ value: m,
1210
+ onChange: (e) => ee(e.target.value)
1211
+ })]
1212
+ }),
1213
+ /* @__PURE__ */ R("div", {
1214
+ className: "grid gap-1.5",
1215
+ children: [/* @__PURE__ */ L(H, {
1216
+ htmlFor: "commitment-target",
1217
+ children: "Target date (optional)"
1218
+ }), /* @__PURE__ */ L(V, {
1219
+ id: "commitment-target",
1220
+ type: "date",
1221
+ value: h,
1222
+ onChange: (e) => g(e.target.value)
1223
+ })]
1224
+ })
1225
+ ]
1226
+ }),
1227
+ /* @__PURE__ */ R("div", {
1228
+ className: "grid gap-1.5",
1229
+ children: [/* @__PURE__ */ L(H, {
1230
+ htmlFor: "commitment-evidence",
1231
+ children: "Evidence URL (optional)"
1232
+ }), /* @__PURE__ */ L(V, {
1233
+ id: "commitment-evidence",
1234
+ value: _,
1235
+ placeholder: "https://",
1236
+ onChange: (e) => y(e.target.value)
1237
+ })]
1238
+ }),
1239
+ /* @__PURE__ */ R("div", {
1240
+ className: "grid gap-4 sm:grid-cols-2",
1241
+ children: [/* @__PURE__ */ R("div", {
1242
+ className: "grid gap-1.5",
1243
+ children: [/* @__PURE__ */ L(H, {
1244
+ htmlFor: "commitment-source-name",
1245
+ children: "Source name (optional)"
1246
+ }), /* @__PURE__ */ L(V, {
1247
+ id: "commitment-source-name",
1248
+ value: S,
1249
+ onChange: (e) => C(e.target.value)
1250
+ })]
1251
+ }), /* @__PURE__ */ R("div", {
1252
+ className: "grid gap-1.5",
1253
+ children: [/* @__PURE__ */ L(H, {
1254
+ htmlFor: "commitment-source-url",
1255
+ children: "Source URL (optional)"
1256
+ }), /* @__PURE__ */ L(V, {
1257
+ id: "commitment-source-url",
1258
+ value: w,
1259
+ placeholder: "https://",
1260
+ onChange: (e) => T(e.target.value)
1261
+ })]
1262
+ })]
1263
+ }),
1264
+ /* @__PURE__ */ R("div", {
1265
+ className: "grid gap-1.5",
1266
+ children: [/* @__PURE__ */ L(H, { children: "Provenance" }), /* @__PURE__ */ R(G, {
1267
+ value: ne,
1268
+ onValueChange: (e) => E(e),
1269
+ children: [/* @__PURE__ */ L(J, {
1270
+ "aria-label": "Provenance",
1271
+ children: /* @__PURE__ */ L(ye, {})
1272
+ }), /* @__PURE__ */ L(K, { children: Me.map((e) => /* @__PURE__ */ L(q, {
1273
+ value: e,
1274
+ children: te[e]
1275
+ }, e)) })]
1276
+ })]
1277
+ }),
1278
+ re && /* @__PURE__ */ L("p", {
1279
+ className: "text-sm text-status-error-text",
1280
+ children: re
1281
+ })
1282
+ ]
1283
+ }),
1284
+ /* @__PURE__ */ R(ge, { children: [/* @__PURE__ */ L(z, {
1285
+ variant: "outline",
1286
+ onClick: n,
1287
+ disabled: t,
1288
+ children: "Cancel"
1289
+ }), /* @__PURE__ */ L(z, {
1290
+ onClick: () => {
1291
+ ie();
1292
+ },
1293
+ disabled: t,
1294
+ children: e ? "Save changes" : "Add commitment"
1295
+ })] })
1296
+ ] });
1297
+ }, Ke = ({ open: e, onOpenChange: t, officialId: n, commitment: r }) => {
1298
+ let i = a(), o = d(), s = i.isPending || o.isPending;
1299
+ return /* @__PURE__ */ L(U, {
1300
+ open: e,
1301
+ onOpenChange: (e) => s ? void 0 : t(e),
1302
+ children: /* @__PURE__ */ L(W, {
1303
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-xl",
1304
+ children: e && /* @__PURE__ */ L(Ge, {
1305
+ commitment: r,
1306
+ busy: s,
1307
+ onCancel: () => t(!1),
1308
+ onSubmit: async ({ create: e, update: a }) => {
1309
+ if (r) {
1310
+ let e = await o.mutateAsync({
1311
+ id: r.id,
1312
+ input: a
1313
+ });
1314
+ y.success("Commitment updated", e.title);
1315
+ } else {
1316
+ let t = await i.mutateAsync({
1317
+ ...e,
1318
+ officialId: n
1319
+ });
1320
+ y.success("Commitment added", t.title);
1321
+ }
1322
+ t(!1);
1323
+ }
1324
+ })
1325
+ })
1326
+ });
1327
+ }, qe = ({ title: e, icon: t, caption: n, officials: r, selectedId: i, onSelect: a }) => /* @__PURE__ */ R("section", { children: [/* @__PURE__ */ R("div", {
1328
+ className: "mb-3 flex items-center gap-2.5",
1329
+ children: [/* @__PURE__ */ L("span", {
1330
+ className: "inline-flex size-8 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary [&>svg]:size-4",
1331
+ children: t
1332
+ }), /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("h2", {
1333
+ className: "text-base font-semibold text-text-primary",
1334
+ children: e
1335
+ }), n && /* @__PURE__ */ L("p", {
1336
+ className: "text-xs text-text-muted",
1337
+ children: n
1338
+ })] })]
1339
+ }), /* @__PURE__ */ L("div", {
1340
+ className: "grid gap-4 sm:grid-cols-2",
1341
+ children: r.map((e) => /* @__PURE__ */ L(Be, {
1342
+ official: e,
1343
+ selected: e.id === i,
1344
+ onSelect: () => a(e.id)
1345
+ }, e.id))
1346
+ })] });
1347
+ function Je() {
1348
+ let { jurisdictionId: t } = pe(), n = f(), [i, a] = D(""), [c, u] = D(!0), [d, p] = D(null), [h, b] = D(!1), [x, te] = D(null), [C, T] = D(null), [ne, O] = D(!1), [ie, k] = D(""), [ae, A] = D(null), [j, M] = D(null), se = o(), ce = s(), { data: N, isLoading: ue, isError: de, refetch: fe } = l({
1349
+ jurisdictionId: t,
1350
+ isCurrent: c ? !0 : void 0,
1351
+ search: i.trim() || void 0
1352
+ }, {
1353
+ limit: Ce,
1354
+ cursor: n.cursor
1355
+ }), I = E(() => N?.items ?? [], [N]), me = E(() => I.filter((e) => e.officeType === "ELECTED"), [I]), B = E(() => Oe.map((e) => ({
1356
+ type: e,
1357
+ items: I.filter((t) => t.officeType === e)
1358
+ })).filter((e) => e.items.length > 0), [I]), U = () => {
1359
+ n.reset(), p(null);
1360
+ }, W = () => {
1361
+ te(null), b(!0);
1362
+ };
1363
+ return /* @__PURE__ */ R(S, {
1364
+ description: "Elected representatives, administrative officials and the promises they are held to.",
1365
+ actions: /* @__PURE__ */ R(z, {
1366
+ onClick: W,
1367
+ children: [/* @__PURE__ */ L(P, { className: "mr-1.5 h-4 w-4" }), " Add office holder"]
1368
+ }),
1369
+ children: [
1370
+ /* @__PURE__ */ R("div", {
1371
+ className: "mb-5 flex flex-col gap-3 sm:flex-row sm:items-center",
1372
+ children: [/* @__PURE__ */ R("div", {
1373
+ className: "relative flex-1",
1374
+ children: [/* @__PURE__ */ L(le, {
1375
+ className: "pointer-events-none absolute left-3.5 top-1/2 size-4 -translate-y-1/2 text-text-muted",
1376
+ "aria-hidden": "true"
1377
+ }), /* @__PURE__ */ L(V, {
1378
+ value: i,
1379
+ onChange: (e) => {
1380
+ a(e.target.value), U();
1381
+ },
1382
+ placeholder: "Search by name, office or party…",
1383
+ "aria-label": "Search office holders",
1384
+ className: "h-11 pl-10"
1385
+ })]
1386
+ }), /* @__PURE__ */ R("div", {
1387
+ className: "flex items-center gap-2",
1388
+ children: [/* @__PURE__ */ L(xe, {
1389
+ id: "governance-current-only",
1390
+ checked: c,
1391
+ onCheckedChange: (e) => {
1392
+ u(e), U();
1393
+ }
1394
+ }), /* @__PURE__ */ L(H, {
1395
+ htmlFor: "governance-current-only",
1396
+ className: "whitespace-nowrap",
1397
+ children: "Currently in office only"
1398
+ })]
1399
+ })]
1400
+ }),
1401
+ /* @__PURE__ */ R("div", {
1402
+ className: "grid gap-4 lg:grid-cols-3",
1403
+ children: [/* @__PURE__ */ L("div", {
1404
+ className: "lg:col-span-2",
1405
+ children: ue ? /* @__PURE__ */ L(ee, { label: "Loading office holders…" }) : de ? /* @__PURE__ */ L(m, {
1406
+ message: "We couldn't load the office holders for this jurisdiction.",
1407
+ onRetry: () => {
1408
+ fe();
1409
+ }
1410
+ }) : I.length === 0 ? /* @__PURE__ */ L(r, {
1411
+ illustration: "empty-people",
1412
+ title: "No office holders published yet",
1413
+ description: i.trim() ? `No office holder on this page matches “${i.trim()}”.` : c ? "Nobody is recorded as currently in office. Add the first office holder, or include former holders." : "Add the first elected representative or administrative official for this jurisdiction.",
1414
+ action: i.trim() ? /* @__PURE__ */ L(z, {
1415
+ variant: "outline",
1416
+ onClick: () => a(""),
1417
+ children: "Clear search"
1418
+ }) : /* @__PURE__ */ R(z, {
1419
+ onClick: W,
1420
+ children: [/* @__PURE__ */ L(P, { className: "mr-1.5 h-4 w-4" }), " Add office holder"]
1421
+ })
1422
+ }) : /* @__PURE__ */ R("div", {
1423
+ className: "space-y-8",
1424
+ children: [
1425
+ me.length > 0 && /* @__PURE__ */ L(qe, {
1426
+ title: "Elected representatives",
1427
+ icon: /* @__PURE__ */ L(oe, {}),
1428
+ caption: "Office holders returned at an election.",
1429
+ officials: me,
1430
+ selectedId: d,
1431
+ onSelect: p
1432
+ }),
1433
+ B.length > 0 && /* @__PURE__ */ R("section", { children: [/* @__PURE__ */ R("div", {
1434
+ className: "mb-4 flex items-center gap-2.5",
1435
+ children: [/* @__PURE__ */ L("span", {
1436
+ className: "inline-flex size-8 shrink-0 items-center justify-center rounded-lg bg-bg-sunken text-text-secondary [&>svg]:size-4",
1437
+ children: /* @__PURE__ */ L(re, {})
1438
+ }), /* @__PURE__ */ R("div", { children: [/* @__PURE__ */ L("h2", {
1439
+ className: "text-base font-semibold text-text-primary",
1440
+ children: "Administrative officials"
1441
+ }), /* @__PURE__ */ L("p", {
1442
+ className: "text-xs text-text-muted",
1443
+ children: "Appointed office holders, grouped by the nature of the appointment."
1444
+ })] })]
1445
+ }), /* @__PURE__ */ L("div", {
1446
+ className: "space-y-6",
1447
+ children: B.map((e) => /* @__PURE__ */ L(qe, {
1448
+ title: De[e.type].title,
1449
+ icon: De[e.type].icon,
1450
+ officials: e.items,
1451
+ selectedId: d,
1452
+ onSelect: p
1453
+ }, e.type))
1454
+ })] }),
1455
+ /* @__PURE__ */ L(_, {
1456
+ page: n.page,
1457
+ pageSize: Ce,
1458
+ itemCount: I.length,
1459
+ hasMore: N?.pageInfo.hasMore ?? !1,
1460
+ onPageChange: (e) => {
1461
+ n.onPageChange(e, N?.pageInfo.cursor), p(null);
1462
+ }
1463
+ })
1464
+ ]
1465
+ })
1466
+ }), /* @__PURE__ */ L("div", {
1467
+ className: e("lg:col-span-1", d ? "order-first lg:order-none" : void 0),
1468
+ children: d ? /* @__PURE__ */ L(He, {
1469
+ officialId: d,
1470
+ onEditOfficial: (e) => {
1471
+ te(e), b(!0);
1472
+ },
1473
+ onDeleteOfficial: T,
1474
+ onAddCommitment: (e) => {
1475
+ k(e), A(null), O(!0);
1476
+ },
1477
+ onEditCommitment: (e) => {
1478
+ k(e.officialId), A(e), O(!0);
1479
+ },
1480
+ onDeleteCommitment: M
1481
+ }) : /* @__PURE__ */ L(g, {
1482
+ title: "Office holder",
1483
+ icon: /* @__PURE__ */ L(F, {}),
1484
+ className: "border-border-seam",
1485
+ children: /* @__PURE__ */ L("p", {
1486
+ className: "text-sm text-text-secondary",
1487
+ children: "Select an office holder to read their biography, responsibilities, committees, contact details and tracked commitments."
1488
+ })
1489
+ })
1490
+ })]
1491
+ }),
1492
+ t && /* @__PURE__ */ L(We, {
1493
+ open: h,
1494
+ onOpenChange: b,
1495
+ jurisdictionId: t,
1496
+ official: x,
1497
+ onSaved: (e) => p(e.id)
1498
+ }),
1499
+ /* @__PURE__ */ L(Ke, {
1500
+ open: ne,
1501
+ onOpenChange: O,
1502
+ officialId: ie,
1503
+ commitment: ae
1504
+ }),
1505
+ C && /* @__PURE__ */ L(w, {
1506
+ open: !!C,
1507
+ onOpenChange: (e) => e ? void 0 : T(null),
1508
+ title: `Delete ${C.fullName}?`,
1509
+ description: "This removes the office holder and every commitment recorded against them.",
1510
+ confirmLabel: "Delete office holder",
1511
+ destructive: !0,
1512
+ onConfirm: async () => {
1513
+ try {
1514
+ await se.mutateAsync(C.id), y.success("Office holder deleted", C.fullName), d === C.id && p(null);
1515
+ } catch (e) {
1516
+ y.error("Could not delete the office holder", v(e));
1517
+ } finally {
1518
+ T(null);
1519
+ }
1520
+ }
1521
+ }),
1522
+ j && /* @__PURE__ */ L(w, {
1523
+ open: !!j,
1524
+ onOpenChange: (e) => e ? void 0 : M(null),
1525
+ title: `Delete “${j.title}”?`,
1526
+ description: "This removes the tracked promise and its recorded progress.",
1527
+ confirmLabel: "Delete commitment",
1528
+ destructive: !0,
1529
+ onConfirm: async () => {
1530
+ try {
1531
+ await ce.mutateAsync(j.id), y.success("Commitment deleted", j.title);
1532
+ } catch (e) {
1533
+ y.error("Could not delete the commitment", v(e));
1534
+ } finally {
1535
+ M(null);
1536
+ }
1537
+ }
1538
+ })
1539
+ ]
1540
+ });
1541
+ }
1542
+ //#endregion
1543
+ export { Je as GovernancePage };
1544
+
1545
+ //# sourceMappingURL=GovernancePage.js.map