@burdenoff/microfe-healthybowl 2026.1005.2 → 2026.1007.2

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 (101) hide show
  1. package/dist/healthybowl/components/BedLayoutGrid.js +128 -115
  2. package/dist/healthybowl/components/BedLayoutGrid.js.map +1 -1
  3. package/dist/healthybowl/components/CropPicker.js +37 -0
  4. package/dist/healthybowl/components/CropPicker.js.map +1 -0
  5. package/dist/healthybowl/components/DataTable.js +125 -108
  6. package/dist/healthybowl/components/DataTable.js.map +1 -1
  7. package/dist/healthybowl/components/FilterBar.js +9 -6
  8. package/dist/healthybowl/components/FilterBar.js.map +1 -1
  9. package/dist/healthybowl/components/PlantCatalogPicker.js +32 -0
  10. package/dist/healthybowl/components/PlantCatalogPicker.js.map +1 -0
  11. package/dist/healthybowl/components/WorkspaceRecordPicker.js +164 -0
  12. package/dist/healthybowl/components/WorkspaceRecordPicker.js.map +1 -0
  13. package/dist/healthybowl/components/index.js +3 -1
  14. package/dist/healthybowl/hooks/useCropPage.js +71 -0
  15. package/dist/healthybowl/hooks/useCropPage.js.map +1 -0
  16. package/dist/healthybowl/hooks/usePlantCatalog.js +133 -44
  17. package/dist/healthybowl/hooks/usePlantCatalog.js.map +1 -1
  18. package/dist/healthybowl/hooks/usePlantingEstimate.js +6 -6
  19. package/dist/healthybowl/hooks/usePlantingEstimate.js.map +1 -1
  20. package/dist/healthybowl/hooks/useWorkspaceRead.js +46 -0
  21. package/dist/healthybowl/hooks/useWorkspaceRead.js.map +1 -0
  22. package/dist/healthybowl/pages/HomePage.js +143 -142
  23. package/dist/healthybowl/pages/HomePage.js.map +1 -1
  24. package/dist/healthybowl/pages/analytics/ReportsPage.js +8 -8
  25. package/dist/healthybowl/pages/catalog/PlantCatalogPage.js +266 -192
  26. package/dist/healthybowl/pages/catalog/PlantCatalogPage.js.map +1 -1
  27. package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js +58 -0
  28. package/dist/healthybowl/pages/catalog/WorkspaceBrowseFilters.js.map +1 -0
  29. package/dist/healthybowl/pages/catalog/browsePagination.js +24 -0
  30. package/dist/healthybowl/pages/catalog/browsePagination.js.map +1 -0
  31. package/dist/healthybowl/pages/compliance/ComplianceDocumentsPage.js +6 -6
  32. package/dist/healthybowl/pages/crops/CropDetailsPage.js +340 -348
  33. package/dist/healthybowl/pages/crops/CropDetailsPage.js.map +1 -1
  34. package/dist/healthybowl/pages/crops/CropPlanningPage.js +468 -434
  35. package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
  36. package/dist/healthybowl/pages/crops/CropsPage.js +633 -542
  37. package/dist/healthybowl/pages/crops/CropsPage.js.map +1 -1
  38. package/dist/healthybowl/pages/crops/FieldDetailsPage.js +875 -800
  39. package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
  40. package/dist/healthybowl/pages/crops/PlanningDetailsPage.js +459 -448
  41. package/dist/healthybowl/pages/crops/PlanningDetailsPage.js.map +1 -1
  42. package/dist/healthybowl/pages/crops/SuccessionCropLabel.js +21 -0
  43. package/dist/healthybowl/pages/crops/SuccessionCropLabel.js.map +1 -0
  44. package/dist/healthybowl/pages/crops/planningEdit.js +30 -0
  45. package/dist/healthybowl/pages/crops/planningEdit.js.map +1 -0
  46. package/dist/healthybowl/pages/fields/FieldMapPage.js +989 -941
  47. package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
  48. package/dist/healthybowl/pages/financial/GeneralLedgerPage.js +6 -6
  49. package/dist/healthybowl/pages/financial/InvoiceManagementPage.js +7 -7
  50. package/dist/healthybowl/pages/financial/InvoiceManagementPage.js.map +1 -1
  51. package/dist/healthybowl/pages/financial/TransactionsPage.js +541 -541
  52. package/dist/healthybowl/pages/financial/TransactionsPage.js.map +1 -1
  53. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +10 -10
  54. package/dist/healthybowl/pages/government-schemes/CommunicationPage.js +207 -207
  55. package/dist/healthybowl/pages/government-schemes/CommunicationPage.js.map +1 -1
  56. package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js +38 -38
  57. package/dist/healthybowl/pages/government-schemes/SchemeAdminPage.js.map +1 -1
  58. package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js +15 -15
  59. package/dist/healthybowl/pages/government-schemes/TrainingProgramsPage.js.map +1 -1
  60. package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js +4 -4
  61. package/dist/healthybowl/pages/livestock/BreedingManagementPage.js +4 -4
  62. package/dist/healthybowl/pages/livestock/FeedManagementPage.js +4 -4
  63. package/dist/healthybowl/pages/livestock/HealthRecordsPage.js +16 -16
  64. package/dist/healthybowl/pages/livestock/HealthRecordsPage.js.map +1 -1
  65. package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js +4 -4
  66. package/dist/healthybowl/pages/livestock/VaccinationSchedulePage.js +4 -4
  67. package/dist/healthybowl/pages/market/MarketPricesPage.js +305 -305
  68. package/dist/healthybowl/pages/market/MarketPricesPage.js.map +1 -1
  69. package/dist/healthybowl/pages/network/CohortsPage.js +107 -107
  70. package/dist/healthybowl/pages/network/CohortsPage.js.map +1 -1
  71. package/dist/healthybowl/pages/network/CommunityPage.js +247 -247
  72. package/dist/healthybowl/pages/network/CommunityPage.js.map +1 -1
  73. package/dist/healthybowl/pages/network/EventsPage.js +16 -16
  74. package/dist/healthybowl/pages/network/EventsPage.js.map +1 -1
  75. package/dist/healthybowl/pages/network/ExpertsPage.js +470 -470
  76. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  77. package/dist/healthybowl/pages/network/MentorsPage.js +6 -6
  78. package/dist/healthybowl/pages/pest-management/PestIssuesPage.js +8 -8
  79. package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js +7 -7
  80. package/dist/healthybowl/pages/pest-management/TreatmentLibraryPage.js.map +1 -1
  81. package/dist/healthybowl/pages/production/ProductionBatchesPage.js +7 -7
  82. package/dist/healthybowl/pages/production/RecipeManagementPage.js +5 -5
  83. package/dist/healthybowl/pages/production/ValueAddedProductsPage.js +7 -7
  84. package/dist/healthybowl/pages/soil/SoilTestsPage.js +6 -6
  85. package/dist/healthybowl/pages/soil/SoilTestsPage.js.map +1 -1
  86. package/dist/healthybowl/pages/suppliers/SuppliersPage.js +10 -10
  87. package/dist/healthybowl/pages/sustainability/CarbonCreditLedgerPage.js +6 -6
  88. package/dist/healthybowl/pages/terrace/PlantingFormModal.js +151 -131
  89. package/dist/healthybowl/pages/terrace/PlantingFormModal.js.map +1 -1
  90. package/dist/healthybowl/pages/traceability/BatchTrackingPage.js +6 -6
  91. package/dist/healthybowl/utils/cropComparison.js +1 -1
  92. package/dist/healthybowl/utils/cropComparison.js.map +1 -1
  93. package/dist/healthybowl/utils/cropPicker.js +35 -0
  94. package/dist/healthybowl/utils/cropPicker.js.map +1 -0
  95. package/dist/healthybowl/utils/plantingCapacity.js +2 -2
  96. package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
  97. package/dist/healthybowl/utils/quotaLabels.js +8 -0
  98. package/dist/healthybowl/utils/quotaLabels.js.map +1 -0
  99. package/dist/healthybowl/utils/seedRate.js +1 -8
  100. package/dist/healthybowl/utils/seedRate.js.map +1 -1
  101. package/package.json +1 -1
@@ -3,34 +3,38 @@ import { geocodePlace as t } from "../../utils/geocode.js";
3
3
  import { useHealthyBowl as n } from "../../context/HealthyBowlContext.js";
4
4
  import { PageLayout as r } from "../../components/PageLayout.js";
5
5
  import { useBasePath as i } from "../../hooks/useBasePath.js";
6
- import { EmptyState as a } from "../../components/EmptyState.js";
7
- import { ErrorState as o } from "../../components/ErrorState.js";
8
- import { ToastContainer as ee } from "../../components/Toast.js";
9
- import { useConfirm as te } from "../../components/ConfirmDialog.js";
10
- import { Modal as ne } from "../../components/Modal.js";
11
- import { extractPolygon as re, isValidPolygon as ie, polygonAreaInUnit as ae, polygonAreaSqMeters as oe, polygonCentroid as se, ringToPolygon as ce } from "../../utils/geo.js";
12
- import { require_leaflet_src as s } from "../../../node_modules/leaflet/dist/leaflet-src.js";
13
- import { useToast as le } from "../../hooks/useToast.js";
14
- import { ensureLeafletCss as ue } from "../../utils/leaflet.js";
15
- import { SOIL_PALETTE as de, soilColor as fe, soilLegendFor as pe } from "../../utils/soil.js";
16
- import { elevationColor as me, fetchElevations as he } from "../../utils/elevation.js";
17
- import { bedPlantCount as ge, generateBeds as _e } from "../../utils/bedLayout.js";
6
+ import { useCropDetail as a } from "../../hooks/useCropPage.js";
7
+ import { deduplicatePickerRecords as o, pickerRecordLabel as ee } from "../../utils/cropPicker.js";
8
+ import { CropPicker as te } from "../../components/CropPicker.js";
9
+ import { EmptyState as ne } from "../../components/EmptyState.js";
10
+ import { ErrorState as re } from "../../components/ErrorState.js";
11
+ import { ToastContainer as ie } from "../../components/Toast.js";
12
+ import { useConfirm as ae } from "../../components/ConfirmDialog.js";
13
+ import { Modal as oe } from "../../components/Modal.js";
14
+ import { extractPolygon as s, isValidPolygon as se, polygonAreaInUnit as ce, polygonAreaSqMeters as le, polygonCentroid as ue, ringToPolygon as de } from "../../utils/geo.js";
15
+ import { require_leaflet_src as c } from "../../../node_modules/leaflet/dist/leaflet-src.js";
16
+ import { useToast as fe } from "../../hooks/useToast.js";
17
+ import { ensureLeafletCss as pe } from "../../utils/leaflet.js";
18
+ import { SOIL_PALETTE as me, soilColor as he, soilLegendFor as ge } from "../../utils/soil.js";
19
+ import { elevationColor as _e, fetchElevations as ve } from "../../utils/elevation.js";
20
+ import { bedPlantCount as ye, generateBeds as be } from "../../utils/bedLayout.js";
18
21
  import "../../utils/index.js";
19
22
  import "../../components/index.js";
20
- import { useHealthyBowlData as ve } from "../../hooks/useHealthyBowlData.js";
21
- import { BED_GEOMETRY_NOTICE as ye, DEFAULT_GROW_LOCATION_TYPE as be, GROW_LOCATION_TYPE_OPTIONS as xe, MAP_FEATURE_PROMOTABLE_HINT as c, growLocationTypeLabel as l, normalizeGrowLocationType as Se, usesBedGeometry as Ce } from "../../utils/growLocationType.js";
22
- import { GrowGeometryInputs as we, geometryForType as Te } from "../../components/GrowGeometryInputs.js";
23
- import { DEFAULT_BED_WIDTH_M as Ee, DEFAULT_PATH_WIDTH_M as De, getCropSpacingPreset as Oe } from "../../utils/plantingCapacity.js";
24
- import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
25
- import { useI18n as ke } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
26
- import { Check as Ae, Droplet as h, Fence as je, Layers as Me, LayoutGrid as Ne, LocateFixed as Pe, MapPinned as Fe, Pencil as Ie, Plus as Le, Ruler as Re, Save as ze, Search as Be, Shapes as Ve, Spline as He, Sprout as g, Square as _, Trash2 as Ue, TriangleAlert as We, Undo2 as Ge, Warehouse as Ke, Waypoints as v, X as qe } from "lucide-react";
27
- import { useNavigate as Je } from "react-router";
28
- import { Fragment as Ye, jsx as y, jsxs as b } from "react/jsx-runtime";
29
- import { Button as x, Select as Xe, SelectContent as Ze, SelectItem as S, SelectTrigger as Qe, SelectValue as $e } from "@burdenoff/fe-libs/ui";
30
- import { gql as C } from "@apollo/client";
31
- import { useMutation as et, useQuery as tt } from "@apollo/client/react";
23
+ import { useHealthyBowlData as xe } from "../../hooks/useHealthyBowlData.js";
24
+ import { BED_GEOMETRY_NOTICE as Se, DEFAULT_GROW_LOCATION_TYPE as Ce, GROW_LOCATION_TYPE_OPTIONS as we, MAP_FEATURE_PROMOTABLE_HINT as l, growLocationTypeLabel as u, normalizeGrowLocationType as Te, usesBedGeometry as Ee } from "../../utils/growLocationType.js";
25
+ import { GrowGeometryInputs as De, geometryForType as Oe } from "../../components/GrowGeometryInputs.js";
26
+ import { DEFAULT_BED_WIDTH_M as ke, DEFAULT_PATH_WIDTH_M as Ae, getCropSpacingPreset as je } from "../../utils/plantingCapacity.js";
27
+ import { cropMatchesField as Me } from "../crops/planningEdit.js";
28
+ import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
29
+ import { useI18n as Ne } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
30
+ import { Check as Pe, Droplet as g, Fence as Fe, Layers as Ie, LayoutGrid as Le, LocateFixed as Re, MapPinned as ze, Pencil as Be, Plus as Ve, Ruler as He, Save as Ue, Search as We, Shapes as Ge, Spline as Ke, Sprout as _, Square as v, Trash2 as qe, TriangleAlert as Je, Undo2 as Ye, Warehouse as Xe, Waypoints as y, X as Ze } from "lucide-react";
31
+ import { useNavigate as Qe } from "react-router";
32
+ import { Fragment as $e, jsx as b, jsxs as x } from "react/jsx-runtime";
33
+ import { Button as S, Select as et, SelectContent as tt, SelectItem as C, SelectTrigger as nt, SelectValue as rt } from "@burdenoff/fe-libs/ui";
34
+ import { gql as w } from "@apollo/client";
35
+ import { useMutation as it, useQuery as at } from "@apollo/client/react";
32
36
  //#region src/healthybowl/pages/fields/FieldMapPage.tsx
33
- var w = /* @__PURE__ */ e(s(), 1), nt = C`
37
+ var T = /* @__PURE__ */ e(c(), 1), ot = w`
34
38
  mutation UpdateHealthyBowlFieldBoundaryOnMapPage($input: UpdateHealthyBowlFieldInput!) {
35
39
  updateHealthyBowlField(input: $input) {
36
40
  id
@@ -39,7 +43,7 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
39
43
  location
40
44
  }
41
45
  }
42
- `, rt = C`
46
+ `, st = w`
43
47
  query HealthyBowlBedsOnMapPage($context: ContextInput!, $fieldId: ID) {
44
48
  healthyBowlBeds(context: $context, fieldId: $fieldId) {
45
49
  id
@@ -55,13 +59,13 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
55
59
  status
56
60
  }
57
61
  }
58
- `, it = C`
62
+ `, ct = w`
59
63
  mutation CreateHealthyBowlBedOnMapPage($input: CreateHealthyBowlBedInput!) {
60
64
  createHealthyBowlBed(input: $input) {
61
65
  id
62
66
  }
63
67
  }
64
- `, at = C`
68
+ `, lt = w`
65
69
  mutation UpdateHealthyBowlBedOnMapPage($input: UpdateHealthyBowlBedInput!) {
66
70
  updateHealthyBowlBed(input: $input) {
67
71
  id
@@ -69,11 +73,11 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
69
73
  plantCount
70
74
  }
71
75
  }
72
- `, ot = C`
76
+ `, ut = w`
73
77
  mutation DeleteHealthyBowlBedOnMapPage($id: ID!, $context: ContextInput!) {
74
78
  deleteHealthyBowlBed(id: $id, context: $context)
75
79
  }
76
- `, st = C`
80
+ `, dt = w`
77
81
  query HealthyBowlMapFeaturesOnMapPage($context: ContextInput!) {
78
82
  healthyBowlMapFeatures(context: $context) {
79
83
  id
@@ -84,17 +88,17 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
84
88
  color
85
89
  }
86
90
  }
87
- `, ct = C`
91
+ `, ft = w`
88
92
  mutation CreateHealthyBowlMapFeatureOnMapPage($input: CreateHealthyBowlMapFeatureInput!) {
89
93
  createHealthyBowlMapFeature(input: $input) {
90
94
  id
91
95
  }
92
96
  }
93
- `, lt = C`
97
+ `, pt = w`
94
98
  mutation DeleteHealthyBowlMapFeatureOnMapPage($id: ID!, $context: ContextInput!) {
95
99
  deleteHealthyBowlMapFeature(id: $id, context: $context)
96
100
  }
97
- `, ut = [
101
+ `, mt = [
98
102
  {
99
103
  type: "BUFFER_ZONE",
100
104
  kind: "polygon",
@@ -108,7 +112,7 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
108
112
  fillColor: "#f59e0b",
109
113
  fillOpacity: .15
110
114
  },
111
- icon: _
115
+ icon: v
112
116
  },
113
117
  {
114
118
  type: "GREENHOUSE",
@@ -122,8 +126,8 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
122
126
  fillColor: "#14b8a6",
123
127
  fillOpacity: .3
124
128
  },
125
- icon: g,
126
- hint: c,
129
+ icon: _,
130
+ hint: l,
127
131
  promotesTo: "GREENHOUSE"
128
132
  },
129
133
  {
@@ -138,7 +142,7 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
138
142
  fillColor: "#6b7280",
139
143
  fillOpacity: .4
140
144
  },
141
- icon: Ke
145
+ icon: Xe
142
146
  },
143
147
  {
144
148
  type: "ENCLOSURE",
@@ -153,7 +157,7 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
153
157
  fillColor: "#92400e",
154
158
  fillOpacity: .2
155
159
  },
156
- icon: je
160
+ icon: Fe
157
161
  },
158
162
  {
159
163
  type: "CUSTOM",
@@ -167,7 +171,7 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
167
171
  fillColor: "#8b5cf6",
168
172
  fillOpacity: .25
169
173
  },
170
- icon: Ve
174
+ icon: Ge
171
175
  },
172
176
  {
173
177
  type: "IRRIGATION_LINE",
@@ -179,7 +183,7 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
179
183
  color: "#3b82f6",
180
184
  weight: 3
181
185
  },
182
- icon: v
186
+ icon: y
183
187
  },
184
188
  {
185
189
  type: "WATER_SOURCE",
@@ -193,7 +197,7 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
193
197
  fillColor: "#3b82f6",
194
198
  fillOpacity: 1
195
199
  },
196
- icon: h
200
+ icon: g
197
201
  },
