'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var lodashEs = require('lodash-es');
require('../../config-provider/index.cjs');
var index = require('../style/index.cjs');
var useConfigInject = require('../../config-provider/src/hooks/useConfigInject.cjs');
var gapSize = require('./gapSize.cjs');
var props = require('./props.cjs');
var util = require('./util.cjs');
var context = require('../../config-provider/src/context/context.cjs');

var AFlex = /* @__PURE__ */ vue.defineComponent({
  name: "AFlex",
  inheritAttrs: false,
  props: props.flexProps(),
  setup(props, {
    slots,
    attrs
  }) {
    const {
      flex: ctxFlex,
      direction: ctxDirection
    } = context.useConfigContextInject();
    const {
      prefixCls
    } = useConfigInject.default("flex", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const mergedCls = vue.computed(() => {
      var _a;
      return [prefixCls.value, hashId.value, util.default(prefixCls.value, props), {
        [`${prefixCls.value}-rtl`]: ctxDirection.value === "rtl",
        [`${prefixCls.value}-gap-${props.gap}`]: gapSize.isPresetSize(props.gap),
        [`${prefixCls.value}-vertical`]: (_a = props.vertical) != null ? _a : ctxFlex == null ? void 0 : ctxFlex.value.vertical
      }];
    });
    return () => {
      const {
        flex,
        gap,
        component: Component = "div",
        ...othersProps
      } = props;
      const mergedStyle = {};
      if (flex)
        mergedStyle.flex = flex;
      if (gap && !gapSize.isPresetSize(gap))
        mergedStyle.gap = `${gap}px`;
      return wrapSSR(vue.createVNode(Component, {
        "class": [attrs.class, mergedCls.value],
        "style": [attrs.style, mergedStyle],
        ...lodashEs.omit(othersProps, ["justify", "wrap", "align", "vertical"])
      }, {
        default: () => {
          var _a;
          return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
        }
      }));
    };
  }
});

exports.default = AFlex;
//# sourceMappingURL=Flex.cjs.map
