@burdenoff/microfe-healthybowl 2026.802.1 → 2026.803.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,20 +2,20 @@ import { __toESM as e } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { geocodePlace as t } from "../utils/geocode.js";
3
3
  import { useHealthyBowl as n } from "../context/HealthyBowlContext.js";
4
4
  import { ToastContainer as r } from "./Toast.js";
5
- import { require_leaflet_src as i } from "../../node_modules/leaflet/dist/leaflet-src.js";
6
- import { useToast as a } from "../hooks/useToast.js";
7
- import { ensureLeafletCss as ee } from "../utils/leaflet.js";
8
- import { extractPolygon as o, isValidPolygon as te, polygonAreaInUnit as s, ringToPolygon as ne } from "../utils/geo.js";
5
+ import { extractPolygon as ee, isUsableCoordinate as i, isValidPolygon as te, polygonAreaInUnit as a, ringToPolygon as o } from "../utils/geo.js";
6
+ import { require_leaflet_src as s } from "../../node_modules/leaflet/dist/leaflet-src.js";
7
+ import { useToast as ne } from "../hooks/useToast.js";
8
+ import { ensureLeafletCss as re } from "../utils/leaflet.js";
9
9
  import "../utils/index.js";
10
10
  import { useCallback as c, useEffect as l, useRef as u, useState as d } from "react";
11
- import { useI18n as re } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
12
- import { Check as ie, LocateFixed as ae, MapPin as f, MapPinned as oe, Pencil as se, Save as ce, Search as p, Trash2 as le, Upload as ue, X as de } from "lucide-react";
13
- import { Fragment as fe, jsx as m, jsxs as h } from "react/jsx-runtime";
14
- import { Button as g } from "@burdenoff/fe-libs/ui";
15
- import { gql as _ } from "@apollo/client";
11
+ import { useI18n as ie } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
12
+ import { Check as ae, LocateFixed as oe, MapPin as se, MapPinned as ce, Pencil as le, Save as ue, Search as f, Trash2 as de, Upload as fe, X as p } from "lucide-react";
13
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
14
+ import { Button as _ } from "@burdenoff/fe-libs/ui";
15
+ import { gql as v } from "@apollo/client";
16
16
  import { useMutation as pe } from "@apollo/client/react";
17
17
  //#region src/healthybowl/components/FieldMap.tsx
