@nivaro/react 0.3.36 → 0.3.37

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 (102) hide show
  1. package/dist/components/slots/CommentsSlot.js +44 -36
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +9 -1
  5. package/dist/shared/components/AgentBadge.js +26 -0
  6. package/dist/shared/components/AgentQuestionsCard.js +198 -0
  7. package/dist/shared/components/ItemEditForm.js +3329 -3263
  8. package/dist/shared/components/McpConnectionScope.js +480 -0
  9. package/dist/shared/components/MyWorkView.js +223 -208
  10. package/dist/shared/components/RecordReadView.js +620 -575
  11. package/dist/shared/components/chat/ChatPanel.js +683 -671
  12. package/dist/shared/components/imports/DownloadSampleButton.js +69 -0
  13. package/dist/shared/components/imports/ImportConsole.js +106 -104
  14. package/dist/shared/components/imports/RunDetailSheet.js +11 -10
  15. package/dist/shared/components/item-edit/FieldAffordances.js +32 -32
  16. package/dist/shared/components/item-edit/FormTour.js +279 -0
  17. package/dist/shared/components/item-edit/GroupSection.js +377 -360
  18. package/dist/shared/components/item-edit/PersonalDefaultControl.js +28 -28
  19. package/dist/shared/components/item-edit/entry/EntryStrip.js +30 -26
  20. package/dist/shared/components/item-edit/form-density.js +36 -0
  21. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -46
  22. package/dist/shared/components/item-edit/usePersonalDefaults.js +312 -296
  23. package/dist/shared/components/layout-editor/AddPanel.js +349 -192
  24. package/dist/shared/components/layout-editor/DesignNode.js +126 -112
  25. package/dist/shared/components/layout-editor/EditorTopBar.js +123 -103
  26. package/dist/shared/components/layout-editor/LayoutEditor.js +829 -751
  27. package/dist/shared/components/layout-editor/PlaceTools.js +334 -0
  28. package/dist/shared/components/layout-editor/SlashInsert.js +252 -0
  29. package/dist/shared/components/layout-editor/StructureMenu.js +285 -242
  30. package/dist/shared/components/layout-editor/add-target.js +54 -43
  31. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +238 -155
  32. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +1 -1
  33. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +15 -12
  34. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +347 -189
  35. package/dist/shared/components/layout-editor/dnd/TrashZone.js +60 -32
  36. package/dist/shared/components/layout-editor/dnd/UndoChip.js +76 -0
  37. package/dist/shared/components/layout-editor/dnd/merge-drop.js +33 -0
  38. package/dist/shared/components/layout-editor/dnd/multi-drop.js +87 -0
  39. package/dist/shared/components/layout-editor/dnd/node.js +115 -105
  40. package/dist/shared/components/layout-editor/dnd/sensors.js +23 -0
  41. package/dist/shared/components/layout-editor/dnd/trash-drop.js +34 -28
  42. package/dist/shared/components/layout-editor/dnd/trash-links.js +97 -0
  43. package/dist/shared/components/layout-editor/even-row.js +86 -0
  44. package/dist/shared/components/layout-editor/field-list.js +99 -0
  45. package/dist/shared/components/layout-editor/format-painter.js +102 -0
  46. package/dist/shared/components/layout-editor/grid-guides.js +15 -13
  47. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +150 -132
  48. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +57 -53
  49. package/dist/shared/components/layout-editor/inspector/EvenRowAction.js +31 -0
  50. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +154 -141
  51. package/dist/shared/components/layout-editor/inspector/Inspector.js +209 -178
  52. package/dist/shared/components/layout-editor/inspector/LookTab.js +106 -98
  53. package/dist/shared/components/layout-editor/inspector/RulesTab.js +38 -37
  54. package/dist/shared/components/layout-editor/inspector/kit.js +280 -223
  55. package/dist/shared/components/layout-editor/keyboard-move.js +15 -15
  56. package/dist/shared/components/layout-editor/lint/LabelStyle.js +201 -0
  57. package/dist/shared/components/layout-editor/lint/LintPanel.js +132 -84
  58. package/dist/shared/components/layout-editor/lint/lint-api.js +65 -28
  59. package/dist/shared/components/layout-editor/nav/NavTools.js +14 -12
  60. package/dist/shared/components/layout-editor/nav/ZoomControls.js +145 -0
  61. package/dist/shared/components/layout-editor/nav/useEditorNav.js +34 -32
  62. package/dist/shared/components/layout-editor/nav/view-prefs.js +100 -15
  63. package/dist/shared/components/layout-editor/outputs/LayoutFile.js +89 -0
  64. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +272 -195
  65. package/dist/shared/components/layout-editor/outputs/layout-file-plan.js +176 -0
  66. package/dist/shared/components/layout-editor/outputs/output-api.js +71 -37
  67. package/dist/shared/components/layout-editor/overview/describe-conditions.js +16 -11
  68. package/dist/shared/components/layout-editor/overview/purpose.js +5 -5
  69. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  70. package/dist/shared/components/layout-editor/pin.js +37 -19
  71. package/dist/shared/components/layout-editor/place-clip.js +257 -0
  72. package/dist/shared/components/layout-editor/preview/PreviewModes.js +27 -26
  73. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +148 -117
  74. package/dist/shared/components/layout-editor/preview/SampleRecord.js +113 -0
  75. package/dist/shared/components/layout-editor/preview/preview-model.js +79 -60
  76. package/dist/shared/components/layout-editor/preview/sample-record.js +105 -0
  77. package/dist/shared/components/layout-editor/removed-log.js +151 -0
  78. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +109 -78
  79. package/dist/shared/components/layout-editor/reuse/linked-sections.js +373 -0
  80. package/dist/shared/components/layout-editor/revert-element.js +140 -0
  81. package/dist/shared/components/layout-editor/section-structure.js +193 -170
  82. package/dist/shared/components/layout-editor/settings/EntrySection.js +63 -45
  83. package/dist/shared/components/layout-editor/settings/LayoutSection.js +63 -32
  84. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +179 -137
  85. package/dist/shared/components/layout-editor/settings/WhoSection.js +18 -17
  86. package/dist/shared/components/layout-editor/settings/settings-registry.js +24 -0
  87. package/dist/shared/components/layout-editor/shortcuts.js +21 -16
  88. package/dist/shared/components/layout-editor/structure-ops.js +221 -195
  89. package/dist/shared/components/layout-editor/usage/UsagePanel.js +133 -85
  90. package/dist/shared/components/layout-editor/usage/refusal-lens.js +130 -0
  91. package/dist/shared/components/layout-editor/usage/usage-api.js +12 -11
  92. package/dist/shared/components/panels/CommentPanel.js +47 -45
  93. package/dist/shared/components/panels/RevisionsPanel.js +66 -64
  94. package/dist/shared/components/panels/TaskPanel.js +395 -332
  95. package/dist/shared/components/profile/AgentsPanel.js +196 -147
  96. package/dist/shared/components/profile/ConnectionRollback.js +329 -0
  97. package/dist/shared/components/profile/MyDefaultsCard.js +526 -520
  98. package/dist/shared/lib/entry-config.js +22 -22
  99. package/dist/shared/lib/form-usage-beacon.js +91 -55
  100. package/dist/shared/lib/layout-lint.js +530 -284
  101. package/dist/shared/lib/layout-resolve.js +58 -44
  102. package/package.json +1 -1
@@ -1,26 +1,26 @@
1
- import { jsxs as s, jsx as t, Fragment as Fe } from "react/jsx-runtime";
2
- import { useQueryClient as De, useQuery as T, useMutation as j } from "@tanstack/react-query";
3
- import { ClipboardList as Ee, ChevronDown as de, X as Q, Plus as Ie, Users as Ae, History as Le, Pencil as Oe, RotateCcw as We, ChevronsUpDown as xe, Check as je } from "lucide-react";
4
- import { useState as y, useRef as Ue, useEffect as ge, useMemo as Re } from "react";
5
- import { toast as k } from "sonner";
6
- import { useNivaroClient as R, useItemEditAuth as Ke } from "../../context.js";
7
- import { get as F, post as J, patch as Me, del as He } from "../../lib/commands.js";
8
- import { OPEN_TASK_STATUSES as ce, invalidateRecordTasks as Be } from "../../lib/record-tasks.js";
9
- import { formatDate as X, cn as U, formatRelative as be } from "../../lib/utils.js";
10
- import { TaskDoButton as ze } from "../ai/TaskDo.js";
11
- import { Button as B } from "../ui/button.js";
1
+ import { jsxs as n, jsx as t, Fragment as Ae } from "react/jsx-runtime";
2
+ import { useQueryClient as Fe, useQuery as q, useMutation as K } from "@tanstack/react-query";
3
+ import { ClipboardList as De, ChevronDown as de, X as Z, Plus as Ee, Bot as Ie, Users as Le, History as We, Pencil as Oe, RotateCcw as je, ChevronsUpDown as ge, Check as Ue } from "lucide-react";
4
+ import { useState as _, useRef as Ke, useEffect as xe, useMemo as Re } from "react";
5
+ import { toast as v } from "sonner";
6
+ import { useNivaroClient as O, useItemEditAuth as Me } from "../../context.js";
7
+ import { get as P, post as Q, patch as He, del as Be } from "../../lib/commands.js";
8
+ import { OPEN_TASK_STATUSES as ce, invalidateRecordTasks as ze } from "../../lib/record-tasks.js";
9
+ import { formatDate as Y, cn as R, formatRelative as fe } from "../../lib/utils.js";
10
+ import { TaskDoButton as Ve } from "../ai/TaskDo.js";
11
+ import { Button as z } from "../ui/button.js";
12
12
  import { Checkbox as me } from "../ui/checkbox.js";
