"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractLinkedDatasetColumnNamesFromConversationFlow = extractLinkedDatasetColumnNamesFromConversationFlow;
/**
 * Column names from conversation-builder flow actions that reference `datasetId`.
 */
function extractLinkedDatasetColumnNamesFromConversationFlow(conversationFlow, targetDatasetId) {
    if (!Array.isArray(conversationFlow) || !targetDatasetId) {
        return [];
    }
    const columns = [];
    const seen = new Set();
    for (const item of conversationFlow) {
        if (item === null || typeof item !== 'object' || Array.isArray(item)) {
            continue;
        }
        const o = item;
        if (String(o.datasetId ?? '') !== targetDatasetId) {
            continue;
        }
        const col = o.columnName;
        if (typeof col === 'string') {
            const trimmed = col.trim();
            if (trimmed && !seen.has(trimmed)) {
                seen.add(trimmed);
                columns.push(trimmed);
            }
        }
    }
    return columns;
}
//# sourceMappingURL=conversationFlowLinkedColumns.js.map