"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
require("vue");
const src_composables_useScrollspy_index = require("../../composables/useScrollspy/index.umd.js");
const object = require("../../../object-DlOVrM-t.js");
const utils = require("../../../utils-BMqbtUwX.js");
const bind = (el, binding) => {
  if (typeof document === "undefined") return;
  const uid = utils.getDirectiveUid(binding);
  const elWithScrollspy = el;
  elWithScrollspy.$__scrollspy = elWithScrollspy.$__scrollspy ?? /* @__PURE__ */ Object.create(null);
  const existingInstance = elWithScrollspy.$__scrollspy[uid];
  if (existingInstance) {
    existingInstance.cleanup();
  }
  const { arg, value } = binding;
  const isObject = typeof value === "object" && value !== null;
  const content = arg ? arg : typeof value === "string" ? value : isObject ? value.content || value.element : null;
  elWithScrollspy.$__scrollspy[uid] = src_composables_useScrollspy_index.useScrollspy(
    content,
    el,
    isObject ? object.omit(value, ["content", "element"]) : {}
  );
};
const vBScrollspy = {
  mounted: bind,
  updated: bind,
  beforeUnmount(el, binding) {
    const uid = utils.getDirectiveUid(binding);
    const elWithScrollspy = el;
    const instance = elWithScrollspy.$__scrollspy?.[uid];
    if (!instance) return;
    instance.cleanup();
    delete elWithScrollspy.$__scrollspy[uid];
  }
};
exports.vBScrollspy = vBScrollspy;
//# sourceMappingURL=index.umd.js.map
