'use strict';

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

var vue = require('vue');
require('../../../utils/index.cjs');
var index = require('../../tooltip/index.cjs');
var props = require('../../tooltip/src/props.cjs');
var raf = require('../../../utils/vue/raf.cjs');

var SliderTooltip = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "SliderTooltip",
  inheritAttrs: false,
  props: props.tooltipProps(),
  setup(props, {
    attrs,
    slots
  }) {
    const innerRef = vue.ref(null);
    const rafRef = vue.ref(null);
    function cancelKeepAlign() {
      raf.raf.cancel(rafRef.value);
      rafRef.value = null;
    }
    function keepAlign() {
      rafRef.value = raf.raf(() => {
        var _a;
        (_a = innerRef.value) == null ? void 0 : _a.forcePopupAlign();
        rafRef.value = null;
      });
    }
    const align = () => {
      cancelKeepAlign();
      if (props.open)
        keepAlign();
    };
    vue.watch([() => props.open, () => props.title], () => {
      align();
    }, {
      flush: "post",
      immediate: true
    });
    vue.onActivated(() => {
      align();
    });
    vue.onBeforeUnmount(() => {
      cancelKeepAlign();
    });
    return () => {
      return vue.createVNode(index.Tooltip, {
        "ref": innerRef,
        ...props,
        ...attrs
      }, slots);
    };
  }
});

exports.default = SliderTooltip;
//# sourceMappingURL=SliderTooltip.cjs.map
