{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "workflow-builder",
  "title": "Workflow Builder Block",
  "description": "An automation builder on a dotted canvas: a trigger, steps and an if/else condition that splits into Yes and No branches, + buttons on every line that insert emails, waits, webhooks and more, an inspector to rename or delete steps, a Test run that lights up each step in turn, and a Draft / Live switch.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/workflow-builder/workflow-builder.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\nexport type NodeKind = \"trigger\" | \"action\" | \"condition\" | \"wait\";\n\nexport interface FlowNode {\n  id: string;\n  kind: NodeKind;\n  title: string;\n  detail: string;\n  icon: IconName;\n}\n\nexport interface WorkflowBuilderProps {\n  name?: string;\n  trigger?: FlowNode;\n  /** Steps before the condition. */\n  steps?: FlowNode[];\n  condition?: FlowNode;\n  yes?: FlowNode[];\n  no?: FlowNode[];\n  onPublish?: (live: boolean) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\ntype IconName = \"form\" | \"sparkle\" | \"split\" | \"deal\" | \"chat\" | \"mail\" | \"clock\" | \"webhook\" | \"tag\" | \"user\";\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\", node: \"#171717\", border: \"rgba(255,255,255,0.1)\", line: \"rgba(255,255,255,0.16)\", chip: \"rgba(255,255,255,0.06)\", dots: \"rgba(255,255,255,0.07)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", green: \"#4ADE80\", amber: \"#FBBF24\", accent: \"#FB923C\", ring: \"rgba(245,244,241,0.6)\", input: \"#0D0D0D\", shadow: \"0 18px 40px -18px rgba(0,0,0,0.8)\" },\n  light: { bg: \"#F6F6F3\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", card: \"#FFFFFF\", node: \"#FFFFFF\", border: \"rgba(10,10,10,0.1)\", line: \"rgba(10,10,10,0.18)\", chip: \"rgba(10,10,10,0.05)\", dots: \"rgba(10,10,10,0.08)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", green: \"#15803D\", amber: \"#B45309\", accent: \"#EA580C\", ring: \"rgba(10,10,10,0.5)\", input: \"#FAFAF8\", shadow: \"0 18px 40px -22px rgba(0,0,0,0.25)\" },\n};\nconst KIND_COLOR: Record<NodeKind, string> = { trigger: \"#FB923C\", action: \"#60A5FA\", condition: \"#A78BFA\", wait: \"#FBBF24\" };\nconst ICONS: Record<IconName, string> = {\n  form: \"M6 3h12v18H6zM9 8h6M9 12h6M9 16h3\",\n  sparkle: \"M12 3c.4 4.6 2.4 7.6 7 8-4.6.4-6.6 3.4-7 8-.4-4.6-2.4-7.6-7-8 4.6-.4 6.6-3.4 7-8Z\",\n  split: \"M6 3v6a4 4 0 0 0 4 4h4a4 4 0 0 1 4 4v4M6 21v-8M18 3v4\",\n  deal: \"M3 12h4l3-6 4 12 3-6h4\",\n  chat: \"M4 5h16v11H8l-4 4V5Z\",\n  mail: \"M3 7l9 6 9-6M4 5h16v14H4z\",\n  clock: \"M12 7v5l3 2M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z\",\n  webhook: \"M10 14a3 3 0 1 1 4 0l3 5M7 18a3 3 0 1 1 1-5l4-6M17 18h-5\",\n  tag: \"M3 12V4h8l10 10-8 8L3 12Zm5-4h.01\",\n  user: \"M4 20a8 8 0 0 1 16 0M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z\",\n};\nconst LIBRARY: { title: string; detail: string; icon: IconName; kind: NodeKind }[] = [\n  { title: \"Send email\", detail: \"Template: Welcome\", icon: \"mail\", kind: \"action\" },\n  { title: \"Wait\", detail: \"1 day\", icon: \"clock\", kind: \"wait\" },\n  { title: \"Call webhook\", detail: \"POST /hooks/leads\", icon: \"webhook\", kind: \"action\" },\n  { title: \"Add tag\", detail: \"hot-lead\", icon: \"tag\", kind: \"action\" },\n  { title: \"Assign owner\", detail: \"Round robin · Sales\", icon: \"user\", kind: \"action\" },\n];\n\nconst DEFAULT_TRIGGER: FlowNode = { id: \"t\", kind: \"trigger\", title: \"Form submitted\", detail: \"Demo request form\", icon: \"form\" };\nconst DEFAULT_STEPS: FlowNode[] = [{ id: \"s1\", kind: \"action\", title: \"Enrich contact\", detail: \"Company, size and role\", icon: \"sparkle\" }];\nconst DEFAULT_CONDITION: FlowNode = { id: \"c\", kind: \"condition\", title: \"Company size over 50\", detail: \"If employees > 50\", icon: \"split\" };\nconst DEFAULT_YES: FlowNode[] = [\n  { id: \"y1\", kind: \"action\", title: \"Create deal\", detail: \"Pipeline: Enterprise\", icon: \"deal\" },\n  { id: \"y2\", kind: \"action\", title: \"Notify #sales\", detail: \"Message the sales channel\", icon: \"chat\" },\n];\nconst DEFAULT_NO: FlowNode[] = [{ id: \"n1\", kind: \"action\", title: \"Add to nurture\", detail: \"Sequence: Small teams\", icon: \"mail\" }];\n\ntype Branch = \"main\" | \"yes\" | \"no\";\ntype RunState = Record<string, \"running\" | \"done\" | \"skipped\">;\n\nexport function WorkflowBuilder({ name = \"Route new demo requests\", trigger = DEFAULT_TRIGGER, steps = DEFAULT_STEPS, condition = DEFAULT_CONDITION, yes = DEFAULT_YES, no = DEFAULT_NO, onPublish, theme = \"dark\", className }: WorkflowBuilderProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const [flow, setFlow] = React.useState<{ main: FlowNode[]; yes: FlowNode[]; no: FlowNode[] }>({ main: steps, yes, no });\n  const [selected, setSelected] = React.useState<string | null>(null);\n  const [adding, setAdding] = React.useState<{ branch: Branch; index: number } | null>(null);\n  const [run, setRun] = React.useState<RunState>({});\n  const [pulse, setPulse] = React.useState<string | null>(null);\n  const [log, setLog] = React.useState<string | null>(null);\n  const [running, setRunning] = React.useState(false);\n  const [live, setLive] = React.useState(false);\n  const [runCount, setRunCount] = React.useState(41);\n  const seq = React.useRef(0);\n  const focusMenu = React.useCallback((el: HTMLButtonElement | null) => el?.focus({ preventScroll: true }), []);\n  const timers = React.useRef<ReturnType<typeof setTimeout>[]>([]);\n  React.useEffect(() => () => timers.current.forEach(clearTimeout), []);\n\n  const all = [trigger, ...flow.main, condition, ...flow.yes, ...flow.no];\n  const sel = all.find((n) => n.id === selected) ?? null;\n  const branchOf = (id: string): Branch | null => (flow.main.some((n) => n.id === id) ? \"main\" : flow.yes.some((n) => n.id === id) ? \"yes\" : flow.no.some((n) => n.id === id) ? \"no\" : null);\n\n  const insert = (branch: Branch, index: number, item: (typeof LIBRARY)[number]) => {\n    seq.current += 1;\n    const node: FlowNode = { id: `new-${seq.current}`, ...item };\n    setFlow((f) => ({ ...f, [branch]: [...f[branch].slice(0, index), node, ...f[branch].slice(index)] }));\n    setAdding(null);\n    setSelected(node.id);\n  };\n  const remove = (id: string) => {\n    const b = branchOf(id);\n    if (!b) return;\n    setFlow((f) => ({ ...f, [b]: f[b].filter((n) => n.id !== id) }));\n    setSelected(null);\n  };\n  const update = (id: string, patch: Partial<FlowNode>) => {\n    const b = branchOf(id);\n    if (!b) return;\n    setFlow((f) => ({ ...f, [b]: f[b].map((n) => (n.id === id ? { ...n, ...patch } : n)) }));\n  };\n\n  const test = () => {\n    if (running) return;\n    timers.current.forEach(clearTimeout);\n    timers.current = [];\n    setRunning(true);\n    setLog(null);\n    setSelected(null);\n    setAdding(null);\n    const order = [trigger, ...flow.main, condition, ...flow.yes];\n    const step = reduce ? 80 : 520;\n    const state: RunState = {};\n    flow.no.forEach((n) => (state[n.id] = \"skipped\"));\n    setRun({});\n    order.forEach((n, i) => {\n      timers.current.push(\n        setTimeout(() => {\n          setPulse(n.id);\n          setRun((r) => ({ ...r, [n.id]: \"running\" }));\n        }, i * step),\n      );\n      timers.current.push(setTimeout(() => setRun((r) => ({ ...r, [n.id]: \"done\", ...(n.id === condition.id ? state : {}) })), i * step + step * 0.7));\n    });\n    timers.current.push(\n      setTimeout(\n        () => {\n          setRunning(false);\n          setPulse(null);\n          setRunCount((c) => c + 1);\n          setLog(`Run #${runCount + 1} succeeded in ${((order.length * step) / 1000).toFixed(1)}s · took the Yes branch`);\n        },\n        order.length * step + 200,\n      ),\n    );\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 glyph = (i: IconName, size = 15) => (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      <path d={ICONS[i]} />\n    </svg>\n  );\n\n  const nodeCard = (n: FlowNode) => {\n    const st = run[n.id];\n    const isSel = selected === n.id;\n    const c = KIND_COLOR[n.kind];\n    return (\n      <motion.div key={n.id} layout={!reduce} initial={reduce ? false : { opacity: 0, scale: 0.92 }} animate={{ opacity: st === \"skipped\" ? 0.4 : 1, scale: 1 }} exit={reduce ? undefined : { opacity: 0, scale: 0.9 }} transition={{ duration: 0.22 }} className=\"relative w-full max-w-[260px]\">\n        {st === \"running\" && !reduce && <motion.span className=\"absolute -inset-1 rounded-[14px]\" style={{ border: `1.5px solid ${c}` }} initial={{ opacity: 0.9, scale: 0.98 }} animate={{ opacity: 0, scale: 1.06 }} transition={{ duration: 0.7, repeat: Infinity }} aria-hidden=\"true\" />}\n        <button\n          type=\"button\"\n          onClick={() => {\n            setSelected(isSel ? null : n.id);\n            setAdding(null);\n          }}\n          aria-pressed={isSel}\n          className={cn(\"relative flex w-full cursor-pointer items-center gap-3 rounded-xl border px-2.5 py-2.5 text-left transition-colors @[560px]:px-3\", focus)}\n          style={{ background: p.node, borderColor: isSel ? p.text : st === \"running\" ? c : p.border, boxShadow: p.shadow, color: p.text, ...ring }}\n        >\n          <span className=\"hidden h-8 w-8 shrink-0 items-center justify-center rounded-lg @[560px]:flex\" style={{ background: `${c}22`, color: c }}>\n            {glyph(n.icon)}\n          </span>\n          <span className=\"min-w-0 flex-1\">\n            <span className=\"block text-[10.5px] font-medium tracking-wide uppercase\" style={{ color: c }}>\n              {n.kind === \"trigger\" ? \"When\" : n.kind === \"condition\" ? \"If\" : n.kind === \"wait\" ? \"Wait\" : \"Then\"}\n            </span>\n            <span className=\"block truncate text-[13.5px] font-medium\">{n.title}</span>\n            <span className=\"block truncate text-[11.5px]\" style={{ color: p.faint }}>\n              {n.detail}\n            </span>\n          </span>\n          <AnimatePresence>\n            {st === \"done\" && (\n              <motion.span initial={reduce ? false : { scale: 0 }} animate={{ scale: 1 }} exit={{ scale: 0 }} className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full\" style={{ background: p.green }} aria-label=\"Succeeded\">\n                <svg width=\"10\" height=\"10\" viewBox=\"0 0 16 16\" fill=\"none\" stroke={p.onText} strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                  <path d=\"m3 8.5 3 3 7-7\" />\n                </svg>\n              </motion.span>\n            )}\n          </AnimatePresence>\n        </button>\n      </motion.div>\n    );\n  };\n\n  const connector = (branch: Branch, index: number, toId: string | null, short = false) => {\n    const isAdding = adding?.branch === branch && adding.index === index;\n    return (\n      <div className={cn(\"relative flex w-full flex-col items-center\", short ? \"h-8\" : \"h-12\")}>\n        <span className=\"absolute top-0 bottom-0 w-px\" style={{ background: p.line }} aria-hidden=\"true\" />\n        {toId && pulse === toId && !reduce && <motion.span className=\"absolute h-2 w-2 rounded-full\" style={{ background: p.accent, boxShadow: `0 0 10px ${p.accent}` }} initial={{ top: 0, opacity: 1 }} animate={{ top: \"100%\", opacity: 0.8 }} transition={{ duration: 0.35, ease: \"easeIn\" }} aria-hidden=\"true\" />}\n        <button\n          type=\"button\"\n          aria-label={`Add a step here (${branch === \"main\" ? \"main path\" : branch === \"yes\" ? \"Yes branch\" : \"No branch\"})`}\n          aria-expanded={isAdding}\n          onClick={() => {\n            setAdding(isAdding ? null : { branch, index });\n            setSelected(null);\n          }}\n          disabled={running}\n          className={cn(\"relative z-10 my-auto flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border text-[12px] leading-none transition-transform hover:scale-125 disabled:cursor-default\", focus)}\n          style={{ background: isAdding ? p.on : p.card, borderColor: isAdding ? p.on : p.line, color: isAdding ? p.onText : p.muted, ...ring }}\n        >\n          +\n        </button>\n        <AnimatePresence>\n          {isAdding && (\n            <motion.div initial={reduce ? false : { opacity: 0, y: -4, scale: 0.97 }} animate={{ opacity: 1, y: 0, scale: 1 }} exit={reduce ? undefined : { opacity: 0, y: -4 }} className=\"absolute top-1/2 left-1/2 z-30 mt-4 w-56 -translate-x-1/2 rounded-xl border p-1.5\" style={{ background: p.card, borderColor: p.border, boxShadow: p.shadow }} role=\"menu\" aria-label=\"Add a step\">\n              {LIBRARY.map((item, i) => (\n                <button key={item.title} ref={i === 0 ? focusMenu : undefined} type=\"button\" role=\"menuitem\" onClick={() => insert(branch, index, item)} onKeyDown={(e) => e.key === \"Escape\" && setAdding(null)} className={cn(\"flex w-full cursor-pointer items-center gap-2.5 rounded-lg border-0 bg-transparent px-2 py-1.5 text-left text-[13px] hover:bg-[var(--wf-h)]\", focus)} style={{ color: p.text, [\"--wf-h\" as string]: p.chip, ...ring }}>\n                  <span className=\"flex h-6 w-6 items-center justify-center rounded-md\" style={{ background: `${KIND_COLOR[item.kind]}22`, color: KIND_COLOR[item.kind] }}>\n                    {glyph(item.icon, 13)}\n                  </span>\n                  {item.title}\n                </button>\n              ))}\n            </motion.div>\n          )}\n        </AnimatePresence>\n      </div>\n    );\n  };\n\n  const branchCol = (branch: \"yes\" | \"no\", nodes: FlowNode[]) => (\n    <div className=\"flex min-w-0 flex-1 flex-col items-center\">\n      <span className=\"mb-1 rounded-full px-2 py-0.5 text-[11px] font-semibold\" style={{ background: p.chip, color: branch === \"yes\" ? p.green : p.faint }}>\n        {branch === \"yes\" ? \"Yes\" : \"No\"}\n      </span>\n      {connector(branch, 0, nodes[0]?.id ?? null, true)}\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        {nodes.map((n, i) => (\n          <React.Fragment key={n.id}>\n            {nodeCard(n)}\n            {connector(branch, i + 1, nodes[i + 1]?.id ?? null, true)}\n          </React.Fragment>\n        ))}\n      </AnimatePresence>\n      <span className=\"h-2.5 w-2.5 rounded-full border\" style={{ borderColor: p.line }} aria-hidden=\"true\" />\n    </div>\n  );\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto max-w-6xl px-4 py-10 @[640px]:px-6 @[640px]:py-14\">\n        <div className=\"overflow-hidden rounded-2xl border\" style={{ background: p.card, borderColor: p.border }}>\n          {/* Toolbar */}\n          <div className=\"flex flex-wrap items-center justify-between gap-3 border-b px-4 py-3 @[640px]:px-5\" style={{ borderColor: p.border }}>\n            <div className=\"min-w-0\">\n              <p className=\"m-0 truncate text-[15px] font-semibold tracking-[-0.01em]\">{name}</p>\n              <p className=\"m-0 text-[12px]\" style={{ color: p.faint }}>\n                {all.length} steps · {runCount} runs\n              </p>\n            </div>\n            <div className=\"flex items-center gap-2\">\n              <button\n                type=\"button\"\n                role=\"switch\"\n                aria-checked={live}\n                onClick={() => {\n                  setLive((l) => !l);\n                  onPublish?.(!live);\n                }}\n                className={cn(\"flex h-8 cursor-pointer items-center gap-2 rounded-lg border bg-transparent px-2.5 text-[12.5px]\", focus)}\n                style={{ borderColor: p.border, color: live ? p.green : p.muted, ...ring }}\n              >\n                <span className=\"relative h-4 w-7 rounded-full transition-colors\" style={{ background: live ? p.green : p.chip }} aria-hidden=\"true\">\n                  <motion.span className=\"absolute top-0.5 h-3 w-3 rounded-full\" style={{ background: live ? p.onText : p.faint }} initial={false} animate={{ left: live ? 14 : 2 }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 600, damping: 34 }} />\n                </span>\n                {live ? \"Live\" : \"Draft\"}\n              </button>\n              <button type=\"button\" onClick={test} disabled={running} className={cn(\"flex h-8 cursor-pointer items-center gap-1.5 rounded-lg border-0 px-3 text-[12.5px] font-medium disabled:cursor-wait disabled:opacity-60\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n                <svg width=\"11\" height=\"11\" viewBox=\"0 0 16 16\" fill=\"currentColor\" aria-hidden=\"true\">\n                  <path d=\"M4 2.5v11l9-5.5z\" />\n                </svg>\n                {running ? \"Running…\" : \"Test run\"}\n              </button>\n            </div>\n          </div>\n\n          <div className=\"grid @[900px]:grid-cols-[1fr_280px]\">\n            {/* Canvas */}\n            <div className=\"relative min-h-[560px] px-3 py-8 @[560px]:px-4\" style={{ backgroundImage: `radial-gradient(${p.dots} 1px, transparent 1px)`, backgroundSize: \"18px 18px\" }}>\n              <div className=\"mx-auto flex max-w-[620px] flex-col items-center\">\n                {nodeCard(trigger)}\n                {connector(\"main\", 0, flow.main[0]?.id ?? condition.id)}\n                <AnimatePresence initial={false} mode=\"popLayout\">\n                  {flow.main.map((n, i) => (\n                    <React.Fragment key={n.id}>\n                      {nodeCard(n)}\n                      {connector(\"main\", i + 1, flow.main[i + 1]?.id ?? condition.id)}\n                    </React.Fragment>\n                  ))}\n                </AnimatePresence>\n                {nodeCard(condition)}\n                <div className=\"relative mt-0 flex w-full gap-3 pt-6 @[560px]:gap-6\">\n                  <span className=\"absolute top-0 left-1/2 h-6 w-px\" style={{ background: p.line }} aria-hidden=\"true\" />\n                  <span className=\"absolute top-6 right-1/4 left-1/4 h-px\" style={{ background: p.line }} aria-hidden=\"true\" />\n                  <div className=\"absolute top-6 left-1/4 h-3 w-px\" style={{ background: p.line }} aria-hidden=\"true\" />\n                  <div className=\"absolute top-6 right-1/4 h-3 w-px\" style={{ background: p.line }} aria-hidden=\"true\" />\n                  <div className=\"flex w-full gap-3 pt-3 @[560px]:gap-6\">\n                    {branchCol(\"yes\", flow.yes)}\n                    {branchCol(\"no\", flow.no)}\n                  </div>\n                </div>\n              </div>\n              <AnimatePresence>\n                {log && (\n                  <motion.p initial={reduce ? false : { opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0 }} className=\"sticky bottom-0 mx-auto mt-6 flex w-fit items-center gap-2 rounded-full border px-3.5 py-1.5 text-[12.5px]\" style={{ background: p.card, borderColor: p.border, color: p.text }} role=\"status\">\n                    <span className=\"h-1.5 w-1.5 rounded-full\" style={{ background: p.green }} aria-hidden=\"true\" />\n                    {log}\n                  </motion.p>\n                )}\n              </AnimatePresence>\n            </div>\n\n            {/* Inspector */}\n            <aside className=\"border-t p-5 @[900px]:border-t-0 @[900px]:border-l\" style={{ borderColor: p.border }} aria-label=\"Step settings\">\n              <AnimatePresence mode=\"wait\" initial={false}>\n                {sel ? (\n                  <motion.div key={sel.id} initial={reduce ? false : { opacity: 0, x: 8 }} animate={{ opacity: 1, x: 0 }} exit={reduce ? undefined : { opacity: 0 }} transition={{ duration: 0.16 }} className=\"flex flex-col gap-4\">\n                    <div className=\"flex items-center gap-2.5\">\n                      <span className=\"flex h-8 w-8 items-center justify-center rounded-lg\" style={{ background: `${KIND_COLOR[sel.kind]}22`, color: KIND_COLOR[sel.kind] }}>\n                        {glyph(sel.icon)}\n                      </span>\n                      <p className=\"m-0 text-[14px] font-semibold capitalize\">{sel.kind} settings</p>\n                    </div>\n                    <label className=\"flex flex-col gap-1.5 text-[12.5px]\" style={{ color: p.muted }}>\n                      Name\n                      <input value={sel.title} disabled={!branchOf(sel.id)} onChange={(e) => update(sel.id, { title: e.target.value })} className={cn(\"h-9 rounded-lg border px-3 text-[13px] disabled:opacity-60\", focus)} style={{ borderColor: p.border, background: p.input, color: p.text, ...ring }} />\n                    </label>\n                    <label className=\"flex flex-col gap-1.5 text-[12.5px]\" style={{ color: p.muted }}>\n                      {sel.kind === \"wait\" ? \"Duration\" : sel.kind === \"condition\" ? \"Rule\" : sel.kind === \"trigger\" ? \"Source\" : \"Details\"}\n                      <input value={sel.detail} disabled={!branchOf(sel.id)} onChange={(e) => update(sel.id, { detail: e.target.value })} className={cn(\"h-9 rounded-lg border px-3 text-[13px] disabled:opacity-60\", focus)} style={{ borderColor: p.border, background: p.input, color: p.text, ...ring }} />\n                    </label>\n                    {!branchOf(sel.id) ? (\n                      <p className=\"m-0 text-[12px]\" style={{ color: p.faint }}>\n                        The trigger and the condition are part of this template and cannot be removed.\n                      </p>\n                    ) : (\n                      <button type=\"button\" onClick={() => remove(sel.id)} className={cn(\"h-9 cursor-pointer rounded-lg border bg-transparent text-[13px]\", focus)} style={{ borderColor: p.border, color: \"#F87171\", ...ring }}>\n                        Delete step\n                      </button>\n                    )}\n                  </motion.div>\n                ) : (\n                  <motion.div key=\"empty\" initial={reduce ? false : { opacity: 0 }} animate={{ opacity: 1 }} exit={reduce ? undefined : { opacity: 0 }} className=\"text-[13px] leading-[1.6]\" style={{ color: p.muted }}>\n                    <p className=\"m-0 font-medium\" style={{ color: p.text }}>\n                      Build the flow\n                    </p>\n                    <p className=\"m-0 mt-1.5\">Click a step to edit it, or press + on any line to add an email, a wait, a webhook and more.</p>\n                    <ul className=\"m-0 mt-4 flex list-none flex-col gap-2 p-0 text-[12.5px]\">\n                      {(Object.keys(KIND_COLOR) as NodeKind[]).map((k) => (\n                        <li key={k} className=\"flex items-center gap-2 capitalize\">\n                          <span className=\"h-2 w-2 rounded-full\" style={{ background: KIND_COLOR[k] }} aria-hidden=\"true\" />\n                          {k}\n                        </li>\n                      ))}\n                    </ul>\n                  </motion.div>\n                )}\n              </AnimatePresence>\n            </aside>\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default WorkflowBuilder;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}