{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "telegram-widget",
  "title": "Telegram Widget",
  "description": "A Telegram-style chat bubble widget with a typing simulation, quick replies, a notification popup, availability status, and a launch-in-Telegram send flow.",
  "dependencies": [
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/telegram-widget/telegram-widget.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nconst TG_BLUE = \"#2AABEE\";\nconst TG_DEEP = \"#1a8fc2\";\nconst TG_BG =\n  \"url(\\\"data:image/svg+xml,%3Csvg width='400' height='400' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='p' width='28' height='28' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='14' cy='14' r='0.9' fill='%23c8dff0' opacity='0.55'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='400' height='400' fill='%23eef5fb'/%3E%3Crect width='400' height='400' fill='url(%23p)'/%3E%3C/svg%3E\\\")\";\n\nexport type TelegramAvailability = \"online\" | \"away\" | \"offline\";\nexport type TelegramWidgetPosition = \"bottom-right\" | \"bottom-left\";\n\nexport interface TelegramQuickReply {\n  emoji: string;\n  label: string;\n  message: string;\n}\n\nexport interface TelegramWidgetProps {\n  agentName?: string;\n  agentStatus?: string;\n  agentAvatar?: string;\n  username: string;\n  showVerified?: boolean;\n  availability?: TelegramAvailability;\n  offlineMessage?: string;\n  greeting?: string;\n  quickReplies?: TelegramQuickReply[];\n  popupMessage?: string;\n  accentColor?: string;\n  gradientEnd?: string;\n  /** Fixed to the viewport corner (typical widget usage). Set false to render inline, e.g. inside a preview card. */\n  fixed?: boolean;\n  position?: TelegramWidgetPosition;\n  notificationCount?: number;\n  popupDelay?: number;\n  typingDuration?: number;\n  autoOpenDelay?: number;\n}\n\nconst STATUS_COLORS: Record<TelegramAvailability, string> = { online: \"#4ade80\", away: \"#f59e0b\", offline: \"#9ca3af\" };\nconst STATUS_LABELS: Record<TelegramAvailability, string> = { online: \"online\", away: \"away\", offline: \"offline\" };\n\nfunction TelegramIcon({ size = 28, color = \"#fff\" }: { size?: number; color?: string }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 16 16\" fill={color}>\n      <path d=\"M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.287 5.906c-.778.324-2.334.994-4.666 2.01-.378.15-.577.298-.595.442-.03.243.275.339.69.47l.175.055c.408.133.958.288 1.243.294.26.006.549-.1.868-.32 2.179-1.471 3.304-2.214 3.374-2.23.05-.012.12-.026.166.016.047.041.042.12.037.141-.03.129-1.227 1.241-1.846 1.817-.193.18-.33.307-.358.336a8.154 8.154 0 0 1-.188.186c-.38.366-.664.64.015 1.088.327.216.589.393.85.571.284.194.568.387.936.629.093.06.183.125.27.187.331.236.63.448.997.414.214-.02.435-.22.547-.82.265-1.417.786-4.486.906-5.751a1.426 1.426 0 0 0-.013-.315.337.337 0 0 0-.114-.217.526.526 0 0 0-.31-.093c-.3.005-.763.166-2.984 1.09z\" />\n    </svg>\n  );\n}\n\nfunction SendIcon({ color = \"#fff\" }: { color?: string }) {\n  return (\n    <svg width={20} height={20} viewBox=\"0 0 24 24\" fill=\"none\">\n      <path d=\"M22 2L11 13\" stroke={color} strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n      <path d=\"M22 2L15 22L11 13L2 9L22 2Z\" stroke={color} strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction CloseIcon({ color = \"#fff\", size = 18 }: { color?: string; size?: number }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n      <path d=\"M18 6L6 18M6 6l12 12\" stroke={color} strokeWidth={2.5} strokeLinecap=\"round\" />\n    </svg>\n  );\n}\n\nfunction SeenIcon({ color }: { color: string }) {\n  return (\n    <svg width={16} height={11} viewBox=\"0 0 16 11\" fill=\"none\">\n      <path d=\"M1 5.5L4.5 9L10 3\" stroke={color} strokeWidth={1.8} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n      <path d=\"M6 5.5L9.5 9L15 3\" stroke={color} strokeWidth={1.8} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction VerifiedIcon({ size = 14 }: { size?: number }) {\n  return (\n    <svg width={size} height={size} viewBox=\"0 0 24 24\" fill=\"none\">\n      <path d=\"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z\" stroke=\"rgba(255,255,255,0.92)\" strokeWidth={2} strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n    </svg>\n  );\n}\n\nfunction Avatar({ size, src, accentColor, gradientEnd }: { size: number; src?: string; accentColor: string; gradientEnd: string }) {\n  return src ? (\n    <img src={src} alt=\"\" className=\"shrink-0 rounded-full object-cover\" style={{ width: size, height: size }} />\n  ) : (\n    <div\n      className=\"flex shrink-0 items-center justify-center rounded-full\"\n      style={{ width: size, height: size, background: `linear-gradient(135deg, ${accentColor}, ${gradientEnd})`, fontSize: size * 0.42 }}\n    >\n      ✈️\n    </div>\n  );\n}\n\nfunction MsgAvatar({ src, accentColor, gradientEnd }: { src?: string; accentColor: string; gradientEnd: string }) {\n  return (\n    <div\n      className=\"flex h-[30px] w-[30px] shrink-0 items-center justify-center overflow-hidden rounded-full\"\n      style={{ background: `linear-gradient(135deg, ${accentColor}, ${gradientEnd})` }}\n    >\n      {src ? <img src={src} alt=\"\" className=\"h-[30px] w-[30px] object-cover\" /> : <TelegramIcon size={16} />}\n    </div>\n  );\n}\n\nconst DEFAULT_QUICK_REPLIES: TelegramQuickReply[] = [\n  { emoji: \"💬\", label: \"Start a chat\", message: \"Hi! I'd like to chat with you.\" },\n  { emoji: \"❓\", label: \"Ask a question\", message: \"I have a question for you.\" },\n  { emoji: \"📋\", label: \"Get information\", message: \"I'd like some information.\" },\n];\n\nexport function TelegramWidget({\n  agentName = \"Support\",\n  agentStatus = \"usually replies in minutes\",\n  agentAvatar,\n  username,\n  showVerified = false,\n  availability = \"online\",\n  offlineMessage = \"We're offline right now. Write to us and we'll reply as soon as we're back.\",\n  greeting = \"Hello! ✈️\\n\\nHow can we assist you today?\",\n  quickReplies = DEFAULT_QUICK_REPLIES,\n  popupMessage = \"✈️ Hey! Got questions? We reply fast, message us now.\",\n  accentColor = TG_BLUE,\n  gradientEnd = TG_DEEP,\n  fixed = true,\n  position = \"bottom-right\",\n  notificationCount = 1,\n  popupDelay = 4,\n  typingDuration = 1.5,\n  autoOpenDelay = 0,\n}: TelegramWidgetProps) {\n  const [isOpen, setIsOpen] = React.useState(false);\n  const [inputValue, setInputValue] = React.useState(\"\");\n  const [isVisible, setIsVisible] = React.useState(false);\n  const [showBadge, setShowBadge] = React.useState(notificationCount > 0);\n  const [msgTime, setMsgTime] = React.useState(\"00:00\");\n  const [showPopup, setShowPopup] = React.useState(false);\n  const [popupDismissed, setPopupDismissed] = React.useState(false);\n  const [showTyping, setShowTyping] = React.useState(false);\n  const [greetingVisible, setGreetingVisible] = React.useState(false);\n\n  const inputRef = React.useRef<HTMLInputElement>(null);\n  const timerRef = React.useRef<ReturnType<typeof setInterval> | null>(null);\n  const secondsRef = React.useRef(0);\n\n  const isOffline = availability === \"offline\";\n  const isAway = availability === \"away\";\n  const dotColor = STATUS_COLORS[availability];\n  const statusText = isOffline ? STATUS_LABELS.offline : isAway ? STATUS_LABELS.away : agentStatus;\n  const headerGradient = isOffline ? \"linear-gradient(140deg, #6b7280 0%, #4b5563 100%)\" : `linear-gradient(140deg, ${accentColor} 0%, ${gradientEnd} 100%)`;\n  const cleanUsername = username.replace(/^@/, \"\");\n\n  React.useEffect(() => setShowBadge(notificationCount > 0), [notificationCount]);\n\n  React.useEffect(() => {\n    const t = setTimeout(() => setIsVisible(true), 300);\n    return () => clearTimeout(t);\n  }, []);\n\n  React.useEffect(() => {\n    if (autoOpenDelay > 0) {\n      const t = setTimeout(() => setIsOpen(true), autoOpenDelay * 1000);\n      return () => clearTimeout(t);\n    }\n  }, [autoOpenDelay]);\n\n  React.useEffect(() => {\n    if (popupDelay > 0 && !popupDismissed && !isOpen) {\n      const t = setTimeout(() => setShowPopup(true), popupDelay * 1000);\n      return () => clearTimeout(t);\n    }\n  }, [popupDelay, popupDismissed, isOpen]);\n\n  React.useEffect(() => {\n    if (isOpen) {\n      setShowBadge(false);\n      setShowPopup(false);\n      secondsRef.current = 0;\n      const startTimer = () => {\n        timerRef.current = setInterval(() => {\n          secondsRef.current += 1;\n          const m = Math.floor(secondsRef.current / 60).toString().padStart(2, \"0\");\n          const s = (secondsRef.current % 60).toString().padStart(2, \"0\");\n          setMsgTime(`${m}:${s}`);\n        }, 1000);\n      };\n      if (typingDuration > 0) {\n        setShowTyping(true);\n        setGreetingVisible(false);\n        startTimer();\n        const t = setTimeout(() => {\n          setShowTyping(false);\n          setGreetingVisible(true);\n        }, typingDuration * 1000);\n        const f = setTimeout(() => inputRef.current?.focus(), 420);\n        return () => {\n          clearTimeout(t);\n          clearTimeout(f);\n          if (timerRef.current) clearInterval(timerRef.current);\n        };\n      }\n      setShowTyping(false);\n      setGreetingVisible(true);\n      startTimer();\n      const f = setTimeout(() => inputRef.current?.focus(), 420);\n      return () => {\n        clearTimeout(f);\n        if (timerRef.current) clearInterval(timerRef.current);\n      };\n    }\n    setShowTyping(false);\n    setGreetingVisible(false);\n    if (timerRef.current) clearInterval(timerRef.current);\n    return () => {\n      if (timerRef.current) clearInterval(timerRef.current);\n    };\n  }, [isOpen, typingDuration]);\n\n  const handleOpen = () => setIsOpen(true);\n  const handleClose = () => setIsOpen(false);\n  const handleDismissPopup = (e: React.MouseEvent) => {\n    e.stopPropagation();\n    setShowPopup(false);\n    setPopupDismissed(true);\n  };\n  const openTelegram = (msg?: string) => {\n    const base = `https://t.me/${cleanUsername}`;\n    window.open(msg ? `${base}?text=${encodeURIComponent(msg)}` : base, \"_blank\");\n  };\n  const handleSend = () => {\n    const msg = inputValue.trim();\n    if (!msg) return;\n    openTelegram(msg);\n    setInputValue(\"\");\n  };\n  const handleQuickReply = (qr: TelegramQuickReply) => {\n    setInputValue(qr.message);\n    setTimeout(() => inputRef.current?.focus(), 50);\n  };\n\n  const isRight = position !== \"bottom-left\";\n  const chatOrigin = isRight ? \"bottom right\" : \"bottom left\";\n  // Never wider than the viewport: leave the corner offset on both sides when fixed,\n  // and a bit more slack when inline (the surrounding layout may add its own padding).\n  const panelMaxWidth = fixed ? \"calc(100vw - 3rem)\" : \"calc(100vw - 5rem)\";\n\n  return (\n    <div\n      className={cn(fixed ? \"fixed bottom-6 z-[9999]\" : \"relative\", isRight ? \"right-6\" : \"left-6\")}\n      style={{ fontFamily: \"system-ui, -apple-system, sans-serif\", ...(fixed ? undefined : { display: \"inline-block\" }) }}\n    >\n      {showPopup && !isOpen && (\n        <div\n          onClick={handleOpen}\n          className={cn(\"absolute bottom-[76px] w-[300px] cursor-pointer overflow-hidden rounded-[18px] bg-white shadow-[0_16px_48px_rgba(0,0,0,0.15),0_4px_16px_rgba(0,0,0,0.08)]\", isRight ? \"right-0\" : \"left-0\")}\n          style={{ maxWidth: panelMaxWidth, animation: \"tg-popup-in 0.42s cubic-bezier(0.34,1.56,0.64,1) forwards\" }}\n        >\n          <div className=\"flex items-center gap-2.5 px-3.5 py-3\" style={{ background: headerGradient }}>\n            <div className=\"relative shrink-0\">\n              <div className=\"h-9 w-9 overflow-hidden rounded-full border-2 border-white/40\">\n                <Avatar size={36} src={agentAvatar} accentColor={accentColor} gradientEnd={gradientEnd} />\n              </div>\n              <div className=\"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-white\" style={{ background: dotColor }} />\n            </div>\n            <div className=\"min-w-0 flex-1\">\n              <div className=\"flex items-center gap-1.5 text-[13px] font-bold text-white\">\n                {agentName}\n                {showVerified && <VerifiedIcon size={12} />}\n              </div>\n              <div className=\"text-[11px] text-white/80\">@{cleanUsername}</div>\n            </div>\n            <button\n              aria-label=\"Dismiss notification\" onClick={handleDismissPopup}\n              className=\"flex h-[26px] w-[26px] shrink-0 items-center justify-center rounded-full bg-white/[0.18] transition-colors hover:bg-white/[0.32]\"\n            >\n              <CloseIcon size={13} />\n            </button>\n          </div>\n          <div className=\"px-3.5 pt-[13px] pb-3.5\" style={{ backgroundImage: TG_BG, backgroundSize: \"cover\" }}>\n            <div className=\"inline-block max-w-full rounded-[4px_16px_16px_16px] bg-white px-[13px] py-2.5 text-sm leading-relaxed text-black shadow-[0_1px_4px_rgba(0,0,0,0.07)]\">\n              {popupMessage}\n            </div>\n            <div className={cn(\"mt-2.5 text-[11.5px] text-[#888]\", isRight ? \"text-right\" : \"text-left\")}>Tap to open Telegram →</div>\n          </div>\n        </div>\n      )}\n\n      <div\n        className={cn(\"absolute bottom-[76px] flex w-[360px] flex-col overflow-hidden rounded-[18px] bg-white\", isRight ? \"right-0\" : \"left-0\")}\n        style={{\n          maxWidth: panelMaxWidth,\n          maxHeight: \"calc(100dvh - 100px)\",\n          boxShadow: isOpen ? \"0 24px 72px rgba(0,0,0,0.18), 0 8px 24px rgba(0,0,0,0.1)\" : \"none\",\n          transformOrigin: chatOrigin,\n          transform: isOpen ? \"scale(1) translateY(0px)\" : \"scale(0.72) translateY(24px)\",\n          opacity: isOpen ? 1 : 0,\n          filter: isOpen ? \"blur(0px)\" : \"blur(6px)\",\n          pointerEvents: isOpen ? \"all\" : \"none\",\n          transition: isOpen\n            ? \"transform 0.45s cubic-bezier(0.34,1.56,0.64,1), opacity 0.28s ease, filter 0.28s ease, box-shadow 0.3s ease\"\n            : \"transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease, filter 0.22s ease\",\n        }}\n      >\n        <div className=\"flex items-center gap-3 px-4 py-3.5\" style={{ background: headerGradient }}>\n          <div className=\"relative shrink-0\">\n            <div className=\"h-[46px] w-[46px] overflow-hidden rounded-full border-[2.5px] border-white/45\">\n              <Avatar size={46} src={agentAvatar} accentColor={accentColor} gradientEnd={gradientEnd} />\n            </div>\n            <div className=\"absolute bottom-px right-px h-3 w-3 rounded-full border-[2.5px] border-white\" style={{ background: dotColor }} />\n          </div>\n          <div className=\"min-w-0 flex-1\">\n            <div className=\"flex items-center gap-1.5 text-[15px] font-bold leading-[1.2] tracking-[-0.01em] text-white\">\n              {agentName}\n              {showVerified && <VerifiedIcon size={15} />}\n            </div>\n            <div className=\"mt-0.5 flex items-center gap-[5px] text-xs text-white/82\">\n              {(isOffline || isAway) && (\n                <span className=\"rounded px-1.5 py-px text-[10px] font-bold tracking-[0.04em]\" style={{ background: \"rgba(255,255,255,0.22)\" }}>\n                  {STATUS_LABELS[availability].toUpperCase()}\n                </span>\n              )}\n              <span>@{cleanUsername} · {statusText}</span>\n            </div>\n          </div>\n          <button\n            aria-label=\"Close chat\" onClick={handleClose}\n            className=\"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-white/[0.18] transition-all hover:scale-110 hover:bg-white/30\"\n          >\n            <CloseIcon />\n          </button>\n        </div>\n\n        {isOffline && (\n          <div className=\"flex items-start gap-[7px] border-b border-[#fde68a] bg-[#fef3c7] px-3.5 py-[9px] text-[12.5px] text-[#92400e]\">\n            <span className=\"shrink-0 text-sm\">🔔</span>\n            <span>{offlineMessage}</span>\n          </div>\n        )}\n        {isAway && (\n          <div className=\"flex items-center gap-[7px] border-b border-[#fde68a] bg-[#fffbeb] px-3.5 py-[9px] text-[12.5px] text-[#92400e]\">\n            <span className=\"text-sm\">🕐</span>\n            <span>Response times may be a bit slower right now.</span>\n          </div>\n        )}\n\n        <div className=\"flex max-h-[320px] min-h-[min(220px,calc(100dvh-330px))] flex-col gap-2.5 overflow-y-auto px-3.5 py-4\" style={{ backgroundImage: TG_BG, backgroundSize: \"cover\" }}>\n          {showTyping && (\n            <div className=\"flex items-end gap-2\">\n              <MsgAvatar src={agentAvatar} accentColor={accentColor} gradientEnd={gradientEnd} />\n              <div className=\"flex items-center gap-[5px] rounded-[4px_18px_18px_18px] bg-white px-4 py-[11px] shadow-[0_1px_5px_rgba(0,0,0,0.08)]\" style={{ animation: \"tg-msg-in 0.3s ease forwards\" }}>\n                <span className=\"h-[7px] w-[7px] animate-[tg-dot_1.2s_ease-in-out_0s_infinite] rounded-full bg-[#bbb]\" />\n                <span className=\"h-[7px] w-[7px] animate-[tg-dot_1.2s_ease-in-out_0.2s_infinite] rounded-full bg-[#bbb]\" />\n                <span className=\"h-[7px] w-[7px] animate-[tg-dot_1.2s_ease-in-out_0.4s_infinite] rounded-full bg-[#bbb]\" />\n              </div>\n            </div>\n          )}\n\n          {greetingVisible && (\n            <div className=\"flex items-end gap-2\" style={{ animation: \"tg-msg-in 0.38s cubic-bezier(0.34,1.2,0.64,1) forwards\" }}>\n              <MsgAvatar src={agentAvatar} accentColor={accentColor} gradientEnd={gradientEnd} />\n              <div className=\"max-w-[258px]\">\n                <div className=\"whitespace-pre-line rounded-[4px_18px_18px_18px] bg-white px-3.5 py-2.5 text-sm leading-relaxed text-black shadow-[0_1px_5px_rgba(0,0,0,0.08)]\">\n                  {greeting}\n                </div>\n                <div className=\"mt-1 flex items-center gap-1 pl-1\">\n                  <span className=\"text-[11px] text-[#aaa]\">{msgTime}</span>\n                  <SeenIcon color={accentColor} />\n                </div>\n              </div>\n            </div>\n          )}\n\n          {greetingVisible && quickReplies.length > 0 && (\n            <div className=\"mt-1 flex flex-col gap-[7px]\" style={{ animation: \"tg-msg-in 0.42s cubic-bezier(0.34,1.2,0.64,1) 0.1s both\" }}>\n              {quickReplies.map((qr, i) => (\n                <button\n                  key={i}\n                  onClick={() => handleQuickReply(qr)}\n                  className=\"flex items-center gap-2.5 rounded-[22px] bg-white px-4 py-[9px] text-left text-[13.5px] font-medium text-[#222] shadow-[0_1px_4px_rgba(0,0,0,0.07)] transition-all duration-200\"\n                  onMouseEnter={(e) => {\n                    e.currentTarget.style.background = `linear-gradient(135deg, ${accentColor}, ${gradientEnd})`;\n                    e.currentTarget.style.color = \"#fff\";\n                    e.currentTarget.style.transform = \"translateX(4px) scale(1.01)\";\n                    e.currentTarget.style.boxShadow = \"0 6px 20px rgba(0,0,0,0.15)\";\n                  }}\n                  onMouseLeave={(e) => {\n                    e.currentTarget.style.background = \"#fff\";\n                    e.currentTarget.style.color = \"#222\";\n                    e.currentTarget.style.transform = \"translateX(0) scale(1)\";\n                    e.currentTarget.style.boxShadow = \"0 1px 4px rgba(0,0,0,0.07)\";\n                  }}\n                >\n                  <span className=\"shrink-0 text-[15.5px]\">{qr.emoji}</span>\n                  {qr.label}\n                </button>\n              ))}\n            </div>\n          )}\n        </div>\n\n        <div className=\"flex items-center gap-2 border-t border-[#eef2f7] bg-white px-3 py-2.5\">\n          <div className=\"shrink-0 cursor-default select-none text-[22px] transition-transform hover:scale-[1.2]\">😊</div>\n          <input aria-label=\"Type a message\"\n            ref={inputRef}\n            value={inputValue}\n            onChange={(e) => setInputValue(e.target.value)}\n            onKeyDown={(e) => e.key === \"Enter\" && handleSend()}\n            placeholder=\"Write a message...\"\n            className=\"flex-1 rounded-[22px] border-[1.5px] border-[#eef2f7] bg-[#f7fafd] px-3.5 py-2 text-sm text-black outline-none transition-colors focus:bg-white\"\n            onFocus={(e) => (e.currentTarget.style.borderColor = accentColor)}\n            onBlur={(e) => (e.currentTarget.style.borderColor = \"#eef2f7\")}\n          />\n          <button\n            aria-label=\"Send message\" onClick={handleSend}\n            className=\"flex h-[38px] w-[38px] shrink-0 items-center justify-center rounded-full transition-transform\"\n            style={{\n              background: inputValue.trim() ? `linear-gradient(135deg, ${accentColor}, ${gradientEnd})` : \"#e4e9ef\",\n              cursor: inputValue.trim() ? \"pointer\" : \"default\",\n              boxShadow: inputValue.trim() ? `0 4px 14px ${accentColor}55` : \"none\",\n            }}\n            onMouseEnter={(e) => {\n              if (inputValue.trim()) e.currentTarget.style.transform = \"scale(1.12)\";\n            }}\n            onMouseLeave={(e) => {\n              e.currentTarget.style.transform = \"scale(1)\";\n            }}\n          >\n            <SendIcon />\n          </button>\n        </div>\n\n        <div className=\"border-t border-[#f2f5f9] pt-[5px] pb-[9px] text-center text-[11px] text-[#bbb]\">\n          Open in{\" \"}\n          <span\n            className=\"font-bold\"\n            style={{ background: `linear-gradient(135deg, ${accentColor}, ${gradientEnd})`, WebkitBackgroundClip: \"text\", WebkitTextFillColor: \"transparent\" }}\n          >\n            Telegram\n          </span>\n        </div>\n      </div>\n\n      <div className=\"relative inline-flex\">\n        <button\n          aria-label={isOpen ? \"Close chat\" : \"Open chat\"} onClick={isOpen ? handleClose : handleOpen}\n          className=\"relative flex h-[60px] w-[60px] items-center justify-center overflow-hidden rounded-full transition-transform hover:scale-110\"\n          style={{\n            background: isOpen ? \"linear-gradient(135deg, #ff6b6b, #ee5a24)\" : isOffline ? \"linear-gradient(135deg, #6b7280, #4b5563)\" : `linear-gradient(135deg, ${accentColor}, ${gradientEnd})`,\n            boxShadow: isOpen ? \"0 6px 24px rgba(238,90,36,0.45)\" : isOffline ? \"0 6px 24px rgba(107,114,128,0.4)\" : `0 8px 28px ${accentColor}70`,\n            transform: isVisible ? \"scale(1)\" : \"scale(0)\",\n            opacity: isVisible ? 1 : 0,\n            transition: \"transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.3s ease, background 0.4s ease, box-shadow 0.3s ease\",\n          }}\n        >\n          <span\n            className=\"pointer-events-none absolute inset-0 rounded-full bg-white/[0.18]\"\n            style={{ transform: \"scale(0)\", animation: isOpen ? \"tg-ripple 0.4s ease-out forwards\" : \"none\" }}\n          />\n\n          {!isOpen && !isOffline && (\n            <>\n              <div className=\"pointer-events-none absolute -inset-[5px] animate-[tg-pulse_2.4s_ease-in-out_1.2s_infinite] rounded-full border-2\" style={{ borderColor: accentColor }} />\n              <div className=\"pointer-events-none absolute -inset-[11px] animate-[tg-pulse_2.4s_ease-in-out_1.8s_infinite] rounded-full border-[1.5px] opacity-40\" style={{ borderColor: gradientEnd }} />\n            </>\n          )}\n          <div className=\"pointer-events-none absolute transition-all duration-[350ms]\" style={{ transform: isOpen ? \"rotate(-90deg) scale(0.3)\" : \"rotate(0deg) scale(1)\", opacity: isOpen ? 0 : 1 }}>\n            <TelegramIcon size={30} />\n          </div>\n          <div className=\"pointer-events-none absolute transition-all duration-[350ms]\" style={{ transform: isOpen ? \"rotate(0deg) scale(1)\" : \"rotate(90deg) scale(0.3)\", opacity: isOpen ? 1 : 0 }}>\n            <CloseIcon size={22} />\n          </div>\n        </button>\n\n        {!isOpen && showBadge && notificationCount > 0 && (\n          <div\n            className=\"pointer-events-none absolute -right-1 -top-1 z-[1] flex h-5 min-w-5 items-center justify-center rounded-full border-[2.5px] border-white bg-[#ef4444] px-1.5 text-[11px] font-bold text-white shadow-[0_2px_8px_rgba(239,68,68,0.55)]\"\n            style={{ animation: \"tg-badge-pop 0.5s cubic-bezier(0.34,1.56,0.64,1) 1.1s both\" }}\n          >\n            {notificationCount > 9 ? \"9+\" : notificationCount}\n          </div>\n        )}\n      </div>\n\n      <style>{`\n        @keyframes tg-pulse { 0% { transform: scale(1); opacity: 0.6; } 70% { transform: scale(1.6); opacity: 0; } 100% { transform: scale(1.6); opacity: 0; } }\n        @keyframes tg-ripple { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(2.5); opacity: 0; } }\n        @keyframes tg-dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }\n        @keyframes tg-msg-in { from { transform: translateY(12px) scale(0.95); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }\n        @keyframes tg-popup-in { from { transform: translateY(18px) scale(0.88); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }\n        @keyframes tg-badge-pop { 0% { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.25) rotate(5deg); } 100% { transform: scale(1) rotate(0deg); } }\n      `}</style>\n    </div>\n  );\n}\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}