'use strict';

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

var vue = require('vue');
var CloseOutlined = require('@ant-design/icons-vue');
var en_US = require('../locale/lang/en_US.js');
require('../vc-image/index.js');
var Image$1 = require('../vc-image/src/Image.js');
require('../hooks/index.js');
var transition = require('../_util/components/transition.js');
var classNames = require('../_util/classNames.js');
var index = require('./style/index.js');
var PreviewGroup = require('./PreviewGroup.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');

const Image = /* @__PURE__ */ vue.defineComponent({
  name: "AImage",
  inheritAttrs: false,
  props: Image$1.imageProps(),
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls,
      rootPrefixCls,
      configProvider
    } = useConfigInject.default("image", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const mergedPreview = vue.computed(() => {
      const {
        preview
      } = props;
      if (preview === false)
        return preview;
      const _preview = typeof preview === "object" ? preview : {};
      return {
        icons: PreviewGroup.icons,
        ..._preview,
        transitionName: transition.getTransitionName(rootPrefixCls.value, "zoom", _preview.transitionName),
        maskTransitionName: transition.getTransitionName(rootPrefixCls.value, "fade", _preview.maskTransitionName)
      };
    });
    return () => {
      var _a, _b;
      const imageLocale = ((_b = (_a = configProvider.locale) == null ? void 0 : _a.value) == null ? void 0 : _b.Image) || en_US.default.Image;
      const defaultPreviewMask = () => vue.createVNode("div", {
        "class": `${prefixCls.value}-mask-info`
      }, [vue.createVNode(CloseOutlined.EyeOutlined, null, null), imageLocale == null ? void 0 : imageLocale.preview]);
      const {
        previewMask = slots.previewMask || defaultPreviewMask
      } = props;
      return wrapSSR(vue.createVNode(Image$1.default, vue.mergeProps({
        ...attrs,
        ...props,
        prefixCls: prefixCls.value
      }, {
        "preview": mergedPreview.value,
        "rootClassName": classNames.default(props.rootClassName, hashId.value)
      }), {
        ...slots,
        previewMask: typeof previewMask === "function" ? previewMask : null
      }));
    };
  }
});
Image.PreviewGroup = PreviewGroup.default;
Image.install = function(app) {
  app.component(Image.name, Image);
  app.component(Image.PreviewGroup.name, Image.PreviewGroup);
  return app;
};

exports.imageProps = Image$1.imageProps;
exports.ImagePreviewGroup = PreviewGroup.default;
exports.default = Image;
//# sourceMappingURL=index.js.map
