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

import { _ as _defineProperty } from '../_chunks/dep-2db7b3ec.mjs';
import { _ as _slicedToArray } from '../_chunks/dep-84acf3c2.mjs';
import { defineComponent, computed, ref, onMounted, nextTick, watch, createVNode } from 'vue';
import { firstUpperCase } from '../utils/helper.mjs';
import { usePrefixClass } from '../hooks/useConfig.mjs';
import props from './props.mjs';
import '../_chunks/dep-255303ba.mjs';
import '../_chunks/dep-b8d7992c.mjs';
import '../_chunks/dep-60fae668.mjs';
import '../_chunks/dep-406cd044.mjs';
import '../_chunks/dep-eba0ea6e.mjs';
import '../_chunks/dep-42cc3015.mjs';
import '../_chunks/dep-469b4ae0.mjs';
import '../_chunks/dep-b57180d0.mjs';
import '../_chunks/dep-c8d7b6b4.mjs';
import '../_chunks/dep-2bc37d52.mjs';
import '../_chunks/dep-3da99438.mjs';
import '../_chunks/dep-327559e8.mjs';
import '../_chunks/dep-b2235f26.mjs';
import '../_chunks/dep-8b989474.mjs';
import '../_chunks/dep-1372b2d3.mjs';
import '../_chunks/dep-78847b2e.mjs';
import '../_chunks/dep-ed5ebb35.mjs';
import '../_chunks/dep-3f21269a.mjs';
import '../_chunks/dep-876fb3ec.mjs';
import '../config-provider/useConfig.mjs';
import '../_chunks/dep-095107f7.mjs';
import '../_chunks/dep-c989dff3.mjs';
import '../_chunks/dep-9cf86cf1.mjs';
import '../_chunks/dep-bc1d737a.mjs';
import '../_chunks/dep-4d7a675b.mjs';
import '../_chunks/dep-5717e263.mjs';
import '../_chunks/dep-a8bcacea.mjs';
import '../_chunks/dep-2e7f59b1.mjs';
import '../_chunks/dep-855db8bc.mjs';
import '../_chunks/dep-a87f3e4c.mjs';
import '../_chunks/dep-1e566bb5.mjs';
import '../_chunks/dep-1434aa15.mjs';
import '../_chunks/dep-e5eb9f23.mjs';
import '../_chunks/dep-9fe2ef12.mjs';
import '../_chunks/dep-672e7d1a.mjs';
import '../_chunks/dep-42a19209.mjs';
import '../_chunks/dep-9262ee2f.mjs';
import '../_chunks/dep-334a4f6b.mjs';
import '../_chunks/dep-8d3e9aa3.mjs';
import '../_chunks/dep-40d69a9c.mjs';
import '../_chunks/dep-dcc83161.mjs';
import '../_chunks/dep-0fc02184.mjs';
import '../_chunks/dep-f1994936.mjs';
import '../_chunks/dep-345e1be3.mjs';
import '../_common/js/global-config/default-config.mjs';
import '../_common/js/global-config/locale/zh_CN.mjs';
import '../_chunks/dep-9888611c.mjs';
import '../_chunks/dep-697a1365.mjs';
import '../config-provider/type.mjs';

var TTabNavBar = defineComponent({
  props: {
    navs: {
      type: Array
    },
    placement: props.placement,
    value: props.value
  },
  setup: function setup(props) {
    var COMPONENT_NAME = usePrefixClass("tabs");
    var classPrefix = usePrefixClass();
    var navBarClass = computed(function () {
      return ["".concat(COMPONENT_NAME.value, "__bar"), "".concat(classPrefix.value, "-is-").concat(props.placement)];
    });
    var navBarStyle = ref(null);
    var getStyle = function getStyle() {
      var _props$navs$i$el2, _ref3;
      var isVertical = ["left", "right"].includes(props.placement.toLowerCase());
      var _ref = isVertical ? ["height", "top"] : ["width", "left"],
        _ref2 = _slicedToArray(_ref, 2),
        sizePropName = _ref2[0],
        offsetPropName = _ref2[1];
      var offset = 0;
      var i = 0;
      for (; i < props.navs.length; i++) {
        var _props$navs$i, _props$navs$i$el;
        if (props.navs[i].props.value === props.value) break;
        offset += ((_props$navs$i = props.navs[i]) === null || _props$navs$i === void 0 ? void 0 : (_props$navs$i$el = _props$navs$i.el) === null || _props$navs$i$el === void 0 ? void 0 : _props$navs$i$el["client".concat(firstUpperCase(sizePropName))]) || 0;
      }
      if (!props.navs[i]) return {};
      return _ref3 = {}, _defineProperty(_ref3, offsetPropName, "".concat(offset, "px")), _defineProperty(_ref3, sizePropName, "".concat(((_props$navs$i$el2 = props.navs[i].el) === null || _props$navs$i$el2 === void 0 ? void 0 : _props$navs$i$el2["client".concat(firstUpperCase(sizePropName))]) || 0, "px")), _ref3;
    };
    onMounted(function () {
      nextTick(function () {
        navBarStyle.value = getStyle();
      });
    });
    watch([function () {
      return props.navs;
    }, function () {
      return props.value;
    }, function () {
      return props.placement;
    }], function () {
      nextTick(function () {
        navBarStyle.value = getStyle();
      });
    });
    return function () {
      return createVNode("div", {
        "class": navBarClass.value,
        "style": navBarStyle.value
      }, null);
    };
  }
});

export { TTabNavBar as default };
//# sourceMappingURL=tab-nav-bar.mjs.map
