{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "user-schedule",
  "title": "User Schedule",
  "description": "A weekly availability editor: a switch per day, any number of time ranges with overlap and order checks, copy one day's hours to other days, a time zone, days off by date, a live week preview with total hours, and a save bar that blocks saving until every range is valid.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/user-schedule/user-schedule.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\ntype Range = { start: string; end: string };\ntype Day = { on: boolean; ranges: Range[] };\nexport interface UserScheduleValue {\n  timezone: string;\n  days: Day[]; // Monday first\n  overrides: string[]; // YYYY-MM-DD, unavailable\n}\n\nexport interface UserScheduleProps {\n  name?: string;\n  defaultValue?: UserScheduleValue;\n  today?: string;\n  onSave?: (value: UserScheduleValue) => Promise<void> | void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", faint: \"rgba(245,244,241,0.36)\", card: \"#121212\", input: \"#0D0D0D\", border: \"rgba(255,255,255,0.09)\", track: \"rgba(255,255,255,0.06)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", accent: \"#60A5FA\", green: \"#4ADE80\", red: \"#F87171\", ring: \"rgba(245,244,241,0.6)\", menu: \"#171717\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", card: \"#FFFFFF\", input: \"#FAFAF8\", border: \"rgba(10,10,10,0.1)\", track: \"rgba(10,10,10,0.05)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", accent: \"#2563EB\", green: \"#15803D\", red: \"#DC2626\", ring: \"rgba(10,10,10,0.5)\", menu: \"#FFFFFF\" },\n};\n\nconst DAYS = [\"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\", \"Sunday\"];\nconst ZONES = [\"Europe/Berlin (GMT+1)\", \"Europe/London (GMT+0)\", \"Europe/Istanbul (GMT+3)\", \"America/New_York (GMT−5)\", \"America/Los_Angeles (GMT−8)\", \"Asia/Tokyo (GMT+9)\"];\nconst work = (): Day => ({ on: true, ranges: [{ start: \"09:00\", end: \"12:00\" }, { start: \"13:00\", end: \"17:30\" }] });\nconst DEFAULT: UserScheduleValue = {\n  timezone: ZONES[0],\n  days: [work(), work(), work(), work(), { on: true, ranges: [{ start: \"09:00\", end: \"15:00\" }] }, { on: false, ranges: [{ start: \"10:00\", end: \"14:00\" }] }, { on: false, ranges: [{ start: \"10:00\", end: \"14:00\" }] }],\n  overrides: [\"2026-11-27\"],\n};\nconst TIMES = Array.from({ length: 64 }, (_, i) => {\n  const m = 6 * 60 + i * 15;\n  return `${String(Math.floor(m / 60)).padStart(2, \"0\")}:${String(m % 60).padStart(2, \"0\")}`;\n}); // 06:00 – 21:45\nconst END_TIMES = [...TIMES.slice(1), \"22:00\"];\nconst MONTHS = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\nconst DOW = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\n\nconst mins = (t: string) => Number(t.slice(0, 2)) * 60 + Number(t.slice(3));\nconst hm = (m: number) => `${String(Math.floor(m / 60)).padStart(2, \"0\")}:${String(m % 60).padStart(2, \"0\")}`;\nconst label = (t: string) => {\n  const h = Number(t.slice(0, 2));\n  return `${h % 12 || 12}:${t.slice(3)} ${h < 12 ? \"am\" : \"pm\"}`;\n};\nconst dateLabel = (d: string) => {\n  const dt = new Date(`${d}T00:00:00Z`);\n  return `${DOW[dt.getUTCDay()]}, ${MONTHS[dt.getUTCMonth()]} ${dt.getUTCDate()}`;\n};\nconst rangeError = (ranges: Range[], i: number) => {\n  const r = ranges[i];\n  if (mins(r.end) <= mins(r.start)) return \"Ends before it starts\";\n  if (ranges.some((o, j) => j !== i && mins(r.start) < mins(o.end) && mins(o.start) < mins(r.end))) return \"Overlaps another range\";\n  return null;\n};\nconst clone = (v: UserScheduleValue): UserScheduleValue => ({ ...v, days: v.days.map((d) => ({ on: d.on, ranges: d.ranges.map((r) => ({ ...r })) })), overrides: [...v.overrides] });\n\nexport function UserSchedule({ name = \"Lena Brandt\", defaultValue = DEFAULT, today = \"2026-11-12\", onSave, theme = \"dark\", className }: UserScheduleProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [saved, setSaved] = React.useState(() => clone(defaultValue));\n  const [v, setV] = React.useState(() => clone(defaultValue));\n  const [copyFrom, setCopyFrom] = React.useState<number | null>(null);\n  const [copyTo, setCopyTo] = React.useState<number[]>([]);\n  const [newDate, setNewDate] = React.useState(\"\");\n  const [status, setStatus] = React.useState<\"idle\" | \"saving\" | \"saved\">(\"idle\");\n  const timer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n  const focusOnce = React.useCallback((el: HTMLElement | null) => el?.focus({ preventScroll: true }), []);\n\n  React.useEffect(() => {\n    if (status !== \"saved\") return;\n    const t = setTimeout(() => setStatus(\"idle\"), 2000);\n    return () => clearTimeout(t);\n  }, [status]);\n  React.useEffect(\n    () => () => {\n      if (timer.current) clearTimeout(timer.current);\n    },\n    [],\n  );\n  React.useEffect(() => {\n    if (copyFrom === null) return;\n    const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setCopyFrom(null);\n    document.addEventListener(\"keydown\", onKey);\n    return () => document.removeEventListener(\"keydown\", onKey);\n  }, [copyFrom]);\n\n  const dirty = JSON.stringify(v) !== JSON.stringify(saved);\n  const errors = v.days.flatMap((d, di) => (d.on ? d.ranges.map((_, ri) => rangeError(d.ranges, ri)).filter(Boolean).map(() => di) : []));\n  const total = v.days.reduce((sum, d) => sum + (d.on ? d.ranges.reduce((s, r) => s + Math.max(0, mins(r.end) - mins(r.start)), 0) : 0), 0) / 60;\n\n  const setDay = (i: number, fn: (d: Day) => Day) => setV((s) => ({ ...s, days: s.days.map((d, j) => (j === i ? fn(d) : d)) }));\n  const addRange = (i: number) =>\n    setDay(i, (d) => {\n      const last = d.ranges[d.ranges.length - 1];\n      const start = last ? Math.min(mins(last.end) + 60, 21 * 60) : 9 * 60;\n      return { ...d, on: true, ranges: [...d.ranges, { start: hm(start), end: hm(Math.min(start + 60, 22 * 60)) }] };\n    });\n  const applyCopy = () => {\n    if (copyFrom === null) return;\n    const src = v.days[copyFrom];\n    setV((s) => ({ ...s, days: s.days.map((d, j) => (copyTo.includes(j) ? { on: src.on, ranges: src.ranges.map((r) => ({ ...r })) } : d)) }));\n    setCopyFrom(null);\n  };\n  const save = () => {\n    if (!dirty || errors.length || status === \"saving\") return;\n    setStatus(\"saving\");\n    const snap = clone(v);\n    const done = () => {\n      setSaved(snap);\n      setStatus(\"saved\");\n    };\n    const r = onSave?.(snap);\n    if (r instanceof Promise) r.then(done, () => setStatus(\"idle\"));\n    else timer.current = setTimeout(done, reduce ? 0 : 700);\n  };\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.card } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const btn = cn(\"flex h-9 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3.5 text-[13px] font-medium disabled:cursor-not-allowed disabled:opacity-40\", focus);\n  const iconBtn = cn(\"grid h-8 w-8 shrink-0 cursor-pointer place-items-center rounded-lg border-0 bg-transparent\", focus);\n  const sel = (bad: boolean) => cn(\"h-9 cursor-pointer rounded-lg border px-2 text-[13px] tabular-nums\", focus, bad && \"border-[var(--bad)]\");\n  const fold = { initial: reduce ? false : { height: 0, opacity: 0 }, animate: { height: \"auto\", opacity: 1 }, exit: reduce ? undefined : { height: 0, opacity: 0 }, transition: { duration: 0.18 } } as const;\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto grid max-w-5xl grid-cols-[minmax(0,1fr)] gap-6 px-4 py-10 @[900px]:grid-cols-[minmax(0,1fr)_280px] @[640px]:px-6\">\n        <div className=\"min-w-0\">\n          <header className=\"flex flex-wrap items-end justify-between gap-3\">\n            <div>\n              <h2 className=\"m-0 text-[22px] font-semibold tracking-[-0.01em]\">Working hours</h2>\n              <p className=\"m-0 mt-1 text-[13.5px]\" style={{ color: p.muted }}>\n                When {name.split(\" \")[0]} can be booked. Meetings outside these hours need approval.\n              </p>\n            </div>\n            <label className=\"flex flex-col gap-1 text-[12px]\" style={{ color: p.faint }}>\n              Time zone\n              <select value={v.timezone} onChange={(e) => setV((s) => ({ ...s, timezone: e.target.value }))} className={cn(sel(false), \"max-w-[240px]\")} style={{ borderColor: p.border, background: p.card, color: p.text, ...ring }}>\n                {ZONES.map((z) => (\n                  <option key={z}>{z}</option>\n                ))}\n              </select>\n            </label>\n          </header>\n\n          <ul className=\"m-0 mt-6 flex list-none flex-col rounded-2xl border p-0\" style={{ borderColor: p.border, background: p.card }}>\n            {v.days.map((d, di) => (\n              <li key={DAYS[di]} className={cn(\"relative flex flex-col gap-3 px-4 py-4 @[640px]:flex-row @[640px]:items-start @[640px]:px-5\", di > 0 && \"border-t\")} style={{ borderColor: p.border }}>\n                <div className=\"flex w-36 shrink-0 items-center gap-3 @[640px]:pt-1.5\">\n                  <button type=\"button\" role=\"switch\" aria-checked={d.on} aria-label={`${DAYS[di]} available`} onClick={() => setDay(di, (x) => ({ ...x, on: !x.on }))} className={cn(\"relative h-5 w-9 shrink-0 cursor-pointer rounded-full border-0 transition-colors\", focus)} style={{ background: d.on ? p.green : p.track, ...ring }}>\n                    <motion.span className=\"absolute top-0.5 h-4 w-4 rounded-full bg-white shadow\" initial={false} animate={{ left: d.on ? 18 : 2 }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 600, damping: 34 }} />\n                  </button>\n                  <span className=\"text-[13.5px] font-medium\" style={{ color: d.on ? p.text : p.faint }}>\n                    {DAYS[di]}\n                  </span>\n                </div>\n                <div className=\"min-w-0 flex-1\">\n                  {d.on ? (\n                    <ul className=\"m-0 flex list-none flex-col gap-2 p-0\">\n                      <AnimatePresence initial={false}>\n                        {d.ranges.map((r, ri) => {\n                          const err = rangeError(d.ranges, ri);\n                          return (\n                            <motion.li key={ri} {...fold} className=\"overflow-hidden\">\n                              <div className=\"flex flex-wrap items-center gap-2\" style={{ [\"--bad\" as string]: p.red }}>\n                                <label className=\"sr-only\" htmlFor={`${uid}-${di}-${ri}-s`}>\n                                  {DAYS[di]} range {ri + 1} start\n                                </label>\n                                <select id={`${uid}-${di}-${ri}-s`} value={r.start} aria-invalid={!!err} onChange={(e) => setDay(di, (x) => ({ ...x, ranges: x.ranges.map((y, k) => (k === ri ? { ...y, start: e.target.value } : y)) }))} className={sel(!!err)} style={{ borderColor: err ? p.red : p.border, background: p.input, color: p.text, ...ring }}>\n                                  {TIMES.map((t) => (\n                                    <option key={t} value={t}>\n                                      {label(t)}\n                                    </option>\n                                  ))}\n                                </select>\n                                <span style={{ color: p.faint }} aria-hidden=\"true\">\n                                  –\n                                </span>\n                                <label className=\"sr-only\" htmlFor={`${uid}-${di}-${ri}-e`}>\n                                  {DAYS[di]} range {ri + 1} end\n                                </label>\n                                <select id={`${uid}-${di}-${ri}-e`} value={r.end} aria-invalid={!!err} aria-describedby={err ? `${uid}-${di}-${ri}-x` : undefined} onChange={(e) => setDay(di, (x) => ({ ...x, ranges: x.ranges.map((y, k) => (k === ri ? { ...y, end: e.target.value } : y)) }))} className={sel(!!err)} style={{ borderColor: err ? p.red : p.border, background: p.input, color: p.text, ...ring }}>\n                                  {END_TIMES.map((t) => (\n                                    <option key={t} value={t}>\n                                      {label(t)}\n                                    </option>\n                                  ))}\n                                </select>\n                                <button type=\"button\" onClick={() => setDay(di, (x) => ({ ...x, on: x.ranges.length > 1, ranges: x.ranges.length > 1 ? x.ranges.filter((_, k) => k !== ri) : x.ranges }))} aria-label={`Remove ${DAYS[di]} range ${ri + 1}`} className={iconBtn} style={{ color: p.faint, ...ring }}>\n                                  <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n                                    <path d=\"M6 6l12 12M18 6 6 18\" />\n                                  </svg>\n                                </button>\n                                {err && (\n                                  <span id={`${uid}-${di}-${ri}-x`} className=\"text-[12px]\" style={{ color: p.red }}>\n                                    {err}\n                                  </span>\n                                )}\n                              </div>\n                            </motion.li>\n                          );\n                        })}\n                      </AnimatePresence>\n                    </ul>\n                  ) : (\n                    <p className=\"m-0 text-[13px] @[640px]:pt-2\" style={{ color: p.faint }}>\n                      Unavailable\n                    </p>\n                  )}\n                </div>\n                <div className=\"absolute top-3.5 right-3 flex items-center gap-0.5 @[640px]:static @[640px]:pt-0.5\">\n                  <button type=\"button\" onClick={() => addRange(di)} aria-label={`Add a range on ${DAYS[di]}`} className={iconBtn} style={{ color: p.muted, ...ring }}>\n                    <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n                      <path d=\"M12 5v14M5 12h14\" />\n                    </svg>\n                  </button>\n                  <div className=\"relative\">\n                    <button\n                      type=\"button\"\n                      onClick={() => {\n                        setCopyFrom(copyFrom === di ? null : di);\n                        setCopyTo([]);\n                      }}\n                      aria-expanded={copyFrom === di}\n                      aria-label={`Copy ${DAYS[di]} to other days`}\n                      className={iconBtn}\n                      style={{ color: p.muted, ...ring }}\n                    >\n                      <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.9\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                        <rect x=\"8\" y=\"8\" width=\"12\" height=\"12\" rx=\"2\" />\n                        <path d=\"M16 8V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h3\" />\n                      </svg>\n                    </button>\n                    <AnimatePresence>\n                      {copyFrom === di && (\n                        <motion.div key=\"copy\" role=\"dialog\" aria-label={`Copy ${DAYS[di]} hours to`} initial={reduce ? false : { opacity: 0, y: -4, scale: 0.98 }} animate={{ opacity: 1, y: 0, scale: 1 }} exit={reduce ? undefined : { opacity: 0, y: -4, scale: 0.98 }} transition={{ duration: 0.14 }} className=\"absolute top-full right-0 z-20 mt-1.5 w-52 origin-top-right rounded-xl border p-2 shadow-[0_16px_40px_-12px_rgba(0,0,0,0.55)]\" style={{ background: p.menu, borderColor: p.border }}>\n                          <p className=\"m-0 px-2 pt-1 pb-1.5 text-[11.5px] font-medium tracking-[0.04em] uppercase\" style={{ color: p.faint }}>\n                            Copy to\n                          </p>\n                          {DAYS.map((name, j) =>\n                            j === di ? null : (\n                              <label key={name} className=\"flex cursor-pointer items-center gap-2.5 rounded-lg px-2 py-1.5 text-[13px] has-[:focus-visible]:ring-2\" style={ring}>\n                                <input type=\"checkbox\" checked={copyTo.includes(j)} onChange={() => setCopyTo((c) => (c.includes(j) ? c.filter((x) => x !== j) : [...c, j]))} className=\"h-4 w-4 cursor-pointer\" style={{ accentColor: p.accent }} ref={copyTo.length === 0 && j === (di === 0 ? 1 : 0) ? focusOnce : undefined} />\n                                {name}\n                              </label>\n                            ),\n                          )}\n                          <div className=\"mt-1.5 flex gap-1.5 border-t pt-2\" style={{ borderColor: p.border }}>\n                            <button type=\"button\" onClick={() => setCopyTo(DAYS.map((_, j) => j).filter((j) => j !== di && j < 5))} className={cn(btn, \"h-8 flex-1 border bg-transparent px-2 text-[12px]\")} style={{ borderColor: p.border, color: p.text, ...ring }}>\n                              Weekdays\n                            </button>\n                            <button type=\"button\" disabled={!copyTo.length} onClick={applyCopy} className={cn(btn, \"h-8 flex-1 border-0 px-2 text-[12px]\")} style={{ background: p.on, color: p.onText, ...ring }}>\n                              Apply\n                            </button>\n                          </div>\n                        </motion.div>\n                      )}\n                    </AnimatePresence>\n                  </div>\n                </div>\n              </li>\n            ))}\n          </ul>\n\n          {/* Overrides */}\n          <div className=\"mt-6 rounded-2xl border p-4 @[640px]:p-5\" style={{ borderColor: p.border, background: p.card }}>\n            <div className=\"flex flex-wrap items-end justify-between gap-3\">\n              <div>\n                <h3 className=\"m-0 text-[14.5px] font-semibold\">Days off</h3>\n                <p className=\"m-0 mt-0.5 text-[12.5px]\" style={{ color: p.muted }}>\n                  Dates when nobody can book, whatever the weekly hours say.\n                </p>\n              </div>\n              <form\n                onSubmit={(e) => {\n                  e.preventDefault();\n                  if (newDate && !v.overrides.includes(newDate)) setV((s) => ({ ...s, overrides: [...s.overrides, newDate].sort() }));\n                  setNewDate(\"\");\n                }}\n                className=\"flex gap-2\"\n              >\n                <label htmlFor={`${uid}-date`} className=\"sr-only\">\n                  Date off\n                </label>\n                <input id={`${uid}-date`} type=\"date\" min={today} value={newDate} onChange={(e) => setNewDate(e.target.value)} className={cn(\"h-9 rounded-lg border px-2.5 text-[13px] [color-scheme:var(--cs)]\", focus)} style={{ borderColor: p.border, background: p.input, color: p.text, [\"--cs\" as string]: theme, ...ring }} />\n                <button type=\"submit\" disabled={!newDate} className={cn(btn, \"border bg-transparent\")} style={{ borderColor: p.border, color: p.text, ...ring }}>\n                  Add\n                </button>\n              </form>\n            </div>\n            <ul className=\"m-0 mt-4 flex list-none flex-wrap gap-2 p-0\">\n              <AnimatePresence initial={false}>\n                {v.overrides.map((d) => (\n                  <motion.li key={d} layout={!reduce} initial={reduce ? false : { opacity: 0, scale: 0.9 }} animate={{ opacity: 1, scale: 1 }} exit={reduce ? undefined : { opacity: 0, scale: 0.9 }} className=\"flex items-center gap-1.5 rounded-full border py-1 pr-1 pl-3 text-[12.5px]\" style={{ borderColor: p.border }}>\n                    {dateLabel(d)}\n                    <button type=\"button\" onClick={() => setV((s) => ({ ...s, overrides: s.overrides.filter((x) => x !== d) }))} aria-label={`Remove ${dateLabel(d)}`} className={cn(\"grid h-6 w-6 cursor-pointer place-items-center rounded-full border-0 bg-transparent\", focus)} style={{ color: p.faint, ...ring }}>\n                      ×\n                    </button>\n                  </motion.li>\n                ))}\n              </AnimatePresence>\n              {!v.overrides.length && (\n                <li className=\"text-[12.5px]\" style={{ color: p.faint }}>\n                  No days off planned.\n                </li>\n              )}\n            </ul>\n          </div>\n        </div>\n\n        {/* Preview */}\n        <aside className=\"@[900px]:sticky @[900px]:top-6 @[900px]:self-start\" aria-labelledby={`${uid}-pv`}>\n          <div className=\"rounded-2xl border p-5\" style={{ borderColor: p.border, background: p.card }}>\n            <div className=\"flex items-baseline justify-between\">\n              <h3 id={`${uid}-pv`} className=\"m-0 text-[13.5px] font-semibold\">\n                This week\n              </h3>\n              <span className=\"text-[12.5px] tabular-nums\" style={{ color: p.muted }}>\n                {Number.isInteger(total) ? total : total.toFixed(1)} h\n              </span>\n            </div>\n            <div className=\"mt-4 grid grid-cols-[28px_repeat(7,minmax(0,1fr))] gap-1.5\" role=\"img\" aria-label={`${total} hours a week across ${v.days.filter((d) => d.on).length} days`}>\n              <div className=\"relative h-48 text-[10px]\" style={{ color: p.faint }}>\n                {[\"6a\", \"10a\", \"2p\", \"6p\", \"10p\"].map((t, i) => (\n                  <span key={t} className=\"absolute -translate-y-1/2\" style={{ top: `${i * 25}%` }}>\n                    {t}\n                  </span>\n                ))}\n              </div>\n              {v.days.map((d, di) => (\n                <div key={di} className=\"flex flex-col items-center gap-1.5\">\n                  <div className=\"relative h-48 w-full overflow-hidden rounded-md\" style={{ background: p.track }}>\n                    {d.on &&\n                      d.ranges.map((r, ri) => {\n                        const bad = !!rangeError(d.ranges, ri);\n                        return <motion.span key={ri} className=\"absolute inset-x-0.5 rounded-[3px]\" initial={false} animate={{ top: `${((mins(r.start) - 360) / 960) * 100}%`, height: `${Math.max(0, (mins(r.end) - mins(r.start)) / 960) * 100}%` }} transition={{ duration: reduce ? 0 : 0.3 }} style={{ background: bad ? p.red : p.green, opacity: 0.85 }} />;\n                      })}\n                  </div>\n                  <span className=\"text-[10.5px] font-medium\" style={{ color: d.on ? p.muted : p.faint }}>\n                    {DAYS[di][0]}\n                  </span>\n                </div>\n              ))}\n            </div>\n            <p className=\"m-0 mt-4 text-[12px] leading-[1.5]\" style={{ color: p.faint }}>\n              {v.timezone.split(\" \")[0]} · {v.overrides.length ? `${v.overrides.length} day${v.overrides.length > 1 ? \"s\" : \"\"} off coming up` : \"No days off\"}\n            </p>\n          </div>\n        </aside>\n      </div>\n\n      {/* Save bar */}\n      <AnimatePresence>\n        {(dirty || status !== \"idle\") && (\n          <motion.div key=\"bar\" initial={reduce ? false : { y: 20, opacity: 0 }} animate={{ y: 0, opacity: 1 }} exit={reduce ? undefined : { y: 20, opacity: 0 }} className=\"sticky bottom-4 z-10 mx-auto mb-4 max-w-5xl px-4 @[640px]:px-6\">\n            <div className=\"flex flex-wrap items-center justify-between gap-3 rounded-xl border px-4 py-3 shadow-[0_12px_32px_-12px_rgba(0,0,0,0.5)]\" style={{ background: p.menu, borderColor: errors.length ? `${p.red}66` : p.border }}>\n              <p role=\"status\" className=\"m-0 text-[13px] font-medium\" style={{ color: status === \"saved\" && !dirty ? p.green : errors.length ? p.red : p.text }}>\n                {status === \"saved\" && !dirty ? \"✓ Working hours saved\" : errors.length ? `Fix ${errors.length} ${errors.length === 1 ? \"range\" : \"ranges\"} before saving` : \"Unsaved changes\"}\n              </p>\n              {dirty && (\n                <div className=\"flex gap-2\">\n                  <button type=\"button\" onClick={() => setV(clone(saved))} className={cn(btn, \"border bg-transparent\")} style={{ borderColor: p.border, color: p.text, ...ring }}>\n                    Discard\n                  </button>\n                  <button type=\"button\" onClick={save} disabled={!!errors.length || status === \"saving\"} className={cn(btn, \"min-w-[72px] border-0\")} style={{ background: p.on, color: p.onText, ...ring }}>\n                    {status === \"saving\" ? \"Saving…\" : \"Save\"}\n                  </button>\n                </div>\n              )}\n            </div>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </section>\n  );\n}\n\nexport default UserSchedule;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}