@burdenoff/microfe-healthybowl 2026.905.2 → 2026.905.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/healthybowl/HealthyBowlRoot.js +57 -56
  2. package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
  3. package/dist/healthybowl/HealthyBowlRoutes.js +48 -36
  4. package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
  5. package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
  6. package/dist/healthybowl/components/PageLayout.js +11 -10
  7. package/dist/healthybowl/components/PageLayout.js.map +1 -1
  8. package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
  9. package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
  10. package/dist/healthybowl/hooks/useAgronomyDecisions.js +79 -0
  11. package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +1 -0
  12. package/dist/healthybowl/hooks/useAnalyticsReports.js +173 -0
  13. package/dist/healthybowl/hooks/useAnalyticsReports.js.map +1 -0
  14. package/dist/healthybowl/hooks/useComplianceExports.js +74 -0
  15. package/dist/healthybowl/hooks/useComplianceExports.js.map +1 -0
  16. package/dist/healthybowl/hooks/useConsultationPayments.js +59 -0
  17. package/dist/healthybowl/hooks/useConsultationPayments.js.map +1 -0
  18. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +157 -141
  19. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
  20. package/dist/healthybowl/hooks/useHealthyBowlData.js +18 -0
  21. package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
  22. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +52 -37
  23. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
  24. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +135 -78
  25. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
  26. package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
  27. package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
  28. package/dist/healthybowl/hooks/usePlantingEstimate.js +88 -0
  29. package/dist/healthybowl/hooks/usePlantingEstimate.js.map +1 -0
  30. package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
  31. package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
  32. package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
  33. package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
  34. package/dist/healthybowl/offline/HeaderOfflinePill.js +28 -0
  35. package/dist/healthybowl/offline/HeaderOfflinePill.js.map +1 -0
  36. package/dist/healthybowl/offline/OfflineStatusPill.js +40 -21
  37. package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
  38. package/dist/healthybowl/offline/OfflineSyncProvider.js +149 -126
  39. package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
  40. package/dist/healthybowl/offline/captureCache.js +30 -0
  41. package/dist/healthybowl/offline/captureCache.js.map +1 -0
  42. package/dist/healthybowl/offline/graphql.js.map +1 -1
  43. package/dist/healthybowl/offline/headerSlot.js +24 -0
  44. package/dist/healthybowl/offline/headerSlot.js.map +1 -0
  45. package/dist/healthybowl/offline/store.js +1 -1
  46. package/dist/healthybowl/offline/syncEngine.js +2 -1
  47. package/dist/healthybowl/offline/syncEngine.js.map +1 -1
  48. package/dist/healthybowl/offline/types.js.map +1 -1
  49. package/dist/healthybowl/pages/GettingStartedPage.js +1 -0
  50. package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
  51. package/dist/healthybowl/pages/ai/AiDecisionsPage.js +287 -0
  52. package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +1 -0
  53. package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
  54. package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
  55. package/dist/healthybowl/pages/analytics/ReportsPage.js +136 -99
  56. package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
  57. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +204 -162
  58. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
  59. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +196 -178
  60. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
  61. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +142 -141
  62. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
  63. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +291 -0
  64. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +1 -0
  65. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +300 -0
  66. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +1 -0
  67. package/dist/healthybowl/pages/compliance/substanceRuleForm.js +135 -0
  68. package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +1 -0
  69. package/dist/healthybowl/pages/crops/CropFieldsPage.js +2 -0
  70. package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
  71. package/dist/healthybowl/pages/crops/CropHarvestPage.js +316 -272
  72. package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
  73. package/dist/healthybowl/pages/crops/CropPlanningPage.js +6 -0
  74. package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
  75. package/dist/healthybowl/pages/crops/FieldDetailsPage.js +871 -846
  76. package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
  77. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +376 -334
  78. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
  79. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +415 -188
  80. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
  81. package/dist/healthybowl/pages/distribution/labels.js +10 -2
  82. package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
  83. package/dist/healthybowl/pages/farm/FarmProfilePage.js +1 -0
  84. package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
  85. package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
  86. package/dist/healthybowl/pages/fields/FieldMapPage.js +2 -0
  87. package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
  88. package/dist/healthybowl/pages/financial/FinancialReportsPage.js +92 -107
  89. package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
  90. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +228 -188
  91. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
  92. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +261 -191
  93. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
  94. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +49 -0
  95. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +1 -0
  96. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +48 -0
  97. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +1 -0
  98. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +54 -0
  99. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +1 -0
  100. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
  101. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
  102. package/dist/healthybowl/pages/irrigation/IrrigationPage.js +338 -307
  103. package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
  104. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +126 -102
  105. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
  106. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +257 -215
  107. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
  108. package/dist/healthybowl/pages/livestock/GrazingPage.js +1 -0
  109. package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
  110. package/dist/healthybowl/pages/livestock/HerdDepthPage.js +4 -0
  111. package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
  112. package/dist/healthybowl/pages/livestock/PedigreeTree.js +154 -0
  113. package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +1 -0
  114. package/dist/healthybowl/pages/livestock/eidTagInput.js +39 -0
  115. package/dist/healthybowl/pages/livestock/eidTagInput.js.map +1 -0
  116. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +8 -9
  117. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
  118. package/dist/healthybowl/pages/livestock/pedigreeLayout.js +68 -0
  119. package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +1 -0
  120. package/dist/healthybowl/pages/network/ExpertsPage.js +520 -419
  121. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  122. package/dist/healthybowl/pages/pest-management/AiPestDetectionPage.js +12 -12
  123. package/dist/healthybowl/pages/pest-management/AiPestDetectionPage.js.map +1 -1
  124. package/dist/healthybowl/pages/terrace/JournalEntryModal.js +165 -165
  125. package/dist/healthybowl/pages/terrace/JournalEntryModal.js.map +1 -1
  126. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +129 -130
  127. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
  128. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +285 -237
  129. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
  130. package/dist/healthybowl/pages/weather/alertDelivery.js +105 -0
  131. package/dist/healthybowl/pages/weather/alertDelivery.js.map +1 -0
  132. package/dist/healthybowl/store/healthybowlStore.js +5 -5
  133. package/dist/healthybowl/utils/icsInspection.js +18 -0
  134. package/dist/healthybowl/utils/icsInspection.js.map +1 -0
  135. package/dist/healthybowl/utils/plantingCapacity.js +10 -10
  136. package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
  137. package/dist/node_modules/fast-equals/dist/es/index.js +74 -86
  138. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
  139. package/package.json +2 -2
@@ -10,28 +10,29 @@ import { useConfirm as ne } from "../../components/ConfirmDialog.js";
10
10
  import { PageLoader as re } from "../../components/PageLoader.js";
11
11
  import { Modal as c } from "../../components/Modal.js";
12
12
  import { useToast as ie } from "../../hooks/useToast.js";
13
+ import { CreateFarmTaskButton as ae } from "../../components/CreateFarmTaskButton.js";
13
14
  import "../../components/index.js";
14
- import { useHealthyBowlData as ae } from "../../hooks/useHealthyBowlData.js";
15
- import { Tooltip as oe } from "../../../node_modules/recharts/es6/component/Tooltip.js";
16
- import { ResponsiveContainer as se } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
17
- import { CartesianGrid as l } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
18
- import { Area as u } from "../../../node_modules/recharts/es6/cartesian/Area.js";
19
- import { XAxis as ce } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
20
- import { YAxis as d } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
21
- import { AreaChart as f } from "../../../node_modules/recharts/es6/chart/AreaChart.js";
22
- import { useIrrigation as p } from "../../hooks/useIrrigation.js";
15
+ import { useHealthyBowlData as oe } from "../../hooks/useHealthyBowlData.js";
16
+ import { Tooltip as se } from "../../../node_modules/recharts/es6/component/Tooltip.js";
17
+ import { ResponsiveContainer as l } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
18
+ import { CartesianGrid as u } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
19
+ import { Area as ce } from "../../../node_modules/recharts/es6/cartesian/Area.js";
20
+ import { XAxis as d } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
21
+ import { YAxis as f } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
22
+ import { AreaChart as p } from "../../../node_modules/recharts/es6/chart/AreaChart.js";
23
+ import { useIrrigation as m } from "../../hooks/useIrrigation.js";
23
24
  import { useIrrigationAutomation as le } from "../../hooks/useIrrigationAutomation.js";
24
- import { useMemo as m, useState as h } from "react";
25
+ import { useMemo as h, useState as g } from "react";
25
26
  import { useI18n as ue } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
26
- import { CalendarClock as g, Droplet as _, Droplets as v, GitBranch as de, Loader2 as y, Pause as fe, Pencil as b, Play as pe, Plus as x, Sparkles as S, Trash2 as me, Waves as C, Zap as he } from "lucide-react";
27
- import { Fragment as w, jsx as T, jsxs as E } from "react/jsx-runtime";
28
- import { Button as D } from "@burdenoff/fe-libs/ui";
27
+ import { CalendarClock as _, Droplet as v, Droplets as y, GitBranch as de, Loader2 as b, Pause as fe, Pencil as x, Play as pe, Plus as S, Sparkles as C, Trash2 as me, Waves as w, Zap as he } from "lucide-react";
28
+ import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
29
+ import { Button as O } from "@burdenoff/fe-libs/ui";
29
30
  //#region src/healthybowl/pages/irrigation/IrrigationPage.tsx
30
- var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", k = [
31
+ var k = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", A = [
31
32
  "DRIP",
32
33
  "SPRINKLER",
33
34
  "FLOOD"
