@nipe-solutions/flex-layout-codemod 2.0.0-beta.3 → 2.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/cli/run-cli.ts","../package.json","../src/logger.ts","../src/analyzer/flex-layout.catalog.ts","../src/util/sha-256.ts","../src/adapter/css/css-invariant.error.ts","../src/util/compare-code-units.ts","../src/adapter/css/css-rule-order.ts","../src/adapter/css/css-artifact.registry.ts","../src/adapter/css/css-breakpoint.context.ts","../src/adapter/css/flex/flex-align.css-renderer.ts","../src/adapter/css/flex/flex-fill.css-renderer.ts","../src/adapter/css/flex/flex-item.css-renderer.ts","../src/adapter/css/flex/flex-offset.css-renderer.ts","../src/adapter/css/flex/flex-order.css-renderer.ts","../src/adapter/css/flex/layout.css-renderer.ts","../src/adapter/css/flex/layout-align.css-renderer.ts","../src/adapter/css/flex/layout-gap.css-renderer.ts","../src/render/css/css.renderer.ts","../src/migrator/migration-application.error.ts","../src/edit/html-attribute-value.ts","../src/adapter/tailwind/extended/tailwind-arbitrary-property.encoder.ts","../src/breakpoint/breakpoint-catalog.ts","../src/adapter/tailwind/tailwind-arbitrary-syntax.ts","../src/semantic/css-property-ownership.ts","../src/adapter/tailwind/extended/tailwind-arbitrary-value-ownership.ts","../src/adapter/tailwind/tailwind-class-conflict.ts","../src/adapter/tailwind/extended/tailwind-candidate-classifier.ts","../src/evidence/tailwind-source-property.evidence.ts","../src/flex/flex-align.semantic.ts","../src/adapter/tailwind/directives/flex-align.strategy.ts","../src/flex/flex-fill.semantic.ts","../src/adapter/tailwind/directives/flex-fill.strategy.ts","../src/flex/css-length.ts","../src/flex/layout.semantic.ts","../src/flex/flex-item.semantic.ts","../src/adapter/tailwind/directives/flex-item.strategy.ts","../src/flex/flex-offset.semantic.ts","../src/adapter/tailwind/tailwind-value.parser.ts","../src/adapter/tailwind/directives/flex-offset.strategy.ts","../src/flex/flex-order.semantic.ts","../src/adapter/tailwind/directives/flex-order.strategy.ts","../src/flex/layout-align.semantic.ts","../src/adapter/tailwind/directives/layout.strategy.ts","../src/adapter/tailwind/directives/layout-align.strategy.ts","../src/flex/layout-gap.semantic.ts","../src/adapter/tailwind/directives/layout-gap.strategy.ts","../src/adapter/tailwind/responsive-variant.emitter.ts","../src/adapter/tailwind/extended/extended-responsive.emitter.ts","../src/adapter/tailwind/grid/tailwind-grid.renderer.ts","../src/adapter/tailwind/visibility/visibility.emitter.ts","../src/semantic/semantic-plan.ts","../src/render/tailwind/tailwind.renderer.ts","../src/render/render-session.ts","../src/adapter/adapter.factory.ts","../src/pipeline/analyze/analyze-project.stage.ts","../src/analyzer/flex-layout-attribute.analyzer.ts","../src/analyzer/template.analyzer.ts","../src/template/angular-template.parser.ts","../src/pipeline/analyzed-project.ts","../src/pipeline/project-manifest.ts","../src/transaction/transaction-unit.state.ts","../src/transaction/cleanup.unit.ts","../src/transaction/commit.unit.ts","../src/transaction/rollback.unit.ts","../src/transaction/staging.unit.ts","../src/transaction/transaction-signal.registrar.ts","../src/transaction/transaction-unit.session.ts","../src/transaction/migration-transaction.ts","../src/pipeline/applied-project.ts","../src/pipeline/apply/apply-project.stage.ts","../src/pipeline/discover/discover-project.stage.ts","../src/lib/gitignore.helper.ts","../src/pipeline/pipeline-stage.error.ts","../src/pipeline/migration-pipeline.ts","../src/report/migration-report.builder.ts","../src/pipeline/invocation-error-path.mapper.ts","../src/pipeline/migration-runner.ts","../src/template/template-attribute.ts","../src/image/srcset-value.ts","../src/image/responsive-image.planner.ts","../src/edit/source-editor.ts","../src/image/html-attribute.encoder.ts","../src/image/picture.renderer.ts","../src/grid/grid-value.parser.ts","../src/semantic/extended/responsive-style-value.parser.ts","../src/semantic/extended/extended-family.planner.ts","../src/semantic/literal-style-declaration.ts","../src/semantic/extended/responsive-class-value.parser.ts","../src/semantic/extended/extended-semantic.planner.ts","../src/semantic/semantic-family-composition.planner.ts","../src/semantic/responsive-family.planner.ts","../src/semantic/source-property-evidence.ts","../src/semantic/visibility/visibility-value.parser.ts","../src/semantic/visibility/visibility-state.planner.ts","../src/semantic/element-semantic.planner.ts","../src/planner/semantic-render.coordinator.ts","../src/planner/conversion-planner.ts","../src/pipeline/rendered-project.ts","../src/pipeline/render/render-project.stage.ts","../src/pipeline/validate/validate-project.stage.ts","../src/migrator/migration-plan.ts","../src/migrator/file-migration-result.ts","../src/migrator/migration-path.validator.ts","../src/migrator/stylesheet.planner.ts","../src/adapter/css/stylesheet/css-stylesheet.error.ts","../src/adapter/css/stylesheet/css-comment.scanner.ts","../src/adapter/css/stylesheet/owned-css-block.parser.ts","../src/adapter/css/stylesheet/css-artifact.validator.ts","../src/adapter/css/stylesheet/css-media.serializer.ts","../src/adapter/css/stylesheet/css-rule.serializer.ts","../src/adapter/css/stylesheet/owned-css-block.serializer.ts","../src/adapter/css/stylesheet/owned-stylesheet.merger.ts","../src/migrator/stylesheet-contents.ts","../src/pipeline/validated-project-plan.ts","../src/pipeline/validate/css-reference.collector.ts","../src/migrator/destination-template-source.ts","../src/pipeline/validate/template-proposal.validator.ts","../src/lib/atomic-file.writer.ts","../src/report/json-report.writer.ts","../src/report/terminal.presenter.ts","../src/util/error.util.ts","../src/cli/exit-policy.ts","../src/cli/report-path.validator.ts","../src/config/breakpoint-migration-config.ts","../src/cli/stylesheet-path.validator.ts","../src/cli/migration-mode.parser.ts","../src/main.ts"],"sourcesContent":["import { Command, CommanderError, InvalidArgumentError, Option } from 'commander';\nimport * as path from 'node:path';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { AdapterFactory } from '../adapter/adapter.factory';\nimport { logger } from '../logger';\nimport { AnalyzeProjectStage } from '../pipeline/analyze/analyze-project.stage';\nimport { ApplyProjectStage } from '../pipeline/apply/apply-project.stage';\nimport { DiscoverProjectStage } from '../pipeline/discover/discover-project.stage';\nimport { MigrationPipeline } from '../pipeline/migration-pipeline';\nimport { MigrationRunner } from '../pipeline/migration-runner';\nimport { migrationInvocation } from '../pipeline/project-manifest';\nimport { RenderProjectStage } from '../pipeline/render/render-project.stage';\nimport { ValidateProjectStage } from '../pipeline/validate/validate-project.stage';\nimport { JsonReportWriter } from '../report/json-report.writer';\nimport { TerminalPresenter, type TextOutput } from '../report/terminal.presenter';\nimport { getErrorMessage } from '../util/error.util';\nimport { resolveExitCode } from './exit-policy';\nimport { validateReportPath } from './report-path.validator';\nimport { parsePrintWithBreakpoints } from '../config/breakpoint-migration-config';\nimport { validateStylesheetPath } from './stylesheet-path.validator';\nimport { resolveMigrationMode } from './migration-mode.parser';\n\ninterface ProgramOptions {\n readonly output?: string;\n readonly target: string;\n readonly write: boolean;\n readonly report?: string;\n readonly stylesheet?: string;\n readonly allowUnresolved: boolean;\n readonly debug: boolean;\n readonly orientationBreakpoints: boolean;\n readonly responsiveImages: boolean;\n readonly printWithBreakpoints?: string;\n}\n\nexport interface CliOutput {\n readonly stdout: TextOutput;\n readonly stderr: TextOutput;\n}\n\nexport interface RunCliDependencies {\n readonly createMigrationRunner?: (pipeline: MigrationPipeline) => Pick<MigrationRunner, 'run'>;\n}\n\nconst processOutput: CliOutput = {\n stdout: process.stdout,\n stderr: process.stderr,\n};\n\nfunction parseSingleStylesheet(value: string, previous: string | undefined): string {\n if (previous !== undefined) throw new InvalidArgumentError('--stylesheet may only be specified once.');\n return value;\n}\n\nexport async function runCli(\n argv: readonly string[],\n output: CliOutput = processOutput,\n dependencies: RunCliDependencies = {},\n): Promise<0 | 1 | 2> {\n let exitCode: 0 | 1 | 2 = 0;\n let debug = false;\n const program = new Command();\n\n program\n .name('flex-layout-codemod')\n .version(packageJson.version)\n .description('Plan Angular Flex-Layout migrations by default; use --write to apply')\n .exitOverride()\n .configureOutput({\n writeOut: text => output.stdout.write(text),\n writeErr: text => output.stderr.write(text),\n })\n .argument('<input>', 'input HTML file or folder')\n .option(\n '-o, --output <path>',\n 'planned output HTML file or folder; single-file output must end in .html; defaults to input',\n )\n .addOption(\n new Option('-t, --target <target>', 'conversion target; css requires --stylesheet')\n .choices(['tailwind', 'css'])\n .default('tailwind'),\n )\n .addOption(\n new Option('--stylesheet <path>', 'companion stylesheet; required when --target css').argParser(\n parseSingleStylesheet,\n ),\n )\n .option('--write', 'apply the validated migration plan', false)\n .option('--report <path>', 'atomically write a JSON report; path must end in .json')\n .option('--allow-unresolved', 'return success when unresolved inputs remain', false)\n .option('--orientation-breakpoints', 'confirm the source enables the archived orientation breakpoints', false)\n .option(\n '--responsive-images',\n 'wrap eligible responsive images in picture elements; acknowledges selector and layout risk',\n false,\n )\n .option(\n '--print-with-breakpoints <aliases>',\n 'confirm the source printWithBreakpoints list; comma-separated aliases or none',\n )\n .option('-d, --debug', 'enable debug logging', false)\n .action(async (input: string, options: ProgramOptions) => {\n const mode = resolveMigrationMode(argv, options.write);\n debug = options.debug;\n logger.level = debug ? 'debug' : 'warn';\n\n const destination = options.output ?? input;\n let reportPath: string | undefined;\n if (options.report !== undefined) {\n validateReportPath(options.report);\n reportPath = path.resolve(options.report);\n }\n const stylesheetPath = await validateStylesheetPath({\n target: options.target,\n stylesheetPath: options.stylesheet,\n inputPath: input,\n outputPath: destination,\n reportPath,\n });\n const printWithBreakpoints =\n options.printWithBreakpoints === undefined\n ? undefined\n : parsePrintWithBreakpoints(options.printWithBreakpoints, options.orientationBreakpoints);\n const session = AdapterFactory.createRenderSession(options.target, {\n orientationBreakpoints: options.orientationBreakpoints,\n printWithBreakpoints,\n });\n const render = new RenderProjectStage(session);\n const pipeline = new MigrationPipeline(\n new DiscoverProjectStage(),\n new AnalyzeProjectStage(),\n render,\n new ValidateProjectStage(),\n new ApplyProjectStage(mode),\n );\n const migrationRunner =\n dependencies.createMigrationRunner === undefined\n ? new MigrationRunner(pipeline)\n : dependencies.createMigrationRunner(pipeline);\n const report = await migrationRunner.run(\n migrationInvocation({\n inputPath: input,\n outputPath: destination,\n options: {\n mode,\n responsiveImages: options.responsiveImages,\n stylesheetPath,\n stylesheetPathInput: options.stylesheet,\n reportPath,\n },\n }),\n );\n const reportOutput = report.summary.parseErrors > 0 ? output.stderr : output.stdout;\n\n new TerminalPresenter().present(report, reportOutput);\n if (reportPath !== undefined) {\n await new JsonReportWriter().write(reportPath, report, {\n protectedPaths: stylesheetPath === undefined ? [] : [stylesheetPath],\n });\n }\n\n exitCode = resolveExitCode(report, options.allowUnresolved);\n });\n\n try {\n resolveMigrationMode(argv, false);\n await program.parseAsync([...argv]);\n return exitCode;\n } catch (error: unknown) {\n if (error instanceof CommanderError) {\n return error.exitCode === 0 ? 0 : 1;\n }\n\n output.stderr.write(`Error: ${getErrorMessage(error)}\\n`);\n if (debug && error instanceof Error && error.stack) {\n output.stderr.write(`${error.stack}\\n`);\n }\n return 1;\n }\n}\n","{\n \"name\": \"@nipe-solutions/flex-layout-codemod\",\n \"version\": \"2.0.0-beta.3\",\n \"description\": \"A safety-first codemod for migrating Angular Flex-Layout templates to native CSS or Tailwind CSS.\",\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=24\"\n },\n \"packageManager\": \"npm@11.19.0\",\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\",\n \"CHANGELOG.md\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"architecture:inventory\": \"node scripts/architecture-inventory.mjs\",\n \"benchmark:architecture\": \"node scripts/benchmark/architecture-benchmark.mjs\",\n \"benchmark:architecture:prepare\": \"npm run build\",\n \"clean\": \"rimraf dist coverage\",\n \"build\": \"tsup\",\n \"build:website\": \"vite build --config vite.website.config.ts && node scripts/generate-website-route-html.mjs\",\n \"generate:website-assets\": \"node scripts/generate-website-assets.mjs\",\n \"dev:website\": \"vite --config vite.website.config.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"typecheck:website\": \"tsc --noEmit --project website/tsconfig.json\",\n \"start\": \"ts-node ./src/main.ts\",\n \"test\": \"vitest run\",\n \"test:website\": \"vitest run --config vite.website.config.ts\",\n \"test:e2e:website\": \"playwright test --config playwright.website.config.ts\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"eslint . --fix\",\n \"format\": \"prettier --check .\",\n \"format:write\": \"prettier --write .\",\n \"verify\": \"npm run format && npm run lint && npm run typecheck && npm run test:coverage && npm run build && npm run package:check\",\n \"verify:website\": \"npm run format && npm run lint && npm run test:website && npm run typecheck:website && npm run verify:website-assets && npm run verify:docs && npm run build:website && npm run verify:website-static && npm run test:e2e:website\",\n \"verify:docs\": \"node scripts/verify-documentation-contract.mjs\",\n \"verify:website-static\": \"node scripts/verify-website-static.mjs\",\n \"package:check\": \"node scripts/verify-package.mjs\",\n \"changeset\": \"changeset add\",\n \"version-packages\": \"changeset version\",\n \"release:prepare\": \"node scripts/release-artifact.mjs\",\n \"release:verify\": \"node scripts/release-artifact.mjs --verify-retained\",\n \"verify:website-assets\": \"node scripts/verify-website-assets.mjs\",\n \"release:version\": \"changeset version && npm install --package-lock-only --ignore-scripts --no-audit --no-fund\",\n \"prepare\": \"husky\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/NIPE-Solutions/flex-layout-migrator.git\"\n },\n \"keywords\": [\n \"angular\",\n \"codemod\",\n \"documentation\",\n \"flex-layout\",\n \"migration\",\n \"tailwindcss\"\n ],\n \"author\": \"Nicholas Petrasek\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/NIPE-Solutions/flex-layout-migrator/issues\"\n },\n \"homepage\": \"https://angular-flex-layout-codemod.nipesolutions.com\",\n \"dependencies\": {\n \"@angular/compiler\": \"21.2.22\",\n \"commander\": \"^15.0.0\",\n \"fs-extra\": \"^11.4.0\",\n \"ignore\": \"5.2.4\",\n \"winston\": \"^3.19.0\"\n },\n \"bin\": {\n \"flex-layout-codemod\": \"./dist/cli.js\"\n },\n \"devDependencies\": {\n \"@axe-core/playwright\": \"^4.13.0\",\n \"@changesets/cli\": \"^3.0.1\",\n \"@eslint/js\": \"^10.0.1\",\n \"@playwright/test\": \"^1.63.0\",\n \"@tailwindcss/cli\": \"4.3.3\",\n \"@testing-library/jest-dom\": \"^7.0.1\",\n \"@testing-library/react\": \"^16.3.3\",\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/mock-fs\": \"^4.13.4\",\n \"@types/node\": \"^26.4.0\",\n \"@types/react\": \"^19.2.18\",\n \"@types/react-dom\": \"^19.2.7\",\n \"@vitejs/plugin-react\": \"^6.1.1\",\n \"@vitest/coverage-v8\": \"^4.1.11\",\n \"axe-core\": \"^4.13.0\",\n \"eslint\": \"^10.9.1\",\n \"eslint-config-prettier\": \"^10.1.8\",\n \"husky\": \"^9.1.7\",\n \"jsdom\": \"^30.0.1\",\n \"lint-staged\": \"^17.4.1\",\n \"mock-fs\": \"^5.5.0\",\n \"postcss\": \"^8.5.26\",\n \"prettier\": \"^3.9.6\",\n \"react\": \"^19.2.8\",\n \"react-dom\": \"^19.2.8\",\n \"rimraf\": \"^6.1.3\",\n \"tailwindcss\": \"4.3.3\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^6.0.3\",\n \"typescript-eslint\": \"^8.68.0\",\n \"vite\": \"^8.2.2\",\n \"vitest\": \"^4.1.11\",\n \"yaml\": \"^2.9.0\"\n },\n \"husky\": {\n \"hooks\": {\n \"pre-commit\": \"lint-staged\"\n }\n },\n \"lint-staged\": {\n \"*.{js,mjs,ts}\": [\n \"eslint --fix\",\n \"prettier --write\"\n ],\n \"*.{json,md,yml,yaml}\": [\n \"prettier --write\"\n ]\n }\n}\n","import { createLogger, format, transports } from 'winston';\n\nconst { combine, timestamp, printf, colorize, splat } = format;\n\nconst myFormat = printf(({ timestamp, level, message, label, lineNumber }) => {\n const timestampValue =\n typeof timestamp === 'string' || typeof timestamp === 'number' || timestamp instanceof Date\n ? timestamp\n : Date.now();\n const formattedTimestamp = new Date(timestampValue)\n .toISOString()\n .replace('T', ' ')\n .replace(/\\.\\d{3}Z$/, 'Z');\n const fileLineInfo = label && lineNumber ? `(${label}:${lineNumber})` : '';\n return `[${formattedTimestamp}] ${level}: ${message} ${fileLineInfo}`;\n});\n\nexport const logger = createLogger({\n level: 'info',\n format: combine(splat(), colorize(), timestamp(), myFormat),\n transports: [new transports.Console()],\n});\n","export const FLEX_LAYOUT_DIRECTIVES = [\n 'fxLayout',\n 'fxLayoutAlign',\n 'fxLayoutGap',\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexAlign',\n 'fxFlexFill',\n 'fxFill',\n 'fxFlexOffset',\n 'fxFlexOrder',\n 'fxShow',\n 'fxHide',\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdArea',\n 'gdAreas',\n 'gdAuto',\n 'gdColumn',\n 'gdColumns',\n 'gdGap',\n 'gdGridAlign',\n 'gdInline',\n 'gdRow',\n 'gdRows',\n 'class',\n 'ngClass',\n 'style',\n 'ngStyle',\n 'imgSrc',\n] as const;\n\nexport type FlexLayoutDirective = (typeof FLEX_LAYOUT_DIRECTIVES)[number];\n\nexport const DEFAULT_BREAKPOINTS = [\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n 'lt-sm',\n 'lt-md',\n 'lt-lg',\n 'lt-xl',\n 'gt-xs',\n 'gt-sm',\n 'gt-md',\n 'gt-lg',\n] as const;\n\nexport type DefaultBreakpoint = (typeof DEFAULT_BREAKPOINTS)[number];\n\nexport const ORIENTATION_BREAKPOINTS = [\n 'handset',\n 'handset.portrait',\n 'handset.landscape',\n 'tablet',\n 'tablet.portrait',\n 'tablet.landscape',\n 'web',\n 'web.portrait',\n 'web.landscape',\n] as const;\n\nexport const SPECIAL_BREAKPOINTS = ['print'] as const;\n\nexport type KnownBreakpoint =\n DefaultBreakpoint | (typeof ORIENTATION_BREAKPOINTS)[number] | (typeof SPECIAL_BREAKPOINTS)[number];\n\nconst directiveNames = new Set<string>(FLEX_LAYOUT_DIRECTIVES);\nconst breakpointNames = new Set<string>([...DEFAULT_BREAKPOINTS, ...ORIENTATION_BREAKPOINTS, ...SPECIAL_BREAKPOINTS]);\n\nexport function isFlexLayoutDirective(value: string): value is FlexLayoutDirective {\n return directiveNames.has(value);\n}\n\nexport function isKnownBreakpoint(value: string): value is KnownBreakpoint {\n return breakpointNames.has(value);\n}\n","const ROUND_CONSTANTS = Object.freeze([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98,\n 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8,\n 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7,\n 0xc67178f2,\n]);\n\nconst INITIAL_HASH = Object.freeze([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n\nexport function sha256(value: string): string {\n const source = new TextEncoder().encode(value);\n const paddedLength = Math.ceil((source.length + 9) / 64) * 64;\n const bytes = new Uint8Array(paddedLength);\n bytes.set(source);\n bytes[source.length] = 0x80;\n const bitLength = source.length * 8;\n const view = new DataView(bytes.buffer);\n view.setUint32(paddedLength - 8, Math.floor(bitLength / 0x1_0000_0000));\n view.setUint32(paddedLength - 4, bitLength >>> 0);\n\n const hash = [...INITIAL_HASH];\n const schedule = new Uint32Array(64);\n for (let offset = 0; offset < bytes.length; offset += 64) {\n for (let index = 0; index < 16; index += 1) schedule[index] = view.getUint32(offset + index * 4);\n for (let index = 16; index < schedule.length; index += 1) {\n const earlier = schedule[index - 15]!;\n const recent = schedule[index - 2]!;\n const sigma0 = rotateRight(earlier, 7) ^ rotateRight(earlier, 18) ^ (earlier >>> 3);\n const sigma1 = rotateRight(recent, 17) ^ rotateRight(recent, 19) ^ (recent >>> 10);\n schedule[index] = (schedule[index - 16]! + sigma0 + schedule[index - 7]! + sigma1) >>> 0;\n }\n\n let [a, b, c, d, e, f, g, h] = hash as [number, number, number, number, number, number, number, number];\n for (let index = 0; index < schedule.length; index += 1) {\n const sum1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);\n const choice = (e & f) ^ (~e & g);\n const temporary1 = (h + sum1 + choice + ROUND_CONSTANTS[index]! + schedule[index]!) >>> 0;\n const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);\n const majority = (a & b) ^ (a & c) ^ (b & c);\n const temporary2 = (sum0 + majority) >>> 0;\n h = g;\n g = f;\n f = e;\n e = (d + temporary1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (temporary1 + temporary2) >>> 0;\n }\n\n const round = [a, b, c, d, e, f, g, h];\n for (let index = 0; index < hash.length; index += 1) hash[index] = (hash[index]! + round[index]!) >>> 0;\n }\n\n return hash.map(word => word.toString(16).padStart(8, '0')).join('');\n}\n\nfunction rotateRight(value: number, count: number): number {\n return (value >>> count) | (value << (32 - count));\n}\n","export class CssInvariantError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CssInvariantError';\n }\n}\n","export function compareCodeUnits(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n","import type { OwnedCssRule } from './css-artifact.model';\nimport { compareCodeUnits } from '../../util/compare-code-units';\n\nexport function compareOwnedCssRules(left: OwnedCssRule, right: OwnedCssRule): number {\n const baseOrder = Number(left.context.media !== undefined) - Number(right.context.media !== undefined);\n if (baseOrder !== 0) return baseOrder;\n const priorityOrder = right.context.priority - left.context.priority;\n return priorityOrder || compareCodeUnits(left.id, right.id);\n}\n","import type { MediaDefinition } from '../../breakpoint/breakpoint-catalog';\nimport { sha256 } from '../../util/sha-256';\nimport { CssInvariantError } from './css-invariant.error';\nimport type { CssDeclaration, CssDigest, CssRuleContext, CssSemanticFamily, OwnedCssRule } from './css-artifact.model';\nimport { compareOwnedCssRules } from './css-rule-order';\n\nconst SHA_256_DIGEST = /^[a-f0-9]{64}$/;\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n const properties = new Set<string>();\n\n for (const declaration of declarations) {\n if (properties.has(declaration.property)) {\n throw new CssInvariantError(`Duplicate CSS declaration property: ${declaration.property}`);\n }\n properties.add(declaration.property);\n }\n\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nfunction assertFiniteMediaBounds(media: MediaDefinition): void {\n for (const clause of media.clauses) {\n for (const bound of [clause.min, clause.max]) {\n if (bound !== undefined && !Number.isFinite(bound)) {\n throw new CssInvariantError('CSS media bounds must be finite numbers');\n }\n }\n\n if (clause.min !== undefined && clause.max !== undefined && clause.min > clause.max) {\n throw new CssInvariantError('CSS media minimum bound must not exceed its maximum bound');\n }\n }\n}\n\nfunction freezeMedia(media: MediaDefinition): MediaDefinition {\n assertFiniteMediaBounds(media);\n return Object.freeze({\n type: media.type,\n clauses: Object.freeze(media.clauses.map(clause => Object.freeze({ ...clause }))),\n });\n}\n\nfunction freezeContext(context: CssRuleContext): CssRuleContext {\n if (!Number.isFinite(context.priority)) {\n throw new CssInvariantError('CSS rule priority must be a finite number');\n }\n\n if (context.media === undefined) {\n if (context.priority !== 0) {\n throw new CssInvariantError('CSS base rules must have priority 0');\n }\n return Object.freeze({ priority: context.priority });\n }\n\n return Object.freeze({ priority: context.priority, media: freezeMedia(context.media) });\n}\n\nfunction canonicalIdentity(\n family: CssSemanticFamily,\n declarations: readonly CssDeclaration[],\n context: CssRuleContext,\n): string {\n return JSON.stringify({\n schema: 1,\n family,\n declarations: declarations.map(({ property, value }) => [property, value]),\n media: context.media\n ? {\n type: context.media.type,\n clauses: context.media.clauses.map(({ min, max, orientation }) => [\n min ?? null,\n max ?? null,\n orientation ?? null,\n ]),\n }\n : null,\n priority: context.priority,\n });\n}\n\nexport class CssArtifactRegistry {\n private readonly rulesByCanonicalIdentity = new Map<string, OwnedCssRule>();\n private readonly canonicalIdentityByDigest = new Map<string, string>();\n private readonly registeredRules: OwnedCssRule[] = [];\n\n constructor(private readonly digest: CssDigest = sha256) {}\n\n register(\n family: CssSemanticFamily,\n declarations: readonly CssDeclaration[],\n context: CssRuleContext = { priority: 0 },\n ): OwnedCssRule {\n const frozenDeclarations = freezeDeclarations(declarations);\n const frozenContext = freezeContext(context);\n const identity = canonicalIdentity(family, frozenDeclarations, frozenContext);\n const existingRule = this.rulesByCanonicalIdentity.get(identity);\n\n if (existingRule) return existingRule;\n\n const id = this.digest(identity);\n if (!SHA_256_DIGEST.test(id)) {\n throw new CssInvariantError('CSS artifact digest must be a 64-character lowercase hexadecimal SHA-256 value');\n }\n\n const collidingIdentity = this.canonicalIdentityByDigest.get(id);\n if (collidingIdentity !== undefined && collidingIdentity !== identity) {\n throw new CssInvariantError('Distinct CSS artifact identities must not share a digest');\n }\n\n const rule: OwnedCssRule = Object.freeze({\n owner: 'flex-layout-codemod',\n id,\n className: `flm-${id}`,\n family,\n declarations: frozenDeclarations,\n context: frozenContext,\n });\n\n this.rulesByCanonicalIdentity.set(identity, rule);\n this.canonicalIdentityByDigest.set(id, identity);\n this.registeredRules.push(rule);\n return rule;\n }\n\n rules(): readonly OwnedCssRule[] {\n return Object.freeze([...this.registeredRules].sort(compareOwnedCssRules));\n }\n\n rulesReferencedBy(classNames: ReadonlySet<string>): readonly OwnedCssRule[] {\n return Object.freeze(\n this.registeredRules.filter(rule => classNames.has(rule.className)).sort(compareOwnedCssRules),\n );\n }\n}\n","import type { BreakpointDefinition, MediaDefinition } from '../../breakpoint/breakpoint-catalog';\nimport type { CssRuleContext } from './css-artifact.model';\n\nfunction copyMedia(media: MediaDefinition): MediaDefinition {\n return Object.freeze({\n type: media.type,\n clauses: Object.freeze(media.clauses.map(clause => Object.freeze({ ...clause }))),\n });\n}\n\nexport function cssRuleContext(definition?: BreakpointDefinition): CssRuleContext {\n if (definition === undefined) {\n return Object.freeze({ priority: 0 });\n }\n\n return Object.freeze({ priority: definition.priority, media: copyMedia(definition.media) });\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexAlignSemantics, FlexSelfAlignment } from '../../../flex/flex-align.semantic';\n\nconst alignmentValues: Readonly<Record<FlexSelfAlignment, CssDeclaration['value']>> = {\n auto: 'auto',\n start: 'flex-start',\n end: 'flex-end',\n center: 'center',\n baseline: 'baseline',\n stretch: 'stretch',\n};\n\nexport function renderFlexAlignCss(value: FlexAlignSemantics): readonly CssDeclaration[] {\n return Object.freeze([Object.freeze({ property: 'align-self', value: alignmentValues[value.alignment] })]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexFillSemantics } from '../../../flex/flex-fill.semantic';\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderFlexFillCss(value: FlexFillSemantics): readonly CssDeclaration[] {\n return freezeDeclarations([\n { property: 'margin', value: value.margin },\n { property: 'width', value: value.width },\n { property: 'height', value: value.height },\n { property: 'min-width', value: value.minWidth },\n { property: 'min-height', value: value.minHeight },\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexItemSemantics } from '../../../flex/flex-item.semantic';\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderFlexItemCss(value: FlexItemSemantics): readonly CssDeclaration[] {\n const flexDeclarations =\n value.basis.kind === 'computed'\n ? [\n { property: 'flex-grow', value: value.grow },\n { property: 'flex-shrink', value: value.shrink },\n { property: 'flex-basis', value: value.basis.value },\n ]\n : [{ property: 'flex', value: `${value.grow} ${value.shrink} ${value.basis.value}` }];\n\n return freezeDeclarations([\n ...flexDeclarations,\n ...(value.min ? [{ property: `min-${value.axis}`, value: value.min }] : []),\n ...(value.max ? [{ property: `max-${value.axis}`, value: value.max }] : []),\n { property: 'box-sizing', value: value.boxSizing },\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexOffsetSemantics } from '../../../flex/flex-offset.semantic';\n\nconst propertyByAxis: Readonly<Record<FlexOffsetSemantics['axis'], CssDeclaration['property']>> = {\n 'inline-start': 'margin-inline-start',\n 'block-start': 'margin-block-start',\n};\n\nexport function renderFlexOffsetCss(value: FlexOffsetSemantics): readonly CssDeclaration[] {\n return Object.freeze([Object.freeze({ property: propertyByAxis[value.axis], value: value.length })]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexOrderSemantics } from '../../../flex/flex-order.semantic';\n\nconst noDeclarations: readonly CssDeclaration[] = Object.freeze([]);\n\nexport function renderFlexOrderCss(value: FlexOrderSemantics): readonly CssDeclaration[] {\n return value.order === undefined\n ? noDeclarations\n : Object.freeze([Object.freeze({ property: 'order', value: String(value.order) })]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { LayoutDirection, LayoutSemantics, LayoutWrap } from '../../../flex/layout.semantic';\n\nconst displayValues: Readonly<Record<LayoutSemantics['display'], CssDeclaration['value']>> = {\n flex: 'flex',\n 'inline-flex': 'inline-flex',\n};\n\nconst directionValues: Readonly<Record<LayoutDirection, CssDeclaration['value']>> = {\n row: 'row',\n 'row-reverse': 'row-reverse',\n column: 'column',\n 'column-reverse': 'column-reverse',\n};\n\nconst wrapValues: Readonly<Record<LayoutWrap, CssDeclaration['value']>> = {\n nowrap: 'nowrap',\n wrap: 'wrap',\n 'wrap-reverse': 'wrap-reverse',\n};\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderLayoutCss(value: LayoutSemantics): readonly CssDeclaration[] {\n return freezeDeclarations([\n { property: 'display', value: displayValues[value.display] },\n { property: 'box-sizing', value: value.boxSizing },\n { property: 'flex-direction', value: directionValues[value.direction] },\n ...(value.explicitWrap ? [{ property: 'flex-wrap', value: wrapValues[value.wrap] }] : []),\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type {\n LayoutContentAlignment,\n LayoutItemsAlignment,\n LayoutMainAlignment,\n LayoutAlignmentSemantics,\n} from '../../../flex/layout-align.semantic';\nimport { renderLayoutCss } from './layout.css-renderer';\n\nconst mainAlignmentValues: Readonly<Record<LayoutMainAlignment, CssDeclaration['value']>> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n 'space-around': 'space-around',\n 'space-between': 'space-between',\n 'space-evenly': 'space-evenly',\n};\n\nconst itemsAlignmentValues: Readonly<Record<LayoutItemsAlignment, CssDeclaration['value']>> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n baseline: 'baseline',\n stretch: 'stretch',\n};\n\nconst contentAlignmentValues: Readonly<Record<LayoutContentAlignment, CssDeclaration['value']>> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n 'space-around': 'space-around',\n 'space-between': 'space-between',\n};\n\nconst stretchMaximumProperties: Readonly<Record<NonNullable<LayoutAlignmentSemantics['stretchMaximum']>, string>> = {\n width: 'max-width',\n height: 'max-height',\n};\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderLayoutAlignmentCss(value: LayoutAlignmentSemantics): readonly CssDeclaration[] {\n return freezeDeclarations([\n { property: 'justify-content', value: mainAlignmentValues[value.main] },\n { property: 'align-items', value: itemsAlignmentValues[value.items] },\n { property: 'align-content', value: contentAlignmentValues[value.content] },\n ...renderLayoutCss(value.layout),\n ...(value.stretchMaximum === undefined\n ? []\n : [{ property: stretchMaximumProperties[value.stretchMaximum], value: '100%' }]),\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { LayoutGapSemantics } from '../../../flex/layout-gap.semantic';\n\nexport function renderLayoutGapCss(value: LayoutGapSemantics): readonly CssDeclaration[] {\n return Object.freeze([Object.freeze({ property: 'gap', value: value.length })]);\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport { DEFAULT_BREAKPOINTS } from '../../analyzer/flex-layout.catalog';\nimport type { BreakpointMigrationConfig } from '../../config/breakpoint-migration-config';\nimport type { FlexAlignSemantics } from '../../flex/flex-align.semantic';\nimport type { FlexFillSemantics } from '../../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../../flex/flex-offset.semantic';\nimport type { FlexOrderSemantics } from '../../flex/flex-order.semantic';\nimport type { LayoutAlignmentSemantics } from '../../flex/layout-align.semantic';\nimport type { LayoutGapSemantics } from '../../flex/layout-gap.semantic';\nimport type { LayoutSemantics } from '../../flex/layout.semantic';\nimport type { CssDeclaration, CssSemanticFamily, OwnedCssRule } from '../../adapter/css/css-artifact.model';\nimport { CssArtifactRegistry } from '../../adapter/css/css-artifact.registry';\nimport { cssRuleContext } from '../../adapter/css/css-breakpoint.context';\nimport { CssInvariantError } from '../../adapter/css/css-invariant.error';\nimport { renderFlexAlignCss } from '../../adapter/css/flex/flex-align.css-renderer';\nimport { renderFlexFillCss } from '../../adapter/css/flex/flex-fill.css-renderer';\nimport { renderFlexItemCss } from '../../adapter/css/flex/flex-item.css-renderer';\nimport { renderFlexOffsetCss } from '../../adapter/css/flex/flex-offset.css-renderer';\nimport { renderFlexOrderCss } from '../../adapter/css/flex/flex-order.css-renderer';\nimport { renderLayoutAlignmentCss } from '../../adapter/css/flex/layout-align.css-renderer';\nimport { renderLayoutGapCss } from '../../adapter/css/flex/layout-gap.css-renderer';\nimport { renderLayoutCss } from '../../adapter/css/flex/layout.css-renderer';\nimport type { SemanticConversionContext } from '../../semantic/conversion-context';\nimport type { ResolvedSemanticPlan } from '../../semantic/semantic-plan';\nimport type { ConversionRenderer, PlannedConversion } from '../conversion-renderer';\n\nconst supportedFamilies = new Set<CssSemanticFamily>([\n 'layout',\n 'layout-gap',\n 'layout-align',\n 'flex-item',\n 'flex-align',\n 'flex-fill',\n 'flex-offset',\n 'flex-order',\n]);\nconst supportedBreakpoints = new Set<string>(DEFAULT_BREAKPOINTS);\n\nfunction targetUnsupported(input: LocatedFlexLayoutInput): PlannedConversion {\n return {\n status: 'unsupported',\n input,\n code: 'target-unsupported',\n reason: `The CSS target does not support ${input.sourceName}.`,\n suggestion: 'Use the Tailwind target when it supports this input, or migrate the directive manually.',\n };\n}\n\nexport class CssRenderer implements ConversionRenderer {\n readonly target = 'css' as const;\n readonly breakpointConfig: BreakpointMigrationConfig;\n private readonly referencedClassNamesByInputId = new Map<string, readonly string[]>();\n\n constructor(\n readonly registry: CssArtifactRegistry = new CssArtifactRegistry(),\n config: BreakpointMigrationConfig = { orientationBreakpoints: false },\n ) {\n this.breakpointConfig = Object.freeze({ ...config });\n }\n\n eligibility(input: LocatedFlexLayoutInput): PlannedConversion | undefined {\n const family = this.cssFamily(input);\n if (family === undefined) return targetUnsupported(input);\n if (input.breakpoint !== undefined && !supportedBreakpoints.has(input.breakpoint)) return targetUnsupported(input);\n return undefined;\n }\n\n render(plan: ResolvedSemanticPlan, _context: SemanticConversionContext): PlannedConversion {\n const family = this.cssFamily(plan.input);\n if (family === undefined || family !== plan.family) {\n throw new CssInvariantError(`CSS emission received an unsupported directive: ${plan.input.directive}`);\n }\n if (plan.activations.length !== 1) {\n throw new CssInvariantError('CSS emission requires exactly one resolved activation');\n }\n\n const declarations = this.declarations(plan);\n if (declarations.length === 0) return { status: 'converted', input: plan.input, classNames: [] };\n const planActivation = plan.activations[0];\n const rule = this.registry.register(\n family,\n declarations,\n planActivation?.kind === 'media' ? cssRuleContext(planActivation.definition) : { priority: 0 },\n );\n return { status: 'converted', input: plan.input, classNames: [rule.className] };\n }\n\n resolveConflicts(\n plans: readonly PlannedConversion[],\n _context: SemanticConversionContext,\n ): readonly PlannedConversion[] {\n return plans;\n }\n\n record(plans: readonly PlannedConversion[]): void {\n for (const plan of plans) {\n this.referencedClassNamesByInputId.set(plan.input.id, plan.status === 'converted' ? plan.classNames : []);\n }\n }\n\n referencedClassNames(): ReadonlySet<string> {\n return new Set([...this.referencedClassNamesByInputId.values()].flatMap(classNames => [...classNames]));\n }\n\n finalizedRules(): readonly OwnedCssRule[] {\n return this.registry.rulesReferencedBy(this.referencedClassNames());\n }\n\n private cssFamily(input: LocatedFlexLayoutInput): CssSemanticFamily | undefined {\n const family =\n input.directive === 'fxLayout'\n ? 'layout'\n : input.directive === 'fxLayoutGap'\n ? 'layout-gap'\n : input.directive === 'fxLayoutAlign'\n ? 'layout-align'\n : input.directive === 'fxFlex' || input.directive === 'fxGrow' || input.directive === 'fxShrink'\n ? 'flex-item'\n : input.directive === 'fxFlexAlign'\n ? 'flex-align'\n : input.directive === 'fxFlexFill' || input.directive === 'fxFill'\n ? 'flex-fill'\n : input.directive === 'fxFlexOffset'\n ? 'flex-offset'\n : input.directive === 'fxFlexOrder'\n ? 'flex-order'\n : undefined;\n return family !== undefined && supportedFamilies.has(family) ? family : undefined;\n }\n\n private declarations(plan: ResolvedSemanticPlan): readonly CssDeclaration[] {\n switch (plan.family) {\n case 'layout':\n return renderLayoutCss(plan.value as LayoutSemantics);\n case 'layout-gap':\n return renderLayoutGapCss(plan.value as LayoutGapSemantics);\n case 'layout-align':\n return renderLayoutAlignmentCss(plan.value as LayoutAlignmentSemantics);\n case 'flex-item':\n return renderFlexItemCss(plan.value as FlexItemSemantics);\n case 'flex-align':\n return renderFlexAlignCss(plan.value as FlexAlignSemantics);\n case 'flex-fill':\n return renderFlexFillCss(plan.value as FlexFillSemantics);\n case 'flex-offset':\n return renderFlexOffsetCss(plan.value as FlexOffsetSemantics);\n case 'flex-order':\n return renderFlexOrderCss(plan.value as FlexOrderSemantics);\n default:\n throw new CssInvariantError(`CSS emission received an unsupported semantic family: ${plan.family}`);\n }\n }\n}\n","export type MigrationApplicationErrorCode =\n | 'invalid-configuration'\n | 'path-collision'\n | 'unsupported-path-type'\n | 'stylesheet-ownership-invalid'\n | 'concurrent-modification'\n | 'transaction-io'\n | 'transaction-interrupted'\n | 'internal-invariant';\n\nexport class MigrationApplicationError extends Error {\n readonly recoveryFailures: readonly unknown[];\n\n constructor(\n readonly code: MigrationApplicationErrorCode,\n message: string,\n readonly paths: readonly string[] = [],\n options?: ErrorOptions & { readonly recoveryFailures?: readonly unknown[] },\n ) {\n super(message, options);\n this.name = 'MigrationApplicationError';\n this.paths = Object.freeze([...paths]);\n this.recoveryFailures = Object.freeze([...(options?.recoveryFailures ?? [])]);\n }\n}\n","import type { TemplateAttribute, TemplateElement } from '../template/template.model';\nimport type { SourceEdit } from './source-edit';\n\nconst htmlSourceWhitespace = /[\\t\\n\\f\\r ]/u;\nconst htmlReferencePrefix = /&(?:#|[a-z\\d])/iu;\n\n/**\n * Tailwind scans template bytes without first decoding HTML. A generated class\n * token is therefore safe only when the same bytes survive Angular's HTML\n * parsing and can be placed in both quote styles without entity escaping.\n */\nexport function isByteExactHtmlClassToken(token: string): boolean {\n return (\n token.length > 0 &&\n ![...token].some(character => htmlSourceWhitespace.test(character)) &&\n !/[\"'<]/u.test(token) &&\n !htmlReferencePrefix.test(token)\n );\n}\n\nfunction isDoubleQuotedHtmlClassToken(token: string): boolean {\n return (\n token.length > 0 &&\n ![...token].some(character => htmlSourceWhitespace.test(character)) &&\n !/[\"<]/u.test(token) &&\n !htmlReferencePrefix.test(token)\n );\n}\n\nfunction appendedRawValue(rawValue: string, missingClassNames: readonly string[]): string {\n const separator = rawValue.length > 0 && !htmlSourceWhitespace.test(rawValue.at(-1) ?? '') ? ' ' : '';\n return `${rawValue}${separator}${missingClassNames.join(' ')}`;\n}\n\nexport function appendLiteralClassNames(\n source: string,\n element: TemplateElement,\n classAttribute: TemplateAttribute | undefined,\n generatedClassNames: readonly string[],\n inputId: string,\n): SourceEdit | undefined {\n const uniqueGenerated = [...new Set(generatedClassNames)];\n // Deduplicate only against byte-identical source candidates. An entity-decoded\n // equivalent has the same Angular token but remains invisible to Tailwind's\n // raw source scanner, so the generated spelling must still be appended.\n const existingRawClassNames = classAttribute?.rawValue.split(/[\\t\\n\\f\\r ]+/u).filter(Boolean) ?? [];\n const missingClassNames = uniqueGenerated.filter(className => !existingRawClassNames.includes(className));\n if (missingClassNames.length === 0) return undefined;\n\n if (!missingClassNames.every(isDoubleQuotedHtmlClassToken)) {\n throw new Error('Generated class names must be byte-exact HTML source tokens before editing.');\n }\n\n if (classAttribute !== undefined) {\n if (classAttribute.valueSource === undefined) {\n return {\n range: classAttribute.source,\n text: `${classAttribute.rawName}=\"${missingClassNames.join(' ')}\"`,\n inputId,\n };\n }\n\n const value = appendedRawValue(classAttribute.rawValue, missingClassNames);\n const delimiter = source[classAttribute.valueSource.start - 1];\n if (delimiter === '\"') {\n return { range: classAttribute.valueSource, text: value, inputId };\n }\n if (delimiter === \"'\" && missingClassNames.every(isByteExactHtmlClassToken)) {\n return { range: classAttribute.valueSource, text: value, inputId };\n }\n if (delimiter === \"'\" && !classAttribute.rawValue.includes('\"')) {\n return {\n range: classAttribute.source,\n text: `${classAttribute.rawName}=\"${value}\"`,\n inputId,\n };\n }\n\n return {\n range: classAttribute.source,\n text: `${classAttribute.rawName}=\"${value}\"`,\n inputId,\n };\n }\n\n const startTag = source.slice(element.startTag.start, element.startTag.end);\n const selfClosing = startTag.endsWith('/>');\n const insertionOffset = element.startTag.end - (selfClosing ? 2 : 1);\n const hasClosingWhitespace = htmlSourceWhitespace.test(source[insertionOffset - 1] ?? '');\n const classAttributeText = `class=\"${missingClassNames.join(' ')}\"`;\n return {\n range: { start: insertionOffset, end: insertionOffset },\n text: selfClosing && hasClosingWhitespace ? `${classAttributeText} ` : ` ${classAttributeText}`,\n inputId,\n };\n}\n","import type { LiteralStyleDeclaration } from '../../../semantic/literal-style-declaration';\nimport { isByteExactHtmlClassToken } from '../../../edit/html-attribute-value';\n\nconst ordinaryProperty = /^-?[a-z][a-z\\d-]*$/iu;\nconst customProperty = /^--[a-z\\d_-]+$/iu;\n\nfunction containsControl(value: string): boolean {\n return [...value].some(character => {\n const codePoint = character.codePointAt(0);\n return codePoint !== undefined && (codePoint < 0x20 || codePoint === 0x7f);\n });\n}\n\nfunction isEncodable(declaration: LiteralStyleDeclaration): boolean {\n const propertyIsValid = ordinaryProperty.test(declaration.property) || customProperty.test(declaration.property);\n return (\n propertyIsValid &&\n declaration.value.length > 0 &&\n !containsControl(declaration.value) &&\n !/[\\\\[\\]{}]/u.test(declaration.value)\n );\n}\n\nexport class TailwindArbitraryPropertyEncoder {\n encode(declaration: LiteralStyleDeclaration): string {\n if (!isEncodable(declaration)) {\n throw new Error('The style declaration cannot be encoded as an exact Tailwind arbitrary property.');\n }\n\n const value = declaration.value.replaceAll('_', '\\\\_').replaceAll(' ', '_');\n const candidate = `[${declaration.property}:${value}]`;\n if (!isByteExactHtmlClassToken(candidate)) {\n throw new Error('The style declaration cannot be encoded as a byte-exact HTML source candidate.');\n }\n return candidate;\n }\n}\n","import { ORIENTATION_BREAKPOINTS } from '../analyzer/flex-layout.catalog';\nimport type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\n\nexport interface MediaRange {\n readonly min?: number;\n readonly max?: number;\n readonly orientation?: 'portrait' | 'landscape';\n}\n\nexport type MediaClause = MediaRange;\n\nexport interface MediaDefinition {\n readonly type: 'screen' | 'print';\n readonly clauses: readonly MediaClause[];\n}\n\nexport interface BreakpointDefinition {\n readonly alias: string;\n /** @deprecated Use media clauses; retained while range consumers migrate. */\n readonly range: MediaClause;\n readonly media: MediaDefinition;\n readonly priority: number;\n}\n\nexport type BreakpointClassification =\n | { readonly kind: 'verified'; readonly definition: BreakpointDefinition }\n | { readonly kind: 'optional'; readonly alias: string }\n | { readonly kind: 'print'; readonly alias: 'print' }\n | { readonly kind: 'custom'; readonly alias: string };\n\nfunction freezeDefinition(definition: BreakpointDefinition): BreakpointDefinition {\n return Object.freeze({\n ...definition,\n range: Object.freeze({ ...definition.range }),\n media: Object.freeze({\n ...definition.media,\n clauses: Object.freeze(definition.media.clauses.map(clause => Object.freeze({ ...clause }))),\n }),\n });\n}\n\nfunction screen(alias: string, range: MediaClause, priority: number): BreakpointDefinition {\n return { alias, range, media: { type: 'screen', clauses: [range] }, priority };\n}\n\nfunction composite(alias: string, clauses: readonly MediaClause[], priority: number): BreakpointDefinition {\n return { alias, range: clauses[0] ?? {}, media: { type: 'screen', clauses }, priority };\n}\n\nconst breakpointDefinitions: readonly BreakpointDefinition[] = [\n screen('xs', { min: 0, max: 599.98 }, 1000),\n screen('sm', { min: 600, max: 959.98 }, 900),\n screen('md', { min: 960, max: 1279.98 }, 800),\n screen('lg', { min: 1280, max: 1919.98 }, 700),\n screen('xl', { min: 1920, max: 4999.98 }, 600),\n screen('lt-sm', { min: undefined, max: 599.98 }, 950),\n screen('lt-md', { min: undefined, max: 959.98 }, 850),\n screen('lt-lg', { min: undefined, max: 1279.98 }, 750),\n screen('lt-xl', { min: undefined, max: 1919.98 }, 650),\n screen('gt-xs', { min: 600, max: undefined }, -950),\n screen('gt-sm', { min: 960, max: undefined }, -850),\n screen('gt-md', { min: 1280, max: undefined }, -750),\n screen('gt-lg', { min: 1920, max: undefined }, -650),\n];\n\nconst orientationDefinitions: readonly BreakpointDefinition[] = [\n screen('handset.portrait', { max: 599.98, orientation: 'portrait' }, 2000),\n screen('handset.landscape', { max: 959.98, orientation: 'landscape' }, 2000),\n composite(\n 'handset',\n [\n { max: 599.98, orientation: 'portrait' },\n { max: 959.98, orientation: 'landscape' },\n ],\n 2000,\n ),\n screen('tablet.portrait', { min: 600, max: 839.98, orientation: 'portrait' }, 2100),\n screen('tablet.landscape', { min: 960, max: 1279.98, orientation: 'landscape' }, 2100),\n composite(\n 'tablet',\n [\n { min: 600, max: 839.98, orientation: 'portrait' },\n { min: 960, max: 1279.98, orientation: 'landscape' },\n ],\n 2100,\n ),\n screen('web.portrait', { min: 840, orientation: 'portrait' }, 2200),\n screen('web.landscape', { min: 1280, orientation: 'landscape' }, 2200),\n composite(\n 'web',\n [\n { min: 840, orientation: 'portrait' },\n { min: 1280, orientation: 'landscape' },\n ],\n 2200,\n ),\n];\n\nconst printDefinition: BreakpointDefinition = {\n alias: 'print',\n range: {},\n media: { type: 'print', clauses: [{}] },\n priority: 1000,\n};\n\nconst definitions = Object.freeze(breakpointDefinitions.map(freezeDefinition));\nconst orientations = Object.freeze(orientationDefinitions.map(freezeDefinition));\nconst frozenPrintDefinition = freezeDefinition(printDefinition);\n\nconst definitionsByAlias = new Map(definitions.map(definition => [definition.alias, definition]));\nconst optionalAliases = new Set<string>(ORIENTATION_BREAKPOINTS);\n\nexport class BreakpointCatalog {\n private readonly configuredDefinitions: ReadonlyMap<string, BreakpointDefinition>;\n readonly printWithBreakpoints: readonly string[] | undefined;\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n this.printWithBreakpoints = config.printWithBreakpoints;\n this.configuredDefinitions = new Map([\n ...definitionsByAlias,\n ...(config.orientationBreakpoints ? orientations.map(definition => [definition.alias, definition] as const) : []),\n ...(config.printWithBreakpoints === undefined\n ? []\n : ([[frozenPrintDefinition.alias, frozenPrintDefinition]] as const)),\n ]);\n }\n\n classify(alias: string): BreakpointClassification {\n const definition = this.configuredDefinitions.get(alias);\n\n if (definition) {\n return { kind: 'verified', definition };\n }\n\n if (optionalAliases.has(alias)) {\n return { kind: 'optional', alias };\n }\n\n if (alias === 'print') {\n return { kind: 'print', alias };\n }\n\n return { kind: 'custom', alias };\n }\n}\n\n/** Internal canonical definitions for deterministic consumers such as CSS ownership recovery. */\nexport function allBreakpointDefinitions(): readonly BreakpointDefinition[] {\n return Object.freeze([...definitions, ...orientations, frozenPrintDefinition]);\n}\n\nexport function mediaRangesIntersect(left: MediaRange, right: MediaRange): boolean {\n if (left.orientation !== undefined && right.orientation !== undefined && left.orientation !== right.orientation) {\n return false;\n }\n const leftMin = left.min ?? Number.NEGATIVE_INFINITY;\n const leftMax = left.max ?? Number.POSITIVE_INFINITY;\n const rightMin = right.min ?? Number.NEGATIVE_INFINITY;\n const rightMax = right.max ?? Number.POSITIVE_INFINITY;\n\n return leftMin <= rightMax && rightMin <= leftMax;\n}\n\nexport function mediaDefinitionsIntersect(left: MediaDefinition, right: MediaDefinition): boolean {\n if (left.type !== right.type) return false;\n return left.clauses.some(leftClause =>\n right.clauses.some(\n rightClause =>\n (leftClause.orientation === undefined ||\n rightClause.orientation === undefined ||\n leftClause.orientation === rightClause.orientation) &&\n mediaRangesIntersect(leftClause, rightClause),\n ),\n );\n}\n","export interface TailwindArbitrarySyntax {\n readonly important: boolean;\n}\n\nconst closingByOpening = new Map([\n ['(', ')'],\n ['[', ']'],\n ['{', '}'],\n]);\n\nexport function analyzeTailwindArbitrarySyntax(value: string): TailwindArbitrarySyntax | undefined {\n if (!value.startsWith('[') || !value.endsWith(']')) return undefined;\n const inner = value.slice(1, -1);\n if (inner.trim().length === 0) return undefined;\n\n const stack: string[] = [];\n let quote: '\"' | \"'\" | undefined;\n let typedSeparator = -1;\n let topLevelValue = '';\n\n for (let index = 0; index < inner.length; index += 1) {\n const character = inner[index];\n if (character === undefined) return undefined;\n const codePoint = character.codePointAt(0);\n if (codePoint === undefined || codePoint <= 0x1f || codePoint === 0x7f) return undefined;\n\n if (quote !== undefined) {\n if (character === '\\\\') {\n if (inner[index + 1] === undefined) return undefined;\n index += 1;\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '/' && inner[index + 1] === '*') {\n const commentEnd = inner.indexOf('*/', index + 2);\n if (commentEnd < 0) return undefined;\n if (stack.length === 0) topLevelValue += ' ';\n index = commentEnd + 1;\n continue;\n }\n\n if (character === '\\\\') {\n const escaped = inner[index + 1];\n if (escaped === undefined || escaped === '\\n' || escaped === '\\r' || escaped === '\\f') return undefined;\n if (stack.length === 0) topLevelValue += escaped === '_' ? '_' : 'x';\n index += 1;\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n if (stack.length === 0) topLevelValue += 'x';\n quote = character;\n continue;\n }\n\n const closing = closingByOpening.get(character);\n if (closing !== undefined) {\n if (stack.length === 0) topLevelValue += 'x';\n stack.push(closing);\n continue;\n }\n if ([')', ']', '}'].includes(character)) {\n if (stack.pop() !== character) return undefined;\n continue;\n }\n if (stack.length !== 0) continue;\n\n if (character === ';') return undefined;\n if (character === ':' && typedSeparator < 0) typedSeparator = index;\n topLevelValue += character === '_' ? ' ' : character;\n }\n\n if (quote !== undefined || stack.length !== 0) return undefined;\n if (\n typedSeparator >= 0 &&\n (inner.slice(0, typedSeparator).trim().length === 0 || inner.slice(typedSeparator + 1).trim().length === 0)\n ) {\n return undefined;\n }\n\n return { important: /!\\s*important\\s*$/iu.test(topLevelValue) };\n}\n\nexport function hasValidTailwindArbitrarySyntax(value: string): boolean {\n return analyzeTailwindArbitrarySyntax(value) !== undefined;\n}\n","type CssPropertyOwnership =\n | { readonly kind: 'universal' }\n | { readonly kind: 'known'; readonly longhands: ReadonlySet<string> }\n | { readonly kind: 'unknown'; readonly property: string }\n | { readonly kind: 'custom'; readonly property: string };\n\nconst edges = ['top', 'right', 'bottom', 'left'] as const;\n\nfunction edgeLonghands(prefix: string, suffix?: string): readonly string[] {\n return edges.map(edge => `${prefix}-${edge}${suffix === undefined ? '' : `-${suffix}`}`);\n}\n\nconst physicalBorderWidths = edgeLonghands('border', 'width');\nconst physicalBorderStyles = edgeLonghands('border', 'style');\nconst physicalBorderColors = edgeLonghands('border', 'color');\nconst logicalBorderWidths = [\n 'border-inline-start-width',\n 'border-inline-end-width',\n 'border-block-start-width',\n 'border-block-end-width',\n] as const;\nconst logicalBorderStyles = [\n 'border-inline-start-style',\n 'border-inline-end-style',\n 'border-block-start-style',\n 'border-block-end-style',\n] as const;\nconst logicalBorderColors = [\n 'border-inline-start-color',\n 'border-inline-end-color',\n 'border-block-start-color',\n 'border-block-end-color',\n] as const;\nconst borderWidths = [...physicalBorderWidths, ...logicalBorderWidths];\nconst borderStyles = [...physicalBorderStyles, ...logicalBorderStyles];\nconst borderColors = [...physicalBorderColors, ...logicalBorderColors];\nconst borderImage = [\n 'border-image-source',\n 'border-image-slice',\n 'border-image-width',\n 'border-image-outset',\n 'border-image-repeat',\n] as const;\n\nconst shorthandLonghands = new Map<string, readonly string[]>([\n [\n 'margin',\n [...edgeLonghands('margin'), 'margin-inline-start', 'margin-inline-end', 'margin-block-start', 'margin-block-end'],\n ],\n ['margin-inline', ['margin-inline-start', 'margin-inline-end', 'margin-left', 'margin-right']],\n ['margin-block', ['margin-block-start', 'margin-block-end', 'margin-top', 'margin-bottom']],\n ['margin-inline-start', ['margin-inline-start', 'margin-left', 'margin-right']],\n ['margin-inline-end', ['margin-inline-end', 'margin-left', 'margin-right']],\n [\n 'padding',\n [\n ...edgeLonghands('padding'),\n 'padding-inline-start',\n 'padding-inline-end',\n 'padding-block-start',\n 'padding-block-end',\n ],\n ],\n ['padding-inline', ['padding-inline-start', 'padding-inline-end', 'padding-left', 'padding-right']],\n ['padding-block', ['padding-block-start', 'padding-block-end', 'padding-top', 'padding-bottom']],\n ['padding-inline-start', ['padding-inline-start', 'padding-left', 'padding-right']],\n ['padding-inline-end', ['padding-inline-end', 'padding-left', 'padding-right']],\n ['inset', [...edges, 'inset-inline-start', 'inset-inline-end', 'inset-block-start', 'inset-block-end']],\n ['inset-inline', ['inset-inline-start', 'inset-inline-end', 'left', 'right']],\n ['inset-block', ['inset-block-start', 'inset-block-end', 'top', 'bottom']],\n ['gap', ['row-gap', 'column-gap']],\n [\n 'font',\n [\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'font-stretch',\n 'font-size',\n 'line-height',\n 'font-family',\n 'font-size-adjust',\n 'font-kerning',\n 'font-optical-sizing',\n 'font-feature-settings',\n 'font-variation-settings',\n 'font-language-override',\n ],\n ],\n [\n 'background',\n [\n 'background-image',\n 'background-position',\n 'background-size',\n 'background-repeat',\n 'background-origin',\n 'background-clip',\n 'background-attachment',\n 'background-color',\n ],\n ],\n ['border', [...borderWidths, ...borderStyles, ...borderColors, ...borderImage]],\n ['border-top', ['border-top-width', 'border-top-style', 'border-top-color']],\n ['border-right', ['border-right-width', 'border-right-style', 'border-right-color']],\n ['border-bottom', ['border-bottom-width', 'border-bottom-style', 'border-bottom-color']],\n ['border-left', ['border-left-width', 'border-left-style', 'border-left-color']],\n ['border-width', borderWidths],\n [\n 'border-inline-width',\n ['border-inline-start-width', 'border-inline-end-width', 'border-left-width', 'border-right-width'],\n ],\n ['border-block-width', ['border-block-start-width', 'border-block-end-width', ...physicalBorderWidths]],\n ['border-inline-start-width', ['border-inline-start-width', 'border-left-width', 'border-right-width']],\n ['border-inline-end-width', ['border-inline-end-width', 'border-left-width', 'border-right-width']],\n ['border-block-start-width', ['border-block-start-width', ...physicalBorderWidths]],\n ['border-block-end-width', ['border-block-end-width', ...physicalBorderWidths]],\n ['border-style', borderStyles],\n [\n 'border-inline-style',\n ['border-inline-start-style', 'border-inline-end-style', 'border-left-style', 'border-right-style'],\n ],\n ['border-block-style', ['border-block-start-style', 'border-block-end-style', ...physicalBorderStyles]],\n ['border-inline-start-style', ['border-inline-start-style', 'border-left-style', 'border-right-style']],\n ['border-inline-end-style', ['border-inline-end-style', 'border-left-style', 'border-right-style']],\n ['border-block-start-style', ['border-block-start-style', ...physicalBorderStyles]],\n ['border-block-end-style', ['border-block-end-style', ...physicalBorderStyles]],\n ['border-color', borderColors],\n [\n 'border-inline-color',\n ['border-inline-start-color', 'border-inline-end-color', 'border-left-color', 'border-right-color'],\n ],\n ['border-block-color', ['border-block-start-color', 'border-block-end-color', ...physicalBorderColors]],\n ['border-inline-start-color', ['border-inline-start-color', 'border-left-color', 'border-right-color']],\n ['border-inline-end-color', ['border-inline-end-color', 'border-left-color', 'border-right-color']],\n ['border-block-start-color', ['border-block-start-color', ...physicalBorderColors]],\n ['border-block-end-color', ['border-block-end-color', ...physicalBorderColors]],\n [\n 'border-radius',\n [\n 'border-top-left-radius',\n 'border-top-right-radius',\n 'border-bottom-right-radius',\n 'border-bottom-left-radius',\n 'border-start-start-radius',\n 'border-start-end-radius',\n 'border-end-start-radius',\n 'border-end-end-radius',\n ],\n ],\n ['border-image', borderImage],\n ['overflow', ['overflow-x', 'overflow-y']],\n ['flex', ['flex-grow', 'flex-shrink', 'flex-basis']],\n [\n 'transition',\n [\n 'transition-property',\n 'transition-duration',\n 'transition-timing-function',\n 'transition-delay',\n 'transition-behavior',\n ],\n ],\n ['grid-template', ['grid-template-rows', 'grid-template-columns', 'grid-template-areas']],\n ['grid-column', ['grid-column-start', 'grid-column-end']],\n ['grid-row', ['grid-row-start', 'grid-row-end']],\n [\n 'grid',\n [\n 'grid-template-rows',\n 'grid-template-columns',\n 'grid-template-areas',\n 'grid-auto-rows',\n 'grid-auto-columns',\n 'grid-auto-flow',\n ],\n ],\n ['list-style', ['list-style-type', 'list-style-position', 'list-style-image']],\n ['columns', ['column-width', 'column-count']],\n ['column-rule', ['column-rule-width', 'column-rule-style', 'column-rule-color']],\n ['outline', ['outline-width', 'outline-style', 'outline-color']],\n [\n 'text-decoration',\n ['text-decoration-line', 'text-decoration-style', 'text-decoration-color', 'text-decoration-thickness'],\n ],\n ['place-content', ['align-content', 'justify-content']],\n ['place-items', ['align-items', 'justify-items']],\n ['place-self', ['align-self', 'justify-self']],\n [\n 'animation',\n [\n 'animation-name',\n 'animation-duration',\n 'animation-timing-function',\n 'animation-delay',\n 'animation-iteration-count',\n 'animation-direction',\n 'animation-fill-mode',\n 'animation-play-state',\n 'animation-timeline',\n 'animation-range-start',\n 'animation-range-end',\n ],\n ],\n]);\n\nconst knownIndependentProperties = new Set([\n ...[...shorthandLonghands.values()].flatMap(longhands => [...longhands]),\n 'display',\n 'box-sizing',\n 'flex-direction',\n 'flex-wrap',\n 'justify-items',\n 'justify-self',\n 'width',\n 'height',\n 'min-width',\n 'min-height',\n 'max-width',\n 'max-height',\n 'color',\n 'text-align',\n 'text-wrap',\n 'background-blend-mode',\n 'background-size',\n 'background-attachment',\n 'background-clip',\n 'background-origin',\n 'background-position',\n 'background-repeat',\n 'box-shadow',\n 'opacity',\n 'position',\n 'transform',\n 'translate',\n 'rotate',\n 'scale',\n 'transform-origin',\n 'order',\n 'grid-column-start',\n 'grid-column-end',\n 'grid-row-start',\n 'grid-row-end',\n 'grid-auto-columns',\n 'grid-auto-rows',\n 'table-layout',\n 'object-fit',\n 'object-position',\n 'cursor',\n 'pointer-events',\n 'visibility',\n 'clip',\n 'clip-path',\n 'white-space',\n 'text-overflow',\n 'content',\n 'z-index',\n]);\n\nfunction ownership(property: string): CssPropertyOwnership {\n if (property.startsWith('--')) return { kind: 'custom', property };\n\n const normalized = property.toLowerCase();\n if (normalized === 'all') return { kind: 'universal' };\n const expanded = shorthandLonghands.get(normalized);\n if (expanded !== undefined) return { kind: 'known', longhands: new Set(expanded) };\n if (knownIndependentProperties.has(normalized)) {\n return { kind: 'known', longhands: new Set([normalized]) };\n }\n return { kind: 'unknown', property: normalized };\n}\n\nexport function cssPropertiesOverlap(leftProperty: string, rightProperty: string): boolean {\n const left = ownership(leftProperty);\n const right = ownership(rightProperty);\n\n if (left.kind === 'custom' || right.kind === 'custom') {\n return left.kind === 'custom' && right.kind === 'custom' && left.property === right.property;\n }\n if (left.kind === 'universal' || right.kind === 'universal') return true;\n if (left.kind === 'unknown' || right.kind === 'unknown') return true;\n return [...left.longhands].some(longhand => right.longhands.has(longhand));\n}\n\nexport function cssPropertyOwnershipCovers(ownerProperty: string, targetProperty: string): boolean {\n const owner = ownership(ownerProperty);\n const target = ownership(targetProperty);\n\n if (owner.kind === 'custom' || target.kind === 'custom') {\n return owner.kind === 'custom' && target.kind === 'custom' && owner.property === target.property;\n }\n if (owner.kind === 'universal') return true;\n if (target.kind === 'universal') return false;\n if (owner.kind === 'unknown' || target.kind === 'unknown') {\n return owner.kind === 'unknown' && target.kind === 'unknown' && owner.property === target.property;\n }\n return [...target.longhands].every(longhand => owner.longhands.has(longhand));\n}\n","const cssLengthUnits = new Set([\n 'cm',\n 'mm',\n 'Q',\n 'in',\n 'pc',\n 'pt',\n 'px',\n 'em',\n 'ex',\n 'ch',\n 'rem',\n 'lh',\n 'rlh',\n 'vw',\n 'vh',\n 'vmin',\n 'vmax',\n 'vb',\n 'vi',\n 'svw',\n 'svh',\n 'lvw',\n 'lvh',\n 'dvw',\n 'dvh',\n 'cqw',\n 'cqh',\n 'cqi',\n 'cqb',\n 'cqmin',\n 'cqmax',\n]);\n\nconst cssColorKeywords = new Set(\n `black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua aliceblue\n antiquewhite aquamarine azure beige bisque blanchedalmond blueviolet brown burlywood cadetblue chartreuse\n chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey\n darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue\n darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick\n floralwhite forestgreen gainsboro ghostwhite gold goldenrod greenyellow grey honeydew hotpink indianred indigo ivory\n khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray\n lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue\n lightyellow limegreen linen magenta mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen\n mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin\n navajowhite oldlace olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip\n peachpuff peru pink plum powderblue rebeccapurple rosybrown royalblue saddlebrown salmon sandybrown seagreen\n seashell sienna skyblue slateblue slategray slategrey snow springgreen steelblue tan thistle tomato turquoise violet\n wheat whitesmoke yellowgreen transparent currentcolor canvas canvastext linktext visitedtext activetext buttonface\n buttontext buttonborder field fieldtext highlight highlighttext selecteditem selecteditemtext mark marktext graytext\n accentcolor accentcolortext`\n .split(/\\s+/u)\n .filter(Boolean),\n);\n\nconst absoluteFontSizes = new Set([\n 'xx-small',\n 'x-small',\n 'small',\n 'medium',\n 'large',\n 'x-large',\n 'xx-large',\n 'xxx-large',\n]);\nconst relativeFontSizes = new Set(['larger', 'smaller']);\nconst defaultTailwindColorNames = new Set([\n 'red',\n 'orange',\n 'amber',\n 'yellow',\n 'lime',\n 'green',\n 'emerald',\n 'teal',\n 'cyan',\n 'sky',\n 'blue',\n 'indigo',\n 'violet',\n 'purple',\n 'fuchsia',\n 'pink',\n 'rose',\n 'slate',\n 'gray',\n 'zinc',\n 'neutral',\n 'stone',\n]);\nconst defaultTailwindColorShades = new Set([\n '50',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '950',\n]);\n\nconst unsignedDecimal = /^(?:(?:\\d+(?:\\.\\d+)?)|(?:\\.\\d+))$/u;\nconst signedCssNumber = /^[+-]?(?:\\d*\\.)?\\d+(?:e[+-]?\\d+)?$/iu;\nconst mathFunction = /(?:calc|min|max|clamp|mod|rem|sin|cos|tan|asin|acos|atan|atan2|pow|sqrt|hypot|log|exp|round)\\(/u;\nconst colorFunction = /^(?:rgba?|hsla?|hwb|color|(?:ok)?(?:lab|lch)|light-dark|color-mix|--alpha)\\(/iu;\n\ninterface ArbitraryValue {\n readonly hint?: string;\n readonly payload: string;\n}\n\nfunction arbitraryValue(value: string): ArbitraryValue | undefined {\n if (!value.startsWith('[') || !value.endsWith(']')) return undefined;\n const inner = value.slice(1, -1);\n const hinted = inner.match(/^([a-z][a-z-]*):([\\s\\S]+)$/u);\n return hinted === null ? { payload: inner } : { hint: hinted[1], payload: hinted[2] ?? '' };\n}\n\nfunction splitNumberAndUnit(value: string): { readonly number: string; readonly unit?: string } | undefined {\n const match = value.match(/^((?:(?:\\d+(?:\\.\\d+)?)|(?:\\.\\d+)))([a-zA-Z%]+)?$/u);\n if (match === null) return undefined;\n return { number: match[1] ?? '', unit: match[2] };\n}\n\nfunction isUnsignedLength(value: string, allowPercentage: boolean, allowUnitless: boolean): boolean {\n const parsed = splitNumberAndUnit(value);\n if (parsed === undefined || !unsignedDecimal.test(parsed.number)) return false;\n if (parsed.unit === undefined) return allowUnitless;\n return (allowPercentage && parsed.unit === '%') || cssLengthUnits.has(parsed.unit);\n}\n\nexport function isConservativelyAdmittedTextLength(value: string): boolean {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return false;\n if (arbitrary.hint !== undefined && arbitrary.hint !== 'length') return false;\n if (arbitrary.hint === 'length' && arbitrary.payload === '0') return true;\n return isUnsignedLength(arbitrary.payload, true, false);\n}\n\nexport function isConservativelyAdmittedBorderWidth(value: string): boolean {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return false;\n if (arbitrary.hint !== undefined && arbitrary.hint !== 'length') return false;\n if (arbitrary.hint === 'length' && arbitrary.payload === '0') return true;\n return isUnsignedLength(arbitrary.payload, false, arbitrary.hint === undefined);\n}\n\nfunction isTailwindLength(value: string): boolean {\n if (/^--spacing\\(/iu.test(value)) return true;\n if (mathFunction.test(value)) return true;\n const match = value.match(/^([+-]?(?:\\d*\\.)?\\d+(?:e[+-]?\\d+)?)([a-zA-Z]+)$/iu);\n return match !== null && signedCssNumber.test(match[1] ?? '') && cssLengthUnits.has(match[2] ?? '');\n}\n\nfunction isTailwindPercentage(value: string): boolean {\n return /^[+-]?(?:\\d*\\.)?\\d+(?:e[+-]?\\d+)?%$/iu.test(value) || mathFunction.test(value);\n}\n\nfunction decodedInferenceValue(value: string): string | undefined {\n if (value.includes('\\\\')) return undefined;\n return value.replaceAll('_', ' ');\n}\n\ntype TailwindDataType = 'color' | 'length' | 'percentage' | 'absolute-size' | 'relative-size' | 'line-width';\n\nfunction inferTailwindDataType(value: string, types: readonly TailwindDataType[]): TailwindDataType | undefined {\n if (value.startsWith('var(')) return undefined;\n\n for (const type of types) {\n if (\n type === 'color' &&\n (value.startsWith('#') || colorFunction.test(value) || cssColorKeywords.has(value.toLowerCase()))\n ) {\n return type;\n }\n if (type === 'length' && isTailwindLength(value)) return type;\n if (type === 'percentage' && isTailwindPercentage(value)) return type;\n if (type === 'absolute-size' && absoluteFontSizes.has(value)) return type;\n if (type === 'relative-size' && relativeFontSizes.has(value)) return type;\n if (type === 'line-width') {\n const parts = value.split(' ');\n if (\n parts.length > 0 &&\n parts.every(\n part =>\n part.length > 0 &&\n (isTailwindLength(part) || signedCssNumber.test(part) || ['thin', 'medium', 'thick'].includes(part)),\n )\n ) {\n return type;\n }\n }\n }\n return undefined;\n}\n\nexport function isPinnedTailwindColorToken(value: string): boolean {\n const [color, opacity, remainder] = value.split('/');\n if (remainder !== undefined || color === undefined) return false;\n const standard = ['inherit', 'current', 'transparent', 'black', 'white'].includes(color);\n const [name, shade, extra] = color.split('-');\n const palette =\n extra === undefined &&\n name !== undefined &&\n shade !== undefined &&\n defaultTailwindColorNames.has(name) &&\n defaultTailwindColorShades.has(shade);\n if (!standard && !palette) return false;\n if (opacity === undefined) return true;\n if (!/^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/u.test(opacity)) return false;\n const numericOpacity = Number(opacity);\n return numericOpacity >= 0 && numericOpacity <= 100;\n}\n\nexport function tailwindArbitraryTextKind(value: string): 'color' | 'font-size' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (['size', 'length', 'percentage', 'absolute-size', 'relative-size'].includes(arbitrary.hint ?? '')) {\n return 'font-size';\n }\n if (arbitrary.hint === 'color') return 'color';\n if (arbitrary.hint !== undefined) return 'unknown';\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n const inferred = inferTailwindDataType(payload, ['color', 'length', 'percentage', 'absolute-size', 'relative-size']);\n return inferred !== undefined && inferred !== 'color' ? 'font-size' : 'color';\n}\n\nfunction isTailwindBackgroundPosition(value: string): boolean {\n let recognized = 0;\n for (const part of value.split(' ')) {\n if (['center', 'top', 'right', 'bottom', 'left'].includes(part)) {\n recognized += 1;\n continue;\n }\n if (part.startsWith('var(')) continue;\n if (!isTailwindLength(part) && !isTailwindPercentage(part)) return false;\n recognized += 1;\n }\n return recognized > 0;\n}\n\nfunction isTailwindBackgroundSize(value: string): boolean {\n let recognized = 0;\n for (const layer of value.split(',')) {\n if (layer === 'cover' || layer === 'contain') {\n recognized += 1;\n continue;\n }\n const parts = layer.split(' ');\n if (\n (parts.length !== 1 && parts.length !== 2) ||\n !parts.every(part => part === 'auto' || isTailwindLength(part) || isTailwindPercentage(part))\n ) {\n return false;\n }\n recognized += 1;\n }\n return recognized > 0;\n}\n\nfunction splitTopLevelCommas(value: string): readonly string[] | undefined {\n const closingByOpening = new Map([\n ['(', ')'],\n ['[', ']'],\n ['{', '}'],\n ]);\n const stack: string[] = [];\n const parts: string[] = [];\n let quote: '\"' | \"'\" | undefined;\n let start = 0;\n\n for (let index = 0; index < value.length; index += 1) {\n const character = value[index];\n if (character === undefined) return undefined;\n if (quote !== undefined) {\n if (character === '\\\\') index += 1;\n else if (character === quote) quote = undefined;\n continue;\n }\n if (character === '\\\\') {\n index += 1;\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n const closing = closingByOpening.get(character);\n if (closing !== undefined) {\n stack.push(closing);\n continue;\n }\n if ([')', ']', '}'].includes(character)) {\n if (stack.pop() !== character) return undefined;\n continue;\n }\n if (character === ',' && stack.length === 0) {\n parts.push(value.slice(start, index));\n start = index + 1;\n }\n }\n if (quote !== undefined || stack.length > 0) return undefined;\n parts.push(value.slice(start));\n return parts;\n}\n\nfunction isTailwindBackgroundImage(value: string): boolean {\n const layers = splitTopLevelCommas(value);\n if (layers === undefined) return false;\n let recognized = 0;\n for (const layer of layers) {\n const normalized = layer.trim();\n if (normalized.startsWith('var(')) continue;\n if (\n !/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|element|image|cross-fade|image-set)\\([\\s\\S]*\\)$/u.test(\n normalized,\n )\n ) {\n return false;\n }\n recognized += 1;\n }\n return recognized > 0;\n}\n\nexport function tailwindArbitraryBackgroundKind(\n value: string,\n): 'background-color' | 'background-image' | 'background-position' | 'background-size' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (arbitrary.hint === 'percentage' || arbitrary.hint === 'position') return 'background-position';\n if (['bg-size', 'length', 'size'].includes(arbitrary.hint ?? '')) return 'background-size';\n if (arbitrary.hint === 'image' || arbitrary.hint === 'url') return 'background-image';\n if (arbitrary.hint === 'color') return 'background-color';\n if (arbitrary.hint !== undefined) return 'unknown';\n\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n if (payload.startsWith('var(')) return 'unknown';\n if (isTailwindBackgroundImage(payload)) return 'background-image';\n if (inferTailwindDataType(payload, ['color']) === 'color') return 'background-color';\n\n const position = isTailwindBackgroundPosition(payload);\n const size = isTailwindBackgroundSize(payload);\n if (position === size) return 'unknown';\n return position ? 'background-position' : 'background-size';\n}\n\nexport function tailwindArbitraryBorderKind(value: string): 'border-color' | 'border-width' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (arbitrary.hint === 'length' || arbitrary.hint === 'line-width') return 'border-width';\n if (arbitrary.hint === 'color') return 'border-color';\n if (arbitrary.hint !== undefined) return 'unknown';\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n const inferred = inferTailwindDataType(payload, ['color', 'line-width', 'length']);\n return inferred === 'line-width' || inferred === 'length' ? 'border-width' : 'border-color';\n}\n\nexport function tailwindArbitraryShadowKind(value: string): 'shadow-color' | 'shadow-geometry' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (arbitrary.hint === 'color') return 'shadow-color';\n if (arbitrary.hint !== undefined) return 'unknown';\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n return inferTailwindDataType(payload, ['color']) === 'color' ? 'shadow-color' : 'shadow-geometry';\n}\n","import { mediaRangesIntersect, type MediaRange } from '../../breakpoint/breakpoint-catalog';\nimport { analyzeTailwindArbitrarySyntax } from './tailwind-arbitrary-syntax';\nimport { cssPropertiesOverlap } from '../../semantic/css-property-ownership';\nimport {\n isPinnedTailwindColorToken,\n tailwindArbitraryBackgroundKind,\n tailwindArbitraryBorderKind,\n tailwindArbitraryShadowKind,\n tailwindArbitraryTextKind,\n} from './extended/tailwind-arbitrary-value-ownership';\n\nexport type TailwindActivation =\n | { readonly kind: 'base' }\n | { readonly kind: 'media'; readonly range: MediaRange; readonly mediaType?: 'screen' | 'print' };\n\nexport interface TailwindDisplayUtility {\n readonly token: string;\n readonly utility: string;\n readonly activation: TailwindActivation;\n readonly important: boolean;\n}\n\nexport interface TailwindUtilityDescriptor {\n readonly token: string;\n readonly variants: readonly string[];\n readonly utility: string;\n readonly cssProperties: readonly string[];\n readonly hasUnknownCssAuthority?: true;\n readonly activation: TailwindActivation;\n readonly hasGeneratedMediaVariant: boolean;\n readonly important: boolean;\n}\n\nconst displayUtilities = new Set([\n 'inline',\n 'block',\n 'inline-block',\n 'flow-root',\n 'flex',\n 'inline-flex',\n 'grid',\n 'inline-grid',\n 'contents',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-column',\n 'table-column-group',\n 'table-footer-group',\n 'table-header-group',\n 'table-row-group',\n 'table-row',\n 'list-item',\n 'hidden',\n]);\n\nconst generatedScreenMediaVariant =\n /^\\[@media_screen_and_(?:(?:\\(min-width:_(\\d+(?:\\.\\d+)?)px\\))(?:_and_\\(max-width:_(\\d+(?:\\.\\d+)?)px\\))?|\\(max-width:_(\\d+(?:\\.\\d+)?)px\\))\\]$/u;\nconst generatedOrientationMediaVariant =\n /^\\[@media_\\(orientation:_(portrait|landscape)\\)(?:_and_\\(min-width:_(\\d+(?:\\.\\d+)?)px\\))?(?:_and_\\(max-width:_(\\d+(?:\\.\\d+)?)px\\))?\\]$/u;\n\nfunction splitVariants(\n className: string,\n): { readonly variants: readonly string[]; readonly utility: string } | undefined {\n let bracketDepth = 0;\n let escaped = false;\n let segmentStart = 0;\n const segments: string[] = [];\n\n for (let index = 0; index < className.length; index += 1) {\n const character = className[index];\n if (escaped) {\n escaped = false;\n continue;\n }\n if (character === '\\\\') {\n escaped = true;\n } else if (character === '[') {\n bracketDepth += 1;\n } else if (character === ']') {\n if (bracketDepth === 0) return undefined;\n bracketDepth -= 1;\n } else if (character === ':' && bracketDepth === 0) {\n const segment = className.slice(segmentStart, index);\n if (segment.length === 0) return undefined;\n segments.push(segment);\n segmentStart = index + 1;\n }\n }\n\n if (escaped || bracketDepth !== 0) return undefined;\n\n const utility = className.slice(segmentStart);\n if (utility.length === 0) return undefined;\n return { variants: Object.freeze(segments), utility };\n}\n\nfunction activation(variants: readonly string[]): TailwindActivation {\n for (const variant of variants) {\n if (variant === '[@media_print]') return { kind: 'media', range: {}, mediaType: 'print' };\n\n const orientationMatch = variant.match(generatedOrientationMediaVariant);\n if (orientationMatch) {\n return {\n kind: 'media',\n range: {\n orientation: orientationMatch[1] as 'portrait' | 'landscape',\n min: orientationMatch[2] === undefined ? undefined : Number(orientationMatch[2]),\n max: orientationMatch[3] === undefined ? undefined : Number(orientationMatch[3]),\n },\n };\n }\n\n const match = variant.match(generatedScreenMediaVariant);\n if (!match) continue;\n const min = match[1] === undefined ? undefined : Number(match[1]);\n const maxValue = match[2] ?? match[3];\n const max = maxValue === undefined ? undefined : Number(maxValue);\n if (min !== undefined && max !== undefined && min > max) continue;\n return { kind: 'media', range: { min, max } };\n }\n\n return { kind: 'base' };\n}\n\nfunction hasGeneratedMediaVariant(variants: readonly string[]): boolean {\n return variants.some(variant => variant.startsWith('[@media_'));\n}\n\nfunction hasInternalDeclarationImportance(utility: string): boolean {\n const arbitraryStart = utility.indexOf('[');\n if (arbitraryStart < 0) return false;\n return analyzeTailwindArbitrarySyntax(utility.slice(arbitraryStart))?.important ?? false;\n}\n\ntype CssAuthority = readonly string[] | 'unknown';\n\nconst textSizes = new Set(['xs', 'sm', 'base', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl', '8xl', '9xl']);\nconst shadowGeometryNames = new Set(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', 'none']);\nconst insetShadowGeometryNames = new Set(['2xs', 'xs', 'sm', 'none']);\n\ninterface BorderFamilyOwnership {\n readonly namespace: string;\n readonly width: readonly string[];\n readonly color: readonly string[];\n}\n\nconst borderFamilies: readonly BorderFamilyOwnership[] = [\n {\n namespace: 'border-bs',\n width: ['border-block-start-style', 'border-block-start-width'],\n color: ['border-block-start-color'],\n },\n {\n namespace: 'border-be',\n width: ['border-block-end-style', 'border-block-end-width'],\n color: ['border-block-end-color'],\n },\n {\n namespace: 'border-x',\n width: ['border-inline-style', 'border-inline-width'],\n color: ['border-inline-color'],\n },\n {\n namespace: 'border-y',\n width: ['border-block-style', 'border-block-width'],\n color: ['border-block-color'],\n },\n {\n namespace: 'border-s',\n width: ['border-inline-start-style', 'border-inline-start-width'],\n color: ['border-inline-start-color'],\n },\n {\n namespace: 'border-e',\n width: ['border-inline-end-style', 'border-inline-end-width'],\n color: ['border-inline-end-color'],\n },\n { namespace: 'border-t', width: ['border-top-style', 'border-top-width'], color: ['border-top-color'] },\n { namespace: 'border-r', width: ['border-right-style', 'border-right-width'], color: ['border-right-color'] },\n { namespace: 'border-b', width: ['border-bottom-style', 'border-bottom-width'], color: ['border-bottom-color'] },\n { namespace: 'border-l', width: ['border-left-style', 'border-left-width'], color: ['border-left-color'] },\n { namespace: 'border', width: ['border-style', 'border-width'], color: ['border-color'] },\n];\n\nconst recognizedTailwindAuthorityNamespaces = [\n '@container',\n 'accent',\n 'align',\n 'animate',\n 'appearance',\n 'aspect',\n 'auto-cols',\n 'auto-rows',\n 'backdrop',\n 'backface',\n 'basis',\n 'bg',\n 'block',\n 'blur',\n 'border',\n 'box-decoration',\n 'break',\n 'brightness',\n 'caption',\n 'caret',\n 'clear',\n 'col',\n 'columns',\n 'contain',\n 'content',\n 'contrast',\n 'decoration',\n 'delay',\n 'divide',\n 'drop-shadow',\n 'duration',\n 'ease',\n 'end',\n 'field-sizing',\n 'fill',\n 'filter',\n 'float',\n 'font',\n 'forced-color-adjust',\n 'from',\n 'gradient',\n 'grid',\n 'grid-flow',\n 'grayscale',\n 'hue-rotate',\n 'hyphens',\n 'indent',\n 'inline',\n 'inset-ring',\n 'inset-shadow',\n 'invert',\n 'isolate',\n 'isolation',\n 'justify-items',\n 'justify-self',\n 'leading',\n 'line-clamp',\n 'list',\n 'list-image',\n 'mask',\n 'max-block',\n 'max-inline',\n 'mbe',\n 'mbs',\n 'min-block',\n 'min-inline',\n 'mix-blend',\n 'object',\n 'opacity',\n 'order',\n 'origin',\n 'outline',\n 'overflow',\n 'overscroll',\n 'place-content',\n 'place-items',\n 'place-self',\n 'placeholder',\n 'pbe',\n 'pbs',\n 'perspective',\n 'perspective-origin',\n 'resize',\n 'ring',\n 'rotate',\n 'rounded',\n 'row',\n 'saturate',\n 'scale',\n 'scheme',\n 'scroll',\n 'scrollbar',\n 'select',\n 'sepia',\n 'shadow',\n 'skew',\n 'snap',\n 'space',\n 'start',\n 'stroke',\n 'tab',\n 'table',\n 'text',\n 'to',\n 'touch',\n 'tracking',\n 'transform',\n 'transition',\n 'translate',\n 'underline-offset',\n 'via',\n 'whitespace',\n 'will-change',\n 'wrap',\n 'z',\n 'zoom',\n] as const;\n\nconst recognizedTailwindAuthorityTokens = new Set([\n 'antialiased',\n 'border-collapse',\n 'border-separate',\n 'capitalize',\n 'container',\n 'diagonal-fractions',\n 'italic',\n 'line-through',\n 'lining-nums',\n 'lowercase',\n 'no-underline',\n 'normal-case',\n 'normal-nums',\n 'not-italic',\n 'oldstyle-nums',\n 'ordinal',\n 'outline',\n 'overline',\n 'proportional-nums',\n 'slashed-zero',\n 'stacked-fractions',\n 'subpixel-antialiased',\n 'tabular-nums',\n 'truncate',\n 'underline',\n 'uppercase',\n]);\n\nfunction isCanonicalInteger(value: string): boolean {\n return /^(?:0|[1-9]\\d*)$/u.test(value);\n}\n\nfunction isCssVariableShorthand(value: string): boolean {\n return /^\\(--[A-Za-z_][A-Za-z0-9_-]*\\)$/u.test(value);\n}\n\nfunction borderCssAuthority(utility: string): CssAuthority | undefined {\n const family = borderFamilies.find(\n current => utility === current.namespace || utility.startsWith(`${current.namespace}-`),\n );\n if (family === undefined) return undefined;\n const suffix = utility === family.namespace ? '' : utility.slice(family.namespace.length + 1);\n if (suffix.length === 0 || isCanonicalInteger(suffix)) return family.width;\n if (family.namespace === 'border' && ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none'].includes(suffix)) {\n return ['--tw-border-style', 'border-style'];\n }\n if (suffix.startsWith('[') && suffix.endsWith(']')) {\n const kind = tailwindArbitraryBorderKind(suffix);\n if (kind === 'border-width') return family.width;\n if (kind === 'border-color') return family.color;\n return 'unknown';\n }\n if (isCssVariableShorthand(suffix) || isPinnedTailwindColorToken(suffix)) return family.color;\n return 'unknown';\n}\n\nfunction shadowCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'shadow') return ['--tw-shadow', 'box-shadow'];\n if (!utility.startsWith('shadow-')) return undefined;\n const suffix = utility.slice('shadow-'.length);\n if (suffix.startsWith('[') && suffix.endsWith(']')) {\n const kind = tailwindArbitraryShadowKind(suffix);\n if (kind === 'shadow-color') return ['--tw-shadow-color'];\n if (kind === 'shadow-geometry') return ['--tw-shadow', 'box-shadow'];\n return 'unknown';\n }\n if (isCssVariableShorthand(suffix) || shadowGeometryNames.has(suffix)) return ['--tw-shadow', 'box-shadow'];\n if (isPinnedTailwindColorToken(suffix)) return ['--tw-shadow-color'];\n return 'unknown';\n}\n\nfunction ringCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'ring') return ['--tw-ring-shadow', 'box-shadow'];\n if (utility === 'ring-inset') return ['--tw-ring-inset'];\n if (!utility.startsWith('ring-')) return undefined;\n const suffix = utility.slice('ring-'.length);\n if (isCanonicalInteger(suffix)) return ['--tw-ring-shadow', 'box-shadow'];\n if (isPinnedTailwindColorToken(suffix)) return ['--tw-ring-color'];\n return 'unknown';\n}\n\nfunction insetShadowCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'inset-shadow') return 'unknown';\n if (!utility.startsWith('inset-shadow-')) return undefined;\n const suffix = utility.slice('inset-shadow-'.length);\n if (insetShadowGeometryNames.has(suffix)) return ['--tw-inset-shadow', 'box-shadow'];\n if (suffix === 'initial' || isPinnedTailwindColorToken(suffix)) return ['--tw-inset-shadow-color'];\n return 'unknown';\n}\n\nfunction insetRingCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'inset-ring') return ['--tw-inset-ring-shadow', 'box-shadow'];\n if (!utility.startsWith('inset-ring-')) return undefined;\n const suffix = utility.slice('inset-ring-'.length);\n if (isCanonicalInteger(suffix)) return ['--tw-inset-ring-shadow', 'box-shadow'];\n if (isPinnedTailwindColorToken(suffix)) return ['--tw-inset-ring-color'];\n return 'unknown';\n}\n\nfunction arbitraryBackgroundCssAuthority(value: string): CssAuthority {\n const arbitrary = value.match(/^\\[([\\s\\S]+)\\](?:\\/[\\s\\S]+)?$/u)?.[1];\n if (arbitrary === undefined) return 'unknown';\n const property = tailwindArbitraryBackgroundKind(`[${arbitrary}]`);\n return property === 'unknown' ? property : [property];\n}\n\nfunction isRecognizedTailwindAuthority(utility: string): boolean {\n const normalized = utility.startsWith('-') ? utility.slice(1) : utility;\n return (\n recognizedTailwindAuthorityTokens.has(normalized) ||\n recognizedTailwindAuthorityNamespaces.some(\n namespace => normalized === namespace || normalized.startsWith(`${namespace}-`),\n )\n );\n}\n\nfunction cssProperties(utility: string): CssAuthority | undefined {\n const arbitraryProperty = utility.match(/^\\[([^:]+):/u)?.[1];\n if (arbitraryProperty) return [arbitraryProperty];\n if (displayUtilities.has(utility)) return ['display'];\n if (/^flex-(?:row|row-reverse|col|col-reverse)$/u.test(utility)) return ['flex-direction'];\n if (/^flex-(?:wrap|wrap-reverse|nowrap)$/u.test(utility)) return ['flex-wrap'];\n if (/^flex-.+$/u.test(utility)) return ['flex'];\n if (/^grow(?:-.+)?$/u.test(utility)) return ['flex-grow'];\n if (/^shrink(?:-.+)?$/u.test(utility)) return ['flex-shrink'];\n if (/^basis-.+$/u.test(utility)) return ['flex-basis'];\n if (/^box-(?:border|content)$/u.test(utility)) return ['box-sizing'];\n if (/^justify-items-/u.test(utility)) return ['justify-items'];\n if (/^justify-self-/u.test(utility)) return ['justify-self'];\n if (/^justify-/u.test(utility)) return ['justify-content'];\n if (/^items-/u.test(utility)) return ['align-items'];\n if (utility === 'content-none') return ['--tw-content', 'content'];\n if (/^content-\\[/u.test(utility)) return ['--tw-content', 'content'];\n if (/^content-/u.test(utility)) return ['align-content'];\n if (/^self-/u.test(utility)) return ['align-self'];\n if (/^gap-x-/u.test(utility)) return ['column-gap'];\n if (/^gap-y-/u.test(utility)) return ['row-gap'];\n if (/^gap-/u.test(utility)) return ['gap'];\n if (/^order-/u.test(utility)) return ['order'];\n if (/^-?m-/u.test(utility)) return ['margin'];\n if (/^-?mx-/u.test(utility)) return ['margin-inline'];\n if (/^-?my-/u.test(utility)) return ['margin-block'];\n if (/^-?mt-/u.test(utility)) return ['margin-top'];\n if (/^-?mr-/u.test(utility)) return ['margin-right'];\n if (/^-?mb-/u.test(utility)) return ['margin-bottom'];\n if (/^-?ml-/u.test(utility)) return ['margin-left'];\n if (/^-?ms-/u.test(utility)) return ['margin-inline-start'];\n if (/^-?me-/u.test(utility)) return ['margin-inline-end'];\n if (/^p-/u.test(utility)) return ['padding'];\n if (/^px-/u.test(utility)) return ['padding-inline'];\n if (/^py-/u.test(utility)) return ['padding-block'];\n if (/^pt-/u.test(utility)) return ['padding-top'];\n if (/^pr-/u.test(utility)) return ['padding-right'];\n if (/^pb-/u.test(utility)) return ['padding-bottom'];\n if (/^pl-/u.test(utility)) return ['padding-left'];\n if (/^ps-/u.test(utility)) return ['padding-inline-start'];\n if (/^pe-/u.test(utility)) return ['padding-inline-end'];\n if (/^size-/u.test(utility)) return ['width', 'height'];\n if (/^w-/u.test(utility)) return ['width'];\n if (/^h-/u.test(utility)) return ['height'];\n if (/^min-w-/u.test(utility)) return ['min-width'];\n if (/^min-h-/u.test(utility)) return ['min-height'];\n if (/^max-w-/u.test(utility)) return ['max-width'];\n if (/^max-h-/u.test(utility)) return ['max-height'];\n const textValue = utility.match(/^text-([\\s\\S]+)$/u)?.[1];\n const [textBaseValue] = textValue?.split('/') ?? [];\n if (textBaseValue !== undefined && textSizes.has(textBaseValue)) return ['font-size', 'line-height'];\n const arbitraryText = utility.match(/^text-(\\[[\\s\\S]+\\])(?:\\/[^\\s]+)?$/u)?.[1];\n if (arbitraryText !== undefined) {\n const kind = tailwindArbitraryTextKind(arbitraryText);\n if (kind === 'color') return ['color'];\n if (kind === 'font-size') return utility.includes(']/') ? ['font-size', 'line-height'] : ['font-size'];\n return 'unknown';\n }\n if (/^text-(?:left|right|center|justify|start|end)$/u.test(utility)) return ['text-align'];\n if (/^text-(?:wrap|nowrap|balance|pretty)$/u.test(utility)) return ['text-wrap'];\n if (/^text-(?:ellipsis|clip)$/u.test(utility)) return ['text-overflow'];\n if (textValue !== undefined && isPinnedTailwindColorToken(textValue)) return ['color'];\n if (/^text-/u.test(utility)) return 'unknown';\n if (/^bg-(?:auto|cover|contain)$/u.test(utility)) return ['background-size'];\n if (/^bg-(?:fixed|local|scroll)$/u.test(utility)) return ['background-attachment'];\n if (/^bg-clip-/u.test(utility)) return ['background-clip'];\n if (/^bg-origin-/u.test(utility)) return ['background-origin'];\n if (/^bg-(?:bottom|center|left|left-bottom|left-top|right|right-bottom|right-top|top)$/u.test(utility)) {\n return ['background-position'];\n }\n if (/^bg-(?:repeat|no-repeat|repeat-x|repeat-y|repeat-round|repeat-space)$/u.test(utility)) {\n return ['background-repeat'];\n }\n if (/^bg-blend-/u.test(utility)) return ['background-blend-mode'];\n if (utility === 'bg-none') return ['background-image'];\n const backgroundValue = utility.match(/^bg-([\\s\\S]+)$/u)?.[1];\n if (backgroundValue?.startsWith('[')) return arbitraryBackgroundCssAuthority(backgroundValue);\n if (isCssVariableShorthand(backgroundValue ?? '')) return 'unknown';\n if (backgroundValue !== undefined && isPinnedTailwindColorToken(backgroundValue)) return ['background-color'];\n if (/^bg-/u.test(utility)) return 'unknown';\n const borderAuthority = borderCssAuthority(utility);\n if (borderAuthority !== undefined) return borderAuthority;\n if (/^rounded(?:-|$)/u.test(utility)) return ['border-radius'];\n const shadowAuthority = shadowCssAuthority(utility);\n if (shadowAuthority !== undefined) return shadowAuthority;\n const ringAuthority = ringCssAuthority(utility);\n if (ringAuthority !== undefined) return ringAuthority;\n const insetShadowAuthority = insetShadowCssAuthority(utility);\n if (insetShadowAuthority !== undefined) return insetShadowAuthority;\n const insetRingAuthority = insetRingCssAuthority(utility);\n if (insetRingAuthority !== undefined) return insetRingAuthority;\n if (utility === 'truncate') return ['overflow', 'text-overflow', 'white-space'];\n if (/^opacity-/u.test(utility)) return ['opacity'];\n if (/^overflow(?:-|$)/u.test(utility)) return ['overflow'];\n if (['static', 'fixed', 'absolute', 'relative', 'sticky'].includes(utility)) return ['position'];\n if (/^-?inset-x-/u.test(utility)) return ['inset-inline'];\n if (/^-?inset-y-/u.test(utility)) return ['inset-block'];\n if (/^-?inset-/u.test(utility)) return ['inset'];\n if (/^-?top-/u.test(utility)) return ['top'];\n if (/^-?right-/u.test(utility)) return ['right'];\n if (/^-?bottom-/u.test(utility)) return ['bottom'];\n if (/^-?left-/u.test(utility)) return ['left'];\n if (/^-?rotate-z-/u.test(utility)) return ['--tw-rotate-z', 'transform'];\n if (/^-?rotate-(?:x|y)-/u.test(utility)) return 'unknown';\n if (/^-?rotate-/u.test(utility)) return ['rotate'];\n if (/^scale-(?:x|y|z)-/u.test(utility)) return 'unknown';\n if (/^scale-(?:\\[|\\()/u.test(utility)) return ['scale'];\n if (/^scale-/u.test(utility)) return ['--tw-scale-x', '--tw-scale-y', '--tw-scale-z', 'scale'];\n if (/^-?translate-z-/u.test(utility)) return 'unknown';\n if (/^-?translate-x-/u.test(utility)) return ['--tw-translate-x', 'translate'];\n if (/^-?translate-y-/u.test(utility)) return ['--tw-translate-y', 'translate'];\n if (/^-?translate-/u.test(utility)) return ['--tw-translate-x', '--tw-translate-y', 'translate'];\n if (utility === 'transition-none') return ['transition-property'];\n if (utility === 'transition-discrete' || utility === 'transition-normal') return ['transition-behavior'];\n if (/^transition(?:-|$)/u.test(utility)) {\n return ['transition-property', 'transition-timing-function', 'transition-duration'];\n }\n if (/^duration-/u.test(utility)) return ['--tw-duration', 'transition-duration'];\n if (/^delay-/u.test(utility)) return ['transition-delay'];\n if (/^ease-/u.test(utility)) return ['--tw-ease', 'transition-timing-function'];\n if (/^grid-cols(?:-|$)/u.test(utility)) return ['grid-template-columns'];\n if (/^auto-cols(?:-|$)/u.test(utility)) return ['grid-auto-columns'];\n if (/^grid-rows(?:-|$)/u.test(utility)) return ['grid-template-rows'];\n if (/^auto-rows(?:-|$)/u.test(utility)) return ['grid-auto-rows'];\n if (/^col-(?:span-|auto$)/u.test(utility)) return ['grid-column'];\n if (/^col-start-/u.test(utility)) return ['grid-column-start'];\n if (/^col-end-/u.test(utility)) return ['grid-column-end'];\n if (/^row-(?:span-|auto$)/u.test(utility)) return ['grid-row'];\n if (/^row-start-/u.test(utility)) return ['grid-row-start'];\n if (/^row-end-/u.test(utility)) return ['grid-row-end'];\n if (/^table-(?:auto|fixed)$/u.test(utility)) return ['table-layout'];\n if (/^list-(?:disc|decimal|none)$/u.test(utility)) return ['list-style-type'];\n if (/^list-(?:inside|outside)$/u.test(utility)) return ['list-style-position'];\n if (/^object-(?:contain|cover|fill|none|scale-down)$/u.test(utility)) return ['object-fit'];\n if (/^object-/u.test(utility)) return ['object-position'];\n if (/^cursor-/u.test(utility)) return ['cursor'];\n if (/^pointer-events-/u.test(utility)) return ['pointer-events'];\n if (['visible', 'invisible', 'collapse'].includes(utility)) return ['visibility'];\n if (utility === 'sr-only') {\n return ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space', 'border-width'];\n }\n if (utility === 'not-sr-only') {\n return ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space'];\n }\n return isRecognizedTailwindAuthority(utility) ? 'unknown' : undefined;\n}\n\nexport function describeTailwindUtility(token: string): TailwindUtilityDescriptor | undefined {\n const split = splitVariants(token);\n if (split === undefined) return undefined;\n const { variants, utility: modifiedUtility } = split;\n const leadingImportant = modifiedUtility.startsWith('!');\n const trailingImportant = modifiedUtility.endsWith('!');\n if (leadingImportant && trailingImportant) return undefined;\n const utility = modifiedUtility.replace(/^!/u, '').replace(/!$/u, '');\n if (utility.length === 0) return undefined;\n const important = leadingImportant || trailingImportant || hasInternalDeclarationImportance(utility);\n const authority = cssProperties(utility);\n return {\n token,\n variants,\n utility,\n cssProperties: authority === undefined || authority === 'unknown' ? [] : authority,\n ...(authority === 'unknown' ? { hasUnknownCssAuthority: true } : {}),\n activation: activation(variants),\n hasGeneratedMediaVariant: hasGeneratedMediaVariant(variants),\n important,\n };\n}\n\nexport function describeTailwindDisplay(token: string): TailwindDisplayUtility | undefined {\n const descriptor = describeTailwindUtility(token);\n if (descriptor === undefined) return undefined;\n if (!descriptor.cssProperties.includes('display')) return undefined;\n return {\n token: descriptor.token,\n utility: descriptor.utility,\n activation: descriptor.activation,\n important: descriptor.important,\n };\n}\n\nfunction activationsIntersect(left: TailwindActivation, right: TailwindActivation): boolean {\n if (left.kind === 'base' || right.kind === 'base') return true;\n if ((left.mediaType ?? 'screen') !== (right.mediaType ?? 'screen')) return false;\n return mediaRangesIntersect(left.range, right.range);\n}\n\nexport function findTailwindClassConflicts(\n existingClassNames: readonly string[],\n generatedClassNames: readonly string[],\n): ReadonlySet<string> {\n const generatedTokens = new Set(generatedClassNames);\n const existing = existingClassNames\n .filter(token => !generatedTokens.has(token))\n .map(describeTailwindUtility)\n .filter(descriptor => descriptor !== undefined);\n const conflicts = new Set<string>();\n\n for (const generated of generatedClassNames\n .map(describeTailwindUtility)\n .filter(descriptor => descriptor !== undefined)) {\n const generatedProperties = generated.cssProperties;\n if (generatedProperties.length === 0) continue;\n if (\n existing.some(\n current =>\n activationsIntersect(current.activation, generated.activation) &&\n (current.hasUnknownCssAuthority === true ||\n generated.hasUnknownCssAuthority === true ||\n current.cssProperties.some(currentProperty =>\n generatedProperties.some(generatedProperty => cssPropertiesOverlap(currentProperty, generatedProperty)),\n )),\n )\n ) {\n conflicts.add(generated.token);\n }\n }\n\n return conflicts;\n}\n\nexport function hasTailwindClassConflict(\n existingClassNames: readonly string[],\n generatedClassNames: readonly string[],\n): boolean {\n return findTailwindClassConflicts(existingClassNames, generatedClassNames).size > 0;\n}\n","import { describeTailwindUtility, type TailwindUtilityDescriptor } from '../tailwind-class-conflict';\nimport { hasValidTailwindArbitrarySyntax } from '../tailwind-arbitrary-syntax';\nimport { isByteExactHtmlClassToken } from '../../../edit/html-attribute-value';\nimport {\n isConservativelyAdmittedBorderWidth,\n isConservativelyAdmittedTextLength,\n} from './tailwind-arbitrary-value-ownership';\n\nexport type TailwindCandidateClassification =\n | { readonly status: 'verified'; readonly descriptor: TailwindUtilityDescriptor }\n | { readonly status: 'unverified'; readonly reason: string };\n\ntype CssProperties = readonly string[] | ((value: string) => readonly string[] | undefined);\n\ninterface NamespaceRule {\n readonly namespace: string;\n readonly cssProperties: CssProperties;\n readonly negative?: boolean;\n readonly accepts: (value: string) => boolean;\n readonly acceptsNegative?: (value: string) => boolean;\n}\n\nconst exactTokenRegistry = Object.freeze([\n ['inline', ['display']],\n ['block', ['display']],\n ['inline-block', ['display']],\n ['flow-root', ['display']],\n ['flex', ['display']],\n ['inline-flex', ['display']],\n ['grid', ['display']],\n ['inline-grid', ['display']],\n ['contents', ['display']],\n ['table', ['display']],\n ['inline-table', ['display']],\n ['list-item', ['display']],\n ['hidden', ['display']],\n ['flex-row', ['flex-direction']],\n ['flex-row-reverse', ['flex-direction']],\n ['flex-col', ['flex-direction']],\n ['flex-col-reverse', ['flex-direction']],\n ['flex-wrap', ['flex-wrap']],\n ['flex-wrap-reverse', ['flex-wrap']],\n ['flex-nowrap', ['flex-wrap']],\n ['static', ['position']],\n ['fixed', ['position']],\n ['absolute', ['position']],\n ['relative', ['position']],\n ['sticky', ['position']],\n ['border', ['border-style', 'border-width']],\n ['shadow', ['--tw-shadow', 'box-shadow']],\n ['transition', ['transition-property', 'transition-timing-function', 'transition-duration']],\n ['visible', ['visibility']],\n ['invisible', ['visibility']],\n ['collapse', ['visibility']],\n [\n 'sr-only',\n ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space', 'border-width'],\n ],\n ['not-sr-only', ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space']],\n] as const);\n\nconst defaultColorNames = Object.freeze([\n 'inherit',\n 'current',\n 'transparent',\n 'black',\n 'white',\n 'red',\n 'orange',\n 'amber',\n 'yellow',\n 'lime',\n 'green',\n 'emerald',\n 'teal',\n 'cyan',\n 'sky',\n 'blue',\n 'indigo',\n 'violet',\n 'purple',\n 'fuchsia',\n 'pink',\n 'rose',\n 'slate',\n 'gray',\n 'zinc',\n 'neutral',\n 'stone',\n] as const);\nconst defaultColorShades = Object.freeze(['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950']);\nconst textSizes = Object.freeze([\n 'xs',\n 'sm',\n 'base',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n '7xl',\n '8xl',\n '9xl',\n]);\n\nfunction isNumber(value: string): boolean {\n return /^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/u.test(value);\n}\n\nfunction isInteger(value: string): boolean {\n return /^(?:0|[1-9]\\d*)$/u.test(value);\n}\n\nfunction isPercentage(value: string): boolean {\n if (!isNumber(value)) return false;\n const number = Number(value);\n return number >= 0 && number <= 100;\n}\n\nfunction hasValidArbitrarySyntax(value: string): boolean {\n return hasValidTailwindArbitrarySyntax(value);\n}\n\nfunction hasCompilerMeaningfulArbitraryValue(value: string): boolean {\n if (!hasValidArbitrarySyntax(value)) return false;\n\n const payload = value\n .slice(1, -1)\n .replace(/\\/\\*[\\s\\S]*?\\*\\//gu, '')\n .replace(/^[a-z][a-z-]*:/iu, '')\n .replace(/[\\s_()[\\]{}'\"`]/gu, '');\n return payload.length > 0;\n}\n\nfunction isCssVariableValue(value: string): boolean {\n return /^\\(--[A-Za-z_][A-Za-z0-9_-]*\\)$/u.test(value);\n}\n\nfunction isArbitraryOrVariable(value: string): boolean {\n return hasCompilerMeaningfulArbitraryValue(value) || isCssVariableValue(value);\n}\n\nfunction isFraction(value: string): boolean {\n const [numerator, denominator, remainder] = value.split('/');\n return remainder === undefined && isInteger(numerator ?? '') && /^[1-9]\\d*$/u.test(denominator ?? '');\n}\n\nfunction isSpacing(value: string): boolean {\n return isNumber(value) || value === 'px' || isArbitraryOrVariable(value);\n}\n\nfunction isMargin(value: string): boolean {\n return isSpacing(value) || value === 'auto';\n}\n\nfunction isFractionalSpacing(value: string): boolean {\n return isSpacing(value) || isFraction(value) || value === 'full';\n}\n\nfunction isInset(value: string): boolean {\n return isFractionalSpacing(value) || value === 'auto';\n}\n\nfunction isDimension(value: string): boolean {\n return (\n isFractionalSpacing(value) ||\n value === 'auto' ||\n ['screen', 'dvh', 'dvw', 'lvh', 'lvw', 'svh', 'svw', 'min', 'max', 'fit'].includes(value)\n );\n}\n\nfunction isWidth(value: string): boolean {\n return isDimension(value) || /^(?:3xs|2xs|xs|sm|md|lg|xl|[2-7]xl)$/u.test(value);\n}\n\nfunction isArbitraryColor(value: string): boolean {\n if (!hasCompilerMeaningfulArbitraryValue(value)) return false;\n const color = value.slice(1, -1);\n return /^(?:color:|#|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|light-dark|color-mix|var)\\()/u.test(color);\n}\n\nfunction isBackgroundImage(value: string): boolean {\n if (!hasCompilerMeaningfulArbitraryValue(value)) return false;\n const image = value.slice(1, -1);\n return /^(?:image:|url\\(|(?:linear|radial|conic)-gradient\\()/u.test(image);\n}\n\nfunction isColor(value: string): boolean {\n const [color, opacity, remainder] = value.split('/');\n if (remainder !== undefined) return false;\n\n const isDefault =\n ['inherit', 'current', 'transparent', 'black', 'white'].includes(color ?? '') ||\n (defaultColorNames.includes((color?.split('-')[0] ?? '') as (typeof defaultColorNames)[number]) &&\n defaultColorShades.includes((color?.split('-')[1] ?? '') as (typeof defaultColorShades)[number]) &&\n color?.split('-').length === 2);\n if (!isDefault && !isArbitraryColor(color ?? '') && !isCssVariableValue(color ?? '')) return false;\n return opacity === undefined || isPercentage(opacity) || isArbitraryOrVariable(opacity);\n}\n\nfunction isBackgroundColor(value: string): boolean {\n const [color] = value.split('/');\n if (isCssVariableValue(color ?? '')) return false;\n if (/^\\[var\\(/u.test(color ?? '')) return false;\n return isColor(value);\n}\n\nfunction textCssProperties(value: string): readonly string[] | undefined {\n const [size, lineHeight, remainder] = value.split('/');\n const hasVerifiedLineHeight =\n remainder === undefined && (lineHeight === undefined || isNumber(lineHeight) || isArbitraryOrVariable(lineHeight));\n if (textSizes.includes((size ?? '') as (typeof textSizes)[number])) {\n return hasVerifiedLineHeight ? ['font-size', 'line-height'] : undefined;\n }\n const arbitrarySize = size ?? '';\n const hasUnambiguousArbitrarySize =\n hasCompilerMeaningfulArbitraryValue(arbitrarySize) && isConservativelyAdmittedTextLength(arbitrarySize);\n if (hasUnambiguousArbitrarySize) {\n if (!hasVerifiedLineHeight) return undefined;\n return lineHeight === undefined ? ['font-size'] : ['font-size', 'line-height'];\n }\n if (hasCompilerMeaningfulArbitraryValue(value) && /^\\[color:[\\s\\S]+\\]$/u.test(value)) return ['color'];\n if (isColor(value)) return ['color'];\n return undefined;\n}\n\nfunction acceptsText(value: string): boolean {\n return textCssProperties(value) !== undefined;\n}\n\nfunction borderCssProperties(value: string): readonly string[] | undefined {\n if (isInteger(value) || (hasCompilerMeaningfulArbitraryValue(value) && isConservativelyAdmittedBorderWidth(value))) {\n return ['border-style', 'border-width'];\n }\n if (oneOf(['solid', 'dashed', 'dotted', 'double', 'hidden', 'none'])(value)) {\n return ['--tw-border-style', 'border-style'];\n }\n if (isColor(value) || isCssVariableValue(value) || /^\\[(?:color:|var\\()/u.test(value)) {\n return ['border-color'];\n }\n return undefined;\n}\n\nfunction transitionCssProperties(value: string): readonly string[] {\n return value === 'none'\n ? ['transition-property']\n : ['transition-property', 'transition-timing-function', 'transition-duration'];\n}\n\nfunction scaleCssProperties(value: string): readonly string[] | undefined {\n if (isInteger(value)) return ['--tw-scale-x', '--tw-scale-y', '--tw-scale-z', 'scale'];\n return isArbitraryOrVariable(value) ? ['scale'] : undefined;\n}\n\nfunction oneOf(values: readonly string[]): (value: string) => boolean {\n return value => values.includes(value);\n}\n\nconst namespaceRegistry: readonly NamespaceRule[] = Object.freeze([\n {\n namespace: 'items',\n cssProperties: ['align-items'],\n accepts: oneOf(['start', 'end', 'center', 'baseline', 'stretch']),\n },\n { namespace: 'gap', cssProperties: ['gap'], accepts: value => isNumber(value) || isArbitraryOrVariable(value) },\n {\n namespace: 'gap-x',\n cssProperties: ['column-gap'],\n accepts: value => isNumber(value) || isArbitraryOrVariable(value),\n },\n { namespace: 'gap-y', cssProperties: ['row-gap'], accepts: value => isNumber(value) || isArbitraryOrVariable(value) },\n { namespace: 'm', cssProperties: ['margin'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mx', cssProperties: ['margin-inline'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'my', cssProperties: ['margin-block'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mt', cssProperties: ['margin-top'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mr', cssProperties: ['margin-right'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mb', cssProperties: ['margin-bottom'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'ml', cssProperties: ['margin-left'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n {\n namespace: 'ms',\n cssProperties: ['margin-inline-start'],\n negative: true,\n accepts: isMargin,\n acceptsNegative: isSpacing,\n },\n {\n namespace: 'me',\n cssProperties: ['margin-inline-end'],\n negative: true,\n accepts: isMargin,\n acceptsNegative: isSpacing,\n },\n {\n namespace: 'p',\n cssProperties: ['padding'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'px',\n cssProperties: ['padding-inline'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'py',\n cssProperties: ['padding-block'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pt',\n cssProperties: ['padding-top'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pr',\n cssProperties: ['padding-right'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pb',\n cssProperties: ['padding-bottom'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pl',\n cssProperties: ['padding-left'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'ps',\n cssProperties: ['padding-inline-start'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pe',\n cssProperties: ['padding-inline-end'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n { namespace: 'w', cssProperties: ['width'], accepts: isWidth },\n { namespace: 'h', cssProperties: ['height'], accepts: isDimension },\n { namespace: 'min-w', cssProperties: ['min-width'], accepts: isWidth },\n { namespace: 'min-h', cssProperties: ['min-height'], accepts: isDimension },\n { namespace: 'max-w', cssProperties: ['max-width'], accepts: value => value !== 'auto' && isWidth(value) },\n { namespace: 'max-h', cssProperties: ['max-height'], accepts: value => value !== 'auto' && isDimension(value) },\n { namespace: 'text', cssProperties: textCssProperties, accepts: acceptsText },\n { namespace: 'bg', cssProperties: ['background-color'], accepts: isBackgroundColor },\n { namespace: 'bg', cssProperties: ['background-image'], accepts: isBackgroundImage },\n {\n namespace: 'border',\n cssProperties: borderCssProperties,\n accepts: value => borderCssProperties(value) !== undefined,\n },\n {\n namespace: 'rounded',\n cssProperties: ['border-radius'],\n accepts: value =>\n oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', 'full'])(value) || isArbitraryOrVariable(value),\n },\n {\n namespace: 'shadow',\n cssProperties: ['--tw-shadow', 'box-shadow'],\n accepts: value => oneOf(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', 'none'])(value) || isCssVariableValue(value),\n },\n {\n namespace: 'opacity',\n cssProperties: ['opacity'],\n accepts: value => isPercentage(value) || isArbitraryOrVariable(value),\n },\n {\n namespace: 'overflow',\n cssProperties: ['overflow'],\n accepts: oneOf(['auto', 'hidden', 'clip', 'visible', 'scroll']),\n },\n {\n namespace: 'inset',\n cssProperties: ['inset'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'inset-x',\n cssProperties: ['inset-inline'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'inset-y',\n cssProperties: ['inset-block'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n { namespace: 'top', cssProperties: ['top'], negative: true, accepts: isInset, acceptsNegative: isFractionalSpacing },\n {\n namespace: 'right',\n cssProperties: ['right'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'bottom',\n cssProperties: ['bottom'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'left',\n cssProperties: ['left'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'rotate',\n cssProperties: ['rotate'],\n negative: true,\n accepts: value => isInteger(value) || isArbitraryOrVariable(value),\n },\n {\n namespace: 'scale',\n cssProperties: scaleCssProperties,\n accepts: value => scaleCssProperties(value) !== undefined,\n },\n {\n namespace: 'translate',\n cssProperties: ['--tw-translate-x', '--tw-translate-y', 'translate'],\n negative: true,\n accepts: isFractionalSpacing,\n },\n {\n namespace: 'transition',\n cssProperties: transitionCssProperties,\n accepts: oneOf(['all', 'colors', 'opacity', 'shadow', 'transform', 'none']),\n },\n {\n namespace: 'grid-cols',\n cssProperties: ['grid-template-columns'],\n accepts: value => /^[1-9]\\d*$/u.test(value) || oneOf(['none', 'subgrid'])(value) || isArbitraryOrVariable(value),\n },\n { namespace: 'table', cssProperties: ['table-layout'], accepts: oneOf(['auto', 'fixed']) },\n {\n namespace: 'list',\n cssProperties: value => [['disc', 'decimal', 'none'].includes(value) ? 'list-style-type' : 'list-style-position'],\n accepts: oneOf(['disc', 'decimal', 'none', 'inside', 'outside']),\n },\n {\n namespace: 'object',\n cssProperties: value => [\n ['contain', 'cover', 'fill', 'none', 'scale-down'].includes(value) ? 'object-fit' : 'object-position',\n ],\n accepts: oneOf([\n 'contain',\n 'cover',\n 'fill',\n 'none',\n 'scale-down',\n 'bottom',\n 'center',\n 'left',\n 'left-bottom',\n 'left-top',\n 'right',\n 'right-bottom',\n 'right-top',\n 'top',\n ]),\n },\n {\n namespace: 'cursor',\n cssProperties: ['cursor'],\n accepts: oneOf([\n 'auto',\n 'default',\n 'pointer',\n 'wait',\n 'text',\n 'move',\n 'help',\n 'not-allowed',\n 'none',\n 'context-menu',\n 'progress',\n 'cell',\n 'crosshair',\n 'vertical-text',\n 'alias',\n 'copy',\n 'no-drop',\n 'grab',\n 'grabbing',\n 'all-scroll',\n 'col-resize',\n 'row-resize',\n 'n-resize',\n 'e-resize',\n 's-resize',\n 'w-resize',\n 'ne-resize',\n 'nw-resize',\n 'se-resize',\n 'sw-resize',\n 'ew-resize',\n 'ns-resize',\n 'nesw-resize',\n 'nwse-resize',\n 'zoom-in',\n 'zoom-out',\n ]),\n },\n { namespace: 'pointer-events', cssProperties: ['pointer-events'], accepts: oneOf(['auto', 'none']) },\n]);\n\nconst exactVariantRegistry = Object.freeze([\n 'hover',\n 'focus',\n 'focus-within',\n 'focus-visible',\n 'active',\n 'visited',\n 'target',\n 'first',\n 'last',\n 'only',\n 'odd',\n 'even',\n 'disabled',\n 'enabled',\n 'checked',\n 'indeterminate',\n 'required',\n 'valid',\n 'invalid',\n 'dark',\n 'motion-safe',\n 'motion-reduce',\n 'contrast-more',\n 'contrast-less',\n 'portrait',\n 'landscape',\n 'print',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n] as const);\n\nfunction variantIsVerified(variant: string): boolean {\n return exactVariantRegistry.includes(variant as (typeof exactVariantRegistry)[number]);\n}\n\nfunction parseArbitraryProperty(utility: string): string | undefined {\n if (!hasValidArbitrarySyntax(utility)) return undefined;\n const inner = utility.slice(1, -1);\n const separator = inner.indexOf(':');\n if (separator <= 0) return undefined;\n\n const property = inner.slice(0, separator);\n const value = inner.slice(separator + 1);\n if (!/^(?:--[A-Za-z_][A-Za-z0-9_-]*|[A-Za-z][A-Za-z0-9-]*)$/u.test(property)) return undefined;\n if (value.trim().length === 0) return undefined;\n return property;\n}\n\nfunction registryCssProperties(utility: string): readonly string[] | undefined {\n const exact = exactTokenRegistry.find(([token]) => token === utility);\n if (exact !== undefined) return exact[1];\n\n const negative = utility.startsWith('-');\n const value = negative ? utility.slice(1) : utility;\n for (const rule of namespaceRegistry) {\n const separator = `${rule.namespace}-`;\n if (!value.startsWith(separator)) continue;\n const suffix = value.slice(separator.length);\n if (suffix.length === 0) continue;\n if (negative) {\n if (rule.negative !== true || !(rule.acceptsNegative ?? rule.accepts)(suffix)) continue;\n } else if (!rule.accepts(suffix)) continue;\n return typeof rule.cssProperties === 'function' ? rule.cssProperties(suffix) : rule.cssProperties;\n }\n\n return undefined;\n}\n\nexport class TailwindCandidateClassifier {\n classify(token: string): TailwindCandidateClassification {\n if (!isByteExactHtmlClassToken(token)) {\n return {\n status: 'unverified',\n reason: 'The decoded candidate cannot be emitted as the same raw HTML source token.',\n };\n }\n\n if (token.includes('\\\\')) {\n return { status: 'unverified', reason: 'Source escapes make the Tailwind candidate ambiguous.' };\n }\n\n const descriptor = describeTailwindUtility(token);\n if (descriptor === undefined) {\n return { status: 'unverified', reason: 'The Tailwind candidate has malformed variant or bracket structure.' };\n }\n if (descriptor.hasGeneratedMediaVariant) {\n return {\n status: 'unverified',\n reason: 'Generated exact-media variants cannot be supplied as source candidates.',\n };\n }\n if (!descriptor.variants.every(variantIsVerified)) {\n return {\n status: 'unverified',\n reason: 'The Tailwind candidate contains an unverified or target-changing variant.',\n };\n }\n\n const arbitraryProperty = parseArbitraryProperty(descriptor.utility);\n const cssProperties =\n arbitraryProperty === undefined ? registryCssProperties(descriptor.utility) : [arbitraryProperty];\n if (cssProperties === undefined || cssProperties.length === 0) {\n return { status: 'unverified', reason: 'The utility is not in the compiler-proven built-in registry.' };\n }\n\n return { status: 'verified', descriptor: { ...descriptor, cssProperties } };\n }\n}\n","import { TailwindArbitraryPropertyEncoder } from '../adapter/tailwind/extended/tailwind-arbitrary-property.encoder';\nimport { TailwindCandidateClassifier } from '../adapter/tailwind/extended/tailwind-candidate-classifier';\nimport { describeTailwindDisplay } from '../adapter/tailwind/tailwind-class-conflict';\nimport { analyzeTailwindArbitrarySyntax } from '../adapter/tailwind/tailwind-arbitrary-syntax';\nimport type {\n SourceClassTokenClassification,\n SourcePropertyEvidence,\n SourceStyleDeclaration,\n SourceStyleDeclarationClassification,\n} from '../semantic/source-property-evidence';\n\nexport class TailwindSourcePropertyEvidence implements SourcePropertyEvidence {\n private readonly classifier = new TailwindCandidateClassifier();\n private readonly styleEncoder = new TailwindArbitraryPropertyEncoder();\n\n classifyClassToken(token: string): SourceClassTokenClassification {\n const classification = this.classifier.classify(token);\n if (classification.status === 'unverified') return classification;\n const display = describeTailwindDisplay(token);\n return {\n status: 'verified',\n evidence: {\n source: token,\n properties: classification.descriptor.cssProperties,\n important: classification.descriptor.important,\n activation: classification.descriptor.activation,\n ...(display === undefined ? {} : { display: display.utility }),\n },\n };\n }\n\n classifyStyleDeclaration(declaration: SourceStyleDeclaration): SourceStyleDeclarationClassification {\n try {\n const candidate = this.styleEncoder.encode(declaration);\n const arbitrary = analyzeTailwindArbitrarySyntax(candidate);\n return arbitrary === undefined || arbitrary.important\n ? { status: 'unverified', priorityText: arbitrary?.important === true }\n : { status: 'verified' };\n } catch {\n let priorityText = false;\n try {\n priorityText = analyzeTailwindArbitrarySyntax(this.styleEncoder.encode(declaration))?.important === true;\n } catch {\n // The source declaration is not encodable by this target.\n }\n return { status: 'unverified', priorityText };\n }\n }\n}\n","import type { SemanticResult } from './flex-semantic.model';\n\nexport type FlexSelfAlignment = 'auto' | 'start' | 'end' | 'center' | 'baseline' | 'stretch';\n\nexport interface FlexAlignSemantics {\n readonly alignment: FlexSelfAlignment;\n}\n\nconst alignments = new Set<FlexSelfAlignment>(['auto', 'start', 'end', 'center', 'baseline', 'stretch']);\n\nexport function planFlexAlignSemantics(value: string): SemanticResult<FlexAlignSemantics> {\n const alignment = (value.trim() || 'stretch') as FlexSelfAlignment;\n return alignments.has(alignment)\n ? { status: 'planned', value: { alignment } }\n : { status: 'invalid', code: 'invalid-value' };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport {\n planFlexAlignSemantics,\n type FlexAlignSemantics,\n type FlexSelfAlignment,\n} from '../../../flex/flex-align.semantic';\n\nconst selfAlignment: Readonly<Record<FlexSelfAlignment, string>> = {\n auto: 'self-auto',\n start: 'self-start',\n end: 'self-end',\n center: 'self-center',\n baseline: 'self-baseline',\n stretch: 'self-stretch',\n};\n\nexport function renderFlexAlign(value: FlexAlignSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: [selfAlignment[value.alignment]] };\n}\n\nexport function planFlexAlign(value: string): TailwindStrategyResult {\n const planned = planFlexAlignSemantics(value);\n return planned.status === 'planned' ? renderFlexAlign(planned.value) : planned;\n}\n","import type { SemanticResult } from './flex-semantic.model';\n\nexport interface FlexFillSemantics {\n readonly margin: '0';\n readonly width: '100%';\n readonly height: '100%';\n readonly minWidth: '100%';\n readonly minHeight: '100%';\n}\n\nconst fill: FlexFillSemantics = {\n margin: '0',\n width: '100%',\n height: '100%',\n minWidth: '100%',\n minHeight: '100%',\n};\n\nexport function planFlexFillSemantics(): SemanticResult<FlexFillSemantics> {\n return { status: 'planned', value: fill };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexFillSemantics, type FlexFillSemantics } from '../../../flex/flex-fill.semantic';\n\nexport function renderFlexFill(_value: FlexFillSemantics): TailwindStrategyResult {\n return {\n status: 'converted',\n classNames: ['m-0', 'w-full', 'h-full', 'min-w-full', 'min-h-full'],\n };\n}\n\nexport function planFlexFill(): TailwindStrategyResult {\n const planned = planFlexFillSemantics();\n return planned.status === 'planned' ? renderFlexFill(planned.value) : planned;\n}\n","export type ParsedValue<T> = { readonly ok: true; readonly value: T } | { readonly ok: false };\n\nexport type CssLength = string & { readonly __cssLength: unique symbol };\n\nexport interface CssLengthOptions {\n readonly fallbackUnit: 'px' | '%';\n}\n\nconst NUMBER = String.raw`-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)`;\nconst LENGTH = new RegExp(`^${NUMBER}(?:%|px|r?em|v(?:w|h|min|max)|ch|ex|cm|mm|in|pt|pc)$`);\nconst UNITLESS = new RegExp(`^${NUMBER}$`);\nconst CSS_FUNCTION = /^(?:calc|clamp|min|max|var)\\([a-zA-Z0-9_%+*/.,()\\-\\s]+\\)$/;\n\nexport function parseCssLength(source: string, options: CssLengthOptions): ParsedValue<CssLength> {\n const value = source.trim();\n if (UNITLESS.test(value)) {\n return { ok: true, value: `${value}${options.fallbackUnit}` as CssLength };\n }\n if (LENGTH.test(value) || CSS_FUNCTION.test(value)) {\n return { ok: true, value: value as CssLength };\n }\n return { ok: false };\n}\n","import type { ParsedValue } from './css-length';\n\nexport type LayoutDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';\nexport type LayoutWrap = 'nowrap' | 'wrap' | 'wrap-reverse';\n\nexport interface LayoutSemantics {\n readonly direction: LayoutDirection;\n readonly wrap: LayoutWrap;\n readonly explicitWrap: boolean;\n readonly display: 'flex' | 'inline-flex';\n readonly boxSizing: 'border-box';\n}\n\nconst directions = new Set<LayoutDirection>(['row', 'row-reverse', 'column', 'column-reverse']);\nconst wraps = new Set<LayoutWrap>(['nowrap', 'wrap', 'wrap-reverse']);\n\nexport function parseLayout(value: string): ParsedValue<LayoutSemantics> {\n const tokens = value.split(/\\s+/).filter(Boolean);\n const direction = (tokens.shift() ?? 'row') as LayoutDirection;\n if (!directions.has(direction)) return { ok: false };\n\n const wrapTokens = tokens.filter(token => wraps.has(token as LayoutWrap));\n if (wrapTokens.length > 1) return { ok: false };\n\n let wrap: LayoutWrap = 'nowrap';\n let display: LayoutSemantics['display'] = 'flex';\n for (const token of tokens) {\n if (wraps.has(token as LayoutWrap)) {\n wrap = token as LayoutWrap;\n } else if (token === 'inline' && display === 'flex') {\n display = 'inline-flex';\n } else {\n return { ok: false };\n }\n }\n\n return {\n ok: true,\n value: { direction, wrap, explicitWrap: wrapTokens.length === 1, display, boxSizing: 'border-box' },\n };\n}\n","import { parseCssLength, type CssLength } from './css-length';\nimport type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout, type LayoutSemantics } from './layout.semantic';\n\nexport interface FlexItemInput {\n readonly basis: string;\n readonly grow?: string;\n readonly shrink?: string;\n readonly layout?: string;\n}\n\nexport type FlexBasisSemantics =\n | { readonly kind: 'keyword'; readonly value: 'auto' }\n | { readonly kind: 'literal' | 'computed'; readonly value: CssLength };\n\nexport interface FlexItemSemantics {\n readonly grow: string;\n readonly shrink: string;\n readonly basis: FlexBasisSemantics;\n readonly axis: 'width' | 'height';\n readonly min?: CssLength;\n readonly max?: CssLength;\n readonly boxSizing: 'border-box';\n}\n\nconst FACTOR = /^\\d+(?:\\.\\d+)?$/;\nconst unconstrainedBases = new Set(['0%', '0px', '0.000000001px', 'auto']);\n\nfunction sizingAxis(layout: LayoutSemantics): FlexItemSemantics['axis'] {\n return layout.direction.startsWith('column') ? 'height' : 'width';\n}\n\nexport function planFlexItemSemantics(input: FlexItemInput): SemanticResult<FlexItemSemantics> {\n if (input.layout === undefined) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'Flex sizing depends on a dynamic parent direction or wrapping mode.',\n suggestion: 'Make the parent layout static or migrate this flex item manually.',\n };\n }\n\n const layout = parseLayout(input.layout);\n if (!layout.ok) return { status: 'invalid', code: 'invalid-value' };\n\n let grow = input.grow?.trim() || '1';\n let shrink = input.shrink?.trim() || '1';\n let basis = input.basis.trim();\n const shorthand = basis.startsWith('calc(') ? undefined : basis.match(/^(\\S+)\\s+(\\S+)\\s+(.+)$/);\n if (shorthand) {\n grow = shorthand[1] ?? grow;\n shrink = shorthand[2] ?? shrink;\n basis = shorthand[3] ?? basis;\n } else if (basis.split(/\\s+/).length > 1 && !basis.startsWith('calc(')) {\n return { status: 'invalid', code: 'invalid-value' };\n }\n if (!FACTOR.test(grow) || !FACTOR.test(shrink)) return { status: 'invalid', code: 'invalid-value' };\n\n const axis = sizingAxis(layout.value);\n let isValue = false;\n let usingCalc = false;\n\n if (!basis) {\n basis = axis === 'width' ? '0%' : '0.000000001px';\n } else if (basis === 'initial' || basis === 'nogrow') {\n grow = '0';\n basis = 'auto';\n } else if (basis === 'grow') {\n basis = '100%';\n } else if (basis === 'noshrink') {\n shrink = '0';\n basis = 'auto';\n } else if (basis === 'none') {\n grow = '0';\n shrink = '0';\n basis = 'auto';\n } else if (basis !== 'auto') {\n const parsed = parseCssLength(basis, { fallbackUnit: '%' });\n if (!parsed.ok) return { status: 'invalid', code: 'invalid-value' };\n basis = parsed.value;\n usingCalc = basis.startsWith('calc(');\n isValue = usingCalc || !basis.endsWith('%');\n if (basis === '0px') basis = '0%';\n }\n\n const fixed = grow === '0' && shrink === '0';\n const constrainedBasis = basis as CssLength;\n const min = !unconstrainedBases.has(basis) && (fixed || (isValue && grow !== '0')) ? constrainedBasis : undefined;\n const max =\n !unconstrainedBases.has(basis) && (fixed || (!usingCalc && shrink !== '0')) ? constrainedBasis : undefined;\n const effectiveBasis =\n min || max ? (layout.value.wrap === 'wrap' ? (max ?? min ?? basis) : isValue ? basis : '100%') : basis;\n const semanticBasis: FlexBasisSemantics =\n effectiveBasis === 'auto'\n ? { kind: 'keyword', value: effectiveBasis }\n : { kind: effectiveBasis.startsWith('calc(') ? 'computed' : 'literal', value: effectiveBasis as CssLength };\n\n return {\n status: 'planned',\n value: { grow, shrink, basis: semanticBasis, axis, min, max, boxSizing: 'border-box' },\n };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexItemSemantics, type FlexItemInput, type FlexItemSemantics } from '../../../flex/flex-item.semantic';\n\nconst property = (name: string, value: string) => `[${name}:${value.replaceAll(/\\s+/g, '_')}]`;\n\nexport function renderFlexItem(value: FlexItemSemantics): readonly string[] {\n const flexClasses =\n value.basis.kind === 'computed'\n ? [\n property('flex-grow', value.grow),\n property('flex-shrink', value.shrink),\n property('flex-basis', value.basis.value),\n ]\n : [property('flex', `${value.grow} ${value.shrink} ${value.basis.value}`)];\n return [\n ...flexClasses,\n ...(value.min ? [property(`min-${value.axis}`, value.min)] : []),\n ...(value.max ? [property(`max-${value.axis}`, value.max)] : []),\n { 'border-box': 'box-border' }[value.boxSizing],\n ];\n}\n\nexport function planFlexItem(input: FlexItemInput): TailwindStrategyResult {\n const planned = planFlexItemSemantics(input);\n return planned.status === 'planned' ? { status: 'converted', classNames: renderFlexItem(planned.value) } : planned;\n}\n","import { parseCssLength, type CssLength } from './css-length';\nimport type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout } from './layout.semantic';\n\nexport interface FlexOffsetSemantics {\n readonly axis: 'inline-start' | 'block-start';\n readonly length: CssLength;\n}\n\nexport function planFlexOffsetSemantics(\n value: string,\n layoutValue: string | undefined,\n): SemanticResult<FlexOffsetSemantics> {\n const offset = parseCssLength(value.trim() || '0', { fallbackUnit: '%' });\n if (!offset.ok) return { status: 'invalid', code: 'invalid-value' };\n if (layoutValue === undefined) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'The offset margin axis depends on a dynamic parent layout.',\n suggestion: 'Make the parent layout static or migrate the offset manually.',\n };\n }\n\n const layout = parseLayout(layoutValue);\n if (!layout.ok) return { status: 'invalid', code: 'invalid-value' };\n return {\n status: 'planned',\n value: { axis: layout.value.direction.startsWith('column') ? 'block-start' : 'inline-start', length: offset.value },\n };\n}\n","export function arbitraryValue(value: string): string {\n return `[${value.replaceAll(/\\s+/g, '_')}]`;\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexOffsetSemantics, type FlexOffsetSemantics } from '../../../flex/flex-offset.semantic';\nimport { arbitraryValue } from '../tailwind-value.parser';\n\nconst marginPrefix: Readonly<Record<FlexOffsetSemantics['axis'], string>> = {\n 'inline-start': 'ms',\n 'block-start': 'mt',\n};\n\nexport function renderFlexOffset(value: FlexOffsetSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: [`${marginPrefix[value.axis]}-${arbitraryValue(value.length)}`] };\n}\n\nexport function planFlexOffset(value: string, layoutValue: string | undefined): TailwindStrategyResult {\n const planned = planFlexOffsetSemantics(value, layoutValue);\n return planned.status === 'planned' ? renderFlexOffset(planned.value) : planned;\n}\n","import type { SemanticResult } from './flex-semantic.model';\n\nexport interface FlexOrderSemantics {\n readonly order: number | undefined;\n}\n\nexport function planFlexOrderSemantics(value: string): SemanticResult<FlexOrderSemantics> {\n const order = Number.parseInt(value.trim(), 10) || undefined;\n return { status: 'planned', value: { order } };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexOrderSemantics, type FlexOrderSemantics } from '../../../flex/flex-order.semantic';\n\nexport function renderFlexOrder(value: FlexOrderSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: value.order === undefined ? [] : [`[order:${value.order}]`] };\n}\n\nexport function planFlexOrder(value: string): TailwindStrategyResult {\n const planned = planFlexOrderSemantics(value);\n return planned.status === 'planned' ? renderFlexOrder(planned.value) : planned;\n}\n","import type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout, type LayoutSemantics } from './layout.semantic';\n\nexport type LayoutMainAlignment = 'start' | 'center' | 'end' | 'space-around' | 'space-between' | 'space-evenly';\nexport type LayoutItemsAlignment = 'start' | 'center' | 'end' | 'baseline' | 'stretch';\nexport type LayoutContentAlignment = 'start' | 'center' | 'end' | 'stretch' | 'space-around' | 'space-between';\n\nexport interface LayoutAlignmentSemantics {\n readonly main: LayoutMainAlignment;\n readonly items: LayoutItemsAlignment;\n readonly content: LayoutContentAlignment;\n readonly stretchMaximum?: 'width' | 'height';\n readonly layout: LayoutSemantics;\n}\n\nconst mainAxis: Readonly<Record<string, LayoutMainAlignment>> = {\n start: 'start',\n 'flex-start': 'start',\n center: 'center',\n end: 'end',\n 'flex-end': 'end',\n 'space-around': 'space-around',\n 'space-between': 'space-between',\n 'space-evenly': 'space-evenly',\n};\n\nconst crossAxis: Readonly<Record<string, readonly [LayoutItemsAlignment, LayoutContentAlignment]>> = {\n start: ['start', 'start'],\n 'flex-start': ['start', 'start'],\n center: ['center', 'center'],\n end: ['end', 'end'],\n 'flex-end': ['end', 'end'],\n 'space-between': ['stretch', 'space-between'],\n 'space-around': ['stretch', 'space-around'],\n baseline: ['baseline', 'stretch'],\n stretch: ['stretch', 'stretch'],\n};\n\nexport function planLayoutAlignment(value: string, layoutValue: string): SemanticResult<LayoutAlignmentSemantics> {\n const values = value.split(/\\s+/).filter(Boolean);\n if (values.length > 2) return { status: 'invalid', code: 'invalid-value' };\n\n const main = mainAxis[values[0] ?? 'start'];\n const crossKey = values[1] ?? 'stretch';\n const cross = crossAxis[crossKey];\n const layout = parseLayout(layoutValue);\n if (!main || !cross || !layout.ok) return { status: 'invalid', code: 'invalid-value' };\n\n const stretchMaximum =\n crossKey === 'stretch'\n ? layout.value.direction === 'row' || layout.value.direction === 'row-reverse'\n ? 'height'\n : 'width'\n : undefined;\n\n return {\n status: 'planned',\n value: { main, items: cross[0], content: cross[1], stretchMaximum, layout: layout.value },\n };\n}\n","import { parseLayout, type LayoutSemantics } from '../../../flex/layout.semantic';\nimport type { ParsedValue } from '../../../flex/css-length';\n\nexport interface TailwindClassPlan {\n readonly classNames: readonly string[];\n}\n\nexport function renderLayout(layout: LayoutSemantics): readonly string[] {\n const display = { flex: 'flex', 'inline-flex': 'inline-flex' }[layout.display];\n const direction = {\n row: 'flex-row',\n 'row-reverse': 'flex-row-reverse',\n column: 'flex-col',\n 'column-reverse': 'flex-col-reverse',\n }[layout.direction];\n const wrap = layout.explicitWrap ? [`flex-${layout.wrap}`] : [];\n const boxSizing = { 'border-box': 'box-border' }[layout.boxSizing];\n return [display, direction, ...wrap, boxSizing];\n}\n\nexport function planLayout(value: string): ParsedValue<TailwindClassPlan> {\n const parsed = parseLayout(value);\n return parsed.ok ? { ok: true, value: { classNames: renderLayout(parsed.value) } } : parsed;\n}\n","import type { ParsedValue } from '../../../flex/css-length';\nimport {\n planLayoutAlignment,\n type LayoutAlignmentSemantics,\n type LayoutContentAlignment,\n type LayoutItemsAlignment,\n type LayoutMainAlignment,\n} from '../../../flex/layout-align.semantic';\nimport { renderLayout, type TailwindClassPlan } from './layout.strategy';\n\nconst mainAxis: Readonly<Record<LayoutMainAlignment, string>> = {\n start: 'start',\n center: 'center',\n end: 'end',\n 'space-around': 'around',\n 'space-between': 'between',\n 'space-evenly': 'evenly',\n};\n\nconst itemsAxis: Readonly<Record<LayoutItemsAlignment, string>> = {\n start: 'start',\n center: 'center',\n end: 'end',\n baseline: 'baseline',\n stretch: 'stretch',\n};\n\nconst contentAxis: Readonly<Record<LayoutContentAlignment, string>> = {\n start: 'start',\n center: 'center',\n end: 'end',\n stretch: 'stretch',\n 'space-around': 'around',\n 'space-between': 'between',\n};\n\nexport function renderLayoutAlignment(alignment: LayoutAlignmentSemantics): TailwindClassPlan {\n const sizing =\n alignment.stretchMaximum === 'height' ? ['max-h-full'] : alignment.stretchMaximum === 'width' ? ['max-w-full'] : [];\n return {\n classNames: [\n `justify-${mainAxis[alignment.main]}`,\n `items-${itemsAxis[alignment.items]}`,\n `content-${contentAxis[alignment.content]}`,\n ...renderLayout(alignment.layout),\n ...sizing,\n ],\n };\n}\n\nexport function planLayoutAlign(value: string, layoutValue: string): ParsedValue<TailwindClassPlan> {\n const planned = planLayoutAlignment(value, layoutValue);\n return planned.status === 'planned' ? { ok: true, value: renderLayoutAlignment(planned.value) } : { ok: false };\n}\n","import { parseCssLength, type CssLength } from './css-length';\nimport type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout } from './layout.semantic';\n\nexport interface LayoutGapSemantics {\n readonly length: CssLength;\n}\n\nexport function planLayoutGapSemantics(\n value: string,\n layoutValue: string | undefined,\n): SemanticResult<LayoutGapSemantics> {\n const normalized = value.trim();\n if (!normalized) return { status: 'invalid', code: 'invalid-value' };\n\n if (normalized.endsWith(' grid')) {\n return {\n status: 'review',\n code: 'semantic-unsupported',\n reason: 'The Flex-Layout grid gap mode changes child padding and compensating host margins.',\n suggestion: 'Replace the grid gap manually after reviewing the child padding behavior.',\n };\n }\n\n const length = parseCssLength(normalized, { fallbackUnit: 'px' });\n if (!length.ok) return { status: 'invalid', code: 'invalid-value' };\n if (length.value.startsWith('-')) {\n return {\n status: 'review',\n code: 'semantic-unsupported',\n reason: 'Flex-Layout accepts a negative margin gap, but CSS gap does not accept negative values.',\n suggestion: 'Preserve the margin-based spacing or migrate the child margins manually.',\n };\n }\n if (length.value.includes('(')) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'The computed gap may resolve to a negative value that CSS gap cannot represent.',\n suggestion: 'Prove the value is nonnegative or migrate the margin-based spacing manually.',\n };\n }\n if (layoutValue === undefined) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'The active flex direction and wrapping behavior depend on a dynamic layout.',\n suggestion: 'Make the layout static or migrate the gap and responsive layout together.',\n };\n }\n\n const layout = parseLayout(layoutValue);\n if (!layout.ok) return { status: 'invalid', code: 'invalid-value' };\n if (layout.value.wrap !== 'nowrap') {\n return {\n status: 'review',\n code: 'semantic-unsupported',\n reason: 'Flex-Layout margins and CSS gap differ when flex items wrap across lines.',\n suggestion: 'Verify the wrapped layout and migrate its spacing manually.',\n };\n }\n\n return { status: 'planned', value: { length: length.value } };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planLayoutGapSemantics, type LayoutGapSemantics } from '../../../flex/layout-gap.semantic';\nimport { arbitraryValue } from '../tailwind-value.parser';\n\nexport function renderLayoutGap(gap: LayoutGapSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: [`gap-${arbitraryValue(gap.length)}`] };\n}\n\nexport function planLayoutGap(value: string, layoutValue: string | undefined): TailwindStrategyResult {\n const planned = planLayoutGapSemantics(value, layoutValue);\n return planned.status === 'planned' ? renderLayoutGap(planned.value) : planned;\n}\n","import type { BreakpointDefinition, MediaClause, MediaDefinition } from '../../breakpoint/breakpoint-catalog';\nimport { describeTailwindUtility } from './tailwind-class-conflict';\n\nexport class ResponsiveVariantEmitter {\n emit(definition: BreakpointDefinition, utility: string): readonly string[] {\n const descriptor = describeTailwindUtility(utility);\n if (descriptor === undefined) {\n throw new Error('Cannot decorate a malformed Tailwind utility');\n }\n if (descriptor.variants.length > 0) {\n throw new Error('Cannot decorate an already-variant utility');\n }\n\n return definition.media.clauses.map(clause => `[${this.mediaQuery(definition.media, clause)}]:${utility}`);\n }\n\n emitCandidate(definition: BreakpointDefinition, candidate: string): readonly string[] {\n const descriptor = describeTailwindUtility(candidate);\n if (descriptor === undefined) {\n throw new Error('Cannot decorate a malformed Tailwind candidate');\n }\n if (descriptor.hasGeneratedMediaVariant) {\n throw new Error('Cannot decorate a candidate containing a generated media variant');\n }\n\n return definition.media.clauses.map(clause => `[${this.mediaQuery(definition.media, clause)}]:${candidate}`);\n }\n\n private mediaQuery(media: MediaDefinition, clause: MediaClause): string {\n if (media.type === 'print') return '@media_print';\n\n const conditions = [\n clause.orientation === undefined ? undefined : `(orientation:_${clause.orientation})`,\n clause.min === undefined ? undefined : `(min-width:_${clause.min}px)`,\n clause.max === undefined ? undefined : `(max-width:_${clause.max}px)`,\n ].filter((condition): condition is string => condition !== undefined);\n\n const medium = clause.orientation === undefined ? 'screen_and_' : '';\n return `@media_${medium}${conditions.join('_and_')}`;\n }\n}\n","import { ResponsiveVariantEmitter } from '../responsive-variant.emitter';\nimport { describeTailwindUtility } from '../tailwind-class-conflict';\nimport type { ExtendedResponsiveState, ResponsiveClassValue } from '../../../semantic/extended/responsive-class.model';\nimport type { ResponsiveStyleValue } from '../../../semantic/extended/responsive-style.model';\nimport { TailwindArbitraryPropertyEncoder } from './tailwind-arbitrary-property.encoder';\nimport { TailwindCandidateClassifier } from './tailwind-candidate-classifier';\n\nexport class ExtendedResponsiveEmitter {\n constructor(\n private readonly responsiveEmitter = new ResponsiveVariantEmitter(),\n private readonly styleEncoder = new TailwindArbitraryPropertyEncoder(),\n private readonly classifier = new TailwindCandidateClassifier(),\n ) {}\n\n emitClass(state: ExtendedResponsiveState<ResponsiveClassValue>): readonly string[] {\n const emitted: string[] = [];\n const seen = new Set<string>();\n\n for (const token of state.value.tokens) {\n if (seen.has(token)) continue;\n seen.add(token);\n\n const classification = this.classifier.classify(token);\n if (classification.status !== 'verified' || classification.descriptor.cssProperties.length === 0) {\n throw new Error('Cannot emit an unverified or ungrouped Tailwind class candidate.');\n }\n emitted.push(...this.responsiveEmitter.emitCandidate(state.activation.definition, token));\n }\n\n return emitted;\n }\n\n emitStyle(state: ExtendedResponsiveState<ResponsiveStyleValue>): readonly string[] {\n const emitted: string[] = [];\n const seen = new Set<string>();\n\n for (const declaration of state.value.declarations) {\n const candidate = this.styleEncoder.encode(declaration);\n if (seen.has(candidate)) continue;\n seen.add(candidate);\n\n const descriptor = describeTailwindUtility(candidate);\n if (descriptor === undefined || descriptor.cssProperties.length === 0) {\n throw new Error('Cannot emit an ungrouped Tailwind arbitrary-property candidate.');\n }\n emitted.push(...this.responsiveEmitter.emitCandidate(state.activation.definition, candidate));\n }\n\n return emitted;\n }\n}\n","import type { GridSemanticPlan } from '../../../grid/grid-semantic.model';\n\nexport type TailwindGridRenderResult =\n | { readonly status: 'rendered'; readonly classNames: readonly string[] }\n | {\n readonly status: 'review';\n readonly code: 'tailwind-candidate-unverified';\n readonly reason: string;\n };\n\nfunction encode(property: string, value: string): string | undefined {\n const containsControl = [...value].some(character => {\n const codePoint = character.codePointAt(0);\n return codePoint !== undefined && (codePoint < 0x20 || codePoint === 0x7f);\n });\n if (\n value.length === 0 ||\n containsControl ||\n /[{}'<>]/u.test(value) ||\n value.includes('\\\\') ||\n value.includes('/*') ||\n value.includes('*/')\n ) {\n return undefined;\n }\n let encodedValue: string;\n if (property === 'grid-template-areas') {\n if (!/^(?:\"[^\"]*\")(?:\\s+\"[^\"]*\")*$/u.test(value)) return undefined;\n encodedValue = value.replaceAll('\"', \"'\").replaceAll(' ', '_');\n } else {\n if (value.includes('\"')) return undefined;\n encodedValue = value.replaceAll('_', '\\\\_').replaceAll(' ', '_');\n }\n const candidate = `[${property}:${encodedValue}]`;\n return candidate.length > 0 && !/[\\t\\n\\f\\r \"<]/u.test(candidate) && !/&(?:#|[a-z\\d])/iu.test(candidate)\n ? candidate\n : undefined;\n}\n\nexport class TailwindGridRenderer {\n render(plan: GridSemanticPlan): TailwindGridRenderResult {\n const classNames: string[] = [];\n for (const declaration of plan.declarations) {\n const candidate = encode(declaration.property, declaration.value);\n if (candidate === undefined) {\n return {\n status: 'review',\n code: 'tailwind-candidate-unverified',\n reason: `${declaration.property}: ${declaration.value} cannot be represented as an exact Tailwind class token.`,\n };\n }\n classNames.push(candidate);\n }\n return { status: 'rendered', classNames };\n }\n}\n","import { ResponsiveVariantEmitter } from '../responsive-variant.emitter';\nimport type { VisibilityState } from '../../../semantic/visibility/visibility.model';\n\nexport class VisibilityEmitter {\n constructor(private readonly responsiveEmitter = new ResponsiveVariantEmitter()) {}\n\n emit(state: VisibilityState, restorationUtility: string | undefined): readonly string[] {\n const utility = state.intent === 'hidden' ? 'hidden' : restorationUtility;\n if (utility === undefined) return [];\n if (state.activation.kind === 'base') return [utility];\n return this.responsiveEmitter.emit(state.activation.definition, utility);\n }\n}\n","import type { DiagnosticCode } from '../analyzer/conversion-result';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { BreakpointDefinition } from '../breakpoint/breakpoint-catalog';\nimport type { FlexAlignSemantics } from '../flex/flex-align.semantic';\nimport type { FlexFillSemantics } from '../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../flex/flex-offset.semantic';\nimport type { FlexOrderSemantics } from '../flex/flex-order.semantic';\nimport type { LayoutAlignmentSemantics } from '../flex/layout-align.semantic';\nimport type { LayoutGapSemantics } from '../flex/layout-gap.semantic';\nimport type { LayoutSemantics } from '../flex/layout.semantic';\nimport type { GridSemanticPlan } from '../grid/grid-semantic.model';\nimport type { SourceClassTokenEvidence } from './source-property-evidence';\n\nexport type DirectiveFamily =\n | 'layout'\n | 'layout-gap'\n | 'layout-align'\n | 'flex-item'\n | 'flex-align'\n | 'flex-fill'\n | 'flex-offset'\n | 'flex-order'\n | 'visibility'\n | 'extended-class'\n | 'extended-style'\n | 'grid-align-columns'\n | 'grid-align-rows'\n | 'grid-area'\n | 'grid-areas'\n | 'grid-auto'\n | 'grid-column'\n | 'grid-columns'\n | 'grid-gap'\n | 'grid-align'\n | 'grid-inline'\n | 'grid-row'\n | 'grid-rows';\n\nexport type SemanticPlan<TValue> =\n | {\n readonly status: 'planned';\n readonly input: LocatedFlexLayoutInput;\n readonly family: DirectiveFamily;\n readonly value: TValue;\n }\n | {\n readonly status: 'review' | 'invalid' | 'unsupported';\n readonly input: LocatedFlexLayoutInput;\n readonly code: DiagnosticCode;\n readonly reason: string;\n readonly suggestion: string;\n };\n\nexport type SemanticActivation =\n { readonly kind: 'base' } | { readonly kind: 'media'; readonly definition: BreakpointDefinition };\n\nexport interface VisibilitySemantics {\n readonly kind: 'visibility';\n readonly emit: boolean;\n readonly states: readonly VisibilitySemanticState[];\n readonly restorationDisplay?: string;\n}\n\nexport interface VisibilitySemanticState {\n readonly intent: 'shown' | 'hidden';\n readonly activation: SemanticActivation;\n}\n\nexport interface ExtendedClassSemanticState {\n readonly activations: readonly SemanticActivation[];\n readonly tokens: readonly SourceClassTokenEvidence[];\n}\n\nexport interface ExtendedClassSemantics {\n readonly kind: 'extended-class';\n readonly emit: boolean;\n readonly states: readonly ExtendedClassSemanticState[];\n readonly retainedTokens: readonly SourceClassTokenEvidence[];\n}\n\nexport interface ExtendedStyleDeclaration {\n readonly property: string;\n readonly value: string;\n}\n\nexport interface ExtendedStyleSemanticState {\n readonly activations: readonly SemanticActivation[];\n readonly declarations: readonly ExtendedStyleDeclaration[];\n}\n\nexport interface ExtendedStyleSemantics {\n readonly kind: 'extended-style';\n readonly emit: boolean;\n readonly states: readonly ExtendedStyleSemanticState[];\n}\n\nexport interface EmptySemantics {\n readonly kind: 'empty';\n}\n\nexport interface SuppressedSemanticEffect {\n readonly activation: SemanticActivation;\n readonly properties: readonly string[];\n readonly important: boolean;\n}\n\nexport type ResolvedSemanticValue =\n | LayoutSemantics\n | LayoutGapSemantics\n | LayoutAlignmentSemantics\n | FlexItemSemantics\n | FlexAlignSemantics\n | FlexFillSemantics\n | FlexOffsetSemantics\n | FlexOrderSemantics\n | GridSemanticPlan\n | VisibilitySemantics\n | ExtendedClassSemantics\n | ExtendedStyleSemantics\n | EmptySemantics;\n\n/** A target-free semantic decision ready for exactly one target renderer. */\nexport interface ResolvedSemanticPlan {\n readonly status: 'converted';\n readonly input: LocatedFlexLayoutInput;\n readonly family: DirectiveFamily;\n readonly value: ResolvedSemanticValue;\n readonly activations: readonly SemanticActivation[];\n readonly suppressedProperties?: readonly string[];\n readonly suppressedEffects?: readonly SuppressedSemanticEffect[];\n readonly emitGridDisplay?: boolean;\n}\n\n/** A target-free diagnostic produced while resolving semantic meaning and dependencies. */\nexport interface UnresolvedSemanticPlan {\n readonly status: 'review' | 'invalid' | 'unsupported';\n readonly input: LocatedFlexLayoutInput;\n readonly code: DiagnosticCode;\n readonly reason: string;\n readonly suggestion: string;\n}\n\n/** The complete target-independent outcome of semantic planning. */\nexport type SemanticPlanningPlan = ResolvedSemanticPlan | UnresolvedSemanticPlan;\n\n/** Lets dependency closure operate on semantic plans before rendering and target plans afterward. */\nexport type SemanticDependencyPlan<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n> = TConverted | UnresolvedSemanticPlan;\n\nconst familyByDirective = new Map<LocatedFlexLayoutInput['directive'], DirectiveFamily>([\n ['fxLayout', 'layout'],\n ['fxLayoutGap', 'layout-gap'],\n ['fxLayoutAlign', 'layout-align'],\n ['fxFlex', 'flex-item'],\n ['fxGrow', 'flex-item'],\n ['fxShrink', 'flex-item'],\n ['fxFlexAlign', 'flex-align'],\n ['fxFlexFill', 'flex-fill'],\n ['fxFill', 'flex-fill'],\n ['fxFlexOffset', 'flex-offset'],\n ['fxFlexOrder', 'flex-order'],\n ['fxShow', 'visibility'],\n ['fxHide', 'visibility'],\n ['class', 'extended-class'],\n ['ngClass', 'extended-class'],\n ['style', 'extended-style'],\n ['ngStyle', 'extended-style'],\n ['gdAlignColumns', 'grid-align-columns'],\n ['gdAlignRows', 'grid-align-rows'],\n ['gdArea', 'grid-area'],\n ['gdAreas', 'grid-areas'],\n ['gdAuto', 'grid-auto'],\n ['gdColumn', 'grid-column'],\n ['gdColumns', 'grid-columns'],\n ['gdGap', 'grid-gap'],\n ['gdGridAlign', 'grid-align'],\n ['gdInline', 'grid-inline'],\n ['gdRow', 'grid-row'],\n ['gdRows', 'grid-rows'],\n]);\n\nexport function directiveFamily(directive: LocatedFlexLayoutInput['directive']): DirectiveFamily | undefined {\n return familyByDirective.get(directive);\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport type { BreakpointMigrationConfig } from '../../config/breakpoint-migration-config';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport type { FlexAlignSemantics } from '../../flex/flex-align.semantic';\nimport type { FlexFillSemantics } from '../../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../../flex/flex-offset.semantic';\nimport type { FlexOrderSemantics } from '../../flex/flex-order.semantic';\nimport type { LayoutAlignmentSemantics } from '../../flex/layout-align.semantic';\nimport type { LayoutGapSemantics } from '../../flex/layout-gap.semantic';\nimport type { LayoutSemantics } from '../../flex/layout.semantic';\nimport type { GridSemanticPlan } from '../../grid/grid-semantic.model';\nimport { TailwindSourcePropertyEvidence } from '../../evidence/tailwind-source-property.evidence';\nimport { renderFlexAlign } from '../../adapter/tailwind/directives/flex-align.strategy';\nimport { renderFlexFill } from '../../adapter/tailwind/directives/flex-fill.strategy';\nimport { renderFlexItem } from '../../adapter/tailwind/directives/flex-item.strategy';\nimport { renderFlexOffset } from '../../adapter/tailwind/directives/flex-offset.strategy';\nimport { renderFlexOrder } from '../../adapter/tailwind/directives/flex-order.strategy';\nimport { renderLayoutAlignment } from '../../adapter/tailwind/directives/layout-align.strategy';\nimport { renderLayoutGap } from '../../adapter/tailwind/directives/layout-gap.strategy';\nimport { renderLayout } from '../../adapter/tailwind/directives/layout.strategy';\nimport { ExtendedResponsiveEmitter } from '../../adapter/tailwind/extended/extended-responsive.emitter';\nimport { TailwindGridRenderer } from '../../adapter/tailwind/grid/tailwind-grid.renderer';\nimport {\n describeTailwindDisplay,\n describeTailwindUtility,\n findTailwindClassConflicts,\n} from '../../adapter/tailwind/tailwind-class-conflict';\nimport { cssPropertiesOverlap } from '../../semantic/css-property-ownership';\nimport { ResponsiveVariantEmitter } from '../../adapter/tailwind/responsive-variant.emitter';\nimport { VisibilityEmitter } from '../../adapter/tailwind/visibility/visibility.emitter';\nimport type { SemanticConversionContext } from '../../semantic/conversion-context';\nimport {\n directiveFamily,\n type ExtendedClassSemantics,\n type ExtendedStyleSemantics,\n type ResolvedSemanticPlan,\n type VisibilitySemantics,\n} from '../../semantic/semantic-plan';\nimport type { ConversionRenderer, PlannedConversion } from '../conversion-renderer';\n\nconst sharedDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'fxLayout',\n 'fxLayoutGap',\n 'fxLayoutAlign',\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexAlign',\n 'fxFlexFill',\n 'fxFill',\n 'fxFlexOffset',\n 'fxFlexOrder',\n]);\nconst visibilityDirectives = new Set<LocatedFlexLayoutInput['directive']>(['fxShow', 'fxHide']);\nconst extendedDirectives = new Set<LocatedFlexLayoutInput['directive']>(['class', 'ngClass', 'style', 'ngStyle']);\nconst gridDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdArea',\n 'gdAreas',\n 'gdAuto',\n 'gdColumn',\n 'gdColumns',\n 'gdGap',\n 'gdGridAlign',\n 'gdInline',\n 'gdRow',\n 'gdRows',\n]);\n\nfunction compatibleVisibilityClasses(\n plan: Extract<PlannedConversion, { readonly status: 'converted' }>,\n existingClassNames: readonly string[],\n): readonly string[] {\n if (!visibilityDirectives.has(plan.input.directive)) return existingClassNames;\n const generatedDisplays = plan.classNames.map(describeTailwindDisplay).filter(descriptor => descriptor !== undefined);\n const hasBaseHidden = generatedDisplays.some(\n descriptor => descriptor.activation.kind === 'base' && descriptor.utility === 'hidden',\n );\n return existingClassNames.filter(className => {\n const existing = describeTailwindDisplay(className);\n if (\n !existing ||\n existing.activation.kind !== 'base' ||\n existing.important ||\n existing.token !== existing.utility ||\n existing.utility === 'hidden'\n ) {\n return true;\n }\n const suppliesResponsiveVisibility = hasBaseHidden\n ? generatedDisplays.some(\n generated => generated.activation.kind === 'media' && generated.utility === existing.utility,\n )\n : generatedDisplays.length > 0 && generatedDisplays.every(generated => generated.activation.kind === 'media');\n return !suppliesResponsiveVisibility;\n });\n}\n\nexport class TailwindRenderer implements ConversionRenderer {\n readonly target = 'tailwind' as const;\n readonly breakpointConfig: BreakpointMigrationConfig;\n readonly sourcePropertyEvidence = new TailwindSourcePropertyEvidence();\n private readonly responsiveEmitter = new ResponsiveVariantEmitter();\n private readonly visibilityEmitter = new VisibilityEmitter();\n private readonly extendedEmitter = new ExtendedResponsiveEmitter();\n private readonly gridRenderer = new TailwindGridRenderer();\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n this.breakpointConfig = Object.freeze({ ...config });\n }\n\n eligibility(input: LocatedFlexLayoutInput): PlannedConversion | undefined {\n if (input.binding !== 'property') {\n if (\n !sharedDirectives.has(input.directive) &&\n !visibilityDirectives.has(input.directive) &&\n !extendedDirectives.has(input.directive) &&\n !gridDirectives.has(input.directive)\n ) {\n return {\n status: 'unsupported',\n input,\n code: 'target-unsupported',\n reason: `The Tailwind target does not support ${input.directive}.`,\n suggestion: 'Keep the directive and migrate it manually.',\n };\n }\n }\n return undefined;\n }\n\n render(plan: ResolvedSemanticPlan, _context: SemanticConversionContext): PlannedConversion {\n const inputFamily = directiveFamily(plan.input.directive);\n if (inputFamily !== plan.family) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Tailwind renderer received semantic family \"${String(plan.family)}\" for directive \"${plan.input.directive}\", which belongs to \"${String(inputFamily)}\".`,\n [plan.input.fileName],\n );\n }\n\n let classNames: readonly string[];\n switch (plan.family) {\n case 'layout':\n classNames = renderLayout(plan.value as LayoutSemantics);\n break;\n case 'layout-gap': {\n const result = renderLayoutGap(plan.value as LayoutGapSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'layout-align':\n classNames = renderLayoutAlignment(plan.value as LayoutAlignmentSemantics).classNames;\n break;\n case 'flex-item':\n classNames = renderFlexItem(plan.value as FlexItemSemantics);\n break;\n case 'flex-align': {\n const result = renderFlexAlign(plan.value as FlexAlignSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'flex-fill': {\n const result = renderFlexFill(plan.value as FlexFillSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'flex-offset': {\n const result = renderFlexOffset(plan.value as FlexOffsetSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'flex-order': {\n const result = renderFlexOrder(plan.value as FlexOrderSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'visibility':\n return this.renderVisibility(plan, plan.value as VisibilitySemantics);\n case 'extended-class':\n return this.renderExtendedClass(plan, plan.value as ExtendedClassSemantics);\n case 'extended-style':\n return this.renderExtendedStyle(plan, plan.value as ExtendedStyleSemantics);\n case 'grid-align-columns':\n case 'grid-align-rows':\n case 'grid-area':\n case 'grid-areas':\n case 'grid-auto':\n case 'grid-column':\n case 'grid-columns':\n case 'grid-gap':\n case 'grid-align':\n case 'grid-inline':\n case 'grid-row':\n case 'grid-rows':\n return this.renderGrid(plan, plan.value as GridSemanticPlan);\n default:\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Tailwind renderer does not handle semantic family \"${String(plan.family)}\".`,\n [plan.input.fileName],\n );\n }\n return {\n status: 'converted',\n input: plan.input,\n classNames: this.applySemanticSuppressions(this.decorate(classNames, plan), plan),\n };\n }\n\n resolveConflicts(\n plans: readonly PlannedConversion[],\n context: SemanticConversionContext,\n ): readonly PlannedConversion[] {\n return this.resolveClassConflicts(plans, context.existingClassNames);\n }\n\n record(_plans: readonly PlannedConversion[]): void {}\n\n resolveClassConflicts(\n plans: readonly PlannedConversion[],\n existingClassNames: readonly string[],\n ): readonly PlannedConversion[] {\n const convertedPlans = plans.filter(\n (plan): plan is Extract<PlannedConversion, { readonly status: 'converted' }> => plan.status === 'converted',\n );\n const sharedConflictingTokens = findTailwindClassConflicts(\n existingClassNames,\n convertedPlans.flatMap(plan => plan.classNames),\n );\n const conflictingFamilies = new Set(\n convertedPlans\n .filter(plan => {\n if (!visibilityDirectives.has(plan.input.directive)) {\n return plan.classNames.some(className => sharedConflictingTokens.has(className));\n }\n const conflictingTokens = findTailwindClassConflicts(\n compatibleVisibilityClasses(plan, existingClassNames),\n plan.classNames,\n );\n return plan.classNames.some(className => conflictingTokens.has(className));\n })\n .map(plan => directiveFamily(plan.input.directive) ?? plan.input.directive),\n );\n return plans.map(plan =>\n plan.status === 'converted' &&\n conflictingFamilies.has(directiveFamily(plan.input.directive) ?? plan.input.directive)\n ? {\n status: 'review',\n input: plan.input,\n code: 'class-conflict',\n reason: 'An existing Tailwind utility controls a CSS property generated by this conversion.',\n suggestion: 'Remove or reconcile the conflicting utility before migrating this directive.',\n }\n : plan,\n );\n }\n\n private decorate(classNames: readonly string[], plan: ResolvedSemanticPlan): readonly string[] {\n return plan.activations.flatMap(planActivation =>\n planActivation.kind === 'base'\n ? classNames\n : classNames.flatMap(className => this.responsiveEmitter.emit(planActivation.definition, className)),\n );\n }\n\n private renderGrid(plan: ResolvedSemanticPlan, value: GridSemanticPlan): PlannedConversion {\n const rendered = this.gridRenderer.render(value);\n if (rendered.status === 'review') {\n return {\n status: 'review',\n input: plan.input,\n code: rendered.code,\n reason: rendered.reason,\n suggestion: 'Use an exact Tailwind class manually or retain the Grid directive.',\n };\n }\n const display =\n value.role === 'container' && plan.emitGridDisplay !== false\n ? ['grid']\n : value.role === 'modifier'\n ? [value.inline ? 'inline-grid' : 'grid']\n : [];\n return {\n status: 'converted',\n input: plan.input,\n classNames: this.applySemanticSuppressions(this.decorate([...display, ...rendered.classNames], plan), plan),\n };\n }\n\n private renderVisibility(plan: ResolvedSemanticPlan, value: VisibilitySemantics): PlannedConversion {\n const classNames = value.emit\n ? [\n ...new Set(\n value.states.flatMap(state =>\n this.visibilityEmitter.emit({ ...state, input: plan.input }, value.restorationDisplay),\n ),\n ),\n ]\n : [];\n return { status: 'converted', input: plan.input, classNames };\n }\n\n private renderExtendedClass(plan: ResolvedSemanticPlan, value: ExtendedClassSemantics): PlannedConversion {\n const classNames = value.emit\n ? [\n ...new Set(\n value.states.flatMap(state =>\n state.activations.flatMap(itemActivation => {\n if (itemActivation.kind !== 'media') return [];\n return this.extendedEmitter.emitClass({\n input: plan.input,\n activation: itemActivation,\n value: { tokens: state.tokens.map(token => token.source) },\n });\n }),\n ),\n ),\n ]\n : [];\n return {\n status: 'converted',\n input: plan.input,\n classNames: this.applySemanticSuppressions(classNames, plan),\n ...(value.retainedTokens.length > 0\n ? { retainedClassNames: value.retainedTokens.map(token => token.source) }\n : {}),\n };\n }\n\n private renderExtendedStyle(plan: ResolvedSemanticPlan, value: ExtendedStyleSemantics): PlannedConversion {\n const classNames = value.emit\n ? [\n ...new Set(\n value.states.flatMap(state =>\n state.activations.flatMap(itemActivation => {\n if (itemActivation.kind !== 'media') return [];\n return this.extendedEmitter.emitStyle({\n input: plan.input,\n activation: itemActivation,\n value: { declarations: state.declarations },\n });\n }),\n ),\n ),\n ]\n : [];\n return { status: 'converted', input: plan.input, classNames: this.applySemanticSuppressions(classNames, plan) };\n }\n\n private applySemanticSuppressions(classNames: readonly string[], plan: ResolvedSemanticPlan): readonly string[] {\n if (!plan.suppressedProperties?.length && !plan.suppressedEffects?.length) return classNames;\n return classNames.filter(className => {\n const descriptor = describeTailwindUtility(className);\n if (descriptor === undefined) return true;\n if (\n plan.suppressedProperties?.some(property =>\n descriptor.cssProperties.some(candidate => cssPropertiesOverlap(candidate, property)),\n )\n ) {\n return false;\n }\n return !(plan.suppressedEffects ?? []).some(suppression => {\n if (\n descriptor.important !== suppression.important ||\n descriptor.cssProperties.length !== suppression.properties.length ||\n !descriptor.cssProperties.every((property, index) => property === suppression.properties[index])\n ) {\n return false;\n }\n if (suppression.activation.kind === 'base') return descriptor.activation.kind === 'base';\n if (descriptor.activation.kind !== 'media') return false;\n if ((descriptor.activation.mediaType ?? 'screen') !== suppression.activation.definition.media.type)\n return false;\n const descriptorActivation = descriptor.activation;\n return suppression.activation.definition.media.clauses.some(\n range =>\n range.min === descriptorActivation.range.min &&\n range.max === descriptorActivation.range.max &&\n range.orientation === descriptorActivation.range.orientation,\n );\n });\n });\n }\n}\n","import type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport { CssRenderer } from './css/css.renderer';\nimport type { ConversionRenderer } from './conversion-renderer';\nimport { TailwindRenderer } from './tailwind/tailwind.renderer';\n\nexport type AdapterSessionResult =\n { readonly target: 'tailwind' } | { readonly target: 'css'; readonly rules: readonly OwnedCssRule[] };\n\nexport interface RenderSession {\n readonly renderer: ConversionRenderer;\n finalize(): AdapterSessionResult;\n}\n\nexport function createRenderSession(\n target: AdapterSessionResult['target'],\n config: BreakpointMigrationConfig = { orientationBreakpoints: false },\n): RenderSession {\n return target === 'tailwind' ? new TailwindRenderSession(config) : new CssRenderSession(config);\n}\n\nexport function sessionBoundRenderer(renderer: ConversionRenderer, assertActive: () => void): ConversionRenderer {\n return Object.freeze({\n target: renderer.target,\n breakpointConfig: renderer.breakpointConfig,\n sourcePropertyEvidence: renderer.sourcePropertyEvidence,\n eligibility(input: Parameters<ConversionRenderer['eligibility']>[0]) {\n assertActive();\n return renderer.eligibility(input);\n },\n render(plan: Parameters<ConversionRenderer['render']>[0], context: Parameters<ConversionRenderer['render']>[1]) {\n assertActive();\n return renderer.render(plan, context);\n },\n resolveConflicts(\n plans: Parameters<ConversionRenderer['resolveConflicts']>[0],\n context: Parameters<ConversionRenderer['resolveConflicts']>[1],\n ) {\n assertActive();\n return renderer.resolveConflicts(plans, context);\n },\n record(plans: Parameters<ConversionRenderer['record']>[0]) {\n assertActive();\n renderer.record(plans);\n },\n });\n}\n\nabstract class SingleUseRenderSession implements RenderSession {\n abstract readonly renderer: ConversionRenderer;\n private finalized = false;\n\n finalize(): AdapterSessionResult {\n if (this.finalized) throw new Error('Render session already finalized');\n this.finalized = true;\n return Object.freeze(this.result());\n }\n\n protected assertActive(): void {\n if (this.finalized) throw new Error('Render session is finalized');\n }\n\n protected abstract result(): AdapterSessionResult;\n}\n\nexport class TailwindRenderSession extends SingleUseRenderSession {\n readonly renderer: ConversionRenderer;\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n super();\n this.renderer = sessionBoundRenderer(new TailwindRenderer(config), () => this.assertActive());\n }\n\n protected result(): AdapterSessionResult {\n return { target: 'tailwind' };\n }\n}\n\nexport class CssRenderSession extends SingleUseRenderSession {\n readonly renderer: ConversionRenderer;\n private readonly cssRenderer: CssRenderer;\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n super();\n this.cssRenderer = new CssRenderer(undefined, config);\n this.renderer = sessionBoundRenderer(this.cssRenderer, () => this.assertActive());\n }\n\n protected result(): AdapterSessionResult {\n return { target: 'css', rules: this.cssRenderer.finalizedRules() };\n }\n}\n","import { logger } from '../logger';\nimport type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\nimport { CssRenderSession, TailwindRenderSession, type RenderSession } from '../render/render-session';\n\nexport class AdapterFactory {\n static createRenderSession(\n target: string,\n config: BreakpointMigrationConfig = { orientationBreakpoints: false },\n ): RenderSession {\n logger.info(`Creating adapter session [${target}]`);\n if (target === 'tailwind') return new TailwindRenderSession(config);\n if (target === 'css') return new CssRenderSession(config);\n throw new Error(`Adapter [${target}] not found`);\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport { TemplateAnalyzer } from '../../analyzer/template.analyzer';\nimport { AngularTemplateParser } from '../../template/angular-template.parser';\nimport { analyzedProject, type AnalyzedProject, type AnalyzedTemplate } from '../analyzed-project';\nimport type { AnalyzeStage } from '../migration-pipeline';\nimport type { ProjectManifest } from '../project-manifest';\nimport type { TemplateInputAnalyzer } from './template-input-analyzer.port';\nimport type { TemplateParser } from './template-parser.port';\nimport type { TemplateSourceReader } from './template-source-reader.port';\n\nconst nodeSourceReader: TemplateSourceReader = Object.freeze({\n read: (path: string) => readFile(path, 'utf8'),\n});\n\nexport class AnalyzeProjectStage implements AnalyzeStage {\n constructor(\n private readonly sourceReader: TemplateSourceReader = nodeSourceReader,\n private readonly parser: TemplateParser = new AngularTemplateParser(),\n private readonly analyzer: TemplateInputAnalyzer = new TemplateAnalyzer(),\n ) {}\n\n public async run(manifest: ProjectManifest): Promise<AnalyzedProject> {\n const templates: AnalyzedTemplate[] = [];\n\n for (const file of manifest.templates) {\n const source = await this.sourceReader.read(file.inputPath);\n const parseResult = this.parser.parse(source, file.inputPath);\n\n templates.push(\n parseResult.status === 'parse-error'\n ? { status: 'parse-error', file, source, parseResult }\n : {\n status: 'parsed',\n file,\n source,\n parseResult,\n inputs: this.analyzer.analyze(file.inputPath, parseResult.elements),\n },\n );\n }\n\n return analyzedProject({ manifest, templates });\n }\n}\n","import { FLEX_LAYOUT_DIRECTIVES, FlexLayoutDirective, isFlexLayoutDirective } from './flex-layout.catalog';\nimport type { SourceRange } from '../template/template.model';\n\nexport type BindingKind = 'literal' | 'property';\n\nexport interface FlexLayoutInput {\n sourceName: string;\n directive: FlexLayoutDirective;\n value: string;\n binding: BindingKind;\n breakpoint: string | undefined;\n}\n\nexport interface LocatedFlexLayoutInput extends FlexLayoutInput {\n readonly id: string;\n readonly fileName: string;\n readonly elementId: string;\n readonly source: SourceRange;\n readonly nameSource: SourceRange;\n readonly valueSource?: SourceRange;\n}\n\nconst responsiveOnlyDirectives = new Set<FlexLayoutDirective>(['class', 'ngClass', 'style', 'ngStyle']);\nconst directivesByLength = [...FLEX_LAYOUT_DIRECTIVES].sort((left, right) => right.length - left.length);\n\nexport function analyzeFlexLayoutAttribute(sourceName: string, value: string): FlexLayoutInput | undefined {\n const startsWithBracket = sourceName.startsWith('[');\n const endsWithBracket = sourceName.endsWith(']');\n\n if (startsWithBracket !== endsWithBracket) return undefined;\n\n const binding: BindingKind = startsWithBracket ? 'property' : 'literal';\n const normalizedName = startsWithBracket ? sourceName.slice(1, -1) : sourceName;\n\n if (normalizedName.startsWith('src.')) {\n return {\n sourceName,\n value,\n directive: 'imgSrc',\n breakpoint: normalizedName.slice('src.'.length),\n binding,\n };\n }\n\n const directive = directivesByLength.find(\n candidate => normalizedName === candidate || normalizedName.startsWith(`${candidate}.`),\n );\n\n if (!directive || !isFlexLayoutDirective(directive)) return undefined;\n\n const breakpoint = normalizedName === directive ? undefined : normalizedName.slice(directive.length + 1);\n if (responsiveOnlyDirectives.has(directive) && !breakpoint) return undefined;\n\n return {\n sourceName,\n value,\n directive,\n breakpoint,\n binding,\n };\n}\n","import type { TemplateElement } from '../template/template.model';\nimport { analyzeFlexLayoutAttribute, LocatedFlexLayoutInput } from './flex-layout-attribute.analyzer';\nimport { isKnownBreakpoint } from './flex-layout.catalog';\n\nfunction sourceNameFor(attribute: TemplateElement['attributes'][number]): string | undefined {\n if (attribute.binding === 'literal') return attribute.name;\n if (attribute.bindingTarget === 'property' || attribute.bindingTarget === 'two-way') return `[${attribute.name}]`;\n if (\n (attribute.bindingTarget === 'class' || attribute.bindingTarget === 'style') &&\n isKnownBreakpoint(attribute.name)\n ) {\n return `[${attribute.bindingTarget}.${attribute.name}]`;\n }\n return undefined;\n}\n\nexport class TemplateAnalyzer {\n analyze(fileName: string, elements: readonly TemplateElement[]): readonly LocatedFlexLayoutInput[] {\n const inputs: LocatedFlexLayoutInput[] = [];\n\n for (const element of elements) {\n for (const attribute of element.attributes) {\n const sourceName = sourceNameFor(attribute);\n if (!sourceName) continue;\n const input = analyzeFlexLayoutAttribute(sourceName, attribute.value);\n if (!input) continue;\n\n inputs.push({\n ...input,\n id: `${fileName}:${attribute.source.start}`,\n fileName,\n elementId: element.id,\n source: attribute.source,\n nameSource: attribute.nameSource,\n ...(attribute.valueSource ? { valueSource: attribute.valueSource } : {}),\n });\n }\n }\n\n return inputs.sort((left, right) => left.source.start - right.source.start);\n }\n}\n","import {\n BindingType,\n parseTemplate,\n TmplAstBoundAttribute,\n TmplAstElement,\n TmplAstRecursiveVisitor,\n TmplAstTemplate,\n TmplAstTextAttribute,\n tmplAstVisitAll,\n} from '@angular/compiler';\nimport { SourceRange, TemplateAttribute, TemplateElement, TemplateParseResult } from './template.model';\n\nfunction range(start: number, end: number): SourceRange {\n return { start, end };\n}\n\nfunction attributeNameRange(source: string, attribute: TmplAstTextAttribute | TmplAstBoundAttribute): SourceRange {\n const start = attribute.sourceSpan.start.offset;\n const rawAttribute = source.slice(start, attribute.sourceSpan.end.offset);\n const equalsIndex = rawAttribute.indexOf('=');\n const rawName = (equalsIndex === -1 ? rawAttribute : rawAttribute.slice(0, equalsIndex)).trimEnd();\n return range(start, start + rawName.length);\n}\n\nfunction normalizeAttribute(\n source: string,\n attribute: TmplAstTextAttribute | TmplAstBoundAttribute,\n binding: TemplateAttribute['binding'],\n): TemplateAttribute {\n const nameSource = attributeNameRange(source, attribute);\n const valueSource = attribute.valueSpan\n ? range(attribute.valueSpan.start.offset, attribute.valueSpan.end.offset)\n : undefined;\n const rawValue = valueSource ? source.slice(valueSource.start, valueSource.end) : '';\n\n return {\n name: attribute.name,\n rawName: source.slice(nameSource.start, nameSource.end),\n rawValue,\n value: attribute instanceof TmplAstTextAttribute ? attribute.value : rawValue,\n binding,\n ...(attribute instanceof TmplAstBoundAttribute ? { bindingTarget: boundTarget(attribute.type) } : {}),\n source: range(attribute.sourceSpan.start.offset, attribute.sourceSpan.end.offset),\n nameSource,\n ...(valueSource ? { valueSource } : {}),\n };\n}\n\nfunction boundTarget(type: BindingType): NonNullable<TemplateAttribute['bindingTarget']> {\n switch (type) {\n case BindingType.Attribute:\n return 'attribute';\n case BindingType.Class:\n return 'class';\n case BindingType.Style:\n return 'style';\n case BindingType.LegacyAnimation:\n case BindingType.Animation:\n return 'animation';\n case BindingType.TwoWay:\n return 'two-way';\n case BindingType.Property:\n default:\n return 'property';\n }\n}\n\nclass ElementCollector extends TmplAstRecursiveVisitor {\n readonly elements: TemplateElement[] = [];\n private readonly parents: string[] = [];\n private readonly structuralElements = new Set<number>();\n\n constructor(private readonly source: string) {\n super();\n }\n\n override visitElement(element: TmplAstElement): void {\n const id = String(element.sourceSpan.start.offset);\n const attributes = [\n ...element.attributes.map(attribute => normalizeAttribute(this.source, attribute, 'literal')),\n ...element.inputs.map(attribute => normalizeAttribute(this.source, attribute, 'property')),\n ].sort((left, right) => left.source.start - right.source.start);\n\n this.elements.push({\n id,\n name: element.name,\n source: range(element.sourceSpan.start.offset, element.sourceSpan.end.offset),\n startTag: range(element.startSourceSpan.start.offset, element.startSourceSpan.end.offset),\n ...(element.endSourceSpan && element.endSourceSpan.start.offset !== element.startSourceSpan.start.offset\n ? { endTag: range(element.endSourceSpan.start.offset, element.endSourceSpan.end.offset) }\n : {}),\n structural: this.structuralElements.has(element.sourceSpan.start.offset),\n attributes,\n ...(this.parents.at(-1) ? { parentId: this.parents.at(-1) } : {}),\n });\n\n this.parents.push(id);\n super.visitElement(element);\n this.parents.pop();\n }\n\n override visitTemplate(template: TmplAstTemplate): void {\n const structuralElement =\n template.tagName === null\n ? undefined\n : template.children.find(\n child =>\n child instanceof TmplAstElement &&\n child.name === template.tagName &&\n child.sourceSpan.start.offset === template.sourceSpan.start.offset &&\n child.sourceSpan.end.offset === template.sourceSpan.end.offset,\n );\n\n if (structuralElement) {\n this.structuralElements.add(structuralElement.sourceSpan.start.offset);\n }\n super.visitTemplate(template);\n if (structuralElement) {\n this.structuralElements.delete(structuralElement.sourceSpan.start.offset);\n }\n }\n}\n\nexport class AngularTemplateParser {\n parse(source: string, fileName: string): TemplateParseResult {\n const parsed = parseTemplate(source, fileName, {\n enableBlockSyntax: true,\n preserveLineEndings: true,\n preserveWhitespaces: true,\n });\n\n if (parsed.errors?.length) {\n return {\n status: 'parse-error',\n diagnostics: parsed.errors.map(error => ({\n message: error.msg,\n source: range(error.span.start.offset, error.span.end.offset),\n })),\n };\n }\n\n const collector = new ElementCollector(source);\n tmplAstVisitAll(collector, parsed.nodes);\n return { status: 'parsed', elements: collector.elements };\n }\n}\n","import * as path from 'node:path';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { SourceRange, TemplateAttribute, TemplateElement, TemplateParseResult } from '../template/template.model';\nimport { projectManifest, type ManifestTemplate, type ProjectManifest } from './project-manifest';\n\nexport type AnalyzedTemplate =\n | {\n readonly status: 'parsed';\n readonly file: ManifestTemplate;\n readonly source: string;\n readonly parseResult: Extract<TemplateParseResult, { readonly status: 'parsed' }>;\n readonly inputs: readonly LocatedFlexLayoutInput[];\n }\n | {\n readonly status: 'parse-error';\n readonly file: ManifestTemplate;\n readonly source: string;\n readonly parseResult: Extract<TemplateParseResult, { readonly status: 'parse-error' }>;\n };\n\nexport interface AnalyzedProject {\n readonly manifest: ProjectManifest;\n readonly templates: readonly AnalyzedTemplate[];\n}\n\nexport function analyzedProject(project: AnalyzedProject): AnalyzedProject {\n const manifest = projectManifest(project.manifest);\n if (project.templates.length !== manifest.templates.length) {\n throw sequenceInvariant();\n }\n const templates = project.templates.map((template, index) => {\n const file = manifestTemplateAt(manifest, template.file, index);\n if (template.status === 'parse-error') {\n return Object.freeze({\n status: template.status,\n file,\n source: template.source,\n parseResult: freezeParseErrorResult(template.parseResult),\n });\n }\n\n return Object.freeze({\n status: template.status,\n file,\n source: template.source,\n parseResult: freezeParsedResult(template.parseResult),\n inputs: Object.freeze(template.inputs.map(input => freezeLocatedInput(input))),\n });\n });\n\n return Object.freeze({ manifest, templates: Object.freeze(templates) });\n}\n\nfunction freezeParsedResult(\n result: Extract<TemplateParseResult, { readonly status: 'parsed' }>,\n): Extract<TemplateParseResult, { readonly status: 'parsed' }> {\n return Object.freeze({\n status: result.status,\n elements: Object.freeze(result.elements.map(element => freezeTemplateElement(element))),\n });\n}\n\nfunction freezeTemplateElement(element: TemplateElement): TemplateElement {\n return Object.freeze({\n id: element.id,\n name: element.name,\n source: freezeSourceRange(element.source),\n startTag: freezeSourceRange(element.startTag),\n ...(element.endTag === undefined ? {} : { endTag: freezeSourceRange(element.endTag) }),\n structural: element.structural,\n attributes: Object.freeze(element.attributes.map(attribute => freezeTemplateAttribute(attribute))),\n ...(element.parentId === undefined ? {} : { parentId: element.parentId }),\n });\n}\n\nfunction freezeTemplateAttribute(attribute: TemplateAttribute): TemplateAttribute {\n return Object.freeze({\n name: attribute.name,\n rawName: attribute.rawName,\n rawValue: attribute.rawValue,\n value: attribute.value,\n binding: attribute.binding,\n ...(attribute.bindingTarget === undefined ? {} : { bindingTarget: attribute.bindingTarget }),\n source: freezeSourceRange(attribute.source),\n nameSource: freezeSourceRange(attribute.nameSource),\n ...(attribute.valueSource === undefined ? {} : { valueSource: freezeSourceRange(attribute.valueSource) }),\n });\n}\n\nfunction freezeSourceRange(source: SourceRange): SourceRange {\n return Object.freeze({ start: source.start, end: source.end });\n}\n\nfunction freezeParseErrorResult(\n result: Extract<TemplateParseResult, { readonly status: 'parse-error' }>,\n): Extract<TemplateParseResult, { readonly status: 'parse-error' }> {\n return Object.freeze({\n status: result.status,\n diagnostics: Object.freeze(\n result.diagnostics.map(diagnostic =>\n Object.freeze({\n ...diagnostic,\n source: Object.freeze({ ...diagnostic.source }),\n }),\n ),\n ),\n });\n}\n\nfunction manifestTemplateAt(manifest: ProjectManifest, candidate: ManifestTemplate, index: number): ManifestTemplate {\n const expected = manifest.templates[index];\n if (expected === undefined || !samePathPair(expected, candidate)) {\n throw sequenceInvariant([candidate.inputPath, candidate.outputPath]);\n }\n return expected;\n}\n\nfunction samePathPair(left: ManifestTemplate, right: ManifestTemplate): boolean {\n return (\n normalizedAbsolutePath(left.inputPath) === normalizedAbsolutePath(right.inputPath) &&\n normalizedAbsolutePath(left.outputPath) === normalizedAbsolutePath(right.outputPath)\n );\n}\n\nfunction freezeLocatedInput(input: LocatedFlexLayoutInput): LocatedFlexLayoutInput {\n return Object.freeze({\n ...input,\n source: Object.freeze({ ...input.source }),\n nameSource: Object.freeze({ ...input.nameSource }),\n ...(input.valueSource === undefined ? {} : { valueSource: Object.freeze({ ...input.valueSource }) }),\n });\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n\nfunction sequenceInvariant(paths: readonly string[] = []): MigrationApplicationError {\n return internalInvariant(\n 'Analyzed project templates must match its manifest one-to-one and in the same order.',\n paths,\n );\n}\n\nfunction internalInvariant(message: string, paths: readonly string[] = []): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message, paths);\n}\n","import * as path from 'node:path';\nimport type { MigrationMode } from '../migrator/migration-mode';\n\nexport interface MigrationOptions {\n readonly mode: MigrationMode;\n readonly responsiveImages?: boolean;\n readonly stylesheetPath?: string;\n readonly stylesheetPathInput?: string;\n readonly reportPath?: string;\n}\n\nexport interface MigrationInvocation {\n readonly inputPath: string;\n readonly outputPath: string;\n readonly canonicalInputPath: string;\n readonly canonicalOutputPath: string;\n readonly options: Readonly<MigrationOptions>;\n}\n\ntype MigrationInvocationInput = Pick<MigrationInvocation, 'inputPath' | 'outputPath' | 'options'>;\n\nexport interface ManifestTemplate {\n readonly inputPath: string;\n readonly outputPath: string;\n}\n\nexport interface ProjectManifest {\n readonly invocation: MigrationInvocation;\n readonly templates: readonly ManifestTemplate[];\n}\n\nexport function migrationInvocation(invocation: MigrationInvocationInput): MigrationInvocation {\n return freezeMigrationInvocation({\n inputPath: invocation.inputPath,\n outputPath: invocation.outputPath,\n canonicalInputPath: normalizedAbsolutePath(invocation.inputPath),\n canonicalOutputPath: normalizedAbsolutePath(invocation.outputPath),\n options: invocation.options,\n });\n}\n\nexport function projectManifest(\n manifest: Omit<ProjectManifest, 'invocation'> & {\n readonly invocation: MigrationInvocationInput | MigrationInvocation;\n },\n): ProjectManifest {\n return Object.freeze({\n invocation: hasCanonicalIdentity(manifest.invocation)\n ? freezeMigrationInvocation(manifest.invocation)\n : migrationInvocation(manifest.invocation),\n templates: Object.freeze(\n manifest.templates.map(template =>\n Object.freeze({\n inputPath: normalizedAbsolutePath(template.inputPath),\n outputPath: normalizedAbsolutePath(template.outputPath),\n }),\n ),\n ),\n });\n}\n\nfunction hasCanonicalIdentity(\n invocation: MigrationInvocationInput | MigrationInvocation,\n): invocation is MigrationInvocation {\n return 'canonicalInputPath' in invocation && 'canonicalOutputPath' in invocation;\n}\n\nfunction freezeMigrationInvocation(invocation: MigrationInvocation): MigrationInvocation {\n return Object.freeze({\n inputPath: invocation.inputPath,\n outputPath: invocation.outputPath,\n canonicalInputPath: invocation.canonicalInputPath,\n canonicalOutputPath: invocation.canonicalOutputPath,\n options: Object.freeze({ ...invocation.options }),\n });\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n","import { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { ArtifactState, PlannedOutputArtifact } from '../migrator/migration-plan';\nimport { compareCodeUnits } from '../util/compare-code-units';\n\nexport interface MigrationTransactionFileHandle {\n chmod(mode: number): Promise<void>;\n writeFile(contents: string, encoding: BufferEncoding): Promise<void>;\n readFile(options: { readonly encoding: 'utf8' }): Promise<string>;\n stat(): Promise<MigrationTransactionStat>;\n sync(): Promise<void>;\n close(): Promise<void>;\n}\n\nexport interface MigrationTransactionStat {\n readonly dev: number | bigint;\n readonly ino: number | bigint;\n readonly mode: number | bigint;\n isDirectory(): boolean;\n isFile(): boolean;\n isSymbolicLink(): boolean;\n}\n\nexport interface MigrationTransactionOperations {\n access(path: string, mode: number): Promise<void>;\n link(existingPath: string, newPath: string): Promise<void>;\n lstat(path: string): Promise<MigrationTransactionStat>;\n mkdir(path: string, options?: { readonly recursive?: boolean; readonly mode?: number }): Promise<unknown>;\n open(path: string, flags: 'r' | 'wx'): Promise<MigrationTransactionFileHandle>;\n rename(source: string, destination: string): Promise<void>;\n rmdir(path: string): Promise<void>;\n stat(path: string): Promise<MigrationTransactionStat>;\n unlink(path: string): Promise<void>;\n}\n\nexport interface FileIdentity {\n readonly dev: string;\n readonly ino: string;\n}\n\nexport interface DirectoryExpectation {\n readonly path: string;\n readonly original:\n | 'absent'\n | { readonly identity: FileIdentity; readonly kind: 'directory' }\n | { readonly identity: FileIdentity; readonly kind: 'symbolic-link'; readonly followedIdentity: FileIdentity };\n}\n\nexport interface CreatedDirectory {\n readonly path: string;\n identity?: FileIdentity;\n readonly publicPaths: Set<string>;\n exists: boolean;\n}\n\nexport interface OwnedNamespace {\n readonly path: string;\n identity?: FileIdentity;\n readonly publicPath: string;\n exists: boolean;\n}\n\nexport interface OwnedFile {\n readonly path: string;\n readonly publicPath: string;\n identity?: FileIdentity;\n exists: boolean;\n preserve: boolean;\n}\n\nexport interface ObservedPresentState {\n readonly status: 'present';\n readonly contents: string;\n readonly identity: FileIdentity;\n readonly mode: number;\n}\n\nexport type ObservedState = { readonly status: 'absent' } | ObservedPresentState;\n\nexport interface RuntimeArtifact {\n readonly artifact: PlannedOutputArtifact;\n readonly directories: readonly DirectoryExpectation[];\n readonly quarantines: OwnedFile[];\n readonly ownedFiles: OwnedFile[];\n readonly readHandles: Set<MigrationTransactionFileHandle>;\n originalIdentity?: FileIdentity;\n originalMode?: number;\n namespace?: OwnedNamespace;\n stage?: OwnedFile;\n backup?: OwnedFile;\n openHandle?: MigrationTransactionFileHandle;\n installedIdentity?: FileIdentity;\n restoredIdentity?: FileIdentity;\n}\n\nexport interface TransactionUnitContext {\n readonly items: RuntimeArtifact[];\n readonly createdDirectories: Map<string, CreatedDirectory>;\n readonly unconfirmedEntries: Map<string, Set<string>>;\n readonly recoveryFailures: unknown[];\n readonly restored: Map<RuntimeArtifact, boolean>;\n readonly ownershipChanged: () => void;\n}\n\nexport interface RecoveryOutcome {\n readonly paths: readonly string[];\n readonly failures: readonly unknown[];\n}\n\nexport class RecoveryUnitError extends Error {\n constructor(\n readonly paths: readonly string[],\n readonly failures: readonly unknown[],\n ) {\n super('Transaction recovery was incomplete.');\n this.name = 'RecoveryUnitError';\n this.paths = Object.freeze([...paths]);\n this.failures = Object.freeze([...failures]);\n }\n}\n\nexport function runtimeArtifact(\n context: Pick<TransactionUnitContext, 'items'>,\n artifact: PlannedOutputArtifact,\n): RuntimeArtifact {\n const item = context.items.find(candidate => candidate.artifact === artifact);\n if (item) return item;\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Migration transaction journal contains an unknown artifact: ${artifact.path}`,\n [artifact.path],\n );\n}\n\nexport function identity(stat: MigrationTransactionStat): FileIdentity {\n return { dev: String(stat.dev), ino: String(stat.ino) };\n}\n\nexport function fileMode(stat: MigrationTransactionStat): number {\n return Number(stat.mode) & 0o7777;\n}\n\nexport function sameIdentity(left: FileIdentity, right: FileIdentity): boolean {\n return left.dev === right.dev && left.ino === right.ino;\n}\n\nexport function sameArtifactState(left: ObservedState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n\nexport function required<T>(value: T | undefined): T {\n if (value === undefined) throw new Error('Missing transaction state.');\n return value;\n}\n\nexport function isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n\nexport function isDirectoryNotEmpty(error: unknown): error is NodeJS.ErrnoException {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n (error.code === 'ENOTEMPTY' || error.code === 'EEXIST')\n );\n}\n\nexport function pathDepth(path: string): number {\n return path.split(/[\\\\/]/u).filter(Boolean).length;\n}\n\nexport function recoveryOutcome(paths: Iterable<string>, failures: readonly unknown[]): RecoveryOutcome {\n return { paths: sortedUnique(paths), failures: Object.freeze([...failures]) };\n}\n\nexport function recoveryUnitError(error: unknown): RecoveryUnitError {\n return new RecoveryUnitError(error instanceof MigrationApplicationError ? error.paths : [], [error]);\n}\n\nexport function sortedUnique(paths: Iterable<string>): readonly string[] {\n return [...new Set(paths)].sort(compareCodeUnits);\n}\n","import type { StagedArtifact } from './staging.unit';\nimport type { CleanupArtifactView, CleanupPort, OwnedFileView } from './transaction-unit.ports';\nimport {\n RecoveryUnitError,\n identity,\n isDirectoryNotEmpty,\n isEnoent,\n pathDepth,\n recoveryOutcome,\n recoveryUnitError,\n sameArtifactState,\n sameIdentity,\n type MigrationTransactionStat,\n type ObservedState,\n type RecoveryOutcome,\n} from './transaction-unit.state';\nimport { compareCodeUnits } from '../util/compare-code-units';\n\nexport { RecoveryUnitError } from './transaction-unit.state';\n\nexport interface CleanupUnit {\n cleanup(staged: readonly StagedArtifact[]): Promise<readonly string[]>;\n}\n\nexport type CleanupKind = 'committed' | 'recovery';\n\nexport class FileSystemCleanupUnit implements CleanupUnit {\n constructor(\n private readonly port: CleanupPort,\n private readonly kind: CleanupKind,\n ) {}\n\n public async cleanup(staged: readonly StagedArtifact[]): Promise<readonly string[]> {\n const failures: unknown[] = [];\n const paths = new Set<string>();\n let stagedItems: CleanupArtifactView[];\n try {\n stagedItems = staged.map(entry => this.port.journal.artifact(entry.artifact));\n } catch (error: unknown) {\n throw recoveryUnitError(error);\n }\n const items = this.kind === 'recovery' ? stagedItems.reverse() : stagedItems;\n for (const item of items) {\n await this.port.closeReadHandles(item, failures);\n await this.port.closeOpenHandle(item, failures);\n const ownedFiles = this.kind === 'recovery' ? [...item.ownedFiles].reverse() : item.ownedFiles;\n for (const owned of ownedFiles) {\n if (this.kind === 'recovery' && owned.path === item.backupPath && this.port.journal.restored(item) === false) {\n if (owned.exists) paths.add(item.artifact.path);\n continue;\n }\n await this.removeOwnedFile(item, owned, paths, failures);\n }\n await this.removeNamespace(item, paths, failures);\n this.port.journal.finishArtifactCleanup();\n }\n await this.removeCreatedDirectories(paths, failures);\n await this.collectUnconfirmedPaths(paths, failures);\n if (this.kind === 'recovery') {\n for (const item of this.port.journal.artifacts()) {\n if (!(await this.verifyOriginal(item, failures))) paths.add(item.artifact.path);\n }\n }\n return recoveryResult(recoveryOutcome(paths, failures));\n }\n\n private async removeOwnedFile(\n item: CleanupArtifactView,\n owned: OwnedFileView | undefined,\n paths: Set<string>,\n failures: unknown[],\n ): Promise<void> {\n if (!owned?.exists) return;\n if (owned.preserve || !owned.identity) {\n paths.add(owned.publicPath);\n return;\n }\n try {\n await this.port.assertNamespace(item);\n const before = await this.port.lstat(owned.path);\n if (!sameIdentity(identity(before), owned.identity) || before.isSymbolicLink() || !before.isFile()) {\n paths.add(owned.publicPath);\n failures.push(new Error('Invocation-owned file identity could not be confirmed.'));\n return;\n }\n } catch (error: unknown) {\n if (isEnoent(error)) {\n this.port.journal.markOwnedFileAbsent(item, owned.path);\n return;\n }\n paths.add(owned.publicPath);\n failures.push(error);\n return;\n }\n try {\n await this.port.unlink(owned.path);\n } catch (error: unknown) {\n if (!isEnoent(error)) failures.push(error);\n }\n try {\n await this.port.lstat(owned.path);\n paths.add(owned.publicPath);\n } catch (error: unknown) {\n if (isEnoent(error)) this.port.journal.markOwnedFileAbsent(item, owned.path);\n else {\n paths.add(owned.publicPath);\n failures.push(error);\n }\n }\n }\n\n private async removeNamespace(item: CleanupArtifactView, paths: Set<string>, failures: unknown[]): Promise<void> {\n const namespace = item.namespace;\n if (!namespace?.exists) return;\n if (!namespace.identity) {\n paths.add(namespace.publicPath);\n return;\n }\n try {\n const namespaceStat = await this.port.lstat(namespace.path);\n if (\n !sameIdentity(identity(namespaceStat), namespace.identity) ||\n namespaceStat.isSymbolicLink() ||\n !namespaceStat.isDirectory()\n ) {\n paths.add(namespace.publicPath);\n failures.push(new Error('Invocation namespace identity could not be confirmed.'));\n return;\n }\n } catch (error: unknown) {\n if (isEnoent(error)) {\n this.port.journal.markNamespaceAbsent(item);\n return;\n }\n paths.add(namespace.publicPath);\n failures.push(error);\n return;\n }\n try {\n await this.port.rmdir(namespace.path);\n } catch (error: unknown) {\n if (!isDirectoryNotEmpty(error) && !isEnoent(error)) failures.push(error);\n }\n try {\n await this.port.lstat(namespace.path);\n paths.add(namespace.publicPath);\n } catch (error: unknown) {\n if (isEnoent(error)) this.port.journal.markNamespaceAbsent(item);\n else {\n paths.add(namespace.publicPath);\n failures.push(error);\n }\n }\n }\n\n private async removeCreatedDirectories(paths: Set<string>, failures: unknown[]): Promise<void> {\n const directories = [...this.port.journal.createdDirectories()].sort(\n (left, right) => pathDepth(right.path) - pathDepth(left.path) || compareCodeUnits(right.path, left.path),\n );\n for (const directory of directories) {\n if (!directory.exists) continue;\n if (\n this.kind === 'committed' &&\n this.port.journal\n .artifacts()\n .some(\n item =>\n item.artifact.proposed.status === 'present' &&\n item.directories.some(expectation => expectation.path === directory.path),\n )\n ) {\n continue;\n }\n if (!directory.identity) {\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n continue;\n }\n let before: MigrationTransactionStat;\n try {\n before = await this.port.lstat(directory.path);\n } catch (error: unknown) {\n if (isEnoent(error)) {\n this.port.journal.markCreatedDirectoryAbsent(directory.path);\n continue;\n }\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n failures.push(error);\n continue;\n }\n if (!sameIdentity(identity(before), directory.identity) || before.isSymbolicLink() || !before.isDirectory()) {\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n continue;\n }\n let removalFailure: unknown;\n try {\n await this.port.rmdir(directory.path);\n } catch (error: unknown) {\n removalFailure = error;\n }\n let after: MigrationTransactionStat | 'absent';\n try {\n after = await this.port.lstatOrAbsent(directory.path);\n } catch (error: unknown) {\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n if (removalFailure !== undefined && !isEnoent(removalFailure)) failures.push(removalFailure);\n failures.push(error);\n continue;\n }\n if (after === 'absent') {\n this.port.journal.markCreatedDirectoryAbsent(directory.path);\n if (removalFailure !== undefined && !isEnoent(removalFailure)) failures.push(removalFailure);\n continue;\n }\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n if (removalFailure !== undefined && !isEnoent(removalFailure)) failures.push(removalFailure);\n }\n }\n\n private async collectUnconfirmedPaths(paths: Set<string>, failures: unknown[]): Promise<void> {\n for (const { path: candidate, publicPaths } of this.port.journal.unconfirmedEntries()) {\n try {\n await this.port.lstat(candidate);\n } catch (error: unknown) {\n if (isEnoent(error)) continue;\n failures.push(error);\n }\n for (const publicPath of publicPaths) paths.add(publicPath);\n }\n }\n\n private async verifyOriginal(item: CleanupArtifactView, failures: unknown[]): Promise<boolean> {\n try {\n return this.isConfirmedOriginal(item, await this.port.observePublic(item));\n } catch (error: unknown) {\n failures.push(error);\n return false;\n }\n }\n\n private isConfirmedOriginal(item: CleanupArtifactView, observed: ObservedState): boolean {\n if (!sameArtifactState(observed, item.artifact.original)) return false;\n if (observed.status === 'absent') return true;\n return [item.originalIdentity, item.restoredIdentity].some(\n expected => expected !== undefined && sameIdentity(observed.identity, expected),\n );\n }\n}\n\nfunction recoveryResult(outcome: RecoveryOutcome): readonly string[] {\n if (outcome.failures.length > 0) throw new RecoveryUnitError(outcome.paths, outcome.failures);\n return outcome.paths;\n}\n","import { randomUUID } from 'node:crypto';\nimport { join } from 'node:path';\nimport type { StagedArtifact } from './staging.unit';\nimport type { CommitArtifactView, CommitPort, OwnedFileView } from './transaction-unit.ports';\nimport {\n identity,\n required,\n sameArtifactState,\n sameIdentity,\n type ObservedPresentState,\n} from './transaction-unit.state';\n\nexport interface CommittedArtifact extends StagedArtifact {\n readonly committed: true;\n}\n\nexport interface CommitUnit {\n commit(staged: readonly StagedArtifact[], signal: AbortSignal): Promise<readonly CommittedArtifact[]>;\n}\n\nexport class CommitUnitError extends Error {\n constructor(\n cause: unknown,\n readonly staged: readonly StagedArtifact[],\n readonly committed: readonly CommittedArtifact[],\n ) {\n super(cause instanceof Error ? cause.message : 'Migration transaction commit failed.', { cause });\n this.name = 'CommitUnitError';\n this.staged = Object.freeze([...staged]);\n this.committed = Object.freeze([...committed]);\n }\n}\n\nexport class FileSystemCommitUnit implements CommitUnit {\n constructor(private readonly port: CommitPort) {}\n\n public async commit(staged: readonly StagedArtifact[], signal: AbortSignal): Promise<readonly CommittedArtifact[]> {\n const committed: CommittedArtifact[] = [];\n let items: readonly CommitArtifactView[];\n try {\n items = staged.map(entry => this.port.journal.artifact(entry.artifact));\n } catch (error: unknown) {\n throw new CommitUnitError(error, staged, committed);\n }\n for (const item of items) {\n try {\n this.port.assertNotInterrupted(signal);\n if (item.artifact.original.status === 'present') await this.captureOriginal(item, signal);\n this.port.assertNotInterrupted(signal);\n if (item.artifact.proposed.status === 'present') await this.installProposed(item);\n committed.push(committedArtifact(this.port.journal.artifact(item.artifact)));\n } catch (error: unknown) {\n const current = this.port.journal.artifact(item.artifact);\n if (transitionStarted(current) && !committed.some(candidate => candidate.artifact === item.artifact)) {\n committed.push(committedArtifact(current));\n }\n throw new CommitUnitError(error, currentStagedArtifacts(this.port.journal.artifacts()), committed);\n }\n }\n return Object.freeze(committed);\n }\n\n private async captureOriginal(item: CommitArtifactView, signal: AbortSignal): Promise<void> {\n const firstCapture = await this.port.observePublic(item);\n if (\n !sameArtifactState(firstCapture, item.artifact.original) ||\n firstCapture.status !== 'present' ||\n !item.originalIdentity ||\n !sameIdentity(firstCapture.identity, item.originalIdentity)\n ) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n const backup = await this.port.createBackupFile(item, firstCapture.contents, signal, firstCapture.mode);\n if ((await this.port.readOwnedFile(item, backup.path)) !== firstCapture.contents) {\n throw this.port.ownershipFailure(item.artifact.path);\n }\n const secondCapture = await this.port.observePublic(item);\n if (\n secondCapture.status !== 'present' ||\n !sameIdentity(secondCapture.identity, firstCapture.identity) ||\n secondCapture.contents !== firstCapture.contents\n ) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n await this.quarantineOriginal(item, firstCapture);\n }\n\n private async quarantineOriginal(item: CommitArtifactView, captured: ObservedPresentState): Promise<void> {\n await this.port.assertParentChain(item);\n await this.port.assertNamespace(item);\n const immediatelyBefore = await this.port.observePublic(item);\n if (\n immediatelyBefore.status !== 'present' ||\n !sameIdentity(immediatelyBefore.identity, captured.identity) ||\n immediatelyBefore.contents !== captured.contents\n ) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n let quarantine = this.port.journal.addQuarantine(\n item,\n join(required(item.namespace).path, `quarantine-${randomUUID()}`),\n );\n await this.port.assertExpectedAbsent(quarantine.path, item.artifact.path);\n let renameFailure: unknown;\n try {\n await this.port.rename(item.artifact.path, quarantine.path);\n } catch (error: unknown) {\n renameFailure = error;\n }\n const quarantinedStat = await this.port.lstatOrAbsent(quarantine.path);\n if (quarantinedStat !== 'absent') {\n quarantine = this.port.journal.confirmOwnedFile(item, quarantine.path, identity(quarantinedStat));\n const quarantinedContents = await this.port.readOwnedFile(item, quarantine.path);\n if (\n !sameIdentity(required(quarantine.identity), captured.identity) ||\n quarantinedContents !== captured.contents\n ) {\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, true);\n await this.restorePreservedQuarantine(item, quarantine);\n throw this.port.concurrentModification(item.artifact.path, renameFailure);\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (renameFailure !== undefined) throw renameFailure;\n if (destination !== 'absent') throw this.port.concurrentModification(item.artifact.path);\n await this.port.assertParentChain(item);\n return;\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (\n renameFailure !== undefined &&\n destination !== 'absent' &&\n sameIdentity(identity(destination), captured.identity)\n ) {\n throw renameFailure;\n }\n throw this.port.concurrentModification(item.artifact.path, renameFailure);\n }\n\n private async installProposed(item: CommitArtifactView): Promise<void> {\n const stage = required(item.stage);\n await this.port.assertOwnedIdentity(item, stage.path);\n await this.port.assertParentChain(item);\n await this.port.assertExpectedAbsent(item.artifact.path, item.artifact.path);\n let linkFailure: unknown;\n try {\n await this.port.link(stage.path, item.artifact.path);\n } catch (error: unknown) {\n linkFailure = error;\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (destination !== 'absent' && stage.identity && sameIdentity(identity(destination), stage.identity)) {\n this.port.journal.recordInstalledIdentity(item, stage.identity);\n await this.port.assertParentChain(item);\n if (linkFailure !== undefined) throw linkFailure;\n return;\n }\n if (destination !== 'absent') throw this.port.concurrentModification(item.artifact.path, linkFailure);\n if (linkFailure !== undefined) throw linkFailure;\n throw this.port.ownershipFailure(item.artifact.path);\n }\n\n private async restorePreservedQuarantine(item: CommitArtifactView, quarantine: OwnedFileView): Promise<void> {\n const quarantineIdentity = required(quarantine.identity);\n if ((await this.port.lstatOrAbsent(item.artifact.path)) !== 'absent') return;\n try {\n await this.port.link(quarantine.path, item.artifact.path);\n } catch (error: unknown) {\n this.port.journal.recordRecoveryFailure(error);\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (destination !== 'absent' && sameIdentity(identity(destination), quarantineIdentity)) {\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, false);\n }\n }\n}\n\nfunction committedArtifact(item: CommitArtifactView): CommittedArtifact {\n return Object.freeze({\n artifact: item.artifact,\n committed: true,\n ...(item.stage === undefined ? {} : { stagingPath: item.stage.path }),\n ...(item.backup === undefined ? {} : { backupPath: item.backup.path }),\n });\n}\n\nfunction transitionStarted(item: CommitArtifactView): boolean {\n return item.installedIdentity !== undefined || item.quarantines.some(quarantine => quarantine.exists);\n}\n\nfunction currentStagedArtifacts(items: readonly CommitArtifactView[]): readonly StagedArtifact[] {\n return Object.freeze(\n items.map(item =>\n Object.freeze({\n artifact: item.artifact,\n ...(item.stage === undefined ? {} : { stagingPath: item.stage.path }),\n ...(item.backup === undefined ? {} : { backupPath: item.backup.path }),\n }),\n ),\n );\n}\n","import { randomUUID } from 'node:crypto';\nimport { join } from 'node:path';\nimport type { CommittedArtifact } from './commit.unit';\nimport type { OwnedFileView, RollbackArtifactView, RollbackPort } from './transaction-unit.ports';\nimport {\n RecoveryUnitError,\n identity,\n recoveryOutcome,\n recoveryUnitError,\n required,\n sameArtifactState,\n sameIdentity,\n type ObservedPresentState,\n type ObservedState,\n type RecoveryOutcome,\n} from './transaction-unit.state';\n\nexport interface RollbackUnit {\n rollback(committed: readonly CommittedArtifact[]): Promise<readonly string[]>;\n}\n\nexport class FileSystemRollbackUnit implements RollbackUnit {\n constructor(private readonly port: RollbackPort) {}\n\n public async rollback(committed: readonly CommittedArtifact[]): Promise<readonly string[]> {\n let items: readonly RollbackArtifactView[];\n try {\n items = committed.map(entry => this.port.journal.artifact(entry.artifact));\n } catch (error: unknown) {\n throw recoveryUnitError(error);\n }\n const failures = [...this.port.journal.recoveryFailures()];\n for (const item of items) await this.restoreOriginal(item, failures);\n const paths = new Set<string>();\n for (const item of this.port.journal.artifacts()) {\n const restored = await this.verifyOriginal(item, failures);\n this.port.journal.recordRestored(item, restored);\n if (!restored) paths.add(item.artifact.path);\n }\n return recoveryResult(recoveryOutcome(paths, failures));\n }\n\n private async restoreOriginal(item: RollbackArtifactView, failures: unknown[]): Promise<void> {\n let current: ObservedState | 'unknown';\n try {\n current = await this.port.observePublic(item);\n } catch (error: unknown) {\n failures.push(error);\n current = 'unknown';\n }\n if (current !== 'unknown' && this.isConfirmedOriginal(item, current)) return;\n if (current !== 'unknown' && current.status === 'present') {\n if (\n !item.installedIdentity ||\n !sameIdentity(current.identity, item.installedIdentity) ||\n item.artifact.proposed.status !== 'present' ||\n current.contents !== item.artifact.proposed.contents\n ) {\n if (item.stage && item.installedIdentity && sameIdentity(current.identity, item.installedIdentity)) {\n this.port.journal.setOwnedFilePreserved(item, item.stage.path, true);\n }\n return;\n }\n if (!(await this.recoveryQuarantine(item, current, failures))) return;\n } else if (current === 'unknown') {\n return;\n }\n if (item.artifact.original.status === 'absent') return;\n const backup = item.backup;\n if (!backup) return;\n try {\n if ((await this.port.readOwnedFile(item, backup.path)) !== item.artifact.original.contents) return;\n await this.port.assertParentChain(item);\n await this.port.assertExpectedAbsent(item.artifact.path, item.artifact.path);\n try {\n await this.port.link(backup.path, item.artifact.path);\n } catch (error: unknown) {\n failures.push(error);\n }\n const restored = await this.port.lstatOrAbsent(item.artifact.path);\n if (\n restored !== 'absent' &&\n !restored.isSymbolicLink() &&\n restored.isFile() &&\n backup.identity &&\n sameIdentity(identity(restored), backup.identity)\n ) {\n this.port.journal.recordRestoredIdentity(item, backup.identity);\n }\n } catch (error: unknown) {\n failures.push(error);\n }\n }\n\n private async recoveryQuarantine(\n item: RollbackArtifactView,\n current: ObservedPresentState,\n failures: unknown[],\n ): Promise<boolean> {\n let quarantine = this.port.journal.addQuarantine(\n item,\n join(required(item.namespace).path, `quarantine-rollback-${randomUUID()}`),\n );\n try {\n await this.port.assertParentChain(item);\n await this.port.assertNamespace(item);\n const before = await this.port.observePublic(item);\n if (\n before.status !== 'present' ||\n !sameIdentity(before.identity, current.identity) ||\n before.contents !== current.contents\n ) {\n return false;\n }\n await this.port.assertExpectedAbsent(quarantine.path, item.artifact.path);\n try {\n await this.port.rename(item.artifact.path, quarantine.path);\n } catch (error: unknown) {\n failures.push(error);\n }\n const quarantined = await this.port.lstatOrAbsent(quarantine.path);\n if (quarantined === 'absent') return false;\n quarantine = this.port.journal.confirmOwnedFile(item, quarantine.path, identity(quarantined));\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, true);\n if (!sameIdentity(required(quarantine.identity), current.identity)) {\n await this.restorePreservedQuarantine(item, quarantine, failures);\n return false;\n }\n if ((await this.port.readOwnedFile(item, quarantine.path)) !== current.contents) {\n await this.restorePreservedQuarantine(item, quarantine, failures);\n return false;\n }\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, false);\n return (await this.port.lstatOrAbsent(item.artifact.path)) === 'absent';\n } catch (error: unknown) {\n failures.push(error);\n return false;\n }\n }\n\n private async restorePreservedQuarantine(\n item: RollbackArtifactView,\n quarantine: OwnedFileView,\n failures: unknown[],\n ): Promise<void> {\n const quarantineIdentity = required(quarantine.identity);\n if ((await this.port.lstatOrAbsent(item.artifact.path)) !== 'absent') return;\n try {\n await this.port.link(quarantine.path, item.artifact.path);\n } catch (error: unknown) {\n failures.push(error);\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (destination !== 'absent' && sameIdentity(identity(destination), quarantineIdentity)) {\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, false);\n }\n }\n\n private async verifyOriginal(item: RollbackArtifactView, failures: unknown[]): Promise<boolean> {\n try {\n return this.isConfirmedOriginal(item, await this.port.observePublic(item));\n } catch (error: unknown) {\n failures.push(error);\n return false;\n }\n }\n\n private isConfirmedOriginal(item: RollbackArtifactView, observed: ObservedState): boolean {\n if (!sameArtifactState(observed, item.artifact.original)) return false;\n if (observed.status === 'absent') return true;\n return [item.originalIdentity, item.restoredIdentity].some(\n expected => expected !== undefined && sameIdentity(observed.identity, expected),\n );\n }\n}\n\nfunction recoveryResult(outcome: RecoveryOutcome): readonly string[] {\n if (outcome.failures.length > 0) throw new RecoveryUnitError(outcome.paths, outcome.failures);\n return outcome.paths;\n}\n","import { randomUUID } from 'node:crypto';\nimport { basename, dirname, join } from 'node:path';\nimport type { PlannedOutputArtifact } from '../migrator/migration-plan';\nimport type { StagingArtifactView, StagingPort } from './transaction-unit.ports';\nimport { identity, required } from './transaction-unit.state';\n\nexport interface StagedArtifact {\n readonly artifact: PlannedOutputArtifact;\n readonly stagingPath?: string;\n readonly backupPath?: string;\n}\n\nexport interface StagingUnit {\n stage(artifacts: readonly PlannedOutputArtifact[], signal: AbortSignal): Promise<readonly StagedArtifact[]>;\n}\n\nexport class StagingUnitError extends Error {\n constructor(\n cause: unknown,\n readonly staged: readonly StagedArtifact[],\n ) {\n super(cause instanceof Error ? cause.message : 'Migration transaction staging failed.', { cause });\n this.name = 'StagingUnitError';\n this.staged = Object.freeze([...staged]);\n }\n}\n\nexport class FileSystemStagingUnit implements StagingUnit {\n constructor(private readonly port: StagingPort) {}\n\n public async stage(\n artifacts: readonly PlannedOutputArtifact[],\n signal: AbortSignal,\n ): Promise<readonly StagedArtifact[]> {\n try {\n await this.port.journal.prepare(artifacts);\n const items = this.port.journal.artifacts();\n for (const item of items) await this.ensureParentDirectories(item, signal);\n for (const item of items) await this.createNamespace(item);\n for (const item of items) {\n if (item.artifact.proposed.status === 'absent') continue;\n this.port.assertNotInterrupted(signal);\n const stage = await this.port.createStageFile(item, item.artifact.proposed.contents, signal, item.originalMode);\n const staged = await this.port.readOwnedFile(item, stage.path);\n if (item.artifact.kind === 'template') this.port.validateStagedTemplate(item.artifact.path, staged);\n }\n return stagedArtifacts(this.port.journal.artifacts());\n } catch (error: unknown) {\n throw new StagingUnitError(error, stagedArtifacts(this.port.journal.artifacts()));\n }\n }\n\n private async ensureParentDirectories(item: StagingArtifactView, signal: AbortSignal): Promise<void> {\n for (let index = 0; index < item.directories.length; index++) {\n this.port.assertNotInterrupted(signal);\n const expectation = item.directories[index];\n if (!expectation) continue;\n if (expectation.original !== 'absent') {\n await this.port.assertDirectoryExpectation(expectation.path, expectation.original, item.artifact.path);\n continue;\n }\n const existingCreation = this.port.journal.createdDirectory(expectation.path);\n if (existingCreation) {\n this.port.journal.addCreatedDirectoryPublicPath(expectation.path, item.artifact.path);\n await this.port.assertDirectoryIdentity(\n expectation.path,\n required(existingCreation.identity),\n item.artifact.path,\n );\n continue;\n }\n await this.port.assertExpectedAbsent(expectation.path, item.artifact.path);\n const parentExpectation = item.directories[index - 1];\n if (parentExpectation) await this.port.assertExpectedDirectory(parentExpectation, item);\n try {\n await this.port.mkdir(expectation.path, { mode: 0o755 });\n } catch (error: unknown) {\n this.port.journal.recordUnconfirmedEntry(expectation.path, item.artifact.path);\n throw error;\n }\n this.port.journal.recordCreatedDirectory(expectation.path, item.artifact.path);\n const createdStat = await this.port.lstat(expectation.path);\n if (createdStat.isSymbolicLink() || !createdStat.isDirectory()) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n this.port.journal.confirmCreatedDirectory(expectation.path, identity(createdStat));\n if (parentExpectation) await this.port.assertExpectedDirectory(parentExpectation, item);\n }\n await this.port.assertParentChain(item);\n }\n\n private async createNamespace(item: StagingArtifactView): Promise<void> {\n await this.port.assertParentChain(item);\n const namespacePath = join(dirname(item.artifact.path), `.${basename(item.artifact.path)}.${randomUUID()}.txn`);\n await this.port.assertExpectedAbsent(namespacePath, item.artifact.path);\n try {\n await this.port.mkdir(namespacePath, { mode: 0o700 });\n } catch (error: unknown) {\n this.port.journal.recordUnconfirmedEntry(namespacePath, item.artifact.path);\n throw error;\n }\n this.port.journal.recordNamespace(item, namespacePath);\n const namespaceStat = await this.port.lstat(namespacePath);\n if (namespaceStat.isSymbolicLink() || !namespaceStat.isDirectory()) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n this.port.journal.confirmNamespace(item, identity(namespaceStat));\n await this.port.assertParentChain(item);\n }\n}\n\nfunction stagedArtifacts(items: readonly StagingArtifactView[]): readonly StagedArtifact[] {\n return Object.freeze(items.map(item => stagedArtifact(item)));\n}\n\nfunction stagedArtifact(item: StagingArtifactView): StagedArtifact {\n return Object.freeze({\n artifact: item.artifact,\n ...(item.stagingPath === undefined ? {} : { stagingPath: item.stagingPath }),\n });\n}\n","export type TransactionInterruptionHandler = (signal: NodeJS.Signals) => void;\n\nexport interface TransactionSignalTarget {\n on(signal: NodeJS.Signals, listener: TransactionInterruptionHandler): void;\n off(signal: NodeJS.Signals, listener: TransactionInterruptionHandler): void;\n}\n\nexport interface TransactionSignalRegistrarLike {\n register(handler: TransactionInterruptionHandler): () => void;\n}\n\nconst transactionSignals: readonly NodeJS.Signals[] = ['SIGINT', 'SIGTERM'];\n\nexport class TransactionSignalRegistrar implements TransactionSignalRegistrarLike {\n constructor(private readonly target: TransactionSignalTarget = process) {}\n\n register(handler: TransactionInterruptionHandler): () => void {\n for (const signal of transactionSignals) this.target.on(signal, handler);\n\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n for (const signal of transactionSignals) this.target.off(signal, handler);\n };\n }\n}\n","import { constants } from 'node:fs';\nimport { access, link, lstat, mkdir, open, rename, rmdir, stat, unlink } from 'node:fs/promises';\nimport { dirname, join, resolve } from 'node:path';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { PlannedOutputArtifact } from '../migrator/migration-plan';\nimport { AngularTemplateParser } from '../template/angular-template.parser';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport type {\n CleanupArtifactView,\n CleanupJournal,\n CleanupPort,\n CommitArtifactView,\n CommitJournal,\n CommitPort,\n CreatedDirectoryView,\n OwnedFileView,\n RollbackArtifactView,\n RollbackJournal,\n RollbackPort,\n StagingArtifactView,\n StagingJournal,\n StagingPort,\n UnconfirmedEntryView,\n} from './transaction-unit.ports';\nimport {\n fileMode,\n identity,\n isEnoent,\n required,\n runtimeArtifact,\n sameArtifactState,\n sameIdentity,\n type CreatedDirectory,\n type DirectoryExpectation,\n type FileIdentity,\n type MigrationTransactionFileHandle,\n type MigrationTransactionOperations,\n type MigrationTransactionStat,\n type ObservedState,\n type OwnedFile,\n type OwnedNamespace,\n type RuntimeArtifact,\n type TransactionUnitContext,\n} from './transaction-unit.state';\n\nexport {\n RecoveryUnitError,\n fileMode,\n identity,\n isDirectoryNotEmpty,\n isEnoent,\n pathDepth,\n recoveryOutcome,\n recoveryUnitError,\n required,\n runtimeArtifact,\n sameArtifactState,\n sameIdentity,\n sortedUnique,\n} from './transaction-unit.state';\nexport type {\n CreatedDirectory,\n DirectoryExpectation,\n FileIdentity,\n MigrationTransactionFileHandle,\n MigrationTransactionOperations,\n MigrationTransactionStat,\n ObservedPresentState,\n ObservedState,\n OwnedFile,\n OwnedNamespace,\n RecoveryOutcome,\n RuntimeArtifact,\n TransactionUnitContext,\n} from './transaction-unit.state';\n\nexport const nodeTransactionOperations: MigrationTransactionOperations = {\n access,\n link,\n lstat,\n mkdir,\n open: (target, flags) => open(target, flags),\n rename,\n rmdir,\n stat,\n unlink,\n};\n\nexport class TransactionUnitSession {\n private readonly context: TransactionUnitContext;\n\n constructor(\n private readonly operations: MigrationTransactionOperations = nodeTransactionOperations,\n private readonly parser: AngularTemplateParser = new AngularTemplateParser(),\n ownershipChanged: () => void = () => undefined,\n ) {\n this.context = {\n items: [],\n createdDirectories: new Map(),\n unconfirmedEntries: new Map(),\n recoveryFailures: [],\n restored: new Map(),\n ownershipChanged,\n };\n }\n\n public stagingPort(): StagingPort {\n const journal: StagingJournal = Object.freeze({\n prepare: (artifacts: readonly PlannedOutputArtifact[]) => this.prepare(artifacts),\n artifacts: () => Object.freeze(this.context.items.map(stagingArtifactView)),\n createdDirectory: (path: string) => createdDirectoryView(this.context.createdDirectories.get(path)),\n addCreatedDirectoryPublicPath: (path: string, publicPath: string) =>\n required(this.context.createdDirectories.get(path)).publicPaths.add(publicPath),\n recordUnconfirmedEntry: (path: string, publicPath: string) => this.recordUnconfirmedEntry(path, publicPath),\n recordCreatedDirectory: (path: string, publicPath: string) => this.recordCreatedDirectory(path, publicPath),\n confirmCreatedDirectory: (path: string, expected: FileIdentity) => {\n required(this.context.createdDirectories.get(path)).identity = expected;\n },\n recordNamespace: (item: StagingArtifactView, path: string) => this.recordNamespace(item.artifact, path),\n confirmNamespace: (item: StagingArtifactView, expected: FileIdentity) => {\n required(this.runtimeArtifact(item.artifact).namespace).identity = expected;\n },\n });\n return Object.freeze({\n journal,\n assertDirectoryExpectation: (\n path: string,\n expected: Exclude<DirectoryExpectation['original'], 'absent'>,\n publicPath: string,\n ) => this.assertDirectoryExpectation(path, expected, publicPath),\n assertDirectoryIdentity: (path: string, expected: FileIdentity, publicPath: string) =>\n this.assertDirectoryIdentity(path, expected, publicPath),\n assertExpectedAbsent: (path: string, publicPath: string) => this.assertExpectedAbsent(path, publicPath),\n assertExpectedDirectory: (expectation: DirectoryExpectation, item: StagingArtifactView) =>\n this.assertExpectedDirectory(expectation, this.runtimeArtifact(item.artifact), this.context),\n assertNotInterrupted: (signal: AbortSignal) => this.assertNotInterrupted(signal),\n assertParentChain: (item: StagingArtifactView) =>\n this.assertParentChain(this.runtimeArtifact(item.artifact), this.context),\n concurrentModification: (publicPath: string, cause?: unknown) => this.concurrentModification(publicPath, cause),\n createStageFile: (item: StagingArtifactView, contents: string, signal: AbortSignal, mode?: number) =>\n this.createStageFile(this.runtimeArtifact(item.artifact), contents, signal, mode),\n lstat: (path: string) => this.operations.lstat(path),\n mkdir: (path: string, options?: { readonly recursive?: boolean; readonly mode?: number }) =>\n this.operations.mkdir(path, options),\n readOwnedFile: (item: StagingArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.readOwnedFile(runtime, this.ownedFile(runtime, ownedPath));\n },\n validateStagedTemplate: (publicPath: string, contents: string) =>\n this.validateStagedTemplate(publicPath, contents),\n });\n }\n\n public commitPort(): CommitPort {\n const journal: CommitJournal = Object.freeze({\n artifact: (artifact: PlannedOutputArtifact) => commitArtifactView(this.runtimeArtifact(artifact)),\n artifacts: () => Object.freeze(this.context.items.map(commitArtifactView)),\n addQuarantine: (item: CommitArtifactView, path: string) =>\n ownedFileView(this.addQuarantine(this.runtimeArtifact(item.artifact), path)),\n confirmOwnedFile: (item: CommitArtifactView, ownedPath: string, expected: FileIdentity) =>\n ownedFileView(this.confirmOwnedFile(this.runtimeArtifact(item.artifact), ownedPath, expected)),\n setOwnedFilePreserved: (item: CommitArtifactView, ownedPath: string, preserve: boolean) => {\n this.ownedFile(this.runtimeArtifact(item.artifact), ownedPath).preserve = preserve;\n },\n recordInstalledIdentity: (item: CommitArtifactView, expected: FileIdentity) => {\n this.runtimeArtifact(item.artifact).installedIdentity = expected;\n },\n recordRecoveryFailure: (error: unknown) => this.context.recoveryFailures.push(error),\n });\n return Object.freeze({\n journal,\n assertExpectedAbsent: (path: string, publicPath: string) => this.assertExpectedAbsent(path, publicPath),\n assertNamespace: (item: CommitArtifactView) => this.assertNamespace(this.runtimeArtifact(item.artifact)),\n assertNotInterrupted: (signal: AbortSignal) => this.assertNotInterrupted(signal),\n assertOwnedIdentity: (item: CommitArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.assertOwnedIdentity(runtime, this.ownedFile(runtime, ownedPath));\n },\n assertParentChain: (item: CommitArtifactView) =>\n this.assertParentChain(this.runtimeArtifact(item.artifact), this.context),\n concurrentModification: (publicPath: string, cause?: unknown) => this.concurrentModification(publicPath, cause),\n createBackupFile: (item: CommitArtifactView, contents: string, signal: AbortSignal, mode?: number) =>\n this.createBackupFile(this.runtimeArtifact(item.artifact), contents, signal, mode),\n link: (existingPath: string, newPath: string) => this.operations.link(existingPath, newPath),\n lstatOrAbsent: (path: string) => this.lstatOrAbsent(path),\n observePublic: (item: CommitArtifactView) =>\n this.observePublic(this.runtimeArtifact(item.artifact), this.context),\n ownershipFailure: (publicPath: string) => this.ownershipFailure(publicPath),\n readOwnedFile: (item: CommitArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.readOwnedFile(runtime, this.ownedFile(runtime, ownedPath));\n },\n rename: (source: string, destination: string) => this.operations.rename(source, destination),\n });\n }\n\n public rollbackPort(): RollbackPort {\n const journal: RollbackJournal = Object.freeze({\n artifact: (artifact: PlannedOutputArtifact) => rollbackArtifactView(this.runtimeArtifact(artifact)),\n artifacts: () => Object.freeze(this.context.items.map(rollbackArtifactView)),\n recoveryFailures: () => Object.freeze([...this.context.recoveryFailures]),\n addQuarantine: (item: RollbackArtifactView, path: string) =>\n ownedFileView(this.addQuarantine(this.runtimeArtifact(item.artifact), path)),\n confirmOwnedFile: (item: RollbackArtifactView, ownedPath: string, expected: FileIdentity) =>\n ownedFileView(this.confirmOwnedFile(this.runtimeArtifact(item.artifact), ownedPath, expected)),\n setOwnedFilePreserved: (item: RollbackArtifactView, ownedPath: string, preserve: boolean) => {\n this.ownedFile(this.runtimeArtifact(item.artifact), ownedPath).preserve = preserve;\n },\n recordRestoredIdentity: (item: RollbackArtifactView, expected: FileIdentity) => {\n this.runtimeArtifact(item.artifact).restoredIdentity = expected;\n },\n recordRestored: (item: RollbackArtifactView, restored: boolean) => {\n this.context.restored.set(this.runtimeArtifact(item.artifact), restored);\n },\n });\n return Object.freeze({\n journal,\n assertExpectedAbsent: (path: string, publicPath: string) => this.assertExpectedAbsent(path, publicPath),\n assertNamespace: (item: RollbackArtifactView) => this.assertNamespace(this.runtimeArtifact(item.artifact)),\n assertParentChain: (item: RollbackArtifactView) =>\n this.assertParentChain(this.runtimeArtifact(item.artifact), this.context),\n link: (existingPath: string, newPath: string) => this.operations.link(existingPath, newPath),\n lstatOrAbsent: (path: string) => this.lstatOrAbsent(path),\n observePublic: (item: RollbackArtifactView) =>\n this.observePublic(this.runtimeArtifact(item.artifact), this.context),\n readOwnedFile: (item: RollbackArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.readOwnedFile(runtime, this.ownedFile(runtime, ownedPath));\n },\n rename: (source: string, destination: string) => this.operations.rename(source, destination),\n });\n }\n\n public cleanupPort(): CleanupPort {\n const journal: CleanupJournal = Object.freeze({\n artifact: (artifact: PlannedOutputArtifact) => cleanupArtifactView(this.runtimeArtifact(artifact)),\n artifacts: () => Object.freeze(this.context.items.map(cleanupArtifactView)),\n createdDirectories: () =>\n Object.freeze([...this.context.createdDirectories.values()].map(directory => createdDirectoryView(directory)!)),\n unconfirmedEntries: () => this.unconfirmedEntryViews(),\n restored: (item: CleanupArtifactView) => this.context.restored.get(this.runtimeArtifact(item.artifact)),\n markOwnedFileAbsent: (item: CleanupArtifactView, ownedPath: string) => {\n this.ownedFile(this.runtimeArtifact(item.artifact), ownedPath).exists = false;\n },\n markNamespaceAbsent: (item: CleanupArtifactView) => {\n required(this.runtimeArtifact(item.artifact).namespace).exists = false;\n },\n markCreatedDirectoryAbsent: (path: string) => {\n required(this.context.createdDirectories.get(path)).exists = false;\n this.context.ownershipChanged();\n },\n finishArtifactCleanup: () => this.context.ownershipChanged(),\n });\n return Object.freeze({\n journal,\n assertNamespace: (item: CleanupArtifactView) => this.assertNamespace(this.runtimeArtifact(item.artifact)),\n closeReadHandles: (item: CleanupArtifactView, failures: unknown[]) =>\n this.closeReadHandles(this.runtimeArtifact(item.artifact), failures),\n closeOpenHandle: (item: CleanupArtifactView, failures: unknown[]) =>\n this.closeOpenHandle(this.runtimeArtifact(item.artifact), failures),\n lstat: (path: string) => this.operations.lstat(path),\n lstatOrAbsent: (path: string) => this.lstatOrAbsent(path),\n observePublic: (item: CleanupArtifactView) =>\n this.observePublic(this.runtimeArtifact(item.artifact), this.context),\n rmdir: (path: string) => this.operations.rmdir(path),\n unlink: (path: string) => this.operations.unlink(path),\n });\n }\n\n public async prepareForPreflight(artifacts: readonly PlannedOutputArtifact[]): Promise<void> {\n await this.prepare(artifacts);\n }\n\n public hasOwnedArtifacts(): boolean {\n return (\n [...this.context.createdDirectories.values()].some(directory => directory.exists) ||\n this.context.items.some(\n item =>\n item.namespace?.exists ||\n item.stage?.exists ||\n item.backup?.exists ||\n item.quarantines.some(quarantine => quarantine.exists),\n )\n );\n }\n\n private async prepare(artifacts: readonly PlannedOutputArtifact[]): Promise<void> {\n const ordered = [...artifacts].sort((left, right) => compareCodeUnits(resolve(left.path), resolve(right.path)));\n for (let index = 1; index < ordered.length; index++) {\n const previous = ordered[index - 1];\n const current = ordered[index];\n if (!previous || !current || previous.path !== current.path) continue;\n throw new MigrationApplicationError('path-collision', `Migration paths collide: ${current.path}`, [current.path]);\n }\n\n for (const artifact of ordered) {\n let item: RuntimeArtifact | undefined;\n try {\n const directories = await this.inspectDirectoryChain(dirname(artifact.path), artifact.path);\n item = { artifact, directories, quarantines: [], ownedFiles: [], readHandles: new Set() };\n const current = await this.observePublic(item);\n if (!sameArtifactState(current, artifact.original)) throw this.concurrentModification(artifact.path);\n if (current.status === 'present') {\n item.originalIdentity = current.identity;\n item.originalMode = current.mode;\n }\n this.context.items.push(item);\n } catch (error: unknown) {\n const closeFailures: unknown[] = [];\n if (item) await this.closeReadHandles(item, closeFailures);\n const failure = this.attachRecoveryFailures(artifact.path, error, closeFailures);\n if (failure instanceof MigrationApplicationError) throw failure;\n throw new MigrationApplicationError(\n 'transaction-io',\n `Could not verify migration destination: ${artifact.path}`,\n [artifact.path],\n { cause: failure },\n );\n }\n }\n }\n\n private async inspectDirectoryChain(parent: string, publicPath: string): Promise<readonly DirectoryExpectation[]> {\n const result: DirectoryExpectation[] = [];\n let missing = false;\n for (const candidate of directoryChain(parent)) {\n if (missing) {\n result.push({ path: candidate, original: 'absent' });\n continue;\n }\n try {\n const candidateStat = await this.operations.lstat(candidate);\n const isImmediateParent = candidate === resolve(parent);\n if (\n (!candidateStat.isSymbolicLink() && !candidateStat.isDirectory()) ||\n (isImmediateParent && candidateStat.isSymbolicLink())\n ) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination parent must be a directory: ${candidate}`,\n [publicPath],\n );\n }\n if (candidateStat.isSymbolicLink()) {\n const followed = await this.operations.stat(candidate);\n if (!followed.isDirectory()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination ancestor must resolve to a directory: ${candidate}`,\n [publicPath],\n );\n }\n result.push({\n path: candidate,\n original: {\n identity: identity(candidateStat),\n kind: 'symbolic-link',\n followedIdentity: identity(followed),\n },\n });\n } else {\n result.push({ path: candidate, original: { identity: identity(candidateStat), kind: 'directory' } });\n }\n } catch (error: unknown) {\n if (!isEnoent(error)) throw error;\n missing = true;\n result.push({ path: candidate, original: 'absent' });\n }\n }\n const nearestExisting = [...result].reverse().find(item => item.original !== 'absent');\n if (nearestExisting) await this.operations.access(nearestExisting.path, constants.W_OK | constants.X_OK);\n return result;\n }\n\n private async createStageFile(\n item: RuntimeArtifact,\n contents: string,\n signal: AbortSignal,\n mode?: number,\n ): Promise<OwnedFileView> {\n await this.assertNamespace(item);\n const namespace = required(item.namespace);\n const owned = this.registerOwnedFile(item, join(namespace.path, 'stage'));\n item.stage = owned;\n await this.writeOwnedFile(item, owned, contents, signal, mode);\n return ownedFileView(owned);\n }\n\n private async createBackupFile(\n item: RuntimeArtifact,\n contents: string,\n signal: AbortSignal,\n mode?: number,\n ): Promise<OwnedFileView> {\n await this.assertNamespace(item);\n const namespace = required(item.namespace);\n const owned = this.registerOwnedFile(item, join(namespace.path, 'backup'));\n item.backup = owned;\n await this.writeOwnedFile(item, owned, contents, signal, mode);\n return ownedFileView(owned);\n }\n\n private registerOwnedFile(item: RuntimeArtifact, path: string): OwnedFile {\n const owned: OwnedFile = {\n path,\n publicPath: item.artifact.path,\n exists: false,\n preserve: false,\n };\n item.ownedFiles.push(owned);\n return owned;\n }\n\n private async writeOwnedFile(\n item: RuntimeArtifact,\n owned: OwnedFile,\n contents: string,\n signal: AbortSignal,\n mode?: number,\n ): Promise<void> {\n await this.assertExpectedAbsent(owned.path, item.artifact.path);\n const handle = await this.operations.open(owned.path, 'wx');\n owned.exists = true;\n item.openHandle = handle;\n this.context.ownershipChanged();\n if (mode !== undefined) await handle.chmod(mode);\n owned.identity = identity(await handle.stat());\n this.assertNotInterrupted(signal);\n await handle.writeFile(contents, 'utf8');\n this.assertNotInterrupted(signal);\n await handle.sync();\n this.assertNotInterrupted(signal);\n await handle.close();\n item.openHandle = undefined;\n this.assertNotInterrupted(signal);\n await this.assertOwnedIdentity(item, owned);\n }\n\n private runtimeArtifact(artifact: PlannedOutputArtifact): RuntimeArtifact {\n return runtimeArtifact(this.context, artifact);\n }\n\n private ownedFile(item: RuntimeArtifact, path: string): OwnedFile {\n const owned = item.ownedFiles.find(candidate => candidate.path === path);\n if (owned !== undefined) return owned;\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Migration transaction journal contains an unknown invocation-owned file: ${path}`,\n [item.artifact.path],\n );\n }\n\n private addQuarantine(item: RuntimeArtifact, path: string): OwnedFile {\n const quarantine = this.registerOwnedFile(item, path);\n item.quarantines.push(quarantine);\n return quarantine;\n }\n\n private confirmOwnedFile(item: RuntimeArtifact, path: string, expected: FileIdentity): OwnedFile {\n const owned = this.ownedFile(item, path);\n owned.exists = true;\n owned.identity = expected;\n return owned;\n }\n\n private recordNamespace(artifact: PlannedOutputArtifact, path: string): void {\n const item = this.runtimeArtifact(artifact);\n item.namespace = { path, publicPath: item.artifact.path, exists: true };\n this.context.ownershipChanged();\n }\n\n private recordCreatedDirectory(path: string, publicPath: string): void {\n this.context.createdDirectories.set(path, {\n path,\n publicPaths: new Set([publicPath]),\n exists: true,\n });\n this.context.ownershipChanged();\n }\n\n private recordUnconfirmedEntry(path: string, publicPath: string): void {\n const publicPaths = this.context.unconfirmedEntries.get(path) ?? new Set<string>();\n publicPaths.add(publicPath);\n this.context.unconfirmedEntries.set(path, publicPaths);\n }\n\n private unconfirmedEntryViews(): readonly UnconfirmedEntryView[] {\n return Object.freeze(\n [...this.context.unconfirmedEntries].map(([path, publicPaths]) =>\n Object.freeze({ path, publicPaths: Object.freeze([...publicPaths]) }),\n ),\n );\n }\n\n private async closeOpenHandle(item: RuntimeArtifact, failures: unknown[]): Promise<void> {\n if (!item.openHandle) return;\n try {\n await item.openHandle.close();\n } catch (error: unknown) {\n failures.push(error);\n }\n item.openHandle = undefined;\n }\n\n private validateStagedTemplate(publicPath: string, contents: string): void {\n if (this.parser.parse(contents, publicPath).status !== 'parse-error') return;\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Staged template failed Angular validation: ${publicPath}`,\n [publicPath],\n );\n }\n\n private async observePublic(item: RuntimeArtifact, context?: TransactionUnitContext): Promise<ObservedState> {\n await this.assertParentChain(item, context);\n const before = await this.lstatOrAbsent(item.artifact.path);\n if (before === 'absent') return { status: 'absent' };\n if (before.isSymbolicLink() || !before.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination must be a regular file: ${item.artifact.path}`,\n [item.artifact.path],\n );\n }\n const beforeIdentity = identity(before);\n const handle = await this.operations.open(item.artifact.path, 'r');\n const contents = await this.readThroughHandle(item, handle, async () => {\n const handleBefore = identity(await handle.stat());\n if (!sameIdentity(beforeIdentity, handleBefore)) throw this.concurrentModification(item.artifact.path);\n const read = await handle.readFile({ encoding: 'utf8' });\n const handleAfter = identity(await handle.stat());\n if (!sameIdentity(handleBefore, handleAfter)) throw this.concurrentModification(item.artifact.path);\n return read;\n });\n const after = await this.lstatOrAbsent(item.artifact.path);\n if (\n after === 'absent' ||\n after.isSymbolicLink() ||\n !after.isFile() ||\n !sameIdentity(beforeIdentity, identity(after))\n ) {\n throw this.concurrentModification(item.artifact.path);\n }\n await this.assertParentChain(item, context);\n return { status: 'present', contents, identity: beforeIdentity, mode: fileMode(before) };\n }\n\n private async readOwnedFile(item: RuntimeArtifact, owned: OwnedFile): Promise<string> {\n await this.assertOwnedIdentity(item, owned);\n const expected = required(owned.identity);\n const handle = await this.operations.open(owned.path, 'r');\n const contents = await this.readThroughHandle(item, handle, async () => {\n const before = identity(await handle.stat());\n if (!sameIdentity(before, expected)) throw this.ownershipFailure(owned.publicPath);\n const read = await handle.readFile({ encoding: 'utf8' });\n const after = identity(await handle.stat());\n if (!sameIdentity(after, expected)) throw this.ownershipFailure(owned.publicPath);\n return read;\n });\n await this.assertOwnedIdentity(item, owned);\n return contents;\n }\n\n private async readThroughHandle<T>(\n item: RuntimeArtifact,\n handle: MigrationTransactionFileHandle,\n read: () => Promise<T>,\n ): Promise<T> {\n item.readHandles.add(handle);\n let value: T | undefined;\n let readFailure: unknown;\n let readFailed = false;\n try {\n value = await read();\n } catch (error: unknown) {\n readFailed = true;\n readFailure = error;\n }\n const closeFailures: unknown[] = [];\n for (let attempt = 0; attempt < 2 && item.readHandles.has(handle); attempt++) {\n try {\n await handle.close();\n item.readHandles.delete(handle);\n } catch (error: unknown) {\n closeFailures.push(error);\n }\n }\n if (readFailed) throw this.attachRecoveryFailures(item.artifact.path, readFailure, closeFailures);\n if (closeFailures.length > 0) {\n throw new MigrationApplicationError(\n 'transaction-io',\n `Could not close a migration read handle: ${item.artifact.path}`,\n [item.artifact.path],\n { cause: closeFailures[0], recoveryFailures: closeFailures.slice(1) },\n );\n }\n return value as T;\n }\n\n private attachRecoveryFailures(publicPath: string, error: unknown, recoveryFailures: readonly unknown[]): unknown {\n if (recoveryFailures.length === 0) return error;\n if (error instanceof MigrationApplicationError) {\n return new MigrationApplicationError(error.code, error.message, error.paths, {\n cause: error.cause ?? error,\n recoveryFailures: [...error.recoveryFailures, ...recoveryFailures],\n });\n }\n return new MigrationApplicationError(\n 'transaction-io',\n `Could not read migration state: ${publicPath}`,\n [publicPath],\n {\n cause: error,\n recoveryFailures,\n },\n );\n }\n\n private async assertOwnedIdentity(item: RuntimeArtifact, owned: OwnedFile): Promise<void> {\n await this.assertNamespace(item);\n if (!owned.identity) throw this.ownershipFailure(owned.publicPath);\n const ownedStat = await this.operations.lstat(owned.path);\n if (ownedStat.isSymbolicLink() || !ownedStat.isFile() || !sameIdentity(identity(ownedStat), owned.identity)) {\n throw this.ownershipFailure(owned.publicPath);\n }\n await this.assertNamespace(item);\n }\n\n private async assertNamespace(item: RuntimeArtifact): Promise<void> {\n const namespace = required(item.namespace);\n const expectedIdentity = required(namespace.identity);\n const namespaceStat = await this.operations.lstat(namespace.path);\n if (\n namespaceStat.isSymbolicLink() ||\n !namespaceStat.isDirectory() ||\n !sameIdentity(identity(namespaceStat), expectedIdentity)\n ) {\n throw this.ownershipFailure(namespace.publicPath);\n }\n }\n\n private async assertParentChain(item: RuntimeArtifact, context?: TransactionUnitContext): Promise<void> {\n for (const expectation of item.directories) await this.assertExpectedDirectory(expectation, item, context);\n }\n\n private async assertExpectedDirectory(\n expectation: DirectoryExpectation,\n item: RuntimeArtifact,\n context?: TransactionUnitContext,\n ): Promise<void> {\n const created = context?.createdDirectories.get(expectation.path);\n if (created?.exists) {\n await this.assertDirectoryIdentity(expectation.path, required(created.identity), item.artifact.path);\n return;\n }\n if (expectation.original === 'absent') {\n await this.assertExpectedAbsent(expectation.path, item.artifact.path);\n return;\n }\n await this.assertDirectoryExpectation(expectation.path, expectation.original, item.artifact.path);\n }\n\n private async assertDirectoryExpectation(\n path: string,\n expected: Exclude<DirectoryExpectation['original'], 'absent'>,\n publicPath: string,\n ): Promise<void> {\n let pathStat: MigrationTransactionStat;\n try {\n pathStat = await this.operations.lstat(path);\n } catch (error: unknown) {\n throw this.concurrentModification(publicPath, error);\n }\n const kind = pathStat.isSymbolicLink() ? 'symbolic-link' : pathStat.isDirectory() ? 'directory' : undefined;\n if (kind !== expected.kind || !sameIdentity(identity(pathStat), expected.identity)) {\n throw this.concurrentModification(publicPath);\n }\n if (expected.kind === 'symbolic-link') {\n let followed: MigrationTransactionStat;\n try {\n followed = await this.operations.stat(path);\n } catch (error: unknown) {\n throw this.concurrentModification(publicPath, error);\n }\n if (!followed.isDirectory() || !sameIdentity(identity(followed), expected.followedIdentity)) {\n throw this.concurrentModification(publicPath);\n }\n }\n }\n\n private async assertDirectoryIdentity(path: string, expected: FileIdentity, publicPath: string): Promise<void> {\n let pathStat: MigrationTransactionStat;\n try {\n pathStat = await this.operations.lstat(path);\n } catch (error: unknown) {\n throw this.concurrentModification(publicPath, error);\n }\n if (pathStat.isSymbolicLink() || !pathStat.isDirectory() || !sameIdentity(identity(pathStat), expected)) {\n throw this.concurrentModification(publicPath);\n }\n }\n\n private async assertExpectedAbsent(path: string, publicPath: string): Promise<void> {\n try {\n await this.operations.lstat(path);\n } catch (error: unknown) {\n if (isEnoent(error)) return;\n throw error;\n }\n throw this.concurrentModification(publicPath);\n }\n\n private async lstatOrAbsent(path: string): Promise<MigrationTransactionStat | 'absent'> {\n try {\n return await this.operations.lstat(path);\n } catch (error: unknown) {\n if (isEnoent(error)) return 'absent';\n throw error;\n }\n }\n\n private async closeReadHandles(item: RuntimeArtifact, failures: unknown[]): Promise<void> {\n for (const handle of item.readHandles) {\n try {\n await handle.close();\n item.readHandles.delete(handle);\n } catch (error: unknown) {\n failures.push(error);\n }\n }\n }\n\n private assertNotInterrupted(signal: AbortSignal): void {\n if (!signal.aborted) return;\n throw signal.reason instanceof Error ? signal.reason : new Error('Migration transaction interrupted.');\n }\n\n private concurrentModification(publicPath: string, cause?: unknown): MigrationApplicationError {\n return new MigrationApplicationError(\n 'concurrent-modification',\n `Migration destination changed after planning: ${publicPath}`,\n [publicPath],\n cause === undefined ? undefined : { cause },\n );\n }\n\n private ownershipFailure(publicPath: string): MigrationApplicationError {\n return new MigrationApplicationError(\n 'transaction-io',\n `Migration transaction ownership could not be confirmed: ${publicPath}`,\n [publicPath],\n );\n }\n}\n\nfunction directoryChain(path: string): readonly string[] {\n const result: string[] = [];\n let current = resolve(path);\n while (true) {\n result.unshift(current);\n const parent = dirname(current);\n if (parent === current) return result;\n current = parent;\n }\n}\n\nfunction frozenIdentity(value: FileIdentity | undefined): FileIdentity | undefined {\n return value === undefined ? undefined : Object.freeze({ ...value });\n}\n\nfunction ownedFileView(owned: OwnedFile): OwnedFileView {\n return Object.freeze({\n path: owned.path,\n publicPath: owned.publicPath,\n ...(owned.identity === undefined ? {} : { identity: frozenIdentity(owned.identity) }),\n exists: owned.exists,\n preserve: owned.preserve,\n });\n}\n\nfunction ownedNamespaceView(namespace: OwnedNamespace | undefined) {\n if (namespace === undefined) return undefined;\n return Object.freeze({\n path: namespace.path,\n publicPath: namespace.publicPath,\n ...(namespace.identity === undefined ? {} : { identity: frozenIdentity(namespace.identity) }),\n exists: namespace.exists,\n });\n}\n\nfunction directoryExpectationView(expectation: DirectoryExpectation): DirectoryExpectation {\n if (expectation.original === 'absent') return Object.freeze({ path: expectation.path, original: 'absent' });\n return Object.freeze({\n path: expectation.path,\n original: Object.freeze({\n ...expectation.original,\n identity: frozenIdentity(expectation.original.identity)!,\n ...(expectation.original.kind === 'symbolic-link'\n ? { followedIdentity: frozenIdentity(expectation.original.followedIdentity)! }\n : {}),\n }),\n });\n}\n\nfunction stagingArtifactView(item: RuntimeArtifact): StagingArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n directories: Object.freeze(item.directories.map(directoryExpectationView)),\n ...(item.originalMode === undefined ? {} : { originalMode: item.originalMode }),\n ...(item.stage === undefined ? {} : { stagingPath: item.stage.path }),\n });\n}\n\nfunction commitArtifactView(item: RuntimeArtifact): CommitArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n ...(item.originalIdentity === undefined ? {} : { originalIdentity: frozenIdentity(item.originalIdentity) }),\n ...(item.namespace === undefined ? {} : { namespace: ownedNamespaceView(item.namespace) }),\n ...(item.stage === undefined ? {} : { stage: ownedFileView(item.stage) }),\n ...(item.backup === undefined ? {} : { backup: ownedFileView(item.backup) }),\n quarantines: Object.freeze(item.quarantines.map(ownedFileView)),\n ...(item.installedIdentity === undefined ? {} : { installedIdentity: frozenIdentity(item.installedIdentity) }),\n });\n}\n\nfunction rollbackArtifactView(item: RuntimeArtifact): RollbackArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n ...(item.originalIdentity === undefined ? {} : { originalIdentity: frozenIdentity(item.originalIdentity) }),\n ...(item.namespace === undefined ? {} : { namespace: ownedNamespaceView(item.namespace) }),\n ...(item.stage === undefined ? {} : { stage: ownedFileView(item.stage) }),\n ...(item.backup === undefined ? {} : { backup: ownedFileView(item.backup) }),\n ...(item.installedIdentity === undefined ? {} : { installedIdentity: frozenIdentity(item.installedIdentity) }),\n ...(item.restoredIdentity === undefined ? {} : { restoredIdentity: frozenIdentity(item.restoredIdentity) }),\n });\n}\n\nfunction cleanupArtifactView(item: RuntimeArtifact): CleanupArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n directories: Object.freeze(item.directories.map(directoryExpectationView)),\n ...(item.originalIdentity === undefined ? {} : { originalIdentity: frozenIdentity(item.originalIdentity) }),\n ...(item.namespace === undefined ? {} : { namespace: ownedNamespaceView(item.namespace) }),\n ownedFiles: Object.freeze(item.ownedFiles.map(ownedFileView)),\n ...(item.backup === undefined ? {} : { backupPath: item.backup.path }),\n ...(item.restoredIdentity === undefined ? {} : { restoredIdentity: frozenIdentity(item.restoredIdentity) }),\n });\n}\n\nfunction createdDirectoryView(directory: CreatedDirectory | undefined): CreatedDirectoryView | undefined {\n if (directory === undefined) return undefined;\n return Object.freeze({\n path: directory.path,\n ...(directory.identity === undefined ? {} : { identity: frozenIdentity(directory.identity) }),\n publicPaths: Object.freeze([...directory.publicPaths]),\n exists: directory.exists,\n });\n}\n","import { MigrationApplicationError, type MigrationApplicationErrorCode } from '../migrator/migration-application.error';\nimport type { MigrationPlan } from '../migrator/migration-plan';\nimport { AngularTemplateParser } from '../template/angular-template.parser';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport { FileSystemCleanupUnit } from './cleanup.unit';\nimport { CommitUnitError, FileSystemCommitUnit, type CommittedArtifact } from './commit.unit';\nimport { FileSystemRollbackUnit } from './rollback.unit';\nimport { FileSystemStagingUnit, StagingUnitError, type StagedArtifact } from './staging.unit';\nimport { TransactionSignalRegistrar, type TransactionSignalRegistrarLike } from './transaction-signal.registrar';\nimport {\n RecoveryUnitError,\n TransactionUnitSession,\n nodeTransactionOperations,\n type MigrationTransactionFileHandle,\n type MigrationTransactionOperations,\n type MigrationTransactionStat,\n type RecoveryOutcome,\n} from './transaction-unit.session';\n\nexport type { MigrationTransactionFileHandle, MigrationTransactionOperations, MigrationTransactionStat };\n\ninterface PreflightSeal {\n readonly plan: MigrationPlan;\n readonly contents: string;\n}\n\nclass TransactionInterruptedError extends Error {\n constructor(readonly signal: NodeJS.Signals) {\n super(`Migration transaction interrupted by ${signal}.`);\n this.name = 'TransactionInterruptedError';\n }\n}\n\nexport class MigrationTransaction {\n private interruptedBy: NodeJS.Signals | undefined;\n private unregisterSignals: (() => void) | undefined;\n private preflightSeal: PreflightSeal | undefined;\n private activePreflight: symbol | undefined;\n private applying = false;\n\n constructor(\n private readonly operations: MigrationTransactionOperations = nodeTransactionOperations,\n private readonly signalRegistrar: TransactionSignalRegistrarLike = new TransactionSignalRegistrar(),\n private readonly parser: AngularTemplateParser = new AngularTemplateParser(),\n ) {}\n\n public async preflight(plan: MigrationPlan): Promise<void> {\n if (this.applying) throw this.invalidTransition('preflight', plan);\n if (this.activePreflight !== undefined) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n 'Migration transaction cannot preflight while another preflight is active.',\n sortedUnique(plan.artifacts.map(artifact => artifact.path)),\n );\n }\n const owner = Symbol('preflight');\n this.activePreflight = owner;\n this.preflightSeal = undefined;\n try {\n this.rejectParseErrors(plan);\n const session = new TransactionUnitSession(this.operations, this.parser);\n await session.prepareForPreflight(plan.artifacts);\n if (this.activePreflight !== owner) throw this.invalidTransition('preflight', plan);\n this.preflightSeal = { plan, contents: planContents(plan) };\n } finally {\n if (this.activePreflight === owner) this.activePreflight = undefined;\n }\n }\n\n public async apply(plan: MigrationPlan): Promise<void> {\n this.assertPreflightSeal(plan);\n this.preflightSeal = undefined;\n if (plan.artifacts.length === 0) return;\n if (this.applying) throw this.invalidTransition('apply', plan);\n\n this.applying = true;\n this.interruptedBy = undefined;\n const controller = new AbortController();\n const session = new TransactionUnitSession(this.operations, this.parser, () => {\n this.syncSignalScope(session, controller);\n });\n const stagingUnit = new FileSystemStagingUnit(session.stagingPort());\n const commitUnit = new FileSystemCommitUnit(session.commitPort());\n const rollbackUnit = new FileSystemRollbackUnit(session.rollbackPort());\n\n let staged: readonly StagedArtifact[] = [];\n try {\n staged = await stagingUnit.stage(plan.artifacts, controller.signal);\n } catch (error: unknown) {\n const stagingError = error instanceof StagingUnitError ? error : undefined;\n staged = stagingError?.staged ?? staged;\n const recovery = await this.runCleanup(session, staged, 'recovery');\n this.finishApplication();\n throw this.decorateFailure(stagingError?.cause ?? error, recovery);\n }\n\n let committed: readonly CommittedArtifact[] = [];\n try {\n committed = await commitUnit.commit(staged, controller.signal);\n this.assertNotInterrupted(controller.signal);\n } catch (error: unknown) {\n const commitError = error instanceof CommitUnitError ? error : undefined;\n staged = commitError?.staged ?? staged;\n committed = commitError?.committed ?? committed;\n const rollback = await this.runRollback(rollbackUnit, [...committed].reverse());\n const cleanup = await this.runCleanup(session, staged, 'recovery');\n this.finishApplication();\n throw this.decorateFailure(commitError?.cause ?? error, mergeRecovery(rollback, cleanup));\n }\n\n const finalization = await this.runCleanup(session, staged, 'committed');\n this.finishApplication();\n if (finalization.paths.length > 0 || finalization.failures.length > 0) {\n const cause = finalization.failures[0] ?? new Error('Transaction cleanup could not be confirmed.');\n throw new MigrationApplicationError(\n this.interruptedBy ? 'transaction-interrupted' : 'transaction-io',\n this.interruptedBy\n ? 'Migration transaction was interrupted during cleanup.'\n : 'Migration committed, but cleanup was incomplete.',\n finalization.paths,\n { cause, recoveryFailures: finalization.failures.slice(1) },\n );\n }\n if (this.interruptedBy) {\n throw new MigrationApplicationError('transaction-interrupted', 'Migration transaction was interrupted.', [], {\n cause: new TransactionInterruptedError(this.interruptedBy),\n });\n }\n }\n\n private rejectParseErrors(plan: MigrationPlan): void {\n const paths = plan.files\n .flatMap(file => file.results.filter(result => result.status === 'parse-error').map(result => result.fileName))\n .filter((path, index, all) => all.indexOf(path) === index)\n .sort(compareCodeUnits);\n if (paths.length === 0) return;\n throw new MigrationApplicationError(\n 'internal-invariant',\n 'A migration plan with template parse errors cannot be applied.',\n paths,\n );\n }\n\n private assertPreflightSeal(plan: MigrationPlan): void {\n const seal = this.preflightSeal;\n if (seal?.plan === plan && seal.contents === planContents(plan)) return;\n throw this.invalidTransition('apply', plan);\n }\n\n private invalidTransition(action: 'preflight' | 'apply', plan: MigrationPlan): MigrationApplicationError {\n return new MigrationApplicationError(\n 'internal-invariant',\n action === 'apply'\n ? 'Migration transaction apply requires the exact plan that passed preflight.'\n : 'Migration transaction cannot preflight while application is active.',\n sortedUnique(plan.artifacts.map(artifact => artifact.path)),\n );\n }\n\n private async runRollback(\n rollbackUnit: FileSystemRollbackUnit,\n committed: readonly CommittedArtifact[],\n ): Promise<RecoveryOutcome> {\n try {\n return { paths: await rollbackUnit.rollback(committed), failures: [] };\n } catch (error: unknown) {\n if (error instanceof RecoveryUnitError) return { paths: error.paths, failures: error.failures };\n return { paths: [], failures: [error] };\n }\n }\n\n private async runCleanup(\n session: TransactionUnitSession,\n staged: readonly StagedArtifact[],\n kind: 'committed' | 'recovery',\n ): Promise<RecoveryOutcome> {\n try {\n return { paths: await new FileSystemCleanupUnit(session.cleanupPort(), kind).cleanup(staged), failures: [] };\n } catch (error: unknown) {\n if (error instanceof RecoveryUnitError) return { paths: error.paths, failures: error.failures };\n return { paths: [], failures: [error] };\n }\n }\n\n private decorateFailure(error: unknown, recovery: RecoveryOutcome): MigrationApplicationError {\n const interrupted = this.interruptedBy !== undefined || error instanceof TransactionInterruptedError;\n const applicationError = error instanceof MigrationApplicationError ? error : undefined;\n const code: MigrationApplicationErrorCode = interrupted\n ? 'transaction-interrupted'\n : (applicationError?.code ?? 'transaction-io');\n const validationPaths =\n applicationError && applicationError.code !== 'transaction-io' ? applicationError.paths : [];\n const paths = sortedUnique([...validationPaths, ...recovery.paths]);\n const cause = applicationError?.cause ?? error;\n const recoveryFailures = [...(applicationError?.recoveryFailures ?? []), ...recovery.failures];\n return new MigrationApplicationError(\n code,\n interrupted\n ? 'Migration transaction was interrupted.'\n : (applicationError?.message ?? 'Migration transaction failed.'),\n paths,\n { cause, recoveryFailures },\n );\n }\n\n private syncSignalScope(session: TransactionUnitSession, controller: AbortController): void {\n const hasOwnedArtifacts = session.hasOwnedArtifacts();\n if (hasOwnedArtifacts && !this.unregisterSignals) {\n this.unregisterSignals = this.signalRegistrar.register(signal => {\n this.interruptedBy ??= signal;\n if (!controller.signal.aborted) controller.abort(new TransactionInterruptedError(signal));\n });\n } else if (!hasOwnedArtifacts) {\n this.unregisterSignalHandlers();\n }\n }\n\n private finishApplication(): void {\n this.unregisterSignalHandlers();\n this.applying = false;\n }\n\n private unregisterSignalHandlers(): void {\n this.unregisterSignals?.();\n this.unregisterSignals = undefined;\n }\n\n private assertNotInterrupted(signal: AbortSignal): void {\n if (!signal.aborted) return;\n throw signal.reason instanceof Error ? signal.reason : new Error('Migration transaction interrupted.');\n }\n}\n\nfunction planContents(plan: MigrationPlan): string {\n return JSON.stringify(plan);\n}\n\nfunction mergeRecovery(...outcomes: readonly RecoveryOutcome[]): RecoveryOutcome {\n return {\n paths: sortedUnique(outcomes.flatMap(outcome => outcome.paths)),\n failures: Object.freeze(outcomes.flatMap(outcome => outcome.failures)),\n };\n}\n\nfunction sortedUnique(paths: Iterable<string>): readonly string[] {\n return [...new Set(paths)].sort(compareCodeUnits);\n}\n","import type { MigrationApplication } from '../report/migration-report';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { ValidatedProjectPlan } from './validated-project-plan';\n\nexport interface AppliedProject {\n readonly validated: ValidatedProjectPlan;\n readonly application: MigrationApplication;\n}\n\nexport function appliedProject(project: AppliedProject): AppliedProject {\n const mode = project.validated.rendered.analyzed.manifest.invocation.options.mode;\n const coherent =\n mode === 'plan'\n ? project.application.status === 'skipped' && project.application.reason === 'plan-only'\n : !(project.application.status === 'skipped' && project.application.reason === 'plan-only');\n if (!coherent) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Application result is incompatible with validated manifest mode \"${mode}\".`,\n );\n }\n return Object.freeze({\n validated: project.validated,\n application: Object.freeze({ ...project.application }),\n });\n}\n","import type { MigrationMode } from '../../migrator/migration-mode';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport { MigrationTransaction } from '../../transaction/migration-transaction';\nimport { appliedProject, type AppliedProject } from '../applied-project';\nimport type { ApplyStage } from '../migration-pipeline';\nimport type { ValidatedProjectPlan } from '../validated-project-plan';\n\nexport type MigrationTransactionPort = Pick<MigrationTransaction, 'preflight' | 'apply'>;\n\nexport class ApplyProjectStage implements ApplyStage {\n constructor(\n private readonly mode: MigrationMode,\n private readonly transaction: MigrationTransactionPort = new MigrationTransaction(),\n ) {}\n\n public async run(validated: ValidatedProjectPlan): Promise<AppliedProject> {\n const manifestMode = validated.rendered.analyzed.manifest.invocation.options.mode;\n if (this.mode !== manifestMode) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Apply stage mode \"${this.mode}\" differs from validated manifest mode \"${manifestMode}\".`,\n );\n }\n const plan = validated.plan;\n const hasParseError = plan.files.some(file => file.results.some(result => result.status === 'parse-error'));\n if (this.mode === 'plan') {\n if (!hasParseError) await this.transaction.preflight(plan);\n return appliedProject({ validated, application: { status: 'skipped', reason: 'plan-only' } });\n }\n if (hasParseError) {\n return appliedProject({ validated, application: { status: 'skipped', reason: 'parse-errors' } });\n }\n\n await this.transaction.preflight(plan);\n if (plan.artifacts.length > 0) await this.transaction.apply(plan);\n return appliedProject({ validated, application: { status: 'applied' } });\n }\n}\n","import { readdir, stat } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { createGitIgnoreMatcher } from '../../lib/gitignore.helper';\nimport { logger } from '../../logger';\nimport { compareCodeUnits } from '../../util/compare-code-units';\nimport type { DiscoverStage } from '../migration-pipeline';\nimport {\n projectManifest,\n type ManifestTemplate,\n type MigrationInvocation,\n type ProjectManifest,\n} from '../project-manifest';\nimport type { DiscoveryEntry, DiscoveryFileSystem } from './discovery-file-system.port';\nimport type { IgnoreMatcher, IgnoreMatcherFactory } from './ignore-matcher.port';\n\nconst nodeFileSystem: DiscoveryFileSystem = Object.freeze({\n async kind(candidate: string) {\n const candidateStat = await stat(candidate);\n if (candidateStat.isFile()) return 'file';\n if (candidateStat.isDirectory()) return 'directory';\n return 'other';\n },\n async entries(directory: string) {\n const entries = await readdir(directory, { withFileTypes: true });\n return entries.map((entry): DiscoveryEntry => ({\n name: entry.name,\n kind: entry.isFile() ? 'file' : entry.isDirectory() ? 'directory' : 'other',\n }));\n },\n});\n\nconst gitIgnoreMatcherFactory: IgnoreMatcherFactory = Object.freeze({\n load: createGitIgnoreMatcher,\n});\n\nexport class DiscoverProjectStage implements DiscoverStage {\n constructor(\n private readonly fileSystem: DiscoveryFileSystem = nodeFileSystem,\n private readonly ignoreMatchers: IgnoreMatcherFactory = gitIgnoreMatcherFactory,\n ) {}\n\n public async run(invocation: MigrationInvocation): Promise<ProjectManifest> {\n const inputProbePath = preserveTrailingSeparator(invocation.canonicalInputPath, invocation.inputPath);\n const inputKind = await this.fileSystem.kind(inputProbePath);\n let templates: readonly ManifestTemplate[];\n\n if (inputKind === 'file') {\n templates = this.singleFile(invocation);\n } else if (inputKind === 'directory') {\n templates = await this.folderTemplates(invocation);\n } else {\n throw new Error(`Unsupported input type: ${invocation.inputPath}`);\n }\n\n return projectManifest({ invocation, templates });\n }\n\n private singleFile(invocation: MigrationInvocation): readonly ManifestTemplate[] {\n if (path.extname(invocation.canonicalInputPath).toLowerCase() !== '.html') {\n throw new Error(`Unsupported file type: ${invocation.inputPath}`);\n }\n if (path.extname(invocation.canonicalOutputPath).toLowerCase() !== '.html') {\n throw new Error('Single-file output path must have a .html extension.');\n }\n return [{ inputPath: invocation.canonicalInputPath, outputPath: invocation.canonicalOutputPath }];\n }\n\n private async folderTemplates(invocation: MigrationInvocation): Promise<readonly ManifestTemplate[]> {\n const root = invocation.canonicalInputPath;\n const matcher = await this.ignoreMatchers.load(root, invocation.inputPath);\n const exclusions = this.excludedPaths(invocation);\n const inputs = await this.collectInputs(root, invocation.inputPath, matcher, exclusions);\n inputs.sort(compareCodeUnits);\n return inputs.map(inputPath => ({\n inputPath,\n outputPath: path.join(invocation.canonicalOutputPath, path.relative(root, inputPath)),\n }));\n }\n\n private async collectInputs(\n directory: string,\n displayDirectory: string,\n matcher: IgnoreMatcher,\n exclusions: ReadonlySet<string>,\n ): Promise<string[]> {\n const entries = [...(await this.fileSystem.entries(directory))].sort((left, right) =>\n compareCodeUnits(left.name, right.name),\n );\n const inputs: string[] = [];\n\n for (const entry of entries) {\n const candidate = path.join(directory, entry.name);\n const displayCandidate = path.join(displayDirectory, entry.name);\n logger.debug(`Processing ${displayCandidate}`);\n const ignored = entry.kind === 'directory' ? matcher.ignoresDirectory(candidate) : matcher.ignores(candidate);\n if (ignored || exclusions.has(path.normalize(candidate))) continue;\n const kind = entry.kind === 'other' ? await this.fileSystem.kind(candidate) : entry.kind;\n if (entry.kind === 'other' && kind === 'directory' && matcher.ignoresDirectory(candidate)) continue;\n\n if (kind === 'directory') {\n inputs.push(...(await this.collectInputs(candidate, displayCandidate, matcher, exclusions)));\n } else if (kind === 'file' && path.extname(entry.name).toLowerCase() === '.html') {\n inputs.push(path.normalize(path.resolve(candidate)));\n }\n }\n\n return inputs;\n }\n\n private excludedPaths(invocation: MigrationInvocation): ReadonlySet<string> {\n const candidates = [invocation.options.stylesheetPath, invocation.options.reportPath]\n .filter((candidate): candidate is string => candidate !== undefined)\n .map(candidate => path.normalize(path.resolve(candidate)));\n const outputRoot = invocation.canonicalOutputPath;\n if (path.relative(invocation.canonicalInputPath, outputRoot) !== '') candidates.push(outputRoot);\n return new Set(candidates);\n }\n}\n\nfunction preserveTrailingSeparator(canonicalPath: string, rawPath: string): string {\n return /[\\\\/]$/u.test(rawPath) && !/[\\\\/]$/u.test(canonicalPath) ? `${canonicalPath}${path.sep}` : canonicalPath;\n}\n","import fs from 'fs-extra';\nimport ignore from 'ignore';\nimport path from 'path';\nimport { logger } from '../logger';\nimport type { IgnoreMatcher } from '../pipeline/discover/ignore-matcher.port';\n\nexport async function createGitIgnoreMatcher(root: string, displayRoot: string = root): Promise<IgnoreMatcher> {\n const matcher = ignore();\n const gitignorePath = path.join(root, '.gitignore');\n if (await fs.pathExists(gitignorePath)) {\n matcher.add(await fs.readFile(gitignorePath, 'utf8'));\n logger.debug(`Loaded .gitignore file from ${path.join(displayRoot, '.gitignore')}`);\n }\n const relativeIgnorePath = (candidate: string): string => path.relative(root, candidate).split(path.sep).join('/');\n return Object.freeze({\n ignores: (candidate: string) => matcher.ignores(relativeIgnorePath(candidate)),\n ignoresDirectory: (candidate: string) => matcher.ignores(`${relativeIgnorePath(candidate)}/`),\n });\n}\n","import type { PipelineStageName } from './migration-pipeline';\n\nexport type { PipelineStageName } from './migration-pipeline';\n\nexport class PipelineStageError extends Error {\n constructor(\n readonly stage: PipelineStageName,\n override readonly cause: unknown,\n ) {\n super(`Migration pipeline ${stage} stage failed.`, { cause });\n this.name = 'PipelineStageError';\n }\n}\n","import type { AppliedProject } from './applied-project';\nimport type { AnalyzedProject } from './analyzed-project';\nimport { PipelineStageError } from './pipeline-stage.error';\nimport type { MigrationInvocation, ProjectManifest } from './project-manifest';\nimport type { RenderedProject } from './rendered-project';\nimport type { ValidatedProjectPlan } from './validated-project-plan';\n\nexport type PipelineStageName = 'discover' | 'analyze' | 'render' | 'validate' | 'apply';\n\nexport interface DiscoverStage {\n run(invocation: MigrationInvocation): Promise<ProjectManifest>;\n}\n\nexport interface AnalyzeStage {\n run(manifest: ProjectManifest): Promise<AnalyzedProject>;\n}\n\nexport interface RenderStage {\n run(analyzed: AnalyzedProject): Promise<RenderedProject>;\n}\n\nexport interface ValidateStage {\n prevalidate(invocation: MigrationInvocation): Promise<void>;\n run(rendered: RenderedProject): Promise<ValidatedProjectPlan>;\n}\n\nexport interface ApplyStage {\n run(plan: ValidatedProjectPlan): Promise<AppliedProject>;\n}\n\nexport type MigrationPipelineResult = AppliedProject;\n\nexport class MigrationPipeline {\n constructor(\n private readonly discover: DiscoverStage,\n private readonly analyze: AnalyzeStage,\n private readonly render: RenderStage,\n private readonly validate: ValidateStage,\n private readonly apply: ApplyStage,\n ) {}\n\n public async run(invocation: MigrationInvocation): Promise<MigrationPipelineResult> {\n await this.validate.prevalidate(invocation);\n const manifest = await runStage('discover', () => this.discover.run(invocation));\n const analyzed = await runStage('analyze', () => this.analyze.run(manifest));\n const rendered = await runStage('render', () => this.render.run(analyzed));\n const validated = await runStage('validate', () => this.validate.run(rendered));\n const applied = await runStage('apply', () => this.apply.run(validated));\n\n return applied;\n }\n}\n\nasync function runStage<T>(stage: PipelineStageName, action: () => Promise<T>): Promise<T> {\n try {\n return await action();\n } catch (error: unknown) {\n if (error instanceof PipelineStageError) throw error;\n throw new PipelineStageError(stage, error);\n }\n}\n","import path from 'node:path';\nimport type { ConversionResult } from '../analyzer/conversion-result';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { FileMigrationResult } from '../migrator/file-migration-result';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport type {\n FileReport,\n MigrationApplication,\n MigrationMode,\n MigrationReport,\n MigrationSummary,\n ReportResult,\n StylesheetReport,\n} from './migration-report';\n\ntype PathApi = typeof path.posix;\n\nexport interface StylesheetMigrationResult {\n readonly path: string;\n readonly change: StylesheetReport['change'];\n}\n\nexport class MigrationReportBuilder {\n public build(\n inputRoot: string,\n outputRoot: string,\n target: 'css' | 'tailwind',\n mode: MigrationMode,\n application: MigrationApplication,\n durationMs: number,\n files: readonly FileMigrationResult[],\n stylesheet?: StylesheetMigrationResult,\n ): MigrationReport {\n const pathApi = this.pathApi(\n inputRoot,\n outputRoot,\n stylesheet?.path ?? '',\n ...files.flatMap(file => [file.inputPath, file.outputPath]),\n );\n const singleFile = files.length === 1 && this.samePath(pathApi, inputRoot, files[0]?.inputPath ?? '');\n const fileReports = files\n .map(file => this.fileReport(pathApi, inputRoot, singleFile, file))\n .sort((left, right) => compareCodeUnits(left.path, right.path));\n const reportPaths = this.reportPaths(pathApi, inputRoot, outputRoot, singleFile);\n const summary = this.summary(fileReports);\n\n return {\n schemaVersion: 2,\n mode,\n target,\n application,\n input: reportPaths.input,\n output: reportPaths.output,\n durationMs: Math.trunc(durationMs),\n summary,\n files: fileReports,\n ...(target === 'css' && stylesheet\n ? { stylesheet: this.stylesheetReport(pathApi, inputRoot, singleFile, stylesheet) }\n : {}),\n };\n }\n\n private stylesheetReport(\n pathApi: PathApi,\n inputRoot: string,\n singleFile: boolean,\n stylesheet: StylesheetMigrationResult,\n ): StylesheetReport {\n const inputIdentity = this.absolutePath(pathApi, inputRoot);\n const base = singleFile ? pathApi.dirname(inputIdentity) : inputIdentity;\n const relativePath = pathApi.relative(base, this.absolutePath(pathApi, stylesheet.path));\n const displayPath = pathApi.isAbsolute(relativePath) ? pathApi.basename(stylesheet.path) : relativePath;\n\n return { path: this.forwardSlashes(pathApi, displayPath), change: stylesheet.change };\n }\n\n private pathApi(...values: readonly string[]): PathApi {\n if (values.some(value => /^[A-Za-z]:[\\\\/]/.test(value) || value.includes('\\\\'))) return path.win32;\n if (values.some(value => value.includes('/'))) return path.posix;\n return path;\n }\n\n private samePath(pathApi: PathApi, left: string, right: string): boolean {\n return this.absolutePath(pathApi, left) === this.absolutePath(pathApi, right);\n }\n\n private fileReport(pathApi: PathApi, inputRoot: string, singleFile: boolean, file: FileMigrationResult): FileReport {\n const relativePath = singleFile\n ? pathApi.basename(inputRoot)\n : pathApi.relative(this.absolutePath(pathApi, inputRoot), this.absolutePath(pathApi, file.inputPath));\n return {\n path: this.forwardSlashes(pathApi, relativePath),\n changed: file.changed,\n results: file.results.map(result => this.result(result)),\n };\n }\n\n private result(result: ConversionResult): ReportResult {\n if (result.status === 'parse-error') {\n return {\n status: result.status,\n offset: result.source.start,\n code: result.code,\n reason: result.reason,\n };\n }\n\n const input = result.input as LocatedFlexLayoutInput;\n if (result.status === 'converted') {\n return {\n status: result.status,\n directive: input.directive,\n sourceName: input.sourceName,\n offset: input.source.start,\n };\n }\n\n return {\n status: result.status,\n directive: input.directive,\n sourceName: input.sourceName,\n offset: input.source.start,\n code: result.code,\n reason: result.reason,\n suggestion: result.suggestion,\n };\n }\n\n private reportPaths(\n pathApi: PathApi,\n inputRoot: string,\n outputRoot: string,\n singleFile: boolean,\n ): { readonly input: string; readonly output: string } {\n const inputIdentity = this.absolutePath(pathApi, inputRoot);\n const base = singleFile ? pathApi.dirname(inputIdentity) : inputIdentity;\n const input = singleFile ? pathApi.basename(inputRoot) : '.';\n const relativeOutput = pathApi.relative(base, this.absolutePath(pathApi, outputRoot));\n const output = pathApi.isAbsolute(relativeOutput) ? pathApi.basename(outputRoot) : relativeOutput || '.';\n\n return {\n input: this.forwardSlashes(pathApi, input),\n output: this.forwardSlashes(pathApi, output),\n };\n }\n\n private forwardSlashes(pathApi: PathApi, value: string): string {\n return value.split(pathApi.sep).join('/');\n }\n\n private absolutePath(pathApi: PathApi, value: string): string {\n return pathApi.normalize(pathApi.resolve(value));\n }\n\n private summary(files: readonly FileReport[]): MigrationSummary {\n const resultCounts = {\n converted: 0,\n review: 0,\n unsupported: 0,\n invalid: 0,\n parseErrors: 0,\n };\n\n for (const result of files.flatMap(file => file.results)) {\n if (result.status === 'parse-error') resultCounts.parseErrors += 1;\n else resultCounts[result.status] += 1;\n }\n\n return {\n filesScanned: files.length,\n filesChanged: files.filter(file => file.changed).length,\n ...resultCounts,\n };\n }\n}\n","import * as path from 'node:path';\nimport type { MigrationInvocation } from './project-manifest';\n\ninterface InvocationPathRoot {\n readonly canonical: string;\n readonly raw: string;\n}\n\ntype PathBearingError = Error & {\n path?: unknown;\n dest?: unknown;\n};\n\nexport function remapInvocationErrorPaths(error: unknown, invocation: MigrationInvocation): unknown {\n if (!(error instanceof Error)) return error;\n\n const roots = invocationRoots(invocation);\n const pathBearingError = error as PathBearingError;\n remapErrorPath(pathBearingError, 'path', roots);\n remapErrorPath(pathBearingError, 'dest', roots);\n return error;\n}\n\nfunction invocationRoots(invocation: MigrationInvocation): readonly InvocationPathRoot[] {\n return [\n { canonical: invocation.canonicalInputPath, raw: invocation.inputPath },\n { canonical: invocation.canonicalOutputPath, raw: invocation.outputPath },\n ].sort((left, right) => right.canonical.length - left.canonical.length);\n}\n\nfunction remapErrorPath(error: PathBearingError, field: 'path' | 'dest', roots: readonly InvocationPathRoot[]): void {\n const original = error[field];\n if (typeof original !== 'string') return;\n\n const mapped = mappedInvocationPath(original, roots);\n if (mapped === original) return;\n\n error.message = error.message.replaceAll(original, () => mapped);\n error[field] = mapped;\n}\n\nfunction mappedInvocationPath(candidate: string, roots: readonly InvocationPathRoot[]): string {\n if (!path.isAbsolute(candidate)) return candidate;\n\n for (const root of roots) {\n const relativePath = path.relative(root.canonical, candidate);\n if (relativePath === '') return root.raw;\n if (relativePath === '..' || relativePath.startsWith(`..${path.sep}`) || path.isAbsolute(relativePath)) continue;\n return path.join(root.raw, relativePath);\n }\n\n return candidate;\n}\n","import type { MigrationReport } from '../report/migration-report';\nimport { MigrationReportBuilder } from '../report/migration-report.builder';\nimport type { AppliedProject } from './applied-project';\nimport { remapInvocationErrorPaths } from './invocation-error-path.mapper';\nimport type { MigrationPipeline } from './migration-pipeline';\nimport { PipelineStageError } from './pipeline-stage.error';\nimport type { MigrationInvocation } from './project-manifest';\n\nexport type MigrationExecutionPipeline = Pick<MigrationPipeline, 'run'>;\n\ntype ReportBuilder = Pick<MigrationReportBuilder, 'build'>;\n\nexport class MigrationRunner {\n constructor(\n private readonly pipeline: MigrationExecutionPipeline,\n private readonly reports: ReportBuilder = new MigrationReportBuilder(),\n private readonly now: () => number = Date.now,\n ) {}\n\n public async run(invocation: MigrationInvocation): Promise<MigrationReport> {\n const startedAt = this.now();\n const applied = await this.execute(invocation);\n const durationMs = this.now() - startedAt;\n const { validated, application } = applied;\n const { plan, rendered, stylesheet } = validated;\n\n return this.reports.build(\n rendered.analyzed.manifest.invocation.inputPath,\n rendered.analyzed.manifest.invocation.outputPath,\n plan.target,\n rendered.analyzed.manifest.invocation.options.mode,\n application,\n durationMs,\n plan.files,\n stylesheet,\n );\n }\n\n private async execute(invocation: MigrationInvocation): Promise<AppliedProject> {\n try {\n return await this.pipeline.run(invocation);\n } catch (error: unknown) {\n if (!(error instanceof PipelineStageError)) throw error;\n if (error.stage === 'apply') throw error.cause;\n throw remapInvocationErrorPaths(error.cause, invocation);\n }\n }\n}\n","import type { TemplateAttribute } from './template.model';\n\nexport function templateAttributeKeys(attribute: TemplateAttribute): ReadonlySet<string> {\n const semanticKey = attribute.name.toLowerCase();\n const rawName = attribute.rawName.toLowerCase();\n const rawKey =\n attribute.binding !== 'property'\n ? rawName\n : rawName.startsWith('[') && rawName.endsWith(']')\n ? rawName.slice(1, -1)\n : rawName.startsWith('bind-')\n ? rawName.slice('bind-'.length)\n : rawName;\n return new Set([rawKey, semanticKey]);\n}\n","export type SrcsetValueValidation =\n { readonly status: 'valid'; readonly value: string } | { readonly status: 'invalid'; readonly reason: string };\n\nexport function validateSingleSrcsetUrl(value: string): SrcsetValueValidation {\n if (value.length === 0) {\n return { status: 'invalid', reason: 'A responsive image source cannot be empty.' };\n }\n if (value.includes('{{') || value.includes('}}')) {\n return { status: 'invalid', reason: 'Interpolation is not a literal responsive image URL.' };\n }\n if ([...value].some(character => character === ',' || character.charCodeAt(0) <= 32 || character === '\\u007f')) {\n return {\n status: 'invalid',\n reason: 'The value is not one descriptor-free srcset URL.',\n };\n }\n return { status: 'valid', value };\n}\n","import type { PlannedConversion } from '../render/conversion-renderer';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { DiagnosticCode } from '../analyzer/conversion-result';\nimport { ORIENTATION_BREAKPOINTS } from '../analyzer/flex-layout.catalog';\nimport { BreakpointCatalog, type BreakpointDefinition } from '../breakpoint/breakpoint-catalog';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport type {\n ResponsiveImageContext,\n ResponsiveImagePlanningResult,\n ResponsiveImageSource,\n} from './responsive-image.model';\nimport { validateSingleSrcsetUrl } from './srcset-value';\n\ninterface Failure {\n readonly status: 'review' | 'unsupported' | 'invalid';\n readonly code: DiagnosticCode;\n readonly reason: string;\n readonly suggestion: string;\n}\n\nconst standardAliases = new Set([\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n 'lt-sm',\n 'lt-md',\n 'lt-lg',\n 'lt-xl',\n 'gt-xs',\n 'gt-sm',\n 'gt-md',\n 'gt-lg',\n]);\nconst optionalAliases = new Set<string>(ORIENTATION_BREAKPOINTS);\n\nfunction unresolved(inputs: readonly LocatedFlexLayoutInput[], failure: Failure): ResponsiveImagePlanningResult {\n return {\n status: 'unresolved',\n plans: inputs.map(\n input =>\n ({\n ...failure,\n input,\n }) satisfies PlannedConversion,\n ),\n };\n}\n\nfunction breakpointFailure(alias: string): Failure {\n if (alias.length === 0 || (!optionalAliases.has(alias) && alias !== 'print')) {\n return {\n status: 'unsupported',\n code: 'custom-breakpoint',\n reason: `Responsive image breakpoint \"${alias}\" is not a standard viewport alias.`,\n suggestion: 'Migrate the responsive image source manually.',\n };\n }\n return {\n status: 'unsupported',\n code: 'breakpoint-unverified',\n reason: `Responsive image breakpoint \"${alias}\" is not supported by native image migration.`,\n suggestion: 'Keep this responsive image family unchanged.',\n };\n}\n\nexport class ResponsiveImagePlanner {\n private readonly catalog = new BreakpointCatalog();\n\n plan(\n inputs: readonly LocatedFlexLayoutInput[],\n context: ResponsiveImageContext,\n enabled: boolean,\n ): ResponsiveImagePlanningResult {\n if (!enabled) {\n return unresolved(inputs, {\n status: 'unsupported',\n code: 'target-unsupported',\n reason: 'Responsive image migration is not enabled.',\n suggestion: 'Rerun with --responsive-images after reviewing picture-wrapper selector risk.',\n });\n }\n\n if (context.element.name.toLowerCase() !== 'img') {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'Responsive image inputs are only safe to migrate on an img element.',\n suggestion: 'Remove or migrate the input manually.',\n });\n }\n if (context.element.structural || context.ancestors.some(ancestor => ancestor.name.toLowerCase() === 'picture')) {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'The image has structural syntax or is already inside a picture element.',\n suggestion: 'Keep this responsive image family unchanged.',\n });\n }\n if (\n context.element.source.start !== context.element.startTag.start ||\n context.element.source.end < context.element.startTag.end\n ) {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'The image does not have one unambiguous replacement range.',\n suggestion: 'Keep this responsive image family unchanged.',\n });\n }\n if (inputs.some(input => input.binding !== 'literal')) {\n return unresolved(inputs, {\n status: 'review',\n code: 'dynamic-binding',\n reason: 'Dynamic responsive image sources cannot become literal source elements.',\n suggestion: 'Keep the binding or replace it with a literal URL before migrating.',\n });\n }\n\n const aliases = inputs.map(input => input.breakpoint ?? '');\n const unsupportedAlias = aliases.find(alias => !standardAliases.has(alias));\n if (unsupportedAlias !== undefined) return unresolved(inputs, breakpointFailure(unsupportedAlias));\n if (new Set(aliases).size !== aliases.length) {\n return unresolved(inputs, {\n status: 'review',\n code: 'responsive-precedence-unverified',\n reason: 'More than one responsive image input owns the same breakpoint.',\n suggestion: 'Remove duplicate responsive image inputs before migrating.',\n });\n }\n\n const sources: ResponsiveImageSource[] = [];\n for (const input of inputs) {\n const validation = validateSingleSrcsetUrl(input.value);\n if (validation.status === 'invalid') {\n return unresolved(inputs, {\n status: 'invalid',\n code: 'invalid-value',\n reason: validation.reason,\n suggestion: 'Use one literal, descriptor-free URL or migrate this image manually.',\n });\n }\n const classification = this.catalog.classify(input.breakpoint ?? '');\n if (classification.kind !== 'verified') {\n return unresolved(inputs, breakpointFailure(input.breakpoint ?? ''));\n }\n sources.push({ input, definition: classification.definition as BreakpointDefinition, url: validation.value });\n }\n\n const fallbackAttributes = context.element.attributes.filter(attribute => attribute.name === 'src');\n const literalFallback = fallbackAttributes.filter(\n attribute => attribute.binding === 'literal' && attribute.rawName.toLowerCase() === 'src',\n );\n const boundFallback = fallbackAttributes.filter(\n attribute =>\n attribute.binding === 'property' &&\n attribute.bindingTarget === 'property' &&\n attribute.rawName.toLowerCase() === '[src]',\n );\n if (fallbackAttributes.length !== literalFallback.length + boundFallback.length || fallbackAttributes.length > 1) {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'The fallback image source has conflicting or unsupported ownership.',\n suggestion: 'Keep one literal src or property [src] fallback before migrating.',\n });\n }\n\n sources.sort(\n (left, right) =>\n right.definition.priority - left.definition.priority ||\n compareCodeUnits(left.definition.alias, right.definition.alias),\n );\n return {\n status: 'converted',\n plan: {\n element: context.element,\n sources,\n fallback: literalFallback.length ? 'literal' : boundFallback.length ? 'bound' : 'absent',\n },\n };\n }\n}\n","import type { EditDiagnostic, EditResult, SourceEdit } from './source-edit';\nimport { compareCodeUnits } from '../util/compare-code-units';\n\nexport class SourceEditor {\n apply(source: string, edits: readonly SourceEdit[]): EditResult {\n const diagnostics = this.validate(source, edits);\n if (diagnostics.length) return { status: 'invalid', diagnostics };\n\n const orderedEdits = [...edits].sort(\n (left, right) => right.range.start - left.range.start || compareCodeUnits(right.inputId, left.inputId),\n );\n\n let output = source;\n for (const edit of orderedEdits) {\n output = output.slice(0, edit.range.start) + edit.text + output.slice(edit.range.end);\n }\n\n return { status: 'applied', output };\n }\n\n private validate(source: string, edits: readonly SourceEdit[]): EditDiagnostic[] {\n const invalidRanges = edits\n .filter(\n edit =>\n !Number.isInteger(edit.range.start) ||\n !Number.isInteger(edit.range.end) ||\n edit.range.start < 0 ||\n edit.range.end < edit.range.start ||\n edit.range.end > source.length,\n )\n .map(edit => ({\n code: 'invalid-range' as const,\n message: `Edit ${edit.inputId} has a range outside the source.`,\n inputIds: [edit.inputId],\n }));\n\n if (invalidRanges.length) return invalidRanges;\n\n const byStart = [...edits].sort(\n (left, right) => left.range.start - right.range.start || left.range.end - right.range.end,\n );\n\n for (let index = 0; index < byStart.length; index++) {\n const left = byStart[index];\n if (!left) continue;\n\n for (let nextIndex = index + 1; nextIndex < byStart.length; nextIndex++) {\n const right = byStart[nextIndex];\n if (!right || right.range.start > left.range.end) break;\n\n if (left.range.start < right.range.end && right.range.start < left.range.end) {\n const inputIds = [left.inputId, right.inputId].sort();\n return [\n {\n code: 'overlapping-edits',\n message: `Edits ${inputIds[0]} and ${inputIds[1]} overlap.`,\n inputIds,\n },\n ];\n }\n }\n }\n\n return [];\n }\n}\n","export function encodeHtmlAttribute(value: string): string {\n return value\n .replaceAll('&', '&amp;')\n .replaceAll('\"', '&quot;')\n .replaceAll('\\r', '&#13;')\n .replaceAll('\\n', '&#10;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;');\n}\n","import type { SourceEdit } from '../edit/source-edit';\nimport { SourceEditor } from '../edit/source-editor';\nimport type { MediaClause } from '../breakpoint/breakpoint-catalog';\nimport { encodeHtmlAttribute } from './html-attribute.encoder';\nimport type { ResponsiveImagePlan, ResponsiveImageSource } from './responsive-image.model';\n\nfunction mediaClause(clause: MediaClause): string {\n const conditions: string[] = [];\n if (clause.min !== undefined) conditions.push(`(min-width: ${clause.min}px)`);\n if (clause.max !== undefined) conditions.push(`(max-width: ${clause.max}px)`);\n if (clause.orientation !== undefined) conditions.push(`(orientation: ${clause.orientation})`);\n return conditions.join(' and ');\n}\n\nfunction mediaValue(source: ResponsiveImageSource): string {\n const { media } = source.definition;\n const clauses = media.clauses.map(mediaClause).filter(Boolean);\n if (!clauses.length) return media.type;\n return `${media.type} and ${clauses.map(clause => (clauses.length > 1 ? `(${clause})` : clause)).join(', ')}`;\n}\n\nfunction removalStart(source: string, elementStart: number, attributeStart: number): number {\n let start = attributeStart;\n while (start > elementStart && /\\s/u.test(source[start - 1] ?? '')) start--;\n return start;\n}\n\nexport class PictureRenderer {\n render(source: string, plan: ResponsiveImagePlan, innerEdits: readonly SourceEdit[] = []): string {\n const { element } = plan;\n const imageSource = source.slice(element.source.start, element.source.end);\n const removalEdits: SourceEdit[] = plan.sources.map(responsiveSource => ({\n range: {\n start: removalStart(source, element.startTag.start, responsiveSource.input.source.start) - element.source.start,\n end: responsiveSource.input.source.end - element.source.start,\n },\n text: '',\n inputId: responsiveSource.input.id,\n }));\n const localInnerEdits = innerEdits.map(edit => ({\n ...edit,\n range: {\n start: edit.range.start - element.source.start,\n end: edit.range.end - element.source.start,\n },\n }));\n const edited = new SourceEditor().apply(imageSource, [...removalEdits, ...localInnerEdits]);\n if (edited.status === 'invalid') {\n throw new Error(`Cannot compose responsive image edits: ${edited.diagnostics[0]?.message ?? 'invalid edit'}`);\n }\n\n const sourceTags = plan.sources.map(\n responsiveSource =>\n `<source media=\"${encodeHtmlAttribute(mediaValue(responsiveSource))}\" srcset=\"${encodeHtmlAttribute(responsiveSource.url)}\">`,\n );\n const lineEnding = imageSource.includes('\\r\\n') ? '\\r\\n' : '\\n';\n if (!imageSource.includes('\\n')) {\n return `<picture>${sourceTags.join('')}${edited.output}</picture>`;\n }\n\n const lineStart = Math.max(source.lastIndexOf('\\n', element.source.start - 1) + 1, 0);\n const linePrefix = source.slice(lineStart, element.source.start);\n const baseIndentation = /^[\\t ]*$/u.test(linePrefix) ? linePrefix : '';\n const attributeIndentation = imageSource.match(/\\r?\\n([\\t ]+)\\S/u)?.[1];\n const indentation =\n attributeIndentation?.startsWith(baseIndentation) && attributeIndentation.length > baseIndentation.length\n ? attributeIndentation\n : `${baseIndentation} `;\n return `<picture>${lineEnding}${sourceTags.map(tag => `${indentation}${tag}`).join(lineEnding)}${lineEnding}${indentation}${edited.output}${lineEnding}${baseIndentation}</picture>`;\n }\n}\n","import type { FlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { GridDeclaration, GridParseResult, GridSemanticPlan } from './grid-semantic.model';\n\nconst contentAlignment = new Set([\n 'center',\n 'space-around',\n 'space-between',\n 'space-evenly',\n 'end',\n 'start',\n 'stretch',\n]);\nconst itemAlignment = new Set(['start', 'center', 'end', 'stretch']);\n\nfunction parsed(\n role: GridSemanticPlan['role'],\n declarations: readonly GridDeclaration[],\n displayDependency = role !== 'child',\n inline?: boolean,\n): GridParseResult {\n return {\n status: 'parsed',\n plan: Object.freeze({\n role,\n declarations: Object.freeze(declarations.map(declaration => Object.freeze(declaration))),\n displayDependency,\n ...(inline === undefined ? {} : { inline }),\n }),\n };\n}\n\nfunction declaration(property: GridDeclaration['property'], value: string): GridDeclaration {\n return { property, value };\n}\n\nfunction alignment(value: string, prefix: 'align' | 'justify'): GridParseResult {\n const [rawMain, rawCross] = (value || 'start stretch').split(' ');\n const main = rawMain !== undefined && contentAlignment.has(rawMain) ? rawMain : 'start';\n const cross = rawCross !== undefined && itemAlignment.has(rawCross) ? rawCross : 'stretch';\n return parsed('container', [declaration(`${prefix}-content`, main), declaration(`${prefix}-items`, cross)]);\n}\n\nfunction tracks(value: string, axis: 'columns' | 'rows'): GridParseResult {\n let normalized = value || 'none';\n const auto = normalized.endsWith('!');\n if (auto) normalized = normalized.slice(0, normalized.indexOf('!'));\n return parsed('container', [declaration(`grid-${auto ? 'auto' : 'template'}-${axis}`, normalized)]);\n}\n\nexport function parseGridValue(input: FlexLayoutInput): GridParseResult {\n if (input.binding === 'property') {\n return {\n status: 'review',\n code: 'dynamic-binding',\n reason: 'Bound Grid values cannot be evaluated statically.',\n };\n }\n\n switch (input.directive) {\n case 'gdAlignColumns':\n return alignment(input.value, 'align');\n case 'gdAlignRows':\n return alignment(input.value, 'justify');\n case 'gdAreas': {\n const rows = (input.value || 'none').split('|').map(row => `\"${row.trim()}\"`);\n return parsed('container', [declaration('grid-template-areas', rows.join(' '))]);\n }\n case 'gdAuto': {\n let [direction, dense] = (input.value || 'initial').split(' ');\n if (!['column', 'row', 'dense'].includes(direction ?? '')) direction = 'row';\n dense = dense === 'dense' && direction !== 'dense' ? ' dense' : '';\n return parsed('container', [declaration('grid-auto-flow', `${direction}${dense}`)]);\n }\n case 'gdColumns':\n return tracks(input.value, 'columns');\n case 'gdRows':\n return tracks(input.value, 'rows');\n case 'gdGap':\n return parsed('container', [declaration('grid-gap', input.value || '0')]);\n case 'gdArea':\n return parsed('child', [declaration('grid-area', input.value || 'auto')], false);\n case 'gdColumn':\n return parsed('child', [declaration('grid-column', input.value || 'auto')], false);\n case 'gdRow':\n return parsed('child', [declaration('grid-row', input.value || 'auto')], false);\n case 'gdGridAlign': {\n const [rawRow, rawColumn] = (input.value || 'stretch').split(' ');\n const row = rawRow !== undefined && itemAlignment.has(rawRow) ? rawRow : 'stretch';\n const column = rawColumn !== undefined && itemAlignment.has(rawColumn) ? rawColumn : 'stretch';\n return parsed('child', [declaration('justify-self', row), declaration('align-self', column)], false);\n }\n case 'gdInline':\n return parsed('modifier', [], true, input.value !== 'false');\n default:\n return {\n status: 'invalid',\n code: 'invalid-value',\n reason: `${input.directive} is not a Grid directive.`,\n };\n }\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport { cssPropertiesOverlap } from '../css-property-ownership';\nimport type { SourcePropertyEvidence } from '../source-property-evidence';\nimport type { LiteralStyleDeclaration, ResponsiveStyleValueResult } from './responsive-style.model';\n\nconst interpolation = /\\{\\{[\\s\\S]*\\}\\}/u;\nconst dashedOrdinaryProperty = /^-?[a-z][a-z\\d-]*$/iu;\nconst rendererProperty = /^[a-z][a-z\\d]*$/u;\nconst customProperty = /^--[a-z\\d_-]+$/iu;\nconst unitSuffixes = new Set(['px', '%', 'em', 'rem', 'vw', 'vh', 'vmin', 'vmax', 'deg', 's', 'ms']);\nconst unitlessNumber = /^[+-]?(?:(?:\\d+(?:\\.\\d*)?)|(?:\\.\\d+))(?:e[+-]?\\d+)?$/iu;\nconst sanitizerSensitiveFunction = /(?:^|[^a-z\\d_-])(?:url|expression|image|(?:-webkit-)?image-set)\\s*\\(/iu;\nconst targetBuildFunction = /(?:^|[^a-z\\d_-])(?:--alpha|--theme|--spacing|theme)\\s*\\(/iu;\nconst urlScheme = /(?:https?|data|blob|file|javascript):/iu;\n\ninterface NormalizedProperty {\n readonly property: string;\n readonly unit?: string;\n}\n\nexport const responsiveStyleExactKeyAliasReason =\n \"Distinct exact ngStyle keys alias the same browser CSS property, so Angular's activation-history-dependent removal order cannot be represented exactly.\";\n\nfunction normalizeProperty(property: string): NormalizedProperty | undefined {\n if (property.startsWith('--')) return customProperty.test(property) ? { property } : undefined;\n const parts = property.split('.');\n if (parts.length > 2) return undefined;\n const sourceName = parts[0] ?? '';\n const name = sourceName.includes('-')\n ? dashedOrdinaryProperty.test(sourceName)\n ? sourceName.toLowerCase()\n : undefined\n : rendererProperty.test(sourceName)\n ? sourceName\n : undefined;\n if (name === undefined) return undefined;\n const unit = parts[1];\n if (unit === undefined) return { property: name };\n const normalizedUnit = unit.toLowerCase();\n return unitSuffixes.has(normalizedUnit) ? { property: name, unit: normalizedUnit } : undefined;\n}\n\nfunction transformUpstreamRawList(value: string): ResponsiveStyleValueResult {\n const rawDeclarations = String(value)\n .trim()\n .split(';')\n .map(item => item.trim())\n .filter(Boolean);\n const declarationsByExactProperty = new Map<string, LiteralStyleDeclaration>();\n for (const rawDeclaration of rawDeclarations) {\n const [rawKey, ...rawValues] = rawDeclaration.split(':');\n if (rawValues.length === 0) {\n return {\n status: 'unverified',\n reason: 'Upstream semicolon splitting produced a style entry without a property separator.',\n };\n }\n const property = (rawKey ?? '').replace(/['\"]/gu, '').trim();\n const transformedValue = rawValues.join(':').replace(/['\"]/gu, '').trim().replace(/;/u, '');\n if (!property || !transformedValue) {\n return {\n status: 'unverified',\n reason: 'Upstream raw-string transformation produced an empty style key or value.',\n };\n }\n declarationsByExactProperty.set(property, { property, value: transformedValue });\n }\n return { status: 'parsed', value: { declarations: [...declarationsByExactProperty.values()] } };\n}\n\nfunction declarationsHaveExactKeyAliases(declarations: readonly LiteralStyleDeclaration[]): boolean {\n const exactKeyByAppliedProperty = new Map<string, string>();\n for (const declaration of declarations) {\n const normalized = normalizeProperty(declaration.property);\n if (normalized === undefined) continue;\n const previous = exactKeyByAppliedProperty.get(normalized.property);\n if (previous !== undefined && previous !== declaration.property) return true;\n exactKeyByAppliedProperty.set(normalized.property, declaration.property);\n }\n return false;\n}\n\nexport function responsiveStyleValuesHaveExactKeyAliases(values: readonly string[]): boolean {\n const declarations: LiteralStyleDeclaration[] = [];\n for (const value of values) {\n const transformed = transformUpstreamRawList(value);\n if (transformed.status === 'parsed') declarations.push(...transformed.value.declarations);\n }\n return declarationsHaveExactKeyAliases(declarations);\n}\n\nfunction normalizeDeclaration(\n declaration: LiteralStyleDeclaration,\n evidence: SourcePropertyEvidence,\n): LiteralStyleDeclaration | undefined {\n const normalized = normalizeProperty(declaration.property);\n if (!normalized || !declaration.value) return undefined;\n if (\n sanitizerSensitiveFunction.test(declaration.value) ||\n targetBuildFunction.test(declaration.value) ||\n urlScheme.test(declaration.value)\n )\n return undefined;\n const value =\n normalized.unit === undefined\n ? declaration.value\n : unitlessNumber.test(declaration.value)\n ? `${declaration.value}${normalized.unit}`\n : undefined;\n if (value === undefined) return undefined;\n const result = { property: normalized.property, value };\n return evidence.classifyStyleDeclaration(result).status === 'verified' ? result : undefined;\n}\n\nexport function parseLiteralResponsiveStyleValue(\n value: string,\n evidence: SourcePropertyEvidence,\n): ResponsiveStyleValueResult {\n const transformed = transformUpstreamRawList(value);\n if (transformed.status === 'unverified') return transformed;\n if (declarationsHaveExactKeyAliases(transformed.value.declarations)) {\n return { status: 'unverified', reason: responsiveStyleExactKeyAliasReason };\n }\n const declarationsByProperty = new Map<string, LiteralStyleDeclaration>();\n for (const declaration of transformed.value.declarations) {\n const normalized = normalizeDeclaration(declaration, evidence);\n if (!normalized) {\n const priorityText = evidence.classifyStyleDeclaration(declaration);\n return {\n status: 'unverified',\n reason:\n priorityText.status === 'unverified' && priorityText.priorityText\n ? `The declaration for ${JSON.stringify(declaration.property)} contains priority text that Angular NgStyle does not apply.`\n : `The declaration for ${JSON.stringify(declaration.property)} cannot be sanitized and encoded exactly.`,\n };\n }\n declarationsByProperty.set(normalized.property, normalized);\n }\n const declarations = [...declarationsByProperty.values()];\n for (const [index, declaration] of declarations.entries()) {\n const overlapping = declarations\n .slice(index + 1)\n .find(candidate => cssPropertiesOverlap(declaration.property, candidate.property));\n if (overlapping !== undefined) {\n return {\n status: 'unverified',\n reason: `The properties ${JSON.stringify(declaration.property)} and ${JSON.stringify(overlapping.property)} have overlapping CSS property ownership.`,\n };\n }\n }\n return { status: 'parsed', value: { declarations } };\n}\n\nexport function parseResponsiveStyleValue(\n input: LocatedFlexLayoutInput,\n evidence: SourcePropertyEvidence,\n): ResponsiveStyleValueResult {\n if (input.binding !== 'literal') {\n return { status: 'unverified', reason: 'Responsive style property bindings may depend on runtime state.' };\n }\n if (input.directive !== 'ngStyle') {\n return { status: 'unverified', reason: 'Deprecated responsive style aliases are not converted.' };\n }\n if (!input.breakpoint) return { status: 'unverified', reason: 'A responsive style alias is required.' };\n if (interpolation.test(input.value)) {\n return { status: 'unverified', reason: 'Responsive style interpolation may depend on runtime state.' };\n }\n return parseLiteralResponsiveStyleValue(input.value, evidence);\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport {\n BreakpointCatalog,\n mediaDefinitionsIntersect,\n type BreakpointClassification,\n} from '../../breakpoint/breakpoint-catalog';\nimport type { UnresolvedSemanticPlan } from '../semantic-plan';\nimport type {\n ExtendedFamilyPlan,\n ExtendedFamilyPlanRequest,\n ExtendedResponsiveKind,\n ExtendedResponsiveState,\n} from './responsive-class.model';\nimport {\n responsiveStyleExactKeyAliasReason,\n responsiveStyleValuesHaveExactKeyAliases,\n} from './responsive-style-value.parser';\n\ntype ClassifiedMember<T> =\n | { readonly input: LocatedFlexLayoutInput; readonly state: ExtendedResponsiveState<T> }\n | { readonly input: LocatedFlexLayoutInput; readonly plan: UnresolvedSemanticPlan };\n\ntype ClassifiedState<T> = Extract<ClassifiedMember<T>, { readonly state: ExtendedResponsiveState<T> }>;\n\nfunction dynamicBinding(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'dynamic-binding',\n reason: 'Angular property bindings and interpolation may depend on runtime state.',\n suggestion: 'Replace the binding manually or make it a literal before migration.',\n };\n}\n\nfunction deprecatedAlias(input: LocatedFlexLayoutInput, kind: ExtendedResponsiveKind): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'semantic-unsupported',\n reason: `Deprecated responsive ${kind} aliases have version-dependent behavior.`,\n suggestion: `Keep the deprecated alias or migrate the complete responsive ${kind} family manually.`,\n };\n}\n\nfunction unresolvedBreakpoint(\n input: LocatedFlexLayoutInput,\n classification: Exclude<BreakpointClassification, { readonly kind: 'verified' }>,\n): UnresolvedSemanticPlan {\n if (classification.kind === 'custom') {\n return {\n status: 'review',\n input,\n code: 'custom-breakpoint',\n reason: `The breakpoint alias ${classification.alias} may be registered by the project.`,\n suggestion: 'Provide its media query or migrate this responsive family manually.',\n };\n }\n\n const kind = classification.kind === 'print' ? 'print' : 'optional';\n return {\n status: 'review',\n input,\n code: 'breakpoint-unverified',\n reason: `The ${kind} breakpoint alias ${classification.alias} is not enabled by explicit migration configuration.`,\n suggestion:\n classification.kind === 'print'\n ? 'Verify the source printWithBreakpoints value, then rerun with --print-with-breakpoints.'\n : 'Verify that the source enables orientation breakpoints, then rerun with --orientation-breakpoints.',\n };\n}\n\nfunction unverifiedValue(\n input: LocatedFlexLayoutInput,\n kind: ExtendedResponsiveKind,\n token: string | undefined,\n reason: string,\n): UnresolvedSemanticPlan {\n if (kind === 'style') {\n return {\n status: 'review',\n input,\n code: 'style-value-unverified',\n reason,\n suggestion: 'Keep the complete responsive style family or replace unsafe declarations before migration.',\n };\n }\n\n return {\n status: 'review',\n input,\n code: 'tailwind-candidate-unverified',\n reason:\n token === undefined\n ? reason\n : `The first unverified token is ${JSON.stringify(token)}. It may be an application or plugin class. ${reason}`,\n suggestion: 'Keep the complete responsive class family or replace unverified classes before migration.',\n };\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Another member of this responsive family is unresolved.',\n suggestion: 'Migrate the complete responsive family together manually.',\n };\n}\n\nfunction responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'responsive-precedence-unverified',\n reason: 'The responsive family contains different values in intersecting activation ranges.',\n suggestion: 'Make intersecting values identical or migrate the complete responsive family manually.',\n };\n}\n\nfunction compareText(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n\nexport class ExtendedFamilyPlanner {\n constructor(private readonly catalog = new BreakpointCatalog()) {}\n\n plan<T>(request: ExtendedFamilyPlanRequest<T>): ExtendedFamilyPlan<T> {\n const members = request.inputs\n .map(input => this.classify(input, request.kind, request.valueParser))\n .sort((left, right) => this.compare(left.input, right.input));\n\n if (!members.every((member): member is ClassifiedState<T> => 'state' in member)) {\n return {\n status: 'unresolved',\n plans: members.map(member => ('plan' in member ? member.plan : contextUnverified(member.input))),\n };\n }\n\n const states = members.map(member => member.state);\n if (request.kind === 'style' && responsiveStyleValuesHaveExactKeyAliases(states.map(state => state.input.value))) {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n unverifiedValue(state.input, request.kind, undefined, responsiveStyleExactKeyAliasReason),\n ),\n };\n }\n if (this.hasConflictingStates(states, request.equals)) {\n return {\n status: 'unresolved',\n plans: states.map(state => responsivePrecedenceUnverified(state.input)),\n };\n }\n\n return { status: 'converted', states };\n }\n\n private classify<T>(\n input: LocatedFlexLayoutInput,\n kind: ExtendedResponsiveKind,\n valueParser: ExtendedFamilyPlanRequest<T>['valueParser'],\n ): ClassifiedMember<T> {\n if (input.binding !== 'literal' || /\\{\\{[\\s\\S]*\\}\\}/u.test(input.value)) {\n return { input, plan: dynamicBinding(input) };\n }\n const expectedDirective = kind === 'class' ? 'ngClass' : 'ngStyle';\n if (input.directive !== expectedDirective) return { input, plan: deprecatedAlias(input, kind) };\n if (input.breakpoint === undefined) return { input, plan: deprecatedAlias(input, kind) };\n\n const breakpoint = this.catalog.classify(input.breakpoint);\n if (breakpoint.kind !== 'verified') return { input, plan: unresolvedBreakpoint(input, breakpoint) };\n\n const parsed = valueParser(input);\n if (parsed.status === 'unverified') {\n return { input, plan: unverifiedValue(input, kind, parsed.token, parsed.reason) };\n }\n\n return {\n input,\n state: {\n input,\n activation: { kind: 'media', definition: breakpoint.definition },\n value: parsed.value,\n },\n };\n }\n\n private hasConflictingStates<T>(\n states: readonly ExtendedResponsiveState<T>[],\n equals: (left: T, right: T) => boolean,\n ): boolean {\n return states.some((left, leftIndex) =>\n states\n .slice(leftIndex + 1)\n .some(\n right =>\n !equals(left.value, right.value) &&\n mediaDefinitionsIntersect(left.activation.definition.media, right.activation.definition.media),\n ),\n );\n }\n\n private compare(left: LocatedFlexLayoutInput, right: LocatedFlexLayoutInput): number {\n const leftPriority = this.breakpointPriority(left.breakpoint);\n const rightPriority = this.breakpointPriority(right.breakpoint);\n if (leftPriority !== rightPriority) return rightPriority - leftPriority;\n\n const aliasOrder = compareText(left.breakpoint ?? '', right.breakpoint ?? '');\n return aliasOrder || compareText(left.id, right.id);\n }\n\n private breakpointPriority(alias: string | undefined): number {\n if (alias === undefined) return Number.NEGATIVE_INFINITY;\n const classification = this.catalog.classify(alias);\n return classification.kind === 'verified' ? classification.definition.priority : Number.NEGATIVE_INFINITY;\n }\n}\n","const cssWhitespace = /[\\t\\n\\f\\r ]/u;\nconst hexDigit = /[\\da-f]/iu;\n\nexport interface LiteralStyleDeclaration {\n readonly property: string;\n readonly value: string;\n}\n\nexport type LiteralStyleParseResult =\n | { readonly status: 'parsed'; readonly declarations: readonly LiteralStyleDeclaration[] }\n | { readonly status: 'unverified'; readonly reason: string };\n\nfunction splitDeclarations(value: string): readonly string[] | undefined {\n const declarations: string[] = [];\n let current = '';\n let quote: '\"' | \"'\" | undefined;\n let parentheses = 0;\n let brackets = 0;\n let braces = 0;\n\n for (let index = 0; index < value.length; index += 1) {\n const character = value[index];\n const next = value[index + 1];\n if (character === undefined) continue;\n\n if (quote) {\n current += character;\n if (character === '\\\\') {\n if (next === undefined) return undefined;\n current += next;\n index += 1;\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '/' && next === '*') {\n const commentEnd = value.indexOf('*/', index + 2);\n if (commentEnd < 0) return undefined;\n current += ' ';\n index = commentEnd + 1;\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n current += character;\n continue;\n }\n if (character === '\\\\') {\n if (next === undefined || next === '\\n' || next === '\\r' || next === '\\f') return undefined;\n current += character + next;\n index += 1;\n continue;\n }\n\n if (character === '(') parentheses += 1;\n else if (character === ')') {\n if (parentheses === 0) return undefined;\n parentheses -= 1;\n } else if (character === '[') brackets += 1;\n else if (character === ']') {\n if (brackets === 0) return undefined;\n brackets -= 1;\n } else if (character === '{') braces += 1;\n else if (character === '}') {\n if (braces === 0) return undefined;\n braces -= 1;\n }\n\n if (character === ';' && parentheses === 0 && brackets === 0 && braces === 0) {\n declarations.push(current);\n current = '';\n } else {\n current += character;\n }\n }\n\n if (quote || parentheses !== 0 || brackets !== 0 || braces !== 0) return undefined;\n declarations.push(current);\n return declarations;\n}\n\nfunction declarationColon(declaration: string): number | undefined {\n let quote: '\"' | \"'\" | undefined;\n let parentheses = 0;\n let brackets = 0;\n let braces = 0;\n\n for (let index = 0; index < declaration.length; index += 1) {\n const character = declaration[index];\n if (character === undefined) continue;\n if (quote) {\n if (character === '\\\\') index += 1;\n else if (character === quote) quote = undefined;\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n if (character === '\\\\') {\n index += 1;\n continue;\n }\n if (character === '(') parentheses += 1;\n else if (character === ')') parentheses -= 1;\n else if (character === '[') brackets += 1;\n else if (character === ']') brackets -= 1;\n else if (character === '{') braces += 1;\n else if (character === '}') braces -= 1;\n else if (character === ':' && parentheses === 0 && brackets === 0 && braces === 0) return index;\n }\n return undefined;\n}\n\nfunction decodeIdentifier(value: string): string | undefined {\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n\n let decoded = '';\n for (let index = 0; index < trimmed.length; index += 1) {\n const character = trimmed[index];\n if (character === undefined) continue;\n if (cssWhitespace.test(character)) return undefined;\n if (character !== '\\\\') {\n decoded += character;\n continue;\n }\n\n const next = trimmed[index + 1];\n if (next === undefined || next === '\\n' || next === '\\r' || next === '\\f') return undefined;\n let hex = '';\n let cursor = index + 1;\n while (hex.length < 6 && cursor < trimmed.length && hexDigit.test(trimmed[cursor] ?? '')) {\n hex += trimmed[cursor];\n cursor += 1;\n }\n if (hex) {\n const codePoint = Number.parseInt(hex, 16);\n decoded +=\n codePoint === 0 || codePoint > 0x10ffff || (codePoint >= 0xd800 && codePoint <= 0xdfff)\n ? '\\uFFFD'\n : String.fromCodePoint(codePoint);\n if (cssWhitespace.test(trimmed[cursor] ?? '')) {\n if (trimmed[cursor] === '\\r' && trimmed[cursor + 1] === '\\n') cursor += 1;\n cursor += 1;\n }\n index = cursor - 1;\n continue;\n }\n\n decoded += next;\n index += 1;\n }\n return decoded;\n}\n\nexport function literalStyleMayControlDisplay(value: string): boolean {\n const result = parseLiteralStyleDeclarations(value);\n if (result.status === 'unverified') return true;\n\n return result.declarations.some(declaration => declaration.property.toLowerCase() === 'display');\n}\n\nexport function parseLiteralStyleDeclarations(value: string): LiteralStyleParseResult {\n const segments = splitDeclarations(value);\n if (!segments) {\n return { status: 'unverified', reason: 'The literal style has malformed or unbalanced delimiters.' };\n }\n\n const declarations: LiteralStyleDeclaration[] = [];\n\n for (const segment of segments) {\n if (!segment.trim()) continue;\n const colon = declarationColon(segment);\n if (colon === undefined) {\n return { status: 'unverified', reason: 'A literal style declaration is missing its property separator.' };\n }\n const property = decodeIdentifier(segment.slice(0, colon));\n if (!property) {\n return { status: 'unverified', reason: 'A literal style declaration has an ambiguous property name.' };\n }\n declarations.push({ property, value: segment.slice(colon + 1).trim() });\n }\n\n return { status: 'parsed', declarations };\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport type { SourceClassTokenEvidence, SourcePropertyEvidence } from '../source-property-evidence';\n\nexport interface SemanticResponsiveClassValue {\n readonly tokens: readonly SourceClassTokenEvidence[];\n}\n\nexport type SemanticResponsiveClassValueResult =\n | { readonly status: 'parsed'; readonly value: SemanticResponsiveClassValue }\n | { readonly status: 'unverified'; readonly token?: string; readonly reason: string };\n\nconst interpolation = /\\{\\{[\\s\\S]*\\}\\}/u;\n\nexport function parseLiteralResponsiveClassValue(\n value: string,\n evidence: SourcePropertyEvidence,\n): SemanticResponsiveClassValueResult {\n if (interpolation.test(value)) {\n return { status: 'unverified', reason: 'Responsive class interpolation may depend on runtime state.' };\n }\n const sources = [...new Set(value.split(/\\s+/u).filter(Boolean))];\n const tokens: SourceClassTokenEvidence[] = [];\n for (const source of sources) {\n const classification = evidence.classifyClassToken(source);\n if (classification.status === 'unverified') {\n return {\n status: 'unverified',\n token: source,\n reason: `The class token ${JSON.stringify(source)} is not a compiler-proven built-in Tailwind utility and may be an application or plugin class. ${classification.reason}`,\n };\n }\n tokens.push(classification.evidence);\n }\n return { status: 'parsed', value: { tokens } };\n}\n\nexport function parseResponsiveClassValue(\n input: LocatedFlexLayoutInput,\n evidence: SourcePropertyEvidence,\n): SemanticResponsiveClassValueResult {\n if (input.binding !== 'literal') {\n return { status: 'unverified', reason: 'Responsive class property bindings may depend on runtime state.' };\n }\n if (input.directive !== 'ngClass') {\n return { status: 'unverified', reason: 'Deprecated responsive class aliases are not converted.' };\n }\n if (!input.breakpoint) return { status: 'unverified', reason: 'A responsive class alias is required.' };\n return parseLiteralResponsiveClassValue(input.value, evidence);\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport { templateAttributeKeys } from '../../template/template-attribute';\nimport type { TemplateAttribute } from '../../template/template.model';\nimport { cssPropertiesOverlap } from '../css-property-ownership';\nimport { parseLiteralStyleDeclarations } from '../literal-style-declaration';\nimport type { SourceClassTokenEvidence, SourcePropertyEvidence } from '../source-property-evidence';\nimport type { UnresolvedSemanticPlan } from '../semantic-plan';\nimport type { ExtendedFamilyPlan, ExtendedResponsiveState } from './responsive-class.model';\nimport { parseLiteralResponsiveClassValue, type SemanticResponsiveClassValue } from './responsive-class-value.parser';\nimport type { ResponsiveStyleValue } from './responsive-style.model';\nimport {\n parseLiteralResponsiveStyleValue,\n responsiveStyleExactKeyAliasReason,\n responsiveStyleValuesHaveExactKeyAliases,\n} from './responsive-style-value.parser';\n\ninterface ExtendedSemanticRequestBase {\n readonly attributes: readonly TemplateAttribute[];\n}\n\nexport type ExtendedSemanticPlanRequest =\n | (ExtendedSemanticRequestBase & {\n readonly kind: 'class';\n readonly familyPlan: ExtendedFamilyPlan<SemanticResponsiveClassValue>;\n })\n | (ExtendedSemanticRequestBase & {\n readonly kind: 'style';\n readonly familyPlan: ExtendedFamilyPlan<ResponsiveStyleValue>;\n });\n\nexport type ExtendedSemanticPlan =\n | {\n readonly status: 'resolved';\n readonly ownerInputId?: string;\n readonly retainedTokens: readonly SourceClassTokenEvidence[];\n }\n | { readonly status: 'unresolved'; readonly plans: readonly UnresolvedSemanticPlan[] };\n\ntype AnyExtendedState =\n ExtendedResponsiveState<SemanticResponsiveClassValue> | ExtendedResponsiveState<ResponsiveStyleValue>;\n\nfunction boundClassAuthority(attribute: TemplateAttribute): boolean {\n if (attribute.binding !== 'property') return false;\n if (attribute.bindingTarget === 'class') return true;\n return [...templateAttributeKeys(attribute)].some(\n key =>\n key === 'class' ||\n key === 'ngclass' ||\n key === 'attr.class' ||\n key.startsWith('class.') ||\n key.startsWith('ngclass.') ||\n key.startsWith('attr.class.'),\n );\n}\n\nfunction boundStyleAuthority(attribute: TemplateAttribute): boolean {\n if (attribute.binding !== 'property') return false;\n if (attribute.bindingTarget === 'style') return true;\n return [...templateAttributeKeys(attribute)].some(\n key =>\n key === 'style' ||\n key === 'ngstyle' ||\n key === 'attr.style' ||\n key.startsWith('style.') ||\n key.startsWith('ngstyle.') ||\n key.startsWith('attr.style.'),\n );\n}\n\nfunction literalStyleAuthority(attribute: TemplateAttribute): boolean {\n return attribute.binding === 'literal' && templateAttributeKeys(attribute).has('style');\n}\n\nfunction unsuffixedAuthority(\n attributes: readonly TemplateAttribute[],\n key: 'ngclass' | 'ngstyle',\n): TemplateAttribute | undefined {\n return attributes.find(attribute => templateAttributeKeys(attribute).has(key));\n}\n\nfunction equalClassValues(left: SemanticResponsiveClassValue, right: SemanticResponsiveClassValue): boolean {\n return (\n left.tokens.length === right.tokens.length &&\n left.tokens.every((token, index) => token.source === right.tokens[index]?.source)\n );\n}\n\nfunction diagnostic(\n input: LocatedFlexLayoutInput,\n code: 'bound-class' | 'class-conflict' | 'tailwind-candidate-unverified' | 'style-value-unverified',\n reason: string,\n suggestion: string,\n): UnresolvedSemanticPlan {\n return { status: 'review', input, code, reason, suggestion };\n}\n\nexport class ExtendedSemanticPlanner {\n constructor(private readonly evidence: SourcePropertyEvidence) {}\n\n plan(request: ExtendedSemanticPlanRequest): ExtendedSemanticPlan {\n if (request.familyPlan.status === 'unresolved') {\n return { status: 'unresolved', plans: request.familyPlan.plans };\n }\n if (request.kind === 'class') return this.planClass(request.familyPlan.states, request.attributes);\n return this.planStyle(request.familyPlan.states, request.attributes);\n }\n\n private planClass(\n states: readonly ExtendedResponsiveState<SemanticResponsiveClassValue>[],\n attributes: readonly TemplateAttribute[],\n ): ExtendedSemanticPlan {\n const fallback = unsuffixedAuthority(attributes, 'ngclass');\n if (fallback !== undefined) {\n if (fallback.binding !== 'literal') {\n return this.unresolved(\n states,\n 'bound-class',\n 'A bound unsuffixed ngClass value is the runtime fallback for this responsive family.',\n 'Make the complete ngClass family literal or migrate its replacement behavior manually.',\n );\n }\n const parsed = parseLiteralResponsiveClassValue(fallback.value, this.evidence);\n if (parsed.status === 'unverified') {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n diagnostic(\n state.input,\n 'tailwind-candidate-unverified',\n `The unsuffixed ngClass fallback cannot be translated exactly. ${parsed.reason}`,\n 'Keep the complete ngClass family or replace the fallback with proven Tailwind candidates.',\n ),\n ),\n };\n }\n if (parsed.value.tokens.length > 0) {\n if (states.every(state => equalClassValues(state.value, parsed.value))) {\n return { status: 'resolved', retainedTokens: parsed.value.tokens };\n }\n return this.unresolved(\n states,\n 'class-conflict',\n 'The literal unsuffixed ngClass fallback is replaced, not merged, when a responsive value activates.',\n 'Migrate the complete ngClass fallback and responsive replacement family manually.',\n );\n }\n }\n\n const hasOutput = states.some(state => state.value.tokens.length > 0);\n if (hasOutput && attributes.some(boundClassAuthority)) {\n return this.unresolved(\n states,\n 'bound-class',\n 'Generated responsive classes cannot be merged safely with a bound class value.',\n 'Merge the generated classes into the class binding manually.',\n );\n }\n return {\n status: 'resolved',\n ...(hasOutput && states[0] !== undefined ? { ownerInputId: states[0].input.id } : {}),\n retainedTokens: [],\n };\n }\n\n private planStyle(\n states: readonly ExtendedResponsiveState<ResponsiveStyleValue>[],\n attributes: readonly TemplateAttribute[],\n ): ExtendedSemanticPlan {\n if (responsiveStyleValuesHaveExactKeyAliases(states.map(state => state.input.value))) {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n diagnostic(\n state.input,\n 'style-value-unverified',\n responsiveStyleExactKeyAliasReason,\n 'Keep the complete responsive style family or normalize its exact property key before migration.',\n ),\n ),\n };\n }\n const fallback = unsuffixedAuthority(attributes, 'ngstyle');\n if (fallback !== undefined) {\n if (fallback.binding !== 'literal') {\n return this.unresolved(\n states,\n 'class-conflict',\n 'A bound unsuffixed ngStyle value is the runtime fallback for this responsive family.',\n 'Make the complete ngStyle family literal or migrate its replacement behavior manually.',\n );\n }\n const parsed = parseLiteralResponsiveStyleValue(fallback.value, this.evidence);\n if (parsed.status === 'unverified') {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n diagnostic(\n state.input,\n 'style-value-unverified',\n `The unsuffixed ngStyle fallback cannot be translated exactly. ${parsed.reason}`,\n 'Keep the complete ngStyle family or replace the fallback with an exact literal style map.',\n ),\n ),\n };\n }\n if (parsed.value.declarations.length > 0 || fallback.value.length > 0) {\n return this.unresolved(\n states,\n 'class-conflict',\n 'The literal unsuffixed ngStyle raw-string fallback is replaced at runtime and cannot remain after Flex-Layout is removed.',\n 'Translate and remove the complete ngStyle fallback together with its responsive replacement family.',\n );\n }\n }\n\n const hasOutput = states.some(state => state.value.declarations.length > 0);\n if (hasOutput && attributes.some(boundClassAuthority)) {\n return this.unresolved(\n states,\n 'bound-class',\n 'Generated responsive classes cannot be merged safely with a bound class value.',\n 'Merge the generated classes into the class binding manually.',\n );\n }\n if (hasOutput && attributes.some(boundStyleAuthority)) {\n return this.unresolved(\n states,\n 'class-conflict',\n 'A bound style authority may control a property generated by this responsive style family.',\n 'Remove or reconcile the bound style before migrating this family.',\n );\n }\n const generatedProperties = new Set(\n states.flatMap(state => state.value.declarations.map(declaration => declaration.property)),\n );\n if (hasOutput && this.literalStyleConflicts(attributes, generatedProperties)) {\n return this.unresolved(\n states,\n 'class-conflict',\n 'A literal fallback style may control a property generated by this responsive style family.',\n 'Remove or reconcile the overlapping fallback declaration before migrating this family.',\n );\n }\n return {\n status: 'resolved',\n ...(hasOutput && states[0] !== undefined ? { ownerInputId: states[0].input.id } : {}),\n retainedTokens: [],\n };\n }\n\n private literalStyleConflicts(\n attributes: readonly TemplateAttribute[],\n generatedProperties: ReadonlySet<string>,\n ): boolean {\n return attributes.filter(literalStyleAuthority).some(attribute => {\n const parsed = parseLiteralStyleDeclarations(attribute.value);\n if (parsed.status === 'unverified') return true;\n return parsed.declarations.some(declaration =>\n [...generatedProperties].some(property => cssPropertiesOverlap(declaration.property, property)),\n );\n });\n }\n\n private unresolved(\n states: readonly AnyExtendedState[],\n code: 'bound-class' | 'class-conflict',\n reason: string,\n suggestion: string,\n ): ExtendedSemanticPlan {\n return {\n status: 'unresolved',\n plans: states.map(state => diagnostic(state.input, code, reason, suggestion)),\n };\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { mediaRangesIntersect, type BreakpointCatalog, type MediaRange } from '../breakpoint/breakpoint-catalog';\nimport type { FlexFillSemantics } from '../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../flex/flex-offset.semantic';\nimport type { LayoutAlignmentSemantics } from '../flex/layout-align.semantic';\nimport type { LayoutSemantics } from '../flex/layout.semantic';\nimport type { GridSemanticPlan } from '../grid/grid-semantic.model';\nimport { templateAttributeKeys } from '../template/template-attribute';\nimport type { SemanticConversionContext } from './conversion-context';\nimport { cssPropertiesOverlap, cssPropertyOwnershipCovers } from './css-property-ownership';\nimport { literalStyleMayControlDisplay, parseLiteralStyleDeclarations } from './literal-style-declaration';\nimport {\n directiveFamily,\n type DirectiveFamily,\n type ExtendedClassSemantics,\n type ExtendedStyleSemantics,\n type ResolvedSemanticPlan,\n type UnresolvedSemanticPlan,\n type SemanticActivation,\n type SuppressedSemanticEffect,\n type VisibilitySemantics,\n} from './semantic-plan';\nimport { type SourceClassTokenEvidence, type SourcePropertyEvidence } from './source-property-evidence';\n\nexport type SemanticCompositionPlan = ResolvedSemanticPlan | UnresolvedSemanticPlan;\n\ntype PropertyAuthority = 'source-class' | 'source-inline' | 'semantic-replacement';\n\ninterface PropertyEffect {\n readonly planId: string;\n readonly family: DirectiveFamily;\n readonly activation: SemanticActivation;\n readonly properties: readonly string[];\n readonly important: boolean;\n readonly authority: PropertyAuthority;\n readonly suppressible: boolean;\n readonly retained: boolean;\n readonly signature: string;\n readonly display?: { readonly intent: 'shown' | 'hidden' | 'unverified'; readonly value?: string };\n}\n\ninterface SourceAuthority {\n readonly input: LocatedFlexLayoutInput;\n readonly family: 'extended-class' | 'extended-style';\n readonly range: MediaRange;\n readonly properties: readonly string[] | undefined;\n readonly mayControlDisplay: boolean;\n}\n\ninterface NumericRange {\n readonly min: number;\n readonly max: number;\n}\n\nconst extendedClassDirectives = new Set<LocatedFlexLayoutInput['directive']>(['class', 'ngClass']);\nconst extendedStyleDirectives = new Set<LocatedFlexLayoutInput['directive']>(['style', 'ngStyle']);\nconst restorationDisplays = new Set([\n 'inline',\n 'block',\n 'inline-block',\n 'flow-root',\n 'flex',\n 'inline-flex',\n 'grid',\n 'inline-grid',\n 'contents',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-column',\n 'table-column-group',\n 'table-footer-group',\n 'table-header-group',\n 'table-row-group',\n 'table-row',\n 'list-item',\n]);\n\nfunction numericRange(range: MediaRange): NumericRange {\n return {\n min: range.min ?? Number.NEGATIVE_INFINITY,\n max: range.max ?? Number.POSITIVE_INFINITY,\n };\n}\n\nfunction activationRange(activation: SemanticActivation): MediaRange {\n return activation.kind === 'base' ? {} : activation.definition.range;\n}\n\nfunction sameActivation(left: SemanticActivation, right: SemanticActivation): boolean {\n if (left.kind !== right.kind) return false;\n if (left.kind === 'base' || right.kind === 'base') return true;\n return (\n left.definition.range.min === right.definition.range.min && left.definition.range.max === right.definition.range.max\n );\n}\n\nfunction rangesCover(target: MediaRange, ranges: readonly MediaRange[]): boolean {\n const numericTarget = numericRange(target);\n const clipped = ranges\n .filter(range => mediaRangesIntersect(target, range))\n .map(range => {\n const numeric = numericRange(range);\n return {\n min: Math.max(numericTarget.min, numeric.min),\n max: Math.min(numericTarget.max, numeric.max),\n };\n })\n .sort((left, right) => left.min - right.min);\n const first = clipped[0];\n if (!first || first.min !== numericTarget.min) return false;\n let coveredUntil = first.max;\n for (const range of clipped.slice(1)) {\n if (range.min > coveredUntil) return false;\n coveredUntil = Math.max(coveredUntil, range.max);\n }\n return coveredUntil >= numericTarget.max;\n}\n\nfunction propertySetsOverlap(left: readonly string[], right: readonly string[]): boolean {\n return left.some(leftProperty => right.some(rightProperty => cssPropertiesOverlap(leftProperty, rightProperty)));\n}\n\nfunction propertiesEqual(left: readonly string[], right: readonly string[]): boolean {\n return left.length === right.length && left.every((property, index) => property === right[index]);\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput, reason: string): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason,\n suggestion: 'Migrate the coupled responsive families together manually.',\n };\n}\n\nfunction generatedOwnershipUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Generated responsive families have overlapping CSS ownership without one provable precedence.',\n suggestion: 'Migrate the coupled responsive families together manually.',\n };\n}\n\nfunction displayRestorationUnverified(input: LocatedFlexLayoutInput, reason: string): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'display-restoration-unverified',\n reason,\n suggestion: 'Provide one unambiguous visible display value or migrate this visibility family manually.',\n };\n}\n\nfunction partialDisplayContextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Partially overlapping responsive layout and visibility displays have unverified cascade precedence.',\n suggestion: 'Migrate the coupled layout and visibility ranges together manually.',\n };\n}\n\nfunction authority(family: DirectiveFamily): PropertyAuthority {\n if (family === 'extended-class') return 'source-class';\n if (\n family === 'extended-style' ||\n family === 'layout' ||\n family === 'layout-align' ||\n family === 'flex-item' ||\n family === 'flex-align' ||\n family === 'flex-fill' ||\n family === 'flex-offset' ||\n family === 'flex-order' ||\n family === 'visibility'\n ) {\n return 'source-inline';\n }\n return 'semantic-replacement';\n}\n\nfunction displayIntent(value: string | undefined): PropertyEffect['display'] {\n if (value === undefined) return undefined;\n if (value === 'none') return { intent: 'hidden', value };\n return restorationDisplays.has(value) ? { intent: 'shown', value } : { intent: 'unverified', value };\n}\n\nfunction makeEffect(\n plan: ResolvedSemanticPlan,\n activation: SemanticActivation,\n properties: readonly string[],\n signature: string,\n options: {\n readonly important?: boolean;\n readonly suppressible?: boolean;\n readonly retained?: boolean;\n readonly display?: PropertyEffect['display'];\n } = {},\n): PropertyEffect {\n return {\n planId: plan.input.id,\n family: plan.family,\n activation,\n properties,\n important: options.important ?? false,\n authority: authority(plan.family),\n suppressible: options.suppressible ?? false,\n retained: options.retained ?? false,\n signature,\n ...(options.display === undefined ? {} : { display: options.display }),\n };\n}\n\nfunction ordinaryPropertyGroups(\n plan: ResolvedSemanticPlan,\n): readonly { properties: readonly string[]; signature: string; display?: PropertyEffect['display'] }[] {\n switch (plan.family) {\n case 'layout': {\n const value = plan.value as LayoutSemantics;\n return [\n { properties: ['display'], signature: value.display, display: displayIntent(value.display) },\n { properties: ['flex-direction'], signature: value.direction },\n ...(value.explicitWrap ? [{ properties: ['flex-wrap'], signature: value.wrap }] : []),\n { properties: ['box-sizing'], signature: value.boxSizing },\n ];\n }\n case 'layout-gap':\n return [{ properties: ['gap'], signature: 'gap' }];\n case 'layout-align': {\n const value = plan.value as LayoutAlignmentSemantics;\n return [\n { properties: ['justify-content'], signature: value.main },\n { properties: ['align-items'], signature: value.items },\n { properties: ['align-content'], signature: value.content },\n { properties: ['display'], signature: value.layout.display, display: displayIntent(value.layout.display) },\n { properties: ['flex-direction'], signature: value.layout.direction },\n ...(value.layout.explicitWrap ? [{ properties: ['flex-wrap'], signature: value.layout.wrap }] : []),\n { properties: ['box-sizing'], signature: value.layout.boxSizing },\n ...(value.stretchMaximum === undefined\n ? []\n : [{ properties: [`max-${value.stretchMaximum}`], signature: '100%' }]),\n ];\n }\n case 'flex-item': {\n const value = plan.value as FlexItemSemantics;\n const flex =\n value.basis.kind === 'computed'\n ? [\n { properties: ['flex-grow'], signature: value.grow },\n { properties: ['flex-shrink'], signature: value.shrink },\n { properties: ['flex-basis'], signature: value.basis.value },\n ]\n : [{ properties: ['flex'], signature: `${value.grow} ${value.shrink} ${value.basis.value}` }];\n return [\n ...flex,\n ...(value.min === undefined ? [] : [{ properties: [`min-${value.axis}`], signature: value.min }]),\n ...(value.max === undefined ? [] : [{ properties: [`max-${value.axis}`], signature: value.max }]),\n { properties: ['box-sizing'], signature: value.boxSizing },\n ];\n }\n case 'flex-align':\n return [{ properties: ['align-self'], signature: 'align-self' }];\n case 'flex-fill': {\n const value = plan.value as FlexFillSemantics;\n return [\n { properties: ['margin'], signature: value.margin },\n { properties: ['width'], signature: value.width },\n { properties: ['height'], signature: value.height },\n { properties: ['min-width'], signature: value.minWidth },\n { properties: ['min-height'], signature: value.minHeight },\n ];\n }\n case 'flex-offset': {\n const value = plan.value as FlexOffsetSemantics;\n return [\n {\n properties: [value.axis === 'inline-start' ? 'margin-inline-start' : 'margin-top'],\n signature: value.length,\n },\n ];\n }\n case 'flex-order':\n return [{ properties: ['order'], signature: 'order' }];\n default: {\n const value = plan.value as GridSemanticPlan;\n if (!('declarations' in value)) return [];\n return [\n ...(value.role === 'container' && plan.emitGridDisplay !== false\n ? [{ properties: ['display'], signature: 'grid', display: displayIntent('grid') }]\n : value.role === 'modifier'\n ? [\n {\n properties: ['display'],\n signature: value.inline ? 'inline-grid' : 'grid',\n display: displayIntent(value.inline ? 'inline-grid' : 'grid'),\n },\n ]\n : []),\n ...value.declarations.map(declaration => ({\n properties: [declaration.property],\n signature: `${declaration.property}:${declaration.value}`,\n })),\n ];\n }\n }\n}\n\nfunction semanticEffects(plan: ResolvedSemanticPlan): readonly PropertyEffect[] {\n if (plan.family === 'visibility') return [];\n if (plan.family === 'extended-class') {\n const value = plan.value as ExtendedClassSemantics;\n const emitted = value.emit\n ? value.states.flatMap((state, stateIndex) =>\n state.activations.flatMap(activation =>\n state.tokens.flatMap((token, tokenIndex) => {\n if (token.properties.length === 0) return [];\n const controlsDisplay = token.properties.some(property => cssPropertiesOverlap(property, 'display'));\n return [\n makeEffect(plan, activation, token.properties, `class:${stateIndex}:${tokenIndex}:${token.source}`, {\n important: token.important,\n suppressible: true,\n display:\n token.display === undefined\n ? controlsDisplay\n ? { intent: 'unverified' }\n : undefined\n : displayIntent(token.display),\n }),\n ];\n }),\n ),\n )\n : [];\n const retained = value.retainedTokens.flatMap((token, tokenIndex) => {\n if (token.properties.length === 0) return [];\n const controlsDisplay = token.properties.some(property => cssPropertiesOverlap(property, 'display'));\n return [\n makeEffect(plan, { kind: 'base' }, token.properties, `retained:${tokenIndex}:${token.source}`, {\n important: token.important,\n retained: true,\n display:\n token.display === undefined\n ? controlsDisplay\n ? { intent: 'unverified' }\n : undefined\n : displayIntent(token.display),\n }),\n ];\n });\n return [...emitted, ...retained];\n }\n if (plan.family === 'extended-style') {\n const value = plan.value as ExtendedStyleSemantics;\n return value.emit\n ? value.states.flatMap((state, stateIndex) =>\n state.activations.flatMap(activation =>\n state.declarations.map((declaration, declarationIndex) =>\n makeEffect(\n plan,\n activation,\n [declaration.property],\n `style:${stateIndex}:${declarationIndex}:${declaration.property}:${declaration.value}`,\n {\n suppressible: true,\n display: cssPropertiesOverlap(declaration.property, 'display')\n ? declaration.property === 'display'\n ? displayIntent(declaration.value)\n : { intent: 'unverified' }\n : undefined,\n },\n ),\n ),\n ),\n )\n : [];\n }\n return plan.activations.flatMap(activation =>\n ordinaryPropertyGroups(plan).map(group =>\n makeEffect(plan, activation, group.properties, group.signature, { display: group.display }),\n ),\n );\n}\n\nfunction sourceAuthorities(\n plans: readonly SemanticCompositionPlan[],\n catalog: BreakpointCatalog,\n evidence: SourcePropertyEvidence,\n): readonly SourceAuthority[] {\n const authorities: SourceAuthority[] = [];\n for (const plan of plans) {\n const input = plan.input;\n const family = extendedClassDirectives.has(input.directive)\n ? 'extended-class'\n : extendedStyleDirectives.has(input.directive)\n ? 'extended-style'\n : undefined;\n if (family === undefined) continue;\n const classification = input.breakpoint === undefined ? undefined : catalog.classify(input.breakpoint);\n const range = classification?.kind === 'verified' ? classification.definition.range : {};\n if (input.binding !== 'literal') {\n authorities.push({ input, family, range, properties: undefined, mayControlDisplay: true });\n continue;\n }\n if (family === 'extended-class') {\n const tokens = input.value.split(/[\\t\\n\\f\\r ]+/u).filter(Boolean);\n const classifications = tokens.map(token => evidence.classifyClassToken(token));\n const properties = classifications.some(item => item.status === 'unverified')\n ? undefined\n : classifications.flatMap(item => (item.status === 'verified' ? item.evidence.properties : []));\n authorities.push({\n input,\n family,\n range,\n properties,\n mayControlDisplay:\n properties === undefined || properties.some(property => cssPropertiesOverlap(property, 'display')),\n });\n continue;\n }\n const parsed = parseLiteralStyleDeclarations(input.value);\n const properties =\n parsed.status === 'parsed' ? parsed.declarations.map(declaration => declaration.property) : undefined;\n authorities.push({\n input,\n family,\n range,\n properties,\n mayControlDisplay:\n properties === undefined || properties.some(property => cssPropertiesOverlap(property, 'display')),\n });\n }\n return authorities;\n}\n\nfunction isSuppressed(effect: PropertyEffect, plansById: ReadonlyMap<string, SemanticCompositionPlan>): boolean {\n const plan = plansById.get(effect.planId);\n if (plan?.status !== 'converted') return true;\n return (plan.suppressedEffects ?? []).some(\n suppression =>\n suppression.important === effect.important &&\n sameActivation(suppression.activation, effect.activation) &&\n propertiesEqual(suppression.properties, effect.properties),\n );\n}\n\nfunction addSuppression(plan: ResolvedSemanticPlan, effect: PropertyEffect): ResolvedSemanticPlan {\n const suppression: SuppressedSemanticEffect = {\n activation: effect.activation,\n properties: effect.properties,\n important: effect.important,\n };\n const existing = plan.suppressedEffects ?? [];\n return existing.some(\n item =>\n item.important === suppression.important &&\n sameActivation(item.activation, suppression.activation) &&\n propertiesEqual(item.properties, suppression.properties),\n )\n ? plan\n : { ...plan, suppressedEffects: [...existing, suppression] };\n}\n\nfunction updatePlans(\n plans: readonly SemanticCompositionPlan[],\n unsafeFamilies: ReadonlySet<DirectiveFamily>,\n diagnostic: (input: LocatedFlexLayoutInput) => UnresolvedSemanticPlan,\n suppressed: readonly PropertyEffect[] = [],\n): readonly SemanticCompositionPlan[] {\n const suppressedByPlan = new Map<string, PropertyEffect[]>();\n for (const effect of suppressed) {\n const items = suppressedByPlan.get(effect.planId) ?? [];\n items.push(effect);\n suppressedByPlan.set(effect.planId, items);\n }\n return plans.map(plan => {\n if (plan.status !== 'converted') return plan;\n if (unsafeFamilies.has(plan.family)) return diagnostic(plan.input);\n return (suppressedByPlan.get(plan.input.id) ?? []).reduce(addSuppression, plan);\n });\n}\n\nfunction attributeControlsDisplay(attribute: SemanticConversionContext['attributeEvidence'][number]): boolean {\n const keys = templateAttributeKeys(attribute);\n if (attribute.binding === 'literal') return keys.has('style') && literalStyleMayControlDisplay(attribute.value);\n return [...keys].some(\n key => key === 'style' || key === 'ngstyle' || key === 'style.display' || key.startsWith('style.display.'),\n );\n}\n\nfunction plainBaseDisplay(descriptor: SourceClassTokenEvidence): boolean {\n return descriptor.activation.kind === 'base' && !descriptor.important && descriptor.display === descriptor.source;\n}\n\n/** Resolves cross-family CSS ownership while values are still target-free semantic plans. */\nexport class SemanticFamilyCompositionPlanner {\n constructor(\n private readonly catalog: BreakpointCatalog,\n private readonly evidence: SourcePropertyEvidence,\n ) {}\n\n compose(\n inputPlans: readonly SemanticCompositionPlan[],\n context: SemanticConversionContext,\n ): readonly SemanticCompositionPlan[] {\n const allEffects = inputPlans.flatMap(plan => (plan.status === 'converted' ? semanticEffects(plan) : []));\n const sources = sourceAuthorities(inputPlans, this.catalog, this.evidence);\n let plans = this.composeGeneratedProperties(inputPlans, allEffects, sources);\n plans = this.composeExtendedDisplayWithLayout(plans, allEffects, sources);\n return this.composeVisibility(plans, allEffects, sources, context);\n }\n\n private activeEffects(\n plans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n ): readonly PropertyEffect[] {\n const plansById = new Map(plans.map(plan => [plan.input.id, plan]));\n return allEffects.filter(effect => !isSuppressed(effect, plansById));\n }\n\n private composeGeneratedProperties(\n plans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n sources: readonly SourceAuthority[],\n ): readonly SemanticCompositionPlan[] {\n const candidates = this.activeEffects(plans, allEffects).filter(effect => effect.family !== 'visibility');\n const unsafe = new Set<DirectiveFamily>();\n const suppressed: PropertyEffect[] = [];\n\n for (const source of sources) {\n const current = plans.find(plan => plan.input.id === source.input.id);\n if (current?.status === 'converted') continue;\n for (const candidate of candidates) {\n if (\n mediaRangesIntersect(source.range, activationRange(candidate.activation)) &&\n (source.properties === undefined || propertySetsOverlap(source.properties, candidate.properties))\n ) {\n unsafe.add(candidate.family);\n }\n }\n }\n\n for (const candidate of candidates.filter(effect => effect.authority === 'source-class')) {\n const writers = candidates.filter(\n writer =>\n writer.authority !== 'source-class' &&\n writer.family !== candidate.family &&\n mediaRangesIntersect(activationRange(writer.activation), activationRange(candidate.activation)) &&\n propertySetsOverlap(writer.properties, candidate.properties),\n );\n if (!writers.length) continue;\n if (writers.some(writer => writer.authority === 'semantic-replacement')) {\n unsafe.add(candidate.family);\n for (const writer of writers) unsafe.add(writer.family);\n continue;\n }\n const ownerFamilies = new Set(writers.map(writer => writer.family));\n const ownershipIsProven =\n !candidate.important &&\n ownerFamilies.size === 1 &&\n candidate.properties.every(property =>\n rangesCover(\n activationRange(candidate.activation),\n writers\n .filter(writer =>\n writer.properties.some(ownerProperty => cssPropertyOwnershipCovers(ownerProperty, property)),\n )\n .map(writer => activationRange(writer.activation)),\n ),\n );\n if (ownershipIsProven && candidate.suppressible) {\n suppressed.push(candidate);\n continue;\n }\n unsafe.add(candidate.family);\n for (const writer of writers) unsafe.add(writer.family);\n }\n\n const writers = candidates.filter(candidate => candidate.authority !== 'source-class');\n for (let leftIndex = 0; leftIndex < writers.length; leftIndex += 1) {\n const left = writers[leftIndex];\n if (left === undefined) continue;\n for (const right of writers.slice(leftIndex + 1)) {\n if (\n left.family === right.family ||\n (!left.family.startsWith('extended-') && !right.family.startsWith('extended-')) ||\n !mediaRangesIntersect(activationRange(left.activation), activationRange(right.activation)) ||\n !propertySetsOverlap(left.properties, right.properties) ||\n (left.authority === 'source-inline' &&\n right.authority === 'source-inline' &&\n left.signature === right.signature)\n ) {\n continue;\n }\n unsafe.add(left.family);\n unsafe.add(right.family);\n }\n }\n\n return updatePlans(plans, unsafe, generatedOwnershipUnverified, suppressed);\n }\n\n private composeExtendedDisplayWithLayout(\n inputPlans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n sources: readonly SourceAuthority[],\n ): readonly SemanticCompositionPlan[] {\n let plans = inputPlans;\n let effects = this.activeEffects(plans, allEffects);\n const classRanges = effects\n .filter(effect => effect.family === 'extended-class' && effect.display !== undefined)\n .map(effect => activationRange(effect.activation));\n const styleRanges = effects\n .filter(effect => effect.family === 'extended-style' && effect.display !== undefined)\n .map(effect => activationRange(effect.activation));\n const importantClassRanges = effects\n .filter(effect => effect.family === 'extended-class' && effect.display !== undefined && effect.important)\n .map(effect => activationRange(effect.activation));\n const unresolvedRange = (family: SourceAuthority['family']): readonly MediaRange[] =>\n sources.flatMap(source => {\n const current = plans.find(plan => plan.input.id === source.input.id);\n return source.family === family && current?.status !== 'converted' && source.mayControlDisplay\n ? [source.range]\n : [];\n });\n const unresolvedClassRanges = unresolvedRange('extended-class');\n const unresolvedStyleRanges = unresolvedRange('extended-style');\n const affected = new Set<DirectiveFamily>();\n if (\n classRanges.some(\n target => styleRanges.some(range => mediaRangesIntersect(target, range)) && !rangesCover(target, styleRanges),\n ) ||\n importantClassRanges.some(target => styleRanges.some(range => mediaRangesIntersect(target, range)))\n ) {\n affected.add('extended-class');\n affected.add('extended-style');\n }\n if (styleRanges.some(target => unresolvedClassRanges.some(range => mediaRangesIntersect(target, range)))) {\n affected.add('extended-style');\n }\n if (classRanges.some(target => unresolvedStyleRanges.some(range => mediaRangesIntersect(target, range)))) {\n affected.add('extended-class');\n }\n const classSuppressed = effects.filter(\n effect =>\n effect.family === 'extended-class' &&\n effect.display !== undefined &&\n !effect.important &&\n rangesCover(activationRange(effect.activation), styleRanges),\n );\n plans = updatePlans(\n plans,\n affected,\n input =>\n contextUnverified(\n input,\n 'Responsive class and style display ownership cannot be proven for every overlapping activation range.',\n ),\n classSuppressed,\n );\n\n effects = this.activeEffects(plans, allEffects);\n const layoutRanges = effects\n .filter(effect => effect.family === 'layout' && effect.display?.value !== undefined && !effect.important)\n .map(effect => activationRange(effect.activation));\n const unresolvedLayout = plans.some(\n plan => directiveFamily(plan.input.directive) === 'layout' && plan.status !== 'converted',\n );\n const unresolvedExtendedDisplay = sources.some(source => {\n const current = plans.find(plan => plan.input.id === source.input.id);\n return current?.status !== 'converted' && source.mayControlDisplay;\n });\n const layoutAffected = new Set<DirectiveFamily>();\n const displaySuppressed: PropertyEffect[] = [];\n let layoutOverlapIsUnsafe = false;\n for (const effect of effects.filter(\n candidate => candidate.family === 'extended-class' || candidate.family === 'extended-style',\n )) {\n if (effect.display === undefined) continue;\n const target = activationRange(effect.activation);\n const overlaps = layoutRanges.some(range => mediaRangesIntersect(target, range));\n if (unresolvedLayout) layoutAffected.add(effect.family);\n if ((effect.properties.length !== 1 || effect.properties[0]?.toLowerCase() !== 'display') && overlaps) {\n layoutOverlapIsUnsafe = true;\n layoutAffected.add(effect.family);\n continue;\n }\n if ((effect.family === 'extended-style' || effect.important) && overlaps) {\n layoutOverlapIsUnsafe = true;\n layoutAffected.add(effect.family);\n continue;\n }\n if (rangesCover(target, layoutRanges)) {\n displaySuppressed.push(effect);\n } else if (overlaps) {\n layoutOverlapIsUnsafe = true;\n layoutAffected.add(effect.family);\n }\n }\n if (unresolvedExtendedDisplay || layoutOverlapIsUnsafe) layoutAffected.add('layout');\n return updatePlans(\n plans,\n layoutAffected,\n input =>\n input.directive === 'fxLayout'\n ? contextUnverified(\n input,\n 'An unresolved or partially overlapping responsive class/style family may control display.',\n )\n : contextUnverified(\n input,\n 'The responsive layout and extended display ranges do not have one provable ownership order.',\n ),\n displaySuppressed,\n );\n }\n\n private composeVisibility(\n inputPlans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n sources: readonly SourceAuthority[],\n context: SemanticConversionContext,\n ): readonly SemanticCompositionPlan[] {\n let plans = inputPlans;\n const visibilityPlans = plans.filter(plan => directiveFamily(plan.input.directive) === 'visibility');\n if (!visibilityPlans.length) return plans;\n const visibilityResolved = visibilityPlans.every(plan => plan.status === 'converted');\n let effects = this.activeEffects(plans, allEffects);\n const extendedDisplayFamilies = new Set(\n effects\n .filter(\n effect =>\n (effect.family === 'extended-class' || effect.family === 'extended-style') && effect.display !== undefined,\n )\n .map(effect => effect.family),\n );\n if (!visibilityResolved) {\n return updatePlans(plans, extendedDisplayFamilies, input =>\n contextUnverified(input, 'The visibility family is unresolved and may override display.'),\n );\n }\n\n const visibility = (visibilityPlans[0] as ResolvedSemanticPlan).value as VisibilitySemantics;\n const states = visibility.states;\n const baseIsHidden = states.some(state => state.activation.kind === 'base' && state.intent === 'hidden');\n const hiddenRanges = states.flatMap(state =>\n state.intent === 'hidden' && state.activation.kind === 'media' ? [state.activation.definition.range] : [],\n );\n const shownRanges = states\n .filter(state => state.intent === 'shown')\n .map(state => activationRange(state.activation));\n const visibilityRanges = states.map(state => activationRange(state.activation));\n const unsafe = new Set<DirectiveFamily>();\n const suppressed: PropertyEffect[] = [];\n const visibilityOwnsHiddenRange = (target: MediaRange): boolean =>\n baseIsHidden\n ? !states.some(\n state =>\n state.intent === 'shown' &&\n state.activation.kind === 'media' &&\n mediaRangesIntersect(target, state.activation.definition.range),\n )\n : rangesCover(target, hiddenRanges);\n\n for (const effect of effects.filter(\n candidate => candidate.family === 'extended-class' || candidate.family === 'extended-style',\n )) {\n if (effect.display === undefined) continue;\n const target = activationRange(effect.activation);\n if (effect.retained && visibilityRanges.some(range => mediaRangesIntersect(target, range))) {\n unsafe.add(effect.family);\n continue;\n }\n const overlapsVisibility = visibilityRanges.some(range => mediaRangesIntersect(target, range));\n if (effect.family === 'extended-style' && overlapsVisibility) {\n unsafe.add(effect.family);\n continue;\n }\n if (effect.properties.length !== 1 || effect.properties[0]?.toLowerCase() !== 'display') {\n if (overlapsVisibility) unsafe.add(effect.family);\n continue;\n }\n if (effect.important && overlapsVisibility) {\n unsafe.add(effect.family);\n continue;\n }\n if (visibilityOwnsHiddenRange(target)) {\n suppressed.push(effect);\n continue;\n }\n const partiallyHidden =\n !baseIsHidden &&\n hiddenRanges.some(range => mediaRangesIntersect(target, range)) &&\n !rangesCover(target, hiddenRanges);\n const shownOverridesHidden =\n effect.display.intent !== 'shown' && shownRanges.some(range => mediaRangesIntersect(target, range));\n if (partiallyHidden || shownOverridesHidden) unsafe.add(effect.family);\n }\n if (unsafe.size > 0) unsafe.add('visibility');\n plans = updatePlans(\n plans,\n unsafe,\n input =>\n contextUnverified(\n input,\n 'The responsive class/style display range and visibility range only partially agree on ownership.',\n ),\n suppressed,\n );\n if (unsafe.size > 0) return plans;\n\n effects = this.activeEffects(plans, allEffects);\n const existingDisplays = context.existingClassNames\n .map(className => this.evidence.classifyClassToken(className))\n .flatMap(item => (item.status === 'verified' && item.evidence.display !== undefined ? [item.evidence] : []));\n const responsiveStyleIsUnresolved = sources.some(source => {\n const current = plans.find(plan => plan.input.id === source.input.id);\n return source.family === 'extended-style' && current?.status !== 'converted' && source.mayControlDisplay;\n });\n const hasEffectiveShownRange = !baseIsHidden || states.some(state => state.intent === 'shown');\n let displayReason =\n responsiveStyleIsUnresolved || context.attributeEvidence.some(attributeControlsDisplay)\n ? 'A literal or bound style may control the element display value.'\n : existingDisplays.some(item => item.display === 'hidden') && hasEffectiveShownRange\n ? 'The visible display value cannot be proven from one unambiguous source.'\n : undefined;\n\n const relevantExtended = effects.filter(\n effect =>\n (effect.family === 'extended-class' || effect.family === 'extended-style') &&\n effect.display !== undefined &&\n (effect.family === 'extended-style' ||\n effect.important ||\n !visibilityOwnsHiddenRange(activationRange(effect.activation))),\n );\n const effectiveShownRanges = states.some(state => state.activation.kind === 'base')\n ? shownRanges\n : [{}, ...shownRanges];\n if (\n displayReason === undefined &&\n relevantExtended.some(\n effect =>\n effect.display?.intent !== 'shown' &&\n effectiveShownRanges.some(range => mediaRangesIntersect(activationRange(effect.activation), range)),\n )\n ) {\n displayReason = 'A responsive class/style hidden utility overlaps a visibility state that must be shown.';\n }\n if (\n displayReason === undefined &&\n relevantExtended.some(effect =>\n effectiveShownRanges.some(range => mediaRangesIntersect(activationRange(effect.activation), range)),\n )\n ) {\n displayReason =\n 'Flex-Layout captures the original display during initialization, before responsive ownership is stable.';\n }\n if (displayReason !== undefined) {\n const visibilityIds = new Set(visibilityPlans.map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && visibilityIds.has(plan.input.id)\n ? displayRestorationUnverified(plan.input, displayReason)\n : plan,\n );\n }\n\n const layoutPlans = plans.filter(\n (plan): plan is ResolvedSemanticPlan => plan.status === 'converted' && plan.family === 'layout',\n );\n const layoutDisplays = layoutPlans.flatMap(plan => {\n const layout = plan.value as LayoutSemantics;\n return plan.activations.map(activation => ({ activation, display: layout.display }));\n });\n const existingRestoration = (() => {\n const descriptor = existingDisplays.length === 1 ? existingDisplays[0] : undefined;\n return descriptor !== undefined &&\n plainBaseDisplay(descriptor) &&\n descriptor.display !== undefined &&\n restorationDisplays.has(descriptor.display)\n ? descriptor.display\n : undefined;\n })();\n const shownOverrides = baseIsHidden\n ? states.filter(state => state.activation.kind === 'media' && state.intent === 'shown')\n : [];\n let restorationDisplay: string | undefined;\n if (shownOverrides.length > 0) {\n const utilities = shownOverrides.map(state => {\n const stateRange = activationRange(state.activation);\n const overlapping = layoutDisplays.some(\n display =>\n display.activation.kind === 'media' &&\n !sameActivation(display.activation, state.activation) &&\n mediaRangesIntersect(display.activation.definition.range, stateRange),\n );\n if (overlapping) return null;\n const exact = layoutDisplays.filter(display => sameActivation(display.activation, state.activation));\n const applicable =\n exact.length > 0 ? exact : layoutDisplays.filter(display => display.activation.kind === 'base');\n const displays = [...new Set(applicable.map(display => display.display))];\n return displays.length === 0 ? existingRestoration : displays.length === 1 ? displays[0] : null;\n });\n const distinct = [...new Set(utilities)];\n if (distinct.length !== 1 || typeof distinct[0] !== 'string') {\n const visibilityIds = new Set(visibilityPlans.map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && visibilityIds.has(plan.input.id)\n ? displayRestorationUnverified(\n plan.input,\n 'The visible display value cannot be proven from one unambiguous source.',\n )\n : plan,\n );\n }\n restorationDisplay = distinct[0];\n }\n\n const unsafePartial =\n !baseIsHidden &&\n layoutDisplays.some(display => {\n if (display.activation.kind !== 'media') return false;\n const range = display.activation.definition.range;\n return hiddenRanges.some(hidden => mediaRangesIntersect(range, hidden)) && !rangesCover(range, hiddenRanges);\n });\n if (unsafePartial) {\n const ids = new Set([...visibilityPlans, ...layoutPlans].map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && ids.has(plan.input.id) ? partialDisplayContextUnverified(plan.input) : plan,\n );\n }\n\n const layoutSuppressions = effects.filter(effect => {\n if (effect.family !== 'layout' || effect.display === undefined) return false;\n const target = activationRange(effect.activation);\n return baseIsHidden\n ? !states.some(\n state =>\n state.intent === 'shown' &&\n state.activation.kind === 'media' &&\n mediaRangesIntersect(target, state.activation.definition.range),\n )\n : rangesCover(target, hiddenRanges);\n });\n const visibilityIds = new Set(visibilityPlans.map(plan => plan.input.id));\n plans = plans.map(plan => {\n if (plan.status !== 'converted') return plan;\n if (visibilityIds.has(plan.input.id)) {\n return {\n ...plan,\n value: {\n ...(plan.value as VisibilitySemantics),\n ...(restorationDisplay === undefined ? {} : { restorationDisplay }),\n },\n };\n }\n return layoutSuppressions.filter(effect => effect.planId === plan.input.id).reduce(addSuppression, plan);\n });\n return plans;\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport {\n BreakpointCatalog,\n mediaDefinitionsIntersect,\n mediaRangesIntersect,\n type MediaRange,\n} from '../breakpoint/breakpoint-catalog';\nimport type { SemanticConversionContext } from './conversion-context';\nimport { directiveFamily, type DirectiveFamily } from './semantic-plan';\n\nexport type { DirectiveFamily } from './semantic-plan';\n\nexport interface ResponsiveOrchestrationPlan {\n readonly status: 'converted' | 'review' | 'unsupported' | 'invalid';\n readonly input: LocatedFlexLayoutInput;\n}\n\nexport type ResponsivePlanOne<TPlan extends ResponsiveOrchestrationPlan> = (\n input: LocatedFlexLayoutInput,\n context: SemanticConversionContext,\n) => TPlan;\n\nexport type ResponsivePlanExtendedFamily<TPlan extends ResponsiveOrchestrationPlan> = (\n family: 'extended-class' | 'extended-style',\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n) => readonly TPlan[];\n\nexport interface SemanticTargetPolicy<TPlan extends ResponsiveOrchestrationPlan> {\n emptyPlan(input: LocatedFlexLayoutInput): TPlan;\n targetEligibility(input: LocatedFlexLayoutInput): TPlan | undefined;\n validateActivation(plan: TPlan): TPlan;\n isTargetEligibilityFailure(plan: TPlan): boolean;\n sameOutput(left: TPlan, right: TPlan): boolean;\n contextUnverified(input: LocatedFlexLayoutInput, reason: string): TPlan;\n contextualOutputUnverified(input: LocatedFlexLayoutInput): TPlan;\n responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): TPlan;\n decorate(plan: TPlan): TPlan;\n addPrintFallback(plan: TPlan): TPlan;\n}\n\nconst localLayoutDependents = new Set<DirectiveFamily>(['layout-gap', 'layout-align']);\nconst parentLayoutDependents = new Set<DirectiveFamily>(['flex-item', 'flex-offset']);\n\ninterface NumericRange {\n readonly min: number;\n readonly max: number;\n}\n\nfunction numericRange(range: MediaRange): NumericRange {\n return {\n min: range.min ?? Number.NEGATIVE_INFINITY,\n max: range.max ?? Number.POSITIVE_INFINITY,\n };\n}\n\nfunction mediaRange(range: NumericRange): MediaRange {\n return {\n min: range.min === Number.NEGATIVE_INFINITY ? undefined : range.min,\n max: range.max === Number.POSITIVE_INFINITY ? undefined : range.max,\n };\n}\n\nfunction nextBelow(value: number): number {\n return value - Math.max(1, Math.abs(value)) * Number.EPSILON;\n}\n\nfunction nextAbove(value: number): number {\n return value + Math.max(1, Math.abs(value)) * Number.EPSILON;\n}\n\nfunction subtractRange(source: NumericRange, excluded: NumericRange): readonly NumericRange[] {\n if (source.max < excluded.min || excluded.max < source.min) return [source];\n const remaining: NumericRange[] = [];\n if (source.min < excluded.min) remaining.push({ min: source.min, max: nextBelow(excluded.min) });\n if (excluded.max < source.max) remaining.push({ min: nextAbove(excluded.max), max: source.max });\n return remaining;\n}\n\nfunction effectiveRanges(\n input: LocatedFlexLayoutInput,\n familyInputs: readonly LocatedFlexLayoutInput[],\n catalog: BreakpointCatalog,\n): readonly NumericRange[] {\n if (input.breakpoint) {\n const classification = catalog.classify(input.breakpoint);\n return classification.kind === 'verified' ? [numericRange(classification.definition.range)] : [];\n }\n\n let ranges: readonly NumericRange[] = [{ min: Number.NEGATIVE_INFINITY, max: Number.POSITIVE_INFINITY }];\n for (const sibling of familyInputs) {\n if (!sibling.breakpoint || sibling.binding !== 'literal') continue;\n const classification = catalog.classify(sibling.breakpoint);\n if (classification.kind !== 'verified') continue;\n const excluded = numericRange(classification.definition.range);\n ranges = ranges.flatMap(range => subtractRange(range, excluded));\n }\n return ranges;\n}\n\nfunction rangesCover(target: NumericRange, ranges: readonly NumericRange[]): boolean {\n const clipped = ranges\n .map(range => ({ min: Math.max(target.min, range.min), max: Math.min(target.max, range.max) }))\n .filter(range => range.min <= range.max)\n .sort((left, right) => left.min - right.min);\n if (!clipped.length || clipped[0]?.min !== target.min) return false;\n\n let coveredUntil = clipped[0].max;\n for (const range of clipped.slice(1)) {\n if (range.min > coveredUntil) return false;\n coveredUntil = Math.max(coveredUntil, range.max);\n }\n return coveredUntil >= target.max;\n}\n\nexport class ResponsiveFamilyPlanner<TPlan extends ResponsiveOrchestrationPlan> {\n constructor(\n private readonly catalog: BreakpointCatalog,\n private readonly policy: SemanticTargetPolicy<TPlan>,\n ) {}\n\n plan(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n planExtendedFamily?: ResponsivePlanExtendedFamily<TPlan>,\n ): readonly TPlan[] {\n return this.planWithDependencies(inputs, context, planOne, true, true, planExtendedFamily);\n }\n\n closeDependencies(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n ): readonly TPlan[] {\n return this.planWithDependencies(inputs, context, planOne, false, false);\n }\n\n private planWithDependencies(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n decorate: boolean,\n validateResponsivePrecedence: boolean,\n planExtendedFamily?: ResponsivePlanExtendedFamily<TPlan>,\n ): readonly TPlan[] {\n const groups = new Map<DirectiveFamily, LocatedFlexLayoutInput[]>();\n const ungrouped: LocatedFlexLayoutInput[] = [];\n for (const input of inputs) {\n const family = directiveFamily(input.directive);\n if (!family) {\n ungrouped.push(input);\n continue;\n }\n const members = groups.get(family) ?? [];\n members.push(input);\n groups.set(family, members);\n }\n\n const completeContext: SemanticConversionContext = { ...context, inputs };\n const rawPlansByFamily = new Map<DirectiveFamily, readonly TPlan[]>();\n const layoutInputs = groups.get('layout') ?? [];\n const layoutPlans = this.planFamily(layoutInputs, completeContext, planOne, validateResponsivePrecedence);\n if (layoutInputs.length) rawPlansByFamily.set('layout', layoutPlans);\n\n const parentLayoutInputs = context.parentInputs.filter(input => input.directive === 'fxLayout');\n const parentLayoutSafe = this.isLayoutContextSafe(\n context.parentInputs,\n {\n ...context,\n element: context.parent ?? context.element,\n inputs: context.parentInputs,\n parent: undefined,\n parentInputs: [],\n },\n planOne,\n validateResponsivePrecedence,\n );\n const localLayoutSafe = layoutPlans.every(plan => plan.status === 'converted');\n\n for (const [family, familyInputs] of groups) {\n if (family === 'layout') continue;\n\n let plans: readonly TPlan[];\n if ((family === 'extended-class' || family === 'extended-style') && planExtendedFamily) {\n plans = planExtendedFamily(family, familyInputs, completeContext);\n } else if (localLayoutDependents.has(family)) {\n plans = localLayoutSafe\n ? this.planContextualFamily(\n familyInputs,\n completeContext,\n layoutInputs,\n 'activeLayout',\n planOne,\n validateResponsivePrecedence,\n )\n : this.planBlockedContextFamily(\n familyInputs,\n completeContext,\n planOne,\n 'The responsive layout family contains an unresolved member.',\n !validateResponsivePrecedence,\n );\n } else if (parentLayoutDependents.has(family)) {\n plans = parentLayoutSafe\n ? this.planContextualFamily(\n familyInputs,\n completeContext,\n parentLayoutInputs,\n 'activeParentLayout',\n planOne,\n validateResponsivePrecedence,\n )\n : this.planBlockedContextFamily(\n familyInputs,\n completeContext,\n planOne,\n 'The responsive parent layout family contains an unresolved member.',\n !validateResponsivePrecedence,\n );\n } else {\n plans = this.planFamily(familyInputs, completeContext, planOne, validateResponsivePrecedence);\n }\n rawPlansByFamily.set(family, plans);\n }\n\n const localFamilies = ['layout', 'layout-gap', 'layout-align'] as const;\n const localContextUnresolved = localFamilies.some(family =>\n rawPlansByFamily.get(family)?.some(plan => plan.status !== 'converted'),\n );\n if (localContextUnresolved) {\n for (const family of localFamilies) {\n const plans = rawPlansByFamily.get(family);\n if (!plans) continue;\n rawPlansByFamily.set(\n family,\n plans.map(plan =>\n plan.status === 'converted'\n ? this.policy.contextUnverified(\n plan.input,\n 'The element layout context contains an unresolved dependent directive family.',\n )\n : plan,\n ),\n );\n }\n }\n\n const plansById = new Map<string, TPlan>();\n for (const [family, plans] of rawPlansByFamily) {\n const shouldDecorate = decorate && family !== 'extended-class' && family !== 'extended-style';\n const decoratedPlans = plans.map(plan => (shouldDecorate ? this.policy.decorate(plan) : plan));\n const printAwarePlans = decorate\n ? this.addPrintFallback(groups.get(family) ?? [], decoratedPlans)\n : decoratedPlans;\n for (const plan of printAwarePlans) plansById.set(plan.input.id, plan);\n }\n for (const input of ungrouped) {\n const plan = this.planOneWithEligibility(input, completeContext, planOne);\n plansById.set(input.id, decorate ? this.policy.decorate(plan) : plan);\n }\n return inputs.map(input => {\n const planned = plansById.get(input.id);\n if (planned) return planned;\n const plan = this.planOneWithEligibility(input, completeContext, planOne);\n return decorate ? this.policy.decorate(plan) : plan;\n });\n }\n\n private addPrintFallback(inputs: readonly LocatedFlexLayoutInput[], plans: readonly TPlan[]): readonly TPlan[] {\n const configuredAliases = this.catalog.printWithBreakpoints;\n if (configuredAliases === undefined || plans.some(plan => plan.status !== 'converted')) return plans;\n if (inputs.some(input => input.breakpoint === 'print')) return plans;\n\n const configured = inputs\n .map((input, index) => ({\n input,\n index,\n classification: input.breakpoint === undefined ? undefined : this.catalog.classify(input.breakpoint),\n }))\n .filter(\n (\n item,\n ): item is typeof item & {\n readonly classification: Extract<ReturnType<BreakpointCatalog['classify']>, { readonly kind: 'verified' }>;\n } =>\n item.input.breakpoint !== undefined &&\n configuredAliases.includes(item.input.breakpoint) &&\n item.classification !== undefined &&\n item.classification.kind === 'verified',\n )\n .sort(\n (left, right) =>\n right.classification.definition.priority - left.classification.definition.priority ||\n configuredAliases.indexOf(left.input.breakpoint ?? '') -\n configuredAliases.indexOf(right.input.breakpoint ?? ''),\n );\n const selected = configured[0];\n if (!selected) return plans;\n\n return plans.map((plan, index) =>\n index === selected.index && plan.status === 'converted' ? this.policy.addPrintFallback(plan) : plan,\n );\n }\n\n private planContextualFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n layoutInputs: readonly LocatedFlexLayoutInput[],\n contextKey: 'activeLayout' | 'activeParentLayout',\n planOne: ResponsivePlanOne<TPlan>,\n validateResponsivePrecedence: boolean,\n ): readonly TPlan[] {\n const semanticPlans = inputs.map(input => {\n const breakpointPlan = this.planBreakpoint(input, context, planOne);\n if (breakpointPlan.status !== 'converted') return breakpointPlan;\n const explicitLayout = context[contextKey];\n const layoutValues =\n layoutInputs.length === 0 && explicitLayout !== undefined\n ? [explicitLayout]\n : this.layoutValuesFor(input, inputs, layoutInputs);\n if (!layoutValues.length) {\n return this.policy.contextUnverified(input, 'The active responsive layout cannot be resolved for this input.');\n }\n const candidates = layoutValues.map(value => planOne(input, { ...context, [contextKey]: value }));\n const unresolved = candidates.find(candidate => candidate.status !== 'converted');\n if (unresolved) return unresolved;\n const first = candidates[0];\n if (!first || candidates.some(candidate => !this.policy.sameOutput(first, candidate))) {\n return this.policy.contextualOutputUnverified(input);\n }\n return first;\n });\n return this.validateFamily(inputs, semanticPlans, validateResponsivePrecedence);\n }\n\n private isLayoutContextSafe(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n validateResponsivePrecedence: boolean,\n ): boolean {\n const layoutInputs = inputs.filter(input => input.directive === 'fxLayout');\n if (\n this.planFamily(layoutInputs, context, planOne, validateResponsivePrecedence).some(\n plan => plan.status !== 'converted',\n )\n ) {\n return false;\n }\n\n return (['fxLayoutGap', 'fxLayoutAlign'] as const).every(directive => {\n const familyInputs = inputs.filter(input => input.directive === directive);\n return this.planContextualFamily(\n familyInputs,\n context,\n layoutInputs,\n 'activeLayout',\n planOne,\n validateResponsivePrecedence,\n ).every(plan => plan.status === 'converted');\n });\n }\n\n private planBlockedContextFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n reason: string,\n preserveExistingDiagnostics = false,\n ): readonly TPlan[] {\n return inputs.map(input => {\n const breakpointPlan = this.planBreakpoint(input, context, planOne);\n if (breakpointPlan.status !== 'converted') return breakpointPlan;\n const existingPlan = preserveExistingDiagnostics\n ? this.planOneWithEligibility(input, context, planOne)\n : breakpointPlan;\n return existingPlan.status === 'converted' ? this.policy.contextUnverified(input, reason) : existingPlan;\n });\n }\n\n private planBreakpoint(\n input: LocatedFlexLayoutInput,\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n ): TPlan {\n const eligibility = this.policy.targetEligibility(input);\n if (eligibility) return eligibility;\n return input.binding === 'literal'\n ? this.policy.validateActivation(this.policy.emptyPlan(input))\n : planOne(input, context);\n }\n\n private layoutValuesFor(\n input: LocatedFlexLayoutInput,\n familyInputs: readonly LocatedFlexLayoutInput[],\n layoutInputs: readonly LocatedFlexLayoutInput[],\n ): readonly string[] {\n const baseLayouts = layoutInputs.filter(layout => !layout.breakpoint);\n const responsiveLayouts = layoutInputs.flatMap(layout => {\n if (!layout.breakpoint) return [];\n const classification = this.catalog.classify(layout.breakpoint);\n return classification.kind === 'verified'\n ? [{ value: layout.value, range: numericRange(classification.definition.range) }]\n : [];\n });\n const values = new Set<string>();\n\n for (const target of effectiveRanges(input, familyInputs, this.catalog)) {\n const activeResponsive = responsiveLayouts.filter(layout =>\n mediaRangesIntersect(mediaRange(target), mediaRange(layout.range)),\n );\n for (const layout of activeResponsive) values.add(layout.value);\n if (\n !rangesCover(\n target,\n activeResponsive.map(layout => layout.range),\n )\n ) {\n if (baseLayouts.length) {\n for (const layout of baseLayouts) values.add(layout.value);\n } else {\n values.add('row');\n }\n }\n }\n return [...values];\n }\n\n private planFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n validateResponsivePrecedence: boolean,\n ): readonly TPlan[] {\n return this.validateFamily(\n inputs,\n inputs.map(input => this.planOneWithEligibility(input, context, planOne)),\n validateResponsivePrecedence,\n );\n }\n\n private validateFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n semanticPlans: readonly TPlan[],\n validateResponsivePrecedence: boolean,\n ): readonly TPlan[] {\n if (inputs.some(input => input.binding !== 'literal')) {\n return inputs.map((input, index) => {\n const semanticPlan =\n semanticPlans[index] ??\n this.policy.contextUnverified(input, 'The dynamic member of this directive family cannot be planned.');\n if (input.binding !== 'literal') return semanticPlan;\n const breakpointPlan = this.policy.validateActivation(semanticPlan);\n if (this.policy.isTargetEligibilityFailure(breakpointPlan)) return breakpointPlan;\n return this.policy.contextUnverified(input, 'Another member of this responsive directive family is dynamic.');\n });\n }\n\n const supportedPlans = semanticPlans.map(plan => this.policy.validateActivation(plan));\n if (supportedPlans.some(plan => plan.status !== 'converted')) {\n return supportedPlans.map(plan =>\n plan.status === 'converted'\n ? this.policy.contextUnverified(\n plan.input,\n 'Another member of this responsive directive family is unresolved.',\n )\n : plan,\n );\n }\n if (!validateResponsivePrecedence) return supportedPlans;\n\n for (let leftIndex = 0; leftIndex < inputs.length; leftIndex += 1) {\n const leftInput = inputs[leftIndex];\n const leftPlan = supportedPlans[leftIndex];\n if (!leftInput?.breakpoint || !leftPlan) continue;\n const leftClassification = this.catalog.classify(leftInput.breakpoint);\n if (leftClassification.kind !== 'verified') continue;\n\n for (let rightIndex = leftIndex + 1; rightIndex < inputs.length; rightIndex += 1) {\n const rightInput = inputs[rightIndex];\n const rightPlan = supportedPlans[rightIndex];\n if (!rightInput?.breakpoint || !rightPlan) continue;\n const rightClassification = this.catalog.classify(rightInput.breakpoint);\n if (\n rightClassification.kind === 'verified' &&\n mediaDefinitionsIntersect(leftClassification.definition.media, rightClassification.definition.media) &&\n !this.policy.sameOutput(leftPlan, rightPlan)\n ) {\n return inputs.map(input => this.policy.responsivePrecedenceUnverified(input));\n }\n }\n }\n return supportedPlans;\n }\n\n private planOneWithEligibility(\n input: LocatedFlexLayoutInput,\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n ): TPlan {\n return this.policy.targetEligibility(input) ?? planOne(input, context);\n }\n}\n","import type { MediaRange } from '../breakpoint/breakpoint-catalog';\n\nexport interface SourceStyleDeclaration {\n readonly property: string;\n readonly value: string;\n}\n\nexport type SourceTokenActivation =\n | { readonly kind: 'base' }\n | { readonly kind: 'media'; readonly range: MediaRange; readonly mediaType?: 'screen' | 'print' };\n\n/** Target-neutral property evidence derived from one literal source class token. */\nexport interface SourceClassTokenEvidence {\n readonly source: string;\n readonly properties: readonly string[];\n readonly important: boolean;\n readonly activation: SourceTokenActivation;\n readonly display?: string;\n}\n\nexport type SourceClassTokenClassification =\n | { readonly status: 'verified'; readonly evidence: SourceClassTokenEvidence }\n | { readonly status: 'unverified'; readonly reason: string };\n\nexport type SourceStyleDeclarationClassification =\n { readonly status: 'verified' } | { readonly status: 'unverified'; readonly priorityText: boolean };\n\n/**\n * Supplies semantic planning with property/category facts without exposing any\n * target candidate representation or emitter.\n */\nexport interface SourcePropertyEvidence {\n classifyClassToken(token: string): SourceClassTokenClassification;\n classifyStyleDeclaration(declaration: SourceStyleDeclaration): SourceStyleDeclarationClassification;\n}\n\nexport const unknownSourcePropertyEvidence: SourcePropertyEvidence = Object.freeze({\n classifyClassToken: (_token: string): SourceClassTokenClassification => ({\n status: 'unverified',\n reason: 'No source class property evidence is available for this conversion target.',\n }),\n classifyStyleDeclaration: (_declaration: SourceStyleDeclaration): SourceStyleDeclarationClassification => ({\n status: 'unverified',\n priorityText: false,\n }),\n});\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport type { VisibilityIntent } from './visibility.model';\n\nconst invariantMessage = 'Visibility value parser requires a literal fxShow or fxHide input.';\n\nexport function parseVisibilityValue(input: LocatedFlexLayoutInput): VisibilityIntent {\n if (input.binding !== 'literal' || (input.directive !== 'fxShow' && input.directive !== 'fxHide')) {\n throw new Error(invariantMessage);\n }\n\n const shown = input.value !== 'false';\n return input.directive === 'fxHide' ? (shown ? 'hidden' : 'shown') : shown ? 'shown' : 'hidden';\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport {\n BreakpointCatalog,\n mediaDefinitionsIntersect,\n type BreakpointClassification,\n} from '../../breakpoint/breakpoint-catalog';\nimport type { UnresolvedSemanticPlan } from '../semantic-plan';\nimport type { VisibilityState } from './visibility.model';\nimport { parseVisibilityValue } from './visibility-value.parser';\n\nexport type VisibilityFamilyPlan =\n | { readonly status: 'converted'; readonly states: readonly VisibilityState[] }\n | { readonly status: 'unresolved'; readonly plans: readonly UnresolvedSemanticPlan[] };\n\ntype ClassifiedMember =\n | { readonly input: LocatedFlexLayoutInput; readonly state: VisibilityState }\n | { readonly input: LocatedFlexLayoutInput; readonly plan: UnresolvedSemanticPlan };\n\ntype ClassifiedState = Extract<ClassifiedMember, { readonly state: VisibilityState }>;\n\nfunction dynamicBinding(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'dynamic-binding',\n reason: 'Angular property bindings may depend on runtime state.',\n suggestion: 'Replace the binding manually or make it a literal before migration.',\n };\n}\n\nfunction unresolvedBreakpoint(\n input: LocatedFlexLayoutInput,\n classification: Exclude<BreakpointClassification, { readonly kind: 'verified' }>,\n): UnresolvedSemanticPlan {\n if (classification.kind === 'custom') {\n return {\n status: 'review',\n input,\n code: 'custom-breakpoint',\n reason: `The breakpoint alias ${classification.alias} may be registered by the project.`,\n suggestion: 'Provide its media query or migrate this responsive input manually.',\n };\n }\n\n const kind = classification.kind === 'print' ? 'print' : 'optional';\n return {\n status: 'review',\n input,\n code: 'breakpoint-unverified',\n reason: `The ${kind} breakpoint alias ${classification.alias} is not enabled by explicit migration configuration.`,\n suggestion:\n classification.kind === 'print'\n ? 'Verify the source printWithBreakpoints value, then rerun with --print-with-breakpoints.'\n : 'Verify that the source enables orientation breakpoints, then rerun with --orientation-breakpoints.',\n };\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Another member of this visibility family is unresolved.',\n suggestion: 'Migrate the complete visibility family together manually.',\n };\n}\n\nfunction responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'responsive-precedence-unverified',\n reason: 'The visibility family contains conflicting base or overlapping responsive states.',\n suggestion: 'Simplify the conflicting declarations or migrate this visibility family manually.',\n };\n}\n\nfunction compareText(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n\nexport class VisibilityStatePlanner {\n constructor(private readonly catalog = new BreakpointCatalog()) {}\n\n plan(inputs: readonly LocatedFlexLayoutInput[]): VisibilityFamilyPlan {\n const members = inputs\n .map(input => this.classify(input))\n .sort((left, right) => this.compare(left.input, right.input));\n\n if (!members.every((member): member is ClassifiedState => 'state' in member)) {\n return {\n status: 'unresolved',\n plans: members.map(member => ('plan' in member ? member.plan : contextUnverified(member.input))),\n };\n }\n\n const states = members.map(member => member.state);\n if (this.hasConflictingStates(states)) {\n return {\n status: 'unresolved',\n plans: states.map(state => responsivePrecedenceUnverified(state.input)),\n };\n }\n\n return { status: 'converted', states };\n }\n\n private classify(input: LocatedFlexLayoutInput): ClassifiedMember {\n if (input.binding !== 'literal') return { input, plan: dynamicBinding(input) };\n\n if (input.breakpoint === undefined) {\n return {\n input,\n state: { input, intent: parseVisibilityValue(input), activation: { kind: 'base' } },\n };\n }\n\n const classification = this.catalog.classify(input.breakpoint);\n if (classification.kind !== 'verified') {\n return { input, plan: unresolvedBreakpoint(input, classification) };\n }\n\n return {\n input,\n state: {\n input,\n intent: parseVisibilityValue(input),\n activation: { kind: 'media', definition: classification.definition },\n },\n };\n }\n\n private hasConflictingStates(states: readonly VisibilityState[]): boolean {\n const baseStates = states.filter(state => state.activation.kind === 'base');\n if (baseStates.some(state => state.intent !== baseStates[0]?.intent)) return true;\n\n const responsiveStates = states.filter(\n (state): state is VisibilityState & { readonly activation: { readonly kind: 'media' } } =>\n state.activation.kind === 'media',\n );\n return responsiveStates.some((left, leftIndex) =>\n responsiveStates\n .slice(leftIndex + 1)\n .some(\n right =>\n left.intent !== right.intent &&\n mediaDefinitionsIntersect(left.activation.definition.media, right.activation.definition.media),\n ),\n );\n }\n\n private compare(left: LocatedFlexLayoutInput, right: LocatedFlexLayoutInput): number {\n const leftIsBase = left.breakpoint === undefined;\n const rightIsBase = right.breakpoint === undefined;\n if (leftIsBase && !rightIsBase) return -1;\n if (!leftIsBase && rightIsBase) return 1;\n\n const leftPriority = this.breakpointPriority(left.breakpoint);\n const rightPriority = this.breakpointPriority(right.breakpoint);\n if (leftPriority !== rightPriority) return rightPriority - leftPriority;\n\n const aliasOrder = compareText(left.breakpoint ?? '', right.breakpoint ?? '');\n return aliasOrder || compareText(left.id, right.id);\n }\n\n private breakpointPriority(alias: string | undefined): number {\n if (alias === undefined) return Number.POSITIVE_INFINITY;\n const classification = this.catalog.classify(alias);\n return classification.kind === 'verified' ? classification.definition.priority : Number.NEGATIVE_INFINITY;\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { BreakpointCatalog, type BreakpointClassification } from '../breakpoint/breakpoint-catalog';\nimport type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\nimport { planFlexAlignSemantics } from '../flex/flex-align.semantic';\nimport { planFlexFillSemantics } from '../flex/flex-fill.semantic';\nimport { planFlexItemSemantics, type FlexItemSemantics } from '../flex/flex-item.semantic';\nimport { planFlexOffsetSemantics } from '../flex/flex-offset.semantic';\nimport { planFlexOrderSemantics } from '../flex/flex-order.semantic';\nimport type { SemanticResult } from '../flex/flex-semantic.model';\nimport { planLayoutAlignment } from '../flex/layout-align.semantic';\nimport { planLayoutGapSemantics } from '../flex/layout-gap.semantic';\nimport { parseLayout } from '../flex/layout.semantic';\nimport { parseGridValue } from '../grid/grid-value.parser';\nimport { templateAttributeKeys } from '../template/template-attribute';\nimport type { TemplateAttribute } from '../template/template.model';\nimport type { SemanticConversionContext } from './conversion-context';\nimport { cssPropertiesOverlap } from './css-property-ownership';\nimport { ExtendedFamilyPlanner } from './extended/extended-family.planner';\nimport { ExtendedSemanticPlanner } from './extended/extended-semantic.planner';\nimport { parseResponsiveClassValue, type SemanticResponsiveClassValue } from './extended/responsive-class-value.parser';\nimport type { ResponsiveStyleValue } from './extended/responsive-style.model';\nimport { parseResponsiveStyleValue } from './extended/responsive-style-value.parser';\nimport { SemanticFamilyCompositionPlanner } from './semantic-family-composition.planner';\nimport { parseLiteralStyleDeclarations } from './literal-style-declaration';\nimport { ResponsiveFamilyPlanner, type SemanticTargetPolicy } from './responsive-family.planner';\nimport {\n directiveFamily,\n type DirectiveFamily,\n type ResolvedSemanticPlan,\n type ResolvedSemanticValue,\n type SemanticDependencyPlan,\n type SemanticPlanningPlan,\n type SemanticActivation,\n type UnresolvedSemanticPlan,\n} from './semantic-plan';\nimport { type SourcePropertyEvidence, unknownSourcePropertyEvidence } from './source-property-evidence';\nimport { VisibilityStatePlanner } from './visibility/visibility-state.planner';\nimport { parseVisibilityValue } from './visibility/visibility-value.parser';\n\nconst flexItemDirectives = new Set<LocatedFlexLayoutInput['directive']>(['fxFlex', 'fxGrow', 'fxShrink']);\nconst visibilityDirectives = new Set<LocatedFlexLayoutInput['directive']>(['fxShow', 'fxHide']);\nconst extendedClassDirectives = new Set<LocatedFlexLayoutInput['directive']>(['class', 'ngClass']);\nconst extendedStyleDirectives = new Set<LocatedFlexLayoutInput['directive']>(['style', 'ngStyle']);\nconst extendedDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n ...extendedClassDirectives,\n ...extendedStyleDirectives,\n]);\nconst gridDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdArea',\n 'gdAreas',\n 'gdAuto',\n 'gdColumn',\n 'gdColumns',\n 'gdGap',\n 'gdGridAlign',\n 'gdInline',\n 'gdRow',\n 'gdRows',\n]);\nconst gridContainerDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdAreas',\n 'gdAuto',\n 'gdColumns',\n 'gdGap',\n 'gdRows',\n]);\nconst gridChildDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdArea',\n 'gdColumn',\n 'gdGridAlign',\n 'gdRow',\n]);\nconst displayAuthorityDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'class',\n 'ngClass',\n 'style',\n 'ngStyle',\n]);\nconst localLayoutDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'fxLayout',\n 'fxLayoutGap',\n 'fxLayoutAlign',\n]);\nconst parentLayoutDependentDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexOffset',\n]);\n\nconst defaultSemanticBreakpointConfig: BreakpointMigrationConfig = {\n orientationBreakpoints: true,\n printWithBreakpoints: [],\n};\n\nfunction invalid(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'invalid',\n input,\n code: 'invalid-value',\n reason: `${input.value} is not a supported ${input.directive} value.`,\n suggestion: 'Correct the value or migrate this directive manually.',\n };\n}\n\nfunction dynamicBinding(input: LocatedFlexLayoutInput, extended = false): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'dynamic-binding',\n reason: extended\n ? 'Angular property bindings and interpolation may depend on runtime state.'\n : 'Angular property bindings may depend on runtime state.',\n suggestion: 'Replace the binding manually or make it a literal before migration.',\n };\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput, reason: string): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason,\n suggestion: 'Migrate the responsive context and its dependent directive families together manually.',\n };\n}\n\nfunction displayContextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'The element display context contains an unresolved layout or visibility family.',\n suggestion: 'Migrate the complete layout and visibility context together manually.',\n };\n}\n\nfunction responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'responsive-precedence-unverified',\n reason: 'Overlapping responsive ranges emit different target outputs for the same directive family.',\n suggestion: 'Simplify the overlapping declarations or migrate this directive family manually.',\n };\n}\n\nfunction unresolvedBreakpoint(\n input: LocatedFlexLayoutInput,\n classification: Exclude<BreakpointClassification, { readonly kind: 'verified' }>,\n): UnresolvedSemanticPlan {\n if (classification.kind === 'custom') {\n return {\n status: 'review',\n input,\n code: 'custom-breakpoint',\n reason: `The breakpoint alias ${classification.alias} may be registered by the project.`,\n suggestion: 'Provide its media query or migrate this responsive input manually.',\n };\n }\n\n const kind = classification.kind === 'print' ? 'print' : 'optional';\n return {\n status: 'review',\n input,\n code: 'breakpoint-unverified',\n reason: `The ${kind} breakpoint alias ${classification.alias} is not enabled by explicit migration configuration.`,\n suggestion:\n classification.kind === 'print'\n ? 'Verify the source printWithBreakpoints value, then rerun with --print-with-breakpoints.'\n : 'Verify that the source enables orientation breakpoints, then rerun with --orientation-breakpoints.',\n };\n}\n\nfunction staticLayoutContext(attributes: readonly TemplateAttribute[]): string | undefined {\n const layouts = attributes.filter(\n attribute => attribute.name === 'fxLayout' || attribute.name.startsWith('fxLayout.'),\n );\n if (!layouts.length) return 'row';\n if (layouts.length !== 1) return undefined;\n const layout = layouts[0];\n return layout?.name === 'fxLayout' && layout.binding === 'literal' ? layout.value : undefined;\n}\n\nfunction activation(\n input: LocatedFlexLayoutInput,\n catalog: BreakpointCatalog,\n): SemanticActivation | UnresolvedSemanticPlan {\n if (input.breakpoint === undefined) return { kind: 'base' };\n const classification = catalog.classify(input.breakpoint);\n return classification.kind === 'verified'\n ? { kind: 'media', definition: classification.definition }\n : unresolvedBreakpoint(input, classification);\n}\n\nfunction resolved(input: LocatedFlexLayoutInput, value: ResolvedSemanticValue): ResolvedSemanticPlan {\n const family = directiveFamily(input.directive);\n if (family === undefined) throw new Error(`Semantic planning received an unknown directive: ${input.directive}`);\n return { status: 'converted', input, family, value, activations: [] };\n}\n\nfunction fromSemantic<T extends ResolvedSemanticValue>(\n input: LocatedFlexLayoutInput,\n result: SemanticResult<T>,\n): SemanticPlanningPlan {\n if (result.status === 'planned') return resolved(input, result.value);\n if (result.status === 'invalid') return invalid(input);\n return { ...result, input };\n}\n\nfunction sameSemanticOutput(left: SemanticPlanningPlan, right: SemanticPlanningPlan): boolean {\n return (\n left.status === 'converted' &&\n right.status === 'converted' &&\n left.family === right.family &&\n JSON.stringify(semanticEffect(left)) === JSON.stringify(semanticEffect(right))\n );\n}\n\nfunction semanticEffect(plan: ResolvedSemanticPlan): ResolvedSemanticValue | Omit<FlexItemSemantics, 'axis'> {\n if (plan.family !== 'flex-item') return plan.value;\n const value = plan.value as FlexItemSemantics;\n if (value.min !== undefined || value.max !== undefined) return value;\n const { axis: _axis, ...effect } = value;\n return effect;\n}\n\nfunction semanticPolicy(catalog: BreakpointCatalog): SemanticTargetPolicy<SemanticPlanningPlan> {\n return {\n emptyPlan: input => resolved(input, { kind: 'empty' }),\n targetEligibility: () => undefined,\n validateActivation: plan => {\n if (plan.status !== 'converted') return plan;\n const plannedActivation = activation(plan.input, catalog);\n return 'status' in plannedActivation ? plannedActivation : plan;\n },\n isTargetEligibilityFailure: plan =>\n plan.status !== 'converted' && (plan.code === 'breakpoint-unverified' || plan.code === 'custom-breakpoint'),\n sameOutput: sameSemanticOutput,\n contextUnverified,\n contextualOutputUnverified: input =>\n contextUnverified(\n input,\n 'This directive emits different target outputs across its active responsive layout contexts.',\n ),\n responsivePrecedenceUnverified,\n decorate: plan => {\n if (plan.status !== 'converted') return plan;\n const plannedActivation = activation(plan.input, catalog);\n return 'status' in plannedActivation ? plannedActivation : { ...plan, activations: [plannedActivation] };\n },\n addPrintFallback: plan => {\n if (plan.status !== 'converted') return plan;\n const print = catalog.classify('print');\n return print.kind === 'verified'\n ? { ...plan, activations: [...plan.activations, { kind: 'media', definition: print.definition }] }\n : plan;\n },\n };\n}\n\nfunction equalClassValues(left: SemanticResponsiveClassValue, right: SemanticResponsiveClassValue): boolean {\n return (\n left.tokens.length === right.tokens.length &&\n left.tokens.every((token, index) => token.source === right.tokens[index]?.source)\n );\n}\n\nfunction equalStyleValues(left: ResponsiveStyleValue, right: ResponsiveStyleValue): boolean {\n return (\n left.declarations.length === right.declarations.length &&\n left.declarations.every(\n (declaration, index) =>\n declaration.property === right.declarations[index]?.property &&\n declaration.value === right.declarations[index]?.value,\n )\n );\n}\n\nfunction extendedMayControlDisplay(input: LocatedFlexLayoutInput, evidence: SourcePropertyEvidence): boolean {\n if (input.binding !== 'literal') return true;\n if (extendedStyleDirectives.has(input.directive)) {\n const parsed = parseLiteralStyleDeclarations(input.value);\n return (\n parsed.status === 'unverified' ||\n parsed.declarations.some(declaration => cssPropertiesOverlap(declaration.property, 'display'))\n );\n }\n return input.value\n .split(/\\s+/u)\n .filter(Boolean)\n .some(token => {\n const classification = evidence.classifyClassToken(token);\n return (\n classification.status === 'unverified' ||\n classification.evidence.properties.some(property => cssPropertiesOverlap(property, 'display'))\n );\n });\n}\n\nfunction hasLiteralGridParentClass(context: SemanticConversionContext): boolean {\n return Boolean(\n context.parent?.attributes.some(attribute => {\n if (attribute.binding !== 'literal' || !templateAttributeKeys(attribute).has('class')) return false;\n return attribute.value.split(/\\s+/u).some(className => className === 'grid' || className === 'inline-grid');\n }),\n );\n}\n\nfunction configuredPrintOwner(\n inputs: readonly LocatedFlexLayoutInput[],\n catalog: BreakpointCatalog,\n): { readonly inputId: string; readonly activation: SemanticActivation } | undefined {\n const configuredAliases = catalog.printWithBreakpoints;\n if (configuredAliases === undefined || inputs.some(input => input.breakpoint === 'print')) return undefined;\n const print = catalog.classify('print');\n if (print.kind !== 'verified') return undefined;\n const selected = inputs\n .flatMap(input => {\n if (input.breakpoint === undefined || !configuredAliases.includes(input.breakpoint)) return [];\n const classification = catalog.classify(input.breakpoint);\n return classification.kind === 'verified' ? [{ input, definition: classification.definition }] : [];\n })\n .sort(\n (left, right) =>\n right.definition.priority - left.definition.priority ||\n configuredAliases.indexOf(left.input.breakpoint ?? '') -\n configuredAliases.indexOf(right.input.breakpoint ?? ''),\n )[0];\n return selected === undefined\n ? undefined\n : { inputId: selected.input.id, activation: { kind: 'media', definition: print.definition } };\n}\n\nexport class ElementSemanticPlanner {\n constructor(\n private readonly breakpointConfig?: BreakpointMigrationConfig,\n private readonly sourcePropertyEvidence: SourcePropertyEvidence = unknownSourcePropertyEvidence,\n ) {}\n\n plan(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n options: {\n readonly breakpointConfig?: BreakpointMigrationConfig;\n readonly sourcePropertyEvidence?: SourcePropertyEvidence;\n } = {},\n ): readonly SemanticPlanningPlan[] {\n const completeContext = { ...context, inputs };\n const catalog = this.catalog(options.breakpointConfig);\n const sourceEvidence = options.sourcePropertyEvidence ?? this.sourcePropertyEvidence;\n const responsive = new ResponsiveFamilyPlanner(catalog, semanticPolicy(catalog));\n const visibilityInputs = inputs.filter(input => visibilityDirectives.has(input.directive));\n const extendedInputs = inputs.filter(input => extendedDirectives.has(input.directive));\n const ordinaryInputs = inputs.filter(\n input => !visibilityDirectives.has(input.directive) && !extendedDirectives.has(input.directive),\n );\n\n const initial = [\n ...responsive.plan(ordinaryInputs, completeContext, (input, itemContext) => this.planOne(input, itemContext)),\n ...this.planVisibility(visibilityInputs, catalog),\n ...this.planExtendedFamilies(extendedInputs, completeContext, catalog, sourceEvidence),\n ];\n const initialById = new Map(initial.map(plan => [plan.input.id, plan]));\n let closed: readonly SemanticPlanningPlan[] = inputs.map(\n input => initialById.get(input.id) ?? this.planOne(input, completeContext),\n );\n closed = this.closeResponsiveDependencies(closed, completeContext, responsive);\n closed = this.closeResponsiveDependencies(closed, completeContext, responsive);\n closed = this.closeGridContainerDependencies(closed);\n closed = this.assignGridDisplayOwnership(closed);\n closed = new SemanticFamilyCompositionPlanner(catalog, sourceEvidence).compose(closed, completeContext);\n\n return closed;\n }\n\n closeDependencies<TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput }>(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, SemanticDependencyPlan<TConverted>>,\n sourceEvidence: SourcePropertyEvidence = unknownSourcePropertyEvidence,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n let closed = this.closeRenderedFamilies(plans);\n closed = this.closeRenderedDisplayDependencies(closed, sourceEvidence);\n closed = this.closeRenderedFamilies(closed);\n closed = this.closeRenderedDisplayDependencies(closed, sourceEvidence);\n closed = this.closeParentLayoutDependencies(closed, context, plansByInputId);\n return this.closeGridParentDependencies(closed, context, plansByInputId);\n }\n\n closeSiblingFamilies<TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput }>(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n ): readonly SemanticDependencyPlan<TConverted>[] {\n return this.closeRenderedFamilies(plans);\n }\n\n closeDisplayDependencies<TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput }>(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n sourceEvidence: SourcePropertyEvidence = unknownSourcePropertyEvidence,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n return this.closeRenderedDisplayDependencies(plans, sourceEvidence);\n }\n\n private planOne(input: LocatedFlexLayoutInput, context: SemanticConversionContext): SemanticPlanningPlan {\n if (input.binding === 'property') return dynamicBinding(input);\n\n if (input.directive === 'fxLayout') {\n const layout = parseLayout(input.value);\n return layout.ok ? resolved(input, layout.value) : invalid(input);\n }\n if (input.directive === 'fxLayoutGap') {\n const layout = context.activeLayout ?? staticLayoutContext(context.element.attributes);\n return fromSemantic(input, planLayoutGapSemantics(input.value, layout));\n }\n if (input.directive === 'fxLayoutAlign') {\n const layout = context.activeLayout ?? staticLayoutContext(context.element.attributes);\n if (layout === undefined) {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Alignment sizing and direction depend on a dynamic or responsive layout.',\n suggestion: 'Make the layout static or migrate layout and alignment together manually.',\n };\n }\n return fromSemantic(input, planLayoutAlignment(input.value, layout));\n }\n if (flexItemDirectives.has(input.directive)) return this.planFlexItem(input, context);\n if (input.directive === 'fxFlexAlign') return fromSemantic(input, planFlexAlignSemantics(input.value));\n if (input.directive === 'fxFlexFill' || input.directive === 'fxFill') {\n return fromSemantic(input, planFlexFillSemantics());\n }\n if (input.directive === 'fxFlexOffset') {\n const layout = context.activeParentLayout ?? staticLayoutContext(context.parent?.attributes ?? []);\n return fromSemantic(input, planFlexOffsetSemantics(input.value, layout));\n }\n if (input.directive === 'fxFlexOrder') return fromSemantic(input, planFlexOrderSemantics(input.value));\n if (gridDirectives.has(input.directive)) return this.planGrid(input, context);\n\n return {\n status: 'unsupported',\n input,\n code: 'target-unsupported',\n reason: `No shared semantic family supports ${input.directive}.`,\n suggestion: 'Keep the directive and migrate it manually.',\n };\n }\n\n private planFlexItem(input: LocatedFlexLayoutInput, context: SemanticConversionContext): SemanticPlanningPlan {\n const flexInputs = context.inputs.filter(item => flexItemDirectives.has(item.directive));\n const atBreakpoint = (directive: LocatedFlexLayoutInput['directive']) =>\n flexInputs.filter(item => item.directive === directive && item.breakpoint === input.breakpoint);\n const atBase = (directive: LocatedFlexLayoutInput['directive']) =>\n flexInputs.filter(item => item.directive === directive && item.breakpoint === undefined);\n const exactFlex = atBreakpoint('fxFlex');\n const basis = exactFlex[0] ?? (input.breakpoint ? atBase('fxFlex')[0] : undefined);\n const exactGrow = atBreakpoint('fxGrow');\n const exactShrink = atBreakpoint('fxShrink');\n const grow = exactGrow[0] ?? (input.breakpoint ? atBase('fxGrow')[0] : undefined);\n const shrink = exactShrink[0] ?? (input.breakpoint ? atBase('fxShrink')[0] : undefined);\n const duplicateMember = [exactFlex, exactGrow, exactShrink].some(items => items.length > 1);\n if (!basis || duplicateMember) {\n return {\n status: 'invalid',\n input,\n code: 'invalid-value',\n reason: basis\n ? 'Multiple flex sizing inputs define the same responsive state.'\n : `${input.directive} requires an active fxFlex value.`,\n suggestion: 'Keep one flex sizing value per breakpoint or migrate this group manually.',\n };\n }\n\n return fromSemantic(\n input,\n planFlexItemSemantics({\n basis: basis.value,\n grow: grow?.value,\n shrink: shrink?.value,\n layout: context.activeParentLayout ?? staticLayoutContext(context.parent?.attributes ?? []),\n }),\n );\n }\n\n private planGrid(input: LocatedFlexLayoutInput, context: SemanticConversionContext): SemanticPlanningPlan {\n const parsed = parseGridValue(input);\n if (parsed.status === 'review') {\n return {\n status: 'review',\n input,\n code: parsed.code,\n reason: parsed.reason,\n suggestion: 'Replace the binding with a literal or migrate this Grid directive manually.',\n };\n }\n if (parsed.status === 'invalid') {\n return {\n status: 'invalid',\n input,\n code: parsed.code,\n reason: parsed.reason,\n suggestion: 'Correct the value or migrate this Grid directive manually.',\n };\n }\n if (\n parsed.plan.role === 'child' &&\n !context.parentInputs.some(parentInput => gridContainerDirectives.has(parentInput.directive)) &&\n !hasLiteralGridParentClass(context)\n ) {\n return contextUnverified(input, 'The parent element does not have a statically proven Grid container context.');\n }\n return resolved(input, parsed.plan);\n }\n\n private planVisibility(\n inputs: readonly LocatedFlexLayoutInput[],\n catalog: BreakpointCatalog,\n ): readonly SemanticPlanningPlan[] {\n const familyPlan = new VisibilityStatePlanner(catalog).plan(inputs);\n if (familyPlan.status === 'unresolved') {\n return familyPlan.plans;\n }\n const states = familyPlan.states.map(state => ({ intent: state.intent, activation: state.activation }));\n const owner = familyPlan.states[0]?.input.id;\n return inputs.map(input => ({\n ...resolved(input, { kind: 'visibility', emit: input.id === owner, states }),\n activations: [],\n }));\n }\n\n private planExtendedFamilies(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n catalog: BreakpointCatalog,\n sourceEvidence: SourcePropertyEvidence,\n ): readonly SemanticPlanningPlan[] {\n const plansById = new Map<string, SemanticPlanningPlan>();\n const familyPlanner = new ExtendedFamilyPlanner(catalog);\n const semanticPlanner = new ExtendedSemanticPlanner(sourceEvidence);\n\n for (const family of ['extended-class', 'extended-style'] as const) {\n const familyInputs = inputs.filter(input =>\n family === 'extended-class'\n ? extendedClassDirectives.has(input.directive)\n : extendedStyleDirectives.has(input.directive),\n );\n if (!familyInputs.length) continue;\n if (family === 'extended-class') {\n const familyPlan = familyPlanner.plan<SemanticResponsiveClassValue>({\n kind: 'class',\n inputs: familyInputs,\n valueParser: input => parseResponsiveClassValue(input, sourceEvidence),\n equals: equalClassValues,\n });\n const decision = semanticPlanner.plan({\n kind: 'class',\n familyPlan,\n attributes: context.attributeEvidence,\n });\n if (familyPlan.status === 'unresolved') {\n for (const plan of familyPlan.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n if (decision.status === 'unresolved') {\n for (const plan of decision.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n const printOwner = configuredPrintOwner(familyInputs, catalog);\n const states = familyPlan.states.map(state => ({\n activations: [state.activation, ...(printOwner?.inputId === state.input.id ? [printOwner.activation] : [])],\n tokens: state.value.tokens,\n }));\n for (const input of familyInputs) {\n plansById.set(input.id, {\n ...resolved(input, {\n kind: 'extended-class',\n emit: decision.ownerInputId === input.id,\n retainedTokens:\n decision.ownerInputId === undefined && input.id === familyPlan.states[0]?.input.id\n ? decision.retainedTokens\n : [],\n states,\n }),\n activations: [],\n });\n }\n continue;\n }\n\n const familyPlan = familyPlanner.plan<ResponsiveStyleValue>({\n kind: 'style',\n inputs: familyInputs,\n valueParser: input => parseResponsiveStyleValue(input, sourceEvidence),\n equals: equalStyleValues,\n });\n const decision = semanticPlanner.plan({\n kind: 'style',\n familyPlan,\n attributes: context.attributeEvidence,\n });\n if (familyPlan.status === 'unresolved') {\n for (const plan of familyPlan.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n if (decision.status === 'unresolved') {\n for (const plan of decision.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n const printOwner = configuredPrintOwner(familyInputs, catalog);\n const states = familyPlan.states.map(state => ({\n activations: [state.activation, ...(printOwner?.inputId === state.input.id ? [printOwner.activation] : [])],\n declarations: state.value.declarations,\n }));\n for (const input of familyInputs) {\n plansById.set(input.id, {\n ...resolved(input, {\n kind: 'extended-style',\n emit: decision.ownerInputId === input.id,\n states,\n }),\n activations: [],\n });\n }\n }\n\n return inputs.map(input => plansById.get(input.id) ?? dynamicBinding(input, true));\n }\n\n private closeResponsiveDependencies(\n plans: readonly SemanticPlanningPlan[],\n context: SemanticConversionContext,\n responsive: ResponsiveFamilyPlanner<SemanticPlanningPlan>,\n ): readonly SemanticPlanningPlan[] {\n const responsiveInputs = plans.map(plan => plan.input).filter(input => !extendedDirectives.has(input.directive));\n const current = new Map(plans.map(plan => [plan.input.id, plan]));\n const closed = responsive.closeDependencies(\n responsiveInputs,\n context,\n (input, itemContext) => current.get(input.id) ?? this.planOne(input, itemContext),\n );\n const closedById = new Map(closed.map(plan => [plan.input.id, plan]));\n return plans.map(plan => closedById.get(plan.input.id) ?? plan);\n }\n\n private closeGridContainerDependencies(plans: readonly SemanticPlanningPlan[]): readonly SemanticPlanningPlan[] {\n const containerPlans = plans.filter(\n plan => gridContainerDirectives.has(plan.input.directive) || plan.input.directive === 'gdInline',\n );\n if (!containerPlans.some(plan => plan.status !== 'converted')) return plans;\n return plans.map(plan =>\n plan.status === 'converted' &&\n (gridContainerDirectives.has(plan.input.directive) || plan.input.directive === 'gdInline')\n ? contextUnverified(plan.input, 'The Grid container display family contains an unresolved member.')\n : plan,\n );\n }\n\n private assignGridDisplayOwnership(plans: readonly SemanticPlanningPlan[]): readonly SemanticPlanningPlan[] {\n const hasBaseInline = plans.some(\n plan => plan.status === 'converted' && plan.input.directive === 'gdInline' && plan.input.breakpoint === undefined,\n );\n const ownerByBreakpoint = new Map<string, string>();\n if (!hasBaseInline) {\n for (const plan of plans) {\n if (plan.status !== 'converted' || !gridContainerDirectives.has(plan.input.directive)) continue;\n const breakpoint = plan.input.breakpoint ?? 'base';\n if (!ownerByBreakpoint.has(breakpoint)) ownerByBreakpoint.set(breakpoint, plan.input.id);\n }\n }\n return plans.map(plan =>\n plan.status === 'converted' && gridContainerDirectives.has(plan.input.directive)\n ? { ...plan, emitGridDisplay: ownerByBreakpoint.get(plan.input.breakpoint ?? 'base') === plan.input.id }\n : plan,\n );\n }\n\n private closeRenderedFamilies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(plans: readonly SemanticDependencyPlan<TConverted>[]): readonly SemanticDependencyPlan<TConverted>[] {\n const groups = new Map<DirectiveFamily, SemanticDependencyPlan<TConverted>[]>();\n for (const plan of plans) {\n const family = directiveFamily(plan.input.directive);\n if (!family) continue;\n const members = groups.get(family) ?? [];\n members.push(plan);\n groups.set(family, members);\n }\n const unresolvedFamilies = new Set(\n [...groups].filter(([, members]) => members.some(plan => plan.status !== 'converted')).map(([family]) => family),\n );\n let closed = plans.map(plan => {\n const family = directiveFamily(plan.input.directive);\n return plan.status === 'converted' && family !== undefined && unresolvedFamilies.has(family)\n ? contextUnverified(plan.input, 'Another member of this responsive directive family is unresolved.')\n : plan;\n });\n\n if (closed.some(plan => localLayoutDirectives.has(plan.input.directive) && plan.status !== 'converted')) {\n closed = closed.map(plan =>\n plan.status === 'converted' && localLayoutDirectives.has(plan.input.directive)\n ? contextUnverified(\n plan.input,\n 'The element layout context contains an unresolved dependent directive family.',\n )\n : plan,\n );\n }\n return closed;\n }\n\n private closeRenderedDisplayDependencies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n evidence: SourcePropertyEvidence,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n const layoutPlans = plans.filter(plan => plan.input.directive === 'fxLayout');\n const visibilityPlans = plans.filter(plan => visibilityDirectives.has(plan.input.directive));\n const authorityPlans = plans.filter(\n plan =>\n displayAuthorityDirectives.has(plan.input.directive) &&\n (extendedMayControlDisplay(plan.input, evidence) ||\n (plan.status !== 'converted' && extendedClassDirectives.has(plan.input.directive))),\n );\n const visibilityIsNoOp =\n visibilityPlans.length > 0 &&\n visibilityPlans.every(plan => plan.status === 'converted' && parseVisibilityValue(plan.input) === 'shown');\n if ((!layoutPlans.length && !authorityPlans.length) || !visibilityPlans.length || visibilityIsNoOp) return plans;\n if (![...layoutPlans, ...visibilityPlans, ...authorityPlans].some(plan => plan.status !== 'converted'))\n return plans;\n const affected = new Set([...layoutPlans, ...visibilityPlans, ...authorityPlans].map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && affected.has(plan.input.id) ? displayContextUnverified(plan.input) : plan,\n );\n }\n\n private closeParentLayoutDependencies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, SemanticDependencyPlan<TConverted>>,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n if (!plans.some(plan => parentLayoutDependentDirectives.has(plan.input.directive))) return plans;\n const parentContextInputs = context.parentInputs.filter(input => localLayoutDirectives.has(input.directive));\n const knownParentPlans = parentContextInputs\n .map(input => plansByInputId.get(input.id))\n .filter((plan): plan is SemanticDependencyPlan<TConverted> => plan !== undefined);\n if (!knownParentPlans.some(plan => plan.status !== 'converted')) return plans;\n return plans.map(plan =>\n plan.status === 'converted' && parentLayoutDependentDirectives.has(plan.input.directive)\n ? contextUnverified(plan.input, 'The responsive parent layout family contains an unresolved member.')\n : plan,\n );\n }\n\n private closeGridParentDependencies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, SemanticDependencyPlan<TConverted>>,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n if (!plans.some(plan => gridChildDirectives.has(plan.input.directive))) return plans;\n const parentGridInputs = context.parentInputs.filter(\n input => gridContainerDirectives.has(input.directive) || input.directive === 'gdInline',\n );\n const parentPlansAreSafe =\n parentGridInputs.some(input => gridContainerDirectives.has(input.directive)) &&\n parentGridInputs.every(input => plansByInputId.get(input.id)?.status === 'converted');\n if (parentPlansAreSafe || (parentGridInputs.length === 0 && hasLiteralGridParentClass(context))) return plans;\n if (parentGridInputs.length > 0 && parentGridInputs.every(input => !plansByInputId.has(input.id))) return plans;\n\n return plans.map(plan =>\n plan.status === 'converted' && gridChildDirectives.has(plan.input.directive)\n ? contextUnverified(plan.input, 'The parent Grid container conversion is unresolved.')\n : plan,\n );\n }\n\n private catalog(override?: BreakpointMigrationConfig): BreakpointCatalog {\n return new BreakpointCatalog(this.breakpointConfig ?? override ?? defaultSemanticBreakpointConfig);\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { ConversionRenderer, PlannedConversion } from '../render/conversion-renderer';\nimport type { SemanticConversionContext } from '../semantic/conversion-context';\nimport { ElementSemanticPlanner } from '../semantic/element-semantic.planner';\nimport type { ResolvedSemanticPlan, UnresolvedSemanticPlan } from '../semantic/semantic-plan';\n\ntype TargetDiagnostic = Exclude<PlannedConversion, { readonly status: 'converted' }>;\ntype ResultBoundary = 'Initial target rendering' | 'Target conflict resolution';\n\n/** Coordinates target-neutral semantic planning with exactly one target renderer. */\nexport class SemanticRenderCoordinator {\n private readonly semanticPlanner: ElementSemanticPlanner;\n\n constructor(\n readonly renderer: ConversionRenderer,\n semanticPlanner: ElementSemanticPlanner = new ElementSemanticPlanner(\n renderer.breakpointConfig,\n renderer.sourcePropertyEvidence,\n ),\n ) {\n this.semanticPlanner = semanticPlanner;\n }\n\n planElement(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n record = true,\n ): readonly PlannedConversion[] {\n this.assertUniqueInputIds(inputs);\n const semanticPlans = this.semanticPlanner.plan(inputs, context, {\n breakpointConfig: this.renderer.breakpointConfig,\n sourcePropertyEvidence: this.renderer.sourcePropertyEvidence,\n });\n const targetReady = semanticPlans.map(plan => this.applyTargetEligibility(plan));\n const familyClosed = this.semanticPlanner.closeSiblingFamilies(targetReady);\n const locallyClosed =\n this.renderer.target === 'css'\n ? this.semanticPlanner.closeDisplayDependencies(familyClosed, this.renderer.sourcePropertyEvidence)\n : familyClosed;\n const rendered = locallyClosed.map(plan =>\n plan.status === 'converted' ? this.renderer.render(plan, context) : plan,\n );\n this.assertResultCorrespondence(inputs, rendered, 'Initial target rendering');\n const resolved = this.renderer.resolveConflicts(rendered, context);\n this.assertResultCorrespondence(inputs, resolved, 'Target conflict resolution');\n if (record) this.record(resolved);\n return resolved;\n }\n\n record(plans: readonly PlannedConversion[]): void {\n this.renderer.record(plans);\n }\n\n closeDependencies(\n plans: readonly PlannedConversion[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, PlannedConversion>,\n ): readonly PlannedConversion[] {\n return this.semanticPlanner.closeDependencies(plans, context, plansByInputId, this.renderer.sourcePropertyEvidence);\n }\n\n private applyTargetEligibility(\n plan: ResolvedSemanticPlan | UnresolvedSemanticPlan,\n ): ResolvedSemanticPlan | TargetDiagnostic {\n const eligibility = this.renderer.eligibility(plan.input);\n if (eligibility?.status === 'converted') throw new Error('Renderer eligibility must not emit target output');\n if (eligibility !== undefined) return eligibility;\n if (plan.status === 'converted') return plan;\n if (plan.reason === 'Overlapping responsive ranges emit different target outputs for the same directive family.') {\n return {\n ...plan,\n reason:\n this.renderer.target === 'css'\n ? 'Overlapping responsive ranges emit different CSS declarations for the same directive family.'\n : 'Overlapping responsive ranges emit different utilities for the same directive family.',\n };\n }\n if (plan.reason === 'This directive emits different target outputs across its active responsive layout contexts.') {\n return {\n ...plan,\n reason:\n this.renderer.target === 'css'\n ? 'This directive emits different declarations across its active responsive layout contexts.'\n : 'This directive emits different utilities across its active responsive layout contexts.',\n };\n }\n return plan;\n }\n\n private assertUniqueInputIds(inputs: readonly LocatedFlexLayoutInput[]): void {\n const seen = new Set<string>();\n for (const input of inputs) {\n if (seen.has(input.id)) {\n throw internalInvariant(`Semantic render inputs contain duplicate ID \"${input.id}\".`, inputPaths(inputs));\n }\n seen.add(input.id);\n }\n }\n\n private assertResultCorrespondence(\n inputs: readonly LocatedFlexLayoutInput[],\n results: readonly PlannedConversion[],\n boundary: ResultBoundary,\n ): void {\n const paths = inputPaths(inputs, results);\n if (results.length !== inputs.length) {\n throw internalInvariant(\n `${boundary} returned ${results.length} ${results.length === 1 ? 'result' : 'results'} for ${inputs.length} inputs; results must be one-to-one and in stable order.`,\n paths,\n );\n }\n\n const seen = new Set<string>();\n for (const result of results) {\n if (seen.has(result.input.id)) {\n throw internalInvariant(`${boundary} returned duplicate input ID \"${result.input.id}\".`, paths);\n }\n seen.add(result.input.id);\n }\n\n for (let index = 0; index < inputs.length; index += 1) {\n const expected = inputs[index]!;\n const result = results[index]!;\n if (result.input.id !== expected.id) {\n throw internalInvariant(\n `${boundary} returned input ID \"${result.input.id}\" at index ${index}; expected \"${expected.id}\".`,\n paths,\n );\n }\n if (result.input !== expected) {\n throw internalInvariant(\n `${boundary} replaced the input identity for ID \"${expected.id}\" at index ${index}.`,\n paths,\n );\n }\n }\n }\n}\n\nfunction inputPaths(\n inputs: readonly LocatedFlexLayoutInput[],\n results: readonly PlannedConversion[] = [],\n): readonly string[] {\n return [...new Set([...inputs.map(input => input.fileName), ...results.map(result => result.input.fileName)])];\n}\n\nfunction internalInvariant(message: string, paths: readonly string[]): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message, paths);\n}\n","import type { PlannedConversion } from '../render/conversion-renderer';\nimport type { ConversionResult } from '../analyzer/conversion-result';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { SourceEdit } from '../edit/source-edit';\nimport { templateAttributeKeys } from '../template/template-attribute';\nimport type { SourceRange, TemplateElement } from '../template/template.model';\nimport { appendLiteralClassNames } from '../edit/html-attribute-value';\nimport { ResponsiveImagePlanner } from '../image/responsive-image.planner';\nimport type { ResponsiveImagePlan } from '../image/responsive-image.model';\nimport { PictureRenderer } from '../image/picture.renderer';\nimport type { ConversionRenderer } from '../render/conversion-renderer';\nimport type { SemanticConversionContext } from '../semantic/conversion-context';\nimport { ElementSemanticPlanner } from '../semantic/element-semantic.planner';\nimport { SemanticRenderCoordinator } from './semantic-render.coordinator';\n\nexport interface FilePlan {\n readonly edits: readonly SourceEdit[];\n readonly results: readonly ConversionResult[];\n}\n\nexport interface ConversionPlanningOptions {\n readonly responsiveImages: boolean;\n}\n\ninterface ElementConversions {\n readonly element: TemplateElement;\n readonly inputs: LocatedFlexLayoutInput[];\n readonly classPlans: Array<{\n readonly input: LocatedFlexLayoutInput;\n readonly classNames: readonly string[];\n }>;\n}\n\nconst directiveOrder = new Map(\n [\n 'fxLayout',\n 'fxLayoutGap',\n 'fxLayoutAlign',\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexAlign',\n 'fxFlexFill',\n 'fxFill',\n 'fxFlexOffset',\n 'fxFlexOrder',\n 'ngClass',\n 'class',\n 'ngStyle',\n 'style',\n 'fxShow',\n 'fxHide',\n ].map((directive, index) => [directive, index]),\n);\n\nfunction boundClassBlocked(input: LocatedFlexLayoutInput): PlannedConversion {\n return {\n status: 'review',\n input,\n code: 'bound-class',\n reason: 'Generated classes cannot be merged safely with a bound class value.',\n suggestion: 'Merge the generated classes into the binding manually.',\n };\n}\n\nfunction isBoundClassAttribute(attribute: TemplateElement['attributes'][number]): boolean {\n if (attribute.binding !== 'property') return false;\n return [...templateAttributeKeys(attribute)].some(\n key => key === 'class' || key === 'ngclass' || key.startsWith('class.') || key.startsWith('ngclass.'),\n );\n}\n\nfunction literalClassAttribute(element: TemplateElement) {\n return element.attributes.find(\n attribute => attribute.binding === 'literal' && templateAttributeKeys(attribute).has('class'),\n );\n}\n\nfunction removalRange(source: string, input: LocatedFlexLayoutInput): SourceRange {\n const start =\n input.source.start > 0 && /[\\t ]/.test(source[input.source.start - 1] ?? '')\n ? input.source.start - 1\n : input.source.start;\n return { start, end: input.source.end };\n}\n\nexport class ConversionPlanner {\n plan(\n source: string,\n elements: readonly TemplateElement[],\n inputs: readonly LocatedFlexLayoutInput[],\n renderer: ConversionRenderer,\n options: ConversionPlanningOptions = { responsiveImages: false },\n semanticPlanner: ElementSemanticPlanner = new ElementSemanticPlanner(renderer.breakpointConfig),\n ): FilePlan {\n const coordinator = new SemanticRenderCoordinator(renderer, semanticPlanner);\n const elementById = new Map(elements.map(element => [element.id, element]));\n const inputsByElementId = new Map<string, LocatedFlexLayoutInput[]>();\n for (const input of inputs) {\n const elementInputs = inputsByElementId.get(input.elementId) ?? [];\n elementInputs.push(input);\n inputsByElementId.set(input.elementId, elementInputs);\n }\n const conversionsByElement = new Map<string, ElementConversions>();\n const results: ConversionResult[] = [];\n const plansByInputId = new Map<string, PlannedConversion>();\n const plansByElementId = new Map<string, readonly PlannedConversion[]>();\n const contextsByElementId = new Map<string, SemanticConversionContext>();\n const imagePlansByElementId = new Map<string, ResponsiveImagePlan>();\n\n for (const element of elements) {\n const allElementInputs = inputsByElementId.get(element.id) ?? [];\n if (!allElementInputs.length) continue;\n const elementInputs = allElementInputs.filter(input => input.directive !== 'imgSrc');\n if (!elementInputs.length) continue;\n const parent = element.parentId ? elementById.get(element.parentId) : undefined;\n const literalClass = literalClassAttribute(element);\n const existingClassNames = literalClass?.value.split(/\\s+/).filter(Boolean) ?? [];\n const context: SemanticConversionContext = {\n element,\n inputs: elementInputs,\n existingClassNames,\n attributeEvidence: element.attributes,\n ...(parent\n ? { parent, parentInputs: inputsByElementId.get(parent.id) ?? [] }\n : { parentInputs: [] as readonly LocatedFlexLayoutInput[] }),\n };\n let plans = coordinator.planElement(elementInputs, context, false);\n const hasBoundClass = element.attributes.some(isBoundClassAttribute);\n if (hasBoundClass) {\n plans = plans.map(plan =>\n plan.status === 'converted' && plan.classNames.length > 0 ? boundClassBlocked(plan.input) : plan,\n );\n }\n contextsByElementId.set(element.id, context);\n plansByElementId.set(element.id, plans);\n for (const planned of plans) plansByInputId.set(planned.input.id, planned);\n }\n\n for (const element of elements) {\n const plans = plansByElementId.get(element.id);\n const context = contextsByElementId.get(element.id);\n if (!plans || !context) continue;\n const closedPlans = coordinator.closeDependencies(plans, context, plansByInputId);\n for (const planned of closedPlans) plansByInputId.set(planned.input.id, planned);\n }\n\n for (const element of elements) {\n const imageInputs = (inputsByElementId.get(element.id) ?? []).filter(input => input.directive === 'imgSrc');\n if (!imageInputs.length) continue;\n const ancestors: TemplateElement[] = [];\n let ancestor = element.parentId ? elementById.get(element.parentId) : undefined;\n while (ancestor) {\n ancestors.push(ancestor);\n ancestor = ancestor.parentId ? elementById.get(ancestor.parentId) : undefined;\n }\n const imageResult = new ResponsiveImagePlanner().plan(\n imageInputs,\n { element, ancestors },\n options.responsiveImages,\n );\n const ordinaryPlans = (inputsByElementId.get(element.id) ?? [])\n .filter(input => input.directive !== 'imgSrc')\n .map(input => plansByInputId.get(input.id))\n .filter((plan): plan is PlannedConversion => plan !== undefined);\n const unresolvedOrdinary = ordinaryPlans.some(plan => plan.status !== 'converted');\n\n if (imageResult.status === 'unresolved') {\n for (const plan of imageResult.plans) plansByInputId.set(plan.input.id, plan);\n continue;\n }\n\n if (!unresolvedOrdinary) {\n imagePlansByElementId.set(element.id, imageResult.plan);\n for (const input of imageInputs) {\n plansByInputId.set(input.id, { status: 'converted', input, classNames: [] });\n }\n continue;\n }\n\n const familyFailure = {\n status: 'review' as const,\n code: 'context-unverified' as const,\n reason: 'Responsive image and same-element conversions must be applied atomically.',\n suggestion: 'Resolve all conversions on this image before enabling its picture migration.',\n };\n for (const plan of ordinaryPlans) {\n if (plan.status === 'converted') plansByInputId.set(plan.input.id, { ...familyFailure, input: plan.input });\n }\n for (const input of imageInputs) plansByInputId.set(input.id, { ...familyFailure, input });\n }\n\n coordinator.record(\n inputs.map(input => plansByInputId.get(input.id)).filter((plan): plan is PlannedConversion => plan !== undefined),\n );\n\n for (const input of inputs) {\n const element = elementById.get(input.elementId);\n if (!element) continue;\n const planned = plansByInputId.get(input.id);\n if (!planned) continue;\n\n if (planned.status !== 'converted') {\n results.push(planned);\n continue;\n }\n\n if (input.directive === 'imgSrc') {\n results.push({ status: 'converted', input });\n continue;\n }\n\n const conversion = conversionsByElement.get(element.id) ?? {\n element,\n inputs: [],\n classPlans: [],\n };\n conversion.inputs.push(input);\n conversion.classPlans.push({ input, classNames: planned.classNames });\n conversionsByElement.set(element.id, conversion);\n results.push({ status: 'converted', input });\n }\n\n const edits: SourceEdit[] = [];\n for (const conversion of conversionsByElement.values()) {\n const generatedClassNames = [...conversion.classPlans]\n .sort(\n (left, right) =>\n (directiveOrder.get(left.input.directive) ?? Number.MAX_SAFE_INTEGER) -\n (directiveOrder.get(right.input.directive) ?? Number.MAX_SAFE_INTEGER) ||\n (left.input.breakpoint ?? '').localeCompare(right.input.breakpoint ?? '') ||\n left.input.source.start - right.input.source.start,\n )\n .flatMap(plan => plan.classNames);\n edits.push(\n ...conversion.inputs.map(input => ({\n range: removalRange(source, input),\n text: '',\n inputId: input.id,\n })),\n );\n\n const classEdit = appendLiteralClassNames(\n source,\n conversion.element,\n literalClassAttribute(conversion.element),\n generatedClassNames,\n `${conversion.element.id}:classes`,\n );\n if (classEdit !== undefined) edits.push(classEdit);\n }\n\n for (const [elementId, imagePlan] of imagePlansByElementId) {\n const containedEdits = edits.filter(\n edit => edit.range.start >= imagePlan.element.source.start && edit.range.end <= imagePlan.element.source.end,\n );\n const externalEdits = edits.filter(edit => !containedEdits.includes(edit));\n edits.length = 0;\n edits.push(...externalEdits, {\n range: imagePlan.element.source,\n text: new PictureRenderer().render(source, imagePlan, containedEdits),\n inputId: `${elementId}:responsive-image`,\n });\n }\n\n return { edits, results };\n }\n}\n","import * as path from 'node:path';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport type { ConversionResult } from '../analyzer/conversion-result';\nimport type { MediaDefinition } from '../breakpoint/breakpoint-catalog';\nimport type { SourceEdit } from '../edit/source-edit';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { AdapterSessionResult } from '../render/render-session';\nimport { analyzedProject, type AnalyzedProject, type AnalyzedTemplate } from './analyzed-project';\nimport type { ManifestTemplate } from './project-manifest';\n\nexport interface RenderedTemplateFile {\n readonly inputPath: string;\n readonly outputPath: string;\n readonly edits: readonly SourceEdit[];\n readonly results: readonly ConversionResult[];\n}\n\nexport interface RenderedProject {\n readonly analyzed: AnalyzedProject;\n readonly target: 'css' | 'tailwind';\n readonly files: readonly RenderedTemplateFile[];\n readonly session: AdapterSessionResult;\n}\n\nexport function renderedProject(project: RenderedProject): RenderedProject {\n const analyzed = analyzedProject(project.analyzed);\n if (project.files.length !== analyzed.templates.length) throw sequenceInvariant();\n const files = project.files.map((file, index) => {\n const template = analyzed.templates[index];\n if (template === undefined || !samePathPair(template.file, file)) {\n throw sequenceInvariant([file.inputPath, file.outputPath]);\n }\n if (\n template.status === 'parse-error' &&\n (file.edits.length > 0 || !sameOwnedValue(file.results, parseErrorResults(template)))\n ) {\n throw internalInvariant(\n 'Rendered parse-error files must be edit-free and preserve their analyzed diagnostics exactly.',\n [file.inputPath, file.outputPath],\n );\n }\n const suppliedTemplate = project.analyzed.templates[index];\n if (template.status === 'parsed') {\n if (suppliedTemplate?.status !== 'parsed') throw sequenceInvariant([file.inputPath, file.outputPath]);\n assertParsedResultCorrespondence(suppliedTemplate, file.results);\n }\n const identity = template.file;\n return freezeRenderedFile({\n inputPath: identity.inputPath,\n outputPath: identity.outputPath,\n edits: file.edits,\n results: template.status === 'parsed' ? canonicalParsedResults(template, file.results) : file.results,\n });\n });\n\n return Object.freeze({\n analyzed,\n target: project.target,\n files: Object.freeze(files),\n session: freezeSessionResult(project.session),\n });\n}\n\nfunction assertParsedResultCorrespondence(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n results: readonly ConversionResult[],\n): void {\n const paths = [template.file.inputPath, template.file.outputPath];\n if (results.length !== template.inputs.length) {\n throw internalInvariant('Parsed render results must match analyzed inputs one-to-one and in stable order.', paths);\n }\n\n const seen = new Set<string>();\n for (let index = 0; index < results.length; index += 1) {\n const result = results[index]!;\n if (result.status === 'parse-error') {\n throw internalInvariant('Parsed render results cannot contain parse-error results.', paths);\n }\n const actual = result.input;\n const expected = template.inputs[index]!;\n if (!('id' in actual) || typeof actual.id !== 'string') {\n throw internalInvariant('Parsed render results must retain analyzed input IDs.', paths);\n }\n if (seen.has(actual.id)) {\n throw internalInvariant(`Parsed render results contain duplicate input ID \"${actual.id}\".`, paths);\n }\n seen.add(actual.id);\n if (actual.id !== expected.id) {\n throw internalInvariant(\n `Parsed render result input ID \"${actual.id}\" at index ${index} does not match analyzed input ID \"${expected.id}\".`,\n paths,\n );\n }\n if (actual !== expected) {\n throw internalInvariant(`Parsed render result replaced analyzed input identity \"${expected.id}\".`, paths);\n }\n }\n}\n\nfunction canonicalParsedResults(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n results: readonly ConversionResult[],\n): readonly ConversionResult[] {\n return Object.freeze(\n results.map((result, index) => {\n if (result.status === 'parse-error') throw new Error('Parsed render-result validation was bypassed.');\n return Object.freeze({ ...result, input: template.inputs[index]! });\n }),\n );\n}\n\nfunction parseErrorResults(\n template: Extract<AnalyzedProject['templates'][number], { readonly status: 'parse-error' }>,\n): readonly ConversionResult[] {\n return template.parseResult.diagnostics.map(diagnostic => ({\n status: 'parse-error',\n fileName: template.file.inputPath,\n code: 'template-parse-error',\n reason: diagnostic.message,\n source: diagnostic.source,\n }));\n}\n\nfunction freezeRenderedFile(file: RenderedTemplateFile): RenderedTemplateFile {\n return Object.freeze({\n inputPath: file.inputPath,\n outputPath: file.outputPath,\n edits: Object.freeze(\n file.edits.map(edit =>\n Object.freeze({\n ...edit,\n range: Object.freeze({ ...edit.range }),\n }),\n ),\n ),\n results: Object.freeze(\n file.results.map(result => (result.status === 'parse-error' ? freezeValue(result) : result)),\n ),\n });\n}\n\nfunction freezeSessionResult(session: AdapterSessionResult): AdapterSessionResult {\n if (session.target === 'tailwind') return Object.freeze({ target: session.target });\n return Object.freeze({\n target: session.target,\n rules: Object.freeze(session.rules.map(rule => freezeOwnedCssRule(rule))),\n });\n}\n\nfunction freezeOwnedCssRule(rule: OwnedCssRule): OwnedCssRule {\n return Object.freeze({\n ...rule,\n declarations: Object.freeze(rule.declarations.map(declaration => Object.freeze({ ...declaration }))),\n context: Object.freeze({\n ...rule.context,\n ...(rule.context.media === undefined ? {} : { media: freezeMedia(rule.context.media) }),\n }),\n });\n}\n\nfunction freezeMedia(media: MediaDefinition): MediaDefinition {\n return Object.freeze({\n ...media,\n clauses: Object.freeze(media.clauses.map(clause => Object.freeze({ ...clause }))),\n });\n}\n\nfunction samePathPair(left: ManifestTemplate, right: RenderedTemplateFile): boolean {\n return (\n normalizedAbsolutePath(left.inputPath) === normalizedAbsolutePath(right.inputPath) &&\n normalizedAbsolutePath(left.outputPath) === normalizedAbsolutePath(right.outputPath)\n );\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n\nfunction sameOwnedValue(left: unknown, right: unknown): boolean {\n if (Object.is(left, right)) return true;\n if (Array.isArray(left) || Array.isArray(right)) {\n return (\n Array.isArray(left) &&\n Array.isArray(right) &&\n left.length === right.length &&\n left.every((item, index) => sameOwnedValue(item, right[index]))\n );\n }\n if (!isPlainRecord(left) || !isPlainRecord(right)) return false;\n const keys = Object.keys(left);\n return (\n keys.length === Object.keys(right).length &&\n keys.every(key => Object.hasOwn(right, key) && sameOwnedValue(left[key], right[key]))\n );\n}\n\nfunction isPlainRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (value === null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value) as unknown;\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction freezeValue<T>(value: T): T {\n if (Array.isArray(value)) return Object.freeze(value.map(item => freezeValue(item))) as T;\n if (value !== null && typeof value === 'object') {\n return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, freezeValue(item)]))) as T;\n }\n return value;\n}\n\nfunction sequenceInvariant(paths: readonly string[] = []): MigrationApplicationError {\n return internalInvariant(\n 'Rendered project files must match its analyzed templates one-to-one and in the same order.',\n paths,\n );\n}\n\nfunction internalInvariant(message: string, paths: readonly string[] = []): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message, paths);\n}\n","import type { ConversionResult } from '../../analyzer/conversion-result';\nimport { ConversionPlanner, type ConversionPlanningOptions, type FilePlan } from '../../planner/conversion-planner';\nimport type { ConversionRenderer } from '../../render/conversion-renderer';\nimport type { RenderSession } from '../../render/render-session';\nimport type { AnalyzedTemplate, AnalyzedProject } from '../analyzed-project';\nimport type { RenderStage } from '../migration-pipeline';\nimport { renderedProject, type RenderedProject, type RenderedTemplateFile } from '../rendered-project';\n\nexport interface RenderTemplatePlanner {\n plan(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n renderer: ConversionRenderer,\n options: ConversionPlanningOptions,\n ): FilePlan;\n}\n\nconst defaultTemplatePlanner: RenderTemplatePlanner = Object.freeze({\n plan(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n renderer: ConversionRenderer,\n options: ConversionPlanningOptions,\n ): FilePlan {\n return new ConversionPlanner().plan(\n template.source,\n template.parseResult.elements,\n template.inputs,\n renderer,\n options,\n );\n },\n});\n\nexport class RenderProjectStage implements RenderStage {\n constructor(\n private readonly session: RenderSession,\n private readonly templatePlanner: RenderTemplatePlanner = defaultTemplatePlanner,\n ) {}\n\n public async run(analyzed: AnalyzedProject): Promise<RenderedProject> {\n const files: RenderedTemplateFile[] = [];\n const options: ConversionPlanningOptions = {\n responsiveImages: analyzed.manifest.invocation.options.responsiveImages ?? false,\n };\n\n for (const template of analyzed.templates) {\n if (template.status === 'parse-error') {\n files.push(parseErrorPlan(template));\n continue;\n }\n\n const plan = this.templatePlanner.plan(template, this.session.renderer, options);\n files.push({\n inputPath: template.file.inputPath,\n outputPath: template.file.outputPath,\n edits: plan.edits,\n results: plan.results,\n });\n }\n\n const finalizedSession = this.session.finalize();\n return renderedProject({ analyzed, target: this.session.renderer.target, files, session: finalizedSession });\n }\n}\n\nfunction parseErrorPlan(template: Extract<AnalyzedTemplate, { readonly status: 'parse-error' }>): RenderedTemplateFile {\n const results: readonly ConversionResult[] = template.parseResult.diagnostics.map(diagnostic => ({\n status: 'parse-error',\n fileName: template.file.inputPath,\n code: 'template-parse-error',\n reason: diagnostic.message,\n source: diagnostic.source,\n }));\n return {\n inputPath: template.file.inputPath,\n outputPath: template.file.outputPath,\n edits: [],\n results,\n };\n}\n","import * as path from 'node:path';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport { migrationPlan, type FileMigrationPlan, type PlannedOutputArtifact } from '../../migrator/migration-plan';\nimport { validateMigrationPaths, validateStylesheetRootTopology } from '../../migrator/migration-path.validator';\nimport { StylesheetPlanner } from '../../migrator/stylesheet.planner';\nimport type { StylesheetMigrationResult } from '../../report/migration-report.builder';\nimport type { ValidateStage } from '../migration-pipeline';\nimport type { MigrationInvocation } from '../project-manifest';\nimport { renderedProject, type RenderedProject } from '../rendered-project';\nimport { validatedProjectPlan, type ValidatedProjectPlan } from '../validated-project-plan';\nimport { CssReferenceCollector } from './css-reference.collector';\nimport { TemplateProposalValidator } from './template-proposal.validator';\n\ntype TemplateProposalValidatorPort = Pick<TemplateProposalValidator, 'validate'>;\ntype CssReferenceCollectorPort = Pick<CssReferenceCollector, 'collect'>;\ntype StylesheetPlannerPort = Pick<StylesheetPlanner, 'plan'>;\n\nexport class ValidateProjectStage implements ValidateStage {\n constructor(\n private readonly templateValidator: TemplateProposalValidatorPort = new TemplateProposalValidator(),\n private readonly cssReferences: CssReferenceCollectorPort = new CssReferenceCollector(),\n private readonly stylesheetPlanner: StylesheetPlannerPort = new StylesheetPlanner(),\n ) {}\n\n public async prevalidate(invocation: MigrationInvocation): Promise<void> {\n await validateStylesheetRootTopology({\n stylesheetPath: invocation.options.stylesheetPath,\n stylesheetPathInput: invocation.options.stylesheetPathInput,\n inputPath: invocation.canonicalInputPath,\n outputPath: invocation.canonicalOutputPath,\n reportPath: invocation.options.reportPath,\n });\n }\n\n public async run(input: RenderedProject): Promise<ValidatedProjectPlan> {\n const rendered = renderedProject(input);\n this.validateConfiguration(rendered);\n\n const stylesheetPath = rendered.analyzed.manifest.invocation.options.stylesheetPath;\n const reportPath = rendered.analyzed.manifest.invocation.options.reportPath;\n const invocation = rendered.analyzed.manifest.invocation;\n await this.prevalidate(invocation);\n await validateMigrationPaths({ templates: rendered.files, stylesheetPath, reportPath });\n\n const files: FileMigrationPlan[] = [];\n for (const [index, renderedFile] of rendered.files.entries()) {\n const template = rendered.analyzed.templates[index];\n if (template === undefined) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n 'Rendered project files must match its analyzed templates one-to-one and in the same order.',\n );\n }\n files.push(await this.templateValidator.validate(template, renderedFile));\n }\n\n let stylesheetArtifact: PlannedOutputArtifact | undefined;\n let stylesheet: StylesheetMigrationResult | undefined;\n if (rendered.session.target === 'css' && stylesheetPath !== undefined) {\n const canonicalStylesheetPath = path.resolve(stylesheetPath);\n const references = await this.cssReferences.collect(rendered, files);\n stylesheetArtifact = await this.stylesheetPlanner.plan(\n canonicalStylesheetPath,\n rendered.session.rules,\n references,\n );\n stylesheet = {\n path: canonicalStylesheetPath,\n change: stylesheetChange(stylesheetArtifact),\n };\n }\n\n const plan = migrationPlan({\n target: rendered.session.target,\n files: files.map(item => item.file),\n artifacts: [\n ...files.flatMap(item => (item.artifact === undefined ? [] : [item.artifact])),\n ...(stylesheetArtifact === undefined ? [] : [stylesheetArtifact]),\n ],\n });\n await validateMigrationPaths({ templates: plan.files, stylesheetPath, reportPath });\n\n return validatedProjectPlan({ rendered, plan, ...(stylesheet === undefined ? {} : { stylesheet }) });\n }\n\n private validateConfiguration(rendered: RenderedProject): void {\n const stylesheetPath = rendered.analyzed.manifest.invocation.options.stylesheetPath;\n if (rendered.target === 'css' && stylesheetPath === undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--target css requires --stylesheet <path>.');\n }\n if (rendered.target === 'tailwind' && stylesheetPath !== undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--stylesheet can only be used with --target css.', [\n stylesheetPath,\n ]);\n }\n }\n}\n\nfunction stylesheetChange(artifact: PlannedOutputArtifact | undefined): StylesheetMigrationResult['change'] {\n if (artifact === undefined) return 'unchanged';\n if (artifact.original.status === 'absent') return 'created';\n if (artifact.proposed.status === 'absent') return 'removed';\n return 'updated';\n}\n","import * as path from 'node:path';\nimport { fileMigrationResult, type FileMigrationResult } from './file-migration-result';\n\nexport type ArtifactState = { readonly status: 'absent' } | { readonly status: 'present'; readonly contents: string };\n\nexport interface PlannedOutputArtifact {\n readonly kind: 'template' | 'stylesheet';\n readonly path: string;\n readonly original: ArtifactState;\n readonly proposed: ArtifactState;\n}\n\nexport interface FileMigrationPlan {\n readonly file: FileMigrationResult;\n readonly artifact?: PlannedOutputArtifact;\n}\n\nexport interface MigrationPlan {\n readonly target: 'css' | 'tailwind';\n readonly files: readonly FileMigrationResult[];\n readonly artifacts: readonly PlannedOutputArtifact[];\n}\n\nexport function plannedOutputArtifact(artifact: PlannedOutputArtifact): PlannedOutputArtifact {\n if (!path.isAbsolute(artifact.path)) {\n throw new Error(`Planned artifact paths must be absolute: ${artifact.path}`);\n }\n if (artifact.kind === 'template' && artifact.proposed.status === 'absent') {\n throw new Error('Planned template artifacts must have a present proposed state.');\n }\n if (sameState(artifact.original, artifact.proposed)) {\n throw new Error('Planned artifacts require changed states.');\n }\n\n return Object.freeze({\n kind: artifact.kind,\n path: path.resolve(artifact.path),\n original: artifactState(artifact.original),\n proposed: artifactState(artifact.proposed),\n });\n}\n\nexport function fileMigrationPlan(plan: FileMigrationPlan): FileMigrationPlan {\n return Object.freeze({\n file: fileMigrationResult(plan.file),\n ...(plan.artifact ? { artifact: plannedOutputArtifact(plan.artifact) } : {}),\n });\n}\n\nexport function migrationPlan(plan: MigrationPlan): MigrationPlan {\n return Object.freeze({\n target: plan.target,\n files: Object.freeze(plan.files.map(file => fileMigrationResult(file))),\n artifacts: Object.freeze(plan.artifacts.map(artifact => plannedOutputArtifact(artifact))),\n });\n}\n\nfunction artifactState(state: ArtifactState): ArtifactState {\n return Object.freeze(state.status === 'absent' ? { status: 'absent' as const } : { ...state });\n}\n\nfunction sameState(left: ArtifactState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n","import type { ConversionResult } from '../analyzer/conversion-result';\n\nexport interface FileMigrationOptions {\n readonly responsiveImages?: boolean;\n}\n\nexport interface FileMigrationResult {\n readonly inputPath: string;\n readonly outputPath: string;\n readonly changed: boolean;\n readonly results: readonly ConversionResult[];\n}\n\nexport function fileMigrationResult(result: FileMigrationResult): FileMigrationResult {\n return Object.freeze({\n inputPath: result.inputPath,\n outputPath: result.outputPath,\n changed: result.changed,\n results: freezeValue([...result.results]),\n });\n}\n\nfunction freezeValue<T>(value: T): T {\n if (Array.isArray(value)) {\n return Object.freeze(value.map(item => freezeValue(item))) as T;\n }\n if (value !== null && typeof value === 'object') {\n return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, freezeValue(item)]))) as T;\n }\n return value;\n}\n","import { lstat, stat } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { MigrationApplicationError } from './migration-application.error';\n\nexport type PathApi = typeof path.posix;\n\nexport interface MigrationPathValidationRequest {\n readonly templates: readonly { readonly inputPath: string; readonly outputPath: string }[];\n readonly stylesheetPath?: string;\n readonly reportPath?: string;\n}\n\nexport interface StylesheetRootTopologyRequest {\n readonly stylesheetPath?: string;\n readonly stylesheetPathInput?: string;\n readonly inputPath: string;\n readonly outputPath: string;\n readonly reportPath?: string;\n}\n\ninterface PathClaim {\n readonly path: string;\n readonly kind: 'template-input' | 'template-output' | 'stylesheet' | 'report';\n readonly templateIndex?: number;\n}\n\ninterface FileSystemIdentity {\n readonly device: string;\n readonly inode: string;\n}\n\ninterface ExistingPathPrefix {\n readonly identity: FileSystemIdentity;\n readonly suffix: readonly string[];\n}\n\ninterface ObservedPath {\n readonly exactIdentity?: FileSystemIdentity;\n readonly prefixes: readonly ExistingPathPrefix[];\n}\n\ntype PathRelationship = 'equivalent' | 'ancestor' | 'descendant' | 'distinct';\ntype PathObserver = (candidate: string) => Promise<ObservedPath>;\n\nexport async function validateMigrationPaths(\n request: MigrationPathValidationRequest,\n pathApi: PathApi = path,\n): Promise<void> {\n const claims = normalizedClaims(request, pathApi);\n await validateCollisions(claims, pathApi);\n\n const destinations = claims.filter(claim => claim.kind !== 'template-input');\n for (const destination of destinations) {\n await validateDestination(destination.path);\n }\n}\n\nexport async function validateStylesheetRootTopology(\n request: StylesheetRootTopologyRequest,\n pathApi: PathApi = path,\n): Promise<void> {\n if (request.stylesheetPath === undefined) return;\n const stylesheetPath = pathApi.resolve(request.stylesheetPath);\n const templateRoots = [request.inputPath, request.outputPath].map(claim => pathApi.resolve(claim));\n const reportPath = request.reportPath === undefined ? undefined : pathApi.resolve(request.reportPath);\n const exactCollision = (\n await Promise.all(\n [...templateRoots, reportPath].map(claim =>\n claim === undefined ? Promise.resolve(false) : pathsEquivalentOnFileSystem(stylesheetPath, claim, pathApi),\n ),\n )\n ).some(Boolean);\n const reportHierarchyCollision =\n reportPath !== undefined && (await pathsOverlapOnFileSystem(stylesheetPath, reportPath, pathApi));\n if (exactCollision || reportHierarchyCollision) {\n const collisionPaths =\n reportHierarchyCollision &&\n reportPath !== undefined &&\n !(await pathsEquivalentOnFileSystem(stylesheetPath, reportPath, pathApi))\n ? [stylesheetPath, reportPath]\n : [stylesheetPath];\n throw new MigrationApplicationError(\n 'path-collision',\n `Stylesheet path collides with another migration path: ${request.stylesheetPathInput ?? request.stylesheetPath}`,\n collisionPaths,\n );\n }\n\n let stylesheetStat: Awaited<ReturnType<typeof lstat>>;\n try {\n stylesheetStat = await lstat(stylesheetPath);\n } catch (error: unknown) {\n if (isEnoent(error)) return;\n throw error;\n }\n const sourcePath = request.stylesheetPathInput ?? request.stylesheetPath;\n if (stylesheetStat.isSymbolicLink()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must not be a symbolic link: ${sourcePath}`,\n [stylesheetPath],\n );\n }\n if (!stylesheetStat.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must be a regular file: ${sourcePath}`,\n [stylesheetPath],\n );\n }\n}\n\nfunction normalizedClaims(request: MigrationPathValidationRequest, pathApi: PathApi): readonly PathClaim[] {\n return [\n ...request.templates.flatMap((template, templateIndex) => [\n { path: pathApi.resolve(template.inputPath), kind: 'template-input' as const, templateIndex },\n { path: pathApi.resolve(template.outputPath), kind: 'template-output' as const, templateIndex },\n ]),\n ...(request.stylesheetPath ? [{ path: pathApi.resolve(request.stylesheetPath), kind: 'stylesheet' as const }] : []),\n ...(request.reportPath ? [{ path: pathApi.resolve(request.reportPath), kind: 'report' as const }] : []),\n ];\n}\n\nasync function validateCollisions(claims: readonly PathClaim[], pathApi: PathApi): Promise<void> {\n const observations = new Map<string, Promise<ObservedPath>>();\n const observe: PathObserver = candidate => {\n const normalized = pathApi.resolve(candidate);\n const existing = observations.get(normalized);\n if (existing) return existing;\n const pending = observePath(normalized, pathApi);\n observations.set(normalized, pending);\n return pending;\n };\n\n for (let leftIndex = 0; leftIndex < claims.length; leftIndex++) {\n const left = claims[leftIndex];\n if (!left) continue;\n for (let rightIndex = leftIndex + 1; rightIndex < claims.length; rightIndex++) {\n const right = claims[rightIndex];\n if (!right) continue;\n const relationship = await fileSystemPathRelationship(left.path, right.path, pathApi, observe);\n if (relationship === 'distinct' || isIntentionalInPlacePair(left, right, pathApi)) continue;\n\n const collisionPaths = relationship === 'equivalent' ? [left.path] : [left.path, right.path];\n throw new MigrationApplicationError(\n 'path-collision',\n `Migration paths collide: ${collisionPaths.join(' and ')}`,\n collisionPaths,\n );\n }\n }\n}\n\nfunction isIntentionalInPlacePair(left: PathClaim, right: PathClaim, pathApi: PathApi): boolean {\n return (\n pathsEquivalent(left.path, right.path, pathApi) &&\n left.templateIndex !== undefined &&\n left.templateIndex === right.templateIndex &&\n left.kind !== right.kind &&\n left.kind.startsWith('template-') &&\n right.kind.startsWith('template-')\n );\n}\n\nexport function pathsOverlap(left: string, right: string, pathApi: PathApi = path): boolean {\n const normalizedLeft = pathApi.resolve(left);\n const normalizedRight = pathApi.resolve(right);\n return (\n normalizedPathsEquivalent(pathApi, normalizedLeft, normalizedRight) ||\n isAncestor(pathApi, normalizedLeft, normalizedRight) ||\n isAncestor(pathApi, normalizedRight, normalizedLeft)\n );\n}\n\nexport function pathsEquivalent(left: string, right: string, pathApi: PathApi = path): boolean {\n return normalizedPathsEquivalent(pathApi, pathApi.resolve(left), pathApi.resolve(right));\n}\n\nexport async function pathsEquivalentOnFileSystem(\n left: string,\n right: string,\n pathApi: PathApi = path,\n): Promise<boolean> {\n return (await fileSystemPathRelationship(left, right, pathApi)) === 'equivalent';\n}\n\nexport async function pathsOverlapOnFileSystem(left: string, right: string, pathApi: PathApi = path): Promise<boolean> {\n return (await fileSystemPathRelationship(left, right, pathApi)) !== 'distinct';\n}\n\nfunction normalizedPathsEquivalent(pathApi: PathApi, left: string, right: string): boolean {\n return pathApi.relative(left, right) === '';\n}\n\nfunction isAncestor(pathApi: PathApi, ancestor: string, descendant: string): boolean {\n const relative = pathApi.relative(ancestor, descendant);\n return (\n relative !== '' && relative !== '..' && !relative.startsWith(`..${pathApi.sep}`) && !pathApi.isAbsolute(relative)\n );\n}\n\nasync function fileSystemPathRelationship(\n left: string,\n right: string,\n pathApi: PathApi,\n observe: PathObserver = candidate => observePath(candidate, pathApi),\n): Promise<PathRelationship> {\n const normalizedLeft = pathApi.resolve(left);\n const normalizedRight = pathApi.resolve(right);\n if (normalizedPathsEquivalent(pathApi, normalizedLeft, normalizedRight)) return 'equivalent';\n if (isAncestor(pathApi, normalizedLeft, normalizedRight)) return 'ancestor';\n if (isAncestor(pathApi, normalizedRight, normalizedLeft)) return 'descendant';\n\n const [observedLeft, observedRight] = await Promise.all([observe(normalizedLeft), observe(normalizedRight)]);\n if (observedLeft.exactIdentity && observedRight.exactIdentity) {\n if (sameIdentity(observedLeft.exactIdentity, observedRight.exactIdentity)) return 'equivalent';\n if (hasIdentityBelow(observedRight, observedLeft.exactIdentity)) return 'ancestor';\n if (hasIdentityBelow(observedLeft, observedRight.exactIdentity)) return 'descendant';\n return 'distinct';\n }\n\n return relationshipThroughExistingPrefixes(observedLeft, observedRight);\n}\n\nasync function observePath(candidate: string, pathApi: PathApi): Promise<ObservedPath> {\n const prefixes: ExistingPathPrefix[] = [];\n const suffix: string[] = [];\n let current = candidate;\n let exactIdentity: FileSystemIdentity | undefined;\n\n while (true) {\n try {\n const currentStat = await stat(current, { bigint: true });\n const currentIdentity = identity(currentStat);\n if (suffix.length === 0) exactIdentity = currentIdentity;\n prefixes.push({ identity: currentIdentity, suffix: [...suffix] });\n } catch (error: unknown) {\n if (!isMissingPath(error)) throw error;\n }\n\n const parent = pathApi.dirname(current);\n if (parent === current) break;\n suffix.unshift(pathApi.basename(current));\n current = parent;\n }\n\n return { ...(exactIdentity ? { exactIdentity } : {}), prefixes };\n}\n\nfunction relationshipThroughExistingPrefixes(left: ObservedPath, right: ObservedPath): PathRelationship {\n for (const leftPrefix of left.prefixes) {\n for (const rightPrefix of right.prefixes) {\n if (!sameIdentity(leftPrefix.identity, rightPrefix.identity)) continue;\n const relationship = suffixRelationship(leftPrefix.suffix, rightPrefix.suffix);\n if (relationship !== 'distinct') return relationship;\n }\n }\n return 'distinct';\n}\n\nfunction hasIdentityBelow(observed: ObservedPath, candidate: FileSystemIdentity): boolean {\n return observed.prefixes.some(prefix => prefix.suffix.length > 0 && sameIdentity(prefix.identity, candidate));\n}\n\nfunction suffixRelationship(left: readonly string[], right: readonly string[]): PathRelationship {\n const normalizedLeft = left.map(portablePathSegment);\n const normalizedRight = right.map(portablePathSegment);\n const sharedLength = Math.min(normalizedLeft.length, normalizedRight.length);\n for (let index = 0; index < sharedLength; index++) {\n if (normalizedLeft[index] !== normalizedRight[index]) return 'distinct';\n }\n if (normalizedLeft.length === normalizedRight.length) return 'equivalent';\n return normalizedLeft.length < normalizedRight.length ? 'ancestor' : 'descendant';\n}\n\nfunction portablePathSegment(value: string): string {\n return value.normalize('NFC').toLowerCase();\n}\n\nfunction identity(value: { readonly dev: number | bigint; readonly ino: number | bigint }): FileSystemIdentity {\n return { device: String(value.dev), inode: String(value.ino) };\n}\n\nfunction sameIdentity(left: FileSystemIdentity, right: FileSystemIdentity): boolean {\n return left.device === right.device && left.inode === right.inode;\n}\n\nasync function validateDestination(destination: string): Promise<void> {\n let stat: Awaited<ReturnType<typeof lstat>>;\n try {\n stat = await lstat(destination);\n } catch (error: unknown) {\n if (isEnoent(error)) return;\n throw error;\n }\n\n if (stat.isSymbolicLink()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination must not be a symbolic link: ${destination}`,\n [destination],\n );\n }\n if (!stat.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination must be a regular file: ${destination}`,\n [destination],\n );\n }\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n\nfunction isMissingPath(error: unknown): error is NodeJS.ErrnoException {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n (error.code === 'ENOENT' || error.code === 'ENOTDIR')\n );\n}\n","import { lstat, readFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport { CssStylesheetError } from '../adapter/css/stylesheet/css-stylesheet.error';\nimport type { OwnedCssReferences } from '../adapter/css/stylesheet/owned-stylesheet.merger';\nimport { MigrationApplicationError } from './migration-application.error';\nimport { plannedOutputArtifact, type ArtifactState, type PlannedOutputArtifact } from './migration-plan';\nimport { mergeStylesheetContents } from './stylesheet-contents';\n\ninterface StylesheetPlannerFileSystem {\n readonly readFile: (path: string) => Promise<string>;\n readonly lstat: (path: string) => ReturnType<typeof lstat>;\n}\n\nconst nodeFileSystem: StylesheetPlannerFileSystem = {\n readFile: target => readFile(target, 'utf8'),\n lstat,\n};\n\nexport class StylesheetPlanner {\n constructor(private readonly fileSystem: StylesheetPlannerFileSystem = nodeFileSystem) {}\n\n async plan(\n stylesheetPath: string,\n rules: readonly OwnedCssRule[],\n references: ReadonlySet<string> | OwnedCssReferences = new Set(rules.map(rule => rule.className)),\n ): Promise<PlannedOutputArtifact | undefined> {\n const outputPath = path.resolve(stylesheetPath);\n const original = await this.originalState(outputPath);\n const existing = original.status === 'present' ? original.contents : '';\n\n let merged: ReturnType<typeof mergeStylesheetContents>;\n try {\n merged = mergeStylesheetContents(existing, rules, references);\n } catch (error: unknown) {\n if (error instanceof CssStylesheetError) {\n throw new MigrationApplicationError(\n 'stylesheet-ownership-invalid',\n `Cannot safely update stylesheet ownership: ${outputPath}`,\n [outputPath],\n { cause: error },\n );\n }\n throw error;\n }\n\n const proposed = proposedState(original, merged.changed, merged.output);\n if (sameState(original, proposed)) return undefined;\n\n return plannedOutputArtifact({ kind: 'stylesheet', path: outputPath, original, proposed });\n }\n\n private async originalState(outputPath: string): Promise<ArtifactState> {\n let stat: Awaited<ReturnType<typeof lstat>>;\n try {\n stat = await this.fileSystem.lstat(outputPath);\n } catch (error: unknown) {\n if (isEnoent(error)) return { status: 'absent' };\n throw error;\n }\n\n if (stat.isSymbolicLink()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must not be a symbolic link: ${outputPath}`,\n [outputPath],\n );\n }\n if (!stat.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must be a regular file: ${outputPath}`,\n [outputPath],\n );\n }\n\n return { status: 'present', contents: await this.fileSystem.readFile(outputPath) };\n }\n}\n\nfunction proposedState(original: ArtifactState, changed: boolean, output: string): ArtifactState {\n if (output === '' && (original.status === 'absent' || changed)) return { status: 'absent' };\n return { status: 'present', contents: output };\n}\n\nfunction sameState(left: ArtifactState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n","export type CssStylesheetErrorCode =\n | 'invalid-artifact'\n | 'invalid-css-lexeme'\n | 'unterminated-css-token'\n | 'unknown-ownership-marker'\n | 'unsupported-ownership-schema'\n | 'malformed-ownership-block'\n | 'ownership-rule-mismatch';\n\nexport class CssStylesheetError extends Error {\n constructor(\n readonly code: CssStylesheetErrorCode,\n message: string,\n ) {\n super(message);\n this.name = 'CssStylesheetError';\n }\n}\n","import { CssStylesheetError } from './css-stylesheet.error';\n\nexport interface CssSourceRange {\n readonly start: number;\n readonly end: number;\n}\n\nexport interface CssCommentToken extends CssSourceRange {\n readonly content: string;\n}\n\ntype ScannerState = 'normal' | 'single-quote' | 'double-quote' | 'comment';\n\nfunction cssNewlineEnd(source: string, start: number): number | undefined {\n const codeUnit = source[start];\n if (codeUnit === '\\r') return source[start + 1] === '\\n' ? start + 1 : start;\n return codeUnit === '\\n' || codeUnit === '\\f' ? start : undefined;\n}\n\nfunction isHexDigit(codeUnit: string | undefined): boolean {\n return codeUnit !== undefined && /^[0-9a-f]$/iu.test(codeUnit);\n}\n\nfunction consumeCssEscape(source: string, backslash: number): number | undefined {\n let index = backslash + 1;\n if (cssNewlineEnd(source, index) !== undefined) return undefined;\n if (!isHexDigit(source[index])) return index < source.length ? index : backslash;\n\n let hexDigits = 0;\n while (hexDigits < 6 && isHexDigit(source[index])) {\n index += 1;\n hexDigits += 1;\n }\n\n const newlineEnd = cssNewlineEnd(source, index);\n if (newlineEnd !== undefined) return newlineEnd;\n if (source[index] === ' ' || source[index] === '\\t') return index;\n return index - 1;\n}\n\nexport function scanCssComments(source: string): readonly CssCommentToken[] {\n const comments: CssCommentToken[] = [];\n let state: ScannerState = 'normal';\n let commentStart = -1;\n\n for (let index = 0; index < source.length; index += 1) {\n const codeUnit = source[index];\n\n if (state === 'normal') {\n if (codeUnit === '\\\\') {\n index = consumeCssEscape(source, index) ?? index;\n } else if (codeUnit === \"'\") {\n state = 'single-quote';\n } else if (codeUnit === '\"') {\n state = 'double-quote';\n } else if (codeUnit === '/' && source[index + 1] === '*') {\n state = 'comment';\n commentStart = index;\n index += 1;\n }\n continue;\n }\n\n if (state === 'comment') {\n if (codeUnit === '*' && source[index + 1] === '/') {\n comments.push({\n start: commentStart,\n end: index + 2,\n content: source.slice(commentStart + 2, index),\n });\n state = 'normal';\n index += 1;\n }\n continue;\n }\n\n if (codeUnit === '\\\\') {\n const newlineEnd = cssNewlineEnd(source, index + 1);\n index = newlineEnd ?? consumeCssEscape(source, index) ?? index;\n continue;\n }\n\n if ((state === 'single-quote' && codeUnit === \"'\") || (state === 'double-quote' && codeUnit === '\"')) {\n state = 'normal';\n }\n }\n\n if (state === 'comment') {\n throw new CssStylesheetError('unterminated-css-token', 'Unterminated CSS comment');\n }\n if (state === 'single-quote') {\n throw new CssStylesheetError('unterminated-css-token', 'Unterminated CSS single-quoted string');\n }\n if (state === 'double-quote') {\n throw new CssStylesheetError('unterminated-css-token', 'Unterminated CSS double-quoted string');\n }\n\n return comments;\n}\n","import type { CssStylesheetErrorCode } from './css-stylesheet.error';\nimport { scanCssComments, type CssCommentToken, type CssSourceRange } from './css-comment.scanner';\nimport type { CssNewline } from './owned-css-block.serializer';\n\nconst MARKER_PREFIX = 'flex-layout-codemod:';\nconst START_MARKER_PATTERN = /^flex-layout-codemod:start schema=([0-9]+)$/;\nconst RULE_MARKER_PATTERN = /^flex-layout-codemod:rule id=([a-f0-9]{64})$/;\nconst END_MARKER_PATTERN = /^flex-layout-codemod:end$/;\n\ninterface OwnedRuleMarker {\n readonly token: CssCommentToken;\n readonly id: string;\n}\n\nexport type OwnedCssBlockParseResult =\n | { readonly status: 'absent' }\n | { readonly status: 'found'; readonly range: CssSourceRange; readonly newline: CssNewline }\n | { readonly status: 'invalid'; readonly code: CssStylesheetErrorCode; readonly reason: string };\n\nfunction invalid(code: CssStylesheetErrorCode, reason: string): OwnedCssBlockParseResult {\n return { status: 'invalid', code, reason };\n}\n\nfunction firstNewline(source: string): CssNewline {\n const match = /\\r\\n|\\n/.exec(source);\n return match?.[0] === '\\r\\n' ? '\\r\\n' : '\\n';\n}\n\nfunction isCssWhitespace(codeUnit: string | undefined): boolean {\n return codeUnit === ' ' || codeUnit === '\\t' || codeUnit === '\\n' || codeUnit === '\\r' || codeUnit === '\\f';\n}\n\nfunction ruleSelectorMatches(source: string, marker: OwnedRuleMarker): boolean {\n let selectorStart = marker.token.end;\n while (isCssWhitespace(source[selectorStart])) selectorStart += 1;\n\n const selector = `.flm-${marker.id}`;\n if (!source.startsWith(selector, selectorStart)) return false;\n\n const boundary = source[selectorStart + selector.length];\n return boundary === '{' || isCssWhitespace(boundary);\n}\n\nexport function parseOwnedCssBlock(source: string): OwnedCssBlockParseResult {\n let start: CssCommentToken | undefined;\n let end: CssCommentToken | undefined;\n let regionOpen = false;\n const rules: OwnedRuleMarker[] = [];\n\n for (const token of scanCssComments(source)) {\n const marker = token.content.trim();\n if (!marker.startsWith(MARKER_PREFIX)) continue;\n\n const startMatch = START_MARKER_PATTERN.exec(marker);\n if (startMatch !== null) {\n const schema = startMatch[1];\n if (schema !== '1') {\n return invalid('unsupported-ownership-schema', `Unsupported flex-layout-codemod ownership schema: ${schema}`);\n }\n if (regionOpen) {\n return invalid('malformed-ownership-block', 'Nested flex-layout-codemod start marker');\n }\n if (start !== undefined) {\n return invalid('malformed-ownership-block', 'Duplicate flex-layout-codemod start marker');\n }\n if (end !== undefined) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod end marker appears before start marker');\n }\n\n start = token;\n regionOpen = true;\n continue;\n }\n\n const ruleMatch = RULE_MARKER_PATTERN.exec(marker);\n if (ruleMatch !== null) {\n if (!regionOpen) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod rule marker appears outside owned block');\n }\n\n rules.push({ token, id: ruleMatch[1] ?? '' });\n continue;\n }\n\n if (END_MARKER_PATTERN.test(marker)) {\n if (end !== undefined) {\n return invalid('malformed-ownership-block', 'Duplicate flex-layout-codemod end marker');\n }\n\n end = token;\n regionOpen = false;\n continue;\n }\n\n if (marker === `${MARKER_PREFIX}rule` || marker.startsWith(`${MARKER_PREFIX}rule `)) {\n return invalid('malformed-ownership-block', 'Malformed flex-layout-codemod rule marker');\n }\n\n return invalid('unknown-ownership-marker', 'Unknown flex-layout-codemod ownership marker');\n }\n\n if (start === undefined && end === undefined) return { status: 'absent' };\n if (start === undefined) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod end marker has no matching start marker');\n }\n if (end === undefined) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod start marker has no matching end marker');\n }\n\n for (const rule of rules) {\n if (!ruleSelectorMatches(source, rule)) {\n return invalid('ownership-rule-mismatch', 'Flex-layout-codemod rule ID does not match following selector');\n }\n }\n\n const internalSource = source.slice(start.end, end.start);\n return {\n status: 'found',\n range: { start: start.start, end: end.end },\n newline: /\\r\\n|\\n/.test(internalSource) ? firstNewline(internalSource) : firstNewline(source),\n };\n}\n","import type { CssSemanticFamily, OwnedCssRule } from '../css-artifact.model';\nimport { CssStylesheetError } from './css-stylesheet.error';\n\nconst ID = /^(?:[a-f0-9]{64})$(?![\\s\\S])/;\nconst PROPERTY = /^(?:-?[a-z][a-z0-9-]*)$(?![\\s\\S])/;\nconst FORBIDDEN_VALUE = /[\\0\\r\\n{};]|\\/\\*|\\*\\//;\nconst FAMILIES = new Set<CssSemanticFamily>([\n 'layout',\n 'layout-align',\n 'layout-gap',\n 'flex-item',\n 'flex-align',\n 'flex-fill',\n 'flex-offset',\n 'flex-order',\n]);\n\ntype ArtifactRecord = Record<string, unknown>;\n\nfunction isArtifactRecord(value: unknown): value is ArtifactRecord {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction invalidArtifact(message: string): never {\n throw new CssStylesheetError('invalid-artifact', message);\n}\n\nfunction invalidLexeme(message: string): never {\n throw new CssStylesheetError('invalid-css-lexeme', message);\n}\n\nfunction validateDeclarations(value: unknown): void {\n if (!Array.isArray(value) || value.length === 0) {\n invalidArtifact('CSS declarations must be a nonempty array');\n }\n\n const properties = new Set<string>();\n for (const declaration of value) {\n if (!isArtifactRecord(declaration)) {\n invalidArtifact('CSS declaration must be an object');\n }\n\n const { property, value: declarationValue } = declaration;\n if (typeof property !== 'string' || !PROPERTY.test(property)) {\n invalidLexeme('CSS declaration property is unsafe');\n }\n if (properties.has(property)) {\n invalidArtifact('CSS declaration properties must be unique');\n }\n properties.add(property);\n\n if (\n typeof declarationValue !== 'string' ||\n declarationValue.length === 0 ||\n declarationValue.trim() !== declarationValue ||\n FORBIDDEN_VALUE.test(declarationValue)\n ) {\n invalidLexeme('CSS declaration value is unsafe');\n }\n }\n}\n\nfunction validateMedia(value: unknown): void {\n if (!isArtifactRecord(value)) {\n invalidArtifact('CSS media must be an object');\n }\n\n const { type, clauses } = value;\n if (type !== 'screen' && type !== 'print') {\n invalidArtifact('CSS media type is invalid');\n }\n if (!Array.isArray(clauses) || clauses.length === 0) {\n invalidArtifact('CSS media must contain at least one clause');\n }\n\n for (const clause of clauses) {\n if (!isArtifactRecord(clause)) {\n invalidArtifact('CSS media clause must be an object');\n }\n\n const { min, max, orientation } = clause;\n if (\n (min !== undefined && (typeof min !== 'number' || !Number.isFinite(min))) ||\n (max !== undefined && (typeof max !== 'number' || !Number.isFinite(max)))\n ) {\n invalidArtifact('CSS media bounds must be finite numbers');\n }\n if (min !== undefined && max !== undefined && min > max) {\n invalidArtifact('CSS media minimum must not exceed maximum');\n }\n if (orientation !== undefined && orientation !== 'portrait' && orientation !== 'landscape') {\n invalidArtifact('CSS media orientation is invalid');\n }\n if (type === 'screen' && min === undefined && max === undefined && orientation === undefined) {\n invalidArtifact('CSS screen media clause must contain a feature');\n }\n }\n}\n\nfunction validateContext(value: unknown): void {\n if (!isArtifactRecord(value)) {\n invalidArtifact('CSS rule context must be an object');\n }\n\n const { priority, media } = value;\n if (typeof priority !== 'number' || !Number.isFinite(priority)) {\n invalidArtifact('CSS rule priority must be a finite number');\n }\n if (media === undefined) {\n if (priority !== 0) {\n invalidArtifact('CSS base rule priority must be zero');\n }\n return;\n }\n\n validateMedia(media);\n}\n\nexport function validateOwnedCssRule(rule: OwnedCssRule): void {\n if (!isArtifactRecord(rule)) {\n invalidArtifact('CSS rule must be an object');\n }\n\n const { owner, id, className, family, declarations, context } = rule;\n if (owner !== 'flex-layout-codemod') {\n invalidArtifact('CSS rule owner is invalid');\n }\n if (typeof id !== 'string' || !ID.test(id)) {\n invalidArtifact('CSS rule ID is invalid');\n }\n if (className !== `flm-${id}`) {\n invalidArtifact('CSS rule class name is invalid');\n }\n if (typeof family !== 'string' || !FAMILIES.has(family as CssSemanticFamily)) {\n invalidArtifact('CSS rule family is invalid');\n }\n\n validateDeclarations(declarations);\n validateContext(context);\n}\n","import type { MediaDefinition, MediaRange } from '../../../breakpoint/breakpoint-catalog';\n\nfunction serializeClause(type: MediaDefinition['type'], clause: MediaRange): string {\n const features: string[] = [];\n if (clause.min !== undefined) features.push(`(min-width: ${String(clause.min)}px)`);\n if (clause.max !== undefined) features.push(`(max-width: ${String(clause.max)}px)`);\n if (clause.orientation !== undefined) features.push(`(orientation: ${clause.orientation})`);\n\n return [type, ...features].join(' and ');\n}\n\nexport function serializeCssMedia(media: MediaDefinition): string {\n return media.clauses.map(clause => serializeClause(media.type, clause)).join(', ');\n}\n","import type { OwnedCssRule } from '../css-artifact.model';\nimport type { MediaDefinition } from '../../../breakpoint/breakpoint-catalog';\nimport { validateOwnedCssRule } from './css-artifact.validator';\nimport { CssStylesheetError } from './css-stylesheet.error';\nimport { serializeCssMedia } from './css-media.serializer';\n\nexport type CssNewline = '\\n' | '\\r\\n';\n\ninterface BaseRuleGroup {\n readonly kind: 'base';\n readonly rule: OwnedCssRule;\n}\n\ninterface ResponsiveGroup {\n readonly kind: 'responsive';\n readonly key: string;\n readonly media: MediaDefinition;\n readonly rules: readonly OwnedCssRule[];\n}\n\ntype RuleGroup = BaseRuleGroup | ResponsiveGroup;\n\nfunction validateNewline(newline: CssNewline): void {\n if (newline !== '\\n' && newline !== '\\r\\n') {\n throw new CssStylesheetError('invalid-artifact', 'CSS newline must be LF or CRLF');\n }\n}\n\nfunction mediaGroupKey(rule: OwnedCssRule): string {\n const media = rule.context.media;\n if (media === undefined) throw new CssStylesheetError('invalid-artifact', 'CSS responsive rule media is required');\n\n return JSON.stringify([\n media.type,\n media.clauses.map(clause => [clause.min ?? null, clause.max ?? null, clause.orientation ?? null]),\n rule.context.priority,\n ]);\n}\n\nfunction serializeBaseRule(rule: OwnedCssRule, newline: CssNewline): string {\n return [\n `/* flex-layout-codemod:rule id=${rule.id} */`,\n `.${rule.className} {`,\n ...rule.declarations.map(({ property, value }) => ` ${property}: ${value};`),\n '}',\n ].join(newline);\n}\n\nfunction serializeResponsiveGroup(group: ResponsiveGroup, newline: CssNewline): string {\n const rules = group.rules\n .map(rule =>\n serializeBaseRule(rule, newline)\n .split(newline)\n .map(line => ` ${line}`)\n .join(newline),\n )\n .join(newline);\n\n return [`@media ${serializeCssMedia(group.media)} {`, rules, '}'].join(newline);\n}\n\nexport function serializeCssRules(rules: readonly OwnedCssRule[], newline: CssNewline): string {\n validateNewline(newline);\n rules.forEach(validateOwnedCssRule);\n\n const groups: RuleGroup[] = [];\n for (const rule of rules) {\n if (rule.context.media === undefined) {\n groups.push({ kind: 'base', rule });\n continue;\n }\n\n const key = mediaGroupKey(rule);\n const previous = groups.at(-1);\n if (previous?.kind === 'responsive' && previous.key === key) {\n groups[groups.length - 1] = { ...previous, rules: [...previous.rules, rule] };\n continue;\n }\n\n groups.push({ kind: 'responsive', key, media: rule.context.media, rules: [rule] });\n }\n\n return groups\n .map(group =>\n group.kind === 'responsive' ? serializeResponsiveGroup(group, newline) : serializeBaseRule(group.rule, newline),\n )\n .join(newline);\n}\n","import type { OwnedCssRule } from '../css-artifact.model';\nimport { serializeCssRules, type CssNewline } from './css-rule.serializer';\n\nconst START_MARKER = '/* flex-layout-codemod:start schema=1 */';\nconst END_MARKER = '/* flex-layout-codemod:end */';\n\nexport { type CssNewline } from './css-rule.serializer';\n\nexport function serializeOwnedCssBlock(rules: readonly OwnedCssRule[], newline: CssNewline): string {\n const serializedRules = serializeCssRules(rules, newline);\n if (serializedRules === '') return '';\n\n return [START_MARKER, serializedRules, END_MARKER].join(newline);\n}\n","import type { CssRuleContext, OwnedCssRule } from '../css-artifact.model';\nimport { CssStylesheetError } from './css-stylesheet.error';\nimport { parseOwnedCssBlock } from './owned-css-block.parser';\nimport { serializeOwnedCssBlock, type CssNewline } from './owned-css-block.serializer';\nimport { serializeCssRules } from './css-rule.serializer';\nimport { serializeCssMedia } from './css-media.serializer';\n\nexport interface OwnedStylesheetMergeResult {\n readonly changed: boolean;\n readonly output: string;\n}\n\n/**\n * Template reference authority collected at the invocation boundary.\n * `complete: false` means a dynamic class expression prevented a complete scan.\n * The default merger retains unmatched rules regardless; completeness is not a pruning grant.\n */\nexport interface OwnedCssReferences {\n readonly classNames: ReadonlySet<string>;\n readonly complete: boolean;\n}\n\n/** Resolves a serialized media query from an existing owned block. */\nexport type RetainedMediaContextResolver = (serializedMedia: string) => CssRuleContext | undefined;\n\ninterface ParsedOwnedRule {\n readonly id: string;\n readonly source: string;\n}\n\ninterface ResolvedOwnedRule extends ParsedOwnedRule {\n readonly context: CssRuleContext;\n}\n\ninterface ParsedOwnedRuleGroup {\n readonly serializedMedia?: string;\n readonly rules: readonly ParsedOwnedRule[];\n}\n\nconst START_MARKER = '/* flex-layout-codemod:start schema=1 */';\nconst END_MARKER = '/* flex-layout-codemod:end */';\nconst RULE_MARKER = /^\\/\\* flex-layout-codemod:rule id=([a-f0-9]{64}) \\*\\/$/u;\n\nfunction malformed(message: string): never {\n throw new CssStylesheetError('malformed-ownership-block', message);\n}\n\nfunction parseRule(\n lines: readonly string[],\n index: number,\n indentation: string,\n newline: CssNewline,\n): {\n readonly rule: ParsedOwnedRule;\n readonly nextIndex: number;\n} {\n const marker = lines[index];\n const match = marker?.slice(indentation.length).match(RULE_MARKER);\n if (marker === undefined || !match || !marker.startsWith(indentation)) {\n malformed('Owned CSS rule does not use the schema-1 serialized form');\n }\n const id = match[1];\n if (id === undefined || lines[index + 1] !== `${indentation}.flm-${id} {`) {\n malformed('Owned CSS rule ID does not match its serialized selector');\n }\n\n let end = index + 2;\n while (lines[end] !== `${indentation}}`) {\n if (lines[end] === undefined) malformed('Owned CSS rule is missing its closing brace');\n end += 1;\n }\n\n return {\n rule: { id, source: lines.slice(index, end + 1).join(newline) },\n nextIndex: end + 1,\n };\n}\n\nfunction parseOwnedRuleGroups(source: string): readonly ParsedOwnedRuleGroup[] {\n const parsed = parseOwnedCssBlock(source);\n if (parsed.status === 'invalid') throw new CssStylesheetError(parsed.code, parsed.reason);\n if (parsed.status === 'absent') return [];\n\n const block = source.slice(parsed.range.start, parsed.range.end);\n const internal = block.slice(START_MARKER.length, -END_MARKER.length);\n const lines = internal.split(parsed.newline);\n if (lines[0] === '') lines.shift();\n if (lines.at(-1) === '') lines.pop();\n\n const groups: ParsedOwnedRuleGroup[] = [];\n for (let index = 0; index < lines.length;) {\n const line = lines[index];\n if (line === undefined) malformed('Owned CSS block ended unexpectedly');\n if (line.startsWith('@media ') && line.endsWith(' {')) {\n const start = line;\n index += 1;\n const rules: ParsedOwnedRule[] = [];\n while (lines[index] !== '}') {\n const parsedRule = parseRule(lines, index, ' ', parsed.newline);\n rules.push(parsedRule.rule);\n index = parsedRule.nextIndex;\n }\n if (rules.length === 0) malformed('Owned CSS media group contains no rules');\n groups.push({ serializedMedia: start.slice('@media '.length, -' {'.length), rules });\n index += 1;\n continue;\n }\n\n const parsedRule = parseRule(lines, index, '', parsed.newline);\n groups.push({ rules: [parsedRule.rule] });\n index = parsedRule.nextIndex;\n }\n\n return groups;\n}\n\nfunction retainedRules(\n groups: readonly ParsedOwnedRuleGroup[],\n retainedIds: ReadonlySet<string>,\n resolveRetainedMediaContext: RetainedMediaContextResolver,\n): readonly ResolvedOwnedRule[] {\n const retained: ResolvedOwnedRule[] = [];\n for (const group of groups) {\n const rules = group.rules.filter(rule => retainedIds.has(rule.id));\n if (rules.length === 0) continue;\n const context =\n group.serializedMedia === undefined ? { priority: 0 } : resolveRetainedMediaContext(group.serializedMedia);\n if (context === undefined)\n malformed(`Owned CSS media query is not a registered breakpoint: ${group.serializedMedia}`);\n retained.push(...rules.map(rule => ({ ...rule, context })));\n }\n return retained;\n}\n\nfunction firstDocumentNewline(source: string): CssNewline {\n return /\\r\\n|\\n/.exec(source)?.[0] === '\\r\\n' ? '\\r\\n' : '\\n';\n}\n\nfunction compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction compareRuleFragments(left: ResolvedOwnedRule, right: ResolvedOwnedRule): number {\n const mediaOrder = Number(left.context.media !== undefined) - Number(right.context.media !== undefined);\n if (mediaOrder !== 0) return mediaOrder;\n const priorityOrder = right.context.priority - left.context.priority;\n return priorityOrder === 0 ? compareCodeUnits(left.id, right.id) : priorityOrder;\n}\n\nfunction mediaKey(context: CssRuleContext): string | undefined {\n return context.media === undefined\n ? undefined\n : JSON.stringify([context.media.type, context.media.clauses, context.priority]);\n}\n\nfunction parsedIncomingRules(rules: readonly OwnedCssRule[], newline: CssNewline): readonly ResolvedOwnedRule[] {\n return rules.map(rule => {\n const serialized = serializeCssRules([rule], newline);\n if (rule.context.media === undefined) return { id: rule.id, source: serialized, context: rule.context };\n\n const lines = serialized.split(newline);\n const source = lines\n .slice(1, -1)\n .map(line => {\n if (!line.startsWith(' ')) malformed('Incoming CSS rule does not use the serialized form');\n return line;\n })\n .join(newline);\n return { id: rule.id, source, context: rule.context };\n });\n}\n\nfunction renderCanonicalRules(rules: readonly ResolvedOwnedRule[], newline: CssNewline): string {\n const groups: string[] = [];\n for (let index = 0; index < rules.length;) {\n const rule = rules[index];\n if (rule === undefined) break;\n if (rule.context.media === undefined) {\n groups.push(rule.source);\n index += 1;\n continue;\n }\n const key = mediaKey(rule.context);\n const grouped: ResolvedOwnedRule[] = [];\n let candidate = rules[index];\n while (candidate !== undefined && mediaKey(candidate.context) === key) {\n grouped.push(candidate);\n index += 1;\n candidate = rules[index];\n }\n groups.push(\n [`@media ${serializeCssMedia(rule.context.media)} {`, grouped.map(item => item.source).join(newline), '}'].join(\n newline,\n ),\n );\n }\n return groups.join(newline);\n}\n\nfunction normalizeReferences(references?: ReadonlySet<string> | OwnedCssReferences): OwnedCssReferences {\n if (references === undefined) return { classNames: new Set(), complete: false };\n return 'classNames' in references ? references : { classNames: references, complete: true };\n}\n\nexport function mergeOwnedStylesheet(\n existing: string,\n rules: readonly OwnedCssRule[],\n references?: ReadonlySet<string> | OwnedCssReferences,\n resolveRetainedMediaContext: RetainedMediaContextResolver = () => undefined,\n): OwnedStylesheetMergeResult {\n const parsed = parseOwnedCssBlock(existing);\n if (parsed.status === 'invalid') throw new CssStylesheetError(parsed.code, parsed.reason);\n\n const newline = parsed.status === 'found' ? parsed.newline : firstDocumentNewline(existing);\n const referenceState = normalizeReferences(references);\n const groups = parseOwnedRuleGroups(existing);\n const existingIds = new Set(groups.flatMap(group => group.rules.map(rule => rule.id)));\n const incomingIds = new Set(rules.map(rule => rule.id));\n for (const className of referenceState.classNames) {\n const id = className.slice('flm-'.length);\n if (!existingIds.has(id) && !incomingIds.has(id)) {\n throw new CssStylesheetError('ownership-rule-mismatch', `No owned CSS rule matches ${className}`);\n }\n }\n const retainedIds = new Set([...existingIds].filter(id => !incomingIds.has(id)));\n const retained = retainedRules(groups, retainedIds, resolveRetainedMediaContext);\n const incoming = parsedIncomingRules(rules, newline);\n const content = [...retained, ...incoming].sort(compareRuleFragments);\n if (rules.length === 0 && retained.length === groups.flatMap(group => group.rules).length) {\n return Object.freeze({ changed: false, output: existing });\n }\n const serialized = renderCanonicalRules(content, newline);\n const block =\n serialized === ''\n ? ''\n : retained.length === 0\n ? serializeOwnedCssBlock(rules, newline)\n : [START_MARKER, serialized, END_MARKER].join(newline);\n const output =\n parsed.status === 'found'\n ? existing.slice(0, parsed.range.start) + block + existing.slice(parsed.range.end)\n : existing + block;\n\n return Object.freeze({ changed: output !== existing, output });\n}\n","import { allBreakpointDefinitions } from '../breakpoint/breakpoint-catalog';\nimport { cssRuleContext } from '../adapter/css/css-breakpoint.context';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport {\n mergeOwnedStylesheet,\n type OwnedCssReferences,\n type OwnedStylesheetMergeResult,\n type RetainedMediaContextResolver,\n} from '../adapter/css/stylesheet/owned-stylesheet.merger';\nimport { serializeCssMedia } from '../adapter/css/stylesheet/css-media.serializer';\n\nconst retainedMediaContexts = new Map(\n allBreakpointDefinitions().map(definition => [serializeCssMedia(definition.media), cssRuleContext(definition)]),\n);\n\nconst resolveRetainedMediaContext: RetainedMediaContextResolver = media => retainedMediaContexts.get(media);\n\nexport function mergeStylesheetContents(\n existing: string,\n rules: readonly OwnedCssRule[],\n references: ReadonlySet<string> | OwnedCssReferences = new Set(rules.map(rule => rule.className)),\n): OwnedStylesheetMergeResult {\n return mergeOwnedStylesheet(existing, rules, references, resolveRetainedMediaContext);\n}\n","import * as path from 'node:path';\nimport { fileMigrationResult, type FileMigrationResult } from '../migrator/file-migration-result';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport { migrationPlan, type MigrationPlan, type PlannedOutputArtifact } from '../migrator/migration-plan';\nimport type { StylesheetMigrationResult } from '../report/migration-report.builder';\nimport { renderedProject, type RenderedProject, type RenderedTemplateFile } from './rendered-project';\n\nexport interface ValidatedProjectPlan {\n readonly rendered: RenderedProject;\n readonly plan: MigrationPlan;\n readonly stylesheet?: StylesheetMigrationResult;\n}\n\nexport function validatedProjectPlan(project: ValidatedProjectPlan): ValidatedProjectPlan {\n const rendered = renderedProject(project.rendered);\n if (rendered.target !== rendered.session.target) {\n throw internalInvariant(\n `Render session finalized for target \"${rendered.session.target}\" but its renderer targets \"${rendered.target}\".`,\n );\n }\n\n const suppliedPlan = migrationPlan(project.plan);\n if (suppliedPlan.target !== rendered.session.target) {\n throw internalInvariant('Validated migration plan target differs from its finalized adapter session target.');\n }\n\n const plan = canonicalPlan(rendered, suppliedPlan);\n const templateArtifacts = validatedTemplateArtifacts(plan.files, plan.artifacts);\n const stylesheet = validatedStylesheet(rendered, plan, templateArtifacts, project.stylesheet);\n\n return Object.freeze({\n rendered,\n plan,\n ...(stylesheet === undefined ? {} : { stylesheet }),\n });\n}\n\nfunction canonicalPlan(rendered: RenderedProject, supplied: MigrationPlan): MigrationPlan {\n if (supplied.files.length !== rendered.files.length) throw fileCongruenceInvariant();\n const files = supplied.files.map((file, index) => {\n const expected = rendered.files[index];\n if (expected === undefined || !samePathPair(expected, file)) throw fileCongruenceInvariant();\n const canonical = fileMigrationResult({\n ...file,\n inputPath: expected.inputPath,\n outputPath: expected.outputPath,\n });\n if (!validResults(expected, canonical)) throw fileCongruenceInvariant();\n return canonical;\n });\n if (new Set(files.map(file => normalizedAbsolutePath(file.outputPath))).size !== files.length) {\n throw fileCongruenceInvariant();\n }\n\n return migrationPlan({ target: supplied.target, files, artifacts: supplied.artifacts });\n}\n\nfunction validResults(rendered: RenderedTemplateFile, planned: FileMigrationResult): boolean {\n if (sameOwnedValue(planned.results, rendered.results)) return true;\n return (\n rendered.edits.length > 0 &&\n planned.changed === false &&\n planned.results.length > 0 &&\n planned.results.every(\n result =>\n result.status === 'parse-error' &&\n result.code === 'generated-template-parse-error' &&\n normalizedAbsolutePath(result.fileName) === normalizedAbsolutePath(rendered.outputPath),\n )\n );\n}\n\nfunction validatedTemplateArtifacts(\n files: readonly FileMigrationResult[],\n artifacts: readonly PlannedOutputArtifact[],\n): readonly PlannedOutputArtifact[] {\n const templateArtifacts = artifacts.filter(artifact => artifact.kind === 'template');\n const changedFiles = files.filter(file => file.changed);\n if (\n templateArtifacts.length !== changedFiles.length ||\n templateArtifacts.some(\n (artifact, index) =>\n artifact.proposed.status !== 'present' ||\n normalizedAbsolutePath(artifact.path) !== normalizedAbsolutePath(changedFiles[index]?.outputPath ?? ''),\n )\n ) {\n throw internalInvariant(\n 'Validated migration plan template artifacts must correspond exactly to changed file outputs in file order.',\n );\n }\n return templateArtifacts;\n}\n\nfunction validatedStylesheet(\n rendered: RenderedProject,\n plan: MigrationPlan,\n templateArtifacts: readonly PlannedOutputArtifact[],\n supplied: StylesheetMigrationResult | undefined,\n): StylesheetMigrationResult | undefined {\n const nonTemplateArtifacts = plan.artifacts.filter(artifact => artifact.kind !== 'template');\n const configuredPath = rendered.analyzed.manifest.invocation.options.stylesheetPath;\n if (rendered.session.target === 'tailwind') {\n if (\n configuredPath !== undefined ||\n supplied !== undefined ||\n nonTemplateArtifacts.length > 0 ||\n !sameArtifactSequence(plan.artifacts, templateArtifacts)\n ) {\n throw internalInvariant('Tailwind migration plans cannot contain stylesheet artifacts or metadata.');\n }\n return undefined;\n }\n\n const stylesheetArtifact = nonTemplateArtifacts.length === 1 ? nonTemplateArtifacts[0] : undefined;\n const canonicalConfiguredPath =\n configuredPath === undefined || configuredPath.trim().length === 0\n ? undefined\n : normalizedAbsolutePath(configuredPath);\n const expectedChange = stylesheetArtifact === undefined ? 'unchanged' : stylesheetChange(stylesheetArtifact);\n const expectedArtifacts = [...templateArtifacts, ...(stylesheetArtifact === undefined ? [] : [stylesheetArtifact])];\n\n if (\n canonicalConfiguredPath !== undefined &&\n (plan.files.some(\n file =>\n normalizedAbsolutePath(file.inputPath) === canonicalConfiguredPath ||\n normalizedAbsolutePath(file.outputPath) === canonicalConfiguredPath,\n ) ||\n templateArtifacts.some(artifact => normalizedAbsolutePath(artifact.path) === canonicalConfiguredPath))\n ) {\n throw internalInvariant(\n 'Configured stylesheet path must not collide with any template input, output, or artifact path.',\n );\n }\n\n if (\n canonicalConfiguredPath === undefined ||\n supplied === undefined ||\n nonTemplateArtifacts.length > 1 ||\n (stylesheetArtifact !== undefined && stylesheetArtifact.kind !== 'stylesheet') ||\n normalizedAbsolutePath(supplied.path) !== canonicalConfiguredPath ||\n (stylesheetArtifact !== undefined && normalizedAbsolutePath(stylesheetArtifact.path) !== canonicalConfiguredPath) ||\n supplied.change !== expectedChange ||\n !sameArtifactSequence(plan.artifacts, expectedArtifacts)\n ) {\n throw internalInvariant(\n 'CSS stylesheet metadata must correspond exactly to its configured path and artifact change state.',\n );\n }\n\n return Object.freeze({ path: canonicalConfiguredPath, change: supplied.change });\n}\n\nfunction stylesheetChange(artifact: PlannedOutputArtifact): StylesheetMigrationResult['change'] {\n if (artifact.original.status === 'absent') return 'created';\n if (artifact.proposed.status === 'absent') return 'removed';\n return 'updated';\n}\n\nfunction sameArtifactSequence(\n left: readonly PlannedOutputArtifact[],\n right: readonly PlannedOutputArtifact[],\n): boolean {\n return left.length === right.length && left.every((artifact, index) => sameArtifact(artifact, right[index]));\n}\n\nfunction sameArtifact(left: PlannedOutputArtifact, right: PlannedOutputArtifact | undefined): boolean {\n return (\n right !== undefined &&\n left.kind === right.kind &&\n normalizedAbsolutePath(left.path) === normalizedAbsolutePath(right.path) &&\n sameOwnedValue(left.original, right.original) &&\n sameOwnedValue(left.proposed, right.proposed)\n );\n}\n\nfunction samePathPair(left: RenderedTemplateFile, right: FileMigrationResult): boolean {\n return (\n normalizedAbsolutePath(left.inputPath) === normalizedAbsolutePath(right.inputPath) &&\n normalizedAbsolutePath(left.outputPath) === normalizedAbsolutePath(right.outputPath)\n );\n}\n\nfunction sameOwnedValue(left: unknown, right: unknown): boolean {\n if (Object.is(left, right)) return true;\n if (Array.isArray(left) || Array.isArray(right)) {\n return (\n Array.isArray(left) &&\n Array.isArray(right) &&\n left.length === right.length &&\n left.every((item, index) => sameOwnedValue(item, right[index]))\n );\n }\n if (!isPlainRecord(left) || !isPlainRecord(right)) return false;\n const keys = Object.keys(left);\n return (\n keys.length === Object.keys(right).length &&\n keys.every(key => Object.hasOwn(right, key) && sameOwnedValue(left[key], right[key]))\n );\n}\n\nfunction isPlainRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (value === null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value) as unknown;\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n\nfunction fileCongruenceInvariant(): MigrationApplicationError {\n return internalInvariant(\n 'Validated migration plan files must match rendered files one-to-one and in the same order.',\n );\n}\n\nfunction internalInvariant(message: string): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message);\n}\n","import * as path from 'node:path';\nimport type { OwnedCssReferences } from '../../adapter/css/stylesheet/owned-stylesheet.merger';\nimport {\n nodeDestinationTemplateSource,\n type DestinationTemplateSource,\n} from '../../migrator/destination-template-source';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport type { FileMigrationPlan } from '../../migrator/migration-plan';\nimport { AngularTemplateParser } from '../../template/angular-template.parser';\nimport { templateAttributeKeys } from '../../template/template-attribute';\nimport type { TemplateParser } from '../analyze/template-parser.port';\nimport type { RenderedProject } from '../rendered-project';\n\ninterface TemplateReferenceSource {\n readonly contents: string;\n readonly complete: boolean;\n}\n\nexport class CssReferenceCollector {\n constructor(\n private readonly referenceParser: TemplateParser = new AngularTemplateParser(),\n private readonly destinationTemplates: DestinationTemplateSource = nodeDestinationTemplateSource,\n ) {}\n\n public async collect(rendered: RenderedProject, files: readonly FileMigrationPlan[]): Promise<OwnedCssReferences> {\n if (files.length !== rendered.analyzed.templates.length) throw fileCongruenceInvariant();\n\n const destinationSources = new Map<string, Promise<TemplateReferenceSource>>();\n const templates = await Promise.all(\n files.map(async (file, index) => {\n const analyzedTemplate = rendered.analyzed.templates[index];\n if (analyzedTemplate === undefined) throw fileCongruenceInvariant();\n if (file.artifact?.kind === 'template' && file.artifact.proposed.status === 'present') {\n return { contents: file.artifact.proposed.contents, complete: true };\n }\n if (path.resolve(file.file.inputPath) === path.resolve(file.file.outputPath)) {\n return { contents: analyzedTemplate.source, complete: true };\n }\n\n const outputPath = path.normalize(path.resolve(file.file.outputPath));\n const existing = destinationSources.get(outputPath);\n if (existing !== undefined) return existing;\n const pending = this.readDestination(outputPath);\n destinationSources.set(outputPath, pending);\n return pending;\n }),\n );\n\n const classNames = new Set<string>();\n let complete = true;\n for (const template of templates) {\n complete &&= template.complete;\n const parsed = this.referenceParser.parse(template.contents, 'proposed-template.html');\n if (parsed.status === 'parse-error') {\n complete = false;\n continue;\n }\n for (const attribute of parsed.elements.flatMap(element => element.attributes)) {\n const ngClassAuthority = [...templateAttributeKeys(attribute)].some(\n key => key === 'ngclass' || key.startsWith('ngclass.'),\n );\n const literalClass = attribute.name === 'class' && attribute.binding === 'literal';\n const namedClassBinding = attribute.binding === 'property' && attribute.bindingTarget === 'class';\n const dynamicClass =\n attribute.binding === 'property' && (attribute.name === 'class' || attribute.name === 'className');\n if (!literalClass && !namedClassBinding && !dynamicClass && !ngClassAuthority) continue;\n\n if (literalClass || (ngClassAuthority && attribute.binding === 'literal')) {\n for (const className of attribute.value.split(/\\s+/u)) {\n if (isGeneratedCssClassName(className)) classNames.add(className);\n }\n }\n if (namedClassBinding) {\n const className = namedGeneratedClassName(attribute.name);\n if (className !== undefined) classNames.add(className);\n }\n if (\n dynamicClass ||\n ngClassAuthority ||\n `${attribute.value} ${attribute.rawValue}`.includes('{{') ||\n `${attribute.value} ${attribute.rawValue}`.includes('}}')\n ) {\n complete = false;\n }\n }\n }\n\n return Object.freeze({ classNames, complete });\n }\n\n private async readDestination(outputPath: string): Promise<TemplateReferenceSource> {\n try {\n return { contents: await this.destinationTemplates.read(outputPath), complete: true };\n } catch (error: unknown) {\n if (isEnoent(error)) return { contents: '', complete: false };\n throw error;\n }\n }\n}\n\nfunction fileCongruenceInvariant(): MigrationApplicationError {\n return new MigrationApplicationError(\n 'internal-invariant',\n 'Rendered file plans must match analyzed templates one-to-one and in the same order.',\n );\n}\n\nfunction isGeneratedCssClassName(className: string): boolean {\n return /^flm-[a-f0-9]{64}$/u.test(className);\n}\n\nfunction namedGeneratedClassName(name: string): string | undefined {\n return isGeneratedCssClassName(name) ? name : undefined;\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n","import { readFile } from 'node:fs/promises';\n\nexport interface DestinationTemplateSource {\n read(path: string): Promise<string>;\n}\n\nexport const nodeDestinationTemplateSource: DestinationTemplateSource = Object.freeze({\n read: (path: string) => readFile(path, 'utf8'),\n});\n","import * as path from 'node:path';\nimport type { ConversionResult } from '../../analyzer/conversion-result';\nimport { SourceEditor } from '../../edit/source-editor';\nimport { fileMigrationResult, type FileMigrationResult } from '../../migrator/file-migration-result';\nimport {\n nodeDestinationTemplateSource,\n type DestinationTemplateSource,\n} from '../../migrator/destination-template-source';\nimport {\n fileMigrationPlan,\n plannedOutputArtifact,\n type ArtifactState,\n type FileMigrationPlan,\n} from '../../migrator/migration-plan';\nimport { AngularTemplateParser } from '../../template/angular-template.parser';\nimport type { TemplateParser } from '../analyze/template-parser.port';\nimport type { AnalyzedTemplate } from '../analyzed-project';\nimport type { RenderedTemplateFile } from '../rendered-project';\n\nexport class TemplateProposalValidator {\n constructor(\n private readonly validationParser: TemplateParser = new AngularTemplateParser(),\n private readonly destinationTemplates: DestinationTemplateSource = nodeDestinationTemplateSource,\n ) {}\n\n public async validate(template: AnalyzedTemplate, rendered: RenderedTemplateFile): Promise<FileMigrationPlan> {\n if (template.status === 'parse-error') return planResult(template, rendered, false, rendered.results);\n\n const edited = new SourceEditor().apply(template.source, rendered.edits);\n if (edited.status === 'invalid') {\n throw new Error(\n `Invalid edit plan for ${template.file.inputPath}: ${edited.diagnostics.map(item => item.message).join('; ')}`,\n );\n }\n\n if (edited.output === template.source) return planResult(template, rendered, false, rendered.results);\n\n const reparsed = this.validationParser.parse(edited.output, template.file.outputPath);\n if (reparsed.status === 'parse-error') {\n return planResult(\n template,\n rendered,\n false,\n reparsed.diagnostics.map(diagnostic => ({\n status: 'parse-error' as const,\n fileName: template.file.outputPath,\n code: 'generated-template-parse-error' as const,\n reason: diagnostic.message,\n source: diagnostic.source,\n })),\n );\n }\n\n const original = await originalState(template, this.destinationTemplates);\n const proposed: ArtifactState = { status: 'present', contents: edited.output };\n if (sameState(original, proposed)) return planResult(template, rendered, false, rendered.results);\n\n return fileMigrationPlan({\n file: result(template, rendered, true, rendered.results),\n artifact: plannedOutputArtifact({\n kind: 'template',\n path: path.normalize(path.resolve(template.file.outputPath)),\n original,\n proposed,\n }),\n });\n }\n}\n\nasync function originalState(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n destinationTemplates: DestinationTemplateSource,\n): Promise<ArtifactState> {\n if (path.resolve(template.file.inputPath) === path.resolve(template.file.outputPath)) {\n return { status: 'present', contents: template.source };\n }\n\n try {\n return { status: 'present', contents: await destinationTemplates.read(template.file.outputPath) };\n } catch (error: unknown) {\n if (isEnoent(error)) return { status: 'absent' };\n throw error;\n }\n}\n\nfunction planResult(\n template: AnalyzedTemplate,\n rendered: RenderedTemplateFile,\n changed: boolean,\n results: readonly ConversionResult[],\n): FileMigrationPlan {\n return fileMigrationPlan({ file: result(template, rendered, changed, results) });\n}\n\nfunction result(\n template: AnalyzedTemplate,\n rendered: RenderedTemplateFile,\n changed: boolean,\n results: readonly ConversionResult[],\n): FileMigrationResult {\n return fileMigrationResult({\n inputPath: template.file.inputPath,\n outputPath: rendered.outputPath,\n changed,\n results,\n });\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n\nfunction sameState(left: ArtifactState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n","import { randomUUID } from 'node:crypto';\nimport { lstat, mkdir, open, rename, rmdir, unlink } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\n\ninterface AtomicFileIdentity {\n readonly dev: string;\n readonly ino: string;\n}\n\nexport interface AtomicFileStat {\n readonly dev: number | bigint;\n readonly ino: number | bigint;\n isDirectory(): boolean;\n isFile(): boolean;\n isSymbolicLink(): boolean;\n}\n\nexport interface AtomicFileHandle {\n writeFile(contents: string, encoding: BufferEncoding): Promise<void>;\n stat(): Promise<AtomicFileStat>;\n sync(): Promise<void>;\n close(): Promise<void>;\n}\n\nexport interface AtomicFileOperations {\n mkdir(path: string, options?: { readonly recursive?: boolean; readonly mode?: number }): Promise<unknown>;\n open(path: string, flags: 'wx'): Promise<AtomicFileHandle>;\n lstat(path: string): Promise<AtomicFileStat>;\n rename(source: string, destination: string): Promise<void>;\n rmdir(path: string): Promise<void>;\n unlink(path: string): Promise<void>;\n}\n\nconst defaultOperations: AtomicFileOperations = { lstat, mkdir, open, rename, rmdir, unlink };\n\nexport class AtomicFileWriter {\n constructor(private readonly operations: AtomicFileOperations = defaultOperations) {}\n\n async write(targetPath: string, contents: string): Promise<void> {\n const directory = dirname(targetPath);\n const namespacePath = join(directory, `.${basename(targetPath)}.${randomUUID()}.txn`);\n const temporaryPath = join(namespacePath, 'stage');\n\n await this.operations.mkdir(directory, { recursive: true });\n await this.operations.mkdir(namespacePath, { mode: 0o700 });\n const namespaceIdentity = await this.captureNamespaceIdentity(namespacePath, targetPath);\n let temporaryFile: AtomicFileHandle | undefined;\n let temporaryIdentity: AtomicFileIdentity | undefined;\n try {\n temporaryFile = await this.operations.open(temporaryPath, 'wx');\n temporaryIdentity = identity(await temporaryFile.stat());\n await temporaryFile.writeFile(contents, 'utf8');\n await temporaryFile.sync();\n await temporaryFile.close();\n temporaryFile = undefined;\n await this.assertNamespaceIdentity(namespacePath, namespaceIdentity, targetPath);\n await this.assertTemporaryIdentity(temporaryPath, temporaryIdentity, targetPath);\n await this.operations.rename(temporaryPath, targetPath);\n } catch (error: unknown) {\n await temporaryFile?.close().catch(() => undefined);\n const cleanupConfirmed = await this.cleanupOwnedTemporary(\n namespacePath,\n namespaceIdentity,\n temporaryPath,\n temporaryIdentity,\n targetPath,\n );\n if (!cleanupConfirmed) throw cleanupError(targetPath, error);\n throw error;\n }\n if (!(await this.cleanupNamespace(namespacePath, namespaceIdentity, targetPath))) {\n throw cleanupError(targetPath);\n }\n }\n\n private async captureNamespaceIdentity(path: string, targetPath: string): Promise<AtomicFileIdentity> {\n const stat = await this.operations.lstat(path);\n if (stat.isSymbolicLink() || !stat.isDirectory()) throw ownershipError(targetPath);\n return identity(stat);\n }\n\n private async assertNamespaceIdentity(path: string, expected: AtomicFileIdentity, targetPath: string): Promise<void> {\n const stat = await this.operations.lstat(path);\n if (stat.isSymbolicLink() || !stat.isDirectory() || !sameIdentity(identity(stat), expected)) {\n throw ownershipError(targetPath);\n }\n }\n\n private async assertTemporaryIdentity(path: string, expected: AtomicFileIdentity, targetPath: string): Promise<void> {\n const stat = await this.operations.lstat(path);\n if (stat.isSymbolicLink() || !stat.isFile() || !sameIdentity(identity(stat), expected)) {\n throw ownershipError(targetPath);\n }\n }\n\n private async cleanupOwnedTemporary(\n namespacePath: string,\n namespaceIdentity: AtomicFileIdentity,\n temporaryPath: string,\n temporaryIdentity: AtomicFileIdentity | undefined,\n targetPath: string,\n ): Promise<boolean> {\n if (temporaryIdentity) {\n try {\n await this.assertNamespaceIdentity(namespacePath, namespaceIdentity, targetPath);\n await this.assertTemporaryIdentity(temporaryPath, temporaryIdentity, targetPath);\n } catch (error: unknown) {\n if (!isEnoent(error)) return false;\n }\n try {\n await this.operations.unlink(temporaryPath);\n } catch {\n // The operation may have taken effect before reporting failure; inspect below.\n }\n try {\n await this.operations.lstat(temporaryPath);\n return false;\n } catch (error: unknown) {\n if (!isEnoent(error)) return false;\n }\n }\n return this.cleanupNamespace(namespacePath, namespaceIdentity, targetPath);\n }\n\n private async cleanupNamespace(\n namespacePath: string,\n namespaceIdentity: AtomicFileIdentity,\n targetPath: string,\n ): Promise<boolean> {\n try {\n await this.assertNamespaceIdentity(namespacePath, namespaceIdentity, targetPath);\n await this.operations.rmdir(namespacePath);\n } catch {\n // The operation may have taken effect before reporting failure; inspect below.\n }\n try {\n await this.operations.lstat(namespacePath);\n return false;\n } catch (error: unknown) {\n return isEnoent(error);\n }\n }\n}\n\nfunction identity(stat: AtomicFileStat): AtomicFileIdentity {\n return { dev: String(stat.dev), ino: String(stat.ino) };\n}\n\nfunction sameIdentity(left: AtomicFileIdentity, right: AtomicFileIdentity): boolean {\n return left.dev === right.dev && left.ino === right.ino;\n}\n\nfunction ownershipError(targetPath: string): Error {\n return new Error(`Atomic write ownership could not be confirmed for ${targetPath}.`);\n}\n\nfunction cleanupError(targetPath: string, cause?: unknown): Error {\n return new Error(\n `Atomic write cleanup could not be confirmed for ${targetPath}.`,\n cause === undefined ? undefined : { cause },\n );\n}\n\nfunction isEnoent(error: unknown): boolean {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n","import { AtomicFileWriter } from '../lib/atomic-file.writer';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport { pathsEquivalentOnFileSystem, pathsOverlapOnFileSystem } from '../migrator/migration-path.validator';\nimport type { MigrationReport } from './migration-report';\n\ntype ReportFileWriter = Pick<AtomicFileWriter, 'write'>;\n\nexport interface JsonReportWriteOptions {\n readonly protectedPaths?: readonly string[];\n}\n\nexport class JsonReportWriter {\n constructor(private readonly writer: ReportFileWriter = new AtomicFileWriter()) {}\n\n public async write(path: string, report: MigrationReport, options: JsonReportWriteOptions = {}): Promise<void> {\n for (const protectedPath of options.protectedPaths ?? []) {\n if (!(await pathsOverlapOnFileSystem(protectedPath, path))) continue;\n const collisionPaths = (await pathsEquivalentOnFileSystem(protectedPath, path))\n ? [protectedPath]\n : [protectedPath, path];\n throw new MigrationApplicationError(\n 'path-collision',\n `Report path collides with a migration output: ${path}`,\n collisionPaths,\n );\n }\n const contents = `${JSON.stringify(report, null, 2)}\\n`;\n await this.writer.write(path, contents);\n }\n}\n","import type { MigrationReport, ReportResult } from './migration-report';\n\ntype MigrationApplication = MigrationReport['application'];\ntype StylesheetChange = NonNullable<MigrationReport['stylesheet']>['change'];\n\ninterface ApplicationPresentation {\n readonly outcome: string;\n readonly footer?: string;\n}\n\nfunction assertNever(value: never, subject: string): never {\n throw new Error(`Unsupported ${subject}: ${String(value)}`);\n}\n\nexport interface TextOutput {\n write(text: string): void;\n readonly isTTY?: boolean;\n}\n\nexport class TerminalPresenter {\n public present(report: MigrationReport, output: TextOutput): void {\n const { summary } = report;\n const application = report.application;\n const presentation = this.applicationPresentation(report);\n const totals = `Converted ${summary.converted} | Review ${summary.review} | Unsupported ${summary.unsupported} | Invalid ${summary.invalid} | Parse errors ${summary.parseErrors}`;\n const stylesheet = report.stylesheet\n ? `Stylesheet: ${this.stylesheetAction(report.stylesheet.change, application.status)} ${report.stylesheet.path}`\n : undefined;\n const diagnostics = report.files.flatMap(file =>\n file.results\n .filter((result): result is Exclude<ReportResult, { status: 'converted' }> => result.status !== 'converted')\n .map(result => `${file.path}:${result.offset} [${result.code}] ${result.reason}`),\n );\n\n output.write(\n [presentation.outcome, totals, stylesheet, ...diagnostics, presentation.footer, '']\n .filter((line): line is string => line !== undefined)\n .join('\\n'),\n );\n }\n\n private applicationPresentation(report: MigrationReport): ApplicationPresentation {\n const { summary, application } = report;\n\n switch (application.status) {\n case 'applied':\n if (report.mode !== 'write') throw new Error('Applied application requires write mode.');\n return {\n outcome: `Applied: ${summary.filesScanned} files scanned, ${summary.filesChanged} changed`,\n };\n case 'skipped':\n switch (application.reason) {\n case 'plan-only':\n if (report.mode !== 'plan') throw new Error('Plan-only application requires plan mode.');\n return {\n outcome: `${this.modeLabel(report.mode)}: ${summary.filesScanned} files scanned, ${summary.filesChanged} would change`,\n footer: 'No project files were written. Run again with --write to apply this plan.',\n };\n case 'parse-errors':\n if (report.mode !== 'write') throw new Error('Parse-error application requires write mode.');\n return {\n outcome: `${this.modeLabel(report.mode)}: ${summary.filesScanned} files scanned, ${summary.filesChanged} would change`,\n footer: 'No project files were written because parsing failed.',\n };\n default:\n return assertNever(application.reason, 'migration application reason');\n }\n default:\n return assertNever(application, 'migration application');\n }\n }\n\n private modeLabel(mode: MigrationReport['mode']): 'Plan' | 'Write' {\n switch (mode) {\n case 'plan':\n return 'Plan';\n case 'write':\n return 'Write';\n default:\n return assertNever(mode, 'migration mode');\n }\n }\n\n private stylesheetAction(change: StylesheetChange, status: MigrationApplication['status']): string {\n switch (status) {\n case 'applied':\n return this.completedStylesheetAction(change);\n case 'skipped':\n return this.prospectiveStylesheetAction(change);\n default:\n return assertNever(status, 'migration application status');\n }\n }\n\n private completedStylesheetAction(change: StylesheetChange): string {\n switch (change) {\n case 'created':\n return 'created';\n case 'updated':\n return 'updated';\n case 'removed':\n return 'removed';\n case 'unchanged':\n return 'unchanged';\n default:\n return assertNever(change, 'stylesheet change');\n }\n }\n\n private prospectiveStylesheetAction(change: StylesheetChange): string {\n switch (change) {\n case 'created':\n return 'would create';\n case 'updated':\n return 'would update';\n case 'removed':\n return 'would remove';\n case 'unchanged':\n return 'would remain unchanged';\n default:\n return assertNever(change, 'stylesheet change');\n }\n }\n}\n","type ErrorWithMessage = {\n message: string;\n};\n\n/**\n * Returns true if the error object has a message property. Otherwise false.\n * @param error error object or any other object\n * @returns true if the error object has a message property. Otherwise false.\n */\nfunction isErrorWithMessage(error: unknown): error is ErrorWithMessage {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'message' in error &&\n typeof (error as Record<string, unknown>).message === 'string'\n );\n}\n\n/**\n * Returns an error object with a message. If the error object is not an error, it will be converted to an error object.\n * @param maybeError error object or any other object\n * @returns error object\n */\nfunction toErrorWithMessage(maybeError: unknown): ErrorWithMessage {\n if (isErrorWithMessage(maybeError)) return maybeError;\n\n try {\n return new Error(JSON.stringify(maybeError));\n } catch {\n // fallback in case there's an error stringifying the maybeError\n // like with circular references for example.\n return new Error(String(maybeError));\n }\n}\n\n/**\n * Returns the error message from an error object. If the error object is not an error, it will be converted to an error object.\n * @param error error object or any other object\n * @returns error message\n */\nfunction getErrorMessage(error: unknown) {\n return toErrorWithMessage(error).message;\n}\n\nexport { getErrorMessage };\n","import type { MigrationReport } from '../report/migration-report';\n\nexport function resolveExitCode(report: MigrationReport, allowUnresolved: boolean): 0 | 1 | 2 {\n if (report.summary.parseErrors > 0) return 1;\n\n const hasUnresolved = report.summary.review > 0 || report.summary.unsupported > 0 || report.summary.invalid > 0;\n\n return hasUnresolved && !allowUnresolved ? 2 : 0;\n}\n","import path from 'node:path';\n\nexport function validateReportPath(reportPath: string): void {\n if (reportPath.trim().length === 0) {\n throw new Error('Report path must not be empty.');\n }\n\n if (path.extname(reportPath).toLowerCase() !== '.json') {\n throw new Error('Report path must have a .json extension.');\n }\n}\n","import { DEFAULT_BREAKPOINTS, ORIENTATION_BREAKPOINTS } from '../analyzer/flex-layout.catalog';\n\nexport interface BreakpointMigrationConfig {\n readonly orientationBreakpoints: boolean;\n readonly printWithBreakpoints?: readonly string[];\n}\n\nconst standardAliases = new Set<string>(DEFAULT_BREAKPOINTS);\nconst orientationAliases = new Set<string>(ORIENTATION_BREAKPOINTS);\n\nexport function parsePrintWithBreakpoints(value: string, orientationEnabled: boolean): readonly string[] {\n if (value === 'none') return Object.freeze([]);\n\n const aliases = value.split(',').map(alias => alias.trim());\n if (aliases.some(alias => alias.length === 0)) {\n throw new Error('Print breakpoint aliases must not be empty');\n }\n if (aliases.includes('none')) {\n throw new Error('The literal none cannot be combined with breakpoint aliases');\n }\n\n const seen = new Set<string>();\n for (const alias of aliases) {\n if (seen.has(alias)) throw new Error(`Print breakpoint list contains duplicate alias ${alias}`);\n seen.add(alias);\n\n if (alias === 'print') throw new Error('Print breakpoint list must not contain print');\n if (orientationAliases.has(alias) && !orientationEnabled) {\n throw new Error(`Orientation breakpoint alias ${alias} requires --orientation-breakpoints`);\n }\n if (!standardAliases.has(alias) && !orientationAliases.has(alias)) {\n throw new Error(`Unknown breakpoint alias ${alias}`);\n }\n }\n\n return Object.freeze(aliases);\n}\n","import * as path from 'node:path';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { PathApi } from '../migrator/migration-path.validator';\n\nexport interface StylesheetPathValidationRequest {\n readonly target: string;\n readonly stylesheetPath?: string;\n readonly inputPath: string;\n readonly outputPath: string;\n readonly reportPath?: string;\n}\n\nexport async function validateStylesheetPath(\n request: StylesheetPathValidationRequest,\n pathApi: PathApi = path,\n): Promise<string | undefined> {\n if (request.target !== 'css') {\n if (request.stylesheetPath !== undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--stylesheet can only be used with --target css.', [\n request.stylesheetPath,\n ]);\n }\n return undefined;\n }\n\n if (request.stylesheetPath === undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--target css requires --stylesheet <path>.');\n }\n if (request.stylesheetPath.trim().length === 0) {\n throw new MigrationApplicationError('invalid-configuration', 'Stylesheet path must not be empty.');\n }\n\n return pathApi.resolve(request.stylesheetPath);\n}\n","import type { MigrationMode } from '../migrator/migration-mode';\n\nconst obsoleteDryRunGuidance = 'Planning is now the default. Remove --dry-run; use --write to apply changes.';\n\nexport function resolveMigrationMode(argv: readonly string[], write: boolean): MigrationMode {\n const cliArguments = argv.slice(2);\n const optionTerminator = cliArguments.indexOf('--');\n const optionArguments = optionTerminator === -1 ? cliArguments : cliArguments.slice(0, optionTerminator);\n\n if (optionArguments.some(argument => argument === '--dry-run' || argument.startsWith('--dry-run='))) {\n throw new Error(obsoleteDryRunGuidance);\n }\n if (optionArguments.filter(argument => argument === '--write').length > 1) {\n throw new Error('--write may only be specified once.');\n }\n\n return write ? 'write' : 'plan';\n}\n","import { runCli } from './cli/run-cli';\nimport { getErrorMessage } from './util/error.util';\n\nasync function main(): Promise<void> {\n process.exitCode = await runCli(process.argv);\n}\n\nvoid main().catch((error: unknown) => {\n process.stderr.write(`Error: ${getErrorMessage(error)}\\n`);\n process.exitCode = 1;\n});\n"],"mappings":";;;AAAA,SAAS,SAAS,gBAAgB,sBAAsB,cAAc;AACtE,YAAYA,YAAU;;;ACDtB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,MA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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,oCAAoC,oBAAI,IAAI;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,mBAAmB,OAAwB;AAClD,SAAO,oBAAoB,KA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A,IACH;AACA,UAAM,eAAe,OAAO,QAAQ,cAAc,IAAI,OAAO,SAAS,OAAO;AAE7E,QAAI,kBAAkB,EAAE,QAAQ,QAAQ,YAAY;AACpD,QAAI,eAAe,QAAW;AAC5B,YAAM,IAAI,iBAAiB,EAAE,MAAM,YAAY,QAAQ;AAAA,QACrD,gBAAgB,mBAAmB,SAAY,CAAC,IAAI,CAAC,cAAc;AAAA,MACrE,CAAC;AAAA,IACH;AAEA,eAAW,gBAAgB,QAAQ,QAAQ,eAAe;AAAA,EAC5D,CAAC;AAEH,MAAI;AACF,yBAAqB,MAAM,KAAK;AAChC,UAAM,QAAQ,WAAW,CAAC,GAAG,IAAI,CAAC;AAClC,WAAO;AAAA,EACT,SAAS,OAAgB;AACvB,QAAI,iBAAiB,gBAAgB;AACnC,aAAO,MAAM,aAAa,IAAI,IAAI;AAAA,IACpC;AAEA,WAAO,OAAO,MAAM,UAAU,gBAAgB,KAAK,CAAC;AAAA,CAAI;AACxD,QAAI,SAAS,iBAAiB,SAAS,MAAM,OAAO;AAClD,aAAO,OAAO,MAAM,GAAG,MAAM,KAAK;AAAA,CAAI;AAAA,IACxC;AACA,WAAO;AAAA,EACT;AACF;;;A+HhLA,eAAe,OAAsB;AACnC,UAAQ,WAAW,MAAM,OAAO,QAAQ,IAAI;AAC9C;AAEA,KAAK,KAAK,EAAE,MAAM,CAAC,UAAmB;AACpC,UAAQ,OAAO,MAAM,UAAU,gBAAgB,KAAK,CAAC;AAAA,CAAI;AACzD,UAAQ,WAAW;AACrB,CAAC;","names":["path","timestamp","declaration","property","identity","freezeDeclarations","declaration","freezeDeclarations","declaration","freezeDeclarations","declaration","freezeDeclarations","declaration","declaration","range","property","parsed","closingByOpening","property","authority","textSizes","property","cssProperties","declaration","alignment","parsed","arbitraryValue","arbitraryValue","main","mainAxis","alignment","arbitraryValue","declaration","property","containsControl","declaration","result","property","range","parsed","path","result","diagnostic","normalizedAbsolutePath","path","stat","path","destination","randomUUID","join","recoveryResult","join","randomUUID","randomUUID","join","join","randomUUID","dirname","join","resolve","path","resolve","dirname","result","join","sortedUnique","result","path","result","stat","path","path","path","stat","path","path","result","path","optionalAliases","declaration","property","main","customProperty","property","declaration","result","parsed","declaration","result","property","interpolation","parsed","declaration","property","range","activation","property","contextUnverified","declaration","properties","parsed","diagnostic","writers","visibilityIds","numericRange","range","rangesCover","unresolved","dynamicBinding","unresolvedBreakpoint","contextUnverified","responsivePrecedenceUnverified","compareText","visibilityDirectives","extendedClassDirectives","extendedStyleDirectives","extendedDirectives","gridDirectives","dynamicBinding","contextUnverified","responsivePrecedenceUnverified","unresolvedBreakpoint","activation","result","equalClassValues","declaration","parsed","property","familyPlan","decision","printOwner","states","resolved","internalInvariant","result","path","sequenceInvariant","samePathPair","internalInvariant","identity","result","diagnostic","declaration","freezeMedia","normalizedAbsolutePath","diagnostic","path","path","result","freezeValue","lstat","stat","path","path","lstat","isEnoent","path","relative","sameIdentity","stat","identity","lstat","isEnoent","lstat","readFile","path","invalid","declaration","property","property","START_MARKER","END_MARKER","parsed","parsedRule","resolveRetainedMediaContext","compareCodeUnits","nodeFileSystem","readFile","lstat","sameState","stat","isEnoent","path","internalInvariant","samePathPair","normalizedAbsolutePath","sameOwnedValue","result","isPlainRecord","path","readFile","path","fileCongruenceInvariant","parsed","isEnoent","path","diagnostic","sameState","isEnoent","stylesheetChange","randomUUID","lstat","mkdir","open","rename","rmdir","unlink","basename","dirname","join","identity","path","stat","sameIdentity","isEnoent","path","result","path","standardAliases","path","path"]}
1
+ {"version":3,"sources":["../src/migrator/migration-path.validator.ts","../src/migrator/migration-application.error.ts","../src/config/migration-config.ts","../src/util/sha-256.ts","../src/config/tailwind-target-profile.ts","../src/config/source-breakpoints.ts","../src/cli/run-cli.ts","../package.json","../src/logger.ts","../src/analyzer/flex-layout.catalog.ts","../src/adapter/css/css-invariant.error.ts","../src/util/compare-code-units.ts","../src/adapter/css/css-rule-order.ts","../src/adapter/css/css-artifact.registry.ts","../src/adapter/css/css-breakpoint.context.ts","../src/adapter/css/flex/flex-align.css-renderer.ts","../src/adapter/css/flex/flex-fill.css-renderer.ts","../src/adapter/css/flex/flex-item.css-renderer.ts","../src/adapter/css/flex/flex-offset.css-renderer.ts","../src/adapter/css/flex/flex-order.css-renderer.ts","../src/adapter/css/flex/layout.css-renderer.ts","../src/adapter/css/flex/layout-align.css-renderer.ts","../src/adapter/css/flex/layout-gap.css-renderer.ts","../src/render/css/css.renderer.ts","../src/config/tailwind-builtin-variants.ts","../src/config/tailwind-candidate-profile.ts","../src/edit/html-attribute-value.ts","../src/adapter/tailwind/extended/tailwind-arbitrary-property.encoder.ts","../src/breakpoint/breakpoint-catalog.ts","../src/adapter/tailwind/tailwind-arbitrary-syntax.ts","../src/semantic/css-property-ownership.ts","../src/adapter/tailwind/extended/tailwind-arbitrary-value-ownership.ts","../src/adapter/tailwind/tailwind-class-conflict.ts","../src/adapter/tailwind/extended/tailwind-candidate-classifier.ts","../src/evidence/tailwind-source-property.evidence.ts","../src/flex/flex-align.semantic.ts","../src/adapter/tailwind/directives/flex-align.strategy.ts","../src/flex/flex-fill.semantic.ts","../src/adapter/tailwind/directives/flex-fill.strategy.ts","../src/flex/css-length.ts","../src/flex/layout.semantic.ts","../src/flex/flex-item.semantic.ts","../src/adapter/tailwind/directives/flex-item.strategy.ts","../src/flex/flex-offset.semantic.ts","../src/adapter/tailwind/tailwind-value.parser.ts","../src/adapter/tailwind/directives/flex-offset.strategy.ts","../src/flex/flex-order.semantic.ts","../src/adapter/tailwind/directives/flex-order.strategy.ts","../src/flex/layout-align.semantic.ts","../src/adapter/tailwind/directives/layout.strategy.ts","../src/adapter/tailwind/directives/layout-align.strategy.ts","../src/flex/layout-gap.semantic.ts","../src/adapter/tailwind/directives/layout-gap.strategy.ts","../src/adapter/tailwind/responsive-variant.emitter.ts","../src/adapter/tailwind/extended/extended-responsive.emitter.ts","../src/adapter/tailwind/grid/tailwind-grid.renderer.ts","../src/adapter/tailwind/visibility/visibility.emitter.ts","../src/semantic/semantic-plan.ts","../src/render/tailwind/tailwind.renderer.ts","../src/render/render-session.ts","../src/adapter/adapter.factory.ts","../src/pipeline/analyze/analyze-project.stage.ts","../src/analyzer/flex-layout-attribute.analyzer.ts","../src/analyzer/template.analyzer.ts","../src/template/angular-template.parser.ts","../src/pipeline/analyzed-project.ts","../src/pipeline/project-manifest.ts","../src/transaction/transaction-unit.state.ts","../src/transaction/cleanup.unit.ts","../src/transaction/commit.unit.ts","../src/transaction/rollback.unit.ts","../src/transaction/staging.unit.ts","../src/transaction/transaction-signal.registrar.ts","../src/transaction/transaction-unit.session.ts","../src/transaction/migration-transaction.ts","../src/pipeline/applied-project.ts","../src/pipeline/apply/apply-project.stage.ts","../src/pipeline/discover/discover-project.stage.ts","../src/lib/gitignore.helper.ts","../src/pipeline/pipeline-stage.error.ts","../src/pipeline/migration-pipeline.ts","../src/report/migration-report.builder.ts","../src/pipeline/invocation-error-path.mapper.ts","../src/pipeline/migration-runner.ts","../src/template/template-attribute.ts","../src/image/srcset-value.ts","../src/image/responsive-image.planner.ts","../src/edit/source-editor.ts","../src/image/html-attribute.encoder.ts","../src/image/picture.renderer.ts","../src/grid/grid-value.parser.ts","../src/semantic/extended/responsive-style-value.parser.ts","../src/semantic/extended/extended-family.planner.ts","../src/semantic/literal-style-declaration.ts","../src/semantic/extended/responsive-class-value.parser.ts","../src/semantic/extended/extended-semantic.planner.ts","../src/semantic/semantic-family-composition.planner.ts","../src/semantic/responsive-family.planner.ts","../src/semantic/source-property-evidence.ts","../src/semantic/visibility/visibility-value.parser.ts","../src/semantic/visibility/visibility-state.planner.ts","../src/semantic/element-semantic.planner.ts","../src/planner/semantic-render.coordinator.ts","../src/planner/conversion-planner.ts","../src/pipeline/rendered-project.ts","../src/pipeline/render/render-project.stage.ts","../src/pipeline/validate/validate-project.stage.ts","../src/migrator/migration-plan.ts","../src/migrator/file-migration-result.ts","../src/migrator/stylesheet.planner.ts","../src/adapter/css/stylesheet/css-stylesheet.error.ts","../src/adapter/css/stylesheet/css-comment.scanner.ts","../src/adapter/css/stylesheet/owned-css-block.parser.ts","../src/adapter/css/stylesheet/css-artifact.validator.ts","../src/adapter/css/stylesheet/css-media.serializer.ts","../src/adapter/css/stylesheet/css-rule.serializer.ts","../src/adapter/css/stylesheet/owned-css-block.serializer.ts","../src/adapter/css/stylesheet/owned-stylesheet.merger.ts","../src/migrator/stylesheet-contents.ts","../src/pipeline/validated-project-plan.ts","../src/pipeline/validate/css-reference.collector.ts","../src/migrator/destination-template-source.ts","../src/template/generated-template-validation.ts","../src/pipeline/validate/template-proposal.validator.ts","../src/lib/atomic-file.writer.ts","../src/report/json-report.writer.ts","../src/report/terminal.presenter.ts","../src/util/error.util.ts","../src/cli/exit-policy.ts","../src/cli/report-path.validator.ts","../src/config/breakpoint-migration-config.ts","../src/cli/stylesheet-path.validator.ts","../src/cli/migration-mode.parser.ts","../src/main.ts"],"sourcesContent":["import { lstat, stat } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { MigrationApplicationError } from './migration-application.error';\n\nexport type PathApi = typeof path.posix;\n\nexport interface MigrationPathValidationRequest {\n readonly templates: readonly { readonly inputPath: string; readonly outputPath: string }[];\n readonly stylesheetPath?: string;\n readonly reportPath?: string;\n}\n\nexport interface StylesheetRootTopologyRequest {\n readonly stylesheetPath?: string;\n readonly stylesheetPathInput?: string;\n readonly inputPath: string;\n readonly outputPath: string;\n readonly reportPath?: string;\n}\n\ninterface PathClaim {\n readonly path: string;\n readonly kind: 'template-input' | 'template-output' | 'stylesheet' | 'report';\n readonly templateIndex?: number;\n}\n\ninterface FileSystemIdentity {\n readonly device: string;\n readonly inode: string;\n}\n\ninterface ExistingPathPrefix {\n readonly identity: FileSystemIdentity;\n readonly suffix: readonly string[];\n}\n\ninterface ObservedPath {\n readonly exactIdentity?: FileSystemIdentity;\n readonly prefixes: readonly ExistingPathPrefix[];\n}\n\ntype PathRelationship = 'equivalent' | 'ancestor' | 'descendant' | 'distinct';\ntype PathObserver = (candidate: string) => Promise<ObservedPath>;\n\nexport async function validateMigrationPaths(\n request: MigrationPathValidationRequest,\n pathApi: PathApi = path,\n): Promise<void> {\n const claims = normalizedClaims(request, pathApi);\n await validateCollisions(claims, pathApi);\n\n const destinations = claims.filter(claim => claim.kind !== 'template-input');\n for (const destination of destinations) {\n await validateDestination(destination.path);\n }\n}\n\nexport async function validateStylesheetRootTopology(\n request: StylesheetRootTopologyRequest,\n pathApi: PathApi = path,\n): Promise<void> {\n if (request.stylesheetPath === undefined) return;\n const stylesheetPath = pathApi.resolve(request.stylesheetPath);\n const templateRoots = [request.inputPath, request.outputPath].map(claim => pathApi.resolve(claim));\n const reportPath = request.reportPath === undefined ? undefined : pathApi.resolve(request.reportPath);\n const exactCollision = (\n await Promise.all(\n [...templateRoots, reportPath].map(claim =>\n claim === undefined ? Promise.resolve(false) : pathsEquivalentOnFileSystem(stylesheetPath, claim, pathApi),\n ),\n )\n ).some(Boolean);\n const reportHierarchyCollision =\n reportPath !== undefined && (await pathsOverlapOnFileSystem(stylesheetPath, reportPath, pathApi));\n if (exactCollision || reportHierarchyCollision) {\n const collisionPaths =\n reportHierarchyCollision &&\n reportPath !== undefined &&\n !(await pathsEquivalentOnFileSystem(stylesheetPath, reportPath, pathApi))\n ? [stylesheetPath, reportPath]\n : [stylesheetPath];\n throw new MigrationApplicationError(\n 'path-collision',\n `Stylesheet path collides with another migration path: ${request.stylesheetPathInput ?? request.stylesheetPath}`,\n collisionPaths,\n );\n }\n\n let stylesheetStat: Awaited<ReturnType<typeof lstat>>;\n try {\n stylesheetStat = await lstat(stylesheetPath);\n } catch (error: unknown) {\n if (isEnoent(error)) return;\n throw error;\n }\n const sourcePath = request.stylesheetPathInput ?? request.stylesheetPath;\n if (stylesheetStat.isSymbolicLink()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must not be a symbolic link: ${sourcePath}`,\n [stylesheetPath],\n );\n }\n if (!stylesheetStat.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must be a regular file: ${sourcePath}`,\n [stylesheetPath],\n );\n }\n}\n\nfunction normalizedClaims(request: MigrationPathValidationRequest, pathApi: PathApi): readonly PathClaim[] {\n return [\n ...request.templates.flatMap((template, templateIndex) => [\n { path: pathApi.resolve(template.inputPath), kind: 'template-input' as const, templateIndex },\n { path: pathApi.resolve(template.outputPath), kind: 'template-output' as const, templateIndex },\n ]),\n ...(request.stylesheetPath ? [{ path: pathApi.resolve(request.stylesheetPath), kind: 'stylesheet' as const }] : []),\n ...(request.reportPath ? [{ path: pathApi.resolve(request.reportPath), kind: 'report' as const }] : []),\n ];\n}\n\nasync function validateCollisions(claims: readonly PathClaim[], pathApi: PathApi): Promise<void> {\n const observations = new Map<string, Promise<ObservedPath>>();\n const observe: PathObserver = candidate => {\n const normalized = pathApi.resolve(candidate);\n const existing = observations.get(normalized);\n if (existing) return existing;\n const pending = observePath(normalized, pathApi);\n observations.set(normalized, pending);\n return pending;\n };\n\n for (let leftIndex = 0; leftIndex < claims.length; leftIndex++) {\n const left = claims[leftIndex];\n if (!left) continue;\n for (let rightIndex = leftIndex + 1; rightIndex < claims.length; rightIndex++) {\n const right = claims[rightIndex];\n if (!right) continue;\n const relationship = await fileSystemPathRelationship(left.path, right.path, pathApi, observe);\n if (relationship === 'distinct' || isIntentionalInPlacePair(left, right, pathApi)) continue;\n\n const collisionPaths = relationship === 'equivalent' ? [left.path] : [left.path, right.path];\n throw new MigrationApplicationError(\n 'path-collision',\n `Migration paths collide: ${collisionPaths.join(' and ')}`,\n collisionPaths,\n );\n }\n }\n}\n\nfunction isIntentionalInPlacePair(left: PathClaim, right: PathClaim, pathApi: PathApi): boolean {\n return (\n pathsEquivalent(left.path, right.path, pathApi) &&\n left.templateIndex !== undefined &&\n left.templateIndex === right.templateIndex &&\n left.kind !== right.kind &&\n left.kind.startsWith('template-') &&\n right.kind.startsWith('template-')\n );\n}\n\nexport function pathsOverlap(left: string, right: string, pathApi: PathApi = path): boolean {\n const normalizedLeft = pathApi.resolve(left);\n const normalizedRight = pathApi.resolve(right);\n return (\n normalizedPathsEquivalent(pathApi, normalizedLeft, normalizedRight) ||\n isAncestor(pathApi, normalizedLeft, normalizedRight) ||\n isAncestor(pathApi, normalizedRight, normalizedLeft)\n );\n}\n\nexport function pathsEquivalent(left: string, right: string, pathApi: PathApi = path): boolean {\n return normalizedPathsEquivalent(pathApi, pathApi.resolve(left), pathApi.resolve(right));\n}\n\nexport async function pathsEquivalentOnFileSystem(\n left: string,\n right: string,\n pathApi: PathApi = path,\n): Promise<boolean> {\n return (await fileSystemPathRelationship(left, right, pathApi)) === 'equivalent';\n}\n\nexport async function pathsOverlapOnFileSystem(left: string, right: string, pathApi: PathApi = path): Promise<boolean> {\n return (await fileSystemPathRelationship(left, right, pathApi)) !== 'distinct';\n}\n\nfunction normalizedPathsEquivalent(pathApi: PathApi, left: string, right: string): boolean {\n return pathApi.relative(left, right) === '';\n}\n\nfunction isAncestor(pathApi: PathApi, ancestor: string, descendant: string): boolean {\n const relative = pathApi.relative(ancestor, descendant);\n return (\n relative !== '' && relative !== '..' && !relative.startsWith(`..${pathApi.sep}`) && !pathApi.isAbsolute(relative)\n );\n}\n\nasync function fileSystemPathRelationship(\n left: string,\n right: string,\n pathApi: PathApi,\n observe: PathObserver = candidate => observePath(candidate, pathApi),\n): Promise<PathRelationship> {\n const normalizedLeft = pathApi.resolve(left);\n const normalizedRight = pathApi.resolve(right);\n if (normalizedPathsEquivalent(pathApi, normalizedLeft, normalizedRight)) return 'equivalent';\n if (isAncestor(pathApi, normalizedLeft, normalizedRight)) return 'ancestor';\n if (isAncestor(pathApi, normalizedRight, normalizedLeft)) return 'descendant';\n\n const [observedLeft, observedRight] = await Promise.all([observe(normalizedLeft), observe(normalizedRight)]);\n if (observedLeft.exactIdentity && observedRight.exactIdentity) {\n if (sameIdentity(observedLeft.exactIdentity, observedRight.exactIdentity)) return 'equivalent';\n if (hasIdentityBelow(observedRight, observedLeft.exactIdentity)) return 'ancestor';\n if (hasIdentityBelow(observedLeft, observedRight.exactIdentity)) return 'descendant';\n return 'distinct';\n }\n\n return relationshipThroughExistingPrefixes(observedLeft, observedRight);\n}\n\nasync function observePath(candidate: string, pathApi: PathApi): Promise<ObservedPath> {\n const prefixes: ExistingPathPrefix[] = [];\n const suffix: string[] = [];\n let current = candidate;\n let exactIdentity: FileSystemIdentity | undefined;\n\n while (true) {\n try {\n const currentStat = await stat(current, { bigint: true });\n const currentIdentity = identity(currentStat);\n if (suffix.length === 0) exactIdentity = currentIdentity;\n prefixes.push({ identity: currentIdentity, suffix: [...suffix] });\n } catch (error: unknown) {\n if (!isMissingPath(error)) throw error;\n }\n\n const parent = pathApi.dirname(current);\n if (parent === current) break;\n suffix.unshift(pathApi.basename(current));\n current = parent;\n }\n\n return { ...(exactIdentity ? { exactIdentity } : {}), prefixes };\n}\n\nfunction relationshipThroughExistingPrefixes(left: ObservedPath, right: ObservedPath): PathRelationship {\n for (const leftPrefix of left.prefixes) {\n for (const rightPrefix of right.prefixes) {\n if (!sameIdentity(leftPrefix.identity, rightPrefix.identity)) continue;\n const relationship = suffixRelationship(leftPrefix.suffix, rightPrefix.suffix);\n if (relationship !== 'distinct') return relationship;\n }\n }\n return 'distinct';\n}\n\nfunction hasIdentityBelow(observed: ObservedPath, candidate: FileSystemIdentity): boolean {\n return observed.prefixes.some(prefix => prefix.suffix.length > 0 && sameIdentity(prefix.identity, candidate));\n}\n\nfunction suffixRelationship(left: readonly string[], right: readonly string[]): PathRelationship {\n const normalizedLeft = left.map(portablePathSegment);\n const normalizedRight = right.map(portablePathSegment);\n const sharedLength = Math.min(normalizedLeft.length, normalizedRight.length);\n for (let index = 0; index < sharedLength; index++) {\n if (normalizedLeft[index] !== normalizedRight[index]) return 'distinct';\n }\n if (normalizedLeft.length === normalizedRight.length) return 'equivalent';\n return normalizedLeft.length < normalizedRight.length ? 'ancestor' : 'descendant';\n}\n\nfunction portablePathSegment(value: string): string {\n return value.normalize('NFC').toLowerCase();\n}\n\nfunction identity(value: { readonly dev: number | bigint; readonly ino: number | bigint }): FileSystemIdentity {\n return { device: String(value.dev), inode: String(value.ino) };\n}\n\nfunction sameIdentity(left: FileSystemIdentity, right: FileSystemIdentity): boolean {\n return left.device === right.device && left.inode === right.inode;\n}\n\nasync function validateDestination(destination: string): Promise<void> {\n let stat: Awaited<ReturnType<typeof lstat>>;\n try {\n stat = await lstat(destination);\n } catch (error: unknown) {\n if (isEnoent(error)) return;\n throw error;\n }\n\n if (stat.isSymbolicLink()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination must not be a symbolic link: ${destination}`,\n [destination],\n );\n }\n if (!stat.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination must be a regular file: ${destination}`,\n [destination],\n );\n }\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n\nfunction isMissingPath(error: unknown): error is NodeJS.ErrnoException {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n (error.code === 'ENOENT' || error.code === 'ENOTDIR')\n );\n}\n","export type MigrationApplicationErrorCode =\n | 'invalid-configuration'\n | 'path-collision'\n | 'unsupported-path-type'\n | 'stylesheet-ownership-invalid'\n | 'concurrent-modification'\n | 'transaction-io'\n | 'transaction-interrupted'\n | 'internal-invariant';\n\nexport class MigrationApplicationError extends Error {\n readonly recoveryFailures: readonly unknown[];\n\n constructor(\n readonly code: MigrationApplicationErrorCode,\n message: string,\n readonly paths: readonly string[] = [],\n options?: ErrorOptions & { readonly recoveryFailures?: readonly unknown[] },\n ) {\n super(message, options);\n this.name = 'MigrationApplicationError';\n this.paths = Object.freeze([...paths]);\n this.recoveryFailures = Object.freeze([...(options?.recoveryFailures ?? [])]);\n }\n}\n","import { readFile, realpath } from 'node:fs/promises';\nimport path from 'node:path';\nimport { createHash } from 'node:crypto';\nimport postcss from 'postcss';\nimport {\n analyzeTailwindStylesheet,\n resolveTailwindTargetProfile,\n type StylesheetAnalysis,\n type TailwindTargetOverrides,\n type TargetDiagnostic,\n type TargetOperation,\n} from './tailwind-target-profile';\nimport { sourceBreakpointDefinition, type SourceBreakpoints } from './source-breakpoints';\n\nexport interface ConfigurationSnapshot {\n readonly path: string;\n readonly digest: string;\n readonly canonicalPath: string;\n}\nexport interface MigrationConfig {\n readonly target?: 'tailwind' | 'css';\n readonly tailwind?: TailwindTargetOverrides & { readonly stylesheet?: string };\n readonly source?: { readonly flexLayout?: { readonly breakpoints?: SourceBreakpoints } };\n}\nfunction object(value: unknown, allowed: readonly string[], label: string): Record<string, unknown> {\n if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error(`${label} must be an object.`);\n for (const key of Object.keys(value)) if (!allowed.includes(key)) throw new Error(`Unknown ${label} setting: ${key}`);\n return value as Record<string, unknown>;\n}\nfunction parseConfig(contents: string): MigrationConfig {\n const config = object(JSON.parse(contents), ['target', 'tailwind', 'source'], 'migration config');\n if (config.target !== undefined && config.target !== 'tailwind' && config.target !== 'css')\n throw new Error('Invalid migration target.');\n if (config.tailwind !== undefined) {\n const tw = object(\n config.tailwind,\n ['version', 'stylesheet', 'prefix', 'breakpoints', 'important', 'coreUtilities'],\n 'tailwind',\n );\n if (tw.stylesheet !== undefined && typeof tw.stylesheet !== 'string')\n throw new Error('Tailwind stylesheet must be a path.');\n if (tw.prefix !== undefined && tw.prefix !== null && typeof tw.prefix !== 'string')\n throw new Error('Tailwind prefix must be a string or null.');\n if (tw.breakpoints !== undefined) {\n if (!tw.breakpoints || typeof tw.breakpoints !== 'object' || Array.isArray(tw.breakpoints))\n throw new Error('Tailwind breakpoints must be an object.');\n for (const value of Object.values(tw.breakpoints))\n if (value !== null && typeof value !== 'string')\n throw new Error('Tailwind breakpoint values must be lengths or null.');\n }\n }\n if (config.source !== undefined) {\n const source = object(config.source, ['flexLayout'], 'source');\n if (source.flexLayout !== undefined) {\n const flex = object(source.flexLayout, ['breakpoints'], 'source.flexLayout');\n if (flex.breakpoints !== undefined) {\n if (!flex.breakpoints || typeof flex.breakpoints !== 'object' || Array.isArray(flex.breakpoints))\n throw new Error('Source breakpoints must be an object.');\n for (const [alias, value] of Object.entries(flex.breakpoints)) {\n object(value, ['mediaQuery', 'priority'], `source breakpoint ${alias}`);\n sourceBreakpointDefinition(alias, value as SourceBreakpoints[string]);\n }\n }\n }\n }\n return config as MigrationConfig;\n}\nconst digest = (value: string) => createHash('sha256').update(value).digest('hex');\nfunction inside(root: string, candidate: string): boolean {\n const relative = path.relative(root, candidate);\n return relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);\n}\nexport async function assertConfigurationUnchanged(snapshots: readonly ConfigurationSnapshot[]): Promise<void> {\n for (const snapshot of snapshots) {\n let current: string;\n try {\n if ((await realpath(snapshot.path)) !== snapshot.canonicalPath) throw new Error('Configuration path changed.');\n current = digest(await readFile(snapshot.path, 'utf8'));\n } catch {\n throw new Error(`Target configuration changed or disappeared since planning: ${snapshot.path}`);\n }\n if (current !== snapshot.digest) throw new Error(`Target configuration changed since planning: ${snapshot.path}`);\n }\n}\nexport async function loadMigrationConfig(options: {\n readonly cwd?: string;\n readonly config?: string;\n readonly stylesheet?: string;\n readonly prefix?: string;\n}) {\n const root = await realpath(options.cwd ?? process.cwd());\n const snapshots: ConfigurationSnapshot[] = [];\n const read = async (file: string) => {\n const contents = await readFile(file, 'utf8');\n if (contents.length > 2_000_000) throw new Error('Configuration file exceeds the 2 MB static analysis limit.');\n if (!snapshots.some(snapshot => snapshot.path === file))\n snapshots.push(Object.freeze({ path: file, canonicalPath: await realpath(file), digest: digest(contents) }));\n return contents;\n };\n const configPath = path.resolve(root, options.config ?? 'flex-layout-migrator.config.json');\n if (!configPath.endsWith('.json')) throw new Error('Migration configuration must be declarative JSON.');\n let config: MigrationConfig = {};\n try {\n config = parseConfig(await read(configPath));\n } catch (error) {\n if (\n options.config !== undefined ||\n !(error && typeof error === 'object' && 'code' in error && error.code === 'ENOENT')\n )\n throw error;\n }\n const stylesheet =\n options.stylesheet === undefined\n ? config.tailwind?.stylesheet === undefined\n ? undefined\n : path.resolve(path.dirname(configPath), config.tailwind.stylesheet)\n : path.resolve(root, options.stylesheet);\n let detected: StylesheetAnalysis | undefined;\n if (stylesheet) {\n const operations: TargetOperation[] = [];\n const diagnostics: TargetDiagnostic[] = [];\n let tailwind = false;\n let defaultTheme = false;\n let utilities = false;\n let visited = 0;\n const relative = (file: string) => path.relative(root, file).split(path.sep).join('/');\n const visit = async (file: string, ancestors: readonly string[], depth: number): Promise<void> => {\n if (++visited > 128 || depth > 16)\n throw new Error('CSS import analysis limit exceeded (128 imports / depth 16).');\n const canonical = await realpath(file);\n if (!inside(root, canonical)) throw new Error('CSS import is outside the project root.');\n if (ancestors.includes(canonical)) throw new Error('CSS import cycle detected.');\n const contents = await read(file);\n const parsed = postcss.parse(contents, { from: undefined });\n for (const node of parsed.nodes) {\n const analysis = analyzeTailwindStylesheet(node.toString(), relative(canonical));\n operations.push(...analysis.operations);\n diagnostics.push(...analysis.diagnostics);\n tailwind ||= analysis.tailwind;\n defaultTheme ||= analysis.defaultTheme;\n utilities ||= analysis.utilities;\n for (const imported of analysis.imports) {\n try {\n await visit(path.resolve(path.dirname(canonical), imported), [...ancestors, canonical], depth + 1);\n } catch (error) {\n diagnostics.push({\n code: 'tailwind-import-unresolved',\n message: `${relative(canonical)}: ${imported}: ${error instanceof Error ? error.message : 'Import unresolved'}`,\n });\n }\n }\n }\n };\n await visit(stylesheet, [], 0);\n detected = {\n source: relative(stylesheet),\n operations,\n diagnostics,\n imports: [],\n defaultTheme,\n utilities,\n tailwind,\n };\n }\n const targetProfile = resolveTailwindTargetProfile({\n detected,\n explicit: config.tailwind,\n explicitSource: path.relative(root, configPath).split(path.sep).join('/'),\n ...(options.prefix !== undefined ? { cli: { prefix: options.prefix || null } } : {}),\n });\n return Object.freeze({\n target: config.target,\n targetProfile,\n sourceBreakpoints: config.source?.flexLayout?.breakpoints,\n snapshots: Object.freeze(snapshots),\n });\n}\n","const ROUND_CONSTANTS = Object.freeze([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98,\n 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786,\n 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8,\n 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,\n 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a,\n 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7,\n 0xc67178f2,\n]);\n\nconst INITIAL_HASH = Object.freeze([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n\nexport function sha256(value: string): string {\n const source = new TextEncoder().encode(value);\n const paddedLength = Math.ceil((source.length + 9) / 64) * 64;\n const bytes = new Uint8Array(paddedLength);\n bytes.set(source);\n bytes[source.length] = 0x80;\n const bitLength = source.length * 8;\n const view = new DataView(bytes.buffer);\n view.setUint32(paddedLength - 8, Math.floor(bitLength / 0x1_0000_0000));\n view.setUint32(paddedLength - 4, bitLength >>> 0);\n\n const hash = [...INITIAL_HASH];\n const schedule = new Uint32Array(64);\n for (let offset = 0; offset < bytes.length; offset += 64) {\n for (let index = 0; index < 16; index += 1) schedule[index] = view.getUint32(offset + index * 4);\n for (let index = 16; index < schedule.length; index += 1) {\n const earlier = schedule[index - 15]!;\n const recent = schedule[index - 2]!;\n const sigma0 = rotateRight(earlier, 7) ^ rotateRight(earlier, 18) ^ (earlier >>> 3);\n const sigma1 = rotateRight(recent, 17) ^ rotateRight(recent, 19) ^ (recent >>> 10);\n schedule[index] = (schedule[index - 16]! + sigma0 + schedule[index - 7]! + sigma1) >>> 0;\n }\n\n let [a, b, c, d, e, f, g, h] = hash as [number, number, number, number, number, number, number, number];\n for (let index = 0; index < schedule.length; index += 1) {\n const sum1 = rotateRight(e, 6) ^ rotateRight(e, 11) ^ rotateRight(e, 25);\n const choice = (e & f) ^ (~e & g);\n const temporary1 = (h + sum1 + choice + ROUND_CONSTANTS[index]! + schedule[index]!) >>> 0;\n const sum0 = rotateRight(a, 2) ^ rotateRight(a, 13) ^ rotateRight(a, 22);\n const majority = (a & b) ^ (a & c) ^ (b & c);\n const temporary2 = (sum0 + majority) >>> 0;\n h = g;\n g = f;\n f = e;\n e = (d + temporary1) >>> 0;\n d = c;\n c = b;\n b = a;\n a = (temporary1 + temporary2) >>> 0;\n }\n\n const round = [a, b, c, d, e, f, g, h];\n for (let index = 0; index < hash.length; index += 1) hash[index] = (hash[index]! + round[index]!) >>> 0;\n }\n\n return hash.map(word => word.toString(16).padStart(8, '0')).join('');\n}\n\nfunction rotateRight(value: number, count: number): number {\n return (value >>> count) | (value << (32 - count));\n}\n","import { sha256 } from '../util/sha-256.js';\nimport postcss from 'postcss';\n\nexport type TargetDiagnosticCode =\n | 'tailwind-prefix-conflict'\n | 'tailwind-config-external'\n | 'tailwind-plugin-external'\n | 'tailwind-breakpoint-unknown'\n | 'tailwind-mixed-breakpoint-units'\n | 'tailwind-target-unknown'\n | 'tailwind-source-excluded'\n | 'tailwind-import-unresolved'\n | 'tailwind-target-assumption';\nexport interface TargetDiagnostic {\n readonly code: TargetDiagnosticCode;\n readonly message: string;\n}\nexport interface TargetSetting<T> {\n readonly value: T;\n readonly source: string;\n readonly confidence: 'explicit' | 'detected' | 'defaulted' | 'unknown';\n}\nexport interface TailwindTargetOverrides {\n readonly version?: 4;\n readonly prefix?: string | null;\n readonly breakpoints?: Readonly<Record<string, string | null>>;\n readonly important?: 'normal' | 'important';\n readonly coreUtilities?: 'standard';\n}\nexport interface TailwindTargetProfile {\n readonly target: 'tailwind';\n readonly version: 4;\n readonly prefix: TargetSetting<string | null>;\n readonly breakpoints: Readonly<Record<string, TargetSetting<string>>>;\n readonly important: TargetSetting<'normal' | 'important' | 'unknown'>;\n readonly coreUtilities: TargetSetting<'standard' | 'unknown'>;\n readonly diagnostics: readonly TargetDiagnostic[];\n readonly assumptions: readonly string[];\n readonly fingerprint: string;\n readonly stylesheet?: string;\n}\nexport type TargetOperation =\n | { readonly kind: 'prefix'; readonly value: string | null; readonly source: string }\n | { readonly kind: 'important'; readonly value: 'normal' | 'important'; readonly source: string }\n | { readonly kind: 'breakpoint'; readonly name: string; readonly value: string | null; readonly source: string };\nexport interface StylesheetAnalysis {\n readonly operations: readonly TargetOperation[];\n readonly diagnostics: readonly TargetDiagnostic[];\n readonly imports: readonly string[];\n readonly tailwind: boolean;\n readonly defaultTheme: boolean;\n readonly utilities: boolean;\n readonly source: string;\n}\nconst defaults = { sm: '40rem', md: '48rem', lg: '64rem', xl: '80rem', '2xl': '96rem' };\nexport function validBreakpoint(value: string): boolean {\n return /^(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:px|rem|em)$/.test(value) && Number.parseFloat(value) < 1e7;\n}\nexport function validPrefix(value: string): boolean {\n return /^[a-z]+$/.test(value);\n}\n\n/** Static extraction only. This parser never loads imports, plugins or JS configuration. */\nexport function analyzeTailwindStylesheet(css: string, source = 'pasted stylesheet'): StylesheetAnalysis {\n const operations: TargetOperation[] = [];\n const diagnostics: TargetDiagnostic[] = [];\n const imports: string[] = [];\n let tailwind = false;\n let defaultTheme = false;\n let utilities = false;\n const warn = (code: TargetDiagnosticCode, message: string) =>\n diagnostics.push({ code, message: `${source}: ${message}` });\n if (css.length > 2_000_000) throw new Error('Stylesheet exceeds the 2 MB static analysis limit.');\n const root = postcss.parse(css, { from: undefined });\n root.walkAtRules(rule => {\n if (rule.name === 'custom-variant' || rule.name === 'utility')\n warn('tailwind-target-unknown', `@${rule.name} may change generated utility semantics and is not evaluated.`);\n if (rule.name === 'config' || rule.name === 'plugin') {\n warn(\n rule.name === 'config' ? 'tailwind-config-external' : 'tailwind-plugin-external',\n `@${rule.name} ${rule.params} was not executed; additional configuration is unknown.`,\n );\n }\n if (rule.name === 'source' && /^not\\b/.test(rule.params)) {\n warn('tailwind-source-excluded', `Source exclusion ${rule.params} may exclude migrated templates.`);\n }\n if (rule.name === 'import') {\n const match = /^([\"'])([^\"']+)\\1(.*)$/.exec(rule.params);\n if (!match) {\n warn('tailwind-import-unresolved', `Import ${rule.params} was not loaded.`);\n return;\n }\n const imported = match[2]!;\n const modifiers = match[3]!;\n if (/^tailwindcss(?:\\/(?:theme|utilities|preflight)\\.css)?$/.test(imported)) {\n tailwind = true;\n if (rule.parent?.type !== 'root') {\n warn('tailwind-target-unknown', 'Conditional Tailwind import is unresolved.');\n return;\n }\n let remaining = modifiers.trim();\n let prefix: string | null = null;\n let important = false;\n const seen = new Set<string>();\n while (remaining) {\n const modifier =\n /^(prefix\\(([^)]*)\\)|important|source\\((?:none|\"[^\"]*\"|'[^']*')\\)|layer\\([a-zA-Z0-9_.-]+\\))(?=\\s|$)/.exec(\n remaining,\n );\n if (!modifier) {\n warn('tailwind-target-unknown', `Unsupported Tailwind import modifiers: ${remaining}`);\n break;\n }\n const name = modifier[1]!.split('(')[0]!;\n if (seen.has(name)) warn('tailwind-target-unknown', `Repeated Tailwind import modifier ${name}.`);\n seen.add(name);\n if (name === 'prefix') {\n if (!validPrefix(modifier[2]!)) warn('tailwind-target-unknown', 'Invalid Tailwind v4 prefix.');\n else prefix = modifier[2]!;\n }\n if (name === 'important') important = true;\n if (modifier[1] === 'source(none)')\n warn('tailwind-source-excluded', 'source(none) disables automatic template discovery.');\n remaining = remaining.slice(modifier[0].length).trim();\n }\n if (imported === 'tailwindcss' || imported === 'tailwindcss/theme.css') defaultTheme = true;\n if (imported !== 'tailwindcss/preflight.css') operations.push({ kind: 'prefix', value: prefix, source });\n if (imported === 'tailwindcss' || imported === 'tailwindcss/utilities.css') {\n utilities = true;\n operations.push({ kind: 'important', value: important ? 'important' : 'normal', source });\n }\n } else if (imported.startsWith('./') || imported.startsWith('../')) {\n if (rule.parent?.type !== 'root' || modifiers.trim())\n warn('tailwind-import-unresolved', `Conditional import ${imported} was not loaded.`);\n else imports.push(imported);\n } else warn('tailwind-import-unresolved', `External import ${imported} was not loaded.`);\n }\n if (rule.name !== 'theme') return;\n if (\n rule.parent?.type !== 'root' ||\n (rule.params.trim() && !/^(?:inline|static)(?:\\s+(?:inline|static))*$/.test(rule.params.trim()))\n ) {\n warn('tailwind-target-unknown', 'Conditional or unsupported @theme block was not resolved.');\n return;\n }\n rule.each(node => {\n if (node.type !== 'decl') return;\n if (node.prop === '--*') {\n if (node.value.trim() === 'initial' && !node.important) {\n operations.push({ kind: 'breakpoint', name: '*', value: null, source });\n } else warn('tailwind-target-unknown', 'Cannot resolve global theme reset.');\n return;\n }\n if (!node.prop.startsWith('--breakpoint-')) return;\n const name = node.prop.slice('--breakpoint-'.length);\n const value = node.value.trim();\n if (\n !/^(?:\\*|[a-zA-Z0-9][a-zA-Z0-9_-]*)$/.test(name) ||\n node.important ||\n (value !== 'initial' && (name === '*' || !validBreakpoint(value)))\n ) {\n warn('tailwind-breakpoint-unknown', `Cannot resolve ${node.prop}: ${value}.`);\n if (/^(?:\\*|[a-zA-Z0-9][a-zA-Z0-9_-]*)$/.test(name))\n operations.push({ kind: 'breakpoint', name, value: null, source });\n return;\n }\n operations.push({ kind: 'breakpoint', name, value: value === 'initial' ? null : value, source });\n });\n });\n return { operations, diagnostics, imports, tailwind, defaultTheme, utilities, source };\n}\n\nexport function resolveTailwindTargetProfile(\n input: {\n readonly detected?: StylesheetAnalysis;\n readonly explicit?: TailwindTargetOverrides;\n readonly explicitSource?: string;\n readonly cli?: TailwindTargetOverrides;\n } = {},\n): TailwindTargetProfile {\n let coreUtilities: TailwindTargetProfile['coreUtilities'] = {\n value: 'standard',\n source: input.detected?.source ?? 'default',\n confidence: input.detected ? 'detected' : 'defaulted',\n };\n let prefix: TargetSetting<string | null> = { value: null, source: 'default', confidence: 'defaulted' };\n let important: TailwindTargetProfile['important'] = { value: 'normal', source: 'default', confidence: 'defaulted' };\n let breakpoints: Record<string, TargetSetting<string>> = Object.fromEntries(\n Object.entries(input.detected && !input.detected.defaultTheme ? {} : defaults).map(([name, value]) => [\n name,\n { value, source: 'default', confidence: 'defaulted' },\n ]),\n );\n const diagnostics = [\n ...(input.detected?.diagnostics ?? []),\n ...(input.detected?.imports ?? []).map(imported => ({\n code: 'tailwind-import-unresolved' as const,\n message: `${input.detected!.source}: Local import ${imported} was not loaded in this analysis.`,\n })),\n ];\n function apply(operation: TargetOperation, confidence: TargetSetting<unknown>['confidence']): void {\n const { value, source } = operation;\n if (operation.kind === 'prefix') {\n if (value !== null && !validPrefix(value))\n throw new Error('Tailwind v4 prefix must contain only lowercase letters.');\n if (prefix.confidence !== 'defaulted' && prefix.value !== value)\n diagnostics.push({\n code: 'tailwind-prefix-conflict',\n message: `Using prefix ${String(value)} from ${source}; ${prefix.source} declared ${String(prefix.value)}.`,\n });\n prefix = { value, source, confidence };\n } else if (operation.kind === 'important') important = { value: operation.value, source, confidence };\n else if (operation.name === '*' && value === null) breakpoints = {};\n else if (value === null) delete breakpoints[operation.name];\n else {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(operation.name) || !validBreakpoint(value))\n throw new Error(`Invalid Tailwind breakpoint ${operation.name}: ${value}`);\n breakpoints[operation.name] = { value, source, confidence };\n }\n }\n input.detected?.operations.forEach(operation => apply(operation, 'detected'));\n for (const [overrides, source] of [\n [input.explicit, input.explicitSource ?? 'migration profile'],\n [input.cli, 'CLI'],\n ] as const) {\n if (!overrides) continue;\n if (overrides.version !== undefined && overrides.version !== 4)\n throw new Error('Only Tailwind v4 targets are supported.');\n if (overrides.coreUtilities !== undefined) {\n if (overrides.coreUtilities !== 'standard')\n throw new Error('coreUtilities must be standard when explicitly asserted.');\n coreUtilities = { value: 'standard', source, confidence: 'explicit' };\n }\n if (overrides.prefix !== undefined) apply({ kind: 'prefix', value: overrides.prefix, source }, 'explicit');\n if (overrides.important !== undefined) {\n if (!['normal', 'important'].includes(overrides.important)) throw new Error('Invalid Tailwind important mode.');\n apply({ kind: 'important', value: overrides.important, source }, 'explicit');\n }\n const entries = Object.entries(overrides.breakpoints ?? {}).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0));\n for (const [name, value] of entries)\n apply({ kind: 'breakpoint', name, value: value === 'initial' ? null : value, source }, 'explicit');\n }\n breakpoints = Object.fromEntries(Object.entries(breakpoints).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)));\n if (new Set(Object.values(breakpoints).map(setting => setting.value.match(/[a-z]+$/)![0])).size > 1)\n diagnostics.push({\n code: 'tailwind-mixed-breakpoint-units',\n message: 'Mixed breakpoint units may affect Tailwind variant ordering; units were preserved.',\n });\n if (input.detected && !input.detected.utilities)\n diagnostics.push({\n code: 'tailwind-target-unknown',\n message: 'The supplied stylesheet does not declare Tailwind utility generation.',\n });\n if (input.detected && !input.detected.tailwind)\n diagnostics.push({ code: 'tailwind-target-unknown', message: 'No supported Tailwind v4 import was detected.' });\n if (\n diagnostics.some(item =>\n [\n 'tailwind-config-external',\n 'tailwind-plugin-external',\n 'tailwind-import-unresolved',\n 'tailwind-target-unknown',\n ].includes(item.code),\n )\n ) {\n if (coreUtilities.confidence !== 'explicit')\n coreUtilities = { ...coreUtilities, value: 'unknown', confidence: 'unknown' };\n breakpoints = Object.fromEntries(\n Object.entries(breakpoints).map(([name, setting]) => [\n name,\n setting.confidence === 'explicit' ? setting : { ...setting, confidence: 'unknown' },\n ]),\n );\n if (prefix.confidence !== 'explicit') prefix = { ...prefix, confidence: 'unknown' };\n if (important.confidence !== 'explicit')\n important = { value: 'unknown', source: important.source, confidence: 'unknown' };\n }\n const assumptions = [\n 'Custom application CSS is not globally analyzed.',\n 'Responsive source ranges are preserved, including screen and print conditions.',\n ];\n if (!input.detected && !input.explicit && !input.cli)\n assumptions.push('Target profile uses Tailwind v4 defaults; project configuration was not discovered.');\n if (diagnostics.some(d => d.code === 'tailwind-config-external' || d.code === 'tailwind-plugin-external'))\n assumptions.push('Legacy JavaScript configuration and plugins were not executed.');\n if (coreUtilities.confidence === 'explicit')\n assumptions.push(\n 'The migration profile explicitly asserts standard Tailwind core utility semantics; this assertion was not verified by executing project code.',\n );\n if (important.value === 'important')\n assumptions.push('Generated Tailwind utilities are globally important; existing styles still require review.');\n const canonical = JSON.stringify({\n version: 4,\n prefix: prefix.value,\n important: important.value,\n coreUtilities: coreUtilities.value,\n breakpoints: Object.fromEntries(Object.entries(breakpoints).map(([name, setting]) => [name, setting.value])),\n });\n return deepFreeze({\n target: 'tailwind',\n version: 4,\n prefix,\n important,\n coreUtilities,\n breakpoints,\n diagnostics,\n assumptions,\n fingerprint: `tw4-${sha256(canonical)}`,\n ...(input.detected ? { stylesheet: input.detected.source } : {}),\n });\n}\nfunction deepFreeze<T>(value: T): T {\n if (value && typeof value === 'object') {\n Object.values(value).forEach(deepFreeze);\n Object.freeze(value);\n }\n return value;\n}\n","import type { BreakpointDefinition, MediaClause } from '../breakpoint/breakpoint-catalog';\nexport interface SourceBreakpoint {\n readonly mediaQuery: string;\n readonly priority: number;\n}\nexport type SourceBreakpoints = Readonly<Record<string, SourceBreakpoint>>;\n\n/** Deliberately bounded media grammar matching the semantic range model. */\nexport function sourceBreakpointDefinition(alias: string, input: SourceBreakpoint): BreakpointDefinition {\n if (!/^[a-zA-Z][a-zA-Z0-9_.-]*$/.test(alias) || !Number.isSafeInteger(input.priority))\n throw new Error(`Invalid source breakpoint ${alias}; an integer priority is required.`);\n if (typeof input.mediaQuery !== 'string') throw new Error(`Invalid source media query for ${alias}.`);\n const parts = input.mediaQuery.trim().split(/\\s+and\\s+/);\n if (parts.shift() !== 'screen' || !parts.length)\n throw new Error(`Source breakpoint ${alias} requires screen and explicit px width/orientation conditions.`);\n const range: { min?: number; max?: number; orientation?: 'portrait' | 'landscape' } = {};\n for (const part of parts) {\n const width = /^\\((min|max)-width:\\s*(\\d+(?:\\.\\d+)?)px\\)$/.exec(part);\n const orientation = /^\\(orientation:\\s*(portrait|landscape)\\)$/.exec(part);\n if (width) {\n const key = width[1] as 'min' | 'max';\n if (range[key] !== undefined || !Number.isFinite(Number(width[2])))\n throw new Error(`Duplicate or invalid source condition in ${alias}.`);\n range[key] = Number(width[2]);\n } else if (orientation && range.orientation === undefined)\n range.orientation = orientation[1] as 'portrait' | 'landscape';\n else throw new Error(`Unsupported source media condition in ${alias}: ${part}`);\n }\n if ((range.min ?? 0) > (range.max ?? Infinity)) throw new Error(`Inverted source media range in ${alias}.`);\n const clause: MediaClause = Object.freeze(range);\n return Object.freeze({\n alias,\n priority: input.priority,\n range: clause,\n media: Object.freeze({ type: 'screen', clauses: Object.freeze([clause]) }),\n });\n}\n","import { pathsOverlapOnFileSystem } from '../migrator/migration-path.validator';\nimport { loadMigrationConfig } from '../config/migration-config';\nimport { Command, CommanderError, InvalidArgumentError, Option } from 'commander';\nimport * as path from 'node:path';\nimport packageJson from '../../package.json' with { type: 'json' };\nimport { AdapterFactory } from '../adapter/adapter.factory';\nimport { logger } from '../logger';\nimport { AnalyzeProjectStage } from '../pipeline/analyze/analyze-project.stage';\nimport { ApplyProjectStage } from '../pipeline/apply/apply-project.stage';\nimport { DiscoverProjectStage } from '../pipeline/discover/discover-project.stage';\nimport { MigrationPipeline } from '../pipeline/migration-pipeline';\nimport { MigrationRunner } from '../pipeline/migration-runner';\nimport { migrationInvocation } from '../pipeline/project-manifest';\nimport { RenderProjectStage } from '../pipeline/render/render-project.stage';\nimport { ValidateProjectStage } from '../pipeline/validate/validate-project.stage';\nimport { JsonReportWriter } from '../report/json-report.writer';\nimport { TerminalPresenter, type TextOutput } from '../report/terminal.presenter';\nimport { getErrorMessage } from '../util/error.util';\nimport { resolveExitCode } from './exit-policy';\nimport { validateReportPath } from './report-path.validator';\nimport { parsePrintWithBreakpoints } from '../config/breakpoint-migration-config';\nimport { validateStylesheetPath } from './stylesheet-path.validator';\nimport { resolveMigrationMode } from './migration-mode.parser';\n\ninterface ProgramOptions {\n readonly output?: string;\n readonly config?: string;\n readonly tailwindStylesheet?: string;\n readonly tailwindPrefix?: string;\n readonly target: string;\n readonly write: boolean;\n readonly report?: string;\n readonly stylesheet?: string;\n readonly allowUnresolved: boolean;\n readonly debug: boolean;\n readonly orientationBreakpoints: boolean;\n readonly responsiveImages: boolean;\n readonly printWithBreakpoints?: string;\n}\n\nexport interface CliOutput {\n readonly stdout: TextOutput;\n readonly stderr: TextOutput;\n}\n\nexport interface RunCliDependencies {\n readonly createMigrationRunner?: (pipeline: MigrationPipeline) => Pick<MigrationRunner, 'run'>;\n}\n\nconst processOutput: CliOutput = {\n stdout: process.stdout,\n stderr: process.stderr,\n};\n\nfunction parseSingleStylesheet(value: string, previous: string | undefined): string {\n if (previous !== undefined) throw new InvalidArgumentError('--stylesheet may only be specified once.');\n return value;\n}\n\nexport async function runCli(\n argv: readonly string[],\n output: CliOutput = processOutput,\n dependencies: RunCliDependencies = {},\n): Promise<0 | 1 | 2> {\n let exitCode: 0 | 1 | 2 = 0;\n let debug = false;\n const program = new Command();\n\n program\n .name('flex-layout-codemod')\n .version(packageJson.version)\n .description('Plan Angular Flex-Layout migrations by default; use --write to apply')\n .exitOverride()\n .configureOutput({\n writeOut: text => output.stdout.write(text),\n writeErr: text => output.stderr.write(text),\n })\n .argument('<input>', 'input HTML file or folder')\n .option(\n '-o, --output <path>',\n 'planned output HTML file or folder; single-file output must end in .html; defaults to input',\n )\n .addOption(\n new Option('-t, --target <target>', 'conversion target; css requires --stylesheet')\n .choices(['tailwind', 'css'])\n .default('tailwind'),\n )\n .addOption(\n new Option('--stylesheet <path>', 'companion stylesheet; required when --target css').argParser(\n parseSingleStylesheet,\n ),\n )\n .option('--config <path>', 'declarative migration JSON configuration')\n .option('--tailwind-stylesheet <path>', 'statically analyze a Tailwind v4 target stylesheet')\n .option('--tailwind-prefix <prefix>', 'override Tailwind v4 prefix; empty string means none')\n .option('--plan', 'explicitly request the default review-only plan')\n .option('--write', 'apply the validated migration plan', false)\n .option('--report <path>', 'atomically write a JSON report; path must end in .json')\n .option('--allow-unresolved', 'return success when unresolved inputs remain', false)\n .option('--orientation-breakpoints', 'confirm the source enables the archived orientation breakpoints', false)\n .option(\n '--responsive-images',\n 'wrap eligible responsive images in picture elements; acknowledges selector and layout risk',\n false,\n )\n .option(\n '--print-with-breakpoints <aliases>',\n 'confirm the source printWithBreakpoints list; comma-separated aliases or none',\n )\n .option('-d, --debug', 'enable debug logging', false)\n .action(async (input: string, options: ProgramOptions) => {\n const mode = resolveMigrationMode(argv, options.write);\n debug = options.debug;\n logger.level = debug ? 'debug' : 'warn';\n\n const configuration = await loadMigrationConfig({\n config: options.config,\n stylesheet: options.tailwindStylesheet,\n prefix: options.tailwindPrefix,\n });\n const target =\n program.getOptionValueSource('target') === 'cli' ? options.target : (configuration.target ?? options.target);\n if (target !== 'tailwind' && (options.tailwindStylesheet !== undefined || options.tailwindPrefix !== undefined))\n throw new Error('Tailwind target options require --target tailwind.');\n const destination = options.output ?? input;\n let reportPath: string | undefined;\n if (options.report !== undefined) {\n validateReportPath(options.report);\n reportPath = path.resolve(options.report);\n }\n if (reportPath)\n for (const snapshot of configuration.snapshots) {\n if (await pathsOverlapOnFileSystem(reportPath, snapshot.path))\n throw new Error('Report path collides with a target configuration input.');\n }\n const stylesheetPath = await validateStylesheetPath({\n target,\n stylesheetPath: options.stylesheet,\n inputPath: input,\n outputPath: destination,\n reportPath,\n });\n const printWithBreakpoints =\n options.printWithBreakpoints === undefined\n ? undefined\n : parsePrintWithBreakpoints(options.printWithBreakpoints, options.orientationBreakpoints);\n const session = AdapterFactory.createRenderSession(target, {\n orientationBreakpoints: options.orientationBreakpoints,\n printWithBreakpoints,\n targetProfile: target === 'tailwind' ? configuration.targetProfile : undefined,\n sourceBreakpoints: configuration.sourceBreakpoints,\n });\n const render = new RenderProjectStage(session);\n const pipeline = new MigrationPipeline(\n new DiscoverProjectStage(),\n new AnalyzeProjectStage(),\n render,\n new ValidateProjectStage(),\n new ApplyProjectStage(mode),\n );\n const migrationRunner =\n dependencies.createMigrationRunner === undefined\n ? new MigrationRunner(pipeline)\n : dependencies.createMigrationRunner(pipeline);\n const report = await migrationRunner.run(\n migrationInvocation({\n inputPath: input,\n outputPath: destination,\n options: {\n mode,\n targetProfile: target === 'tailwind' ? configuration.targetProfile : undefined,\n sourceBreakpoints: configuration.sourceBreakpoints,\n configurationSnapshots: configuration.snapshots,\n responsiveImages: options.responsiveImages,\n stylesheetPath,\n stylesheetPathInput: options.stylesheet,\n reportPath,\n },\n }),\n );\n const reportOutput = report.summary.parseErrors > 0 ? output.stderr : output.stdout;\n\n new TerminalPresenter().present(report, reportOutput);\n if (reportPath !== undefined) {\n await new JsonReportWriter().write(reportPath, report, {\n protectedPaths: [\n ...configuration.snapshots.map(snapshot => snapshot.path),\n ...(stylesheetPath === undefined ? [] : [stylesheetPath]),\n ],\n });\n }\n\n exitCode = resolveExitCode(report, options.allowUnresolved);\n });\n\n try {\n resolveMigrationMode(argv, false);\n await program.parseAsync([...argv]);\n return exitCode;\n } catch (error: unknown) {\n if (error instanceof CommanderError) {\n return error.exitCode === 0 ? 0 : 1;\n }\n\n output.stderr.write(`Error: ${getErrorMessage(error)}\\n`);\n if (debug && error instanceof Error && error.stack) {\n output.stderr.write(`${error.stack}\\n`);\n }\n return 1;\n }\n}\n","{\n \"name\": \"@nipe-solutions/flex-layout-codemod\",\n \"version\": \"2.0.0-beta.4\",\n \"description\": \"A safety-first codemod for migrating Angular Flex-Layout templates to native CSS or Tailwind CSS.\",\n \"type\": \"module\",\n \"engines\": {\n \"node\": \">=22.12.0\"\n },\n \"packageManager\": \"npm@11.19.0\",\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\",\n \"CHANGELOG.md\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"scripts\": {\n \"architecture:inventory\": \"node scripts/architecture-inventory.mjs\",\n \"benchmark:architecture\": \"node scripts/benchmark/architecture-benchmark.mjs\",\n \"benchmark:architecture:prepare\": \"npm run build\",\n \"clean\": \"rimraf dist coverage\",\n \"build\": \"tsup\",\n \"build:website\": \"vite build --config vite.website.config.ts && node scripts/generate-website-route-html.mjs\",\n \"generate:website-assets\": \"node scripts/generate-website-assets.mjs\",\n \"dev:website\": \"vite --config vite.website.config.ts\",\n \"typecheck\": \"tsc --noEmit\",\n \"typecheck:website\": \"tsc --noEmit --project website/tsconfig.json\",\n \"start\": \"ts-node ./src/main.ts\",\n \"test\": \"vitest run\",\n \"test:website\": \"vitest run --config vite.website.config.ts\",\n \"test:e2e:website\": \"playwright test --config playwright.website.config.ts\",\n \"test:watch\": \"vitest\",\n \"test:coverage\": \"vitest run --coverage\",\n \"lint\": \"eslint .\",\n \"lint:fix\": \"eslint . --fix\",\n \"format\": \"prettier --check .\",\n \"format:write\": \"prettier --write .\",\n \"verify\": \"npm run format && npm run lint && npm run typecheck && npm run test:coverage && npm run build && npm run package:check\",\n \"verify:website\": \"npm run format && npm run lint && npm run test:website && npm run typecheck:website && npm run verify:website-assets && npm run verify:docs && npm run build:website && npm run verify:website-static && npm run test:e2e:website\",\n \"verify:docs\": \"node scripts/verify-documentation-contract.mjs\",\n \"verify:website-static\": \"node scripts/verify-website-static.mjs\",\n \"package:check\": \"node scripts/verify-package.mjs\",\n \"changeset\": \"changeset add\",\n \"version-packages\": \"changeset version\",\n \"release:prepare\": \"node scripts/release-artifact.mjs\",\n \"release:verify\": \"node scripts/release-artifact.mjs --verify-retained\",\n \"verify:website-assets\": \"node scripts/verify-website-assets.mjs\",\n \"release:version\": \"changeset version && npm install --package-lock-only --ignore-scripts --no-audit --no-fund\",\n \"prepare\": \"husky\",\n \"check\": \"npm run verify && npm run verify:website\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/NIPE-Solutions/flex-layout-migrator.git\"\n },\n \"keywords\": [\n \"angular\",\n \"codemod\",\n \"documentation\",\n \"flex-layout\",\n \"migration\",\n \"tailwindcss\"\n ],\n \"author\": \"Nicholas Petrasek\",\n \"license\": \"MIT\",\n \"bugs\": {\n \"url\": \"https://github.com/NIPE-Solutions/flex-layout-migrator/issues\"\n },\n \"homepage\": \"https://angular-flex-layout-codemod.nipesolutions.com\",\n \"dependencies\": {\n \"@angular/compiler\": \"21.2.22\",\n \"commander\": \"^15.0.0\",\n \"fs-extra\": \"^11.4.0\",\n \"ignore\": \"5.2.4\",\n \"postcss\": \"^8.5.26\",\n \"winston\": \"^3.19.0\"\n },\n \"bin\": {\n \"flex-layout-codemod\": \"./dist/cli.js\"\n },\n \"devDependencies\": {\n \"@axe-core/playwright\": \"^4.13.0\",\n \"@changesets/cli\": \"^3.0.1\",\n \"@eslint/js\": \"^10.0.1\",\n \"@playwright/test\": \"^1.63.0\",\n \"@tailwindcss/cli\": \"4.3.3\",\n \"@testing-library/jest-dom\": \"^7.0.1\",\n \"@testing-library/react\": \"^16.3.3\",\n \"@types/fs-extra\": \"^11.0.4\",\n \"@types/mock-fs\": \"^4.13.4\",\n \"@types/node\": \"^26.4.0\",\n \"@types/react\": \"^19.2.18\",\n \"@types/react-dom\": \"^19.2.7\",\n \"@vitejs/plugin-react\": \"^6.1.1\",\n \"@vitest/coverage-v8\": \"^4.1.11\",\n \"axe-core\": \"^4.13.0\",\n \"eslint\": \"^10.9.1\",\n \"eslint-config-prettier\": \"^10.1.8\",\n \"husky\": \"^9.1.7\",\n \"jsdom\": \"^30.0.1\",\n \"lint-staged\": \"^17.4.1\",\n \"mock-fs\": \"^5.5.0\",\n \"prettier\": \"^3.9.6\",\n \"react\": \"^19.2.8\",\n \"react-dom\": \"^19.2.8\",\n \"rimraf\": \"^6.1.3\",\n \"tailwindcss\": \"4.3.3\",\n \"tsup\": \"^8.5.1\",\n \"typescript\": \"^6.0.3\",\n \"typescript-eslint\": \"^8.68.0\",\n \"vite\": \"^8.2.2\",\n \"vitest\": \"^4.1.11\",\n \"yaml\": \"^2.9.0\"\n },\n \"husky\": {\n \"hooks\": {\n \"pre-commit\": \"lint-staged\"\n }\n },\n \"lint-staged\": {\n \"*.{js,mjs,ts}\": [\n \"eslint --fix\",\n \"prettier --write\"\n ],\n \"*.{json,md,yml,yaml}\": [\n \"prettier --write\"\n ]\n }\n}\n","import { createLogger, format, transports } from 'winston';\n\nconst { combine, timestamp, printf, colorize, splat } = format;\n\nconst myFormat = printf(({ timestamp, level, message, label, lineNumber }) => {\n const timestampValue =\n typeof timestamp === 'string' || typeof timestamp === 'number' || timestamp instanceof Date\n ? timestamp\n : Date.now();\n const formattedTimestamp = new Date(timestampValue)\n .toISOString()\n .replace('T', ' ')\n .replace(/\\.\\d{3}Z$/, 'Z');\n const fileLineInfo = label && lineNumber ? `(${label}:${lineNumber})` : '';\n return `[${formattedTimestamp}] ${level}: ${message} ${fileLineInfo}`;\n});\n\nexport const logger = createLogger({\n level: 'info',\n format: combine(splat(), colorize(), timestamp(), myFormat),\n transports: [new transports.Console()],\n});\n","export const FLEX_LAYOUT_DIRECTIVES = [\n 'fxLayout',\n 'fxLayoutAlign',\n 'fxLayoutGap',\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexAlign',\n 'fxFlexFill',\n 'fxFill',\n 'fxFlexOffset',\n 'fxFlexOrder',\n 'fxShow',\n 'fxHide',\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdArea',\n 'gdAreas',\n 'gdAuto',\n 'gdColumn',\n 'gdColumns',\n 'gdGap',\n 'gdGridAlign',\n 'gdInline',\n 'gdRow',\n 'gdRows',\n 'class',\n 'ngClass',\n 'style',\n 'ngStyle',\n 'imgSrc',\n] as const;\n\nexport type FlexLayoutDirective = (typeof FLEX_LAYOUT_DIRECTIVES)[number];\n\nexport const DEFAULT_BREAKPOINTS = [\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n 'lt-sm',\n 'lt-md',\n 'lt-lg',\n 'lt-xl',\n 'gt-xs',\n 'gt-sm',\n 'gt-md',\n 'gt-lg',\n] as const;\n\nexport type DefaultBreakpoint = (typeof DEFAULT_BREAKPOINTS)[number];\n\nexport const ORIENTATION_BREAKPOINTS = [\n 'handset',\n 'handset.portrait',\n 'handset.landscape',\n 'tablet',\n 'tablet.portrait',\n 'tablet.landscape',\n 'web',\n 'web.portrait',\n 'web.landscape',\n] as const;\n\nexport const SPECIAL_BREAKPOINTS = ['print'] as const;\n\nexport type KnownBreakpoint =\n DefaultBreakpoint | (typeof ORIENTATION_BREAKPOINTS)[number] | (typeof SPECIAL_BREAKPOINTS)[number];\n\nconst directiveNames = new Set<string>(FLEX_LAYOUT_DIRECTIVES);\nconst breakpointNames = new Set<string>([...DEFAULT_BREAKPOINTS, ...ORIENTATION_BREAKPOINTS, ...SPECIAL_BREAKPOINTS]);\n\nexport function isFlexLayoutDirective(value: string): value is FlexLayoutDirective {\n return directiveNames.has(value);\n}\n\nexport function isKnownBreakpoint(value: string): value is KnownBreakpoint {\n return breakpointNames.has(value);\n}\n","export class CssInvariantError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'CssInvariantError';\n }\n}\n","export function compareCodeUnits(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n","import type { OwnedCssRule } from './css-artifact.model';\nimport { compareCodeUnits } from '../../util/compare-code-units';\n\nexport function compareOwnedCssRules(left: OwnedCssRule, right: OwnedCssRule): number {\n const baseOrder = Number(left.context.media !== undefined) - Number(right.context.media !== undefined);\n if (baseOrder !== 0) return baseOrder;\n const priorityOrder = right.context.priority - left.context.priority;\n return priorityOrder || compareCodeUnits(left.id, right.id);\n}\n","import type { MediaDefinition } from '../../breakpoint/breakpoint-catalog';\nimport { sha256 } from '../../util/sha-256';\nimport { CssInvariantError } from './css-invariant.error';\nimport type { CssDeclaration, CssDigest, CssRuleContext, CssSemanticFamily, OwnedCssRule } from './css-artifact.model';\nimport { compareOwnedCssRules } from './css-rule-order';\n\nconst SHA_256_DIGEST = /^[a-f0-9]{64}$/;\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n const properties = new Set<string>();\n\n for (const declaration of declarations) {\n if (properties.has(declaration.property)) {\n throw new CssInvariantError(`Duplicate CSS declaration property: ${declaration.property}`);\n }\n properties.add(declaration.property);\n }\n\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nfunction assertFiniteMediaBounds(media: MediaDefinition): void {\n for (const clause of media.clauses) {\n for (const bound of [clause.min, clause.max]) {\n if (bound !== undefined && !Number.isFinite(bound)) {\n throw new CssInvariantError('CSS media bounds must be finite numbers');\n }\n }\n\n if (clause.min !== undefined && clause.max !== undefined && clause.min > clause.max) {\n throw new CssInvariantError('CSS media minimum bound must not exceed its maximum bound');\n }\n }\n}\n\nfunction freezeMedia(media: MediaDefinition): MediaDefinition {\n assertFiniteMediaBounds(media);\n return Object.freeze({\n type: media.type,\n clauses: Object.freeze(media.clauses.map(clause => Object.freeze({ ...clause }))),\n });\n}\n\nfunction freezeContext(context: CssRuleContext): CssRuleContext {\n if (!Number.isFinite(context.priority)) {\n throw new CssInvariantError('CSS rule priority must be a finite number');\n }\n\n if (context.media === undefined) {\n if (context.priority !== 0) {\n throw new CssInvariantError('CSS base rules must have priority 0');\n }\n return Object.freeze({ priority: context.priority });\n }\n\n return Object.freeze({ priority: context.priority, media: freezeMedia(context.media) });\n}\n\nfunction canonicalIdentity(\n family: CssSemanticFamily,\n declarations: readonly CssDeclaration[],\n context: CssRuleContext,\n): string {\n return JSON.stringify({\n schema: 1,\n family,\n declarations: declarations.map(({ property, value }) => [property, value]),\n media: context.media\n ? {\n type: context.media.type,\n clauses: context.media.clauses.map(({ min, max, orientation }) => [\n min ?? null,\n max ?? null,\n orientation ?? null,\n ]),\n }\n : null,\n priority: context.priority,\n });\n}\n\nexport class CssArtifactRegistry {\n private readonly rulesByCanonicalIdentity = new Map<string, OwnedCssRule>();\n private readonly canonicalIdentityByDigest = new Map<string, string>();\n private readonly registeredRules: OwnedCssRule[] = [];\n\n constructor(private readonly digest: CssDigest = sha256) {}\n\n register(\n family: CssSemanticFamily,\n declarations: readonly CssDeclaration[],\n context: CssRuleContext = { priority: 0 },\n ): OwnedCssRule {\n const frozenDeclarations = freezeDeclarations(declarations);\n const frozenContext = freezeContext(context);\n const identity = canonicalIdentity(family, frozenDeclarations, frozenContext);\n const existingRule = this.rulesByCanonicalIdentity.get(identity);\n\n if (existingRule) return existingRule;\n\n const id = this.digest(identity);\n if (!SHA_256_DIGEST.test(id)) {\n throw new CssInvariantError('CSS artifact digest must be a 64-character lowercase hexadecimal SHA-256 value');\n }\n\n const collidingIdentity = this.canonicalIdentityByDigest.get(id);\n if (collidingIdentity !== undefined && collidingIdentity !== identity) {\n throw new CssInvariantError('Distinct CSS artifact identities must not share a digest');\n }\n\n const rule: OwnedCssRule = Object.freeze({\n owner: 'flex-layout-codemod',\n id,\n className: `flm-${id}`,\n family,\n declarations: frozenDeclarations,\n context: frozenContext,\n });\n\n this.rulesByCanonicalIdentity.set(identity, rule);\n this.canonicalIdentityByDigest.set(id, identity);\n this.registeredRules.push(rule);\n return rule;\n }\n\n rules(): readonly OwnedCssRule[] {\n return Object.freeze([...this.registeredRules].sort(compareOwnedCssRules));\n }\n\n rulesReferencedBy(classNames: ReadonlySet<string>): readonly OwnedCssRule[] {\n return Object.freeze(\n this.registeredRules.filter(rule => classNames.has(rule.className)).sort(compareOwnedCssRules),\n );\n }\n}\n","import type { BreakpointDefinition, MediaDefinition } from '../../breakpoint/breakpoint-catalog';\nimport type { CssRuleContext } from './css-artifact.model';\n\nfunction copyMedia(media: MediaDefinition): MediaDefinition {\n return Object.freeze({\n type: media.type,\n clauses: Object.freeze(media.clauses.map(clause => Object.freeze({ ...clause }))),\n });\n}\n\nexport function cssRuleContext(definition?: BreakpointDefinition): CssRuleContext {\n if (definition === undefined) {\n return Object.freeze({ priority: 0 });\n }\n\n return Object.freeze({ priority: definition.priority, media: copyMedia(definition.media) });\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexAlignSemantics, FlexSelfAlignment } from '../../../flex/flex-align.semantic';\n\nconst alignmentValues: Readonly<Record<FlexSelfAlignment, CssDeclaration['value']>> = {\n auto: 'auto',\n start: 'flex-start',\n end: 'flex-end',\n center: 'center',\n baseline: 'baseline',\n stretch: 'stretch',\n};\n\nexport function renderFlexAlignCss(value: FlexAlignSemantics): readonly CssDeclaration[] {\n return Object.freeze([Object.freeze({ property: 'align-self', value: alignmentValues[value.alignment] })]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexFillSemantics } from '../../../flex/flex-fill.semantic';\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderFlexFillCss(value: FlexFillSemantics): readonly CssDeclaration[] {\n return freezeDeclarations([\n { property: 'margin', value: value.margin },\n { property: 'width', value: value.width },\n { property: 'height', value: value.height },\n { property: 'min-width', value: value.minWidth },\n { property: 'min-height', value: value.minHeight },\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexItemSemantics } from '../../../flex/flex-item.semantic';\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderFlexItemCss(value: FlexItemSemantics): readonly CssDeclaration[] {\n const flexDeclarations =\n value.basis.kind === 'computed'\n ? [\n { property: 'flex-grow', value: value.grow },\n { property: 'flex-shrink', value: value.shrink },\n { property: 'flex-basis', value: value.basis.value },\n ]\n : [{ property: 'flex', value: `${value.grow} ${value.shrink} ${value.basis.value}` }];\n\n return freezeDeclarations([\n ...flexDeclarations,\n ...(value.min ? [{ property: `min-${value.axis}`, value: value.min }] : []),\n ...(value.max ? [{ property: `max-${value.axis}`, value: value.max }] : []),\n { property: 'box-sizing', value: value.boxSizing },\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexOffsetSemantics } from '../../../flex/flex-offset.semantic';\n\nconst propertyByAxis: Readonly<Record<FlexOffsetSemantics['axis'], CssDeclaration['property']>> = {\n 'inline-start': 'margin-inline-start',\n 'block-start': 'margin-block-start',\n};\n\nexport function renderFlexOffsetCss(value: FlexOffsetSemantics): readonly CssDeclaration[] {\n return Object.freeze([Object.freeze({ property: propertyByAxis[value.axis], value: value.length })]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { FlexOrderSemantics } from '../../../flex/flex-order.semantic';\n\nconst noDeclarations: readonly CssDeclaration[] = Object.freeze([]);\n\nexport function renderFlexOrderCss(value: FlexOrderSemantics): readonly CssDeclaration[] {\n return value.order === undefined\n ? noDeclarations\n : Object.freeze([Object.freeze({ property: 'order', value: String(value.order) })]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { LayoutDirection, LayoutSemantics, LayoutWrap } from '../../../flex/layout.semantic';\n\nconst displayValues: Readonly<Record<LayoutSemantics['display'], CssDeclaration['value']>> = {\n flex: 'flex',\n 'inline-flex': 'inline-flex',\n};\n\nconst directionValues: Readonly<Record<LayoutDirection, CssDeclaration['value']>> = {\n row: 'row',\n 'row-reverse': 'row-reverse',\n column: 'column',\n 'column-reverse': 'column-reverse',\n};\n\nconst wrapValues: Readonly<Record<LayoutWrap, CssDeclaration['value']>> = {\n nowrap: 'nowrap',\n wrap: 'wrap',\n 'wrap-reverse': 'wrap-reverse',\n};\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderLayoutCss(value: LayoutSemantics): readonly CssDeclaration[] {\n return freezeDeclarations([\n { property: 'display', value: displayValues[value.display] },\n { property: 'box-sizing', value: value.boxSizing },\n { property: 'flex-direction', value: directionValues[value.direction] },\n ...(value.explicitWrap ? [{ property: 'flex-wrap', value: wrapValues[value.wrap] }] : []),\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type {\n LayoutContentAlignment,\n LayoutItemsAlignment,\n LayoutMainAlignment,\n LayoutAlignmentSemantics,\n} from '../../../flex/layout-align.semantic';\nimport { renderLayoutCss } from './layout.css-renderer';\n\nconst mainAlignmentValues: Readonly<Record<LayoutMainAlignment, CssDeclaration['value']>> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n 'space-around': 'space-around',\n 'space-between': 'space-between',\n 'space-evenly': 'space-evenly',\n};\n\nconst itemsAlignmentValues: Readonly<Record<LayoutItemsAlignment, CssDeclaration['value']>> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n baseline: 'baseline',\n stretch: 'stretch',\n};\n\nconst contentAlignmentValues: Readonly<Record<LayoutContentAlignment, CssDeclaration['value']>> = {\n start: 'flex-start',\n center: 'center',\n end: 'flex-end',\n stretch: 'stretch',\n 'space-around': 'space-around',\n 'space-between': 'space-between',\n};\n\nconst stretchMaximumProperties: Readonly<Record<NonNullable<LayoutAlignmentSemantics['stretchMaximum']>, string>> = {\n width: 'max-width',\n height: 'max-height',\n};\n\nfunction freezeDeclarations(declarations: readonly CssDeclaration[]): readonly CssDeclaration[] {\n return Object.freeze(declarations.map(declaration => Object.freeze({ ...declaration })));\n}\n\nexport function renderLayoutAlignmentCss(value: LayoutAlignmentSemantics): readonly CssDeclaration[] {\n return freezeDeclarations([\n { property: 'justify-content', value: mainAlignmentValues[value.main] },\n { property: 'align-items', value: itemsAlignmentValues[value.items] },\n { property: 'align-content', value: contentAlignmentValues[value.content] },\n ...renderLayoutCss(value.layout),\n ...(value.stretchMaximum === undefined\n ? []\n : [{ property: stretchMaximumProperties[value.stretchMaximum], value: '100%' }]),\n ]);\n}\n","import type { CssDeclaration } from '../css-artifact.model';\nimport type { LayoutGapSemantics } from '../../../flex/layout-gap.semantic';\n\nexport function renderLayoutGapCss(value: LayoutGapSemantics): readonly CssDeclaration[] {\n return Object.freeze([Object.freeze({ property: 'gap', value: value.length })]);\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport { DEFAULT_BREAKPOINTS } from '../../analyzer/flex-layout.catalog';\nimport type { BreakpointMigrationConfig } from '../../config/breakpoint-migration-config';\nimport type { FlexAlignSemantics } from '../../flex/flex-align.semantic';\nimport type { FlexFillSemantics } from '../../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../../flex/flex-offset.semantic';\nimport type { FlexOrderSemantics } from '../../flex/flex-order.semantic';\nimport type { LayoutAlignmentSemantics } from '../../flex/layout-align.semantic';\nimport type { LayoutGapSemantics } from '../../flex/layout-gap.semantic';\nimport type { LayoutSemantics } from '../../flex/layout.semantic';\nimport type { CssDeclaration, CssSemanticFamily, OwnedCssRule } from '../../adapter/css/css-artifact.model';\nimport { CssArtifactRegistry } from '../../adapter/css/css-artifact.registry';\nimport { cssRuleContext } from '../../adapter/css/css-breakpoint.context';\nimport { CssInvariantError } from '../../adapter/css/css-invariant.error';\nimport { renderFlexAlignCss } from '../../adapter/css/flex/flex-align.css-renderer';\nimport { renderFlexFillCss } from '../../adapter/css/flex/flex-fill.css-renderer';\nimport { renderFlexItemCss } from '../../adapter/css/flex/flex-item.css-renderer';\nimport { renderFlexOffsetCss } from '../../adapter/css/flex/flex-offset.css-renderer';\nimport { renderFlexOrderCss } from '../../adapter/css/flex/flex-order.css-renderer';\nimport { renderLayoutAlignmentCss } from '../../adapter/css/flex/layout-align.css-renderer';\nimport { renderLayoutGapCss } from '../../adapter/css/flex/layout-gap.css-renderer';\nimport { renderLayoutCss } from '../../adapter/css/flex/layout.css-renderer';\nimport type { SemanticConversionContext } from '../../semantic/conversion-context';\nimport type { ResolvedSemanticPlan } from '../../semantic/semantic-plan';\nimport type { ConversionRenderer, PlannedConversion } from '../conversion-renderer';\n\nconst supportedFamilies = new Set<CssSemanticFamily>([\n 'layout',\n 'layout-gap',\n 'layout-align',\n 'flex-item',\n 'flex-align',\n 'flex-fill',\n 'flex-offset',\n 'flex-order',\n]);\nconst supportedBreakpoints = new Set<string>(DEFAULT_BREAKPOINTS);\n\nfunction targetUnsupported(input: LocatedFlexLayoutInput): PlannedConversion {\n return {\n status: 'unsupported',\n input,\n code: 'target-unsupported',\n reason: `The CSS target does not support ${input.sourceName}.`,\n suggestion: 'Use the Tailwind target when it supports this input, or migrate the directive manually.',\n };\n}\n\nexport class CssRenderer implements ConversionRenderer {\n readonly target = 'css' as const;\n readonly breakpointConfig: BreakpointMigrationConfig;\n private readonly referencedClassNamesByInputId = new Map<string, readonly string[]>();\n\n constructor(\n readonly registry: CssArtifactRegistry = new CssArtifactRegistry(),\n config: BreakpointMigrationConfig = { orientationBreakpoints: false },\n ) {\n this.breakpointConfig = Object.freeze({ ...config });\n }\n\n eligibility(input: LocatedFlexLayoutInput): PlannedConversion | undefined {\n const family = this.cssFamily(input);\n if (family === undefined) return targetUnsupported(input);\n if (\n input.breakpoint !== undefined &&\n !supportedBreakpoints.has(input.breakpoint) &&\n !Object.hasOwn(this.breakpointConfig.sourceBreakpoints ?? {}, input.breakpoint)\n )\n return targetUnsupported(input);\n return undefined;\n }\n\n render(plan: ResolvedSemanticPlan, _context: SemanticConversionContext): PlannedConversion {\n const family = this.cssFamily(plan.input);\n if (family === undefined || family !== plan.family) {\n throw new CssInvariantError(`CSS emission received an unsupported directive: ${plan.input.directive}`);\n }\n if (plan.activations.length !== 1) {\n throw new CssInvariantError('CSS emission requires exactly one resolved activation');\n }\n\n const declarations = this.declarations(plan);\n if (declarations.length === 0) return { status: 'converted', input: plan.input, classNames: [] };\n const planActivation = plan.activations[0];\n const rule = this.registry.register(\n family,\n declarations,\n planActivation?.kind === 'media' ? cssRuleContext(planActivation.definition) : { priority: 0 },\n );\n return { status: 'converted', input: plan.input, classNames: [rule.className] };\n }\n\n resolveConflicts(\n plans: readonly PlannedConversion[],\n _context: SemanticConversionContext,\n ): readonly PlannedConversion[] {\n return plans;\n }\n\n record(plans: readonly PlannedConversion[]): void {\n for (const plan of plans) {\n this.referencedClassNamesByInputId.set(plan.input.id, plan.status === 'converted' ? plan.classNames : []);\n }\n }\n\n referencedClassNames(): ReadonlySet<string> {\n return new Set([...this.referencedClassNamesByInputId.values()].flatMap(classNames => [...classNames]));\n }\n\n finalizedRules(): readonly OwnedCssRule[] {\n return this.registry.rulesReferencedBy(this.referencedClassNames());\n }\n\n private cssFamily(input: LocatedFlexLayoutInput): CssSemanticFamily | undefined {\n const family =\n input.directive === 'fxLayout'\n ? 'layout'\n : input.directive === 'fxLayoutGap'\n ? 'layout-gap'\n : input.directive === 'fxLayoutAlign'\n ? 'layout-align'\n : input.directive === 'fxFlex' || input.directive === 'fxGrow' || input.directive === 'fxShrink'\n ? 'flex-item'\n : input.directive === 'fxFlexAlign'\n ? 'flex-align'\n : input.directive === 'fxFlexFill' || input.directive === 'fxFill'\n ? 'flex-fill'\n : input.directive === 'fxFlexOffset'\n ? 'flex-offset'\n : input.directive === 'fxFlexOrder'\n ? 'flex-order'\n : undefined;\n return family !== undefined && supportedFamilies.has(family) ? family : undefined;\n }\n\n private declarations(plan: ResolvedSemanticPlan): readonly CssDeclaration[] {\n switch (plan.family) {\n case 'layout':\n return renderLayoutCss(plan.value as LayoutSemantics);\n case 'layout-gap':\n return renderLayoutGapCss(plan.value as LayoutGapSemantics);\n case 'layout-align':\n return renderLayoutAlignmentCss(plan.value as LayoutAlignmentSemantics);\n case 'flex-item':\n return renderFlexItemCss(plan.value as FlexItemSemantics);\n case 'flex-align':\n return renderFlexAlignCss(plan.value as FlexAlignSemantics);\n case 'flex-fill':\n return renderFlexFillCss(plan.value as FlexFillSemantics);\n case 'flex-offset':\n return renderFlexOffsetCss(plan.value as FlexOffsetSemantics);\n case 'flex-order':\n return renderFlexOrderCss(plan.value as FlexOrderSemantics);\n default:\n throw new CssInvariantError(`CSS emission received an unsupported semantic family: ${plan.family}`);\n }\n }\n}\n","// Core variant roots from the pinned Tailwind 4.3.3 compiler. Compiler tests guard this list.\nexport const tailwindBuiltinVariants: readonly string[] = Object.freeze([\n '*',\n '**',\n '@',\n '@max',\n '@min',\n 'active',\n 'after',\n 'any-pointer-coarse',\n 'any-pointer-fine',\n 'any-pointer-none',\n 'aria',\n 'autofill',\n 'backdrop',\n 'before',\n 'checked',\n 'contrast-less',\n 'contrast-more',\n 'dark',\n 'data',\n 'default',\n 'details-content',\n 'disabled',\n 'empty',\n 'enabled',\n 'even',\n 'file',\n 'first',\n 'first-letter',\n 'first-line',\n 'first-of-type',\n 'focus',\n 'focus-visible',\n 'focus-within',\n 'forced-colors',\n 'group',\n 'has',\n 'hover',\n 'in',\n 'in-range',\n 'indeterminate',\n 'inert',\n 'invalid',\n 'inverted-colors',\n 'landscape',\n 'last',\n 'last-of-type',\n 'ltr',\n 'marker',\n 'max',\n 'min',\n 'motion-reduce',\n 'motion-safe',\n 'noscript',\n 'not',\n 'nth',\n 'nth-last',\n 'nth-last-of-type',\n 'nth-of-type',\n 'odd',\n 'only',\n 'only-of-type',\n 'open',\n 'optional',\n 'out-of-range',\n 'peer',\n 'placeholder',\n 'placeholder-shown',\n 'pointer-coarse',\n 'pointer-fine',\n 'pointer-none',\n 'portrait',\n 'print',\n 'read-only',\n 'required',\n 'rtl',\n 'selection',\n 'starting',\n 'supports',\n 'target',\n 'user-invalid',\n 'user-valid',\n 'valid',\n 'visited',\n]);\n","import { tailwindBuiltinVariants } from './tailwind-builtin-variants';\nimport type { TailwindTargetProfile } from './tailwind-target-profile';\n\n/** Only min-only px ranges can be named without a unit conversion or exclusive-bound change. */\nexport function renderTargetCandidate(candidate: string, profile: TailwindTargetProfile): string {\n const match = /^\\[@media_screen_and_\\(min-width:_(\\d+(?:\\.\\d+)?)px\\)\\]:(.+)$/.exec(candidate);\n if (match) {\n const exact = Object.entries(profile.breakpoints).find(\n ([name, setting]) =>\n setting.confidence !== 'unknown' && setting.value === `${match[1]}px` && isNamedBreakpoint(name),\n );\n // Tailwind named variants apply to all media; retain the source's screen restriction.\n if (exact) candidate = `[@media_screen]:${exact[0]}:${match[2]}`;\n }\n return profile.prefix.value ? `${profile.prefix.value}:${candidate}` : candidate;\n}\nexport function normalizeTargetCandidate(candidate: string, profile: TailwindTargetProfile): string {\n const prefix = profile.prefix.value;\n if (prefix && candidate.startsWith(`${prefix}:`)) candidate = candidate.slice(prefix.length + 1);\n const match = /^\\[@media_screen\\]:([^:]+):(.+)$/.exec(candidate);\n if (match) {\n const setting = profile.breakpoints[match[1]!];\n const width = setting?.value;\n if (setting?.confidence !== 'unknown' && isNamedBreakpoint(match[1]!) && width?.endsWith('px'))\n return `[@media_screen_and_(min-width:_${width})]:${match[2]}`;\n }\n return candidate;\n}\n\nfunction isNamedBreakpoint(name: string): boolean {\n return !tailwindBuiltinVariants.some(root => name === root || name.startsWith(`${root}-`));\n}\n","import type { TemplateAttribute, TemplateElement } from '../template/template.model';\nimport type { SourceEdit } from './source-edit';\n\nconst htmlSourceWhitespace = /[\\t\\n\\f\\r ]/u;\nconst htmlReferencePrefix = /&(?:#|[a-z\\d])/iu;\n\n/**\n * Tailwind scans template bytes without first decoding HTML. A generated class\n * token is therefore safe only when the same bytes survive Angular's HTML\n * parsing and can be placed in both quote styles without entity escaping.\n */\nexport function isByteExactHtmlClassToken(token: string): boolean {\n return (\n token.length > 0 &&\n ![...token].some(character => htmlSourceWhitespace.test(character)) &&\n !/[\"'<]/u.test(token) &&\n !htmlReferencePrefix.test(token)\n );\n}\n\nfunction isDoubleQuotedHtmlClassToken(token: string): boolean {\n return (\n token.length > 0 &&\n ![...token].some(character => htmlSourceWhitespace.test(character)) &&\n !/[\"<]/u.test(token) &&\n !htmlReferencePrefix.test(token)\n );\n}\n\nfunction appendedRawValue(rawValue: string, missingClassNames: readonly string[]): string {\n const separator = rawValue.length > 0 && !htmlSourceWhitespace.test(rawValue.at(-1) ?? '') ? ' ' : '';\n return `${rawValue}${separator}${missingClassNames.join(' ')}`;\n}\n\nexport function appendLiteralClassNames(\n source: string,\n element: TemplateElement,\n classAttribute: TemplateAttribute | undefined,\n generatedClassNames: readonly string[],\n inputId: string,\n): SourceEdit | undefined {\n const uniqueGenerated = [...new Set(generatedClassNames)];\n // Deduplicate only against byte-identical source candidates. An entity-decoded\n // equivalent has the same Angular token but remains invisible to Tailwind's\n // raw source scanner, so the generated spelling must still be appended.\n const existingRawClassNames = classAttribute?.rawValue.split(/[\\t\\n\\f\\r ]+/u).filter(Boolean) ?? [];\n const missingClassNames = uniqueGenerated.filter(className => !existingRawClassNames.includes(className));\n if (missingClassNames.length === 0) return undefined;\n\n if (!missingClassNames.every(isDoubleQuotedHtmlClassToken)) {\n throw new Error('Generated class names must be byte-exact HTML source tokens before editing.');\n }\n\n if (classAttribute !== undefined) {\n if (classAttribute.valueSource === undefined) {\n return {\n range: classAttribute.source,\n text: `${classAttribute.rawName}=\"${missingClassNames.join(' ')}\"`,\n inputId,\n };\n }\n\n const value = appendedRawValue(classAttribute.rawValue, missingClassNames);\n const delimiter = source[classAttribute.valueSource.start - 1];\n if (delimiter === '\"') {\n return { range: classAttribute.valueSource, text: value, inputId };\n }\n if (delimiter === \"'\" && missingClassNames.every(isByteExactHtmlClassToken)) {\n return { range: classAttribute.valueSource, text: value, inputId };\n }\n if (delimiter === \"'\" && !classAttribute.rawValue.includes('\"')) {\n return {\n range: classAttribute.source,\n text: `${classAttribute.rawName}=\"${value}\"`,\n inputId,\n };\n }\n\n return {\n range: classAttribute.source,\n text: `${classAttribute.rawName}=\"${value}\"`,\n inputId,\n };\n }\n\n const startTag = source.slice(element.startTag.start, element.startTag.end);\n const selfClosing = startTag.endsWith('/>');\n const insertionOffset = element.startTag.end - (selfClosing ? 2 : 1);\n const hasClosingWhitespace = htmlSourceWhitespace.test(source[insertionOffset - 1] ?? '');\n const classAttributeText = `class=\"${missingClassNames.join(' ')}\"`;\n return {\n range: { start: insertionOffset, end: insertionOffset },\n text: selfClosing && hasClosingWhitespace ? `${classAttributeText} ` : ` ${classAttributeText}`,\n inputId,\n };\n}\n","import type { LiteralStyleDeclaration } from '../../../semantic/literal-style-declaration';\nimport { isByteExactHtmlClassToken } from '../../../edit/html-attribute-value';\n\nconst ordinaryProperty = /^-?[a-z][a-z\\d-]*$/iu;\nconst customProperty = /^--[a-z\\d_-]+$/iu;\n\nfunction containsControl(value: string): boolean {\n return [...value].some(character => {\n const codePoint = character.codePointAt(0);\n return codePoint !== undefined && (codePoint < 0x20 || codePoint === 0x7f);\n });\n}\n\nfunction isEncodable(declaration: LiteralStyleDeclaration): boolean {\n const propertyIsValid = ordinaryProperty.test(declaration.property) || customProperty.test(declaration.property);\n return (\n propertyIsValid &&\n declaration.value.length > 0 &&\n !containsControl(declaration.value) &&\n !/[\\\\[\\]{}]/u.test(declaration.value)\n );\n}\n\nexport class TailwindArbitraryPropertyEncoder {\n encode(declaration: LiteralStyleDeclaration): string {\n if (!isEncodable(declaration)) {\n throw new Error('The style declaration cannot be encoded as an exact Tailwind arbitrary property.');\n }\n\n const value = declaration.value.replaceAll('_', '\\\\_').replaceAll(' ', '_');\n const candidate = `[${declaration.property}:${value}]`;\n if (!isByteExactHtmlClassToken(candidate)) {\n throw new Error('The style declaration cannot be encoded as a byte-exact HTML source candidate.');\n }\n return candidate;\n }\n}\n","import { sourceBreakpointDefinition } from '../config/source-breakpoints';\nimport { ORIENTATION_BREAKPOINTS } from '../analyzer/flex-layout.catalog';\nimport type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\n\nexport interface MediaRange {\n readonly min?: number;\n readonly max?: number;\n readonly orientation?: 'portrait' | 'landscape';\n}\n\nexport type MediaClause = MediaRange;\n\nexport interface MediaDefinition {\n readonly type: 'screen' | 'print';\n readonly clauses: readonly MediaClause[];\n}\n\nexport interface BreakpointDefinition {\n readonly alias: string;\n /** @deprecated Use media clauses; retained while range consumers migrate. */\n readonly range: MediaClause;\n readonly media: MediaDefinition;\n readonly priority: number;\n}\n\nexport type BreakpointClassification =\n | { readonly kind: 'verified'; readonly definition: BreakpointDefinition }\n | { readonly kind: 'optional'; readonly alias: string }\n | { readonly kind: 'print'; readonly alias: 'print' }\n | { readonly kind: 'custom'; readonly alias: string };\n\nfunction freezeDefinition(definition: BreakpointDefinition): BreakpointDefinition {\n return Object.freeze({\n ...definition,\n range: Object.freeze({ ...definition.range }),\n media: Object.freeze({\n ...definition.media,\n clauses: Object.freeze(definition.media.clauses.map(clause => Object.freeze({ ...clause }))),\n }),\n });\n}\n\nfunction screen(alias: string, range: MediaClause, priority: number): BreakpointDefinition {\n return { alias, range, media: { type: 'screen', clauses: [range] }, priority };\n}\n\nfunction composite(alias: string, clauses: readonly MediaClause[], priority: number): BreakpointDefinition {\n return { alias, range: clauses[0] ?? {}, media: { type: 'screen', clauses }, priority };\n}\n\nconst breakpointDefinitions: readonly BreakpointDefinition[] = [\n screen('xs', { min: 0, max: 599.98 }, 1000),\n screen('sm', { min: 600, max: 959.98 }, 900),\n screen('md', { min: 960, max: 1279.98 }, 800),\n screen('lg', { min: 1280, max: 1919.98 }, 700),\n screen('xl', { min: 1920, max: 4999.98 }, 600),\n screen('lt-sm', { min: undefined, max: 599.98 }, 950),\n screen('lt-md', { min: undefined, max: 959.98 }, 850),\n screen('lt-lg', { min: undefined, max: 1279.98 }, 750),\n screen('lt-xl', { min: undefined, max: 1919.98 }, 650),\n screen('gt-xs', { min: 600, max: undefined }, -950),\n screen('gt-sm', { min: 960, max: undefined }, -850),\n screen('gt-md', { min: 1280, max: undefined }, -750),\n screen('gt-lg', { min: 1920, max: undefined }, -650),\n];\n\nconst orientationDefinitions: readonly BreakpointDefinition[] = [\n screen('handset.portrait', { max: 599.98, orientation: 'portrait' }, 2000),\n screen('handset.landscape', { max: 959.98, orientation: 'landscape' }, 2000),\n composite(\n 'handset',\n [\n { max: 599.98, orientation: 'portrait' },\n { max: 959.98, orientation: 'landscape' },\n ],\n 2000,\n ),\n screen('tablet.portrait', { min: 600, max: 839.98, orientation: 'portrait' }, 2100),\n screen('tablet.landscape', { min: 960, max: 1279.98, orientation: 'landscape' }, 2100),\n composite(\n 'tablet',\n [\n { min: 600, max: 839.98, orientation: 'portrait' },\n { min: 960, max: 1279.98, orientation: 'landscape' },\n ],\n 2100,\n ),\n screen('web.portrait', { min: 840, orientation: 'portrait' }, 2200),\n screen('web.landscape', { min: 1280, orientation: 'landscape' }, 2200),\n composite(\n 'web',\n [\n { min: 840, orientation: 'portrait' },\n { min: 1280, orientation: 'landscape' },\n ],\n 2200,\n ),\n];\n\nconst printDefinition: BreakpointDefinition = {\n alias: 'print',\n range: {},\n media: { type: 'print', clauses: [{}] },\n priority: 1000,\n};\n\nconst definitions = Object.freeze(breakpointDefinitions.map(freezeDefinition));\nconst orientations = Object.freeze(orientationDefinitions.map(freezeDefinition));\nconst frozenPrintDefinition = freezeDefinition(printDefinition);\n\nconst definitionsByAlias = new Map(definitions.map(definition => [definition.alias, definition]));\nconst optionalAliases = new Set<string>(ORIENTATION_BREAKPOINTS);\n\nexport class BreakpointCatalog {\n private readonly configuredDefinitions: ReadonlyMap<string, BreakpointDefinition>;\n readonly printWithBreakpoints: readonly string[] | undefined;\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n this.printWithBreakpoints = config.printWithBreakpoints;\n this.configuredDefinitions = new Map([\n ...definitionsByAlias,\n ...(config.orientationBreakpoints ? orientations.map(definition => [definition.alias, definition] as const) : []),\n ...(config.printWithBreakpoints === undefined\n ? []\n : ([[frozenPrintDefinition.alias, frozenPrintDefinition]] as const)),\n ...Object.entries(config.sourceBreakpoints ?? {}).map(\n ([alias, value]) => [alias, sourceBreakpointDefinition(alias, value)] as const,\n ),\n ]);\n }\n\n classify(alias: string): BreakpointClassification {\n const definition = this.configuredDefinitions.get(alias);\n\n if (definition) {\n return { kind: 'verified', definition };\n }\n\n if (optionalAliases.has(alias)) {\n return { kind: 'optional', alias };\n }\n\n if (alias === 'print') {\n return { kind: 'print', alias };\n }\n\n return { kind: 'custom', alias };\n }\n}\n\n/** Internal canonical definitions for deterministic consumers such as CSS ownership recovery. */\nexport function allBreakpointDefinitions(): readonly BreakpointDefinition[] {\n return Object.freeze([...definitions, ...orientations, frozenPrintDefinition]);\n}\n\nexport function mediaRangesIntersect(left: MediaRange, right: MediaRange): boolean {\n if (left.orientation !== undefined && right.orientation !== undefined && left.orientation !== right.orientation) {\n return false;\n }\n const leftMin = left.min ?? Number.NEGATIVE_INFINITY;\n const leftMax = left.max ?? Number.POSITIVE_INFINITY;\n const rightMin = right.min ?? Number.NEGATIVE_INFINITY;\n const rightMax = right.max ?? Number.POSITIVE_INFINITY;\n\n return leftMin <= rightMax && rightMin <= leftMax;\n}\n\nexport function mediaDefinitionsIntersect(left: MediaDefinition, right: MediaDefinition): boolean {\n if (left.type !== right.type) return false;\n return left.clauses.some(leftClause =>\n right.clauses.some(\n rightClause =>\n (leftClause.orientation === undefined ||\n rightClause.orientation === undefined ||\n leftClause.orientation === rightClause.orientation) &&\n mediaRangesIntersect(leftClause, rightClause),\n ),\n );\n}\n","export interface TailwindArbitrarySyntax {\n readonly important: boolean;\n}\n\nconst closingByOpening = new Map([\n ['(', ')'],\n ['[', ']'],\n ['{', '}'],\n]);\n\nexport function analyzeTailwindArbitrarySyntax(value: string): TailwindArbitrarySyntax | undefined {\n if (!value.startsWith('[') || !value.endsWith(']')) return undefined;\n const inner = value.slice(1, -1);\n if (inner.trim().length === 0) return undefined;\n\n const stack: string[] = [];\n let quote: '\"' | \"'\" | undefined;\n let typedSeparator = -1;\n let topLevelValue = '';\n\n for (let index = 0; index < inner.length; index += 1) {\n const character = inner[index];\n if (character === undefined) return undefined;\n const codePoint = character.codePointAt(0);\n if (codePoint === undefined || codePoint <= 0x1f || codePoint === 0x7f) return undefined;\n\n if (quote !== undefined) {\n if (character === '\\\\') {\n if (inner[index + 1] === undefined) return undefined;\n index += 1;\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '/' && inner[index + 1] === '*') {\n const commentEnd = inner.indexOf('*/', index + 2);\n if (commentEnd < 0) return undefined;\n if (stack.length === 0) topLevelValue += ' ';\n index = commentEnd + 1;\n continue;\n }\n\n if (character === '\\\\') {\n const escaped = inner[index + 1];\n if (escaped === undefined || escaped === '\\n' || escaped === '\\r' || escaped === '\\f') return undefined;\n if (stack.length === 0) topLevelValue += escaped === '_' ? '_' : 'x';\n index += 1;\n continue;\n }\n\n if (character === '\"' || character === \"'\") {\n if (stack.length === 0) topLevelValue += 'x';\n quote = character;\n continue;\n }\n\n const closing = closingByOpening.get(character);\n if (closing !== undefined) {\n if (stack.length === 0) topLevelValue += 'x';\n stack.push(closing);\n continue;\n }\n if ([')', ']', '}'].includes(character)) {\n if (stack.pop() !== character) return undefined;\n continue;\n }\n if (stack.length !== 0) continue;\n\n if (character === ';') return undefined;\n if (character === ':' && typedSeparator < 0) typedSeparator = index;\n topLevelValue += character === '_' ? ' ' : character;\n }\n\n if (quote !== undefined || stack.length !== 0) return undefined;\n if (\n typedSeparator >= 0 &&\n (inner.slice(0, typedSeparator).trim().length === 0 || inner.slice(typedSeparator + 1).trim().length === 0)\n ) {\n return undefined;\n }\n\n return { important: /!\\s*important\\s*$/iu.test(topLevelValue) };\n}\n\nexport function hasValidTailwindArbitrarySyntax(value: string): boolean {\n return analyzeTailwindArbitrarySyntax(value) !== undefined;\n}\n","type CssPropertyOwnership =\n | { readonly kind: 'universal' }\n | { readonly kind: 'known'; readonly longhands: ReadonlySet<string> }\n | { readonly kind: 'unknown'; readonly property: string }\n | { readonly kind: 'custom'; readonly property: string };\n\nconst edges = ['top', 'right', 'bottom', 'left'] as const;\n\nfunction edgeLonghands(prefix: string, suffix?: string): readonly string[] {\n return edges.map(edge => `${prefix}-${edge}${suffix === undefined ? '' : `-${suffix}`}`);\n}\n\nconst physicalBorderWidths = edgeLonghands('border', 'width');\nconst physicalBorderStyles = edgeLonghands('border', 'style');\nconst physicalBorderColors = edgeLonghands('border', 'color');\nconst logicalBorderWidths = [\n 'border-inline-start-width',\n 'border-inline-end-width',\n 'border-block-start-width',\n 'border-block-end-width',\n] as const;\nconst logicalBorderStyles = [\n 'border-inline-start-style',\n 'border-inline-end-style',\n 'border-block-start-style',\n 'border-block-end-style',\n] as const;\nconst logicalBorderColors = [\n 'border-inline-start-color',\n 'border-inline-end-color',\n 'border-block-start-color',\n 'border-block-end-color',\n] as const;\nconst borderWidths = [...physicalBorderWidths, ...logicalBorderWidths];\nconst borderStyles = [...physicalBorderStyles, ...logicalBorderStyles];\nconst borderColors = [...physicalBorderColors, ...logicalBorderColors];\nconst borderImage = [\n 'border-image-source',\n 'border-image-slice',\n 'border-image-width',\n 'border-image-outset',\n 'border-image-repeat',\n] as const;\n\nconst shorthandLonghands = new Map<string, readonly string[]>([\n [\n 'margin',\n [...edgeLonghands('margin'), 'margin-inline-start', 'margin-inline-end', 'margin-block-start', 'margin-block-end'],\n ],\n ['margin-inline', ['margin-inline-start', 'margin-inline-end', 'margin-left', 'margin-right']],\n ['margin-block', ['margin-block-start', 'margin-block-end', 'margin-top', 'margin-bottom']],\n ['margin-inline-start', ['margin-inline-start', 'margin-left', 'margin-right']],\n ['margin-inline-end', ['margin-inline-end', 'margin-left', 'margin-right']],\n [\n 'padding',\n [\n ...edgeLonghands('padding'),\n 'padding-inline-start',\n 'padding-inline-end',\n 'padding-block-start',\n 'padding-block-end',\n ],\n ],\n ['padding-inline', ['padding-inline-start', 'padding-inline-end', 'padding-left', 'padding-right']],\n ['padding-block', ['padding-block-start', 'padding-block-end', 'padding-top', 'padding-bottom']],\n ['padding-inline-start', ['padding-inline-start', 'padding-left', 'padding-right']],\n ['padding-inline-end', ['padding-inline-end', 'padding-left', 'padding-right']],\n ['inset', [...edges, 'inset-inline-start', 'inset-inline-end', 'inset-block-start', 'inset-block-end']],\n ['inset-inline', ['inset-inline-start', 'inset-inline-end', 'left', 'right']],\n ['inset-block', ['inset-block-start', 'inset-block-end', 'top', 'bottom']],\n ['gap', ['row-gap', 'column-gap']],\n [\n 'font',\n [\n 'font-style',\n 'font-variant',\n 'font-weight',\n 'font-stretch',\n 'font-size',\n 'line-height',\n 'font-family',\n 'font-size-adjust',\n 'font-kerning',\n 'font-optical-sizing',\n 'font-feature-settings',\n 'font-variation-settings',\n 'font-language-override',\n ],\n ],\n [\n 'background',\n [\n 'background-image',\n 'background-position',\n 'background-size',\n 'background-repeat',\n 'background-origin',\n 'background-clip',\n 'background-attachment',\n 'background-color',\n ],\n ],\n ['border', [...borderWidths, ...borderStyles, ...borderColors, ...borderImage]],\n ['border-top', ['border-top-width', 'border-top-style', 'border-top-color']],\n ['border-right', ['border-right-width', 'border-right-style', 'border-right-color']],\n ['border-bottom', ['border-bottom-width', 'border-bottom-style', 'border-bottom-color']],\n ['border-left', ['border-left-width', 'border-left-style', 'border-left-color']],\n ['border-width', borderWidths],\n [\n 'border-inline-width',\n ['border-inline-start-width', 'border-inline-end-width', 'border-left-width', 'border-right-width'],\n ],\n ['border-block-width', ['border-block-start-width', 'border-block-end-width', ...physicalBorderWidths]],\n ['border-inline-start-width', ['border-inline-start-width', 'border-left-width', 'border-right-width']],\n ['border-inline-end-width', ['border-inline-end-width', 'border-left-width', 'border-right-width']],\n ['border-block-start-width', ['border-block-start-width', ...physicalBorderWidths]],\n ['border-block-end-width', ['border-block-end-width', ...physicalBorderWidths]],\n ['border-style', borderStyles],\n [\n 'border-inline-style',\n ['border-inline-start-style', 'border-inline-end-style', 'border-left-style', 'border-right-style'],\n ],\n ['border-block-style', ['border-block-start-style', 'border-block-end-style', ...physicalBorderStyles]],\n ['border-inline-start-style', ['border-inline-start-style', 'border-left-style', 'border-right-style']],\n ['border-inline-end-style', ['border-inline-end-style', 'border-left-style', 'border-right-style']],\n ['border-block-start-style', ['border-block-start-style', ...physicalBorderStyles]],\n ['border-block-end-style', ['border-block-end-style', ...physicalBorderStyles]],\n ['border-color', borderColors],\n [\n 'border-inline-color',\n ['border-inline-start-color', 'border-inline-end-color', 'border-left-color', 'border-right-color'],\n ],\n ['border-block-color', ['border-block-start-color', 'border-block-end-color', ...physicalBorderColors]],\n ['border-inline-start-color', ['border-inline-start-color', 'border-left-color', 'border-right-color']],\n ['border-inline-end-color', ['border-inline-end-color', 'border-left-color', 'border-right-color']],\n ['border-block-start-color', ['border-block-start-color', ...physicalBorderColors]],\n ['border-block-end-color', ['border-block-end-color', ...physicalBorderColors]],\n [\n 'border-radius',\n [\n 'border-top-left-radius',\n 'border-top-right-radius',\n 'border-bottom-right-radius',\n 'border-bottom-left-radius',\n 'border-start-start-radius',\n 'border-start-end-radius',\n 'border-end-start-radius',\n 'border-end-end-radius',\n ],\n ],\n ['border-image', borderImage],\n ['overflow', ['overflow-x', 'overflow-y']],\n ['flex', ['flex-grow', 'flex-shrink', 'flex-basis']],\n [\n 'transition',\n [\n 'transition-property',\n 'transition-duration',\n 'transition-timing-function',\n 'transition-delay',\n 'transition-behavior',\n ],\n ],\n ['grid-template', ['grid-template-rows', 'grid-template-columns', 'grid-template-areas']],\n ['grid-column', ['grid-column-start', 'grid-column-end']],\n ['grid-row', ['grid-row-start', 'grid-row-end']],\n [\n 'grid',\n [\n 'grid-template-rows',\n 'grid-template-columns',\n 'grid-template-areas',\n 'grid-auto-rows',\n 'grid-auto-columns',\n 'grid-auto-flow',\n ],\n ],\n ['list-style', ['list-style-type', 'list-style-position', 'list-style-image']],\n ['columns', ['column-width', 'column-count']],\n ['column-rule', ['column-rule-width', 'column-rule-style', 'column-rule-color']],\n ['outline', ['outline-width', 'outline-style', 'outline-color']],\n [\n 'text-decoration',\n ['text-decoration-line', 'text-decoration-style', 'text-decoration-color', 'text-decoration-thickness'],\n ],\n ['place-content', ['align-content', 'justify-content']],\n ['place-items', ['align-items', 'justify-items']],\n ['place-self', ['align-self', 'justify-self']],\n [\n 'animation',\n [\n 'animation-name',\n 'animation-duration',\n 'animation-timing-function',\n 'animation-delay',\n 'animation-iteration-count',\n 'animation-direction',\n 'animation-fill-mode',\n 'animation-play-state',\n 'animation-timeline',\n 'animation-range-start',\n 'animation-range-end',\n ],\n ],\n]);\n\nconst knownIndependentProperties = new Set([\n ...[...shorthandLonghands.values()].flatMap(longhands => [...longhands]),\n 'display',\n 'box-sizing',\n 'flex-direction',\n 'flex-wrap',\n 'justify-items',\n 'justify-self',\n 'width',\n 'height',\n 'min-width',\n 'min-height',\n 'max-width',\n 'max-height',\n 'color',\n 'text-align',\n 'text-wrap',\n 'background-blend-mode',\n 'background-size',\n 'background-attachment',\n 'background-clip',\n 'background-origin',\n 'background-position',\n 'background-repeat',\n 'box-shadow',\n 'opacity',\n 'position',\n 'transform',\n 'translate',\n 'rotate',\n 'scale',\n 'transform-origin',\n 'order',\n 'grid-column-start',\n 'grid-column-end',\n 'grid-row-start',\n 'grid-row-end',\n 'grid-auto-columns',\n 'grid-auto-rows',\n 'table-layout',\n 'object-fit',\n 'object-position',\n 'cursor',\n 'pointer-events',\n 'visibility',\n 'clip',\n 'clip-path',\n 'white-space',\n 'text-overflow',\n 'content',\n 'z-index',\n]);\n\nfunction ownership(property: string): CssPropertyOwnership {\n if (property.startsWith('--')) return { kind: 'custom', property };\n\n const normalized = property.toLowerCase();\n if (normalized === 'all') return { kind: 'universal' };\n const expanded = shorthandLonghands.get(normalized);\n if (expanded !== undefined) return { kind: 'known', longhands: new Set(expanded) };\n if (knownIndependentProperties.has(normalized)) {\n return { kind: 'known', longhands: new Set([normalized]) };\n }\n return { kind: 'unknown', property: normalized };\n}\n\nexport function cssPropertiesOverlap(leftProperty: string, rightProperty: string): boolean {\n const left = ownership(leftProperty);\n const right = ownership(rightProperty);\n\n if (left.kind === 'custom' || right.kind === 'custom') {\n return left.kind === 'custom' && right.kind === 'custom' && left.property === right.property;\n }\n if (left.kind === 'universal' || right.kind === 'universal') return true;\n if (left.kind === 'unknown' || right.kind === 'unknown') return true;\n return [...left.longhands].some(longhand => right.longhands.has(longhand));\n}\n\nexport function cssPropertyOwnershipCovers(ownerProperty: string, targetProperty: string): boolean {\n const owner = ownership(ownerProperty);\n const target = ownership(targetProperty);\n\n if (owner.kind === 'custom' || target.kind === 'custom') {\n return owner.kind === 'custom' && target.kind === 'custom' && owner.property === target.property;\n }\n if (owner.kind === 'universal') return true;\n if (target.kind === 'universal') return false;\n if (owner.kind === 'unknown' || target.kind === 'unknown') {\n return owner.kind === 'unknown' && target.kind === 'unknown' && owner.property === target.property;\n }\n return [...target.longhands].every(longhand => owner.longhands.has(longhand));\n}\n","const cssLengthUnits = new Set([\n 'cm',\n 'mm',\n 'Q',\n 'in',\n 'pc',\n 'pt',\n 'px',\n 'em',\n 'ex',\n 'ch',\n 'rem',\n 'lh',\n 'rlh',\n 'vw',\n 'vh',\n 'vmin',\n 'vmax',\n 'vb',\n 'vi',\n 'svw',\n 'svh',\n 'lvw',\n 'lvh',\n 'dvw',\n 'dvh',\n 'cqw',\n 'cqh',\n 'cqi',\n 'cqb',\n 'cqmin',\n 'cqmax',\n]);\n\nconst cssColorKeywords = new Set(\n `black silver gray white maroon red purple fuchsia green lime olive yellow navy blue teal aqua aliceblue\n antiquewhite aquamarine azure beige bisque blanchedalmond blueviolet brown burlywood cadetblue chartreuse\n chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey\n darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue\n darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick\n floralwhite forestgreen gainsboro ghostwhite gold goldenrod greenyellow grey honeydew hotpink indianred indigo ivory\n khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray\n lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue\n lightyellow limegreen linen magenta mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen\n mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin\n navajowhite oldlace olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip\n peachpuff peru pink plum powderblue rebeccapurple rosybrown royalblue saddlebrown salmon sandybrown seagreen\n seashell sienna skyblue slateblue slategray slategrey snow springgreen steelblue tan thistle tomato turquoise violet\n wheat whitesmoke yellowgreen transparent currentcolor canvas canvastext linktext visitedtext activetext buttonface\n buttontext buttonborder field fieldtext highlight highlighttext selecteditem selecteditemtext mark marktext graytext\n accentcolor accentcolortext`\n .split(/\\s+/u)\n .filter(Boolean),\n);\n\nconst absoluteFontSizes = new Set([\n 'xx-small',\n 'x-small',\n 'small',\n 'medium',\n 'large',\n 'x-large',\n 'xx-large',\n 'xxx-large',\n]);\nconst relativeFontSizes = new Set(['larger', 'smaller']);\nconst defaultTailwindColorNames = new Set([\n 'red',\n 'orange',\n 'amber',\n 'yellow',\n 'lime',\n 'green',\n 'emerald',\n 'teal',\n 'cyan',\n 'sky',\n 'blue',\n 'indigo',\n 'violet',\n 'purple',\n 'fuchsia',\n 'pink',\n 'rose',\n 'slate',\n 'gray',\n 'zinc',\n 'neutral',\n 'stone',\n]);\nconst defaultTailwindColorShades = new Set([\n '50',\n '100',\n '200',\n '300',\n '400',\n '500',\n '600',\n '700',\n '800',\n '900',\n '950',\n]);\n\nconst unsignedDecimal = /^(?:(?:\\d+(?:\\.\\d+)?)|(?:\\.\\d+))$/u;\nconst signedCssNumber = /^[+-]?(?:\\d*\\.)?\\d+(?:e[+-]?\\d+)?$/iu;\nconst mathFunction = /(?:calc|min|max|clamp|mod|rem|sin|cos|tan|asin|acos|atan|atan2|pow|sqrt|hypot|log|exp|round)\\(/u;\nconst colorFunction = /^(?:rgba?|hsla?|hwb|color|(?:ok)?(?:lab|lch)|light-dark|color-mix|--alpha)\\(/iu;\n\ninterface ArbitraryValue {\n readonly hint?: string;\n readonly payload: string;\n}\n\nfunction arbitraryValue(value: string): ArbitraryValue | undefined {\n if (!value.startsWith('[') || !value.endsWith(']')) return undefined;\n const inner = value.slice(1, -1);\n const hinted = inner.match(/^([a-z][a-z-]*):([\\s\\S]+)$/u);\n return hinted === null ? { payload: inner } : { hint: hinted[1], payload: hinted[2] ?? '' };\n}\n\nfunction splitNumberAndUnit(value: string): { readonly number: string; readonly unit?: string } | undefined {\n const match = value.match(/^((?:(?:\\d+(?:\\.\\d+)?)|(?:\\.\\d+)))([a-zA-Z%]+)?$/u);\n if (match === null) return undefined;\n return { number: match[1] ?? '', unit: match[2] };\n}\n\nfunction isUnsignedLength(value: string, allowPercentage: boolean, allowUnitless: boolean): boolean {\n const parsed = splitNumberAndUnit(value);\n if (parsed === undefined || !unsignedDecimal.test(parsed.number)) return false;\n if (parsed.unit === undefined) return allowUnitless;\n return (allowPercentage && parsed.unit === '%') || cssLengthUnits.has(parsed.unit);\n}\n\nexport function isConservativelyAdmittedTextLength(value: string): boolean {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return false;\n if (arbitrary.hint !== undefined && arbitrary.hint !== 'length') return false;\n if (arbitrary.hint === 'length' && arbitrary.payload === '0') return true;\n return isUnsignedLength(arbitrary.payload, true, false);\n}\n\nexport function isConservativelyAdmittedBorderWidth(value: string): boolean {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return false;\n if (arbitrary.hint !== undefined && arbitrary.hint !== 'length') return false;\n if (arbitrary.hint === 'length' && arbitrary.payload === '0') return true;\n return isUnsignedLength(arbitrary.payload, false, arbitrary.hint === undefined);\n}\n\nfunction isTailwindLength(value: string): boolean {\n if (/^--spacing\\(/iu.test(value)) return true;\n if (mathFunction.test(value)) return true;\n const match = value.match(/^([+-]?(?:\\d*\\.)?\\d+(?:e[+-]?\\d+)?)([a-zA-Z]+)$/iu);\n return match !== null && signedCssNumber.test(match[1] ?? '') && cssLengthUnits.has(match[2] ?? '');\n}\n\nfunction isTailwindPercentage(value: string): boolean {\n return /^[+-]?(?:\\d*\\.)?\\d+(?:e[+-]?\\d+)?%$/iu.test(value) || mathFunction.test(value);\n}\n\nfunction decodedInferenceValue(value: string): string | undefined {\n if (value.includes('\\\\')) return undefined;\n return value.replaceAll('_', ' ');\n}\n\ntype TailwindDataType = 'color' | 'length' | 'percentage' | 'absolute-size' | 'relative-size' | 'line-width';\n\nfunction inferTailwindDataType(value: string, types: readonly TailwindDataType[]): TailwindDataType | undefined {\n if (value.startsWith('var(')) return undefined;\n\n for (const type of types) {\n if (\n type === 'color' &&\n (value.startsWith('#') || colorFunction.test(value) || cssColorKeywords.has(value.toLowerCase()))\n ) {\n return type;\n }\n if (type === 'length' && isTailwindLength(value)) return type;\n if (type === 'percentage' && isTailwindPercentage(value)) return type;\n if (type === 'absolute-size' && absoluteFontSizes.has(value)) return type;\n if (type === 'relative-size' && relativeFontSizes.has(value)) return type;\n if (type === 'line-width') {\n const parts = value.split(' ');\n if (\n parts.length > 0 &&\n parts.every(\n part =>\n part.length > 0 &&\n (isTailwindLength(part) || signedCssNumber.test(part) || ['thin', 'medium', 'thick'].includes(part)),\n )\n ) {\n return type;\n }\n }\n }\n return undefined;\n}\n\nexport function isPinnedTailwindColorToken(value: string): boolean {\n const [color, opacity, remainder] = value.split('/');\n if (remainder !== undefined || color === undefined) return false;\n const standard = ['inherit', 'current', 'transparent', 'black', 'white'].includes(color);\n const [name, shade, extra] = color.split('-');\n const palette =\n extra === undefined &&\n name !== undefined &&\n shade !== undefined &&\n defaultTailwindColorNames.has(name) &&\n defaultTailwindColorShades.has(shade);\n if (!standard && !palette) return false;\n if (opacity === undefined) return true;\n if (!/^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/u.test(opacity)) return false;\n const numericOpacity = Number(opacity);\n return numericOpacity >= 0 && numericOpacity <= 100;\n}\n\nexport function tailwindArbitraryTextKind(value: string): 'color' | 'font-size' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (['size', 'length', 'percentage', 'absolute-size', 'relative-size'].includes(arbitrary.hint ?? '')) {\n return 'font-size';\n }\n if (arbitrary.hint === 'color') return 'color';\n if (arbitrary.hint !== undefined) return 'unknown';\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n const inferred = inferTailwindDataType(payload, ['color', 'length', 'percentage', 'absolute-size', 'relative-size']);\n return inferred !== undefined && inferred !== 'color' ? 'font-size' : 'color';\n}\n\nfunction isTailwindBackgroundPosition(value: string): boolean {\n let recognized = 0;\n for (const part of value.split(' ')) {\n if (['center', 'top', 'right', 'bottom', 'left'].includes(part)) {\n recognized += 1;\n continue;\n }\n if (part.startsWith('var(')) continue;\n if (!isTailwindLength(part) && !isTailwindPercentage(part)) return false;\n recognized += 1;\n }\n return recognized > 0;\n}\n\nfunction isTailwindBackgroundSize(value: string): boolean {\n let recognized = 0;\n for (const layer of value.split(',')) {\n if (layer === 'cover' || layer === 'contain') {\n recognized += 1;\n continue;\n }\n const parts = layer.split(' ');\n if (\n (parts.length !== 1 && parts.length !== 2) ||\n !parts.every(part => part === 'auto' || isTailwindLength(part) || isTailwindPercentage(part))\n ) {\n return false;\n }\n recognized += 1;\n }\n return recognized > 0;\n}\n\nfunction splitTopLevelCommas(value: string): readonly string[] | undefined {\n const closingByOpening = new Map([\n ['(', ')'],\n ['[', ']'],\n ['{', '}'],\n ]);\n const stack: string[] = [];\n const parts: string[] = [];\n let quote: '\"' | \"'\" | undefined;\n let start = 0;\n\n for (let index = 0; index < value.length; index += 1) {\n const character = value[index];\n if (character === undefined) return undefined;\n if (quote !== undefined) {\n if (character === '\\\\') index += 1;\n else if (character === quote) quote = undefined;\n continue;\n }\n if (character === '\\\\') {\n index += 1;\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n const closing = closingByOpening.get(character);\n if (closing !== undefined) {\n stack.push(closing);\n continue;\n }\n if ([')', ']', '}'].includes(character)) {\n if (stack.pop() !== character) return undefined;\n continue;\n }\n if (character === ',' && stack.length === 0) {\n parts.push(value.slice(start, index));\n start = index + 1;\n }\n }\n if (quote !== undefined || stack.length > 0) return undefined;\n parts.push(value.slice(start));\n return parts;\n}\n\nfunction isTailwindBackgroundImage(value: string): boolean {\n const layers = splitTopLevelCommas(value);\n if (layers === undefined) return false;\n let recognized = 0;\n for (const layer of layers) {\n const normalized = layer.trim();\n if (normalized.startsWith('var(')) continue;\n if (\n !/^(?:url|(?:repeating-)?(?:linear|radial|conic)-gradient|element|image|cross-fade|image-set)\\([\\s\\S]*\\)$/u.test(\n normalized,\n )\n ) {\n return false;\n }\n recognized += 1;\n }\n return recognized > 0;\n}\n\nexport function tailwindArbitraryBackgroundKind(\n value: string,\n): 'background-color' | 'background-image' | 'background-position' | 'background-size' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (arbitrary.hint === 'percentage' || arbitrary.hint === 'position') return 'background-position';\n if (['bg-size', 'length', 'size'].includes(arbitrary.hint ?? '')) return 'background-size';\n if (arbitrary.hint === 'image' || arbitrary.hint === 'url') return 'background-image';\n if (arbitrary.hint === 'color') return 'background-color';\n if (arbitrary.hint !== undefined) return 'unknown';\n\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n if (payload.startsWith('var(')) return 'unknown';\n if (isTailwindBackgroundImage(payload)) return 'background-image';\n if (inferTailwindDataType(payload, ['color']) === 'color') return 'background-color';\n\n const position = isTailwindBackgroundPosition(payload);\n const size = isTailwindBackgroundSize(payload);\n if (position === size) return 'unknown';\n return position ? 'background-position' : 'background-size';\n}\n\nexport function tailwindArbitraryBorderKind(value: string): 'border-color' | 'border-width' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (arbitrary.hint === 'length' || arbitrary.hint === 'line-width') return 'border-width';\n if (arbitrary.hint === 'color') return 'border-color';\n if (arbitrary.hint !== undefined) return 'unknown';\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n const inferred = inferTailwindDataType(payload, ['color', 'line-width', 'length']);\n return inferred === 'line-width' || inferred === 'length' ? 'border-width' : 'border-color';\n}\n\nexport function tailwindArbitraryShadowKind(value: string): 'shadow-color' | 'shadow-geometry' | 'unknown' {\n const arbitrary = arbitraryValue(value);\n if (arbitrary === undefined) return 'unknown';\n if (arbitrary.hint === 'color') return 'shadow-color';\n if (arbitrary.hint !== undefined) return 'unknown';\n const payload = decodedInferenceValue(arbitrary.payload);\n if (payload === undefined || payload.length === 0) return 'unknown';\n return inferTailwindDataType(payload, ['color']) === 'color' ? 'shadow-color' : 'shadow-geometry';\n}\n","import { mediaRangesIntersect, type MediaRange } from '../../breakpoint/breakpoint-catalog';\nimport { analyzeTailwindArbitrarySyntax } from './tailwind-arbitrary-syntax';\nimport { cssPropertiesOverlap } from '../../semantic/css-property-ownership';\nimport {\n isPinnedTailwindColorToken,\n tailwindArbitraryBackgroundKind,\n tailwindArbitraryBorderKind,\n tailwindArbitraryShadowKind,\n tailwindArbitraryTextKind,\n} from './extended/tailwind-arbitrary-value-ownership';\n\nexport type TailwindActivation =\n | { readonly kind: 'base' }\n | { readonly kind: 'media'; readonly range: MediaRange; readonly mediaType?: 'screen' | 'print' };\n\nexport interface TailwindDisplayUtility {\n readonly token: string;\n readonly utility: string;\n readonly activation: TailwindActivation;\n readonly important: boolean;\n}\n\nexport interface TailwindUtilityDescriptor {\n readonly token: string;\n readonly variants: readonly string[];\n readonly utility: string;\n readonly cssProperties: readonly string[];\n readonly hasUnknownCssAuthority?: true;\n readonly activation: TailwindActivation;\n readonly hasGeneratedMediaVariant: boolean;\n readonly important: boolean;\n}\n\nconst displayUtilities = new Set([\n 'inline',\n 'block',\n 'inline-block',\n 'flow-root',\n 'flex',\n 'inline-flex',\n 'grid',\n 'inline-grid',\n 'contents',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-column',\n 'table-column-group',\n 'table-footer-group',\n 'table-header-group',\n 'table-row-group',\n 'table-row',\n 'list-item',\n 'hidden',\n]);\n\nconst generatedScreenMediaVariant =\n /^\\[@media_screen_and_(?:(?:\\(min-width:_(\\d+(?:\\.\\d+)?)px\\))(?:_and_\\(max-width:_(\\d+(?:\\.\\d+)?)px\\))?|\\(max-width:_(\\d+(?:\\.\\d+)?)px\\))\\]$/u;\nconst generatedOrientationMediaVariant =\n /^\\[@media_\\(orientation:_(portrait|landscape)\\)(?:_and_\\(min-width:_(\\d+(?:\\.\\d+)?)px\\))?(?:_and_\\(max-width:_(\\d+(?:\\.\\d+)?)px\\))?\\]$/u;\n\nfunction splitVariants(\n className: string,\n): { readonly variants: readonly string[]; readonly utility: string } | undefined {\n let bracketDepth = 0;\n let escaped = false;\n let segmentStart = 0;\n const segments: string[] = [];\n\n for (let index = 0; index < className.length; index += 1) {\n const character = className[index];\n if (escaped) {\n escaped = false;\n continue;\n }\n if (character === '\\\\') {\n escaped = true;\n } else if (character === '[') {\n bracketDepth += 1;\n } else if (character === ']') {\n if (bracketDepth === 0) return undefined;\n bracketDepth -= 1;\n } else if (character === ':' && bracketDepth === 0) {\n const segment = className.slice(segmentStart, index);\n if (segment.length === 0) return undefined;\n segments.push(segment);\n segmentStart = index + 1;\n }\n }\n\n if (escaped || bracketDepth !== 0) return undefined;\n\n const utility = className.slice(segmentStart);\n if (utility.length === 0) return undefined;\n return { variants: Object.freeze(segments), utility };\n}\n\nfunction activation(variants: readonly string[]): TailwindActivation {\n for (const variant of variants) {\n if (variant === '[@media_print]') return { kind: 'media', range: {}, mediaType: 'print' };\n\n const orientationMatch = variant.match(generatedOrientationMediaVariant);\n if (orientationMatch) {\n return {\n kind: 'media',\n range: {\n orientation: orientationMatch[1] as 'portrait' | 'landscape',\n min: orientationMatch[2] === undefined ? undefined : Number(orientationMatch[2]),\n max: orientationMatch[3] === undefined ? undefined : Number(orientationMatch[3]),\n },\n };\n }\n\n const match = variant.match(generatedScreenMediaVariant);\n if (!match) continue;\n const min = match[1] === undefined ? undefined : Number(match[1]);\n const maxValue = match[2] ?? match[3];\n const max = maxValue === undefined ? undefined : Number(maxValue);\n if (min !== undefined && max !== undefined && min > max) continue;\n return { kind: 'media', range: { min, max } };\n }\n\n return { kind: 'base' };\n}\n\nfunction hasGeneratedMediaVariant(variants: readonly string[]): boolean {\n return variants.some(variant => variant.startsWith('[@media_'));\n}\n\nfunction hasInternalDeclarationImportance(utility: string): boolean {\n const arbitraryStart = utility.indexOf('[');\n if (arbitraryStart < 0) return false;\n return analyzeTailwindArbitrarySyntax(utility.slice(arbitraryStart))?.important ?? false;\n}\n\ntype CssAuthority = readonly string[] | 'unknown';\n\nconst textSizes = new Set(['xs', 'sm', 'base', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', '7xl', '8xl', '9xl']);\nconst shadowGeometryNames = new Set(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', 'none']);\nconst insetShadowGeometryNames = new Set(['2xs', 'xs', 'sm', 'none']);\n\ninterface BorderFamilyOwnership {\n readonly namespace: string;\n readonly width: readonly string[];\n readonly color: readonly string[];\n}\n\nconst borderFamilies: readonly BorderFamilyOwnership[] = [\n {\n namespace: 'border-bs',\n width: ['border-block-start-style', 'border-block-start-width'],\n color: ['border-block-start-color'],\n },\n {\n namespace: 'border-be',\n width: ['border-block-end-style', 'border-block-end-width'],\n color: ['border-block-end-color'],\n },\n {\n namespace: 'border-x',\n width: ['border-inline-style', 'border-inline-width'],\n color: ['border-inline-color'],\n },\n {\n namespace: 'border-y',\n width: ['border-block-style', 'border-block-width'],\n color: ['border-block-color'],\n },\n {\n namespace: 'border-s',\n width: ['border-inline-start-style', 'border-inline-start-width'],\n color: ['border-inline-start-color'],\n },\n {\n namespace: 'border-e',\n width: ['border-inline-end-style', 'border-inline-end-width'],\n color: ['border-inline-end-color'],\n },\n { namespace: 'border-t', width: ['border-top-style', 'border-top-width'], color: ['border-top-color'] },\n { namespace: 'border-r', width: ['border-right-style', 'border-right-width'], color: ['border-right-color'] },\n { namespace: 'border-b', width: ['border-bottom-style', 'border-bottom-width'], color: ['border-bottom-color'] },\n { namespace: 'border-l', width: ['border-left-style', 'border-left-width'], color: ['border-left-color'] },\n { namespace: 'border', width: ['border-style', 'border-width'], color: ['border-color'] },\n];\n\nconst recognizedTailwindAuthorityNamespaces = [\n '@container',\n 'accent',\n 'align',\n 'animate',\n 'appearance',\n 'aspect',\n 'auto-cols',\n 'auto-rows',\n 'backdrop',\n 'backface',\n 'basis',\n 'bg',\n 'block',\n 'blur',\n 'border',\n 'box-decoration',\n 'break',\n 'brightness',\n 'caption',\n 'caret',\n 'clear',\n 'col',\n 'columns',\n 'contain',\n 'content',\n 'contrast',\n 'decoration',\n 'delay',\n 'divide',\n 'drop-shadow',\n 'duration',\n 'ease',\n 'end',\n 'field-sizing',\n 'fill',\n 'filter',\n 'float',\n 'font',\n 'forced-color-adjust',\n 'from',\n 'gradient',\n 'grid',\n 'grid-flow',\n 'grayscale',\n 'hue-rotate',\n 'hyphens',\n 'indent',\n 'inline',\n 'inset-ring',\n 'inset-shadow',\n 'invert',\n 'isolate',\n 'isolation',\n 'justify-items',\n 'justify-self',\n 'leading',\n 'line-clamp',\n 'list',\n 'list-image',\n 'mask',\n 'max-block',\n 'max-inline',\n 'mbe',\n 'mbs',\n 'min-block',\n 'min-inline',\n 'mix-blend',\n 'object',\n 'opacity',\n 'order',\n 'origin',\n 'outline',\n 'overflow',\n 'overscroll',\n 'place-content',\n 'place-items',\n 'place-self',\n 'placeholder',\n 'pbe',\n 'pbs',\n 'perspective',\n 'perspective-origin',\n 'resize',\n 'ring',\n 'rotate',\n 'rounded',\n 'row',\n 'saturate',\n 'scale',\n 'scheme',\n 'scroll',\n 'scrollbar',\n 'select',\n 'sepia',\n 'shadow',\n 'skew',\n 'snap',\n 'space',\n 'start',\n 'stroke',\n 'tab',\n 'table',\n 'text',\n 'to',\n 'touch',\n 'tracking',\n 'transform',\n 'transition',\n 'translate',\n 'underline-offset',\n 'via',\n 'whitespace',\n 'will-change',\n 'wrap',\n 'z',\n 'zoom',\n] as const;\n\nconst recognizedTailwindAuthorityTokens = new Set([\n 'antialiased',\n 'border-collapse',\n 'border-separate',\n 'capitalize',\n 'container',\n 'diagonal-fractions',\n 'italic',\n 'line-through',\n 'lining-nums',\n 'lowercase',\n 'no-underline',\n 'normal-case',\n 'normal-nums',\n 'not-italic',\n 'oldstyle-nums',\n 'ordinal',\n 'outline',\n 'overline',\n 'proportional-nums',\n 'slashed-zero',\n 'stacked-fractions',\n 'subpixel-antialiased',\n 'tabular-nums',\n 'truncate',\n 'underline',\n 'uppercase',\n]);\n\nfunction isCanonicalInteger(value: string): boolean {\n return /^(?:0|[1-9]\\d*)$/u.test(value);\n}\n\nfunction isCssVariableShorthand(value: string): boolean {\n return /^\\(--[A-Za-z_][A-Za-z0-9_-]*\\)$/u.test(value);\n}\n\nfunction borderCssAuthority(utility: string): CssAuthority | undefined {\n const family = borderFamilies.find(\n current => utility === current.namespace || utility.startsWith(`${current.namespace}-`),\n );\n if (family === undefined) return undefined;\n const suffix = utility === family.namespace ? '' : utility.slice(family.namespace.length + 1);\n if (suffix.length === 0 || isCanonicalInteger(suffix)) return family.width;\n if (family.namespace === 'border' && ['solid', 'dashed', 'dotted', 'double', 'hidden', 'none'].includes(suffix)) {\n return ['--tw-border-style', 'border-style'];\n }\n if (suffix.startsWith('[') && suffix.endsWith(']')) {\n const kind = tailwindArbitraryBorderKind(suffix);\n if (kind === 'border-width') return family.width;\n if (kind === 'border-color') return family.color;\n return 'unknown';\n }\n if (isCssVariableShorthand(suffix) || isPinnedTailwindColorToken(suffix)) return family.color;\n return 'unknown';\n}\n\nfunction shadowCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'shadow') return ['--tw-shadow', 'box-shadow'];\n if (!utility.startsWith('shadow-')) return undefined;\n const suffix = utility.slice('shadow-'.length);\n if (suffix.startsWith('[') && suffix.endsWith(']')) {\n const kind = tailwindArbitraryShadowKind(suffix);\n if (kind === 'shadow-color') return ['--tw-shadow-color'];\n if (kind === 'shadow-geometry') return ['--tw-shadow', 'box-shadow'];\n return 'unknown';\n }\n if (isCssVariableShorthand(suffix) || shadowGeometryNames.has(suffix)) return ['--tw-shadow', 'box-shadow'];\n if (isPinnedTailwindColorToken(suffix)) return ['--tw-shadow-color'];\n return 'unknown';\n}\n\nfunction ringCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'ring') return ['--tw-ring-shadow', 'box-shadow'];\n if (utility === 'ring-inset') return ['--tw-ring-inset'];\n if (!utility.startsWith('ring-')) return undefined;\n const suffix = utility.slice('ring-'.length);\n if (isCanonicalInteger(suffix)) return ['--tw-ring-shadow', 'box-shadow'];\n if (isPinnedTailwindColorToken(suffix)) return ['--tw-ring-color'];\n return 'unknown';\n}\n\nfunction insetShadowCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'inset-shadow') return 'unknown';\n if (!utility.startsWith('inset-shadow-')) return undefined;\n const suffix = utility.slice('inset-shadow-'.length);\n if (insetShadowGeometryNames.has(suffix)) return ['--tw-inset-shadow', 'box-shadow'];\n if (suffix === 'initial' || isPinnedTailwindColorToken(suffix)) return ['--tw-inset-shadow-color'];\n return 'unknown';\n}\n\nfunction insetRingCssAuthority(utility: string): CssAuthority | undefined {\n if (utility === 'inset-ring') return ['--tw-inset-ring-shadow', 'box-shadow'];\n if (!utility.startsWith('inset-ring-')) return undefined;\n const suffix = utility.slice('inset-ring-'.length);\n if (isCanonicalInteger(suffix)) return ['--tw-inset-ring-shadow', 'box-shadow'];\n if (isPinnedTailwindColorToken(suffix)) return ['--tw-inset-ring-color'];\n return 'unknown';\n}\n\nfunction arbitraryBackgroundCssAuthority(value: string): CssAuthority {\n const arbitrary = value.match(/^\\[([\\s\\S]+)\\](?:\\/[\\s\\S]+)?$/u)?.[1];\n if (arbitrary === undefined) return 'unknown';\n const property = tailwindArbitraryBackgroundKind(`[${arbitrary}]`);\n return property === 'unknown' ? property : [property];\n}\n\nfunction isRecognizedTailwindAuthority(utility: string): boolean {\n const normalized = utility.startsWith('-') ? utility.slice(1) : utility;\n return (\n recognizedTailwindAuthorityTokens.has(normalized) ||\n recognizedTailwindAuthorityNamespaces.some(\n namespace => normalized === namespace || normalized.startsWith(`${namespace}-`),\n )\n );\n}\n\nfunction cssProperties(utility: string): CssAuthority | undefined {\n const arbitraryProperty = utility.match(/^\\[([^:]+):/u)?.[1];\n if (arbitraryProperty) return [arbitraryProperty];\n if (displayUtilities.has(utility)) return ['display'];\n if (/^flex-(?:row|row-reverse|col|col-reverse)$/u.test(utility)) return ['flex-direction'];\n if (/^flex-(?:wrap|wrap-reverse|nowrap)$/u.test(utility)) return ['flex-wrap'];\n if (/^flex-.+$/u.test(utility)) return ['flex'];\n if (/^grow(?:-.+)?$/u.test(utility)) return ['flex-grow'];\n if (/^shrink(?:-.+)?$/u.test(utility)) return ['flex-shrink'];\n if (/^basis-.+$/u.test(utility)) return ['flex-basis'];\n if (/^box-(?:border|content)$/u.test(utility)) return ['box-sizing'];\n if (/^justify-items-/u.test(utility)) return ['justify-items'];\n if (/^justify-self-/u.test(utility)) return ['justify-self'];\n if (/^justify-/u.test(utility)) return ['justify-content'];\n if (/^items-/u.test(utility)) return ['align-items'];\n if (utility === 'content-none') return ['--tw-content', 'content'];\n if (/^content-\\[/u.test(utility)) return ['--tw-content', 'content'];\n if (/^content-/u.test(utility)) return ['align-content'];\n if (/^self-/u.test(utility)) return ['align-self'];\n if (/^gap-x-/u.test(utility)) return ['column-gap'];\n if (/^gap-y-/u.test(utility)) return ['row-gap'];\n if (/^gap-/u.test(utility)) return ['gap'];\n if (/^order-/u.test(utility)) return ['order'];\n if (/^-?m-/u.test(utility)) return ['margin'];\n if (/^-?mx-/u.test(utility)) return ['margin-inline'];\n if (/^-?my-/u.test(utility)) return ['margin-block'];\n if (/^-?mt-/u.test(utility)) return ['margin-top'];\n if (/^-?mr-/u.test(utility)) return ['margin-right'];\n if (/^-?mb-/u.test(utility)) return ['margin-bottom'];\n if (/^-?ml-/u.test(utility)) return ['margin-left'];\n if (/^-?ms-/u.test(utility)) return ['margin-inline-start'];\n if (/^-?me-/u.test(utility)) return ['margin-inline-end'];\n if (/^p-/u.test(utility)) return ['padding'];\n if (/^px-/u.test(utility)) return ['padding-inline'];\n if (/^py-/u.test(utility)) return ['padding-block'];\n if (/^pt-/u.test(utility)) return ['padding-top'];\n if (/^pr-/u.test(utility)) return ['padding-right'];\n if (/^pb-/u.test(utility)) return ['padding-bottom'];\n if (/^pl-/u.test(utility)) return ['padding-left'];\n if (/^ps-/u.test(utility)) return ['padding-inline-start'];\n if (/^pe-/u.test(utility)) return ['padding-inline-end'];\n if (/^size-/u.test(utility)) return ['width', 'height'];\n if (/^w-/u.test(utility)) return ['width'];\n if (/^h-/u.test(utility)) return ['height'];\n if (/^min-w-/u.test(utility)) return ['min-width'];\n if (/^min-h-/u.test(utility)) return ['min-height'];\n if (/^max-w-/u.test(utility)) return ['max-width'];\n if (/^max-h-/u.test(utility)) return ['max-height'];\n const textValue = utility.match(/^text-([\\s\\S]+)$/u)?.[1];\n const [textBaseValue] = textValue?.split('/') ?? [];\n if (textBaseValue !== undefined && textSizes.has(textBaseValue)) return ['font-size', 'line-height'];\n const arbitraryText = utility.match(/^text-(\\[[\\s\\S]+\\])(?:\\/[^\\s]+)?$/u)?.[1];\n if (arbitraryText !== undefined) {\n const kind = tailwindArbitraryTextKind(arbitraryText);\n if (kind === 'color') return ['color'];\n if (kind === 'font-size') return utility.includes(']/') ? ['font-size', 'line-height'] : ['font-size'];\n return 'unknown';\n }\n if (/^text-(?:left|right|center|justify|start|end)$/u.test(utility)) return ['text-align'];\n if (/^text-(?:wrap|nowrap|balance|pretty)$/u.test(utility)) return ['text-wrap'];\n if (/^text-(?:ellipsis|clip)$/u.test(utility)) return ['text-overflow'];\n if (textValue !== undefined && isPinnedTailwindColorToken(textValue)) return ['color'];\n if (/^text-/u.test(utility)) return 'unknown';\n if (/^bg-(?:auto|cover|contain)$/u.test(utility)) return ['background-size'];\n if (/^bg-(?:fixed|local|scroll)$/u.test(utility)) return ['background-attachment'];\n if (/^bg-clip-/u.test(utility)) return ['background-clip'];\n if (/^bg-origin-/u.test(utility)) return ['background-origin'];\n if (/^bg-(?:bottom|center|left|left-bottom|left-top|right|right-bottom|right-top|top)$/u.test(utility)) {\n return ['background-position'];\n }\n if (/^bg-(?:repeat|no-repeat|repeat-x|repeat-y|repeat-round|repeat-space)$/u.test(utility)) {\n return ['background-repeat'];\n }\n if (/^bg-blend-/u.test(utility)) return ['background-blend-mode'];\n if (utility === 'bg-none') return ['background-image'];\n const backgroundValue = utility.match(/^bg-([\\s\\S]+)$/u)?.[1];\n if (backgroundValue?.startsWith('[')) return arbitraryBackgroundCssAuthority(backgroundValue);\n if (isCssVariableShorthand(backgroundValue ?? '')) return 'unknown';\n if (backgroundValue !== undefined && isPinnedTailwindColorToken(backgroundValue)) return ['background-color'];\n if (/^bg-/u.test(utility)) return 'unknown';\n const borderAuthority = borderCssAuthority(utility);\n if (borderAuthority !== undefined) return borderAuthority;\n if (/^rounded(?:-|$)/u.test(utility)) return ['border-radius'];\n const shadowAuthority = shadowCssAuthority(utility);\n if (shadowAuthority !== undefined) return shadowAuthority;\n const ringAuthority = ringCssAuthority(utility);\n if (ringAuthority !== undefined) return ringAuthority;\n const insetShadowAuthority = insetShadowCssAuthority(utility);\n if (insetShadowAuthority !== undefined) return insetShadowAuthority;\n const insetRingAuthority = insetRingCssAuthority(utility);\n if (insetRingAuthority !== undefined) return insetRingAuthority;\n if (utility === 'truncate') return ['overflow', 'text-overflow', 'white-space'];\n if (/^opacity-/u.test(utility)) return ['opacity'];\n if (/^overflow(?:-|$)/u.test(utility)) return ['overflow'];\n if (['static', 'fixed', 'absolute', 'relative', 'sticky'].includes(utility)) return ['position'];\n if (/^-?inset-x-/u.test(utility)) return ['inset-inline'];\n if (/^-?inset-y-/u.test(utility)) return ['inset-block'];\n if (/^-?inset-/u.test(utility)) return ['inset'];\n if (/^-?top-/u.test(utility)) return ['top'];\n if (/^-?right-/u.test(utility)) return ['right'];\n if (/^-?bottom-/u.test(utility)) return ['bottom'];\n if (/^-?left-/u.test(utility)) return ['left'];\n if (/^-?rotate-z-/u.test(utility)) return ['--tw-rotate-z', 'transform'];\n if (/^-?rotate-(?:x|y)-/u.test(utility)) return 'unknown';\n if (/^-?rotate-/u.test(utility)) return ['rotate'];\n if (/^scale-(?:x|y|z)-/u.test(utility)) return 'unknown';\n if (/^scale-(?:\\[|\\()/u.test(utility)) return ['scale'];\n if (/^scale-/u.test(utility)) return ['--tw-scale-x', '--tw-scale-y', '--tw-scale-z', 'scale'];\n if (/^-?translate-z-/u.test(utility)) return 'unknown';\n if (/^-?translate-x-/u.test(utility)) return ['--tw-translate-x', 'translate'];\n if (/^-?translate-y-/u.test(utility)) return ['--tw-translate-y', 'translate'];\n if (/^-?translate-/u.test(utility)) return ['--tw-translate-x', '--tw-translate-y', 'translate'];\n if (utility === 'transition-none') return ['transition-property'];\n if (utility === 'transition-discrete' || utility === 'transition-normal') return ['transition-behavior'];\n if (/^transition(?:-|$)/u.test(utility)) {\n return ['transition-property', 'transition-timing-function', 'transition-duration'];\n }\n if (/^duration-/u.test(utility)) return ['--tw-duration', 'transition-duration'];\n if (/^delay-/u.test(utility)) return ['transition-delay'];\n if (/^ease-/u.test(utility)) return ['--tw-ease', 'transition-timing-function'];\n if (/^grid-cols(?:-|$)/u.test(utility)) return ['grid-template-columns'];\n if (/^auto-cols(?:-|$)/u.test(utility)) return ['grid-auto-columns'];\n if (/^grid-rows(?:-|$)/u.test(utility)) return ['grid-template-rows'];\n if (/^auto-rows(?:-|$)/u.test(utility)) return ['grid-auto-rows'];\n if (/^col-(?:span-|auto$)/u.test(utility)) return ['grid-column'];\n if (/^col-start-/u.test(utility)) return ['grid-column-start'];\n if (/^col-end-/u.test(utility)) return ['grid-column-end'];\n if (/^row-(?:span-|auto$)/u.test(utility)) return ['grid-row'];\n if (/^row-start-/u.test(utility)) return ['grid-row-start'];\n if (/^row-end-/u.test(utility)) return ['grid-row-end'];\n if (/^table-(?:auto|fixed)$/u.test(utility)) return ['table-layout'];\n if (/^list-(?:disc|decimal|none)$/u.test(utility)) return ['list-style-type'];\n if (/^list-(?:inside|outside)$/u.test(utility)) return ['list-style-position'];\n if (/^object-(?:contain|cover|fill|none|scale-down)$/u.test(utility)) return ['object-fit'];\n if (/^object-/u.test(utility)) return ['object-position'];\n if (/^cursor-/u.test(utility)) return ['cursor'];\n if (/^pointer-events-/u.test(utility)) return ['pointer-events'];\n if (['visible', 'invisible', 'collapse'].includes(utility)) return ['visibility'];\n if (utility === 'sr-only') {\n return ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space', 'border-width'];\n }\n if (utility === 'not-sr-only') {\n return ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space'];\n }\n return isRecognizedTailwindAuthority(utility) ? 'unknown' : undefined;\n}\n\nexport function describeTailwindUtility(token: string): TailwindUtilityDescriptor | undefined {\n const split = splitVariants(token);\n if (split === undefined) return undefined;\n const { variants, utility: modifiedUtility } = split;\n const leadingImportant = modifiedUtility.startsWith('!');\n const trailingImportant = modifiedUtility.endsWith('!');\n if (leadingImportant && trailingImportant) return undefined;\n const utility = modifiedUtility.replace(/^!/u, '').replace(/!$/u, '');\n if (utility.length === 0) return undefined;\n const important = leadingImportant || trailingImportant || hasInternalDeclarationImportance(utility);\n const authority = cssProperties(utility);\n return {\n token,\n variants,\n utility,\n cssProperties: authority === undefined || authority === 'unknown' ? [] : authority,\n ...(authority === 'unknown' ? { hasUnknownCssAuthority: true } : {}),\n activation: activation(variants),\n hasGeneratedMediaVariant: hasGeneratedMediaVariant(variants),\n important,\n };\n}\n\nexport function describeTailwindDisplay(token: string): TailwindDisplayUtility | undefined {\n const descriptor = describeTailwindUtility(token);\n if (descriptor === undefined) return undefined;\n if (!descriptor.cssProperties.includes('display')) return undefined;\n return {\n token: descriptor.token,\n utility: descriptor.utility,\n activation: descriptor.activation,\n important: descriptor.important,\n };\n}\n\nfunction activationsIntersect(left: TailwindActivation, right: TailwindActivation): boolean {\n if (left.kind === 'base' || right.kind === 'base') return true;\n if ((left.mediaType ?? 'screen') !== (right.mediaType ?? 'screen')) return false;\n return mediaRangesIntersect(left.range, right.range);\n}\n\nexport function findTailwindClassConflicts(\n existingClassNames: readonly string[],\n generatedClassNames: readonly string[],\n): ReadonlySet<string> {\n const generatedTokens = new Set(generatedClassNames);\n const existing = existingClassNames\n .filter(token => !generatedTokens.has(token))\n .map(describeTailwindUtility)\n .filter(descriptor => descriptor !== undefined);\n const conflicts = new Set<string>();\n\n for (const generated of generatedClassNames\n .map(describeTailwindUtility)\n .filter(descriptor => descriptor !== undefined)) {\n const generatedProperties = generated.cssProperties;\n if (generatedProperties.length === 0) continue;\n if (\n existing.some(\n current =>\n activationsIntersect(current.activation, generated.activation) &&\n (current.hasUnknownCssAuthority === true ||\n generated.hasUnknownCssAuthority === true ||\n current.cssProperties.some(currentProperty =>\n generatedProperties.some(generatedProperty => cssPropertiesOverlap(currentProperty, generatedProperty)),\n )),\n )\n ) {\n conflicts.add(generated.token);\n }\n }\n\n return conflicts;\n}\n\nexport function hasTailwindClassConflict(\n existingClassNames: readonly string[],\n generatedClassNames: readonly string[],\n): boolean {\n return findTailwindClassConflicts(existingClassNames, generatedClassNames).size > 0;\n}\n","import { describeTailwindUtility, type TailwindUtilityDescriptor } from '../tailwind-class-conflict';\nimport { hasValidTailwindArbitrarySyntax } from '../tailwind-arbitrary-syntax';\nimport { isByteExactHtmlClassToken } from '../../../edit/html-attribute-value';\nimport {\n isConservativelyAdmittedBorderWidth,\n isConservativelyAdmittedTextLength,\n} from './tailwind-arbitrary-value-ownership';\n\nexport type TailwindCandidateClassification =\n | { readonly status: 'verified'; readonly descriptor: TailwindUtilityDescriptor }\n | { readonly status: 'unverified'; readonly reason: string };\n\ntype CssProperties = readonly string[] | ((value: string) => readonly string[] | undefined);\n\ninterface NamespaceRule {\n readonly namespace: string;\n readonly cssProperties: CssProperties;\n readonly negative?: boolean;\n readonly accepts: (value: string) => boolean;\n readonly acceptsNegative?: (value: string) => boolean;\n}\n\nconst exactTokenRegistry = Object.freeze([\n ['inline', ['display']],\n ['block', ['display']],\n ['inline-block', ['display']],\n ['flow-root', ['display']],\n ['flex', ['display']],\n ['inline-flex', ['display']],\n ['grid', ['display']],\n ['inline-grid', ['display']],\n ['contents', ['display']],\n ['table', ['display']],\n ['inline-table', ['display']],\n ['list-item', ['display']],\n ['hidden', ['display']],\n ['flex-row', ['flex-direction']],\n ['flex-row-reverse', ['flex-direction']],\n ['flex-col', ['flex-direction']],\n ['flex-col-reverse', ['flex-direction']],\n ['flex-wrap', ['flex-wrap']],\n ['flex-wrap-reverse', ['flex-wrap']],\n ['flex-nowrap', ['flex-wrap']],\n ['static', ['position']],\n ['fixed', ['position']],\n ['absolute', ['position']],\n ['relative', ['position']],\n ['sticky', ['position']],\n ['border', ['border-style', 'border-width']],\n ['shadow', ['--tw-shadow', 'box-shadow']],\n ['transition', ['transition-property', 'transition-timing-function', 'transition-duration']],\n ['visible', ['visibility']],\n ['invisible', ['visibility']],\n ['collapse', ['visibility']],\n [\n 'sr-only',\n ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space', 'border-width'],\n ],\n ['not-sr-only', ['position', 'width', 'height', 'padding', 'margin', 'overflow', 'clip-path', 'white-space']],\n] as const);\n\nconst defaultColorNames = Object.freeze([\n 'inherit',\n 'current',\n 'transparent',\n 'black',\n 'white',\n 'red',\n 'orange',\n 'amber',\n 'yellow',\n 'lime',\n 'green',\n 'emerald',\n 'teal',\n 'cyan',\n 'sky',\n 'blue',\n 'indigo',\n 'violet',\n 'purple',\n 'fuchsia',\n 'pink',\n 'rose',\n 'slate',\n 'gray',\n 'zinc',\n 'neutral',\n 'stone',\n] as const);\nconst defaultColorShades = Object.freeze(['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', '950']);\nconst textSizes = Object.freeze([\n 'xs',\n 'sm',\n 'base',\n 'lg',\n 'xl',\n '2xl',\n '3xl',\n '4xl',\n '5xl',\n '6xl',\n '7xl',\n '8xl',\n '9xl',\n]);\n\nfunction isNumber(value: string): boolean {\n return /^(?:0|[1-9]\\d*)(?:\\.\\d+)?$/u.test(value);\n}\n\nfunction isInteger(value: string): boolean {\n return /^(?:0|[1-9]\\d*)$/u.test(value);\n}\n\nfunction isPercentage(value: string): boolean {\n if (!isNumber(value)) return false;\n const number = Number(value);\n return number >= 0 && number <= 100;\n}\n\nfunction hasValidArbitrarySyntax(value: string): boolean {\n return hasValidTailwindArbitrarySyntax(value);\n}\n\nfunction hasCompilerMeaningfulArbitraryValue(value: string): boolean {\n if (!hasValidArbitrarySyntax(value)) return false;\n\n const payload = value\n .slice(1, -1)\n .replace(/\\/\\*[\\s\\S]*?\\*\\//gu, '')\n .replace(/^[a-z][a-z-]*:/iu, '')\n .replace(/[\\s_()[\\]{}'\"`]/gu, '');\n return payload.length > 0;\n}\n\nfunction isCssVariableValue(value: string): boolean {\n return /^\\(--[A-Za-z_][A-Za-z0-9_-]*\\)$/u.test(value);\n}\n\nfunction isArbitraryOrVariable(value: string): boolean {\n return hasCompilerMeaningfulArbitraryValue(value) || isCssVariableValue(value);\n}\n\nfunction isFraction(value: string): boolean {\n const [numerator, denominator, remainder] = value.split('/');\n return remainder === undefined && isInteger(numerator ?? '') && /^[1-9]\\d*$/u.test(denominator ?? '');\n}\n\nfunction isSpacing(value: string): boolean {\n return isNumber(value) || value === 'px' || isArbitraryOrVariable(value);\n}\n\nfunction isMargin(value: string): boolean {\n return isSpacing(value) || value === 'auto';\n}\n\nfunction isFractionalSpacing(value: string): boolean {\n return isSpacing(value) || isFraction(value) || value === 'full';\n}\n\nfunction isInset(value: string): boolean {\n return isFractionalSpacing(value) || value === 'auto';\n}\n\nfunction isDimension(value: string): boolean {\n return (\n isFractionalSpacing(value) ||\n value === 'auto' ||\n ['screen', 'dvh', 'dvw', 'lvh', 'lvw', 'svh', 'svw', 'min', 'max', 'fit'].includes(value)\n );\n}\n\nfunction isWidth(value: string): boolean {\n return isDimension(value) || /^(?:3xs|2xs|xs|sm|md|lg|xl|[2-7]xl)$/u.test(value);\n}\n\nfunction isArbitraryColor(value: string): boolean {\n if (!hasCompilerMeaningfulArbitraryValue(value)) return false;\n const color = value.slice(1, -1);\n return /^(?:color:|#|(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|light-dark|color-mix|var)\\()/u.test(color);\n}\n\nfunction isBackgroundImage(value: string): boolean {\n if (!hasCompilerMeaningfulArbitraryValue(value)) return false;\n const image = value.slice(1, -1);\n return /^(?:image:|url\\(|(?:linear|radial|conic)-gradient\\()/u.test(image);\n}\n\nfunction isColor(value: string): boolean {\n const [color, opacity, remainder] = value.split('/');\n if (remainder !== undefined) return false;\n\n const isDefault =\n ['inherit', 'current', 'transparent', 'black', 'white'].includes(color ?? '') ||\n (defaultColorNames.includes((color?.split('-')[0] ?? '') as (typeof defaultColorNames)[number]) &&\n defaultColorShades.includes((color?.split('-')[1] ?? '') as (typeof defaultColorShades)[number]) &&\n color?.split('-').length === 2);\n if (!isDefault && !isArbitraryColor(color ?? '') && !isCssVariableValue(color ?? '')) return false;\n return opacity === undefined || isPercentage(opacity) || isArbitraryOrVariable(opacity);\n}\n\nfunction isBackgroundColor(value: string): boolean {\n const [color] = value.split('/');\n if (isCssVariableValue(color ?? '')) return false;\n if (/^\\[var\\(/u.test(color ?? '')) return false;\n return isColor(value);\n}\n\nfunction textCssProperties(value: string): readonly string[] | undefined {\n const [size, lineHeight, remainder] = value.split('/');\n const hasVerifiedLineHeight =\n remainder === undefined && (lineHeight === undefined || isNumber(lineHeight) || isArbitraryOrVariable(lineHeight));\n if (textSizes.includes((size ?? '') as (typeof textSizes)[number])) {\n return hasVerifiedLineHeight ? ['font-size', 'line-height'] : undefined;\n }\n const arbitrarySize = size ?? '';\n const hasUnambiguousArbitrarySize =\n hasCompilerMeaningfulArbitraryValue(arbitrarySize) && isConservativelyAdmittedTextLength(arbitrarySize);\n if (hasUnambiguousArbitrarySize) {\n if (!hasVerifiedLineHeight) return undefined;\n return lineHeight === undefined ? ['font-size'] : ['font-size', 'line-height'];\n }\n if (hasCompilerMeaningfulArbitraryValue(value) && /^\\[color:[\\s\\S]+\\]$/u.test(value)) return ['color'];\n if (isColor(value)) return ['color'];\n return undefined;\n}\n\nfunction acceptsText(value: string): boolean {\n return textCssProperties(value) !== undefined;\n}\n\nfunction borderCssProperties(value: string): readonly string[] | undefined {\n if (isInteger(value) || (hasCompilerMeaningfulArbitraryValue(value) && isConservativelyAdmittedBorderWidth(value))) {\n return ['border-style', 'border-width'];\n }\n if (oneOf(['solid', 'dashed', 'dotted', 'double', 'hidden', 'none'])(value)) {\n return ['--tw-border-style', 'border-style'];\n }\n if (isColor(value) || isCssVariableValue(value) || /^\\[(?:color:|var\\()/u.test(value)) {\n return ['border-color'];\n }\n return undefined;\n}\n\nfunction transitionCssProperties(value: string): readonly string[] {\n return value === 'none'\n ? ['transition-property']\n : ['transition-property', 'transition-timing-function', 'transition-duration'];\n}\n\nfunction scaleCssProperties(value: string): readonly string[] | undefined {\n if (isInteger(value)) return ['--tw-scale-x', '--tw-scale-y', '--tw-scale-z', 'scale'];\n return isArbitraryOrVariable(value) ? ['scale'] : undefined;\n}\n\nfunction oneOf(values: readonly string[]): (value: string) => boolean {\n return value => values.includes(value);\n}\n\nconst namespaceRegistry: readonly NamespaceRule[] = Object.freeze([\n {\n namespace: 'items',\n cssProperties: ['align-items'],\n accepts: oneOf(['start', 'end', 'center', 'baseline', 'stretch']),\n },\n { namespace: 'gap', cssProperties: ['gap'], accepts: value => isNumber(value) || isArbitraryOrVariable(value) },\n {\n namespace: 'gap-x',\n cssProperties: ['column-gap'],\n accepts: value => isNumber(value) || isArbitraryOrVariable(value),\n },\n { namespace: 'gap-y', cssProperties: ['row-gap'], accepts: value => isNumber(value) || isArbitraryOrVariable(value) },\n { namespace: 'm', cssProperties: ['margin'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mx', cssProperties: ['margin-inline'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'my', cssProperties: ['margin-block'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mt', cssProperties: ['margin-top'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mr', cssProperties: ['margin-right'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'mb', cssProperties: ['margin-bottom'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n { namespace: 'ml', cssProperties: ['margin-left'], negative: true, accepts: isMargin, acceptsNegative: isSpacing },\n {\n namespace: 'ms',\n cssProperties: ['margin-inline-start'],\n negative: true,\n accepts: isMargin,\n acceptsNegative: isSpacing,\n },\n {\n namespace: 'me',\n cssProperties: ['margin-inline-end'],\n negative: true,\n accepts: isMargin,\n acceptsNegative: isSpacing,\n },\n {\n namespace: 'p',\n cssProperties: ['padding'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'px',\n cssProperties: ['padding-inline'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'py',\n cssProperties: ['padding-block'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pt',\n cssProperties: ['padding-top'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pr',\n cssProperties: ['padding-right'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pb',\n cssProperties: ['padding-bottom'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pl',\n cssProperties: ['padding-left'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'ps',\n cssProperties: ['padding-inline-start'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n {\n namespace: 'pe',\n cssProperties: ['padding-inline-end'],\n accepts: value => isNumber(value) || value === 'px' || isArbitraryOrVariable(value),\n },\n { namespace: 'w', cssProperties: ['width'], accepts: isWidth },\n { namespace: 'h', cssProperties: ['height'], accepts: isDimension },\n { namespace: 'min-w', cssProperties: ['min-width'], accepts: isWidth },\n { namespace: 'min-h', cssProperties: ['min-height'], accepts: isDimension },\n { namespace: 'max-w', cssProperties: ['max-width'], accepts: value => value !== 'auto' && isWidth(value) },\n { namespace: 'max-h', cssProperties: ['max-height'], accepts: value => value !== 'auto' && isDimension(value) },\n { namespace: 'text', cssProperties: textCssProperties, accepts: acceptsText },\n { namespace: 'bg', cssProperties: ['background-color'], accepts: isBackgroundColor },\n { namespace: 'bg', cssProperties: ['background-image'], accepts: isBackgroundImage },\n {\n namespace: 'border',\n cssProperties: borderCssProperties,\n accepts: value => borderCssProperties(value) !== undefined,\n },\n {\n namespace: 'rounded',\n cssProperties: ['border-radius'],\n accepts: value =>\n oneOf(['none', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', 'full'])(value) || isArbitraryOrVariable(value),\n },\n {\n namespace: 'shadow',\n cssProperties: ['--tw-shadow', 'box-shadow'],\n accepts: value => oneOf(['2xs', 'xs', 'sm', 'md', 'lg', 'xl', '2xl', 'none'])(value) || isCssVariableValue(value),\n },\n {\n namespace: 'opacity',\n cssProperties: ['opacity'],\n accepts: value => isPercentage(value) || isArbitraryOrVariable(value),\n },\n {\n namespace: 'overflow',\n cssProperties: ['overflow'],\n accepts: oneOf(['auto', 'hidden', 'clip', 'visible', 'scroll']),\n },\n {\n namespace: 'inset',\n cssProperties: ['inset'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'inset-x',\n cssProperties: ['inset-inline'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'inset-y',\n cssProperties: ['inset-block'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n { namespace: 'top', cssProperties: ['top'], negative: true, accepts: isInset, acceptsNegative: isFractionalSpacing },\n {\n namespace: 'right',\n cssProperties: ['right'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'bottom',\n cssProperties: ['bottom'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'left',\n cssProperties: ['left'],\n negative: true,\n accepts: isInset,\n acceptsNegative: isFractionalSpacing,\n },\n {\n namespace: 'rotate',\n cssProperties: ['rotate'],\n negative: true,\n accepts: value => isInteger(value) || isArbitraryOrVariable(value),\n },\n {\n namespace: 'scale',\n cssProperties: scaleCssProperties,\n accepts: value => scaleCssProperties(value) !== undefined,\n },\n {\n namespace: 'translate',\n cssProperties: ['--tw-translate-x', '--tw-translate-y', 'translate'],\n negative: true,\n accepts: isFractionalSpacing,\n },\n {\n namespace: 'transition',\n cssProperties: transitionCssProperties,\n accepts: oneOf(['all', 'colors', 'opacity', 'shadow', 'transform', 'none']),\n },\n {\n namespace: 'grid-cols',\n cssProperties: ['grid-template-columns'],\n accepts: value => /^[1-9]\\d*$/u.test(value) || oneOf(['none', 'subgrid'])(value) || isArbitraryOrVariable(value),\n },\n { namespace: 'table', cssProperties: ['table-layout'], accepts: oneOf(['auto', 'fixed']) },\n {\n namespace: 'list',\n cssProperties: value => [['disc', 'decimal', 'none'].includes(value) ? 'list-style-type' : 'list-style-position'],\n accepts: oneOf(['disc', 'decimal', 'none', 'inside', 'outside']),\n },\n {\n namespace: 'object',\n cssProperties: value => [\n ['contain', 'cover', 'fill', 'none', 'scale-down'].includes(value) ? 'object-fit' : 'object-position',\n ],\n accepts: oneOf([\n 'contain',\n 'cover',\n 'fill',\n 'none',\n 'scale-down',\n 'bottom',\n 'center',\n 'left',\n 'left-bottom',\n 'left-top',\n 'right',\n 'right-bottom',\n 'right-top',\n 'top',\n ]),\n },\n {\n namespace: 'cursor',\n cssProperties: ['cursor'],\n accepts: oneOf([\n 'auto',\n 'default',\n 'pointer',\n 'wait',\n 'text',\n 'move',\n 'help',\n 'not-allowed',\n 'none',\n 'context-menu',\n 'progress',\n 'cell',\n 'crosshair',\n 'vertical-text',\n 'alias',\n 'copy',\n 'no-drop',\n 'grab',\n 'grabbing',\n 'all-scroll',\n 'col-resize',\n 'row-resize',\n 'n-resize',\n 'e-resize',\n 's-resize',\n 'w-resize',\n 'ne-resize',\n 'nw-resize',\n 'se-resize',\n 'sw-resize',\n 'ew-resize',\n 'ns-resize',\n 'nesw-resize',\n 'nwse-resize',\n 'zoom-in',\n 'zoom-out',\n ]),\n },\n { namespace: 'pointer-events', cssProperties: ['pointer-events'], accepts: oneOf(['auto', 'none']) },\n]);\n\nconst exactVariantRegistry = Object.freeze([\n 'hover',\n 'focus',\n 'focus-within',\n 'focus-visible',\n 'active',\n 'visited',\n 'target',\n 'first',\n 'last',\n 'only',\n 'odd',\n 'even',\n 'disabled',\n 'enabled',\n 'checked',\n 'indeterminate',\n 'required',\n 'valid',\n 'invalid',\n 'dark',\n 'motion-safe',\n 'motion-reduce',\n 'contrast-more',\n 'contrast-less',\n 'portrait',\n 'landscape',\n 'print',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n '2xl',\n] as const);\n\nfunction variantIsVerified(variant: string): boolean {\n return exactVariantRegistry.includes(variant as (typeof exactVariantRegistry)[number]);\n}\n\nfunction parseArbitraryProperty(utility: string): string | undefined {\n if (!hasValidArbitrarySyntax(utility)) return undefined;\n const inner = utility.slice(1, -1);\n const separator = inner.indexOf(':');\n if (separator <= 0) return undefined;\n\n const property = inner.slice(0, separator);\n const value = inner.slice(separator + 1);\n if (!/^(?:--[A-Za-z_][A-Za-z0-9_-]*|[A-Za-z][A-Za-z0-9-]*)$/u.test(property)) return undefined;\n if (value.trim().length === 0) return undefined;\n return property;\n}\n\nfunction registryCssProperties(utility: string): readonly string[] | undefined {\n const exact = exactTokenRegistry.find(([token]) => token === utility);\n if (exact !== undefined) return exact[1];\n\n const negative = utility.startsWith('-');\n const value = negative ? utility.slice(1) : utility;\n for (const rule of namespaceRegistry) {\n const separator = `${rule.namespace}-`;\n if (!value.startsWith(separator)) continue;\n const suffix = value.slice(separator.length);\n if (suffix.length === 0) continue;\n if (negative) {\n if (rule.negative !== true || !(rule.acceptsNegative ?? rule.accepts)(suffix)) continue;\n } else if (!rule.accepts(suffix)) continue;\n return typeof rule.cssProperties === 'function' ? rule.cssProperties(suffix) : rule.cssProperties;\n }\n\n return undefined;\n}\n\nexport class TailwindCandidateClassifier {\n classify(token: string): TailwindCandidateClassification {\n if (!isByteExactHtmlClassToken(token)) {\n return {\n status: 'unverified',\n reason: 'The decoded candidate cannot be emitted as the same raw HTML source token.',\n };\n }\n\n if (token.includes('\\\\')) {\n return { status: 'unverified', reason: 'Source escapes make the Tailwind candidate ambiguous.' };\n }\n\n const descriptor = describeTailwindUtility(token);\n if (descriptor === undefined) {\n return { status: 'unverified', reason: 'The Tailwind candidate has malformed variant or bracket structure.' };\n }\n if (descriptor.hasGeneratedMediaVariant) {\n return {\n status: 'unverified',\n reason: 'Generated exact-media variants cannot be supplied as source candidates.',\n };\n }\n if (!descriptor.variants.every(variantIsVerified)) {\n return {\n status: 'unverified',\n reason: 'The Tailwind candidate contains an unverified or target-changing variant.',\n };\n }\n\n const arbitraryProperty = parseArbitraryProperty(descriptor.utility);\n const cssProperties =\n arbitraryProperty === undefined ? registryCssProperties(descriptor.utility) : [arbitraryProperty];\n if (cssProperties === undefined || cssProperties.length === 0) {\n return { status: 'unverified', reason: 'The utility is not in the compiler-proven built-in registry.' };\n }\n\n return { status: 'verified', descriptor: { ...descriptor, cssProperties } };\n }\n}\n","import type { TailwindTargetProfile } from '../config/tailwind-target-profile';\nimport { TailwindArbitraryPropertyEncoder } from '../adapter/tailwind/extended/tailwind-arbitrary-property.encoder';\nimport { TailwindCandidateClassifier } from '../adapter/tailwind/extended/tailwind-candidate-classifier';\nimport { describeTailwindDisplay } from '../adapter/tailwind/tailwind-class-conflict';\nimport { analyzeTailwindArbitrarySyntax } from '../adapter/tailwind/tailwind-arbitrary-syntax';\nimport type {\n SourceClassTokenClassification,\n SourcePropertyEvidence,\n SourceStyleDeclaration,\n SourceStyleDeclarationClassification,\n} from '../semantic/source-property-evidence';\n\nexport class TailwindSourcePropertyEvidence implements SourcePropertyEvidence {\n private readonly classifier = new TailwindCandidateClassifier();\n private readonly styleEncoder = new TailwindArbitraryPropertyEncoder();\n\n constructor(private readonly profile?: TailwindTargetProfile) {}\n\n classifyClassToken(token: string): SourceClassTokenClassification {\n const prefix = this.profile?.prefix.value;\n if (prefix && !token.startsWith(`${prefix}:`))\n return { status: 'unverified', reason: 'Class is not a utility in the declared prefixed target.' };\n const normalized = prefix ? token.slice(prefix.length + 1) : token;\n const classification = this.classifier.classify(normalized);\n if (classification.status === 'unverified') return classification;\n const display = describeTailwindDisplay(normalized);\n return {\n status: 'verified',\n evidence: {\n source: token,\n properties: classification.descriptor.cssProperties,\n important: classification.descriptor.important || this.profile?.important.value === 'important',\n activation: classification.descriptor.activation,\n ...(display === undefined ? {} : { display: display.utility }),\n },\n };\n }\n\n classifyStyleDeclaration(declaration: SourceStyleDeclaration): SourceStyleDeclarationClassification {\n try {\n const candidate = this.styleEncoder.encode(declaration);\n const arbitrary = analyzeTailwindArbitrarySyntax(candidate);\n return arbitrary === undefined || arbitrary.important\n ? { status: 'unverified', priorityText: arbitrary?.important === true }\n : { status: 'verified' };\n } catch {\n let priorityText = false;\n try {\n priorityText = analyzeTailwindArbitrarySyntax(this.styleEncoder.encode(declaration))?.important === true;\n } catch {\n // The source declaration is not encodable by this target.\n }\n return { status: 'unverified', priorityText };\n }\n }\n}\n","import type { SemanticResult } from './flex-semantic.model';\n\nexport type FlexSelfAlignment = 'auto' | 'start' | 'end' | 'center' | 'baseline' | 'stretch';\n\nexport interface FlexAlignSemantics {\n readonly alignment: FlexSelfAlignment;\n}\n\nconst alignments = new Set<FlexSelfAlignment>(['auto', 'start', 'end', 'center', 'baseline', 'stretch']);\n\nexport function planFlexAlignSemantics(value: string): SemanticResult<FlexAlignSemantics> {\n const alignment = (value.trim() || 'stretch') as FlexSelfAlignment;\n return alignments.has(alignment)\n ? { status: 'planned', value: { alignment } }\n : { status: 'invalid', code: 'invalid-value' };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport {\n planFlexAlignSemantics,\n type FlexAlignSemantics,\n type FlexSelfAlignment,\n} from '../../../flex/flex-align.semantic';\n\nconst selfAlignment: Readonly<Record<FlexSelfAlignment, string>> = {\n auto: 'self-auto',\n start: 'self-start',\n end: 'self-end',\n center: 'self-center',\n baseline: 'self-baseline',\n stretch: 'self-stretch',\n};\n\nexport function renderFlexAlign(value: FlexAlignSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: [selfAlignment[value.alignment]] };\n}\n\nexport function planFlexAlign(value: string): TailwindStrategyResult {\n const planned = planFlexAlignSemantics(value);\n return planned.status === 'planned' ? renderFlexAlign(planned.value) : planned;\n}\n","import type { SemanticResult } from './flex-semantic.model';\n\nexport interface FlexFillSemantics {\n readonly margin: '0';\n readonly width: '100%';\n readonly height: '100%';\n readonly minWidth: '100%';\n readonly minHeight: '100%';\n}\n\nconst fill: FlexFillSemantics = {\n margin: '0',\n width: '100%',\n height: '100%',\n minWidth: '100%',\n minHeight: '100%',\n};\n\nexport function planFlexFillSemantics(): SemanticResult<FlexFillSemantics> {\n return { status: 'planned', value: fill };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexFillSemantics, type FlexFillSemantics } from '../../../flex/flex-fill.semantic';\n\nexport function renderFlexFill(_value: FlexFillSemantics): TailwindStrategyResult {\n return {\n status: 'converted',\n classNames: ['m-0', 'w-full', 'h-full', 'min-w-full', 'min-h-full'],\n };\n}\n\nexport function planFlexFill(): TailwindStrategyResult {\n const planned = planFlexFillSemantics();\n return planned.status === 'planned' ? renderFlexFill(planned.value) : planned;\n}\n","export type ParsedValue<T> = { readonly ok: true; readonly value: T } | { readonly ok: false };\n\nexport type CssLength = string & { readonly __cssLength: unique symbol };\n\nexport interface CssLengthOptions {\n readonly fallbackUnit: 'px' | '%';\n}\n\nconst NUMBER = String.raw`-?(?:\\d+(?:\\.\\d+)?|\\.\\d+)`;\nconst LENGTH = new RegExp(`^${NUMBER}(?:%|px|r?em|v(?:w|h|min|max)|ch|ex|cm|mm|in|pt|pc)$`);\nconst UNITLESS = new RegExp(`^${NUMBER}$`);\nconst CSS_FUNCTION = /^(?:calc|clamp|min|max|var)\\([a-zA-Z0-9_%+*/.,()\\-\\s]+\\)$/;\n\nexport function parseCssLength(source: string, options: CssLengthOptions): ParsedValue<CssLength> {\n const value = source.trim();\n if (UNITLESS.test(value)) {\n return { ok: true, value: `${value}${options.fallbackUnit}` as CssLength };\n }\n if (LENGTH.test(value) || CSS_FUNCTION.test(value)) {\n return { ok: true, value: value as CssLength };\n }\n return { ok: false };\n}\n","import type { ParsedValue } from './css-length';\n\nexport type LayoutDirection = 'row' | 'row-reverse' | 'column' | 'column-reverse';\nexport type LayoutWrap = 'nowrap' | 'wrap' | 'wrap-reverse';\n\nexport interface LayoutSemantics {\n readonly direction: LayoutDirection;\n readonly wrap: LayoutWrap;\n readonly explicitWrap: boolean;\n readonly display: 'flex' | 'inline-flex';\n readonly boxSizing: 'border-box';\n}\n\nconst directions = new Set<LayoutDirection>(['row', 'row-reverse', 'column', 'column-reverse']);\nconst wraps = new Set<LayoutWrap>(['nowrap', 'wrap', 'wrap-reverse']);\n\nexport function parseLayout(value: string): ParsedValue<LayoutSemantics> {\n const tokens = value.split(/\\s+/).filter(Boolean);\n const direction = (tokens.shift() ?? 'row') as LayoutDirection;\n if (!directions.has(direction)) return { ok: false };\n\n const wrapTokens = tokens.filter(token => wraps.has(token as LayoutWrap));\n if (wrapTokens.length > 1) return { ok: false };\n\n let wrap: LayoutWrap = 'nowrap';\n let display: LayoutSemantics['display'] = 'flex';\n for (const token of tokens) {\n if (wraps.has(token as LayoutWrap)) {\n wrap = token as LayoutWrap;\n } else if (token === 'inline' && display === 'flex') {\n display = 'inline-flex';\n } else {\n return { ok: false };\n }\n }\n\n return {\n ok: true,\n value: { direction, wrap, explicitWrap: wrapTokens.length === 1, display, boxSizing: 'border-box' },\n };\n}\n","import { parseCssLength, type CssLength } from './css-length';\nimport type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout, type LayoutSemantics } from './layout.semantic';\n\nexport interface FlexItemInput {\n readonly basis: string;\n readonly grow?: string;\n readonly shrink?: string;\n readonly layout?: string;\n}\n\nexport type FlexBasisSemantics =\n | { readonly kind: 'keyword'; readonly value: 'auto' }\n | { readonly kind: 'literal' | 'computed'; readonly value: CssLength };\n\nexport interface FlexItemSemantics {\n readonly grow: string;\n readonly shrink: string;\n readonly basis: FlexBasisSemantics;\n readonly axis: 'width' | 'height';\n readonly min?: CssLength;\n readonly max?: CssLength;\n readonly boxSizing: 'border-box';\n}\n\nconst FACTOR = /^\\d+(?:\\.\\d+)?$/;\nconst unconstrainedBases = new Set(['0%', '0px', '0.000000001px', 'auto']);\n\nfunction sizingAxis(layout: LayoutSemantics): FlexItemSemantics['axis'] {\n return layout.direction.startsWith('column') ? 'height' : 'width';\n}\n\nexport function planFlexItemSemantics(input: FlexItemInput): SemanticResult<FlexItemSemantics> {\n if (input.layout === undefined) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'Flex sizing depends on a dynamic parent direction or wrapping mode.',\n suggestion: 'Make the parent layout static or migrate this flex item manually.',\n };\n }\n\n const layout = parseLayout(input.layout);\n if (!layout.ok) return { status: 'invalid', code: 'invalid-value' };\n\n let grow = input.grow?.trim() || '1';\n let shrink = input.shrink?.trim() || '1';\n let basis = input.basis.trim();\n const shorthand = basis.startsWith('calc(') ? undefined : basis.match(/^(\\S+)\\s+(\\S+)\\s+(.+)$/);\n if (shorthand) {\n grow = shorthand[1] ?? grow;\n shrink = shorthand[2] ?? shrink;\n basis = shorthand[3] ?? basis;\n } else if (basis.split(/\\s+/).length > 1 && !basis.startsWith('calc(')) {\n return { status: 'invalid', code: 'invalid-value' };\n }\n if (!FACTOR.test(grow) || !FACTOR.test(shrink)) return { status: 'invalid', code: 'invalid-value' };\n\n const axis = sizingAxis(layout.value);\n let isValue = false;\n let usingCalc = false;\n\n if (!basis) {\n basis = axis === 'width' ? '0%' : '0.000000001px';\n } else if (basis === 'initial' || basis === 'nogrow') {\n grow = '0';\n basis = 'auto';\n } else if (basis === 'grow') {\n basis = '100%';\n } else if (basis === 'noshrink') {\n shrink = '0';\n basis = 'auto';\n } else if (basis === 'none') {\n grow = '0';\n shrink = '0';\n basis = 'auto';\n } else if (basis !== 'auto') {\n const parsed = parseCssLength(basis, { fallbackUnit: '%' });\n if (!parsed.ok) return { status: 'invalid', code: 'invalid-value' };\n basis = parsed.value;\n usingCalc = basis.startsWith('calc(');\n isValue = usingCalc || !basis.endsWith('%');\n if (basis === '0px') basis = '0%';\n }\n\n const fixed = grow === '0' && shrink === '0';\n const constrainedBasis = basis as CssLength;\n const min = !unconstrainedBases.has(basis) && (fixed || (isValue && grow !== '0')) ? constrainedBasis : undefined;\n const max =\n !unconstrainedBases.has(basis) && (fixed || (!usingCalc && shrink !== '0')) ? constrainedBasis : undefined;\n const effectiveBasis =\n min || max ? (layout.value.wrap === 'wrap' ? (max ?? min ?? basis) : isValue ? basis : '100%') : basis;\n const semanticBasis: FlexBasisSemantics =\n effectiveBasis === 'auto'\n ? { kind: 'keyword', value: effectiveBasis }\n : { kind: effectiveBasis.startsWith('calc(') ? 'computed' : 'literal', value: effectiveBasis as CssLength };\n\n return {\n status: 'planned',\n value: { grow, shrink, basis: semanticBasis, axis, min, max, boxSizing: 'border-box' },\n };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexItemSemantics, type FlexItemInput, type FlexItemSemantics } from '../../../flex/flex-item.semantic';\n\nconst property = (name: string, value: string) => `[${name}:${value.replaceAll(/\\s+/g, '_')}]`;\n\nexport function renderFlexItem(value: FlexItemSemantics): readonly string[] {\n const flexClasses =\n value.basis.kind === 'computed'\n ? [\n property('flex-grow', value.grow),\n property('flex-shrink', value.shrink),\n property('flex-basis', value.basis.value),\n ]\n : [property('flex', `${value.grow} ${value.shrink} ${value.basis.value}`)];\n return [\n ...flexClasses,\n ...(value.min ? [property(`min-${value.axis}`, value.min)] : []),\n ...(value.max ? [property(`max-${value.axis}`, value.max)] : []),\n { 'border-box': 'box-border' }[value.boxSizing],\n ];\n}\n\nexport function planFlexItem(input: FlexItemInput): TailwindStrategyResult {\n const planned = planFlexItemSemantics(input);\n return planned.status === 'planned' ? { status: 'converted', classNames: renderFlexItem(planned.value) } : planned;\n}\n","import { parseCssLength, type CssLength } from './css-length';\nimport type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout } from './layout.semantic';\n\nexport interface FlexOffsetSemantics {\n readonly axis: 'inline-start' | 'block-start';\n readonly length: CssLength;\n}\n\nexport function planFlexOffsetSemantics(\n value: string,\n layoutValue: string | undefined,\n): SemanticResult<FlexOffsetSemantics> {\n const offset = parseCssLength(value.trim() || '0', { fallbackUnit: '%' });\n if (!offset.ok) return { status: 'invalid', code: 'invalid-value' };\n if (layoutValue === undefined) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'The offset margin axis depends on a dynamic parent layout.',\n suggestion: 'Make the parent layout static or migrate the offset manually.',\n };\n }\n\n const layout = parseLayout(layoutValue);\n if (!layout.ok) return { status: 'invalid', code: 'invalid-value' };\n return {\n status: 'planned',\n value: { axis: layout.value.direction.startsWith('column') ? 'block-start' : 'inline-start', length: offset.value },\n };\n}\n","export function arbitraryValue(value: string): string {\n return `[${value.replaceAll(/\\s+/g, '_')}]`;\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexOffsetSemantics, type FlexOffsetSemantics } from '../../../flex/flex-offset.semantic';\nimport { arbitraryValue } from '../tailwind-value.parser';\n\nconst marginPrefix: Readonly<Record<FlexOffsetSemantics['axis'], string>> = {\n 'inline-start': 'ms',\n 'block-start': 'mt',\n};\n\nexport function renderFlexOffset(value: FlexOffsetSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: [`${marginPrefix[value.axis]}-${arbitraryValue(value.length)}`] };\n}\n\nexport function planFlexOffset(value: string, layoutValue: string | undefined): TailwindStrategyResult {\n const planned = planFlexOffsetSemantics(value, layoutValue);\n return planned.status === 'planned' ? renderFlexOffset(planned.value) : planned;\n}\n","import type { SemanticResult } from './flex-semantic.model';\n\nexport interface FlexOrderSemantics {\n readonly order: number | undefined;\n}\n\nexport function planFlexOrderSemantics(value: string): SemanticResult<FlexOrderSemantics> {\n const order = Number.parseInt(value.trim(), 10) || undefined;\n return { status: 'planned', value: { order } };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planFlexOrderSemantics, type FlexOrderSemantics } from '../../../flex/flex-order.semantic';\n\nexport function renderFlexOrder(value: FlexOrderSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: value.order === undefined ? [] : [`[order:${value.order}]`] };\n}\n\nexport function planFlexOrder(value: string): TailwindStrategyResult {\n const planned = planFlexOrderSemantics(value);\n return planned.status === 'planned' ? renderFlexOrder(planned.value) : planned;\n}\n","import type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout, type LayoutSemantics } from './layout.semantic';\n\nexport type LayoutMainAlignment = 'start' | 'center' | 'end' | 'space-around' | 'space-between' | 'space-evenly';\nexport type LayoutItemsAlignment = 'start' | 'center' | 'end' | 'baseline' | 'stretch';\nexport type LayoutContentAlignment = 'start' | 'center' | 'end' | 'stretch' | 'space-around' | 'space-between';\n\nexport interface LayoutAlignmentSemantics {\n readonly main: LayoutMainAlignment;\n readonly items: LayoutItemsAlignment;\n readonly content: LayoutContentAlignment;\n readonly stretchMaximum?: 'width' | 'height';\n readonly layout: LayoutSemantics;\n}\n\nconst mainAxis: Readonly<Record<string, LayoutMainAlignment>> = {\n start: 'start',\n 'flex-start': 'start',\n center: 'center',\n end: 'end',\n 'flex-end': 'end',\n 'space-around': 'space-around',\n 'space-between': 'space-between',\n 'space-evenly': 'space-evenly',\n};\n\nconst crossAxis: Readonly<Record<string, readonly [LayoutItemsAlignment, LayoutContentAlignment]>> = {\n start: ['start', 'start'],\n 'flex-start': ['start', 'start'],\n center: ['center', 'center'],\n end: ['end', 'end'],\n 'flex-end': ['end', 'end'],\n 'space-between': ['stretch', 'space-between'],\n 'space-around': ['stretch', 'space-around'],\n baseline: ['baseline', 'stretch'],\n stretch: ['stretch', 'stretch'],\n};\n\nexport function planLayoutAlignment(value: string, layoutValue: string): SemanticResult<LayoutAlignmentSemantics> {\n const values = value.split(/\\s+/).filter(Boolean);\n if (values.length > 2) return { status: 'invalid', code: 'invalid-value' };\n\n const main = mainAxis[values[0] ?? 'start'];\n const crossKey = values[1] ?? 'stretch';\n const cross = crossAxis[crossKey];\n const layout = parseLayout(layoutValue);\n if (!main || !cross || !layout.ok) return { status: 'invalid', code: 'invalid-value' };\n\n const stretchMaximum =\n crossKey === 'stretch'\n ? layout.value.direction === 'row' || layout.value.direction === 'row-reverse'\n ? 'height'\n : 'width'\n : undefined;\n\n return {\n status: 'planned',\n value: { main, items: cross[0], content: cross[1], stretchMaximum, layout: layout.value },\n };\n}\n","import { parseLayout, type LayoutSemantics } from '../../../flex/layout.semantic';\nimport type { ParsedValue } from '../../../flex/css-length';\n\nexport interface TailwindClassPlan {\n readonly classNames: readonly string[];\n}\n\nexport function renderLayout(layout: LayoutSemantics): readonly string[] {\n const display = { flex: 'flex', 'inline-flex': 'inline-flex' }[layout.display];\n const direction = {\n row: 'flex-row',\n 'row-reverse': 'flex-row-reverse',\n column: 'flex-col',\n 'column-reverse': 'flex-col-reverse',\n }[layout.direction];\n const wrap = layout.explicitWrap ? [`flex-${layout.wrap}`] : [];\n const boxSizing = { 'border-box': 'box-border' }[layout.boxSizing];\n return [display, direction, ...wrap, boxSizing];\n}\n\nexport function planLayout(value: string): ParsedValue<TailwindClassPlan> {\n const parsed = parseLayout(value);\n return parsed.ok ? { ok: true, value: { classNames: renderLayout(parsed.value) } } : parsed;\n}\n","import type { ParsedValue } from '../../../flex/css-length';\nimport {\n planLayoutAlignment,\n type LayoutAlignmentSemantics,\n type LayoutContentAlignment,\n type LayoutItemsAlignment,\n type LayoutMainAlignment,\n} from '../../../flex/layout-align.semantic';\nimport { renderLayout, type TailwindClassPlan } from './layout.strategy';\n\nconst mainAxis: Readonly<Record<LayoutMainAlignment, string>> = {\n start: 'start',\n center: 'center',\n end: 'end',\n 'space-around': 'around',\n 'space-between': 'between',\n 'space-evenly': 'evenly',\n};\n\nconst itemsAxis: Readonly<Record<LayoutItemsAlignment, string>> = {\n start: 'start',\n center: 'center',\n end: 'end',\n baseline: 'baseline',\n stretch: 'stretch',\n};\n\nconst contentAxis: Readonly<Record<LayoutContentAlignment, string>> = {\n start: 'start',\n center: 'center',\n end: 'end',\n stretch: 'stretch',\n 'space-around': 'around',\n 'space-between': 'between',\n};\n\nexport function renderLayoutAlignment(alignment: LayoutAlignmentSemantics): TailwindClassPlan {\n const sizing =\n alignment.stretchMaximum === 'height' ? ['max-h-full'] : alignment.stretchMaximum === 'width' ? ['max-w-full'] : [];\n return {\n classNames: [\n `justify-${mainAxis[alignment.main]}`,\n `items-${itemsAxis[alignment.items]}`,\n `content-${contentAxis[alignment.content]}`,\n ...renderLayout(alignment.layout),\n ...sizing,\n ],\n };\n}\n\nexport function planLayoutAlign(value: string, layoutValue: string): ParsedValue<TailwindClassPlan> {\n const planned = planLayoutAlignment(value, layoutValue);\n return planned.status === 'planned' ? { ok: true, value: renderLayoutAlignment(planned.value) } : { ok: false };\n}\n","import { parseCssLength, type CssLength } from './css-length';\nimport type { SemanticResult } from './flex-semantic.model';\nimport { parseLayout } from './layout.semantic';\n\nexport interface LayoutGapSemantics {\n readonly length: CssLength;\n}\n\nexport function planLayoutGapSemantics(\n value: string,\n layoutValue: string | undefined,\n): SemanticResult<LayoutGapSemantics> {\n const normalized = value.trim();\n if (!normalized) return { status: 'invalid', code: 'invalid-value' };\n\n if (normalized.endsWith(' grid')) {\n return {\n status: 'review',\n code: 'semantic-unsupported',\n reason: 'The Flex-Layout grid gap mode changes child padding and compensating host margins.',\n suggestion: 'Replace the grid gap manually after reviewing the child padding behavior.',\n };\n }\n\n const length = parseCssLength(normalized, { fallbackUnit: 'px' });\n if (!length.ok) return { status: 'invalid', code: 'invalid-value' };\n if (length.value.startsWith('-')) {\n return {\n status: 'review',\n code: 'semantic-unsupported',\n reason: 'Flex-Layout accepts a negative margin gap, but CSS gap does not accept negative values.',\n suggestion: 'Preserve the margin-based spacing or migrate the child margins manually.',\n };\n }\n if (length.value.includes('(')) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'The computed gap may resolve to a negative value that CSS gap cannot represent.',\n suggestion: 'Prove the value is nonnegative or migrate the margin-based spacing manually.',\n };\n }\n if (layoutValue === undefined) {\n return {\n status: 'review',\n code: 'context-unverified',\n reason: 'The active flex direction and wrapping behavior depend on a dynamic layout.',\n suggestion: 'Make the layout static or migrate the gap and responsive layout together.',\n };\n }\n\n const layout = parseLayout(layoutValue);\n if (!layout.ok) return { status: 'invalid', code: 'invalid-value' };\n if (layout.value.wrap !== 'nowrap') {\n return {\n status: 'review',\n code: 'semantic-unsupported',\n reason: 'Flex-Layout margins and CSS gap differ when flex items wrap across lines.',\n suggestion: 'Verify the wrapped layout and migrate its spacing manually.',\n };\n }\n\n return { status: 'planned', value: { length: length.value } };\n}\n","import type { TailwindStrategyResult } from '../tailwind-semantic.model';\nimport { planLayoutGapSemantics, type LayoutGapSemantics } from '../../../flex/layout-gap.semantic';\nimport { arbitraryValue } from '../tailwind-value.parser';\n\nexport function renderLayoutGap(gap: LayoutGapSemantics): TailwindStrategyResult {\n return { status: 'converted', classNames: [`gap-${arbitraryValue(gap.length)}`] };\n}\n\nexport function planLayoutGap(value: string, layoutValue: string | undefined): TailwindStrategyResult {\n const planned = planLayoutGapSemantics(value, layoutValue);\n return planned.status === 'planned' ? renderLayoutGap(planned.value) : planned;\n}\n","import type { BreakpointDefinition, MediaClause, MediaDefinition } from '../../breakpoint/breakpoint-catalog';\nimport { describeTailwindUtility } from './tailwind-class-conflict';\n\nexport class ResponsiveVariantEmitter {\n emit(definition: BreakpointDefinition, utility: string): readonly string[] {\n const descriptor = describeTailwindUtility(utility);\n if (descriptor === undefined) {\n throw new Error('Cannot decorate a malformed Tailwind utility');\n }\n if (descriptor.variants.length > 0) {\n throw new Error('Cannot decorate an already-variant utility');\n }\n\n return definition.media.clauses.map(clause => `[${this.mediaQuery(definition.media, clause)}]:${utility}`);\n }\n\n emitCandidate(definition: BreakpointDefinition, candidate: string): readonly string[] {\n const descriptor = describeTailwindUtility(candidate);\n if (descriptor === undefined) {\n throw new Error('Cannot decorate a malformed Tailwind candidate');\n }\n if (descriptor.hasGeneratedMediaVariant) {\n throw new Error('Cannot decorate a candidate containing a generated media variant');\n }\n\n return definition.media.clauses.map(clause => `[${this.mediaQuery(definition.media, clause)}]:${candidate}`);\n }\n\n private mediaQuery(media: MediaDefinition, clause: MediaClause): string {\n if (media.type === 'print') return '@media_print';\n\n const conditions = [\n clause.orientation === undefined ? undefined : `(orientation:_${clause.orientation})`,\n clause.min === undefined ? undefined : `(min-width:_${clause.min}px)`,\n clause.max === undefined ? undefined : `(max-width:_${clause.max}px)`,\n ].filter((condition): condition is string => condition !== undefined);\n\n const medium = clause.orientation === undefined ? 'screen_and_' : '';\n return `@media_${medium}${conditions.join('_and_')}`;\n }\n}\n","import { ResponsiveVariantEmitter } from '../responsive-variant.emitter';\nimport { describeTailwindUtility } from '../tailwind-class-conflict';\nimport type { ExtendedResponsiveState, ResponsiveClassValue } from '../../../semantic/extended/responsive-class.model';\nimport type { ResponsiveStyleValue } from '../../../semantic/extended/responsive-style.model';\nimport { TailwindArbitraryPropertyEncoder } from './tailwind-arbitrary-property.encoder';\nimport { TailwindCandidateClassifier } from './tailwind-candidate-classifier';\n\nexport class ExtendedResponsiveEmitter {\n constructor(\n private readonly responsiveEmitter = new ResponsiveVariantEmitter(),\n private readonly styleEncoder = new TailwindArbitraryPropertyEncoder(),\n private readonly classifier = new TailwindCandidateClassifier(),\n ) {}\n\n emitClass(state: ExtendedResponsiveState<ResponsiveClassValue>): readonly string[] {\n const emitted: string[] = [];\n const seen = new Set<string>();\n\n for (const token of state.value.tokens) {\n if (seen.has(token)) continue;\n seen.add(token);\n\n const classification = this.classifier.classify(token);\n if (classification.status !== 'verified' || classification.descriptor.cssProperties.length === 0) {\n throw new Error('Cannot emit an unverified or ungrouped Tailwind class candidate.');\n }\n emitted.push(...this.responsiveEmitter.emitCandidate(state.activation.definition, token));\n }\n\n return emitted;\n }\n\n emitStyle(state: ExtendedResponsiveState<ResponsiveStyleValue>): readonly string[] {\n const emitted: string[] = [];\n const seen = new Set<string>();\n\n for (const declaration of state.value.declarations) {\n const candidate = this.styleEncoder.encode(declaration);\n if (seen.has(candidate)) continue;\n seen.add(candidate);\n\n const descriptor = describeTailwindUtility(candidate);\n if (descriptor === undefined || descriptor.cssProperties.length === 0) {\n throw new Error('Cannot emit an ungrouped Tailwind arbitrary-property candidate.');\n }\n emitted.push(...this.responsiveEmitter.emitCandidate(state.activation.definition, candidate));\n }\n\n return emitted;\n }\n}\n","import type { GridSemanticPlan } from '../../../grid/grid-semantic.model';\n\nexport type TailwindGridRenderResult =\n | { readonly status: 'rendered'; readonly classNames: readonly string[] }\n | {\n readonly status: 'review';\n readonly code: 'tailwind-candidate-unverified';\n readonly reason: string;\n };\n\nfunction encode(property: string, value: string): string | undefined {\n const containsControl = [...value].some(character => {\n const codePoint = character.codePointAt(0);\n return codePoint !== undefined && (codePoint < 0x20 || codePoint === 0x7f);\n });\n if (\n value.length === 0 ||\n containsControl ||\n /[{}'<>]/u.test(value) ||\n value.includes('\\\\') ||\n value.includes('/*') ||\n value.includes('*/')\n ) {\n return undefined;\n }\n let encodedValue: string;\n if (property === 'grid-template-areas') {\n if (!/^(?:\"[^\"]*\")(?:\\s+\"[^\"]*\")*$/u.test(value)) return undefined;\n encodedValue = value.replaceAll('\"', \"'\").replaceAll(' ', '_');\n } else {\n if (value.includes('\"')) return undefined;\n encodedValue = value.replaceAll('_', '\\\\_').replaceAll(' ', '_');\n }\n const candidate = `[${property}:${encodedValue}]`;\n return candidate.length > 0 && !/[\\t\\n\\f\\r \"<]/u.test(candidate) && !/&(?:#|[a-z\\d])/iu.test(candidate)\n ? candidate\n : undefined;\n}\n\nexport class TailwindGridRenderer {\n render(plan: GridSemanticPlan): TailwindGridRenderResult {\n const classNames: string[] = [];\n for (const declaration of plan.declarations) {\n const candidate = encode(declaration.property, declaration.value);\n if (candidate === undefined) {\n return {\n status: 'review',\n code: 'tailwind-candidate-unverified',\n reason: `${declaration.property}: ${declaration.value} cannot be represented as an exact Tailwind class token.`,\n };\n }\n classNames.push(candidate);\n }\n return { status: 'rendered', classNames };\n }\n}\n","import { ResponsiveVariantEmitter } from '../responsive-variant.emitter';\nimport type { VisibilityState } from '../../../semantic/visibility/visibility.model';\n\nexport class VisibilityEmitter {\n constructor(private readonly responsiveEmitter = new ResponsiveVariantEmitter()) {}\n\n emit(state: VisibilityState, restorationUtility: string | undefined): readonly string[] {\n const utility = state.intent === 'hidden' ? 'hidden' : restorationUtility;\n if (utility === undefined) return [];\n if (state.activation.kind === 'base') return [utility];\n return this.responsiveEmitter.emit(state.activation.definition, utility);\n }\n}\n","import type { DiagnosticCode } from '../analyzer/conversion-result';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { BreakpointDefinition } from '../breakpoint/breakpoint-catalog';\nimport type { FlexAlignSemantics } from '../flex/flex-align.semantic';\nimport type { FlexFillSemantics } from '../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../flex/flex-offset.semantic';\nimport type { FlexOrderSemantics } from '../flex/flex-order.semantic';\nimport type { LayoutAlignmentSemantics } from '../flex/layout-align.semantic';\nimport type { LayoutGapSemantics } from '../flex/layout-gap.semantic';\nimport type { LayoutSemantics } from '../flex/layout.semantic';\nimport type { GridSemanticPlan } from '../grid/grid-semantic.model';\nimport type { SourceClassTokenEvidence } from './source-property-evidence';\n\nexport type DirectiveFamily =\n | 'layout'\n | 'layout-gap'\n | 'layout-align'\n | 'flex-item'\n | 'flex-align'\n | 'flex-fill'\n | 'flex-offset'\n | 'flex-order'\n | 'visibility'\n | 'extended-class'\n | 'extended-style'\n | 'grid-align-columns'\n | 'grid-align-rows'\n | 'grid-area'\n | 'grid-areas'\n | 'grid-auto'\n | 'grid-column'\n | 'grid-columns'\n | 'grid-gap'\n | 'grid-align'\n | 'grid-inline'\n | 'grid-row'\n | 'grid-rows';\n\nexport type SemanticPlan<TValue> =\n | {\n readonly status: 'planned';\n readonly input: LocatedFlexLayoutInput;\n readonly family: DirectiveFamily;\n readonly value: TValue;\n }\n | {\n readonly status: 'review' | 'invalid' | 'unsupported';\n readonly input: LocatedFlexLayoutInput;\n readonly code: DiagnosticCode;\n readonly reason: string;\n readonly suggestion: string;\n };\n\nexport type SemanticActivation =\n { readonly kind: 'base' } | { readonly kind: 'media'; readonly definition: BreakpointDefinition };\n\nexport interface VisibilitySemantics {\n readonly kind: 'visibility';\n readonly emit: boolean;\n readonly states: readonly VisibilitySemanticState[];\n readonly restorationDisplay?: string;\n}\n\nexport interface VisibilitySemanticState {\n readonly intent: 'shown' | 'hidden';\n readonly activation: SemanticActivation;\n}\n\nexport interface ExtendedClassSemanticState {\n readonly activations: readonly SemanticActivation[];\n readonly tokens: readonly SourceClassTokenEvidence[];\n}\n\nexport interface ExtendedClassSemantics {\n readonly kind: 'extended-class';\n readonly emit: boolean;\n readonly states: readonly ExtendedClassSemanticState[];\n readonly retainedTokens: readonly SourceClassTokenEvidence[];\n}\n\nexport interface ExtendedStyleDeclaration {\n readonly property: string;\n readonly value: string;\n}\n\nexport interface ExtendedStyleSemanticState {\n readonly activations: readonly SemanticActivation[];\n readonly declarations: readonly ExtendedStyleDeclaration[];\n}\n\nexport interface ExtendedStyleSemantics {\n readonly kind: 'extended-style';\n readonly emit: boolean;\n readonly states: readonly ExtendedStyleSemanticState[];\n}\n\nexport interface EmptySemantics {\n readonly kind: 'empty';\n}\n\nexport interface SuppressedSemanticEffect {\n readonly activation: SemanticActivation;\n readonly properties: readonly string[];\n readonly important: boolean;\n}\n\nexport type ResolvedSemanticValue =\n | LayoutSemantics\n | LayoutGapSemantics\n | LayoutAlignmentSemantics\n | FlexItemSemantics\n | FlexAlignSemantics\n | FlexFillSemantics\n | FlexOffsetSemantics\n | FlexOrderSemantics\n | GridSemanticPlan\n | VisibilitySemantics\n | ExtendedClassSemantics\n | ExtendedStyleSemantics\n | EmptySemantics;\n\n/** A target-free semantic decision ready for exactly one target renderer. */\nexport interface ResolvedSemanticPlan {\n readonly status: 'converted';\n readonly input: LocatedFlexLayoutInput;\n readonly family: DirectiveFamily;\n readonly value: ResolvedSemanticValue;\n readonly activations: readonly SemanticActivation[];\n readonly suppressedProperties?: readonly string[];\n readonly suppressedEffects?: readonly SuppressedSemanticEffect[];\n readonly emitGridDisplay?: boolean;\n}\n\n/** A target-free diagnostic produced while resolving semantic meaning and dependencies. */\nexport interface UnresolvedSemanticPlan {\n readonly status: 'review' | 'invalid' | 'unsupported';\n readonly input: LocatedFlexLayoutInput;\n readonly code: DiagnosticCode;\n readonly reason: string;\n readonly suggestion: string;\n}\n\n/** The complete target-independent outcome of semantic planning. */\nexport type SemanticPlanningPlan = ResolvedSemanticPlan | UnresolvedSemanticPlan;\n\n/** Lets dependency closure operate on semantic plans before rendering and target plans afterward. */\nexport type SemanticDependencyPlan<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n> = TConverted | UnresolvedSemanticPlan;\n\nconst familyByDirective = new Map<LocatedFlexLayoutInput['directive'], DirectiveFamily>([\n ['fxLayout', 'layout'],\n ['fxLayoutGap', 'layout-gap'],\n ['fxLayoutAlign', 'layout-align'],\n ['fxFlex', 'flex-item'],\n ['fxGrow', 'flex-item'],\n ['fxShrink', 'flex-item'],\n ['fxFlexAlign', 'flex-align'],\n ['fxFlexFill', 'flex-fill'],\n ['fxFill', 'flex-fill'],\n ['fxFlexOffset', 'flex-offset'],\n ['fxFlexOrder', 'flex-order'],\n ['fxShow', 'visibility'],\n ['fxHide', 'visibility'],\n ['class', 'extended-class'],\n ['ngClass', 'extended-class'],\n ['style', 'extended-style'],\n ['ngStyle', 'extended-style'],\n ['gdAlignColumns', 'grid-align-columns'],\n ['gdAlignRows', 'grid-align-rows'],\n ['gdArea', 'grid-area'],\n ['gdAreas', 'grid-areas'],\n ['gdAuto', 'grid-auto'],\n ['gdColumn', 'grid-column'],\n ['gdColumns', 'grid-columns'],\n ['gdGap', 'grid-gap'],\n ['gdGridAlign', 'grid-align'],\n ['gdInline', 'grid-inline'],\n ['gdRow', 'grid-row'],\n ['gdRows', 'grid-rows'],\n]);\n\nexport function directiveFamily(directive: LocatedFlexLayoutInput['directive']): DirectiveFamily | undefined {\n return familyByDirective.get(directive);\n}\n","import { normalizeTargetCandidate, renderTargetCandidate } from '../../config/tailwind-candidate-profile';\nimport { resolveTailwindTargetProfile, type TailwindTargetProfile } from '../../config/tailwind-target-profile';\nimport type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport type { BreakpointMigrationConfig } from '../../config/breakpoint-migration-config';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport type { FlexAlignSemantics } from '../../flex/flex-align.semantic';\nimport type { FlexFillSemantics } from '../../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../../flex/flex-offset.semantic';\nimport type { FlexOrderSemantics } from '../../flex/flex-order.semantic';\nimport type { LayoutAlignmentSemantics } from '../../flex/layout-align.semantic';\nimport type { LayoutGapSemantics } from '../../flex/layout-gap.semantic';\nimport type { LayoutSemantics } from '../../flex/layout.semantic';\nimport type { GridSemanticPlan } from '../../grid/grid-semantic.model';\nimport { TailwindSourcePropertyEvidence } from '../../evidence/tailwind-source-property.evidence';\nimport { renderFlexAlign } from '../../adapter/tailwind/directives/flex-align.strategy';\nimport { renderFlexFill } from '../../adapter/tailwind/directives/flex-fill.strategy';\nimport { renderFlexItem } from '../../adapter/tailwind/directives/flex-item.strategy';\nimport { renderFlexOffset } from '../../adapter/tailwind/directives/flex-offset.strategy';\nimport { renderFlexOrder } from '../../adapter/tailwind/directives/flex-order.strategy';\nimport { renderLayoutAlignment } from '../../adapter/tailwind/directives/layout-align.strategy';\nimport { renderLayoutGap } from '../../adapter/tailwind/directives/layout-gap.strategy';\nimport { renderLayout } from '../../adapter/tailwind/directives/layout.strategy';\nimport { ExtendedResponsiveEmitter } from '../../adapter/tailwind/extended/extended-responsive.emitter';\nimport { TailwindGridRenderer } from '../../adapter/tailwind/grid/tailwind-grid.renderer';\nimport {\n describeTailwindDisplay,\n describeTailwindUtility,\n findTailwindClassConflicts,\n} from '../../adapter/tailwind/tailwind-class-conflict';\nimport { cssPropertiesOverlap } from '../../semantic/css-property-ownership';\nimport { ResponsiveVariantEmitter } from '../../adapter/tailwind/responsive-variant.emitter';\nimport { VisibilityEmitter } from '../../adapter/tailwind/visibility/visibility.emitter';\nimport type { SemanticConversionContext } from '../../semantic/conversion-context';\nimport {\n directiveFamily,\n type ExtendedClassSemantics,\n type ExtendedStyleSemantics,\n type ResolvedSemanticPlan,\n type VisibilitySemantics,\n} from '../../semantic/semantic-plan';\nimport type { ConversionRenderer, PlannedConversion } from '../conversion-renderer';\n\nconst sharedDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'fxLayout',\n 'fxLayoutGap',\n 'fxLayoutAlign',\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexAlign',\n 'fxFlexFill',\n 'fxFill',\n 'fxFlexOffset',\n 'fxFlexOrder',\n]);\nconst visibilityDirectives = new Set<LocatedFlexLayoutInput['directive']>(['fxShow', 'fxHide']);\nconst extendedDirectives = new Set<LocatedFlexLayoutInput['directive']>(['class', 'ngClass', 'style', 'ngStyle']);\nconst gridDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdArea',\n 'gdAreas',\n 'gdAuto',\n 'gdColumn',\n 'gdColumns',\n 'gdGap',\n 'gdGridAlign',\n 'gdInline',\n 'gdRow',\n 'gdRows',\n]);\n\nfunction compatibleVisibilityClasses(\n plan: Extract<PlannedConversion, { readonly status: 'converted' }>,\n existingClassNames: readonly string[],\n): readonly string[] {\n if (!visibilityDirectives.has(plan.input.directive)) return existingClassNames;\n const generatedDisplays = plan.classNames.map(describeTailwindDisplay).filter(descriptor => descriptor !== undefined);\n const hasBaseHidden = generatedDisplays.some(\n descriptor => descriptor.activation.kind === 'base' && descriptor.utility === 'hidden',\n );\n return existingClassNames.filter(className => {\n const existing = describeTailwindDisplay(className);\n if (\n !existing ||\n existing.activation.kind !== 'base' ||\n existing.important ||\n existing.token !== existing.utility ||\n existing.utility === 'hidden'\n ) {\n return true;\n }\n const suppliesResponsiveVisibility = hasBaseHidden\n ? generatedDisplays.some(\n generated => generated.activation.kind === 'media' && generated.utility === existing.utility,\n )\n : generatedDisplays.length > 0 && generatedDisplays.every(generated => generated.activation.kind === 'media');\n return !suppliesResponsiveVisibility;\n });\n}\n\nexport class TailwindRenderer implements ConversionRenderer {\n readonly target = 'tailwind' as const;\n readonly breakpointConfig: BreakpointMigrationConfig;\n readonly sourcePropertyEvidence: TailwindSourcePropertyEvidence;\n readonly targetProfile: TailwindTargetProfile;\n private readonly responsiveEmitter = new ResponsiveVariantEmitter();\n private readonly visibilityEmitter = new VisibilityEmitter();\n private readonly extendedEmitter = new ExtendedResponsiveEmitter();\n private readonly gridRenderer = new TailwindGridRenderer();\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n this.targetProfile = config.targetProfile ?? resolveTailwindTargetProfile();\n this.breakpointConfig = Object.freeze({ ...config });\n this.sourcePropertyEvidence = new TailwindSourcePropertyEvidence(this.targetProfile);\n }\n\n eligibility(input: LocatedFlexLayoutInput): PlannedConversion | undefined {\n const unresolved = this.targetProfile.diagnostics.filter(\n item =>\n item.code === 'tailwind-prefix-conflict' ||\n item.code === 'tailwind-target-unknown' ||\n (['tailwind-config-external', 'tailwind-plugin-external', 'tailwind-import-unresolved'].includes(item.code) &&\n (this.targetProfile.coreUtilities.value === 'unknown' ||\n this.targetProfile.prefix.confidence !== 'explicit' ||\n this.targetProfile.important.confidence !== 'explicit')),\n );\n if (unresolved.length)\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: `Target configuration is unresolved: ${unresolved.map(item => item.message).join(' ')}`,\n suggestion: 'Resolve the target stylesheet or supply explicit migration profile settings before migrating.',\n };\n\n if (input.binding !== 'property') {\n if (\n !sharedDirectives.has(input.directive) &&\n !visibilityDirectives.has(input.directive) &&\n !extendedDirectives.has(input.directive) &&\n !gridDirectives.has(input.directive)\n ) {\n return {\n status: 'unsupported',\n input,\n code: 'target-unsupported',\n reason: `The Tailwind target does not support ${input.directive}.`,\n suggestion: 'Keep the directive and migrate it manually.',\n };\n }\n }\n return undefined;\n }\n\n render(plan: ResolvedSemanticPlan, context: SemanticConversionContext): PlannedConversion {\n const result = this.renderUnprefixed(plan, context);\n if (result.status !== 'converted') return result;\n return { ...result, classNames: result.classNames.map(token => renderTargetCandidate(token, this.targetProfile)) };\n }\n\n private renderUnprefixed(plan: ResolvedSemanticPlan, _context: SemanticConversionContext): PlannedConversion {\n const inputFamily = directiveFamily(plan.input.directive);\n if (inputFamily !== plan.family) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Tailwind renderer received semantic family \"${String(plan.family)}\" for directive \"${plan.input.directive}\", which belongs to \"${String(inputFamily)}\".`,\n [plan.input.fileName],\n );\n }\n\n let classNames: readonly string[];\n switch (plan.family) {\n case 'layout':\n classNames = renderLayout(plan.value as LayoutSemantics);\n break;\n case 'layout-gap': {\n const result = renderLayoutGap(plan.value as LayoutGapSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'layout-align':\n classNames = renderLayoutAlignment(plan.value as LayoutAlignmentSemantics).classNames;\n break;\n case 'flex-item':\n classNames = renderFlexItem(plan.value as FlexItemSemantics);\n break;\n case 'flex-align': {\n const result = renderFlexAlign(plan.value as FlexAlignSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'flex-fill': {\n const result = renderFlexFill(plan.value as FlexFillSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'flex-offset': {\n const result = renderFlexOffset(plan.value as FlexOffsetSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'flex-order': {\n const result = renderFlexOrder(plan.value as FlexOrderSemantics);\n classNames = result.status === 'converted' ? result.classNames : [];\n break;\n }\n case 'visibility':\n return this.renderVisibility(plan, plan.value as VisibilitySemantics);\n case 'extended-class':\n return this.renderExtendedClass(plan, plan.value as ExtendedClassSemantics);\n case 'extended-style':\n return this.renderExtendedStyle(plan, plan.value as ExtendedStyleSemantics);\n case 'grid-align-columns':\n case 'grid-align-rows':\n case 'grid-area':\n case 'grid-areas':\n case 'grid-auto':\n case 'grid-column':\n case 'grid-columns':\n case 'grid-gap':\n case 'grid-align':\n case 'grid-inline':\n case 'grid-row':\n case 'grid-rows':\n return this.renderGrid(plan, plan.value as GridSemanticPlan);\n default:\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Tailwind renderer does not handle semantic family \"${String(plan.family)}\".`,\n [plan.input.fileName],\n );\n }\n return {\n status: 'converted',\n input: plan.input,\n classNames: this.applySemanticSuppressions(this.decorate(classNames, plan), plan),\n };\n }\n\n resolveConflicts(\n plans: readonly PlannedConversion[],\n context: SemanticConversionContext,\n ): readonly PlannedConversion[] {\n const normalize = (token: string) => normalizeTargetCandidate(token, this.targetProfile);\n const normalized = plans.map(plan =>\n plan.status === 'converted' ? { ...plan, classNames: plan.classNames.map(token => normalize(token)) } : plan,\n );\n const resolved = this.resolveClassConflicts(\n normalized,\n context.existingClassNames.map(token => normalize(token)),\n );\n return resolved.map((plan, index) => (plan.status === 'converted' ? plans[index]! : plan));\n }\n\n record(_plans: readonly PlannedConversion[]): void {}\n\n resolveClassConflicts(\n plans: readonly PlannedConversion[],\n existingClassNames: readonly string[],\n ): readonly PlannedConversion[] {\n const convertedPlans = plans.filter(\n (plan): plan is Extract<PlannedConversion, { readonly status: 'converted' }> => plan.status === 'converted',\n );\n const sharedConflictingTokens = findTailwindClassConflicts(\n existingClassNames,\n convertedPlans.flatMap(plan => plan.classNames),\n );\n const conflictingFamilies = new Set(\n convertedPlans\n .filter(plan => {\n if (!visibilityDirectives.has(plan.input.directive)) {\n return plan.classNames.some(className => sharedConflictingTokens.has(className));\n }\n const conflictingTokens = findTailwindClassConflicts(\n compatibleVisibilityClasses(plan, existingClassNames),\n plan.classNames,\n );\n return plan.classNames.some(className => conflictingTokens.has(className));\n })\n .map(plan => directiveFamily(plan.input.directive) ?? plan.input.directive),\n );\n return plans.map(plan =>\n plan.status === 'converted' &&\n conflictingFamilies.has(directiveFamily(plan.input.directive) ?? plan.input.directive)\n ? {\n status: 'review',\n input: plan.input,\n code: 'class-conflict',\n reason: 'An existing Tailwind utility controls a CSS property generated by this conversion.',\n suggestion: 'Remove or reconcile the conflicting utility before migrating this directive.',\n }\n : plan,\n );\n }\n\n private unprefix(token: string): string {\n const prefix = this.targetProfile.prefix.value;\n return prefix && token.startsWith(`${prefix}:`) ? token.slice(prefix.length + 1) : token;\n }\n\n private decorate(classNames: readonly string[], plan: ResolvedSemanticPlan): readonly string[] {\n return plan.activations.flatMap(planActivation =>\n planActivation.kind === 'base'\n ? classNames\n : classNames.flatMap(className => this.responsiveEmitter.emit(planActivation.definition, className)),\n );\n }\n\n private renderGrid(plan: ResolvedSemanticPlan, value: GridSemanticPlan): PlannedConversion {\n const rendered = this.gridRenderer.render(value);\n if (rendered.status === 'review') {\n return {\n status: 'review',\n input: plan.input,\n code: rendered.code,\n reason: rendered.reason,\n suggestion: 'Use an exact Tailwind class manually or retain the Grid directive.',\n };\n }\n const display =\n value.role === 'container' && plan.emitGridDisplay !== false\n ? ['grid']\n : value.role === 'modifier'\n ? [value.inline ? 'inline-grid' : 'grid']\n : [];\n return {\n status: 'converted',\n input: plan.input,\n classNames: this.applySemanticSuppressions(this.decorate([...display, ...rendered.classNames], plan), plan),\n };\n }\n\n private renderVisibility(plan: ResolvedSemanticPlan, value: VisibilitySemantics): PlannedConversion {\n const classNames = value.emit\n ? [\n ...new Set(\n value.states.flatMap(state =>\n this.visibilityEmitter.emit({ ...state, input: plan.input }, value.restorationDisplay),\n ),\n ),\n ]\n : [];\n return { status: 'converted', input: plan.input, classNames };\n }\n\n private renderExtendedClass(plan: ResolvedSemanticPlan, value: ExtendedClassSemantics): PlannedConversion {\n const classNames = value.emit\n ? [\n ...new Set(\n value.states.flatMap(state =>\n state.activations.flatMap(itemActivation => {\n if (itemActivation.kind !== 'media') return [];\n return this.extendedEmitter.emitClass({\n input: plan.input,\n activation: itemActivation,\n value: { tokens: state.tokens.map(token => this.unprefix(token.source)) },\n });\n }),\n ),\n ),\n ]\n : [];\n return {\n status: 'converted',\n input: plan.input,\n classNames: this.applySemanticSuppressions(classNames, plan),\n ...(value.retainedTokens.length > 0\n ? { retainedClassNames: value.retainedTokens.map(token => token.source) }\n : {}),\n };\n }\n\n private renderExtendedStyle(plan: ResolvedSemanticPlan, value: ExtendedStyleSemantics): PlannedConversion {\n const classNames = value.emit\n ? [\n ...new Set(\n value.states.flatMap(state =>\n state.activations.flatMap(itemActivation => {\n if (itemActivation.kind !== 'media') return [];\n return this.extendedEmitter.emitStyle({\n input: plan.input,\n activation: itemActivation,\n value: { declarations: state.declarations },\n });\n }),\n ),\n ),\n ]\n : [];\n return { status: 'converted', input: plan.input, classNames: this.applySemanticSuppressions(classNames, plan) };\n }\n\n private applySemanticSuppressions(classNames: readonly string[], plan: ResolvedSemanticPlan): readonly string[] {\n if (!plan.suppressedProperties?.length && !plan.suppressedEffects?.length) return classNames;\n return classNames.filter(className => {\n const descriptor = describeTailwindUtility(className);\n if (descriptor === undefined) return true;\n if (\n plan.suppressedProperties?.some(property =>\n descriptor.cssProperties.some(candidate => cssPropertiesOverlap(candidate, property)),\n )\n ) {\n return false;\n }\n return !(plan.suppressedEffects ?? []).some(suppression => {\n if (\n descriptor.important !== suppression.important ||\n descriptor.cssProperties.length !== suppression.properties.length ||\n !descriptor.cssProperties.every((property, index) => property === suppression.properties[index])\n ) {\n return false;\n }\n if (suppression.activation.kind === 'base') return descriptor.activation.kind === 'base';\n if (descriptor.activation.kind !== 'media') return false;\n if ((descriptor.activation.mediaType ?? 'screen') !== suppression.activation.definition.media.type)\n return false;\n const descriptorActivation = descriptor.activation;\n return suppression.activation.definition.media.clauses.some(\n range =>\n range.min === descriptorActivation.range.min &&\n range.max === descriptorActivation.range.max &&\n range.orientation === descriptorActivation.range.orientation,\n );\n });\n });\n }\n}\n","import type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport { CssRenderer } from './css/css.renderer';\nimport type { ConversionRenderer } from './conversion-renderer';\nimport { TailwindRenderer } from './tailwind/tailwind.renderer';\n\nexport type AdapterSessionResult =\n { readonly target: 'tailwind' } | { readonly target: 'css'; readonly rules: readonly OwnedCssRule[] };\n\nexport interface RenderSession {\n readonly renderer: ConversionRenderer;\n finalize(): AdapterSessionResult;\n}\n\nexport function createRenderSession(\n target: AdapterSessionResult['target'],\n config: BreakpointMigrationConfig = { orientationBreakpoints: false },\n): RenderSession {\n return target === 'tailwind' ? new TailwindRenderSession(config) : new CssRenderSession(config);\n}\n\nexport function sessionBoundRenderer(renderer: ConversionRenderer, assertActive: () => void): ConversionRenderer {\n return Object.freeze({\n target: renderer.target,\n breakpointConfig: renderer.breakpointConfig,\n sourcePropertyEvidence: renderer.sourcePropertyEvidence,\n eligibility(input: Parameters<ConversionRenderer['eligibility']>[0]) {\n assertActive();\n return renderer.eligibility(input);\n },\n render(plan: Parameters<ConversionRenderer['render']>[0], context: Parameters<ConversionRenderer['render']>[1]) {\n assertActive();\n return renderer.render(plan, context);\n },\n resolveConflicts(\n plans: Parameters<ConversionRenderer['resolveConflicts']>[0],\n context: Parameters<ConversionRenderer['resolveConflicts']>[1],\n ) {\n assertActive();\n return renderer.resolveConflicts(plans, context);\n },\n record(plans: Parameters<ConversionRenderer['record']>[0]) {\n assertActive();\n renderer.record(plans);\n },\n });\n}\n\nabstract class SingleUseRenderSession implements RenderSession {\n abstract readonly renderer: ConversionRenderer;\n private finalized = false;\n\n finalize(): AdapterSessionResult {\n if (this.finalized) throw new Error('Render session already finalized');\n this.finalized = true;\n return Object.freeze(this.result());\n }\n\n protected assertActive(): void {\n if (this.finalized) throw new Error('Render session is finalized');\n }\n\n protected abstract result(): AdapterSessionResult;\n}\n\nexport class TailwindRenderSession extends SingleUseRenderSession {\n readonly renderer: ConversionRenderer;\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n super();\n this.renderer = sessionBoundRenderer(new TailwindRenderer(config), () => this.assertActive());\n }\n\n protected result(): AdapterSessionResult {\n return { target: 'tailwind' };\n }\n}\n\nexport class CssRenderSession extends SingleUseRenderSession {\n readonly renderer: ConversionRenderer;\n private readonly cssRenderer: CssRenderer;\n\n constructor(config: BreakpointMigrationConfig = { orientationBreakpoints: false }) {\n super();\n this.cssRenderer = new CssRenderer(undefined, config);\n this.renderer = sessionBoundRenderer(this.cssRenderer, () => this.assertActive());\n }\n\n protected result(): AdapterSessionResult {\n return { target: 'css', rules: this.cssRenderer.finalizedRules() };\n }\n}\n","import { logger } from '../logger';\nimport type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\nimport { CssRenderSession, TailwindRenderSession, type RenderSession } from '../render/render-session';\n\nexport class AdapterFactory {\n static createRenderSession(\n target: string,\n config: BreakpointMigrationConfig = { orientationBreakpoints: false },\n ): RenderSession {\n logger.info(`Creating adapter session [${target}]`);\n if (target === 'tailwind') return new TailwindRenderSession(config);\n if (target === 'css') return new CssRenderSession(config);\n throw new Error(`Adapter [${target}] not found`);\n }\n}\n","import { readFile } from 'node:fs/promises';\nimport { TemplateAnalyzer } from '../../analyzer/template.analyzer';\nimport { AngularTemplateParser } from '../../template/angular-template.parser';\nimport { analyzedProject, type AnalyzedProject, type AnalyzedTemplate } from '../analyzed-project';\nimport type { AnalyzeStage } from '../migration-pipeline';\nimport type { ProjectManifest } from '../project-manifest';\nimport type { TemplateInputAnalyzer } from './template-input-analyzer.port';\nimport type { TemplateParser } from './template-parser.port';\nimport type { TemplateSourceReader } from './template-source-reader.port';\n\nconst nodeSourceReader: TemplateSourceReader = Object.freeze({\n read: (path: string) => readFile(path, 'utf8'),\n});\n\nexport class AnalyzeProjectStage implements AnalyzeStage {\n constructor(\n private readonly sourceReader: TemplateSourceReader = nodeSourceReader,\n private readonly parser: TemplateParser = new AngularTemplateParser(),\n private readonly analyzer: TemplateInputAnalyzer = new TemplateAnalyzer(),\n ) {}\n\n public async run(manifest: ProjectManifest): Promise<AnalyzedProject> {\n const templates: AnalyzedTemplate[] = [];\n\n for (const file of manifest.templates) {\n const source = await this.sourceReader.read(file.inputPath);\n const parseResult = this.parser.parse(source, file.inputPath);\n\n templates.push(\n parseResult.status === 'parse-error'\n ? { status: 'parse-error', file, source, parseResult }\n : {\n status: 'parsed',\n file,\n source,\n parseResult,\n inputs: this.analyzer.analyze(file.inputPath, parseResult.elements),\n },\n );\n }\n\n return analyzedProject({ manifest, templates });\n }\n}\n","import { FLEX_LAYOUT_DIRECTIVES, FlexLayoutDirective, isFlexLayoutDirective } from './flex-layout.catalog';\nimport type { SourceRange } from '../template/template.model';\n\nexport type BindingKind = 'literal' | 'property';\n\nexport interface FlexLayoutInput {\n sourceName: string;\n directive: FlexLayoutDirective;\n value: string;\n binding: BindingKind;\n breakpoint: string | undefined;\n}\n\nexport interface LocatedFlexLayoutInput extends FlexLayoutInput {\n readonly id: string;\n readonly fileName: string;\n readonly elementId: string;\n readonly source: SourceRange;\n readonly nameSource: SourceRange;\n readonly valueSource?: SourceRange;\n}\n\nconst responsiveOnlyDirectives = new Set<FlexLayoutDirective>(['class', 'ngClass', 'style', 'ngStyle']);\nconst directivesByLength = [...FLEX_LAYOUT_DIRECTIVES].sort((left, right) => right.length - left.length);\n\nexport function analyzeFlexLayoutAttribute(sourceName: string, value: string): FlexLayoutInput | undefined {\n const startsWithBracket = sourceName.startsWith('[');\n const endsWithBracket = sourceName.endsWith(']');\n\n if (startsWithBracket !== endsWithBracket) return undefined;\n\n const binding: BindingKind = startsWithBracket ? 'property' : 'literal';\n const normalizedName = startsWithBracket ? sourceName.slice(1, -1) : sourceName;\n\n if (normalizedName.startsWith('src.')) {\n return {\n sourceName,\n value,\n directive: 'imgSrc',\n breakpoint: normalizedName.slice('src.'.length),\n binding,\n };\n }\n\n const directive = directivesByLength.find(\n candidate => normalizedName === candidate || normalizedName.startsWith(`${candidate}.`),\n );\n\n if (!directive || !isFlexLayoutDirective(directive)) return undefined;\n\n const breakpoint = normalizedName === directive ? undefined : normalizedName.slice(directive.length + 1);\n if (responsiveOnlyDirectives.has(directive) && !breakpoint) return undefined;\n\n return {\n sourceName,\n value,\n directive,\n breakpoint,\n binding,\n };\n}\n","import type { TemplateElement } from '../template/template.model';\nimport { analyzeFlexLayoutAttribute, LocatedFlexLayoutInput } from './flex-layout-attribute.analyzer';\nimport { isKnownBreakpoint } from './flex-layout.catalog';\n\nfunction sourceNameFor(attribute: TemplateElement['attributes'][number]): string | undefined {\n if (attribute.binding === 'literal') return attribute.name;\n if (attribute.bindingTarget === 'property' || attribute.bindingTarget === 'two-way') return `[${attribute.name}]`;\n if (\n (attribute.bindingTarget === 'class' || attribute.bindingTarget === 'style') &&\n isKnownBreakpoint(attribute.name)\n ) {\n return `[${attribute.bindingTarget}.${attribute.name}]`;\n }\n return undefined;\n}\n\nexport class TemplateAnalyzer {\n analyze(fileName: string, elements: readonly TemplateElement[]): readonly LocatedFlexLayoutInput[] {\n const inputs: LocatedFlexLayoutInput[] = [];\n\n for (const element of elements) {\n for (const attribute of element.attributes) {\n const sourceName = sourceNameFor(attribute);\n if (!sourceName) continue;\n const input = analyzeFlexLayoutAttribute(sourceName, attribute.value);\n if (!input) continue;\n\n inputs.push({\n ...input,\n id: `${fileName}:${attribute.source.start}`,\n fileName,\n elementId: element.id,\n source: attribute.source,\n nameSource: attribute.nameSource,\n ...(attribute.valueSource ? { valueSource: attribute.valueSource } : {}),\n });\n }\n }\n\n return inputs.sort((left, right) => left.source.start - right.source.start);\n }\n}\n","import {\n BindingType,\n parseTemplate,\n TmplAstBoundAttribute,\n TmplAstElement,\n TmplAstRecursiveVisitor,\n TmplAstTemplate,\n TmplAstTextAttribute,\n tmplAstVisitAll,\n} from '@angular/compiler';\nimport { SourceRange, TemplateAttribute, TemplateElement, TemplateParseResult } from './template.model';\n\nfunction range(start: number, end: number): SourceRange {\n return { start, end };\n}\n\nfunction attributeNameRange(source: string, attribute: TmplAstTextAttribute | TmplAstBoundAttribute): SourceRange {\n const start = attribute.sourceSpan.start.offset;\n const rawAttribute = source.slice(start, attribute.sourceSpan.end.offset);\n const equalsIndex = rawAttribute.indexOf('=');\n const rawName = (equalsIndex === -1 ? rawAttribute : rawAttribute.slice(0, equalsIndex)).trimEnd();\n return range(start, start + rawName.length);\n}\n\nfunction normalizeAttribute(\n source: string,\n attribute: TmplAstTextAttribute | TmplAstBoundAttribute,\n binding: TemplateAttribute['binding'],\n): TemplateAttribute {\n const nameSource = attributeNameRange(source, attribute);\n const valueSource = attribute.valueSpan\n ? range(attribute.valueSpan.start.offset, attribute.valueSpan.end.offset)\n : undefined;\n const rawValue = valueSource ? source.slice(valueSource.start, valueSource.end) : '';\n\n return {\n name: attribute.name,\n rawName: source.slice(nameSource.start, nameSource.end),\n rawValue,\n value: attribute instanceof TmplAstTextAttribute ? attribute.value : rawValue,\n binding,\n ...(attribute instanceof TmplAstBoundAttribute ? { bindingTarget: boundTarget(attribute.type) } : {}),\n source: range(attribute.sourceSpan.start.offset, attribute.sourceSpan.end.offset),\n nameSource,\n ...(valueSource ? { valueSource } : {}),\n };\n}\n\nfunction boundTarget(type: BindingType): NonNullable<TemplateAttribute['bindingTarget']> {\n switch (type) {\n case BindingType.Attribute:\n return 'attribute';\n case BindingType.Class:\n return 'class';\n case BindingType.Style:\n return 'style';\n case BindingType.LegacyAnimation:\n case BindingType.Animation:\n return 'animation';\n case BindingType.TwoWay:\n return 'two-way';\n case BindingType.Property:\n default:\n return 'property';\n }\n}\n\nclass ElementCollector extends TmplAstRecursiveVisitor {\n readonly elements: TemplateElement[] = [];\n private readonly parents: string[] = [];\n private readonly structuralElements = new Set<number>();\n\n constructor(private readonly source: string) {\n super();\n }\n\n override visitElement(element: TmplAstElement): void {\n const id = String(element.sourceSpan.start.offset);\n const attributes = [\n ...element.attributes.map(attribute => normalizeAttribute(this.source, attribute, 'literal')),\n ...element.inputs.map(attribute => normalizeAttribute(this.source, attribute, 'property')),\n ].sort((left, right) => left.source.start - right.source.start);\n\n this.elements.push({\n id,\n name: element.name,\n source: range(element.sourceSpan.start.offset, element.sourceSpan.end.offset),\n startTag: range(element.startSourceSpan.start.offset, element.startSourceSpan.end.offset),\n ...(element.endSourceSpan && element.endSourceSpan.start.offset !== element.startSourceSpan.start.offset\n ? { endTag: range(element.endSourceSpan.start.offset, element.endSourceSpan.end.offset) }\n : {}),\n structural: this.structuralElements.has(element.sourceSpan.start.offset),\n attributes,\n ...(this.parents.at(-1) ? { parentId: this.parents.at(-1) } : {}),\n });\n\n this.parents.push(id);\n super.visitElement(element);\n this.parents.pop();\n }\n\n override visitTemplate(template: TmplAstTemplate): void {\n const structuralElement =\n template.tagName === null\n ? undefined\n : template.children.find(\n child =>\n child instanceof TmplAstElement &&\n child.name === template.tagName &&\n child.sourceSpan.start.offset === template.sourceSpan.start.offset &&\n child.sourceSpan.end.offset === template.sourceSpan.end.offset,\n );\n\n if (structuralElement) {\n this.structuralElements.add(structuralElement.sourceSpan.start.offset);\n }\n super.visitTemplate(template);\n if (structuralElement) {\n this.structuralElements.delete(structuralElement.sourceSpan.start.offset);\n }\n }\n}\n\nexport class AngularTemplateParser {\n parse(source: string, fileName: string): TemplateParseResult {\n const parsed = parseTemplate(source, fileName, {\n enableBlockSyntax: true,\n preserveLineEndings: true,\n preserveWhitespaces: true,\n });\n\n if (parsed.errors?.length) {\n return {\n status: 'parse-error',\n diagnostics: parsed.errors.map(error => ({\n message: error.msg,\n source: range(error.span.start.offset, error.span.end.offset),\n })),\n };\n }\n\n const collector = new ElementCollector(source);\n tmplAstVisitAll(collector, parsed.nodes);\n return { status: 'parsed', elements: collector.elements };\n }\n}\n","import * as path from 'node:path';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { SourceRange, TemplateAttribute, TemplateElement, TemplateParseResult } from '../template/template.model';\nimport { projectManifest, type ManifestTemplate, type ProjectManifest } from './project-manifest';\n\nexport type AnalyzedTemplate =\n | {\n readonly status: 'parsed';\n readonly file: ManifestTemplate;\n readonly source: string;\n readonly parseResult: Extract<TemplateParseResult, { readonly status: 'parsed' }>;\n readonly inputs: readonly LocatedFlexLayoutInput[];\n }\n | {\n readonly status: 'parse-error';\n readonly file: ManifestTemplate;\n readonly source: string;\n readonly parseResult: Extract<TemplateParseResult, { readonly status: 'parse-error' }>;\n };\n\nexport interface AnalyzedProject {\n readonly manifest: ProjectManifest;\n readonly templates: readonly AnalyzedTemplate[];\n}\n\nexport function analyzedProject(project: AnalyzedProject): AnalyzedProject {\n const manifest = projectManifest(project.manifest);\n if (project.templates.length !== manifest.templates.length) {\n throw sequenceInvariant();\n }\n const templates = project.templates.map((template, index) => {\n const file = manifestTemplateAt(manifest, template.file, index);\n if (template.status === 'parse-error') {\n return Object.freeze({\n status: template.status,\n file,\n source: template.source,\n parseResult: freezeParseErrorResult(template.parseResult),\n });\n }\n\n return Object.freeze({\n status: template.status,\n file,\n source: template.source,\n parseResult: freezeParsedResult(template.parseResult),\n inputs: Object.freeze(template.inputs.map(input => freezeLocatedInput(input))),\n });\n });\n\n return Object.freeze({ manifest, templates: Object.freeze(templates) });\n}\n\nfunction freezeParsedResult(\n result: Extract<TemplateParseResult, { readonly status: 'parsed' }>,\n): Extract<TemplateParseResult, { readonly status: 'parsed' }> {\n return Object.freeze({\n status: result.status,\n elements: Object.freeze(result.elements.map(element => freezeTemplateElement(element))),\n });\n}\n\nfunction freezeTemplateElement(element: TemplateElement): TemplateElement {\n return Object.freeze({\n id: element.id,\n name: element.name,\n source: freezeSourceRange(element.source),\n startTag: freezeSourceRange(element.startTag),\n ...(element.endTag === undefined ? {} : { endTag: freezeSourceRange(element.endTag) }),\n structural: element.structural,\n attributes: Object.freeze(element.attributes.map(attribute => freezeTemplateAttribute(attribute))),\n ...(element.parentId === undefined ? {} : { parentId: element.parentId }),\n });\n}\n\nfunction freezeTemplateAttribute(attribute: TemplateAttribute): TemplateAttribute {\n return Object.freeze({\n name: attribute.name,\n rawName: attribute.rawName,\n rawValue: attribute.rawValue,\n value: attribute.value,\n binding: attribute.binding,\n ...(attribute.bindingTarget === undefined ? {} : { bindingTarget: attribute.bindingTarget }),\n source: freezeSourceRange(attribute.source),\n nameSource: freezeSourceRange(attribute.nameSource),\n ...(attribute.valueSource === undefined ? {} : { valueSource: freezeSourceRange(attribute.valueSource) }),\n });\n}\n\nfunction freezeSourceRange(source: SourceRange): SourceRange {\n return Object.freeze({ start: source.start, end: source.end });\n}\n\nfunction freezeParseErrorResult(\n result: Extract<TemplateParseResult, { readonly status: 'parse-error' }>,\n): Extract<TemplateParseResult, { readonly status: 'parse-error' }> {\n return Object.freeze({\n status: result.status,\n diagnostics: Object.freeze(\n result.diagnostics.map(diagnostic =>\n Object.freeze({\n ...diagnostic,\n source: Object.freeze({ ...diagnostic.source }),\n }),\n ),\n ),\n });\n}\n\nfunction manifestTemplateAt(manifest: ProjectManifest, candidate: ManifestTemplate, index: number): ManifestTemplate {\n const expected = manifest.templates[index];\n if (expected === undefined || !samePathPair(expected, candidate)) {\n throw sequenceInvariant([candidate.inputPath, candidate.outputPath]);\n }\n return expected;\n}\n\nfunction samePathPair(left: ManifestTemplate, right: ManifestTemplate): boolean {\n return (\n normalizedAbsolutePath(left.inputPath) === normalizedAbsolutePath(right.inputPath) &&\n normalizedAbsolutePath(left.outputPath) === normalizedAbsolutePath(right.outputPath)\n );\n}\n\nfunction freezeLocatedInput(input: LocatedFlexLayoutInput): LocatedFlexLayoutInput {\n return Object.freeze({\n ...input,\n source: Object.freeze({ ...input.source }),\n nameSource: Object.freeze({ ...input.nameSource }),\n ...(input.valueSource === undefined ? {} : { valueSource: Object.freeze({ ...input.valueSource }) }),\n });\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n\nfunction sequenceInvariant(paths: readonly string[] = []): MigrationApplicationError {\n return internalInvariant(\n 'Analyzed project templates must match its manifest one-to-one and in the same order.',\n paths,\n );\n}\n\nfunction internalInvariant(message: string, paths: readonly string[] = []): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message, paths);\n}\n","import type { TailwindTargetProfile } from '../config/tailwind-target-profile';\nimport type { ConfigurationSnapshot } from '../config/migration-config';\nimport type { SourceBreakpoints } from '../config/source-breakpoints';\nimport * as path from 'node:path';\nimport type { MigrationMode } from '../migrator/migration-mode';\n\nexport interface MigrationOptions {\n readonly mode: MigrationMode;\n readonly targetProfile?: TailwindTargetProfile;\n readonly sourceBreakpoints?: SourceBreakpoints;\n readonly configurationSnapshots?: readonly ConfigurationSnapshot[];\n readonly responsiveImages?: boolean;\n readonly stylesheetPath?: string;\n readonly stylesheetPathInput?: string;\n readonly reportPath?: string;\n}\n\nexport interface MigrationInvocation {\n readonly inputPath: string;\n readonly outputPath: string;\n readonly canonicalInputPath: string;\n readonly canonicalOutputPath: string;\n readonly options: Readonly<MigrationOptions>;\n}\n\ntype MigrationInvocationInput = Pick<MigrationInvocation, 'inputPath' | 'outputPath' | 'options'>;\n\nexport interface ManifestTemplate {\n readonly inputPath: string;\n readonly outputPath: string;\n}\n\nexport interface ProjectManifest {\n readonly invocation: MigrationInvocation;\n readonly templates: readonly ManifestTemplate[];\n}\n\nexport function migrationInvocation(invocation: MigrationInvocationInput): MigrationInvocation {\n return freezeMigrationInvocation({\n inputPath: invocation.inputPath,\n outputPath: invocation.outputPath,\n canonicalInputPath: normalizedAbsolutePath(invocation.inputPath),\n canonicalOutputPath: normalizedAbsolutePath(invocation.outputPath),\n options: invocation.options,\n });\n}\n\nexport function projectManifest(\n manifest: Omit<ProjectManifest, 'invocation'> & {\n readonly invocation: MigrationInvocationInput | MigrationInvocation;\n },\n): ProjectManifest {\n return Object.freeze({\n invocation: hasCanonicalIdentity(manifest.invocation)\n ? freezeMigrationInvocation(manifest.invocation)\n : migrationInvocation(manifest.invocation),\n templates: Object.freeze(\n manifest.templates.map(template =>\n Object.freeze({\n inputPath: normalizedAbsolutePath(template.inputPath),\n outputPath: normalizedAbsolutePath(template.outputPath),\n }),\n ),\n ),\n });\n}\n\nfunction hasCanonicalIdentity(\n invocation: MigrationInvocationInput | MigrationInvocation,\n): invocation is MigrationInvocation {\n return 'canonicalInputPath' in invocation && 'canonicalOutputPath' in invocation;\n}\n\nfunction freezeMigrationInvocation(invocation: MigrationInvocation): MigrationInvocation {\n return Object.freeze({\n inputPath: invocation.inputPath,\n outputPath: invocation.outputPath,\n canonicalInputPath: invocation.canonicalInputPath,\n canonicalOutputPath: invocation.canonicalOutputPath,\n options: Object.freeze({ ...invocation.options }),\n });\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n","import { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { ArtifactState, PlannedOutputArtifact } from '../migrator/migration-plan';\nimport { compareCodeUnits } from '../util/compare-code-units';\n\nexport interface MigrationTransactionFileHandle {\n chmod(mode: number): Promise<void>;\n writeFile(contents: string, encoding: BufferEncoding): Promise<void>;\n readFile(options: { readonly encoding: 'utf8' }): Promise<string>;\n stat(): Promise<MigrationTransactionStat>;\n sync(): Promise<void>;\n close(): Promise<void>;\n}\n\nexport interface MigrationTransactionStat {\n readonly dev: number | bigint;\n readonly ino: number | bigint;\n readonly mode: number | bigint;\n isDirectory(): boolean;\n isFile(): boolean;\n isSymbolicLink(): boolean;\n}\n\nexport interface MigrationTransactionOperations {\n access(path: string, mode: number): Promise<void>;\n link(existingPath: string, newPath: string): Promise<void>;\n lstat(path: string): Promise<MigrationTransactionStat>;\n mkdir(path: string, options?: { readonly recursive?: boolean; readonly mode?: number }): Promise<unknown>;\n open(path: string, flags: 'r' | 'wx'): Promise<MigrationTransactionFileHandle>;\n rename(source: string, destination: string): Promise<void>;\n rmdir(path: string): Promise<void>;\n stat(path: string): Promise<MigrationTransactionStat>;\n unlink(path: string): Promise<void>;\n}\n\nexport interface FileIdentity {\n readonly dev: string;\n readonly ino: string;\n}\n\nexport interface DirectoryExpectation {\n readonly path: string;\n readonly original:\n | 'absent'\n | { readonly identity: FileIdentity; readonly kind: 'directory' }\n | { readonly identity: FileIdentity; readonly kind: 'symbolic-link'; readonly followedIdentity: FileIdentity };\n}\n\nexport interface CreatedDirectory {\n readonly path: string;\n identity?: FileIdentity;\n readonly publicPaths: Set<string>;\n exists: boolean;\n}\n\nexport interface OwnedNamespace {\n readonly path: string;\n identity?: FileIdentity;\n readonly publicPath: string;\n exists: boolean;\n}\n\nexport interface OwnedFile {\n readonly path: string;\n readonly publicPath: string;\n identity?: FileIdentity;\n exists: boolean;\n preserve: boolean;\n}\n\nexport interface ObservedPresentState {\n readonly status: 'present';\n readonly contents: string;\n readonly identity: FileIdentity;\n readonly mode: number;\n}\n\nexport type ObservedState = { readonly status: 'absent' } | ObservedPresentState;\n\nexport interface RuntimeArtifact {\n readonly artifact: PlannedOutputArtifact;\n readonly directories: readonly DirectoryExpectation[];\n readonly quarantines: OwnedFile[];\n readonly ownedFiles: OwnedFile[];\n readonly readHandles: Set<MigrationTransactionFileHandle>;\n originalIdentity?: FileIdentity;\n originalMode?: number;\n namespace?: OwnedNamespace;\n stage?: OwnedFile;\n backup?: OwnedFile;\n openHandle?: MigrationTransactionFileHandle;\n installedIdentity?: FileIdentity;\n restoredIdentity?: FileIdentity;\n}\n\nexport interface TransactionUnitContext {\n readonly items: RuntimeArtifact[];\n readonly createdDirectories: Map<string, CreatedDirectory>;\n readonly unconfirmedEntries: Map<string, Set<string>>;\n readonly recoveryFailures: unknown[];\n readonly restored: Map<RuntimeArtifact, boolean>;\n readonly ownershipChanged: () => void;\n}\n\nexport interface RecoveryOutcome {\n readonly paths: readonly string[];\n readonly failures: readonly unknown[];\n}\n\nexport class RecoveryUnitError extends Error {\n constructor(\n readonly paths: readonly string[],\n readonly failures: readonly unknown[],\n ) {\n super('Transaction recovery was incomplete.');\n this.name = 'RecoveryUnitError';\n this.paths = Object.freeze([...paths]);\n this.failures = Object.freeze([...failures]);\n }\n}\n\nexport function runtimeArtifact(\n context: Pick<TransactionUnitContext, 'items'>,\n artifact: PlannedOutputArtifact,\n): RuntimeArtifact {\n const item = context.items.find(candidate => candidate.artifact === artifact);\n if (item) return item;\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Migration transaction journal contains an unknown artifact: ${artifact.path}`,\n [artifact.path],\n );\n}\n\nexport function identity(stat: MigrationTransactionStat): FileIdentity {\n return { dev: String(stat.dev), ino: String(stat.ino) };\n}\n\nexport function fileMode(stat: MigrationTransactionStat): number {\n return Number(stat.mode) & 0o7777;\n}\n\nexport function sameIdentity(left: FileIdentity, right: FileIdentity): boolean {\n return left.dev === right.dev && left.ino === right.ino;\n}\n\nexport function sameArtifactState(left: ObservedState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n\nexport function required<T>(value: T | undefined): T {\n if (value === undefined) throw new Error('Missing transaction state.');\n return value;\n}\n\nexport function isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n\nexport function isDirectoryNotEmpty(error: unknown): error is NodeJS.ErrnoException {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n (error.code === 'ENOTEMPTY' || error.code === 'EEXIST')\n );\n}\n\nexport function pathDepth(path: string): number {\n return path.split(/[\\\\/]/u).filter(Boolean).length;\n}\n\nexport function recoveryOutcome(paths: Iterable<string>, failures: readonly unknown[]): RecoveryOutcome {\n return { paths: sortedUnique(paths), failures: Object.freeze([...failures]) };\n}\n\nexport function recoveryUnitError(error: unknown): RecoveryUnitError {\n return new RecoveryUnitError(error instanceof MigrationApplicationError ? error.paths : [], [error]);\n}\n\nexport function sortedUnique(paths: Iterable<string>): readonly string[] {\n return [...new Set(paths)].sort(compareCodeUnits);\n}\n","import type { StagedArtifact } from './staging.unit';\nimport type { CleanupArtifactView, CleanupPort, OwnedFileView } from './transaction-unit.ports';\nimport {\n RecoveryUnitError,\n identity,\n isDirectoryNotEmpty,\n isEnoent,\n pathDepth,\n recoveryOutcome,\n recoveryUnitError,\n sameArtifactState,\n sameIdentity,\n type MigrationTransactionStat,\n type ObservedState,\n type RecoveryOutcome,\n} from './transaction-unit.state';\nimport { compareCodeUnits } from '../util/compare-code-units';\n\nexport { RecoveryUnitError } from './transaction-unit.state';\n\nexport interface CleanupUnit {\n cleanup(staged: readonly StagedArtifact[]): Promise<readonly string[]>;\n}\n\nexport type CleanupKind = 'committed' | 'recovery';\n\nexport class FileSystemCleanupUnit implements CleanupUnit {\n constructor(\n private readonly port: CleanupPort,\n private readonly kind: CleanupKind,\n ) {}\n\n public async cleanup(staged: readonly StagedArtifact[]): Promise<readonly string[]> {\n const failures: unknown[] = [];\n const paths = new Set<string>();\n let stagedItems: CleanupArtifactView[];\n try {\n stagedItems = staged.map(entry => this.port.journal.artifact(entry.artifact));\n } catch (error: unknown) {\n throw recoveryUnitError(error);\n }\n const items = this.kind === 'recovery' ? stagedItems.reverse() : stagedItems;\n for (const item of items) {\n await this.port.closeReadHandles(item, failures);\n await this.port.closeOpenHandle(item, failures);\n const ownedFiles = this.kind === 'recovery' ? [...item.ownedFiles].reverse() : item.ownedFiles;\n for (const owned of ownedFiles) {\n if (this.kind === 'recovery' && owned.path === item.backupPath && this.port.journal.restored(item) === false) {\n if (owned.exists) paths.add(item.artifact.path);\n continue;\n }\n await this.removeOwnedFile(item, owned, paths, failures);\n }\n await this.removeNamespace(item, paths, failures);\n this.port.journal.finishArtifactCleanup();\n }\n await this.removeCreatedDirectories(paths, failures);\n await this.collectUnconfirmedPaths(paths, failures);\n if (this.kind === 'recovery') {\n for (const item of this.port.journal.artifacts()) {\n if (!(await this.verifyOriginal(item, failures))) paths.add(item.artifact.path);\n }\n }\n return recoveryResult(recoveryOutcome(paths, failures));\n }\n\n private async removeOwnedFile(\n item: CleanupArtifactView,\n owned: OwnedFileView | undefined,\n paths: Set<string>,\n failures: unknown[],\n ): Promise<void> {\n if (!owned?.exists) return;\n if (owned.preserve || !owned.identity) {\n paths.add(owned.publicPath);\n return;\n }\n try {\n await this.port.assertNamespace(item);\n const before = await this.port.lstat(owned.path);\n if (!sameIdentity(identity(before), owned.identity) || before.isSymbolicLink() || !before.isFile()) {\n paths.add(owned.publicPath);\n failures.push(new Error('Invocation-owned file identity could not be confirmed.'));\n return;\n }\n } catch (error: unknown) {\n if (isEnoent(error)) {\n this.port.journal.markOwnedFileAbsent(item, owned.path);\n return;\n }\n paths.add(owned.publicPath);\n failures.push(error);\n return;\n }\n try {\n await this.port.unlink(owned.path);\n } catch (error: unknown) {\n if (!isEnoent(error)) failures.push(error);\n }\n try {\n await this.port.lstat(owned.path);\n paths.add(owned.publicPath);\n } catch (error: unknown) {\n if (isEnoent(error)) this.port.journal.markOwnedFileAbsent(item, owned.path);\n else {\n paths.add(owned.publicPath);\n failures.push(error);\n }\n }\n }\n\n private async removeNamespace(item: CleanupArtifactView, paths: Set<string>, failures: unknown[]): Promise<void> {\n const namespace = item.namespace;\n if (!namespace?.exists) return;\n if (!namespace.identity) {\n paths.add(namespace.publicPath);\n return;\n }\n try {\n const namespaceStat = await this.port.lstat(namespace.path);\n if (\n !sameIdentity(identity(namespaceStat), namespace.identity) ||\n namespaceStat.isSymbolicLink() ||\n !namespaceStat.isDirectory()\n ) {\n paths.add(namespace.publicPath);\n failures.push(new Error('Invocation namespace identity could not be confirmed.'));\n return;\n }\n } catch (error: unknown) {\n if (isEnoent(error)) {\n this.port.journal.markNamespaceAbsent(item);\n return;\n }\n paths.add(namespace.publicPath);\n failures.push(error);\n return;\n }\n try {\n await this.port.rmdir(namespace.path);\n } catch (error: unknown) {\n if (!isDirectoryNotEmpty(error) && !isEnoent(error)) failures.push(error);\n }\n try {\n await this.port.lstat(namespace.path);\n paths.add(namespace.publicPath);\n } catch (error: unknown) {\n if (isEnoent(error)) this.port.journal.markNamespaceAbsent(item);\n else {\n paths.add(namespace.publicPath);\n failures.push(error);\n }\n }\n }\n\n private async removeCreatedDirectories(paths: Set<string>, failures: unknown[]): Promise<void> {\n const directories = [...this.port.journal.createdDirectories()].sort(\n (left, right) => pathDepth(right.path) - pathDepth(left.path) || compareCodeUnits(right.path, left.path),\n );\n for (const directory of directories) {\n if (!directory.exists) continue;\n if (\n this.kind === 'committed' &&\n this.port.journal\n .artifacts()\n .some(\n item =>\n item.artifact.proposed.status === 'present' &&\n item.directories.some(expectation => expectation.path === directory.path),\n )\n ) {\n continue;\n }\n if (!directory.identity) {\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n continue;\n }\n let before: MigrationTransactionStat;\n try {\n before = await this.port.lstat(directory.path);\n } catch (error: unknown) {\n if (isEnoent(error)) {\n this.port.journal.markCreatedDirectoryAbsent(directory.path);\n continue;\n }\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n failures.push(error);\n continue;\n }\n if (!sameIdentity(identity(before), directory.identity) || before.isSymbolicLink() || !before.isDirectory()) {\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n continue;\n }\n let removalFailure: unknown;\n try {\n await this.port.rmdir(directory.path);\n } catch (error: unknown) {\n removalFailure = error;\n }\n let after: MigrationTransactionStat | 'absent';\n try {\n after = await this.port.lstatOrAbsent(directory.path);\n } catch (error: unknown) {\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n if (removalFailure !== undefined && !isEnoent(removalFailure)) failures.push(removalFailure);\n failures.push(error);\n continue;\n }\n if (after === 'absent') {\n this.port.journal.markCreatedDirectoryAbsent(directory.path);\n if (removalFailure !== undefined && !isEnoent(removalFailure)) failures.push(removalFailure);\n continue;\n }\n for (const publicPath of directory.publicPaths) paths.add(publicPath);\n if (removalFailure !== undefined && !isEnoent(removalFailure)) failures.push(removalFailure);\n }\n }\n\n private async collectUnconfirmedPaths(paths: Set<string>, failures: unknown[]): Promise<void> {\n for (const { path: candidate, publicPaths } of this.port.journal.unconfirmedEntries()) {\n try {\n await this.port.lstat(candidate);\n } catch (error: unknown) {\n if (isEnoent(error)) continue;\n failures.push(error);\n }\n for (const publicPath of publicPaths) paths.add(publicPath);\n }\n }\n\n private async verifyOriginal(item: CleanupArtifactView, failures: unknown[]): Promise<boolean> {\n try {\n return this.isConfirmedOriginal(item, await this.port.observePublic(item));\n } catch (error: unknown) {\n failures.push(error);\n return false;\n }\n }\n\n private isConfirmedOriginal(item: CleanupArtifactView, observed: ObservedState): boolean {\n if (!sameArtifactState(observed, item.artifact.original)) return false;\n if (observed.status === 'absent') return true;\n return [item.originalIdentity, item.restoredIdentity].some(\n expected => expected !== undefined && sameIdentity(observed.identity, expected),\n );\n }\n}\n\nfunction recoveryResult(outcome: RecoveryOutcome): readonly string[] {\n if (outcome.failures.length > 0) throw new RecoveryUnitError(outcome.paths, outcome.failures);\n return outcome.paths;\n}\n","import { randomUUID } from 'node:crypto';\nimport { join } from 'node:path';\nimport type { StagedArtifact } from './staging.unit';\nimport type { CommitArtifactView, CommitPort, OwnedFileView } from './transaction-unit.ports';\nimport {\n identity,\n required,\n sameArtifactState,\n sameIdentity,\n type ObservedPresentState,\n} from './transaction-unit.state';\n\nexport interface CommittedArtifact extends StagedArtifact {\n readonly committed: true;\n}\n\nexport interface CommitUnit {\n commit(staged: readonly StagedArtifact[], signal: AbortSignal): Promise<readonly CommittedArtifact[]>;\n}\n\nexport class CommitUnitError extends Error {\n constructor(\n cause: unknown,\n readonly staged: readonly StagedArtifact[],\n readonly committed: readonly CommittedArtifact[],\n ) {\n super(cause instanceof Error ? cause.message : 'Migration transaction commit failed.', { cause });\n this.name = 'CommitUnitError';\n this.staged = Object.freeze([...staged]);\n this.committed = Object.freeze([...committed]);\n }\n}\n\nexport class FileSystemCommitUnit implements CommitUnit {\n constructor(private readonly port: CommitPort) {}\n\n public async commit(staged: readonly StagedArtifact[], signal: AbortSignal): Promise<readonly CommittedArtifact[]> {\n const committed: CommittedArtifact[] = [];\n let items: readonly CommitArtifactView[];\n try {\n items = staged.map(entry => this.port.journal.artifact(entry.artifact));\n } catch (error: unknown) {\n throw new CommitUnitError(error, staged, committed);\n }\n for (const item of items) {\n try {\n this.port.assertNotInterrupted(signal);\n if (item.artifact.original.status === 'present') await this.captureOriginal(item, signal);\n this.port.assertNotInterrupted(signal);\n if (item.artifact.proposed.status === 'present') await this.installProposed(item);\n committed.push(committedArtifact(this.port.journal.artifact(item.artifact)));\n } catch (error: unknown) {\n const current = this.port.journal.artifact(item.artifact);\n if (transitionStarted(current) && !committed.some(candidate => candidate.artifact === item.artifact)) {\n committed.push(committedArtifact(current));\n }\n throw new CommitUnitError(error, currentStagedArtifacts(this.port.journal.artifacts()), committed);\n }\n }\n return Object.freeze(committed);\n }\n\n private async captureOriginal(item: CommitArtifactView, signal: AbortSignal): Promise<void> {\n const firstCapture = await this.port.observePublic(item);\n if (\n !sameArtifactState(firstCapture, item.artifact.original) ||\n firstCapture.status !== 'present' ||\n !item.originalIdentity ||\n !sameIdentity(firstCapture.identity, item.originalIdentity)\n ) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n const backup = await this.port.createBackupFile(item, firstCapture.contents, signal, firstCapture.mode);\n if ((await this.port.readOwnedFile(item, backup.path)) !== firstCapture.contents) {\n throw this.port.ownershipFailure(item.artifact.path);\n }\n const secondCapture = await this.port.observePublic(item);\n if (\n secondCapture.status !== 'present' ||\n !sameIdentity(secondCapture.identity, firstCapture.identity) ||\n secondCapture.contents !== firstCapture.contents\n ) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n await this.quarantineOriginal(item, firstCapture);\n }\n\n private async quarantineOriginal(item: CommitArtifactView, captured: ObservedPresentState): Promise<void> {\n await this.port.assertParentChain(item);\n await this.port.assertNamespace(item);\n const immediatelyBefore = await this.port.observePublic(item);\n if (\n immediatelyBefore.status !== 'present' ||\n !sameIdentity(immediatelyBefore.identity, captured.identity) ||\n immediatelyBefore.contents !== captured.contents\n ) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n let quarantine = this.port.journal.addQuarantine(\n item,\n join(required(item.namespace).path, `quarantine-${randomUUID()}`),\n );\n await this.port.assertExpectedAbsent(quarantine.path, item.artifact.path);\n let renameFailure: unknown;\n try {\n await this.port.rename(item.artifact.path, quarantine.path);\n } catch (error: unknown) {\n renameFailure = error;\n }\n const quarantinedStat = await this.port.lstatOrAbsent(quarantine.path);\n if (quarantinedStat !== 'absent') {\n quarantine = this.port.journal.confirmOwnedFile(item, quarantine.path, identity(quarantinedStat));\n const quarantinedContents = await this.port.readOwnedFile(item, quarantine.path);\n if (\n !sameIdentity(required(quarantine.identity), captured.identity) ||\n quarantinedContents !== captured.contents\n ) {\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, true);\n await this.restorePreservedQuarantine(item, quarantine);\n throw this.port.concurrentModification(item.artifact.path, renameFailure);\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (renameFailure !== undefined) throw renameFailure;\n if (destination !== 'absent') throw this.port.concurrentModification(item.artifact.path);\n await this.port.assertParentChain(item);\n return;\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (\n renameFailure !== undefined &&\n destination !== 'absent' &&\n sameIdentity(identity(destination), captured.identity)\n ) {\n throw renameFailure;\n }\n throw this.port.concurrentModification(item.artifact.path, renameFailure);\n }\n\n private async installProposed(item: CommitArtifactView): Promise<void> {\n const stage = required(item.stage);\n await this.port.assertOwnedIdentity(item, stage.path);\n await this.port.assertParentChain(item);\n await this.port.assertExpectedAbsent(item.artifact.path, item.artifact.path);\n let linkFailure: unknown;\n try {\n await this.port.link(stage.path, item.artifact.path);\n } catch (error: unknown) {\n linkFailure = error;\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (destination !== 'absent' && stage.identity && sameIdentity(identity(destination), stage.identity)) {\n this.port.journal.recordInstalledIdentity(item, stage.identity);\n await this.port.assertParentChain(item);\n if (linkFailure !== undefined) throw linkFailure;\n return;\n }\n if (destination !== 'absent') throw this.port.concurrentModification(item.artifact.path, linkFailure);\n if (linkFailure !== undefined) throw linkFailure;\n throw this.port.ownershipFailure(item.artifact.path);\n }\n\n private async restorePreservedQuarantine(item: CommitArtifactView, quarantine: OwnedFileView): Promise<void> {\n const quarantineIdentity = required(quarantine.identity);\n if ((await this.port.lstatOrAbsent(item.artifact.path)) !== 'absent') return;\n try {\n await this.port.link(quarantine.path, item.artifact.path);\n } catch (error: unknown) {\n this.port.journal.recordRecoveryFailure(error);\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (destination !== 'absent' && sameIdentity(identity(destination), quarantineIdentity)) {\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, false);\n }\n }\n}\n\nfunction committedArtifact(item: CommitArtifactView): CommittedArtifact {\n return Object.freeze({\n artifact: item.artifact,\n committed: true,\n ...(item.stage === undefined ? {} : { stagingPath: item.stage.path }),\n ...(item.backup === undefined ? {} : { backupPath: item.backup.path }),\n });\n}\n\nfunction transitionStarted(item: CommitArtifactView): boolean {\n return item.installedIdentity !== undefined || item.quarantines.some(quarantine => quarantine.exists);\n}\n\nfunction currentStagedArtifacts(items: readonly CommitArtifactView[]): readonly StagedArtifact[] {\n return Object.freeze(\n items.map(item =>\n Object.freeze({\n artifact: item.artifact,\n ...(item.stage === undefined ? {} : { stagingPath: item.stage.path }),\n ...(item.backup === undefined ? {} : { backupPath: item.backup.path }),\n }),\n ),\n );\n}\n","import { randomUUID } from 'node:crypto';\nimport { join } from 'node:path';\nimport type { CommittedArtifact } from './commit.unit';\nimport type { OwnedFileView, RollbackArtifactView, RollbackPort } from './transaction-unit.ports';\nimport {\n RecoveryUnitError,\n identity,\n recoveryOutcome,\n recoveryUnitError,\n required,\n sameArtifactState,\n sameIdentity,\n type ObservedPresentState,\n type ObservedState,\n type RecoveryOutcome,\n} from './transaction-unit.state';\n\nexport interface RollbackUnit {\n rollback(committed: readonly CommittedArtifact[]): Promise<readonly string[]>;\n}\n\nexport class FileSystemRollbackUnit implements RollbackUnit {\n constructor(private readonly port: RollbackPort) {}\n\n public async rollback(committed: readonly CommittedArtifact[]): Promise<readonly string[]> {\n let items: readonly RollbackArtifactView[];\n try {\n items = committed.map(entry => this.port.journal.artifact(entry.artifact));\n } catch (error: unknown) {\n throw recoveryUnitError(error);\n }\n const failures = [...this.port.journal.recoveryFailures()];\n for (const item of items) await this.restoreOriginal(item, failures);\n const paths = new Set<string>();\n for (const item of this.port.journal.artifacts()) {\n const restored = await this.verifyOriginal(item, failures);\n this.port.journal.recordRestored(item, restored);\n if (!restored) paths.add(item.artifact.path);\n }\n return recoveryResult(recoveryOutcome(paths, failures));\n }\n\n private async restoreOriginal(item: RollbackArtifactView, failures: unknown[]): Promise<void> {\n let current: ObservedState | 'unknown';\n try {\n current = await this.port.observePublic(item);\n } catch (error: unknown) {\n failures.push(error);\n current = 'unknown';\n }\n if (current !== 'unknown' && this.isConfirmedOriginal(item, current)) return;\n if (current !== 'unknown' && current.status === 'present') {\n if (\n !item.installedIdentity ||\n !sameIdentity(current.identity, item.installedIdentity) ||\n item.artifact.proposed.status !== 'present' ||\n current.contents !== item.artifact.proposed.contents\n ) {\n if (item.stage && item.installedIdentity && sameIdentity(current.identity, item.installedIdentity)) {\n this.port.journal.setOwnedFilePreserved(item, item.stage.path, true);\n }\n return;\n }\n if (!(await this.recoveryQuarantine(item, current, failures))) return;\n } else if (current === 'unknown') {\n return;\n }\n if (item.artifact.original.status === 'absent') return;\n const backup = item.backup;\n if (!backup) return;\n try {\n if ((await this.port.readOwnedFile(item, backup.path)) !== item.artifact.original.contents) return;\n await this.port.assertParentChain(item);\n await this.port.assertExpectedAbsent(item.artifact.path, item.artifact.path);\n try {\n await this.port.link(backup.path, item.artifact.path);\n } catch (error: unknown) {\n failures.push(error);\n }\n const restored = await this.port.lstatOrAbsent(item.artifact.path);\n if (\n restored !== 'absent' &&\n !restored.isSymbolicLink() &&\n restored.isFile() &&\n backup.identity &&\n sameIdentity(identity(restored), backup.identity)\n ) {\n this.port.journal.recordRestoredIdentity(item, backup.identity);\n }\n } catch (error: unknown) {\n failures.push(error);\n }\n }\n\n private async recoveryQuarantine(\n item: RollbackArtifactView,\n current: ObservedPresentState,\n failures: unknown[],\n ): Promise<boolean> {\n let quarantine = this.port.journal.addQuarantine(\n item,\n join(required(item.namespace).path, `quarantine-rollback-${randomUUID()}`),\n );\n try {\n await this.port.assertParentChain(item);\n await this.port.assertNamespace(item);\n const before = await this.port.observePublic(item);\n if (\n before.status !== 'present' ||\n !sameIdentity(before.identity, current.identity) ||\n before.contents !== current.contents\n ) {\n return false;\n }\n await this.port.assertExpectedAbsent(quarantine.path, item.artifact.path);\n try {\n await this.port.rename(item.artifact.path, quarantine.path);\n } catch (error: unknown) {\n failures.push(error);\n }\n const quarantined = await this.port.lstatOrAbsent(quarantine.path);\n if (quarantined === 'absent') return false;\n quarantine = this.port.journal.confirmOwnedFile(item, quarantine.path, identity(quarantined));\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, true);\n if (!sameIdentity(required(quarantine.identity), current.identity)) {\n await this.restorePreservedQuarantine(item, quarantine, failures);\n return false;\n }\n if ((await this.port.readOwnedFile(item, quarantine.path)) !== current.contents) {\n await this.restorePreservedQuarantine(item, quarantine, failures);\n return false;\n }\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, false);\n return (await this.port.lstatOrAbsent(item.artifact.path)) === 'absent';\n } catch (error: unknown) {\n failures.push(error);\n return false;\n }\n }\n\n private async restorePreservedQuarantine(\n item: RollbackArtifactView,\n quarantine: OwnedFileView,\n failures: unknown[],\n ): Promise<void> {\n const quarantineIdentity = required(quarantine.identity);\n if ((await this.port.lstatOrAbsent(item.artifact.path)) !== 'absent') return;\n try {\n await this.port.link(quarantine.path, item.artifact.path);\n } catch (error: unknown) {\n failures.push(error);\n }\n const destination = await this.port.lstatOrAbsent(item.artifact.path);\n if (destination !== 'absent' && sameIdentity(identity(destination), quarantineIdentity)) {\n this.port.journal.setOwnedFilePreserved(item, quarantine.path, false);\n }\n }\n\n private async verifyOriginal(item: RollbackArtifactView, failures: unknown[]): Promise<boolean> {\n try {\n return this.isConfirmedOriginal(item, await this.port.observePublic(item));\n } catch (error: unknown) {\n failures.push(error);\n return false;\n }\n }\n\n private isConfirmedOriginal(item: RollbackArtifactView, observed: ObservedState): boolean {\n if (!sameArtifactState(observed, item.artifact.original)) return false;\n if (observed.status === 'absent') return true;\n return [item.originalIdentity, item.restoredIdentity].some(\n expected => expected !== undefined && sameIdentity(observed.identity, expected),\n );\n }\n}\n\nfunction recoveryResult(outcome: RecoveryOutcome): readonly string[] {\n if (outcome.failures.length > 0) throw new RecoveryUnitError(outcome.paths, outcome.failures);\n return outcome.paths;\n}\n","import { randomUUID } from 'node:crypto';\nimport { basename, dirname, join } from 'node:path';\nimport type { PlannedOutputArtifact } from '../migrator/migration-plan';\nimport type { StagingArtifactView, StagingPort } from './transaction-unit.ports';\nimport { identity, required } from './transaction-unit.state';\n\nexport interface StagedArtifact {\n readonly artifact: PlannedOutputArtifact;\n readonly stagingPath?: string;\n readonly backupPath?: string;\n}\n\nexport interface StagingUnit {\n stage(artifacts: readonly PlannedOutputArtifact[], signal: AbortSignal): Promise<readonly StagedArtifact[]>;\n}\n\nexport class StagingUnitError extends Error {\n constructor(\n cause: unknown,\n readonly staged: readonly StagedArtifact[],\n ) {\n super(cause instanceof Error ? cause.message : 'Migration transaction staging failed.', { cause });\n this.name = 'StagingUnitError';\n this.staged = Object.freeze([...staged]);\n }\n}\n\nexport class FileSystemStagingUnit implements StagingUnit {\n constructor(private readonly port: StagingPort) {}\n\n public async stage(\n artifacts: readonly PlannedOutputArtifact[],\n signal: AbortSignal,\n ): Promise<readonly StagedArtifact[]> {\n try {\n await this.port.journal.prepare(artifacts);\n const items = this.port.journal.artifacts();\n for (const item of items) await this.ensureParentDirectories(item, signal);\n for (const item of items) await this.createNamespace(item);\n for (const item of items) {\n if (item.artifact.proposed.status === 'absent') continue;\n this.port.assertNotInterrupted(signal);\n const stage = await this.port.createStageFile(item, item.artifact.proposed.contents, signal, item.originalMode);\n const staged = await this.port.readOwnedFile(item, stage.path);\n if (item.artifact.kind === 'template') this.port.validateStagedTemplate(item.artifact.path, staged);\n }\n return stagedArtifacts(this.port.journal.artifacts());\n } catch (error: unknown) {\n throw new StagingUnitError(error, stagedArtifacts(this.port.journal.artifacts()));\n }\n }\n\n private async ensureParentDirectories(item: StagingArtifactView, signal: AbortSignal): Promise<void> {\n for (let index = 0; index < item.directories.length; index++) {\n this.port.assertNotInterrupted(signal);\n const expectation = item.directories[index];\n if (!expectation) continue;\n if (expectation.original !== 'absent') {\n await this.port.assertDirectoryExpectation(expectation.path, expectation.original, item.artifact.path);\n continue;\n }\n const existingCreation = this.port.journal.createdDirectory(expectation.path);\n if (existingCreation) {\n this.port.journal.addCreatedDirectoryPublicPath(expectation.path, item.artifact.path);\n await this.port.assertDirectoryIdentity(\n expectation.path,\n required(existingCreation.identity),\n item.artifact.path,\n );\n continue;\n }\n await this.port.assertExpectedAbsent(expectation.path, item.artifact.path);\n const parentExpectation = item.directories[index - 1];\n if (parentExpectation) await this.port.assertExpectedDirectory(parentExpectation, item);\n try {\n await this.port.mkdir(expectation.path, { mode: 0o755 });\n } catch (error: unknown) {\n this.port.journal.recordUnconfirmedEntry(expectation.path, item.artifact.path);\n throw error;\n }\n this.port.journal.recordCreatedDirectory(expectation.path, item.artifact.path);\n const createdStat = await this.port.lstat(expectation.path);\n if (createdStat.isSymbolicLink() || !createdStat.isDirectory()) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n this.port.journal.confirmCreatedDirectory(expectation.path, identity(createdStat));\n if (parentExpectation) await this.port.assertExpectedDirectory(parentExpectation, item);\n }\n await this.port.assertParentChain(item);\n }\n\n private async createNamespace(item: StagingArtifactView): Promise<void> {\n await this.port.assertParentChain(item);\n const namespacePath = join(dirname(item.artifact.path), `.${basename(item.artifact.path)}.${randomUUID()}.txn`);\n await this.port.assertExpectedAbsent(namespacePath, item.artifact.path);\n try {\n await this.port.mkdir(namespacePath, { mode: 0o700 });\n } catch (error: unknown) {\n this.port.journal.recordUnconfirmedEntry(namespacePath, item.artifact.path);\n throw error;\n }\n this.port.journal.recordNamespace(item, namespacePath);\n const namespaceStat = await this.port.lstat(namespacePath);\n if (namespaceStat.isSymbolicLink() || !namespaceStat.isDirectory()) {\n throw this.port.concurrentModification(item.artifact.path);\n }\n this.port.journal.confirmNamespace(item, identity(namespaceStat));\n await this.port.assertParentChain(item);\n }\n}\n\nfunction stagedArtifacts(items: readonly StagingArtifactView[]): readonly StagedArtifact[] {\n return Object.freeze(items.map(item => stagedArtifact(item)));\n}\n\nfunction stagedArtifact(item: StagingArtifactView): StagedArtifact {\n return Object.freeze({\n artifact: item.artifact,\n ...(item.stagingPath === undefined ? {} : { stagingPath: item.stagingPath }),\n });\n}\n","export type TransactionInterruptionHandler = (signal: NodeJS.Signals) => void;\n\nexport interface TransactionSignalTarget {\n on(signal: NodeJS.Signals, listener: TransactionInterruptionHandler): void;\n off(signal: NodeJS.Signals, listener: TransactionInterruptionHandler): void;\n}\n\nexport interface TransactionSignalRegistrarLike {\n register(handler: TransactionInterruptionHandler): () => void;\n}\n\nconst transactionSignals: readonly NodeJS.Signals[] = ['SIGINT', 'SIGTERM'];\n\nexport class TransactionSignalRegistrar implements TransactionSignalRegistrarLike {\n constructor(private readonly target: TransactionSignalTarget = process) {}\n\n register(handler: TransactionInterruptionHandler): () => void {\n for (const signal of transactionSignals) this.target.on(signal, handler);\n\n let registered = true;\n return () => {\n if (!registered) return;\n registered = false;\n for (const signal of transactionSignals) this.target.off(signal, handler);\n };\n }\n}\n","import { constants } from 'node:fs';\nimport { access, link, lstat, mkdir, open, rename, rmdir, stat, unlink } from 'node:fs/promises';\nimport { dirname, join, resolve } from 'node:path';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { PlannedOutputArtifact } from '../migrator/migration-plan';\nimport { AngularTemplateParser } from '../template/angular-template.parser';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport type {\n CleanupArtifactView,\n CleanupJournal,\n CleanupPort,\n CommitArtifactView,\n CommitJournal,\n CommitPort,\n CreatedDirectoryView,\n OwnedFileView,\n RollbackArtifactView,\n RollbackJournal,\n RollbackPort,\n StagingArtifactView,\n StagingJournal,\n StagingPort,\n UnconfirmedEntryView,\n} from './transaction-unit.ports';\nimport {\n fileMode,\n identity,\n isEnoent,\n required,\n runtimeArtifact,\n sameArtifactState,\n sameIdentity,\n type CreatedDirectory,\n type DirectoryExpectation,\n type FileIdentity,\n type MigrationTransactionFileHandle,\n type MigrationTransactionOperations,\n type MigrationTransactionStat,\n type ObservedState,\n type OwnedFile,\n type OwnedNamespace,\n type RuntimeArtifact,\n type TransactionUnitContext,\n} from './transaction-unit.state';\n\nexport {\n RecoveryUnitError,\n fileMode,\n identity,\n isDirectoryNotEmpty,\n isEnoent,\n pathDepth,\n recoveryOutcome,\n recoveryUnitError,\n required,\n runtimeArtifact,\n sameArtifactState,\n sameIdentity,\n sortedUnique,\n} from './transaction-unit.state';\nexport type {\n CreatedDirectory,\n DirectoryExpectation,\n FileIdentity,\n MigrationTransactionFileHandle,\n MigrationTransactionOperations,\n MigrationTransactionStat,\n ObservedPresentState,\n ObservedState,\n OwnedFile,\n OwnedNamespace,\n RecoveryOutcome,\n RuntimeArtifact,\n TransactionUnitContext,\n} from './transaction-unit.state';\n\nexport const nodeTransactionOperations: MigrationTransactionOperations = {\n access,\n link,\n lstat,\n mkdir,\n open: (target, flags) => open(target, flags),\n rename,\n rmdir,\n stat,\n unlink,\n};\n\nexport class TransactionUnitSession {\n private readonly context: TransactionUnitContext;\n\n constructor(\n private readonly operations: MigrationTransactionOperations = nodeTransactionOperations,\n private readonly parser: AngularTemplateParser = new AngularTemplateParser(),\n ownershipChanged: () => void = () => undefined,\n ) {\n this.context = {\n items: [],\n createdDirectories: new Map(),\n unconfirmedEntries: new Map(),\n recoveryFailures: [],\n restored: new Map(),\n ownershipChanged,\n };\n }\n\n public stagingPort(): StagingPort {\n const journal: StagingJournal = Object.freeze({\n prepare: (artifacts: readonly PlannedOutputArtifact[]) => this.prepare(artifacts),\n artifacts: () => Object.freeze(this.context.items.map(stagingArtifactView)),\n createdDirectory: (path: string) => createdDirectoryView(this.context.createdDirectories.get(path)),\n addCreatedDirectoryPublicPath: (path: string, publicPath: string) =>\n required(this.context.createdDirectories.get(path)).publicPaths.add(publicPath),\n recordUnconfirmedEntry: (path: string, publicPath: string) => this.recordUnconfirmedEntry(path, publicPath),\n recordCreatedDirectory: (path: string, publicPath: string) => this.recordCreatedDirectory(path, publicPath),\n confirmCreatedDirectory: (path: string, expected: FileIdentity) => {\n required(this.context.createdDirectories.get(path)).identity = expected;\n },\n recordNamespace: (item: StagingArtifactView, path: string) => this.recordNamespace(item.artifact, path),\n confirmNamespace: (item: StagingArtifactView, expected: FileIdentity) => {\n required(this.runtimeArtifact(item.artifact).namespace).identity = expected;\n },\n });\n return Object.freeze({\n journal,\n assertDirectoryExpectation: (\n path: string,\n expected: Exclude<DirectoryExpectation['original'], 'absent'>,\n publicPath: string,\n ) => this.assertDirectoryExpectation(path, expected, publicPath),\n assertDirectoryIdentity: (path: string, expected: FileIdentity, publicPath: string) =>\n this.assertDirectoryIdentity(path, expected, publicPath),\n assertExpectedAbsent: (path: string, publicPath: string) => this.assertExpectedAbsent(path, publicPath),\n assertExpectedDirectory: (expectation: DirectoryExpectation, item: StagingArtifactView) =>\n this.assertExpectedDirectory(expectation, this.runtimeArtifact(item.artifact), this.context),\n assertNotInterrupted: (signal: AbortSignal) => this.assertNotInterrupted(signal),\n assertParentChain: (item: StagingArtifactView) =>\n this.assertParentChain(this.runtimeArtifact(item.artifact), this.context),\n concurrentModification: (publicPath: string, cause?: unknown) => this.concurrentModification(publicPath, cause),\n createStageFile: (item: StagingArtifactView, contents: string, signal: AbortSignal, mode?: number) =>\n this.createStageFile(this.runtimeArtifact(item.artifact), contents, signal, mode),\n lstat: (path: string) => this.operations.lstat(path),\n mkdir: (path: string, options?: { readonly recursive?: boolean; readonly mode?: number }) =>\n this.operations.mkdir(path, options),\n readOwnedFile: (item: StagingArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.readOwnedFile(runtime, this.ownedFile(runtime, ownedPath));\n },\n validateStagedTemplate: (publicPath: string, contents: string) =>\n this.validateStagedTemplate(publicPath, contents),\n });\n }\n\n public commitPort(): CommitPort {\n const journal: CommitJournal = Object.freeze({\n artifact: (artifact: PlannedOutputArtifact) => commitArtifactView(this.runtimeArtifact(artifact)),\n artifacts: () => Object.freeze(this.context.items.map(commitArtifactView)),\n addQuarantine: (item: CommitArtifactView, path: string) =>\n ownedFileView(this.addQuarantine(this.runtimeArtifact(item.artifact), path)),\n confirmOwnedFile: (item: CommitArtifactView, ownedPath: string, expected: FileIdentity) =>\n ownedFileView(this.confirmOwnedFile(this.runtimeArtifact(item.artifact), ownedPath, expected)),\n setOwnedFilePreserved: (item: CommitArtifactView, ownedPath: string, preserve: boolean) => {\n this.ownedFile(this.runtimeArtifact(item.artifact), ownedPath).preserve = preserve;\n },\n recordInstalledIdentity: (item: CommitArtifactView, expected: FileIdentity) => {\n this.runtimeArtifact(item.artifact).installedIdentity = expected;\n },\n recordRecoveryFailure: (error: unknown) => this.context.recoveryFailures.push(error),\n });\n return Object.freeze({\n journal,\n assertExpectedAbsent: (path: string, publicPath: string) => this.assertExpectedAbsent(path, publicPath),\n assertNamespace: (item: CommitArtifactView) => this.assertNamespace(this.runtimeArtifact(item.artifact)),\n assertNotInterrupted: (signal: AbortSignal) => this.assertNotInterrupted(signal),\n assertOwnedIdentity: (item: CommitArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.assertOwnedIdentity(runtime, this.ownedFile(runtime, ownedPath));\n },\n assertParentChain: (item: CommitArtifactView) =>\n this.assertParentChain(this.runtimeArtifact(item.artifact), this.context),\n concurrentModification: (publicPath: string, cause?: unknown) => this.concurrentModification(publicPath, cause),\n createBackupFile: (item: CommitArtifactView, contents: string, signal: AbortSignal, mode?: number) =>\n this.createBackupFile(this.runtimeArtifact(item.artifact), contents, signal, mode),\n link: (existingPath: string, newPath: string) => this.operations.link(existingPath, newPath),\n lstatOrAbsent: (path: string) => this.lstatOrAbsent(path),\n observePublic: (item: CommitArtifactView) =>\n this.observePublic(this.runtimeArtifact(item.artifact), this.context),\n ownershipFailure: (publicPath: string) => this.ownershipFailure(publicPath),\n readOwnedFile: (item: CommitArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.readOwnedFile(runtime, this.ownedFile(runtime, ownedPath));\n },\n rename: (source: string, destination: string) => this.operations.rename(source, destination),\n });\n }\n\n public rollbackPort(): RollbackPort {\n const journal: RollbackJournal = Object.freeze({\n artifact: (artifact: PlannedOutputArtifact) => rollbackArtifactView(this.runtimeArtifact(artifact)),\n artifacts: () => Object.freeze(this.context.items.map(rollbackArtifactView)),\n recoveryFailures: () => Object.freeze([...this.context.recoveryFailures]),\n addQuarantine: (item: RollbackArtifactView, path: string) =>\n ownedFileView(this.addQuarantine(this.runtimeArtifact(item.artifact), path)),\n confirmOwnedFile: (item: RollbackArtifactView, ownedPath: string, expected: FileIdentity) =>\n ownedFileView(this.confirmOwnedFile(this.runtimeArtifact(item.artifact), ownedPath, expected)),\n setOwnedFilePreserved: (item: RollbackArtifactView, ownedPath: string, preserve: boolean) => {\n this.ownedFile(this.runtimeArtifact(item.artifact), ownedPath).preserve = preserve;\n },\n recordRestoredIdentity: (item: RollbackArtifactView, expected: FileIdentity) => {\n this.runtimeArtifact(item.artifact).restoredIdentity = expected;\n },\n recordRestored: (item: RollbackArtifactView, restored: boolean) => {\n this.context.restored.set(this.runtimeArtifact(item.artifact), restored);\n },\n });\n return Object.freeze({\n journal,\n assertExpectedAbsent: (path: string, publicPath: string) => this.assertExpectedAbsent(path, publicPath),\n assertNamespace: (item: RollbackArtifactView) => this.assertNamespace(this.runtimeArtifact(item.artifact)),\n assertParentChain: (item: RollbackArtifactView) =>\n this.assertParentChain(this.runtimeArtifact(item.artifact), this.context),\n link: (existingPath: string, newPath: string) => this.operations.link(existingPath, newPath),\n lstatOrAbsent: (path: string) => this.lstatOrAbsent(path),\n observePublic: (item: RollbackArtifactView) =>\n this.observePublic(this.runtimeArtifact(item.artifact), this.context),\n readOwnedFile: (item: RollbackArtifactView, ownedPath: string) => {\n const runtime = this.runtimeArtifact(item.artifact);\n return this.readOwnedFile(runtime, this.ownedFile(runtime, ownedPath));\n },\n rename: (source: string, destination: string) => this.operations.rename(source, destination),\n });\n }\n\n public cleanupPort(): CleanupPort {\n const journal: CleanupJournal = Object.freeze({\n artifact: (artifact: PlannedOutputArtifact) => cleanupArtifactView(this.runtimeArtifact(artifact)),\n artifacts: () => Object.freeze(this.context.items.map(cleanupArtifactView)),\n createdDirectories: () =>\n Object.freeze([...this.context.createdDirectories.values()].map(directory => createdDirectoryView(directory)!)),\n unconfirmedEntries: () => this.unconfirmedEntryViews(),\n restored: (item: CleanupArtifactView) => this.context.restored.get(this.runtimeArtifact(item.artifact)),\n markOwnedFileAbsent: (item: CleanupArtifactView, ownedPath: string) => {\n this.ownedFile(this.runtimeArtifact(item.artifact), ownedPath).exists = false;\n },\n markNamespaceAbsent: (item: CleanupArtifactView) => {\n required(this.runtimeArtifact(item.artifact).namespace).exists = false;\n },\n markCreatedDirectoryAbsent: (path: string) => {\n required(this.context.createdDirectories.get(path)).exists = false;\n this.context.ownershipChanged();\n },\n finishArtifactCleanup: () => this.context.ownershipChanged(),\n });\n return Object.freeze({\n journal,\n assertNamespace: (item: CleanupArtifactView) => this.assertNamespace(this.runtimeArtifact(item.artifact)),\n closeReadHandles: (item: CleanupArtifactView, failures: unknown[]) =>\n this.closeReadHandles(this.runtimeArtifact(item.artifact), failures),\n closeOpenHandle: (item: CleanupArtifactView, failures: unknown[]) =>\n this.closeOpenHandle(this.runtimeArtifact(item.artifact), failures),\n lstat: (path: string) => this.operations.lstat(path),\n lstatOrAbsent: (path: string) => this.lstatOrAbsent(path),\n observePublic: (item: CleanupArtifactView) =>\n this.observePublic(this.runtimeArtifact(item.artifact), this.context),\n rmdir: (path: string) => this.operations.rmdir(path),\n unlink: (path: string) => this.operations.unlink(path),\n });\n }\n\n public async prepareForPreflight(artifacts: readonly PlannedOutputArtifact[]): Promise<void> {\n await this.prepare(artifacts);\n }\n\n public hasOwnedArtifacts(): boolean {\n return (\n [...this.context.createdDirectories.values()].some(directory => directory.exists) ||\n this.context.items.some(\n item =>\n item.namespace?.exists ||\n item.stage?.exists ||\n item.backup?.exists ||\n item.quarantines.some(quarantine => quarantine.exists),\n )\n );\n }\n\n private async prepare(artifacts: readonly PlannedOutputArtifact[]): Promise<void> {\n const ordered = [...artifacts].sort((left, right) => compareCodeUnits(resolve(left.path), resolve(right.path)));\n for (let index = 1; index < ordered.length; index++) {\n const previous = ordered[index - 1];\n const current = ordered[index];\n if (!previous || !current || previous.path !== current.path) continue;\n throw new MigrationApplicationError('path-collision', `Migration paths collide: ${current.path}`, [current.path]);\n }\n\n for (const artifact of ordered) {\n let item: RuntimeArtifact | undefined;\n try {\n const directories = await this.inspectDirectoryChain(dirname(artifact.path), artifact.path);\n item = { artifact, directories, quarantines: [], ownedFiles: [], readHandles: new Set() };\n const current = await this.observePublic(item);\n if (!sameArtifactState(current, artifact.original)) throw this.concurrentModification(artifact.path);\n if (current.status === 'present') {\n item.originalIdentity = current.identity;\n item.originalMode = current.mode;\n }\n this.context.items.push(item);\n } catch (error: unknown) {\n const closeFailures: unknown[] = [];\n if (item) await this.closeReadHandles(item, closeFailures);\n const failure = this.attachRecoveryFailures(artifact.path, error, closeFailures);\n if (failure instanceof MigrationApplicationError) throw failure;\n throw new MigrationApplicationError(\n 'transaction-io',\n `Could not verify migration destination: ${artifact.path}`,\n [artifact.path],\n { cause: failure },\n );\n }\n }\n }\n\n private async inspectDirectoryChain(parent: string, publicPath: string): Promise<readonly DirectoryExpectation[]> {\n const result: DirectoryExpectation[] = [];\n let missing = false;\n for (const candidate of directoryChain(parent)) {\n if (missing) {\n result.push({ path: candidate, original: 'absent' });\n continue;\n }\n try {\n const candidateStat = await this.operations.lstat(candidate);\n const isImmediateParent = candidate === resolve(parent);\n if (\n (!candidateStat.isSymbolicLink() && !candidateStat.isDirectory()) ||\n (isImmediateParent && candidateStat.isSymbolicLink())\n ) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination parent must be a directory: ${candidate}`,\n [publicPath],\n );\n }\n if (candidateStat.isSymbolicLink()) {\n const followed = await this.operations.stat(candidate);\n if (!followed.isDirectory()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination ancestor must resolve to a directory: ${candidate}`,\n [publicPath],\n );\n }\n result.push({\n path: candidate,\n original: {\n identity: identity(candidateStat),\n kind: 'symbolic-link',\n followedIdentity: identity(followed),\n },\n });\n } else {\n result.push({ path: candidate, original: { identity: identity(candidateStat), kind: 'directory' } });\n }\n } catch (error: unknown) {\n if (!isEnoent(error)) throw error;\n missing = true;\n result.push({ path: candidate, original: 'absent' });\n }\n }\n const nearestExisting = [...result].reverse().find(item => item.original !== 'absent');\n if (nearestExisting) await this.operations.access(nearestExisting.path, constants.W_OK | constants.X_OK);\n return result;\n }\n\n private async createStageFile(\n item: RuntimeArtifact,\n contents: string,\n signal: AbortSignal,\n mode?: number,\n ): Promise<OwnedFileView> {\n await this.assertNamespace(item);\n const namespace = required(item.namespace);\n const owned = this.registerOwnedFile(item, join(namespace.path, 'stage'));\n item.stage = owned;\n await this.writeOwnedFile(item, owned, contents, signal, mode);\n return ownedFileView(owned);\n }\n\n private async createBackupFile(\n item: RuntimeArtifact,\n contents: string,\n signal: AbortSignal,\n mode?: number,\n ): Promise<OwnedFileView> {\n await this.assertNamespace(item);\n const namespace = required(item.namespace);\n const owned = this.registerOwnedFile(item, join(namespace.path, 'backup'));\n item.backup = owned;\n await this.writeOwnedFile(item, owned, contents, signal, mode);\n return ownedFileView(owned);\n }\n\n private registerOwnedFile(item: RuntimeArtifact, path: string): OwnedFile {\n const owned: OwnedFile = {\n path,\n publicPath: item.artifact.path,\n exists: false,\n preserve: false,\n };\n item.ownedFiles.push(owned);\n return owned;\n }\n\n private async writeOwnedFile(\n item: RuntimeArtifact,\n owned: OwnedFile,\n contents: string,\n signal: AbortSignal,\n mode?: number,\n ): Promise<void> {\n await this.assertExpectedAbsent(owned.path, item.artifact.path);\n const handle = await this.operations.open(owned.path, 'wx');\n owned.exists = true;\n item.openHandle = handle;\n this.context.ownershipChanged();\n if (mode !== undefined) await handle.chmod(mode);\n owned.identity = identity(await handle.stat());\n this.assertNotInterrupted(signal);\n await handle.writeFile(contents, 'utf8');\n this.assertNotInterrupted(signal);\n await handle.sync();\n this.assertNotInterrupted(signal);\n await handle.close();\n item.openHandle = undefined;\n this.assertNotInterrupted(signal);\n await this.assertOwnedIdentity(item, owned);\n }\n\n private runtimeArtifact(artifact: PlannedOutputArtifact): RuntimeArtifact {\n return runtimeArtifact(this.context, artifact);\n }\n\n private ownedFile(item: RuntimeArtifact, path: string): OwnedFile {\n const owned = item.ownedFiles.find(candidate => candidate.path === path);\n if (owned !== undefined) return owned;\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Migration transaction journal contains an unknown invocation-owned file: ${path}`,\n [item.artifact.path],\n );\n }\n\n private addQuarantine(item: RuntimeArtifact, path: string): OwnedFile {\n const quarantine = this.registerOwnedFile(item, path);\n item.quarantines.push(quarantine);\n return quarantine;\n }\n\n private confirmOwnedFile(item: RuntimeArtifact, path: string, expected: FileIdentity): OwnedFile {\n const owned = this.ownedFile(item, path);\n owned.exists = true;\n owned.identity = expected;\n return owned;\n }\n\n private recordNamespace(artifact: PlannedOutputArtifact, path: string): void {\n const item = this.runtimeArtifact(artifact);\n item.namespace = { path, publicPath: item.artifact.path, exists: true };\n this.context.ownershipChanged();\n }\n\n private recordCreatedDirectory(path: string, publicPath: string): void {\n this.context.createdDirectories.set(path, {\n path,\n publicPaths: new Set([publicPath]),\n exists: true,\n });\n this.context.ownershipChanged();\n }\n\n private recordUnconfirmedEntry(path: string, publicPath: string): void {\n const publicPaths = this.context.unconfirmedEntries.get(path) ?? new Set<string>();\n publicPaths.add(publicPath);\n this.context.unconfirmedEntries.set(path, publicPaths);\n }\n\n private unconfirmedEntryViews(): readonly UnconfirmedEntryView[] {\n return Object.freeze(\n [...this.context.unconfirmedEntries].map(([path, publicPaths]) =>\n Object.freeze({ path, publicPaths: Object.freeze([...publicPaths]) }),\n ),\n );\n }\n\n private async closeOpenHandle(item: RuntimeArtifact, failures: unknown[]): Promise<void> {\n if (!item.openHandle) return;\n try {\n await item.openHandle.close();\n } catch (error: unknown) {\n failures.push(error);\n }\n item.openHandle = undefined;\n }\n\n private validateStagedTemplate(publicPath: string, contents: string): void {\n if (this.parser.parse(contents, publicPath).status !== 'parse-error') return;\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Staged template failed Angular validation: ${publicPath}`,\n [publicPath],\n );\n }\n\n private async observePublic(item: RuntimeArtifact, context?: TransactionUnitContext): Promise<ObservedState> {\n await this.assertParentChain(item, context);\n const before = await this.lstatOrAbsent(item.artifact.path);\n if (before === 'absent') return { status: 'absent' };\n if (before.isSymbolicLink() || !before.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Migration destination must be a regular file: ${item.artifact.path}`,\n [item.artifact.path],\n );\n }\n const beforeIdentity = identity(before);\n const handle = await this.operations.open(item.artifact.path, 'r');\n const contents = await this.readThroughHandle(item, handle, async () => {\n const handleBefore = identity(await handle.stat());\n if (!sameIdentity(beforeIdentity, handleBefore)) throw this.concurrentModification(item.artifact.path);\n const read = await handle.readFile({ encoding: 'utf8' });\n const handleAfter = identity(await handle.stat());\n if (!sameIdentity(handleBefore, handleAfter)) throw this.concurrentModification(item.artifact.path);\n return read;\n });\n const after = await this.lstatOrAbsent(item.artifact.path);\n if (\n after === 'absent' ||\n after.isSymbolicLink() ||\n !after.isFile() ||\n !sameIdentity(beforeIdentity, identity(after))\n ) {\n throw this.concurrentModification(item.artifact.path);\n }\n await this.assertParentChain(item, context);\n return { status: 'present', contents, identity: beforeIdentity, mode: fileMode(before) };\n }\n\n private async readOwnedFile(item: RuntimeArtifact, owned: OwnedFile): Promise<string> {\n await this.assertOwnedIdentity(item, owned);\n const expected = required(owned.identity);\n const handle = await this.operations.open(owned.path, 'r');\n const contents = await this.readThroughHandle(item, handle, async () => {\n const before = identity(await handle.stat());\n if (!sameIdentity(before, expected)) throw this.ownershipFailure(owned.publicPath);\n const read = await handle.readFile({ encoding: 'utf8' });\n const after = identity(await handle.stat());\n if (!sameIdentity(after, expected)) throw this.ownershipFailure(owned.publicPath);\n return read;\n });\n await this.assertOwnedIdentity(item, owned);\n return contents;\n }\n\n private async readThroughHandle<T>(\n item: RuntimeArtifact,\n handle: MigrationTransactionFileHandle,\n read: () => Promise<T>,\n ): Promise<T> {\n item.readHandles.add(handle);\n let value: T | undefined;\n let readFailure: unknown;\n let readFailed = false;\n try {\n value = await read();\n } catch (error: unknown) {\n readFailed = true;\n readFailure = error;\n }\n const closeFailures: unknown[] = [];\n for (let attempt = 0; attempt < 2 && item.readHandles.has(handle); attempt++) {\n try {\n await handle.close();\n item.readHandles.delete(handle);\n } catch (error: unknown) {\n closeFailures.push(error);\n }\n }\n if (readFailed) throw this.attachRecoveryFailures(item.artifact.path, readFailure, closeFailures);\n if (closeFailures.length > 0) {\n throw new MigrationApplicationError(\n 'transaction-io',\n `Could not close a migration read handle: ${item.artifact.path}`,\n [item.artifact.path],\n { cause: closeFailures[0], recoveryFailures: closeFailures.slice(1) },\n );\n }\n return value as T;\n }\n\n private attachRecoveryFailures(publicPath: string, error: unknown, recoveryFailures: readonly unknown[]): unknown {\n if (recoveryFailures.length === 0) return error;\n if (error instanceof MigrationApplicationError) {\n return new MigrationApplicationError(error.code, error.message, error.paths, {\n cause: error.cause ?? error,\n recoveryFailures: [...error.recoveryFailures, ...recoveryFailures],\n });\n }\n return new MigrationApplicationError(\n 'transaction-io',\n `Could not read migration state: ${publicPath}`,\n [publicPath],\n {\n cause: error,\n recoveryFailures,\n },\n );\n }\n\n private async assertOwnedIdentity(item: RuntimeArtifact, owned: OwnedFile): Promise<void> {\n await this.assertNamespace(item);\n if (!owned.identity) throw this.ownershipFailure(owned.publicPath);\n const ownedStat = await this.operations.lstat(owned.path);\n if (ownedStat.isSymbolicLink() || !ownedStat.isFile() || !sameIdentity(identity(ownedStat), owned.identity)) {\n throw this.ownershipFailure(owned.publicPath);\n }\n await this.assertNamespace(item);\n }\n\n private async assertNamespace(item: RuntimeArtifact): Promise<void> {\n const namespace = required(item.namespace);\n const expectedIdentity = required(namespace.identity);\n const namespaceStat = await this.operations.lstat(namespace.path);\n if (\n namespaceStat.isSymbolicLink() ||\n !namespaceStat.isDirectory() ||\n !sameIdentity(identity(namespaceStat), expectedIdentity)\n ) {\n throw this.ownershipFailure(namespace.publicPath);\n }\n }\n\n private async assertParentChain(item: RuntimeArtifact, context?: TransactionUnitContext): Promise<void> {\n for (const expectation of item.directories) await this.assertExpectedDirectory(expectation, item, context);\n }\n\n private async assertExpectedDirectory(\n expectation: DirectoryExpectation,\n item: RuntimeArtifact,\n context?: TransactionUnitContext,\n ): Promise<void> {\n const created = context?.createdDirectories.get(expectation.path);\n if (created?.exists) {\n await this.assertDirectoryIdentity(expectation.path, required(created.identity), item.artifact.path);\n return;\n }\n if (expectation.original === 'absent') {\n await this.assertExpectedAbsent(expectation.path, item.artifact.path);\n return;\n }\n await this.assertDirectoryExpectation(expectation.path, expectation.original, item.artifact.path);\n }\n\n private async assertDirectoryExpectation(\n path: string,\n expected: Exclude<DirectoryExpectation['original'], 'absent'>,\n publicPath: string,\n ): Promise<void> {\n let pathStat: MigrationTransactionStat;\n try {\n pathStat = await this.operations.lstat(path);\n } catch (error: unknown) {\n throw this.concurrentModification(publicPath, error);\n }\n const kind = pathStat.isSymbolicLink() ? 'symbolic-link' : pathStat.isDirectory() ? 'directory' : undefined;\n if (kind !== expected.kind || !sameIdentity(identity(pathStat), expected.identity)) {\n throw this.concurrentModification(publicPath);\n }\n if (expected.kind === 'symbolic-link') {\n let followed: MigrationTransactionStat;\n try {\n followed = await this.operations.stat(path);\n } catch (error: unknown) {\n throw this.concurrentModification(publicPath, error);\n }\n if (!followed.isDirectory() || !sameIdentity(identity(followed), expected.followedIdentity)) {\n throw this.concurrentModification(publicPath);\n }\n }\n }\n\n private async assertDirectoryIdentity(path: string, expected: FileIdentity, publicPath: string): Promise<void> {\n let pathStat: MigrationTransactionStat;\n try {\n pathStat = await this.operations.lstat(path);\n } catch (error: unknown) {\n throw this.concurrentModification(publicPath, error);\n }\n if (pathStat.isSymbolicLink() || !pathStat.isDirectory() || !sameIdentity(identity(pathStat), expected)) {\n throw this.concurrentModification(publicPath);\n }\n }\n\n private async assertExpectedAbsent(path: string, publicPath: string): Promise<void> {\n try {\n await this.operations.lstat(path);\n } catch (error: unknown) {\n if (isEnoent(error)) return;\n throw error;\n }\n throw this.concurrentModification(publicPath);\n }\n\n private async lstatOrAbsent(path: string): Promise<MigrationTransactionStat | 'absent'> {\n try {\n return await this.operations.lstat(path);\n } catch (error: unknown) {\n if (isEnoent(error)) return 'absent';\n throw error;\n }\n }\n\n private async closeReadHandles(item: RuntimeArtifact, failures: unknown[]): Promise<void> {\n for (const handle of item.readHandles) {\n try {\n await handle.close();\n item.readHandles.delete(handle);\n } catch (error: unknown) {\n failures.push(error);\n }\n }\n }\n\n private assertNotInterrupted(signal: AbortSignal): void {\n if (!signal.aborted) return;\n throw signal.reason instanceof Error ? signal.reason : new Error('Migration transaction interrupted.');\n }\n\n private concurrentModification(publicPath: string, cause?: unknown): MigrationApplicationError {\n return new MigrationApplicationError(\n 'concurrent-modification',\n `Migration destination changed after planning: ${publicPath}`,\n [publicPath],\n cause === undefined ? undefined : { cause },\n );\n }\n\n private ownershipFailure(publicPath: string): MigrationApplicationError {\n return new MigrationApplicationError(\n 'transaction-io',\n `Migration transaction ownership could not be confirmed: ${publicPath}`,\n [publicPath],\n );\n }\n}\n\nfunction directoryChain(path: string): readonly string[] {\n const result: string[] = [];\n let current = resolve(path);\n while (true) {\n result.unshift(current);\n const parent = dirname(current);\n if (parent === current) return result;\n current = parent;\n }\n}\n\nfunction frozenIdentity(value: FileIdentity | undefined): FileIdentity | undefined {\n return value === undefined ? undefined : Object.freeze({ ...value });\n}\n\nfunction ownedFileView(owned: OwnedFile): OwnedFileView {\n return Object.freeze({\n path: owned.path,\n publicPath: owned.publicPath,\n ...(owned.identity === undefined ? {} : { identity: frozenIdentity(owned.identity) }),\n exists: owned.exists,\n preserve: owned.preserve,\n });\n}\n\nfunction ownedNamespaceView(namespace: OwnedNamespace | undefined) {\n if (namespace === undefined) return undefined;\n return Object.freeze({\n path: namespace.path,\n publicPath: namespace.publicPath,\n ...(namespace.identity === undefined ? {} : { identity: frozenIdentity(namespace.identity) }),\n exists: namespace.exists,\n });\n}\n\nfunction directoryExpectationView(expectation: DirectoryExpectation): DirectoryExpectation {\n if (expectation.original === 'absent') return Object.freeze({ path: expectation.path, original: 'absent' });\n return Object.freeze({\n path: expectation.path,\n original: Object.freeze({\n ...expectation.original,\n identity: frozenIdentity(expectation.original.identity)!,\n ...(expectation.original.kind === 'symbolic-link'\n ? { followedIdentity: frozenIdentity(expectation.original.followedIdentity)! }\n : {}),\n }),\n });\n}\n\nfunction stagingArtifactView(item: RuntimeArtifact): StagingArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n directories: Object.freeze(item.directories.map(directoryExpectationView)),\n ...(item.originalMode === undefined ? {} : { originalMode: item.originalMode }),\n ...(item.stage === undefined ? {} : { stagingPath: item.stage.path }),\n });\n}\n\nfunction commitArtifactView(item: RuntimeArtifact): CommitArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n ...(item.originalIdentity === undefined ? {} : { originalIdentity: frozenIdentity(item.originalIdentity) }),\n ...(item.namespace === undefined ? {} : { namespace: ownedNamespaceView(item.namespace) }),\n ...(item.stage === undefined ? {} : { stage: ownedFileView(item.stage) }),\n ...(item.backup === undefined ? {} : { backup: ownedFileView(item.backup) }),\n quarantines: Object.freeze(item.quarantines.map(ownedFileView)),\n ...(item.installedIdentity === undefined ? {} : { installedIdentity: frozenIdentity(item.installedIdentity) }),\n });\n}\n\nfunction rollbackArtifactView(item: RuntimeArtifact): RollbackArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n ...(item.originalIdentity === undefined ? {} : { originalIdentity: frozenIdentity(item.originalIdentity) }),\n ...(item.namespace === undefined ? {} : { namespace: ownedNamespaceView(item.namespace) }),\n ...(item.stage === undefined ? {} : { stage: ownedFileView(item.stage) }),\n ...(item.backup === undefined ? {} : { backup: ownedFileView(item.backup) }),\n ...(item.installedIdentity === undefined ? {} : { installedIdentity: frozenIdentity(item.installedIdentity) }),\n ...(item.restoredIdentity === undefined ? {} : { restoredIdentity: frozenIdentity(item.restoredIdentity) }),\n });\n}\n\nfunction cleanupArtifactView(item: RuntimeArtifact): CleanupArtifactView {\n return Object.freeze({\n artifact: item.artifact,\n directories: Object.freeze(item.directories.map(directoryExpectationView)),\n ...(item.originalIdentity === undefined ? {} : { originalIdentity: frozenIdentity(item.originalIdentity) }),\n ...(item.namespace === undefined ? {} : { namespace: ownedNamespaceView(item.namespace) }),\n ownedFiles: Object.freeze(item.ownedFiles.map(ownedFileView)),\n ...(item.backup === undefined ? {} : { backupPath: item.backup.path }),\n ...(item.restoredIdentity === undefined ? {} : { restoredIdentity: frozenIdentity(item.restoredIdentity) }),\n });\n}\n\nfunction createdDirectoryView(directory: CreatedDirectory | undefined): CreatedDirectoryView | undefined {\n if (directory === undefined) return undefined;\n return Object.freeze({\n path: directory.path,\n ...(directory.identity === undefined ? {} : { identity: frozenIdentity(directory.identity) }),\n publicPaths: Object.freeze([...directory.publicPaths]),\n exists: directory.exists,\n });\n}\n","import { MigrationApplicationError, type MigrationApplicationErrorCode } from '../migrator/migration-application.error';\nimport type { MigrationPlan } from '../migrator/migration-plan';\nimport { AngularTemplateParser } from '../template/angular-template.parser';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport { FileSystemCleanupUnit } from './cleanup.unit';\nimport { CommitUnitError, FileSystemCommitUnit, type CommittedArtifact } from './commit.unit';\nimport { FileSystemRollbackUnit } from './rollback.unit';\nimport { FileSystemStagingUnit, StagingUnitError, type StagedArtifact } from './staging.unit';\nimport { TransactionSignalRegistrar, type TransactionSignalRegistrarLike } from './transaction-signal.registrar';\nimport {\n RecoveryUnitError,\n TransactionUnitSession,\n nodeTransactionOperations,\n type MigrationTransactionFileHandle,\n type MigrationTransactionOperations,\n type MigrationTransactionStat,\n type RecoveryOutcome,\n} from './transaction-unit.session';\n\nexport type { MigrationTransactionFileHandle, MigrationTransactionOperations, MigrationTransactionStat };\n\ninterface PreflightSeal {\n readonly plan: MigrationPlan;\n readonly contents: string;\n}\n\nclass TransactionInterruptedError extends Error {\n constructor(readonly signal: NodeJS.Signals) {\n super(`Migration transaction interrupted by ${signal}.`);\n this.name = 'TransactionInterruptedError';\n }\n}\n\nexport class MigrationTransaction {\n private interruptedBy: NodeJS.Signals | undefined;\n private unregisterSignals: (() => void) | undefined;\n private preflightSeal: PreflightSeal | undefined;\n private activePreflight: symbol | undefined;\n private applying = false;\n\n constructor(\n private readonly operations: MigrationTransactionOperations = nodeTransactionOperations,\n private readonly signalRegistrar: TransactionSignalRegistrarLike = new TransactionSignalRegistrar(),\n private readonly parser: AngularTemplateParser = new AngularTemplateParser(),\n ) {}\n\n public async preflight(plan: MigrationPlan): Promise<void> {\n if (this.applying) throw this.invalidTransition('preflight', plan);\n if (this.activePreflight !== undefined) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n 'Migration transaction cannot preflight while another preflight is active.',\n sortedUnique(plan.artifacts.map(artifact => artifact.path)),\n );\n }\n const owner = Symbol('preflight');\n this.activePreflight = owner;\n this.preflightSeal = undefined;\n try {\n this.rejectParseErrors(plan);\n const session = new TransactionUnitSession(this.operations, this.parser);\n await session.prepareForPreflight(plan.artifacts);\n if (this.activePreflight !== owner) throw this.invalidTransition('preflight', plan);\n this.preflightSeal = { plan, contents: planContents(plan) };\n } finally {\n if (this.activePreflight === owner) this.activePreflight = undefined;\n }\n }\n\n public async apply(plan: MigrationPlan): Promise<void> {\n this.assertPreflightSeal(plan);\n this.preflightSeal = undefined;\n if (plan.artifacts.length === 0) return;\n if (this.applying) throw this.invalidTransition('apply', plan);\n\n this.applying = true;\n this.interruptedBy = undefined;\n const controller = new AbortController();\n const session = new TransactionUnitSession(this.operations, this.parser, () => {\n this.syncSignalScope(session, controller);\n });\n const stagingUnit = new FileSystemStagingUnit(session.stagingPort());\n const commitUnit = new FileSystemCommitUnit(session.commitPort());\n const rollbackUnit = new FileSystemRollbackUnit(session.rollbackPort());\n\n let staged: readonly StagedArtifact[] = [];\n try {\n staged = await stagingUnit.stage(plan.artifacts, controller.signal);\n } catch (error: unknown) {\n const stagingError = error instanceof StagingUnitError ? error : undefined;\n staged = stagingError?.staged ?? staged;\n const recovery = await this.runCleanup(session, staged, 'recovery');\n this.finishApplication();\n throw this.decorateFailure(stagingError?.cause ?? error, recovery);\n }\n\n let committed: readonly CommittedArtifact[] = [];\n try {\n committed = await commitUnit.commit(staged, controller.signal);\n this.assertNotInterrupted(controller.signal);\n } catch (error: unknown) {\n const commitError = error instanceof CommitUnitError ? error : undefined;\n staged = commitError?.staged ?? staged;\n committed = commitError?.committed ?? committed;\n const rollback = await this.runRollback(rollbackUnit, [...committed].reverse());\n const cleanup = await this.runCleanup(session, staged, 'recovery');\n this.finishApplication();\n throw this.decorateFailure(commitError?.cause ?? error, mergeRecovery(rollback, cleanup));\n }\n\n const finalization = await this.runCleanup(session, staged, 'committed');\n this.finishApplication();\n if (finalization.paths.length > 0 || finalization.failures.length > 0) {\n const cause = finalization.failures[0] ?? new Error('Transaction cleanup could not be confirmed.');\n throw new MigrationApplicationError(\n this.interruptedBy ? 'transaction-interrupted' : 'transaction-io',\n this.interruptedBy\n ? 'Migration transaction was interrupted during cleanup.'\n : 'Migration committed, but cleanup was incomplete.',\n finalization.paths,\n { cause, recoveryFailures: finalization.failures.slice(1) },\n );\n }\n if (this.interruptedBy) {\n throw new MigrationApplicationError('transaction-interrupted', 'Migration transaction was interrupted.', [], {\n cause: new TransactionInterruptedError(this.interruptedBy),\n });\n }\n }\n\n private rejectParseErrors(plan: MigrationPlan): void {\n const paths = plan.files\n .flatMap(file => file.results.filter(result => result.status === 'parse-error').map(result => result.fileName))\n .filter((path, index, all) => all.indexOf(path) === index)\n .sort(compareCodeUnits);\n if (paths.length === 0) return;\n throw new MigrationApplicationError(\n 'internal-invariant',\n 'A migration plan with template parse errors cannot be applied.',\n paths,\n );\n }\n\n private assertPreflightSeal(plan: MigrationPlan): void {\n const seal = this.preflightSeal;\n if (seal?.plan === plan && seal.contents === planContents(plan)) return;\n throw this.invalidTransition('apply', plan);\n }\n\n private invalidTransition(action: 'preflight' | 'apply', plan: MigrationPlan): MigrationApplicationError {\n return new MigrationApplicationError(\n 'internal-invariant',\n action === 'apply'\n ? 'Migration transaction apply requires the exact plan that passed preflight.'\n : 'Migration transaction cannot preflight while application is active.',\n sortedUnique(plan.artifacts.map(artifact => artifact.path)),\n );\n }\n\n private async runRollback(\n rollbackUnit: FileSystemRollbackUnit,\n committed: readonly CommittedArtifact[],\n ): Promise<RecoveryOutcome> {\n try {\n return { paths: await rollbackUnit.rollback(committed), failures: [] };\n } catch (error: unknown) {\n if (error instanceof RecoveryUnitError) return { paths: error.paths, failures: error.failures };\n return { paths: [], failures: [error] };\n }\n }\n\n private async runCleanup(\n session: TransactionUnitSession,\n staged: readonly StagedArtifact[],\n kind: 'committed' | 'recovery',\n ): Promise<RecoveryOutcome> {\n try {\n return { paths: await new FileSystemCleanupUnit(session.cleanupPort(), kind).cleanup(staged), failures: [] };\n } catch (error: unknown) {\n if (error instanceof RecoveryUnitError) return { paths: error.paths, failures: error.failures };\n return { paths: [], failures: [error] };\n }\n }\n\n private decorateFailure(error: unknown, recovery: RecoveryOutcome): MigrationApplicationError {\n const interrupted = this.interruptedBy !== undefined || error instanceof TransactionInterruptedError;\n const applicationError = error instanceof MigrationApplicationError ? error : undefined;\n const code: MigrationApplicationErrorCode = interrupted\n ? 'transaction-interrupted'\n : (applicationError?.code ?? 'transaction-io');\n const validationPaths =\n applicationError && applicationError.code !== 'transaction-io' ? applicationError.paths : [];\n const paths = sortedUnique([...validationPaths, ...recovery.paths]);\n const cause = applicationError?.cause ?? error;\n const recoveryFailures = [...(applicationError?.recoveryFailures ?? []), ...recovery.failures];\n return new MigrationApplicationError(\n code,\n interrupted\n ? 'Migration transaction was interrupted.'\n : (applicationError?.message ?? 'Migration transaction failed.'),\n paths,\n { cause, recoveryFailures },\n );\n }\n\n private syncSignalScope(session: TransactionUnitSession, controller: AbortController): void {\n const hasOwnedArtifacts = session.hasOwnedArtifacts();\n if (hasOwnedArtifacts && !this.unregisterSignals) {\n this.unregisterSignals = this.signalRegistrar.register(signal => {\n this.interruptedBy ??= signal;\n if (!controller.signal.aborted) controller.abort(new TransactionInterruptedError(signal));\n });\n } else if (!hasOwnedArtifacts) {\n this.unregisterSignalHandlers();\n }\n }\n\n private finishApplication(): void {\n this.unregisterSignalHandlers();\n this.applying = false;\n }\n\n private unregisterSignalHandlers(): void {\n this.unregisterSignals?.();\n this.unregisterSignals = undefined;\n }\n\n private assertNotInterrupted(signal: AbortSignal): void {\n if (!signal.aborted) return;\n throw signal.reason instanceof Error ? signal.reason : new Error('Migration transaction interrupted.');\n }\n}\n\nfunction planContents(plan: MigrationPlan): string {\n return JSON.stringify(plan);\n}\n\nfunction mergeRecovery(...outcomes: readonly RecoveryOutcome[]): RecoveryOutcome {\n return {\n paths: sortedUnique(outcomes.flatMap(outcome => outcome.paths)),\n failures: Object.freeze(outcomes.flatMap(outcome => outcome.failures)),\n };\n}\n\nfunction sortedUnique(paths: Iterable<string>): readonly string[] {\n return [...new Set(paths)].sort(compareCodeUnits);\n}\n","import type { MigrationApplication } from '../report/migration-report';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { ValidatedProjectPlan } from './validated-project-plan';\n\nexport interface AppliedProject {\n readonly validated: ValidatedProjectPlan;\n readonly application: MigrationApplication;\n}\n\nexport function appliedProject(project: AppliedProject): AppliedProject {\n const mode = project.validated.rendered.analyzed.manifest.invocation.options.mode;\n const coherent =\n mode === 'plan'\n ? project.application.status === 'skipped' && project.application.reason === 'plan-only'\n : !(project.application.status === 'skipped' && project.application.reason === 'plan-only');\n if (!coherent) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Application result is incompatible with validated manifest mode \"${mode}\".`,\n );\n }\n return Object.freeze({\n validated: project.validated,\n application: Object.freeze({ ...project.application }),\n });\n}\n","import { assertConfigurationUnchanged } from '../../config/migration-config';\nimport { pathsOverlapOnFileSystem } from '../../migrator/migration-path.validator';\nimport type { MigrationMode } from '../../migrator/migration-mode';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport { MigrationTransaction } from '../../transaction/migration-transaction';\nimport { appliedProject, type AppliedProject } from '../applied-project';\nimport type { ApplyStage } from '../migration-pipeline';\nimport type { ValidatedProjectPlan } from '../validated-project-plan';\n\nexport type MigrationTransactionPort = Pick<MigrationTransaction, 'preflight' | 'apply'>;\n\nexport class ApplyProjectStage implements ApplyStage {\n constructor(\n private readonly mode: MigrationMode,\n private readonly transaction: MigrationTransactionPort = new MigrationTransaction(),\n ) {}\n\n public async run(validated: ValidatedProjectPlan): Promise<AppliedProject> {\n const manifestMode = validated.rendered.analyzed.manifest.invocation.options.mode;\n if (this.mode !== manifestMode) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n `Apply stage mode \"${this.mode}\" differs from validated manifest mode \"${manifestMode}\".`,\n );\n }\n const plan = validated.plan;\n const snapshots = validated.rendered.analyzed.manifest.invocation.options.configurationSnapshots ?? [];\n await assertConfigurationUnchanged(snapshots);\n for (const artifact of plan.artifacts)\n for (const snapshot of snapshots) {\n if (await pathsOverlapOnFileSystem(artifact.path, snapshot.path))\n throw new Error(`Migration output collides with target configuration: ${artifact.path}`);\n }\n const hasParseError = plan.files.some(file => file.results.some(result => result.status === 'parse-error'));\n if (this.mode === 'plan') {\n if (!hasParseError) await this.transaction.preflight(plan);\n return appliedProject({ validated, application: { status: 'skipped', reason: 'plan-only' } });\n }\n if (hasParseError) {\n return appliedProject({ validated, application: { status: 'skipped', reason: 'parse-errors' } });\n }\n\n await this.transaction.preflight(plan);\n await assertConfigurationUnchanged(snapshots);\n if (plan.artifacts.length > 0) await this.transaction.apply(plan);\n return appliedProject({ validated, application: { status: 'applied' } });\n }\n}\n","import { readdir, stat } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport { createGitIgnoreMatcher } from '../../lib/gitignore.helper';\nimport { logger } from '../../logger';\nimport { compareCodeUnits } from '../../util/compare-code-units';\nimport type { DiscoverStage } from '../migration-pipeline';\nimport {\n projectManifest,\n type ManifestTemplate,\n type MigrationInvocation,\n type ProjectManifest,\n} from '../project-manifest';\nimport type { DiscoveryEntry, DiscoveryFileSystem } from './discovery-file-system.port';\nimport type { IgnoreMatcher, IgnoreMatcherFactory } from './ignore-matcher.port';\n\nconst nodeFileSystem: DiscoveryFileSystem = Object.freeze({\n async kind(candidate: string) {\n const candidateStat = await stat(candidate);\n if (candidateStat.isFile()) return 'file';\n if (candidateStat.isDirectory()) return 'directory';\n return 'other';\n },\n async entries(directory: string) {\n const entries = await readdir(directory, { withFileTypes: true });\n return entries.map((entry): DiscoveryEntry => ({\n name: entry.name,\n kind: entry.isFile() ? 'file' : entry.isDirectory() ? 'directory' : 'other',\n }));\n },\n});\n\nconst gitIgnoreMatcherFactory: IgnoreMatcherFactory = Object.freeze({\n load: createGitIgnoreMatcher,\n});\n\nexport class DiscoverProjectStage implements DiscoverStage {\n constructor(\n private readonly fileSystem: DiscoveryFileSystem = nodeFileSystem,\n private readonly ignoreMatchers: IgnoreMatcherFactory = gitIgnoreMatcherFactory,\n ) {}\n\n public async run(invocation: MigrationInvocation): Promise<ProjectManifest> {\n const inputProbePath = preserveTrailingSeparator(invocation.canonicalInputPath, invocation.inputPath);\n const inputKind = await this.fileSystem.kind(inputProbePath);\n let templates: readonly ManifestTemplate[];\n\n if (inputKind === 'file') {\n templates = this.singleFile(invocation);\n } else if (inputKind === 'directory') {\n templates = await this.folderTemplates(invocation);\n } else {\n throw new Error(`Unsupported input type: ${invocation.inputPath}`);\n }\n\n return projectManifest({ invocation, templates });\n }\n\n private singleFile(invocation: MigrationInvocation): readonly ManifestTemplate[] {\n if (path.extname(invocation.canonicalInputPath).toLowerCase() !== '.html') {\n throw new Error(`Unsupported file type: ${invocation.inputPath}`);\n }\n if (path.extname(invocation.canonicalOutputPath).toLowerCase() !== '.html') {\n throw new Error('Single-file output path must have a .html extension.');\n }\n return [{ inputPath: invocation.canonicalInputPath, outputPath: invocation.canonicalOutputPath }];\n }\n\n private async folderTemplates(invocation: MigrationInvocation): Promise<readonly ManifestTemplate[]> {\n const root = invocation.canonicalInputPath;\n const matcher = await this.ignoreMatchers.load(root, invocation.inputPath);\n const exclusions = this.excludedPaths(invocation);\n const inputs = await this.collectInputs(root, invocation.inputPath, matcher, exclusions);\n inputs.sort(compareCodeUnits);\n return inputs.map(inputPath => ({\n inputPath,\n outputPath: path.join(invocation.canonicalOutputPath, path.relative(root, inputPath)),\n }));\n }\n\n private async collectInputs(\n directory: string,\n displayDirectory: string,\n matcher: IgnoreMatcher,\n exclusions: ReadonlySet<string>,\n ): Promise<string[]> {\n const entries = [...(await this.fileSystem.entries(directory))].sort((left, right) =>\n compareCodeUnits(left.name, right.name),\n );\n const inputs: string[] = [];\n\n for (const entry of entries) {\n const candidate = path.join(directory, entry.name);\n const displayCandidate = path.join(displayDirectory, entry.name);\n logger.debug(`Processing ${displayCandidate}`);\n const ignored = entry.kind === 'directory' ? matcher.ignoresDirectory(candidate) : matcher.ignores(candidate);\n if (ignored || exclusions.has(path.normalize(candidate))) continue;\n const kind = entry.kind === 'other' ? await this.fileSystem.kind(candidate) : entry.kind;\n if (entry.kind === 'other' && kind === 'directory' && matcher.ignoresDirectory(candidate)) continue;\n\n if (kind === 'directory') {\n inputs.push(...(await this.collectInputs(candidate, displayCandidate, matcher, exclusions)));\n } else if (kind === 'file' && path.extname(entry.name).toLowerCase() === '.html') {\n inputs.push(path.normalize(path.resolve(candidate)));\n }\n }\n\n return inputs;\n }\n\n private excludedPaths(invocation: MigrationInvocation): ReadonlySet<string> {\n const candidates = [invocation.options.stylesheetPath, invocation.options.reportPath]\n .filter((candidate): candidate is string => candidate !== undefined)\n .map(candidate => path.normalize(path.resolve(candidate)));\n const outputRoot = invocation.canonicalOutputPath;\n if (path.relative(invocation.canonicalInputPath, outputRoot) !== '') candidates.push(outputRoot);\n return new Set(candidates);\n }\n}\n\nfunction preserveTrailingSeparator(canonicalPath: string, rawPath: string): string {\n return /[\\\\/]$/u.test(rawPath) && !/[\\\\/]$/u.test(canonicalPath) ? `${canonicalPath}${path.sep}` : canonicalPath;\n}\n","import fs from 'fs-extra';\nimport ignore from 'ignore';\nimport path from 'path';\nimport { logger } from '../logger';\nimport type { IgnoreMatcher } from '../pipeline/discover/ignore-matcher.port';\n\nexport async function createGitIgnoreMatcher(root: string, displayRoot: string = root): Promise<IgnoreMatcher> {\n const matcher = ignore();\n const gitignorePath = path.join(root, '.gitignore');\n if (await fs.pathExists(gitignorePath)) {\n matcher.add(await fs.readFile(gitignorePath, 'utf8'));\n logger.debug(`Loaded .gitignore file from ${path.join(displayRoot, '.gitignore')}`);\n }\n const relativeIgnorePath = (candidate: string): string => path.relative(root, candidate).split(path.sep).join('/');\n return Object.freeze({\n ignores: (candidate: string) => matcher.ignores(relativeIgnorePath(candidate)),\n ignoresDirectory: (candidate: string) => matcher.ignores(`${relativeIgnorePath(candidate)}/`),\n });\n}\n","import type { PipelineStageName } from './migration-pipeline';\n\nexport type { PipelineStageName } from './migration-pipeline';\n\nexport class PipelineStageError extends Error {\n constructor(\n readonly stage: PipelineStageName,\n override readonly cause: unknown,\n ) {\n super(`Migration pipeline ${stage} stage failed.`, { cause });\n this.name = 'PipelineStageError';\n }\n}\n","import type { AppliedProject } from './applied-project';\nimport type { AnalyzedProject } from './analyzed-project';\nimport { PipelineStageError } from './pipeline-stage.error';\nimport type { MigrationInvocation, ProjectManifest } from './project-manifest';\nimport type { RenderedProject } from './rendered-project';\nimport type { ValidatedProjectPlan } from './validated-project-plan';\n\nexport type PipelineStageName = 'discover' | 'analyze' | 'render' | 'validate' | 'apply';\n\nexport interface DiscoverStage {\n run(invocation: MigrationInvocation): Promise<ProjectManifest>;\n}\n\nexport interface AnalyzeStage {\n run(manifest: ProjectManifest): Promise<AnalyzedProject>;\n}\n\nexport interface RenderStage {\n run(analyzed: AnalyzedProject): Promise<RenderedProject>;\n}\n\nexport interface ValidateStage {\n prevalidate(invocation: MigrationInvocation): Promise<void>;\n run(rendered: RenderedProject): Promise<ValidatedProjectPlan>;\n}\n\nexport interface ApplyStage {\n run(plan: ValidatedProjectPlan): Promise<AppliedProject>;\n}\n\nexport type MigrationPipelineResult = AppliedProject;\n\nexport class MigrationPipeline {\n constructor(\n private readonly discover: DiscoverStage,\n private readonly analyze: AnalyzeStage,\n private readonly render: RenderStage,\n private readonly validate: ValidateStage,\n private readonly apply: ApplyStage,\n ) {}\n\n public async run(invocation: MigrationInvocation): Promise<MigrationPipelineResult> {\n await this.validate.prevalidate(invocation);\n const manifest = await runStage('discover', () => this.discover.run(invocation));\n const analyzed = await runStage('analyze', () => this.analyze.run(manifest));\n const rendered = await runStage('render', () => this.render.run(analyzed));\n const validated = await runStage('validate', () => this.validate.run(rendered));\n const applied = await runStage('apply', () => this.apply.run(validated));\n\n return applied;\n }\n}\n\nasync function runStage<T>(stage: PipelineStageName, action: () => Promise<T>): Promise<T> {\n try {\n return await action();\n } catch (error: unknown) {\n if (error instanceof PipelineStageError) throw error;\n throw new PipelineStageError(stage, error);\n }\n}\n","import type { MigrationOptions } from '../pipeline/project-manifest';\nimport path from 'node:path';\nimport type { ConversionResult } from '../analyzer/conversion-result';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { FileMigrationResult } from '../migrator/file-migration-result';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport type {\n FileReport,\n MigrationApplication,\n MigrationMode,\n MigrationReport,\n MigrationSummary,\n ReportResult,\n StylesheetReport,\n} from './migration-report';\n\ntype PathApi = typeof path.posix;\n\nexport interface StylesheetMigrationResult {\n readonly path: string;\n readonly change: StylesheetReport['change'];\n}\n\nexport class MigrationReportBuilder {\n public build(\n inputRoot: string,\n outputRoot: string,\n target: 'css' | 'tailwind',\n mode: MigrationMode,\n application: MigrationApplication,\n durationMs: number,\n files: readonly FileMigrationResult[],\n stylesheet?: StylesheetMigrationResult,\n ): MigrationReport {\n const pathApi = this.pathApi(\n inputRoot,\n outputRoot,\n stylesheet?.path ?? '',\n ...files.flatMap(file => [file.inputPath, file.outputPath]),\n );\n const singleFile = files.length === 1 && this.samePath(pathApi, inputRoot, files[0]?.inputPath ?? '');\n const fileReports = files\n .map(file => this.fileReport(pathApi, inputRoot, singleFile, file))\n .sort((left, right) => compareCodeUnits(left.path, right.path));\n const reportPaths = this.reportPaths(pathApi, inputRoot, outputRoot, singleFile);\n const summary = this.summary(fileReports);\n\n return {\n schemaVersion: 2,\n mode,\n target,\n application,\n input: reportPaths.input,\n output: reportPaths.output,\n durationMs: Math.trunc(durationMs),\n summary,\n files: fileReports,\n ...(target === 'css' && stylesheet\n ? { stylesheet: this.stylesheetReport(pathApi, inputRoot, singleFile, stylesheet) }\n : {}),\n };\n }\n\n private stylesheetReport(\n pathApi: PathApi,\n inputRoot: string,\n singleFile: boolean,\n stylesheet: StylesheetMigrationResult,\n ): StylesheetReport {\n const inputIdentity = this.absolutePath(pathApi, inputRoot);\n const base = singleFile ? pathApi.dirname(inputIdentity) : inputIdentity;\n const relativePath = pathApi.relative(base, this.absolutePath(pathApi, stylesheet.path));\n const displayPath = pathApi.isAbsolute(relativePath) ? pathApi.basename(stylesheet.path) : relativePath;\n\n return { path: this.forwardSlashes(pathApi, displayPath), change: stylesheet.change };\n }\n\n private pathApi(...values: readonly string[]): PathApi {\n if (values.some(value => /^[A-Za-z]:[\\\\/]/.test(value) || value.includes('\\\\'))) return path.win32;\n if (values.some(value => value.includes('/'))) return path.posix;\n return path;\n }\n\n private samePath(pathApi: PathApi, left: string, right: string): boolean {\n return this.absolutePath(pathApi, left) === this.absolutePath(pathApi, right);\n }\n\n private fileReport(pathApi: PathApi, inputRoot: string, singleFile: boolean, file: FileMigrationResult): FileReport {\n const relativePath = singleFile\n ? pathApi.basename(inputRoot)\n : pathApi.relative(this.absolutePath(pathApi, inputRoot), this.absolutePath(pathApi, file.inputPath));\n return {\n path: this.forwardSlashes(pathApi, relativePath),\n changed: file.changed,\n results: file.results.map(result => this.result(result)),\n };\n }\n\n private result(result: ConversionResult): ReportResult {\n if (result.status === 'parse-error') {\n return {\n status: result.status,\n offset: result.source.start,\n code: result.code,\n reason: result.reason,\n };\n }\n\n const input = result.input as LocatedFlexLayoutInput;\n if (result.status === 'converted') {\n return {\n status: result.status,\n directive: input.directive,\n sourceName: input.sourceName,\n offset: input.source.start,\n };\n }\n\n return {\n status: result.status,\n directive: input.directive,\n sourceName: input.sourceName,\n offset: input.source.start,\n code: result.code,\n reason: result.reason,\n suggestion: result.suggestion,\n };\n }\n\n private reportPaths(\n pathApi: PathApi,\n inputRoot: string,\n outputRoot: string,\n singleFile: boolean,\n ): { readonly input: string; readonly output: string } {\n const inputIdentity = this.absolutePath(pathApi, inputRoot);\n const base = singleFile ? pathApi.dirname(inputIdentity) : inputIdentity;\n const input = singleFile ? pathApi.basename(inputRoot) : '.';\n const relativeOutput = pathApi.relative(base, this.absolutePath(pathApi, outputRoot));\n const output = pathApi.isAbsolute(relativeOutput) ? pathApi.basename(outputRoot) : relativeOutput || '.';\n\n return {\n input: this.forwardSlashes(pathApi, input),\n output: this.forwardSlashes(pathApi, output),\n };\n }\n\n private forwardSlashes(pathApi: PathApi, value: string): string {\n return value.split(pathApi.sep).join('/');\n }\n\n private absolutePath(pathApi: PathApi, value: string): string {\n return pathApi.normalize(pathApi.resolve(value));\n }\n\n private summary(files: readonly FileReport[]): MigrationSummary {\n const resultCounts = {\n converted: 0,\n review: 0,\n unsupported: 0,\n invalid: 0,\n parseErrors: 0,\n };\n\n for (const result of files.flatMap(file => file.results)) {\n if (result.status === 'parse-error') resultCounts.parseErrors += 1;\n else resultCounts[result.status] += 1;\n }\n\n return {\n filesScanned: files.length,\n filesChanged: files.filter(file => file.changed).length,\n ...resultCounts,\n };\n }\n}\n\n/** Additive schema-2 environment metadata, separate from template result normalization. */\nexport function withReportEnvironment(report: MigrationReport, options: MigrationOptions): MigrationReport {\n return {\n ...report,\n ...(options.targetProfile ? { targetProfile: options.targetProfile } : {}),\n ...(options.sourceBreakpoints ? { sourceBreakpoints: options.sourceBreakpoints } : {}),\n };\n}\n","import * as path from 'node:path';\nimport type { MigrationInvocation } from './project-manifest';\n\ninterface InvocationPathRoot {\n readonly canonical: string;\n readonly raw: string;\n}\n\ntype PathBearingError = Error & {\n path?: unknown;\n dest?: unknown;\n};\n\nexport function remapInvocationErrorPaths(error: unknown, invocation: MigrationInvocation): unknown {\n if (!(error instanceof Error)) return error;\n\n const roots = invocationRoots(invocation);\n const pathBearingError = error as PathBearingError;\n remapErrorPath(pathBearingError, 'path', roots);\n remapErrorPath(pathBearingError, 'dest', roots);\n return error;\n}\n\nfunction invocationRoots(invocation: MigrationInvocation): readonly InvocationPathRoot[] {\n return [\n { canonical: invocation.canonicalInputPath, raw: invocation.inputPath },\n { canonical: invocation.canonicalOutputPath, raw: invocation.outputPath },\n ].sort((left, right) => right.canonical.length - left.canonical.length);\n}\n\nfunction remapErrorPath(error: PathBearingError, field: 'path' | 'dest', roots: readonly InvocationPathRoot[]): void {\n const original = error[field];\n if (typeof original !== 'string') return;\n\n const mapped = mappedInvocationPath(original, roots);\n if (mapped === original) return;\n\n error.message = error.message.replaceAll(original, () => mapped);\n error[field] = mapped;\n}\n\nfunction mappedInvocationPath(candidate: string, roots: readonly InvocationPathRoot[]): string {\n if (!path.isAbsolute(candidate)) return candidate;\n\n for (const root of roots) {\n const relativePath = path.relative(root.canonical, candidate);\n if (relativePath === '') return root.raw;\n if (relativePath === '..' || relativePath.startsWith(`..${path.sep}`) || path.isAbsolute(relativePath)) continue;\n return path.join(root.raw, relativePath);\n }\n\n return candidate;\n}\n","import type { MigrationReport } from '../report/migration-report';\nimport { MigrationReportBuilder, withReportEnvironment } from '../report/migration-report.builder';\nimport type { AppliedProject } from './applied-project';\nimport { remapInvocationErrorPaths } from './invocation-error-path.mapper';\nimport type { MigrationPipeline } from './migration-pipeline';\nimport { PipelineStageError } from './pipeline-stage.error';\nimport type { MigrationInvocation } from './project-manifest';\n\nexport type MigrationExecutionPipeline = Pick<MigrationPipeline, 'run'>;\n\ntype ReportBuilder = Pick<MigrationReportBuilder, 'build'>;\n\nexport class MigrationRunner {\n constructor(\n private readonly pipeline: MigrationExecutionPipeline,\n private readonly reports: ReportBuilder = new MigrationReportBuilder(),\n private readonly now: () => number = Date.now,\n ) {}\n\n public async run(invocation: MigrationInvocation): Promise<MigrationReport> {\n const startedAt = this.now();\n const applied = await this.execute(invocation);\n const durationMs = this.now() - startedAt;\n const { validated, application } = applied;\n const { plan, rendered, stylesheet } = validated;\n\n const report = this.reports.build(\n rendered.analyzed.manifest.invocation.inputPath,\n rendered.analyzed.manifest.invocation.outputPath,\n plan.target,\n rendered.analyzed.manifest.invocation.options.mode,\n application,\n durationMs,\n plan.files,\n stylesheet,\n );\n return withReportEnvironment(report, invocation.options);\n }\n\n private async execute(invocation: MigrationInvocation): Promise<AppliedProject> {\n try {\n return await this.pipeline.run(invocation);\n } catch (error: unknown) {\n if (!(error instanceof PipelineStageError)) throw error;\n if (error.stage === 'apply') throw error.cause;\n throw remapInvocationErrorPaths(error.cause, invocation);\n }\n }\n}\n","import type { TemplateAttribute } from './template.model';\n\nexport function templateAttributeKeys(attribute: TemplateAttribute): ReadonlySet<string> {\n const semanticKey = attribute.name.toLowerCase();\n const rawName = attribute.rawName.toLowerCase();\n const rawKey =\n attribute.binding !== 'property'\n ? rawName\n : rawName.startsWith('[') && rawName.endsWith(']')\n ? rawName.slice(1, -1)\n : rawName.startsWith('bind-')\n ? rawName.slice('bind-'.length)\n : rawName;\n return new Set([rawKey, semanticKey]);\n}\n","export type SrcsetValueValidation =\n { readonly status: 'valid'; readonly value: string } | { readonly status: 'invalid'; readonly reason: string };\n\nexport function validateSingleSrcsetUrl(value: string): SrcsetValueValidation {\n if (value.length === 0) {\n return { status: 'invalid', reason: 'A responsive image source cannot be empty.' };\n }\n if (value.includes('{{') || value.includes('}}')) {\n return { status: 'invalid', reason: 'Interpolation is not a literal responsive image URL.' };\n }\n if ([...value].some(character => character === ',' || character.charCodeAt(0) <= 32 || character === '\\u007f')) {\n return {\n status: 'invalid',\n reason: 'The value is not one descriptor-free srcset URL.',\n };\n }\n return { status: 'valid', value };\n}\n","import type { PlannedConversion } from '../render/conversion-renderer';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { DiagnosticCode } from '../analyzer/conversion-result';\nimport { ORIENTATION_BREAKPOINTS } from '../analyzer/flex-layout.catalog';\nimport { BreakpointCatalog, type BreakpointDefinition } from '../breakpoint/breakpoint-catalog';\nimport { compareCodeUnits } from '../util/compare-code-units';\nimport type {\n ResponsiveImageContext,\n ResponsiveImagePlanningResult,\n ResponsiveImageSource,\n} from './responsive-image.model';\nimport { validateSingleSrcsetUrl } from './srcset-value';\n\ninterface Failure {\n readonly status: 'review' | 'unsupported' | 'invalid';\n readonly code: DiagnosticCode;\n readonly reason: string;\n readonly suggestion: string;\n}\n\nconst standardAliases = new Set([\n 'xs',\n 'sm',\n 'md',\n 'lg',\n 'xl',\n 'lt-sm',\n 'lt-md',\n 'lt-lg',\n 'lt-xl',\n 'gt-xs',\n 'gt-sm',\n 'gt-md',\n 'gt-lg',\n]);\nconst optionalAliases = new Set<string>(ORIENTATION_BREAKPOINTS);\n\nfunction unresolved(inputs: readonly LocatedFlexLayoutInput[], failure: Failure): ResponsiveImagePlanningResult {\n return {\n status: 'unresolved',\n plans: inputs.map(\n input =>\n ({\n ...failure,\n input,\n }) satisfies PlannedConversion,\n ),\n };\n}\n\nfunction breakpointFailure(alias: string): Failure {\n if (alias.length === 0 || (!optionalAliases.has(alias) && alias !== 'print')) {\n return {\n status: 'unsupported',\n code: 'custom-breakpoint',\n reason: `Responsive image breakpoint \"${alias}\" is not a standard viewport alias.`,\n suggestion: 'Migrate the responsive image source manually.',\n };\n }\n return {\n status: 'unsupported',\n code: 'breakpoint-unverified',\n reason: `Responsive image breakpoint \"${alias}\" is not supported by native image migration.`,\n suggestion: 'Keep this responsive image family unchanged.',\n };\n}\n\nexport class ResponsiveImagePlanner {\n private readonly catalog = new BreakpointCatalog();\n\n plan(\n inputs: readonly LocatedFlexLayoutInput[],\n context: ResponsiveImageContext,\n enabled: boolean,\n ): ResponsiveImagePlanningResult {\n if (!enabled) {\n return unresolved(inputs, {\n status: 'unsupported',\n code: 'target-unsupported',\n reason: 'Responsive image migration is not enabled.',\n suggestion: 'Rerun with --responsive-images after reviewing picture-wrapper selector risk.',\n });\n }\n\n if (context.element.name.toLowerCase() !== 'img') {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'Responsive image inputs are only safe to migrate on an img element.',\n suggestion: 'Remove or migrate the input manually.',\n });\n }\n if (context.element.structural || context.ancestors.some(ancestor => ancestor.name.toLowerCase() === 'picture')) {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'The image has structural syntax or is already inside a picture element.',\n suggestion: 'Keep this responsive image family unchanged.',\n });\n }\n if (\n context.element.source.start !== context.element.startTag.start ||\n context.element.source.end < context.element.startTag.end\n ) {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'The image does not have one unambiguous replacement range.',\n suggestion: 'Keep this responsive image family unchanged.',\n });\n }\n if (inputs.some(input => input.binding !== 'literal')) {\n return unresolved(inputs, {\n status: 'review',\n code: 'dynamic-binding',\n reason: 'Dynamic responsive image sources cannot become literal source elements.',\n suggestion: 'Keep the binding or replace it with a literal URL before migrating.',\n });\n }\n\n const aliases = inputs.map(input => input.breakpoint ?? '');\n const unsupportedAlias = aliases.find(alias => !standardAliases.has(alias));\n if (unsupportedAlias !== undefined) return unresolved(inputs, breakpointFailure(unsupportedAlias));\n if (new Set(aliases).size !== aliases.length) {\n return unresolved(inputs, {\n status: 'review',\n code: 'responsive-precedence-unverified',\n reason: 'More than one responsive image input owns the same breakpoint.',\n suggestion: 'Remove duplicate responsive image inputs before migrating.',\n });\n }\n\n const sources: ResponsiveImageSource[] = [];\n for (const input of inputs) {\n const validation = validateSingleSrcsetUrl(input.value);\n if (validation.status === 'invalid') {\n return unresolved(inputs, {\n status: 'invalid',\n code: 'invalid-value',\n reason: validation.reason,\n suggestion: 'Use one literal, descriptor-free URL or migrate this image manually.',\n });\n }\n const classification = this.catalog.classify(input.breakpoint ?? '');\n if (classification.kind !== 'verified') {\n return unresolved(inputs, breakpointFailure(input.breakpoint ?? ''));\n }\n sources.push({ input, definition: classification.definition as BreakpointDefinition, url: validation.value });\n }\n\n const fallbackAttributes = context.element.attributes.filter(attribute => attribute.name === 'src');\n const literalFallback = fallbackAttributes.filter(\n attribute => attribute.binding === 'literal' && attribute.rawName.toLowerCase() === 'src',\n );\n const boundFallback = fallbackAttributes.filter(\n attribute =>\n attribute.binding === 'property' &&\n attribute.bindingTarget === 'property' &&\n attribute.rawName.toLowerCase() === '[src]',\n );\n if (fallbackAttributes.length !== literalFallback.length + boundFallback.length || fallbackAttributes.length > 1) {\n return unresolved(inputs, {\n status: 'review',\n code: 'context-unverified',\n reason: 'The fallback image source has conflicting or unsupported ownership.',\n suggestion: 'Keep one literal src or property [src] fallback before migrating.',\n });\n }\n\n sources.sort(\n (left, right) =>\n right.definition.priority - left.definition.priority ||\n compareCodeUnits(left.definition.alias, right.definition.alias),\n );\n return {\n status: 'converted',\n plan: {\n element: context.element,\n sources,\n fallback: literalFallback.length ? 'literal' : boundFallback.length ? 'bound' : 'absent',\n },\n };\n }\n}\n","import type { EditDiagnostic, EditResult, SourceEdit } from './source-edit';\nimport { compareCodeUnits } from '../util/compare-code-units';\n\nexport class SourceEditor {\n apply(source: string, edits: readonly SourceEdit[]): EditResult {\n const diagnostics = this.validate(source, edits);\n if (diagnostics.length) return { status: 'invalid', diagnostics };\n\n const orderedEdits = [...edits].sort(\n (left, right) => right.range.start - left.range.start || compareCodeUnits(right.inputId, left.inputId),\n );\n\n let output = source;\n for (const edit of orderedEdits) {\n output = output.slice(0, edit.range.start) + edit.text + output.slice(edit.range.end);\n }\n\n return { status: 'applied', output };\n }\n\n private validate(source: string, edits: readonly SourceEdit[]): EditDiagnostic[] {\n const invalidRanges = edits\n .filter(\n edit =>\n !Number.isInteger(edit.range.start) ||\n !Number.isInteger(edit.range.end) ||\n edit.range.start < 0 ||\n edit.range.end < edit.range.start ||\n edit.range.end > source.length,\n )\n .map(edit => ({\n code: 'invalid-range' as const,\n message: `Edit ${edit.inputId} has a range outside the source.`,\n inputIds: [edit.inputId],\n }));\n\n if (invalidRanges.length) return invalidRanges;\n\n const byStart = [...edits].sort(\n (left, right) => left.range.start - right.range.start || left.range.end - right.range.end,\n );\n\n for (let index = 0; index < byStart.length; index++) {\n const left = byStart[index];\n if (!left) continue;\n\n for (let nextIndex = index + 1; nextIndex < byStart.length; nextIndex++) {\n const right = byStart[nextIndex];\n if (!right || right.range.start > left.range.end) break;\n\n if (left.range.start < right.range.end && right.range.start < left.range.end) {\n const inputIds = [left.inputId, right.inputId].sort();\n return [\n {\n code: 'overlapping-edits',\n message: `Edits ${inputIds[0]} and ${inputIds[1]} overlap.`,\n inputIds,\n },\n ];\n }\n }\n }\n\n return [];\n }\n}\n","export function encodeHtmlAttribute(value: string): string {\n return value\n .replaceAll('&', '&amp;')\n .replaceAll('\"', '&quot;')\n .replaceAll('\\r', '&#13;')\n .replaceAll('\\n', '&#10;')\n .replaceAll('<', '&lt;')\n .replaceAll('>', '&gt;');\n}\n","import type { SourceEdit } from '../edit/source-edit';\nimport { SourceEditor } from '../edit/source-editor';\nimport type { MediaClause } from '../breakpoint/breakpoint-catalog';\nimport { encodeHtmlAttribute } from './html-attribute.encoder';\nimport type { ResponsiveImagePlan, ResponsiveImageSource } from './responsive-image.model';\n\nfunction mediaClause(clause: MediaClause): string {\n const conditions: string[] = [];\n if (clause.min !== undefined) conditions.push(`(min-width: ${clause.min}px)`);\n if (clause.max !== undefined) conditions.push(`(max-width: ${clause.max}px)`);\n if (clause.orientation !== undefined) conditions.push(`(orientation: ${clause.orientation})`);\n return conditions.join(' and ');\n}\n\nfunction mediaValue(source: ResponsiveImageSource): string {\n const { media } = source.definition;\n const clauses = media.clauses.map(mediaClause).filter(Boolean);\n if (!clauses.length) return media.type;\n return `${media.type} and ${clauses.map(clause => (clauses.length > 1 ? `(${clause})` : clause)).join(', ')}`;\n}\n\nfunction removalStart(source: string, elementStart: number, attributeStart: number): number {\n let start = attributeStart;\n while (start > elementStart && /\\s/u.test(source[start - 1] ?? '')) start--;\n return start;\n}\n\nexport class PictureRenderer {\n render(source: string, plan: ResponsiveImagePlan, innerEdits: readonly SourceEdit[] = []): string {\n const { element } = plan;\n const imageSource = source.slice(element.source.start, element.source.end);\n const removalEdits: SourceEdit[] = plan.sources.map(responsiveSource => ({\n range: {\n start: removalStart(source, element.startTag.start, responsiveSource.input.source.start) - element.source.start,\n end: responsiveSource.input.source.end - element.source.start,\n },\n text: '',\n inputId: responsiveSource.input.id,\n }));\n const localInnerEdits = innerEdits.map(edit => ({\n ...edit,\n range: {\n start: edit.range.start - element.source.start,\n end: edit.range.end - element.source.start,\n },\n }));\n const edited = new SourceEditor().apply(imageSource, [...removalEdits, ...localInnerEdits]);\n if (edited.status === 'invalid') {\n throw new Error(`Cannot compose responsive image edits: ${edited.diagnostics[0]?.message ?? 'invalid edit'}`);\n }\n\n const sourceTags = plan.sources.map(\n responsiveSource =>\n `<source media=\"${encodeHtmlAttribute(mediaValue(responsiveSource))}\" srcset=\"${encodeHtmlAttribute(responsiveSource.url)}\">`,\n );\n const lineEnding = imageSource.includes('\\r\\n') ? '\\r\\n' : '\\n';\n if (!imageSource.includes('\\n')) {\n return `<picture>${sourceTags.join('')}${edited.output}</picture>`;\n }\n\n const lineStart = Math.max(source.lastIndexOf('\\n', element.source.start - 1) + 1, 0);\n const linePrefix = source.slice(lineStart, element.source.start);\n const baseIndentation = /^[\\t ]*$/u.test(linePrefix) ? linePrefix : '';\n const attributeIndentation = imageSource.match(/\\r?\\n([\\t ]+)\\S/u)?.[1];\n const indentation =\n attributeIndentation?.startsWith(baseIndentation) && attributeIndentation.length > baseIndentation.length\n ? attributeIndentation\n : `${baseIndentation} `;\n return `<picture>${lineEnding}${sourceTags.map(tag => `${indentation}${tag}`).join(lineEnding)}${lineEnding}${indentation}${edited.output}${lineEnding}${baseIndentation}</picture>`;\n }\n}\n","import type { FlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { GridDeclaration, GridParseResult, GridSemanticPlan } from './grid-semantic.model';\n\nconst contentAlignment = new Set([\n 'center',\n 'space-around',\n 'space-between',\n 'space-evenly',\n 'end',\n 'start',\n 'stretch',\n]);\nconst itemAlignment = new Set(['start', 'center', 'end', 'stretch']);\n\nfunction parsed(\n role: GridSemanticPlan['role'],\n declarations: readonly GridDeclaration[],\n displayDependency = role !== 'child',\n inline?: boolean,\n): GridParseResult {\n return {\n status: 'parsed',\n plan: Object.freeze({\n role,\n declarations: Object.freeze(declarations.map(declaration => Object.freeze(declaration))),\n displayDependency,\n ...(inline === undefined ? {} : { inline }),\n }),\n };\n}\n\nfunction declaration(property: GridDeclaration['property'], value: string): GridDeclaration {\n return { property, value };\n}\n\nfunction alignment(value: string, prefix: 'align' | 'justify'): GridParseResult {\n const [rawMain, rawCross] = (value || 'start stretch').split(' ');\n const main = rawMain !== undefined && contentAlignment.has(rawMain) ? rawMain : 'start';\n const cross = rawCross !== undefined && itemAlignment.has(rawCross) ? rawCross : 'stretch';\n return parsed('container', [declaration(`${prefix}-content`, main), declaration(`${prefix}-items`, cross)]);\n}\n\nfunction tracks(value: string, axis: 'columns' | 'rows'): GridParseResult {\n let normalized = value || 'none';\n const auto = normalized.endsWith('!');\n if (auto) normalized = normalized.slice(0, normalized.indexOf('!'));\n return parsed('container', [declaration(`grid-${auto ? 'auto' : 'template'}-${axis}`, normalized)]);\n}\n\nexport function parseGridValue(input: FlexLayoutInput): GridParseResult {\n if (input.binding === 'property') {\n return {\n status: 'review',\n code: 'dynamic-binding',\n reason: 'Bound Grid values cannot be evaluated statically.',\n };\n }\n\n switch (input.directive) {\n case 'gdAlignColumns':\n return alignment(input.value, 'align');\n case 'gdAlignRows':\n return alignment(input.value, 'justify');\n case 'gdAreas': {\n const rows = (input.value || 'none').split('|').map(row => `\"${row.trim()}\"`);\n return parsed('container', [declaration('grid-template-areas', rows.join(' '))]);\n }\n case 'gdAuto': {\n let [direction, dense] = (input.value || 'initial').split(' ');\n if (!['column', 'row', 'dense'].includes(direction ?? '')) direction = 'row';\n dense = dense === 'dense' && direction !== 'dense' ? ' dense' : '';\n return parsed('container', [declaration('grid-auto-flow', `${direction}${dense}`)]);\n }\n case 'gdColumns':\n return tracks(input.value, 'columns');\n case 'gdRows':\n return tracks(input.value, 'rows');\n case 'gdGap':\n return parsed('container', [declaration('grid-gap', input.value || '0')]);\n case 'gdArea':\n return parsed('child', [declaration('grid-area', input.value || 'auto')], false);\n case 'gdColumn':\n return parsed('child', [declaration('grid-column', input.value || 'auto')], false);\n case 'gdRow':\n return parsed('child', [declaration('grid-row', input.value || 'auto')], false);\n case 'gdGridAlign': {\n const [rawRow, rawColumn] = (input.value || 'stretch').split(' ');\n const row = rawRow !== undefined && itemAlignment.has(rawRow) ? rawRow : 'stretch';\n const column = rawColumn !== undefined && itemAlignment.has(rawColumn) ? rawColumn : 'stretch';\n return parsed('child', [declaration('justify-self', row), declaration('align-self', column)], false);\n }\n case 'gdInline':\n return parsed('modifier', [], true, input.value !== 'false');\n default:\n return {\n status: 'invalid',\n code: 'invalid-value',\n reason: `${input.directive} is not a Grid directive.`,\n };\n }\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport { cssPropertiesOverlap } from '../css-property-ownership';\nimport type { SourcePropertyEvidence } from '../source-property-evidence';\nimport type { LiteralStyleDeclaration, ResponsiveStyleValueResult } from './responsive-style.model';\n\nconst interpolation = /\\{\\{[\\s\\S]*\\}\\}/u;\nconst dashedOrdinaryProperty = /^-?[a-z][a-z\\d-]*$/iu;\nconst rendererProperty = /^[a-z][a-z\\d]*$/u;\nconst customProperty = /^--[a-z\\d_-]+$/iu;\nconst unitSuffixes = new Set(['px', '%', 'em', 'rem', 'vw', 'vh', 'vmin', 'vmax', 'deg', 's', 'ms']);\nconst unitlessNumber = /^[+-]?(?:(?:\\d+(?:\\.\\d*)?)|(?:\\.\\d+))(?:e[+-]?\\d+)?$/iu;\nconst sanitizerSensitiveFunction = /(?:^|[^a-z\\d_-])(?:url|expression|image|(?:-webkit-)?image-set)\\s*\\(/iu;\nconst targetBuildFunction = /(?:^|[^a-z\\d_-])(?:--alpha|--theme|--spacing|theme)\\s*\\(/iu;\nconst urlScheme = /(?:https?|data|blob|file|javascript):/iu;\n\ninterface NormalizedProperty {\n readonly property: string;\n readonly unit?: string;\n}\n\nexport const responsiveStyleExactKeyAliasReason =\n \"Distinct exact ngStyle keys alias the same browser CSS property, so Angular's activation-history-dependent removal order cannot be represented exactly.\";\n\nfunction normalizeProperty(property: string): NormalizedProperty | undefined {\n if (property.startsWith('--')) return customProperty.test(property) ? { property } : undefined;\n const parts = property.split('.');\n if (parts.length > 2) return undefined;\n const sourceName = parts[0] ?? '';\n const name = sourceName.includes('-')\n ? dashedOrdinaryProperty.test(sourceName)\n ? sourceName.toLowerCase()\n : undefined\n : rendererProperty.test(sourceName)\n ? sourceName\n : undefined;\n if (name === undefined) return undefined;\n const unit = parts[1];\n if (unit === undefined) return { property: name };\n const normalizedUnit = unit.toLowerCase();\n return unitSuffixes.has(normalizedUnit) ? { property: name, unit: normalizedUnit } : undefined;\n}\n\nfunction transformUpstreamRawList(value: string): ResponsiveStyleValueResult {\n const rawDeclarations = String(value)\n .trim()\n .split(';')\n .map(item => item.trim())\n .filter(Boolean);\n const declarationsByExactProperty = new Map<string, LiteralStyleDeclaration>();\n for (const rawDeclaration of rawDeclarations) {\n const [rawKey, ...rawValues] = rawDeclaration.split(':');\n if (rawValues.length === 0) {\n return {\n status: 'unverified',\n reason: 'Upstream semicolon splitting produced a style entry without a property separator.',\n };\n }\n const property = (rawKey ?? '').replace(/['\"]/gu, '').trim();\n const transformedValue = rawValues.join(':').replace(/['\"]/gu, '').trim().replace(/;/u, '');\n if (!property || !transformedValue) {\n return {\n status: 'unverified',\n reason: 'Upstream raw-string transformation produced an empty style key or value.',\n };\n }\n declarationsByExactProperty.set(property, { property, value: transformedValue });\n }\n return { status: 'parsed', value: { declarations: [...declarationsByExactProperty.values()] } };\n}\n\nfunction declarationsHaveExactKeyAliases(declarations: readonly LiteralStyleDeclaration[]): boolean {\n const exactKeyByAppliedProperty = new Map<string, string>();\n for (const declaration of declarations) {\n const normalized = normalizeProperty(declaration.property);\n if (normalized === undefined) continue;\n const previous = exactKeyByAppliedProperty.get(normalized.property);\n if (previous !== undefined && previous !== declaration.property) return true;\n exactKeyByAppliedProperty.set(normalized.property, declaration.property);\n }\n return false;\n}\n\nexport function responsiveStyleValuesHaveExactKeyAliases(values: readonly string[]): boolean {\n const declarations: LiteralStyleDeclaration[] = [];\n for (const value of values) {\n const transformed = transformUpstreamRawList(value);\n if (transformed.status === 'parsed') declarations.push(...transformed.value.declarations);\n }\n return declarationsHaveExactKeyAliases(declarations);\n}\n\nfunction normalizeDeclaration(\n declaration: LiteralStyleDeclaration,\n evidence: SourcePropertyEvidence,\n): LiteralStyleDeclaration | undefined {\n const normalized = normalizeProperty(declaration.property);\n if (!normalized || !declaration.value) return undefined;\n if (\n sanitizerSensitiveFunction.test(declaration.value) ||\n targetBuildFunction.test(declaration.value) ||\n urlScheme.test(declaration.value)\n )\n return undefined;\n const value =\n normalized.unit === undefined\n ? declaration.value\n : unitlessNumber.test(declaration.value)\n ? `${declaration.value}${normalized.unit}`\n : undefined;\n if (value === undefined) return undefined;\n const result = { property: normalized.property, value };\n return evidence.classifyStyleDeclaration(result).status === 'verified' ? result : undefined;\n}\n\nexport function parseLiteralResponsiveStyleValue(\n value: string,\n evidence: SourcePropertyEvidence,\n): ResponsiveStyleValueResult {\n const transformed = transformUpstreamRawList(value);\n if (transformed.status === 'unverified') return transformed;\n if (declarationsHaveExactKeyAliases(transformed.value.declarations)) {\n return { status: 'unverified', reason: responsiveStyleExactKeyAliasReason };\n }\n const declarationsByProperty = new Map<string, LiteralStyleDeclaration>();\n for (const declaration of transformed.value.declarations) {\n const normalized = normalizeDeclaration(declaration, evidence);\n if (!normalized) {\n const priorityText = evidence.classifyStyleDeclaration(declaration);\n return {\n status: 'unverified',\n reason:\n priorityText.status === 'unverified' && priorityText.priorityText\n ? `The declaration for ${JSON.stringify(declaration.property)} contains priority text that Angular NgStyle does not apply.`\n : `The declaration for ${JSON.stringify(declaration.property)} cannot be sanitized and encoded exactly.`,\n };\n }\n declarationsByProperty.set(normalized.property, normalized);\n }\n const declarations = [...declarationsByProperty.values()];\n for (const [index, declaration] of declarations.entries()) {\n const overlapping = declarations\n .slice(index + 1)\n .find(candidate => cssPropertiesOverlap(declaration.property, candidate.property));\n if (overlapping !== undefined) {\n return {\n status: 'unverified',\n reason: `The properties ${JSON.stringify(declaration.property)} and ${JSON.stringify(overlapping.property)} have overlapping CSS property ownership.`,\n };\n }\n }\n return { status: 'parsed', value: { declarations } };\n}\n\nexport function parseResponsiveStyleValue(\n input: LocatedFlexLayoutInput,\n evidence: SourcePropertyEvidence,\n): ResponsiveStyleValueResult {\n if (input.binding !== 'literal') {\n return { status: 'unverified', reason: 'Responsive style property bindings may depend on runtime state.' };\n }\n if (input.directive !== 'ngStyle') {\n return { status: 'unverified', reason: 'Deprecated responsive style aliases are not converted.' };\n }\n if (!input.breakpoint) return { status: 'unverified', reason: 'A responsive style alias is required.' };\n if (interpolation.test(input.value)) {\n return { status: 'unverified', reason: 'Responsive style interpolation may depend on runtime state.' };\n }\n return parseLiteralResponsiveStyleValue(input.value, evidence);\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport {\n BreakpointCatalog,\n mediaDefinitionsIntersect,\n type BreakpointClassification,\n} from '../../breakpoint/breakpoint-catalog';\nimport type { UnresolvedSemanticPlan } from '../semantic-plan';\nimport type {\n ExtendedFamilyPlan,\n ExtendedFamilyPlanRequest,\n ExtendedResponsiveKind,\n ExtendedResponsiveState,\n} from './responsive-class.model';\nimport {\n responsiveStyleExactKeyAliasReason,\n responsiveStyleValuesHaveExactKeyAliases,\n} from './responsive-style-value.parser';\n\ntype ClassifiedMember<T> =\n | { readonly input: LocatedFlexLayoutInput; readonly state: ExtendedResponsiveState<T> }\n | { readonly input: LocatedFlexLayoutInput; readonly plan: UnresolvedSemanticPlan };\n\ntype ClassifiedState<T> = Extract<ClassifiedMember<T>, { readonly state: ExtendedResponsiveState<T> }>;\n\nfunction dynamicBinding(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'dynamic-binding',\n reason: 'Angular property bindings and interpolation may depend on runtime state.',\n suggestion: 'Replace the binding manually or make it a literal before migration.',\n };\n}\n\nfunction deprecatedAlias(input: LocatedFlexLayoutInput, kind: ExtendedResponsiveKind): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'semantic-unsupported',\n reason: `Deprecated responsive ${kind} aliases have version-dependent behavior.`,\n suggestion: `Keep the deprecated alias or migrate the complete responsive ${kind} family manually.`,\n };\n}\n\nfunction unresolvedBreakpoint(\n input: LocatedFlexLayoutInput,\n classification: Exclude<BreakpointClassification, { readonly kind: 'verified' }>,\n): UnresolvedSemanticPlan {\n if (classification.kind === 'custom') {\n return {\n status: 'review',\n input,\n code: 'custom-breakpoint',\n reason: `The breakpoint alias ${classification.alias} may be registered by the project.`,\n suggestion: 'Provide its media query or migrate this responsive family manually.',\n };\n }\n\n const kind = classification.kind === 'print' ? 'print' : 'optional';\n return {\n status: 'review',\n input,\n code: 'breakpoint-unverified',\n reason: `The ${kind} breakpoint alias ${classification.alias} is not enabled by explicit migration configuration.`,\n suggestion:\n classification.kind === 'print'\n ? 'Verify the source printWithBreakpoints value, then rerun with --print-with-breakpoints.'\n : 'Verify that the source enables orientation breakpoints, then rerun with --orientation-breakpoints.',\n };\n}\n\nfunction unverifiedValue(\n input: LocatedFlexLayoutInput,\n kind: ExtendedResponsiveKind,\n token: string | undefined,\n reason: string,\n): UnresolvedSemanticPlan {\n if (kind === 'style') {\n return {\n status: 'review',\n input,\n code: 'style-value-unverified',\n reason,\n suggestion: 'Keep the complete responsive style family or replace unsafe declarations before migration.',\n };\n }\n\n return {\n status: 'review',\n input,\n code: 'tailwind-candidate-unverified',\n reason:\n token === undefined\n ? reason\n : `The first unverified token is ${JSON.stringify(token)}. It may be an application or plugin class. ${reason}`,\n suggestion: 'Keep the complete responsive class family or replace unverified classes before migration.',\n };\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Another member of this responsive family is unresolved.',\n suggestion: 'Migrate the complete responsive family together manually.',\n };\n}\n\nfunction responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'responsive-precedence-unverified',\n reason: 'The responsive family contains different values in intersecting activation ranges.',\n suggestion: 'Make intersecting values identical or migrate the complete responsive family manually.',\n };\n}\n\nfunction compareText(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n\nexport class ExtendedFamilyPlanner {\n constructor(private readonly catalog = new BreakpointCatalog()) {}\n\n plan<T>(request: ExtendedFamilyPlanRequest<T>): ExtendedFamilyPlan<T> {\n const members = request.inputs\n .map(input => this.classify(input, request.kind, request.valueParser))\n .sort((left, right) => this.compare(left.input, right.input));\n\n if (!members.every((member): member is ClassifiedState<T> => 'state' in member)) {\n return {\n status: 'unresolved',\n plans: members.map(member => ('plan' in member ? member.plan : contextUnverified(member.input))),\n };\n }\n\n const states = members.map(member => member.state);\n if (request.kind === 'style' && responsiveStyleValuesHaveExactKeyAliases(states.map(state => state.input.value))) {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n unverifiedValue(state.input, request.kind, undefined, responsiveStyleExactKeyAliasReason),\n ),\n };\n }\n if (this.hasConflictingStates(states, request.equals)) {\n return {\n status: 'unresolved',\n plans: states.map(state => responsivePrecedenceUnverified(state.input)),\n };\n }\n\n return { status: 'converted', states };\n }\n\n private classify<T>(\n input: LocatedFlexLayoutInput,\n kind: ExtendedResponsiveKind,\n valueParser: ExtendedFamilyPlanRequest<T>['valueParser'],\n ): ClassifiedMember<T> {\n if (input.binding !== 'literal' || /\\{\\{[\\s\\S]*\\}\\}/u.test(input.value)) {\n return { input, plan: dynamicBinding(input) };\n }\n const expectedDirective = kind === 'class' ? 'ngClass' : 'ngStyle';\n if (input.directive !== expectedDirective) return { input, plan: deprecatedAlias(input, kind) };\n if (input.breakpoint === undefined) return { input, plan: deprecatedAlias(input, kind) };\n\n const breakpoint = this.catalog.classify(input.breakpoint);\n if (breakpoint.kind !== 'verified') return { input, plan: unresolvedBreakpoint(input, breakpoint) };\n\n const parsed = valueParser(input);\n if (parsed.status === 'unverified') {\n return { input, plan: unverifiedValue(input, kind, parsed.token, parsed.reason) };\n }\n\n return {\n input,\n state: {\n input,\n activation: { kind: 'media', definition: breakpoint.definition },\n value: parsed.value,\n },\n };\n }\n\n private hasConflictingStates<T>(\n states: readonly ExtendedResponsiveState<T>[],\n equals: (left: T, right: T) => boolean,\n ): boolean {\n return states.some((left, leftIndex) =>\n states\n .slice(leftIndex + 1)\n .some(\n right =>\n !equals(left.value, right.value) &&\n mediaDefinitionsIntersect(left.activation.definition.media, right.activation.definition.media),\n ),\n );\n }\n\n private compare(left: LocatedFlexLayoutInput, right: LocatedFlexLayoutInput): number {\n const leftPriority = this.breakpointPriority(left.breakpoint);\n const rightPriority = this.breakpointPriority(right.breakpoint);\n if (leftPriority !== rightPriority) return rightPriority - leftPriority;\n\n const aliasOrder = compareText(left.breakpoint ?? '', right.breakpoint ?? '');\n return aliasOrder || compareText(left.id, right.id);\n }\n\n private breakpointPriority(alias: string | undefined): number {\n if (alias === undefined) return Number.NEGATIVE_INFINITY;\n const classification = this.catalog.classify(alias);\n return classification.kind === 'verified' ? classification.definition.priority : Number.NEGATIVE_INFINITY;\n }\n}\n","const cssWhitespace = /[\\t\\n\\f\\r ]/u;\nconst hexDigit = /[\\da-f]/iu;\n\nexport interface LiteralStyleDeclaration {\n readonly property: string;\n readonly value: string;\n}\n\nexport type LiteralStyleParseResult =\n | { readonly status: 'parsed'; readonly declarations: readonly LiteralStyleDeclaration[] }\n | { readonly status: 'unverified'; readonly reason: string };\n\nfunction splitDeclarations(value: string): readonly string[] | undefined {\n const declarations: string[] = [];\n let current = '';\n let quote: '\"' | \"'\" | undefined;\n let parentheses = 0;\n let brackets = 0;\n let braces = 0;\n\n for (let index = 0; index < value.length; index += 1) {\n const character = value[index];\n const next = value[index + 1];\n if (character === undefined) continue;\n\n if (quote) {\n current += character;\n if (character === '\\\\') {\n if (next === undefined) return undefined;\n current += next;\n index += 1;\n } else if (character === quote) {\n quote = undefined;\n }\n continue;\n }\n\n if (character === '/' && next === '*') {\n const commentEnd = value.indexOf('*/', index + 2);\n if (commentEnd < 0) return undefined;\n current += ' ';\n index = commentEnd + 1;\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n current += character;\n continue;\n }\n if (character === '\\\\') {\n if (next === undefined || next === '\\n' || next === '\\r' || next === '\\f') return undefined;\n current += character + next;\n index += 1;\n continue;\n }\n\n if (character === '(') parentheses += 1;\n else if (character === ')') {\n if (parentheses === 0) return undefined;\n parentheses -= 1;\n } else if (character === '[') brackets += 1;\n else if (character === ']') {\n if (brackets === 0) return undefined;\n brackets -= 1;\n } else if (character === '{') braces += 1;\n else if (character === '}') {\n if (braces === 0) return undefined;\n braces -= 1;\n }\n\n if (character === ';' && parentheses === 0 && brackets === 0 && braces === 0) {\n declarations.push(current);\n current = '';\n } else {\n current += character;\n }\n }\n\n if (quote || parentheses !== 0 || brackets !== 0 || braces !== 0) return undefined;\n declarations.push(current);\n return declarations;\n}\n\nfunction declarationColon(declaration: string): number | undefined {\n let quote: '\"' | \"'\" | undefined;\n let parentheses = 0;\n let brackets = 0;\n let braces = 0;\n\n for (let index = 0; index < declaration.length; index += 1) {\n const character = declaration[index];\n if (character === undefined) continue;\n if (quote) {\n if (character === '\\\\') index += 1;\n else if (character === quote) quote = undefined;\n continue;\n }\n if (character === '\"' || character === \"'\") {\n quote = character;\n continue;\n }\n if (character === '\\\\') {\n index += 1;\n continue;\n }\n if (character === '(') parentheses += 1;\n else if (character === ')') parentheses -= 1;\n else if (character === '[') brackets += 1;\n else if (character === ']') brackets -= 1;\n else if (character === '{') braces += 1;\n else if (character === '}') braces -= 1;\n else if (character === ':' && parentheses === 0 && brackets === 0 && braces === 0) return index;\n }\n return undefined;\n}\n\nfunction decodeIdentifier(value: string): string | undefined {\n const trimmed = value.trim();\n if (!trimmed) return undefined;\n\n let decoded = '';\n for (let index = 0; index < trimmed.length; index += 1) {\n const character = trimmed[index];\n if (character === undefined) continue;\n if (cssWhitespace.test(character)) return undefined;\n if (character !== '\\\\') {\n decoded += character;\n continue;\n }\n\n const next = trimmed[index + 1];\n if (next === undefined || next === '\\n' || next === '\\r' || next === '\\f') return undefined;\n let hex = '';\n let cursor = index + 1;\n while (hex.length < 6 && cursor < trimmed.length && hexDigit.test(trimmed[cursor] ?? '')) {\n hex += trimmed[cursor];\n cursor += 1;\n }\n if (hex) {\n const codePoint = Number.parseInt(hex, 16);\n decoded +=\n codePoint === 0 || codePoint > 0x10ffff || (codePoint >= 0xd800 && codePoint <= 0xdfff)\n ? '\\uFFFD'\n : String.fromCodePoint(codePoint);\n if (cssWhitespace.test(trimmed[cursor] ?? '')) {\n if (trimmed[cursor] === '\\r' && trimmed[cursor + 1] === '\\n') cursor += 1;\n cursor += 1;\n }\n index = cursor - 1;\n continue;\n }\n\n decoded += next;\n index += 1;\n }\n return decoded;\n}\n\nexport function literalStyleMayControlDisplay(value: string): boolean {\n const result = parseLiteralStyleDeclarations(value);\n if (result.status === 'unverified') return true;\n\n return result.declarations.some(declaration => declaration.property.toLowerCase() === 'display');\n}\n\nexport function parseLiteralStyleDeclarations(value: string): LiteralStyleParseResult {\n const segments = splitDeclarations(value);\n if (!segments) {\n return { status: 'unverified', reason: 'The literal style has malformed or unbalanced delimiters.' };\n }\n\n const declarations: LiteralStyleDeclaration[] = [];\n\n for (const segment of segments) {\n if (!segment.trim()) continue;\n const colon = declarationColon(segment);\n if (colon === undefined) {\n return { status: 'unverified', reason: 'A literal style declaration is missing its property separator.' };\n }\n const property = decodeIdentifier(segment.slice(0, colon));\n if (!property) {\n return { status: 'unverified', reason: 'A literal style declaration has an ambiguous property name.' };\n }\n declarations.push({ property, value: segment.slice(colon + 1).trim() });\n }\n\n return { status: 'parsed', declarations };\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport type { SourceClassTokenEvidence, SourcePropertyEvidence } from '../source-property-evidence';\n\nexport interface SemanticResponsiveClassValue {\n readonly tokens: readonly SourceClassTokenEvidence[];\n}\n\nexport type SemanticResponsiveClassValueResult =\n | { readonly status: 'parsed'; readonly value: SemanticResponsiveClassValue }\n | { readonly status: 'unverified'; readonly token?: string; readonly reason: string };\n\nconst interpolation = /\\{\\{[\\s\\S]*\\}\\}/u;\n\nexport function parseLiteralResponsiveClassValue(\n value: string,\n evidence: SourcePropertyEvidence,\n): SemanticResponsiveClassValueResult {\n if (interpolation.test(value)) {\n return { status: 'unverified', reason: 'Responsive class interpolation may depend on runtime state.' };\n }\n const sources = [...new Set(value.split(/\\s+/u).filter(Boolean))];\n const tokens: SourceClassTokenEvidence[] = [];\n for (const source of sources) {\n const classification = evidence.classifyClassToken(source);\n if (classification.status === 'unverified') {\n return {\n status: 'unverified',\n token: source,\n reason: `The class token ${JSON.stringify(source)} is not a compiler-proven built-in Tailwind utility and may be an application or plugin class. ${classification.reason}`,\n };\n }\n tokens.push(classification.evidence);\n }\n return { status: 'parsed', value: { tokens } };\n}\n\nexport function parseResponsiveClassValue(\n input: LocatedFlexLayoutInput,\n evidence: SourcePropertyEvidence,\n): SemanticResponsiveClassValueResult {\n if (input.binding !== 'literal') {\n return { status: 'unverified', reason: 'Responsive class property bindings may depend on runtime state.' };\n }\n if (input.directive !== 'ngClass') {\n return { status: 'unverified', reason: 'Deprecated responsive class aliases are not converted.' };\n }\n if (!input.breakpoint) return { status: 'unverified', reason: 'A responsive class alias is required.' };\n return parseLiteralResponsiveClassValue(input.value, evidence);\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport { templateAttributeKeys } from '../../template/template-attribute';\nimport type { TemplateAttribute } from '../../template/template.model';\nimport { cssPropertiesOverlap } from '../css-property-ownership';\nimport { parseLiteralStyleDeclarations } from '../literal-style-declaration';\nimport type { SourceClassTokenEvidence, SourcePropertyEvidence } from '../source-property-evidence';\nimport type { UnresolvedSemanticPlan } from '../semantic-plan';\nimport type { ExtendedFamilyPlan, ExtendedResponsiveState } from './responsive-class.model';\nimport { parseLiteralResponsiveClassValue, type SemanticResponsiveClassValue } from './responsive-class-value.parser';\nimport type { ResponsiveStyleValue } from './responsive-style.model';\nimport {\n parseLiteralResponsiveStyleValue,\n responsiveStyleExactKeyAliasReason,\n responsiveStyleValuesHaveExactKeyAliases,\n} from './responsive-style-value.parser';\n\ninterface ExtendedSemanticRequestBase {\n readonly attributes: readonly TemplateAttribute[];\n}\n\nexport type ExtendedSemanticPlanRequest =\n | (ExtendedSemanticRequestBase & {\n readonly kind: 'class';\n readonly familyPlan: ExtendedFamilyPlan<SemanticResponsiveClassValue>;\n })\n | (ExtendedSemanticRequestBase & {\n readonly kind: 'style';\n readonly familyPlan: ExtendedFamilyPlan<ResponsiveStyleValue>;\n });\n\nexport type ExtendedSemanticPlan =\n | {\n readonly status: 'resolved';\n readonly ownerInputId?: string;\n readonly retainedTokens: readonly SourceClassTokenEvidence[];\n }\n | { readonly status: 'unresolved'; readonly plans: readonly UnresolvedSemanticPlan[] };\n\ntype AnyExtendedState =\n ExtendedResponsiveState<SemanticResponsiveClassValue> | ExtendedResponsiveState<ResponsiveStyleValue>;\n\nfunction boundClassAuthority(attribute: TemplateAttribute): boolean {\n if (attribute.binding !== 'property') return false;\n if (attribute.bindingTarget === 'class') return true;\n return [...templateAttributeKeys(attribute)].some(\n key =>\n key === 'class' ||\n key === 'ngclass' ||\n key === 'attr.class' ||\n key.startsWith('class.') ||\n key.startsWith('ngclass.') ||\n key.startsWith('attr.class.'),\n );\n}\n\nfunction boundStyleAuthority(attribute: TemplateAttribute): boolean {\n if (attribute.binding !== 'property') return false;\n if (attribute.bindingTarget === 'style') return true;\n return [...templateAttributeKeys(attribute)].some(\n key =>\n key === 'style' ||\n key === 'ngstyle' ||\n key === 'attr.style' ||\n key.startsWith('style.') ||\n key.startsWith('ngstyle.') ||\n key.startsWith('attr.style.'),\n );\n}\n\nfunction literalStyleAuthority(attribute: TemplateAttribute): boolean {\n return attribute.binding === 'literal' && templateAttributeKeys(attribute).has('style');\n}\n\nfunction unsuffixedAuthority(\n attributes: readonly TemplateAttribute[],\n key: 'ngclass' | 'ngstyle',\n): TemplateAttribute | undefined {\n return attributes.find(attribute => templateAttributeKeys(attribute).has(key));\n}\n\nfunction equalClassValues(left: SemanticResponsiveClassValue, right: SemanticResponsiveClassValue): boolean {\n return (\n left.tokens.length === right.tokens.length &&\n left.tokens.every((token, index) => token.source === right.tokens[index]?.source)\n );\n}\n\nfunction diagnostic(\n input: LocatedFlexLayoutInput,\n code: 'bound-class' | 'class-conflict' | 'tailwind-candidate-unverified' | 'style-value-unverified',\n reason: string,\n suggestion: string,\n): UnresolvedSemanticPlan {\n return { status: 'review', input, code, reason, suggestion };\n}\n\nexport class ExtendedSemanticPlanner {\n constructor(private readonly evidence: SourcePropertyEvidence) {}\n\n plan(request: ExtendedSemanticPlanRequest): ExtendedSemanticPlan {\n if (request.familyPlan.status === 'unresolved') {\n return { status: 'unresolved', plans: request.familyPlan.plans };\n }\n if (request.kind === 'class') return this.planClass(request.familyPlan.states, request.attributes);\n return this.planStyle(request.familyPlan.states, request.attributes);\n }\n\n private planClass(\n states: readonly ExtendedResponsiveState<SemanticResponsiveClassValue>[],\n attributes: readonly TemplateAttribute[],\n ): ExtendedSemanticPlan {\n const fallback = unsuffixedAuthority(attributes, 'ngclass');\n if (fallback !== undefined) {\n if (fallback.binding !== 'literal') {\n return this.unresolved(\n states,\n 'bound-class',\n 'A bound unsuffixed ngClass value is the runtime fallback for this responsive family.',\n 'Make the complete ngClass family literal or migrate its replacement behavior manually.',\n );\n }\n const parsed = parseLiteralResponsiveClassValue(fallback.value, this.evidence);\n if (parsed.status === 'unverified') {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n diagnostic(\n state.input,\n 'tailwind-candidate-unverified',\n `The unsuffixed ngClass fallback cannot be translated exactly. ${parsed.reason}`,\n 'Keep the complete ngClass family or replace the fallback with proven Tailwind candidates.',\n ),\n ),\n };\n }\n if (parsed.value.tokens.length > 0) {\n if (states.every(state => equalClassValues(state.value, parsed.value))) {\n return { status: 'resolved', retainedTokens: parsed.value.tokens };\n }\n return this.unresolved(\n states,\n 'class-conflict',\n 'The literal unsuffixed ngClass fallback is replaced, not merged, when a responsive value activates.',\n 'Migrate the complete ngClass fallback and responsive replacement family manually.',\n );\n }\n }\n\n const hasOutput = states.some(state => state.value.tokens.length > 0);\n if (hasOutput && attributes.some(boundClassAuthority)) {\n return this.unresolved(\n states,\n 'bound-class',\n 'Generated responsive classes cannot be merged safely with a bound class value.',\n 'Merge the generated classes into the class binding manually.',\n );\n }\n return {\n status: 'resolved',\n ...(hasOutput && states[0] !== undefined ? { ownerInputId: states[0].input.id } : {}),\n retainedTokens: [],\n };\n }\n\n private planStyle(\n states: readonly ExtendedResponsiveState<ResponsiveStyleValue>[],\n attributes: readonly TemplateAttribute[],\n ): ExtendedSemanticPlan {\n if (responsiveStyleValuesHaveExactKeyAliases(states.map(state => state.input.value))) {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n diagnostic(\n state.input,\n 'style-value-unverified',\n responsiveStyleExactKeyAliasReason,\n 'Keep the complete responsive style family or normalize its exact property key before migration.',\n ),\n ),\n };\n }\n const fallback = unsuffixedAuthority(attributes, 'ngstyle');\n if (fallback !== undefined) {\n if (fallback.binding !== 'literal') {\n return this.unresolved(\n states,\n 'class-conflict',\n 'A bound unsuffixed ngStyle value is the runtime fallback for this responsive family.',\n 'Make the complete ngStyle family literal or migrate its replacement behavior manually.',\n );\n }\n const parsed = parseLiteralResponsiveStyleValue(fallback.value, this.evidence);\n if (parsed.status === 'unverified') {\n return {\n status: 'unresolved',\n plans: states.map(state =>\n diagnostic(\n state.input,\n 'style-value-unverified',\n `The unsuffixed ngStyle fallback cannot be translated exactly. ${parsed.reason}`,\n 'Keep the complete ngStyle family or replace the fallback with an exact literal style map.',\n ),\n ),\n };\n }\n if (parsed.value.declarations.length > 0 || fallback.value.length > 0) {\n return this.unresolved(\n states,\n 'class-conflict',\n 'The literal unsuffixed ngStyle raw-string fallback is replaced at runtime and cannot remain after Flex-Layout is removed.',\n 'Translate and remove the complete ngStyle fallback together with its responsive replacement family.',\n );\n }\n }\n\n const hasOutput = states.some(state => state.value.declarations.length > 0);\n if (hasOutput && attributes.some(boundClassAuthority)) {\n return this.unresolved(\n states,\n 'bound-class',\n 'Generated responsive classes cannot be merged safely with a bound class value.',\n 'Merge the generated classes into the class binding manually.',\n );\n }\n if (hasOutput && attributes.some(boundStyleAuthority)) {\n return this.unresolved(\n states,\n 'class-conflict',\n 'A bound style authority may control a property generated by this responsive style family.',\n 'Remove or reconcile the bound style before migrating this family.',\n );\n }\n const generatedProperties = new Set(\n states.flatMap(state => state.value.declarations.map(declaration => declaration.property)),\n );\n if (hasOutput && this.literalStyleConflicts(attributes, generatedProperties)) {\n return this.unresolved(\n states,\n 'class-conflict',\n 'A literal fallback style may control a property generated by this responsive style family.',\n 'Remove or reconcile the overlapping fallback declaration before migrating this family.',\n );\n }\n return {\n status: 'resolved',\n ...(hasOutput && states[0] !== undefined ? { ownerInputId: states[0].input.id } : {}),\n retainedTokens: [],\n };\n }\n\n private literalStyleConflicts(\n attributes: readonly TemplateAttribute[],\n generatedProperties: ReadonlySet<string>,\n ): boolean {\n return attributes.filter(literalStyleAuthority).some(attribute => {\n const parsed = parseLiteralStyleDeclarations(attribute.value);\n if (parsed.status === 'unverified') return true;\n return parsed.declarations.some(declaration =>\n [...generatedProperties].some(property => cssPropertiesOverlap(declaration.property, property)),\n );\n });\n }\n\n private unresolved(\n states: readonly AnyExtendedState[],\n code: 'bound-class' | 'class-conflict',\n reason: string,\n suggestion: string,\n ): ExtendedSemanticPlan {\n return {\n status: 'unresolved',\n plans: states.map(state => diagnostic(state.input, code, reason, suggestion)),\n };\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { mediaRangesIntersect, type BreakpointCatalog, type MediaRange } from '../breakpoint/breakpoint-catalog';\nimport type { FlexFillSemantics } from '../flex/flex-fill.semantic';\nimport type { FlexItemSemantics } from '../flex/flex-item.semantic';\nimport type { FlexOffsetSemantics } from '../flex/flex-offset.semantic';\nimport type { LayoutAlignmentSemantics } from '../flex/layout-align.semantic';\nimport type { LayoutSemantics } from '../flex/layout.semantic';\nimport type { GridSemanticPlan } from '../grid/grid-semantic.model';\nimport { templateAttributeKeys } from '../template/template-attribute';\nimport type { SemanticConversionContext } from './conversion-context';\nimport { cssPropertiesOverlap, cssPropertyOwnershipCovers } from './css-property-ownership';\nimport { literalStyleMayControlDisplay, parseLiteralStyleDeclarations } from './literal-style-declaration';\nimport {\n directiveFamily,\n type DirectiveFamily,\n type ExtendedClassSemantics,\n type ExtendedStyleSemantics,\n type ResolvedSemanticPlan,\n type UnresolvedSemanticPlan,\n type SemanticActivation,\n type SuppressedSemanticEffect,\n type VisibilitySemantics,\n} from './semantic-plan';\nimport { type SourceClassTokenEvidence, type SourcePropertyEvidence } from './source-property-evidence';\n\nexport type SemanticCompositionPlan = ResolvedSemanticPlan | UnresolvedSemanticPlan;\n\ntype PropertyAuthority = 'source-class' | 'source-inline' | 'semantic-replacement';\n\ninterface PropertyEffect {\n readonly planId: string;\n readonly family: DirectiveFamily;\n readonly activation: SemanticActivation;\n readonly properties: readonly string[];\n readonly important: boolean;\n readonly authority: PropertyAuthority;\n readonly suppressible: boolean;\n readonly retained: boolean;\n readonly signature: string;\n readonly display?: { readonly intent: 'shown' | 'hidden' | 'unverified'; readonly value?: string };\n}\n\ninterface SourceAuthority {\n readonly input: LocatedFlexLayoutInput;\n readonly family: 'extended-class' | 'extended-style';\n readonly range: MediaRange;\n readonly properties: readonly string[] | undefined;\n readonly mayControlDisplay: boolean;\n}\n\ninterface NumericRange {\n readonly min: number;\n readonly max: number;\n}\n\nconst extendedClassDirectives = new Set<LocatedFlexLayoutInput['directive']>(['class', 'ngClass']);\nconst extendedStyleDirectives = new Set<LocatedFlexLayoutInput['directive']>(['style', 'ngStyle']);\nconst restorationDisplays = new Set([\n 'inline',\n 'block',\n 'inline-block',\n 'flow-root',\n 'flex',\n 'inline-flex',\n 'grid',\n 'inline-grid',\n 'contents',\n 'table',\n 'inline-table',\n 'table-caption',\n 'table-cell',\n 'table-column',\n 'table-column-group',\n 'table-footer-group',\n 'table-header-group',\n 'table-row-group',\n 'table-row',\n 'list-item',\n]);\n\nfunction numericRange(range: MediaRange): NumericRange {\n return {\n min: range.min ?? Number.NEGATIVE_INFINITY,\n max: range.max ?? Number.POSITIVE_INFINITY,\n };\n}\n\nfunction activationRange(activation: SemanticActivation): MediaRange {\n return activation.kind === 'base' ? {} : activation.definition.range;\n}\n\nfunction sameActivation(left: SemanticActivation, right: SemanticActivation): boolean {\n if (left.kind !== right.kind) return false;\n if (left.kind === 'base' || right.kind === 'base') return true;\n return (\n left.definition.range.min === right.definition.range.min && left.definition.range.max === right.definition.range.max\n );\n}\n\nfunction rangesCover(target: MediaRange, ranges: readonly MediaRange[]): boolean {\n const numericTarget = numericRange(target);\n const clipped = ranges\n .filter(range => mediaRangesIntersect(target, range))\n .map(range => {\n const numeric = numericRange(range);\n return {\n min: Math.max(numericTarget.min, numeric.min),\n max: Math.min(numericTarget.max, numeric.max),\n };\n })\n .sort((left, right) => left.min - right.min);\n const first = clipped[0];\n if (!first || first.min !== numericTarget.min) return false;\n let coveredUntil = first.max;\n for (const range of clipped.slice(1)) {\n if (range.min > coveredUntil) return false;\n coveredUntil = Math.max(coveredUntil, range.max);\n }\n return coveredUntil >= numericTarget.max;\n}\n\nfunction propertySetsOverlap(left: readonly string[], right: readonly string[]): boolean {\n return left.some(leftProperty => right.some(rightProperty => cssPropertiesOverlap(leftProperty, rightProperty)));\n}\n\nfunction propertiesEqual(left: readonly string[], right: readonly string[]): boolean {\n return left.length === right.length && left.every((property, index) => property === right[index]);\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput, reason: string): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason,\n suggestion: 'Migrate the coupled responsive families together manually.',\n };\n}\n\nfunction generatedOwnershipUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Generated responsive families have overlapping CSS ownership without one provable precedence.',\n suggestion: 'Migrate the coupled responsive families together manually.',\n };\n}\n\nfunction displayRestorationUnverified(input: LocatedFlexLayoutInput, reason: string): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'display-restoration-unverified',\n reason,\n suggestion: 'Provide one unambiguous visible display value or migrate this visibility family manually.',\n };\n}\n\nfunction partialDisplayContextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Partially overlapping responsive layout and visibility displays have unverified cascade precedence.',\n suggestion: 'Migrate the coupled layout and visibility ranges together manually.',\n };\n}\n\nfunction authority(family: DirectiveFamily): PropertyAuthority {\n if (family === 'extended-class') return 'source-class';\n if (\n family === 'extended-style' ||\n family === 'layout' ||\n family === 'layout-align' ||\n family === 'flex-item' ||\n family === 'flex-align' ||\n family === 'flex-fill' ||\n family === 'flex-offset' ||\n family === 'flex-order' ||\n family === 'visibility'\n ) {\n return 'source-inline';\n }\n return 'semantic-replacement';\n}\n\nfunction displayIntent(value: string | undefined): PropertyEffect['display'] {\n if (value === undefined) return undefined;\n if (value === 'none') return { intent: 'hidden', value };\n return restorationDisplays.has(value) ? { intent: 'shown', value } : { intent: 'unverified', value };\n}\n\nfunction makeEffect(\n plan: ResolvedSemanticPlan,\n activation: SemanticActivation,\n properties: readonly string[],\n signature: string,\n options: {\n readonly important?: boolean;\n readonly suppressible?: boolean;\n readonly retained?: boolean;\n readonly display?: PropertyEffect['display'];\n } = {},\n): PropertyEffect {\n return {\n planId: plan.input.id,\n family: plan.family,\n activation,\n properties,\n important: options.important ?? false,\n authority: authority(plan.family),\n suppressible: options.suppressible ?? false,\n retained: options.retained ?? false,\n signature,\n ...(options.display === undefined ? {} : { display: options.display }),\n };\n}\n\nfunction ordinaryPropertyGroups(\n plan: ResolvedSemanticPlan,\n): readonly { properties: readonly string[]; signature: string; display?: PropertyEffect['display'] }[] {\n switch (plan.family) {\n case 'layout': {\n const value = plan.value as LayoutSemantics;\n return [\n { properties: ['display'], signature: value.display, display: displayIntent(value.display) },\n { properties: ['flex-direction'], signature: value.direction },\n ...(value.explicitWrap ? [{ properties: ['flex-wrap'], signature: value.wrap }] : []),\n { properties: ['box-sizing'], signature: value.boxSizing },\n ];\n }\n case 'layout-gap':\n return [{ properties: ['gap'], signature: 'gap' }];\n case 'layout-align': {\n const value = plan.value as LayoutAlignmentSemantics;\n return [\n { properties: ['justify-content'], signature: value.main },\n { properties: ['align-items'], signature: value.items },\n { properties: ['align-content'], signature: value.content },\n { properties: ['display'], signature: value.layout.display, display: displayIntent(value.layout.display) },\n { properties: ['flex-direction'], signature: value.layout.direction },\n ...(value.layout.explicitWrap ? [{ properties: ['flex-wrap'], signature: value.layout.wrap }] : []),\n { properties: ['box-sizing'], signature: value.layout.boxSizing },\n ...(value.stretchMaximum === undefined\n ? []\n : [{ properties: [`max-${value.stretchMaximum}`], signature: '100%' }]),\n ];\n }\n case 'flex-item': {\n const value = plan.value as FlexItemSemantics;\n const flex =\n value.basis.kind === 'computed'\n ? [\n { properties: ['flex-grow'], signature: value.grow },\n { properties: ['flex-shrink'], signature: value.shrink },\n { properties: ['flex-basis'], signature: value.basis.value },\n ]\n : [{ properties: ['flex'], signature: `${value.grow} ${value.shrink} ${value.basis.value}` }];\n return [\n ...flex,\n ...(value.min === undefined ? [] : [{ properties: [`min-${value.axis}`], signature: value.min }]),\n ...(value.max === undefined ? [] : [{ properties: [`max-${value.axis}`], signature: value.max }]),\n { properties: ['box-sizing'], signature: value.boxSizing },\n ];\n }\n case 'flex-align':\n return [{ properties: ['align-self'], signature: 'align-self' }];\n case 'flex-fill': {\n const value = plan.value as FlexFillSemantics;\n return [\n { properties: ['margin'], signature: value.margin },\n { properties: ['width'], signature: value.width },\n { properties: ['height'], signature: value.height },\n { properties: ['min-width'], signature: value.minWidth },\n { properties: ['min-height'], signature: value.minHeight },\n ];\n }\n case 'flex-offset': {\n const value = plan.value as FlexOffsetSemantics;\n return [\n {\n properties: [value.axis === 'inline-start' ? 'margin-inline-start' : 'margin-top'],\n signature: value.length,\n },\n ];\n }\n case 'flex-order':\n return [{ properties: ['order'], signature: 'order' }];\n default: {\n const value = plan.value as GridSemanticPlan;\n if (!('declarations' in value)) return [];\n return [\n ...(value.role === 'container' && plan.emitGridDisplay !== false\n ? [{ properties: ['display'], signature: 'grid', display: displayIntent('grid') }]\n : value.role === 'modifier'\n ? [\n {\n properties: ['display'],\n signature: value.inline ? 'inline-grid' : 'grid',\n display: displayIntent(value.inline ? 'inline-grid' : 'grid'),\n },\n ]\n : []),\n ...value.declarations.map(declaration => ({\n properties: [declaration.property],\n signature: `${declaration.property}:${declaration.value}`,\n })),\n ];\n }\n }\n}\n\nfunction semanticEffects(plan: ResolvedSemanticPlan): readonly PropertyEffect[] {\n if (plan.family === 'visibility') return [];\n if (plan.family === 'extended-class') {\n const value = plan.value as ExtendedClassSemantics;\n const emitted = value.emit\n ? value.states.flatMap((state, stateIndex) =>\n state.activations.flatMap(activation =>\n state.tokens.flatMap((token, tokenIndex) => {\n if (token.properties.length === 0) return [];\n const controlsDisplay = token.properties.some(property => cssPropertiesOverlap(property, 'display'));\n return [\n makeEffect(plan, activation, token.properties, `class:${stateIndex}:${tokenIndex}:${token.source}`, {\n important: token.important,\n suppressible: true,\n display:\n token.display === undefined\n ? controlsDisplay\n ? { intent: 'unverified' }\n : undefined\n : displayIntent(token.display),\n }),\n ];\n }),\n ),\n )\n : [];\n const retained = value.retainedTokens.flatMap((token, tokenIndex) => {\n if (token.properties.length === 0) return [];\n const controlsDisplay = token.properties.some(property => cssPropertiesOverlap(property, 'display'));\n return [\n makeEffect(plan, { kind: 'base' }, token.properties, `retained:${tokenIndex}:${token.source}`, {\n important: token.important,\n retained: true,\n display:\n token.display === undefined\n ? controlsDisplay\n ? { intent: 'unverified' }\n : undefined\n : displayIntent(token.display),\n }),\n ];\n });\n return [...emitted, ...retained];\n }\n if (plan.family === 'extended-style') {\n const value = plan.value as ExtendedStyleSemantics;\n return value.emit\n ? value.states.flatMap((state, stateIndex) =>\n state.activations.flatMap(activation =>\n state.declarations.map((declaration, declarationIndex) =>\n makeEffect(\n plan,\n activation,\n [declaration.property],\n `style:${stateIndex}:${declarationIndex}:${declaration.property}:${declaration.value}`,\n {\n suppressible: true,\n display: cssPropertiesOverlap(declaration.property, 'display')\n ? declaration.property === 'display'\n ? displayIntent(declaration.value)\n : { intent: 'unverified' }\n : undefined,\n },\n ),\n ),\n ),\n )\n : [];\n }\n return plan.activations.flatMap(activation =>\n ordinaryPropertyGroups(plan).map(group =>\n makeEffect(plan, activation, group.properties, group.signature, { display: group.display }),\n ),\n );\n}\n\nfunction sourceAuthorities(\n plans: readonly SemanticCompositionPlan[],\n catalog: BreakpointCatalog,\n evidence: SourcePropertyEvidence,\n): readonly SourceAuthority[] {\n const authorities: SourceAuthority[] = [];\n for (const plan of plans) {\n const input = plan.input;\n const family = extendedClassDirectives.has(input.directive)\n ? 'extended-class'\n : extendedStyleDirectives.has(input.directive)\n ? 'extended-style'\n : undefined;\n if (family === undefined) continue;\n const classification = input.breakpoint === undefined ? undefined : catalog.classify(input.breakpoint);\n const range = classification?.kind === 'verified' ? classification.definition.range : {};\n if (input.binding !== 'literal') {\n authorities.push({ input, family, range, properties: undefined, mayControlDisplay: true });\n continue;\n }\n if (family === 'extended-class') {\n const tokens = input.value.split(/[\\t\\n\\f\\r ]+/u).filter(Boolean);\n const classifications = tokens.map(token => evidence.classifyClassToken(token));\n const properties = classifications.some(item => item.status === 'unverified')\n ? undefined\n : classifications.flatMap(item => (item.status === 'verified' ? item.evidence.properties : []));\n authorities.push({\n input,\n family,\n range,\n properties,\n mayControlDisplay:\n properties === undefined || properties.some(property => cssPropertiesOverlap(property, 'display')),\n });\n continue;\n }\n const parsed = parseLiteralStyleDeclarations(input.value);\n const properties =\n parsed.status === 'parsed' ? parsed.declarations.map(declaration => declaration.property) : undefined;\n authorities.push({\n input,\n family,\n range,\n properties,\n mayControlDisplay:\n properties === undefined || properties.some(property => cssPropertiesOverlap(property, 'display')),\n });\n }\n return authorities;\n}\n\nfunction isSuppressed(effect: PropertyEffect, plansById: ReadonlyMap<string, SemanticCompositionPlan>): boolean {\n const plan = plansById.get(effect.planId);\n if (plan?.status !== 'converted') return true;\n return (plan.suppressedEffects ?? []).some(\n suppression =>\n suppression.important === effect.important &&\n sameActivation(suppression.activation, effect.activation) &&\n propertiesEqual(suppression.properties, effect.properties),\n );\n}\n\nfunction addSuppression(plan: ResolvedSemanticPlan, effect: PropertyEffect): ResolvedSemanticPlan {\n const suppression: SuppressedSemanticEffect = {\n activation: effect.activation,\n properties: effect.properties,\n important: effect.important,\n };\n const existing = plan.suppressedEffects ?? [];\n return existing.some(\n item =>\n item.important === suppression.important &&\n sameActivation(item.activation, suppression.activation) &&\n propertiesEqual(item.properties, suppression.properties),\n )\n ? plan\n : { ...plan, suppressedEffects: [...existing, suppression] };\n}\n\nfunction updatePlans(\n plans: readonly SemanticCompositionPlan[],\n unsafeFamilies: ReadonlySet<DirectiveFamily>,\n diagnostic: (input: LocatedFlexLayoutInput) => UnresolvedSemanticPlan,\n suppressed: readonly PropertyEffect[] = [],\n): readonly SemanticCompositionPlan[] {\n const suppressedByPlan = new Map<string, PropertyEffect[]>();\n for (const effect of suppressed) {\n const items = suppressedByPlan.get(effect.planId) ?? [];\n items.push(effect);\n suppressedByPlan.set(effect.planId, items);\n }\n return plans.map(plan => {\n if (plan.status !== 'converted') return plan;\n if (unsafeFamilies.has(plan.family)) return diagnostic(plan.input);\n return (suppressedByPlan.get(plan.input.id) ?? []).reduce(addSuppression, plan);\n });\n}\n\nfunction attributeControlsDisplay(attribute: SemanticConversionContext['attributeEvidence'][number]): boolean {\n const keys = templateAttributeKeys(attribute);\n if (attribute.binding === 'literal') return keys.has('style') && literalStyleMayControlDisplay(attribute.value);\n return [...keys].some(\n key => key === 'style' || key === 'ngstyle' || key === 'style.display' || key.startsWith('style.display.'),\n );\n}\n\nfunction plainBaseDisplay(descriptor: SourceClassTokenEvidence): boolean {\n return descriptor.activation.kind === 'base' && !descriptor.important && descriptor.display === descriptor.source;\n}\n\n/** Resolves cross-family CSS ownership while values are still target-free semantic plans. */\nexport class SemanticFamilyCompositionPlanner {\n constructor(\n private readonly catalog: BreakpointCatalog,\n private readonly evidence: SourcePropertyEvidence,\n ) {}\n\n compose(\n inputPlans: readonly SemanticCompositionPlan[],\n context: SemanticConversionContext,\n ): readonly SemanticCompositionPlan[] {\n const allEffects = inputPlans.flatMap(plan => (plan.status === 'converted' ? semanticEffects(plan) : []));\n const sources = sourceAuthorities(inputPlans, this.catalog, this.evidence);\n let plans = this.composeGeneratedProperties(inputPlans, allEffects, sources);\n plans = this.composeExtendedDisplayWithLayout(plans, allEffects, sources);\n return this.composeVisibility(plans, allEffects, sources, context);\n }\n\n private activeEffects(\n plans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n ): readonly PropertyEffect[] {\n const plansById = new Map(plans.map(plan => [plan.input.id, plan]));\n return allEffects.filter(effect => !isSuppressed(effect, plansById));\n }\n\n private composeGeneratedProperties(\n plans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n sources: readonly SourceAuthority[],\n ): readonly SemanticCompositionPlan[] {\n const candidates = this.activeEffects(plans, allEffects).filter(effect => effect.family !== 'visibility');\n const unsafe = new Set<DirectiveFamily>();\n const suppressed: PropertyEffect[] = [];\n\n for (const source of sources) {\n const current = plans.find(plan => plan.input.id === source.input.id);\n if (current?.status === 'converted') continue;\n for (const candidate of candidates) {\n if (\n mediaRangesIntersect(source.range, activationRange(candidate.activation)) &&\n (source.properties === undefined || propertySetsOverlap(source.properties, candidate.properties))\n ) {\n unsafe.add(candidate.family);\n }\n }\n }\n\n for (const candidate of candidates.filter(effect => effect.authority === 'source-class')) {\n const writers = candidates.filter(\n writer =>\n writer.authority !== 'source-class' &&\n writer.family !== candidate.family &&\n mediaRangesIntersect(activationRange(writer.activation), activationRange(candidate.activation)) &&\n propertySetsOverlap(writer.properties, candidate.properties),\n );\n if (!writers.length) continue;\n if (writers.some(writer => writer.authority === 'semantic-replacement')) {\n unsafe.add(candidate.family);\n for (const writer of writers) unsafe.add(writer.family);\n continue;\n }\n const ownerFamilies = new Set(writers.map(writer => writer.family));\n const ownershipIsProven =\n !candidate.important &&\n ownerFamilies.size === 1 &&\n candidate.properties.every(property =>\n rangesCover(\n activationRange(candidate.activation),\n writers\n .filter(writer =>\n writer.properties.some(ownerProperty => cssPropertyOwnershipCovers(ownerProperty, property)),\n )\n .map(writer => activationRange(writer.activation)),\n ),\n );\n if (ownershipIsProven && candidate.suppressible) {\n suppressed.push(candidate);\n continue;\n }\n unsafe.add(candidate.family);\n for (const writer of writers) unsafe.add(writer.family);\n }\n\n const writers = candidates.filter(candidate => candidate.authority !== 'source-class');\n for (let leftIndex = 0; leftIndex < writers.length; leftIndex += 1) {\n const left = writers[leftIndex];\n if (left === undefined) continue;\n for (const right of writers.slice(leftIndex + 1)) {\n if (\n left.family === right.family ||\n (!left.family.startsWith('extended-') && !right.family.startsWith('extended-')) ||\n !mediaRangesIntersect(activationRange(left.activation), activationRange(right.activation)) ||\n !propertySetsOverlap(left.properties, right.properties) ||\n (left.authority === 'source-inline' &&\n right.authority === 'source-inline' &&\n left.signature === right.signature)\n ) {\n continue;\n }\n unsafe.add(left.family);\n unsafe.add(right.family);\n }\n }\n\n return updatePlans(plans, unsafe, generatedOwnershipUnverified, suppressed);\n }\n\n private composeExtendedDisplayWithLayout(\n inputPlans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n sources: readonly SourceAuthority[],\n ): readonly SemanticCompositionPlan[] {\n let plans = inputPlans;\n let effects = this.activeEffects(plans, allEffects);\n const classRanges = effects\n .filter(effect => effect.family === 'extended-class' && effect.display !== undefined)\n .map(effect => activationRange(effect.activation));\n const styleRanges = effects\n .filter(effect => effect.family === 'extended-style' && effect.display !== undefined)\n .map(effect => activationRange(effect.activation));\n const importantClassRanges = effects\n .filter(effect => effect.family === 'extended-class' && effect.display !== undefined && effect.important)\n .map(effect => activationRange(effect.activation));\n const unresolvedRange = (family: SourceAuthority['family']): readonly MediaRange[] =>\n sources.flatMap(source => {\n const current = plans.find(plan => plan.input.id === source.input.id);\n return source.family === family && current?.status !== 'converted' && source.mayControlDisplay\n ? [source.range]\n : [];\n });\n const unresolvedClassRanges = unresolvedRange('extended-class');\n const unresolvedStyleRanges = unresolvedRange('extended-style');\n const affected = new Set<DirectiveFamily>();\n if (\n classRanges.some(\n target => styleRanges.some(range => mediaRangesIntersect(target, range)) && !rangesCover(target, styleRanges),\n ) ||\n importantClassRanges.some(target => styleRanges.some(range => mediaRangesIntersect(target, range)))\n ) {\n affected.add('extended-class');\n affected.add('extended-style');\n }\n if (styleRanges.some(target => unresolvedClassRanges.some(range => mediaRangesIntersect(target, range)))) {\n affected.add('extended-style');\n }\n if (classRanges.some(target => unresolvedStyleRanges.some(range => mediaRangesIntersect(target, range)))) {\n affected.add('extended-class');\n }\n const classSuppressed = effects.filter(\n effect =>\n effect.family === 'extended-class' &&\n effect.display !== undefined &&\n !effect.important &&\n rangesCover(activationRange(effect.activation), styleRanges),\n );\n plans = updatePlans(\n plans,\n affected,\n input =>\n contextUnverified(\n input,\n 'Responsive class and style display ownership cannot be proven for every overlapping activation range.',\n ),\n classSuppressed,\n );\n\n effects = this.activeEffects(plans, allEffects);\n const layoutRanges = effects\n .filter(effect => effect.family === 'layout' && effect.display?.value !== undefined && !effect.important)\n .map(effect => activationRange(effect.activation));\n const unresolvedLayout = plans.some(\n plan => directiveFamily(plan.input.directive) === 'layout' && plan.status !== 'converted',\n );\n const unresolvedExtendedDisplay = sources.some(source => {\n const current = plans.find(plan => plan.input.id === source.input.id);\n return current?.status !== 'converted' && source.mayControlDisplay;\n });\n const layoutAffected = new Set<DirectiveFamily>();\n const displaySuppressed: PropertyEffect[] = [];\n let layoutOverlapIsUnsafe = false;\n for (const effect of effects.filter(\n candidate => candidate.family === 'extended-class' || candidate.family === 'extended-style',\n )) {\n if (effect.display === undefined) continue;\n const target = activationRange(effect.activation);\n const overlaps = layoutRanges.some(range => mediaRangesIntersect(target, range));\n if (unresolvedLayout) layoutAffected.add(effect.family);\n if ((effect.properties.length !== 1 || effect.properties[0]?.toLowerCase() !== 'display') && overlaps) {\n layoutOverlapIsUnsafe = true;\n layoutAffected.add(effect.family);\n continue;\n }\n if ((effect.family === 'extended-style' || effect.important) && overlaps) {\n layoutOverlapIsUnsafe = true;\n layoutAffected.add(effect.family);\n continue;\n }\n if (rangesCover(target, layoutRanges)) {\n displaySuppressed.push(effect);\n } else if (overlaps) {\n layoutOverlapIsUnsafe = true;\n layoutAffected.add(effect.family);\n }\n }\n if (unresolvedExtendedDisplay || layoutOverlapIsUnsafe) layoutAffected.add('layout');\n return updatePlans(\n plans,\n layoutAffected,\n input =>\n input.directive === 'fxLayout'\n ? contextUnverified(\n input,\n 'An unresolved or partially overlapping responsive class/style family may control display.',\n )\n : contextUnverified(\n input,\n 'The responsive layout and extended display ranges do not have one provable ownership order.',\n ),\n displaySuppressed,\n );\n }\n\n private composeVisibility(\n inputPlans: readonly SemanticCompositionPlan[],\n allEffects: readonly PropertyEffect[],\n sources: readonly SourceAuthority[],\n context: SemanticConversionContext,\n ): readonly SemanticCompositionPlan[] {\n let plans = inputPlans;\n const visibilityPlans = plans.filter(plan => directiveFamily(plan.input.directive) === 'visibility');\n if (!visibilityPlans.length) return plans;\n const visibilityResolved = visibilityPlans.every(plan => plan.status === 'converted');\n let effects = this.activeEffects(plans, allEffects);\n const extendedDisplayFamilies = new Set(\n effects\n .filter(\n effect =>\n (effect.family === 'extended-class' || effect.family === 'extended-style') && effect.display !== undefined,\n )\n .map(effect => effect.family),\n );\n if (!visibilityResolved) {\n return updatePlans(plans, extendedDisplayFamilies, input =>\n contextUnverified(input, 'The visibility family is unresolved and may override display.'),\n );\n }\n\n const visibility = (visibilityPlans[0] as ResolvedSemanticPlan).value as VisibilitySemantics;\n const states = visibility.states;\n const baseIsHidden = states.some(state => state.activation.kind === 'base' && state.intent === 'hidden');\n const hiddenRanges = states.flatMap(state =>\n state.intent === 'hidden' && state.activation.kind === 'media' ? [state.activation.definition.range] : [],\n );\n const shownRanges = states\n .filter(state => state.intent === 'shown')\n .map(state => activationRange(state.activation));\n const visibilityRanges = states.map(state => activationRange(state.activation));\n const unsafe = new Set<DirectiveFamily>();\n const suppressed: PropertyEffect[] = [];\n const visibilityOwnsHiddenRange = (target: MediaRange): boolean =>\n baseIsHidden\n ? !states.some(\n state =>\n state.intent === 'shown' &&\n state.activation.kind === 'media' &&\n mediaRangesIntersect(target, state.activation.definition.range),\n )\n : rangesCover(target, hiddenRanges);\n\n for (const effect of effects.filter(\n candidate => candidate.family === 'extended-class' || candidate.family === 'extended-style',\n )) {\n if (effect.display === undefined) continue;\n const target = activationRange(effect.activation);\n if (effect.retained && visibilityRanges.some(range => mediaRangesIntersect(target, range))) {\n unsafe.add(effect.family);\n continue;\n }\n const overlapsVisibility = visibilityRanges.some(range => mediaRangesIntersect(target, range));\n if (effect.family === 'extended-style' && overlapsVisibility) {\n unsafe.add(effect.family);\n continue;\n }\n if (effect.properties.length !== 1 || effect.properties[0]?.toLowerCase() !== 'display') {\n if (overlapsVisibility) unsafe.add(effect.family);\n continue;\n }\n if (effect.important && overlapsVisibility) {\n unsafe.add(effect.family);\n continue;\n }\n if (visibilityOwnsHiddenRange(target)) {\n suppressed.push(effect);\n continue;\n }\n const partiallyHidden =\n !baseIsHidden &&\n hiddenRanges.some(range => mediaRangesIntersect(target, range)) &&\n !rangesCover(target, hiddenRanges);\n const shownOverridesHidden =\n effect.display.intent !== 'shown' && shownRanges.some(range => mediaRangesIntersect(target, range));\n if (partiallyHidden || shownOverridesHidden) unsafe.add(effect.family);\n }\n if (unsafe.size > 0) unsafe.add('visibility');\n plans = updatePlans(\n plans,\n unsafe,\n input =>\n contextUnverified(\n input,\n 'The responsive class/style display range and visibility range only partially agree on ownership.',\n ),\n suppressed,\n );\n if (unsafe.size > 0) return plans;\n\n effects = this.activeEffects(plans, allEffects);\n const existingDisplays = context.existingClassNames\n .map(className => this.evidence.classifyClassToken(className))\n .flatMap(item => (item.status === 'verified' && item.evidence.display !== undefined ? [item.evidence] : []));\n const responsiveStyleIsUnresolved = sources.some(source => {\n const current = plans.find(plan => plan.input.id === source.input.id);\n return source.family === 'extended-style' && current?.status !== 'converted' && source.mayControlDisplay;\n });\n const hasEffectiveShownRange = !baseIsHidden || states.some(state => state.intent === 'shown');\n let displayReason =\n responsiveStyleIsUnresolved || context.attributeEvidence.some(attributeControlsDisplay)\n ? 'A literal or bound style may control the element display value.'\n : existingDisplays.some(item => item.display === 'hidden') && hasEffectiveShownRange\n ? 'The visible display value cannot be proven from one unambiguous source.'\n : undefined;\n\n const relevantExtended = effects.filter(\n effect =>\n (effect.family === 'extended-class' || effect.family === 'extended-style') &&\n effect.display !== undefined &&\n (effect.family === 'extended-style' ||\n effect.important ||\n !visibilityOwnsHiddenRange(activationRange(effect.activation))),\n );\n const effectiveShownRanges = states.some(state => state.activation.kind === 'base')\n ? shownRanges\n : [{}, ...shownRanges];\n if (\n displayReason === undefined &&\n relevantExtended.some(\n effect =>\n effect.display?.intent !== 'shown' &&\n effectiveShownRanges.some(range => mediaRangesIntersect(activationRange(effect.activation), range)),\n )\n ) {\n displayReason = 'A responsive class/style hidden utility overlaps a visibility state that must be shown.';\n }\n if (\n displayReason === undefined &&\n relevantExtended.some(effect =>\n effectiveShownRanges.some(range => mediaRangesIntersect(activationRange(effect.activation), range)),\n )\n ) {\n displayReason =\n 'Flex-Layout captures the original display during initialization, before responsive ownership is stable.';\n }\n if (displayReason !== undefined) {\n const visibilityIds = new Set(visibilityPlans.map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && visibilityIds.has(plan.input.id)\n ? displayRestorationUnverified(plan.input, displayReason)\n : plan,\n );\n }\n\n const layoutPlans = plans.filter(\n (plan): plan is ResolvedSemanticPlan => plan.status === 'converted' && plan.family === 'layout',\n );\n const layoutDisplays = layoutPlans.flatMap(plan => {\n const layout = plan.value as LayoutSemantics;\n return plan.activations.map(activation => ({ activation, display: layout.display }));\n });\n const existingRestoration = (() => {\n const descriptor = existingDisplays.length === 1 ? existingDisplays[0] : undefined;\n return descriptor !== undefined &&\n plainBaseDisplay(descriptor) &&\n descriptor.display !== undefined &&\n restorationDisplays.has(descriptor.display)\n ? descriptor.display\n : undefined;\n })();\n const shownOverrides = baseIsHidden\n ? states.filter(state => state.activation.kind === 'media' && state.intent === 'shown')\n : [];\n let restorationDisplay: string | undefined;\n if (shownOverrides.length > 0) {\n const utilities = shownOverrides.map(state => {\n const stateRange = activationRange(state.activation);\n const overlapping = layoutDisplays.some(\n display =>\n display.activation.kind === 'media' &&\n !sameActivation(display.activation, state.activation) &&\n mediaRangesIntersect(display.activation.definition.range, stateRange),\n );\n if (overlapping) return null;\n const exact = layoutDisplays.filter(display => sameActivation(display.activation, state.activation));\n const applicable =\n exact.length > 0 ? exact : layoutDisplays.filter(display => display.activation.kind === 'base');\n const displays = [...new Set(applicable.map(display => display.display))];\n return displays.length === 0 ? existingRestoration : displays.length === 1 ? displays[0] : null;\n });\n const distinct = [...new Set(utilities)];\n if (distinct.length !== 1 || typeof distinct[0] !== 'string') {\n const visibilityIds = new Set(visibilityPlans.map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && visibilityIds.has(plan.input.id)\n ? displayRestorationUnverified(\n plan.input,\n 'The visible display value cannot be proven from one unambiguous source.',\n )\n : plan,\n );\n }\n restorationDisplay = distinct[0];\n }\n\n const unsafePartial =\n !baseIsHidden &&\n layoutDisplays.some(display => {\n if (display.activation.kind !== 'media') return false;\n const range = display.activation.definition.range;\n return hiddenRanges.some(hidden => mediaRangesIntersect(range, hidden)) && !rangesCover(range, hiddenRanges);\n });\n if (unsafePartial) {\n const ids = new Set([...visibilityPlans, ...layoutPlans].map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && ids.has(plan.input.id) ? partialDisplayContextUnverified(plan.input) : plan,\n );\n }\n\n const layoutSuppressions = effects.filter(effect => {\n if (effect.family !== 'layout' || effect.display === undefined) return false;\n const target = activationRange(effect.activation);\n return baseIsHidden\n ? !states.some(\n state =>\n state.intent === 'shown' &&\n state.activation.kind === 'media' &&\n mediaRangesIntersect(target, state.activation.definition.range),\n )\n : rangesCover(target, hiddenRanges);\n });\n const visibilityIds = new Set(visibilityPlans.map(plan => plan.input.id));\n plans = plans.map(plan => {\n if (plan.status !== 'converted') return plan;\n if (visibilityIds.has(plan.input.id)) {\n return {\n ...plan,\n value: {\n ...(plan.value as VisibilitySemantics),\n ...(restorationDisplay === undefined ? {} : { restorationDisplay }),\n },\n };\n }\n return layoutSuppressions.filter(effect => effect.planId === plan.input.id).reduce(addSuppression, plan);\n });\n return plans;\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport {\n BreakpointCatalog,\n mediaDefinitionsIntersect,\n mediaRangesIntersect,\n type MediaRange,\n} from '../breakpoint/breakpoint-catalog';\nimport type { SemanticConversionContext } from './conversion-context';\nimport { directiveFamily, type DirectiveFamily } from './semantic-plan';\n\nexport type { DirectiveFamily } from './semantic-plan';\n\nexport interface ResponsiveOrchestrationPlan {\n readonly status: 'converted' | 'review' | 'unsupported' | 'invalid';\n readonly input: LocatedFlexLayoutInput;\n}\n\nexport type ResponsivePlanOne<TPlan extends ResponsiveOrchestrationPlan> = (\n input: LocatedFlexLayoutInput,\n context: SemanticConversionContext,\n) => TPlan;\n\nexport type ResponsivePlanExtendedFamily<TPlan extends ResponsiveOrchestrationPlan> = (\n family: 'extended-class' | 'extended-style',\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n) => readonly TPlan[];\n\nexport interface SemanticTargetPolicy<TPlan extends ResponsiveOrchestrationPlan> {\n emptyPlan(input: LocatedFlexLayoutInput): TPlan;\n targetEligibility(input: LocatedFlexLayoutInput): TPlan | undefined;\n validateActivation(plan: TPlan): TPlan;\n isTargetEligibilityFailure(plan: TPlan): boolean;\n sameOutput(left: TPlan, right: TPlan): boolean;\n contextUnverified(input: LocatedFlexLayoutInput, reason: string): TPlan;\n contextualOutputUnverified(input: LocatedFlexLayoutInput): TPlan;\n responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): TPlan;\n decorate(plan: TPlan): TPlan;\n addPrintFallback(plan: TPlan): TPlan;\n}\n\nconst localLayoutDependents = new Set<DirectiveFamily>(['layout-gap', 'layout-align']);\nconst parentLayoutDependents = new Set<DirectiveFamily>(['flex-item', 'flex-offset']);\n\ninterface NumericRange {\n readonly min: number;\n readonly max: number;\n}\n\nfunction numericRange(range: MediaRange): NumericRange {\n return {\n min: range.min ?? Number.NEGATIVE_INFINITY,\n max: range.max ?? Number.POSITIVE_INFINITY,\n };\n}\n\nfunction mediaRange(range: NumericRange): MediaRange {\n return {\n min: range.min === Number.NEGATIVE_INFINITY ? undefined : range.min,\n max: range.max === Number.POSITIVE_INFINITY ? undefined : range.max,\n };\n}\n\nfunction nextBelow(value: number): number {\n return value - Math.max(1, Math.abs(value)) * Number.EPSILON;\n}\n\nfunction nextAbove(value: number): number {\n return value + Math.max(1, Math.abs(value)) * Number.EPSILON;\n}\n\nfunction subtractRange(source: NumericRange, excluded: NumericRange): readonly NumericRange[] {\n if (source.max < excluded.min || excluded.max < source.min) return [source];\n const remaining: NumericRange[] = [];\n if (source.min < excluded.min) remaining.push({ min: source.min, max: nextBelow(excluded.min) });\n if (excluded.max < source.max) remaining.push({ min: nextAbove(excluded.max), max: source.max });\n return remaining;\n}\n\nfunction effectiveRanges(\n input: LocatedFlexLayoutInput,\n familyInputs: readonly LocatedFlexLayoutInput[],\n catalog: BreakpointCatalog,\n): readonly NumericRange[] {\n if (input.breakpoint) {\n const classification = catalog.classify(input.breakpoint);\n return classification.kind === 'verified' ? [numericRange(classification.definition.range)] : [];\n }\n\n let ranges: readonly NumericRange[] = [{ min: Number.NEGATIVE_INFINITY, max: Number.POSITIVE_INFINITY }];\n for (const sibling of familyInputs) {\n if (!sibling.breakpoint || sibling.binding !== 'literal') continue;\n const classification = catalog.classify(sibling.breakpoint);\n if (classification.kind !== 'verified') continue;\n const excluded = numericRange(classification.definition.range);\n ranges = ranges.flatMap(range => subtractRange(range, excluded));\n }\n return ranges;\n}\n\nfunction rangesCover(target: NumericRange, ranges: readonly NumericRange[]): boolean {\n const clipped = ranges\n .map(range => ({ min: Math.max(target.min, range.min), max: Math.min(target.max, range.max) }))\n .filter(range => range.min <= range.max)\n .sort((left, right) => left.min - right.min);\n if (!clipped.length || clipped[0]?.min !== target.min) return false;\n\n let coveredUntil = clipped[0].max;\n for (const range of clipped.slice(1)) {\n if (range.min > coveredUntil) return false;\n coveredUntil = Math.max(coveredUntil, range.max);\n }\n return coveredUntil >= target.max;\n}\n\nexport class ResponsiveFamilyPlanner<TPlan extends ResponsiveOrchestrationPlan> {\n constructor(\n private readonly catalog: BreakpointCatalog,\n private readonly policy: SemanticTargetPolicy<TPlan>,\n ) {}\n\n plan(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n planExtendedFamily?: ResponsivePlanExtendedFamily<TPlan>,\n ): readonly TPlan[] {\n return this.planWithDependencies(inputs, context, planOne, true, true, planExtendedFamily);\n }\n\n closeDependencies(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n ): readonly TPlan[] {\n return this.planWithDependencies(inputs, context, planOne, false, false);\n }\n\n private planWithDependencies(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n decorate: boolean,\n validateResponsivePrecedence: boolean,\n planExtendedFamily?: ResponsivePlanExtendedFamily<TPlan>,\n ): readonly TPlan[] {\n const groups = new Map<DirectiveFamily, LocatedFlexLayoutInput[]>();\n const ungrouped: LocatedFlexLayoutInput[] = [];\n for (const input of inputs) {\n const family = directiveFamily(input.directive);\n if (!family) {\n ungrouped.push(input);\n continue;\n }\n const members = groups.get(family) ?? [];\n members.push(input);\n groups.set(family, members);\n }\n\n const completeContext: SemanticConversionContext = { ...context, inputs };\n const rawPlansByFamily = new Map<DirectiveFamily, readonly TPlan[]>();\n const layoutInputs = groups.get('layout') ?? [];\n const layoutPlans = this.planFamily(layoutInputs, completeContext, planOne, validateResponsivePrecedence);\n if (layoutInputs.length) rawPlansByFamily.set('layout', layoutPlans);\n\n const parentLayoutInputs = context.parentInputs.filter(input => input.directive === 'fxLayout');\n const parentLayoutSafe = this.isLayoutContextSafe(\n context.parentInputs,\n {\n ...context,\n element: context.parent ?? context.element,\n inputs: context.parentInputs,\n parent: undefined,\n parentInputs: [],\n },\n planOne,\n validateResponsivePrecedence,\n );\n const localLayoutSafe = layoutPlans.every(plan => plan.status === 'converted');\n\n for (const [family, familyInputs] of groups) {\n if (family === 'layout') continue;\n\n let plans: readonly TPlan[];\n if ((family === 'extended-class' || family === 'extended-style') && planExtendedFamily) {\n plans = planExtendedFamily(family, familyInputs, completeContext);\n } else if (localLayoutDependents.has(family)) {\n plans = localLayoutSafe\n ? this.planContextualFamily(\n familyInputs,\n completeContext,\n layoutInputs,\n 'activeLayout',\n planOne,\n validateResponsivePrecedence,\n )\n : this.planBlockedContextFamily(\n familyInputs,\n completeContext,\n planOne,\n 'The responsive layout family contains an unresolved member.',\n !validateResponsivePrecedence,\n );\n } else if (parentLayoutDependents.has(family)) {\n plans = parentLayoutSafe\n ? this.planContextualFamily(\n familyInputs,\n completeContext,\n parentLayoutInputs,\n 'activeParentLayout',\n planOne,\n validateResponsivePrecedence,\n )\n : this.planBlockedContextFamily(\n familyInputs,\n completeContext,\n planOne,\n 'The responsive parent layout family contains an unresolved member.',\n !validateResponsivePrecedence,\n );\n } else {\n plans = this.planFamily(familyInputs, completeContext, planOne, validateResponsivePrecedence);\n }\n rawPlansByFamily.set(family, plans);\n }\n\n const localFamilies = ['layout', 'layout-gap', 'layout-align'] as const;\n const localContextUnresolved = localFamilies.some(family =>\n rawPlansByFamily.get(family)?.some(plan => plan.status !== 'converted'),\n );\n if (localContextUnresolved) {\n for (const family of localFamilies) {\n const plans = rawPlansByFamily.get(family);\n if (!plans) continue;\n rawPlansByFamily.set(\n family,\n plans.map(plan =>\n plan.status === 'converted'\n ? this.policy.contextUnverified(\n plan.input,\n 'The element layout context contains an unresolved dependent directive family.',\n )\n : plan,\n ),\n );\n }\n }\n\n const plansById = new Map<string, TPlan>();\n for (const [family, plans] of rawPlansByFamily) {\n const shouldDecorate = decorate && family !== 'extended-class' && family !== 'extended-style';\n const decoratedPlans = plans.map(plan => (shouldDecorate ? this.policy.decorate(plan) : plan));\n const printAwarePlans = decorate\n ? this.addPrintFallback(groups.get(family) ?? [], decoratedPlans)\n : decoratedPlans;\n for (const plan of printAwarePlans) plansById.set(plan.input.id, plan);\n }\n for (const input of ungrouped) {\n const plan = this.planOneWithEligibility(input, completeContext, planOne);\n plansById.set(input.id, decorate ? this.policy.decorate(plan) : plan);\n }\n return inputs.map(input => {\n const planned = plansById.get(input.id);\n if (planned) return planned;\n const plan = this.planOneWithEligibility(input, completeContext, planOne);\n return decorate ? this.policy.decorate(plan) : plan;\n });\n }\n\n private addPrintFallback(inputs: readonly LocatedFlexLayoutInput[], plans: readonly TPlan[]): readonly TPlan[] {\n const configuredAliases = this.catalog.printWithBreakpoints;\n if (configuredAliases === undefined || plans.some(plan => plan.status !== 'converted')) return plans;\n if (inputs.some(input => input.breakpoint === 'print')) return plans;\n\n const configured = inputs\n .map((input, index) => ({\n input,\n index,\n classification: input.breakpoint === undefined ? undefined : this.catalog.classify(input.breakpoint),\n }))\n .filter(\n (\n item,\n ): item is typeof item & {\n readonly classification: Extract<ReturnType<BreakpointCatalog['classify']>, { readonly kind: 'verified' }>;\n } =>\n item.input.breakpoint !== undefined &&\n configuredAliases.includes(item.input.breakpoint) &&\n item.classification !== undefined &&\n item.classification.kind === 'verified',\n )\n .sort(\n (left, right) =>\n right.classification.definition.priority - left.classification.definition.priority ||\n configuredAliases.indexOf(left.input.breakpoint ?? '') -\n configuredAliases.indexOf(right.input.breakpoint ?? ''),\n );\n const selected = configured[0];\n if (!selected) return plans;\n\n return plans.map((plan, index) =>\n index === selected.index && plan.status === 'converted' ? this.policy.addPrintFallback(plan) : plan,\n );\n }\n\n private planContextualFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n layoutInputs: readonly LocatedFlexLayoutInput[],\n contextKey: 'activeLayout' | 'activeParentLayout',\n planOne: ResponsivePlanOne<TPlan>,\n validateResponsivePrecedence: boolean,\n ): readonly TPlan[] {\n const semanticPlans = inputs.map(input => {\n const breakpointPlan = this.planBreakpoint(input, context, planOne);\n if (breakpointPlan.status !== 'converted') return breakpointPlan;\n const explicitLayout = context[contextKey];\n const layoutValues =\n layoutInputs.length === 0 && explicitLayout !== undefined\n ? [explicitLayout]\n : this.layoutValuesFor(input, inputs, layoutInputs);\n if (!layoutValues.length) {\n return this.policy.contextUnverified(input, 'The active responsive layout cannot be resolved for this input.');\n }\n const candidates = layoutValues.map(value => planOne(input, { ...context, [contextKey]: value }));\n const unresolved = candidates.find(candidate => candidate.status !== 'converted');\n if (unresolved) return unresolved;\n const first = candidates[0];\n if (!first || candidates.some(candidate => !this.policy.sameOutput(first, candidate))) {\n return this.policy.contextualOutputUnverified(input);\n }\n return first;\n });\n return this.validateFamily(inputs, semanticPlans, validateResponsivePrecedence);\n }\n\n private isLayoutContextSafe(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n validateResponsivePrecedence: boolean,\n ): boolean {\n const layoutInputs = inputs.filter(input => input.directive === 'fxLayout');\n if (\n this.planFamily(layoutInputs, context, planOne, validateResponsivePrecedence).some(\n plan => plan.status !== 'converted',\n )\n ) {\n return false;\n }\n\n return (['fxLayoutGap', 'fxLayoutAlign'] as const).every(directive => {\n const familyInputs = inputs.filter(input => input.directive === directive);\n return this.planContextualFamily(\n familyInputs,\n context,\n layoutInputs,\n 'activeLayout',\n planOne,\n validateResponsivePrecedence,\n ).every(plan => plan.status === 'converted');\n });\n }\n\n private planBlockedContextFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n reason: string,\n preserveExistingDiagnostics = false,\n ): readonly TPlan[] {\n return inputs.map(input => {\n const breakpointPlan = this.planBreakpoint(input, context, planOne);\n if (breakpointPlan.status !== 'converted') return breakpointPlan;\n const existingPlan = preserveExistingDiagnostics\n ? this.planOneWithEligibility(input, context, planOne)\n : breakpointPlan;\n return existingPlan.status === 'converted' ? this.policy.contextUnverified(input, reason) : existingPlan;\n });\n }\n\n private planBreakpoint(\n input: LocatedFlexLayoutInput,\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n ): TPlan {\n const eligibility = this.policy.targetEligibility(input);\n if (eligibility) return eligibility;\n return input.binding === 'literal'\n ? this.policy.validateActivation(this.policy.emptyPlan(input))\n : planOne(input, context);\n }\n\n private layoutValuesFor(\n input: LocatedFlexLayoutInput,\n familyInputs: readonly LocatedFlexLayoutInput[],\n layoutInputs: readonly LocatedFlexLayoutInput[],\n ): readonly string[] {\n const baseLayouts = layoutInputs.filter(layout => !layout.breakpoint);\n const responsiveLayouts = layoutInputs.flatMap(layout => {\n if (!layout.breakpoint) return [];\n const classification = this.catalog.classify(layout.breakpoint);\n return classification.kind === 'verified'\n ? [{ value: layout.value, range: numericRange(classification.definition.range) }]\n : [];\n });\n const values = new Set<string>();\n\n for (const target of effectiveRanges(input, familyInputs, this.catalog)) {\n const activeResponsive = responsiveLayouts.filter(layout =>\n mediaRangesIntersect(mediaRange(target), mediaRange(layout.range)),\n );\n for (const layout of activeResponsive) values.add(layout.value);\n if (\n !rangesCover(\n target,\n activeResponsive.map(layout => layout.range),\n )\n ) {\n if (baseLayouts.length) {\n for (const layout of baseLayouts) values.add(layout.value);\n } else {\n values.add('row');\n }\n }\n }\n return [...values];\n }\n\n private planFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n validateResponsivePrecedence: boolean,\n ): readonly TPlan[] {\n return this.validateFamily(\n inputs,\n inputs.map(input => this.planOneWithEligibility(input, context, planOne)),\n validateResponsivePrecedence,\n );\n }\n\n private validateFamily(\n inputs: readonly LocatedFlexLayoutInput[],\n semanticPlans: readonly TPlan[],\n validateResponsivePrecedence: boolean,\n ): readonly TPlan[] {\n if (inputs.some(input => input.binding !== 'literal')) {\n return inputs.map((input, index) => {\n const semanticPlan =\n semanticPlans[index] ??\n this.policy.contextUnverified(input, 'The dynamic member of this directive family cannot be planned.');\n if (input.binding !== 'literal') return semanticPlan;\n const breakpointPlan = this.policy.validateActivation(semanticPlan);\n if (this.policy.isTargetEligibilityFailure(breakpointPlan)) return breakpointPlan;\n return this.policy.contextUnverified(input, 'Another member of this responsive directive family is dynamic.');\n });\n }\n\n const supportedPlans = semanticPlans.map(plan => this.policy.validateActivation(plan));\n if (supportedPlans.some(plan => plan.status !== 'converted')) {\n return supportedPlans.map(plan =>\n plan.status === 'converted'\n ? this.policy.contextUnverified(\n plan.input,\n 'Another member of this responsive directive family is unresolved.',\n )\n : plan,\n );\n }\n if (!validateResponsivePrecedence) return supportedPlans;\n\n for (let leftIndex = 0; leftIndex < inputs.length; leftIndex += 1) {\n const leftInput = inputs[leftIndex];\n const leftPlan = supportedPlans[leftIndex];\n if (!leftInput?.breakpoint || !leftPlan) continue;\n const leftClassification = this.catalog.classify(leftInput.breakpoint);\n if (leftClassification.kind !== 'verified') continue;\n\n for (let rightIndex = leftIndex + 1; rightIndex < inputs.length; rightIndex += 1) {\n const rightInput = inputs[rightIndex];\n const rightPlan = supportedPlans[rightIndex];\n if (!rightInput?.breakpoint || !rightPlan) continue;\n const rightClassification = this.catalog.classify(rightInput.breakpoint);\n if (\n rightClassification.kind === 'verified' &&\n mediaDefinitionsIntersect(leftClassification.definition.media, rightClassification.definition.media) &&\n !this.policy.sameOutput(leftPlan, rightPlan)\n ) {\n return inputs.map(input => this.policy.responsivePrecedenceUnverified(input));\n }\n }\n }\n return supportedPlans;\n }\n\n private planOneWithEligibility(\n input: LocatedFlexLayoutInput,\n context: SemanticConversionContext,\n planOne: ResponsivePlanOne<TPlan>,\n ): TPlan {\n return this.policy.targetEligibility(input) ?? planOne(input, context);\n }\n}\n","import type { MediaRange } from '../breakpoint/breakpoint-catalog';\n\nexport interface SourceStyleDeclaration {\n readonly property: string;\n readonly value: string;\n}\n\nexport type SourceTokenActivation =\n | { readonly kind: 'base' }\n | { readonly kind: 'media'; readonly range: MediaRange; readonly mediaType?: 'screen' | 'print' };\n\n/** Target-neutral property evidence derived from one literal source class token. */\nexport interface SourceClassTokenEvidence {\n readonly source: string;\n readonly properties: readonly string[];\n readonly important: boolean;\n readonly activation: SourceTokenActivation;\n readonly display?: string;\n}\n\nexport type SourceClassTokenClassification =\n | { readonly status: 'verified'; readonly evidence: SourceClassTokenEvidence }\n | { readonly status: 'unverified'; readonly reason: string };\n\nexport type SourceStyleDeclarationClassification =\n { readonly status: 'verified' } | { readonly status: 'unverified'; readonly priorityText: boolean };\n\n/**\n * Supplies semantic planning with property/category facts without exposing any\n * target candidate representation or emitter.\n */\nexport interface SourcePropertyEvidence {\n classifyClassToken(token: string): SourceClassTokenClassification;\n classifyStyleDeclaration(declaration: SourceStyleDeclaration): SourceStyleDeclarationClassification;\n}\n\nexport const unknownSourcePropertyEvidence: SourcePropertyEvidence = Object.freeze({\n classifyClassToken: (_token: string): SourceClassTokenClassification => ({\n status: 'unverified',\n reason: 'No source class property evidence is available for this conversion target.',\n }),\n classifyStyleDeclaration: (_declaration: SourceStyleDeclaration): SourceStyleDeclarationClassification => ({\n status: 'unverified',\n priorityText: false,\n }),\n});\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport type { VisibilityIntent } from './visibility.model';\n\nconst invariantMessage = 'Visibility value parser requires a literal fxShow or fxHide input.';\n\nexport function parseVisibilityValue(input: LocatedFlexLayoutInput): VisibilityIntent {\n if (input.binding !== 'literal' || (input.directive !== 'fxShow' && input.directive !== 'fxHide')) {\n throw new Error(invariantMessage);\n }\n\n const shown = input.value !== 'false';\n return input.directive === 'fxHide' ? (shown ? 'hidden' : 'shown') : shown ? 'shown' : 'hidden';\n}\n","import type { LocatedFlexLayoutInput } from '../../analyzer/flex-layout-attribute.analyzer';\nimport {\n BreakpointCatalog,\n mediaDefinitionsIntersect,\n type BreakpointClassification,\n} from '../../breakpoint/breakpoint-catalog';\nimport type { UnresolvedSemanticPlan } from '../semantic-plan';\nimport type { VisibilityState } from './visibility.model';\nimport { parseVisibilityValue } from './visibility-value.parser';\n\nexport type VisibilityFamilyPlan =\n | { readonly status: 'converted'; readonly states: readonly VisibilityState[] }\n | { readonly status: 'unresolved'; readonly plans: readonly UnresolvedSemanticPlan[] };\n\ntype ClassifiedMember =\n | { readonly input: LocatedFlexLayoutInput; readonly state: VisibilityState }\n | { readonly input: LocatedFlexLayoutInput; readonly plan: UnresolvedSemanticPlan };\n\ntype ClassifiedState = Extract<ClassifiedMember, { readonly state: VisibilityState }>;\n\nfunction dynamicBinding(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'dynamic-binding',\n reason: 'Angular property bindings may depend on runtime state.',\n suggestion: 'Replace the binding manually or make it a literal before migration.',\n };\n}\n\nfunction unresolvedBreakpoint(\n input: LocatedFlexLayoutInput,\n classification: Exclude<BreakpointClassification, { readonly kind: 'verified' }>,\n): UnresolvedSemanticPlan {\n if (classification.kind === 'custom') {\n return {\n status: 'review',\n input,\n code: 'custom-breakpoint',\n reason: `The breakpoint alias ${classification.alias} may be registered by the project.`,\n suggestion: 'Provide its media query or migrate this responsive input manually.',\n };\n }\n\n const kind = classification.kind === 'print' ? 'print' : 'optional';\n return {\n status: 'review',\n input,\n code: 'breakpoint-unverified',\n reason: `The ${kind} breakpoint alias ${classification.alias} is not enabled by explicit migration configuration.`,\n suggestion:\n classification.kind === 'print'\n ? 'Verify the source printWithBreakpoints value, then rerun with --print-with-breakpoints.'\n : 'Verify that the source enables orientation breakpoints, then rerun with --orientation-breakpoints.',\n };\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Another member of this visibility family is unresolved.',\n suggestion: 'Migrate the complete visibility family together manually.',\n };\n}\n\nfunction responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'responsive-precedence-unverified',\n reason: 'The visibility family contains conflicting base or overlapping responsive states.',\n suggestion: 'Simplify the conflicting declarations or migrate this visibility family manually.',\n };\n}\n\nfunction compareText(left: string, right: string): number {\n if (left < right) return -1;\n if (left > right) return 1;\n return 0;\n}\n\nexport class VisibilityStatePlanner {\n constructor(private readonly catalog = new BreakpointCatalog()) {}\n\n plan(inputs: readonly LocatedFlexLayoutInput[]): VisibilityFamilyPlan {\n const members = inputs\n .map(input => this.classify(input))\n .sort((left, right) => this.compare(left.input, right.input));\n\n if (!members.every((member): member is ClassifiedState => 'state' in member)) {\n return {\n status: 'unresolved',\n plans: members.map(member => ('plan' in member ? member.plan : contextUnverified(member.input))),\n };\n }\n\n const states = members.map(member => member.state);\n if (this.hasConflictingStates(states)) {\n return {\n status: 'unresolved',\n plans: states.map(state => responsivePrecedenceUnverified(state.input)),\n };\n }\n\n return { status: 'converted', states };\n }\n\n private classify(input: LocatedFlexLayoutInput): ClassifiedMember {\n if (input.binding !== 'literal') return { input, plan: dynamicBinding(input) };\n\n if (input.breakpoint === undefined) {\n return {\n input,\n state: { input, intent: parseVisibilityValue(input), activation: { kind: 'base' } },\n };\n }\n\n const classification = this.catalog.classify(input.breakpoint);\n if (classification.kind !== 'verified') {\n return { input, plan: unresolvedBreakpoint(input, classification) };\n }\n\n return {\n input,\n state: {\n input,\n intent: parseVisibilityValue(input),\n activation: { kind: 'media', definition: classification.definition },\n },\n };\n }\n\n private hasConflictingStates(states: readonly VisibilityState[]): boolean {\n const baseStates = states.filter(state => state.activation.kind === 'base');\n if (baseStates.some(state => state.intent !== baseStates[0]?.intent)) return true;\n\n const responsiveStates = states.filter(\n (state): state is VisibilityState & { readonly activation: { readonly kind: 'media' } } =>\n state.activation.kind === 'media',\n );\n return responsiveStates.some((left, leftIndex) =>\n responsiveStates\n .slice(leftIndex + 1)\n .some(\n right =>\n left.intent !== right.intent &&\n mediaDefinitionsIntersect(left.activation.definition.media, right.activation.definition.media),\n ),\n );\n }\n\n private compare(left: LocatedFlexLayoutInput, right: LocatedFlexLayoutInput): number {\n const leftIsBase = left.breakpoint === undefined;\n const rightIsBase = right.breakpoint === undefined;\n if (leftIsBase && !rightIsBase) return -1;\n if (!leftIsBase && rightIsBase) return 1;\n\n const leftPriority = this.breakpointPriority(left.breakpoint);\n const rightPriority = this.breakpointPriority(right.breakpoint);\n if (leftPriority !== rightPriority) return rightPriority - leftPriority;\n\n const aliasOrder = compareText(left.breakpoint ?? '', right.breakpoint ?? '');\n return aliasOrder || compareText(left.id, right.id);\n }\n\n private breakpointPriority(alias: string | undefined): number {\n if (alias === undefined) return Number.POSITIVE_INFINITY;\n const classification = this.catalog.classify(alias);\n return classification.kind === 'verified' ? classification.definition.priority : Number.NEGATIVE_INFINITY;\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { BreakpointCatalog, type BreakpointClassification } from '../breakpoint/breakpoint-catalog';\nimport type { BreakpointMigrationConfig } from '../config/breakpoint-migration-config';\nimport { planFlexAlignSemantics } from '../flex/flex-align.semantic';\nimport { planFlexFillSemantics } from '../flex/flex-fill.semantic';\nimport { planFlexItemSemantics, type FlexItemSemantics } from '../flex/flex-item.semantic';\nimport { planFlexOffsetSemantics } from '../flex/flex-offset.semantic';\nimport { planFlexOrderSemantics } from '../flex/flex-order.semantic';\nimport type { SemanticResult } from '../flex/flex-semantic.model';\nimport { planLayoutAlignment } from '../flex/layout-align.semantic';\nimport { planLayoutGapSemantics } from '../flex/layout-gap.semantic';\nimport { parseLayout } from '../flex/layout.semantic';\nimport { parseGridValue } from '../grid/grid-value.parser';\nimport { templateAttributeKeys } from '../template/template-attribute';\nimport type { TemplateAttribute } from '../template/template.model';\nimport type { SemanticConversionContext } from './conversion-context';\nimport { cssPropertiesOverlap } from './css-property-ownership';\nimport { ExtendedFamilyPlanner } from './extended/extended-family.planner';\nimport { ExtendedSemanticPlanner } from './extended/extended-semantic.planner';\nimport { parseResponsiveClassValue, type SemanticResponsiveClassValue } from './extended/responsive-class-value.parser';\nimport type { ResponsiveStyleValue } from './extended/responsive-style.model';\nimport { parseResponsiveStyleValue } from './extended/responsive-style-value.parser';\nimport { SemanticFamilyCompositionPlanner } from './semantic-family-composition.planner';\nimport { parseLiteralStyleDeclarations } from './literal-style-declaration';\nimport { ResponsiveFamilyPlanner, type SemanticTargetPolicy } from './responsive-family.planner';\nimport {\n directiveFamily,\n type DirectiveFamily,\n type ResolvedSemanticPlan,\n type ResolvedSemanticValue,\n type SemanticDependencyPlan,\n type SemanticPlanningPlan,\n type SemanticActivation,\n type UnresolvedSemanticPlan,\n} from './semantic-plan';\nimport { type SourcePropertyEvidence, unknownSourcePropertyEvidence } from './source-property-evidence';\nimport { VisibilityStatePlanner } from './visibility/visibility-state.planner';\nimport { parseVisibilityValue } from './visibility/visibility-value.parser';\n\nconst flexItemDirectives = new Set<LocatedFlexLayoutInput['directive']>(['fxFlex', 'fxGrow', 'fxShrink']);\nconst visibilityDirectives = new Set<LocatedFlexLayoutInput['directive']>(['fxShow', 'fxHide']);\nconst extendedClassDirectives = new Set<LocatedFlexLayoutInput['directive']>(['class', 'ngClass']);\nconst extendedStyleDirectives = new Set<LocatedFlexLayoutInput['directive']>(['style', 'ngStyle']);\nconst extendedDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n ...extendedClassDirectives,\n ...extendedStyleDirectives,\n]);\nconst gridDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdArea',\n 'gdAreas',\n 'gdAuto',\n 'gdColumn',\n 'gdColumns',\n 'gdGap',\n 'gdGridAlign',\n 'gdInline',\n 'gdRow',\n 'gdRows',\n]);\nconst gridContainerDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdAlignColumns',\n 'gdAlignRows',\n 'gdAreas',\n 'gdAuto',\n 'gdColumns',\n 'gdGap',\n 'gdRows',\n]);\nconst gridChildDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'gdArea',\n 'gdColumn',\n 'gdGridAlign',\n 'gdRow',\n]);\nconst displayAuthorityDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'class',\n 'ngClass',\n 'style',\n 'ngStyle',\n]);\nconst localLayoutDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'fxLayout',\n 'fxLayoutGap',\n 'fxLayoutAlign',\n]);\nconst parentLayoutDependentDirectives = new Set<LocatedFlexLayoutInput['directive']>([\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexOffset',\n]);\n\nconst defaultSemanticBreakpointConfig: BreakpointMigrationConfig = {\n orientationBreakpoints: true,\n printWithBreakpoints: [],\n};\n\nfunction invalid(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'invalid',\n input,\n code: 'invalid-value',\n reason: `${input.value} is not a supported ${input.directive} value.`,\n suggestion: 'Correct the value or migrate this directive manually.',\n };\n}\n\nfunction dynamicBinding(input: LocatedFlexLayoutInput, extended = false): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'dynamic-binding',\n reason: extended\n ? 'Angular property bindings and interpolation may depend on runtime state.'\n : 'Angular property bindings may depend on runtime state.',\n suggestion: 'Replace the binding manually or make it a literal before migration.',\n };\n}\n\nfunction contextUnverified(input: LocatedFlexLayoutInput, reason: string): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason,\n suggestion: 'Migrate the responsive context and its dependent directive families together manually.',\n };\n}\n\nfunction displayContextUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'The element display context contains an unresolved layout or visibility family.',\n suggestion: 'Migrate the complete layout and visibility context together manually.',\n };\n}\n\nfunction responsivePrecedenceUnverified(input: LocatedFlexLayoutInput): UnresolvedSemanticPlan {\n return {\n status: 'review',\n input,\n code: 'responsive-precedence-unverified',\n reason: 'Overlapping responsive ranges emit different target outputs for the same directive family.',\n suggestion: 'Simplify the overlapping declarations or migrate this directive family manually.',\n };\n}\n\nfunction unresolvedBreakpoint(\n input: LocatedFlexLayoutInput,\n classification: Exclude<BreakpointClassification, { readonly kind: 'verified' }>,\n): UnresolvedSemanticPlan {\n if (classification.kind === 'custom') {\n return {\n status: 'review',\n input,\n code: 'custom-breakpoint',\n reason: `The breakpoint alias ${classification.alias} may be registered by the project.`,\n suggestion: 'Provide its media query or migrate this responsive input manually.',\n };\n }\n\n const kind = classification.kind === 'print' ? 'print' : 'optional';\n return {\n status: 'review',\n input,\n code: 'breakpoint-unverified',\n reason: `The ${kind} breakpoint alias ${classification.alias} is not enabled by explicit migration configuration.`,\n suggestion:\n classification.kind === 'print'\n ? 'Verify the source printWithBreakpoints value, then rerun with --print-with-breakpoints.'\n : 'Verify that the source enables orientation breakpoints, then rerun with --orientation-breakpoints.',\n };\n}\n\nfunction staticLayoutContext(attributes: readonly TemplateAttribute[]): string | undefined {\n const layouts = attributes.filter(\n attribute => attribute.name === 'fxLayout' || attribute.name.startsWith('fxLayout.'),\n );\n if (!layouts.length) return 'row';\n if (layouts.length !== 1) return undefined;\n const layout = layouts[0];\n return layout?.name === 'fxLayout' && layout.binding === 'literal' ? layout.value : undefined;\n}\n\nfunction activation(\n input: LocatedFlexLayoutInput,\n catalog: BreakpointCatalog,\n): SemanticActivation | UnresolvedSemanticPlan {\n if (input.breakpoint === undefined) return { kind: 'base' };\n const classification = catalog.classify(input.breakpoint);\n return classification.kind === 'verified'\n ? { kind: 'media', definition: classification.definition }\n : unresolvedBreakpoint(input, classification);\n}\n\nfunction resolved(input: LocatedFlexLayoutInput, value: ResolvedSemanticValue): ResolvedSemanticPlan {\n const family = directiveFamily(input.directive);\n if (family === undefined) throw new Error(`Semantic planning received an unknown directive: ${input.directive}`);\n return { status: 'converted', input, family, value, activations: [] };\n}\n\nfunction fromSemantic<T extends ResolvedSemanticValue>(\n input: LocatedFlexLayoutInput,\n result: SemanticResult<T>,\n): SemanticPlanningPlan {\n if (result.status === 'planned') return resolved(input, result.value);\n if (result.status === 'invalid') return invalid(input);\n return { ...result, input };\n}\n\nfunction sameSemanticOutput(left: SemanticPlanningPlan, right: SemanticPlanningPlan): boolean {\n return (\n left.status === 'converted' &&\n right.status === 'converted' &&\n left.family === right.family &&\n JSON.stringify(semanticEffect(left)) === JSON.stringify(semanticEffect(right))\n );\n}\n\nfunction semanticEffect(plan: ResolvedSemanticPlan): ResolvedSemanticValue | Omit<FlexItemSemantics, 'axis'> {\n if (plan.family !== 'flex-item') return plan.value;\n const value = plan.value as FlexItemSemantics;\n if (value.min !== undefined || value.max !== undefined) return value;\n const { axis: _axis, ...effect } = value;\n return effect;\n}\n\nfunction semanticPolicy(catalog: BreakpointCatalog): SemanticTargetPolicy<SemanticPlanningPlan> {\n return {\n emptyPlan: input => resolved(input, { kind: 'empty' }),\n targetEligibility: () => undefined,\n validateActivation: plan => {\n if (plan.status !== 'converted') return plan;\n const plannedActivation = activation(plan.input, catalog);\n return 'status' in plannedActivation ? plannedActivation : plan;\n },\n isTargetEligibilityFailure: plan =>\n plan.status !== 'converted' && (plan.code === 'breakpoint-unverified' || plan.code === 'custom-breakpoint'),\n sameOutput: sameSemanticOutput,\n contextUnverified,\n contextualOutputUnverified: input =>\n contextUnverified(\n input,\n 'This directive emits different target outputs across its active responsive layout contexts.',\n ),\n responsivePrecedenceUnverified,\n decorate: plan => {\n if (plan.status !== 'converted') return plan;\n const plannedActivation = activation(plan.input, catalog);\n return 'status' in plannedActivation ? plannedActivation : { ...plan, activations: [plannedActivation] };\n },\n addPrintFallback: plan => {\n if (plan.status !== 'converted') return plan;\n const print = catalog.classify('print');\n return print.kind === 'verified'\n ? { ...plan, activations: [...plan.activations, { kind: 'media', definition: print.definition }] }\n : plan;\n },\n };\n}\n\nfunction equalClassValues(left: SemanticResponsiveClassValue, right: SemanticResponsiveClassValue): boolean {\n return (\n left.tokens.length === right.tokens.length &&\n left.tokens.every((token, index) => token.source === right.tokens[index]?.source)\n );\n}\n\nfunction equalStyleValues(left: ResponsiveStyleValue, right: ResponsiveStyleValue): boolean {\n return (\n left.declarations.length === right.declarations.length &&\n left.declarations.every(\n (declaration, index) =>\n declaration.property === right.declarations[index]?.property &&\n declaration.value === right.declarations[index]?.value,\n )\n );\n}\n\nfunction extendedMayControlDisplay(input: LocatedFlexLayoutInput, evidence: SourcePropertyEvidence): boolean {\n if (input.binding !== 'literal') return true;\n if (extendedStyleDirectives.has(input.directive)) {\n const parsed = parseLiteralStyleDeclarations(input.value);\n return (\n parsed.status === 'unverified' ||\n parsed.declarations.some(declaration => cssPropertiesOverlap(declaration.property, 'display'))\n );\n }\n return input.value\n .split(/\\s+/u)\n .filter(Boolean)\n .some(token => {\n const classification = evidence.classifyClassToken(token);\n return (\n classification.status === 'unverified' ||\n classification.evidence.properties.some(property => cssPropertiesOverlap(property, 'display'))\n );\n });\n}\n\nfunction hasLiteralGridParentClass(context: SemanticConversionContext): boolean {\n return Boolean(\n context.parent?.attributes.some(attribute => {\n if (attribute.binding !== 'literal' || !templateAttributeKeys(attribute).has('class')) return false;\n return attribute.value.split(/\\s+/u).some(className => className === 'grid' || className === 'inline-grid');\n }),\n );\n}\n\nfunction configuredPrintOwner(\n inputs: readonly LocatedFlexLayoutInput[],\n catalog: BreakpointCatalog,\n): { readonly inputId: string; readonly activation: SemanticActivation } | undefined {\n const configuredAliases = catalog.printWithBreakpoints;\n if (configuredAliases === undefined || inputs.some(input => input.breakpoint === 'print')) return undefined;\n const print = catalog.classify('print');\n if (print.kind !== 'verified') return undefined;\n const selected = inputs\n .flatMap(input => {\n if (input.breakpoint === undefined || !configuredAliases.includes(input.breakpoint)) return [];\n const classification = catalog.classify(input.breakpoint);\n return classification.kind === 'verified' ? [{ input, definition: classification.definition }] : [];\n })\n .sort(\n (left, right) =>\n right.definition.priority - left.definition.priority ||\n configuredAliases.indexOf(left.input.breakpoint ?? '') -\n configuredAliases.indexOf(right.input.breakpoint ?? ''),\n )[0];\n return selected === undefined\n ? undefined\n : { inputId: selected.input.id, activation: { kind: 'media', definition: print.definition } };\n}\n\nexport class ElementSemanticPlanner {\n constructor(\n private readonly breakpointConfig?: BreakpointMigrationConfig,\n private readonly sourcePropertyEvidence: SourcePropertyEvidence = unknownSourcePropertyEvidence,\n ) {}\n\n plan(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n options: {\n readonly breakpointConfig?: BreakpointMigrationConfig;\n readonly sourcePropertyEvidence?: SourcePropertyEvidence;\n } = {},\n ): readonly SemanticPlanningPlan[] {\n const completeContext = { ...context, inputs };\n const catalog = this.catalog(options.breakpointConfig);\n const sourceEvidence = options.sourcePropertyEvidence ?? this.sourcePropertyEvidence;\n const responsive = new ResponsiveFamilyPlanner(catalog, semanticPolicy(catalog));\n const visibilityInputs = inputs.filter(input => visibilityDirectives.has(input.directive));\n const extendedInputs = inputs.filter(input => extendedDirectives.has(input.directive));\n const ordinaryInputs = inputs.filter(\n input => !visibilityDirectives.has(input.directive) && !extendedDirectives.has(input.directive),\n );\n\n const initial = [\n ...responsive.plan(ordinaryInputs, completeContext, (input, itemContext) => this.planOne(input, itemContext)),\n ...this.planVisibility(visibilityInputs, catalog),\n ...this.planExtendedFamilies(extendedInputs, completeContext, catalog, sourceEvidence),\n ];\n const initialById = new Map(initial.map(plan => [plan.input.id, plan]));\n let closed: readonly SemanticPlanningPlan[] = inputs.map(\n input => initialById.get(input.id) ?? this.planOne(input, completeContext),\n );\n closed = this.closeResponsiveDependencies(closed, completeContext, responsive);\n closed = this.closeResponsiveDependencies(closed, completeContext, responsive);\n closed = this.closeGridContainerDependencies(closed);\n closed = this.assignGridDisplayOwnership(closed);\n closed = new SemanticFamilyCompositionPlanner(catalog, sourceEvidence).compose(closed, completeContext);\n\n return closed;\n }\n\n closeDependencies<TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput }>(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, SemanticDependencyPlan<TConverted>>,\n sourceEvidence: SourcePropertyEvidence = unknownSourcePropertyEvidence,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n let closed = this.closeRenderedFamilies(plans);\n closed = this.closeRenderedDisplayDependencies(closed, sourceEvidence);\n closed = this.closeRenderedFamilies(closed);\n closed = this.closeRenderedDisplayDependencies(closed, sourceEvidence);\n closed = this.closeParentLayoutDependencies(closed, context, plansByInputId);\n return this.closeGridParentDependencies(closed, context, plansByInputId);\n }\n\n closeSiblingFamilies<TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput }>(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n ): readonly SemanticDependencyPlan<TConverted>[] {\n return this.closeRenderedFamilies(plans);\n }\n\n closeDisplayDependencies<TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput }>(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n sourceEvidence: SourcePropertyEvidence = unknownSourcePropertyEvidence,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n return this.closeRenderedDisplayDependencies(plans, sourceEvidence);\n }\n\n private planOne(input: LocatedFlexLayoutInput, context: SemanticConversionContext): SemanticPlanningPlan {\n if (input.binding === 'property') return dynamicBinding(input);\n\n if (input.directive === 'fxLayout') {\n const layout = parseLayout(input.value);\n return layout.ok ? resolved(input, layout.value) : invalid(input);\n }\n if (input.directive === 'fxLayoutGap') {\n const layout = context.activeLayout ?? staticLayoutContext(context.element.attributes);\n return fromSemantic(input, planLayoutGapSemantics(input.value, layout));\n }\n if (input.directive === 'fxLayoutAlign') {\n const layout = context.activeLayout ?? staticLayoutContext(context.element.attributes);\n if (layout === undefined) {\n return {\n status: 'review',\n input,\n code: 'context-unverified',\n reason: 'Alignment sizing and direction depend on a dynamic or responsive layout.',\n suggestion: 'Make the layout static or migrate layout and alignment together manually.',\n };\n }\n return fromSemantic(input, planLayoutAlignment(input.value, layout));\n }\n if (flexItemDirectives.has(input.directive)) return this.planFlexItem(input, context);\n if (input.directive === 'fxFlexAlign') return fromSemantic(input, planFlexAlignSemantics(input.value));\n if (input.directive === 'fxFlexFill' || input.directive === 'fxFill') {\n return fromSemantic(input, planFlexFillSemantics());\n }\n if (input.directive === 'fxFlexOffset') {\n const layout = context.activeParentLayout ?? staticLayoutContext(context.parent?.attributes ?? []);\n return fromSemantic(input, planFlexOffsetSemantics(input.value, layout));\n }\n if (input.directive === 'fxFlexOrder') return fromSemantic(input, planFlexOrderSemantics(input.value));\n if (gridDirectives.has(input.directive)) return this.planGrid(input, context);\n\n return {\n status: 'unsupported',\n input,\n code: 'target-unsupported',\n reason: `No shared semantic family supports ${input.directive}.`,\n suggestion: 'Keep the directive and migrate it manually.',\n };\n }\n\n private planFlexItem(input: LocatedFlexLayoutInput, context: SemanticConversionContext): SemanticPlanningPlan {\n const flexInputs = context.inputs.filter(item => flexItemDirectives.has(item.directive));\n const atBreakpoint = (directive: LocatedFlexLayoutInput['directive']) =>\n flexInputs.filter(item => item.directive === directive && item.breakpoint === input.breakpoint);\n const atBase = (directive: LocatedFlexLayoutInput['directive']) =>\n flexInputs.filter(item => item.directive === directive && item.breakpoint === undefined);\n const exactFlex = atBreakpoint('fxFlex');\n const basis = exactFlex[0] ?? (input.breakpoint ? atBase('fxFlex')[0] : undefined);\n const exactGrow = atBreakpoint('fxGrow');\n const exactShrink = atBreakpoint('fxShrink');\n const grow = exactGrow[0] ?? (input.breakpoint ? atBase('fxGrow')[0] : undefined);\n const shrink = exactShrink[0] ?? (input.breakpoint ? atBase('fxShrink')[0] : undefined);\n const duplicateMember = [exactFlex, exactGrow, exactShrink].some(items => items.length > 1);\n if (!basis || duplicateMember) {\n return {\n status: 'invalid',\n input,\n code: 'invalid-value',\n reason: basis\n ? 'Multiple flex sizing inputs define the same responsive state.'\n : `${input.directive} requires an active fxFlex value.`,\n suggestion: 'Keep one flex sizing value per breakpoint or migrate this group manually.',\n };\n }\n\n return fromSemantic(\n input,\n planFlexItemSemantics({\n basis: basis.value,\n grow: grow?.value,\n shrink: shrink?.value,\n layout: context.activeParentLayout ?? staticLayoutContext(context.parent?.attributes ?? []),\n }),\n );\n }\n\n private planGrid(input: LocatedFlexLayoutInput, context: SemanticConversionContext): SemanticPlanningPlan {\n const parsed = parseGridValue(input);\n if (parsed.status === 'review') {\n return {\n status: 'review',\n input,\n code: parsed.code,\n reason: parsed.reason,\n suggestion: 'Replace the binding with a literal or migrate this Grid directive manually.',\n };\n }\n if (parsed.status === 'invalid') {\n return {\n status: 'invalid',\n input,\n code: parsed.code,\n reason: parsed.reason,\n suggestion: 'Correct the value or migrate this Grid directive manually.',\n };\n }\n if (\n parsed.plan.role === 'child' &&\n !context.parentInputs.some(parentInput => gridContainerDirectives.has(parentInput.directive)) &&\n !hasLiteralGridParentClass(context)\n ) {\n return contextUnverified(input, 'The parent element does not have a statically proven Grid container context.');\n }\n return resolved(input, parsed.plan);\n }\n\n private planVisibility(\n inputs: readonly LocatedFlexLayoutInput[],\n catalog: BreakpointCatalog,\n ): readonly SemanticPlanningPlan[] {\n const familyPlan = new VisibilityStatePlanner(catalog).plan(inputs);\n if (familyPlan.status === 'unresolved') {\n return familyPlan.plans;\n }\n const states = familyPlan.states.map(state => ({ intent: state.intent, activation: state.activation }));\n const owner = familyPlan.states[0]?.input.id;\n return inputs.map(input => ({\n ...resolved(input, { kind: 'visibility', emit: input.id === owner, states }),\n activations: [],\n }));\n }\n\n private planExtendedFamilies(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n catalog: BreakpointCatalog,\n sourceEvidence: SourcePropertyEvidence,\n ): readonly SemanticPlanningPlan[] {\n const plansById = new Map<string, SemanticPlanningPlan>();\n const familyPlanner = new ExtendedFamilyPlanner(catalog);\n const semanticPlanner = new ExtendedSemanticPlanner(sourceEvidence);\n\n for (const family of ['extended-class', 'extended-style'] as const) {\n const familyInputs = inputs.filter(input =>\n family === 'extended-class'\n ? extendedClassDirectives.has(input.directive)\n : extendedStyleDirectives.has(input.directive),\n );\n if (!familyInputs.length) continue;\n if (family === 'extended-class') {\n const familyPlan = familyPlanner.plan<SemanticResponsiveClassValue>({\n kind: 'class',\n inputs: familyInputs,\n valueParser: input => parseResponsiveClassValue(input, sourceEvidence),\n equals: equalClassValues,\n });\n const decision = semanticPlanner.plan({\n kind: 'class',\n familyPlan,\n attributes: context.attributeEvidence,\n });\n if (familyPlan.status === 'unresolved') {\n for (const plan of familyPlan.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n if (decision.status === 'unresolved') {\n for (const plan of decision.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n const printOwner = configuredPrintOwner(familyInputs, catalog);\n const states = familyPlan.states.map(state => ({\n activations: [state.activation, ...(printOwner?.inputId === state.input.id ? [printOwner.activation] : [])],\n tokens: state.value.tokens,\n }));\n for (const input of familyInputs) {\n plansById.set(input.id, {\n ...resolved(input, {\n kind: 'extended-class',\n emit: decision.ownerInputId === input.id,\n retainedTokens:\n decision.ownerInputId === undefined && input.id === familyPlan.states[0]?.input.id\n ? decision.retainedTokens\n : [],\n states,\n }),\n activations: [],\n });\n }\n continue;\n }\n\n const familyPlan = familyPlanner.plan<ResponsiveStyleValue>({\n kind: 'style',\n inputs: familyInputs,\n valueParser: input => parseResponsiveStyleValue(input, sourceEvidence),\n equals: equalStyleValues,\n });\n const decision = semanticPlanner.plan({\n kind: 'style',\n familyPlan,\n attributes: context.attributeEvidence,\n });\n if (familyPlan.status === 'unresolved') {\n for (const plan of familyPlan.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n if (decision.status === 'unresolved') {\n for (const plan of decision.plans) {\n plansById.set(plan.input.id, plan);\n }\n continue;\n }\n const printOwner = configuredPrintOwner(familyInputs, catalog);\n const states = familyPlan.states.map(state => ({\n activations: [state.activation, ...(printOwner?.inputId === state.input.id ? [printOwner.activation] : [])],\n declarations: state.value.declarations,\n }));\n for (const input of familyInputs) {\n plansById.set(input.id, {\n ...resolved(input, {\n kind: 'extended-style',\n emit: decision.ownerInputId === input.id,\n states,\n }),\n activations: [],\n });\n }\n }\n\n return inputs.map(input => plansById.get(input.id) ?? dynamicBinding(input, true));\n }\n\n private closeResponsiveDependencies(\n plans: readonly SemanticPlanningPlan[],\n context: SemanticConversionContext,\n responsive: ResponsiveFamilyPlanner<SemanticPlanningPlan>,\n ): readonly SemanticPlanningPlan[] {\n const responsiveInputs = plans.map(plan => plan.input).filter(input => !extendedDirectives.has(input.directive));\n const current = new Map(plans.map(plan => [plan.input.id, plan]));\n const closed = responsive.closeDependencies(\n responsiveInputs,\n context,\n (input, itemContext) => current.get(input.id) ?? this.planOne(input, itemContext),\n );\n const closedById = new Map(closed.map(plan => [plan.input.id, plan]));\n return plans.map(plan => closedById.get(plan.input.id) ?? plan);\n }\n\n private closeGridContainerDependencies(plans: readonly SemanticPlanningPlan[]): readonly SemanticPlanningPlan[] {\n const containerPlans = plans.filter(\n plan => gridContainerDirectives.has(plan.input.directive) || plan.input.directive === 'gdInline',\n );\n if (!containerPlans.some(plan => plan.status !== 'converted')) return plans;\n return plans.map(plan =>\n plan.status === 'converted' &&\n (gridContainerDirectives.has(plan.input.directive) || plan.input.directive === 'gdInline')\n ? contextUnverified(plan.input, 'The Grid container display family contains an unresolved member.')\n : plan,\n );\n }\n\n private assignGridDisplayOwnership(plans: readonly SemanticPlanningPlan[]): readonly SemanticPlanningPlan[] {\n const hasBaseInline = plans.some(\n plan => plan.status === 'converted' && plan.input.directive === 'gdInline' && plan.input.breakpoint === undefined,\n );\n const ownerByBreakpoint = new Map<string, string>();\n if (!hasBaseInline) {\n for (const plan of plans) {\n if (plan.status !== 'converted' || !gridContainerDirectives.has(plan.input.directive)) continue;\n const breakpoint = plan.input.breakpoint ?? 'base';\n if (!ownerByBreakpoint.has(breakpoint)) ownerByBreakpoint.set(breakpoint, plan.input.id);\n }\n }\n return plans.map(plan =>\n plan.status === 'converted' && gridContainerDirectives.has(plan.input.directive)\n ? { ...plan, emitGridDisplay: ownerByBreakpoint.get(plan.input.breakpoint ?? 'base') === plan.input.id }\n : plan,\n );\n }\n\n private closeRenderedFamilies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(plans: readonly SemanticDependencyPlan<TConverted>[]): readonly SemanticDependencyPlan<TConverted>[] {\n const groups = new Map<DirectiveFamily, SemanticDependencyPlan<TConverted>[]>();\n for (const plan of plans) {\n const family = directiveFamily(plan.input.directive);\n if (!family) continue;\n const members = groups.get(family) ?? [];\n members.push(plan);\n groups.set(family, members);\n }\n const unresolvedFamilies = new Set(\n [...groups].filter(([, members]) => members.some(plan => plan.status !== 'converted')).map(([family]) => family),\n );\n let closed = plans.map(plan => {\n const family = directiveFamily(plan.input.directive);\n return plan.status === 'converted' && family !== undefined && unresolvedFamilies.has(family)\n ? contextUnverified(plan.input, 'Another member of this responsive directive family is unresolved.')\n : plan;\n });\n\n if (closed.some(plan => localLayoutDirectives.has(plan.input.directive) && plan.status !== 'converted')) {\n closed = closed.map(plan =>\n plan.status === 'converted' && localLayoutDirectives.has(plan.input.directive)\n ? contextUnverified(\n plan.input,\n 'The element layout context contains an unresolved dependent directive family.',\n )\n : plan,\n );\n }\n return closed;\n }\n\n private closeRenderedDisplayDependencies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n evidence: SourcePropertyEvidence,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n const layoutPlans = plans.filter(plan => plan.input.directive === 'fxLayout');\n const visibilityPlans = plans.filter(plan => visibilityDirectives.has(plan.input.directive));\n const authorityPlans = plans.filter(\n plan =>\n displayAuthorityDirectives.has(plan.input.directive) &&\n (extendedMayControlDisplay(plan.input, evidence) ||\n (plan.status !== 'converted' && extendedClassDirectives.has(plan.input.directive))),\n );\n const visibilityIsNoOp =\n visibilityPlans.length > 0 &&\n visibilityPlans.every(plan => plan.status === 'converted' && parseVisibilityValue(plan.input) === 'shown');\n if ((!layoutPlans.length && !authorityPlans.length) || !visibilityPlans.length || visibilityIsNoOp) return plans;\n if (![...layoutPlans, ...visibilityPlans, ...authorityPlans].some(plan => plan.status !== 'converted'))\n return plans;\n const affected = new Set([...layoutPlans, ...visibilityPlans, ...authorityPlans].map(plan => plan.input.id));\n return plans.map(plan =>\n plan.status === 'converted' && affected.has(plan.input.id) ? displayContextUnverified(plan.input) : plan,\n );\n }\n\n private closeParentLayoutDependencies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, SemanticDependencyPlan<TConverted>>,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n if (!plans.some(plan => parentLayoutDependentDirectives.has(plan.input.directive))) return plans;\n const parentContextInputs = context.parentInputs.filter(input => localLayoutDirectives.has(input.directive));\n const knownParentPlans = parentContextInputs\n .map(input => plansByInputId.get(input.id))\n .filter((plan): plan is SemanticDependencyPlan<TConverted> => plan !== undefined);\n if (!knownParentPlans.some(plan => plan.status !== 'converted')) return plans;\n return plans.map(plan =>\n plan.status === 'converted' && parentLayoutDependentDirectives.has(plan.input.directive)\n ? contextUnverified(plan.input, 'The responsive parent layout family contains an unresolved member.')\n : plan,\n );\n }\n\n private closeGridParentDependencies<\n TConverted extends { readonly status: 'converted'; readonly input: LocatedFlexLayoutInput },\n >(\n plans: readonly SemanticDependencyPlan<TConverted>[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, SemanticDependencyPlan<TConverted>>,\n ): readonly SemanticDependencyPlan<TConverted>[] {\n if (!plans.some(plan => gridChildDirectives.has(plan.input.directive))) return plans;\n const parentGridInputs = context.parentInputs.filter(\n input => gridContainerDirectives.has(input.directive) || input.directive === 'gdInline',\n );\n const parentPlansAreSafe =\n parentGridInputs.some(input => gridContainerDirectives.has(input.directive)) &&\n parentGridInputs.every(input => plansByInputId.get(input.id)?.status === 'converted');\n if (parentPlansAreSafe || (parentGridInputs.length === 0 && hasLiteralGridParentClass(context))) return plans;\n if (parentGridInputs.length > 0 && parentGridInputs.every(input => !plansByInputId.has(input.id))) return plans;\n\n return plans.map(plan =>\n plan.status === 'converted' && gridChildDirectives.has(plan.input.directive)\n ? contextUnverified(plan.input, 'The parent Grid container conversion is unresolved.')\n : plan,\n );\n }\n\n private catalog(override?: BreakpointMigrationConfig): BreakpointCatalog {\n return new BreakpointCatalog(this.breakpointConfig ?? override ?? defaultSemanticBreakpointConfig);\n }\n}\n","import type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { ConversionRenderer, PlannedConversion } from '../render/conversion-renderer';\nimport type { SemanticConversionContext } from '../semantic/conversion-context';\nimport { ElementSemanticPlanner } from '../semantic/element-semantic.planner';\nimport type { ResolvedSemanticPlan, UnresolvedSemanticPlan } from '../semantic/semantic-plan';\n\ntype TargetDiagnostic = Exclude<PlannedConversion, { readonly status: 'converted' }>;\ntype ResultBoundary = 'Initial target rendering' | 'Target conflict resolution';\n\n/** Coordinates target-neutral semantic planning with exactly one target renderer. */\nexport class SemanticRenderCoordinator {\n private readonly semanticPlanner: ElementSemanticPlanner;\n\n constructor(\n readonly renderer: ConversionRenderer,\n semanticPlanner: ElementSemanticPlanner = new ElementSemanticPlanner(\n renderer.breakpointConfig,\n renderer.sourcePropertyEvidence,\n ),\n ) {\n this.semanticPlanner = semanticPlanner;\n }\n\n planElement(\n inputs: readonly LocatedFlexLayoutInput[],\n context: SemanticConversionContext,\n record = true,\n ): readonly PlannedConversion[] {\n this.assertUniqueInputIds(inputs);\n const semanticPlans = this.semanticPlanner.plan(inputs, context, {\n breakpointConfig: this.renderer.breakpointConfig,\n sourcePropertyEvidence: this.renderer.sourcePropertyEvidence,\n });\n const targetReady = semanticPlans.map(plan => this.applyTargetEligibility(plan));\n const familyClosed = this.semanticPlanner.closeSiblingFamilies(targetReady);\n const locallyClosed =\n this.renderer.target === 'css'\n ? this.semanticPlanner.closeDisplayDependencies(familyClosed, this.renderer.sourcePropertyEvidence)\n : familyClosed;\n const rendered = locallyClosed.map(plan =>\n plan.status === 'converted' ? this.renderer.render(plan, context) : plan,\n );\n this.assertResultCorrespondence(inputs, rendered, 'Initial target rendering');\n const resolved = this.renderer.resolveConflicts(rendered, context);\n this.assertResultCorrespondence(inputs, resolved, 'Target conflict resolution');\n if (record) this.record(resolved);\n return resolved;\n }\n\n record(plans: readonly PlannedConversion[]): void {\n this.renderer.record(plans);\n }\n\n closeDependencies(\n plans: readonly PlannedConversion[],\n context: SemanticConversionContext,\n plansByInputId: ReadonlyMap<string, PlannedConversion>,\n ): readonly PlannedConversion[] {\n return this.semanticPlanner.closeDependencies(plans, context, plansByInputId, this.renderer.sourcePropertyEvidence);\n }\n\n private applyTargetEligibility(\n plan: ResolvedSemanticPlan | UnresolvedSemanticPlan,\n ): ResolvedSemanticPlan | TargetDiagnostic {\n const eligibility = this.renderer.eligibility(plan.input);\n if (eligibility?.status === 'converted') throw new Error('Renderer eligibility must not emit target output');\n if (eligibility !== undefined) return eligibility;\n if (plan.status === 'converted') return plan;\n if (plan.reason === 'Overlapping responsive ranges emit different target outputs for the same directive family.') {\n return {\n ...plan,\n reason:\n this.renderer.target === 'css'\n ? 'Overlapping responsive ranges emit different CSS declarations for the same directive family.'\n : 'Overlapping responsive ranges emit different utilities for the same directive family.',\n };\n }\n if (plan.reason === 'This directive emits different target outputs across its active responsive layout contexts.') {\n return {\n ...plan,\n reason:\n this.renderer.target === 'css'\n ? 'This directive emits different declarations across its active responsive layout contexts.'\n : 'This directive emits different utilities across its active responsive layout contexts.',\n };\n }\n return plan;\n }\n\n private assertUniqueInputIds(inputs: readonly LocatedFlexLayoutInput[]): void {\n const seen = new Set<string>();\n for (const input of inputs) {\n if (seen.has(input.id)) {\n throw internalInvariant(`Semantic render inputs contain duplicate ID \"${input.id}\".`, inputPaths(inputs));\n }\n seen.add(input.id);\n }\n }\n\n private assertResultCorrespondence(\n inputs: readonly LocatedFlexLayoutInput[],\n results: readonly PlannedConversion[],\n boundary: ResultBoundary,\n ): void {\n const paths = inputPaths(inputs, results);\n if (results.length !== inputs.length) {\n throw internalInvariant(\n `${boundary} returned ${results.length} ${results.length === 1 ? 'result' : 'results'} for ${inputs.length} inputs; results must be one-to-one and in stable order.`,\n paths,\n );\n }\n\n const seen = new Set<string>();\n for (const result of results) {\n if (seen.has(result.input.id)) {\n throw internalInvariant(`${boundary} returned duplicate input ID \"${result.input.id}\".`, paths);\n }\n seen.add(result.input.id);\n }\n\n for (let index = 0; index < inputs.length; index += 1) {\n const expected = inputs[index]!;\n const result = results[index]!;\n if (result.input.id !== expected.id) {\n throw internalInvariant(\n `${boundary} returned input ID \"${result.input.id}\" at index ${index}; expected \"${expected.id}\".`,\n paths,\n );\n }\n if (result.input !== expected) {\n throw internalInvariant(\n `${boundary} replaced the input identity for ID \"${expected.id}\" at index ${index}.`,\n paths,\n );\n }\n }\n }\n}\n\nfunction inputPaths(\n inputs: readonly LocatedFlexLayoutInput[],\n results: readonly PlannedConversion[] = [],\n): readonly string[] {\n return [...new Set([...inputs.map(input => input.fileName), ...results.map(result => result.input.fileName)])];\n}\n\nfunction internalInvariant(message: string, paths: readonly string[]): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message, paths);\n}\n","import type { PlannedConversion } from '../render/conversion-renderer';\nimport type { ConversionResult } from '../analyzer/conversion-result';\nimport type { LocatedFlexLayoutInput } from '../analyzer/flex-layout-attribute.analyzer';\nimport type { SourceEdit } from '../edit/source-edit';\nimport { templateAttributeKeys } from '../template/template-attribute';\nimport type { SourceRange, TemplateElement } from '../template/template.model';\nimport { appendLiteralClassNames } from '../edit/html-attribute-value';\nimport { ResponsiveImagePlanner } from '../image/responsive-image.planner';\nimport type { ResponsiveImagePlan } from '../image/responsive-image.model';\nimport { PictureRenderer } from '../image/picture.renderer';\nimport type { ConversionRenderer } from '../render/conversion-renderer';\nimport type { SemanticConversionContext } from '../semantic/conversion-context';\nimport { ElementSemanticPlanner } from '../semantic/element-semantic.planner';\nimport { SemanticRenderCoordinator } from './semantic-render.coordinator';\n\nexport interface FilePlan {\n readonly edits: readonly SourceEdit[];\n readonly results: readonly ConversionResult[];\n}\n\nexport interface ConversionPlanningOptions {\n readonly responsiveImages: boolean;\n}\n\ninterface ElementConversions {\n readonly element: TemplateElement;\n readonly inputs: LocatedFlexLayoutInput[];\n readonly classPlans: Array<{\n readonly input: LocatedFlexLayoutInput;\n readonly classNames: readonly string[];\n }>;\n}\n\nconst directiveOrder = new Map(\n [\n 'fxLayout',\n 'fxLayoutGap',\n 'fxLayoutAlign',\n 'fxFlex',\n 'fxGrow',\n 'fxShrink',\n 'fxFlexAlign',\n 'fxFlexFill',\n 'fxFill',\n 'fxFlexOffset',\n 'fxFlexOrder',\n 'ngClass',\n 'class',\n 'ngStyle',\n 'style',\n 'fxShow',\n 'fxHide',\n ].map((directive, index) => [directive, index]),\n);\n\nfunction boundClassBlocked(input: LocatedFlexLayoutInput): PlannedConversion {\n return {\n status: 'review',\n input,\n code: 'bound-class',\n reason: 'Generated classes cannot be merged safely with a bound class value.',\n suggestion: 'Merge the generated classes into the binding manually.',\n };\n}\n\nfunction isBoundClassAttribute(attribute: TemplateElement['attributes'][number]): boolean {\n if (attribute.binding !== 'property') return false;\n return [...templateAttributeKeys(attribute)].some(\n key => key === 'class' || key === 'ngclass' || key.startsWith('class.') || key.startsWith('ngclass.'),\n );\n}\n\nfunction literalClassAttribute(element: TemplateElement) {\n return element.attributes.find(\n attribute => attribute.binding === 'literal' && templateAttributeKeys(attribute).has('class'),\n );\n}\n\nfunction removalRange(source: string, input: LocatedFlexLayoutInput): SourceRange {\n const start =\n input.source.start > 0 && /[\\t ]/.test(source[input.source.start - 1] ?? '')\n ? input.source.start - 1\n : input.source.start;\n return { start, end: input.source.end };\n}\n\nexport class ConversionPlanner {\n plan(\n source: string,\n elements: readonly TemplateElement[],\n inputs: readonly LocatedFlexLayoutInput[],\n renderer: ConversionRenderer,\n options: ConversionPlanningOptions = { responsiveImages: false },\n semanticPlanner: ElementSemanticPlanner = new ElementSemanticPlanner(renderer.breakpointConfig),\n ): FilePlan {\n const coordinator = new SemanticRenderCoordinator(renderer, semanticPlanner);\n const elementById = new Map(elements.map(element => [element.id, element]));\n const inputsByElementId = new Map<string, LocatedFlexLayoutInput[]>();\n for (const input of inputs) {\n const elementInputs = inputsByElementId.get(input.elementId) ?? [];\n elementInputs.push(input);\n inputsByElementId.set(input.elementId, elementInputs);\n }\n const conversionsByElement = new Map<string, ElementConversions>();\n const results: ConversionResult[] = [];\n const plansByInputId = new Map<string, PlannedConversion>();\n const plansByElementId = new Map<string, readonly PlannedConversion[]>();\n const contextsByElementId = new Map<string, SemanticConversionContext>();\n const imagePlansByElementId = new Map<string, ResponsiveImagePlan>();\n\n for (const element of elements) {\n const allElementInputs = inputsByElementId.get(element.id) ?? [];\n if (!allElementInputs.length) continue;\n const elementInputs = allElementInputs.filter(input => input.directive !== 'imgSrc');\n if (!elementInputs.length) continue;\n const parent = element.parentId ? elementById.get(element.parentId) : undefined;\n const literalClass = literalClassAttribute(element);\n const existingClassNames = literalClass?.value.split(/\\s+/).filter(Boolean) ?? [];\n const context: SemanticConversionContext = {\n element,\n inputs: elementInputs,\n existingClassNames,\n attributeEvidence: element.attributes,\n ...(parent\n ? { parent, parentInputs: inputsByElementId.get(parent.id) ?? [] }\n : { parentInputs: [] as readonly LocatedFlexLayoutInput[] }),\n };\n let plans = coordinator.planElement(elementInputs, context, false);\n const hasBoundClass = element.attributes.some(isBoundClassAttribute);\n if (hasBoundClass) {\n plans = plans.map(plan =>\n plan.status === 'converted' && plan.classNames.length > 0 ? boundClassBlocked(plan.input) : plan,\n );\n }\n contextsByElementId.set(element.id, context);\n plansByElementId.set(element.id, plans);\n for (const planned of plans) plansByInputId.set(planned.input.id, planned);\n }\n\n for (const element of elements) {\n const plans = plansByElementId.get(element.id);\n const context = contextsByElementId.get(element.id);\n if (!plans || !context) continue;\n const closedPlans = coordinator.closeDependencies(plans, context, plansByInputId);\n for (const planned of closedPlans) plansByInputId.set(planned.input.id, planned);\n }\n\n for (const element of elements) {\n const imageInputs = (inputsByElementId.get(element.id) ?? []).filter(input => input.directive === 'imgSrc');\n if (!imageInputs.length) continue;\n const ancestors: TemplateElement[] = [];\n let ancestor = element.parentId ? elementById.get(element.parentId) : undefined;\n while (ancestor) {\n ancestors.push(ancestor);\n ancestor = ancestor.parentId ? elementById.get(ancestor.parentId) : undefined;\n }\n const imageResult = new ResponsiveImagePlanner().plan(\n imageInputs,\n { element, ancestors },\n options.responsiveImages,\n );\n const ordinaryPlans = (inputsByElementId.get(element.id) ?? [])\n .filter(input => input.directive !== 'imgSrc')\n .map(input => plansByInputId.get(input.id))\n .filter((plan): plan is PlannedConversion => plan !== undefined);\n const unresolvedOrdinary = ordinaryPlans.some(plan => plan.status !== 'converted');\n\n if (imageResult.status === 'unresolved') {\n for (const plan of imageResult.plans) plansByInputId.set(plan.input.id, plan);\n continue;\n }\n\n if (!unresolvedOrdinary) {\n imagePlansByElementId.set(element.id, imageResult.plan);\n for (const input of imageInputs) {\n plansByInputId.set(input.id, { status: 'converted', input, classNames: [] });\n }\n continue;\n }\n\n const familyFailure = {\n status: 'review' as const,\n code: 'context-unverified' as const,\n reason: 'Responsive image and same-element conversions must be applied atomically.',\n suggestion: 'Resolve all conversions on this image before enabling its picture migration.',\n };\n for (const plan of ordinaryPlans) {\n if (plan.status === 'converted') plansByInputId.set(plan.input.id, { ...familyFailure, input: plan.input });\n }\n for (const input of imageInputs) plansByInputId.set(input.id, { ...familyFailure, input });\n }\n\n coordinator.record(\n inputs.map(input => plansByInputId.get(input.id)).filter((plan): plan is PlannedConversion => plan !== undefined),\n );\n\n for (const input of inputs) {\n const element = elementById.get(input.elementId);\n if (!element) continue;\n const planned = plansByInputId.get(input.id);\n if (!planned) continue;\n\n if (planned.status !== 'converted') {\n results.push(planned);\n continue;\n }\n\n if (input.directive === 'imgSrc') {\n results.push({ status: 'converted', input });\n continue;\n }\n\n const conversion = conversionsByElement.get(element.id) ?? {\n element,\n inputs: [],\n classPlans: [],\n };\n conversion.inputs.push(input);\n conversion.classPlans.push({ input, classNames: planned.classNames });\n conversionsByElement.set(element.id, conversion);\n results.push({ status: 'converted', input });\n }\n\n const edits: SourceEdit[] = [];\n for (const conversion of conversionsByElement.values()) {\n const generatedClassNames = [...conversion.classPlans]\n .sort(\n (left, right) =>\n (directiveOrder.get(left.input.directive) ?? Number.MAX_SAFE_INTEGER) -\n (directiveOrder.get(right.input.directive) ?? Number.MAX_SAFE_INTEGER) ||\n (left.input.breakpoint ?? '').localeCompare(right.input.breakpoint ?? '') ||\n left.input.source.start - right.input.source.start,\n )\n .flatMap(plan => plan.classNames);\n edits.push(\n ...conversion.inputs.map(input => ({\n range: removalRange(source, input),\n text: '',\n inputId: input.id,\n })),\n );\n\n const classEdit = appendLiteralClassNames(\n source,\n conversion.element,\n literalClassAttribute(conversion.element),\n generatedClassNames,\n `${conversion.element.id}:classes`,\n );\n if (classEdit !== undefined) edits.push(classEdit);\n }\n\n for (const [elementId, imagePlan] of imagePlansByElementId) {\n const containedEdits = edits.filter(\n edit => edit.range.start >= imagePlan.element.source.start && edit.range.end <= imagePlan.element.source.end,\n );\n const externalEdits = edits.filter(edit => !containedEdits.includes(edit));\n edits.length = 0;\n edits.push(...externalEdits, {\n range: imagePlan.element.source,\n text: new PictureRenderer().render(source, imagePlan, containedEdits),\n inputId: `${elementId}:responsive-image`,\n });\n }\n\n return { edits, results };\n }\n}\n","import * as path from 'node:path';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport type { ConversionResult } from '../analyzer/conversion-result';\nimport type { MediaDefinition } from '../breakpoint/breakpoint-catalog';\nimport type { SourceEdit } from '../edit/source-edit';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { AdapterSessionResult } from '../render/render-session';\nimport { analyzedProject, type AnalyzedProject, type AnalyzedTemplate } from './analyzed-project';\nimport type { ManifestTemplate } from './project-manifest';\n\nexport interface RenderedTemplateFile {\n readonly inputPath: string;\n readonly outputPath: string;\n readonly edits: readonly SourceEdit[];\n readonly results: readonly ConversionResult[];\n}\n\nexport interface RenderedProject {\n readonly analyzed: AnalyzedProject;\n readonly target: 'css' | 'tailwind';\n readonly files: readonly RenderedTemplateFile[];\n readonly session: AdapterSessionResult;\n}\n\nexport function renderedProject(project: RenderedProject): RenderedProject {\n const analyzed = analyzedProject(project.analyzed);\n if (project.files.length !== analyzed.templates.length) throw sequenceInvariant();\n const files = project.files.map((file, index) => {\n const template = analyzed.templates[index];\n if (template === undefined || !samePathPair(template.file, file)) {\n throw sequenceInvariant([file.inputPath, file.outputPath]);\n }\n if (\n template.status === 'parse-error' &&\n (file.edits.length > 0 || !sameOwnedValue(file.results, parseErrorResults(template)))\n ) {\n throw internalInvariant(\n 'Rendered parse-error files must be edit-free and preserve their analyzed diagnostics exactly.',\n [file.inputPath, file.outputPath],\n );\n }\n const suppliedTemplate = project.analyzed.templates[index];\n if (template.status === 'parsed') {\n if (suppliedTemplate?.status !== 'parsed') throw sequenceInvariant([file.inputPath, file.outputPath]);\n assertParsedResultCorrespondence(suppliedTemplate, file.results);\n }\n const identity = template.file;\n return freezeRenderedFile({\n inputPath: identity.inputPath,\n outputPath: identity.outputPath,\n edits: file.edits,\n results: template.status === 'parsed' ? canonicalParsedResults(template, file.results) : file.results,\n });\n });\n\n return Object.freeze({\n analyzed,\n target: project.target,\n files: Object.freeze(files),\n session: freezeSessionResult(project.session),\n });\n}\n\nfunction assertParsedResultCorrespondence(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n results: readonly ConversionResult[],\n): void {\n const paths = [template.file.inputPath, template.file.outputPath];\n if (results.length !== template.inputs.length) {\n throw internalInvariant('Parsed render results must match analyzed inputs one-to-one and in stable order.', paths);\n }\n\n const seen = new Set<string>();\n for (let index = 0; index < results.length; index += 1) {\n const result = results[index]!;\n if (result.status === 'parse-error') {\n throw internalInvariant('Parsed render results cannot contain parse-error results.', paths);\n }\n const actual = result.input;\n const expected = template.inputs[index]!;\n if (!('id' in actual) || typeof actual.id !== 'string') {\n throw internalInvariant('Parsed render results must retain analyzed input IDs.', paths);\n }\n if (seen.has(actual.id)) {\n throw internalInvariant(`Parsed render results contain duplicate input ID \"${actual.id}\".`, paths);\n }\n seen.add(actual.id);\n if (actual.id !== expected.id) {\n throw internalInvariant(\n `Parsed render result input ID \"${actual.id}\" at index ${index} does not match analyzed input ID \"${expected.id}\".`,\n paths,\n );\n }\n if (actual !== expected) {\n throw internalInvariant(`Parsed render result replaced analyzed input identity \"${expected.id}\".`, paths);\n }\n }\n}\n\nfunction canonicalParsedResults(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n results: readonly ConversionResult[],\n): readonly ConversionResult[] {\n return Object.freeze(\n results.map((result, index) => {\n if (result.status === 'parse-error') throw new Error('Parsed render-result validation was bypassed.');\n return Object.freeze({ ...result, input: template.inputs[index]! });\n }),\n );\n}\n\nfunction parseErrorResults(\n template: Extract<AnalyzedProject['templates'][number], { readonly status: 'parse-error' }>,\n): readonly ConversionResult[] {\n return template.parseResult.diagnostics.map(diagnostic => ({\n status: 'parse-error',\n fileName: template.file.inputPath,\n code: 'template-parse-error',\n reason: diagnostic.message,\n source: diagnostic.source,\n }));\n}\n\nfunction freezeRenderedFile(file: RenderedTemplateFile): RenderedTemplateFile {\n return Object.freeze({\n inputPath: file.inputPath,\n outputPath: file.outputPath,\n edits: Object.freeze(\n file.edits.map(edit =>\n Object.freeze({\n ...edit,\n range: Object.freeze({ ...edit.range }),\n }),\n ),\n ),\n results: Object.freeze(\n file.results.map(result => (result.status === 'parse-error' ? freezeValue(result) : result)),\n ),\n });\n}\n\nfunction freezeSessionResult(session: AdapterSessionResult): AdapterSessionResult {\n if (session.target === 'tailwind') return Object.freeze({ target: session.target });\n return Object.freeze({\n target: session.target,\n rules: Object.freeze(session.rules.map(rule => freezeOwnedCssRule(rule))),\n });\n}\n\nfunction freezeOwnedCssRule(rule: OwnedCssRule): OwnedCssRule {\n return Object.freeze({\n ...rule,\n declarations: Object.freeze(rule.declarations.map(declaration => Object.freeze({ ...declaration }))),\n context: Object.freeze({\n ...rule.context,\n ...(rule.context.media === undefined ? {} : { media: freezeMedia(rule.context.media) }),\n }),\n });\n}\n\nfunction freezeMedia(media: MediaDefinition): MediaDefinition {\n return Object.freeze({\n ...media,\n clauses: Object.freeze(media.clauses.map(clause => Object.freeze({ ...clause }))),\n });\n}\n\nfunction samePathPair(left: ManifestTemplate, right: RenderedTemplateFile): boolean {\n return (\n normalizedAbsolutePath(left.inputPath) === normalizedAbsolutePath(right.inputPath) &&\n normalizedAbsolutePath(left.outputPath) === normalizedAbsolutePath(right.outputPath)\n );\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n\nfunction sameOwnedValue(left: unknown, right: unknown): boolean {\n if (Object.is(left, right)) return true;\n if (Array.isArray(left) || Array.isArray(right)) {\n return (\n Array.isArray(left) &&\n Array.isArray(right) &&\n left.length === right.length &&\n left.every((item, index) => sameOwnedValue(item, right[index]))\n );\n }\n if (!isPlainRecord(left) || !isPlainRecord(right)) return false;\n const keys = Object.keys(left);\n return (\n keys.length === Object.keys(right).length &&\n keys.every(key => Object.hasOwn(right, key) && sameOwnedValue(left[key], right[key]))\n );\n}\n\nfunction isPlainRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (value === null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value) as unknown;\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction freezeValue<T>(value: T): T {\n if (Array.isArray(value)) return Object.freeze(value.map(item => freezeValue(item))) as T;\n if (value !== null && typeof value === 'object') {\n return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, freezeValue(item)]))) as T;\n }\n return value;\n}\n\nfunction sequenceInvariant(paths: readonly string[] = []): MigrationApplicationError {\n return internalInvariant(\n 'Rendered project files must match its analyzed templates one-to-one and in the same order.',\n paths,\n );\n}\n\nfunction internalInvariant(message: string, paths: readonly string[] = []): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message, paths);\n}\n","import type { ConversionResult } from '../../analyzer/conversion-result';\nimport { ConversionPlanner, type ConversionPlanningOptions, type FilePlan } from '../../planner/conversion-planner';\nimport type { ConversionRenderer } from '../../render/conversion-renderer';\nimport type { RenderSession } from '../../render/render-session';\nimport type { AnalyzedTemplate, AnalyzedProject } from '../analyzed-project';\nimport type { RenderStage } from '../migration-pipeline';\nimport { renderedProject, type RenderedProject, type RenderedTemplateFile } from '../rendered-project';\n\nexport interface RenderTemplatePlanner {\n plan(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n renderer: ConversionRenderer,\n options: ConversionPlanningOptions,\n ): FilePlan;\n}\n\nconst defaultTemplatePlanner: RenderTemplatePlanner = Object.freeze({\n plan(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n renderer: ConversionRenderer,\n options: ConversionPlanningOptions,\n ): FilePlan {\n return new ConversionPlanner().plan(\n template.source,\n template.parseResult.elements,\n template.inputs,\n renderer,\n options,\n );\n },\n});\n\nexport class RenderProjectStage implements RenderStage {\n constructor(\n private readonly session: RenderSession,\n private readonly templatePlanner: RenderTemplatePlanner = defaultTemplatePlanner,\n ) {}\n\n public async run(analyzed: AnalyzedProject): Promise<RenderedProject> {\n const files: RenderedTemplateFile[] = [];\n const options: ConversionPlanningOptions = {\n responsiveImages: analyzed.manifest.invocation.options.responsiveImages ?? false,\n };\n\n for (const template of analyzed.templates) {\n if (template.status === 'parse-error') {\n files.push(parseErrorPlan(template));\n continue;\n }\n\n const plan = this.templatePlanner.plan(template, this.session.renderer, options);\n files.push({\n inputPath: template.file.inputPath,\n outputPath: template.file.outputPath,\n edits: plan.edits,\n results: plan.results,\n });\n }\n\n const finalizedSession = this.session.finalize();\n return renderedProject({ analyzed, target: this.session.renderer.target, files, session: finalizedSession });\n }\n}\n\nfunction parseErrorPlan(template: Extract<AnalyzedTemplate, { readonly status: 'parse-error' }>): RenderedTemplateFile {\n const results: readonly ConversionResult[] = template.parseResult.diagnostics.map(diagnostic => ({\n status: 'parse-error',\n fileName: template.file.inputPath,\n code: 'template-parse-error',\n reason: diagnostic.message,\n source: diagnostic.source,\n }));\n return {\n inputPath: template.file.inputPath,\n outputPath: template.file.outputPath,\n edits: [],\n results,\n };\n}\n","import * as path from 'node:path';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport { migrationPlan, type FileMigrationPlan, type PlannedOutputArtifact } from '../../migrator/migration-plan';\nimport { validateMigrationPaths, validateStylesheetRootTopology } from '../../migrator/migration-path.validator';\nimport { StylesheetPlanner } from '../../migrator/stylesheet.planner';\nimport type { StylesheetMigrationResult } from '../../report/migration-report.builder';\nimport type { ValidateStage } from '../migration-pipeline';\nimport type { MigrationInvocation } from '../project-manifest';\nimport { renderedProject, type RenderedProject } from '../rendered-project';\nimport { validatedProjectPlan, type ValidatedProjectPlan } from '../validated-project-plan';\nimport { CssReferenceCollector } from './css-reference.collector';\nimport { TemplateProposalValidator } from './template-proposal.validator';\n\ntype TemplateProposalValidatorPort = Pick<TemplateProposalValidator, 'validate'>;\ntype CssReferenceCollectorPort = Pick<CssReferenceCollector, 'collect'>;\ntype StylesheetPlannerPort = Pick<StylesheetPlanner, 'plan'>;\n\nexport class ValidateProjectStage implements ValidateStage {\n constructor(\n private readonly templateValidator: TemplateProposalValidatorPort = new TemplateProposalValidator(),\n private readonly cssReferences: CssReferenceCollectorPort = new CssReferenceCollector(),\n private readonly stylesheetPlanner: StylesheetPlannerPort = new StylesheetPlanner(),\n ) {}\n\n public async prevalidate(invocation: MigrationInvocation): Promise<void> {\n await validateStylesheetRootTopology({\n stylesheetPath: invocation.options.stylesheetPath,\n stylesheetPathInput: invocation.options.stylesheetPathInput,\n inputPath: invocation.canonicalInputPath,\n outputPath: invocation.canonicalOutputPath,\n reportPath: invocation.options.reportPath,\n });\n }\n\n public async run(input: RenderedProject): Promise<ValidatedProjectPlan> {\n const rendered = renderedProject(input);\n this.validateConfiguration(rendered);\n\n const stylesheetPath = rendered.analyzed.manifest.invocation.options.stylesheetPath;\n const reportPath = rendered.analyzed.manifest.invocation.options.reportPath;\n const invocation = rendered.analyzed.manifest.invocation;\n await this.prevalidate(invocation);\n await validateMigrationPaths({ templates: rendered.files, stylesheetPath, reportPath });\n\n const files: FileMigrationPlan[] = [];\n for (const [index, renderedFile] of rendered.files.entries()) {\n const template = rendered.analyzed.templates[index];\n if (template === undefined) {\n throw new MigrationApplicationError(\n 'internal-invariant',\n 'Rendered project files must match its analyzed templates one-to-one and in the same order.',\n );\n }\n files.push(await this.templateValidator.validate(template, renderedFile));\n }\n\n let stylesheetArtifact: PlannedOutputArtifact | undefined;\n let stylesheet: StylesheetMigrationResult | undefined;\n if (rendered.session.target === 'css' && stylesheetPath !== undefined) {\n const canonicalStylesheetPath = path.resolve(stylesheetPath);\n const references = await this.cssReferences.collect(rendered, files);\n stylesheetArtifact = await this.stylesheetPlanner.plan(\n canonicalStylesheetPath,\n rendered.session.rules,\n references,\n );\n stylesheet = {\n path: canonicalStylesheetPath,\n change: stylesheetChange(stylesheetArtifact),\n };\n }\n\n const plan = migrationPlan({\n target: rendered.session.target,\n files: files.map(item => item.file),\n artifacts: [\n ...files.flatMap(item => (item.artifact === undefined ? [] : [item.artifact])),\n ...(stylesheetArtifact === undefined ? [] : [stylesheetArtifact]),\n ],\n });\n await validateMigrationPaths({ templates: plan.files, stylesheetPath, reportPath });\n\n return validatedProjectPlan({ rendered, plan, ...(stylesheet === undefined ? {} : { stylesheet }) });\n }\n\n private validateConfiguration(rendered: RenderedProject): void {\n const stylesheetPath = rendered.analyzed.manifest.invocation.options.stylesheetPath;\n if (rendered.target === 'css' && stylesheetPath === undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--target css requires --stylesheet <path>.');\n }\n if (rendered.target === 'tailwind' && stylesheetPath !== undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--stylesheet can only be used with --target css.', [\n stylesheetPath,\n ]);\n }\n }\n}\n\nfunction stylesheetChange(artifact: PlannedOutputArtifact | undefined): StylesheetMigrationResult['change'] {\n if (artifact === undefined) return 'unchanged';\n if (artifact.original.status === 'absent') return 'created';\n if (artifact.proposed.status === 'absent') return 'removed';\n return 'updated';\n}\n","import * as path from 'node:path';\nimport { fileMigrationResult, type FileMigrationResult } from './file-migration-result';\n\nexport type ArtifactState = { readonly status: 'absent' } | { readonly status: 'present'; readonly contents: string };\n\nexport interface PlannedOutputArtifact {\n readonly kind: 'template' | 'stylesheet';\n readonly path: string;\n readonly original: ArtifactState;\n readonly proposed: ArtifactState;\n}\n\nexport interface FileMigrationPlan {\n readonly file: FileMigrationResult;\n readonly artifact?: PlannedOutputArtifact;\n}\n\nexport interface MigrationPlan {\n readonly target: 'css' | 'tailwind';\n readonly files: readonly FileMigrationResult[];\n readonly artifacts: readonly PlannedOutputArtifact[];\n}\n\nexport function plannedOutputArtifact(artifact: PlannedOutputArtifact): PlannedOutputArtifact {\n if (!path.isAbsolute(artifact.path)) {\n throw new Error(`Planned artifact paths must be absolute: ${artifact.path}`);\n }\n if (artifact.kind === 'template' && artifact.proposed.status === 'absent') {\n throw new Error('Planned template artifacts must have a present proposed state.');\n }\n if (sameState(artifact.original, artifact.proposed)) {\n throw new Error('Planned artifacts require changed states.');\n }\n\n return Object.freeze({\n kind: artifact.kind,\n path: path.resolve(artifact.path),\n original: artifactState(artifact.original),\n proposed: artifactState(artifact.proposed),\n });\n}\n\nexport function fileMigrationPlan(plan: FileMigrationPlan): FileMigrationPlan {\n return Object.freeze({\n file: fileMigrationResult(plan.file),\n ...(plan.artifact ? { artifact: plannedOutputArtifact(plan.artifact) } : {}),\n });\n}\n\nexport function migrationPlan(plan: MigrationPlan): MigrationPlan {\n return Object.freeze({\n target: plan.target,\n files: Object.freeze(plan.files.map(file => fileMigrationResult(file))),\n artifacts: Object.freeze(plan.artifacts.map(artifact => plannedOutputArtifact(artifact))),\n });\n}\n\nfunction artifactState(state: ArtifactState): ArtifactState {\n return Object.freeze(state.status === 'absent' ? { status: 'absent' as const } : { ...state });\n}\n\nfunction sameState(left: ArtifactState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n","import type { ConversionResult } from '../analyzer/conversion-result';\n\nexport interface FileMigrationOptions {\n readonly responsiveImages?: boolean;\n}\n\nexport interface FileMigrationResult {\n readonly inputPath: string;\n readonly outputPath: string;\n readonly changed: boolean;\n readonly results: readonly ConversionResult[];\n}\n\nexport function fileMigrationResult(result: FileMigrationResult): FileMigrationResult {\n return Object.freeze({\n inputPath: result.inputPath,\n outputPath: result.outputPath,\n changed: result.changed,\n results: freezeValue([...result.results]),\n });\n}\n\nfunction freezeValue<T>(value: T): T {\n if (Array.isArray(value)) {\n return Object.freeze(value.map(item => freezeValue(item))) as T;\n }\n if (value !== null && typeof value === 'object') {\n return Object.freeze(Object.fromEntries(Object.entries(value).map(([key, item]) => [key, freezeValue(item)]))) as T;\n }\n return value;\n}\n","import { lstat, readFile } from 'node:fs/promises';\nimport * as path from 'node:path';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport { CssStylesheetError } from '../adapter/css/stylesheet/css-stylesheet.error';\nimport type { OwnedCssReferences } from '../adapter/css/stylesheet/owned-stylesheet.merger';\nimport { MigrationApplicationError } from './migration-application.error';\nimport { plannedOutputArtifact, type ArtifactState, type PlannedOutputArtifact } from './migration-plan';\nimport { mergeStylesheetContents } from './stylesheet-contents';\n\ninterface StylesheetPlannerFileSystem {\n readonly readFile: (path: string) => Promise<string>;\n readonly lstat: (path: string) => ReturnType<typeof lstat>;\n}\n\nconst nodeFileSystem: StylesheetPlannerFileSystem = {\n readFile: target => readFile(target, 'utf8'),\n lstat,\n};\n\nexport class StylesheetPlanner {\n constructor(private readonly fileSystem: StylesheetPlannerFileSystem = nodeFileSystem) {}\n\n async plan(\n stylesheetPath: string,\n rules: readonly OwnedCssRule[],\n references: ReadonlySet<string> | OwnedCssReferences = new Set(rules.map(rule => rule.className)),\n ): Promise<PlannedOutputArtifact | undefined> {\n const outputPath = path.resolve(stylesheetPath);\n const original = await this.originalState(outputPath);\n const existing = original.status === 'present' ? original.contents : '';\n\n let merged: ReturnType<typeof mergeStylesheetContents>;\n try {\n merged = mergeStylesheetContents(existing, rules, references);\n } catch (error: unknown) {\n if (error instanceof CssStylesheetError) {\n throw new MigrationApplicationError(\n 'stylesheet-ownership-invalid',\n `Cannot safely update stylesheet ownership: ${outputPath}`,\n [outputPath],\n { cause: error },\n );\n }\n throw error;\n }\n\n const proposed = proposedState(original, merged.changed, merged.output);\n if (sameState(original, proposed)) return undefined;\n\n return plannedOutputArtifact({ kind: 'stylesheet', path: outputPath, original, proposed });\n }\n\n private async originalState(outputPath: string): Promise<ArtifactState> {\n let stat: Awaited<ReturnType<typeof lstat>>;\n try {\n stat = await this.fileSystem.lstat(outputPath);\n } catch (error: unknown) {\n if (isEnoent(error)) return { status: 'absent' };\n throw error;\n }\n\n if (stat.isSymbolicLink()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must not be a symbolic link: ${outputPath}`,\n [outputPath],\n );\n }\n if (!stat.isFile()) {\n throw new MigrationApplicationError(\n 'unsupported-path-type',\n `Stylesheet path must be a regular file: ${outputPath}`,\n [outputPath],\n );\n }\n\n return { status: 'present', contents: await this.fileSystem.readFile(outputPath) };\n }\n}\n\nfunction proposedState(original: ArtifactState, changed: boolean, output: string): ArtifactState {\n if (output === '' && (original.status === 'absent' || changed)) return { status: 'absent' };\n return { status: 'present', contents: output };\n}\n\nfunction sameState(left: ArtifactState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n","export type CssStylesheetErrorCode =\n | 'invalid-artifact'\n | 'invalid-css-lexeme'\n | 'unterminated-css-token'\n | 'unknown-ownership-marker'\n | 'unsupported-ownership-schema'\n | 'malformed-ownership-block'\n | 'ownership-rule-mismatch';\n\nexport class CssStylesheetError extends Error {\n constructor(\n readonly code: CssStylesheetErrorCode,\n message: string,\n ) {\n super(message);\n this.name = 'CssStylesheetError';\n }\n}\n","import { CssStylesheetError } from './css-stylesheet.error';\n\nexport interface CssSourceRange {\n readonly start: number;\n readonly end: number;\n}\n\nexport interface CssCommentToken extends CssSourceRange {\n readonly content: string;\n}\n\ntype ScannerState = 'normal' | 'single-quote' | 'double-quote' | 'comment';\n\nfunction cssNewlineEnd(source: string, start: number): number | undefined {\n const codeUnit = source[start];\n if (codeUnit === '\\r') return source[start + 1] === '\\n' ? start + 1 : start;\n return codeUnit === '\\n' || codeUnit === '\\f' ? start : undefined;\n}\n\nfunction isHexDigit(codeUnit: string | undefined): boolean {\n return codeUnit !== undefined && /^[0-9a-f]$/iu.test(codeUnit);\n}\n\nfunction consumeCssEscape(source: string, backslash: number): number | undefined {\n let index = backslash + 1;\n if (cssNewlineEnd(source, index) !== undefined) return undefined;\n if (!isHexDigit(source[index])) return index < source.length ? index : backslash;\n\n let hexDigits = 0;\n while (hexDigits < 6 && isHexDigit(source[index])) {\n index += 1;\n hexDigits += 1;\n }\n\n const newlineEnd = cssNewlineEnd(source, index);\n if (newlineEnd !== undefined) return newlineEnd;\n if (source[index] === ' ' || source[index] === '\\t') return index;\n return index - 1;\n}\n\nexport function scanCssComments(source: string): readonly CssCommentToken[] {\n const comments: CssCommentToken[] = [];\n let state: ScannerState = 'normal';\n let commentStart = -1;\n\n for (let index = 0; index < source.length; index += 1) {\n const codeUnit = source[index];\n\n if (state === 'normal') {\n if (codeUnit === '\\\\') {\n index = consumeCssEscape(source, index) ?? index;\n } else if (codeUnit === \"'\") {\n state = 'single-quote';\n } else if (codeUnit === '\"') {\n state = 'double-quote';\n } else if (codeUnit === '/' && source[index + 1] === '*') {\n state = 'comment';\n commentStart = index;\n index += 1;\n }\n continue;\n }\n\n if (state === 'comment') {\n if (codeUnit === '*' && source[index + 1] === '/') {\n comments.push({\n start: commentStart,\n end: index + 2,\n content: source.slice(commentStart + 2, index),\n });\n state = 'normal';\n index += 1;\n }\n continue;\n }\n\n if (codeUnit === '\\\\') {\n const newlineEnd = cssNewlineEnd(source, index + 1);\n index = newlineEnd ?? consumeCssEscape(source, index) ?? index;\n continue;\n }\n\n if ((state === 'single-quote' && codeUnit === \"'\") || (state === 'double-quote' && codeUnit === '\"')) {\n state = 'normal';\n }\n }\n\n if (state === 'comment') {\n throw new CssStylesheetError('unterminated-css-token', 'Unterminated CSS comment');\n }\n if (state === 'single-quote') {\n throw new CssStylesheetError('unterminated-css-token', 'Unterminated CSS single-quoted string');\n }\n if (state === 'double-quote') {\n throw new CssStylesheetError('unterminated-css-token', 'Unterminated CSS double-quoted string');\n }\n\n return comments;\n}\n","import type { CssStylesheetErrorCode } from './css-stylesheet.error';\nimport { scanCssComments, type CssCommentToken, type CssSourceRange } from './css-comment.scanner';\nimport type { CssNewline } from './owned-css-block.serializer';\n\nconst MARKER_PREFIX = 'flex-layout-codemod:';\nconst START_MARKER_PATTERN = /^flex-layout-codemod:start schema=([0-9]+)$/;\nconst RULE_MARKER_PATTERN = /^flex-layout-codemod:rule id=([a-f0-9]{64})$/;\nconst END_MARKER_PATTERN = /^flex-layout-codemod:end$/;\n\ninterface OwnedRuleMarker {\n readonly token: CssCommentToken;\n readonly id: string;\n}\n\nexport type OwnedCssBlockParseResult =\n | { readonly status: 'absent' }\n | { readonly status: 'found'; readonly range: CssSourceRange; readonly newline: CssNewline }\n | { readonly status: 'invalid'; readonly code: CssStylesheetErrorCode; readonly reason: string };\n\nfunction invalid(code: CssStylesheetErrorCode, reason: string): OwnedCssBlockParseResult {\n return { status: 'invalid', code, reason };\n}\n\nfunction firstNewline(source: string): CssNewline {\n const match = /\\r\\n|\\n/.exec(source);\n return match?.[0] === '\\r\\n' ? '\\r\\n' : '\\n';\n}\n\nfunction isCssWhitespace(codeUnit: string | undefined): boolean {\n return codeUnit === ' ' || codeUnit === '\\t' || codeUnit === '\\n' || codeUnit === '\\r' || codeUnit === '\\f';\n}\n\nfunction ruleSelectorMatches(source: string, marker: OwnedRuleMarker): boolean {\n let selectorStart = marker.token.end;\n while (isCssWhitespace(source[selectorStart])) selectorStart += 1;\n\n const selector = `.flm-${marker.id}`;\n if (!source.startsWith(selector, selectorStart)) return false;\n\n const boundary = source[selectorStart + selector.length];\n return boundary === '{' || isCssWhitespace(boundary);\n}\n\nexport function parseOwnedCssBlock(source: string): OwnedCssBlockParseResult {\n let start: CssCommentToken | undefined;\n let end: CssCommentToken | undefined;\n let regionOpen = false;\n const rules: OwnedRuleMarker[] = [];\n\n for (const token of scanCssComments(source)) {\n const marker = token.content.trim();\n if (!marker.startsWith(MARKER_PREFIX)) continue;\n\n const startMatch = START_MARKER_PATTERN.exec(marker);\n if (startMatch !== null) {\n const schema = startMatch[1];\n if (schema !== '1') {\n return invalid('unsupported-ownership-schema', `Unsupported flex-layout-codemod ownership schema: ${schema}`);\n }\n if (regionOpen) {\n return invalid('malformed-ownership-block', 'Nested flex-layout-codemod start marker');\n }\n if (start !== undefined) {\n return invalid('malformed-ownership-block', 'Duplicate flex-layout-codemod start marker');\n }\n if (end !== undefined) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod end marker appears before start marker');\n }\n\n start = token;\n regionOpen = true;\n continue;\n }\n\n const ruleMatch = RULE_MARKER_PATTERN.exec(marker);\n if (ruleMatch !== null) {\n if (!regionOpen) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod rule marker appears outside owned block');\n }\n\n rules.push({ token, id: ruleMatch[1] ?? '' });\n continue;\n }\n\n if (END_MARKER_PATTERN.test(marker)) {\n if (end !== undefined) {\n return invalid('malformed-ownership-block', 'Duplicate flex-layout-codemod end marker');\n }\n\n end = token;\n regionOpen = false;\n continue;\n }\n\n if (marker === `${MARKER_PREFIX}rule` || marker.startsWith(`${MARKER_PREFIX}rule `)) {\n return invalid('malformed-ownership-block', 'Malformed flex-layout-codemod rule marker');\n }\n\n return invalid('unknown-ownership-marker', 'Unknown flex-layout-codemod ownership marker');\n }\n\n if (start === undefined && end === undefined) return { status: 'absent' };\n if (start === undefined) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod end marker has no matching start marker');\n }\n if (end === undefined) {\n return invalid('malformed-ownership-block', 'Flex-layout-codemod start marker has no matching end marker');\n }\n\n for (const rule of rules) {\n if (!ruleSelectorMatches(source, rule)) {\n return invalid('ownership-rule-mismatch', 'Flex-layout-codemod rule ID does not match following selector');\n }\n }\n\n const internalSource = source.slice(start.end, end.start);\n return {\n status: 'found',\n range: { start: start.start, end: end.end },\n newline: /\\r\\n|\\n/.test(internalSource) ? firstNewline(internalSource) : firstNewline(source),\n };\n}\n","import type { CssSemanticFamily, OwnedCssRule } from '../css-artifact.model';\nimport { CssStylesheetError } from './css-stylesheet.error';\n\nconst ID = /^(?:[a-f0-9]{64})$(?![\\s\\S])/;\nconst PROPERTY = /^(?:-?[a-z][a-z0-9-]*)$(?![\\s\\S])/;\nconst FORBIDDEN_VALUE = /[\\0\\r\\n{};]|\\/\\*|\\*\\//;\nconst FAMILIES = new Set<CssSemanticFamily>([\n 'layout',\n 'layout-align',\n 'layout-gap',\n 'flex-item',\n 'flex-align',\n 'flex-fill',\n 'flex-offset',\n 'flex-order',\n]);\n\ntype ArtifactRecord = Record<string, unknown>;\n\nfunction isArtifactRecord(value: unknown): value is ArtifactRecord {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction invalidArtifact(message: string): never {\n throw new CssStylesheetError('invalid-artifact', message);\n}\n\nfunction invalidLexeme(message: string): never {\n throw new CssStylesheetError('invalid-css-lexeme', message);\n}\n\nfunction validateDeclarations(value: unknown): void {\n if (!Array.isArray(value) || value.length === 0) {\n invalidArtifact('CSS declarations must be a nonempty array');\n }\n\n const properties = new Set<string>();\n for (const declaration of value) {\n if (!isArtifactRecord(declaration)) {\n invalidArtifact('CSS declaration must be an object');\n }\n\n const { property, value: declarationValue } = declaration;\n if (typeof property !== 'string' || !PROPERTY.test(property)) {\n invalidLexeme('CSS declaration property is unsafe');\n }\n if (properties.has(property)) {\n invalidArtifact('CSS declaration properties must be unique');\n }\n properties.add(property);\n\n if (\n typeof declarationValue !== 'string' ||\n declarationValue.length === 0 ||\n declarationValue.trim() !== declarationValue ||\n FORBIDDEN_VALUE.test(declarationValue)\n ) {\n invalidLexeme('CSS declaration value is unsafe');\n }\n }\n}\n\nfunction validateMedia(value: unknown): void {\n if (!isArtifactRecord(value)) {\n invalidArtifact('CSS media must be an object');\n }\n\n const { type, clauses } = value;\n if (type !== 'screen' && type !== 'print') {\n invalidArtifact('CSS media type is invalid');\n }\n if (!Array.isArray(clauses) || clauses.length === 0) {\n invalidArtifact('CSS media must contain at least one clause');\n }\n\n for (const clause of clauses) {\n if (!isArtifactRecord(clause)) {\n invalidArtifact('CSS media clause must be an object');\n }\n\n const { min, max, orientation } = clause;\n if (\n (min !== undefined && (typeof min !== 'number' || !Number.isFinite(min))) ||\n (max !== undefined && (typeof max !== 'number' || !Number.isFinite(max)))\n ) {\n invalidArtifact('CSS media bounds must be finite numbers');\n }\n if (min !== undefined && max !== undefined && min > max) {\n invalidArtifact('CSS media minimum must not exceed maximum');\n }\n if (orientation !== undefined && orientation !== 'portrait' && orientation !== 'landscape') {\n invalidArtifact('CSS media orientation is invalid');\n }\n if (type === 'screen' && min === undefined && max === undefined && orientation === undefined) {\n invalidArtifact('CSS screen media clause must contain a feature');\n }\n }\n}\n\nfunction validateContext(value: unknown): void {\n if (!isArtifactRecord(value)) {\n invalidArtifact('CSS rule context must be an object');\n }\n\n const { priority, media } = value;\n if (typeof priority !== 'number' || !Number.isFinite(priority)) {\n invalidArtifact('CSS rule priority must be a finite number');\n }\n if (media === undefined) {\n if (priority !== 0) {\n invalidArtifact('CSS base rule priority must be zero');\n }\n return;\n }\n\n validateMedia(media);\n}\n\nexport function validateOwnedCssRule(rule: OwnedCssRule): void {\n if (!isArtifactRecord(rule)) {\n invalidArtifact('CSS rule must be an object');\n }\n\n const { owner, id, className, family, declarations, context } = rule;\n if (owner !== 'flex-layout-codemod') {\n invalidArtifact('CSS rule owner is invalid');\n }\n if (typeof id !== 'string' || !ID.test(id)) {\n invalidArtifact('CSS rule ID is invalid');\n }\n if (className !== `flm-${id}`) {\n invalidArtifact('CSS rule class name is invalid');\n }\n if (typeof family !== 'string' || !FAMILIES.has(family as CssSemanticFamily)) {\n invalidArtifact('CSS rule family is invalid');\n }\n\n validateDeclarations(declarations);\n validateContext(context);\n}\n","import type { MediaDefinition, MediaRange } from '../../../breakpoint/breakpoint-catalog';\n\nfunction serializeClause(type: MediaDefinition['type'], clause: MediaRange): string {\n const features: string[] = [];\n if (clause.min !== undefined) features.push(`(min-width: ${String(clause.min)}px)`);\n if (clause.max !== undefined) features.push(`(max-width: ${String(clause.max)}px)`);\n if (clause.orientation !== undefined) features.push(`(orientation: ${clause.orientation})`);\n\n return [type, ...features].join(' and ');\n}\n\nexport function serializeCssMedia(media: MediaDefinition): string {\n return media.clauses.map(clause => serializeClause(media.type, clause)).join(', ');\n}\n","import type { OwnedCssRule } from '../css-artifact.model';\nimport type { MediaDefinition } from '../../../breakpoint/breakpoint-catalog';\nimport { validateOwnedCssRule } from './css-artifact.validator';\nimport { CssStylesheetError } from './css-stylesheet.error';\nimport { serializeCssMedia } from './css-media.serializer';\n\nexport type CssNewline = '\\n' | '\\r\\n';\n\ninterface BaseRuleGroup {\n readonly kind: 'base';\n readonly rule: OwnedCssRule;\n}\n\ninterface ResponsiveGroup {\n readonly kind: 'responsive';\n readonly key: string;\n readonly media: MediaDefinition;\n readonly rules: readonly OwnedCssRule[];\n}\n\ntype RuleGroup = BaseRuleGroup | ResponsiveGroup;\n\nfunction validateNewline(newline: CssNewline): void {\n if (newline !== '\\n' && newline !== '\\r\\n') {\n throw new CssStylesheetError('invalid-artifact', 'CSS newline must be LF or CRLF');\n }\n}\n\nfunction mediaGroupKey(rule: OwnedCssRule): string {\n const media = rule.context.media;\n if (media === undefined) throw new CssStylesheetError('invalid-artifact', 'CSS responsive rule media is required');\n\n return JSON.stringify([\n media.type,\n media.clauses.map(clause => [clause.min ?? null, clause.max ?? null, clause.orientation ?? null]),\n rule.context.priority,\n ]);\n}\n\nfunction serializeBaseRule(rule: OwnedCssRule, newline: CssNewline): string {\n return [\n `/* flex-layout-codemod:rule id=${rule.id} */`,\n `.${rule.className} {`,\n ...rule.declarations.map(({ property, value }) => ` ${property}: ${value};`),\n '}',\n ].join(newline);\n}\n\nfunction serializeResponsiveGroup(group: ResponsiveGroup, newline: CssNewline): string {\n const rules = group.rules\n .map(rule =>\n serializeBaseRule(rule, newline)\n .split(newline)\n .map(line => ` ${line}`)\n .join(newline),\n )\n .join(newline);\n\n return [`@media ${serializeCssMedia(group.media)} {`, rules, '}'].join(newline);\n}\n\nexport function serializeCssRules(rules: readonly OwnedCssRule[], newline: CssNewline): string {\n validateNewline(newline);\n rules.forEach(validateOwnedCssRule);\n\n const groups: RuleGroup[] = [];\n for (const rule of rules) {\n if (rule.context.media === undefined) {\n groups.push({ kind: 'base', rule });\n continue;\n }\n\n const key = mediaGroupKey(rule);\n const previous = groups.at(-1);\n if (previous?.kind === 'responsive' && previous.key === key) {\n groups[groups.length - 1] = { ...previous, rules: [...previous.rules, rule] };\n continue;\n }\n\n groups.push({ kind: 'responsive', key, media: rule.context.media, rules: [rule] });\n }\n\n return groups\n .map(group =>\n group.kind === 'responsive' ? serializeResponsiveGroup(group, newline) : serializeBaseRule(group.rule, newline),\n )\n .join(newline);\n}\n","import type { OwnedCssRule } from '../css-artifact.model';\nimport { serializeCssRules, type CssNewline } from './css-rule.serializer';\n\nconst START_MARKER = '/* flex-layout-codemod:start schema=1 */';\nconst END_MARKER = '/* flex-layout-codemod:end */';\n\nexport { type CssNewline } from './css-rule.serializer';\n\nexport function serializeOwnedCssBlock(rules: readonly OwnedCssRule[], newline: CssNewline): string {\n const serializedRules = serializeCssRules(rules, newline);\n if (serializedRules === '') return '';\n\n return [START_MARKER, serializedRules, END_MARKER].join(newline);\n}\n","import type { CssRuleContext, OwnedCssRule } from '../css-artifact.model';\nimport { CssStylesheetError } from './css-stylesheet.error';\nimport { parseOwnedCssBlock } from './owned-css-block.parser';\nimport { serializeOwnedCssBlock, type CssNewline } from './owned-css-block.serializer';\nimport { serializeCssRules } from './css-rule.serializer';\nimport { serializeCssMedia } from './css-media.serializer';\n\nexport interface OwnedStylesheetMergeResult {\n readonly changed: boolean;\n readonly output: string;\n}\n\n/**\n * Template reference authority collected at the invocation boundary.\n * `complete: false` means a dynamic class expression prevented a complete scan.\n * The default merger retains unmatched rules regardless; completeness is not a pruning grant.\n */\nexport interface OwnedCssReferences {\n readonly classNames: ReadonlySet<string>;\n readonly complete: boolean;\n}\n\n/** Resolves a serialized media query from an existing owned block. */\nexport type RetainedMediaContextResolver = (serializedMedia: string) => CssRuleContext | undefined;\n\ninterface ParsedOwnedRule {\n readonly id: string;\n readonly source: string;\n}\n\ninterface ResolvedOwnedRule extends ParsedOwnedRule {\n readonly context: CssRuleContext;\n}\n\ninterface ParsedOwnedRuleGroup {\n readonly serializedMedia?: string;\n readonly rules: readonly ParsedOwnedRule[];\n}\n\nconst START_MARKER = '/* flex-layout-codemod:start schema=1 */';\nconst END_MARKER = '/* flex-layout-codemod:end */';\nconst RULE_MARKER = /^\\/\\* flex-layout-codemod:rule id=([a-f0-9]{64}) \\*\\/$/u;\n\nfunction malformed(message: string): never {\n throw new CssStylesheetError('malformed-ownership-block', message);\n}\n\nfunction parseRule(\n lines: readonly string[],\n index: number,\n indentation: string,\n newline: CssNewline,\n): {\n readonly rule: ParsedOwnedRule;\n readonly nextIndex: number;\n} {\n const marker = lines[index];\n const match = marker?.slice(indentation.length).match(RULE_MARKER);\n if (marker === undefined || !match || !marker.startsWith(indentation)) {\n malformed('Owned CSS rule does not use the schema-1 serialized form');\n }\n const id = match[1];\n if (id === undefined || lines[index + 1] !== `${indentation}.flm-${id} {`) {\n malformed('Owned CSS rule ID does not match its serialized selector');\n }\n\n let end = index + 2;\n while (lines[end] !== `${indentation}}`) {\n if (lines[end] === undefined) malformed('Owned CSS rule is missing its closing brace');\n end += 1;\n }\n\n return {\n rule: { id, source: lines.slice(index, end + 1).join(newline) },\n nextIndex: end + 1,\n };\n}\n\nfunction parseOwnedRuleGroups(source: string): readonly ParsedOwnedRuleGroup[] {\n const parsed = parseOwnedCssBlock(source);\n if (parsed.status === 'invalid') throw new CssStylesheetError(parsed.code, parsed.reason);\n if (parsed.status === 'absent') return [];\n\n const block = source.slice(parsed.range.start, parsed.range.end);\n const internal = block.slice(START_MARKER.length, -END_MARKER.length);\n const lines = internal.split(parsed.newline);\n if (lines[0] === '') lines.shift();\n if (lines.at(-1) === '') lines.pop();\n\n const groups: ParsedOwnedRuleGroup[] = [];\n for (let index = 0; index < lines.length;) {\n const line = lines[index];\n if (line === undefined) malformed('Owned CSS block ended unexpectedly');\n if (line.startsWith('@media ') && line.endsWith(' {')) {\n const start = line;\n index += 1;\n const rules: ParsedOwnedRule[] = [];\n while (lines[index] !== '}') {\n const parsedRule = parseRule(lines, index, ' ', parsed.newline);\n rules.push(parsedRule.rule);\n index = parsedRule.nextIndex;\n }\n if (rules.length === 0) malformed('Owned CSS media group contains no rules');\n groups.push({ serializedMedia: start.slice('@media '.length, -' {'.length), rules });\n index += 1;\n continue;\n }\n\n const parsedRule = parseRule(lines, index, '', parsed.newline);\n groups.push({ rules: [parsedRule.rule] });\n index = parsedRule.nextIndex;\n }\n\n return groups;\n}\n\nfunction retainedRules(\n groups: readonly ParsedOwnedRuleGroup[],\n retainedIds: ReadonlySet<string>,\n resolveRetainedMediaContext: RetainedMediaContextResolver,\n): readonly ResolvedOwnedRule[] {\n const retained: ResolvedOwnedRule[] = [];\n for (const group of groups) {\n const rules = group.rules.filter(rule => retainedIds.has(rule.id));\n if (rules.length === 0) continue;\n const context =\n group.serializedMedia === undefined ? { priority: 0 } : resolveRetainedMediaContext(group.serializedMedia);\n if (context === undefined)\n malformed(`Owned CSS media query is not a registered breakpoint: ${group.serializedMedia}`);\n retained.push(...rules.map(rule => ({ ...rule, context })));\n }\n return retained;\n}\n\nfunction firstDocumentNewline(source: string): CssNewline {\n return /\\r\\n|\\n/.exec(source)?.[0] === '\\r\\n' ? '\\r\\n' : '\\n';\n}\n\nfunction compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nfunction compareRuleFragments(left: ResolvedOwnedRule, right: ResolvedOwnedRule): number {\n const mediaOrder = Number(left.context.media !== undefined) - Number(right.context.media !== undefined);\n if (mediaOrder !== 0) return mediaOrder;\n const priorityOrder = right.context.priority - left.context.priority;\n return priorityOrder === 0 ? compareCodeUnits(left.id, right.id) : priorityOrder;\n}\n\nfunction mediaKey(context: CssRuleContext): string | undefined {\n return context.media === undefined\n ? undefined\n : JSON.stringify([context.media.type, context.media.clauses, context.priority]);\n}\n\nfunction parsedIncomingRules(rules: readonly OwnedCssRule[], newline: CssNewline): readonly ResolvedOwnedRule[] {\n return rules.map(rule => {\n const serialized = serializeCssRules([rule], newline);\n if (rule.context.media === undefined) return { id: rule.id, source: serialized, context: rule.context };\n\n const lines = serialized.split(newline);\n const source = lines\n .slice(1, -1)\n .map(line => {\n if (!line.startsWith(' ')) malformed('Incoming CSS rule does not use the serialized form');\n return line;\n })\n .join(newline);\n return { id: rule.id, source, context: rule.context };\n });\n}\n\nfunction renderCanonicalRules(rules: readonly ResolvedOwnedRule[], newline: CssNewline): string {\n const groups: string[] = [];\n for (let index = 0; index < rules.length;) {\n const rule = rules[index];\n if (rule === undefined) break;\n if (rule.context.media === undefined) {\n groups.push(rule.source);\n index += 1;\n continue;\n }\n const key = mediaKey(rule.context);\n const grouped: ResolvedOwnedRule[] = [];\n let candidate = rules[index];\n while (candidate !== undefined && mediaKey(candidate.context) === key) {\n grouped.push(candidate);\n index += 1;\n candidate = rules[index];\n }\n groups.push(\n [`@media ${serializeCssMedia(rule.context.media)} {`, grouped.map(item => item.source).join(newline), '}'].join(\n newline,\n ),\n );\n }\n return groups.join(newline);\n}\n\nfunction normalizeReferences(references?: ReadonlySet<string> | OwnedCssReferences): OwnedCssReferences {\n if (references === undefined) return { classNames: new Set(), complete: false };\n return 'classNames' in references ? references : { classNames: references, complete: true };\n}\n\nexport function mergeOwnedStylesheet(\n existing: string,\n rules: readonly OwnedCssRule[],\n references?: ReadonlySet<string> | OwnedCssReferences,\n resolveRetainedMediaContext: RetainedMediaContextResolver = () => undefined,\n): OwnedStylesheetMergeResult {\n const parsed = parseOwnedCssBlock(existing);\n if (parsed.status === 'invalid') throw new CssStylesheetError(parsed.code, parsed.reason);\n\n const newline = parsed.status === 'found' ? parsed.newline : firstDocumentNewline(existing);\n const referenceState = normalizeReferences(references);\n const groups = parseOwnedRuleGroups(existing);\n const existingIds = new Set(groups.flatMap(group => group.rules.map(rule => rule.id)));\n const incomingIds = new Set(rules.map(rule => rule.id));\n for (const className of referenceState.classNames) {\n const id = className.slice('flm-'.length);\n if (!existingIds.has(id) && !incomingIds.has(id)) {\n throw new CssStylesheetError('ownership-rule-mismatch', `No owned CSS rule matches ${className}`);\n }\n }\n const retainedIds = new Set([...existingIds].filter(id => !incomingIds.has(id)));\n const retained = retainedRules(groups, retainedIds, resolveRetainedMediaContext);\n const incoming = parsedIncomingRules(rules, newline);\n const content = [...retained, ...incoming].sort(compareRuleFragments);\n if (rules.length === 0 && retained.length === groups.flatMap(group => group.rules).length) {\n return Object.freeze({ changed: false, output: existing });\n }\n const serialized = renderCanonicalRules(content, newline);\n const block =\n serialized === ''\n ? ''\n : retained.length === 0\n ? serializeOwnedCssBlock(rules, newline)\n : [START_MARKER, serialized, END_MARKER].join(newline);\n const output =\n parsed.status === 'found'\n ? existing.slice(0, parsed.range.start) + block + existing.slice(parsed.range.end)\n : existing + block;\n\n return Object.freeze({ changed: output !== existing, output });\n}\n","import { allBreakpointDefinitions } from '../breakpoint/breakpoint-catalog';\nimport { cssRuleContext } from '../adapter/css/css-breakpoint.context';\nimport type { OwnedCssRule } from '../adapter/css/css-artifact.model';\nimport {\n mergeOwnedStylesheet,\n type OwnedCssReferences,\n type OwnedStylesheetMergeResult,\n type RetainedMediaContextResolver,\n} from '../adapter/css/stylesheet/owned-stylesheet.merger';\nimport { serializeCssMedia } from '../adapter/css/stylesheet/css-media.serializer';\n\nconst retainedMediaContexts = new Map(\n allBreakpointDefinitions().map(definition => [serializeCssMedia(definition.media), cssRuleContext(definition)]),\n);\n\nconst resolveRetainedMediaContext: RetainedMediaContextResolver = media => retainedMediaContexts.get(media);\n\nexport function mergeStylesheetContents(\n existing: string,\n rules: readonly OwnedCssRule[],\n references: ReadonlySet<string> | OwnedCssReferences = new Set(rules.map(rule => rule.className)),\n): OwnedStylesheetMergeResult {\n return mergeOwnedStylesheet(existing, rules, references, resolveRetainedMediaContext);\n}\n","import * as path from 'node:path';\nimport { fileMigrationResult, type FileMigrationResult } from '../migrator/file-migration-result';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport { migrationPlan, type MigrationPlan, type PlannedOutputArtifact } from '../migrator/migration-plan';\nimport type { StylesheetMigrationResult } from '../report/migration-report.builder';\nimport { renderedProject, type RenderedProject, type RenderedTemplateFile } from './rendered-project';\n\nexport interface ValidatedProjectPlan {\n readonly rendered: RenderedProject;\n readonly plan: MigrationPlan;\n readonly stylesheet?: StylesheetMigrationResult;\n}\n\nexport function validatedProjectPlan(project: ValidatedProjectPlan): ValidatedProjectPlan {\n const rendered = renderedProject(project.rendered);\n if (rendered.target !== rendered.session.target) {\n throw internalInvariant(\n `Render session finalized for target \"${rendered.session.target}\" but its renderer targets \"${rendered.target}\".`,\n );\n }\n\n const suppliedPlan = migrationPlan(project.plan);\n if (suppliedPlan.target !== rendered.session.target) {\n throw internalInvariant('Validated migration plan target differs from its finalized adapter session target.');\n }\n\n const plan = canonicalPlan(rendered, suppliedPlan);\n const templateArtifacts = validatedTemplateArtifacts(plan.files, plan.artifacts);\n const stylesheet = validatedStylesheet(rendered, plan, templateArtifacts, project.stylesheet);\n\n return Object.freeze({\n rendered,\n plan,\n ...(stylesheet === undefined ? {} : { stylesheet }),\n });\n}\n\nfunction canonicalPlan(rendered: RenderedProject, supplied: MigrationPlan): MigrationPlan {\n if (supplied.files.length !== rendered.files.length) throw fileCongruenceInvariant();\n const files = supplied.files.map((file, index) => {\n const expected = rendered.files[index];\n if (expected === undefined || !samePathPair(expected, file)) throw fileCongruenceInvariant();\n const canonical = fileMigrationResult({\n ...file,\n inputPath: expected.inputPath,\n outputPath: expected.outputPath,\n });\n if (!validResults(expected, canonical)) throw fileCongruenceInvariant();\n return canonical;\n });\n if (new Set(files.map(file => normalizedAbsolutePath(file.outputPath))).size !== files.length) {\n throw fileCongruenceInvariant();\n }\n\n return migrationPlan({ target: supplied.target, files, artifacts: supplied.artifacts });\n}\n\nfunction validResults(rendered: RenderedTemplateFile, planned: FileMigrationResult): boolean {\n if (sameOwnedValue(planned.results, rendered.results)) return true;\n return (\n rendered.edits.length > 0 &&\n planned.changed === false &&\n planned.results.length > 0 &&\n planned.results.every(\n result =>\n result.status === 'parse-error' &&\n result.code === 'generated-template-parse-error' &&\n normalizedAbsolutePath(result.fileName) === normalizedAbsolutePath(rendered.outputPath),\n )\n );\n}\n\nfunction validatedTemplateArtifacts(\n files: readonly FileMigrationResult[],\n artifacts: readonly PlannedOutputArtifact[],\n): readonly PlannedOutputArtifact[] {\n const templateArtifacts = artifacts.filter(artifact => artifact.kind === 'template');\n const changedFiles = files.filter(file => file.changed);\n if (\n templateArtifacts.length !== changedFiles.length ||\n templateArtifacts.some(\n (artifact, index) =>\n artifact.proposed.status !== 'present' ||\n normalizedAbsolutePath(artifact.path) !== normalizedAbsolutePath(changedFiles[index]?.outputPath ?? ''),\n )\n ) {\n throw internalInvariant(\n 'Validated migration plan template artifacts must correspond exactly to changed file outputs in file order.',\n );\n }\n return templateArtifacts;\n}\n\nfunction validatedStylesheet(\n rendered: RenderedProject,\n plan: MigrationPlan,\n templateArtifacts: readonly PlannedOutputArtifact[],\n supplied: StylesheetMigrationResult | undefined,\n): StylesheetMigrationResult | undefined {\n const nonTemplateArtifacts = plan.artifacts.filter(artifact => artifact.kind !== 'template');\n const configuredPath = rendered.analyzed.manifest.invocation.options.stylesheetPath;\n if (rendered.session.target === 'tailwind') {\n if (\n configuredPath !== undefined ||\n supplied !== undefined ||\n nonTemplateArtifacts.length > 0 ||\n !sameArtifactSequence(plan.artifacts, templateArtifacts)\n ) {\n throw internalInvariant('Tailwind migration plans cannot contain stylesheet artifacts or metadata.');\n }\n return undefined;\n }\n\n const stylesheetArtifact = nonTemplateArtifacts.length === 1 ? nonTemplateArtifacts[0] : undefined;\n const canonicalConfiguredPath =\n configuredPath === undefined || configuredPath.trim().length === 0\n ? undefined\n : normalizedAbsolutePath(configuredPath);\n const expectedChange = stylesheetArtifact === undefined ? 'unchanged' : stylesheetChange(stylesheetArtifact);\n const expectedArtifacts = [...templateArtifacts, ...(stylesheetArtifact === undefined ? [] : [stylesheetArtifact])];\n\n if (\n canonicalConfiguredPath !== undefined &&\n (plan.files.some(\n file =>\n normalizedAbsolutePath(file.inputPath) === canonicalConfiguredPath ||\n normalizedAbsolutePath(file.outputPath) === canonicalConfiguredPath,\n ) ||\n templateArtifacts.some(artifact => normalizedAbsolutePath(artifact.path) === canonicalConfiguredPath))\n ) {\n throw internalInvariant(\n 'Configured stylesheet path must not collide with any template input, output, or artifact path.',\n );\n }\n\n if (\n canonicalConfiguredPath === undefined ||\n supplied === undefined ||\n nonTemplateArtifacts.length > 1 ||\n (stylesheetArtifact !== undefined && stylesheetArtifact.kind !== 'stylesheet') ||\n normalizedAbsolutePath(supplied.path) !== canonicalConfiguredPath ||\n (stylesheetArtifact !== undefined && normalizedAbsolutePath(stylesheetArtifact.path) !== canonicalConfiguredPath) ||\n supplied.change !== expectedChange ||\n !sameArtifactSequence(plan.artifacts, expectedArtifacts)\n ) {\n throw internalInvariant(\n 'CSS stylesheet metadata must correspond exactly to its configured path and artifact change state.',\n );\n }\n\n return Object.freeze({ path: canonicalConfiguredPath, change: supplied.change });\n}\n\nfunction stylesheetChange(artifact: PlannedOutputArtifact): StylesheetMigrationResult['change'] {\n if (artifact.original.status === 'absent') return 'created';\n if (artifact.proposed.status === 'absent') return 'removed';\n return 'updated';\n}\n\nfunction sameArtifactSequence(\n left: readonly PlannedOutputArtifact[],\n right: readonly PlannedOutputArtifact[],\n): boolean {\n return left.length === right.length && left.every((artifact, index) => sameArtifact(artifact, right[index]));\n}\n\nfunction sameArtifact(left: PlannedOutputArtifact, right: PlannedOutputArtifact | undefined): boolean {\n return (\n right !== undefined &&\n left.kind === right.kind &&\n normalizedAbsolutePath(left.path) === normalizedAbsolutePath(right.path) &&\n sameOwnedValue(left.original, right.original) &&\n sameOwnedValue(left.proposed, right.proposed)\n );\n}\n\nfunction samePathPair(left: RenderedTemplateFile, right: FileMigrationResult): boolean {\n return (\n normalizedAbsolutePath(left.inputPath) === normalizedAbsolutePath(right.inputPath) &&\n normalizedAbsolutePath(left.outputPath) === normalizedAbsolutePath(right.outputPath)\n );\n}\n\nfunction sameOwnedValue(left: unknown, right: unknown): boolean {\n if (Object.is(left, right)) return true;\n if (Array.isArray(left) || Array.isArray(right)) {\n return (\n Array.isArray(left) &&\n Array.isArray(right) &&\n left.length === right.length &&\n left.every((item, index) => sameOwnedValue(item, right[index]))\n );\n }\n if (!isPlainRecord(left) || !isPlainRecord(right)) return false;\n const keys = Object.keys(left);\n return (\n keys.length === Object.keys(right).length &&\n keys.every(key => Object.hasOwn(right, key) && sameOwnedValue(left[key], right[key]))\n );\n}\n\nfunction isPlainRecord(value: unknown): value is Readonly<Record<string, unknown>> {\n if (value === null || typeof value !== 'object') return false;\n const prototype = Object.getPrototypeOf(value) as unknown;\n return prototype === Object.prototype || prototype === null;\n}\n\nfunction normalizedAbsolutePath(value: string): string {\n return path.normalize(path.resolve(value));\n}\n\nfunction fileCongruenceInvariant(): MigrationApplicationError {\n return internalInvariant(\n 'Validated migration plan files must match rendered files one-to-one and in the same order.',\n );\n}\n\nfunction internalInvariant(message: string): MigrationApplicationError {\n return new MigrationApplicationError('internal-invariant', message);\n}\n","import * as path from 'node:path';\nimport type { OwnedCssReferences } from '../../adapter/css/stylesheet/owned-stylesheet.merger';\nimport {\n nodeDestinationTemplateSource,\n type DestinationTemplateSource,\n} from '../../migrator/destination-template-source';\nimport { MigrationApplicationError } from '../../migrator/migration-application.error';\nimport type { FileMigrationPlan } from '../../migrator/migration-plan';\nimport { AngularTemplateParser } from '../../template/angular-template.parser';\nimport { templateAttributeKeys } from '../../template/template-attribute';\nimport type { TemplateParser } from '../analyze/template-parser.port';\nimport type { RenderedProject } from '../rendered-project';\n\ninterface TemplateReferenceSource {\n readonly contents: string;\n readonly complete: boolean;\n}\n\nexport class CssReferenceCollector {\n constructor(\n private readonly referenceParser: TemplateParser = new AngularTemplateParser(),\n private readonly destinationTemplates: DestinationTemplateSource = nodeDestinationTemplateSource,\n ) {}\n\n public async collect(rendered: RenderedProject, files: readonly FileMigrationPlan[]): Promise<OwnedCssReferences> {\n if (files.length !== rendered.analyzed.templates.length) throw fileCongruenceInvariant();\n\n const destinationSources = new Map<string, Promise<TemplateReferenceSource>>();\n const templates = await Promise.all(\n files.map(async (file, index) => {\n const analyzedTemplate = rendered.analyzed.templates[index];\n if (analyzedTemplate === undefined) throw fileCongruenceInvariant();\n if (file.artifact?.kind === 'template' && file.artifact.proposed.status === 'present') {\n return { contents: file.artifact.proposed.contents, complete: true };\n }\n if (path.resolve(file.file.inputPath) === path.resolve(file.file.outputPath)) {\n return { contents: analyzedTemplate.source, complete: true };\n }\n\n const outputPath = path.normalize(path.resolve(file.file.outputPath));\n const existing = destinationSources.get(outputPath);\n if (existing !== undefined) return existing;\n const pending = this.readDestination(outputPath);\n destinationSources.set(outputPath, pending);\n return pending;\n }),\n );\n\n const classNames = new Set<string>();\n let complete = true;\n for (const template of templates) {\n complete &&= template.complete;\n const parsed = this.referenceParser.parse(template.contents, 'proposed-template.html');\n if (parsed.status === 'parse-error') {\n complete = false;\n continue;\n }\n for (const attribute of parsed.elements.flatMap(element => element.attributes)) {\n const ngClassAuthority = [...templateAttributeKeys(attribute)].some(\n key => key === 'ngclass' || key.startsWith('ngclass.'),\n );\n const literalClass = attribute.name === 'class' && attribute.binding === 'literal';\n const namedClassBinding = attribute.binding === 'property' && attribute.bindingTarget === 'class';\n const dynamicClass =\n attribute.binding === 'property' && (attribute.name === 'class' || attribute.name === 'className');\n if (!literalClass && !namedClassBinding && !dynamicClass && !ngClassAuthority) continue;\n\n if (literalClass || (ngClassAuthority && attribute.binding === 'literal')) {\n for (const className of attribute.value.split(/\\s+/u)) {\n if (isGeneratedCssClassName(className)) classNames.add(className);\n }\n }\n if (namedClassBinding) {\n const className = namedGeneratedClassName(attribute.name);\n if (className !== undefined) classNames.add(className);\n }\n if (\n dynamicClass ||\n ngClassAuthority ||\n `${attribute.value} ${attribute.rawValue}`.includes('{{') ||\n `${attribute.value} ${attribute.rawValue}`.includes('}}')\n ) {\n complete = false;\n }\n }\n }\n\n return Object.freeze({ classNames, complete });\n }\n\n private async readDestination(outputPath: string): Promise<TemplateReferenceSource> {\n try {\n return { contents: await this.destinationTemplates.read(outputPath), complete: true };\n } catch (error: unknown) {\n if (isEnoent(error)) return { contents: '', complete: false };\n throw error;\n }\n }\n}\n\nfunction fileCongruenceInvariant(): MigrationApplicationError {\n return new MigrationApplicationError(\n 'internal-invariant',\n 'Rendered file plans must match analyzed templates one-to-one and in the same order.',\n );\n}\n\nfunction isGeneratedCssClassName(className: string): boolean {\n return /^flm-[a-f0-9]{64}$/u.test(className);\n}\n\nfunction namedGeneratedClassName(name: string): string | undefined {\n return isGeneratedCssClassName(name) ? name : undefined;\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n","import { readFile } from 'node:fs/promises';\n\nexport interface DestinationTemplateSource {\n read(path: string): Promise<string>;\n}\n\nexport const nodeDestinationTemplateSource: DestinationTemplateSource = Object.freeze({\n read: (path: string) => readFile(path, 'utf8'),\n});\n","import type { ConversionResult } from '../analyzer/conversion-result';\nimport type { TemplateParser } from '../pipeline/analyze/template-parser.port';\nimport { AngularTemplateParser } from './angular-template.parser';\n\n/** Browser and CLI share the same generated Angular acceptance boundary. */\nexport function generatedTemplateErrors(\n source: string,\n fileName: string,\n parser: TemplateParser = new AngularTemplateParser(),\n): readonly ConversionResult[] {\n const parsed = parser.parse(source, fileName);\n return parsed.status === 'parse-error'\n ? parsed.diagnostics.map(diagnostic => ({\n status: 'parse-error',\n fileName,\n code: 'generated-template-parse-error',\n reason: diagnostic.message,\n source: diagnostic.source,\n }))\n : [];\n}\n","import { generatedTemplateErrors } from '../../template/generated-template-validation';\nimport * as path from 'node:path';\nimport type { ConversionResult } from '../../analyzer/conversion-result';\nimport { SourceEditor } from '../../edit/source-editor';\nimport { fileMigrationResult, type FileMigrationResult } from '../../migrator/file-migration-result';\nimport {\n nodeDestinationTemplateSource,\n type DestinationTemplateSource,\n} from '../../migrator/destination-template-source';\nimport {\n fileMigrationPlan,\n plannedOutputArtifact,\n type ArtifactState,\n type FileMigrationPlan,\n} from '../../migrator/migration-plan';\nimport { AngularTemplateParser } from '../../template/angular-template.parser';\nimport type { TemplateParser } from '../analyze/template-parser.port';\nimport type { AnalyzedTemplate } from '../analyzed-project';\nimport type { RenderedTemplateFile } from '../rendered-project';\n\nexport class TemplateProposalValidator {\n constructor(\n private readonly validationParser: TemplateParser = new AngularTemplateParser(),\n private readonly destinationTemplates: DestinationTemplateSource = nodeDestinationTemplateSource,\n ) {}\n\n public async validate(template: AnalyzedTemplate, rendered: RenderedTemplateFile): Promise<FileMigrationPlan> {\n if (template.status === 'parse-error') return planResult(template, rendered, false, rendered.results);\n\n const edited = new SourceEditor().apply(template.source, rendered.edits);\n if (edited.status === 'invalid') {\n throw new Error(\n `Invalid edit plan for ${template.file.inputPath}: ${edited.diagnostics.map(item => item.message).join('; ')}`,\n );\n }\n\n if (edited.output === template.source) return planResult(template, rendered, false, rendered.results);\n\n const errors = generatedTemplateErrors(edited.output, template.file.outputPath, this.validationParser);\n if (errors.length) return planResult(template, rendered, false, errors);\n\n const original = await originalState(template, this.destinationTemplates);\n const proposed: ArtifactState = { status: 'present', contents: edited.output };\n if (sameState(original, proposed)) return planResult(template, rendered, false, rendered.results);\n\n return fileMigrationPlan({\n file: result(template, rendered, true, rendered.results),\n artifact: plannedOutputArtifact({\n kind: 'template',\n path: path.normalize(path.resolve(template.file.outputPath)),\n original,\n proposed,\n }),\n });\n }\n}\n\nasync function originalState(\n template: Extract<AnalyzedTemplate, { readonly status: 'parsed' }>,\n destinationTemplates: DestinationTemplateSource,\n): Promise<ArtifactState> {\n if (path.resolve(template.file.inputPath) === path.resolve(template.file.outputPath)) {\n return { status: 'present', contents: template.source };\n }\n\n try {\n return { status: 'present', contents: await destinationTemplates.read(template.file.outputPath) };\n } catch (error: unknown) {\n if (isEnoent(error)) return { status: 'absent' };\n throw error;\n }\n}\n\nfunction planResult(\n template: AnalyzedTemplate,\n rendered: RenderedTemplateFile,\n changed: boolean,\n results: readonly ConversionResult[],\n): FileMigrationPlan {\n return fileMigrationPlan({ file: result(template, rendered, changed, results) });\n}\n\nfunction result(\n template: AnalyzedTemplate,\n rendered: RenderedTemplateFile,\n changed: boolean,\n results: readonly ConversionResult[],\n): FileMigrationResult {\n return fileMigrationResult({\n inputPath: template.file.inputPath,\n outputPath: rendered.outputPath,\n changed,\n results,\n });\n}\n\nfunction isEnoent(error: unknown): error is NodeJS.ErrnoException {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n\nfunction sameState(left: ArtifactState, right: ArtifactState): boolean {\n if (left.status !== right.status) return false;\n if (left.status === 'absent') return true;\n return right.status === 'present' && left.contents === right.contents;\n}\n","import { randomUUID } from 'node:crypto';\nimport { lstat, mkdir, open, rename, rmdir, unlink } from 'node:fs/promises';\nimport { basename, dirname, join } from 'node:path';\n\ninterface AtomicFileIdentity {\n readonly dev: string;\n readonly ino: string;\n}\n\nexport interface AtomicFileStat {\n readonly dev: number | bigint;\n readonly ino: number | bigint;\n isDirectory(): boolean;\n isFile(): boolean;\n isSymbolicLink(): boolean;\n}\n\nexport interface AtomicFileHandle {\n writeFile(contents: string, encoding: BufferEncoding): Promise<void>;\n stat(): Promise<AtomicFileStat>;\n sync(): Promise<void>;\n close(): Promise<void>;\n}\n\nexport interface AtomicFileOperations {\n mkdir(path: string, options?: { readonly recursive?: boolean; readonly mode?: number }): Promise<unknown>;\n open(path: string, flags: 'wx'): Promise<AtomicFileHandle>;\n lstat(path: string): Promise<AtomicFileStat>;\n rename(source: string, destination: string): Promise<void>;\n rmdir(path: string): Promise<void>;\n unlink(path: string): Promise<void>;\n}\n\nconst defaultOperations: AtomicFileOperations = { lstat, mkdir, open, rename, rmdir, unlink };\n\nexport class AtomicFileWriter {\n constructor(private readonly operations: AtomicFileOperations = defaultOperations) {}\n\n async write(targetPath: string, contents: string): Promise<void> {\n const directory = dirname(targetPath);\n const namespacePath = join(directory, `.${basename(targetPath)}.${randomUUID()}.txn`);\n const temporaryPath = join(namespacePath, 'stage');\n\n await this.operations.mkdir(directory, { recursive: true });\n await this.operations.mkdir(namespacePath, { mode: 0o700 });\n const namespaceIdentity = await this.captureNamespaceIdentity(namespacePath, targetPath);\n let temporaryFile: AtomicFileHandle | undefined;\n let temporaryIdentity: AtomicFileIdentity | undefined;\n try {\n temporaryFile = await this.operations.open(temporaryPath, 'wx');\n temporaryIdentity = identity(await temporaryFile.stat());\n await temporaryFile.writeFile(contents, 'utf8');\n await temporaryFile.sync();\n await temporaryFile.close();\n temporaryFile = undefined;\n await this.assertNamespaceIdentity(namespacePath, namespaceIdentity, targetPath);\n await this.assertTemporaryIdentity(temporaryPath, temporaryIdentity, targetPath);\n await this.operations.rename(temporaryPath, targetPath);\n } catch (error: unknown) {\n await temporaryFile?.close().catch(() => undefined);\n const cleanupConfirmed = await this.cleanupOwnedTemporary(\n namespacePath,\n namespaceIdentity,\n temporaryPath,\n temporaryIdentity,\n targetPath,\n );\n if (!cleanupConfirmed) throw cleanupError(targetPath, error);\n throw error;\n }\n if (!(await this.cleanupNamespace(namespacePath, namespaceIdentity, targetPath))) {\n throw cleanupError(targetPath);\n }\n }\n\n private async captureNamespaceIdentity(path: string, targetPath: string): Promise<AtomicFileIdentity> {\n const stat = await this.operations.lstat(path);\n if (stat.isSymbolicLink() || !stat.isDirectory()) throw ownershipError(targetPath);\n return identity(stat);\n }\n\n private async assertNamespaceIdentity(path: string, expected: AtomicFileIdentity, targetPath: string): Promise<void> {\n const stat = await this.operations.lstat(path);\n if (stat.isSymbolicLink() || !stat.isDirectory() || !sameIdentity(identity(stat), expected)) {\n throw ownershipError(targetPath);\n }\n }\n\n private async assertTemporaryIdentity(path: string, expected: AtomicFileIdentity, targetPath: string): Promise<void> {\n const stat = await this.operations.lstat(path);\n if (stat.isSymbolicLink() || !stat.isFile() || !sameIdentity(identity(stat), expected)) {\n throw ownershipError(targetPath);\n }\n }\n\n private async cleanupOwnedTemporary(\n namespacePath: string,\n namespaceIdentity: AtomicFileIdentity,\n temporaryPath: string,\n temporaryIdentity: AtomicFileIdentity | undefined,\n targetPath: string,\n ): Promise<boolean> {\n if (temporaryIdentity) {\n try {\n await this.assertNamespaceIdentity(namespacePath, namespaceIdentity, targetPath);\n await this.assertTemporaryIdentity(temporaryPath, temporaryIdentity, targetPath);\n } catch (error: unknown) {\n if (!isEnoent(error)) return false;\n }\n try {\n await this.operations.unlink(temporaryPath);\n } catch {\n // The operation may have taken effect before reporting failure; inspect below.\n }\n try {\n await this.operations.lstat(temporaryPath);\n return false;\n } catch (error: unknown) {\n if (!isEnoent(error)) return false;\n }\n }\n return this.cleanupNamespace(namespacePath, namespaceIdentity, targetPath);\n }\n\n private async cleanupNamespace(\n namespacePath: string,\n namespaceIdentity: AtomicFileIdentity,\n targetPath: string,\n ): Promise<boolean> {\n try {\n await this.assertNamespaceIdentity(namespacePath, namespaceIdentity, targetPath);\n await this.operations.rmdir(namespacePath);\n } catch {\n // The operation may have taken effect before reporting failure; inspect below.\n }\n try {\n await this.operations.lstat(namespacePath);\n return false;\n } catch (error: unknown) {\n return isEnoent(error);\n }\n }\n}\n\nfunction identity(stat: AtomicFileStat): AtomicFileIdentity {\n return { dev: String(stat.dev), ino: String(stat.ino) };\n}\n\nfunction sameIdentity(left: AtomicFileIdentity, right: AtomicFileIdentity): boolean {\n return left.dev === right.dev && left.ino === right.ino;\n}\n\nfunction ownershipError(targetPath: string): Error {\n return new Error(`Atomic write ownership could not be confirmed for ${targetPath}.`);\n}\n\nfunction cleanupError(targetPath: string, cause?: unknown): Error {\n return new Error(\n `Atomic write cleanup could not be confirmed for ${targetPath}.`,\n cause === undefined ? undefined : { cause },\n );\n}\n\nfunction isEnoent(error: unknown): boolean {\n return typeof error === 'object' && error !== null && 'code' in error && error.code === 'ENOENT';\n}\n","import { AtomicFileWriter } from '../lib/atomic-file.writer';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport { pathsEquivalentOnFileSystem, pathsOverlapOnFileSystem } from '../migrator/migration-path.validator';\nimport type { MigrationReport } from './migration-report';\n\ntype ReportFileWriter = Pick<AtomicFileWriter, 'write'>;\n\nexport interface JsonReportWriteOptions {\n readonly protectedPaths?: readonly string[];\n}\n\nexport class JsonReportWriter {\n constructor(private readonly writer: ReportFileWriter = new AtomicFileWriter()) {}\n\n public async write(path: string, report: MigrationReport, options: JsonReportWriteOptions = {}): Promise<void> {\n for (const protectedPath of options.protectedPaths ?? []) {\n if (!(await pathsOverlapOnFileSystem(protectedPath, path))) continue;\n const collisionPaths = (await pathsEquivalentOnFileSystem(protectedPath, path))\n ? [protectedPath]\n : [protectedPath, path];\n throw new MigrationApplicationError(\n 'path-collision',\n `Report path collides with a migration output: ${path}`,\n collisionPaths,\n );\n }\n const contents = `${JSON.stringify(report, null, 2)}\\n`;\n await this.writer.write(path, contents);\n }\n}\n","import type { MigrationReport, ReportResult } from './migration-report';\n\ntype MigrationApplication = MigrationReport['application'];\ntype StylesheetChange = NonNullable<MigrationReport['stylesheet']>['change'];\n\ninterface ApplicationPresentation {\n readonly outcome: string;\n readonly footer?: string;\n}\n\nfunction assertNever(value: never, subject: string): never {\n throw new Error(`Unsupported ${subject}: ${String(value)}`);\n}\n\nexport interface TextOutput {\n write(text: string): void;\n readonly isTTY?: boolean;\n}\n\nexport class TerminalPresenter {\n public present(report: MigrationReport, output: TextOutput): void {\n const { summary } = report;\n const application = report.application;\n const presentation = this.applicationPresentation(report);\n const totals = `Converted ${summary.converted} | Review ${summary.review} | Unsupported ${summary.unsupported} | Invalid ${summary.invalid} | Parse errors ${summary.parseErrors}`;\n const stylesheet = report.stylesheet\n ? `Stylesheet: ${this.stylesheetAction(report.stylesheet.change, application.status)} ${report.stylesheet.path}`\n : undefined;\n const diagnostics = report.files.flatMap(file =>\n file.results\n .filter((result): result is Exclude<ReportResult, { status: 'converted' }> => result.status !== 'converted')\n .map(result => `${file.path}:${result.offset} [${result.code}] ${result.reason}`),\n );\n\n const profile = report.targetProfile;\n const environment = profile\n ? [\n 'Target environment',\n `Tailwind: v${profile.version} (${profile.fingerprint})`,\n `Stylesheet: ${profile.stylesheet ?? 'not supplied'}`,\n `Prefix: ${profile.prefix.value ?? 'none'} (${profile.prefix.source}; ${profile.prefix.confidence})`,\n `Important utilities: ${profile.important.value} (${profile.important.source})`,\n `Core utilities: ${profile.coreUtilities.value} (${profile.coreUtilities.source}; ${profile.coreUtilities.confidence})`,\n ...Object.entries(profile.breakpoints).map(\n ([name, setting]) => `Breakpoint ${name}: ${setting.value} (${setting.source}; ${setting.confidence})`,\n ),\n ...profile.diagnostics.map(item => `[${item.code}] ${item.message}`),\n ...profile.assumptions.map(item => `Assumption: ${item}`),\n '',\n ]\n : [];\n output.write(\n [...environment, presentation.outcome, totals, stylesheet, ...diagnostics, presentation.footer, '']\n .filter((line): line is string => line !== undefined)\n .join('\\n'),\n );\n }\n\n private applicationPresentation(report: MigrationReport): ApplicationPresentation {\n const { summary, application } = report;\n\n switch (application.status) {\n case 'applied':\n if (report.mode !== 'write') throw new Error('Applied application requires write mode.');\n return {\n outcome: `Applied: ${summary.filesScanned} files scanned, ${summary.filesChanged} changed`,\n };\n case 'skipped':\n switch (application.reason) {\n case 'plan-only':\n if (report.mode !== 'plan') throw new Error('Plan-only application requires plan mode.');\n return {\n outcome: `${this.modeLabel(report.mode)}: ${summary.filesScanned} files scanned, ${summary.filesChanged} would change`,\n footer: 'No project files were written. Run again with --write to apply this plan.',\n };\n case 'parse-errors':\n if (report.mode !== 'write') throw new Error('Parse-error application requires write mode.');\n return {\n outcome: `${this.modeLabel(report.mode)}: ${summary.filesScanned} files scanned, ${summary.filesChanged} would change`,\n footer: 'No project files were written because parsing failed.',\n };\n default:\n return assertNever(application.reason, 'migration application reason');\n }\n default:\n return assertNever(application, 'migration application');\n }\n }\n\n private modeLabel(mode: MigrationReport['mode']): 'Plan' | 'Write' {\n switch (mode) {\n case 'plan':\n return 'Plan';\n case 'write':\n return 'Write';\n default:\n return assertNever(mode, 'migration mode');\n }\n }\n\n private stylesheetAction(change: StylesheetChange, status: MigrationApplication['status']): string {\n switch (status) {\n case 'applied':\n return this.completedStylesheetAction(change);\n case 'skipped':\n return this.prospectiveStylesheetAction(change);\n default:\n return assertNever(status, 'migration application status');\n }\n }\n\n private completedStylesheetAction(change: StylesheetChange): string {\n switch (change) {\n case 'created':\n return 'created';\n case 'updated':\n return 'updated';\n case 'removed':\n return 'removed';\n case 'unchanged':\n return 'unchanged';\n default:\n return assertNever(change, 'stylesheet change');\n }\n }\n\n private prospectiveStylesheetAction(change: StylesheetChange): string {\n switch (change) {\n case 'created':\n return 'would create';\n case 'updated':\n return 'would update';\n case 'removed':\n return 'would remove';\n case 'unchanged':\n return 'would remain unchanged';\n default:\n return assertNever(change, 'stylesheet change');\n }\n }\n}\n","type ErrorWithMessage = {\n message: string;\n};\n\n/**\n * Returns true if the error object has a message property. Otherwise false.\n * @param error error object or any other object\n * @returns true if the error object has a message property. Otherwise false.\n */\nfunction isErrorWithMessage(error: unknown): error is ErrorWithMessage {\n return (\n typeof error === 'object' &&\n error !== null &&\n 'message' in error &&\n typeof (error as Record<string, unknown>).message === 'string'\n );\n}\n\n/**\n * Returns an error object with a message. If the error object is not an error, it will be converted to an error object.\n * @param maybeError error object or any other object\n * @returns error object\n */\nfunction toErrorWithMessage(maybeError: unknown): ErrorWithMessage {\n if (isErrorWithMessage(maybeError)) return maybeError;\n\n try {\n return new Error(JSON.stringify(maybeError));\n } catch {\n // fallback in case there's an error stringifying the maybeError\n // like with circular references for example.\n return new Error(String(maybeError));\n }\n}\n\n/**\n * Returns the error message from an error object. If the error object is not an error, it will be converted to an error object.\n * @param error error object or any other object\n * @returns error message\n */\nfunction getErrorMessage(error: unknown) {\n return toErrorWithMessage(error).message;\n}\n\nexport { getErrorMessage };\n","import type { MigrationReport } from '../report/migration-report';\n\nexport function resolveExitCode(report: MigrationReport, allowUnresolved: boolean): 0 | 1 | 2 {\n if (report.summary.parseErrors > 0) return 1;\n\n const hasUnresolved =\n (report.targetProfile?.diagnostics.length ?? 0) > 0 ||\n report.summary.review > 0 ||\n report.summary.unsupported > 0 ||\n report.summary.invalid > 0;\n\n return hasUnresolved && !allowUnresolved ? 2 : 0;\n}\n","import path from 'node:path';\n\nexport function validateReportPath(reportPath: string): void {\n if (reportPath.trim().length === 0) {\n throw new Error('Report path must not be empty.');\n }\n\n if (path.extname(reportPath).toLowerCase() !== '.json') {\n throw new Error('Report path must have a .json extension.');\n }\n}\n","import type { SourceBreakpoints } from './source-breakpoints';\nimport type { TailwindTargetProfile } from './tailwind-target-profile';\nimport { DEFAULT_BREAKPOINTS, ORIENTATION_BREAKPOINTS } from '../analyzer/flex-layout.catalog';\n\nexport interface BreakpointMigrationConfig {\n readonly orientationBreakpoints: boolean;\n readonly targetProfile?: TailwindTargetProfile;\n readonly sourceBreakpoints?: SourceBreakpoints;\n readonly printWithBreakpoints?: readonly string[];\n}\n\nconst standardAliases = new Set<string>(DEFAULT_BREAKPOINTS);\nconst orientationAliases = new Set<string>(ORIENTATION_BREAKPOINTS);\n\nexport function parsePrintWithBreakpoints(value: string, orientationEnabled: boolean): readonly string[] {\n if (value === 'none') return Object.freeze([]);\n\n const aliases = value.split(',').map(alias => alias.trim());\n if (aliases.some(alias => alias.length === 0)) {\n throw new Error('Print breakpoint aliases must not be empty');\n }\n if (aliases.includes('none')) {\n throw new Error('The literal none cannot be combined with breakpoint aliases');\n }\n\n const seen = new Set<string>();\n for (const alias of aliases) {\n if (seen.has(alias)) throw new Error(`Print breakpoint list contains duplicate alias ${alias}`);\n seen.add(alias);\n\n if (alias === 'print') throw new Error('Print breakpoint list must not contain print');\n if (orientationAliases.has(alias) && !orientationEnabled) {\n throw new Error(`Orientation breakpoint alias ${alias} requires --orientation-breakpoints`);\n }\n if (!standardAliases.has(alias) && !orientationAliases.has(alias)) {\n throw new Error(`Unknown breakpoint alias ${alias}`);\n }\n }\n\n return Object.freeze(aliases);\n}\n","import * as path from 'node:path';\nimport { MigrationApplicationError } from '../migrator/migration-application.error';\nimport type { PathApi } from '../migrator/migration-path.validator';\n\nexport interface StylesheetPathValidationRequest {\n readonly target: string;\n readonly stylesheetPath?: string;\n readonly inputPath: string;\n readonly outputPath: string;\n readonly reportPath?: string;\n}\n\nexport async function validateStylesheetPath(\n request: StylesheetPathValidationRequest,\n pathApi: PathApi = path,\n): Promise<string | undefined> {\n if (request.target !== 'css') {\n if (request.stylesheetPath !== undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--stylesheet can only be used with --target css.', [\n request.stylesheetPath,\n ]);\n }\n return undefined;\n }\n\n if (request.stylesheetPath === undefined) {\n throw new MigrationApplicationError('invalid-configuration', '--target css requires --stylesheet <path>.');\n }\n if (request.stylesheetPath.trim().length === 0) {\n throw new MigrationApplicationError('invalid-configuration', 'Stylesheet path must not be empty.');\n }\n\n return pathApi.resolve(request.stylesheetPath);\n}\n","import type { MigrationMode } from '../migrator/migration-mode';\n\nconst obsoleteDryRunGuidance = 'Planning is now the default. Remove --dry-run; use --write to apply changes.';\n\nexport function resolveMigrationMode(argv: readonly string[], write: boolean): MigrationMode {\n const cliArguments = argv.slice(2);\n const optionTerminator = cliArguments.indexOf('--');\n const optionArguments = optionTerminator === -1 ? cliArguments : cliArguments.slice(0, optionTerminator);\n\n if (optionArguments.some(argument => argument === '--dry-run' || argument.startsWith('--dry-run='))) {\n throw new Error(obsoleteDryRunGuidance);\n }\n if (optionArguments.filter(argument => argument === '--write').length > 1) {\n throw new Error('--write may only be specified once.');\n }\n\n if (write && optionArguments.includes('--plan')) throw new Error('--plan and --write cannot be combined.');\n\n return write ? 'write' : 'plan';\n}\n","import { runCli } from './cli/run-cli';\nimport { getErrorMessage } from './util/error.util';\n\nasync function main(): Promise<void> {\n process.exitCode = await runCli(process.argv);\n}\n\nvoid main().catch((error: unknown) => {\n process.stderr.write(`Error: ${getErrorMessage(error)}\\n`);\n process.exitCode = 1;\n});\n"],"mappings":";;;AAAA,SAAS,OAAO,YAAY;AAC5B,YAAY,UAAU;;;ACSf,IAAM,4BAAN,cAAwC,MAAM;AAAA,EAGnD,YACW,MACT,SACS,QAA2B,CAAC,GACrC,SACA;AACA,UAAM,SAAS,OAAO;AALb;AAEA;AAIT,SAAK,OAAO;AACZ,SAAK,QAAQ,OAAO,OAAO,CAAC,GAAG,KAAK,CAAC;AACrC,SAAK,mBAAmB,OAAO,OAAO,CAAC,GAAI,SAAS,oBAAoB,CAAC,CAAE,CAAC;AAAA,EAC9E;AAAA,EAZS;AAaX;;;ADoBA,eAAsB,uBACpB,SACA,UAAmB,MACJ;AACf,QAAM,SAAS,iBAAiB,SAAS,OAAO;AAChD,QAAM,mBAAmB,QAAQ,OAAO;AAExC,QAAM,eAAe,OAAO,OAAO,WAAS,MAAM,SAAS,gBAAgB;AAC3E,aAAW,eAAe,cAAc;AACtC,UAAM,oBAAoB,YAAY,IAAI;AAAA,EAC5C;AACF;AAEA,eAAsB,+BACpB,SACA,UAAmB,MACJ;AACf,MAAI,QAAQ,mBAAmB,OAAW;AAC1C,QAAM,iBAAiB,QAAQ,QAAQ,QAAQ,cAAc;AAC7D,QAAM,gBAAgB,CAAC,QAAQ,WAAW,QAAQ,UAAU,EAAE,IAAI,WAAS,QA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AA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,IAAM,oCAAoC,oBAAI,IAAI;AAAA,EAChD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAED,SAAS,mBAAmB,OAAwB;AAClD,SAAO,oBAAoB,KAAK,KAAK;AACvC;AAEA,SAAS,uBAAuB,OAAw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QAAI,iBAAiB,gBAAgB;AACnC,aAAO,MAAM,aAAa,IAAI,IAAI;AAAA,IACpC;AAEA,WAAO,OAAO,MAAM,UAAU,gBAAgB,KAAK,CAAC;AAAA,CAAI;AACxD,QAAI,SAAS,iBAAiB,SAAS,MAAM,OAAO;AAClD,aAAO,OAAO,MAAM,GAAG,MAAM,KAAK;AAAA,CAAI;AAAA,IACxC;AACA,WAAO;AAAA,EACT;AACF;;;A+H/MA,eAAe,OAAsB;AACnC,UAAQ,WAAW,MAAM,OAAO,QAAQ,IAAI;AAC9C;AAEA,KAAK,KAAK,EAAE,MAAM,CAAC,UAAmB;AACpC,UAAQ,OAAO,MAAM,UAAU,gBAAgB,KAAK,CAAC;AAAA,CAAI;AACzD,UAAQ,WAAW;AACrB,CAAC;","names":["relative","stat","path","postcss","range","relative","path","parsed","postcss","path","timestamp","declaration","property","digest","identity","freezeDeclarations","declaration","freezeDeclarations","declaration","freezeDeclarations","declaration","freezeDeclarations","declaration","declaration","range","property","parsed","closingByOpening","property","authority","textSizes","property","cssProperties","declaration","alignment","parsed","arbitraryValue","arbitraryValue","main","mainAxis","alignment","arbitraryValue","declaration","property","containsControl","declaration","unresolved","result","normalize","resolved","property","range","readFile","parsed","path","path","result","diagnostic","normalizedAbsolutePath","path","readFile","identity","stat","sameIdentity","isEnoent","path","sameIdentity","identity","isEnoent","sameIdentity","identity","destination","randomUUID","join","recoveryResult","sameIdentity","identity","join","randomUUID","randomUUID","join","identity","join","randomUUID","lstat","stat","dirname","join","resolve","lstat","stat","path","resolve","dirname","result","identity","isEnoent","join","sameIdentity","sortedUnique","result","path","result","stat","path","path","path","stat","path","path","result","path","optionalAliases","declaration","property","main","customProperty","property","declaration","result","parsed","declaration","result","property","interpolation","parsed","declaration","property","range","activation","property","contextUnverified","declaration","properties","parsed","diagnostic","writers","visibilityIds","numericRange","range","rangesCover","unresolved","dynamicBinding","unresolvedBreakpoint","contextUnverified","responsivePrecedenceUnverified","compareText","visibilityDirectives","extendedClassDirectives","extendedStyleDirectives","extendedDirectives","gridDirectives","dynamicBinding","contextUnverified","responsivePrecedenceUnverified","unresolvedBreakpoint","activation","result","equalClassValues","declaration","parsed","property","familyPlan","decision","printOwner","states","resolved","internalInvariant","result","path","sequenceInvariant","samePathPair","internalInvariant","identity","result","diagnostic","declaration","freezeMedia","normalizedAbsolutePath","diagnostic","path","path","result","freezeValue","lstat","readFile","path","invalid","declaration","property","property","START_MARKER","END_MARKER","parsed","parsedRule","resolveRetainedMediaContext","compareCodeUnits","nodeFileSystem","readFile","lstat","sameState","stat","isEnoent","path","internalInvariant","samePathPair","normalizedAbsolutePath","sameOwnedValue","result","isPlainRecord","path","readFile","path","fileCongruenceInvariant","parsed","isEnoent","parsed","diagnostic","path","sameState","isEnoent","stylesheetChange","randomUUID","lstat","mkdir","open","rename","rmdir","unlink","basename","dirname","join","identity","path","stat","sameIdentity","isEnoent","path","result","path","standardAliases","path","path"]}