"use strict";
exports.id = 1;
exports.ids = [1];
exports.modules = {

/***/ 601:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  AuditOutputsMissingAuditError: () => (/* reexport */ AuditOutputsMissingAuditError),
  ConfigPathError: () => (/* reexport */ ConfigPathError),
  PersistDirError: () => (/* reexport */ PersistDirError),
  PersistError: () => (/* reexport */ PersistError),
  autoloadRc: () => (/* reexport */ autoloadRc),
  collect: () => (/* reexport */ collect),
  collectAndPersistReports: () => (/* reexport */ collectAndPersistReports),
  compareReportFiles: () => (/* reexport */ compareReportFiles),
  compareReports: () => (/* reexport */ compareReports),
  executePlugin: () => (/* reexport */ executePlugin),
  executePlugins: () => (/* reexport */ executePlugins),
  getRunnerOutputsPath: () => (/* reexport */ getRunnerOutputsPath),
  history: () => (/* reexport */ history_history),
  mergeDiffs: () => (/* reexport */ mergeDiffs),
  persistReport: () => (/* reexport */ persistReport),
  readRcByPath: () => (/* reexport */ readRcByPath),
  upload: () => (/* reexport */ upload)
});

// EXTERNAL MODULE: ../../node_modules/@code-pushup/models/src/index.js + 43 modules
var src = __webpack_require__(350);
// EXTERNAL MODULE: ../../node_modules/@code-pushup/utils/src/index.js + 101 modules
var utils_src = __webpack_require__(349);
// EXTERNAL MODULE: ../../node_modules/ansis/index.mjs
var ansis = __webpack_require__(351);
// EXTERNAL MODULE: external "node:fs/promises"
var promises_ = __webpack_require__(362);
// EXTERNAL MODULE: external "node:path"
var external_node_path_ = __webpack_require__(363);
var external_node_path_default = /*#__PURE__*/__webpack_require__.n(external_node_path_);
;// ../../node_modules/@code-pushup/core/src/lib/normalize.js

function normalizeIssue(issue, gitRoot) {
    const { source, ...issueWithoutSource } = issue;
    // early exit to avoid issue object cloning.
    return source == null
        ? issue
        : {
            ...issueWithoutSource,
            source: {
                ...source,
                file: (0,utils_src.formatGitPath)(source.file, gitRoot),
            },
        };
}
async function normalizeAuditOutputs(audits) {
    const gitRoot = await (0,utils_src.getGitRoot)();
    return audits.map(audit => {
        if (audit.details?.issues == null ||
            audit.details.issues.every(issue => issue.source == null)) {
            return audit;
        }
        return {
            ...audit,
            details: {
                ...audit.details,
                issues: audit.details.issues.map(issue => normalizeIssue(issue, gitRoot)),
            },
        };
    });
}
//# sourceMappingURL=normalize.js.map
;// ../../node_modules/@code-pushup/core/src/lib/implementation/runner.js






async function executeRunnerConfig(cfg) {
    const { args, command, outputFile, outputTransform } = cfg;
    const { duration, date } = await (0,utils_src.executeProcess)({
        command,
        args,
        observer: {
            onStdout: stdout => {
                if ((0,utils_src.isVerbose)()) {
                    (0,utils_src.ui)().logger.log(stdout);
                }
            },
            onStderr: stderr => (0,utils_src.ui)().logger.error(stderr),
        },
    });
    // read process output from the file system and parse it
    const outputs = await (0,utils_src.readJsonFile)(outputFile);
    // clean up plugin individual runner output directory
    await (0,utils_src.removeDirectoryIfExists)(external_node_path_default().dirname(outputFile));
    // transform unknownAuditOutputs to auditOutputs
    const audits = outputTransform ? await outputTransform(outputs) : outputs;
    // create runner result
    return {
        duration,
        date,
        audits,
    };
}
async function executeRunnerFunction(runner) {
    const date = new Date().toISOString();
    const start = performance.now();
    // execute plugin runner
    const audits = await runner();
    // create runner result
    return {
        date,
        duration: (0,utils_src.calcDuration)(start),
        audits,
    };
}
/**
 * Error thrown when plugin output is invalid.
 */
