@pipelex/mthds-form 0.33.0 → 0.34.0

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.
Files changed (34) hide show
  1. package/dist/brand/index.js +2 -2
  2. package/dist/{chunk-UKTYADY3.js → chunk-5RV3ASMO.js} +141 -69
  3. package/dist/chunk-5RV3ASMO.js.map +1 -0
  4. package/dist/{chunk-VH5CDQDR.js → chunk-AURDKAIC.js} +3 -3
  5. package/dist/{chunk-VH5CDQDR.js.map → chunk-AURDKAIC.js.map} +1 -1
  6. package/dist/{chunk-ZX52CQJ4.js → chunk-CFBK7NO7.js} +3 -3
  7. package/dist/{chunk-ZX52CQJ4.js.map → chunk-CFBK7NO7.js.map} +1 -1
  8. package/dist/{chunk-3GO65HWP.js → chunk-PNNWNRPG.js} +11 -7
  9. package/dist/chunk-PNNWNRPG.js.map +1 -0
  10. package/dist/{chunk-XO5OENNF.js → chunk-TF4RTKLH.js} +32 -5
  11. package/dist/chunk-TF4RTKLH.js.map +1 -0
  12. package/dist/{chunk-IBBAJXIO.js → chunk-XIWBKV7T.js} +3 -3
  13. package/dist/{chunk-IBBAJXIO.js.map → chunk-XIWBKV7T.js.map} +1 -1
  14. package/dist/{chunk-4SRSGZWM.js → chunk-XYS5KCXB.js} +158 -31
  15. package/dist/chunk-XYS5KCXB.js.map +1 -0
  16. package/dist/core/gate.js +2 -2
  17. package/dist/core/index.js +4 -4
  18. package/dist/core/readiness.d.ts +34 -1
  19. package/dist/core/readiness.js +1 -1
  20. package/dist/core/seed.js +2 -2
  21. package/dist/core/values.js +2 -2
  22. package/dist/generative/headless/index.d.ts +15 -9
  23. package/dist/generative/headless/index.js +3 -2
  24. package/dist/generative/index.d.ts +27 -4
  25. package/dist/generative/index.js +628 -240
  26. package/dist/generative/index.js.map +1 -1
  27. package/dist/react/index.d.ts +30 -3
  28. package/dist/react/index.js +4 -4
  29. package/dist/styles.css +1 -1
  30. package/package.json +1 -1
  31. package/dist/chunk-3GO65HWP.js.map +0 -1
  32. package/dist/chunk-4SRSGZWM.js.map +0 -1
  33. package/dist/chunk-UKTYADY3.js.map +0 -1
  34. package/dist/chunk-XO5OENNF.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/generative/brand-context.tsx","../../src/generative/checked-fields.tsx","../../src/generative/element-errors.tsx","../../src/generative/brand-bar.tsx","../../src/generative/declared-props.ts","../../src/generative/frame-host.tsx","../../src/generative/ui/shadcn.tsx","../../src/generative/registry.tsx","../../src/generative/frame-registry.tsx","../../src/generative/result-slot.tsx","../../src/generative/product-registry.tsx","../../src/generative/page.tsx"],"names":["React","React2","React3","jsx","Renderer","Component","React4","React5","jsxs","Tag","Switch","useRepeatScope","useBoundProp","Map","Clock","useStateValue","List","React7","LABEL","React8","React9","useOptionalValidation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAM,YAAA,GAAqBA,qBAAoC,IAAI,CAAA;AAE5D,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,UAAA,CAAW,SAAS,OAAO,CAAA;AAC3B,EAAA,2BAAQ,YAAA,CAAa,QAAA,EAAb,EAAsB,KAAA,EAAO,UAAW,QAAA,EAAS,CAAA;AAC3D;AAEO,SAAS,QAAA,GAA0B;AACxC,EAAA,MAAM,QAAA,GAAiBA,kBAAW,YAAY,CAAA;AAC9C,EAAA,IAAI,CAAC,QAAA;AACH,IAAA,MAAM,IAAI,KAAA;AAAA,MACR;AAAA,KACF;AACF,EAAA,OAAO,QAAA;AACT;AAGA,IAAM,OAAA,GAAU,iBAAA;AAEhB,SAAS,WAAW,OAAA,EAAmC;AACrD,EAAA,MAAM,WAAW,OAAA,EAAS,QAAA;AAC1B,EAAA,MAAM,SAAS,OAAA,EAAS,MAAA;AACxB,EAAMA,iBAAU,MAAM;AACpB,IAAA,IAAI,CAAC,QAAA,IAAY,CAAC,MAAA,EAAQ;AAC1B,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SAAA;AAAA,IACN,KAAA,CAAM,WAAA;AAAA,IACN,KAAA,CAAM,qBAAqB,KAAA,CAAM;AAAA,GACnC;AACF","file":"index.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { BrandManifest } from '../brand/manifest';\n\n/**\n * The manifest, handed down to the brand components: the app bar reads the\n * logo pair and the name off it, and nothing on the page names a brand\n * itself. The provider also loads the manifest's web font, once per family,\n * by appending the Google Fonts link a host would put in its document head -\n * so a brand story needs nothing in `.storybook/preview-head.html`, and the\n * Storybook carries no font any story did not ask for.\n */\n\nconst BrandContext = React.createContext<BrandManifest | null>(null);\n\nexport function BrandProvider({\n manifest,\n children,\n}: {\n manifest: BrandManifest;\n children: React.ReactNode;\n}) {\n useWebfont(manifest.webfont);\n return <BrandContext.Provider value={manifest}>{children}</BrandContext.Provider>;\n}\n\nexport function useBrand(): BrandManifest {\n const manifest = React.useContext(BrandContext);\n if (!manifest)\n throw new Error(\n 'useBrand: no brand in scope. Pass `brand` to GenerativePage, or wrap the tree in BrandProvider.',\n );\n return manifest;\n}\n\n/** The weights the page sets: regular, medium, semibold, bold. */\nconst WEIGHTS = '400;500;600;700';\n\nfunction useWebfont(webfont: BrandManifest['webfont']) {\n const provider = webfont?.provider;\n const family = webfont?.family;\n React.useEffect(() => {\n if (!provider || !family) return;\n const key = `${provider}:${family}`;\n if (document.head.querySelector(`link[data-brand-webfont=\"${CSS.escape(key)}\"]`)) return;\n for (const origin of ['https://fonts.googleapis.com', 'https://fonts.gstatic.com']) {\n if (document.head.querySelector(`link[rel=\"preconnect\"][href=\"${origin}\"]`)) continue;\n const preconnect = document.createElement('link');\n preconnect.rel = 'preconnect';\n preconnect.href = origin;\n if (origin.endsWith('gstatic.com')) preconnect.crossOrigin = 'anonymous';\n document.head.appendChild(preconnect);\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n // Percent-encoded, then spaces back to the `+` Google Fonts expects: a\n // family carrying an `&` would otherwise inject query parameters of its own.\n const encoded = encodeURIComponent(family).replace(/%20/g, '+');\n link.href = `https://fonts.googleapis.com/css2?family=${encoded}:wght@${WEIGHTS}&display=swap`;\n link.dataset.brandWebfont = key;\n document.head.appendChild(link);\n }, [provider, family]);\n}\n","'use client';\n\nimport * as React from 'react';\nimport type { ValidationConfig } from '@json-render/core';\nimport {\n useFieldValidation,\n useOptionalValidation,\n type ValidationContextValue,\n} from '@json-render/react';\n\n/**\n * The checks of a page's fields, as json-render's validation is told of them.\n *\n * json-render keeps one set of checks per path, registered by each field's\n * own effect and never unregistered, and `validateForm` and `validateAll` run\n * every set it holds. So a field hidden by its `visible` condition, or one a\n * streamed or swapped layout dropped, kept its last checks and refused the\n * run while nobody could see or correct it; and two controls bound to the\n * same path with different checks each registered its own over the other's\n * at every render, an update loop React stopped with \"Maximum update depth\n * exceeded\", while whichever result was written last hid the other's\n * failure. The page keeps its own record instead: every checked field that\n * is mounted now, by path, and json-render is told, for each path, the checks\n * of all the fields mounted at it, and no checks once the last one leaves. A\n * field validates against the same combined checks, so what it shows and\n * what `validateForm` and the run decide agree.\n */\nexport class CheckedFields {\n // One entry per mounted field, so two fields handed one config object are\n // two entries, and one leaving does not take the other's checks with it.\n private readonly byPath = new Map<string, Set<{ config: ValidationConfig }>>();\n private validation: ValidationContextValue | null = null;\n\n /** Hands the record json-render's validation, and tells it what is already mounted. */\n attach(validation: ValidationContextValue | null): void {\n if (validation === this.validation) return;\n const first = this.validation === null;\n this.validation = validation;\n if (first) for (const path of this.byPath.keys()) this.publish(path);\n }\n\n /** Enters one mounted field's checks; what it returns leaves them again. */\n enter(path: string, config: ValidationConfig): () => void {\n const configs = this.byPath.get(path) ?? new Set<{ config: ValidationConfig }>();\n this.byPath.set(path, configs);\n const entry = { config };\n configs.add(entry);\n this.publish(path);\n return () => {\n configs.delete(entry);\n if (configs.size === 0) this.byPath.delete(path);\n this.publish(path);\n };\n }\n\n /** The checks of every field mounted at `path`, combined, or none when no field is. */\n configFor(path: string): ValidationConfig | undefined {\n const configs = this.byPath.get(path);\n if (!configs || configs.size === 0) return undefined;\n const [first] = configs;\n return {\n checks: [...configs].flatMap(({ config }) => config.checks ?? []),\n ...(first?.config.validateOn ? { validateOn: first.config.validateOn } : {}),\n };\n }\n\n /**\n * Runs the checks of every path a mounted field carries, as the record\n * holds them now, and answers whether they all pass; every path is checked,\n * so each failing field shows its message. json-render's own `validateAll`\n * reads what it was told as of its provider's last render, which a press\n * can beat by one task when a field has just mounted.\n */\n check(validation: ValidationContextValue): boolean {\n let pass = true;\n for (const path of this.byPath.keys()) {\n const combined = this.configFor(path);\n if (combined && !validation.validate(path, combined).valid) pass = false;\n }\n return pass;\n }\n\n private publish(path: string): void {\n this.validation?.registerField(path, this.configFor(path) ?? { checks: [] });\n }\n}\n\n/** The page's record of its mounted checked fields; absent outside a page. */\nexport const CheckedFieldsContext = React.createContext<CheckedFields | null>(null);\n\n/**\n * json-render's `useFieldValidation`, for a control that carries checks. On a\n * page, the field's checks enter the page's record while it is mounted, and\n * the field validates against every check its path carries, so a control\n * hidden or dropped no longer holds the run and two controls on one path\n * agree. A host's own control that carries checks calls this rather than\n * `useFieldValidation` to be held to the same rules; outside a page it is\n * `useFieldValidation`.\n */\nexport function useCheckedField(\n path: string,\n config: ValidationConfig | undefined,\n): ReturnType<typeof useFieldValidation> {\n const fields = React.useContext(CheckedFieldsContext);\n // On a page the record registers the path's combined checks; a field\n // registering its own as well would undo them.\n const field = useFieldValidation(path, fields ? undefined : config);\n const validation = useOptionalValidation();\n // Keyed on what the checks say, not on the object a renderer builds anew at\n // every render, so a keystroke does not leave and enter the record.\n const signature = config ? JSON.stringify(config) : '';\n const latest = React.useRef(config);\n React.useInsertionEffect(() => {\n latest.current = config;\n });\n React.useEffect(() => {\n const entered = latest.current;\n if (!fields || !path || !entered) return undefined;\n return fields.enter(path, entered);\n }, [fields, path, signature]);\n const fallback = field.validate;\n const validate = React.useCallback(() => {\n const combined = fields?.configFor(path);\n return validation && combined ? validation.validate(path, combined) : fallback();\n }, [fields, path, validation, fallback]);\n return { ...field, validate };\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n evaluateVisibility,\n getByPath,\n resolveElementProps,\n resolveRepeatStatePath,\n} from '@json-render/core';\nimport { useRepeatScope, useVisibility } from '@json-render/react';\n\n/**\n * How a page tells its host that one of its elements failed to render.\n *\n * json-render wraps every element in a boundary of its own that catches what\n * the element throws, logs it and renders nothing, so a boundary a host puts\n * around the page never fires: the page arrives with an element missing, its\n * call to action perhaps still there, and the host has nothing to act on.\n * Every renderer of the page's registry is wrapped in a boundary of this\n * module's, inside json-render's, and the page's root gets one too, since\n * json-render resolves an element's props before its renderer runs and puts no\n * boundary above the root. When the host passes a handler, the boundary\n * catches the throw first, renders nothing in its place as json-render's\n * would, and hands the error to the host after the commit, once per element\n * that failed. When it passes none, an element's boundary logs the error as\n * json-render's would and renders nothing, and the root's throws it on, to\n * the host's own boundary. The wrapping does not depend on whether there is a\n * handler, so a host that starts or stops passing one remounts nothing.\n *\n * Unlike json-render's, a failed boundary tries again when what it caught a\n * throw from changes - for an element, its resolved props, the list it\n * repeats over when it repeats, and each child's props and visibility as they\n * resolve, since a child's props are resolved in the child's render and a\n * throw there is the element above's to catch; for the root, the layout and\n * the root's own resolved props - so an element that threw on a word where\n * its list belongs draws once the store holds the list, without remounting\n * the page. What changed is judged by content, read when the boundary fails\n * and again only while it has failed, so a host that hands an equal value as\n * a new object at every render - a spec parsed inline, props resolved afresh\n * - does not retry, throw and report again at every render, and one that\n * corrects its layout in place is judged against what failed. And while the\n * page is `loading`, a failure is neither reported nor logged: a layout still\n * streaming may be caught half-written, so the boundary tries again with each\n * new value and once more when the stream ends, and reports only what still\n * fails then.\n */\n\n/** What a host is told of an element that failed to render. */\nexport interface ElementErrorInfo {\n /** The component type the element named, or the element whose children threw. */\n type: string;\n /** React's component stack at the throw, when React gave one. */\n componentStack?: string;\n}\n\n/** The host's hook for an element's render error. */\nexport type ElementErrorHandler = (error: unknown, info: ElementErrorInfo) => void;\n\n/**\n * Whether the host passes a handler, read by every element's boundary as it\n * renders. A boolean, so a host passing a new callback at every render\n * re-renders no element; only starting or stopping does.\n */\nexport const ReportingContext = React.createContext(false);\n\ninterface BoundaryProps {\n type: string;\n report: React.RefObject<ElementErrorHandler | undefined>;\n /** Whether the host passes a handler, as of this render. */\n reporting: boolean;\n /** Whether the layout is still streaming: a failure is held, and tried again when it ends. */\n loading?: boolean;\n /**\n * A value that changes whenever what the element renders from may have:\n * the cue to read `inputOf` again, while the boundary has failed. A list\n * is compared entry by entry, so the cue can be written inline.\n */\n resetOn?: unknown;\n /**\n * What the element renders from, read only while the boundary has failed:\n * once when it fails, and again at each new `resetOn`. A failed boundary\n * tries again when it reads differently - at each new `resetOn` while the\n * page is loading.\n */\n inputOf?: () => unknown;\n /** The root's boundary: with no handler, it throws the error on to the host's boundary rather than logging it. */\n root?: boolean;\n children: React.ReactNode;\n}\n\ninterface BoundaryState {\n failed: boolean;\n error: unknown;\n}\n\n/** An error as text, for a failure the input itself raises; never throws. */\nfunction said(error: unknown): string {\n try {\n return String(error);\n } catch {\n return 'an error that cannot be written out';\n }\n}\n\n/**\n * A value as the text of its content, for telling a new value from the same\n * one handed again as a new object. What a boundary renders from is mostly\n * JSON a model wrote and the store holds, but a host's store may hold what\n * JSON cannot write - a big integer, a structure that contains itself - so\n * those are written out too, and anything still unwritable is one text: an\n * input read afresh is a new object every time, and compared as itself it\n * would read as changed at every render, retrying and reporting each time.\n */\nfunction contentOf(value: unknown): string {\n const open = new WeakSet<object>();\n try {\n return (\n JSON.stringify(value, function (this: unknown, _key, entry: unknown) {\n if (typeof entry === 'bigint') return `${entry}n`;\n if (typeof entry === 'object' && entry !== null) {\n if (open.has(entry)) return '[cycle]';\n open.add(entry);\n }\n return entry;\n }) ?? 'undefined'\n );\n } catch {\n return 'an input that cannot be written out';\n }\n}\n\n/** Whether two cues are the same: a list entry by entry, anything else by identity. */\nfunction sameCue(a: unknown, b: unknown): boolean {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((entry, index) => Object.is(entry, b[index]));\n }\n return Object.is(a, b);\n}\n\n/** One element's boundary: reports a render error to the host, or logs it, and tries again when its element's input changes. */\nexport class ElementBoundary extends React.Component<BoundaryProps, BoundaryState> {\n /**\n * The content of what the element rendered from when it failed, read at\n * the catch: a spec patched in place afterwards must not move it.\n */\n private failedOn: unknown;\n\n constructor(props: BoundaryProps) {\n super(props);\n this.state = { failed: false, error: undefined };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<BoundaryState> {\n return { failed: true, error };\n }\n\n /** What the element renders from, as text; total, since it reads a model's layout and the store. */\n private input(): unknown {\n try {\n return contentOf(this.props.inputOf ? this.props.inputOf() : this.props.resetOn);\n } catch (error) {\n return `the input could not be read: ${said(error)}`;\n }\n }\n\n override componentDidCatch(error: unknown, info: React.ErrorInfo): void {\n // Held while the layout streams; tried again with each new value and\n // when it ends, so its content is not read at every patch.\n if (this.props.loading) {\n this.failedOn = undefined;\n return;\n }\n this.failedOn = this.input();\n const componentStack = info.componentStack ?? undefined;\n if (this.props.reporting) {\n this.props.report.current?.(error, {\n type: this.props.type,\n ...(componentStack ? { componentStack } : {}),\n });\n return;\n }\n // The root throws the error on as it renders its failure, and the host's\n // boundary records it; an element records it here, as json-render's own\n // boundary would have.\n if (!this.props.root) {\n // eslint-disable-next-line no-console -- the record json-render's boundary writes, in its words.\n console.error(\n `[json-render] Rendering error in <${this.props.type}>:`,\n error,\n componentStack,\n );\n }\n }\n\n override componentDidUpdate(previous: BoundaryProps, previousState: BoundaryState): void {\n // React runs this before `componentDidCatch` in the commit that caught\n // the throw, with the input that threw: only a boundary that had already\n // failed before this update can be looking at a corrected input.\n if (!this.state.failed || !previousState.failed) return;\n const streamEnded = previous.loading === true && !this.props.loading;\n if (streamEnded || this.inputChanged(previous)) {\n this.failedOn = undefined;\n this.setState({ failed: false, error: undefined });\n }\n }\n\n /** Whether what the element renders from is no longer what it failed on. */\n private inputChanged(previous: BoundaryProps): boolean {\n if (sameCue(this.props.resetOn, previous.resetOn)) return false;\n // While a layout streams, each new value is a new layout; after, an equal\n // one handed as a new object is the same input, and is not tried again.\n if (this.props.loading || this.failedOn === undefined) return true;\n return !Object.is(this.input(), this.failedOn);\n }\n\n // Whether the root throws the error on is decided as it renders its\n // failure, from whether the host passes a handler in this very render:\n // decided later, it cost a blank commit and a second record of the same\n // error, and decided from the ref, it read the previous render's callback.\n // No host to tell: the root's error goes on, in the same render, to the\n // host's boundary around the page, which records it once.\n override render(): React.ReactNode {\n if (!this.state.failed) return this.props.children;\n if (this.props.root && !this.props.reporting && !this.props.loading) throw this.state.error;\n return null;\n }\n}\n\n/** An element as json-render hands it to a renderer, or as it carries a child: what is read of it here. */\ninterface ElementLike {\n props?: Record<string, unknown>;\n visible?: unknown;\n repeat?: { statePath?: unknown };\n children?: unknown;\n slots?: unknown;\n}\n\ntype ResolveContext = Parameters<typeof resolveElementProps>[1];\n\n/**\n * An element's props and visibility as json-render resolves them under\n * `ctx`, or the throw resolving them raises, written out: what tells a\n * corrected input from the one that threw, for an element whose resolution\n * is what failed.\n */\nfunction resolvedOf(element: ElementLike | undefined, ctx: ResolveContext): unknown {\n if (!element) return undefined;\n try {\n return {\n props: resolveElementProps(element.props ?? {}, ctx),\n visible:\n element.visible === undefined ? true : evaluateVisibility(element.visible as never, ctx),\n };\n } catch (error) {\n return `throws: ${said(error)}`;\n }\n}\n\n/**\n * The raw element a child node carries, when json-render rendered it for one\n * of the spec's elements - which it names by its key. The node a repeating\n * element gets in its children's place names none, and carries the\n * element's own props, already resolved.\n */\nfunction childElementOf(node: React.ReactNode): ElementLike | undefined {\n if (!React.isValidElement(node)) return undefined;\n const { element, elementKey } = node.props as { element?: unknown; elementKey?: unknown };\n if (typeof elementKey !== 'string') return undefined;\n return typeof element === 'object' && element !== null ? (element as ElementLike) : undefined;\n}\n\n/**\n * What one element renders from, for its boundary to tell a corrected input\n * from the one it failed on: its own props as resolved; for one that\n * repeats, the list it repeats over, which json-render reads inside the\n * element's render; and each child json-render renders under it, as written\n * and as resolved, since a child's props are resolved inside the child's\n * render and a throw there is caught by this boundary, the element above.\n * Read only while the boundary has failed, so a render that does not fail\n * pays for none of it.\n */\nfunction inputOfElement(\n props: Record<string, unknown>,\n visibility: ResolveContext,\n scope: ReturnType<typeof useRepeatScope>,\n): unknown {\n const element = props.element as ElementLike | undefined;\n const state = visibility.stateModel;\n const ctx: ResolveContext = {\n ...visibility,\n ...(scope\n ? { repeatItem: scope.item, repeatIndex: scope.index, repeatBasePath: scope.basePath }\n : {}),\n };\n const statePath = element?.repeat?.statePath;\n let list: unknown;\n if (statePath !== undefined) {\n try {\n const path = resolveRepeatStatePath(statePath as never, scope?.basePath);\n list = path === undefined ? undefined : getByPath(state, path);\n } catch (error) {\n list = `throws: ${said(error)}`;\n }\n }\n const under = (nodes: unknown) =>\n React.Children.toArray(nodes as React.ReactNode).map((node) => {\n const child = childElementOf(node);\n return child ? { element: child, resolved: resolvedOf(child, ctx) } : null;\n });\n const slots =\n typeof props.slots === 'object' && props.slots !== null\n ? Object.fromEntries(Object.entries(props.slots).map(([name, nodes]) => [name, under(nodes)]))\n : undefined;\n return { props: element?.props, list, children: under(props.children), slots };\n}\n\n/**\n * What the page's root renders from: the layout, and the root element's\n * props and visibility as resolved against the store, since json-render\n * resolves them before any boundary of an element's, and a throw there is\n * the root boundary's to catch.\n */\nfunction inputOfRoot(spec: SpecLike | null | undefined, visibility: ResolveContext): unknown {\n const root = spec?.elements?.[spec.root as string] as ElementLike | undefined;\n return { spec, root: resolvedOf(root, visibility) };\n}\n\n/** A layout, as far as the root's boundary reads one. */\ninterface SpecLike {\n root?: unknown;\n elements?: Record<string, unknown>;\n}\n\n/**\n * The boundary around a page's root. It is placed inside json-render's\n * provider, to read the store: a root whose props threw on what the store\n * held tries again when the store changes, as an element does.\n */\nexport function RootBoundary(props: {\n type: string;\n report: React.RefObject<ElementErrorHandler | undefined>;\n reporting: boolean;\n loading: boolean;\n spec: SpecLike | null | undefined;\n children: React.ReactNode;\n}): React.ReactElement {\n const { ctx } = useVisibility();\n return (\n <ElementBoundary\n type={props.type}\n report={props.report}\n reporting={props.reporting}\n loading={props.loading}\n resetOn={[props.spec, ctx]}\n inputOf={() => inputOfRoot(props.spec, ctx)}\n root\n >\n {props.children}\n </ElementBoundary>\n );\n}\n\n/** The wrappers a page has made, by component type, with the renderer each wraps. */\nexport type ReportedRenderers = Map<string, { renderer: unknown; wrapper: unknown }>;\n\n/**\n * The registry with every renderer wrapped in a reporting boundary. A wrapper\n * is made once per type and renderer, and kept in `made` across registries,\n * so a host that hands a registry object rebuilt on each render - its own\n * spread over this entry's, written inline - keeps every component's identity\n * and remounts nothing, as json-render alone would. The handler is read\n * through `report` at the moment of the error, so the host's latest callback\n * is the one called.\n */\nexport function reportingRegistry<R extends Record<string, unknown>>(\n registry: R,\n report: React.RefObject<ElementErrorHandler | undefined>,\n made: ReportedRenderers,\n): R {\n const wrapped: Record<string, unknown> = {};\n for (const [type, Renderer] of Object.entries(registry)) {\n const kept = made.get(type);\n if (kept && kept.renderer === Renderer) {\n wrapped[type] = kept.wrapper;\n continue;\n }\n const Component = Renderer as React.ComponentType<Record<string, unknown>>;\n const Reported = (props: Record<string, unknown>) => {\n const reporting = React.useContext(ReportingContext);\n const { ctx } = useVisibility();\n const scope = useRepeatScope();\n return (\n <ElementBoundary\n type={type}\n report={report}\n reporting={reporting}\n loading={props.loading === true}\n // A new element or a new store is the cue; what changed is read\n // only once the boundary has failed.\n resetOn={[props.element, props.children, props.slots, ctx, scope]}\n inputOf={() => inputOfElement(props, ctx, scope)}\n >\n <Component {...props} />\n </ElementBoundary>\n );\n };\n Reported.displayName = `Reported(${type})`;\n made.set(type, { renderer: Renderer, wrapper: Reported });\n wrapped[type] = Reported;\n }\n return wrapped as R;\n}\n","'use client';\n\nimport { linkTextClass, selectedBorderClass, selectedFillClass } from '../react/role-tokens';\nimport { cn } from '../react/utils';\nimport { useBrand } from './brand-context';\n\n/**\n * The brand's bar: the logo pair and the app's name, the site's links and a\n * tag, in a banner across the top of the page. It is what the catalog's\n * `AppBar` draws, and a host draws it as its own chrome - over a plain form,\n * or above a designed page whose layout has none - inside a `BrandProvider`,\n * or under a `GenerativePage` given a `brand`. It reads the manifest from\n * there, and throws naming the cure when there is none.\n */\n\n/** The page's width and gutters, shared with the product page's chrome. */\nexport const CONTAINER = 'mx-auto w-full max-w-6xl px-6 sm:px-8';\n\nexport interface BrandBarProps {\n /** The app's name, beside the logo. */\n app: string;\n /** The site's links, drawn as words from the small breakpoint up. */\n links?: readonly string[] | null;\n /** A short code at the end of the bar, such as the pipe's. */\n tag?: string | null;\n}\n\nexport function BrandBar({ app, links, tag }: BrandBarProps) {\n const brand = useBrand();\n return (\n <header className=\"border-b border-border\">\n <div className={cn(CONTAINER, 'flex h-16 items-center gap-5')}>\n {/* `no-referrer` on both, as on every image this package paints: the\n scheme is already checked where the manifest is parsed, and a brand\n asset has no more business learning where it was drawn than a\n payload's picture does.\n\n This pair is the one place a `dark:` variant and the token fallbacks\n disagree. A fallback is frozen per utility and cannot vary by scope,\n so a host that defines no tokens renders LIGHT inside `.dark` - but\n the variant still flips, so that host gets the dark-ground asset on\n a light surface. Documented in `docs/theming.md` rather than worked\n around: the swap is right for every host that defines tokens, which\n is every host that sets `.dark` deliberately. */}\n <img\n src={brand.logo.onLight}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"h-7 w-auto dark:hidden\"\n />\n <img\n src={brand.logo.onDark}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"hidden h-7 w-auto dark:block\"\n />\n <span aria-hidden=\"true\" className=\"h-5 w-px bg-border\" />\n <span className=\"text-sm font-medium text-foreground/80\">{app}</span>\n {/* `min-w-0` down to the pill: a pipe's code is one long word, and\n at phone width an unshrinkable pill pushed the row past the viewport. */}\n <div className=\"ml-auto flex min-w-0 items-center gap-6\">\n {links && links.length > 0 ? (\n <nav aria-label=\"Site\" className=\"hidden items-center gap-6 sm:flex\">\n {links.map((link, index) => (\n <a\n // A layout may name one link twice, so the label alone is no key.\n key={`${index}-${link}`}\n href=\"#\"\n onClick={(event) => event.preventDefault()}\n className=\"rounded-sm text-sm text-muted-foreground transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden\"\n >\n {link}\n </a>\n ))}\n </nav>\n ) : null}\n {tag ? (\n <span\n className={cn(\n 'min-w-0 truncate rounded-lg border px-2.5 py-1 font-mono text-[11px]',\n selectedBorderClass,\n selectedFillClass,\n linkTextClass,\n )}\n >\n {tag}\n </span>\n ) : null}\n </div>\n </div>\n </header>\n );\n}\n","import type { z } from 'zod';\nimport { definitionChain, unwrapped, type ZodDefinition } from './zod-definition';\n\n/**\n * What a renderer is handed: its props as the catalog declares them, whatever\n * a layout's expressions resolved to.\n *\n * The checks hold a layout's literals to each prop's schema and the paths the\n * descriptor owns to what the descriptor says they are. A layout's own scratch\n * state is its business, though, and its value is whatever JSON a `setState`\n * wrote, so a prop bound to it can resolve to anything: a structure where a\n * title belongs, a word where a list of options belongs. A renderer that\n * trusted its declared type then threw - an object is not a React child, and a\n * string has no `map` - and json-render's element boundary dropped the element\n * from the page, past both checks. And a run's payload is the run's: a value\n * the descriptor calls a list may still arrive as something else.\n *\n * So every renderer of this entry's registry is handed props conformed to its\n * definition, once, here, rather than each renderer guarding each prop. A\n * value its schema accepts is passed as it is. One it refuses is replaced by\n * the nearest value of the declared type: a number or a boolean in a text prop\n * is written out, as an interpolation would write it, and so is one among the\n * entries of a list of texts; a list keeps the entries its item schema\n * accepts, and is itself held to the list's bounds once they are dropped, so\n * a `Tabs` left with one tab of the two it must have draws none rather than\n * one; anything else is absent - null where the prop is nullable, and for a\n * required text or list prop the empty text or list, which a renderer draws as\n * nothing. A prop declared `any` (a value a renderer shows, a table's rows) is\n * the renderer's own to read, through `textOf` where it writes one out.\n *\n * It runs on every render of every element, so it parses as little as it can.\n * What a schema says of an absent value is worked out once per schema; a\n * scalar against a plain text, number or boolean schema is judged by its type\n * alone; and a structure or a list is judged once per schema and value, so the\n * list a `$state` reads out of the store is parsed when the store changes and\n * not at each render - and when it is refused, the entries it keeps come back\n * as the same list each time, so a renderer whose effect is keyed on the prop\n * does not run it at every render.\n */\n\n/** What a schema says of an absent value, worked out once. */\ninterface SchemaFacts {\n def: ZodDefinition | undefined;\n /** The scalar type a value conforms to by its type alone, when the schema refines nothing. */\n plain: 'string' | 'boolean' | 'number' | undefined;\n acceptsNull: boolean;\n acceptsUndefined: boolean;\n /** What the prop resolves to when it is absent or refused. */\n absent: unknown;\n}\n\nconst factsBySchema = new WeakMap<z.ZodType, SchemaFacts>();\n\nfunction factsOf(schema: z.ZodType): SchemaFacts {\n const known = factsBySchema.get(schema);\n if (known) return known;\n const chain = definitionChain(schema);\n const def = chain[chain.length - 1];\n const acceptsNull = schema.safeParse(null).success;\n const acceptsUndefined = schema.safeParse(undefined).success;\n const absent = acceptsNull\n ? null\n : acceptsUndefined\n ? undefined\n : def?.type === 'string'\n ? ''\n : def?.type === 'array'\n ? []\n : undefined;\n const facts = { def, plain: plainType(chain), acceptsNull, acceptsUndefined, absent };\n factsBySchema.set(schema, facts);\n return facts;\n}\n\n/** The wrappers that hand a present value to the schema they wrap and its result back unchanged. */\nconst PASSING_WRAPPERS: ReadonlySet<string> = new Set([\n 'optional',\n 'nullable',\n 'default',\n 'prefault',\n 'readonly',\n 'catch',\n 'nonoptional',\n]);\n\n/**\n * The scalar type a value conforms to by its type alone: a text, a boolean\n * or a number schema with no refinement and no format on it, under wrappers\n * that pass a present value through and refine nothing either. Anything else\n * - an enum, a bounded text, an email, an integer, a `.refine` on the\n * nullable around a text - is parsed.\n */\nfunction plainType(chain: readonly ZodDefinition[]): SchemaFacts['plain'] {\n const def = chain[chain.length - 1];\n if (!def || def.format !== undefined) return undefined;\n if (chain.some((link) => link.checks !== undefined && link.checks.length > 0)) return undefined;\n if (!chain.slice(0, -1).every((link) => PASSING_WRAPPERS.has(link.type))) return undefined;\n return def.type === 'string' || def.type === 'boolean' || def.type === 'number'\n ? def.type\n : undefined;\n}\n\n/** Whether a scalar conforms by its type alone, against a schema `plainType` read as plain. */\nfunction plainlyConforms(plain: SchemaFacts['plain'], value: unknown): boolean {\n if (plain === 'number') return typeof value === 'number' && Number.isFinite(value);\n return plain !== undefined && typeof value === plain;\n}\n\n/** A scalar's nearest value of a text schema: a number or a boolean written out, or nothing. */\nfunction writtenOut(schema: z.ZodType, value: unknown): string | undefined {\n if (typeof value !== 'number' && typeof value !== 'boolean') return undefined;\n const text = String(value);\n return schema.safeParse(text).success ? text : undefined;\n}\n\n/** A refused list's nearest value: the entries its item schema accepts, or writes out, held to its bounds. */\nfunction keptEntries(\n schema: z.ZodType,\n element: z.ZodType,\n entries: readonly unknown[],\n absent: unknown,\n): unknown {\n const textItems = unwrapped(element)?.type === 'string';\n const kept = entries.flatMap((entry) => {\n if (element.safeParse(entry).success) return [entry];\n const text = textItems ? writtenOut(element, entry) : undefined;\n return text === undefined ? [] : [text];\n });\n return schema.safeParse(kept).success ? kept : absent;\n}\n\n/** What a structure or a list conformed to, by schema and value. */\nconst conformedBySchema = new WeakMap<z.ZodType, WeakMap<object, unknown>>();\n\n/** One prop's resolved value, held to its schema. */\nfunction conformValue(schema: z.ZodType, value: unknown): unknown {\n const facts = factsOf(schema);\n if (value === undefined) return facts.acceptsUndefined ? value : facts.absent;\n if (value === null) return facts.acceptsNull ? value : facts.absent;\n if (typeof value !== 'object') {\n if (plainlyConforms(facts.plain, value) || schema.safeParse(value).success) return value;\n if (facts.def?.type === 'string') return writtenOut(schema, value) ?? facts.absent;\n return facts.absent;\n }\n let byValue = conformedBySchema.get(schema);\n if (!byValue) {\n byValue = new WeakMap();\n conformedBySchema.set(schema, byValue);\n }\n if (byValue.has(value)) return byValue.get(value);\n const held = schema.safeParse(value).success\n ? value\n : facts.def?.type === 'array' && facts.def.element && Array.isArray(value)\n ? keptEntries(schema, facts.def.element, value, facts.absent)\n : facts.absent;\n byValue.set(value, held);\n return held;\n}\n\n/**\n * Props held to a component's declared shape. The same object comes back when\n * every value already conforms, which is every render of a layout whose\n * expressions resolved to what they should, so a renderer sees no new props\n * object for nothing. A prop the shape does not declare is passed through: the\n * catalog check refuses one, and this is not the place to restate it, and\n * neither is a prop named in `asWritten`, whose renderer reads it as it came.\n */\nexport function conformProps<P extends Record<string, unknown>>(\n shape: Readonly<Record<string, z.ZodType>>,\n props: P,\n asWritten: readonly string[] = [],\n): P {\n let conformed: Record<string, unknown> | undefined;\n for (const [name, schema] of Object.entries(shape)) {\n if (asWritten.includes(name)) continue;\n const value = props[name];\n const held = conformValue(schema, value);\n if (held === value) continue;\n conformed ??= { ...props };\n conformed[name] = held;\n }\n return (conformed ?? props) as P;\n}\n\n/** A component definition as a catalog carries it: what matters here is its props schema. */\ntype Definitions = Readonly<Record<string, { props?: unknown }>>;\n\n/**\n * Renderers that are handed their props conformed to the definitions they\n * render, each wrapped once. A renderer the definitions do not name is\n * returned as it is. `asWritten` names, per component, the props whose\n * nearest value would mean something else: a `path` the layer resolves as\n * written - a hatch's, a `Picture`'s - is relative inside a repeat, so a\n * refused one written out as text would bind a live field to some other\n * corner of the state (a `0` read from scratch state is the item's first\n * entry), and an empty one is the item itself; a refused path must reach its\n * renderer as refused.\n */\nexport function withDeclaredProps<R extends Record<string, (ctx: never) => unknown>>(\n definitions: Definitions,\n renderers: R,\n asWritten: Readonly<Record<string, readonly string[]>> = {},\n): R {\n const wrapped: Record<string, unknown> = {};\n for (const [name, render] of Object.entries(renderers)) {\n const schema = definitions[name]?.props as { shape?: Record<string, z.ZodType> } | undefined;\n const shape = schema?.shape;\n wrapped[name] = shape\n ? (ctx: { props: Record<string, unknown> }) =>\n (render as (ctx: unknown) => unknown)({\n ...ctx,\n props: conformProps(shape, ctx.props, asWritten[name]),\n })\n : render;\n }\n return wrapped as R;\n}\n\n/**\n * A value as the text a renderer writes out, for a prop declared `any`. A\n * scalar is written as it is; a list is its entries written out and joined;\n * a structure is no text at all, so the renderer shows what it shows for a\n * value that is not there rather than `[object Object]`. The checks refuse a\n * read of a structure the descriptor owns into such a prop; this is for one\n * that reached it anyway, out of a layout's own scratch state, where a\n * `setState` wrote whatever JSON it wrote - one carrying its own `toString`\n * member included, which `String` throws on.\n */\nexport function textOf(value: unknown): string {\n if (value === undefined || value === null) return '';\n if (Array.isArray(value)) {\n return value\n .map(textOf)\n .filter((text) => text !== '')\n .join(', ');\n }\n if (typeof value === 'object') return '';\n return String(value);\n}\n","'use client';\n\nimport * as React from 'react';\n\n/**\n * What a host's compose-then-result frame tells the frame components of a\n * layout - the facts no descriptor carries.\n *\n * A layout written for the `composer` frame places the host's action row\n * through `Composer`, and one written for the `result` frame places the\n * host's actions through `ResultHeader`. What those rows SAY beyond the\n * layout's own words is the host's knowledge: how long a run usually takes,\n * what the result's actions are called and what they do. The layout names\n * where they go; the host fills them.\n */\nexport interface FrameHost {\n /** How long a run usually takes, from the app's past runs: \"Takes about 30 seconds\". */\n eta?: string;\n /** The result's actions, primary first: \"Download PDF\", \"Share\". */\n actions?: readonly string[];\n /** What an action does, by its label. */\n onAction?: (label: string) => void;\n}\n\nconst FrameHostContext = React.createContext<FrameHost>({});\n\nexport function FrameHostProvider({\n host,\n children,\n}: {\n host: FrameHost;\n children: React.ReactNode;\n}) {\n return <FrameHostContext.Provider value={host}>{children}</FrameHostContext.Provider>;\n}\n\nexport function useFrameHost(): FrameHost {\n return React.useContext(FrameHostContext);\n}\n","'use client';\n\nimport * as React from 'react';\nimport { type BaseComponentProps, useBoundProp } from '@json-render/react';\nimport { useCheckedField } from '../checked-fields';\nimport { hasOwnProp } from '../../core/own-property';\nimport { enumLabeler, useFieldPresentation } from '../../react/field-presentation';\nimport { fieldControlClass } from '../../react/field-styles';\nimport { checkedAccentClass, focusOutlineClass } from '../../react/role-tokens';\nimport { headingClass, panelFlatShadowClass, panelSurfaceClass } from '../../react/style-tokens';\nimport { cn } from '../../react/utils';\nimport { ChevronDown } from 'lucide-react';\nimport { Switch as SwitchPrimitive } from '../../react/ui/switch';\n\n/**\n * The renderers for the shadcn subset the catalog picks.\n *\n * They are the package's own, over the same theme tokens the kernel's controls\n * read, for the same reason the controls vendor their primitives: a consumer\n * of `./generative` installs this package and a handful of radix primitives,\n * never a component library. The DEFINITIONS these implement live in\n * `../shadcn-definitions.ts`, and `docs/dependency-budget.md` states the pair.\n *\n * A bound prop is read through `useBoundProp` and written back at the path the\n * spec named, so what the person types lands in the host's store and nowhere\n * else. An unbound one falls back to component state, which is what lets a\n * layout be rendered over an empty store while it is being read.\n */\n\ntype Check = { type: string; message: string; args?: Record<string, unknown> };\ntype ValidateOn = 'change' | 'blur' | 'submit';\n\ninterface BoundFieldProps {\n checks?: Check[] | null;\n validateOn?: ValidateOn | null;\n}\n\n/**\n * The one piece of binding every input repeats: the value the control shows,\n * the setter that writes it back, and the checks the spec attached to it.\n * `useCheckedField` is given a binding only when there is both a path and a\n * check, so an unbound control never registers a validator the run would wait\n * on.\n */\nfunction useBoundField<T>(\n literal: T | null | undefined,\n binding: string | undefined,\n empty: T,\n { checks, validateOn }: BoundFieldProps,\n) {\n const [boundValue, setBoundValue] = useBoundProp<T>(literal ?? undefined, binding);\n const [localValue, setLocalValue] = React.useState<T>(literal ?? empty);\n const isBound = Boolean(binding);\n const hasValidation = Boolean(binding && checks?.length);\n const when = validateOn ?? 'change';\n const { errors, validate } = useCheckedField(\n binding ?? '',\n hasValidation ? { checks: checks ?? [], validateOn: when } : undefined,\n );\n return {\n value: isBound ? (boundValue ?? empty) : localValue,\n setValue: (next: T) => {\n if (isBound) setBoundValue(next);\n else setLocalValue(next);\n },\n error: errors[0],\n validateOnChange: () => {\n if (hasValidation && when === 'change') validate();\n },\n validateOnBlur: () => {\n if (hasValidation && when === 'blur') validate();\n },\n };\n}\n\nconst LABEL = 'block text-sm leading-none font-medium';\n\nfunction FieldError({ message }: { message?: string }) {\n return message ? <p className=\"text-sm text-destructive\">{message}</p> : null;\n}\n\n/**\n * The key a closed map answers to, or the fallback.\n *\n * Every map below is keyed by a prop the catalog declares as an enum, and a\n * renderer must not trust that: an expression-valued prop skips the zod check,\n * and a `$template` with nothing to interpolate resolves to a literal, so the\n * string can be anything a layout wrote - `constructor` included, which a bare\n * lookup answers with a function off `Object.prototype`. Both gates refuse the\n * shape; the prop's own type stays the contract; this is what happens when a\n * stored artifact disagrees with it. The read is `hasOwnProp`, the kernel's one\n * spelling of an own-property read (and `Object.hasOwn` is ES2022, past the\n * package's ES2020 target), so an inherited name is not a hit; the fallback is\n * typed as one of the map's own keys.\n */\nexport function pickKey<K extends string>(\n table: Record<K, unknown>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): K {\n return key != null && hasOwnProp(table, key) ? (key as K) : fallback;\n}\n\n/** The value a closed map holds for `key`, or for the fallback when `key` is not one of its own. */\nexport function pick<K extends string, T>(\n table: Record<K, T>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): T {\n return table[pickKey(table, key, fallback)];\n}\n\n// ── Layout ──────────────────────────────────────────────────────────────────\n\nexport function Card({\n props,\n children,\n}: BaseComponentProps<{ title?: string | null; description?: string | null }>) {\n return (\n // A style's panel: a host writes the style's field fill onto `--input`\n // here, as on its own panel, so the fields inside do not sink into it.\n // A panel's corner is one and a half times a control's, as the rail's is.\n <div\n data-style-panel=\"\"\n className={cn(\n 'rounded-[calc(var(--radius,0.5rem)*1.5)] p-6 text-card-foreground',\n panelSurfaceClass,\n panelFlatShadowClass,\n )}\n >\n {props.title || props.description ? (\n <div className=\"mb-4 space-y-1.5\">\n {props.title ? (\n <h3 className={cn('text-lg leading-none', headingClass(600))}>{props.title}</h3>\n ) : null}\n {props.description ? (\n <p className=\"text-sm text-muted-foreground\">{props.description}</p>\n ) : null}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\nconst GAP = {\n none: 'gap-0',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8',\n};\n\nconst ALIGN = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n};\n\nconst JUSTIFY = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n};\n\nexport function Stack({\n props,\n children,\n}: BaseComponentProps<{\n direction?: 'horizontal' | 'vertical' | null;\n gap?: keyof typeof GAP | null;\n align?: keyof typeof ALIGN | null;\n justify?: keyof typeof JUSTIFY | null;\n}>) {\n const horizontal = props.direction === 'horizontal';\n return (\n <div\n className={cn(\n 'flex',\n horizontal ? 'flex-row' : 'flex-col',\n pick(GAP, props.gap, 'md'),\n pick(ALIGN, props.align, horizontal ? 'start' : 'stretch'),\n props.justify ? pick(JUSTIFY, props.justify, 'start') : undefined,\n )}\n >\n {children}\n </div>\n );\n}\n\n/** Enumerated rather than interpolated: Tailwind compiles the class names it can see. */\nconst COLUMNS: Record<number, string> = {\n 1: 'grid-cols-1',\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-2 lg:grid-cols-3',\n 4: 'sm:grid-cols-2 lg:grid-cols-4',\n 5: 'sm:grid-cols-2 lg:grid-cols-5',\n 6: 'sm:grid-cols-2 lg:grid-cols-6',\n};\n\nexport function Grid({\n props,\n children,\n}: BaseComponentProps<{ columns?: number | null; gap?: keyof typeof GAP | null }>) {\n const columns = Math.min(Math.max(Math.round(props.columns ?? 2), 1), 6);\n return (\n <div className={cn('grid grid-cols-1', COLUMNS[columns], pick(GAP, props.gap, 'md'))}>\n {children}\n </div>\n );\n}\n\nexport function Separator({\n props,\n}: BaseComponentProps<{ orientation?: 'horizontal' | 'vertical' | null }>) {\n const vertical = props.orientation === 'vertical';\n return (\n <div\n role=\"separator\"\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n className={cn('shrink-0 bg-border', vertical ? 'h-full w-px' : 'h-px w-full')}\n />\n );\n}\n\n/**\n * `details`/`summary` rather than a disclosure primitive: the open state is the\n * element's own, which is what the catalog asks for (a page's UI state never\n * reaches `/state`), and a closed section still exists for find-in-page.\n */\nexport function Collapsible({\n props,\n children,\n}: BaseComponentProps<{ title: string; defaultOpen?: boolean | null }>) {\n return (\n <details\n className=\"rounded-md border border-border\"\n open={props.defaultOpen ?? false}\n data-slot=\"collapsible\"\n >\n {/* A chevron that turns as it opens: without one the closed section\n read as an empty text field with a placeholder. */}\n <summary className=\"flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-md px-4 py-3 text-sm font-medium select-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset [&::-webkit-details-marker]:hidden\">\n <span>{props.title}</span>\n <ChevronDown\n aria-hidden=\"true\"\n className=\"size-4 shrink-0 text-muted-foreground transition-transform [details[open]>summary_&]:rotate-180\"\n />\n </summary>\n <div className=\"border-t border-border px-4 py-3\">{children}</div>\n </details>\n );\n}\n\n// ── Content ─────────────────────────────────────────────────────────────────\n\n// Every level reads the page's heading style (`react/style-tokens`), falling\n// back to the weight and tracking it was set in.\nconst HEADING = {\n h1: cn('text-3xl', headingClass(700, true)),\n h2: cn('text-2xl', headingClass(600, true)),\n h3: cn('text-lg', headingClass(600)),\n h4: cn('text-base', headingClass(600)),\n};\n\nexport function Heading({\n props,\n}: BaseComponentProps<{ text: string; level?: 'h1' | 'h2' | 'h3' | 'h4' | null }>) {\n // The tag is looked up in the same closed map the class comes from, never\n // taken from the prop. `const Tag = level` made an arbitrary string a DOM tag\n // name, and a prop can carry one (`pickKey` says how): a server-rendered host\n // emitted `<script>` from a layout that passed both gates.\n const Tag = pickKey(HEADING, props.level, 'h2');\n return <Tag className={cn('text-foreground', HEADING[Tag])}>{props.text}</Tag>;\n}\n\nconst TEXT = {\n body: 'text-sm text-foreground',\n caption: 'text-xs text-muted-foreground',\n muted: 'text-sm text-muted-foreground',\n lead: 'text-lg text-muted-foreground',\n code: 'font-mono text-[13px] text-foreground',\n};\n\nexport function Text({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'body' | 'caption' | 'muted' | 'lead' | 'code' | null;\n}>) {\n return <p className={pick(TEXT, props.variant, 'body')}>{props.text}</p>;\n}\n\nconst AVATAR_SIZE = {\n sm: 'size-8 text-[11px]',\n md: 'size-10 text-xs',\n lg: 'size-12 text-sm',\n};\n\n/** Initials only: the catalog's description tells a model never to set `src`. */\nfunction initialsOf(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n if (words.length === 0) return '?';\n const first = words[0]?.[0] ?? '';\n const last = words.length > 1 ? (words[words.length - 1]?.[0] ?? '') : '';\n return (first + last).toUpperCase();\n}\n\nexport function Avatar({\n props,\n}: BaseComponentProps<{ name: string; size?: 'sm' | 'md' | 'lg' | null }>) {\n const name = String(props.name ?? '');\n return (\n <span\n className={cn(\n 'inline-flex shrink-0 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground',\n pick(AVATAR_SIZE, props.size, 'md'),\n )}\n aria-label={name || undefined}\n role=\"img\"\n >\n {initialsOf(name)}\n </span>\n );\n}\n\nconst BADGE = {\n default: 'bg-primary text-primary-foreground',\n secondary: 'bg-secondary text-secondary-foreground',\n destructive: 'bg-destructive text-white',\n outline: 'border border-border text-foreground',\n};\n\nexport function Badge({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'default' | 'secondary' | 'destructive' | 'outline' | null;\n}>) {\n return (\n <span\n className={cn(\n 'inline-flex w-fit items-center rounded-md px-2 py-0.5 text-xs font-medium',\n pick(BADGE, props.variant, 'default'),\n )}\n >\n {props.text}\n </span>\n );\n}\n\nconst ALERT = {\n info: 'border-border bg-muted text-foreground',\n success: 'border-border bg-muted text-foreground',\n warning: 'border-border bg-muted text-foreground',\n error: 'border-destructive/50 bg-destructive/10 text-foreground',\n};\n\nexport function Alert({\n props,\n}: BaseComponentProps<{\n title: string;\n message?: string | null;\n type?: 'info' | 'success' | 'warning' | 'error' | null;\n}>) {\n const type = pickKey(ALERT, props.type, 'info');\n return (\n <div\n role={type === 'error' ? 'alert' : 'status'}\n className={cn('rounded-md border px-4 py-3 text-sm', ALERT[type])}\n >\n <p className=\"font-medium\">{props.title}</p>\n {props.message ? <p className=\"mt-1 text-muted-foreground\">{props.message}</p> : null}\n </div>\n );\n}\n\nexport function Progress({\n props,\n}: BaseComponentProps<{ value: number; max?: number | null; label?: string | null }>) {\n const max = props.max ?? 100;\n const value = Math.min(Math.max(Number(props.value) || 0, 0), max);\n const percent = max > 0 ? (value / max) * 100 : 0;\n return (\n <div className=\"space-y-1.5\">\n {props.label ? <p className=\"text-sm text-muted-foreground\">{props.label}</p> : null}\n <div\n role=\"progressbar\"\n aria-valuenow={value}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-label={props.label ?? undefined}\n className=\"h-2 w-full overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary transition-all\" style={{ width: `${percent}%` }} />\n </div>\n </div>\n );\n}\n\n// ── Inputs ──────────────────────────────────────────────────────────────────\n\n/**\n * A stable id per mounted control, for the label that names it.\n *\n * `useId` rather than a module-level counter, for the reason\n * `src/react/field-dom-id.tsx` already gives: it is unique per instance within\n * a React root AND hydration-stable. A counter is neither. It is module state\n * that lives as long as the process, so a server module that has served earlier\n * requests is already advanced while the freshly loaded client module starts at\n * zero - and these controls carry `'use client'`, which means they are still\n * server-rendered and then hydrated. `useMemo` is documented as a hint a\n * renderer may discard, so the id was not guaranteed stable within one session\n * either; when it changed, the label stopped naming its input and the control\n * lost its accessible name, which no story test can see because none of them\n * render on a server.\n */\nexport function useControlId(name: string): string {\n return `jr-${name}-${React.useId()}`;\n}\n\nexport function Input({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n type?: 'text' | 'email' | 'password' | 'number' | null;\n placeholder?: string | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n className={cn(fieldControlClass, 'min-h-11 px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onFocus={() => emit('focus')}\n onBlur={() => {\n field.validateOnBlur();\n emit('blur');\n }}\n />\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Textarea({\n props,\n bindings,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n placeholder?: string | null;\n rows?: number | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 4}\n className={cn(fieldControlClass, 'px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onBlur={field.validateOnBlur}\n />\n <FieldError message={field.error} />\n </div>\n );\n}\n\n/**\n * A native radio or check box: checked in the accent ink, as every selection\n * reads the accent rather than the button colour, and focused in `--ring`, as\n * everything in the tab order is, never in the browser's own ring.\n */\nconst NATIVE_CHECK = cn('size-4 shrink-0', checkedAccentClass, focusOutlineClass);\n\n/**\n * The label a native radio or check box sits in, which is where a finger\n * lands: a tap anywhere on a label activates the control it wraps. The box\n * keeps its 16 pixels, and below `sm` its row grows to 44 pixels tall across\n * the column, so the target is the whole row rather than the box.\n */\nconst NATIVE_CHECK_ROW = 'flex items-center gap-2 text-sm max-sm:min-h-11';\n\nexport function Radio({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; options: string[]; value?: string | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props);\n const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\n return (\n <fieldset className=\"space-y-2\" aria-invalid={field.error ? true : undefined}>\n <legend className={LABEL}>{props.label}</legend>\n {/* Rows of 44 pixels need no gap between them on a phone. */}\n <div className=\"space-y-2 max-sm:space-y-0\">\n {(props.options ?? []).map((option, index) => (\n <label key={`${index}-${option}`} className={NATIVE_CHECK_ROW}>\n <input\n type=\"radio\"\n name={id}\n value={option}\n checked={field.value === option}\n className={NATIVE_CHECK}\n onChange={() => {\n field.setValue(option);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{labelOf(option)}</span>\n </label>\n ))}\n </div>\n <FieldError message={field.error} />\n </fieldset>\n );\n}\n\nexport function Checkbox({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={NATIVE_CHECK_ROW}>\n <input\n id={id}\n name={props.name}\n type=\"checkbox\"\n className={NATIVE_CHECK}\n checked={field.value}\n aria-invalid={field.error ? true : undefined}\n onChange={(event) => {\n field.setValue(event.target.checked);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{props.label}</span>\n </label>\n <FieldError message={field.error} />\n </div>\n );\n}\n\nexport function Switch({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props);\n return (\n <div className=\"space-y-2\">\n {/* Room for the switch's 44px hit area below `sm`, inside its own row. */}\n <div className=\"flex items-center gap-3 max-sm:py-2.5\">\n <SwitchPrimitive\n id={id}\n name={props.name}\n checked={field.value}\n aria-invalid={field.error ? true : undefined}\n onCheckedChange={(next) => {\n field.setValue(next);\n field.validateOnChange();\n emit('change');\n }}\n />\n <label htmlFor={id} className=\"text-sm\">\n {props.label}\n </label>\n </div>\n <FieldError message={field.error} />\n </div>\n );\n}\n\n// ── Actions ─────────────────────────────────────────────────────────────────\n\nconst BUTTON = {\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n danger: 'bg-destructive text-white hover:bg-destructive/90',\n};\n\nexport function Button({\n props,\n emit,\n}: BaseComponentProps<{\n label: string;\n variant?: 'primary' | 'secondary' | 'danger' | null;\n disabled?: boolean | null;\n}>) {\n return (\n <button\n type=\"button\"\n disabled={props.disabled ?? false}\n className={cn(\n 'inline-flex min-h-11 w-fit items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-colors',\n 'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background',\n 'disabled:pointer-events-none disabled:opacity-50',\n pick(BUTTON, props.variant, 'primary'),\n )}\n onClick={() => emit('press')}\n >\n {props.label}\n </button>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n type BaseComponentProps,\n type Components,\n useBoundProp,\n useRepeatScope,\n useStateStore,\n useStateValue,\n} from '@json-render/react';\nimport { useCheckedField } from './checked-fields';\nimport {\n Accessibility,\n AlertCircle,\n Baby,\n Banknote,\n BarChart3,\n Bookmark,\n Briefcase,\n Building2,\n Calendar,\n Camera,\n Car,\n CheckCircle2,\n Clock,\n Coffee,\n Coins,\n Compass,\n FileText,\n Flag,\n Gift,\n Globe,\n Hash,\n Heart,\n Home,\n Hotel,\n Hourglass,\n Image,\n Info,\n Landmark,\n Layers,\n Leaf,\n Lightbulb,\n ListChecks,\n type LucideIcon,\n Mail,\n Map,\n MapPin,\n Moon,\n Mountain,\n Music,\n Package,\n Paperclip,\n Pencil,\n Percent,\n Phone,\n Plane,\n Receipt,\n Rocket,\n Route,\n Send,\n Shield,\n Ship,\n Sparkles,\n Star,\n Sun,\n Tag,\n Ticket,\n Train,\n TrendingUp,\n Truck,\n Upload,\n User,\n Users,\n Utensils,\n Wallet,\n Zap,\n} from 'lucide-react';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport type { RunField } from '../core';\nimport { readDateContent } from '../core/native-content';\nimport { FieldRenderer, ResultField, type FieldEnv } from '../react';\nimport { linkTextClass, selectedFillStrongClass } from '../react/role-tokens';\nimport { fieldControlClass } from '../react/field-styles';\nimport { enumLabeler, useFieldPresentation } from '../react/field-presentation';\nimport { ResultRoot } from '../react/result-location';\nimport {\n Select as SelectRoot,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../react/ui/select';\nimport { ToggleGroup, ToggleGroupItem } from '../react/ui/toggle-group';\nimport { cn } from '../react/utils';\nimport { baseCatalog, type ICON_NAMES, type METRIC_FORMATS } from './components';\nimport { textOf, withDeclaredProps } from './declared-props';\nimport * as shadcn from './ui/shadcn';\nimport { inputFieldAtPath, RESULT_ROOT, resultFieldAtPath, segmentsUnder } from './paths';\n\n/**\n * The registry: what each catalog entry RENDERS as.\n *\n * The shadcn subset binds the package's own implementations. The custom\n * components are implemented here over this package's controls and vendored\n * primitives - the vocabulary of an app (Split, Tabs, Steps, Icon, Segmented,\n * NumberInput), the bound equivalents of what a model most wants to inline\n * (DataTable, Metric), and the two escape hatches the design rests on:\n *\n * - `MthdsField` renders ONE input through `FieldRenderer`, two-way at the\n * path the spec names. It is the arm for the kinds the catalog cannot\n * enter, and it is always available for a scalar the model would rather\n * not style.\n * - `MthdsResult` renders ONE result subtree through `ResultField`, reading\n * state at the path the spec names.\n *\n * Both resolve the path against the DESCRIPTOR, through `DescriptorProvider`,\n * which is what keeps rule 1: the spec names a path and nothing more, and the\n * kernel is handed the `RunField` the host already holds. A spec never\n * restates what a field is.\n */\n\nexport interface DescriptorScope {\n /** The input page's top-level fields, for `/inputs/...` paths. */\n inputs?: readonly RunField[];\n /** The result page's descriptor, for `/result/...` paths. */\n result?: RunField;\n /** What the host injects into the controls: upload, disabled, resolver. */\n env?: FieldEnv;\n /** Prefix for the DOM ids `MthdsField` mints; two pages on one screen need two. */\n idPrefix?: string;\n}\n\nconst DescriptorContext = React.createContext<DescriptorScope>({});\n\n/** The scope the nearest `DescriptorProvider` set - for a renderer defined outside this file. */\nexport function useDescriptorScope(): DescriptorScope {\n return React.useContext(DescriptorContext);\n}\n\nexport function DescriptorProvider({\n scope,\n children,\n}: {\n scope: DescriptorScope;\n children: React.ReactNode;\n}) {\n return <DescriptorContext.Provider value={scope}>{children}</DescriptorContext.Provider>;\n}\n\nfunction Unresolved({ path, side }: { path: unknown; side: 'input' | 'result' }) {\n return (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/50 px-2.5 py-1.5 text-[12px] text-destructive\"\n >\n {side === 'input' ? 'No input' : 'No result'} at{' '}\n <span className=\"font-mono\">\n {typeof path === 'string' ? path : (JSON.stringify(path) ?? String(path))}\n </span>\n </p>\n );\n}\n\n/**\n * A pointer segment as one piece of a DOM id, and back.\n *\n * The id is built by joining the pointer's segments with `-`, so a segment that\n * contains a `-` of its own would make the join ambiguous: `/inputs/a-b` and\n * `/inputs/a/b` mint the same id, and the inverse below then hands a host the\n * wrong path to write an uploaded file to - plausible-looking, silent, and\n * wrong. This used to rest on a comment asserting that a field's name carries\n * no `-`; nothing here can enforce that, because a name reaches the descriptor\n * from a JSON Schema property. So the separator is escaped instead.\n *\n * `_` goes first, which is what makes the pass unambiguous: every `_` in the\n * output that is not one this function wrote has already been doubled, so the\n * single left-to-right decode below cannot mistake one for the other. Names\n * without `_`, `-` or `~` - which is every name in practice - pass through\n * untouched, so the ids this mints are the ids it always minted.\n */\nfunction encodeSegment(segment: string): string {\n return segment.replace(/_/g, '_u').replace(/-/g, '_d').replace(/~/g, '_t');\n}\n\nfunction decodeSegment(segment: string): string {\n return segment.replace(/_([udt])/g, (_match, code: string) =>\n code === 'u' ? '_' : code === 'd' ? '-' : '~',\n );\n}\n\n/**\n * Exported for the round-trip test only, not from the entry's index: the pair\n * is only correct together, so a test that could see just one half of it would\n * be no guard at all.\n */\nexport function domIdFor(prefix: string | undefined, path: string): string {\n return `${prefix ?? 'gen'}${path.split('/').map(encodeSegment).join('-')}`;\n}\n\n/**\n * The inverse of `domIdFor`, for a host's upload seam: the kernel reports a\n * drop by the DOM id of the field it landed on, which for a nested one is the\n * hatch's id with the child's name or index joined by `.` (the kernel's own\n * composition, `FieldRenderer` through `ObjectField` and `ListField`), and\n * the host writes the file at the store path that id was minted from. Kept\n * beside `domIdFor` so the two cannot drift, and exact for any name by\n * construction rather than by assumption.\n */\nexport function pathFromDomId(prefix: string | undefined, id: string): string | undefined {\n const head = prefix ?? 'gen';\n if (!id.startsWith(head)) return undefined;\n const [own = '', ...children] = id.slice(head.length).split('.');\n if (!own.startsWith('-')) return undefined;\n const path = own.split('-').map(decodeSegment).join('/');\n return `${path}${children.map((child) => `/${child}`).join('')}`;\n}\n\n/**\n * The path a hatch resolves: absolute as written, or, inside a repeat, the\n * item's field name joined onto the current item's base path. A relative path\n * outside any repeat resolves to nothing, and the hatch says so.\n */\nfunction useAbsolutePath(path: unknown): string | undefined {\n const repeat = useRepeatScope();\n // The checks hold a hatch's `path` to a literal text; a layout rendered\n // past them may hand anything here, which resolves to nothing - never read\n // as some other path, as a number written out would be inside a repeat.\n if (typeof path !== 'string') return undefined;\n if (path.startsWith('/')) return path;\n // Raw, not `joinPath`: the same reason `absoluteHatchPath` gives - a relative\n // hatch path may name several segments, so its `/` are separators already.\n return repeat ? `${repeat.basePath}/${path}` : undefined;\n}\n\n// ─── The escape hatches ──────────────────────────────────────────────────────\n\n/** A label without a trailing \"(optional)\", which the kernel's own badge says. */\nfunction withoutOptionalMark(label: string): string {\n return label.replace(/\\s*\\(optional\\)\\s*$/i, '') || label;\n}\n\nfunction MthdsField({\n props,\n}: BaseComponentProps<{ path: string; label?: string | null; hint?: string | null }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const found = scope.inputs && path ? inputFieldAtPath(scope.inputs, path) : undefined;\n // The page's own words for the label and the line under it, where it wrote them.\n const field = React.useMemo(\n () =>\n found && (props.label || props.hint)\n ? {\n ...found,\n // The control marks an optional field itself, so a label that\n // says \"(optional)\" too would say it twice.\n title: props.label ? withoutOptionalMark(props.label) : found.title,\n description: props.hint || found.description,\n }\n : found,\n [found, props.label, props.hint],\n );\n const value = useStateValue<unknown>(path);\n const { set } = useStateStore();\n const onChange = React.useCallback((next: unknown) => set(path, next), [set, path]);\n if (!field) return <Unresolved path={props.path} side=\"input\" />;\n return (\n <FieldRenderer\n field={field}\n value={value}\n onChange={onChange}\n id={domIdFor(scope.idPrefix, path)}\n env={scope.env}\n />\n );\n}\n\nfunction MthdsResult({ props }: BaseComponentProps<{ path: string; hideLabel?: boolean | null }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const field = scope.result && path ? resultFieldAtPath(scope.result, path) : undefined;\n const value = useStateValue<unknown>(path);\n if (!field || !scope.result) return <Unresolved path={props.path} side=\"result\" />;\n // The subtree's place in the whole result, so a file inside it saves under\n // the name the whole-result download gives it. Left to itself, `ResultField`\n // would root the location at its own node's name, and every entry of a\n // repeat would save as `image.png`.\n const place = [scope.result.name, ...(segmentsUnder(RESULT_ROOT, path) ?? [])];\n return (\n <ResultRoot baseName={scope.result.name} path={place}>\n <ResultField field={field} value={value} hideLabel={props.hideLabel ?? false} />\n </ResultRoot>\n );\n}\n\n// ─── A Select with an accessible name ────────────────────────────────────────\n\ninterface SelectProps {\n label: string;\n name: string;\n options: string[];\n placeholder?: string | null;\n value?: string | null;\n checks?: { type: string; message: string; args?: Record<string, unknown> }[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction AccessibleSelect({ props, bindings, emit }: BaseComponentProps<SelectProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'change';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate } = useCheckedField(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const id = shadcn.useControlId(props.name);\n const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <SelectRoot\n value={value}\n onValueChange={(next) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n emit('change');\n }}\n >\n {/* As tall as the layer's text input beside it, and the 44 pixels a\n finger needs. */}\n <SelectTrigger id={id} className=\"h-11 w-full\">\n <SelectValue placeholder={props.placeholder ?? 'Select...'} />\n </SelectTrigger>\n <SelectContent>\n {/* Written exactly as listed. The primitive throws on an empty value,\n and the fallback that used to stand in for one wrote a value the\n descriptor's enum never listed; the definition refuses an empty\n option now, upstream of every renderer. */}\n {(props.options ?? []).map((option, index) => (\n <SelectItem key={`${index}-${option}`} value={option}>\n {labelOf(option)}\n </SelectItem>\n ))}\n </SelectContent>\n </SelectRoot>\n {errors.length > 0 ? <p className=\"text-sm text-destructive\">{errors[0]}</p> : null}\n </div>\n );\n}\n\n// ─── The bound equivalents of what a model most wants to inline ──────────────\n\nfunction valueAt(row: unknown, relativePath: string): unknown {\n let current: unknown = row;\n for (const segment of relativePath.split('/').filter((part) => part.length > 0)) {\n if (typeof current !== 'object' || current === null) return undefined;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\n}\n\n/** A cell shows a number as it is: grouped, with the places it has, never padded. */\nconst CELL_NUMBER = new Intl.NumberFormat('en-US', { maximumFractionDigits: 2 });\n\nfunction formatCell(value: unknown): string {\n if (value === null || value === undefined || value === '') return '—';\n if (typeof value === 'boolean') return value ? 'yes' : 'no';\n if (typeof value === 'number') return CELL_NUMBER.format(value);\n if (typeof value === 'string') return value;\n if (Array.isArray(value)) return value.map(formatCell).join(', ');\n return JSON.stringify(value);\n}\n\n/** A cell in a column the layout stated a format for. */\nfunction formatColumnCell(value: unknown, format: string | null | undefined): string {\n // The calendar day is the one written: a time beside it (\"2025-03-09\n // 00:30\") must not move it across midnight in the reader's zone, so only the\n // leading day is read, anchored at noon UTC, as `DateText` reads one.\n // The value is the day as text, or a native date's own structure\n // ({ date, time }); either way its day is read, never stringified.\n const written = format === 'date' ? readDateContent(value)?.date : undefined;\n const day = written === undefined ? null : /^\\d{4}-\\d{2}-\\d{2}/.exec(written);\n if (day) {\n const date = new Date(`${day[0]}T12:00:00Z`);\n if (!Number.isNaN(date.getTime()))\n return date.toLocaleDateString('en-GB', {\n day: 'numeric',\n month: 'short',\n year: 'numeric',\n timeZone: 'UTC',\n });\n }\n return formatCell(value);\n}\n\ninterface DataTableProps {\n rows: unknown;\n columns: { path: string; label: string; format?: 'text' | 'date' | 'number' | null }[];\n caption?: string | null;\n}\n\nfunction DataTable({ props }: BaseComponentProps<DataTableProps>) {\n const rows = Array.isArray(props.rows) ? props.rows : [];\n const columns = props.columns ?? [];\n return (\n <div className=\"overflow-x-auto rounded-md border border-border\">\n <table className=\"w-full min-w-full border-collapse text-[13px]\">\n {props.caption ? (\n <caption className=\"px-2.5 py-1.5 text-start text-[12px] text-muted-foreground\">\n {props.caption}\n </caption>\n ) : null}\n <thead>\n <tr className=\"border-b border-border bg-muted\">\n {columns.map((column) => (\n <th\n key={column.path}\n scope=\"col\"\n className=\"whitespace-nowrap px-2.5 py-1.5 text-start font-semibold text-foreground\"\n >\n {column.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, index) => (\n <tr key={index} className=\"border-b border-border/60 last:border-b-0\">\n {columns.map((column) => (\n <td key={column.path} className=\"px-2.5 py-1.5 align-top text-foreground\">\n {formatColumnCell(valueAt(row, column.path), column.format)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\ntype MetricFormat = (typeof METRIC_FORMATS)[number];\n\nfunction numberFormat(format: MetricFormat): Intl.NumberFormat {\n switch (format) {\n case 'integer':\n return new Intl.NumberFormat('en-US', { maximumFractionDigits: 0 });\n case 'decimal':\n return new Intl.NumberFormat('en-US', { minimumFractionDigits: 2, maximumFractionDigits: 2 });\n case 'compact':\n return new Intl.NumberFormat('en-US', { notation: 'compact', maximumFractionDigits: 1 });\n case 'plain':\n return new Intl.NumberFormat('en-US', { maximumFractionDigits: 20, useGrouping: false });\n default:\n return format satisfies never;\n }\n}\n\ninterface MetricProps {\n label: string;\n value: unknown;\n unit?: string | null;\n format?: MetricFormat | null;\n}\n\nfunction Metric({ props }: BaseComponentProps<MetricProps>) {\n const value = props.value;\n // Anything but a number as it writes out, so a structure, which writes out\n // as nothing, shows the dash an absent value shows.\n const text =\n typeof value === 'number'\n ? numberFormat(props.format ?? 'plain').format(value)\n : textOf(value) || '—';\n return (\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wider text-muted-foreground\">\n {props.label}\n </span>\n <span className=\"text-2xl font-semibold tabular-nums text-foreground\">\n {text}\n {props.unit ? (\n <span className=\"ml-1 text-sm font-normal text-muted-foreground\">{props.unit}</span>\n ) : null}\n </span>\n </div>\n );\n}\n\n// ─── The vocabulary of an app ────────────────────────────────────────────────\n\ntype SplitRatio = '1:1' | '1:2' | '2:1';\n\nconst SPLIT_COLUMNS: Record<SplitRatio, string> = {\n '1:1': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]',\n '1:2': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]',\n '2:1': 'sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]',\n};\n\nconst SPLIT_GAP: Record<'md' | 'lg' | 'xl', string> = { md: 'gap-4', lg: 'gap-6', xl: 'gap-8' };\n\n/** Two columns from two children, stacking under the `sm` breakpoint. */\nfunction Split({\n props,\n children,\n}: BaseComponentProps<{ ratio?: SplitRatio | null; gap?: 'md' | 'lg' | 'xl' | null }>) {\n return (\n <div\n className={cn(\n 'grid grid-cols-1 items-start',\n shadcn.pick(SPLIT_COLUMNS, props.ratio, '1:2'),\n shadcn.pick(SPLIT_GAP, props.gap, 'lg'),\n )}\n >\n {children}\n </div>\n );\n}\n\ninterface TabsProps {\n tabs: { label: string; value: string }[];\n}\n\n/**\n * Tabs whose panels follow the active tab - the reason shadcn's is not in the\n * catalog. The nth child is the nth tab's panel; the active tab is local\n * state, so a spec never touches /state for it. An inactive panel stays\n * mounted and hidden, so the checks of the fields in it still hold the run:\n * unmounted, as Radix does by default, they left the page's record, and a\n * run pressed from another tab started past a field that refused it.\n */\nfunction Tabs({ props, children }: BaseComponentProps<TabsProps>) {\n const tabs = props.tabs ?? [];\n const panels = React.Children.toArray(children);\n // Each tab is told apart by its position, which is unique where a layout's\n // values need not be: two tabs written with one value would otherwise be\n // one tab to Radix, opening both panels, and one key to React. The open\n // tab is remembered by its value, and which of the tabs sharing it, so it\n // stays open when a patched layout inserts or removes a tab before it; one\n // the layout no longer has gives way to the first.\n const [chosen, setChosen] = React.useState<{ value: string; occurrence: number } | null>(null);\n const open = chosen ? openIndex(tabs, chosen) : 0;\n const value = String(open);\n const choose = (next: string) => {\n const index = Number(next);\n const tab = tabs[index];\n if (!tab) return;\n const occurrence = tabs.slice(0, index).filter((t) => t.value === tab.value).length;\n setChosen({ value: tab.value, occurrence });\n };\n return (\n <TabsPrimitive.Root value={value} onValueChange={choose} className=\"w-full\">\n {/* Below `sm` each tab grows to the 44 by 44 pixels a finger needs,\n however short its label, and the list around it with it, wrapping\n onto a second row rather than pushing the page sideways. */}\n <TabsPrimitive.List className=\"inline-flex h-10 items-center justify-start rounded-md bg-muted p-1 text-muted-foreground max-sm:h-auto max-sm:flex-wrap\">\n {tabs.map((tab, index) => (\n <TabsPrimitive.Trigger\n key={index}\n value={String(index)}\n className=\"inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm max-sm:min-h-11 max-sm:min-w-11\"\n >\n {tab.label}\n </TabsPrimitive.Trigger>\n ))}\n </TabsPrimitive.List>\n {tabs.map((_tab, index) => (\n <TabsPrimitive.Content\n key={index}\n value={String(index)}\n forceMount\n hidden={index !== open}\n className=\"mt-4 focus-visible:outline-hidden\"\n >\n {panels[index] ?? null}\n </TabsPrimitive.Content>\n ))}\n </TabsPrimitive.Root>\n );\n}\n\n/** The position of the `occurrence`th tab carrying `value`, or the first tab's when none does. */\nfunction openIndex(\n tabs: readonly { value: string }[],\n { value, occurrence }: { value: string; occurrence: number },\n): number {\n let seen = 0;\n for (const [index, tab] of tabs.entries()) {\n if (tab.value !== value) continue;\n if (seen === occurrence) return index;\n seen += 1;\n }\n return 0;\n}\n\n// As tall as the layer's own `Button`, which is the 44 pixels a finger needs.\nconst BUTTON_BASE =\n 'inline-flex min-h-11 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50';\nconst PRIMARY_BUTTON = cn(BUTTON_BASE, 'bg-primary text-primary-foreground hover:bg-primary/90');\nconst SECONDARY_BUTTON = cn(\n BUTTON_BASE,\n 'border border-border bg-background text-foreground hover:bg-accent hover:text-accent-foreground',\n);\n\ninterface StepsProps {\n steps: string[];\n nextLabel?: string | null;\n backLabel?: string | null;\n}\n\n/**\n * A journey: a numbered indicator, one panel at a time, and its own Back and\n * Next. The nth child is the nth step's panel; the spec's one Button sits\n * inside the last one, which is why Next disappears there. The current step\n * is local state. A hidden panel stays mounted, so its inputs keep their\n * values in the store and their checks hold the run - a step hides from the\n * eye, never from the run.\n */\nfunction Steps({ props, children }: BaseComponentProps<StepsProps>) {\n const steps = props.steps ?? [];\n const panels = React.Children.toArray(children);\n const [chosen, setIndex] = React.useState(0);\n const last = steps.length - 1;\n // A layout patched or swapped mid-way may have fewer steps than the one\n // reached: the last there is shows rather than none.\n const index = Math.max(0, Math.min(chosen, last));\n return (\n <div className=\"flex flex-col gap-5\">\n <ol className=\"flex flex-wrap items-center gap-x-5 gap-y-2\">\n {steps.map((label, position) => (\n <li\n key={`${position}-${label}`}\n aria-current={position === index ? 'step' : undefined}\n className={cn(\n 'flex items-center gap-2 text-sm',\n position === index ? 'font-medium text-foreground' : 'text-muted-foreground',\n )}\n >\n <span\n className={cn(\n 'flex h-6 w-6 items-center justify-center rounded-full text-[12px] font-semibold tabular-nums',\n position < index\n ? cn(selectedFillStrongClass, linkTextClass)\n : position === index\n ? 'bg-primary text-primary-foreground'\n : 'bg-muted text-muted-foreground',\n )}\n >\n {position + 1}\n </span>\n {label}\n </li>\n ))}\n </ol>\n {steps.map((_step, position) => (\n <div key={position} hidden={position !== index}>\n {panels[position] ?? null}\n </div>\n ))}\n {index > 0 || index < last ? (\n <div className=\"flex items-center justify-between gap-3\">\n {index > 0 ? (\n <button\n type=\"button\"\n data-testid=\"steps-back\"\n onClick={() => setIndex((current) => Math.max(0, current - 1))}\n className={SECONDARY_BUTTON}\n >\n {props.backLabel ?? 'Back'}\n </button>\n ) : (\n <span />\n )}\n {index < last ? (\n <button\n type=\"button\"\n data-testid=\"steps-next\"\n onClick={() => setIndex((current) => Math.min(last, current + 1))}\n className={PRIMARY_BUTTON}\n >\n {props.nextLabel ?? 'Next'}\n </button>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\ntype IconName = (typeof ICON_NAMES)[number];\n\n/** The closed list the catalog names, each bound to its lucide component. */\nconst ICONS: Record<IconName, LucideIcon> = {\n Sparkles,\n Rocket,\n Compass,\n Map,\n MapPin,\n Route,\n Plane,\n Train,\n Car,\n Ship,\n Hotel,\n Home,\n Building2,\n Landmark,\n Globe,\n Mountain,\n Leaf,\n Sun,\n Moon,\n Calendar,\n Clock,\n Hourglass,\n Users,\n User,\n Baby,\n Accessibility,\n Heart,\n Star,\n Utensils,\n Coffee,\n Music,\n Camera,\n Image,\n Ticket,\n Gift,\n Wallet,\n Banknote,\n Coins,\n Receipt,\n Percent,\n Hash,\n TrendingUp,\n BarChart3,\n FileText,\n Upload,\n Paperclip,\n Mail,\n Phone,\n Tag,\n Layers,\n ListChecks,\n CheckCircle2,\n AlertCircle,\n Info,\n Shield,\n Flag,\n Bookmark,\n Briefcase,\n Package,\n Truck,\n Lightbulb,\n Zap,\n Pencil,\n Send,\n};\n\n/** Decorative: hidden from assistive technology, because it carries no text. */\nfunction Icon({ props }: BaseComponentProps<{ name: IconName; size?: 'sm' | 'md' | 'lg' | null }>) {\n const Glyph = ICONS[props.name];\n if (!Glyph) return null;\n const size = props.size === 'lg' ? 'h-7 w-7' : props.size === 'sm' ? 'h-4 w-4' : 'h-5 w-5';\n return <Glyph aria-hidden=\"true\" className={cn(size, 'shrink-0 text-muted-foreground')} />;\n}\n\ninterface SegmentedProps {\n label: string;\n name: string;\n options: string[];\n value?: string | null;\n}\n\n/**\n * A choice as a row of pills, over the package's own toggle group. The group\n * is named by its visible label; each pill is a button whose text is its\n * option as the kernel words it (`enumLabeler`), while the value it writes\n * stays the option. Deselecting is ignored, as shadcn's toggle group does, so\n * the bound path never holds an empty string.\n */\nfunction Segmented({ props, bindings, emit }: BaseComponentProps<SegmentedProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const labelId = shadcn.useControlId(props.name);\n const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\n return (\n <div className=\"space-y-2\">\n <span id={labelId} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </span>\n <ToggleGroup\n type=\"single\"\n aria-labelledby={labelId}\n value={value}\n onValueChange={(next: string) => {\n if (!next) return;\n setValue(next);\n emit('change');\n }}\n className=\"flex-wrap justify-start gap-1.5\"\n >\n {(props.options ?? []).map((option, index) => (\n <ToggleGroupItem\n // A layout may name one option twice, so the option alone is no key.\n key={`${index}-${option}`}\n value={option}\n variant=\"outline\"\n size=\"sm\"\n // Below `sm`, the 44 pixels a finger needs, as the kernel's own\n // choice control grows there.\n className=\"rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground max-sm:h-11 max-sm:min-w-11\"\n >\n {labelOf(option)}\n </ToggleGroupItem>\n ))}\n </ToggleGroup>\n </div>\n );\n}\n\ninterface NumberInputProps {\n label: string;\n name: string;\n value?: number | null;\n placeholder?: string | null;\n unit?: string | null;\n min?: number | null;\n max?: number | null;\n step?: number | null;\n}\n\n/**\n * A figure that writes a NUMBER to state - the gap Checkpoint 3 recorded\n * against shadcn's `Input type=\"number\"`, which writes the DOM's string. An\n * emptied field writes `undefined`, which the kernel's readiness reads as\n * absent, exactly as its own number control does.\n */\nfunction NumberInput({ props, bindings, emit }: BaseComponentProps<NumberInputProps>) {\n const [boundValue, setBoundValue] = useBoundProp<number | undefined>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState<number | undefined>(undefined);\n const isBound = Boolean(bindings?.value);\n const value = isBound ? boundValue : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const id = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id={id}\n type=\"number\"\n inputMode=\"decimal\"\n value={typeof value === 'number' ? value : ''}\n min={props.min ?? undefined}\n max={props.max ?? undefined}\n step={props.step ?? 'any'}\n placeholder={props.placeholder ?? undefined}\n onChange={(event) => {\n const raw = event.target.value;\n setValue(raw === '' ? undefined : Number(raw));\n emit('change');\n }}\n // As tall as the layer's text input and the kernel's number field,\n // which is the 44 pixels a finger needs.\n className={cn(\n fieldControlClass,\n 'h-11 px-3 tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none',\n )}\n />\n {props.unit ? <span className=\"text-sm text-muted-foreground\">{props.unit}</span> : null}\n </div>\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/**\n * Each renderer is MOUNTED rather than called: they are React components that\n * use hooks, and a render function calling hooks itself would run them inside\n * the registry's wrapper and break the moment the wrapper re-ordered them.\n */\nconst components: Components<typeof baseCatalog> = {\n Card: (ctx) => <shadcn.Card {...ctx} />,\n // A vertical Stack stretches its children unless the spec says otherwise:\n // hugging the content is the one layout a result page never wants, since a\n // table or a grid inside it would stop short of the page's width.\n Stack: (ctx) => <shadcn.Stack {...ctx} />,\n Grid: (ctx) => <shadcn.Grid {...ctx} />,\n Separator: (ctx) => <shadcn.Separator {...ctx} />,\n Collapsible: (ctx) => <shadcn.Collapsible {...ctx} />,\n Heading: (ctx) => <shadcn.Heading {...ctx} />,\n Text: (ctx) => <shadcn.Text {...ctx} />,\n Badge: (ctx) => <shadcn.Badge {...ctx} />,\n Alert: (ctx) => <shadcn.Alert {...ctx} />,\n Progress: (ctx) => <shadcn.Progress {...ctx} />,\n Avatar: (ctx) => <shadcn.Avatar {...ctx} />,\n Input: (ctx) => <shadcn.Input {...ctx} />,\n Textarea: (ctx) => <shadcn.Textarea {...ctx} />,\n // A plain label beside a trigger leaves the trigger with no accessible name,\n // which axe reports as a button without one (`a11y` runs at error). This one\n // is the package's own vendored select under a label that names the trigger.\n Select: (ctx) => <AccessibleSelect {...ctx} />,\n Radio: (ctx) => <shadcn.Radio {...ctx} />,\n Checkbox: (ctx) => <shadcn.Checkbox {...ctx} />,\n Switch: (ctx) => <shadcn.Switch {...ctx} />,\n Button: (ctx) => <shadcn.Button {...ctx} />,\n Split: (ctx) => <Split {...ctx} />,\n Tabs: (ctx) => <Tabs {...ctx} />,\n Steps: (ctx) => <Steps {...ctx} />,\n Icon: (ctx) => <Icon {...ctx} />,\n Segmented: (ctx) => <Segmented {...ctx} />,\n NumberInput: (ctx) => <NumberInput {...ctx} />,\n // Ours are React components (they use hooks), so each is MOUNTED rather than\n // called: a render function that called hooks itself would run them inside\n // the registry's wrapper and break the moment the wrapper re-ordered them.\n MthdsField: (ctx) => <MthdsField {...ctx} />,\n MthdsResult: (ctx) => <MthdsResult {...ctx} />,\n DataTable: (ctx) => <DataTable {...ctx} />,\n Metric: (ctx) => <Metric {...ctx} />,\n};\n\n/** The renderers, for the registry over the catalog that extends this vocabulary. */\n/**\n * Each renderer is handed its props held to the base catalog's definitions\n * (`declared-props.ts`), so an expression that resolved to the wrong type -\n * scratch state holding a structure where a title belongs - draws nothing\n * rather than throwing past both checks.\n */\nexport const generativeRenderers = withDeclaredProps(\n baseCatalog.data.components as Record<string, { props?: unknown }>,\n components,\n // A hatch resolves its `path` as written, relative inside a repeat, so a\n // refused one reaches it as refused rather than written out as text.\n { MthdsField: ['path'], MthdsResult: ['path'] },\n);\n","'use client';\n\nimport { type BaseComponentProps, useRepeatScope, useStateValue } from '@json-render/react';\nimport { ArrowRight, Clock } from 'lucide-react';\nimport { readImageContent, viewableUrl } from '../core/native-content';\nimport { useResolveUrl } from '../react';\nimport { focusOutlineClass, linkTextClass } from '../react/role-tokens';\nimport {\n actionShadowClass,\n headingClass,\n panelFlatShadowClass,\n panelSurfaceClass,\n} from '../react/style-tokens';\nimport { cn } from '../react/utils';\nimport { textOf, withDeclaredProps } from './declared-props';\nimport { frameComponents } from './frame-definitions';\nimport { shareAmount } from './share-amount';\nimport { useFrameHost } from './frame-host';\nimport { useDescriptorScope } from './registry';\n\n/**\n * The renderers of the two frames' vocabularies (`frame-definitions.ts`): the\n * composer of a host's compose-then-result app and its result page.\n *\n * Each reads the theme contract's tokens and the style tokens only, as the\n * product chrome does (`product-registry.tsx`): a title reads the style's\n * heading face, weight and tracking, a raised surface is the style's panel and\n * marks itself `data-style-panel`, the composer's run button wears the\n * style's call-to-action shadow. So a team's style reaches a designed page as\n * it reaches the kernel's controls, and a host that sets no style token sees\n * the look these components had before they read one.\n *\n * What the host knows and no descriptor says - how long a run takes, the\n * result's actions - comes in through `FrameHostProvider`; a picture the run\n * produced goes through the host's resolver and the kernel's URL gate, as\n * every file the result view shows does.\n */\n\nconst RADIUS = 'rounded-[calc(var(--radius,0.5rem)*1.5)]';\n\nfunction useAbsolute(path: string): string {\n const repeat = useRepeatScope();\n if (path.startsWith('/')) return path;\n if (!repeat) return path;\n return path === '' ? repeat.basePath : `${repeat.basePath}/${path}`;\n}\n\n/** A date path's value as a date at noon UTC, so no time zone moves its day; `undefined` for anything else. */\nfunction asDate(value: unknown): Date | undefined {\n if (typeof value !== 'string' || !/^\\d{4}-\\d{2}-\\d{2}/.test(value)) return undefined;\n const date = new Date(`${value.slice(0, 10)}T12:00:00Z`);\n return Number.isNaN(date.getTime()) ? undefined : date;\n}\n\n// ─── Composer ────────────────────────────────────────────────────────────────\n\ninterface ComposerProps {\n headline: string;\n lede?: string | null;\n runLabel: string;\n columns?: '1' | '2' | null;\n notes?: string[] | null;\n}\n\nfunction Composer({ props, children, emit }: BaseComponentProps<ComposerProps>) {\n const host = useFrameHost();\n // The host's `env.disabled` holds the run while one is going, as it holds\n // the plain form's submit: a second press would be a second billed run.\n const busy = useDescriptorScope().env?.disabled ?? false;\n const two = props.columns === '2';\n return (\n <div\n className={cn('mx-auto flex w-full flex-col gap-7', two ? 'max-w-[980px]' : 'max-w-[740px]')}\n >\n <div>\n <h1\n className={cn(\n 'text-[32px] leading-[1.1] text-balance text-foreground sm:text-[38px] sm:leading-[1.08]',\n headingClass(700, true),\n )}\n >\n {props.headline}\n </h1>\n {props.lede ? (\n <p className=\"mt-3.5 max-w-[62ch] text-[17px] leading-relaxed text-muted-foreground\">\n {props.lede}\n </p>\n ) : null}\n </div>\n {/* The composer's panel is the host's panel, so with no style it is the\n host's hairline with no shadow, as `quiet` asks, and a style's\n shadow floats it. */}\n <div\n data-style-panel=\"\"\n className={cn(RADIUS, panelSurfaceClass, panelFlatShadowClass, 'p-7 max-sm:p-5')}\n >\n {/* Two columns flow the groups down one column and on into the next,\n balanced, rather than a grid's rows: a row as tall as its tallest\n group left a hole beside every long list. A group may continue into\n the next column between its fields, but never inside a field (a\n list is one, so its last row never opens the next column alone)\n and never right after a title.\n The space between groups is a top margin, which a column break\n truncates. */}\n <div\n className={cn(\n 'grid gap-8',\n two &&\n 'md:block md:columns-2 md:gap-x-10 md:[&>*+*]:mt-8 md:[&>*>h2]:break-after-avoid md:[&>*>*:not(h2)]:break-inside-avoid',\n )}\n >\n {children}\n </div>\n <div className=\"sticky bottom-0 z-[2] -mx-7 -mb-7 mt-7 flex items-center justify-between gap-4 rounded-b-[calc(var(--radius,0.5rem)*1.5)] border-t border-border [background-color:var(--panel-fill,var(--card,hsl(0_0%_100%)))] px-7 pt-[18px] pb-7 max-sm:-mx-5 max-sm:-mb-5 max-sm:flex-col-reverse max-sm:items-stretch max-sm:px-5 max-sm:pb-5\">\n {host.eta ? (\n <span className=\"inline-flex items-center gap-2 text-sm text-muted-foreground max-sm:justify-center\">\n <Clock className=\"size-4\" aria-hidden=\"true\" /> {host.eta}\n </span>\n ) : (\n <span />\n )}\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => emit('press')}\n className={cn(\n 'inline-flex min-h-11 items-center justify-center gap-2 rounded-[var(--radius,0.5rem)] bg-primary px-[22px] text-[15px] font-semibold text-primary-foreground transition-all hover:bg-primary/90',\n actionShadowClass,\n focusOutlineClass,\n 'disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-primary',\n )}\n >\n {props.runLabel} <ArrowRight className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n {props.notes && props.notes.length > 0 ? (\n <ul className=\"grid gap-x-8 gap-y-2.5 px-1 sm:grid-cols-2\">\n {props.notes.map((note, index) => (\n <li key={index} className=\"flex items-start gap-2.5 text-sm text-muted-foreground\">\n <span aria-hidden=\"true\" className={linkTextClass}>\n ✓\n </span>\n <span className=\"min-w-0\">{note}</span>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\nfunction FieldGroup({ props, children }: BaseComponentProps<{ title?: string | null }>) {\n return (\n <section className=\"flex min-w-0 flex-col gap-5\">\n {props.title ? (\n <h2 className={cn('text-[17px] leading-snug text-foreground', headingClass(600))}>\n {props.title}\n </h2>\n ) : null}\n {children}\n </section>\n );\n}\n\n// ─── Result: ResultHeader ────────────────────────────────────────────────────\n\ninterface ResultHeaderProps {\n eyebrow?: string | null;\n title: string;\n subtitle?: string | null;\n}\n\nfunction ResultHeader({ props }: BaseComponentProps<ResultHeaderProps>) {\n const host = useFrameHost();\n return (\n <div className=\"flex items-start justify-between gap-6 max-sm:flex-col\">\n <div className=\"min-w-0\">\n {props.eyebrow ? (\n <p className={cn('mb-1.5 text-[13px] font-semibold', linkTextClass)}>{props.eyebrow}</p>\n ) : null}\n <h1\n className={cn(\n 'text-[28px] leading-[1.12] text-balance text-foreground sm:text-[32px]',\n headingClass(700, true),\n )}\n >\n {props.title}\n </h1>\n {props.subtitle ? (\n <p className=\"mt-2 text-[15px] text-muted-foreground\">{props.subtitle}</p>\n ) : null}\n </div>\n {host.actions && host.actions.length > 0 && host.onAction ? (\n <div className=\"flex shrink-0 gap-2\">\n {host.actions.map((label, i) => (\n <button\n key={`${i}-${label}`}\n type=\"button\"\n onClick={() => host.onAction?.(label)}\n className={cn(\n 'inline-flex min-h-11 items-center rounded-[var(--radius,0.5rem)] px-4 text-sm font-semibold sm:min-h-9',\n focusOutlineClass,\n i === 0\n ? 'bg-primary text-primary-foreground'\n : 'border border-border bg-background text-foreground',\n )}\n >\n {label}\n </button>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n\n// ─── Result: ProportionBar ───────────────────────────────────────────────────\n\ninterface ProportionBarProps {\n label: string;\n total?: number | null;\n of?: number | null;\n unit?: string | null;\n items?: unknown[] | null;\n labelKey: string;\n valueKey: string;\n}\n\n/**\n * A segment's share of the accent, mixed into the muted fill: an even ramp\n * from the full accent down to a quarter of it, in the order the parts come,\n * so two segments are never a near shade of each other the way a fixed\n * cycle's neighbours (85 after 100, 60 after 70) were.\n */\nfunction segmentMix(index: number, count: number): number {\n return count <= 1 ? 100 : Math.round(100 - (index * 75) / (count - 1));\n}\n\nfunction segmentColor(index: number, count: number): string {\n return `color-mix(in oklab, var(--link, var(--primary, hsl(240 5.9% 10%))) ${segmentMix(index, count)}%, var(--muted, hsl(240 4.8% 95.9%)))`;\n}\n\nfunction amount(value: number, unit: string | null | undefined): string {\n if (unit && /^[A-Z]{3}$/.test(unit)) {\n try {\n return new Intl.NumberFormat('en-GB', {\n style: 'currency',\n currency: unit,\n maximumFractionDigits: 0,\n }).format(value);\n } catch {\n /* not a currency code */\n }\n }\n const n = new Intl.NumberFormat('en-GB', { maximumFractionDigits: 2 }).format(value);\n return unit ? `${n} ${unit}` : n;\n}\n\nfunction ProportionBar({ props }: BaseComponentProps<ProportionBarProps>) {\n // A part is a structure with a label member and a number member; an entry\n // that is not one - a null, a word, an expression that resolved to nothing -\n // is no part of the share, and is skipped rather than read into.\n const rows = (Array.isArray(props.items) ? props.items : []).filter(\n (row): row is Record<string, unknown> =>\n typeof row === 'object' && row !== null && !Array.isArray(row),\n );\n const parts = rows\n .map((row) => ({\n label: textOf(row[props.labelKey]),\n value: shareAmount(row[props.valueKey]),\n }))\n .filter((p) => Number.isFinite(p.value) && p.value > 0);\n const sum = parts.reduce((s, p) => s + p.value, 0);\n const total = typeof props.total === 'number' ? props.total : sum;\n const scale = Math.max(sum, total, typeof props.of === 'number' ? props.of : 0) || 1;\n const cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);\n return (\n <div\n data-style-panel=\"\"\n className={cn(\n RADIUS,\n panelSurfaceClass,\n panelFlatShadowClass,\n 'flex flex-col gap-3.5 px-6 py-5',\n )}\n >\n <div className=\"flex flex-wrap items-baseline gap-x-2.5\">\n <span className=\"text-[15px] text-muted-foreground\">{props.label}</span>\n <strong className=\"text-2xl font-semibold tabular-nums text-foreground\">\n {amount(total, props.unit)}\n </strong>\n {typeof props.of === 'number' ? (\n <span className=\"text-[15px] text-muted-foreground\">\n of {amount(props.of, props.unit)}\n </span>\n ) : null}\n </div>\n <div className=\"flex h-2 gap-0.5 overflow-hidden rounded-full bg-muted\" aria-hidden=\"true\">\n {parts.map((p, i) => (\n <span\n key={`${i}-${p.label}`}\n style={{\n width: `${(p.value / scale) * 100}%`,\n background: segmentColor(i, parts.length),\n }}\n />\n ))}\n </div>\n <ul className=\"flex flex-wrap gap-x-5 gap-y-1\">\n {parts.map((p, i) => (\n <li\n key={`${i}-${p.label}`}\n className=\"inline-flex items-center gap-2 text-sm text-muted-foreground\"\n >\n <span\n className=\"size-2 rounded-[2px]\"\n style={{\n background: segmentColor(i, parts.length),\n }}\n aria-hidden=\"true\"\n />\n {cap(p.label)} {amount(p.value, props.unit)}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n// ─── Result: Swatches, Picture, Fact, Detail ─────────────────────────────────\n\n/**\n * A colour value a swatch may paint: a hex code, a colour function, or a\n * keyword. Anything else is result text a model wrote, and painting it would\n * let `url(…)` or `image-set(…)` fetch on paint, the channel the prose\n * renderer closes for images; such an entry draws no swatch.\n */\nconst COLOR_VALUE =\n /^(?:#[0-9a-f]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\\([\\w\\s.,%/+-]*\\)|[a-z]+)$/i;\n\nfunction Swatches({ props }: BaseComponentProps<{ colors: string[] }>) {\n const colors = (props.colors ?? []).filter(\n (c): c is string => typeof c === 'string' && COLOR_VALUE.test(c.trim()),\n );\n return (\n <div className=\"flex flex-wrap gap-2\">\n {colors.map((color, i) => (\n <div key={`${color}-${i}`} className=\"flex flex-col gap-1\">\n <span\n className=\"h-7 w-11 rounded-[3px] border border-border\"\n style={{ backgroundColor: color.trim() }}\n />\n <span className=\"font-mono text-[11px] text-muted-foreground\">{color}</span>\n </div>\n ))}\n </div>\n );\n}\n\nconst ASPECT: Record<string, string> = {\n '16:9': 'aspect-video',\n '4:3': 'aspect-[4/3]',\n '1:1': 'aspect-square',\n};\n\nfunction Picture({\n props,\n}: BaseComponentProps<{ path: string; alt?: string | null; aspect?: string | null }>) {\n // The checks hold `path` to a literal; a layout rendered past them may still\n // hand an expression's value here, which shows no picture. It is not read as\n // the empty path, which inside a repeat is the item itself.\n const written = typeof props.path === 'string' ? props.path : undefined;\n const path = useAbsolute(written ?? '');\n const value = useStateValue<unknown>(path);\n const resolve = useResolveUrl();\n // In the result view's order, each through the kernel's gate: the host's\n // resolver on the stored reference, then the file's own public URL, then the\n // reference itself, so a picture shows wherever the result view shows it.\n const content = written === undefined ? undefined : readImageContent(value);\n const src = content\n ? (viewableUrl(resolve?.(content.url)) ??\n viewableUrl(content.publicUrl) ??\n viewableUrl(content.url))\n : undefined;\n const aspect = props.aspect && props.aspect !== 'auto' ? ASPECT[props.aspect] : undefined;\n if (!src) return null;\n return (\n <img\n src={src}\n alt={props.alt ?? content?.caption ?? ''}\n // A result's URL is the result's to choose, so the host page's address\n // is never sent to it, as with every other picture the package draws.\n referrerPolicy=\"no-referrer\"\n className={cn(\n 'block w-full rounded-[var(--radius,0.5rem)] border border-border bg-muted object-cover',\n aspect,\n )}\n />\n );\n}\n\nfunction Fact({\n props,\n}: BaseComponentProps<{ label: string; value?: unknown; detail?: string | null }>) {\n // What the value writes out, so a structure, which writes out as nothing,\n // shows the dash an absent value shows.\n const text = textOf(props.value);\n return (\n <div className=\"flex flex-col gap-1 rounded-[var(--radius,0.5rem)] border border-border bg-background px-4 py-3\">\n <span className=\"text-[13px] text-muted-foreground\">{props.label}</span>\n <span className=\"text-[16px] font-medium text-foreground tabular-nums\">\n {text !== '' ? text : '—'}\n </span>\n {props.detail ? (\n <span className=\"text-[13px] text-muted-foreground\">{props.detail}</span>\n ) : null}\n </div>\n );\n}\n\nfunction Detail({ props }: BaseComponentProps<{ label: string; value?: unknown }>) {\n const text = textOf(props.value);\n if (text === '') return null;\n return (\n // A rule between the rows of a list of details, never under one set in a\n // row: there it read as an underline on every detail but the last.\n <div className=\"grid grid-cols-[minmax(0,8.5rem)_minmax(0,1fr)] gap-3 border-b border-border py-2.5 text-[14px] last:border-b-0 [.flex-row>&]:border-b-0 [.flex-row>&]:grid-cols-[auto_minmax(0,1fr)]\">\n <span className=\"text-muted-foreground\">{props.label}</span>\n <span className=\"text-foreground\">{text}</span>\n </div>\n );\n}\n\nconst DATE_STYLES: Record<string, Intl.DateTimeFormatOptions> = {\n long: { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric', timeZone: 'UTC' },\n short: { day: 'numeric', month: 'short', year: 'numeric', timeZone: 'UTC' },\n weekday: { weekday: 'short', day: 'numeric', month: 'long', timeZone: 'UTC' },\n};\n\ninterface DateTextProps {\n value?: string | null;\n style?: 'long' | 'short' | 'weekday' | null;\n tone?: 'default' | 'muted' | 'accent' | null;\n}\n\nfunction DateText({ props }: BaseComponentProps<DateTextProps>) {\n const date = asDate(props.value);\n if (!date) return null;\n const tone =\n props.tone === 'accent'\n ? cn('text-[13px] font-semibold', linkTextClass)\n : props.tone === 'muted'\n ? 'text-sm text-muted-foreground'\n : 'text-[15px] text-foreground';\n return (\n <span className={cn('block', tone)}>\n {date.toLocaleDateString('en-GB', DATE_STYLES[props.style ?? 'long'])}\n </span>\n );\n}\n\ninterface TextListProps {\n items?: unknown;\n marker?: 'bullet' | 'number' | 'check' | null;\n}\n\nfunction TextList({ props }: BaseComponentProps<TextListProps>) {\n const items = Array.isArray(props.items)\n ? props.items.filter((x) => typeof x === 'string' && x.trim())\n : [];\n if (items.length === 0) return null;\n const marker = props.marker ?? 'bullet';\n // Only numbered items are ordered; bullets and checks are a plain list.\n const List = marker === 'number' ? 'ol' : 'ul';\n return (\n <List className=\"flex flex-col gap-2.5\">\n {items.map((text, index) => (\n <li key={index} className=\"flex gap-3 text-[15px] leading-relaxed text-foreground\">\n <span\n aria-hidden=\"true\"\n className={cn(\n 'mt-[0.55em] shrink-0',\n marker === 'bullet' &&\n 'size-1.5 rounded-full bg-[color:var(--link,var(--primary,hsl(240_5.9%_10%)))]',\n marker === 'number' &&\n cn('mt-0 min-w-5 text-sm font-semibold tabular-nums', linkTextClass),\n marker === 'check' && cn('mt-0', linkTextClass),\n )}\n >\n {marker === 'number' ? `${index + 1}.` : marker === 'check' ? '✓' : null}\n </span>\n <span className=\"min-w-0\">{String(text)}</span>\n </li>\n ))}\n </List>\n );\n}\n\n/**\n * Each renderer is handed its props held to the frame's definitions\n * (`declared-props.ts`), as the base catalog's are.\n */\nexport const frameRenderers = withDeclaredProps(\n frameComponents,\n {\n TextList: (ctx: BaseComponentProps<TextListProps>) => <TextList {...ctx} />,\n DateText: (ctx: BaseComponentProps<DateTextProps>) => <DateText {...ctx} />,\n Composer: (ctx: BaseComponentProps<ComposerProps>) => <Composer {...ctx} />,\n FieldGroup: (ctx: BaseComponentProps<{ title?: string | null }>) => <FieldGroup {...ctx} />,\n ResultHeader: (ctx: BaseComponentProps<ResultHeaderProps>) => <ResultHeader {...ctx} />,\n ProportionBar: (ctx: BaseComponentProps<ProportionBarProps>) => <ProportionBar {...ctx} />,\n Swatches: (ctx: BaseComponentProps<{ colors: string[] }>) => <Swatches {...ctx} />,\n Picture: (\n ctx: BaseComponentProps<{ path: string; alt?: string | null; aspect?: string | null }>,\n ) => <Picture {...ctx} />,\n Fact: (ctx: BaseComponentProps<{ label: string; value?: unknown; detail?: string | null }>) => (\n <Fact {...ctx} />\n ),\n Detail: (ctx: BaseComponentProps<{ label: string; value?: unknown }>) => <Detail {...ctx} />,\n },\n // A refused `path` reaches the renderer as refused: its nearest value, the\n // empty text, is the item itself inside a repeat.\n { Picture: ['path'] },\n);\n","'use client';\n\nimport * as React from 'react';\n\n/**\n * What the page paints under the work column, when there is anything to paint.\n *\n * No spec names a result: the layout a model writes is the INPUT page, and the\n * result has shapes of its own. So the page leaves a slot instead, and the host\n * fills it with whatever the run yielded - the kernel's own viewer over the\n * output descriptor, a line while the run is in flight, a failure. The slot is\n * a React node and nothing more: this entry knows how to place it in the page's\n * grammar and nothing about how a run is started, followed or delivered.\n *\n * A host that provides nothing gets a page with no result section at all, which\n * is what an input page is before its first run.\n */\n\nexport interface ResultSlot {\n /** What to paint. Nothing is painted at all while this is absent or `null`. */\n content: React.ReactNode;\n /** The heading above it. \"Result\" unless the host names it. */\n title?: string;\n}\n\nconst ResultSlotContext = React.createContext<ResultSlot | null>(null);\n\nexport function ResultSlotProvider({\n slot,\n children,\n}: {\n slot: ResultSlot | null;\n children: React.ReactNode;\n}) {\n return <ResultSlotContext.Provider value={slot}>{children}</ResultSlotContext.Provider>;\n}\n\n/** The slot the nearest page provides, or `null` on a page with no result yet. */\nexport function useResultSlot(): ResultSlot | null {\n return React.useContext(ResultSlotContext);\n}\n","'use client';\n\nimport * as React from 'react';\nimport { type BaseComponentProps, defineRegistry, useBoundProp } from '@json-render/react';\nimport { useCheckedField } from './checked-fields';\nimport { focusOutlineClass, linkTextClass } from '../react/role-tokens';\nimport {\n actionShadowClass,\n headingClass,\n panelRaisedShadowClass,\n panelSurfaceClass,\n} from '../react/style-tokens';\nimport { fieldControlClass } from '../react/field-styles';\nimport { cn } from '../react/utils';\nimport { BrandBar, CONTAINER } from './brand-bar';\nimport { catalog } from './catalog';\nimport { textOf, withDeclaredProps } from './declared-props';\nimport { frameRenderers } from './frame-registry';\nimport { generativeRenderers, useDescriptorScope } from './registry';\nimport { useResultSlot } from './result-slot';\nimport { useControlId } from './ui/shadcn';\n\n/**\n * What the brand catalog's components RENDER as - the product page's chrome,\n * over the same tokens the kernel's controls read, and over NOTHING else: no\n * literal colour, no literal radius, no literal typeface. The rail's panel is\n * the page's style panel (`--panel-*`), falling back to `bg-card` on\n * `border-border` and a large shadow; a title reads the style's heading face,\n * weight and tracking; a hairline is `border-border`; the call to action wears\n * the style's `--action-shadow`, falling back to a glow of the button colour\n * (`--primary`) composed with `color-mix()` (see `react/style-tokens`); the corners are\n * `--radius` and its multiples, a tag is `font-mono`, the logo is the\n * manifest's pair. The running text names no face at all: it inherits the\n * page's, which a brand's compiled stylesheet sets on its scope from\n * `--font-sans` (docs/brand.md). That is what lets one set of components\n * render any brand the `./brand` entry compiles - and what makes anything the\n * tokens cannot state absent from the page by construction.\n *\n * The layer's renderers are reused as they are; two of shadcn's are replaced\n * (`Input`, `Textarea`) so that every text field on the page is drawn on the\n * kernel's own control surface (`fieldControlClass`) and reads as one family\n * with the dates, the lists and the upload the kernel renders itself.\n *\n * Nothing here reads a schema - a brand component takes copy and bound values,\n * and that is all.\n */\n\n/** The kernel's app-presentation label, so a brand field and a kernel field read alike. */\nconst LABEL = 'block text-[13.5px] leading-none font-medium text-foreground';\n\n// ─── The page's chrome ───────────────────────────────────────────────────────\n\ninterface AppBarProps {\n app: string;\n links?: string[] | null;\n tag?: string | null;\n}\n\nfunction AppBar({ props }: BaseComponentProps<AppBarProps>) {\n return <BrandBar app={props.app} links={props.links} tag={props.tag} />;\n}\n\ninterface HeroProps {\n headline: string;\n lede?: string | null;\n eyebrow?: string | null;\n}\n\nfunction Hero({ props }: BaseComponentProps<HeroProps>) {\n return (\n <section className=\"pt-12 pb-10 sm:pt-14 sm:pb-12\">\n {props.eyebrow ? (\n <p\n className={cn('mb-4 text-[11px] font-medium tracking-[0.15em] uppercase', linkTextClass)}\n >\n {props.eyebrow}\n </p>\n ) : null}\n <h1\n className={cn(\n 'max-w-2xl text-4xl text-foreground sm:text-[44px] sm:leading-[1.15]',\n headingClass(700, true),\n )}\n >\n {props.headline}\n </h1>\n {props.lede ? (\n <p className=\"mt-4 max-w-2xl text-[17px] leading-relaxed text-muted-foreground\">\n {props.lede}\n </p>\n ) : null}\n </section>\n );\n}\n\nfunction Workspace({ props, children }: BaseComponentProps<{ rail?: 'right' | 'left' | null }>) {\n const [work, rail] = React.Children.toArray(children);\n const railLeft = props.rail === 'left';\n return (\n <div\n className={cn(\n CONTAINER,\n 'grid grid-cols-1 gap-10 pb-16 lg:gap-14',\n railLeft ? 'lg:grid-cols-[360px_minmax(0,1fr)]' : 'lg:grid-cols-[minmax(0,1fr)_360px]',\n )}\n >\n <div className={cn('min-w-0', railLeft && 'lg:order-2')}>\n {work}\n <ResultPanel />\n </div>\n <aside\n className={cn(\n 'lg:sticky lg:top-6 lg:self-start lg:pt-12 sm:lg:pt-14',\n railLeft && 'lg:order-1',\n )}\n >\n {rail}\n </aside>\n </div>\n );\n}\n\n/**\n * What the host paints under the work column, in the page's own grammar and\n * in the container it gives everything else. No spec names it - no layout was\n * written for a result - so the page leaves the slot and places what it is\n * given; an input page before its first run is given nothing and shows none of\n * this.\n */\nfunction ResultPanel() {\n const slot = useResultSlot();\n if (!slot?.content) return null;\n return (\n <section className=\"border-t border-border py-9\" data-testid=\"result-panel\" aria-live=\"polite\">\n <h2 className={cn('mb-6 text-xl text-foreground', headingClass(600, true))}>\n {slot.title ?? 'Result'}\n </h2>\n {slot.content}\n </section>\n );\n}\n\ninterface SectionProps {\n number?: string | null;\n title: string;\n lede?: string | null;\n}\n\nfunction Section({ props, children }: BaseComponentProps<SectionProps>) {\n return (\n <section className=\"border-t border-border py-9 first:border-t-0 first:pt-0\">\n <div className=\"mb-6\">\n <div className=\"flex items-baseline gap-3\">\n {props.number ? (\n <span className={cn('font-mono text-[12px]', linkTextClass)}>{props.number}</span>\n ) : null}\n <h2 className={cn('text-xl text-foreground', headingClass(600, true))}>{props.title}</h2>\n </div>\n {props.lede ? <p className=\"mt-1.5 text-sm text-muted-foreground\">{props.lede}</p> : null}\n </div>\n {/* The rules put a concern's inputs flat inside the Section, so the\n Section spaces them: the gap the hand-written spec's Stack gave its. */}\n <div className=\"flex flex-col gap-4\">{children}</div>\n </section>\n );\n}\n\nfunction Rail({ props, children }: BaseComponentProps<{ title: string }>) {\n return (\n // An arbitrary value reads the token directly, so it does NOT go through\n // the `@theme inline` mapping and does not inherit its fallback - it has to\n // carry its own, or a host that defines no tokens loses the declaration\n // outright. See src/styles/tailwind-entry.css.\n <div\n data-style-panel=\"\"\n className={cn(\n 'rounded-[calc(var(--radius,0.5rem)*1.5)] p-7 text-card-foreground',\n panelSurfaceClass,\n panelRaisedShadowClass,\n )}\n >\n <h2 className=\"text-[11px] font-semibold tracking-[0.15em] text-muted-foreground uppercase\">\n {props.title}\n </h2>\n <div className=\"mt-4 flex flex-col\">{children}</div>\n </div>\n );\n}\n\ninterface SummaryRowProps {\n label: string;\n value?: unknown;\n detail?: unknown;\n separator?: string | null;\n placeholder?: string | null;\n}\n\nfunction SummaryRow({ props }: BaseComponentProps<SummaryRowProps>) {\n // Each half as it writes out, so one that is a structure, which writes out\n // as nothing, leaves no separator dangling.\n const text = [props.value, props.detail]\n .map(textOf)\n .filter((half) => half !== '')\n .join(props.separator ?? ' ');\n return (\n <div className=\"flex items-baseline justify-between gap-4 border-b border-border/60 py-3 first:pt-0 last:border-b-0\">\n <span className=\"shrink-0 text-[13px] text-muted-foreground\">{props.label}</span>\n {text ? (\n <span className=\"text-right text-[13px] font-medium text-foreground\">{text}</span>\n ) : (\n <span className=\"text-[13px] text-muted-foreground/50\">{props.placeholder ?? '—'}</span>\n )}\n </div>\n );\n}\n\nfunction Cta({ props, emit }: BaseComponentProps<{ label: string; hint?: string | null }>) {\n // The host's `env.disabled` holds the run while one is going, as it holds\n // the plain form's submit: a second press would be a second billed run.\n const busy = useDescriptorScope().env?.disabled ?? false;\n return (\n <div className=\"mt-6\">\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => emit('press')}\n className={cn(\n 'inline-flex h-12 w-full items-center justify-center rounded-lg bg-primary px-6 text-sm font-semibold text-primary-foreground transition-all hover:bg-primary/90',\n // The page's call-to-action shadow, or the glow in the button colour\n // it had. Focus is an outline, which no shadow a style sets can\n // replace or hide.\n actionShadowClass,\n focusOutlineClass,\n 'disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-primary',\n )}\n >\n {props.label}\n </button>\n {props.hint ? (\n <p className=\"mt-3 text-center text-[12px] leading-relaxed text-muted-foreground\">\n {props.hint}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction Footer({ props }: BaseComponentProps<{ text: string; tag?: string | null }>) {\n return (\n <footer className=\"border-t border-border\">\n <div\n className={cn(\n CONTAINER,\n // Wraps, and the tag may break anywhere: a pipe's code is one long\n // word, and at phone width an unbreakable one widened the document\n // past the viewport.\n 'flex flex-wrap items-center justify-between gap-x-6 gap-y-2 py-6 text-[12px] text-muted-foreground',\n )}\n >\n <span>{props.text}</span>\n {props.tag ? (\n <span className=\"min-w-0 font-mono text-[11px] tracking-wider break-all text-muted-foreground/70 uppercase\">\n {props.tag}\n </span>\n ) : null}\n </div>\n </footer>\n );\n}\n\n// ─── Text fields on the kernel's own surface ─────────────────────────────────\n\ninterface Check {\n type: string;\n message: string;\n args?: Record<string, unknown>;\n}\n\ninterface TextFieldProps {\n label: string;\n name: string;\n placeholder?: string | null;\n value?: string | null;\n checks?: Check[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction useTextField(\n props: TextFieldProps,\n bindings: BaseComponentProps<TextFieldProps>['bindings'],\n) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'blur';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate } = useCheckedField(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const onChange = (next: string) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n };\n const onBlur = () => {\n if (hasValidation && validateOn === 'blur') validate();\n };\n return { value, errors, onChange, onBlur };\n}\n\nfunction BrandInput({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n TextFieldProps & { type?: 'text' | 'email' | 'password' | 'number' | null }\n>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n aria-invalid={field.errors.length > 0 || undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={() => {\n field.onBlur();\n emit('blur');\n }}\n onFocus={() => emit('focus')}\n onKeyDown={(event) => {\n if (event.key === 'Enter') emit('submit');\n }}\n className={cn(fieldControlClass, 'h-11 px-3.5')}\n />\n {field.errors[0] ? (\n <p role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction BrandTextarea({\n props,\n bindings,\n}: BaseComponentProps<TextFieldProps & { rows?: number | null }>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 3}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n aria-invalid={field.errors.length > 0 || undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={field.onBlur}\n className={cn(fieldControlClass, 'px-3.5 py-2.5 leading-relaxed')}\n />\n {field.errors[0] ? (\n <p role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/** What `defineRegistry` takes for this catalog. */\ntype RegistryOptions = Parameters<typeof defineRegistry<typeof catalog>>[1];\n\n/**\n * The registry over the product catalog: components only. `run` is supplied\n * by `GenerativePage`, which hands it to `JSONUIProvider` as a handler closing\n * over the host's `onRun`, or by a host's own provider; json-render's type\n * asks for an `actions` entry because the catalog declares one, but only the\n * `handlers` factory this destructure discards would ever read it, so the\n * entry is stated absent rather than filled with a no-op a reader would take\n * for the handler.\n *\n * Its `AppBar` reads the brand, so the page it renders in needs one:\n * `GenerativePage`'s `brand` prop, or a `BrandProvider` above the tree.\n */\nexport const { registry: generativeRegistry } = defineRegistry(catalog, {\n components: {\n ...generativeRenderers,\n // Held to their definitions as the base and frame renderers are\n // (`declared-props.ts`).\n ...withDeclaredProps(catalog.data.components as Record<string, { props?: unknown }>, {\n Input: (ctx: Parameters<typeof BrandInput>[0]) => <BrandInput {...ctx} />,\n Textarea: (ctx: Parameters<typeof BrandTextarea>[0]) => <BrandTextarea {...ctx} />,\n AppBar: (ctx: Parameters<typeof AppBar>[0]) => <AppBar {...ctx} />,\n Hero: (ctx: Parameters<typeof Hero>[0]) => <Hero {...ctx} />,\n Workspace: (ctx: Parameters<typeof Workspace>[0]) => <Workspace {...ctx} />,\n Section: (ctx: Parameters<typeof Section>[0]) => <Section {...ctx} />,\n Rail: (ctx: Parameters<typeof Rail>[0]) => <Rail {...ctx} />,\n SummaryRow: (ctx: Parameters<typeof SummaryRow>[0]) => <SummaryRow {...ctx} />,\n Cta: (ctx: Parameters<typeof Cta>[0]) => <Cta {...ctx} />,\n Footer: (ctx: Parameters<typeof Footer>[0]) => <Footer {...ctx} />,\n }),\n ...frameRenderers,\n },\n} as RegistryOptions);\n","'use client';\n\nimport * as React from 'react';\nimport type { Spec, StateModel, StateStore } from '@json-render/core';\nimport {\n JSONUIProvider,\n Renderer,\n useOptionalValidation,\n type ValidationContextValue,\n} from '@json-render/react';\nimport { BrandProvider } from './brand-context';\nimport { CheckedFields, CheckedFieldsContext } from './checked-fields';\nimport {\n ReportingContext,\n RootBoundary,\n reportingRegistry,\n type ElementErrorHandler,\n type ReportedRenderers,\n} from './element-errors';\nimport type { BrandManifest } from '../brand/manifest';\nimport { generativeRegistry } from './product-registry';\nimport { DescriptorProvider, type DescriptorScope } from './registry';\nimport { isThenable } from '../react/utils';\n\n/** What a page renders through: this entry's registry unless a host brings its own. */\nexport type PageRegistry = React.ComponentProps<typeof Renderer>['registry'];\n\nexport interface GenerativePageProps {\n /** The layout to render; `null` while a stream has produced nothing yet. */\n spec: Spec | null;\n /** The state the layout binds to. The host owns it; the page reads and writes it. */\n store: StateStore;\n /** The descriptor the escape hatches resolve paths against. */\n scope: DescriptorScope;\n /**\n * What `run` does. Receives the state at the moment the call to action was\n * pressed. Return the run's promise and a press while it is pending starts\n * nothing. Not called while a field's own checks (its `checks` prop) fail:\n * the press shows each failing field its message instead.\n */\n onRun?: (state: StateModel) => void | Promise<unknown>;\n /** Whether a stream is still arriving. */\n loading?: boolean;\n /** A registry over a catalog that extends this entry's, when a host has one. */\n registry?: PageRegistry;\n /**\n * The brand the product chrome renders: the app bar's logo pair and name,\n * the web font. Required by this entry's own registry, whose `AppBar` reads\n * it - without one the bar throws, json-render's element boundary drops it\n * from the page, and the console names the cure. A host registry with no\n * brand components may omit it.\n */\n brand?: BrandManifest;\n /**\n * Called once for each element that throws while rendering, with the error\n * and the element's component type. json-render drops such an element from\n * the page and catches its throw in a boundary of its own, so a boundary\n * around the page never fires; this is how a host hears of it, and falls\n * back to its plain view if it wants the whole page to. The element renders\n * nothing in its place either way, and draws again once what it renders\n * from changes. Not called while `loading`: what still fails when the stream\n * ends is reported then. Without it, the error is logged as json-render logs\n * it, and the root's goes on to the host's own boundary around the page.\n */\n onElementError?: ElementErrorHandler;\n}\n\n/**\n * One generative page: providers, registry and renderer wired together.\n *\n * The store is CONTROLLED - the host creates it, seeds it (`seedInputs`) and\n * reads it back to start the run - so what the page writes is exactly what the\n * kernel's readiness is computed from, and generation is nowhere in the\n * request path: a layout is a data file, and this renders it.\n */\nexport function GenerativePage({\n spec,\n store,\n scope,\n onRun,\n loading,\n registry = generativeRegistry,\n brand,\n onElementError,\n}: GenerativePageProps) {\n // The scope reaches every control through context, so a fresh object on each\n // render re-renders every field on the page - and a host naturally writes it\n // as a literal beside the store it just read. Memoised on its members, so an\n // inline `scope={{ inputs: fields, env }}` costs a keystroke nothing. Rebuilt\n // from the members it names rather than returning `scope` itself, so no\n // member this list leaves out can be frozen at its first value: a required\n // member added to `DescriptorScope` is a type error here, and an optional one\n // is at least legible as absent from the literal.\n const { inputs, result, env, idPrefix } = scope;\n const stableScope = React.useMemo<DescriptorScope>(\n () => ({ inputs, result, env, idPrefix }),\n [inputs, result, env, idPrefix],\n );\n // json-render's `ActionProvider` reads `handlers` ONCE, into a `useState`,\n // and never looks at the prop again - so a handler object rebuilt on a new\n // `onRun` or `store` was rebuilt for nobody, and Run kept calling the\n // callback and reading the store from the first render. A host writes\n // `onRun` as an inline closure over its own state as naturally as it writes\n // the scope literal above, and every one of those closures after the first\n // went unused. So the handler is created once and reads the latest pair\n // through a ref, which is refreshed after each commit; the handler only ever\n // fires from a click, which is after the commit that installed the values.\n const latest = React.useRef({ onRun, store });\n React.useEffect(() => {\n latest.current = { onRun, store };\n });\n // Every renderer is wrapped in a reporting boundary, once per type and\n // renderer, so no element remounts on a new callback, on a host that starts\n // or stops passing one, or on a registry object rebuilt with the same\n // renderers; without a callback the boundary throws the error on, and the\n // page renders exactly as json-render does. The callback is read through a\n // ref at the error, refreshed in an insertion effect, which runs before the\n // layout phase a boundary reports in, so an element that fails in the same\n // commit as a new callback reports to that one.\n const report = React.useRef(onElementError);\n React.useInsertionEffect(() => {\n report.current = onElementError;\n });\n const [made] = React.useState<ReportedRenderers>(() => new Map());\n const pageRegistry = React.useMemo(\n () => reportingRegistry(registry, report, made),\n [registry, made],\n );\n // json-render resolves an element's props before its renderer runs, so a\n // throw there is caught by the boundary of the element above - and the root\n // has none. Its own boundary is given another try when the layout or the\n // root's resolved props change, judged by their content once the page is\n // not loading: a host that parses its spec inline hands a new object at\n // every render, and one whose report sets its state would otherwise retry,\n // throw and report until React gave up. The content is read only while the\n // root has failed, so a streamed layout is not written out whole at every\n // patch.\n const rootType = spec?.elements?.[spec.root]?.type ?? 'root';\n const reporting = onElementError !== undefined;\n // The page's checks, read at the press that runs it (below): json-render's\n // validation, which runs a field's checks and shows its message, told by\n // the page's own record of the checked fields mounted now which checks\n // each path carries.\n const validation = React.useRef<ValidationContextValue | null>(null);\n const [checkedFields] = React.useState(() => new CheckedFields());\n\n // One run at a time. The run button is held by the host's `env.disabled`,\n // which arrives on a later render: a host that sets it after an await (or\n // never) left a second press inside that wait free to start a second\n // billed run. The guard is held until what `onRun` returns settles - at\n // once for an `onRun` that returns nothing, where the host's own state\n // covers the run - and then one task longer: json-render applies the\n // binding's `onSuccess` or `onError` chain after the handler, in the same\n // task, so a guard released as `onRun` settled let a run chained under the\n // run that just failed start a second billed run. The catalog check refuses\n // such a chain; this holds a layout rendered past it to one run per press.\n const running = React.useRef(false);\n const [handlers] = React.useState(() => {\n const release = () => {\n setTimeout(() => {\n running.current = false;\n }, 0);\n };\n return {\n run: () => {\n if (running.current) return undefined;\n // A layout's fields may carry checks of their own, which `validateForm`\n // runs and records - and json-render runs the next binding whatever it\n // recorded, so `[validateForm, run]` ran a form its own checks had just\n // refused, and only the host's run gate stood between it and a billed\n // run. A run is started only when every field's checks pass, and\n // running them shows each failing field its message, as\n // `validateForm` does. The checks are those of the fields mounted now,\n // which the page's record keeps json-render told of, so a field\n // hidden or dropped since does not hold the run.\n // The record's own checks run too, as it holds them now, since the\n // provider's may lag a field mounted the task before.\n const checks = validation.current;\n if (checks) {\n const registered = checks.validateAll();\n const mounted = checkedFields.check(checks);\n if (!registered || !mounted) return undefined;\n }\n running.current = true;\n let pending: unknown;\n try {\n pending = latest.current.onRun?.(latest.current.store.getSnapshot());\n } catch (error) {\n release();\n throw error;\n }\n if (isThenable(pending)) {\n // Any thenable holds the guard, a promise from another realm\n // included, and json-render still receives what the host returned,\n // its rejection included.\n const settled = Promise.resolve(pending);\n settled.then(release, release);\n return settled;\n }\n release();\n return undefined;\n },\n };\n });\n const page = (\n <DescriptorProvider scope={stableScope}>\n <JSONUIProvider registry={pageRegistry} store={store} handlers={handlers}>\n <ReportingContext.Provider value={reporting}>\n <CheckedFieldsContext.Provider value={checkedFields}>\n <ValidationBridge into={validation} fields={checkedFields} />\n <RootBoundary\n type={rootType}\n report={report}\n reporting={reporting}\n loading={loading === true}\n spec={spec}\n >\n <Renderer spec={spec} registry={pageRegistry} loading={loading} />\n </RootBoundary>\n </CheckedFieldsContext.Provider>\n </ReportingContext.Provider>\n </JSONUIProvider>\n </DescriptorProvider>\n );\n return brand ? <BrandProvider manifest={brand}>{page}</BrandProvider> : page;\n}\n\n/**\n * Hands the page's validation - the checks its fields registered with\n * json-render, which `validateForm` runs - to the run handler, which is\n * created above the provider that holds it, and to the page's record of its\n * checked fields, which registers them. Refreshed in an insertion effect,\n * before any field's effect enters its checks and before any press can reach\n * the handler.\n */\nfunction ValidationBridge({\n into,\n fields,\n}: {\n into: React.RefObject<ValidationContextValue | null>;\n fields: CheckedFields;\n}) {\n const validation = useOptionalValidation();\n React.useInsertionEffect(() => {\n into.current = validation;\n fields.attach(validation);\n });\n return null;\n}\n\n/** The store's current state, re-rendering on every change. For a receipt beside a page. */\nexport function useStoreSnapshot(store: StateStore): StateModel {\n return React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot ?? store.getSnapshot,\n );\n}\n"]}
1
+ {"version":3,"sources":["../../src/generative/brand-context.tsx","../../src/generative/checked-fields.tsx","../../src/generative/element-errors.tsx","../../src/generative/placed-inputs.tsx","../../src/generative/brand-bar.tsx","../../src/generative/declared-props.ts","../../src/generative/frame-host.tsx","../../src/generative/format.ts","../../src/generative/ui/shadcn.tsx","../../src/generative/registry.tsx","../../src/generative/frame-registry.tsx","../../src/generative/result-slot.tsx","../../src/generative/product-registry.tsx","../../src/generative/page.tsx"],"names":["React","jsx","React3","Renderer","Component","React4","React5","React6","jsxs","Tag","Switch","React7","useRepeatScope","place","useBoundProp","Map","useStateValue","isRecord","React8","Clock","List","React9","LABEL","React10","React11","useOptionalValidation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,IAAM,YAAA,GAAqBA,qBAAoC,IAAI,CAAA;AAE5D,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,UAAA,CAAW,SAAS,OAAO,CAAA;AAC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;AAC7B,IAAA,IAAA,CAAK,OAAA,GAAU,UAAA;AACf,IAAA,MAAA,CAAO,OAAO,UAAU,CAAA;AAAA,EAC1B,CAAC,CAAA;AACD,EAAA,OAAO,IAAA;AACT;AAGO,SAAS,iBAAiB,KAAA,EAA+B;AAC9D,EAAA,OAAaA,MAAA,CAAA,oBAAA;AAAA,IACX,KAAA,CAAM,SAAA;AAAA,IACN,KAAA,CAAM,WAAA;AAAA,IACN,KAAA,CAAM,qBAAqB,KAAA,CAAM;AAAA,GACnC;AACF","file":"index.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { BrandManifest } from '../brand/manifest';\n\n/**\n * The manifest, handed down to the brand components: the app bar reads the\n * logo pair and the name off it, and nothing on the page names a brand\n * itself. The provider also loads the manifest's web font, once per family,\n * by appending the Google Fonts link a host would put in its document head -\n * so a brand story needs nothing in `.storybook/preview-head.html`, and the\n * Storybook carries no font any story did not ask for.\n */\n\nconst BrandContext = React.createContext<BrandManifest | null>(null);\n\nexport function BrandProvider({\n manifest,\n children,\n}: {\n manifest: BrandManifest;\n children: React.ReactNode;\n}) {\n useWebfont(manifest.webfont);\n return <BrandContext.Provider value={manifest}>{children}</BrandContext.Provider>;\n}\n\nexport function useBrand(): BrandManifest {\n const manifest = React.useContext(BrandContext);\n if (!manifest)\n throw new Error(\n 'useBrand: no brand in scope. Pass `brand` to GenerativePage, or wrap the tree in BrandProvider.',\n );\n return manifest;\n}\n\n/** The weights the page sets: regular, medium, semibold, bold. */\nconst WEIGHTS = '400;500;600;700';\n\nfunction useWebfont(webfont: BrandManifest['webfont']) {\n const provider = webfont?.provider;\n const family = webfont?.family;\n React.useEffect(() => {\n if (!provider || !family) return;\n const key = `${provider}:${family}`;\n if (document.head.querySelector(`link[data-brand-webfont=\"${CSS.escape(key)}\"]`)) return;\n for (const origin of ['https://fonts.googleapis.com', 'https://fonts.gstatic.com']) {\n if (document.head.querySelector(`link[rel=\"preconnect\"][href=\"${origin}\"]`)) continue;\n const preconnect = document.createElement('link');\n preconnect.rel = 'preconnect';\n preconnect.href = origin;\n if (origin.endsWith('gstatic.com')) preconnect.crossOrigin = 'anonymous';\n document.head.appendChild(preconnect);\n }\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n // Percent-encoded, then spaces back to the `+` Google Fonts expects: a\n // family carrying an `&` would otherwise inject query parameters of its own.\n const encoded = encodeURIComponent(family).replace(/%20/g, '+');\n link.href = `https://fonts.googleapis.com/css2?family=${encoded}:wght@${WEIGHTS}&display=swap`;\n link.dataset.brandWebfont = key;\n document.head.appendChild(link);\n }, [provider, family]);\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n builtInValidationFunctions,\n type ValidationCheck,\n type ValidationConfig,\n type ValidationFunction,\n} from '@json-render/core';\nimport {\n useFieldValidation,\n useOptionalValidation,\n type ValidationContextValue,\n} from '@json-render/react';\nimport { hasOwnProp } from '../core/own-property';\n\n/**\n * The check a conditional config's checks are carried in once they are\n * combined with other configs' checks at one path. json-render reads a config's\n * `enabled` once for the whole config, so it cannot say \"these checks while\n * this holds, those always\"; each check of a conditional config is therefore\n * wrapped in this one, whose arguments carry the condition, as a `$cond`\n * json-render resolves against the state when it runs the check, and the type\n * of the check it stands for. The page registers the function behind it.\n */\nconst CHECK_WHEN = 'checkedFieldWhen';\nconst WHEN_ENABLED = 'checkedFieldEnabled';\nconst WHEN_TYPE = 'checkedFieldType';\n\n/**\n * The validation functions a page hands json-render: the one behind\n * `CHECK_WHEN`, which passes while its condition is off and otherwise runs\n * the built-in check it stands for, with the arguments that check was written\n * with. A type json-render does not know passes, as json-render answers one,\n * and so does one inherited from `Object.prototype`, which a bare lookup would\n * call.\n */\nexport const CHECKED_FIELD_FUNCTIONS: Readonly<Record<string, ValidationFunction>> = {\n [CHECK_WHEN]: (value, args) => {\n if (args?.[WHEN_ENABLED] !== true) return true;\n const type = args[WHEN_TYPE];\n if (typeof type !== 'string' || !hasOwnProp(builtInValidationFunctions, type)) return true;\n return builtInValidationFunctions[type]!(value, args);\n },\n};\n\n/** One check of a conditional config, held to its condition wherever it is combined. */\nfunction heldTo(check: ValidationCheck, enabled: unknown): ValidationCheck {\n return {\n type: CHECK_WHEN,\n message: check.message,\n args: {\n ...check.args,\n [WHEN_ENABLED]: { $cond: enabled, $then: true, $else: false },\n [WHEN_TYPE]: check.type,\n },\n };\n}\n\n/**\n * One mounted checked field: its checks, and how a refused run takes the\n * person to it - the panels around it to open, and the element to focus.\n */\ninterface CheckedEntry {\n config: ValidationConfig;\n /** Opens every tab, step or section the field sits in. */\n reveal: () => void;\n /** Puts the focus on the field once what `reveal` opened is drawn. */\n focus: () => void;\n /** The element the focus goes to, when the control handed one over. */\n element: () => HTMLElement | null;\n}\n\n/**\n * The checks of a page's fields, as json-render's validation is told of them.\n *\n * json-render keeps one set of checks per path, registered by each field's\n * own effect and never unregistered, and `validateForm` and `validateAll` run\n * every set it holds. So a field hidden by its `visible` condition, or one a\n * streamed or swapped layout dropped, kept its last checks and refused the\n * run while nobody could see or correct it; and two controls bound to the\n * same path with different checks each registered its own over the other's\n * at every render, an update loop React stopped with \"Maximum update depth\n * exceeded\", while whichever result was written last hid the other's\n * failure. The page keeps its own record instead: every checked field that\n * is mounted now, by path, and json-render is told, for each path, the checks\n * of all the fields mounted at it, and no checks once the last one leaves. A\n * field validates against the same combined checks, so what it shows and\n * what `validateForm` and the run decide agree.\n */\nexport class CheckedFields {\n // One entry per mounted field, so two fields handed one config object are\n // two entries, and one leaving does not take the other's checks with it.\n private readonly byPath = new Map<string, Set<CheckedEntry>>();\n // Every path the record speaks for: those it carries now, and those it has\n // just emptied, whose old checks json-render may still read until it has\n // drawn once with the emptied ones. The verdict on these is the record's.\n private readonly told = new Set<string>();\n // The emptied paths, each with the validation json-render handed over when\n // the record emptied it. A later one has drawn with the emptied checks, so\n // the path goes back to json-render: a host's control that registers its\n // checks there directly is then judged by them.\n private readonly emptied = new Map<string, ValidationContextValue>();\n private validation: ValidationContextValue | null = null;\n\n /** Hands the record json-render's validation, and tells it what is already mounted. */\n attach(validation: ValidationContextValue | null): void {\n if (validation === this.validation) return;\n const first = this.validation === null;\n this.validation = validation;\n for (const [path, at] of this.emptied) {\n if (at === validation) continue;\n this.emptied.delete(path);\n this.told.delete(path);\n }\n if (first) for (const path of this.byPath.keys()) this.publish(path);\n }\n\n /** Enters one mounted field; what it returns leaves it again. */\n enter(\n path: string,\n config: ValidationConfig,\n field: Partial<Omit<CheckedEntry, 'config'>> = {},\n ): () => void {\n const entries = this.byPath.get(path) ?? new Set<CheckedEntry>();\n this.byPath.set(path, entries);\n const entry: CheckedEntry = {\n config,\n reveal: field.reveal ?? (() => {}),\n focus: field.focus ?? (() => {}),\n element: field.element ?? (() => null),\n };\n entries.add(entry);\n this.publish(path);\n return () => {\n entries.delete(entry);\n if (entries.size === 0) this.byPath.delete(path);\n this.publish(path);\n };\n }\n\n /**\n * The checks of every field mounted at `path`, combined, or none when no\n * field is. A field's `enabled` condition holds its own checks and no\n * other field's: json-render reads `enabled` once for a whole config, and\n * compares two configs without it, so each check of a conditional config\n * carries its condition itself (`CHECK_WHEN`).\n */\n configFor(path: string): ValidationConfig | undefined {\n const entries = this.byPath.get(path);\n if (!entries || entries.size === 0) return undefined;\n const [first] = entries;\n return {\n checks: [...entries].flatMap(({ config }) => {\n const checks = config.checks ?? [];\n return config.enabled === undefined\n ? checks\n : checks.map((check) => heldTo(check, config.enabled));\n }),\n ...(first?.config.validateOn ? { validateOn: first.config.validateOn } : {}),\n };\n }\n\n /**\n * Runs the checks of the page and answers whether they all pass; every\n * check runs, so each failing field shows its message. When one fails, the\n * person is taken to the first failing field in the page's order: the\n * panels around it opened and the focus put on it, since a tab, a step or a\n * section that is not open keeps its fields mounted and hidden.\n *\n * Each path is judged once, by one side. A path the record has carried is\n * judged by the record's checks as it holds them now: json-render's own\n * `validateAll` reads what it was told as of its provider's last render,\n * which a press can beat by one task, so a field hidden or mounted the\n * task before would be judged by checks it no longer carries, or not yet\n * by those it does. A path the record does not carry, and has not just\n * emptied, is a host's control that registered its checks with json-render\n * directly (`useFieldValidation`), and json-render's verdict on it stands,\n * a path the record once carried included.\n */\n check(validation: ValidationContextValue): boolean {\n const before = validation.fieldStates;\n validation.validateAll();\n const after = validation.fieldStates;\n let pass = true;\n for (const [path, state] of Object.entries(after)) {\n if (state === before[path] || this.told.has(path)) continue;\n if (state.result?.valid === false) pass = false;\n }\n const failing: CheckedEntry[] = [];\n for (const path of this.told) {\n const combined = this.configFor(path);\n if (combined) {\n if (!validation.validate(path, combined).valid) {\n pass = false;\n failing.push(...(this.byPath.get(path) ?? []));\n }\n } else if (after[path] !== before[path]) {\n // json-render judged a field that has left by checks it no longer\n // carries; a field mounted there later must not show that verdict.\n validation.clear(path);\n }\n }\n const first = firstInPage(failing);\n if (first) {\n first.reveal();\n first.focus();\n }\n return pass;\n }\n\n private publish(path: string): void {\n if (!this.validation) return;\n const config = this.configFor(path);\n this.told.add(path);\n if (config) this.emptied.delete(path);\n else this.emptied.set(path, this.validation);\n this.validation.registerField(path, config ?? { checks: [] });\n }\n}\n\n/** `Node.DOCUMENT_POSITION_FOLLOWING`, without reading a DOM global where none may exist. */\nconst FOLLOWING = 4;\n\n/**\n * The entry whose element comes first in the document, which is the page's\n * reading order: a hidden panel stays in the document, so the fields of a\n * closed tab sit where its panel does. An entry whose control handed over no\n * element comes after every one that did, in the order the fields mounted.\n */\nfunction firstInPage(entries: readonly CheckedEntry[]): CheckedEntry | undefined {\n let first: CheckedEntry | undefined;\n let firstElement: HTMLElement | null = null;\n for (const entry of entries) {\n const element = entry.element();\n if (!first) {\n first = entry;\n firstElement = element;\n continue;\n }\n if (!element) continue;\n if (!firstElement || element.compareDocumentPosition(firstElement) & FOLLOWING) {\n first = entry;\n firstElement = element;\n }\n }\n return first;\n}\n\n/** The page's record of its mounted checked fields; absent outside a page. */\nexport const CheckedFieldsContext = React.createContext<CheckedFields | null>(null);\n\n/**\n * What opens every panel around a point of the page: the tab, the step or the\n * section a field sits in, and the ones around those. Absent where nothing\n * hides the field.\n */\nconst RevealContext = React.createContext<(() => void) | null>(null);\n\n/**\n * A panel that can be hidden - a tab's, a step's, a closed section's - as a\n * refused run sees it: `open` shows this panel, and the reveal it hands its\n * contents opens the panels around it first. The reveal handed down keeps its\n * identity across renders, so no field re-renders when its panel does.\n */\nexport function RevealPanel({ open, children }: { open: () => void; children: React.ReactNode }) {\n const outer = React.useContext(RevealContext);\n const latest = React.useRef({ open, outer });\n React.useInsertionEffect(() => {\n latest.current = { open, outer };\n });\n const reveal = React.useCallback(() => {\n latest.current.outer?.();\n latest.current.open();\n }, []);\n return <RevealContext.Provider value={reveal}>{children}</RevealContext.Provider>;\n}\n\n/** What `useCheckedField` gives a control: json-render's field validation, and where the focus goes. */\nexport type CheckedField = ReturnType<typeof useFieldValidation> & {\n /**\n * A ref for the element a refused run puts the focus on: the input, the\n * select's trigger, a radio group's checked option or its first while none\n * is. A control that attaches it is focused when it is the first failing\n * field of a refused run; one that does not is still revealed, after every\n * field that does.\n */\n focusRef: (element: HTMLElement | null) => void;\n};\n\n/**\n * json-render's `useFieldValidation`, for a control that carries checks. On a\n * page, the field's checks enter the page's record while it is mounted, and\n * the field validates against every check its path carries, so a control\n * hidden or dropped no longer holds the run and two controls on one path\n * agree; and when a run is refused, the first failing field is revealed and\n * focused. A host's own control that carries checks calls this rather than\n * `useFieldValidation` to be held to the same rules, and attaches `focusRef`\n * to the element that should take the focus; outside a page it is\n * `useFieldValidation`.\n */\nexport function useCheckedField(path: string, config: ValidationConfig | undefined): CheckedField {\n const fields = React.useContext(CheckedFieldsContext);\n // On a page the record registers the path's combined checks; a field\n // registering its own as well would undo them.\n const field = useFieldValidation(path, fields ? undefined : config);\n const validation = useOptionalValidation();\n const reveal = React.useContext(RevealContext);\n const element = React.useRef<HTMLElement | null>(null);\n const focusRef = React.useCallback((node: HTMLElement | null) => {\n element.current = node;\n }, []);\n // A refused run asks for the focus in the same update that opens the\n // panels around the field, so it is given once that update is drawn.\n const [focusAsked, askFocus] = React.useState(0);\n React.useEffect(() => {\n if (focusAsked === 0) return;\n const target = element.current;\n if (!target) return;\n target.focus({ preventScroll: true });\n // The middle of the viewport rather than its edge, where a host's sticky\n // action row may sit over it. jsdom has no `scrollIntoView`.\n target.scrollIntoView?.({ block: 'center' });\n }, [focusAsked]);\n // Keyed on what the checks say, not on the object a renderer builds anew at\n // every render, so a keystroke does not leave and enter the record.\n const signature = config ? JSON.stringify(config) : '';\n const latest = React.useRef({ config, reveal });\n React.useInsertionEffect(() => {\n latest.current = { config, reveal };\n });\n React.useEffect(() => {\n const entered = latest.current.config;\n if (!fields || !path || !entered) return undefined;\n return fields.enter(path, entered, {\n reveal: () => latest.current.reveal?.(),\n focus: () => askFocus((asked) => asked + 1),\n element: () => element.current,\n });\n }, [fields, path, signature]);\n const fallback = field.validate;\n const validate = React.useCallback(() => {\n const combined = fields?.configFor(path);\n return validation && combined ? validation.validate(path, combined) : fallback();\n }, [fields, path, validation, fallback]);\n return { ...field, validate, focusRef };\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n evaluateVisibility,\n getByPath,\n resolveElementProps,\n resolveRepeatItemStatePath,\n resolveRepeatStatePath,\n} from '@json-render/core';\nimport { useRepeatScope, useVisibility } from '@json-render/react';\nimport { ownProp } from '../core/own-property';\n\n/**\n * How a page tells its host that one of its elements failed to render.\n *\n * json-render wraps every element in a boundary of its own that catches what\n * the element throws, logs it and renders nothing, so a boundary a host puts\n * around the page never fires: the page arrives with an element missing, its\n * call to action perhaps still there, and the host has nothing to act on.\n * Every renderer of the page's registry is wrapped in a boundary of this\n * module's, inside json-render's, and the page's root gets one too, since\n * json-render resolves an element's props before its renderer runs and puts no\n * boundary above the root. When the host passes a handler, the boundary\n * catches the throw first, renders nothing in its place as json-render's\n * would, and hands the error to the host after the commit, once per element\n * that failed. When it passes none, an element's boundary logs the error as\n * json-render's would and renders nothing, and the root's throws it on, to\n * the host's own boundary. The wrapping does not depend on whether there is a\n * handler, so a host that starts or stops passing one remounts nothing.\n *\n * Unlike json-render's, a failed boundary tries again when what it caught a\n * throw from changes - for an element, its resolved props, the list it\n * repeats over when it repeats, and each child's props and visibility as they\n * resolve, since a child's props are resolved in the child's render and a\n * throw there is the element above's to catch; for the root, the layout and\n * the root's own resolved props - so an element that threw on a word where\n * its list belongs draws once the store holds the list, without remounting\n * the page. What changed is judged by content, read when the boundary fails\n * and again only while it has failed, so a host that hands an equal value as\n * a new object at every render - a spec parsed inline, props resolved afresh\n * - does not retry, throw and report again at every render, and one that\n * corrects its layout in place is judged against what failed. And while the\n * page is `loading`, a failure is neither reported nor logged: a layout still\n * streaming may be caught half-written, so the boundary tries again with each\n * new value and once more when the stream ends, and reports only what still\n * fails then.\n */\n\n/** What a host is told of an element that failed to render. */\nexport interface ElementErrorInfo {\n /** The component type the element named, or the element whose children threw. */\n type: string;\n /** React's component stack at the throw, when React gave one. */\n componentStack?: string;\n}\n\n/** The host's hook for an element's render error. */\nexport type ElementErrorHandler = (error: unknown, info: ElementErrorInfo) => void;\n\n/**\n * Whether the host passes a handler, read by every element's boundary as it\n * renders. A boolean, so a host passing a new callback at every render\n * re-renders no element; only starting or stopping does.\n */\nexport const ReportingContext = React.createContext(false);\n\ninterface BoundaryProps {\n type: string;\n report: React.RefObject<ElementErrorHandler | undefined>;\n /** Whether the host passes a handler, as of this render. */\n reporting: boolean;\n /** Whether the layout is still streaming: a failure is held, and tried again when it ends. */\n loading?: boolean;\n /**\n * A value that changes whenever what the element renders from may have:\n * the cue to read `inputOf` again, while the boundary has failed. A list\n * is compared entry by entry, so the cue can be written inline.\n */\n resetOn?: unknown;\n /**\n * What the element renders from, read only while the boundary has failed:\n * once when it fails, and again at each new `resetOn`. A failed boundary\n * tries again when it reads differently - at each new `resetOn` while the\n * page is loading.\n */\n inputOf?: () => unknown;\n /** The root's boundary: with no handler, it throws the error on to the host's boundary rather than logging it. */\n root?: boolean;\n children: React.ReactNode;\n}\n\ninterface BoundaryState {\n failed: boolean;\n error: unknown;\n}\n\n/** An error as text, for a failure the input itself raises; never throws. */\nfunction said(error: unknown): string {\n try {\n return String(error);\n } catch {\n return 'an error that cannot be written out';\n }\n}\n\n/**\n * A value as the text of its content, for telling a new value from the same\n * one handed again as a new object. What a boundary renders from is mostly\n * JSON a model wrote and the store holds, but a host's store may hold what\n * JSON cannot write - a big integer, a structure that contains itself - so\n * those are written out too, and anything still unwritable is one text: an\n * input read afresh is a new object every time, and compared as itself it\n * would read as changed at every render, retrying and reporting each time.\n *\n * Only a structure inside itself is a cycle. A structure held at two places -\n * a list a repeat lays out that a child's props read again, two members\n * sharing one value - is written out at each, so the same content shared\n * differently reads the same, and what one place shows is never left to the\n * other to show. json-render calls the replacer with the structure holding\n * each entry, so the structures open above an entry are the ones down the\n * chain of holders, and a structure is closed once the walk leaves it.\n *\n * Exported for its test; not part of the entry.\n */\nexport function contentOf(value: unknown): string {\n const open: object[] = [];\n let entries = 0;\n try {\n return (\n JSON.stringify(value, function (this: unknown, _key, entry: unknown) {\n // A structure shared at several places is written out at each, so\n // sharing nested level under level doubles the text at every level:\n // past a bound no real input reaches, it is an input that cannot be\n // written out, rather than a page frozen writing it.\n if (++entries > MAX_CONTENT_ENTRIES) throw new RangeError('too large to compare');\n // Close every structure the walk has left: the one holding this\n // entry is the innermost still open.\n while (open.length > 0 && open[open.length - 1] !== this) open.pop();\n if (typeof entry === 'bigint') return `${entry}n`;\n if (typeof entry === 'object' && entry !== null) {\n if (open.includes(entry)) return '[cycle]';\n open.push(entry);\n }\n return entry;\n }) ?? 'undefined'\n );\n } catch {\n return 'an input that cannot be written out';\n }\n}\n\n/** How many values `contentOf` writes out before it gives up on an input. */\n// A failed repeat writes each repeated child out once per item, a few dozen\n// values an item, so this covers a list of tens of thousands of rows: an input\n// past it reads the same before and after a correction, and the element stays\n// blank until it is remounted. It is still far below what sharing nested level\n// under level reaches, and only a boundary that has failed pays for the walk.\nconst MAX_CONTENT_ENTRIES = 5_000_000;\n\n/** Whether two cues are the same: a list entry by entry, anything else by identity. */\nfunction sameCue(a: unknown, b: unknown): boolean {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.length === b.length && a.every((entry, index) => Object.is(entry, b[index]));\n }\n return Object.is(a, b);\n}\n\n/** One element's boundary: reports a render error to the host, or logs it, and tries again when its element's input changes. */\nexport class ElementBoundary extends React.Component<BoundaryProps, BoundaryState> {\n /**\n * The content of what the element rendered from when it failed, read at\n * the catch: a spec patched in place afterwards must not move it.\n */\n private failedOn: unknown;\n\n constructor(props: BoundaryProps) {\n super(props);\n this.state = { failed: false, error: undefined };\n }\n\n static getDerivedStateFromError(error: unknown): Partial<BoundaryState> {\n return { failed: true, error };\n }\n\n /** What the element renders from, as text; total, since it reads a model's layout and the store. */\n private input(): unknown {\n try {\n return contentOf(this.props.inputOf ? this.props.inputOf() : this.props.resetOn);\n } catch (error) {\n return `the input could not be read: ${said(error)}`;\n }\n }\n\n override componentDidCatch(error: unknown, info: React.ErrorInfo): void {\n // Held while the layout streams; tried again with each new value and\n // when it ends, so its content is not read at every patch.\n if (this.props.loading) {\n this.failedOn = undefined;\n return;\n }\n this.failedOn = this.input();\n const componentStack = info.componentStack ?? undefined;\n if (this.props.reporting) {\n this.props.report.current?.(error, {\n type: this.props.type,\n ...(componentStack ? { componentStack } : {}),\n });\n return;\n }\n // The root throws the error on as it renders its failure, and the host's\n // boundary records it; an element records it here, as json-render's own\n // boundary would have.\n if (!this.props.root) {\n // eslint-disable-next-line no-console -- the record json-render's boundary writes, in its words.\n console.error(\n `[json-render] Rendering error in <${this.props.type}>:`,\n error,\n componentStack,\n );\n }\n }\n\n override componentDidUpdate(previous: BoundaryProps, previousState: BoundaryState): void {\n // React runs this before `componentDidCatch` in the commit that caught\n // the throw, with the input that threw: only a boundary that had already\n // failed before this update can be looking at a corrected input.\n if (!this.state.failed || !previousState.failed) return;\n const streamEnded = previous.loading === true && !this.props.loading;\n if (streamEnded || this.inputChanged(previous)) {\n this.failedOn = undefined;\n this.setState({ failed: false, error: undefined });\n }\n }\n\n /** Whether what the element renders from is no longer what it failed on. */\n private inputChanged(previous: BoundaryProps): boolean {\n if (sameCue(this.props.resetOn, previous.resetOn)) return false;\n // While a layout streams, each new value is a new layout; after, an equal\n // one handed as a new object is the same input, and is not tried again.\n if (this.props.loading || this.failedOn === undefined) return true;\n return !Object.is(this.input(), this.failedOn);\n }\n\n // Whether the root throws the error on is decided as it renders its\n // failure, from whether the host passes a handler in this very render:\n // decided later, it cost a blank commit and a second record of the same\n // error, and decided from the ref, it read the previous render's callback.\n // No host to tell: the root's error goes on, in the same render, to the\n // host's boundary around the page, which records it once.\n override render(): React.ReactNode {\n if (!this.state.failed) return this.props.children;\n if (this.props.root && !this.props.reporting && !this.props.loading) throw this.state.error;\n return null;\n }\n}\n\n/** An element as json-render hands it to a renderer, or as it carries a child: what is read of it here. */\ninterface ElementLike {\n props?: Record<string, unknown>;\n visible?: unknown;\n repeat?: { statePath?: unknown };\n children?: unknown;\n slots?: unknown;\n}\n\ntype ResolveContext = Parameters<typeof resolveElementProps>[1];\n\n/**\n * An element's props and visibility as json-render resolves them under\n * `ctx`, or the throw resolving them raises, written out: what tells a\n * corrected input from the one that threw, for an element whose resolution\n * is what failed.\n */\nfunction resolvedOf(element: ElementLike | undefined, ctx: ResolveContext): unknown {\n if (!element) return undefined;\n try {\n return {\n props: resolveElementProps(element.props ?? {}, ctx),\n visible:\n element.visible === undefined ? true : evaluateVisibility(element.visible as never, ctx),\n };\n } catch (error) {\n return `throws: ${said(error)}`;\n }\n}\n\n/**\n * The raw element a child node carries, when json-render rendered it for one\n * of the spec's elements - which it names by its key. The node a repeating\n * element gets in its children's place names none, and carries the\n * element's own props, already resolved.\n */\nfunction childElementOf(node: React.ReactNode): ElementLike | undefined {\n if (!React.isValidElement(node)) return undefined;\n const { element, elementKey } = node.props as { element?: unknown; elementKey?: unknown };\n if (typeof elementKey !== 'string') return undefined;\n return typeof element === 'object' && element !== null ? (element as ElementLike) : undefined;\n}\n\n/**\n * The children json-render repeats under an element, when `node` is the one\n * node it hands a repeating element in their place: that node names no\n * element of its own, and carries the layout and the repeating element, whose\n * `children` are the keys of the elements laid out once per item.\n */\nfunction repeatOf(\n node: React.ReactNode,\n):\n { keys: readonly unknown[]; elements: Record<string, unknown>; itemFilter: unknown } | undefined {\n if (!React.isValidElement(node)) return undefined;\n const { element, spec, elementKey, itemFilter } = node.props as {\n element?: ElementLike;\n spec?: { elements?: unknown };\n elementKey?: unknown;\n itemFilter?: unknown;\n };\n if (elementKey !== undefined || element?.repeat === undefined) return undefined;\n const elements = spec?.elements;\n if (typeof elements !== 'object' || elements === null || !Array.isArray(element.children)) {\n return undefined;\n }\n return { keys: element.children, elements: elements as Record<string, unknown>, itemFilter };\n}\n\n/**\n * What one element renders from, for its boundary to tell a corrected input\n * from the one it failed on: its own props as resolved; for one that\n * repeats, the list it repeats over, which json-render reads inside the\n * element's render; and each child json-render renders under it, as written\n * and as resolved, since a child's props are resolved inside the child's\n * render and a throw there is caught by this boundary, the element above -\n * for one that repeats, each child for each item it lays out, resolved\n * against that item, so a repeated child that threw on what the store holds\n * outside the list draws again once that changes. Read only while the\n * boundary has failed, so a render that does not fail pays for none of it.\n */\nfunction inputOfElement(\n props: Record<string, unknown>,\n visibility: ResolveContext,\n scope: ReturnType<typeof useRepeatScope>,\n): unknown {\n const element = props.element as ElementLike | undefined;\n const state = visibility.stateModel;\n const ctx: ResolveContext = {\n ...visibility,\n ...(scope\n ? { repeatItem: scope.item, repeatIndex: scope.index, repeatBasePath: scope.basePath }\n : {}),\n };\n const statePath = element?.repeat?.statePath;\n let list: unknown;\n let listPath: string | undefined;\n if (statePath !== undefined) {\n try {\n listPath = resolveRepeatStatePath(statePath as never, scope?.basePath);\n list = listPath === undefined ? undefined : getByPath(state, listPath);\n } catch (error) {\n list = `throws: ${said(error)}`;\n }\n }\n // Each child under each item json-render lays out, as it resolves there:\n // the items its filter keeps, each child under the item's own scope.\n const repeated = (repeat: NonNullable<ReturnType<typeof repeatOf>>): unknown => {\n if (listPath === undefined || !Array.isArray(list)) return null;\n const path = listPath;\n return list.map((item: unknown, index: number) => {\n const itemCtx: ResolveContext = {\n ...visibility,\n repeatItem: item,\n repeatIndex: index,\n repeatBasePath: resolveRepeatItemStatePath(path, index),\n };\n if (repeat.itemFilter !== undefined) {\n try {\n if (!evaluateVisibility(repeat.itemFilter as never, itemCtx)) return null;\n } catch (error) {\n return `throws: ${said(error)}`;\n }\n }\n return repeat.keys.map((key) => {\n const child =\n typeof key === 'string'\n ? (ownProp(repeat.elements, key) as ElementLike | undefined)\n : undefined;\n return child ? { element: child, resolved: resolvedOf(child, itemCtx) } : null;\n });\n });\n };\n const under = (nodes: unknown) =>\n React.Children.toArray(nodes as React.ReactNode).map((node) => {\n const repeat = repeatOf(node);\n if (repeat) return { repeated: repeated(repeat) };\n const child = childElementOf(node);\n return child ? { element: child, resolved: resolvedOf(child, ctx) } : null;\n });\n const slots =\n typeof props.slots === 'object' && props.slots !== null\n ? Object.fromEntries(Object.entries(props.slots).map(([name, nodes]) => [name, under(nodes)]))\n : undefined;\n return { props: element?.props, list, children: under(props.children), slots };\n}\n\n/**\n * What the page's root renders from: the layout, and the root element's\n * props and visibility as resolved against the store, since json-render\n * resolves them before any boundary of an element's, and a throw there is\n * the root boundary's to catch.\n */\nfunction inputOfRoot(spec: SpecLike | null | undefined, visibility: ResolveContext): unknown {\n const root = spec?.elements?.[spec.root as string] as ElementLike | undefined;\n return { spec, root: resolvedOf(root, visibility) };\n}\n\n/** A layout, as far as the root's boundary reads one. */\ninterface SpecLike {\n root?: unknown;\n elements?: Record<string, unknown>;\n}\n\n/**\n * The boundary around a page's root. It is placed inside json-render's\n * provider, to read the store: a root whose props threw on what the store\n * held tries again when the store changes, as an element does.\n */\nexport function RootBoundary(props: {\n type: string;\n report: React.RefObject<ElementErrorHandler | undefined>;\n reporting: boolean;\n loading: boolean;\n spec: SpecLike | null | undefined;\n children: React.ReactNode;\n}): React.ReactElement {\n const { ctx } = useVisibility();\n return (\n <ElementBoundary\n type={props.type}\n report={props.report}\n reporting={props.reporting}\n loading={props.loading}\n resetOn={[props.spec, ctx]}\n inputOf={() => inputOfRoot(props.spec, ctx)}\n root\n >\n {props.children}\n </ElementBoundary>\n );\n}\n\n/** The wrappers a page has made, by component type, with the renderer each wraps. */\nexport type ReportedRenderers = Map<string, { renderer: unknown; wrapper: unknown }>;\n\n/**\n * The registry with every renderer wrapped in a reporting boundary. A wrapper\n * is made once per type and renderer, and kept in `made` across registries,\n * so a host that hands a registry object rebuilt on each render - its own\n * spread over this entry's, written inline - keeps every component's identity\n * and remounts nothing, as json-render alone would. The handler is read\n * through `report` at the moment of the error, so the host's latest callback\n * is the one called.\n */\nexport function reportingRegistry<R extends Record<string, unknown>>(\n registry: R,\n report: React.RefObject<ElementErrorHandler | undefined>,\n made: ReportedRenderers,\n): R {\n const wrapped: Record<string, unknown> = {};\n for (const [type, Renderer] of Object.entries(registry)) {\n const kept = made.get(type);\n if (kept && kept.renderer === Renderer) {\n wrapped[type] = kept.wrapper;\n continue;\n }\n const Component = Renderer as React.ComponentType<Record<string, unknown>>;\n const Reported = (props: Record<string, unknown>) => {\n const reporting = React.useContext(ReportingContext);\n const { ctx } = useVisibility();\n const scope = useRepeatScope();\n return (\n <ElementBoundary\n type={type}\n report={report}\n reporting={reporting}\n loading={props.loading === true}\n // A new element or a new store is the cue; what changed is read\n // only once the boundary has failed.\n resetOn={[props.element, props.children, props.slots, ctx, scope]}\n inputOf={() => inputOfElement(props, ctx, scope)}\n >\n <Component {...props} />\n </ElementBoundary>\n );\n };\n Reported.displayName = `Reported(${type})`;\n made.set(type, { renderer: Renderer, wrapper: Reported });\n wrapped[type] = Reported;\n }\n return wrapped as R;\n}\n","'use client';\n\nimport * as React from 'react';\nimport type { Spec } from '@json-render/core';\nimport { ownProp } from '../core/own-property';\nimport { INPUTS_ROOT, joinPath, segmentsUnder } from './paths';\n\n/** Where a layout places one input: its rank in the page's reading order, and the page's word for it. */\nexport interface PlacedInput {\n /** 0 for the first input the page places, reading from its root down. */\n order: number;\n /** The `label` of the element that places it, when the layout wrote one. */\n label?: string;\n}\n\n/**\n * The inputs a layout places, by path, in the order the page reads: each path\n * an element binds (`{ \"$bindState\": \"/inputs/...\" }`), an `MthdsField`\n * delegates or a repeat lays out as its list, with the `label` that element\n * gives it. A layout orders and\n * words its controls itself - \"Trip name\", near the end, where the descriptor\n * says \"Title\", first - so a line that names inputs for the person names them\n * as the page does, in the order the page shows them, and falls back on the\n * descriptor only for what the page does not say.\n *\n * The page is read from its root, depth first, children before slots, so an\n * element no other element names places nothing, and each element is read\n * once, so a layout that names an element inside itself ends. The first\n * element to place a path decides its order, and the first to word it its\n * label. A path inside a repeat is a row's, named through its list, so a\n * relative binding is not read.\n */\nexport function placedInputs(spec: Spec | null | undefined): ReadonlyMap<string, PlacedInput> {\n const placed = new Map<string, PlacedInput>();\n const elements: unknown = spec?.elements;\n if (!isRecord(elements) || typeof spec?.root !== 'string') return placed;\n const seen = new Set<string>();\n const pending: string[] = [spec.root];\n while (pending.length > 0) {\n const key = pending.pop()!;\n if (seen.has(key)) continue;\n seen.add(key);\n const element = ownProp(elements, key);\n if (!isRecord(element)) continue;\n const props = isRecord(element.props) ? element.props : {};\n place(placed, [...repeatedList(element.repeat), ...inputPathsOf(element.type, props)], props);\n // A stack: the first child is read next, and its descendants before its sibling.\n pending.push(...[...keysOf(element.children), ...slotKeys(element.slots)].reverse());\n }\n return placed;\n}\n\nfunction place(\n placed: Map<string, PlacedInput>,\n paths: readonly string[],\n props: Record<string, unknown>,\n): void {\n const label = typeof props.label === 'string' ? props.label.trim() : '';\n for (const path of paths) {\n const known = placed.get(path);\n if (!known) placed.set(path, { order: placed.size, ...(label ? { label } : {}) });\n else if (known.label === undefined && label) known.label = label;\n }\n}\n\n/** The `/inputs` paths one element places: what its props bind, and a hatch's own path. */\nfunction inputPathsOf(type: unknown, props: Record<string, unknown>): string[] {\n const paths: string[] = [];\n if (type === 'MthdsField' && typeof props.path === 'string') paths.push(props.path);\n for (const value of Object.values(props)) {\n if (isRecord(value) && typeof value.$bindState === 'string') paths.push(value.$bindState);\n }\n return paths.flatMap(inputPath);\n}\n\n/** The list a repeat lays out, when it names an input's list by its own path. */\nfunction repeatedList(repeat: unknown): string[] {\n return isRecord(repeat) && typeof repeat.statePath === 'string'\n ? inputPath(repeat.statePath)\n : [];\n}\n\nfunction inputPath(path: string): string[] {\n const segments = segmentsUnder(INPUTS_ROOT, path);\n return segments && segments.length > 0 ? [joinPath(INPUTS_ROOT, ...segments)] : [];\n}\n\nfunction keysOf(value: unknown): string[] {\n return Array.isArray(value) ? value.filter((key): key is string => typeof key === 'string') : [];\n}\n\nfunction slotKeys(slots: unknown): string[] {\n return isRecord(slots) ? Object.values(slots).flatMap(keysOf) : [];\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nconst PlacedInputsContext = React.createContext<ReadonlyMap<string, PlacedInput>>(new Map());\n\n/** Hands the frame components the inputs the layout places (`placedInputs`). */\nexport function PlacedInputsProvider({\n spec,\n children,\n}: {\n spec: Spec | null | undefined;\n children: React.ReactNode;\n}) {\n const placed = React.useMemo(() => placedInputs(spec), [spec]);\n return <PlacedInputsContext.Provider value={placed}>{children}</PlacedInputsContext.Provider>;\n}\n\n/** The inputs the layout places, by path; empty outside a page. */\nexport function usePlacedInputs(): ReadonlyMap<string, PlacedInput> {\n return React.useContext(PlacedInputsContext);\n}\n","'use client';\n\nimport {\n focusOutlineClass,\n linkTextClass,\n selectedBorderClass,\n selectedFillClass,\n} from '../react/role-tokens';\nimport { cn } from '../react/utils';\nimport { useBrand } from './brand-context';\n\n/**\n * The brand's bar: the logo pair and the app's name, the site's links and a\n * tag, in a banner across the top of the page. It is what the catalog's\n * `AppBar` draws, and a host draws it as its own chrome - over a plain form,\n * or above a designed page whose layout has none - inside a `BrandProvider`,\n * or under a `GenerativePage` given a `brand`. It reads the manifest from\n * there, and throws naming the cure when there is none.\n */\n\n/** The page's width and gutters, shared with the product page's chrome. */\nexport const CONTAINER = 'mx-auto w-full max-w-6xl px-6 sm:px-8';\n\nexport interface BrandBarProps {\n /** The app's name, beside the logo. */\n app: string;\n /** The site's links, drawn as words from the small breakpoint up. */\n links?: readonly string[] | null;\n /** A short code at the end of the bar, such as the pipe's. */\n tag?: string | null;\n}\n\nexport function BrandBar({ app, links, tag }: BrandBarProps) {\n const brand = useBrand();\n return (\n <header className=\"border-b border-border\">\n <div className={cn(CONTAINER, 'flex h-16 items-center gap-5')}>\n {/* `no-referrer` on both, as on every image this package paints: the\n scheme is already checked where the manifest is parsed, and a brand\n asset has no more business learning where it was drawn than a\n payload's picture does.\n\n This pair is the one place a `dark:` variant and the token fallbacks\n disagree. A fallback is frozen per utility and cannot vary by scope,\n so a host that defines no tokens renders LIGHT inside `.dark` - but\n the variant still flips, so that host gets the dark-ground asset on\n a light surface. Documented in `docs/theming.md` rather than worked\n around: the swap is right for every host that defines tokens, which\n is every host that sets `.dark` deliberately. */}\n <img\n src={brand.logo.onLight}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"h-7 w-auto dark:hidden\"\n />\n <img\n src={brand.logo.onDark}\n alt={brand.name}\n referrerPolicy=\"no-referrer\"\n className=\"hidden h-7 w-auto dark:block\"\n />\n <span aria-hidden=\"true\" className=\"h-5 w-px bg-border\" />\n <span className=\"text-sm font-medium text-foreground/80\">{app}</span>\n {/* `min-w-0` down to the pill: a pipe's code is one long word, and\n at phone width an unshrinkable pill pushed the row past the viewport. */}\n <div className=\"ml-auto flex min-w-0 items-center gap-6\">\n {links && links.length > 0 ? (\n <nav aria-label=\"Site\" className=\"hidden items-center gap-6 sm:flex\">\n {links.map((link, index) => (\n <a\n // A layout may name one link twice, so the label alone is no key.\n key={`${index}-${link}`}\n href=\"#\"\n onClick={(event) => event.preventDefault()}\n className={cn(\n 'rounded-sm text-sm text-muted-foreground transition-colors hover:text-foreground',\n focusOutlineClass,\n )}\n >\n {link}\n </a>\n ))}\n </nav>\n ) : null}\n {tag ? (\n <span\n className={cn(\n 'min-w-0 truncate rounded-lg border px-2.5 py-1 font-mono text-[11px]',\n selectedBorderClass,\n selectedFillClass,\n linkTextClass,\n )}\n >\n {tag}\n </span>\n ) : null}\n </div>\n </div>\n </header>\n );\n}\n","import type { z } from 'zod';\nimport { definitionChain, unwrapped, type ZodDefinition } from './zod-definition';\n\n/**\n * What a renderer is handed: its props as the catalog declares them, whatever\n * a layout's expressions resolved to.\n *\n * The checks hold a layout's literals to each prop's schema and the paths the\n * descriptor owns to what the descriptor says they are. A layout's own scratch\n * state is its business, though, and its value is whatever JSON a `setState`\n * wrote, so a prop bound to it can resolve to anything: a structure where a\n * title belongs, a word where a list of options belongs. A renderer that\n * trusted its declared type then threw - an object is not a React child, and a\n * string has no `map` - and json-render's element boundary dropped the element\n * from the page, past both checks. And a run's payload is the run's: a value\n * the descriptor calls a list may still arrive as something else.\n *\n * So every renderer of this entry's registry is handed props conformed to its\n * definition, once, here, rather than each renderer guarding each prop. A\n * value its schema accepts is passed as it is. One it refuses is replaced by\n * the nearest value of the declared type: a number or a boolean in a text prop\n * is written out, as an interpolation would write it, and so is one among the\n * entries of a list of texts; a list keeps the entries its item schema\n * accepts, and is itself held to the list's bounds once they are dropped, so\n * a `Tabs` left with one tab of the two it must have draws none rather than\n * one; anything else is absent - null where the prop is nullable, and for a\n * required text or list prop the empty text or list, which a renderer draws as\n * nothing. A prop declared `any` (a value a renderer shows, a table's rows) is\n * the renderer's own to read, through `textOf` where it writes one out.\n *\n * It runs on every render of every element, so it parses as little as it can.\n * What a schema says of an absent value is worked out once per schema; a\n * scalar against a plain text, number or boolean schema is judged by its type\n * alone; and a structure or a list is judged once per schema and value, so the\n * list a `$state` reads out of the store is parsed when the store changes and\n * not at each render - and when it is refused, the entries it keeps come back\n * as the same list each time, so a renderer whose effect is keyed on the prop\n * does not run it at every render.\n */\n\n/** What a schema says of an absent value, worked out once. */\ninterface SchemaFacts {\n def: ZodDefinition | undefined;\n /** The scalar type a value conforms to by its type alone, when the schema refines nothing. */\n plain: 'string' | 'boolean' | 'number' | undefined;\n acceptsNull: boolean;\n acceptsUndefined: boolean;\n /** What the prop resolves to when it is absent or refused. */\n absent: unknown;\n}\n\nconst factsBySchema = new WeakMap<z.ZodType, SchemaFacts>();\n\nfunction factsOf(schema: z.ZodType): SchemaFacts {\n const known = factsBySchema.get(schema);\n if (known) return known;\n const chain = definitionChain(schema);\n const def = chain[chain.length - 1];\n const acceptsNull = schema.safeParse(null).success;\n const acceptsUndefined = schema.safeParse(undefined).success;\n const absent = acceptsNull\n ? null\n : acceptsUndefined\n ? undefined\n : def?.type === 'string'\n ? ''\n : def?.type === 'array'\n ? []\n : undefined;\n const facts = { def, plain: plainType(chain), acceptsNull, acceptsUndefined, absent };\n factsBySchema.set(schema, facts);\n return facts;\n}\n\n/** The wrappers that hand a present value to the schema they wrap and its result back unchanged. */\nconst PASSING_WRAPPERS: ReadonlySet<string> = new Set([\n 'optional',\n 'nullable',\n 'default',\n 'prefault',\n 'readonly',\n 'catch',\n 'nonoptional',\n]);\n\n/**\n * The scalar type a value conforms to by its type alone: a text, a boolean\n * or a number schema with no refinement and no format on it, under wrappers\n * that pass a present value through and refine nothing either. Anything else\n * - an enum, a bounded text, an email, an integer, a `.refine` on the\n * nullable around a text - is parsed.\n */\nfunction plainType(chain: readonly ZodDefinition[]): SchemaFacts['plain'] {\n const def = chain[chain.length - 1];\n if (!def || def.format !== undefined) return undefined;\n if (chain.some((link) => link.checks !== undefined && link.checks.length > 0)) return undefined;\n if (!chain.slice(0, -1).every((link) => PASSING_WRAPPERS.has(link.type))) return undefined;\n return def.type === 'string' || def.type === 'boolean' || def.type === 'number'\n ? def.type\n : undefined;\n}\n\n/** Whether a scalar conforms by its type alone, against a schema `plainType` read as plain. */\nfunction plainlyConforms(plain: SchemaFacts['plain'], value: unknown): boolean {\n if (plain === 'number') return typeof value === 'number' && Number.isFinite(value);\n return plain !== undefined && typeof value === plain;\n}\n\n/** A scalar's nearest value of a text schema: a number or a boolean written out, or nothing. */\nfunction writtenOut(schema: z.ZodType, value: unknown): string | undefined {\n if (typeof value !== 'number' && typeof value !== 'boolean') return undefined;\n const text = String(value);\n return schema.safeParse(text).success ? text : undefined;\n}\n\n/** A refused list's nearest value: the entries its item schema accepts, or writes out, held to its bounds. */\nfunction keptEntries(\n schema: z.ZodType,\n element: z.ZodType,\n entries: readonly unknown[],\n absent: unknown,\n): unknown {\n const textItems = unwrapped(element)?.type === 'string';\n const kept = entries.flatMap((entry) => {\n if (element.safeParse(entry).success) return [entry];\n const text = textItems ? writtenOut(element, entry) : undefined;\n return text === undefined ? [] : [text];\n });\n return schema.safeParse(kept).success ? kept : absent;\n}\n\n/** What a structure or a list conformed to, by schema and value. */\nconst conformedBySchema = new WeakMap<z.ZodType, WeakMap<object, unknown>>();\n\n/** One prop's resolved value, held to its schema. */\nfunction conformValue(schema: z.ZodType, value: unknown): unknown {\n const facts = factsOf(schema);\n if (value === undefined) return facts.acceptsUndefined ? value : facts.absent;\n if (value === null) return facts.acceptsNull ? value : facts.absent;\n if (typeof value !== 'object') {\n if (plainlyConforms(facts.plain, value) || schema.safeParse(value).success) return value;\n if (facts.def?.type === 'string') return writtenOut(schema, value) ?? facts.absent;\n return facts.absent;\n }\n let byValue = conformedBySchema.get(schema);\n if (!byValue) {\n byValue = new WeakMap();\n conformedBySchema.set(schema, byValue);\n }\n if (byValue.has(value)) return byValue.get(value);\n const held = schema.safeParse(value).success\n ? value\n : facts.def?.type === 'array' && facts.def.element && Array.isArray(value)\n ? keptEntries(schema, facts.def.element, value, facts.absent)\n : facts.absent;\n byValue.set(value, held);\n return held;\n}\n\n/**\n * Props held to a component's declared shape. The same object comes back when\n * every value already conforms, which is every render of a layout whose\n * expressions resolved to what they should, so a renderer sees no new props\n * object for nothing. A prop the shape does not declare is passed through: the\n * catalog check refuses one, and this is not the place to restate it, and\n * neither is a prop named in `asWritten`, whose renderer reads it as it came.\n */\nexport function conformProps<P extends Record<string, unknown>>(\n shape: Readonly<Record<string, z.ZodType>>,\n props: P,\n asWritten: readonly string[] = [],\n): P {\n let conformed: Record<string, unknown> | undefined;\n for (const [name, schema] of Object.entries(shape)) {\n if (asWritten.includes(name)) continue;\n const value = props[name];\n const held = conformValue(schema, value);\n if (held === value) continue;\n conformed ??= { ...props };\n conformed[name] = held;\n }\n return (conformed ?? props) as P;\n}\n\n/** A component definition as a catalog carries it: what matters here is its props schema. */\ntype Definitions = Readonly<Record<string, { props?: unknown }>>;\n\n/**\n * Renderers that are handed their props conformed to the definitions they\n * render, each wrapped once. A renderer the definitions do not name is\n * returned as it is. `asWritten` names, per component, the props whose\n * nearest value would mean something else: a `path` the layer resolves as\n * written - a hatch's, a `Picture`'s - is relative inside a repeat, so a\n * refused one written out as text would bind a live field to some other\n * corner of the state (a `0` read from scratch state is the item's first\n * entry), and an empty one is the item itself; a refused path must reach its\n * renderer as refused.\n */\nexport function withDeclaredProps<R extends Record<string, (ctx: never) => unknown>>(\n definitions: Definitions,\n renderers: R,\n asWritten: Readonly<Record<string, readonly string[]>> = {},\n): R {\n const wrapped: Record<string, unknown> = {};\n for (const [name, render] of Object.entries(renderers)) {\n const schema = definitions[name]?.props as { shape?: Record<string, z.ZodType> } | undefined;\n const shape = schema?.shape;\n wrapped[name] = shape\n ? (ctx: { props: Record<string, unknown> }) =>\n (render as (ctx: unknown) => unknown)({\n ...ctx,\n props: conformProps(shape, ctx.props, asWritten[name]),\n })\n : render;\n }\n return wrapped as R;\n}\n\n/**\n * A value as the text a renderer writes out, for a prop declared `any`. A\n * scalar is written as it is; a list is its entries written out and joined;\n * a structure is no text at all, so the renderer shows what it shows for a\n * value that is not there rather than `[object Object]`. The checks refuse a\n * read of a structure the descriptor owns into such a prop; this is for one\n * that reached it anyway, out of a layout's own scratch state, where a\n * `setState` wrote whatever JSON it wrote - one carrying its own `toString`\n * member included, which `String` throws on.\n */\nexport function textOf(value: unknown): string {\n if (value === undefined || value === null) return '';\n if (Array.isArray(value)) {\n return value\n .map(textOf)\n .filter((text) => text !== '')\n .join(', ');\n }\n if (typeof value === 'object') return '';\n return String(value);\n}\n","'use client';\n\nimport * as React from 'react';\n\n/**\n * What a host's compose-then-result frame tells the frame components of a\n * layout - the facts no descriptor carries.\n *\n * A layout written for the `composer` frame places the host's action row\n * through `Composer`, and one written for the `result` frame places the\n * host's actions through `ResultHeader`. What those rows SAY beyond the\n * layout's own words is the host's knowledge: how long a run usually takes,\n * what the result's actions are called and what they do. The layout names\n * where they go; the host fills them.\n */\nexport interface FrameHost {\n /** How long a run usually takes, from the app's past runs: \"Takes about 30 seconds\". */\n eta?: string;\n /** The result's actions, primary first: \"Download PDF\", \"Share\". */\n actions?: readonly string[];\n /** What an action does, by its label. */\n onAction?: (label: string) => void;\n}\n\nconst FrameHostContext = React.createContext<FrameHost>({});\n\nexport function FrameHostProvider({\n host,\n children,\n}: {\n host: FrameHost;\n children: React.ReactNode;\n}) {\n return <FrameHostContext.Provider value={host}>{children}</FrameHostContext.Provider>;\n}\n\nexport function useFrameHost(): FrameHost {\n return React.useContext(FrameHostContext);\n}\n","import { readDateContent } from '../core/native-content';\n\n/**\n * How the generative layer writes a number, an amount and a day: one locale,\n * one formatter per setting, made once and kept.\n *\n * The result components used to build their formatters three ways in two\n * locales, so a `DataTable` cell and a `Metric` wrote their numbers in en-US\n * while a `ProportionBar` wrote its amounts in en-GB, and a share of money was\n * rounded to whole units: parts of 3.99 and 1.49 read \"€4\" and \"€1\" beside a\n * total of \"€5\". Every component now asks here.\n *\n * The locale is the one the layer's dates were already written in. A host's\n * own locale reaching a produced page is a separate question, the kernel's\n * result view's as much as this layer's.\n */\nexport const LAYOUT_LOCALE = 'en-GB';\n\n/** How a number is written: `grouped` as a cell shows one, the others as a `Metric` names them. */\nexport type NumberStyle = 'grouped' | 'integer' | 'decimal' | 'compact' | 'plain';\n\nconst NUMBER_OPTIONS: Readonly<Record<NumberStyle, Intl.NumberFormatOptions>> = {\n // Grouped, with the places it has up to two, never padded.\n grouped: { maximumFractionDigits: 2 },\n integer: { maximumFractionDigits: 0 },\n decimal: { minimumFractionDigits: 2, maximumFractionDigits: 2 },\n compact: { notation: 'compact', maximumFractionDigits: 1 },\n // As written: every place, and no grouping, so a year or an id reads as itself.\n plain: { maximumFractionDigits: 20, useGrouping: false },\n};\n\nconst numbers = new Map<NumberStyle, Intl.NumberFormat>();\n\n/** `value` written in `style`. */\nexport function formatNumber(value: number, style: NumberStyle = 'grouped'): string {\n let format = numbers.get(style);\n if (!format) {\n format = new Intl.NumberFormat(LAYOUT_LOCALE, NUMBER_OPTIONS[style]);\n numbers.set(style, format);\n }\n return format.format(value);\n}\n\n/** A currency's two formatters: one for a whole amount, one with its own fraction digits. */\ninterface Money {\n readonly whole: Intl.NumberFormat;\n readonly fractional: Intl.NumberFormat;\n}\n\n/**\n * The currencies already asked for, each with its formatters, or `null` for a\n * code that names none. Bounded by what it can hold: three capital letters.\n */\nconst currencies = new Map<string, Money | null>();\n\n/**\n * The currency codes `Intl` lists, where it can list them. A well-formed code\n * it does not know (\"KWH\", \"MPH\") does not make `Intl.NumberFormat` throw, it\n * writes the code as a symbol (\"KWH 12.50\"), so a unit in capitals would read\n * as money; the list is what says it is none. A runtime with no list falls\n * back to what `Intl` accepts.\n */\nconst KNOWN_CURRENCIES: ReadonlySet<string> | null = (() => {\n try {\n return typeof Intl.supportedValuesOf === 'function'\n ? new Set(Intl.supportedValuesOf('currency'))\n : null;\n } catch {\n return null;\n }\n})();\n\nfunction currencyFormat(code: string): Money | null {\n if (!currencies.has(code)) {\n if (KNOWN_CURRENCIES && !KNOWN_CURRENCIES.has(code)) {\n currencies.set(code, null);\n return null;\n }\n let money: Money | null;\n try {\n // The currency's own fraction digits (two for the euro, none for the\n // yen), with a whole amount written whole: €2,400 beside €3.99. Two\n // formatters rather than `trailingZeroDisplay`, which not every\n // browser a host supports knows.\n money = {\n whole: new Intl.NumberFormat(LAYOUT_LOCALE, {\n style: 'currency',\n currency: code,\n minimumFractionDigits: 0,\n maximumFractionDigits: 0,\n }),\n fractional: new Intl.NumberFormat(LAYOUT_LOCALE, { style: 'currency', currency: code }),\n };\n } catch {\n money = null;\n }\n currencies.set(code, money);\n }\n return currencies.get(code)!;\n}\n\n/**\n * An amount in `unit`: money when the unit is a currency code `Intl` lists,\n * with that currency's own fraction digits; otherwise the number grouped,\n * with the unit after it (\"12.5 km\"), or alone with no unit.\n */\nexport function formatAmount(value: number, unit?: string | null): string {\n if (unit && /^[A-Z]{3}$/.test(unit)) {\n const money = currencyFormat(unit);\n if (money) {\n // Whole as the currency's own formatter rounds it, so a payload's\n // 2399.999 reads \"€2,400\" beside the 2,400 it is, not \"€2,400.00\", and\n // 1.005 keeps the cent `Intl` rounds it to: binary arithmetic would\n // round it the other way and call it whole.\n const fraction = money.fractional.formatToParts(value).find((p) => p.type === 'fraction');\n const whole = fraction === undefined || /^0+$/.test(fraction.value);\n return (whole ? money.whole : money.fractional).format(value);\n }\n }\n const written = formatNumber(value);\n return unit ? `${written} ${unit}` : written;\n}\n\n/** How a day is written: in full, short, or its weekday with its day and month. */\nexport type DayStyle = 'long' | 'short' | 'weekday';\n\nconst DAY_OPTIONS: Readonly<Record<DayStyle, Intl.DateTimeFormatOptions>> = {\n long: { weekday: 'long', day: 'numeric', month: 'long', year: 'numeric', timeZone: 'UTC' },\n short: { day: 'numeric', month: 'short', year: 'numeric', timeZone: 'UTC' },\n weekday: { weekday: 'short', day: 'numeric', month: 'long', timeZone: 'UTC' },\n};\n\nconst days = new Map<DayStyle, Intl.DateTimeFormat>();\n\n/**\n * The calendar day a value names, written in `style`, or `undefined` for a\n * value that names none. A day is read as the kernel's result view reads a\n * date (`readDateContent`): the day as text, or a native date's own\n * structure (`{ date, time }`, in the serializer's envelope or not). Only its\n * leading `YYYY-MM-DD` is read, anchored at noon UTC, so a time beside it\n * (\"2025-03-09 00:30\") never moves it across midnight in the reader's zone,\n * and a day its month does not have names none.\n */\nexport function formatDay(value: unknown, style: DayStyle = 'long'): string | undefined {\n const written = readDateContent(value)?.date;\n const day = written === undefined ? null : /^\\d{4}-\\d{2}-\\d{2}/.exec(written);\n if (!day) return undefined;\n const date = new Date(`${day[0]}T12:00:00Z`);\n // `Date` rolls a day the month does not have into the next (\"2025-02-31\"\n // into 3 March), so the day it lands on must be the one written.\n if (Number.isNaN(date.getTime()) || date.toISOString().slice(0, 10) !== day[0]) {\n return undefined;\n }\n let format = days.get(style);\n if (!format) {\n format = new Intl.DateTimeFormat(LAYOUT_LOCALE, DAY_OPTIONS[style]);\n days.set(style, format);\n }\n return format.format(date);\n}\n","'use client';\n\nimport * as React from 'react';\nimport { type BaseComponentProps, useBoundProp } from '@json-render/react';\nimport { RevealPanel, useCheckedField } from '../checked-fields';\nimport { hasOwnProp } from '../../core/own-property';\nimport { enumLabeler, useFieldPresentation } from '../../react/field-presentation';\nimport { fieldControlClass } from '../../react/field-styles';\nimport { checkedAccentClass, focusOutlineClass } from '../../react/role-tokens';\nimport { headingClass, panelFlatShadowClass, panelSurfaceClass } from '../../react/style-tokens';\nimport { cn } from '../../react/utils';\nimport { ChevronDown } from 'lucide-react';\nimport { Switch as SwitchPrimitive } from '../../react/ui/switch';\n\n/**\n * The renderers for the shadcn subset the catalog picks.\n *\n * They are the package's own, over the same theme tokens the kernel's controls\n * read, for the same reason the controls vendor their primitives: a consumer\n * of `./generative` installs this package and a handful of radix primitives,\n * never a component library. The DEFINITIONS these implement live in\n * `../shadcn-definitions.ts`, and `docs/dependency-budget.md` states the pair.\n *\n * A bound prop is read through `useBoundProp` and written back at the path the\n * spec named, so what the person types lands in the host's store and nowhere\n * else. An unbound one falls back to component state, which is what lets a\n * layout be rendered over an empty store while it is being read.\n */\n\ntype Check = { type: string; message: string; args?: Record<string, unknown> };\ntype ValidateOn = 'change' | 'blur' | 'submit';\n\ninterface BoundFieldProps {\n checks?: Check[] | null;\n validateOn?: ValidateOn | null;\n}\n\n/**\n * The one piece of binding every input repeats: the value the control shows,\n * the setter that writes it back, and the checks the spec attached to it.\n * `useCheckedField` is given a binding only when there is both a path and a\n * check, so an unbound control never registers a validator the run would wait\n * on. `focusRef` goes on the element a refused run puts the focus on, and\n * `describedBy` on the element the message describes, so the message is\n * heard with the focus.\n */\nfunction useBoundField<T>(\n literal: T | null | undefined,\n binding: string | undefined,\n empty: T,\n { checks, validateOn }: BoundFieldProps,\n id: string,\n) {\n const [boundValue, setBoundValue] = useBoundProp<T>(literal ?? undefined, binding);\n const [localValue, setLocalValue] = React.useState<T>(literal ?? empty);\n const isBound = Boolean(binding);\n const hasValidation = Boolean(binding && checks?.length);\n const when = validateOn ?? 'change';\n const { errors, validate, focusRef } = useCheckedField(\n binding ?? '',\n hasValidation ? { checks: checks ?? [], validateOn: when } : undefined,\n );\n const error = errors[0];\n return {\n value: isBound ? (boundValue ?? empty) : localValue,\n setValue: (next: T) => {\n if (isBound) setBoundValue(next);\n else setLocalValue(next);\n },\n error,\n errorId: `${id}-error`,\n describedBy: error ? `${id}-error` : undefined,\n focusRef,\n validateOnChange: () => {\n if (hasValidation && when === 'change') validate();\n },\n validateOnBlur: () => {\n if (hasValidation && when === 'blur') validate();\n },\n };\n}\n\nconst LABEL = 'block text-sm leading-none font-medium';\n\nfunction FieldError({ id, message }: { id: string; message?: string }) {\n return message ? (\n <p id={id} className=\"text-sm text-destructive\">\n {message}\n </p>\n ) : null;\n}\n\n/**\n * The key a closed map answers to, or the fallback.\n *\n * Every map below is keyed by a prop the catalog declares as an enum, and a\n * renderer must not trust that: an expression-valued prop skips the zod check,\n * and a `$template` with nothing to interpolate resolves to a literal, so the\n * string can be anything a layout wrote - `constructor` included, which a bare\n * lookup answers with a function off `Object.prototype`. Both gates refuse the\n * shape; the prop's own type stays the contract; this is what happens when a\n * stored artifact disagrees with it. The read is `hasOwnProp`, the kernel's one\n * spelling of an own-property read (and `Object.hasOwn` is ES2022, past the\n * package's ES2020 target), so an inherited name is not a hit; the fallback is\n * typed as one of the map's own keys.\n */\nexport function pickKey<K extends string>(\n table: Record<K, unknown>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): K {\n return key != null && hasOwnProp(table, key) ? (key as K) : fallback;\n}\n\n/** The value a closed map holds for `key`, or for the fallback when `key` is not one of its own. */\nexport function pick<K extends string, T>(\n table: Record<K, T>,\n key: string | null | undefined,\n fallback: NoInfer<K>,\n): T {\n return table[pickKey(table, key, fallback)];\n}\n\n// ── Layout ──────────────────────────────────────────────────────────────────\n\nexport function Card({\n props,\n children,\n}: BaseComponentProps<{ title?: string | null; description?: string | null }>) {\n return (\n // A style's panel: a host writes the style's field fill onto `--input`\n // here, as on its own panel, so the fields inside do not sink into it.\n // A panel's corner is one and a half times a control's, as the rail's is.\n <div\n data-style-panel=\"\"\n className={cn(\n 'rounded-[calc(var(--radius,0.5rem)*1.5)] p-6 text-card-foreground',\n panelSurfaceClass,\n panelFlatShadowClass,\n )}\n >\n {props.title || props.description ? (\n <div className=\"mb-4 space-y-1.5\">\n {props.title ? (\n <h3 className={cn('text-lg leading-none', headingClass(600))}>{props.title}</h3>\n ) : null}\n {props.description ? (\n <p className=\"text-sm text-muted-foreground\">{props.description}</p>\n ) : null}\n </div>\n ) : null}\n {children}\n </div>\n );\n}\n\nconst GAP = {\n none: 'gap-0',\n sm: 'gap-2',\n md: 'gap-4',\n lg: 'gap-6',\n xl: 'gap-8',\n};\n\nconst ALIGN = {\n start: 'items-start',\n center: 'items-center',\n end: 'items-end',\n stretch: 'items-stretch',\n};\n\nconst JUSTIFY = {\n start: 'justify-start',\n center: 'justify-center',\n end: 'justify-end',\n between: 'justify-between',\n around: 'justify-around',\n};\n\nexport function Stack({\n props,\n children,\n}: BaseComponentProps<{\n direction?: 'horizontal' | 'vertical' | null;\n gap?: keyof typeof GAP | null;\n align?: keyof typeof ALIGN | null;\n justify?: keyof typeof JUSTIFY | null;\n}>) {\n const horizontal = props.direction === 'horizontal';\n // A vertical stack asked to centre centres ONE column its children share,\n // as wide as the widest of them and never wider than its box, rather than\n // each child at its own width: `items-center` there gave a hero narrower\n // than the form under it a different left edge from the form, and the page\n // read ragged. Its children then fill the column, so their edges agree, and\n // one that sizes itself (a `Button`) starts at the column's edge with the\n // rest rather than in its middle. A horizontal stack centres its children\n // on the cross axis, one by one.\n //\n // The column is centred by an outer box that centres it as `items-center`\n // centred each child, never by auto margins: inside a horizontal stack an\n // auto margin takes the row's free space ahead of its `gap` and `justify`,\n // so two centred columns side by side spread apart instead of packing. The\n // column grows to the outer box's height, so a parent that stretches the\n // box (a grid cell, a row asked to stretch) still gives its `justify` and a\n // child that grows the room they had.\n const column = !horizontal && props.align === 'center';\n const stack = (\n <div\n className={cn(\n 'flex',\n horizontal ? 'flex-row' : 'flex-col',\n pick(GAP, props.gap, 'md'),\n column\n ? 'w-fit max-w-full grow items-stretch'\n : pick(ALIGN, props.align, horizontal ? 'start' : 'stretch'),\n props.justify ? pick(JUSTIFY, props.justify, 'start') : undefined,\n )}\n >\n {children}\n </div>\n );\n return column ? <div className=\"flex flex-col items-center\">{stack}</div> : stack;\n}\n\n/** Enumerated rather than interpolated: Tailwind compiles the class names it can see. */\nconst COLUMNS: Record<number, string> = {\n 1: 'grid-cols-1',\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-2 lg:grid-cols-3',\n 4: 'sm:grid-cols-2 lg:grid-cols-4',\n 5: 'sm:grid-cols-2 lg:grid-cols-5',\n 6: 'sm:grid-cols-2 lg:grid-cols-6',\n};\n\nexport function Grid({\n props,\n children,\n}: BaseComponentProps<{ columns?: number | null; gap?: keyof typeof GAP | null }>) {\n const columns = Math.min(Math.max(Math.round(props.columns ?? 2), 1), 6);\n return (\n <div className={cn('grid grid-cols-1', COLUMNS[columns], pick(GAP, props.gap, 'md'))}>\n {children}\n </div>\n );\n}\n\nexport function Separator({\n props,\n}: BaseComponentProps<{ orientation?: 'horizontal' | 'vertical' | null }>) {\n const vertical = props.orientation === 'vertical';\n return (\n <div\n role=\"separator\"\n aria-orientation={vertical ? 'vertical' : 'horizontal'}\n className={cn('shrink-0 bg-border', vertical ? 'h-full w-px' : 'h-px w-full')}\n />\n );\n}\n\n/**\n * `details`/`summary` rather than a disclosure primitive: the open state is the\n * element's own, which is what the catalog asks for (a page's UI state never\n * reaches `/state`), and a closed section still exists for find-in-page. A\n * closed section keeps its fields mounted, so their checks hold the run, and\n * a run one of them refuses opens it to show that field.\n */\nexport function Collapsible({\n props,\n children,\n}: BaseComponentProps<{ title: string; defaultOpen?: boolean | null }>) {\n const details = React.useRef<HTMLDetailsElement>(null);\n const open = React.useCallback(() => {\n if (details.current) details.current.open = true;\n }, []);\n return (\n <details\n ref={details}\n className=\"rounded-md border border-border\"\n open={props.defaultOpen ?? false}\n data-slot=\"collapsible\"\n >\n {/* A chevron that turns as it opens: without one the closed section\n read as an empty text field with a placeholder. */}\n <summary className=\"flex min-h-11 cursor-pointer list-none items-center justify-between gap-3 rounded-md px-4 py-3 text-sm font-medium select-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset [&::-webkit-details-marker]:hidden\">\n <span>{props.title}</span>\n <ChevronDown\n aria-hidden=\"true\"\n className=\"size-4 shrink-0 text-muted-foreground transition-transform [details[open]>summary_&]:rotate-180\"\n />\n </summary>\n <div className=\"border-t border-border px-4 py-3\">\n <RevealPanel open={open}>{children}</RevealPanel>\n </div>\n </details>\n );\n}\n\n// ── Content ─────────────────────────────────────────────────────────────────\n\n// Every level reads the page's heading style (`react/style-tokens`), falling\n// back to the weight and tracking it was set in.\nconst HEADING = {\n h1: cn('text-3xl', headingClass(700, true)),\n h2: cn('text-2xl', headingClass(600, true)),\n h3: cn('text-lg', headingClass(600)),\n h4: cn('text-base', headingClass(600)),\n};\n\nexport function Heading({\n props,\n}: BaseComponentProps<{ text: string; level?: 'h1' | 'h2' | 'h3' | 'h4' | null }>) {\n // The tag is looked up in the same closed map the class comes from, never\n // taken from the prop. `const Tag = level` made an arbitrary string a DOM tag\n // name, and a prop can carry one (`pickKey` says how): a server-rendered host\n // emitted `<script>` from a layout that passed both gates.\n const Tag = pickKey(HEADING, props.level, 'h2');\n return <Tag className={cn('text-foreground', HEADING[Tag])}>{props.text}</Tag>;\n}\n\nconst TEXT = {\n body: 'text-sm text-foreground',\n caption: 'text-xs text-muted-foreground',\n muted: 'text-sm text-muted-foreground',\n lead: 'text-lg text-muted-foreground',\n code: 'font-mono text-[13px] text-foreground',\n};\n\nexport function Text({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'body' | 'caption' | 'muted' | 'lead' | 'code' | null;\n}>) {\n return <p className={pick(TEXT, props.variant, 'body')}>{props.text}</p>;\n}\n\nconst AVATAR_SIZE = {\n sm: 'size-8 text-[11px]',\n md: 'size-10 text-xs',\n lg: 'size-12 text-sm',\n};\n\n/** Initials only: the catalog's description tells a model never to set `src`. */\nfunction initialsOf(name: string): string {\n const words = name.trim().split(/\\s+/).filter(Boolean);\n if (words.length === 0) return '?';\n const first = words[0]?.[0] ?? '';\n const last = words.length > 1 ? (words[words.length - 1]?.[0] ?? '') : '';\n return (first + last).toUpperCase();\n}\n\nexport function Avatar({\n props,\n}: BaseComponentProps<{ name: string; size?: 'sm' | 'md' | 'lg' | null }>) {\n const name = String(props.name ?? '');\n return (\n <span\n className={cn(\n 'inline-flex shrink-0 items-center justify-center rounded-full bg-muted font-medium text-muted-foreground',\n pick(AVATAR_SIZE, props.size, 'md'),\n )}\n aria-label={name || undefined}\n role=\"img\"\n >\n {initialsOf(name)}\n </span>\n );\n}\n\nconst BADGE = {\n default: 'bg-primary text-primary-foreground',\n secondary: 'bg-secondary text-secondary-foreground',\n destructive: 'bg-destructive text-white',\n outline: 'border border-border text-foreground',\n};\n\nexport function Badge({\n props,\n}: BaseComponentProps<{\n text: string;\n variant?: 'default' | 'secondary' | 'destructive' | 'outline' | null;\n}>) {\n return (\n <span\n className={cn(\n 'inline-flex w-fit items-center rounded-md px-2 py-0.5 text-xs font-medium',\n pick(BADGE, props.variant, 'default'),\n )}\n >\n {props.text}\n </span>\n );\n}\n\nconst ALERT = {\n info: 'border-border bg-muted text-foreground',\n success: 'border-border bg-muted text-foreground',\n warning: 'border-border bg-muted text-foreground',\n error: 'border-destructive/50 bg-destructive/10 text-foreground',\n};\n\nexport function Alert({\n props,\n}: BaseComponentProps<{\n title: string;\n message?: string | null;\n type?: 'info' | 'success' | 'warning' | 'error' | null;\n}>) {\n const type = pickKey(ALERT, props.type, 'info');\n return (\n <div\n role={type === 'error' ? 'alert' : 'status'}\n className={cn('rounded-md border px-4 py-3 text-sm', ALERT[type])}\n >\n <p className=\"font-medium\">{props.title}</p>\n {props.message ? <p className=\"mt-1 text-muted-foreground\">{props.message}</p> : null}\n </div>\n );\n}\n\nexport function Progress({\n props,\n}: BaseComponentProps<{ value: number; max?: number | null; label?: string | null }>) {\n const max = props.max ?? 100;\n const value = Math.min(Math.max(Number(props.value) || 0, 0), max);\n const percent = max > 0 ? (value / max) * 100 : 0;\n return (\n <div className=\"space-y-1.5\">\n {props.label ? <p className=\"text-sm text-muted-foreground\">{props.label}</p> : null}\n <div\n role=\"progressbar\"\n aria-valuenow={value}\n aria-valuemin={0}\n aria-valuemax={max}\n aria-label={props.label ?? undefined}\n className=\"h-2 w-full overflow-hidden rounded-full bg-muted\"\n >\n <div className=\"h-full bg-primary transition-all\" style={{ width: `${percent}%` }} />\n </div>\n </div>\n );\n}\n\n// ── Inputs ──────────────────────────────────────────────────────────────────\n\n/**\n * A stable id per mounted control, for the label that names it.\n *\n * `useId` rather than a module-level counter, for the reason\n * `src/react/field-dom-id.tsx` already gives: it is unique per instance within\n * a React root AND hydration-stable. A counter is neither. It is module state\n * that lives as long as the process, so a server module that has served earlier\n * requests is already advanced while the freshly loaded client module starts at\n * zero - and these controls carry `'use client'`, which means they are still\n * server-rendered and then hydrated. `useMemo` is documented as a hint a\n * renderer may discard, so the id was not guaranteed stable within one session\n * either; when it changed, the label stopped naming its input and the control\n * lost its accessible name, which no story test can see because none of them\n * render on a server.\n */\nexport function useControlId(name: string): string {\n return `jr-${name}-${React.useId()}`;\n}\n\nexport function Input({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n type?: 'text' | 'email' | 'password' | 'number' | null;\n placeholder?: string | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props, id);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n className={cn(fieldControlClass, 'min-h-11 px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n ref={field.focusRef}\n aria-invalid={field.error ? true : undefined}\n aria-describedby={field.describedBy}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onFocus={() => emit('focus')}\n onBlur={() => {\n field.validateOnBlur();\n emit('blur');\n }}\n />\n <FieldError id={field.errorId} message={field.error} />\n </div>\n );\n}\n\nexport function Textarea({\n props,\n bindings,\n}: BaseComponentProps<\n {\n label: string;\n name: string;\n placeholder?: string | null;\n rows?: number | null;\n value?: string | null;\n } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props, id);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 4}\n className={cn(fieldControlClass, 'px-3 py-2')}\n placeholder={props.placeholder ?? undefined}\n value={field.value}\n ref={field.focusRef}\n aria-invalid={field.error ? true : undefined}\n aria-describedby={field.describedBy}\n onChange={(event) => {\n field.setValue(event.target.value);\n field.validateOnChange();\n }}\n onBlur={field.validateOnBlur}\n />\n <FieldError id={field.errorId} message={field.error} />\n </div>\n );\n}\n\n/**\n * A native radio or check box: checked in the accent ink, as every selection\n * reads the accent rather than the button colour, and focused in `--ring`, as\n * everything in the tab order is, never in the browser's own ring.\n */\nconst NATIVE_CHECK = cn('size-4 shrink-0', checkedAccentClass, focusOutlineClass);\n\n/**\n * The label a native radio or check box sits in, which is where a finger\n * lands: a tap anywhere on a label activates the control it wraps. The box\n * keeps its 16 pixels, and below `sm` its row grows to 44 pixels tall across\n * the column, so the target is the whole row rather than the box.\n */\nconst NATIVE_CHECK_ROW = 'flex items-center gap-2 text-sm max-sm:min-h-11';\n\nexport function Radio({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; options: string[]; value?: string | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<string>(props.value, bindings?.value, '', props, id);\n const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\n return (\n <fieldset\n className=\"space-y-2\"\n aria-invalid={field.error ? true : undefined}\n aria-describedby={field.describedBy}\n >\n <legend className={LABEL}>{props.label}</legend>\n {/* Rows of 44 pixels need no gap between them on a phone. */}\n <div className=\"space-y-2 max-sm:space-y-0\">\n {(props.options ?? []).map((option, index, options) => (\n <label key={`${index}-${option}`} className={NATIVE_CHECK_ROW}>\n <input\n type=\"radio\"\n name={id}\n value={option}\n checked={field.value === option}\n // The focus a refused run gives the group goes to the checked\n // option, as the group's own tab stop does, and to the first\n // while none is.\n ref={\n field.value === option ||\n (index === 0 && !options.some((other) => other === field.value))\n ? field.focusRef\n : undefined\n }\n className={NATIVE_CHECK}\n onChange={() => {\n field.setValue(option);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{labelOf(option)}</span>\n </label>\n ))}\n </div>\n <FieldError id={field.errorId} message={field.error} />\n </fieldset>\n );\n}\n\nexport function Checkbox({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props, id);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={NATIVE_CHECK_ROW}>\n <input\n id={id}\n name={props.name}\n type=\"checkbox\"\n className={NATIVE_CHECK}\n checked={field.value}\n ref={field.focusRef}\n aria-invalid={field.error ? true : undefined}\n aria-describedby={field.describedBy}\n onChange={(event) => {\n field.setValue(event.target.checked);\n field.validateOnChange();\n emit('change');\n }}\n />\n <span>{props.label}</span>\n </label>\n <FieldError id={field.errorId} message={field.error} />\n </div>\n );\n}\n\nexport function Switch({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n { label: string; name: string; checked?: boolean | null } & BoundFieldProps\n>) {\n const id = useControlId(props.name);\n const field = useBoundField<boolean>(props.checked, bindings?.checked, false, props, id);\n return (\n <div className=\"space-y-2\">\n {/* Room for the switch's 44px hit area below `sm`, inside its own row. */}\n <div className=\"flex items-center gap-3 max-sm:py-2.5\">\n <SwitchPrimitive\n id={id}\n name={props.name}\n checked={field.value}\n ref={field.focusRef}\n aria-invalid={field.error ? true : undefined}\n aria-describedby={field.describedBy}\n onCheckedChange={(next) => {\n field.setValue(next);\n field.validateOnChange();\n emit('change');\n }}\n />\n <label htmlFor={id} className=\"text-sm\">\n {props.label}\n </label>\n </div>\n <FieldError id={field.errorId} message={field.error} />\n </div>\n );\n}\n\n// ── Actions ─────────────────────────────────────────────────────────────────\n\nconst BUTTON = {\n primary: 'bg-primary text-primary-foreground hover:bg-primary/90',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-secondary/80',\n danger: 'bg-destructive text-white hover:bg-destructive/90',\n};\n\nexport function Button({\n props,\n emit,\n}: BaseComponentProps<{\n label: string;\n variant?: 'primary' | 'secondary' | 'danger' | null;\n disabled?: boolean | null;\n}>) {\n return (\n <button\n type=\"button\"\n disabled={props.disabled ?? false}\n className={cn(\n 'inline-flex min-h-11 w-fit items-center justify-center rounded-md px-4 py-2 text-sm font-medium transition-colors',\n focusOutlineClass,\n 'disabled:pointer-events-none disabled:opacity-50',\n pick(BUTTON, props.variant, 'primary'),\n )}\n onClick={() => emit('press')}\n >\n {props.label}\n </button>\n );\n}\n","'use client';\n\nimport * as React from 'react';\nimport {\n type BaseComponentProps,\n type Components,\n useBoundProp,\n useRepeatScope,\n useStateStore,\n useStateValue,\n} from '@json-render/react';\nimport { RevealPanel, useCheckedField } from './checked-fields';\nimport {\n Accessibility,\n AlertCircle,\n Baby,\n Banknote,\n BarChart3,\n Bookmark,\n Briefcase,\n Building2,\n Calendar,\n Camera,\n Car,\n CheckCircle2,\n Clock,\n Coffee,\n Coins,\n Compass,\n FileText,\n Flag,\n Gift,\n Globe,\n Hash,\n Heart,\n Home,\n Hotel,\n Hourglass,\n Image,\n Info,\n Landmark,\n Layers,\n Leaf,\n Lightbulb,\n ListChecks,\n type LucideIcon,\n Mail,\n Map,\n MapPin,\n Moon,\n Mountain,\n Music,\n Package,\n Paperclip,\n Pencil,\n Percent,\n Phone,\n Plane,\n Receipt,\n Rocket,\n Route,\n Send,\n Shield,\n Ship,\n Sparkles,\n Star,\n Sun,\n Tag,\n Ticket,\n Train,\n TrendingUp,\n Truck,\n Upload,\n User,\n Users,\n Utensils,\n Wallet,\n Zap,\n} from 'lucide-react';\nimport * as TabsPrimitive from '@radix-ui/react-tabs';\nimport type { RunField } from '../core';\nimport { FieldRenderer, ResultField, type FieldEnv } from '../react';\nimport { focusOutlineClass, linkTextClass, selectedFillStrongClass } from '../react/role-tokens';\nimport { fieldControlClass } from '../react/field-styles';\nimport { enumLabeler, useFieldPresentation } from '../react/field-presentation';\nimport { ResultRoot } from '../react/result-location';\nimport {\n Select as SelectRoot,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '../react/ui/select';\nimport { ToggleGroup, ToggleGroupItem } from '../react/ui/toggle-group';\nimport { cn } from '../react/utils';\nimport { baseCatalog, type ICON_NAMES, type METRIC_FORMATS } from './components';\nimport { textOf, withDeclaredProps } from './declared-props';\nimport { formatDay, formatNumber } from './format';\nimport { shareAmount } from './share-amount';\nimport * as shadcn from './ui/shadcn';\nimport { inputFieldAtPath, RESULT_ROOT, resultFieldAtPath, segmentsUnder } from './paths';\n\n/**\n * The registry: what each catalog entry RENDERS as.\n *\n * The shadcn subset binds the package's own implementations. The custom\n * components are implemented here over this package's controls and vendored\n * primitives - the vocabulary of an app (Split, Tabs, Steps, Icon, Segmented,\n * NumberInput), the bound equivalents of what a model most wants to inline\n * (DataTable, Metric), and the two escape hatches the design rests on:\n *\n * - `MthdsField` renders ONE input through `FieldRenderer`, two-way at the\n * path the spec names. It is the arm for the kinds the catalog cannot\n * enter, and it is always available for a scalar the model would rather\n * not style.\n * - `MthdsResult` renders ONE result subtree through `ResultField`, reading\n * state at the path the spec names.\n *\n * Both resolve the path against the DESCRIPTOR, through `DescriptorProvider`,\n * which is what keeps rule 1: the spec names a path and nothing more, and the\n * kernel is handed the `RunField` the host already holds. A spec never\n * restates what a field is.\n */\n\nexport interface DescriptorScope {\n /** The input page's top-level fields, for `/inputs/...` paths. */\n inputs?: readonly RunField[];\n /** The result page's descriptor, for `/result/...` paths. */\n result?: RunField;\n /** What the host injects into the controls: upload, disabled, resolver. */\n env?: FieldEnv;\n /** Prefix for the DOM ids `MthdsField` mints; two pages on one screen need two. */\n idPrefix?: string;\n}\n\nconst DescriptorContext = React.createContext<DescriptorScope>({});\n\n/** The scope the nearest `DescriptorProvider` set - for a renderer defined outside this file. */\nexport function useDescriptorScope(): DescriptorScope {\n return React.useContext(DescriptorContext);\n}\n\nexport function DescriptorProvider({\n scope,\n children,\n}: {\n scope: DescriptorScope;\n children: React.ReactNode;\n}) {\n return <DescriptorContext.Provider value={scope}>{children}</DescriptorContext.Provider>;\n}\n\nfunction Unresolved({ path, side }: { path: unknown; side: 'input' | 'result' }) {\n return (\n <p\n role=\"alert\"\n className=\"rounded-md border border-destructive/50 px-2.5 py-1.5 text-[12px] text-destructive\"\n >\n {side === 'input' ? 'No input' : 'No result'} at{' '}\n <span className=\"font-mono\">\n {typeof path === 'string' ? path : (JSON.stringify(path) ?? String(path))}\n </span>\n </p>\n );\n}\n\n/**\n * A pointer segment as one piece of a DOM id, and back.\n *\n * The id is built by joining the pointer's segments with `-`, so a segment that\n * contains a `-` of its own would make the join ambiguous: `/inputs/a-b` and\n * `/inputs/a/b` mint the same id, and the inverse below then hands a host the\n * wrong path to write an uploaded file to - plausible-looking, silent, and\n * wrong. This used to rest on a comment asserting that a field's name carries\n * no `-`; nothing here can enforce that, because a name reaches the descriptor\n * from a JSON Schema property. So the separator is escaped instead.\n *\n * `_` goes first, which is what makes the pass unambiguous: every `_` in the\n * output that is not one this function wrote has already been doubled, so the\n * single left-to-right decode below cannot mistake one for the other. Names\n * without `_`, `-` or `~` - which is every name in practice - pass through\n * untouched, so the ids this mints are the ids it always minted.\n */\nfunction encodeSegment(segment: string): string {\n return segment.replace(/_/g, '_u').replace(/-/g, '_d').replace(/~/g, '_t');\n}\n\nfunction decodeSegment(segment: string): string {\n return segment.replace(/_([udt])/g, (_match, code: string) =>\n code === 'u' ? '_' : code === 'd' ? '-' : '~',\n );\n}\n\n/**\n * Exported for the round-trip test only, not from the entry's index: the pair\n * is only correct together, so a test that could see just one half of it would\n * be no guard at all.\n */\nexport function domIdFor(prefix: string | undefined, path: string): string {\n return `${prefix ?? 'gen'}${path.split('/').map(encodeSegment).join('-')}`;\n}\n\n/**\n * The inverse of `domIdFor`, for a host's upload seam: the kernel reports a\n * drop by the DOM id of the field it landed on, which for a nested one is the\n * hatch's id with the child's name or index joined by `.` (the kernel's own\n * composition, `FieldRenderer` through `ObjectField` and `ListField`), and\n * the host writes the file at the store path that id was minted from. Kept\n * beside `domIdFor` so the two cannot drift, and exact for any name by\n * construction rather than by assumption.\n */\nexport function pathFromDomId(prefix: string | undefined, id: string): string | undefined {\n const head = prefix ?? 'gen';\n if (!id.startsWith(head)) return undefined;\n const [own = '', ...children] = id.slice(head.length).split('.');\n if (!own.startsWith('-')) return undefined;\n const path = own.split('-').map(decodeSegment).join('/');\n return `${path}${children.map((child) => `/${child}`).join('')}`;\n}\n\n/**\n * The path a hatch or a `Picture` resolves: absolute as written, or, inside a\n * repeat, the item's field name joined onto the current item's base path. A\n * relative path outside any repeat resolves to nothing, and the element says\n * so. The one resolver every renderer that names a path literally reads\n * through, so two cannot read one path two ways. The empty path is the item\n * itself only where `emptyIsItem` says so, which is a `Picture`'s reading\n * alone, as the fit check reads it (`layout-fits.ts`): for a hatch it stays\n * the item's base and a trailing separator, which no field has, so the\n * renderer and the check refuse it together.\n */\nexport function useAbsolutePath(path: unknown, emptyIsItem = false): string | undefined {\n const repeat = useRepeatScope();\n // The checks hold such a `path` to a literal text; a layout rendered past\n // them may hand anything here, which resolves to nothing - never read as\n // some other path, as a number written out would be inside a repeat.\n if (typeof path !== 'string') return undefined;\n if (path.startsWith('/')) return path;\n if (!repeat) return undefined;\n // Raw, not `joinPath`: the same reason `absoluteHatchPath` gives - a relative\n // hatch path may name several segments, so its `/` are separators already.\n return path === '' && emptyIsItem ? repeat.basePath : `${repeat.basePath}/${path}`;\n}\n\n// ─── The escape hatches ──────────────────────────────────────────────────────\n\n/** A label without a trailing \"(optional)\", which the kernel's own badge says. */\nfunction withoutOptionalMark(label: string): string {\n return label.replace(/\\s*\\(optional\\)\\s*$/i, '') || label;\n}\n\nfunction MthdsField({\n props,\n}: BaseComponentProps<{ path: string; label?: string | null; hint?: string | null }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const found = scope.inputs && path ? inputFieldAtPath(scope.inputs, path) : undefined;\n // The page's own words for the label and the line under it, where it wrote them.\n const field = React.useMemo(\n () =>\n found && (props.label || props.hint)\n ? {\n ...found,\n // The control marks an optional field itself, so a label that\n // says \"(optional)\" too would say it twice.\n title: props.label ? withoutOptionalMark(props.label) : found.title,\n description: props.hint || found.description,\n }\n : found,\n [found, props.label, props.hint],\n );\n const value = useStateValue<unknown>(path);\n const { set } = useStateStore();\n const onChange = React.useCallback((next: unknown) => set(path, next), [set, path]);\n if (!field) return <Unresolved path={props.path} side=\"input\" />;\n return (\n <FieldRenderer\n field={field}\n value={value}\n onChange={onChange}\n id={domIdFor(scope.idPrefix, path)}\n env={scope.env}\n />\n );\n}\n\nfunction MthdsResult({ props }: BaseComponentProps<{ path: string; hideLabel?: boolean | null }>) {\n const scope = React.useContext(DescriptorContext);\n const path = useAbsolutePath(props.path) ?? '';\n const field = scope.result && path ? resultFieldAtPath(scope.result, path) : undefined;\n const value = useStateValue<unknown>(path);\n if (!field || !scope.result) return <Unresolved path={props.path} side=\"result\" />;\n // The subtree's place in the whole result, so a file inside it saves under\n // the name the whole-result download gives it. Left to itself, `ResultField`\n // would root the location at its own node's name, and every entry of a\n // repeat would save as `image.png`.\n const place = [scope.result.name, ...(segmentsUnder(RESULT_ROOT, path) ?? [])];\n return (\n <ResultRoot baseName={scope.result.name} path={place}>\n <ResultField field={field} value={value} hideLabel={props.hideLabel ?? false} />\n </ResultRoot>\n );\n}\n\n// ─── A Select with an accessible name ────────────────────────────────────────\n\ninterface SelectProps {\n label: string;\n name: string;\n options: string[];\n placeholder?: string | null;\n value?: string | null;\n checks?: { type: string; message: string; args?: Record<string, unknown> }[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction AccessibleSelect({ props, bindings, emit }: BaseComponentProps<SelectProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'change';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate, focusRef } = useCheckedField(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const id = shadcn.useControlId(props.name);\n const errorId = `${id}-error`;\n const error = errors[0];\n const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <SelectRoot\n value={value}\n onValueChange={(next) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n emit('change');\n }}\n >\n {/* As tall as the layer's text input beside it, and the 44 pixels a\n finger needs. */}\n <SelectTrigger\n id={id}\n ref={focusRef}\n aria-invalid={error ? true : undefined}\n aria-describedby={error ? errorId : undefined}\n className=\"h-11 w-full\"\n >\n <SelectValue placeholder={props.placeholder ?? 'Select...'} />\n </SelectTrigger>\n <SelectContent>\n {/* Written exactly as listed. The primitive throws on an empty value,\n and the fallback that used to stand in for one wrote a value the\n descriptor's enum never listed; the definition refuses an empty\n option now, upstream of every renderer. */}\n {(props.options ?? []).map((option, index) => (\n <SelectItem key={`${index}-${option}`} value={option}>\n {labelOf(option)}\n </SelectItem>\n ))}\n </SelectContent>\n </SelectRoot>\n {error ? (\n <p id={errorId} className=\"text-sm text-destructive\">\n {error}\n </p>\n ) : null}\n </div>\n );\n}\n\n// ─── The bound equivalents of what a model most wants to inline ──────────────\n\nfunction valueAt(row: unknown, relativePath: string): unknown {\n let current: unknown = row;\n for (const segment of relativePath.split('/').filter((part) => part.length > 0)) {\n if (typeof current !== 'object' || current === null) return undefined;\n current = (current as Record<string, unknown>)[segment];\n }\n return current;\n}\n\n/** A cell shows a number as it is: grouped, with the places it has, never padded. */\nfunction formatCell(value: unknown): string {\n if (value === null || value === undefined || value === '') return '—';\n if (typeof value === 'boolean') return value ? 'yes' : 'no';\n if (typeof value === 'number') return formatNumber(value);\n if (typeof value === 'string') return value;\n if (Array.isArray(value)) return value.map(formatCell).join(', ');\n return JSON.stringify(value);\n}\n\n/**\n * A cell in a column the layout stated a format for. `date` writes the day\n * the value names (`formatDay`), never a stringified structure. `text` writes\n * a number in full and ungrouped, never in exponent notation, since a column the layout calls text holds a\n * year, a reference or a code, and \"2,024\" is damage there. `number` groups a\n * number, and a text that writes one out too, as a payload's decimal may\n * arrive. With no format, a number is grouped and the rest written as it is.\n */\nfunction formatColumnCell(value: unknown, format: string | null | undefined): string {\n if (format === 'date') return formatDay(value, 'short') ?? formatCell(value);\n if (format === 'text' && typeof value === 'number') return formatNumber(value, 'plain');\n if (format === 'number') {\n const amount = shareAmount(value);\n if (Number.isFinite(amount)) return formatNumber(amount);\n }\n return formatCell(value);\n}\n\ninterface DataTableProps {\n rows: unknown;\n columns: { path: string; label: string; format?: 'text' | 'date' | 'number' | null }[];\n caption?: string | null;\n}\n\nfunction DataTable({ props }: BaseComponentProps<DataTableProps>) {\n const rows = Array.isArray(props.rows) ? props.rows : [];\n const columns = props.columns ?? [];\n return (\n <div className=\"overflow-x-auto rounded-md border border-border\">\n <table className=\"w-full min-w-full border-collapse text-[13px]\">\n {props.caption ? (\n <caption className=\"px-2.5 py-1.5 text-start text-[12px] text-muted-foreground\">\n {props.caption}\n </caption>\n ) : null}\n <thead>\n <tr className=\"border-b border-border bg-muted\">\n {columns.map((column) => (\n <th\n key={column.path}\n scope=\"col\"\n className=\"whitespace-nowrap px-2.5 py-1.5 text-start font-semibold text-foreground\"\n >\n {column.label}\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {rows.map((row, index) => (\n <tr key={index} className=\"border-b border-border/60 last:border-b-0\">\n {columns.map((column) => (\n <td key={column.path} className=\"px-2.5 py-1.5 align-top text-foreground\">\n {formatColumnCell(valueAt(row, column.path), column.format)}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n );\n}\n\ntype MetricFormat = (typeof METRIC_FORMATS)[number];\n\ninterface MetricProps {\n label: string;\n value: unknown;\n unit?: string | null;\n format?: MetricFormat | null;\n}\n\nfunction Metric({ props }: BaseComponentProps<MetricProps>) {\n const value = props.value;\n // Anything but a number as it writes out, so a structure, which writes out\n // as nothing, shows the dash an absent value shows.\n const text =\n typeof value === 'number' ? formatNumber(value, props.format ?? 'plain') : textOf(value) || '—';\n return (\n <div className=\"flex flex-col gap-0.5\">\n <span className=\"text-[11px] font-medium uppercase tracking-wider text-muted-foreground\">\n {props.label}\n </span>\n <span className=\"text-2xl font-semibold tabular-nums text-foreground\">\n {text}\n {props.unit ? (\n <span className=\"ml-1 text-sm font-normal text-muted-foreground\">{props.unit}</span>\n ) : null}\n </span>\n </div>\n );\n}\n\n// ─── The vocabulary of an app ────────────────────────────────────────────────\n\ntype SplitRatio = '1:1' | '1:2' | '2:1';\n\nconst SPLIT_COLUMNS: Record<SplitRatio, string> = {\n '1:1': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]',\n '1:2': 'sm:grid-cols-[minmax(0,1fr)_minmax(0,2fr)]',\n '2:1': 'sm:grid-cols-[minmax(0,2fr)_minmax(0,1fr)]',\n};\n\nconst SPLIT_GAP: Record<'md' | 'lg' | 'xl', string> = { md: 'gap-4', lg: 'gap-6', xl: 'gap-8' };\n\n/** Two columns from two children, stacking under the `sm` breakpoint. */\nfunction Split({\n props,\n children,\n}: BaseComponentProps<{ ratio?: SplitRatio | null; gap?: 'md' | 'lg' | 'xl' | null }>) {\n return (\n <div\n className={cn(\n 'grid grid-cols-1 items-start',\n shadcn.pick(SPLIT_COLUMNS, props.ratio, '1:2'),\n shadcn.pick(SPLIT_GAP, props.gap, 'lg'),\n )}\n >\n {children}\n </div>\n );\n}\n\ninterface TabsProps {\n tabs: { label: string; value: string }[];\n}\n\n/**\n * Tabs whose panels follow the active tab - the reason shadcn's is not in the\n * catalog. The nth child is the nth tab's panel; the active tab is local\n * state, so a spec never touches /state for it. An inactive panel stays\n * mounted and hidden, so the checks of the fields in it still hold the run:\n * unmounted, as Radix does by default, they left the page's record, and a\n * run pressed from another tab started past a field that refused it. A run\n * refused by a field in a hidden panel opens that panel's tab to show it.\n */\nfunction Tabs({ props, children }: BaseComponentProps<TabsProps>) {\n const tabs = props.tabs ?? [];\n const panels = React.Children.toArray(children);\n // Each tab is told apart by its position, which is unique where a layout's\n // values need not be: two tabs written with one value would otherwise be\n // one tab to Radix, opening both panels, and one key to React. The open\n // tab is remembered by its value, and which of the tabs sharing it, so it\n // stays open when a patched layout inserts or removes a tab before it; one\n // the layout no longer has gives way to the first.\n const [chosen, setChosen] = React.useState<{ value: string; occurrence: number } | null>(null);\n const open = chosen ? openIndex(tabs, chosen) : 0;\n const value = String(open);\n const choose = (next: string) => {\n const index = Number(next);\n const tab = tabs[index];\n if (!tab) return;\n const occurrence = tabs.slice(0, index).filter((t) => t.value === tab.value).length;\n setChosen({ value: tab.value, occurrence });\n };\n return (\n <TabsPrimitive.Root value={value} onValueChange={choose} className=\"w-full\">\n {/* Below `sm` each tab grows to the 44 by 44 pixels a finger needs,\n however short its label, and the list around it with it, wrapping\n onto a second row rather than pushing the page sideways. */}\n <TabsPrimitive.List className=\"inline-flex h-10 items-center justify-start rounded-md bg-muted p-1 text-muted-foreground max-sm:h-auto max-sm:flex-wrap\">\n {tabs.map((tab, index) => (\n <TabsPrimitive.Trigger\n key={index}\n value={String(index)}\n className=\"inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm max-sm:min-h-11 max-sm:min-w-11\"\n >\n {tab.label}\n </TabsPrimitive.Trigger>\n ))}\n </TabsPrimitive.List>\n {tabs.map((_tab, index) => (\n <TabsPrimitive.Content\n key={index}\n value={String(index)}\n forceMount\n hidden={index !== open}\n className=\"mt-4 focus-visible:outline-hidden\"\n >\n <RevealPanel open={() => choose(String(index))}>{panels[index] ?? null}</RevealPanel>\n </TabsPrimitive.Content>\n ))}\n </TabsPrimitive.Root>\n );\n}\n\n/** The position of the `occurrence`th tab carrying `value`, or the first tab's when none does. */\nfunction openIndex(\n tabs: readonly { value: string }[],\n { value, occurrence }: { value: string; occurrence: number },\n): number {\n let seen = 0;\n for (const [index, tab] of tabs.entries()) {\n if (tab.value !== value) continue;\n if (seen === occurrence) return index;\n seen += 1;\n }\n return 0;\n}\n\n// As tall as the layer's own `Button`, which is the 44 pixels a finger needs.\n// Its focus is the kernel's one outline, whose offset is a gap the panel\n// shows through rather than a ring offset painted in the page colour.\nconst BUTTON_BASE = cn(\n 'inline-flex min-h-11 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors disabled:pointer-events-none disabled:opacity-50',\n focusOutlineClass,\n);\nconst PRIMARY_BUTTON = cn(BUTTON_BASE, 'bg-primary text-primary-foreground hover:bg-primary/90');\nconst SECONDARY_BUTTON = cn(\n BUTTON_BASE,\n 'border border-border bg-background text-foreground hover:bg-accent hover:text-accent-foreground',\n);\n\ninterface StepsProps {\n steps: string[];\n nextLabel?: string | null;\n backLabel?: string | null;\n}\n\n/**\n * A journey: a numbered indicator, one panel at a time, and its own Back and\n * Next. The nth child is the nth step's panel; the spec's one Button sits\n * inside the last one, which is why Next disappears there. The current step\n * is local state. A hidden panel stays mounted, so its inputs keep their\n * values in the store and their checks hold the run - a step hides from the\n * eye, never from the run - and a run refused by a field on another step goes\n * back to that step to show it.\n */\nfunction Steps({ props, children }: BaseComponentProps<StepsProps>) {\n const steps = props.steps ?? [];\n const panels = React.Children.toArray(children);\n const [chosen, setIndex] = React.useState(0);\n const last = steps.length - 1;\n // A layout patched or swapped mid-way may have fewer steps than the one\n // reached: the last there is shows rather than none, and Back and Next\n // move from the step shown, not from the one reached.\n const index = Math.max(0, Math.min(chosen, last));\n return (\n <div className=\"flex flex-col gap-5\">\n <ol className=\"flex flex-wrap items-center gap-x-5 gap-y-2\">\n {steps.map((label, position) => (\n <li\n key={`${position}-${label}`}\n aria-current={position === index ? 'step' : undefined}\n className={cn(\n 'flex items-center gap-2 text-sm',\n position === index ? 'font-medium text-foreground' : 'text-muted-foreground',\n )}\n >\n <span\n className={cn(\n 'flex h-6 w-6 items-center justify-center rounded-full text-[12px] font-semibold tabular-nums',\n position < index\n ? cn(selectedFillStrongClass, linkTextClass)\n : position === index\n ? 'bg-primary text-primary-foreground'\n : 'bg-muted text-muted-foreground',\n )}\n >\n {position + 1}\n </span>\n {label}\n </li>\n ))}\n </ol>\n {steps.map((_step, position) => (\n <div key={position} hidden={position !== index}>\n <RevealPanel open={() => setIndex(position)}>{panels[position] ?? null}</RevealPanel>\n </div>\n ))}\n {index > 0 || index < last ? (\n <div className=\"flex items-center justify-between gap-3\">\n {index > 0 ? (\n <button\n type=\"button\"\n data-testid=\"steps-back\"\n onClick={() => setIndex(Math.max(0, index - 1))}\n className={SECONDARY_BUTTON}\n >\n {props.backLabel ?? 'Back'}\n </button>\n ) : (\n <span />\n )}\n {index < last ? (\n <button\n type=\"button\"\n data-testid=\"steps-next\"\n onClick={() => setIndex(Math.min(last, index + 1))}\n className={PRIMARY_BUTTON}\n >\n {props.nextLabel ?? 'Next'}\n </button>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n}\n\ntype IconName = (typeof ICON_NAMES)[number];\n\n/** The closed list the catalog names, each bound to its lucide component. */\nconst ICONS: Record<IconName, LucideIcon> = {\n Sparkles,\n Rocket,\n Compass,\n Map,\n MapPin,\n Route,\n Plane,\n Train,\n Car,\n Ship,\n Hotel,\n Home,\n Building2,\n Landmark,\n Globe,\n Mountain,\n Leaf,\n Sun,\n Moon,\n Calendar,\n Clock,\n Hourglass,\n Users,\n User,\n Baby,\n Accessibility,\n Heart,\n Star,\n Utensils,\n Coffee,\n Music,\n Camera,\n Image,\n Ticket,\n Gift,\n Wallet,\n Banknote,\n Coins,\n Receipt,\n Percent,\n Hash,\n TrendingUp,\n BarChart3,\n FileText,\n Upload,\n Paperclip,\n Mail,\n Phone,\n Tag,\n Layers,\n ListChecks,\n CheckCircle2,\n AlertCircle,\n Info,\n Shield,\n Flag,\n Bookmark,\n Briefcase,\n Package,\n Truck,\n Lightbulb,\n Zap,\n Pencil,\n Send,\n};\n\n/** Decorative: hidden from assistive technology, because it carries no text. */\nfunction Icon({ props }: BaseComponentProps<{ name: IconName; size?: 'sm' | 'md' | 'lg' | null }>) {\n const Glyph = ICONS[props.name];\n if (!Glyph) return null;\n const size = props.size === 'lg' ? 'h-7 w-7' : props.size === 'sm' ? 'h-4 w-4' : 'h-5 w-5';\n return <Glyph aria-hidden=\"true\" className={cn(size, 'shrink-0 text-muted-foreground')} />;\n}\n\ninterface SegmentedProps {\n label: string;\n name: string;\n options: string[];\n value?: string | null;\n}\n\n/**\n * A choice as a row of pills, over the package's own toggle group. The group\n * is named by its visible label; each pill is a button whose text is its\n * option as the kernel words it (`enumLabeler`), while the value it writes\n * stays the option. Deselecting is ignored, as shadcn's toggle group does, so\n * the bound path never holds an empty string.\n */\nfunction Segmented({ props, bindings, emit }: BaseComponentProps<SegmentedProps>) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const labelId = shadcn.useControlId(props.name);\n const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());\n return (\n <div className=\"space-y-2\">\n <span id={labelId} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </span>\n <ToggleGroup\n type=\"single\"\n aria-labelledby={labelId}\n value={value}\n onValueChange={(next: string) => {\n if (!next) return;\n setValue(next);\n emit('change');\n }}\n className=\"flex-wrap justify-start gap-1.5\"\n >\n {(props.options ?? []).map((option, index) => (\n <ToggleGroupItem\n // A layout may name one option twice, so the option alone is no key.\n key={`${index}-${option}`}\n value={option}\n variant=\"outline\"\n size=\"sm\"\n // Below `sm`, the 44 pixels a finger needs, as the kernel's own\n // choice control grows there.\n className=\"rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground max-sm:h-11 max-sm:min-w-11\"\n >\n {labelOf(option)}\n </ToggleGroupItem>\n ))}\n </ToggleGroup>\n </div>\n );\n}\n\ninterface NumberInputProps {\n label: string;\n name: string;\n value?: number | null;\n placeholder?: string | null;\n unit?: string | null;\n min?: number | null;\n max?: number | null;\n step?: number | null;\n}\n\n/**\n * A figure that writes a NUMBER to state - the gap Checkpoint 3 recorded\n * against shadcn's `Input type=\"number\"`, which writes the DOM's string. An\n * emptied field writes `undefined`, which the kernel's readiness reads as\n * absent, exactly as its own number control does.\n */\nfunction NumberInput({ props, bindings, emit }: BaseComponentProps<NumberInputProps>) {\n const [boundValue, setBoundValue] = useBoundProp<number | undefined>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState<number | undefined>(undefined);\n const isBound = Boolean(bindings?.value);\n const value = isBound ? boundValue : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const id = shadcn.useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className=\"block text-sm leading-none font-medium\">\n {props.label}\n </label>\n <div className=\"flex items-center gap-2\">\n <input\n id={id}\n type=\"number\"\n inputMode=\"decimal\"\n value={typeof value === 'number' ? value : ''}\n min={props.min ?? undefined}\n max={props.max ?? undefined}\n step={props.step ?? 'any'}\n placeholder={props.placeholder ?? undefined}\n onChange={(event) => {\n const raw = event.target.value;\n setValue(raw === '' ? undefined : Number(raw));\n emit('change');\n }}\n // As tall as the layer's text input and the kernel's number field,\n // which is the 44 pixels a finger needs.\n className={cn(\n fieldControlClass,\n 'h-11 px-3 tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none',\n )}\n />\n {props.unit ? <span className=\"text-sm text-muted-foreground\">{props.unit}</span> : null}\n </div>\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/**\n * Each renderer is MOUNTED rather than called: they are React components that\n * use hooks, and a render function calling hooks itself would run them inside\n * the registry's wrapper and break the moment the wrapper re-ordered them.\n */\nconst components: Components<typeof baseCatalog> = {\n Card: (ctx) => <shadcn.Card {...ctx} />,\n // A vertical Stack stretches its children unless the spec says otherwise:\n // hugging the content is the one layout a result page never wants, since a\n // table or a grid inside it would stop short of the page's width.\n Stack: (ctx) => <shadcn.Stack {...ctx} />,\n Grid: (ctx) => <shadcn.Grid {...ctx} />,\n Separator: (ctx) => <shadcn.Separator {...ctx} />,\n Collapsible: (ctx) => <shadcn.Collapsible {...ctx} />,\n Heading: (ctx) => <shadcn.Heading {...ctx} />,\n Text: (ctx) => <shadcn.Text {...ctx} />,\n Badge: (ctx) => <shadcn.Badge {...ctx} />,\n Alert: (ctx) => <shadcn.Alert {...ctx} />,\n Progress: (ctx) => <shadcn.Progress {...ctx} />,\n Avatar: (ctx) => <shadcn.Avatar {...ctx} />,\n Input: (ctx) => <shadcn.Input {...ctx} />,\n Textarea: (ctx) => <shadcn.Textarea {...ctx} />,\n // A plain label beside a trigger leaves the trigger with no accessible name,\n // which axe reports as a button without one (`a11y` runs at error). This one\n // is the package's own vendored select under a label that names the trigger.\n Select: (ctx) => <AccessibleSelect {...ctx} />,\n Radio: (ctx) => <shadcn.Radio {...ctx} />,\n Checkbox: (ctx) => <shadcn.Checkbox {...ctx} />,\n Switch: (ctx) => <shadcn.Switch {...ctx} />,\n Button: (ctx) => <shadcn.Button {...ctx} />,\n Split: (ctx) => <Split {...ctx} />,\n Tabs: (ctx) => <Tabs {...ctx} />,\n Steps: (ctx) => <Steps {...ctx} />,\n Icon: (ctx) => <Icon {...ctx} />,\n Segmented: (ctx) => <Segmented {...ctx} />,\n NumberInput: (ctx) => <NumberInput {...ctx} />,\n // Ours are React components (they use hooks), so each is MOUNTED rather than\n // called: a render function that called hooks itself would run them inside\n // the registry's wrapper and break the moment the wrapper re-ordered them.\n MthdsField: (ctx) => <MthdsField {...ctx} />,\n MthdsResult: (ctx) => <MthdsResult {...ctx} />,\n DataTable: (ctx) => <DataTable {...ctx} />,\n Metric: (ctx) => <Metric {...ctx} />,\n};\n\n/** The renderers, for the registry over the catalog that extends this vocabulary. */\n/**\n * Each renderer is handed its props held to the base catalog's definitions\n * (`declared-props.ts`), so an expression that resolved to the wrong type -\n * scratch state holding a structure where a title belongs - draws nothing\n * rather than throwing past both checks.\n */\nexport const generativeRenderers = withDeclaredProps(\n baseCatalog.data.components as Record<string, { props?: unknown }>,\n components,\n // A hatch resolves its `path` as written, relative inside a repeat, so a\n // refused one reaches it as refused rather than written out as text.\n { MthdsField: ['path'], MthdsResult: ['path'] },\n);\n","'use client';\n\nimport * as React from 'react';\nimport { type BaseComponentProps, useStateValue } from '@json-render/react';\nimport { ArrowRight, Clock } from 'lucide-react';\nimport { readImageContent, viewableUrl } from '../core/native-content';\nimport { waitingFields } from '../core/readiness';\nimport { useFieldStrings, useResolveUrl } from '../react';\nimport { fieldLabel, useFieldPresentation } from '../react/field-presentation';\nimport { focusOutlineClass, linkTextClass } from '../react/role-tokens';\nimport {\n actionShadowClass,\n headingClass,\n panelFlatShadowClass,\n panelSurfaceClass,\n} from '../react/style-tokens';\nimport { cn } from '../react/utils';\nimport { textOf, withDeclaredProps } from './declared-props';\nimport { frameComponents } from './frame-definitions';\nimport { shareAmount } from './share-amount';\nimport { useFrameHost } from './frame-host';\nimport { formatAmount, formatDay } from './format';\nimport { INPUTS_ROOT, inputFieldAtPath, joinPath } from './paths';\nimport { type PlacedInput, usePlacedInputs } from './placed-inputs';\nimport { useAbsolutePath, useDescriptorScope } from './registry';\n\n/**\n * The renderers of the two frames' vocabularies (`frame-definitions.ts`): the\n * composer of a host's compose-then-result app and its result page.\n *\n * Each reads the theme contract's tokens and the style tokens only, as the\n * product chrome does (`product-registry.tsx`): a title reads the style's\n * heading face, weight and tracking, a raised surface is the style's panel and\n * marks itself `data-style-panel`, the composer's run button wears the\n * style's call-to-action shadow. So a team's style reaches a designed page as\n * it reaches the kernel's controls, and a host that sets no style token sees\n * the look these components had before they read one.\n *\n * What the host knows and no descriptor says - how long a run takes, the\n * result's actions - comes in through `FrameHostProvider`; a picture the run\n * produced goes through the host's resolver and the kernel's URL gate, as\n * every file the result view shows does.\n */\n\nconst RADIUS = 'rounded-[calc(var(--radius,0.5rem)*1.5)]';\n\n// ─── Composer ────────────────────────────────────────────────────────────────\n\ninterface ComposerProps {\n headline: string;\n lede?: string | null;\n runLabel: string;\n columns?: '1' | '2' | null;\n notes?: string[] | null;\n}\n\n/** How many of the inputs a run waits for the action row names before it counts the rest. */\nconst NAMED_WAITING = 3;\n\n/**\n * What the run waits for, in the action row's words: the fields to fill for\n * the inputs the kernel's readiness counts as missing (`waitingFields`), or\n * nothing once none is. Inside a structure those are the members it refuses,\n * since a composer commonly spreads one structure's members over the page,\n * and \"fill in Request\" would name a field nobody can see. They are named and\n * ordered as the page words and orders them (`placedInputs`), and as the\n * descriptor labels and orders them where the page does not. The designer\n * method tells a model writing a composer that the host's action row says\n * this, so the page itself does not.\n */\nfunction useRunWaitsFor(): string | undefined {\n const { inputs } = useDescriptorScope();\n const values = useStateValue<Record<string, unknown>>(INPUTS_ROOT);\n const placed = usePlacedInputs();\n const presentation = useFieldPresentation();\n const strings = useFieldStrings();\n const waiting = waitingFields(inputs ?? [], isRecord(values) ? values : undefined)\n .map(({ field, path }) => {\n const at = joinPath(INPUTS_ROOT, ...path);\n return { field, path, on: placed.get(at), rank: rankOf(placed, at) };\n })\n // A stable sort: what the page does not place keeps the descriptor's order, after the rest.\n .sort((a, b) => a.rank - b.rank);\n if (waiting.length === 0) return undefined;\n const labelAt = (path: readonly string[]): string | undefined => {\n const field = inputFieldAtPath(inputs ?? [], joinPath(INPUTS_ROOT, ...path));\n if (!field) return undefined;\n return (\n placed.get(joinPath(INPUTS_ROOT, ...path))?.label ??\n fieldLabel(field.title, field.name, presentation)\n );\n };\n const named = waiting.slice(0, NAMED_WAITING);\n const labels = named.map(\n ({ field, on }) => on?.label ?? fieldLabel(field.title, field.name, presentation),\n );\n // One concept used for two inputs gives two members one label: each is then\n // said with the structure it belongs to, \"Name (Sender)\".\n const names = labels.map((label, index) => {\n const parent = named[index]!.path.slice(0, -1);\n const shared = labels.filter((other) => other === label).length > 1;\n const around = shared && parent.length > 0 ? labelAt(parent) : undefined;\n return around ? `${label} (${around})` : label;\n });\n return strings.runWaitsFor(names, waiting.length - names.length);\n}\n\n/**\n * Where the page shows a field: where it places the field itself, else where\n * it places the nearest structure around it whole (an `MthdsField` over the\n * structure draws its members), else where it places the first of the\n * field's own members, and after everything the page places otherwise.\n */\nfunction rankOf(placed: ReadonlyMap<string, PlacedInput>, path: string): number {\n const own = placed.get(path);\n if (own) return own.order;\n for (\n let at = path.lastIndexOf('/');\n at > INPUTS_ROOT.length;\n at = path.lastIndexOf('/', at - 1)\n ) {\n const around = placed.get(path.slice(0, at));\n if (around) return around.order;\n }\n let first = Number.MAX_SAFE_INTEGER;\n for (const [inside, { order }] of placed) {\n if (inside.startsWith(`${path}/`)) first = Math.min(first, order);\n }\n return first;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction Composer({ props, children, emit }: BaseComponentProps<ComposerProps>) {\n const host = useFrameHost();\n // The host's `env.disabled` holds the run while one is going, as it holds\n // the plain form's submit: a second press would be a second billed run.\n const busy = useDescriptorScope().env?.disabled ?? false;\n const waitsFor = useRunWaitsFor();\n const waitsForId = React.useId();\n const two = props.columns === '2';\n return (\n <div\n className={cn('mx-auto flex w-full flex-col gap-7', two ? 'max-w-[980px]' : 'max-w-[740px]')}\n >\n <div>\n <h1\n className={cn(\n 'text-[32px] leading-[1.1] text-balance text-foreground sm:text-[38px] sm:leading-[1.08]',\n headingClass(700, true),\n )}\n >\n {props.headline}\n </h1>\n {props.lede ? (\n <p className=\"mt-3.5 max-w-[62ch] text-[17px] leading-relaxed text-muted-foreground\">\n {props.lede}\n </p>\n ) : null}\n </div>\n {/* The composer's panel is the host's panel, so with no style it is the\n host's hairline with no shadow, as `quiet` asks, and a style's\n shadow floats it. */}\n <div\n data-style-panel=\"\"\n className={cn(RADIUS, panelSurfaceClass, panelFlatShadowClass, 'p-7 max-sm:p-5')}\n >\n {/* Two columns flow the groups down one column and on into the next,\n balanced, rather than a grid's rows: a row as tall as its tallest\n group left a hole beside every long list. A group may continue into\n the next column between its fields, but never inside a field (a\n list is one, so its last row never opens the next column alone)\n and never right after a title.\n The space between groups is a top margin, which a column break\n truncates. */}\n <div\n className={cn(\n 'grid gap-8',\n two &&\n 'md:block md:columns-2 md:gap-x-10 md:[&>*+*]:mt-8 md:[&>*>h2]:break-after-avoid md:[&>*>*:not(h2)]:break-inside-avoid',\n )}\n >\n {children}\n </div>\n <div className=\"sticky bottom-0 z-[2] -mx-7 -mb-7 mt-7 flex items-center justify-between gap-4 rounded-b-[calc(var(--radius,0.5rem)*1.5)] border-t border-border [background-color:var(--panel-fill,var(--card,hsl(0_0%_100%)))] px-7 pt-[18px] pb-7 max-sm:-mx-5 max-sm:-mb-5 max-sm:flex-col-reverse max-sm:items-stretch max-sm:px-5 max-sm:pb-5\">\n {/* What the run waits for, which describes the button, and how long\n a run takes. The run is not held by it: a press runs the page's\n checks and the host's gate, which say what is wrong where. */}\n <div className=\"flex min-w-0 flex-col gap-1 text-sm text-muted-foreground max-sm:items-center max-sm:text-center\">\n {waitsFor ? <p id={waitsForId}>{waitsFor}</p> : null}\n {host.eta ? (\n <span className=\"inline-flex items-center gap-2\">\n <Clock className=\"size-4\" aria-hidden=\"true\" /> {host.eta}\n </span>\n ) : null}\n </div>\n <button\n type=\"button\"\n disabled={busy}\n aria-describedby={waitsFor ? waitsForId : undefined}\n onClick={() => emit('press')}\n className={cn(\n 'inline-flex min-h-11 items-center justify-center gap-2 rounded-[var(--radius,0.5rem)] bg-primary px-[22px] text-[15px] font-semibold text-primary-foreground transition-all hover:bg-primary/90',\n actionShadowClass,\n focusOutlineClass,\n 'disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-primary',\n )}\n >\n {props.runLabel} <ArrowRight className=\"size-4\" aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n {props.notes && props.notes.length > 0 ? (\n <ul className=\"grid gap-x-8 gap-y-2.5 px-1 sm:grid-cols-2\">\n {props.notes.map((note, index) => (\n <li key={index} className=\"flex items-start gap-2.5 text-sm text-muted-foreground\">\n <span aria-hidden=\"true\" className={linkTextClass}>\n ✓\n </span>\n <span className=\"min-w-0\">{note}</span>\n </li>\n ))}\n </ul>\n ) : null}\n </div>\n );\n}\n\nfunction FieldGroup({ props, children }: BaseComponentProps<{ title?: string | null }>) {\n return (\n <section className=\"flex min-w-0 flex-col gap-5\">\n {props.title ? (\n <h2 className={cn('text-[17px] leading-snug text-foreground', headingClass(600))}>\n {props.title}\n </h2>\n ) : null}\n {children}\n </section>\n );\n}\n\n// ─── Result: ResultHeader ────────────────────────────────────────────────────\n\ninterface ResultHeaderProps {\n eyebrow?: string | null;\n title: string;\n subtitle?: string | null;\n}\n\nfunction ResultHeader({ props }: BaseComponentProps<ResultHeaderProps>) {\n const host = useFrameHost();\n return (\n <div className=\"flex items-start justify-between gap-6 max-sm:flex-col\">\n <div className=\"min-w-0\">\n {props.eyebrow ? (\n <p className={cn('mb-1.5 text-[13px] font-semibold', linkTextClass)}>{props.eyebrow}</p>\n ) : null}\n <h1\n className={cn(\n 'text-[28px] leading-[1.12] text-balance text-foreground sm:text-[32px]',\n headingClass(700, true),\n )}\n >\n {props.title}\n </h1>\n {props.subtitle ? (\n <p className=\"mt-2 text-[15px] text-muted-foreground\">{props.subtitle}</p>\n ) : null}\n </div>\n {host.actions && host.actions.length > 0 && host.onAction ? (\n <div className=\"flex shrink-0 gap-2\">\n {host.actions.map((label, i) => (\n <button\n key={`${i}-${label}`}\n type=\"button\"\n onClick={() => host.onAction?.(label)}\n className={cn(\n 'inline-flex min-h-11 items-center rounded-[var(--radius,0.5rem)] px-4 text-sm font-semibold sm:min-h-9',\n focusOutlineClass,\n i === 0\n ? 'bg-primary text-primary-foreground'\n : 'border border-border bg-background text-foreground',\n )}\n >\n {label}\n </button>\n ))}\n </div>\n ) : null}\n </div>\n );\n}\n\n// ─── Result: ProportionBar ───────────────────────────────────────────────────\n\ninterface ProportionBarProps {\n label: string;\n /** Read as written (`asWritten` below): a number, a numeric text, or what the layout check let by. */\n total?: unknown;\n of?: unknown;\n unit?: string | null;\n items?: unknown[] | null;\n labelKey: string;\n valueKey: string;\n}\n\n/**\n * A segment's share of the accent, mixed into the muted fill: an even ramp\n * from the full accent down to a quarter of it, in the order the parts come,\n * so two segments are never a near shade of each other the way a fixed\n * cycle's neighbours (85 after 100, 60 after 70) were.\n */\nfunction segmentMix(index: number, count: number): number {\n return count <= 1 ? 100 : Math.round(100 - (index * 75) / (count - 1));\n}\n\nfunction segmentColor(index: number, count: number): string {\n return `color-mix(in oklab, var(--link, var(--primary, hsl(240 5.9% 10%))) ${segmentMix(index, count)}%, var(--muted, hsl(240 4.8% 95.9%)))`;\n}\n\n/**\n * A total or a ceiling as the layout wrote it: `null` when it wrote none, the\n * number a number or a text writes out (a payload's decimal may arrive as\n * text, and the prop's schema would otherwise drop a `$state` read of it to\n * nothing), and `undefined` for anything else, which is shown as no figure.\n * `null` is none whoever wrote it: the layout, or a run that left the path a\n * `$state` read names empty, which the renderer cannot tell apart, since it\n * sees the value resolved. Only an unreadable total is never read as the\n * parts' sum: a total of 2,400 shown as the 100 its parts add up to was a\n * wrong figure in large type.\n */\nfunction statedAmount(raw: unknown): number | null | undefined {\n if (raw === null || raw === undefined) return null;\n const amount = shareAmount(raw);\n return Number.isFinite(amount) ? amount : undefined;\n}\n\nfunction ProportionBar({ props }: BaseComponentProps<ProportionBarProps>) {\n // A part is a structure with a label member and a number member; an entry\n // that is not one - a null, a word, an expression that resolved to nothing -\n // is no part of the share, and is skipped rather than read into.\n const rows = (Array.isArray(props.items) ? props.items : []).filter(\n (row): row is Record<string, unknown> =>\n typeof row === 'object' && row !== null && !Array.isArray(row),\n );\n const parts = rows\n .map((row) => ({\n label: textOf(row[props.labelKey]),\n value: shareAmount(row[props.valueKey]),\n }))\n .filter((p) => Number.isFinite(p.value) && p.value > 0);\n const sum = parts.reduce((s, p) => s + p.value, 0);\n const stated = statedAmount(props.total);\n const total = stated === null ? sum : stated;\n const ceiling = statedAmount(props.of) ?? undefined;\n const scale = Math.max(sum, total ?? 0, ceiling ?? 0) || 1;\n const cap = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);\n return (\n <div\n data-style-panel=\"\"\n className={cn(\n RADIUS,\n panelSurfaceClass,\n panelFlatShadowClass,\n 'flex flex-col gap-3.5 px-6 py-5',\n )}\n >\n <div className=\"flex flex-wrap items-baseline gap-x-2.5\">\n <span className=\"text-[15px] text-muted-foreground\">{props.label}</span>\n {total !== undefined ? (\n <strong className=\"text-2xl font-semibold tabular-nums text-foreground\">\n {formatAmount(total, props.unit)}\n </strong>\n ) : null}\n {ceiling !== undefined ? (\n <span className=\"text-[15px] text-muted-foreground\">\n of {formatAmount(ceiling, props.unit)}\n </span>\n ) : null}\n </div>\n <div className=\"flex h-2 gap-0.5 overflow-hidden rounded-full bg-muted\" aria-hidden=\"true\">\n {parts.map((p, i) => (\n <span\n key={`${i}-${p.label}`}\n style={{\n width: `${(p.value / scale) * 100}%`,\n background: segmentColor(i, parts.length),\n }}\n />\n ))}\n </div>\n <ul className=\"flex flex-wrap gap-x-5 gap-y-1\">\n {parts.map((p, i) => (\n <li\n key={`${i}-${p.label}`}\n className=\"inline-flex items-center gap-2 text-sm text-muted-foreground\"\n >\n <span\n className=\"size-2 rounded-[2px]\"\n style={{\n background: segmentColor(i, parts.length),\n }}\n aria-hidden=\"true\"\n />\n {cap(p.label)} {formatAmount(p.value, props.unit)}\n </li>\n ))}\n </ul>\n </div>\n );\n}\n\n// ─── Result: Swatches, Picture, Fact, Detail ─────────────────────────────────\n\n/**\n * A colour value a swatch may paint: a hex code, a colour function, or a\n * keyword. Anything else is result text a model wrote, and painting it would\n * let `url(…)` or `image-set(…)` fetch on paint, the channel the prose\n * renderer closes for images; such an entry draws no swatch.\n */\nconst COLOR_VALUE =\n /^(?:#[0-9a-f]{3,8}|(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\\([\\w\\s.,%/+-]*\\)|[a-z]+)$/i;\n\nfunction Swatches({ props }: BaseComponentProps<{ colors: string[] }>) {\n const colors = (props.colors ?? []).filter(\n (c): c is string => typeof c === 'string' && COLOR_VALUE.test(c.trim()),\n );\n return (\n <div className=\"flex flex-wrap gap-2\">\n {colors.map((color, i) => (\n <div key={`${color}-${i}`} className=\"flex flex-col gap-1\">\n <span\n className=\"h-7 w-11 rounded-[3px] border border-border\"\n style={{ backgroundColor: color.trim() }}\n />\n <span className=\"font-mono text-[11px] text-muted-foreground\">{color}</span>\n </div>\n ))}\n </div>\n );\n}\n\nconst ASPECT: Record<string, string> = {\n '16:9': 'aspect-video',\n '4:3': 'aspect-[4/3]',\n '1:1': 'aspect-square',\n};\n\nfunction Picture({\n props,\n}: BaseComponentProps<{ path: string; alt?: string | null; aspect?: string | null }>) {\n // The checks hold `path` to a literal; a layout rendered past them may still\n // hand an expression's value here, which shows no picture, as does a\n // relative path outside any repeat. Neither is read as the empty path,\n // which inside a repeat is the item itself (`useAbsolutePath`).\n const path = useAbsolutePath(props.path, true);\n const value = useStateValue<unknown>(path ?? '');\n const resolve = useResolveUrl();\n // In the result view's order, each through the kernel's gate: the host's\n // resolver on the stored reference, then the file's own public URL, then the\n // reference itself, so a picture shows wherever the result view shows it.\n const content = path === undefined ? undefined : readImageContent(value);\n const src = content\n ? (viewableUrl(resolve?.(content.url)) ??\n viewableUrl(content.publicUrl) ??\n viewableUrl(content.url))\n : undefined;\n const aspect = props.aspect && props.aspect !== 'auto' ? ASPECT[props.aspect] : undefined;\n if (!src) return null;\n return (\n <img\n src={src}\n alt={props.alt ?? content?.caption ?? ''}\n // A result's URL is the result's to choose, so the host page's address\n // is never sent to it, as with every other picture the package draws.\n referrerPolicy=\"no-referrer\"\n className={cn(\n 'block w-full rounded-[var(--radius,0.5rem)] border border-border bg-muted object-cover',\n aspect,\n )}\n />\n );\n}\n\nfunction Fact({\n props,\n}: BaseComponentProps<{ label: string; value?: unknown; detail?: string | null }>) {\n // What the value writes out, so a structure, which writes out as nothing,\n // shows the dash an absent value shows.\n const text = textOf(props.value);\n return (\n <div className=\"flex flex-col gap-1 rounded-[var(--radius,0.5rem)] border border-border bg-background px-4 py-3\">\n <span className=\"text-[13px] text-muted-foreground\">{props.label}</span>\n <span className=\"text-[16px] font-medium text-foreground tabular-nums\">\n {text !== '' ? text : '—'}\n </span>\n {props.detail ? (\n <span className=\"text-[13px] text-muted-foreground\">{props.detail}</span>\n ) : null}\n </div>\n );\n}\n\nfunction Detail({ props }: BaseComponentProps<{ label: string; value?: unknown }>) {\n const text = textOf(props.value);\n if (text === '') return null;\n return (\n // A rule between the rows of a list of details, never under one set in a\n // row: there it read as an underline on every detail but the last.\n <div className=\"grid grid-cols-[minmax(0,8.5rem)_minmax(0,1fr)] gap-3 border-b border-border py-2.5 text-[14px] last:border-b-0 [.flex-row>&]:border-b-0 [.flex-row>&]:grid-cols-[auto_minmax(0,1fr)]\">\n <span className=\"text-muted-foreground\">{props.label}</span>\n <span className=\"text-foreground\">{text}</span>\n </div>\n );\n}\n\ninterface DateTextProps {\n value?: string | null;\n style?: 'long' | 'short' | 'weekday' | null;\n tone?: 'default' | 'muted' | 'accent' | null;\n}\n\nfunction DateText({ props }: BaseComponentProps<DateTextProps>) {\n // A day written as text, its leading day read through the layer's one\n // formatter (`formatDay`) at noon UTC, so no time zone moves it. The prop is\n // a text, so a native date's structure never reaches here: a `native.Date`\n // is delegated to the result view, which reads its structure.\n const day = formatDay(props.value, props.style ?? 'long');\n if (day === undefined) return null;\n const tone =\n props.tone === 'accent'\n ? cn('text-[13px] font-semibold', linkTextClass)\n : props.tone === 'muted'\n ? 'text-sm text-muted-foreground'\n : 'text-[15px] text-foreground';\n return <span className={cn('block', tone)}>{day}</span>;\n}\n\ninterface TextListProps {\n items?: unknown;\n marker?: 'bullet' | 'number' | 'check' | null;\n}\n\nfunction TextList({ props }: BaseComponentProps<TextListProps>) {\n const items = Array.isArray(props.items)\n ? props.items.filter((x) => typeof x === 'string' && x.trim())\n : [];\n if (items.length === 0) return null;\n const marker = props.marker ?? 'bullet';\n // Only numbered items are ordered; bullets and checks are a plain list.\n const List = marker === 'number' ? 'ol' : 'ul';\n return (\n <List className=\"flex flex-col gap-2.5\">\n {items.map((text, index) => (\n <li key={index} className=\"flex gap-3 text-[15px] leading-relaxed text-foreground\">\n <span\n aria-hidden=\"true\"\n className={cn(\n 'mt-[0.55em] shrink-0',\n marker === 'bullet' &&\n 'size-1.5 rounded-full bg-[color:var(--link,var(--primary,hsl(240_5.9%_10%)))]',\n marker === 'number' &&\n cn('mt-0 min-w-5 text-sm font-semibold tabular-nums', linkTextClass),\n marker === 'check' && cn('mt-0', linkTextClass),\n )}\n >\n {marker === 'number' ? `${index + 1}.` : marker === 'check' ? '✓' : null}\n </span>\n <span className=\"min-w-0\">{String(text)}</span>\n </li>\n ))}\n </List>\n );\n}\n\n/**\n * Each renderer is handed its props held to the frame's definitions\n * (`declared-props.ts`), as the base catalog's are.\n */\nexport const frameRenderers = withDeclaredProps(\n frameComponents,\n {\n TextList: (ctx: BaseComponentProps<TextListProps>) => <TextList {...ctx} />,\n DateText: (ctx: BaseComponentProps<DateTextProps>) => <DateText {...ctx} />,\n Composer: (ctx: BaseComponentProps<ComposerProps>) => <Composer {...ctx} />,\n FieldGroup: (ctx: BaseComponentProps<{ title?: string | null }>) => <FieldGroup {...ctx} />,\n ResultHeader: (ctx: BaseComponentProps<ResultHeaderProps>) => <ResultHeader {...ctx} />,\n ProportionBar: (ctx: BaseComponentProps<ProportionBarProps>) => <ProportionBar {...ctx} />,\n Swatches: (ctx: BaseComponentProps<{ colors: string[] }>) => <Swatches {...ctx} />,\n Picture: (\n ctx: BaseComponentProps<{ path: string; alt?: string | null; aspect?: string | null }>,\n ) => <Picture {...ctx} />,\n Fact: (ctx: BaseComponentProps<{ label: string; value?: unknown; detail?: string | null }>) => (\n <Fact {...ctx} />\n ),\n Detail: (ctx: BaseComponentProps<{ label: string; value?: unknown }>) => <Detail {...ctx} />,\n },\n // A refused `path` reaches the renderer as refused: its nearest value, the\n // empty text, is the item itself inside a repeat. A share's total and its\n // ceiling are read as written too: a decimal a payload carries as text is\n // a number the bar can draw, where its nearest value, nothing, would put\n // the parts' sum in its place.\n { Picture: ['path'], ProportionBar: ['total', 'of'] },\n);\n","'use client';\n\nimport * as React from 'react';\n\n/**\n * What the page paints under the work column, when there is anything to paint.\n *\n * No spec names a result: the layout a model writes is the INPUT page, and the\n * result has shapes of its own. So the page leaves a slot instead, and the host\n * fills it with whatever the run yielded - the kernel's own viewer over the\n * output descriptor, a line while the run is in flight, a failure. The slot is\n * a React node and nothing more: this entry knows how to place it in the page's\n * grammar and nothing about how a run is started, followed or delivered.\n *\n * A host that provides nothing gets a page with no result section at all, which\n * is what an input page is before its first run.\n */\n\nexport interface ResultSlot {\n /** What to paint. Nothing is painted at all while this is absent or `null`. */\n content: React.ReactNode;\n /** The heading above it. \"Result\" unless the host names it. */\n title?: string;\n}\n\nconst ResultSlotContext = React.createContext<ResultSlot | null>(null);\n\nexport function ResultSlotProvider({\n slot,\n children,\n}: {\n slot: ResultSlot | null;\n children: React.ReactNode;\n}) {\n return <ResultSlotContext.Provider value={slot}>{children}</ResultSlotContext.Provider>;\n}\n\n/** The slot the nearest page provides, or `null` on a page with no result yet. */\nexport function useResultSlot(): ResultSlot | null {\n return React.useContext(ResultSlotContext);\n}\n","'use client';\n\nimport * as React from 'react';\nimport { type BaseComponentProps, defineRegistry, useBoundProp } from '@json-render/react';\nimport { useCheckedField } from './checked-fields';\nimport { focusOutlineClass, linkTextClass } from '../react/role-tokens';\nimport {\n actionShadowClass,\n headingClass,\n panelRaisedShadowClass,\n panelSurfaceClass,\n} from '../react/style-tokens';\nimport { fieldControlClass } from '../react/field-styles';\nimport { cn } from '../react/utils';\nimport { BrandBar, CONTAINER } from './brand-bar';\nimport { catalog } from './catalog';\nimport { textOf, withDeclaredProps } from './declared-props';\nimport { frameRenderers } from './frame-registry';\nimport { generativeRenderers, useDescriptorScope } from './registry';\nimport { useResultSlot } from './result-slot';\nimport { useControlId } from './ui/shadcn';\n\n/**\n * What the brand catalog's components RENDER as - the product page's chrome,\n * over the same tokens the kernel's controls read, and over NOTHING else: no\n * literal colour, no literal radius, no literal typeface. The rail's panel is\n * the page's style panel (`--panel-*`), falling back to `bg-card` on\n * `border-border` and a large shadow; a title reads the style's heading face,\n * weight and tracking; a hairline is `border-border`; the call to action wears\n * the style's `--action-shadow`, falling back to a glow of the button colour\n * (`--primary`) composed with `color-mix()` (see `react/style-tokens`); the corners are\n * `--radius` and its multiples, a tag is `font-mono`, the logo is the\n * manifest's pair. The running text names no face at all: it inherits the\n * page's, which a brand's compiled stylesheet sets on its scope from\n * `--font-sans` (docs/brand.md). That is what lets one set of components\n * render any brand the `./brand` entry compiles - and what makes anything the\n * tokens cannot state absent from the page by construction.\n *\n * The layer's renderers are reused as they are; two of shadcn's are replaced\n * (`Input`, `Textarea`) so that every text field on the page is drawn on the\n * kernel's own control surface (`fieldControlClass`) and reads as one family\n * with the dates, the lists and the upload the kernel renders itself.\n *\n * Nothing here reads a schema - a brand component takes copy and bound values,\n * and that is all.\n */\n\n/** The kernel's app-presentation label, so a brand field and a kernel field read alike. */\nconst LABEL = 'block text-[13.5px] leading-none font-medium text-foreground';\n\n// ─── The page's chrome ───────────────────────────────────────────────────────\n\ninterface AppBarProps {\n app: string;\n links?: string[] | null;\n tag?: string | null;\n}\n\nfunction AppBar({ props }: BaseComponentProps<AppBarProps>) {\n return <BrandBar app={props.app} links={props.links} tag={props.tag} />;\n}\n\ninterface HeroProps {\n headline: string;\n lede?: string | null;\n eyebrow?: string | null;\n}\n\nfunction Hero({ props }: BaseComponentProps<HeroProps>) {\n return (\n <section className=\"pt-12 pb-10 sm:pt-14 sm:pb-12\">\n {props.eyebrow ? (\n <p\n className={cn('mb-4 text-[11px] font-medium tracking-[0.15em] uppercase', linkTextClass)}\n >\n {props.eyebrow}\n </p>\n ) : null}\n <h1\n className={cn(\n 'max-w-2xl text-4xl text-foreground sm:text-[44px] sm:leading-[1.15]',\n headingClass(700, true),\n )}\n >\n {props.headline}\n </h1>\n {props.lede ? (\n <p className=\"mt-4 max-w-2xl text-[17px] leading-relaxed text-muted-foreground\">\n {props.lede}\n </p>\n ) : null}\n </section>\n );\n}\n\nfunction Workspace({ props, children }: BaseComponentProps<{ rail?: 'right' | 'left' | null }>) {\n const [work, rail] = React.Children.toArray(children);\n const railLeft = props.rail === 'left';\n return (\n <div\n className={cn(\n CONTAINER,\n 'grid grid-cols-1 gap-10 pb-16 lg:gap-14',\n railLeft ? 'lg:grid-cols-[360px_minmax(0,1fr)]' : 'lg:grid-cols-[minmax(0,1fr)_360px]',\n )}\n >\n <div className={cn('min-w-0', railLeft && 'lg:order-2')}>\n {work}\n <ResultPanel />\n </div>\n <aside\n className={cn(\n 'lg:sticky lg:top-6 lg:self-start lg:pt-12 sm:lg:pt-14',\n railLeft && 'lg:order-1',\n )}\n >\n {rail}\n </aside>\n </div>\n );\n}\n\n/**\n * What the host paints under the work column, in the page's own grammar and\n * in the container it gives everything else. No spec names it - no layout was\n * written for a result - so the page leaves the slot and places what it is\n * given; an input page before its first run is given nothing and shows none of\n * this.\n */\nfunction ResultPanel() {\n const slot = useResultSlot();\n if (!slot?.content) return null;\n return (\n <section className=\"border-t border-border py-9\" data-testid=\"result-panel\" aria-live=\"polite\">\n <h2 className={cn('mb-6 text-xl text-foreground', headingClass(600, true))}>\n {slot.title ?? 'Result'}\n </h2>\n {slot.content}\n </section>\n );\n}\n\ninterface SectionProps {\n number?: string | null;\n title: string;\n lede?: string | null;\n}\n\nfunction Section({ props, children }: BaseComponentProps<SectionProps>) {\n return (\n <section className=\"border-t border-border py-9 first:border-t-0 first:pt-0\">\n <div className=\"mb-6\">\n <div className=\"flex items-baseline gap-3\">\n {props.number ? (\n <span className={cn('font-mono text-[12px]', linkTextClass)}>{props.number}</span>\n ) : null}\n <h2 className={cn('text-xl text-foreground', headingClass(600, true))}>{props.title}</h2>\n </div>\n {props.lede ? <p className=\"mt-1.5 text-sm text-muted-foreground\">{props.lede}</p> : null}\n </div>\n {/* The rules put a concern's inputs flat inside the Section, so the\n Section spaces them: the gap the hand-written spec's Stack gave its. */}\n <div className=\"flex flex-col gap-4\">{children}</div>\n </section>\n );\n}\n\nfunction Rail({ props, children }: BaseComponentProps<{ title: string }>) {\n return (\n // An arbitrary value reads the token directly, so it does NOT go through\n // the `@theme inline` mapping and does not inherit its fallback - it has to\n // carry its own, or a host that defines no tokens loses the declaration\n // outright. See src/styles/tailwind-entry.css.\n <div\n data-style-panel=\"\"\n className={cn(\n 'rounded-[calc(var(--radius,0.5rem)*1.5)] p-7 text-card-foreground',\n panelSurfaceClass,\n panelRaisedShadowClass,\n )}\n >\n <h2 className=\"text-[11px] font-semibold tracking-[0.15em] text-muted-foreground uppercase\">\n {props.title}\n </h2>\n <div className=\"mt-4 flex flex-col\">{children}</div>\n </div>\n );\n}\n\ninterface SummaryRowProps {\n label: string;\n value?: unknown;\n detail?: unknown;\n separator?: string | null;\n placeholder?: string | null;\n}\n\nfunction SummaryRow({ props }: BaseComponentProps<SummaryRowProps>) {\n // Each half as it writes out, so one that is a structure, which writes out\n // as nothing, leaves no separator dangling.\n const text = [props.value, props.detail]\n .map(textOf)\n .filter((half) => half !== '')\n .join(props.separator ?? ' ');\n return (\n <div className=\"flex items-baseline justify-between gap-4 border-b border-border/60 py-3 first:pt-0 last:border-b-0\">\n <span className=\"shrink-0 text-[13px] text-muted-foreground\">{props.label}</span>\n {text ? (\n <span className=\"text-right text-[13px] font-medium text-foreground\">{text}</span>\n ) : (\n <span className=\"text-[13px] text-muted-foreground/50\">{props.placeholder ?? '—'}</span>\n )}\n </div>\n );\n}\n\nfunction Cta({ props, emit }: BaseComponentProps<{ label: string; hint?: string | null }>) {\n // The host's `env.disabled` holds the run while one is going, as it holds\n // the plain form's submit: a second press would be a second billed run.\n const busy = useDescriptorScope().env?.disabled ?? false;\n return (\n <div className=\"mt-6\">\n <button\n type=\"button\"\n disabled={busy}\n onClick={() => emit('press')}\n className={cn(\n 'inline-flex h-12 w-full items-center justify-center rounded-lg bg-primary px-6 text-sm font-semibold text-primary-foreground transition-all hover:bg-primary/90',\n // The page's call-to-action shadow, or the glow in the button colour\n // it had. Focus is an outline, which no shadow a style sets can\n // replace or hide.\n actionShadowClass,\n focusOutlineClass,\n 'disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-primary',\n )}\n >\n {props.label}\n </button>\n {props.hint ? (\n <p className=\"mt-3 text-center text-[12px] leading-relaxed text-muted-foreground\">\n {props.hint}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction Footer({ props }: BaseComponentProps<{ text: string; tag?: string | null }>) {\n return (\n <footer className=\"border-t border-border\">\n <div\n className={cn(\n CONTAINER,\n // Wraps, and the tag may break anywhere: a pipe's code is one long\n // word, and at phone width an unbreakable one widened the document\n // past the viewport.\n 'flex flex-wrap items-center justify-between gap-x-6 gap-y-2 py-6 text-[12px] text-muted-foreground',\n )}\n >\n <span>{props.text}</span>\n {props.tag ? (\n <span className=\"min-w-0 font-mono text-[11px] tracking-wider break-all text-muted-foreground/70 uppercase\">\n {props.tag}\n </span>\n ) : null}\n </div>\n </footer>\n );\n}\n\n// ─── Text fields on the kernel's own surface ─────────────────────────────────\n\ninterface Check {\n type: string;\n message: string;\n args?: Record<string, unknown>;\n}\n\ninterface TextFieldProps {\n label: string;\n name: string;\n placeholder?: string | null;\n value?: string | null;\n checks?: Check[] | null;\n validateOn?: 'change' | 'blur' | 'submit' | null;\n}\n\nfunction useTextField(\n props: TextFieldProps,\n bindings: BaseComponentProps<TextFieldProps>['bindings'],\n) {\n const [boundValue, setBoundValue] = useBoundProp<string>(\n props.value ?? undefined,\n bindings?.value,\n );\n const [localValue, setLocalValue] = React.useState('');\n const isBound = Boolean(bindings?.value);\n const value = isBound ? (boundValue ?? '') : localValue;\n const setValue = isBound ? setBoundValue : setLocalValue;\n const validateOn = props.validateOn ?? 'blur';\n const hasValidation = Boolean(bindings?.value && props.checks?.length);\n const { errors, validate, focusRef } = useCheckedField(\n bindings?.value ?? '',\n hasValidation ? { checks: props.checks ?? [], validateOn } : undefined,\n );\n const onChange = (next: string) => {\n setValue(next);\n if (hasValidation && validateOn === 'change') validate();\n };\n const onBlur = () => {\n if (hasValidation && validateOn === 'blur') validate();\n };\n return { value, errors, onChange, onBlur, focusRef };\n}\n\nfunction BrandInput({\n props,\n bindings,\n emit,\n}: BaseComponentProps<\n TextFieldProps & { type?: 'text' | 'email' | 'password' | 'number' | null }\n>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <input\n id={id}\n name={props.name}\n type={props.type ?? 'text'}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n ref={field.focusRef}\n aria-invalid={field.errors.length > 0 || undefined}\n aria-describedby={field.errors[0] ? `${id}-error` : undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={() => {\n field.onBlur();\n emit('blur');\n }}\n onFocus={() => emit('focus')}\n onKeyDown={(event) => {\n if (event.key === 'Enter') emit('submit');\n }}\n className={cn(fieldControlClass, 'h-11 px-3.5')}\n />\n {field.errors[0] ? (\n <p id={`${id}-error`} role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction BrandTextarea({\n props,\n bindings,\n}: BaseComponentProps<TextFieldProps & { rows?: number | null }>) {\n const field = useTextField(props, bindings);\n const id = useControlId(props.name);\n return (\n <div className=\"space-y-2\">\n <label htmlFor={id} className={LABEL}>\n {props.label}\n </label>\n <textarea\n id={id}\n name={props.name}\n rows={props.rows ?? 3}\n value={field.value}\n placeholder={props.placeholder ?? ''}\n ref={field.focusRef}\n aria-invalid={field.errors.length > 0 || undefined}\n aria-describedby={field.errors[0] ? `${id}-error` : undefined}\n onChange={(event) => field.onChange(event.target.value)}\n onBlur={field.onBlur}\n className={cn(fieldControlClass, 'px-3.5 py-2.5 leading-relaxed')}\n />\n {field.errors[0] ? (\n <p id={`${id}-error`} role=\"alert\" className=\"text-[11px] text-destructive\">\n {field.errors[0]}\n </p>\n ) : null}\n </div>\n );\n}\n\n// ─── The registry ────────────────────────────────────────────────────────────\n\n/** What `defineRegistry` takes for this catalog. */\ntype RegistryOptions = Parameters<typeof defineRegistry<typeof catalog>>[1];\n\n/**\n * The registry over the product catalog: components only. `run` is supplied\n * by `GenerativePage`, which hands it to `JSONUIProvider` as a handler closing\n * over the host's `onRun`, or by a host's own provider; json-render's type\n * asks for an `actions` entry because the catalog declares one, but only the\n * `handlers` factory this destructure discards would ever read it, so the\n * entry is stated absent rather than filled with a no-op a reader would take\n * for the handler.\n *\n * Its `AppBar` reads the brand, so the page it renders in needs one:\n * `GenerativePage`'s `brand` prop, or a `BrandProvider` above the tree.\n */\nexport const { registry: generativeRegistry } = defineRegistry(catalog, {\n components: {\n ...generativeRenderers,\n // Held to their definitions as the base and frame renderers are\n // (`declared-props.ts`).\n ...withDeclaredProps(catalog.data.components as Record<string, { props?: unknown }>, {\n Input: (ctx: Parameters<typeof BrandInput>[0]) => <BrandInput {...ctx} />,\n Textarea: (ctx: Parameters<typeof BrandTextarea>[0]) => <BrandTextarea {...ctx} />,\n AppBar: (ctx: Parameters<typeof AppBar>[0]) => <AppBar {...ctx} />,\n Hero: (ctx: Parameters<typeof Hero>[0]) => <Hero {...ctx} />,\n Workspace: (ctx: Parameters<typeof Workspace>[0]) => <Workspace {...ctx} />,\n Section: (ctx: Parameters<typeof Section>[0]) => <Section {...ctx} />,\n Rail: (ctx: Parameters<typeof Rail>[0]) => <Rail {...ctx} />,\n SummaryRow: (ctx: Parameters<typeof SummaryRow>[0]) => <SummaryRow {...ctx} />,\n Cta: (ctx: Parameters<typeof Cta>[0]) => <Cta {...ctx} />,\n Footer: (ctx: Parameters<typeof Footer>[0]) => <Footer {...ctx} />,\n }),\n ...frameRenderers,\n },\n} as RegistryOptions);\n","'use client';\n\nimport * as React from 'react';\nimport type { Spec, StateModel, StateStore } from '@json-render/core';\nimport {\n JSONUIProvider,\n Renderer,\n useOptionalValidation,\n type ValidationContextValue,\n} from '@json-render/react';\nimport { BrandProvider } from './brand-context';\nimport { CHECKED_FIELD_FUNCTIONS, CheckedFields, CheckedFieldsContext } from './checked-fields';\nimport {\n ReportingContext,\n RootBoundary,\n reportingRegistry,\n type ElementErrorHandler,\n type ReportedRenderers,\n} from './element-errors';\nimport type { BrandManifest } from '../brand/manifest';\nimport { PlacedInputsProvider } from './placed-inputs';\nimport { generativeRegistry } from './product-registry';\nimport { DescriptorProvider, type DescriptorScope } from './registry';\nimport { isThenable } from '../react/utils';\n\n/** What a page renders through: this entry's registry unless a host brings its own. */\nexport type PageRegistry = React.ComponentProps<typeof Renderer>['registry'];\n\nexport interface GenerativePageProps {\n /** The layout to render; `null` while a stream has produced nothing yet. */\n spec: Spec | null;\n /** The state the layout binds to. The host owns it; the page reads and writes it. */\n store: StateStore;\n /** The descriptor the escape hatches resolve paths against. */\n scope: DescriptorScope;\n /**\n * What `run` does. Receives the state at the moment the call to action was\n * pressed. Return the run's promise and a press while it is pending starts\n * nothing. Not called while a field's own checks (its `checks` prop) fail:\n * the press shows each failing field its message instead.\n */\n onRun?: (state: StateModel) => void | Promise<unknown>;\n /** Whether a stream is still arriving. */\n loading?: boolean;\n /** A registry over a catalog that extends this entry's, when a host has one. */\n registry?: PageRegistry;\n /**\n * The brand the product chrome renders: the app bar's logo pair and name,\n * the web font. Required by this entry's own registry, whose `AppBar` reads\n * it - without one the bar throws, json-render's element boundary drops it\n * from the page, and the console names the cure. A host registry with no\n * brand components may omit it.\n */\n brand?: BrandManifest;\n /**\n * Called once for each element that throws while rendering, with the error\n * and the element's component type. json-render drops such an element from\n * the page and catches its throw in a boundary of its own, so a boundary\n * around the page never fires; this is how a host hears of it, and falls\n * back to its plain view if it wants the whole page to. The element renders\n * nothing in its place either way, and draws again once what it renders\n * from changes. Not called while `loading`: what still fails when the stream\n * ends is reported then. Without it, the error is logged as json-render logs\n * it, and the root's goes on to the host's own boundary around the page.\n */\n onElementError?: ElementErrorHandler;\n}\n\n/**\n * One generative page: providers, registry and renderer wired together.\n *\n * The store is CONTROLLED - the host creates it, seeds it (`seedInputs`) and\n * reads it back to start the run - so what the page writes is exactly what the\n * kernel's readiness is computed from, and generation is nowhere in the\n * request path: a layout is a data file, and this renders it.\n */\nexport function GenerativePage({\n spec,\n store,\n scope,\n onRun,\n loading,\n registry = generativeRegistry,\n brand,\n onElementError,\n}: GenerativePageProps) {\n // The scope reaches every control through context, so a fresh object on each\n // render re-renders every field on the page - and a host naturally writes it\n // as a literal beside the store it just read. Memoised on its members, so an\n // inline `scope={{ inputs: fields, env }}` costs a keystroke nothing. Rebuilt\n // from the members it names rather than returning `scope` itself, so no\n // member this list leaves out can be frozen at its first value: a required\n // member added to `DescriptorScope` is a type error here, and an optional one\n // is at least legible as absent from the literal.\n const { inputs, result, env, idPrefix } = scope;\n const stableScope = React.useMemo<DescriptorScope>(\n () => ({ inputs, result, env, idPrefix }),\n [inputs, result, env, idPrefix],\n );\n // json-render's `ActionProvider` reads `handlers` ONCE, into a `useState`,\n // and never looks at the prop again - so a handler object rebuilt on a new\n // `onRun` or `store` was rebuilt for nobody, and Run kept calling the\n // callback and reading the store from the first render. A host writes\n // `onRun` as an inline closure over its own state as naturally as it writes\n // the scope literal above, and every one of those closures after the first\n // went unused. So the handler is created once and reads the latest pair\n // through a ref, which is refreshed after each commit; the handler only ever\n // fires from a click, which is after the commit that installed the values.\n const latest = React.useRef({ onRun, store });\n React.useEffect(() => {\n latest.current = { onRun, store };\n });\n // Every renderer is wrapped in a reporting boundary, once per type and\n // renderer, so no element remounts on a new callback, on a host that starts\n // or stops passing one, or on a registry object rebuilt with the same\n // renderers; without a callback the boundary throws the error on, and the\n // page renders exactly as json-render does. The callback is read through a\n // ref at the error, refreshed in an insertion effect, which runs before the\n // layout phase a boundary reports in, so an element that fails in the same\n // commit as a new callback reports to that one.\n const report = React.useRef(onElementError);\n React.useInsertionEffect(() => {\n report.current = onElementError;\n });\n const [made] = React.useState<ReportedRenderers>(() => new Map());\n const pageRegistry = React.useMemo(\n () => reportingRegistry(registry, report, made),\n [registry, made],\n );\n // json-render resolves an element's props before its renderer runs, so a\n // throw there is caught by the boundary of the element above - and the root\n // has none. Its own boundary is given another try when the layout or the\n // root's resolved props change, judged by their content once the page is\n // not loading: a host that parses its spec inline hands a new object at\n // every render, and one whose report sets its state would otherwise retry,\n // throw and report until React gave up. The content is read only while the\n // root has failed, so a streamed layout is not written out whole at every\n // patch.\n const rootType = spec?.elements?.[spec.root]?.type ?? 'root';\n const reporting = onElementError !== undefined;\n // The page's checks, read at the press that runs it (below): json-render's\n // validation, which runs a field's checks and shows its message, told by\n // the page's own record of the checked fields mounted now which checks\n // each path carries.\n const validation = React.useRef<ValidationContextValue | null>(null);\n const [checkedFields] = React.useState(() => new CheckedFields());\n\n // One run at a time. The run button is held by the host's `env.disabled`,\n // which arrives on a later render: a host that sets it after an await (or\n // never) left a second press inside that wait free to start a second\n // billed run. The guard is held until what `onRun` returns settles - at\n // once for an `onRun` that returns nothing, where the host's own state\n // covers the run - and then one task longer: json-render applies the\n // binding's `onSuccess` or `onError` chain after the handler, in the same\n // task, so a guard released as `onRun` settled let a run chained under the\n // run that just failed start a second billed run. The catalog check refuses\n // such a chain; this holds a layout rendered past it to one run per press.\n const running = React.useRef(false);\n const [handlers] = React.useState(() => {\n const release = () => {\n setTimeout(() => {\n running.current = false;\n }, 0);\n };\n return {\n run: () => {\n if (running.current) return undefined;\n // A layout's fields may carry checks of their own, which `validateForm`\n // runs and records - and json-render runs the next binding whatever it\n // recorded, so `[validateForm, run]` ran a form its own checks had just\n // refused, and only the host's run gate stood between it and a billed\n // run. A run is started only when every field's checks pass, and\n // running them shows each failing field its message, as\n // `validateForm` does, and takes the person to the first one, its\n // tab, step or section opened. The checks are those of the fields\n // mounted now, as the page's record holds them at the press, so a\n // field hidden or dropped since does not hold the run, whatever\n // json-render's own reading, which lags it by a render, still says.\n const checks = validation.current;\n if (checks && !checkedFields.check(checks)) return undefined;\n running.current = true;\n let pending: unknown;\n try {\n pending = latest.current.onRun?.(latest.current.store.getSnapshot());\n } catch (error) {\n release();\n throw error;\n }\n if (isThenable(pending)) {\n // Any thenable holds the guard, a promise from another realm\n // included, and json-render still receives what the host returned,\n // its rejection included.\n const settled = Promise.resolve(pending);\n settled.then(release, release);\n return settled;\n }\n release();\n return undefined;\n },\n };\n });\n const page = (\n <DescriptorProvider scope={stableScope}>\n <PlacedInputsProvider spec={spec}>\n <JSONUIProvider\n registry={pageRegistry}\n store={store}\n handlers={handlers}\n validationFunctions={CHECKED_FIELD_FUNCTIONS}\n >\n <ReportingContext.Provider value={reporting}>\n <CheckedFieldsContext.Provider value={checkedFields}>\n <ValidationBridge into={validation} fields={checkedFields} />\n <RootBoundary\n type={rootType}\n report={report}\n reporting={reporting}\n loading={loading === true}\n spec={spec}\n >\n <Renderer spec={spec} registry={pageRegistry} loading={loading} />\n </RootBoundary>\n </CheckedFieldsContext.Provider>\n </ReportingContext.Provider>\n </JSONUIProvider>\n </PlacedInputsProvider>\n </DescriptorProvider>\n );\n return brand ? <BrandProvider manifest={brand}>{page}</BrandProvider> : page;\n}\n\n/**\n * Hands the page's validation - the checks its fields registered with\n * json-render, which `validateForm` runs - to the run handler, which is\n * created above the provider that holds it, and to the page's record of its\n * checked fields, which registers them. Refreshed in an insertion effect,\n * before any field's effect enters its checks and before any press can reach\n * the handler.\n */\nfunction ValidationBridge({\n into,\n fields,\n}: {\n into: React.RefObject<ValidationContextValue | null>;\n fields: CheckedFields;\n}) {\n const validation = useOptionalValidation();\n React.useInsertionEffect(() => {\n into.current = validation;\n fields.attach(validation);\n });\n return null;\n}\n\n/** The store's current state, re-rendering on every change. For a receipt beside a page. */\nexport function useStoreSnapshot(store: StateStore): StateModel {\n return React.useSyncExternalStore(\n store.subscribe,\n store.getSnapshot,\n store.getServerSnapshot ?? store.getSnapshot,\n );\n}\n"]}