import { defineComponent as u, computed as h, createElementBlock as O, createCommentVNode as s, unref as t, openBlock as i, createBlock as g, createElementVNode as l, withCtx as k, createTextVNode as C, toDisplayString as m, withModifiers as v, createVNode as y, normalizeClass as B } from "vue";
import { useWorkspace as N } from "@scalar/api-client/store";
import { getPointer as V } from "../../../blocks/helpers/getPointer.js";
import { useBlockProps as S } from "../../../blocks/hooks/useBlockProps.js";
import { useNavState as w } from "../../../hooks/useNavState.js";
import { useSidebar as H } from "../../../hooks/useSidebar.js";
import { isOperationDeprecated as I } from "../../../libs/operation.js";
import T from "../../Section/SectionHeaderTag.vue.js";
import $ from "../../HttpMethod/HttpMethod.vue.js";
const b = ["href"], F = /* @__PURE__ */ u({
  __name: "OperationsListItem",
  props: {
    transformedOperation: {},
    tag: {},
    collection: {},
    isCollapsed: { type: Boolean }
  },
  setup(a) {
    const { getOperationId: n } = w(), { scrollToOperation: p } = H(), c = async (e) => {
      const o = n(e, a.tag);
      p(o, !0);
    }, d = N(), { operation: r } = S({
      store: d,
      collection: a.collection,
      location: V([
        "paths",
        a.transformedOperation.path,
        a.transformedOperation.httpVerb.toLowerCase()
      ])
    }), f = h(() => {
      var e, o;
      return ((e = r.value) == null ? void 0 : e.summary) || ((o = r.value) == null ? void 0 : o.path);
    });
    return (e, o) => t(r) ? (i(), O("li", {
      key: t(n)(e.transformedOperation, e.tag),
      class: "contents"
    }, [
      e.isCollapsed ? (i(), g(t(T), {
        key: 0,
        class: "sr-only",
        level: 3
      }, {
        default: k(() => [
          C(m(f.value) + " (Hidden) ", 1)
        ]),
        _: 1
      })) : s("", !0),
      l("a", {
        class: "endpoint",
        href: `#${t(n)(e.transformedOperation, e.tag)}`,
        onClick: o[0] || (o[0] = v((D) => c(e.transformedOperation), ["prevent"]))
      }, [
        y(t($), {
          class: "endpoint-method",
          method: t(r).method
        }, null, 8, ["method"]),
        l("span", {
          class: B(["endpoint-path", {
            deprecated: t(I)(t(r))
          }])
        }, m(t(r).path), 3)
      ], 8, b)
    ])) : s("", !0);
  }
});
export {
  F as default
};