13
- import { Command as fe, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as Y, CommandItem as ve } from "../ui/command.js";
14
- import { Input as Z } from "../ui/input.js";
15
- import { Label as A } from "../ui/label.js";
16
- import { Popover as we, PopoverTrigger as _e, PopoverContent as Ce } from "../ui/popover.js";
17
- import { SimpleSelect as ee } from "../ui/SimpleSelect.js";
18
- import { Textarea as Ve } from "../ui/textarea.js";
19
- const Ge = "id,first_name,last_name,email,is_out_of_office,ooo_end,delegate_id";
20
- function z(a) {
13
+ import { Command as be, CommandInput as ke, CommandList as ye, CommandEmpty as Ne, CommandGroup as ee, CommandItem as ve } from "../ui/command.js";
14
+ import { Input as te } from "../ui/input.js";
15
+ import { Label as W } from "../ui/label.js";
16
+ import { Popover as _e, PopoverTrigger as we, PopoverContent as Ce } from "../ui/popover.js";
17
+ import { SimpleSelect as G } from "../ui/SimpleSelect.js";
18
+ import { Textarea as Ge } from "../ui/textarea.js";
19
+ const Je = "id,first_name,last_name,email,is_out_of_office,ooo_end,delegate_id";
20
+ function V(a) {
21
21
  return a && ([a.first_name, a.last_name].filter(Boolean).join(" ") || a.email) || "Unknown";
22
22
  }
23
- const C = (a, i) => a != null && i != null && String(a).toUpperCase() === String(i).toUpperCase();
23
+ const $ = (a, i) => a != null && i != null && String(a).toUpperCase() === String(i).toUpperCase();
24
24
  function Se(a) {
25
25
  if (!a) return [];
26
26
  try {
@@ -30,10 +30,10 @@ function Se(a) {
30
30
  return [];
31
31
  }
32
32
  }
33
- function Je(a, i) {
33
+ function Xe(a, i) {
34
34
  return a.map((o) => {
35
- const m = i.get(o.field) ?? o.field.replace(/_/g, " ");
36
- return o.op === "nnull" ? `${m} is filled in` : o.op === "eq" ? `${m} is ${String(o.value ?? "")}` : o.op === "null" ? `${m} is empty` : `${m} ${o.op} ${String(o.value ?? "")}`.trim();
35
+ const c = i.get(o.field) ?? o.field.replace(/_/g, " ");
36
+ return o.op === "nnull" ? `${c} is filled in` : o.op === "eq" ? `${c} is ${String(o.value ?? "")}` : o.op === "null" ? `${c} is empty` : `${c} ${o.op} ${String(o.value ?? "")}`.trim();
37
37
  }).join(" and ");
38
38
  }
39
39
  function ue({ priority: a }) {
@@ -45,134 +45,164 @@ function ue({ priority: a }) {
45
45
  }
46
46
  );
47
47
  }
48
- function Xe({
48
+ function Qe({
49
49
  collection: a,
50
50
  item: i,
51
51
  value: o,
52
- valueLabel: m,
52
+ valueLabel: c,
53
53
  onChange: r
54
54
  }) {
55
- const c = R(), [g, d] = y(!1), [l, w] = y(""), [h, N] = y("");
56
- ge(() => {
57
- const n = setTimeout(() => N(l.trim()), 250);
58
- return () => clearTimeout(n);
59
- }, [l]);
60
- const v = T({
55
+ const u = O(), [x, m] = _(!1), [h, d] = _(""), [f, b] = _("");
56
+ xe(() => {
57
+ const s = setTimeout(() => b(h.trim()), 250);
58
+ return () => clearTimeout(s);
59
+ }, [h]);
60
+ const T = q({
61
61
  queryKey: ["task-people", a, i],
62
- queryFn: () => c.request(F("/tasks/people", { collection: a, item: i })).then((n) => n.data).catch(() => []),
63
- enabled: g && !!i && i !== "new",
62
+ queryFn: () => u.request(P("/tasks/people", { collection: a, item: i })).then((s) => s.data).catch(() => []),
63
+ enabled: x && !!i && i !== "new",
64
64
  staleTime: 6e4
65
- }), _ = T({
66
- queryKey: ["task-people-search", h],
67
- queryFn: () => c.request(
68
- F("/users", {
65
+ }), A = q({
66
+ queryKey: ["task-people-search", f],
67
+ queryFn: () => u.request(
68
+ P("/users", {
69
69
  limit: 25,
70
70
  people: 1,
71
- fields: Ge,
72
- ...h ? { search: h } : {}
71
+ fields: Je,
72
+ ...f ? { search: f } : {}
73
73
  })
74
- ).then((n) => n.data).catch(() => []),
75
- enabled: g,
74
+ ).then((s) => s.data).catch(() => []),
75
+ enabled: x,
76
76
  staleTime: 6e4
77
- }), u = v.data ?? [], x = new Set(u.map((n) => String(n.id).toUpperCase())), f = h.toLowerCase(), S = u.filter(
78
- (n) => !f || `${z(n)} ${n.email ?? ""}`.toLowerCase().includes(f)
79
- ), $ = (_.data ?? []).filter((n) => !x.has(String(n.id).toUpperCase())), L = [...S, ...$].map((n) => n.id), { data: D } = T({
80
- queryKey: ["task-open-counts", L.join(",")],
81
- queryFn: () => c.request(
82
- F("/tasks/open-counts", { ids: L.join(",") })
83
- ).then((n) => n.data).catch(() => ({})),
84
- enabled: g && L.length > 0,
77
+ }), w = T.data ?? [], y = new Set(w.map((s) => String(s.id).toUpperCase())), C = f.toLowerCase(), l = w.filter(
78
+ (s) => !C || `${V(s)} ${s.email ?? ""}`.toLowerCase().includes(C)
79
+ ), g = (A.data ?? []).filter((s) => !y.has(String(s.id).toUpperCase())), N = [...l, ...g].map((s) => s.id), { data: E } = q({
80
+ queryKey: ["task-open-counts", N.join(",")],
81
+ queryFn: () => u.request(
82
+ P("/tasks/open-counts", { ids: N.join(",") })
83
+ ).then((s) => s.data).catch(() => ({})),
84
+ enabled: x && N.length > 0,
85
85
  staleTime: 6e4
86
- }), K = (n, q) => {
87
- const E = (D == null ? void 0 : D[String(n.id).toUpperCase()]) ?? 0;
88
- return /* @__PURE__ */ s(
86
+ }), M = (s, F) => {
87
+ const I = (E == null ? void 0 : E[String(s.id).toUpperCase()]) ?? 0;
88
+ return /* @__PURE__ */ n(
89
89
  ve,
90
90
  {
91
- value: n.id,
91
+ value: s.id,
92
92
  onSelect: () => {
93
- r(C(n.id, o) ? null : n.id, C(n.id, o) ? null : n), d(!1);
93
+ r($(s.id, o) ? null : s.id, $(s.id, o) ? null : s), m(!1);
94
94
  },
95
95
  className: "text-[12px]",
96
- "data-task-person": n.id,
96
+ "data-task-person": s.id,
97
97
  children: [
98
98
  /* @__PURE__ */ t(
99
- je,
99
+ Ue,
100
100
  {
101
- className: U("mr-2 h-3.5 w-3.5", C(o, n.id) ? "opacity-100" : "opacity-0")
101
+ className: R("mr-2 h-3.5 w-3.5", $(o, s.id) ? "opacity-100" : "opacity-0")
102
102
  }
103
103
  ),
104
- /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate", children: [
105
- z(n),
106
- q != null && q.length ? /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10.5px] text-muted-foreground", children: q.join(", ") }) : null
104
+ /* @__PURE__ */ n("span", { className: "min-w-0 flex-1 truncate", children: [
105
+ V(s),
106
+ F != null && F.length ? /* @__PURE__ */ t("span", { className: "ml-1.5 text-[10.5px] text-muted-foreground", children: F.join(", ") }) : null
107
107
  ] }),
108
- n.is_out_of_office ? /* @__PURE__ */ t("span", { className: "ml-2 shrink-0 text-[10px] text-amber-600 dark:text-amber-400", children: "out" }) : null,
109
- E > 0 && /* @__PURE__ */ t(
108
+ s.is_out_of_office ? /* @__PURE__ */ t("span", { className: "ml-2 shrink-0 text-[10px] text-amber-600 dark:text-amber-400", children: "out" }) : null,
109
+ I > 0 && /* @__PURE__ */ t(
110
110
  "span",
111
111
  {
112
112
  className: "ml-2 shrink-0 rounded-full bg-slate-100 px-1.5 text-[10px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400",
113
- title: `${E} open task${E === 1 ? "" : "s"} already assigned`,
114
- children: E
113
+ title: `${I} open task${I === 1 ? "" : "s"} already assigned`,
114
+ children: I
115
115
  }
116
116
  )
117
117
  ]
118
118
  },
119
- n.id
119
+ s.id
120
120
  );
121
121
  };
122
- return /* @__PURE__ */ s(we, { open: g, onOpenChange: d, children: [
123
- /* @__PURE__ */ t(_e, { asChild: !0, children: /* @__PURE__ */ s(
124
- B,
122
+ return /* @__PURE__ */ n(_e, { open: x, onOpenChange: m, children: [
123
+ /* @__PURE__ */ t(we, { asChild: !0, children: /* @__PURE__ */ n(
124
+ z,
125
125
  {
126
126
  variant: "outline",
127
127
  role: "combobox",
128
- "aria-expanded": g,
128
+ "aria-expanded": x,
129
129
  "data-task-assignee-picker": !0,
130
130
  className: "h-8 w-full justify-between px-2.5 text-[12px] font-normal",
131
131
  children: [
132
- /* @__PURE__ */ t("span", { className: U("truncate", !o && "text-muted-foreground"), children: o ? m ?? "Selected" : "Assign to…" }),
133
- /* @__PURE__ */ t(xe, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
132
+ /* @__PURE__ */ t("span", { className: R("truncate", !o && "text-muted-foreground"), children: o ? c ?? "Selected" : "Assign to…" }),
133
+ /* @__PURE__ */ t(ge, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
134
134
  ]
135
135
  }
136
136
  ) }),
137
- /* @__PURE__ */ t(Ce, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ s(fe, { shouldFilter: !1, children: [
137
+ /* @__PURE__ */ t(Ce, { className: "w-[300px] p-0", align: "start", children: /* @__PURE__ */ n(be, { shouldFilter: !1, children: [
138
138
  /* @__PURE__ */ t(
139
139
  ke,
140
140
  {
141
141
  placeholder: "Search people…",
142
142
  className: "h-8 text-[12px]",
143
- value: l,
144
- onValueChange: w
143
+ value: h,
144
+ onValueChange: d
145
145
  }
146
146
  ),
147
- /* @__PURE__ */ s(ye, { children: [
148
- /* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: _.isFetching ? "Searching…" : "No one matches" }),
149
- S.length > 0 && /* @__PURE__ */ t(Y, { heading: "On this record", children: S.map((n) => K(n, n.reasons)) }),
150
- $.length > 0 && /* @__PURE__ */ t(Y, { heading: h ? "Everyone" : "Everyone (type to search)", children: $.map((n) => K(n)) })
147
+ /* @__PURE__ */ n(ye, { children: [
148
+ /* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: A.isFetching ? "Searching…" : "No one matches" }),
149
+ l.length > 0 && /* @__PURE__ */ t(ee, { heading: "On this record", children: l.map((s) => M(s, s.reasons)) }),
150
+ g.length > 0 && /* @__PURE__ */ t(ee, { heading: f ? "Everyone" : "Everyone (type to search)", children: g.map((s) => M(s)) })
151
151
  ] })
152
152
  ] }) })
153
153
  ] });
154
154
  }
155
- function Qe({
155
+ function Ye(a) {
156
+ const i = O();
157
+ return q({
158
+ queryKey: ["task-agents"],
159
+ queryFn: () => i.request(P("/tasks/agents")).then((o) => o.data ?? []).catch(() => []),
160
+ enabled: a,
161
+ staleTime: 5 * 6e4
162
+ });
163
+ }
164
+ function Ze({
165
+ agents: a,
166
+ value: i,
167
+ onChange: o
168
+ }) {
169
+ return /* @__PURE__ */ t(
170
+ G,
171
+ {
172
+ value: i ?? "",
173
+ onChange: (c) => o(a.find((r) => r.conn === c) ?? null),
174
+ ariaLabel: "Agent",
175
+ options: [
176
+ { value: "", label: a.length ? "Choose an agent…" : "No agents connected" },
177
+ ...a.map((c) => ({
178
+ value: c.conn,
179
+ label: `${c.name}${c.kind === "api_key" ? " · API key" : ""}`
180
+ }))
181
+ ]
182
+ }
183
+ );
184
+ }
185
+ function et({
156
186
  value: a,
157
187
  onChange: i
158
188
  }) {
159
- const o = R(), { data: m = [] } = T({
189
+ const o = O(), { data: c = [] } = q({
160
190
  queryKey: ["user-groups", "task-picker"],
161
- queryFn: () => o.request(F("/user-groups")).then((r) => r.data).catch(() => []),
191
+ queryFn: () => o.request(P("/user-groups")).then((r) => r.data).catch(() => []),
162
192
  staleTime: 5 * 6e4
163
193
  });
164
194
  return /* @__PURE__ */ t(
165
- ee,
195
+ G,
166
196
  {
167
197
  value: a == null ? "" : String(a),
168
198
  onChange: (r) => {
169
- const c = m.find((g) => String(g.id) === r) ?? null;
170
- i(c ? c.id : null, c);
199
+ const u = c.find((x) => String(x.id) === r) ?? null;
200
+ i(u ? u.id : null, u);
171
201
  },
172
202
  ariaLabel: "Team",
173
203
  options: [
174
- { value: "", label: m.length ? "Choose a team…" : "No teams yet" },
175
- ...m.map((r) => ({
204
+ { value: "", label: c.length ? "Choose a team…" : "No teams yet" },
205
+ ...c.map((r) => ({
176
206
  value: String(r.id),
177
207
  label: `${r.name}${r.member_count ? ` · ${r.member_count}` : ""}`
178
208
  }))
@@ -181,77 +211,77 @@ function Qe({
181
211
  );
182
212
  }
183
213
  function $e(a) {
184
- const i = R(), { data: o } = T({
214
+ const i = O(), { data: o } = q({
185
215
  queryKey: ["task-field-labels", a],
186
- queryFn: () => i.request(F(`/collections/${a}`)).then((c) => c.data.fields ?? []).catch(() => []),
216
+ queryFn: () => i.request(P(`/collections/${a}`)).then((u) => u.data.fields ?? []).catch(() => []),
187
217
  staleTime: 10 * 6e4
188
- }), m = (o ?? []).filter(
189
- (c) => !c.hidden && c.field !== "id" && c.type !== "alias" && !c.field.startsWith("__")
218
+ }), c = (o ?? []).filter(
219
+ (u) => !u.hidden && u.field !== "id" && u.type !== "alias" && !u.field.startsWith("__")
190
220
  ), r = Re(
191
- () => new Map(m.map((c) => [c.field, c.label || c.field.replace(/_/g, " ")])),
192
- [m]
221
+ () => new Map(c.map((u) => [u.field, u.label || u.field.replace(/_/g, " ")])),
222
+ [c]
193
223
  );
194
- return { fields: m, labels: r };
224
+ return { fields: c, labels: r };
195
225
  }
196
- function Ye({
226
+ function tt({
197
227
  collection: a,
198
228
  value: i,
199
229
  onChange: o
200
230
  }) {
201
- const { fields: m, labels: r } = $e(a), [c, g] = y(!1), d = i[0] ?? null;
202
- return /* @__PURE__ */ s("div", { className: "space-y-1.5", "data-task-done-when": !0, children: [
203
- /* @__PURE__ */ t(A, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
204
- /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-1.5", children: [
205
- /* @__PURE__ */ s(we, { open: c, onOpenChange: g, children: [
206
- /* @__PURE__ */ t(_e, { asChild: !0, children: /* @__PURE__ */ s(
207
- B,
231
+ const { fields: c, labels: r } = $e(a), [u, x] = _(!1), m = i[0] ?? null;
232
+ return /* @__PURE__ */ n("div", { className: "space-y-1.5", "data-task-done-when": !0, children: [
233
+ /* @__PURE__ */ t(W, { className: "block text-[11px]", children: "Close automatically when (optional)" }),
234
+ /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1.5", children: [
235
+ /* @__PURE__ */ n(_e, { open: u, onOpenChange: x, children: [
236
+ /* @__PURE__ */ t(we, { asChild: !0, children: /* @__PURE__ */ n(
237
+ z,
208
238
  {
209
239
  variant: "outline",
210
240
  className: "h-8 max-w-[220px] justify-between px-2.5 text-[12px] font-normal",
211
241
  children: [
212
- /* @__PURE__ */ t("span", { className: U("truncate", !d && "text-muted-foreground"), children: d ? r.get(d.field) ?? d.field : "A field on this record…" }),
213
- /* @__PURE__ */ t(xe, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
242
+ /* @__PURE__ */ t("span", { className: R("truncate", !m && "text-muted-foreground"), children: m ? r.get(m.field) ?? m.field : "A field on this record…" }),
243
+ /* @__PURE__ */ t(ge, { className: "ml-1 h-3.5 w-3.5 shrink-0 opacity-50" })
214
244
  ]
215
245
  }
216
246
  ) }),
217
- /* @__PURE__ */ t(Ce, { className: "w-[260px] p-0", align: "start", children: /* @__PURE__ */ s(fe, { children: [
247
+ /* @__PURE__ */ t(Ce, { className: "w-[260px] p-0", align: "start", children: /* @__PURE__ */ n(be, { children: [
218
248
  /* @__PURE__ */ t(ke, { placeholder: "Search fields…", className: "h-8 text-[12px]" }),
219
- /* @__PURE__ */ s(ye, { children: [
249
+ /* @__PURE__ */ n(ye, { children: [
220
250
  /* @__PURE__ */ t(Ne, { className: "py-3 text-center text-[12px] text-muted-foreground", children: "No field" }),
221
- /* @__PURE__ */ t(Y, { children: m.map((l) => /* @__PURE__ */ t(
251
+ /* @__PURE__ */ t(ee, { children: c.map((h) => /* @__PURE__ */ t(
222
252
  ve,
223
253
  {
224
- value: `${r.get(l.field)} ${l.field}`,
254
+ value: `${r.get(h.field)} ${h.field}`,
225
255
  onSelect: () => {
226
256
  o([
227
- { field: l.field, op: (d == null ? void 0 : d.op) ?? "nnull", value: (d == null ? void 0 : d.value) ?? null }
228
- ]), g(!1);
257
+ { field: h.field, op: (m == null ? void 0 : m.op) ?? "nnull", value: (m == null ? void 0 : m.value) ?? null }
258
+ ]), x(!1);
229
259
  },
230
260
  className: "text-[12px]",
231
- children: r.get(l.field)
261
+ children: r.get(h.field)
232
262
  },
233
- l.field
263
+ h.field
234
264
  )) })
235
265
  ] })
236
266
  ] }) })
237
267
  ] }),
238
- d && /* @__PURE__ */ s(Fe, { children: [
268
+ m && /* @__PURE__ */ n(Ae, { children: [
239
269
  /* @__PURE__ */ t("div", { className: "w-[130px]", children: /* @__PURE__ */ t(
240
- ee,
270
+ G,
241
271
  {
242
- value: d.op,
243
- onChange: (l) => o([{ ...d, op: l, value: l === "eq" ? d.value ?? "" : null }]),
272
+ value: m.op,
273
+ onChange: (h) => o([{ ...m, op: h, value: h === "eq" ? m.value ?? "" : null }]),
244
274
  options: [
245
275
  { value: "nnull", label: "is filled in" },
246
276
  { value: "eq", label: "equals" }
247
277
  ]
248
278
  }
249
279
  ) }),
250
- d.op === "eq" && /* @__PURE__ */ t(
251
- Z,
280
+ m.op === "eq" && /* @__PURE__ */ t(
281
+ te,
252
282
  {
253
- value: String(d.value ?? ""),
254
- onChange: (l) => o([{ ...d, value: l.target.value }]),
283
+ value: String(m.value ?? ""),
284
+ onChange: (h) => o([{ ...m, value: h.target.value }]),
255
285
  className: "h-8 w-[140px] text-[12px]",
256
286
  placeholder: "Value"
257
287
  }
@@ -263,17 +293,19 @@ function Ye({
263
293
  onClick: () => o([]),
264
294
  className: "rounded p-1 text-slate-400 hover:text-slate-600",
265
295
  "aria-label": "Remove condition",
266
- children: /* @__PURE__ */ t(Q, { className: "h-3.5 w-3.5" })
296
+ children: /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" })
267
297
  }
268
298
  )
269
299
  ] })
270
300
  ] })
271
301
  ] });
272
302
  }
273
- const Ze = () => ({
303
+ const at = () => ({
274
304
  title: "",
275
305
  description: "",
276
306
  mode: "person",
307
+ agent: null,
308
+ agentName: null,
277
309
  assignee: null,
278
310
  assigneeName: null,
279
311
  assigneePerson: null,
@@ -283,11 +315,13 @@ const Ze = () => ({
283
315
  priority: "normal",
284
316
  doneWhen: []
285
317
  });
286
- function et(a) {
318
+ function nt(a) {
287
319
  return {
288
320
  title: a.title,
289
321
  description: a.description ?? "",
290
- mode: a.assignee || a.team_id == null ? "person" : "team",
322
+ mode: a.agent_assignee ? "agent" : a.assignee || a.team_id == null ? "person" : "team",
323
+ agent: a.agent_assignee ?? null,
324
+ agentName: a.agent_name ?? null,
291
325
  assignee: a.assignee,
292
326
  assigneeName: a.assignee_name ?? null,
293
327
  assigneePerson: null,
@@ -302,27 +336,28 @@ function pe({
302
336
  collection: a,
303
337
  item: i,
304
338
  initial: o,
305
- submitLabel: m,
339
+ submitLabel: c,
306
340
  busy: r,
307
- allowTeam: c,
308
- onSubmit: g,
309
- onCancel: d
341
+ allowTeam: u,
342
+ allowAgent: x = !1,
343
+ onSubmit: m,
344
+ onCancel: h
310
345
  }) {
311
- var _;
312
- const [l, w] = y(o), h = (u, x) => w((f) => ({ ...f, [u]: x })), N = l.mode === "team" ? l.teamId != null : !!l.assignee, v = l.mode === "person" && ((_ = l.assigneePerson) != null && _.is_out_of_office) ? l.assigneePerson : null;
313
- return /* @__PURE__ */ s(
346
+ var C;
347
+ const [d, f] = _(o), b = (l, g) => f((N) => ({ ...N, [l]: g })), T = Ye(x).data ?? [], A = x && (T.length > 0 || d.mode === "agent"), w = d.mode === "team" ? d.teamId != null : d.mode === "agent" ? !!d.agent : !!d.assignee, y = d.mode === "person" && ((C = d.assigneePerson) != null && C.is_out_of_office) ? d.assigneePerson : null;
348
+ return /* @__PURE__ */ n(
314
349
  "div",
315
350
  {
316
351
  className: "space-y-3 rounded-lg border border-slate-200 bg-slate-50 p-3 dark:border-border dark:bg-slate-900/30",
317
352
  "data-task-form": !0,
318
353
  children: [
319
- /* @__PURE__ */ s("div", { children: [
320
- /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Title" }),
354
+ /* @__PURE__ */ n("div", { children: [
355
+ /* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Title" }),
321
356
  /* @__PURE__ */ t(
322
- Z,
357
+ te,
323
358
  {
324
- value: l.title,
325
- onChange: (u) => h("title", u.target.value),
359
+ value: d.title,
360
+ onChange: (l) => b("title", l.target.value),
326
361
  className: "h-8 bg-white text-[12px] dark:bg-background",
327
362
  placeholder: "What needs to be done?",
328
363
  autoFocus: !0,
@@ -330,13 +365,13 @@ function pe({
330
365
  }
331
366
  )
332
367
  ] }),
333
- /* @__PURE__ */ s("div", { children: [
334
- /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Details (optional)" }),
368
+ /* @__PURE__ */ n("div", { children: [
369
+ /* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Details (optional)" }),
335
370
  /* @__PURE__ */ t(
336
- Ve,
371
+ Ge,
337
372
  {
338
- value: l.description,
339
- onChange: (u) => h("description", u.target.value),
373
+ value: d.description,
374
+ onChange: (l) => b("description", l.target.value),
340
375
  className: "min-h-[56px] bg-white text-[12px] dark:bg-background",
341
376
  placeholder: "Anything the person needs to know",
342
377
  rows: 2,
@@ -344,70 +379,81 @@ function pe({
344
379
  }
345
380
  )
346
381
  ] }),
347
- /* @__PURE__ */ s("div", { className: "grid grid-cols-2 gap-3", children: [
348
- /* @__PURE__ */ s("div", { className: "col-span-2 sm:col-span-1", children: [
349
- /* @__PURE__ */ s("div", { className: "mb-1 flex items-center justify-between", children: [
350
- /* @__PURE__ */ t(A, { className: "text-[11px]", children: l.mode === "team" ? "Team" : "Assignee" }),
351
- c && /* @__PURE__ */ t(
382
+ /* @__PURE__ */ n("div", { className: "grid grid-cols-2 gap-3", children: [
383
+ /* @__PURE__ */ n("div", { className: "col-span-2 sm:col-span-1", children: [
384
+ /* @__PURE__ */ n("div", { className: "mb-1 flex items-center justify-between gap-2", children: [
385
+ /* @__PURE__ */ t(W, { className: "text-[11px]", children: d.mode === "team" ? "Team" : d.mode === "agent" ? "Agent" : "Assignee" }),
386
+ /* @__PURE__ */ t("span", { className: "flex items-center gap-2", children: ["person", "team", "agent"].filter(
387
+ (l) => l !== d.mode && (l !== "team" || u) && (l !== "agent" || A)
388
+ ).map((l) => /* @__PURE__ */ t(
352
389
  "button",
353
390
  {
354
391
  type: "button",
355
- "data-task-mode": l.mode === "team" ? "person" : "team",
356
- onClick: () => h("mode", l.mode === "team" ? "person" : "team"),
357
- className: "text-[10.5px] text-slate-500 hover:text-slate-800 dark:hover:text-slate-200",
358
- children: l.mode === "team" ? "Assign to a person" : "Assign to a team"
359
- }
360
- )
392
+ "data-task-mode": l,
393
+ onClick: () => b("mode", l),
394
+ className: "text-[10.5px] text-slate-500 hover:text-slate-800 dark:text-slate-400 dark:hover:text-slate-200",
395
+ children: l === "person" ? "A person" : l === "team" ? "A team" : "An agent"
396
+ },
397
+ l
398
+ )) })
361
399
  ] }),
362
- l.mode === "team" ? /* @__PURE__ */ t(
363
- Qe,
400
+ d.mode === "agent" ? /* @__PURE__ */ t(
401
+ Ze,
402
+ {
403
+ agents: T,
404
+ value: d.agent,
405
+ onChange: (l) => f((g) => ({ ...g, agent: (l == null ? void 0 : l.conn) ?? null, agentName: (l == null ? void 0 : l.name) ?? null }))
406
+ }
407
+ ) : d.mode === "team" ? /* @__PURE__ */ t(
408
+ et,
364
409
  {
365
- value: l.teamId,
366
- onChange: (u, x) => w((f) => ({ ...f, teamId: u, teamName: (x == null ? void 0 : x.name) ?? null }))
410
+ value: d.teamId,
411
+ onChange: (l, g) => f((N) => ({ ...N, teamId: l, teamName: (g == null ? void 0 : g.name) ?? null }))
367
412
  }
368
413
  ) : /* @__PURE__ */ t(
369
- Xe,
414
+ Qe,
370
415
  {
371
416
  collection: a,
372
417
  item: i,
373
- value: l.assignee,
374
- valueLabel: l.assigneeName,
375
- onChange: (u, x) => w((f) => ({
376
- ...f,
377
- assignee: u,
378
- assigneeName: x ? z(x) : null,
379
- assigneePerson: x
418
+ value: d.assignee,
419
+ valueLabel: d.assigneeName,
420
+ onChange: (l, g) => f((N) => ({
421
+ ...N,
422
+ assignee: l,
423
+ assigneeName: g ? V(g) : null,
424
+ assigneePerson: g
380
425
  }))
381
426
  }
382
427
  ),
383
- v && /* @__PURE__ */ s("p", { className: "mt-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 dark:bg-amber-400/10 dark:text-amber-400", children: [
384
- z(v),
428
+ y && /* @__PURE__ */ n("p", { className: "mt-1 rounded bg-amber-50 px-2 py-1 text-[11px] text-amber-700 dark:bg-amber-400/10 dark:text-amber-400", children: [
429
+ V(y),
385
430
  " is out of office",
386
- v.ooo_end ? ` until ${String(v.ooo_end).slice(0, 10)}` : "",
431
+ y.ooo_end ? ` until ${String(y.ooo_end).slice(0, 10)}` : "",
387
432
  " — the task goes to their delegate if one is set."
388
433
  ] }),
389
- l.mode === "team" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Waits with the team until one of them picks it up." })
434
+ d.mode === "team" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Waits with the team until one of them picks it up." }),
435
+ d.mode === "agent" && /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "The assistant picks it up through My Work and acts as the person it is connected for." })
390
436
  ] }),
391
- /* @__PURE__ */ s("div", { children: [
392
- /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Due date" }),
437
+ /* @__PURE__ */ n("div", { children: [
438
+ /* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Due date" }),
393
439
  /* @__PURE__ */ t(
394
- Z,
440
+ te,
395
441
  {
396
442
  type: "date",
397
- value: l.due,
398
- onChange: (u) => h("due", u.target.value),
443
+ value: d.due,
444
+ onChange: (l) => b("due", l.target.value),
399
445
  className: "h-8 bg-white text-[12px] dark:bg-background",
400
446
  "data-task-due": !0
401
447
  }
402
448
  )
403
449
  ] }),
404
- /* @__PURE__ */ s("div", { children: [
405
- /* @__PURE__ */ t(A, { className: "mb-1 block text-[11px]", children: "Priority" }),
450
+ /* @__PURE__ */ n("div", { children: [
451
+ /* @__PURE__ */ t(W, { className: "mb-1 block text-[11px]", children: "Priority" }),
406
452
  /* @__PURE__ */ t(
407
- ee,
453
+ G,
408
454
  {
409
- value: l.priority,
410
- onChange: (u) => h("priority", u),
455
+ value: d.priority,
456
+ onChange: (l) => b("priority", l),
411
457
  options: [
412
458
  { value: "low", label: "Low" },
413
459
  { value: "normal", label: "Normal" },
@@ -418,35 +464,35 @@ function pe({
418
464
  ] })
419
465
  ] }),
420
466
  /* @__PURE__ */ t(
421
- Ye,
467
+ tt,
422
468
  {
423
469
  collection: a,
424
- value: l.doneWhen,
425
- onChange: (u) => h("doneWhen", u)
470
+ value: d.doneWhen,
471
+ onChange: (l) => b("doneWhen", l)
426
472
  }
427
473
  ),
428
- /* @__PURE__ */ s("div", { className: "flex justify-end gap-2", children: [
474
+ /* @__PURE__ */ n("div", { className: "flex justify-end gap-2", children: [
429
475
  /* @__PURE__ */ t(
430
- B,
476
+ z,
431
477
  {
432
478
  type: "button",
433
479
  variant: "outline",
434
480
  size: "sm",
435
481
  className: "h-7 text-[12px]",
436
- onClick: d,
482
+ onClick: h,
437
483
  children: "Cancel"
438
484
  }
439
485
  ),
440
486
  /* @__PURE__ */ t(
441
- B,
487
+ z,
442
488
  {
443
489
  type: "button",
444
490
  size: "sm",
445
491
  className: "h-7 text-[12px]",
446
- disabled: !l.title.trim() || !N || r,
447
- onClick: () => g(l),
492
+ disabled: !d.title.trim() || !w || r,
493
+ onClick: () => m(d),
448
494
  "data-task-submit": !0,
449
- children: r ? "Saving…" : m
495
+ children: r ? "Saving…" : c
450
496
  }
451
497
  )
452
498
  ] })
@@ -455,98 +501,99 @@ function pe({
455
501
  );
456
502
  }
457
503
  function he({ taskId: a }) {
458
- const i = R(), { data: o = [], isLoading: m } = T({
504
+ const i = O(), { data: o = [], isLoading: c } = q({
459
505
  queryKey: ["task-history", a],
460
- queryFn: () => i.request(F(`/tasks/${a}/history`)).then((r) => r.data),
506
+ queryFn: () => i.request(P(`/tasks/${a}/history`)).then((r) => r.data),
461
507
  staleTime: 3e4
462
508
  });
463
- return m ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Loading history…" }) : o.length ? /* @__PURE__ */ t(
509
+ return c ? /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "Loading history…" }) : o.length ? /* @__PURE__ */ t(
464
510
  "ol",
465
511
  {
466
512
  className: "mt-1.5 space-y-1 border-l border-slate-200 pl-3 dark:border-border",
467
513
  "data-task-history": !0,
468
- children: o.map((r) => /* @__PURE__ */ s("li", { className: "text-[11px] text-slate-600 dark:text-slate-400", children: [
514
+ children: o.map((r) => /* @__PURE__ */ n("li", { className: "text-[11px] text-slate-600 dark:text-slate-400", children: [
469
515
  /* @__PURE__ */ t("span", { className: "text-slate-800 dark:text-slate-200", children: r.text }),
470
- /* @__PURE__ */ s("span", { className: "text-slate-400", children: [
516
+ /* @__PURE__ */ n("span", { className: "text-slate-400", children: [
471
517
  " ",
472
518
  "· ",
473
519
  r.user_name ? `${r.user_name}, ` : "",
474
- /* @__PURE__ */ t("span", { title: new Date(r.at).toLocaleString(), children: be(r.at) })
520
+ /* @__PURE__ */ t("span", { title: new Date(r.at).toLocaleString(), children: fe(r.at) })
475
521
  ] })
476
522
  ] }, r.id))
477
523
  }
478
524
  ) : /* @__PURE__ */ t("p", { className: "mt-1 text-[11px] text-muted-foreground", children: "No history yet." });
479
525
  }
480
- function kt({
526
+ function vt({
481
527
  collection: a,
482
528
  item: i,
483
529
  title: o,
484
- defaultExpanded: m,
530
+ defaultExpanded: c,
485
531
  queuedTasks: r,
486
- onQueueTask: c,
487
- onRemoveQueuedTask: g
532
+ onQueueTask: u,
533
+ onRemoveQueuedTask: x
488
534
  }) {
489
- const d = R(), l = De(), { isAdmin: w, userId: h } = Ke(), [N, v] = y(!1), _ = Ue(!1);
490
- ge(() => {
491
- !_.current && m !== void 0 && (_.current = !0, v(m));
492
- }, [m]);
493
- const [u, x] = y(!1), [f, S] = y(null), [$, L] = y(null), [D, K] = y(!1), n = !i || i === "new", { data: q = [] } = T({
535
+ const m = O(), h = Fe(), { isAdmin: d, userId: f } = Me(), [b, T] = _(!1), A = Ke(!1);
536
+ xe(() => {
537
+ !A.current && c !== void 0 && (A.current = !0, T(c));
538
+ }, [c]);
539
+ const [w, y] = _(!1), [C, l] = _(null), [g, N] = _(null), [E, M] = _(!1), s = !i || i === "new", { data: F = [] } = q({
494
540
  queryKey: ["tasks", a, i],
495
- queryFn: () => d.request(F("/tasks", { collection: a, item: i })).then((e) => e.data),
496
- enabled: !!a && !n
497
- }), { labels: E } = $e(a), I = () => {
498
- Be(l, a, i), l.invalidateQueries({ queryKey: ["task-history"] });
499
- }, O = (e, p) => {
500
- var P;
501
- return ((P = e == null ? void 0 : e.response) == null ? void 0 : P.error) ?? (e instanceof Error && e.message ? e.message : p);
502
- }, te = (e) => ({
541
+ queryFn: () => m.request(P("/tasks", { collection: a, item: i })).then((e) => e.data),
542
+ enabled: !!a && !s
543
+ }), { labels: I } = $e(a), L = () => {
544
+ ze(h, a, i), h.invalidateQueries({ queryKey: ["task-history"] });
545
+ }, j = (e, p) => {
546
+ var D;
547
+ return ((D = e == null ? void 0 : e.response) == null ? void 0 : D.error) ?? (e instanceof Error && e.message ? e.message : p);
548
+ }, ae = (e) => ({
503
549
  title: e.title.trim(),
504
550
  description: e.description.trim() || null,
505
551
  assignee: e.mode === "person" ? e.assignee : null,
506
552
  team_id: e.mode === "team" ? e.teamId : null,
553
+ ...e.mode === "agent" && e.agent ? { agent: e.agent } : {},
507
554
  due_date: e.due || null,
508
555
  priority: e.priority,
509
556
  done_when: e.doneWhen.length ? e.doneWhen : null
510
- }), ae = j({
511
- mutationFn: (e) => d.request(
512
- J("/tasks", { collection: a, item: i, ...te(e) })
557
+ }), ne = K({
558
+ mutationFn: (e) => m.request(
559
+ Q("/tasks", { collection: a, item: i, ...ae(e) })
513
560
  ),
514
561
  onSuccess: (e) => {
515
562
  var p;
516
- I(), x(!1), k.success(
563
+ L(), y(!1), v.success(
517
564
  (p = e == null ? void 0 : e.data) != null && p.delegated_from ? "Task created — it went to their delegate" : "Task created"
518
565
  );
519
566
  },
520
- onError: (e) => k.error(O(e, "Could not create the task"))
521
- }), M = j({
522
- mutationFn: ({ id: e, body: p }) => d.request(Me(`/tasks/${e}`, p)),
567
+ onError: (e) => v.error(j(e, "Could not create the task"))
568
+ }), H = K({
569
+ mutationFn: ({ id: e, body: p }) => m.request(He(`/tasks/${e}`, p)),
523
570
  onSuccess: (e, p) => {
524
- I(), S(null), p.body.status === "open" ? k.success("Task reopened") : k.success("Task updated");
571
+ L(), l(null), p.body.status === "open" ? v.success("Task reopened") : v.success("Task updated");
525
572
  },
526
- onError: (e) => k.error(O(e, "Could not update the task"))
527
- }), se = j({
528
- mutationFn: (e) => d.request(J(`/tasks/${e}/complete`, {})),
573
+ onError: (e) => v.error(j(e, "Could not update the task"))
574
+ }), se = K({
575
+ mutationFn: (e) => m.request(Q(`/tasks/${e}/complete`, {})),
529
576
  onSuccess: () => {
530
- I(), k.success("Task completed");
577
+ L(), v.success("Task completed");
531
578
  },
532
- onError: (e) => k.error(O(e, "Could not complete the task"))
533
- }), ne = j({
534
- mutationFn: (e) => d.request(J(`/tasks/${e}/claim`, {})),
579
+ onError: (e) => v.error(j(e, "Could not complete the task"))
580
+ }), le = K({
581
+ mutationFn: (e) => m.request(Q(`/tasks/${e}/claim`, {})),
535
582
  onSuccess: () => {
536
- I(), k.success("It’s yours");
583
+ L(), v.success("It’s yours");
537
584
  },
538
- onError: (e) => k.error(O(e, "Could not pick it up"))
539
- }), le = j({
540
- mutationFn: (e) => d.request(He(`/tasks/${e}`)),
585
+ onError: (e) => v.error(j(e, "Could not pick it up"))
586
+ }), re = K({
587
+ mutationFn: (e) => m.request(Be(`/tasks/${e}`)),
541
588
  onSuccess: () => {
542
- I(), k.success("Task deleted");
589
+ L(), v.success("Task deleted");
543
590
  },
544
- onError: (e) => k.error(O(e, "Could not delete the task"))
591
+ onError: (e) => v.error(j(e, "Could not delete the task"))
545
592
  });
546
593
  if (!a) return null;
547
- const b = q.filter((e) => ce.has(e.status)), V = q.filter((e) => !ce.has(e.status)), qe = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), G = (e) => w || C(e.assignee, h) || C(e.created_by, h), Pe = (e) => w || C(e.created_by, h);
594
+ const k = F.filter((e) => ce.has(e.status)), J = F.filter((e) => !ce.has(e.status)), qe = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), X = (e) => d || $(e.assignee, f) || $(e.created_by, f), Pe = (e) => d || $(e.created_by, f);
548
595
  function Te(e) {
549
- c == null || c({
596
+ u == null || u({
550
597
  title: e.title.trim(),
551
598
  description: e.description.trim() || void 0,
552
599
  assignee: e.mode === "person" ? e.assignee : null,
@@ -555,51 +602,65 @@ function kt({
555
602
  team_name: e.mode === "team" ? e.teamName : null,
556
603
  due_date: e.due,
557
604
  priority: e.priority
558
- }), x(!1);
605
+ }), y(!1);
559
606
  }
560
- const re = (e, p) => {
561
- const P = !p && !!e.due_date && String(e.due_date).slice(0, 10) < qe;
562
- return /* @__PURE__ */ s("div", { className: "mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-slate-400", children: [
607
+ const ie = (e, p) => {
608
+ const D = !p && !!e.due_date && String(e.due_date).slice(0, 10) < qe;
609
+ return /* @__PURE__ */ n("div", { className: "mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-0.5 text-[11px] text-slate-400", children: [
563
610
  /* @__PURE__ */ t(ue, { priority: e.priority }),
564
- e.assignee ? /* @__PURE__ */ t("span", { children: e.assignee_name ?? "Someone" }) : e.team_id != null ? /* @__PURE__ */ s("span", { className: "inline-flex items-center gap-1", children: [
565
- /* @__PURE__ */ t(Ae, { className: "h-3 w-3" }),
611
+ e.agent_assignee ? /* @__PURE__ */ n(
612
+ "span",
613
+ {
614
+ className: "inline-flex items-center gap-1 text-[#0e7490] dark:text-[#67e8f9]",
615
+ "data-task-agent": e.agent_assignee,
616
+ children: [
617
+ /* @__PURE__ */ t(Ie, { className: "h-3 w-3", "aria-hidden": !0 }),
618
+ e.agent_name ?? "An agent",
619
+ e.assignee_name && /* @__PURE__ */ n("span", { className: "text-slate-400", children: [
620
+ "for ",
621
+ e.assignee_name
622
+ ] })
623
+ ]
624
+ }
625
+ ) : e.assignee ? /* @__PURE__ */ t("span", { children: e.assignee_name ?? "Someone" }) : e.team_id != null ? /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1", children: [
626
+ /* @__PURE__ */ t(Le, { className: "h-3 w-3" }),
566
627
  "Waiting for ",
567
628
  e.team_name ?? "the team"
568
629
  ] }) : null,
569
- !p && e.due_date && /* @__PURE__ */ s("span", { className: U(P && "font-medium text-red-500"), children: [
630
+ !p && e.due_date && /* @__PURE__ */ n("span", { className: R(D && "font-medium text-red-500"), children: [
570
631
  "Due ",
571
- X(e.due_date),
572
- P && " (overdue)"
632
+ Y(e.due_date),
633
+ D && " (overdue)"
573
634
  ] }),
574
- p && e.completed_at && /* @__PURE__ */ s("span", { "data-task-completed-by": !0, children: [
635
+ p && e.completed_at && /* @__PURE__ */ n("span", { "data-task-completed-by": !0, children: [
575
636
  e.status === "cancelled" ? "Cancelled" : `Done${e.completed_by_name ? ` by ${e.completed_by_name}` : ""}`,
576
637
  " ",
577
- /* @__PURE__ */ t("span", { title: new Date(e.completed_at).toLocaleString(), children: be(e.completed_at) })
638
+ /* @__PURE__ */ t("span", { title: new Date(e.completed_at).toLocaleString(), children: fe(e.completed_at) })
578
639
  ] }),
579
- e.created_by_name && !C(e.created_by, e.assignee) && /* @__PURE__ */ s("span", { children: [
640
+ e.created_by_name && !$(e.created_by, e.assignee) && /* @__PURE__ */ n("span", { children: [
580
641
  "Asked by ",
581
642
  e.created_by_name
582
643
  ] })
583
644
  ] });
584
- }, ie = (e, p) => /* @__PURE__ */ s("div", { className: "flex shrink-0 items-center gap-0.5", children: [
585
- !p && /* @__PURE__ */ t(ze, { task: e, compact: !0, onTaskChanged: I }),
645
+ }, oe = (e, p) => /* @__PURE__ */ n("div", { className: "flex shrink-0 items-center gap-0.5", children: [
646
+ !p && /* @__PURE__ */ t(Ve, { task: e, compact: !0, onTaskChanged: L }),
586
647
  /* @__PURE__ */ t(
587
648
  "button",
588
649
  {
589
650
  type: "button",
590
- onClick: () => L($ === e.id ? null : e.id),
651
+ onClick: () => N(g === e.id ? null : e.id),
591
652
  className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
592
653
  "aria-label": `History of ${e.title}`,
593
654
  title: "History",
594
655
  "data-task-history-toggle": e.id,
595
- children: /* @__PURE__ */ t(Le, { className: "h-3.5 w-3.5" })
656
+ children: /* @__PURE__ */ t(We, { className: "h-3.5 w-3.5" })
596
657
  }
597
658
  ),
598
- !p && G(e) && /* @__PURE__ */ t(
659
+ !p && X(e) && /* @__PURE__ */ t(
599
660
  "button",
600
661
  {
601
662
  type: "button",
602
- onClick: () => S(f === e.id ? null : e.id),
663
+ onClick: () => l(C === e.id ? null : e.id),
603
664
  className: "rounded p-1 text-slate-300 transition-colors hover:bg-muted hover:text-slate-600",
604
665
  "aria-label": `Edit ${e.title}`,
605
666
  title: "Edit",
@@ -607,16 +668,16 @@ function kt({
607
668
  children: /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" })
608
669
  }
609
670
  ),
610
- p && G(e) && /* @__PURE__ */ s(
671
+ p && X(e) && /* @__PURE__ */ n(
611
672
  "button",
612
673
  {
613
674
  type: "button",
614
- onClick: () => M.mutate({ id: e.id, body: { status: "open" } }),
615
- disabled: M.isPending,
675
+ onClick: () => H.mutate({ id: e.id, body: { status: "open" } }),
676
+ disabled: H.isPending,
616
677
  className: "inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[11px] text-slate-500 transition-colors hover:bg-muted hover:text-slate-800 dark:hover:text-slate-200",
617
678
  "data-task-reopen": e.id,
618
679
  children: [
619
- /* @__PURE__ */ t(We, { className: "h-3 w-3" }),
680
+ /* @__PURE__ */ t(je, { className: "h-3 w-3" }),
620
681
  "Reopen"
621
682
  ]
622
683
  }
@@ -625,193 +686,195 @@ function kt({
625
686
  "button",
626
687
  {
627
688
  type: "button",
628
- onClick: () => le.mutate(e.id),
629
- disabled: le.isPending,
689
+ onClick: () => re.mutate(e.id),
690
+ disabled: re.isPending,
630
691
  className: "rounded p-1 text-slate-300 transition-colors hover:bg-red-50 hover:text-red-400 disabled:opacity-40 dark:hover:bg-red-500/10",
631
692
  "aria-label": `Delete ${e.title}`,
632
693
  title: "Delete",
633
- children: /* @__PURE__ */ t(Q, { className: "h-3.5 w-3.5" })
694
+ children: /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" })
634
695
  }
635
696
  )
636
697
  ] });
637
- return /* @__PURE__ */ s("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
638
- /* @__PURE__ */ s(
698
+ return /* @__PURE__ */ n("div", { className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:border-border dark:bg-card", children: [
699
+ /* @__PURE__ */ n(
639
700
  "button",
640
701
  {
641
702
  type: "button",
642
- onClick: () => v((e) => !e),
643
- "aria-expanded": N,
644
- "data-task-panel-toggle": N ? "open" : "closed",
703
+ onClick: () => T((e) => !e),
704
+ "aria-expanded": b,
705
+ "data-task-panel-toggle": b ? "open" : "closed",
645
706
  className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
646
707
  children: [
647
- /* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
648
- /* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
708
+ /* @__PURE__ */ n("span", { className: "flex w-full items-center gap-2.5", children: [
709
+ /* @__PURE__ */ t(De, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
649
710
  /* @__PURE__ */ t("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: o || "Tasks" }),
650
- (n ? (r ?? []).length : b.length) > 0 && /* @__PURE__ */ t("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: n ? `${(r ?? []).length} queued` : `${b.length} open` }),
711
+ (s ? (r ?? []).length : k.length) > 0 && /* @__PURE__ */ t("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: s ? `${(r ?? []).length} queued` : `${k.length} open` }),
651
712
  /* @__PURE__ */ t(
652
713
  de,
653
714
  {
654
- className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${N ? " rotate-180" : ""}`
715
+ className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${b ? " rotate-180" : ""}`
655
716
  }
656
717
  )
657
718
  ] }),
658
- !N && b.length > 0 && /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
659
- b[b.length - 1].title,
660
- b[b.length - 1].due_date && /* @__PURE__ */ s("span", { className: "text-slate-400/80", children: [
719
+ !b && k.length > 0 && /* @__PURE__ */ n("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
720
+ k[k.length - 1].title,
721
+ k[k.length - 1].due_date && /* @__PURE__ */ n("span", { className: "text-slate-400/80", children: [
661
722
  " ",
662
723
  "· due ",
663
- X(b[b.length - 1].due_date)
724
+ Y(k[k.length - 1].due_date)
664
725
  ] })
665
726
  ] })
666
727
  ]
667
728
  }
668
729
  ),
669
- N && /* @__PURE__ */ t("div", { className: "border-t border-slate-100 dark:border-border/60", children: /* @__PURE__ */ s("div", { className: "space-y-3 px-5 py-3", children: [
670
- n && (r ?? []).length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (r ?? []).map((e, p) => (
730
+ b && /* @__PURE__ */ t("div", { className: "border-t border-slate-100 dark:border-border/60", children: /* @__PURE__ */ n("div", { className: "space-y-3 px-5 py-3", children: [
731
+ s && (r ?? []).length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (r ?? []).map((e, p) => (
671
732
  // biome-ignore lint/suspicious/noArrayIndexKey: queued rows have no id yet
672
- /* @__PURE__ */ s("div", { className: "flex items-start gap-2.5 py-2", children: [
733
+ /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5 py-2", children: [
673
734
  /* @__PURE__ */ t("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-700 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
674
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
735
+ /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
675
736
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: e.title }),
676
- /* @__PURE__ */ s("div", { className: "mt-0.5 flex items-center gap-3 text-[11px] text-slate-400", children: [
737
+ /* @__PURE__ */ n("div", { className: "mt-0.5 flex items-center gap-3 text-[11px] text-slate-400", children: [
677
738
  /* @__PURE__ */ t(ue, { priority: e.priority }),
678
739
  e.assignee_name && /* @__PURE__ */ t("span", { children: e.assignee_name }),
679
- e.team_name && /* @__PURE__ */ s("span", { children: [
740
+ e.team_name && /* @__PURE__ */ n("span", { children: [
680
741
  "Team: ",
681
742
  e.team_name
682
743
  ] }),
683
- e.due_date && /* @__PURE__ */ s("span", { children: [
744
+ e.due_date && /* @__PURE__ */ n("span", { children: [
684
745
  "Due ",
685
- X(e.due_date)
746
+ Y(e.due_date)
686
747
  ] })
687
748
  ] })
688
749
  ] }),
689
- g && /* @__PURE__ */ t(
750
+ x && /* @__PURE__ */ t(
690
751
  "button",
691
752
  {
692
753
  type: "button",
693
- onClick: () => g(p),
754
+ onClick: () => x(p),
694
755
  className: "shrink-0 rounded p-1 text-slate-300 hover:text-red-400",
695
756
  "aria-label": `Remove ${e.title}`,
696
- children: /* @__PURE__ */ t(Q, { className: "h-3.5 w-3.5" })
757
+ children: /* @__PURE__ */ t(Z, { className: "h-3.5 w-3.5" })
697
758
  }
698
759
  )
699
760
  ] }, p)
700
761
  )) }),
701
- n && (r ?? []).length === 0 && !u && /* @__PURE__ */ t("p", { className: "py-1 text-[12px] text-slate-400", children: "Tasks are created once the record is saved." }),
702
- !n && b.length === 0 && !u && /* @__PURE__ */ t("p", { className: "py-1 text-[13px] text-slate-400", children: "No open tasks" }),
703
- !n && b.length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: b.map((e) => {
704
- const p = Se(e.done_when), P = !e.assignee && e.team_id != null;
705
- return /* @__PURE__ */ s("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
706
- /* @__PURE__ */ s("div", { className: "flex items-start gap-2.5", children: [
762
+ s && (r ?? []).length === 0 && !w && /* @__PURE__ */ t("p", { className: "py-1 text-[12px] text-slate-400", children: "Tasks are created once the record is saved." }),
763
+ !s && k.length === 0 && !w && /* @__PURE__ */ t("p", { className: "py-1 text-[13px] text-slate-400", children: "No open tasks" }),
764
+ !s && k.length > 0 && /* @__PURE__ */ t("div", { className: "divide-y divide-slate-100 dark:divide-border/60", children: k.map((e) => {
765
+ const p = Se(e.done_when), D = !e.assignee && e.team_id != null;
766
+ return /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
767
+ /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5", children: [
707
768
  /* @__PURE__ */ t(
708
769
  me,
709
770
  {
710
771
  className: "mt-0.5",
711
772
  checked: !1,
712
773
  onCheckedChange: () => se.mutate(e.id),
713
- disabled: se.isPending || !G(e),
774
+ disabled: se.isPending || !X(e),
714
775
  "aria-label": `Complete task: ${e.title}`
715
776
  }
716
777
  ),
717
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
778
+ /* @__PURE__ */ n("div", { className: "min-w-0 flex-1", children: [
718
779
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: e.title }),
719
780
  e.description && /* @__PURE__ */ t("p", { className: "mt-0.5 line-clamp-2 whitespace-pre-line text-[12px] text-slate-500", children: e.description }),
720
- re(e, !1),
721
- p.length > 0 && /* @__PURE__ */ s("p", { className: "mt-0.5 text-[11px] text-slate-500", "data-task-rule": !0, children: [
781
+ ie(e, !1),
782
+ p.length > 0 && /* @__PURE__ */ n("p", { className: "mt-0.5 text-[11px] text-slate-500", "data-task-rule": !0, children: [
722
783
  "Closes itself when ",
723
- Je(p, E)
784
+ Xe(p, I)
724
785
  ] }),
725
- P && /* @__PURE__ */ t(
786
+ D && /* @__PURE__ */ t(
726
787
  "button",
727
788
  {
728
789
  type: "button",
729
- onClick: () => ne.mutate(e.id),
730
- disabled: ne.isPending,
790
+ onClick: () => le.mutate(e.id),
791
+ disabled: le.isPending,
731
792
  className: "mt-1 rounded border border-slate-200 px-2 py-0.5 text-[11px] font-medium text-slate-700 hover:bg-muted dark:border-border dark:text-slate-300",
732
793
  "data-task-claim": e.id,
733
794
  children: "Pick it up"
734
795
  }
735
796
  )
736
797
  ] }),
737
- ie(e, !1)
798
+ oe(e, !1)
738
799
  ] }),
739
- f === e.id && /* @__PURE__ */ t("div", { className: "mt-2 pl-6", children: /* @__PURE__ */ t(
800
+ C === e.id && /* @__PURE__ */ t("div", { className: "mt-2 pl-6", children: /* @__PURE__ */ t(
740
801
  pe,
741
802
  {
742
803
  collection: a,
743
804
  item: i,
744
- initial: et(e),
805
+ initial: nt(e),
745
806
  submitLabel: "Save changes",
746
- busy: M.isPending,
807
+ busy: H.isPending,
747
808
  allowTeam: !1,
748
- onCancel: () => S(null),
749
- onSubmit: (H) => {
750
- const W = te(H), oe = {
751
- title: W.title,
752
- description: W.description,
753
- due_date: W.due_date,
754
- priority: W.priority,
755
- done_when: W.done_when
809
+ allowAgent: !0,
810
+ onCancel: () => l(null),
811
+ onSubmit: (S) => {
812
+ const U = ae(S), B = {
813
+ title: U.title,
814
+ description: U.description,
815
+ due_date: U.due_date,
816
+ priority: U.priority,
817
+ done_when: U.done_when
756
818
  };
757
- H.mode === "person" && !C(H.assignee, e.assignee) && (oe.assignee = H.assignee), M.mutate({ id: e.id, body: oe });
819
+ S.mode === "agent" ? S.agent && S.agent !== e.agent_assignee && (B.agent = S.agent) : S.mode === "person" && ($(S.assignee, e.assignee) ? e.agent_assignee && (B.agent = null) : B.assignee = S.assignee), H.mutate({ id: e.id, body: B });
758
820
  }
759
821
  }
760
822
  ) }),
761
- $ === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(he, { taskId: e.id }) })
823
+ g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(he, { taskId: e.id }) })
762
824
  ] }, e.id);
763
825
  }) }),
764
- !u && /* @__PURE__ */ s(
826
+ !w && /* @__PURE__ */ n(
765
827
  "button",
766
828
  {
767
829
  type: "button",
768
- onClick: () => x(!0),
830
+ onClick: () => y(!0),
769
831
  className: "flex items-center gap-1.5 text-[12px] text-slate-400 transition-colors hover:text-nvr-cyan",
770
832
  "data-task-add": !0,
771
833
  children: [
772
- /* @__PURE__ */ t(Ie, { className: "h-3.5 w-3.5" }),
834
+ /* @__PURE__ */ t(Ee, { className: "h-3.5 w-3.5" }),
773
835
  "Add task"
774
836
  ]
775
837
  }
776
838
  ),
777
- u && /* @__PURE__ */ t(
839
+ w && /* @__PURE__ */ t(
778
840
  pe,
779
841
  {
780
842
  collection: a,
781
843
  item: i,
782
- initial: Ze(),
783
- submitLabel: n ? "Queue task" : "Create task",
784
- busy: ae.isPending,
844
+ initial: at(),
845
+ submitLabel: s ? "Queue task" : "Create task",
846
+ busy: ne.isPending,
785
847
  allowTeam: !0,
786
- onCancel: () => x(!1),
787
- onSubmit: (e) => n ? Te(e) : ae.mutate(e)
848
+ allowAgent: !s,
849
+ onCancel: () => y(!1),
850
+ onSubmit: (e) => s ? Te(e) : ne.mutate(e)
788
851
  }
789
852
  ),
790
- !n && V.length > 0 && /* @__PURE__ */ s("div", { children: [
791
- /* @__PURE__ */ s(
853
+ !s && J.length > 0 && /* @__PURE__ */ n("div", { children: [
854
+ /* @__PURE__ */ n(
792
855
  "button",
793
856
  {
794
857
  type: "button",
795
- onClick: () => K((e) => !e),
858
+ onClick: () => M((e) => !e),
796
859
  className: "flex items-center gap-1 text-[12px] text-slate-400 transition-colors hover:text-slate-600",
797
860
  children: [
798
861
  /* @__PURE__ */ t(
799
862
  de,
800
863
  {
801
- className: U(
864
+ className: R(
802
865
  "h-3.5 w-3.5 transition-transform",
803
- D && "rotate-180"
866
+ E && "rotate-180"
804
867
  )
805
868
  }
806
869
  ),
807
870
  "Completed (",
808
- V.length,
871
+ J.length,
809
872
  ")"
810
873
  ]
811
874
  }
812
875
  ),
813
- D && /* @__PURE__ */ t("div", { className: "mt-1 divide-y divide-slate-100 dark:divide-border/60", children: V.map((e) => /* @__PURE__ */ s("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
814
- /* @__PURE__ */ s("div", { className: "flex items-start gap-2.5", children: [
876
+ E && /* @__PURE__ */ t("div", { className: "mt-1 divide-y divide-slate-100 dark:divide-border/60", children: J.map((e) => /* @__PURE__ */ n("div", { className: "nvr-rise-in py-2", "data-task-row": e.id, children: [
877
+ /* @__PURE__ */ n("div", { className: "flex items-start gap-2.5", children: [
815
878
  /* @__PURE__ */ t(
816
879
  me,
817
880
  {
@@ -821,18 +884,18 @@ function kt({
821
884
  "aria-label": "Completed"
822
885
  }
823
886
  ),
824
- /* @__PURE__ */ s("div", { className: "min-w-0 flex-1 opacity-70", children: [
887
+ /* @__PURE__ */ n("div", { className: "min-w-0 flex-1 opacity-70", children: [
825
888
  /* @__PURE__ */ t("p", { className: "text-[13px] text-slate-600 line-through dark:text-slate-400", children: e.title }),
826
- re(e, !0)
889
+ ie(e, !0)
827
890
  ] }),
828
- ie(e, !0)
891
+ oe(e, !0)
829
892
  ] }),
830
- $ === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(he, { taskId: e.id }) })
893
+ g === e.id && /* @__PURE__ */ t("div", { className: "pl-6", children: /* @__PURE__ */ t(he, { taskId: e.id }) })
831
894
  ] }, e.id)) })
832
895
  ] })
833
896
  ] }) })
834
897
  ] });
835
898
  }
836
899
  export {
837
- kt as TaskPanel
900
+ vt as TaskPanel
838
901
  };