198
202
  {
199
203
  type: "HAZARD",
@@ -207,79 +211,88 @@ var w = /* @__PURE__ */ e(s(), 1), nt = C`
207
211
  fillColor: "#dc2626",
208
212
  fillOpacity: 1
209
213
  },
210
- icon: We
214
+ icon: Je
211
215
  }
212
- ], T = new Map(ut.map((e) => [e.type, e])), dt = (e) => e === "polygon" ? "Area" : e === "line" ? "Line" : "Point", ft = 250, pt = 20;
213
- async function mt(e, t, n) {
216
+ ], E = new Map(mt.map((e) => [e.type, e])), ht = (e) => e === "polygon" ? "Area" : e === "line" ? "Line" : "Point", gt = 250, _t = 20;
217
+ async function vt(e, t, n) {
214
218
  for (let r = 0; r < e.length; r += t) await Promise.all(e.slice(r, r + t).map(n));
215
219
  }
216
- var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", gt = "Esri, Maxar, Earthstar Geographics", _t = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", vt = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", yt = 21, bt = 16, xt = 2.47105, St = "#16a34a", Ct = {
220
+ var yt = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", bt = "Esri, Maxar, Earthstar Geographics", xt = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", St = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", Ct = 21, wt = 16, Tt = 2.47105, Et = "#16a34a", Dt = {
217
221
  color: "#f59e0b",
218
222
  weight: 2,
219
223
  dashArray: "6 4",
220
224
  fillColor: "#f59e0b",
221
225
  fillOpacity: .15
222
- }, wt = {
226
+ }, Ot = {
223
227
  color: "#ffffff",
224
228
  weight: 2,
225
229
  dashArray: "6 4",
226
230
  fillColor: "#22c55e",
227
231
  fillOpacity: .2
228
- }, Tt = {
232
+ }, kt = {
229
233
  color: "#38bdf8",
230
234
  weight: 3,
231
235
  dashArray: "6 6"
232
- }, Et = {
236
+ }, At = {
233
237
  color: "#b45309",
234
238
  weight: 1,
235
239
  dashArray: "4 3",
236
240
  fillColor: "#f59e0b",
237
241
  fillOpacity: .25
238
- }, Dt = {
242
+ }, jt = {
239
243
  color: "#065f46",
240
244
  weight: 2,
241
245
  fillColor: "#34d399",
242
246
  fillOpacity: .5
243
- }, Ot = {
247
+ }, Mt = {
244
248
  color: "#065f46",
245
249
  weight: 2,
246
250
  fillColor: "#059669",
247
251
  fillOpacity: .6
248
- }, kt = {
252
+ }, Nt = {
249
253
  color: "#f8fafc",
250
254
  weight: 2,
251
255
  dashArray: "8 6",
252
256
  fillColor: "#f8fafc",
253
257
  fillOpacity: .06
254
- }, At = (e) => !!(e && Number.isFinite(e.lat) && Number.isFinite(e.lng) && e.lat >= -90 && e.lat <= 90 && e.lng >= -180 && e.lng <= 180 && (e.lat !== 0 || e.lng !== 0)), jt = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), Mt = (e) => jt(e.unit) ? e.area * xt : e.area, Nt = (e) => `${e.area.toFixed(1)} ${jt(e.unit) ? "ha" : "ac"}`, E = (e) => {
255
- let t = re(e.boundary);
256
- return t && ie(t) ? t : null;
257
- }, Pt = w.default.divIcon({
258
+ }, Pt = (e) => !!(e && Number.isFinite(e.lat) && Number.isFinite(e.lng) && e.lat >= -90 && e.lat <= 90 && e.lng >= -180 && e.lng <= 180 && (e.lat !== 0 || e.lng !== 0)), Ft = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), It = (e) => Ft(e.unit) ? e.area * Tt : e.area, Lt = (e) => `${e.area.toFixed(1)} ${Ft(e.unit) ? "ha" : "ac"}`, D = (e) => {
259
+ let t = s(e.boundary);
260
+ return t && se(t) ? t : null;
261
+ }, Rt = T.default.divIcon({
258
262
  className: "",
259
263
  html: "<span style=\"display:block;width:12px;height:12px;background:#22c55e;border:2px solid #fff;border-radius:2px;box-shadow:0 0 3px rgba(0,0,0,.6)\"></span>",
260
264
  iconSize: [16, 16],
261
265
  iconAnchor: [8, 8]
262
- }), D = () => {
263
- let { t: e } = ke(), { workspaceId: s } = n(), c = te(), { fields: h, crops: g, farm: _, loadings: We, errors: Ke, refetch: v, createField: C, updateFarm: xt } = ve(), { toasts: jt, toast: D, dismiss: Ft } = le(), It = Je(), { buildPath: Lt } = i(), Rt = !!_?.id, [zt] = et(nt), [Bt] = et(it), [Vt] = et(at), [Ht] = et(ot), [Ut] = et(ct), [Wt] = et(lt), [O, Gt] = m("loading"), [k, A] = m("view"), [j, M] = m(null), [Kt, qt] = m(!1), [Jt, Yt] = m(!0), [Xt, Zt] = m(!1), [N, Qt] = m({}), [$t, en] = m(""), [tn, nn] = m(""), [rn, an] = m(!1), [on, sn] = m(0), [cn, ln] = m(null), [un, dn] = m(!1), [fn, pn] = m(!1), [P, mn] = m(null), [hn, gn] = m(!1), [F, _n] = m(Ee), [vn, yn] = m(De), [bn, xn] = m(0), [Sn, Cn] = m(""), [wn, Tn] = m(!1), [En, Dn] = m(!1), [I, On] = m(null), [kn, An] = m(""), [jn, Mn] = m(!1), [Nn, Pn] = m(!0), [Fn, In] = m(!0), [Ln, Rn] = m(!1), [zn, Bn] = m(!1), [Vn, Hn] = m(null), [Un, Wn] = m(0), [L, Gn] = m(null), [Kn, qn] = m(""), [Jn, Yn] = m(""), [Xn, Zn] = m(!1), [R, Qn] = m(null), [$n, er] = m(!1), [z, tr] = m(null), [nr, rr] = m(!1), [ir, ar] = m(""), [or, sr] = m("Clay loam"), [cr, lr] = m("Drip"), [ur, dr] = m("active"), [fr, pr] = m(be), [mr, hr] = m({}), [gr, _r] = m(null), vr = p(null), B = p(null), yr = p(null), br = p(null), xr = p(null), Sr = p(null), Cr = p(null), wr = p(null), Tr = p(null), Er = p(null), Dr = p(null), Or = p(null), V = p([]), kr = p(null), H = p(null), U = p([]), Ar = p(null), jr = p([]), Mr = p(null), Nr = p([]), W = p("view"), Pr = p(!1);
264
- d(() => {
265
- W.current = k;
266
- }, [k]), d(() => {
267
- H.current = Vn;
268
- }, [Vn]), d(() => {
269
- k !== "element" && (Or.current?.clearLayers(), V.current = [], kr.current = null);
270
- }, [k]);
271
- let Fr = f(() => h.filter((e) => E(e) !== null).length, [h]), Ir = f(() => h.reduce((e, t) => e + Mt(t), 0), [h]), Lr = f(() => pe(h.map((e) => e.soilType)), [h]), G = f(() => h.find((e) => e.id === j) ?? null, [h, j]), Rr = f(() => {
272
- let e = re(_?.boundary);
273
- return e && ie(e) ? e : null;
274
- }, [_]), zr = f(() => {
275
- let e = $t.trim().toLowerCase();
276
- return e ? h.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : h;
277
- }, [h, $t]), Br = f(() => {
266
+ }), O = () => {
267
+ let { workspaceId: e } = n();
268
+ return e ? /* @__PURE__ */ b(zt, {}, e) : /* @__PURE__ */ b(r, {
269
+ title: "Field Map",
270
+ children: /* @__PURE__ */ b("p", {
271
+ className: "text-sm text-text-secondary",
272
+ children: "Choose a workspace to view its fields and beds."
273
+ })
274
+ });
275
+ }, zt = () => {
276
+ let { t: e } = Ne(), { workspaceId: c } = n(), l = ae(), { fields: g, crops: _, farm: v, loadings: Je, errors: Xe, refetch: y, createField: w, updateFarm: Tt } = xe(), { toasts: Ft, toast: O, dismiss: zt } = fe(), Bt = Qe(), { buildPath: Vt } = i(), Ht = !!v?.id, [Ut] = it(ot), [Wt] = it(ct), [Gt] = it(lt), [Kt] = it(ut), [qt] = it(ft), [Jt] = it(pt), [k, Yt] = h("loading"), [A, j] = h("view"), [M, N] = h(null), [Xt, Zt] = h(!1), [Qt, $t] = h(!0), [en, tn] = h(!1), [P, nn] = h({}), [rn, an] = h(""), [on, sn] = h(""), [cn, ln] = h(!1), [un, dn] = h(0), [fn, pn] = h(null), [mn, hn] = h(!1), [gn, _n] = h(!1), [F, vn] = h(null), [yn, bn] = h(!1), [I, xn] = h(ke), [Sn, Cn] = h(Ae), [wn, Tn] = h(0), [L, En] = h(""), [Dn, On] = h(null), [kn, An] = h(!1), [jn, Mn] = h(!1), [R, Nn] = h(null), [z, Pn] = h(""), [Fn, In] = h(!1), [Ln, Rn] = h(!0), [zn, Bn] = h(!0), [Vn, Hn] = h(!1), [Un, Wn] = h(!1), [Gn, Kn] = h(null), [qn, Jn] = h(0), [B, Yn] = h(null), [Xn, Zn] = h(""), [Qn, $n] = h(""), [er, tr] = h(!1), [V, nr] = h(null), [rr, ir] = h(!1), [H, ar] = h(null), [or, sr] = h(!1), [cr, lr] = h(""), [ur, dr] = h("Clay loam"), [fr, pr] = h("Drip"), [mr, hr] = h("active"), [gr, _r] = h(Ce), [vr, yr] = h({}), [br, xr] = h(null), Sr = m(null), U = m(null), Cr = m(null), wr = m(null), Tr = m(null), Er = m(null), Dr = m(null), Or = m(null), kr = m(null), Ar = m(null), jr = m(null), Mr = m(null), Nr = m([]), Pr = m(null), Fr = m(null), Ir = m([]), Lr = m(null), Rr = m([]), zr = m(null), Br = m([]), W = m("view"), Vr = m(!1);
277
+ f(() => {
278
+ W.current = A;
279
+ }, [A]), f(() => {
280
+ Fr.current = Gn;
281
+ }, [Gn]), f(() => {
282
+ A !== "element" && (Mr.current?.clearLayers(), Nr.current = [], Pr.current = null);
283
+ }, [A]);
284
+ let Hr = p(() => g.filter((e) => D(e) !== null).length, [g]), Ur = p(() => g.reduce((e, t) => e + It(t), 0), [g]), Wr = p(() => ge(g.map((e) => e.soilType)), [g]), G = p(() => g.find((e) => e.id === M) ?? null, [g, M]), Gr = p(() => {
285
+ let e = s(v?.boundary);
286
+ return e && se(e) ? e : null;
287
+ }, [v]), Kr = p(() => {
288
+ let e = rn.trim().toLowerCase();
289
+ return e ? g.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : g;
290
+ }, [g, rn]), qr = p(() => {
278
291
  let e = [];
279
- for (let t of h) {
280
- let n = E(t);
292
+ for (let t of g) {
293
+ let n = D(t);
281
294
  if (n) {
282
- let r = se(n);
295
+ let r = ue(n);
283
296
  if (r) {
284
297
  e.push({
285
298
  id: t.id,
@@ -289,80 +302,88 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
289
302
  continue;
290
303
  }
291
304
  }
292
- At(t.location) && e.push({
305
+ Pt(t.location) && e.push({
293
306
  id: t.id,
294
307
  lat: t.location.lat,
295
308
  lng: t.location.lng
296
309
  });
297
310
  }
298
311
  return e;
299
- }, [h]);
300
- d(() => {
301
- if (Br.length === 0) {
302
- Qt({});
312
+ }, [g]);
313
+ f(() => {
314
+ if (qr.length === 0) {
315
+ nn({});
303
316
  return;
304
317
  }
305
318
  let e = new AbortController(), t = !1;
306
- return he(Br.map((e) => ({
319
+ return ve(qr.map((e) => ({
307
320
  lat: e.lat,
308
321
  lng: e.lng
309
322
  })), e.signal).then((e) => {
310
323
  if (t) return;
311
324
  let n = {};
312
- Br.forEach((t, r) => {
325
+ qr.forEach((t, r) => {
313
326
  n[t.id] = e[r] ?? null;
314
- }), Qt(n);
327
+ }), nn(n);
315
328
  }), () => {
316
329
  t = !0, e.abort();
317
330
  };
318
- }, [f(() => Br.map((e) => `${e.id}:${e.lat.toFixed(5)},${e.lng.toFixed(5)}`).join("|"), [Br])]);
319
- let [Vr, Hr] = f(() => {
320
- let e = Object.values(N).filter((e) => e != null && Number.isFinite(e));
331
+ }, [p(() => qr.map((e) => `${e.id}:${e.lat.toFixed(5)},${e.lng.toFixed(5)}`).join("|"), [qr])]);
332
+ let [Jr, Yr] = p(() => {
333
+ let e = Object.values(P).filter((e) => e != null && Number.isFinite(e));
321
334
  return e.length === 0 ? [0, 0] : [Math.min(...e), Math.max(...e)];
322
- }, [N]), Ur = f(() => Object.values(N).some((e) => e != null && Number.isFinite(e)), [N]), Wr = u((e) => {
335
+ }, [P]), Xr = p(() => Object.values(P).some((e) => e != null && Number.isFinite(e)), [P]), Zr = d((e) => {
323
336
  if (!e) return "";
324
- let t = g.find((t) => t.field === e.id || t.fieldName === e.name);
337
+ let t = _.find((t) => Me(t, e));
325
338
  return t ? t.name : (e.crops ?? []).join(", ");
326
- }, [g]), Gr = f(() => G ? E(G) : null, [G]), Kr = f(() => G ? g.find((e) => e.field === G.id || e.fieldName === G.name) ?? null : null, [g, G]), qr = f(() => g.find((e) => e.id === Sn) ?? Kr, [
327
- g,
328
- Sn,
329
- Kr
330
- ]), K = f(() => Oe(qr), [qr]);
331
- d(() => {
332
- Cn("");
333
- }, [j]);
334
- let q = Ce(G?.type), Jr = l(e, G?.type), J = f(() => !Gr || !q ? null : _e(Gr, {
335
- bedWidthM: F,
336
- pathWidthM: vn,
337
- orientationDeg: bn
339
+ }, [_]), Qr = p(() => G ? D(G) : null, [G]), $r = p(() => G ? _.find((e) => Me(e, G)) ?? null : null, [_, G]), ei = a(L), ti = Dn?.workspaceId === c && Dn.crop.id === L ? Dn.crop : null, ni = L ? ei.crop ?? ti : $r, K = !!(L && !ni), ri = ei.loading && !ei.error ? e("healthybowl.fieldMapPage.beds.cropLoading", "Loading selected crop spacing… Your selection is kept.") : e("healthybowl.fieldMapPage.beds.cropUnavailable", "Selected crop spacing is unavailable. Your selection is kept; resolve it before replacing the layout.");
340
+ f(() => {
341
+ ei.crop && On({
342
+ workspaceId: c,
343
+ crop: ei.crop
344
+ });
345
+ }, [ei.crop, c]);
346
+ let ii = p(() => o([..._.filter((e) => G && Me(e, G)), ..._]), [_, G]), ai = a(z, { skip: !R }), oi = ai.crop, si = z === (R?.cropId ?? ""), q = p(() => je(ni), [ni]);
347
+ f(() => {
348
+ En(""), On(null);
349
+ }, [M]);
350
+ let J = Ee(G?.type), ci = u(e, G?.type), Y = p(() => !Qr || !J ? null : be(Qr, {
351
+ bedWidthM: I,
352
+ pathWidthM: Sn,
353
+ orientationDeg: wn
338
354
  }), [
339
- Gr,
340
- q,
341
- F,
342
- vn,
343
- bn
344
- ]), Yr = f(() => J ? J.beds.reduce((e, t) => e + ge(oe(t), F, K.plantSpacingCm, K.rowSpacingCm), 0) : 0, [
355
+ Qr,
345
356
  J,
346
- F,
347
- K
348
- ]), { data: Xr, loading: Zr, refetch: Qr } = tt(rt, {
357
+ I,
358
+ Sn,
359
+ wn
360
+ ]), li = p(() => K ? null : Y ? Y.beds.reduce((e, t) => e + ye(le(t), I, q.plantSpacingCm, q.rowSpacingCm), 0) : 0, [
361
+ K,
362
+ Y,
363
+ I,
364
+ q
365
+ ]), { data: ui, loading: di, refetch: fi } = at(st, {
349
366
  variables: {
350
- context: { workspaceId: s },
351
- fieldId: j ?? void 0
367
+ context: { workspaceId: c },
368
+ fieldId: M ?? void 0
352
369
  },
353
- skip: !j,
370
+ skip: !M,
354
371
  fetchPolicy: "cache-and-network"
355
- }), Y = f(() => Xr?.healthyBowlBeds ?? [], [Xr]), { data: $r, refetch: ei } = tt(st, {
356
- variables: { context: { workspaceId: s } },
372
+ }), X = p(() => ui?.healthyBowlBeds ?? [], [ui]), { data: pi, refetch: mi } = at(dt, {
373
+ variables: { context: { workspaceId: c } },
357
374
  fetchPolicy: "cache-and-network"
358
- }), ti = f(() => $r?.healthyBowlMapFeatures ?? [], [$r]), ni = f(() => T.get(Vn ?? "") ?? null, [Vn]), ri = u((e) => e ? g.find((t) => t.id === e)?.name ?? null : null, [g]);
359
- d(() => {
360
- let t = Er.current;
361
- t && (t.clearLayers(), k === "view" && (Y.forEach((n) => {
362
- let r = re(n.boundary);
363
- if (!r || !ie(r)) return;
364
- let i = ri(n.cropId), a = w.default.geoJSON(r, { style: () => n.cropId ? Ot : Dt });
365
- a.bindTooltip(q ? e("healthybowl.fieldMapPage.beds.savedTooltip", "{{name}}{{crop}} · {{plants}} plants", {
375
+ }), hi = p(() => pi?.healthyBowlMapFeatures ?? [], [pi]), gi = p(() => E.get(Gn ?? "") ?? null, [Gn]), _i = d((e) => {
376
+ if (!e) return null;
377
+ let t = _.find((t) => t.id === e);
378
+ return t ? ee(t) : `Recorded crop ID ${e} (unavailable)`;
379
+ }, [_]);
380
+ f(() => {
381
+ let t = Ar.current;
382
+ t && (t.clearLayers(), A === "view" && (X.forEach((n) => {
383
+ let r = s(n.boundary);
384
+ if (!r || !se(r)) return;
385
+ let i = _i(n.cropId), a = T.default.geoJSON(r, { style: () => n.cropId ? Mt : jt });
386
+ a.bindTooltip(J ? e("healthybowl.fieldMapPage.beds.savedTooltip", "{{name}}{{crop}} · {{plants}} plants", {
366
387
  name: n.name,
367
388
  crop: i ? ` · ${i}` : "",
368
389
  plants: String(n.plantCount ?? 0)
@@ -373,41 +394,43 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
373
394
  sticky: !0,
374
395
  direction: "top"
375
396
  }), a.on("click", (e) => {
376
- w.default.DomEvent.stopPropagation(e), On(n), An(n.cropId ?? "");
397
+ T.default.DomEvent.stopPropagation(e), Nn(n), Pn(n.cropId ?? "");
377
398
  }), a.addTo(t);
378
- }), hn && J && J.beds.forEach((n) => {
379
- let r = oe(n), i = ge(r, F, K.plantSpacingCm, K.rowSpacingCm), a = w.default.geoJSON(n, { style: () => Et });
380
- a.bindTooltip(e("healthybowl.fieldMapPage.beds.bedTooltip", "{{plants}} plants · {{area}} m²", {
381
- plants: String(i),
399
+ }), yn && Y && Y.beds.forEach((n) => {
400
+ let r = le(n), i = T.default.geoJSON(n, { style: () => At });
401
+ i.bindTooltip(K ? ri : e("healthybowl.fieldMapPage.beds.bedTooltip", "{{plants}} plants · {{area}} m²", {
402
+ plants: String(ye(r, I, q.plantSpacingCm, q.rowSpacingCm)),
382
403
  area: r.toFixed(0)
383
404
  }), {
384
405
  sticky: !0,
385
406
  direction: "top"
386
- }), a.addTo(t);
407
+ }), i.addTo(t);
387
408
  })));
388
409
  }, [
389
- hn,
390
- q,
410
+ yn,
391
411
  J,
392
- F,
393
- K,
394
- k,
395
412
  Y,
413
+ I,
414
+ q,
415
+ K,
396
416
  ri,
417
+ A,
418
+ X,
419
+ _i,
397
420
  e
398
- ]), d(() => {
399
- let t = Dr.current;
400
- t && (t.clearLayers(), Nn && ti.forEach((n) => {
401
- let r = T.get(n.type), i = n.color || r?.color || "#8b5cf6", a = r?.style ?? {
421
+ ]), f(() => {
422
+ let t = jr.current;
423
+ t && (t.clearLayers(), Ln && hi.forEach((n) => {
424
+ let r = E.get(n.type), i = n.color || r?.color || "#8b5cf6", a = r?.style ?? {
402
425
  color: i,
403
426
  weight: 2,
404
427
  fillColor: i,
405
428
  fillOpacity: .25
406
429
  }, o = null;
407
430
  try {
408
- o = w.default.geoJSON(n.geometry, {
431
+ o = T.default.geoJSON(n.geometry, {
409
432
  style: () => a,
410
- pointToLayer: (e, t) => w.default.circleMarker(t, {
433
+ pointToLayer: (e, t) => T.default.circleMarker(t, {
411
434
  radius: 7,
412
435
  color: "#fff",
413
436
  weight: 2,
@@ -424,65 +447,73 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
424
447
  sticky: !0,
425
448
  direction: "top"
426
449
  }), o.on("click", (e) => {
427
- w.default.DomEvent.stopPropagation(e), W.current === "view" && Qn(n);
450
+ T.default.DomEvent.stopPropagation(e), W.current === "view" && nr(n);
428
451
  }), o.addTo(t);
429
452
  }));
430
453
  }, [
431
- ti,
432
- Nn,
454
+ hi,
455
+ Ln,
433
456
  e
434
- ]), d(() => {
435
- let t = Sr.current;
436
- if (!t || (t.clearLayers(), !Fn || !Rr)) return;
437
- let n = w.default.geoJSON(Rr, { style: () => kt });
438
- n.bindTooltip(e("healthybowl.fieldMapPage.farmBoundary.tooltip", "{{name}} · Farm boundary", { name: _?.name ?? "" }), {
457
+ ]), f(() => {
458
+ let t = Er.current;
459
+ if (!t || (t.clearLayers(), !zn || !Gr)) return;
460
+ let n = T.default.geoJSON(Gr, { style: () => Nt });
461
+ n.bindTooltip(e("healthybowl.fieldMapPage.farmBoundary.tooltip", "{{name}} · Farm boundary", { name: v?.name ?? "" }), {
439
462
  sticky: !0,
440
463
  direction: "top"
441
464
  }), n.addTo(t);
442
465
  }, [
443
- Rr,
444
- Fn,
445
- _?.name,
466
+ Gr,
467
+ zn,
468
+ v?.name,
446
469
  e
447
470
  ]);
448
- let ii = u(async () => {
449
- if (!(!G || !J || J.beds.length === 0)) {
450
- if (J.bedCount > ft) {
451
- D({
471
+ let vi = d(async () => {
472
+ if (!(!G || !Y || Y.beds.length === 0)) {
473
+ if (K) {
474
+ O({
475
+ title: e("healthybowl.fieldMapPage.beds.saveFailed.title", "Could not save beds"),
476
+ description: ri,
477
+ variant: "warning"
478
+ });
479
+ return;
480
+ }
481
+ if (Y.bedCount > gt) {
482
+ O({
452
483
  title: e("healthybowl.fieldMapPage.beds.tooMany.title", "Too many beds to save"),
453
484
  description: e("healthybowl.fieldMapPage.beds.tooMany.description", "This layout has {{count}} beds (max {{max}}). Increase the bed width to reduce the count, then save.", {
454
- count: String(J.bedCount),
455
- max: String(ft)
485
+ count: String(Y.bedCount),
486
+ max: String(gt)
456
487
  }),
457
488
  variant: "warning"
458
489
  });
459
490
  return;
460
491
  }
461
- Tn(!0);
492
+ An(!0);
462
493
  try {
463
- await mt(Y, pt, (e) => Ht({ variables: {
494
+ await vt(X, _t, (e) => Kt({ variables: {
464
495
  id: e.id,
465
- context: { workspaceId: s }
496
+ context: { workspaceId: c }
466
497
  } }));
467
- let t = J.beds;
468
- await mt(t.map((e, t) => ({
498
+ let t = Y.beds;
499
+ await vt(t.map((e, t) => ({
469
500
  bed: e,
470
501
  index: t
471
- })), pt, ({ bed: t, index: n }) => {
472
- let r = oe(t), i = ge(r, F, K.plantSpacingCm, K.rowSpacingCm);
473
- return Bt({ variables: { input: {
502
+ })), _t, ({ bed: t, index: n }) => {
503
+ let r = le(t), i = ye(r, I, q.plantSpacingCm, q.rowSpacingCm);
504
+ return Wt({ variables: { input: {
474
505
  fieldId: G.id,
475
506
  name: e("healthybowl.fieldMapPage.beds.bedName", "Bed {{n}}", { n: String(n + 1) }),
476
507
  boundary: t,
477
508
  area: r,
478
509
  unit: "sqm",
479
- widthM: F,
480
- orientationDeg: bn,
481
- cropId: qr?.id ?? void 0,
510
+ widthM: I,
511
+ orientationDeg: wn,
512
+ cropId: L || ni?.id || void 0,
482
513
  plantCount: i,
483
- context: { workspaceId: s }
514
+ context: { workspaceId: c }
484
515
  } } });
485
- }), await Qr(), D({
516
+ }), await fi(), O({
486
517
  title: e("healthybowl.fieldMapPage.beds.saved.title", "Bed layout saved"),
487
518
  description: e("healthybowl.fieldMapPage.beds.saved.description", "Saved {{count}} beds for {{name}}.", {
488
519
  count: String(t.length),
@@ -491,115 +522,121 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
491
522
  variant: "success"
492
523
  });
493
524
  } catch (t) {
494
- D({
525
+ O({
495
526
  title: e("healthybowl.fieldMapPage.beds.saveFailed.title", "Could not save beds"),
496
527
  description: String(t),
497
528
  variant: "error"
498
529
  });
499
530
  } finally {
500
- Tn(!1);
531
+ An(!1);
501
532
  }
502
533
  }
503
534
  }, [
504
- qr,
505
- J,
506
- bn,
535
+ ni,
536
+ L,
507
537
  K,
508
- F,
509
- Bt,
510
- Ht,
511
- Qr,
538
+ ri,
512
539
  Y,
540
+ wn,
541
+ q,
542
+ I,
543
+ Wt,
544
+ Kt,
545
+ fi,
546
+ X,
513
547
  G,
514
548
  e,
515
- D,
516
- s
517
- ]), ai = u(async () => {
518
- if (!(!G || Y.length === 0) && await c({
549
+ O,
550
+ c
551
+ ]), yi = d(async () => {
552
+ if (!(!G || X.length === 0) && await l({
519
553
  title: e("healthybowl.fieldMapPage.beds.clearConfirm.title", "Clear saved beds?"),
520
554
  message: e("healthybowl.fieldMapPage.beds.clearConfirm.description", "This deletes all {{count}} saved beds for {{name}}. You can re-generate and save again.", {
521
- count: String(Y.length),
555
+ count: String(X.length),
522
556
  name: G.name
523
557
  }),
524
558
  okButtonTitle: e("healthybowl.common.delete", "Delete")
525
559
  })) {
526
- Dn(!0);
560
+ Mn(!0);
527
561
  try {
528
- await mt(Y, pt, (e) => Ht({ variables: {
562
+ await vt(X, _t, (e) => Kt({ variables: {
529
563
  id: e.id,
530
- context: { workspaceId: s }
531
- } })), await Qr(), D({
564
+ context: { workspaceId: c }
565
+ } })), await fi(), O({
532
566
  title: e("healthybowl.fieldMapPage.beds.cleared.title", "Saved beds cleared"),
533
567
  description: e("healthybowl.fieldMapPage.beds.cleared.description", "Removed the saved layout."),
534
568
  variant: "success"
535
569
  });
536
570
  } catch (t) {
537
- D({
571
+ O({
538
572
  title: e("healthybowl.fieldMapPage.beds.saveFailed.title", "Could not save beds"),
539
573
  description: String(t),
540
574
  variant: "error"
541
575
  });
542
576
  } finally {
543
- Dn(!1);
577
+ Mn(!1);
544
578
  }
545
579
  }
546
580
  }, [
547
- c,
548
- Ht,
549
- Qr,
550
- Y,
581
+ l,
582
+ Kt,
583
+ fi,
584
+ X,
551
585
  G,
552
586
  e,
553
- D,
554
- s
555
- ]), oi = u(async () => {
556
- if (!I) return;
557
- let t = g.find((e) => e.id === kn) ?? null, n = Oe(t), r = re(I.boundary), i = I.area ?? (r ? oe(r) : 0), a = I.widthM ?? F, o = q ? ge(i, a, n.plantSpacingCm, n.rowSpacingCm) : null;
558
- Mn(!0);
587
+ O,
588
+ c
589
+ ]), bi = d(async () => {
590
+ if (!R) return;
591
+ let t = oi;
592
+ if (z && !t && !si) return;
593
+ let n = je(t), r = s(R.boundary), i = R.area ?? (r ? le(r) : 0), a = R.widthM ?? I, o = z && !t ? R.plantCount : J ? ye(i, a, n.plantSpacingCm, n.rowSpacingCm) : null;
594
+ In(!0);
559
595
  try {
560
- await Vt({ variables: { input: {
561
- id: I.id,
562
- cropId: kn || null,
596
+ await Gt({ variables: { input: {
597
+ id: R.id,
598
+ cropId: z || null,
563
599
  plantCount: o,
564
- context: { workspaceId: s }
565
- } } }), await Qr(), On(null), D({
600
+ context: { workspaceId: c }
601
+ } } }), await fi(), Nn(null), O({
566
602
  title: e("healthybowl.fieldMapPage.beds.assigned.title", "Crop assigned"),
567
- description: t ? o == null ? e("healthybowl.fieldMapPage.beds.assigned.noPlants", "{{bed}}: {{crop}}.", {
568
- bed: I.name,
603
+ description: z && !t ? `${R.name}: recorded crop ID ${z} and plant count retained.` : t ? o == null ? e("healthybowl.fieldMapPage.beds.assigned.noPlants", "{{bed}}: {{crop}}.", {
604
+ bed: R.name,
569
605
  crop: t.name
570
606
  }) : e("healthybowl.fieldMapPage.beds.assigned.description", "{{bed}}: {{crop}} · {{plants}} plants.", {
571
- bed: I.name,
607
+ bed: R.name,
572
608
  crop: t.name,
573
609
  plants: String(o)
574
- }) : e("healthybowl.fieldMapPage.beds.assigned.cleared", "{{bed}}: crop cleared.", { bed: I.name }),
610
+ }) : e("healthybowl.fieldMapPage.beds.assigned.cleared", "{{bed}}: crop cleared.", { bed: R.name }),
575
611
  variant: "success"
576
612
  });
577
613
  } catch (t) {
578
- D({
614
+ O({
579
615
  title: e("healthybowl.fieldMapPage.beds.assignFailed.title", "Could not assign crop"),
580
616
  description: String(t),
581
617
  variant: "error"
582
618
  });
583
619
  } finally {
584
- Mn(!1);
620
+ In(!1);
585
621
  }
586
622
  }, [
623
+ R,
624
+ z,
625
+ oi,
626
+ si,
627
+ J,
587
628
  I,
588
- kn,
589
- q,
590
- F,
591
- g,
592
- Qr,
629
+ fi,
593
630
  e,
594
- D,
595
- Vt,
596
- s
597
- ]), si = u((e) => {
598
- let t = B.current;
631
+ O,
632
+ Gt,
633
+ c
634
+ ]), xi = d((e) => {
635
+ let t = U.current;
599
636
  if (!t) return;
600
- let n = E(e);
637
+ let n = D(e);
601
638
  if (n) try {
602
- let e = w.default.geoJSON(n).getBounds();
639
+ let e = T.default.geoJSON(n).getBounds();
603
640
  if (e.isValid()) {
604
641
  t.fitBounds(e, {
605
642
  padding: [40, 40],
@@ -608,30 +645,30 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
608
645
  return;
609
646
  }
610
647
  } catch {}
611
- At(e.location) && t.flyTo([e.location.lat, e.location.lng], bt, { duration: .6 });
612
- }, []), ci = u((e) => {
613
- W.current === "draw" || W.current === "measure" || (M(e.id), si(e));
614
- }, [si]);
615
- d(() => {
616
- j && document.querySelector(`[data-field-id="${j}"]`)?.scrollIntoView({ block: "nearest" });
617
- }, [j]);
618
- let li = u(() => {
619
- let t = B.current, n = xr.current;
648
+ Pt(e.location) && t.flyTo([e.location.lat, e.location.lng], wt, { duration: .6 });
649
+ }, []), Si = d((e) => {
650
+ W.current === "draw" || W.current === "measure" || (N(e.id), xi(e));
651
+ }, [xi]);
652
+ f(() => {
653
+ M && document.querySelector(`[data-field-id="${M}"]`)?.scrollIntoView({ block: "nearest" });
654
+ }, [M]);
655
+ let Ci = d(() => {
656
+ let t = U.current, n = Tr.current;
620
657
  if (!t || !n) return;
621
658
  n.clearLayers();
622
659
  let r = [];
623
- for (let t of h) {
624
- if (k === "edit" && t.id === j) continue;
625
- let i = t.id === j, a = N[t.id], o = Xt && a != null ? me(a, Vr, Hr) : Jt ? fe(t.soilType) : St, ee = Se(t.type) === "OPEN_FIELD" ? null : l(e, t.type), te = ee ? `${t.name} — ${Nt(t)} · ${ee}` : `${t.name} — ${Nt(t)}`, ne = E(t);
660
+ for (let t of g) {
661
+ if (A === "edit" && t.id === M) continue;
662
+ let i = t.id === M, a = P[t.id], o = en && a != null ? _e(a, Jr, Yr) : Qt ? he(t.soilType) : Et, ee = Te(t.type) === "OPEN_FIELD" ? null : u(e, t.type), te = ee ? `${t.name} — ${Lt(t)} · ${ee}` : `${t.name} — ${Lt(t)}`, ne = D(t);
626
663
  if (ne) {
627
- let e = w.default.geoJSON(ne, { style: () => ({
664
+ let e = T.default.geoJSON(ne, { style: () => ({
628
665
  color: i ? "#ffffff" : o,
629
666
  weight: i ? 5 : 2,
630
667
  opacity: 1,
631
668
  fillColor: o,
632
669
  fillOpacity: i ? .62 : .5
633
670
  }) });
634
- e.on("click", () => M(t.id)), e.bindTooltip(te, {
671
+ e.on("click", () => N(t.id)), e.bindTooltip(te, {
635
672
  permanent: !0,
636
673
  direction: "center",
637
674
  className: "hb-field-label"
@@ -640,117 +677,117 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
640
677
  let t = e.getBounds();
641
678
  t.isValid() && r.push(t);
642
679
  } catch {}
643
- } else if (At(t.location)) {
644
- let a = w.default.circleMarker([t.location.lat, t.location.lng], {
680
+ } else if (Pt(t.location)) {
681
+ let a = T.default.circleMarker([t.location.lat, t.location.lng], {
645
682
  radius: i ? 9 : 7,
646
683
  color: i ? "#ffffff" : "#fff",
647
684
  weight: i ? 3 : 2,
648
685
  fillColor: o,
649
686
  fillOpacity: 1
650
687
  });
651
- a.on("click", () => M(t.id)), a.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
688
+ a.on("click", () => N(t.id)), a.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
652
689
  permanent: !1,
653
690
  direction: "top"
654
- }), a.addTo(n), r.push(w.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
691
+ }), a.addTo(n), r.push(T.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
655
692
  }
656
693
  }
657
- if (!Pr.current) {
694
+ if (!Vr.current) {
658
695
  let e = null;
659
- if (r.length > 0) e = r.reduce((e, t) => e.extend(t), w.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
660
- else if (Rr) try {
661
- let t = w.default.geoJSON(Rr).getBounds();
696
+ if (r.length > 0) e = r.reduce((e, t) => e.extend(t), T.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
697
+ else if (Gr) try {
698
+ let t = T.default.geoJSON(Gr).getBounds();
662
699
  t.isValid() && (e = t);
663
700
  } catch {}
664
701
  if (e) try {
665
702
  t.fitBounds(e, {
666
703
  padding: [40, 40],
667
704
  maxZoom: 17
668
- }), Pr.current = !0;
705
+ }), Vr.current = !0;
669
706
  } catch {}
670
707
  }
671
708
  }, [
672
- h,
673
- k,
674
- j,
675
- Jt,
676
- Xt,
677
- N,
678
- Vr,
679
- Hr,
680
- Rr,
709
+ g,
710
+ A,
711
+ M,
712
+ Qt,
713
+ en,
714
+ P,
715
+ Jr,
716
+ Yr,
717
+ Gr,
681
718
  e
682
719
  ]);
683
- d(() => {
684
- O === "ready" && li();
685
- }, [li, O]);
686
- let X = u(() => {
687
- Cr.current?.clearLayers(), Ar.current = null, U.current = [], sn(0);
688
- }, []), ui = u(() => {
689
- let e = Cr.current;
720
+ f(() => {
721
+ k === "ready" && Ci();
722
+ }, [Ci, k]);
723
+ let Z = d(() => {
724
+ Dr.current?.clearLayers(), Lr.current = null, Ir.current = [], dn(0);
725
+ }, []), wi = d(() => {
726
+ let e = Dr.current;
690
727
  if (!e) return;
691
- Ar.current &&= (e.removeLayer(Ar.current), null);
692
- let t = U.current;
693
- t.length >= 2 && (Ar.current = w.default.polygon(t, Ct).addTo(e));
694
- }, []), di = u(() => {
695
- let t = U.current;
728
+ Lr.current &&= (e.removeLayer(Lr.current), null);
729
+ let t = Ir.current;
730
+ t.length >= 2 && (Lr.current = T.default.polygon(t, Dt).addTo(e));
731
+ }, []), Ti = d(() => {
732
+ let t = Ir.current;
696
733
  if (t.length < 3) {
697
- D({
734
+ O({
698
735
  title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
699
736
  description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
700
737
  variant: "warning"
701
738
  });
702
739
  return;
703
740
  }
704
- let n = W.current === "farm", r = ce(t.map((e) => ({
741
+ let n = W.current === "farm", r = de(t.map((e) => ({
705
742
  lat: e.lat,
706
743
  lng: e.lng
707
744
  })));
708
- if (X(), W.current = "view", A("view"), r) {
745
+ if (Z(), W.current = "view", j("view"), r) {
709
746
  if (n) {
710
- if (!_?.id) return;
711
- Rn(!0), xt({
712
- id: _.id,
747
+ if (!v?.id) return;
748
+ Hn(!0), Tt({
749
+ id: v.id,
713
750
  boundary: r
714
751
  }).then(() => {
715
- D({
752
+ O({
716
753
  title: e("healthybowl.fieldMapPage.toast.farmBoundarySaved.title", "Farm outline saved"),
717
754
  description: e("healthybowl.fieldMapPage.toast.farmBoundarySaved.description", "The dashed ring now wraps your fields on the map."),
718
755
  variant: "success"
719
756
  });
720
757
  }).catch((t) => {
721
- D({
758
+ O({
722
759
  title: e("healthybowl.fieldMapPage.toast.farmBoundarySaveFailed.title", "Could not save the farm outline"),
723
760
  description: t instanceof Error ? t.message : String(t),
724
761
  variant: "error"
725
762
  });
726
- }).finally(() => Rn(!1));
763
+ }).finally(() => Hn(!1));
727
764
  return;
728
765
  }
729
- tr({
766
+ ar({
730
767
  boundary: r,
731
- area: ae(r, "acres"),
732
- centroid: se(r) ?? [0, 0]
733
- }), ar(""), sr("Clay loam"), lr("Drip"), dr("active"), pr(be), _r(null);
768
+ area: ce(r, "acres"),
769
+ centroid: ue(r) ?? [0, 0]
770
+ }), lr(""), dr("Clay loam"), pr("Drip"), hr("active"), _r(Ce), xr(null);
734
771
  }
735
772
  }, [
736
- X,
737
- _?.id,
773
+ Z,
774
+ v?.id,
738
775
  e,
739
- D,
740
- xt
741
- ]), fi = u(() => {
742
- M(null), X(), W.current = "draw", A("draw");
743
- }, [X]), pi = u(() => {
744
- M(null), X(), W.current = "farm", A("farm");
745
- }, [X]), mi = u(() => {
746
- X(), W.current = "view", A("view");
747
- }, [X]), hi = u(() => {
748
- let e = U.current;
776
+ O,
777
+ Tt
778
+ ]), Ei = d(() => {
779
+ N(null), Z(), W.current = "draw", j("draw");
780
+ }, [Z]), Di = d(() => {
781
+ N(null), Z(), W.current = "farm", j("farm");
782
+ }, [Z]), Oi = d(() => {
783
+ Z(), W.current = "view", j("view");
784
+ }, [Z]), ki = d(() => {
785
+ let e = Ir.current;
749
786
  if (e.length === 0) return;
750
787
  e.pop();
751
- let t = Cr.current;
752
- t && (t.clearLayers(), Ar.current = null, e.forEach((e, n) => {
753
- let r = n === 0, i = w.default.circleMarker(e, {
788
+ let t = Dr.current;
789
+ t && (t.clearLayers(), Lr.current = null, e.forEach((e, n) => {
790
+ let r = n === 0, i = T.default.circleMarker(e, {
754
791
  radius: r ? 7 : 5,
755
792
  color: "#fff",
756
793
  weight: 2,
@@ -758,38 +795,38 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
758
795
  fillOpacity: 1
759
796
  }).addTo(t);
760
797
  r && i.on("click", (e) => {
761
- w.default.DomEvent.stopPropagation(e), di();
798
+ T.default.DomEvent.stopPropagation(e), Ti();
762
799
  });
763
- }), ui()), sn(e.length);
764
- }, [di, ui]);
765
- d(() => {
766
- if (k !== "draw") return;
800
+ }), wi()), dn(e.length);
801
+ }, [Ti, wi]);
802
+ f(() => {
803
+ if (A !== "draw") return;
767
804
  let e = (e) => {
768
805
  let t = e.target;
769
- t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable) || (e.key === "Backspace" || e.key === "Delete" ? (e.preventDefault(), hi()) : e.key === "Escape" && (e.preventDefault(), mi()));
806
+ t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable) || (e.key === "Backspace" || e.key === "Delete" ? (e.preventDefault(), ki()) : e.key === "Escape" && (e.preventDefault(), Oi()));
770
807
  };
771
808
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
772
809
  }, [
773
- k,
774
- hi,
775
- mi
810
+ A,
811
+ ki,
812
+ Oi
776
813
  ]);
777
- let gi = u(() => {
778
- wr.current?.clearLayers(), Mr.current = null, jr.current = [], ln(null), dn(!1);
779
- }, []), _i = u(() => {
780
- if (!wr.current || !Mr.current) return;
781
- Mr.current.setLatLngs(jr.current);
782
- let e = ce(jr.current.map((e) => ({
814
+ let Ai = d(() => {
815
+ Or.current?.clearLayers(), zr.current = null, Rr.current = [], pn(null), hn(!1);
816
+ }, []), ji = d(() => {
817
+ if (!Or.current || !zr.current) return;
818
+ zr.current.setLatLngs(Rr.current);
819
+ let e = de(Rr.current.map((e) => ({
783
820
  lat: e.lat,
784
821
  lng: e.lng
785
822
  })));
786
- e && ln(ae(e, G?.unit ?? "acres"));
787
- }, [G]), vi = u(() => {
788
- let t = B.current, n = wr.current;
823
+ e && pn(ce(e, G?.unit ?? "acres"));
824
+ }, [G]), Mi = d(() => {
825
+ let t = U.current, n = Or.current;
789
826
  if (!t || !n || !G) return;
790
- let r = E(G);
827
+ let r = D(G);
791
828
  if (!r) {
792
- D({
829
+ O({
793
830
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
794
831
  description: e("healthybowl.fieldMapPage.toast.noBoundary.description", "Draw a boundary for this field first."),
795
832
  variant: "warning"
@@ -797,38 +834,38 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
797
834
  return;
798
835
  }
799
836
  n.clearLayers();
800
- let i = r.coordinates[0].slice(0, -1).map(([e, t]) => w.default.latLng(t, e));
801
- jr.current = i, Mr.current = w.default.polygon(i, wt).addTo(n), i.forEach((e, t) => {
802
- w.default.marker(i[t], {
803
- icon: Pt,
837
+ let i = r.coordinates[0].slice(0, -1).map(([e, t]) => T.default.latLng(t, e));
838
+ Rr.current = i, zr.current = T.default.polygon(i, Ot).addTo(n), i.forEach((e, t) => {
839
+ T.default.marker(i[t], {
840
+ icon: Rt,
804
841
  draggable: !0
805
842
  }).addTo(n).on("drag", (e) => {
806
- jr.current[t] = e.target.getLatLng(), _i(), dn(!0);
843
+ Rr.current[t] = e.target.getLatLng(), ji(), hn(!0);
807
844
  });
808
- }), W.current = "edit", A("edit"), dn(!1), ln(ae(r, G.unit));
845
+ }), W.current = "edit", j("edit"), hn(!1), pn(ce(r, G.unit));
809
846
  }, [
810
- _i,
847
+ ji,
811
848
  G,
812
849
  e,
813
- D
814
- ]), yi = u(() => {
815
- gi(), W.current = "view", A("view"), li();
816
- }, [gi, li]), bi = u(async () => {
850
+ O
851
+ ]), Ni = d(() => {
852
+ Ai(), W.current = "view", j("view"), Ci();
853
+ }, [Ai, Ci]), Pi = d(async () => {
817
854
  if (!G) return;
818
- let t = ce(jr.current.map((e) => ({
855
+ let t = de(Rr.current.map((e) => ({
819
856
  lat: e.lat,
820
857
  lng: e.lng
821
858
  })));
822
859
  if (t) {
823
- pn(!0);
860
+ _n(!0);
824
861
  try {
825
- let n = ae(t, G.unit);
826
- await zt({ variables: { input: {
862
+ let n = ce(t, G.unit);
863
+ await Ut({ variables: { input: {
827
864
  id: G.id,
828
865
  boundary: t,
829
866
  area: n,
830
- context: { workspaceId: s }
831
- } } }), await v(), gi(), W.current = "view", A("view"), D({
867
+ context: { workspaceId: c }
868
+ } } }), await y(), Ai(), W.current = "view", j("view"), O({
832
869
  title: e("healthybowl.fieldMapPage.toast.saved.title", "Boundary saved"),
833
870
  description: e("healthybowl.fieldMapPage.toast.saved.description", "Area updated to {{area}} {{unit}}.", {
834
871
  area: String(n),
@@ -837,49 +874,49 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
837
874
  variant: "success"
838
875
  });
839
876
  } catch (t) {
840
- D({
877
+ O({
841
878
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
842
879
  description: String(t),
843
880
  variant: "error"
844
881
  });
845
882
  } finally {
846
- pn(!1);
883
+ _n(!1);
847
884
  }
848
885
  }
849
886
  }, [
850
- gi,
851
- v,
887
+ Ai,
888
+ y,
852
889
  G,
853
890
  e,
854
- D,
855
- zt,
856
- s
857
- ]), xi = u(async () => {
891
+ O,
892
+ Ut,
893
+ c
894
+ ]), Fi = d(async () => {
858
895
  if (G) {
859
- if (!E(G)) {
860
- D({
896
+ if (!D(G)) {
897
+ O({
861
898
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
862
899
  description: e("healthybowl.fieldMapPage.toast.deleteNone.description", "This field has no boundary to delete."),
863
900
  variant: "warning"
864
901
  });
865
902
  return;
866
903
  }
867
- if (await c({
904
+ if (await l({
868
905
  title: e("healthybowl.fieldMapPage.confirmDelete.title", "Delete boundary?"),
869
906
  message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: G.name }),
870
907
  okButtonTitle: e("healthybowl.common.delete", "Delete")
871
908
  })) try {
872
- await zt({ variables: { input: {
909
+ await Ut({ variables: { input: {
873
910
  id: G.id,
874
911
  boundary: null,
875
- context: { workspaceId: s }
876
- } } }), await v(), D({
912
+ context: { workspaceId: c }
913
+ } } }), await y(), O({
877
914
  title: e("healthybowl.fieldMapPage.toast.boundaryDeleted.title", "Boundary removed"),
878
915
  description: e("healthybowl.fieldMapPage.toast.boundaryDeleted.description", "The drawn shape was cleared."),
879
916
  variant: "success"
880
917
  });
881
918
  } catch (t) {
882
- D({
919
+ O({
883
920
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
884
921
  description: String(t),
885
922
  variant: "error"
@@ -887,90 +924,90 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
887
924
  }
888
925
  }
889
926
  }, [
890
- c,
891
- v,
927
+ l,
928
+ y,
892
929
  G,
893
930
  e,
894
- D,
895
- zt,
896
- s
897
- ]), Z = u(() => {
898
- Tr.current?.clearLayers(), Nr.current = [], mn(null);
899
- }, []), Si = u(() => {
900
- let e = Tr.current;
931
+ O,
932
+ Ut,
933
+ c
934
+ ]), Ii = d(() => {
935
+ kr.current?.clearLayers(), Br.current = [], vn(null);
936
+ }, []), Li = d(() => {
937
+ let e = kr.current;
901
938
  if (!e) return;
902
939
  e.clearLayers();
903
- let t = Nr.current;
940
+ let t = Br.current;
904
941
  t.forEach((t) => {
905
- w.default.circleMarker(t, {
942
+ T.default.circleMarker(t, {
906
943
  radius: 4,
907
944
  color: "#38bdf8",
908
945
  weight: 2,
909
946
  fillColor: "#fff",
910
947
  fillOpacity: 1
911
948
  }).addTo(e);
912
- }), t.length >= 2 && w.default.polyline(t, Tt).addTo(e);
949
+ }), t.length >= 2 && T.default.polyline(t, kt).addTo(e);
913
950
  let n = 0;
914
951
  for (let e = 1; e < t.length; e++) n += t[e - 1].distanceTo(t[e]);
915
952
  let r = null;
916
953
  if (t.length >= 3) {
917
- let e = ce(t.map((e) => ({
954
+ let e = de(t.map((e) => ({
918
955
  lat: e.lat,
919
956
  lng: e.lng
920
957
  })));
921
- e && (r = oe(e));
958
+ e && (r = le(e));
922
959
  }
923
- mn({
960
+ vn({
924
961
  distance: n,
925
962
  area: r
926
963
  });
927
- }, []), Ci = u(() => {
928
- M(null), Z(), W.current = "measure", A("measure"), mn({
964
+ }, []), Ri = d(() => {
965
+ N(null), Ii(), W.current = "measure", j("measure"), vn({
929
966
  distance: 0,
930
967
  area: null
931
968
  });
932
- }, [Z]), wi = u(() => {
933
- Z(), W.current = "view", A("view");
934
- }, [Z]), Ti = u(() => {
935
- Or.current?.clearLayers(), kr.current = null, V.current = [], Wn(0);
936
- }, []), Ei = u(() => {
937
- let e = Or.current, t = T.get(H.current ?? "");
969
+ }, [Ii]), zi = d(() => {
970
+ Ii(), W.current = "view", j("view");
971
+ }, [Ii]), Bi = d(() => {
972
+ Mr.current?.clearLayers(), Pr.current = null, Nr.current = [], Jn(0);
973
+ }, []), Vi = d(() => {
974
+ let e = Mr.current, t = E.get(Fr.current ?? "");
938
975
  if (!e || !t) return;
939
- kr.current &&= (e.removeLayer(kr.current), null);
940
- let n = V.current;
941
- t.kind === "polygon" && n.length >= 2 ? kr.current = w.default.polygon(n, {
976
+ Pr.current &&= (e.removeLayer(Pr.current), null);
977
+ let n = Nr.current;
978
+ t.kind === "polygon" && n.length >= 2 ? Pr.current = T.default.polygon(n, {
942
979
  ...t.style,
943
980
  dashArray: "6 4"
944
- }).addTo(e) : t.kind === "line" && n.length >= 2 && (kr.current = w.default.polyline(n, {
981
+ }).addTo(e) : t.kind === "line" && n.length >= 2 && (Pr.current = T.default.polyline(n, {
945
982
  ...t.style,
946
983
  dashArray: "6 4"
947
984
  }).addTo(e));
948
- }, []), Di = u((e, t) => {
949
- Ti(), Hn(null), H.current = null, W.current = "view", A("view"), qn(""), Yn(""), Gn({
985
+ }, []), Hi = d((e, t) => {
986
+ Bi(), Kn(null), Fr.current = null, W.current = "view", j("view"), Zn(""), $n(""), Yn({
950
987
  type: e,
951
988
  geometry: t
952
989
  });
953
- }, [Ti]), Oi = u(() => {
954
- let t = T.get(H.current ?? "");
990
+ }, [Bi]), Ui = d(() => {
991
+ let t = E.get(Fr.current ?? "");
955
992
  if (!t) return;
956
- let n = V.current;
993
+ let n = Nr.current;
957
994
  if (t.kind === "polygon") {
958
995
  if (n.length < 3) {
959
- D({
996
+ O({
960
997
  title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
961
998
  description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
962
999
  variant: "warning"
963
1000
  });
964
1001
  return;
965
1002
  }
966
- let r = ce(n.map((e) => ({
1003
+ let r = de(n.map((e) => ({
967
1004
  lat: e.lat,
968
1005
  lng: e.lng
969
1006
  })));
970
- r && Di(t.type, r);
1007
+ r && Hi(t.type, r);
971
1008
  } else if (t.kind === "line") {
972
1009
  if (n.length < 2) {
973
- D({
1010
+ O({
974
1011
  title: e("healthybowl.fieldMapPage.toast.needLine.title", "Need at least 2 points"),
975
1012
  description: e("healthybowl.fieldMapPage.toast.needLine.description", "Click the map to add more points."),
976
1013
  variant: "warning"
@@ -981,314 +1018,314 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
981
1018
  type: "LineString",
982
1019
  coordinates: n.map((e) => [e.lng, e.lat])
983
1020
  };
984
- Di(t.type, r);
1021
+ Hi(t.type, r);
985
1022
  }
986
1023
  }, [
987
- Di,
1024
+ Hi,
988
1025
  e,
989
- D
990
- ]), ki = u((e) => {
991
- X(), gi(), Z(), Ti(), M(null), Qn(null), Bn(!1), T.has(e) && (Hn(e), H.current = e, W.current = "element", A("element"));
1026
+ O
1027
+ ]), Wi = d((e) => {
1028
+ Z(), Ai(), Ii(), Bi(), N(null), nr(null), Wn(!1), E.has(e) && (Kn(e), Fr.current = e, W.current = "element", j("element"));
992
1029
  }, [
993
- X,
994
- gi,
995
1030
  Z,
996
- Ti
997
- ]), Ai = u(() => {
998
- Ti(), Hn(null), H.current = null, W.current = "view", A("view");
999
- }, [Ti]), ji = u((e) => {
1000
- if (B.current) {
1031
+ Ai,
1032
+ Ii,
1033
+ Bi
1034
+ ]), Gi = d(() => {
1035
+ Bi(), Kn(null), Fr.current = null, W.current = "view", j("view");
1036
+ }, [Bi]), Ki = d((e) => {
1037
+ if (U.current) {
1001
1038
  if (W.current === "element") {
1002
- let t = T.get(H.current ?? "");
1039
+ let t = E.get(Fr.current ?? "");
1003
1040
  if (!t) return;
1004
1041
  if (t.kind === "point") {
1005
- Di(t.type, {
1042
+ Hi(t.type, {
1006
1043
  type: "Point",
1007
1044
  coordinates: [e.latlng.lng, e.latlng.lat]
1008
1045
  });
1009
1046
  return;
1010
1047
  }
1011
- V.current.push(e.latlng);
1012
- let n = V.current.length === 1, r = w.default.circleMarker(e.latlng, {
1048
+ Nr.current.push(e.latlng);
1049
+ let n = Nr.current.length === 1, r = T.default.circleMarker(e.latlng, {
1013
1050
  radius: n ? 7 : 5,
1014
1051
  color: "#fff",
1015
1052
  weight: 2,
1016
1053
  fillColor: t.color,
1017
1054
  fillOpacity: 1
1018
- }).addTo(Or.current);
1055
+ }).addTo(Mr.current);
1019
1056
  n && t.kind === "polygon" && r.on("click", (e) => {
1020
- w.default.DomEvent.stopPropagation(e), Oi();
1021
- }), Wn(V.current.length), Ei();
1057
+ T.default.DomEvent.stopPropagation(e), Ui();
1058
+ }), Jn(Nr.current.length), Vi();
1022
1059
  return;
1023
1060
  }
1024
1061
  if (W.current === "draw" || W.current === "farm") {
1025
- U.current.push(e.latlng);
1026
- let t = U.current.length === 1, n = w.default.circleMarker(e.latlng, {
1062
+ Ir.current.push(e.latlng);
1063
+ let t = Ir.current.length === 1, n = T.default.circleMarker(e.latlng, {
1027
1064
  radius: t ? 7 : 5,
1028
1065
  color: "#fff",
1029
1066
  weight: 2,
1030
1067
  fillColor: t ? "#16a34a" : "#f59e0b",
1031
1068
  fillOpacity: 1
1032
- }).addTo(Cr.current);
1069
+ }).addTo(Dr.current);
1033
1070
  t && n.on("click", (e) => {
1034
- w.default.DomEvent.stopPropagation(e), di();
1035
- }), sn(U.current.length), ui();
1036
- } else W.current === "measure" && (Nr.current.push(e.latlng), Si());
1071
+ T.default.DomEvent.stopPropagation(e), Ti();
1072
+ }), dn(Ir.current.length), wi();
1073
+ } else W.current === "measure" && (Br.current.push(e.latlng), Li());
1037
1074
  }
1038
1075
  }, [
1039
- di,
1040
- Si,
1041
- ui,
1042
- Di,
1043
- Oi,
1044
- Ei
1045
- ]), Mi = u(async (n) => {
1076
+ Ti,
1077
+ Li,
1078
+ wi,
1079
+ Hi,
1080
+ Ui,
1081
+ Vi
1082
+ ]), qi = d(async (n) => {
1046
1083
  n.preventDefault();
1047
- let r = B.current, i = tn.trim();
1084
+ let r = U.current, i = on.trim();
1048
1085
  if (!r || !i) return;
1049
1086
  let a = i.match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
1050
1087
  if (a) {
1051
- r.flyTo([Number(a[1]), Number(a[2])], bt, { duration: .6 });
1088
+ r.flyTo([Number(a[1]), Number(a[2])], wt, { duration: .6 });
1052
1089
  return;
1053
1090
  }
1054
- an(!0);
1091
+ ln(!0);
1055
1092
  try {
1056
1093
  let n = await t(i);
1057
1094
  if (!n) {
1058
- D({
1095
+ O({
1059
1096
  title: e("healthybowl.fieldMapPage.toast.placeNotFound.title", "Place not found"),
1060
1097
  description: e("healthybowl.fieldMapPage.toast.placeNotFound.description", "Try a more specific place name."),
1061
1098
  variant: "warning"
1062
1099
  });
1063
1100
  return;
1064
1101
  }
1065
- r.flyTo([n.latitude, n.longitude], bt, { duration: .6 });
1102
+ r.flyTo([n.latitude, n.longitude], wt, { duration: .6 });
1066
1103
  } catch (t) {
1067
- D({
1104
+ O({
1068
1105
  title: e("healthybowl.fieldMapPage.toast.searchFailed.title", "Search failed"),
1069
1106
  description: t instanceof Error ? t.message : String(t),
1070
1107
  variant: "error"
1071
1108
  });
1072
1109
  } finally {
1073
- an(!1);
1110
+ ln(!1);
1074
1111
  }
1075
1112
  }, [
1076
- tn,
1113
+ on,
1077
1114
  e,
1078
- D
1079
- ]), Ni = u(async () => {
1080
- if (z) {
1081
- if (!ir.trim()) {
1082
- D({
1115
+ O
1116
+ ]), Ji = d(async () => {
1117
+ if (H) {
1118
+ if (!cr.trim()) {
1119
+ O({
1083
1120
  title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
1084
1121
  description: e("healthybowl.fieldMapPage.toast.nameRequired.description", "Give the new field a name."),
1085
1122
  variant: "warning"
1086
1123
  });
1087
1124
  return;
1088
1125
  }
1089
- rr(!0);
1126
+ sr(!0);
1090
1127
  try {
1091
- let [t, n] = z.centroid, r = await C({
1092
- name: ir.trim(),
1093
- area: z.area,
1128
+ let [t, n] = H.centroid, r = await w({
1129
+ name: cr.trim(),
1130
+ area: H.area,
1094
1131
  unit: "acres",
1095
- soilType: or,
1096
- irrigationType: cr,
1132
+ soilType: ur,
1133
+ irrigationType: fr,
1097
1134
  organicCertified: !1,
1098
- status: ur,
1099
- type: fr,
1100
- growGeometry: Te(fr, mr),
1135
+ status: mr,
1136
+ type: gr,
1137
+ growGeometry: Oe(gr, vr),
1101
1138
  crops: [],
1102
1139
  location: {
1103
1140
  lat: t,
1104
1141
  lng: n
1105
1142
  }
1106
1143
  });
1107
- r?.id && await zt({ variables: { input: {
1144
+ r?.id && await Ut({ variables: { input: {
1108
1145
  id: r.id,
1109
- boundary: z.boundary,
1110
- area: z.area,
1111
- context: { workspaceId: s }
1112
- } } }), gr && (await Wt({ variables: {
1113
- id: gr.id,
1114
- context: { workspaceId: s }
1115
- } }), await ei()), await v(), tr(null), _r(null), r?.id && M(r.id), D({
1146
+ boundary: H.boundary,
1147
+ area: H.area,
1148
+ context: { workspaceId: c }
1149
+ } } }), br && (await Jt({ variables: {
1150
+ id: br.id,
1151
+ context: { workspaceId: c }
1152
+ } }), await mi()), await y(), ar(null), xr(null), r?.id && N(r.id), O({
1116
1153
  title: e("healthybowl.fieldMapPage.toast.fieldCreated.title", "Field created"),
1117
1154
  description: e("healthybowl.fieldMapPage.toast.fieldCreated.description", "{{name}} saved at {{area}} acres.", {
1118
- name: ir.trim(),
1119
- area: String(z.area)
1155
+ name: cr.trim(),
1156
+ area: String(H.area)
1120
1157
  }),
1121
1158
  variant: "success"
1122
1159
  });
1123
1160
  } catch (t) {
1124
1161
  let n = t instanceof Error ? t.message : String(t), r = /unexpected error/i.test(n) ? e("healthybowl.fieldMapPage.toast.createFailed.quotaHint", "This can happen when your workspace has reached its active-fields limit. Free up a field, or ask an admin to raise the quota, then try again.") : n;
1125
- D({
1162
+ O({
1126
1163
  title: e("healthybowl.fieldMapPage.toast.createFailed.title", "Create failed"),
1127
1164
  description: r,
1128
1165
  variant: "error"
1129
1166
  });
1130
1167
  } finally {
1131
- rr(!1);
1168
+ sr(!1);
1132
1169
  }
1133
1170
  }
1134
1171
  }, [
1135
- C,
1136
- Wt,
1172
+ w,
1173
+ Jt,
1174
+ fr,
1137
1175
  cr,
1138
- ir,
1139
- mr,
1140
- or,
1176
+ vr,
1141
1177
  ur,
1142
- fr,
1143
- z,
1178
+ mr,
1144
1179
  gr,
1145
- v,
1146
- ei,
1180
+ H,
1181
+ br,
1182
+ y,
1183
+ mi,
1147
1184
  e,
1148
- D,
1149
- zt,
1150
- s
1151
- ]), Pi = u(async () => {
1152
- if (!L) return;
1153
- if (!Kn.trim()) {
1154
- D({
1185
+ O,
1186
+ Ut,
1187
+ c
1188
+ ]), Yi = d(async () => {
1189
+ if (!B) return;
1190
+ if (!Xn.trim()) {
1191
+ O({
1155
1192
  title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
1156
1193
  description: e("healthybowl.fieldMapPage.elements.nameRequired", "Give this map element a name."),
1157
1194
  variant: "warning"
1158
1195
  });
1159
1196
  return;
1160
1197
  }
1161
- let t = T.get(L.type);
1162
- Zn(!0);
1198
+ let t = E.get(B.type);
1199
+ tr(!0);
1163
1200
  try {
1164
- await Ut({ variables: { input: {
1165
- name: Kn.trim(),
1166
- type: L.type,
1167
- geometry: L.geometry,
1168
- notes: Jn.trim() || void 0,
1201
+ await qt({ variables: { input: {
1202
+ name: Xn.trim(),
1203
+ type: B.type,
1204
+ geometry: B.geometry,
1205
+ notes: Qn.trim() || void 0,
1169
1206
  color: t?.color,
1170
- context: { workspaceId: s }
1171
- } } }), await ei(), Gn(null), D({
1207
+ context: { workspaceId: c }
1208
+ } } }), await mi(), Yn(null), O({
1172
1209
  title: e("healthybowl.fieldMapPage.elements.saved.title", "Map element added"),
1173
- description: e("healthybowl.fieldMapPage.elements.saved.description", "{{name}} saved to the map.", { name: Kn.trim() }),
1210
+ description: e("healthybowl.fieldMapPage.elements.saved.description", "{{name}} saved to the map.", { name: Xn.trim() }),
1174
1211
  variant: "success"
1175
1212
  });
1176
1213
  } catch (t) {
1177
- D({
1214
+ O({
1178
1215
  title: e("healthybowl.fieldMapPage.elements.saveFailed.title", "Could not add element"),
1179
1216
  description: String(t),
1180
1217
  variant: "error"
1181
1218
  });
1182
1219
  } finally {
1183
- Zn(!1);
1220
+ tr(!1);
1184
1221
  }
1185
1222
  }, [
1186
- Ut,
1187
- Kn,
1188
- Jn,
1189
- L,
1190
- ei,
1223
+ qt,
1224
+ Xn,
1225
+ Qn,
1226
+ B,
1227
+ mi,
1191
1228
  e,
1192
- D,
1193
- s
1194
- ]), Fi = u(async () => {
1195
- if (R && await c({
1229
+ O,
1230
+ c
1231
+ ]), Xi = d(async () => {
1232
+ if (V && await l({
1196
1233
  title: e("healthybowl.fieldMapPage.elements.deleteConfirm.title", "Delete map element?"),
1197
- message: e("healthybowl.fieldMapPage.elements.deleteConfirm.description", "This removes {{name}} from the map. This cannot be undone.", { name: R.name }),
1234
+ message: e("healthybowl.fieldMapPage.elements.deleteConfirm.description", "This removes {{name}} from the map. This cannot be undone.", { name: V.name }),
1198
1235
  okButtonTitle: e("healthybowl.common.delete", "Delete")
1199
1236
  })) {
1200
- er(!0);
1237
+ ir(!0);
1201
1238
  try {
1202
- await Wt({ variables: {
1203
- id: R.id,
1204
- context: { workspaceId: s }
1205
- } }), await ei(), Qn(null), D({
1239
+ await Jt({ variables: {
1240
+ id: V.id,
1241
+ context: { workspaceId: c }
1242
+ } }), await mi(), nr(null), O({
1206
1243
  title: e("healthybowl.fieldMapPage.elements.deleted.title", "Map element removed"),
1207
1244
  description: e("healthybowl.fieldMapPage.elements.deleted.description", "The element was deleted."),
1208
1245
  variant: "success"
1209
1246
  });
1210
1247
  } catch (t) {
1211
- D({
1248
+ O({
1212
1249
  title: e("healthybowl.fieldMapPage.elements.deleteFailed.title", "Could not delete element"),
1213
1250
  description: String(t),
1214
1251
  variant: "error"
1215
1252
  });
1216
1253
  } finally {
1217
- er(!1);
1254
+ ir(!1);
1218
1255
  }
1219
1256
  }
1220
1257
  }, [
1221
- c,
1222
- Wt,
1223
- ei,
1224
- R,
1258
+ l,
1259
+ Jt,
1260
+ mi,
1261
+ V,
1225
1262
  e,
1226
- D,
1227
- s
1263
+ O,
1264
+ c
1228
1265
  ]);
1229
- d(() => {
1230
- let e = vr.current;
1266
+ f(() => {
1267
+ let e = Sr.current;
1231
1268
  if (!e) return;
1232
- ue();
1233
- let t = w.default.tileLayer(ht, {
1234
- attribution: gt,
1235
- maxZoom: yt,
1269
+ pe();
1270
+ let t = T.default.tileLayer(yt, {
1271
+ attribution: bt,
1272
+ maxZoom: Ct,
1236
1273
  maxNativeZoom: 18
1237
- }), n = w.default.tileLayer(_t, {
1238
- attribution: vt,
1239
- maxZoom: yt,
1274
+ }), n = T.default.tileLayer(xt, {
1275
+ attribution: St,
1276
+ maxZoom: Ct,
1240
1277
  maxNativeZoom: 17,
1241
1278
  opacity: .65
1242
1279
  });
1243
- yr.current = t, br.current = n;
1244
- let r = w.default.map(e, {
1280
+ Cr.current = t, wr.current = n;
1281
+ let r = T.default.map(e, {
1245
1282
  center: [20, 78],
1246
1283
  zoom: 4,
1247
1284
  scrollWheelZoom: !0,
1248
- maxZoom: yt,
1285
+ maxZoom: Ct,
1249
1286
  layers: [t]
1250
1287
  });
1251
- return B.current = r, Sr.current = w.default.layerGroup().addTo(r), xr.current = w.default.layerGroup().addTo(r), Er.current = w.default.layerGroup().addTo(r), Dr.current = w.default.layerGroup().addTo(r), Cr.current = w.default.layerGroup().addTo(r), wr.current = w.default.layerGroup().addTo(r), Tr.current = w.default.layerGroup().addTo(r), Or.current = w.default.layerGroup().addTo(r), r.on("click", ji), Gt("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
1252
- r.off("click", ji), r.remove(), B.current = null, yr.current = null, br.current = null, Sr.current = null, xr.current = null, Er.current = null, Dr.current = null, Cr.current = null, wr.current = null, Tr.current = null, Or.current = null;
1288
+ return U.current = r, Er.current = T.default.layerGroup().addTo(r), Tr.current = T.default.layerGroup().addTo(r), Ar.current = T.default.layerGroup().addTo(r), jr.current = T.default.layerGroup().addTo(r), Dr.current = T.default.layerGroup().addTo(r), Or.current = T.default.layerGroup().addTo(r), kr.current = T.default.layerGroup().addTo(r), Mr.current = T.default.layerGroup().addTo(r), r.on("click", Ki), Yt("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
1289
+ r.off("click", Ki), r.remove(), U.current = null, Cr.current = null, wr.current = null, Er.current = null, Tr.current = null, Ar.current = null, jr.current = null, Dr.current = null, Or.current = null, kr.current = null, Mr.current = null;
1253
1290
  };
1254
- }, []), d(() => {
1255
- let e = B.current, t = br.current;
1256
- !e || !t || (Kt ? t.addTo(e) : e.removeLayer(t));
1257
- }, [Kt]);
1258
- let Q = L ? T.get(L.type) ?? null : null, $ = R ? T.get(R.type) ?? null : null, Ii = R ? re(R.geometry) : null, Li = !!($?.promotesTo && Ii), Ri = u(() => {
1259
- if (!R || !$?.promotesTo) return;
1260
- let e = re(R.geometry);
1261
- e && (tr({
1291
+ }, []), f(() => {
1292
+ let e = U.current, t = wr.current;
1293
+ !e || !t || (Xt ? t.addTo(e) : e.removeLayer(t));
1294
+ }, [Xt]);
1295
+ let Q = B ? E.get(B.type) ?? null : null, $ = V ? E.get(V.type) ?? null : null, Zi = V ? s(V.geometry) : null, Qi = !!($?.promotesTo && Zi), $i = d(() => {
1296
+ if (!V || !$?.promotesTo) return;
1297
+ let e = s(V.geometry);
1298
+ e && (ar({
1262
1299
  boundary: e,
1263
- area: ae(e, "acres"),
1264
- centroid: se(e) ?? [0, 0]
1265
- }), ar(R.name), sr("Clay loam"), lr("Drip"), dr("active"), pr($.promotesTo), _r(R), Qn(null));
1266
- }, [R, $]), zi = !We.crops && h.length === 0, Bi = P ? P.distance >= 1e3 ? `${(P.distance / 1e3).toFixed(2)} km` : `${P.distance.toFixed(0)} m` : "";
1267
- if (Ke.crops && h.length === 0) return /* @__PURE__ */ y(r, {
1300
+ area: ce(e, "acres"),
1301
+ centroid: ue(e) ?? [0, 0]
1302
+ }), lr(V.name), dr("Clay loam"), pr("Drip"), hr("active"), _r($.promotesTo), xr(V), nr(null));
1303
+ }, [V, $]), ea = !Je.crops && g.length === 0, ta = F ? F.distance >= 1e3 ? `${(F.distance / 1e3).toFixed(2)} km` : `${F.distance.toFixed(0)} m` : "";
1304
+ if (Xe.crops && g.length === 0) return /* @__PURE__ */ b(r, {
1268
1305
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
1269
1306
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1270
1307
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1271
- children: /* @__PURE__ */ y(o, { onRetry: v })
1308
+ children: /* @__PURE__ */ b(re, { onRetry: y })
1272
1309
  });
1273
- if (!We.dashboard && !Rt) return /* @__PURE__ */ y(r, {
1310
+ if (!Je.dashboard && !Ht) return /* @__PURE__ */ b(r, {
1274
1311
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
1275
1312
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1276
1313
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1277
- children: /* @__PURE__ */ y(a, {
1314
+ children: /* @__PURE__ */ b(ne, {
1278
1315
  illustration: "onboarding",
1279
1316
  title: e("healthybowl.fieldMapPage.noFarm.title", "Set up your farm first"),
1280
1317
  description: e("healthybowl.fieldMapPage.noFarm.description", "The Field Map attaches every boundary you draw to your farm. Create your farm, then come back to trace and save your fields on the satellite view."),
1281
- action: /* @__PURE__ */ b(x, {
1282
- onClick: () => It(Lt("getting-started")),
1318
+ action: /* @__PURE__ */ x(S, {
1319
+ onClick: () => Bt(Vt("getting-started")),
1283
1320
  children: [
1284
- /* @__PURE__ */ y(Le, { className: "h-4 w-4" }),
1321
+ /* @__PURE__ */ b(Ve, { className: "h-4 w-4" }),
1285
1322
  " ",
1286
1323
  e("healthybowl.fieldMapPage.noFarm.action", "Set up your farm")
1287
1324
  ]
1288
1325
  })
1289
1326
  })
1290
1327
  });
1291
- let Vi = (e, t, n, r, i = !1) => /* @__PURE__ */ b("button", {
1328
+ let na = (e, t, n, r, i = !1) => /* @__PURE__ */ x("button", {
1292
1329
  type: "button",
1293
1330
  onClick: t,
1294
1331
  "aria-pressed": e,
@@ -1296,277 +1333,277 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1296
1333
  className: `flex flex-col items-center gap-1 rounded-md px-3 py-1.5 text-[11px] font-medium transition-colors ${e ? "bg-success text-white" : "text-text-primary hover:bg-bg-sunken"} ${i ? "cursor-not-allowed opacity-50" : ""}`,
1297
1334
  children: [n, r]
1298
1335
  });
1299
- return /* @__PURE__ */ b(r, {
1336
+ return /* @__PURE__ */ x(r, {
1300
1337
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
1301
1338
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
1302
1339
  hero: !0,
1303
1340
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
1304
1341
  purpose: "Trace each plot on the aerial view to auto-calculate its acreage, shade fields by soil type, overlay terrain, and see your whole holding at a glance. Click any field in the list to fly straight to it.",
1305
1342
  children: [
1306
- /* @__PURE__ */ b("div", {
1343
+ /* @__PURE__ */ x("div", {
1307
1344
  className: "flex flex-col gap-4 lg:flex-row",
1308
- children: [/* @__PURE__ */ b("div", {
1345
+ children: [/* @__PURE__ */ x("div", {
1309
1346
  className: "min-w-0 flex-1 space-y-3",
1310
1347
  children: [
1311
- /* @__PURE__ */ b("form", {
1348
+ /* @__PURE__ */ x("form", {
1312
1349
  className: "flex gap-2",
1313
- onSubmit: Mi,
1314
- children: [/* @__PURE__ */ b("div", {
1350
+ onSubmit: qi,
1351
+ children: [/* @__PURE__ */ x("div", {
1315
1352
  className: "relative min-w-0 flex-1",
1316
- children: [/* @__PURE__ */ y(Be, { className: "pointer-events-none absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ y("input", {
1353
+ children: [/* @__PURE__ */ b(We, { className: "pointer-events-none absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ b("input", {
1317
1354
  type: "search",
1318
- value: tn,
1319
- onChange: (e) => nn(e.target.value),
1355
+ value: on,
1356
+ onChange: (e) => sn(e.target.value),
1320
1357
  placeholder: e("healthybowl.fieldMapPage.placeSearch.placeholder", "Find your farm — village, city, or lat,lng…"),
1321
1358
  "aria-label": e("healthybowl.fieldMapPage.placeSearch.label", "Locate a place on the map"),
1322
1359
  className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 ps-9 pe-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
1323
1360
  })]
1324
- }), /* @__PURE__ */ b(x, {
1361
+ }), /* @__PURE__ */ x(S, {
1325
1362
  type: "submit",
1326
1363
  variant: "outline",
1327
1364
  size: "sm",
1328
- disabled: O !== "ready" || rn,
1365
+ disabled: k !== "ready" || cn,
1329
1366
  children: [
1330
- /* @__PURE__ */ y(Pe, { className: "h-4 w-4" }),
1367
+ /* @__PURE__ */ b(Re, { className: "h-4 w-4" }),
1331
1368
  " ",
1332
- rn ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
1369
+ cn ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
1333
1370
  ]
1334
1371
  })]
1335
1372
  }),
1336
- /* @__PURE__ */ b("div", {
1373
+ /* @__PURE__ */ x("div", {
1337
1374
  className: "relative isolate",
1338
1375
  children: [
1339
- /* @__PURE__ */ y("div", {
1340
- ref: vr,
1376
+ /* @__PURE__ */ b("div", {
1377
+ ref: Sr,
1341
1378
  className: "h-[70vh] max-h-[640px] w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken"
1342
1379
  }),
1343
- O === "ready" && /* @__PURE__ */ b("div", {
1380
+ k === "ready" && /* @__PURE__ */ x("div", {
1344
1381
  className: "absolute end-3 top-3 z-[1000] flex items-center gap-1 rounded-lg border border-border-subtle bg-bg-surface/95 p-1 shadow-md",
1345
1382
  children: [
1346
- Vi(k === "draw", () => k === "draw" ? mi() : fi(), /* @__PURE__ */ y(Ie, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
1347
- Vi(k === "edit", () => k === "edit" ? yi() : vi(), /* @__PURE__ */ y(He, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
1348
- Vi(!1, xi, /* @__PURE__ */ y(Ue, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
1349
- Vi(k === "measure", () => k === "measure" ? wi() : Ci(), /* @__PURE__ */ y(Re, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure")),
1350
- Vi(k === "element" || zn, () => {
1351
- k === "element" ? (Ai(), Bn(!1)) : Bn((e) => !e);
1352
- }, /* @__PURE__ */ y(Ve, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.elements", "Elements")),
1353
- Vi(k === "farm", () => k === "farm" ? mi() : pi(), /* @__PURE__ */ y(je, { className: "h-4 w-4" }), Ln ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.tools.farmOutline", "Farm outline"), Ln)
1383
+ na(A === "draw", () => A === "draw" ? Oi() : Ei(), /* @__PURE__ */ b(Be, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
1384
+ na(A === "edit", () => A === "edit" ? Ni() : Mi(), /* @__PURE__ */ b(Ke, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
1385
+ na(!1, Fi, /* @__PURE__ */ b(qe, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
1386
+ na(A === "measure", () => A === "measure" ? zi() : Ri(), /* @__PURE__ */ b(He, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure")),
1387
+ na(A === "element" || Un, () => {
1388
+ A === "element" ? (Gi(), Wn(!1)) : Wn((e) => !e);
1389
+ }, /* @__PURE__ */ b(Ge, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.elements", "Elements")),
1390
+ na(A === "farm", () => A === "farm" ? Oi() : Di(), /* @__PURE__ */ b(Fe, { className: "h-4 w-4" }), Vn ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.tools.farmOutline", "Farm outline"), Vn)
1354
1391
  ]
1355
1392
  }),
1356
- O === "ready" && zn && k !== "element" && /* @__PURE__ */ b("div", {
1393
+ k === "ready" && Un && A !== "element" && /* @__PURE__ */ x("div", {
1357
1394
  className: "absolute end-3 top-16 z-[1001] w-60 rounded-lg border border-border-subtle bg-bg-surface/95 p-2 shadow-lg",
1358
- children: [/* @__PURE__ */ y("p", {
1395
+ children: [/* @__PURE__ */ b("p", {
1359
1396
  className: "px-1.5 pb-1 text-[11px] font-semibold uppercase tracking-wide text-text-secondary",
1360
1397
  children: e("healthybowl.fieldMapPage.elements.menuTitle", "Add map element")
1361
- }), ut.map((t) => {
1398
+ }), mt.map((t) => {
1362
1399
  let n = t.icon;
1363
- return /* @__PURE__ */ b("button", {
1400
+ return /* @__PURE__ */ x("button", {
1364
1401
  type: "button",
1365
- onClick: () => ki(t.type),
1402
+ onClick: () => Wi(t.type),
1366
1403
  className: "flex w-full flex-col gap-0.5 rounded-md px-2 py-1.5 text-start text-sm text-text-primary transition-colors hover:bg-bg-sunken",
1367
- children: [/* @__PURE__ */ b("span", {
1404
+ children: [/* @__PURE__ */ x("span", {
1368
1405
  className: "flex w-full items-center gap-2",
1369
1406
  children: [
1370
- /* @__PURE__ */ y(n, {
1407
+ /* @__PURE__ */ b(n, {
1371
1408
  className: "h-4 w-4 shrink-0",
1372
1409
  style: { color: t.color }
1373
1410
  }),
1374
- /* @__PURE__ */ y("span", {
1411
+ /* @__PURE__ */ b("span", {
1375
1412
  className: "min-w-0 flex-1 truncate",
1376
1413
  children: e(t.labelKey, t.label)
1377
1414
  }),
1378
- /* @__PURE__ */ y("span", {
1415
+ /* @__PURE__ */ b("span", {
1379
1416
  className: "shrink-0 text-[10px] uppercase tracking-wide text-text-secondary",
1380
- children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`, dt(t.kind))
1417
+ children: e(`healthybowl.fieldMapPage.elements.kind.${t.kind}`, ht(t.kind))
1381
1418
  })
