import {
  agenticGenerator
} from "./chunk-GHXW56PO.js";
import {
  assertModelAllowed
} from "./chunk-ISTDY47H.js";
import {
  ConfigError
} from "./chunk-YEJR7IXO.js";

// src/improvement/improvement-driver.ts
import { spawnSync } from "child_process";
import {
  verifyCodeSurface
} from "@tangle-network/agent-eval/campaign";
function improvementDriver(opts) {
  const baseRef = opts.baseRef ?? "main";
  const owned = /* @__PURE__ */ new Map();
  return {
    kind: `improvement:${opts.generator.kind}`,
    async propose(ctx) {
      const findings = resolveFindings(ctx);
      if (findings.length === 0 && ctx.report === void 0 && !opts.generator.proposesWithoutFindings) {
        return [];
      }
      const surfaces = [];
      const incumbent = verifiedCodeIncumbent(ctx.currentSurface);
      const proposalBaseRef = incumbent?.baseCommit ?? baseRef;
      for (let i = 0; i < ctx.populationSize; i++) {
        if (ctx.signal.aborted) break;
        const wt = await opts.worktree.create({
          baseRef: proposalBaseRef,
          label: `${opts.generator.kind}-gen${ctx.generation}-cand${i}`
        });
        owned.set(wt.path, wt);
        try {
          if (incumbent) advanceToIncumbent(wt, incumbent);
          const { applied, summary } = await opts.generator.generate({
            worktreePath: wt.path,
            report: ctx.report,
            findings,
            dataset: ctx.dataset,
            maxShots: ctx.maxImprovementShots ?? 1,
            signal: ctx.signal,
            generation: ctx.generation,
            candidateIndex: i,
            ...ctx.costLedger ? { costLedger: ctx.costLedger } : {},
            ...ctx.costPhase ? { costPhase: ctx.costPhase } : {}
          });
          if (!applied) {
            await opts.worktree.discard(wt);
            owned.delete(wt.path);
            continue;
          }
          const surface = await opts.worktree.finalize(wt, summary);
          surfaces.push(surface);
          owned.delete(wt.path);
          owned.set(surface.worktreeRef, wt);
        } catch (err) {
          const cleanupErrors = [];
          for (let attempt = 0; attempt < 2; attempt += 1) {
            try {
              await opts.worktree.discard(wt);
              owned.delete(wt.path);
              break;
            } catch (cause) {
              cleanupErrors.push(cause);
            }
          }
          if (cleanupErrors.length === 0) throw err;
          const failure = err instanceof Error ? err.message : String(err);
          const cleanupSucceeded = !owned.has(wt.path);
          throw new AggregateError(
            [err, ...cleanupErrors],
            cleanupSucceeded ? `improvementDriver: ${failure}; candidate cleanup retry succeeded` : `improvementDriver: ${failure}; candidate worktree could not be cleaned`
          );
        }
      }
      return surfaces;
    },
    async cleanup(retainWorktreeRefs = []) {
      const retained = new Set(retainWorktreeRefs);
      const errors = [];
      for (const [worktreeRef, worktree] of owned) {
        if (retained.has(worktreeRef)) continue;
        try {
          await opts.worktree.discard(worktree);
          owned.delete(worktreeRef);
        } catch (cause) {
          errors.push(cause);
        }
      }
      if (errors.length > 0) {
        throw new AggregateError(errors, "improvementDriver: failed to discard candidate worktrees");
      }
    }
  };
}
function verifiedCodeIncumbent(surface) {
  if (typeof surface !== "object" || surface.kind !== "code") return void 0;
  verifyCodeSurface(surface);
  return surface;
}
function advanceToIncumbent(worktree, incumbent) {
  if (worktree.baseCommit !== incumbent.baseCommit || worktree.baseTree !== incumbent.baseTree) {
    throw new Error("improvementDriver: candidate worktree does not match incumbent base identity");
  }
  if (worktree.baseCommit === incumbent.candidateCommit) return;
  const merge = spawnSync("git", ["merge", "--ff-only", incumbent.candidateCommit], {
    cwd: worktree.path,
    encoding: "utf8"
  });
  if (merge.error) {
    throw new Error(
      `improvementDriver: failed to start candidate from incumbent: ${merge.error.message}`
    );
  }
  if (merge.status !== 0) {
    throw new Error(
      `improvementDriver: could not fast-forward candidate to incumbent ${incumbent.candidateCommit}: ${merge.stderr.trim()}`
    );
  }
  const head = spawnSync("git", ["rev-parse", "--verify", "HEAD"], {
    cwd: worktree.path,
    encoding: "utf8"
  });
  if (head.error || head.status !== 0 || head.stdout.trim() !== incumbent.candidateCommit) {
    throw new Error("improvementDriver: candidate worktree did not reach the incumbent commit");
  }
}
function resolveFindings(ctx) {
  const report = ctx.report;
  if (report && typeof report === "object" && "findings" in report) {
    const f = report.findings;
    if (Array.isArray(f) && f.length > 0) return f;
  }
  return ctx.findings;
}

