{"version":3,"file":"index.mjs","names":["randomSource: RandomSource","int","array","chunk","esChunk","primeCache: number[]","core.int","core.rand","core.int","core.sample","pairs: [string, string][]","result: string[]","stack: [string, string][]","numbers.distinctInts","numbers.ints","core.shuffleInPlace","points","parts: number[]","core.rand","stack: [number, number][]","core.shuffle","core.int","result: number[][]","current","year","core.int","core.int","dx: number","dy: number","core.shuffle","angles: number[]","result: number[][]","edges: number[][]","arrays.permutation","core.int","core.shuffleInPlace","result","maxEdges: number","candidates: [number, number][]","core.sample","requiredCycle: [number, number][]","children: number[]","parent: number","val: bigint","core.sample","label: string | null","data: T","config: Required<Omit<DebugOptions, 'colors'>> & { colors: boolean }","matrix","G: IGenerator","numbers.int","numbers.ints","numbers.distinctInts","numbers.float","numbers.even","numbers.odd","numbers.prime","numbers.coprime","numbers.divisible","numbers.sequence","strings.string","strings.palindrome","strings.word","strings.words","strings.brackets","arrays.array","arrays.sorted","arrays.sparse","arrays.partition","arrays.matrix","arrays.grid01","arrays.maze","arrays.intervals","arrays.permutation","arrays.chunk","core.shuffle","core.sample","core.withRng","core.resetRng","graphs.tree","graphs.graph","graphs.binaryTree","geometry.points","geometry.convexHull","geometry.polygon","datetime.isLeap","datetime.year","datetime.date","array","year","t","LANGUAGES: LanguageInfo[]","translations: Record<string, string>","DEFAULT_COMPILER_FLAGS: Record<string, string[]>","runtime: string | null","profileContext: CompilationProfileContext","command","fs","tokens: string[]","quote: '\"' | \"'\" | null","error: any","stdout: string","replay: DatasetReplayInfo","expanded: ExpandedDatasetCase<TInput>[]","fs","currentPhase: DatasetErrorPhase","validationSummary: DatasetValidationSummary","inputRecord: DatasetFileRecord | null","outputRecord: DatasetFileRecord | null","manifest: DatasetManifest","chunk","AI_CONTRACT_GENERATED: AiContractGeneratedData","FMT_METHOD_PATCHES: Partial<Record<AiFmtMethodName, AiMethodPatch>>","GENERATOR_METHOD_PATCHES: Partial<Record<AiGeneratorMethodName, AiMethodPatch>>","BASE_METHOD_PATCHES: Partial<Record<AiBaseMethodName, AiMethodPatch>>","DATASET_DECLARATION_PATCHES: Partial<Record<string, AiBlockPatch>>","collected: string[]","matrix","tree","canonicalPatterns: string[]","rendered: string[]"],"sources":["../src/dataset.ts","../src/format.ts","../src/generator/core.ts","../src/generator/numbers.ts","../src/generator/strings.ts","../src/generator/arrays.ts","../src/generator/datetime.ts","../src/generator/geometry.ts","../src/generator/graphs.ts","../src/generator/base.ts","../src/generator/debug.ts","../src/generator/index.ts","../src/generator/factory.ts","../package.json","../src/language.ts","../src/i18n.ts","../src/execution.ts","../src/dataset-runner.ts","../src/ai-contract.generated.ts","../src/ai-contract.ts"],"sourcesContent":["import type { FormatDocument, FormatNode } from './format';\nimport type { DatasetGenerator, SeedInput } from './generator/factory';\nimport type { OjProfile } from './types';\n\nexport type MaybePromise<T> = T | Promise<T>;\n\nexport interface DatasetGenerateContext {\n  caseIndex: number;\n  caseNumber: number;\n  caseName: string;\n  repeatIndex: number;\n  seed: string;\n  g: DatasetGenerator;\n}\n\nexport interface DatasetValidationContext {\n  caseIndex: number;\n  caseNumber: number;\n  caseName: string;\n  repeatIndex: number;\n  tags: string[];\n  seed: string;\n  formattedInput: string;\n}\n\nexport interface DatasetValidationResult {\n  ok: boolean;\n  reason?: string;\n}\n\nexport type DatasetValidationReturn =\n  | void\n  | boolean\n  | string\n  | DatasetValidationResult;\n\nexport interface DatasetStaticCase<TInput> {\n  name: string;\n  tags?: string[];\n  input: TInput;\n  generate?: never;\n  repeat?: never;\n}\n\nexport interface DatasetGeneratedCase<TInput> {\n  name: string;\n  tags?: string[];\n  repeat?: number;\n  generate(ctx: DatasetGenerateContext): MaybePromise<TInput>;\n  input?: never;\n}\n\nexport type DatasetCase<TInput> = DatasetStaticCase<TInput> | DatasetGeneratedCase<TInput>;\n\nexport interface DatasetConfig<TInput> {\n  solution: string;\n  outputDir?: string;\n  seed: SeedInput;\n  startFrom?: number;\n  runTimeoutMs?: number;\n  caseConcurrency?: number;\n  compiler?: string;\n  compilerFlags?: string[];\n  ojProfile?: OjProfile;\n  stackSizeBytes?: number;\n  manifestPath?: string | false;\n  format(input: TInput): FormatDocument | FormatNode;\n  validate?(\n    input: TInput,\n    context: DatasetValidationContext,\n  ): MaybePromise<DatasetValidationReturn>;\n  cases: DatasetCase<TInput>[];\n}\n\nexport interface Dataset<TInput = unknown> {\n  readonly __genesisDataset: 2;\n  readonly config: DatasetConfig<TInput>;\n}\n\nexport function defineDataset<TInput>(config: DatasetConfig<TInput>): Dataset<TInput> {\n  return {\n    __genesisDataset: 2,\n    config,\n  };\n}\n\nexport function isDataset(value: unknown): value is Dataset {\n  return Boolean(\n    value\n      && typeof value === 'object'\n      && (value as { __genesisDataset?: unknown }).__genesisDataset === 2\n      && typeof (value as { config?: unknown }).config === 'object',\n  );\n}\n","export type FormatAtom = string | number | bigint | boolean | null | undefined;\n\nexport interface FormatLine {\n  readonly kind: 'line';\n  readonly items: readonly FormatAtom[];\n}\n\nexport interface FormatTable {\n  readonly kind: 'table';\n  readonly rows: readonly (readonly FormatAtom[])[];\n}\n\nexport interface FormatGrid {\n  readonly kind: 'grid';\n  readonly rows: readonly (string | readonly FormatAtom[])[];\n}\n\nexport interface FormatRaw {\n  readonly kind: 'raw';\n  readonly text: string;\n}\n\nexport type FormatNode = FormatLine | FormatTable | FormatGrid | FormatRaw;\n\nexport interface FormatDocument {\n  readonly __genesisFormat: 2;\n  readonly nodes: readonly FormatNode[];\n}\n\nexport const fmt = {\n  line(...items: FormatAtom[]): FormatLine {\n    return { kind: 'line', items };\n  },\n\n  lines(...rows: (FormatNode | readonly FormatAtom[] | FormatAtom)[]): FormatDocument {\n    return createFormatDocument(rows.map(row => normalizeRow(row)));\n  },\n\n  table(rows: readonly (readonly FormatAtom[])[]): FormatTable {\n    return { kind: 'table', rows };\n  },\n\n  grid(rows: readonly (string | readonly FormatAtom[])[]): FormatGrid {\n    return { kind: 'grid', rows };\n  },\n\n  raw(text: string): FormatRaw {\n    return { kind: 'raw', text };\n  },\n} as const;\n\nexport function createFormatDocument(nodes: readonly FormatNode[]): FormatDocument {\n  return { __genesisFormat: 2, nodes };\n}\n\nexport function isFormatNode(value: unknown): value is FormatNode {\n  if (!value || typeof value !== 'object') return false;\n  const kind = (value as { kind?: unknown }).kind;\n  return kind === 'line' || kind === 'table' || kind === 'grid' || kind === 'raw';\n}\n\nexport function isFormatDocument(value: unknown): value is FormatDocument {\n  return Boolean(\n    value\n      && typeof value === 'object'\n      && (value as { __genesisFormat?: unknown }).__genesisFormat === 2\n      && Array.isArray((value as { nodes?: unknown }).nodes)\n      && (value as FormatDocument).nodes.every(isFormatNode),\n  );\n}\n\nexport function normalizeFormat(value: unknown): FormatDocument {\n  if (isFormatDocument(value)) return value;\n  if (isFormatNode(value)) return createFormatDocument([value]);\n  throw new Error('Dataset format() must return a v2 format document created with fmt.*.');\n}\n\nexport function renderFormatDocument(document: FormatDocument | FormatNode): string {\n  const normalized = isFormatDocument(document) ? document : createFormatDocument([document]);\n  return normalized.nodes.map(renderNode).join('\\n');\n}\n\nfunction normalizeRow(row: FormatNode | readonly FormatAtom[] | FormatAtom): FormatNode {\n  if (isFormatNode(row)) return row;\n  if (Array.isArray(row)) return fmt.line(...row);\n  return fmt.line(row as FormatAtom);\n}\n\nfunction renderNode(node: FormatNode): string {\n  switch (node.kind) {\n    case 'line':\n      return node.items.map(renderAtom).join(' ');\n    case 'table':\n      return node.rows.map(row => row.map(renderAtom).join(' ')).join('\\n');\n    case 'grid':\n      return node.rows.map(row => Array.isArray(row) ? row.map(renderAtom).join('') : row).join('\\n');\n    case 'raw':\n      return node.text;\n  }\n}\n\nfunction renderAtom(value: FormatAtom): string {\n  return value == null ? '' : String(value);\n}\n","// src/generator/core.ts\n// 核心基础函数 — 单例导出，其他模块直接 import\n\nimport { AsyncLocalStorage } from 'node:async_hooks';\nimport { chunk as esChunk } from 'es-toolkit';\n\nexport type RandomSource = () => number;\n\nconst MAX_RANDOM = 1 - Number.EPSILON;\nlet randomSource: RandomSource = Math.random;\nconst scopedRandomSource = new AsyncLocalStorage<RandomSource>();\n\nfunction normalizedRandom(value: number): number {\n    if (!Number.isFinite(value)) return 0;\n    if (value <= 0) return 0;\n    if (value >= 1) return MAX_RANDOM;\n    return value;\n}\n\n/**\n * 注入随机源（返回值应位于 [0, 1)）。\n */\nexport function withRng(rng: RandomSource): void {\n    if (typeof rng !== 'function') {\n        throw new Error('Random source must be a function.');\n    }\n    randomSource = rng;\n}\n\n/**\n * 重置为默认随机源 Math.random。\n */\nexport function resetRng(): void {\n    randomSource = Math.random;\n}\n\n/**\n * Run a synchronous or async callback with an isolated random source.\n * This is used by v2 generator instances so per-case RNG does not mutate the\n * legacy process-global G random source.\n */\nexport function runWithRng<T>(rng: RandomSource, callback: () => T): T {\n    if (typeof rng !== 'function') {\n        throw new Error('Random source must be a function.');\n    }\n    return scopedRandomSource.run(rng, callback);\n}\n\n/**\n * 获取 [0, 1) 随机小数。\n */\nexport function rand(): number {\n    const source = scopedRandomSource.getStore() ?? randomSource;\n    return normalizedRandom(source());\n}\n\n/**\n * 生成 [min, max] 范围内的随机整数\n */\nexport function int(min: number, max: number): number {\n    min = Math.ceil(min);\n    max = Math.floor(max);\n    return Math.floor(rand() * (max - min + 1)) + min;\n}\n\n/**\n * 随机打乱数组\n */\nexport function shuffle<T>(array: readonly T[]): T[] {\n    const result = [...array];\n    return shuffleInPlace(result);\n}\n\n/**\n * In-place Fisher-Yates shuffle for mutable arrays.\n */\nexport function shuffleInPlace<T>(array: T[]): T[] {\n    const result = array;\n    for (let i = result.length - 1; i > 0; i--) {\n        const j = int(0, i);\n        [result[i], result[j]] = [result[j], result[i]];\n    }\n    return result;\n}\n\n/**\n * 随机采样\n */\nexport function sample<T>(population: readonly T[]): T;\nexport function sample<T>(population: readonly T[], k: number): T[];\nexport function sample<T>(population: readonly T[], k?: number): T | T[] {\n    if (k === undefined) {\n        if (population.length === 0) throw new Error('Cannot sample from an empty array.');\n        return population[int(0, population.length - 1)]!;\n    }\n    if (k < 0) {\n        throw new Error('Sample size cannot be negative.');\n    }\n    if (k > population.length) {\n        throw new Error(`Sample size ${k} exceeds population size ${population.length}.`);\n    }\n    if (k === 0) return [];\n    if (k === population.length) return shuffle(population);\n\n    const indices = Array.from({ length: population.length }, (_, i) => i);\n    for (let i = 0; i < k; i++) {\n        const j = i + int(0, population.length - i - 1);\n        [indices[i], indices[j]] = [indices[j], indices[i]];\n    }\n    return indices.slice(0, k).map(i => population[i]!);\n}\n\n/**\n * 数组分块\n */\nexport function chunk<T>(array: readonly T[], size: number): T[][] {\n    return esChunk(array, size);\n}\n\n// 为了兼容旧代码，保留 core 对象形式\nexport const core = { int, shuffle, shuffleInPlace, sample, rand, withRng, resetRng, runWithRng };\n","// src/generator/numbers.ts\n// 数值生成模块 — 静态导出\n\nimport * as core from './core';\n\n// 增量质数缓存（按最大上界复用）\nlet primeCacheMax = 1;\nconst primeCache: number[] = [];\n\nfunction isPrimeByCache(candidate: number): boolean {\n    const limit = Math.floor(Math.sqrt(candidate));\n    for (const p of primeCache) {\n        if (p > limit) break;\n        if (candidate % p === 0) return false;\n    }\n    return true;\n}\n\nfunction ensurePrimesUpTo(max: number): void {\n    if (max <= primeCacheMax) return;\n    const start = Math.max(2, primeCacheMax + 1);\n    for (let n = start; n <= max; n++) {\n        if (isPrimeByCache(n)) {\n            primeCache.push(n);\n        }\n    }\n    primeCacheMax = max;\n}\n\nfunction lowerBound(arr: number[], target: number): number {\n    let l = 0;\n    let r = arr.length;\n    while (l < r) {\n        const mid = (l + r) >> 1;\n        if (arr[mid] < target) l = mid + 1;\n        else r = mid;\n    }\n    return l;\n}\n\n// GCD\nfunction gcd(a: number, b: number): number {\n    while (b !== 0) {\n        [a, b] = [b, a % b];\n    }\n    return a;\n}\n\n// 数列生成选项\nexport type SequenceOptions =\n    | { type: 'arithmetic'; start: number; diff: number; count: number }\n    | { type: 'geometric'; start: number; ratio: number; count: number }\n    | { type: 'fibonacci'; count: number; first?: number; second?: number }\n    | { type: 'custom'; init: number[]; fn: (prev: number[]) => number; count: number };\n\n// ============ 静态导出函数 ============\n\nexport const int = core.int;\n\nexport function ints(count: number, min: number, max: number): number[] {\n    return Array.from({ length: count }, () => core.int(min, max));\n}\n\nexport function distinctInts(count: number, min: number, max: number): number[] {\n    const range = max - min + 1;\n    if (count > range) {\n        throw new Error(`Cannot generate ${count} distinct integers from a range of size ${range}.`);\n    }\n\n    if (count <= 0) return [];\n\n    // 高占比场景使用局部 Fisher-Yates，避免反复撞值\n    const DENSE_RATIO = 0.6;\n    const MAX_POOL_SIZE = 2_000_000;\n    if (range <= MAX_POOL_SIZE && count / range >= DENSE_RATIO) {\n        const pool = Array.from({ length: range }, (_, i) => min + i);\n        for (let i = 0; i < count; i++) {\n            const j = i + core.int(0, range - i - 1);\n            [pool[i], pool[j]] = [pool[j], pool[i]];\n        }\n        return pool.slice(0, count);\n    }\n\n    const values = new Set<number>();\n    while (values.size < count) values.add(core.int(min, max));\n    return Array.from(values);\n}\n\nexport function float(min: number, max: number, precision = 2): number {\n    const value = core.rand() * (max - min) + min;\n    return parseFloat(value.toFixed(precision));\n}\n\nexport function even(min: number, max: number): number {\n    const start = min % 2 === 0 ? min : min + 1;\n    const end = max % 2 === 0 ? max : max - 1;\n    if (start > end) throw new Error(`No even numbers exist in the range [${min}, ${max}].`);\n    const numChoices = (end - start) / 2;\n    return start + core.int(0, numChoices) * 2;\n}\n\nexport function odd(min: number, max: number): number {\n    const start = min % 2 !== 0 ? min : min + 1;\n    const end = max % 2 !== 0 ? max : max - 1;\n    if (start > end) throw new Error(`No odd numbers exist in the range [${min}, ${max}].`);\n    const numChoices = (end - start) / 2;\n    return start + core.int(0, numChoices) * 2;\n}\n\nexport function prime(min: number, max: number): number {\n    ensurePrimesUpTo(max);\n    const start = lowerBound(primeCache, min);\n    if (start >= primeCache.length || primeCache[start] > max) {\n        throw new Error(`No prime numbers exist in the range [${min}, ${max}].`);\n    }\n\n    let end = lowerBound(primeCache, max + 1) - 1;\n    if (end < start) {\n        throw new Error(`No prime numbers exist in the range [${min}, ${max}].`);\n    }\n    return primeCache[core.int(start, end)]!;\n}\n\nexport function coprime(min: number, max: number): [number, number] {\n    for (let attempt = 0; attempt < 1000; attempt++) {\n        const a = core.int(min, max);\n        const b = core.int(min, max);\n        if (a !== b && gcd(a, b) === 1) {\n            return [a, b];\n        }\n    }\n    return [1, core.int(Math.max(2, min), max)];\n}\n\nexport function divisible(min: number, max: number, d: number): number {\n    if (d === 0) throw new Error('Divisor cannot be zero.');\n    const start = Math.ceil(min / d) * d;\n    const end = Math.floor(max / d) * d;\n    if (start > end) {\n        throw new Error(`No numbers divisible by ${d} exist in the range [${min}, ${max}].`);\n    }\n    const count = (end - start) / d;\n    return start + core.int(0, count) * d;\n}\n\nexport function sequence(options: SequenceOptions): number[] {\n    switch (options.type) {\n        case 'arithmetic': {\n            const { start, diff, count } = options;\n            return Array.from({ length: count }, (_, i) => start + i * diff);\n        }\n        case 'geometric': {\n            const { start, ratio, count } = options;\n            return Array.from({ length: count }, (_, i) => start * Math.pow(ratio, i));\n        }\n        case 'fibonacci': {\n            const { count, first = 1, second = 1 } = options;\n            if (count <= 0) return [];\n            if (count === 1) return [first];\n            const result = [first, second];\n            for (let i = 2; i < count; i++) {\n                result.push(result[i - 1] + result[i - 2]);\n            }\n            return result;\n        }\n        case 'custom': {\n            const { init, fn, count } = options;\n            if (count <= init.length) return init.slice(0, count);\n            const result = [...init];\n            for (let i = init.length; i < count; i++) {\n                result.push(fn(result));\n            }\n            return result;\n        }\n    }\n}\n","// src/generator/strings.ts\n// 字符串生成模块 — 静态导出\n\nimport * as core from './core';\n\nexport const CHARSET = {\n    LOWERCASE: 'abcdefghijklmnopqrstuvwxyz',\n    UPPERCASE: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',\n    DIGITS: '0123456789',\n    get ALPHANUMERIC() { return this.LOWERCASE + this.UPPERCASE + this.DIGITS; },\n    get ALPHA() { return this.LOWERCASE + this.UPPERCASE; },\n    get BASE36() { return this.DIGITS + this.UPPERCASE; },\n} as const;\n\n// ============ 静态导出函数 ============\n\nexport function string(len: number, charset = CHARSET.ALPHANUMERIC): string {\n    let result = '';\n    for (let i = 0; i < len; i++) {\n        result += charset.charAt(core.int(0, charset.length - 1));\n    }\n    return result;\n}\n\nexport function palindrome(len: number, charset = CHARSET.LOWERCASE): string {\n    if (len <= 0) return '';\n    const halfLen = Math.floor(len / 2);\n    const left = string(halfLen, charset);\n    const right = left.split('').reverse().join('');\n    if (len % 2 === 1) {\n        const mid = core.sample(charset.split(''));\n        return left + mid + right;\n    }\n    return left + right;\n}\n\nexport function word(minLen: number, maxLen: number): string {\n    return string(core.int(minLen, maxLen), CHARSET.LOWERCASE);\n}\n\nexport function words(count: number, minLen: number, maxLen: number): string[] {\n    return Array.from({ length: count }, () => word(minLen, maxLen));\n}\n\nexport function brackets(n: number, options: { types?: string } = {}): string {\n    const { types = '()' } = options;\n    const pairs: [string, string][] = [];\n    if (types.includes('()')) pairs.push(['(', ')']);\n    if (types.includes('[]')) pairs.push(['[', ']']);\n    if (types.includes('{}')) pairs.push(['{', '}']);\n    if (pairs.length === 0) pairs.push(['(', ')']);\n\n    const result: string[] = [];\n    const stack: [string, string][] = [];\n\n    for (let i = 0; i < n; i++) {\n        const pair = pairs[core.int(0, pairs.length - 1)];\n        result.push(pair[0]);\n        stack.push(pair);\n    }\n\n    while (stack.length > 0) {\n        const idx = core.int(0, stack.length - 1);\n        const pair = stack.splice(idx, 1)[0];\n        result.push(pair[1]);\n    }\n\n    return result.join('');\n}\n","// src/generator/arrays.ts\n// 数组/矩阵生成模块 — 静态导出\n\nimport * as core from './core';\nimport * as numbers from './numbers';\n\n// ============ 静态导出函数 ============\n\nexport function array<T>(count: number, itemGenerator: (index: number) => T): T[] {\n    return Array.from({ length: count }, (_, i) => itemGenerator(i));\n}\n\nexport function sorted(count: number, min: number, max: number, options: { order?: 'asc' | 'desc' | 'strictlyAsc' | 'strictlyDesc' } = {}): number[] {\n    const { order = 'asc' } = options;\n    if (order === 'strictlyAsc' || order === 'strictlyDesc') {\n        const nums = numbers.distinctInts(count, min, max);\n        return nums.sort((a, b) => order === 'strictlyAsc' ? a - b : b - a);\n    }\n    const nums = numbers.ints(count, min, max);\n    return nums.sort((a, b) => order === 'asc' ? a - b : b - a);\n}\n\nexport function sparse(count: number, min: number, max: number, gap: number): number[] {\n    if ((count - 1) * gap > max - min) {\n        throw new Error(`Cannot generate ${count} sparse numbers with gap ${gap} in range [${min}, ${max}]. Range is too small.`);\n    }\n    const baseValues = sorted(count, 0, max - min - (count - 1) * gap);\n    const sparseValues = baseValues.map((val, i) => min + val + i * gap);\n    return core.shuffleInPlace(sparseValues);\n}\n\nexport function partition(count: number, sum: number, options: { minVal?: number } = {}): number[] {\n    const { minVal = 1 } = options;\n    if (count * minVal > sum) {\n        throw new Error(`Cannot partition sum ${sum} into ${count} parts with minVal ${minVal}. Required sum is at least ${count * minVal}.`);\n    }\n    const adjustedSum = sum - count * minVal;\n    const cuts = sorted(count - 1, 0, adjustedSum);\n    const points = [0, ...cuts, adjustedSum];\n    const parts: number[] = [];\n    for (let i = 0; i < count; i++) {\n        parts.push(points[i + 1] - points[i] + minVal);\n    }\n    return core.shuffleInPlace(parts);\n}\n\nexport function matrix<T>(rows: number, cols: number, cellGenerator: (r: number, c: number) => T): T[][] {\n    return Array.from({ length: rows }, (_, i) =>\n        Array.from({ length: cols }, (__, j) => cellGenerator(i, j))\n    );\n}\n\nexport function grid01(rows: number, cols: number, density = 0.5): number[][] {\n    return matrix(rows, cols, () => core.rand() < density ? 1 : 0);\n}\n\nexport function maze(rows: number, cols: number, options: { wall?: string; road?: string } = {}): string[][] {\n    const { wall = '#', road = '.' } = options;\n    const grid = Array.from({ length: rows }, () => Array(cols).fill(wall));\n    const visited = Array.from({ length: rows }, () => Array(cols).fill(false));\n    const stack: [number, number][] = [];\n\n    const startR = 1, startC = 1;\n    if (startR >= rows || startC >= cols) return grid;\n\n    grid[startR][startC] = road;\n    visited[startR][startC] = true;\n    stack.push([startR, startC]);\n\n    while (stack.length > 0) {\n        const [r, c] = stack.pop()!;\n        const dirs = core.shuffle([[-2, 0], [2, 0], [0, -2], [0, 2]]);\n\n        for (const [dr, dc] of dirs) {\n            const nr = r + dr, nc = c + dc;\n            if (nr > 0 && nr < rows - 1 && nc > 0 && nc < cols - 1 && !visited[nr][nc]) {\n                grid[r + dr / 2][c + dc / 2] = road;\n                grid[nr][nc] = road;\n                visited[nr][nc] = true;\n                stack.push([r, c]);\n                stack.push([nr, nc]);\n                break;\n            }\n        }\n    }\n    return grid;\n}\n\nfunction allocateWithCap(total: number, slots: number, cap: number): number[] {\n    const result = new Array<number>(slots).fill(0);\n    let remain = total;\n    for (let i = 0; i < slots; i++) {\n        const maxRest = (slots - i - 1) * cap;\n        const low = Math.max(0, remain - maxRest);\n        const high = Math.min(cap, remain);\n        const val = core.int(low, high);\n        result[i] = val;\n        remain -= val;\n    }\n    return core.shuffle(result);\n}\n\nexport function intervals(n: number, min: number, max: number, options: { overlapping?: boolean; sorted?: boolean; minLen?: number; maxLen?: number; allowGaps?: boolean } = {}): number[][] {\n    const { overlapping = true, sorted: shouldSort = false, minLen = 1, maxLen = max - min, allowGaps = false } = options;\n    const result: number[][] = [];\n    if (n <= 0) return result;\n\n    if (overlapping) {\n        const upperLen = Math.min(maxLen, max - min + 1);\n        if (minLen < 1 || upperLen < minLen) {\n            throw new Error(`Cannot generate intervals in range [${min}, ${max}] with minLen=${minLen}, maxLen=${maxLen}.`);\n        }\n        for (let i = 0; i < n; i++) {\n            const len = core.int(minLen, upperLen);\n            const l = core.int(min, max - len + 1);\n            result.push([l, l + len - 1]);\n        }\n    } else {\n        const totalMinSpace = n * minLen;\n        if (totalMinSpace > max - min + 1) {\n            throw new Error(`Cannot generate ${n} non-overlapping intervals in range [${min}, ${max}].`);\n        }\n\n        if (!allowGaps) {\n            const gaps = max - min + 1 - totalMinSpace;\n            const extraLens = partition(n, gaps, { minVal: 0 });\n            let current = min;\n            for (let i = 0; i < n; i++) {\n                const len = minLen + extraLens[i];\n                result.push([current, current + len - 1]);\n                current += len;\n            }\n            return shouldSort ? result : core.shuffle(result);\n        }\n\n        const totalSpace = max - min + 1;\n        const maxExtraPerInterval = Math.max(0, maxLen - minLen);\n        const maxUsableLength = totalMinSpace + n * maxExtraPerInterval;\n        const chosenLength = Math.min(totalSpace, maxUsableLength);\n        const extraLength = chosenLength - totalMinSpace;\n\n        if (extraLength < 0) {\n            throw new Error(`Cannot generate ${n} non-overlapping intervals in range [${min}, ${max}] with minLen=${minLen}.`);\n        }\n\n        const extraLens = allocateWithCap(extraLength, n, maxExtraPerInterval);\n        const lengths = extraLens.map(v => minLen + v);\n\n        const gapTotal = totalSpace - lengths.reduce((acc, len) => acc + len, 0);\n        const gaps = partition(n + 1, gapTotal, { minVal: 0 });\n\n        let current = min + gaps[0];\n        for (let i = 0; i < n; i++) {\n            const len = lengths[i];\n            const l = current;\n            const r = l + len - 1;\n            result.push([l, r]);\n            current = r + 1 + gaps[i + 1];\n        }\n        return shouldSort ? result : core.shuffle(result);\n    }\n\n    return shouldSort ? result.sort((a, b) => a[0] - b[0]) : result;\n}\n\nexport function permutation(n: number, oneBased = true): number[] {\n    const arr = Array.from({ length: n }, (_, i) => (oneBased ? i + 1 : i));\n    return core.shuffleInPlace(arr);\n}\n\nexport { chunk } from './core';\n","// src/generator/datetime.ts\n// 日期时间生成模块 — 静态导出\n\nimport * as core from './core';\n\n// ============ 静态导出函数 ============\n\nexport function isLeap(year: number): boolean {\n    return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n}\n\nexport function year(minYear = 1970, maxYear = new Date().getFullYear()): number {\n    return core.int(minYear, maxYear);\n}\n\nexport function date(options: { minYear?: number; maxYear?: number; format?: string } = {}): string {\n    const { minYear = 1970, maxYear = new Date().getFullYear(), format = 'YYYY-MM-DD' } = options;\n    const y = year(minYear, maxYear);\n    const month = core.int(1, 12);\n    const days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n    if (isLeap(y)) days[1] = 29;\n    const day = core.int(1, days[month - 1]!);\n    return format\n        .replace('YYYY', String(y))\n        .replace('MM', String(month).padStart(2, '0'))\n        .replace('DD', String(day).padStart(2, '0'));\n}\n","// src/generator/geometry.ts\n// 几何生成模块 — 静态导出\n\nimport * as core from './core';\nimport { float } from './numbers';\n\n// ============ 静态导出函数 ============\n\nexport function points(n: number, minVal: number, maxVal: number, options: { type?: 'random' | 'collinear' } = {}): number[][] {\n    const { type = 'random' } = options;\n\n    if (type === 'random') {\n        const range = maxVal - minVal + 1;\n        const maxPossible = range * range;\n        const target = Math.min(n, maxPossible);\n        const DENSE_RATIO = 0.65;\n        const MAX_POOL_SIZE = 1_000_000;\n\n        if (maxPossible <= MAX_POOL_SIZE && target / maxPossible >= DENSE_RATIO) {\n            // 接近满网格时改用池采样，避免 set 去重退化\n            const pool = Array.from({ length: maxPossible }, (_, i) => i);\n            for (let i = 0; i < target; i++) {\n                const j = i + core.int(0, maxPossible - i - 1);\n                [pool[i], pool[j]] = [pool[j], pool[i]];\n            }\n\n            return pool.slice(0, target).map(idx => {\n                const x = minVal + Math.floor(idx / range);\n                const y = minVal + (idx % range);\n                return [x, y];\n            });\n        }\n\n        const pointSet = new Set<string>();\n        while (pointSet.size < target) {\n            pointSet.add(`${core.int(minVal, maxVal)},${core.int(minVal, maxVal)}`);\n        }\n        return Array.from(pointSet).map(p => p.split(',').map(Number));\n    }\n\n    if (type === 'collinear') {\n        if (n <= 1) return points(n, minVal, maxVal);\n        for (let attempt = 0; attempt < 50; attempt++) {\n            let dx: number, dy: number;\n            do {\n                dx = core.int(-10, 10);\n                dy = core.int(-10, 10);\n            } while (dx === 0 && dy === 0);\n\n            const x0_min = dx >= 0 ? minVal : minVal - (n - 1) * dx;\n            const x0_max = dx >= 0 ? maxVal - (n - 1) * dx : maxVal;\n            const y0_min = dy >= 0 ? minVal : minVal - (n - 1) * dy;\n            const y0_max = dy >= 0 ? maxVal - (n - 1) * dy : maxVal;\n\n            if (x0_min <= x0_max && y0_min <= y0_max) {\n                const x0 = core.int(x0_min, x0_max);\n                const y0 = core.int(y0_min, y0_max);\n                return core.shuffle(Array.from({ length: n }, (_, i) => [x0 + i * dx, y0 + i * dy]));\n            }\n        }\n        return points(n, minVal, maxVal);\n    }\n    return [];\n}\n\nexport function convexHull(n: number, minVal: number, maxVal: number): number[][] {\n    if (n < 3) return points(n, minVal, maxVal);\n\n    const angles: number[] = [];\n    for (let i = 0; i < n; i++) {\n        angles.push(float(0, 2 * Math.PI, 6));\n    }\n    angles.sort((a, b) => a - b);\n\n    const cx = (minVal + maxVal) / 2;\n    const cy = (minVal + maxVal) / 2;\n    const maxR = (maxVal - minVal) / 2 * 0.9;\n    const minR = maxR * 0.3;\n\n    const result: number[][] = [];\n    for (const angle of angles) {\n        const r = float(minR, maxR, 2);\n        const x = Math.max(minVal, Math.min(maxVal, Math.round(cx + r * Math.cos(angle))));\n        const y = Math.max(minVal, Math.min(maxVal, Math.round(cy + r * Math.sin(angle))));\n        result.push([x, y]);\n    }\n\n    const unique = Array.from(\n        new Set(result.map(p => `${p[0]},${p[1]}`))\n    ).map(s => s.split(',').map(Number));\n\n    while (unique.length < n) {\n        const angle = float(0, 2 * Math.PI, 6);\n        const r = float(minR, maxR, 2);\n        const x = Math.max(minVal, Math.min(maxVal, Math.round(cx + r * Math.cos(angle))));\n        const y = Math.max(minVal, Math.min(maxVal, Math.round(cy + r * Math.sin(angle))));\n        const key = `${x},${y}`;\n        if (!unique.some(p => `${p[0]},${p[1]}` === key)) {\n            unique.push([x, y]);\n        }\n    }\n    return unique.slice(0, n);\n}\n\nexport function polygon(n: number, minVal: number, maxVal: number): number[][] {\n    if (n < 3) return points(n, minVal, maxVal);\n\n    // 生成 n 个随机点\n    const pts = points(n, minVal, maxVal);\n\n    // 计算重心\n    const cx = pts.reduce((sum, p) => sum + p[0], 0) / n;\n    const cy = pts.reduce((sum, p) => sum + p[1], 0) / n;\n\n    // 按极角排序形成简单多边形\n    return pts.sort((a, b) => {\n        const angleA = Math.atan2(a[1] - cy, a[0] - cx);\n        const angleB = Math.atan2(b[1] - cy, b[0] - cx);\n        return angleA - angleB;\n    });\n}\n","// src/generator/graphs.ts\n// 图论生成模块 — 静态导出\n\nimport * as core from './core';\nimport * as arrays from './arrays';\nimport type { TreeOptions, GraphOptions, BinaryTreeOptions } from '../types';\n\n// ============ 静态导出函数 ============\n\nexport function tree(n: number, options: TreeOptions = {}): number[][] {\n    const { type = 'random', oneBased = true, weighted = false } = options;\n    if (n <= 1) return [];\n\n    const edges: number[][] = [];\n\n    if (type === 'path') {\n        const nodes = arrays.permutation(n, false);\n        for (let i = 0; i < n - 1; i++) edges.push([nodes[i], nodes[i + 1]]);\n    } else if (type === 'star') {\n        const nodes = arrays.permutation(n, false);\n        for (let i = 1; i < n; i++) edges.push([nodes[0], nodes[i]]);\n    } else {\n        const nodes = arrays.permutation(n, false);\n        for (let i = 1; i < n; i++) edges.push([nodes[i], nodes[core.int(0, i - 1)]]);\n    }\n\n    const result = core.shuffleInPlace(edges);\n    if (weighted) {\n        const [minW, maxW] = Array.isArray(weighted) ? weighted : [1, 1_000_000_000];\n        result.forEach(e => e.push(core.int(minW, maxW)));\n    }\n    if (oneBased) {\n        result.forEach(e => {\n            e[0] += 1;\n            e[1] += 1;\n        });\n    }\n    return result;\n}\n\nexport function graph(n: number, m: number, options: GraphOptions = {}): number[][] {\n    const {\n        type = 'simple',\n        weighted = false,\n        connected = false,\n        noSelfLoops = true,\n        oneBased = true,\n        negativeCycle = false\n    } = options;\n\n    let { directed = false } = options;\n    if (type === 'dag' && options.directed === undefined) directed = true;\n    if (negativeCycle && type === 'dag') {\n        throw new Error(\"Option 'negativeCycle' cannot be used with DAG graphs.\");\n    }\n\n    if (n <= 0) return [];\n\n    // 轮图\n    if (type === 'wheel') {\n        if (n < 4) throw new Error('Wheel graph requires at least 4 vertices.');\n        const edges: number[][] = [];\n        for (let i = 1; i < n; i++) edges.push([0, i]);\n        for (let i = 1; i < n; i++) edges.push([i, i === n - 1 ? 1 : i + 1]);\n        let result = edges;\n        if (weighted) {\n            const [minW, maxW] = Array.isArray(weighted) ? weighted : [1, 1e9];\n            result.forEach(e => e.push(core.int(minW, maxW)));\n        }\n        if (oneBased) result = result.map(e => e.map((v, i) => i < 2 ? v + 1 : v));\n        return core.shuffleInPlace(result);\n    }\n\n    // 完全图\n    if (type === 'complete') {\n        const edges: number[][] = [];\n        for (let i = 0; i < n; i++) {\n            for (let j = i + 1; j < n; j++) {\n                edges.push([i, j]);\n                if (directed) edges.push([j, i]);\n            }\n        }\n        let result = edges;\n        if (weighted) {\n            const [minW, maxW] = Array.isArray(weighted) ? weighted : [1, 1e9];\n            result.forEach(e => e.push(core.int(minW, maxW)));\n        }\n        if (oneBased) result = result.map(e => e.map((v, i) => i < 2 ? v + 1 : v));\n        return core.shuffleInPlace(result);\n    }\n\n    // 树\n    if (type === 'tree') {\n        if (m !== n - 1) throw new Error(`A tree with ${n} vertices must have ${n - 1} edges.`);\n        return tree(n, { oneBased, weighted });\n    }\n\n    // 边数检查\n    if (connected && m < n - 1) {\n        throw new Error(`A connected graph needs at least ${n - 1} edges.`);\n    }\n\n    let maxEdges: number;\n    if (type === 'dag') {\n        maxEdges = n * (n - 1) / 2;\n    } else if (type === 'bipartite') {\n        const h = Math.floor(n / 2);\n        maxEdges = h * (n - h) * (directed ? 2 : 1);\n    } else {\n        maxEdges = directed\n            ? (noSelfLoops ? n * (n - 1) : n * n)\n            : (noSelfLoops ? n * (n - 1) / 2 : n * (n + 1) / 2);\n    }\n\n    if (m > maxEdges) {\n        throw new Error(`Graph with ${n} vertices of type '${type}' (directed: ${directed}) can have at most ${maxEdges} edges. Requested: ${m}.`);\n    }\n\n    const edgeSet = new Set<string>();\n    const toEdgeKey = (u: number, v: number): string =>\n        directed ? `${u},${v}` : `${Math.min(u, v)},${Math.max(u, v)}`;\n    const addEdge = (u: number, v: number) => {\n        if (noSelfLoops && u === v) return false;\n        const key = toEdgeKey(u, v);\n        if (edgeSet.has(key)) return false;\n        edgeSet.add(key);\n        return true;\n    };\n\n    const fillEdges = (\n        randomEdge: () => [number, number],\n        enumerateCandidates: () => [number, number][]\n    ) => {\n        let failedAttempts = 0;\n        const maxFailedAttempts = Math.max(2_000, (m - edgeSet.size) * 25);\n\n        while (edgeSet.size < m) {\n            const [u, v] = randomEdge();\n            const sizeBefore = edgeSet.size;\n            addEdge(u, v);\n\n            if (edgeSet.size === sizeBefore) {\n                failedAttempts++;\n                if (failedAttempts >= maxFailedAttempts) {\n                    // 稠密场景下切换到候选边池采样，避免重复碰撞导致退化\n                    const candidates = enumerateCandidates()\n                        .filter(([cu, cv]) => !edgeSet.has(toEdgeKey(cu, cv)));\n                    const remain = m - edgeSet.size;\n\n                    if (remain > candidates.length) {\n                        throw new Error('Not enough candidate edges to satisfy requested m.');\n                    }\n\n                    for (let i = 0; i < remain; i++) {\n                        const j = i + core.int(0, candidates.length - i - 1);\n                        [candidates[i], candidates[j]] = [candidates[j], candidates[i]];\n                        const [eu, ev] = candidates[i];\n                        addEdge(eu, ev);\n                    }\n                    return;\n                }\n            } else {\n                failedAttempts = 0;\n            }\n        }\n    };\n\n    // DAG\n    if (type === 'dag') {\n        const nodes = arrays.permutation(n, false);\n        if (connected) {\n            for (let i = 1; i < n; i++) addEdge(nodes[core.int(0, i - 1)], nodes[i]);\n        }\n        fillEdges(\n            () => {\n                const i1 = core.int(0, n - 1);\n                let i2 = core.int(0, n - 1);\n                while (i1 === i2) {\n                    i2 = core.int(0, n - 1);\n                }\n                return [nodes[Math.min(i1, i2)], nodes[Math.max(i1, i2)]];\n            },\n            () => {\n                const candidates: [number, number][] = [];\n                for (let i = 0; i < n; i++) {\n                    for (let j = i + 1; j < n; j++) {\n                        candidates.push([nodes[i], nodes[j]]);\n                    }\n                }\n                return candidates;\n            }\n        );\n    }\n    // 二分图\n    else if (type === 'bipartite') {\n        const nodes = arrays.permutation(n, false);\n        const C = directed ? 2 : 1;\n        const disc = n * n - 4 * m / C;\n        const sqrtD = Math.sqrt(Math.max(0, disc));\n        const validMin = Math.max(1, Math.ceil((n - sqrtD) / 2));\n        const validMax = Math.min(n - 1, Math.floor((n + sqrtD) / 2));\n        const ps = core.int(validMin, validMax);\n        const setA = nodes.slice(0, ps);\n        const setB = nodes.slice(ps);\n\n        if (connected) {\n            addEdge(setA[0], setB[0]);\n            for (const u of [...setA.slice(1), ...setB.slice(1)]) {\n                addEdge(u, setA.includes(u) ? core.sample(setB) : core.sample(setA));\n            }\n        }\n        fillEdges(\n            () => {\n                if (directed && core.int(0, 1) === 1) {\n                    return [core.sample(setB), core.sample(setA)];\n                }\n                return [core.sample(setA), core.sample(setB)];\n            },\n            () => {\n                const candidates: [number, number][] = [];\n                for (const u of setA) {\n                    for (const v of setB) {\n                        candidates.push([u, v]);\n                        if (directed) candidates.push([v, u]);\n                    }\n                }\n                return candidates;\n            }\n        );\n    }\n    // 普通图\n    else {\n        if (connected) {\n            tree(n, { type: 'random', oneBased: false }).forEach(([u, v]) => addEdge(u, v));\n        }\n        fillEdges(\n            () => [core.int(0, n - 1), core.int(0, n - 1)],\n            () => {\n                const candidates: [number, number][] = [];\n                if (directed) {\n                    for (let u = 0; u < n; u++) {\n                        for (let v = 0; v < n; v++) {\n                            if (noSelfLoops && u === v) continue;\n                            candidates.push([u, v]);\n                        }\n                    }\n                } else {\n                    for (let u = 0; u < n; u++) {\n                        const startV = noSelfLoops ? u + 1 : u;\n                        for (let v = startV; v < n; v++) {\n                            candidates.push([u, v]);\n                        }\n                    }\n                }\n                return candidates;\n            }\n        );\n    }\n\n    let result = Array.from(edgeSet).map(k => k.split(',').map(Number));\n\n    if (weighted || negativeCycle) {\n        const [minW, maxW] = Array.isArray(weighted) ? weighted : [1, 1e9];\n        const maxAbsWeight = Math.max(Math.abs(minW), Math.abs(maxW), 1);\n\n        result.forEach(e => e.push(core.int(minW, maxW)));\n\n        if (negativeCycle) {\n            if (result.length === 0) {\n                throw new Error(\"Option 'negativeCycle' requires at least one edge.\");\n            }\n\n            const edgeKey = (u: number, v: number): string =>\n                directed ? `${u},${v}` : `${Math.min(u, v)},${Math.max(u, v)}`;\n\n            const edgeIndex = new Map<string, number>();\n            result.forEach((e, idx) => edgeIndex.set(edgeKey(e[0], e[1]), idx));\n\n            const requiredCycle: [number, number][] = [];\n            if (directed) {\n                if (n === 1) {\n                    if (noSelfLoops) {\n                        throw new Error(\"Option 'negativeCycle' with directed graphs requires n >= 2 when self-loops are disabled.\");\n                    }\n                    requiredCycle.push([0, 0]);\n                } else if (n === 2) {\n                    requiredCycle.push([0, 1], [1, 0]);\n                } else {\n                    requiredCycle.push([0, 1], [1, 2], [2, 0]);\n                }\n            } else {\n                // In an undirected graph, a single negative edge can be traversed back and forth.\n                requiredCycle.push([result[0][0], result[0][1]]);\n            }\n\n            if (result.length < requiredCycle.length) {\n                throw new Error(`Option 'negativeCycle' requires at least ${requiredCycle.length} edges, but got ${result.length}.`);\n            }\n\n            const requiredKeys = new Set(requiredCycle.map(([u, v]) => edgeKey(u, v)));\n            const upsertEdge = (u: number, v: number): number => {\n                const key = edgeKey(u, v);\n                const existingIndex = edgeIndex.get(key);\n                if (existingIndex !== undefined) return existingIndex;\n\n                const replaceIndex = result.findIndex(e => !requiredKeys.has(edgeKey(e[0], e[1])));\n                const targetIndex = replaceIndex === -1 ? 0 : replaceIndex;\n                const oldKey = edgeKey(result[targetIndex][0], result[targetIndex][1]);\n                edgeIndex.delete(oldKey);\n                result[targetIndex][0] = u;\n                result[targetIndex][1] = v;\n                edgeIndex.set(key, targetIndex);\n                return targetIndex;\n            };\n\n            const cycleEdgeIndices = requiredCycle.map(([u, v]) => upsertEdge(u, v));\n            for (const idx of cycleEdgeIndices) {\n                result[idx][2] = -core.int(1, maxAbsWeight);\n            }\n        }\n    }\n\n    if (oneBased) {\n        result = result.map(e => e.map((v, i) => i < 2 ? v + 1 : v));\n    }\n    return core.shuffleInPlace(result);\n}\n\nexport function binaryTree(n: number, options: BinaryTreeOptions = {}): { edges: number[][]; root: number } {\n    const { type = 'random', oneBased = true } = options;\n    if (n <= 0) return { edges: [], root: oneBased ? 1 : 0 };\n\n    const offset = oneBased ? 1 : 0;\n    const edges: number[][] = [];\n    let root = offset;\n\n    if (type === 'complete') {\n        // 完全二叉树：节点 i 的左子节点是 2i+1，右子节点是 2i+2\n        for (let i = 0; i < n; i++) {\n            const left = 2 * i + 1;\n            const right = 2 * i + 2;\n            if (left < n) edges.push([i + offset, left + offset]);\n            if (right < n) edges.push([i + offset, right + offset]);\n        }\n    } else if (type === 'skewed') {\n        // 倾斜二叉树：每个节点只有一个子节点（随机左或右）\n        const nodes = arrays.permutation(n, false);\n        for (let i = 0; i < n - 1; i++) {\n            edges.push([nodes[i] + offset, nodes[i + 1] + offset]);\n        }\n    } else {\n        // 随机二叉树：每个节点最多两个子节点\n        const nodes = arrays.permutation(n, false);\n        const children: number[] = new Array(n).fill(0); // 记录每个节点的子节点数\n\n        for (let i = 1; i < n; i++) {\n            // 找一个还能添加子节点的父节点 (子节点数 < 2)\n            let parent: number;\n            do {\n                parent = nodes[core.int(0, i - 1)];\n            } while (children[parent] >= 2);\n\n            children[parent]++;\n            edges.push([parent + offset, nodes[i] + offset]);\n        }\n    }\n\n    return { edges: core.shuffleInPlace(edges), root };\n}\n","// src/generator/base.ts\n// 进制转换模块 — 静态导出\n\nimport * as core from './core';\nimport { CHARSET, string } from './strings';\n\n// ============ 静态导出函数 ============\n\nexport function convert(input: string | number | bigint, fromRadix: number, toRadix: number): string {\n    if (fromRadix < 2 || fromRadix > 36 || toRadix < 2 || toRadix > 36) {\n        throw new Error(`Radix must be an integer between 2 and 36. Received: from=${fromRadix}, to=${toRadix}`);\n    }\n    const inputStr = String(input);\n    let val: bigint;\n    try {\n        if (fromRadix === 10) {\n            val = BigInt(inputStr);\n        } else {\n            val = BigInt(0);\n            for (const c of inputStr.toUpperCase()) {\n                const d = CHARSET.BASE36.indexOf(c);\n                if (d === -1 || d >= fromRadix) throw new Error();\n                val = val * BigInt(fromRadix) + BigInt(d);\n            }\n        }\n    } catch {\n        throw new Error(`Input \"${inputStr}\" contains invalid characters for base ${fromRadix}.`);\n    }\n    if (val === BigInt(0)) return '0';\n    let result = '';\n    while (val > 0) {\n        result = CHARSET.BASE36[Number(val % BigInt(toRadix))] + result;\n        val = val / BigInt(toRadix);\n    }\n    return result;\n}\n\nexport function binToHex(s: string): string {\n    return convert(s, 2, 16);\n}\n\nexport function hexToBin(s: string): string {\n    return convert(s, 16, 2);\n}\n\nexport function digits(len: number, radix: number): string {\n    if (len <= 0) return '';\n    if (radix < 2 || radix > 36) {\n        throw new Error(`Radix must be an integer between 2 and 36. Received: ${radix}`);\n    }\n    const cs = CHARSET.BASE36.slice(0, radix);\n    if (len === 1) return core.sample(cs.split(''));\n    return core.sample(cs.replace('0', '').split('')) + string(len - 1, cs);\n}\n\n// 导出完整的 base 对象供 index.ts 使用\nexport const base = { convert, binToHex, hexToBin, digits };\n","// src/generator/debug.ts\n// 调试工具模块 — 静态导出\n\nimport pc from 'picocolors';\nimport type { DebugOptions } from '../types';\n\n// debug 函数直接导出\nexport function debug<T>(data: T, options?: DebugOptions): void;\nexport function debug<T>(label: string, data: T, options?: DebugOptions): void;\nexport function debug<T>(\n    labelOrData: string | T,\n    dataOrOptions?: T | DebugOptions,\n    options?: DebugOptions\n): void {\n    let label: string | null = null;\n    let data: T;\n    let config: Required<Omit<DebugOptions, 'colors'>> & { colors: boolean };\n\n    const defaults = {\n        separator: ' ',\n        printDims: false,\n        printType: true,\n        printStats: false,\n        truncate: 50,\n        colors: true,\n    };\n\n    if (typeof labelOrData === 'string') {\n        label = labelOrData;\n        data = dataOrOptions as T;\n        config = { ...defaults, ...options };\n    } else {\n        data = labelOrData as T;\n        config = { ...defaults, ...(dataOrOptions as DebugOptions) };\n    }\n\n    // 条件颜色函数：当 colors=false 时返回原字符串\n    const c = config.colors\n        ? { bold: pc.bold, cyan: pc.cyan, gray: pc.gray, magenta: pc.magenta, yellow: pc.yellow, green: pc.green }\n        : { bold: (s: string) => s, cyan: (s: string) => s, gray: (s: string) => s, magenta: (s: string) => s, yellow: (s: string) => s, green: (s: string) => s };\n\n    console.log(c.bold(c.cyan(`---[ ${label || 'Genesis Debug'} ]`)) + c.gray(' ---'));\n\n    if (data === null || data === undefined) {\n        console.log(c.magenta(String(data)));\n        console.log(c.gray('------------------------------------'));\n        return;\n    }\n\n    if (!Array.isArray(data)) {\n        if (config.printType) {\n            console.log(`${c.yellow('Type:')} ${c.green(typeof data)}`);\n        }\n        console.log(data);\n        console.log(c.gray('------------------------------------'));\n        return;\n    }\n\n    if (data.length === 0) {\n        console.log(c.yellow('Type:') + c.green(' Array (empty)'));\n        console.log('[]');\n        console.log(c.gray('------------------------------------'));\n        return;\n    }\n\n    const is2D = Array.isArray(data[0]);\n    const isTruncated = data.length > config.truncate;\n    const displayData = isTruncated ? data.slice(0, config.truncate) : data;\n\n    if (config.printType) {\n        const itemType = is2D ? typeof (data[0] as any[])?.[0] : typeof data[0];\n        const typeStr = is2D ? `Matrix<${itemType}>` : `Array<${itemType}>`;\n        const dimsStr = is2D\n            ? `(${data.length}x${(data[0] as any[]).length})`\n            : `(len=${data.length})`;\n        console.log(`${c.yellow('Type:')} ${c.green(typeStr)}  ${c.yellow('Dims:')} ${c.green(dimsStr)}`);\n    }\n\n    if (config.printStats && typeof data[0] === 'number') {\n        const flatNums = (is2D ? (data as number[][]).flat() : data as number[])\n            .filter(n => typeof n === 'number');\n        if (flatNums.length > 0) {\n            const stats = {\n                min: Math.min(...flatNums),\n                max: Math.max(...flatNums),\n                sum: flatNums.reduce((a, b) => a + b, 0),\n            };\n            console.log(\n                `${c.yellow('Stats:')} ${c.gray('min=')}${stats.min} ` +\n                `${c.gray('max=')}${stats.max} ${c.gray('sum=')}${stats.sum}`\n            );\n        }\n    }\n\n    if (config.printDims) {\n        const dims = is2D\n            ? `${data.length}${config.separator}${(data[0] as any[]).length}`\n            : `${data.length}`;\n        console.log(c.magenta(dims));\n    }\n\n    if (is2D) {\n        const matrix = displayData as any[][];\n        const colWidths = Array(matrix[0]?.length || 0).fill(0);\n\n        for (const row of matrix) {\n            for (let i = 0; i < row.length; i++) {\n                const cellStr = String(row[i] ?? '');\n                if (cellStr.length > colWidths[i]) {\n                    colWidths[i] = cellStr.length;\n                }\n            }\n        }\n\n        matrix.forEach(row => {\n            const rowStr = row\n                .map((cell, i) => String(cell ?? '').padEnd(colWidths[i], ' '))\n                .join(config.separator);\n            console.log(rowStr);\n        });\n    } else {\n        console.log(displayData.join(config.separator));\n    }\n\n    if (isTruncated) {\n        console.log(c.gray(`... (truncated, ${data.length - config.truncate} more items)`));\n    }\n\n    console.log(c.gray('------------------------------------'));\n}\n","// src/generator/index.ts\n// Genesis 数据生成器 — 简洁的模块组装入口\n// 静态导出设计：直接从各模块导入，无需工厂函数\n\nimport type { IGenerator } from './types';\n\n// 直接导入各模块的静态导出\nimport * as core from './core';\nimport * as numbers from './numbers';\nimport * as strings from './strings';\nimport * as arrays from './arrays';\nimport * as datetime from './datetime';\nimport * as geometry from './geometry';\nimport * as graphs from './graphs';\nimport { base } from './base';\nimport { debug } from './debug';\nimport { CHARSET } from './strings';\n\n/**\n * G 对象 — Genesis 数据生成器单例\n * \n * 静态导出架构：\n * - 所有模块直接导出函数\n * - 模块间通过 import * as xxx 相互引用\n * - 无工厂函数，无闭包，代码简洁\n */\nexport const G: IGenerator = {\n    // 字符集常量\n    CHARSET,\n\n    // === 数值生成 ===\n    int: numbers.int,\n    ints: numbers.ints,\n    distinctInts: numbers.distinctInts,\n    float: numbers.float,\n    even: numbers.even,\n    odd: numbers.odd,\n    prime: numbers.prime,\n    coprime: numbers.coprime,\n    divisible: numbers.divisible,\n    sequence: numbers.sequence,\n\n    // === 字符串生成 ===\n    string: strings.string,\n    palindrome: strings.palindrome,\n    word: strings.word,\n    words: strings.words,\n    brackets: strings.brackets,\n\n    // === 数组/矩阵 ===\n    array: arrays.array,\n    sorted: arrays.sorted,\n    sparse: arrays.sparse,\n    partition: arrays.partition,\n    matrix: arrays.matrix,\n    grid01: arrays.grid01,\n    maze: arrays.maze,\n    intervals: arrays.intervals,\n    permutation: arrays.permutation,\n    chunk: arrays.chunk,\n\n    // === 排列/采样 ===\n    shuffle: core.shuffle,\n    sample: core.sample,\n    withRng: core.withRng,\n    resetRng: core.resetRng,\n\n    // === 图论 ===\n    tree: graphs.tree,\n    graph: graphs.graph,\n    binaryTree: graphs.binaryTree,\n\n    // === 几何 ===\n    points: geometry.points,\n    convexHull: geometry.convexHull,\n    polygon: geometry.polygon,\n\n    // === 日期 ===\n    isLeap: datetime.isLeap,\n    year: datetime.year,\n    date: datetime.date,\n\n    // === 进制 ===\n    base,\n\n    // === 调试 ===\n    debug,\n};\n\n// 导出类型\nexport type { IGenerator } from './types';\n","import crypto from 'node:crypto';\nimport { G } from './index';\nimport { runWithRng, type RandomSource } from './core';\nimport type { IGenerator } from './types';\n\nexport type SeedInput = string | number | bigint;\nexport type DatasetGenerator = Omit<IGenerator, 'withRng' | 'resetRng'>;\n\nexport function createGenerator(seedOrRng: SeedInput | RandomSource): DatasetGenerator {\n  const rng = typeof seedOrRng === 'function' ? seedOrRng : createSeededRng(seedOrRng);\n  const scoped = <T>(callback: () => T): T => runWithRng(rng, callback);\n\n  return {\n    CHARSET: G.CHARSET,\n\n    int: (min, max) => scoped(() => G.int(min, max)),\n    ints: (count, min, max) => scoped(() => G.ints(count, min, max)),\n    distinctInts: (count, min, max) => scoped(() => G.distinctInts(count, min, max)),\n    float: (min, max, precision) => scoped(() => G.float(min, max, precision)),\n    even: (min, max) => scoped(() => G.even(min, max)),\n    odd: (min, max) => scoped(() => G.odd(min, max)),\n    prime: (min, max) => scoped(() => G.prime(min, max)),\n    coprime: (min, max) => scoped(() => G.coprime(min, max)),\n    divisible: (min, max, d) => scoped(() => G.divisible(min, max, d)),\n    sequence: options => scoped(() => G.sequence(options)),\n\n    string: (len, charset) => scoped(() => G.string(len, charset)),\n    palindrome: (len, charset) => scoped(() => G.palindrome(len, charset)),\n    word: (minLen, maxLen) => scoped(() => G.word(minLen, maxLen)),\n    words: (count, minLen, maxLen) => scoped(() => G.words(count, minLen, maxLen)),\n    brackets: (n, options) => scoped(() => G.brackets(n, options)),\n\n    array: (count, itemGenerator) => scoped(() => G.array(count, itemGenerator)),\n    sorted: (count, min, max, options) => scoped(() => G.sorted(count, min, max, options)),\n    sparse: (count, min, max, gap) => scoped(() => G.sparse(count, min, max, gap)),\n    partition: (count, sum, options) => scoped(() => G.partition(count, sum, options)),\n    matrix: (rows, cols, cellGenerator) => scoped(() => G.matrix(rows, cols, cellGenerator)),\n    grid01: (rows, cols, density) => scoped(() => G.grid01(rows, cols, density)),\n    maze: (rows, cols, options) => scoped(() => G.maze(rows, cols, options)),\n    intervals: (n, min, max, options) => scoped(() => G.intervals(n, min, max, options)),\n\n    permutation: (n, oneBased) => scoped(() => G.permutation(n, oneBased)),\n    shuffle: array => scoped(() => G.shuffle(array)),\n    sample: ((population: readonly unknown[], k?: number) =>\n      scoped(() => k === undefined ? G.sample(population) : G.sample(population, k))) as DatasetGenerator['sample'],\n    chunk: (array, size) => G.chunk(array, size),\n\n    tree: (n, options) => scoped(() => G.tree(n, options)),\n    graph: (n, m, options) => scoped(() => G.graph(n, m, options)),\n\n    points: (n, minVal, maxVal, options) => scoped(() => G.points(n, minVal, maxVal, options)),\n    convexHull: (n, minVal, maxVal) => scoped(() => G.convexHull(n, minVal, maxVal)),\n    polygon: (n, minVal, maxVal) => scoped(() => G.polygon(n, minVal, maxVal)),\n    binaryTree: (n, options) => scoped(() => G.binaryTree(n, options)),\n\n    isLeap: year => G.isLeap(year),\n    year: (minYear, maxYear) => scoped(() => G.year(minYear, maxYear)),\n    date: options => scoped(() => G.date(options)),\n\n    base: {\n      convert: (input, fromRadix, toRadix) => G.base.convert(input, fromRadix, toRadix),\n      binToHex: s => G.base.binToHex(s),\n      hexToBin: s => G.base.hexToBin(s),\n      digits: (length, radix) => scoped(() => G.base.digits(length, radix)),\n    },\n\n    debug: ((...args: [unknown, unknown?, unknown?]) => {\n      const [labelOrData, dataOrOptions, options] = args;\n      if (typeof labelOrData === 'string' && args.length >= 2) {\n        return G.debug(labelOrData, dataOrOptions, options as never);\n      }\n      return G.debug(labelOrData, dataOrOptions as never);\n    }) as DatasetGenerator['debug'],\n  };\n}\n\nexport function createSeededRng(seed: SeedInput): RandomSource {\n  const hash = crypto.createHash('sha256').update(String(seed)).digest();\n  let a = hash.readUInt32LE(0);\n  let b = hash.readUInt32LE(4);\n  let c = hash.readUInt32LE(8);\n  let d = hash.readUInt32LE(12);\n\n  return () => {\n    a >>>= 0; b >>>= 0; c >>>= 0; d >>>= 0;\n    const t = (a + b) | 0;\n    a = b ^ (b >>> 9);\n    b = (c + (c << 3)) | 0;\n    c = (c << 21) | (c >>> 11);\n    d = (d + 1) | 0;\n    const result = (t + d) | 0;\n    c = (c + result) | 0;\n    return (result >>> 0) / 4294967296;\n  };\n}\n","{\n  \"name\": \"genesis-kit\",\n  \"version\": \"2.0.0\",\n  \"description\": \"AI-first deterministic dataset generator for algorithm competitions.\",\n  \"keywords\": [\n    \"oi\",\n    \"acm\",\n    \"icpc\",\n    \"algorithm\",\n    \"contest\",\n    \"test-data\",\n    \"generator\",\n    \"dataset\",\n    \"deterministic\",\n    \"ai-first\",\n    \"genesis-kit\"\n  ],\n  \"author\": \"YV\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/yviscool/Genesis/issues\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"git+https://github.com/yviscool/Genesis.git\"\n  },\n  \"bin\": {\n    \"genesis\": \"dist/cli.js\"\n  },\n  \"files\": [\n    \"dist\",\n    \"manifest.schema.json\",\n    \"CHANGELOG.md\",\n    \"MIGRATION.md\",\n    \"README.md\",\n    \"README.en.md\",\n    \"LICENSE\"\n  ],\n  \"module\": \"./dist/index.mjs\",\n  \"main\": \"dist/index.js\",\n  \"types\": \"dist/index.d.ts\",\n  \"exports\": {\n    \"./package.json\": \"./package.json\",\n    \".\": {\n      \"import\": \"./dist/index.mjs\",\n      \"require\": \"./dist/index.js\",\n      \"bun\": \"./dist/bun/index.js\",\n      \"types\": \"./dist/index.d.ts\"\n    },\n    \"./manifest.schema.json\": \"./manifest.schema.json\"\n  },\n  \"scripts\": {\n    \"test\": \"bun test\",\n    \"dev\": \"bun --watch run examples/make.ts\",\n    \"build\": \"bun run build.ts\",\n    \"prepare\": \"bun run build\",\n    \"build:ai-contract\": \"bun run scripts/build-ai-contract.ts\",\n    \"release:check\": \"node scripts/release-check.mjs\",\n    \"release\": \"bun run release:check && bun publish\"\n  },\n  \"devDependencies\": {\n    \"@types/bun\": \"latest\",\n    \"esbuild-fix-imports-plugin\": \"latest\",\n    \"tsdown\": \"^0.16.2\"\n  },\n  \"peerDependencies\": {\n    \"@typescript/native-preview\": \"^7.0.0-dev.20251228.1\"\n  },\n  \"dependencies\": {\n    \"cac\": \"^6.7.14\",\n    \"consola\": \"^3.4.2\",\n    \"es-toolkit\": \"^1.43.0\",\n    \"execa\": \"^9.6.1\",\n    \"ora\": \"^9.0.0\",\n    \"picocolors\": \"^1.1.1\",\n    \"tsx\": \"^4.20.6\"\n  }\n}\n","// src/language.ts\nimport path from 'node:path';\n\n/**\n * 编程语言信息接口。\n */\nexport interface LanguageInfo {\n  /** 语言唯一标识符 (例如 'cpp', 'python')。 */\n  id: string;\n  /** 语言显示名称。 */\n  name: string;\n  /** 支持的文件扩展名列表。 */\n  extensions: string[];\n  /** 语言类型：编译型 ('compiled') 或 解释型 ('interpreted')。 */\n  type: 'compiled' | 'interpreted';\n}\n\nconst LANGUAGES: LanguageInfo[] = [\n  { id: 'cpp', name: 'C++', extensions: ['.cpp', '.cc', '.cxx'], type: 'compiled' },\n  { id: 'go', name: 'Go', extensions: ['.go'], type: 'compiled' },\n  { id: 'rust', name: 'Rust', extensions: ['.rs'], type: 'compiled' },\n  { id: 'java', name: 'Java', extensions: ['.java'], type: 'compiled' },\n  { id: 'python', name: 'Python', extensions: ['.py'], type: 'interpreted' },\n  { id: 'javascript', name: 'JavaScript', extensions: ['.js'], type: 'interpreted' },\n  { id: 'typescript', name: 'TypeScript', extensions: ['.ts'], type: 'interpreted' },\n];\n\n/**\n * 根据源文件扩展名检测编程语言。\n * @param sourceFile 源文件路径。\n * @returns {LanguageInfo | null} 匹配的语言信息，如果未找到则返回 null。\n */\nexport function detectLanguage(sourceFile: string): LanguageInfo | null {\n  const extension = path.extname(sourceFile);\n  if (!extension) return null;\n  return LANGUAGES.find(lang => lang.extensions.includes(extension)) || null;\n}\n","import fs from 'node:fs';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n// ESM 环境下模拟 __dirname\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\ntype Locale = 'en' | 'zh';\n\nlet translations: Record<string, string> = {};\n\nfunction getSystemLocale(): Locale {\n  const explicitLocale = process.env.GENESIS_LANG;\n  if (explicitLocale) {\n    return explicitLocale.toLowerCase().startsWith('zh') ? 'zh' : 'en';\n  }\n\n  // 优先使用环境变量，因为它们在不同运行时中更可靠\n  const lang = process.env.LANG || process.env.LC_MESSAGES || process.env.LC_ALL;\n  if (lang && lang.toLowerCase().startsWith('zh')) {\n    return 'zh';\n  }\n\n  // 回退到 Intl API\n  const locale = Intl.DateTimeFormat().resolvedOptions().locale;\n  if (locale.startsWith('zh')) {\n    return 'zh';\n  }\n\n  return 'en';\n}\n\nfunction loadTranslations(locale: Locale) {\n  const filePath = path.join(__dirname, 'locales', `${locale}.json`);\n  try {\n    const fileContent = fs.readFileSync(filePath, 'utf-8');\n    translations = JSON.parse(fileContent);\n  } catch (error) {\n    console.error(`Failed to load translations for locale: ${locale}`, error);\n    // 如果加载失败，回退到英语\n    if (locale !== 'en') {\n      loadTranslations('en');\n    }\n  }\n}\n\n/**\n * 翻译函数。\n * 根据当前语言环境获取键对应的翻译文本，并支持参数替换。\n * @param key 翻译键。\n * @param args 替换参数。\n * @returns 翻译后的字符串。\n */\nexport function t(key: string, ...args: (string | number)[]): string {\n  let message = translations[key] || key;\n  args.forEach((arg, index) => {\n    message = message.replace(`{${index}}`, String(arg));\n  });\n  return message;\n}\n\nconst currentLocale = getSystemLocale();\nloadTranslations(currentLocale);\n","import crypto from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { consola } from 'consola';\nimport { execa } from 'execa';\nimport ora from 'ora';\nimport pc from 'picocolors';\nimport { detectLanguage, type LanguageInfo } from './language';\nimport { t } from './i18n';\nimport { type OjProfile } from './types';\n\nexport const GENESIS_CACHE_DIR = '.genesis';\nconst CACHE_FILE = path.join(GENESIS_CACHE_DIR, 'cache.json');\nconst DEFAULT_WINDOWS_CPP_STACK_SIZE_BYTES = 16 * 1024 * 1024;\n\nconst DEFAULT_COMPILER_FLAGS: Record<string, string[]> = {\n  cpp: ['-O2', '-std=c++17', '-Wall'],\n  rust: ['-C', 'opt-level=2'],\n};\n\ninterface CacheMetadata {\n  [cacheKey: string]: {\n    hash: string;\n    executablePath: string;\n  };\n}\n\nexport interface ExecutionConfig {\n  compiler?: string;\n  compilerFlags?: string[];\n  ojProfile?: OjProfile;\n  stackSizeBytes?: number;\n}\n\nexport interface ResolvedCompiler {\n  command: string;\n  inlineFlags: string[];\n  displayName: string;\n}\n\nexport interface ExecutionResult {\n  runArgs: string[];\n  executablePath: string;\n}\n\nexport interface CompilationProfileContext {\n  compilerVersion?: string | null;\n  platform?: NodeJS.Platform;\n  arch?: string;\n  ojProfile?: OjProfile;\n  stackSizeBytes?: number;\n}\n\ntype CppToolchain = 'gnu' | 'msvc' | 'unknown';\n\nexport async function prepareForExecution(\n  sourceFile: string,\n  config: ExecutionConfig\n): Promise<ExecutionResult | null> {\n  const lang = detectLanguage(sourceFile);\n  if (!lang) {\n    consola.error(`Unsupported language for file: ${sourceFile}`);\n    return null;\n  }\n\n  if (lang.type === 'interpreted') {\n    return handleInterpretedLanguage(sourceFile, lang);\n  }\n\n  return handleCompiledLanguage(sourceFile, lang, config);\n}\n\nasync function handleInterpretedLanguage(sourceFile: string, lang: LanguageInfo): Promise<ExecutionResult | null> {\n  let runtime: string | null = null;\n\n  switch (lang.id) {\n    case 'python':\n      runtime = await findRuntime(['python3', 'python']);\n      break;\n    case 'javascript':\n      runtime = await findRuntime(['node']);\n      break;\n    case 'typescript':\n      runtime = await findRuntime(['tsx']);\n      break;\n  }\n\n  if (!runtime) {\n    consola.error(`Could not find runtime for ${lang.name}. Please ensure it is installed and in your PATH.`);\n    return null;\n  }\n\n  return {\n    runArgs: [runtime, sourceFile],\n    executablePath: sourceFile,\n  };\n}\n\nasync function handleCompiledLanguage(\n  sourceFile: string,\n  lang: LanguageInfo,\n  config: ExecutionConfig\n): Promise<ExecutionResult | null> {\n  const compiler = await resolveCompiler(lang, config.compiler);\n  if (!compiler) {\n    consola.error(getCompilerHelpMessage(lang));\n    return null;\n  }\n\n  const compilerVersion = await getCompilerVersion(compiler);\n  if (compilerVersion) {\n    consola.info(t('compilation.usingCompiler', `${compiler.displayName} ${pc.green(compilerVersion)}`));\n  } else {\n    consola.info(t('compilation.usingCompiler', compiler.displayName));\n  }\n\n  const profileContext: CompilationProfileContext = {\n    compilerVersion,\n    platform: process.platform,\n    arch: process.arch,\n    ojProfile: config.ojProfile,\n    stackSizeBytes: config.stackSizeBytes,\n  };\n  const profile = await getCompilationProfile(sourceFile, compiler, lang, config.compilerFlags, profileContext);\n  const cacheKey = `${sourceFile}-${compiler.displayName}-${process.platform}-${process.arch}`;\n\n  const cachedExecutable = await findCachedExecutable(cacheKey, profile.hash);\n  if (cachedExecutable) {\n    consola.info(t('compilation.hashMatch', sourceFile));\n    return {\n      runArgs: getRunCommand(cachedExecutable, sourceFile, lang),\n      executablePath: cachedExecutable,\n    };\n  }\n\n  const executablePath = await executeCompilation(sourceFile, compiler, profile, lang, cacheKey);\n  if (!executablePath) {\n    return null;\n  }\n\n  return {\n    runArgs: getRunCommand(executablePath, sourceFile, lang),\n    executablePath,\n  };\n}\n\nfunction getRunCommand(executablePath: string, sourceFile: string, lang: LanguageInfo): string[] {\n  if (lang.id === 'java') {\n    const className = path.basename(sourceFile, '.java');\n    return ['java', '-cp', executablePath, className];\n  }\n\n  return [executablePath];\n}\n\nexport async function resolveCompiler(lang: LanguageInfo, userCompiler?: string): Promise<ResolvedCompiler | null> {\n  if (userCompiler) {\n    const parts = splitCommandString(userCompiler);\n    if (parts.length === 0) {\n      return null;\n    }\n\n    const [command, ...inlineFlags] = parts;\n    return {\n      command,\n      inlineFlags,\n      displayName: parts.join(' '),\n    };\n  }\n\n  const compilers: Record<string, string[]> = {\n    cpp: ['g++', 'clang++'],\n    go: ['go'],\n    rust: ['rustc'],\n    java: ['javac'],\n  };\n\n  const command = await findRuntime(compilers[lang.id] || []);\n  if (!command) {\n    return null;\n  }\n\n  return {\n    command,\n    inlineFlags: [],\n    displayName: command,\n  };\n}\n\nexport async function getCompilationProfile(\n  sourceFile: string,\n  compiler: ResolvedCompiler,\n  lang: LanguageInfo,\n  userFlags: string[] = [],\n  context: CompilationProfileContext = {}\n): Promise<{ hash: string, flags: string[] }> {\n  const finalFlags = buildCompilerFlags(lang, compiler.command, compiler.inlineFlags, userFlags, context);\n\n  await fs.mkdir(GENESIS_CACHE_DIR, { recursive: true });\n  const sourceContent = await fs.readFile(sourceFile, 'utf8');\n  const fingerprint = buildCompilationFingerprint(sourceContent, compiler, finalFlags, context);\n  const hash = crypto.createHash('sha256').update(fingerprint).digest('hex');\n\n  return { hash, flags: finalFlags };\n}\n\nexport function buildCompilationFingerprint(\n  sourceContent: string,\n  compiler: ResolvedCompiler,\n  finalFlags: string[],\n  context: CompilationProfileContext = {}\n): string {\n  return [\n    sourceContent,\n    compiler.displayName,\n    context.compilerVersion ?? 'unknown',\n    context.platform ?? process.platform,\n    context.arch ?? process.arch,\n    finalFlags.join('\\0'),\n  ].join('\\0');\n}\n\nexport function buildCompilerFlags(\n  lang: LanguageInfo,\n  compilerCommand: string,\n  inlineFlags: string[] = [],\n  userFlags: string[] = [],\n  context: CompilationProfileContext = {}\n): string[] {\n  const baseFlags = DEFAULT_COMPILER_FLAGS[lang.id] || [];\n  const explicitFlags = [...inlineFlags, ...userFlags];\n  const automaticFlags = getAutomaticCompilerFlags(lang, compilerCommand, explicitFlags, context);\n\n  return [...baseFlags, ...automaticFlags, ...userFlags];\n}\n\nfunction getAutomaticCompilerFlags(\n  lang: LanguageInfo,\n  compilerCommand: string,\n  explicitFlags: string[],\n  context: CompilationProfileContext = {}\n): string[] {\n  const platform = context.platform ?? process.platform;\n  if (lang.id !== 'cpp' || platform !== 'win32') {\n    return [];\n  }\n\n  if (hasExplicitWindowsStackFlag(explicitFlags)) {\n    return [];\n  }\n\n  const stackSizeBytes = resolveDesiredStackSizeBytes(context);\n  if (!stackSizeBytes) {\n    return [];\n  }\n\n  return getWindowsStackFlags(compilerCommand, stackSizeBytes);\n}\n\nfunction resolveDesiredStackSizeBytes(context: CompilationProfileContext): number | null {\n  if (isValidStackSize(context.stackSizeBytes)) {\n    return Math.floor(context.stackSizeBytes!);\n  }\n\n  const ojProfile = context.ojProfile ?? 'auto';\n  if (ojProfile === 'none' || ojProfile === 'windows') {\n    return null;\n  }\n\n  return DEFAULT_WINDOWS_CPP_STACK_SIZE_BYTES;\n}\n\nfunction isValidStackSize(stackSizeBytes?: number): boolean {\n  return typeof stackSizeBytes === 'number'\n    && Number.isFinite(stackSizeBytes)\n    && stackSizeBytes > 0;\n}\n\nfunction getWindowsStackFlags(compilerCommand: string, stackSizeBytes: number): string[] {\n  const toolchain = detectCppToolchain(compilerCommand);\n\n  if (toolchain === 'msvc') {\n    return ['/link', `/STACK:${stackSizeBytes}`];\n  }\n\n  if (toolchain === 'gnu') {\n    return [`-Wl,--stack,${stackSizeBytes}`];\n  }\n\n  return [];\n}\n\nfunction detectCppToolchain(compilerCommand: string): CppToolchain {\n  const compilerName = path.basename(compilerCommand).toLowerCase();\n\n  if (\n    compilerName === 'cl'\n    || compilerName === 'cl.exe'\n    || compilerName === 'clang-cl'\n    || compilerName === 'clang-cl.exe'\n  ) {\n    return 'msvc';\n  }\n\n  if (\n    compilerName === 'g++'\n    || compilerName === 'g++.exe'\n    || compilerName === 'c++'\n    || compilerName === 'c++.exe'\n    || compilerName.includes('g++')\n    || compilerName.includes('clang++')\n  ) {\n    return 'gnu';\n  }\n\n  return 'unknown';\n}\n\nfunction hasExplicitWindowsStackFlag(flags: string[]): boolean {\n  for (let index = 0; index < flags.length; index++) {\n    const current = flags[index]?.toLowerCase() || '';\n    const next = flags[index + 1]?.toLowerCase() || '';\n\n    if (isWindowsStackFlag(current)) {\n      return true;\n    }\n\n    if ((current === '-xlinker' || current === '/link') && isWindowsStackFlag(next)) {\n      return true;\n    }\n  }\n\n  return false;\n}\n\nfunction isWindowsStackFlag(flag: string): boolean {\n  return /(?:^|,)--stack(?:[=,]|$)/.test(flag) || /^\\/stack:/.test(flag);\n}\n\nexport function splitCommandString(commandLine: string): string[] {\n  const tokens: string[] = [];\n  let current = '';\n  let quote: '\"' | \"'\" | null = null;\n\n  for (let index = 0; index < commandLine.length; index++) {\n    const char = commandLine[index];\n    const next = commandLine[index + 1];\n\n    if (char === '\\\\' && next && (next === quote || next === '\"' || next === \"'\" || next === '\\\\')) {\n      current += next;\n      index++;\n      continue;\n    }\n\n    if (quote) {\n      if (char === quote) {\n        quote = null;\n      } else {\n        current += char;\n      }\n      continue;\n    }\n\n    if (char === '\"' || char === \"'\") {\n      quote = char;\n      continue;\n    }\n\n    if (/\\s/.test(char)) {\n      if (current) {\n        tokens.push(current);\n        current = '';\n      }\n      continue;\n    }\n\n    current += char;\n  }\n\n  if (current) {\n    tokens.push(current);\n  }\n\n  return tokens;\n}\n\nasync function findCachedExecutable(cacheKey: string, currentHash: string): Promise<string | null> {\n  const cache = await readCache();\n  const entry = cache[cacheKey];\n\n  if (entry && entry.hash === currentHash) {\n    try {\n      await fs.access(entry.executablePath);\n      return entry.executablePath;\n    } catch {\n      consola.warn(t('compilation.cacheMissing'));\n    }\n  }\n\n  return null;\n}\n\nasync function executeCompilation(\n  sourceFile: string,\n  compiler: ResolvedCompiler,\n  profile: { hash: string, flags: string[] },\n  lang: LanguageInfo,\n  cacheKey: string\n): Promise<string | null> {\n  const spinner = ora(t('compilation.compiling', sourceFile, compiler.displayName)).start();\n  const { command, args, executablePath } = getCompilationCommand(sourceFile, compiler, profile.flags, lang, profile.hash);\n\n  try {\n    if (lang.id === 'java') {\n      await fs.mkdir(executablePath, { recursive: true });\n    }\n\n    await execa(command, args);\n    spinner.succeed(t('compilation.compiled', sourceFile));\n    await updateCache(cacheKey, profile.hash, executablePath);\n    return executablePath;\n  } catch (error: any) {\n    spinner.fail(t('compilation.compileFailed', sourceFile));\n    const { formatCompilerError } = await import('./error-formatter');\n    consola.error(formatCompilerError(error.stderr || error.message, sourceFile));\n    return null;\n  }\n}\n\nfunction getCompilationCommand(\n  sourceFile: string,\n  compiler: ResolvedCompiler,\n  flags: string[],\n  lang: LanguageInfo,\n  hash: string\n): { command: string, args: string[], executablePath: string } {\n  const baseName = path.parse(sourceFile).name;\n  const hashSuffix = hash.substring(0, 8);\n\n  if (lang.id === 'java') {\n    const outputDir = path.join(GENESIS_CACHE_DIR, `${baseName}-${hashSuffix}`);\n    return {\n      command: compiler.command,\n      args: [...compiler.inlineFlags, ...flags, '-d', outputDir, sourceFile],\n      executablePath: outputDir,\n    };\n  }\n\n  const exeSuffix = process.platform === 'win32' ? '.exe' : '';\n  const executablePath = path.join(GENESIS_CACHE_DIR, `${baseName}-${hashSuffix}${exeSuffix}`);\n\n  if (lang.id === 'go') {\n    return {\n      command: compiler.command,\n      args: [...compiler.inlineFlags, 'build', ...flags, '-o', executablePath, sourceFile],\n      executablePath,\n    };\n  }\n\n  return {\n    command: compiler.command,\n    args: [...compiler.inlineFlags, sourceFile, '-o', executablePath, ...flags],\n    executablePath,\n  };\n}\n\nasync function readCache(): Promise<CacheMetadata> {\n  try {\n    return JSON.parse(await fs.readFile(CACHE_FILE, 'utf-8'));\n  } catch {\n    return {};\n  }\n}\n\nasync function updateCache(cacheKey: string, hash: string, executablePath: string): Promise<void> {\n  const cache = await readCache();\n  cache[cacheKey] = { hash, executablePath };\n  await fs.writeFile(CACHE_FILE, JSON.stringify(cache, null, 2));\n}\n\nasync function findRuntime(commands: readonly string[]): Promise<string | null> {\n  for (const cmd of commands) {\n    try {\n      if (cmd === 'go') {\n        await execa(cmd, ['version']);\n      } else {\n        try {\n          await execa(cmd, ['--version']);\n        } catch {\n          await execa(cmd, ['-v']);\n        }\n      }\n\n      return cmd;\n    } catch {\n      // Try the next candidate.\n    }\n  }\n\n  return null;\n}\n\nasync function getCompilerVersion(compiler: ResolvedCompiler): Promise<string | null> {\n  try {\n    let stdout: string;\n    const compilerName = path.basename(compiler.command).toLowerCase();\n\n    if (compilerName === 'go' || compilerName === 'go.exe') {\n      const result = await execa(compiler.command, [...compiler.inlineFlags, 'version']);\n      stdout = result.stdout;\n      return stdout.match(/go(\\d+\\.\\d+\\.\\d+)/)?.[1] ?? null;\n    }\n\n    if (compilerName === 'javac' || compilerName === 'javac.exe') {\n      const result = await execa(compiler.command, [...compiler.inlineFlags, '-version']);\n      stdout = result.stdout || result.stderr;\n      return stdout.match(/javac\\s+(\\S+)/)?.[1] ?? null;\n    }\n\n    if (compilerName === 'rustc' || compilerName === 'rustc.exe') {\n      const result = await execa(compiler.command, [...compiler.inlineFlags, '--version']);\n      stdout = result.stdout;\n      return stdout.match(/rustc\\s+(\\S+)/)?.[1] ?? null;\n    }\n\n    if (compilerName === 'cl' || compilerName === 'cl.exe') {\n      const result = await execa(compiler.command, [...compiler.inlineFlags], { reject: false });\n      stdout = `${result.stdout}\\n${result.stderr}`;\n      return stdout.match(/version\\s+(\\S+)/i)?.[1] ?? null;\n    }\n\n    const result = await execa(compiler.command, [...compiler.inlineFlags, '--version']);\n    stdout = result.stdout;\n    return stdout.match(/(\\d+\\.\\d+\\.\\d+|\\d+\\.\\d+)/)?.[1] ?? null;\n  } catch {\n    return null;\n  }\n}\n\nfunction getCompilerHelpMessage(lang: LanguageInfo): string {\n  const platform = process.platform;\n\n  const installCommands: { [key: string]: { [key: string]: string } } = {\n    cpp: {\n      win32: 'pacman -S --needed base-devel mingw-w64-ucrt-x86_64-toolchain',\n      darwin: 'xcode-select --install',\n      linux: 'sudo apt update && sudo apt install build-essential',\n    },\n    go: {\n      default: 'https://golang.org/doc/install',\n    },\n    rust: {\n      default: \"curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\",\n    },\n    java: {\n      linux: 'sudo apt install default-jdk',\n      darwin: 'brew install openjdk',\n      default: 'https://adoptium.net/',\n    },\n  };\n\n  const langCommands = installCommands[lang.id] || {};\n  const command = langCommands[platform] || langCommands.linux || langCommands.default || '';\n\n  let message = `\\n${t('compiler.notFoundNew', lang.name)}\\n\\n`;\n  message += `${t('compiler.installHint')}\\n\\n`;\n\n  if (command.startsWith('http')) {\n    message += `${t('compiler.installGuideLink', pc.green(command))}\\n`;\n  } else {\n    message += `${t('compiler.copyCommand')}\\n\\n`;\n    message += `   ${pc.green(command)}\\n`;\n  }\n\n  return message;\n}\n","import crypto from 'node:crypto';\nimport { createReadStream } from 'node:fs';\nimport fs from 'node:fs/promises';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { execa } from 'execa';\nimport { version } from '../package.json';\nimport { prepareForExecution, type ExecutionResult } from './execution';\nimport { createGenerator } from './generator/factory';\nimport { normalizeFormat, renderFormatDocument } from './format';\nimport { isDataset, type Dataset, type DatasetConfig, type DatasetGeneratedCase, type DatasetValidationContext, type DatasetValidationReturn } from './dataset';\n\nexport interface DatasetRunOptions {\n  mode: 'generate' | 'validate';\n  datasetFile?: string | null;\n  replay?: DatasetReplayInfo | null;\n  outputDir?: string;\n  manifestPath?: string | false;\n  cleanOutputDir?: boolean;\n}\n\nexport interface DatasetReplaySelector {\n  caseNumber?: number;\n  caseName?: string;\n  repeatIndex?: number;\n  outputDir?: string;\n  manifestPath?: string | false;\n}\n\nexport interface DatasetReplayInfo {\n  caseNumber: number;\n  caseName: string;\n  repeatIndex: number;\n  outputDir: string;\n}\n\nexport type DatasetCaseStatus = 'success' | 'failure';\nexport type DatasetErrorPhase = 'config' | 'materialize' | 'format' | 'validate' | 'write-input' | 'execution' | 'write-output' | 'manifest';\n\nexport interface DatasetErrorRecord {\n  phase: DatasetErrorPhase;\n  kind: 'generator' | 'formatter' | 'validation' | 'io' | 'execution' | 'timeout' | 'config';\n  message: string;\n}\n\nexport interface DatasetFileRecord {\n  path: string;\n  sha256: string;\n  bytes: number;\n  lines?: number;\n}\n\nexport interface DatasetValidationSummary {\n  status: 'not-run' | 'passed' | 'failed';\n  durationMs: number;\n  reason?: string;\n}\n\nexport interface DatasetCaseRecord {\n  caseId: number;\n  caseNumber: number;\n  name: string;\n  repeatIndex: number;\n  tags: string[];\n  seed: string;\n  status: DatasetCaseStatus;\n  durationMs: number;\n  phases: {\n    materializeMs: number;\n    formatMs: number;\n    validateMs: number;\n    writeInputMs: number;\n    executionMs: number;\n    writeOutputMs: number;\n  };\n  validation: DatasetValidationSummary;\n  input: DatasetFileRecord | null;\n  output: DatasetFileRecord | null;\n  error: DatasetErrorRecord | null;\n}\n\nexport interface DatasetManifest {\n  version: 2;\n  tool: {\n    name: 'genesis-kit';\n    version: string;\n  };\n  generatedAt: string;\n  dataset: {\n    modulePath: string | null;\n    solution: string;\n    outputDir: string;\n    seed: string;\n    startFrom: number;\n    runTimeoutMs: number;\n    caseConcurrency: number | null;\n    compiler: string | null;\n    compilerFlags: string[];\n    ojProfile: string | null;\n    stackSizeBytes: number | null;\n    manifestPath: string | null;\n  };\n  execution: {\n    runArgs: string[];\n    executablePath: string;\n    fingerprint: string;\n  } | null;\n  replay: DatasetReplayInfo | null;\n  summary: {\n    totalCases: number;\n    succeeded: number;\n    failed: number;\n    durationMs: number;\n  };\n  cases: DatasetCaseRecord[];\n}\n\nexport interface DatasetRunResult {\n  manifest: DatasetManifest | null;\n  results: DatasetCaseRecord[];\n  summary: DatasetManifest['summary'];\n}\n\nexport async function loadDatasetFromFile(entryFile = 'make.ts'): Promise<Dataset<unknown>> {\n  const resolvedPath = path.resolve(entryFile);\n  const moduleUrl = pathToFileURL(resolvedPath).href;\n  const module = await importDatasetModule(resolvedPath, moduleUrl);\n  const candidate = resolveDatasetExport(module);\n\n  if (!isDataset(candidate)) {\n    throw new Error(`Default export in '${entryFile}' is not a Genesis v2 dataset.`);\n  }\n\n  return candidate;\n}\n\nfunction resolveDatasetExport(module: any): unknown {\n  let candidate = module?.default ?? module;\n  for (let depth = 0; depth < 3 && !isDataset(candidate); depth++) {\n    if (!candidate || typeof candidate !== 'object' || !('default' in candidate)) {\n      break;\n    }\n    candidate = (candidate as { default?: unknown }).default;\n  }\n  return candidate;\n}\n\nasync function importDatasetModule(resolvedPath: string, moduleUrl: string): Promise<any> {\n  const extension = path.extname(resolvedPath).toLowerCase();\n  if (extension === '.ts' || extension === '.tsx' || extension === '.mts' || extension === '.cts') {\n    if (process.versions.bun) {\n      return import(moduleUrl);\n    }\n\n    const { tsImport } = await import('tsx/esm/api');\n    return tsImport(moduleUrl, { parentURL: import.meta.url });\n  }\n\n  return import(moduleUrl);\n}\n\nexport async function validateDatasetFromFile(entryFile = 'make.ts'): Promise<DatasetRunResult> {\n  const dataset = await loadDatasetFromFile(entryFile);\n  return validateDataset(dataset, { datasetFile: path.resolve(entryFile) });\n}\n\nexport async function generateDatasetFromFile(entryFile = 'make.ts'): Promise<DatasetRunResult> {\n  const dataset = await loadDatasetFromFile(entryFile);\n  return generateDataset(dataset, { datasetFile: path.resolve(entryFile) });\n}\n\nexport async function replayDatasetFromFile(\n  entryFile = 'make.ts',\n  selector: DatasetReplaySelector,\n): Promise<DatasetRunResult> {\n  const dataset = await loadDatasetFromFile(entryFile);\n  return replayDataset(dataset, selector, { datasetFile: path.resolve(entryFile) });\n}\n\nexport async function validateDataset<TInput>(\n  dataset: Dataset<TInput>,\n  options: Omit<DatasetRunOptions, 'mode'> = {},\n): Promise<DatasetRunResult> {\n  return runDataset(dataset, { ...options, mode: 'validate' });\n}\n\nexport async function generateDataset<TInput>(\n  dataset: Dataset<TInput>,\n  options: Omit<DatasetRunOptions, 'mode'> = {},\n): Promise<DatasetRunResult> {\n  return runDataset(dataset, { ...options, mode: 'generate' });\n}\n\nexport async function replayDataset<TInput>(\n  dataset: Dataset<TInput>,\n  selector: DatasetReplaySelector,\n  options: Omit<DatasetRunOptions, 'mode' | 'replay'> = {},\n): Promise<DatasetRunResult> {\n  assertDataset(dataset);\n  const rootDir = getDatasetRootDir(options.datasetFile);\n  const config = resolveConfigPaths(normalizeConfig(dataset.config), options.datasetFile);\n  const cases = expandDatasetCases(config);\n  const selected = selectReplayCase(cases, selector);\n  const replayOutputDir = selector.outputDir\n    ? resolvePathFromRoot(selector.outputDir, rootDir)\n    : path.join(config.outputDir ?? 'data', 'replay');\n  const replayManifestPath = selector.manifestPath === false\n    ? false\n    : selector.manifestPath\n      ? resolvePathFromRoot(selector.manifestPath, rootDir)\n      : config.manifestPath === false\n        ? false\n        : path.join(replayOutputDir, `${selected.caseNumber}.manifest.json`);\n  const startedAt = Date.now();\n  const runConfig = {\n    ...config,\n    outputDir: replayOutputDir,\n    manifestPath: replayManifestPath,\n  };\n  const { results, execution } = await runCasePipeline(runConfig, [selected], 'generate', {\n    cleanOutputDir: false,\n    outputDir: replayOutputDir,\n    rootDir,\n  });\n  const summary = summarize(results, Date.now() - startedAt);\n  const replay: DatasetReplayInfo = {\n    caseNumber: selected.caseNumber,\n    caseName: selected.name,\n    repeatIndex: selected.repeatIndex,\n    outputDir: path.resolve(replayOutputDir),\n  };\n  const manifest = await writeManifest(runConfig, results, summary, {\n    datasetFile: options.datasetFile ?? null,\n    execution,\n    replay,\n  });\n\n  return { manifest, results, summary };\n}\n\nexport function expandDatasetCases<TInput>(config: DatasetConfig<TInput>): ExpandedDatasetCase<TInput>[] {\n  const expanded: ExpandedDatasetCase<TInput>[] = [];\n  let caseIndex = 0;\n\n  for (const item of config.cases) {\n    if (!item || typeof item !== 'object') {\n      throw new Error('Every dataset case must be an object.');\n    }\n    if (!item.name || typeof item.name !== 'string') {\n      throw new Error('Every dataset case must have a non-empty name.');\n    }\n\n    const hasInput = Object.prototype.hasOwnProperty.call(item, 'input');\n    const hasGenerate = typeof (item as DatasetGeneratedCase<TInput>).generate === 'function';\n    if (hasInput === hasGenerate) {\n      throw new Error(`Case '${item.name}' must define exactly one of input or generate.`);\n    }\n\n    const tags = normalizeTags(item.tags);\n\n    if (hasInput) {\n      if (Object.prototype.hasOwnProperty.call(item, 'repeat')) {\n        throw new Error(`Static case '${item.name}' must not define repeat.`);\n      }\n      expanded.push({\n        caseIndex,\n        caseNumber: (config.startFrom ?? 1) + caseIndex,\n        name: item.name,\n        repeatIndex: 0,\n        repeatTotal: 1,\n        tags,\n        kind: 'static',\n        input: item.input,\n        seed: '',\n      });\n      caseIndex++;\n      continue;\n    }\n\n    const repeat = item.repeat ?? 1;\n    if (!Number.isInteger(repeat) || repeat <= 0) {\n      throw new Error(`Case '${item.name}' repeat must be a positive integer.`);\n    }\n\n    for (let repeatIndex = 0; repeatIndex < repeat; repeatIndex++) {\n      expanded.push({\n        caseIndex,\n        caseNumber: (config.startFrom ?? 1) + caseIndex,\n        name: item.name,\n        repeatIndex,\n        repeatTotal: repeat,\n        tags,\n        kind: 'generated',\n        generate: item.generate,\n        seed: '',\n      });\n      caseIndex++;\n    }\n  }\n\n  return expanded.map(entry => ({\n    ...entry,\n    seed: deriveCaseSeed(config.seed, entry.caseIndex, entry.caseNumber, entry.name, entry.repeatIndex),\n  }));\n}\n\nexport interface ExpandedDatasetCase<TInput> {\n  caseIndex: number;\n  caseNumber: number;\n  name: string;\n  repeatIndex: number;\n  repeatTotal: number;\n  tags: string[];\n  kind: 'static' | 'generated';\n  input?: TInput;\n  generate?: DatasetGeneratedCase<TInput>['generate'];\n  seed: string;\n}\n\nfunction selectReplayCase<TInput>(\n  cases: ExpandedDatasetCase<TInput>[],\n  selector: DatasetReplaySelector,\n): ExpandedDatasetCase<TInput> {\n  if (selector.caseNumber !== undefined) {\n    const matched = cases.find(item => item.caseNumber === selector.caseNumber);\n    if (!matched) {\n      throw new Error(`No dataset case has caseNumber ${selector.caseNumber}.`);\n    }\n    return matched;\n  }\n\n  if (selector.caseName) {\n    const repeatIndex = selector.repeatIndex ?? 0;\n    const matched = cases.find(item => item.name === selector.caseName && item.repeatIndex === repeatIndex);\n    if (!matched) {\n      throw new Error(`No dataset case matches name '${selector.caseName}' with repeatIndex ${repeatIndex}.`);\n    }\n    return matched;\n  }\n\n  throw new Error('Replay requires either caseNumber or caseName.');\n}\n\nasync function runDataset<TInput>(\n  dataset: Dataset<TInput>,\n  options: DatasetRunOptions,\n): Promise<DatasetRunResult> {\n  assertDataset(dataset);\n  const rootDir = getDatasetRootDir(options.datasetFile);\n  const config = resolveConfigPaths(normalizeConfig({\n    ...dataset.config,\n    outputDir: options.outputDir ?? dataset.config.outputDir,\n    manifestPath: options.manifestPath ?? dataset.config.manifestPath,\n  }), options.datasetFile);\n  const cases = expandDatasetCases(config);\n\n  if (cases.length === 0) {\n    throw new Error('Dataset contains no cases.');\n  }\n\n  const startedAt = Date.now();\n  const { results, execution } = await runCasePipeline(config, cases, options.mode, {\n    cleanOutputDir: options.cleanOutputDir,\n    outputDir: config.outputDir,\n    rootDir,\n  });\n  const summary = summarize(results, Date.now() - startedAt);\n  const manifest = options.mode === 'generate'\n    ? await writeManifest(config, results, summary, {\n      datasetFile: options.datasetFile ?? null,\n      execution,\n      replay: options.replay ?? null,\n    })\n    : null;\n\n  return { manifest, results, summary };\n}\n\nfunction assertDataset<TInput>(dataset: Dataset<TInput>): void {\n  if (!dataset || typeof dataset !== 'object' || dataset.__genesisDataset !== 2) {\n    throw new Error('Invalid Genesis v2 dataset object.');\n  }\n}\n\nfunction normalizeConfig<TInput>(config: DatasetConfig<TInput>): DatasetConfig<TInput> {\n  if (!config || typeof config !== 'object') {\n    throw new Error('Dataset config is missing.');\n  }\n  if (!config.solution || typeof config.solution !== 'string') {\n    throw new Error('Dataset config.solution must be a non-empty string.');\n  }\n  if (typeof config.format !== 'function') {\n    throw new Error('Dataset config.format must be a function.');\n  }\n  if (!Array.isArray(config.cases)) {\n    throw new Error('Dataset config.cases must be an array.');\n  }\n  if (config.seed === undefined || config.seed === null || config.seed === '') {\n    throw new Error('Dataset config.seed is required.');\n  }\n\n  return {\n    ...config,\n    outputDir: config.outputDir ?? 'data',\n    startFrom: Number.isInteger(config.startFrom) && (config.startFrom ?? 1) > 0 ? config.startFrom : 1,\n    runTimeoutMs: Number.isFinite(config.runTimeoutMs) && (config.runTimeoutMs ?? 10000) > 0 ? config.runTimeoutMs : 10000,\n    caseConcurrency: Number.isFinite(config.caseConcurrency) && (config.caseConcurrency ?? 0) > 0 ? config.caseConcurrency : undefined,\n    compilerFlags: [...(config.compilerFlags ?? [])],\n    manifestPath: config.manifestPath ?? undefined,\n  };\n}\n\nfunction resolveConfigPaths<TInput>(\n  config: DatasetConfig<TInput>,\n  datasetFile?: string | null,\n): DatasetConfig<TInput> {\n  if (!datasetFile) return config;\n\n  const rootDir = getDatasetRootDir(datasetFile);\n\n  return {\n    ...config,\n    solution: resolvePathFromRoot(config.solution, rootDir),\n    outputDir: resolvePathFromRoot(config.outputDir ?? 'data', rootDir),\n    manifestPath: typeof config.manifestPath === 'string'\n      ? resolvePathFromRoot(config.manifestPath, rootDir)\n      : config.manifestPath,\n  };\n}\n\nasync function runCasePipeline<TInput>(\n  config: DatasetConfig<TInput>,\n  cases: ExpandedDatasetCase<TInput>[],\n  mode: 'generate' | 'validate',\n  options: { cleanOutputDir?: boolean; outputDir?: string; rootDir?: string } = {},\n): Promise<{ results: DatasetCaseRecord[]; execution: ExecutionResult | null }> {\n  const preparedExecution = mode === 'generate'\n    ? await prepareDatasetExecution(config)\n    : null;\n  const outputDir = path.resolve(options.outputDir ?? config.outputDir ?? 'data');\n  const rootDir = path.resolve(options.rootDir ?? process.cwd());\n\n  if (mode === 'generate' && options.cleanOutputDir !== false) {\n    await resetOutputDirectory(outputDir, rootDir);\n    await fs.mkdir(outputDir, { recursive: true });\n  }\n  if (mode === 'generate') {\n    await fs.mkdir(outputDir, { recursive: true });\n  }\n\n  const concurrency = resolveConcurrency(config.caseConcurrency, cases.length);\n  const results = new Array<DatasetCaseRecord>(cases.length);\n  let nextIndex = 0;\n  const running = new Set<Promise<void>>();\n\n  const launch = (index: number) => {\n    const task = processCase(config, cases[index]!, mode, preparedExecution, outputDir)\n      .then(result => {\n        results[index] = result;\n      })\n      .finally(() => {\n        running.delete(task);\n      });\n    running.add(task);\n  };\n\n  while (nextIndex < cases.length || running.size > 0) {\n    while (nextIndex < cases.length && running.size < concurrency) {\n      launch(nextIndex);\n      nextIndex++;\n    }\n    if (running.size > 0) {\n      await Promise.race(running);\n    }\n  }\n\n  return { results, execution: preparedExecution };\n}\n\nasync function processCase<TInput>(\n  config: DatasetConfig<TInput>,\n  entry: ExpandedDatasetCase<TInput>,\n  mode: 'generate' | 'validate',\n  execution: ExecutionResult | null,\n  outputDir: string,\n): Promise<DatasetCaseRecord> {\n  const startedAt = Date.now();\n  const phases = {\n    materializeMs: 0,\n    formatMs: 0,\n    validateMs: 0,\n    writeInputMs: 0,\n    executionMs: 0,\n    writeOutputMs: 0,\n  };\n  let currentPhase: DatasetErrorPhase = 'materialize';\n  let validationSummary: DatasetValidationSummary = { status: 'not-run', durationMs: 0 };\n  let inputRecord: DatasetFileRecord | null = null;\n  let outputRecord: DatasetFileRecord | null = null;\n\n  try {\n    currentPhase = 'materialize';\n    const materializeStarted = Date.now();\n    const input = entry.kind === 'static'\n      ? entry.input\n      : await entry.generate!(buildGenerateContext(entry));\n    phases.materializeMs = Date.now() - materializeStarted;\n\n    currentPhase = 'format';\n    const formatStarted = Date.now();\n    const formatted = normalizeFormat(config.format(input as TInput));\n    const renderedInput = renderFormatDocument(formatted);\n    phases.formatMs = Date.now() - formatStarted;\n\n    currentPhase = 'validate';\n    const validationStarted = Date.now();\n    validationSummary = await runValidation(config, input as TInput, {\n      caseIndex: entry.caseIndex,\n      caseNumber: entry.caseNumber,\n      caseName: entry.name,\n      repeatIndex: entry.repeatIndex,\n      tags: entry.tags,\n      seed: entry.seed,\n      formattedInput: renderedInput,\n    });\n    phases.validateMs = Date.now() - validationStarted;\n\n    if (validationSummary.status === 'failed') {\n      return buildFailedRecord(entry, phases, startedAt, {\n        phase: 'validate',\n        kind: 'validation',\n        message: validationSummary.reason || 'Validation failed.',\n      }, validationSummary);\n    }\n\n    if (mode === 'validate') {\n      return buildSuccessRecord(entry, phases, startedAt, null, null, validationSummary);\n    }\n\n    const inPath = path.join(outputDir, `${entry.caseNumber}.in`);\n    const outPath = path.join(outputDir, `${entry.caseNumber}.out`);\n\n    currentPhase = 'write-input';\n    const writeInputStarted = Date.now();\n    inputRecord = await writeTextFile(inPath, renderedInput);\n    phases.writeInputMs = Date.now() - writeInputStarted;\n\n    if (!execution) {\n      throw new Error('Execution environment is not available.');\n    }\n\n    currentPhase = 'execution';\n    const executionStarted = Date.now();\n    await runSolution(execution, renderedInput, config.runTimeoutMs ?? 10000, outPath);\n    phases.executionMs = Date.now() - executionStarted;\n\n    currentPhase = 'write-output';\n    const writeOutputStarted = Date.now();\n    outputRecord = await describeFile(outPath);\n    phases.writeOutputMs = Date.now() - writeOutputStarted;\n\n    return {\n      caseId: entry.caseNumber,\n      caseNumber: entry.caseNumber,\n      name: entry.name,\n      repeatIndex: entry.repeatIndex,\n      tags: entry.tags,\n      seed: entry.seed,\n      status: 'success',\n      durationMs: Date.now() - startedAt,\n      phases,\n      validation: validationSummary,\n      input: inputRecord,\n      output: outputRecord,\n      error: null,\n    };\n  } catch (error) {\n    return buildFailedRecord(\n      entry,\n      phases,\n      startedAt,\n      classifyError(error, currentPhase),\n      validationSummary,\n      inputRecord,\n      outputRecord,\n    );\n  }\n}\n\nfunction buildGenerateContext<TInput>(\n  entry: ExpandedDatasetCase<TInput>,\n) {\n  return {\n    caseIndex: entry.caseIndex,\n    caseNumber: entry.caseNumber,\n    caseName: entry.name,\n    repeatIndex: entry.repeatIndex,\n    seed: entry.seed,\n    g: createGenerator(entry.seed),\n  };\n}\n\nasync function runValidation<TInput>(\n  config: DatasetConfig<TInput>,\n  input: TInput,\n  context: DatasetValidationContext,\n): Promise<DatasetValidationSummary> {\n  if (!config.validate) {\n    return { status: 'not-run', durationMs: 0 };\n  }\n\n  const startedAt = Date.now();\n  try {\n    const result = await config.validate(input, context);\n    const normalized = normalizeValidationResult(result);\n    normalized.durationMs = Date.now() - startedAt;\n    return normalized;\n  } catch (error) {\n    return {\n      status: 'failed',\n      durationMs: Date.now() - startedAt,\n      reason: getErrorMessage(error),\n    };\n  }\n}\n\nfunction normalizeValidationResult(result: DatasetValidationReturn): DatasetValidationSummary {\n  if (result === undefined || result === true) {\n    return { status: 'passed', durationMs: 0 };\n  }\n  if (result === false) {\n    return { status: 'failed', durationMs: 0, reason: 'Validation returned false.' };\n  }\n  if (typeof result === 'string') {\n    return { status: 'failed', durationMs: 0, reason: result };\n  }\n  if (result && typeof result === 'object') {\n    return result.ok\n      ? { status: 'passed', durationMs: 0 }\n      : { status: 'failed', durationMs: 0, reason: result.reason || 'Validation failed.' };\n  }\n  return { status: 'failed', durationMs: 0, reason: 'Validation returned an unsupported value.' };\n}\n\nfunction buildSuccessRecord(\n  entry: ExpandedDatasetCase<unknown>,\n  phases: DatasetCaseRecord['phases'],\n  startedAt: number,\n  input: DatasetFileRecord | null,\n  output: DatasetFileRecord | null,\n  validation: DatasetValidationSummary,\n): DatasetCaseRecord {\n  return {\n    caseId: entry.caseNumber,\n    caseNumber: entry.caseNumber,\n    name: entry.name,\n    repeatIndex: entry.repeatIndex,\n    tags: entry.tags,\n    seed: entry.seed,\n    status: 'success',\n    durationMs: Date.now() - startedAt,\n    phases,\n    validation,\n    input,\n    output,\n    error: null,\n  };\n}\n\nfunction buildFailedRecord(\n  entry: ExpandedDatasetCase<unknown>,\n  phases: DatasetCaseRecord['phases'],\n  startedAt: number,\n  error: DatasetErrorRecord,\n  validation: DatasetValidationSummary,\n  input: DatasetFileRecord | null = null,\n  output: DatasetFileRecord | null = null,\n): DatasetCaseRecord {\n  return {\n    caseId: entry.caseNumber,\n    caseNumber: entry.caseNumber,\n    name: entry.name,\n    repeatIndex: entry.repeatIndex,\n    tags: entry.tags,\n    seed: entry.seed,\n    status: 'failure',\n    durationMs: Date.now() - startedAt,\n    phases,\n    validation,\n    input,\n    output,\n    error,\n  };\n}\n\nfunction classifyError(error: unknown, phase: DatasetErrorPhase): DatasetErrorRecord {\n  const message = getErrorMessage(error);\n  if (error instanceof Error && /timeout/i.test(error.message)) {\n    return { phase: 'execution', kind: 'timeout', message };\n  }\n  if (phase === 'format') return { phase, kind: 'formatter', message };\n  if (phase === 'validate') return { phase, kind: 'validation', message };\n  if (phase === 'write-input' || phase === 'write-output' || phase === 'manifest') {\n    return { phase, kind: 'io', message };\n  }\n  if (phase === 'execution') return { phase, kind: 'execution', message };\n  if (phase === 'config') return { phase, kind: 'config', message };\n  return { phase, kind: 'generator', message };\n}\n\nfunction normalizeTags(tags?: string[]): string[] {\n  return Array.from(new Set((tags ?? []).filter(Boolean)));\n}\n\nfunction deriveCaseSeed(seed: string | number | bigint, caseIndex: number, caseNumber: number, name: string, repeatIndex: number): string {\n  return crypto.createHash('sha256')\n    .update(JSON.stringify({ seed: String(seed), caseIndex, caseNumber, name, repeatIndex }))\n    .digest('hex');\n}\n\nfunction summarize(results: DatasetCaseRecord[], durationMs: number): DatasetManifest['summary'] {\n  const succeeded = results.filter(result => result.status === 'success').length;\n  return {\n    totalCases: results.length,\n    succeeded,\n    failed: results.length - succeeded,\n    durationMs,\n  };\n}\n\nasync function writeManifest(\n  config: DatasetConfig<unknown>,\n  results: DatasetCaseRecord[],\n  summary: DatasetManifest['summary'],\n  context: {\n    datasetFile?: string | null;\n    execution?: ExecutionResult | null;\n    replay?: DatasetReplayInfo | null;\n  } = {},\n): Promise<DatasetManifest | null> {\n  const manifestPath = resolveManifestPath(config);\n  if (!manifestPath) return null;\n\n  const manifest: DatasetManifest = {\n    version: 2,\n    tool: {\n      name: 'genesis-kit',\n      version,\n    },\n    generatedAt: new Date().toISOString(),\n    dataset: {\n      modulePath: context.datasetFile ? toProjectRelativePosix(path.resolve(context.datasetFile)) : null,\n      solution: toProjectRelativePosix(path.resolve(config.solution)),\n      outputDir: toProjectRelativePosix(path.resolve(config.outputDir ?? 'data')),\n      seed: String(config.seed),\n      startFrom: config.startFrom ?? 1,\n      runTimeoutMs: config.runTimeoutMs ?? 10000,\n      caseConcurrency: config.caseConcurrency ?? null,\n      compiler: config.compiler ?? null,\n      compilerFlags: [...(config.compilerFlags ?? [])],\n      ojProfile: config.ojProfile ?? null,\n      stackSizeBytes: config.stackSizeBytes ?? null,\n      manifestPath: manifestPath ? toProjectRelativePosix(manifestPath) : null,\n    },\n    execution: context.execution ? {\n      runArgs: [...context.execution.runArgs],\n      executablePath: context.execution.executablePath,\n      fingerprint: buildExecutionFingerprint(context.execution),\n    } : null,\n    replay: context.replay ?? null,\n    summary,\n    cases: results,\n  };\n\n  await fs.mkdir(path.dirname(manifestPath), { recursive: true });\n  await fs.writeFile(manifestPath, JSON.stringify(manifest, null, 2) + '\\n', 'utf8');\n  return manifest;\n}\n\nfunction buildExecutionFingerprint(execution: ExecutionResult): string {\n  return crypto.createHash('sha256')\n    .update(JSON.stringify({\n      runArgs: execution.runArgs,\n      executablePath: execution.executablePath,\n    }))\n    .digest('hex');\n}\n\nfunction resolveManifestPath(config: DatasetConfig<unknown>): string | null {\n  if (config.manifestPath === false) {\n    return null;\n  }\n  if (typeof config.manifestPath === 'string') {\n    return path.resolve(config.manifestPath);\n  }\n  const outputDir = path.resolve(config.outputDir ?? 'data');\n  const parentDir = path.dirname(outputDir);\n  const name = path.basename(outputDir) || 'data';\n  return path.join(parentDir, `${name}.manifest.json`);\n}\n\nfunction toPortablePath(filePath: string): string {\n  return filePath.split(path.sep).join(path.posix.sep).replaceAll(path.win32.sep, path.posix.sep);\n}\n\nfunction toProjectRelativePosix(filePath: string): string {\n  const absolutePath = path.resolve(filePath);\n  const relativePath = path.relative(process.cwd(), absolutePath);\n  if (relativePath && !relativePath.startsWith('..') && !path.isAbsolute(relativePath)) {\n    return toPortablePath(relativePath);\n  }\n  return toPortablePath(absolutePath);\n}\n\nfunction getDatasetRootDir(datasetFile?: string | null): string {\n  return datasetFile ? path.dirname(path.resolve(datasetFile)) : process.cwd();\n}\n\nfunction resolvePathFromRoot(filePath: string, rootDir: string): string {\n  return path.isAbsolute(filePath) ? filePath : path.resolve(rootDir, filePath);\n}\n\nasync function prepareDatasetExecution<TInput>(config: DatasetConfig<TInput>): Promise<ExecutionResult> {\n  const result = await prepareForExecution(path.resolve(config.solution), {\n    compiler: config.compiler,\n    compilerFlags: config.compilerFlags,\n    ojProfile: config.ojProfile,\n    stackSizeBytes: config.stackSizeBytes,\n  });\n\n  if (!result) {\n    throw new Error('Failed to prepare standard solution for execution.');\n  }\n\n  return result;\n}\n\nasync function runSolution(\n  execution: ExecutionResult,\n  input: string,\n  timeoutMs: number,\n  outputPath: string,\n): Promise<void> {\n  const [command, ...args] = execution.runArgs;\n  const tempOutputPath = path.join(\n    path.dirname(outputPath),\n    `.${path.basename(outputPath)}.${process.pid}.${crypto.randomUUID()}.tmp`,\n  );\n\n  try {\n    const result = await execa(command, args, {\n      input,\n      timeout: timeoutMs,\n      reject: false,\n      cleanup: true,\n      buffer: { stdout: false, stderr: true },\n      stripFinalNewline: { stdout: false, stderr: true },\n      stdout: { file: tempOutputPath },\n    });\n\n    if (result.timedOut) {\n      throw new Error(`Execution timed out after ${timeoutMs}ms.`);\n    }\n\n    if (result.exitCode !== 0) {\n      throw new Error(result.stderr || `Command failed with exit code ${result.exitCode}.`);\n    }\n\n    await fs.rm(outputPath, { force: true });\n    await fs.rename(tempOutputPath, outputPath);\n  } catch (error) {\n    await fs.rm(tempOutputPath, { force: true });\n    throw error;\n  }\n}\n\nasync function writeTextFile(filePath: string, text: string): Promise<DatasetFileRecord> {\n  await fs.mkdir(path.dirname(filePath), { recursive: true });\n  await fs.writeFile(filePath, text, 'utf8');\n  return describeFile(filePath);\n}\n\nasync function describeFile(filePath: string): Promise<DatasetFileRecord> {\n  const stat = await fs.stat(filePath);\n  const sha256 = crypto.createHash('sha256');\n  let newlineCount = 0;\n\n  await new Promise<void>((resolve, reject) => {\n    const stream = createReadStream(filePath);\n    stream.on('data', (chunk: Buffer) => {\n      sha256.update(chunk);\n      for (const byte of chunk) {\n        if (byte === 0x0a) {\n          newlineCount++;\n        }\n      }\n    });\n    stream.once('error', reject);\n    stream.once('end', () => resolve());\n  });\n\n  return {\n    path: toProjectRelativePosix(filePath),\n    sha256: sha256.digest('hex'),\n    bytes: stat.size,\n    lines: stat.size === 0 ? 0 : newlineCount + 1,\n  };\n}\n\nasync function resetOutputDirectory(outputDir: string, rootDir: string): Promise<void> {\n  const forbiddenNames = ['src', 'node_modules', '.git', '.', '..', '/'];\n  if (forbiddenNames.includes(path.basename(outputDir))) {\n    throw new Error(`Safety check failed: refusing to remove '${outputDir}'.`);\n  }\n  const absoluteOutputDir = path.resolve(outputDir);\n  const absoluteRootDir = path.resolve(rootDir);\n  const relativePath = path.relative(absoluteRootDir, absoluteOutputDir);\n  if (absoluteOutputDir === absoluteRootDir || relativePath.startsWith('..') || path.isAbsolute(relativePath)) {\n    throw new Error(`Safety check failed: outputDir '${outputDir}' must be inside '${absoluteRootDir}'.`);\n  }\n  await fs.rm(absoluteOutputDir, { recursive: true, force: true });\n}\n\nfunction resolveConcurrency(caseConcurrency: number | undefined, totalCases: number): number {\n  const preferred = caseConcurrency ?? os.cpus().length;\n  if (!Number.isFinite(preferred) || preferred <= 0) {\n    return 1;\n  }\n  return Math.max(1, Math.min(totalCases, Math.floor(preferred)));\n}\n\nfunction getErrorMessage(error: unknown): string {\n  if (error instanceof Error && error.message) {\n    return error.message;\n  }\n  return String(error);\n}\n","// Generated by scripts/build-ai-contract.ts\n// Do not edit this file by hand.\n\nimport type { AiContractGeneratedData } from './ai-contract.types';\n\nexport const AI_CONTRACT_GENERATED: AiContractGeneratedData = {\n  \"headerDeclarations\": [\n    {\n      \"name\": \"SeedInput\",\n      \"declarationLines\": [\n        \"export type SeedInput = string | number | bigint;\"\n      ]\n    },\n    {\n      \"name\": \"OjProfile\",\n      \"declarationLines\": [\n        \"export type OjProfile = 'auto' | 'linux' | 'windows' | 'none';\"\n      ]\n    },\n    {\n      \"name\": \"MaybePromise\",\n      \"declarationLines\": [\n        \"export type MaybePromise<T> = T | Promise<T>;\"\n      ]\n    },\n    {\n      \"name\": \"DebugOptions\",\n      \"declarationLines\": [\n        \"export interface DebugOptions {\",\n        \"    separator?: string;\",\n        \"    printDims?: boolean;\",\n        \"    printType?: boolean;\",\n        \"    printStats?: boolean;\",\n        \"    truncate?: number;\",\n        \"    colors?: boolean;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"WeightOption\",\n      \"declarationLines\": [\n        \"export type WeightOption = boolean | [\",\n        \"    min: number,\",\n        \"    max: number\",\n        \"];\"\n      ]\n    },\n    {\n      \"name\": \"GraphType\",\n      \"declarationLines\": [\n        \"export type GraphType = 'simple' | 'tree' | 'dag' | 'bipartite' | 'wheel' | 'complete';\"\n      ]\n    },\n    {\n      \"name\": \"GraphOptions\",\n      \"declarationLines\": [\n        \"export interface GraphOptions {\",\n        \"    type?: GraphType;\",\n        \"    directed?: boolean;\",\n        \"    weighted?: WeightOption;\",\n        \"    connected?: boolean;\",\n        \"    noSelfLoops?: boolean;\",\n        \"    oneBased?: boolean;\",\n        \"    negativeCycle?: boolean;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"TreeType\",\n      \"declarationLines\": [\n        \"export type TreeType = 'random' | 'path' | 'star';\"\n      ]\n    },\n    {\n      \"name\": \"TreeOptions\",\n      \"declarationLines\": [\n        \"export interface TreeOptions {\",\n        \"    type?: TreeType;\",\n        \"    weighted?: WeightOption;\",\n        \"    oneBased?: boolean;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"BinaryTreeType\",\n      \"declarationLines\": [\n        \"export type BinaryTreeType = 'random' | 'complete' | 'skewed';\"\n      ]\n    },\n    {\n      \"name\": \"BinaryTreeOptions\",\n      \"declarationLines\": [\n        \"export interface BinaryTreeOptions {\",\n        \"    type?: BinaryTreeType;\",\n        \"    oneBased?: boolean;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"SequenceOptions\",\n      \"declarationLines\": [\n        \"export type SequenceOptions = {\",\n        \"    type: 'arithmetic';\",\n        \"    start: number;\",\n        \"    diff: number;\",\n        \"    count: number;\",\n        \"} | {\",\n        \"    type: 'geometric';\",\n        \"    start: number;\",\n        \"    ratio: number;\",\n        \"    count: number;\",\n        \"} | {\",\n        \"    type: 'fibonacci';\",\n        \"    count: number;\",\n        \"    first?: number;\",\n        \"    second?: number;\",\n        \"} | {\",\n        \"    type: 'custom';\",\n        \"    init: number[];\",\n        \"    fn: (prev: number[]) => number;\",\n        \"    count: number;\",\n        \"};\"\n      ]\n    },\n    {\n      \"name\": \"FormatAtom\",\n      \"declarationLines\": [\n        \"export type FormatAtom = string | number | bigint | boolean | null | undefined;\"\n      ]\n    },\n    {\n      \"name\": \"FormatLine\",\n      \"declarationLines\": [\n        \"export interface FormatLine {\",\n        \"    readonly kind: 'line';\",\n        \"    readonly items: readonly FormatAtom[];\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"FormatTable\",\n      \"declarationLines\": [\n        \"export interface FormatTable {\",\n        \"    readonly kind: 'table';\",\n        \"    readonly rows: readonly (readonly FormatAtom[])[];\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"FormatGrid\",\n      \"declarationLines\": [\n        \"export interface FormatGrid {\",\n        \"    readonly kind: 'grid';\",\n        \"    readonly rows: readonly (string | readonly FormatAtom[])[];\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"FormatRaw\",\n      \"declarationLines\": [\n        \"export interface FormatRaw {\",\n        \"    readonly kind: 'raw';\",\n        \"    readonly text: string;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"FormatNode\",\n      \"declarationLines\": [\n        \"export type FormatNode = FormatLine | FormatTable | FormatGrid | FormatRaw;\"\n      ]\n    },\n    {\n      \"name\": \"FormatDocument\",\n      \"declarationLines\": [\n        \"export interface FormatDocument {\",\n        \"    readonly __genesisFormat: 2;\",\n        \"    readonly nodes: readonly FormatNode[];\",\n        \"}\"\n      ]\n    }\n  ],\n  \"datasetDeclarations\": [\n    {\n      \"name\": \"DatasetGenerateContext\",\n      \"declarationLines\": [\n        \"export interface DatasetGenerateContext {\",\n        \"    caseIndex: number;\",\n        \"    caseNumber: number;\",\n        \"    caseName: string;\",\n        \"    repeatIndex: number;\",\n        \"    seed: string;\",\n        \"    g: DatasetGenerator;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"DatasetValidationContext\",\n      \"declarationLines\": [\n        \"export interface DatasetValidationContext {\",\n        \"    caseIndex: number;\",\n        \"    caseNumber: number;\",\n        \"    caseName: string;\",\n        \"    repeatIndex: number;\",\n        \"    tags: string[];\",\n        \"    seed: string;\",\n        \"    formattedInput: string;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"DatasetValidationResult\",\n      \"declarationLines\": [\n        \"export interface DatasetValidationResult {\",\n        \"    ok: boolean;\",\n        \"    reason?: string;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"DatasetValidationReturn\",\n      \"declarationLines\": [\n        \"export type DatasetValidationReturn = void | boolean | string | DatasetValidationResult;\"\n      ]\n    },\n    {\n      \"name\": \"DatasetStaticCase\",\n      \"declarationLines\": [\n        \"export interface DatasetStaticCase<TInput> {\",\n        \"    name: string;\",\n        \"    tags?: string[];\",\n        \"    input: TInput;\",\n        \"    generate?: never;\",\n        \"    repeat?: never;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"DatasetGeneratedCase\",\n      \"declarationLines\": [\n        \"export interface DatasetGeneratedCase<TInput> {\",\n        \"    name: string;\",\n        \"    tags?: string[];\",\n        \"    repeat?: number;\",\n        \"    generate(ctx: DatasetGenerateContext): MaybePromise<TInput>;\",\n        \"    input?: never;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"DatasetCase\",\n      \"declarationLines\": [\n        \"export type DatasetCase<TInput> = DatasetStaticCase<TInput> | DatasetGeneratedCase<TInput>;\"\n      ]\n    },\n    {\n      \"name\": \"DatasetConfig\",\n      \"declarationLines\": [\n        \"export interface DatasetConfig<TInput> {\",\n        \"    solution: string;\",\n        \"    outputDir?: string;\",\n        \"    seed: SeedInput;\",\n        \"    startFrom?: number;\",\n        \"    runTimeoutMs?: number;\",\n        \"    caseConcurrency?: number;\",\n        \"    compiler?: string;\",\n        \"    compilerFlags?: string[];\",\n        \"    ojProfile?: OjProfile;\",\n        \"    stackSizeBytes?: number;\",\n        \"    manifestPath?: string | false;\",\n        \"    format(input: TInput): FormatDocument | FormatNode;\",\n        \"    validate?(input: TInput, context: DatasetValidationContext): MaybePromise<DatasetValidationReturn>;\",\n        \"    cases: DatasetCase<TInput>[];\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"Dataset\",\n      \"declarationLines\": [\n        \"export interface Dataset<TInput = unknown> {\",\n        \"    readonly __genesisDataset: 2;\",\n        \"    readonly config: DatasetConfig<TInput>;\",\n        \"}\"\n      ]\n    },\n    {\n      \"name\": \"defineDataset\",\n      \"declarationLines\": [\n        \"export function defineDataset<TInput>(config: DatasetConfig<TInput>): Dataset<TInput>;\"\n      ]\n    }\n  ],\n  \"fmtMethods\": [\n    {\n      \"name\": \"line\",\n      \"signature\": \"line(...items: FormatAtom[]): FormatLine;\",\n      \"declarationLines\": [\n        \"line(...items: FormatAtom[]): FormatLine;\"\n      ]\n    },\n    {\n      \"name\": \"lines\",\n      \"signature\": \"lines(...rows: (FormatNode | readonly FormatAtom[] | FormatAtom)[]): FormatDocument;\",\n      \"declarationLines\": [\n        \"lines(...rows: (FormatNode | readonly FormatAtom[] | FormatAtom)[]): FormatDocument;\"\n      ]\n    },\n    {\n      \"name\": \"table\",\n      \"signature\": \"table(rows: readonly (readonly FormatAtom[])[]): FormatTable;\",\n      \"declarationLines\": [\n        \"table(rows: readonly (readonly FormatAtom[])[]): FormatTable;\"\n      ]\n    },\n    {\n      \"name\": \"grid\",\n      \"signature\": \"grid(rows: readonly (string | readonly FormatAtom[])[]): FormatGrid;\",\n      \"declarationLines\": [\n        \"grid(rows: readonly (string | readonly FormatAtom[])[]): FormatGrid;\"\n      ]\n    },\n    {\n      \"name\": \"raw\",\n      \"signature\": \"raw(text: string): FormatRaw;\",\n      \"declarationLines\": [\n        \"raw(text: string): FormatRaw;\"\n      ]\n    }\n  ],\n  \"generatorMethods\": [\n    {\n      \"name\": \"int\",\n      \"signature\": \"int(min: number, max: number): number;\",\n      \"declarationLines\": [\n        \"int(min: number, max: number): number;\"\n      ]\n    },\n    {\n      \"name\": \"ints\",\n      \"signature\": \"ints(count: number, min: number, max: number): number[];\",\n      \"declarationLines\": [\n        \"ints(count: number, min: number, max: number): number[];\"\n      ]\n    },\n    {\n      \"name\": \"distinctInts\",\n      \"signature\": \"distinctInts(count: number, min: number, max: number): number[];\",\n      \"declarationLines\": [\n        \"distinctInts(count: number, min: number, max: number): number[];\"\n      ]\n    },\n    {\n      \"name\": \"float\",\n      \"signature\": \"float(min: number, max: number, precision?: number): number;\",\n      \"declarationLines\": [\n        \"float(min: number, max: number, precision?: number): number;\"\n      ]\n    },\n    {\n      \"name\": \"even\",\n      \"signature\": \"even(min: number, max: number): number;\",\n      \"declarationLines\": [\n        \"even(min: number, max: number): number;\"\n      ]\n    },\n    {\n      \"name\": \"odd\",\n      \"signature\": \"odd(min: number, max: number): number;\",\n      \"declarationLines\": [\n        \"odd(min: number, max: number): number;\"\n      ]\n    },\n    {\n      \"name\": \"prime\",\n      \"signature\": \"prime(min: number, max: number): number;\",\n      \"declarationLines\": [\n        \"prime(min: number, max: number): number;\"\n      ]\n    },\n    {\n      \"name\": \"coprime\",\n      \"signature\": \"coprime(min: number, max: number): [\",\n      \"declarationLines\": [\n        \"coprime(min: number, max: number): [\",\n        \"    number,\",\n        \"    number\",\n        \"];\"\n      ]\n    },\n    {\n      \"name\": \"divisible\",\n      \"signature\": \"divisible(min: number, max: number, d: number): number;\",\n      \"declarationLines\": [\n        \"divisible(min: number, max: number, d: number): number;\"\n      ]\n    },\n    {\n      \"name\": \"sequence\",\n      \"signature\": \"sequence(options: SequenceOptions): number[];\",\n      \"declarationLines\": [\n        \"sequence(options: SequenceOptions): number[];\"\n      ]\n    },\n    {\n      \"name\": \"string\",\n      \"signature\": \"string(len: number, charset?: string): string;\",\n      \"declarationLines\": [\n        \"string(len: number, charset?: string): string;\"\n      ]\n    },\n    {\n      \"name\": \"palindrome\",\n      \"signature\": \"palindrome(len: number, charset?: string): string;\",\n      \"declarationLines\": [\n        \"palindrome(len: number, charset?: string): string;\"\n      ]\n    },\n    {\n      \"name\": \"word\",\n      \"signature\": \"word(minLen: number, maxLen: number): string;\",\n      \"declarationLines\": [\n        \"word(minLen: number, maxLen: number): string;\"\n      ]\n    },\n    {\n      \"name\": \"words\",\n      \"signature\": \"words(count: number, minLen: number, maxLen: number): string[];\",\n      \"declarationLines\": [\n        \"words(count: number, minLen: number, maxLen: number): string[];\"\n      ]\n    },\n    {\n      \"name\": \"brackets\",\n      \"signature\": \"brackets(n: number, options?: {\",\n      \"declarationLines\": [\n        \"brackets(n: number, options?: {\",\n        \"    types?: string;\",\n        \"}): string;\"\n      ]\n    },\n    {\n      \"name\": \"array\",\n      \"signature\": \"array<T>(count: number, itemGenerator: (index: number) => T): T[];\",\n      \"declarationLines\": [\n        \"array<T>(count: number, itemGenerator: (index: number) => T): T[];\"\n      ]\n    },\n    {\n      \"name\": \"sorted\",\n      \"signature\": \"sorted(count: number, min: number, max: number, options?: {\",\n      \"declarationLines\": [\n        \"sorted(count: number, min: number, max: number, options?: {\",\n        \"    order?: 'asc' | 'desc' | 'strictlyAsc' | 'strictlyDesc';\",\n        \"}): number[];\"\n      ]\n    },\n    {\n      \"name\": \"sparse\",\n      \"signature\": \"sparse(count: number, min: number, max: number, gap: number): number[];\",\n      \"declarationLines\": [\n        \"sparse(count: number, min: number, max: number, gap: number): number[];\"\n      ]\n    },\n    {\n      \"name\": \"partition\",\n      \"signature\": \"partition(count: number, sum: number, options?: {\",\n      \"declarationLines\": [\n        \"partition(count: number, sum: number, options?: {\",\n        \"    minVal?: number;\",\n        \"}): number[];\"\n      ]\n    },\n    {\n      \"name\": \"matrix\",\n      \"signature\": \"matrix<T>(rows: number, cols: number, cellGenerator: (r: number, c: number) => T): T[][];\",\n      \"declarationLines\": [\n        \"matrix<T>(rows: number, cols: number, cellGenerator: (r: number, c: number) => T): T[][];\"\n      ]\n    },\n    {\n      \"name\": \"grid01\",\n      \"signature\": \"grid01(rows: number, cols: number, density?: number): number[][];\",\n      \"declarationLines\": [\n        \"grid01(rows: number, cols: number, density?: number): number[][];\"\n      ]\n    },\n    {\n      \"name\": \"maze\",\n      \"signature\": \"maze(rows: number, cols: number, options?: {\",\n      \"declarationLines\": [\n        \"maze(rows: number, cols: number, options?: {\",\n        \"    wall?: string;\",\n        \"    road?: string;\",\n        \"}): string[][];\"\n      ]\n    },\n    {\n      \"name\": \"intervals\",\n      \"signature\": \"intervals(n: number, min: number, max: number, options?: {\",\n      \"declarationLines\": [\n        \"intervals(n: number, min: number, max: number, options?: {\",\n        \"    overlapping?: boolean;\",\n        \"    sorted?: boolean;\",\n        \"    minLen?: number;\",\n        \"    maxLen?: number;\",\n        \"    allowGaps?: boolean;\",\n        \"}): number[][];\"\n      ]\n    },\n    {\n      \"name\": \"permutation\",\n      \"signature\": \"permutation(n: number, oneBased?: boolean): number[];\",\n      \"declarationLines\": [\n        \"permutation(n: number, oneBased?: boolean): number[];\"\n      ]\n    },\n    {\n      \"name\": \"shuffle\",\n      \"signature\": \"shuffle<T>(array: readonly T[]): T[];\",\n      \"declarationLines\": [\n        \"shuffle<T>(array: readonly T[]): T[];\"\n      ]\n    },\n    {\n      \"name\": \"sample\",\n      \"signature\": \"sample<T>(population: readonly T[]): T;\",\n      \"declarationLines\": [\n        \"sample<T>(population: readonly T[]): T;\",\n        \"sample<T>(population: readonly T[], k: number): T[];\"\n      ]\n    },\n    {\n      \"name\": \"chunk\",\n      \"signature\": \"chunk<T>(array: readonly T[], size: number): T[][];\",\n      \"declarationLines\": [\n        \"chunk<T>(array: readonly T[], size: number): T[][];\"\n      ]\n    },\n    {\n      \"name\": \"tree\",\n      \"signature\": \"tree(n: number, options?: TreeOptions): number[][];\",\n      \"declarationLines\": [\n        \"tree(n: number, options?: TreeOptions): number[][];\"\n      ]\n    },\n    {\n      \"name\": \"graph\",\n      \"signature\": \"graph(n: number, m: number, options?: GraphOptions): number[][];\",\n      \"declarationLines\": [\n        \"graph(n: number, m: number, options?: GraphOptions): number[][];\"\n      ]\n    },\n    {\n      \"name\": \"points\",\n      \"signature\": \"points(n: number, minVal: number, maxVal: number, options?: {\",\n      \"declarationLines\": [\n        \"points(n: number, minVal: number, maxVal: number, options?: {\",\n        \"    type?: 'random' | 'collinear';\",\n        \"}): number[][];\"\n      ]\n    },\n    {\n      \"name\": \"convexHull\",\n      \"signature\": \"convexHull(n: number, minVal: number, maxVal: number): number[][];\",\n      \"declarationLines\": [\n        \"convexHull(n: number, minVal: number, maxVal: number): number[][];\"\n      ]\n    },\n    {\n      \"name\": \"polygon\",\n      \"signature\": \"polygon(n: number, minVal: number, maxVal: number): number[][];\",\n      \"declarationLines\": [\n        \"polygon(n: number, minVal: number, maxVal: number): number[][];\"\n      ]\n    },\n    {\n      \"name\": \"binaryTree\",\n      \"signature\": \"binaryTree(n: number, options?: BinaryTreeOptions): {\",\n      \"declarationLines\": [\n        \"binaryTree(n: number, options?: BinaryTreeOptions): {\",\n        \"    edges: number[][];\",\n        \"    root: number;\",\n        \"};\"\n      ]\n    },\n    {\n      \"name\": \"isLeap\",\n      \"signature\": \"isLeap(year: number): boolean;\",\n      \"declarationLines\": [\n        \"isLeap(year: number): boolean;\"\n      ]\n    },\n    {\n      \"name\": \"year\",\n      \"signature\": \"year(minYear?: number, maxYear?: number): number;\",\n      \"declarationLines\": [\n        \"year(minYear?: number, maxYear?: number): number;\"\n      ]\n    },\n    {\n      \"name\": \"date\",\n      \"signature\": \"date(options?: {\",\n      \"declarationLines\": [\n        \"date(options?: {\",\n        \"    minYear?: number;\",\n        \"    maxYear?: number;\",\n        \"    format?: string;\",\n        \"}): string;\"\n      ]\n    },\n    {\n      \"name\": \"debug\",\n      \"signature\": \"debug<T>(data: T, options?: DebugOptions): void;\",\n      \"declarationLines\": [\n        \"debug<T>(data: T, options?: DebugOptions): void;\",\n        \"debug<T>(label: string, data: T, options?: DebugOptions): void;\"\n      ]\n    }\n  ],\n  \"baseMethods\": [\n    {\n      \"name\": \"convert\",\n      \"signature\": \"convert(input: string | number | bigint, fromRadix: number, toRadix: number): string;\",\n      \"declarationLines\": [\n        \"convert(input: string | number | bigint, fromRadix: number, toRadix: number): string;\"\n      ]\n    },\n    {\n      \"name\": \"binToHex\",\n      \"signature\": \"binToHex(binString: string): string;\",\n      \"declarationLines\": [\n        \"binToHex(binString: string): string;\"\n      ]\n    },\n    {\n      \"name\": \"hexToBin\",\n      \"signature\": \"hexToBin(hexString: string): string;\",\n      \"declarationLines\": [\n        \"hexToBin(hexString: string): string;\"\n      ]\n    },\n    {\n      \"name\": \"digits\",\n      \"signature\": \"digits(length: number, radix: number): string;\",\n      \"declarationLines\": [\n        \"digits(length: number, radix: number): string;\"\n      ]\n    }\n  ],\n  \"charsetProperties\": [\n    \"LOWERCASE\",\n    \"UPPERCASE\",\n    \"DIGITS\",\n    \"ALPHANUMERIC\",\n    \"ALPHA\",\n    \"BASE36\"\n  ]\n} as const;\n","import { AI_CONTRACT_GENERATED } from './ai-contract.generated';\n\ntype AiContractMethodSpec = {\n  signature: string;\n  declarationLines: readonly string[];\n};\n\ntype AiContractBlock = {\n  name: string;\n  declarationLines: readonly string[];\n};\n\ntype AiMethodPatch = {\n  docLines?: readonly string[];\n  declarationLines?: readonly string[];\n  signature?: string;\n};\n\ntype AiBlockPatch = {\n  docLines?: readonly string[];\n  declarationLines?: readonly string[];\n};\n\ntype AiFmtMethodName = typeof AI_CONTRACT_GENERATED.fmtMethods[number]['name'];\ntype AiGeneratorMethodName = typeof AI_CONTRACT_GENERATED.generatorMethods[number]['name'];\ntype AiBaseMethodName = typeof AI_CONTRACT_GENERATED.baseMethods[number]['name'];\ntype AiCharsetPropertyName = typeof AI_CONTRACT_GENERATED.charsetProperties[number];\n\nexport type AiProblemProfile = {\n  multiTest: boolean;\n  matrix: boolean;\n  tree: boolean;\n  graph: boolean;\n  interval: boolean;\n  string: boolean;\n  grid: boolean;\n  geometry: boolean;\n};\n\nexport type AiContractSelection = {\n  profile: AiProblemProfile;\n  fmtMethods: readonly AiFmtMethodName[];\n  generatorMethods: readonly AiGeneratorMethodName[];\n  baseMethods: readonly AiBaseMethodName[];\n  charsetProperties: readonly AiCharsetPropertyName[];\n  canonicalPatterns: readonly string[];\n};\n\nexport type AiContractAllowance = {\n  fmtMethods: readonly string[];\n  generatorMethods: readonly string[];\n  baseMethods: readonly string[];\n  charsetProperties: readonly string[];\n  generatorPropertyRoots: readonly string[];\n};\n\nconst FMT_METHOD_PATCHES: Partial<Record<AiFmtMethodName, AiMethodPatch>> = {\n  lines: {\n    docLines: [\n      '/** Multiple rows. Each item may be one atom, one atom array, or one fmt.* node. */',\n      '/** Atom arrays become one space-separated line; nested fmt.* nodes are embedded verbatim. */',\n    ],\n  },\n  grid: {\n    docLines: [\n      '/** Grid-style rows with no separator inside each row. */',\n      '/** Use fmt.table(...) instead when row items should be separated by spaces. */',\n    ],\n  },\n  raw: {\n    docLines: [\n      '/** Raw text passthrough. */',\n      '/** Text is emitted exactly as provided, including embedded newlines. */',\n    ],\n  },\n};\n\nconst GENERATOR_METHOD_PATCHES: Partial<Record<AiGeneratorMethodName, AiMethodPatch>> = {\n  sample: {\n    docLines: [\n      '/** Pick one element from a candidate list. */',\n      '/** Pick k distinct elements without replacement from a candidate list. */',\n    ],\n  },\n  sparse: {\n    docLines: [\n      '/** Numeric array whose sorted order has adjacent differences >= gap. */',\n      '/** Final output order may be shuffled. Sort it yourself if order matters. */',\n    ],\n  },\n  partition: {\n    docLines: [\n      '/** Positive integers whose sum is sum. */',\n      '/** Final output order may be shuffled. */',\n    ],\n  },\n  intervals: {\n    docLines: [\n      '/** Interval list. */',\n      '/** When overlapping is false and sorted is not set, interval order may be shuffled. */',\n    ],\n    declarationLines: [\n      \"intervals(n: number, min: number, max: number, options?: { overlapping?: boolean; sorted?: boolean; minLen?: number; maxLen?: number; allowGaps?: boolean; }): Array<[number, number]>;\",\n    ],\n  },\n  tree: {\n    declarationLines: [\n      'tree(n: number, options?: TreeOptions): Array<[number, number] | [number, number, number]>;',\n    ],\n  },\n  graph: {\n    declarationLines: [\n      'graph(n: number, m: number, options?: GraphOptions): Array<[number, number] | [number, number, number]>;',\n    ],\n  },\n  points: {\n    declarationLines: [\n      \"points(n: number, minVal: number, maxVal: number, options?: { type?: 'random' | 'collinear'; }): Array<[number, number]>;\",\n    ],\n  },\n  convexHull: {\n    declarationLines: [\n      'convexHull(n: number, minVal: number, maxVal: number): Array<[number, number]>;',\n    ],\n  },\n  polygon: {\n    declarationLines: [\n      'polygon(n: number, minVal: number, maxVal: number): Array<[number, number]>;',\n    ],\n  },\n  binaryTree: {\n    docLines: [\n      '/** Binary tree edges and the actual root label of this generated tree. */',\n    ],\n    declarationLines: [\n      'binaryTree(n: number, options?: BinaryTreeOptions): {',\n      '  edges: Array<[number, number]>;',\n      '  root: number;',\n      '};',\n    ],\n  },\n  date: {\n    docLines: [\n      '/** Supported format tokens are YYYY, MM, and DD. */',\n    ],\n  },\n};\n\nconst BASE_METHOD_PATCHES: Partial<Record<AiBaseMethodName, AiMethodPatch>> = {\n  digits: {\n    docLines: [\n      '/** For length > 1, the first digit is non-zero. */',\n    ],\n  },\n};\n\nconst DATASET_DECLARATION_PATCHES: Partial<Record<string, AiBlockPatch>> = {\n  DatasetValidationReturn: {\n    docLines: [\n      '/** void/true => pass, false => fail with a generic message, string => fail with that reason. */',\n      '/** { ok: false, reason } => fail with a structured reason. */',\n    ],\n  },\n};\n\nconst RESOLVED_HEADER_DECLARATIONS = AI_CONTRACT_GENERATED.headerDeclarations.map(block => resolveBlock(block));\nconst RESOLVED_DATASET_DECLARATIONS = AI_CONTRACT_GENERATED.datasetDeclarations.map(block =>\n  resolveBlock(block, DATASET_DECLARATION_PATCHES[block.name]),\n);\nconst RESOLVED_FMT_METHODS = AI_CONTRACT_GENERATED.fmtMethods.map(method =>\n  resolveMethod(method, FMT_METHOD_PATCHES[method.name as AiFmtMethodName]),\n);\nconst RESOLVED_GENERATOR_METHODS = AI_CONTRACT_GENERATED.generatorMethods.map(method =>\n  resolveMethod(method, GENERATOR_METHOD_PATCHES[method.name as AiGeneratorMethodName]),\n);\nconst RESOLVED_BASE_METHODS = AI_CONTRACT_GENERATED.baseMethods.map(method =>\n  resolveMethod(method, BASE_METHOD_PATCHES[method.name as AiBaseMethodName]),\n);\n\nconst RESOLVED_FMT_METHOD_MAP = Object.fromEntries(\n  RESOLVED_FMT_METHODS.map(method => [method.name, method]),\n) as Record<AiFmtMethodName, AiContractMethodSpec & { name: AiFmtMethodName }>;\n\nconst RESOLVED_GENERATOR_METHOD_MAP = Object.fromEntries(\n  RESOLVED_GENERATOR_METHODS.map(method => [method.name, method]),\n) as Record<AiGeneratorMethodName, AiContractMethodSpec & { name: AiGeneratorMethodName }>;\n\nconst RESOLVED_BASE_METHOD_MAP = Object.fromEntries(\n  RESOLVED_BASE_METHODS.map(method => [method.name, method]),\n) as Record<AiBaseMethodName, AiContractMethodSpec & { name: AiBaseMethodName }>;\n\nexport const AI_FMT_METHOD_SIGNATURES = Object.fromEntries(\n  RESOLVED_FMT_METHODS.map(method => [method.name, method.signature]),\n) as Record<AiFmtMethodName, string>;\n\nexport const AI_GENERATOR_METHOD_SIGNATURES = Object.fromEntries(\n  RESOLVED_GENERATOR_METHODS.map(method => [method.name, method.signature]),\n) as Record<AiGeneratorMethodName, string>;\n\nexport const AI_BASE_METHOD_SIGNATURES = Object.fromEntries(\n  RESOLVED_BASE_METHODS.map(method => [method.name, method.signature]),\n) as Record<AiBaseMethodName, string>;\n\nexport const AI_CHARSET_PROPERTIES = Object.fromEntries(\n  AI_CONTRACT_GENERATED.charsetProperties.map(property => [property, property]),\n) as Record<AiCharsetPropertyName, AiCharsetPropertyName>;\n\nconst ALL_FMT_METHOD_NAMES = RESOLVED_FMT_METHODS.map(method => method.name) as AiFmtMethodName[];\nconst ALL_GENERATOR_METHOD_NAMES = RESOLVED_GENERATOR_METHODS.map(method => method.name) as AiGeneratorMethodName[];\nconst ALL_BASE_METHOD_NAMES = RESOLVED_BASE_METHODS.map(method => method.name) as AiBaseMethodName[];\nconst ALL_CHARSET_PROPERTY_NAMES = [...AI_CONTRACT_GENERATED.charsetProperties] as AiCharsetPropertyName[];\n\nfunction resolveBlock(\n  block: typeof AI_CONTRACT_GENERATED.headerDeclarations[number] | typeof AI_CONTRACT_GENERATED.datasetDeclarations[number],\n  patch?: AiBlockPatch,\n): AiContractBlock {\n  return {\n    name: block.name,\n    declarationLines: [\n      ...(patch?.docLines ?? []),\n      ...(patch?.declarationLines ?? block.declarationLines),\n    ],\n  };\n}\n\nfunction resolveMethod(\n  method: typeof AI_CONTRACT_GENERATED.fmtMethods[number] | typeof AI_CONTRACT_GENERATED.generatorMethods[number] | typeof AI_CONTRACT_GENERATED.baseMethods[number],\n  patch?: AiMethodPatch,\n): AiContractMethodSpec & { name: string } {\n  const declarationLines = [\n    ...(patch?.docLines ?? []),\n    ...(patch?.declarationLines ?? method.declarationLines),\n  ];\n\n  return {\n    name: method.name,\n    declarationLines,\n    signature: patch?.signature ?? firstDeclarationLine(declarationLines),\n  };\n}\n\nfunction firstDeclarationLine(lines: readonly string[]): string {\n  const line = lines.find(item => item.trim().length > 0 && !item.trim().startsWith('/**'));\n  if (!line) {\n    throw new Error('Resolved AI contract declaration lines are empty.');\n  }\n  return line.trim();\n}\n\nfunction extractSectionBlock(statement: string, headings: string[]): string {\n  const normalizedHeadings = new Set(headings.map(item => item.toLowerCase()));\n  const lines = statement.split(/\\r?\\n/);\n  const collected: string[] = [];\n  let active = false;\n\n  for (const line of lines) {\n    const trimmed = line.trim();\n    const heading = trimmed.replace(/^#+\\s*/, '').toLowerCase();\n\n    if (normalizedHeadings.has(heading)) {\n      active = true;\n      collected.push(line);\n      continue;\n    }\n\n    if (active && /^#+\\s+/.test(trimmed)) {\n      break;\n    }\n\n    if (active) {\n      collected.push(line);\n    }\n  }\n\n  return collected.join('\\n').trim();\n}\n\nfunction normalizeStatementText(text: string): string {\n  return text\n    .toLowerCase()\n    .replace(/[`*_>#]/g, ' ')\n    .replace(/\\$/g, '')\n    .replace(/[()[\\]{}，。；：,.:!?]/g, ' ')\n    .replace(/\\s+/g, ' ')\n    .trim();\n}\n\nfunction buildStructuralText(statement: string): string {\n  const parts = [\n    extractSectionBlock(statement, ['输入格式', '输入', 'input format', 'input']),\n    extractSectionBlock(statement, ['数据范围', 'constraints', 'limits']),\n    extractSectionBlock(statement, ['格式', 'format']),\n  ].filter(Boolean);\n\n  return normalizeStatementText(parts.join('\\n\\n') || statement);\n}\n\nfunction buildWholeText(statement: string): string {\n  return normalizeStatementText(statement);\n}\n\nfunction matchesAny(text: string, patterns: RegExp[]): boolean {\n  return patterns.some(pattern => pattern.test(text));\n}\n\nexport function analyzeProblemStatement(statement: string): AiProblemProfile {\n  const structuralText = buildStructuralText(statement);\n  const wholeText = buildWholeText(statement);\n\n  const multiTest = matchesAny(structuralText, [\n    /测试用例组数/,\n    /多组测试/,\n    /接下来\\s*t\\s*组/,\n    /for each test case/,\n    /multiple test cases/,\n    /the next t/,\n  ]);\n\n  const matrix = matchesAny(structuralText, [\n    /(矩阵|matrix).*(接下来.*n.*行|n.*行.*每行.*m)/,\n    /(接下来.*n.*行|n.*行.*每行.*m).*(矩阵|matrix)/,\n    /n\\s+rows?\\s+and\\s+m\\s+columns?/,\n  ]);\n\n  const grid = matchesAny(structuralText, [\n    /网格/,\n    /\\bgrid\\b/,\n    /迷宫/,\n    /\\bmaze\\b/,\n    /字符矩阵/,\n    /01矩阵/,\n  ]);\n\n  const tree = matchesAny(structuralText, [\n    /输入保证是一棵树/,\n    /(树|tree).*(边|edge)/,\n    /(接下来.*n\\s*-\\s*1.*行|next\\s+n\\s*-\\s*1\\s+lines?).*(边|edge)/,\n  ]);\n\n  const graph = !tree && matchesAny(structuralText, [\n    /(图|graph).*(边|edge)/,\n    /(接下来.*m.*行|next\\s+m\\s+lines?).*(边|edge)/,\n  ]);\n\n  const interval = matchesAny(structuralText, [\n    /区间/,\n    /\\binterval\\b/,\n    /\\[l/i,\n    /\\[ r/i,\n  ]);\n\n  const string = matchesAny(structuralText, [\n    /字符串/,\n    /\\bstring\\b/,\n    /字符序列/,\n    /character sequence/,\n    /单词/,\n  ]);\n\n  const geometry = matchesAny(wholeText, [\n    /坐标/,\n    /\\bcoordinate\\b/,\n    /\\bcoordinates\\b/,\n    /\\bpolygon\\b/,\n    /多边形/,\n    /几何/,\n    /平面/,\n    /二维点/,\n  ]);\n\n  return {\n    multiTest,\n    matrix,\n    tree,\n    graph,\n    interval,\n    string,\n    grid,\n    geometry,\n  };\n}\n\nexport function selectAiContract(statement: string): AiContractSelection {\n  const profile = analyzeProblemStatement(statement);\n\n  const canonicalPatterns: string[] = [\n    'Default dataset shape: export default defineDataset<Input>({ solution, seed, format, validate, cases })',\n    'Static case: { name, input }',\n    'Generated case: { name, repeat?, generate: ({ g, caseIndex, caseNumber, caseName, repeatIndex, seed }) => input }',\n    'Canonical explicit format style: fmt.lines(fmt.line(...), fmt.table(...), fmt.grid(...), fmt.raw(...))',\n    'Matrix/grid input pattern: { n, m, rows } with fmt.lines(fmt.line(n, m), fmt.table(rows)) or fmt.lines(fmt.line(n, m), fmt.grid(rows))',\n    'Graph/tree input pattern: { n, edges } or { n, m, edges } with fmt.lines(fmt.line(...header), fmt.table(edges))',\n    'Multi-test input pattern: { tests: [...] } with fmt.lines(fmt.line(t), ...tests.flatMap(...))',\n  ];\n\n  return {\n    profile,\n    fmtMethods: [...ALL_FMT_METHOD_NAMES],\n    generatorMethods: [...ALL_GENERATOR_METHOD_NAMES],\n    baseMethods: [...ALL_BASE_METHOD_NAMES],\n    charsetProperties: [...ALL_CHARSET_PROPERTY_NAMES],\n    canonicalPatterns,\n  };\n}\n\nexport function resolveAiContractAllowance(selection: AiContractSelection): AiContractAllowance {\n  return {\n    fmtMethods: [...selection.fmtMethods],\n    generatorMethods: [...selection.generatorMethods],\n    baseMethods: [...selection.baseMethods],\n    charsetProperties: [...selection.charsetProperties],\n    generatorPropertyRoots: [\n      ...(selection.charsetProperties.length > 0 ? ['CHARSET'] : []),\n      ...(selection.baseMethods.length > 0 ? ['base'] : []),\n    ],\n  };\n}\n\nfunction indentLines(lines: readonly string[], spaces = 2): string[] {\n  const indent = ' '.repeat(spaces);\n  return lines.map(line => line.length > 0 ? `${indent}${line}` : line);\n}\n\nfunction renderDeclarationBlock(lines: readonly string[]): string[] {\n  return indentLines(lines, 4);\n}\n\nfunction renderNamedBlocks(blocks: readonly AiContractBlock[], spaces = 2): string[] {\n  const rendered: string[] = [];\n\n  for (const [index, block] of blocks.entries()) {\n    if (index > 0) rendered.push('');\n    rendered.push(...indentLines(block.declarationLines, spaces));\n  }\n\n  return rendered;\n}\n\nfunction renderFmtInterface(selection: AiContractSelection): string[] {\n  const lines = [\n    '  export const fmt: {',\n  ];\n\n  for (const methodName of selection.fmtMethods) {\n    lines.push(...renderDeclarationBlock(RESOLVED_FMT_METHOD_MAP[methodName].declarationLines));\n  }\n\n  lines.push('  };');\n  return lines;\n}\n\nfunction renderGeneratorInterface(selection: AiContractSelection): string[] {\n  const lines = [\n    '  export interface DatasetGenerator {',\n  ];\n\n  if (selection.charsetProperties.length > 0) {\n    lines.push('    readonly CHARSET: {');\n    for (const property of selection.charsetProperties) {\n      lines.push(`      readonly ${property}: string;`);\n    }\n    lines.push('    };');\n  }\n\n  for (const methodName of selection.generatorMethods) {\n    lines.push(...renderDeclarationBlock(RESOLVED_GENERATOR_METHOD_MAP[methodName].declarationLines));\n  }\n\n  if (selection.baseMethods.length > 0) {\n    lines.push('    readonly base: {');\n    for (const methodName of selection.baseMethods) {\n      lines.push(...indentLines(RESOLVED_BASE_METHOD_MAP[methodName].declarationLines, 6));\n    }\n    lines.push('    };');\n  }\n\n  lines.push('  }');\n  return lines;\n}\n\nexport function renderAiGenesisContractDts(\n  selection: AiContractSelection = selectAiContract(''),\n): string {\n  const lines = [\n    '// Genesis AI contract for maker.ts',\n    '// Only use declarations present in this file.',\n    '// If a helper is missing, write plain TypeScript instead of inventing a Genesis API.',\n    '',\n    \"declare module 'genesis-kit' {\",\n    ...renderNamedBlocks(RESOLVED_HEADER_DECLARATIONS),\n    '',\n    ...renderFmtInterface(selection),\n    '',\n    ...renderGeneratorInterface(selection),\n    '',\n    ...renderNamedBlocks(RESOLVED_DATASET_DECLARATIONS),\n    '}',\n    '',\n    '// Canonical patterns:',\n    ...selection.canonicalPatterns.map(item => `// - ${item}`),\n    '',\n    '// Notes:',\n    '// - Import only defineDataset and fmt from genesis-kit',\n    '// - Use only the fmt.* and g.* declarations shown above',\n  ];\n\n  return `${lines.join('\\n')}\\n`;\n}\n\nexport function renderAiGenesisContractMarkdown(\n  selection: AiContractSelection = selectAiContract(''),\n): string {\n  return renderAiGenesisContractDts(selection);\n}\n\nexport function isAiFormatMethodName(value: string): value is AiFmtMethodName {\n  return value in RESOLVED_FMT_METHOD_MAP;\n}\n\nexport function isAiGeneratorMethodName(value: string): value is AiGeneratorMethodName {\n  return value in RESOLVED_GENERATOR_METHOD_MAP;\n}\n"],"mappings":";;;;;;;;;;;;;;AA+EA,SAAgB,cAAsB,QAAgD;AACpF,QAAO;EACL,kBAAkB;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D;GACE,QAAQ;GACR,oBAAoB,CAClB,0FACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB,CAClB,qDACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB,CAClB,iEACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB,CAClB,kFACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB,CAClB,8EACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACF;CACD,uBAAuB;EACrB;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB,CAClB,2FACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB,CAClB,8FACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,oBAAoB,CAClB,yFACD;GACF;EACF;CACD,cAAc;EACZ;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,4CACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,uFACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,gEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,uEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,gCACD;GACF;EACF;CACD,oBAAoB;EAClB;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,yCACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,2DACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,mEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,+DACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,0CACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,yCACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,2CACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,0DACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,gDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,iDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,qDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,gDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,kEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,qEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,0EACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,4FACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,oEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,wDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,wCACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,2CACA,uDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,sDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,sDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,mEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,qEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,kEACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,iCACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,oDACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB;IAClB;IACA;IACA;IACA;IACA;IACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,oDACA,kEACD;GACF;EACF;CACD,eAAe;EACb;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,wFACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,uCACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,uCACD;GACF;EACD;GACE,QAAQ;GACR,aAAa;GACb,oBAAoB,CAClB,iDACD;GACF;EACF;CACD,qBAAqB;EACnB;EACA;EACA;EACA;EACA;EACA;EACD;CACF;;;;ACzlBD,MAAMC,qBAAsE;CAC1E,OAAO,EACL,UAAU,CACR,uFACA,gGACD,EACF;CACD,MAAM,EACJ,UAAU,CACR,6DACA,kFACD,EACF;CACD,KAAK,EACH,UAAU,CACR,gCACA,2EACD,EACF;CACF;AAED,MAAMC,2BAAkF;CACtF,QAAQ,EACN,UAAU,CACR,kDACA,6EACD,EACF;CACD,QAAQ,EACN,UAAU,CACR,4EACA,gFACD,EACF;CACD,WAAW,EACT,UAAU,CACR,8CACA,6CACD,EACF;CACD,WAAW;EACT,UAAU,CACR,yBACA,0FACD;EACD,kBAAkB,CAChB,0LACD;EACF;CACD,MAAM,EACJ,kBAAkB,CAChB,8FACD,EACF;CACD,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