import { defineComponent as f, computed as d, createElementBlock as n, openBlock as t, withModifiers as S, createCommentVNode as m, createBlock as y, normalizeClass as s, Fragment as g, renderList as k, createElementVNode as u, toDisplayString as w, unref as B, withCtx as p, createVNode as C } from "vue";
import U from "./RequestAuthTab.vue.js";
import A from "../../../components/data-table/DataTable.vue.js";
const z = ["onClick"], N = { class: "relative z-10 font-medium whitespace-nowrap" }, O = {
  key: 0,
  class: "absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current"
}, D = /* @__PURE__ */ f({
  __name: "RequestAuthDataTable",
  props: {
    environment: {},
    isStatic: { type: Boolean },
    selectedSchemeOptions: {},
    activeAuthIndex: {},
    proxyUrl: {},
    securitySchemes: { default: () => ({}) },
    server: {},
    eventBus: {},
    meta: {}
  },
  setup(e, { expose: h }) {
    const c = d(
      () => e.selectedSchemeOptions[e.activeAuthIndex]
    ), v = d(() => e.selectedSchemeOptions.length > 1), b = (a) => e.eventBus.emit("auth:update:active-index", {
      index: a,
      meta: e.meta
    }), x = (a) => e.eventBus.emit("auth:update:selected-scopes", {
      ...a,
      meta: e.meta
    }), i = (a) => e.activeAuthIndex === a;
    return h({
      activeScheme: c
    }), (a, o) => (t(), n("form", {
      onSubmit: o[0] || (o[0] = S(() => {
      }, ["prevent"]))
    }, [
      v.value ? (t(), n("div", {
        key: 0,
        class: s(["box-content flex flex-wrap gap-x-2.5 overflow-hidden border border-b-0 px-3", { "border-x-0": !e.isStatic }]),
        "data-testid": "auth-tabs"
      }, [
        (t(!0), n(g, null, k(e.selectedSchemeOptions, (l, r) => (t(), n("div", {
          key: l.id,
          class: "relative z-1 -mb-[var(--scalar-border-width)] flex h-8"
        }, [
          u("button", {
            class: s(["floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors", i(r) ? "text-c-1" : "text-c-3"]),
            type: "button",
            onClick: (T) => b(r)
          }, [
            u("span", N, w(l.label), 1)
          ], 10, z),
          i(r) ? (t(), n("div", O)) : m("", !0)
        ]))), 128))
      ], 2)) : m("", !0),
      c.value ? (t(), y(B(A), {
        key: 1,
        class: s(["flex-1", { "bg-b-1 rounded-b-lg border border-t-0": e.isStatic }]),
        columns: [""],
        presentational: ""
      }, {
        default: p(() => [
          C(U, {
            environment: e.environment,
            eventBus: e.eventBus,
            isStatic: e.isStatic,
            proxyUrl: e.proxyUrl,
            securitySchemes: e.securitySchemes,
            selectedSecuritySchemas: c.value.value,
            server: e.server,
            "onUpdate:selectedScopes": x
          }, null, 8, ["environment", "eventBus", "isStatic", "proxyUrl", "securitySchemes", "selectedSecuritySchemas", "server"])
        ]),
        _: 1
      }, 8, ["class"])) : (t(), n("div", {
        key: 2,
        class: s(["bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm", { "min-h-[calc(4rem+0.5px)] rounded-b-lg border": e.isStatic }])
      }, " No authentication selected ", 2))
    ], 32));
  }
});
export {
  D as default
};
