import { effectScope as l, ref as d, readonly as m } from "vue";
function f(n) {
  let s = !1, c;
  const t = l(!0);
  return (...u) => (s || (c = t.run(() => n(...u)), s = !0), c);
}
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
const p = f(() => {
  const n = d([]), s = (t) => n.value.includes(t), c = (t) => {
    n.value = t;
  };
  return {
    aclList: m(n),
    checkPermission: s,
    setPermission: c
  };
});
function v(n) {
  return !!(n && n.nodeType === 8);
}
const y = () => {
  const { checkPermission: n } = p(), s = "acl", c = `v-${s}`, t = /* @__PURE__ */ new WeakMap(), u = (e, o) => {
    const i = t.get(e);
    let { parentEl: a, comment: r } = i;
    if (n(o))
      r && r.nodeType === 8 && r.nodeValue === c && (a == null || a.replaceChild(e, r), t.set(e, {
        parentEl: e.parentElement,
        parentNode: e.parentNode
      }));
    else {
      if (r)
        return;
      r = document.createComment(c), a == null || a.replaceChild(r, e), t.set(e, { ...i, comment: r });
    }
  };
  return {
    name: s,
    directiveLifeCycle: {
      mounted(e, o) {
        t.set(e, {
          parentEl: e.parentElement,
          parentNode: e.parentNode
        }), u(e, o.value);
      },
      updated(e, o) {
        u(e, o.value);
      },
      unmounted(e) {
        const { parentEl: o, comment: i } = t.get(e);
        i && v(i) && i.nodeValue === c && (o == null || o.removeChild(i)), t.delete(e);
      }
    }
  };
};
export {
  y as vAcl
};
//# sourceMappingURL=acl.mjs.map
