import { t as IntegrationLogo_default } from "./IntegrationLogo-B9EDW8db.js";
import { t as DeleteSidebarListElement_default } from "./DeleteSidebarListElement-C-p87d03.js";
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, renderList, renderSlot, toDisplayString, unref, useSlots, withCtx } from "vue";
import { ScalarButton, ScalarIcon, ScalarModal, ScalarToggle, cva, cx, useModal } from "@scalar/components";
import { presets, themeLabels } from "@scalar/themes";
//#region src/v2/features/settings/components/Section.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1$3 = { class: "flex flex-col gap-2" };
var _hoisted_2$2 = {
	key: 0,
	class: "flex items-start justify-between gap-2"
};
var _hoisted_3$2 = { class: "flex flex-col gap-2" };
var _hoisted_4$2 = {
	key: 0,
	class: "flex h-8 items-center"
};
var _hoisted_5$2 = { class: "font-bold" };
var _hoisted_6$2 = {
	key: 1,
	class: "text-c-2 mb-4 text-sm leading-tight"
};
//#endregion
//#region src/v2/features/settings/components/Section.vue
var Section_default = /* @__PURE__ */ defineComponent({
	__name: "Section",
	setup(__props) {
		const slots = useSlots();
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1$3, [slots.title || slots.description ? (openBlock(), createElementBlock("div", _hoisted_2$2, [createElementVNode("div", _hoisted_3$2, [slots.title ? (openBlock(), createElementBlock("div", _hoisted_4$2, [createElementVNode("h3", _hoisted_5$2, [renderSlot(_ctx.$slots, "title")])])) : createCommentVNode("", true), slots.description ? (openBlock(), createElementBlock("p", _hoisted_6$2, [renderSlot(_ctx.$slots, "description")])) : createCommentVNode("", true)]), slots.actions ? renderSlot(_ctx.$slots, "actions", { key: 0 }) : createCommentVNode("", true)])) : createCommentVNode("", true), renderSlot(_ctx.$slots, "default")]);
		};
	}
});
//#endregion
//#region src/v2/features/settings/components/Appearance.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1$2 = { class: "flex flex-col gap-2" };
//#endregion
//#region src/v2/features/settings/components/Appearance.vue
var Appearance_default = /* @__PURE__ */ defineComponent({
	__name: "Appearance",
	props: { colorMode: {} },
	emits: ["update:colorMode"],
	setup(__props, { emit: __emit }) {
		const emit = __emit;
		const buttonStyles = cva({
			base: "w-full shadow-none text-c-1 justify-start pl-2 gap-2 border",
			variants: { active: {
				true: "bg-primary text-c-1 hover:bg-inherit",
				false: "bg-b-1 hover:bg-b-2"
			} }
		});
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1$2, [
				createVNode(unref(ScalarButton), {
					class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: __props.colorMode === "system" }))),
					onClick: _cache[0] || (_cache[0] = ($event) => emit("update:colorMode", "system"))
				}, {
					default: withCtx(() => [createElementVNode("div", { class: normalizeClass(["flex h-5 w-5 items-center justify-center rounded-full border-[1.5px] p-1", { "bg-c-accent text-b-1 border-transparent": __props.colorMode === "system" }]) }, [__props.colorMode === "system" ? (openBlock(), createBlock(unref(ScalarIcon), {
						key: 0,
						icon: "Checkmark",
						size: "xs",
						thickness: "3.5"
					})) : createCommentVNode("", true)], 2), _cache[3] || (_cache[3] = createTextVNode(" System Preference (default) ", -1))]),
					_: 1
				}, 8, ["class"]),
				createVNode(unref(ScalarButton), {
					class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: __props.colorMode === "light" }))),
					onClick: _cache[1] || (_cache[1] = ($event) => emit("update:colorMode", "light"))
				}, {
					default: withCtx(() => [createElementVNode("div", { class: normalizeClass(["flex h-5 w-5 items-center justify-center rounded-full border-[1.5px] p-1", { "bg-c-accent text-b-1 border-transparent": __props.colorMode === "light" }]) }, [__props.colorMode === "light" ? (openBlock(), createBlock(unref(ScalarIcon), {
						key: 0,
						icon: "Checkmark",
						size: "xs",
						thickness: "3.5"
					})) : createCommentVNode("", true)], 2), _cache[4] || (_cache[4] = createTextVNode(" Light Mode Always ", -1))]),
					_: 1
				}, 8, ["class"]),
				createVNode(unref(ScalarButton), {
					class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: __props.colorMode === "dark" }))),
					onClick: _cache[2] || (_cache[2] = ($event) => emit("update:colorMode", "dark"))
				}, {
					default: withCtx(() => [createElementVNode("div", { class: normalizeClass(["flex h-5 w-5 items-center justify-center rounded-full border-[1.5px] p-1", { "bg-c-accent text-b-1 border-transparent": __props.colorMode === "dark" }]) }, [__props.colorMode === "dark" ? (openBlock(), createBlock(unref(ScalarIcon), {
						key: 0,
						icon: "Checkmark",
						size: "xs",
						thickness: "3.5"
					})) : createCommentVNode("", true)], 2), _cache[5] || (_cache[5] = createTextVNode(" Dark Mode Always ", -1))]),
					_: 1
				}, 8, ["class"])
			]);
		};
	}
});
//#endregion
//#region src/v2/features/settings/helpers/get-theme-colors.ts
var getThemeColors = (themeId) => {
	return {
		default: {
			light: "#fff",
			dark: "#0f0f0f",
			accent: "#0099ff"
		},
		alternate: {
			light: "#f9f9f9",
			dark: "#131313",
			accent: "#e7e7e7"
		},
		moon: {
			light: "#ccc9b3",
			dark: "#313332",
			accent: "#645b0f"
		},
		purple: {
			light: "#f5f6f8",
			dark: "#22252b",
			accent: "#5469d4"
		},
		solarized: {
			light: "#fdf6e3",
			dark: "#00212b",
			accent: "#007acc"
		},
		"blue-planet": {
			light: "#f0f2f5",
			dark: "#000e23",
			accent: "#e0e2e6"
		},
		saturn: {
			light: "#e4e4df",
			dark: "#2c2c30",
			accent: "#1763a6"
		},
		"kepler-11e": {
			light: "#f6f6f6",
			dark: "#0d0f1e",
			accent: "#7070ff"
		},
		mars: {
			light: "#f2efe8",
			dark: "#321116",
			accent: "#c75549"
		},
		"deep-space": {
			light: "#f4f4f5",
			dark: "#09090b",
			accent: "#8ab4f8"
		},
		laserwave: {
			light: "#f4f2f7",
			dark: "#27212e",
			accent: "#ed78c2"
		}
	}[themeId] || {
		light: "#ffffff",
		dark: "#000000",
		accent: "#3b82f6"
	};
};
//#endregion
//#region src/v2/features/settings/CollectionSettings.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1$1 = { class: "flex flex-col gap-10" };
var _hoisted_2$1 = { class: "flex flex-col gap-2" };
var _hoisted_3$1 = { class: "grid grid-cols-2 gap-2" };
var _hoisted_4$1 = { class: "flex items-center gap-2" };
var _hoisted_5$1 = { class: "flex items-center gap-1" };
var _hoisted_6$1 = { class: "grid grid-cols-2 gap-2" };
var _hoisted_7$1 = { class: "flex items-center gap-2" };
var _hoisted_8 = { class: "flex items-center gap-1" };
var _hoisted_9 = { class: "size-7 rounded-xl" };
var _hoisted_10 = { class: "grid grid-cols-2 gap-2" };
var _hoisted_11 = { class: "flex items-center gap-2" };
var DEFAULT_PROXY_URL = "https://proxy.scalar.com";
//#endregion
//#region src/v2/features/settings/CollectionSettings.vue
var CollectionSettings_default = /* @__PURE__ */ defineComponent({
	__name: "CollectionSettings",
	props: {
		activeProxyUrl: {},
		customThemes: { default: () => [] },
		activeThemeSlug: {},
		colorMode: {}
	},
	emits: [
		"update:proxyUrl",
		"update:themeSlug",
		"update:colorMode"
	],
	setup(__props, { emit: __emit }) {
		const emit = __emit;
		const THEME_IDS = [
			"none",
			"default",
			"alternate",
			"purple",
			"solarized",
			"saturn",
			"kepler"
		];
		const INTEGRATION_THEME_IDS = ["elysiajs", "fastify"];
		const defaultThemes = THEME_IDS.map((themeId) => {
			if (themeId === "none") return {
				slug: themeId,
				name: "None",
				description: "No theme",
				theme: ""
			};
			return presets[themeId];
		});
		const integrationThemes = INTEGRATION_THEME_IDS.map((themeId) => ({
			slug: themeId,
			name: themeLabels[themeId],
			description: themeLabels[themeId],
			theme: ""
		}));
		const customThemeSlugs = computed(() => new Set(__props.customThemes.map((theme) => theme.slug)));
		const buttonStyles = cva({
			base: "w-full shadow-none text-c-1 justify-start pl-2 gap-2 border",
			variants: { active: {
				true: "bg-primary text-c-1 hover:bg-inherit",
				false: "bg-b-1 hover:bg-b-2"
			} }
		});
		/**
		* Determines if the "None" theme should be selected.
		* This happens when no theme is selected, or when the selected theme does not exist.
		*/
		const isNoneThemeSelected = computed(() => {
			if (__props.activeThemeSlug === void 0 || __props.activeThemeSlug === "none") return true;
			return !(customThemeSlugs.value.has(__props.activeThemeSlug) || defaultThemes.some((theme) => theme.slug === __props.activeThemeSlug) || integrationThemes.some((theme) => theme.slug === __props.activeThemeSlug));
		});
		const isNoneTheme = (themeId) => themeId === "none";
		const isThemeActive = (themeSlug) => {
			return __props.activeThemeSlug === themeSlug || isNoneTheme(themeSlug) && isNoneThemeSelected.value;
		};
		const checkmarkClasses = (isActive) => cx("flex h-5 w-5 items-center justify-center rounded-full border-[1.5px] p-1", isActive && "bg-c-accent text-b-1 border-transparent");
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1$1, [
				createVNode(Section_default, null, {
					title: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("CORS Proxy", -1)])]),
					description: withCtx(() => [..._cache[4] || (_cache[4] = [
						createTextVNode(" Browsers block cross-origin requests for security. We provide a public proxy to ", -1),
						createElementVNode("a", {
							class: "hover:text-c-1 underline-offset-2",
							href: "https://en.wikipedia.org/wiki/Cross-origin_resource_sharing",
							target: "_blank"
						}, " bypass CORS issues ", -1),
						createTextVNode(" . Check the ", -1),
						createElementVNode("a", {
							class: "hover:text-c-1 underline-offset-2",
							href: "https://github.com/scalar/scalar/tree/main/projects/proxy-scalar-com",
							target: "_blank"
						}, " source code on GitHub ", -1),
						createTextVNode(" . ", -1)
					])]),
					default: withCtx(() => [createElementVNode("div", _hoisted_2$1, [createVNode(unref(ScalarButton), {
						class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: __props.activeProxyUrl === DEFAULT_PROXY_URL }))),
						onClick: _cache[0] || (_cache[0] = ($event) => emit("update:proxyUrl", DEFAULT_PROXY_URL))
					}, {
						default: withCtx(() => [createElementVNode("div", { class: normalizeClass(checkmarkClasses(__props.activeProxyUrl === DEFAULT_PROXY_URL)) }, [__props.activeProxyUrl === DEFAULT_PROXY_URL ? (openBlock(), createBlock(unref(ScalarIcon), {
							key: 0,
							icon: "Checkmark",
							size: "xs",
							thickness: "3.5"
						})) : createCommentVNode("", true)], 2), _cache[5] || (_cache[5] = createTextVNode(" Use proxy.scalar.com (default) ", -1))]),
						_: 1
					}, 8, ["class"]), createVNode(unref(ScalarButton), {
						class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: !__props.activeProxyUrl }))),
						onClick: _cache[1] || (_cache[1] = ($event) => emit("update:proxyUrl", null))
					}, {
						default: withCtx(() => [createElementVNode("div", { class: normalizeClass(checkmarkClasses(!__props.activeProxyUrl)) }, [!__props.activeProxyUrl ? (openBlock(), createBlock(unref(ScalarIcon), {
							key: 0,
							icon: "Checkmark",
							size: "xs",
							thickness: "3.5"
						})) : createCommentVNode("", true)], 2), _cache[6] || (_cache[6] = createTextVNode(" Skip the proxy ", -1))]),
						_: 1
					}, 8, ["class"])])]),
					_: 1
				}),
				createVNode(Section_default, null, {
					title: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("Themes", -1)])]),
					description: withCtx(() => [..._cache[8] || (_cache[8] = [createTextVNode(" We've got a whole rainbow of themes for you to play with: ", -1)])]),
					default: withCtx(() => [createElementVNode("div", _hoisted_3$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(defaultThemes), (theme) => {
						return openBlock(), createBlock(unref(ScalarButton), {
							key: theme.slug,
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: isThemeActive(theme.slug) }))),
							onClick: ($event) => emit("update:themeSlug", isNoneTheme(theme.slug) ? void 0 : theme.slug)
						}, {
							default: withCtx(() => [createElementVNode("div", _hoisted_4$1, [createElementVNode("div", { class: normalizeClass(checkmarkClasses(isThemeActive(theme.slug))) }, [isThemeActive(theme.slug) ? (openBlock(), createBlock(unref(ScalarIcon), {
								key: 0,
								icon: "Checkmark",
								size: "xs",
								thickness: "3.5"
							})) : createCommentVNode("", true)], 2), createTextVNode(" " + toDisplayString(theme.name), 1)]), createElementVNode("div", _hoisted_5$1, [
								createElementVNode("span", {
									class: "border-c-3 -mr-3 inline-block h-5 w-5 rounded-full",
									style: normalizeStyle({ backgroundColor: unref(getThemeColors)(theme.slug).light })
								}, null, 4),
								createElementVNode("span", {
									class: "border-c-3 -mr-3 inline-block h-5 w-5 rounded-full",
									style: normalizeStyle({ backgroundColor: unref(getThemeColors)(theme.slug).dark })
								}, null, 4),
								createElementVNode("span", {
									class: "border-c-3 inline-block h-5 w-5 rounded-full",
									style: normalizeStyle({ backgroundColor: unref(getThemeColors)(theme.slug).accent })
								}, null, 4)
							])]),
							_: 2
						}, 1032, ["class", "onClick"]);
					}), 128))])]),
					_: 1
				}),
				createVNode(Section_default, null, {
					title: withCtx(() => [..._cache[9] || (_cache[9] = [createTextVNode("Framework Themes", -1)])]),
					description: withCtx(() => [..._cache[10] || (_cache[10] = [createTextVNode(" Are you a real fan? Show your support by using your favorite framework's theme! ", -1)])]),
					default: withCtx(() => [createElementVNode("div", _hoisted_6$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(integrationThemes), (theme) => {
						return openBlock(), createBlock(unref(ScalarButton), {
							key: theme.slug,
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: __props.activeThemeSlug === theme.slug }))),
							onClick: ($event) => emit("update:themeSlug", theme.slug)
						}, {
							default: withCtx(() => [createElementVNode("div", _hoisted_7$1, [createElementVNode("div", { class: normalizeClass(checkmarkClasses(__props.activeThemeSlug === theme.slug)) }, [__props.activeThemeSlug === theme.slug ? (openBlock(), createBlock(unref(ScalarIcon), {
								key: 0,
								icon: "Checkmark",
								size: "xs",
								thickness: "3.5"
							})) : createCommentVNode("", true)], 2), createTextVNode(" " + toDisplayString(theme.name), 1)]), createElementVNode("div", _hoisted_8, [createElementVNode("div", _hoisted_9, [createVNode(IntegrationLogo_default, { integration: theme.slug }, null, 8, ["integration"])])])]),
							_: 2
						}, 1032, ["class", "onClick"]);
					}), 128))])]),
					_: 1
				}),
				__props.customThemes.length > 0 ? (openBlock(), createBlock(Section_default, { key: 0 }, {
					title: withCtx(() => [..._cache[11] || (_cache[11] = [createTextVNode(" Custom Themes ", -1)])]),
					description: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode(" Team defined themes are available to all workspaces in the team. ", -1)])]),
					default: withCtx(() => [createElementVNode("div", _hoisted_10, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.customThemes, (theme) => {
						return openBlock(), createBlock(unref(ScalarButton), {
							key: theme.slug,
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: __props.activeThemeSlug === theme.slug }))),
							onClick: ($event) => emit("update:themeSlug", theme.slug)
						}, {
							default: withCtx(() => [createElementVNode("div", _hoisted_11, [createElementVNode("div", { class: normalizeClass(checkmarkClasses(__props.activeThemeSlug === theme.slug)) }, [__props.activeThemeSlug === theme.slug ? (openBlock(), createBlock(unref(ScalarIcon), {
								key: 0,
								icon: "Checkmark",
								size: "xs",
								thickness: "3.5"
							})) : createCommentVNode("", true)], 2), createTextVNode(" " + toDisplayString(theme.name), 1)])]),
							_: 2
						}, 1032, ["class", "onClick"]);
					}), 128))])]),
					_: 1
				})) : createCommentVNode("", true),
				createVNode(Section_default, null, {
					title: withCtx(() => [..._cache[13] || (_cache[13] = [createTextVNode("Appearance", -1)])]),
					description: withCtx(() => [..._cache[14] || (_cache[14] = [createTextVNode(" Choose between light, dark, or system-based appearance for your workspace. ", -1)])]),
					default: withCtx(() => [createVNode(Appearance_default, {
						colorMode: __props.colorMode,
						"onUpdate:colorMode": _cache[2] || (_cache[2] = (value) => emit("update:colorMode", value))
					}, null, 8, ["colorMode"])]),
					_: 1
				})
			]);
		};
	}
});
//#endregion
//#region src/v2/features/settings/DocumentSettings.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "flex flex-col gap-12" };
var _hoisted_2 = { class: "bg-b-2 rounded-lg border text-sm" };
var _hoisted_3 = { class: "bg-b-1 flex items-center justify-between gap-4 rounded-t-lg p-3" };
var _hoisted_4 = { class: "text-c-1 flex items-center overflow-x-auto border-t py-1.5 whitespace-nowrap" };
var _hoisted_5 = { class: "flex items-center" };
var _hoisted_6 = ["href"];
var _hoisted_7 = { class: "flex items-center justify-between rounded-lg border p-3 text-sm" };
//#endregion
//#region src/v2/features/settings/DocumentSettings.vue
var DocumentSettings_default = /* @__PURE__ */ defineComponent({
	__name: "DocumentSettings",
	props: {
		documentUrl: {},
		watchMode: { type: Boolean },
		title: {},
		isDraftDocument: {
			type: Boolean,
			default: false
		}
	},
	emits: ["delete:document", "update:watchMode"],
	setup(__props, { emit: __emit }) {
		const emit = __emit;
		const deleteModal = useModal();
		/**
		* Handles the delete button click.
		* Prevents opening the modal if the document is a draft.
		*/
		const handleDeleteClick = () => {
			if (__props.isDraftDocument) return;
			deleteModal.show();
		};
		const handleDocumentDelete = () => {
			emit("delete:document");
			deleteModal.hide();
		};
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", _hoisted_1, [createVNode(Section_default, null, {
				title: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Features", -1)])]),
				default: withCtx(() => [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [_cache[3] || (_cache[3] = createElementVNode("div", null, [createElementVNode("h4", null, "Watch Mode"), createElementVNode("p", { class: "text-c-2 mt-1" }, " When enabled, the OpenAPI document will be polled for changes. The collection will be updated automatically. ")], -1)), createVNode(unref(ScalarToggle), {
					class: "w-4",
					disabled: !__props.documentUrl,
					modelValue: __props.watchMode ?? false,
					"onUpdate:modelValue": _cache[0] || (_cache[0] = (value) => emit("update:watchMode", value))
				}, null, 8, ["disabled", "modelValue"])]), createElementVNode("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [__props.documentUrl ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[4] || (_cache[4] = createElementVNode("span", { class: "bg-b-2 sticky left-0 pr-2 pl-3" }, "Source", -1)), createElementVNode("a", {
					class: "text-c-2 group rounded pr-3 no-underline hover:underline",
					href: __props.documentUrl,
					target: "_blank"
				}, [createTextVNode(toDisplayString(__props.documentUrl) + " ", 1), createVNode(unref(ScalarIcon), {
					class: "ml-1 hidden w-2.5 group-hover:inline",
					icon: "ExternalLink"
				})], 8, _hoisted_6)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createVNode(unref(ScalarIcon), {
					class: "text-c-2 mr-2 ml-3 w-4",
					icon: "NotAllowed",
					size: "sm"
				}), _cache[5] || (_cache[5] = createElementVNode("span", { class: "text-c-2 pr-3" }, " No URL configured. Try importing an OpenAPI document from an URL. ", -1))], 64))])])])]),
				_: 1
			}), createVNode(Section_default, null, {
				title: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("Danger Zone", -1)])]),
				default: withCtx(() => [createElementVNode("div", _hoisted_7, [_cache[8] || (_cache[8] = createElementVNode("div", null, [createElementVNode("h4", null, "Delete Collection"), createElementVNode("p", { class: "text-c-2 mt-1" }, " Be careful, my friend. Once deleted, there is no way to recover the collection. ")], -1)), createVNode(unref(ScalarButton), {
					disabled: __props.isDraftDocument,
					size: "sm",
					variant: "danger",
					onClick: handleDeleteClick
				}, {
					default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode(" Delete Collection ", -1)])]),
					_: 1
				}, 8, ["disabled"])])]),
				_: 1
			})]), createVNode(unref(ScalarModal), {
				size: "xxs",
				state: unref(deleteModal),
				title: `Delete ${__props.title}`
			}, {
				default: withCtx(() => [createVNode(DeleteSidebarListElement_default, {
					variableName: __props.title ?? "",
					warningMessage: "This action cannot be undone.",
					onClose: _cache[1] || (_cache[1] = ($event) => unref(deleteModal).hide()),
					onDelete: handleDocumentDelete
				}, null, 8, ["variableName"])]),
				_: 1
			}, 8, ["state", "title"])], 64);
		};
	}
});
//#endregion
export { CollectionSettings_default as n, Section_default as r, DocumentSettings_default as t };

//# sourceMappingURL=settings-BKk_1lcH.js.map