// src/improvement/raw-trace-distiller.ts
import { existsSync, readdirSync } from "fs";
import { basename, join, resolve } from "path";
import { makeFinding } from "@tangle-network/agent-eval";
var ANALYST_ID = "raw-trace-distiller";
var PASS_THRESHOLD = 0.999;
function rawTraceDistiller(options = {}) {
  const maxCandidates = options.maxCandidates ?? 12;
  const maxCellsPerCandidate = options.maxCellsPerCandidate ?? 8;
  const maxFilesPerCell = options.maxFilesPerCell ?? 24;
  return async (input) => {
    const genRoot = absoluteRunDir(options.runDir ?? input.runDir);
    const durable = isDurable(genRoot);
    const ranked = [...input.candidates].map((c) => ({
      surfaceHash: c.surfaceHash,
      composite: c.composite,
      campaignDir: absoluteRunDir(c.campaign.runDir),
      cells: failingCells(c.campaign, maxCellsPerCandidate, maxFilesPerCell)
    })).sort((a, b) => a.composite - b.composite).slice(0, maxCandidates);
    const totalFailingCells = ranked.reduce((n, c) => n + c.cells.length, 0);
    if (totalFailingCells === 0) {
      if (options.fallbackFindings && options.fallbackFindings.length > 0) {
        return options.fallbackFindings;
      }
      return [
        makeFinding({
          analyst_id: ANALYST_ID,
          severity: "info",
          area: "raw-trace-context",
          confidence: 1,
          claim: `Generation ${input.generation} had no failing cells. The full raw run traces are on disk under ${genRoot}.`,
          recommended_action: `To keep improving, grep/cat the raw traces under ${genRoot} (per-cell spans.jsonl + cached-result.json) to find the weakest passing runs, then make a targeted harness-code edit.`,
          evidence_refs: [{ kind: "artifact", uri: genRoot }],
          metadata: { generation: input.generation, runDir: genRoot, failingCells: 0 }
        })
      ];
    }
    const findings = [];
    findings.push(
      makeFinding({
        analyst_id: ANALYST_ID,
        severity: "high",
        area: "raw-trace-context",
        confidence: 1,
        claim: `Generation ${input.generation} produced ${totalFailingCells} failing/low-scoring cell(s) across ${ranked.length} candidate(s). Their FULL RAW run traces are on disk under ${genRoot} \u2014 the actual event logs (spans.jsonl), scores (cached-result.json), and artifacts, not a summary.${durable ? "" : " (WARNING: this run root does not exist on disk \u2014 it looks like an in-memory run; pass a real runDir to improve() to get raw-trace context.)"}`,
        recommended_action: `Do NOT rely on a pre-summarized finding. Before editing, DIAGNOSE from the raw traces: run \`grep\`/\`cat\`/\`ls\` over the trace files and directories named in the following findings to see exactly what each failing run did and why it scored low, then make the smallest harness-code edit that fixes the dominant failure. Start with \`grep -rIn "error" ${genRoot}\` then \`cat\` the spans.jsonl of the worst cell.`,
        evidence_refs: [{ kind: "artifact", uri: genRoot }],
        metadata: {
          generation: input.generation,
          runDir: genRoot,
          failingCells: totalFailingCells,
          candidates: ranked.length
        }
      })
    );
    for (const cand of ranked) {
      if (cand.cells.length === 0) continue;
      const scenarioList = cand.cells.map((c) => c.scenarioId).join(", ");
      const fileLines = cand.cells.map((c) => {
        const header = `  cell ${c.scenarioId} (composite ${c.composite.toFixed(3)}${c.error ? `, error: ${truncate(c.error, 160)}` : ""}) \u2014 dir ${c.cellDir}`;
        const files = c.files.map((f) => `    - ${f}`).join("\n");
        const more = c.truncatedFiles ? `
    - \u2026(ls ${c.cellDir} for the rest)` : "";
        return c.files.length > 0 ? `${header}
${files}${more}` : header;
      }).join("\n");
      findings.push(
        makeFinding({
          analyst_id: ANALYST_ID,
          severity: cand.composite < 0.5 ? "critical" : "high",
          area: "raw-trace-context",
          confidence: 1,
          subject: cand.surfaceHash,
          claim: `Candidate ${cand.surfaceHash} scored composite ${cand.composite.toFixed(3)} with ${cand.cells.length} failing cell(s) [${scenarioList}]. Its raw traces are under ${cand.campaignDir}.`,
          recommended_action: `grep/cat these raw trace files to diagnose WHY this candidate failed before editing:
${fileLines}
Or scan the whole candidate at once: \`grep -rIn . ${cand.campaignDir}\` and \`ls -R ${cand.campaignDir}\`.`,
          evidence_refs: [
            { kind: "artifact", uri: cand.campaignDir },
            ...cand.cells.flatMap(
              (c) => c.files.map((f) => ({ kind: "artifact", uri: f }))
            )
          ],
          metadata: {
            surfaceHash: cand.surfaceHash,
            composite: cand.composite,
            campaignDir: cand.campaignDir,
            cells: cand.cells.map((c) => ({
              scenarioId: c.scenarioId,
              composite: c.composite,
              cellDir: c.cellDir,
              files: c.files,
              ...c.error ? { error: c.error } : {}
            }))
          }
        })
      );
    }
    return findings;
  };
}
function failingCells(campaign, maxCells, maxFiles) {
  const campaignDir = absoluteRunDir(campaign.runDir);
  const durable = isDurable(campaignDir);
  const out = [];
  for (const cell of campaign.cells) {
    const scores = Object.values(cell.judgeScores ?? {});
    const composite = scores.length === 0 ? 0 : scores.reduce((sum, s) => sum + (s.composite ?? 0), 0) / scores.length;
    if (!cell.error && composite >= PASS_THRESHOLD) continue;
    const cellDir = join(campaignDir, sanitizeCellId(cell.cellId));
    const artifactPaths = artifactPathsForCell(campaign.artifactsByPath, cell.cellId);
    const discovered = durable ? listTraceFiles(cellDir) : [];
    const canonical = [join(cellDir, "spans.jsonl"), join(cellDir, "cached-result.json")];
    const files = dedupeSorted([...discovered, ...artifactPaths, ...canonical]);
    out.push({
      scenarioId: cell.scenarioId,
      composite: Number(composite.toFixed(3)),
      ...cell.error ? { error: cell.error } : {},
      cellDir,
      files: files.slice(0, maxFiles),
      truncatedFiles: files.length > maxFiles
    });
    if (out.length >= maxCells) break;
  }
  return out;
}
function artifactPathsForCell(artifactsByPath, cellId) {
  if (!artifactsByPath) return [];
  const prefix = `${cellId}/`;
  return Object.entries(artifactsByPath).filter(([key]) => key.startsWith(prefix)).map(([, absPath]) => resolve(absPath));
}
function listTraceFiles(dir) {
  const out = [];
  for (const entry of safeReadDir(dir)) {
    const full = join(dir, entry.name);
    if (entry.isFile()) {
      out.push(full);
    } else if (!entry.isSymbolicLink() && entry.isDirectory()) {
      for (const sub of safeReadDir(full)) {
        if (sub.isFile()) out.push(join(full, sub.name));
      }
    }
  }
  return out;
}
function safeReadDir(dir) {
  try {
    return readdirSync(dir, { withFileTypes: true });
  } catch {
    return [];
  }
}
function sanitizeCellId(cellId) {
  return cellId.replace(/[^a-zA-Z0-9_-]/g, "_");
}
function isDurable(runDir) {
  return !runDir.startsWith("mem://") && existsSync(runDir);
}
function absoluteRunDir(runDir) {
  return runDir.startsWith("mem://") ? runDir : resolve(runDir);
}
function dedupeSorted(paths) {
  return [...new Set(paths)].sort((a, b) => {
    const da = a.slice(0, a.length - basename(a).length);
    const db = b.slice(0, b.length - basename(b).length);
    return da === db ? basename(a).localeCompare(basename(b)) : da.localeCompare(db);
  });
}
function truncate(s, n) {
  return s.length <= n ? s : `${s.slice(0, n - 1)}\u2026`;
}

