import p from "./index-extends.js";
import I from "./index-objectWithoutPropertiesLoose.js";
import * as u from "react";
import e from "./index-_virtual16.js";
import { clsx as z } from "./index-clsx.js";
import B from "./index-SelectInput.js";
import G from "./index-formControlState.js";
import H from "./index-useFormControl.js";
import J from "./index-ArrowDropDown.js";
import K from "./index-NativeSelectInput.js";
import d from "./index-styled.js";
import { jsx as a } from "react/jsx-runtime";
import { useDefaultProps as Q } from "./index-DefaultPropsProvider.js";
import X from "./index-useForkRef.js";
import Y from "./index-getReactElementRef.js";
import Z from "./index-deepmerge.js";
import $ from "./index-FilledInput.js";
import ee from "./index-OutlinedInput.js";
import oe from "./index-Input2.js";
import te from "./index-rootShouldForwardProp.js";
const ne = ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"], re = ["root"], se = (o) => {
  const {
    classes: t
  } = o;
  return t;
}, f = {
  name: "MuiSelect",
  overridesResolver: (o, t) => t.root,
  shouldForwardProp: (o) => te(o) && o !== "variant",
  slot: "Root"
}, le = d(oe, f)(""), pe = d(ee, f)(""), ae = d($, f)(""), O = /* @__PURE__ */ u.forwardRef(function(t, h) {
  const r = Q({
    name: "MuiSelect",
    props: t
  }), {
    autoWidth: w = !1,
    children: N,
    classes: R = {},
    className: g,
    defaultOpen: j = !1,
    displayEmpty: y = !1,
    IconComponent: D = J,
    id: b,
    input: s,
    inputProps: i,
    label: F,
    labelId: x,
    MenuProps: E,
    multiple: S = !1,
    native: c = !1,
    onClose: T,
    onOpen: M,
    open: V,
    renderValue: _,
    SelectDisplayProps: W,
    variant: k = "outlined"
  } = r, A = I(r, ne), L = c ? K : B, U = H(), P = G({
    props: r,
    muiFormControl: U,
    states: ["variant", "error"]
  }), n = P.variant || k, l = p({}, r, {
    variant: n,
    classes: R
  }), v = se(l), C = I(v, re), m = s || {
    standard: /* @__PURE__ */ a(le, {
      ownerState: l
    }),
    outlined: /* @__PURE__ */ a(pe, {
      label: F,
      ownerState: l
    }),
    filled: /* @__PURE__ */ a(ae, {
      ownerState: l
    })
  }[n], q = X(h, Y(m));
  return /* @__PURE__ */ a(u.Fragment, {
    children: /* @__PURE__ */ u.cloneElement(m, p({
      // Most of the logic is implemented in `SelectInput`.
      // The `Select` component is a simple API wrapper to expose something better to play with.
      inputComponent: L,
      inputProps: p({
        children: N,
        error: P.error,
        IconComponent: D,
        variant: n,
        type: void 0,
        // We render a select. We can ignore the type provided by the `Input`.
        multiple: S
      }, c ? {
        id: b
      } : {
        autoWidth: w,
        defaultOpen: j,
        displayEmpty: y,
        labelId: x,
        MenuProps: E,
        onClose: T,
        onOpen: M,
        open: V,
        renderValue: _,
        SelectDisplayProps: p({
          id: b
        }, W)
      }, i, {
        classes: i ? Z(C, i.classes) : C
      }, s ? s.props.inputProps : {})
    }, (S && c || y) && n === "outlined" ? {
      notched: !0
    } : {}, {
      ref: q,
      className: z(m.props.className, g, v.root)
    }, !s && {
      variant: n
    }, A))
  });
});
process.env.NODE_ENV !== "production" && (O.propTypes = {
  // ┌────────────────────────────── Warning ──────────────────────────────┐
  // │ These PropTypes are generated from the TypeScript type definitions. │
  // │    To update them, edit the d.ts file and run `pnpm proptypes`.     │
  // └─────────────────────────────────────────────────────────────────────┘
  /**
   * If `true`, the width of the popover will automatically be set according to the items inside the
   * menu, otherwise it will be at least the width of the select input.
   * @default false
   */
  autoWidth: e.bool,
  /**
   * The option elements to populate the select with.
   * Can be some `MenuItem` when `native` is false and `option` when `native` is true.
   *
   * ⚠️The `MenuItem` elements **must** be direct descendants when `native` is false.
   */
  children: e.node,
  /**
   * Override or extend the styles applied to the component.
   * @default {}
   */
  classes: e.object,
  /**
   * @ignore
   */
  className: e.string,
  /**
   * If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
   * You can only use it when the `native` prop is `false` (default).
   * @default false
   */
  defaultOpen: e.bool,
  /**
   * The default value. Use when the component is not controlled.
   */
  defaultValue: e.any,
  /**
   * If `true`, a value is displayed even if no items are selected.
   *
   * In order to display a meaningful value, a function can be passed to the `renderValue` prop which
   * returns the value to be displayed when no items are selected.
   *
   * ⚠️ When using this prop, make sure the label doesn't overlap with the empty displayed value.
   * The label should either be hidden or forced to a shrunk state.
   * @default false
   */
  displayEmpty: e.bool,
  /**
   * The icon that displays the arrow.
   * @default ArrowDropDownIcon
   */
  IconComponent: e.elementType,
  /**
   * The `id` of the wrapper element or the `select` element when `native`.
   */
  id: e.string,
  /**
   * An `Input` element; does not have to be a material-ui specific `Input`.
   */
  input: e.element,
  /**
   * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.
   * When `native` is `true`, the attributes are applied on the `select` element.
   */
  inputProps: e.object,
  /**
   * See [OutlinedInput#label](/material-ui/api/outlined-input/#props)
   */
  label: e.node,
  /**
   * The ID of an element that acts as an additional label. The Select will
   * be labelled by the additional label and the selected value.
   */
  labelId: e.string,
  /**
   * Props applied to the [`Menu`](/material-ui/api/menu/) element.
   */
  MenuProps: e.object,
  /**
   * If `true`, `value` must be an array and the menu will support multiple selections.
   * @default false
   */
  multiple: e.bool,
  /**
   * If `true`, the component uses a native `select` element.
   * @default false
   */
  native: e.bool,
  /**
   * Callback fired when a menu item is selected.
   *
   * @param {SelectChangeEvent<Value>} event The event source of the callback.
   * You can pull out the new value by accessing `event.target.value` (any).
   * **Warning**: This is a generic event, not a change event, unless the change event is caused by browser autofill.
   * @param {object} [child] The react element that was selected when `native` is `false` (default).
   */
  onChange: e.func,
  /**
   * Callback fired when the component requests to be closed.
   * Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select collapses).
   *
   * @param {object} event The event source of the callback.
   */
  onClose: e.func,
  /**
   * Callback fired when the component requests to be opened.
   * Use it in either controlled (see the `open` prop), or uncontrolled mode (to detect when the Select expands).
   *
   * @param {object} event The event source of the callback.
   */
  onOpen: e.func,
  /**
   * If `true`, the component is shown.
   * You can only use it when the `native` prop is `false` (default).
   */
  open: e.bool,
  /**
   * Render the selected value.
   * You can only use it when the `native` prop is `false` (default).
   *
   * @param {any} value The `value` provided to the component.
   * @returns {ReactNode}
   */
  renderValue: e.func,
  /**
   * Props applied to the clickable div element.
   */
  SelectDisplayProps: e.object,
  /**
   * The system prop that allows defining system overrides as well as additional CSS styles.
   */
  sx: e.oneOfType([e.arrayOf(e.oneOfType([e.func, e.object, e.bool])), e.func, e.object]),
  /**
   * The `input` value. Providing an empty string will select no options.
   * Set to an empty string `''` if you don't want any of the available options to be selected.
   *
   * If the value is an object it must have reference equality with the option in order to be selected.
   * If the value is not an object, the string representation must match with the string representation of the option in order to be selected.
   */
  value: e.oneOfType([e.oneOf([""]), e.any]),
  /**
   * The variant to use.
   * @default 'outlined'
   */
  variant: e.oneOf(["filled", "outlined", "standard"])
});
O.muiName = "Select";
export {
  O as default
};
