import { defineComponent as O, computed as m, useId as H, createBlock as n, createCommentVNode as d, openBlock as r, unref as e, withCtx as s, createVNode as i, createElementVNode as z, createTextVNode as S, normalizeClass as A, createElementBlock as b, Fragment as h, renderList as _, toDisplayString as E } from "vue";
import { ScalarMarkdown as M } from "@scalar/components";
import T from "../../components/ShowMoreButton.vue.js";
import j from "./components/Webhook.vue.js";
import F from "../../components/Section/SectionContainer.vue.js";
import K from "../../components/Section/Section.vue.js";
import D from "../../components/Section/SectionHeader.vue.js";
import g from "../../components/Section/SectionHeaderTag.vue.js";
import I from "../../components/Content/Lazy/Lazy.vue2.js";
import X from "../../components/Section/CompactSection.vue.js";
import { useNavState as Y } from "../../hooks/useNavState.js";
import { useSidebar as $ } from "../../hooks/useSidebar.js";
const N = 10, te = /* @__PURE__ */ O({
  __name: "Webhooks",
  props: {
    webhooks: {}
  },
  setup(W) {
    const C = W, u = m(() => Object.keys(C.webhooks ?? {})), w = H(), { getWebhookId: k } = Y(), { collapsedSidebarItems: B } = $(), c = m(
      () => u.value.length <= N || B[k()]
    ), L = m(() => {
      const t = u.value;
      return c.value ? t : t.slice(0, N);
    });
    return (t, f) => u.value.length ? (r(), n(e(F), {
      key: 0,
      id: "webhooks"
    }, {
      default: s(() => [
        i(e(K), { "aria-labelledby": e(w) }, {
          default: s(() => [
            i(e(D), null, {
              default: s(() => [
                i(e(g), {
                  id: e(w),
                  level: 2
                }, {
                  default: s(() => f[0] || (f[0] = [
                    S(" Webhooks ")
                  ])),
                  _: 1
                }, 8, ["id"])
              ]),
              _: 1
            }),
            i(e(I), {
              id: "webhooks",
              isLazy: !1
            }),
            z("div", {
              class: A(["webhooks-list", { "webhooks-list-truncated": !c.value }])
            }, [
              (r(!0), b(h, null, _(L.value, (o) => {
                var p;
                return r(), b(h, { key: o }, [
                  (r(!0), b(h, null, _(Object.keys(
                    (p = t.webhooks) == null ? void 0 : p[o]
                  ), (l) => (r(), n(e(I), {
                    id: e(k)({ name: o, method: l }),
                    key: l,
                    isLazy: ""
                  }, {
                    default: s(() => {
                      var y;
                      return [
                        (y = t.webhooks) != null && y[o] ? (r(), n(e(X), {
                          key: 0,
                          id: e(k)({ name: o, method: l }),
                          class: "webhooks-list-item",
                          label: o
                        }, {
                          heading: s(() => [
                            i(e(g), { level: 3 }, {
                              default: s(() => {
                                var a;
                                return [
                                  S(E((a = t.webhooks[o][l]) == null ? void 0 : a.name), 1)
                                ];
                              }),
                              _: 2
                            }, 1024)
                          ]),
                          default: s(() => {
                            var a, v;
                            return [
                              (a = t.webhooks[o][l]) != null && a.description ? (r(), n(e(M), {
                                key: 0,
                                class: "webhook-section-description",
                                value: (v = t.webhooks[o][l]) == null ? void 0 : v.description,
                                withImages: ""
                              }, null, 8, ["value"])) : d("", !0),
                              i(j, {
                                webhook: t.webhooks[o][l]
                              }, null, 8, ["webhook"])
                            ];
                          }),
                          _: 2
                        }, 1032, ["id", "label"])) : d("", !0)
                      ];
                    }),
                    _: 2
                  }, 1032, ["id"]))), 128))
                ], 64);
              }), 128))
            ], 2),
            c.value ? d("", !0) : (r(), n(T, {
              key: 0,
              id: "webhooks",
              class: "show-more-webhooks"
            }))
          ]),
          _: 1
        }, 8, ["aria-labelledby"])
      ]),
      _: 1
    })) : d("", !0);
  }
});
export {
  te as default
};
