import { jsx as t } from "react/jsx-runtime";
import { phoneMasks as u } from "./index-phone-masks.js";
import { InputBase as c } from "./index-InputBase.js";
import { ComponentContainer as d } from "./index-ComponentContainer.js";
import { FlagAdornment as l } from "./index-FlagAdornment.js";
import { useState as p, useEffect as x } from "react";
const b = (o) => {
  const {
    className: n,
    type: s = "text",
    testId: m,
    countryCode: e
  } = o, [i, f] = p("");
  return x(() => {
    const r = u.find((a) => a.iso === e);
    r && f(r.code);
  }, [e]), e ? t(d, {
    className: n,
    children: t(c, {
      testId: m,
      type: s,
      multiline: !1,
      ...o,
      value: i,
      className: void 0,
      adornment: t(l, {
        countryCode: e.toLowerCase()
      })
    })
  }) : null;
};
export {
  b as PhoneNumberPrefix
};
