import { I as j, a as V, b as z, C as O, c as E } from "./translations-BEMKy6-W.js";
import { Use as x, input as A, attr as n, coalesce as F, on as m, Empty as w, emitValue as v, prop as k, computedOf as C, html as p, aria as M, When as T, Fragment as B, Value as g, Unless as R, Ensure as S } from "@tempots/dom";
import { C as W } from "./use-form-DMiCxK26.js";
const L = (t) => {
  const l = {
    name: "email",
    autocomplete: "email",
    ...t
  }, {
    value: c,
    before: s,
    onBlur: o,
    onChange: d,
    onInput: r,
    placeholder: I
  } = l, b = s ?? j({
    icon: "line-md:email",
    size: t.size,
    color: "neutral"
  });
  return x(
    V,
    (f) => z({
      ...t,
      before: b,
      input: A.email(
        O(l),
        n.placeholder(F(I, f.$.emailPlaceholderText)),
        n.value(c),
        n.class("bc-input"),
        o != null ? m.blur(v(o)) : w,
        d != null ? m.change(v(d)) : w,
        r != null ? m.input(v(r)) : w
      )
    })
  );
}, Q = (t) => {
  const {
    value: l,
    onBlur: c,
    onChange: s,
    onInput: o,
    before: d,
    after: r,
    hasError: I,
    disabled: b,
    autocomplete: f,
    placeholder: _,
    ...h
  } = t, $ = {
    name: "password",
    disabled: b,
    ...h
  }, i = k(!0), a = C(
    i,
    f
  )((e, u) => e ? u ?? "current-password" : "off");
  return x(V, (e) => {
    const u = C(
      e.$.passwordPlaceholderText,
      i,
      _
    )((y, N, U) => N ? "•••••••••••••••" : U ?? y), P = p.button(
      n.type("button"),
      n.class("bc-input-container__password-toggle"),
      M.label(e.$.togglePasswordVisibility),
      m.click(() => i.update((y) => !y)),
      T(
        i,
        () => E({ icon: "line-md:watch" }),
        () => E({ icon: "line-md:watch-off" })
      )
    );
    return z({
      before: d,
      disabled: b,
      hasError: I,
      input: p.input(
        O({
          ...$,
          autocomplete: a,
          placeholder: u
        }),
        T(
          i,
          () => B(n.type("password")),
          () => B(n.type("text"))
        ),
        n.class("bc-input"),
        n.value(l),
        c != null ? m.blur(v(c)) : w,
        s != null ? m.change(v(s)) : w,
        o != null ? m.input(v(o)) : w
      ),
      after: r != null ? B(P, r) : P
    });
  });
};
function q(t) {
  switch (t) {
    case "success":
      return "material-symbols:check-circle-outline";
    case "warning":
      return "material-symbols:warning-outline";
    case "danger":
      return "material-symbols:error-outline";
    case "info":
    default:
      return "material-symbols:info-outline";
  }
}
function D(t) {
  switch (t) {
    case "success":
      return "success";
    case "warning":
      return "warning";
    case "danger":
      return "danger";
    case "info":
    default:
      return "info";
  }
}
function G(t, l, c, s) {
  const o = [
    "bc-notice",
    `bc-notice--${t}`,
    `bc-notice--tone-${l}`
  ];
  return c && o.push("bc-notice--dismissible"), s && s.length > 0 && o.push(s), o.join(" ");
}
function X({
  variant: t = "info",
  tone: l = "subtle",
  role: c,
  title: s,
  icon: o,
  closable: d = !1,
  onDismiss: r,
  class: I
}, ...b) {
  const f = k(!0);
  return T(f, () => {
    const _ = g.map(
      d,
      (a) => !!a || r != null
    ), h = g.map(t, (a) => a ?? "info"), $ = g.map(l, (a) => a ?? "subtle"), i = C(
      c,
      h
    )(
      (a, e) => a ?? (e === "danger" ? "alert" : "status")
    );
    return x(
      V,
      (a) => p.div(
        n.class(
          C(
            h,
            $,
            _,
            I
          )((e, u, P, y) => G(e, u, P, y))
        ),
        // Accessibility role mapping (always defined)
        n.role(g.map(i, (e) => e)),
        R(
          g.map(o, (e) => e === !1),
          () => p.div(
            n.class("bc-notice__icon"),
            E({
              icon: C(
                o,
                h
              )(
                (e, u) => e === void 0 ? q(u) : String(e)
              ),
              size: "md",
              color: g.map(h, D)
            })
          )
        ),
        p.div(
          n.class("bc-notice__body"),
          S(
            s,
            (e) => p.div(n.class("bc-notice__title"), e)
          ),
          p.div(n.class("bc-notice__content"), ...b)
        ),
        T(
          _,
          () => W({
            size: "xs",
            label: a.$.closeModal,
            onClick: () => {
              f.set(!1), r?.();
            }
          })
        )
      )
    );
  });
}
export {
  L as E,
  X as N,
  Q as P
};