class AuditOutputsMissingAuditError extends Error {
    constructor(auditSlug) {
        super(`Audit metadata not present in plugin config. Missing slug: ${(0,ansis.bold)(auditSlug)}`);
    }
}
async function executePluginRunner(pluginConfig) {
    const { audits: pluginConfigAudits, runner } = pluginConfig;
    const runnerResult = typeof runner === 'object'
        ? await executeRunnerConfig(runner)
        : await executeRunnerFunction(runner);
    const { audits: unvalidatedAuditOutputs, ...executionMeta } = runnerResult;
    const result = src.auditOutputsSchema.safeParse(unvalidatedAuditOutputs);
    if (!result.success) {
        throw new Error(`Audit output is invalid: ${result.error.message}`);
    }
    const auditOutputs = result.data;
    auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits);
    return {
        ...executionMeta,
        audits: await normalizeAuditOutputs(auditOutputs),
    };
}
function auditOutputsCorrelateWithPluginOutput(auditOutputs, pluginConfigAudits) {
    auditOutputs.forEach(auditOutput => {
        const auditMetadata = pluginConfigAudits.find(audit => audit.slug === auditOutput.slug);
        if (!auditMetadata) {
            throw new AuditOutputsMissingAuditError(auditOutput.slug);
        }
    });
}
function getRunnerOutputsPath(pluginSlug, outputDir) {
    return external_node_path_default().join(outputDir, pluginSlug, 'runner-output.json');
}
/**
 * Save audit outputs to a file to be able to cache the results
 * @param auditOutputs
 * @param pluginSlug
 * @param outputDir
 */
async function writeRunnerResults(pluginSlug, outputDir, runnerResult) {
    const cacheFilePath = getRunnerOutputsPath(pluginSlug, outputDir);
    await (0,utils_src.ensureDirectoryExists)(external_node_path_default().dirname(cacheFilePath));
    await (0,promises_.writeFile)(cacheFilePath, JSON.stringify(runnerResult.audits, null, 2));
}
async function readRunnerResults(pluginSlug, outputDir) {
    const auditOutputsPath = getRunnerOutputsPath(pluginSlug, outputDir);
    if (await (0,utils_src.fileExists)(auditOutputsPath)) {
        const cachedResult = await (0,utils_src.readJsonFile)(auditOutputsPath);
        return {
            audits: cachedResult,
            duration: 0,
            date: new Date().toISOString(),
        };
    }
    return null;
}
//# sourceMappingURL=runner.js.map
;// ../../node_modules/@code-pushup/core/src/lib/implementation/execute-plugin.js



/**
 * Execute a plugin.
 *
 * @public
 * @param pluginConfig - {@link ProcessConfig} object with runner and meta
 * @param opt
 * @returns {Promise<AuditOutput[]>} - audit outputs from plugin runner
 * @throws {AuditOutputsMissingAuditError} - if plugin runner output is invalid
 *
 * @example
 * // plugin execution
 * const pluginCfg = pluginConfigSchema.parse({...});
 * const output = await executePlugin(pluginCfg);
 *
 *  @example
 *  // error handling
 *  try {
 *  await executePlugin(pluginCfg);
 *  } catch (e) {
 *  console.error(e.message);
 *  }
 */
async function executePlugin(pluginConfig, opt) {
    const { cache, persist } = opt;
    const { runner, audits: pluginConfigAudits, description, docsUrl, groups, ...pluginMeta } = pluginConfig;
    const { write: cacheWrite = false, read: cacheRead = false } = cache;
    const { outputDir } = persist;
    const { audits, ...executionMeta } = cacheRead
        ? // IF not null, take the result from cache
            ((await readRunnerResults(pluginMeta.slug, outputDir)) ??
                // ELSE execute the plugin runner
                (await executePluginRunner(pluginConfig)))
        : await executePluginRunner(pluginConfig);
    if (cacheWrite) {
        await writeRunnerResults(pluginMeta.slug, outputDir, {
            ...executionMeta,
            audits,
        });
    }
    // enrich `AuditOutputs` to `AuditReport`
    const auditReports = audits.map((auditOutput) => ({
        ...auditOutput,
        ...pluginConfigAudits.find(audit => audit.slug === auditOutput.slug),
    }));
    // create plugin report
    return {
        ...pluginMeta,
        ...executionMeta,
        audits: auditReports,
        ...(description && { description }),
        ...(docsUrl && { docsUrl }),
        ...(groups && { groups }),
    };
}
const wrapProgress = async (cfg, steps, progressBar) => {
    const { plugin: pluginCfg, ...rest } = cfg;
    progressBar?.updateTitle(`Executing ${(0,ansis.bold)(pluginCfg.title)}`);
    try {
        const pluginReport = await executePlugin(pluginCfg, rest);
        progressBar?.incrementInSteps(steps);
        return pluginReport;
    }
    catch (error) {
        progressBar?.incrementInSteps(steps);
        throw new Error(error instanceof Error
            ? `- Plugin ${(0,ansis.bold)(pluginCfg.title)} (${(0,ansis.bold)(pluginCfg.slug)}) produced the following error:\n  - ${error.message}`
            : String(error));
    }
};
/**
 * Execute multiple plugins and aggregates their output.
 * @public
 * @param cfg
 * @param {Object} [options] execution options
 * @param {boolean} options.progress show progress bar
 * @returns {Promise<PluginReport[]>} plugin report
 *
 * @example
 * // plugin execution
 * const plugins = [pluginConfigSchema.parse({...})];
 *
 * @example
 * // error handling
 * try {
 * await executePlugins(plugins);
 * } catch (e) {
 * console.error(e.message); // Plugin output is invalid
 * }
 *
 */
