import { defineComponent as h, openBlock as m, createElementBlock as u, Fragment as S, createElementVNode as t, normalizeClass as f, unref as a, createVNode as p, toDisplayString as i, pushScopeId as y, popScopeId as _ } from "vue";
import { useModal as b, ScalarIcon as k } from "@scalar/components";
import { isMacOS as r } from "@scalar/use-tooltip";
import { useMagicKeys as v, whenever as K } from "@vueuse/core";
import w from "./SearchModal.vue.js";
const g = (o) => (y("data-v-c9d49ac3"), o = o(), _(), o), H = { class: "sidebar-search-input" }, I = /* @__PURE__ */ g(() => /* @__PURE__ */ t("span", { class: "sidebar-search-placeholder" }, "Search", -1)), M = { class: "sidebar-search-shortcut" }, B = { class: "sidebar-search-key" }, F = /* @__PURE__ */ h({
  __name: "SearchButton",
  props: {
    spec: {},
    searchHotKey: { default: "k" }
  },
  setup(o) {
    const c = o, s = b(), l = v({
      passive: !1,
      onEventFired(e) {
        !r() && e.ctrlKey && e.key === c.searchHotKey && (e.preventDefault(), e.stopPropagation());
      }
    });
    return K(
      l[`${r() ? "meta" : "control"}_${c.searchHotKey}`],
      () => s.open ? s.hide() : s.show()
    ), (e, n) => (m(), u(S, null, [
      t("button", {
        class: f(["sidebar-search", e.$attrs.class]),
        type: "button",
        onClick: n[0] || (n[0] = //@ts-ignore
        (...d) => a(s).show && a(s).show(...d))
      }, [
        p(a(k), {
          class: "search-icon",
          icon: "Search",
          size: "sm"
        }),
        t("div", H, [
          I,
          t("span", M, [
            t("span", B, i(a(r)() ? "⌘" : "⌃") + i(e.searchHotKey), 1)
          ])
        ])
      ], 2),
      p(w, {
        modalState: a(s),
        parsedSpec: e.spec
      }, null, 8, ["modalState", "parsedSpec"])
    ], 64));
  }
});
export {
  F as default
};
