const require_chunk = require("./chunk-9hOWP6kD.cjs");
const require_translation_api_context_factory = require("./translation-api-context-factory-DkXq_vPq.cjs");
const require_src = require("./src-CfWQyJTB.cjs");
let react = require("react");
react = require_chunk.__toESM(react);
let _tanstack_react_query = require("@tanstack/react-query");
let react_jsx_runtime = require("react/jsx-runtime");
let lucide_react = require("lucide-react");
//#region ../../contacts/core/src/contacts-api-context.ts
const ContactsApiContext = (0, react.createContext)(null);
const ContactsApiProvider = ContactsApiContext.Provider;
function useContactsDomainApi() {
	const api = (0, react.use)(ContactsApiContext);
	if (!api) throw new Error("useContactsDomainApi must be used within a ContactsApiProvider");
	return api;
}
function useContactsCrud() {
	return useContactsDomainApi().contacts;
}
function useNotesApi() {
	return useContactsDomainApi().notes;
}
function useTasksApi() {
	return useContactsDomainApi().tasks;
}
/** Returns GroupsApi if the provider supplies one, otherwise null. */
function useGroupsApi() {
	return useContactsDomainApi().groups ?? null;
}
//#endregion
//#region ../../contacts/core/src/translation-api-context.ts
const { Context, Provider: ContactsProvider, useTranslation } = require_translation_api_context_factory.createTranslationContext("Contacts");
const ContactsTranslationProvider = ContactsProvider;
const useContactsTranslation = useTranslation;
/**
* Like `useContactsTranslation()` but returns `null` instead of throwing
* when no `ContactsTranslationProvider` is present in the tree.
* Useful for shared hooks consumed by both portal (has provider) and admin (no provider).
*/
function useOptionalContactsTranslation() {
	return (0, react.use)(Context);
}
//#endregion
//#region ../../contacts/core/src/parse-task-body.ts
/**
* Tasks store both a title (first line) and an optional body separated by a
* blank line. This is the canonical convention used by the task editor and
* by every consumer that displays tasks (contacts UI list, portal todo
* widget). Drift across consumers would mean some surfaces show "Title\n\n
* body details" verbatim while others split correctly — keep the delimiter
* convention in one place.
*/
function parseTaskBody(raw) {
	const split = raw.indexOf("\n\n");
	if (split >= 0) return {
		title: raw.slice(0, split),
		body: raw.slice(split + 2)
	};
	return {
		title: raw,
		body: ""
	};
}
//#endregion
//#region ../../contacts/core/src/iso-date.ts
/**
* Format a date as YYYY-MM-DD in the renderer's local timezone, optionally
* shifted by `offsetDays`. Use this for due-date inputs where "today" must
* resolve to the user's local calendar date — never `toISOString().slice(0, 10)`,
* which returns the UTC date and silently rolls over a day for users east/west
* of UTC at the wrong hours.
*/
function isoDate(offsetDays, now = /* @__PURE__ */ new Date()) {
	const d = new Date(now);
	d.setDate(d.getDate() + offsetDays);
	return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
}
/**
* Return a Date pinned to local midnight of the calendar day represented by
* `input`. Use this whenever you need to compare two due dates by calendar day
* (overdue / today / tomorrow / future).
*
* Why not just `new Date(input)`?  `new Date("YYYY-MM-DD")` parses the string
* as UTC midnight, which lands on the *previous* calendar day in any UTC−
* timezone — a task due "May 1" then reads as April 30 for a user in the
* Americas, classifying it as "Overdue" all day. Parse the date components
* directly so the calendar-day intent of the string is preserved.
*/
function startOfLocalDay(input) {
	if (typeof input === "string") {
		const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(input);
		if (match?.[1] && match[2] && match[3]) return new Date(Number(match[1]), Number(match[2]) - 1, Number(match[3]));
	}
	const d = typeof input === "string" ? new Date(input) : input;
	return new Date(d.getFullYear(), d.getMonth(), d.getDate());
}
//#endregion
//#region ../../contacts/ui/src/portal/utils/format-date.ts
/** Detect bare YYYY-MM-DD and ISO strings whose time is exactly midnight. */
const ALL_DAY_PATTERN = /^\d{4}-\d{2}-\d{2}(?:$|T00:00(?::00(?:\.\d+)?)?(?:[+-]\d{2}:\d{2}|Z)?)$/;
/**
* Detect non-Z ISO date-time strings that should stay on the timed path instead
* of being classified as all-day. Editors may read the written date/time fields
* directly. A trailing `Z` is intentionally excluded; UTC midnight values may
* still be handled as all-day by ALL_DAY_PATTERN.
*/
const LOCAL_TIMED_DUE_AT_PATTERN = /^\d{4}-\d{2}-\d{2}T(\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?(?:[+-]\d{2}:\d{2})?$/;
function isAllDay(dateStr) {
	return ALL_DAY_PATTERN.test(dateStr);
}
function toDateInputValue(dueDate) {
	if (!dueDate) return "";
	if (LOCAL_TIMED_DUE_AT_PATTERN.test(dueDate)) return dueDate.slice(0, 10);
	if (isAllDay(dueDate)) {
		const match = /^(\d{4})-(\d{2})-(\d{2})/.exec(dueDate);
		if (match?.[1] && match[2] && match[3]) return `${match[1]}-${match[2]}-${match[3]}`;
		return "";
	}
	const d = new Date(dueDate);
	if (Number.isNaN(d.getTime())) return "";
	return isoDate(0, d);
}
function getLocalCalendarDayDiff(dateStr, now = /* @__PURE__ */ new Date()) {
	const date = startOfLocalDay(dateStr);
	if (Number.isNaN(date.getTime())) return null;
	const today = startOfLocalDay(now);
	const dateUtc = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
	const todayUtc = Date.UTC(today.getFullYear(), today.getMonth(), today.getDate());
	return Math.round((dateUtc - todayUtc) / (1e3 * 60 * 60 * 24));
}
function formatDateForDisplay(dateStr, locale) {
	const normalizedLocale = locale?.replace(/_/g, "-") ?? "en-US";
	return (isAllDay(dateStr) ? startOfLocalDay(dateStr) : new Date(dateStr)).toLocaleDateString(normalizedLocale, {
		month: "short",
		day: "numeric",
		year: "numeric"
	});
}
//#endregion
//#region ../../contacts/core/src/query-keys.ts
const CONTACTS_QUERY_KEYS = {
	all: (prefix) => [prefix],
	list: (prefix) => [...CONTACTS_QUERY_KEYS.all(prefix), "list"],
	detail: (prefix, id) => [
		...CONTACTS_QUERY_KEYS.all(prefix),
		"detail",
		id
	]
};
const contactsKeys = {
	activities: (contactId) => [
		"portal-contacts",
		"activities",
		contactId
	],
	tasks: (contactId) => [
		"portal-contacts",
		"tasks",
		contactId
	],
	notes: (contactId) => [
		"portal-contacts",
		"notes",
		contactId
	],
	orders: (contactId) => [
		"rep-contacts",
		"orders",
		contactId
	],
	subscriptionOrders: (contactId) => [
		"rep-contacts",
		"subscription-orders",
		contactId
	],
	groups: () => ["portal-contacts", "groups"],
	groupMembers: (groupName) => [
		"portal-contacts",
		"group-members",
		groupName
	],
	groupAddSearch: (groupName, search) => [
		"portal-contacts",
		"group-add-search",
		groupName,
		search
	]
};
//#endregion
//#region ../../contacts/core/src/hooks/use-infinite-contacts.ts
function useInfiniteContacts(params) {
	const api = useContactsCrud();
	return (0, _tanstack_react_query.useInfiniteQuery)({
		queryKey: [...CONTACTS_QUERY_KEYS.list("contacts"), params],
		queryFn: ({ pageParam }) => api.listContacts({
			...params,
			page: pageParam
		}),
		getNextPageParam: (lastPage) => {
			const currentPage = lastPage.meta.current_page;
			if (currentPage == null) return void 0;
			if (lastPage.meta.next_cursor) return currentPage + 1;
			if (lastPage.meta.total_pages != null && currentPage < lastPage.meta.total_pages) return currentPage + 1;
		},
		initialPageParam: 1
	});
}
//#endregion
//#region ../../contacts/ui/src/portal/components/tasks/task-composer-form.tsx
const RELATIVE_DATE_MAX_DAYS = 30;
const DEFAULT_DUE_TIME = "12:00";
const TIME_INPUT_PATTERN = /^(\d{2}):(\d{2})$/;
function isValidTimeInput(timeValue) {
	const match = TIME_INPUT_PATTERN.exec(timeValue);
	const hours = match?.[1] ? Number(match[1]) : NaN;
	const minutes = match?.[2] ? Number(match[2]) : NaN;
	return Number.isInteger(hours) && Number.isInteger(minutes) && hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59;
}
function toTimeInputValue(dueDate) {
	if (!dueDate) return "";
	const localTimedMatch = LOCAL_TIMED_DUE_AT_PATTERN.exec(dueDate);
	if (localTimedMatch?.[1] && localTimedMatch[2]) {
		const timeValue = `${localTimedMatch[1]}:${localTimedMatch[2]}`;
		return isValidTimeInput(timeValue) ? timeValue : "";
	}
	if (isAllDay(dueDate)) return "";
	const date = new Date(dueDate);
	if (Number.isNaN(date.getTime())) return "";
	return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
}
function formatTimeForDisplay(timeValue, locale) {
	const match = TIME_INPUT_PATTERN.exec(timeValue);
	const hours = match?.[1] ? Number(match[1]) : NaN;
	const minutes = match?.[2] ? Number(match[2]) : NaN;
	if (!isValidTimeInput(timeValue)) return timeValue;
	const date = /* @__PURE__ */ new Date();
	date.setHours(hours, minutes, 0, 0);
	return new Intl.DateTimeFormat(locale, {
		hour: "numeric",
		minute: "2-digit"
	}).format(date);
}
function formatOffset(date) {
	const offsetMinutes = -date.getTimezoneOffset();
	const sign = offsetMinutes >= 0 ? "+" : "-";
	const absoluteOffset = Math.abs(offsetMinutes);
	return `${sign}${String(Math.floor(absoluteOffset / 60)).padStart(2, "0")}:${String(absoluteOffset % 60).padStart(2, "0")}`;
}
function composeDueAt(dateOnlyValue, timeValue) {
	if (!dateOnlyValue) return null;
	if (isValidTimeInput(timeValue)) {
		const dateMatch = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateOnlyValue);
		const timeMatch = TIME_INPUT_PATTERN.exec(timeValue);
		if (dateMatch?.[1] && dateMatch[2] && dateMatch[3] && timeMatch?.[1] && timeMatch[2]) return `${dateOnlyValue}T${timeValue}:00${formatOffset(new Date(Number(dateMatch[1]), Number(dateMatch[2]) - 1, Number(dateMatch[3]), Number(timeMatch[1]), Number(timeMatch[2]), 0, 0))}`;
	}
	return dateOnlyValue;
}
function QuickDateRow({ icon: Icon, label, rightLabel, onSelect }) {
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
		type: "button",
		onClick: onSelect,
		className: "text-foreground hover:bg-accent hover:text-accent-foreground focus-visible:ring-ring flex w-full min-w-0 items-center gap-3 rounded-lg px-2 py-2 text-sm transition-colors outline-none focus-visible:ring-2",
		children: [
			/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
				className: "size-4 shrink-0",
				"aria-hidden": "true"
			}),
			/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
				className: "min-w-0 flex-1 truncate text-left font-medium",
				children: label
			}),
			rightLabel && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
				className: "ml-auto max-w-[50%] min-w-0 truncate text-right text-xs font-medium text-current/80",
				children: rightLabel
			})
		]
	});
}
function TaskComposerForm({ onSubmit, isSubmitting = false, submitLabel, submittingLabel, initialBody = "", initialDueAt = null, metadataControls, onClose, autoFocus = true }) {
	const { t, locale } = useContactsTranslation();
	const [body, setBody] = (0, react.useState)(initialBody);
	const [dueDate, setDueDate] = (0, react.useState)(initialDueAt ?? null);
	const [dueTime, setDueTime] = (0, react.useState)(() => toTimeInputValue(initialDueAt) || DEFAULT_DUE_TIME);
	const [dateTimeControlsChanged, setDateTimeControlsChanged] = (0, react.useState)(false);
	const [datePopoverOpen, setDatePopoverOpen] = (0, react.useState)(false);
	const [labelNow, setLabelNow] = (0, react.useState)(() => /* @__PURE__ */ new Date());
	const timeInputId = (0, react.useId)();
	const inputRef = (0, react.useRef)(null);
	(0, react.useEffect)(() => {
		if (autoFocus) inputRef.current?.focus();
	}, [autoFocus]);
	(0, react.useEffect)(() => {
		let timeoutId = null;
		const scheduleNextMidnightUpdate = () => {
			const now = /* @__PURE__ */ new Date();
			setLabelNow(now);
			const nextMidnight = new Date(now);
			nextMidnight.setHours(24, 0, 0, 0);
			timeoutId = setTimeout(scheduleNextMidnightUpdate, nextMidnight.getTime() - now.getTime());
		};
		scheduleNextMidnightUpdate();
		return () => {
			if (timeoutId != null) clearTimeout(timeoutId);
		};
	}, []);
	const dateOnlyValue = (0, react.useMemo)(() => toDateInputValue(dueDate), [dueDate]);
	const hasDateSelected = dateOnlyValue !== "";
	const hasInitialTimedDueAt = toTimeInputValue(initialDueAt) !== "";
	const hasTimeSelected = dueTime !== "" && hasDateSelected && (dateTimeControlsChanged || hasInitialTimedDueAt);
	const selectedCalendarDate = (0, react.useMemo)(() => dateOnlyValue === "" ? void 0 : startOfLocalDay(dateOnlyValue), [dateOnlyValue]);
	const todayLocalMidnight = (0, react.useMemo)(() => startOfLocalDay(labelNow), [labelNow]);
	const normalizedLocale = (0, react.useMemo)(() => locale?.replace(/_/g, "-") ?? "en-US", [locale]);
	const calendarDefaultMonth = (0, react.useMemo)(() => {
		if (!selectedCalendarDate) return todayLocalMidnight;
		return selectedCalendarDate.getTime() < todayLocalMidnight.getTime() ? todayLocalMidnight : selectedCalendarDate;
	}, [selectedCalendarDate, todayLocalMidnight]);
	const quickDates = (0, react.useMemo)(() => {
		const tomorrow = isoDate(1, labelNow);
		const nextWeek = isoDate(7, labelNow);
		const weekdayFormatter = new Intl.DateTimeFormat(normalizedLocale, { weekday: "short" });
		const nextWeekFormatter = new Intl.DateTimeFormat(normalizedLocale, {
			weekday: "short",
			month: "short",
			day: "numeric"
		});
		return {
			tomorrow,
			tomorrowLabel: weekdayFormatter.format(startOfLocalDay(tomorrow)),
			nextWeek,
			nextWeekLabel: nextWeekFormatter.format(startOfLocalDay(nextWeek))
		};
	}, [labelNow, normalizedLocale]);
	const calendarFormatters = (0, react.useMemo)(() => {
		const monthYearFormatter = new Intl.DateTimeFormat(normalizedLocale, {
			month: "long",
			year: "numeric"
		});
		const monthFormatter = new Intl.DateTimeFormat(normalizedLocale, { month: "long" });
		const yearFormatter = new Intl.DateTimeFormat(normalizedLocale, { year: "numeric" });
		const dayFormatter = new Intl.DateTimeFormat(normalizedLocale, { day: "numeric" });
		const weekdayFormatter = new Intl.DateTimeFormat(normalizedLocale, { weekday: "short" });
		const weekNumberFormatter = new Intl.NumberFormat(normalizedLocale);
		return {
			formatCaption: (month) => monthYearFormatter.format(month),
			formatMonthCaption: (month) => monthFormatter.format(month),
			formatYearCaption: (year) => yearFormatter.format(year),
			formatDay: (day) => dayFormatter.format(day),
			formatWeekdayName: (weekday) => weekdayFormatter.format(weekday),
			formatWeekNumber: (weekNumber) => weekNumberFormatter.format(weekNumber)
		};
	}, [normalizedLocale]);
	const calendarLabels = (0, react.useMemo)(() => {
		const dayLabelFormatter = new Intl.DateTimeFormat(normalizedLocale, {
			weekday: "long",
			month: "long",
			day: "numeric",
			year: "numeric"
		});
		const weekdayLabelFormatter = new Intl.DateTimeFormat(normalizedLocale, { weekday: "long" });
		const weekNumberFormatter = new Intl.NumberFormat(normalizedLocale);
		return {
			labelNext: () => t("calendar_next_month"),
			labelPrevious: () => t("calendar_previous_month"),
			labelMonthDropdown: () => t("calendar_month_dropdown"),
			labelYearDropdown: () => t("calendar_year_dropdown"),
			labelDay: (day) => dayLabelFormatter.format(day),
			labelWeekday: (weekday) => weekdayLabelFormatter.format(weekday),
			labelWeekNumber: (weekNumber) => t("calendar_week_number", { number: weekNumberFormatter.format(weekNumber) })
		};
	}, [normalizedLocale, t]);
	const dateBadgeLabel = (0, react.useMemo)(() => {
		if (!hasDateSelected) return t("task_select_date");
		const diffDays = getLocalCalendarDayDiff(dateOnlyValue, labelNow);
		if (diffDays === 0) return t("quick_today");
		if (diffDays === 1) return t("quick_tomorrow");
		if (diffDays != null && diffDays >= 2 && diffDays <= RELATIVE_DATE_MAX_DAYS) return t("task_due_in_days", { count: diffDays });
		return formatDateForDisplay(dateOnlyValue, normalizedLocale);
	}, [
		dateOnlyValue,
		hasDateSelected,
		labelNow,
		normalizedLocale,
		t
	]);
	const timeBadgeLabel = (0, react.useMemo)(() => hasTimeSelected ? formatTimeForDisplay(dueTime, normalizedLocale) : "", [
		dueTime,
		hasTimeSelected,
		normalizedLocale
	]);
	const dateBadgeAriaLabel = hasTimeSelected ? `${dateBadgeLabel}, ${timeBadgeLabel}` : dateBadgeLabel;
	const submit = () => {
		const trimmed = body.trim();
		if (!trimmed || isSubmitting) return;
		onSubmit({
			body: trimmed,
			due_at: dateTimeControlsChanged ? composeDueAt(dateOnlyValue, dueTime) : initialDueAt ?? null
		});
	};
	const canSubmit = body.trim().length > 0 && !isSubmitting;
	const selectDueDate = (value) => {
		setDateTimeControlsChanged(true);
		setDueDate(value);
		setDueTime((currentTime) => currentTime || DEFAULT_DUE_TIME);
	};
	const clearDueDate = () => {
		setDateTimeControlsChanged(true);
		setDueDate(null);
		setDueTime(DEFAULT_DUE_TIME);
		setDatePopoverOpen(false);
	};
	const handleTimeChange = (value) => {
		setDateTimeControlsChanged(true);
		setDueTime(value);
		if (value && !hasDateSelected) setDueDate(isoDate(0, labelNow));
	};
	return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
		className: "border-border/50 focus-within:border-foreground/30 rounded-xl border p-3 transition-colors",
		children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
			className: "flex items-start gap-3",
			children: [
				/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
					className: "border-muted-foreground/50 mt-1.5 size-5 shrink-0 rounded-full border-2",
					"aria-hidden": "true"
				}),
				/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
					ref: inputRef,
					value: body,
					onChange: (e) => setBody(e.target.value),
					onKeyDown: (e) => {
						if (e.key === "Enter" && !e.shiftKey) {
							e.preventDefault();
							submit();
						} else if (e.key === "Escape" && onClose) {
							e.preventDefault();
							onClose();
						}
					},
					placeholder: t("task_describe_placeholder"),
					"aria-label": t("task_description_aria"),
					className: "placeholder:text-muted-foreground/80 text-foreground flex-1 border-0 bg-transparent text-sm font-medium outline-none pointer-coarse:text-base"
				}),
				onClose && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
					type: "button",
					onClick: onClose,
					"aria-label": t("task_discard_aria"),
					className: "text-muted-foreground hover:bg-muted hover:text-foreground -mt-0.5 -mr-0.5 flex size-7 shrink-0 items-center justify-center rounded-md transition-colors",
					children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, { className: "size-4" })
				})
			]
		}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
			className: "mt-3 flex flex-wrap items-center gap-1.5 pl-(--row-indent) [--row-indent:2rem]",
			children: [
				/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.Popover, {
					open: datePopoverOpen,
					onOpenChange: setDatePopoverOpen,
					children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.PopoverTrigger, {
						asChild: true,
						children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
							type: "button",
							"aria-label": hasDateSelected ? t("task_custom_date_selected_aria", { date: dateBadgeAriaLabel }) : t("task_custom_date_aria"),
							className: require_src.cn("flex shrink-0 items-center gap-1 rounded-full px-3 py-1 text-xs font-medium transition-colors", hasDateSelected ? "bg-primary text-primary-foreground" : "bg-muted text-muted-foreground hover:bg-muted/70"),
							children: [
								/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CalendarIcon, {
									className: "size-3",
									"aria-hidden": "true"
								}),
								/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: dateBadgeLabel }),
								hasTimeSelected && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
									className: "inline-flex items-center gap-0.5 text-current/80",
									children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Clock, {
										className: "size-3",
										"aria-hidden": "true"
									}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: timeBadgeLabel })]
								})
							]
						})
					}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_src.PopoverContent, {
						align: "start",
						className: "bg-popover text-popover-foreground pointer-events-auto z-[9999] w-max max-w-[calc(100vw-2rem)] rounded-xl border p-3 shadow-lg",
						children: [
							/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
								className: "text-foreground max-w-full truncate px-1 text-sm font-semibold",
								children: dateBadgeLabel
							}),
							/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Separator, { className: "bg-border my-3" }),
							/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
								className: "min-w-0 space-y-1",
								children: [
									/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickDateRow, {
										icon: lucide_react.Sun,
										label: t("quick_today"),
										onSelect: () => selectDueDate(isoDate(0, labelNow))
									}),
									/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickDateRow, {
										icon: lucide_react.Sunrise,
										label: t("quick_tomorrow"),
										rightLabel: quickDates.tomorrowLabel,
										onSelect: () => selectDueDate(quickDates.tomorrow)
									}),
									/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickDateRow, {
										icon: lucide_react.CalendarDays,
										label: t("task_next_week"),
										rightLabel: quickDates.nextWeekLabel,
										onSelect: () => selectDueDate(quickDates.nextWeek)
									}),
									/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuickDateRow, {
										icon: lucide_react.CircleOff,
										label: t("task_no_date"),
										onSelect: clearDueDate
									})
								]
							}),
							/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Separator, { className: "bg-border my-3" }),
							/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
								className: "text-muted-foreground px-1 text-xs font-semibold",
								children: t("task_custom_calendar")
							}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Calendar, {
								mode: "single",
								formatters: calendarFormatters,
								labels: calendarLabels,
								disabled: { before: todayLocalMidnight },
								onSelect: (date) => {
									if (!date) return;
									const selectedDate = startOfLocalDay(date);
									if (selectedDate.getTime() < todayLocalMidnight.getTime()) return;
									selectDueDate(isoDate(0, selectedDate));
								},
								className: "p-0 pt-2",
								classNames: {
									cell: "h-9 w-9 p-0 text-center text-sm focus-within:relative focus-within:z-20",
									day_selected: "rounded-md bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground"
								},
								initialFocus: true,
								defaultMonth: calendarDefaultMonth,
								...selectedCalendarDate ? { selected: selectedCalendarDate } : {}
							})] }),
							/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_src.Separator, { className: "bg-border my-3" }),
							/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
								className: "flex items-center justify-between gap-4 px-1",
								children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("label", {
									htmlFor: timeInputId,
									className: "text-muted-foreground text-xs font-semibold",
									children: t("task_time_label")
								}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
									className: "border-input bg-background text-foreground focus-within:ring-ring flex h-9 items-center gap-2 rounded-md border px-2 focus-within:ring-2",
									children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Clock, {
										className: "text-muted-foreground size-3.5 shrink-0",
										"aria-hidden": "true"
									}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
										id: timeInputId,
										type: "time",
										value: dueTime,
										onChange: (event) => handleTimeChange(event.target.value),
										"aria-label": t("task_time_aria"),
										className: "h-full border-0 bg-transparent p-0 text-right text-sm outline-none [&::-webkit-calendar-picker-indicator]:hidden"
									})]
								})]
							})
						]
					})]
				}),
				metadataControls,
				/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
					type: "button",
					onClick: submit,
					disabled: !canSubmit,
					className: "bg-primary text-primary-foreground hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground mt-1 -ml-(--row-indent) inline-flex h-10 w-[calc(100%+var(--row-indent))] items-center justify-center rounded-lg text-sm font-semibold transition-colors disabled:cursor-not-allowed sm:mt-0 sm:ml-auto sm:h-auto sm:w-auto sm:shrink-0 sm:gap-1.5 sm:rounded-full sm:px-4 sm:py-1.5 sm:text-xs",
					children: isSubmitting ? submittingLabel ?? t("adding") : submitLabel ?? t("add_task")
				})
			]
		})]
	});
}
//#endregion
Object.defineProperty(exports, "ALL_DAY_PATTERN", {
	enumerable: true,
	get: function() {
		return ALL_DAY_PATTERN;
	}
});
Object.defineProperty(exports, "CONTACTS_QUERY_KEYS", {
	enumerable: true,
	get: function() {
		return CONTACTS_QUERY_KEYS;
	}
});
Object.defineProperty(exports, "ContactsApiProvider", {
	enumerable: true,
	get: function() {
		return ContactsApiProvider;
	}
});
Object.defineProperty(exports, "ContactsTranslationProvider", {
	enumerable: true,
	get: function() {
		return ContactsTranslationProvider;
	}
});
Object.defineProperty(exports, "LOCAL_TIMED_DUE_AT_PATTERN", {
	enumerable: true,
	get: function() {
		return LOCAL_TIMED_DUE_AT_PATTERN;
	}
});
Object.defineProperty(exports, "TaskComposerForm", {
	enumerable: true,
	get: function() {
		return TaskComposerForm;
	}
});
Object.defineProperty(exports, "contactsKeys", {
	enumerable: true,
	get: function() {
		return contactsKeys;
	}
});
Object.defineProperty(exports, "formatDateForDisplay", {
	enumerable: true,
	get: function() {
		return formatDateForDisplay;
	}
});
Object.defineProperty(exports, "isAllDay", {
	enumerable: true,
	get: function() {
		return isAllDay;
	}
});
Object.defineProperty(exports, "parseTaskBody", {
	enumerable: true,
	get: function() {
		return parseTaskBody;
	}
});
Object.defineProperty(exports, "startOfLocalDay", {
	enumerable: true,
	get: function() {
		return startOfLocalDay;
	}
});
Object.defineProperty(exports, "toDateInputValue", {
	enumerable: true,
	get: function() {
		return toDateInputValue;
	}
});
Object.defineProperty(exports, "useContactsCrud", {
	enumerable: true,
	get: function() {
		return useContactsCrud;
	}
});
Object.defineProperty(exports, "useContactsTranslation", {
	enumerable: true,
	get: function() {
		return useContactsTranslation;
	}
});
Object.defineProperty(exports, "useGroupsApi", {
	enumerable: true,
	get: function() {
		return useGroupsApi;
	}
});
Object.defineProperty(exports, "useInfiniteContacts", {
	enumerable: true,
	get: function() {
		return useInfiniteContacts;
	}
});
Object.defineProperty(exports, "useNotesApi", {
	enumerable: true,
	get: function() {
		return useNotesApi;
	}
});
Object.defineProperty(exports, "useOptionalContactsTranslation", {
	enumerable: true,
	get: function() {
		return useOptionalContactsTranslation;
	}
});
Object.defineProperty(exports, "useTasksApi", {
	enumerable: true,
	get: function() {
		return useTasksApi;
	}
});

//# sourceMappingURL=task-composer-form-oKkUtTAg.cjs.map