async function executePlugins(cfg, options) {
    const { plugins, ...cacheCfg } = cfg;
    const { progress = false } = options ?? {};
    const progressBar = progress ? (0,utils_src.getProgressBar)('Run plugins') : null;
    const pluginsResult = plugins.map(pluginCfg => wrapProgress({ plugin: pluginCfg, ...cacheCfg }, plugins.length, progressBar));
    const errorsTransform = ({ reason }) => String(reason);
    const results = await Promise.allSettled(pluginsResult);
    progressBar?.endProgress('Done running plugins');
    (0,utils_src.logMultipleResults)(results, 'Plugins', undefined, errorsTransform);
    const { fulfilled, rejected } = (0,utils_src.groupByStatus)(results);
    if (rejected.length > 0) {
        const errorMessages = rejected
            .map(({ reason }) => String(reason))
            .join('\n');
        throw new Error(`Executing ${(0,utils_src.pluralizeToken)('plugin', rejected.length)} failed.\n\n${errorMessages}\n\n`);
    }
    return fulfilled.map(result => result.value);
}
//# sourceMappingURL=execute-plugin.js.map
;// ../../node_modules/@code-pushup/core/src/lib/implementation/collect.js




/**
 * Run audits, collect plugin output and aggregate it into a JSON object
 * @param options
 */
async function collect(options) {
    const { plugins, categories, persist, cache, ...otherOptions } = options;
    const date = new Date().toISOString();
    const start = performance.now();
    const commit = await (0,utils_src.getLatestCommit)();
    const pluginOutputs = await executePlugins({
        plugins,
        persist: { outputDir: src.DEFAULT_PERSIST_OUTPUT_DIR, ...persist },
        cache,
    }, otherOptions);
    const packageJson = __webpack_require__(602);
    return {
        commit,
        packageName: packageJson.name,
        version: packageJson.version,
        date,
        duration: (0,utils_src.calcDuration)(start),
        categories,
        plugins: pluginOutputs,
    };
}
//# sourceMappingURL=collect.js.map
;// ../../node_modules/@code-pushup/core/src/lib/implementation/persist.js


class PersistDirError extends Error {
    constructor(outputDir) {
        super(`outPath: ${outputDir} is no directory.`);
    }
}
class PersistError extends Error {
    constructor(reportPath) {
        super(`fileName: ${reportPath} could not be saved.`);
    }
}
async function persistReport(report, sortedScoredReport, options) {
    const { outputDir, filename, format } = options;
    // collect physical format outputs
    const results = format.map((reportType) => {
        switch (reportType) {
            case 'json':
                return {
                    format: 'json',
                    content: JSON.stringify(report, null, 2),
                };
            case 'md':
                return {
                    format: 'md',
                    content: (0,utils_src.generateMdReport)(sortedScoredReport, { outputDir }),
                };
        }
    });
    if (!(await (0,utils_src.directoryExists)(outputDir))) {
        try {
            await (0,promises_.mkdir)(outputDir, { recursive: true });
        }
        catch (error) {
            (0,utils_src.ui)().logger.warning(error.toString());
            throw new PersistDirError(outputDir);
        }
    }
    // write relevant format outputs to file system
    return Promise.allSettled(results.map(result => persistResult((0,utils_src.createReportPath)({ outputDir, filename, format: result.format }), result.content)));
}
async function persistResult(reportPath, content) {
    return ((0,promises_.writeFile)(reportPath, content)
        // return reportPath instead of void
        .then(() => (0,promises_.stat)(reportPath))
        .then(stats => [reportPath, stats.size])
        .catch(error => {
        (0,utils_src.ui)().logger.warning(error.toString());
        throw new PersistError(reportPath);
    }));
}
function logPersistedResults(persistResults) {
    (0,utils_src.logMultipleFileResults)(persistResults, 'Generated reports');
}
//# sourceMappingURL=persist.js.map
;// ../../node_modules/@code-pushup/core/src/lib/collect-and-persist.js




