import { o as ve } from "./rolldown-runtime.js";
import { i as ye, t as we } from "./vendor/react.js";
import { t as Ne } from "./arrow-down.js";
import { t as te } from "./arrow-up.js";
import { n as W, r as oe } from "./FileUpload.js";
import { t as X } from "./x.js";
import { t as ae } from "./Button.js";
import { t as je } from "./dist.js";
import { t as o } from "./utils.js";
import { t as Ie } from "./create-safe-context.js";
var p = /* @__PURE__ */ ve(ye(), 1), e = we(), ie = "flex-1 h-[40px] resize-none overflow-y-auto bg-transparent text-base text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:text-muted-foreground", le = "flex-1 h-[40px] resize-none overflow-y-auto bg-transparent text-sm leading-5 text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:text-muted-foreground", Z = je("flex items-center w-full transition-[color,background-color,border-color,box-shadow,opacity] shadow-[0_8px_32px_rgba(0,0,0,0.1)]", {
  variants: {
    state: {
      default: "",
      focused: "",
      withText: "",
      disabled: "cursor-not-allowed",
      attachments: "",
      dragover: ""
    },
    variant: {
      default: "flex-col gap-2 py-4 px-4 rounded-3xl",
      compact: "flex-col gap-2 p-3 rounded-2xl",
      inline: "flex-row gap-2 px-[13px] py-1 rounded-2xl"
    }
  },
  compoundVariants: [
    {
      variant: "default",
      state: "default",
      className: "shadow-md"
    },
    {
      variant: "default",
      state: "focused",
      className: "shadow-lg"
    },
    {
      variant: "default",
      state: "withText",
      className: "shadow-lg"
    },
    {
      variant: "default",
      state: "disabled",
      className: "shadow-md"
    },
    {
      variant: "default",
      state: "attachments",
      className: "shadow-lg"
    },
    {
      variant: "default",
      state: "dragover",
      className: "shadow-lg"
    },
    {
      variant: "compact",
      state: "dragover",
      className: "shadow-lg"
    },
    {
      variant: "inline",
      state: "dragover",
      className: "shadow-lg"
    }
  ],
  defaultVariants: {
    state: "default",
    variant: "default"
  }
});
function _({ isDefault: n, dropText: a }) {
  return /* @__PURE__ */ (0, e.jsxs)("div", {
    "data-slot": "ai-input-drop-overlay",
    role: "status",
    "aria-live": "polite",
    className: o("delight-drop-enter absolute inset-1.5 border-2 border-dashed border-primary/50 dark:border-primary/60 pointer-events-none flex flex-col items-center justify-center gap-1.5 z-10", n ? "rounded-[calc(1.5rem-8px)]" : "rounded-[calc(1rem-8px)]"),
    children: [/* @__PURE__ */ (0, e.jsx)(Ne, { className: "size-4 text-primary/70 delight-drop-icon" }), /* @__PURE__ */ (0, e.jsx)("span", {
      className: "text-sm text-muted-foreground font-medium",
      children: a
    })]
  });
}
_.displayName = "AIInput.DropOverlay";
var [Ae, J] = Ie("AIInput");
function ue({ icon: n, onClick: a, disabled: r, tooltip: t, className: i, ...d }) {
  return /* @__PURE__ */ (0, e.jsx)("button", {
    type: "button",
    "data-slot": "action-button",
    onClick: a,
    disabled: r,
    title: t,
    "aria-label": t,
    className: o("p-2 rounded-full hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed", i),
    ...d,
    children: /* @__PURE__ */ (0, e.jsx)(n, { className: "size-5 text-quaternary-foreground" })
  });
}
ue.displayName = "AIInput.ActionButton";
function G({ icon: n = te, className: a, onClick: r, disabled: t, ...i }) {
  return /* @__PURE__ */ (0, e.jsx)(ae, {
    type: "button",
    "data-slot": "submit-button",
    size: "icon",
    onClick: r,
    disabled: t,
    "aria-label": "Send message",
    className: o("rounded-full bg-primary hover:bg-primary/90 text-primary-foreground disabled:bg-accent disabled:text-muted-foreground transition-colors duration-150 ease-out", a),
    ...i,
    children: /* @__PURE__ */ (0, e.jsx)(n, { className: "size-5" })
  });
}
G.displayName = "AIInput.SubmitButton";
function de({ icon: n, className: a, onClick: r, disabled: t, ...i }) {
  return /* @__PURE__ */ (0, e.jsx)(ae, {
    type: "button",
    "data-slot": "compact-action-button",
    onClick: r,
    disabled: t,
    appearance: "outline",
    variant: "secondary",
    size: "icon",
    className: o("rounded-full border-border text-foreground hover:bg-muted", a),
    ...i,
    children: /* @__PURE__ */ (0, e.jsx)(n, { className: "size-5" })
  });
}
de.displayName = "AIInput.CompactActionButton";
function V({ onClick: n }) {
  return /* @__PURE__ */ (0, e.jsxs)("button", {
    type: "button",
    onClick: n,
    "aria-label": "Remove all attached files",
    className: "flex items-center gap-1.5 h-5 px-2 py-1 rounded-full bg-accent border border-border text-xs font-medium text-foreground hover:bg-accent/80 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring transition-colors",
    children: [/* @__PURE__ */ (0, e.jsx)(X, { className: "size-4" }), "Remove all"]
  });
}
V.displayName = "AIInput.RemoveAllButton";
function ce({ children: n, variant: a = "default", value: r, defaultValue: t = "", onChange: i, onSubmit: d, uploadingFiles: h = [], onRemoveFile: z, onCancelUpload: B, onRetryUpload: D, onRemoveAllFiles: C, disabled: v = !1, className: Q, onFilesSelected: I, accept: l, multiple: F = !0, dropText: $ = "Drop files to attach" }) {
  const [O, S] = p.useState(t), [y, Y] = p.useState(!1), q = p.useRef(null), R = p.useRef(null), b = p.useRef(null), { isDragging: m, dropZoneProps: E, openFilePicker: T } = oe({
    onFilesSelected: I,
    accept: l,
    multiple: F,
    disabled: v,
    containerRef: b
  }), w = r !== void 0, c = w ? r : O, x = c.trim().length > 0, g = h.length > 0, u = p.useCallback((N) => {
    i && i(N), w || S(N);
  }, [i, w]), f = p.useCallback(() => {
    x && d && (d(c), w || S(""));
  }, [
    x,
    d,
    c,
    w
  ]), H = p.useCallback((N) => {
    N.key === "Enter" && !N.shiftKey && (N.preventDefault(), f());
  }, [f]), A = p.useCallback(() => {
    u(""), a === "inline" ? R.current?.focus() : q.current?.focus();
  }, [u, a]), P = () => v ? "disabled" : m ? "dragover" : g ? "attachments" : x ? "withText" : y ? "focused" : "default", K = y || x ? 2 : 1.25, M = p.useMemo(() => ({
    value: c,
    hasText: x,
    isFocused: y,
    disabled: v,
    variant: a,
    uploadingFiles: h,
    hasAttachments: g,
    setValue: u,
    setIsFocused: Y,
    handleSubmit: f,
    handleKeyDown: H,
    handleClear: A,
    onRemoveFile: z,
    onCancelUpload: B,
    onRetryUpload: D,
    onRemoveAllFiles: C,
    isDragging: m,
    openFilePicker: T,
    onFilesSelected: I,
    textareaRef: q,
    inputRef: R
  }), [
    c,
    x,
    y,
    v,
    a,
    h,
    g,
    u,
    f,
    H,
    A,
    z,
    B,
    D,
    C,
    m,
    T,
    I
  ]), j = a === "default", U = a === "inline";
  return /* @__PURE__ */ (0, e.jsx)(Ae.Provider, {
    value: M,
    children: /* @__PURE__ */ (0, e.jsx)("div", {
      ref: b,
      "data-slot": "ai-input",
      "data-gradient-active": !v && (m || !g && (y || x)),
      "data-dragging": m,
      ...E,
      ...I ? { "aria-label": "Chat input with file drop zone" } : {},
      className: o("relative w-full p-[1.25px] delight-gradient-border", j ? "rounded-3xl max-w-[850px]" : "rounded-2xl", v ? "bg-border" : m || g ? "bg-primary" : "bg-primary/50 hover:bg-primary", Q),
      style: { padding: `${K}px` },
      children: /* @__PURE__ */ (0, e.jsxs)("div", {
        "data-slot": "ai-input-inner",
        className: o(Z({
          state: P(),
          variant: a
        }), "relative", U && g && "flex-col py-3", v && !j ? "bg-muted" : "bg-background", j ? o("rounded-[calc(1.5rem-1.25px)]", (y || x) && "rounded-[calc(1.5rem-2px)]") : o("rounded-[calc(1rem-1.25px)]", (y || x) && "rounded-[calc(1rem-2px)]"), v && j && "bg-muted"),
        children: [m && /* @__PURE__ */ (0, e.jsx)(_, {
          isDefault: j,
          dropText: $
        }), n]
      })
    })
  });
}
ce.displayName = "AIInput.Root";
function pe({ placeholder: n = "How can HUMAIN ONE help you today?", className: a, showClearButton: r = !0 }) {
  const t = J(), i = t.variant === "inline", d = (h) => {
    t.setValue(h.target.value);
  };
  return i ? /* @__PURE__ */ (0, e.jsx)("input", {
    ref: t.inputRef,
    "data-slot": "ai-input-text",
    type: "text",
    value: t.value,
    onChange: d,
    onFocus: () => t.setIsFocused(!0),
    onBlur: () => t.setIsFocused(!1),
    onKeyDown: t.handleKeyDown,
    placeholder: n,
    "aria-label": n,
    disabled: t.disabled,
    className: o("flex-1 min-w-0 bg-transparent text-sm leading-5 text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:text-muted-foreground", a)
  }) : /* @__PURE__ */ (0, e.jsxs)("div", {
    "data-slot": "ai-input-text-area",
    className: "flex items-start gap-2 w-full",
    children: [/* @__PURE__ */ (0, e.jsx)("textarea", {
      ref: t.textareaRef,
      "data-slot": "ai-input-textarea",
      value: t.value,
      onChange: d,
      onFocus: () => t.setIsFocused(!0),
      onBlur: () => t.setIsFocused(!1),
      onKeyDown: t.handleKeyDown,
      placeholder: n,
      "aria-label": n,
      disabled: t.disabled,
      rows: 1,
      className: o(t.variant === "compact" ? le : ie, a)
    }), r && t.hasText && !t.disabled && /* @__PURE__ */ (0, e.jsx)("button", {
      type: "button",
      onClick: t.handleClear,
      "aria-label": "Clear input",
      className: "p-2 rounded-full hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring transition-colors duration-150 ease-out shrink-0",
      children: /* @__PURE__ */ (0, e.jsx)(X, { className: "size-5 text-muted-foreground" })
    })]
  });
}
pe.displayName = "AIInput.TextArea";
function se({ children: n, className: a }) {
  return /* @__PURE__ */ (0, e.jsx)("div", {
    "data-slot": "ai-input-leading-icon",
    "aria-hidden": "true",
    className: o("flex items-center justify-center shrink-0 size-9 rounded-xl bg-foreground/4 border border-border", a),
    children: n
  });
}
se.displayName = "AIInput.LeadingIcon";
function fe({ icon: n, className: a, ...r }) {
  const t = J(), i = n ?? te;
  return /* @__PURE__ */ (0, e.jsx)(ae, {
    type: "button",
    "data-slot": "ai-input-send-button",
    size: "icon",
    onClick: t.handleSubmit,
    disabled: t.disabled || !t.hasText,
    "aria-label": "Send message",
    className: o("rounded-full bg-primary hover:bg-primary/90 text-primary-foreground disabled:bg-accent disabled:text-muted-foreground", "transition-all duration-150 ease-out active:scale-90 motion-reduce:active:scale-100", a),
    ...r,
    children: /* @__PURE__ */ (0, e.jsx)(i, { className: "size-5" })
  });
}
fe.displayName = "AIInput.SendButton";
function me({ icon: n, tooltip: a, className: r, onClick: t, ...i }) {
  const d = J();
  return /* @__PURE__ */ (0, e.jsx)("button", {
    type: "button",
    "data-slot": "ai-input-attach-button",
    onClick: p.useCallback((h) => {
      t ? t(h) : d.onFilesSelected && d.openFilePicker();
    }, [
      t,
      d.onFilesSelected,
      d.openFilePicker
    ]),
    disabled: d.disabled,
    title: a,
    "aria-label": a ?? "Attach file",
    className: o("p-2.5 min-h-11 min-w-11 flex items-center justify-center rounded-full hover:bg-accent transition-colors disabled:opacity-50 disabled:cursor-not-allowed", r),
    ...i,
    children: /* @__PURE__ */ (0, e.jsx)(n, { className: "size-5 text-quaternary-foreground" })
  });
}
me.displayName = "AIInput.AttachButton";
function xe({ children: n, position: a = "leading", className: r }) {
  return /* @__PURE__ */ (0, e.jsx)("div", {
    "data-slot": "ai-input-actions",
    "data-position": a,
    className: o("flex items-center gap-2", r),
    children: n
  });
}
xe.displayName = "AIInput.Actions";
function ge({ children: n, className: a }) {
  return /* @__PURE__ */ (0, e.jsx)("div", {
    "data-slot": "ai-input-action-bar",
    className: o("flex items-center justify-between w-full", a),
    children: n
  });
}
ge.displayName = "AIInput.ActionBar";
function be({ className: n }) {
  const a = J();
  if (!a.hasAttachments) return null;
  const r = a.uploadingFiles.filter((t) => t.status === "complete" || t.progress >= 100);
  return a.variant !== "default" ? /* @__PURE__ */ (0, e.jsxs)("div", {
    "data-slot": "ai-input-file-preview",
    className: o("w-full flex flex-col gap-2", n),
    children: [
      /* @__PURE__ */ (0, e.jsx)("div", {
        className: "flex gap-2 w-full overflow-x-auto",
        children: a.uploadingFiles.map((t, i) => /* @__PURE__ */ (0, e.jsx)(W, {
          progressType: "compact",
          fileName: t.name,
          fileExtension: t.fileExtension ?? t.name.split(".").pop(),
          progress: t.progress,
          status: t.status,
          className: "shrink-0 delight-stagger",
          style: { "--delight-delay": `${i * 60}ms` },
          onRemove: () => a.onRemoveFile?.(t.id),
          onCancel: () => a.onCancelUpload?.(t.id),
          onRetry: () => a.onRetryUpload?.(t.id)
        }, t.id))
      }),
      /* @__PURE__ */ (0, e.jsxs)("div", {
        className: "flex items-center justify-between w-full",
        children: [/* @__PURE__ */ (0, e.jsxs)("span", {
          className: "text-xs text-card-foreground",
          children: [
            r.length,
            " file",
            r.length !== 1 ? "s" : "",
            " added"
          ]
        }), /* @__PURE__ */ (0, e.jsx)(V, { onClick: a.onRemoveAllFiles })]
      }),
      /* @__PURE__ */ (0, e.jsx)("div", { className: "w-full h-px bg-border" })
    ]
  }) : /* @__PURE__ */ (0, e.jsxs)("div", {
    "data-slot": "ai-input-file-preview",
    className: o("w-full flex flex-col gap-2", n),
    children: [
      /* @__PURE__ */ (0, e.jsx)("div", {
        className: "flex items-start gap-2 w-full overflow-x-auto",
        children: a.uploadingFiles.map((t, i) => /* @__PURE__ */ (0, e.jsx)(W, {
          fileName: t.name,
          fileSize: t.size,
          fileExtension: t.fileExtension ?? t.name.split(".").pop(),
          progress: t.progress,
          status: t.status,
          progressType: "fill",
          className: "flex-1 min-w-0 delight-stagger",
          style: { "--delight-delay": `${i * 60}ms` },
          onRemove: () => a.onRemoveFile?.(t.id),
          onCancel: () => a.onCancelUpload?.(t.id),
          onRetry: () => a.onRetryUpload?.(t.id)
        }, t.id))
      }),
      /* @__PURE__ */ (0, e.jsxs)("div", {
        className: "flex items-end justify-between w-full",
        children: [/* @__PURE__ */ (0, e.jsxs)("span", {
          className: "text-xs text-card-foreground",
          children: [
            r.length,
            " file",
            r.length !== 1 ? "s" : "",
            " added"
          ]
        }), /* @__PURE__ */ (0, e.jsx)(V, { onClick: a.onRemoveAllFiles })]
      }),
      /* @__PURE__ */ (0, e.jsx)("div", { className: "w-full h-px bg-border" })
    ]
  });
}
be.displayName = "AIInput.FilePreview";
function he({ variant: n = "default", placeholder: a = "How can HUMAIN ONE help you today?", value: r, onChange: t, onSubmit: i, uploadingFiles: d = [], onRemoveFile: h, onCancelUpload: z, onRetryUpload: B, onRemoveAllFiles: D, onFilesSelected: C, accept: v, multiple: Q = !0, dropText: I = "Drop files to attach", disabled: l = !1, className: F, leadingActions: $, trailingActions: O, submitButton: S, defaultButton: y, leadingIcon: Y }) {
  const [q, R] = p.useState(""), [b, m] = p.useState(!1), E = p.useRef(null), T = p.useRef(null), w = p.useRef(null), { isDragging: c, dropZoneProps: x } = oe({
    onFilesSelected: C,
    accept: v,
    multiple: Q,
    disabled: l,
    containerRef: w
  }), g = r !== void 0 ? r : q, u = g.trim().length > 0, f = d.length > 0, H = n === "inline", A = n === "default", P = () => l ? "disabled" : c ? "dragover" : f ? "attachments" : u ? "withText" : b ? "focused" : "default", K = (s) => {
    const k = s.target.value;
    t ? t(k) : R(k);
  }, M = () => {
    u && i && (i(g), r || R(""));
  }, j = (s) => {
    s.key === "Enter" && !s.shiftKey && (s.preventDefault(), M());
  }, U = () => {
    t ? t("") : R(""), n === "inline" ? T.current?.focus() : E.current?.focus();
  }, N = b || u ? 2 : 1.25, ee = () => {
    const s = {
      onClick: M,
      disabled: l || !u
    };
    return S ? S(s) : /* @__PURE__ */ (0, e.jsx)(G, { ...s });
  }, ne = () => {
    const s = { disabled: l || !u };
    return y ? y(s) : /* @__PURE__ */ (0, e.jsx)(G, {
      icon: te,
      ...s
    });
  }, L = d.filter((s) => s.status === "complete" || s.progress >= 100).length, re = !A && f && /* @__PURE__ */ (0, e.jsxs)("div", {
    "data-slot": "ai-input-file-preview",
    className: "w-full flex flex-col gap-2",
    children: [
      /* @__PURE__ */ (0, e.jsx)("div", {
        className: "flex gap-2 w-full overflow-x-auto",
        children: d.map((s, k) => /* @__PURE__ */ (0, e.jsx)(W, {
          progressType: "compact",
          fileName: s.name,
          fileExtension: s.fileExtension ?? s.name.split(".").pop(),
          progress: s.progress,
          status: s.status,
          className: "shrink-0 delight-stagger",
          style: { "--delight-delay": `${k * 60}ms` },
          onRemove: () => h?.(s.id),
          onCancel: () => z?.(s.id),
          onRetry: () => B?.(s.id)
        }, s.id))
      }),
      /* @__PURE__ */ (0, e.jsxs)("div", {
        className: "flex items-center justify-between w-full",
        children: [/* @__PURE__ */ (0, e.jsxs)("span", {
          className: "text-xs text-card-foreground",
          children: [
            L,
            " file",
            L !== 1 ? "s" : "",
            " added"
          ]
        }), /* @__PURE__ */ (0, e.jsx)(V, { onClick: D })]
      }),
      /* @__PURE__ */ (0, e.jsx)("div", { className: "w-full h-px bg-border" })
    ]
  });
  return H ? /* @__PURE__ */ (0, e.jsx)("div", {
    ref: w,
    "data-slot": "ai-input",
    "data-gradient-active": !l && (c || !f && (b || u)),
    "data-dragging": c,
    ...x,
    ...C ? { "aria-label": "Chat input with file drop zone" } : {},
    className: o("relative rounded-2xl w-full p-[1.25px] delight-gradient-border", l ? "bg-border" : c || f ? "bg-primary" : "bg-primary/50 hover:bg-primary", F),
    style: { padding: `${N}px` },
    children: /* @__PURE__ */ (0, e.jsxs)("div", {
      "data-slot": "ai-input-inner",
      className: o(Z({
        state: P(),
        variant: "inline"
      }), "relative", f && "flex-col py-3", l ? "bg-muted" : "bg-background", "rounded-[calc(1rem-1.25px)]", (b || u) && "rounded-[calc(1rem-2px)]"),
      children: [
        c && /* @__PURE__ */ (0, e.jsx)(_, {
          isDefault: A,
          dropText: I
        }),
        re,
        /* @__PURE__ */ (0, e.jsxs)("div", {
          className: "flex items-center gap-2 w-full",
          children: [
            /* @__PURE__ */ (0, e.jsx)(se, { children: Y }),
            /* @__PURE__ */ (0, e.jsx)("input", {
              ref: T,
              "data-slot": "ai-input-text",
              type: "text",
              value: g,
              onChange: K,
              onFocus: () => m(!0),
              onBlur: () => m(!1),
              onKeyDown: j,
              placeholder: a,
              "aria-label": a,
              disabled: l,
              className: "flex-1 min-w-0 bg-transparent text-sm leading-5 text-foreground placeholder:text-muted-foreground focus-visible:outline-none disabled:cursor-not-allowed disabled:text-muted-foreground"
            }),
            ee()
          ]
        })
      ]
    })
  }) : A ? /* @__PURE__ */ (0, e.jsx)("div", {
    ref: w,
    "data-slot": "ai-input",
    "data-gradient-active": !l && (c || !f && (b || u)),
    "data-dragging": c,
    ...x,
    ...C ? { "aria-label": "Chat input with file drop zone" } : {},
    className: o("relative rounded-3xl w-full max-w-[850px] p-[1.25px] delight-gradient-border", l ? "bg-border" : c || f ? "bg-primary" : "bg-primary/50 hover:bg-primary", F),
    style: { padding: `${N}px` },
    children: /* @__PURE__ */ (0, e.jsxs)("div", {
      "data-slot": "ai-input-inner",
      className: o(Z({
        state: P(),
        variant: "default"
      }), "relative bg-background rounded-[calc(1.5rem-1.25px)]", (b || u) && "rounded-[calc(1.5rem-2px)]", l && "bg-muted"),
      children: [
        c && /* @__PURE__ */ (0, e.jsx)(_, {
          isDefault: A,
          dropText: I
        }),
        f && /* @__PURE__ */ (0, e.jsxs)("div", {
          "data-slot": "ai-input-file-preview",
          className: "w-full flex flex-col gap-2",
          children: [
            /* @__PURE__ */ (0, e.jsx)("div", {
              className: "flex items-start gap-2 w-full overflow-x-auto",
              children: d.map((s, k) => /* @__PURE__ */ (0, e.jsx)(W, {
                fileName: s.name,
                fileSize: s.size,
                fileExtension: s.fileExtension ?? s.name.split(".").pop(),
                progress: s.progress,
                status: s.status,
                className: "flex-1 min-w-0 delight-stagger",
                style: { "--delight-delay": `${k * 60}ms` },
                onRemove: () => h?.(s.id),
                onCancel: () => z?.(s.id),
                onRetry: () => B?.(s.id)
              }, s.id))
            }),
            /* @__PURE__ */ (0, e.jsxs)("div", {
              className: "flex items-end justify-between w-full",
              children: [/* @__PURE__ */ (0, e.jsxs)("span", {
                className: "text-xs text-card-foreground",
                children: [
                  L,
                  " file",
                  L !== 1 ? "s" : "",
                  " added"
                ]
              }), /* @__PURE__ */ (0, e.jsx)(V, { onClick: D })]
            }),
            /* @__PURE__ */ (0, e.jsx)("div", { className: "w-full h-px bg-border" })
          ]
        }),
        /* @__PURE__ */ (0, e.jsxs)("div", {
          "data-slot": "ai-input-text-area",
          className: "flex items-start gap-2 w-full",
          children: [/* @__PURE__ */ (0, e.jsx)("textarea", {
            ref: E,
            "data-slot": "ai-input-textarea",
            value: g,
            onChange: K,
            onFocus: () => m(!0),
            onBlur: () => m(!1),
            onKeyDown: j,
            placeholder: a,
            "aria-label": a,
            disabled: l,
            rows: 1,
            className: ie
          }), u && !l && /* @__PURE__ */ (0, e.jsx)("button", {
            type: "button",
            onClick: U,
            "aria-label": "Clear input",
            className: "p-2 rounded-full hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring transition-colors duration-150 ease-out shrink-0",
            children: /* @__PURE__ */ (0, e.jsx)(X, { className: "size-5 text-muted-foreground" })
          })]
        }),
        /* @__PURE__ */ (0, e.jsxs)("div", {
          "data-slot": "ai-input-action-bar",
          className: "flex items-center justify-between w-full",
          children: [/* @__PURE__ */ (0, e.jsx)("div", {
            "data-slot": "ai-input-actions",
            className: "flex items-center gap-2",
            children: $
          }), /* @__PURE__ */ (0, e.jsxs)("div", {
            "data-slot": "ai-input-actions",
            className: "flex items-center gap-2",
            children: [O, u ? ee() : ne()]
          })]
        })
      ]
    })
  }) : /* @__PURE__ */ (0, e.jsx)("div", {
    ref: w,
    "data-slot": "ai-input",
    "data-gradient-active": !l && (c || !f && (b || u)),
    "data-dragging": c,
    ...x,
    ...C ? { "aria-label": "Chat input with file drop zone" } : {},
    className: o("relative rounded-2xl w-full p-[1.25px] delight-gradient-border", l ? "bg-border" : c || f ? "bg-primary" : "bg-primary/50 hover:bg-primary", F),
    style: { padding: `${N}px` },
    children: /* @__PURE__ */ (0, e.jsxs)("div", {
      "data-slot": "ai-input-inner",
      className: o(Z({
        state: P(),
        variant: "compact"
      }), "relative", l ? "bg-muted" : "bg-background", "rounded-[calc(1rem-1.25px)]", (b || u) && "rounded-[calc(1rem-2px)]"),
      children: [
        c && /* @__PURE__ */ (0, e.jsx)(_, {
          isDefault: A,
          dropText: I
        }),
        re,
        /* @__PURE__ */ (0, e.jsxs)("div", {
          "data-slot": "ai-input-text-area",
          className: "flex items-start gap-2 w-full",
          children: [/* @__PURE__ */ (0, e.jsx)("textarea", {
            ref: E,
            "data-slot": "ai-input-textarea",
            value: g,
            onChange: K,
            onFocus: () => m(!0),
            onBlur: () => m(!1),
            onKeyDown: j,
            placeholder: a,
            "aria-label": a,
            disabled: l,
            rows: 1,
            className: le
          }), u && !l && /* @__PURE__ */ (0, e.jsx)("button", {
            type: "button",
            onClick: U,
            "aria-label": "Clear input",
            className: "p-2 rounded-full hover:bg-accent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring transition-colors duration-150 ease-out shrink-0",
            children: /* @__PURE__ */ (0, e.jsx)(X, { className: "size-5 text-muted-foreground" })
          })]
        }),
        /* @__PURE__ */ (0, e.jsxs)("div", {
          "data-slot": "ai-input-action-bar",
          className: "flex items-center justify-between w-full",
          children: [/* @__PURE__ */ (0, e.jsx)("div", {
            "data-slot": "ai-input-actions",
            className: "flex items-center gap-2",
            children: $
          }), /* @__PURE__ */ (0, e.jsxs)("div", {
            "data-slot": "ai-input-actions",
            className: "flex items-center gap-2",
            children: [O, u ? ee() : ne()]
          })]
        })
      ]
    })
  });
}
he.displayName = "AIInput";
var Pe = Object.assign(he, {
  Root: ce,
  TextArea: pe,
  LeadingIcon: se,
  SendButton: fe,
  AttachButton: me,
  Actions: xe,
  ActionBar: ge,
  FilePreview: be,
  ActionButton: ue,
  SubmitButton: G,
  CompactActionButton: de
});
export {
  Pe as t
};

//# sourceMappingURL=AIInput.js.map