"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _vue = require("vue");
var _unrefElement = require("../../_util/hooks/_vueuse/unrefElement");
const DEFAULT_BORDER_INFO = {
  borderWidth: [0, 0, 0, 0],
  borderRadius: '0px'
};
const parseBorderWidth = value => {
  const size = Number.parseFloat(value);
  return Number.isFinite(size) ? size : 0;
};
const useBorderSize = domNode => {
  const borderInfo = (0, _vue.ref)(DEFAULT_BORDER_INFO);
  (0, _vue.watchEffect)(() => {
    const node = (0, _unrefElement.unrefElement)(domNode.value);
    if (!node) {
      borderInfo.value = DEFAULT_BORDER_INFO;
      return;
    }
    const {
      borderTopWidth,
      borderRightWidth,
      borderBottomWidth,
      borderLeftWidth,
      borderRadius
    } = getComputedStyle(node);
    borderInfo.value = {
      borderWidth: [parseBorderWidth(borderTopWidth), parseBorderWidth(borderRightWidth), parseBorderWidth(borderBottomWidth), parseBorderWidth(borderLeftWidth)],
      borderRadius
    };
  });
  return borderInfo;
};
var _default = exports.default = useBorderSize;