async function collectAndPersistReports(options) {
    const logger = (0,utils_src.ui)().logger;
    const reportResult = await collect(options);
    const sortedScoredReport = (0,utils_src.sortReport)((0,utils_src.scoreReport)(reportResult));
    const { persist } = options;
    const { skipReports = false, ...persistOptions } = persist ?? {};
    if (skipReports === true) {
        logger.info('Skipping saving reports as `persist.skipReports` is true');
    }
    else {
        const persistResults = await persistReport(reportResult, sortedScoredReport, persistOptions);
        if ((0,utils_src.isVerbose)()) {
            logPersistedResults(persistResults);
        }
    }
    // terminal output
    (0,utils_src.logStdoutSummary)(sortedScoredReport);
    // validate report and throw if invalid
    reportResult.plugins.forEach(plugin => {
        // Running checks after persisting helps while debugging as you can check the invalid output after the error is thrown
        src.pluginReportSchema.parse(plugin);
    });
}
//# sourceMappingURL=collect-and-persist.js.map
;// ../../node_modules/@code-pushup/core/src/lib/implementation/compare-scorables.js

function compareCategories(reports) {
    const { pairs, added, removed } = (0,utils_src.matchArrayItemsByKey)({
        before: reports.before.categories ?? [],
        after: reports.after.categories ?? [],
        key: 'slug',
    });
    const { changed, unchanged } = (0,utils_src.comparePairs)(pairs, ({ before, after }) => before.score === after.score);
    return {
        changed: changed.map(categoryPairToDiff),
        unchanged: unchanged.map(categoryToResult),
        added: added.map(categoryToResult),
        removed: removed.map(categoryToResult),
    };
}
function compareGroups(reports) {
    const { pairs, added, removed } = (0,utils_src.matchArrayItemsByKey)({
        before: (0,utils_src.listGroupsFromAllPlugins)(reports.before),
        after: (0,utils_src.listGroupsFromAllPlugins)(reports.after),
        key: ({ plugin, group }) => `${plugin.slug}/${group.slug}`,
    });
    const { changed, unchanged } = (0,utils_src.comparePairs)(pairs, ({ before, after }) => before.group.score === after.group.score);
    return {
        changed: changed.map(pluginGroupPairToDiff),
        unchanged: unchanged.map(pluginGroupToResult),
        added: added.map(pluginGroupToResult),
        removed: removed.map(pluginGroupToResult),
    };
}
function compareAudits(reports) {
    const { pairs, added, removed } = (0,utils_src.matchArrayItemsByKey)({
        before: (0,utils_src.listAuditsFromAllPlugins)(reports.before),
        after: (0,utils_src.listAuditsFromAllPlugins)(reports.after),
        key: ({ plugin, audit }) => `${plugin.slug}/${audit.slug}`,
    });
    const { changed, unchanged } = (0,utils_src.comparePairs)(pairs, ({ before, after }) => before.audit.value === after.audit.value &&
        before.audit.score === after.audit.score);
    return {
        changed: changed.map(pluginAuditPairToDiff),
        unchanged: unchanged.map(pluginAuditToResult),
        added: added.map(pluginAuditToResult),
        removed: removed.map(pluginAuditToResult),
    };
}
function categoryToResult(category) {
    return {
        ...selectMeta(category),
        score: category.score,
    };
}
function categoryPairToDiff({ before, after, }) {
    return {
        ...selectMeta(after),
        scores: {
            before: before.score,
            after: after.score,
            diff: after.score - before.score,
        },
    };
}
function pluginGroupToResult({ group, plugin }) {
    return {
        ...selectMeta(group),
        plugin: selectMeta(plugin),
        score: group.score,
    };
}
function pluginGroupPairToDiff({ before, after, }) {
    return {
        ...selectMeta(after.group),
        plugin: selectMeta(after.plugin),
        scores: {
            before: before.group.score,
            after: after.group.score,
            diff: after.group.score - before.group.score,
        },
    };
}
function pluginAuditToResult({ audit, plugin }) {
    return {
        ...selectMeta(audit),
        plugin: selectMeta(plugin),
        score: audit.score,
        value: audit.value,
        displayValue: audit.displayValue,
    };
}
function pluginAuditPairToDiff({ before, after, }) {
    return {
        ...selectMeta(after.audit),
        plugin: selectMeta(after.plugin),
        scores: {
            before: before.audit.score,
            after: after.audit.score,
            diff: after.audit.score - before.audit.score,
        },
        values: {
            before: before.audit.value,
            after: after.audit.value,
            diff: after.audit.value - before.audit.value,
        },
        displayValues: {
            before: before.audit.displayValue,
            after: after.audit.displayValue,
        },
    };
}
function selectMeta(meta) {
    return {
        slug: meta.slug,
        title: meta.title,
        ...(meta.docsUrl && {
            docsUrl: meta.docsUrl,
        }),
    };
}
//# sourceMappingURL=compare-scorables.js.map
;// ../../node_modules/@code-pushup/core/src/lib/load-portal-client.js

