{
  "name": "ai-connect",
  "type": "registry:component",
  "dependencies": [
    "lucide-react",
    "motion"
  ],
  "files": [
    {
      "type": "registry:component",
      "content": "\"use client\";\n\n/**\n * @author: @kokonutui\n * @description: AI Connect\n * @version: 1.1.0\n * @date: 2026-10-31\n * @license: MIT\n * @website: https://kokonutui.com\n * @github: https://github.com/kokonut-labs/kokonutui\n */\n\nimport { Ban, Check, Eye, GitPullRequest, Lock, Pause, X } from \"lucide-react\";\nimport { AnimatePresence, MotionConfig, motion } from \"motion/react\";\nimport { type ReactNode, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface ConnectScope {\n  label: string;\n  /** A limit rather than a permission, shown struck through in grey. */\n  denied?: boolean;\n  icon?: ReactNode;\n}\n\n/**\n * Where the tool call is, from your app. `needs-access` shows the card;\n * `running` is the call before access was asked for, or after it was given.\n */\nexport type ConnectStatus = \"needs-access\" | \"running\" | \"done\" | \"error\";\n\nexport interface AIConnectProps {\n  /** The user's message, drawn as a bubble. Only the demo draws one by default. */\n  prompt?: string;\n  /** Your product's name, as the person knows it. */\n  agent?: string;\n  /** Your product's mark, about 18px. */\n  agentLogo?: ReactNode;\n  /** The app the tool needs, e.g. \"GitHub\". */\n  app?: string;\n  /** Its mark, about 18px. */\n  appLogo?: ReactNode;\n  /** Background of the app's tile and button, its brand colour. */\n  appColor?: string;\n  /** Why it's needed, e.g. \"to open a pull request on acme/web\". */\n  reason?: string;\n  scopes?: ConnectScope[];\n  /** The tool call, while running and once done. */\n  running?: string;\n  done?: string;\n  /** What the call works on, e.g. a repo. */\n  target?: string;\n  /** Shown on the right of the call once done, e.g. \"#142\". */\n  result?: string;\n  answer?: ReactNode;\n  /**\n   * Pass it to drive the card from your tool call. Leave it out and the demo\n   * plays through by itself.\n   */\n  status?: ConnectStatus;\n  /** Why the call failed, shown when `status` is `error`. */\n  error?: string;\n  /**\n   * Runs your OAuth flow. Resolve once connected, then retry the call and\n   * move `status` on. Throw and the card stays, with the error's message.\n   */\n  onConnect?: () => Promise<void>;\n  /** \"Not now\". Live, it only shows when you pass this. */\n  onSkip?: () => void;\n  /** What the assistant says after \"Not now\". */\n  skipped?: ReactNode;\n  className?: string;\n}\n\ntype Step =\n  | \"running\"\n  | \"blocked\"\n  | \"authorizing\"\n  | \"connected\"\n  | \"resumed\"\n  | \"done\"\n  | \"failed\"\n  | \"skipped\";\n\ntype Link = \"idle\" | \"waiting\" | \"linked\";\n\nconst EASE_OUT = [0.23, 1, 0.32, 1] as const;\nconst EASE_DRAWER = [0.32, 0.72, 0, 1] as const;\n\nfunction GitHubMark({ className }: { className?: string }) {\n  return (\n    <svg\n      aria-hidden=\"true\"\n      className={className}\n      fill=\"currentColor\"\n      viewBox=\"0 0 24 24\"\n    >\n      <path d=\"M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12\" />\n    </svg>\n  );\n}\n\nconst DEMO_SCOPES: ConnectScope[] = [\n  { label: \"Read code in kokonut/web\", icon: <Eye className=\"size-3.5\" /> },\n  {\n    label: \"Open and update pull requests\",\n    icon: <GitPullRequest className=\"size-3.5\" />,\n  },\n  {\n    label: \"Push to main or change settings\",\n    denied: true,\n    icon: <Ban className=\"size-3.5\" />,\n  },\n];\n\nconst demoConnect = () =>\n  new Promise<void>((resolve) => setTimeout(resolve, 1600));\n\nconst DEMO_TEXT = {\n  prompt: \"Open a PR with the theme fix\",\n  target: \"kokonut/web\",\n  result: \"#142\",\n  answer:\n    \"Opened #142, “Fix theme flash on load”, against main. CI is running now.\",\n  skipped:\n    \"No problem. The branch is pushed, so you can open the PR on GitHub whenever you like.\",\n};\n\ntype Shown = Pick<\n  AIConnectProps,\n  \"prompt\" | \"target\" | \"result\" | \"answer\" | \"skipped\"\n>;\n\n/** The text around the call: the demo's only when it's the demo. */\nfunction shownText(text: Shown, isDemo: boolean): Shown {\n  if (!isDemo) {\n    return text;\n  }\n  return {\n    prompt: text.prompt ?? DEMO_TEXT.prompt,\n    target: text.target ?? DEMO_TEXT.target,\n    result: text.result ?? DEMO_TEXT.result,\n    answer: text.answer ?? DEMO_TEXT.answer,\n    skipped: text.skipped ?? DEMO_TEXT.skipped,\n  };\n}\n\n/** Where the card is when your app drives it. */\nfunction drivenStep(status: ConnectStatus, step: Step): Step {\n  if (step === \"skipped\") {\n    return \"skipped\";\n  }\n  if (status === \"needs-access\") {\n    return step;\n  }\n  if (status === \"done\") {\n    return \"done\";\n  }\n  if (status === \"error\") {\n    return \"failed\";\n  }\n  // Running again after access was given, or before it was asked for.\n  return step === \"connected\" ? \"resumed\" : \"running\";\n}\n\nconst reasonOf = (error: unknown) =>\n  error instanceof Error && error.message\n    ? error.message\n    : \"Couldn’t connect. Try again.\";\n\n/** Steps that move on by themselves, and after how long. */\nconst AUTO: Partial<Record<Step, [number, Step]>> = {\n  running: [900, \"blocked\"],\n  connected: [1000, \"resumed\"],\n  resumed: [1200, \"done\"],\n};\n\nexport default function AIConnect({\n  prompt,\n  agent = \"Kokonut\",\n  agentLogo,\n  app = \"GitHub\",\n  appLogo,\n  appColor = \"#1f2328\",\n  reason = \"to open a pull request on kokonut/web\",\n  scopes = DEMO_SCOPES,\n  running = \"Opening a pull request\",\n  done = \"Opened a pull request\",\n  target,\n  result,\n  answer,\n  status,\n  error,\n  onConnect = demoConnect,\n  onSkip,\n  skipped,\n  className,\n}: AIConnectProps) {\n  const driven = status !== undefined;\n  const shown = shownText({ prompt, target, result, answer, skipped }, !driven);\n  const [own, setStep] = useState<Step>(driven ? \"blocked\" : \"running\");\n  const [connectError, setConnectError] = useState<string>();\n  const step = driven ? drivenStep(status, own) : own;\n  const logo = appLogo ?? <GitHubMark className=\"size-[18px]\" />;\n\n  useEffect(() => {\n    const auto = AUTO[own];\n    if (!auto || driven) {\n      return;\n    }\n    const t = setTimeout(() => setStep(auto[1]), auto[0]);\n    return () => clearTimeout(t);\n  }, [own, driven]);\n\n  const connect = async () => {\n    setStep(\"authorizing\");\n    setConnectError(undefined);\n    try {\n      await onConnect();\n      setStep(\"connected\");\n    } catch (e) {\n      setConnectError(reasonOf(e));\n      setStep(\"blocked\");\n    }\n  };\n\n  const skip = () => {\n    setStep(\"skipped\");\n    onSkip?.();\n  };\n\n  const asking =\n    step === \"blocked\" || step === \"authorizing\" || step === \"connected\";\n\n  return (\n    <MotionConfig reducedMotion=\"user\">\n      <div\n        className={cn(\"flex w-full max-w-md flex-col gap-4\", className)}\n        data-state={step}\n      >\n        {shown.prompt ? (\n          <p className=\"max-w-[85%] self-end rounded-2xl rounded-br-md bg-zinc-100 px-3.5 py-2 text-[14px] text-zinc-800 leading-snug dark:bg-zinc-800 dark:text-zinc-100\">\n            {shown.prompt}\n          </p>\n        ) : null}\n\n        <AutoHeight className=\"rounded-[22px] bg-black/[0.04] dark:bg-white/[0.06]\">\n          <CallBand\n            app={app}\n            done={done}\n            error={error}\n            logo={logo}\n            result={shown.result}\n            running={running}\n            step={step}\n            target={shown.target}\n          />\n          <AnimatePresence initial={false}>\n            {asking && (\n              <motion.div\n                animate={{ opacity: 1, filter: \"blur(0px)\" }}\n                exit={{ opacity: 0, filter: \"blur(4px)\" }}\n                initial={{ opacity: 0, filter: \"blur(4px)\" }}\n                transition={{ duration: 0.25, ease: EASE_OUT }}\n              >\n                <AccessCard\n                  agent={agent}\n                  agentLogo={agentLogo}\n                  app={app}\n                  appColor={appColor}\n                  error={connectError}\n                  logo={logo}\n                  onConnect={connect}\n                  onSkip={!driven || onSkip ? skip : undefined}\n                  reason={reason}\n                  scopes={scopes}\n                  step={step}\n                />\n              </motion.div>\n            )}\n          </AnimatePresence>\n        </AutoHeight>\n\n        <AnimatePresence>\n          {closingLine(step, shown) ? (\n            <motion.div\n              animate={{ opacity: 1, filter: \"blur(0px)\", y: 0 }}\n              className=\"text-[15px] text-zinc-800 leading-7 dark:text-zinc-200\"\n              initial={{ opacity: 0, filter: \"blur(4px)\", y: 4 }}\n              transition={{ duration: 0.4, ease: EASE_OUT, delay: 0.15 }}\n            >\n              {closingLine(step, shown)}\n            </motion.div>\n          ) : null}\n        </AnimatePresence>\n      </div>\n    </MotionConfig>\n  );\n}\n\nfunction closingLine(step: Step, shown: Shown) {\n  if (step === \"done\") {\n    return shown.answer;\n  }\n  return step === \"skipped\" ? shown.skipped : undefined;\n}\n\n/** The tool call itself, in the frame above the access card. */\nfunction CallBand({\n  step,\n  app,\n  logo,\n  running,\n  done,\n  target,\n  result,\n  error,\n}: {\n  step: Step;\n  app: string;\n  logo: ReactNode;\n  running: string;\n  done: string;\n  target?: string;\n  result?: string;\n  error?: string;\n}) {\n  const paused = step === \"blocked\" || step === \"authorizing\";\n  const via = step === \"resumed\" || step === \"done\";\n\n  let label = running;\n  if (step === \"done\") {\n    label = done;\n  } else if (step === \"skipped\") {\n    label = \"Stopped before it ran\";\n  } else if (step === \"failed\") {\n    label = error ?? \"Didn’t finish\";\n  }\n\n  return (\n    <div className=\"flex h-10 items-center gap-2 px-4 text-[13px]\">\n      <span className=\"flex size-4 items-center justify-center text-zinc-900 dark:text-zinc-100\">\n        <StateIcon step={step} />\n      </span>\n      <AnimatePresence initial={false} mode=\"popLayout\">\n        <motion.span\n          animate={{ opacity: 1, filter: \"blur(0px)\" }}\n          className={cn(\n            \"shrink-0\",\n            step === \"done\" || step === \"skipped\"\n              ? \"text-zinc-600 dark:text-zinc-400\"\n              : \"font-medium text-zinc-900 dark:text-zinc-100\",\n            step === \"failed\" &&\n              \"min-w-0 truncate text-rose-600 dark:text-rose-400\"\n          )}\n          exit={{ opacity: 0, filter: \"blur(2px)\" }}\n          initial={{ opacity: 0, filter: \"blur(2px)\" }}\n          key={label}\n          transition={{ duration: 0.18 }}\n        >\n          {label}\n        </motion.span>\n      </AnimatePresence>\n      {step !== \"skipped\" && step !== \"failed\" && target && (\n        <span className=\"min-w-0 truncate font-mono text-[11.5px] text-zinc-400 dark:text-zinc-500\">\n          {target}\n        </span>\n      )}\n      <span className=\"ml-auto flex shrink-0 items-center gap-2 pl-2\">\n        <AnimatePresence initial={false} mode=\"popLayout\">\n          {paused && (\n            <motion.span\n              animate={{ opacity: 1 }}\n              className=\"text-[12px] text-zinc-500 dark:text-zinc-400\"\n              exit={{ opacity: 0 }}\n              initial={{ opacity: 0 }}\n              key=\"paused\"\n            >\n              Needs {app}\n            </motion.span>\n          )}\n          {via && (\n            <motion.span\n              animate={{ opacity: 1, x: 0 }}\n              className=\"flex items-center gap-1.5 text-[12px]\"\n              initial={{ opacity: 0, x: 4 }}\n              key=\"via\"\n              transition={{ duration: 0.25, ease: EASE_OUT }}\n            >\n              <span className=\"text-zinc-800 dark:text-zinc-200 [&_svg]:size-3.5\">\n                {logo}\n              </span>\n              {step === \"done\" && result && (\n                <span className=\"font-mono text-zinc-700 dark:text-zinc-300\">\n                  {result}\n                </span>\n              )}\n            </motion.span>\n          )}\n        </AnimatePresence>\n      </span>\n    </div>\n  );\n}\n\nfunction AccessCard({\n  agent,\n  agentLogo,\n  app,\n  appColor,\n  logo,\n  reason,\n  scopes,\n  step,\n  error,\n  onConnect,\n  onSkip,\n}: {\n  agent: string;\n  agentLogo?: ReactNode;\n  app: string;\n  appColor: string;\n  logo: ReactNode;\n  reason: string;\n  scopes: ConnectScope[];\n  step: Step;\n  error?: string;\n  onConnect: () => void;\n  onSkip?: () => void;\n}) {\n  const waiting = step === \"authorizing\";\n  const linked = step === \"connected\";\n  let link: Link = \"idle\";\n  if (linked) {\n    link = \"linked\";\n  } else if (waiting) {\n    link = \"waiting\";\n  }\n\n  return (\n    <div className=\"m-1 mt-0 rounded-[18px] bg-white px-4 pt-5 pb-3 shadow-[0_1px_2px_rgb(0_0_0/0.04)] ring-1 ring-black/[0.06] dark:bg-zinc-900 dark:ring-white/[0.08]\">\n      <div className=\"flex items-center justify-center\">\n        <span className=\"flex size-10 items-center justify-center rounded-xl bg-zinc-100 font-semibold text-[15px] text-zinc-900 ring-1 ring-black/[0.06] dark:bg-zinc-800 dark:text-zinc-100 dark:ring-white/10\">\n          {agentLogo ?? agent.slice(0, 1)}\n        </span>\n        <Handshake state={link} />\n        <span\n          className=\"flex size-10 items-center justify-center rounded-xl text-white dark:ring-1 dark:ring-white/15\"\n          style={{ backgroundColor: appColor }}\n        >\n          {logo}\n        </span>\n      </div>\n\n      <div className=\"mt-4 text-center\">\n        <AnimatePresence initial={false} mode=\"popLayout\">\n          <motion.p\n            animate={{ opacity: 1, y: 0 }}\n            className=\"font-medium text-[15px] text-zinc-900 dark:text-zinc-100\"\n            exit={{ opacity: 0, y: -4 }}\n            initial={{ opacity: 0, y: 4 }}\n            key={linked ? \"linked\" : \"ask\"}\n            transition={{ duration: 0.2, ease: EASE_OUT }}\n          >\n            {linked ? `${app} connected` : `Connect ${app} to continue`}\n          </motion.p>\n        </AnimatePresence>\n        <p className=\"mt-1 text-[13px] text-zinc-500 dark:text-zinc-400\">\n          {linked\n            ? \"Picking up where it stopped…\"\n            : `${agent} needs access ${reason}.`}\n        </p>\n      </div>\n\n      <ul className=\"mt-4 space-y-2 rounded-xl bg-zinc-50 px-3 py-2.5 text-[12.5px] ring-1 ring-black/[0.04] dark:bg-white/[0.03] dark:ring-white/[0.06]\">\n        {scopes.map((scope) => (\n          <li\n            className={cn(\n              \"flex items-center gap-2\",\n              scope.denied\n                ? \"text-zinc-400 dark:text-zinc-500\"\n                : \"text-zinc-700 dark:text-zinc-300\"\n            )}\n            key={scope.label}\n          >\n            <span className=\"flex size-4 shrink-0 items-center justify-center text-zinc-400 dark:text-zinc-500\">\n              {scope.icon ?? <Check className=\"size-3.5\" />}\n            </span>\n            <span\n              className={cn(\n                scope.denied &&\n                  \"line-through decoration-zinc-300 dark:decoration-zinc-600\"\n              )}\n            >\n              {scope.label}\n            </span>\n            {scope.denied && (\n              <span className=\"ml-auto shrink-0 text-[11px]\">Not asked</span>\n            )}\n          </li>\n        ))}\n      </ul>\n\n      <button\n        aria-busy={waiting}\n        className=\"mt-4 flex h-10 w-full items-center justify-center rounded-xl font-medium text-[14px] text-white outline-hidden transition-[filter,background-color] duration-300 hover:brightness-125 focus-visible:ring-2 focus-visible:ring-zinc-400/60 focus-visible:ring-offset-2 active:brightness-110 disabled:pointer-events-none dark:ring-1 dark:ring-white/15 dark:focus-visible:ring-offset-zinc-900\"\n        disabled={step !== \"blocked\"}\n        onClick={onConnect}\n        style={{ backgroundColor: linked ? \"#059669\" : appColor }}\n        type=\"button\"\n      >\n        <AnimatePresence initial={false} mode=\"popLayout\">\n          <motion.span\n            animate={{ opacity: 1, y: 0 }}\n            className=\"flex items-center gap-2 [&_svg]:size-4\"\n            exit={{ opacity: 0, y: -6 }}\n            initial={{ opacity: 0, y: 6 }}\n            key={link}\n            transition={{ duration: 0.18, ease: EASE_OUT }}\n          >\n            <ButtonFace app={app} link={link} logo={logo} />\n          </motion.span>\n        </AnimatePresence>\n      </button>\n      {error && step === \"blocked\" ? (\n        <p\n          className=\"mt-2 text-center text-[12.5px] text-rose-600 dark:text-rose-400\"\n          role=\"alert\"\n        >\n          {error}\n        </p>\n      ) : null}\n      <div className={cn(\"mt-1 flex justify-center\", !onSkip && \"hidden\")}>\n        <button\n          className=\"rounded-md px-2 py-1 text-[12.5px] text-zinc-500 outline-hidden transition-[color,opacity] duration-150 hover:text-zinc-900 focus-visible:ring-2 focus-visible:ring-zinc-400/50 disabled:opacity-0 dark:text-zinc-400 dark:hover:text-zinc-100\"\n          disabled={step !== \"blocked\"}\n          onClick={onSkip}\n          type=\"button\"\n        >\n          Not now\n        </button>\n      </div>\n      <p aria-live=\"polite\" className=\"sr-only\">\n        {waiting ? `Waiting for ${app}` : \"\"}\n        {linked ? `${app} connected` : \"\"}\n      </p>\n    </div>\n  );\n}\n\nfunction ButtonFace({\n  link,\n  app,\n  logo,\n}: {\n  link: Link;\n  app: string;\n  logo: ReactNode;\n}) {\n  if (link === \"waiting\") {\n    return (\n      <>\n        <Spinner />\n        Waiting for {app}…\n      </>\n    );\n  }\n  if (link === \"linked\") {\n    return (\n      <>\n        <Check aria-hidden=\"true\" />\n        Connected\n      </>\n    );\n  }\n  return (\n    <>\n      {logo}\n      Continue with {app}\n    </>\n  );\n}\n\n/**\n * The line between the two tiles: dashed while it waits, dashes flowing while\n * the person approves, then drawn solid green with a check in the middle.\n */\nfunction Handshake({ state }: { state: Link }) {\n  const waiting = state === \"waiting\";\n  return (\n    <span className=\"relative mx-2 flex h-10 w-20 items-center justify-center\">\n      <svg\n        aria-hidden=\"true\"\n        className=\"absolute inset-0 h-full w-full\"\n        fill=\"none\"\n        viewBox=\"0 0 80 40\"\n      >\n        <motion.line\n          animate={{ strokeDashoffset: waiting ? [0, -12] : 0 }}\n          className=\"stroke-zinc-300 dark:stroke-zinc-600\"\n          initial={{ strokeDashoffset: 0 }}\n          strokeDasharray=\"3 3\"\n          strokeLinecap=\"round\"\n          strokeWidth=\"1.5\"\n          transition={\n            waiting\n              ? {\n                  duration: 0.6,\n                  ease: \"linear\",\n                  repeat: Number.POSITIVE_INFINITY,\n                }\n              : { duration: 0 }\n          }\n          x1=\"2\"\n          x2=\"78\"\n          y1=\"20\"\n          y2=\"20\"\n        />\n        <motion.line\n          animate={{\n            pathLength: state === \"linked\" ? 1 : 0,\n            opacity: state === \"linked\" ? 1 : 0,\n          }}\n          className=\"stroke-emerald-500\"\n          initial={false}\n          strokeLinecap=\"round\"\n          strokeWidth=\"1.5\"\n          transition={{ duration: 0.45, ease: EASE_OUT }}\n          x1=\"2\"\n          x2=\"78\"\n          y1=\"20\"\n          y2=\"20\"\n        />\n      </svg>\n      <span\n        className={cn(\n          \"relative flex size-6 items-center justify-center rounded-full ring-1 transition-colors duration-300\",\n          state === \"linked\"\n            ? \"bg-emerald-500 text-white ring-emerald-500\"\n            : \"bg-white text-zinc-500 ring-black/10 dark:bg-zinc-900 dark:text-zinc-400 dark:ring-white/15\"\n        )}\n      >\n        <AnimatePresence initial={false} mode=\"popLayout\">\n          <motion.span\n            animate={{ opacity: 1, scale: 1 }}\n            exit={{ opacity: 0, scale: 0.5 }}\n            initial={{ opacity: 0, scale: 0.5 }}\n            key={state === \"linked\" ? \"check\" : \"lock\"}\n            transition={{ type: \"spring\", stiffness: 500, damping: 28 }}\n          >\n            {state === \"linked\" ? (\n              <Check className=\"size-3\" strokeWidth={3} />\n            ) : (\n              <Lock className=\"size-3\" />\n            )}\n          </motion.span>\n        </AnimatePresence>\n      </span>\n    </span>\n  );\n}\n\nfunction StateIcon({ step }: { step: Step }) {\n  let icon: ReactNode = <Spinner />;\n  let key = \"spin\";\n  if (step === \"done\") {\n    icon = (\n      <Check className=\"size-3.5 text-emerald-600 dark:text-emerald-400\" />\n    );\n    key = \"done\";\n  } else if (\n    step === \"blocked\" ||\n    step === \"authorizing\" ||\n    step === \"connected\"\n  ) {\n    icon = (\n      <Pause className=\"size-3 fill-current text-zinc-500 dark:text-zinc-400\" />\n    );\n    key = \"pause\";\n  } else if (step === \"failed\") {\n    icon = <X className=\"size-3.5 text-rose-600 dark:text-rose-400\" />;\n    key = \"failed\";\n  } else if (step === \"skipped\") {\n    icon = (\n      <span className=\"size-1.5 rounded-full bg-zinc-300 dark:bg-zinc-600\" />\n    );\n    key = \"skip\";\n  }\n  return (\n    <AnimatePresence initial={false} mode=\"popLayout\">\n      <motion.span\n        animate={{ opacity: 1, scale: 1 }}\n        className=\"flex items-center justify-center\"\n        exit={{ opacity: 0, scale: 0.6 }}\n        initial={{ opacity: 0, scale: 0.6 }}\n        key={key}\n        transition={{ duration: 0.2, ease: EASE_OUT }}\n      >\n        {icon}\n      </motion.span>\n    </AnimatePresence>\n  );\n}\n\nfunction Spinner() {\n  return (\n    <motion.svg\n      animate={{ rotate: 360 }}\n      aria-hidden=\"true\"\n      className=\"size-3.5\"\n      fill=\"none\"\n      transition={{\n        duration: 0.6,\n        ease: \"linear\",\n        repeat: Number.POSITIVE_INFINITY,\n      }}\n      viewBox=\"0 0 16 16\"\n    >\n      <circle\n        cx=\"8\"\n        cy=\"8\"\n        opacity=\"0.2\"\n        r=\"6.25\"\n        stroke=\"currentColor\"\n        strokeWidth=\"1.5\"\n      />\n      <path\n        d=\"M8 1.75a6.25 6.25 0 0 1 6.25 6.25\"\n        stroke=\"currentColor\"\n        strokeLinecap=\"round\"\n        strokeWidth=\"1.5\"\n      />\n    </motion.svg>\n  );\n}\n\n/** Eases the frame to its content's height when the card opens or folds. */\nfunction AutoHeight({\n  className,\n  children,\n}: {\n  className?: string;\n  children: ReactNode;\n}) {\n  const innerRef = useRef<HTMLDivElement>(null);\n  const [height, setHeight] = useState<number | \"auto\">(\"auto\");\n\n  useEffect(() => {\n    const inner = innerRef.current;\n    if (!inner) {\n      return;\n    }\n    const observer = new ResizeObserver(() => setHeight(inner.offsetHeight));\n    observer.observe(inner);\n    return () => observer.disconnect();\n  }, []);\n\n  return (\n    <motion.div\n      animate={{ height }}\n      className={cn(\"overflow-hidden\", className)}\n      initial={false}\n      transition={{ duration: 0.3, ease: EASE_DRAWER }}\n    >\n      <div ref={innerRef}>{children}</div>\n    </motion.div>\n  );\n}\n",
      "path": "/components/kokonutui/ai-connect.tsx",
      "target": "components/kokonutui/ai-connect.tsx"
    }
  ]
}