'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');
var LocaleReceiver = require('../locale-provider/LocaleReceiver.js');
require('../vc-pagination/index.js');
var classNames = require('../_util/classNames.js');
require('../hooks/index.js');
var type = require('../_util/type.js');
var index = require('./style/index.js');
var Select = require('./Select.js');
var useConfigInject = require('../config-provider/hooks/useConfigInject.js');
var useBreakpoint = require('../hooks/useBreakpoint.js');
var Pagination$1 = require('../vc-pagination/Pagination.js');

const paginationProps = () => ({
  "total": Number,
  "defaultCurrent": Number,
  "disabled": type.booleanType(),
  "current": Number,
  "defaultPageSize": Number,
  "pageSize": Number,
  "hideOnSinglePage": type.booleanType(),
  "showSizeChanger": type.booleanType(),
  "pageSizeOptions": type.arrayType(),
  "buildOptionText": type.functionType(),
  "showQuickJumper": type.someType([Boolean, Object]),
  "showTotal": type.functionType(),
  "size": type.stringType(),
  "simple": type.booleanType(),
  "locale": Object,
  "prefixCls": String,
  "selectPrefixCls": String,
  "totalBoundaryShowSizeChanger": Number,
  "selectComponentClass": String,
  "itemRender": type.functionType(),
  "role": String,
  "responsive": Boolean,
  "showLessItems": type.booleanType(),
  "onChange": type.functionType(),
  "onShowSizeChange": type.functionType(),
  "onUpdate:current": type.functionType(),
  "onUpdate:pageSize": type.functionType()
});
const paginationConfig = () => ({
  ...paginationProps(),
  position: type.stringType()
});
var Pagination = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "APagination",
  inheritAttrs: false,
  props: paginationProps(),
  // emits: ['change', 'showSizeChange', 'update:current', 'update:pageSize'],
  setup(props, {
    slots,
    attrs
  }) {
    const {
      prefixCls,
      configProvider,
      direction,
      size
    } = useConfigInject.default("pagination", props);
    const [wrapSSR, hashId] = index.default(prefixCls);
    const selectPrefixCls = vue.computed(() => configProvider.getPrefixCls("select", props.selectPrefixCls));
    const breakpoint = useBreakpoint.useBreakpoint();
    const [locale] = LocaleReceiver.useLocaleReceiver("Pagination", en_US.default.Pagination, vue.toRef(props, "locale"));
    const getIconsProps = (pre) => {
      const ellipsis = vue.createVNode("span", {
        "class": `${pre}-item-ellipsis`
      }, [vue.createTextVNode("\u2022\u2022\u2022")]);
      const prevIcon = vue.createVNode("button", {
        "class": `${pre}-item-link`,
        "type": "button",
        "tabindex": -1
      }, [direction.value === "rtl" ? vue.createVNode(CloseOutlined.RightOutlined, null, null) : vue.createVNode(CloseOutlined.LeftOutlined, null, null)]);
      const nextIcon = vue.createVNode("button", {
        "class": `${pre}-item-link`,
        "type": "button",
        "tabindex": -1
      }, [direction.value === "rtl" ? vue.createVNode(CloseOutlined.LeftOutlined, null, null) : vue.createVNode(CloseOutlined.RightOutlined, null, null)]);
      const jumpPrevIcon = vue.createVNode("a", {
        "rel": "nofollow",
        "class": `${pre}-item-link`
      }, [vue.createVNode("div", {
        "class": `${pre}-item-container`
      }, [direction.value === "rtl" ? vue.createVNode(CloseOutlined.DoubleRightOutlined, {
        "class": `${pre}-item-link-icon`
      }, null) : vue.createVNode(CloseOutlined.DoubleLeftOutlined, {
        "class": `${pre}-item-link-icon`
      }, null), ellipsis])]);
      const jumpNextIcon = vue.createVNode("a", {
        "rel": "nofollow",
        "class": `${pre}-item-link`
      }, [vue.createVNode("div", {
        "class": `${pre}-item-container`
      }, [direction.value === "rtl" ? vue.createVNode(CloseOutlined.DoubleLeftOutlined, {
        "class": `${pre}-item-link-icon`
      }, null) : vue.createVNode(CloseOutlined.DoubleRightOutlined, {
        "class": `${pre}-item-link-icon`
      }, null), ellipsis])]);
      return {
        prevIcon,
        nextIcon,
        jumpPrevIcon,
        jumpNextIcon
      };
    };
    return () => {
      var _a;
      const {
        itemRender = slots.itemRender,
        buildOptionText = slots.buildOptionText,
        selectComponentClass,
        responsive,
        ...restProps
      } = props;
      const isSmall = size.value === "small" || !!(((_a = breakpoint.value) == null ? void 0 : _a.xs) && !size.value && responsive);
      const paginationProps2 = {
        ...restProps,
        ...getIconsProps(prefixCls.value),
        prefixCls: prefixCls.value,
        selectPrefixCls: selectPrefixCls.value,
        selectComponentClass: selectComponentClass || (isSmall ? Select.default : Select.MiddleSelect),
        locale: locale.value,
        buildOptionText,
        ...attrs,
        class: classNames.default({
          [`${prefixCls.value}-mini`]: isSmall,
          [`${prefixCls.value}-rtl`]: direction.value === "rtl"
        }, attrs.class, hashId.value),
        itemRender
      };
      return wrapSSR(vue.createVNode(Pagination$1.default, paginationProps2, null));
    };
  }
});

exports.default = Pagination;
exports.paginationConfig = paginationConfig;
exports.paginationProps = paginationProps;
//# sourceMappingURL=Pagination.js.map