async function loadPortalClient() {
    try {
        return await Promise.resolve().then(function webpackMissingModule() { var e = new Error("Cannot find module '@code-pushup/portal-client'"); e.code = 'MODULE_NOT_FOUND'; throw e; });
    }
    catch {
        (0,utils_src.ui)().logger.error('Optional peer dependency @code-pushup/portal-client is not available. Make sure it is installed to enable upload functionality.');
        return null;
    }
}
//# sourceMappingURL=load-portal-client.js.map
;// ../../node_modules/@code-pushup/core/src/lib/compare.js






async function compareReportFiles(config, options) {
    const { outputDir, filename, format } = config.persist;
    const defaultInputPath = (suffix) => (0,utils_src.createReportPath)({ outputDir, filename, format: 'json', suffix });
    const [reportBefore, reportAfter] = await Promise.all([
        (0,utils_src.readJsonFile)(options?.before ?? defaultInputPath('before')),
        (0,utils_src.readJsonFile)(options?.after ?? defaultInputPath('after')),
    ]);
    const reports = {
        before: src.reportSchema.parse(reportBefore),
        after: src.reportSchema.parse(reportAfter),
    };
    const diff = compareReports(reports);
    const label = options?.label ?? getLabelFromReports(reports);
    const portalUrl = config.upload &&
        diff.commits &&
        (await fetchPortalComparisonLink(config.upload, diff.commits));
    const diffWithLinks = label || portalUrl
        ? { ...diff, ...(label && { label }), ...(portalUrl && { portalUrl }) }
        : diff;
    return Promise.all(format.map(async (fmt) => {
        const outputPath = (0,utils_src.createReportPath)({
            outputDir,
            filename,
            format: fmt,
            suffix: 'diff',
        });
        const content = reportsDiffToFileContent(diffWithLinks, fmt);
        await (0,utils_src.ensureDirectoryExists)(outputDir);
        await (0,promises_.writeFile)(outputPath, content);
        return outputPath;
    }));
}
function compareReports(reports) {
    const start = performance.now();
    const date = new Date().toISOString();
    const commits = reports.before.commit != null && reports.after.commit != null
        ? { before: reports.before.commit, after: reports.after.commit }
        : null;
    const scoredReports = {
        before: (0,utils_src.scoreReport)(reports.before),
        after: (0,utils_src.scoreReport)(reports.after),
    };
    const categories = compareCategories(scoredReports);
    const groups = compareGroups(scoredReports);
    const audits = compareAudits(scoredReports);
    const duration = (0,utils_src.calcDuration)(start);
    const packageJson = __webpack_require__(602);
    return {
        commits,
        categories,
        groups,
        audits,
        packageName: packageJson.name,
        version: packageJson.version,
        date,
        duration,
    };
}
function reportsDiffToFileContent(reportsDiff, format) {
    switch (format) {
        case 'json':
            return JSON.stringify(reportsDiff, null, 2);
        case 'md':
            return (0,utils_src.generateMdReportsDiff)(reportsDiff);
    }
}
async function fetchPortalComparisonLink(uploadConfig, commits) {
    const { server, apiKey, organization, project } = uploadConfig;
    const portalClient = await loadPortalClient();
    if (!portalClient) {
        return;
    }
    const { PortalOperationError, getPortalComparisonLink } = portalClient;
    try {
        return await getPortalComparisonLink({
            server,
            apiKey,
            parameters: {
                organization,
                project,
                before: commits.before.hash,
                after: commits.after.hash,
            },
        });
    }
    catch (error) {
        if (error instanceof PortalOperationError) {
            (0,utils_src.ui)().logger.warning(`Failed to fetch portal comparison link - ${error.message}`);
            return undefined;
        }
        throw error;
    }
}
function getLabelFromReports(reports) {
    if (reports.before.label &&
        reports.after.label &&
        reports.before.label === reports.after.label) {
        return reports.after.label;
    }
    return undefined;
}
//# sourceMappingURL=compare.js.map
;// ../../node_modules/@code-pushup/core/src/lib/implementation/report-to-gql.js
function reportToGQL(report) {
    return {
        packageName: report.packageName,
        packageVersion: report.version,
        commandStartDate: report.date,
        commandDuration: report.duration,
        plugins: report.plugins.map(pluginToGQL),
        categories: (report.categories ?? []).map(categoryToGQL),
    };
}
function pluginToGQL(plugin) {
    return {
        slug: plugin.slug,
        title: plugin.title,
        icon: plugin.icon,
        description: plugin.description,
        docsUrl: plugin.docsUrl,
        audits: plugin.audits.map(auditToGQL),
        groups: plugin.groups?.map(groupToGQL),
        packageName: plugin.packageName,
        packageVersion: plugin.version,
        runnerDuration: plugin.duration,
        runnerStartDate: plugin.date,
    };
}
function groupToGQL(group) {
    return {
        slug: group.slug,
        title: group.title,
        description: group.description,
        refs: group.refs.map(ref => ({ slug: ref.slug, weight: ref.weight })),
    };
}
function auditToGQL(audit) {
    const { slug, title, description, docsUrl, score, value, displayValue: formattedValue, details, } = audit;
    const { issues, table, trees } = details ?? {};
    return {
        slug,
        title,
        description,
        docsUrl,
        score,
        value,
        formattedValue,
        ...(details && {
            details: {
                ...(issues && { issues: issues.map(issueToGQL) }),
                ...(table && { tables: [tableToGQL(table)] }),
                ...(trees && { trees: trees.map(treeToGQL) }),
            },
        }),
    };
}
function issueToGQL(issue) {
    return {
        message: issue.message,
        severity: issueSeverityToGQL(issue.severity),
        ...(issue.source?.file && {
            sourceType: safeEnum('SourceCode'),
            sourceFilePath: issue.source.file,
            sourceStartLine: issue.source.position?.startLine,
            sourceStartColumn: issue.source.position?.startColumn,
            sourceEndLine: issue.source.position?.endLine,
            sourceEndColumn: issue.source.position?.endColumn,
        }),
    };
}
function tableToGQL(table) {
    return {
        ...(table.title && { title: table.title }),
        ...(table.columns?.length && {
            columns: table.columns.map((column) => typeof column === 'string'
                ? { alignment: tableAlignmentToGQL(column) }
                : {
                    key: column.key,
                    label: column.label,
                    alignment: column.align && tableAlignmentToGQL(column.align),
                }),
        }),
        rows: table.rows.map((row) => Array.isArray(row)
            ? row.map(content => ({ content: content?.toString() ?? '' }))
            : Object.entries(row).map(([key, content]) => ({
                key,
                content: content?.toString() ?? '',
            }))),
    };
}
function treeToGQL(tree) {
    if (tree.type === 'coverage') {
        return coverageTreeToGQL(tree);
    }
    return basicTreeToGQL(tree);
}
function basicTreeToGQL(tree) {
    return {
        type: safeEnum('Basic'),
        ...(tree.title && { title: tree.title }),
        root: basicTreeNodeToGQL(tree.root),
    };
}
function basicTreeNodeToGQL(node) {
    return {
        name: node.name,
        ...(node.values && {
            values: Object.entries(node.values).map(([key, value]) => ({
                key,
                value: value.toString(),
            })),
        }),
        ...(node.children?.length && {
            children: node.children.map(basicTreeNodeToGQL),
        }),
    };
}
function coverageTreeToGQL(tree) {
    return {
        type: safeEnum('Coverage'),
        ...(tree.title && { title: tree.title }),
        root: coverageTreeNodeToGQL(tree.root),
    };
}
function coverageTreeNodeToGQL(node) {
    return {
        name: node.name,
        coverage: node.values.coverage,
        ...(node.values.missing?.length && {
            missing: node.values.missing,
        }),
        ...(node.children?.length && {
            children: node.children.map(coverageTreeNodeToGQL),
        }),
    };
}
function categoryToGQL(category) {
    return {
        slug: category.slug,
        title: category.title,
        description: category.description,
        // TODO: Portal API migration - convert scoreTarget to isBinary for backward compatibility
        // Remove this conversion when Portal API supports scoreTarget (#713)
        isBinary: category.scoreTarget === 1,
        refs: category.refs.map(ref => ({
            plugin: ref.plugin,
            type: categoryRefTypeToGQL(ref.type),
            weight: ref.weight,
            slug: ref.slug,
        })),
    };
}
function categoryRefTypeToGQL(type) {
    switch (type) {
        case 'audit':
            return safeEnum('Audit');
        case 'group':
            return safeEnum('Group');
    }
}
function issueSeverityToGQL(severity) {
    switch (severity) {
        case 'info':
            return safeEnum('Info');
        case 'error':
            return safeEnum('Error');
        case 'warning':
            return safeEnum('Warning');
    }
}
function tableAlignmentToGQL(alignment) {
    switch (alignment) {
        case 'left':
            return safeEnum('Left');
        case 'center':
            return safeEnum('Center');
        case 'right':
            return safeEnum('Right');
    }
}
// validates enum value string, workaround for nominal typing
function safeEnum(value) {
    return value;
}
//# sourceMappingURL=report-to-gql.js.map
;// ../../node_modules/@code-pushup/core/src/lib/upload.js



