@homebound/truss 2.29.7 → 2.29.9

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/plugin/index.ts","../../src/plugin/rewrite-css-ts-imports.ts","../../src/plugin/ast-utils.ts","../../src/plugin/babel-utils.ts","../../src/plugin/transform-session.ts","../../src/plugin/resolve-chain.ts","../../src/plugin/mapping-utils.ts","../../src/plugin/chain-nodes.ts","../../src/plugin/condition-context.ts","../../src/plugin/resolve-entry.ts","../../src/plugin/resolve-calls.ts","../../src/plugin/types.ts","../../src/plugin/resolve-literals.ts","../../src/css-custom-property.ts","../../src/spacing-css-var.ts","../../src/plugin/resolve-setvar.ts","../../src/plugin/container-query.ts","../../src/plugin/style-entries.ts","../../src/plugin/css-property-abbreviations.ts","../../src/plugin/when-relationships.ts","../../src/pseudo-selectors.ts","../../src/plugin/resolve-typography.ts","../../src/plugin/resolve-when.ts","../../src/media-query.ts","../../src/css-order.ts","../../src/plugin/property-priorities.ts","../../src/plugin/priority.ts","../../src/plugin/emit-css.ts","../../src/plugin/transform-css.ts","../../src/plugin/css-ts-utils.ts","../../src/plugin/transform.ts","../../src/plugin/emit-style-hash.ts","../../src/plugin/rewrite-sites.ts","../../src/style-metadata.ts","../../src/plugin/merge-css.ts","../../src/truss-css.ts","../../src/plugin/esbuild-plugin.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync, readdirSync } from \"fs\";\nimport { resolve, dirname, isAbsolute, join } from \"path\";\nimport { createHash } from \"crypto\";\nimport { rewriteCssTsImports } from \"./rewrite-css-ts-imports\";\nimport { createTrussTransformSession } from \"./transform-session\";\nimport { annotateArbitraryCssBlock } from \"./merge-css\";\nimport { rootSpacingPreludeCss } from \"../spacing-css-var\";\nimport { generate, parseModule, traverse } from \"./babel-utils\";\nimport * as t from \"@babel/types\";\n\nexport interface TrussPluginOptions {\n /** Path to the Css.json mapping file used for transforming files (relative to project root or absolute). */\n mapping: string;\n /** Paths to pre-compiled truss.css files from libraries to merge into the app's CSS. */\n libraries?: string[];\n}\n\n// Intentionally loose Vite types so we don't depend on the `vite` package at compile time.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TrussVitePlugin {\n name: string;\n enforce?: \"pre\" | \"post\";\n configResolved?: (config: any) => void;\n buildStart?: () => void;\n resolveId?: (source: string, importer: string | undefined) => string | null;\n load?: (id: string) => string | null;\n transform?: (code: string, id: string) => { code: string; map: any } | null;\n configureServer?: (server: any) => void;\n transformIndexHtml?: (html: string) => string;\n handleHotUpdate?: (ctx: any) => void;\n generateBundle?: (options: any, bundle: any) => void;\n writeBundle?: (options: any, bundle: any) => void;\n}\n\n/** Prefix for virtual CSS module IDs generated from .css.ts files. */\nconst VIRTUAL_CSS_PREFIX = \"\\0truss-css:\";\nconst VIRTUAL_TEST_CSS_PREFIX = \"\\0truss-test-css:\";\nconst CSS_TS_QUERY = \"?truss-css\";\n\n/** Placeholder injected into HTML during build; replaced with the hashed CSS filename in generateBundle. */\nconst TRUSS_CSS_PLACEHOLDER = \"__TRUSS_CSS_HASH__\";\n\n/** Virtual module IDs for dev HMR. */\nconst VIRTUAL_CSS_ENDPOINT = \"/virtual:truss.css\";\nconst VIRTUAL_RUNTIME_ID = \"virtual:truss:runtime\";\nconst RESOLVED_VIRTUAL_RUNTIME_ID = \"\\0\" + VIRTUAL_RUNTIME_ID;\n// Test-only bootstrap that injects merged library CSS and the spacing prelude\n// as a virtual module side effect instead of an HTTP\n// fetch. In dev, the browser reaches /virtual:truss.css via transformIndexHtml\n// -> virtual:truss:runtime -> fetch(\"/virtual:truss.css\") -> configureServer.\n// Vitest/jsdom does not boot from index.html or run that browser fetch/HMR path;\n// it imports modules directly into the test environment, so CSS has to enter via\n// a module side effect instead.\nconst VIRTUAL_TEST_CSS_ID = \"virtual:truss:test-css\";\nconst RESOLVED_VIRTUAL_TEST_CSS_ID = \"\\0\" + VIRTUAL_TEST_CSS_ID;\n\n/**\n * Vite plugin that transforms `Css.*.$` expressions from truss's CssBuilder DSL\n * into Truss-native style hash objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Also supports `.css.ts` files: a `.css.ts` file with\n * `export const css = { \".selector\": Css.blue.$ }` can keep other runtime exports,\n * while imports are supplemented with a virtual CSS side-effect module.\n *\n * In dev mode, serves CSS via a virtual endpoint that the injected runtime keeps in sync.\n * In production, emits a content-hashed CSS asset (e.g. `assets/truss-abc123.css`) for long-term caching.\n */\nexport function trussPlugin(opts: TrussPluginOptions): TrussVitePlugin {\n let projectRoot: string;\n let debug = false;\n let isTest = false;\n let isBuild = false;\n const libraryPaths = opts.libraries ?? [];\n /** The hashed CSS filename emitted during generateBundle, used by writeBundle to patch HTML. */\n let emittedCssFileName: string | null = null;\n\n let cssVersion = 0;\n let lastSentVersion = 0;\n\n function mappingPath(): string {\n return resolve(projectRoot || process.cwd(), opts.mapping);\n }\n\n const session = createTrussTransformSession({\n mappingPath,\n projectRoot: () => projectRoot || process.cwd(),\n libraries: libraryPaths,\n onCssChanged() {\n cssVersion++;\n },\n });\n\n return {\n name: \"truss\",\n enforce: \"pre\",\n\n configResolved(config: any) {\n projectRoot = config.root;\n debug = config.command === \"serve\" || config.mode === \"development\" || config.mode === \"test\";\n isTest = config.mode === \"test\";\n isBuild = config.command === \"build\";\n },\n\n buildStart() {\n session.ensureMapping();\n // Reset registries and library cache at start of each build\n session.reset();\n cssVersion = 0;\n lastSentVersion = 0;\n },\n\n // -- Dev mode HMR --\n\n configureServer(server: any) {\n // Skip dev-server setup in test mode — Vitest doesn't start a real HTTP\n // server, so the interval would keep the process alive.\n if (isTest) return;\n\n // Serve the current collected CSS at the virtual endpoint\n server.middlewares.use((req: any, res: any, next: any) => {\n if (req.url !== VIRTUAL_CSS_ENDPOINT) return next();\n const css = session.collectCss();\n res.setHeader(\"Content-Type\", \"text/css\");\n res.setHeader(\"Cache-Control\", \"no-store\");\n res.end(css);\n });\n\n // Poll for CSS version changes and push HMR updates\n const interval = setInterval(() => {\n if (cssVersion !== lastSentVersion && server.ws) {\n lastSentVersion = cssVersion;\n server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n }, 150);\n\n // Clean up interval when server closes\n server.httpServer?.on(\"close\", () => {\n clearInterval(interval);\n });\n },\n\n transformIndexHtml(html: string) {\n if (isBuild) {\n // Strip any existing truss CSS references so the hook is idempotent when\n // a tool (e.g. Storybook) runs multiple Vite builds with the same plugin.\n // I.e. removes /virtual:truss.css, __TRUSS_CSS_HASH__, and /assets/truss-<hash>.css\n const stripped = html\n .replace(/\\s*<link[^>]*href=[\"'][^\"']*virtual:truss\\.css[\"'][^>]*\\/?>/g, \"\")\n .replace(/\\s*<link[^>]*href=[\"'][^\"']*__TRUSS_CSS_HASH__[\"'][^>]*\\/?>/g, \"\")\n .replace(/\\s*<link[^>]*href=[\"'][^\"']*\\/assets\\/truss-[0-9a-f]+\\.css[\"'][^>]*\\/?>/g, \"\");\n // Inject a stylesheet link with a placeholder; writeBundle replaces it\n // with the content-hashed filename for long-term caching.\n const link = `<link rel=\"stylesheet\" href=\"${TRUSS_CSS_PLACEHOLDER}\">`;\n return stripped.replace(\"</head>\", ` ${link}\\n </head>`);\n }\n // Inject the virtual runtime script for dev mode; it owns style updates.\n const tag = `<script type=\"module\" src=\"/${VIRTUAL_RUNTIME_ID}\"></script>`;\n return html.replace(\"</head>\", ` ${tag}\\n </head>`);\n },\n\n handleHotUpdate(ctx: any) {\n // Send CSS update event on any file change for safety\n if (ctx.server?.ws) {\n ctx.server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n },\n\n // -- Virtual module resolution --\n\n resolveId(source: string, importer: string | undefined) {\n // Handle the dev HMR runtime virtual module\n if (source === VIRTUAL_RUNTIME_ID || source === \"/\" + VIRTUAL_RUNTIME_ID) {\n return RESOLVED_VIRTUAL_RUNTIME_ID;\n }\n if (source === VIRTUAL_TEST_CSS_ID || source === \"/\" + VIRTUAL_TEST_CSS_ID) {\n return RESOLVED_VIRTUAL_TEST_CSS_ID;\n }\n\n // Handle .css.ts virtual modules\n if (!source.endsWith(CSS_TS_QUERY)) return null;\n\n const absolutePath = resolveImportPath(source.slice(0, -CSS_TS_QUERY.length), importer, projectRoot);\n\n // Only handle it if the .css.ts file actually exists\n if (!existsSync(absolutePath)) return null;\n\n // Compile test side effects without evaluating build-only CssBuilder expressions.\n if (isTest) return VIRTUAL_TEST_CSS_PREFIX + absolutePath;\n\n // Return a virtual CSS module ID that maps back to the source .css.ts file.\n // Strip the trailing `.ts` so the ID ends in `.css` — this tells Vite to\n // route the loaded content through its CSS pipeline.\n return VIRTUAL_CSS_PREFIX + absolutePath.slice(0, -3);\n },\n\n load(id: string) {\n // Serve the dev HMR runtime script\n if (id === RESOLVED_VIRTUAL_RUNTIME_ID) {\n return `\n// Truss dev HMR runtime — keeps styles up to date without page reload\n(() => {\n let style = document.getElementById(\"__truss_virtual__\");\n if (!style) {\n style = document.createElement(\"style\");\n style.id = \"__truss_virtual__\";\n document.head.appendChild(style);\n }\n\n function fetchCss() {\n fetch(\"${VIRTUAL_CSS_ENDPOINT}\")\n .then((r) => r.text())\n .then((css) => { style.textContent = css; })\n .catch(() => {});\n }\n\n fetchCss();\n\n if (import.meta.hot) {\n import.meta.hot.on(\"truss:css-update\", fetchCss);\n import.meta.hot.on(\"vite:afterUpdate\", () => {\n setTimeout(fetchCss, 50);\n });\n }\n})();\n`;\n }\n if (id === RESOLVED_VIRTUAL_TEST_CSS_ID) {\n // Vitest/jsdom has no dev server stylesheet fetch, so inject libraries\n // once; application modules deliver CSS when they evaluate.\n const css = session.collectTestCss();\n const options = {\n source: \"libraries\",\n order: 0,\n prelude: rootSpacingPreludeCss(session.ensureMapping().increment),\n };\n return `\nimport { __injectTrussCSS } from \"@homebound/truss/runtime\";\n\n__injectTrussCSS(${JSON.stringify(css)}, ${JSON.stringify(options)});\n`;\n }\n\n if (id.startsWith(VIRTUAL_TEST_CSS_PREFIX)) {\n const sourcePath = resolve(id.slice(VIRTUAL_TEST_CSS_PREFIX.length)).replace(/\\\\/g, \"/\");\n session.updateArbitraryCssRegistry(sourcePath, readFileSync(sourcePath, \"utf8\"));\n const css = annotateArbitraryCssBlock(session.getArbitraryCss(sourcePath));\n return `\nimport \"${VIRTUAL_TEST_CSS_ID}\";\nimport { __injectTrussCSS } from \"@homebound/truss/runtime\";\n\n__injectTrussCSS(${JSON.stringify(css)}, ${JSON.stringify({ source: sourcePath })});\n`;\n }\n\n // Handle .css.ts virtual modules\n if (!id.startsWith(VIRTUAL_CSS_PREFIX)) return null;\n\n // Re-add `.ts` to recover the original source file path\n const sourcePath = id.slice(VIRTUAL_CSS_PREFIX.length) + \".ts\";\n const sourceCode = readFileSync(sourcePath, \"utf8\");\n\n // Populate the arbitrary CSS registry on first load; subsequent updates\n // happen in the transform hook when Vite re-transforms the changed file.\n session.updateArbitraryCssRegistry(sourcePath, sourceCode);\n\n // Return an empty stylesheet to Vite's CSS pipeline — the real CSS is now\n // served via collectCss() (dev: /virtual:truss.css, build: truss-<hash>.css)\n // so we avoid duplicating it in Vite's own CSS bundle.\n return `/* [truss] ${sourcePath} — included via truss.css */`;\n },\n\n transform(code: string, id: string) {\n // The virtual test module already contains compiled CSS, not source TypeScript.\n if (id.startsWith(VIRTUAL_TEST_CSS_PREFIX)) return null;\n // Only process JS/TS/JSX/TSX files outside node_modules\n if (!/\\.[cm]?[jt]sx?(\\?|$)/.test(id)) return null;\n const fileId = stripQueryAndHash(id);\n if (isNodeModulesFile(fileId)) return null;\n\n const rewrittenImports = rewriteCssTsImports(code, id);\n\n // In tests, we do not boot through index.html and the dev runtime fetch path\n // (`virtual:truss:runtime` -> fetch(\"/virtual:truss.css\")), so we inject the\n // library CSS and spacing through a virtual module side effect instead.\n //\n // We add `import \"virtual:truss:test-css\"` to each eligible transformed module,\n // but ESM module caching should evaluate that virtual module only once per test\n // module graph. Transformed files may still emit per-file `__injectTrussCSS`\n // calls; atomic classes are deduped in the runtime helper.\n const shouldBootstrapTestCss = isTest;\n const transformedCode = shouldBootstrapTestCss\n ? `${rewrittenImports.code}\\nimport \"${VIRTUAL_TEST_CSS_ID}\";`\n : rewrittenImports.code;\n // The result to return when only the import rewrites changed the module\n const importsOnlyResult =\n rewrittenImports.changed || shouldBootstrapTestCss ? { code: transformedCode, map: null } : null;\n\n if (fileId.endsWith(\".css.ts\")) {\n // Keep `.css.ts` modules as normal TS so named exports like class-name\n // constants still work at runtime. Tests also inject their CSS at evaluation.\n //\n // Also update the arbitrary CSS registry so HMR picks up changes —\n // the load hook only runs on first resolve, so edits need to refresh\n // the registry here where Vite re-transforms changed files.\n session.updateArbitraryCssRegistry(fileId, code);\n if (isTest) {\n const css = annotateArbitraryCssBlock(session.getArbitraryCss(fileId));\n const ast = parseModule(transformedCode, fileId);\n traverse(ast, {\n Program(path) {\n const inject = path.scope.generateUidIdentifier(\"injectTrussCSS\");\n path.unshiftContainer(\n \"body\",\n t.importDeclaration(\n [t.importSpecifier(inject, t.identifier(\"__injectTrussCSS\"))],\n t.stringLiteral(\"@homebound/truss/runtime\"),\n ),\n );\n path.pushContainer(\n \"body\",\n t.expressionStatement(\n t.callExpression(inject, [\n t.stringLiteral(css),\n t.objectExpression([\n t.objectProperty(t.identifier(\"source\"), t.stringLiteral(resolve(fileId).replace(/\\\\/g, \"/\"))),\n ]),\n ]),\n ),\n );\n },\n });\n return { code: generate(ast, { sourceFileName: fileId }).code, map: null };\n }\n return importsOnlyResult;\n }\n\n // Some non-`.css.ts` modules only need the import rewrite and do not have\n // any `Css.*.$` expressions for the main Truss transform to process.\n const hasCssDsl = rewrittenImports.code.includes(\"Css\") || rewrittenImports.code.includes(\"css=\");\n if (!hasCssDsl) return importsOnlyResult;\n\n // For regular JS/TS modules that still use the DSL, run the full Truss\n // transform after the import rewrite so both behaviors compose.\n const result = session.transformCode(transformedCode, fileId, { debug, injectCss: isTest });\n return result ? { code: result.code, map: result.map } : importsOnlyResult;\n },\n\n // -- Production CSS emission --\n\n generateBundle(_options: any, _bundle: any) {\n if (!isBuild) return;\n const css = session.collectCss();\n if (!css) return;\n\n // Compute a content hash so the filename is cache-bustable.\n const hash = createHash(\"sha256\").update(css).digest(\"hex\").slice(0, 8);\n const fileName = `assets/truss-${hash}.css`;\n emittedCssFileName = fileName;\n\n (this as any).emitFile({\n type: \"asset\",\n fileName,\n source: css,\n });\n },\n\n /** Patch HTML files on disk to replace the CSS placeholder with the hashed filename. */\n writeBundle(options: any, _bundle: any) {\n if (!emittedCssFileName) return;\n const outDir = options.dir || join(projectRoot, \"dist\");\n // Find and patch all HTML files in the output directory\n for (const entry of readdirSync(outDir)) {\n if (!entry.endsWith(\".html\")) continue;\n const htmlPath = join(outDir, entry);\n const html = readFileSync(htmlPath, \"utf8\");\n if (html.includes(TRUSS_CSS_PLACEHOLDER)) {\n writeFileSync(htmlPath, html.replace(TRUSS_CSS_PLACEHOLDER, `/${emittedCssFileName}`), \"utf8\");\n }\n }\n },\n };\n}\n\nfunction resolveImportPath(source: string, importer: string | undefined, projectRoot: string | undefined): string {\n if (isAbsolute(source)) {\n return source;\n }\n\n if (importer) {\n return resolve(dirname(importer), source);\n }\n\n return resolve(projectRoot || process.cwd(), source);\n}\n\n/** Strip Vite query/hash suffixes from an id. */\nfunction stripQueryAndHash(id: string): string {\n const queryIndex = id.indexOf(\"?\");\n const hashIndex = id.indexOf(\"#\");\n\n let end = id.length;\n if (queryIndex >= 0) end = Math.min(end, queryIndex);\n if (hashIndex >= 0) end = Math.min(end, hashIndex);\n\n const cleanId = id.slice(0, end);\n // Vite can prefix absolute paths with `/@fs/`.\n if (cleanId.startsWith(\"/@fs/\")) {\n return cleanId.slice(4);\n }\n return cleanId;\n}\n\nfunction isNodeModulesFile(filePath: string): boolean {\n return filePath.replace(/\\\\/g, \"/\").includes(\"/node_modules/\");\n}\n\nexport type { TrussMapping, TrussMappingEntry } from \"./types\";\nexport { loadMapping } from \"./mapping-utils\";\nexport { trussEsbuildPlugin, type TrussEsbuildPluginOptions } from \"./esbuild-plugin\";\n","import { existsSync } from \"fs\";\nimport { dirname, resolve } from \"path\";\nimport * as t from \"@babel/types\";\nimport { findLastImportIndex } from \"./ast-utils\";\nimport { generate, parseModule } from \"./babel-utils\";\n\nexport interface RewriteCssTsImportsResult {\n code: string;\n changed: boolean;\n}\n\n/**\n * Rewrite `.css.ts` (and bare `.css`) imports so runtime imports stay pointed at the\n * real module, while a separate `?truss-css` side-effect import is added for generated CSS.\n *\n * I.e. `import { foo } from \"./App.css.ts\"` becomes:\n * - `import { foo } from \"./App.css.ts\"`\n * - `import \"./App.css.ts?truss-css\"`\n *\n * Bare `.css` imports (i.e. `from \"./App.css\"`) are handled when a corresponding `.css.ts`\n * file exists on disk — the specifier is normalized to `.css.ts` for the virtual CSS\n * side-effect import so the resolveId/load pipeline can find the source file.\n *\n * Pure side-effect imports are rewritten directly to the virtual CSS import.\n */\nexport function rewriteCssTsImports(code: string, filename: string): RewriteCssTsImportsResult {\n if (!code.includes(\".css\")) {\n return { code, changed: false };\n }\n\n const importerDir = dirname(filename);\n\n const ast = parseModule(code, filename);\n\n const existingCssSideEffects = new Set<string>();\n const neededCssSideEffects = new Set<string>();\n let changed = false;\n\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n if (typeof node.source.value !== \"string\") continue;\n if (!isCssTsImport(node.source.value, importerDir)) continue;\n\n if (node.specifiers.length === 0) {\n node.source = t.stringLiteral(toVirtualCssSpecifier(node.source.value));\n existingCssSideEffects.add(node.source.value);\n changed = true;\n continue;\n }\n\n neededCssSideEffects.add(toVirtualCssSpecifier(node.source.value));\n }\n\n const sideEffectImports: t.ImportDeclaration[] = [];\n for (const source of neededCssSideEffects) {\n if (existingCssSideEffects.has(source)) continue;\n sideEffectImports.push(t.importDeclaration([], t.stringLiteral(source)));\n changed = true;\n }\n\n if (!changed) {\n return { code, changed: false };\n }\n\n if (sideEffectImports.length > 0) {\n const insertIndex = findLastImportIndex(ast) + 1;\n ast.program.body.splice(insertIndex, 0, ...sideEffectImports);\n }\n\n const output = generate(ast, {\n sourceFileName: filename,\n retainLines: false,\n });\n return { code: output.code, changed: true };\n}\n\n/** Check if this import targets a `.css.ts` file (explicitly or via a bare `.css` with a `.css.ts` on disk). */\nfunction isCssTsImport(specifier: string, importerDir: string): boolean {\n if (specifier.endsWith(\".css.ts\")) return true;\n // I.e. `from \"./App.css\"` or `from \"src/App.css\"` — only rewrite if a `.css.ts` file exists\n if (specifier.endsWith(\".css\")) {\n return existsSync(resolve(importerDir, `${specifier}.ts`));\n }\n return false;\n}\n\n/** Normalize to `.css.ts` so resolveId can find the source file on disk. */\nfunction toVirtualCssSpecifier(source: string): string {\n const normalized = source.endsWith(\".css.ts\") ? source : `${source}.ts`;\n return `${normalized}?truss-css`;\n}\n","import * as t from \"@babel/types\";\nimport type { ChainNode } from \"./chain-nodes\";\n\nexport interface NamedImport {\n importedName: string;\n localName: string;\n}\n\n/**\n * Reserve a stable, collision-free identifier.\n *\n * Preference order:\n * 1) preferred\n * 2) secondary (if provided)\n * 3) numbered suffixes based on secondary/preferred\n */\nexport function reservePreferredName(used: Set<string>, preferred: string, secondary?: string): string {\n if (!used.has(preferred)) {\n used.add(preferred);\n return preferred;\n }\n\n if (secondary && !used.has(secondary)) {\n used.add(secondary);\n return secondary;\n }\n\n const base = secondary ?? preferred;\n let i = 1;\n // Numbered fallback keeps generated names deterministic across runs.\n let candidate = `${base}_${i}`;\n while (used.has(candidate)) {\n i++;\n candidate = `${base}_${i}`;\n }\n used.add(candidate);\n return candidate;\n}\n\n/** Find the local binding name for `Css` from import declarations. */\nexport function findCssImportBinding(ast: t.File): string | null {\n return findNamedImportBinding(ast, \"Css\");\n}\n\n/**\n * Find a local binding where `Css` is created via `new CssBuilder(...)`.\n *\n * This handles tsup-bundled libraries where Css is not imported but declared as:\n * var Css = new CssBuilder({ ... });\n */\nexport function findCssBuilderBinding(ast: t.File): string | null {\n for (const node of ast.program.body) {\n if (!t.isVariableDeclaration(node)) continue;\n for (const decl of node.declarations) {\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isNewExpression(decl.init) &&\n t.isIdentifier(decl.init.callee, { name: \"CssBuilder\" })\n ) {\n return decl.id.name;\n }\n }\n }\n return null;\n}\n\n/** True for a `binding.method(...)` call, i.e. `Css.props(...)` when `binding` is `\"Css\"` and `method` is `\"props\"`. */\nexport function isCssMethodCall(node: t.CallExpression, binding: string, method: string): boolean {\n return (\n t.isMemberExpression(node.callee) &&\n !node.callee.computed &&\n t.isIdentifier(node.callee.object, { name: binding }) &&\n t.isIdentifier(node.callee.property, { name: method })\n );\n}\n\n/**\n * Remove the Css import specifier. If it was the only specifier, remove the whole import.\n */\nexport function removeCssImport(ast: t.File, cssBinding: string): void {\n for (let i = 0; i < ast.program.body.length; i++) {\n const node = ast.program.body[i];\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex((s) => t.isImportSpecifier(s) && s.local.name === cssBinding);\n if (cssSpecIndex === -1) continue;\n\n if (node.specifiers.length === 1) {\n ast.program.body.splice(i, 1);\n } else {\n node.specifiers.splice(cssSpecIndex, 1);\n }\n return;\n }\n}\n\n/** Return the index of the last import declaration in the module. */\nexport function findLastImportIndex(ast: t.File): number {\n let lastImportIndex = -1;\n for (let i = 0; i < ast.program.body.length; i++) {\n if (t.isImportDeclaration(ast.program.body[i])) {\n lastImportIndex = i;\n }\n }\n return lastImportIndex;\n}\n\n/**\n * Insert statements directly after the module's leading block of imports.\n *\n * I.e. before the first non-import statement, so helpers land near the top even when a\n * later import (like the test-mode `import \"virtual:truss:test-css\"`) trails the module body.\n */\nexport function insertAfterLeadingImports(ast: t.File, statements: t.Statement[]): void {\n if (statements.length === 0) return;\n const firstNonImport = ast.program.body.findIndex((node) => !t.isImportDeclaration(node));\n ast.program.body.splice(firstNonImport === -1 ? ast.program.body.length : firstNonImport, 0, ...statements);\n}\n\n/**\n * Find the local name of a named import, i.e. `mergeProps13` for `import { mergeProps as mergeProps13 }`.\n *\n * When `source` is given, only imports from that module are considered.\n */\nexport function findNamedImportBinding(ast: t.File, importedName: string, source?: string): string | null {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n if (source !== undefined && node.source.value !== source) continue;\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: importedName })) {\n return spec.local.name;\n }\n }\n }\n return null;\n}\n\n/** Find the import declaration for `source`, if the module has one. */\nexport function findImportDeclaration(ast: t.File, source: string): t.ImportDeclaration | null {\n for (const node of ast.program.body) {\n if (t.isImportDeclaration(node) && node.source.value === source) {\n return node;\n }\n }\n return null;\n}\n\n/**\n * Repoint an import that only binds `Css` at `source` with `imports`, so the runtime import\n * lands on the line the Css import occupied. Returns false when no such sole-specifier import exists.\n */\nexport function replaceCssImportWithNamedImports(\n ast: t.File,\n cssBinding: string,\n source: string,\n imports: NamedImport[],\n): boolean {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex((spec) => {\n return t.isImportSpecifier(spec) && spec.local.name === cssBinding;\n });\n if (cssSpecIndex === -1 || node.specifiers.length !== 1) continue;\n\n node.source = t.stringLiteral(source);\n node.specifiers = imports.map(toImportSpecifier);\n return true;\n }\n\n return false;\n}\n\n/** Add `imports` to the existing import of `source`, or add a new import after the last one. */\nexport function upsertNamedImports(ast: t.File, source: string, imports: NamedImport[]): void {\n if (imports.length === 0) return;\n\n const existing = findImportDeclaration(ast, source);\n if (!existing) {\n const importDecl = t.importDeclaration(imports.map(toImportSpecifier), t.stringLiteral(source));\n ast.program.body.splice(findLastImportIndex(ast) + 1, 0, importDecl);\n return;\n }\n\n for (const entry of imports) {\n const exists = existing.specifiers.some((spec) => {\n return t.isImportSpecifier(spec) && t.isIdentifier(spec.imported, { name: entry.importedName });\n });\n if (!exists) existing.specifiers.push(toImportSpecifier(entry));\n }\n}\n\n/**\n * Extract a `Css` method/property chain from an expression.\n *\n * Example: `Css.if(cond).df.else.db.$` ->\n * `[{type:\"if\"}, {type:\"getter\", name:\"df\"}, {type:\"else\"}, {type:\"getter\", name:\"db\"}]`\n *\n * Returns `null` when the expression is not rooted at the Css import binding,\n * which lets the caller ignore unrelated member expressions cheaply.\n */\nexport function extractChain(node: t.Expression, cssBinding: string): ChainNode[] | null {\n const chain: ChainNode[] = [];\n let current: t.Expression = node;\n\n while (true) {\n if (t.isIdentifier(current, { name: cssBinding })) {\n chain.reverse();\n return chain;\n }\n\n if (t.isMemberExpression(current) && !current.computed && t.isIdentifier(current.property)) {\n const name = current.property.name;\n if (name === \"else\") {\n chain.push({ type: \"else\" });\n } else {\n chain.push({ type: \"getter\", name });\n }\n current = current.object as t.Expression;\n continue;\n }\n\n if (\n t.isCallExpression(current) &&\n t.isMemberExpression(current.callee) &&\n !current.callee.computed &&\n t.isIdentifier(current.callee.property)\n ) {\n const name = current.callee.property.name;\n\n if (name === \"if\") {\n chain.push({\n type: \"if\",\n conditionNode: current.arguments[0] as t.Expression,\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n chain.push({\n type: \"call\",\n name,\n args: current.arguments as (t.Expression | t.SpreadElement)[],\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n return null;\n }\n}\n\n/**\n * Extract the chain of a complete `Css.*.$` expression.\n *\n * Returns `null` when `node` does not end in `.$` or is not rooted at `cssBinding`.\n */\nexport function extractDollarChain(node: t.Node, cssBinding: string): ChainNode[] | null {\n if (!t.isMemberExpression(node) || node.computed || !t.isIdentifier(node.property, { name: \"$\" })) return null;\n if (t.isSuper(node.object)) return null;\n return extractChain(node.object, cssBinding);\n}\n\n/** Strip parentheses and TypeScript-only wrappers, i.e. `(x as Foo)!` → `x`. */\nexport function unwrapExpression(node: t.Expression): t.Expression {\n let current = node;\n while (\n t.isParenthesizedExpression(current) ||\n t.isTSAsExpression(current) ||\n t.isTSTypeAssertion(current) ||\n t.isTSNonNullExpression(current) ||\n t.isTSSatisfiesExpression(current)\n ) {\n current = current.expression;\n }\n return current;\n}\n\n/** The static name of an object key, i.e. `foo` and `\"foo\"` → `\"foo\"`; null for computed or other keys. */\nexport function staticPropertyName(key: t.Node): string | null {\n if (t.isIdentifier(key)) return key.name;\n if (t.isStringLiteral(key)) return key.value;\n return null;\n}\n\n/** The static member name of `obj.foo` or `obj[\"foo\"]` → `\"foo\"`; null for other member access. */\nexport function memberPropertyName(node: t.MemberExpression): string | null {\n if (!node.computed && t.isIdentifier(node.property)) return node.property.name;\n if (node.computed && t.isStringLiteral(node.property)) return node.property.value;\n return null;\n}\n\nfunction toImportSpecifier(entry: NamedImport): t.ImportSpecifier {\n return t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName));\n}\n","import _generate from \"@babel/generator\";\nimport { parse } from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\n\n// Babel packages are CJS today; normalize default interop across loaders.\nexport const generate = ((_generate as unknown as { default?: typeof _generate }).default ??\n _generate) as typeof _generate;\nexport const traverse = ((_traverse as unknown as { default?: typeof _traverse }).default ??\n _traverse) as typeof _traverse;\n\n/** Parse a TypeScript/JSX module with the plugin's standard parser options. */\nexport function parseModule(code: string, filename: string): t.File {\n return parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n }) as t.File;\n}\n","import { resolve } from \"path\";\nimport { generateCssText, type AtomicRule } from \"./emit-css\";\nimport { transformCssTs } from \"./transform-css\";\nimport { transformTruss, type TransformResult, type TransformTrussOptions } from \"./transform\";\nimport {\n annotateArbitraryCssBlock,\n mergeTrussCss,\n parseTrussCss,\n readTrussCss,\n type ParsedTrussCss,\n} from \"./merge-css\";\nimport { loadMapping } from \"./mapping-utils\";\nimport type { TrussMapping } from \"./types\";\nimport { rootSpacingPreludeCss } from \"../spacing-css-var\";\nimport { compareClassNames } from \"../css-order\";\n\nexport interface TrussTransformSessionOptions {\n mappingPath: () => string;\n projectRoot: () => string;\n libraries?: string[];\n onCssChanged?: () => void;\n}\n\n/** Shared transform state for plugin adapters that collect Truss CSS. */\nexport function createTrussTransformSession(options: TrussTransformSessionOptions): TrussTransformSession {\n let mapping: TrussMapping | null = null;\n let libraryCache: ParsedTrussCss[] | null = null;\n const cssRegistry = new Map<string, AtomicRule>();\n const arbitraryCssRegistry = new Map<string, string>();\n const libraryPaths = options.libraries ?? [];\n\n function ensureMapping(): TrussMapping {\n if (!mapping) {\n mapping = loadMapping(options.mappingPath());\n }\n return mapping;\n }\n\n function loadLibraries(): ParsedTrussCss[] {\n if (!libraryCache) {\n libraryCache = libraryPaths.map((libPath) => {\n const resolved = resolve(options.projectRoot(), libPath);\n return readTrussCss(resolved);\n });\n }\n return libraryCache;\n }\n\n function reset(): void {\n cssRegistry.clear();\n arbitraryCssRegistry.clear();\n libraryCache = null;\n }\n\n function updateArbitraryCssRegistry(sourcePath: string, sourceCode: string): void {\n sourcePath = resolve(sourcePath).replace(/\\\\/g, \"/\");\n const css = transformCssTs(sourceCode, sourcePath, ensureMapping()).trim();\n if (css.length > 0) {\n const prev = arbitraryCssRegistry.get(sourcePath);\n arbitraryCssRegistry.set(sourcePath, css);\n if (prev !== css) options.onCssChanged?.();\n return;\n }\n\n if (arbitraryCssRegistry.delete(sourcePath)) {\n options.onCssChanged?.();\n }\n }\n\n function transformCode(\n code: string,\n fileId: string,\n transformOptions: TransformTrussOptions = {},\n ): TransformResult | null {\n const result = transformTruss(code, fileId, ensureMapping(), transformOptions);\n if (!result) return null;\n\n let hasNewRules = false;\n for (const [className, rule] of result.rules) {\n if (!cssRegistry.has(className)) {\n cssRegistry.set(className, rule);\n hasNewRules = true;\n }\n }\n if (hasNewRules) {\n options.onCssChanged?.();\n }\n\n return result;\n }\n\n function collectCss(): string {\n const mapping = ensureMapping();\n const appCssParts = [generateCssText(cssRegistry)];\n const allArbitrary = Array.from(arbitraryCssRegistry.entries())\n .sort((a, b) => compareClassNames(a[0], b[0]))\n .map((entry) => entry[1])\n .join(\"\\n\\n\");\n appCssParts.push(annotateArbitraryCssBlock(allArbitrary));\n const appCss = appCssParts.filter((part) => part.length > 0).join(\"\\n\");\n const libs = loadLibraries();\n const body = libs.length === 0 ? appCss : mergeTrussCss([...libs, parseTrussCss(appCss)]);\n if (body.length === 0) return \"\";\n return `${rootSpacingPreludeCss(mapping.increment)}\\n${body}`;\n }\n\n function hasCss(): boolean {\n return cssRegistry.size > 0 || arbitraryCssRegistry.size > 0 || libraryPaths.length > 0;\n }\n\n /** Collect only libraries; application modules deliver their own CSS in tests. */\n function collectTestCss(): string {\n return mergeTrussCss(loadLibraries());\n }\n\n /** Read the transformed arbitrary CSS for one canonical source file. */\n function getArbitraryCss(sourcePath: string): string {\n return arbitraryCssRegistry.get(resolve(sourcePath).replace(/\\\\/g, \"/\")) ?? \"\";\n }\n\n return {\n collectCss,\n collectTestCss,\n getArbitraryCss,\n ensureMapping,\n hasCss,\n reset,\n transformCode,\n updateArbitraryCssRegistry,\n };\n}\n\nexport interface TrussTransformSession {\n collectCss: () => string;\n collectTestCss: () => string;\n getArbitraryCss: (sourcePath: string) => string;\n ensureMapping: () => TrussMapping;\n hasCss: () => boolean;\n reset: () => void;\n transformCode: (code: string, fileId: string, options?: TransformTrussOptions) => TransformResult | null;\n updateArbitraryCssRegistry: (sourcePath: string, sourceCode: string) => void;\n}\n","import * as t from \"@babel/types\";\nimport type { MarkerSegment, ResolvedConditionContext, ResolvedSegment, TrussMapping } from \"./types\";\nimport { breakpointMediaQuery } from \"./mapping-utils\";\nimport { extractDollarChain, unwrapExpression } from \"./ast-utils\";\nimport { type CallChainNode, type ChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext, emptyConditionContext, resetConditionContext } from \"./condition-context\";\nimport { errorSegment, requireEntry, resolveEntry } from \"./resolve-entry\";\nimport { resolveCallNode } from \"./resolve-calls\";\nimport { resolveWhenCall } from \"./resolve-when\";\nimport { containerQueryFromCall } from \"./container-query\";\nimport { invertMediaQuery } from \"../media-query\";\nimport { isTrussPseudoMethod, trussPseudoSelector } from \"../pseudo-selectors\";\n\n/**\n * Optional hook for resolving identifier references like `const same = Css.blue.$`\n * back into a `ChainNode[]`, so the core chain resolver can stay decoupled from\n * Babel scope/AST traversal concerns.\n */\nexport type CssChainReferenceResolver = (node: t.Expression) => ChainNode[] | null;\n\nexport interface ResolveChainCtx {\n /** The Truss mapping that defines abbreviations, breakpoints, and typography resolution. */\n mapping: TrussMapping;\n /** The local identifier bound to the generated `Css` export, if one exists in this file. */\n cssBindingName?: string;\n /** Optional lexical binding resolver for `const same = Css.blue.$` style references. */\n resolveCssChainReference?: CssChainReferenceResolver;\n}\n\n/**\n * A resolved chain that may contain conditional (if/else) sections.\n *\n * I.e. `ChainNode` is just the raw AST chain from `Css` to `.$`, which may contain if/else nodes;\n * this `ResolvedChain` is the post-processed result where each if/else has been split into separate segments.\n *\n * The `parts` array contains unconditional segments and conditional groups.\n * The `markers` array contains marker directives (Css.marker.$, Css.markerOf(\"x\").$).\n */\nexport interface ResolvedChain {\n parts: ResolvedChainPart[];\n /** Marker directives to attach to the element (not CSS styles). */\n markers: MarkerSegment[];\n /** Error messages from unsupported patterns found in this chain. */\n errors: string[];\n}\n\nexport type ResolvedChainPart =\n | { type: \"unconditional\"; segments: ResolvedSegment[] }\n | {\n type: \"conditional\";\n conditionNode: t.Expression;\n thenSegments: ResolvedSegment[];\n elseSegments: ResolvedSegment[];\n };\n\n/** Every segment in a chain part, i.e. both branches of a conditional part. */\nexport function partSegments(part: ResolvedChainPart): ResolvedSegment[] {\n return part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n}\n\n/** Every segment in a resolved chain, across all parts and branches. */\nexport function chainSegments(chain: ResolvedChain): ResolvedSegment[] {\n return chain.parts.flatMap((part) => partSegments(part));\n}\n\n/**\n * Resolve a whole `Css.*.$` chain in one left-to-right pass, splitting at if/else into parts.\n *\n * One live condition context is advanced by every modifier node as it is encountered, and each\n * style node is resolved under the context at that moment. `initialContext` seeds that context,\n * i.e. the selector of an enclosing `when({ \":hover\": ... })` value.\n *\n * ## Chain semantics\n *\n * A `Css.*.$` chain is read left-to-right. Each segment is either a style\n * abbreviation (getter or call) or a modifier that changes the context for\n * subsequent styles. The modifiers and their precedence:\n *\n * - **`if(bool)`** / **`else`** — Boolean conditional. Splits the chain into\n * then/else branches at the AST level. Subsequent styles go into the active\n * branch. A new `if` starts a new conditional.\n *\n * - **`if(mediaQuery)`** — String overload. Sets the media query context\n * (same as `ifSm`, `ifMd` etc.) for subsequent styles. Does NOT create\n * a boolean branch.\n *\n * - **`ifSm`**, **`ifMd`**, **`ifLg`**, etc. — Breakpoint getters. Set the\n * media query context. Stacks with pseudo-classes: `ifSm.onHover.blue.$`\n * applies both conditions.\n *\n * - **`onHover`**, **`onFocus`**, etc. — Pseudo-class getters. Set the\n * pseudo-class context. Stacks with media queries (see above). A new\n * pseudo-class replaces the previous one.\n *\n * - **`element(\"::placeholder\")`** — Pseudo-element. Sets the pseudo-element\n * context for subsequent styles.\n *\n * - **`when(\":hover\")` / `when('[data-state=\"open\"]')`** — Same-element selector.\n * Behaves like a custom selector context and stacks with media queries.\n *\n * - **`when({ \":hover\": Css.blue.$ })`** — Object form. Each value is resolved\n * like an inline `Css.*.$` chain using the selector key as its initial\n * selector context, while inheriting the current media/when context.\n *\n * - **`when(marker, \"ancestor\", \":hover\")`** — Relationship selector. Sets the\n * relationship selector context and stacks with same-element pseudos, pseudo-elements,\n * and media queries.\n *\n * - **`ifContainer({ gt, lt })`** — Container query. Sets the media query\n * context to an `@container` query string.\n *\n * - **`end`** — Closes the active boolean or media `if`/`else` group and resets\n * the media query, pseudo-class, pseudo-element, and `when(...)`\n * relationship-selector context so subsequent styles are unconditional.\n *\n * Contexts accumulate left-to-right until explicitly replaced within the same\n * axis or cleared with `end`. A media query set by `ifSm` persists through\n * `onHover` and `when(...)`.\n * A boolean `if(bool)` nests the chain but inherits the currently-active\n * modifier axes into both branches.\n */\nexport function resolveFullChain(\n ctx: ResolveChainCtx,\n chain: ChainNode[],\n initialContext: ResolvedConditionContext = emptyConditionContext(),\n): ResolvedChain {\n const { mapping } = ctx;\n const markerScan = scanMarkerNodes(chain);\n const nodes = markerScan.chain;\n const markers = [...markerScan.markers];\n const errors = [...markerScan.errors];\n const parts: ResolvedChainPart[] = [];\n const context = cloneConditionContext(initialContext);\n // The open unconditional part; closed before each conditional or when({ ... }) part\n let current: ResolvedSegment[] = [];\n\n function closeCurrentPart(): void {\n if (current.length > 0) {\n parts.push({ type: \"unconditional\", segments: current });\n current = [];\n }\n }\n\n let i = 0;\n while (i < nodes.length) {\n const node = nodes[i];\n\n const mediaQuery = mediaQueryOfNode(node, mapping);\n if (mediaQuery !== null) {\n const elseIndex = findElseIndex(nodes, i + 1);\n if (elseIndex === -1) {\n // I.e. `ifSm.black` or `if(\"@media ...\").black`: a media context for the nodes that follow.\n context.mediaQuery = mediaQuery;\n i++;\n continue;\n }\n\n // I.e. `ifSm.black.else.white[.end]`: the else branch gets the inverted media query.\n const branchEnd = findEndIndex(nodes, elseIndex + 1);\n const thenContext = cloneConditionContext(context);\n thenContext.mediaQuery = mediaQuery;\n const elseContext = cloneConditionContext(context);\n elseContext.mediaQuery = invertMediaQuery(mediaQuery);\n current.push(\n ...resolveSegments(ctx, nodes.slice(i + 1, elseIndex), thenContext),\n ...resolveSegments(ctx, nodes.slice(elseIndex + 1, branchEnd), elseContext),\n );\n if (branchEnd === nodes.length) {\n break;\n }\n resetConditionContext(context);\n i = branchEnd + 1;\n continue;\n }\n\n if (isWhenObjectCall(node)) {\n closeCurrentPart();\n const resolved = resolveWhenObjectSelectors(ctx, node, context);\n parts.push(...resolved.parts);\n markers.push(...resolved.markers);\n errors.push(...resolved.errors);\n i++;\n continue;\n }\n\n if (node.type === \"if\") {\n // Boolean conditional; the string-literal `if(mediaQuery)` overload was handled above.\n closeCurrentPart();\n // Both branches inherit the context as of the `if`, even when the group's `end` resets it below\n const branchContext = cloneConditionContext(context);\n\n // Collect \"then\" nodes until \"else\" or end\n const thenNodes: ChainNode[] = [];\n const elseNodes: ChainNode[] = [];\n i++;\n let inElse = false;\n while (i < nodes.length) {\n const branchNode = nodes[i];\n if (branchNode.type === \"getter\" && branchNode.name === \"end\") {\n resetConditionContext(context);\n i++;\n break;\n }\n if (branchNode.type === \"else\") {\n inElse = true;\n i++;\n continue;\n }\n if (branchNode.type === \"if\") {\n // Nested if — break out and let the outer loop handle it\n break;\n }\n if (inElse) {\n elseNodes.push(branchNode);\n } else {\n thenNodes.push(branchNode);\n }\n i++;\n }\n parts.push({\n type: \"conditional\",\n conditionNode: node.conditionNode,\n thenSegments: resolveSegments(ctx, thenNodes, cloneConditionContext(branchContext)),\n elseSegments: resolveSegments(ctx, elseNodes, cloneConditionContext(branchContext)),\n });\n continue;\n }\n\n current.push(...resolveNode(ctx, node, context));\n i++;\n }\n\n closeCurrentPart();\n\n const segmentErrors = parts\n .flatMap((part) => partSegments(part))\n .flatMap((seg) => (seg.kind === \"error\" ? [seg.message] : []));\n return { parts, markers, errors: [...new Set([...errors, ...segmentErrors])] };\n}\n\n/**\n * Resolve a run of nodes under one live `context`, which each modifier node advances in place.\n *\n * I.e. the body of an `if()` branch. Does NOT split at if/else — use resolveFullChain for that.\n */\nfunction resolveSegments(\n ctx: ResolveChainCtx,\n nodes: ChainNode[],\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n return nodes.flatMap((node) => resolveNode(ctx, node, context));\n}\n\n/**\n * Resolve one chain node under `context`.\n *\n * Modifiers (`ifSm`, `onHover`, `end`, ...) advance `context` and yield no segments; abbreviations and\n * built-in calls yield their segments; an unsupported pattern yields one error segment in their place.\n */\nfunction resolveNode(ctx: ResolveChainCtx, node: ChainNode, context: ResolvedConditionContext): ResolvedSegment[] {\n const { mapping } = ctx;\n try {\n if (isWhenObjectCall(node)) {\n return flattenWhenObjectParts(resolveWhenObjectSelectors(ctx, node, context));\n }\n if (applyModifierNodeToConditionContext(context, node, mapping)) {\n return [];\n }\n if (node.type === \"getter\") {\n return resolveEntry(node.name, requireEntry(mapping, node.name), mapping, context);\n }\n if (node.type === \"call\") {\n return resolveCallNode(node, mapping, context);\n }\n return [];\n } catch (err) {\n if (!(err instanceof UnsupportedPatternError)) throw err;\n return [errorSegment(err.message)];\n }\n}\n\n/**\n * Apply context-only chain nodes like breakpoints/pseudos/end.\n *\n * Returns false for nodes that produce styles instead. Throws UnsupportedPatternError for a\n * malformed modifier, which `resolveNode` turns into an error segment.\n */\nfunction applyModifierNodeToConditionContext(\n context: ResolvedConditionContext,\n node: ChainNode,\n mapping: TrussMapping,\n): boolean {\n if (node.type === \"getter\") {\n if (node.name === \"end\") {\n resetConditionContext(context);\n return true;\n }\n if (isTrussPseudoMethod(node.name)) {\n context.pseudoClass = trussPseudoSelector(node.name);\n return true;\n }\n const mediaQuery = breakpointMediaQuery(mapping, node.name);\n if (mediaQuery !== null) {\n context.mediaQuery = mediaQuery;\n return true;\n }\n return false;\n }\n\n if (node.type !== \"call\") {\n return false;\n }\n\n if (node.name === \"ifContainer\") {\n context.mediaQuery = containerQueryFromCall(node);\n return true;\n }\n\n if (node.name === \"element\") {\n const arg = node.args.length === 1 ? node.args[0] : null;\n if (!t.isStringLiteral(arg)) {\n throw new UnsupportedPatternError(\n `element() requires exactly one string literal argument (e.g. \"::placeholder\")`,\n );\n }\n context.pseudoElement = arg.value;\n return true;\n }\n\n if (node.name === \"when\") {\n if (isWhenObjectCall(node)) {\n return false;\n }\n const resolved = resolveWhenCall(node);\n if (resolved.kind === \"selector\") {\n context.pseudoClass = resolved.selector;\n } else {\n context.whenPseudo = resolved.condition;\n }\n return true;\n }\n\n if (isTrussPseudoMethod(node.name)) {\n context.pseudoClass = trussPseudoSelector(node.name);\n if (node.args.length > 0) {\n throw new UnsupportedPatternError(\n `${node.name}() does not take arguments -- use when(marker, \"ancestor\", \":hover\") for relationship selectors`,\n );\n }\n return true;\n }\n\n return false;\n}\n\n// ── Chain scanning helpers for resolveFullChain ───────────────────────\n\n/** Pull marker nodes out of a chain before style resolution. */\nfunction scanMarkerNodes(chain: ChainNode[]): { chain: ChainNode[]; markers: MarkerSegment[]; errors: string[] } {\n const filteredChain: ChainNode[] = [];\n const markers: MarkerSegment[] = [];\n const errors: string[] = [];\n\n for (const node of chain) {\n if (node.type === \"getter\" && node.name === \"marker\") {\n markers.push({ type: \"marker\" });\n continue;\n }\n\n if (node.type === \"call\" && node.name === \"markerOf\") {\n const arg = node.args.length === 1 ? node.args[0] : null;\n if (!arg || t.isSpreadElement(arg)) {\n errors.push(\"[truss] Unsupported pattern: markerOf() requires exactly one argument (a marker variable)\");\n } else {\n markers.push({ type: \"marker\", markerNode: arg });\n }\n continue;\n }\n\n filteredChain.push(node);\n }\n\n return { chain: filteredChain, markers, errors };\n}\n\n/** The media query a node switches into, i.e. `ifSm` or `if(\"@media ...\")`; null for every other node. */\nfunction mediaQueryOfNode(node: ChainNode, mapping: TrussMapping): string | null {\n if (node.type === \"if\" && t.isStringLiteral(node.conditionNode)) {\n return node.conditionNode.value;\n }\n if (node.type === \"getter\") {\n return breakpointMediaQuery(mapping, node.name);\n }\n return null;\n}\n\n/** Index of the `else` that closes the branch starting at `start`, or -1 when an `if`/`end` comes first. */\nfunction findElseIndex(chain: ChainNode[], start: number): number {\n for (let i = start; i < chain.length; i++) {\n const node = chain[i];\n if (node.type === \"if\") {\n return -1;\n }\n if (node.type === \"getter\" && node.name === \"end\") {\n return -1;\n }\n if (node.type === \"else\") {\n return i;\n }\n }\n return -1;\n}\n\n/** Index of the first `end` at or after `start`, or `chain.length` when the chain has none. */\nfunction findEndIndex(chain: ChainNode[], start: number): number {\n for (let i = start; i < chain.length; i++) {\n const node = chain[i];\n if (node.type === \"getter\" && node.name === \"end\") {\n return i;\n }\n }\n return chain.length;\n}\n\n// ── when({ ... }) object form ─────────────────────────────────────────\n\n/** Detect `when({ ... })` so object-form selector groups can be resolved specially. */\ntype WhenObjectCallChainNode = CallChainNode & { name: \"when\"; args: [t.ObjectExpression] };\n\nfunction isWhenObjectCall(node: ChainNode): node is WhenObjectCallChainNode {\n return node.type === \"call\" && node.name === \"when\" && node.args.length === 1 && t.isObjectExpression(node.args[0]);\n}\n\n/**\n * Resolve `when({ \":hover\": Css.blue.$, ... })` by recursively resolving each\n * nested `Css.*.$` value with the selector key as its initial pseudo-class.\n */\nfunction resolveWhenObjectSelectors(\n ctx: ResolveChainCtx,\n node: WhenObjectCallChainNode,\n context: ResolvedConditionContext,\n): ResolvedChain {\n if (!ctx.cssBindingName) {\n return {\n parts: [],\n markers: [],\n errors: [new UnsupportedPatternError(`when({ ... }) requires a resolvable Css binding`).message],\n };\n }\n\n const parts: ResolvedChainPart[] = [];\n const markers: MarkerSegment[] = [];\n const errors: string[] = [];\n\n for (const property of node.args[0].properties) {\n try {\n if (t.isSpreadElement(property)) {\n throw new UnsupportedPatternError(`when({ ... }) does not support spread properties`);\n }\n if (!t.isObjectProperty(property)) {\n throw new UnsupportedPatternError(`when({ ... }) only supports plain object properties`);\n }\n if (property.computed || !t.isStringLiteral(property.key)) {\n throw new UnsupportedPatternError(`when({ ... }) selector keys must be string literals`);\n }\n\n const value = unwrapExpression(property.value as t.Expression);\n const innerChain = resolveWhenObjectValueChain(ctx, value);\n if (!innerChain) {\n throw new UnsupportedPatternError(`when({ ... }) values must be Css.*.$ expressions`);\n }\n\n const selectorContext = cloneConditionContext(context);\n selectorContext.pseudoClass = property.key.value;\n const resolved = resolveFullChain(ctx, innerChain, selectorContext);\n parts.push(...resolved.parts);\n markers.push(...resolved.markers);\n errors.push(...resolved.errors);\n } catch (err) {\n if (!(err instanceof UnsupportedPatternError)) throw err;\n errors.push(err.message);\n }\n }\n\n return { parts, markers, errors: [...new Set(errors)] };\n}\n\n/**\n * Resolve a `when({ ... })` value into an inner `ChainNode[]`.\n *\n * I.e. this accepts either a direct `Css.blue.$` member expression or a\n * transform-provided reference resolver for identifiers like `const same = Css.blue.$`.\n * The reference lookup itself stays outside this file because it depends on\n * Babel scope/NodePath traversal state, while `resolve-chain.ts` is kept focused\n * on chain semantics rather than lexical binding analysis.\n */\nfunction resolveWhenObjectValueChain(ctx: ResolveChainCtx, value: t.Expression): ChainNode[] | null {\n const direct = ctx.cssBindingName ? extractDollarChain(value, ctx.cssBindingName) : null;\n return direct ?? ctx.resolveCssChainReference?.(value) ?? null;\n}\n\n/** Flatten nested `when({ ... })` parts back into plain segments for a branch body. */\nfunction flattenWhenObjectParts(resolved: ResolvedChain): ResolvedSegment[] {\n const segments: ResolvedSegment[] = [];\n\n // I.e. a branch body needs a flat segment list, even though `when({ ... })` is resolved via `resolveFullChain()`.\n for (const part of resolved.parts) {\n if (part.type !== \"unconditional\") {\n throw new UnsupportedPatternError(`when({ ... }) values cannot use if()/else in this context`);\n }\n\n segments.push(...part.segments);\n }\n\n for (const err of resolved.errors) {\n segments.push(errorSegment(err));\n }\n\n return segments;\n}\n","import { readFileSync } from \"fs\";\nimport type { TrussMapping } from \"./types\";\n\n/** Load a truss mapping file synchronously. */\nexport function loadMapping(path: string): TrussMapping {\n const raw = readFileSync(path, \"utf8\");\n return JSON.parse(raw);\n}\n\nconst longhandCache = new WeakMap<TrussMapping, Map<string, string>>();\n\n/**\n * Reverse lookup from `\"cssProperty\\0cssValue\"` → canonical abbreviation name.\n *\n * I.e. `{ paddingTop: \"8px\" }` → `\"pt1\"`, `{ borderStyle: \"solid\" }` → `\"bss\"`.\n * Cached per mapping via WeakMap.\n */\nexport function getLonghandLookup(mapping: TrussMapping): Map<string, string> {\n let lookup = longhandCache.get(mapping);\n if (lookup) return lookup;\n lookup = new Map();\n for (const [abbr, entry] of Object.entries(mapping.abbreviations)) {\n if (entry.kind !== \"static\") continue;\n const keys = Object.keys(entry.defs);\n if (keys.length !== 1) continue;\n const key = `${keys[0]}\\0${entry.defs[keys[0]]}`;\n // First match wins — if multiple abbreviations produce the same declaration,\n // the one that appears first in the mapping is canonical.\n if (!lookup.has(key)) lookup.set(key, abbr);\n }\n longhandCache.set(mapping, lookup);\n return lookup;\n}\n\n/** The canonical single-property abbreviation for `{ [cssProp]: cssValue }`, i.e. `(\"display\", \"grid\")` → `\"dg\"`. */\nexport function findCanonicalAbbreviation(\n mapping: TrussMapping,\n cssProp: string,\n cssValue: string,\n): string | undefined {\n return getLonghandLookup(mapping).get(`${cssProp}\\0${cssValue}`);\n}\n\n/** The media query behind a breakpoint getter, i.e. `\"ifSm\"` → `\"@media screen and (max-width: 599px)\"`, or null. */\nexport function breakpointMediaQuery(mapping: TrussMapping, getterName: string): string | null {\n const breakpoints = mapping.breakpoints;\n if (!breakpoints || !Object.hasOwn(breakpoints, getterName)) return null;\n return breakpoints[getterName];\n}\n\n/**\n * The breakpoint name behind a media query, without its `if` prefix.\n *\n * I.e. `\"@media screen and (max-width: 599px)\"` → `\"Sm\"` when `breakpoints.ifSm` is that query,\n * or null for media queries that are not a configured breakpoint.\n */\nexport function breakpointNameForMediaQuery(mapping: TrussMapping, mediaQuery: string): string | null {\n const breakpoints = mapping.breakpoints;\n if (!breakpoints) return null;\n const getterName = Object.keys(breakpoints).find((name) => breakpoints[name] === mediaQuery);\n return getterName === undefined ? null : getterName.replace(/^if/, \"\");\n}\n","import type * as t from \"@babel/types\";\n\n/**\n * The parsed shape of a `Css.*.$` chain: one node per getter, call, `if()`, or `else` between\n * `Css` and `.$`, in source order.\n *\n * I.e. `Css.if(cond).df.else.db.$` → `[{ type: \"if\" }, { type: \"getter\", name: \"df\" }, { type: \"else\" }, { type: \"getter\", name: \"db\" }]`.\n * Produced by `extractChain` in ast-utils and consumed by the resolve-* modules.\n */\nexport type ChainNode = GetterChainNode | CallChainNode | IfChainNode | ElseChainNode;\n\nexport interface GetterChainNode {\n type: \"getter\";\n name: string;\n}\n\nexport interface CallChainNode {\n type: \"call\";\n name: string;\n args: (t.Expression | t.SpreadElement)[];\n}\n\nexport interface IfChainNode {\n type: \"if\";\n conditionNode: t.Expression;\n}\n\nexport interface ElseChainNode {\n type: \"else\";\n}\n\n/**\n * A chain pattern the compiler cannot resolve.\n *\n * Resolution catches it per node and records an error segment in the chain, which transform\n * reports as a `console.error` in the output and transform-css as a CSS comment.\n */\nexport class UnsupportedPatternError extends Error {\n constructor(message: string) {\n super(`[truss] Unsupported pattern: ${message}`);\n this.name = \"UnsupportedPatternError\";\n }\n}\n","import type { ResolvedConditionContext } from \"./types\";\n\n/** The context with no modifier axes active. */\nexport function emptyConditionContext(): ResolvedConditionContext {\n return {\n mediaQuery: null,\n pseudoClass: null,\n pseudoElement: null,\n whenPseudo: null,\n };\n}\n\n/** `WhenCondition` objects are never mutated after creation, so a shallow copy is a full snapshot. */\nexport function cloneConditionContext(context: ResolvedConditionContext): ResolvedConditionContext {\n return { ...context };\n}\n\n/** Clear every axis in place, i.e. for `end`. */\nexport function resetConditionContext(context: ResolvedConditionContext): void {\n Object.assign(context, emptyConditionContext());\n}\n","import type {\n ResolvedConditionContext,\n ResolvedSegment,\n StaticSegment,\n TrussMapping,\n TrussMappingEntry,\n} from \"./types\";\nimport { UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext } from \"./condition-context\";\n\n/** The mapping entry for `abbr`, or an unsupported-pattern error for an unknown abbreviation. */\nexport function requireEntry(mapping: TrussMapping, abbr: string): TrussMappingEntry {\n const entry = mapping.abbreviations[abbr];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown abbreviation \"${abbr}\"`);\n }\n return entry;\n}\n\n/** Placeholder segment that carries an unsupported-pattern message through to the emitter. */\nexport function errorSegment(message: string): ResolvedSegment {\n return { kind: \"error\", message };\n}\n\n/** A static segment under a snapshot of the active condition axes. */\nexport function staticSegment(\n abbr: string,\n defs: Record<string, unknown>,\n context: ResolvedConditionContext,\n argResolved?: string,\n): StaticSegment {\n return { kind: \"static\", abbr, defs, argResolved, condition: cloneConditionContext(context) };\n}\n\n/** Resolve a static or alias entry (from a getter access). Defs are always flat. */\nexport function resolveEntry(\n abbr: string,\n entry: TrussMappingEntry,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n switch (entry.kind) {\n case \"static\": {\n return [staticSegment(abbr, entry.defs, context)];\n }\n case \"alias\": {\n const result: ResolvedSegment[] = [];\n for (const chainAbbr of entry.chain) {\n const subEntry = mapping.abbreviations[chainAbbr];\n if (!subEntry) {\n throw new UnsupportedPatternError(`Alias \"${abbr}\" references unknown abbreviation \"${chainAbbr}\"`);\n }\n result.push(...resolveEntry(chainAbbr, subEntry, mapping, context));\n }\n return result;\n }\n case \"variable\":\n case \"delegate\":\n throw new UnsupportedPatternError(`Abbreviation \"${abbr}\" requires arguments — use ${abbr}() not .${abbr}`);\n default:\n throw new UnsupportedPatternError(`Unhandled entry kind for \"${abbr}\"`);\n }\n}\n","import * as t from \"@babel/types\";\nimport {\n hasCondition,\n type ResolvedConditionContext,\n type ResolvedSegment,\n type TrussMapping,\n type TrussMappingEntry,\n} from \"./types\";\nimport { findCanonicalAbbreviation } from \"./mapping-utils\";\nimport { staticPropertyName } from \"./ast-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext } from \"./condition-context\";\nimport { requireEntry, staticSegment } from \"./resolve-entry\";\nimport { isCustomPropertyLiteral, singleArg, tryEvaluatePropertyLiteral, tryNumericLiteral } from \"./resolve-literals\";\nimport { resolveSetVarCall } from \"./resolve-setvar\";\nimport { resolveTypographyCall } from \"./resolve-typography\";\n\n/** Resolve a call node: a built-in like `add(...)`/`setVar(...)`, or a variable/delegate abbreviation like `mt(2)`. */\nexport function resolveCallNode(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n switch (node.name) {\n case \"with\":\n return [resolveWithCall(node)];\n case \"add\":\n return resolveAddCall(node, mapping, context);\n case \"className\":\n return [resolveClassNameCall(node, context)];\n case \"style\":\n return [resolveStyleCall(node, context)];\n case \"setVar\":\n return resolveSetVarCall(node, mapping, context);\n case \"typography\":\n return resolveTypographyCall(node, mapping, context);\n }\n\n const entry = requireEntry(mapping, node.name);\n if (entry.kind === \"variable\") {\n return [resolveVariableCall(node.name, entry, node, mapping, context)];\n }\n if (entry.kind === \"delegate\") {\n return [resolveDelegateCall(node.name, entry, node, mapping, context)];\n }\n throw new UnsupportedPatternError(`Abbreviation \"${node.name}\" is ${entry.kind}, cannot be called as a function`);\n}\n\n/** Resolve a variable (parameterized) call like mt(2) or mt(x). */\nfunction resolveVariableCall(\n abbr: string,\n entry: Extract<TrussMappingEntry, { kind: \"variable\" }>,\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment {\n const arg = singleArg(node, abbr);\n return resolveLiteralOrVariableSegment({\n abbr,\n props: entry.props,\n incremented: entry.incremented,\n extraDefs: entry.extraDefs,\n argAst: arg,\n literalValue: tryEvaluatePropertyLiteral(arg, mapping, entry.incremented),\n mapping,\n context,\n });\n}\n\n/** Resolve a delegate call like mtPx(12). */\nfunction resolveDelegateCall(\n abbr: string,\n entry: Extract<TrussMappingEntry, { kind: \"delegate\" }>,\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment {\n const targetEntry = mapping.abbreviations[entry.target];\n if (!targetEntry || targetEntry.kind !== \"variable\") {\n throw new UnsupportedPatternError(`Delegate \"${abbr}\" targets \"${entry.target}\" which is not a variable entry`);\n }\n const arg = singleArg(node, abbr);\n // I.e. `mtPx(12)` folds to `12px` and `mtPx(-4)` to `-4px`; anything else is a runtime value\n const pixels = tryNumericLiteral(arg);\n // Use the target abbreviation name for delegate segments (i.e. mtPx → mt)\n return resolveLiteralOrVariableSegment({\n abbr: entry.target,\n props: targetEntry.props,\n incremented: false,\n appendPx: true,\n extraDefs: targetEntry.extraDefs,\n argAst: arg,\n literalValue: pixels === null ? null : `${pixels}px`,\n mapping,\n context,\n });\n}\n\n/**\n * Resolve a parameterized call argument to either a static fold, a compile-time `_var` tuple,\n * or a runtime `_var` tuple.\n *\n * I.e. `mt(2)` folds to `defs: { marginTop: \"calc(var(--t-spacing) * 2)\" }`; `mt(Tokens.gap)` stays a\n * `_var` segment with `argResolved: \"var(--gap)\"` so every token shares one `mt_var` class; and `mt(x)`\n * is a `_var` segment whose value is only known at runtime.\n */\nfunction resolveLiteralOrVariableSegment(params: {\n abbr: string;\n props: string[];\n incremented: boolean;\n appendPx?: boolean;\n extraDefs?: Record<string, unknown>;\n argAst: t.Expression;\n literalValue: string | null;\n mapping: TrussMapping;\n context: ResolvedConditionContext;\n}): ResolvedSegment {\n const { abbr, props, incremented, appendPx = false, extraDefs, argAst, literalValue, mapping, context } = params;\n\n if (literalValue !== null && !isCustomPropertyLiteral(argAst, mapping)) {\n const defs: Record<string, unknown> = Object.fromEntries(props.map((prop) => [prop, literalValue]));\n return staticSegment(abbr, { ...defs, ...extraDefs }, context, literalValue);\n }\n\n return {\n kind: \"variable\",\n abbr,\n props,\n incremented,\n appendPx,\n extraDefs,\n argNode: literalValue === null ? argAst : undefined,\n argResolved: literalValue ?? undefined,\n condition: cloneConditionContext(context),\n };\n}\n\n/** Raw class passthrough, i.e. `Css.className(buttonClass).df.$`. */\nfunction resolveClassNameCall(node: CallChainNode, context: ResolvedConditionContext): ResolvedSegment {\n const arg = singleArg(node, \"className\");\n if (hasCondition(context)) {\n // I.e. `ifSm.className(\"x\")` cannot be represented as a runtime-only class append.\n throw new UnsupportedPatternError(\n `className() cannot be used inside media query, pseudo-class, pseudo-element, or when() contexts`,\n );\n }\n // I.e. this is metadata for the rewriter/runtime, not an atomic CSS rule.\n return { kind: \"className\", arg };\n}\n\n/** Raw inline style passthrough, i.e. `Css.mt(x).style(vars).$`. */\nfunction resolveStyleCall(node: CallChainNode, context: ResolvedConditionContext): ResolvedSegment {\n const arg = singleArg(node, \"style\");\n if (hasCondition(context)) {\n throw new UnsupportedPatternError(\n `style() cannot be used inside media query, pseudo-class, pseudo-element, or when() contexts`,\n );\n }\n return { kind: \"inlineStyle\", arg };\n}\n\n/**\n * Resolve a `with(cssProp)` call — compose an existing Css expression or partial\n * style hash into the chain.\n *\n * - `with(expr)` — spread an existing Css expression into the chain output\n * - `with({ height })` — inline a partial style hash, skipping undefined values\n */\nfunction resolveWithCall(node: CallChainNode): ResolvedSegment {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`with() requires exactly 1 argument`);\n }\n const styleArg = node.args[0];\n if (t.isSpreadElement(styleArg)) {\n throw new UnsupportedPatternError(`with() does not support spread arguments`);\n }\n // Object literal: skip undefined values (the old addCss({ height }) pattern)\n return { kind: \"composed\", arg: styleArg, skipUndefined: t.isObjectExpression(styleArg) };\n}\n\n/**\n * Resolve an `add(...)` call.\n *\n * Supported overloads:\n * - `add({ prop: value, ... })` to add real CSS property/value pairs (alias for multiple add calls)\n * - `add(\"propName\", value)` for an arbitrary CSS property/value pair\n *\n * Both forms reuse a canonical abbreviation when the pair matches one, i.e. `add(\"display\", \"grid\")` → `dg`.\n */\nfunction resolveAddCall(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const usage =\n `add() requires 1 or 2 arguments (property name and value, or an object literal), got ${node.args.length}. ` +\n `Supported overloads are add({ prop: value }), add(\"propName\", value), and with(cssProp)`;\n\n if (node.args.length === 1) {\n const styleArg = node.args[0];\n if (t.isSpreadElement(styleArg)) {\n throw new UnsupportedPatternError(`add() does not support spread arguments`);\n }\n if (t.isObjectExpression(styleArg)) {\n return resolveAddObjectLiteral(styleArg, mapping, context);\n }\n throw new UnsupportedPatternError(usage);\n }\n\n if (node.args.length !== 2) {\n throw new UnsupportedPatternError(usage);\n }\n\n const [propArg, valueArg] = node.args;\n if (!t.isStringLiteral(propArg)) {\n throw new UnsupportedPatternError(`add() first argument must be a string literal property name`);\n }\n if (t.isSpreadElement(valueArg)) {\n throw new UnsupportedPatternError(`add() does not support spread arguments`);\n }\n\n return [resolveAddDeclaration(propArg.value, valueArg, mapping, context)];\n}\n\n/**\n * Expand an `add({ prop1: value1, prop2: value2 })` object literal into individual segments,\n * as if the user had called `add(\"prop1\", value1).add(\"prop2\", value2)`.\n */\nfunction resolveAddObjectLiteral(\n obj: t.ObjectExpression,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const segments: ResolvedSegment[] = [];\n for (const property of obj.properties) {\n if (t.isSpreadElement(property)) {\n throw new UnsupportedPatternError(`add({...}) does not support spread properties -- use with() instead`);\n }\n if (!t.isObjectProperty(property) || property.computed) {\n throw new UnsupportedPatternError(`add({...}) only supports simple property keys`);\n }\n const propName = staticPropertyName(property.key);\n if (propName === null) {\n throw new UnsupportedPatternError(`add({...}) property keys must be identifiers or string literals`);\n }\n segments.push(resolveAddDeclaration(propName, property.value as t.Expression, mapping, context));\n }\n return segments;\n}\n\n/**\n * Resolve one `add()` property/value pair to a segment.\n *\n * When the pair matches an existing single-property abbreviation in the mapping, that abbreviation\n * is reused so the class is shared with direct uses. Otherwise the property name itself is the\n * abbreviation, folded to a static class for literal values or a `_var` tuple for runtime values.\n *\n * I.e. `(\"display\", \"grid\")` → the `dg` segment; `(\"boxShadow\", \"0 0 0 1px blue\")` → `boxShadow_0_0_0_1px_blue`;\n * `(\"boxShadow\", shadow)` → `boxShadow_var` with `--boxShadow: shadow`.\n */\nfunction resolveAddDeclaration(\n propName: string,\n valueNode: t.Expression,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment {\n const literalValue = tryEvaluatePropertyLiteral(valueNode, mapping, false);\n\n const canonicalAbbr =\n literalValue !== null && !isCustomPropertyLiteral(valueNode, mapping)\n ? findCanonicalAbbreviation(mapping, propName, literalValue)\n : undefined;\n if (canonicalAbbr) {\n const entry = mapping.abbreviations[canonicalAbbr] as Extract<TrussMappingEntry, { kind: \"static\" }>;\n return staticSegment(canonicalAbbr, entry.defs, context);\n }\n\n return resolveLiteralOrVariableSegment({\n abbr: propName,\n props: [propName],\n incremented: false,\n argAst: valueNode,\n literalValue,\n mapping,\n context,\n });\n}\n","import type * as t from \"@babel/types\";\nimport type { WhenRelationship } from \"./when-relationships\";\n\n/** The shape of the Css.json mapping file consumed by the Vite plugin. */\nexport interface TrussMapping {\n increment: number;\n breakpoints?: Record<string, string>;\n typography?: string[];\n /** Token member name → CSS variable (from `config.tokens`), for `setVar` key resolution. */\n tokens?: Record<string, string>;\n abbreviations: Record<string, TrussMappingEntry>;\n}\n\n/** A `when()` relationship selector context that can stack with other condition axes. */\nexport interface WhenCondition {\n pseudo: string;\n /** The user's marker variable, i.e. `row` in `when(row, \"ancestor\", \":hover\")`. Absent for the default marker. */\n markerNode?: t.Identifier;\n relationship: WhenRelationship;\n}\n\n/** The active modifier axes while resolving a Css chain. */\nexport interface ResolvedConditionContext {\n mediaQuery: string | null;\n pseudoClass: string | null;\n pseudoElement: string | null;\n whenPseudo: WhenCondition | null;\n}\n\n/**\n * A single abbreviation entry from `Css.json`.\n *\n * Each `kind` describes how the transformer should resolve that abbreviation.\n */\nexport type TrussMappingEntry =\n /** I.e. `{ \"kind\": \"static\", \"defs\": { \"display\": \"flex\" } }` for `Css.df.$`. */\n | { kind: \"static\"; defs: Record<string, unknown> }\n /** I.e. `{ \"kind\": \"variable\", \"props\": [\"marginTop\"], \"incremented\": true }` for `Css.mt(v).$`. */\n | { kind: \"variable\"; props: string[]; incremented: boolean; extraDefs?: Record<string, unknown> }\n /** I.e. `{ \"kind\": \"delegate\", \"target\": \"mt\" }` for `Css.mtPx(v).$`. */\n | { kind: \"delegate\"; target: string }\n /** I.e. `{ \"kind\": \"alias\", \"chain\": [\"f14\", \"black\"] }` for `Css.bodyText.$`. */\n | { kind: \"alias\"; chain: string[] };\n\n/** Fields shared by the segments that resolve to atomic CSS declarations. */\ninterface CssSegmentBase {\n /** The abbreviation name, i.e. \"df\", \"black\", \"mt\", \"ba\"; the base of the generated class name. */\n abbr: string;\n /** The modifier axes this segment resolved under, snapshotted at resolution time. */\n condition: ResolvedConditionContext;\n}\n\n/**\n * Concrete CSS property/value pairs.\n *\n * I.e. `Css.df.$` → `defs: { display: \"flex\" }`. A folded `Css.mt(2).$` also carries\n * `argResolved: \"calc(var(--t-spacing) * 2)\"` so its class name can include the value.\n */\nexport interface StaticSegment extends CssSegmentBase {\n kind: \"static\";\n defs: Record<string, unknown>;\n argResolved?: string;\n}\n\n/**\n * A `_var` class whose value comes from a CSS custom property.\n *\n * I.e. `Css.mt(x).$` sets `argNode` (the runtime value), while `Css.mt(Tokens.gap).$` sets\n * `argResolved: \"var(--gap)\"` so every token shares the one `mt_var` class.\n */\nexport interface VariableSegment extends CssSegmentBase {\n kind: \"variable\";\n /** The CSS props the variable sets, i.e. `[\"height\", \"width\"]` for `sq(x)`. */\n props: string[];\n /** Whether the runtime value goes through `__maybeInc`. */\n incremented: boolean;\n /** For Px delegates: whether the runtime value must append `px`. */\n appendPx: boolean;\n /** Additional static defs applied alongside the variable value. */\n extraDefs?: Record<string, unknown>;\n argNode?: t.Expression;\n argResolved?: string;\n}\n\n/** A raw class name appended at runtime, i.e. `Css.className(cls).$`. */\nexport interface ClassNameSegment {\n kind: \"className\";\n arg: t.Expression;\n}\n\n/** A raw inline style object merged at runtime, i.e. `Css.style(vars).$`. */\nexport interface InlineStyleSegment {\n kind: \"inlineStyle\";\n arg: t.Expression;\n}\n\n/** An existing Css expression composed into the chain via `with(cssProp)`. */\nexport interface ComposedSegment {\n kind: \"composed\";\n arg: t.Expression;\n /** True for `with({ height })` object literals, whose undefined values are skipped at runtime. */\n skipUndefined: boolean;\n}\n\n/** A runtime `typography(key)` lookup: every typography abbreviation pre-resolved under the current condition. */\nexport interface TypographyLookupSegment {\n kind: \"typography\";\n /** I.e. `\"typography\"` or `\"typography__sm\"` for `Css.typography(key).$` in a given condition context. */\n lookupKey: string;\n argNode: t.Expression;\n segmentsByName: Record<string, ResolvedSegment[]>;\n}\n\n/**\n * An unsupported pattern that could not be resolved.\n *\n * Valid segments in the same chain are preserved; only this segment is skipped in the output.\n */\nexport interface ErrorSegment {\n kind: \"error\";\n message: string;\n}\n\n/** The segments that resolve to atomic CSS declarations. */\nexport type CssSegment = StaticSegment | VariableSegment;\n\n/** A resolved chain segment — one abbreviation resolved to its effect on the element. */\nexport type ResolvedSegment =\n | CssSegment\n | ClassNameSegment\n | InlineStyleSegment\n | ComposedSegment\n | TypographyLookupSegment\n | ErrorSegment;\n\n/**\n * A marker segment — not a CSS style, but a directive to attach\n * a default or user-defined marker class to the element.\n */\nexport interface MarkerSegment {\n type: \"marker\";\n /** If set, the AST node of the user-provided marker variable. Otherwise, default marker. */\n markerNode?: t.Expression;\n}\n\n/** True for segments that resolve to atomic CSS declarations. */\nexport function isCssSegment(seg: ResolvedSegment): seg is CssSegment {\n return seg.kind === \"static\" || seg.kind === \"variable\";\n}\n\n/** True when any modifier axis is active: media query, pseudo-class, pseudo-element, or `when()`. */\nexport function hasCondition(condition: ResolvedConditionContext): boolean {\n return !!(condition.mediaQuery || condition.pseudoClass || condition.pseudoElement || condition.whenPseudo);\n}\n","import * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport { memberPropertyName, staticPropertyName, unwrapExpression } from \"./ast-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { isCustomPropertyName, maybeCssVar } from \"../css-custom-property\";\nimport { incrementCssValue } from \"../spacing-css-var\";\n\n// ── Literal evaluation ────────────────────────────────────────────────\n\n/**\n * Try to evaluate a literal AST node to a CSS property value.\n * For incremented entries, also evaluates `maybeInc(literal)` (web: calc on `--t-spacing`).\n * Custom property names (`--token` / `Tokens.X`) are wrapped as `var(--token)`.\n */\nexport function tryEvaluatePropertyLiteral(\n node: t.Expression,\n mapping: TrussMapping,\n incremented: boolean,\n): string | null {\n const numeric = tryNumericLiteral(node);\n if (numeric !== null) {\n return incremented ? incrementCssValue(numeric) : String(numeric);\n }\n const raw = tryResolveValueLiteral(node, mapping);\n return raw === null ? null : maybeCssVar(raw);\n}\n\n/** True when the argument names a CSS custom property, i.e. `\"--token\"` or `Tokens.x`. */\nexport function isCustomPropertyLiteral(node: t.Expression, mapping: TrussMapping): boolean {\n const raw = tryResolveValueLiteral(node, mapping);\n return raw !== null && isCustomPropertyName(raw);\n}\n\n/** Resolve a literal value without wrapping (for setVar values, etc.). */\nexport function tryResolveValueLiteral(node: t.Expression, mapping?: TrussMapping): string | null {\n if (mapping) {\n const token = tryResolveTokensMember(node, mapping);\n if (token !== null) return token;\n }\n if (t.isStringLiteral(node)) {\n return node.value;\n }\n const numeric = tryNumericLiteral(node);\n return numeric === null ? null : String(numeric);\n}\n\n/** I.e. `12` → 12 and `-12` → -12; null for anything but a (negated) numeric literal. */\nexport function tryNumericLiteral(node: t.Expression): number | null {\n if (t.isNumericLiteral(node)) {\n return node.value;\n }\n if (t.isUnaryExpression(node, { operator: \"-\" }) && t.isNumericLiteral(node.argument)) {\n return -node.argument.value;\n }\n return null;\n}\n\n/** Resolve `Tokens.Member` / `Tokens[\"Member\"]` to a `--` custom property name. */\nfunction tryResolveTokensMember(node: t.Expression, mapping: TrussMapping): string | null {\n if (!t.isMemberExpression(node) || !t.isIdentifier(node.object, { name: \"Tokens\" })) return null;\n const memberName = memberPropertyName(node);\n if (memberName === null) return null;\n\n const tokenMap = mapping.tokens;\n if (!tokenMap) {\n throw new UnsupportedPatternError(`Tokens.* requires config.tokens`);\n }\n if (!(memberName in tokenMap)) {\n throw new UnsupportedPatternError(`Unknown token \"${memberName}\" - add it to config.tokens`);\n }\n return tokenMap[memberName];\n}\n\n// ── Argument and object-literal validation ────────────────────────────\n\n/** The single argument of `label()`, rejecting missing, extra, and spread arguments. */\nexport function singleArg(node: CallChainNode, label: string): t.Expression {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`${label}() expects exactly 1 argument, got ${node.args.length}`);\n }\n const arg = node.args[0];\n if (t.isSpreadElement(arg)) {\n throw new UnsupportedPatternError(`${label}() does not support spread arguments`);\n }\n return arg;\n}\n\n/** The `key: value` pairs of an object literal, rejecting spreads, methods, computed keys, and non-static keys. */\nexport function plainObjectEntries(\n obj: t.ObjectExpression,\n label: string,\n): Array<{ key: string; value: t.Expression }> {\n return obj.properties.map((prop) => {\n if (t.isSpreadElement(prop)) {\n throw new UnsupportedPatternError(`${label} does not support spread properties`);\n }\n if (!t.isObjectProperty(prop) || prop.computed) {\n throw new UnsupportedPatternError(`${label} only supports plain object properties`);\n }\n const key = staticPropertyName(prop.key);\n if (key === null) {\n throw new UnsupportedPatternError(`${label} only supports identifier/string keys`);\n }\n return { key, value: prop.value as t.Expression };\n });\n}\n\n/** A (negated) numeric literal's value, or throws `errorMessage`. */\nexport function numericLiteralValue(node: t.Expression, errorMessage: string): number {\n const numeric = tryNumericLiteral(node);\n if (numeric === null) {\n throw new UnsupportedPatternError(errorMessage);\n }\n return numeric;\n}\n\n/** A string literal's or expression-free template literal's value, or throws `errorMessage`. */\nexport function stringLiteralValue(node: t.Expression, errorMessage: string): string {\n if (t.isStringLiteral(node)) {\n return node.value;\n }\n if (t.isTemplateLiteral(node) && node.expressions.length === 0 && node.quasis.length === 1) {\n return node.quasis[0].value.cooked ?? \"\";\n }\n throw new UnsupportedPatternError(errorMessage);\n}\n\n/** A string/number literal value, unwrapping TS/paren wrappers first. */\nexport function requireValueLiteral(node: t.Expression, errorMessage: string): string {\n const value = tryResolveValueLiteral(unwrapExpression(node));\n if (value === null) {\n throw new UnsupportedPatternError(errorMessage);\n }\n return value;\n}\n","/**\n * Utilities for CSS custom properties (`--token`) in Truss style values.\n */\n\n/**\n * If `value` is a custom property name (`--token`), wrap as `var(--token)` for use as a property value.\n * Passes through values that are not custom-property names (including existing `var(...)`).\n */\nexport function maybeCssVar<T>(value: T): T {\n if (typeof value !== \"string\") return value;\n if (value.startsWith(\"--\")) return `var(${value})` as T;\n return value;\n}\n\n/** True when a runtime variable tuple value may be a `--token` name (not a Px `` `${n}px` `` path). */\nexport function variableValueNeedsMaybeCssVar(opts: { appendPx?: boolean }): boolean {\n return !opts.appendPx;\n}\n\n/** True when a resolved argument value is a CSS custom property name (`--token`). */\nexport function isCustomPropertyName(value: string): boolean {\n return value.startsWith(\"--\");\n}\n","/**\n * Web increment utilities use `--t-spacing` with `calc` (see generated `Css.ts` and the Vite plugin).\n * Keep literals in one place so codegen, emitted CSS, and the transform stay aligned.\n * `--t-spacing` must be set (e.g. `:root` prelude from `collectCss()` / mapping `increment`).\n */\n\n/** Custom property for increment-based spacing (web). */\nexport const SPACING_CUSTOM_PROPERTY = \"--t-spacing\";\n\n/** I.e. `calc(var(--t-spacing) * 3)` — requires prelude defining `--t-spacing`. */\nexport function incrementCssValue(multiplier: number): string {\n return `calc(var(${SPACING_CUSTOM_PROPERTY}) * ${multiplier})`;\n}\n\n/**\n * If `cssValue` is exactly `calc(var(--t-spacing) * k)` for this package's spacing property,\n * returns the multiplier substring `k` (e.g. `\"2\"`, `\"-1\"`, `\"2.5\"`). Otherwise null.\n */\nexport function tryParseIncrementCalcMultiplier(cssValue: string): string | null {\n const prop = SPACING_CUSTOM_PROPERTY.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const re = new RegExp(`^calc\\\\(var\\\\(${prop}\\\\) \\\\* (-?\\\\d+(?:\\\\.\\\\d+)?)\\\\)$`);\n const m = cssValue.match(re);\n return m ? m[1] : null;\n}\n\n/** Prepended to emitted Truss CSS; `incrementPx` comes from `truss-config` / `Css.json`. */\nexport function rootSpacingPreludeCss(incrementPx: number): string {\n return `:root { ${SPACING_CUSTOM_PROPERTY}: ${incrementPx}px; }`;\n}\n","import * as t from \"@babel/types\";\nimport { pascalCase } from \"change-case\";\nimport type { ResolvedConditionContext, ResolvedSegment, TrussMapping } from \"./types\";\nimport { breakpointMediaQuery } from \"./mapping-utils\";\nimport { memberPropertyName, unwrapExpression } from \"./ast-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext } from \"./condition-context\";\nimport { staticSegment } from \"./resolve-entry\";\nimport { plainObjectEntries, requireValueLiteral, singleArg, tryResolveValueLiteral } from \"./resolve-literals\";\nimport { type ContainerBounds, containerQueryString, readContainerBound } from \"./container-query\";\nimport { sanitizeClassNameToken } from \"./style-entries\";\n\n/** CSS custom properties as atomic classes, i.e. `Css.setVar({ [Tokens.x]: \"1px\" }).$`. */\nexport function resolveSetVarCall(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const arg = singleArg(node, \"setVar\");\n if (!t.isObjectExpression(arg)) {\n throw new UnsupportedPatternError(`setVar() requires an object literal argument`);\n }\n\n const segments: ResolvedSegment[] = [];\n for (const prop of arg.properties) {\n if (t.isSpreadElement(prop)) {\n throw new UnsupportedPatternError(`setVar() does not support spread properties`);\n }\n if (!t.isObjectProperty(prop)) {\n throw new UnsupportedPatternError(`setVar() only supports object properties`);\n }\n const cssVarName = resolveSetVarPropertyKey(prop, mapping);\n // I.e. `--theme-accent` → `__theme_accent`, which the emitter extends with the value, i.e. `__theme_accent_blue`.\n const abbr = `__${sanitizeClassNameToken(cssVarName.replace(/^--/, \"\"))}`;\n for (const leaf of expandSetVarValueToLeaves(prop.value as t.Expression, mapping, context)) {\n segments.push(staticSegment(abbr, { [cssVarName]: leaf.literal }, leaf.context, leaf.literal));\n }\n }\n\n return segments;\n}\n\n/** The `--var-name` a setVar key refers to: a `\"--literal\"` string key or a `[Tokens.Name]` member. */\nfunction resolveSetVarPropertyKey(prop: t.ObjectProperty, mapping: TrussMapping): string {\n const key = prop.key;\n if (!prop.computed) {\n if (t.isStringLiteral(key)) {\n if (key.value.startsWith(\"--\")) {\n return key.value;\n }\n throw new UnsupportedPatternError(\n `setVar() string keys must be CSS variables starting with \"--\" - got ${JSON.stringify(key.value)}`,\n );\n }\n if (t.isIdentifier(key)) {\n throw new UnsupportedPatternError(\n `setVar() requires computed keys like [Tokens.Name] or string keys \"--my-var\", not bare property names`,\n );\n }\n throw new UnsupportedPatternError(`setVar() property keys must be string literals or [Tokens.*] members`);\n }\n\n if (!t.isMemberExpression(key)) {\n throw new UnsupportedPatternError(`setVar() computed keys must be Tokens.*-style members`);\n }\n const memberName = memberPropertyName(key);\n if (memberName === null) {\n throw new UnsupportedPatternError(\n `setVar() [Tokens.name] keys must use a plain .member or [\"string\"] member access`,\n );\n }\n const tokenMap = mapping.tokens;\n if (!tokenMap || !(memberName in tokenMap)) {\n throw new UnsupportedPatternError(\n tokenMap\n ? `Unknown token \"${memberName}\" - add it to config.tokens or use a \"--\" string literal key`\n : `setVar() [Tokens.*] requires config.tokens; use \"--\" string literal keys only`,\n );\n }\n return tokenMap[memberName];\n}\n\n/** One concrete value for a setVar custom property, together with the condition it applies under. */\ninterface SetVarLeaf {\n literal: string;\n context: ResolvedConditionContext;\n}\n\n/**\n * Expands one `setVar` property value into one or more static \"leaves\" for emission.\n *\n * Input: the AST for a single value — either a string/number literal, or an object\n * `{ default?, media?, container? }` when the variable is responsive.\n *\n * Output: each leaf is a concrete literal plus a condition context (viewport `mediaQuery`,\n * `@container` string in `mediaQuery`, or base). `resolveSetVarCall` turns each leaf into\n * a static segment with `defs: { [cssVarName]: literal }`. Leaves are emitted in the order\n * default, media, container regardless of the source property order.\n *\n * I.e. `\"8px\"` → one leaf with the inherited context (often unconditional).\n *\n * I.e. `{ default: \"blue\", media: { sm: \"green\" } }` → `\"blue\"` in base context, and `\"green\"`\n * with `mediaQuery` set from `mapping.breakpoints` for `ifSm` (same `@media` as `Css.ifSm`).\n *\n * I.e. `{ container: [{ gt: 400, value: \"10px\" }] }` → one leaf with `mediaQuery` like\n * `@container (min-width: 401px)` (same shape as `ifContainer({ gt: 400 })`).\n */\nfunction expandSetVarValueToLeaves(\n valueNode: t.Expression,\n mapping: TrussMapping,\n baseContext: ResolvedConditionContext,\n): SetVarLeaf[] {\n const unwrapped = unwrapExpression(valueNode);\n const scalar = tryResolveValueLiteral(unwrapped);\n if (scalar !== null) {\n return [setVarLeaf(scalar, baseContext)];\n }\n\n if (!t.isObjectExpression(unwrapped)) {\n throw new UnsupportedPatternError(\n `setVar() values must be string/number literals or a { default?, media?, container? } object`,\n );\n }\n\n let defaultLiteral: string | undefined;\n let mediaObject: t.ObjectExpression | undefined;\n let containerArray: t.ArrayExpression | undefined;\n\n for (const { key, value } of plainObjectEntries(unwrapped, \"setVar() responsive object\")) {\n if (key === \"default\") {\n defaultLiteral = requireValueLiteral(value, `setVar().default must be a string or number literal`);\n } else if (key === \"media\") {\n if (!t.isObjectExpression(value)) {\n throw new UnsupportedPatternError(`setVar().media must be an object literal`);\n }\n mediaObject = value;\n } else if (key === \"container\") {\n if (!t.isArrayExpression(value)) {\n throw new UnsupportedPatternError(`setVar().container must be an array literal`);\n }\n containerArray = value;\n } else {\n throw new UnsupportedPatternError(`setVar() responsive object does not support property \"${key}\"`);\n }\n }\n\n const leaves: SetVarLeaf[] = [];\n if (defaultLiteral !== undefined) {\n leaves.push(setVarLeaf(defaultLiteral, baseContext));\n }\n if (mediaObject) {\n leaves.push(...setVarMediaLeaves(mediaObject, mapping, baseContext));\n }\n if (containerArray) {\n leaves.push(...setVarContainerLeaves(containerArray, baseContext));\n }\n\n if (leaves.length === 0) {\n throw new UnsupportedPatternError(\n `setVar() responsive object must include at least one of default, media entries, or container entries`,\n );\n }\n\n return leaves;\n}\n\n/** I.e. `{ sm: \"green\" }` → one leaf per breakpoint, each under that breakpoint's media query. */\nfunction setVarMediaLeaves(\n mediaObject: t.ObjectExpression,\n mapping: TrussMapping,\n baseContext: ResolvedConditionContext,\n): SetVarLeaf[] {\n return plainObjectEntries(mediaObject, \"setVar().media\").map(({ key: breakpointName, value }) => {\n const mediaQuery = breakpointMediaQuery(mapping, `if${pascalCase(breakpointName)}`);\n if (mediaQuery === null) {\n throw new UnsupportedPatternError(\n `Unknown breakpoint \"${breakpointName}\" in setVar().media - use a Breakpoint name from truss-config`,\n );\n }\n const literal = requireValueLiteral(value, `setVar().media[${breakpointName}] must be a string or number literal`);\n return setVarLeaf(literal, baseContext, mediaQuery);\n });\n}\n\n/** I.e. `[{ gt: 400, value: \"10px\" }]` → one leaf per row, each under its `@container` query. */\nfunction setVarContainerLeaves(containerArray: t.ArrayExpression, baseContext: ResolvedConditionContext): SetVarLeaf[] {\n const leaves: SetVarLeaf[] = [];\n for (const element of containerArray.elements) {\n if (element === null) {\n continue;\n }\n if (!t.isObjectExpression(element)) {\n throw new UnsupportedPatternError(`setVar().container entries must be object literals`);\n }\n let rowValue: string | undefined;\n const bounds: ContainerBounds = {};\n for (const { key, value } of plainObjectEntries(element, \"setVar().container row\")) {\n if (key === \"value\") {\n rowValue = requireValueLiteral(value, `setVar().container row \"value\" must be a string or number literal`);\n } else if (!readContainerBound(bounds, key, value, \"setVar().container \")) {\n throw new UnsupportedPatternError(`setVar().container row does not support property \"${key}\"`);\n }\n }\n if (rowValue === undefined) {\n throw new UnsupportedPatternError(`setVar().container row requires a \"value\" property`);\n }\n if (bounds.lt === undefined && bounds.gt === undefined) {\n throw new UnsupportedPatternError(`setVar().container row requires at least one of gt or lt`);\n }\n leaves.push(setVarLeaf(rowValue, baseContext, containerQueryString(bounds)));\n }\n return leaves;\n}\n\n/** A leaf in the base context, or under `mediaQuery` when given. */\nfunction setVarLeaf(literal: string, baseContext: ResolvedConditionContext, mediaQuery?: string): SetVarLeaf {\n const context = cloneConditionContext(baseContext);\n if (mediaQuery !== undefined) {\n context.mediaQuery = mediaQuery;\n }\n return { literal, context };\n}\n","import * as t from \"@babel/types\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { numericLiteralValue, plainObjectEntries, singleArg, stringLiteralValue } from \"./resolve-literals\";\n\n/** The `{ gt, lt, name }` bounds shared by `ifContainer()` and `setVar().container` rows. */\nexport interface ContainerBounds {\n lt?: number;\n gt?: number;\n name?: string;\n}\n\n/** Resolve ifContainer({ gt, lt, name? }) to an `@container` query string. */\nexport function containerQueryFromCall(node: CallChainNode): string {\n const arg = singleArg(node, \"ifContainer\");\n if (!t.isObjectExpression(arg)) {\n throw new UnsupportedPatternError(\"ifContainer() expects an object literal argument\");\n }\n\n const bounds: ContainerBounds = {};\n for (const { key, value } of plainObjectEntries(arg, \"ifContainer()\")) {\n if (!readContainerBound(bounds, key, value, \"ifContainer().\")) {\n throw new UnsupportedPatternError(`ifContainer() does not support property \"${key}\"`);\n }\n }\n\n if (bounds.lt === undefined && bounds.gt === undefined) {\n throw new UnsupportedPatternError('ifContainer() requires at least one of \"lt\" or \"gt\"');\n }\n\n return containerQueryString(bounds);\n}\n\n/** Read one `lt`/`gt`/`name` bound into `bounds`; false when `key` is not a bound. */\nexport function readContainerBound(bounds: ContainerBounds, key: string, value: t.Expression, label: string): boolean {\n if (key === \"lt\") {\n bounds.lt = numericLiteralValue(value, `${label}lt must be a numeric literal`);\n return true;\n }\n if (key === \"gt\") {\n bounds.gt = numericLiteralValue(value, `${label}gt must be a numeric literal`);\n return true;\n }\n if (key === \"name\") {\n bounds.name = stringLiteralValue(value, `${label}name must be a string literal`);\n return true;\n }\n return false;\n}\n\n/** I.e. `{ gt: 400, lt: 800, name: \"card\" }` → `@container card (min-width: 401px) and (max-width: 800px)`. */\nexport function containerQueryString(bounds: ContainerBounds): string {\n const parts: string[] = [];\n if (bounds.gt !== undefined) {\n parts.push(`(min-width: ${bounds.gt + 1}px)`);\n }\n if (bounds.lt !== undefined) {\n parts.push(`(max-width: ${bounds.lt}px)`);\n }\n const namePrefix = bounds.name ? `${bounds.name} ` : \"\";\n return `@container ${namePrefix}${parts.join(\" and \")}`;\n}\n","import * as t from \"@babel/types\";\nimport type { CssSegment, ResolvedConditionContext, TrussMapping, VariableSegment, WhenCondition } from \"./types\";\nimport { breakpointNameForMediaQuery, findCanonicalAbbreviation } from \"./mapping-utils\";\nimport { cssPropertyAbbreviations } from \"./css-property-abbreviations\";\nimport { WHEN_RELATIONSHIPS } from \"./when-relationships\";\nimport { pseudoSelectorPrefix } from \"../pseudo-selectors\";\nimport { tryParseIncrementCalcMultiplier } from \"../spacing-css-var\";\n\n/**\n * One class/property pair derived from a segment; the shared model both CSS rules (emit-css)\n * and style hashes (emit-style-hash) consume.\n */\nexport interface StyleEntry {\n cssProp: string;\n className: string;\n isVariable: boolean;\n /** Whether this entry has a condition prefix (pseudo/media/when). */\n isConditional: boolean;\n /** Concrete CSS declaration value for emitted CSS rules. */\n cssValue: string;\n varName?: string;\n argNode?: t.Expression;\n /** Compile-time resolved tuple value for `_var` segments (e.g. `\"var(--theme-accent)\"`). */\n argResolved?: string;\n incremented?: boolean;\n appendPx?: boolean;\n}\n\n// ── Marker class helpers ──────────────────────────────────────────────\n\n/** I.e. the shared default marker class is `_mrk`. */\nexport const DEFAULT_MARKER_CLASS = \"_mrk\";\n\n/** I.e. `markerClassName(row)` → `\"_row_mrk\"`, `markerClassName()` → `\"_mrk\"`. */\nexport function markerClassName(markerNode?: t.Expression): string {\n if (!markerNode) return DEFAULT_MARKER_CLASS;\n if (t.isIdentifier(markerNode)) return `_${markerNode.name}_mrk`;\n return \"_marker_mrk\";\n}\n\n// ── Style entries ─────────────────────────────────────────────────────\n\n/**\n * Build normalized class/property entries from a segment for CSS and AST emitters.\n *\n * I.e. convert one resolved segment into the shared model both CSS rules and style hashes consume.\n */\nexport function styleEntriesForSegment(seg: CssSegment, mapping: TrussMapping): StyleEntry[] {\n const prefix = segmentClassPrefix(seg.condition, mapping);\n const isConditional = prefix !== \"\";\n\n if (seg.kind === \"variable\") {\n return variableStyleEntries(seg, mapping, prefix, isConditional);\n }\n\n return staticStyleEntries(seg, mapping, prefix, isConditional, seg.defs);\n}\n\n/**\n * Build entries for concrete CSS defs.\n *\n * I.e. `Css.ba.$` becomes separate `borderStyle -> bss` and `borderWidth -> bw1` entries.\n */\nfunction staticStyleEntries(\n seg: CssSegment,\n mapping: TrussMapping,\n prefix: string,\n isConditional: boolean,\n defs: Record<string, unknown>,\n forceLonghandNames = false,\n): StyleEntry[] {\n const isMultiProp = forceLonghandNames || Object.keys(defs).length > 1;\n\n return Object.entries(defs).map(([cssProp, value]) => {\n const cssValue = String(value);\n const baseName = computeStaticBaseName(seg, cssProp, cssValue, isMultiProp, mapping);\n return { cssProp, className: `${prefix}${baseName}`, isVariable: false, isConditional, cssValue };\n });\n}\n\n/**\n * Build entries for runtime variable CSS defs.\n *\n * I.e. `Css.mt(x).$` becomes `marginTop -> mt_var` plus `--marginTop` metadata,\n * and `Css.ifSm.mt(x).$` becomes `sm_mt_var` with `--sm_marginTop`.\n */\nfunction variableStyleEntries(\n seg: VariableSegment,\n mapping: TrussMapping,\n prefix: string,\n isConditional: boolean,\n): StyleEntry[] {\n const className = `${prefix}${seg.abbr}_var`;\n const entries: StyleEntry[] = seg.props.map((cssProp) => {\n const varName = `--${prefix}${cssProp}`;\n return {\n cssProp,\n className,\n isVariable: true,\n isConditional,\n cssValue: `var(${varName})`,\n varName,\n argNode: seg.argNode,\n argResolved: seg.argResolved,\n incremented: seg.incremented,\n appendPx: seg.appendPx,\n };\n });\n\n if (seg.extraDefs) {\n entries.push(...staticStyleEntries(seg, mapping, prefix, isConditional, seg.extraDefs, true));\n }\n\n return entries;\n}\n\n/**\n * Compute the base class name for a static segment.\n *\n * For multi-property abbreviations, looks up the canonical single-property\n * abbreviation name so classes are maximally reused.\n * I.e. `p1` → `pt1`, `pr1`, `pb1`, `pl1` (not `p1_paddingTop`, etc.)\n * I.e. `ba` → `bss`, `bw1` (not `ba_borderStyle`, etc.)\n * I.e. `lineClamp(\"3\")` display:-webkit-box → `d_negwebkit_box`, not `d_3`\n *\n * For literal-folded variables (argResolved set), includes the value:\n * I.e. `mt(2)` → `mt_2` (web increment calc), `mt(-1)` → `mt_neg1`, `bc(\"red\")` → `bc_red`.\n */\nfunction computeStaticBaseName(\n seg: CssSegment,\n cssProp: string,\n cssValue: string,\n isMultiProp: boolean,\n mapping: TrussMapping,\n): string {\n if (isMultiProp) {\n const canonical = findCanonicalAbbreviation(mapping, cssProp, cssValue);\n return canonical ?? `${getPropertyAbbreviation(cssProp)}_${classNameFragmentForResolvedValue(cssValue)}`;\n }\n if (seg.argResolved !== undefined) {\n return `${seg.abbr}_${classNameFragmentForResolvedValue(seg.argResolved)}`;\n }\n return seg.abbr;\n}\n\n// ── Class-name building blocks ────────────────────────────────────────\n\n/**\n * Build the condition prefix for a segment's class names.\n *\n * I.e. `ifSm.onHover.bgBlack` → `\"sm_h_\"` so the final class reads `sm_h_bgBlack`\n * (\"on sm + hover, bgBlack\"), and `when(row, \"ancestor\", \":hover\").blue` → `\"wh_anc_h_row_\"`.\n */\nfunction segmentClassPrefix(condition: ResolvedConditionContext, mapping: TrussMapping): string {\n const parts: string[] = [];\n if (condition.pseudoElement) {\n // I.e. \"::placeholder\" → \"placeholder_\"\n parts.push(`${condition.pseudoElement.replace(/^::/, \"\")}_`);\n }\n if (condition.mediaQuery) {\n // I.e. the `ifSm` breakpoint → \"sm_\"; any other media/container query is sanitized in full, i.e.\n // \"@media (min-width: 600px)\" → \"media_min_width_600px_\", so two different queries never share a class\n const breakpoint = breakpointNameForMediaQuery(mapping, condition.mediaQuery);\n parts.push(`${breakpoint ? breakpoint.toLowerCase() : sanitizeClassNameToken(condition.mediaQuery)}_`);\n }\n if (condition.pseudoClass) {\n parts.push(`${pseudoSelectorPrefix(condition.pseudoClass)}_`);\n }\n if (condition.whenPseudo) {\n parts.push(whenPrefix(condition.whenPseudo));\n }\n return parts.join(\"\");\n}\n\n/** I.e. `when(marker, \"ancestor\", \":hover\")` → `\"wh_anc_h_\"`, `when(row, …)` → `\"wh_anc_h_row_\"`. */\nfunction whenPrefix(whenPseudo: WhenCondition): string {\n const rel = WHEN_RELATIONSHIPS[whenPseudo.relationship].short;\n const pseudoPrefix = pseudoSelectorPrefix(whenPseudo.pseudo);\n const markerPart = whenPseudo.markerNode ? `${whenPseudo.markerNode.name}_` : \"\";\n return `wh_${rel}_${pseudoPrefix}_${markerPart}`;\n}\n\n/** I.e. `\"backgroundColor\"` → `\"background-color\"`, `\"WebkitTransform\"` → `\"-webkit-transform\"`. */\nexport function camelToKebab(s: string): string {\n return s.replace(/^(Webkit|Moz|Ms|O)/, (m) => `-${m.toLowerCase()}`).replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n}\n\n/** Collapse anything that is not a letter or digit into single underscores, i.e. `\"0 0 0 1px blue\"` → `\"0_0_0_1px_blue\"`. */\nexport function sanitizeClassNameToken(value: string): string {\n return value\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n}\n\n/** I.e. `\"-8px\"` → `\"neg8px\"`, `\"0 0 0 1px blue\"` → `\"0_0_0_1px_blue\"`. */\nfunction cleanValueForClassName(value: string): string {\n return sanitizeClassNameToken(value.startsWith(\"-\") ? `neg${value.slice(1)}` : value);\n}\n\n/** Class-name fragment for a resolved CSS value, i.e. `calc(var(--t-spacing) * 2)` → `\"2\"`, `\"red\"` → `\"red\"`. */\nfunction classNameFragmentForResolvedValue(value: string): string {\n return cleanValueForClassName(tryParseIncrementCalcMultiplier(value) ?? value);\n}\n\n/** I.e. `\"backgroundColor\"` → `\"bg\"` (from the abbreviation table), or the raw name as fallback. */\nfunction getPropertyAbbreviation(cssProp: string): string {\n return cssPropertyAbbreviations[cssProp] ?? cssProp;\n}\n","/**\n * Static mapping of CSS property names (camelCase) to unique short abbreviations.\n *\n * Used by the Truss compiler to generate compact, deterministic class names\n * when no user-defined canonical abbreviation exists for a given property+value.\n *\n * Convention: first letter of each camelCase word, with conflict resolution\n * via extra characters where needed. I.e. `borderBottomWidth` → `bbw`,\n * `flexDirection` → `fxd`, `fontSize` → `fz`.\n *\n * User-defined abbreviations (from the longhand lookup) always take priority\n * over these — this mapping is only the fallback.\n */\nexport const cssPropertyAbbreviations: Record<string, string> = {\n // Alignment\n alignContent: \"ac\",\n alignItems: \"ai\",\n alignSelf: \"als\",\n\n // Animation\n animation: \"anim\",\n animationDelay: \"animd\",\n animationDirection: \"animdr\",\n animationDuration: \"animdu\",\n animationFillMode: \"animfm\",\n animationIterationCount: \"animic\",\n animationName: \"animn\",\n animationPlayState: \"animps\",\n animationTimingFunction: \"animtf\",\n\n // Appearance\n appearance: \"app\",\n\n // Aspect ratio\n aspectRatio: \"ar\",\n\n // Backdrop filter\n backdropFilter: \"bdf\",\n\n // Background\n background: \"bg\",\n backgroundAttachment: \"bga\",\n backgroundBlendMode: \"bgbm\",\n backgroundClip: \"bgcl\",\n backgroundColor: \"bgc\",\n backgroundImage: \"bgi\",\n backgroundOrigin: \"bgo\",\n backgroundPosition: \"bgp\",\n backgroundRepeat: \"bgr\",\n backgroundSize: \"bgs\",\n\n // Border – shorthand\n border: \"bd\",\n borderCollapse: \"bdcl\",\n borderColor: \"bdc\",\n borderImage: \"bdi\",\n borderRadius: \"bra\",\n borderSpacing: \"bdsp\",\n borderStyle: \"bs\",\n borderWidth: \"bw\",\n\n // Border – top\n borderTop: \"bdt\",\n borderTopColor: \"btc\",\n borderTopLeftRadius: \"btlr\",\n borderTopRightRadius: \"btrr\",\n borderTopStyle: \"bts\",\n borderTopWidth: \"btw\",\n\n // Border – right\n borderRight: \"bdr\",\n borderRightColor: \"brc\",\n borderRightStyle: \"brs\",\n borderRightWidth: \"brw\",\n\n // Border – bottom\n borderBottom: \"bdb\",\n borderBottomColor: \"bbc\",\n borderBottomLeftRadius: \"bblr\",\n borderBottomRightRadius: \"bbrr\",\n borderBottomStyle: \"bbs\",\n borderBottomWidth: \"bbw\",\n\n // Border – left\n borderLeft: \"bdl\",\n borderLeftColor: \"blc\",\n borderLeftStyle: \"bls\",\n borderLeftWidth: \"blw\",\n\n // Box\n boxDecorationBreak: \"bxdb\",\n boxShadow: \"bxs\",\n boxSizing: \"bxz\",\n\n // Break\n breakAfter: \"bka\",\n breakBefore: \"bkb\",\n breakInside: \"bki\",\n\n // Caret / caption\n captionSide: \"cps\",\n caretColor: \"cac\",\n\n // Clear / clip\n clear: \"clr\",\n clip: \"cli\",\n clipPath: \"clp\",\n\n // Color\n color: \"c\",\n colorScheme: \"cs\",\n\n // Columns\n columnCount: \"cc\",\n columnFill: \"cf\",\n columnGap: \"cg\",\n columnRule: \"cr\",\n columnRuleColor: \"crc\",\n columnRuleStyle: \"crs\",\n columnRuleWidth: \"crw\",\n columnSpan: \"csp\",\n columnWidth: \"cw\",\n columns: \"cols\",\n\n // Contain / container\n contain: \"ctn\",\n containerName: \"ctnm\",\n containerType: \"ctnt\",\n content: \"cnt\",\n contentVisibility: \"cv\",\n\n // Counter\n counterIncrement: \"coi\",\n counterReset: \"cor\",\n\n // Cursor\n cursor: \"cur\",\n\n // Direction\n direction: \"dir\",\n\n // Display\n display: \"d\",\n\n // Empty cells\n emptyCells: \"ec\",\n\n // Fill (SVG)\n fill: \"fi\",\n fillOpacity: \"fio\",\n fillRule: \"fir\",\n\n // Filter\n filter: \"flt\",\n\n // Flex\n flex: \"fx\",\n flexBasis: \"fxb\",\n flexDirection: \"fxd\",\n flexFlow: \"fxf\",\n flexGrow: \"fxg\",\n flexShrink: \"fxs\",\n flexWrap: \"fxw\",\n\n // Float\n float: \"fl\",\n\n // Font\n font: \"fnt\",\n fontDisplay: \"fntd\",\n fontFamily: \"ff\",\n fontFeatureSettings: \"ffs\",\n fontKerning: \"fk\",\n fontSize: \"fz\",\n fontSizeAdjust: \"fza\",\n fontStretch: \"fst\",\n fontStyle: \"fsy\",\n fontSynthesis: \"fsyn\",\n fontVariant: \"fv\",\n fontVariantCaps: \"fvc\",\n fontVariantLigatures: \"fvl\",\n fontVariantNumeric: \"fvn\",\n fontWeight: \"fw\",\n\n // Gap\n gap: \"g\",\n\n // Grid\n grid: \"gd\",\n gridArea: \"ga\",\n gridAutoColumns: \"gac\",\n gridAutoFlow: \"gaf\",\n gridAutoRows: \"gar\",\n gridColumn: \"gc\",\n gridColumnEnd: \"gce\",\n gridColumnGap: \"gcg\",\n gridColumnStart: \"gcs\",\n gridGap: \"gg\",\n gridRow: \"gr\",\n gridRowEnd: \"gre\",\n gridRowGap: \"grg\",\n gridRowStart: \"grs\",\n gridTemplate: \"gt\",\n gridTemplateAreas: \"gta\",\n gridTemplateColumns: \"gtc\",\n gridTemplateRows: \"gtr\",\n\n // Height\n height: \"h\",\n maxHeight: \"mxh\",\n minHeight: \"mnh\",\n\n // Hyphens\n hyphens: \"hyp\",\n\n // Image rendering\n imageRendering: \"ir\",\n\n // Inset\n inset: \"ins\",\n insetBlock: \"insb\",\n insetBlockEnd: \"insbe\",\n insetBlockStart: \"insbs\",\n insetInline: \"insi\",\n insetInlineEnd: \"insie\",\n insetInlineStart: \"insis\",\n\n // Isolation\n isolation: \"iso\",\n\n // Justify\n justifyContent: \"jc\",\n justifyItems: \"ji\",\n justifySelf: \"jfs\",\n\n // Left\n left: \"l\",\n\n // Letter spacing\n letterSpacing: \"ls\",\n\n // Line\n lineBreak: \"lb\",\n lineHeight: \"lh\",\n\n // List\n listStyle: \"lis\",\n listStyleImage: \"lsi\",\n listStylePosition: \"lsp\",\n listStyleType: \"lst\",\n\n // Margin\n margin: \"m\",\n marginBlock: \"mbl\",\n marginBlockEnd: \"mble\",\n marginBlockStart: \"mbls\",\n marginBottom: \"mb\",\n marginInline: \"mil\",\n marginInlineEnd: \"mile\",\n marginInlineStart: \"mils\",\n marginLeft: \"ml\",\n marginRight: \"mr\",\n marginTop: \"mt\",\n\n // Mask\n mask: \"msk\",\n maskImage: \"mski\",\n maskPosition: \"mskp\",\n maskRepeat: \"mskr\",\n maskSize: \"msks\",\n\n // Max / min width\n maxWidth: \"mxw\",\n minWidth: \"mnw\",\n\n // Mix blend mode\n mixBlendMode: \"mbm\",\n\n // Object\n objectFit: \"obf\",\n objectPosition: \"obp\",\n\n // Offset\n offset: \"ofs\",\n offsetPath: \"ofsp\",\n\n // Opacity\n opacity: \"op\",\n\n // Order\n order: \"ord\",\n\n // Orphans / widows\n orphans: \"orp\",\n widows: \"wid\",\n\n // Outline\n outline: \"ol\",\n outlineColor: \"olc\",\n outlineOffset: \"olo\",\n outlineStyle: \"ols\",\n outlineWidth: \"olw\",\n\n // Overflow\n overflow: \"ov\",\n overflowAnchor: \"ova\",\n overflowWrap: \"ovw\",\n overflowX: \"ovx\",\n overflowY: \"ovy\",\n overscrollBehavior: \"osb\",\n overscrollBehaviorX: \"osbx\",\n overscrollBehaviorY: \"osby\",\n\n // Padding\n padding: \"p\",\n paddingBlock: \"pbl\",\n paddingBlockEnd: \"pble\",\n paddingBlockStart: \"pbls\",\n paddingBottom: \"pb\",\n paddingInline: \"pil\",\n paddingInlineEnd: \"pile\",\n paddingInlineStart: \"pils\",\n paddingLeft: \"pl\",\n paddingRight: \"pr\",\n paddingTop: \"pt\",\n\n // Page break\n pageBreakAfter: \"pgba\",\n pageBreakBefore: \"pgbb\",\n pageBreakInside: \"pgbi\",\n\n // Perspective\n perspective: \"per\",\n perspectiveOrigin: \"pero\",\n\n // Place\n placeContent: \"plc\",\n placeItems: \"pli\",\n placeSelf: \"pls\",\n\n // Pointer events\n pointerEvents: \"pe\",\n\n // Position\n position: \"pos\",\n\n // Quotes\n quotes: \"q\",\n\n // Resize\n resize: \"rsz\",\n\n // Right\n right: \"r\",\n\n // Rotate / scale\n rotate: \"rot\",\n scale: \"sc\",\n\n // Row gap\n rowGap: \"rg\",\n\n // Scroll\n scrollBehavior: \"scb\",\n scrollMargin: \"scm\",\n scrollPadding: \"scp\",\n scrollSnapAlign: \"ssa\",\n scrollSnapStop: \"sss\",\n scrollSnapType: \"sst\",\n scrollbarWidth: \"sbw\",\n\n // Shape\n shapeImageThreshold: \"sit\",\n shapeMargin: \"sm\",\n shapeOutside: \"so\",\n\n // Stroke (SVG)\n stroke: \"stk\",\n strokeDasharray: \"sda\",\n strokeDashoffset: \"sdo\",\n strokeLinecap: \"slc\",\n strokeLinejoin: \"slj\",\n strokeOpacity: \"sop\",\n strokeWidth: \"sw\",\n\n // Tab size\n tabSize: \"ts\",\n\n // Table layout\n tableLayout: \"tl\",\n\n // Text\n textAlign: \"ta\",\n textAlignLast: \"tal\",\n textDecoration: \"td\",\n textDecorationColor: \"tdc\",\n textDecorationLine: \"tdl\",\n textDecorationStyle: \"tds\",\n textDecorationThickness: \"tdt\",\n textEmphasis: \"te\",\n textIndent: \"ti\",\n textJustify: \"tj\",\n textOrientation: \"tor\",\n textOverflow: \"to\",\n textRendering: \"tr\",\n textShadow: \"tsh\",\n textTransform: \"tt\",\n textUnderlineOffset: \"tuo\",\n textUnderlinePosition: \"tup\",\n textWrap: \"twp\",\n\n // Top\n top: \"tp\",\n\n // Touch action\n touchAction: \"tca\",\n\n // Transform\n transform: \"tf\",\n transformOrigin: \"tfo\",\n transformStyle: \"tfs\",\n\n // Transition\n transition: \"tsn\",\n transitionDelay: \"tsnd\",\n transitionDuration: \"tsndu\",\n transitionProperty: \"tsnp\",\n transitionTimingFunction: \"tsntf\",\n\n // Translate\n translate: \"tsl\",\n\n // Unicode / user select\n unicodeBidi: \"ub\",\n userSelect: \"us\",\n\n // Vertical align\n verticalAlign: \"va\",\n\n // Visibility\n visibility: \"vis\",\n\n // Webkit\n WebkitAppearance: \"wkapp\",\n WebkitBackdropFilter: \"wkbdf\",\n WebkitBoxOrient: \"wbo\",\n WebkitFontSmoothing: \"wkfs\",\n WebkitLineClamp: \"wlc\",\n WebkitMaskImage: \"wkmi\",\n WebkitOverflowScrolling: \"wkos\",\n WebkitTapHighlightColor: \"wkthc\",\n WebkitTextFillColor: \"wktfc\",\n WebkitTextStrokeColor: \"wktsc\",\n WebkitTextStrokeWidth: \"wktsw\",\n\n // White space\n whiteSpace: \"ws\",\n\n // Width\n width: \"w\",\n\n // Will change\n willChange: \"wc\",\n\n // Word\n wordBreak: \"wdb\",\n wordSpacing: \"wds\",\n wordWrap: \"wdw\",\n writingMode: \"wm\",\n\n // Z-index\n zIndex: \"zi\",\n\n // Bottom (positioned after \"border*\" to avoid scan confusion)\n bottom: \"bot\",\n};\n\n// Validate uniqueness at module load time\nconst seen = new Map<string, string>();\nfor (const [prop, abbr] of Object.entries(cssPropertyAbbreviations)) {\n const existing = seen.get(abbr);\n if (existing) {\n throw new Error(`CSS property abbreviation conflict: \"${abbr}\" is used by both \"${existing}\" and \"${prop}\"`);\n }\n seen.set(abbr, prop);\n}\n","/**\n * The relationship kinds accepted by `when(marker, relationship, pseudo)`.\n *\n * Each kind owns its class-name fragment, its StyleX-style priority bump, and the\n * selector shape that ties the marker element to the styled target element.\n */\nexport type WhenRelationship = \"ancestor\" | \"descendant\" | \"anySibling\" | \"siblingBefore\" | \"siblingAfter\";\n\nexport interface WhenRelationshipSpec {\n /** Class-name fragment, i.e. `\"anc\"` in `wh_anc_h_blue`. */\n short: string;\n /** Base priority added to rules that use this relationship, matching StyleX's relational selector system. */\n priority: number;\n /**\n * Build the full rule selector.\n *\n * `marker` is the marker selector, i.e. `._row_mrk:hover`; `target` builds the styled element's\n * selector and accepts an extra pseudo-class to splice in before any pseudo-element.\n */\n selector(marker: string, target: (extraPseudoClass?: string) => string): string;\n}\n\n/** Keyed in the order the error message for an unknown relationship lists them. */\nexport const WHEN_RELATIONSHIPS: Readonly<Record<WhenRelationship, WhenRelationshipSpec>> = {\n ancestor: {\n short: \"anc\",\n priority: 10,\n /** I.e. `._mrk:hover .wh_anc_h_blue`. */\n selector(marker, target) {\n return `${marker} ${target()}`;\n },\n },\n descendant: {\n short: \"desc\",\n priority: 15,\n /** I.e. `.wh_desc_h_blue:has(._mrk:hover)`. */\n selector(marker, target) {\n return target(`:has(${marker})`);\n },\n },\n anySibling: {\n short: \"anyS\",\n priority: 20,\n /** I.e. `.wh_anyS_h_blue:has(~ ._mrk:hover), ._mrk:hover ~ .wh_anyS_h_blue`. */\n selector(marker, target) {\n return `${target(`:has(~ ${marker})`)}, ${marker} ~ ${target()}`;\n },\n },\n siblingBefore: {\n short: \"sibB\",\n priority: 30,\n /** I.e. `._mrk:hover ~ .wh_sibB_h_blue`. */\n selector(marker, target) {\n return `${marker} ~ ${target()}`;\n },\n },\n siblingAfter: {\n short: \"sibA\",\n priority: 40,\n /** I.e. `.wh_sibA_h_blue:has(~ ._mrk:hover)`. */\n selector(marker, target) {\n return target(`:has(~ ${marker})`);\n },\n },\n};\n\n/** True when `value` names one of the supported `when()` relationships. */\nexport function isWhenRelationship(value: string): value is WhenRelationship {\n return Object.hasOwn(WHEN_RELATIONSHIPS, value);\n}\n","/** Pseudo-class getter methods supported by CssBuilder chains. */\nexport const TRUSS_PSEUDO_METHODS: Readonly<Record<string, string>> = {\n onHover: \":hover\",\n onFocus: \":focus\",\n onFocusVisible: \":focus-visible\",\n onFocusWithin: \":focus-within\",\n onActive: \":active\",\n onDisabled: \":disabled\",\n ifFirstOfType: \":first-of-type\",\n ifLastOfType: \":last-of-type\",\n};\n\n/** Compact class-name prefixes for pseudo selectors. */\nconst PSEUDO_SELECTOR_PREFIXES: Readonly<Record<string, string>> = {\n \":hover\": \"h\",\n \":focus\": \"f\",\n \":focus-visible\": \"fv\",\n \":focus-within\": \"fw\",\n \":active\": \"a\",\n \":disabled\": \"d\",\n \":first-of-type\": \"fot\",\n \":last-of-type\": \"lot\",\n \":not\": \"n\",\n \":is\": \"is\",\n \":where\": \"where\",\n \":has\": \"has\",\n};\n\nexport function isTrussPseudoMethod(name: string): boolean {\n return name in TRUSS_PSEUDO_METHODS;\n}\n\nexport function trussPseudoSelector(name: string): string {\n return TRUSS_PSEUDO_METHODS[name];\n}\n\n/** I.e. `\":hover:not(:disabled)\"` -> `\"h_n_d\"`. */\nexport function pseudoSelectorPrefix(pseudo: string): string {\n const replaced = pseudo.trim().replace(/::?[a-zA-Z-]+/g, function pseudoMatchToPrefix(match) {\n return `_${pseudoIdentifierPrefix(match)}_`;\n });\n const cleaned = replaced\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n return cleaned || \"pseudo\";\n}\n\n/** I.e. `\":hover\"` -> `\"h\"`, `\":focus-visible\"` -> `\"fv\"`. */\nfunction pseudoIdentifierPrefix(pseudo: string): string {\n const normalized = normalizePseudoIdentifier(pseudo);\n const known = PSEUDO_SELECTOR_PREFIXES[normalized];\n if (known) {\n return known;\n }\n return normalized.replace(/^::?/, \"\").replace(/-/g, \"_\");\n}\n\n/** I.e. `\":focusVisible\"` -> `\":focus-visible\"`. */\nfunction normalizePseudoIdentifier(pseudo: string): string {\n const prefixMatch = pseudo.match(/^::?/);\n const prefix = prefixMatch?.[0] ?? \"\";\n const name = pseudo.slice(prefix.length).replace(/[A-Z]/g, function upperToKebab(match) {\n return `-${match.toLowerCase()}`;\n });\n return `${prefix}${name}`;\n}\n","import * as t from \"@babel/types\";\nimport type { ResolvedConditionContext, ResolvedSegment, TrussMapping, WhenCondition } from \"./types\";\nimport { breakpointNameForMediaQuery } from \"./mapping-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { resolveEntry } from \"./resolve-entry\";\nimport { singleArg } from \"./resolve-literals\";\nimport { sanitizeClassNameToken } from \"./style-entries\";\n\n/** Resolve `typography(key)` into either direct segments or a runtime lookup-backed segment. */\nexport function resolveTypographyCall(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const arg = singleArg(node, \"typography\");\n if (t.isStringLiteral(arg)) {\n return resolveTypographyEntry(arg.value, mapping, context);\n }\n\n const typography = mapping.typography ?? [];\n if (typography.length === 0) {\n throw new UnsupportedPatternError(`typography() is unavailable because no typography abbreviations were generated`);\n }\n\n const suffix = typographyLookupKeySuffix(context, mapping);\n const lookupKey = suffix ? `typography__${suffix}` : \"typography\";\n const segmentsByName: Record<string, ResolvedSegment[]> = {};\n for (const name of typography) {\n segmentsByName[name] = resolveTypographyEntry(name, mapping, context);\n }\n\n return [{ kind: \"typography\", lookupKey, argNode: arg, segmentsByName }];\n}\n\n/** Resolve a single typography abbreviation name within the current condition context. */\nfunction resolveTypographyEntry(\n name: string,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n if (!(mapping.typography ?? []).includes(name)) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const entry = mapping.abbreviations[name];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const resolved = resolveEntry(name, entry, mapping, context);\n for (const segment of resolved) {\n if (segment.kind === \"variable\") {\n throw new UnsupportedPatternError(`Typography abbreviation \"${name}\" cannot require runtime arguments`);\n }\n }\n return resolved;\n}\n\n/**\n * Build a typography lookup key suffix from condition context.\n *\n * I.e. `typography(key)` → `\"\"`, `ifSm.typography(key)` → `\"sm\"`, `onHover.typography(key)` → `\"hover\"`.\n */\nfunction typographyLookupKeySuffix(context: ResolvedConditionContext, mapping: TrussMapping): string {\n const parts: string[] = [];\n if (context.pseudoElement) parts.push(context.pseudoElement.replace(/^::/, \"\"));\n if (context.mediaQuery) {\n const breakpoint = breakpointNameForMediaQuery(mapping, context.mediaQuery);\n parts.push(\n breakpoint ? breakpoint.replace(/^./, (c) => c.toLowerCase()) : sanitizeClassNameToken(context.mediaQuery),\n );\n }\n if (context.pseudoClass) parts.push(context.pseudoClass.replace(/^:+/, \"\").replace(/-/g, \"_\"));\n if (context.whenPseudo) parts.push(whenLookupKeyPart(context.whenPseudo));\n return parts.join(\"_\");\n}\n\n/** I.e. `when(row, \"ancestor\", \":hover\")` → `\"when_ancestor_hover_row\"`. */\nfunction whenLookupKeyPart(whenPseudo: WhenCondition): string {\n const parts = [\"when\", whenPseudo.relationship, sanitizeClassNameToken(whenPseudo.pseudo) || \"value\"];\n if (whenPseudo.markerNode) {\n parts.push(whenPseudo.markerNode.name);\n }\n return parts.join(\"_\");\n}\n","import * as t from \"@babel/types\";\nimport type { WhenCondition } from \"./types\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { isWhenRelationship, WHEN_RELATIONSHIPS } from \"./when-relationships\";\n\n/** A same-element selector (`when(\":hover\")`) or a relationship to a marker (`when(marker, \"ancestor\", \":hover\")`). */\nexport type WhenCallResolution =\n | { kind: \"selector\"; selector: string }\n | { kind: \"relationship\"; condition: WhenCondition };\n\n/**\n * Resolve a `when(selector)` or `when(marker, relationship, pseudo)` call.\n *\n * - 1 arg: `when(\":hover\")` / `when('[data-state=\"open\"]')` — same-element selector,\n * must be a string literal\n * - 3 args: `when(marker, \"ancestor\", \":hover\")` — marker must be a marker variable or\n * the shared `marker` token, relationship/pseudo must be string literals\n *\n * The object form `when({ \":hover\": Css.blue.$ })` is handled by resolve-chain, since it recurses.\n */\nexport function resolveWhenCall(node: CallChainNode): WhenCallResolution {\n if (node.args.length !== 1 && node.args.length !== 3) {\n throw new UnsupportedPatternError(\n `when() expects 1 or 3 arguments (selector) or (marker, relationship, pseudo), got ${node.args.length}`,\n );\n }\n\n if (node.args.length === 1) {\n const selectorArg = node.args[0];\n if (!t.isStringLiteral(selectorArg)) {\n throw new UnsupportedPatternError(`when() selector must be a string literal`);\n }\n return { kind: \"selector\", selector: selectorArg.value };\n }\n\n const [markerArg, relationshipArg, pseudoArg] = node.args;\n const markerNode = resolveWhenMarker(markerArg);\n if (!t.isStringLiteral(relationshipArg)) {\n throw new UnsupportedPatternError(`when() relationship argument must be a string literal`);\n }\n const relationship = relationshipArg.value;\n if (!isWhenRelationship(relationship)) {\n throw new UnsupportedPatternError(\n `when() relationship must be one of: ${Object.keys(WHEN_RELATIONSHIPS).join(\", \")} -- got \"${relationship}\"`,\n );\n }\n if (!t.isStringLiteral(pseudoArg)) {\n throw new UnsupportedPatternError(`when() pseudo selector (3rd argument) must be a string literal`);\n }\n return { kind: \"relationship\", condition: { pseudo: pseudoArg.value, markerNode, relationship } };\n}\n\n/** The user's marker variable, or undefined for the shared default marker. */\nfunction resolveWhenMarker(node: t.Expression | t.SpreadElement): t.Identifier | undefined {\n if (isDefaultMarkerNode(node)) {\n return undefined;\n }\n if (t.isIdentifier(node)) {\n return node;\n }\n throw new UnsupportedPatternError(`when() marker must be a marker variable or marker`);\n}\n\n/** I.e. `marker`, `defaultMarker`, or the legacy `Css.defaultMarker()` call. */\nfunction isDefaultMarkerNode(node: t.Expression | t.SpreadElement): boolean {\n if (t.isIdentifier(node) && (node.name === \"marker\" || node.name === \"defaultMarker\")) {\n return true;\n }\n return (\n t.isCallExpression(node) &&\n node.arguments.length === 0 &&\n t.isMemberExpression(node.callee) &&\n !node.callee.computed &&\n t.isIdentifier(node.callee.property, { name: \"defaultMarker\" })\n );\n}\n","/** Return the complementary query used by `Css.*.else` media branches. */\nexport function invertMediaQuery(query: string): string {\n const screenPrefix = \"@media screen and \";\n if (query.startsWith(screenPrefix)) {\n const conditions = query.slice(screenPrefix.length).trim();\n const rangeMatch = conditions.match(/^\\(min-width: (\\d+)px\\) and \\(max-width: (\\d+)px\\)$/);\n if (rangeMatch) {\n const min = Number(rangeMatch[1]);\n const max = Number(rangeMatch[2]);\n return `@media screen and (max-width: ${min - 1}px), screen and (min-width: ${max + 1}px)`;\n }\n const minMatch = conditions.match(/^\\(min-width: (\\d+)px\\)$/);\n if (minMatch) {\n return `@media screen and (max-width: ${Number(minMatch[1]) - 1}px)`;\n }\n const maxMatch = conditions.match(/^\\(max-width: (\\d+)px\\)$/);\n if (maxMatch) {\n return `@media screen and (min-width: ${Number(maxMatch[1]) + 1}px)`;\n }\n }\n return query.replace(\"@media\", \"@media not\");\n}\n","/**\n * The sort key shared by `emit-css` and `merge-css`, so a stylesheet merged from library CSS\n * keeps the same rule order as the per-file output.\n */\nexport interface RuleSortKey {\n priority: number;\n className: string;\n /** The px widths the rule's media or container query matches, or null when it has no readable interval. */\n widthInterval: WidthInterval | null;\n}\n\n/** The inclusive px widths a query matches; `hi` is Infinity for a min-width-only query. */\nexport interface WidthInterval {\n lo: number;\n hi: number;\n}\n\n/** I.e. `ruleSortKey(3200, \"lg_black\", \"@media screen and (min-width: 960px)\")` → `widthInterval: { lo: 960, hi: Infinity }`. */\nexport function ruleSortKey(priority: number, className: string, atRulePrelude: string | undefined): RuleSortKey {\n const widthInterval = atRulePrelude === undefined ? null : parseWidthInterval(atRulePrelude);\n return { priority, className, widthInterval };\n}\n\n/**\n * Order rules by priority, then by query width interval, then by class name.\n *\n * Priority ties happen between rules in the same tier for the same property, i.e. two `@media`\n * rules for `color`. Those are ordered widest interval first, so the narrower query is emitted\n * later and wins in the cascade wherever both match. Equal widths go by lower bound ascending,\n * and queries with no readable interval (`print`, `not`, comma lists, non-px units) come last,\n * as they do in StyleX. For one-sided queries this is min-width ascending, then max-width descending.\n *\n * The class-name tiebreak keeps the output fully deterministic regardless of file processing\n * order, which differs between dev HMR and production builds.\n *\n * I.e. `(min-width: 600px)` → `(min-width: 960px)` → `(max-width: 1150px)` → `(max-width: 820px)`\n * → `(min-width: 600px) and (max-width: 959px)` → `print`.\n */\nexport function compareRuleSortKeys(a: RuleSortKey, b: RuleSortKey): number {\n return (\n a.priority - b.priority ||\n compareWidthIntervals(a.widthInterval, b.widthInterval) ||\n compareClassNames(a.className, b.className)\n );\n}\n\n/** Code-point order, so identical class sets sort identically in dev and production. */\nexport function compareClassNames(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** I.e. `\"@media (min-width: 600px) { .a.a { color: red; } }\"` → `\"@media (min-width: 600px)\"`, or undefined for a plain rule. */\nexport function atRulePrelude(cssText: string): string | undefined {\n if (!cssText.startsWith(\"@\")) return undefined;\n const brace = cssText.indexOf(\"{\");\n return brace === -1 ? undefined : cssText.slice(0, brace).trim();\n}\n\n/**\n * Parse the px width interval a `@media` or `@container` prelude matches.\n *\n * Only `and`-joined `(min-width: Npx)` / `(max-width: Npx)` terms are read. Other features such as\n * `(orientation: landscape)` and media types such as `screen` add no bound, and repeated terms\n * collapse to the effective bound. The result is exact for what it accepts, and null (\"no interval\")\n * for a prelude with no width term or with anything it cannot read exactly: comma lists, `not`,\n * `or`, range syntax, and non-px units.\n *\n * I.e. `\"@media screen and (min-width: 600px) and (max-width: 959px)\"` → `{ lo: 600, hi: 959 }`,\n * `\"@container grid (min-width: 601px)\"` → `{ lo: 601, hi: Infinity }`, `\"@media print\"` → null.\n */\nfunction parseWidthInterval(prelude: string): WidthInterval | null {\n if (/,|\\bnot\\b|\\bor\\b|[<>]/.test(prelude)) return null;\n const terms = Array.from(prelude.matchAll(/\\((min|max)-width:\\s*([^)]*)\\)/g));\n if (terms.length === 0) return null;\n let lo = 0;\n let hi = Infinity;\n for (const term of terms) {\n const px = parsePxLength(term[2]);\n if (px === null) return null;\n if (term[1] === \"min\") {\n lo = Math.max(lo, px);\n } else {\n hi = Math.min(hi, px);\n }\n }\n return { lo, hi };\n}\n\n/** I.e. `\"600px\"` → 600, `\"0\"` → 0, `\"40rem\"` → null. */\nfunction parsePxLength(value: string): number | null {\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?)(px)?$/);\n if (!match) return null;\n if (match[2] === undefined && Number(match[1]) !== 0) return null;\n return Number(match[1]);\n}\n\n/**\n * Widest interval first, equal widths by lower bound ascending, null last.\n *\n * I.e. `{ lo: 600, hi: Infinity }` (width Infinity) → `{ lo: 0, hi: 1150 }` (width 1150)\n * → `{ lo: 600, hi: 959 }` (width 359) → null.\n */\nfunction compareWidthIntervals(a: WidthInterval | null, b: WidthInterval | null): number {\n if (a === null || b === null) {\n return (a === null ? 1 : 0) - (b === null ? 1 : 0);\n }\n const widthA = a.hi - a.lo;\n const widthB = b.hi - b.lo;\n if (widthA !== widthB) return widthA > widthB ? -1 : 1;\n return a.lo - b.lo;\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Converted from Flow to TypeScript; otherwise kept as-is for easy updates from upstream.\n * Source: https://github.com/facebook/stylex/blob/1ddee1dde1d55134c7d4f6889d8cbf34091e72fd/packages/%40stylexjs/shared/src/utils/property-priorities.js\n */\n\n// Physical properties that have logical equivalents:\nconst longHandPhysical = new Set<string>();\n// Logical properties *and* all other long hand properties:\nconst longHandLogical = new Set<string>();\n// Shorthand properties that override longhand properties:\nconst shorthandsOfLonghands = new Set<string>();\n// Shorthand properties that override other shorthand properties:\nconst shorthandsOfShorthands = new Set<string>();\n\n// Using MDN data as a source of truth to populate the above sets\n// by group in alphabetical order:\n\n// Composition and Blending\nlongHandLogical.add(\"background-blend-mode\");\nlongHandLogical.add(\"isolation\");\nlongHandLogical.add(\"mix-blend-mode\");\n\n// CSS Animations\nshorthandsOfShorthands.add(\"animation\");\nlongHandLogical.add(\"animation-composition\");\nlongHandLogical.add(\"animation-delay\");\nlongHandLogical.add(\"animation-direction\");\nlongHandLogical.add(\"animation-duration\");\nlongHandLogical.add(\"animation-fill-mode\");\nlongHandLogical.add(\"animation-iteration-count\");\nlongHandLogical.add(\"animation-name\");\nlongHandLogical.add(\"animation-play-state\");\nshorthandsOfLonghands.add(\"animation-range\");\nlongHandLogical.add(\"animation-range-end\");\nlongHandLogical.add(\"animation-range-start\");\nlongHandLogical.add(\"animation-timing-function\");\nlongHandLogical.add(\"animation-timeline\");\n\nshorthandsOfLonghands.add(\"scroll-timeline\");\nlongHandLogical.add(\"scroll-timeline-axis\");\nlongHandLogical.add(\"scroll-timeline-name\");\n\nlongHandLogical.add(\"timeline-scope\");\n\nshorthandsOfLonghands.add(\"view-timeline\");\nlongHandLogical.add(\"view-timeline-axis\");\nlongHandLogical.add(\"view-timeline-inset\");\nlongHandLogical.add(\"view-timeline-name\");\n\n// CSS Backgrounds and Borders\nshorthandsOfShorthands.add(\"background\");\nlongHandLogical.add(\"background-attachment\");\nlongHandLogical.add(\"background-clip\");\nlongHandLogical.add(\"background-color\");\nlongHandLogical.add(\"background-image\");\nlongHandLogical.add(\"background-origin\");\nlongHandLogical.add(\"background-repeat\");\nlongHandLogical.add(\"background-size\");\nshorthandsOfLonghands.add(\"background-position\");\nlongHandLogical.add(\"background-position-x\");\nlongHandLogical.add(\"background-position-y\");\n\nshorthandsOfShorthands.add(\"border\"); // OF SHORTHANDS!\nshorthandsOfLonghands.add(\"border-color\");\nshorthandsOfLonghands.add(\"border-style\");\nshorthandsOfLonghands.add(\"border-width\");\nshorthandsOfShorthands.add(\"border-block\"); // Logical Properties\nlongHandLogical.add(\"border-block-color\"); // Logical Properties\nlongHandLogical.add(\"border-block-stylex\"); // Logical Properties\nlongHandLogical.add(\"border-block-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-block-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-top\");\nlongHandLogical.add(\"border-block-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-top-color\");\nlongHandLogical.add(\"border-block-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-top-style\");\nlongHandLogical.add(\"border-block-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-top-width\");\nshorthandsOfLonghands.add(\"border-block-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-bottom\");\nlongHandLogical.add(\"border-block-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-color\");\nlongHandLogical.add(\"border-block-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-style\");\nlongHandLogical.add(\"border-block-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-width\");\nshorthandsOfShorthands.add(\"border-inline\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-color\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-style\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-left\");\nlongHandLogical.add(\"border-inline-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-left-color\");\nlongHandLogical.add(\"border-inline-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-left-style\");\nlongHandLogical.add(\"border-inline-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-left-width\");\nshorthandsOfLonghands.add(\"border-inline-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-right\");\nlongHandLogical.add(\"border-inline-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-right-color\");\nlongHandLogical.add(\"border-inline-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-right-style\");\nlongHandLogical.add(\"border-inline-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-right-width\");\n\nshorthandsOfLonghands.add(\"border-image\");\nlongHandLogical.add(\"border-image-outset\");\nlongHandLogical.add(\"border-image-repeat\");\nlongHandLogical.add(\"border-image-slice\");\nlongHandLogical.add(\"border-image-source\");\nlongHandLogical.add(\"border-image-width\");\n\nshorthandsOfLonghands.add(\"border-radius\");\nlongHandLogical.add(\"border-start-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-start-start-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-start-radius\"); // Logical Properties\nlongHandPhysical.add(\"border-top-left-radius\");\nlongHandPhysical.add(\"border-top-right-radius\");\nlongHandPhysical.add(\"border-bottom-left-radius\");\nlongHandPhysical.add(\"border-bottom-right-radius\");\n\nshorthandsOfLonghands.add(\"corner-shape\");\nlongHandLogical.add(\"corner-start-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-start-end-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-end-shape\"); // Logical Properties\nlongHandPhysical.add(\"corner-top-left-shape\");\nlongHandPhysical.add(\"corner-top-right-shape\");\nlongHandPhysical.add(\"corner-bottom-left-shape\");\nlongHandPhysical.add(\"corner-bottom-right-shape\");\n\nlongHandLogical.add(\"box-shadow\");\n\n// CSS Basic User Interface\nlongHandLogical.add(\"accent-color\");\nlongHandLogical.add(\"appearance\");\nlongHandLogical.add(\"aspect-ratio\");\n\nshorthandsOfLonghands.add(\"caret\");\nlongHandLogical.add(\"caret-color\");\nlongHandLogical.add(\"caret-shape\");\n\nlongHandLogical.add(\"cursor\");\nlongHandLogical.add(\"ime-mode\");\nlongHandLogical.add(\"input-security\");\n\nshorthandsOfLonghands.add(\"outline\");\nlongHandLogical.add(\"outline-color\");\nlongHandLogical.add(\"outline-offset\");\nlongHandLogical.add(\"outline-style\");\nlongHandLogical.add(\"outline-width\");\n\nlongHandLogical.add(\"pointer-events\");\nlongHandLogical.add(\"resize\"); // horizontal, vertical, block, inline, both\nlongHandLogical.add(\"text-overflow\");\nlongHandLogical.add(\"user-select\");\n\n// CSS Box Alignment\nshorthandsOfLonghands.add(\"grid-gap\"); // alias for `gap`\nshorthandsOfLonghands.add(\"gap\");\nlongHandLogical.add(\"grid-row-gap\"); // alias for `row-gap`\nlongHandLogical.add(\"row-gap\");\nlongHandLogical.add(\"grid-column-gap\"); // alias for `column-gap`\nlongHandLogical.add(\"column-gap\");\n\nshorthandsOfLonghands.add(\"place-content\");\nlongHandLogical.add(\"align-content\");\nlongHandLogical.add(\"justify-content\");\n\nshorthandsOfLonghands.add(\"place-items\");\nlongHandLogical.add(\"align-items\");\nlongHandLogical.add(\"justify-items\");\n\nshorthandsOfLonghands.add(\"place-self\");\nlongHandLogical.add(\"align-self\");\nlongHandLogical.add(\"justify-self\");\n\n// CSS Box Model\nlongHandLogical.add(\"box-sizing\");\n\nlongHandLogical.add(\"block-size\"); // Logical Properties\nlongHandPhysical.add(\"height\");\nlongHandLogical.add(\"inline-size\"); // Logical Properties\nlongHandPhysical.add(\"width\");\n\nlongHandLogical.add(\"max-block-size\"); // Logical Properties\nlongHandPhysical.add(\"max-height\");\nlongHandLogical.add(\"max-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"max-width\");\nlongHandLogical.add(\"min-block-size\"); // Logical Properties\nlongHandPhysical.add(\"min-height\");\nlongHandLogical.add(\"min-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"min-width\");\n\nshorthandsOfShorthands.add(\"margin\");\nshorthandsOfLonghands.add(\"margin-block\"); // Logical Properties\nlongHandLogical.add(\"margin-block-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-top\");\nlongHandLogical.add(\"margin-block-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-bottom\");\nshorthandsOfLonghands.add(\"margin-inline\"); // Logical Properties\nlongHandLogical.add(\"margin-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-left\");\nlongHandLogical.add(\"margin-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-right\");\n\nlongHandLogical.add(\"margin-trim\");\n\nshorthandsOfLonghands.add(\"overscroll-behavior\");\nlongHandLogical.add(\"overscroll-behavior-block\");\nlongHandPhysical.add(\"overscroll-behavior-y\");\nlongHandLogical.add(\"overscroll-behavior-inline\");\nlongHandPhysical.add(\"overscroll-behavior-x\");\n\nshorthandsOfShorthands.add(\"padding\");\nshorthandsOfLonghands.add(\"padding-block\"); // Logical Properties\nlongHandLogical.add(\"padding-block-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-top\");\nlongHandLogical.add(\"padding-block-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-bottom\");\nshorthandsOfLonghands.add(\"padding-inline\"); // Logical Properties\nlongHandLogical.add(\"padding-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-left\");\nlongHandLogical.add(\"padding-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-right\");\n\nlongHandLogical.add(\"visibility\");\n\n// CSS Color\nlongHandLogical.add(\"color\");\nlongHandLogical.add(\"color-scheme\");\nlongHandLogical.add(\"forced-color-adjust\");\nlongHandLogical.add(\"opacity\");\nlongHandLogical.add(\"print-color-adjust\");\n\n// CSS Columns\nshorthandsOfLonghands.add(\"columns\");\nlongHandLogical.add(\"column-count\");\nlongHandLogical.add(\"column-width\");\n\nlongHandLogical.add(\"column-fill\");\nlongHandLogical.add(\"column-span\");\n\nshorthandsOfLonghands.add(\"column-rule\");\nlongHandLogical.add(\"column-rule-color\");\nlongHandLogical.add(\"column-rule-style\");\nlongHandLogical.add(\"column-rule-width\");\n\n// CSS Containment\nlongHandLogical.add(\"contain\");\n\nshorthandsOfLonghands.add(\"contain-intrinsic-size\");\nlongHandLogical.add(\"contain-intrinsic-block-size\");\nlongHandLogical.add(\"contain-intrinsic-width\");\nlongHandLogical.add(\"contain-intrinsic-height\");\nlongHandLogical.add(\"contain-intrinsic-inline-size\");\n\nshorthandsOfLonghands.add(\"container\");\nlongHandLogical.add(\"container-name\");\nlongHandLogical.add(\"container-type\");\n\nlongHandLogical.add(\"content-visibility\");\n\n// CSS Counter Styles\nlongHandLogical.add(\"counter-increment\");\nlongHandLogical.add(\"counter-reset\");\nlongHandLogical.add(\"counter-set\");\n\n// CSS Display\nlongHandLogical.add(\"display\");\n\n// CSS Flexible Box Layout\nshorthandsOfLonghands.add(\"flex\");\nlongHandLogical.add(\"flex-basis\");\nlongHandLogical.add(\"flex-grow\");\nlongHandLogical.add(\"flex-shrink\");\n\nshorthandsOfLonghands.add(\"flex-flow\");\nlongHandLogical.add(\"flex-direction\");\nlongHandLogical.add(\"flex-wrap\");\n\nlongHandLogical.add(\"order\");\n\n// CSS Fonts\nshorthandsOfShorthands.add(\"font\");\nlongHandLogical.add(\"font-family\");\nlongHandLogical.add(\"font-size\");\nlongHandLogical.add(\"font-stretch\");\nlongHandLogical.add(\"font-style\");\nlongHandLogical.add(\"font-weight\");\nlongHandLogical.add(\"line-height\");\nshorthandsOfLonghands.add(\"font-variant\");\nlongHandLogical.add(\"font-variant-alternates\");\nlongHandLogical.add(\"font-variant-caps\");\nlongHandLogical.add(\"font-variant-east-asian\");\nlongHandLogical.add(\"font-variant-emoji\");\nlongHandLogical.add(\"font-variant-ligatures\");\nlongHandLogical.add(\"font-variant-numeric\");\nlongHandLogical.add(\"font-variant-position\");\n\nlongHandLogical.add(\"font-feature-settings\");\nlongHandLogical.add(\"font-kerning\");\nlongHandLogical.add(\"font-language-override\");\nlongHandLogical.add(\"font-optical-sizing\");\nlongHandLogical.add(\"font-palette\");\nlongHandLogical.add(\"font-variation-settings\");\nlongHandLogical.add(\"font-size-adjust\");\nlongHandLogical.add(\"font-smooth\"); // Non-standard\nlongHandLogical.add(\"font-synthesis-position\");\nlongHandLogical.add(\"font-synthesis-small-caps\");\nlongHandLogical.add(\"font-synthesis-style\");\nlongHandLogical.add(\"font-synthesis-weight\");\n\nlongHandLogical.add(\"line-height-step\");\n\n// CSS Fragmentation\nlongHandLogical.add(\"box-decoration-break\");\nlongHandLogical.add(\"break-after\");\nlongHandLogical.add(\"break-before\");\nlongHandLogical.add(\"break-inside\");\nlongHandLogical.add(\"orphans\");\nlongHandLogical.add(\"widows\");\n\n// CSS Generated Content\nlongHandLogical.add(\"content\");\nlongHandLogical.add(\"quotes\");\n\n// CSS Grid Layout\nshorthandsOfShorthands.add(\"grid\");\nlongHandLogical.add(\"grid-auto-flow\");\nlongHandLogical.add(\"grid-auto-rows\");\nlongHandLogical.add(\"grid-auto-columns\");\nshorthandsOfShorthands.add(\"grid-template\");\nshorthandsOfLonghands.add(\"grid-template-areas\");\nlongHandLogical.add(\"grid-template-columns\");\nlongHandLogical.add(\"grid-template-rows\");\n\nshorthandsOfShorthands.add(\"grid-area\");\nshorthandsOfLonghands.add(\"grid-row\");\nlongHandLogical.add(\"grid-row-start\");\nlongHandLogical.add(\"grid-row-end\");\nshorthandsOfLonghands.add(\"grid-column\");\nlongHandLogical.add(\"grid-column-start\");\nlongHandLogical.add(\"grid-column-end\");\n\nlongHandLogical.add(\"align-tracks\");\nlongHandLogical.add(\"justify-tracks\");\nlongHandLogical.add(\"masonry-auto-flow\");\n\n// CSS Images\nlongHandLogical.add(\"image-orientation\");\nlongHandLogical.add(\"image-rendering\");\nlongHandLogical.add(\"image-resolution\");\nlongHandLogical.add(\"object-fit\");\nlongHandLogical.add(\"object-position\");\n\n// CSS Inline\nlongHandLogical.add(\"initial-letter\");\nlongHandLogical.add(\"initial-letter-align\");\n\n// CSS Lists and Counters\nshorthandsOfLonghands.add(\"list-style\");\nlongHandLogical.add(\"list-style-image\");\nlongHandLogical.add(\"list-style-position\");\nlongHandLogical.add(\"list-style-type\");\n\n// CSS Masking\nlongHandLogical.add(\"clip\"); // @deprecated\nlongHandLogical.add(\"clip-path\");\n\nshorthandsOfLonghands.add(\"mask\");\nlongHandLogical.add(\"mask-clip\");\nlongHandLogical.add(\"mask-composite\");\nlongHandLogical.add(\"mask-image\");\nlongHandLogical.add(\"mask-mode\");\nlongHandLogical.add(\"mask-origin\");\nlongHandLogical.add(\"mask-position\");\nlongHandLogical.add(\"mask-repeat\");\nlongHandLogical.add(\"mask-size\");\n\nlongHandLogical.add(\"mask-type\");\n\nshorthandsOfLonghands.add(\"mask-border\");\nlongHandLogical.add(\"mask-border-mode\");\nlongHandLogical.add(\"mask-border-outset\");\nlongHandLogical.add(\"mask-border-repeat\");\nlongHandLogical.add(\"mask-border-slice\");\nlongHandLogical.add(\"mask-border-source\");\nlongHandLogical.add(\"mask-border-width\");\n\n// CSS Miscellaneous\nshorthandsOfShorthands.add(\"all\"); // avoid!\nlongHandLogical.add(\"text-rendering\");\n\n// CSS Motion Path\nshorthandsOfLonghands.add(\"offset\");\nlongHandLogical.add(\"offset-anchor\");\nlongHandLogical.add(\"offset-distance\");\nlongHandLogical.add(\"offset-path\");\nlongHandLogical.add(\"offset-position\");\nlongHandLogical.add(\"offset-rotate\");\n\n// CSS Overflow\nlongHandLogical.add(\"-webkit-box-orient\");\nlongHandLogical.add(\"-webkit-line-clamp\");\n\nshorthandsOfLonghands.add(\"overflow\");\nlongHandLogical.add(\"overflow-block\");\nlongHandPhysical.add(\"overflow-y\");\nlongHandLogical.add(\"overflow-inline\");\nlongHandPhysical.add(\"overflow-x\");\n\nlongHandLogical.add(\"overflow-clip-margin\"); // partial support\n\nlongHandLogical.add(\"scroll-gutter\");\nlongHandLogical.add(\"scroll-behavior\");\n\n// CSS Pages\nlongHandLogical.add(\"page\");\nlongHandLogical.add(\"page-break-after\");\nlongHandLogical.add(\"page-break-before\");\nlongHandLogical.add(\"page-break-inside\");\n\n// CSS Positioning\nshorthandsOfShorthands.add(\"inset\"); // Logical Properties\nshorthandsOfLonghands.add(\"inset-block\"); // Logical Properties\nlongHandLogical.add(\"inset-block-start\"); // Logical Properties\nlongHandPhysical.add(\"top\");\nlongHandLogical.add(\"inset-block-end\"); // Logical Properties\nlongHandPhysical.add(\"bottom\");\nshorthandsOfLonghands.add(\"inset-inline\"); // Logical Properties\nlongHandLogical.add(\"inset-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"left\");\nlongHandLogical.add(\"inset-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"right\");\n\nlongHandLogical.add(\"clear\");\nlongHandLogical.add(\"float\");\nlongHandLogical.add(\"position\");\nlongHandLogical.add(\"z-index\");\n\n// CSS Ruby\nlongHandLogical.add(\"ruby-align\");\nlongHandLogical.add(\"ruby-merge\");\nlongHandLogical.add(\"ruby-position\");\n\n// CSS Scroll Anchoring\nlongHandLogical.add(\"overflow-anchor\");\n\n// CSS Scroll Snap\nshorthandsOfShorthands.add(\"scroll-margin\");\nshorthandsOfLonghands.add(\"scroll-margin-block\");\nlongHandLogical.add(\"scroll-margin-block-start\");\nlongHandPhysical.add(\"scroll-margin-top\");\nlongHandLogical.add(\"scroll-margin-block-end\");\nlongHandPhysical.add(\"scroll-margin-bottom\");\nshorthandsOfLonghands.add(\"scroll-margin-inline\");\nlongHandLogical.add(\"scroll-margin-inline-start\");\nlongHandPhysical.add(\"scroll-margin-left\");\nlongHandLogical.add(\"scroll-margin-inline-end\");\nlongHandPhysical.add(\"scroll-margin-right\");\n\nshorthandsOfShorthands.add(\"scroll-padding\");\nshorthandsOfLonghands.add(\"scroll-padding-block\");\nlongHandLogical.add(\"scroll-padding-block-start\");\nlongHandPhysical.add(\"scroll-padding-top\");\nlongHandLogical.add(\"scroll-padding-block-end\");\nlongHandPhysical.add(\"scroll-padding-bottom\");\nshorthandsOfLonghands.add(\"scroll-padding-inline\");\nlongHandLogical.add(\"scroll-padding-inline-start\");\nlongHandPhysical.add(\"scroll-padding-left\");\nlongHandLogical.add(\"scroll-padding-inline-end\");\nlongHandPhysical.add(\"scroll-padding-right\");\n\nlongHandLogical.add(\"scroll-snap-align\");\nlongHandLogical.add(\"scroll-snap-stop\");\nshorthandsOfLonghands.add(\"scroll-snap-type\");\n\n// CSS Scrollbars\nlongHandLogical.add(\"scrollbar-color\");\nlongHandLogical.add(\"scrollbar-width\");\n\n// CSS Shapes\nlongHandLogical.add(\"shape-image-threshold\");\nlongHandLogical.add(\"shape-margin\");\nlongHandLogical.add(\"shape-outside\");\n\n// CSS Speech\nlongHandLogical.add(\"azimuth\");\n\n// CSS Table\nlongHandLogical.add(\"border-collapse\");\nlongHandLogical.add(\"border-spacing\");\nlongHandLogical.add(\"caption-side\");\nlongHandLogical.add(\"empty-cells\");\nlongHandLogical.add(\"table-layout\");\nlongHandLogical.add(\"vertical-align\");\n\n// CSS Text Decoration\nshorthandsOfLonghands.add(\"text-decoration\");\nlongHandLogical.add(\"text-decoration-color\");\nlongHandLogical.add(\"text-decoration-line\");\nlongHandLogical.add(\"text-decoration-skip\");\nlongHandLogical.add(\"text-decoration-skip-ink\");\nlongHandLogical.add(\"text-decoration-style\");\nlongHandLogical.add(\"text-decoration-thickness\");\n\nshorthandsOfLonghands.add(\"text-emphasis\");\nlongHandLogical.add(\"text-emphasis-color\");\nlongHandLogical.add(\"text-emphasis-position\");\nlongHandLogical.add(\"text-emphasis-style\");\nlongHandLogical.add(\"text-shadow\");\nlongHandLogical.add(\"text-underline-offset\");\nlongHandLogical.add(\"text-underline-position\");\n\n// CSS Text\nlongHandLogical.add(\"hanging-punctuation\");\nlongHandLogical.add(\"hyphenate-character\");\nlongHandLogical.add(\"hyphenate-limit-chars\");\nlongHandLogical.add(\"hyphens\");\nlongHandLogical.add(\"letter-spacing\");\nlongHandLogical.add(\"line-break\");\nlongHandLogical.add(\"overflow-wrap\");\nlongHandLogical.add(\"paint-order\");\nlongHandLogical.add(\"tab-size\");\nlongHandLogical.add(\"text-align\");\nlongHandLogical.add(\"text-align-last\");\nlongHandLogical.add(\"text-indent\");\nlongHandLogical.add(\"text-justify\");\nlongHandLogical.add(\"text-size-adjust\");\nlongHandLogical.add(\"text-transform\");\nlongHandLogical.add(\"text-wrap\");\nlongHandLogical.add(\"white-space\");\nlongHandLogical.add(\"white-space-collapse\");\nlongHandLogical.add(\"word-break\");\nlongHandLogical.add(\"word-spacing\");\nlongHandLogical.add(\"word-wrap\");\n\n// CSS Transforms\nlongHandLogical.add(\"backface-visibility\");\nlongHandLogical.add(\"perspective\");\nlongHandLogical.add(\"perspective-origin\");\nlongHandLogical.add(\"rotate\");\nlongHandLogical.add(\"scale\");\nlongHandLogical.add(\"transform\");\nlongHandLogical.add(\"transform-box\");\nlongHandLogical.add(\"transform-origin\");\nlongHandLogical.add(\"transform-style\");\nlongHandLogical.add(\"translate\");\n\n// CSS Transitions\nshorthandsOfLonghands.add(\"transition\");\nlongHandLogical.add(\"transition-delay\");\nlongHandLogical.add(\"transition-duration\");\nlongHandLogical.add(\"transition-property\");\nlongHandLogical.add(\"transition-timing-function\");\n\n// CSS View Transitions\nlongHandLogical.add(\"view-transition-name\");\n\n// CSS Will Change\nlongHandLogical.add(\"will-change\");\n\n// CSS Writing Modes\nlongHandLogical.add(\"direction\");\nlongHandLogical.add(\"text-combine-upright\");\nlongHandLogical.add(\"text-orientation\");\nlongHandLogical.add(\"unicode-bidi\");\nlongHandLogical.add(\"writing-mode\");\n\n// CSS Filter Effects\nlongHandLogical.add(\"backdrop-filter\");\nlongHandLogical.add(\"filter\");\n\n// MathML\nlongHandLogical.add(\"math-depth\");\nlongHandLogical.add(\"math-shift\");\nlongHandLogical.add(\"math-style\");\n\n// CSS Pointer Events\nlongHandLogical.add(\"touch-action\");\n\nexport const PSEUDO_CLASS_PRIORITIES: Readonly<Record<string, number>> = {\n \":is\": 40,\n \":where\": 40,\n \":not\": 40,\n \":has\": 45,\n \":dir\": 50,\n \":lang\": 51,\n \":first-child\": 52,\n \":first-of-type\": 53,\n \":last-child\": 54,\n \":last-of-type\": 55,\n \":only-child\": 56,\n \":only-of-type\": 57,\n \":nth-child\": 60,\n \":nth-last-child\": 61,\n \":nth-of-type\": 62,\n \":nth-last-of-type\": 63,\n \":empty\": 70,\n \":link\": 80,\n \":any-link\": 81,\n \":local-link\": 82,\n \":target-within\": 83,\n \":target\": 84,\n \":visited\": 85,\n \":enabled\": 91,\n \":disabled\": 92,\n \":required\": 93,\n \":optional\": 94,\n \":read-only\": 95,\n \":read-write\": 96,\n \":placeholder-shown\": 97,\n \":in-range\": 98,\n \":out-of-range\": 99,\n \":default\": 100,\n \":checked\": 101,\n \":indeterminate\": 101,\n \":blank\": 102,\n \":valid\": 103,\n \":invalid\": 104,\n \":user-invalid\": 105,\n \":autofill\": 110,\n \":picture-in-picture\": 120,\n \":modal\": 121,\n \":fullscreen\": 122,\n \":paused\": 123,\n \":playing\": 124,\n \":current\": 125,\n \":past\": 126,\n \":future\": 127,\n \":hover\": 130,\n \":focus-within\": 140,\n \":focus\": 150,\n \":focus-visible\": 160,\n \":active\": 170,\n};\n\nexport const AT_RULE_PRIORITIES: Readonly<Record<string, number>> = {\n \"@supports\": 30,\n \"@media\": 200,\n \"@container\": 300,\n};\n\nexport const PSEUDO_ELEMENT_PRIORITY: number = 5000;\n\n/** Get the property tier for a CSS property (kebab-case). */\nexport function getPropertyPriority(property: string): number {\n if (shorthandsOfShorthands.has(property)) return 1000;\n if (shorthandsOfLonghands.has(property)) return 2000;\n if (longHandLogical.has(property)) return 3000;\n if (longHandPhysical.has(property)) return 4000;\n // Unknown properties default to 3000 (longhand) — safest default\n return 3000;\n}\n\n/** Get the priority for a pseudo-class selector. */\nexport function getPseudoClassPriority(pseudo: string): number {\n const leadingPseudo = pseudo.trim().match(/^::?[a-zA-Z-]+/)?.[0] ?? pseudo.split(\"(\")[0];\n const base = leadingPseudo.replace(/[A-Z]/g, (match) => {\n return `-${match.toLowerCase()}`;\n });\n return PSEUDO_CLASS_PRIORITIES[base] ?? 40;\n}\n\n/** Get the priority for an at-rule. */\nexport function getAtRulePriority(atRule: string): number {\n if (atRule.startsWith(\"--\")) return 1;\n if (atRule.startsWith(\"@supports\")) return AT_RULE_PRIORITIES[\"@supports\"];\n if (atRule.startsWith(\"@media\")) return AT_RULE_PRIORITIES[\"@media\"];\n if (atRule.startsWith(\"@container\")) return AT_RULE_PRIORITIES[\"@container\"];\n return 0;\n}\n","/**\n * Computes CSS rule priority using StyleX's priority system.\n *\n * Priority is an additive sum: propertyPriority + pseudoPriority + atRulePriority + pseudoElementPriority.\n * Rules are sorted by this number before emission, guaranteeing longhands beat shorthands,\n * pseudo-classes follow LVFHA order, and at-rules override base styles — all deterministically.\n *\n * Rules that tie on priority, i.e. two `@media` rules for the same property, are ordered by the\n * width interval their query matches, widest first, so the narrower query is emitted later and\n * wins wherever both match. See `compareRuleSortKeys`.\n */\n\nimport { compareRuleSortKeys, ruleSortKey } from \"../css-order\";\nimport {\n getPropertyPriority,\n getPseudoClassPriority,\n getAtRulePriority,\n PSEUDO_ELEMENT_PRIORITY,\n} from \"./property-priorities\";\nimport { WHEN_RELATIONSHIPS } from \"./when-relationships\";\nimport type { AtomicRule } from \"./emit-css\";\n\nexport { compareClassNames, compareRuleSortKeys, ruleSortKey } from \"../css-order\";\nexport type { RuleSortKey, WidthInterval } from \"../css-order\";\n\n/**\n * Compute the numeric priority for a single AtomicRule.\n *\n * I.e. a rule with `declarations: [{ cssProperty: \"border-top-color\", ... }]`, `pseudoClass: \":hover\"`,\n * `mediaQuery: \"@media ...\"` → 4000 (physical longhand) + 130 (:hover) + 200 (@media) = 4330\n */\nexport function computeRulePriority(rule: AtomicRule): number {\n let priority = getPropertyPriority(rule.declarations[0].cssProperty);\n\n if (rule.pseudoElement) {\n priority += PSEUDO_ELEMENT_PRIORITY;\n }\n\n if (rule.pseudoClass) {\n priority += getPseudoClassPriority(rule.pseudoClass);\n }\n\n if (rule.mediaQuery) {\n priority += getAtRulePriority(rule.mediaQuery);\n }\n\n if (rule.whenSelector) {\n const relBase = WHEN_RELATIONSHIPS[rule.whenSelector.relationship].priority;\n const pseudoFraction = getPseudoClassPriority(rule.whenSelector.pseudo) / 100;\n priority += relBase + pseudoFraction;\n }\n\n // Variable rules get a small bonus (+0.5) so they sort after static rules for the same property\n if (isVariableRule(rule)) {\n priority += 0.5;\n }\n\n return priority;\n}\n\n/** Returns true if this rule uses CSS custom property var() values. */\nfunction isVariableRule(rule: AtomicRule): boolean {\n return rule.declarations.some((d) => d.cssVarName !== undefined);\n}\n\n/**\n * Pair each rule with its computed priority and sort with `compareRuleSortKeys`.\n *\n * Priorities and width intervals are computed once upfront so the O(n log n) comparisons are just\n * number/string compares, and callers can reuse the priorities for the `@truss p:` annotations.\n */\nexport function sortRulesByPriority(rules: Iterable<AtomicRule>): Array<{ rule: AtomicRule; priority: number }> {\n const decorated = Array.from(rules, (rule) => {\n const priority = computeRulePriority(rule);\n return { rule, priority, key: ruleSortKey(priority, rule.className, rule.mediaQuery) };\n });\n decorated.sort((a, b) => compareRuleSortKeys(a.key, b.key));\n return decorated.map((d) => ({ rule: d.rule, priority: d.priority }));\n}\n","import { chainSegments, type ResolvedChain } from \"./resolve-chain\";\nimport { isCssSegment, type CssSegment, type ResolvedSegment, type TrussMapping, type WhenCondition } from \"./types\";\nimport { sortRulesByPriority } from \"./priority\";\nimport { camelToKebab, markerClassName, styleEntriesForSegment } from \"./style-entries\";\nimport { WHEN_RELATIONSHIPS, type WhenRelationship } from \"./when-relationships\";\nimport { variableValueNeedsMaybeCssVar } from \"../css-custom-property\";\n\n// ── Atomic CSS rule model ─────────────────────────────────────────────\n\n/**\n * A single atomic CSS rule: one class, one selector, one or more declarations.\n *\n * I.e. `.black { color: #353535; }` is one AtomicRule with a single declaration,\n * while `sq(x)` produces one AtomicRule with two declarations (`height` + `width`).\n */\nexport interface AtomicRule {\n /** I.e. `\"sm_h_blue\"` — the generated class name including condition prefixes. */\n className: string;\n /**\n * The CSS property/value pairs this rule sets. Always has at least one entry.\n *\n * I.e. `[{ cssProperty: \"color\", cssValue: \"#526675\" }]` for a static rule, or\n * `[{ cssProperty: \"height\", cssValue: \"var(--height)\", cssVarName: \"--height\" },\n * { cssProperty: \"width\", cssValue: \"var(--width)\", cssVarName: \"--width\" }]` for `sq(x)`.\n */\n declarations: AtomicDeclaration[];\n pseudoClass?: string;\n mediaQuery?: string;\n pseudoElement?: string;\n /** I.e. `when(row, \"ancestor\", \":hover\")` → `{ relationship: \"ancestor\", markerClass: \"_row_mrk\", pseudo: \":hover\" }`. */\n whenSelector?: WhenSelector;\n}\n\nexport interface AtomicDeclaration {\n cssProperty: string;\n cssValue: string;\n /** I.e. `\"--marginTop\"` — present when this declaration uses a CSS custom property. */\n cssVarName?: string;\n}\n\nexport interface WhenSelector {\n relationship: WhenRelationship;\n markerClass: string;\n pseudo: string;\n}\n\n// ── Collecting atomic rules from resolved chains ──────────────────────\n\nexport interface CollectedRules {\n rules: Map<string, AtomicRule>;\n needsMaybeInc: boolean;\n needsMaybeCssVar: boolean;\n}\n\n/**\n * Collect all atomic CSS rules from resolved chains.\n *\n * I.e. walks every segment in every chain part and registers one AtomicRule\n * per CSS declaration, keyed by the prefixed class name.\n */\nexport function collectAtomicRules(chains: ResolvedChain[], mapping: TrussMapping): CollectedRules {\n const rules = new Map<string, AtomicRule>();\n let needsMaybeInc = false;\n let needsMaybeCssVar = false;\n\n function collectSegment(seg: ResolvedSegment): void {\n if (seg.kind === \"typography\") {\n for (const segments of Object.values(seg.segmentsByName)) {\n segments.forEach(collectSegment);\n }\n return;\n }\n if (!isCssSegment(seg)) return;\n if (seg.kind === \"variable\") {\n if (seg.incremented) needsMaybeInc = true;\n if (seg.argResolved === undefined && variableValueNeedsMaybeCssVar(seg)) needsMaybeCssVar = true;\n }\n collectSegmentRules(rules, seg, mapping);\n }\n\n for (const chain of chains) {\n chainSegments(chain).forEach(collectSegment);\n }\n\n return { rules, needsMaybeInc, needsMaybeCssVar };\n}\n\n/** Collect atomic CSS rules for one resolved style segment. */\nfunction collectSegmentRules(rules: Map<string, AtomicRule>, seg: CssSegment, mapping: TrussMapping): void {\n const { condition } = seg;\n\n for (const entry of styleEntriesForSegment(seg, mapping)) {\n const declaration: AtomicDeclaration = {\n cssProperty: camelToKebab(entry.cssProp),\n cssValue: entry.cssValue,\n ...(entry.varName ? { cssVarName: entry.varName } : {}),\n };\n const existingRule = rules.get(entry.className);\n if (!existingRule) {\n rules.set(entry.className, {\n className: entry.className,\n declarations: [declaration],\n pseudoClass: condition.pseudoClass ?? undefined,\n mediaQuery: condition.mediaQuery ?? undefined,\n pseudoElement: condition.pseudoElement ?? undefined,\n whenSelector: condition.whenPseudo ? whenSelectorFor(condition.whenPseudo) : undefined,\n });\n continue;\n }\n\n // I.e. `sq(x)` registers `height` and then `width` on the one `sq_var` rule.\n const alreadyDeclared = existingRule.declarations.some(\n (existing) => existing.cssProperty === declaration.cssProperty,\n );\n if (!alreadyDeclared) {\n existingRule.declarations.push(declaration);\n }\n }\n}\n\n/** I.e. `when(row, \"ancestor\", \":hover\")` → `{ relationship: \"ancestor\", markerClass: \"_row_mrk\", pseudo: \":hover\" }`. */\nfunction whenSelectorFor(whenPseudo: WhenCondition): WhenSelector {\n return {\n relationship: whenPseudo.relationship,\n markerClass: markerClassName(whenPseudo.markerNode),\n pseudo: whenPseudo.pseudo,\n };\n}\n\n// ── CSS text generation ───────────────────────────────────────────────\n\n/**\n * Generate the full CSS text from collected rules, sorted by StyleX priority.\n *\n * I.e. produces output like:\n * ```\n * /* @truss p:3000 c:black *\\/\n * .black { color: #353535; }\n * /* @truss p:3200 c:sm_blue *\\/\n * @media screen and (max-width: 599px) { .sm_blue.sm_blue { color: #526675; } }\n * ```\n */\nexport function generateCssText(rules: Map<string, AtomicRule>): string {\n const sorted = sortRulesByPriority(rules.values());\n const lines: string[] = [];\n\n for (const { rule, priority } of sorted) {\n lines.push(`/* @truss p:${priority} c:${rule.className} */`);\n lines.push(formatRule(rule));\n }\n\n // I.e. `@property --marginTop { syntax: \"*\"; inherits: false; }` for variable rules\n for (const { rule } of sorted) {\n for (const declaration of rule.declarations) {\n if (declaration.cssVarName) {\n lines.push(`/* @truss @property */`);\n lines.push(`@property ${declaration.cssVarName} { syntax: \"*\"; inherits: false; }`);\n }\n }\n }\n\n return lines.join(\"\\n\");\n}\n\n/**\n * Format a single rule into its CSS text.\n *\n * I.e. a base rule → `.black { color: #353535; }`,\n * a media rule → `@media (...) { .sm_blue.sm_blue { color: #526675; } }`,\n * a when rule → `._mrk:hover .wh_anc_h_blue { color: #526675; }`.\n *\n * Inside a media query the class is doubled (`.sm_blue.sm_blue`) so it outranks the base class.\n */\nfunction formatRule(rule: AtomicRule): string {\n const duplicateClassName = !!rule.mediaQuery;\n const whenSelector = rule.whenSelector;\n const selector = whenSelector\n ? WHEN_RELATIONSHIPS[whenSelector.relationship].selector(\n `.${whenSelector.markerClass}${whenSelector.pseudo}`,\n (extraPseudoClass) => buildTargetSelector(rule, duplicateClassName, extraPseudoClass),\n )\n : buildTargetSelector(rule, duplicateClassName);\n\n const body = rule.declarations.map((d) => `${d.cssProperty}: ${d.cssValue};`).join(\" \");\n const block = `${selector} { ${body} }`;\n return rule.mediaQuery ? `${rule.mediaQuery} { ${block} }` : block;\n}\n\n/**\n * Assemble the target element's CSS selector from all active condition slots.\n *\n * I.e. `buildTargetSelector(rule, true)` → `.sm_h_blue.sm_h_blue:hover`,\n * `buildTargetSelector(rule, false, \":has(._mrk:hover)\")` → `.wh_anc_h_blue:has(._mrk:hover)`.\n */\nfunction buildTargetSelector(rule: AtomicRule, duplicateClassName: boolean, extraPseudoClass = \"\"): string {\n const classSelector = duplicateClassName ? `.${rule.className}.${rule.className}` : `.${rule.className}`;\n return `${classSelector}${rule.pseudoClass ?? \"\"}${extraPseudoClass}${rule.pseudoElement ?? \"\"}`;\n}\n","import * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport { resolveFullChain } from \"./resolve-chain\";\nimport { extractDollarChain, findCssImportBinding, unwrapExpression } from \"./ast-utils\";\nimport { collectStaticStringBindings, resolveStaticString } from \"./css-ts-utils\";\nimport { camelToKebab } from \"./style-entries\";\nimport { parseModule } from \"./babel-utils\";\n\n/**\n * Transform a `.css.ts` file into a plain CSS string.\n *\n * The file is expected to have the shape:\n * ```ts\n * import { Css } from \"./Css\";\n * export const css = {\n * \".some-selector\": Css.df.blue.$,\n * \".other > .selector\": Css.mt(2).black.$,\n * body: `\n * margin: 0;\n * font-size: 14px !important;\n * `,\n * };\n * ```\n *\n * Each key is a CSS selector (string literal), each value is either a `Css.*.$`\n * chain or a string literal / template literal containing raw CSS declarations.\n * The chains are resolved via the truss mapping into concrete CSS declarations.\n *\n * Returns the generated CSS string.\n */\nexport function transformCssTs(code: string, filename: string, mapping: TrussMapping): string {\n const ast = parseModule(code, filename);\n\n // Css import is optional — only needed when Css.*.$ chains are used\n const cssBindingName = findCssImportBinding(ast);\n\n // Find the `export const css = { ... }` expression\n const cssExport = findNamedCssExportObject(ast);\n if (!cssExport) {\n return `/* [truss] ${filename}: expected \\`export const css = { ... }\\` with an object literal */\\n`;\n }\n\n const rules: string[] = [];\n const stringBindings = collectStaticStringBindings(ast);\n\n for (const prop of cssExport.properties) {\n if (t.isSpreadElement(prop)) {\n rules.push(`/* [truss] unsupported: spread elements in css.ts export */`);\n continue;\n }\n\n if (!t.isObjectProperty(prop)) {\n rules.push(`/* [truss] unsupported: non-property in css.ts export */`);\n continue;\n }\n\n // Key must be a string literal (the CSS selector)\n const selector = objectPropertyStringKey(prop, stringBindings);\n if (selector === null) {\n rules.push(`/* [truss] unsupported: non-string-literal key in css.ts export */`);\n continue;\n }\n\n const valueNode = prop.value;\n\n // String literal or template literal → pass through as raw CSS\n const rawCss = extractStaticStringValue(valueNode, cssBindingName);\n if (rawCss !== null) {\n rules.push(formatRawCssRule(selector, rawCss));\n continue;\n }\n\n // Otherwise value must be a Css.*.$ expression\n if (!t.isExpression(valueNode)) {\n rules.push(`/* [truss] unsupported: \"${selector}\" value is not an expression */`);\n continue;\n }\n\n if (!cssBindingName) {\n rules.push(`/* [truss] unsupported: \"${selector}\" — Css.*.$ chain requires a Css import */`);\n continue;\n }\n\n const cssResult = resolveCssExpression(valueNode, cssBindingName, mapping, filename);\n if (\"error\" in cssResult) {\n rules.push(`/* [truss] unsupported: \"${selector}\" — ${cssResult.error} */`);\n continue;\n }\n\n rules.push(formatCssRule(selector, cssResult.declarations));\n }\n\n return rules.join(\"\\n\\n\") + \"\\n\";\n}\n\n/** Find the object expression in `export const css = { ... }`. */\nfunction findNamedCssExportObject(ast: t.File): t.ObjectExpression | null {\n for (const node of ast.program.body) {\n if (!t.isExportNamedDeclaration(node) || !node.declaration) continue;\n if (!t.isVariableDeclaration(node.declaration)) continue;\n\n for (const declarator of node.declaration.declarations) {\n if (!t.isIdentifier(declarator.id, { name: \"css\" }) || !declarator.init) continue;\n // I.e. also accept `export const css = { ... } satisfies Record<string, ...>`\n const value = unwrapExpression(declarator.init);\n if (t.isObjectExpression(value)) return value;\n }\n }\n return null;\n}\n\n/** Extract a static string key from an ObjectProperty. */\nfunction objectPropertyStringKey(prop: t.ObjectProperty, stringBindings: Map<string, string>): string | null {\n if (t.isStringLiteral(prop.key)) return prop.key.value;\n // Allow unquoted identifiers as keys too (e.g. `body: Css.df.$`)\n if (t.isIdentifier(prop.key) && !prop.computed) return prop.key.name;\n if (prop.computed) return resolveStaticString(prop.key, stringBindings);\n return null;\n}\n\n/**\n * Extract a static string from a StringLiteral, a no-expression TemplateLiteral,\n * or a `Css.raw` tagged template literal (i.e. `Css.raw\\`...\\``).\n */\nfunction extractStaticStringValue(node: t.Node, cssBindingName: string | null): string | null {\n if (t.isStringLiteral(node)) return node.value;\n if (t.isTemplateLiteral(node) && node.expressions.length === 0 && node.quasis.length === 1) {\n return node.quasis[0].value.cooked ?? node.quasis[0].value.raw;\n }\n // Css.raw`...` tagged template literal\n if (\n t.isTaggedTemplateExpression(node) &&\n t.isMemberExpression(node.tag) &&\n !node.tag.computed &&\n t.isIdentifier(node.tag.property, { name: \"raw\" }) &&\n t.isIdentifier(node.tag.object, { name: cssBindingName ?? \"\" }) &&\n node.quasi.expressions.length === 0 &&\n node.quasi.quasis.length === 1\n ) {\n return node.quasi.quasis[0].value.cooked ?? node.quasi.quasis[0].value.raw;\n }\n return null;\n}\n\ninterface CssResolution {\n declarations: Array<{ property: string; value: string }>;\n error?: undefined;\n}\ninterface CssError {\n declarations?: undefined;\n error: string;\n}\n\n/**\n * Resolve a `Css.*.$` expression node to CSS declarations.\n *\n * Validates that the chain only uses static/literal patterns (no variable args,\n * no if/else conditionals, no pseudo/media modifiers).\n */\nfunction resolveCssExpression(\n node: t.Expression,\n cssBindingName: string,\n mapping: TrussMapping,\n filename: string,\n): CssResolution | CssError {\n // The expression must be a `Css.*.$` chain rooted at the Css import\n const chain = extractDollarChain(node, cssBindingName);\n if (!chain) {\n return { error: \"value must be a Css.*.$ expression\" };\n }\n\n // Validate: no if/else nodes\n for (const n of chain) {\n if (n.type === \"if\") return { error: \"if() conditionals are not supported in .css.ts files\" };\n if (n.type === \"else\") return { error: \"else is not supported in .css.ts files\" };\n if (n.type === \"call\" && n.name === \"when\") {\n return { error: \"when() modifiers are not supported in .css.ts files\" };\n }\n }\n\n const resolved = resolveFullChain({ mapping, cssBindingName }, chain);\n\n // Check for errors from resolution\n if (resolved.errors.length > 0) {\n return { error: resolved.errors[0] };\n }\n\n // Validate: no conditionals came back\n for (const part of resolved.parts) {\n if (part.type === \"conditional\") {\n return { error: \"conditional chains are not supported in .css.ts files\" };\n }\n }\n\n // Collect all declarations from all unconditional parts\n const declarations: Array<{ property: string; value: string }> = [];\n\n for (const part of resolved.parts) {\n if (part.type !== \"unconditional\") continue;\n for (const seg of part.segments) {\n // Reject segments that need the runtime: variables with runtime args and the non-CSS kinds\n if (seg.kind === \"error\") {\n return { error: seg.message };\n }\n if (seg.kind === \"variable\" && seg.argResolved === undefined) {\n return { error: `variable value with variable argument is not supported in .css.ts files` };\n }\n if (seg.kind === \"typography\") {\n return { error: `typography() with a runtime key is not supported in .css.ts files` };\n }\n if (seg.kind === \"composed\") {\n return { error: `add(cssProp) is not supported in .css.ts files` };\n }\n if (seg.kind === \"inlineStyle\") {\n return { error: `style() is not supported in .css.ts files` };\n }\n if (seg.kind === \"className\") {\n return { error: `className() is not supported in .css.ts files` };\n }\n\n // Reject segments with media query / pseudo-class / pseudo-element / when modifiers\n const { condition } = seg;\n if (condition.mediaQuery) {\n return { error: `media query modifiers (ifSm, ifMd, etc.) are not supported in .css.ts files` };\n }\n if (condition.pseudoClass) {\n return { error: `pseudo-class modifiers (onHover, onFocus, etc.) are not supported in .css.ts files` };\n }\n if (condition.pseudoElement) {\n return { error: `pseudo-element modifiers are not supported in .css.ts files` };\n }\n if (condition.whenPseudo) {\n return { error: `when() modifiers are not supported in .css.ts files` };\n }\n\n // I.e. a token variable `mt(Tokens.gap)` declares `var(--gap)` for each of its props\n const pairs: Array<[string, unknown]> =\n seg.kind === \"variable\" ? seg.props.map((prop) => [prop, seg.argResolved]) : Object.entries(seg.defs);\n for (const [prop, value] of pairs) {\n if (typeof value === \"string\" || typeof value === \"number\") {\n declarations.push({ property: camelToKebab(prop), value: String(value) });\n } else {\n // Nested condition objects (shouldn't happen after our validation, but defensive)\n return { error: `unexpected nested value for property \"${prop}\"` };\n }\n }\n }\n }\n\n return { declarations };\n}\n\n/** Format a CSS rule block from a raw CSS string, passed through as-is. */\nfunction formatRawCssRule(selector: string, raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return `${selector} {}`;\n // Indent each non-empty line by two spaces\n const body = trimmed\n .split(\"\\n\")\n .map((line) => ` ${line.trim()}`)\n .filter((line) => line.trim().length > 0)\n .join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n\n/** Format a CSS rule block. */\nfunction formatCssRule(selector: string, declarations: Array<{ property: string; value: string }>): string {\n if (declarations.length === 0) {\n return `${selector} {}`;\n }\n const body = declarations.map((d) => ` ${d.property}: ${d.value};`).join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n","import * as t from \"@babel/types\";\nimport { unwrapExpression } from \"./ast-utils\";\n\n/** Resolve module-scope string constants so .css.ts selectors can reuse them. */\nexport function collectStaticStringBindings(ast: t.File): Map<string, string> {\n const bindings = new Map<string, string>();\n let changed = true;\n\n while (changed) {\n changed = false;\n\n for (const node of ast.program.body) {\n const declaration = getTopLevelVariableDeclaration(node);\n if (!declaration) continue;\n\n for (const declarator of declaration.declarations) {\n if (!t.isIdentifier(declarator.id) || !declarator.init) continue;\n if (bindings.has(declarator.id.name)) continue;\n\n const value = resolveStaticString(declarator.init, bindings);\n if (value === null) continue;\n\n bindings.set(declarator.id.name, value);\n changed = true;\n }\n }\n }\n\n return bindings;\n}\n\n/** Resolve a static string expression from a literal, template, or identifier. */\nexport function resolveStaticString(node: t.Node | null | undefined, bindings: Map<string, string>): string | null {\n if (!node) return null;\n if (t.isExpression(node)) node = unwrapExpression(node);\n\n if (t.isStringLiteral(node)) return node.value;\n\n if (t.isTemplateLiteral(node)) {\n let value = \"\";\n for (let i = 0; i < node.quasis.length; i++) {\n value += node.quasis[i].value.cooked ?? \"\";\n if (i >= node.expressions.length) continue;\n\n const expressionValue = resolveStaticString(node.expressions[i], bindings);\n if (expressionValue === null) return null;\n value += expressionValue;\n }\n return value;\n }\n\n if (t.isIdentifier(node)) {\n return bindings.get(node.name) ?? null;\n }\n\n if (t.isBinaryExpression(node, { operator: \"+\" })) {\n const left = resolveStaticString(node.left, bindings);\n const right = resolveStaticString(node.right, bindings);\n if (left === null || right === null) return null;\n return left + right;\n }\n\n return null;\n}\n\nfunction getTopLevelVariableDeclaration(node: t.Statement): t.VariableDeclaration | null {\n if (t.isVariableDeclaration(node)) {\n return node;\n }\n\n if (t.isExportNamedDeclaration(node) && node.declaration && t.isVariableDeclaration(node.declaration)) {\n return node.declaration;\n }\n\n return null;\n}\n","import type { NodePath } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { basename } from \"path\";\nimport type { TrussMapping, ResolvedSegment } from \"./types\";\nimport { chainSegments, resolveFullChain, type CssChainReferenceResolver, type ResolvedChain } from \"./resolve-chain\";\nimport { generate, parseModule, traverse } from \"./babel-utils\";\nimport {\n extractChain,\n extractDollarChain,\n findCssBuilderBinding,\n findCssImportBinding,\n findImportDeclaration,\n findNamedImportBinding,\n insertAfterLeadingImports,\n isCssMethodCall,\n removeCssImport,\n replaceCssImportWithNamedImports,\n reservePreferredName,\n unwrapExpression,\n upsertNamedImports,\n type NamedImport,\n} from \"./ast-utils\";\nimport { collectAtomicRules, generateCssText, type AtomicRule } from \"./emit-css\";\nimport { buildMaybeIncDeclaration, buildRuntimeLookupDeclaration } from \"./emit-style-hash\";\nimport {\n rewriteExpressionSites,\n type ExpressionSite,\n type RuntimeHelperName,\n type RuntimeHelpers,\n} from \"./rewrite-sites\";\n\nexport interface TransformResult {\n code: string;\n map?: unknown;\n /** The generated CSS text for this file's Truss usages. */\n css: string;\n /** The atomic CSS rules collected during this transform, keyed by class name. */\n rules: Map<string, AtomicRule>;\n}\n\nexport interface TransformTrussOptions {\n debug?: boolean;\n /** When true, inject `__injectTrussCSS(cssText)` call for jsdom/test environments. */\n injectCss?: boolean;\n}\n\nconst RUNTIME_MODULE = \"@homebound/truss/runtime\";\n\n/** Runtime imports are emitted in this order regardless of which helper the rewrite reached first. */\nconst RUNTIME_HELPER_ORDER: RuntimeHelperName[] = [\"trussProps\", \"mergeProps\", \"TrussDebugInfo\", \"maybeCssVar\"];\n\n/**\n * The core transform function. Given a source file's code and the truss mapping,\n * finds all `Css.*.$` expressions and rewrites them into Truss-native style hash\n * objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Returns null if the file doesn't use Css.\n */\nexport function transformTruss(\n code: string,\n filename: string,\n mapping: TrussMapping,\n options: TransformTrussOptions = {},\n): TransformResult | null {\n // Fast bail: skip files that don't reference Css or use JSX css= attributes\n if (!code.includes(\"Css\") && !code.includes(\"css=\")) return null;\n\n const ast = parseModule(code, filename);\n\n // Step 1: Find the Css binding name — either from an import or a local `new CssBuilder(...)` declaration.\n // May be null when the file only has JSX css= attributes without importing Css.\n const cssImportBinding = findCssImportBinding(ast);\n const cssBindingName = cssImportBinding ?? findCssBuilderBinding(ast);\n\n // Step 2: Collect all Css.*.$ expression sites AND detect Css.props() / JSX css= in a single pass.\n const sites: ExpressionSite[] = [];\n const errorMessages: Array<{ message: string; line: number | null }> = [];\n let hasCssPropsCall = false;\n let hasBuildtimeJsxCssAttribute = false;\n // Module-scope names, so injected helpers and imports can avoid collisions\n let usedTopLevelNames = new Set<string>();\n\n traverse(ast, {\n Program(path: NodePath<t.Program>) {\n usedTopLevelNames = new Set(Object.keys(path.scope.bindings));\n },\n // -- Css.*.$ chain collection --\n MemberExpression(path: NodePath<t.MemberExpression>) {\n if (!cssBindingName) return;\n\n const chain = extractDollarChain(path.node, cssBindingName);\n if (!chain) return;\n if (isInsideWhenObjectValue(path, cssBindingName)) {\n return;\n }\n\n const parentPath = path.parentPath;\n if (parentPath && parentPath.isMemberExpression() && t.isIdentifier(parentPath.node.property, { name: \"$\" })) {\n return;\n }\n\n const resolveCssChainReference = buildCssChainReferenceResolver(path, cssBindingName);\n const resolvedChain = resolveFullChain({ mapping, cssBindingName, resolveCssChainReference }, chain);\n sites.push({ path, resolvedChain });\n\n const line = path.node.loc?.start.line ?? null;\n for (const err of resolvedChain.errors) {\n errorMessages.push({ message: err, line });\n }\n },\n // -- Css.props() detection (so we don't bail early when there are no Css.*.$ sites) --\n CallExpression(path: NodePath<t.CallExpression>) {\n if (cssBindingName && isCssMethodCall(path.node, cssBindingName, \"props\")) {\n hasCssPropsCall = true;\n }\n },\n // -- JSX css={...} attribute detection (so we don't bail when there are only css props) --\n JSXAttribute(path: NodePath<t.JSXAttribute>) {\n if (!t.isJSXIdentifier(path.node.name, { name: \"css\" })) return;\n hasBuildtimeJsxCssAttribute = true;\n },\n });\n\n if (sites.length === 0 && !hasCssPropsCall && !hasBuildtimeJsxCssAttribute) return null;\n\n // Step 3: Collect atomic rules for CSS generation\n const chains = sites.map((s) => s.resolvedChain);\n const { rules, needsMaybeInc, needsMaybeCssVar } = collectAtomicRules(chains, mapping);\n const cssText = generateCssText(rules);\n\n // Step 4: Reserve local names for injected helpers\n const runtime = createRuntimeHelpers(ast, usedTopLevelNames);\n const maybeIncHelperName = needsMaybeInc ? reservePreferredName(usedTopLevelNames, \"__maybeInc\") : null;\n const maybeCssVarHelperName = needsMaybeCssVar ? runtime.use(\"maybeCssVar\") : null;\n\n // Collect typography runtime lookups\n const runtimeLookups = collectRuntimeLookups(chains);\n const runtimeLookupNames = new Map<string, string>();\n for (const lookupKey of runtimeLookups.keys()) {\n runtimeLookupNames.set(lookupKey, reservePreferredName(usedTopLevelNames, `__${lookupKey}`));\n }\n\n // Step 5: Rewrite Css sites in-place\n rewriteExpressionSites({\n ast,\n sites,\n cssBindingName,\n filename: basename(filename),\n debug: options.debug ?? false,\n mapping,\n maybeIncHelperName,\n maybeCssVarHelperName,\n runtime,\n runtimeLookupNames,\n });\n\n // Step 6: Prepare runtime imports before removing the Css import.\n const runtimeImports = runtime.imports();\n if (options.injectCss) {\n runtimeImports.push({ importedName: \"__injectTrussCSS\", localName: \"__injectTrussCSS\" });\n }\n\n // Step 7: Remove/replace the Css import and inject runtime imports.\n // When Css comes from a local `new CssBuilder(...)` (tsup bundles), skip import removal.\n let reusedCssImportLine = false;\n if (cssImportBinding) {\n reusedCssImportLine =\n runtimeImports.length > 0 &&\n findImportDeclaration(ast, RUNTIME_MODULE) === null &&\n replaceCssImportWithNamedImports(ast, cssImportBinding, RUNTIME_MODULE, runtimeImports);\n\n if (!reusedCssImportLine) {\n removeCssImport(ast, cssImportBinding);\n }\n }\n\n if (!reusedCssImportLine) {\n upsertNamedImports(ast, RUNTIME_MODULE, runtimeImports);\n }\n\n // Step 8: Insert helper declarations after imports\n const declarationsToInsert: t.Statement[] = [];\n if (maybeIncHelperName) {\n declarationsToInsert.push(buildMaybeIncDeclaration(maybeIncHelperName));\n }\n // Insert runtime lookup tables for typography\n for (const [lookupKey, segmentsByName] of runtimeLookups) {\n const lookupName = runtimeLookupNames.get(lookupKey);\n if (!lookupName) continue;\n declarationsToInsert.push(buildRuntimeLookupDeclaration(lookupName, segmentsByName, mapping));\n }\n\n // Inject __injectTrussCSS call if requested\n if (options.injectCss && cssText.length > 0) {\n declarationsToInsert.push(\n t.expressionStatement(t.callExpression(t.identifier(\"__injectTrussCSS\"), [t.stringLiteral(cssText)])),\n );\n }\n\n // Emit console.error calls for any unsupported patterns\n for (const { message, line } of errorMessages) {\n const location = line !== null ? `${filename}:${line}` : filename;\n const logMessage = `${message} (${location})`;\n declarationsToInsert.push(\n t.expressionStatement(\n t.callExpression(t.memberExpression(t.identifier(\"console\"), t.identifier(\"error\")), [\n t.stringLiteral(logMessage),\n ]),\n ),\n );\n }\n\n insertAfterLeadingImports(ast, declarationsToInsert);\n\n const output = generate(ast, {\n sourceFileName: filename,\n sourceMaps: true,\n retainLines: false,\n });\n\n const outputCode = preserveBlankLineAfterImports(code, output.code);\n\n return { code: outputCode, map: output.map, css: cssText, rules };\n}\n\n/**\n * Track which `@homebound/truss/runtime` helpers the rewrite ends up calling.\n *\n * `use()` reuses an existing import's local name when the module already imports the helper,\n * otherwise reserves a collision-free local name; `imports()` lists the helpers that still\n * need an import statement, in canonical order.\n */\nfunction createRuntimeHelpers(\n ast: t.File,\n usedTopLevelNames: Set<string>,\n): RuntimeHelpers & { imports(): NamedImport[] } {\n const localNames = new Map<RuntimeHelperName, string>();\n const missingImports = new Map<RuntimeHelperName, NamedImport>();\n\n return {\n use(name) {\n let localName = localNames.get(name);\n if (localName === undefined) {\n const existing = findNamedImportBinding(ast, name, RUNTIME_MODULE);\n localName = existing ?? reservePreferredName(usedTopLevelNames, name);\n if (!existing) missingImports.set(name, { importedName: name, localName });\n localNames.set(name, localName);\n }\n return localName;\n },\n imports() {\n return RUNTIME_HELPER_ORDER.flatMap((name) => {\n const entry = missingImports.get(name);\n return entry ? [entry] : [];\n });\n },\n };\n}\n\n/** True when `path` sits inside the object literal of a `Css.…when({ ... })` call, whose values are resolved by the outer chain. */\nfunction isInsideWhenObjectValue(path: NodePath<t.MemberExpression>, cssBindingName: string): boolean {\n let current: NodePath<t.Node> | null = path.parentPath;\n\n while (current) {\n if (current.isObjectExpression()) {\n const parent = current.parentPath;\n if (\n parent?.isCallExpression() &&\n parent.node.arguments[0] === current.node &&\n t.isMemberExpression(parent.node.callee) &&\n !parent.node.callee.computed &&\n t.isIdentifier(parent.node.callee.property, { name: \"when\" }) &&\n extractChain(parent.node.callee.object as t.Expression, cssBindingName)\n ) {\n return true;\n }\n }\n\n current = current.parentPath;\n }\n\n return false;\n}\n\nfunction buildCssChainReferenceResolver(\n path: NodePath<t.MemberExpression>,\n cssBindingName: string,\n): CssChainReferenceResolver {\n return (node) => {\n return resolveCssChainReference(path, node, cssBindingName, new Set<string>());\n };\n}\n\n/**\n * Follow lexical bindings like `const same = Css.blue.$` back to their original\n * `Css.*.$` expression so `when({ \":hover\": same })` can resolve the same as\n * an inline value. This stays in the transform layer because it depends on Babel\n * scope/NodePath lookup, not just chain semantics.\n */\nfunction resolveCssChainReference(\n path: NodePath<t.Node>,\n node: t.Expression,\n cssBindingName: string,\n seen: Set<string>,\n): ReturnType<typeof extractChain> {\n const value = unwrapExpression(node);\n\n if (t.isMemberExpression(value)) {\n return extractDollarChain(value, cssBindingName);\n }\n\n if (!t.isIdentifier(value) || seen.has(value.name)) {\n return null;\n }\n\n const binding = path.scope.getBinding(value.name);\n if (!binding?.constant || !binding.path.isVariableDeclarator()) {\n return null;\n }\n\n const init = binding.path.node.init;\n if (!init || !t.isExpression(init)) {\n return null;\n }\n\n seen.add(value.name);\n return resolveCssChainReference(binding.path, init, cssBindingName, seen);\n}\n\n/** Collect typography runtime lookups from all resolved chains, keyed by lookup name. */\nfunction collectRuntimeLookups(chains: ResolvedChain[]): Map<string, Record<string, ResolvedSegment[]>> {\n const lookups = new Map<string, Record<string, ResolvedSegment[]>>();\n for (const seg of chains.flatMap((chain) => chainSegments(chain))) {\n if (seg.kind === \"typography\" && !lookups.has(seg.lookupKey)) {\n lookups.set(seg.lookupKey, seg.segmentsByName);\n }\n }\n return lookups;\n}\n\n/** Babel's generator drops the blank line after the import block; put it back when the source had one. */\nfunction preserveBlankLineAfterImports(input: string, output: string): string {\n const inputLines = input.split(\"\\n\");\n const outputLines = output.split(\"\\n\");\n const lastInputImportLine = findLastImportLine(inputLines);\n const lastOutputImportLine = findLastImportLine(outputLines);\n\n if (lastInputImportLine === -1 || lastOutputImportLine === -1) {\n return output;\n }\n\n const inputHasBlankLineAfterImports = inputLines[lastInputImportLine + 1]?.trim() === \"\";\n const outputHasBlankLineAfterImports = outputLines[lastOutputImportLine + 1]?.trim() === \"\";\n if (!inputHasBlankLineAfterImports || outputHasBlankLineAfterImports) {\n return output;\n }\n\n outputLines.splice(lastOutputImportLine + 1, 0, \"\");\n return outputLines.join(\"\\n\");\n}\n\nfunction findLastImportLine(lines: string[]): number {\n let lastImportLine = -1;\n for (let index = 0; index < lines.length; index++) {\n if (lines[index].trimStart().startsWith(\"import \")) {\n lastImportLine = index;\n }\n }\n return lastImportLine;\n}\n","import * as t from \"@babel/types\";\nimport { isCssSegment, type ResolvedSegment, type TrussMapping } from \"./types\";\nimport { styleEntriesForSegment, type StyleEntry } from \"./style-entries\";\nimport { variableValueNeedsMaybeCssVar } from \"../css-custom-property\";\nimport { SPACING_CUSTOM_PROPERTY } from \"../spacing-css-var\";\n\n// ── Style hash objects ────────────────────────────────────────────────\n\n/**\n * Build the style hash AST for a list of segments (from one `Css.*.$` expression).\n *\n * I.e. `[blue, h_white]` → `{ color: \"blue h_white\" }`, and `[mt(x)]` →\n * `{ marginTop: [\"mt_var\", { \"--marginTop\": __maybeInc(x) }] }`.\n */\nexport function buildStyleHashProperties(\n segments: ResolvedSegment[],\n mapping: TrussMapping,\n maybeIncHelperName?: string | null,\n maybeCssVarHelperName?: string | null,\n): t.ObjectProperty[] {\n return styleHashProperties(collectStyleEntryGroups(segments, mapping), maybeIncHelperName, maybeCssVarHelperName);\n}\n\n/**\n * Group the style entries of `segments` by CSS property, in order of first appearance.\n *\n * Within a group, a new base-level entry replaces earlier base-level entries while conditional\n * entries accumulate. I.e. `Css.blue.black.$` → the later `black` replaces `blue` for `color`,\n * but `Css.blue.onHover.black.$` keeps both because `onHover.black` is conditional.\n *\n * `seed` supplies the starting entries for a property the first time it appears, i.e. the base\n * `color` entries that an `if(cond).onHover.black` branch must carry alongside its own `h_black`.\n */\nexport function collectStyleEntryGroups(\n segments: ResolvedSegment[],\n mapping: TrussMapping,\n seed?: ReadonlyMap<string, StyleEntry[]>,\n): Map<string, StyleEntry[]> {\n const propGroups = new Map<string, StyleEntry[]>();\n\n for (const seg of segments) {\n if (!isCssSegment(seg)) continue;\n for (const entry of styleEntriesForSegment(seg, mapping)) {\n const entries = propGroups.get(entry.cssProp) ?? seed?.get(entry.cssProp) ?? [];\n const kept = entry.isConditional ? entries : entries.filter((existing) => existing.isConditional);\n propGroups.set(entry.cssProp, [...kept, entry]);\n }\n }\n\n return propGroups;\n}\n\n/**\n * Build style hash properties from grouped entries.\n *\n * Static groups become space-separated class bundles, i.e. `{ color: \"blue h_white\" }`.\n * Groups with a variable entry become tuples, i.e. `{ marginTop: [\"mt_var\", { \"--marginTop\": __maybeInc(x) }] }`.\n */\nexport function styleHashProperties(\n propGroups: ReadonlyMap<string, StyleEntry[]>,\n maybeIncHelperName?: string | null,\n maybeCssVarHelperName?: string | null,\n): t.ObjectProperty[] {\n const properties: t.ObjectProperty[] = [];\n\n for (const [cssProp, entries] of propGroups) {\n const classNames = entries.map((e) => e.className).join(\" \");\n const variableEntries = entries.filter((e) => e.isVariable);\n\n if (variableEntries.length === 0) {\n properties.push(t.objectProperty(toPropertyKey(cssProp), t.stringLiteral(classNames)));\n continue;\n }\n\n const varsProps = variableEntries.map((dyn) => {\n return t.objectProperty(\n t.stringLiteral(dyn.varName!),\n variableValueExpression(dyn, maybeIncHelperName, maybeCssVarHelperName),\n );\n });\n const tuple = t.arrayExpression([t.stringLiteral(classNames), t.objectExpression(varsProps)]);\n properties.push(t.objectProperty(toPropertyKey(cssProp), tuple));\n }\n\n return properties;\n}\n\n/**\n * The runtime value stored in a variable tuple's vars object.\n *\n * I.e. a folded `Tokens.gap` → `\"var(--gap)\"`; `mt(x)` → `maybeCssVar(__maybeInc(x))`; `mtPx(x)` → `` `${x}px` ``.\n */\nfunction variableValueExpression(\n dyn: StyleEntry,\n maybeIncHelperName?: string | null,\n maybeCssVarHelperName?: string | null,\n): t.Expression {\n if (dyn.argResolved !== undefined) {\n return t.stringLiteral(dyn.argResolved);\n }\n\n let valueExpr = dyn.argNode!;\n if (dyn.incremented) {\n // I.e. wrap with `__maybeInc(x)` for increment-based values\n valueExpr = t.callExpression(t.identifier(maybeIncHelperName ?? \"__maybeInc\"), [valueExpr]);\n } else if (dyn.appendPx) {\n // I.e. wrap with `` `${v}px` `` for Px delegate values\n valueExpr = t.templateLiteral(\n [t.templateElement({ raw: \"\", cooked: \"\" }, false), t.templateElement({ raw: \"px\", cooked: \"px\" }, true)],\n [valueExpr],\n );\n }\n if (maybeCssVarHelperName && variableValueNeedsMaybeCssVar(dyn)) {\n valueExpr = t.callExpression(t.identifier(maybeCssVarHelperName), [valueExpr]);\n }\n return valueExpr;\n}\n\n// ── Helper AST declarations ───────────────────────────────────────────\n\n/**\n * Build the per-file increment helper declaration.\n *\n * I.e. `const __maybeInc = (inc) => typeof inc === \"string\" ? inc : \\`calc(var(--t-spacing) * \\${inc})\\`;`\n */\nexport function buildMaybeIncDeclaration(helperName: string): t.VariableDeclaration {\n const incParam = t.identifier(\"inc\");\n const calcPrefix = `calc(var(${SPACING_CUSTOM_PROPERTY}) * `;\n const body = t.blockStatement([\n t.returnStatement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.unaryExpression(\"typeof\", incParam), t.stringLiteral(\"string\")),\n incParam,\n t.templateLiteral(\n [\n t.templateElement({ raw: calcPrefix, cooked: calcPrefix }, false),\n t.templateElement({ raw: \")\", cooked: \")\" }, true),\n ],\n [incParam],\n ),\n ),\n ),\n ]);\n\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(helperName), t.arrowFunctionExpression([incParam], body)),\n ]);\n}\n\n/**\n * Build a runtime lookup table declaration for typography.\n *\n * I.e. `const __typography = { f24: { fontSize: \"f24\", lineHeight: \"lh32\" }, ... };`\n */\nexport function buildRuntimeLookupDeclaration(\n lookupName: string,\n segmentsByName: Record<string, ResolvedSegment[]>,\n mapping: TrussMapping,\n): t.VariableDeclaration {\n const properties = Object.entries(segmentsByName).map(([name, segs]) => {\n return t.objectProperty(t.identifier(name), t.objectExpression(buildStyleHashProperties(segs, mapping)));\n });\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(lookupName), t.objectExpression(properties)),\n ]);\n}\n\n/** I.e. `\"color\"` → `t.identifier(\"color\")`, `\"box-shadow\"` → `t.stringLiteral(\"box-shadow\")`. */\nfunction toPropertyKey(key: string): t.Identifier | t.StringLiteral {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) ? t.identifier(key) : t.stringLiteral(key);\n}\n","import type { NodePath } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { hasCondition, isCssSegment, type CssSegment, type ResolvedSegment, type TrussMapping } from \"./types\";\nimport type { ResolvedChain } from \"./resolve-chain\";\nimport { collectStyleEntryGroups, styleHashProperties } from \"./emit-style-hash\";\nimport { markerClassName, type StyleEntry } from \"./style-entries\";\nimport { generate, traverse } from \"./babel-utils\";\nimport { isCssMethodCall, staticPropertyName } from \"./ast-utils\";\nimport { TRUSS_CUSTOM_CLASS_PREFIX, TRUSS_INLINE_STYLE_PREFIX, TRUSS_MARKER_KEY } from \"../style-metadata\";\n\nexport interface ExpressionSite {\n path: NodePath<t.MemberExpression>;\n resolvedChain: ResolvedChain;\n}\n\n/** The `@homebound/truss/runtime` exports the rewritten code may call. */\nexport type RuntimeHelperName = \"trussProps\" | \"mergeProps\" | \"TrussDebugInfo\" | \"maybeCssVar\";\n\nexport interface RuntimeHelpers {\n /**\n * The local identifier for a runtime export, marking it as used so the import gets added.\n *\n * I.e. `use(\"mergeProps\")` → `\"mergeProps\"`, or `\"mergeProps13\"` when the module already\n * has `import { mergeProps as mergeProps13 } from \"@homebound/truss/runtime\"`.\n */\n use(name: RuntimeHelperName): string;\n}\n\nexport interface RewriteSitesOptions {\n ast: t.File;\n sites: ExpressionSite[];\n /** Null when the file only has JSX `css=` attributes and no `Css` binding. */\n cssBindingName: string | null;\n filename: string;\n debug: boolean;\n mapping: TrussMapping;\n maybeIncHelperName: string | null;\n maybeCssVarHelperName: string | null;\n runtime: RuntimeHelpers;\n runtimeLookupNames: Map<string, string>;\n}\n\ntype StyleHashMember = t.ObjectProperty | t.SpreadElement;\n\n/** Entry groups keyed by CSS property, i.e. `color → [blue, h_white]`. */\ntype StyleEntryGroups = Map<string, StyleEntry[]>;\n\n/**\n * Rewrite collected `Css...$` expression sites into Truss-native style hash objects.\n *\n * In the new model, each site becomes an ObjectExpression keyed by CSS property.\n * JSX `css=` attributes become `trussProps(hash)` or `mergeProps(className, style, hash)` spreads.\n * Non-JSX positions become plain object expressions.\n */\nexport function rewriteExpressionSites(options: RewriteSitesOptions): void {\n for (const site of options.sites) {\n const styleHash = buildStyleHashFromChain(site.resolvedChain, options);\n const cssAttrPath = getCssAttributePath(site.path);\n const line = site.path.node.loc?.start.line ?? null;\n\n if (cssAttrPath) {\n // JSX css= attribute → static className when possible, otherwise spread trussProps/mergeProps\n if (\n !options.debug &&\n isFullyStaticStyleHash(styleHash) &&\n !hasExistingAttribute(cssAttrPath, \"className\") &&\n !hasExistingAttribute(cssAttrPath, \"style\")\n ) {\n const classNames = extractStaticClassNames(styleHash);\n cssAttrPath.replaceWith(t.jsxAttribute(t.jsxIdentifier(\"className\"), t.stringLiteral(classNames)));\n } else {\n cssAttrPath.replaceWith(buildCssSpreadAttribute(cssAttrPath, styleHash, line, options));\n }\n } else {\n // Non-JSX position → plain object expression with optional debug info\n injectDebugInfo(styleHash, line, options);\n site.path.replaceWith(styleHash);\n }\n }\n\n // Single pass: rewrite Css.props(...) calls and remaining css={...} attributes together\n rewriteCssPropsAndCssAttributes(options);\n}\n\n/**\n * Return the enclosing `css={...}` JSX attribute path for a transformed site,\n * or null when the site is in a non-`css` expression context.\n */\nfunction getCssAttributePath(path: NodePath<t.MemberExpression>): NodePath<t.JSXAttribute> | null {\n const parentPath = path.parentPath;\n if (!parentPath || !parentPath.isJSXExpressionContainer()) return null;\n\n const attrPath = parentPath.parentPath;\n if (!attrPath || !attrPath.isJSXAttribute()) return null;\n if (!t.isJSXIdentifier(attrPath.node.name, { name: \"css\" })) return null;\n\n return attrPath;\n}\n\n// ---------------------------------------------------------------------------\n// Building style hash objects from resolved chains\n// ---------------------------------------------------------------------------\n\n/**\n * Build an ObjectExpression from a ResolvedChain, handling conditionals.\n *\n * I.e. `Css.blue.if(cond).onHover.black.$` →\n * `{ color: \"blue\", ...(cond ? { color: \"blue h_black\" } : {}) }`.\n */\nfunction buildStyleHashFromChain(chain: ResolvedChain, options: RewriteSitesOptions): t.ObjectExpression {\n const members: StyleHashMember[] = [];\n // The latest entry group per CSS property from the unconditional parts so far, so a conditional\n // branch can carry the base classes alongside its own conditional-only overlays.\n const previousGroups: StyleEntryGroups = new Map();\n const pendingUnconditionalSegments: ResolvedSegment[] = [];\n\n function flushPendingUnconditionalSegments(): void {\n // I.e. `Css.black.when({ \":hover\": Css.blue.$ }).$` becomes one merged `color: \"black h_blue\"` entry.\n if (pendingUnconditionalSegments.length === 0) {\n return;\n }\n\n const built = buildStyleHashMembers(pendingUnconditionalSegments, options);\n members.push(...built.members);\n for (const [cssProp, entries] of built.groups) {\n previousGroups.set(cssProp, entries);\n }\n pendingUnconditionalSegments.length = 0;\n }\n\n /**\n * Build one `if()` branch.\n *\n * Properties the branch only touches conditionally (i.e. `onHover.black`) start from the base\n * entries, so the spread keeps `blue` alongside `h_black` instead of dropping it. Plain\n * replacements (i.e. an unconditional `black`) get no seed, so the spread overrides the base.\n */\n function buildBranchMembers(segments: ResolvedSegment[]): StyleHashMember[] {\n const conditionalOnly = collectConditionalOnlyProps(segments);\n const seed: StyleEntryGroups = new Map([...previousGroups].filter(([cssProp]) => conditionalOnly.has(cssProp)));\n return buildStyleHashMembers(segments, options, seed).members;\n }\n\n if (chain.markers.length > 0) {\n const markerClasses = chain.markers.map((marker) => markerClassName(marker.markerNode));\n members.push(t.objectProperty(t.identifier(TRUSS_MARKER_KEY), t.stringLiteral(markerClasses.join(\" \"))));\n }\n\n for (const part of chain.parts) {\n if (part.type === \"unconditional\") {\n pendingUnconditionalSegments.push(...part.segments);\n } else {\n flushPendingUnconditionalSegments();\n // Conditional: ...(cond ? { then } : { else })\n const thenMembers = buildBranchMembers(part.thenSegments);\n const elseMembers = buildBranchMembers(part.elseSegments);\n members.push(\n t.spreadElement(\n t.conditionalExpression(part.conditionNode, t.objectExpression(thenMembers), t.objectExpression(elseMembers)),\n ),\n );\n }\n }\n\n flushPendingUnconditionalSegments();\n\n return t.objectExpression(members);\n}\n\n/**\n * Build ObjectExpression members from a list of segments.\n *\n * CSS segments are batched into entry groups and emitted as style hash properties. The other kinds\n * (composed, typography, className, inlineStyle) produce spread members or reserved metadata properties.\n *\n * Returns the members plus the entry groups they were built from, so an enclosing conditional can\n * seed its branches with them.\n */\nfunction buildStyleHashMembers(\n segments: ResolvedSegment[],\n options: RewriteSitesOptions,\n seed?: StyleEntryGroups,\n): { members: StyleHashMember[]; groups: StyleEntryGroups } {\n const members: StyleHashMember[] = [];\n const groups: StyleEntryGroups = new Map();\n const cssSegs: CssSegment[] = [];\n const classNameArgs: t.Expression[] = [];\n const styleKeyCounts = new Map<string, number>();\n\n function flushCssSegs(): void {\n if (cssSegs.length === 0) return;\n const batchGroups = collectStyleEntryGroups(cssSegs, options.mapping, seed);\n members.push(...styleHashProperties(batchGroups, options.maybeIncHelperName, options.maybeCssVarHelperName));\n for (const [cssProp, entries] of batchGroups) {\n groups.set(cssProp, entries);\n }\n cssSegs.length = 0;\n }\n\n for (const seg of segments) {\n switch (seg.kind) {\n case \"error\":\n continue;\n case \"className\":\n // I.e. `Css.className(cls).df.$` becomes `className_cls: cls` in the style hash.\n classNameArgs.push(t.cloneNode(seg.arg, true));\n continue;\n case \"inlineStyle\":\n flushCssSegs();\n members.push(buildMetadataMember(TRUSS_INLINE_STYLE_PREFIX, seg.arg, styleKeyCounts));\n continue;\n case \"composed\":\n flushCssSegs();\n if (seg.skipUndefined && t.isObjectExpression(seg.arg)) {\n members.push(...buildAddCssObjectMembers(seg.arg));\n } else {\n members.push(t.spreadElement(seg.arg));\n }\n continue;\n case \"typography\": {\n flushCssSegs();\n const lookupName = options.runtimeLookupNames.get(seg.lookupKey);\n if (lookupName) {\n // I.e. `{ ...(__typography[key] ?? {}) }`\n const lookupAccess = t.memberExpression(t.identifier(lookupName), seg.argNode, true);\n members.push(t.spreadElement(t.logicalExpression(\"??\", lookupAccess, t.objectExpression([]))));\n }\n continue;\n }\n }\n\n // In debug mode, add the abbreviation name as a marker className for multi-property\n // segments so engineers can see the origin in the DOM. I.e. `Css.bb.$` adds \"bb\"\n // alongside \"bbs_solid bbw_1px\", and `Css.lineClamp(n).$` adds \"lineClamp\".\n if (options.debug) {\n const isMultiProp = seg.kind === \"static\" && Object.keys(seg.defs).length > 1;\n const hasExtraDefs = seg.kind === \"variable\" && !!seg.extraDefs && Object.keys(seg.extraDefs).length > 0;\n if (isMultiProp || hasExtraDefs) {\n classNameArgs.push(t.stringLiteral(seg.abbr));\n }\n }\n\n cssSegs.push(seg);\n }\n\n flushCssSegs();\n if (classNameArgs.length > 0) {\n // Prepend so markers/custom classes appear first in the DOM,\n // I.e. `className=\"bb bbs_solid bbw_1px\"` rather than at the end.\n // Uses unique `className_${key}` keys so spreading preserves all entries.\n const classNameKeyCounts = new Map<string, number>();\n members.unshift(\n ...classNameArgs.map((arg) => buildMetadataMember(TRUSS_CUSTOM_CLASS_PREFIX, arg, classNameKeyCounts)),\n );\n }\n return { members, groups };\n}\n\n/** I.e. `className_my_btn: \"my-btn\"`, with `_2`, `_3` suffixes for repeated keys. */\nfunction buildMetadataMember(prefix: string, arg: t.Expression, counts: Map<string, number>): t.ObjectProperty {\n const baseKey = `${prefix}${sanitizeMetadataKey(arg)}`;\n const count = (counts.get(baseKey) ?? 0) + 1;\n counts.set(baseKey, count);\n const key = count === 1 ? baseKey : `${baseKey}_${count}`;\n return t.objectProperty(t.identifier(key), t.cloneNode(arg, true));\n}\n\n/** Derive a valid JS identifier suffix from metadata args. I.e. `\"my-btn\"` → `my_btn`, `vars` → `vars`. */\nfunction sanitizeMetadataKey(arg: t.Expression): string {\n const raw = t.isStringLiteral(arg)\n ? arg.value\n : t.isTemplateLiteral(arg) && arg.expressions.length === 0 && arg.quasis.length === 1\n ? (arg.quasis[0].value.cooked ?? \"\")\n : generate(arg).code;\n\n const sanitized = raw\n .replace(/[^a-zA-Z0-9_$]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_+|_+$/g, \"\");\n return sanitized || \"value\";\n}\n\n/**\n * Spread an `with({ height, ...rest })` object literal member by member, skipping identifier and\n * member-expression values that are `undefined` at runtime so they do not clobber earlier styles.\n */\nfunction buildAddCssObjectMembers(styleObject: t.ObjectExpression): StyleHashMember[] {\n const members: StyleHashMember[] = [];\n\n for (const property of styleObject.properties) {\n if (t.isSpreadElement(property)) {\n members.push(t.spreadElement(t.cloneNode(property.argument, true)));\n continue;\n }\n\n if (!t.isObjectProperty(property) || property.computed) {\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n continue;\n }\n\n const value = property.value;\n if (t.isIdentifier(value) || t.isMemberExpression(value) || t.isOptionalMemberExpression(value)) {\n // I.e. `...(height === undefined ? {} : { height })`\n members.push(\n t.spreadElement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.cloneNode(value, true), t.identifier(\"undefined\")),\n t.objectExpression([]),\n t.objectExpression([t.objectProperty(clonePropertyKey(property.key), t.cloneNode(value, true))]),\n ),\n ),\n );\n continue;\n }\n\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n }\n\n return members;\n}\n\n/**\n * Collect the set of CSS properties where ALL contributing segments have a condition\n * (pseudo-class, media query, pseudo-element, or when relationship).\n *\n * I.e. `onHover.white` → `color` is conditional-only (needs base merged in),\n * but `bgWhite` → `backgroundColor` is a plain replacement (should NOT merge).\n */\nfunction collectConditionalOnlyProps(segments: ResolvedSegment[]): Set<string> {\n const conditionalOnly = new Map<string, boolean>();\n for (const seg of segments) {\n if (!isCssSegment(seg)) continue;\n const segHasCondition = hasCondition(seg.condition);\n const props = seg.kind === \"variable\" ? seg.props : Object.keys(seg.defs);\n for (const prop of props) {\n // If any segment for this property is unconditional, it's not conditional-only\n conditionalOnly.set(prop, (conditionalOnly.get(prop) ?? true) && segHasCondition);\n }\n }\n return new Set([...conditionalOnly].filter(([, isConditionalOnly]) => isConditionalOnly).map(([prop]) => prop));\n}\n\nfunction propertyName(key: t.Expression | t.Identifier | t.PrivateName): string {\n return staticPropertyName(key) ?? generate(key).code;\n}\n\nfunction clonePropertyKey(key: t.Expression | t.Identifier | t.PrivateName): t.Expression | t.Identifier {\n if (t.isPrivateName(key)) {\n return t.identifier(key.id.name);\n }\n return t.cloneNode(key, true);\n}\n\n// ---------------------------------------------------------------------------\n// Debug info injection\n// ---------------------------------------------------------------------------\n\n/**\n * Inject debug info into the first style property of a style hash ObjectExpression.\n *\n * For static values, promotes `\"df\"` to `[\"df\", new TrussDebugInfo(\"...\")]`.\n * For variable tuples, appends the debug info as a third element.\n * No-op outside debug mode, without a source line, or for non-object hashes.\n */\nfunction injectDebugInfo(\n styleHash: t.Expression,\n line: number | null,\n options: Pick<RewriteSitesOptions, \"debug\" | \"filename\" | \"runtime\">,\n): void {\n if (!options.debug || line === null || !t.isObjectExpression(styleHash)) return;\n\n // Find the first real style property (skip SpreadElements and metadata like __marker / className_*)\n const firstProp = styleHash.properties.find((p): p is t.ObjectProperty => {\n return t.isObjectProperty(p) && !isMetadataKey(propertyName(p.key));\n });\n if (!firstProp) return;\n\n const debugExpr = t.newExpression(t.identifier(options.runtime.use(\"TrussDebugInfo\")), [\n t.stringLiteral(`${options.filename}:${line}`),\n ]);\n\n if (t.isStringLiteral(firstProp.value)) {\n // Static: \"df\" → [\"df\", new TrussDebugInfo(\"...\")]\n firstProp.value = t.arrayExpression([firstProp.value, debugExpr]);\n } else if (t.isArrayExpression(firstProp.value)) {\n // Variable tuple: [\"mt_var\", { vars }] → [\"mt_var\", { vars }, new TrussDebugInfo(\"...\")]\n firstProp.value.elements.push(debugExpr);\n }\n}\n\n/** I.e. `__marker`, `className_foo`, and `style_vars` carry runtime metadata rather than CSS classes. */\nfunction isMetadataKey(name: string): boolean {\n return (\n name === TRUSS_MARKER_KEY ||\n name.startsWith(TRUSS_CUSTOM_CLASS_PREFIX) ||\n name.startsWith(TRUSS_INLINE_STYLE_PREFIX)\n );\n}\n\n// ---------------------------------------------------------------------------\n// JSX css= attribute handling\n// ---------------------------------------------------------------------------\n\n/**\n * Build the spread attribute for a JSX `css=` attribute.\n *\n * I.e. `{...trussProps(hash)}`, or `{...mergeProps(className, style, hash)}` when the element\n * also has `className`/`style` attributes (which are removed and folded in).\n */\nfunction buildCssSpreadAttribute(\n path: NodePath<t.JSXAttribute>,\n styleHash: t.Expression,\n line: number | null,\n options: RewriteSitesOptions,\n): t.JSXSpreadAttribute {\n const existingClassNameExpr = removeExistingAttribute(path, \"className\");\n const existingStyleExpr = removeExistingAttribute(path, \"style\");\n\n injectDebugInfo(styleHash, line, options);\n\n if (!existingClassNameExpr && !existingStyleExpr) {\n return t.jsxSpreadAttribute(t.callExpression(t.identifier(options.runtime.use(\"trussProps\")), [styleHash]));\n }\n\n return t.jsxSpreadAttribute(\n t.callExpression(t.identifier(options.runtime.use(\"mergeProps\")), [\n existingClassNameExpr ?? t.identifier(\"undefined\"),\n existingStyleExpr ?? t.identifier(\"undefined\"),\n styleHash,\n ]),\n );\n}\n\n/** Remove a sibling JSX attribute and return its expression. */\nfunction removeExistingAttribute(path: NodePath<t.JSXAttribute>, attrName: string): t.Expression | null {\n const openingElement = path.parentPath;\n if (!openingElement || !openingElement.isJSXOpeningElement()) return null;\n\n const attrs = openingElement.node.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs[i];\n if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name, { name: attrName })) continue;\n\n let expr: t.Expression | null = null;\n if (t.isStringLiteral(attr.value)) {\n expr = attr.value;\n } else if (t.isJSXExpressionContainer(attr.value) && t.isExpression(attr.value.expression)) {\n expr = attr.value.expression;\n }\n\n attrs.splice(i, 1);\n return expr;\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Combined pass: Css.props(...) rewriting + remaining css={...} attributes\n// ---------------------------------------------------------------------------\n\n/**\n * Single traversal that rewrites both `Css.props(expr)` calls and remaining\n * `css={expr}` JSX attributes, avoiding two separate full-AST passes.\n */\nfunction rewriteCssPropsAndCssAttributes(options: RewriteSitesOptions): void {\n traverse(options.ast, {\n // -- Css.props(expr) → trussProps(expr) or mergeProps(...) --\n CallExpression(path: NodePath<t.CallExpression>) {\n if (!options.cssBindingName || !isCssMethodCall(path.node, options.cssBindingName, \"props\")) return;\n\n const arg = path.node.arguments[0];\n if (!arg || t.isSpreadElement(arg) || !t.isExpression(arg) || path.node.arguments.length !== 1) return;\n\n // Check for a sibling `className` property in the parent object literal\n const classNameExpr = extractSiblingClassName(path);\n if (classNameExpr) {\n path.replaceWith(\n t.callExpression(t.identifier(options.runtime.use(\"mergeProps\")), [\n classNameExpr,\n t.identifier(\"undefined\"),\n arg,\n ]),\n );\n } else {\n path.replaceWith(t.callExpression(t.identifier(options.runtime.use(\"trussProps\")), [arg]));\n }\n },\n // -- Remaining css={expr} JSX attributes → {...trussProps(expr)} spreads --\n // I.e. css={someVariable}, css={{ ...a, ...b }}, css={cond ? a : b}\n JSXAttribute(path: NodePath<t.JSXAttribute>) {\n if (!t.isJSXIdentifier(path.node.name, { name: \"css\" })) return;\n if (isRuntimeStyleCssAttribute(path)) return;\n const value = path.node.value;\n if (!t.isJSXExpressionContainer(value)) return;\n if (!t.isExpression(value.expression)) return;\n\n path.replaceWith(buildCssSpreadAttribute(path, value.expression, path.node.loc?.start.line ?? null, options));\n },\n });\n}\n\n/**\n * If `...Css.props(...)` is spread inside an object literal that has a sibling\n * `className` property, extract and remove that property so the rewrite can\n * merge it via `mergeProps`.\n */\nfunction extractSiblingClassName(callPath: NodePath<t.CallExpression>): t.Expression | null {\n // Walk up: CallExpression → SpreadElement → ObjectExpression\n const spreadPath = callPath.parentPath;\n if (!spreadPath || !spreadPath.isSpreadElement()) return null;\n const objectPath = spreadPath.parentPath;\n if (!objectPath || !objectPath.isObjectExpression()) return null;\n\n const properties = objectPath.node.properties;\n for (let i = 0; i < properties.length; i++) {\n const prop = properties[i];\n if (!t.isObjectProperty(prop)) continue;\n if (staticPropertyName(prop.key) !== \"className\") continue;\n if (!t.isExpression(prop.value)) continue;\n\n const classNameExpr = prop.value;\n properties.splice(i, 1);\n return classNameExpr;\n }\n\n return null;\n}\n\n/** `<RuntimeStyle css={...}>` takes real declarations, not a style hash, so it is left for the runtime. */\nfunction isRuntimeStyleCssAttribute(path: NodePath<t.JSXAttribute>): boolean {\n const openingElementPath = path.parentPath;\n if (!openingElementPath || !openingElementPath.isJSXOpeningElement()) return false;\n return t.isJSXIdentifier(openingElementPath.node.name, { name: \"RuntimeStyle\" });\n}\n\n// ---------------------------------------------------------------------------\n// Static style hash detection\n// ---------------------------------------------------------------------------\n\n/** Check whether a style hash has only static string values (no spreads, no tuples). */\nfunction isFullyStaticStyleHash(hash: t.ObjectExpression): boolean {\n return hash.properties.every((prop) => t.isObjectProperty(prop) && t.isStringLiteral(prop.value));\n}\n\n/** Extract all static class names from a fully-static style hash, joined with spaces. */\nfunction extractStaticClassNames(hash: t.ObjectExpression): string {\n const classNames: string[] = [];\n for (const prop of hash.properties) {\n if (t.isObjectProperty(prop) && t.isStringLiteral(prop.value)) {\n classNames.push(prop.value.value);\n }\n }\n return classNames.join(\" \");\n}\n\n/** Check whether a sibling JSX attribute exists without removing it. */\nfunction hasExistingAttribute(path: NodePath<t.JSXAttribute>, attrName: string): boolean {\n const openingElement = path.parentPath;\n if (!openingElement || !openingElement.isJSXOpeningElement()) return false;\n return openingElement.node.attributes.some((attr) => {\n return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name, { name: attrName });\n });\n}\n","/** Metadata key that carries a marker class through Truss style hashes. */\nexport const TRUSS_MARKER_KEY = \"__marker\";\n\n/** Prefix for style-hash entries that append raw class names at runtime. */\nexport const TRUSS_CUSTOM_CLASS_PREFIX = \"className_\";\n\n/** Prefix for style-hash entries that append raw inline styles at runtime. */\nexport const TRUSS_INLINE_STYLE_PREFIX = \"style_\";\n\n/** Generated Css expressions include this brand marker in runtime-only paths. */\nexport const TRUSS_CSS_MARKER_KEY = \"$css\";\n","import { readFileSync } from \"fs\";\nimport { atRulePrelude, compareRuleSortKeys, ruleSortKey } from \"../css-order\";\nimport { annotateArbitraryCssBlock, parseTrussCss } from \"../truss-css\";\nimport type { ParsedArbitraryCssBlock, ParsedCssRule, ParsedPropertyDeclaration, ParsedTrussCss } from \"../truss-css\";\n\nexport { annotateArbitraryCssBlock, parseTrussCss } from \"../truss-css\";\nexport type { ParsedArbitraryCssBlock, ParsedCssRule, ParsedPropertyDeclaration, ParsedTrussCss } from \"../truss-css\";\n\n/**\n * Read and parse an annotated truss.css file from disk.\n *\n * Throws if the file doesn't exist or can't be read.\n */\nexport function readTrussCss(filePath: string): ParsedTrussCss {\n const content = readFileSync(filePath, \"utf8\");\n return parseTrussCss(content);\n}\n\n/**\n * Merge multiple parsed truss CSS sources into a single CSS string.\n *\n * Rules are deduplicated by class name (first occurrence wins, since\n * deterministic output means identical class names produce identical rules),\n * then sorted with the same comparator emit-css uses: priority, then media-query width, then class name.\n * @property declarations are deduplicated by variable name and appended next.\n * Arbitrary CSS blocks are left opaque and appended in source order at the end.\n */\nexport function mergeTrussCss(sources: ParsedTrussCss[]): string {\n const seenClasses = new Set<string>();\n const allRules: ParsedCssRule[] = [];\n const seenProperties = new Set<string>();\n const allProperties: ParsedPropertyDeclaration[] = [];\n const allArbitraryCssBlocks: ParsedArbitraryCssBlock[] = [];\n\n for (const source of sources) {\n for (const rule of source.rules) {\n if (!seenClasses.has(rule.className)) {\n seenClasses.add(rule.className);\n allRules.push(rule);\n }\n }\n for (const prop of source.properties) {\n if (!seenProperties.has(prop.varName)) {\n seenProperties.add(prop.varName);\n allProperties.push(prop);\n }\n }\n allArbitraryCssBlocks.push(...source.arbitraryCssBlocks);\n }\n\n // Sort exactly as emit-css does, so a merged stylesheet keeps the per-file cascade order\n const decorated = allRules.map((rule) => {\n return { rule, key: ruleSortKey(rule.priority, rule.className, atRulePrelude(rule.cssText)) };\n });\n decorated.sort((a, b) => compareRuleSortKeys(a.key, b.key));\n\n const lines: string[] = [];\n\n for (const entry of decorated) {\n lines.push(`/* @truss p:${entry.rule.priority} c:${entry.rule.className} */`);\n lines.push(entry.rule.cssText);\n }\n\n for (const prop of allProperties) {\n lines.push(`/* @truss @property */`);\n lines.push(prop.cssText);\n }\n\n for (const block of allArbitraryCssBlocks) {\n lines.push(annotateArbitraryCssBlock(block.cssText));\n }\n\n return lines.join(\"\\n\");\n}\n","/** A parsed CSS rule extracted from an annotated truss.css file. */\nexport interface ParsedCssRule {\n priority: number;\n className: string;\n cssText: string;\n}\n\n/** A parsed @property declaration extracted from an annotated truss.css file. */\nexport interface ParsedPropertyDeclaration {\n cssText: string;\n /** The variable name, i.e. `--marginTop`. */\n varName: string;\n}\n\n/** A parsed arbitrary CSS block extracted from an annotated truss.css file. */\nexport interface ParsedArbitraryCssBlock {\n cssText: string;\n}\n\n/** The result of parsing an annotated truss.css file. */\nexport interface ParsedTrussCss {\n rules: ParsedCssRule[];\n properties: ParsedPropertyDeclaration[];\n arbitraryCssBlocks: ParsedArbitraryCssBlock[];\n}\n\n/** Regex matching `/* @truss p:<priority> c:<className> *\\/` annotations. */\nconst RULE_ANNOTATION_RE = /^\\/\\* @truss p:([\\d.]+) c:(\\S+) \\*\\/$/;\n\n/** Regex matching `/* @truss @property *\\/` annotations. */\nconst PROPERTY_ANNOTATION_RE = /^\\/\\* @truss @property \\*\\/$/;\n\n/** Regex matching the start of an annotated arbitrary CSS block. */\nconst ARBITRARY_START_RE = /^\\/\\* @truss arbitrary:start \\*\\/$/;\n\n/** Regex matching the end of an annotated arbitrary CSS block. */\nconst ARBITRARY_END_RE = /^\\/\\* @truss arbitrary:end \\*\\/$/;\n\n/** Regex to extract the variable name from `@property --foo { ... }`. */\nconst PROPERTY_VAR_RE = /^@property\\s+(--\\S+)/;\n\n/**\n * Parse an annotated truss.css file into rules, @property declarations,\n * and arbitrary CSS blocks.\n *\n * The file must contain `/* @truss p:<priority> c:<className> *\\/` comments\n * before each CSS rule, and `/* @truss @property *\\/` before each @property declaration.\n * Unannotated lines are ignored.\n */\nexport function parseTrussCss(cssText: string): ParsedTrussCss {\n const lines = cssText.split(\"\\n\");\n const rules: ParsedCssRule[] = [];\n const properties: ParsedPropertyDeclaration[] = [];\n const arbitraryCssBlocks: ParsedArbitraryCssBlock[] = [];\n\n let i = 0;\n\n /** Advance past the current annotation line and any blank lines to the annotated content line. */\n function takeAnnotatedLine(): string | null {\n i++;\n while (i < lines.length && lines[i].trim() === \"\") i++;\n return i < lines.length ? lines[i].trim() : null;\n }\n\n while (i < lines.length) {\n const line = lines[i].trim();\n\n // Check for rule annotation\n const ruleMatch = RULE_ANNOTATION_RE.exec(line);\n if (ruleMatch) {\n const cssText = takeAnnotatedLine();\n if (cssText !== null) {\n rules.push({ priority: parseFloat(ruleMatch[1]), className: ruleMatch[2], cssText });\n }\n i++;\n continue;\n }\n\n // Check for @property annotation\n if (PROPERTY_ANNOTATION_RE.test(line)) {\n const propLine = takeAnnotatedLine();\n const varMatch = propLine === null ? null : PROPERTY_VAR_RE.exec(propLine);\n if (propLine !== null && varMatch) {\n properties.push({ cssText: propLine, varName: varMatch[1] });\n }\n i++;\n continue;\n }\n\n if (ARBITRARY_START_RE.test(line)) {\n i++;\n const blockLines: string[] = [];\n while (i < lines.length && !ARBITRARY_END_RE.test(lines[i].trim())) {\n blockLines.push(lines[i]);\n i++;\n }\n const blockText = blockLines.join(\"\\n\").trim();\n if (blockText.length > 0) {\n arbitraryCssBlocks.push({ cssText: blockText });\n }\n if (i < lines.length && ARBITRARY_END_RE.test(lines[i].trim())) {\n i++;\n }\n continue;\n }\n\n i++;\n }\n\n return { rules, properties, arbitraryCssBlocks };\n}\n\n/** Wrap an arbitrary CSS block in annotations so it survives later Truss merges. */\nexport function annotateArbitraryCssBlock(cssText: string): string {\n const trimmed = cssText.trim();\n if (trimmed.length === 0) {\n return \"\";\n }\n return [\"/* @truss arbitrary:start */\", trimmed, \"/* @truss arbitrary:end */\"].join(\"\\n\");\n}\n","import { readFileSync, writeFileSync, mkdirSync } from \"fs\";\nimport { resolve, join } from \"path\";\nimport { createTrussTransformSession } from \"./transform-session\";\n\nexport interface TrussEsbuildPluginOptions {\n /** Path to the Css.json mapping file (relative to cwd or absolute). */\n mapping: string;\n /** Output path for the generated truss.css (relative to outDir or absolute). Defaults to `truss.css`. */\n outputCss?: string;\n}\n\n/**\n * esbuild plugin that transforms `Css.*.$` expressions, collects `.css.ts` blocks,\n * and emits a `truss.css` file.\n *\n * Designed for library builds using tsup/esbuild. Transforms source files\n * during the build and writes an annotated `truss.css` alongside the output\n * that consuming applications can merge via the Vite plugin's `libraries` option.\n *\n * Usage with tsup:\n * ```ts\n * import { trussEsbuildPlugin } from \"@homebound/truss/plugin\";\n *\n * export default defineConfig({\n * esbuildPlugins: [trussEsbuildPlugin({ mapping: \"./src/Css.json\" })],\n * });\n * ```\n */\nexport function trussEsbuildPlugin(opts: TrussEsbuildPluginOptions) {\n const session = createTrussTransformSession({\n mappingPath() {\n return resolve(process.cwd(), opts.mapping);\n },\n projectRoot() {\n return process.cwd();\n },\n });\n\n return {\n name: \"truss\",\n setup(build: EsbuildPluginBuild) {\n const outDir = build.initialOptions.outdir ?? join(process.cwd(), \"dist\");\n\n build.onLoad({ filter: /\\.[cm]?[jt]sx?$/ }, (args: { path: string }) => {\n const code = readFileSync(args.path, \"utf8\");\n\n if (args.path.endsWith(\".css.ts\")) {\n session.updateArbitraryCssRegistry(args.path, code);\n return { contents: code, loader: loaderForPath(args.path) };\n }\n\n if (!code.includes(\"Css\") && !code.includes(\"css=\")) return undefined;\n\n const result = session.transformCode(code, args.path);\n if (!result) return undefined;\n\n return { contents: result.code, loader: loaderForPath(args.path) };\n });\n\n build.onEnd(() => {\n if (!session.hasCss()) return;\n\n const css = session.collectCss();\n if (css.length === 0) return;\n const cssPath = resolve(outDir, opts.outputCss ?? \"truss.css\");\n\n mkdirSync(resolve(cssPath, \"..\"), { recursive: true });\n writeFileSync(cssPath, css, \"utf8\");\n });\n },\n };\n}\n\n/** Map file extension to esbuild loader type. */\nfunction loaderForPath(filePath: string): string {\n if (filePath.endsWith(\".tsx\")) return \"tsx\";\n if (filePath.endsWith(\".ts\")) return \"ts\";\n if (filePath.endsWith(\".jsx\")) return \"jsx\";\n return \"js\";\n}\n\n/**\n * Minimal esbuild plugin types so we don't need esbuild as a dependency.\n *\n * These match the subset of the esbuild Plugin API that we use.\n */\ninterface EsbuildPluginBuild {\n initialOptions: { outdir?: string };\n onLoad(\n options: { filter: RegExp },\n callback: (args: { path: string }) => { contents: string; loader: string } | undefined,\n ): void;\n onEnd(callback: () => void): void;\n}\n"],"mappings":";AAAA,SAAS,gBAAAA,eAAc,iBAAAC,gBAAe,cAAAC,aAAY,mBAAmB;AACrE,SAAS,WAAAC,UAAS,WAAAC,UAAS,YAAY,QAAAC,aAAY;AACnD,SAAS,kBAAkB;;;ACF3B,SAAS,kBAAkB;AAC3B,SAAS,SAAS,eAAe;AACjC,YAAYC,QAAO;;;ACFnB,YAAY,OAAO;AAgBZ,SAAS,qBAAqB,MAAmB,WAAmB,WAA4B;AACrG,MAAI,CAAC,KAAK,IAAI,SAAS,GAAG;AACxB,SAAK,IAAI,SAAS;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,CAAC,KAAK,IAAI,SAAS,GAAG;AACr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G;AACvC,YAAI,CAAC,MAAM,SAAS,OAAO,EAAG;AAC9B,cAAM,WAAWA,MAAK,QAAQ,KAAK;AACnC,cAAM,OAAOD,cAAa,UAAU,MAAM;AAC1C,YAAI,KAAK,SAAS,qBAAqB,GAAG;AACxC,UAAAE,eAAc,UAAU,KAAK,QAAQ,uBAAuB,IAAI,kBAAkB,EAAE,GAAG,MAAM;AAAA,QAC/F;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAEA,SAAS,kBAAkB,QAAgB,UAA8B,aAAyC;AAChH,MAAI,WAAW,MAAM,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,MAAI,UAAU;AACZ,WAAOL,SAAQM,SAAQ,QAAQ,GAAG,MAAM;AAAA,EAC1C;AAEA,SAAON,SAAQ,eAAe,QAAQ,IAAI,GAAG,MAAM;AACrD;AAGA,SAAS,kBAAkB,IAAoB;AAC7C,QAAM,aAAa,GAAG,QAAQ,GAAG;AACjC,QAAM,YAAY,GAAG,QAAQ,GAAG;AAEhC,MAAI,MAAM,GAAG;AACb,MAAI,cAAc,EAAG,OAAM,KAAK,IAAI,KAAK,UAAU;AACnD,MAAI,aAAa,EAAG,OAAM,KAAK,IAAI,KAAK,SAAS;AAEjD,QAAM,UAAU,GAAG,MAAM,GAAG,GAAG;AAE/B,MAAI,QAAQ,WAAW,OAAO,GAAG;AAC/B,WAAO,QAAQ,MAAM,CAAC;AAAA,EACxB;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,UAA2B;AACpD,SAAO,SAAS,QAAQ,OAAO,GAAG,EAAE,SAAS,gBAAgB;AAC/D;","names":["readFileSync","writeFileSync","existsSync","resolve","dirname","join","t","resolve","t","t","t","t","t","t","t","t","atRulePrelude","t","t","t","t","t","resolveCssChainReference","seen","readFileSync","cssText","readFileSync","resolve","mapping","t","readFileSync","resolve","resolve","readFileSync","resolve","existsSync","sourcePath","readFileSync","join","writeFileSync","dirname"]}
1
+ {"version":3,"sources":["../../src/plugin/index.ts","../../src/plugin/rewrite-css-ts-imports.ts","../../src/plugin/ast-utils.ts","../../src/plugin/babel-utils.ts","../../src/plugin/transform-session.ts","../../src/plugin/resolve-chain.ts","../../src/plugin/mapping-utils.ts","../../src/plugin/chain-nodes.ts","../../src/plugin/condition-context.ts","../../src/plugin/resolve-entry.ts","../../src/plugin/resolve-calls.ts","../../src/plugin/types.ts","../../src/plugin/resolve-literals.ts","../../src/css-custom-property.ts","../../src/spacing-css-var.ts","../../src/plugin/resolve-setvar.ts","../../src/plugin/container-query.ts","../../src/plugin/style-entries.ts","../../src/plugin/css-property-abbreviations.ts","../../src/plugin/when-relationships.ts","../../src/pseudo-selectors.ts","../../src/plugin/resolve-typography.ts","../../src/plugin/resolve-when.ts","../../src/media-query.ts","../../src/css-order.ts","../../src/plugin/property-priorities.ts","../../src/plugin/priority.ts","../../src/plugin/truss-css.ts","../../src/plugin/emit-css.ts","../../src/plugin/transform-css.ts","../../src/plugin/css-ts-utils.ts","../../src/plugin/transform.ts","../../src/plugin/test-css.ts","../../src/plugin/emit-style-hash.ts","../../src/plugin/rewrite-sites.ts","../../src/style-metadata.ts","../../src/plugin/merge-css.ts","../../src/plugin/esbuild-plugin.ts"],"sourcesContent":["import { readFileSync, writeFileSync, existsSync, readdirSync } from \"fs\";\nimport { resolve, dirname, isAbsolute, join } from \"path\";\nimport { createHash } from \"crypto\";\nimport { rewriteCssTsImports } from \"./rewrite-css-ts-imports\";\nimport { createTrussTransformSession } from \"./transform-session\";\nimport { splitArbitraryCss } from \"./test-css\";\nimport { rootSpacingPreludeCss } from \"../spacing-css-var\";\nimport { generate, parseModule, traverse } from \"./babel-utils\";\nimport { findNamedImportBinding, reservePreferredName, upsertNamedImports } from \"./ast-utils\";\nimport * as t from \"@babel/types\";\n\nexport interface TrussPluginOptions {\n /** Path to the Css.json mapping file used for transforming files (relative to project root or absolute). */\n mapping: string;\n /** Paths to pre-compiled truss.css files from libraries to merge into the app's CSS. */\n libraries?: string[];\n}\n\n// Intentionally loose Vite types so we don't depend on the `vite` package at compile time.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface TrussVitePlugin {\n name: string;\n enforce?: \"pre\" | \"post\";\n configResolved?: (config: any) => void;\n buildStart?: () => void;\n resolveId?: (source: string, importer: string | undefined) => string | null;\n load?: (id: string) => string | null;\n transform?: (code: string, id: string) => { code: string; map: any } | null;\n configureServer?: (server: any) => void;\n transformIndexHtml?: (html: string) => string;\n handleHotUpdate?: (ctx: any) => void;\n generateBundle?: (options: any, bundle: any) => void;\n writeBundle?: (options: any, bundle: any) => void;\n}\n\n/** Prefix for virtual CSS module IDs generated from .css.ts files. */\nconst VIRTUAL_CSS_PREFIX = \"\\0truss-css:\";\nconst VIRTUAL_TEST_CSS_PREFIX = \"\\0truss-test-css:\";\nconst CSS_TS_QUERY = \"?truss-css\";\nconst RUNTIME_MODULE = \"@homebound/truss/runtime\";\nconst INJECT_CSS_HELPER = \"__injectTrussCSS\";\n\n/** Placeholder injected into HTML during build; replaced with the hashed CSS filename in generateBundle. */\nconst TRUSS_CSS_PLACEHOLDER = \"__TRUSS_CSS_HASH__\";\n\n/** Virtual module IDs for dev HMR. */\nconst VIRTUAL_CSS_ENDPOINT = \"/virtual:truss.css\";\nconst VIRTUAL_RUNTIME_ID = \"virtual:truss:runtime\";\nconst RESOLVED_VIRTUAL_RUNTIME_ID = \"\\0\" + VIRTUAL_RUNTIME_ID;\n// Test-only bootstrap that injects merged library CSS and the spacing prelude\n// as a virtual module side effect instead of an HTTP\n// fetch. In dev, the browser reaches /virtual:truss.css via transformIndexHtml\n// -> virtual:truss:runtime -> fetch(\"/virtual:truss.css\") -> configureServer.\n// Vitest/jsdom does not boot from index.html or run that browser fetch/HMR path;\n// it imports modules directly into the test environment, so CSS has to enter via\n// a module side effect instead.\nconst VIRTUAL_TEST_CSS_ID = \"virtual:truss:test-css\";\nconst RESOLVED_VIRTUAL_TEST_CSS_ID = \"\\0\" + VIRTUAL_TEST_CSS_ID;\n\n/**\n * Vite plugin that transforms `Css.*.$` expressions from truss's CssBuilder DSL\n * into Truss-native style hash objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Also supports `.css.ts` files: a `.css.ts` file with\n * `export const css = { \".selector\": Css.blue.$ }` can keep other runtime exports,\n * while imports are supplemented with a virtual CSS side-effect module.\n *\n * In dev mode, serves CSS via a virtual endpoint that the injected runtime keeps in sync.\n * In production, emits a content-hashed CSS asset (e.g. `assets/truss-abc123.css`) for long-term caching.\n */\nexport function trussPlugin(opts: TrussPluginOptions): TrussVitePlugin {\n let projectRoot: string;\n let debug = false;\n let isTest = false;\n let isBuild = false;\n const libraryPaths = opts.libraries ?? [];\n /** The hashed CSS filename emitted during generateBundle, used by writeBundle to patch HTML. */\n let emittedCssFileName: string | null = null;\n\n let cssVersion = 0;\n let lastSentVersion = 0;\n\n function mappingPath(): string {\n return resolve(projectRoot || process.cwd(), opts.mapping);\n }\n\n const session = createTrussTransformSession({\n mappingPath,\n projectRoot: () => projectRoot || process.cwd(),\n libraries: libraryPaths,\n onCssChanged() {\n cssVersion++;\n },\n });\n\n return {\n name: \"truss\",\n enforce: \"pre\",\n\n configResolved(config: any) {\n projectRoot = config.root;\n debug = config.command === \"serve\" || config.mode === \"development\" || config.mode === \"test\";\n isTest = config.mode === \"test\";\n isBuild = config.command === \"build\";\n },\n\n buildStart() {\n session.ensureMapping();\n // Reset registries and library cache at start of each build\n session.reset();\n cssVersion = 0;\n lastSentVersion = 0;\n },\n\n // -- Dev mode HMR --\n\n configureServer(server: any) {\n // Skip dev-server setup in test mode — Vitest doesn't start a real HTTP\n // server, so the interval would keep the process alive.\n if (isTest) return;\n\n // Serve the current collected CSS at the virtual endpoint\n server.middlewares.use((req: any, res: any, next: any) => {\n if (req.url !== VIRTUAL_CSS_ENDPOINT) return next();\n const css = session.collectCss();\n res.setHeader(\"Content-Type\", \"text/css\");\n res.setHeader(\"Cache-Control\", \"no-store\");\n res.end(css);\n });\n\n // Poll for CSS version changes and push HMR updates\n const interval = setInterval(() => {\n if (cssVersion !== lastSentVersion && server.ws) {\n lastSentVersion = cssVersion;\n server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n }, 150);\n\n // Clean up interval when server closes\n server.httpServer?.on(\"close\", () => {\n clearInterval(interval);\n });\n },\n\n transformIndexHtml(html: string) {\n if (isBuild) {\n // Strip any existing truss CSS references so the hook is idempotent when\n // a tool (e.g. Storybook) runs multiple Vite builds with the same plugin.\n // I.e. removes /virtual:truss.css, __TRUSS_CSS_HASH__, and /assets/truss-<hash>.css\n const stripped = html\n .replace(/\\s*<link[^>]*href=[\"'][^\"']*virtual:truss\\.css[\"'][^>]*\\/?>/g, \"\")\n .replace(/\\s*<link[^>]*href=[\"'][^\"']*__TRUSS_CSS_HASH__[\"'][^>]*\\/?>/g, \"\")\n .replace(/\\s*<link[^>]*href=[\"'][^\"']*\\/assets\\/truss-[0-9a-f]+\\.css[\"'][^>]*\\/?>/g, \"\");\n // Inject a stylesheet link with a placeholder; writeBundle replaces it\n // with the content-hashed filename for long-term caching.\n const link = `<link rel=\"stylesheet\" href=\"${TRUSS_CSS_PLACEHOLDER}\">`;\n return stripped.replace(\"</head>\", ` ${link}\\n </head>`);\n }\n // Inject the virtual runtime script for dev mode; it owns style updates.\n const tag = `<script type=\"module\" src=\"/${VIRTUAL_RUNTIME_ID}\"></script>`;\n return html.replace(\"</head>\", ` ${tag}\\n </head>`);\n },\n\n handleHotUpdate(ctx: any) {\n // Send CSS update event on any file change for safety\n if (ctx.server?.ws) {\n ctx.server.ws.send({ type: \"custom\", event: \"truss:css-update\" });\n }\n },\n\n // -- Virtual module resolution --\n\n resolveId(source: string, importer: string | undefined) {\n // Handle the dev HMR runtime virtual module\n if (source === VIRTUAL_RUNTIME_ID || source === \"/\" + VIRTUAL_RUNTIME_ID) {\n return RESOLVED_VIRTUAL_RUNTIME_ID;\n }\n if (source === VIRTUAL_TEST_CSS_ID || source === \"/\" + VIRTUAL_TEST_CSS_ID) {\n return RESOLVED_VIRTUAL_TEST_CSS_ID;\n }\n\n // Handle .css.ts virtual modules\n if (!source.endsWith(CSS_TS_QUERY)) return null;\n\n const absolutePath = resolveImportPath(source.slice(0, -CSS_TS_QUERY.length), importer, projectRoot);\n\n // Only handle it if the .css.ts file actually exists\n if (!existsSync(absolutePath)) return null;\n\n // Compile test side effects without evaluating build-only CssBuilder expressions.\n if (isTest) return VIRTUAL_TEST_CSS_PREFIX + absolutePath;\n\n // Return a virtual CSS module ID that maps back to the source .css.ts file.\n // Strip the trailing `.ts` so the ID ends in `.css` — this tells Vite to\n // route the loaded content through its CSS pipeline.\n return VIRTUAL_CSS_PREFIX + absolutePath.slice(0, -3);\n },\n\n load(id: string) {\n // Serve the dev HMR runtime script\n if (id === RESOLVED_VIRTUAL_RUNTIME_ID) {\n return `\n// Truss dev HMR runtime — keeps styles up to date without page reload\n(() => {\n let style = document.getElementById(\"__truss_virtual__\");\n if (!style) {\n style = document.createElement(\"style\");\n style.id = \"__truss_virtual__\";\n document.head.appendChild(style);\n }\n\n function fetchCss() {\n fetch(\"${VIRTUAL_CSS_ENDPOINT}\")\n .then((r) => r.text())\n .then((css) => { style.textContent = css; })\n .catch(() => {});\n }\n\n fetchCss();\n\n if (import.meta.hot) {\n import.meta.hot.on(\"truss:css-update\", fetchCss);\n import.meta.hot.on(\"vite:afterUpdate\", () => {\n setTimeout(fetchCss, 50);\n });\n }\n})();\n`;\n }\n if (id === RESOLVED_VIRTUAL_TEST_CSS_ID) {\n // Vitest/jsdom has no dev server stylesheet fetch, so inject libraries\n // once; application modules deliver CSS when they evaluate.\n const payload = {\n ...session.collectTestCss(),\n source: \"libraries\",\n order: 0,\n prelude: rootSpacingPreludeCss(session.ensureMapping().increment),\n };\n return `\nimport { __injectTrussCSS } from \"@homebound/truss/runtime\";\n\n__injectTrussCSS(${JSON.stringify(payload)});\n`;\n }\n\n if (id.startsWith(VIRTUAL_TEST_CSS_PREFIX)) {\n const sourcePath = canonicalSourcePath(id.slice(VIRTUAL_TEST_CSS_PREFIX.length));\n session.updateArbitraryCssRegistry(sourcePath, readFileSync(sourcePath, \"utf8\"));\n const payload = {\n arbitraryRules: splitArbitraryCss(session.getArbitraryCss(sourcePath)),\n source: sourcePath,\n };\n return `\nimport \"${VIRTUAL_TEST_CSS_ID}\";\nimport { __injectTrussCSS } from \"@homebound/truss/runtime\";\n\n__injectTrussCSS(${JSON.stringify(payload)});\n`;\n }\n\n // Handle .css.ts virtual modules\n if (!id.startsWith(VIRTUAL_CSS_PREFIX)) return null;\n\n // Re-add `.ts` to recover the original source file path\n const sourcePath = id.slice(VIRTUAL_CSS_PREFIX.length) + \".ts\";\n const sourceCode = readFileSync(sourcePath, \"utf8\");\n\n // Populate the arbitrary CSS registry on first load; subsequent updates\n // happen in the transform hook when Vite re-transforms the changed file.\n session.updateArbitraryCssRegistry(sourcePath, sourceCode);\n\n // Return an empty stylesheet to Vite's CSS pipeline — the real CSS is now\n // served via collectCss() (dev: /virtual:truss.css, build: truss-<hash>.css)\n // so we avoid duplicating it in Vite's own CSS bundle.\n return `/* [truss] ${sourcePath} — included via truss.css */`;\n },\n\n transform(code: string, id: string) {\n // The virtual test module already contains compiled CSS, not source TypeScript.\n if (id.startsWith(VIRTUAL_TEST_CSS_PREFIX)) return null;\n // Only process JS/TS/JSX/TSX files outside node_modules\n if (!/\\.[cm]?[jt]sx?(\\?|$)/.test(id)) return null;\n const fileId = stripQueryAndHash(id);\n if (isNodeModulesFile(fileId)) return null;\n\n const rewrittenImports = rewriteCssTsImports(code, id);\n\n // In tests, we do not boot through index.html and the dev runtime fetch path\n // (`virtual:truss:runtime` -> fetch(\"/virtual:truss.css\")), so we inject the\n // library CSS and spacing through a virtual module side effect instead.\n //\n // We add `import \"virtual:truss:test-css\"` to each eligible transformed module,\n // but ESM module caching should evaluate that virtual module only once per test\n // module graph. Transformed files may still emit per-file `__injectTrussCSS`\n // calls; atomic classes are deduped in the runtime helper.\n const shouldBootstrapTestCss = isTest;\n const transformedCode = shouldBootstrapTestCss\n ? `${rewrittenImports.code}\\nimport \"${VIRTUAL_TEST_CSS_ID}\";`\n : rewrittenImports.code;\n // The result to return when only the import rewrites changed the module\n const importsOnlyResult =\n rewrittenImports.changed || shouldBootstrapTestCss ? { code: transformedCode, map: null } : null;\n\n if (fileId.endsWith(\".css.ts\")) {\n // Keep `.css.ts` modules as normal TS so named exports like class-name\n // constants still work at runtime. Tests also inject their CSS at evaluation.\n //\n // Also update the arbitrary CSS registry so HMR picks up changes —\n // the load hook only runs on first resolve, so edits need to refresh\n // the registry here where Vite re-transforms changed files.\n session.updateArbitraryCssRegistry(fileId, code);\n if (isTest) {\n const css = session.getArbitraryCss(fileId);\n return { code: appendTestCssInjection(transformedCode, fileId, css), map: null };\n }\n return importsOnlyResult;\n }\n\n // Some non-`.css.ts` modules only need the import rewrite and do not have\n // any `Css.*.$` expressions for the main Truss transform to process.\n const hasCssDsl = rewrittenImports.code.includes(\"Css\") || rewrittenImports.code.includes(\"css=\");\n if (!hasCssDsl) return importsOnlyResult;\n\n // For regular JS/TS modules that still use the DSL, run the full Truss\n // transform after the import rewrite so both behaviors compose.\n const result = session.transformCode(transformedCode, fileId, { debug, injectCss: isTest });\n return result ? { code: result.code, map: result.map } : importsOnlyResult;\n },\n\n // -- Production CSS emission --\n\n generateBundle(_options: any, _bundle: any) {\n if (!isBuild) return;\n const css = session.collectCss();\n if (!css) return;\n\n // Compute a content hash so the filename is cache-bustable.\n const hash = createHash(\"sha256\").update(css).digest(\"hex\").slice(0, 8);\n const fileName = `assets/truss-${hash}.css`;\n emittedCssFileName = fileName;\n\n (this as any).emitFile({\n type: \"asset\",\n fileName,\n source: css,\n });\n },\n\n /** Patch HTML files on disk to replace the CSS placeholder with the hashed filename. */\n writeBundle(options: any, _bundle: any) {\n if (!emittedCssFileName) return;\n const outDir = options.dir || join(projectRoot, \"dist\");\n // Find and patch all HTML files in the output directory\n for (const entry of readdirSync(outDir)) {\n if (!entry.endsWith(\".html\")) continue;\n const htmlPath = join(outDir, entry);\n const html = readFileSync(htmlPath, \"utf8\");\n if (html.includes(TRUSS_CSS_PLACEHOLDER)) {\n writeFileSync(htmlPath, html.replace(TRUSS_CSS_PLACEHOLDER, `/${emittedCssFileName}`), \"utf8\");\n }\n }\n },\n };\n}\n\nfunction resolveImportPath(source: string, importer: string | undefined, projectRoot: string | undefined): string {\n if (isAbsolute(source)) {\n return source;\n }\n\n if (importer) {\n return resolve(dirname(importer), source);\n }\n\n return resolve(projectRoot || process.cwd(), source);\n}\n\n/** Strip Vite query/hash suffixes from an id. */\nfunction stripQueryAndHash(id: string): string {\n const queryIndex = id.indexOf(\"?\");\n const hashIndex = id.indexOf(\"#\");\n\n let end = id.length;\n if (queryIndex >= 0) end = Math.min(end, queryIndex);\n if (hashIndex >= 0) end = Math.min(end, hashIndex);\n\n const cleanId = id.slice(0, end);\n // Vite can prefix absolute paths with `/@fs/`.\n if (cleanId.startsWith(\"/@fs/\")) {\n return cleanId.slice(4);\n }\n return cleanId;\n}\n\nfunction isNodeModulesFile(filePath: string): boolean {\n return filePath.replace(/\\\\/g, \"/\").includes(\"/node_modules/\");\n}\n\n/** Absolute, forward-slashed path, matching the arbitrary CSS registry keys on every platform. */\nfunction canonicalSourcePath(filePath: string): string {\n return resolve(filePath).replace(/\\\\/g, \"/\");\n}\n\n/**\n * Append an `__injectTrussCSS` call so a `.css.ts` module delivers its compiled CSS when it\n * evaluates in tests, including through dynamic imports the import rewrite cannot see.\n *\n * Reuses an existing runtime import of the helper, otherwise reserves a collision-free local\n * name the same way the main transform does, so `export const __injectTrussCSS` in the module\n * still works.\n */\nfunction appendTestCssInjection(code: string, fileId: string, css: string): string {\n const ast = parseModule(code, fileId);\n // Module-scope names, so the injected import can avoid collisions\n let usedTopLevelNames = new Set<string>();\n traverse(ast, {\n Program(path) {\n usedTopLevelNames = new Set(Object.keys(path.scope.bindings));\n path.stop();\n },\n });\n const existing = findNamedImportBinding(ast, INJECT_CSS_HELPER, RUNTIME_MODULE);\n const localName = existing ?? reservePreferredName(usedTopLevelNames, INJECT_CSS_HELPER);\n if (!existing) upsertNamedImports(ast, RUNTIME_MODULE, [{ importedName: INJECT_CSS_HELPER, localName }]);\n ast.program.body.push(\n t.expressionStatement(\n t.callExpression(t.identifier(localName), [\n t.valueToNode({ arbitraryRules: splitArbitraryCss(css), source: canonicalSourcePath(fileId) }),\n ]),\n ),\n );\n return generate(ast, { sourceFileName: fileId }).code;\n}\n\nexport type { TrussMapping, TrussMappingEntry } from \"./types\";\nexport { loadMapping } from \"./mapping-utils\";\nexport { trussEsbuildPlugin, type TrussEsbuildPluginOptions } from \"./esbuild-plugin\";\n","import { existsSync } from \"fs\";\nimport { dirname, resolve } from \"path\";\nimport * as t from \"@babel/types\";\nimport { findLastImportIndex } from \"./ast-utils\";\nimport { generate, parseModule } from \"./babel-utils\";\n\nexport interface RewriteCssTsImportsResult {\n code: string;\n changed: boolean;\n}\n\n/**\n * Rewrite `.css.ts` (and bare `.css`) imports so runtime imports stay pointed at the\n * real module, while a separate `?truss-css` side-effect import is added for generated CSS.\n *\n * I.e. `import { foo } from \"./App.css.ts\"` becomes:\n * - `import { foo } from \"./App.css.ts\"`\n * - `import \"./App.css.ts?truss-css\"`\n *\n * Bare `.css` imports (i.e. `from \"./App.css\"`) are handled when a corresponding `.css.ts`\n * file exists on disk — the specifier is normalized to `.css.ts` for the virtual CSS\n * side-effect import so the resolveId/load pipeline can find the source file.\n *\n * Pure side-effect imports are rewritten directly to the virtual CSS import.\n */\nexport function rewriteCssTsImports(code: string, filename: string): RewriteCssTsImportsResult {\n if (!code.includes(\".css\")) {\n return { code, changed: false };\n }\n\n const importerDir = dirname(filename);\n\n const ast = parseModule(code, filename);\n\n const existingCssSideEffects = new Set<string>();\n const neededCssSideEffects = new Set<string>();\n let changed = false;\n\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n if (typeof node.source.value !== \"string\") continue;\n if (!isCssTsImport(node.source.value, importerDir)) continue;\n\n if (node.specifiers.length === 0) {\n node.source = t.stringLiteral(toVirtualCssSpecifier(node.source.value));\n existingCssSideEffects.add(node.source.value);\n changed = true;\n continue;\n }\n\n neededCssSideEffects.add(toVirtualCssSpecifier(node.source.value));\n }\n\n const sideEffectImports: t.ImportDeclaration[] = [];\n for (const source of neededCssSideEffects) {\n if (existingCssSideEffects.has(source)) continue;\n sideEffectImports.push(t.importDeclaration([], t.stringLiteral(source)));\n changed = true;\n }\n\n if (!changed) {\n return { code, changed: false };\n }\n\n if (sideEffectImports.length > 0) {\n const insertIndex = findLastImportIndex(ast) + 1;\n ast.program.body.splice(insertIndex, 0, ...sideEffectImports);\n }\n\n const output = generate(ast, {\n sourceFileName: filename,\n retainLines: false,\n });\n return { code: output.code, changed: true };\n}\n\n/** Check if this import targets a `.css.ts` file (explicitly or via a bare `.css` with a `.css.ts` on disk). */\nfunction isCssTsImport(specifier: string, importerDir: string): boolean {\n if (specifier.endsWith(\".css.ts\")) return true;\n // I.e. `from \"./App.css\"` or `from \"src/App.css\"` — only rewrite if a `.css.ts` file exists\n if (specifier.endsWith(\".css\")) {\n return existsSync(resolve(importerDir, `${specifier}.ts`));\n }\n return false;\n}\n\n/** Normalize to `.css.ts` so resolveId can find the source file on disk. */\nfunction toVirtualCssSpecifier(source: string): string {\n const normalized = source.endsWith(\".css.ts\") ? source : `${source}.ts`;\n return `${normalized}?truss-css`;\n}\n","import * as t from \"@babel/types\";\nimport type { ChainNode } from \"./chain-nodes\";\n\nexport interface NamedImport {\n importedName: string;\n localName: string;\n}\n\n/**\n * Reserve a stable, collision-free identifier.\n *\n * Preference order:\n * 1) preferred\n * 2) secondary (if provided)\n * 3) numbered suffixes based on secondary/preferred\n */\nexport function reservePreferredName(used: Set<string>, preferred: string, secondary?: string): string {\n if (!used.has(preferred)) {\n used.add(preferred);\n return preferred;\n }\n\n if (secondary && !used.has(secondary)) {\n used.add(secondary);\n return secondary;\n }\n\n const base = secondary ?? preferred;\n let i = 1;\n // Numbered fallback keeps generated names deterministic across runs.\n let candidate = `${base}_${i}`;\n while (used.has(candidate)) {\n i++;\n candidate = `${base}_${i}`;\n }\n used.add(candidate);\n return candidate;\n}\n\n/** Find the local binding name for `Css` from import declarations. */\nexport function findCssImportBinding(ast: t.File): string | null {\n return findNamedImportBinding(ast, \"Css\");\n}\n\n/**\n * Find a local binding where `Css` is created via `new CssBuilder(...)`.\n *\n * This handles tsup-bundled libraries where Css is not imported but declared as:\n * var Css = new CssBuilder({ ... });\n */\nexport function findCssBuilderBinding(ast: t.File): string | null {\n for (const node of ast.program.body) {\n if (!t.isVariableDeclaration(node)) continue;\n for (const decl of node.declarations) {\n if (\n t.isIdentifier(decl.id) &&\n decl.init &&\n t.isNewExpression(decl.init) &&\n t.isIdentifier(decl.init.callee, { name: \"CssBuilder\" })\n ) {\n return decl.id.name;\n }\n }\n }\n return null;\n}\n\n/** True for a `binding.method(...)` call, i.e. `Css.props(...)` when `binding` is `\"Css\"` and `method` is `\"props\"`. */\nexport function isCssMethodCall(node: t.CallExpression, binding: string, method: string): boolean {\n return (\n t.isMemberExpression(node.callee) &&\n !node.callee.computed &&\n t.isIdentifier(node.callee.object, { name: binding }) &&\n t.isIdentifier(node.callee.property, { name: method })\n );\n}\n\n/**\n * Remove the Css import specifier. If it was the only specifier, remove the whole import.\n *\n * When only type specifiers remain, the declaration is marked type-only so the bundler\n * erases it. I.e. `import { Css, type Properties } from \"~/Css\"` becomes\n * `import type { Properties } from \"~/Css\"`, because verbatimModuleSyntax keeps a\n * `import { type Properties }` declaration as a side-effect import of the Css module.\n */\nexport function removeCssImport(ast: t.File, cssBinding: string): void {\n for (let i = 0; i < ast.program.body.length; i++) {\n const node = ast.program.body[i];\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex((s) => t.isImportSpecifier(s) && s.local.name === cssBinding);\n if (cssSpecIndex === -1) continue;\n\n if (node.specifiers.length === 1) {\n ast.program.body.splice(i, 1);\n } else {\n node.specifiers.splice(cssSpecIndex, 1);\n hoistTypeOnlyImportKind(node);\n }\n return;\n }\n}\n\n/** Return the index of the last import declaration in the module. */\nexport function findLastImportIndex(ast: t.File): number {\n let lastImportIndex = -1;\n for (let i = 0; i < ast.program.body.length; i++) {\n if (t.isImportDeclaration(ast.program.body[i])) {\n lastImportIndex = i;\n }\n }\n return lastImportIndex;\n}\n\n/**\n * Insert statements directly after the module's leading block of imports.\n *\n * I.e. before the first non-import statement, so helpers land near the top even when a\n * later import (like the test-mode `import \"virtual:truss:test-css\"`) trails the module body.\n */\nexport function insertAfterLeadingImports(ast: t.File, statements: t.Statement[]): void {\n if (statements.length === 0) return;\n const firstNonImport = ast.program.body.findIndex((node) => !t.isImportDeclaration(node));\n ast.program.body.splice(firstNonImport === -1 ? ast.program.body.length : firstNonImport, 0, ...statements);\n}\n\n/**\n * Find the local name of a named value import, i.e. `mergeProps13` for `import { mergeProps as mergeProps13 }`.\n *\n * When `source` is given, only imports from that module are considered.\n */\nexport function findNamedImportBinding(ast: t.File, importedName: string, source?: string): string | null {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node) || node.importKind === \"type\") continue;\n if (source !== undefined && node.source.value !== source) continue;\n for (const spec of node.specifiers) {\n if (\n t.isImportSpecifier(spec) &&\n spec.importKind !== \"type\" &&\n t.isIdentifier(spec.imported, { name: importedName })\n ) {\n return spec.local.name;\n }\n }\n }\n return null;\n}\n\n/** Find the import declaration for `source`, if the module has one. */\nexport function findImportDeclaration(ast: t.File, source: string): t.ImportDeclaration | null {\n for (const node of ast.program.body) {\n if (t.isImportDeclaration(node) && node.source.value === source) {\n return node;\n }\n }\n return null;\n}\n\n/**\n * Repoint an import that only binds `Css` at `source` with `imports`, so the runtime import\n * lands on the line the Css import occupied. Returns false when no such sole-specifier import exists.\n */\nexport function replaceCssImportWithNamedImports(\n ast: t.File,\n cssBinding: string,\n source: string,\n imports: NamedImport[],\n): boolean {\n for (const node of ast.program.body) {\n if (!t.isImportDeclaration(node)) continue;\n\n const cssSpecIndex = node.specifiers.findIndex((spec) => {\n return t.isImportSpecifier(spec) && spec.local.name === cssBinding;\n });\n if (cssSpecIndex === -1 || node.specifiers.length !== 1) continue;\n\n node.source = t.stringLiteral(source);\n node.specifiers = imports.map(toImportSpecifier);\n return true;\n }\n\n return false;\n}\n\n/**\n * Add named value imports to a compatible declaration, or add a new import after the last one.\n * Type-only declarations are erased, and namespace imports cannot contain named specifiers.\n */\nexport function upsertNamedImports(ast: t.File, source: string, imports: NamedImport[]): void {\n if (imports.length === 0) return;\n\n const existing = ast.program.body.find(\n (node): node is t.ImportDeclaration =>\n t.isImportDeclaration(node) &&\n node.source.value === source &&\n node.importKind !== \"type\" &&\n !node.specifiers.some((spec) => t.isImportNamespaceSpecifier(spec)),\n );\n if (!existing) {\n const importDecl = t.importDeclaration(imports.map(toImportSpecifier), t.stringLiteral(source));\n ast.program.body.splice(findLastImportIndex(ast) + 1, 0, importDecl);\n return;\n }\n\n for (const entry of imports) {\n const exists = existing.specifiers.some((spec) => {\n return (\n t.isImportSpecifier(spec) &&\n spec.importKind !== \"type\" &&\n t.isIdentifier(spec.imported, { name: entry.importedName })\n );\n });\n if (!exists) existing.specifiers.push(toImportSpecifier(entry));\n }\n}\n\n/**\n * Extract a `Css` method/property chain from an expression.\n *\n * Example: `Css.if(cond).df.else.db.$` ->\n * `[{type:\"if\"}, {type:\"getter\", name:\"df\"}, {type:\"else\"}, {type:\"getter\", name:\"db\"}]`\n *\n * Returns `null` when the expression is not rooted at the Css import binding,\n * which lets the caller ignore unrelated member expressions cheaply.\n */\nexport function extractChain(node: t.Expression, cssBinding: string): ChainNode[] | null {\n const chain: ChainNode[] = [];\n let current: t.Expression = node;\n\n while (true) {\n if (t.isIdentifier(current, { name: cssBinding })) {\n chain.reverse();\n return chain;\n }\n\n if (t.isMemberExpression(current) && !current.computed && t.isIdentifier(current.property)) {\n const name = current.property.name;\n if (name === \"else\") {\n chain.push({ type: \"else\" });\n } else {\n chain.push({ type: \"getter\", name });\n }\n current = current.object as t.Expression;\n continue;\n }\n\n if (\n t.isCallExpression(current) &&\n t.isMemberExpression(current.callee) &&\n !current.callee.computed &&\n t.isIdentifier(current.callee.property)\n ) {\n const name = current.callee.property.name;\n\n if (name === \"if\") {\n chain.push({\n type: \"if\",\n conditionNode: current.arguments[0] as t.Expression,\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n chain.push({\n type: \"call\",\n name,\n args: current.arguments as (t.Expression | t.SpreadElement)[],\n });\n current = current.callee.object as t.Expression;\n continue;\n }\n\n return null;\n }\n}\n\n/**\n * Extract the chain of a complete `Css.*.$` expression.\n *\n * Returns `null` when `node` does not end in `.$` or is not rooted at `cssBinding`.\n */\nexport function extractDollarChain(node: t.Node, cssBinding: string): ChainNode[] | null {\n if (!t.isMemberExpression(node) || node.computed || !t.isIdentifier(node.property, { name: \"$\" })) return null;\n if (t.isSuper(node.object)) return null;\n return extractChain(node.object, cssBinding);\n}\n\n/** Strip parentheses and TypeScript-only wrappers, i.e. `(x as Foo)!` → `x`. */\nexport function unwrapExpression(node: t.Expression): t.Expression {\n let current = node;\n while (\n t.isParenthesizedExpression(current) ||\n t.isTSAsExpression(current) ||\n t.isTSTypeAssertion(current) ||\n t.isTSNonNullExpression(current) ||\n t.isTSSatisfiesExpression(current)\n ) {\n current = current.expression;\n }\n return current;\n}\n\n/** The static name of an object key, i.e. `foo` and `\"foo\"` → `\"foo\"`; null for computed or other keys. */\nexport function staticPropertyName(key: t.Node): string | null {\n if (t.isIdentifier(key)) return key.name;\n if (t.isStringLiteral(key)) return key.value;\n return null;\n}\n\n/** The static member name of `obj.foo` or `obj[\"foo\"]` → `\"foo\"`; null for other member access. */\nexport function memberPropertyName(node: t.MemberExpression): string | null {\n if (!node.computed && t.isIdentifier(node.property)) return node.property.name;\n if (node.computed && t.isStringLiteral(node.property)) return node.property.value;\n return null;\n}\n\n/**\n * Mark a declaration type-only when every remaining specifier is type-only.\n *\n * I.e. `import { type Properties } from \"~/Css\"` becomes `import type { Properties } from \"~/Css\"`.\n * The per-specifier `type` markers are cleared, since `import type { type Properties }` is invalid.\n */\nfunction hoistTypeOnlyImportKind(node: t.ImportDeclaration): void {\n if (node.importKind === \"type\") return;\n const typeOnly = node.specifiers.every((spec) => t.isImportSpecifier(spec) && spec.importKind === \"type\");\n if (!typeOnly) return;\n node.importKind = \"type\";\n for (const spec of node.specifiers) {\n if (t.isImportSpecifier(spec)) spec.importKind = null;\n }\n}\n\nfunction toImportSpecifier(entry: NamedImport): t.ImportSpecifier {\n return t.importSpecifier(t.identifier(entry.localName), t.identifier(entry.importedName));\n}\n","import generate from \"@babel/generator\";\nimport { parse } from \"@babel/parser\";\nimport traverse from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\n\nexport { generate, traverse };\n\n/** Parse a TypeScript/JSX module with the plugin's standard parser options. */\nexport function parseModule(code: string, filename: string): t.File {\n return parse(code, {\n sourceType: \"module\",\n plugins: [\"typescript\", \"jsx\"],\n sourceFilename: filename,\n }) as t.File;\n}\n","import { resolve } from \"path\";\nimport { generateCssData, type AtomicRule } from \"./emit-css\";\nimport { transformCssTs } from \"./transform-css\";\nimport { transformTruss, type TransformResult, type TransformTrussOptions } from \"./transform\";\nimport { mergeTrussCssData, readTrussCss } from \"./merge-css\";\nimport type { ParsedTrussCss } from \"../truss-css\";\nimport { serializeTrussCss } from \"./truss-css\";\nimport { createTestCssPayload } from \"./test-css\";\nimport type { TestCssPayload } from \"../test-css\";\nimport { loadMapping } from \"./mapping-utils\";\nimport type { TrussMapping } from \"./types\";\nimport { rootSpacingPreludeCss } from \"../spacing-css-var\";\nimport { compareClassNames } from \"../css-order\";\n\nexport interface TrussTransformSessionOptions {\n mappingPath: () => string;\n projectRoot: () => string;\n libraries?: string[];\n onCssChanged?: () => void;\n}\n\n/** Shared transform state for plugin adapters that collect Truss CSS. */\nexport function createTrussTransformSession(options: TrussTransformSessionOptions): TrussTransformSession {\n let mapping: TrussMapping | null = null;\n let libraryCache: ParsedTrussCss[] | null = null;\n const cssRegistry = new Map<string, AtomicRule>();\n const arbitraryCssRegistry = new Map<string, string>();\n const libraryPaths = options.libraries ?? [];\n\n function ensureMapping(): TrussMapping {\n if (!mapping) {\n mapping = loadMapping(options.mappingPath());\n }\n return mapping;\n }\n\n function loadLibraries(): ParsedTrussCss[] {\n if (!libraryCache) {\n libraryCache = libraryPaths.map((libPath) => {\n const resolved = resolve(options.projectRoot(), libPath);\n return readTrussCss(resolved);\n });\n }\n return libraryCache;\n }\n\n function reset(): void {\n cssRegistry.clear();\n arbitraryCssRegistry.clear();\n libraryCache = null;\n }\n\n function updateArbitraryCssRegistry(sourcePath: string, sourceCode: string): void {\n sourcePath = resolve(sourcePath).replace(/\\\\/g, \"/\");\n const css = transformCssTs(sourceCode, sourcePath, ensureMapping()).trim();\n if (css.length > 0) {\n const prev = arbitraryCssRegistry.get(sourcePath);\n arbitraryCssRegistry.set(sourcePath, css);\n if (prev !== css) options.onCssChanged?.();\n return;\n }\n\n if (arbitraryCssRegistry.delete(sourcePath)) {\n options.onCssChanged?.();\n }\n }\n\n function transformCode(\n code: string,\n fileId: string,\n transformOptions: TransformTrussOptions = {},\n ): TransformResult | null {\n const result = transformTruss(code, fileId, ensureMapping(), transformOptions);\n if (!result) return null;\n\n let hasNewRules = false;\n for (const [className, rule] of result.rules) {\n if (!cssRegistry.has(className)) {\n cssRegistry.set(className, rule);\n hasNewRules = true;\n }\n }\n if (hasNewRules) {\n options.onCssChanged?.();\n }\n\n return result;\n }\n\n function collectCss(): string {\n const mapping = ensureMapping();\n const appCss = generateCssData(cssRegistry);\n const allArbitrary = Array.from(arbitraryCssRegistry.entries())\n .sort((a, b) => compareClassNames(a[0], b[0]))\n .map((entry) => entry[1])\n .join(\"\\n\\n\");\n if (allArbitrary.length > 0) appCss.arbitraryCssBlocks.push({ cssText: allArbitrary });\n const libs = loadLibraries();\n const body = serializeTrussCss(libs.length === 0 ? appCss : mergeTrussCssData([...libs, appCss]));\n if (body.length === 0) return \"\";\n return `${rootSpacingPreludeCss(mapping.increment)}\\n${body}`;\n }\n\n function hasCss(): boolean {\n return cssRegistry.size > 0 || arbitraryCssRegistry.size > 0 || libraryPaths.length > 0;\n }\n\n /** Collect only libraries; application modules deliver their own CSS in tests. */\n function collectTestCss(): TestCssPayload {\n return createTestCssPayload(mergeTrussCssData(loadLibraries()));\n }\n\n /** Read the transformed arbitrary CSS for one canonical source file. */\n function getArbitraryCss(sourcePath: string): string {\n return arbitraryCssRegistry.get(resolve(sourcePath).replace(/\\\\/g, \"/\")) ?? \"\";\n }\n\n return {\n collectCss,\n collectTestCss,\n getArbitraryCss,\n ensureMapping,\n hasCss,\n reset,\n transformCode,\n updateArbitraryCssRegistry,\n };\n}\n\nexport interface TrussTransformSession {\n collectCss: () => string;\n collectTestCss: () => TestCssPayload;\n getArbitraryCss: (sourcePath: string) => string;\n ensureMapping: () => TrussMapping;\n hasCss: () => boolean;\n reset: () => void;\n transformCode: (code: string, fileId: string, options?: TransformTrussOptions) => TransformResult | null;\n updateArbitraryCssRegistry: (sourcePath: string, sourceCode: string) => void;\n}\n","import * as t from \"@babel/types\";\nimport type { MarkerSegment, ResolvedConditionContext, ResolvedSegment, TrussMapping } from \"./types\";\nimport { breakpointMediaQuery } from \"./mapping-utils\";\nimport { extractDollarChain, unwrapExpression } from \"./ast-utils\";\nimport { type CallChainNode, type ChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext, emptyConditionContext, resetConditionContext } from \"./condition-context\";\nimport { errorSegment, requireEntry, resolveEntry } from \"./resolve-entry\";\nimport { resolveCallNode } from \"./resolve-calls\";\nimport { resolveWhenCall } from \"./resolve-when\";\nimport { containerQueryFromCall } from \"./container-query\";\nimport { invertMediaQuery } from \"../media-query\";\nimport { isTrussPseudoMethod, trussPseudoSelector } from \"../pseudo-selectors\";\n\n/**\n * Optional hook for resolving identifier references like `const same = Css.blue.$`\n * back into a `ChainNode[]`, so the core chain resolver can stay decoupled from\n * Babel scope/AST traversal concerns.\n */\nexport type CssChainReferenceResolver = (node: t.Expression) => ChainNode[] | null;\n\nexport interface ResolveChainCtx {\n /** The Truss mapping that defines abbreviations, breakpoints, and typography resolution. */\n mapping: TrussMapping;\n /** The local identifier bound to the generated `Css` export, if one exists in this file. */\n cssBindingName?: string;\n /** Optional lexical binding resolver for `const same = Css.blue.$` style references. */\n resolveCssChainReference?: CssChainReferenceResolver;\n}\n\n/**\n * A resolved chain that may contain conditional (if/else) sections.\n *\n * I.e. `ChainNode` is just the raw AST chain from `Css` to `.$`, which may contain if/else nodes;\n * this `ResolvedChain` is the post-processed result where each if/else has been split into separate segments.\n *\n * The `parts` array contains unconditional segments and conditional groups.\n * The `markers` array contains marker directives (Css.marker.$, Css.markerOf(\"x\").$).\n */\nexport interface ResolvedChain {\n parts: ResolvedChainPart[];\n /** Marker directives to attach to the element (not CSS styles). */\n markers: MarkerSegment[];\n /** Error messages from unsupported patterns found in this chain. */\n errors: string[];\n}\n\nexport type ResolvedChainPart =\n | { type: \"unconditional\"; segments: ResolvedSegment[] }\n | {\n type: \"conditional\";\n conditionNode: t.Expression;\n thenSegments: ResolvedSegment[];\n elseSegments: ResolvedSegment[];\n };\n\n/** Every segment in a chain part, i.e. both branches of a conditional part. */\nexport function partSegments(part: ResolvedChainPart): ResolvedSegment[] {\n return part.type === \"unconditional\" ? part.segments : [...part.thenSegments, ...part.elseSegments];\n}\n\n/** Every segment in a resolved chain, across all parts and branches. */\nexport function chainSegments(chain: ResolvedChain): ResolvedSegment[] {\n return chain.parts.flatMap((part) => partSegments(part));\n}\n\n/**\n * Resolve a whole `Css.*.$` chain in one left-to-right pass, splitting at if/else into parts.\n *\n * One live condition context is advanced by every modifier node as it is encountered, and each\n * style node is resolved under the context at that moment. `initialContext` seeds that context,\n * i.e. the selector of an enclosing `when({ \":hover\": ... })` value.\n *\n * ## Chain semantics\n *\n * A `Css.*.$` chain is read left-to-right. Each segment is either a style\n * abbreviation (getter or call) or a modifier that changes the context for\n * subsequent styles. The modifiers and their precedence:\n *\n * - **`if(bool)`** / **`else`** — Boolean conditional. Splits the chain into\n * then/else branches at the AST level. Subsequent styles go into the active\n * branch. A new `if` starts a new conditional.\n *\n * - **`if(mediaQuery)`** — String overload. Sets the media query context\n * (same as `ifSm`, `ifMd` etc.) for subsequent styles. Does NOT create\n * a boolean branch.\n *\n * - **`ifSm`**, **`ifMd`**, **`ifLg`**, etc. — Breakpoint getters. Set the\n * media query context. Stacks with pseudo-classes: `ifSm.onHover.blue.$`\n * applies both conditions.\n *\n * - **`onHover`**, **`onFocus`**, etc. — Pseudo-class getters. Set the\n * pseudo-class context. Stacks with media queries (see above). A new\n * pseudo-class replaces the previous one.\n *\n * - **`element(\"::placeholder\")`** — Pseudo-element. Sets the pseudo-element\n * context for subsequent styles.\n *\n * - **`when(\":hover\")` / `when('[data-state=\"open\"]')`** — Same-element selector.\n * Behaves like a custom selector context and stacks with media queries.\n *\n * - **`when({ \":hover\": Css.blue.$ })`** — Object form. Each value is resolved\n * like an inline `Css.*.$` chain using the selector key as its initial\n * selector context, while inheriting the current media/when context.\n *\n * - **`when(marker, \"ancestor\", \":hover\")`** — Relationship selector. Sets the\n * relationship selector context and stacks with same-element pseudos, pseudo-elements,\n * and media queries.\n *\n * - **`ifContainer({ gt, lt })`** — Container query. Sets the media query\n * context to an `@container` query string.\n *\n * - **`end`** — Closes the active boolean or media `if`/`else` group and resets\n * the media query, pseudo-class, pseudo-element, and `when(...)`\n * relationship-selector context so subsequent styles are unconditional.\n *\n * Contexts accumulate left-to-right until explicitly replaced within the same\n * axis or cleared with `end`. A media query set by `ifSm` persists through\n * `onHover` and `when(...)`.\n * A boolean `if(bool)` nests the chain but inherits the currently-active\n * modifier axes into both branches.\n */\nexport function resolveFullChain(\n ctx: ResolveChainCtx,\n chain: ChainNode[],\n initialContext: ResolvedConditionContext = emptyConditionContext(),\n): ResolvedChain {\n const { mapping } = ctx;\n const markerScan = scanMarkerNodes(chain);\n const nodes = markerScan.chain;\n const markers = [...markerScan.markers];\n const errors = [...markerScan.errors];\n const parts: ResolvedChainPart[] = [];\n const context = cloneConditionContext(initialContext);\n // The open unconditional part; closed before each conditional or when({ ... }) part\n let current: ResolvedSegment[] = [];\n\n function closeCurrentPart(): void {\n if (current.length > 0) {\n parts.push({ type: \"unconditional\", segments: current });\n current = [];\n }\n }\n\n let i = 0;\n while (i < nodes.length) {\n const node = nodes[i];\n\n const mediaQuery = mediaQueryOfNode(node, mapping);\n if (mediaQuery !== null) {\n const elseIndex = findElseIndex(nodes, i + 1);\n if (elseIndex === -1) {\n // I.e. `ifSm.black` or `if(\"@media ...\").black`: a media context for the nodes that follow.\n context.mediaQuery = mediaQuery;\n i++;\n continue;\n }\n\n // I.e. `ifSm.black.else.white[.end]`: the else branch gets the inverted media query.\n const branchEnd = findEndIndex(nodes, elseIndex + 1);\n const thenContext = cloneConditionContext(context);\n thenContext.mediaQuery = mediaQuery;\n const elseContext = cloneConditionContext(context);\n elseContext.mediaQuery = invertMediaQuery(mediaQuery);\n current.push(\n ...resolveSegments(ctx, nodes.slice(i + 1, elseIndex), thenContext),\n ...resolveSegments(ctx, nodes.slice(elseIndex + 1, branchEnd), elseContext),\n );\n if (branchEnd === nodes.length) {\n break;\n }\n resetConditionContext(context);\n i = branchEnd + 1;\n continue;\n }\n\n if (isWhenObjectCall(node)) {\n closeCurrentPart();\n const resolved = resolveWhenObjectSelectors(ctx, node, context);\n parts.push(...resolved.parts);\n markers.push(...resolved.markers);\n errors.push(...resolved.errors);\n i++;\n continue;\n }\n\n if (node.type === \"if\") {\n // Boolean conditional; the string-literal `if(mediaQuery)` overload was handled above.\n closeCurrentPart();\n // Both branches inherit the context as of the `if`, even when the group's `end` resets it below\n const branchContext = cloneConditionContext(context);\n\n // Collect \"then\" nodes until \"else\" or end\n const thenNodes: ChainNode[] = [];\n const elseNodes: ChainNode[] = [];\n i++;\n let inElse = false;\n while (i < nodes.length) {\n const branchNode = nodes[i];\n if (branchNode.type === \"getter\" && branchNode.name === \"end\") {\n resetConditionContext(context);\n i++;\n break;\n }\n if (branchNode.type === \"else\") {\n inElse = true;\n i++;\n continue;\n }\n if (branchNode.type === \"if\") {\n // Nested if — break out and let the outer loop handle it\n break;\n }\n if (inElse) {\n elseNodes.push(branchNode);\n } else {\n thenNodes.push(branchNode);\n }\n i++;\n }\n parts.push({\n type: \"conditional\",\n conditionNode: node.conditionNode,\n thenSegments: resolveSegments(ctx, thenNodes, cloneConditionContext(branchContext)),\n elseSegments: resolveSegments(ctx, elseNodes, cloneConditionContext(branchContext)),\n });\n continue;\n }\n\n current.push(...resolveNode(ctx, node, context));\n i++;\n }\n\n closeCurrentPart();\n\n const segmentErrors = parts\n .flatMap((part) => partSegments(part))\n .flatMap((seg) => (seg.kind === \"error\" ? [seg.message] : []));\n return { parts, markers, errors: [...new Set([...errors, ...segmentErrors])] };\n}\n\n/**\n * Resolve a run of nodes under one live `context`, which each modifier node advances in place.\n *\n * I.e. the body of an `if()` branch. Does NOT split at if/else — use resolveFullChain for that.\n */\nfunction resolveSegments(\n ctx: ResolveChainCtx,\n nodes: ChainNode[],\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n return nodes.flatMap((node) => resolveNode(ctx, node, context));\n}\n\n/**\n * Resolve one chain node under `context`.\n *\n * Modifiers (`ifSm`, `onHover`, `end`, ...) advance `context` and yield no segments; abbreviations and\n * built-in calls yield their segments; an unsupported pattern yields one error segment in their place.\n */\nfunction resolveNode(ctx: ResolveChainCtx, node: ChainNode, context: ResolvedConditionContext): ResolvedSegment[] {\n const { mapping } = ctx;\n try {\n if (isWhenObjectCall(node)) {\n return flattenWhenObjectParts(resolveWhenObjectSelectors(ctx, node, context));\n }\n if (applyModifierNodeToConditionContext(context, node, mapping)) {\n return [];\n }\n if (node.type === \"getter\") {\n return resolveEntry(node.name, requireEntry(mapping, node.name), mapping, context);\n }\n if (node.type === \"call\") {\n return resolveCallNode(node, mapping, context);\n }\n return [];\n } catch (err) {\n if (!(err instanceof UnsupportedPatternError)) throw err;\n return [errorSegment(err.message)];\n }\n}\n\n/**\n * Apply context-only chain nodes like breakpoints/pseudos/end.\n *\n * Returns false for nodes that produce styles instead. Throws UnsupportedPatternError for a\n * malformed modifier, which `resolveNode` turns into an error segment.\n */\nfunction applyModifierNodeToConditionContext(\n context: ResolvedConditionContext,\n node: ChainNode,\n mapping: TrussMapping,\n): boolean {\n if (node.type === \"getter\") {\n if (node.name === \"end\") {\n resetConditionContext(context);\n return true;\n }\n if (isTrussPseudoMethod(node.name)) {\n context.pseudoClass = trussPseudoSelector(node.name);\n return true;\n }\n const mediaQuery = breakpointMediaQuery(mapping, node.name);\n if (mediaQuery !== null) {\n context.mediaQuery = mediaQuery;\n return true;\n }\n return false;\n }\n\n if (node.type !== \"call\") {\n return false;\n }\n\n if (node.name === \"ifContainer\") {\n context.mediaQuery = containerQueryFromCall(node);\n return true;\n }\n\n if (node.name === \"element\") {\n const arg = node.args.length === 1 ? node.args[0] : null;\n if (!t.isStringLiteral(arg)) {\n throw new UnsupportedPatternError(\n `element() requires exactly one string literal argument (e.g. \"::placeholder\")`,\n );\n }\n context.pseudoElement = arg.value;\n return true;\n }\n\n if (node.name === \"when\") {\n if (isWhenObjectCall(node)) {\n return false;\n }\n const resolved = resolveWhenCall(node);\n if (resolved.kind === \"selector\") {\n context.pseudoClass = resolved.selector;\n } else {\n context.whenPseudo = resolved.condition;\n }\n return true;\n }\n\n if (isTrussPseudoMethod(node.name)) {\n context.pseudoClass = trussPseudoSelector(node.name);\n if (node.args.length > 0) {\n throw new UnsupportedPatternError(\n `${node.name}() does not take arguments -- use when(marker, \"ancestor\", \":hover\") for relationship selectors`,\n );\n }\n return true;\n }\n\n return false;\n}\n\n// ── Chain scanning helpers for resolveFullChain ───────────────────────\n\n/** Pull marker nodes out of a chain before style resolution. */\nfunction scanMarkerNodes(chain: ChainNode[]): { chain: ChainNode[]; markers: MarkerSegment[]; errors: string[] } {\n const filteredChain: ChainNode[] = [];\n const markers: MarkerSegment[] = [];\n const errors: string[] = [];\n\n for (const node of chain) {\n if (node.type === \"getter\" && node.name === \"marker\") {\n markers.push({ type: \"marker\" });\n continue;\n }\n\n if (node.type === \"call\" && node.name === \"markerOf\") {\n const arg = node.args.length === 1 ? node.args[0] : null;\n if (!arg || t.isSpreadElement(arg)) {\n errors.push(\"[truss] Unsupported pattern: markerOf() requires exactly one argument (a marker variable)\");\n } else {\n markers.push({ type: \"marker\", markerNode: arg });\n }\n continue;\n }\n\n filteredChain.push(node);\n }\n\n return { chain: filteredChain, markers, errors };\n}\n\n/** The media query a node switches into, i.e. `ifSm` or `if(\"@media ...\")`; null for every other node. */\nfunction mediaQueryOfNode(node: ChainNode, mapping: TrussMapping): string | null {\n if (node.type === \"if\" && t.isStringLiteral(node.conditionNode)) {\n return node.conditionNode.value;\n }\n if (node.type === \"getter\") {\n return breakpointMediaQuery(mapping, node.name);\n }\n return null;\n}\n\n/** Index of the `else` that closes the branch starting at `start`, or -1 when an `if`/`end` comes first. */\nfunction findElseIndex(chain: ChainNode[], start: number): number {\n for (let i = start; i < chain.length; i++) {\n const node = chain[i];\n if (node.type === \"if\") {\n return -1;\n }\n if (node.type === \"getter\" && node.name === \"end\") {\n return -1;\n }\n if (node.type === \"else\") {\n return i;\n }\n }\n return -1;\n}\n\n/** Index of the first `end` at or after `start`, or `chain.length` when the chain has none. */\nfunction findEndIndex(chain: ChainNode[], start: number): number {\n for (let i = start; i < chain.length; i++) {\n const node = chain[i];\n if (node.type === \"getter\" && node.name === \"end\") {\n return i;\n }\n }\n return chain.length;\n}\n\n// ── when({ ... }) object form ─────────────────────────────────────────\n\n/** Detect `when({ ... })` so object-form selector groups can be resolved specially. */\ntype WhenObjectCallChainNode = CallChainNode & { name: \"when\"; args: [t.ObjectExpression] };\n\nfunction isWhenObjectCall(node: ChainNode): node is WhenObjectCallChainNode {\n return node.type === \"call\" && node.name === \"when\" && node.args.length === 1 && t.isObjectExpression(node.args[0]);\n}\n\n/**\n * Resolve `when({ \":hover\": Css.blue.$, ... })` by recursively resolving each\n * nested `Css.*.$` value with the selector key as its initial pseudo-class.\n */\nfunction resolveWhenObjectSelectors(\n ctx: ResolveChainCtx,\n node: WhenObjectCallChainNode,\n context: ResolvedConditionContext,\n): ResolvedChain {\n if (!ctx.cssBindingName) {\n return {\n parts: [],\n markers: [],\n errors: [new UnsupportedPatternError(`when({ ... }) requires a resolvable Css binding`).message],\n };\n }\n\n const parts: ResolvedChainPart[] = [];\n const markers: MarkerSegment[] = [];\n const errors: string[] = [];\n\n for (const property of node.args[0].properties) {\n try {\n if (t.isSpreadElement(property)) {\n throw new UnsupportedPatternError(`when({ ... }) does not support spread properties`);\n }\n if (!t.isObjectProperty(property)) {\n throw new UnsupportedPatternError(`when({ ... }) only supports plain object properties`);\n }\n if (property.computed || !t.isStringLiteral(property.key)) {\n throw new UnsupportedPatternError(`when({ ... }) selector keys must be string literals`);\n }\n\n const value = unwrapExpression(property.value as t.Expression);\n const innerChain = resolveWhenObjectValueChain(ctx, value);\n if (!innerChain) {\n throw new UnsupportedPatternError(`when({ ... }) values must be Css.*.$ expressions`);\n }\n\n const selectorContext = cloneConditionContext(context);\n selectorContext.pseudoClass = property.key.value;\n const resolved = resolveFullChain(ctx, innerChain, selectorContext);\n parts.push(...resolved.parts);\n markers.push(...resolved.markers);\n errors.push(...resolved.errors);\n } catch (err) {\n if (!(err instanceof UnsupportedPatternError)) throw err;\n errors.push(err.message);\n }\n }\n\n return { parts, markers, errors: [...new Set(errors)] };\n}\n\n/**\n * Resolve a `when({ ... })` value into an inner `ChainNode[]`.\n *\n * I.e. this accepts either a direct `Css.blue.$` member expression or a\n * transform-provided reference resolver for identifiers like `const same = Css.blue.$`.\n * The reference lookup itself stays outside this file because it depends on\n * Babel scope/NodePath traversal state, while `resolve-chain.ts` is kept focused\n * on chain semantics rather than lexical binding analysis.\n */\nfunction resolveWhenObjectValueChain(ctx: ResolveChainCtx, value: t.Expression): ChainNode[] | null {\n const direct = ctx.cssBindingName ? extractDollarChain(value, ctx.cssBindingName) : null;\n return direct ?? ctx.resolveCssChainReference?.(value) ?? null;\n}\n\n/** Flatten nested `when({ ... })` parts back into plain segments for a branch body. */\nfunction flattenWhenObjectParts(resolved: ResolvedChain): ResolvedSegment[] {\n const segments: ResolvedSegment[] = [];\n\n // I.e. a branch body needs a flat segment list, even though `when({ ... })` is resolved via `resolveFullChain()`.\n for (const part of resolved.parts) {\n if (part.type !== \"unconditional\") {\n throw new UnsupportedPatternError(`when({ ... }) values cannot use if()/else in this context`);\n }\n\n segments.push(...part.segments);\n }\n\n for (const err of resolved.errors) {\n segments.push(errorSegment(err));\n }\n\n return segments;\n}\n","import { readFileSync } from \"fs\";\nimport type { TrussMapping } from \"./types\";\n\n/** Load a truss mapping file synchronously. */\nexport function loadMapping(path: string): TrussMapping {\n const raw = readFileSync(path, \"utf8\");\n return JSON.parse(raw);\n}\n\nconst longhandCache = new WeakMap<TrussMapping, Map<string, string>>();\n\n/**\n * Reverse lookup from `\"cssProperty\\0cssValue\"` → canonical abbreviation name.\n *\n * I.e. `{ paddingTop: \"8px\" }` → `\"pt1\"`, `{ borderStyle: \"solid\" }` → `\"bss\"`.\n * Cached per mapping via WeakMap.\n */\nexport function getLonghandLookup(mapping: TrussMapping): Map<string, string> {\n let lookup = longhandCache.get(mapping);\n if (lookup) return lookup;\n lookup = new Map();\n for (const [abbr, entry] of Object.entries(mapping.abbreviations)) {\n if (entry.kind !== \"static\") continue;\n const keys = Object.keys(entry.defs);\n if (keys.length !== 1) continue;\n const key = `${keys[0]}\\0${entry.defs[keys[0]]}`;\n // First match wins — if multiple abbreviations produce the same declaration,\n // the one that appears first in the mapping is canonical.\n if (!lookup.has(key)) lookup.set(key, abbr);\n }\n longhandCache.set(mapping, lookup);\n return lookup;\n}\n\n/** The canonical single-property abbreviation for `{ [cssProp]: cssValue }`, i.e. `(\"display\", \"grid\")` → `\"dg\"`. */\nexport function findCanonicalAbbreviation(\n mapping: TrussMapping,\n cssProp: string,\n cssValue: string,\n): string | undefined {\n return getLonghandLookup(mapping).get(`${cssProp}\\0${cssValue}`);\n}\n\n/** The media query behind a breakpoint getter, i.e. `\"ifSm\"` → `\"@media screen and (max-width: 599px)\"`, or null. */\nexport function breakpointMediaQuery(mapping: TrussMapping, getterName: string): string | null {\n const breakpoints = mapping.breakpoints;\n if (!breakpoints || !Object.hasOwn(breakpoints, getterName)) return null;\n return breakpoints[getterName];\n}\n\n/**\n * The breakpoint name behind a media query, without its `if` prefix.\n *\n * I.e. `\"@media screen and (max-width: 599px)\"` → `\"Sm\"` when `breakpoints.ifSm` is that query,\n * or null for media queries that are not a configured breakpoint.\n */\nexport function breakpointNameForMediaQuery(mapping: TrussMapping, mediaQuery: string): string | null {\n const breakpoints = mapping.breakpoints;\n if (!breakpoints) return null;\n const getterName = Object.keys(breakpoints).find((name) => breakpoints[name] === mediaQuery);\n return getterName === undefined ? null : getterName.replace(/^if/, \"\");\n}\n","import type * as t from \"@babel/types\";\n\n/**\n * The parsed shape of a `Css.*.$` chain: one node per getter, call, `if()`, or `else` between\n * `Css` and `.$`, in source order.\n *\n * I.e. `Css.if(cond).df.else.db.$` → `[{ type: \"if\" }, { type: \"getter\", name: \"df\" }, { type: \"else\" }, { type: \"getter\", name: \"db\" }]`.\n * Produced by `extractChain` in ast-utils and consumed by the resolve-* modules.\n */\nexport type ChainNode = GetterChainNode | CallChainNode | IfChainNode | ElseChainNode;\n\nexport interface GetterChainNode {\n type: \"getter\";\n name: string;\n}\n\nexport interface CallChainNode {\n type: \"call\";\n name: string;\n args: (t.Expression | t.SpreadElement)[];\n}\n\nexport interface IfChainNode {\n type: \"if\";\n conditionNode: t.Expression;\n}\n\nexport interface ElseChainNode {\n type: \"else\";\n}\n\n/**\n * A chain pattern the compiler cannot resolve.\n *\n * Resolution catches it per node and records an error segment in the chain, which transform\n * reports as a `console.error` in the output and transform-css as a CSS comment.\n */\nexport class UnsupportedPatternError extends Error {\n constructor(message: string) {\n super(`[truss] Unsupported pattern: ${message}`);\n this.name = \"UnsupportedPatternError\";\n }\n}\n","import type { ResolvedConditionContext } from \"./types\";\n\n/** The context with no modifier axes active. */\nexport function emptyConditionContext(): ResolvedConditionContext {\n return {\n mediaQuery: null,\n pseudoClass: null,\n pseudoElement: null,\n whenPseudo: null,\n };\n}\n\n/** `WhenCondition` objects are never mutated after creation, so a shallow copy is a full snapshot. */\nexport function cloneConditionContext(context: ResolvedConditionContext): ResolvedConditionContext {\n return { ...context };\n}\n\n/** Clear every axis in place, i.e. for `end`. */\nexport function resetConditionContext(context: ResolvedConditionContext): void {\n Object.assign(context, emptyConditionContext());\n}\n","import type {\n ResolvedConditionContext,\n ResolvedSegment,\n StaticSegment,\n TrussMapping,\n TrussMappingEntry,\n} from \"./types\";\nimport { UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext } from \"./condition-context\";\n\n/** The mapping entry for `abbr`, or an unsupported-pattern error for an unknown abbreviation. */\nexport function requireEntry(mapping: TrussMapping, abbr: string): TrussMappingEntry {\n const entry = mapping.abbreviations[abbr];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown abbreviation \"${abbr}\"`);\n }\n return entry;\n}\n\n/** Placeholder segment that carries an unsupported-pattern message through to the emitter. */\nexport function errorSegment(message: string): ResolvedSegment {\n return { kind: \"error\", message };\n}\n\n/** A static segment under a snapshot of the active condition axes. */\nexport function staticSegment(\n abbr: string,\n defs: Record<string, unknown>,\n context: ResolvedConditionContext,\n argResolved?: string,\n): StaticSegment {\n return { kind: \"static\", abbr, defs, argResolved, condition: cloneConditionContext(context) };\n}\n\n/** Resolve a static or alias entry (from a getter access). Defs are always flat. */\nexport function resolveEntry(\n abbr: string,\n entry: TrussMappingEntry,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n switch (entry.kind) {\n case \"static\": {\n return [staticSegment(abbr, entry.defs, context)];\n }\n case \"alias\": {\n const result: ResolvedSegment[] = [];\n for (const chainAbbr of entry.chain) {\n const subEntry = mapping.abbreviations[chainAbbr];\n if (!subEntry) {\n throw new UnsupportedPatternError(`Alias \"${abbr}\" references unknown abbreviation \"${chainAbbr}\"`);\n }\n result.push(...resolveEntry(chainAbbr, subEntry, mapping, context));\n }\n return result;\n }\n case \"variable\":\n case \"delegate\":\n throw new UnsupportedPatternError(`Abbreviation \"${abbr}\" requires arguments — use ${abbr}() not .${abbr}`);\n default:\n throw new UnsupportedPatternError(`Unhandled entry kind for \"${abbr}\"`);\n }\n}\n","import * as t from \"@babel/types\";\nimport {\n hasCondition,\n type ResolvedConditionContext,\n type ResolvedSegment,\n type TrussMapping,\n type TrussMappingEntry,\n} from \"./types\";\nimport { findCanonicalAbbreviation } from \"./mapping-utils\";\nimport { staticPropertyName } from \"./ast-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext } from \"./condition-context\";\nimport { requireEntry, staticSegment } from \"./resolve-entry\";\nimport { isCustomPropertyLiteral, singleArg, tryEvaluatePropertyLiteral, tryNumericLiteral } from \"./resolve-literals\";\nimport { resolveSetVarCall } from \"./resolve-setvar\";\nimport { resolveTypographyCall } from \"./resolve-typography\";\n\n/** Resolve a call node: a built-in like `add(...)`/`setVar(...)`, or a variable/delegate abbreviation like `mt(2)`. */\nexport function resolveCallNode(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n switch (node.name) {\n case \"with\":\n return [resolveWithCall(node)];\n case \"add\":\n return resolveAddCall(node, mapping, context);\n case \"className\":\n return [resolveClassNameCall(node, context)];\n case \"style\":\n return [resolveStyleCall(node, context)];\n case \"setVar\":\n return resolveSetVarCall(node, mapping, context);\n case \"typography\":\n return resolveTypographyCall(node, mapping, context);\n }\n\n const entry = requireEntry(mapping, node.name);\n if (entry.kind === \"variable\") {\n return [resolveVariableCall(node.name, entry, node, mapping, context)];\n }\n if (entry.kind === \"delegate\") {\n return [resolveDelegateCall(node.name, entry, node, mapping, context)];\n }\n throw new UnsupportedPatternError(`Abbreviation \"${node.name}\" is ${entry.kind}, cannot be called as a function`);\n}\n\n/** Resolve a variable (parameterized) call like mt(2) or mt(x). */\nfunction resolveVariableCall(\n abbr: string,\n entry: Extract<TrussMappingEntry, { kind: \"variable\" }>,\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment {\n const arg = singleArg(node, abbr);\n return resolveLiteralOrVariableSegment({\n abbr,\n props: entry.props,\n incremented: entry.incremented,\n extraDefs: entry.extraDefs,\n argAst: arg,\n literalValue: tryEvaluatePropertyLiteral(arg, mapping, entry.incremented),\n mapping,\n context,\n });\n}\n\n/** Resolve a delegate call like mtPx(12). */\nfunction resolveDelegateCall(\n abbr: string,\n entry: Extract<TrussMappingEntry, { kind: \"delegate\" }>,\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment {\n const targetEntry = mapping.abbreviations[entry.target];\n if (!targetEntry || targetEntry.kind !== \"variable\") {\n throw new UnsupportedPatternError(`Delegate \"${abbr}\" targets \"${entry.target}\" which is not a variable entry`);\n }\n const arg = singleArg(node, abbr);\n // I.e. `mtPx(12)` folds to `12px` and `mtPx(-4)` to `-4px`; anything else is a runtime value\n const pixels = tryNumericLiteral(arg);\n // Use the target abbreviation name for delegate segments (i.e. mtPx → mt)\n return resolveLiteralOrVariableSegment({\n abbr: entry.target,\n props: targetEntry.props,\n incremented: false,\n appendPx: true,\n extraDefs: targetEntry.extraDefs,\n argAst: arg,\n literalValue: pixels === null ? null : `${pixels}px`,\n mapping,\n context,\n });\n}\n\n/**\n * Resolve a parameterized call argument to either a static fold, a compile-time `_var` tuple,\n * or a runtime `_var` tuple.\n *\n * I.e. `mt(2)` folds to `defs: { marginTop: \"calc(var(--t-spacing) * 2)\" }`; `mt(Tokens.gap)` stays a\n * `_var` segment with `argResolved: \"var(--gap)\"` so every token shares one `mt_var` class; and `mt(x)`\n * is a `_var` segment whose value is only known at runtime.\n */\nfunction resolveLiteralOrVariableSegment(params: {\n abbr: string;\n props: string[];\n incremented: boolean;\n appendPx?: boolean;\n extraDefs?: Record<string, unknown>;\n argAst: t.Expression;\n literalValue: string | null;\n mapping: TrussMapping;\n context: ResolvedConditionContext;\n}): ResolvedSegment {\n const { abbr, props, incremented, appendPx = false, extraDefs, argAst, literalValue, mapping, context } = params;\n\n if (literalValue !== null && !isCustomPropertyLiteral(argAst, mapping)) {\n const defs: Record<string, unknown> = Object.fromEntries(props.map((prop) => [prop, literalValue]));\n return staticSegment(abbr, { ...defs, ...extraDefs }, context, literalValue);\n }\n\n return {\n kind: \"variable\",\n abbr,\n props,\n incremented,\n appendPx,\n extraDefs,\n argNode: literalValue === null ? argAst : undefined,\n argResolved: literalValue ?? undefined,\n condition: cloneConditionContext(context),\n };\n}\n\n/** Raw class passthrough, i.e. `Css.className(buttonClass).df.$`. */\nfunction resolveClassNameCall(node: CallChainNode, context: ResolvedConditionContext): ResolvedSegment {\n const arg = singleArg(node, \"className\");\n if (hasCondition(context)) {\n // I.e. `ifSm.className(\"x\")` cannot be represented as a runtime-only class append.\n throw new UnsupportedPatternError(\n `className() cannot be used inside media query, pseudo-class, pseudo-element, or when() contexts`,\n );\n }\n // I.e. this is metadata for the rewriter/runtime, not an atomic CSS rule.\n return { kind: \"className\", arg };\n}\n\n/** Raw inline style passthrough, i.e. `Css.mt(x).style(vars).$`. */\nfunction resolveStyleCall(node: CallChainNode, context: ResolvedConditionContext): ResolvedSegment {\n const arg = singleArg(node, \"style\");\n if (hasCondition(context)) {\n throw new UnsupportedPatternError(\n `style() cannot be used inside media query, pseudo-class, pseudo-element, or when() contexts`,\n );\n }\n return { kind: \"inlineStyle\", arg };\n}\n\n/**\n * Resolve a `with(cssProp)` call — compose an existing Css expression or partial\n * style hash into the chain.\n *\n * - `with(expr)` — spread an existing Css expression into the chain output\n * - `with({ height })` — inline a partial style hash, skipping undefined values\n */\nfunction resolveWithCall(node: CallChainNode): ResolvedSegment {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`with() requires exactly 1 argument`);\n }\n const styleArg = node.args[0];\n if (t.isSpreadElement(styleArg)) {\n throw new UnsupportedPatternError(`with() does not support spread arguments`);\n }\n // Object literal: skip undefined values (the old addCss({ height }) pattern)\n return { kind: \"composed\", arg: styleArg, skipUndefined: t.isObjectExpression(styleArg) };\n}\n\n/**\n * Resolve an `add(...)` call.\n *\n * Supported overloads:\n * - `add({ prop: value, ... })` to add real CSS property/value pairs (alias for multiple add calls)\n * - `add(\"propName\", value)` for an arbitrary CSS property/value pair\n *\n * Both forms reuse a canonical abbreviation when the pair matches one, i.e. `add(\"display\", \"grid\")` → `dg`.\n */\nfunction resolveAddCall(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const usage =\n `add() requires 1 or 2 arguments (property name and value, or an object literal), got ${node.args.length}. ` +\n `Supported overloads are add({ prop: value }), add(\"propName\", value), and with(cssProp)`;\n\n if (node.args.length === 1) {\n const styleArg = node.args[0];\n if (t.isSpreadElement(styleArg)) {\n throw new UnsupportedPatternError(`add() does not support spread arguments`);\n }\n if (t.isObjectExpression(styleArg)) {\n return resolveAddObjectLiteral(styleArg, mapping, context);\n }\n throw new UnsupportedPatternError(usage);\n }\n\n if (node.args.length !== 2) {\n throw new UnsupportedPatternError(usage);\n }\n\n const [propArg, valueArg] = node.args;\n if (!t.isStringLiteral(propArg)) {\n throw new UnsupportedPatternError(`add() first argument must be a string literal property name`);\n }\n if (t.isSpreadElement(valueArg)) {\n throw new UnsupportedPatternError(`add() does not support spread arguments`);\n }\n\n return [resolveAddDeclaration(propArg.value, valueArg, mapping, context)];\n}\n\n/**\n * Expand an `add({ prop1: value1, prop2: value2 })` object literal into individual segments,\n * as if the user had called `add(\"prop1\", value1).add(\"prop2\", value2)`.\n */\nfunction resolveAddObjectLiteral(\n obj: t.ObjectExpression,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const segments: ResolvedSegment[] = [];\n for (const property of obj.properties) {\n if (t.isSpreadElement(property)) {\n throw new UnsupportedPatternError(`add({...}) does not support spread properties -- use with() instead`);\n }\n if (!t.isObjectProperty(property) || property.computed) {\n throw new UnsupportedPatternError(`add({...}) only supports simple property keys`);\n }\n const propName = staticPropertyName(property.key);\n if (propName === null) {\n throw new UnsupportedPatternError(`add({...}) property keys must be identifiers or string literals`);\n }\n segments.push(resolveAddDeclaration(propName, property.value as t.Expression, mapping, context));\n }\n return segments;\n}\n\n/**\n * Resolve one `add()` property/value pair to a segment.\n *\n * When the pair matches an existing single-property abbreviation in the mapping, that abbreviation\n * is reused so the class is shared with direct uses. Otherwise the property name itself is the\n * abbreviation, folded to a static class for literal values or a `_var` tuple for runtime values.\n *\n * I.e. `(\"display\", \"grid\")` → the `dg` segment; `(\"boxShadow\", \"0 0 0 1px blue\")` → `boxShadow_0_0_0_1px_blue`;\n * `(\"boxShadow\", shadow)` → `boxShadow_var` with `--boxShadow: shadow`.\n */\nfunction resolveAddDeclaration(\n propName: string,\n valueNode: t.Expression,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment {\n const literalValue = tryEvaluatePropertyLiteral(valueNode, mapping, false);\n\n const canonicalAbbr =\n literalValue !== null && !isCustomPropertyLiteral(valueNode, mapping)\n ? findCanonicalAbbreviation(mapping, propName, literalValue)\n : undefined;\n if (canonicalAbbr) {\n const entry = mapping.abbreviations[canonicalAbbr] as Extract<TrussMappingEntry, { kind: \"static\" }>;\n return staticSegment(canonicalAbbr, entry.defs, context);\n }\n\n return resolveLiteralOrVariableSegment({\n abbr: propName,\n props: [propName],\n incremented: false,\n argAst: valueNode,\n literalValue,\n mapping,\n context,\n });\n}\n","import type * as t from \"@babel/types\";\nimport type { WhenRelationship } from \"./when-relationships\";\n\n/** The shape of the Css.json mapping file consumed by the Vite plugin. */\nexport interface TrussMapping {\n increment: number;\n breakpoints?: Record<string, string>;\n typography?: string[];\n /** Token member name → CSS variable (from `config.tokens`), for `setVar` key resolution. */\n tokens?: Record<string, string>;\n abbreviations: Record<string, TrussMappingEntry>;\n}\n\n/** A `when()` relationship selector context that can stack with other condition axes. */\nexport interface WhenCondition {\n pseudo: string;\n /** The user's marker variable, i.e. `row` in `when(row, \"ancestor\", \":hover\")`. Absent for the default marker. */\n markerNode?: t.Identifier;\n relationship: WhenRelationship;\n}\n\n/** The active modifier axes while resolving a Css chain. */\nexport interface ResolvedConditionContext {\n mediaQuery: string | null;\n pseudoClass: string | null;\n pseudoElement: string | null;\n whenPseudo: WhenCondition | null;\n}\n\n/**\n * A single abbreviation entry from `Css.json`.\n *\n * Each `kind` describes how the transformer should resolve that abbreviation.\n */\nexport type TrussMappingEntry =\n /** I.e. `{ \"kind\": \"static\", \"defs\": { \"display\": \"flex\" } }` for `Css.df.$`. */\n | { kind: \"static\"; defs: Record<string, unknown> }\n /** I.e. `{ \"kind\": \"variable\", \"props\": [\"marginTop\"], \"incremented\": true }` for `Css.mt(v).$`. */\n | { kind: \"variable\"; props: string[]; incremented: boolean; extraDefs?: Record<string, unknown> }\n /** I.e. `{ \"kind\": \"delegate\", \"target\": \"mt\" }` for `Css.mtPx(v).$`. */\n | { kind: \"delegate\"; target: string }\n /** I.e. `{ \"kind\": \"alias\", \"chain\": [\"f14\", \"black\"] }` for `Css.bodyText.$`. */\n | { kind: \"alias\"; chain: string[] };\n\n/** Fields shared by the segments that resolve to atomic CSS declarations. */\ninterface CssSegmentBase {\n /** The abbreviation name, i.e. \"df\", \"black\", \"mt\", \"ba\"; the base of the generated class name. */\n abbr: string;\n /** The modifier axes this segment resolved under, snapshotted at resolution time. */\n condition: ResolvedConditionContext;\n}\n\n/**\n * Concrete CSS property/value pairs.\n *\n * I.e. `Css.df.$` → `defs: { display: \"flex\" }`. A folded `Css.mt(2).$` also carries\n * `argResolved: \"calc(var(--t-spacing) * 2)\"` so its class name can include the value.\n */\nexport interface StaticSegment extends CssSegmentBase {\n kind: \"static\";\n defs: Record<string, unknown>;\n argResolved?: string;\n}\n\n/**\n * A `_var` class whose value comes from a CSS custom property.\n *\n * I.e. `Css.mt(x).$` sets `argNode` (the runtime value), while `Css.mt(Tokens.gap).$` sets\n * `argResolved: \"var(--gap)\"` so every token shares the one `mt_var` class.\n */\nexport interface VariableSegment extends CssSegmentBase {\n kind: \"variable\";\n /** The CSS props the variable sets, i.e. `[\"height\", \"width\"]` for `sq(x)`. */\n props: string[];\n /** Whether the runtime value goes through `__maybeInc`. */\n incremented: boolean;\n /** For Px delegates: whether the runtime value must append `px`. */\n appendPx: boolean;\n /** Additional static defs applied alongside the variable value. */\n extraDefs?: Record<string, unknown>;\n argNode?: t.Expression;\n argResolved?: string;\n}\n\n/** A raw class name appended at runtime, i.e. `Css.className(cls).$`. */\nexport interface ClassNameSegment {\n kind: \"className\";\n arg: t.Expression;\n}\n\n/** A raw inline style object merged at runtime, i.e. `Css.style(vars).$`. */\nexport interface InlineStyleSegment {\n kind: \"inlineStyle\";\n arg: t.Expression;\n}\n\n/** An existing Css expression composed into the chain via `with(cssProp)`. */\nexport interface ComposedSegment {\n kind: \"composed\";\n arg: t.Expression;\n /** True for `with({ height })` object literals, whose undefined values are skipped at runtime. */\n skipUndefined: boolean;\n}\n\n/** A runtime `typography(key)` lookup: every typography abbreviation pre-resolved under the current condition. */\nexport interface TypographyLookupSegment {\n kind: \"typography\";\n /** I.e. `\"typography\"` or `\"typography__sm\"` for `Css.typography(key).$` in a given condition context. */\n lookupKey: string;\n argNode: t.Expression;\n segmentsByName: Record<string, ResolvedSegment[]>;\n}\n\n/**\n * An unsupported pattern that could not be resolved.\n *\n * Valid segments in the same chain are preserved; only this segment is skipped in the output.\n */\nexport interface ErrorSegment {\n kind: \"error\";\n message: string;\n}\n\n/** The segments that resolve to atomic CSS declarations. */\nexport type CssSegment = StaticSegment | VariableSegment;\n\n/** A resolved chain segment — one abbreviation resolved to its effect on the element. */\nexport type ResolvedSegment =\n | CssSegment\n | ClassNameSegment\n | InlineStyleSegment\n | ComposedSegment\n | TypographyLookupSegment\n | ErrorSegment;\n\n/**\n * A marker segment — not a CSS style, but a directive to attach\n * a default or user-defined marker class to the element.\n */\nexport interface MarkerSegment {\n type: \"marker\";\n /** If set, the AST node of the user-provided marker variable. Otherwise, default marker. */\n markerNode?: t.Expression;\n}\n\n/** True for segments that resolve to atomic CSS declarations. */\nexport function isCssSegment(seg: ResolvedSegment): seg is CssSegment {\n return seg.kind === \"static\" || seg.kind === \"variable\";\n}\n\n/** True when any modifier axis is active: media query, pseudo-class, pseudo-element, or `when()`. */\nexport function hasCondition(condition: ResolvedConditionContext): boolean {\n return !!(condition.mediaQuery || condition.pseudoClass || condition.pseudoElement || condition.whenPseudo);\n}\n","import * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport { memberPropertyName, staticPropertyName, unwrapExpression } from \"./ast-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { isCustomPropertyName, maybeCssVar } from \"../css-custom-property\";\nimport { incrementCssValue } from \"../spacing-css-var\";\n\n// ── Literal evaluation ────────────────────────────────────────────────\n\n/**\n * Try to evaluate a literal AST node to a CSS property value.\n * For incremented entries, also evaluates `maybeInc(literal)` (web: calc on `--t-spacing`).\n * Custom property names (`--token` / `Tokens.X`) are wrapped as `var(--token)`.\n */\nexport function tryEvaluatePropertyLiteral(\n node: t.Expression,\n mapping: TrussMapping,\n incremented: boolean,\n): string | null {\n const numeric = tryNumericLiteral(node);\n if (numeric !== null) {\n return incremented ? incrementCssValue(numeric) : String(numeric);\n }\n const raw = tryResolveValueLiteral(node, mapping);\n return raw === null ? null : maybeCssVar(raw);\n}\n\n/** True when the argument names a CSS custom property, i.e. `\"--token\"` or `Tokens.x`. */\nexport function isCustomPropertyLiteral(node: t.Expression, mapping: TrussMapping): boolean {\n const raw = tryResolveValueLiteral(node, mapping);\n return raw !== null && isCustomPropertyName(raw);\n}\n\n/** Resolve a literal value without wrapping (for setVar values, etc.). */\nexport function tryResolveValueLiteral(node: t.Expression, mapping?: TrussMapping): string | null {\n if (mapping) {\n const token = tryResolveTokensMember(node, mapping);\n if (token !== null) return token;\n }\n if (t.isStringLiteral(node)) {\n return node.value;\n }\n const numeric = tryNumericLiteral(node);\n return numeric === null ? null : String(numeric);\n}\n\n/** I.e. `12` → 12 and `-12` → -12; null for anything but a (negated) numeric literal. */\nexport function tryNumericLiteral(node: t.Expression): number | null {\n if (t.isNumericLiteral(node)) {\n return node.value;\n }\n if (t.isUnaryExpression(node, { operator: \"-\" }) && t.isNumericLiteral(node.argument)) {\n return -node.argument.value;\n }\n return null;\n}\n\n/** Resolve `Tokens.Member` / `Tokens[\"Member\"]` to a `--` custom property name. */\nfunction tryResolveTokensMember(node: t.Expression, mapping: TrussMapping): string | null {\n if (!t.isMemberExpression(node) || !t.isIdentifier(node.object, { name: \"Tokens\" })) return null;\n const memberName = memberPropertyName(node);\n if (memberName === null) return null;\n\n const tokenMap = mapping.tokens;\n if (!tokenMap) {\n throw new UnsupportedPatternError(`Tokens.* requires config.tokens`);\n }\n if (!(memberName in tokenMap)) {\n throw new UnsupportedPatternError(`Unknown token \"${memberName}\" - add it to config.tokens`);\n }\n return tokenMap[memberName];\n}\n\n// ── Argument and object-literal validation ────────────────────────────\n\n/** The single argument of `label()`, rejecting missing, extra, and spread arguments. */\nexport function singleArg(node: CallChainNode, label: string): t.Expression {\n if (node.args.length !== 1) {\n throw new UnsupportedPatternError(`${label}() expects exactly 1 argument, got ${node.args.length}`);\n }\n const arg = node.args[0];\n if (t.isSpreadElement(arg)) {\n throw new UnsupportedPatternError(`${label}() does not support spread arguments`);\n }\n return arg;\n}\n\n/** The `key: value` pairs of an object literal, rejecting spreads, methods, computed keys, and non-static keys. */\nexport function plainObjectEntries(\n obj: t.ObjectExpression,\n label: string,\n): Array<{ key: string; value: t.Expression }> {\n return obj.properties.map((prop) => {\n if (t.isSpreadElement(prop)) {\n throw new UnsupportedPatternError(`${label} does not support spread properties`);\n }\n if (!t.isObjectProperty(prop) || prop.computed) {\n throw new UnsupportedPatternError(`${label} only supports plain object properties`);\n }\n const key = staticPropertyName(prop.key);\n if (key === null) {\n throw new UnsupportedPatternError(`${label} only supports identifier/string keys`);\n }\n return { key, value: prop.value as t.Expression };\n });\n}\n\n/** A (negated) numeric literal's value, or throws `errorMessage`. */\nexport function numericLiteralValue(node: t.Expression, errorMessage: string): number {\n const numeric = tryNumericLiteral(node);\n if (numeric === null) {\n throw new UnsupportedPatternError(errorMessage);\n }\n return numeric;\n}\n\n/** A string literal's or expression-free template literal's value, or throws `errorMessage`. */\nexport function stringLiteralValue(node: t.Expression, errorMessage: string): string {\n if (t.isStringLiteral(node)) {\n return node.value;\n }\n if (t.isTemplateLiteral(node) && node.expressions.length === 0 && node.quasis.length === 1) {\n return node.quasis[0].value.cooked ?? \"\";\n }\n throw new UnsupportedPatternError(errorMessage);\n}\n\n/** A string/number literal value, unwrapping TS/paren wrappers first. */\nexport function requireValueLiteral(node: t.Expression, errorMessage: string): string {\n const value = tryResolveValueLiteral(unwrapExpression(node));\n if (value === null) {\n throw new UnsupportedPatternError(errorMessage);\n }\n return value;\n}\n","/**\n * Utilities for CSS custom properties (`--token`) in Truss style values.\n */\n\n/**\n * If `value` is a custom property name (`--token`), wrap as `var(--token)` for use as a property value.\n * Passes through values that are not custom-property names (including existing `var(...)`).\n */\nexport function maybeCssVar<T>(value: T): T {\n if (typeof value !== \"string\") return value;\n if (value.startsWith(\"--\")) return `var(${value})` as T;\n return value;\n}\n\n/** True when a runtime variable tuple value may be a `--token` name (not a Px `` `${n}px` `` path). */\nexport function variableValueNeedsMaybeCssVar(opts: { appendPx?: boolean }): boolean {\n return !opts.appendPx;\n}\n\n/** True when a resolved argument value is a CSS custom property name (`--token`). */\nexport function isCustomPropertyName(value: string): boolean {\n return value.startsWith(\"--\");\n}\n","/**\n * Web increment utilities use `--t-spacing` with `calc` (see generated `Css.ts` and the Vite plugin).\n * Keep literals in one place so codegen, emitted CSS, and the transform stay aligned.\n * `--t-spacing` must be set (e.g. `:root` prelude from `collectCss()` / mapping `increment`).\n */\n\n/** Custom property for increment-based spacing (web). */\nexport const SPACING_CUSTOM_PROPERTY = \"--t-spacing\";\n\n/** I.e. `calc(var(--t-spacing) * 3)` — requires prelude defining `--t-spacing`. */\nexport function incrementCssValue(multiplier: number): string {\n return `calc(var(${SPACING_CUSTOM_PROPERTY}) * ${multiplier})`;\n}\n\n/**\n * If `cssValue` is exactly `calc(var(--t-spacing) * k)` for this package's spacing property,\n * returns the multiplier substring `k` (e.g. `\"2\"`, `\"-1\"`, `\"2.5\"`). Otherwise null.\n */\nexport function tryParseIncrementCalcMultiplier(cssValue: string): string | null {\n const prop = SPACING_CUSTOM_PROPERTY.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n const re = new RegExp(`^calc\\\\(var\\\\(${prop}\\\\) \\\\* (-?\\\\d+(?:\\\\.\\\\d+)?)\\\\)$`);\n const m = cssValue.match(re);\n return m ? m[1] : null;\n}\n\n/** Prepended to emitted Truss CSS; `incrementPx` comes from `truss-config` / `Css.json`. */\nexport function rootSpacingPreludeCss(incrementPx: number): string {\n return `:root { ${SPACING_CUSTOM_PROPERTY}: ${incrementPx}px; }`;\n}\n","import * as t from \"@babel/types\";\nimport { pascalCase } from \"change-case\";\nimport type { ResolvedConditionContext, ResolvedSegment, TrussMapping } from \"./types\";\nimport { breakpointMediaQuery } from \"./mapping-utils\";\nimport { memberPropertyName, unwrapExpression } from \"./ast-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { cloneConditionContext } from \"./condition-context\";\nimport { staticSegment } from \"./resolve-entry\";\nimport { plainObjectEntries, requireValueLiteral, singleArg, tryResolveValueLiteral } from \"./resolve-literals\";\nimport { type ContainerBounds, containerQueryString, readContainerBound } from \"./container-query\";\nimport { sanitizeClassNameToken } from \"./style-entries\";\n\n/** CSS custom properties as atomic classes, i.e. `Css.setVar({ [Tokens.x]: \"1px\" }).$`. */\nexport function resolveSetVarCall(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const arg = singleArg(node, \"setVar\");\n if (!t.isObjectExpression(arg)) {\n throw new UnsupportedPatternError(`setVar() requires an object literal argument`);\n }\n\n const segments: ResolvedSegment[] = [];\n for (const prop of arg.properties) {\n if (t.isSpreadElement(prop)) {\n throw new UnsupportedPatternError(`setVar() does not support spread properties`);\n }\n if (!t.isObjectProperty(prop)) {\n throw new UnsupportedPatternError(`setVar() only supports object properties`);\n }\n const cssVarName = resolveSetVarPropertyKey(prop, mapping);\n // I.e. `--theme-accent` → `__theme_accent`, which the emitter extends with the value, i.e. `__theme_accent_blue`.\n const abbr = `__${sanitizeClassNameToken(cssVarName.replace(/^--/, \"\"))}`;\n for (const leaf of expandSetVarValueToLeaves(prop.value as t.Expression, mapping, context)) {\n segments.push(staticSegment(abbr, { [cssVarName]: leaf.literal }, leaf.context, leaf.literal));\n }\n }\n\n return segments;\n}\n\n/** The `--var-name` a setVar key refers to: a `\"--literal\"` string key or a `[Tokens.Name]` member. */\nfunction resolveSetVarPropertyKey(prop: t.ObjectProperty, mapping: TrussMapping): string {\n const key = prop.key;\n if (!prop.computed) {\n if (t.isStringLiteral(key)) {\n if (key.value.startsWith(\"--\")) {\n return key.value;\n }\n throw new UnsupportedPatternError(\n `setVar() string keys must be CSS variables starting with \"--\" - got ${JSON.stringify(key.value)}`,\n );\n }\n if (t.isIdentifier(key)) {\n throw new UnsupportedPatternError(\n `setVar() requires computed keys like [Tokens.Name] or string keys \"--my-var\", not bare property names`,\n );\n }\n throw new UnsupportedPatternError(`setVar() property keys must be string literals or [Tokens.*] members`);\n }\n\n if (!t.isMemberExpression(key)) {\n throw new UnsupportedPatternError(`setVar() computed keys must be Tokens.*-style members`);\n }\n const memberName = memberPropertyName(key);\n if (memberName === null) {\n throw new UnsupportedPatternError(\n `setVar() [Tokens.name] keys must use a plain .member or [\"string\"] member access`,\n );\n }\n const tokenMap = mapping.tokens;\n if (!tokenMap || !(memberName in tokenMap)) {\n throw new UnsupportedPatternError(\n tokenMap\n ? `Unknown token \"${memberName}\" - add it to config.tokens or use a \"--\" string literal key`\n : `setVar() [Tokens.*] requires config.tokens; use \"--\" string literal keys only`,\n );\n }\n return tokenMap[memberName];\n}\n\n/** One concrete value for a setVar custom property, together with the condition it applies under. */\ninterface SetVarLeaf {\n literal: string;\n context: ResolvedConditionContext;\n}\n\n/**\n * Expands one `setVar` property value into one or more static \"leaves\" for emission.\n *\n * Input: the AST for a single value — either a string/number literal, or an object\n * `{ default?, media?, container? }` when the variable is responsive.\n *\n * Output: each leaf is a concrete literal plus a condition context (viewport `mediaQuery`,\n * `@container` string in `mediaQuery`, or base). `resolveSetVarCall` turns each leaf into\n * a static segment with `defs: { [cssVarName]: literal }`. Leaves are emitted in the order\n * default, media, container regardless of the source property order.\n *\n * I.e. `\"8px\"` → one leaf with the inherited context (often unconditional).\n *\n * I.e. `{ default: \"blue\", media: { sm: \"green\" } }` → `\"blue\"` in base context, and `\"green\"`\n * with `mediaQuery` set from `mapping.breakpoints` for `ifSm` (same `@media` as `Css.ifSm`).\n *\n * I.e. `{ container: [{ gt: 400, value: \"10px\" }] }` → one leaf with `mediaQuery` like\n * `@container (min-width: 401px)` (same shape as `ifContainer({ gt: 400 })`).\n */\nfunction expandSetVarValueToLeaves(\n valueNode: t.Expression,\n mapping: TrussMapping,\n baseContext: ResolvedConditionContext,\n): SetVarLeaf[] {\n const unwrapped = unwrapExpression(valueNode);\n const scalar = tryResolveValueLiteral(unwrapped);\n if (scalar !== null) {\n return [setVarLeaf(scalar, baseContext)];\n }\n\n if (!t.isObjectExpression(unwrapped)) {\n throw new UnsupportedPatternError(\n `setVar() values must be string/number literals or a { default?, media?, container? } object`,\n );\n }\n\n let defaultLiteral: string | undefined;\n let mediaObject: t.ObjectExpression | undefined;\n let containerArray: t.ArrayExpression | undefined;\n\n for (const { key, value } of plainObjectEntries(unwrapped, \"setVar() responsive object\")) {\n if (key === \"default\") {\n defaultLiteral = requireValueLiteral(value, `setVar().default must be a string or number literal`);\n } else if (key === \"media\") {\n if (!t.isObjectExpression(value)) {\n throw new UnsupportedPatternError(`setVar().media must be an object literal`);\n }\n mediaObject = value;\n } else if (key === \"container\") {\n if (!t.isArrayExpression(value)) {\n throw new UnsupportedPatternError(`setVar().container must be an array literal`);\n }\n containerArray = value;\n } else {\n throw new UnsupportedPatternError(`setVar() responsive object does not support property \"${key}\"`);\n }\n }\n\n const leaves: SetVarLeaf[] = [];\n if (defaultLiteral !== undefined) {\n leaves.push(setVarLeaf(defaultLiteral, baseContext));\n }\n if (mediaObject) {\n leaves.push(...setVarMediaLeaves(mediaObject, mapping, baseContext));\n }\n if (containerArray) {\n leaves.push(...setVarContainerLeaves(containerArray, baseContext));\n }\n\n if (leaves.length === 0) {\n throw new UnsupportedPatternError(\n `setVar() responsive object must include at least one of default, media entries, or container entries`,\n );\n }\n\n return leaves;\n}\n\n/** I.e. `{ sm: \"green\" }` → one leaf per breakpoint, each under that breakpoint's media query. */\nfunction setVarMediaLeaves(\n mediaObject: t.ObjectExpression,\n mapping: TrussMapping,\n baseContext: ResolvedConditionContext,\n): SetVarLeaf[] {\n return plainObjectEntries(mediaObject, \"setVar().media\").map(({ key: breakpointName, value }) => {\n const mediaQuery = breakpointMediaQuery(mapping, `if${pascalCase(breakpointName)}`);\n if (mediaQuery === null) {\n throw new UnsupportedPatternError(\n `Unknown breakpoint \"${breakpointName}\" in setVar().media - use a Breakpoint name from truss-config`,\n );\n }\n const literal = requireValueLiteral(value, `setVar().media[${breakpointName}] must be a string or number literal`);\n return setVarLeaf(literal, baseContext, mediaQuery);\n });\n}\n\n/** I.e. `[{ gt: 400, value: \"10px\" }]` → one leaf per row, each under its `@container` query. */\nfunction setVarContainerLeaves(containerArray: t.ArrayExpression, baseContext: ResolvedConditionContext): SetVarLeaf[] {\n const leaves: SetVarLeaf[] = [];\n for (const element of containerArray.elements) {\n if (element === null) {\n continue;\n }\n if (!t.isObjectExpression(element)) {\n throw new UnsupportedPatternError(`setVar().container entries must be object literals`);\n }\n let rowValue: string | undefined;\n const bounds: ContainerBounds = {};\n for (const { key, value } of plainObjectEntries(element, \"setVar().container row\")) {\n if (key === \"value\") {\n rowValue = requireValueLiteral(value, `setVar().container row \"value\" must be a string or number literal`);\n } else if (!readContainerBound(bounds, key, value, \"setVar().container \")) {\n throw new UnsupportedPatternError(`setVar().container row does not support property \"${key}\"`);\n }\n }\n if (rowValue === undefined) {\n throw new UnsupportedPatternError(`setVar().container row requires a \"value\" property`);\n }\n if (bounds.lt === undefined && bounds.gt === undefined) {\n throw new UnsupportedPatternError(`setVar().container row requires at least one of gt or lt`);\n }\n leaves.push(setVarLeaf(rowValue, baseContext, containerQueryString(bounds)));\n }\n return leaves;\n}\n\n/** A leaf in the base context, or under `mediaQuery` when given. */\nfunction setVarLeaf(literal: string, baseContext: ResolvedConditionContext, mediaQuery?: string): SetVarLeaf {\n const context = cloneConditionContext(baseContext);\n if (mediaQuery !== undefined) {\n context.mediaQuery = mediaQuery;\n }\n return { literal, context };\n}\n","import * as t from \"@babel/types\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { numericLiteralValue, plainObjectEntries, singleArg, stringLiteralValue } from \"./resolve-literals\";\n\n/** The `{ gt, lt, name }` bounds shared by `ifContainer()` and `setVar().container` rows. */\nexport interface ContainerBounds {\n lt?: number;\n gt?: number;\n name?: string;\n}\n\n/** Resolve ifContainer({ gt, lt, name? }) to an `@container` query string. */\nexport function containerQueryFromCall(node: CallChainNode): string {\n const arg = singleArg(node, \"ifContainer\");\n if (!t.isObjectExpression(arg)) {\n throw new UnsupportedPatternError(\"ifContainer() expects an object literal argument\");\n }\n\n const bounds: ContainerBounds = {};\n for (const { key, value } of plainObjectEntries(arg, \"ifContainer()\")) {\n if (!readContainerBound(bounds, key, value, \"ifContainer().\")) {\n throw new UnsupportedPatternError(`ifContainer() does not support property \"${key}\"`);\n }\n }\n\n if (bounds.lt === undefined && bounds.gt === undefined) {\n throw new UnsupportedPatternError('ifContainer() requires at least one of \"lt\" or \"gt\"');\n }\n\n return containerQueryString(bounds);\n}\n\n/** Read one `lt`/`gt`/`name` bound into `bounds`; false when `key` is not a bound. */\nexport function readContainerBound(bounds: ContainerBounds, key: string, value: t.Expression, label: string): boolean {\n if (key === \"lt\") {\n bounds.lt = numericLiteralValue(value, `${label}lt must be a numeric literal`);\n return true;\n }\n if (key === \"gt\") {\n bounds.gt = numericLiteralValue(value, `${label}gt must be a numeric literal`);\n return true;\n }\n if (key === \"name\") {\n bounds.name = stringLiteralValue(value, `${label}name must be a string literal`);\n return true;\n }\n return false;\n}\n\n/** I.e. `{ gt: 400, lt: 800, name: \"card\" }` → `@container card (min-width: 401px) and (max-width: 800px)`. */\nexport function containerQueryString(bounds: ContainerBounds): string {\n const parts: string[] = [];\n if (bounds.gt !== undefined) {\n parts.push(`(min-width: ${bounds.gt + 1}px)`);\n }\n if (bounds.lt !== undefined) {\n parts.push(`(max-width: ${bounds.lt}px)`);\n }\n const namePrefix = bounds.name ? `${bounds.name} ` : \"\";\n return `@container ${namePrefix}${parts.join(\" and \")}`;\n}\n","import * as t from \"@babel/types\";\nimport type { CssSegment, ResolvedConditionContext, TrussMapping, VariableSegment, WhenCondition } from \"./types\";\nimport { breakpointNameForMediaQuery, findCanonicalAbbreviation } from \"./mapping-utils\";\nimport { cssPropertyAbbreviations } from \"./css-property-abbreviations\";\nimport { WHEN_RELATIONSHIPS } from \"./when-relationships\";\nimport { pseudoSelectorPrefix } from \"../pseudo-selectors\";\nimport { tryParseIncrementCalcMultiplier } from \"../spacing-css-var\";\n\n/**\n * One class/property pair derived from a segment; the shared model both CSS rules (emit-css)\n * and style hashes (emit-style-hash) consume.\n */\nexport interface StyleEntry {\n cssProp: string;\n className: string;\n isVariable: boolean;\n /** Whether this entry has a condition prefix (pseudo/media/when). */\n isConditional: boolean;\n /** Concrete CSS declaration value for emitted CSS rules. */\n cssValue: string;\n varName?: string;\n argNode?: t.Expression;\n /** Compile-time resolved tuple value for `_var` segments (e.g. `\"var(--theme-accent)\"`). */\n argResolved?: string;\n incremented?: boolean;\n appendPx?: boolean;\n}\n\n// ── Marker class helpers ──────────────────────────────────────────────\n\n/** I.e. the shared default marker class is `_mrk`. */\nexport const DEFAULT_MARKER_CLASS = \"_mrk\";\n\n/** I.e. `markerClassName(row)` → `\"_row_mrk\"`, `markerClassName()` → `\"_mrk\"`. */\nexport function markerClassName(markerNode?: t.Expression): string {\n if (!markerNode) return DEFAULT_MARKER_CLASS;\n if (t.isIdentifier(markerNode)) return `_${markerNode.name}_mrk`;\n return \"_marker_mrk\";\n}\n\n// ── Style entries ─────────────────────────────────────────────────────\n\n/**\n * Build normalized class/property entries from a segment for CSS and AST emitters.\n *\n * I.e. convert one resolved segment into the shared model both CSS rules and style hashes consume.\n */\nexport function styleEntriesForSegment(seg: CssSegment, mapping: TrussMapping): StyleEntry[] {\n const prefix = segmentClassPrefix(seg.condition, mapping);\n const isConditional = prefix !== \"\";\n\n if (seg.kind === \"variable\") {\n return variableStyleEntries(seg, mapping, prefix, isConditional);\n }\n\n return staticStyleEntries(seg, mapping, prefix, isConditional, seg.defs);\n}\n\n/**\n * Build entries for concrete CSS defs.\n *\n * I.e. `Css.ba.$` becomes separate `borderStyle -> bss` and `borderWidth -> bw1` entries.\n */\nfunction staticStyleEntries(\n seg: CssSegment,\n mapping: TrussMapping,\n prefix: string,\n isConditional: boolean,\n defs: Record<string, unknown>,\n forceLonghandNames = false,\n): StyleEntry[] {\n const isMultiProp = forceLonghandNames || Object.keys(defs).length > 1;\n\n return Object.entries(defs).map(([cssProp, value]) => {\n const cssValue = String(value);\n const baseName = computeStaticBaseName(seg, cssProp, cssValue, isMultiProp, mapping);\n return { cssProp, className: `${prefix}${baseName}`, isVariable: false, isConditional, cssValue };\n });\n}\n\n/**\n * Build entries for runtime variable CSS defs.\n *\n * I.e. `Css.mt(x).$` becomes `marginTop -> mt_var` plus `--marginTop` metadata,\n * and `Css.ifSm.mt(x).$` becomes `sm_mt_var` with `--sm_marginTop`.\n */\nfunction variableStyleEntries(\n seg: VariableSegment,\n mapping: TrussMapping,\n prefix: string,\n isConditional: boolean,\n): StyleEntry[] {\n const className = `${prefix}${seg.abbr}_var`;\n const entries: StyleEntry[] = seg.props.map((cssProp) => {\n const varName = `--${prefix}${cssProp}`;\n return {\n cssProp,\n className,\n isVariable: true,\n isConditional,\n cssValue: `var(${varName})`,\n varName,\n argNode: seg.argNode,\n argResolved: seg.argResolved,\n incremented: seg.incremented,\n appendPx: seg.appendPx,\n };\n });\n\n if (seg.extraDefs) {\n entries.push(...staticStyleEntries(seg, mapping, prefix, isConditional, seg.extraDefs, true));\n }\n\n return entries;\n}\n\n/**\n * Compute the base class name for a static segment.\n *\n * For multi-property abbreviations, looks up the canonical single-property\n * abbreviation name so classes are maximally reused.\n * I.e. `p1` → `pt1`, `pr1`, `pb1`, `pl1` (not `p1_paddingTop`, etc.)\n * I.e. `ba` → `bss`, `bw1` (not `ba_borderStyle`, etc.)\n * I.e. `lineClamp(\"3\")` display:-webkit-box → `d_negwebkit_box`, not `d_3`\n *\n * For literal-folded variables (argResolved set), includes the value:\n * I.e. `mt(2)` → `mt_2` (web increment calc), `mt(-1)` → `mt_neg1`, `bc(\"red\")` → `bc_red`.\n */\nfunction computeStaticBaseName(\n seg: CssSegment,\n cssProp: string,\n cssValue: string,\n isMultiProp: boolean,\n mapping: TrussMapping,\n): string {\n if (isMultiProp) {\n const canonical = findCanonicalAbbreviation(mapping, cssProp, cssValue);\n return canonical ?? `${getPropertyAbbreviation(cssProp)}_${classNameFragmentForResolvedValue(cssValue)}`;\n }\n if (seg.argResolved !== undefined) {\n return `${seg.abbr}_${classNameFragmentForResolvedValue(seg.argResolved)}`;\n }\n return seg.abbr;\n}\n\n// ── Class-name building blocks ────────────────────────────────────────\n\n/**\n * Build the condition prefix for a segment's class names.\n *\n * I.e. `ifSm.onHover.bgBlack` → `\"sm_h_\"` so the final class reads `sm_h_bgBlack`\n * (\"on sm + hover, bgBlack\"), and `when(row, \"ancestor\", \":hover\").blue` → `\"wh_anc_h_row_\"`.\n */\nfunction segmentClassPrefix(condition: ResolvedConditionContext, mapping: TrussMapping): string {\n const parts: string[] = [];\n if (condition.pseudoElement) {\n // I.e. \"::placeholder\" → \"placeholder_\"\n parts.push(`${condition.pseudoElement.replace(/^::/, \"\")}_`);\n }\n if (condition.mediaQuery) {\n // I.e. the `ifSm` breakpoint → \"sm_\"; any other media/container query is sanitized in full, i.e.\n // \"@media (min-width: 600px)\" → \"media_min_width_600px_\", so two different queries never share a class\n const breakpoint = breakpointNameForMediaQuery(mapping, condition.mediaQuery);\n parts.push(`${breakpoint ? breakpoint.toLowerCase() : sanitizeClassNameToken(condition.mediaQuery)}_`);\n }\n if (condition.pseudoClass) {\n parts.push(`${pseudoSelectorPrefix(condition.pseudoClass)}_`);\n }\n if (condition.whenPseudo) {\n parts.push(whenPrefix(condition.whenPseudo));\n }\n return parts.join(\"\");\n}\n\n/** I.e. `when(marker, \"ancestor\", \":hover\")` → `\"wh_anc_h_\"`, `when(row, …)` → `\"wh_anc_h_row_\"`. */\nfunction whenPrefix(whenPseudo: WhenCondition): string {\n const rel = WHEN_RELATIONSHIPS[whenPseudo.relationship].short;\n const pseudoPrefix = pseudoSelectorPrefix(whenPseudo.pseudo);\n const markerPart = whenPseudo.markerNode ? `${whenPseudo.markerNode.name}_` : \"\";\n return `wh_${rel}_${pseudoPrefix}_${markerPart}`;\n}\n\n/** I.e. `\"backgroundColor\"` → `\"background-color\"`, `\"WebkitTransform\"` → `\"-webkit-transform\"`. */\nexport function camelToKebab(s: string): string {\n return s.replace(/^(Webkit|Moz|Ms|O)/, (m) => `-${m.toLowerCase()}`).replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n}\n\n/** Collapse anything that is not a letter or digit into single underscores, i.e. `\"0 0 0 1px blue\"` → `\"0_0_0_1px_blue\"`. */\nexport function sanitizeClassNameToken(value: string): string {\n return value\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n}\n\n/** I.e. `\"-8px\"` → `\"neg8px\"`, `\"0 0 0 1px blue\"` → `\"0_0_0_1px_blue\"`. */\nfunction cleanValueForClassName(value: string): string {\n return sanitizeClassNameToken(value.startsWith(\"-\") ? `neg${value.slice(1)}` : value);\n}\n\n/** Class-name fragment for a resolved CSS value, i.e. `calc(var(--t-spacing) * 2)` → `\"2\"`, `\"red\"` → `\"red\"`. */\nfunction classNameFragmentForResolvedValue(value: string): string {\n return cleanValueForClassName(tryParseIncrementCalcMultiplier(value) ?? value);\n}\n\n/** I.e. `\"backgroundColor\"` → `\"bg\"` (from the abbreviation table), or the raw name as fallback. */\nfunction getPropertyAbbreviation(cssProp: string): string {\n return cssPropertyAbbreviations[cssProp] ?? cssProp;\n}\n","/**\n * Static mapping of CSS property names (camelCase) to unique short abbreviations.\n *\n * Used by the Truss compiler to generate compact, deterministic class names\n * when no user-defined canonical abbreviation exists for a given property+value.\n *\n * Convention: first letter of each camelCase word, with conflict resolution\n * via extra characters where needed. I.e. `borderBottomWidth` → `bbw`,\n * `flexDirection` → `fxd`, `fontSize` → `fz`.\n *\n * User-defined abbreviations (from the longhand lookup) always take priority\n * over these — this mapping is only the fallback.\n */\nexport const cssPropertyAbbreviations: Record<string, string> = {\n // Alignment\n alignContent: \"ac\",\n alignItems: \"ai\",\n alignSelf: \"als\",\n\n // Animation\n animation: \"anim\",\n animationDelay: \"animd\",\n animationDirection: \"animdr\",\n animationDuration: \"animdu\",\n animationFillMode: \"animfm\",\n animationIterationCount: \"animic\",\n animationName: \"animn\",\n animationPlayState: \"animps\",\n animationTimingFunction: \"animtf\",\n\n // Appearance\n appearance: \"app\",\n\n // Aspect ratio\n aspectRatio: \"ar\",\n\n // Backdrop filter\n backdropFilter: \"bdf\",\n\n // Background\n background: \"bg\",\n backgroundAttachment: \"bga\",\n backgroundBlendMode: \"bgbm\",\n backgroundClip: \"bgcl\",\n backgroundColor: \"bgc\",\n backgroundImage: \"bgi\",\n backgroundOrigin: \"bgo\",\n backgroundPosition: \"bgp\",\n backgroundRepeat: \"bgr\",\n backgroundSize: \"bgs\",\n\n // Border – shorthand\n border: \"bd\",\n borderCollapse: \"bdcl\",\n borderColor: \"bdc\",\n borderImage: \"bdi\",\n borderRadius: \"bra\",\n borderSpacing: \"bdsp\",\n borderStyle: \"bs\",\n borderWidth: \"bw\",\n\n // Border – top\n borderTop: \"bdt\",\n borderTopColor: \"btc\",\n borderTopLeftRadius: \"btlr\",\n borderTopRightRadius: \"btrr\",\n borderTopStyle: \"bts\",\n borderTopWidth: \"btw\",\n\n // Border – right\n borderRight: \"bdr\",\n borderRightColor: \"brc\",\n borderRightStyle: \"brs\",\n borderRightWidth: \"brw\",\n\n // Border – bottom\n borderBottom: \"bdb\",\n borderBottomColor: \"bbc\",\n borderBottomLeftRadius: \"bblr\",\n borderBottomRightRadius: \"bbrr\",\n borderBottomStyle: \"bbs\",\n borderBottomWidth: \"bbw\",\n\n // Border – left\n borderLeft: \"bdl\",\n borderLeftColor: \"blc\",\n borderLeftStyle: \"bls\",\n borderLeftWidth: \"blw\",\n\n // Box\n boxDecorationBreak: \"bxdb\",\n boxShadow: \"bxs\",\n boxSizing: \"bxz\",\n\n // Break\n breakAfter: \"bka\",\n breakBefore: \"bkb\",\n breakInside: \"bki\",\n\n // Caret / caption\n captionSide: \"cps\",\n caretColor: \"cac\",\n\n // Clear / clip\n clear: \"clr\",\n clip: \"cli\",\n clipPath: \"clp\",\n\n // Color\n color: \"c\",\n colorScheme: \"cs\",\n\n // Columns\n columnCount: \"cc\",\n columnFill: \"cf\",\n columnGap: \"cg\",\n columnRule: \"cr\",\n columnRuleColor: \"crc\",\n columnRuleStyle: \"crs\",\n columnRuleWidth: \"crw\",\n columnSpan: \"csp\",\n columnWidth: \"cw\",\n columns: \"cols\",\n\n // Contain / container\n contain: \"ctn\",\n containerName: \"ctnm\",\n containerType: \"ctnt\",\n content: \"cnt\",\n contentVisibility: \"cv\",\n\n // Counter\n counterIncrement: \"coi\",\n counterReset: \"cor\",\n\n // Cursor\n cursor: \"cur\",\n\n // Direction\n direction: \"dir\",\n\n // Display\n display: \"d\",\n\n // Empty cells\n emptyCells: \"ec\",\n\n // Fill (SVG)\n fill: \"fi\",\n fillOpacity: \"fio\",\n fillRule: \"fir\",\n\n // Filter\n filter: \"flt\",\n\n // Flex\n flex: \"fx\",\n flexBasis: \"fxb\",\n flexDirection: \"fxd\",\n flexFlow: \"fxf\",\n flexGrow: \"fxg\",\n flexShrink: \"fxs\",\n flexWrap: \"fxw\",\n\n // Float\n float: \"fl\",\n\n // Font\n font: \"fnt\",\n fontDisplay: \"fntd\",\n fontFamily: \"ff\",\n fontFeatureSettings: \"ffs\",\n fontKerning: \"fk\",\n fontSize: \"fz\",\n fontSizeAdjust: \"fza\",\n fontStretch: \"fst\",\n fontStyle: \"fsy\",\n fontSynthesis: \"fsyn\",\n fontVariant: \"fv\",\n fontVariantCaps: \"fvc\",\n fontVariantLigatures: \"fvl\",\n fontVariantNumeric: \"fvn\",\n fontWeight: \"fw\",\n\n // Gap\n gap: \"g\",\n\n // Grid\n grid: \"gd\",\n gridArea: \"ga\",\n gridAutoColumns: \"gac\",\n gridAutoFlow: \"gaf\",\n gridAutoRows: \"gar\",\n gridColumn: \"gc\",\n gridColumnEnd: \"gce\",\n gridColumnGap: \"gcg\",\n gridColumnStart: \"gcs\",\n gridGap: \"gg\",\n gridRow: \"gr\",\n gridRowEnd: \"gre\",\n gridRowGap: \"grg\",\n gridRowStart: \"grs\",\n gridTemplate: \"gt\",\n gridTemplateAreas: \"gta\",\n gridTemplateColumns: \"gtc\",\n gridTemplateRows: \"gtr\",\n\n // Height\n height: \"h\",\n maxHeight: \"mxh\",\n minHeight: \"mnh\",\n\n // Hyphens\n hyphens: \"hyp\",\n\n // Image rendering\n imageRendering: \"ir\",\n\n // Inset\n inset: \"ins\",\n insetBlock: \"insb\",\n insetBlockEnd: \"insbe\",\n insetBlockStart: \"insbs\",\n insetInline: \"insi\",\n insetInlineEnd: \"insie\",\n insetInlineStart: \"insis\",\n\n // Isolation\n isolation: \"iso\",\n\n // Justify\n justifyContent: \"jc\",\n justifyItems: \"ji\",\n justifySelf: \"jfs\",\n\n // Left\n left: \"l\",\n\n // Letter spacing\n letterSpacing: \"ls\",\n\n // Line\n lineBreak: \"lb\",\n lineHeight: \"lh\",\n\n // List\n listStyle: \"lis\",\n listStyleImage: \"lsi\",\n listStylePosition: \"lsp\",\n listStyleType: \"lst\",\n\n // Margin\n margin: \"m\",\n marginBlock: \"mbl\",\n marginBlockEnd: \"mble\",\n marginBlockStart: \"mbls\",\n marginBottom: \"mb\",\n marginInline: \"mil\",\n marginInlineEnd: \"mile\",\n marginInlineStart: \"mils\",\n marginLeft: \"ml\",\n marginRight: \"mr\",\n marginTop: \"mt\",\n\n // Mask\n mask: \"msk\",\n maskImage: \"mski\",\n maskPosition: \"mskp\",\n maskRepeat: \"mskr\",\n maskSize: \"msks\",\n\n // Max / min width\n maxWidth: \"mxw\",\n minWidth: \"mnw\",\n\n // Mix blend mode\n mixBlendMode: \"mbm\",\n\n // Object\n objectFit: \"obf\",\n objectPosition: \"obp\",\n\n // Offset\n offset: \"ofs\",\n offsetPath: \"ofsp\",\n\n // Opacity\n opacity: \"op\",\n\n // Order\n order: \"ord\",\n\n // Orphans / widows\n orphans: \"orp\",\n widows: \"wid\",\n\n // Outline\n outline: \"ol\",\n outlineColor: \"olc\",\n outlineOffset: \"olo\",\n outlineStyle: \"ols\",\n outlineWidth: \"olw\",\n\n // Overflow\n overflow: \"ov\",\n overflowAnchor: \"ova\",\n overflowWrap: \"ovw\",\n overflowX: \"ovx\",\n overflowY: \"ovy\",\n overscrollBehavior: \"osb\",\n overscrollBehaviorX: \"osbx\",\n overscrollBehaviorY: \"osby\",\n\n // Padding\n padding: \"p\",\n paddingBlock: \"pbl\",\n paddingBlockEnd: \"pble\",\n paddingBlockStart: \"pbls\",\n paddingBottom: \"pb\",\n paddingInline: \"pil\",\n paddingInlineEnd: \"pile\",\n paddingInlineStart: \"pils\",\n paddingLeft: \"pl\",\n paddingRight: \"pr\",\n paddingTop: \"pt\",\n\n // Page break\n pageBreakAfter: \"pgba\",\n pageBreakBefore: \"pgbb\",\n pageBreakInside: \"pgbi\",\n\n // Perspective\n perspective: \"per\",\n perspectiveOrigin: \"pero\",\n\n // Place\n placeContent: \"plc\",\n placeItems: \"pli\",\n placeSelf: \"pls\",\n\n // Pointer events\n pointerEvents: \"pe\",\n\n // Position\n position: \"pos\",\n\n // Quotes\n quotes: \"q\",\n\n // Resize\n resize: \"rsz\",\n\n // Right\n right: \"r\",\n\n // Rotate / scale\n rotate: \"rot\",\n scale: \"sc\",\n\n // Row gap\n rowGap: \"rg\",\n\n // Scroll\n scrollBehavior: \"scb\",\n scrollMargin: \"scm\",\n scrollPadding: \"scp\",\n scrollSnapAlign: \"ssa\",\n scrollSnapStop: \"sss\",\n scrollSnapType: \"sst\",\n scrollbarWidth: \"sbw\",\n\n // Shape\n shapeImageThreshold: \"sit\",\n shapeMargin: \"sm\",\n shapeOutside: \"so\",\n\n // Stroke (SVG)\n stroke: \"stk\",\n strokeDasharray: \"sda\",\n strokeDashoffset: \"sdo\",\n strokeLinecap: \"slc\",\n strokeLinejoin: \"slj\",\n strokeOpacity: \"sop\",\n strokeWidth: \"sw\",\n\n // Tab size\n tabSize: \"ts\",\n\n // Table layout\n tableLayout: \"tl\",\n\n // Text\n textAlign: \"ta\",\n textAlignLast: \"tal\",\n textDecoration: \"td\",\n textDecorationColor: \"tdc\",\n textDecorationLine: \"tdl\",\n textDecorationStyle: \"tds\",\n textDecorationThickness: \"tdt\",\n textEmphasis: \"te\",\n textIndent: \"ti\",\n textJustify: \"tj\",\n textOrientation: \"tor\",\n textOverflow: \"to\",\n textRendering: \"tr\",\n textShadow: \"tsh\",\n textTransform: \"tt\",\n textUnderlineOffset: \"tuo\",\n textUnderlinePosition: \"tup\",\n textWrap: \"twp\",\n\n // Top\n top: \"tp\",\n\n // Touch action\n touchAction: \"tca\",\n\n // Transform\n transform: \"tf\",\n transformOrigin: \"tfo\",\n transformStyle: \"tfs\",\n\n // Transition\n transition: \"tsn\",\n transitionDelay: \"tsnd\",\n transitionDuration: \"tsndu\",\n transitionProperty: \"tsnp\",\n transitionTimingFunction: \"tsntf\",\n\n // Translate\n translate: \"tsl\",\n\n // Unicode / user select\n unicodeBidi: \"ub\",\n userSelect: \"us\",\n\n // Vertical align\n verticalAlign: \"va\",\n\n // Visibility\n visibility: \"vis\",\n\n // Webkit\n WebkitAppearance: \"wkapp\",\n WebkitBackdropFilter: \"wkbdf\",\n WebkitBoxOrient: \"wbo\",\n WebkitFontSmoothing: \"wkfs\",\n WebkitLineClamp: \"wlc\",\n WebkitMaskImage: \"wkmi\",\n WebkitOverflowScrolling: \"wkos\",\n WebkitTapHighlightColor: \"wkthc\",\n WebkitTextFillColor: \"wktfc\",\n WebkitTextStrokeColor: \"wktsc\",\n WebkitTextStrokeWidth: \"wktsw\",\n\n // White space\n whiteSpace: \"ws\",\n\n // Width\n width: \"w\",\n\n // Will change\n willChange: \"wc\",\n\n // Word\n wordBreak: \"wdb\",\n wordSpacing: \"wds\",\n wordWrap: \"wdw\",\n writingMode: \"wm\",\n\n // Z-index\n zIndex: \"zi\",\n\n // Bottom (positioned after \"border*\" to avoid scan confusion)\n bottom: \"bot\",\n};\n\n// Validate uniqueness at module load time\nconst seen = new Map<string, string>();\nfor (const [prop, abbr] of Object.entries(cssPropertyAbbreviations)) {\n const existing = seen.get(abbr);\n if (existing) {\n throw new Error(`CSS property abbreviation conflict: \"${abbr}\" is used by both \"${existing}\" and \"${prop}\"`);\n }\n seen.set(abbr, prop);\n}\n","/**\n * The relationship kinds accepted by `when(marker, relationship, pseudo)`.\n *\n * Each kind owns its class-name fragment, its StyleX-style priority bump, and the\n * selector shape that ties the marker element to the styled target element.\n */\nexport type WhenRelationship = \"ancestor\" | \"descendant\" | \"anySibling\" | \"siblingBefore\" | \"siblingAfter\";\n\nexport interface WhenRelationshipSpec {\n /** Class-name fragment, i.e. `\"anc\"` in `wh_anc_h_blue`. */\n short: string;\n /** Base priority added to rules that use this relationship, matching StyleX's relational selector system. */\n priority: number;\n /**\n * Build the full rule selector.\n *\n * `marker` is the marker selector, i.e. `._row_mrk:hover`; `target` builds the styled element's\n * selector and accepts an extra pseudo-class to splice in before any pseudo-element.\n */\n selector(marker: string, target: (extraPseudoClass?: string) => string): string;\n}\n\n/** Keyed in the order the error message for an unknown relationship lists them. */\nexport const WHEN_RELATIONSHIPS: Readonly<Record<WhenRelationship, WhenRelationshipSpec>> = {\n ancestor: {\n short: \"anc\",\n priority: 10,\n /** I.e. `._mrk:hover .wh_anc_h_blue`. */\n selector(marker, target) {\n return `${marker} ${target()}`;\n },\n },\n descendant: {\n short: \"desc\",\n priority: 15,\n /** I.e. `.wh_desc_h_blue:has(._mrk:hover)`. */\n selector(marker, target) {\n return target(`:has(${marker})`);\n },\n },\n anySibling: {\n short: \"anyS\",\n priority: 20,\n /** I.e. `.wh_anyS_h_blue:has(~ ._mrk:hover), ._mrk:hover ~ .wh_anyS_h_blue`. */\n selector(marker, target) {\n return `${target(`:has(~ ${marker})`)}, ${marker} ~ ${target()}`;\n },\n },\n siblingBefore: {\n short: \"sibB\",\n priority: 30,\n /** I.e. `._mrk:hover ~ .wh_sibB_h_blue`. */\n selector(marker, target) {\n return `${marker} ~ ${target()}`;\n },\n },\n siblingAfter: {\n short: \"sibA\",\n priority: 40,\n /** I.e. `.wh_sibA_h_blue:has(~ ._mrk:hover)`. */\n selector(marker, target) {\n return target(`:has(~ ${marker})`);\n },\n },\n};\n\n/** True when `value` names one of the supported `when()` relationships. */\nexport function isWhenRelationship(value: string): value is WhenRelationship {\n return Object.hasOwn(WHEN_RELATIONSHIPS, value);\n}\n","/** Pseudo-class getter methods supported by CssBuilder chains. */\nexport const TRUSS_PSEUDO_METHODS: Readonly<Record<string, string>> = {\n onHover: \":hover\",\n onFocus: \":focus\",\n onFocusVisible: \":focus-visible\",\n onFocusWithin: \":focus-within\",\n onActive: \":active\",\n onDisabled: \":disabled\",\n ifFirstOfType: \":first-of-type\",\n ifLastOfType: \":last-of-type\",\n};\n\n/** Compact class-name prefixes for pseudo selectors. */\nconst PSEUDO_SELECTOR_PREFIXES: Readonly<Record<string, string>> = {\n \":hover\": \"h\",\n \":focus\": \"f\",\n \":focus-visible\": \"fv\",\n \":focus-within\": \"fw\",\n \":active\": \"a\",\n \":disabled\": \"d\",\n \":first-of-type\": \"fot\",\n \":last-of-type\": \"lot\",\n \":not\": \"n\",\n \":is\": \"is\",\n \":where\": \"where\",\n \":has\": \"has\",\n};\n\nexport function isTrussPseudoMethod(name: string): boolean {\n return name in TRUSS_PSEUDO_METHODS;\n}\n\nexport function trussPseudoSelector(name: string): string {\n return TRUSS_PSEUDO_METHODS[name];\n}\n\n/** I.e. `\":hover:not(:disabled)\"` -> `\"h_n_d\"`. */\nexport function pseudoSelectorPrefix(pseudo: string): string {\n const replaced = pseudo.trim().replace(/::?[a-zA-Z-]+/g, function pseudoMatchToPrefix(match) {\n return `_${pseudoIdentifierPrefix(match)}_`;\n });\n const cleaned = replaced\n .replace(/[^a-zA-Z0-9]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_|_$/g, \"\");\n return cleaned || \"pseudo\";\n}\n\n/** I.e. `\":hover\"` -> `\"h\"`, `\":focus-visible\"` -> `\"fv\"`. */\nfunction pseudoIdentifierPrefix(pseudo: string): string {\n const normalized = normalizePseudoIdentifier(pseudo);\n const known = PSEUDO_SELECTOR_PREFIXES[normalized];\n if (known) {\n return known;\n }\n return normalized.replace(/^::?/, \"\").replace(/-/g, \"_\");\n}\n\n/** I.e. `\":focusVisible\"` -> `\":focus-visible\"`. */\nfunction normalizePseudoIdentifier(pseudo: string): string {\n const prefixMatch = pseudo.match(/^::?/);\n const prefix = prefixMatch?.[0] ?? \"\";\n const name = pseudo.slice(prefix.length).replace(/[A-Z]/g, function upperToKebab(match) {\n return `-${match.toLowerCase()}`;\n });\n return `${prefix}${name}`;\n}\n","import * as t from \"@babel/types\";\nimport type { ResolvedConditionContext, ResolvedSegment, TrussMapping, WhenCondition } from \"./types\";\nimport { breakpointNameForMediaQuery } from \"./mapping-utils\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { resolveEntry } from \"./resolve-entry\";\nimport { singleArg } from \"./resolve-literals\";\nimport { sanitizeClassNameToken } from \"./style-entries\";\n\n/** Resolve `typography(key)` into either direct segments or a runtime lookup-backed segment. */\nexport function resolveTypographyCall(\n node: CallChainNode,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n const arg = singleArg(node, \"typography\");\n if (t.isStringLiteral(arg)) {\n return resolveTypographyEntry(arg.value, mapping, context);\n }\n\n const typography = mapping.typography ?? [];\n if (typography.length === 0) {\n throw new UnsupportedPatternError(`typography() is unavailable because no typography abbreviations were generated`);\n }\n\n const suffix = typographyLookupKeySuffix(context, mapping);\n const lookupKey = suffix ? `typography__${suffix}` : \"typography\";\n const segmentsByName: Record<string, ResolvedSegment[]> = {};\n for (const name of typography) {\n segmentsByName[name] = resolveTypographyEntry(name, mapping, context);\n }\n\n return [{ kind: \"typography\", lookupKey, argNode: arg, segmentsByName }];\n}\n\n/** Resolve a single typography abbreviation name within the current condition context. */\nfunction resolveTypographyEntry(\n name: string,\n mapping: TrussMapping,\n context: ResolvedConditionContext,\n): ResolvedSegment[] {\n if (!(mapping.typography ?? []).includes(name)) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const entry = mapping.abbreviations[name];\n if (!entry) {\n throw new UnsupportedPatternError(`Unknown typography abbreviation \"${name}\"`);\n }\n\n const resolved = resolveEntry(name, entry, mapping, context);\n for (const segment of resolved) {\n if (segment.kind === \"variable\") {\n throw new UnsupportedPatternError(`Typography abbreviation \"${name}\" cannot require runtime arguments`);\n }\n }\n return resolved;\n}\n\n/**\n * Build a typography lookup key suffix from condition context.\n *\n * I.e. `typography(key)` → `\"\"`, `ifSm.typography(key)` → `\"sm\"`, `onHover.typography(key)` → `\"hover\"`.\n */\nfunction typographyLookupKeySuffix(context: ResolvedConditionContext, mapping: TrussMapping): string {\n const parts: string[] = [];\n if (context.pseudoElement) parts.push(context.pseudoElement.replace(/^::/, \"\"));\n if (context.mediaQuery) {\n const breakpoint = breakpointNameForMediaQuery(mapping, context.mediaQuery);\n parts.push(\n breakpoint ? breakpoint.replace(/^./, (c) => c.toLowerCase()) : sanitizeClassNameToken(context.mediaQuery),\n );\n }\n if (context.pseudoClass) parts.push(context.pseudoClass.replace(/^:+/, \"\").replace(/-/g, \"_\"));\n if (context.whenPseudo) parts.push(whenLookupKeyPart(context.whenPseudo));\n return parts.join(\"_\");\n}\n\n/** I.e. `when(row, \"ancestor\", \":hover\")` → `\"when_ancestor_hover_row\"`. */\nfunction whenLookupKeyPart(whenPseudo: WhenCondition): string {\n const parts = [\"when\", whenPseudo.relationship, sanitizeClassNameToken(whenPseudo.pseudo) || \"value\"];\n if (whenPseudo.markerNode) {\n parts.push(whenPseudo.markerNode.name);\n }\n return parts.join(\"_\");\n}\n","import * as t from \"@babel/types\";\nimport type { WhenCondition } from \"./types\";\nimport { type CallChainNode, UnsupportedPatternError } from \"./chain-nodes\";\nimport { isWhenRelationship, WHEN_RELATIONSHIPS } from \"./when-relationships\";\n\n/** A same-element selector (`when(\":hover\")`) or a relationship to a marker (`when(marker, \"ancestor\", \":hover\")`). */\nexport type WhenCallResolution =\n | { kind: \"selector\"; selector: string }\n | { kind: \"relationship\"; condition: WhenCondition };\n\n/**\n * Resolve a `when(selector)` or `when(marker, relationship, pseudo)` call.\n *\n * - 1 arg: `when(\":hover\")` / `when('[data-state=\"open\"]')` — same-element selector,\n * must be a string literal\n * - 3 args: `when(marker, \"ancestor\", \":hover\")` — marker must be a marker variable or\n * the shared `marker` token, relationship/pseudo must be string literals\n *\n * The object form `when({ \":hover\": Css.blue.$ })` is handled by resolve-chain, since it recurses.\n */\nexport function resolveWhenCall(node: CallChainNode): WhenCallResolution {\n if (node.args.length !== 1 && node.args.length !== 3) {\n throw new UnsupportedPatternError(\n `when() expects 1 or 3 arguments (selector) or (marker, relationship, pseudo), got ${node.args.length}`,\n );\n }\n\n if (node.args.length === 1) {\n const selectorArg = node.args[0];\n if (!t.isStringLiteral(selectorArg)) {\n throw new UnsupportedPatternError(`when() selector must be a string literal`);\n }\n return { kind: \"selector\", selector: selectorArg.value };\n }\n\n const [markerArg, relationshipArg, pseudoArg] = node.args;\n const markerNode = resolveWhenMarker(markerArg);\n if (!t.isStringLiteral(relationshipArg)) {\n throw new UnsupportedPatternError(`when() relationship argument must be a string literal`);\n }\n const relationship = relationshipArg.value;\n if (!isWhenRelationship(relationship)) {\n throw new UnsupportedPatternError(\n `when() relationship must be one of: ${Object.keys(WHEN_RELATIONSHIPS).join(\", \")} -- got \"${relationship}\"`,\n );\n }\n if (!t.isStringLiteral(pseudoArg)) {\n throw new UnsupportedPatternError(`when() pseudo selector (3rd argument) must be a string literal`);\n }\n return { kind: \"relationship\", condition: { pseudo: pseudoArg.value, markerNode, relationship } };\n}\n\n/** The user's marker variable, or undefined for the shared default marker. */\nfunction resolveWhenMarker(node: t.Expression | t.SpreadElement): t.Identifier | undefined {\n if (isDefaultMarkerNode(node)) {\n return undefined;\n }\n if (t.isIdentifier(node)) {\n return node;\n }\n throw new UnsupportedPatternError(`when() marker must be a marker variable or marker`);\n}\n\n/** I.e. `marker`, `defaultMarker`, or the legacy `Css.defaultMarker()` call. */\nfunction isDefaultMarkerNode(node: t.Expression | t.SpreadElement): boolean {\n if (t.isIdentifier(node) && (node.name === \"marker\" || node.name === \"defaultMarker\")) {\n return true;\n }\n return (\n t.isCallExpression(node) &&\n node.arguments.length === 0 &&\n t.isMemberExpression(node.callee) &&\n !node.callee.computed &&\n t.isIdentifier(node.callee.property, { name: \"defaultMarker\" })\n );\n}\n","/** Return the complementary query used by `Css.*.else` media branches. */\nexport function invertMediaQuery(query: string): string {\n const screenPrefix = \"@media screen and \";\n if (query.startsWith(screenPrefix)) {\n const conditions = query.slice(screenPrefix.length).trim();\n const rangeMatch = conditions.match(/^\\(min-width: (\\d+)px\\) and \\(max-width: (\\d+)px\\)$/);\n if (rangeMatch) {\n const min = Number(rangeMatch[1]);\n const max = Number(rangeMatch[2]);\n return `@media screen and (max-width: ${min - 1}px), screen and (min-width: ${max + 1}px)`;\n }\n const minMatch = conditions.match(/^\\(min-width: (\\d+)px\\)$/);\n if (minMatch) {\n return `@media screen and (max-width: ${Number(minMatch[1]) - 1}px)`;\n }\n const maxMatch = conditions.match(/^\\(max-width: (\\d+)px\\)$/);\n if (maxMatch) {\n return `@media screen and (min-width: ${Number(maxMatch[1]) + 1}px)`;\n }\n }\n return query.replace(\"@media\", \"@media not\");\n}\n","/**\n * The sort key shared by `emit-css`, `merge-css`, and `runtime-css`, so a stylesheet merged from\n * library CSS or assembled rule by rule in jsdom keeps the same rule order as the per-file output.\n */\nexport interface RuleSortKey {\n priority: number;\n className: string;\n /** The px widths the rule's media or container query matches, or null when it has no readable interval. */\n widthInterval: WidthInterval | null;\n}\n\n/** The inclusive px widths a query matches; `hi` is Infinity for a min-width-only query. */\nexport interface WidthInterval {\n lo: number;\n hi: number;\n}\n\n/** I.e. `ruleSortKey(3200, \"lg_black\", \"@media screen and (min-width: 960px)\")` → `widthInterval: { lo: 960, hi: Infinity }`. */\nexport function ruleSortKey(priority: number, className: string, atRulePrelude: string | undefined): RuleSortKey {\n const widthInterval = atRulePrelude === undefined ? null : parseWidthInterval(atRulePrelude);\n return { priority, className, widthInterval };\n}\n\n/**\n * Order rules by priority, then by query width interval, then by class name.\n *\n * Priority ties happen between rules in the same tier for the same property, i.e. two `@media`\n * rules for `color`. Those are ordered widest interval first, so the narrower query is emitted\n * later and wins in the cascade wherever both match. Equal widths go by lower bound ascending,\n * and queries with no readable interval (`print`, `not`, comma lists, non-px units) come last,\n * as they do in StyleX. For one-sided queries this is min-width ascending, then max-width descending.\n *\n * The class-name tiebreak keeps the output fully deterministic regardless of file processing\n * order, which differs between dev HMR and production builds.\n *\n * I.e. `(min-width: 600px)` → `(min-width: 960px)` → `(max-width: 1150px)` → `(max-width: 820px)`\n * → `(min-width: 600px) and (max-width: 959px)` → `print`.\n */\nexport function compareRuleSortKeys(a: RuleSortKey, b: RuleSortKey): number {\n return (\n a.priority - b.priority ||\n compareWidthIntervals(a.widthInterval, b.widthInterval) ||\n compareClassNames(a.className, b.className)\n );\n}\n\n/** Code-point order, so identical class sets sort identically in dev and production. */\nexport function compareClassNames(a: string, b: string): number {\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** I.e. `\"@media (min-width: 600px) { .a.a { color: red; } }\"` → `\"@media (min-width: 600px)\"`, or undefined for a plain rule. */\nexport function atRulePrelude(cssText: string): string | undefined {\n if (!cssText.startsWith(\"@\")) return undefined;\n const brace = cssText.indexOf(\"{\");\n return brace === -1 ? undefined : cssText.slice(0, brace).trim();\n}\n\n/**\n * Parse the px width interval a `@media` or `@container` prelude matches.\n *\n * Only `and`-joined `(min-width: Npx)` / `(max-width: Npx)` terms are read. Other features such as\n * `(orientation: landscape)` and media types such as `screen` add no bound, and repeated terms\n * collapse to the effective bound. The result is exact for what it accepts, and null (\"no interval\")\n * for a prelude with no width term or with anything it cannot read exactly: comma lists, `not`,\n * `or`, range syntax, and non-px units.\n *\n * I.e. `\"@media screen and (min-width: 600px) and (max-width: 959px)\"` → `{ lo: 600, hi: 959 }`,\n * `\"@container grid (min-width: 601px)\"` → `{ lo: 601, hi: Infinity }`, `\"@media print\"` → null.\n */\nfunction parseWidthInterval(prelude: string): WidthInterval | null {\n if (/,|\\bnot\\b|\\bor\\b|[<>]/.test(prelude)) return null;\n const terms = Array.from(prelude.matchAll(/\\((min|max)-width:\\s*([^)]*)\\)/g));\n if (terms.length === 0) return null;\n let lo = 0;\n let hi = Infinity;\n for (const term of terms) {\n const px = parsePxLength(term[2]);\n if (px === null) return null;\n if (term[1] === \"min\") {\n lo = Math.max(lo, px);\n } else {\n hi = Math.min(hi, px);\n }\n }\n return { lo, hi };\n}\n\n/** I.e. `\"600px\"` → 600, `\"0\"` → 0, `\"40rem\"` → null. */\nfunction parsePxLength(value: string): number | null {\n const match = value.trim().match(/^(\\d+(?:\\.\\d+)?)(px)?$/);\n if (!match) return null;\n if (match[2] === undefined && Number(match[1]) !== 0) return null;\n return Number(match[1]);\n}\n\n/**\n * Widest interval first, equal widths by lower bound ascending, null last.\n *\n * I.e. `{ lo: 600, hi: Infinity }` (width Infinity) → `{ lo: 0, hi: 1150 }` (width 1150)\n * → `{ lo: 600, hi: 959 }` (width 359) → null.\n */\nfunction compareWidthIntervals(a: WidthInterval | null, b: WidthInterval | null): number {\n if (a === null || b === null) {\n return (a === null ? 1 : 0) - (b === null ? 1 : 0);\n }\n const widthA = a.hi - a.lo;\n const widthB = b.hi - b.lo;\n if (widthA !== widthB) return widthA > widthB ? -1 : 1;\n return a.lo - b.lo;\n}\n","/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * Converted from Flow to TypeScript; otherwise kept as-is for easy updates from upstream.\n * Source: https://github.com/facebook/stylex/blob/1ddee1dde1d55134c7d4f6889d8cbf34091e72fd/packages/%40stylexjs/shared/src/utils/property-priorities.js\n */\n\n// Physical properties that have logical equivalents:\nconst longHandPhysical = new Set<string>();\n// Logical properties *and* all other long hand properties:\nconst longHandLogical = new Set<string>();\n// Shorthand properties that override longhand properties:\nconst shorthandsOfLonghands = new Set<string>();\n// Shorthand properties that override other shorthand properties:\nconst shorthandsOfShorthands = new Set<string>();\n\n// Using MDN data as a source of truth to populate the above sets\n// by group in alphabetical order:\n\n// Composition and Blending\nlongHandLogical.add(\"background-blend-mode\");\nlongHandLogical.add(\"isolation\");\nlongHandLogical.add(\"mix-blend-mode\");\n\n// CSS Animations\nshorthandsOfShorthands.add(\"animation\");\nlongHandLogical.add(\"animation-composition\");\nlongHandLogical.add(\"animation-delay\");\nlongHandLogical.add(\"animation-direction\");\nlongHandLogical.add(\"animation-duration\");\nlongHandLogical.add(\"animation-fill-mode\");\nlongHandLogical.add(\"animation-iteration-count\");\nlongHandLogical.add(\"animation-name\");\nlongHandLogical.add(\"animation-play-state\");\nshorthandsOfLonghands.add(\"animation-range\");\nlongHandLogical.add(\"animation-range-end\");\nlongHandLogical.add(\"animation-range-start\");\nlongHandLogical.add(\"animation-timing-function\");\nlongHandLogical.add(\"animation-timeline\");\n\nshorthandsOfLonghands.add(\"scroll-timeline\");\nlongHandLogical.add(\"scroll-timeline-axis\");\nlongHandLogical.add(\"scroll-timeline-name\");\n\nlongHandLogical.add(\"timeline-scope\");\n\nshorthandsOfLonghands.add(\"view-timeline\");\nlongHandLogical.add(\"view-timeline-axis\");\nlongHandLogical.add(\"view-timeline-inset\");\nlongHandLogical.add(\"view-timeline-name\");\n\n// CSS Backgrounds and Borders\nshorthandsOfShorthands.add(\"background\");\nlongHandLogical.add(\"background-attachment\");\nlongHandLogical.add(\"background-clip\");\nlongHandLogical.add(\"background-color\");\nlongHandLogical.add(\"background-image\");\nlongHandLogical.add(\"background-origin\");\nlongHandLogical.add(\"background-repeat\");\nlongHandLogical.add(\"background-size\");\nshorthandsOfLonghands.add(\"background-position\");\nlongHandLogical.add(\"background-position-x\");\nlongHandLogical.add(\"background-position-y\");\n\nshorthandsOfShorthands.add(\"border\"); // OF SHORTHANDS!\nshorthandsOfLonghands.add(\"border-color\");\nshorthandsOfLonghands.add(\"border-style\");\nshorthandsOfLonghands.add(\"border-width\");\nshorthandsOfShorthands.add(\"border-block\"); // Logical Properties\nlongHandLogical.add(\"border-block-color\"); // Logical Properties\nlongHandLogical.add(\"border-block-stylex\"); // Logical Properties\nlongHandLogical.add(\"border-block-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-block-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-top\");\nlongHandLogical.add(\"border-block-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-top-color\");\nlongHandLogical.add(\"border-block-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-top-style\");\nlongHandLogical.add(\"border-block-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-top-width\");\nshorthandsOfLonghands.add(\"border-block-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-bottom\");\nlongHandLogical.add(\"border-block-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-color\");\nlongHandLogical.add(\"border-block-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-style\");\nlongHandLogical.add(\"border-block-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-bottom-width\");\nshorthandsOfShorthands.add(\"border-inline\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-color\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-style\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-width\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-inline-start\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-left\");\nlongHandLogical.add(\"border-inline-start-color\"); // Logical Properties\nlongHandPhysical.add(\"border-left-color\");\nlongHandLogical.add(\"border-inline-start-style\"); // Logical Properties\nlongHandPhysical.add(\"border-left-style\");\nlongHandLogical.add(\"border-inline-start-width\"); // Logical Properties\nlongHandPhysical.add(\"border-left-width\");\nshorthandsOfLonghands.add(\"border-inline-end\"); // Logical Properties\nshorthandsOfLonghands.add(\"border-right\");\nlongHandLogical.add(\"border-inline-end-color\"); // Logical Properties\nlongHandPhysical.add(\"border-right-color\");\nlongHandLogical.add(\"border-inline-end-style\"); // Logical Properties\nlongHandPhysical.add(\"border-right-style\");\nlongHandLogical.add(\"border-inline-end-width\"); // Logical Properties\nlongHandPhysical.add(\"border-right-width\");\n\nshorthandsOfLonghands.add(\"border-image\");\nlongHandLogical.add(\"border-image-outset\");\nlongHandLogical.add(\"border-image-repeat\");\nlongHandLogical.add(\"border-image-slice\");\nlongHandLogical.add(\"border-image-source\");\nlongHandLogical.add(\"border-image-width\");\n\nshorthandsOfLonghands.add(\"border-radius\");\nlongHandLogical.add(\"border-start-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-start-start-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-end-radius\"); // Logical Properties\nlongHandLogical.add(\"border-end-start-radius\"); // Logical Properties\nlongHandPhysical.add(\"border-top-left-radius\");\nlongHandPhysical.add(\"border-top-right-radius\");\nlongHandPhysical.add(\"border-bottom-left-radius\");\nlongHandPhysical.add(\"border-bottom-right-radius\");\n\nshorthandsOfLonghands.add(\"corner-shape\");\nlongHandLogical.add(\"corner-start-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-start-end-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-start-shape\"); // Logical Properties\nlongHandLogical.add(\"corner-end-end-shape\"); // Logical Properties\nlongHandPhysical.add(\"corner-top-left-shape\");\nlongHandPhysical.add(\"corner-top-right-shape\");\nlongHandPhysical.add(\"corner-bottom-left-shape\");\nlongHandPhysical.add(\"corner-bottom-right-shape\");\n\nlongHandLogical.add(\"box-shadow\");\n\n// CSS Basic User Interface\nlongHandLogical.add(\"accent-color\");\nlongHandLogical.add(\"appearance\");\nlongHandLogical.add(\"aspect-ratio\");\n\nshorthandsOfLonghands.add(\"caret\");\nlongHandLogical.add(\"caret-color\");\nlongHandLogical.add(\"caret-shape\");\n\nlongHandLogical.add(\"cursor\");\nlongHandLogical.add(\"ime-mode\");\nlongHandLogical.add(\"input-security\");\n\nshorthandsOfLonghands.add(\"outline\");\nlongHandLogical.add(\"outline-color\");\nlongHandLogical.add(\"outline-offset\");\nlongHandLogical.add(\"outline-style\");\nlongHandLogical.add(\"outline-width\");\n\nlongHandLogical.add(\"pointer-events\");\nlongHandLogical.add(\"resize\"); // horizontal, vertical, block, inline, both\nlongHandLogical.add(\"text-overflow\");\nlongHandLogical.add(\"user-select\");\n\n// CSS Box Alignment\nshorthandsOfLonghands.add(\"grid-gap\"); // alias for `gap`\nshorthandsOfLonghands.add(\"gap\");\nlongHandLogical.add(\"grid-row-gap\"); // alias for `row-gap`\nlongHandLogical.add(\"row-gap\");\nlongHandLogical.add(\"grid-column-gap\"); // alias for `column-gap`\nlongHandLogical.add(\"column-gap\");\n\nshorthandsOfLonghands.add(\"place-content\");\nlongHandLogical.add(\"align-content\");\nlongHandLogical.add(\"justify-content\");\n\nshorthandsOfLonghands.add(\"place-items\");\nlongHandLogical.add(\"align-items\");\nlongHandLogical.add(\"justify-items\");\n\nshorthandsOfLonghands.add(\"place-self\");\nlongHandLogical.add(\"align-self\");\nlongHandLogical.add(\"justify-self\");\n\n// CSS Box Model\nlongHandLogical.add(\"box-sizing\");\n\nlongHandLogical.add(\"block-size\"); // Logical Properties\nlongHandPhysical.add(\"height\");\nlongHandLogical.add(\"inline-size\"); // Logical Properties\nlongHandPhysical.add(\"width\");\n\nlongHandLogical.add(\"max-block-size\"); // Logical Properties\nlongHandPhysical.add(\"max-height\");\nlongHandLogical.add(\"max-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"max-width\");\nlongHandLogical.add(\"min-block-size\"); // Logical Properties\nlongHandPhysical.add(\"min-height\");\nlongHandLogical.add(\"min-inline-size\"); // Logical Properties\nlongHandPhysical.add(\"min-width\");\n\nshorthandsOfShorthands.add(\"margin\");\nshorthandsOfLonghands.add(\"margin-block\"); // Logical Properties\nlongHandLogical.add(\"margin-block-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-top\");\nlongHandLogical.add(\"margin-block-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-bottom\");\nshorthandsOfLonghands.add(\"margin-inline\"); // Logical Properties\nlongHandLogical.add(\"margin-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"margin-left\");\nlongHandLogical.add(\"margin-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"margin-right\");\n\nlongHandLogical.add(\"margin-trim\");\n\nshorthandsOfLonghands.add(\"overscroll-behavior\");\nlongHandLogical.add(\"overscroll-behavior-block\");\nlongHandPhysical.add(\"overscroll-behavior-y\");\nlongHandLogical.add(\"overscroll-behavior-inline\");\nlongHandPhysical.add(\"overscroll-behavior-x\");\n\nshorthandsOfShorthands.add(\"padding\");\nshorthandsOfLonghands.add(\"padding-block\"); // Logical Properties\nlongHandLogical.add(\"padding-block-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-top\");\nlongHandLogical.add(\"padding-block-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-bottom\");\nshorthandsOfLonghands.add(\"padding-inline\"); // Logical Properties\nlongHandLogical.add(\"padding-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"padding-left\");\nlongHandLogical.add(\"padding-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"padding-right\");\n\nlongHandLogical.add(\"visibility\");\n\n// CSS Color\nlongHandLogical.add(\"color\");\nlongHandLogical.add(\"color-scheme\");\nlongHandLogical.add(\"forced-color-adjust\");\nlongHandLogical.add(\"opacity\");\nlongHandLogical.add(\"print-color-adjust\");\n\n// CSS Columns\nshorthandsOfLonghands.add(\"columns\");\nlongHandLogical.add(\"column-count\");\nlongHandLogical.add(\"column-width\");\n\nlongHandLogical.add(\"column-fill\");\nlongHandLogical.add(\"column-span\");\n\nshorthandsOfLonghands.add(\"column-rule\");\nlongHandLogical.add(\"column-rule-color\");\nlongHandLogical.add(\"column-rule-style\");\nlongHandLogical.add(\"column-rule-width\");\n\n// CSS Containment\nlongHandLogical.add(\"contain\");\n\nshorthandsOfLonghands.add(\"contain-intrinsic-size\");\nlongHandLogical.add(\"contain-intrinsic-block-size\");\nlongHandLogical.add(\"contain-intrinsic-width\");\nlongHandLogical.add(\"contain-intrinsic-height\");\nlongHandLogical.add(\"contain-intrinsic-inline-size\");\n\nshorthandsOfLonghands.add(\"container\");\nlongHandLogical.add(\"container-name\");\nlongHandLogical.add(\"container-type\");\n\nlongHandLogical.add(\"content-visibility\");\n\n// CSS Counter Styles\nlongHandLogical.add(\"counter-increment\");\nlongHandLogical.add(\"counter-reset\");\nlongHandLogical.add(\"counter-set\");\n\n// CSS Display\nlongHandLogical.add(\"display\");\n\n// CSS Flexible Box Layout\nshorthandsOfLonghands.add(\"flex\");\nlongHandLogical.add(\"flex-basis\");\nlongHandLogical.add(\"flex-grow\");\nlongHandLogical.add(\"flex-shrink\");\n\nshorthandsOfLonghands.add(\"flex-flow\");\nlongHandLogical.add(\"flex-direction\");\nlongHandLogical.add(\"flex-wrap\");\n\nlongHandLogical.add(\"order\");\n\n// CSS Fonts\nshorthandsOfShorthands.add(\"font\");\nlongHandLogical.add(\"font-family\");\nlongHandLogical.add(\"font-size\");\nlongHandLogical.add(\"font-stretch\");\nlongHandLogical.add(\"font-style\");\nlongHandLogical.add(\"font-weight\");\nlongHandLogical.add(\"line-height\");\nshorthandsOfLonghands.add(\"font-variant\");\nlongHandLogical.add(\"font-variant-alternates\");\nlongHandLogical.add(\"font-variant-caps\");\nlongHandLogical.add(\"font-variant-east-asian\");\nlongHandLogical.add(\"font-variant-emoji\");\nlongHandLogical.add(\"font-variant-ligatures\");\nlongHandLogical.add(\"font-variant-numeric\");\nlongHandLogical.add(\"font-variant-position\");\n\nlongHandLogical.add(\"font-feature-settings\");\nlongHandLogical.add(\"font-kerning\");\nlongHandLogical.add(\"font-language-override\");\nlongHandLogical.add(\"font-optical-sizing\");\nlongHandLogical.add(\"font-palette\");\nlongHandLogical.add(\"font-variation-settings\");\nlongHandLogical.add(\"font-size-adjust\");\nlongHandLogical.add(\"font-smooth\"); // Non-standard\nlongHandLogical.add(\"font-synthesis-position\");\nlongHandLogical.add(\"font-synthesis-small-caps\");\nlongHandLogical.add(\"font-synthesis-style\");\nlongHandLogical.add(\"font-synthesis-weight\");\n\nlongHandLogical.add(\"line-height-step\");\n\n// CSS Fragmentation\nlongHandLogical.add(\"box-decoration-break\");\nlongHandLogical.add(\"break-after\");\nlongHandLogical.add(\"break-before\");\nlongHandLogical.add(\"break-inside\");\nlongHandLogical.add(\"orphans\");\nlongHandLogical.add(\"widows\");\n\n// CSS Generated Content\nlongHandLogical.add(\"content\");\nlongHandLogical.add(\"quotes\");\n\n// CSS Grid Layout\nshorthandsOfShorthands.add(\"grid\");\nlongHandLogical.add(\"grid-auto-flow\");\nlongHandLogical.add(\"grid-auto-rows\");\nlongHandLogical.add(\"grid-auto-columns\");\nshorthandsOfShorthands.add(\"grid-template\");\nshorthandsOfLonghands.add(\"grid-template-areas\");\nlongHandLogical.add(\"grid-template-columns\");\nlongHandLogical.add(\"grid-template-rows\");\n\nshorthandsOfShorthands.add(\"grid-area\");\nshorthandsOfLonghands.add(\"grid-row\");\nlongHandLogical.add(\"grid-row-start\");\nlongHandLogical.add(\"grid-row-end\");\nshorthandsOfLonghands.add(\"grid-column\");\nlongHandLogical.add(\"grid-column-start\");\nlongHandLogical.add(\"grid-column-end\");\n\nlongHandLogical.add(\"align-tracks\");\nlongHandLogical.add(\"justify-tracks\");\nlongHandLogical.add(\"masonry-auto-flow\");\n\n// CSS Images\nlongHandLogical.add(\"image-orientation\");\nlongHandLogical.add(\"image-rendering\");\nlongHandLogical.add(\"image-resolution\");\nlongHandLogical.add(\"object-fit\");\nlongHandLogical.add(\"object-position\");\n\n// CSS Inline\nlongHandLogical.add(\"initial-letter\");\nlongHandLogical.add(\"initial-letter-align\");\n\n// CSS Lists and Counters\nshorthandsOfLonghands.add(\"list-style\");\nlongHandLogical.add(\"list-style-image\");\nlongHandLogical.add(\"list-style-position\");\nlongHandLogical.add(\"list-style-type\");\n\n// CSS Masking\nlongHandLogical.add(\"clip\"); // @deprecated\nlongHandLogical.add(\"clip-path\");\n\nshorthandsOfLonghands.add(\"mask\");\nlongHandLogical.add(\"mask-clip\");\nlongHandLogical.add(\"mask-composite\");\nlongHandLogical.add(\"mask-image\");\nlongHandLogical.add(\"mask-mode\");\nlongHandLogical.add(\"mask-origin\");\nlongHandLogical.add(\"mask-position\");\nlongHandLogical.add(\"mask-repeat\");\nlongHandLogical.add(\"mask-size\");\n\nlongHandLogical.add(\"mask-type\");\n\nshorthandsOfLonghands.add(\"mask-border\");\nlongHandLogical.add(\"mask-border-mode\");\nlongHandLogical.add(\"mask-border-outset\");\nlongHandLogical.add(\"mask-border-repeat\");\nlongHandLogical.add(\"mask-border-slice\");\nlongHandLogical.add(\"mask-border-source\");\nlongHandLogical.add(\"mask-border-width\");\n\n// CSS Miscellaneous\nshorthandsOfShorthands.add(\"all\"); // avoid!\nlongHandLogical.add(\"text-rendering\");\n\n// CSS Motion Path\nshorthandsOfLonghands.add(\"offset\");\nlongHandLogical.add(\"offset-anchor\");\nlongHandLogical.add(\"offset-distance\");\nlongHandLogical.add(\"offset-path\");\nlongHandLogical.add(\"offset-position\");\nlongHandLogical.add(\"offset-rotate\");\n\n// CSS Overflow\nlongHandLogical.add(\"-webkit-box-orient\");\nlongHandLogical.add(\"-webkit-line-clamp\");\n\nshorthandsOfLonghands.add(\"overflow\");\nlongHandLogical.add(\"overflow-block\");\nlongHandPhysical.add(\"overflow-y\");\nlongHandLogical.add(\"overflow-inline\");\nlongHandPhysical.add(\"overflow-x\");\n\nlongHandLogical.add(\"overflow-clip-margin\"); // partial support\n\nlongHandLogical.add(\"scroll-gutter\");\nlongHandLogical.add(\"scroll-behavior\");\n\n// CSS Pages\nlongHandLogical.add(\"page\");\nlongHandLogical.add(\"page-break-after\");\nlongHandLogical.add(\"page-break-before\");\nlongHandLogical.add(\"page-break-inside\");\n\n// CSS Positioning\nshorthandsOfShorthands.add(\"inset\"); // Logical Properties\nshorthandsOfLonghands.add(\"inset-block\"); // Logical Properties\nlongHandLogical.add(\"inset-block-start\"); // Logical Properties\nlongHandPhysical.add(\"top\");\nlongHandLogical.add(\"inset-block-end\"); // Logical Properties\nlongHandPhysical.add(\"bottom\");\nshorthandsOfLonghands.add(\"inset-inline\"); // Logical Properties\nlongHandLogical.add(\"inset-inline-start\"); // Logical Properties\nlongHandPhysical.add(\"left\");\nlongHandLogical.add(\"inset-inline-end\"); // Logical Properties\nlongHandPhysical.add(\"right\");\n\nlongHandLogical.add(\"clear\");\nlongHandLogical.add(\"float\");\nlongHandLogical.add(\"position\");\nlongHandLogical.add(\"z-index\");\n\n// CSS Ruby\nlongHandLogical.add(\"ruby-align\");\nlongHandLogical.add(\"ruby-merge\");\nlongHandLogical.add(\"ruby-position\");\n\n// CSS Scroll Anchoring\nlongHandLogical.add(\"overflow-anchor\");\n\n// CSS Scroll Snap\nshorthandsOfShorthands.add(\"scroll-margin\");\nshorthandsOfLonghands.add(\"scroll-margin-block\");\nlongHandLogical.add(\"scroll-margin-block-start\");\nlongHandPhysical.add(\"scroll-margin-top\");\nlongHandLogical.add(\"scroll-margin-block-end\");\nlongHandPhysical.add(\"scroll-margin-bottom\");\nshorthandsOfLonghands.add(\"scroll-margin-inline\");\nlongHandLogical.add(\"scroll-margin-inline-start\");\nlongHandPhysical.add(\"scroll-margin-left\");\nlongHandLogical.add(\"scroll-margin-inline-end\");\nlongHandPhysical.add(\"scroll-margin-right\");\n\nshorthandsOfShorthands.add(\"scroll-padding\");\nshorthandsOfLonghands.add(\"scroll-padding-block\");\nlongHandLogical.add(\"scroll-padding-block-start\");\nlongHandPhysical.add(\"scroll-padding-top\");\nlongHandLogical.add(\"scroll-padding-block-end\");\nlongHandPhysical.add(\"scroll-padding-bottom\");\nshorthandsOfLonghands.add(\"scroll-padding-inline\");\nlongHandLogical.add(\"scroll-padding-inline-start\");\nlongHandPhysical.add(\"scroll-padding-left\");\nlongHandLogical.add(\"scroll-padding-inline-end\");\nlongHandPhysical.add(\"scroll-padding-right\");\n\nlongHandLogical.add(\"scroll-snap-align\");\nlongHandLogical.add(\"scroll-snap-stop\");\nshorthandsOfLonghands.add(\"scroll-snap-type\");\n\n// CSS Scrollbars\nlongHandLogical.add(\"scrollbar-color\");\nlongHandLogical.add(\"scrollbar-width\");\n\n// CSS Shapes\nlongHandLogical.add(\"shape-image-threshold\");\nlongHandLogical.add(\"shape-margin\");\nlongHandLogical.add(\"shape-outside\");\n\n// CSS Speech\nlongHandLogical.add(\"azimuth\");\n\n// CSS Table\nlongHandLogical.add(\"border-collapse\");\nlongHandLogical.add(\"border-spacing\");\nlongHandLogical.add(\"caption-side\");\nlongHandLogical.add(\"empty-cells\");\nlongHandLogical.add(\"table-layout\");\nlongHandLogical.add(\"vertical-align\");\n\n// CSS Text Decoration\nshorthandsOfLonghands.add(\"text-decoration\");\nlongHandLogical.add(\"text-decoration-color\");\nlongHandLogical.add(\"text-decoration-line\");\nlongHandLogical.add(\"text-decoration-skip\");\nlongHandLogical.add(\"text-decoration-skip-ink\");\nlongHandLogical.add(\"text-decoration-style\");\nlongHandLogical.add(\"text-decoration-thickness\");\n\nshorthandsOfLonghands.add(\"text-emphasis\");\nlongHandLogical.add(\"text-emphasis-color\");\nlongHandLogical.add(\"text-emphasis-position\");\nlongHandLogical.add(\"text-emphasis-style\");\nlongHandLogical.add(\"text-shadow\");\nlongHandLogical.add(\"text-underline-offset\");\nlongHandLogical.add(\"text-underline-position\");\n\n// CSS Text\nlongHandLogical.add(\"hanging-punctuation\");\nlongHandLogical.add(\"hyphenate-character\");\nlongHandLogical.add(\"hyphenate-limit-chars\");\nlongHandLogical.add(\"hyphens\");\nlongHandLogical.add(\"letter-spacing\");\nlongHandLogical.add(\"line-break\");\nlongHandLogical.add(\"overflow-wrap\");\nlongHandLogical.add(\"paint-order\");\nlongHandLogical.add(\"tab-size\");\nlongHandLogical.add(\"text-align\");\nlongHandLogical.add(\"text-align-last\");\nlongHandLogical.add(\"text-indent\");\nlongHandLogical.add(\"text-justify\");\nlongHandLogical.add(\"text-size-adjust\");\nlongHandLogical.add(\"text-transform\");\nlongHandLogical.add(\"text-wrap\");\nlongHandLogical.add(\"white-space\");\nlongHandLogical.add(\"white-space-collapse\");\nlongHandLogical.add(\"word-break\");\nlongHandLogical.add(\"word-spacing\");\nlongHandLogical.add(\"word-wrap\");\n\n// CSS Transforms\nlongHandLogical.add(\"backface-visibility\");\nlongHandLogical.add(\"perspective\");\nlongHandLogical.add(\"perspective-origin\");\nlongHandLogical.add(\"rotate\");\nlongHandLogical.add(\"scale\");\nlongHandLogical.add(\"transform\");\nlongHandLogical.add(\"transform-box\");\nlongHandLogical.add(\"transform-origin\");\nlongHandLogical.add(\"transform-style\");\nlongHandLogical.add(\"translate\");\n\n// CSS Transitions\nshorthandsOfLonghands.add(\"transition\");\nlongHandLogical.add(\"transition-delay\");\nlongHandLogical.add(\"transition-duration\");\nlongHandLogical.add(\"transition-property\");\nlongHandLogical.add(\"transition-timing-function\");\n\n// CSS View Transitions\nlongHandLogical.add(\"view-transition-name\");\n\n// CSS Will Change\nlongHandLogical.add(\"will-change\");\n\n// CSS Writing Modes\nlongHandLogical.add(\"direction\");\nlongHandLogical.add(\"text-combine-upright\");\nlongHandLogical.add(\"text-orientation\");\nlongHandLogical.add(\"unicode-bidi\");\nlongHandLogical.add(\"writing-mode\");\n\n// CSS Filter Effects\nlongHandLogical.add(\"backdrop-filter\");\nlongHandLogical.add(\"filter\");\n\n// MathML\nlongHandLogical.add(\"math-depth\");\nlongHandLogical.add(\"math-shift\");\nlongHandLogical.add(\"math-style\");\n\n// CSS Pointer Events\nlongHandLogical.add(\"touch-action\");\n\nexport const PSEUDO_CLASS_PRIORITIES: Readonly<Record<string, number>> = {\n \":is\": 40,\n \":where\": 40,\n \":not\": 40,\n \":has\": 45,\n \":dir\": 50,\n \":lang\": 51,\n \":first-child\": 52,\n \":first-of-type\": 53,\n \":last-child\": 54,\n \":last-of-type\": 55,\n \":only-child\": 56,\n \":only-of-type\": 57,\n \":nth-child\": 60,\n \":nth-last-child\": 61,\n \":nth-of-type\": 62,\n \":nth-last-of-type\": 63,\n \":empty\": 70,\n \":link\": 80,\n \":any-link\": 81,\n \":local-link\": 82,\n \":target-within\": 83,\n \":target\": 84,\n \":visited\": 85,\n \":enabled\": 91,\n \":disabled\": 92,\n \":required\": 93,\n \":optional\": 94,\n \":read-only\": 95,\n \":read-write\": 96,\n \":placeholder-shown\": 97,\n \":in-range\": 98,\n \":out-of-range\": 99,\n \":default\": 100,\n \":checked\": 101,\n \":indeterminate\": 101,\n \":blank\": 102,\n \":valid\": 103,\n \":invalid\": 104,\n \":user-invalid\": 105,\n \":autofill\": 110,\n \":picture-in-picture\": 120,\n \":modal\": 121,\n \":fullscreen\": 122,\n \":paused\": 123,\n \":playing\": 124,\n \":current\": 125,\n \":past\": 126,\n \":future\": 127,\n \":hover\": 130,\n \":focus-within\": 140,\n \":focus\": 150,\n \":focus-visible\": 160,\n \":active\": 170,\n};\n\nexport const AT_RULE_PRIORITIES: Readonly<Record<string, number>> = {\n \"@supports\": 30,\n \"@media\": 200,\n \"@container\": 300,\n};\n\nexport const PSEUDO_ELEMENT_PRIORITY: number = 5000;\n\n/** Get the property tier for a CSS property (kebab-case). */\nexport function getPropertyPriority(property: string): number {\n if (shorthandsOfShorthands.has(property)) return 1000;\n if (shorthandsOfLonghands.has(property)) return 2000;\n if (longHandLogical.has(property)) return 3000;\n if (longHandPhysical.has(property)) return 4000;\n // Unknown properties default to 3000 (longhand) — safest default\n return 3000;\n}\n\n/** Get the priority for a pseudo-class selector. */\nexport function getPseudoClassPriority(pseudo: string): number {\n const leadingPseudo = pseudo.trim().match(/^::?[a-zA-Z-]+/)?.[0] ?? pseudo.split(\"(\")[0];\n const base = leadingPseudo.replace(/[A-Z]/g, (match) => {\n return `-${match.toLowerCase()}`;\n });\n return PSEUDO_CLASS_PRIORITIES[base] ?? 40;\n}\n\n/** Get the priority for an at-rule. */\nexport function getAtRulePriority(atRule: string): number {\n if (atRule.startsWith(\"--\")) return 1;\n if (atRule.startsWith(\"@supports\")) return AT_RULE_PRIORITIES[\"@supports\"];\n if (atRule.startsWith(\"@media\")) return AT_RULE_PRIORITIES[\"@media\"];\n if (atRule.startsWith(\"@container\")) return AT_RULE_PRIORITIES[\"@container\"];\n return 0;\n}\n","/**\n * Computes CSS rule priority using StyleX's priority system.\n *\n * Priority is an additive sum: propertyPriority + pseudoPriority + atRulePriority + pseudoElementPriority.\n * Rules are sorted by this number before emission, guaranteeing longhands beat shorthands,\n * pseudo-classes follow LVFHA order, and at-rules override base styles — all deterministically.\n *\n * Rules that tie on priority, i.e. two `@media` rules for the same property, are ordered by the\n * width interval their query matches, widest first, so the narrower query is emitted later and\n * wins wherever both match. See `compareRuleSortKeys`.\n */\n\nimport { compareRuleSortKeys, ruleSortKey } from \"../css-order\";\nimport {\n getPropertyPriority,\n getPseudoClassPriority,\n getAtRulePriority,\n PSEUDO_ELEMENT_PRIORITY,\n} from \"./property-priorities\";\nimport { WHEN_RELATIONSHIPS } from \"./when-relationships\";\nimport type { AtomicRule } from \"./emit-css\";\n\n/**\n * Compute the numeric priority for a single AtomicRule.\n *\n * I.e. a rule with `declarations: [{ cssProperty: \"border-top-color\", ... }]`, `pseudoClass: \":hover\"`,\n * `mediaQuery: \"@media ...\"` → 4000 (physical longhand) + 130 (:hover) + 200 (@media) = 4330\n */\nexport function computeRulePriority(rule: AtomicRule): number {\n let priority = getPropertyPriority(rule.declarations[0].cssProperty);\n\n if (rule.pseudoElement) {\n priority += PSEUDO_ELEMENT_PRIORITY;\n }\n\n if (rule.pseudoClass) {\n priority += getPseudoClassPriority(rule.pseudoClass);\n }\n\n if (rule.mediaQuery) {\n priority += getAtRulePriority(rule.mediaQuery);\n }\n\n if (rule.whenSelector) {\n const relBase = WHEN_RELATIONSHIPS[rule.whenSelector.relationship].priority;\n const pseudoFraction = getPseudoClassPriority(rule.whenSelector.pseudo) / 100;\n priority += relBase + pseudoFraction;\n }\n\n // Variable rules get a small bonus (+0.5) so they sort after static rules for the same property\n if (isVariableRule(rule)) {\n priority += 0.5;\n }\n\n return priority;\n}\n\n/** Returns true if this rule uses CSS custom property var() values. */\nfunction isVariableRule(rule: AtomicRule): boolean {\n return rule.declarations.some((d) => d.cssVarName !== undefined);\n}\n\n/**\n * Pair each rule with its computed priority and sort with `compareRuleSortKeys`.\n *\n * Priorities and width intervals are computed once upfront so the O(n log n) comparisons are just\n * number/string compares, and callers can reuse the priorities for the `@truss p:` annotations.\n */\nexport function sortRulesByPriority(rules: Iterable<AtomicRule>): Array<{ rule: AtomicRule; priority: number }> {\n const decorated = Array.from(rules, (rule) => {\n const priority = computeRulePriority(rule);\n return { rule, priority, key: ruleSortKey(priority, rule.className, rule.mediaQuery) };\n });\n decorated.sort((a, b) => compareRuleSortKeys(a.key, b.key));\n return decorated.map((d) => ({ rule: d.rule, priority: d.priority }));\n}\n","import type { ParsedArbitraryCssBlock, ParsedCssRule, ParsedPropertyDeclaration, ParsedTrussCss } from \"../truss-css\";\n\n/** Regex matching `/* @truss p:<priority> c:<className> *\\/` annotations. */\nconst RULE_ANNOTATION_RE = /^\\/\\* @truss p:([\\d.]+) c:(\\S+) \\*\\/$/;\n\n/** Regex matching `/* @truss @property *\\/` annotations. */\nconst PROPERTY_ANNOTATION_RE = /^\\/\\* @truss @property \\*\\/$/;\n\n/** Regex matching the start of an annotated arbitrary CSS block. */\nconst ARBITRARY_START_RE = /^\\/\\* @truss arbitrary:start \\*\\/$/;\n\n/** Regex matching the end of an annotated arbitrary CSS block. */\nconst ARBITRARY_END_RE = /^\\/\\* @truss arbitrary:end \\*\\/$/;\n\n/** Regex to extract the variable name from `@property --foo { ... }`. */\nconst PROPERTY_VAR_RE = /^@property\\s+(--\\S+)/;\n\n/**\n * Parse an annotated truss.css file into rules, @property declarations,\n * and arbitrary CSS blocks.\n *\n * The file must contain `/* @truss p:<priority> c:<className> *\\/` comments\n * before each CSS rule, and `/* @truss @property *\\/` before each @property declaration.\n * Unannotated lines are ignored.\n */\nexport function parseTrussCss(cssText: string): ParsedTrussCss {\n const lines = cssText.split(\"\\n\");\n const rules: ParsedCssRule[] = [];\n const properties: ParsedPropertyDeclaration[] = [];\n const arbitraryCssBlocks: ParsedArbitraryCssBlock[] = [];\n\n let i = 0;\n\n /** Advance past the current annotation line and any blank lines to the annotated content line. */\n function takeAnnotatedLine(): string | null {\n i++;\n while (i < lines.length && lines[i].trim() === \"\") i++;\n return i < lines.length ? lines[i].trim() : null;\n }\n\n while (i < lines.length) {\n const line = lines[i].trim();\n\n // Check for rule annotation\n const ruleMatch = RULE_ANNOTATION_RE.exec(line);\n if (ruleMatch) {\n const cssText = takeAnnotatedLine();\n if (cssText !== null) {\n rules.push({ priority: parseFloat(ruleMatch[1]), className: ruleMatch[2], cssText });\n }\n i++;\n continue;\n }\n\n // Check for @property annotation\n if (PROPERTY_ANNOTATION_RE.test(line)) {\n const propLine = takeAnnotatedLine();\n const varMatch = propLine === null ? null : PROPERTY_VAR_RE.exec(propLine);\n if (propLine !== null && varMatch) {\n properties.push({ cssText: propLine, varName: varMatch[1] });\n }\n i++;\n continue;\n }\n\n if (ARBITRARY_START_RE.test(line)) {\n i++;\n const blockLines: string[] = [];\n while (i < lines.length && !ARBITRARY_END_RE.test(lines[i].trim())) {\n blockLines.push(lines[i]);\n i++;\n }\n const blockText = blockLines.join(\"\\n\").trim();\n if (blockText.length > 0) {\n arbitraryCssBlocks.push({ cssText: blockText });\n }\n if (i < lines.length && ARBITRARY_END_RE.test(lines[i].trim())) {\n i++;\n }\n continue;\n }\n\n i++;\n }\n\n return { rules, properties, arbitraryCssBlocks };\n}\n\n/** Serialize structured CSS without changing rule order or removing duplicate declarations. */\nexport function serializeTrussCss(css: ParsedTrussCss): string {\n const lines: string[] = [];\n for (const rule of css.rules) {\n lines.push(`/* @truss p:${rule.priority} c:${rule.className} */`, rule.cssText);\n }\n for (const prop of css.properties) {\n lines.push(`/* @truss @property */`, prop.cssText);\n }\n for (const block of css.arbitraryCssBlocks) {\n lines.push(annotateArbitraryCssBlock(block.cssText));\n }\n return lines.join(\"\\n\");\n}\n\n/** Wrap an arbitrary CSS block in annotations so it survives later Truss merges. */\nexport function annotateArbitraryCssBlock(cssText: string): string {\n const trimmed = cssText.trim();\n if (trimmed.length === 0) {\n return \"\";\n }\n return [\"/* @truss arbitrary:start */\", trimmed, \"/* @truss arbitrary:end */\"].join(\"\\n\");\n}\n","import { chainSegments, type ResolvedChain } from \"./resolve-chain\";\nimport { isCssSegment, type CssSegment, type ResolvedSegment, type TrussMapping, type WhenCondition } from \"./types\";\nimport { sortRulesByPriority } from \"./priority\";\nimport { camelToKebab, markerClassName, styleEntriesForSegment } from \"./style-entries\";\nimport { WHEN_RELATIONSHIPS, type WhenRelationship } from \"./when-relationships\";\nimport { variableValueNeedsMaybeCssVar } from \"../css-custom-property\";\nimport type { ParsedTrussCss } from \"../truss-css\";\nimport { serializeTrussCss } from \"./truss-css\";\n\n// ── Atomic CSS rule model ─────────────────────────────────────────────\n\n/**\n * A single atomic CSS rule: one class, one selector, one or more declarations.\n *\n * I.e. `.black { color: #353535; }` is one AtomicRule with a single declaration,\n * while `sq(x)` produces one AtomicRule with two declarations (`height` + `width`).\n */\nexport interface AtomicRule {\n /** I.e. `\"sm_h_blue\"` — the generated class name including condition prefixes. */\n className: string;\n /**\n * The CSS property/value pairs this rule sets. Always has at least one entry.\n *\n * I.e. `[{ cssProperty: \"color\", cssValue: \"#526675\" }]` for a static rule, or\n * `[{ cssProperty: \"height\", cssValue: \"var(--height)\", cssVarName: \"--height\" },\n * { cssProperty: \"width\", cssValue: \"var(--width)\", cssVarName: \"--width\" }]` for `sq(x)`.\n */\n declarations: AtomicDeclaration[];\n pseudoClass?: string;\n mediaQuery?: string;\n pseudoElement?: string;\n /** I.e. `when(row, \"ancestor\", \":hover\")` → `{ relationship: \"ancestor\", markerClass: \"_row_mrk\", pseudo: \":hover\" }`. */\n whenSelector?: WhenSelector;\n}\n\nexport interface AtomicDeclaration {\n cssProperty: string;\n cssValue: string;\n /** I.e. `\"--marginTop\"` — present when this declaration uses a CSS custom property. */\n cssVarName?: string;\n}\n\nexport interface WhenSelector {\n relationship: WhenRelationship;\n markerClass: string;\n pseudo: string;\n}\n\n// ── Collecting atomic rules from resolved chains ──────────────────────\n\nexport interface CollectedRules {\n rules: Map<string, AtomicRule>;\n needsMaybeInc: boolean;\n needsMaybeCssVar: boolean;\n}\n\n/**\n * Collect all atomic CSS rules from resolved chains.\n *\n * I.e. walks every segment in every chain part and registers one AtomicRule\n * per CSS declaration, keyed by the prefixed class name.\n */\nexport function collectAtomicRules(chains: ResolvedChain[], mapping: TrussMapping): CollectedRules {\n const rules = new Map<string, AtomicRule>();\n let needsMaybeInc = false;\n let needsMaybeCssVar = false;\n\n function collectSegment(seg: ResolvedSegment): void {\n if (seg.kind === \"typography\") {\n for (const segments of Object.values(seg.segmentsByName)) {\n segments.forEach(collectSegment);\n }\n return;\n }\n if (!isCssSegment(seg)) return;\n if (seg.kind === \"variable\") {\n if (seg.incremented) needsMaybeInc = true;\n if (seg.argResolved === undefined && variableValueNeedsMaybeCssVar(seg)) needsMaybeCssVar = true;\n }\n collectSegmentRules(rules, seg, mapping);\n }\n\n for (const chain of chains) {\n chainSegments(chain).forEach(collectSegment);\n }\n\n return { rules, needsMaybeInc, needsMaybeCssVar };\n}\n\n/** Collect atomic CSS rules for one resolved style segment. */\nfunction collectSegmentRules(rules: Map<string, AtomicRule>, seg: CssSegment, mapping: TrussMapping): void {\n const { condition } = seg;\n\n for (const entry of styleEntriesForSegment(seg, mapping)) {\n const declaration: AtomicDeclaration = {\n cssProperty: camelToKebab(entry.cssProp),\n cssValue: entry.cssValue,\n ...(entry.varName ? { cssVarName: entry.varName } : {}),\n };\n const existingRule = rules.get(entry.className);\n if (!existingRule) {\n rules.set(entry.className, {\n className: entry.className,\n declarations: [declaration],\n pseudoClass: condition.pseudoClass ?? undefined,\n mediaQuery: condition.mediaQuery ?? undefined,\n pseudoElement: condition.pseudoElement ?? undefined,\n whenSelector: condition.whenPseudo ? whenSelectorFor(condition.whenPseudo) : undefined,\n });\n continue;\n }\n\n // I.e. `sq(x)` registers `height` and then `width` on the one `sq_var` rule.\n const alreadyDeclared = existingRule.declarations.some(\n (existing) => existing.cssProperty === declaration.cssProperty,\n );\n if (!alreadyDeclared) {\n existingRule.declarations.push(declaration);\n }\n }\n}\n\n/** I.e. `when(row, \"ancestor\", \":hover\")` → `{ relationship: \"ancestor\", markerClass: \"_row_mrk\", pseudo: \":hover\" }`. */\nfunction whenSelectorFor(whenPseudo: WhenCondition): WhenSelector {\n return {\n relationship: whenPseudo.relationship,\n markerClass: markerClassName(whenPseudo.markerNode),\n pseudo: whenPseudo.pseudo,\n };\n}\n\n// ── CSS text generation ───────────────────────────────────────────────\n\n/**\n * Generate the full CSS text from collected rules, sorted by StyleX priority.\n *\n * I.e. produces output like:\n * ```\n * /* @truss p:3000 c:black *\\/\n * .black { color: #353535; }\n * /* @truss p:3200 c:sm_blue *\\/\n * @media screen and (max-width: 599px) { .sm_blue.sm_blue { color: #526675; } }\n * ```\n */\nexport function generateCssText(rules: Map<string, AtomicRule>): string {\n return serializeTrussCss(generateCssData(rules));\n}\n\n/** Generate sorted atomic CSS data, retaining every emitted custom property declaration. */\nexport function generateCssData(rules: Map<string, AtomicRule>): ParsedTrussCss {\n const sorted = sortRulesByPriority(rules.values());\n const css: ParsedTrussCss = {\n rules: sorted.map((entry) => ({\n priority: entry.priority,\n className: entry.rule.className,\n cssText: formatRule(entry.rule),\n })),\n properties: [],\n arbitraryCssBlocks: [],\n };\n\n // I.e. `@property --marginTop { syntax: \"*\"; inherits: false; }` for variable rules\n for (const { rule } of sorted) {\n for (const declaration of rule.declarations) {\n if (declaration.cssVarName) {\n css.properties.push({\n varName: declaration.cssVarName,\n cssText: `@property ${declaration.cssVarName} { syntax: \"*\"; inherits: false; }`,\n });\n }\n }\n }\n\n return css;\n}\n\n/**\n * Format a single rule into its CSS text.\n *\n * I.e. a base rule → `.black { color: #353535; }`,\n * a media rule → `@media (...) { .sm_blue.sm_blue { color: #526675; } }`,\n * a when rule → `._mrk:hover .wh_anc_h_blue { color: #526675; }`.\n *\n * Inside a media query the class is doubled (`.sm_blue.sm_blue`) so it outranks the base class.\n */\nfunction formatRule(rule: AtomicRule): string {\n const duplicateClassName = !!rule.mediaQuery;\n const whenSelector = rule.whenSelector;\n const selector = whenSelector\n ? WHEN_RELATIONSHIPS[whenSelector.relationship].selector(\n `.${whenSelector.markerClass}${whenSelector.pseudo}`,\n (extraPseudoClass) => buildTargetSelector(rule, duplicateClassName, extraPseudoClass),\n )\n : buildTargetSelector(rule, duplicateClassName);\n\n const body = rule.declarations.map((d) => `${d.cssProperty}: ${d.cssValue};`).join(\" \");\n const block = `${selector} { ${body} }`;\n return rule.mediaQuery ? `${rule.mediaQuery} { ${block} }` : block;\n}\n\n/**\n * Assemble the target element's CSS selector from all active condition slots.\n *\n * I.e. `buildTargetSelector(rule, true)` → `.sm_h_blue.sm_h_blue:hover`,\n * `buildTargetSelector(rule, false, \":has(._mrk:hover)\")` → `.wh_anc_h_blue:has(._mrk:hover)`.\n */\nfunction buildTargetSelector(rule: AtomicRule, duplicateClassName: boolean, extraPseudoClass = \"\"): string {\n const classSelector = duplicateClassName ? `.${rule.className}.${rule.className}` : `.${rule.className}`;\n return `${classSelector}${rule.pseudoClass ?? \"\"}${extraPseudoClass}${rule.pseudoElement ?? \"\"}`;\n}\n","import * as t from \"@babel/types\";\nimport type { TrussMapping } from \"./types\";\nimport { resolveFullChain } from \"./resolve-chain\";\nimport { extractDollarChain, findCssImportBinding, unwrapExpression } from \"./ast-utils\";\nimport { collectStaticStringBindings, resolveStaticString } from \"./css-ts-utils\";\nimport { camelToKebab } from \"./style-entries\";\nimport { parseModule } from \"./babel-utils\";\n\n/**\n * Transform a `.css.ts` file into a plain CSS string.\n *\n * The file is expected to have the shape:\n * ```ts\n * import { Css } from \"./Css\";\n * export const css = {\n * \".some-selector\": Css.df.blue.$,\n * \".other > .selector\": Css.mt(2).black.$,\n * body: `\n * margin: 0;\n * font-size: 14px !important;\n * `,\n * };\n * ```\n *\n * Each key is a CSS selector (string literal), each value is either a `Css.*.$`\n * chain or a string literal / template literal containing raw CSS declarations.\n * The chains are resolved via the truss mapping into concrete CSS declarations.\n *\n * Returns the generated CSS string.\n */\nexport function transformCssTs(code: string, filename: string, mapping: TrussMapping): string {\n const ast = parseModule(code, filename);\n\n // Css import is optional — only needed when Css.*.$ chains are used\n const cssBindingName = findCssImportBinding(ast);\n\n // Find the `export const css = { ... }` expression\n const cssExport = findNamedCssExportObject(ast);\n if (!cssExport) {\n return `/* [truss] ${filename}: expected \\`export const css = { ... }\\` with an object literal */\\n`;\n }\n\n const rules: string[] = [];\n const stringBindings = collectStaticStringBindings(ast);\n\n for (const prop of cssExport.properties) {\n if (t.isSpreadElement(prop)) {\n rules.push(`/* [truss] unsupported: spread elements in css.ts export */`);\n continue;\n }\n\n if (!t.isObjectProperty(prop)) {\n rules.push(`/* [truss] unsupported: non-property in css.ts export */`);\n continue;\n }\n\n // Key must be a string literal (the CSS selector)\n const selector = objectPropertyStringKey(prop, stringBindings);\n if (selector === null) {\n rules.push(`/* [truss] unsupported: non-string-literal key in css.ts export */`);\n continue;\n }\n\n const valueNode = prop.value;\n\n // String literal or template literal → pass through as raw CSS\n const rawCss = extractStaticStringValue(valueNode, cssBindingName);\n if (rawCss !== null) {\n rules.push(formatRawCssRule(selector, rawCss));\n continue;\n }\n\n // Otherwise value must be a Css.*.$ expression\n if (!t.isExpression(valueNode)) {\n rules.push(`/* [truss] unsupported: \"${selector}\" value is not an expression */`);\n continue;\n }\n\n if (!cssBindingName) {\n rules.push(`/* [truss] unsupported: \"${selector}\" — Css.*.$ chain requires a Css import */`);\n continue;\n }\n\n const cssResult = resolveCssExpression(valueNode, cssBindingName, mapping, filename);\n if (\"error\" in cssResult) {\n rules.push(`/* [truss] unsupported: \"${selector}\" — ${cssResult.error} */`);\n continue;\n }\n\n rules.push(formatCssRule(selector, cssResult.declarations));\n }\n\n return rules.join(\"\\n\\n\") + \"\\n\";\n}\n\n/** Find the object expression in `export const css = { ... }`. */\nfunction findNamedCssExportObject(ast: t.File): t.ObjectExpression | null {\n for (const node of ast.program.body) {\n if (!t.isExportNamedDeclaration(node) || !node.declaration) continue;\n if (!t.isVariableDeclaration(node.declaration)) continue;\n\n for (const declarator of node.declaration.declarations) {\n if (!t.isIdentifier(declarator.id, { name: \"css\" }) || !declarator.init) continue;\n // I.e. also accept `export const css = { ... } satisfies Record<string, ...>`\n const value = unwrapExpression(declarator.init);\n if (t.isObjectExpression(value)) return value;\n }\n }\n return null;\n}\n\n/** Extract a static string key from an ObjectProperty. */\nfunction objectPropertyStringKey(prop: t.ObjectProperty, stringBindings: Map<string, string>): string | null {\n if (t.isStringLiteral(prop.key)) return prop.key.value;\n // Allow unquoted identifiers as keys too (e.g. `body: Css.df.$`)\n if (t.isIdentifier(prop.key) && !prop.computed) return prop.key.name;\n if (prop.computed) return resolveStaticString(prop.key, stringBindings);\n return null;\n}\n\n/**\n * Extract a static string from a StringLiteral, a no-expression TemplateLiteral,\n * or a `Css.raw` tagged template literal (i.e. `Css.raw\\`...\\``).\n */\nfunction extractStaticStringValue(node: t.Node, cssBindingName: string | null): string | null {\n if (t.isStringLiteral(node)) return node.value;\n if (t.isTemplateLiteral(node) && node.expressions.length === 0 && node.quasis.length === 1) {\n return node.quasis[0].value.cooked ?? node.quasis[0].value.raw;\n }\n // Css.raw`...` tagged template literal\n if (\n t.isTaggedTemplateExpression(node) &&\n t.isMemberExpression(node.tag) &&\n !node.tag.computed &&\n t.isIdentifier(node.tag.property, { name: \"raw\" }) &&\n t.isIdentifier(node.tag.object, { name: cssBindingName ?? \"\" }) &&\n node.quasi.expressions.length === 0 &&\n node.quasi.quasis.length === 1\n ) {\n return node.quasi.quasis[0].value.cooked ?? node.quasi.quasis[0].value.raw;\n }\n return null;\n}\n\ninterface CssResolution {\n declarations: Array<{ property: string; value: string }>;\n error?: undefined;\n}\ninterface CssError {\n declarations?: undefined;\n error: string;\n}\n\n/**\n * Resolve a `Css.*.$` expression node to CSS declarations.\n *\n * Validates that the chain only uses static/literal patterns (no variable args,\n * no if/else conditionals, no pseudo/media modifiers).\n */\nfunction resolveCssExpression(\n node: t.Expression,\n cssBindingName: string,\n mapping: TrussMapping,\n filename: string,\n): CssResolution | CssError {\n // The expression must be a `Css.*.$` chain rooted at the Css import\n const chain = extractDollarChain(node, cssBindingName);\n if (!chain) {\n return { error: \"value must be a Css.*.$ expression\" };\n }\n\n // Validate: no if/else nodes\n for (const n of chain) {\n if (n.type === \"if\") return { error: \"if() conditionals are not supported in .css.ts files\" };\n if (n.type === \"else\") return { error: \"else is not supported in .css.ts files\" };\n if (n.type === \"call\" && n.name === \"when\") {\n return { error: \"when() modifiers are not supported in .css.ts files\" };\n }\n }\n\n const resolved = resolveFullChain({ mapping, cssBindingName }, chain);\n\n // Check for errors from resolution\n if (resolved.errors.length > 0) {\n return { error: resolved.errors[0] };\n }\n\n // Validate: no conditionals came back\n for (const part of resolved.parts) {\n if (part.type === \"conditional\") {\n return { error: \"conditional chains are not supported in .css.ts files\" };\n }\n }\n\n // Collect all declarations from all unconditional parts\n const declarations: Array<{ property: string; value: string }> = [];\n\n for (const part of resolved.parts) {\n if (part.type !== \"unconditional\") continue;\n for (const seg of part.segments) {\n // Reject segments that need the runtime: variables with runtime args and the non-CSS kinds\n if (seg.kind === \"error\") {\n return { error: seg.message };\n }\n if (seg.kind === \"variable\" && seg.argResolved === undefined) {\n return { error: `variable value with variable argument is not supported in .css.ts files` };\n }\n if (seg.kind === \"typography\") {\n return { error: `typography() with a runtime key is not supported in .css.ts files` };\n }\n if (seg.kind === \"composed\") {\n return { error: `add(cssProp) is not supported in .css.ts files` };\n }\n if (seg.kind === \"inlineStyle\") {\n return { error: `style() is not supported in .css.ts files` };\n }\n if (seg.kind === \"className\") {\n return { error: `className() is not supported in .css.ts files` };\n }\n\n // Reject segments with media query / pseudo-class / pseudo-element / when modifiers\n const { condition } = seg;\n if (condition.mediaQuery) {\n return { error: `media query modifiers (ifSm, ifMd, etc.) are not supported in .css.ts files` };\n }\n if (condition.pseudoClass) {\n return { error: `pseudo-class modifiers (onHover, onFocus, etc.) are not supported in .css.ts files` };\n }\n if (condition.pseudoElement) {\n return { error: `pseudo-element modifiers are not supported in .css.ts files` };\n }\n if (condition.whenPseudo) {\n return { error: `when() modifiers are not supported in .css.ts files` };\n }\n\n // I.e. a token variable `mt(Tokens.gap)` declares `var(--gap)` for each of its props\n const pairs: Array<[string, unknown]> =\n seg.kind === \"variable\" ? seg.props.map((prop) => [prop, seg.argResolved]) : Object.entries(seg.defs);\n for (const [prop, value] of pairs) {\n if (typeof value === \"string\" || typeof value === \"number\") {\n declarations.push({ property: camelToKebab(prop), value: String(value) });\n } else {\n // Nested condition objects (shouldn't happen after our validation, but defensive)\n return { error: `unexpected nested value for property \"${prop}\"` };\n }\n }\n }\n }\n\n return { declarations };\n}\n\n/** Format a CSS rule block from a raw CSS string, passed through as-is. */\nfunction formatRawCssRule(selector: string, raw: string): string {\n const trimmed = raw.trim();\n if (!trimmed) return `${selector} {}`;\n // Indent each non-empty line by two spaces\n const body = trimmed\n .split(\"\\n\")\n .map((line) => ` ${line.trim()}`)\n .filter((line) => line.trim().length > 0)\n .join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n\n/** Format a CSS rule block. */\nfunction formatCssRule(selector: string, declarations: Array<{ property: string; value: string }>): string {\n if (declarations.length === 0) {\n return `${selector} {}`;\n }\n const body = declarations.map((d) => ` ${d.property}: ${d.value};`).join(\"\\n\");\n return `${selector} {\\n${body}\\n}`;\n}\n","import * as t from \"@babel/types\";\nimport { unwrapExpression } from \"./ast-utils\";\n\n/** Resolve module-scope string constants so .css.ts selectors can reuse them. */\nexport function collectStaticStringBindings(ast: t.File): Map<string, string> {\n const bindings = new Map<string, string>();\n let changed = true;\n\n while (changed) {\n changed = false;\n\n for (const node of ast.program.body) {\n const declaration = getTopLevelVariableDeclaration(node);\n if (!declaration) continue;\n\n for (const declarator of declaration.declarations) {\n if (!t.isIdentifier(declarator.id) || !declarator.init) continue;\n if (bindings.has(declarator.id.name)) continue;\n\n const value = resolveStaticString(declarator.init, bindings);\n if (value === null) continue;\n\n bindings.set(declarator.id.name, value);\n changed = true;\n }\n }\n }\n\n return bindings;\n}\n\n/** Resolve a static string expression from a literal, template, or identifier. */\nexport function resolveStaticString(node: t.Node | null | undefined, bindings: Map<string, string>): string | null {\n if (!node) return null;\n if (t.isExpression(node)) node = unwrapExpression(node);\n\n if (t.isStringLiteral(node)) return node.value;\n\n if (t.isTemplateLiteral(node)) {\n let value = \"\";\n for (let i = 0; i < node.quasis.length; i++) {\n value += node.quasis[i].value.cooked ?? \"\";\n if (i >= node.expressions.length) continue;\n\n const expressionValue = resolveStaticString(node.expressions[i], bindings);\n if (expressionValue === null) return null;\n value += expressionValue;\n }\n return value;\n }\n\n if (t.isIdentifier(node)) {\n return bindings.get(node.name) ?? null;\n }\n\n if (t.isBinaryExpression(node, { operator: \"+\" })) {\n const left = resolveStaticString(node.left, bindings);\n const right = resolveStaticString(node.right, bindings);\n if (left === null || right === null) return null;\n return left + right;\n }\n\n return null;\n}\n\nfunction getTopLevelVariableDeclaration(node: t.Statement): t.VariableDeclaration | null {\n if (t.isVariableDeclaration(node)) {\n return node;\n }\n\n if (t.isExportNamedDeclaration(node) && node.declaration && t.isVariableDeclaration(node.declaration)) {\n return node.declaration;\n }\n\n return null;\n}\n","import type { NodePath } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { basename } from \"path\";\nimport type { TrussMapping, ResolvedSegment } from \"./types\";\nimport { chainSegments, resolveFullChain, type CssChainReferenceResolver, type ResolvedChain } from \"./resolve-chain\";\nimport { generate, parseModule, traverse } from \"./babel-utils\";\nimport {\n extractChain,\n extractDollarChain,\n findCssBuilderBinding,\n findCssImportBinding,\n findImportDeclaration,\n findNamedImportBinding,\n insertAfterLeadingImports,\n isCssMethodCall,\n removeCssImport,\n replaceCssImportWithNamedImports,\n reservePreferredName,\n unwrapExpression,\n upsertNamedImports,\n type NamedImport,\n} from \"./ast-utils\";\nimport { collectAtomicRules, generateCssData, type AtomicRule } from \"./emit-css\";\nimport { serializeTrussCss } from \"./truss-css\";\nimport { createTestCssPayload } from \"./test-css\";\nimport { buildMaybeIncDeclaration, buildRuntimeLookupDeclaration } from \"./emit-style-hash\";\nimport {\n rewriteExpressionSites,\n type ExpressionSite,\n type RuntimeHelperName,\n type RuntimeHelpers,\n} from \"./rewrite-sites\";\n\nexport interface TransformResult {\n code: string;\n map?: unknown;\n /** The generated CSS text for this file's Truss usages. */\n css: string;\n /** The atomic CSS rules collected during this transform, keyed by class name. */\n rules: Map<string, AtomicRule>;\n}\n\nexport interface TransformTrussOptions {\n debug?: boolean;\n /** When true, inject `__injectTrussCSS(payload)` call for jsdom/test environments. */\n injectCss?: boolean;\n}\n\nconst RUNTIME_MODULE = \"@homebound/truss/runtime\";\n\n/** Runtime imports are emitted in this order regardless of which helper the rewrite reached first. */\nconst RUNTIME_HELPER_ORDER: RuntimeHelperName[] = [\"trussProps\", \"mergeProps\", \"TrussDebugInfo\", \"maybeCssVar\"];\n\n/**\n * The core transform function. Given a source file's code and the truss mapping,\n * finds all `Css.*.$` expressions and rewrites them into Truss-native style hash\n * objects and `trussProps()`/`mergeProps()` runtime calls.\n *\n * Returns null if the file doesn't use Css.\n */\nexport function transformTruss(\n code: string,\n filename: string,\n mapping: TrussMapping,\n options: TransformTrussOptions = {},\n): TransformResult | null {\n // Fast bail: skip files that don't reference Css or use JSX css= attributes\n if (!code.includes(\"Css\") && !code.includes(\"css=\")) return null;\n\n const ast = parseModule(code, filename);\n\n // Step 1: Find the Css binding name — either from an import or a local `new CssBuilder(...)` declaration.\n // May be null when the file only has JSX css= attributes without importing Css.\n const cssImportBinding = findCssImportBinding(ast);\n const cssBindingName = cssImportBinding ?? findCssBuilderBinding(ast);\n\n // Step 2: Collect all Css.*.$ expression sites AND detect Css.props() / JSX css= in a single pass.\n const sites: ExpressionSite[] = [];\n const errorMessages: Array<{ message: string; line: number | null }> = [];\n let hasCssPropsCall = false;\n let hasBuildtimeJsxCssAttribute = false;\n // Module-scope names, so injected helpers and imports can avoid collisions\n let usedTopLevelNames = new Set<string>();\n\n traverse(ast, {\n Program(path: NodePath<t.Program>) {\n usedTopLevelNames = new Set(Object.keys(path.scope.bindings));\n },\n // -- Css.*.$ chain collection --\n MemberExpression(path: NodePath<t.MemberExpression>) {\n if (!cssBindingName) return;\n\n const chain = extractDollarChain(path.node, cssBindingName);\n if (!chain) return;\n if (isInsideWhenObjectValue(path, cssBindingName)) {\n return;\n }\n\n const parentPath = path.parentPath;\n if (parentPath && parentPath.isMemberExpression() && t.isIdentifier(parentPath.node.property, { name: \"$\" })) {\n return;\n }\n\n const resolveCssChainReference = buildCssChainReferenceResolver(path, cssBindingName);\n const resolvedChain = resolveFullChain({ mapping, cssBindingName, resolveCssChainReference }, chain);\n sites.push({ path, resolvedChain });\n\n const line = path.node.loc?.start.line ?? null;\n for (const err of resolvedChain.errors) {\n errorMessages.push({ message: err, line });\n }\n },\n // -- Css.props() detection (so we don't bail early when there are no Css.*.$ sites) --\n CallExpression(path: NodePath<t.CallExpression>) {\n if (cssBindingName && isCssMethodCall(path.node, cssBindingName, \"props\")) {\n hasCssPropsCall = true;\n }\n },\n // -- JSX css={...} attribute detection (so we don't bail when there are only css props) --\n JSXAttribute(path: NodePath<t.JSXAttribute>) {\n if (!t.isJSXIdentifier(path.node.name, { name: \"css\" })) return;\n hasBuildtimeJsxCssAttribute = true;\n },\n });\n\n if (sites.length === 0 && !hasCssPropsCall && !hasBuildtimeJsxCssAttribute) return null;\n\n // Step 3: Collect atomic rules for CSS generation\n const chains = sites.map((s) => s.resolvedChain);\n const { rules, needsMaybeInc, needsMaybeCssVar } = collectAtomicRules(chains, mapping);\n const cssData = generateCssData(rules);\n const cssText = serializeTrussCss(cssData);\n\n // Step 4: Reserve local names for injected helpers\n const runtime = createRuntimeHelpers(ast, usedTopLevelNames);\n const maybeIncHelperName = needsMaybeInc ? reservePreferredName(usedTopLevelNames, \"__maybeInc\") : null;\n const maybeCssVarHelperName = needsMaybeCssVar ? runtime.use(\"maybeCssVar\") : null;\n\n // Collect typography runtime lookups\n const runtimeLookups = collectRuntimeLookups(chains);\n const runtimeLookupNames = new Map<string, string>();\n for (const lookupKey of runtimeLookups.keys()) {\n runtimeLookupNames.set(lookupKey, reservePreferredName(usedTopLevelNames, `__${lookupKey}`));\n }\n\n // Step 5: Rewrite Css sites in-place\n rewriteExpressionSites({\n ast,\n sites,\n cssBindingName,\n filename: basename(filename),\n debug: options.debug ?? false,\n mapping,\n maybeIncHelperName,\n maybeCssVarHelperName,\n runtime,\n runtimeLookupNames,\n });\n\n // Step 6: Prepare runtime imports before removing the Css import.\n const runtimeImports = runtime.imports();\n if (options.injectCss) {\n runtimeImports.push({ importedName: \"__injectTrussCSS\", localName: \"__injectTrussCSS\" });\n }\n\n // Step 7: Remove/replace the Css import and inject runtime imports.\n // When Css comes from a local `new CssBuilder(...)` (tsup bundles), skip import removal.\n let reusedCssImportLine = false;\n if (cssImportBinding) {\n reusedCssImportLine =\n runtimeImports.length > 0 &&\n findImportDeclaration(ast, RUNTIME_MODULE) === null &&\n replaceCssImportWithNamedImports(ast, cssImportBinding, RUNTIME_MODULE, runtimeImports);\n\n if (!reusedCssImportLine) {\n removeCssImport(ast, cssImportBinding);\n }\n }\n\n if (!reusedCssImportLine) {\n upsertNamedImports(ast, RUNTIME_MODULE, runtimeImports);\n }\n\n // Step 8: Insert helper declarations after imports\n const declarationsToInsert: t.Statement[] = [];\n if (maybeIncHelperName) {\n declarationsToInsert.push(buildMaybeIncDeclaration(maybeIncHelperName));\n }\n // Insert runtime lookup tables for typography\n for (const [lookupKey, segmentsByName] of runtimeLookups) {\n const lookupName = runtimeLookupNames.get(lookupKey);\n if (!lookupName) continue;\n declarationsToInsert.push(buildRuntimeLookupDeclaration(lookupName, segmentsByName, mapping));\n }\n\n // Inject __injectTrussCSS call if requested\n if (options.injectCss && cssText.length > 0) {\n declarationsToInsert.push(\n t.expressionStatement(\n t.callExpression(t.identifier(\"__injectTrussCSS\"), [t.valueToNode(createTestCssPayload(cssData))]),\n ),\n );\n }\n\n // Emit console.error calls for any unsupported patterns\n for (const { message, line } of errorMessages) {\n const location = line !== null ? `${filename}:${line}` : filename;\n const logMessage = `${message} (${location})`;\n declarationsToInsert.push(\n t.expressionStatement(\n t.callExpression(t.memberExpression(t.identifier(\"console\"), t.identifier(\"error\")), [\n t.stringLiteral(logMessage),\n ]),\n ),\n );\n }\n\n insertAfterLeadingImports(ast, declarationsToInsert);\n\n const output = generate(ast, {\n sourceFileName: filename,\n sourceMaps: true,\n retainLines: false,\n });\n\n const outputCode = preserveBlankLineAfterImports(code, output.code);\n\n return { code: outputCode, map: output.map, css: cssText, rules };\n}\n\n/**\n * Track which `@homebound/truss/runtime` helpers the rewrite ends up calling.\n *\n * `use()` reuses an existing import's local name when the module already imports the helper,\n * otherwise reserves a collision-free local name; `imports()` lists the helpers that still\n * need an import statement, in canonical order.\n */\nfunction createRuntimeHelpers(\n ast: t.File,\n usedTopLevelNames: Set<string>,\n): RuntimeHelpers & { imports(): NamedImport[] } {\n const localNames = new Map<RuntimeHelperName, string>();\n const missingImports = new Map<RuntimeHelperName, NamedImport>();\n\n return {\n use(name) {\n let localName = localNames.get(name);\n if (localName === undefined) {\n const existing = findNamedImportBinding(ast, name, RUNTIME_MODULE);\n localName = existing ?? reservePreferredName(usedTopLevelNames, name);\n if (!existing) missingImports.set(name, { importedName: name, localName });\n localNames.set(name, localName);\n }\n return localName;\n },\n imports() {\n return RUNTIME_HELPER_ORDER.flatMap((name) => {\n const entry = missingImports.get(name);\n return entry ? [entry] : [];\n });\n },\n };\n}\n\n/** True when `path` sits inside the object literal of a `Css.…when({ ... })` call, whose values are resolved by the outer chain. */\nfunction isInsideWhenObjectValue(path: NodePath<t.MemberExpression>, cssBindingName: string): boolean {\n let current: NodePath<t.Node> | null = path.parentPath;\n\n while (current) {\n if (current.isObjectExpression()) {\n const parent = current.parentPath;\n if (\n parent?.isCallExpression() &&\n parent.node.arguments[0] === current.node &&\n t.isMemberExpression(parent.node.callee) &&\n !parent.node.callee.computed &&\n t.isIdentifier(parent.node.callee.property, { name: \"when\" }) &&\n extractChain(parent.node.callee.object as t.Expression, cssBindingName)\n ) {\n return true;\n }\n }\n\n current = current.parentPath;\n }\n\n return false;\n}\n\nfunction buildCssChainReferenceResolver(\n path: NodePath<t.MemberExpression>,\n cssBindingName: string,\n): CssChainReferenceResolver {\n return (node) => {\n return resolveCssChainReference(path, node, cssBindingName, new Set<string>());\n };\n}\n\n/**\n * Follow lexical bindings like `const same = Css.blue.$` back to their original\n * `Css.*.$` expression so `when({ \":hover\": same })` can resolve the same as\n * an inline value. This stays in the transform layer because it depends on Babel\n * scope/NodePath lookup, not just chain semantics.\n */\nfunction resolveCssChainReference(\n path: NodePath<t.Node>,\n node: t.Expression,\n cssBindingName: string,\n seen: Set<string>,\n): ReturnType<typeof extractChain> {\n const value = unwrapExpression(node);\n\n if (t.isMemberExpression(value)) {\n return extractDollarChain(value, cssBindingName);\n }\n\n if (!t.isIdentifier(value) || seen.has(value.name)) {\n return null;\n }\n\n const binding = path.scope.getBinding(value.name);\n if (!binding?.constant || !binding.path.isVariableDeclarator()) {\n return null;\n }\n\n const init = binding.path.node.init;\n if (!init || !t.isExpression(init)) {\n return null;\n }\n\n seen.add(value.name);\n return resolveCssChainReference(binding.path, init, cssBindingName, seen);\n}\n\n/** Collect typography runtime lookups from all resolved chains, keyed by lookup name. */\nfunction collectRuntimeLookups(chains: ResolvedChain[]): Map<string, Record<string, ResolvedSegment[]>> {\n const lookups = new Map<string, Record<string, ResolvedSegment[]>>();\n for (const seg of chains.flatMap((chain) => chainSegments(chain))) {\n if (seg.kind === \"typography\" && !lookups.has(seg.lookupKey)) {\n lookups.set(seg.lookupKey, seg.segmentsByName);\n }\n }\n return lookups;\n}\n\n/** Babel's generator drops the blank line after the import block; put it back when the source had one. */\nfunction preserveBlankLineAfterImports(input: string, output: string): string {\n const inputLines = input.split(\"\\n\");\n const outputLines = output.split(\"\\n\");\n const lastInputImportLine = findLastImportLine(inputLines);\n const lastOutputImportLine = findLastImportLine(outputLines);\n\n if (lastInputImportLine === -1 || lastOutputImportLine === -1) {\n return output;\n }\n\n const inputHasBlankLineAfterImports = inputLines[lastInputImportLine + 1]?.trim() === \"\";\n const outputHasBlankLineAfterImports = outputLines[lastOutputImportLine + 1]?.trim() === \"\";\n if (!inputHasBlankLineAfterImports || outputHasBlankLineAfterImports) {\n return output;\n }\n\n outputLines.splice(lastOutputImportLine + 1, 0, \"\");\n return outputLines.join(\"\\n\");\n}\n\nfunction findLastImportLine(lines: string[]): number {\n let lastImportLine = -1;\n for (let index = 0; index < lines.length; index++) {\n if (lines[index].trimStart().startsWith(\"import \")) {\n lastImportLine = index;\n }\n }\n return lastImportLine;\n}\n","import { parse, type StyleSheet } from \"css-tree\";\nimport { atRulePrelude } from \"../css-order\";\nimport type { TestCssPayload } from \"../test-css\";\nimport type { ParsedTrussCss } from \"../truss-css\";\n\n/** Build test injection data; callers supply source identity, order, and the spacing prelude. */\nexport function createTestCssPayload(css: ParsedTrussCss): TestCssPayload {\n const payload: TestCssPayload = {};\n if (css.rules.length > 0) {\n payload.rules = css.rules.map((rule) => {\n const atRule = atRulePrelude(rule.cssText);\n return { ...rule, ...(atRule === undefined ? {} : { atRule }) };\n });\n }\n if (css.properties.length > 0) payload.properties = css.properties;\n const arbitraryRules = css.arbitraryCssBlocks.flatMap((block) => splitArbitraryCss(block.cssText));\n if (arbitraryRules.length > 0) payload.arbitraryRules = arbitraryRules;\n return payload;\n}\n\n/** Split arbitrary CSS into original top-level rule slices, keeping nested content and EOF recovery intact. */\nexport function splitArbitraryCss(cssText: string): string[] {\n const root = parse(cssText, {\n context: \"stylesheet\",\n positions: true,\n parseRulePrelude: false,\n parseAtrulePrelude: false,\n parseValue: false,\n }) as StyleSheet;\n const rules: string[] = [];\n root.children.forEach((node) => {\n if (node.type === \"Rule\" || node.type === \"Atrule\") {\n rules.push(cssText.slice(node.loc!.start.offset, node.loc!.end.offset));\n }\n });\n return rules;\n}\n","import * as t from \"@babel/types\";\nimport { isCssSegment, type ResolvedSegment, type TrussMapping } from \"./types\";\nimport { styleEntriesForSegment, type StyleEntry } from \"./style-entries\";\nimport { variableValueNeedsMaybeCssVar } from \"../css-custom-property\";\nimport { SPACING_CUSTOM_PROPERTY } from \"../spacing-css-var\";\n\n// ── Style hash objects ────────────────────────────────────────────────\n\n/**\n * Build the style hash AST for a list of segments (from one `Css.*.$` expression).\n *\n * I.e. `[blue, h_white]` → `{ color: \"blue h_white\" }`, and `[mt(x)]` →\n * `{ marginTop: [\"mt_var\", { \"--marginTop\": __maybeInc(x) }] }`.\n */\nexport function buildStyleHashProperties(\n segments: ResolvedSegment[],\n mapping: TrussMapping,\n maybeIncHelperName?: string | null,\n maybeCssVarHelperName?: string | null,\n): t.ObjectProperty[] {\n return styleHashProperties(collectStyleEntryGroups(segments, mapping), maybeIncHelperName, maybeCssVarHelperName);\n}\n\n/**\n * Group the style entries of `segments` by CSS property, in order of first appearance.\n *\n * Within a group, a new base-level entry replaces earlier base-level entries while conditional\n * entries accumulate. I.e. `Css.blue.black.$` → the later `black` replaces `blue` for `color`,\n * but `Css.blue.onHover.black.$` keeps both because `onHover.black` is conditional.\n *\n * `seed` supplies the starting entries for a property the first time it appears, i.e. the base\n * `color` entries that an `if(cond).onHover.black` branch must carry alongside its own `h_black`.\n */\nexport function collectStyleEntryGroups(\n segments: ResolvedSegment[],\n mapping: TrussMapping,\n seed?: ReadonlyMap<string, StyleEntry[]>,\n): Map<string, StyleEntry[]> {\n const propGroups = new Map<string, StyleEntry[]>();\n\n for (const seg of segments) {\n if (!isCssSegment(seg)) continue;\n for (const entry of styleEntriesForSegment(seg, mapping)) {\n const entries = propGroups.get(entry.cssProp) ?? seed?.get(entry.cssProp) ?? [];\n const kept = entry.isConditional ? entries : entries.filter((existing) => existing.isConditional);\n propGroups.set(entry.cssProp, [...kept, entry]);\n }\n }\n\n return propGroups;\n}\n\n/**\n * Build style hash properties from grouped entries.\n *\n * Static groups become space-separated class bundles, i.e. `{ color: \"blue h_white\" }`.\n * Groups with a variable entry become tuples, i.e. `{ marginTop: [\"mt_var\", { \"--marginTop\": __maybeInc(x) }] }`.\n */\nexport function styleHashProperties(\n propGroups: ReadonlyMap<string, StyleEntry[]>,\n maybeIncHelperName?: string | null,\n maybeCssVarHelperName?: string | null,\n): t.ObjectProperty[] {\n const properties: t.ObjectProperty[] = [];\n\n for (const [cssProp, entries] of propGroups) {\n const classNames = entries.map((e) => e.className).join(\" \");\n const variableEntries = entries.filter((e) => e.isVariable);\n\n if (variableEntries.length === 0) {\n properties.push(t.objectProperty(toPropertyKey(cssProp), t.stringLiteral(classNames)));\n continue;\n }\n\n const varsProps = variableEntries.map((dyn) => {\n return t.objectProperty(\n t.stringLiteral(dyn.varName!),\n variableValueExpression(dyn, maybeIncHelperName, maybeCssVarHelperName),\n );\n });\n const tuple = t.arrayExpression([t.stringLiteral(classNames), t.objectExpression(varsProps)]);\n properties.push(t.objectProperty(toPropertyKey(cssProp), tuple));\n }\n\n return properties;\n}\n\n/**\n * The runtime value stored in a variable tuple's vars object.\n *\n * I.e. a folded `Tokens.gap` → `\"var(--gap)\"`; `mt(x)` → `maybeCssVar(__maybeInc(x))`; `mtPx(x)` → `` `${x}px` ``.\n */\nfunction variableValueExpression(\n dyn: StyleEntry,\n maybeIncHelperName?: string | null,\n maybeCssVarHelperName?: string | null,\n): t.Expression {\n if (dyn.argResolved !== undefined) {\n return t.stringLiteral(dyn.argResolved);\n }\n\n let valueExpr = dyn.argNode!;\n if (dyn.incremented) {\n // I.e. wrap with `__maybeInc(x)` for increment-based values\n valueExpr = t.callExpression(t.identifier(maybeIncHelperName ?? \"__maybeInc\"), [valueExpr]);\n } else if (dyn.appendPx) {\n // I.e. wrap with `` `${v}px` `` for Px delegate values\n valueExpr = t.templateLiteral(\n [t.templateElement({ raw: \"\", cooked: \"\" }, false), t.templateElement({ raw: \"px\", cooked: \"px\" }, true)],\n [valueExpr],\n );\n }\n if (maybeCssVarHelperName && variableValueNeedsMaybeCssVar(dyn)) {\n valueExpr = t.callExpression(t.identifier(maybeCssVarHelperName), [valueExpr]);\n }\n return valueExpr;\n}\n\n// ── Helper AST declarations ───────────────────────────────────────────\n\n/**\n * Build the per-file increment helper declaration.\n *\n * I.e. `const __maybeInc = (inc) => typeof inc === \"string\" ? inc : \\`calc(var(--t-spacing) * \\${inc})\\`;`\n */\nexport function buildMaybeIncDeclaration(helperName: string): t.VariableDeclaration {\n const incParam = t.identifier(\"inc\");\n const calcPrefix = `calc(var(${SPACING_CUSTOM_PROPERTY}) * `;\n const body = t.blockStatement([\n t.returnStatement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.unaryExpression(\"typeof\", incParam), t.stringLiteral(\"string\")),\n incParam,\n t.templateLiteral(\n [\n t.templateElement({ raw: calcPrefix, cooked: calcPrefix }, false),\n t.templateElement({ raw: \")\", cooked: \")\" }, true),\n ],\n [incParam],\n ),\n ),\n ),\n ]);\n\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(helperName), t.arrowFunctionExpression([incParam], body)),\n ]);\n}\n\n/**\n * Build a runtime lookup table declaration for typography.\n *\n * I.e. `const __typography = { f24: { fontSize: \"f24\", lineHeight: \"lh32\" }, ... };`\n */\nexport function buildRuntimeLookupDeclaration(\n lookupName: string,\n segmentsByName: Record<string, ResolvedSegment[]>,\n mapping: TrussMapping,\n): t.VariableDeclaration {\n const properties = Object.entries(segmentsByName).map(([name, segs]) => {\n return t.objectProperty(t.identifier(name), t.objectExpression(buildStyleHashProperties(segs, mapping)));\n });\n return t.variableDeclaration(\"const\", [\n t.variableDeclarator(t.identifier(lookupName), t.objectExpression(properties)),\n ]);\n}\n\n/** I.e. `\"color\"` → `t.identifier(\"color\")`, `\"box-shadow\"` → `t.stringLiteral(\"box-shadow\")`. */\nfunction toPropertyKey(key: string): t.Identifier | t.StringLiteral {\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) ? t.identifier(key) : t.stringLiteral(key);\n}\n","import type { NodePath } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { hasCondition, isCssSegment, type CssSegment, type ResolvedSegment, type TrussMapping } from \"./types\";\nimport type { ResolvedChain } from \"./resolve-chain\";\nimport { collectStyleEntryGroups, styleHashProperties } from \"./emit-style-hash\";\nimport { markerClassName, type StyleEntry } from \"./style-entries\";\nimport { generate, traverse } from \"./babel-utils\";\nimport { isCssMethodCall, staticPropertyName } from \"./ast-utils\";\nimport { TRUSS_CUSTOM_CLASS_PREFIX, TRUSS_INLINE_STYLE_PREFIX, TRUSS_MARKER_KEY } from \"../style-metadata\";\n\nexport interface ExpressionSite {\n path: NodePath<t.MemberExpression>;\n resolvedChain: ResolvedChain;\n}\n\n/** The `@homebound/truss/runtime` exports the rewritten code may call. */\nexport type RuntimeHelperName = \"trussProps\" | \"mergeProps\" | \"TrussDebugInfo\" | \"maybeCssVar\";\n\nexport interface RuntimeHelpers {\n /**\n * The local identifier for a runtime export, marking it as used so the import gets added.\n *\n * I.e. `use(\"mergeProps\")` → `\"mergeProps\"`, or `\"mergeProps13\"` when the module already\n * has `import { mergeProps as mergeProps13 } from \"@homebound/truss/runtime\"`.\n */\n use(name: RuntimeHelperName): string;\n}\n\nexport interface RewriteSitesOptions {\n ast: t.File;\n sites: ExpressionSite[];\n /** Null when the file only has JSX `css=` attributes and no `Css` binding. */\n cssBindingName: string | null;\n filename: string;\n debug: boolean;\n mapping: TrussMapping;\n maybeIncHelperName: string | null;\n maybeCssVarHelperName: string | null;\n runtime: RuntimeHelpers;\n runtimeLookupNames: Map<string, string>;\n}\n\ntype StyleHashMember = t.ObjectProperty | t.SpreadElement;\n\n/** Entry groups keyed by CSS property, i.e. `color → [blue, h_white]`. */\ntype StyleEntryGroups = Map<string, StyleEntry[]>;\n\n/**\n * Rewrite collected `Css...$` expression sites into Truss-native style hash objects.\n *\n * In the new model, each site becomes an ObjectExpression keyed by CSS property.\n * JSX `css=` attributes become `trussProps(hash)` or `mergeProps(className, style, hash)` spreads.\n * Non-JSX positions become plain object expressions.\n */\nexport function rewriteExpressionSites(options: RewriteSitesOptions): void {\n for (const site of options.sites) {\n const styleHash = buildStyleHashFromChain(site.resolvedChain, options);\n const cssAttrPath = getCssAttributePath(site.path);\n const line = site.path.node.loc?.start.line ?? null;\n\n if (cssAttrPath) {\n // JSX css= attribute → static className when possible, otherwise spread trussProps/mergeProps\n if (\n !options.debug &&\n isFullyStaticStyleHash(styleHash) &&\n !hasExistingAttribute(cssAttrPath, \"className\") &&\n !hasExistingAttribute(cssAttrPath, \"style\")\n ) {\n const classNames = extractStaticClassNames(styleHash);\n cssAttrPath.replaceWith(t.jsxAttribute(t.jsxIdentifier(\"className\"), t.stringLiteral(classNames)));\n } else {\n cssAttrPath.replaceWith(buildCssSpreadAttribute(cssAttrPath, styleHash, line, options));\n }\n } else {\n // Non-JSX position → plain object expression with optional debug info\n injectDebugInfo(styleHash, line, options);\n site.path.replaceWith(styleHash);\n }\n }\n\n // Single pass: rewrite Css.props(...) calls and remaining css={...} attributes together\n rewriteCssPropsAndCssAttributes(options);\n}\n\n/**\n * Return the enclosing `css={...}` JSX attribute path for a transformed site,\n * or null when the site is in a non-`css` expression context.\n */\nfunction getCssAttributePath(path: NodePath<t.MemberExpression>): NodePath<t.JSXAttribute> | null {\n const parentPath = path.parentPath;\n if (!parentPath || !parentPath.isJSXExpressionContainer()) return null;\n\n const attrPath = parentPath.parentPath;\n if (!attrPath || !attrPath.isJSXAttribute()) return null;\n if (!t.isJSXIdentifier(attrPath.node.name, { name: \"css\" })) return null;\n\n return attrPath;\n}\n\n// ---------------------------------------------------------------------------\n// Building style hash objects from resolved chains\n// ---------------------------------------------------------------------------\n\n/**\n * Build an ObjectExpression from a ResolvedChain, handling conditionals.\n *\n * I.e. `Css.blue.if(cond).onHover.black.$` →\n * `{ color: \"blue\", ...(cond ? { color: \"blue h_black\" } : {}) }`.\n */\nfunction buildStyleHashFromChain(chain: ResolvedChain, options: RewriteSitesOptions): t.ObjectExpression {\n const members: StyleHashMember[] = [];\n // The latest entry group per CSS property from the unconditional parts so far, so a conditional\n // branch can carry the base classes alongside its own conditional-only overlays.\n const previousGroups: StyleEntryGroups = new Map();\n const pendingUnconditionalSegments: ResolvedSegment[] = [];\n\n function flushPendingUnconditionalSegments(): void {\n // I.e. `Css.black.when({ \":hover\": Css.blue.$ }).$` becomes one merged `color: \"black h_blue\"` entry.\n if (pendingUnconditionalSegments.length === 0) {\n return;\n }\n\n const built = buildStyleHashMembers(pendingUnconditionalSegments, options);\n members.push(...built.members);\n for (const [cssProp, entries] of built.groups) {\n previousGroups.set(cssProp, entries);\n }\n pendingUnconditionalSegments.length = 0;\n }\n\n /**\n * Build one `if()` branch.\n *\n * Properties the branch only touches conditionally (i.e. `onHover.black`) start from the base\n * entries, so the spread keeps `blue` alongside `h_black` instead of dropping it. Plain\n * replacements (i.e. an unconditional `black`) get no seed, so the spread overrides the base.\n */\n function buildBranchMembers(segments: ResolvedSegment[]): StyleHashMember[] {\n const conditionalOnly = collectConditionalOnlyProps(segments);\n const seed: StyleEntryGroups = new Map([...previousGroups].filter(([cssProp]) => conditionalOnly.has(cssProp)));\n return buildStyleHashMembers(segments, options, seed).members;\n }\n\n if (chain.markers.length > 0) {\n const markerClasses = chain.markers.map((marker) => markerClassName(marker.markerNode));\n members.push(t.objectProperty(t.identifier(TRUSS_MARKER_KEY), t.stringLiteral(markerClasses.join(\" \"))));\n }\n\n for (const part of chain.parts) {\n if (part.type === \"unconditional\") {\n pendingUnconditionalSegments.push(...part.segments);\n } else {\n flushPendingUnconditionalSegments();\n // Conditional: ...(cond ? { then } : { else })\n const thenMembers = buildBranchMembers(part.thenSegments);\n const elseMembers = buildBranchMembers(part.elseSegments);\n members.push(\n t.spreadElement(\n t.conditionalExpression(part.conditionNode, t.objectExpression(thenMembers), t.objectExpression(elseMembers)),\n ),\n );\n }\n }\n\n flushPendingUnconditionalSegments();\n\n return t.objectExpression(members);\n}\n\n/**\n * Build ObjectExpression members from a list of segments.\n *\n * CSS segments are batched into entry groups and emitted as style hash properties. The other kinds\n * (composed, typography, className, inlineStyle) produce spread members or reserved metadata properties.\n *\n * Returns the members plus the entry groups they were built from, so an enclosing conditional can\n * seed its branches with them.\n */\nfunction buildStyleHashMembers(\n segments: ResolvedSegment[],\n options: RewriteSitesOptions,\n seed?: StyleEntryGroups,\n): { members: StyleHashMember[]; groups: StyleEntryGroups } {\n const members: StyleHashMember[] = [];\n const groups: StyleEntryGroups = new Map();\n const cssSegs: CssSegment[] = [];\n const classNameArgs: t.Expression[] = [];\n const styleKeyCounts = new Map<string, number>();\n\n function flushCssSegs(): void {\n if (cssSegs.length === 0) return;\n const batchGroups = collectStyleEntryGroups(cssSegs, options.mapping, seed);\n members.push(...styleHashProperties(batchGroups, options.maybeIncHelperName, options.maybeCssVarHelperName));\n for (const [cssProp, entries] of batchGroups) {\n groups.set(cssProp, entries);\n }\n cssSegs.length = 0;\n }\n\n for (const seg of segments) {\n switch (seg.kind) {\n case \"error\":\n continue;\n case \"className\":\n // I.e. `Css.className(cls).df.$` becomes `className_cls: cls` in the style hash.\n classNameArgs.push(t.cloneNode(seg.arg, true));\n continue;\n case \"inlineStyle\":\n flushCssSegs();\n members.push(buildMetadataMember(TRUSS_INLINE_STYLE_PREFIX, seg.arg, styleKeyCounts));\n continue;\n case \"composed\":\n flushCssSegs();\n if (seg.skipUndefined && t.isObjectExpression(seg.arg)) {\n members.push(...buildAddCssObjectMembers(seg.arg));\n } else {\n members.push(t.spreadElement(seg.arg));\n }\n continue;\n case \"typography\": {\n flushCssSegs();\n const lookupName = options.runtimeLookupNames.get(seg.lookupKey);\n if (lookupName) {\n // I.e. `{ ...(__typography[key] ?? {}) }`\n const lookupAccess = t.memberExpression(t.identifier(lookupName), seg.argNode, true);\n members.push(t.spreadElement(t.logicalExpression(\"??\", lookupAccess, t.objectExpression([]))));\n }\n continue;\n }\n }\n\n // In debug mode, add the abbreviation name as a marker className for multi-property\n // segments so engineers can see the origin in the DOM. I.e. `Css.bb.$` adds \"bb\"\n // alongside \"bbs_solid bbw_1px\", and `Css.lineClamp(n).$` adds \"lineClamp\".\n if (options.debug) {\n const isMultiProp = seg.kind === \"static\" && Object.keys(seg.defs).length > 1;\n const hasExtraDefs = seg.kind === \"variable\" && !!seg.extraDefs && Object.keys(seg.extraDefs).length > 0;\n if (isMultiProp || hasExtraDefs) {\n classNameArgs.push(t.stringLiteral(seg.abbr));\n }\n }\n\n cssSegs.push(seg);\n }\n\n flushCssSegs();\n if (classNameArgs.length > 0) {\n // Prepend so markers/custom classes appear first in the DOM,\n // I.e. `className=\"bb bbs_solid bbw_1px\"` rather than at the end.\n // Uses unique `className_${key}` keys so spreading preserves all entries.\n const classNameKeyCounts = new Map<string, number>();\n members.unshift(\n ...classNameArgs.map((arg) => buildMetadataMember(TRUSS_CUSTOM_CLASS_PREFIX, arg, classNameKeyCounts)),\n );\n }\n return { members, groups };\n}\n\n/** I.e. `className_my_btn: \"my-btn\"`, with `_2`, `_3` suffixes for repeated keys. */\nfunction buildMetadataMember(prefix: string, arg: t.Expression, counts: Map<string, number>): t.ObjectProperty {\n const baseKey = `${prefix}${sanitizeMetadataKey(arg)}`;\n const count = (counts.get(baseKey) ?? 0) + 1;\n counts.set(baseKey, count);\n const key = count === 1 ? baseKey : `${baseKey}_${count}`;\n return t.objectProperty(t.identifier(key), t.cloneNode(arg, true));\n}\n\n/** Derive a valid JS identifier suffix from metadata args. I.e. `\"my-btn\"` → `my_btn`, `vars` → `vars`. */\nfunction sanitizeMetadataKey(arg: t.Expression): string {\n const raw = t.isStringLiteral(arg)\n ? arg.value\n : t.isTemplateLiteral(arg) && arg.expressions.length === 0 && arg.quasis.length === 1\n ? (arg.quasis[0].value.cooked ?? \"\")\n : generate(arg).code;\n\n const sanitized = raw\n .replace(/[^a-zA-Z0-9_$]/g, \"_\")\n .replace(/_+/g, \"_\")\n .replace(/^_+|_+$/g, \"\");\n return sanitized || \"value\";\n}\n\n/**\n * Spread an `with({ height, ...rest })` object literal member by member, skipping identifier and\n * member-expression values that are `undefined` at runtime so they do not clobber earlier styles.\n */\nfunction buildAddCssObjectMembers(styleObject: t.ObjectExpression): StyleHashMember[] {\n const members: StyleHashMember[] = [];\n\n for (const property of styleObject.properties) {\n if (t.isSpreadElement(property)) {\n members.push(t.spreadElement(t.cloneNode(property.argument, true)));\n continue;\n }\n\n if (!t.isObjectProperty(property) || property.computed) {\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n continue;\n }\n\n const value = property.value;\n if (t.isIdentifier(value) || t.isMemberExpression(value) || t.isOptionalMemberExpression(value)) {\n // I.e. `...(height === undefined ? {} : { height })`\n members.push(\n t.spreadElement(\n t.conditionalExpression(\n t.binaryExpression(\"===\", t.cloneNode(value, true), t.identifier(\"undefined\")),\n t.objectExpression([]),\n t.objectExpression([t.objectProperty(clonePropertyKey(property.key), t.cloneNode(value, true))]),\n ),\n ),\n );\n continue;\n }\n\n members.push(t.spreadElement(t.objectExpression([t.cloneNode(property, true)])));\n }\n\n return members;\n}\n\n/**\n * Collect the set of CSS properties where ALL contributing segments have a condition\n * (pseudo-class, media query, pseudo-element, or when relationship).\n *\n * I.e. `onHover.white` → `color` is conditional-only (needs base merged in),\n * but `bgWhite` → `backgroundColor` is a plain replacement (should NOT merge).\n */\nfunction collectConditionalOnlyProps(segments: ResolvedSegment[]): Set<string> {\n const conditionalOnly = new Map<string, boolean>();\n for (const seg of segments) {\n if (!isCssSegment(seg)) continue;\n const segHasCondition = hasCondition(seg.condition);\n const props = seg.kind === \"variable\" ? seg.props : Object.keys(seg.defs);\n for (const prop of props) {\n // If any segment for this property is unconditional, it's not conditional-only\n conditionalOnly.set(prop, (conditionalOnly.get(prop) ?? true) && segHasCondition);\n }\n }\n return new Set([...conditionalOnly].filter(([, isConditionalOnly]) => isConditionalOnly).map(([prop]) => prop));\n}\n\nfunction propertyName(key: t.Expression | t.Identifier | t.PrivateName): string {\n return staticPropertyName(key) ?? generate(key).code;\n}\n\nfunction clonePropertyKey(key: t.Expression | t.Identifier | t.PrivateName): t.Expression | t.Identifier {\n if (t.isPrivateName(key)) {\n return t.identifier(key.id.name);\n }\n return t.cloneNode(key, true);\n}\n\n// ---------------------------------------------------------------------------\n// Debug info injection\n// ---------------------------------------------------------------------------\n\n/**\n * Inject debug info into the first style property of a style hash ObjectExpression.\n *\n * For static values, promotes `\"df\"` to `[\"df\", new TrussDebugInfo(\"...\")]`.\n * For variable tuples, appends the debug info as a third element.\n * No-op outside debug mode, without a source line, or for non-object hashes.\n */\nfunction injectDebugInfo(\n styleHash: t.Expression,\n line: number | null,\n options: Pick<RewriteSitesOptions, \"debug\" | \"filename\" | \"runtime\">,\n): void {\n if (!options.debug || line === null || !t.isObjectExpression(styleHash)) return;\n\n // Find the first real style property (skip SpreadElements and metadata like __marker / className_*)\n const firstProp = styleHash.properties.find((p): p is t.ObjectProperty => {\n return t.isObjectProperty(p) && !isMetadataKey(propertyName(p.key));\n });\n if (!firstProp) return;\n\n const debugExpr = t.newExpression(t.identifier(options.runtime.use(\"TrussDebugInfo\")), [\n t.stringLiteral(`${options.filename}:${line}`),\n ]);\n\n if (t.isStringLiteral(firstProp.value)) {\n // Static: \"df\" → [\"df\", new TrussDebugInfo(\"...\")]\n firstProp.value = t.arrayExpression([firstProp.value, debugExpr]);\n } else if (t.isArrayExpression(firstProp.value)) {\n // Variable tuple: [\"mt_var\", { vars }] → [\"mt_var\", { vars }, new TrussDebugInfo(\"...\")]\n firstProp.value.elements.push(debugExpr);\n }\n}\n\n/** I.e. `__marker`, `className_foo`, and `style_vars` carry runtime metadata rather than CSS classes. */\nfunction isMetadataKey(name: string): boolean {\n return (\n name === TRUSS_MARKER_KEY ||\n name.startsWith(TRUSS_CUSTOM_CLASS_PREFIX) ||\n name.startsWith(TRUSS_INLINE_STYLE_PREFIX)\n );\n}\n\n// ---------------------------------------------------------------------------\n// JSX css= attribute handling\n// ---------------------------------------------------------------------------\n\n/**\n * Build the spread attribute for a JSX `css=` attribute.\n *\n * I.e. `{...trussProps(hash)}`, or `{...mergeProps(className, style, hash)}` when the element\n * also has `className`/`style` attributes (which are removed and folded in).\n */\nfunction buildCssSpreadAttribute(\n path: NodePath<t.JSXAttribute>,\n styleHash: t.Expression,\n line: number | null,\n options: RewriteSitesOptions,\n): t.JSXSpreadAttribute {\n const existingClassNameExpr = removeExistingAttribute(path, \"className\");\n const existingStyleExpr = removeExistingAttribute(path, \"style\");\n\n injectDebugInfo(styleHash, line, options);\n\n if (!existingClassNameExpr && !existingStyleExpr) {\n return t.jsxSpreadAttribute(t.callExpression(t.identifier(options.runtime.use(\"trussProps\")), [styleHash]));\n }\n\n return t.jsxSpreadAttribute(\n t.callExpression(t.identifier(options.runtime.use(\"mergeProps\")), [\n existingClassNameExpr ?? t.identifier(\"undefined\"),\n existingStyleExpr ?? t.identifier(\"undefined\"),\n styleHash,\n ]),\n );\n}\n\n/** Remove a sibling JSX attribute and return its expression. */\nfunction removeExistingAttribute(path: NodePath<t.JSXAttribute>, attrName: string): t.Expression | null {\n const openingElement = path.parentPath;\n if (!openingElement || !openingElement.isJSXOpeningElement()) return null;\n\n const attrs = openingElement.node.attributes;\n for (let i = 0; i < attrs.length; i++) {\n const attr = attrs[i];\n if (!t.isJSXAttribute(attr) || !t.isJSXIdentifier(attr.name, { name: attrName })) continue;\n\n let expr: t.Expression | null = null;\n if (t.isStringLiteral(attr.value)) {\n expr = attr.value;\n } else if (t.isJSXExpressionContainer(attr.value) && t.isExpression(attr.value.expression)) {\n expr = attr.value.expression;\n }\n\n attrs.splice(i, 1);\n return expr;\n }\n\n return null;\n}\n\n// ---------------------------------------------------------------------------\n// Combined pass: Css.props(...) rewriting + remaining css={...} attributes\n// ---------------------------------------------------------------------------\n\n/**\n * Single traversal that rewrites both `Css.props(expr)` calls and remaining\n * `css={expr}` JSX attributes, avoiding two separate full-AST passes.\n */\nfunction rewriteCssPropsAndCssAttributes(options: RewriteSitesOptions): void {\n traverse(options.ast, {\n // -- Css.props(expr) → trussProps(expr) or mergeProps(...) --\n CallExpression(path: NodePath<t.CallExpression>) {\n if (!options.cssBindingName || !isCssMethodCall(path.node, options.cssBindingName, \"props\")) return;\n\n const arg = path.node.arguments[0];\n if (!arg || t.isSpreadElement(arg) || !t.isExpression(arg) || path.node.arguments.length !== 1) return;\n\n // Check for a sibling `className` property in the parent object literal\n const classNameExpr = extractSiblingClassName(path);\n if (classNameExpr) {\n path.replaceWith(\n t.callExpression(t.identifier(options.runtime.use(\"mergeProps\")), [\n classNameExpr,\n t.identifier(\"undefined\"),\n arg,\n ]),\n );\n } else {\n path.replaceWith(t.callExpression(t.identifier(options.runtime.use(\"trussProps\")), [arg]));\n }\n },\n // -- Remaining css={expr} JSX attributes → {...trussProps(expr)} spreads --\n // I.e. css={someVariable}, css={{ ...a, ...b }}, css={cond ? a : b}\n JSXAttribute(path: NodePath<t.JSXAttribute>) {\n if (!t.isJSXIdentifier(path.node.name, { name: \"css\" })) return;\n if (isRuntimeStyleCssAttribute(path)) return;\n const value = path.node.value;\n if (!t.isJSXExpressionContainer(value)) return;\n if (!t.isExpression(value.expression)) return;\n\n path.replaceWith(buildCssSpreadAttribute(path, value.expression, path.node.loc?.start.line ?? null, options));\n },\n });\n}\n\n/**\n * If `...Css.props(...)` is spread inside an object literal that has a sibling\n * `className` property, extract and remove that property so the rewrite can\n * merge it via `mergeProps`.\n */\nfunction extractSiblingClassName(callPath: NodePath<t.CallExpression>): t.Expression | null {\n // Walk up: CallExpression → SpreadElement → ObjectExpression\n const spreadPath = callPath.parentPath;\n if (!spreadPath || !spreadPath.isSpreadElement()) return null;\n const objectPath = spreadPath.parentPath;\n if (!objectPath || !objectPath.isObjectExpression()) return null;\n\n const properties = objectPath.node.properties;\n for (let i = 0; i < properties.length; i++) {\n const prop = properties[i];\n if (!t.isObjectProperty(prop)) continue;\n if (staticPropertyName(prop.key) !== \"className\") continue;\n if (!t.isExpression(prop.value)) continue;\n\n const classNameExpr = prop.value;\n properties.splice(i, 1);\n return classNameExpr;\n }\n\n return null;\n}\n\n/** `<RuntimeStyle css={...}>` takes real declarations, not a style hash, so it is left for the runtime. */\nfunction isRuntimeStyleCssAttribute(path: NodePath<t.JSXAttribute>): boolean {\n const openingElementPath = path.parentPath;\n if (!openingElementPath || !openingElementPath.isJSXOpeningElement()) return false;\n return t.isJSXIdentifier(openingElementPath.node.name, { name: \"RuntimeStyle\" });\n}\n\n// ---------------------------------------------------------------------------\n// Static style hash detection\n// ---------------------------------------------------------------------------\n\n/** Check whether a style hash has only static string values (no spreads, no tuples). */\nfunction isFullyStaticStyleHash(hash: t.ObjectExpression): boolean {\n return hash.properties.every((prop) => t.isObjectProperty(prop) && t.isStringLiteral(prop.value));\n}\n\n/** Extract all static class names from a fully-static style hash, joined with spaces. */\nfunction extractStaticClassNames(hash: t.ObjectExpression): string {\n const classNames: string[] = [];\n for (const prop of hash.properties) {\n if (t.isObjectProperty(prop) && t.isStringLiteral(prop.value)) {\n classNames.push(prop.value.value);\n }\n }\n return classNames.join(\" \");\n}\n\n/** Check whether a sibling JSX attribute exists without removing it. */\nfunction hasExistingAttribute(path: NodePath<t.JSXAttribute>, attrName: string): boolean {\n const openingElement = path.parentPath;\n if (!openingElement || !openingElement.isJSXOpeningElement()) return false;\n return openingElement.node.attributes.some((attr) => {\n return t.isJSXAttribute(attr) && t.isJSXIdentifier(attr.name, { name: attrName });\n });\n}\n","/** Metadata key that carries a marker class through Truss style hashes. */\nexport const TRUSS_MARKER_KEY = \"__marker\";\n\n/** Prefix for style-hash entries that append raw class names at runtime. */\nexport const TRUSS_CUSTOM_CLASS_PREFIX = \"className_\";\n\n/** Prefix for style-hash entries that append raw inline styles at runtime. */\nexport const TRUSS_INLINE_STYLE_PREFIX = \"style_\";\n\n/** Generated Css expressions include this brand marker in runtime-only paths. */\nexport const TRUSS_CSS_MARKER_KEY = \"$css\";\n","import { readFileSync } from \"fs\";\nimport { atRulePrelude, compareRuleSortKeys, ruleSortKey } from \"../css-order\";\nimport { parseTrussCss, serializeTrussCss } from \"./truss-css\";\nimport type { ParsedArbitraryCssBlock, ParsedCssRule, ParsedPropertyDeclaration, ParsedTrussCss } from \"../truss-css\";\n\n/**\n * Read and parse an annotated truss.css file from disk.\n *\n * Throws if the file doesn't exist or can't be read.\n */\nexport function readTrussCss(filePath: string): ParsedTrussCss {\n const content = readFileSync(filePath, \"utf8\");\n return parseTrussCss(content);\n}\n\n/**\n * Merge multiple parsed truss CSS sources into structured CSS.\n *\n * Rules are deduplicated by class name (first occurrence wins, since\n * deterministic output means identical class names produce identical rules),\n * then sorted with the same comparator emit-css uses: priority, then media-query width, then class name.\n * @property declarations are deduplicated by variable name and appended next.\n * Arbitrary CSS blocks are left opaque and appended in source order at the end.\n */\nexport function mergeTrussCssData(sources: ParsedTrussCss[]): ParsedTrussCss {\n const seenClasses = new Set<string>();\n const allRules: ParsedCssRule[] = [];\n const seenProperties = new Set<string>();\n const allProperties: ParsedPropertyDeclaration[] = [];\n const allArbitraryCssBlocks: ParsedArbitraryCssBlock[] = [];\n\n for (const source of sources) {\n for (const rule of source.rules) {\n if (!seenClasses.has(rule.className)) {\n seenClasses.add(rule.className);\n allRules.push(rule);\n }\n }\n for (const prop of source.properties) {\n if (!seenProperties.has(prop.varName)) {\n seenProperties.add(prop.varName);\n allProperties.push(prop);\n }\n }\n allArbitraryCssBlocks.push(...source.arbitraryCssBlocks);\n }\n\n // Sort exactly as emit-css does, so a merged stylesheet keeps the per-file cascade order\n const decorated = allRules.map((rule) => {\n return { rule, key: ruleSortKey(rule.priority, rule.className, atRulePrelude(rule.cssText)) };\n });\n decorated.sort((a, b) => compareRuleSortKeys(a.key, b.key));\n\n return {\n rules: decorated.map((entry) => entry.rule),\n properties: allProperties,\n arbitraryCssBlocks: allArbitraryCssBlocks,\n };\n}\n\n/** Merge and serialize annotated Truss CSS with the first source winning duplicate names. */\nexport function mergeTrussCss(sources: ParsedTrussCss[]): string {\n return serializeTrussCss(mergeTrussCssData(sources));\n}\n","import { readFileSync, writeFileSync, mkdirSync } from \"fs\";\nimport { resolve, join } from \"path\";\nimport { createTrussTransformSession } from \"./transform-session\";\n\nexport interface TrussEsbuildPluginOptions {\n /** Path to the Css.json mapping file (relative to cwd or absolute). */\n mapping: string;\n /** Output path for the generated truss.css (relative to outDir or absolute). Defaults to `truss.css`. */\n outputCss?: string;\n}\n\n/**\n * esbuild plugin that transforms `Css.*.$` expressions, collects `.css.ts` blocks,\n * and emits a `truss.css` file.\n *\n * Designed for library builds using tsup/esbuild. Transforms source files\n * during the build and writes an annotated `truss.css` alongside the output\n * that consuming applications can merge via the Vite plugin's `libraries` option.\n *\n * Usage with tsup:\n * ```ts\n * import { trussEsbuildPlugin } from \"@homebound/truss/plugin\";\n *\n * export default defineConfig({\n * esbuildPlugins: [trussEsbuildPlugin({ mapping: \"./src/Css.json\" })],\n * });\n * ```\n */\nexport function trussEsbuildPlugin(opts: TrussEsbuildPluginOptions) {\n const session = createTrussTransformSession({\n mappingPath() {\n return resolve(process.cwd(), opts.mapping);\n },\n projectRoot() {\n return process.cwd();\n },\n });\n\n return {\n name: \"truss\",\n setup(build: EsbuildPluginBuild) {\n const outDir = build.initialOptions.outdir ?? join(process.cwd(), \"dist\");\n\n build.onLoad({ filter: /\\.[cm]?[jt]sx?$/ }, (args: { path: string }) => {\n const code = readFileSync(args.path, \"utf8\");\n\n if (args.path.endsWith(\".css.ts\")) {\n session.updateArbitraryCssRegistry(args.path, code);\n return { contents: code, loader: loaderForPath(args.path) };\n }\n\n if (!code.includes(\"Css\") && !code.includes(\"css=\")) return undefined;\n\n const result = session.transformCode(code, args.path);\n if (!result) return undefined;\n\n return { contents: result.code, loader: loaderForPath(args.path) };\n });\n\n build.onEnd(() => {\n if (!session.hasCss()) return;\n\n const css = session.collectCss();\n if (css.length === 0) return;\n const cssPath = resolve(outDir, opts.outputCss ?? \"truss.css\");\n\n mkdirSync(resolve(cssPath, \"..\"), { recursive: true });\n writeFileSync(cssPath, css, \"utf8\");\n });\n },\n };\n}\n\n/** Map file extension to esbuild loader type. */\nfunction loaderForPath(filePath: string): string {\n if (filePath.endsWith(\".tsx\")) return \"tsx\";\n if (filePath.endsWith(\".ts\")) return \"ts\";\n if (filePath.endsWith(\".jsx\")) return \"jsx\";\n return \"js\";\n}\n\n/**\n * Minimal esbuild plugin types so we don't need esbuild as a dependency.\n *\n * These match the subset of the esbuild Plugin API that we use.\n */\ninterface EsbuildPluginBuild {\n initialOptions: { outdir?: string };\n onLoad(\n options: { filter: RegExp },\n callback: (args: { path: string }) => { contents: string; loader: string } | undefined,\n ): void;\n onEnd(callback: () => void): void;\n}\n"],"mappings":";AAAA,SAAS,gBAAAA,eAAc,iBAAAC,gBAAe,cAAAC,aAAY,mBAAmB;AACrE,SAAS,WAAAC,UAAS,WAAAC,UAAS,YAAY,QAAAC,aAAY;AACnD,SAAS,kBAAkB;;;ACF3B,SAAS,kBAAkB;AAC3B,SAAS,SAAS,eAAe;AACjC,YAAYC,QAAO;;;ACFnB,YAAY,OAAO;AAgBZ,SAAS,qBAAqB,MAAmB,WAAmB,WAA4B;AACrG,MAAI,CAAC,KAAK,IAAI,SAAS,GAAG;AACxB,SAAK,IAAI,SAAS;AAClB,WAAO;AAAA,EACT;AAEA,MAAI,aAAa,CAAC,KAAK,IAAI,SAAS,GAAG;AACrC,SAAK,IAAI,SAAS;AAClB,WAAO;AAAA,EACT;AAEA,QAAM,OAAO,aAAa;AAC1B,MAAI,IAAI;AAER,MAAI,YAAY,GAAG,IAAI,IAAI,CAAC;AAC5B,SAAO,KAAK,IAAI,SAAS,GAAG;AAC1B;AACA,gBAAY,GAAG,IAAI,IAAI,CAAC;AAAA,EAC1B;AACA,OAAK,IAAI,SAAS;AAClB,SAAO;AACT;AAGO,SAAS,qBAAqB,KAA4B;AAC/D,SAAO,uBAAuB,KAAK,KAAK;AAC1C;AAQO,SAAS,sBAAsB,KAA4B;AAChE,aAAW,QAAQ,IAAI,QAAQ,MAAM;AACnC,QAAI,CAAG,wBAAsB,IAAI,EAAG;AACpC,eAAW,QAAQ,KAAK,cAAc;AACpC,UACI,eAAa,KAAK,EAAE,KACtB,KAAK,QACH,kBAAgB,KAAK,IAAI,KACzB,eAAa,KAAK,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC,GAC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ACxB;AACA,SAAO;AACT;AAEA,SAAS,kBAAkB,UAA2B;AACpD,SAAO,SAAS,QAAQ,OAAO,GAAG,EAAE,SAAS,gBAAgB;AAC/D;AAGA,SAAS,oBAAoB,UAA0B;AACrD,SAAOA,SAAQ,QAAQ,EAAE,QAAQ,OAAO,GAAG;AAC7C;AAUA,SAAS,uBAAuB,MAAc,QAAgB,KAAqB;AACjF,QAAM,MAAM,YAAY,MAAM,MAAM;AAEpC,MAAI,oBAAoB,oBAAI,IAAY;AACxC,WAAS,KAAK;AAAA,IACZ,QAAQ,MAAM;AACZ,0BAAoB,IAAI,IAAI,OAAO,KAAK,KAAK,MAAM,QAAQ,CAAC;AAC5D,WAAK,KAAK;AAAA,IACZ;AAAA,EACF,CAAC;AACD,QAAM,WAAW,uBAAuB,KAAK,mBAAmBD,eAAc;AAC9E,QAAM,YAAY,YAAY,qBAAqB,mBAAmB,iBAAiB;AACvF,MAAI,CAAC,SAAU,oBAAmB,KAAKA,iBAAgB,CAAC,EAAE,cAAc,mBAAmB,UAAU,CAAC,CAAC;AACvG,MAAI,QAAQ,KAAK;AAAA,IACb;AAAA,MACE,mBAAiB,eAAW,SAAS,GAAG;AAAA,QACtC,gBAAY,EAAE,gBAAgB,kBAAkB,GAAG,GAAG,QAAQ,oBAAoB,MAAM,EAAE,CAAC;AAAA,MAC/F,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO,SAAS,KAAK,EAAE,gBAAgB,OAAO,CAAC,EAAE;AACnD;","names":["readFileSync","writeFileSync","existsSync","resolve","dirname","join","t","resolve","t","t","t","t","t","t","t","t","atRulePrelude","cssText","t","t","t","parse","parse","t","t","resolveCssChainReference","seen","readFileSync","readFileSync","resolve","mapping","t","readFileSync","resolve","resolve","readFileSync","RUNTIME_MODULE","resolve","existsSync","sourcePath","readFileSync","join","writeFileSync","dirname"]}