import { jsxs as n, jsx as t } from "react/jsx-runtime";
import { a } from "./twind.Cg2g8xBZ.js";
import "react";
import "./index.D1n9HtNk.js";
import { aC as u, r as d, bu as g } from "./use-page-data.BYLN5MSa.js";
import { f as x } from "./index.XOBVdtzY.js";
import { o as c } from "./Editor.Dux-10a7.js";
function b(o) {
  return u({ attr: { viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8z" }, child: [] }, { tag: "path", attr: { d: "M9 9h6v6H9z" }, child: [] }] })(o);
}
function A({
  input: o,
  setInput: m,
  onSubmit: i,
  status: l,
  disabled: r,
  stop: p,
  messages: f,
  showWebSearch: y = !1,
  onWebSearchToggle: w,
  ref: h
}) {
  const s = d();
  return /* @__PURE__ */ n(
    "form",
    {
      onSubmit: i,
      className: a(
        "flex flex-col flex-1 min-h-[150px] max-h-[150px] gap-1.5 p-2 justify-center mt-2",
        "bg-upstart-100 border-t border-upstart-300 relative",
        s.isReady === !1 && "rounded-lg"
      ),
      children: [
        /* @__PURE__ */ t(
          "textarea",
          {
            ref: h,
            onChange: (e) => m(e.target.value),
            value: o,
            autoFocus: !0,
            onKeyDown: (e) => {
              e.key === "Enter" && !e.shiftKey && i(e);
            },
            disabled: r,
            name: "prompt",
            spellCheck: !1,
            autoComplete: "off",
            autoCorrect: "off",
            placeholder: f.some((e) => e.role === "user") ? void 0 : "Add a section just below the navbar containing a paragraph with a short description of the site.",
            className: a(
              "form-textarea ",
              s.isReady === !1 ? "!text-fluid-sm" : "text-sm",
              "h-full w-full rounded scrollbar-thin p-2 !pb-9 border-upstart-300 shadow-inner focus:(!outline-0 !ring-upstart-500 !border-upstart-500)",
              r ? "!bg-gray-200" : "!bg-white"
            )
          }
        ),
        /* @__PURE__ */ n(
          "div",
          {
            className: a(
              "flex justify-between items-center h-9 text-gray-500 absolute left-[9px] right-[9px] rounded bottom-2.5 px-2 z-50 ",
              r ? "bg-gray-200" : "bg-white"
            ),
            children: [
              /* @__PURE__ */ t(
                "button",
                {
                  disabled: r,
                  type: "button",
                  className: a("hover:bg-upstart-200 p-1 rounded inline-flex text-sm gap-1"),
                  children: /* @__PURE__ */ t(x, { className: "h-5 w-5" })
                }
              ),
              s.isReady && !1,
              l === "submitted" || l === "streaming" ? /* @__PURE__ */ t(
                c,
                {
                  type: "button",
                  size: "1",
                  className: a("flex items-center justify-center gap-0.5"),
                  onClick: p,
                  children: /* @__PURE__ */ t(b, { className: "text-lg" })
                }
              ) : /* @__PURE__ */ t(
                c,
                {
                  type: "submit",
                  size: "1",
                  className: a("flex items-center gap-0.5"),
                  disabled: r || o.trim().length === 0,
                  children: /* @__PURE__ */ t(g, { className: "text-lg" })
                }
              )
            ]
          }
        )
      ]
    }
  );
}
export {
  A as default
};
