import { defineComponent as E, watch as P, computed as S, openBlock as s, createElementBlock as p, Fragment as m, createElementVNode as w, renderSlot as y, createVNode as f, unref as o, createBlock as i, withCtx as u, normalizeClass as W, renderList as $, resolveDynamicComponent as k, createCommentVNode as L, createStaticVNode as D } from "vue";
import { useServerStore as F } from "@scalar/api-client";
import j from "./Tag/TagAccordion.vue.js";
import q from "./Tag/Tag.vue.js";
import G from "./Operation/OperationAccordion.vue.js";
import H from "./Operation/Operation.vue.js";
import J from "./Lazy/Loading.vue.js";
/* empty css                  */
import K from "./Introduction/Introduction.vue.js";
import Q from "./BaseUrl/BaseUrl.vue.js";
import X from "./Authentication/Authentication.vue.js";
import Y from "./ClientLibraries/ClientLibraries.vue.js";
import C from "./Lazy/Lazy.vue.js";
import Z from "./Webhooks/Webhooks.vue.js";
import _ from "./Models/ModelsAccordion.vue.js";
import x from "./Models/Models.vue.js";
import { useSidebar as ee } from "../../hooks/useSidebar.js";
import { hasModels as oe } from "../../helpers/hasModels.js";
import { getModels as g } from "../../helpers/getModels.js";
import { useNavState as re } from "../../hooks/useNavState.js";
const se = /* @__PURE__ */ D('<div class="section-flare" data-v-54f6ce8b><div class="section-flare-item" data-v-54f6ce8b></div><div class="section-flare-item" data-v-54f6ce8b></div><div class="section-flare-item" data-v-54f6ce8b></div><div class="section-flare-item" data-v-54f6ce8b></div><div class="section-flare-item" data-v-54f6ce8b></div><div class="section-flare-item" data-v-54f6ce8b></div><div class="section-flare-item" data-v-54f6ce8b></div><div class="section-flare-item" data-v-54f6ce8b></div></div>', 1), te = { class: "narrow-references-container" }, ge = /* @__PURE__ */ E({
  __name: "Content",
  props: {
    parsedSpec: {},
    layout: {},
    baseServerURL: {},
    proxy: {},
    servers: {}
  },
  setup(z) {
    const r = z, { getOperationId: h, getTagId: l, hash: I } = re(), { setServer: M } = F(), { hideModels: N, collapsedSidebarItems: R } = ee(), U = (e) => {
      if (e.url.match(/^(?!(https?|file):\/\/|{).+/)) {
        let t = r.baseServerURL ?? window.location.origin;
        t = t.replace(/\/$/, "");
        const d = e.url.startsWith("/") ? e.url : `/${e.url}`;
        e.url = `${t}${d}`.replace(/\/$/, "");
      }
      return e;
    };
    P(
      () => r.parsedSpec,
      (e) => {
        var d, c;
        let t = [
          { url: typeof window < "u" ? window.location.origin : "/" }
        ];
        r.servers ? t = r.servers : e.servers && e.servers.length > 0 ? t = e.servers : r.parsedSpec.host && (t = [
          {
            url: `${((d = r.parsedSpec.schemes) == null ? void 0 : d[0]) ?? "http"}://${r.parsedSpec.host}${((c = r.parsedSpec) == null ? void 0 : c.basePath) ?? ""}`
          }
        ]), (r.baseServerURL || typeof window < "u") && (t = t.map(U)), M({ servers: t });
      },
      { deep: !0, immediate: !0 }
    );
    const V = S(
      () => r.layout === "accordion" ? j : q
    ), A = S(
      () => r.layout === "accordion" ? G : H
    ), B = S(
      () => r.layout === "accordion" ? "after" : "aside"
    ), O = r.layout !== "accordion" && !I.value.startsWith("model");
    return (e, t) => {
      var d, c, v, b;
      return s(), p(m, null, [
        se,
        w("div", te, [
          y(e.$slots, "start", {}, void 0, !0),
          f(o(J), {
            layout: e.layout,
            parsedSpec: e.parsedSpec
          }, null, 8, ["layout", "parsedSpec"]),
          (c = (d = e.parsedSpec) == null ? void 0 : d.info) != null && c.title || (b = (v = e.parsedSpec) == null ? void 0 : v.info) != null && b.description ? (s(), i(o(K), {
            key: 0,
            info: e.parsedSpec.info,
            parsedSpec: e.parsedSpec
          }, {
            [B.value]: u(() => [
              w("div", {
                class: W(["introduction-card", { "introduction-card-row": e.layout === "accordion" }])
              }, [
                f(o(Q)),
                f(o(X), {
                  parsedSpec: e.parsedSpec,
                  proxy: e.proxy
                }, null, 8, ["parsedSpec", "proxy"]),
                f(o(Y))
              ], 2)
            ]),
            _: 2
          }, 1032, ["info", "parsedSpec"])) : y(e.$slots, "empty-state", { key: 1 }, void 0, !0),
          (s(!0), p(m, null, $(e.parsedSpec.tags, (a) => (s(), i(o(C), {
            id: o(l)(a),
            key: o(l)(a),
            isLazy: o(O) && !o(R)[o(l)(a)]
          }, {
            default: u(() => [
              (s(), i(k(V.value), {
                id: o(l)(a),
                spec: e.parsedSpec,
                tag: a
              }, {
                default: u(() => [
                  (s(!0), p(m, null, $(a.operations, (n, T) => (s(), i(o(C), {
                    id: o(h)(n, a),
                    key: `${n.httpVerb}-${n.operationId}`,
                    isLazy: T > 0
                  }, {
                    default: u(() => [
                      (s(), i(k(A.value), {
                        id: o(h)(n, a),
                        operation: n,
                        tag: a
                      }, null, 8, ["id", "operation", "tag"]))
                    ]),
                    _: 2
                  }, 1032, ["id", "isLazy"]))), 128))
                ]),
                _: 2
              }, 1032, ["id", "spec", "tag"]))
            ]),
            _: 2
          }, 1032, ["id", "isLazy"]))), 128)),
          e.parsedSpec.webhooks ? (s(), i(o(Z), {
            key: 2,
            webhooks: e.parsedSpec.webhooks
          }, null, 8, ["webhooks"])) : L("", !0),
          o(oe)(e.parsedSpec) && !o(N) ? (s(), p(m, { key: 3 }, [
            e.layout === "accordion" ? (s(), i(o(_), {
              key: 0,
              schemas: o(g)(e.parsedSpec)
            }, null, 8, ["schemas"])) : (s(), i(o(x), {
              key: 1,
              schemas: o(g)(e.parsedSpec)
            }, null, 8, ["schemas"]))
          ], 64)) : L("", !0),
          y(e.$slots, "end", {}, void 0, !0)
        ])
      ], 64);
    };
  }
});
export {
  ge as default
};
