import { defineComponent as V, computed as s, createBlock as y, openBlock as i, unref as t, withCtx as a, createVNode as o, createElementVNode as B, normalizeClass as N, createElementBlock as C, createCommentVNode as l } from "vue";
import { useWorkspace as _, useActiveEntities as z } from "@scalar/api-client/store";
import { RequestAuth as L } from "@scalar/api-client/views/Request/RequestSection/RequestAuth";
import { ScalarErrorBoundary as W } from "@scalar/components";
import { getSlugUid as D } from "@scalar/oas-utils/transforms";
import { useNavState as I } from "../../../hooks/useNavState.js";
import $ from "./IntroductionSection.vue.js";
import j from "../../Lazy/Lazy.vue2.js";
import q from "../../../features/base-url/BaseUrl.vue.js";
import R from "../ClientLibraries/ClientLibraries.vue.js";
const F = {
  key: 0,
  class: "scalar-reference-intro-server scalar-client introduction-card-item text-base leading-normal [--scalar-address-bar-height:0px]"
}, G = {
  key: 1,
  class: "scalar-reference-intro-auth scalar-client introduction-card-item leading-normal"
}, x = /* @__PURE__ */ V({
  __name: "Introduction",
  props: {
    document: {},
    config: {},
    clientOptions: {},
    store: {}
  },
  setup(n) {
    const { collections: b, securitySchemes: w, servers: u } = _(), {
      activeCollection: A,
      activeEnvVariables: E,
      activeEnvironment: O,
      activeWorkspace: d
    } = z(), r = s(() => {
      var e;
      if ((e = n.config) != null && e.slug) {
        const c = b[D(n.config.slug)];
        if (c)
          return c;
      }
      return A.value;
    }), m = s(() => {
      if (r.value) {
        if (r.value.selectedServerUid) {
          const e = u[r.value.selectedServerUid];
          if (e)
            return e;
        }
        return u[r.value.servers[0]];
      }
    }), U = s(
      () => {
        var e;
        return ((e = n.config) == null ? void 0 : e.layout) === "classic" ? "after" : "aside";
      }
    ), { hash: v } = I();
    return (e, c) => (i(), y(t(j), {
      id: "introduction-card",
      prev: "",
      isLazy: !!t(v) && !t(v).startsWith("description")
    }, {
      default: a(() => [
        o($, {
          document: e.document,
          config: e.config
        }, {
          [U.value]: a(() => [
            o(t(W), null, {
              default: a(() => {
                var f, p, h, g, S, k;
                return [
                  B("div", {
                    class: N(["introduction-card", { "introduction-card-row": ((f = e.config) == null ? void 0 : f.layout) === "classic" }])
                  }, [
                    (h = (p = r.value) == null ? void 0 : p.servers) != null && h.length ? (i(), C("div", F, [
                      o(t(q), {
                        collection: r.value,
                        server: m.value
                      }, null, 8, ["collection", "server"])
                    ])) : l("", !0),
                    r.value && t(d) && Object.keys(t(w) ?? {}).length ? (i(), C("div", G, [
                      o(t(L), {
                        collection: r.value,
                        envVariables: t(E),
                        environment: t(O),
                        layout: "reference",
                        persistAuth: (g = e.config) == null ? void 0 : g.persistAuth,
                        selectedSecuritySchemeUids: ((S = r.value) == null ? void 0 : S.selectedSecuritySchemeUids) ?? [],
                        server: m.value,
                        title: "Authentication",
                        workspace: t(d)
                      }, null, 8, ["collection", "envVariables", "environment", "persistAuth", "selectedSecuritySchemeUids", "server", "workspace"])
                    ])) : l("", !0),
                    ((k = e.config) == null ? void 0 : k.hiddenClients) !== !0 && e.clientOptions.length && e.store.workspace.activeDocument ? (i(), y(t(R), {
                      key: 2,
                      clientOptions: e.clientOptions,
                      document: e.store.workspace.activeDocument,
                      selectedClient: e.store.workspace["x-scalar-default-client"],
                      class: "introduction-card-item scalar-reference-intro-clients"
                    }, null, 8, ["clientOptions", "document", "selectedClient"])) : l("", !0)
                  ], 2)
                ];
              }),
              _: 1
            })
          ]),
          _: 2
        }, 1032, ["document", "config"])
      ]),
      _: 1
    }, 8, ["isLazy"]));
  }
});
export {
  x as default
};
