"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSlackConnectorStatus = getSlackConnectorStatus;
exports.sanitizeSlackWebhookUrl = sanitizeSlackWebhookUrl;
function getSlackConnectorStatus(webhookUrl = process.env.HARNESS_SLACK_WEBHOOK_URL ?? '') {
    const trimmed = webhookUrl.trim();
    const webhookConfigured = trimmed.length > 0;
    const webhookValid = !webhookConfigured || /^https:\/\/hooks\.slack\.com\/services\/[A-Za-z0-9/_-]+$/.test(trimmed);
    const ready = webhookConfigured && webhookValid;
    return {
        connector: 'slack',
        configured: webhookConfigured,
        webhookConfigured,
        webhookValid,
        allowlist: ['https://hooks.slack.com/services/*'],
        mode: 'notification-only',
        ready,
        message: ready ? 'Slack incoming webhook is configured for notification-only sends.' : webhookConfigured ? 'Slack webhook URL is not a valid incoming webhook URL.' : 'No Slack incoming webhook is configured.',
    };
}
function sanitizeSlackWebhookUrl(value) {
    return String(value ?? '').trim().slice(0, 500);
}
//# sourceMappingURL=slack.js.map