"use client";
import { j as r } from "../../../node_modules/.pnpm/react@19.1.0/node_modules/react/jsx-runtime.mjs";
import { useRef as y } from "react";
import o from "../../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.mjs";
import I from "../Button/index.mjs";
import n from "./RewardImage.module.scss.mjs";
import b from "../../../node_modules/.pnpm/@tabler_icons-react@3.34.0_react@19.1.0/node_modules/@tabler/icons-react/dist/esm/icons/IconCamera.mjs";
function v({
  label: u,
  inputProps: l,
  url: x,
  classNames: t,
  onFileChange: i,
  error: d,
  i18n: h = {
    changeImage: "Change image"
  }
}) {
  const f = y(null), g = () => {
    var e;
    return (e = f.current) == null ? void 0 : e.click();
  }, j = (e) => {
    const c = e.target.files ? e.target.files[0] : null;
    i == null || i(c);
  };
  let p;
  return x ? p = /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
    /* @__PURE__ */ r.jsx("img", { src: x, alt: "Reward image", className: n.image }),
    /* @__PURE__ */ r.jsx(
      I,
      {
        htmlType: "button",
        type: "secondaryGradient",
        className: o(n.changeButton, t == null ? void 0 : t.changeButton),
        onClick: g,
        children: h.changeImage
      }
    )
  ] }) : p = /* @__PURE__ */ r.jsx(
    "button",
    {
      type: "button",
      className: o(n.box, d && n.error, t == null ? void 0 : t.box),
      onClick: g,
      children: /* @__PURE__ */ r.jsx("div", { className: o(n.innerBox, t == null ? void 0 : t.innerBox), children: /* @__PURE__ */ r.jsx(b, { size: 24, color: "var(--color-neutral-100)" }) })
    }
  ), /* @__PURE__ */ r.jsxs("div", { className: o(n.root, t == null ? void 0 : t.root), children: [
    /* @__PURE__ */ r.jsx(
      "input",
      {
        type: "file",
        style: { display: "none" },
        onChange: j,
        ref: f,
        ...l
      }
    ),
    u && /* @__PURE__ */ r.jsx("label", { className: o(n.label, t == null ? void 0 : t.label), children: u }),
    p,
    /* @__PURE__ */ r.jsx("span", { className: o(n.errorText, "caption", t == null ? void 0 : t.errorText), children: d })
  ] });
}
export {
  v as default
};
//# sourceMappingURL=index.mjs.map
