import { defineComponent as l, useId as p, createElementBlock as c, openBlock as u, createElementVNode as o, unref as s, renderSlot as m, withModifiers as f, createVNode as b, withCtx as _, createTextVNode as h } from "vue";
import { useClipboard as y } from "@scalar/use-hooks/useClipboard";
import { useNavState as C } from "../../hooks/useNavState.js";
import k from "../ScreenReader.vue.js";
const N = { class: "label" }, x = ["id"], S = { class: "anchor" }, V = ["aria-describedby"], I = /* @__PURE__ */ l({
  __name: "Anchor",
  props: {
    id: {}
  },
  setup(n) {
    const t = p(), { copyToClipboard: r } = y(), { getHashedUrl: a } = C(), d = () => {
      r(a(n.id));
    };
    return (i, e) => (u(), c("span", N, [
      o("span", {
        id: s(t),
        class: "contents"
      }, [
        m(i.$slots, "default", {}, void 0, !0)
      ], 8, x),
      o("span", S, [
        e[2] || (e[2] = o("span", null, "​", -1)),
        o("button", {
          "aria-describedby": s(t),
          class: "anchor-copy",
          type: "button",
          onClick: f(d, ["stop"])
        }, [
          e[1] || (e[1] = o("span", { "aria-hidden": "true" }, "#", -1)),
          b(k, null, {
            default: _(() => e[0] || (e[0] = [
              h("Copy link")
            ])),
            _: 1
          })
        ], 8, V)
      ])
    ]));
  }
});
export {
  I as default
};
