@burdenoff/microfe-healthybowl 2026.710.10 → 2026.710.12

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.
@@ -5,24 +5,25 @@ import { PageLayout as r } from "../../components/PageLayout.js";
5
5
  import { ErrorState as i } from "../../components/ErrorState.js";
6
6
  import { ToastContainer as a } from "../../components/Toast.js";
7
7
  import { useConfirm as o } from "../../components/ConfirmDialog.js";
8
- import { Modal as s } from "../../components/Modal.js";
9
- import { require_leaflet_src as c } from "../../../node_modules/leaflet/dist/leaflet-src.js";
10
- import { useToast as ee } from "../../hooks/useToast.js";
11
- import { ensureLeafletCss as te } from "../../utils/leaflet.js";
12
- import { extractPolygon as l, isValidPolygon as u, polygonAreaInUnit as d, polygonAreaSqMeters as ne, polygonCentroid as re, ringToPolygon as f } from "../../utils/geo.js";
13
- import { SOIL_PALETTE as ie, soilColor as ae, soilLegendFor as oe } from "../../utils/soil.js";
8
+ import { Modal as ee } from "../../components/Modal.js";
9
+ import { require_leaflet_src as s } from "../../../node_modules/leaflet/dist/leaflet-src.js";
10
+ import { useToast as te } from "../../hooks/useToast.js";
11
+ import { ensureLeafletCss as ne } from "../../utils/leaflet.js";
12
+ import { extractPolygon as re, isValidPolygon as c, polygonAreaInUnit as l, polygonAreaSqMeters as ie, polygonCentroid as ae, ringToPolygon as u } from "../../utils/geo.js";
13
+ import { SOIL_PALETTE as oe, soilColor as se, soilLegendFor as ce } from "../../utils/soil.js";
14
+ import { elevationColor as le, fetchElevations as ue } from "../../utils/elevation.js";
14
15
  import "../../utils/index.js";
15
16
  import "../../components/index.js";
16
- import { useHealthyBowlData as se } from "../../hooks/useHealthyBowlData.js";
17
- import { useCallback as p, useEffect as m, useMemo as h, useRef as g, useState as _ } from "react";
18
- import { useI18n as ce } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
19
- import { Check as le, Layers as ue, LocateFixed as de, MapPinned as fe, Pencil as pe, Plus as me, Ruler as he, Save as ge, Search as _e, Spline as ve, Trash2 as ye, X as be } from "lucide-react";
20
- import { Fragment as xe, jsx as v, jsxs as y } from "react/jsx-runtime";
21
- import { Button as b, Select as x, SelectContent as Se, SelectItem as S, SelectTrigger as Ce, SelectValue as we } from "@burdenoff/fe-libs/ui";
22
- import { gql as Te } from "@apollo/client";
23
- import { useMutation as Ee } from "@apollo/client/react";
17
+ import { useHealthyBowlData as de } from "../../hooks/useHealthyBowlData.js";
18
+ import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
19
+ import { useI18n as fe } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
20
+ import { Check as pe, Layers as me, LocateFixed as he, MapPinned as ge, Pencil as _e, Plus as ve, Ruler as ye, Save as be, Search as xe, Spline as Se, Trash2 as Ce, X as we } from "lucide-react";
21
+ import { Fragment as Te, jsx as g, jsxs as _ } from "react/jsx-runtime";
22
+ import { Button as v, Select as Ee, SelectContent as De, SelectItem as y, SelectTrigger as Oe, SelectValue as ke } from "@burdenoff/fe-libs/ui";
23
+ import { gql as Ae } from "@apollo/client";
24
+ import { useMutation as je } from "@apollo/client/react";
24
25
  //#region src/healthybowl/pages/fields/FieldMapPage.tsx
25
- var C = /* @__PURE__ */ e(c(), 1), De = Te`
26
+ var b = /* @__PURE__ */ e(s(), 1), Me = Ae`
26
27
  mutation UpdateHealthyBowlFieldBoundaryOnMapPage($input: UpdateHealthyBowlFieldInput!) {
27
28
  updateHealthyBowlField(input: $input) {
28
29
  id
@@ -31,48 +32,93 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
31
32
  location
32
33
  }
33
34
  }
34
- `, Oe = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", ke = "Esri, Maxar, Earthstar Geographics", Ae = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", je = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", Me = 21, Ne = 16, Pe = 2.47105, Fe = "#16a34a", Ie = {
35
+ `, Ne = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}", Pe = "Esri, Maxar, Earthstar Geographics", Fe = "https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png", Ie = "© OpenTopoMap (CC-BY-SA) · © OpenStreetMap contributors", Le = 21, Re = 16, ze = 2.47105, Be = "#16a34a", Ve = {
35
36
  color: "#f59e0b",
36
37
  weight: 2,
37
38
  dashArray: "6 4",
38
39
  fillColor: "#f59e0b",
39
40
  fillOpacity: .15
