import { jsx, jsxs } from "react/jsx-runtime";
import { useState, useEffect } from "react";
import { getAssetUrl } from "../../utils/assetBase.js";
import ChatInput from "./chatInput.js";
const SmartBotIcon = getAssetUrl("icons/smartBotAlan.svg");
const SunIcon = getAssetUrl("icons/sun.webp");
const getGreeting = () => {
  const hour = (/* @__PURE__ */ new Date()).getHours();
  if (hour >= 5 && hour < 12) return "Good Morning";
  if (hour >= 12 && hour < 16) return "Good Afternoon";
  return "Good Evening";
};
function NewChatComponent({
  userName,
  inputValue,
  setInputValue,
  setIsNewChat,
  onSendIconClick,
  userChats,
  setUserChats,
  activeList,
  handleRefresh,
  handleMicClick,
  suggestionBanner,
  isStopIcon,
  onStopIconClick,
  onCloseSuggestionBanner,
  showSuggestionBanner,
  customInputComponent
}) {
  const [loading, setLoading] = useState(true);
  const [greeting, setGreeting] = useState(getGreeting());
  useEffect(() => {
    const timer = setTimeout(() => {
      setLoading(false);
    }, 450);
    return () => {
      clearTimeout(timer);
    };
  }, []);
  useEffect(() => {
    setGreeting(getGreeting());
  }, []);
  return /* @__PURE__ */ jsx("div", { className: "chatbot-component-body", children: /* @__PURE__ */ jsxs("div", { className: "chatbot-component-body-container", children: [
    /* @__PURE__ */ jsx("div", { className: `chatbot-component-body-icon${loading ? " rotating" : ""}`, children: /* @__PURE__ */ jsx("img", { alt: "smartbot", src: SmartBotIcon }) }),
    /* @__PURE__ */ jsxs("div", { className: "chatbot-component-body-text", children: [
      /* @__PURE__ */ jsxs("span", { className: "chatbot-component-body-text-title", children: [
        greeting,
        " ",
        /* @__PURE__ */ jsxs("span", { className: "chatbot-component-body-text-username", children: [
          userName,
          "!"
        ] }),
        /* @__PURE__ */ jsx("img", { alt: "sun", src: SunIcon })
      ] }),
      /* @__PURE__ */ jsx("span", { className: "chatbot-component-body-text-description", children: "I am Alan, how can I help you today?" })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "chatbot-component-body-input-container", children: /* @__PURE__ */ jsx(
      ChatInput,
      {
        newChatScreen: true,
        activeList,
        customInputComponent,
        handleMicClick,
        handleRefresh,
        inputValue,
        isStopIcon,
        minRows: 4,
        setInputValue,
        setIsNewChat,
        setUserChats,
        showSuggestionBanner,
        suggestionBanner,
        userChats,
        onCloseSuggestionBanner,
        onSendIconClick,
        onStopIconClick
      }
    ) })
  ] }) });
}
export {
  NewChatComponent
};
