/**
 * ldesign v0.4.6
 * (c) 2023 ldesign
 * @license MIT
 */

import _defineProperty from '@babel/runtime/helpers/defineProperty';
import { defineComponent, toRefs, getCurrentInstance, ref, nextTick, computed, provide } from '@vue/composition-api';
import { usePrefixClass } from '../hooks/useConfig.js';
import getRenderAlign from './utils.js';
import _TimelineItem from './timeline-item.js';
import TimelineProps from './props.js';
import '../config-provider/useConfig.js';
import '../config-provider/context.js';
import 'lodash/merge';
import 'lodash/mergeWith';
import '../_common/js/global-config/default-config.js';
import '../_common/js/global-config/locale/zh_CN.js';
import '@babel/runtime/helpers/typeof';
import '../_chunks/dep-be599ec8.js';
import 'dayjs';
import '../_chunks/dep-67ff4010.js';
import '../config-provider/type.js';
import '../_common/js/log/index.js';
import '../_common/js/log/log.js';
import '../loading/index.js';
import '../utils/withInstall.js';
import 'vue';
import 'lodash/capitalize';
import '../loading/directive.js';
import 'lodash/isObject';
import 'lodash/mapKeys';
import 'lodash/isEqual';
import '../loading/plugin.js';
import '../config.js';
import '../utils/dom.js';
import 'raf';
import 'lodash/isString';
import '../utils/easing.js';
import '../loading/loading.js';
import '../utils/render-tnode.js';
import 'lodash/camelCase';
import 'lodash/kebabCase';
import '../utils/transfer-dom.js';
import '../config-provider/config-receiver.js';
import '../utils/mixins.js';
import '../loading/props.js';
import '../loading/icon/gradient.js';
import '../_common/js/loading/circle-adapter.js';
import '../_common/js/utils/set-style.js';
import '../_common/js/utils/helper.js';
import '@babel/runtime/helpers/toConsumableArray';
import '@babel/runtime/helpers/objectWithoutProperties';
import '@babel/runtime/helpers/slicedToArray';
import 'lodash/isNull';
import 'lodash/isUndefined';
import 'lodash/isNumber';
import 'lodash/isArray';
import '../loading/style/css.js';
import '../loading/type.js';
import './timeline-item-props.js';

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
var _Timeline = defineComponent({
  name: "TTimeline",
  components: {
    TimelineItem: _TimelineItem
  },
  props: _objectSpread({}, TimelineProps),
  setup: function setup(props) {
    var _toRefs = toRefs(props),
      theme = _toRefs.theme,
      labelAlign = _toRefs.labelAlign,
      reverse = _toRefs.reverse,
      layout = _toRefs.layout,
      mode = _toRefs.mode;
    var instance = getCurrentInstance();
    var classPrefix = usePrefixClass();
    var uidArr = ref([]);
    nextTick(function () {
      var defaultSlots = instance.slots["default"] ? instance.slots["default"] : [null];
      uidArr.value = defaultSlots.map(function (item) {
        var _item$componentInstan;
        return item === null || item === void 0 ? void 0 : (_item$componentInstan = item.componentInstance) === null || _item$componentInstan === void 0 ? void 0 : _item$componentInstan._uid;
      });
    });
    var hasLabelItem = computed(function () {
      var defaultSlots = instance.slots["default"] ? instance.slots["default"] : [null];
      return defaultSlots.some(function (item) {
        var _item$componentOption, _item$componentOption2;
        return !!(item !== null && item !== void 0 && (_item$componentOption = item.componentOptions) !== null && _item$componentOption !== void 0 && (_item$componentOption2 = _item$componentOption.propsData) !== null && _item$componentOption2 !== void 0 && _item$componentOption2.label);
      });
    });
    var timelineClassName = computed(function () {
      var renderAlign = getRenderAlign(labelAlign === null || labelAlign === void 0 ? void 0 : labelAlign.value, layout === null || layout === void 0 ? void 0 : layout.value);
      var classNames = ["".concat(classPrefix.value, "-timeline"), "".concat(classPrefix.value, "-timeline-").concat(renderAlign), "".concat(classPrefix.value, "-timeline-").concat(layout === null || layout === void 0 ? void 0 : layout.value), "".concat(classPrefix.value, "-timeline-label--").concat(mode === null || mode === void 0 ? void 0 : mode.value)];
      if (reverse !== null && reverse !== void 0 && reverse.value) classNames.push("".concat(classPrefix.value, "-timeline-reverse"));
      if (hasLabelItem !== null && hasLabelItem !== void 0 && hasLabelItem.value) classNames.push("".concat(classPrefix.value, "-timeline-label"));
      return classNames.join(" ");
    });
    provide("TTimeline", {
      uidArr: uidArr,
      theme: theme,
      labelAlign: labelAlign,
      reverse: reverse,
      layout: layout,
      mode: mode,
      timelineClassName: timelineClassName.value
    });
    return {
      timelineClassName: timelineClassName
    };
  },
  render: function render() {
    var h = arguments[0];
    var reverse = this.reverse;
    var defaultSlot = this.$scopedSlots["default"] ? this.$scopedSlots["default"](null) : [null];
    if (reverse) defaultSlot.reverse();
    var timelineClassName = this.timelineClassName,
      style = this.style;
    return h("ul", {
      "class": timelineClassName,
      "style": style
    }, [defaultSlot]);
  }
});

export { _Timeline as default };
//# sourceMappingURL=timeline.js.map
