import { i as useForm, n as head_default, o as vue_exports } from "../ssr.js";
import { n as server_renderer_exports, t } from "./i18n-CXLOYfyq.js";
import { t as AdminLayout_default } from "./AdminLayout-DJaJT5Cr.js";
//#region resources/js/Pages/Admin/Sso.vue?vue&type=script&setup=true&lang.ts
var field = "mt-1.5 w-full rounded-lg border-line bg-appbg text-ink placeholder:text-ink-muted focus:border-primary focus:ring-primary";
var Sso_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ (0, vue_exports.defineComponent)({
	__name: "Sso",
	__ssrInlineRender: true,
	props: {
		values: {},
		callbackUrl: {}
	},
	setup(__props) {
		const props = __props;
		const form = useForm({
			enabled: props.values.enabled,
			label: props.values.label ?? "",
			issuer: props.values.issuer ?? "",
			client_id: props.values.client_id ?? "",
			client_secret: "",
			scopes: props.values.scopes ?? "openid profile email",
			auto_create: props.values.auto_create,
			allowed_domain: props.values.allowed_domain ?? ""
		});
		function save() {
			form.post("/admin/sso", {
				preserveScroll: true,
				onSuccess: () => form.reset("client_secret")
			});
		}
		const copied = (0, vue_exports.ref)(false);
		async function copyCallback() {
			try {
				await navigator.clipboard.writeText(props.callbackUrl);
				copied.value = true;
				setTimeout(() => copied.value = false, 1600);
			} catch {}
		}
		return (_ctx, _push, _parent, _attrs) => {
			_push(`<!--[-->`);
			_push((0, server_renderer_exports.ssrRenderComponent)((0, vue_exports.unref)(head_default), { title: (0, vue_exports.unref)(t)("Admin · Single sign-on") }, null, _parent));
			_push((0, server_renderer_exports.ssrRenderComponent)(AdminLayout_default, null, {
				title: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Single sign-on"))}`);
					else return [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Single sign-on")), 1)];
				}),
				subtitle: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
					if (_push) _push(`${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Let members sign in with your identity provider via OpenID Connect"))}`);
					else return [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Let members sign in with your identity provider via OpenID Connect")), 1)];
				}),
				default: (0, vue_exports.withCtx)((_, _push, _parent, _scopeId) => {
					if (_push) {
						_push(`<div class="max-w-2xl space-y-6"${_scopeId}><section class="rounded-2xl border border-line bg-surface p-5"${_scopeId}><label class="flex items-center gap-2 text-sm font-semibold text-ink"${_scopeId}><input${(0, server_renderer_exports.ssrIncludeBooleanAttr)(Array.isArray((0, vue_exports.unref)(form).enabled) ? (0, server_renderer_exports.ssrLooseContain)((0, vue_exports.unref)(form).enabled, null) : (0, vue_exports.unref)(form).enabled) ? " checked" : ""} type="checkbox" class="rounded border-line text-primary focus:ring-primary"${_scopeId}> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Enable single sign-on"))}</label><p class="mt-1.5 text-xs text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Works with any OpenID Connect provider — Okta, Auth0, Azure AD, Google Workspace, Authentik, Keycloak and more."))}</p></section><section class="rounded-2xl border border-line bg-surface p-5"${_scopeId}><h3 class="text-sm font-bold text-ink"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Provider"))}</h3><div class="mt-3"${_scopeId}><label class="text-xs font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Button label"))}</label><input${(0, server_renderer_exports.ssrRenderAttr)("value", (0, vue_exports.unref)(form).label)} class="${(0, server_renderer_exports.ssrRenderClass)(field)}" placeholder="Okta"${_scopeId}><p class="mt-1 text-xs text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Shown on the sign-in button, e.g. “Sign in with Okta”."))}</p></div><div class="mt-4"${_scopeId}><label class="text-xs font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Issuer URL"))}</label><input${(0, server_renderer_exports.ssrRenderAttr)("value", (0, vue_exports.unref)(form).issuer)} class="${(0, server_renderer_exports.ssrRenderClass)(field)}" placeholder="https://your-org.okta.com"${_scopeId}>`);
						if ((0, vue_exports.unref)(form).errors.issuer) _push(`<p class="mt-1 text-xs text-red-500"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(form).errors.issuer)}</p>`);
						else _push(`<!---->`);
						_push(`<p class="mt-1 text-xs text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("We read the endpoints from {issuer}/.well-known/openid-configuration.", { issuer: "<issuer>" }))}</p></div><div class="mt-4 grid gap-4 sm:grid-cols-2"${_scopeId}><div${_scopeId}><label class="text-xs font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Client ID"))}</label><input${(0, server_renderer_exports.ssrRenderAttr)("value", (0, vue_exports.unref)(form).client_id)} class="${(0, server_renderer_exports.ssrRenderClass)(field)}"${_scopeId}></div><div${_scopeId}><label class="text-xs font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Client secret"))}</label><input${(0, server_renderer_exports.ssrRenderAttr)("value", (0, vue_exports.unref)(form).client_secret)} type="password" class="${(0, server_renderer_exports.ssrRenderClass)(field)}"${(0, server_renderer_exports.ssrRenderAttr)("placeholder", __props.values.has_secret ? "••••••••  " + (0, vue_exports.unref)(t)("(unchanged)") : "")}${_scopeId}></div></div><div class="mt-4 grid gap-4 sm:grid-cols-2"${_scopeId}><div${_scopeId}><label class="text-xs font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Scopes"))}</label><input${(0, server_renderer_exports.ssrRenderAttr)("value", (0, vue_exports.unref)(form).scopes)} class="${(0, server_renderer_exports.ssrRenderClass)(field)}" placeholder="openid profile email"${_scopeId}></div><div${_scopeId}><label class="text-xs font-semibold text-ink-2"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Restrict to email domain"))} <span class="font-normal text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("(optional)"))}</span></label><input${(0, server_renderer_exports.ssrRenderAttr)("value", (0, vue_exports.unref)(form).allowed_domain)} class="${(0, server_renderer_exports.ssrRenderClass)(field)}" placeholder="example.com"${_scopeId}></div></div><label class="mt-4 flex items-center gap-2 text-sm text-ink-2"${_scopeId}><input${(0, server_renderer_exports.ssrIncludeBooleanAttr)(Array.isArray((0, vue_exports.unref)(form).auto_create) ? (0, server_renderer_exports.ssrLooseContain)((0, vue_exports.unref)(form).auto_create, null) : (0, vue_exports.unref)(form).auto_create) ? " checked" : ""} type="checkbox" class="rounded border-line text-primary focus:ring-primary"${_scopeId}> ${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Create an account automatically the first time someone signs in"))}</label></section><section class="rounded-2xl border border-line bg-surface p-5"${_scopeId}><h3 class="text-sm font-bold text-ink"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Redirect URI"))}</h3><p class="mt-1 text-xs text-ink-muted"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(t)("Add this exact URL to your provider’s allowed redirect/callback URIs."))}</p><div class="mt-2 flex flex-col gap-2 sm:flex-row"${_scopeId}><input${(0, server_renderer_exports.ssrRenderAttr)("value", __props.callbackUrl)} readonly class="w-full truncate rounded-lg border-line bg-appbg text-sm text-ink-2"${_scopeId}><button class="shrink-0 rounded-lg bg-surface-2 px-3 py-2 text-sm font-semibold text-ink hover:bg-appbg"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)(copied.value ? (0, vue_exports.unref)(t)("Copied!") : (0, vue_exports.unref)(t)("Copy"))}</button></div></section><div${_scopeId}><button${(0, server_renderer_exports.ssrIncludeBooleanAttr)((0, vue_exports.unref)(form).processing) ? " disabled" : ""} class="rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-white hover:bg-primary-600 disabled:opacity-50"${_scopeId}>${(0, server_renderer_exports.ssrInterpolate)((0, vue_exports.unref)(form).processing ? (0, vue_exports.unref)(t)("Saving…") : (0, vue_exports.unref)(t)("Save"))}</button></div></div>`);
					} else return [(0, vue_exports.createVNode)("div", { class: "max-w-2xl space-y-6" }, [
						(0, vue_exports.createVNode)("section", { class: "rounded-2xl border border-line bg-surface p-5" }, [(0, vue_exports.createVNode)("label", { class: "flex items-center gap-2 text-sm font-semibold text-ink" }, [(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
							"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).enabled = $event,
							type: "checkbox",
							class: "rounded border-line text-primary focus:ring-primary"
						}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelCheckbox, (0, vue_exports.unref)(form).enabled]]), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Enable single sign-on")), 1)]), (0, vue_exports.createVNode)("p", { class: "mt-1.5 text-xs text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Works with any OpenID Connect provider — Okta, Auth0, Azure AD, Google Workspace, Authentik, Keycloak and more.")), 1)]),
						(0, vue_exports.createVNode)("section", { class: "rounded-2xl border border-line bg-surface p-5" }, [
							(0, vue_exports.createVNode)("h3", { class: "text-sm font-bold text-ink" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Provider")), 1),
							(0, vue_exports.createVNode)("div", { class: "mt-3" }, [
								(0, vue_exports.createVNode)("label", { class: "text-xs font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Button label")), 1),
								(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
									"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).label = $event,
									class: field,
									placeholder: "Okta"
								}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelText, (0, vue_exports.unref)(form).label]]),
								(0, vue_exports.createVNode)("p", { class: "mt-1 text-xs text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Shown on the sign-in button, e.g. “Sign in with Okta”.")), 1)
							]),
							(0, vue_exports.createVNode)("div", { class: "mt-4" }, [
								(0, vue_exports.createVNode)("label", { class: "text-xs font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Issuer URL")), 1),
								(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
									"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).issuer = $event,
									class: field,
									placeholder: "https://your-org.okta.com"
								}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelText, (0, vue_exports.unref)(form).issuer]]),
								(0, vue_exports.unref)(form).errors.issuer ? ((0, vue_exports.openBlock)(), (0, vue_exports.createBlock)("p", {
									key: 0,
									class: "mt-1 text-xs text-red-500"
								}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(form).errors.issuer), 1)) : (0, vue_exports.createCommentVNode)("", true),
								(0, vue_exports.createVNode)("p", { class: "mt-1 text-xs text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("We read the endpoints from {issuer}/.well-known/openid-configuration.", { issuer: "<issuer>" })), 1)
							]),
							(0, vue_exports.createVNode)("div", { class: "mt-4 grid gap-4 sm:grid-cols-2" }, [(0, vue_exports.createVNode)("div", null, [(0, vue_exports.createVNode)("label", { class: "text-xs font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Client ID")), 1), (0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
								"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).client_id = $event,
								class: field
							}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelText, (0, vue_exports.unref)(form).client_id]])]), (0, vue_exports.createVNode)("div", null, [(0, vue_exports.createVNode)("label", { class: "text-xs font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Client secret")), 1), (0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
								"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).client_secret = $event,
								type: "password",
								class: field,
								placeholder: __props.values.has_secret ? "••••••••  " + (0, vue_exports.unref)(t)("(unchanged)") : ""
							}, null, 8, ["onUpdate:modelValue", "placeholder"]), [[vue_exports.vModelText, (0, vue_exports.unref)(form).client_secret]])])]),
							(0, vue_exports.createVNode)("div", { class: "mt-4 grid gap-4 sm:grid-cols-2" }, [(0, vue_exports.createVNode)("div", null, [(0, vue_exports.createVNode)("label", { class: "text-xs font-semibold text-ink-2" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Scopes")), 1), (0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
								"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).scopes = $event,
								class: field,
								placeholder: "openid profile email"
							}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelText, (0, vue_exports.unref)(form).scopes]])]), (0, vue_exports.createVNode)("div", null, [(0, vue_exports.createVNode)("label", { class: "text-xs font-semibold text-ink-2" }, [(0, vue_exports.createTextVNode)((0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Restrict to email domain")) + " ", 1), (0, vue_exports.createVNode)("span", { class: "font-normal text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("(optional)")), 1)]), (0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
								"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).allowed_domain = $event,
								class: field,
								placeholder: "example.com"
							}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelText, (0, vue_exports.unref)(form).allowed_domain]])])]),
							(0, vue_exports.createVNode)("label", { class: "mt-4 flex items-center gap-2 text-sm text-ink-2" }, [(0, vue_exports.withDirectives)((0, vue_exports.createVNode)("input", {
								"onUpdate:modelValue": ($event) => (0, vue_exports.unref)(form).auto_create = $event,
								type: "checkbox",
								class: "rounded border-line text-primary focus:ring-primary"
							}, null, 8, ["onUpdate:modelValue"]), [[vue_exports.vModelCheckbox, (0, vue_exports.unref)(form).auto_create]]), (0, vue_exports.createTextVNode)(" " + (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Create an account automatically the first time someone signs in")), 1)])
						]),
						(0, vue_exports.createVNode)("section", { class: "rounded-2xl border border-line bg-surface p-5" }, [
							(0, vue_exports.createVNode)("h3", { class: "text-sm font-bold text-ink" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Redirect URI")), 1),
							(0, vue_exports.createVNode)("p", { class: "mt-1 text-xs text-ink-muted" }, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(t)("Add this exact URL to your provider’s allowed redirect/callback URIs.")), 1),
							(0, vue_exports.createVNode)("div", { class: "mt-2 flex flex-col gap-2 sm:flex-row" }, [(0, vue_exports.createVNode)("input", {
								value: __props.callbackUrl,
								readonly: "",
								class: "w-full truncate rounded-lg border-line bg-appbg text-sm text-ink-2",
								onFocus: ($event) => $event.target.select()
							}, null, 40, ["value", "onFocus"]), (0, vue_exports.createVNode)("button", {
								class: "shrink-0 rounded-lg bg-surface-2 px-3 py-2 text-sm font-semibold text-ink hover:bg-appbg",
								onClick: copyCallback
							}, (0, vue_exports.toDisplayString)(copied.value ? (0, vue_exports.unref)(t)("Copied!") : (0, vue_exports.unref)(t)("Copy")), 1)])
						]),
						(0, vue_exports.createVNode)("div", null, [(0, vue_exports.createVNode)("button", {
							disabled: (0, vue_exports.unref)(form).processing,
							class: "rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-white hover:bg-primary-600 disabled:opacity-50",
							onClick: save
						}, (0, vue_exports.toDisplayString)((0, vue_exports.unref)(form).processing ? (0, vue_exports.unref)(t)("Saving…") : (0, vue_exports.unref)(t)("Save")), 9, ["disabled"])])
					])];
				}),
				_: 1
			}, _parent));
			_push(`<!--]-->`);
		};
	}
});
//#endregion
//#region resources/js/Pages/Admin/Sso.vue
var _sfc_setup = Sso_vue_vue_type_script_setup_true_lang_default.setup;
Sso_vue_vue_type_script_setup_true_lang_default.setup = (props, ctx) => {
	const ssrContext = (0, vue_exports.useSSRContext)();
	(ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("resources/js/Pages/Admin/Sso.vue");
	return _sfc_setup ? _sfc_setup(props, ctx) : void 0;
};
var Sso_default = Sso_vue_vue_type_script_setup_true_lang_default;
//#endregion
export { Sso_default as default };
