import { r as useWorkspace, w as useActiveEntities } from "./store-DpSUVhjp.js";
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BmmBcIzD.js";
import "./CodeInput-C-igR77V.js";
import "./DataTableInput-yaU5g-kP.js";
import { t as RequestAuth_default } from "./RequestAuth-BzBfIysT.js";
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, unref } from "vue";
import { ScalarToggle } from "@scalar/components";
//#region src/views/Collection/CollectionAuthentication.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "flex h-full w-full flex-col gap-12 px-1.5 pt-8" };
var _hoisted_2 = { class: "flex flex-col gap-4" };
var _hoisted_3 = { class: "flex flex-col gap-2" };
var _hoisted_4 = { class: "flex h-8 items-center justify-between" };
//#endregion
//#region src/views/Collection/CollectionAuthentication.vue
var CollectionAuthentication_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
	__name: "CollectionAuthentication",
	setup(__props) {
		const { activeCollection, activeEnvVariables, activeEnvironment, activeServer, activeWorkspace } = useActiveEntities();
		const { collectionMutators } = useWorkspace();
		/** Toggle the collection security */
		const handleToggleCollectionSecurity = () => {
			if (!activeCollection.value?.uid) return;
			collectionMutators.edit(activeCollection.value.uid, "useCollectionSecurity", !activeCollection.value.useCollectionSecurity);
		};
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [createElementVNode("div", _hoisted_4, [_cache[0] || (_cache[0] = createElementVNode("h3", { class: "font-bold" }, "Authentication", -1)), createVNode(unref(ScalarToggle), {
				class: "w-4",
				modelValue: unref(activeCollection)?.useCollectionSecurity ?? false,
				"onUpdate:modelValue": handleToggleCollectionSecurity
			}, null, 8, ["modelValue"])]), _cache[1] || (_cache[1] = createElementVNode("p", { class: "pr-6 text-sm" }, " Added authentication will apply to all requests under this collection. You can override this by specifying another one in the request. ", -1))]), unref(activeCollection) && unref(activeWorkspace) ? (openBlock(), createBlock(unref(RequestAuth_default), {
				key: 0,
				class: normalizeClass(["scalar-collection-auth", !unref(activeCollection)?.useCollectionSecurity && "pointer-events-none opacity-50 mix-blend-luminosity"]),
				collection: unref(activeCollection),
				envVariables: unref(activeEnvVariables),
				environment: unref(activeEnvironment),
				layout: "client",
				selectedSecuritySchemeUids: unref(activeCollection)?.selectedSecuritySchemeUids ?? [],
				server: unref(activeServer),
				title: "Authentication",
				workspace: unref(activeWorkspace)
			}, null, 8, [
				"class",
				"collection",
				"envVariables",
				"environment",
				"selectedSecuritySchemeUids",
				"server",
				"workspace"
			])) : createCommentVNode("", true)])]);
		};
	}
}), [["__scopeId", "data-v-cc87292e"]]);
//#endregion
export { CollectionAuthentication_default as default };

//# sourceMappingURL=CollectionAuthentication-MHWQpw74.js.map