/**
 * Uploads collected audits to the portal
 * @param options
 * @param uploadFn
 */
async function upload(options) {
    if (options.upload == null) {
        throw new Error('Upload configuration is not set.');
    }
    const portalClient = await loadPortalClient();
    if (!portalClient) {
        return;
    }
    const { uploadReportToPortal } = portalClient;
    const { apiKey, server, organization, project, timeout } = options.upload;
    const report = await (0,utils_src.loadReport)({
        ...options.persist,
        format: 'json',
    });
    if (!report.commit) {
        throw new Error('Commit must be linked in order to upload report');
    }
    const data = {
        organization,
        project,
        commit: report.commit.hash,
        ...reportToGQL(report),
    };
    return uploadReportToPortal({ apiKey, server, data, timeout });
}
//# sourceMappingURL=upload.js.map
;// ../../node_modules/@code-pushup/core/src/lib/history.js



async function history_history(config, commits) {
    const initialBranch = await (0,utils_src.getCurrentBranchOrTag)();
    const { skipUploads = false, forceCleanStatus, persist } = config;
    const reports = [];
    // eslint-disable-next-line functional/no-loop-statements
    for (const commit of commits) {
        (0,utils_src.ui)().logger.info(`Collect ${commit}`);
        await (0,utils_src.safeCheckout)(commit, forceCleanStatus);
        const currentConfig = {
            ...config,
            persist: {
                ...persist,
                format: ['json'],
                filename: `${commit}-report`,
            },
            cache: {
                read: false,
                write: false,
            },
        };
        await collectAndPersistReports(currentConfig);
        if (skipUploads) {
            (0,utils_src.ui)().logger.info('Upload is skipped because skipUploads is set to true.');
        }
        else {
            if (currentConfig.upload) {
                await upload(currentConfig);
            }
            else {
                (0,utils_src.ui)().logger.info('Upload is skipped because upload config is undefined.');
            }
        }
        // eslint-disable-next-line functional/immutable-data
        reports.push(currentConfig.persist.filename);
    }
    await (0,utils_src.safeCheckout)(initialBranch, forceCleanStatus);
    return reports;
}
//# sourceMappingURL=history.js.map
;// ../../node_modules/@code-pushup/core/src/lib/implementation/read-rc-file.js