34
- ], A = [
35
+ ], j = [
35
36
  "mon",
36
37
  "tue",
37
38
  "wed",
@@ -47,12 +48,12 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
47
48
  "Fri",
48
49
  "Sat",
49
50
  "Sun"
50
- ], j = (e) => {
51
+ ], M = (e) => {
51
52
  let t = e.trim();
52
53
  if (!t) return;
53
54
  let n = Number(t);
54
55
  return Number.isFinite(n) ? n : void 0;
55
- }, M = {
56
+ }, N = {
56
57
  fieldId: "",
57
58
  cropId: "",
58
59
  method: "DRIP",
@@ -60,15 +61,15 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
60
61
  durationMin: "30",
61
62
  startTime: "06:00",
62
63
  status: "active"
63
- }, N = {
64
+ }, P = {
64
65
  fieldId: "",
65
66
  scheduleId: "",
66
67
  litres: "",
67
68
  date: n(),
68
69
  status: "ran",
69
70
  skippedReason: ""
70
- }, P = () => {
71
- let { t } = ue(), de = ne(), { schedules: y, runs: S, loading: P, error: F, refetch: ve, createSchedule: ye, updateSchedule: be, deleteSchedule: xe, setScheduleStatus: Se, logWateringRun: Ce } = p(), { fields: I, crops: L } = ae(), { automations: we } = le(), { toasts: Te, toast: R, dismiss: Ee } = ie(), De = m(() => new Map(I.map((e) => [e.id, e])), [I]), Oe = m(() => new Map(L.map((e) => [e.id, e])), [L]), z = (e) => e && De.get(e)?.name || t("healthybowl.irrigation.unknownField", "Unknown field"), ke = (e) => e ? Oe.get(e)?.name ?? null : null, B = (e) => t(`healthybowl.irrigation.method.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase()), V = m(() => y.filter((e) => e.status === "active"), [y]), Ae = m(() => we.filter((e) => e.status === "active").length, [!0, we]), je = m(() => new Set(V.map((e) => e.fieldId)).size, [V]), Me = n(), Ne = m(() => S.filter((e) => e.status === "ran" && (e.runAt ?? "").slice(0, 10) === Me).reduce((e, t) => e + (t.litres ?? 0), 0), [S, Me]), H = m(() => {
71
+ }, _e = () => {
72
+ let { t } = ue(), de = ne(), { schedules: b, runs: C, loading: _e, error: F, refetch: ye, createSchedule: be, updateSchedule: xe, deleteSchedule: Se, setScheduleStatus: Ce, logWateringRun: we } = m(), { fields: I, crops: L } = oe(), { automations: Te } = le(), { toasts: Ee, toast: R, dismiss: De } = ie(), Oe = h(() => new Map(I.map((e) => [e.id, e])), [I]), ke = h(() => new Map(L.map((e) => [e.id, e])), [L]), z = (e) => e && Oe.get(e)?.name || t("healthybowl.irrigation.unknownField", "Unknown field"), Ae = (e) => e ? ke.get(e)?.name ?? null : null, B = (e) => t(`healthybowl.irrigation.method.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase()), V = h(() => b.filter((e) => e.status === "active"), [b]), je = h(() => Te.filter((e) => e.status === "active").length, [!0, Te]), Me = h(() => new Set(V.map((e) => e.fieldId)).size, [V]), Ne = n(), Pe = h(() => C.filter((e) => e.status === "ran" && (e.runAt ?? "").slice(0, 10) === Ne).reduce((e, t) => e + (t.litres ?? 0), 0), [C, Ne]), H = h(() => {
72
73
  let e = /* @__PURE__ */ new Date(), t = null;
73
74
  for (let n of V) {
74
75
  let [r, i] = (n.startTime || "00:00").split(":").map((e) => Number(e) || 0), a = new Date(e);
@@ -83,17 +84,17 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
83
84
  fieldId: t.fieldId,
84
85
  hours: n
85
86
  };
86
- }, [V]), Pe = H ? H.hours <= 48 ? t("healthybowl.irrigation.stats.nextRun.inHours", "{{field}} · in {{hours}}h", {
87
+ }, [V]), Fe = H ? H.hours <= 48 ? t("healthybowl.irrigation.stats.nextRun.inHours", "{{field}} · in {{hours}}h", {
87
88
  field: z(H.fieldId),
88
89
  hours: String(H.hours)
89
- }) : z(H.fieldId) : "—", Fe = m(() => {
90
- let e = A.map(() => []);
90
+ }) : z(H.fieldId) : "—", Ie = h(() => {
91
+ let e = j.map(() => []);
91
92
  for (let t of V) {
92
93
  let n = Math.max(1, t.frequencyDays || 1);
93
94
  for (let r = 0; r < 7; r += 1) r % n === 0 && e[r].push(t);
94
95
  }
95
96
  return e;
96
- }, [V]), Ie = m(() => {
97
+ }, [V]), Le = h(() => {
97
98
  let e = [];
98
99
  for (let t = 6; t >= 0; --t) {
99
100
  let n = /* @__PURE__ */ new Date();
@@ -106,7 +107,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
106
107
  });
107
108
  }
108
109
  let t = new Map(e.map((e) => [e.key, e]));
109
- for (let e of S) {
110
+ for (let e of C) {
110
111
  if (e.status !== "ran") continue;
111
112
  let n = t.get((e.runAt ?? "").slice(0, 10));
112
113
  n && (n.litres += e.litres ?? 0);
@@ -115,32 +116,32 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
115
116
  day: e.label,
116
117
  litres: Math.round(e.litres)
117
118
  }));