40
- }, Le = {
41
+ }, He = {
41
42
  color: "#ffffff",
42
43
  weight: 2,
43
44
  dashArray: "6 4",
44
45
  fillColor: "#22c55e",
45
46
  fillOpacity: .2
46
- }, Re = {
47
+ }, Ue = {
47
48
  color: "#38bdf8",
48
49
  weight: 3,
49
50
  dashArray: "6 6"
50
- }, ze = (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)), Be = (e) => e.unit === "hectares" ? e.area * Pe : e.area, w = (e) => {
51
- let t = l(e.boundary);
52
- return t && u(t) ? t : null;
53
- }, Ve = C.default.divIcon({
51
+ }, We = (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)), Ge = (e) => /hect|(^|[^a-z])ha([^a-z]|$)/i.test(e ?? ""), Ke = (e) => Ge(e.unit) ? e.area * ze : e.area, qe = (e) => `${e.area.toFixed(1)} ${Ge(e.unit) ? "ha" : "ac"}`, x = (e) => {
52
+ let t = re(e.boundary);
53
+ return t && c(t) ? t : null;
54
+ }, Je = b.default.divIcon({
54
55
  className: "",
55
56
  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>",
56
57
  iconSize: [16, 16],
57
58
  iconAnchor: [8, 8]
58
- }), He = () => {
59
- let { t: e } = ce(), { workspaceId: c } = n(), l = o(), { fields: u, crops: Te, loadings: Pe, errors: He, refetch: T, createField: Ue } = se(), { toasts: We, toast: E, dismiss: Ge } = ee(), [D] = Ee(De), [O, Ke] = _("loading"), [k, A] = _("view"), [j, M] = _(null), [N, qe] = _(!1), [P, Je] = _(!0), [Ye, Xe] = _(""), [Ze, Qe] = _(""), [$e, et] = _(!1), [tt, nt] = _(0), [rt, it] = _(null), [at, ot] = _(!1), [st, ct] = _(!1), [F, lt] = _(null), [I, L] = _(null), [ut, dt] = _(!1), [R, ft] = _(""), [pt, mt] = _("Clay loam"), [ht, gt] = _("Drip"), [_t, vt] = _("active"), yt = g(null), z = g(null), bt = g(null), xt = g(null), St = g(null), B = g(null), V = g(null), H = g(null), U = g([]), W = g(null), G = g([]), K = g(null), Ct = g([]), q = g("view"), wt = g(!1);
60
- m(() => {
61
- q.current = k;
62
- }, [k]);
63
- let Tt = h(() => u.filter((e) => w(e) !== null).length, [u]), Et = h(() => u.reduce((e, t) => e + Be(t), 0), [u]), Dt = h(() => oe(u.map((e) => e.soilType)), [u]), J = h(() => u.find((e) => e.id === j) ?? null, [u, j]), Ot = h(() => {
64
- let e = Ye.trim().toLowerCase();
65
- return e ? u.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : u;
66
- }, [u, Ye]), kt = p((e) => {
59
+ }), S = () => {
60
+ let { t: e } = fe(), { workspaceId: s } = n(), re = o(), { fields: c, crops: Ae, loadings: ze, errors: Ge, refetch: S, createField: Ye } = de(), { toasts: Xe, toast: C, dismiss: Ze } = te(), [w] = je(Me), [T, Qe] = h("loading"), [E, D] = h("view"), [O, k] = h(null), [A, $e] = h(!1), [j, et] = h(!0), [M, tt] = h(!1), [N, nt] = h({}), [rt, it] = h(""), [at, ot] = h(""), [st, ct] = h(!1), [lt, ut] = h(0), [dt, ft] = h(null), [pt, mt] = h(!1), [ht, gt] = h(!1), [P, _t] = h(null), [F, I] = h(null), [vt, yt] = h(!1), [L, bt] = h(""), [xt, St] = h("Clay loam"), [Ct, wt] = h("Drip"), [Tt, Et] = h("active"), Dt = m(null), R = m(null), Ot = m(null), kt = m(null), At = m(null), z = m(null), B = m(null), V = m(null), H = m([]), U = m(null), W = m([]), G = m(null), jt = m([]), K = m("view"), Mt = m(!1);
61
+ f(() => {
62
+ K.current = E;
63
+ }, [E]);
64
+ let Nt = p(() => c.filter((e) => x(e) !== null).length, [c]), Pt = p(() => c.reduce((e, t) => e + Ke(t), 0), [c]), Ft = p(() => ce(c.map((e) => e.soilType)), [c]), q = p(() => c.find((e) => e.id === O) ?? null, [c, O]), It = p(() => {
65
+ let e = rt.trim().toLowerCase();
66
+ return e ? c.filter((t) => t.name.toLowerCase().includes(e) || (t.soilType ?? "").toLowerCase().includes(e)) : c;
67
+ }, [c, rt]), J = p(() => {
68
+ let e = [];
69
+ for (let t of c) {
70
+ let n = x(t);
71
+ if (n) {
72
+ let r = ae(n);
73
+ if (r) {
74
+ e.push({
75
+ id: t.id,
76
+ lat: r[0],
77
+ lng: r[1]
78
+ });
79
+ continue;
80
+ }
81
+ }
82
+ We(t.location) && e.push({
83
+ id: t.id,
84
+ lat: t.location.lat,
85
+ lng: t.location.lng
86
+ });
87
+ }
88
+ return e;
89
+ }, [c]);
90
+ f(() => {
91
+ if (J.length === 0) {
92
+ nt({});
93
+ return;
94
+ }
95
+ let e = new AbortController(), t = !1;
96
+ return ue(J.map((e) => ({
97
+ lat: e.lat,
98
+ lng: e.lng
99
+ })), e.signal).then((e) => {
100
+ if (t) return;
101
+ let n = {};
102
+ J.forEach((t, r) => {
103
+ n[t.id] = e[r] ?? null;
104
+ }), nt(n);
105
+ }), () => {
106
+ t = !0, e.abort();
107
+ };
108
+ }, [p(() => J.map((e) => `${e.id}:${e.lat.toFixed(5)},${e.lng.toFixed(5)}`).join("|"), [J])]);
109
+ let [Lt, Rt] = p(() => {
110
+ let e = Object.values(N).filter((e) => e != null && Number.isFinite(e));
111
+ return e.length === 0 ? [0, 0] : [Math.min(...e), Math.max(...e)];
112
+ }, [N]), zt = p(() => Object.values(N).some((e) => e != null && Number.isFinite(e)), [N]), Bt = d((e) => {
67
113
  if (!e) return "";
68
- let t = Te.find((t) => t.field === e.id || t.fieldName === e.name);
114
+ let t = Ae.find((t) => t.field === e.id || t.fieldName === e.name);
69
115
  return t ? t.name : (e.crops ?? []).join(", ");
70
- }, [Te]), At = p((e) => {
71
- let t = z.current;
116
+ }, [Ae]), Vt = d((e) => {
117
+ let t = R.current;
72
118
  if (!t) return;
73
- let n = w(e);
119
+ let n = x(e);
74
120
  if (n) try {
75
- let e = C.default.geoJSON(n).getBounds();
121
+ let e = b.default.geoJSON(n).getBounds();
76
122
  if (e.isValid()) {
77
123
  t.fitBounds(e, {
78
124
  padding: [40, 40],
@@ -81,25 +127,29 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
81
127
  return;
82
128
  }
83
129
  } catch {}
84
- ze(e.location) && t.flyTo([e.location.lat, e.location.lng], Ne, { duration: .6 });
85
- }, []), jt = p((e) => {
86
- q.current === "draw" || q.current === "measure" || (M(e.id), At(e));
87
- }, [At]), Y = p(() => {
88
- let t = z.current, n = St.current;
130
+ We(e.location) && t.flyTo([e.location.lat, e.location.lng], Re, { duration: .6 });
131
+ }, []), Ht = d((e) => {
132
+ K.current === "draw" || K.current === "measure" || (k(e.id), Vt(e));
133
+ }, [Vt]);
134
+ f(() => {
135
+ O && document.querySelector(`[data-field-id="${O}"]`)?.scrollIntoView({ block: "nearest" });
136
+ }, [O]);
137
+ let Y = d(() => {
138
+ let t = R.current, n = At.current;
89
139
  if (!t || !n) return;
90
140
  n.clearLayers();
91
141
  let r = [];
92
- for (let t of u) {
93
- if (k === "edit" && t.id === j) continue;
94
- let i = t.id === j, a = P ? ae(t.soilType) : Fe, o = `${t.name} — ${Be(t).toFixed(1)} ac`, s = w(t);
142
+ for (let t of c) {
143
+ if (E === "edit" && t.id === O) continue;
144
+ let i = t.id === O, a = N[t.id], o = M && a != null ? le(a, Lt, Rt) : j ? se(t.soilType) : Be, ee = `${t.name} — ${qe(t)}`, s = x(t);
95
145
  if (s) {
96
- let e = C.default.geoJSON(s, { style: () => ({
97
- color: i ? "#ffffff" : a,
146
+ let e = b.default.geoJSON(s, { style: () => ({
147
+ color: i ? "#ffffff" : o,
98
148
  weight: i ? 4 : 2,
99
- fillColor: a,
149
+ fillColor: o,
100
150
  fillOpacity: i ? .5 : .3
101
151
  }) });
102
- e.on("click", () => M(t.id)), e.bindTooltip(o, {
152
+ e.on("click", () => k(t.id)), e.bindTooltip(ee, {
103
153
  permanent: !0,
104
154
  direction: "center",
105
155
  className: "hb-field-label"
@@ -108,90 +158,94 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
108
158
  let t = e.getBounds();
109
159
  t.isValid() && r.push(t);
110
160
  } catch {}
111
- } else if (ze(t.location)) {
112
- let o = C.default.circleMarker([t.location.lat, t.location.lng], {
161
+ } else if (We(t.location)) {
162
+ let a = b.default.circleMarker([t.location.lat, t.location.lng], {
113
163
  radius: i ? 9 : 7,
114
164
  color: i ? "#ffffff" : "#fff",
115
165
  weight: i ? 3 : 2,
116
- fillColor: a,
166
+ fillColor: o,
117
167
  fillOpacity: 1
118
168
  });
119
- o.on("click", () => M(t.id)), o.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
169
+ a.on("click", () => k(t.id)), a.bindTooltip(`${t.name} (${e("healthybowl.fieldMapPage.unmapped", "no boundary")})`, {
120
170
  permanent: !1,
121
171
  direction: "top"
122
- }), o.addTo(n), r.push(C.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
172
+ }), a.addTo(n), r.push(b.default.latLngBounds([t.location.lat, t.location.lng], [t.location.lat, t.location.lng]));
123
173
  }
124
174
  }
125
- if (!wt.current && r.length > 0) {
126
- let e = r.reduce((e, t) => e.extend(t), C.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
175
+ if (!Mt.current && r.length > 0) {
176
+ let e = r.reduce((e, t) => e.extend(t), b.default.latLngBounds(r[0].getSouthWest(), r[0].getNorthEast()));
127
177
  try {
128
178
  t.fitBounds(e, {
129
179
  padding: [40, 40],
130
180
  maxZoom: 17
131
- }), wt.current = !0;
181
+ }), Mt.current = !0;
132
182
  } catch {}
133
183
  }
134
184
  }, [
135
- u,
136
- k,
185
+ c,
186
+ E,
187
+ O,
137
188
  j,
138
- P,
189
+ M,
190
+ N,
191
+ Lt,
192
+ Rt,
139
193
  e
140
194
  ]);
141
- m(() => {
142
- O === "ready" && Y();
143
- }, [Y, O]);
144
- let X = p(() => {
145
- B.current?.clearLayers(), W.current = null, U.current = [], nt(0);
146
- }, []), Mt = p(() => {
147
- let e = B.current;
195
+ f(() => {
196
+ T === "ready" && Y();
197
+ }, [Y, T]);
198
+ let X = d(() => {
199
+ z.current?.clearLayers(), U.current = null, H.current = [], ut(0);
200
+ }, []), Ut = d(() => {
201
+ let e = z.current;
148
202
  if (!e) return;
149
- W.current &&= (e.removeLayer(W.current), null);
150
- let t = U.current;
151
- t.length >= 2 && (W.current = C.default.polygon(t, Ie).addTo(e));
152
- }, []), Nt = p(() => {
153
- let t = U.current;
203
+ U.current &&= (e.removeLayer(U.current), null);
204
+ let t = H.current;
205
+ t.length >= 2 && (U.current = b.default.polygon(t, Ve).addTo(e));
206
+ }, []), Wt = d(() => {
207
+ let t = H.current;
154
208
  if (t.length < 3) {
155
- E({
209
+ C({
156
210
  title: e("healthybowl.fieldMapPage.toast.needPoints.title", "Need at least 3 points"),
157
211
  description: e("healthybowl.fieldMapPage.toast.needPoints.description", "Click the map to add more corners."),
158
212
  variant: "warning"
159
213
  });
160
214
  return;
161
215
  }
162
- let n = f(t.map((e) => ({
216
+ let n = u(t.map((e) => ({
163
217
  lat: e.lat,
164
218
  lng: e.lng
165
219
  })));
166
- X(), q.current = "view", A("view"), n && (L({
220
+ X(), K.current = "view", D("view"), n && (I({
167
221
  boundary: n,
168
- area: d(n, "acres"),
169
- centroid: re(n) ?? [0, 0]
170
- }), ft(""), mt("Clay loam"), gt("Drip"), vt("active"));
222
+ area: l(n, "acres"),
223
+ centroid: ae(n) ?? [0, 0]
224
+ }), bt(""), St("Clay loam"), wt("Drip"), Et("active"));
171
225
  }, [
172
226
  X,
173
227
  e,
174
- E
175
- ]), Pt = p(() => {
176
- M(null), X(), q.current = "draw", A("draw");
177
- }, [X]), Ft = p(() => {
178
- X(), q.current = "view", A("view");
179
- }, [X]), Z = p(() => {
180
- V.current?.clearLayers(), K.current = null, G.current = [], it(null), ot(!1);
181
- }, []), It = p(() => {
182
- if (!V.current || !K.current) return;
183
- K.current.setLatLngs(G.current);
184
- let e = f(G.current.map((e) => ({
228
+ C
229
+ ]), Gt = d(() => {
230
+ k(null), X(), K.current = "draw", D("draw");
231
+ }, [X]), Kt = d(() => {
232
+ X(), K.current = "view", D("view");
233
+ }, [X]), Z = d(() => {
234
+ B.current?.clearLayers(), G.current = null, W.current = [], ft(null), mt(!1);
235
+ }, []), qt = d(() => {
236
+ if (!B.current || !G.current) return;
237
+ G.current.setLatLngs(W.current);
238
+ let e = u(W.current.map((e) => ({
185
239
  lat: e.lat,
186
240
  lng: e.lng
187
241
  })));
188
- e && it(d(e, J?.unit ?? "acres"));
189
- }, [J]), Lt = p(() => {
190
- let t = z.current, n = V.current;
191
- if (!t || !n || !J) return;
192
- let r = w(J);
242
+ e && ft(l(e, q?.unit ?? "acres"));
243
+ }, [q]), Jt = d(() => {
244
+ let t = R.current, n = B.current;
245
+ if (!t || !n || !q) return;
246
+ let r = x(q);
193
247
  if (!r) {
194
- E({
248
+ C({
195
249
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
196
250
  description: e("healthybowl.fieldMapPage.toast.noBoundary.description", "Draw a boundary for this field first."),
197
251
  variant: "warning"
@@ -199,89 +253,89 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
199
253
  return;
200
254
  }
201
255
  n.clearLayers();
202
- let i = r.coordinates[0].slice(0, -1).map(([e, t]) => C.default.latLng(t, e));
203
- G.current = i, K.current = C.default.polygon(i, Le).addTo(n), i.forEach((e, t) => {
204
- C.default.marker(i[t], {
205
- icon: Ve,
256
+ let i = r.coordinates[0].slice(0, -1).map(([e, t]) => b.default.latLng(t, e));
257
+ W.current = i, G.current = b.default.polygon(i, He).addTo(n), i.forEach((e, t) => {
258
+ b.default.marker(i[t], {
259
+ icon: Je,
206
260
  draggable: !0
207
261
  }).addTo(n).on("drag", (e) => {
208
- G.current[t] = e.target.getLatLng(), It(), ot(!0);
262
+ W.current[t] = e.target.getLatLng(), qt(), mt(!0);
209
263
  });
210
- }), q.current = "edit", A("edit"), ot(!1), it(d(r, J.unit));
264
+ }), K.current = "edit", D("edit"), mt(!1), ft(l(r, q.unit));
211
265
  }, [
212
- It,
213
- J,
266
+ qt,
267
+ q,
214
268
  e,
215
- E
216
- ]), Rt = p(() => {
217
- Z(), q.current = "view", A("view"), Y();
218
- }, [Z, Y]), zt = p(async () => {
219
- if (!J) return;
220
- let t = f(G.current.map((e) => ({
269
+ C
270
+ ]), Yt = d(() => {
271
+ Z(), K.current = "view", D("view"), Y();
272
+ }, [Z, Y]), Xt = d(async () => {
273
+ if (!q) return;
274
+ let t = u(W.current.map((e) => ({
221
275
  lat: e.lat,
222
276
  lng: e.lng
223
277
  })));
224
278
  if (t) {
225
- ct(!0);
279
+ gt(!0);
226
280
  try {
227
- let n = d(t, J.unit);
228
- await D({ variables: { input: {
229
- id: J.id,
281
+ let n = l(t, q.unit);
282
+ await w({ variables: { input: {
283
+ id: q.id,
230
284
  boundary: t,
231
285
  area: n,
232
- context: { workspaceId: c }
233
- } } }), await T(), Z(), q.current = "view", A("view"), E({
286
+ context: { workspaceId: s }
287
+ } } }), await S(), Z(), K.current = "view", D("view"), C({
234
288
  title: e("healthybowl.fieldMapPage.toast.saved.title", "Boundary saved"),
235
289
  description: e("healthybowl.fieldMapPage.toast.saved.description", "Area updated to {{area}} {{unit}}.", {
236
290
  area: String(n),
237
- unit: J.unit
291
+ unit: q.unit
238
292
  }),
239
293
  variant: "success"
240
294
  });
241
295
  } catch (t) {
242
- E({
296
+ C({
243
297
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
244
298
  description: String(t),
245
299
  variant: "error"
246
300
  });
247
301
  } finally {
248
- ct(!1);
302
+ gt(!1);
249
303
  }
250
304
  }
251
305
  }, [
252
306
  Z,
253
- T,
254
- J,
307
+ S,
308
+ q,
255
309
  e,
256
- E,
257
- D,
258
- c
259
- ]), Bt = p(async () => {
260
- if (J) {
261
- if (!w(J)) {
262
- E({
310
+ C,
311
+ w,
312
+ s
313
+ ]), Zt = d(async () => {
314
+ if (q) {
315
+ if (!x(q)) {
316
+ C({
263
317
  title: e("healthybowl.fieldMapPage.toast.noBoundary.title", "No boundary to edit"),
264
318
  description: e("healthybowl.fieldMapPage.toast.deleteNone.description", "This field has no boundary to delete."),
265
319
  variant: "warning"
266
320
  });
267
321
  return;
268
322
  }
269
- if (await l({
323
+ if (await re({
270
324
  title: e("healthybowl.fieldMapPage.confirmDelete.title", "Delete boundary?"),
271
- message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: J.name }),
325
+ message: e("healthybowl.fieldMapPage.confirmDelete.description", "This removes the drawn shape from {{name}}. The field record is kept.", { name: q.name }),
272
326
  okButtonTitle: e("healthybowl.common.delete", "Delete")
273
327
  })) try {
274
- await D({ variables: { input: {
275
- id: J.id,
328
+ await w({ variables: { input: {
329
+ id: q.id,
276
330
  boundary: null,
277
- context: { workspaceId: c }
278
- } } }), await T(), E({
331
+ context: { workspaceId: s }
332
+ } } }), await S(), C({
279
333
  title: e("healthybowl.fieldMapPage.toast.boundaryDeleted.title", "Boundary removed"),
280
334
  description: e("healthybowl.fieldMapPage.toast.boundaryDeleted.description", "The drawn shape was cleared."),
281
335
  variant: "success"
282
336
  });
283
337
  } catch (t) {
284
- E({
338
+ C({
285
339
  title: e("healthybowl.fieldMapPage.toast.saveFailed.title", "Save failed"),
286
340
  description: String(t),
287
341
  variant: "error"
@@ -289,415 +343,440 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
289
343
  }
290
344
  }
291
345
  }, [
292
- l,
293
- T,
294
- J,
346
+ re,
347
+ S,
348
+ q,
295
349
  e,
296
- E,
297
- D,
298
- c
299
- ]), Q = p(() => {
300
- H.current?.clearLayers(), Ct.current = [], lt(null);
301
- }, []), Vt = p(() => {
302
- let e = H.current;
350
+ C,
351
+ w,
352
+ s
353
+ ]), Q = d(() => {
354
+ V.current?.clearLayers(), jt.current = [], _t(null);
355
+ }, []), Qt = d(() => {
356
+ let e = V.current;
303
357
  if (!e) return;
304
358
  e.clearLayers();
305
- let t = Ct.current;
359
+ let t = jt.current;
306
360
  t.forEach((t) => {
307
- C.default.circleMarker(t, {
361
+ b.default.circleMarker(t, {
308
362
  radius: 4,
309
363
  color: "#38bdf8",
310
364
  weight: 2,
311
365
  fillColor: "#fff",
312
366
  fillOpacity: 1
313
367
  }).addTo(e);
314
- }), t.length >= 2 && C.default.polyline(t, Re).addTo(e);
368
+ }), t.length >= 2 && b.default.polyline(t, Ue).addTo(e);
315
369
  let n = 0;
316
370
  for (let e = 1; e < t.length; e++) n += t[e - 1].distanceTo(t[e]);
317
371
  let r = null;
318
372
  if (t.length >= 3) {
319
- let e = f(t.map((e) => ({
373
+ let e = u(t.map((e) => ({
320
374
  lat: e.lat,
321
375
  lng: e.lng
322
376
  })));
323
- e && (r = ne(e));
377
+ e && (r = ie(e));
324
378
  }
325
- lt({
379
+ _t({
326
380
  distance: n,
327
381
  area: r
328
382
  });
329
- }, []), Ht = p(() => {
330
- M(null), Q(), q.current = "measure", A("measure"), lt({
383
+ }, []), $t = d(() => {
384
+ k(null), Q(), K.current = "measure", D("measure"), _t({
331
385
  distance: 0,
332
386
  area: null
333
387
  });
334
- }, [Q]), Ut = p(() => {
335
- Q(), q.current = "view", A("view");
336
- }, [Q]), Wt = p((e) => {
337
- if (z.current) if (q.current === "draw") {
338
- U.current.push(e.latlng);
339
- let t = U.current.length === 1, n = C.default.circleMarker(e.latlng, {
388
+ }, [Q]), en = d(() => {
389
+ Q(), K.current = "view", D("view");
390
+ }, [Q]), tn = d((e) => {
391
+ if (R.current) if (K.current === "draw") {
392
+ H.current.push(e.latlng);
393
+ let t = H.current.length === 1, n = b.default.circleMarker(e.latlng, {
340
394
  radius: t ? 7 : 5,
341
395
  color: "#fff",
342
396
  weight: 2,
343
397
  fillColor: t ? "#16a34a" : "#f59e0b",
344
398
  fillOpacity: 1
345
- }).addTo(B.current);
399
+ }).addTo(z.current);
346
400
  t && n.on("click", (e) => {
347
- C.default.DomEvent.stopPropagation(e), Nt();
348
- }), nt(U.current.length), Mt();
349
- } else q.current === "measure" && (Ct.current.push(e.latlng), Vt());
401
+ b.default.DomEvent.stopPropagation(e), Wt();
402
+ }), ut(H.current.length), Ut();
403
+ } else K.current === "measure" && (jt.current.push(e.latlng), Qt());
350
404
  }, [
351
- Nt,
352
- Vt,
353
- Mt
354
- ]), Gt = p(async (n) => {
405
+ Wt,
406
+ Qt,
407
+ Ut
408
+ ]), nn = d(async (n) => {
355
409
  n.preventDefault();
356
- let r = z.current, i = Ze.trim();
410
+ let r = R.current, i = at.trim();
357
411
  if (!r || !i) return;
358
412
  let a = i.match(/^(-?\d+(?:\.\d+)?)\s*,\s*(-?\d+(?:\.\d+)?)$/);
359
413
  if (a) {
360
- r.flyTo([Number(a[1]), Number(a[2])], Ne, { duration: .6 });
414
+ r.flyTo([Number(a[1]), Number(a[2])], Re, { duration: .6 });
361
415
  return;
362
416
  }
363
- et(!0);
417
+ ct(!0);
364
418
  try {
365
419
  let n = await t(i);
366
420
  if (!n) {
367
- E({
421
+ C({
368
422
  title: e("healthybowl.fieldMapPage.toast.placeNotFound.title", "Place not found"),
369
423
  description: e("healthybowl.fieldMapPage.toast.placeNotFound.description", "Try a more specific place name."),
370
424
  variant: "warning"
371
425
  });
372
426
  return;
373
427
  }
374
- r.flyTo([n.latitude, n.longitude], Ne, { duration: .6 });
428
+ r.flyTo([n.latitude, n.longitude], Re, { duration: .6 });
375
429
  } catch (t) {
376
- E({
430
+ C({
377
431
  title: e("healthybowl.fieldMapPage.toast.searchFailed.title", "Search failed"),
378
432
  description: t instanceof Error ? t.message : String(t),
379
433
  variant: "error"
380
434
  });
381
435
  } finally {
382
- et(!1);
436
+ ct(!1);
383
437
  }
384
438
  }, [
385
- Ze,
439
+ at,
386
440
  e,
387
- E
388
- ]), Kt = p(async () => {
389
- if (I) {
390
- if (!R.trim()) {
391
- E({
441
+ C
442
+ ]), rn = d(async () => {
443
+ if (F) {
444
+ if (!L.trim()) {
445
+ C({
392
446
  title: e("healthybowl.fieldMapPage.toast.nameRequired.title", "Name required"),
393
447
  description: e("healthybowl.fieldMapPage.toast.nameRequired.description", "Give the new field a name."),
394
448
  variant: "warning"
395
449
  });
396
450
  return;
397
451
  }
398
- dt(!0);
452
+ yt(!0);
399
453
  try {
400
- let [t, n] = I.centroid, r = await Ue({
401
- name: R.trim(),
402
- area: I.area,
454
+ let [t, n] = F.centroid, r = await Ye({
455
+ name: L.trim(),
456
+ area: F.area,
403
457
  unit: "acres",
404
- soilType: pt,
405
- irrigationType: ht,
458
+ soilType: xt,
459
+ irrigationType: Ct,
406
460
  organicCertified: !1,
407
- status: _t,
461
+ status: Tt,
408
462
  crops: [],
409
463
  location: {
410
464
  lat: t,
411
465
  lng: n
412
466
  }
413
467
  });
414
- r?.id && await D({ variables: { input: {
468
+ r?.id && await w({ variables: { input: {
415
469
  id: r.id,
416
- boundary: I.boundary,
417
- area: I.area,
418
- context: { workspaceId: c }
419
- } } }), await T(), L(null), r?.id && M(r.id), E({
470
+ boundary: F.boundary,
471
+ area: F.area,
472
+ context: { workspaceId: s }
473
+ } } }), await S(), I(null), r?.id && k(r.id), C({
420
474
  title: e("healthybowl.fieldMapPage.toast.fieldCreated.title", "Field created"),
421
475
  description: e("healthybowl.fieldMapPage.toast.fieldCreated.description", "{{name}} saved at {{area}} acres.", {
422
- name: R.trim(),
423
- area: String(I.area)
476
+ name: L.trim(),
477
+ area: String(F.area)
424
478
  }),
425
479
  variant: "success"
426
480
  });
427
481
  } catch (t) {
428
- E({
482
+ C({
429
483
  title: e("healthybowl.fieldMapPage.toast.createFailed.title", "Create failed"),
430
484
  description: String(t),
431
485
  variant: "error"
432
486
  });
433
487
  } finally {
434
- dt(!1);
488
+ yt(!1);
435
489
  }
436
490
  }
437
491
  }, [
438
- Ue,
439
- ht,
440
- R,
441
- pt,
442
- _t,
443
- I,
444
- T,
492
+ Ye,
493
+ Ct,
494
+ L,
495
+ xt,
496
+ Tt,
497
+ F,
498
+ S,
445
499
  e,
446
- E,
447
- D,
448
- c
500
+ C,
501
+ w,
502
+ s
449
503
  ]);
450
- m(() => {
451
- let e = yt.current;
504
+ f(() => {
505
+ let e = Dt.current;
452
506
  if (!e) return;
453
- te();
454
- let t = C.default.tileLayer(Oe, {
455
- attribution: ke,
456
- maxZoom: Me,
507
+ ne();
508
+ let t = b.default.tileLayer(Ne, {
509
+ attribution: Pe,
510
+ maxZoom: Le,
457
511
  maxNativeZoom: 18
458
- }), n = C.default.tileLayer(Ae, {
459
- attribution: je,
460
- maxZoom: Me,
512
+ }), n = b.default.tileLayer(Fe, {
513
+ attribution: Ie,
514
+ maxZoom: Le,
461
515
  maxNativeZoom: 17,
462
516
  opacity: .65
463
517
  });
464
- bt.current = t, xt.current = n;
465
- let r = C.default.map(e, {
518
+ Ot.current = t, kt.current = n;
519
+ let r = b.default.map(e, {
466
520
  center: [20, 78],
467
521
  zoom: 4,
468
522
  scrollWheelZoom: !0,
469
- maxZoom: Me,
523
+ maxZoom: Le,
470
524
  layers: [t]
471
525
  });
472
- return z.current = r, St.current = C.default.layerGroup().addTo(r), B.current = C.default.layerGroup().addTo(r), V.current = C.default.layerGroup().addTo(r), H.current = C.default.layerGroup().addTo(r), r.on("click", Wt), Ke("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
473
- r.off("click", Wt), r.remove(), z.current = null, bt.current = null, xt.current = null, St.current = null, B.current = null, V.current = null, H.current = null;
526
+ return R.current = r, At.current = b.default.layerGroup().addTo(r), z.current = b.default.layerGroup().addTo(r), B.current = b.default.layerGroup().addTo(r), V.current = b.default.layerGroup().addTo(r), r.on("click", tn), Qe("ready"), window.setTimeout(() => r.invalidateSize(), 80), () => {
527
+ r.off("click", tn), r.remove(), R.current = null, Ot.current = null, kt.current = null, At.current = null, z.current = null, B.current = null, V.current = null;
474
528
  };
475
- }, []), m(() => {
476
- let e = z.current, t = xt.current;
477
- !e || !t || (N ? t.addTo(e) : e.removeLayer(t));
478
- }, [N]);
479
- let qt = !Pe.crops && u.length === 0, Jt = F ? F.distance >= 1e3 ? `${(F.distance / 1e3).toFixed(2)} km` : `${F.distance.toFixed(0)} m` : "";
480
- if (He.crops && u.length === 0) return /* @__PURE__ */ v(r, {
529
+ }, []), f(() => {
530
+ let e = R.current, t = kt.current;
531
+ !e || !t || (A ? t.addTo(e) : e.removeLayer(t));
532
+ }, [A]);
533
+ let an = !ze.crops && c.length === 0, on = P ? P.distance >= 1e3 ? `${(P.distance / 1e3).toFixed(2)} km` : `${P.distance.toFixed(0)} m` : "";
534
+ if (Ge.crops && c.length === 0) return /* @__PURE__ */ g(r, {
481
535
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
482
536
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
483
537
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
484
- children: /* @__PURE__ */ v(i, { onRetry: T })
538
+ children: /* @__PURE__ */ g(i, { onRetry: S })
485
539
  });
486
- let $ = (e, t, n, r) => /* @__PURE__ */ y("button", {
540
+ let $ = (e, t, n, r) => /* @__PURE__ */ _("button", {
487
541
  type: "button",
488
542
  onClick: t,
489
543
  "aria-pressed": e,
490
544
  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"}`,
491
545
  children: [n, r]
492
546
  });
493
- return /* @__PURE__ */ y(r, {
547
+ return /* @__PURE__ */ _(r, {
494
548
  title: e("healthybowl.fieldMapPage.title", "Field Map"),
495
549
  titleAccent: e("healthybowl.fieldMapPage.titleAccent", "Map"),
496
550
  hero: !0,
497
551
  description: e("healthybowl.fieldMapPage.description", "Draw and manage your field boundaries on satellite imagery."),
498
552
  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.",
499
553
  children: [
500
- /* @__PURE__ */ y("div", {
554
+ /* @__PURE__ */ _("div", {
501
555
  className: "flex flex-col gap-4 lg:flex-row",
502
- children: [/* @__PURE__ */ y("div", {
556
+ children: [/* @__PURE__ */ _("div", {
503
557
  className: "min-w-0 flex-1 space-y-3",
504
558
  children: [
505
- /* @__PURE__ */ y("form", {
559
+ /* @__PURE__ */ _("form", {
506
560
  className: "flex gap-2",
507
- onSubmit: Gt,
508
- children: [/* @__PURE__ */ y("div", {
561
+ onSubmit: nn,
562
+ children: [/* @__PURE__ */ _("div", {
509
563
  className: "relative min-w-0 flex-1",
510
- children: [/* @__PURE__ */ v(_e, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ v("input", {
564
+ children: [/* @__PURE__ */ g(xe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ g("input", {
511
565
  type: "search",
512
- value: Ze,
513
- onChange: (e) => Qe(e.target.value),
566
+ value: at,
567
+ onChange: (e) => ot(e.target.value),
514
568
  placeholder: e("healthybowl.fieldMapPage.placeSearch.placeholder", "Find your farm — village, city, or lat,lng…"),
515
569
  "aria-label": e("healthybowl.fieldMapPage.placeSearch.label", "Locate a place on the map"),
516
570
  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)]"
517
571
  })]
518
- }), /* @__PURE__ */ y(b, {
572
+ }), /* @__PURE__ */ _(v, {
519
573
  type: "submit",
520
574
  variant: "outline",
521
575
  size: "sm",
522
- disabled: O !== "ready" || $e,
576
+ disabled: T !== "ready" || st,
523
577
  children: [
524
- /* @__PURE__ */ v(de, { className: "h-4 w-4" }),
578
+ /* @__PURE__ */ g(he, { className: "h-4 w-4" }),
525
579
  " ",
526
- $e ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
580
+ st ? e("healthybowl.fieldMapPage.placeSearch.searching", "Locating…") : e("healthybowl.fieldMapPage.placeSearch.action", "Locate")
527
581
  ]
528
582
  })]
529
583
  }),
530
- /* @__PURE__ */ y("div", {
584
+ /* @__PURE__ */ _("div", {
531
585
  className: "relative",
532
586
  children: [
533
- /* @__PURE__ */ v("div", {
534
- ref: yt,
587
+ /* @__PURE__ */ g("div", {
588
+ ref: Dt,
535
589
  className: "h-[70vh] max-h-[640px] w-full overflow-hidden rounded-lg border border-border-subtle bg-bg-sunken"
536
590
  }),
537
- O === "ready" && /* @__PURE__ */ y("div", {
591
+ T === "ready" && /* @__PURE__ */ _("div", {
538
592
  className: "absolute right-3 top-3 z-[1000] flex items-center gap-1 rounded-lg border border-border-subtle bg-bg-surface/95 p-1 shadow-md",
539
593
  children: [
540
- $(k === "draw", () => k === "draw" ? Ft() : Pt(), /* @__PURE__ */ v(pe, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
541
- $(k === "edit", () => k === "edit" ? Rt() : Lt(), /* @__PURE__ */ v(ve, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
542
- $(!1, Bt, /* @__PURE__ */ v(ye, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
543
- $(k === "measure", () => k === "measure" ? Ut() : Ht(), /* @__PURE__ */ v(he, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure"))
594
+ $(E === "draw", () => E === "draw" ? Kt() : Gt(), /* @__PURE__ */ g(_e, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.polygon", "Polygon")),
595
+ $(E === "edit", () => E === "edit" ? Yt() : Jt(), /* @__PURE__ */ g(Se, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.vertices", "Vertices")),
596
+ $(!1, Zt, /* @__PURE__ */ g(Ce, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.delete", "Delete")),
597
+ $(E === "measure", () => E === "measure" ? en() : $t(), /* @__PURE__ */ g(ye, { className: "h-4 w-4" }), e("healthybowl.fieldMapPage.tools.measure", "Measure"))
544
598
  ]
545
599
  }),
546
- k === "draw" && /* @__PURE__ */ y("div", {
600
+ E === "draw" && /* @__PURE__ */ _("div", {
547
601
  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",
548
602
  children: [
549
- /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(tt) }) }),
550
- /* @__PURE__ */ y(b, {
603
+ /* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.drawHint", "Click the map to add corners ({{count}}) — click the first point or Finish.", { count: String(lt) }) }),
604
+ /* @__PURE__ */ _(v, {
551
605
  size: "sm",
552
606
  variant: "default",
553
- onClick: Nt,
607
+ onClick: Wt,
554
608
  children: [
555
- /* @__PURE__ */ v(le, { className: "h-3.5 w-3.5" }),
609
+ /* @__PURE__ */ g(pe, { className: "h-3.5 w-3.5" }),
556
610
  " ",
557
611
  e("healthybowl.fieldMapPage.finish", "Finish")
558
612
  ]
559
613
  }),
560
- /* @__PURE__ */ v(b, {
614
+ /* @__PURE__ */ g(v, {
561
615
  size: "sm",
562
616
  variant: "outline",
563
- onClick: Ft,
564
- children: /* @__PURE__ */ v(be, { className: "h-3.5 w-3.5" })
617
+ onClick: Kt,
618
+ children: /* @__PURE__ */ g(we, { className: "h-3.5 w-3.5" })
565
619
  })
566
620
  ]
567
621
  }),
568
- k === "edit" && /* @__PURE__ */ y("div", {
622
+ E === "edit" && /* @__PURE__ */ _("div", {
569
623
  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",
570
624
  children: [
571
- /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
572
- area: String(rt ?? ""),
573
- unit: J?.unit ?? "acres"
625
+ /* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.editHint", "Drag handles to reshape · {{area}} {{unit}}", {
626
+ area: String(dt ?? ""),
627
+ unit: q?.unit ?? "acres"
574
628
  }) }),
575
- /* @__PURE__ */ y(b, {
629
+ /* @__PURE__ */ _(v, {
576
630
  size: "sm",
577
631
  variant: "default",
578
- onClick: zt,
579
- disabled: !at || st,
632
+ onClick: Xt,
633
+ disabled: !pt || ht,
580
634
  children: [
581
- /* @__PURE__ */ v(ge, { className: "h-3.5 w-3.5" }),
635
+ /* @__PURE__ */ g(be, { className: "h-3.5 w-3.5" }),
582
636
  " ",
583
- st ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
637
+ ht ? e("healthybowl.fieldMapPage.saving", "Saving…") : e("healthybowl.fieldMapPage.save", "Save")
584
638
  ]
585
639
  }),
586
- /* @__PURE__ */ v(b, {
640
+ /* @__PURE__ */ g(v, {
587
641
  size: "sm",
588
642
  variant: "outline",
589
- onClick: Rt,
590
- children: /* @__PURE__ */ v(be, { className: "h-3.5 w-3.5" })
643
+ onClick: Yt,
644
+ children: /* @__PURE__ */ g(we, { className: "h-3.5 w-3.5" })
591
645
  })
592
646
  ]
593
647
  }),
594
- k === "measure" && F && /* @__PURE__ */ y("div", {
648
+ E === "measure" && P && /* @__PURE__ */ _("div", {
595
649
  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",
596
650
  children: [
597
- /* @__PURE__ */ y("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: Jt }), F.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (F.area / 4046.8564224).toFixed(2) })}`] }),
598
- /* @__PURE__ */ v(b, {
651
+ /* @__PURE__ */ _("span", { children: [e("healthybowl.fieldMapPage.measure.distance", "Distance: {{d}}", { d: on }), P.area != null && ` · ${e("healthybowl.fieldMapPage.measure.area", "Area: {{a}} ac", { a: (P.area / 4046.8564224).toFixed(2) })}`] }),
652
+ /* @__PURE__ */ g(v, {
599
653
  size: "sm",
600
654
  variant: "outline",
601
655
  onClick: Q,
602
656
  children: e("healthybowl.fieldMapPage.measure.reset", "Reset")
603
657
  }),
604
- /* @__PURE__ */ v(b, {
658
+ /* @__PURE__ */ g(v, {
605
659
  size: "sm",
606
660
  variant: "outline",
607
- onClick: Ut,
608
- children: /* @__PURE__ */ v(be, { className: "h-3.5 w-3.5" })
661
+ onClick: en,
662
+ children: /* @__PURE__ */ g(we, { className: "h-3.5 w-3.5" })
609
663
  })
610
664
  ]
611
665
  }),
612
- O === "ready" && /* @__PURE__ */ y("div", {
666
+ T === "ready" && /* @__PURE__ */ _("div", {
613
667
  className: "absolute bottom-3 left-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
614
668
  children: [
615
- /* @__PURE__ */ y("div", {
669
+ /* @__PURE__ */ _("div", {
616
670
  className: "mb-1.5 flex items-center gap-1.5 font-semibold text-text-primary",
617
671
  children: [
618
- /* @__PURE__ */ v(ue, { className: "h-3.5 w-3.5" }),
672
+ /* @__PURE__ */ g(me, { className: "h-3.5 w-3.5" }),
619
673
  " ",
620
674
  e("healthybowl.fieldMapPage.layers.title", "Layers")
621
675
  ]
622
676
  }),
623
- /* @__PURE__ */ y("label", {
677
+ /* @__PURE__ */ _("label", {
624
678
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
625
- children: [/* @__PURE__ */ v("input", {
679
+ children: [/* @__PURE__ */ g("input", {
626
680
  type: "checkbox",
627
681
  checked: !0,
628
682
  readOnly: !0,
629
683
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
630
684
  }), e("healthybowl.fieldMapPage.layers.satellite", "Satellite")]
631
685
  }),
632
- /* @__PURE__ */ y("label", {
686
+ /* @__PURE__ */ _("label", {
633
687
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
634
- children: [/* @__PURE__ */ v("input", {
688
+ children: [/* @__PURE__ */ g("input", {
635
689
  type: "checkbox",
636
- checked: N,
637
- onChange: (e) => qe(e.target.checked),
690
+ checked: A,
691
+ onChange: (e) => $e(e.target.checked),
638
692
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
639
693
  }), e("healthybowl.fieldMapPage.layers.terrain", "Terrain")]
640
694
  }),
641
- /* @__PURE__ */ y("label", {
695
+ /* @__PURE__ */ _("label", {
642
696
  className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
643
- children: [/* @__PURE__ */ v("input", {
697
+ children: [/* @__PURE__ */ g("input", {
644
698
  type: "checkbox",
645
- checked: P,
646
- onChange: (e) => Je(e.target.checked),
699
+ checked: j,
700
+ onChange: (e) => et(e.target.checked),
647
701
  className: "h-3.5 w-3.5 accent-[var(--color-success)]"
648
702
  }), e("healthybowl.fieldMapPage.layers.soil", "Soil type")]
703
+ }),
704
+ /* @__PURE__ */ _("label", {
705
+ className: "flex cursor-pointer items-center gap-2 py-0.5 text-text-primary",
706
+ children: [/* @__PURE__ */ g("input", {
707
+ type: "checkbox",
708
+ checked: M,
709
+ onChange: (e) => tt(e.target.checked),
710
+ className: "h-3.5 w-3.5 accent-[var(--color-success)]"
711
+ }), e("healthybowl.fieldMapPage.layers.elevation", "Elevation")]
649
712
  })
650
713
  ]
651
714
  }),
652
- O === "ready" && P && Dt.length > 0 && /* @__PURE__ */ y("div", {
715
+ T === "ready" && M && /* @__PURE__ */ _("div", {
716
+ className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
717
+ children: [/* @__PURE__ */ g("div", {
718
+ className: "mb-1.5 font-semibold text-text-primary",
719
+ children: e("healthybowl.fieldMapPage.elevationLegend.title", "Elevation")
720
+ }), zt ? /* @__PURE__ */ _(Te, { children: [/* @__PURE__ */ g("span", {
721
+ className: "block h-2 w-40 rounded-full",
722
+ style: { background: "linear-gradient(to right, #16a34a, #f59e0b, #dc2626)" }
723
+ }), /* @__PURE__ */ _("div", {
724
+ className: "mt-1 flex justify-between gap-3 text-text-secondary",
725
+ children: [/* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.elevationLegend.low", "{{value}} m Low", { value: String(Math.round(Lt)) }) }), /* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.elevationLegend.high", "{{value}} m High", { value: String(Math.round(Rt)) }) })]
726
+ })] }) : /* @__PURE__ */ g("span", {
727
+ className: "text-text-secondary",
728
+ children: e("healthybowl.fieldMapPage.elevationLegend.loading", "Loading elevation…")
729
+ })]
730
+ }),
731
+ T === "ready" && j && !M && Ft.length > 0 && /* @__PURE__ */ _("div", {
653
732
  className: "absolute bottom-3 right-3 z-[1000] rounded-lg border border-border-subtle bg-bg-surface/95 p-3 text-xs shadow-md",
654
- children: [/* @__PURE__ */ v("div", {
733
+ children: [/* @__PURE__ */ g("div", {
655
734
  className: "mb-1.5 font-semibold text-text-primary",
656
735
  children: e("healthybowl.fieldMapPage.soilLegend.title", "Soil Legend")
657
- }), Dt.map((t) => /* @__PURE__ */ y("div", {
736
+ }), Ft.map((t) => /* @__PURE__ */ _("div", {
658
737
  className: "flex items-center gap-2 py-0.5 text-text-secondary",
659
- children: [/* @__PURE__ */ v("span", {
738
+ children: [/* @__PURE__ */ g("span", {
660
739
  className: "inline-block h-3 w-3 rounded-sm",
661
740
  style: { backgroundColor: t.color }
662
741
  }), e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)]
663
742
  }, t.key))]
664
743
  }),
665
- O === "ready" && N && /* @__PURE__ */ y("div", {
744
+ T === "ready" && A && /* @__PURE__ */ _("div", {
666
745
  className: "absolute left-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",
667
- children: [/* @__PURE__ */ v("div", {
746
+ children: [/* @__PURE__ */ g("div", {
668
747
  className: "font-semibold text-text-primary",
669
748
  children: e("healthybowl.fieldMapPage.terrainLegend.title", "Terrain / Elevation")
670
- }), /* @__PURE__ */ y("div", {
749
+ }), /* @__PURE__ */ _("div", {
671
750
  className: "mt-1 flex items-center gap-2",
672
- children: [/* @__PURE__ */ v("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ v("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
751
+ children: [/* @__PURE__ */ g("span", { className: "inline-block h-2 w-16 rounded-full bg-gradient-to-r from-green-600 via-yellow-400 to-orange-500" }), /* @__PURE__ */ g("span", { children: e("healthybowl.fieldMapPage.terrainLegend.scale", "low → high (contours)") })]
673
752
  })]
674
753
  }),
675
- (O === "loading" || Pe.crops && u.length === 0) && /* @__PURE__ */ v("div", {
754
+ (T === "loading" || ze.crops && c.length === 0) && /* @__PURE__ */ g("div", {
676
755
  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",
677
756
  children: e("healthybowl.fieldMapPage.loading", "Loading map…")
678
757
  }),
679
- qt && O === "ready" && k === "view" && /* @__PURE__ */ v("div", {
758
+ an && T === "ready" && E === "view" && /* @__PURE__ */ g("div", {
680
759
  className: "absolute inset-0 z-[950] flex items-center justify-center p-6",
681
- children: /* @__PURE__ */ y("div", {
760
+ children: /* @__PURE__ */ _("div", {
682
761
  className: "max-w-sm rounded-xl border border-border-subtle bg-bg-surface/95 p-6 text-center shadow-lg",
683
762
  children: [
684
- /* @__PURE__ */ v("div", {
763
+ /* @__PURE__ */ g("div", {
685
764
  className: "mx-auto mb-3 flex h-12 w-12 items-center justify-center rounded-full bg-success/15",
686
- children: /* @__PURE__ */ v(fe, { className: "h-6 w-6 text-success" })
765
+ children: /* @__PURE__ */ g(ge, { className: "h-6 w-6 text-success" })
687
766
  }),
688
- /* @__PURE__ */ v("h3", {
767
+ /* @__PURE__ */ g("h3", {
689
768
  className: "text-lg font-semibold text-text-primary",
690
769
  children: e("healthybowl.fieldMapPage.empty.title", "No field boundaries yet")
691
770
  }),
692
- /* @__PURE__ */ v("p", {
771
+ /* @__PURE__ */ g("p", {
693
772
  className: "mt-1 text-sm text-text-secondary",
694
773
  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.")
695
774
  }),
696
- /* @__PURE__ */ y(b, {
775
+ /* @__PURE__ */ _(v, {
697
776
  className: "mt-4",
698
- onClick: Pt,
777
+ onClick: Gt,
699
778
  children: [
700
- /* @__PURE__ */ v(me, { className: "h-4 w-4" }),
779
+ /* @__PURE__ */ g(ve, { className: "h-4 w-4" }),
701
780
  " ",
702
781
  e("healthybowl.fieldMapPage.empty.action", "Draw Your First Field")
703
782
  ]
@@ -707,174 +786,186 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
707
786
  })
708
787
  ]
709
788
  }),
710
- /* @__PURE__ */ v("p", {
789
+ /* @__PURE__ */ g("p", {
711
790
  className: "text-xs text-text-secondary",
712
791
  children: e("healthybowl.fieldMapPage.attribution", "Imagery © Esri, Maxar, Earthstar Geographics · terrain © OpenTopoMap / OpenStreetMap")
713
792
  })
714
793
  ]
715
- }), /* @__PURE__ */ y("aside", {
794
+ }), /* @__PURE__ */ _("aside", {
716
795
  className: "shrink-0 space-y-4 lg:w-80",
717
- children: [/* @__PURE__ */ y("div", {
796
+ children: [/* @__PURE__ */ _("div", {
718
797
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
719
798
  children: [
720
- /* @__PURE__ */ v("h2", {
799
+ /* @__PURE__ */ g("h2", {
721
800
  className: "text-base font-semibold text-text-primary",
722
801
  children: e("healthybowl.fieldMapPage.panel.title", "Fields")
723
802
  }),
724
- /* @__PURE__ */ v("p", {
803
+ /* @__PURE__ */ g("p", {
725
804
  className: "mt-0.5 text-xs text-text-secondary",
726
805
  children: e("healthybowl.fieldMapPage.panel.summary", "{{acres}} acres · {{count}} fields · {{mapped}} mapped", {
727
- acres: Et.toFixed(1),
728
- count: String(u.length),
729
- mapped: String(Tt)
806
+ acres: Pt.toFixed(1),
807
+ count: String(c.length),
808
+ mapped: String(Nt)
730
809
  })
731
810
  }),
732
- /* @__PURE__ */ y("div", {
811
+ /* @__PURE__ */ _("div", {
733
812
  className: "relative mt-3",
734
- children: [/* @__PURE__ */ v(_e, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ v("input", {
813
+ children: [/* @__PURE__ */ g(xe, { className: "pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-text-secondary" }), /* @__PURE__ */ g("input", {
735
814
  type: "search",
736
- value: Ye,
737
- onChange: (e) => Xe(e.target.value),
815
+ value: rt,
816
+ onChange: (e) => it(e.target.value),
738
817
  placeholder: e("healthybowl.fieldMapPage.panel.search", "Search fields…"),
739
818
  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)]"
740
819
  })]
741
820
  }),
742
- /* @__PURE__ */ y("div", {
821
+ /* @__PURE__ */ _("div", {
743
822
  className: "mt-3 max-h-[38vh] space-y-1 overflow-y-auto",
744
- children: [Ot.map((t) => {
745
- let n = w(t) !== null;
746
- return /* @__PURE__ */ y("button", {
823
+ children: [It.map((t) => {
824
+ let n = x(t) !== null;
825
+ return /* @__PURE__ */ _("button", {
747
826
  type: "button",
748
- onClick: () => jt(t),
749
- className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id === j ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
827
+ "data-field-id": t.id,
828
+ onClick: () => Ht(t),
829
+ className: `flex w-full items-center gap-3 rounded-md border px-2.5 py-2 text-left transition-colors ${t.id === O ? "border-success bg-success/10" : "border-transparent hover:bg-bg-sunken"}`,
750
830
  children: [
751
- /* @__PURE__ */ v("span", {
831
+ /* @__PURE__ */ g("span", {
752
832
  className: "mt-0.5 inline-block h-4 w-4 shrink-0 rounded",
753
- style: { backgroundColor: ae(t.soilType) }
833
+ style: { backgroundColor: se(t.soilType) }
754
834
  }),
755
- /* @__PURE__ */ y("span", {
835
+ /* @__PURE__ */ _("span", {
756
836
  className: "min-w-0 flex-1",
757
- children: [/* @__PURE__ */ v("span", {
837
+ children: [/* @__PURE__ */ g("span", {
758
838
  className: "block truncate text-sm font-medium text-text-primary",
759
839
  children: t.name
760
- }), /* @__PURE__ */ y("span", {
840
+ }), /* @__PURE__ */ _("span", {
761
841
  className: "block truncate text-xs text-text-secondary",
762
842
  children: [
763
- Be(t).toFixed(1),
764
- " ac ·",
843
+ qe(t),
844
+ " ·",
765
845
  " ",
766
- t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
846
+ t.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil"),
847
+ N[t.id] != null && ` · ${e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[t.id])) })}`
767
848
  ]
768
849
  })]
769
850
  }),
770
- !n && /* @__PURE__ */ v("span", {
851
+ !n && /* @__PURE__ */ g("span", {
771
852
  className: "shrink-0 rounded-full bg-warning/20 px-1.5 py-0.5 text-[10px] font-medium text-warning",
772
853
  children: e("healthybowl.fieldMapPage.unmapped", "no boundary")
773
854
  })
774
855
  ]
775
856
  }, t.id);
776
- }), Ot.length === 0 && /* @__PURE__ */ v("p", {
857
+ }), It.length === 0 && /* @__PURE__ */ g("p", {
777
858
  className: "px-2 py-4 text-center text-xs text-text-secondary",
778
859
  children: e("healthybowl.fieldMapPage.panel.none", "No fields match your search.")
779
860
  })]
780
861
  }),
781
- /* @__PURE__ */ y(b, {
862
+ /* @__PURE__ */ _(v, {
782
863
  className: "mt-3 w-full",
783
- onClick: Pt,
784
- disabled: k === "draw",
864
+ onClick: Gt,
865
+ disabled: E === "draw",
785
866
  children: [
786
- /* @__PURE__ */ v(me, { className: "h-4 w-4" }),
867
+ /* @__PURE__ */ g(ve, { className: "h-4 w-4" }),
787
868
  " ",
788
869
  e("healthybowl.fieldMapPage.panel.drawNew", "Draw New Field")
789
870
  ]
790
871
  })
791
872
  ]
792
- }), J && /* @__PURE__ */ y("div", {
873
+ }), q && /* @__PURE__ */ _("div", {
793
874
  className: "rounded-lg border border-border-subtle bg-bg-surface p-4",
794
875
  children: [
795
- /* @__PURE__ */ v("h3", {
876
+ /* @__PURE__ */ g("h3", {
796
877
  className: "text-sm font-semibold text-text-primary",
797
- children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: J.name })
878
+ children: e("healthybowl.fieldMapPage.detail.selected", "Selected: {{name}}", { name: q.name })
798
879
  }),
799
- /* @__PURE__ */ y("dl", {
880
+ /* @__PURE__ */ _("dl", {
800
881
  className: "mt-3 space-y-2 text-sm",
801
882
  children: [
802
- /* @__PURE__ */ y("div", {
883
+ /* @__PURE__ */ _("div", {
803
884
  className: "flex justify-between gap-3",
804
- children: [/* @__PURE__ */ v("dt", {
885
+ children: [/* @__PURE__ */ g("dt", {
805
886
  className: "text-text-secondary",
806
887
  children: e("healthybowl.fieldMapPage.detail.area", "Area")
807
- }), /* @__PURE__ */ y("dd", {
888
+ }), /* @__PURE__ */ _("dd", {
808
889
  className: "font-medium text-text-primary",
809
890
  children: [
810
- J.area,
891
+ q.area,
811
892
  " ",
812
- J.unit
893
+ q.unit
813
894
  ]
814
895
  })]
815
896
  }),
816
- /* @__PURE__ */ y("div", {
897
+ /* @__PURE__ */ _("div", {
898
+ className: "flex justify-between gap-3",
899
+ children: [/* @__PURE__ */ g("dt", {
900
+ className: "text-text-secondary",
901
+ children: e("healthybowl.fieldMapPage.detail.elevation", "Elevation")
902
+ }), /* @__PURE__ */ g("dd", {
903
+ className: "font-medium text-text-primary",
904
+ children: N[q.id] == null ? "—" : e("healthybowl.fieldMapPage.detail.elevationValue", "{{value}} m", { value: String(Math.round(N[q.id])) })
905
+ })]
906
+ }),
907
+ /* @__PURE__ */ _("div", {
817
908
  className: "flex justify-between gap-3",
818
- children: [/* @__PURE__ */ v("dt", {
909
+ children: [/* @__PURE__ */ g("dt", {
819
910
  className: "text-text-secondary",
820
911
  children: e("healthybowl.fieldMapPage.detail.soil", "Soil")
821
- }), /* @__PURE__ */ v("dd", {
912
+ }), /* @__PURE__ */ g("dd", {
822
913
  className: "font-medium text-text-primary",
823
- children: J.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
914
+ children: q.soilType || e("healthybowl.fieldMapPage.unknownSoil", "Unknown soil")
824
915
  })]
825
916
  }),
826
- /* @__PURE__ */ y("div", {
917
+ /* @__PURE__ */ _("div", {
827
918
  className: "flex justify-between gap-3",
828
- children: [/* @__PURE__ */ v("dt", {
919
+ children: [/* @__PURE__ */ g("dt", {
829
920
  className: "text-text-secondary",
830
921
  children: e("healthybowl.fieldMapPage.detail.irrigation", "Irrigation")
831
- }), /* @__PURE__ */ v("dd", {
922
+ }), /* @__PURE__ */ g("dd", {
832
923
  className: "font-medium text-text-primary",
833
- children: J.irrigationType || "—"
924
+ children: q.irrigationType || "—"
834
925
  })]
835
926
  }),
836
- /* @__PURE__ */ y("div", {
927
+ /* @__PURE__ */ _("div", {
837
928
  className: "flex justify-between gap-3",
838
- children: [/* @__PURE__ */ v("dt", {
929
+ children: [/* @__PURE__ */ g("dt", {
839
930
  className: "text-text-secondary",
840
931
  children: e("healthybowl.fieldMapPage.detail.crop", "Crop")
841
- }), /* @__PURE__ */ v("dd", {
932
+ }), /* @__PURE__ */ g("dd", {
842
933
  className: "font-medium text-text-primary",
843
- children: kt(J) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
934
+ children: Bt(q) || e("healthybowl.fieldMapPage.detail.noCrop", "None")
844
935
  })]
845
936
  }),
846
- /* @__PURE__ */ y("div", {
937
+ /* @__PURE__ */ _("div", {
847
938
  className: "flex justify-between gap-3",
848
- children: [/* @__PURE__ */ v("dt", {
939
+ children: [/* @__PURE__ */ g("dt", {
849
940
  className: "text-text-secondary",
850
941
  children: e("healthybowl.fieldMapPage.detail.status", "Status")
851
- }), /* @__PURE__ */ v("dd", {
942
+ }), /* @__PURE__ */ g("dd", {
852
943
  className: "font-medium capitalize text-text-primary",
853
- children: J.status
944
+ children: q.status
854
945
  })]
855
946
  })
856
947
  ]
857
948
  }),
858
- /* @__PURE__ */ y("div", {
949
+ /* @__PURE__ */ _("div", {
859
950
  className: "mt-3 flex gap-2",
860
- children: [/* @__PURE__ */ y(b, {
951
+ children: [/* @__PURE__ */ _(v, {
861
952
  variant: "outline",
862
953
  size: "sm",
863
954
  className: "flex-1",
864
- onClick: () => At(J),
955
+ onClick: () => Vt(q),
865
956
  children: [
866
- /* @__PURE__ */ v(fe, { className: "h-4 w-4" }),
957
+ /* @__PURE__ */ g(ge, { className: "h-4 w-4" }),
867
958
  " ",
868
959
  e("healthybowl.fieldMapPage.detail.flyTo", "Fly to")
869
960
  ]
870
- }), w(J) && /* @__PURE__ */ y(b, {
961
+ }), x(q) && /* @__PURE__ */ _(v, {
871
962
  variant: "outline",
872
963
  size: "sm",
873
964
  className: "flex-1",
874
- onClick: Lt,
875
- disabled: k === "edit",
965
+ onClick: Jt,
966
+ disabled: E === "edit",
876
967
  children: [
877
- /* @__PURE__ */ v(ve, { className: "h-4 w-4" }),
968
+ /* @__PURE__ */ g(Se, { className: "h-4 w-4" }),
878
969
  " ",
879
970
  e("healthybowl.fieldMapPage.detail.edit", "Edit")
880
971
  ]
@@ -884,105 +975,105 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
884
975
  })]
885
976
  })]
886
977
  }),
887
- /* @__PURE__ */ v(s, {
888
- open: I !== null,
889
- onClose: () => L(null),
978
+ /* @__PURE__ */ g(ee, {
979
+ open: F !== null,
980
+ onClose: () => I(null),
890
981
  title: e("healthybowl.fieldMapPage.create.title", "Save New Field"),
891
982
  description: e("healthybowl.fieldMapPage.create.description", "Name the field you just drew. Its area is auto-calculated."),
892
- footer: /* @__PURE__ */ y(xe, { children: [/* @__PURE__ */ v(b, {
983
+ footer: /* @__PURE__ */ _(Te, { children: [/* @__PURE__ */ g(v, {
893
984
  variant: "outline",
894
- onClick: () => L(null),
985
+ onClick: () => I(null),
895
986
  className: "text-text-secondary",
896
987
  children: e("healthybowl.common.cancel", "Cancel")
897
- }), /* @__PURE__ */ v(b, {
898
- onClick: Kt,
899
- disabled: ut,
900
- children: ut ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
988
+ }), /* @__PURE__ */ g(v, {
989
+ onClick: rn,
990
+ disabled: vt,
991
+ children: vt ? e("healthybowl.fieldMapPage.create.saving", "Saving…") : e("healthybowl.fieldMapPage.create.action", "Save Field")
901
992
  })] }),
902
- children: /* @__PURE__ */ y("div", {
993
+ children: /* @__PURE__ */ _("div", {
903
994
  className: "space-y-4",
904
995
  children: [
905
- /* @__PURE__ */ v("div", {
996
+ /* @__PURE__ */ g("div", {
906
997
  className: "rounded-md bg-success/10 px-3 py-2 text-sm text-text-primary",
907
- children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(I?.area ?? 0) })
998
+ children: e("healthybowl.fieldMapPage.create.areaLine", "Auto-calculated area: {{area}} acres", { area: String(F?.area ?? 0) })
908
999
  }),
909
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1000
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
910
1001
  className: "text-sm font-medium text-text-primary",
911
1002
  children: e("healthybowl.fieldMapPage.create.name", "Field name *")
912
- }), /* @__PURE__ */ v("input", {
1003
+ }), /* @__PURE__ */ g("input", {
913
1004
  type: "text",
914
- value: R,
915
- onChange: (e) => ft(e.target.value),
1005
+ value: L,
1006
+ onChange: (e) => bt(e.target.value),
916
1007
  placeholder: e("healthybowl.fieldMapPage.create.namePlaceholder", "e.g., North Paddy"),
917
1008
  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)]"
918
1009
  })] }),
919
- /* @__PURE__ */ y("div", {
1010
+ /* @__PURE__ */ _("div", {
920
1011
  className: "grid grid-cols-2 gap-3",
921
- children: [/* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1012
+ children: [/* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
922
1013
  className: "text-sm font-medium text-text-primary",
923
1014
  children: e("healthybowl.fieldMapPage.create.soil", "Soil type")
924
- }), /* @__PURE__ */ y(x, {
925
- value: pt,
926
- onValueChange: mt,
927
- children: [/* @__PURE__ */ v(Ce, {
1015
+ }), /* @__PURE__ */ _(Ee, {
1016
+ value: xt,
1017
+ onValueChange: St,
1018
+ children: [/* @__PURE__ */ g(Oe, {
928
1019
  className: "mt-1 w-full",
929
- children: /* @__PURE__ */ v(we, {})
930
- }), /* @__PURE__ */ v(Se, { children: ie.map((t) => /* @__PURE__ */ v(S, {
1020
+ children: /* @__PURE__ */ g(ke, {})
1021
+ }), /* @__PURE__ */ g(De, { children: oe.map((t) => /* @__PURE__ */ g(y, {
931
1022
  value: t.label,
932
1023
  children: e(`healthybowl.fieldMapPage.soil.${t.key}`, t.label)
933
1024
  }, t.key)) })]
934
- })] }), /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1025
+ })] }), /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
935
1026
  className: "text-sm font-medium text-text-primary",
936
1027
  children: e("healthybowl.fieldMapPage.create.irrigation", "Irrigation")
937
- }), /* @__PURE__ */ y(x, {
938
- value: ht,
939
- onValueChange: gt,
940
- children: [/* @__PURE__ */ v(Ce, {
1028
+ }), /* @__PURE__ */ _(Ee, {
1029
+ value: Ct,
1030
+ onValueChange: wt,
1031
+ children: [/* @__PURE__ */ g(Oe, {
941
1032
  className: "mt-1 w-full",
942
- children: /* @__PURE__ */ v(we, {})
943
- }), /* @__PURE__ */ y(Se, { children: [
944
- /* @__PURE__ */ v(S, {
1033
+ children: /* @__PURE__ */ g(ke, {})
1034
+ }), /* @__PURE__ */ _(De, { children: [
1035
+ /* @__PURE__ */ g(y, {
945
1036
  value: "Drip",
946
1037
  children: e("healthybowl.fieldMapPage.irrigation.drip", "Drip")
947
1038
  }),
948
- /* @__PURE__ */ v(S, {
1039
+ /* @__PURE__ */ g(y, {
949
1040
  value: "Sprinkler",
950
1041
  children: e("healthybowl.fieldMapPage.irrigation.sprinkler", "Sprinkler")
951
1042
  }),
952
- /* @__PURE__ */ v(S, {
1043
+ /* @__PURE__ */ g(y, {
953
1044
  value: "Flood",
954
1045
  children: e("healthybowl.fieldMapPage.irrigation.flood", "Flood")
955
1046
  }),
956
- /* @__PURE__ */ v(S, {
1047
+ /* @__PURE__ */ g(y, {
957
1048
  value: "Rainfed",
958
1049
  children: e("healthybowl.fieldMapPage.irrigation.rainfed", "Rainfed")
959
1050
  }),
960
- /* @__PURE__ */ v(S, {
1051
+ /* @__PURE__ */ g(y, {
961
1052
  value: "None",
962
1053
  children: e("healthybowl.fieldMapPage.irrigation.none", "None")
963
1054
  })
964
1055
  ] })]
965
1056
  })] })]
966
1057
  }),
967
- /* @__PURE__ */ y("div", { children: [/* @__PURE__ */ v("label", {
1058
+ /* @__PURE__ */ _("div", { children: [/* @__PURE__ */ g("label", {
968
1059
  className: "text-sm font-medium text-text-primary",
969
1060
  children: e("healthybowl.fieldMapPage.create.status", "Status")
970
- }), /* @__PURE__ */ y(x, {
971
- value: _t,
972
- onValueChange: vt,
973
- children: [/* @__PURE__ */ v(Ce, {
1061
+ }), /* @__PURE__ */ _(Ee, {
1062
+ value: Tt,
1063
+ onValueChange: Et,
1064
+ children: [/* @__PURE__ */ g(Oe, {
974
1065
  className: "mt-1 w-full",
975
- children: /* @__PURE__ */ v(we, {})
976
- }), /* @__PURE__ */ y(Se, { children: [
977
- /* @__PURE__ */ v(S, {
1066
+ children: /* @__PURE__ */ g(ke, {})
1067
+ }), /* @__PURE__ */ _(De, { children: [
1068
+ /* @__PURE__ */ g(y, {
978
1069
  value: "active",
979
1070
  children: e("healthybowl.fieldMapPage.status.active", "Active")
980
1071
  }),
981
- /* @__PURE__ */ v(S, {
1072
+ /* @__PURE__ */ g(y, {
982
1073
  value: "preparation",
983
1074
  children: e("healthybowl.fieldMapPage.status.preparation", "Preparation")
984
1075
  }),
985
- /* @__PURE__ */ v(S, {
1076
+ /* @__PURE__ */ g(y, {
986
1077
  value: "fallow",
987
1078
  children: e("healthybowl.fieldMapPage.status.fallow", "Fallow")
988
1079
  })
@@ -991,14 +1082,14 @@ var C = /* @__PURE__ */ e(c(), 1), De = Te`
991
1082
  ]
992
1083
  })
993
1084
  }),
994
- /* @__PURE__ */ v(a, {
995
- toasts: We,
996
- onDismiss: Ge
1085
+ /* @__PURE__ */ g(a, {
1086
+ toasts: Xe,
1087
+ onDismiss: Ze
997
1088
  })
998
1089
  ]
999
1090
  });
1000
1091
  };
1001
1092
  //#endregion
1002
- export { He as FieldMapPage };
1093
+ export { S as FieldMapPage };
1003
1094
 
1004
1095
  //# sourceMappingURL=FieldMapPage.js.map