import { computed, createBlock, createCommentVNode, defineComponent, openBlock, unref } from "vue";
import { getSecurityRequirements, getSelectedSecurity } from "@scalar/workspace-store/request-example";
import { AuthSelector } from "@scalar/api-client/blocks/scalar-auth-selector-block";
//#region src/components/Content/Auth/Auth.vue?vue&type=script&setup=true&lang.ts
var Auth_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "Auth",
	props: {
		options: {},
		authStore: {},
		document: {},
		eventBus: {},
		securitySchemes: {},
		selectedServer: {},
		environment: {}
	},
	setup(__props) {
		/** Compute what the security requirements should be for the document */
		const securityRequirements = computed(() => getSecurityRequirements(__props.document?.security));
		/** Grab the selected security for the document from the auth store */
		const documentSelectedSecurity = computed(() => __props.authStore.getAuthSelectedSchemas({
			type: "document",
			documentName: __props.document?.["x-scalar-navigation"]?.name ?? ""
		}));
		/** The selected security keys for the document */
		const selectedSecurity = computed(() => getSelectedSecurity(documentSelectedSecurity.value, void 0, securityRequirements.value, __props.securitySchemes, __props.options.authentication?.preferredSecurityScheme));
		return (_ctx, _cache) => {
			return Object.keys(__props.securitySchemes).length ? (openBlock(), createBlock(unref(AuthSelector), {
				key: 0,
				createAnySecurityScheme: __props.options.authentication?.createAnySecurityScheme ?? false,
				environment: __props.environment,
				eventBus: __props.eventBus,
				isStatic: "",
				layout: "reference",
				meta: { type: "document" },
				persistAuth: __props.options.persistAuth,
				proxyUrl: __props.options.proxyUrl ?? "",
				securityRequirements: securityRequirements.value,
				securitySchemes: __props.securitySchemes,
				selectedSecurity: selectedSecurity.value,
				server: __props.selectedServer,
				title: "Authentication"
			}, null, 8, [
				"createAnySecurityScheme",
				"environment",
				"eventBus",
				"persistAuth",
				"proxyUrl",
				"securityRequirements",
				"securitySchemes",
				"selectedSecurity",
				"server"
			])) : createCommentVNode("", true);
		};
	}
});
//#endregion
export { Auth_vue_vue_type_script_setup_true_lang_default as default };

//# sourceMappingURL=Auth.vue.script.js.map