@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,620 @@
1
+ import { useGovCitizenHub as e } from "../../context/GovCitizenHubContext.js";
2
+ import "../../context/index.js";
3
+ import { cn as t } from "../../utils/cn.js";
4
+ import { PageLayout as n } from "../../components/PageLayout.js";
5
+ import { formatNumber as r } from "../../utils/formatters.js";
6
+ import { StatusBadge as i } from "../../components/StatusBadge.js";
7
+ import { EmptyState as a } from "../../components/EmptyState.js";
8
+ import { useGovAdminLevels as o, useGovCreateJurisdiction as s, useGovFollowJurisdiction as c, useGovJurisdictionTree as l, useGovJurisdictions as u, useGovMyFollowedJurisdictions as d, useGovUnfollowJurisdiction as f } from "../../hooks/useIntelligenceApi.js";
9
+ import { useCursorPager as p } from "../../hooks/useCursorPager.js";
10
+ import "../../hooks/index.js";
11
+ import { ErrorView as m } from "../../components/StateViews.js";
12
+ import { FilterTabs as h } from "../../components/FilterTabs.js";
13
+ import { SectionCard as g } from "../../components/SectionCard.js";
14
+ import { Pagination as _ } from "../../components/Pagination.js";
15
+ import { describeError as ee, notify as v } from "../../lib/toast.js";
16
+ import { VerificationChip as y } from "./JurisdictionLayout.js";
17
+ import { useCallback as b, useEffect as x, useMemo as S, useRef as te, useState as C } from "react";
18
+ import { Bell as w, BellOff as ne, ChevronDown as T, ChevronRight as E, Compass as D, Hash as O, Layers as re, Plus as ie, Ruler as k, Search as ae, Users as A, X as oe } from "lucide-react";
19
+ import { useSearchParams as se } from "react-router-dom";
20
+ import { Fragment as ce, jsx as j, jsxs as M } from "react/jsx-runtime";
21
+ import { Button as N, GlassCard as le, Input as P, Label as F, ResponsiveDialog as I, ResponsiveDialogContent as L, ResponsiveDialogDescription as ue, ResponsiveDialogFooter as de, ResponsiveDialogHeader as fe, ResponsiveDialogTitle as R, Select as z, SelectContent as B, SelectItem as V, SelectTrigger as H, SelectValue as U, Skeleton as W } from "@burdenoff/fe-libs/ui";
22
+ //#region src/govcitizenhub/pages/intelligence/JurisdictionDirectoryPage.tsx
23
+ var pe = 12, me = 4, he = 200, ge = 200, G = "ANY", K = "NO_PARENT", _e = 300, ve = [
24
+ {
25
+ value: "ALL",
26
+ label: "All"
27
+ },
28
+ {
29
+ value: "PUBLISHED",
30
+ label: "Published"
31
+ },
32
+ {
33
+ value: "DRAFT",
34
+ label: "Draft"
35
+ },
36
+ {
37
+ value: "ARCHIVED",
38
+ label: "Archived"
39
+ }
40
+ ];
41
+ function ye(e, t = 0) {
42
+ let n = [];
43
+ for (let r of e) n.push({
44
+ id: r.id,
45
+ name: r.name,
46
+ depth: t,
47
+ adminLevelName: r.adminLevelName
48
+ }), n.push(...ye(r.children, t + 1));
49
+ return n;
50
+ }
51
+ var be = ({ node: e, depth: n, expanded: i, onToggle: a, onSelect: o, activeId: s }) => {
52
+ let c = e.children.length > 0, l = i[e.id] ?? n === 0, u = e.id === s;
53
+ return /* @__PURE__ */ M("li", { children: [/* @__PURE__ */ M("div", {
54
+ className: "flex items-center gap-0.5",
55
+ style: { paddingLeft: `${n * 12}px` },
56
+ children: [c ? /* @__PURE__ */ j("button", {
57
+ type: "button",
58
+ onClick: () => a(e.id, l),
59
+ "aria-expanded": l,
60
+ "aria-label": `${l ? "Collapse" : "Expand"} ${e.name}`,
61
+ className: "inline-flex size-6 shrink-0 items-center justify-center rounded-md text-text-muted outline-none transition-colors hover:bg-bg-sunken hover:text-text-primary focus-visible:ring-1 focus-visible:ring-border-focus",
62
+ children: j(l ? T : E, { className: "size-3.5" })
63
+ }) : /* @__PURE__ */ j("span", {
64
+ className: "inline-block size-6 shrink-0",
65
+ "aria-hidden": "true"
66
+ }), /* @__PURE__ */ M("button", {
67
+ type: "button",
68
+ onClick: () => o(e.id),
69
+ "aria-current": u ? "true" : void 0,
70
+ className: t("min-w-0 flex-1 rounded-md px-2 py-1 text-left outline-none transition-colors focus-visible:ring-1 focus-visible:ring-border-focus", u ? "bg-bg-sunken text-text-primary" : "text-text-secondary hover:bg-bg-sunken hover:text-text-primary"),
71
+ children: [/* @__PURE__ */ j("span", {
72
+ className: t("block truncate text-sm", u && "font-medium"),
73
+ children: e.name
74
+ }), /* @__PURE__ */ M("span", {
75
+ className: "block truncate text-xs text-text-muted",
76
+ children: [e.adminLevelName, e.childCount > 0 && ` · ${r(e.childCount)} sub-region${e.childCount === 1 ? "" : "s"}`]
77
+ })]
78
+ })]
79
+ }), c && l && /* @__PURE__ */ j("ul", {
80
+ className: "mt-0.5 space-y-0.5",
81
+ children: e.children.map((e) => /* @__PURE__ */ j(be, {
82
+ node: e,
83
+ depth: n + 1,
84
+ expanded: i,
85
+ onToggle: a,
86
+ onSelect: o,
87
+ activeId: s
88
+ }, e.id))
89
+ })] });
90
+ }, xe = ({ jurisdiction: e, following: t, followPending: n, followKnown: a, onOpen: o, onToggleFollow: s }) => /* @__PURE__ */ M(le, {
91
+ treatment: "plain",
92
+ role: "button",
93
+ tabIndex: 0,
94
+ "aria-label": `Open ${e.name}`,
95
+ onClick: o,
96
+ onKeyDown: (e) => {
97
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o());
98
+ },
99
+ className: "flex cursor-pointer flex-col border-border-seam p-5 outline-none transition-shadow duration-200 hover:shadow-elevation-1 focus-visible:ring-1 focus-visible:ring-border-focus",
100
+ children: [
101
+ /* @__PURE__ */ M("div", {
102
+ className: "flex items-start gap-3",
103
+ children: [
104
+ /* @__PURE__ */ j("span", {
105
+ className: "inline-flex size-11 shrink-0 items-center justify-center rounded-xl bg-bg-sunken text-text-secondary",
106
+ children: /* @__PURE__ */ j(D, {
107
+ className: "size-5",
108
+ "aria-hidden": "true"
109
+ })
110
+ }),
111
+ /* @__PURE__ */ M("div", {
112
+ className: "min-w-0 flex-1",
113
+ children: [/* @__PURE__ */ j("h2", {
114
+ className: "truncate text-base font-semibold text-text-primary",
115
+ children: e.name
116
+ }), e.localName && /* @__PURE__ */ j("p", {
117
+ className: "truncate text-sm text-text-muted",
118
+ children: e.localName
119
+ })]
120
+ }),
121
+ /* @__PURE__ */ j(i, { status: e.status })
122
+ ]
123
+ }),
124
+ /* @__PURE__ */ M("div", {
125
+ className: "mt-3 flex flex-wrap items-center gap-2",
126
+ children: [
127
+ e.adminLevel && /* @__PURE__ */ M("span", {
128
+ className: "inline-flex items-center gap-1 rounded-full border border-border-seam bg-bg-surface px-2.5 py-0.5 text-xs font-medium text-text-secondary",
129
+ children: [
130
+ /* @__PURE__ */ j(re, {
131
+ className: "size-3",
132
+ "aria-hidden": "true"
133
+ }),
134
+ " ",
135
+ e.adminLevel.name
136
+ ]
137
+ }),
138
+ /* @__PURE__ */ j(y, { status: e.verification }),
139
+ e.officialCode && /* @__PURE__ */ M("span", {
140
+ className: "inline-flex items-center gap-1 rounded-full bg-bg-sunken px-2.5 py-0.5 font-mono text-xs text-text-secondary",
141
+ children: [
142
+ /* @__PURE__ */ j(O, {
143
+ className: "size-3",
144
+ "aria-hidden": "true"
145
+ }),
146
+ " ",
147
+ e.officialCode
148
+ ]
149
+ })
150
+ ]
151
+ }),
152
+ (e.population != null || e.areaSqKm != null) && /* @__PURE__ */ M("div", {
153
+ className: "mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-sm",
154
+ children: [e.population != null && /* @__PURE__ */ M("span", {
155
+ className: "inline-flex items-center gap-1.5 text-text-secondary",
156
+ children: [
157
+ /* @__PURE__ */ j(A, {
158
+ className: "size-4 text-text-muted",
159
+ "aria-hidden": "true"
160
+ }),
161
+ /* @__PURE__ */ j("span", {
162
+ className: "font-medium tabular-nums text-text-primary",
163
+ children: r(e.population)
164
+ }),
165
+ e.populationYear != null && /* @__PURE__ */ M("span", {
166
+ className: "text-xs text-text-muted tabular-nums",
167
+ children: [
168
+ "(",
169
+ e.populationYear,
170
+ ")"
171
+ ]
172
+ })
173
+ ]
174
+ }), e.areaSqKm != null && /* @__PURE__ */ M("span", {
175
+ className: "inline-flex items-center gap-1.5 text-text-secondary",
176
+ children: [
177
+ /* @__PURE__ */ j(k, {
178
+ className: "size-4 text-text-muted",
179
+ "aria-hidden": "true"
180
+ }),
181
+ /* @__PURE__ */ j("span", {
182
+ className: "font-medium tabular-nums text-text-primary",
183
+ children: r(e.areaSqKm, { maximumFractionDigits: 1 })
184
+ }),
185
+ /* @__PURE__ */ j("span", {
186
+ className: "text-xs text-text-muted",
187
+ children: "km²"
188
+ })
189
+ ]
190
+ })]
191
+ }),
192
+ /* @__PURE__ */ M("div", {
193
+ className: "mt-4 flex items-center justify-between gap-2 border-t border-border-seam pt-3",
194
+ children: [/* @__PURE__ */ j("span", {
195
+ className: "truncate text-xs text-text-muted",
196
+ children: e.countryCode
197
+ }), /* @__PURE__ */ M(N, {
198
+ size: "sm",
199
+ variant: "outline",
200
+ disabled: n || !a,
201
+ onClick: (e) => {
202
+ e.stopPropagation(), s();
203
+ },
204
+ "aria-pressed": t,
205
+ "aria-label": `${t ? "Unfollow" : "Follow"} ${e.name}`,
206
+ children: [j(t ? ne : w, {
207
+ className: "mr-1.5 h-4 w-4",
208
+ "aria-hidden": "true"
209
+ }), t ? "Following" : "Follow"]
210
+ })]
211
+ })
212
+ ]
213
+ }), Se = ({ open: e, onOpenChange: t, adminLevels: n, parents: r, onConfigureLevels: i, onCreated: a }) => {
214
+ let o = s(), [c, l] = C(""), [u, d] = C(""), [f, p] = C(""), [m, h] = C(""), [g, _] = C(K), y = n.find((e) => e.id === c), b = !!y && u.trim().length > 0, x = () => {
215
+ l(""), d(""), p(""), h(""), _(K);
216
+ }, S = (e) => {
217
+ o.isPending || (e || x(), t(e));
218
+ }, te = async () => {
219
+ if (!y || !u.trim()) return;
220
+ let e = {
221
+ adminLevelId: y.id,
222
+ countryCode: y.countryCode,
223
+ name: u.trim()
224
+ };
225
+ f.trim() && (e.localName = f.trim()), m.trim() && (e.officialCode = m.trim()), g !== K && (e.parentId = g);
226
+ try {
227
+ let n = await o.mutateAsync(e);
228
+ v.success("Jurisdiction created", `${n.name} starts as a draft profile.`), x(), t(!1), a(n);
229
+ } catch (e) {
230
+ v.error("Could not create the jurisdiction", ee(e));
231
+ }
232
+ };
233
+ return /* @__PURE__ */ j(I, {
234
+ open: e,
235
+ onOpenChange: S,
236
+ children: /* @__PURE__ */ M(L, {
237
+ className: "sm:max-w-lg",
238
+ children: [/* @__PURE__ */ M(fe, { children: [/* @__PURE__ */ j(R, { children: "New jurisdiction" }), /* @__PURE__ */ j(ue, { children: "Create the profile as a draft. It stays invisible to citizens until it is published." })] }), n.length === 0 ? /* @__PURE__ */ M("div", {
239
+ className: "py-2",
240
+ children: [/* @__PURE__ */ j("p", {
241
+ className: "text-sm text-text-secondary",
242
+ children: "No administrative tiers are configured for this workspace yet. A jurisdiction has to sit on a tier, so set the hierarchy up first."
243
+ }), /* @__PURE__ */ j(N, {
244
+ className: "mt-4",
245
+ onClick: i,
246
+ children: "Configure the hierarchy"
247
+ })]
248
+ }) : /* @__PURE__ */ M(ce, { children: [/* @__PURE__ */ M("div", {
249
+ className: "grid gap-4 py-2 sm:grid-cols-2",
250
+ children: [
251
+ /* @__PURE__ */ M("div", {
252
+ className: "grid gap-1.5 sm:col-span-2",
253
+ children: [
254
+ /* @__PURE__ */ j(F, {
255
+ htmlFor: "jurisdiction-level",
256
+ children: "Administrative tier"
257
+ }),
258
+ /* @__PURE__ */ M(z, {
259
+ value: c,
260
+ onValueChange: l,
261
+ children: [/* @__PURE__ */ j(H, {
262
+ id: "jurisdiction-level",
263
+ "aria-label": "Administrative tier",
264
+ children: /* @__PURE__ */ j(U, { placeholder: "Choose a tier" })
265
+ }), /* @__PURE__ */ j(B, { children: n.map((e) => /* @__PURE__ */ M(V, {
266
+ value: e.id,
267
+ children: [
268
+ e.name,
269
+ " · ",
270
+ e.countryCode,
271
+ " · rank ",
272
+ e.rank
273
+ ]
274
+ }, e.id)) })]
275
+ }),
276
+ y && /* @__PURE__ */ M("p", {
277
+ className: "text-xs text-text-muted",
278
+ children: [
279
+ "Country is taken from the tier: ",
280
+ y.countryCode,
281
+ "."
282
+ ]
283
+ })
284
+ ]
285
+ }),
286
+ /* @__PURE__ */ M("div", {
287
+ className: "grid gap-1.5 sm:col-span-2",
288
+ children: [/* @__PURE__ */ j(F, {
289
+ htmlFor: "jurisdiction-name",
290
+ children: "Name"
291
+ }), /* @__PURE__ */ j(P, {
292
+ id: "jurisdiction-name",
293
+ value: u,
294
+ onChange: (e) => d(e.target.value),
295
+ placeholder: "Official name of the region"
296
+ })]
297
+ }),
298
+ /* @__PURE__ */ M("div", {
299
+ className: "grid gap-1.5",
300
+ children: [/* @__PURE__ */ j(F, {
301
+ htmlFor: "jurisdiction-local-name",
302
+ children: "Local name (optional)"
303
+ }), /* @__PURE__ */ j(P, {
304
+ id: "jurisdiction-local-name",
305
+ value: f,
306
+ onChange: (e) => p(e.target.value),
307
+ placeholder: "Name in the local script"
308
+ })]
309
+ }),
310
+ /* @__PURE__ */ M("div", {
311
+ className: "grid gap-1.5",
312
+ children: [/* @__PURE__ */ j(F, {
313
+ htmlFor: "jurisdiction-code",
314
+ children: "Official code (optional)"
315
+ }), /* @__PURE__ */ j(P, {
316
+ id: "jurisdiction-code",
317
+ value: m,
318
+ onChange: (e) => h(e.target.value),
319
+ placeholder: "Census / government code"
320
+ })]
321
+ }),
322
+ /* @__PURE__ */ M("div", {
323
+ className: "grid gap-1.5 sm:col-span-2",
324
+ children: [/* @__PURE__ */ j(F, {
325
+ htmlFor: "jurisdiction-parent",
326
+ children: "Parent region (optional)"
327
+ }), /* @__PURE__ */ M(z, {
328
+ value: g,
329
+ onValueChange: _,
330
+ children: [/* @__PURE__ */ j(H, {
331
+ id: "jurisdiction-parent",
332
+ "aria-label": "Parent region",
333
+ children: /* @__PURE__ */ j(U, {})
334
+ }), /* @__PURE__ */ M(B, { children: [/* @__PURE__ */ j(V, {
335
+ value: K,
336
+ children: "No parent (top level)"
337
+ }), r.map((e) => /* @__PURE__ */ j(V, {
338
+ value: e.id,
339
+ children: /* @__PURE__ */ M("span", {
340
+ style: { paddingLeft: `${e.depth * 12}px` },
341
+ children: [
342
+ e.name,
343
+ " · ",
344
+ e.adminLevelName
345
+ ]
346
+ })
347
+ }, e.id))] })]
348
+ })]
349
+ })
350
+ ]
351
+ }), /* @__PURE__ */ M(de, { children: [/* @__PURE__ */ j(N, {
352
+ variant: "outline",
353
+ onClick: () => S(!1),
354
+ disabled: o.isPending,
355
+ children: "Cancel"
356
+ }), /* @__PURE__ */ j(N, {
357
+ onClick: () => void te(),
358
+ disabled: !b || o.isPending,
359
+ children: "Create jurisdiction"
360
+ })] })] })]
361
+ })
362
+ });
363
+ }, q = () => {
364
+ let { navigateTo: t } = e(), [r, i] = se(), s = p(), y = s.reset, w = r.get("parentId"), [ne, T] = C(""), [E, D] = C(""), [O, k] = C(G), [A, F] = C(G), [I, L] = C("ALL"), [ue, de] = C({}), [fe, R] = C(!1), [K, q] = C(null), J = te(null);
365
+ x(() => () => {
366
+ J.current !== null && window.clearTimeout(J.current);
367
+ }, []);
368
+ let Ce = o(void 0, { limit: ge }), Y = S(() => Ce.data?.items ?? [], [Ce.data]), we = S(() => [...new Set(Y.map((e) => e.countryCode))].sort(), [Y]), Te = S(() => Y.filter((e) => O === G || e.countryCode === O).sort((e, t) => e.rank - t.rank || e.name.localeCompare(t.name)), [Y, O]), X = l(void 0, me), Z = S(() => X.data ?? [], [X.data]), Ee = S(() => ye(Z), [Z]), De = Ee.find((e) => e.id === w)?.name, Oe = d({ limit: he }), ke = S(() => new Set((Oe.data?.items ?? []).map((e) => e.id)), [Oe.data]), Ae = Oe.isSuccess, je = c(), Me = f(), { data: Q, isLoading: Ne, isError: Pe, refetch: Fe } = u(S(() => {
369
+ let e = {};
370
+ return E && (e.search = E), O !== G && (e.countryCode = O), A !== G && (e.adminLevelId = A), I !== "ALL" && (e.status = I), w && (e.parentId = w), e;
371
+ }, [
372
+ E,
373
+ O,
374
+ A,
375
+ I,
376
+ w
377
+ ]), {
378
+ limit: pe,
379
+ cursor: s.cursor
380
+ }), Ie = S(() => Q?.items ?? [], [Q]), $ = E.length > 0 || O !== G || A !== G || I !== "ALL" || !!w, Le = b((e) => {
381
+ T(e), J.current !== null && window.clearTimeout(J.current), J.current = window.setTimeout(() => {
382
+ D(e.trim()), y();
383
+ }, _e);
384
+ }, [y]), Re = b((e) => {
385
+ k(e), F(G), y();
386
+ }, [y]), ze = b((e) => {
387
+ F(e), y();
388
+ }, [y]), Be = b((e) => {
389
+ L(e), y();
390
+ }, [y]), Ve = b(() => {
391
+ let e = new URLSearchParams(r);
392
+ e.delete("parentId"), i(e, { replace: !0 }), y();
393
+ }, [
394
+ r,
395
+ i,
396
+ y
397
+ ]), He = b(() => {
398
+ if (J.current !== null && window.clearTimeout(J.current), T(""), D(""), k(G), F(G), L("ALL"), y(), w) {
399
+ let e = new URLSearchParams(r);
400
+ e.delete("parentId"), i(e, { replace: !0 });
401
+ }
402
+ }, [
403
+ w,
404
+ r,
405
+ i,
406
+ y
407
+ ]), Ue = b((e, t) => {
408
+ de((n) => ({
409
+ ...n,
410
+ [e]: !t
411
+ }));
412
+ }, []), We = b((e) => t(`intelligence/${e}`), [t]), Ge = b(() => {
413
+ Fe();
414
+ }, [Fe]), Ke = b(async (e) => {
415
+ q(e.id);
416
+ try {
417
+ ke.has(e.id) ? (await Me.mutateAsync(e.id), v.success("Unfollowed", `You will no longer get updates for ${e.name}.`)) : (await je.mutateAsync({ jurisdictionId: e.id }), v.success("Following", `You will get updates for ${e.name}.`));
418
+ } catch (e) {
419
+ v.error("Could not update your subscription", ee(e));
420
+ } finally {
421
+ q(null);
422
+ }
423
+ }, [
424
+ ke,
425
+ je,
426
+ Me
427
+ ]);
428
+ return /* @__PURE__ */ M(n, {
429
+ title: "Community Intelligence",
430
+ titleGradient: !0,
431
+ description: "Every administrative region, its officials, its money and how it performs — sourced, dated and open.",
432
+ actions: /* @__PURE__ */ M(N, {
433
+ onClick: () => R(!0),
434
+ children: [/* @__PURE__ */ j(ie, {
435
+ className: "mr-1.5 h-4 w-4",
436
+ "aria-hidden": "true"
437
+ }), " New jurisdiction"]
438
+ }),
439
+ children: [/* @__PURE__ */ M("div", {
440
+ className: "grid gap-5 lg:grid-cols-4",
441
+ children: [/* @__PURE__ */ M("div", {
442
+ className: "min-w-0 lg:col-span-3",
443
+ children: [
444
+ /* @__PURE__ */ M("div", {
445
+ className: "relative mb-4",
446
+ children: [/* @__PURE__ */ j(ae, {
447
+ className: "pointer-events-none absolute left-3.5 top-1/2 size-4 -translate-y-1/2 text-text-muted",
448
+ "aria-hidden": "true"
449
+ }), /* @__PURE__ */ j(P, {
450
+ value: ne,
451
+ onChange: (e) => Le(e.target.value),
452
+ placeholder: "Search by name, local name or official code…",
453
+ "aria-label": "Search jurisdictions",
454
+ className: "h-11 pl-10"
455
+ })]
456
+ }),
457
+ /* @__PURE__ */ M("div", {
458
+ className: "mb-4 flex flex-wrap items-center gap-3",
459
+ children: [
460
+ /* @__PURE__ */ M(z, {
461
+ value: O,
462
+ onValueChange: Re,
463
+ children: [/* @__PURE__ */ j(H, {
464
+ className: "w-full sm:w-52",
465
+ "aria-label": "Filter by country",
466
+ children: /* @__PURE__ */ j(U, { placeholder: "All countries" })
467
+ }), /* @__PURE__ */ M(B, { children: [/* @__PURE__ */ j(V, {
468
+ value: G,
469
+ children: "All countries"
470
+ }), we.map((e) => /* @__PURE__ */ j(V, {
471
+ value: e,
472
+ children: e
473
+ }, e))] })]
474
+ }),
475
+ /* @__PURE__ */ M(z, {
476
+ value: A,
477
+ onValueChange: ze,
478
+ children: [/* @__PURE__ */ j(H, {
479
+ className: "w-full sm:w-60",
480
+ "aria-label": "Filter by administrative tier",
481
+ children: /* @__PURE__ */ j(U, { placeholder: "All tiers" })
482
+ }), /* @__PURE__ */ M(B, { children: [/* @__PURE__ */ j(V, {
483
+ value: G,
484
+ children: "All tiers"
485
+ }), Te.map((e) => /* @__PURE__ */ M(V, {
486
+ value: e.id,
487
+ children: [
488
+ e.pluralName,
489
+ " · ",
490
+ e.countryCode
491
+ ]
492
+ }, e.id))] })]
493
+ }),
494
+ /* @__PURE__ */ j(h, {
495
+ options: ve,
496
+ value: I,
497
+ onChange: Be
498
+ })
499
+ ]
500
+ }),
501
+ w && /* @__PURE__ */ M("div", {
502
+ className: "mb-4 flex flex-wrap items-center justify-between gap-2 rounded-card border border-border-seam bg-bg-sunken px-4 py-2.5",
503
+ children: [/* @__PURE__ */ M("p", {
504
+ className: "text-sm text-text-secondary",
505
+ children: [
506
+ "Showing the sub-regions of",
507
+ " ",
508
+ /* @__PURE__ */ j("span", {
509
+ className: "font-medium text-text-primary",
510
+ children: De ?? "the selected region"
511
+ }),
512
+ "."
513
+ ]
514
+ }), /* @__PURE__ */ M(N, {
515
+ size: "sm",
516
+ variant: "ghost",
517
+ onClick: Ve,
518
+ children: [/* @__PURE__ */ j(oe, {
519
+ className: "mr-1.5 h-4 w-4",
520
+ "aria-hidden": "true"
521
+ }), " Show all regions"]
522
+ })]
523
+ }),
524
+ Ne ? /* @__PURE__ */ j("div", {
525
+ className: "grid gap-4 sm:grid-cols-2 xl:grid-cols-3",
526
+ children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ M(le, {
527
+ treatment: "plain",
528
+ className: "space-y-3 p-5",
529
+ children: [/* @__PURE__ */ M("div", {
530
+ className: "flex items-center gap-3",
531
+ children: [/* @__PURE__ */ j(W, { className: "size-11 rounded-xl" }), /* @__PURE__ */ M("div", {
532
+ className: "flex-1 space-y-2",
533
+ children: [/* @__PURE__ */ j(W, { className: "h-5 w-2/3 rounded" }), /* @__PURE__ */ j(W, { className: "h-4 w-1/2 rounded" })]
534
+ })]
535
+ }), /* @__PURE__ */ j(W, { className: "h-9 w-full rounded-button" })]
536
+ }, t))
537
+ }) : Pe ? /* @__PURE__ */ j(m, {
538
+ message: "We couldn't load the jurisdiction directory.",
539
+ onRetry: Ge
540
+ }) : Ie.length === 0 ? /* @__PURE__ */ j(a, {
541
+ illustration: $ ? "empty-search" : "empty-data",
542
+ title: $ ? "No jurisdictions match these filters" : "No jurisdictions yet",
543
+ description: $ ? "Nothing in this workspace matches the current search and filters. Try widening them." : "Create the first administrative region to start building its public profile.",
544
+ action: $ ? /* @__PURE__ */ j(N, {
545
+ variant: "outline",
546
+ onClick: He,
547
+ children: "Clear filters"
548
+ }) : /* @__PURE__ */ M(N, {
549
+ onClick: () => R(!0),
550
+ children: [/* @__PURE__ */ j(ie, {
551
+ className: "mr-1.5 h-4 w-4",
552
+ "aria-hidden": "true"
553
+ }), " Create jurisdiction"]
554
+ })
555
+ }) : /* @__PURE__ */ M(ce, { children: [/* @__PURE__ */ j("div", {
556
+ className: "grid gap-4 sm:grid-cols-2 xl:grid-cols-3",
557
+ children: Ie.map((e) => /* @__PURE__ */ j(xe, {
558
+ jurisdiction: e,
559
+ following: ke.has(e.id),
560
+ followPending: K === e.id,
561
+ followKnown: Ae,
562
+ onOpen: () => We(e.id),
563
+ onToggleFollow: () => void Ke(e)
564
+ }, e.id))
565
+ }), /* @__PURE__ */ j(_, {
566
+ page: s.page,
567
+ pageSize: pe,
568
+ itemCount: Ie.length,
569
+ hasMore: Q?.pageInfo.hasMore ?? !1,
570
+ onPageChange: (e) => s.onPageChange(e, Q?.pageInfo.cursor)
571
+ })] })
572
+ ]
573
+ }), /* @__PURE__ */ j("aside", {
574
+ className: "min-w-0 lg:col-span-1 lg:order-first",
575
+ children: /* @__PURE__ */ j(g, {
576
+ title: "Hierarchy",
577
+ icon: /* @__PURE__ */ j(re, {}),
578
+ className: "border-border-seam",
579
+ children: X.isLoading ? /* @__PURE__ */ j("div", {
580
+ className: "space-y-2",
581
+ children: Array.from({ length: 6 }, (e, t) => /* @__PURE__ */ j(W, { className: "h-8 w-full rounded-md" }, t))
582
+ }) : X.isError ? /* @__PURE__ */ j(m, {
583
+ className: "min-h-0 py-6",
584
+ title: "Hierarchy unavailable",
585
+ message: "We couldn't load the administrative tree.",
586
+ onRetry: () => {
587
+ X.refetch();
588
+ }
589
+ }) : Z.length === 0 ? /* @__PURE__ */ j("p", {
590
+ className: "text-sm text-text-secondary",
591
+ children: "No regions have been added yet. The hierarchy appears here once the first jurisdiction exists."
592
+ }) : /* @__PURE__ */ j("ul", {
593
+ className: "-mx-1 max-h-[28rem] space-y-0.5 overflow-y-auto px-1",
594
+ children: Z.map((e) => /* @__PURE__ */ j(be, {
595
+ node: e,
596
+ depth: 0,
597
+ expanded: ue,
598
+ onToggle: Ue,
599
+ onSelect: We,
600
+ activeId: w ?? void 0
601
+ }, e.id))
602
+ })
603
+ })
604
+ })]
605
+ }), /* @__PURE__ */ j(Se, {
606
+ open: fe,
607
+ onOpenChange: R,
608
+ adminLevels: Y,
609
+ parents: Ee,
610
+ onConfigureLevels: () => {
611
+ R(!1), t("intelligence/admin/levels");
612
+ },
613
+ onCreated: (e) => We(e.id)
614
+ })]
615
+ });
616
+ };
617
+ //#endregion
618
+ export { q as JurisdictionDirectoryPage };
619
+
620
+ //# sourceMappingURL=JurisdictionDirectoryPage.js.map