//#region extensions/telegram/src/adapters/setup-wizard.ts
function resolveTelegramToken(cfg, _accountId) {
	const accounts = (cfg.channels?.telegram)?.accounts;
	return accounts && Object.values(accounts).find((a) => a?.botToken)?.botToken || process.env.TELEGRAM_BOT_TOKEN;
}
function createTelegramSetupWizard() {
	return {
		channel: "telegram",
		status: { check: async (cfg, accountId) => {
			const first = resolveTelegramToken(cfg, accountId);
			return {
				ok: !!first,
				detail: first ? "" : "No bot token configured"
			};
		} },
		envShortcut: {
			envVar: "TELEGRAM_BOT_TOKEN",
			configPath: "channels.telegram.accounts.default.botToken"
		},
		credentials: [{
			key: "botToken",
			label: "Bot API token",
			type: "password",
			validate: (v) => v && v.length > 10 ? null : "Paste a token from @BotFather",
			hint: "From BotFather → /newbot or your bot’s API token"
		}],
		finalize: {
			validate: async (cfg) => {
				return resolveTelegramToken(cfg) ? { ok: true } : {
					ok: false,
					error: "Configure channels.telegram with a bot token"
				};
			},
			message: "Telegram bot token saved."
		}
	};
}
//#endregion
export { createTelegramSetupWizard };

//# sourceMappingURL=setup-wizard.js.map