1382
1419
  ]
1383
- }), t.hint && /* @__PURE__ */ y("span", {
1420
+ }), t.hint && /* @__PURE__ */ b("span", {
1384
1421
  className: "ps-6 text-xs font-normal normal-case text-text-secondary",
1385
- children: e(t.hint.key, t.hint.defaultValue, { type: t.promotesTo ? l(e, t.promotesTo) : "" })
1422
+ children: e(t.hint.key, t.hint.defaultValue, { type: t.promotesTo ? u(e, t.promotesTo) : "" })
1386
1423
  })]
1387
1424
  }, t.type);
1388
1425
  })]
1389
1426
  }),
1390
- (k === "draw" || k === "farm") && /* @__PURE__ */ b("div", {
1427
+ (A === "draw" || A === "farm") && /* @__PURE__ */ x("div", {
1391
1428
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1392
1429
  children: [
1393
- /* @__PURE__ */ y("span", { children: k === "farm" ? e("healthybowl.fieldMapPage.farmDrawHint", "Click the map to trace the farm outline ({{count}}) — click the first point or Finish to save it.", { count: String(on) }) : e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(on) }) }),
1394
- /* @__PURE__ */ b(x, {
1430
+ /* @__PURE__ */ b("span", { children: A === "farm" ? e("healthybowl.fieldMapPage.farmDrawHint", "Click the map to trace the farm outline ({{count}}) — click the first point or Finish to save it.", { count: String(un) }) : e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(un) }) }),
1431
+ /* @__PURE__ */ x(S, {
1395
1432
  size: "sm",
1396
1433
  variant: "outline",
1397
- onClick: hi,
1398
- disabled: on === 0,
1434
+ onClick: ki,
1435
+ disabled: un === 0,
1399
1436
  title: e("healthybowl.fieldMapPage.undoCorner", "Undo last corner"),
1400
1437
  children: [
1401
- /* @__PURE__ */ y(Ge, { className: "h-3.5 w-3.5" }),
1438
+ /* @__PURE__ */ b(Ye, { className: "h-3.5 w-3.5" }),
1402
1439
  " ",
1403
1440
  e("healthybowl.fieldMapPage.undo", "Undo")
1404
1441
  ]
1405
1442
  }),
1406
- /* @__PURE__ */ b(x, {
1443
+ /* @__PURE__ */ x(S, {
1407
1444
  size: "sm",
1408
1445
  variant: "default",
1409
- onClick: di,
1446
+ onClick: Ti,
1410
1447
  children: [
1411
- /* @__PURE__ */ y(Ae, { className: "h-3.5 w-3.5" }),
1448
+ /* @__PURE__ */ b(Pe, { className: "h-3.5 w-3.5" }),
1412
1449
  " ",
1413
1450
  e("healthybowl.fieldMapPage.finish", "Finish")
1414
1451
  ]
1415
1452
  }),
1416
- /* @__PURE__ */ y(x, {
1453
+ /* @__PURE__ */ b(S, {
1417
1454
  size: "sm",
1418
1455
  variant: "outline",
1419
- onClick: mi,
1420
- children: /* @__PURE__ */ y(qe, { className: "h-3.5 w-3.5" })
1456
+ onClick: Oi,
1457
+ children: /* @__PURE__ */ b(Ze, { className: "h-3.5 w-3.5" })
1421
1458
  })
1422
1459
  ]
1423
1460
  }),
1424
- k === "edit" && /* @__PURE__ */ b("div", {
1461
+ A === "edit" && /* @__PURE__ */ x("div", {
1425
1462
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1426
1463
  children: [
1427
- /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
1428
- area: String(cn ?? ""),
1464
+ /* @__PURE__ */ b("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
1465
+ area: String(fn ?? ""),
1429
1466
  unit: G?.unit ?? "acres"
1430
1467
  }) }),
1431
- /* @__PURE__ */ b(x, {
1468
+ /* @__PURE__ */ x(S, {
1432
1469
  size: "sm",
1433
1470
  variant: "default",
1434
- onClick: bi,
1435
- disabled: !un || fn,
1471
+ onClick: Pi,
1472
+ disabled: !mn || gn,
1436
1473
  children: [
1437
- /* @__PURE__ */ y(ze, { className: "h-3.5 w-3.5" }),
1474
+ /* @__PURE__ */ b(Ue, { className: "h-3.5 w-3.5" }),
1438
1475
  " ",
1439
- fn ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
1476
+ gn ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
1440
1477
  ]
1441
1478
  }),
1442
- /* @__PURE__ */ y(x, {
1479
+ /* @__PURE__ */ b(S, {
1443
1480
  size: "sm",
1444
1481
  variant: "outline",
1445
- onClick: yi,
1446
- children: /* @__PURE__ */ y(qe, { className: "h-3.5 w-3.5" })
1482
+ onClick: Ni,
1483
+ children: /* @__PURE__ */ b(Ze, { className: "h-3.5 w-3.5" })
1447
1484
  })
1448
1485
  ]
1449
1486
  }),
1450
- k === "measure" && P && /* @__PURE__ */ b("div", {
1487
+ A === "measure" && F && /* @__PURE__ */ x("div", {
1451
1488
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-3 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1452
1489
  children: [
1453
- /* @__PURE__ */ b("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: Bi }), P.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (P.area / 4046.8564224).toFixed(2) })}`] }),
1454
- /* @__PURE__ */ y(x, {
1490
+ /* @__PURE__ */ x("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: ta }), F.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (F.area / 4046.8564224).toFixed(2) })}`] }),
1491
+ /* @__PURE__ */ b(S, {
1455
1492
  size: "sm",
1456
1493
  variant: "outline",
1457
- onClick: Z,
1494
+ onClick: Ii,
1458
1495
  children: e("healthybowl.fieldMapPage.measure.reset", "Reset")
1459
1496
  }),
1460
- /* @__PURE__ */ y(x, {
1497
+ /* @__PURE__ */ b(S, {
1461
1498
  size: "sm",
1462
1499
  variant: "outline",
1463
- onClick: wi,
1464
- children: /* @__PURE__ */ y(qe, { className: "h-3.5 w-3.5" })
1500
+ onClick: zi,
1501
+ children: /* @__PURE__ */ b(Ze, { className: "h-3.5 w-3.5" })
1465
1502
  })
1466
1503
  ]
1467
1504
  }),
1468
- k === "element" && ni && /* @__PURE__ */ b("div", {
1505
+ A === "element" && gi && /* @__PURE__ */ x("div", {
1469
1506
  className: "absolute left-1/2 top-3 z-[1000] flex -translate-x-1/2 items-center gap-2 rounded-full bg-bg-surface/95 px-3 py-1.5 text-xs text-text-primary shadow-md",
1470
1507
  children: [
1471
- /* @__PURE__ */ y("span", { children: ni.kind === "point" ? e("healthybowl.fieldMapPage.elements.hint.point", "Click the map to place {{label}}.", { label: e(ni.labelKey, ni.label) }) : ni.kind === "line" ? e("healthybowl.fieldMapPage.elements.hint.line", "Click to add points ({{count}}) — then Finish.", { count: String(Un) }) : e("healthybowl.fieldMapPage.elements.hint.polygon", "Click to add corners ({{count}}) — click the first point or Finish.", { count: String(Un) }) }),
1472
- ni.kind !== "point" && /* @__PURE__ */ b(x, {
1508
+ /* @__PURE__ */ b("span", { children: gi.kind === "point" ? e("healthybowl.fieldMapPage.elements.hint.point", "Click the map to place {{label}}.", { label: e(gi.labelKey, gi.label) }) : gi.kind === "line" ? e("healthybowl.fieldMapPage.elements.hint.line", "Click to add points ({{count}}) — then Finish.", { count: String(qn) }) : e("healthybowl.fieldMapPage.elements.hint.polygon", "Click to add corners ({{count}}) — click the first point or Finish.", { count: String(qn) }) }),
1509
+ gi.kind !== "point" && /* @__PURE__ */ x(S, {
1473
1510
  size: "sm",
1474
1511
  variant: "default",
1475
- onClick: Oi,
1512
+ onClick: Ui,
1476
1513
  children: [
1477
- /* @__PURE__ */ y(Ae, { className: "h-3.5 w-3.5" }),
1514
+ /* @__PURE__ */ b(Pe, { className: "h-3.5 w-3.5" }),
1478
1515
  " ",
1479
1516
  e("healthybowl.fieldMapPage.finish", "Finish")
1480
1517
  ]
1481
1518
  }),
1482
- /* @__PURE__ */ y(x, {
1519
+ /* @__PURE__ */ b(S, {
1483
1520
  size: "sm",
1484
1521
  variant: "outline",
1485
- onClick: Ai,
1486
- children: /* @__PURE__ */ y(qe, { className: "h-3.5 w-3.5" })
1522
+ onClick: Gi,
1523
+ children: /* @__PURE__ */ b(Ze, { className: "h-3.5 w-3.5" })
1487
1524
  })
1488
1525
  ]
1489
1526
  }),
1490
- O === "ready" && /* @__PURE__ */ b("div", {
1527
+ k === "ready" && /* @__PURE__ */ x("div", {
1491
1528
  className: "absolute bottom-3 start-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
1492
1529
  children: [
1493
- /* @__PURE__ */ b("div", {
1530
+ /* @__PURE__ */ x("div", {
1494
1531
  className: "mb-1.5 flex items-center gap-1.5 font-semibold text-text-primary",
1495
1532
  children: [
1496
- /* @__PURE__ */ y(Me, { className: "h-3.5 w-3.5" }),
1533
+ /* @__PURE__ */ b(Ie, { className: "h-3.5 w-3.5" }),
1497
1534
  " ",
1498
1535
  e("healthybowl.fieldMapPage.layers.title", "Layers")
1499
1536
  ]
1500
1537
  }),
1501
- /* @__PURE__ */ b("label", {
1538
+ /* @__PURE__ */ x("label", {
1502
1539
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1503
- children: [/* @__PURE__ */ y("input", {
1540
+ children: [/* @__PURE__ */ b("input", {
1504
1541
  type: "checkbox",
1505
1542
  checked: !0,
1506
1543
  readOnly: !0,
1507
1544
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1508
1545
  }), e("healthybowl.fieldMapPage.layers.satellite", "Satellite")]
1509
1546
  }),
1510
- /* @__PURE__ */ b("label", {
1547
+ /* @__PURE__ */ x("label", {
1511
1548
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1512
- children: [/* @__PURE__ */ y("input", {
1549
+ children: [/* @__PURE__ */ b("input", {
1513
1550
  type: "checkbox",
1514
- checked: Kt,
1515
- onChange: (e) => qt(e.target.checked),
1551
+ checked: Xt,
1552
+ onChange: (e) => Zt(e.target.checked),
1516
1553
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1517
1554
  }), e("healthybowl.fieldMapPage.layers.terrain", "Terrain")]
1518
1555
  }),
1519
- /* @__PURE__ */ b("label", {
1556
+ /* @__PURE__ */ x("label", {
1520
1557
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1521
- children: [/* @__PURE__ */ y("input", {
1558
+ children: [/* @__PURE__ */ b("input", {
1522
1559
  type: "checkbox",
1523
- checked: Jt,
1524
- onChange: (e) => Yt(e.target.checked),
1560
+ checked: Qt,
1561
+ onChange: (e) => $t(e.target.checked),
1525
1562
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1526
1563
  }), e("healthybowl.fieldMapPage.layers.soil", "Soil type")]
1527
1564
  }),
1528
- /* @__PURE__ */ b("label", {
1565
+ /* @__PURE__ */ x("label", {
1529
1566
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1530
- children: [/* @__PURE__ */ y("input", {
1567
+ children: [/* @__PURE__ */ b("input", {
1531
1568
  type: "checkbox",
1532
- checked: Xt,
1533
- onChange: (e) => Zt(e.target.checked),
1569
+ checked: en,
1570
+ onChange: (e) => tn(e.target.checked),
1534
1571
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1535
1572
  }), e("healthybowl.fieldMapPage.layers.elevation", "Elevation")]
1536
1573
  }),
1537
- /* @__PURE__ */ b("label", {
1574
+ /* @__PURE__ */ x("label", {
1538
1575
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1539
- children: [/* @__PURE__ */ y("input", {
1576
+ children: [/* @__PURE__ */ b("input", {
1540
1577
  type: "checkbox",
1541
- checked: Nn,
1542
- onChange: (e) => Pn(e.target.checked),
1578
+ checked: Ln,
1579
+ onChange: (e) => Rn(e.target.checked),
1543
1580
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1544
1581
  }), e("healthybowl.fieldMapPage.layers.elements", "Map elements")]
1545
1582
  }),
1546
- /* @__PURE__ */ b("label", {
1583
+ /* @__PURE__ */ x("label", {
1547
1584
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
1548
- children: [/* @__PURE__ */ y("input", {
1585
+ children: [/* @__PURE__ */ b("input", {
1549
1586
  type: "checkbox",
1550
- checked: Fn,
1551
- onChange: (e) => In(e.target.checked),
1587
+ checked: zn,
1588
+ onChange: (e) => Bn(e.target.checked),
1552
1589
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1553
1590
  }), e("healthybowl.fieldMapPage.layers.farmBoundary", "Farm boundary")]
1554
1591
  }),
1555
- Nn && /* @__PURE__ */ b("div", {
1592
+ Ln && /* @__PURE__ */ x("div", {
1556
1593
  className: "mt-1.5 max-h-40 overflow-y-auto border-t border-border-subtle pt-1.5",
1557
- children: [/* @__PURE__ */ y("div", {
1594
+ children: [/* @__PURE__ */ b("div", {
1558
1595
  className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-text-secondary",
1559
1596
  children: e("healthybowl.fieldMapPage.elements.legendTitle", "Element types")
1560
- }), ut.map((t) => {
1597
+ }), mt.map((t) => {
1561
1598
  let n = t.icon;
1562
- return /* @__PURE__ */ b("div", {
1599
+ return /* @__PURE__ */ x("div", {
1563
1600
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1564
1601
  children: [
1565
- /* @__PURE__ */ y("span", {
1602
+ /* @__PURE__ */ b("span", {
1566
1603
  className: `inline-block shrink-0 ${t.kind === "line" ? "h-0.5 w-3.5 rounded-full" : "h-3 w-3 rounded-sm"}`,
1567
1604
  style: { backgroundColor: t.color }
1568
1605
  }),
1569
- /* @__PURE__ */ y(n, {
1606
+ /* @__PURE__ */ b(n, {
1570
1607
  className: "h-3 w-3 shrink-0",
1571
1608
  style: { color: t.color }
1572
1609
  }),
@@ -1577,71 +1614,71 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1577
1614
  })
1578
1615
  ]
1579
1616
  }),
1580
- O === "ready" && Xt && /* @__PURE__ */ b("div", {
1617
+ k === "ready" && en && /* @__PURE__ */ x("div", {
1581
1618
  className: "absolute bottom-3 end-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
1582
- children: [/* @__PURE__ */ y("div", {
1619
+ children: [/* @__PURE__ */ b("div", {
1583
1620
  className: "mb-1.5 font-semibold text-text-primary",
1584
1621
  children: e("healthybowl.fieldMapPage.elevationLegend.title", "Elevation")
1585
- }), Ur ? /* @__PURE__ */ b(Ye, { children: [/* @__PURE__ */ y("span", {
1622
+ }), Xr ? /* @__PURE__ */ x($e, { children: [/* @__PURE__ */ b("span", {
1586
1623
  className: "block h-2 w-40 rounded-full",
1587
1624
  style: { background: "linear-gradient(to right, #16a34a, #f59e0b, #dc2626)" }
1588
- }), /* @__PURE__ */ b("div", {
1625
+ }), /* @__PURE__ */ x("div", {
1589
1626
  className: "mt-1 flex justify-between gap-3 text-text-secondary",
1590
- children: [/* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.elevationLegend.low", "{{value}} m Low", { value: String(Math.round(Vr)) }) }), /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.elevationLegend.high", "{{value}} m High", { value: String(Math.round(Hr)) }) })]
1591
- })] }) : /* @__PURE__ */ y("span", {
1627
+ children: [/* @__PURE__ */ b("span", { children: e("healthybowl.fieldMapPage.elevationLegend.low", "{{value}} m Low", { value: String(Math.round(Jr)) }) }), /* @__PURE__ */ b("span", { children: e("healthybowl.fieldMapPage.elevationLegend.high", "{{value}} m High", { value: String(Math.round(Yr)) }) })]
1628
+ })] }) : /* @__PURE__ */ b("span", {
1592
1629
  className: "text-text-secondary",
1593
1630
  children: e("healthybowl.fieldMapPage.elevationLegend.loading", "Loading elevation…")
1594
1631
  })]
1595
1632
  }),
1596
- O === "ready" && Jt && !Xt && Lr.length > 0 && /* @__PURE__ */ b("div", {
1633
+ k === "ready" && Qt && !en && Wr.length > 0 && /* @__PURE__ */ x("div", {
1597
1634
  className: "absolute bottom-3 end-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
1598
- children: [/* @__PURE__ */ y("div", {
1635
+ children: [/* @__PURE__ */ b("div", {
1599
1636
  className: "mb-1.5 font-semibold text-text-primary",
1600
1637
  children: e("healthybowl.fieldMapPage.soilLegend.title", "Soil Legend")
1601
- }), Lr.map((t) => /* @__PURE__ */ b("div", {
1638
+ }), Wr.map((t) => /* @__PURE__ */ x("div", {
1602
1639
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
1603
- children: [/* @__PURE__ */ y("span", {
1640
+ children: [/* @__PURE__ */ b("span", {
1604
1641
  className: "inline-block h-3 w-3 rounded-sm",
1605
1642
  style: { backgroundColor: t.color }
1606
1643
  }), e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)]
1607
1644
  }, t.key))]
1608
1645
  }),
1609
- O === "ready" && Kt && /* @__PURE__ */ b("div", {
1646
+ k === "ready" && Xt && /* @__PURE__ */ x("div", {
1610
1647
  className: "absolute start-3 top-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 px-3 py-2 text-[11px] text-text-secondary shadow-md",
1611
- children: [/* @__PURE__ */ y("div", {
1648
+ children: [/* @__PURE__ */ b("div", {
1612
1649
  className: "font-semibold text-text-primary",
1613
1650
  children: e("healthybowl.fieldMapPage.terrainLegend.title", "Terrain / Elevation")
1614
- }), /* @__PURE__ */ b("div", {
1651
+ }), /* @__PURE__ */ x("div", {
1615
1652
  className: "mt-1 flex items-center gap-2",
1616
- children: [/* @__PURE__ */ y("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ y("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
1653
+ children: [/* @__PURE__ */ b("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ b("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
1617
1654
  })]
1618
1655
  }),
1619
- (O === "loading" || We.crops && h.length === 0) && /* @__PURE__ */ y("div", {
1656
+ (k === "loading" || Je.crops && g.length === 0) && /* @__PURE__ */ b("div", {
1620
1657
  className: "pointer-events-none absolute inset-0 z-[900] flex items-center justify-center rounded-lg bg-bg-surface/60 text-sm text-text-secondary",
1621
1658
  children: e("healthybowl.fieldMapPage.loading", "Loading map…")
1622
1659
  }),
1623
- zi && O === "ready" && k === "view" && /* @__PURE__ */ y("div", {
1660
+ ea && k === "ready" && A === "view" && /* @__PURE__ */ b("div", {
1624
1661
  className: "absolute inset-0 z-[950] flex items-center justify-center p-6",
1625
- children: /* @__PURE__ */ b("div", {
1662
+ children: /* @__PURE__ */ x("div", {
1626
1663
  className: "max-w-sm rounded-xl border border-border-subtle bg-bg-surface/95 p-6 text-center shadow-lg",
1627
1664
  children: [
1628
- /* @__PURE__ */ y("div", {
1665
+ /* @__PURE__ */ b("div", {
1629
1666
  className: "mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-success/15",
1630
- children: /* @__PURE__ */ y(Fe, { className: "h-6 w-6 text-success" })
1667
+ children: /* @__PURE__ */ b(ze, { className: "h-6 w-6 text-success" })
1631
1668
  }),
1632
- /* @__PURE__ */ y("h3", {
1669
+ /* @__PURE__ */ b("h3", {
1633
1670
  className: "text-lg font-semibold text-text-primary",
1634
1671
  children: e("healthybowl.fieldMapPage.empty.title", "No field boundaries yet")
1635
1672
  }),
1636
- /* @__PURE__ */ y("p", {
1673
+ /* @__PURE__ */ b("p", {
1637
1674
  className: "mt-1 text-sm text-text-secondary",
1638
1675
  children: e("healthybowl.fieldMapPage.empty.description", "Draw the shape of each field on the satellite view to auto-calculate its area and unlock soil & terrain overlays.")
1639
1676
  }),
1640
- /* @__PURE__ */ b(x, {
1677
+ /* @__PURE__ */ x(S, {
1641
1678
  className: "mt-4",
1642
- onClick: fi,
1679
+ onClick: Ei,
1643
1680
  children: [
1644
- /* @__PURE__ */ y(Le, { className: "h-4 w-4" }),
1681
+ /* @__PURE__ */ b(Ve, { className: "h-4 w-4" }),
1645
1682
  " ",
1646
1683
  e("healthybowl.fieldMapPage.empty.action", "Draw Your First Field")
1647
1684
  ]
@@ -1651,110 +1688,110 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1651
1688
  })
1652
1689
  ]
1653
1690
  }),
1654
- /* @__PURE__ */ y("p", {
1691
+ /* @__PURE__ */ b("p", {
1655
1692
  className: "text-xs text-text-secondary",
1656
1693
  children: e("healthybowl.fieldMapPage.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · terrain © OpenTopoMap / OpenStreetMap")
1657
1694
  })
1658
1695
  ]
1659
- }), /* @__PURE__ */ b("aside", {
1696
+ }), /* @__PURE__ */ x("aside", {
1660
1697
  className: "shrink-0 space-y-4 lg:w-80",
1661
1698
  children: [
1662
- /* @__PURE__ */ b("div", {
1699
+ /* @__PURE__ */ x("div", {
1663
1700
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1664
1701
  children: [
1665
- /* @__PURE__ */ y("h2", {
1702
+ /* @__PURE__ */ b("h2", {
1666
1703
  className: "text-base font-semibold text-text-primary",
1667
1704
  children: e("healthybowl.fieldMapPage.panel.title", "Fields")
1668
1705
  }),
1669
- /* @__PURE__ */ y("p", {
1706
+ /* @__PURE__ */ b("p", {
1670
1707
  className: "mt-0.5 text-xs text-text-secondary",
1671
1708
  children: e("healthybowl.fieldMapPage.panel.summary", "{{acres}} acres · {{count}} fields · {{mapped}} mapped", {
1672
- acres: Ir.toFixed(1),
1673
- count: String(h.length),
1674
- mapped: String(Fr)
1709
+ acres: Ur.toFixed(1),
1710
+ count: String(g.length),
1711
+ mapped: String(Hr)
1675
1712
  })
1676
1713
  }),
1677
- /* @__PURE__ */ b("div", {
1714
+ /* @__PURE__ */ x("div", {
1678
1715
  className: "relative mt-3",
1679
- children: [/* @__PURE__ */ y(Be, { className: "pointer-events-none absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ y("input", {
1716
+ children: [/* @__PURE__ */ b(We, { className: "pointer-events-none absolute start-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ b("input", {
1680
1717
  type: "search",
1681
- value: $t,
1682
- onChange: (e) => en(e.target.value),
1718
+ value: rn,
1719
+ onChange: (e) => an(e.target.value),
1683
1720
  placeholder: e("healthybowl.fieldMapPage.panel.search", "Search fields…"),
1684
1721
  className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 ps-9 pe-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
1685
1722
  })]
1686
1723
  }),
1687
- /* @__PURE__ */ b("div", {
1724
+ /* @__PURE__ */ x("div", {
1688
1725
  className: "mt-3 max-h-[38vh] space-y-1 overflow-y-auto",
1689
- children: [zr.map((t) => {
1690
- let n = E(t) !== null;
1691
- return /* @__PURE__ */ b("button", {
1726
+ children: [Kr.map((t) => {
1727
+ let n = D(t) !== null;
1728
+ return /* @__PURE__ */ x("button", {
1692
1729
  type: "button",
1693
1730
  "data-field-id": t.id,
1694
- onClick: () => ci(t),
1695
- className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-start transition-colors ${t.id === j ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
1731
+ onClick: () => Si(t),
1732
+ className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-start transition-colors ${t.id === M ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
1696
1733
  children: [
1697
- /* @__PURE__ */ y("span", {
1734
+ /* @__PURE__ */ b("span", {
1698
1735
  className: "mt-0.5 inline-block h-4 w-4 shrink-0 rounded",
1699
- style: { backgroundColor: fe(t.soilType) }
1736
+ style: { backgroundColor: he(t.soilType) }
1700
1737
  }),
1701
- /* @__PURE__ */ b("span", {
1738
+ /* @__PURE__ */ x("span", {
1702
1739
  className: "min-w-0 flex-1",
1703
- children: [/* @__PURE__ */ y("span", {
1740
+ children: [/* @__PURE__ */ b("span", {
1704
1741
  className: "block truncate text-sm font-medium text-text-primary",
1705
1742
  children: t.name
1706
- }), /* @__PURE__ */ b("span", {
1743
+ }), /* @__PURE__ */ x("span", {
1707
1744
  className: "block truncate text-xs text-text-secondary",
1708
1745
  children: [
1709
- Nt(t),
1746
+ Lt(t),
1710
1747
  " · ",
1711
- l(e, t.type),
1748
+ u(e, t.type),
1712
1749
  " ·",
1713
1750
  " ",
1714
1751
  t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil"),
1715
- N[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[t.id])) })}`
1752
+ P[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(P[t.id])) })}`
1716
1753
  ]
1717
1754
  })]
1718
1755
  }),
1719
- !n && /* @__PURE__ */ y("span", {
1756
+ !n && /* @__PURE__ */ b("span", {
1720
1757
  className: "shrink-0 rounded-full bg-warning/20 px-1.5 py-0.5 text-[10px] font-medium text-warning",
1721
1758
  children: e("healthybowl.fieldMapPage.unmapped", "no boundary")
1722
1759
  })
1723
1760
  ]
1724
1761
  }, t.id);
1725
- }), zr.length === 0 && /* @__PURE__ */ y("p", {
1762
+ }), Kr.length === 0 && /* @__PURE__ */ b("p", {
1726
1763
  className: "px-2 py-4 text-center text-xs text-text-secondary",
1727
1764
  children: e("healthybowl.fieldMapPage.panel.none", "No fields match your search.")
1728
1765
  })]
1729
1766
  }),
1730
- /* @__PURE__ */ b(x, {
1767
+ /* @__PURE__ */ x(S, {
1731
1768
  className: "mt-3 w-full",
1732
- onClick: fi,
1733
- disabled: k === "draw",
1769
+ onClick: Ei,
1770
+ disabled: A === "draw",
1734
1771
  children: [
1735
- /* @__PURE__ */ y(Le, { className: "h-4 w-4" }),
1772
+ /* @__PURE__ */ b(Ve, { className: "h-4 w-4" }),
1736
1773
  " ",
1737
1774
  e("healthybowl.fieldMapPage.panel.drawNew", "Draw New Field")
1738
1775
  ]
1739
1776
  })
1740
1777
  ]
1741
1778
  }),
1742
- G && /* @__PURE__ */ b("div", {
1779
+ G && /* @__PURE__ */ x("div", {
1743
1780
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1744
1781
  children: [
1745
- /* @__PURE__ */ y("h3", {
1782
+ /* @__PURE__ */ b("h3", {
1746
1783
  className: "text-sm font-semibold text-text-primary",
1747
1784
  children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: G.name })
1748
1785
  }),
1749
- /* @__PURE__ */ b("dl", {
1786
+ /* @__PURE__ */ x("dl", {
1750
1787
  className: "mt-3 space-y-2 text-sm",
1751
1788
  children: [
1752
- /* @__PURE__ */ b("div", {
1789
+ /* @__PURE__ */ x("div", {
1753
1790
  className: "flex justify-between gap-3",
1754
- children: [/* @__PURE__ */ y("dt", {
1791
+ children: [/* @__PURE__ */ b("dt", {
1755
1792
  className: "text-text-secondary",
1756
1793
  children: e("healthybowl.fieldMapPage.detail.area", "Area")
1757
- }), /* @__PURE__ */ b("dd", {
1794
+ }), /* @__PURE__ */ x("dd", {
1758
1795
  className: "font-medium text-text-primary",
1759
1796
  children: [
1760
1797
  G.area,
@@ -1763,88 +1800,88 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1763
1800
  ]
1764
1801
  })]
1765
1802
  }),
1766
- /* @__PURE__ */ b("div", {
1803
+ /* @__PURE__ */ x("div", {
1767
1804
  className: "flex justify-between gap-3",
1768
- children: [/* @__PURE__ */ y("dt", {
1805
+ children: [/* @__PURE__ */ b("dt", {
1769
1806
  className: "text-text-secondary",
1770
1807
  children: e("healthybowl.fieldMapPage.detail.elevation", "Elevation")
1771
- }), /* @__PURE__ */ y("dd", {
1808
+ }), /* @__PURE__ */ b("dd", {
1772
1809
  className: "font-medium text-text-primary",
1773
- children: N[G.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[G.id])) })
1810
+ children: P[G.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(P[G.id])) })
1774
1811
  })]
1775
1812
  }),
1776
- /* @__PURE__ */ b("div", {
1813
+ /* @__PURE__ */ x("div", {
1777
1814
  className: "flex justify-between gap-3",
1778
- children: [/* @__PURE__ */ y("dt", {
1815
+ children: [/* @__PURE__ */ b("dt", {
1779
1816
  className: "text-text-secondary",
1780
1817
  children: e("healthybowl.fieldMapPage.detail.type", "Growing location")
1781
- }), /* @__PURE__ */ y("dd", {
1818
+ }), /* @__PURE__ */ b("dd", {
1782
1819
  className: "font-medium text-text-primary",
1783
- children: Jr
1820
+ children: ci
1784
1821
  })]
1785
1822
  }),
1786
- /* @__PURE__ */ b("div", {
1823
+ /* @__PURE__ */ x("div", {
1787
1824
  className: "flex justify-between gap-3",
1788
- children: [/* @__PURE__ */ y("dt", {
1825
+ children: [/* @__PURE__ */ b("dt", {
1789
1826
  className: "text-text-secondary",
1790
1827
  children: e("healthybowl.fieldMapPage.detail.soil", "Soil")
1791
- }), /* @__PURE__ */ y("dd", {
1828
+ }), /* @__PURE__ */ b("dd", {
1792
1829
  className: "font-medium text-text-primary",
1793
1830
  children: G.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
1794
1831
  })]
1795
1832
  }),
1796
- /* @__PURE__ */ b("div", {
1833
+ /* @__PURE__ */ x("div", {
1797
1834
  className: "flex justify-between gap-3",
1798
- children: [/* @__PURE__ */ y("dt", {
1835
+ children: [/* @__PURE__ */ b("dt", {
1799
1836
  className: "text-text-secondary",
1800
1837
  children: e("healthybowl.fieldMapPage.detail.irrigation", "Irrigation")
1801
- }), /* @__PURE__ */ y("dd", {
1838
+ }), /* @__PURE__ */ b("dd", {
1802
1839
  className: "font-medium text-text-primary",
1803
1840
  children: G.irrigationType || "—"
1804
1841
  })]
1805
1842
  }),
1806
- /* @__PURE__ */ b("div", {
1843
+ /* @__PURE__ */ x("div", {
1807
1844
  className: "flex justify-between gap-3",
1808
- children: [/* @__PURE__ */ y("dt", {
1845
+ children: [/* @__PURE__ */ b("dt", {
1809
1846
  className: "text-text-secondary",
1810
1847
  children: e("healthybowl.fieldMapPage.detail.crop", "Crop")
1811
- }), /* @__PURE__ */ y("dd", {
1848
+ }), /* @__PURE__ */ b("dd", {
1812
1849
  className: "font-medium text-text-primary",
1813
- children: Wr(G) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
1850
+ children: Zr(G) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
1814
1851
  })]
1815
1852
  }),
1816
- /* @__PURE__ */ b("div", {
1853
+ /* @__PURE__ */ x("div", {
1817
1854
  className: "flex justify-between gap-3",
1818
- children: [/* @__PURE__ */ y("dt", {
1855
+ children: [/* @__PURE__ */ b("dt", {
1819
1856
  className: "text-text-secondary",
1820
1857
  children: e("healthybowl.fieldMapPage.detail.status", "Status")
1821
- }), /* @__PURE__ */ y("dd", {
1858
+ }), /* @__PURE__ */ b("dd", {
1822
1859
  className: "font-medium capitalize text-text-primary",
1823
1860
  children: G.status
1824
1861
  })]
1825
1862
  })
1826
1863
  ]
1827
1864
  }),
1828
- /* @__PURE__ */ b("div", {
1865
+ /* @__PURE__ */ x("div", {
1829
1866
  className: "mt-3 flex gap-2",
1830
- children: [/* @__PURE__ */ b(x, {
1867
+ children: [/* @__PURE__ */ x(S, {
1831
1868
  variant: "outline",
1832
1869
  size: "sm",
1833
1870
  className: "flex-1",
1834
- onClick: () => si(G),
1871
+ onClick: () => xi(G),
1835
1872
  children: [
1836
- /* @__PURE__ */ y(Fe, { className: "h-4 w-4" }),
1873
+ /* @__PURE__ */ b(ze, { className: "h-4 w-4" }),
1837
1874
  " ",
1838
1875
  e("healthybowl.fieldMapPage.detail.flyTo", "Fly to")
1839
1876
  ]
1840
- }), E(G) && /* @__PURE__ */ b(x, {
1877
+ }), D(G) && /* @__PURE__ */ x(S, {
1841
1878
  variant: "outline",
1842
1879
  size: "sm",
1843
1880
  className: "flex-1",
1844
- onClick: vi,
1845
- disabled: k === "edit",
1881
+ onClick: Mi,
1882
+ disabled: A === "edit",
1846
1883
  children: [
1847
- /* @__PURE__ */ y(He, { className: "h-4 w-4" }),
1884
+ /* @__PURE__ */ b(Ke, { className: "h-4 w-4" }),
1848
1885
  " ",
1849
1886
  e("healthybowl.fieldMapPage.detail.edit", "Edit")
1850
1887
  ]
@@ -1852,307 +1889,311 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
1852
1889
  })
1853
1890
  ]
1854
1891
  }),
1855
- G && Gr && /* @__PURE__ */ b("div", {
1892
+ G && Qr && /* @__PURE__ */ x("div", {
1856
1893
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
1857
1894
  children: [
1858
- /* @__PURE__ */ b("div", {
1895
+ /* @__PURE__ */ x("div", {
1859
1896
  className: "flex items-center justify-between gap-2",
1860
- children: [/* @__PURE__ */ b("h3", {
1897
+ children: [/* @__PURE__ */ x("h3", {
1861
1898
  className: "flex items-center gap-1.5 text-sm font-semibold text-text-primary",
1862
1899
  children: [
1863
- /* @__PURE__ */ y(Ne, { className: "h-4 w-4" }),
1900
+ /* @__PURE__ */ b(Le, { className: "h-4 w-4" }),
1864
1901
  " ",
1865
1902
  e("healthybowl.fieldMapPage.beds.title", "Bed layout")
1866
1903
  ]
1867
- }), q && /* @__PURE__ */ b("label", {
1904
+ }), J && /* @__PURE__ */ x("label", {
1868
1905
  className: "flex cursor-pointer items-center gap-2 text-xs font-medium text-text-primary",
1869
- children: [/* @__PURE__ */ y("input", {
1906
+ children: [/* @__PURE__ */ b("input", {
1870
1907
  type: "checkbox",
1871
- checked: hn,
1872
- onChange: (e) => gn(e.target.checked),
1908
+ checked: yn,
1909
+ onChange: (e) => bn(e.target.checked),
1873
1910
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
1874
1911
  }), e("healthybowl.fieldMapPage.beds.show", "Show beds")]
1875
1912
  })]
1876
1913
  }),
1877
- q ? /* @__PURE__ */ b(Ye, { children: [
1878
- /* @__PURE__ */ y("p", {
1914
+ J ? /* @__PURE__ */ x($e, { children: [
1915
+ /* @__PURE__ */ b("p", {
1879
1916
  className: "mt-1 text-xs text-text-secondary",
1880
1917
  children: e("healthybowl.fieldMapPage.beds.hint", "Draw planting bed strips inside this field, then save the layout. Click a saved bed to assign a crop.")
1881
1918
  }),
1882
- /* @__PURE__ */ b("div", {
1919
+ /* @__PURE__ */ x("div", {
1883
1920
  className: "mt-3 grid grid-cols-2 gap-3",
1884
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1921
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
1885
1922
  className: "text-xs font-medium text-text-primary",
1886
1923
  children: e("healthybowl.fieldMapPage.beds.bedWidth", "Bed width (m)")
1887
- }), /* @__PURE__ */ y("input", {
1924
+ }), /* @__PURE__ */ b("input", {
1888
1925
  type: "number",
1889
1926
  min: .2,
1890
1927
  step: .1,
1891
- value: F,
1892
- onChange: (e) => _n(Math.max(.2, Number(e.target.value) || 0)),
1928
+ value: I,
1929
+ onChange: (e) => xn(Math.max(.2, Number(e.target.value) || 0)),
1893
1930
  className: "mt-1 h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
1894
- })] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
1931
+ })] }), /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
1895
1932
  className: "text-xs font-medium text-text-primary",
1896
1933
  children: e("healthybowl.fieldMapPage.beds.pathWidth", "Path width (m)")
1897
- }), /* @__PURE__ */ y("input", {
1934
+ }), /* @__PURE__ */ b("input", {
1898
1935
  type: "number",
1899
1936
  min: 0,
1900
1937
  step: .05,
1901
- value: vn,
1902
- onChange: (e) => yn(Math.max(0, Number(e.target.value) || 0)),
1938
+ value: Sn,
1939
+ onChange: (e) => Cn(Math.max(0, Number(e.target.value) || 0)),
1903
1940
  className: "mt-1 h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
1904
1941
  })] })]
1905
1942
  }),
1906
- /* @__PURE__ */ b("div", {
1943
+ /* @__PURE__ */ x("div", {
1907
1944
  className: "mt-3",
1908
- children: [/* @__PURE__ */ b("div", {
1945
+ children: [/* @__PURE__ */ x("div", {
1909
1946
  className: "flex items-center justify-between",
1910
- children: [/* @__PURE__ */ y("label", {
1947
+ children: [/* @__PURE__ */ b("label", {
1911
1948
  className: "text-xs font-medium text-text-primary",
1912
1949
  children: e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
1913
- }), /* @__PURE__ */ b("span", {
1950
+ }), /* @__PURE__ */ x("span", {
1914
1951
  className: "text-xs text-text-secondary",
1915
- children: [bn, "°"]
1952
+ children: [wn, "°"]
1916
1953
  })]
1917
- }), /* @__PURE__ */ y("input", {
1954
+ }), /* @__PURE__ */ b("input", {
1918
1955
  type: "range",
1919
1956
  min: 0,
1920
1957
  max: 180,
1921
1958
  step: 1,
1922
- value: bn,
1923
- onChange: (e) => xn(Number(e.target.value)),
1959
+ value: wn,
1960
+ onChange: (e) => Tn(Number(e.target.value)),
1924
1961
  className: "mt-1 w-full accent-[var(--color-success)]",
1925
1962
  "aria-label": e("healthybowl.fieldMapPage.beds.orientation", "Orientation")
1926
1963
  })]
1927
1964
  }),
1928
- g.length > 0 && /* @__PURE__ */ b("div", {
1965
+ /* @__PURE__ */ x("div", {
1929
1966
  className: "mt-3",
1930
1967
  children: [
1931
- /* @__PURE__ */ y("label", {
1968
+ /* @__PURE__ */ b("label", {
1969
+ htmlFor: "map-bed-spacing-crop",
1932
1970
  className: "text-xs font-medium text-text-primary",
1933
1971
  children: e("healthybowl.fieldMapPage.beds.crop", "Spacing for crop")
1934
1972
  }),
1935
- /* @__PURE__ */ b(Xe, {
1936
- value: qr?.id ?? "",
1937
- onValueChange: Cn,
1938
- children: [/* @__PURE__ */ y(Qe, {
1939
- className: "mt-1 w-full",
1940
- children: /* @__PURE__ */ y($e, { placeholder: e("healthybowl.fieldMapPage.beds.cropPlaceholder", "Standard spacing") })
1941
- }), /* @__PURE__ */ y(Ze, { children: g.map((e) => /* @__PURE__ */ y(S, {
1942
- value: e.id,
1943
- children: e.name
1944
- }, e.id)) })]
1973
+ /* @__PURE__ */ b(te, {
1974
+ id: "map-bed-spacing-crop",
1975
+ value: L || $r?.id || "",
1976
+ onValueChange: (e, t) => {
1977
+ En(e), On(t?.id === e ? {
1978
+ workspaceId: c,
1979
+ crop: t
1980
+ } : null);
1981
+ },
1982
+ options: ii,
1983
+ placeholder: e("healthybowl.fieldMapPage.beds.cropPlaceholder", "Standard spacing"),
1984
+ className: "mt-1"
1945
1985
  }),
1946
- /* @__PURE__ */ y("p", {
1986
+ /* @__PURE__ */ b("p", {
1987
+ role: K ? "status" : void 0,
1947
1988
  className: "mt-1 text-[11px] text-text-secondary",
1948
- children: e("healthybowl.fieldMapPage.beds.spacingLine", "{{preset}} · {{plant}}×{{row}} cm", {
1949
- preset: K.label,
1950
- plant: String(K.plantSpacingCm),
1951
- row: String(K.rowSpacingCm)
1989
+ children: K ? ri : e("healthybowl.fieldMapPage.beds.spacingLine", "{{preset}} · {{plant}}×{{row}} cm", {
1990
+ preset: q.label,
1991
+ plant: String(q.plantSpacingCm),
1992
+ row: String(q.rowSpacingCm)
1952
1993
  })
1953
1994
  })
1954
1995
  ]
1955
1996
  }),
1956
- J && /* @__PURE__ */ b("div", {
1997
+ Y && /* @__PURE__ */ x("div", {
1957
1998
  className: "mt-3 rounded-md bg-warning/10 px-3 py-2 text-sm font-medium text-text-primary",
1958
- children: [e("healthybowl.fieldMapPage.beds.readout", "{{beds}} beds · ~{{plants}} plants", {
1959
- beds: String(J.bedCount),
1960
- plants: Yr.toLocaleString()
1961
- }), /* @__PURE__ */ y("span", {
1999
+ children: [li == null ? e("healthybowl.fieldMapPage.beds.unresolvedReadout", "{{beds}} beds · crop spacing unresolved", { beds: String(Y.bedCount) }) : e("healthybowl.fieldMapPage.beds.readout", "{{beds}} beds · ~{{plants}} plants", {
2000
+ beds: String(Y.bedCount),
2001
+ plants: li.toLocaleString()
2002
+ }), /* @__PURE__ */ b("span", {
1962
2003
  className: "ms-1 text-xs font-normal text-text-secondary",
1963
2004
  children: e("healthybowl.fieldMapPage.beds.previewTag", "(preview)")
1964
2005
  })]
1965
2006
  })
1966
- ] }) : /* @__PURE__ */ y("p", {
2007
+ ] }) : /* @__PURE__ */ b("p", {
1967
2008
  "data-testid": "bed-geometry-notice",
1968
2009
  className: "mt-2 rounded-md border border-border-subtle bg-bg-sunken/60 p-3 text-xs text-text-secondary",
1969
- children: e(ye.key, ye.defaultValue, { type: Jr })
2010
+ children: e(Se.key, Se.defaultValue, { type: ci })
1970
2011
  }),
1971
- Y.length > 0 && /* @__PURE__ */ b("div", {
2012
+ X.length > 0 && /* @__PURE__ */ x("div", {
1972
2013
  className: "mt-2 flex items-center gap-2 rounded-md bg-success/10 px-3 py-2 text-sm font-medium text-text-primary",
1973
- children: [/* @__PURE__ */ y("span", { className: "inline-block h-3 w-3 shrink-0 rounded-sm border border-[#065f46] bg-[#34d399]" }), e("healthybowl.fieldMapPage.beds.savedCount", "Saved ({{count}} beds)", { count: String(Y.length) })]
2014
+ children: [/* @__PURE__ */ b("span", { className: "inline-block h-3 w-3 shrink-0 rounded-sm border border-[#065f46] bg-[#34d399]" }), e("healthybowl.fieldMapPage.beds.savedCount", "Saved ({{count}} beds)", { count: String(X.length) })]
1974
2015
  }),
1975
- Zr && Y.length === 0 && /* @__PURE__ */ y("p", {
2016
+ di && X.length === 0 && /* @__PURE__ */ b("p", {
1976
2017
  className: "mt-2 text-xs text-text-secondary",
1977
2018
  children: e("healthybowl.fieldMapPage.beds.loadingSaved", "Loading saved beds…")
1978
2019
  }),
1979
- (q || Y.length > 0) && /* @__PURE__ */ b("div", {
2020
+ (J || X.length > 0) && /* @__PURE__ */ x("div", {
1980
2021
  className: "mt-3 flex gap-2",
1981
- children: [q && /* @__PURE__ */ b(x, {
2022
+ children: [J && /* @__PURE__ */ x(S, {
1982
2023
  size: "sm",
1983
2024
  className: "flex-1",
1984
- onClick: ii,
1985
- disabled: !J || J.beds.length === 0 || wn,
2025
+ onClick: vi,
2026
+ disabled: !Y || Y.beds.length === 0 || kn || K,
1986
2027
  children: [
1987
- /* @__PURE__ */ y(ze, { className: "h-4 w-4" }),
2028
+ /* @__PURE__ */ b(Ue, { className: "h-4 w-4" }),
1988
2029
  " ",
1989
- wn ? e("healthybowl.fieldMapPage.beds.saving", "Saving…") : Y.length > 0 ? e("healthybowl.fieldMapPage.beds.resave", "Save layout (replace)") : e("healthybowl.fieldMapPage.beds.save", "Save layout")
2030
+ kn ? e("healthybowl.fieldMapPage.beds.saving", "Saving…") : X.length > 0 ? e("healthybowl.fieldMapPage.beds.resave", "Save layout (replace)") : e("healthybowl.fieldMapPage.beds.save", "Save layout")
1990
2031
  ]
1991
- }), Y.length > 0 && /* @__PURE__ */ b(x, {
2032
+ }), X.length > 0 && /* @__PURE__ */ x(S, {
1992
2033
  variant: "outline",
1993
2034
  size: "sm",
1994
- onClick: ai,
1995
- disabled: En,
2035
+ onClick: yi,
2036
+ disabled: jn,
1996
2037
  children: [
1997
- /* @__PURE__ */ y(Ue, { className: "h-4 w-4" }),
2038
+ /* @__PURE__ */ b(qe, { className: "h-4 w-4" }),
1998
2039
  " ",
1999
- En ? e("healthybowl.fieldMapPage.beds.clearing", "Clearing…") : e("healthybowl.fieldMapPage.beds.clear", "Clear")
2040
+ jn ? e("healthybowl.fieldMapPage.beds.clearing", "Clearing…") : e("healthybowl.fieldMapPage.beds.clear", "Clear")
2000
2041
  ]
2001
2042
  })]
2002
2043
  }),
2003
- J && J.bedCount > ft && /* @__PURE__ */ y("p", {
2044
+ Y && Y.bedCount > gt && /* @__PURE__ */ b("p", {
2004
2045
  className: "mt-2 text-xs text-warning",
2005
- children: e("healthybowl.fieldMapPage.beds.capHint", "Over the {{max}}-bed save limit — widen the beds to save this layout.", { max: String(ft) })
2046
+ children: e("healthybowl.fieldMapPage.beds.capHint", "Over the {{max}}-bed save limit — widen the beds to save this layout.", { max: String(gt) })
2006
2047
  })
2007
2048
  ]
2008
2049
  })
2009
2050
  ]
2010
2051
  })]
2011
2052
  }),
2012
- /* @__PURE__ */ y(ne, {
2013
- open: z !== null,
2053
+ /* @__PURE__ */ b(oe, {
2054
+ open: H !== null,
2014
2055
  onClose: () => {
2015
- tr(null), _r(null);
2056
+ ar(null), xr(null);
2016
2057
  },
2017
2058
  title: e("healthybowl.fieldMapPage.create.title", "Save New Field"),
2018
2059
  description: e("healthybowl.fieldMapPage.create.description", "Name the field you just drew. Its area is auto-calculated."),
2019
- footer: /* @__PURE__ */ b(Ye, { children: [/* @__PURE__ */ y(x, {
2060
+ footer: /* @__PURE__ */ x($e, { children: [/* @__PURE__ */ b(S, {
2020
2061
  variant: "outline",
2021
2062
  onClick: () => {
2022
- tr(null), _r(null);
2063
+ ar(null), xr(null);
2023
2064
  },
2024
2065
  className: "text-text-secondary",
2025
2066
  children: e("healthybowl.common.cancel", "Cancel")
2026
- }), /* @__PURE__ */ y(x, {
2027
- onClick: Ni,
2028
- disabled: nr,
2029
- children: nr ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
2067
+ }), /* @__PURE__ */ b(S, {
2068
+ onClick: Ji,
2069
+ disabled: or,
2070
+ children: or ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
2030
2071
  })] }),
2031
- children: /* @__PURE__ */ b("div", {
2072
+ children: /* @__PURE__ */ x("div", {
2032
2073
  className: "space-y-4",
2033
2074
  children: [
2034
- /* @__PURE__ */ y("div", {
2075
+ /* @__PURE__ */ b("div", {
2035
2076
  className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
2036
- children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(z?.area ?? 0) })
2077
+ children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(H?.area ?? 0) })
2037
2078
  }),
2038
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2079
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
2039
2080
  className: "text-sm font-medium text-text-primary",
2040
2081
  children: e("healthybowl.fieldMapPage.create.name", "Field name *")
2041
- }), /* @__PURE__ */ y("input", {
2082
+ }), /* @__PURE__ */ b("input", {
2042
2083
  type: "text",
2043
- value: ir,
2044
- onChange: (e) => ar(e.target.value),
2084
+ value: cr,
2085
+ onChange: (e) => lr(e.target.value),
2045
2086
  placeholder: e("healthybowl.fieldMapPage.create.namePlaceholder", "e.g., North Paddy"),
2046
2087
  className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
2047
2088
  })] }),
2048
- /* @__PURE__ */ b("div", { children: [
2049
- /* @__PURE__ */ y("label", {
2089
+ /* @__PURE__ */ x("div", { children: [
2090
+ /* @__PURE__ */ b("label", {
2050
2091
  className: "text-sm font-medium text-text-primary",
2051
2092
  children: e("healthybowl.fieldMapPage.create.type", "Growing location")
2052
2093
  }),
2053
- /* @__PURE__ */ b(Xe, {
2054
- value: fr,
2055
- onValueChange: (e) => pr(e),
2056
- children: [/* @__PURE__ */ y(Qe, {
2094
+ /* @__PURE__ */ x(et, {
2095
+ value: gr,
2096
+ onValueChange: (e) => _r(e),
2097
+ children: [/* @__PURE__ */ b(nt, {
2057
2098
  className: "mt-1 w-full",
2058
- children: /* @__PURE__ */ y($e, {})
2059
- }), /* @__PURE__ */ y(Ze, { children: xe.map((t) => /* @__PURE__ */ y(S, {
2099
+ children: /* @__PURE__ */ b(rt, {})
2100
+ }), /* @__PURE__ */ b(tt, { children: we.map((t) => /* @__PURE__ */ b(C, {
2060
2101
  value: t.value,
2061
2102
  children: e(t.key, t.defaultValue)
2062
2103
  }, t.value)) })]
2063
2104
  }),
2064
- /* @__PURE__ */ y("p", {
2105
+ /* @__PURE__ */ b("p", {
2065
2106
  className: "mt-1 text-xs text-text-secondary",
2066
2107
  children: e("healthybowl.fieldMapPage.create.typeHint", "Bed layouts are drawn for open fields and raised beds. Other types are estimated from their own geometry below.")
2067
2108
  }),
2068
- /* @__PURE__ */ y("div", {
2109
+ /* @__PURE__ */ b("div", {
2069
2110
  className: "mt-3",
2070
- children: /* @__PURE__ */ y(we, {
2071
- type: fr,
2072
- value: mr,
2073
- onChange: hr,
2111
+ children: /* @__PURE__ */ b(De, {
2112
+ type: gr,
2113
+ value: vr,
2114
+ onChange: yr,
2074
2115
  t: e,
2075
2116
  testIdPrefix: "field-map-grow-geometry"
2076
2117
  })
2077
2118
  })
2078
2119
  ] }),
2079
- /* @__PURE__ */ b("div", {
2120
+ /* @__PURE__ */ x("div", {
2080
2121
  className: "grid grid-cols-2 gap-3",
2081
- children: [/* @__PURE__ */ b("div", { children: [
2082
- /* @__PURE__ */ y("label", {
2122
+ children: [/* @__PURE__ */ x("div", { children: [
2123
+ /* @__PURE__ */ b("label", {
2083
2124
  className: "text-sm font-medium text-text-primary",
2084
2125
  children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
2085
2126
  }),
2086
- /* @__PURE__ */ b(Xe, {
2087
- value: or,
2088
- onValueChange: sr,
2089
- children: [/* @__PURE__ */ y(Qe, {
2127
+ /* @__PURE__ */ x(et, {
2128
+ value: ur,
2129
+ onValueChange: dr,
2130
+ children: [/* @__PURE__ */ b(nt, {
2090
2131
  className: "mt-1 w-full",
2091
- children: /* @__PURE__ */ y($e, {})
2092
- }), /* @__PURE__ */ y(Ze, { children: de.map((t) => /* @__PURE__ */ y(S, {
2132
+ children: /* @__PURE__ */ b(rt, {})
2133
+ }), /* @__PURE__ */ b(tt, { children: me.map((t) => /* @__PURE__ */ b(C, {
2093
2134
  value: t.label,
2094
2135
  children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
2095
2136
  }, t.key)) })]
2096
2137
  }),
2097
- /* @__PURE__ */ b("p", {
2138
+ /* @__PURE__ */ x("p", {
2098
2139
  className: "mt-1 flex items-center gap-1.5 text-xs text-text-secondary",
2099
- children: [/* @__PURE__ */ y("span", {
2140
+ children: [/* @__PURE__ */ b("span", {
2100
2141
  className: "inline-block h-3 w-3 shrink-0 rounded-sm border border-border-subtle",
2101
- style: { backgroundColor: fe(or) }
2142
+ style: { backgroundColor: he(ur) }
2102
2143
  }), e("healthybowl.fieldMapPage.create.soilHint", "The map shades each field by its soil type — pick the right one so fields stand apart.")]
2103
2144
  })
2104
- ] }), /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2145
+ ] }), /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
2105
2146
  className: "text-sm font-medium text-text-primary",
2106
2147
  children: e("healthybowl.fieldMapPage.create.irrigation", "Irrigation")
2107
- }), /* @__PURE__ */ b(Xe, {
2108
- value: cr,
2109
- onValueChange: lr,
2110
- children: [/* @__PURE__ */ y(Qe, {
2148
+ }), /* @__PURE__ */ x(et, {
2149
+ value: fr,
2150
+ onValueChange: pr,
2151
+ children: [/* @__PURE__ */ b(nt, {
2111
2152
  className: "mt-1 w-full",
2112
- children: /* @__PURE__ */ y($e, {})
2113
- }), /* @__PURE__ */ b(Ze, { children: [
2114
- /* @__PURE__ */ y(S, {
2153
+ children: /* @__PURE__ */ b(rt, {})
2154
+ }), /* @__PURE__ */ x(tt, { children: [
2155
+ /* @__PURE__ */ b(C, {
2115
2156
  value: "Drip",
2116
2157
  children: e("healthybowl.fieldMapPage.irrigation.drip", "Drip")
2117
2158
  }),
2118
- /* @__PURE__ */ y(S, {
2159
+ /* @__PURE__ */ b(C, {
2119
2160
  value: "Sprinkler",
2120
2161
  children: e("healthybowl.fieldMapPage.irrigation.sprinkler", "Sprinkler")
2121
2162
  }),
2122
- /* @__PURE__ */ y(S, {
2163
+ /* @__PURE__ */ b(C, {
2123
2164
  value: "Flood",
2124
2165
  children: e("healthybowl.fieldMapPage.irrigation.flood", "Flood")
2125
2166
  }),
2126
- /* @__PURE__ */ y(S, {
2167
+ /* @__PURE__ */ b(C, {
2127
2168
  value: "Rainfed",
2128
2169
  children: e("healthybowl.fieldMapPage.irrigation.rainfed", "Rainfed")
2129
2170
  }),
2130
- /* @__PURE__ */ y(S, {
2171
+ /* @__PURE__ */ b(C, {
2131
2172
  value: "None",
2132
2173
  children: e("healthybowl.fieldMapPage.irrigation.none", "None")
2133
2174
  })
2134
2175
  ] })]
2135
2176
  })] })]
2136
2177
  }),
2137
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2178
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
2138
2179
  className: "text-sm font-medium text-text-primary",
2139
2180
  children: e("healthybowl.fieldMapPage.create.status", "Status")
2140
- }), /* @__PURE__ */ b(Xe, {
2141
- value: ur,
2142
- onValueChange: dr,
2143
- children: [/* @__PURE__ */ y(Qe, {
2181
+ }), /* @__PURE__ */ x(et, {
2182
+ value: mr,
2183
+ onValueChange: hr,
2184
+ children: [/* @__PURE__ */ b(nt, {
2144
2185
  className: "mt-1 w-full",
2145
- children: /* @__PURE__ */ y($e, {})
2146
- }), /* @__PURE__ */ b(Ze, { children: [
2147
- /* @__PURE__ */ y(S, {
2186
+ children: /* @__PURE__ */ b(rt, {})
2187
+ }), /* @__PURE__ */ x(tt, { children: [
2188
+ /* @__PURE__ */ b(C, {
2148
2189
  value: "active",
2149
2190
  children: e("healthybowl.fieldMapPage.status.active", "Active")
2150
2191
  }),
2151
- /* @__PURE__ */ y(S, {
2192
+ /* @__PURE__ */ b(C, {
2152
2193
  value: "preparation",
2153
2194
  children: e("healthybowl.fieldMapPage.status.preparation", "Preparation")
2154
2195
  }),
2155
- /* @__PURE__ */ y(S, {
2196
+ /* @__PURE__ */ b(C, {
2156
2197
  value: "fallow",
2157
2198
  children: e("healthybowl.fieldMapPage.status.fallow", "Fallow")
2158
2199
  })
@@ -2161,39 +2202,46 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
2161
2202
  ]
2162
2203
  })
2163
2204
  }),
2164
- /* @__PURE__ */ y(ne, {
2165
- open: I !== null,
2166
- onClose: () => On(null),
2167
- title: e("healthybowl.fieldMapPage.beds.assign.title", "Assign crop to {{bed}}", { bed: I?.name ?? "" }),
2205
+ /* @__PURE__ */ b(oe, {
2206
+ open: R !== null,
2207
+ onClose: () => Nn(null),
2208
+ title: e("healthybowl.fieldMapPage.beds.assign.title", "Assign crop to {{bed}}", { bed: R?.name ?? "" }),
2168
2209
  description: e("healthybowl.fieldMapPage.beds.assign.description", "Pick a crop for this bed. Its plant count is recomputed from the crop's spacing."),
2169
- footer: /* @__PURE__ */ b(Ye, { children: [/* @__PURE__ */ y(x, {
2210
+ footer: /* @__PURE__ */ x($e, { children: [/* @__PURE__ */ b(S, {
2170
2211
  variant: "outline",
2171
- onClick: () => On(null),
2212
+ onClick: () => Nn(null),
2172
2213
  className: "text-text-secondary",
2173
2214
  children: e("healthybowl.common.cancel", "Cancel")
2174
- }), /* @__PURE__ */ y(x, {
2175
- onClick: oi,
2176
- disabled: jn,
2177
- children: jn ? e("healthybowl.fieldMapPage.beds.assign.saving", "Saving…") : e("healthybowl.fieldMapPage.beds.assign.action", "Assign")
2215
+ }), /* @__PURE__ */ b(S, {
2216
+ onClick: bi,
2217
+ disabled: Fn || !!(z && !oi && !si),
2218
+ children: Fn ? e("healthybowl.fieldMapPage.beds.assign.saving", "Saving…") : e("healthybowl.fieldMapPage.beds.assign.action", "Assign")
2178
2219
  })] }),
2179
- children: /* @__PURE__ */ b("div", {
2220
+ children: /* @__PURE__ */ x("div", {
2180
2221
  className: "space-y-3",
2181
- children: [/* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2222
+ children: [/* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
2223
+ htmlFor: "map-bed-assignment-crop",
2182
2224
  className: "text-sm font-medium text-text-primary",
2183
2225
  children: e("healthybowl.fieldMapPage.beds.assign.crop", "Crop")
2184
- }), /* @__PURE__ */ b(Xe, {
2185
- value: kn,
2186
- onValueChange: An,
2187
- children: [/* @__PURE__ */ y(Qe, {
2188
- className: "mt-1 w-full",
2189
- children: /* @__PURE__ */ y($e, { placeholder: e("healthybowl.fieldMapPage.beds.assign.none", "No crop") })
2190
- }), /* @__PURE__ */ y(Ze, { children: g.map((e) => /* @__PURE__ */ y(S, {
2191
- value: e.id,
2192
- children: e.name
2193
- }, e.id)) })]
2194
- })] }), q ? (() => {
2195
- let t = Oe(g.find((e) => e.id === kn) ?? null), n = I ? re(I.boundary) : null, r = ge(I?.area ?? (n ? oe(n) : 0), I?.widthM ?? F, t.plantSpacingCm, t.rowSpacingCm);
2196
- return /* @__PURE__ */ y("div", {
2226
+ }), /* @__PURE__ */ b(te, {
2227
+ id: "map-bed-assignment-crop",
2228
+ value: z || "__no_crop__",
2229
+ onValueChange: (e) => Pn(e === "__no_crop__" ? "" : e),
2230
+ options: ii,
2231
+ emptyOption: {
2232
+ value: "__no_crop__",
2233
+ label: e("healthybowl.fieldMapPage.beds.assign.none", "No crop")
2234
+ },
2235
+ skip: !R,
2236
+ disabled: Fn,
2237
+ className: "mt-1"
2238
+ })] }), z && !oi ? /* @__PURE__ */ x("p", {
2239
+ role: "status",
2240
+ className: "rounded-md border border-border-subtle bg-bg-sunken/60 px-3 py-2 text-sm text-text-secondary",
2241
+ children: [ai.loading ? "Loading the recorded crop…" : `Recorded crop ID ${z} is unavailable.`, si ? ` Stored plant count: ${R?.plantCount ?? "—"}; retained unless you deliberately choose another crop.` : " Choose an available crop before saving."]
2242
+ }) : J ? (() => {
2243
+ let t = je(oi), n = R ? s(R.boundary) : null, r = ye(R?.area ?? (n ? le(n) : 0), R?.widthM ?? I, t.plantSpacingCm, t.rowSpacingCm);
2244
+ return /* @__PURE__ */ b("div", {
2197
2245
  className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
2198
2246
  children: e("healthybowl.fieldMapPage.beds.assign.preview", "{{preset}} · {{plant}}×{{row}} cm · ~{{plants}} plants", {
2199
2247
  preset: t.label,
@@ -2202,58 +2250,58 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
2202
2250
  plants: r.toLocaleString()
2203
2251
  })
2204
2252
  });
2205
- })() : /* @__PURE__ */ y("p", {
2253
+ })() : /* @__PURE__ */ b("p", {
2206
2254
  "data-testid": "bed-geometry-notice-bed-layout",
2207
2255
  className: "rounded-md border border-border-subtle bg-bg-sunken/60 px-3 py-2 text-xs text-text-secondary",
2208
- children: e(ye.key, ye.defaultValue, { type: Jr })
2256
+ children: e(Se.key, Se.defaultValue, { type: ci })
2209
2257
  })]
2210
2258
  })
2211
2259
  }),
2212
- /* @__PURE__ */ y(ne, {
2213
- open: L !== null,
2214
- onClose: () => Gn(null),
2260
+ /* @__PURE__ */ b(oe, {
2261
+ open: B !== null,
2262
+ onClose: () => Yn(null),
2215
2263
  title: e("healthybowl.fieldMapPage.elements.save.title", "Save map element"),
2216
2264
  description: e("healthybowl.fieldMapPage.elements.save.description", "Name the element you just drew. It will show on the map with its type styling."),
2217
- footer: /* @__PURE__ */ b(Ye, { children: [/* @__PURE__ */ y(x, {
2265
+ footer: /* @__PURE__ */ x($e, { children: [/* @__PURE__ */ b(S, {
2218
2266
  variant: "outline",
2219
- onClick: () => Gn(null),
2267
+ onClick: () => Yn(null),
2220
2268
  className: "text-text-secondary",
2221
2269
  children: e("healthybowl.common.cancel", "Cancel")
2222
- }), /* @__PURE__ */ y(x, {
2223
- onClick: Pi,
2224
- disabled: Xn,
2225
- children: Xn ? e("healthybowl.fieldMapPage.elements.save.saving", "Saving…") : e("healthybowl.fieldMapPage.elements.save.action", "Save element")
2270
+ }), /* @__PURE__ */ b(S, {
2271
+ onClick: Yi,
2272
+ disabled: er,
2273
+ children: er ? e("healthybowl.fieldMapPage.elements.save.saving", "Saving…") : e("healthybowl.fieldMapPage.elements.save.action", "Save element")
2226
2274
  })] }),
2227
- children: /* @__PURE__ */ b("div", {
2275
+ children: /* @__PURE__ */ x("div", {
2228
2276
  className: "space-y-4",
2229
2277
  children: [
2230
- Q && /* @__PURE__ */ b("div", {
2278
+ Q && /* @__PURE__ */ x("div", {
2231
2279
  className: "flex items-center gap-2 rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
2232
- children: [/* @__PURE__ */ y(Q.icon, {
2280
+ children: [/* @__PURE__ */ b(Q.icon, {
2233
2281
  className: "h-4 w-4 shrink-0",
2234
2282
  style: { color: Q.color }
2235
2283
  }), e("healthybowl.fieldMapPage.elements.save.typeLine", "Type: {{type}}", { type: e(Q.labelKey, Q.label) })]
2236
2284
  }),
2237
- Q?.hint && /* @__PURE__ */ y("p", {
2285
+ Q?.hint && /* @__PURE__ */ b("p", {
2238
2286
  className: "text-xs text-text-secondary",
2239
- children: e(Q.hint.key, Q.hint.defaultValue, { type: Q.promotesTo ? l(e, Q.promotesTo) : "" })
2287
+ children: e(Q.hint.key, Q.hint.defaultValue, { type: Q.promotesTo ? u(e, Q.promotesTo) : "" })
2240
2288
  }),
2241
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2289
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
2242
2290
  className: "text-sm font-medium text-text-primary",
2243
2291
  children: e("healthybowl.fieldMapPage.elements.save.name", "Name *")
2244
- }), /* @__PURE__ */ y("input", {
2292
+ }), /* @__PURE__ */ b("input", {
2245
2293
  type: "text",
2246
- value: Kn,
2247
- onChange: (e) => qn(e.target.value),
2294
+ value: Xn,
2295
+ onChange: (e) => Zn(e.target.value),
2248
2296
  placeholder: e("healthybowl.fieldMapPage.elements.save.namePlaceholder", "e.g., North buffer strip"),
2249
2297
  className: "mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
2250
2298
  })] }),
2251
- /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("label", {
2299
+ /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("label", {
2252
2300
  className: "text-sm font-medium text-text-primary",
2253
2301
  children: e("healthybowl.fieldMapPage.elements.save.notes", "Notes")
2254
- }), /* @__PURE__ */ y("textarea", {
2255
- value: Jn,
2256
- onChange: (e) => Yn(e.target.value),
2302
+ }), /* @__PURE__ */ b("textarea", {
2303
+ value: Qn,
2304
+ onChange: (e) => $n(e.target.value),
2257
2305
  rows: 3,
2258
2306
  placeholder: e("healthybowl.fieldMapPage.elements.save.notesPlaceholder", "Optional details…"),
2259
2307
  className: "mt-1 w-full resize-y rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
@@ -2261,76 +2309,76 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
2261
2309
  ]
2262
2310
  })
2263
2311
  }),
2264
- /* @__PURE__ */ y(ne, {
2265
- open: R !== null,
2266
- onClose: () => Qn(null),
2267
- title: R?.name ?? e("healthybowl.fieldMapPage.elements.detail.title", "Map element"),
2268
- description: $ ? e($.labelKey, $.label) : R?.type ?? "",
2269
- footer: /* @__PURE__ */ b(Ye, { children: [
2270
- /* @__PURE__ */ y(x, {
2312
+ /* @__PURE__ */ b(oe, {
2313
+ open: V !== null,
2314
+ onClose: () => nr(null),
2315
+ title: V?.name ?? e("healthybowl.fieldMapPage.elements.detail.title", "Map element"),
2316
+ description: $ ? e($.labelKey, $.label) : V?.type ?? "",
2317
+ footer: /* @__PURE__ */ x($e, { children: [
2318
+ /* @__PURE__ */ b(S, {
2271
2319
  variant: "outline",
2272
- onClick: () => Qn(null),
2320
+ onClick: () => nr(null),
2273
2321
  className: "text-text-secondary",
2274
2322
  children: e("healthybowl.common.close", "Close")
2275
2323
  }),
2276
- Li && $?.promotesTo && /* @__PURE__ */ b(x, {
2324
+ Qi && $?.promotesTo && /* @__PURE__ */ x(S, {
2277
2325
  variant: "default",
2278
- onClick: Ri,
2326
+ onClick: $i,
2279
2327
  children: [
2280
- /* @__PURE__ */ y(Le, { className: "h-4 w-4" }),
2328
+ /* @__PURE__ */ b(Ve, { className: "h-4 w-4" }),
2281
2329
  " ",
2282
- e("healthybowl.fieldMapPage.elements.detail.promote", "Create a {{type}} field", { type: l(e, $.promotesTo).toLowerCase() })
2330
+ e("healthybowl.fieldMapPage.elements.detail.promote", "Create a {{type}} field", { type: u(e, $.promotesTo).toLowerCase() })
2283
2331
  ]
2284
2332
  }),
2285
- /* @__PURE__ */ b(x, {
2333
+ /* @__PURE__ */ x(S, {
2286
2334
  variant: "destructive",
2287
- onClick: Fi,
2288
- disabled: $n,
2335
+ onClick: Xi,
2336
+ disabled: rr,
2289
2337
  children: [
2290
- /* @__PURE__ */ y(Ue, { className: "h-4 w-4" }),
2338
+ /* @__PURE__ */ b(qe, { className: "h-4 w-4" }),
2291
2339
  " ",
2292
- $n ? e("healthybowl.fieldMapPage.elements.detail.deleting", "Deleting…") : e("healthybowl.common.delete", "Delete")
2340
+ rr ? e("healthybowl.fieldMapPage.elements.detail.deleting", "Deleting…") : e("healthybowl.common.delete", "Delete")
2293
2341
  ]
2294
2342
  })
2295
2343
  ] }),
2296
- children: /* @__PURE__ */ b("div", {
2344
+ children: /* @__PURE__ */ x("div", {
2297
2345
  className: "space-y-3 text-sm",
2298
2346
  children: [
2299
- /* @__PURE__ */ b("div", {
2347
+ /* @__PURE__ */ x("div", {
2300
2348
  className: "flex justify-between gap-3",
2301
- children: [/* @__PURE__ */ y("span", {
2349
+ children: [/* @__PURE__ */ b("span", {
2302
2350
  className: "text-text-secondary",
2303
2351
  children: e("healthybowl.fieldMapPage.elements.detail.type", "Type")
2304
- }), /* @__PURE__ */ b("span", {
2352
+ }), /* @__PURE__ */ x("span", {
2305
2353
  className: "flex items-center gap-1.5 font-medium text-text-primary",
2306
- children: [$ && /* @__PURE__ */ y($.icon, {
2354
+ children: [$ && /* @__PURE__ */ b($.icon, {
2307
2355
  className: "h-4 w-4",
2308
2356
  style: { color: $.color }
2309
- }), $ ? e($.labelKey, $.label) : R?.type]
2357
+ }), $ ? e($.labelKey, $.label) : V?.type]
2310
2358
  })]
2311
2359
  }),
2312
- $?.hint && /* @__PURE__ */ y("div", {
2360
+ $?.hint && /* @__PURE__ */ b("div", {
2313
2361
  className: "rounded-md bg-warning/10 px-3 py-2 text-xs text-text-secondary",
2314
- children: e($.hint.key, $.hint.defaultValue, { type: $.promotesTo ? l(e, $.promotesTo) : "" })
2362
+ children: e($.hint.key, $.hint.defaultValue, { type: $.promotesTo ? u(e, $.promotesTo) : "" })
2315
2363
  }),
2316
- R?.notes && /* @__PURE__ */ b("div", { children: [/* @__PURE__ */ y("span", {
2364
+ V?.notes && /* @__PURE__ */ x("div", { children: [/* @__PURE__ */ b("span", {
2317
2365
  className: "text-text-secondary",
2318
2366
  children: e("healthybowl.fieldMapPage.elements.detail.notes", "Notes")
2319
- }), /* @__PURE__ */ y("p", {
2367
+ }), /* @__PURE__ */ b("p", {
2320
2368
  className: "mt-1 whitespace-pre-wrap text-text-primary",
2321
- children: R.notes
2369
+ children: V.notes
2322
2370
  })] })
2323
2371
  ]
2324
2372
  })
2325
2373
  }),
2326
- /* @__PURE__ */ y(ee, {
2327
- toasts: jt,
2328
- onDismiss: Ft
2374
+ /* @__PURE__ */ b(ie, {
2375
+ toasts: Ft,
2376
+ onDismiss: zt
2329
2377
  })
2330
2378
  ]
2331
2379
  });
2332
2380
  };
2333
2381
  //#endregion
2334
- export { D as FieldMapPage };
2382
+ export { O as FieldMapPage };
2335
2383
 
2336
2384
  //# sourceMappingURL=FieldMapPage.js.map