"use strict";
/**
 * Copyright: (c) Myia SAS 2026.
 * This file and its contents are licensed under the AGPLv3 License.
 * Please see the LICENSE file at the root of this repository
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractLeadingComment = extractLeadingComment;
function extractLeadingComment(node) {
    const comments = node?.leadingComments;
    if (!comments || comments.length === 0)
        return null;
    return comments.map((c) => stripOneSpace(c.value)).join('\n');
}
// Strip at most one leading and one trailing space. Not `.trim()` —
// that would destroy intentional indentation in JSDoc-style blocks
// where inner lines are `' * foo'`.
function stripOneSpace(value) {
    return value.replace(/^ /, '').replace(/ $/, '');
}
