import { defineComponent as D, computed as p, createElementBlock as i, openBlock as r, Fragment as m, createStaticVNode as H, createElementVNode as M, renderSlot as f, createBlock as s, createCommentVNode as n, unref as t, withCtx as W, createVNode as v, normalizeClass as J, renderList as K } from "vue";
import { useWorkspace as P, useActiveEntities as Q } from "@scalar/api-client/store";
import { RequestAuth as T } from "@scalar/api-client/views/Request/RequestSection/RequestAuth";
import { ScalarErrorBoundary as X } from "@scalar/components";
import { getSlugUid as Y } from "@scalar/oas-utils/transforms";
import { useConfig as Z } from "../../hooks/useConfig.js";
import _ from "./Lazy/Loading.vue.js";
/* empty css                  */
import x from "./Introduction/Introduction.vue.js";
import ee from "../../features/base-url/BaseUrl.vue.js";
import te from "./ClientLibraries/ClientLibraries.vue.js";
import y from "./Tag/TagList.vue.js";
import oe from "./Models/ModelsAccordion.vue.js";
import re from "./Models/Models.vue.js";
const se = { class: "narrow-references-container" }, ae = {
  key: 0,
  class: "scalar-reference-intro-server scalar-client introduction-card-item text-sm leading-normal [--scalar-address-bar-height:0px]"
}, le = {
  key: 1,
  class: "scalar-reference-intro-auth scalar-client introduction-card-item leading-normal"
}, Ce = /* @__PURE__ */ D({
  __name: "Content",
  props: {
    document: {},
    parsedSpec: {},
    layout: { default: "modern" }
  },
  setup(L) {
    const j = L, u = Z(), { collections: q, securitySchemes: z, servers: h } = P(), {
      activeCollection: F,
      activeEnvVariables: G,
      activeEnvironment: I,
      activeWorkspace: S
    } = Q(), o = p(() => {
      if (u.value.slug) {
        const e = q[Y(u.value.slug)];
        if (e)
          return e;
      }
      return F.value;
    }), a = p(() => {
      if (o.value) {
        if (o.value.selectedServerUid) {
          const e = h[o.value.selectedServerUid];
          if (e)
            return e;
        }
        return h[o.value.servers[0]];
      }
    }), O = p(
      () => j.layout === "classic" ? "after" : "aside"
    );
    return (e, k) => {
      var g, C, b, w, A, V, E, U, $, B, N;
      return r(), i(m, null, [
        k[0] || (k[0] = H('<div class="section-flare" data-v-3358908f><div class="section-flare-item" data-v-3358908f></div><div class="section-flare-item" data-v-3358908f></div><div class="section-flare-item" data-v-3358908f></div><div class="section-flare-item" data-v-3358908f></div><div class="section-flare-item" data-v-3358908f></div><div class="section-flare-item" data-v-3358908f></div><div class="section-flare-item" data-v-3358908f></div><div class="section-flare-item" data-v-3358908f></div></div>', 1)),
        M("div", se, [
          f(e.$slots, "start", {}, void 0, !0),
          o.value ? (r(), s(t(_), {
            key: 0,
            document: e.document,
            collection: o.value,
            layout: e.layout,
            parsedSpec: e.parsedSpec,
            server: a.value
          }, null, 8, ["document", "collection", "layout", "parsedSpec", "server"])) : n("", !0),
          (C = (g = e.document) == null ? void 0 : g.info) != null && C.title || (w = (b = e.document) == null ? void 0 : b.info) != null && w.description ? (r(), s(t(x), {
            key: 1,
            document: e.document
          }, {
            [O.value]: W(() => [
              v(t(X), null, {
                default: W(() => {
                  var c, l, d;
                  return [
                    M("div", {
                      class: J(["introduction-card", { "introduction-card-row": e.layout === "classic" }])
                    }, [
                      (l = (c = o.value) == null ? void 0 : c.servers) != null && l.length ? (r(), i("div", ae, [
                        v(t(ee), {
                          collection: o.value,
                          server: a.value
                        }, null, 8, ["collection", "server"])
                      ])) : n("", !0),
                      o.value && t(S) && Object.keys(t(z) ?? {}).length ? (r(), i("div", le, [
                        v(t(T), {
                          collection: o.value,
                          envVariables: t(G),
                          environment: t(I),
                          layout: "reference",
                          persistAuth: t(u).persistAuth,
                          selectedSecuritySchemeUids: ((d = o.value) == null ? void 0 : d.selectedSecuritySchemeUids) ?? [],
                          server: a.value,
                          title: "Authentication",
                          workspace: t(S)
                        }, null, 8, ["collection", "envVariables", "environment", "persistAuth", "selectedSecuritySchemeUids", "server", "workspace"])
                      ])) : n("", !0),
                      v(t(te), { class: "introduction-card-item scalar-reference-intro-clients" })
                    ], 2)
                  ];
                }),
                _: 1
              })
            ]),
            _: 2
          }, 1032, ["document"])) : f(e.$slots, "empty-state", { key: 2 }, void 0, !0),
          e.parsedSpec.tags && o.value ? (r(), i(m, { key: 3 }, [
            e.parsedSpec["x-tagGroups"] ? (r(!0), i(m, { key: 0 }, K(e.parsedSpec["x-tagGroups"], (c) => (r(), s(t(y), {
              document: e.document,
              key: c.name,
              collection: o.value,
              layout: e.layout,
              server: a.value,
              spec: e.parsedSpec,
              tags: c.tags.map((l) => {
                var d;
                return (d = e.parsedSpec.tags) == null ? void 0 : d.find((R) => R.name === l);
              }).filter((l) => !!l)
            }, null, 8, ["document", "collection", "layout", "server", "spec", "tags"]))), 128)) : (r(), s(t(y), {
              key: 1,
              collection: o.value,
              document: e.document,
              layout: e.layout,
              server: a.value,
              spec: e.parsedSpec,
              tags: e.parsedSpec.tags
            }, null, 8, ["collection", "document", "layout", "server", "spec", "tags"]))
          ], 64)) : n("", !0),
          (A = e.parsedSpec.webhooks) != null && A.length && o.value ? (r(), s(t(y), {
            key: 4,
            document: e.document,
            id: "webhooks",
            collection: o.value,
            layout: e.layout,
            server: a.value,
            spec: e.parsedSpec,
            tags: [
              {
                name: "Webhooks",
                description: "",
                operations: e.parsedSpec.webhooks
              }
            ]
          }, null, 8, ["document", "collection", "layout", "server", "spec", "tags"])) : n("", !0),
          (E = (V = e.document) == null ? void 0 : V.components) != null && E.schemas && !t(u).hideModels ? (r(), i(m, { key: 5 }, [
            e.layout === "classic" ? (r(), s(t(oe), {
              key: 0,
              schemas: ($ = (U = e.document) == null ? void 0 : U.components) == null ? void 0 : $.schemas
            }, null, 8, ["schemas"])) : (r(), s(t(re), {
              key: 1,
              schemas: (N = (B = e.document) == null ? void 0 : B.components) == null ? void 0 : N.schemas
            }, null, 8, ["schemas"]))
          ], 64)) : n("", !0),
          f(e.$slots, "end", {}, void 0, !0)
        ])
      ], 64);
    };
  }
});
export {
  Ce as default
};