class ConfigPathError extends Error {
    constructor(configPath) {
        super(`Provided path '${configPath}' is not valid.`);
    }
}
async function readRcByPath(filepath, tsconfig) {
    if (filepath.length === 0) {
        throw new Error('The path to the configuration file is empty.');
    }
    if (!(await (0,utils_src.fileExists)(filepath))) {
        throw new ConfigPathError(filepath);
    }
    const cfg = await (0,utils_src.importModule)({
        filepath,
        tsconfig,
        format: 'esm',
    });
    return (0,utils_src.parseSchema)(src.coreConfigSchema, cfg, {
        schemaType: 'core config',
        sourcePath: filepath,
    });
}
async function autoloadRc(tsconfig) {
    // eslint-disable-next-line functional/no-let
    let ext = '';
    // eslint-disable-next-line functional/no-loop-statements
    for (const extension of src.SUPPORTED_CONFIG_FILE_FORMATS) {
        const filePath = `${src.CONFIG_FILE_NAME}.${extension}`;
        const exists = await (0,utils_src.fileExists)(filePath);
        if (exists) {
            ext = extension;
            break;
        }
    }
    if (!ext) {
        throw new Error(`No file ${src.CONFIG_FILE_NAME}.(${src.SUPPORTED_CONFIG_FILE_FORMATS.join('|')}) present in ${process.cwd()}`);
    }
    return readRcByPath(external_node_path_default().join(process.cwd(), `${src.CONFIG_FILE_NAME}.${ext}`), tsconfig);
}
//# sourceMappingURL=read-rc-file.js.map
;// ../../node_modules/@code-pushup/core/src/lib/merge-diffs.js