// src/improvement/improve.ts
import { canonicalJson } from "@tangle-network/agent-eval";
import {
  gepaProposer,
  gitWorktreeAdapter,
  memoryCurationProposer,
  skillOptProposer
} from "@tangle-network/agent-eval/campaign";
import {
  selfImprove
} from "@tangle-network/agent-eval/contract";
import { agentProfileSchema } from "@tangle-network/agent-interface";
var defaultReflectionModel = "deepseek-v4-flash";
function llmClientOptions(llm) {
  return { baseUrl: llm?.baseUrl, apiKey: llm?.apiKey };
}
function defaultGeneratorFor(surface, llm) {
  const model = llm?.model ?? defaultReflectionModel;
  switch (surface) {
    case "prompt":
      return gepaProposer({ llm: llmClientOptions(llm), model, target: "agent system prompt" });
    case "skills":
      return skillOptProposer({ llm: llmClientOptions(llm), model, target: "agent skill document" });
    case "memory":
      return memoryCurationProposer();
    default:
      return void 0;
  }
}
function baselineSurfaceFor(profile, surface, skills, memory) {
  switch (surface) {
    case "prompt":
      return profile.prompt?.systemPrompt ?? "";
    case "skills":
      return skills?.document ?? JSON.stringify(profile.resources?.skills ?? []);
    case "tools":
      return JSON.stringify(profile.tools ?? {});
    case "mcp":
      return JSON.stringify(profile.mcp ?? {});
    case "hooks":
      return JSON.stringify(profile.hooks ?? {});
    case "subagents":
      return JSON.stringify(profile.subagents ?? {});
    case "agent-profile":
      return canonicalJson(profile);
    case "memory":
      if (!memory) {
        throw new ConfigError("improve(): surface 'memory' requires opts.memory.document");
      }
      return memory.document;
    case "code":
      throw new ConfigError(
        "improve(): code requires the isolated baseline created from opts.code.repoRoot"
      );
  }
}
function generationFailureDistiller(staticFindings) {
  const CAP = 12;
  return async (input) => {
    const failures = [];
    for (const candidate of input.candidates) {
      for (const rawCell of candidate.campaign.cells) {
        const cell = rawCell;
        const scenario = String(cell.scenarioId ?? "unknown");
        const error = typeof cell.error === "string" ? cell.error : void 0;
        const judgeScores = cell.judgeScores && typeof cell.judgeScores === "object" ? Object.values(
          cell.judgeScores
        ) : [];
        const composite = judgeScores.length === 0 ? 0 : judgeScores.reduce((sum, j) => sum + (j.composite ?? 0), 0) / judgeScores.length;
        if (!error && composite >= 0.999) continue;
        const notes = judgeScores.map((j) => j.notes).filter((n) => typeof n === "string" && n.length > 0).join("; ").slice(0, 400);
        const claim = notes || (error ? `Scenario ${scenario} failed: ${error.slice(0, 200)}` : "");
        failures.push({
          scenario,
          composite: Number(composite.toFixed(3)),
          notes,
          ...claim ? { claim } : {},
          ...error ? { error: error.slice(0, 200) } : {}
        });
      }
    }
    if (failures.length === 0) return staticFindings;
    failures.sort((a, b) => a.composite - b.composite);
    return failures.slice(0, CAP);
  };
}
function memoryGenerationDistiller(staticFindings) {
  const distillFailures = generationFailureDistiller(staticFindings);
  return async (input) => {
    const fresh = await distillFailures(input);
    return fresh === staticFindings ? staticFindings : [...staticFindings, ...fresh];
  };
}
async function rethrowAfterCleanup(cause, cleanup, message) {
  const cleanupErrors = [];
  for (let attempt = 0; attempt < 2; attempt += 1) {
    try {
      await cleanup();
    } catch (cleanupCause) {
      cleanupErrors.push(cleanupCause);
      continue;
    }
    if (cleanupErrors.length === 0) throw cause;
    throw new AggregateError([cause, ...cleanupErrors], `${message}; the cleanup retry succeeded`);
  }
  throw new AggregateError([cause, ...cleanupErrors], message);
}
async function discardPreparedBaseline(worktree, baselineWorktree, cause) {
  return rethrowAfterCleanup(
    cause,
    () => worktree.discard(baselineWorktree),
    "improve(): code preparation failed and its baseline worktree could not be cleaned"
  );
}
function isCodeSurface(surface) {
  return typeof surface === "object" && surface !== null && surface.kind === "code";
}
async function prepareCodeRun(code) {
  const baseRef = code.baseRef ?? "main";
  const worktree = code.worktree ?? gitWorktreeAdapter({
    repoRoot: code.repoRoot,
    ...code.worktreeDir ? { worktreeDir: code.worktreeDir } : {}
  });
  const baselineWorktree = await worktree.create({ baseRef, label: "incumbent-baseline" });
  try {
    const baseline = await worktree.finalize(baselineWorktree, "Incumbent code checkout");
    let baselineDiscarded = false;
    const generator = code.generator ?? agenticGenerator({
      ...code.harness ? { harness: code.harness } : {},
      ...code.verify ? { verify: code.verify } : {},
      ...code.timeoutMs ? { timeoutMs: code.timeoutMs } : {}
    });
    const managed = improvementDriver({ worktree, generator, baseRef });
    return {
      baseline,
      proposer: managed,
      async cleanup(retainedWinner) {
        const errors = [];
        const retainedWorktreeRef = isCodeSurface(retainedWinner) ? retainedWinner.worktreeRef : void 0;
        try {
          await managed?.cleanup(retainedWorktreeRef ? [retainedWorktreeRef] : []);
        } catch (cause) {
          errors.push(cause);
        }
        if (!baselineDiscarded && retainedWorktreeRef !== baseline.worktreeRef) {
          try {
            await worktree.discard(baselineWorktree);
            baselineDiscarded = true;
          } catch (cause) {
            errors.push(cause);
          }
        }
        if (errors.length > 0) {
          throw new AggregateError(errors, "improve(): failed to clean code improvement worktrees");
        }
      }
    };
  } catch (cause) {
    return discardPreparedBaseline(worktree, baselineWorktree, cause);
  }
}
function idempotentDispose(dispose) {
  let disposed = false;
  let inFlight;
  return async () => {
    if (disposed) return;
    if (inFlight) return inFlight;
    inFlight = (async () => {
      await dispose();
      disposed = true;
    })();
    try {
      await inFlight;
    } finally {
      inFlight = void 0;
    }
  };
}
function parseWinnerJson(winner, surface) {
  try {
    return JSON.parse(winner);
  } catch (cause) {
    throw new ConfigError(
      `improve(): the shipped '${surface}' winner is not valid JSON, so it cannot be applied back to the profile: ${cause.message}`
    );
  }
}
function applyImprovementWinnerToProfile(profile, surface, winner) {
  if (typeof winner !== "string") return profile;
  let candidate;
  switch (surface) {
    case "prompt":
      candidate = { ...profile, prompt: { ...profile.prompt, systemPrompt: winner } };
      break;
    case "skills":
      candidate = {
        ...profile,
        resources: { ...profile.resources, skills: parseWinnerJson(winner, surface) }
      };
      break;
    case "tools":
      candidate = { ...profile, tools: parseWinnerJson(winner, surface) };
      break;
    case "mcp":
      candidate = { ...profile, mcp: parseWinnerJson(winner, surface) };
      break;
    case "hooks":
      candidate = { ...profile, hooks: parseWinnerJson(winner, surface) };
      break;
    case "subagents":
      candidate = { ...profile, subagents: parseWinnerJson(winner, surface) };
      break;
    case "agent-profile":
      candidate = parseWinnerJson(winner, surface);
      break;
    case "memory":
      return profile;
    case "code":
      return profile;
  }
  const parsed = agentProfileSchema.safeParse(candidate);
  if (!parsed.success) {
    throw new ConfigError(
      `improve(): the shipped '${surface}' winner does not produce a valid AgentProfile: ${parsed.error.message}`
    );
  }
  return parsed.data;
}
async function improve(profile, findings, opts) {
  const {
    surface = "prompt",
    gate = "holdout",
    generator,
    allowedModels,
    rawTraceContext,
    code,
    skills,
    memory,
    promotionGate,
    analyzeGeneration,
    ...sharedOptions
  } = opts;
  const parsedProfile = agentProfileSchema.safeParse(profile);
  if (!parsedProfile.success) {
    throw new ConfigError(
      `improve(): input is not a valid AgentProfile: ${parsedProfile.error.message}`
    );
  }
  if (surface === "skills" && !generator && !skills) {
    throw new ConfigError(
      "improve(): the default skills optimizer requires opts.skills.document; pass the skill text or an explicit generator that understands resource refs"
    );
  }
  if (surface === "memory" && !memory) {
    throw new ConfigError("improve(): surface 'memory' requires opts.memory.document");
  }
  if (surface === "code" && generator) {
    throw new ConfigError(
      "improve(): surface 'code' forbids opts.generator because an external SurfaceProposer cannot transfer checkout ownership; pass opts.code.generator instead"
    );
  }
  const usesReflectionModel = !generator && (surface === "prompt" || surface === "skills");
  if (usesReflectionModel) {
    assertModelAllowed(sharedOptions.llm?.model ?? defaultReflectionModel, allowedModels);
  }
  let preparedCode;
  if (surface === "code") {
    if (!code) {
      throw new ConfigError(
        "improve(): surface 'code' requires opts.code.repoRoot so the incumbent can run from an isolated checkout"
      );
    }
    preparedCode = await prepareCodeRun(code);
  }
  const proposer = preparedCode?.proposer ?? generator ?? defaultGeneratorFor(surface, sharedOptions.llm);
  if (!proposer) {
    throw new ConfigError(
      `improve(): surface '${surface}' has no default generator \u2014 pass opts.generator (a SurfaceProposer) explicitly`
    );
  }
  const budget = gate === "none" ? { ...sharedOptions.budget, generations: 0 } : { ...sharedOptions.budget };
  let raw;
  try {
    raw = await selfImprove({
      ...sharedOptions,
      baselineSurface: preparedCode?.baseline ?? baselineSurfaceFor(profile, surface, skills, memory),
      proposer,
      budget,
      findings,
      ...promotionGate !== void 0 ? { gate: promotionGate } : {},
      ...analyzeGeneration === null ? {} : {
        analyzeGeneration: analyzeGeneration ?? (rawTraceContext ? rawTraceDistiller({ fallbackFindings: findings }) : surface === "memory" ? memoryGenerationDistiller(findings) : generationFailureDistiller(findings))
      }
    });
  } catch (cause) {
    if (!preparedCode) throw cause;
    return rethrowAfterCleanup(
      cause,
      () => preparedCode.cleanup(),
      "improve(): code improvement failed and its worktrees could not be cleaned"
    );
  }
  const shipped = raw.gateDecision === "ship";
  const winnerSurface = raw.winner.surface;
  if (preparedCode) {
    try {
      await preparedCode.cleanup(winnerSurface);
    } catch (cleanupCause) {
      try {
        await preparedCode.cleanup();
      } catch (finalCleanupCause) {
        throw new AggregateError(
          [cleanupCause, finalCleanupCause],
          "improve(): code result cleanup failed, including the final all-worktree retry"
        );
      }
      throw new AggregateError(
        [cleanupCause],
        "improve(): code result cleanup failed; the final all-worktree retry succeeded"
      );
    }
  }
  const dispose = idempotentDispose(async () => preparedCode?.cleanup());
  const externalDocument = surface === "skills" && skills ? skills : surface === "memory" && memory ? memory : void 0;
  if (shipped && externalDocument) {
    if (typeof winnerSurface !== "string") {
      throw new ConfigError(
        `improve(): the shipped '${surface}' winner must be text before it can be persisted`
      );
    }
    await externalDocument.writeBack?.(winnerSurface);
  }
  const nextProfile = shipped && !externalDocument ? applyImprovementWinnerToProfile(profile, surface, winnerSurface) : profile;
  return {
    profile: nextProfile,
    shipped,
    lift: raw.lift,
    gateDecision: raw.gateDecision,
    raw,
    dispose
  };
}

export {
  improvementDriver,
  rawTraceDistiller,
  applyImprovementWinnerToProfile,
  improve
};
//# sourceMappingURL=chunk-7NCP74SL.js.map