import { resetComponent as d } from "../../style/index.mjs";
import "../../../../@ant-design/cssinjs/es/extractStyle.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCacheToken.mjs";
import "react";
import "../../../../@ant-design/cssinjs/es/StyleContext.mjs";
import { unit as n } from "../../../../@ant-design/cssinjs/es/util/index.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useCompatibleInsertionEffect.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useEffectCleanupRegister.mjs";
import "../../../../@ant-design/cssinjs/es/hooks/useHMR.mjs";
import "../../../../rc-util/es/warning.mjs";
import "../../../../@ant-design/cssinjs/es/theme/createTheme.mjs";
import "../../../../@ant-design/cssinjs/es/theme/ThemeCache.mjs";
import "../../../../@ant-design/cssinjs/es/transformers/legacyLogicalProperties.mjs";
import { merge as s } from "../../theme/util/statistic.mjs";
function r(i, t) {
  const {
    componentCls: e,
    inputPaddingHorizontalBase: o,
    borderRadius: a
  } = i, l = i.calc(i.controlHeight).sub(i.calc(i.lineWidth).mul(2)).equal(), c = t ? `${e}-${t}` : "";
  return {
    [`${e}-single${c}`]: {
      fontSize: i.fontSize,
      height: i.controlHeight,
      // ========================= Selector =========================
      [`${e}-selector`]: Object.assign(Object.assign({}, d(i, !0)), {
        display: "flex",
        borderRadius: a,
        [`${e}-selection-search`]: {
          position: "absolute",
          top: 0,
          insetInlineStart: o,
          insetInlineEnd: o,
          bottom: 0,
          "&-input": {
            width: "100%",
            WebkitAppearance: "textfield"
          }
        },
        [`
          ${e}-selection-item,
          ${e}-selection-placeholder
        `]: {
          padding: 0,
          lineHeight: n(l),
          transition: `all ${i.motionDurationSlow}, visibility 0s`,
          alignSelf: "center"
        },
        [`${e}-selection-placeholder`]: {
          transition: "none",
          pointerEvents: "none"
        },
        // For common baseline align
        [[
          "&:after",
          /* For '' value baseline align */
          `${e}-selection-item:empty:after`,
          /* For undefined value baseline align */
          `${e}-selection-placeholder:empty:after`
        ].join(",")]: {
          display: "inline-block",
          width: 0,
          visibility: "hidden",
          content: '"\\a0"'
        }
      }),
      [`
        &${e}-show-arrow ${e}-selection-item,
        &${e}-show-arrow ${e}-selection-placeholder
      `]: {
        paddingInlineEnd: i.showArrowPaddingInlineEnd
      },
      // Opacity selection if open
      [`&${e}-open ${e}-selection-item`]: {
        color: i.colorTextPlaceholder
      },
      // ========================== Input ==========================
      // We only change the style of non-customize input which is only support by `combobox` mode.
      // Not customize
      [`&:not(${e}-customize-input)`]: {
        [`${e}-selector`]: {
          width: "100%",
          height: "100%",
          padding: `0 ${n(o)}`,
          [`${e}-selection-search-input`]: {
            height: l
          },
          "&:after": {
            lineHeight: n(l)
          }
        }
      },
      [`&${e}-customize-input`]: {
        [`${e}-selector`]: {
          "&:after": {
            display: "none"
          },
          [`${e}-selection-search`]: {
            position: "static",
            width: "100%"
          },
          [`${e}-selection-placeholder`]: {
            position: "absolute",
            insetInlineStart: 0,
            insetInlineEnd: 0,
            padding: `0 ${n(o)}`,
            "&:after": {
              display: "none"
            }
          }
        }
      }
    }
  };
}
function E(i) {
  const {
    componentCls: t
  } = i, e = i.calc(i.controlPaddingHorizontalSM).sub(i.lineWidth).equal();
  return [
    r(i),
    // ======================== Small ========================
    // Shared
    r(s(i, {
      controlHeight: i.controlHeightSM,
      borderRadius: i.borderRadiusSM
    }), "sm"),
    // padding
    {
      [`${t}-single${t}-sm`]: {
        [`&:not(${t}-customize-input)`]: {
          [`${t}-selection-search`]: {
            insetInlineStart: e,
            insetInlineEnd: e
          },
          [`${t}-selector`]: {
            padding: `0 ${n(e)}`
          },
          // With arrow should provides `padding-right` to show the arrow
          [`&${t}-show-arrow ${t}-selection-search`]: {
            insetInlineEnd: i.calc(e).add(i.calc(i.fontSize).mul(1.5)).equal()
          },
          [`
            &${t}-show-arrow ${t}-selection-item,
            &${t}-show-arrow ${t}-selection-placeholder
          `]: {
            paddingInlineEnd: i.calc(i.fontSize).mul(1.5).equal()
          }
        }
      }
    },
    // ======================== Large ========================
    // Shared
    r(s(i, {
      controlHeight: i.singleItemHeightLG,
      fontSize: i.fontSizeLG,
      borderRadius: i.borderRadiusLG
    }), "lg")
  ];
}
export {
  E as default
};
