import { useActiveEntities } from "../../store/active-entities.js";
import { useWorkspace } from "../../store/store.js";
import IntegrationLogo_default from "../../components/ImportCollection/IntegrationLogo.vue.js";
import SettingsAppearance_default from "./components/SettingsAppearance.vue.js";
import SettingsSection_default from "./components/SettingsSection.vue.js";
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, renderList, toDisplayString, unref, withCtx } from "vue";
import { ScalarButton, ScalarIcon, cva, cx } from "@scalar/components";
import { themeLabels } from "@scalar/themes";
//#region src/views/Settings/SettingsGeneral.vue?vue&type=script&setup=true&lang.ts
var _hoisted_1 = { class: "bg-b-1 h-full w-full overflow-auto" };
var _hoisted_2 = { class: "mr-auto ml-auto w-full max-w-[720px] px-5 py-5" };
var _hoisted_3 = { class: "flex flex-col gap-8" };
var _hoisted_4 = { class: "flex flex-col gap-2" };
var _hoisted_5 = { class: "flex flex-col gap-2" };
var _hoisted_6 = { class: "grid grid-cols-2 gap-2" };
var _hoisted_7 = { class: "flex items-center gap-2" };
var _hoisted_8 = { class: "flex items-center gap-1" };
var _hoisted_9 = { class: "grid grid-cols-2 gap-2" };
var _hoisted_10 = { class: "flex items-center gap-2" };
var _hoisted_11 = { class: "flex items-center gap-1" };
var _hoisted_12 = { class: "size-7 rounded-xl" };
var DEFAULT_PROXY_URL = "https://proxy.scalar.com";
var SettingsGeneral_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
	__name: "SettingsGeneral",
	setup(__props) {
		const { activeWorkspace } = useActiveEntities();
		const { proxyUrl, workspaceMutators } = useWorkspace();
		const themeIds = [
			"default",
			"alternate",
			"purple",
			"solarized",
			"saturn",
			"kepler"
		];
		const integrationThemeIds = ["elysiajs", "fastify"];
		const 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"
				},
				bluePlanet: {
					light: "#f0f2f5",
					dark: "#000e23",
					accent: "#e0e2e6"
				},
				saturn: {
					light: "#e4e4df",
					dark: "#2c2c30",
					accent: "#1763a6"
				},
				kepler: {
					light: "#f6f6f6",
					dark: "#0d0f1e",
					accent: "#7070ff"
				},
				mars: {
					light: "#f2efe8",
					dark: "#321116",
					accent: "#c75549"
				},
				deepSpace: {
					light: "#f4f4f5",
					dark: "#09090b",
					accent: "#8ab4f8"
				},
				laserwave: {
					light: "#f4f2f7",
					dark: "#27212e",
					accent: "#ed78c2"
				},
				none: {
					light: "#ffffff",
					dark: "#000000",
					accent: "#3b82f6"
				}
			}[themeId] || {
				light: "#ffffff",
				dark: "#000000",
				accent: "#3b82f6"
			};
		};
		const changeTheme = (themeId) => workspaceMutators.edit(activeWorkspace.value?.uid, "themeId", themeId);
		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"
			} }
		});
		const setProxy = (newProxy) => workspaceMutators.edit(activeWorkspace.value?.uid, "proxyUrl", newProxy);
		return (_ctx, _cache) => {
			return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [
				_cache[13] || (_cache[13] = createElementVNode("div", null, [createElementVNode("h2", { class: "mt-10 text-xl font-bold" }, "Settings")], -1)),
				createVNode(SettingsSection_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/examples/proxy-server",
							target: "_blank"
						}, " source code on GitHub ", -1),
						createTextVNode(" . ", -1)
					])]),
					default: withCtx(() => [createElementVNode("div", _hoisted_4, [
						createVNode(unref(ScalarButton), {
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: unref(activeWorkspace)?.proxyUrl === DEFAULT_PROXY_URL }))),
							onClick: _cache[0] || (_cache[0] = ($event) => setProxy(DEFAULT_PROXY_URL))
						}, {
							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": unref(activeWorkspace)?.proxyUrl === DEFAULT_PROXY_URL }]) }, [unref(activeWorkspace)?.proxyUrl === 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"]),
						unref(proxyUrl) && unref(proxyUrl) !== DEFAULT_PROXY_URL ? (openBlock(), createBlock(unref(ScalarButton), {
							key: 0,
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: unref(activeWorkspace)?.proxyUrl === unref(proxyUrl) }))),
							onClick: _cache[1] || (_cache[1] = ($event) => setProxy(unref(proxyUrl)))
						}, {
							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": unref(activeWorkspace)?.proxyUrl === unref(proxyUrl) }]) }, [unref(activeWorkspace)?.proxyUrl === unref(proxyUrl) ? (openBlock(), createBlock(unref(ScalarIcon), {
								key: 0,
								icon: "Checkmark",
								size: "xs",
								thickness: "3.5"
							})) : createCommentVNode("", true)], 2), createTextVNode(" Use custom proxy (" + toDisplayString(unref(proxyUrl)) + ") ", 1)]),
							_: 1
						}, 8, ["class"])) : createCommentVNode("", true),
						createVNode(unref(ScalarButton), {
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: !unref(activeWorkspace)?.proxyUrl }))),
							onClick: _cache[2] || (_cache[2] = ($event) => setProxy(void 0))
						}, {
							default: withCtx(() => [createElementVNode("div", { class: normalizeClass(["flex h-5 w-5 items-center justify-center rounded-full border-[1.5px] p-1", !unref(activeWorkspace)?.proxyUrl && "bg-c-accent text-b-1 border-transparent"]) }, [!unref(activeWorkspace)?.proxyUrl ? (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(SettingsSection_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_5, [createElementVNode("div", _hoisted_6, [(openBlock(), createElementBlock(Fragment, null, renderList(themeIds, (themeId) => {
						return createVNode(unref(ScalarButton), {
							key: themeId,
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: unref(activeWorkspace)?.themeId === themeId }))),
							onClick: ($event) => changeTheme(themeId)
						}, {
							default: withCtx(() => [createElementVNode("div", _hoisted_7, [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": unref(activeWorkspace)?.themeId === themeId }]) }, [unref(activeWorkspace)?.themeId === themeId ? (openBlock(), createBlock(unref(ScalarIcon), {
								key: 0,
								icon: "Checkmark",
								size: "xs",
								thickness: "3.5"
							})) : createCommentVNode("", true)], 2), createTextVNode(" " + toDisplayString(unref(themeLabels)[themeId]), 1)]), createElementVNode("div", _hoisted_8, [
								createElementVNode("span", {
									class: "border-c-3 -mr-3 inline-block h-5 w-5 rounded-full",
									style: normalizeStyle({ backgroundColor: getThemeColors(themeId).light })
								}, null, 4),
								createElementVNode("span", {
									class: "border-c-3 -mr-3 inline-block h-5 w-5 rounded-full",
									style: normalizeStyle({ backgroundColor: getThemeColors(themeId).dark })
								}, null, 4),
								createElementVNode("span", {
									class: "border-c-3 inline-block h-5 w-5 rounded-full",
									style: normalizeStyle({ backgroundColor: getThemeColors(themeId).accent })
								}, null, 4)
							])]),
							_: 2
						}, 1032, ["class", "onClick"]);
					}), 64))])])]),
					_: 1
				}),
				createVNode(SettingsSection_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_9, [(openBlock(), createElementBlock(Fragment, null, renderList(integrationThemeIds, (themeId) => {
						return createVNode(unref(ScalarButton), {
							key: themeId,
							class: normalizeClass(unref(cx)(unref(buttonStyles)({ active: unref(activeWorkspace)?.themeId === themeId }))),
							onClick: ($event) => changeTheme(themeId)
						}, {
							default: withCtx(() => [createElementVNode("div", _hoisted_10, [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": unref(activeWorkspace)?.themeId === themeId }]) }, [unref(activeWorkspace)?.themeId === themeId ? (openBlock(), createBlock(unref(ScalarIcon), {
								key: 0,
								icon: "Checkmark",
								size: "xs",
								thickness: "3.5"
							})) : createCommentVNode("", true)], 2), createTextVNode(" " + toDisplayString(unref(themeLabels)[themeId]), 1)]), createElementVNode("div", _hoisted_11, [createElementVNode("div", _hoisted_12, [createVNode(IntegrationLogo_default, { integration: themeId }, null, 8, ["integration"])])])]),
							_: 2
						}, 1032, ["class", "onClick"]);
					}), 64))])]),
					_: 1
				}),
				createVNode(SettingsSection_default, null, {
					title: withCtx(() => [..._cache[11] || (_cache[11] = [createTextVNode(" Appearance ", -1)])]),
					description: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode(" Choose between light, dark, or system-based appearance for your workspace. ", -1)])]),
					default: withCtx(() => [createVNode(SettingsAppearance_default)]),
					_: 1
				})
			])])]);
		};
	}
});
//#endregion
export { SettingsGeneral_vue_vue_type_script_setup_true_lang_default as default };

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