import T from "./index-objectWithoutPropertiesLoose.js";
import f from "./index-extends.js";
import * as b from "react";
import o from "./index-_virtual16.js";
import { clsx as I } from "./index-clsx.js";
import N from "./index-FormControlContext.js";
import A from "./index-useFormControl.js";
import C from "./index-styled.js";
import y, { getInputAdornmentUtilityClass as L } from "./index-inputAdornmentClasses.js";
import { jsx as p, jsxs as O } from "react/jsx-runtime";
import { useDefaultProps as R } from "./index-DefaultPropsProvider.js";
import j from "./index-Typography.js";
import v from "./index-capitalize.js";
import _ from "./index-composeClasses.js";
var g;
const z = ["children", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"], $ = (t, e) => {
  const {
    ownerState: n
  } = t;
  return [e.root, e[`position${v(n.position)}`], n.disablePointerEvents === !0 && e.disablePointerEvents, e[n.variant]];
}, F = (t) => {
  const {
    classes: e,
    disablePointerEvents: n,
    hiddenLabel: s,
    position: r,
    size: a,
    variant: l
  } = t, d = {
    root: ["root", n && "disablePointerEvents", r && `position${v(r)}`, l, s && "hiddenLabel", a && `size${v(a)}`]
  };
  return _(d, L, e);
}, w = C("div", {
  name: "MuiInputAdornment",
  slot: "Root",
  overridesResolver: $
})(({
  theme: t,
  ownerState: e
}) => f({
  display: "flex",
  height: "0.01em",
  // Fix IE11 flexbox alignment. To remove at some point.
  maxHeight: "2em",
  alignItems: "center",
  whiteSpace: "nowrap",
  color: (t.vars || t).palette.action.active
}, e.variant === "filled" && {
  // Styles applied to the root element if `variant="filled"`.
  [`&.${y.positionStart}&:not(.${y.hiddenLabel})`]: {
    marginTop: 16
  }
}, e.position === "start" && {
  // Styles applied to the root element if `position="start"`.
  marginRight: 8
}, e.position === "end" && {
  // Styles applied to the root element if `position="end"`.
  marginLeft: 8
}, e.disablePointerEvents === !0 && {
  // Styles applied to the root element if `disablePointerEvents={true}`.
  pointerEvents: "none"
})), D = /* @__PURE__ */ b.forwardRef(function(e, n) {
  const s = R({
    props: e,
    name: "MuiInputAdornment"
  }), {
    children: r,
    className: a,
    component: l = "div",
    disablePointerEvents: d = !1,
    disableTypography: E = !1,
    position: u,
    variant: m
  } = s, P = T(s, z), i = A() || {};
  let c = m;
  m && i.variant && process.env.NODE_ENV !== "production" && i.variant, i && !c && (c = i.variant);
  const h = f({}, s, {
    hiddenLabel: i.hiddenLabel,
    size: i.size,
    disablePointerEvents: d,
    position: u,
    variant: c
  }), x = F(h);
  return /* @__PURE__ */ p(N.Provider, {
    value: null,
    children: /* @__PURE__ */ p(w, f({
      as: l,
      ownerState: h,
      className: I(x.root, a),
      ref: n
    }, P, {
      children: typeof r == "string" && !E ? /* @__PURE__ */ p(j, {
        color: "text.secondary",
        children: r
      }) : /* @__PURE__ */ O(b.Fragment, {
        children: [u === "start" ? (
          /* notranslate needed while Google Translate will not fix zero-width space issue */
          g || (g = /* @__PURE__ */ p("span", {
            className: "notranslate",
            children: "​"
          }))
        ) : null, r]
      })
    }))
  });
});
process.env.NODE_ENV !== "production" && (D.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * The content of the component, normally an `IconButton` or string.
   */
  children: o.node,
  /**
   * Override or extend the styles applied to the component.
   */
  classes: o.object,
  /**
   * @ignore
   */
  className: o.string,
  /**
   * The component used for the root node.
   * Either a string to use a HTML element or a component.
   */
  component: o.elementType,
  /**
   * Disable pointer events on the root.
   * This allows for the content of the adornment to focus the `input` on click.
   * @default false
   */
  disablePointerEvents: o.bool,
  /**
   * If children is a string then disable wrapping in a Typography component.
   * @default false
   */
  disableTypography: o.bool,
  /**
   * The position this adornment should appear relative to the `Input`.
   */
  position: o.oneOf(["end", "start"]).isRequired,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
  /**
   * The variant to use.
   * Note: If you are using the `TextField` component or the `FormControl` component
   * you do not have to set this manually.
   */
  variant: o.oneOf(["filled", "outlined", "standard"])
});
export {
  D as default
};