118
- }, [S]), Le = m(() => {
119
+ }, [C]), Re = h(() => {
119
120
  let e = /* @__PURE__ */ new Map();
120
- for (let t of S) t.scheduleId && e.set(t.scheduleId, (e.get(t.scheduleId) ?? 0) + 1);
121
+ for (let t of C) t.scheduleId && e.set(t.scheduleId, (e.get(t.scheduleId) ?? 0) + 1);
121
122
  return e;
122
- }, [S]), [Re, U] = h(!1), [W, G] = h(null), [K, q] = h(M), [ze, Be] = h(!1), J = (e, t) => q((n) => ({
123
+ }, [C]), [ze, U] = g(!1), [W, G] = g(null), [K, q] = g(N), [Be, Ve] = g(!1), J = (e, t) => q((n) => ({
123
124
  ...n,
124
125
  [e]: t
125
- })), Ve = () => {
126
+ })), He = () => {
126
127
  q({
127
- ...M,
128
+ ...N,
128
129
  fieldId: I[0]?.id ?? ""
129
130
  }), G(null), U(!0);
130
- }, He = (e) => {
131
+ }, Ue = (e) => {
131
132
  q({
132
133
  fieldId: e.fieldId,
133
134
  cropId: e.cropId ?? "",
134
- method: k.includes(e.method) ? e.method : "DRIP",
135
+ method: A.includes(e.method) ? e.method : "DRIP",
135
136
  frequencyDays: String(e.frequencyDays ?? 1),
136
137
  durationMin: String(e.durationMin ?? 0),
137
138
  startTime: e.startTime || "06:00",
138
139
  status: e.status === "paused" ? "paused" : "active"
139
140
  }), G(e.id), U(!0);
140
141
  }, Y = () => {
141
- q(M), G(null), U(!1);
142
- }, Ue = async () => {
143
- let e = j(K.frequencyDays), n = j(K.durationMin);
142
+ q(N), G(null), U(!1);
143
+ }, We = async () => {
144
+ let e = M(K.frequencyDays), n = M(K.durationMin);
144
145
  if (!K.fieldId || !e || !n || !K.startTime) {
145
146
  R({
146
147
  title: t("healthybowl.irrigation.schedule.toast.required.title", "Missing required fields"),
@@ -158,12 +159,12 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
158
159
  startTime: K.startTime,
159
160
  status: K.status
160
161
  };
161
- Be(!0);
162
+ Ve(!0);
162
163
  try {
163
- W ? (await be(W, r), R({
164
+ W ? (await xe(W, r), R({
164
165
  title: t("healthybowl.irrigation.schedule.toast.updated.title", "Schedule updated"),
165
166
  variant: "success"
166
- })) : (await ye(r), R({
167
+ })) : (await be(r), R({
167
168
  title: t("healthybowl.irrigation.schedule.toast.added.title", "Schedule created"),
168
169
  description: t("healthybowl.irrigation.schedule.toast.added.description", "{{field}} is now on a watering schedule.", { field: z(r.fieldId) }),
169
170
  variant: "success"
@@ -175,11 +176,11 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
175
176
  variant: "error"
176
177
  });
177
178
  } finally {
178
- Be(!1);
179
+ Ve(!1);
179
180
  }
180
- }, We = async (e) => {
181
+ }, Ge = async (e) => {
181
182
  if (await de({ message: t("healthybowl.irrigation.schedule.confirm.delete", "Delete the irrigation schedule for {{field}}? This cannot be undone.", { field: z(e.fieldId) }) })) try {
182
- await xe(e.id), R({
183
+ await Se(e.id), R({
183
184
  title: t("healthybowl.irrigation.schedule.toast.deleted.title", "Schedule deleted"),
184
185
  variant: "success"
185
186
  });
@@ -190,10 +191,10 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
190
191
  variant: "error"
191
192
  });
192
193
  }
193
- }, Ge = async (e) => {
194
+ }, Ke = async (e) => {
194
195
  let n = e.status === "active" ? "paused" : "active";
195
196
  try {
196
- await Se(e.id, n), R({
197
+ await Ce(e.id, n), R({
197
198
  title: n === "active" ? t("healthybowl.irrigation.schedule.toast.resumed.title", "Schedule resumed") : t("healthybowl.irrigation.schedule.toast.paused.title", "Schedule paused"),
198
199
  variant: "success"
199
200
  });
@@ -204,16 +205,16 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
204
205
  variant: "error"
205
206
  });
206
207
  }
207
- }, [Ke, X] = h(!1), [Z, Q] = h(N), [qe, Je] = h(!1), $ = (e, t) => Q((n) => ({
208
+ }, [qe, X] = g(!1), [Z, Q] = g(P), [Je, Ye] = g(!1), $ = (e, t) => Q((n) => ({
208
209
  ...n,
209
210
  [e]: t
210
- })), Ye = () => {
211
+ })), Xe = () => {
211
212
  Q({
212
- ...N,
213
+ ...P,
213
214
  fieldId: I[0]?.id ?? "",
214
215
  date: n()
215
216
  }), X(!0);
216
- }, Xe = m(() => y.filter((e) => e.fieldId === Z.fieldId), [y, Z.fieldId]), Ze = async () => {
217
+ }, Ze = h(() => b.filter((e) => e.fieldId === Z.fieldId), [b, Z.fieldId]), Qe = async () => {
217
218
  if (!Z.fieldId) {
218
219
  R({
219
220
  title: t("healthybowl.irrigation.run.toast.required.title", "Field required"),
@@ -222,12 +223,12 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
222
223
  });
223
224
  return;
224
225
  }
225
- Je(!0);
226
+ Ye(!0);
226
227
  try {
227
- await Ce({
228
+ await we({
228
229
  fieldId: Z.fieldId,
229
230
  scheduleId: Z.scheduleId || void 0,
230
- litres: Z.status === "ran" ? j(Z.litres) : void 0,
231
+ litres: Z.status === "ran" ? M(Z.litres) : void 0,
231
232
  runAt: `${Z.date}T12:00:00`,
232
233
  status: Z.status,
233
234
  skippedReason: Z.status === "skipped" && Z.skippedReason.trim() || void 0,
@@ -236,7 +237,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
236
237
  title: t("healthybowl.irrigation.run.toast.logged.title", "Watering run logged"),
237
238
  description: t("healthybowl.irrigation.run.toast.logged.description", "Recorded for {{field}}.", { field: z(Z.fieldId) }),
238
239
  variant: "success"
239
- }), X(!1), Q(N);
240
+ }), X(!1), Q(P);
240
241
  } catch (e) {
241
242
  R({
242
243
  title: t("healthybowl.irrigation.run.toast.error.title", "Could not log watering run"),
@@ -244,13 +245,13 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
244
245
  variant: "error"
245
246
  });
246
247
  } finally {
247
- Je(!1);
248
+ Ye(!1);
248
249
  }
249
- }, Qe = [
250
+ }, $e = [
250
251
  {
251
252
  key: "field",
252
253
  header: t("healthybowl.irrigation.columns.field", "Field"),
253
- render: (e) => /* @__PURE__ */ T("span", {
254
+ render: (e) => /* @__PURE__ */ E("span", {
254
255
  className: "font-medium text-text-primary",
255
256
  children: z(e.fieldId)
256
257
  })
@@ -258,15 +259,15 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
258
259
  {
259
260
  key: "crop",
260
261
  header: t("healthybowl.irrigation.columns.crop", "Crop"),
261
- render: (e) => /* @__PURE__ */ T("span", {
262
+ render: (e) => /* @__PURE__ */ E("span", {
262
263
  className: "text-text-secondary",
263
- children: ke(e.cropId) ?? "—"
264
+ children: Ae(e.cropId) ?? "—"
264
265
  })
265
266
  },
266
267
  {
267
268
  key: "method",
268
269
  header: t("healthybowl.irrigation.columns.method", "Method"),
269
- render: (e) => /* @__PURE__ */ T(o, {
270
+ render: (e) => /* @__PURE__ */ E(o, {
270
271
  label: B(e.method),
271
272
  variant: "info"
272
273
  })
@@ -274,7 +275,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
274
275
  {
275
276
  key: "frequency",
276
277
  header: t("healthybowl.irrigation.columns.frequency", "Frequency"),
277
- render: (e) => /* @__PURE__ */ T("span", {
278
+ render: (e) => /* @__PURE__ */ E("span", {
278
279
  className: "text-text-secondary",
279
280
  children: t("healthybowl.irrigation.everyNDays", "Every {{n}} day(s)", { n: String(e.frequencyDays) })
280
281
  })
@@ -282,7 +283,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
282
283
  {
283
284
  key: "duration",
284
285
  header: t("healthybowl.irrigation.columns.duration", "Duration"),
285
- render: (e) => /* @__PURE__ */ E("span", {
286
+ render: (e) => /* @__PURE__ */ D("span", {
286
287
  className: "tabular-nums text-text-secondary",
287
288
  children: [
288
289
  t("healthybowl.irrigation.minutes", "{{n}} min", { n: String(e.durationMin) }),
@@ -294,14 +295,14 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
294
295
  {
295
296
  key: "status",
296
297
  header: t("healthybowl.irrigation.columns.status", "Status"),
297
- render: (n) => /* @__PURE__ */ E("button", {
298
+ render: (n) => /* @__PURE__ */ D("button", {
298
299
  type: "button",
299
300
  onClick: (e) => {
300
- e.stopPropagation(), Ge(n);
301
+ e.stopPropagation(), Ke(n);
301
302
  },
302
303
  className: e("inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-medium transition-colors", n.status === "active" ? "border-status-success-text/30 bg-status-success-bg/10 text-status-success-text" : "border-border-subtle bg-bg-sunken text-text-secondary"),
303
304
  "aria-label": n.status === "active" ? t("healthybowl.irrigation.actions.pause", "Pause schedule") : t("healthybowl.irrigation.actions.resume", "Resume schedule"),
304
- children: [n.status === "active" ? /* @__PURE__ */ T(pe, { className: "h-3 w-3" }) : /* @__PURE__ */ T(fe, { className: "h-3 w-3" }), n.status === "active" ? t("healthybowl.irrigation.status.active", "Active") : t("healthybowl.irrigation.status.paused", "Paused")]
305
+ children: [n.status === "active" ? /* @__PURE__ */ E(pe, { className: "h-3 w-3" }) : /* @__PURE__ */ E(fe, { className: "h-3 w-3" }), n.status === "active" ? t("healthybowl.irrigation.status.active", "Active") : t("healthybowl.irrigation.status.paused", "Paused")]
305
306
  })
306
307
  },
307
308
  {
@@ -309,138 +310,149 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
309
310
  header: "",
310
311
  sortable: !1,
311
312
  className: "text-end",
312
- render: (e) => /* @__PURE__ */ E("div", {
313
+ render: (e) => /* @__PURE__ */ D("div", {
313
314
  className: "flex items-center justify-end gap-2",
314
- children: [/* @__PURE__ */ T(D, {
315
- variant: "outline",
316
- size: "icon-sm",
317
- onClick: (t) => {
318
- t.stopPropagation(), He(e);
319
- },
320
- "aria-label": t("healthybowl.common.edit", "Edit"),
321
- children: /* @__PURE__ */ T(b, { className: "h-4 w-4" })
322
- }), /* @__PURE__ */ T(D, {
323
- variant: "ghost",
324
- size: "icon-sm",
325
- onClick: (t) => {
326
- t.stopPropagation(), We(e);
327
- },
328
- "aria-label": t("healthybowl.common.delete", "Delete"),
329
- className: "text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text",
330
- children: /* @__PURE__ */ T(me, { className: "h-4 w-4" })
331
- })]
315
+ children: [
316
+ /* @__PURE__ */ E(ae, {
317
+ entityType: "IRRIGATION_SCHEDULE",
318
+ entityId: e.id,
319
+ entityLabel: z(e.fieldId),
320
+ iconOnly: !0,
321
+ size: "icon-sm",
322
+ title: t("healthybowl.irrigation.createTask", "Create a task for this schedule")
323
+ }),
324
+ /* @__PURE__ */ E(O, {
325
+ variant: "outline",
326
+ size: "icon-sm",
327
+ onClick: (t) => {
328
+ t.stopPropagation(), Ue(e);
329
+ },
330
+ "aria-label": t("healthybowl.common.edit", "Edit"),
331
+ children: /* @__PURE__ */ E(x, { className: "h-4 w-4" })
332
+ }),
333
+ /* @__PURE__ */ E(O, {
334
+ variant: "ghost",
335
+ size: "icon-sm",
336
+ onClick: (t) => {
337
+ t.stopPropagation(), Ge(e);
338
+ },
339
+ "aria-label": t("healthybowl.common.delete", "Delete"),
340
+ className: "text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text",
341
+ children: /* @__PURE__ */ E(me, { className: "h-4 w-4" })
342
+ })
343
+ ]
332
344
  })
333
345
  }
334
- ], $e = y.length > 0 || S.length > 0, et = Math.max(1, ...Ie.map((e) => e.litres));
335
- return /* @__PURE__ */ E(r, {
346
+ ], et = b.length > 0 || C.length > 0, tt = Math.max(1, ...Le.map((e) => e.litres));
347
+ return /* @__PURE__ */ D(r, {
336
348
  title: t("healthybowl.irrigation.title", "Irrigation Scheduling & Automation"),
337
349
  description: t("healthybowl.irrigation.description", "Schedule watering per field, log runs, and track water usage"),
338
350
  purpose: "Define a watering schedule for each field — method, cadence, duration and daily start time — then log the runs you carry out. HealthyBowl tallies your water usage and previews the automation rules that will run these schedules for you in Phase B.",
339
- actions: /* @__PURE__ */ E("div", {
351
+ actions: /* @__PURE__ */ D("div", {
340
352
  className: "flex items-center gap-2",
341
- children: [/* @__PURE__ */ E(D, {
353
+ children: [/* @__PURE__ */ D(O, {
342
354
  variant: "outline",
343
- onClick: Ye,
355
+ onClick: Xe,
344
356
  disabled: I.length === 0,
345
357
  children: [
346
- /* @__PURE__ */ T(_, { className: "h-4 w-4" }),
358
+ /* @__PURE__ */ E(v, { className: "h-4 w-4" }),
347
359
  " ",
348
360
  t("healthybowl.irrigation.actions.logRun", "Log Watering Run")
349
361
  ]
350
- }), /* @__PURE__ */ E(D, {
351
- onClick: Ve,
362
+ }), /* @__PURE__ */ D(O, {
363
+ onClick: He,
352
364
  disabled: I.length === 0,
353
365
  children: [
354
- /* @__PURE__ */ T(x, { className: "h-4 w-4" }),
366
+ /* @__PURE__ */ E(S, { className: "h-4 w-4" }),
355
367
  " ",
356
368
  t("healthybowl.irrigation.actions.addSchedule", "Add Schedule")
357
369
  ]
358
370
  })]
359
371
  }),
360
372
  children: [
361
- P && !$e ? /* @__PURE__ */ T(re, {}) : F && !$e ? /* @__PURE__ */ T(s, { onRetry: () => void ve() }) : /* @__PURE__ */ E("div", {
373
+ _e && !et ? /* @__PURE__ */ E(re, {}) : F && !et ? /* @__PURE__ */ E(s, { onRetry: () => void ye() }) : /* @__PURE__ */ D("div", {
362
374
  className: "space-y-8",
363
- children: [/* @__PURE__ */ E("div", {
375
+ children: [/* @__PURE__ */ D("div", {
364
376
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",
365
377
  children: [
366
- /* @__PURE__ */ T(i, {
378
+ /* @__PURE__ */ E(i, {
367
379
  label: t("healthybowl.irrigation.stats.fieldsOnSchedule", "Fields on Schedule"),
368
- value: je,
369
- icon: /* @__PURE__ */ T(C, {})
380
+ value: Me,
381
+ icon: /* @__PURE__ */ E(w, {})
370
382
  }),
371
- /* @__PURE__ */ T(i, {
383
+ /* @__PURE__ */ E(i, {
372
384
  label: t("healthybowl.irrigation.stats.waterToday", "Water Used Today"),
373
- value: Math.round(Ne),
385
+ value: Math.round(Pe),
374
386
  unit: "L",
375
- icon: /* @__PURE__ */ T(v, {})
387
+ icon: /* @__PURE__ */ E(y, {})
376
388
  }),
377
- /* @__PURE__ */ T(i, {
389
+ /* @__PURE__ */ E(i, {
378
390
  label: t("healthybowl.irrigation.stats.nextRun", "Next Run"),
379
- value: Pe,
380
- icon: /* @__PURE__ */ T(g, {})
391
+ value: Fe,
392
+ icon: /* @__PURE__ */ E(_, {})
381
393
  }),
382
- /* @__PURE__ */ T(i, {
394
+ /* @__PURE__ */ E(i, {
383
395
  label: t("healthybowl.irrigation.stats.automations", "Active Automations"),
384
- value: Ae,
385
- icon: /* @__PURE__ */ T(he, {})
396
+ value: je,
397
+ icon: /* @__PURE__ */ E(he, {})
386
398
  })
387
399
  ]
388
- }), y.length === 0 ? /* @__PURE__ */ E("div", {
400
+ }), b.length === 0 ? /* @__PURE__ */ D("div", {
389
401
  className: "flex flex-col items-center justify-center gap-3 rounded-xl border border-border-seam bg-gloss-card p-12 text-center",
390
402
  children: [
391
- /* @__PURE__ */ T("div", {
403
+ /* @__PURE__ */ E("div", {
392
404
  className: "flex h-12 w-12 items-center justify-center rounded-full bg-bg-sunken",
393
- children: /* @__PURE__ */ T(v, { className: "h-6 w-6 text-text-secondary" })
405
+ children: /* @__PURE__ */ E(y, { className: "h-6 w-6 text-text-secondary" })
394
406
  }),
395
- /* @__PURE__ */ T("p", {
407
+ /* @__PURE__ */ E("p", {
396
408
  className: "text-sm font-medium text-text-primary",
397
409
  children: t("healthybowl.irrigation.empty.title", "No irrigation schedules yet")
398
410
  }),
399
- /* @__PURE__ */ T("p", {
411
+ /* @__PURE__ */ E("p", {
400
412
  className: "max-w-sm text-sm text-text-secondary",
401
413
  children: I.length === 0 ? t("healthybowl.irrigation.empty.needField", "Add a field first, then set up a watering schedule for it.") : t("healthybowl.irrigation.empty.description", "Create a watering schedule for one of your fields to get started.")
402
414
  }),
403
- I.length > 0 && /* @__PURE__ */ E(D, {
404
- onClick: Ve,
415
+ I.length > 0 && /* @__PURE__ */ D(O, {
416
+ onClick: He,
405
417
  className: "mt-1",
406
418
  children: [
407
- /* @__PURE__ */ T(x, { className: "h-4 w-4" }),
419
+ /* @__PURE__ */ E(S, { className: "h-4 w-4" }),
408
420
  " ",
409
421
  t("healthybowl.irrigation.actions.addSchedule", "Add Schedule")
410
422
  ]
411
423
  })
412
424
  ]
413
- }) : /* @__PURE__ */ E(w, { children: [
414
- /* @__PURE__ */ E("section", {
425
+ }) : /* @__PURE__ */ D(T, { children: [
426
+ /* @__PURE__ */ D("section", {
415
427
  className: "space-y-3",
416
- children: [/* @__PURE__ */ E("div", {
428
+ children: [/* @__PURE__ */ D("div", {
417
429
  className: "flex items-center gap-2",
418
- children: [/* @__PURE__ */ T(g, { className: "h-5 w-5 text-text-secondary" }), /* @__PURE__ */ T("h2", {
430
+ children: [/* @__PURE__ */ E(_, { className: "h-5 w-5 text-text-secondary" }), /* @__PURE__ */ E("h2", {
419
431
  className: "text-lg font-semibold text-text-primary",
420
432
  children: t("healthybowl.irrigation.calendar.heading", "Weekly Schedule")
421
433
  })]
422
- }), /* @__PURE__ */ T("div", {
434
+ }), /* @__PURE__ */ E("div", {
423
435
  className: "overflow-x-auto",
424
- children: /* @__PURE__ */ T("div", {
436
+ children: /* @__PURE__ */ E("div", {
425
437
  className: "grid min-w-[720px] grid-cols-7 gap-3",
426
- children: A.map((e, n) => /* @__PURE__ */ E("div", {
438
+ children: j.map((e, n) => /* @__PURE__ */ D("div", {
427
439
  className: "flex flex-col gap-2",
428
- children: [/* @__PURE__ */ T("div", {
440
+ children: [/* @__PURE__ */ E("div", {
429
441
  className: "text-center text-xs font-semibold uppercase tracking-wider text-text-secondary",
430
442
  children: t(`healthybowl.irrigation.weekday.${e}`, ge[n])
431
- }), /* @__PURE__ */ T("div", {
443
+ }), /* @__PURE__ */ E("div", {
432
444
  className: "flex min-h-[96px] flex-col gap-2 rounded-lg border border-border-seam bg-bg-sunken/30 p-2",
433
- children: Fe[n].length === 0 ? /* @__PURE__ */ T("span", {
445
+ children: Ie[n].length === 0 ? /* @__PURE__ */ E("span", {
434
446
  className: "mt-6 text-center text-[11px] text-text-secondary",
435
447
  children: "—"
436
- }) : Fe[n].map((e) => /* @__PURE__ */ E("div", {
448
+ }) : Ie[n].map((e) => /* @__PURE__ */ D("div", {
437
449
  className: "rounded-md border border-border-subtle bg-gloss-card p-2 text-start shadow-pop",
438
450
  children: [
439
- /* @__PURE__ */ T("p", {
451
+ /* @__PURE__ */ E("p", {
440
452
  className: "truncate text-xs font-medium text-text-primary",
441
453
  children: z(e.fieldId)
442
454
  }),
443
- /* @__PURE__ */ E("p", {
455
+ /* @__PURE__ */ D("p", {
444
456
  className: "mt-0.5 truncate text-[11px] text-text-secondary",
445
457
  children: [
446
458
  B(e.method),
@@ -448,7 +460,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
448
460
  e.startTime
449
461
  ]
450
462
  }),
451
- /* @__PURE__ */ T("span", {
463
+ /* @__PURE__ */ E("span", {
452
464
  className: "mt-1 inline-block rounded-full bg-[var(--color-accent-soft)] px-1.5 py-0.5 text-[10px] font-medium text-text-primary",
453
465
  children: t("healthybowl.irrigation.everyNShort", "every {{n}}d", { n: String(e.frequencyDays) })
454
466
  })
@@ -459,53 +471,53 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
459
471
  })
460
472
  })]
461
473
  }),
462
- /* @__PURE__ */ E("section", {
474
+ /* @__PURE__ */ D("section", {
463
475
  className: "space-y-3",
464
- children: [/* @__PURE__ */ E("div", {
476
+ children: [/* @__PURE__ */ D("div", {
465
477
  className: "flex items-center gap-2",
466
- children: [/* @__PURE__ */ T(v, { className: "h-5 w-5 text-text-secondary" }), /* @__PURE__ */ T("h2", {
478
+ children: [/* @__PURE__ */ E(y, { className: "h-5 w-5 text-text-secondary" }), /* @__PURE__ */ E("h2", {
467
479
  className: "text-lg font-semibold text-text-primary",
468
480
  children: t("healthybowl.irrigation.table.heading", "Water Schedule")
469
481
  })]
470
- }), /* @__PURE__ */ T(a, {
471
- columns: Qe,
472
- data: y,
482
+ }), /* @__PURE__ */ E(a, {
483
+ columns: $e,
484
+ data: b,
473
485
  keyField: "id"
474
486
  })]
475
487
  }),
476
- /* @__PURE__ */ E("div", {
488
+ /* @__PURE__ */ D("div", {
477
489
  className: "grid grid-cols-1 gap-6 lg:grid-cols-2",
478
- children: [/* @__PURE__ */ T(_e, {
479
- schedules: y,
490
+ children: [/* @__PURE__ */ E(ve, {
491
+ schedules: b,
480
492
  fieldName: z
481
- }), /* @__PURE__ */ E(ee, {
493
+ }), /* @__PURE__ */ D(ee, {
482
494
  title: t("healthybowl.irrigation.usage.title", "Weekly Water Usage"),
483
495
  description: t("healthybowl.irrigation.usage.description", "Litres logged over the last 7 days"),
484
- children: [S.length === 0 ? /* @__PURE__ */ E("div", {
496
+ children: [C.length === 0 ? /* @__PURE__ */ D("div", {
485
497
  className: "flex h-[240px] flex-col items-center justify-center gap-2 text-center",
486
498
  children: [
487
- /* @__PURE__ */ T(_, { className: "h-8 w-8 text-text-secondary" }),
488
- /* @__PURE__ */ T("p", {
499
+ /* @__PURE__ */ E(v, { className: "h-8 w-8 text-text-secondary" }),
500
+ /* @__PURE__ */ E("p", {
489
501
  className: "text-sm text-text-secondary",
490
502
  children: t("healthybowl.irrigation.usage.empty", "No watering runs logged yet.")
491
503
  }),
492
- /* @__PURE__ */ E(D, {
504
+ /* @__PURE__ */ D(O, {
493
505
  variant: "outline",
494
506
  size: "sm",
495
- onClick: Ye,
507
+ onClick: Xe,
496
508
  className: "mt-1",
497
509
  children: [
498
- /* @__PURE__ */ T(_, { className: "h-4 w-4" }),
510
+ /* @__PURE__ */ E(v, { className: "h-4 w-4" }),
499
511
  " ",
500
512
  t("healthybowl.irrigation.actions.logRun", "Log Watering Run")
501
513
  ]
502
514
  })
503
515
  ]
504
- }) : /* @__PURE__ */ T(se, {
516
+ }) : /* @__PURE__ */ E(l, {
505
517
  width: "100%",
506
518
  height: 240,
507
- children: /* @__PURE__ */ E(f, {
508
- data: Ie,
519
+ children: /* @__PURE__ */ D(p, {
520
+ data: Le,
509
521
  margin: {
510
522
  top: 5,
511
523
  right: 12,
@@ -513,38 +525,38 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
513
525
  bottom: 5
514
526
  },
515
527
  children: [
516
- /* @__PURE__ */ T("defs", { children: /* @__PURE__ */ E("linearGradient", {
528
+ /* @__PURE__ */ E("defs", { children: /* @__PURE__ */ D("linearGradient", {
517
529
  id: "waterGrad",
518
530
  x1: "0",
519
531
  y1: "0",
520
532
  x2: "0",
521
533
  y2: "1",
522
- children: [/* @__PURE__ */ T("stop", {
534
+ children: [/* @__PURE__ */ E("stop", {
523
535
  offset: "5%",
524
536
  stopColor: "var(--color-info, #38bdf8)",
525
537
  stopOpacity: .35
526
- }), /* @__PURE__ */ T("stop", {
538
+ }), /* @__PURE__ */ E("stop", {
527
539
  offset: "95%",
528
540
  stopColor: "var(--color-info, #38bdf8)",
529
541
  stopOpacity: 0
530
542
  })]
531
543
  }) }),
532
- /* @__PURE__ */ T(l, {
544
+ /* @__PURE__ */ E(u, {
533
545
  strokeDasharray: "3 3",
534
546
  className: "stroke-border"
535
547
  }),
536
- /* @__PURE__ */ T(ce, {
548
+ /* @__PURE__ */ E(d, {
537
549
  dataKey: "day",
538
550
  className: "text-xs",
539
551
  tick: { fill: "currentColor" }
540
552
  }),
541
- /* @__PURE__ */ T(d, {
553
+ /* @__PURE__ */ E(f, {
542
554
  className: "text-xs",
543
555
  tick: { fill: "currentColor" },
544
556
  tickFormatter: (e) => `${e}L`,
545
557
  width: 44
546
558
  }),
547
- /* @__PURE__ */ T(oe, {
559
+ /* @__PURE__ */ E(se, {
548
560
  formatter: (e) => [`${e} L`, t("healthybowl.irrigation.usage.series", "Water")],
549
561
  contentStyle: {
550
562
  backgroundColor: "var(--color-card)",
@@ -553,7 +565,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
553
565
  },
554
566
  labelStyle: { color: "var(--color-foreground)" }
555
567
  }),
556
- /* @__PURE__ */ T(u, {
568
+ /* @__PURE__ */ E(ce, {
557
569
  type: "monotone",
558
570
  dataKey: "litres",
559
571
  name: t("healthybowl.irrigation.usage.series", "Water"),
@@ -563,97 +575,97 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
563
575
  })
564
576
  ]
565
577
  })
566
- }), S.length > 0 && /* @__PURE__ */ T("p", {
578
+ }), C.length > 0 && /* @__PURE__ */ E("p", {
567
579
  className: "mt-2 text-center text-[11px] text-text-secondary",
568
- children: t("healthybowl.irrigation.usage.peak", "Peak day: {{n}} L", { n: String(et) })
580
+ children: t("healthybowl.irrigation.usage.peak", "Peak day: {{n}} L", { n: String(tt) })
569
581
  })]
570
582
  })]
571
583
  })
572
584
  ] })]
573
585
  }),
574
- /* @__PURE__ */ T(c, {
575
- open: Re,
586
+ /* @__PURE__ */ E(c, {
587
+ open: ze,
576
588
  onClose: Y,
577
589
  title: W ? t("healthybowl.irrigation.schedule.modal.editTitle", "Edit Irrigation Schedule") : t("healthybowl.irrigation.schedule.modal.title", "New Irrigation Schedule"),
578
590
  description: t("healthybowl.irrigation.schedule.modal.description", "Set the field, method, cadence, duration and daily start time."),
579
591
  size: "md",
580
- footer: /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(D, {
592
+ footer: /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(O, {
581
593
  variant: "outline",
582
594
  onClick: Y,
583
595
  children: t("healthybowl.common.cancel", "Cancel")
584
- }), /* @__PURE__ */ T(D, {
585
- onClick: Ue,
586
- disabled: ze,
587
- children: ze ? t("healthybowl.irrigation.actions.saving", "Saving...") : W ? t("healthybowl.common.saveChanges", "Save Changes") : t("healthybowl.irrigation.actions.addSchedule", "Add Schedule")
596
+ }), /* @__PURE__ */ E(O, {
597
+ onClick: We,
598
+ disabled: Be,
599
+ children: Be ? t("healthybowl.irrigation.actions.saving", "Saving...") : W ? t("healthybowl.common.saveChanges", "Save Changes") : t("healthybowl.irrigation.actions.addSchedule", "Add Schedule")
588
600
  })] }),
589
- children: /* @__PURE__ */ E("div", {
601
+ children: /* @__PURE__ */ D("div", {
590
602
  className: "space-y-4",
591
603
  children: [
592
- /* @__PURE__ */ E("div", {
604
+ /* @__PURE__ */ D("div", {
593
605
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
594
- children: [/* @__PURE__ */ E("div", { children: [
595
- /* @__PURE__ */ T("label", {
606
+ children: [/* @__PURE__ */ D("div", { children: [
607
+ /* @__PURE__ */ E("label", {
596
608
  htmlFor: "irr-field",
597
609
  className: "mb-1 block text-sm font-medium text-text-primary",
598
610
  children: t("healthybowl.irrigation.form.field.label", "Field *")
599
611
  }),
600
- /* @__PURE__ */ E("select", {
612
+ /* @__PURE__ */ D("select", {
601
613
  id: "irr-field",
602
614
  value: K.fieldId,
603
615
  onChange: (e) => J("fieldId", e.target.value),
604
- className: O,
605
- children: [/* @__PURE__ */ T("option", {
616
+ className: k,
617
+ children: [/* @__PURE__ */ E("option", {
606
618
  value: "",
607
619
  children: t("healthybowl.irrigation.form.field.placeholder", "Select a field")
608
- }), I.map((e) => /* @__PURE__ */ T("option", {
620
+ }), I.map((e) => /* @__PURE__ */ E("option", {
609
621
  value: e.id,
610
622
  children: e.name
611
623
  }, e.id))]
612
624
  }),
613
- I.length === 0 && /* @__PURE__ */ T("p", {
625
+ I.length === 0 && /* @__PURE__ */ E("p", {
614
626
  className: "mt-1 text-xs text-status-warning-text",
615
627
  children: t("healthybowl.irrigation.form.field.none", "No fields found. Add a field first.")
616
628
  })
617
- ] }), /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
629
+ ] }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
618
630
  htmlFor: "irr-crop",
619
631
  className: "mb-1 block text-sm font-medium text-text-primary",
620
632
  children: t("healthybowl.irrigation.form.crop.label", "Crop")
621
- }), /* @__PURE__ */ E("select", {
633
+ }), /* @__PURE__ */ D("select", {
622
634
  id: "irr-crop",
623
635
  value: K.cropId,
624
636
  onChange: (e) => J("cropId", e.target.value),
625
- className: O,
626
- children: [/* @__PURE__ */ T("option", {
637
+ className: k,
638
+ children: [/* @__PURE__ */ E("option", {
627
639
  value: "",
628
640
  children: t("healthybowl.irrigation.form.crop.placeholder", "Any / none")
629
- }), L.map((e) => /* @__PURE__ */ T("option", {
641
+ }), L.map((e) => /* @__PURE__ */ E("option", {
630
642
  value: e.id,
631
643
  children: e.name
632
644
  }, e.id))]
633
645
  })] })]
634
646
  }),
635
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
647
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
636
648
  htmlFor: "irr-method",
637
649
  className: "mb-1 block text-sm font-medium text-text-primary",
638
650
  children: t("healthybowl.irrigation.form.method.label", "Method *")
639
- }), /* @__PURE__ */ T("select", {
651
+ }), /* @__PURE__ */ E("select", {
640
652
  id: "irr-method",
641
653
  value: K.method,
642
654
  onChange: (e) => J("method", e.target.value),
643
- className: O,
644
- children: k.map((e) => /* @__PURE__ */ T("option", {
655
+ className: k,
656
+ children: A.map((e) => /* @__PURE__ */ E("option", {
645
657
  value: e,
646
658
  children: B(e)
647
659
  }, e))
648
660
  })] }),
649
- /* @__PURE__ */ E("div", {
661
+ /* @__PURE__ */ D("div", {
650
662
  className: "grid grid-cols-1 gap-4 sm:grid-cols-3",
651
663
  children: [
652
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
664
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
653
665
  htmlFor: "irr-freq",
654
666
  className: "mb-1 block text-sm font-medium text-text-primary",
655
667
  children: t("healthybowl.irrigation.form.frequency.label", "Frequency (days) *")
656
- }), /* @__PURE__ */ T("input", {
668
+ }), /* @__PURE__ */ E("input", {
657
669
  id: "irr-freq",
658
670
  type: "number",
659
671
  min: "1",
@@ -661,13 +673,13 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
661
673
  value: K.frequencyDays,
662
674
  onChange: (e) => J("frequencyDays", e.target.value),
663
675
  placeholder: "1",
664
- className: O
676
+ className: k
665
677
  })] }),
666
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
678
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
667
679
  htmlFor: "irr-duration",
668
680
  className: "mb-1 block text-sm font-medium text-text-primary",
669
681
  children: t("healthybowl.irrigation.form.duration.label", "Duration (min) *")
670
- }), /* @__PURE__ */ T("input", {
682
+ }), /* @__PURE__ */ E("input", {
671
683
  id: "irr-duration",
672
684
  type: "number",
673
685
  min: "1",
@@ -675,34 +687,34 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
675
687
  value: K.durationMin,
676
688
  onChange: (e) => J("durationMin", e.target.value),
677
689
  placeholder: "30",
678
- className: O
690
+ className: k
679
691
  })] }),
680
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
692
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
681
693
  htmlFor: "irr-start",
682
694
  className: "mb-1 block text-sm font-medium text-text-primary",
683
695
  children: t("healthybowl.irrigation.form.startTime.label", "Start Time *")
684
- }), /* @__PURE__ */ T("input", {
696
+ }), /* @__PURE__ */ E("input", {
685
697
  id: "irr-start",
686
698
  type: "time",
687
699
  value: K.startTime,
688
700
  onChange: (e) => J("startTime", e.target.value),
689
- className: O
701
+ className: k
690
702
  })] })
691
703
  ]
692
704
  }),
693
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
705
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
694
706
  htmlFor: "irr-status",
695
707
  className: "mb-1 block text-sm font-medium text-text-primary",
696
708
  children: t("healthybowl.irrigation.form.status.label", "Status")
697
- }), /* @__PURE__ */ E("select", {
709
+ }), /* @__PURE__ */ D("select", {
698
710
  id: "irr-status",
699
711
  value: K.status,
700
712
  onChange: (e) => J("status", e.target.value),
701
- className: O,
702
- children: [/* @__PURE__ */ T("option", {
713
+ className: k,
714
+ children: [/* @__PURE__ */ E("option", {
703
715
  value: "active",
704
716
  children: t("healthybowl.irrigation.status.active", "Active")
705
- }), /* @__PURE__ */ T("option", {
717
+ }), /* @__PURE__ */ E("option", {
706
718
  value: "paused",
707
719
  children: t("healthybowl.irrigation.status.paused", "Paused")
708
720
  })]
@@ -710,56 +722,56 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
710
722
  ]
711
723
  })
712
724
  }),
713
- /* @__PURE__ */ T(c, {
714
- open: Ke,
725
+ /* @__PURE__ */ E(c, {
726
+ open: qe,
715
727
  onClose: () => X(!1),
716
728
  title: t("healthybowl.irrigation.run.modal.title", "Log Watering Run"),
717
729
  description: t("healthybowl.irrigation.run.modal.description", "Record a watering that took place — this feeds the usage totals."),
718
730
  size: "md",
719
- footer: /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(D, {
731
+ footer: /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(O, {
720
732
  variant: "outline",
721
733
  onClick: () => X(!1),
722
734
  children: t("healthybowl.common.cancel", "Cancel")
723
- }), /* @__PURE__ */ T(D, {
724
- onClick: Ze,
725
- disabled: qe,
726
- children: qe ? t("healthybowl.irrigation.actions.saving", "Saving...") : t("healthybowl.irrigation.run.actions.log", "Log Run")
735
+ }), /* @__PURE__ */ E(O, {
736
+ onClick: Qe,
737
+ disabled: Je,
738
+ children: Je ? t("healthybowl.irrigation.actions.saving", "Saving...") : t("healthybowl.irrigation.run.actions.log", "Log Run")
727
739
  })] }),
728
- children: /* @__PURE__ */ E("div", {
740
+ children: /* @__PURE__ */ D("div", {
729
741
  className: "space-y-4",
730
742
  children: [
731
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
743
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
732
744
  htmlFor: "run-field",
733
745
  className: "mb-1 block text-sm font-medium text-text-primary",
734
746
  children: t("healthybowl.irrigation.run.form.field.label", "Field *")
735
- }), /* @__PURE__ */ E("select", {
747
+ }), /* @__PURE__ */ D("select", {
736
748
  id: "run-field",
737
749
  value: Z.fieldId,
738
750
  onChange: (e) => {
739
751
  $("fieldId", e.target.value), $("scheduleId", "");
740
752
  },
741
- className: O,
742
- children: [/* @__PURE__ */ T("option", {
753
+ className: k,
754
+ children: [/* @__PURE__ */ E("option", {
743
755
  value: "",
744
756
  children: t("healthybowl.irrigation.run.form.field.placeholder", "Select a field")
745
- }), I.map((e) => /* @__PURE__ */ T("option", {
757
+ }), I.map((e) => /* @__PURE__ */ E("option", {
746
758
  value: e.id,
747
759
  children: e.name
748
760
  }, e.id))]
749
761
  })] }),
750
- Xe.length > 0 && /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
762
+ Ze.length > 0 && /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
751
763
  htmlFor: "run-schedule",
752
764
  className: "mb-1 block text-sm font-medium text-text-primary",
753
765
  children: t("healthybowl.irrigation.run.form.schedule.label", "Against Schedule")
754
- }), /* @__PURE__ */ E("select", {
766
+ }), /* @__PURE__ */ D("select", {
755
767
  id: "run-schedule",
756
768
  value: Z.scheduleId,
757
769
  onChange: (e) => $("scheduleId", e.target.value),
758
- className: O,
759
- children: [/* @__PURE__ */ T("option", {
770
+ className: k,
771
+ children: [/* @__PURE__ */ E("option", {
760
772
  value: "",
761
773
  children: t("healthybowl.irrigation.run.form.schedule.placeholder", "None (ad-hoc)")
762
- }), Xe.map((e) => /* @__PURE__ */ E("option", {
774
+ }), Ze.map((e) => /* @__PURE__ */ D("option", {
763
775
  value: e.id,
764
776
  children: [
765
777
  B(e.method),
@@ -768,46 +780,46 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
768
780
  " ·",
769
781
  " ",
770
782
  t("healthybowl.irrigation.everyNShort", "every {{n}}d", { n: String(e.frequencyDays) }),
771
- Le.get(e.id) ? ` (${Le.get(e.id)})` : ""
783
+ Re.get(e.id) ? ` (${Re.get(e.id)})` : ""
772
784
  ]
773
785
  }, e.id))]
774
786
  })] }),
775
- /* @__PURE__ */ E("div", {
787
+ /* @__PURE__ */ D("div", {
776
788
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2",
777
- children: [/* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
789
+ children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
778
790
  htmlFor: "run-status",
779
791
  className: "mb-1 block text-sm font-medium text-text-primary",
780
792
  children: t("healthybowl.irrigation.run.form.status.label", "Outcome")
781
- }), /* @__PURE__ */ E("select", {
793
+ }), /* @__PURE__ */ D("select", {
782
794
  id: "run-status",
783
795
  value: Z.status,
784
796
  onChange: (e) => $("status", e.target.value),
785
- className: O,
786
- children: [/* @__PURE__ */ T("option", {
797
+ className: k,
798
+ children: [/* @__PURE__ */ E("option", {
787
799
  value: "ran",
788
800
  children: t("healthybowl.irrigation.run.status.ran", "Ran")
789
- }), /* @__PURE__ */ T("option", {
801
+ }), /* @__PURE__ */ E("option", {
790
802
  value: "skipped",
791
803
  children: t("healthybowl.irrigation.run.status.skipped", "Skipped")
792
804
  })]
793
- })] }), /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
805
+ })] }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
794
806
  htmlFor: "run-date",
795
807
  className: "mb-1 block text-sm font-medium text-text-primary",
796
808
  children: t("healthybowl.irrigation.run.form.date.label", "Date")
797
- }), /* @__PURE__ */ T("input", {
809
+ }), /* @__PURE__ */ E("input", {
798
810
  id: "run-date",
799
811
  type: "date",
800
812
  max: n(),
801
813
  value: Z.date,
802
814
  onChange: (e) => $("date", e.target.value),
803
- className: O
815
+ className: k
804
816
  })] })]
805
817
  }),
806
- Z.status === "ran" ? /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
818
+ Z.status === "ran" ? /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
807
819
  htmlFor: "run-litres",
808
820
  className: "mb-1 block text-sm font-medium text-text-primary",
809
821
  children: t("healthybowl.irrigation.run.form.litres.label", "Litres Used")
810
- }), /* @__PURE__ */ T("input", {
822
+ }), /* @__PURE__ */ E("input", {
811
823
  id: "run-litres",
812
824
  type: "number",
813
825
  min: "0",
@@ -815,25 +827,25 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
815
827
  value: Z.litres,
816
828
  onChange: (e) => $("litres", e.target.value),
817
829
  placeholder: "500",
818
- className: O
819
- })] }) : /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
830
+ className: k
831
+ })] }) : /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
820
832
  htmlFor: "run-reason",
821
833
  className: "mb-1 block text-sm font-medium text-text-primary",
822
834
  children: t("healthybowl.irrigation.run.form.reason.label", "Skip Reason")
823
- }), /* @__PURE__ */ T("input", {
835
+ }), /* @__PURE__ */ E("input", {
824
836
  id: "run-reason",
825
837
  type: "text",
826
838
  value: Z.skippedReason,
827
839
  onChange: (e) => $("skippedReason", e.target.value),
828
840
  placeholder: t("healthybowl.irrigation.run.form.reason.placeholder", "e.g., Rainfall — soil already wet"),
829
- className: O
841
+ className: k
830
842
  })] })
831
843
  ]
832
844
  })
833
845
  }),
834
- /* @__PURE__ */ T(te, {
835
- toasts: Te,
836
- onDismiss: Ee
846
+ /* @__PURE__ */ E(te, {
847
+ toasts: Ee,
848
+ onDismiss: De
837
849
  })
838
850
  ]
839
851
  });
@@ -842,20 +854,21 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
842
854
  soilThresholdPct: "30",
843
855
  skipIfRain: !0,
844
856
  rainProbThreshold: "50",
845
- notifyInApp: !0
846
- }, _e = ({ schedules: e, fieldName: n }) => {
847
- let { t: r } = ue(), i = ne(), { toast: a } = ie(), { automations: s, loading: te, createAutomation: re, updateAutomation: ae, deleteAutomation: oe, runAutomation: se } = le(), l = m(() => new Map(e.map((e) => [e.id, e])), [e]), u = (e) => e ? r(`healthybowl.irrigation.method.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase()) : r("healthybowl.irrigation.automation.unknownMethod", "Schedule"), [ce, d] = h(!1), [f, p] = h(F), [g, _] = h(!1), [v, b] = h(null), C = (e, t) => p((n) => ({
857
+ notifyInApp: !0,
858
+ autoTaskEnabled: !1
859
+ }, ve = ({ schedules: e, fieldName: n }) => {
860
+ let { t: r } = ue(), i = ne(), { toast: a } = ie(), { automations: s, loading: te, createAutomation: re, updateAutomation: ae, deleteAutomation: oe, runAutomation: se } = le(), l = h(() => new Map(e.map((e) => [e.id, e])), [e]), u = (e) => e ? r(`healthybowl.irrigation.method.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase()) : r("healthybowl.irrigation.automation.unknownMethod", "Schedule"), [ce, d] = g(!1), [f, p] = g(F), [m, _] = g(!1), [v, y] = g(null), x = (e, t) => p((n) => ({
848
861
  ...n,
849
862
  [e]: t
850
- })), k = () => {
863
+ })), w = () => {
851
864
  p({
852
865
  ...F,
853
866
  scheduleId: e[0]?.id ?? ""
854
867
  }), d(!0);
855
868
  }, A = () => {
856
869
  p(F), d(!1);
857
- }, ge = async () => {
858
- let e = j(f.soilThresholdPct);
870
+ }, j = async () => {
871
+ let e = M(f.soilThresholdPct);
859
872
  if (!f.scheduleId || e === void 0) {
860
873
  a({
861
874
  title: r("healthybowl.irrigation.automation.toast.required.title", "Missing required fields"),
@@ -868,8 +881,9 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
868
881
  scheduleId: f.scheduleId,
869
882
  soilThresholdPct: e,
870
883
  skipIfRain: f.skipIfRain,
871
- rainProbThreshold: f.skipIfRain ? j(f.rainProbThreshold) : void 0,
884
+ rainProbThreshold: f.skipIfRain ? M(f.rainProbThreshold) : void 0,
872
885
  notifyInApp: f.notifyInApp,
886
+ autoTaskEnabled: f.autoTaskEnabled,
873
887
  status: "active"
874
888
  };
875
889
  _(!0);
@@ -887,7 +901,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
887
901
  } finally {
888
902
  _(!1);
889
903
  }
890
- }, M = async (e) => {
904
+ }, ge = async (e) => {
891
905
  let t = e.status === "active" ? "paused" : "active";
892
906
  try {
893
907
  await ae(e.id, { status: t }), a({
@@ -915,7 +929,7 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
915
929
  });
916
930
  }
917
931
  }, P = async (e) => {
918
- b(e.id);
932
+ y(e.id);
919
933
  try {
920
934
  let t = await se(e.id);
921
935
  if (!t) {
@@ -938,167 +952,168 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
938
952
  variant: "error"
939
953
  });
940
954
  } finally {
941
- b(null);
955
+ y(null);
942
956
  }
943
957
  };
944
- return /* @__PURE__ */ E(ee, {
958
+ return /* @__PURE__ */ D(ee, {
945
959
  title: r("healthybowl.irrigation.automation.title", "Automation Rules"),
946
960
  description: r("healthybowl.irrigation.automation.rules.description", "Auto-irrigate when soil runs dry"),
947
- actions: /* @__PURE__ */ E("div", {
961
+ actions: /* @__PURE__ */ D("div", {
948
962
  className: "flex items-center gap-2",
949
- children: [/* @__PURE__ */ E("span", {
963
+ children: [/* @__PURE__ */ D("span", {
950
964
  className: "inline-flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken px-2 py-0.5 text-[11px] font-medium text-text-secondary",
951
965
  children: [
952
- /* @__PURE__ */ T(de, { className: "h-3 w-3" }),
966
+ /* @__PURE__ */ E(de, { className: "h-3 w-3" }),
953
967
  " ",
954
968
  r("healthybowl.irrigation.automation.poweredBy", "Powered by FluidGrids")
955
969
  ]
956
- }), /* @__PURE__ */ E(D, {
970
+ }), /* @__PURE__ */ D(O, {
957
971
  size: "sm",
958
- onClick: k,
972
+ onClick: w,
959
973
  disabled: e.length === 0,
960
974
  children: [
961
- /* @__PURE__ */ T(x, { className: "h-4 w-4" }),
975
+ /* @__PURE__ */ E(S, { className: "h-4 w-4" }),
962
976
  " ",
963
977
  r("healthybowl.irrigation.automation.actions.newRule", "New Rule")
964
978
  ]
965
979
  })]
966
980
  }),
967
- children: [s.length === 0 ? /* @__PURE__ */ E("div", {
981
+ children: [s.length === 0 ? /* @__PURE__ */ D("div", {
968
982
  className: "flex flex-col items-center justify-center gap-2 py-10 text-center",
969
983
  children: [
970
- /* @__PURE__ */ T("span", {
984
+ /* @__PURE__ */ E("span", {
971
985
  className: "flex h-10 w-10 items-center justify-center rounded-full bg-[var(--color-accent-soft)] text-text-primary",
972
- children: /* @__PURE__ */ T(he, { className: "h-5 w-5" })
986
+ children: /* @__PURE__ */ E(he, { className: "h-5 w-5" })
973
987
  }),
974
- /* @__PURE__ */ T("p", {
988
+ /* @__PURE__ */ E("p", {
975
989
  className: "text-sm font-medium text-text-primary",
976
990
  children: r("healthybowl.irrigation.automation.empty.title", "No automation rules yet")
977
991
  }),
978
- /* @__PURE__ */ T("p", {
992
+ /* @__PURE__ */ E("p", {
979
993
  className: "max-w-xs text-xs text-text-secondary",
980
994
  children: e.length === 0 ? r("healthybowl.irrigation.automation.empty.needSchedule", "Add an irrigation schedule first, then automate it.") : r("healthybowl.irrigation.automation.empty.description", "Create a rule to water automatically when soil moisture drops below a threshold.")
981
995
  }),
982
- e.length > 0 && /* @__PURE__ */ E(D, {
996
+ e.length > 0 && /* @__PURE__ */ D(O, {
983
997
  size: "sm",
984
- onClick: k,
998
+ onClick: w,
985
999
  className: "mt-1",
986
1000
  children: [
987
- /* @__PURE__ */ T(x, { className: "h-4 w-4" }),
1001
+ /* @__PURE__ */ E(S, { className: "h-4 w-4" }),
988
1002
  " ",
989
1003
  r("healthybowl.irrigation.automation.actions.newRule", "New Rule")
990
1004
  ]
991
1005
  })
992
1006
  ]
993
- }) : /* @__PURE__ */ E("div", {
1007
+ }) : /* @__PURE__ */ D("div", {
994
1008
  className: "space-y-3",
995
1009
  children: [s.map((e) => {
996
1010
  let i = l.get(e.scheduleId), a = e.status === "active", s = v === e.id;
997
- return /* @__PURE__ */ T("div", {
1011
+ return /* @__PURE__ */ E("div", {
998
1012
  className: "rounded-lg border border-border-seam bg-bg-sunken/30 p-3",
999
- children: /* @__PURE__ */ E("div", {
1013
+ children: /* @__PURE__ */ D("div", {
1000
1014
  className: "flex flex-wrap items-start justify-between gap-3",
1001
- children: [/* @__PURE__ */ E("div", {
1015
+ children: [/* @__PURE__ */ D("div", {
1002
1016
  className: "min-w-0",
1003
1017
  children: [
1004
- /* @__PURE__ */ E("p", {
1018
+ /* @__PURE__ */ D("p", {
1005
1019
  className: "flex items-center gap-2 text-sm font-medium text-text-primary",
1006
1020
  children: [
1007
1021
  n(i?.fieldId),
1008
- /* @__PURE__ */ T(o, {
1022
+ /* @__PURE__ */ E(o, {
1009
1023
  label: u(i?.method),
1010
1024
  variant: "info"
1011
1025
  }),
1012
- /* @__PURE__ */ T(o, {
1026
+ /* @__PURE__ */ E(o, {
1013
1027
  label: a ? r("healthybowl.irrigation.status.active", "Active") : r("healthybowl.irrigation.status.paused", "Paused"),
1014
1028
  variant: a ? "success" : "muted",
1015
1029
  dot: a
1016
1030
  })
1017
1031
  ]
1018
1032
  }),
1019
- /* @__PURE__ */ E("p", {
1033
+ /* @__PURE__ */ D("p", {
1020
1034
  className: "mt-1 text-xs text-text-secondary",
1021
1035
  children: [
1022
1036
  r("healthybowl.irrigation.automation.rule.threshold", "Water below {{n}}% soil moisture", { n: String(e.soilThresholdPct) }),
1023
1037
  e.skipIfRain ? ` · ${r("healthybowl.irrigation.automation.rule.skipRain", "skip if rain > {{n}}%", { n: String(e.rainProbThreshold ?? 50) })}` : "",
1024
- e.notifyInApp ? ` · ${r("healthybowl.irrigation.automation.rule.notify", "notify in-app")}` : ""
1038
+ e.notifyInApp ? ` · ${r("healthybowl.irrigation.automation.rule.notify", "notify in-app")}` : "",
1039
+ e.autoTaskEnabled ? ` · ${r("healthybowl.irrigation.automation.rule.autoTask", "create a task")}` : ""
1025
1040
  ]
1026
1041
  }),
1027
- /* @__PURE__ */ T("p", {
1042
+ /* @__PURE__ */ E("p", {
1028
1043
  className: "mt-1 text-[11px] text-text-secondary",
1029
1044
  children: e.lastEvaluatedAt ? r("healthybowl.irrigation.automation.rule.lastRun", "Last run: {{outcome}} · {{when}}", {
1030
1045
  outcome: e.lastOutcome ?? r("healthybowl.irrigation.automation.rule.noOutcome", "evaluated"),
1031
1046
  when: t(e.lastEvaluatedAt)
1032
1047
  }) : r("healthybowl.irrigation.automation.rule.neverRun", "Not evaluated yet")
1033
1048
  }),
1034
- !e.workflowKey && /* @__PURE__ */ T("p", {
1049
+ !e.workflowKey && /* @__PURE__ */ E("p", {
1035
1050
  className: "mt-1 inline-flex items-center gap-1 rounded-md border border-dashed border-border-subtle bg-bg-surface px-2 py-0.5 text-[10px] text-text-secondary",
1036
1051
  children: r("healthybowl.irrigation.automation.rule.notProvisioned", "Workflow not provisioned yet")
1037
1052
  })
1038
1053
  ]
1039
- }), /* @__PURE__ */ E("div", {
1054
+ }), /* @__PURE__ */ D("div", {
1040
1055
  className: "flex shrink-0 items-center gap-2",
1041
1056
  children: [
1042
- /* @__PURE__ */ E(D, {
1057
+ /* @__PURE__ */ D(O, {
1043
1058
  size: "sm",
1044
1059
  onClick: () => void P(e),
1045
1060
  disabled: s,
1046
- children: [s ? /* @__PURE__ */ T(y, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ T(S, { className: "h-4 w-4" }), r("healthybowl.irrigation.automation.actions.runNow", "Run now")]
1061
+ children: [s ? /* @__PURE__ */ E(b, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ E(C, { className: "h-4 w-4" }), r("healthybowl.irrigation.automation.actions.runNow", "Run now")]
1047
1062
  }),
1048
- /* @__PURE__ */ T(D, {
1063
+ /* @__PURE__ */ E(O, {
1049
1064
  variant: "outline",
1050
1065
  size: "icon-sm",
1051
- onClick: () => void M(e),
1066
+ onClick: () => void ge(e),
1052
1067
  "aria-label": a ? r("healthybowl.irrigation.actions.pause", "Pause schedule") : r("healthybowl.irrigation.actions.resume", "Resume schedule"),
1053
- children: T(a ? fe : pe, { className: "h-4 w-4" })
1068
+ children: E(a ? fe : pe, { className: "h-4 w-4" })
1054
1069
  }),
1055
- /* @__PURE__ */ T(D, {
1070
+ /* @__PURE__ */ E(O, {
1056
1071
  variant: "ghost",
1057
1072
  size: "icon-sm",
1058
1073
  onClick: () => void N(e),
1059
1074
  "aria-label": r("healthybowl.common.delete", "Delete"),
1060
1075
  className: "text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text",
1061
- children: /* @__PURE__ */ T(me, { className: "h-4 w-4" })
1076
+ children: /* @__PURE__ */ E(me, { className: "h-4 w-4" })
1062
1077
  })
1063
1078
  ]
1064
1079
  })]
1065
1080
  })
1066
1081
  }, e.id);
1067
- }), te && /* @__PURE__ */ T("p", {
1082
+ }), te && /* @__PURE__ */ E("p", {
1068
1083
  className: "text-center text-[11px] text-text-secondary",
1069
1084
  children: r("healthybowl.irrigation.automation.refreshing", "Refreshing…")
1070
1085
  })]
1071
- }), /* @__PURE__ */ T(c, {
1086
+ }), /* @__PURE__ */ E(c, {
1072
1087
  open: ce,
1073
1088
  onClose: A,
1074
1089
  title: r("healthybowl.irrigation.automation.modal.title", "New Automation Rule"),
1075
1090
  description: r("healthybowl.irrigation.automation.modal.description", "Automatically run an irrigation schedule when soil moisture drops."),
1076
1091
  size: "md",
1077
- footer: /* @__PURE__ */ E(w, { children: [/* @__PURE__ */ T(D, {
1092
+ footer: /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E(O, {
1078
1093
  variant: "outline",
1079
1094
  onClick: A,
1080
1095
  children: r("healthybowl.common.cancel", "Cancel")
1081
- }), /* @__PURE__ */ T(D, {
1082
- onClick: ge,
1083
- disabled: g,
1084
- children: g ? r("healthybowl.irrigation.actions.saving", "Saving...") : r("healthybowl.irrigation.automation.actions.createRule", "Create Rule")
1096
+ }), /* @__PURE__ */ E(O, {
1097
+ onClick: j,
1098
+ disabled: m,
1099
+ children: m ? r("healthybowl.irrigation.actions.saving", "Saving...") : r("healthybowl.irrigation.automation.actions.createRule", "Create Rule")
1085
1100
  })] }),
1086
- children: /* @__PURE__ */ E("div", {
1101
+ children: /* @__PURE__ */ D("div", {
1087
1102
  className: "space-y-4",
1088
1103
  children: [
1089
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
1104
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
1090
1105
  htmlFor: "auto-schedule",
1091
1106
  className: "mb-1 block text-sm font-medium text-text-primary",
1092
1107
  children: r("healthybowl.irrigation.automation.form.schedule.label", "Schedule *")
1093
- }), /* @__PURE__ */ E("select", {
1108
+ }), /* @__PURE__ */ D("select", {
1094
1109
  id: "auto-schedule",
1095
1110
  value: f.scheduleId,
1096
- onChange: (e) => C("scheduleId", e.target.value),
1097
- className: O,
1098
- children: [/* @__PURE__ */ T("option", {
1111
+ onChange: (e) => x("scheduleId", e.target.value),
1112
+ className: k,
1113
+ children: [/* @__PURE__ */ E("option", {
1099
1114
  value: "",
1100
1115
  children: r("healthybowl.irrigation.automation.form.schedule.placeholder", "Select a schedule")
1101
- }), e.map((e) => /* @__PURE__ */ E("option", {
1116
+ }), e.map((e) => /* @__PURE__ */ D("option", {
1102
1117
  value: e.id,
1103
1118
  children: [
1104
1119
  n(e.fieldId),
@@ -1110,57 +1125,73 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
1110
1125
  ]
1111
1126
  }, e.id))]
1112
1127
  })] }),
1113
- /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
1128
+ /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
1114
1129
  htmlFor: "auto-soil",
1115
1130
  className: "mb-1 block text-sm font-medium text-text-primary",
1116
1131
  children: r("healthybowl.irrigation.automation.form.soil.label", "Soil Moisture Threshold (%) *")
1117
- }), /* @__PURE__ */ T("input", {
1132
+ }), /* @__PURE__ */ E("input", {
1118
1133
  id: "auto-soil",
1119
1134
  type: "number",
1120
1135
  min: "0",
1121
1136
  max: "100",
1122
1137
  step: "1",
1123
1138
  value: f.soilThresholdPct,
1124
- onChange: (e) => C("soilThresholdPct", e.target.value),
1139
+ onChange: (e) => x("soilThresholdPct", e.target.value),
1125
1140
  placeholder: "30",
1126
- className: O
1141
+ className: k
1127
1142
  })] }),
1128
- /* @__PURE__ */ E("label", {
1143
+ /* @__PURE__ */ D("label", {
1129
1144
  className: "flex items-center justify-between gap-3 rounded-md border border-border-subtle bg-bg-surface px-3 py-2",
1130
- children: [/* @__PURE__ */ T("span", {
1145
+ children: [/* @__PURE__ */ E("span", {
1131
1146
  className: "text-sm text-text-primary",
1132
1147
  children: r("healthybowl.irrigation.automation.form.skipRain.label", "Skip if rain is forecast")
1133
- }), /* @__PURE__ */ T("input", {
1148
+ }), /* @__PURE__ */ E("input", {
1134
1149
  type: "checkbox",
1135
1150
  checked: f.skipIfRain,
1136
- onChange: (e) => C("skipIfRain", e.target.checked),
1151
+ onChange: (e) => x("skipIfRain", e.target.checked),
1137
1152
  className: "h-4 w-4 accent-[var(--color-primary)]"
1138
1153
  })]
1139
1154
  }),
1140
- f.skipIfRain && /* @__PURE__ */ E("div", { children: [/* @__PURE__ */ T("label", {
1155
+ f.skipIfRain && /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("label", {
1141
1156
  htmlFor: "auto-rain",
1142
1157
  className: "mb-1 block text-sm font-medium text-text-primary",
1143
1158
  children: r("healthybowl.irrigation.automation.form.rainProb.label", "Rain Probability Threshold (%)")
1144
- }), /* @__PURE__ */ T("input", {
1159
+ }), /* @__PURE__ */ E("input", {
1145
1160
  id: "auto-rain",
1146
1161
  type: "number",
1147
1162
  min: "0",
1148
1163
  max: "100",
1149
1164
  step: "1",
1150
1165
  value: f.rainProbThreshold,
1151
- onChange: (e) => C("rainProbThreshold", e.target.value),
1166
+ onChange: (e) => x("rainProbThreshold", e.target.value),
1152
1167
  placeholder: "50",
1153
- className: O
1168
+ className: k
1154
1169
  })] }),
1155
- /* @__PURE__ */ E("label", {
1170
+ /* @__PURE__ */ D("label", {
1156
1171
  className: "flex items-center justify-between gap-3 rounded-md border border-border-subtle bg-bg-surface px-3 py-2",
1157
- children: [/* @__PURE__ */ T("span", {
1172
+ children: [/* @__PURE__ */ E("span", {
1158
1173
  className: "text-sm text-text-primary",
1159
1174
  children: r("healthybowl.irrigation.automation.form.notify.label", "Send in-app notification")
1160
- }), /* @__PURE__ */ T("input", {
1175
+ }), /* @__PURE__ */ E("input", {
1161
1176
  type: "checkbox",
1162
1177
  checked: f.notifyInApp,
1163
- onChange: (e) => C("notifyInApp", e.target.checked),
1178
+ onChange: (e) => x("notifyInApp", e.target.checked),
1179
+ className: "h-4 w-4 accent-[var(--color-primary)]"
1180
+ })]
1181
+ }),
1182
+ /* @__PURE__ */ D("label", {
1183
+ className: "flex items-center justify-between gap-3 rounded-md border border-border-subtle bg-bg-surface px-3 py-2",
1184
+ children: [/* @__PURE__ */ D("span", {
1185
+ className: "text-sm text-text-primary",
1186
+ children: [r("healthybowl.irrigation.automation.form.autoTask.label", "Create a task when a run fires"), /* @__PURE__ */ E("span", {
1187
+ className: "mt-0.5 block text-xs text-text-secondary",
1188
+ children: r("healthybowl.irrigation.automation.form.autoTask.help", "Adds a card to Farm Tasks when this rule waters. A skipped run adds nothing.")
1189
+ })]
1190
+ }), /* @__PURE__ */ E("input", {
1191
+ type: "checkbox",
1192
+ "data-testid": "irrigation-auto-task-toggle",
1193
+ checked: f.autoTaskEnabled,
1194
+ onChange: (e) => x("autoTaskEnabled", e.target.checked),
1164
1195
  className: "h-4 w-4 accent-[var(--color-primary)]"
1165
1196
  })]
1166
1197
  })
@@ -1170,6 +1201,6 @@ var O = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 te
1170
1201
  });
1171
1202
  };
1172
1203
  //#endregion
1173
- export { P as IrrigationPage };
1204
+ export { _e as IrrigationPage };
1174
1205
 
1175
1206
  //# sourceMappingURL=IrrigationPage.js.map