async function mergeDiffs(files, persistConfig) {
    const results = await Promise.allSettled(files.map(async (file) => {
        const json = await (0,utils_src.readJsonFile)(file).catch((error) => {
            throw new Error(`Failed to read JSON file ${file} - ${(0,utils_src.stringifyError)(error)}`);
        });
        const result = await src.reportsDiffSchema.safeParseAsync(json);
        if (!result.success) {
            throw new Error(`Invalid reports diff in ${file} - ${result.error.message}`);
        }
        return { ...result.data, file };
    }));
    results.filter(utils_src.isPromiseRejectedResult).forEach(({ reason }) => {
        (0,utils_src.ui)().logger.warning(`Skipped invalid report diff - ${(0,utils_src.stringifyError)(reason)}`);
    });
    const diffs = results
        .filter(utils_src.isPromiseFulfilledResult)
        .map(({ value }) => value);
    const labeledDiffs = diffs.map(diff => ({
        ...diff,
        label: diff.label || external_node_path_default().basename(external_node_path_default().dirname(diff.file)), // fallback is parent folder name
    }));
    const markdown = (0,utils_src.generateMdReportsDiffForMonorepo)(labeledDiffs);
    const { outputDir, filename } = persistConfig;
    const outputPath = external_node_path_default().join(outputDir, `${filename}-diff.md`);
    await (0,utils_src.ensureDirectoryExists)(outputDir);
    await (0,promises_.writeFile)(outputPath, markdown);
    return outputPath;
}
//# sourceMappingURL=merge-diffs.js.map
;// ../../node_modules/@code-pushup/core/src/index.js











//# sourceMappingURL=index.js.map

/***/ }),

/***/ 602:
/***/ ((module) => {

module.exports = /*#__PURE__*/JSON.parse('{"name":"@code-pushup/core","version":"0.75.0","license":"MIT","description":"Core business logic for the used by the Code PushUp CLI","homepage":"https://github.com/code-pushup/cli/tree/main/packages/core#readme","bugs":{"url":"https://github.com/code-pushup/cli/issues?q=is%3Aissue%20state%3Aopen%20type%3ABug%20label%3A\\"🧩%20core\\""},"repository":{"type":"git","url":"git+https://github.com/code-pushup/cli.git","directory":"packages/core"},"keywords":["CLI","Code PushUp","automation","developer tools","code quality","conformance","build tools","KPI tracking","tech debt","automated feedback","regression guard","CI integration","code management","actionable feedback","trend analysis","static analysis","linting","audit","performance","score monitoring"],"publishConfig":{"access":"public"},"type":"module","dependencies":{"@code-pushup/models":"0.75.0","@code-pushup/utils":"0.75.0","ansis":"^3.3.0"},"peerDependencies":{"@code-pushup/portal-client":"^0.15.0"},"peerDependenciesMeta":{"@code-pushup/portal-client":{"optional":true}},"files":["src","!**/*.tsbuildinfo"],"module":"./src/index.js","main":"./src/index.js","types":"./src/index.d.ts"}');

/***/ })

};
;