import { jsx as u } from "../../../../../preact@10.29.0/node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js";
import { useMemo as p } from "../../../../../preact@10.29.0/node_modules/preact/hooks/dist/hooks.module.js";
import { a as o } from "./InputText-C55stM8O.js";
try {
  let e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}, t = new e.Error().stack;
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "58040435-841e-4f4a-bf8b-899df760df1a", e._sentryDebugIdIdentifier = "sentry-dbid-58040435-841e-4f4a-bf8b-899df760df1a");
} catch {
}
const c = () => {
  const e = document.createElement("input");
  return e.setAttribute("type", "date"), e.type === "date";
}, d = (e) => {
  const t = e.replace(/\D|\s/g, "").replace(/^(00)(.*)?/, "01$2").replace(/^(3[2-9])(.*)?/, "0$1$2").replace(/^([4-9])(.*)?/, "0$1").replace(/^([0-9]{2})(00)(.*)?/, "$101").replace(/^(3[01])(02)(.*)?/, "29$2").replace(/^([0-9]{2})([2-9]|1[3-9])(.*)?/, "$10$2").replace(/^([0-9]{2})([0-9]{2})([0-9])/, "$1/$2/$3").replace(/^([0-9]{2})([0-9])/, "$1/$2"), [r = "", a = "", n = ""] = t.split("/");
  return n.length === 4 && r === "29" && a === "02" && (Number(n) % 4 !== 0 || n.substring(2, 4) === "00" && Number(n) % 400 !== 0) ? t.replace(/^29/, "28") : t;
};
function b(e) {
  const t = p(c, []), { onInput: r } = e, a = (n) => {
    const { value: s } = n.currentTarget;
    n.currentTarget.value = d(s), r(n);
  };
  return t ? /* @__PURE__ */ u(o, { ...e, type: "date" }) : /* @__PURE__ */ u(o, { ...e, onInput: a, maxLength: 10 });
}
export {
  b as I
};