18
- var v = /* @__PURE__ */ e(i(), 1), me = _`
18
+ var y = /* @__PURE__ */ e(s(), 1), me = v`
19
19
  mutation UpdateHealthyBowlFieldBoundary($input: UpdateHealthyBowlFieldInput!) {
20
20
  updateHealthyBowlField(input: $input) {
21
21
  id
@@ -24,22 +24,22 @@ var v = /* @__PURE__ */ e(i(), 1), me = _`
24
24
  location
25
25
  }
26
26
  }
27
- `, he = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", ge = "Esri, Maxar, Earthstar Geographics", _e = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", ve = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", ye = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", be = {
27
+ `, he = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", ge = "Esri, Maxar, Earthstar Geographics", _e = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", b = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", ve = "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", ye = {
28
28
  color: "#16a34a",
29
29
  weight: 2,
30
30
  fillColor: "#16a34a",
31
31
  fillOpacity: .25
32
- }, xe = {
32
+ }, be = {
33
33
  color: "#f59e0b",
34
34
  weight: 2,
35
35
  dashArray: "6 4",
36
36
  fillColor: "#f59e0b",
37
37
  fillOpacity: .15
38
- }, Se = 16, Ce = 17, y = (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)), we = (e) => {
38
+ }, x = 16, xe = 17, Se = (e) => {
39
39
  let t = e.trim().match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
40
40
  if (!t) return null;
41
41
  let n = Number(t[1]), r = Number(t[2]);
42
- return y({
42
+ return i({
43
43
  lat: n,
44
44
  lng: r
45
45
  }) ? {
@@ -47,48 +47,48 @@ var v = /* @__PURE__ */ e(i(), 1), me = _`
47
47
  lng: r,
48
48
  label: `${n.toFixed(6)}, ${r.toFixed(6)}`
49
49
  } : null;
50
- }, Te = ({ fieldId: e, unit: i, center: _, initialBoundary: Te, onSaved: Ee, onAreaChange: De }) => {
51
- let { t: b } = re(), { workspaceId: x } = n(), { toasts: Oe, toast: S, dismiss: ke } = a(), C = u(null), w = u(null), T = u(null), E = u(null), D = u(null), O = u(null), k = u(null), A = u(null), j = u(_ ?? null), M = u([]), N = u([]), P = u(null), F = u("view"), [I, Ae] = d("loading"), [L, R] = d("view"), [z, je] = d(!1), [B, Me] = d(null), [Ne, Pe] = d(0), [Fe, V] = d(!1), [Ie, H] = d(!1), [Le, Re] = d(!1), [ze, U] = d(!1), [W, Be] = d(""), [G, Ve] = d(!1), [K, q] = d(null), He = Fe || Ie, [Ue] = pe(me);
50
+ }, S = ({ fieldId: e, unit: s, center: v, initialBoundary: S, onSaved: Ce, onAreaChange: we }) => {
51
+ let { t: C } = ie(), { workspaceId: Te } = n(), { toasts: Ee, toast: w, dismiss: De } = ne(), Oe = u(null), ke = u(null), T = u(null), E = u(null), D = u(null), O = u(null), k = u(null), A = u(null), j = u(v ?? null), M = u([]), N = u([]), P = u(null), F = u("view"), [I, Ae] = d("loading"), [L, R] = d("view"), [z, B] = d(!1), [V, je] = d(null), [Me, Ne] = d(0), [Pe, H] = d(!1), [Fe, U] = d(!1), [Ie, Le] = d(!1), [Re, W] = d(!1), [G, ze] = d(""), [K, Be] = d(!1), [q, J] = d(null), Ve = Pe || Fe, [He] = pe(me);
52
52
  l(() => {
53
- j.current = _ ?? null;
54
- }, [_]), l(() => {
55
- De?.(B);
56
- }, [B, De]);
57
- let J = c(() => {
53
+ j.current = v ?? null;
54
+ }, [v]), l(() => {
55
+ we?.(V);
56
+ }, [V, we]);
57
+ let Y = c(() => {
58
58
  let e = T.current;
59
- D.current && e && e.removeLayer(D.current), D.current = null, M.current.forEach((t) => e?.removeLayer(t)), M.current = [], N.current = [], Pe(0);
60
- }, []), Y = c((e, t) => {
59
+ D.current && e && e.removeLayer(D.current), D.current = null, M.current.forEach((t) => e?.removeLayer(t)), M.current = [], N.current = [], Ne(0);
60
+ }, []), X = c((e, t) => {
61
61
  let n = T.current;
62
62
  if (!n) return;
63
63
  E.current && n.removeLayer(E.current);
64
- let r = v.default.geoJSON(e, { style: () => be }).addTo(n);
65
- if (E.current = r, P.current = e, je(!0), Me(s(e, i)), t) try {
64
+ let r = y.default.geoJSON(e, { style: () => ye }).addTo(n);
65
+ if (E.current = r, P.current = e, B(!0), je(a(e, s)), t) try {
66
66
  n.fitBounds(r.getBounds(), {
67
67
  padding: [24, 24],
68
68
  maxZoom: 18
69
69
  });
70
70
  } catch {}
71
- }, [i]), X = c(() => {
71
+ }, [s]), Z = c(() => {
72
72
  let e = T.current;
73
- E.current && e && e.removeLayer(E.current), E.current = null, P.current = null, je(!1), Me(null);
74
- }, []), Z = c(() => {
73
+ E.current && e && e.removeLayer(E.current), E.current = null, P.current = null, B(!1), je(null);
74
+ }, []), Ue = c(() => {
75
75
  let e = T.current;
76
76
  O.current && e && e.removeLayer(O.current), k.current && e && e.removeLayer(k.current), O.current = null, k.current = null;
77
77
  }, []), We = c(() => {
78
78
  let e = T.current;
79
- A.current && e && e.removeLayer(A.current), A.current = null, q(null), H(!1);
79
+ A.current && e && e.removeLayer(A.current), A.current = null, J(null), U(!1);
80
80
  }, []), Q = c((e) => {
81
81
  let t = T.current;
82
82
  if (!t) return;
83
83
  A.current && t.removeLayer(A.current);
84
84
  let n = [e.lat, e.lng], r = document.createElement("span");
85
- r.textContent = e.label, A.current = v.default.circleMarker(n, {
85
+ r.textContent = e.label, A.current = y.default.circleMarker(n, {
86
86
  radius: 8,
87
87
  color: "#ffffff",
88
88
  weight: 2,
89
89
  fillColor: "#16a34a",
90
90
  fillOpacity: 1
91
- }).addTo(t).bindPopup(r).openPopup(), t.flyTo(n, Math.max(t.getZoom(), Ce), { duration: .75 }), q(e), H(!0);
91
+ }).addTo(t).bindPopup(r).openPopup(), t.flyTo(n, Math.max(t.getZoom(), xe), { duration: .75 }), J(e), U(!0);
92
92
  }, []), Ge = c(() => {
93
93
  let e = T.current;
94
94
  if (!e) return;
@@ -104,57 +104,57 @@ var v = /* @__PURE__ */ e(i(), 1), me = _`
104
104
  }
105
105
  } catch {}
106
106
  let n = j.current;
107
- if (y(n)) {
108
- e.flyTo([n.lat, n.lng], Se, { duration: .6 });
107
+ if (i(n)) {
108
+ e.flyTo([n.lat, n.lng], x, { duration: .6 });
109
109
  return;
110
110
  }
111
- S({
112
- title: b("healthybowl.fieldMap.toast.noFieldLocation.title", "No field location set"),
113
- description: b("healthybowl.fieldMap.toast.noFieldLocation.description", "Draw a boundary or save GPS coordinates for this field first."),
111
+ w({
112
+ title: C("healthybowl.fieldMap.toast.noFieldLocation.title", "No field location set"),
113
+ description: C("healthybowl.fieldMap.toast.noFieldLocation.description", "Draw a boundary or save GPS coordinates for this field first."),
114
114
  variant: "warning"
115
115
  });
116
- }, [b, S]), Ke = c(() => {
116
+ }, [C, w]), Ke = c(() => {
117
117
  let e = T.current;
118
118
  if (e) {
119
119
  if (typeof navigator > "u" || !navigator.geolocation) {
120
- S({
121
- title: b("healthybowl.fieldMap.toast.locationUnsupported.title", "Location unavailable"),
122
- description: b("healthybowl.fieldMap.toast.locationUnsupported.description", "This browser does not support device location."),
120
+ w({
121
+ title: C("healthybowl.fieldMap.toast.locationUnsupported.title", "Location unavailable"),
122
+ description: C("healthybowl.fieldMap.toast.locationUnsupported.description", "This browser does not support device location."),
123
123
  variant: "warning"
124
124
  });
125
125
  return;
126
126
  }
127
- U(!0), navigator.geolocation.getCurrentPosition((t) => {
127
+ W(!0), navigator.geolocation.getCurrentPosition((t) => {
128
128
  let n = [t.coords.latitude, t.coords.longitude];
129
- Z(), k.current = v.default.circle(n, {
129
+ Ue(), k.current = y.default.circle(n, {
130
130
  radius: Math.max(10, t.coords.accuracy || 0),
131
131
  color: "#2563eb",
132
132
  fillColor: "#3b82f6",
133
133
  fillOpacity: .12,
134
134
  opacity: .45,
135
135
  weight: 1
136
- }).addTo(e), O.current = v.default.circleMarker(n, {
136
+ }).addTo(e), O.current = y.default.circleMarker(n, {
137
137
  radius: 7,
138
138
  color: "#ffffff",
139
139
  weight: 2,
140
140
  fillColor: "#2563eb",
141
141
  fillOpacity: 1
142
- }).addTo(e), e.flyTo(n, Math.max(e.getZoom(), Ce), { duration: .75 }), Q({
142
+ }).addTo(e), e.flyTo(n, Math.max(e.getZoom(), xe), { duration: .75 }), Q({
143
143
  lat: t.coords.latitude,
144
144
  lng: t.coords.longitude,
145
- label: b("healthybowl.fieldMap.location.currentLabel", "My current location")
146
- }), U(!1), S({
147
- title: b("healthybowl.fieldMap.toast.locationReady.title", "Location ready"),
148
- description: b("healthybowl.fieldMap.toast.locationReady.description", "Save to store this as the field GPS location."),
145
+ label: C("healthybowl.fieldMap.location.currentLabel", "My current location")
146
+ }), W(!1), w({
147
+ title: C("healthybowl.fieldMap.toast.locationReady.title", "Location ready"),
148
+ description: C("healthybowl.fieldMap.toast.locationReady.description", "Save to store this as the field GPS location."),
149
149
  variant: "success"
150
150
  });
151
151
  }, (e) => {
152
152
  let t = e.code === e.PERMISSION_DENIED;
153
- S({
154
- title: t ? b("healthybowl.fieldMap.toast.locationBlocked.title", "Location blocked") : b("healthybowl.fieldMap.toast.locationFailed.title", "Could not get location"),
155
- description: t ? b("healthybowl.fieldMap.toast.locationBlocked.description", "Allow location access in the browser, then try again.") : b("healthybowl.fieldMap.toast.locationFailed.description", "Make sure GPS is enabled and the page is open over HTTPS."),
153
+ w({
154
+ title: t ? C("healthybowl.fieldMap.toast.locationBlocked.title", "Location blocked") : C("healthybowl.fieldMap.toast.locationFailed.title", "Could not get location"),
155
+ description: t ? C("healthybowl.fieldMap.toast.locationBlocked.description", "Allow location access in the browser, then try again.") : C("healthybowl.fieldMap.toast.locationFailed.description", "Make sure GPS is enabled and the page is open over HTTPS."),
156
156
  variant: "warning"
157
- }), U(!1);
157
+ }), W(!1);
158
158
  }, {
159
159
  enableHighAccuracy: !0,
160
160
  timeout: 12e3,
@@ -162,33 +162,33 @@ var v = /* @__PURE__ */ e(i(), 1), me = _`
162
162
  });
163
163
  }
164
164
  }, [
165
- Z,
165
+ Ue,
166
166
  Q,
167
- b,
168
- S
167
+ C,
168
+ w
169
169
  ]), qe = c(async (e) => {
170
170
  e.preventDefault();
171
- let n = W.trim();
171
+ let n = G.trim();
172
172
  if (!n) {
173
- S({
174
- title: b("healthybowl.fieldMap.toast.searchRequired.title", "Place required"),
175
- description: b("healthybowl.fieldMap.toast.searchRequired.description", "Enter a village, city, region, or coordinates."),
173
+ w({
174
+ title: C("healthybowl.fieldMap.toast.searchRequired.title", "Place required"),
175
+ description: C("healthybowl.fieldMap.toast.searchRequired.description", "Enter a village, city, region, or coordinates."),
176
176
  variant: "warning"
177
177
  });
178
178
  return;
179
179
  }
180
- let r = we(n);
180
+ let r = Se(n);
181
181
  if (r) {
182
182
  Q(r);
183
183
  return;
184
184
  }
185
- Ve(!0);
185
+ Be(!0);
186
186
  try {
187
187
  let e = await t(n);
188
188
  if (!e) {
189
- S({
190
- title: b("healthybowl.fieldMap.toast.searchNotFound.title", "Place not found"),
191
- description: b("healthybowl.fieldMap.toast.searchNotFound.description", "Try a more specific location, such as village, district, and state."),
189
+ w({
190
+ title: C("healthybowl.fieldMap.toast.searchNotFound.title", "Place not found"),
191
+ description: C("healthybowl.fieldMap.toast.searchNotFound.description", "Try a more specific location, such as village, district, and state."),
192
192
  variant: "warning"
193
193
  });
194
194
  return;
@@ -204,49 +204,49 @@ var v = /* @__PURE__ */ e(i(), 1), me = _`
204
204
  label: r
205
205
  });
206
206
  } catch (e) {
207
- S({
208
- title: b("healthybowl.fieldMap.toast.searchFailed.title", "Search failed"),
207
+ w({
208
+ title: C("healthybowl.fieldMap.toast.searchFailed.title", "Search failed"),
209
209
  description: e instanceof Error ? e.message : String(e),
210
210
  variant: "error"
211
211
  });
212
212
  } finally {
213
- Ve(!1);
213
+ Be(!1);
214
214
  }
215
215
  }, [
216
- W,
216
+ G,
217
217
  Q,
218
- b,
219
- S
218
+ C,
219
+ w
220
220
  ]), Je = c(() => {
221
221
  let e = T.current;
222
222
  if (!e) return;
223
223
  let t = N.current;
224
- D.current && e.removeLayer(D.current), t.length >= 2 ? D.current = v.default.polygon(t, xe).addTo(e) : D.current = null;
224
+ D.current && e.removeLayer(D.current), t.length >= 2 ? D.current = y.default.polygon(t, be).addTo(e) : D.current = null;
225
225
  }, []), $ = c(() => {
226
226
  if (N.current.length < 3) {
227
- S({
228
- title: b("healthybowl.fieldMap.toast.needPoints.title", "Need at least 3 points"),
229
- description: b("healthybowl.fieldMap.toast.needPoints.description", "Click on the map to add more boundary corners."),
227
+ w({
228
+ title: C("healthybowl.fieldMap.toast.needPoints.title", "Need at least 3 points"),
229
+ description: C("healthybowl.fieldMap.toast.needPoints.description", "Click on the map to add more boundary corners."),
230
230
  variant: "warning"
231
231
  });
232
232
  return;
233
233
  }
234
- let e = ne(N.current.map((e) => ({
234
+ let e = o(N.current.map((e) => ({
235
235
  lat: e.lat,
236
236
  lng: e.lng
237
237
  })));
238
- J(), F.current = "view", R("view"), e && (Y(e, !1), V(!0));
238
+ Y(), F.current = "view", R("view"), e && (X(e, !1), H(!0));
239
239
  }, [
240
- J,
241
240
  Y,
242
- b,
243
- S
241
+ X,
242
+ C,
243
+ w
244
244
  ]), Ye = c((e) => {
245
245
  if (F.current !== "draw") return;
246
246
  let t = T.current;
247
247
  if (!t) return;
248
248
  N.current.push(e.latlng);
249
- let n = N.current.length === 1, r = v.default.circleMarker(e.latlng, {
249
+ let n = N.current.length === 1, r = y.default.circleMarker(e.latlng, {
250
250
  radius: n ? 7 : 5,
251
251
  color: "#fff",
252
252
  weight: 2,
@@ -254,281 +254,281 @@ var v = /* @__PURE__ */ e(i(), 1), me = _`
254
254
  fillOpacity: 1
255
255
  }).addTo(t);
256
256
  n && r.on("click", (e) => {
257
- v.default.DomEvent.stopPropagation(e), $();
258
- }), M.current.push(r), Pe(N.current.length), Je();
257
+ y.default.DomEvent.stopPropagation(e), $();
258
+ }), M.current.push(r), Ne(N.current.length), Je();
259
259
  }, [$, Je]), Xe = c(() => {
260
- X(), J(), F.current = "draw", R("draw"), V(!0);
261
- }, [J, X]), Ze = c(() => {
262
- J(), F.current = "view", R("view");
263
- }, [J]), Qe = c(() => {
264
- J(), X(), F.current = "view", R("view"), V(!0);
265
- }, [J, X]), $e = c(async (e) => {
260
+ Z(), Y(), F.current = "draw", R("draw"), H(!0);
261
+ }, [Y, Z]), Ze = c(() => {
262
+ Y(), F.current = "view", R("view");
263
+ }, [Y]), Qe = c(() => {
264
+ Y(), Z(), F.current = "view", R("view"), H(!0);
265
+ }, [Y, Z]), $e = c(async (e) => {
266
266
  try {
267
267
  let t = await e.text(), n = JSON.parse(t);
268
268
  if (!te(n)) {
269
- S({
270
- title: b("healthybowl.fieldMap.toast.importInvalid.title", "No polygon found"),
271
- description: b("healthybowl.fieldMap.toast.importInvalid.description", "The file must contain a GeoJSON Polygon (Feature, FeatureCollection or geometry)."),
269
+ w({
270
+ title: C("healthybowl.fieldMap.toast.importInvalid.title", "No polygon found"),
271
+ description: C("healthybowl.fieldMap.toast.importInvalid.description", "The file must contain a GeoJSON Polygon (Feature, FeatureCollection or geometry)."),
272
272
  variant: "error"
273
273
  });
274
274
  return;
275
275
  }
276
- let r = o(n);
277
- J(), F.current = "view", R("view"), Y(r, !0), V(!0), S({
278
- title: b("healthybowl.fieldMap.toast.imported.title", "Boundary imported"),
279
- description: b("healthybowl.fieldMap.toast.imported.description", "Review it on the map, then Save to persist."),
276
+ let r = ee(n);
277
+ Y(), F.current = "view", R("view"), X(r, !0), H(!0), w({
278
+ title: C("healthybowl.fieldMap.toast.imported.title", "Boundary imported"),
279
+ description: C("healthybowl.fieldMap.toast.imported.description", "Review it on the map, then Save to persist."),
280
280
  variant: "success"
281
281
  });
282
282
  } catch {
283
- S({
284
- title: b("healthybowl.fieldMap.toast.importFailed.title", "Could not read file"),
285
- description: b("healthybowl.fieldMap.toast.importFailed.description", "Make sure it is a valid GeoJSON (.json / .geojson) file."),
283
+ w({
284
+ title: C("healthybowl.fieldMap.toast.importFailed.title", "Could not read file"),
285
+ description: C("healthybowl.fieldMap.toast.importFailed.description", "Make sure it is a valid GeoJSON (.json / .geojson) file."),
286
286
  variant: "error"
287
287
  });
288
288
  }
289
289
  }, [
290
- J,
291
290
  Y,
292
- b,
293
- S
291
+ X,
292
+ C,
293
+ w
294
294
  ]), et = c(async () => {
295
- Re(!0);
295
+ Le(!0);
296
296
  try {
297
- let t = P.current, n = t ? s(t, i) : void 0, r = K ? {
298
- lat: K.lat,
299
- lng: K.lng
297
+ let t = P.current, n = t ? a(t, s) : void 0, r = q ? {
298
+ lat: q.lat,
299
+ lng: q.lng
300
300
  } : void 0;
301
- await Ue({ variables: { input: {
301
+ await He({ variables: { input: {
302
302
  id: e,
303
303
  boundary: t,
304
304
  ...n == null ? {} : { area: n },
305
305
  ...r ? { location: r } : {},
306
- context: { workspaceId: x }
307
- } } }), r && (j.current = r), V(!1), H(!1), q(null), Ee?.(), S({
308
- title: b("healthybowl.fieldMap.toast.saved.title", "Map saved"),
309
- description: r ? b("healthybowl.fieldMap.toast.savedLocation.description", "Field GPS location updated.") : t ? b("healthybowl.fieldMap.toast.saved.description", "Field area updated to {{area}} {{unit}}.", {
306
+ context: { workspaceId: Te }
307
+ } } }), r && (j.current = r), H(!1), U(!1), J(null), Ce?.(), w({
308
+ title: C("healthybowl.fieldMap.toast.saved.title", "Map saved"),
309
+ description: r ? C("healthybowl.fieldMap.toast.savedLocation.description", "Field GPS location updated.") : t ? C("healthybowl.fieldMap.toast.saved.description", "Field area updated to {{area}} {{unit}}.", {
310
310
  area: String(n ?? ""),
311
- unit: i
312
- }) : b("healthybowl.fieldMap.toast.savedCleared.description", "Boundary removed from this field."),
311
+ unit: s
312
+ }) : C("healthybowl.fieldMap.toast.savedCleared.description", "Boundary removed from this field."),
313
313
  variant: "success"
314
314
  });
315
315
  } catch (e) {
316
- S({
317
- title: b("healthybowl.fieldMap.toast.saveFailed.title", "Save failed"),
316
+ w({
317
+ title: C("healthybowl.fieldMap.toast.saveFailed.title", "Save failed"),
318
318
  description: String(e),
319
319
  variant: "error"
320
320
  });
321
321
  } finally {
322
- Re(!1);
322
+ Le(!1);
323
323
  }
324
324
  }, [
325
325
  e,
326
- Ee,
327
- K,
328
- b,
329
- S,
330
- i,
331
- Ue,
332
- x
326
+ Ce,
327
+ q,
328
+ C,
329
+ w,
330
+ s,
331
+ He,
332
+ Te
333
333
  ]);
334
334
  return l(() => {
335
- let e = w.current;
335
+ let e = ke.current;
336
336
  if (!e) return;
337
- ee();
338
- let t = v.default.tileLayer(he, {
337
+ re();
338
+ let t = y.default.tileLayer(he, {
339
339
  attribution: ge,
340
340
  maxZoom: 21,
341
341
  maxNativeZoom: 18
342
- }), n = v.default.tileLayer(_e, {
343
- attribution: ve,
342
+ }), n = y.default.tileLayer(_e, {
343
+ attribution: b,
344
344
  maxZoom: 21,
345
345
  maxNativeZoom: 17
346
- }), r = v.default.tileLayer(_e, {
347
- attribution: ve,
346
+ }), r = y.default.tileLayer(_e, {
347
+ attribution: b,
348
348
  maxZoom: 21,
349
349
  maxNativeZoom: 17,
350
350
  opacity: .6
351
- }), i = v.default.tileLayer(ye, {
351
+ }), a = y.default.tileLayer(ve, {
352
352
  attribution: "© OpenStreetMap contributors",
353
353
  maxZoom: 21,
354
354
  maxNativeZoom: 19
355
- }), a = v.default.map(e, {
355
+ }), o = y.default.map(e, {
356
356
  center: [20, 0],
357
357
  zoom: 2,
358
358
  scrollWheelZoom: !0,
359
359
  maxZoom: 21,
360
360
  layers: [t]
361
361
  });
362
- T.current = a, v.default.control.layers({ [b("healthybowl.fieldMap.layers.satellite", "Satellite (Esri)")]: t }, {
363
- [b("healthybowl.fieldMap.layers.terrain", "Terrain (OpenTopoMap)")]: n,
364
- [b("healthybowl.fieldMap.layers.soil", "Soil (placeholder)")]: r,
365
- [b("healthybowl.fieldMap.layers.streets", "Streets (OSM)")]: i
366
- }, { collapsed: !1 }).addTo(a), a.on("click", Ye);
367
- let s = o(Te);
368
- return s && te(s) ? Y(s, !0) : y(_) && a.setView([_.lat, _.lng], Se), Ae("ready"), window.setTimeout(() => a.invalidateSize(), 80), () => {
369
- a.off("click", Ye), a.remove(), T.current = null, E.current = null, D.current = null, O.current = null, k.current = null, A.current = null, M.current = [], N.current = [], P.current = null;
362
+ T.current = o, y.default.control.layers({ [C("healthybowl.fieldMap.layers.satellite", "Satellite (Esri)")]: t }, {
363
+ [C("healthybowl.fieldMap.layers.terrain", "Terrain (OpenTopoMap)")]: n,
364
+ [C("healthybowl.fieldMap.layers.soil", "Soil (placeholder)")]: r,
365
+ [C("healthybowl.fieldMap.layers.streets", "Streets (OSM)")]: a
366
+ }, { collapsed: !1 }).addTo(o), o.on("click", Ye);
367
+ let s = ee(S);
368
+ return s && te(s) ? X(s, !0) : i(v) && o.setView([v.lat, v.lng], x), Ae("ready"), window.setTimeout(() => o.invalidateSize(), 80), () => {
369
+ o.off("click", Ye), o.remove(), T.current = null, E.current = null, D.current = null, O.current = null, k.current = null, A.current = null, M.current = [], N.current = [], P.current = null;
370
370
  };
371
- }, []), /* @__PURE__ */ h("div", {
371
+ }, []), /* @__PURE__ */ g("div", {
372
372
  className: "relative",
373
373
  children: [
374
- /* @__PURE__ */ h("div", {
374
+ /* @__PURE__ */ g("div", {
375
375
  className: "mb-3 flex flex-wrap items-center gap-2",
376
- children: [L === "view" ? /* @__PURE__ */ h(fe, { children: [
377
- /* @__PURE__ */ h(g, {
376
+ children: [L === "view" ? /* @__PURE__ */ g(m, { children: [
377
+ /* @__PURE__ */ g(_, {
378
378
  variant: "outline",
379
379
  size: "sm",
380
380
  onClick: Xe,
381
381
  children: [
382
- /* @__PURE__ */ m(se, { className: "h-4 w-4" }),
382
+ /* @__PURE__ */ h(le, { className: "h-4 w-4" }),
383
383
  " ",
384
- z ? b("healthybowl.fieldMap.actions.redraw", "Redraw") : b("healthybowl.fieldMap.actions.draw", "Draw boundary")
384
+ z ? C("healthybowl.fieldMap.actions.redraw", "Redraw") : C("healthybowl.fieldMap.actions.draw", "Draw boundary")
385
385
  ]
386
386
  }),
387
- /* @__PURE__ */ h(g, {
387
+ /* @__PURE__ */ g(_, {
388
388
  variant: "outline",
389
389
  size: "sm",
390
- onClick: () => C.current?.click(),
390
+ onClick: () => Oe.current?.click(),
391
391
  children: [
392
- /* @__PURE__ */ m(ue, { className: "h-4 w-4" }),
392
+ /* @__PURE__ */ h(fe, { className: "h-4 w-4" }),
393
393
  " ",
394
- b("healthybowl.fieldMap.actions.import", "Import GeoJSON")
394
+ C("healthybowl.fieldMap.actions.import", "Import GeoJSON")
395
395
  ]
396
396
  }),
397
- /* @__PURE__ */ h(g, {
397
+ /* @__PURE__ */ g(_, {
398
398
  variant: "outline",
399
399
  size: "sm",
400
400
  onClick: Ge,
401
- title: b("healthybowl.fieldMap.actions.focusField.title", "Fit map to this field"),
402
- "aria-label": b("healthybowl.fieldMap.actions.focusField.title", "Fit map to this field"),
401
+ title: C("healthybowl.fieldMap.actions.focusField.title", "Fit map to this field"),
402
+ "aria-label": C("healthybowl.fieldMap.actions.focusField.title", "Fit map to this field"),
403
403
  children: [
404
- /* @__PURE__ */ m(oe, { className: "h-4 w-4" }),
404
+ /* @__PURE__ */ h(ce, { className: "h-4 w-4" }),
405
405
  " ",
406
- b("healthybowl.fieldMap.actions.focusField", "Field")
406
+ C("healthybowl.fieldMap.actions.focusField", "Field")
407
407
  ]
408
408
  }),
409
- /* @__PURE__ */ h(g, {
409
+ /* @__PURE__ */ g(_, {
410
410
  variant: "outline",
411
411
  size: "sm",
412
412
  onClick: Ke,
413
- disabled: ze,
414
- title: b("healthybowl.fieldMap.actions.locateMe.title", "Go to my current location"),
415
- "aria-label": b("healthybowl.fieldMap.actions.locateMe.title", "Go to my current location"),
413
+ disabled: Re,
414
+ title: C("healthybowl.fieldMap.actions.locateMe.title", "Go to my current location"),
415
+ "aria-label": C("healthybowl.fieldMap.actions.locateMe.title", "Go to my current location"),
416
416
  children: [
417
- /* @__PURE__ */ m(ae, { className: "h-4 w-4" }),
417
+ /* @__PURE__ */ h(oe, { className: "h-4 w-4" }),
418
418
  " ",
419
- ze ? b("healthybowl.fieldMap.actions.locating", "Locating...") : b("healthybowl.fieldMap.actions.locateMe", "My location")
419
+ Re ? C("healthybowl.fieldMap.actions.locating", "Locating...") : C("healthybowl.fieldMap.actions.locateMe", "My location")
420
420
  ]
421
421
  }),
422
- z && /* @__PURE__ */ h(g, {
422
+ z && /* @__PURE__ */ g(_, {
423
423
  variant: "outline",
424
424
  size: "sm",
425
425
  onClick: Qe,
426
426
  children: [
427
- /* @__PURE__ */ m(le, { className: "h-4 w-4" }),
427
+ /* @__PURE__ */ h(de, { className: "h-4 w-4" }),
428
428
  " ",
429
- b("healthybowl.fieldMap.actions.clear", "Clear")
429
+ C("healthybowl.fieldMap.actions.clear", "Clear")
430
430
  ]
431
431
  })
432
- ] }) : /* @__PURE__ */ h(fe, { children: [
433
- /* @__PURE__ */ h(g, {
432
+ ] }) : /* @__PURE__ */ g(m, { children: [
433
+ /* @__PURE__ */ g(_, {
434
434
  variant: "default",
435
435
  size: "sm",
436
436
  onClick: $,
437
437
  children: [
438
- /* @__PURE__ */ m(ie, { className: "h-4 w-4" }),
438
+ /* @__PURE__ */ h(ae, { className: "h-4 w-4" }),
439
439
  " ",
440
- b("healthybowl.fieldMap.actions.finish", "Finish")
440
+ C("healthybowl.fieldMap.actions.finish", "Finish")
441
441
  ]
442
442
  }),
443
- /* @__PURE__ */ h(g, {
443
+ /* @__PURE__ */ g(_, {
444
444
  variant: "outline",
445
445
  size: "sm",
446
446
  onClick: Ze,
447
447
  children: [
448
- /* @__PURE__ */ m(de, { className: "h-4 w-4" }),
448
+ /* @__PURE__ */ h(p, { className: "h-4 w-4" }),
449
449
  " ",
450
- b("healthybowl.common.cancel", "Cancel")
450
+ C("healthybowl.common.cancel", "Cancel")
451
451
  ]
452
452
  }),
453
- /* @__PURE__ */ m("span", {
453
+ /* @__PURE__ */ h("span", {
454
454
  className: "text-xs text-text-secondary",
455
- children: b("healthybowl.fieldMap.draftHint", "Click the map to add corners ({{count}} placed) — click the first point or Finish to close.", { count: String(Ne) })
455
+ children: C("healthybowl.fieldMap.draftHint", "Click the map to add corners ({{count}} placed) — click the first point or Finish to close.", { count: String(Me) })
456
456
  })
457
- ] }), /* @__PURE__ */ h("div", {
457
+ ] }), /* @__PURE__ */ g("div", {
458
458
  className: "ml-auto flex items-center gap-3",
459
- children: [B != null && /* @__PURE__ */ m("span", {
459
+ children: [V != null && /* @__PURE__ */ h("span", {
460
460
  className: "text-xs text-text-secondary",
461
- children: b("healthybowl.fieldMap.computedArea", "Area: {{area}} {{unit}}", {
462
- area: String(B),
463
- unit: i
461
+ children: C("healthybowl.fieldMap.computedArea", "Area: {{area}} {{unit}}", {
462
+ area: String(V),
463
+ unit: s
464
464
  })
465
- }), /* @__PURE__ */ h(g, {
465
+ }), /* @__PURE__ */ g(_, {
466
466
  variant: "default",
467
467
  size: "sm",
468
468
  onClick: et,
469
- disabled: !He || Le || L === "draw",
469
+ disabled: !Ve || Ie || L === "draw",
470
470
  children: [
471
- /* @__PURE__ */ m(ce, { className: "h-4 w-4" }),
471
+ /* @__PURE__ */ h(ue, { className: "h-4 w-4" }),
472
472
  " ",
473
- Le ? b("healthybowl.fieldMap.actions.saving", "Saving…") : b("healthybowl.fieldMap.actions.save", "Save")
473
+ Ie ? C("healthybowl.fieldMap.actions.saving", "Saving…") : C("healthybowl.fieldMap.actions.save", "Save")
474
474
  ]
475
475
  })]
476
476
  })]
477
477
  }),
478
- L === "view" && /* @__PURE__ */ h("div", {
478
+ L === "view" && /* @__PURE__ */ g("div", {
479
479
  className: "mb-3 space-y-2",
480
- children: [/* @__PURE__ */ h("form", {
480
+ children: [/* @__PURE__ */ g("form", {
481
481
  className: "flex flex-col gap-2 sm:flex-row",
482
482
  onSubmit: qe,
483
483
  children: [
484
- /* @__PURE__ */ h("div", {
484
+ /* @__PURE__ */ g("div", {
485
485
  className: "relative min-w-0 flex-1",
486
- children: [/* @__PURE__ */ m(p, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ m("input", {
486
+ children: [/* @__PURE__ */ h(f, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ h("input", {
487
487
  type: "search",
488
- value: W,
489
- onChange: (e) => Be(e.target.value),
490
- disabled: I !== "ready" || G,
491
- placeholder: b("healthybowl.fieldMap.search.placeholder", "Search village, city, region, or lat,lng..."),
492
- "aria-label": b("healthybowl.fieldMap.search.label", "Search field map by place or coordinates"),
488
+ value: G,
489
+ onChange: (e) => ze(e.target.value),
490
+ disabled: I !== "ready" || K,
491
+ placeholder: C("healthybowl.fieldMap.search.placeholder", "Search village, city, region, or lat,lng..."),
492
+ "aria-label": C("healthybowl.fieldMap.search.label", "Search field map by place or coordinates"),
493
493
  className: "h-9 w-full rounded-md border border-border-subtle bg-bg-surface py-2 pl-9 pr-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]"
494
494
  })]
495
495
  }),
496
- /* @__PURE__ */ h(g, {
496
+ /* @__PURE__ */ g(_, {
497
497
  type: "submit",
498
498
  variant: "outline",
499
499
  size: "sm",
500
- disabled: I !== "ready" || G,
500
+ disabled: I !== "ready" || K,
501
501
  children: [
502
- /* @__PURE__ */ m(p, { className: "h-4 w-4" }),
502
+ /* @__PURE__ */ h(f, { className: "h-4 w-4" }),
503
503
  " ",
504
- G ? b("healthybowl.fieldMap.search.searching", "Searching...") : b("healthybowl.fieldMap.search.action", "Search")
504
+ K ? C("healthybowl.fieldMap.search.searching", "Searching...") : C("healthybowl.fieldMap.search.action", "Search")
505
505
  ]
506
506
  }),
507
- K && /* @__PURE__ */ h(g, {
507
+ q && /* @__PURE__ */ g(_, {
508
508
  type: "button",
509
509
  variant: "outline",
510
510
  size: "sm",
511
511
  onClick: We,
512
512
  children: [
513
- /* @__PURE__ */ m(de, { className: "h-4 w-4" }),
513
+ /* @__PURE__ */ h(p, { className: "h-4 w-4" }),
514
514
  " ",
515
- b("healthybowl.common.clear", "Clear")
515
+ C("healthybowl.common.clear", "Clear")
516
516
  ]
517
517
  })
518
518
  ]
519
- }), K && /* @__PURE__ */ m("div", {
519
+ }), q && /* @__PURE__ */ h("div", {
520
520
  className: "flex flex-wrap items-center gap-2 text-xs text-text-secondary",
521
- children: /* @__PURE__ */ h("span", {
521
+ children: /* @__PURE__ */ g("span", {
522
522
  className: "inline-flex min-w-0 items-center gap-1.5 rounded-full border border-border-subtle bg-bg-sunken/70 px-2.5 py-1",
523
- children: [/* @__PURE__ */ m(f, { className: "h-3.5 w-3.5 shrink-0 text-success" }), /* @__PURE__ */ m("span", {
523
+ children: [/* @__PURE__ */ h(se, { className: "h-3.5 w-3.5 shrink-0 text-success" }), /* @__PURE__ */ h("span", {
524
524
  className: "truncate",
525
- children: b("healthybowl.fieldMap.search.pendingLocation", "Unsaved field GPS: {{place}}", { place: K.label })
525
+ children: C("healthybowl.fieldMap.search.pendingLocation", "Unsaved field GPS: {{place}}", { place: q.label })
526
526
  })]
527
527
  })
528
528
  })]
529
529
  }),
530
- /* @__PURE__ */ m("input", {
531
- ref: C,
530
+ /* @__PURE__ */ h("input", {
531
+ ref: Oe,
532
532
  type: "file",
533
533
  accept: ".json,.geojson,application/geo+json,application/json",
534
534
  className: "hidden",
@@ -537,46 +537,46 @@ var v = /* @__PURE__ */ e(i(), 1), me = _`
537
537
  t && $e(t), e.target.value = "";
538
538
  }
539
539
  }),
540
- /* @__PURE__ */ h("div", {
540
+ /* @__PURE__ */ g("div", {
541
541
  className: "relative",
542
542
  children: [
543
- /* @__PURE__ */ m("div", {
544
- ref: w,
543
+ /* @__PURE__ */ h("div", {
544
+ ref: ke,
545
545
  className: "h-[60vh] max-h-[520px] w-full overflow-hidden rounded-md border border-border-subtle bg-bg-sunken"
546
546
  }),
547
- I === "loading" && /* @__PURE__ */ m("div", {
547
+ I === "loading" && /* @__PURE__ */ h("div", {
548
548
  className: "pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/60 text-sm text-text-secondary",
549
- children: b("healthybowl.fieldMap.loading", "Loading map…")
549
+ children: C("healthybowl.fieldMap.loading", "Loading map…")
550
550
  }),
551
- I === "error" && /* @__PURE__ */ m("div", {
551
+ I === "error" && /* @__PURE__ */ h("div", {
552
552
  className: "pointer-events-none absolute inset-0 flex items-center justify-center rounded-md bg-bg-surface/80 px-4 text-center text-sm text-text-secondary",
553
- children: b("healthybowl.fieldMap.error", "The map needs an internet connection and couldn’t load.")
553
+ children: C("healthybowl.fieldMap.error", "The map needs an internet connection and couldn’t load.")
554
554
  }),
555
- I === "ready" && !z && L === "view" && /* @__PURE__ */ m("div", {
555
+ I === "ready" && !z && L === "view" && /* @__PURE__ */ h("div", {
556
556
  className: "pointer-events-none absolute left-1/2 top-3 z-[400] -translate-x-1/2 rounded-full bg-bg-surface/90 px-3 py-1.5 text-xs text-text-secondary shadow-sm",
557
- children: /* @__PURE__ */ h("span", {
557
+ children: /* @__PURE__ */ g("span", {
558
558
  className: "inline-flex items-center gap-1.5",
559
559
  children: [
560
- /* @__PURE__ */ m(f, { className: "h-3.5 w-3.5" }),
560
+ /* @__PURE__ */ h(se, { className: "h-3.5 w-3.5" }),
561
561
  " ",
562
- b("healthybowl.fieldMap.empty", "No boundary set — draw or import one.")
562
+ C("healthybowl.fieldMap.empty", "No boundary set — draw or import one.")
563
563
  ]
564
564
  })
565
565
  })
566
566
  ]
567
567
  }),
568
- /* @__PURE__ */ m("p", {
568
+ /* @__PURE__ */ h("p", {
569
569
  className: "mt-2 text-xs text-text-secondary",
570
- children: b("healthybowl.fieldMap.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · overlays © OpenTopoMap / OpenStreetMap")
570
+ children: C("healthybowl.fieldMap.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · overlays © OpenTopoMap / OpenStreetMap")
571
571
  }),
572
- /* @__PURE__ */ m(r, {
573
- toasts: Oe,
574
- onDismiss: ke
572
+ /* @__PURE__ */ h(r, {
573
+ toasts: Ee,
574
+ onDismiss: De
575
575
  })
576
576
  ]
577
577
  });
578
578
  };
579
579
  //#endregion
580
- export { Te as FieldMap };
580
+ export { S as FieldMap };
581
581
 
582
582
  //# sourceMappingURL=FieldMap.js.map