@burojs/ui-shadcn 0.4.0 → 0.6.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 (131) hide show
  1. package/README.md +22 -5
  2. package/dist/bulk-summary-CwSd6Yjb.cjs +108 -0
  3. package/dist/bulk-summary-CwSd6Yjb.cjs.map +1 -0
  4. package/dist/bulk-summary-GxMDP4bw.js +108 -0
  5. package/dist/bulk-summary-GxMDP4bw.js.map +1 -0
  6. package/dist/button-BxnnE28H.cjs +55 -0
  7. package/dist/button-BxnnE28H.cjs.map +1 -0
  8. package/dist/button-MWVeZaqj.js +44 -0
  9. package/dist/button-MWVeZaqj.js.map +1 -0
  10. package/dist/candidates-gate-Bb70LPAy.js +135 -0
  11. package/dist/candidates-gate-Bb70LPAy.js.map +1 -0
  12. package/dist/candidates-gate-D33jXLHO.cjs +153 -0
  13. package/dist/candidates-gate-D33jXLHO.cjs.map +1 -0
  14. package/dist/candidates-relation-picker-B116Bmqi.js +31 -0
  15. package/dist/candidates-relation-picker-B116Bmqi.js.map +1 -0
  16. package/dist/candidates-relation-picker-Cy0rTxvI.cjs +31 -0
  17. package/dist/candidates-relation-picker-Cy0rTxvI.cjs.map +1 -0
  18. package/dist/check-confirm-dialog--gPFnEeg.cjs +1547 -0
  19. package/dist/check-confirm-dialog--gPFnEeg.cjs.map +1 -0
  20. package/dist/check-confirm-dialog-bRT8lt0d.js +1245 -0
  21. package/dist/check-confirm-dialog-bRT8lt0d.js.map +1 -0
  22. package/dist/dialog-B_rt9S1c.js +63 -0
  23. package/dist/dialog-B_rt9S1c.js.map +1 -0
  24. package/dist/dialog-DRNUq9EA.cjs +112 -0
  25. package/dist/dialog-DRNUq9EA.cjs.map +1 -0
  26. package/dist/filter-builder-Bhn-dhZV.js +1621 -0
  27. package/dist/filter-builder-Bhn-dhZV.js.map +1 -0
  28. package/dist/filter-builder-nXqtM_h4.cjs +1789 -0
  29. package/dist/filter-builder-nXqtM_h4.cjs.map +1 -0
  30. package/dist/flow-runtime-D3avVH0I.cjs +255 -0
  31. package/dist/flow-runtime-D3avVH0I.cjs.map +1 -0
  32. package/dist/flow-runtime-s6lkRPKF.js +252 -0
  33. package/dist/flow-runtime-s6lkRPKF.js.map +1 -0
  34. package/dist/flow-screen-CCvgDI9G.js +704 -0
  35. package/dist/flow-screen-CCvgDI9G.js.map +1 -0
  36. package/dist/flow-screen-Ci_Sik4Y.cjs +708 -0
  37. package/dist/flow-screen-Ci_Sik4Y.cjs.map +1 -0
  38. package/dist/index.cjs +3420 -11986
  39. package/dist/index.cjs.map +1 -1
  40. package/dist/index.d.cts +1843 -2015
  41. package/dist/index.d.ts +1849 -2021
  42. package/dist/index.js +3090 -11675
  43. package/dist/index.js.map +1 -1
  44. package/dist/inline-flow-host-B6FI0ctQ.js +112 -0
  45. package/dist/inline-flow-host-B6FI0ctQ.js.map +1 -0
  46. package/dist/inline-flow-host-DV1et3c6.cjs +112 -0
  47. package/dist/inline-flow-host-DV1et3c6.cjs.map +1 -0
  48. package/dist/input-BI0czGyI.cjs +23 -0
  49. package/dist/input-BI0czGyI.cjs.map +1 -0
  50. package/dist/input-CUPStzZO.js +17 -0
  51. package/dist/input-CUPStzZO.js.map +1 -0
  52. package/dist/label-66W1qbke.js +29 -0
  53. package/dist/label-66W1qbke.js.map +1 -0
  54. package/dist/label-w6JYf2cF.cjs +36 -0
  55. package/dist/label-w6JYf2cF.cjs.map +1 -0
  56. package/dist/markdown/index.cjs +1 -1
  57. package/dist/markdown/index.d.cts +2 -3
  58. package/dist/markdown/index.d.ts +2 -3
  59. package/dist/markdown/index.js +1 -1
  60. package/dist/page-flow-route-hdnULWqd.cjs +277 -0
  61. package/dist/page-flow-route-hdnULWqd.cjs.map +1 -0
  62. package/dist/page-flow-route-i3ZfJ1sd.js +277 -0
  63. package/dist/page-flow-route-i3ZfJ1sd.js.map +1 -0
  64. package/dist/place-node-C5SmIAYU.cjs +8139 -0
  65. package/dist/place-node-C5SmIAYU.cjs.map +1 -0
  66. package/dist/place-node-NraNYKPx.js +7597 -0
  67. package/dist/place-node-NraNYKPx.js.map +1 -0
  68. package/dist/related-list-cards-BWZ9GfOG.js +42 -0
  69. package/dist/related-list-cards-BWZ9GfOG.js.map +1 -0
  70. package/dist/related-list-cards-CFq3meUn.cjs +42 -0
  71. package/dist/related-list-cards-CFq3meUn.cjs.map +1 -0
  72. package/dist/related-list-timeline-CCzl71aA.cjs +142 -0
  73. package/dist/related-list-timeline-CCzl71aA.cjs.map +1 -0
  74. package/dist/related-list-timeline-yrPsjA3F.js +142 -0
  75. package/dist/related-list-timeline-yrPsjA3F.js.map +1 -0
  76. package/dist/related-rows-ea43qhhy.cjs +208 -0
  77. package/dist/related-rows-ea43qhhy.cjs.map +1 -0
  78. package/dist/related-rows-o0_t-Yce.js +185 -0
  79. package/dist/related-rows-o0_t-Yce.js.map +1 -0
  80. package/dist/relation-create-IA40t1hi.cjs +364 -0
  81. package/dist/relation-create-IA40t1hi.cjs.map +1 -0
  82. package/dist/relation-create-h6F9B4C4.js +339 -0
  83. package/dist/relation-create-h6F9B4C4.js.map +1 -0
  84. package/dist/relation-many-picker-C8zFEjwd.cjs +467 -0
  85. package/dist/relation-many-picker-C8zFEjwd.cjs.map +1 -0
  86. package/dist/relation-many-picker-bvkjkv-k.js +466 -0
  87. package/dist/relation-many-picker-bvkjkv-k.js.map +1 -0
  88. package/dist/relation-picker-Z0ZJJ5uS.js +493 -0
  89. package/dist/relation-picker-Z0ZJJ5uS.js.map +1 -0
  90. package/dist/relation-picker-dialog-0IzkjmiA.cjs +304 -0
  91. package/dist/relation-picker-dialog-0IzkjmiA.cjs.map +1 -0
  92. package/dist/relation-picker-dialog-B6nIiJBf.js +303 -0
  93. package/dist/relation-picker-dialog-B6nIiJBf.js.map +1 -0
  94. package/dist/relation-picker-gag0qSR5.cjs +516 -0
  95. package/dist/relation-picker-gag0qSR5.cjs.map +1 -0
  96. package/dist/resource-page-router-3RUf9d1j.js +1588 -0
  97. package/dist/resource-page-router-3RUf9d1j.js.map +1 -0
  98. package/dist/resource-page-router-PXfMW9nh.cjs +1785 -0
  99. package/dist/resource-page-router-PXfMW9nh.cjs.map +1 -0
  100. package/dist/{rich-text-IDFvyvRE.js → rich-text-DFerywgz.js} +7 -4
  101. package/dist/{rich-text-IDFvyvRE.js.map → rich-text-DFerywgz.js.map} +1 -1
  102. package/dist/{rich-text-lndbYqzR.cjs → rich-text-vTyVjDoa.cjs} +25 -22
  103. package/dist/{rich-text-lndbYqzR.cjs.map → rich-text-vTyVjDoa.cjs.map} +1 -1
  104. package/dist/search-access-CPPmfuvy.js +654 -0
  105. package/dist/search-access-CPPmfuvy.js.map +1 -0
  106. package/dist/search-access-Dugvttlg.cjs +791 -0
  107. package/dist/search-access-Dugvttlg.cjs.map +1 -0
  108. package/dist/shell-BPlk8hEa.js +205 -0
  109. package/dist/shell-BPlk8hEa.js.map +1 -0
  110. package/dist/shell-DxhlsPwm.cjs +271 -0
  111. package/dist/shell-DxhlsPwm.cjs.map +1 -0
  112. package/dist/skeleton-U2noefj5.js +13 -0
  113. package/dist/skeleton-U2noefj5.js.map +1 -0
  114. package/dist/skeleton-_1gP7wan.cjs +18 -0
  115. package/dist/skeleton-_1gP7wan.cjs.map +1 -0
  116. package/dist/styles.css +241 -9
  117. package/dist/toaster-C02XbB9r.js +135 -0
  118. package/dist/toaster-C02XbB9r.js.map +1 -0
  119. package/dist/toaster-Cr51X7bz.cjs +195 -0
  120. package/dist/toaster-Cr51X7bz.cjs.map +1 -0
  121. package/dist/use-dialog-filter-state-C--oMAZG.js +87 -0
  122. package/dist/use-dialog-filter-state-C--oMAZG.js.map +1 -0
  123. package/dist/use-dialog-filter-state-Dhe8PcB5.cjs +92 -0
  124. package/dist/use-dialog-filter-state-Dhe8PcB5.cjs.map +1 -0
  125. package/dist/{use-theme-BwPWinB2.cjs → use-theme-DFlpXils.cjs} +12 -1
  126. package/dist/use-theme-DFlpXils.cjs.map +1 -0
  127. package/dist/{use-theme-IHmtrhEt.js → use-theme-dnE3Od3I.js} +7 -2
  128. package/dist/use-theme-dnE3Od3I.js.map +1 -0
  129. package/package.json +16 -14
  130. package/dist/use-theme-BwPWinB2.cjs.map +0 -1
  131. package/dist/use-theme-IHmtrhEt.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-page-router-3RUf9d1j.js","names":[],"sources":["../src/resource-key.ts","../src/layout/build-nav-items.ts","../src/layout/nav-slots.ts","../src/layout/use-nav-routing.ts","../src/layout/nav-chrome-boundary.tsx","../src/layout/nav-chrome.tsx","../src/record/record-state.tsx","../src/flows/page-flow-loader.tsx","../src/list-kit/resource-list-page.tsx","../src/layout/page-host.tsx","../src/resource/form-context.tsx","../src/frames/obligations.tsx","../src/frames/slot-wrapper.tsx","../src/frames/record-frame-host.tsx","../src/record/type-offer.tsx","../src/record/record-screen.tsx","../src/layout/record-trail-store.ts","../src/layout/route-trail.ts","../src/layout/recent-records.ts","../src/layout/use-record-visit.ts","../src/layout/record-page.tsx","../src/layout/resource-page-router.tsx"],"sourcesContent":["import { canonicalEntityNodeKey, type CanonicalEntityNode, type ResourceDef } from '@burojs/core';\n\nexport type CanonicalNodeShape = CanonicalEntityNode;\n\n/** Canonical identity for any registry node or route ref. */\nexport function canonicalNavKey(node: CanonicalNodeShape): string {\n return canonicalEntityNodeKey(node);\n}\n\n/** Canonical UI/query identity; default resources retain their legacy short key. */\nexport function canonicalResourceKey(def: ResourceDef): string {\n return canonicalNavKey(def);\n}\n","import {\n type AppRuntime,\n type I18nCaps,\n type NavNode,\n type ResourceLabels,\n type RouteMatch,\n navHrefFor,\n nodeKind,\n resolveNavLabel,\n resolveResourceNavLabel,\n declaredText,\n} from '@burojs/core';\nimport type { ReactNode } from 'react';\nimport type { NavItem } from './nav-slots.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nexport interface BuildNavItemsArgs {\n registry: AppRuntime['registry'];\n caps: I18nCaps;\n groupName: string;\n match: RouteMatch | null;\n isVisible: (node: NavNode) => boolean;\n entryFilter?: (node: NavNode) => boolean;\n icons?: {\n resource?: (name: string) => ReactNode;\n page?: (name: string) => ReactNode;\n group?: (name: string) => ReactNode;\n };\n}\n\n/**\n * Resolve a group's direct children into NavItems: href via `navHrefFor`\n * (nesting-independent; resolves a sub-group directly to its visible target,\n * skipping the group-root redirect hop so React reconciles the nested chrome\n * instead of remounting it), label via the i18n resolvers (reactive on locale),\n * and `active` via the spec §8.2 rule — a leaf is active when it IS the\n * current match; a sub-group is active when it is an ANCESTOR of the match\n * (on `match.groupChain`). Children failing `isVisible`/`entryFilter` drop.\n */\nexport function buildNavItems(args: BuildNavItemsArgs): NavItem[] {\n const { registry, caps, groupName, match, isVisible, entryFilter, icons } = args;\n const chain = match?.groupChain ?? [];\n // On a group-index match, match.name is the GROUP; the shown page is match.target\n // (the index page, or the first-visible-descendant leaf). Highlight THAT.\n const qualifiedMatch = match as\n | (RouteMatch & {\n readonly ref?: Readonly<{ namespace: string; id: string }>;\n readonly targetRef?: Readonly<{ namespace: string; id: string }>;\n })\n | null;\n const activeLeaf =\n qualifiedMatch == null\n ? undefined\n : qualifiedMatch.kind === 'group-index'\n ? canonicalNavKey({\n name: qualifiedMatch.target ?? qualifiedMatch.name,\n ref: qualifiedMatch.targetRef,\n })\n : canonicalNavKey(qualifiedMatch);\n const isEligible = (node: NavNode): boolean =>\n isVisible(node) && (entryFilter ? entryFilter(node) : true);\n const out: NavItem[] = [];\n for (const child of registry.groups.childrenOf(groupName)) {\n if (!isEligible(child as NavNode)) continue;\n const kind = nodeKind(child);\n const childKey = canonicalNavKey(child);\n const href = navHrefFor(registry, childKey, { isVisible: isEligible });\n if (kind === 'group') {\n const label = resolveNavLabel(\n caps,\n `groups.${childKey}`,\n declaredText('chrome', child, 'label'),\n );\n const active = chain.some((g) => canonicalNavKey(g) === childKey);\n out.push({\n kind: 'group',\n name: childKey,\n label,\n href,\n icon: icons?.group?.(childKey),\n active,\n });\n } else if (kind === 'custom-page') {\n out.push({\n kind: 'custom-page',\n name: childKey,\n label: resolveNavLabel(caps, `pages.${childKey}`, declaredText('chrome', child, 'label')),\n href,\n icon: icons?.page?.(childKey),\n active: activeLeaf === childKey,\n });\n } else {\n out.push({\n kind: 'resource',\n name: childKey,\n /*\n `navLabel` first, the plural label otherwise.\n\n A sidebar entry and a page title are not always the same phrase. Under\n a «Documents» section the entry wants to read «All documents» — it\n sits beside the individual kinds and has to say which one it is —\n while the breadcrumb still wants «Documents › wo:2921», because «All\n documents › wo:2921» is not a sentence anyone would write.\n\n A LEAF string, deliberately: a `nav` object with a `.label` inside\n would put an object node in the lookup path, and i18next answers\n `exists()` true for those while `t()` returns the literal\n \"key '…' returned an object instead of string.\" — the exact trap this\n codebase has already been bitten by.\n */\n label: resolveResourceNavLabel(caps, childKey, child as ResourceLabels),\n href,\n icon: icons?.resource?.(childKey),\n active: activeLeaf === childKey,\n });\n }\n }\n return out;\n}\n","'use client';\nimport type { NavGroupDef } from '@burojs/core';\nimport { ComponentsContext, useComponent } from '@burojs/react';\nimport type { ComponentType, ReactNode } from 'react';\nimport { useContext } from 'react';\n\n/** A resolved child entry a layout renderer draws (spec §8.2). */\nexport interface NavItem {\n kind: 'resource' | 'custom-page' | 'group';\n name: string;\n label: string;\n href: string;\n icon?: ReactNode;\n active: boolean;\n}\n\n/** Props every layout renderer receives. `children` = the active leaf's content. */\nexport interface NavLayoutProps {\n group: NavGroupDef;\n /** Canonical group identity. Default-namespace groups keep their short name. */\n groupKey?: string;\n items: NavItem[];\n children: ReactNode;\n}\n\nexport type NavLayout = ComponentType<NavLayoutProps>;\n\n/** Components-registry slot key for a layout renderer: `layout.<key>`. */\nexport function layoutSlot(key: string): string {\n return `layout.${key}`;\n}\n\n/** Resolve the registered layout renderer for a `layout` slot key, or undefined. */\nexport function useLayout(key: string): NavLayout | undefined {\n return useComponent<NavLayout>(layoutSlot(key));\n}\n\n/**\n * Non-hook-in-loop layout lookup: read the Components registry once, return a\n * resolver `(key) => NavLayout | undefined`. Lets `NavChrome` resolve a\n * variable-length group chain without violating Rules of Hooks.\n */\nexport function useLayoutResolver(): (key: string) => NavLayout | undefined {\n const components = useContext(ComponentsContext);\n return (key: string) => components[layoutSlot(key)] as NavLayout | undefined;\n}\n","'use client';\nimport {\n type HrefOpts,\n type NavNode,\n type RouteMatch,\n type CustomPageDef,\n evaluateVisible,\n isCustomPageDef,\n hrefFor,\n matchPath,\n} from '@burojs/core';\nimport {\n pageAccessFor,\n useApp,\n useOptionalRouterAdapter,\n usePermissions,\n useVisibilityCtx,\n} from '@burojs/react';\nimport { useCallback } from 'react';\n\n/**\n * The app-scoped visibility predicate passed to the pure core resolvers so\n * that group-index → first-visible-child resolution and (later) chrome item\n * lists honor `visible(ctx)`. Resources, groups and custom pages consult\n * `evaluateVisible` against the current visibility context; a node without a\n * predicate is visible. The custom-page route gates on it too (`<PageHost>`).\n */\nexport function useNavVisible(): (node: NavNode) => boolean {\n const ctx = useVisibilityCtx();\n const allowed = usePageAllowed();\n return useCallback(\n (node: NavNode) =>\n evaluateVisible((node as { visible?: unknown }).visible as never, ctx) &&\n (!isCustomPageDef(node) || allowed(node)),\n [ctx, allowed],\n );\n}\n\n/**\n * Whether a custom page's `requires` is decided in the user's favour (P7 3.13): a page without\n * one is allowed; one whose permission decision is still pending is not (the entry is absent, the\n * group index passes it over), so nothing about a page is drawn before it is decided.\n */\nexport function usePageAllowed(): (page: CustomPageDef) => boolean {\n const permissions = usePermissions();\n return useCallback((page) => pageAccessFor(page, permissions) === 'allowed', [permissions]);\n}\n\n/** Canonical href for a resource / custom page / group. Nesting-independent. */\nexport function useHref(name: string, opts?: Omit<HrefOpts, 'isVisible'>): string {\n const app = useApp();\n const isVisible = useNavVisible();\n return hrefFor(app.registry, name, { ...opts, isVisible });\n}\n\n/**\n * Resolve the active route from the router adapter's pathname, or null. The\n * router adapter is the framework's only source of the location; without one\n * there is no location, so there is no match.\n */\nexport function useMatch(): RouteMatch | null {\n const app = useApp();\n const isVisible = useNavVisible();\n const path = useOptionalRouterAdapter()?.pathname;\n return path === undefined ? null : matchPath(app.registry, path, { isVisible });\n}\n","'use client';\nimport { createContext, useContext, useMemo, type ReactNode } from 'react';\n\n/** Group names already rendered by an ancestor NavAreaLayout — NavChrome skips these. */\nconst NavChromeBoundaryContext = createContext<ReadonlySet<string>>(new Set());\n\nexport function useNavChromeBoundary(): ReadonlySet<string> {\n return useContext(NavChromeBoundaryContext);\n}\n\n/**\n * Merge `claim` into the ancestor boundary set and provide it downward. Nested\n * NavAreaLayouts compose: each adds its own group (+ ancestors) to the set.\n */\nexport function NavChromeBoundaryProvider({\n claim,\n children,\n}: {\n claim: readonly string[];\n children: ReactNode;\n}) {\n const parent = useContext(NavChromeBoundaryContext);\n const key = claim.join(' ');\n const merged = useMemo(() => {\n const s = new Set(parent);\n for (const n of claim) s.add(n);\n return s;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [parent, key]);\n return (\n <NavChromeBoundaryContext.Provider value={merged}>{children}</NavChromeBoundaryContext.Provider>\n );\n}\n","'use client';\nimport { useApp, useI18nCaps } from '@burojs/react';\nimport type { ReactElement, ReactNode } from 'react';\nimport { buildNavItems, type BuildNavItemsArgs } from './build-nav-items.js';\nimport { useNavChromeBoundary } from './nav-chrome-boundary.js';\nimport { useLayoutResolver } from './nav-slots.js';\nimport { useMatch, useNavVisible } from './use-nav-routing.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nconst DETAIL_ACTIONS = new Set(['show', 'edit', 'create']);\n\nexport interface NavChromeProps {\n children: ReactNode;\n entryFilter?: (node: { name: string }) => boolean;\n icons?: BuildNavItemsArgs['icons'];\n}\n\n/**\n * Wrap the active page in its group-chain chrome. Walks `match.groupChain`\n * innermost→outermost, wrapping the accumulating content in each group's\n * registered content layout (secondary-sidebar / tabs). Groups whose layout\n * has no registered content renderer (flat / collapsible — main-sidebar only)\n * contribute no wrapping. No match → children bare.\n */\nexport function NavChrome({ children, entryFilter, icons }: NavChromeProps): ReactElement {\n const app = useApp();\n const caps = useI18nCaps();\n const isVisible = useNavVisible();\n const match = useMatch();\n const resolveLayout = useLayoutResolver();\n const boundary = useNavChromeBoundary();\n\n if (!match) return <>{children}</>;\n\n let content = children;\n // innermost group is last in groupChain → fold from the end outward.\n for (let i = match.groupChain.length - 1; i >= 0; i--) {\n const group = match.groupChain[i];\n if (!group) continue;\n const groupKey = canonicalNavKey(group);\n if (boundary.has(groupKey)) continue; // already rendered by an ancestor NavAreaLayout\n // chromeOn: 'list' groups collapse (contribute zero wrapping) on a\n // resource detail action — drilling into a record hides that group's\n // chrome (tabs / secondary-sidebar) entirely.\n if (group.chromeOn === 'list' && match.kind === 'resource' && DETAIL_ACTIONS.has(match.action))\n continue;\n const Layout = resolveLayout(group.layout);\n if (!Layout) continue; // flat/collapsible: no content wrapping\n const items = buildNavItems({\n registry: app.registry,\n caps,\n groupName: groupKey,\n match,\n isVisible,\n entryFilter,\n icons,\n });\n content = (\n <Layout group={group} groupKey={groupKey} items={items}>\n {content}\n </Layout>\n );\n }\n return <>{content}</>;\n}\n","'use client';\nimport { useT } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { Button } from '../primitives/button.js';\n\nexport type RecordErrorState = 'not-found' | 'session-expired' | 'error';\n\n/**\n * A record that is loading or cannot be shown: `record-page:loading`, or\n * `record-page:<state>` with Retry when the caller passes `onRetry`. Shared by\n * the record route and `<RecordScreen>`.\n */\nexport function RecordState({\n state,\n onRetry,\n}: {\n readonly state: RecordErrorState | 'loading';\n readonly onRetry?: () => void;\n}): ReactElement {\n const t = useT();\n if (state === 'loading') {\n return (\n <div\n role=\"status\"\n aria-busy=\"true\"\n data-testid=\"record-page:loading\"\n className=\"p-6 text-sm text-muted-foreground\"\n >\n {t('router.recordLoading')}\n </div>\n );\n }\n const message =\n state === 'not-found'\n ? t('router.recordNotFound')\n : state === 'session-expired'\n ? t('router.recordSessionExpired')\n : t('router.recordError');\n return (\n <div\n // A failed read is announced; loading stays a polite `status`.\n role=\"alert\"\n data-testid={`record-page:${state}`}\n className=\"flex flex-col items-center justify-center gap-3 px-6 py-24 text-center\"\n >\n <p className=\"max-w-sm text-sm text-muted-foreground\">{message}</p>\n {onRetry ? (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"record-page:retry\"\n onClick={onRetry}\n >\n {t('actions.retry')}\n </Button>\n ) : null}\n </div>\n );\n}\n","'use client';\nimport type { RouteMatch } from '@burojs/core';\nimport { useOptionalT } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { RecordState } from '../record/record-state.js';\nimport { Button } from '../primitives/button.js';\nimport { FlowBoundary, loadFailedText, loadPageFlowRoute, useLoaded } from './load-runtime.js';\n\n/**\n * A page-hosted flow's route, once its chunk arrived (P6): the flow machine and the flow host\n * load with the first visit to such a route, never with the first screen. While the chunk loads\n * the record route's loading state shows; a chunk that failed to arrive says so with Retry.\n */\nexport function PageFlowRouteLoader({ match }: { readonly match: RouteMatch }): ReactElement {\n const t = useOptionalT();\n const loaded = useLoaded(loadPageFlowRoute);\n const failed = (retry: () => void) => (\n <div role=\"alert\" data-buro-flow-load=\"failed\" className=\"flex flex-col gap-3 p-6 text-sm\">\n <p>{loadFailedText(t)}</p>\n <div>\n <Button type=\"button\" onClick={retry}>\n {t('actions.retry') === 'actions.retry' ? 'Retry' : t('actions.retry')}\n </Button>\n </div>\n </div>\n );\n if (loaded.error !== undefined) return failed(loaded.retry);\n if (loaded.module === undefined) return <RecordState state=\"loading\" />;\n const Route = loaded.module.PageFlowRoute;\n return (\n <FlowBoundary fallback={(_error, reset) => failed(reset)}>\n <Route match={match} />\n </FlowBoundary>\n );\n}\n","'use client';\nimport { normalizeEntityRef } from '@burojs/core';\nimport { type RowRecord, useRouteListImplementation, useTranslate } from '@burojs/react';\nimport { type ReactNode, Suspense, useMemo } from 'react';\nimport { selectImplementation, viewOf } from '../blocks/place-node.js';\nimport { RouteListContext } from '../blocks/route-list-context.js';\n\n/**\n * Props of {@link ResourceListPage}.\n */\nexport interface ResourceListPageProps {\n /**\n * Registry name of the resource to list.\n *\n * ⚠️ **Precondition: it MUST be registered.** `useResourceList` resolves\n * `routing.createHref` through `hrefFor`, which throws `unknown node\n * '<resource>'` for a name the registry doesn't know. Route-level code\n * should 404 before mounting this component (the playground's\n * `app/(admin)/[resource]/page.tsx` does exactly that).\n */\n resource: string;\n /**\n * Extra `meta` merged into the underlying `useList` call — and therefore\n * into the react-query cache key. This is the seam for app-level query\n * scope the framework cannot know about: a sidebar product-group /\n * location picker, a tenant id, anything a data provider turns into a\n * server-side `where`.\n *\n * ⚠️ **The caller MUST memoize this object.** It flows into the query key\n * AND into the controller's own memo chain; an inline object literal\n * mints a fresh key on every render, which busts that chain and can\n * produce a refetch loop. The playground memoizes on\n * `[scope.productGroup, scope.locationId]`:\n *\n * ```tsx\n * const scope = useScope();\n * const listMeta = useMemo(\n * () => ({ scope: { pg: scope.productGroup, location_id: scope.locationId } }),\n * [scope.productGroup, scope.locationId],\n * );\n * return <ResourceListPage resource={resource} meta={listMeta} />;\n * ```\n */\n meta?: Record<string, unknown>;\n /**\n * App-level per-cell renderer, consulted AFTER this component's own\n * built-in branches (typed discriminator → declared `enum` field) and\n * BEFORE `<ResourceList>`'s default field-type display. Return\n * `undefined` to fall through, exactly like `<ResourceList renderCell>`.\n *\n * The built-ins cover what the registry can describe on its own; this\n * prop is for the rest — the playground uses it for a legacy hardcoded\n * `status` badge and a `is_active` Yes/No badge, neither of which the\n * framework can derive from a field def.\n *\n * ⚠️ Wins over a registered `list.cell.<resource>` slot (level 1 —\n * {@link ../list-kit/list-slots.js | listSlot}). A host that mounted this\n * page by hand and passed its own `renderCell` knows more than the\n * registry does; the slot exists for the standard router, which mounts\n * `<ResourceListPage resource={...}>` with no props at all.\n *\n * ⚠️ Same purity requirement as `<ResourceList renderCell>`: it runs\n * inside a memoized cell, so anything depending on external reactive\n * state (locale, flags) must be delegated to a component that\n * subscribes to that state itself.\n */\n renderCell?: (col: string, value: unknown, row: RowRecord) => ReactNode | undefined;\n /**\n * Replacement for the table's empty state, forwarded to\n * `<ResourceList emptyState>` and from there to `<DataTable emptyState>`.\n *\n * ⚠️ Supplying this changes the SHAPE of the empty list, not just its\n * copy: the default is a standalone panel rendered INSTEAD of the table\n * (dashed border, icon, heading, and a \"Clear filter\" / \"+ Create\" /\n * \"back to page 1\" CTA), whereas a supplied node renders inside the\n * table body, so the header row survives and the CTAs do not. Pass one\n * when a slot wants the table chrome to stay put; omit it for the\n * standard panel.\n */\n emptyState?: ReactNode;\n}\n\n/**\n * The assembled, data-connected list page (core flexibility program, Task\n * B3.1) — the piece that makes `<ResourceList>` actually useful. Given a\n * resource name it renders the whole standard list surface:\n *\n * - page header,\n * - the filter region — search box + pinned controls + the filter-builder\n * popover + applied-filter badges + \"Clear all\" (via {@link FilterRegion}),\n * - saved-views dropdown and its two dialogs (save-current / manage),\n * - the columns toggle and the create button,\n * - `<ResourceList>` itself (table, empty/error/loading states,\n * pagination),\n * - the floating bulk-action bar.\n *\n * Everything beneath is already framework-owned: the controller\n * (`useResourceList`, `@burojs/react`) and the filter-builder region\n * (`FilterRegion`, this package's `list-kit/filter-builder`). This\n * component contributes only the JSX assembly — it was lifted VERBATIM out\n * of the playground's `_list-body.tsx` (`ResourceListBody`), so every\n * `list-*` testid it emits is byte-identical to the pre-move markup (Task 7\n * — the filter region's OWN testids moved to the builder's `list-filter:*`\n * convention; everything else is unchanged).\n *\n * It renders through the built-in `related-list` block (spec 8.4, decision 63): the view is\n * `buro:related-list`'s, inside a `[data-buro-node=\"place\"]` wrapper, and an app that registers\n * its own `buro:related-list` view (`<BuroProvider blockImplementations>`) replaces this list\n * everywhere, a development notice saying so. The body itself lives in `ResourceListSurface`.\n *\n * The whole subtree is wrapped in `<ResourceListProvider>`, so any nested\n * component can read the live controller with `useResourceListContext()`\n * instead of receiving a hand-threaded prop chain. That is the seam the\n * list slots plug into.\n *\n * ## Override ladder (Task B3.2; level 1 added by SP0 Task 5)\n *\n * Three optional slots, resolved from the Components registry by resource\n * name — see {@link listSlot}. Registering none (level 0) is what every\n * resource in the playground does today, and what every existing e2e spec\n * covers:\n *\n * - **`list.cell.<resource>`** (level 1) is consulted for every cell, AFTER\n * this component's own built-in branches (typed discriminator →\n * declared `enum` field) and BEFORE `<ResourceList>`'s default field-type\n * display — the same position the `renderCell` prop occupies, and the\n * explicit prop wins when both are present. Everything else — filters,\n * saved views, the columns menu, the table, pagination — stays standard.\n * - **`list.filters.<resource>`** (level 2) replaces the filter region —\n * the search box, the pinned controls, the filter-builder popover and its\n * applied-filter badges. Saved views, the columns toggle, the create\n * button, the table, the footer and pagination all stay standard.\n * - A whole-body override is a list frame (`views.list.frame`, P7-34), which arranges the\n * framework's pieces and keeps the page header, the controller, the URL state, the saved-view\n * dialogs, the export watcher and the bulk bar. `list.body.<resource>` is gone (P7-37).\n *\n * ⚠️ The `<PageHeader>` stays framework-owned. It is what writes `document.title` (via\n * `useDocumentTitle`, defended against Next's metadata re-application) and what renders the\n * page's accessible `<h1>` and its breadcrumb slot; the header's `h1` is `sr-only`.\n *\n * Both slots take no props and read the controller from\n * `useResourceListContext()`, so each is unit-testable against a\n * hand-written stub controller with no Next mocking.\n *\n * @see docs/superpowers/plans/2026-07-26-cfb3-assembled-page-slots.md — Tasks B3.1, B3.2\n */\nexport function ResourceListPage({\n resource,\n meta,\n renderCell,\n emptyState,\n}: ResourceListPageProps) {\n const app = useRouteListImplementation();\n const implementation = selectImplementation('buro:related-list', app);\n const View = implementation === undefined ? undefined : viewOf(implementation);\n const translate = useTranslate();\n const route = useMemo(() => ({ meta, renderCell, emptyState }), [meta, renderCell, emptyState]);\n const viewProps = useMemo(\n () => ({\n props: { resource: normalizeEntityRef(resource) },\n data: {},\n t: (key: string, options?: { params?: Record<string, unknown>; count?: number }) =>\n translate(`blocks.buro:related-list.${key}`, options),\n }),\n [resource, translate],\n );\n return (\n <div data-buro-node=\"place\" data-buro-size=\"full\" className=\"min-w-0\">\n <RouteListContext.Provider value={route}>\n <Suspense fallback={null}>{View === undefined ? null : <View {...viewProps} />}</Suspense>\n </RouteListContext.Provider>\n </div>\n );\n}\n","'use client';\nimport {\n type CustomPageDef,\n compilePageScreen,\n evaluateVisible,\n formatEntityRef,\n isScreenFailure,\n type NavNode,\n pageParamNames,\n parsePageParams,\n type RouteMatch,\n resolveNavLabel,\n snapshotAppFrames,\n snapshotBlockLookup,\n snapshotFrameLookup,\n declaredText,\n} from '@burojs/core';\nimport {\n type PageFrameViewProps,\n RouteSourceContext,\n ScreenStateProvider,\n useApplicationSnapshot,\n useFrameImplementations,\n useFrameT,\n useI18nCaps,\n useOptionalRouterAdapter,\n usePageAccess,\n usePageScreen,\n useVisibilityCtx,\n} from '@burojs/react';\nimport { type ReactElement, type ReactNode, Suspense, useContext, useEffect, useMemo } from 'react';\nimport { resolveFrameView } from '../frames/resolve.js';\nimport { RecordState } from '../record/record-state.js';\nimport { RouteScreenClaimContext, RouteScreenContext } from '../record/route-screen-context.js';\nimport { canonicalNavKey } from '../resource-key.js';\nimport { DeepLinkScope } from '../quick/use-deep-link.js';\nimport { ScreenTree } from '../screen/screen-tree.js';\nimport { useTabsUrlState } from '../screen/use-tabs-url-state.js';\nimport { useNavVisible } from './use-nav-routing.js';\n\nexport interface PageHostProps {\n readonly page: CustomPageDef;\n readonly match: RouteMatch;\n /** The router's not-found panel, rendered when the nav gate rejects the page. */\n readonly notFound: ReactElement;\n}\n\n/**\n * The route of a custom page with a `body` (P1b+P1c decision 52). The nav gate comes first: when\n * the page's own `visible` or any group on its chain rejects it, the route renders not-found and\n * mounts nothing else — no compile, no resolver, no block (a hidden page is not reachable by\n * URL). Otherwise it renders the page label as the `<h1>` and the planned body, placements\n * resolved through the page's own resolver (`usePageScreen`), in a `page-body` region.\n */\nexport function PageHost({ page, match, notFound }: PageHostProps): ReactElement {\n const isVisible = useNavVisible();\n const ctx = useVisibilityCtx();\n const access = usePageAccess(page);\n const visible =\n evaluateVisible(page.visible as never, ctx) &&\n match.groupChain.every((group) => isVisible(group as NavNode));\n if (!visible) return notFound;\n // The page's `requires` decides before anything of the page mounts (P7 3.13): undecided is the\n // loading state, denied is the not-found a missing page renders, and neither reads a thing.\n if (access === 'pending') return <RecordState state=\"loading\" />;\n if (access === 'denied') return notFound;\n return <PageParams page={page} notFound={notFound} />;\n}\n\nconst NO_SEARCH = new URLSearchParams();\n\n/**\n * The page's declared params, read from the query string (P2 4.5): a missing required param or\n * a value its schema rejects renders not-found and mounts nothing — no compile, no resolver, no\n * block (fail closed). Otherwise the body reads them as `route`.\n */\nfunction PageParams({\n page,\n notFound,\n}: {\n readonly page: CustomPageDef;\n readonly notFound: ReactElement;\n}): ReactElement {\n const router = useOptionalRouterAdapter();\n const search =\n router?.searchParams ??\n (typeof window === 'undefined' ? NO_SEARCH : new URLSearchParams(window.location.search));\n // Keyed by the declared params' raw values: another query parameter changing re-parses nothing.\n const raw = JSON.stringify(pageParamNames(page.params).map((name) => search.get(name)));\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed by the declared params' raw values\n const parsed = useMemo(() => parsePageParams(page, search), [page, raw]);\n if (!parsed.ok) return notFound;\n return (\n <RouteSourceContext.Provider value={parsed.route}>\n <PageBody page={page} />\n </RouteSourceContext.Provider>\n );\n}\n\nfunction PageBody({ page }: { readonly page: CustomPageDef }): ReactElement {\n const snapshot = useApplicationSnapshot();\n const compiled = useMemo(\n () =>\n compilePageScreen(page, {\n blocks: snapshotBlockLookup(snapshot),\n frames: snapshotFrameLookup(snapshot),\n appFrames: snapshotAppFrames(snapshot),\n }),\n [page, snapshot],\n );\n const failure = isScreenFailure(compiled) ? compiled : null;\n const screen = failure === null && !isScreenFailure(compiled) ? compiled : null;\n const caps = useI18nCaps();\n const name = canonicalNavKey(page);\n const label = resolveNavLabel(caps, `pages.${name}`, declaredText('chrome', page, 'label'));\n useEffect(() => {\n if (failure === null || process.env.NODE_ENV === 'production') return;\n console.error(\n `[burojs] The page \"${name}\" cannot render its body: ${failure.code} at ${failure.path.join('.')}: ${failure.message}.`,\n );\n }, [failure, name]);\n return (\n // No padding of its own: `AppLayout` pads the content area, and a second `p-6` here started\n // app pages 48px from the edge against a resource page's 24px.\n <div className=\"flex flex-col gap-4\">\n <h1 className=\"text-2xl font-semibold tracking-tight\">{label}</h1>\n {screen === null ? (\n <RecordState state=\"error\" />\n ) : (\n <PageRouteScreen>\n <PlannedBody screen={screen} name={name} label={label} />\n </PageRouteScreen>\n )}\n </div>\n );\n}\n\n/**\n * The page is its route's screen (P2 4.6): its keyed tabs open from `?<tabsKey>=` and a top-level\n * `state: 'url'` placement writes `?<key>.<param>`, as on a record route; a screen nested inside\n * it (a dialog's record screen) is not one.\n */\nfunction PageRouteScreen({ children }: { readonly children: ReactNode }): ReactElement {\n const tabs = useTabsUrlState('show', true);\n return (\n <RouteScreenClaimContext.Provider value={false}>\n <RouteScreenContext.Provider value={true}>\n <ScreenStateProvider open={tabs.open} onOpenChange={tabs.onOpenChange}>\n {children}\n </ScreenStateProvider>\n </RouteScreenContext.Provider>\n </RouteScreenClaimContext.Provider>\n );\n}\n\n/**\n * The planned body of a compiled page screen, drawn through its frame (P7 3.14). The page route\n * draws it under the heading; a modal action's block screen (P7 3.16) draws it alone.\n * @internal\n */\nexport function PlannedBody({\n screen,\n name,\n label,\n}: {\n readonly screen: NonNullable<Parameters<typeof usePageScreen>[0]>;\n readonly name: string;\n readonly label: string;\n}): ReactElement {\n const page = usePageScreen(screen);\n const { PlacementScope } = page;\n const route = useContext(RouteSourceContext);\n const catalog = useFrameImplementations();\n const id = formatEntityRef(screen.frame);\n const resolved = useMemo(\n () => resolveFrameView(screen.frame, catalog, 'page'),\n [screen.frame, catalog],\n );\n const t = useFrameT(id);\n // Each slot of the effective frame as a rendered tree; one with nothing to show is `null`.\n const slots: Record<string, ReactElement | null> = {};\n for (const slot of Object.keys(screen.slots)) {\n const roots = page.plan.slots[slot] ?? [];\n slots[slot] = roots.every((node) => node.state === 'absent') ? null : (\n <ScreenTree\n key={slot}\n region={slot === 'body' ? 'page-body' : 'record'}\n slot={slot}\n resource={name}\n mode=\"show\"\n compiled={screen}\n page={page}\n />\n );\n }\n const View = resolved.view;\n const viewProps: PageFrameViewProps = { slots: slots as never, label, params: route ?? {}, t };\n // The page's params are its screen's alone (spec 4.5): a block below that mounts its own form\n // controller reads `{}`.\n return (\n <RouteSourceContext.Provider value={null}>\n <PlacementScope>\n <DeepLinkScope plan={page.plan} enabled>\n <div data-buro-region=\"page-body\">\n <Suspense fallback={null}>\n <View {...viewProps} />\n </Suspense>\n </div>\n </DeepLinkScope>\n </PlacementScope>\n </RouteSourceContext.Provider>\n );\n}\n","'use client';\nimport { createContext, useContext } from 'react';\n\n/**\n * Minimal form-control handle exposed to field renderers so a field can update\n * SIBLING fields (a field renderer otherwise only sees its own value). Used for\n * reactive prefills — e.g. picking a product on a GTIN field also fills the\n * «Product name» / «Code type» fields (#2). `<RecordScreen>` provides it.\n */\nexport interface FormControl {\n /** Merge a patch of `{ fieldName: value }` into the form's live values. */\n setValues: (patch: Record<string, unknown>) => void;\n}\n\nconst FormControlContext = createContext<FormControl | null>(null);\n\nexport const FormControlProvider = FormControlContext.Provider;\n\n/** Read the surrounding form's control handle, or `null` outside a form. */\nexport function useFormControl(): FormControl | null {\n return useContext(FormControlContext);\n}\n","'use client';\nimport { FrameCheckContext, type FrameCheckValue, type FramePiece } from '@burojs/react';\nimport {\n createContext,\n type ReactElement,\n type ReactNode,\n type RefObject,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n} from 'react';\n\n/** One screen instance's slot mounts: a slot renders at most once (P6-15). */\ninterface SlotMounts {\n /** Takes the slot for `token` when it is free; whether `token` holds it. */\n claim(slot: string, token: string): boolean;\n release(slot: string, token: string): void;\n /** A second concurrent mount of `slot`: logged once per slot. */\n twice(slot: string): void;\n}\n\nconst SlotMountsContext = createContext<SlotMounts | null>(null);\n\n/**\n * Whether this mount of `slot` is its screen's first: a second concurrent mount renders nothing,\n * so the form keeps one value per field, and logs `frame.slot-twice` once.\n */\nexport function useSlotOnce(slot: string): boolean {\n const mounts = useContext(SlotMountsContext);\n const token = useId();\n const first = mounts === null || mounts.claim(slot, token);\n useEffect(() => {\n if (mounts === null) return;\n mounts.claim(slot, token);\n return () => mounts.release(slot, token);\n }, [mounts, slot, token]);\n useEffect(() => {\n if (!first) mounts?.twice(slot);\n }, [first, mounts, slot]);\n return first;\n}\n\n/**\n * The runtime obligations of a record frame (spec 3.3, P6-15), checked in development after the\n * view mounted, once per screen instance each: `body` and every slot at most once, `<FormActions/>`\n * in edit and create, `<RecordActions/>` in show when the resource has item actions there, no\n * `h1` (the route draws the screen's one).\n */\nexport function FrameObligations({\n id,\n mode,\n showActions,\n root,\n children,\n}: {\n readonly id: string;\n readonly mode: 'show' | 'edit' | 'create';\n /** The record is read and the resource has item actions on the show surface. */\n readonly showActions: boolean;\n /** The screen's root element: an `h1` inside it is the frame's. */\n readonly root: RefObject<HTMLElement | null>;\n readonly children: ReactNode;\n}): ReactElement {\n const told = useRef(new Set<string>());\n const counts = useRef(new Map<FramePiece, number>());\n const owners = useRef(new Map<string, string>());\n const tell = (key: string, write: () => void) => {\n if (told.current.has(key) || process.env.NODE_ENV === 'production') return;\n told.current.add(key);\n write();\n };\n const latestId = useRef(id);\n latestId.current = id;\n // biome-ignore lint/correctness/useExhaustiveDependencies: one registry per screen instance\n const slotMounts = useMemo<SlotMounts>(\n () => ({\n claim(slot, token) {\n const owner = owners.current.get(slot);\n if (owner === undefined) {\n owners.current.set(slot, token);\n return true;\n }\n return owner === token;\n },\n release(slot, token) {\n if (owners.current.get(slot) === token) owners.current.delete(slot);\n },\n twice(slot) {\n tell(`slot-twice:${slot}`, () =>\n console.error(\n `[burojs] frame.slot-twice: ${latestId.current} renders slots.${slot} twice; a slot renders at most once (body twice would mount every field twice under one form).`,\n ),\n );\n },\n }),\n [],\n );\n const pieces = useMemo<FrameCheckValue>(\n () => ({\n stub: false,\n mount(piece) {\n counts.current.set(piece, (counts.current.get(piece) ?? 0) + 1);\n return () => counts.current.set(piece, (counts.current.get(piece) ?? 1) - 1);\n },\n }),\n [],\n );\n return (\n <SlotMountsContext.Provider value={slotMounts}>\n <FrameCheckContext.Provider value={pieces}>\n {children}\n <ObligationCheck\n check={() => {\n const mounted = (piece: FramePiece) => (counts.current.get(piece) ?? 0) > 0;\n if (mode !== 'show' && !mounted('FormActions'))\n tell('no-form-actions', () =>\n console.error(\n `[burojs] frame.no-form-actions: ${id} renders no <FormActions/> in ${mode}; nothing can submit or cancel the form.`,\n ),\n );\n if (mode === 'show' && showActions && !mounted('RecordActions'))\n tell('no-actions', () =>\n console.warn(\n `[burojs] screen.no-actions: ${id} renders no <RecordActions/> in show, and the resource has item actions there.`,\n ),\n );\n if (root.current?.querySelector('h1') != null)\n tell('h1', () =>\n console.error(`[burojs] ${id} renders an h1; the route draws the screen's one h1.`),\n );\n }}\n />\n </FrameCheckContext.Provider>\n </SlotMountsContext.Provider>\n );\n}\n\n/** Runs `check` after every commit of the view before it (its effects ran first). */\nfunction ObligationCheck({ check }: { readonly check: () => void }): null {\n useEffect(() => {\n check();\n });\n return null;\n}\n","'use client';\nimport { FORM_SLOT } from '@burojs/core';\nimport { type RecordFrameValue, useOptionalT, useRecordFrame, useTestIds } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { Button } from '../primitives/button.js';\nimport { useFrameChrome } from '../record/frame-context.js';\nimport { ScreenTree } from '../screen/screen-tree.js';\nimport { useSlotOnce } from './obligations.js';\n\n/** The draft-found banner: restore or discard; an edit draft over a changed record offers discard only. */\nfunction DraftBanner(): ReactElement | null {\n const { resource, mode, controller } = useRecordFrame();\n const t = useOptionalT();\n const tid = useTestIds();\n const { draft } = controller;\n if (mode === 'show' || draft.pending === null) return null;\n return (\n <div\n data-testid={tid.formDraftBanner(resource, mode)}\n role=\"status\"\n aria-live=\"polite\"\n className=\"flex flex-wrap items-center gap-2 rounded-md border border-warning/50 bg-warning/10 px-3 py-2 text-sm\"\n >\n <span className=\"font-medium\">\n {draft.recordChanged\n ? t('draft.recordChanged')\n : t('draft.found', { params: { time: timeAgo(draft.pending.savedAt, t) } })}\n </span>\n {draft.recordChanged ? null : (\n <span className=\"text-muted-foreground\">{t('draft.restorePrompt')}</span>\n )}\n <div className=\"ml-auto flex gap-2\">\n {draft.recordChanged ? null : (\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"outline\"\n data-testid={tid.formDraftRestore(resource, mode)}\n onClick={draft.restore}\n >\n {t('draft.restore')}\n </Button>\n )}\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"ghost\"\n data-testid={tid.formDraftDiscard(resource, mode)}\n onClick={draft.discard}\n >\n {t('draft.discard')}\n </Button>\n </div>\n </div>\n );\n}\n\n/** A draft's age as the banner says it. */\nfunction timeAgo(savedAt: string, t: ReturnType<typeof useOptionalT>): string {\n const then = new Date(savedAt).getTime();\n if (!Number.isFinite(then)) return t('draft.timeAgoRecently');\n const diff = Date.now() - then;\n if (diff < 60_000) return t('draft.timeAgoMoment');\n if (diff < 3_600_000) return t('draft.timeAgoMinutes', { count: Math.round(diff / 60_000) });\n if (diff < 86_400_000) return t('draft.timeAgoHours', { count: Math.round(diff / 3_600_000) });\n return t('draft.timeAgoDays', { count: Math.round(diff / 86_400_000) });\n}\n\n/** The record's id as the frame knows it: the `recordId`, else the record's own `id`. */\nexport function frameRecordId(frame: RecordFrameValue): string | undefined {\n if (frame.recordId !== undefined) return frame.recordId;\n const id = frame.record?.id;\n return typeof id === 'string' || typeof id === 'number' ? String(id) : undefined;\n}\n\n/**\n * The `body` slot, the framework's: the planned `body` tree in its\n * `<div data-buro-region=\"record-body\" data-buro-slot=\"body\">`, inside the screen's `<form>` (with\n * the draft banner and the submit wiring) in edit and create. A frame places it; it cannot omit\n * or replace the form (P6-70).\n */\nfunction BodySlot(): ReactElement {\n const frame = useRecordFrame();\n const { resource, mode, controller } = frame;\n const chrome = useFrameChrome();\n const tid = useTestIds();\n const id = frameRecordId(frame);\n const tree = (\n <div data-buro-region=\"record-body\" data-buro-slot={FORM_SLOT}>\n <ScreenTree\n region=\"record\"\n slot={FORM_SLOT}\n resource={resource}\n mode={mode}\n compiled={controller.screen}\n controller={controller}\n />\n </div>\n );\n if (mode === 'show') return tree;\n return (\n <form\n id={chrome.formId}\n noValidate\n data-testid={tid.form(resource, mode, id)}\n onSubmit={(event) => {\n event.preventDefault();\n // Enter inside a wizard step before the last one moves on, as Next does.\n const steps = controller.steps;\n if (\n steps !== null &&\n steps.current !== undefined &&\n steps.current !== steps.ids[steps.ids.length - 1]\n )\n void steps.next();\n else void chrome.submit();\n }}\n className=\"flex flex-col gap-4\"\n >\n <DraftBanner />\n {tree}\n </form>\n );\n}\n\n/** A display slot: its planned tree, the stack carrying `data-buro-slot` (no region). */\nfunction DisplaySlot({ name }: { readonly name: string }): ReactElement {\n const { resource, mode, controller } = useRecordFrame();\n return (\n <ScreenTree\n region=\"record\"\n slot={name}\n resource={resource}\n mode={mode}\n compiled={controller.screen}\n controller={controller}\n />\n );\n}\n\n/**\n * One slot of a record frame, as the frame receives it (spec 3.3): `body` the form slot, every\n * other slot display-only. A slot mounted twice at once renders once (`frame.slot-twice`).\n */\nexport function SlotWrapper({ name }: { readonly name: string }): ReactElement | null {\n const first = useSlotOnce(name);\n if (!first) return null;\n return name === FORM_SLOT ? <BodySlot /> : <DisplaySlot name={name} />;\n}\n","'use client';\nimport {\n type AnyFrameHandle,\n builtinFrames,\n type CompiledScreen,\n type EntityRef,\n FORM_SLOT,\n fieldSensitivity,\n formatEntityRef,\n type PlanNode,\n} from '@burojs/core';\nimport {\n type RecordFrameViewProps,\n policyRecordOf,\n useApp,\n useFieldAccess,\n useFrameImplementations,\n useFrameT,\n useQuickEntry,\n useRecordFrame,\n} from '@burojs/react';\nimport { type ReactElement, Suspense, useEffect, useMemo, useRef } from 'react';\nimport { useShownItemActions } from '../actions/action-overflow.js';\nimport { useFrameChrome } from '../record/frame-context.js';\nimport { RecordState } from '../record/record-state.js';\nimport { ChangeTypeButton, HeaderTypeNotice, TypeChromeDrawnContext } from './builtin-record.js';\nimport { isBuiltinRecordView, resolveFrameView } from './resolve.js';\nimport { FrameObligations } from './obligations.js';\nimport { SlotWrapper } from './slot-wrapper.js';\n\nconst NO_ROOT = { current: null };\n\ntype Row = Readonly<Record<string, unknown>>;\n\n/**\n * The field names the plan draws with a value (a `ready` field leaf), in any slot. A `pending` or\n * `failed` leaf (access still undecided, or its read failed) draws no value, so its field is not\n * drawn: the record never carries what the screen has not yet been allowed to show.\n */\nfunction drawnFields(roots: readonly PlanNode[], compiled: CompiledScreen, out: Set<string>): void {\n for (const node of roots) {\n if (node.state === 'absent') continue;\n const field = node.field ?? compiled.nodes[node.index]?.field;\n if (node.kind === 'field' && field !== undefined && node.state === 'ready') out.add(field);\n drawnFields(node.children, compiled, out);\n }\n}\n\n/**\n * The record a frame view receives as its `record` prop (P6-66, spec 3.3): the id field, and the\n * fields the plan draws with a value (`ready`) in some slot that are not `sensitive` (Known\n * finding 11). The prop never holds an unplaced, sensitive, rule-hidden or undecided field.\n *\n * `visible` is P5's field view (spec 3.6.4): a field the user may not view, or whose access is\n * still undecided, is dropped even when the plan drew it. That guarantee covers the prop only.\n * `useRecordFrame().record` and `.controller` are trusted-frame APIs; a frame is trusted code.\n */\nexport function frameRecord(\n record: Row | undefined,\n compiled: CompiledScreen | null,\n slots: Readonly<Record<string, readonly PlanNode[]>> | undefined,\n idField: string,\n visible: (name: string) => boolean = () => true,\n): Row | undefined {\n if (record === undefined || compiled === null || slots === undefined) return undefined;\n const drawn = new Set<string>();\n for (const roots of Object.values(slots)) drawnFields(roots, compiled, drawn);\n const declarations = new Map(compiled.fields.map((entry) => [entry.name, entry.declaration]));\n const out: Record<string, unknown> = {};\n if (Object.hasOwn(record, idField)) out[idField] = record[idField];\n for (const name of drawn) {\n if (!Object.hasOwn(record, name) || !visible(name)) continue;\n if (fieldSensitivity(declarations.get(name)) !== undefined) continue;\n out[name] = record[name];\n }\n return Object.freeze(out);\n}\n\n/** The slots the screen fills: every compiled slot with planned roots. */\nfunction declaredSlots(compiled: CompiledScreen | null): readonly string[] {\n if (compiled === null) return [];\n return Object.entries(compiled.slots)\n .filter(([, nodes]) => nodes.length > 0)\n .map(([name]) => name);\n}\n\n/**\n * The frame this instance draws: `<RecordScreen frame>` when its slots cover every slot the\n * screen fills (else one development error and the screen's own), else the compiled screen's\n * effective frame (screen ← app ← `buro:record`).\n */\nfunction useEffectiveFrame(instance: AnyFrameHandle | undefined): {\n readonly ref: EntityRef;\n readonly slotNames: readonly string[];\n} {\n const { resource, mode, controller } = useRecordFrame();\n const compiled = controller.screen;\n const missing = useMemo(() => {\n if (instance === undefined || instance.for !== 'record') return undefined;\n const own = new Set(Object.keys(instance.slots));\n return declaredSlots(compiled).find((slot) => !own.has(slot));\n }, [instance, compiled]);\n const told = useRef(false);\n const instanceId = instance === undefined ? undefined : formatEntityRef(instance.ref);\n useEffect(() => {\n if (missing === undefined || told.current || process.env.NODE_ENV === 'production') return;\n told.current = true;\n console.error(\n `[burojs] <RecordScreen frame={${instanceId}}> lacks the slot ${missing} that ${resource}'s ${mode} screen fills; the screen's own frame draws it.`,\n );\n }, [missing, instanceId, resource, mode]);\n if (\n instance !== undefined &&\n instance.for === 'record' &&\n missing === undefined &&\n compiled !== null\n )\n return { ref: instance.ref, slotNames: Object.keys(instance.slots) };\n const ref = compiled?.frame ?? builtinFrames.record.ref;\n return {\n ref,\n slotNames: compiled === null ? ['header', FORM_SLOT] : Object.keys(compiled.slots),\n };\n}\n\n/**\n * Draws the record screen's frame (spec 3.3): the view resolved from the frame reference, its\n * slots each inside the framework's wrapper (`body` holding the form), `null` for a slot that is\n * absent in this mode, omitted or planned empty. Under a custom frame the framework draws the\n * undeclared-type notice and Change type above the frame (P6-70).\n */\nexport function RecordFrameView({\n frame: instance,\n}: {\n readonly frame?: AnyFrameHandle;\n}): ReactElement {\n const { resource, mode, controller, record } = useRecordFrame();\n const chrome = useFrameChrome();\n const quick = useQuickEntry();\n const app = useApp();\n const catalog = useFrameImplementations();\n const { ref, slotNames } = useEffectiveFrame(instance);\n const id = formatEntityRef(ref);\n const resolved = useMemo(() => resolveFrameView(ref, catalog, 'record'), [ref, catalog]);\n const t = useFrameT(id);\n const compiled = controller.screen;\n const plan = controller.plan;\n const slots: Record<string, ReactElement | null> = {};\n for (const name of slotNames) {\n if (name === FORM_SLOT) {\n slots[name] = <SlotWrapper key={name} name={name} />;\n continue;\n }\n const roots = plan?.slots[name] ?? [];\n slots[name] = roots.every((node) => node.state === 'absent') ? null : (\n <SlotWrapper key={name} name={name} />\n );\n }\n slots[FORM_SLOT] ??= <SlotWrapper name={FORM_SLOT} />;\n const idField =\n (app.registry.get(resource) as { readonly data?: { readonly idField?: string } } | undefined)\n ?.data?.idField ?? 'id';\n // P5 field view in record reach, decided over the row as read; pending is not visible.\n const access = useFieldAccess(\n resource,\n 'record',\n record === undefined ? undefined : policyRecordOf(controller, record),\n );\n const projected = useMemo(\n () =>\n frameRecord(\n record,\n compiled,\n plan?.slots,\n idField,\n (name) => access[name]?.view === 'visible',\n ),\n [record, compiled, plan, idField, access],\n );\n const quickHost = chrome.hostTitle === true && quick !== null;\n const props: RecordFrameViewProps = {\n slots: slots as RecordFrameViewProps['slots'],\n host: quickHost ? quick.host : 'page',\n mode,\n screen: { resource, entry: quickHost ? 'quick' : 'route' },\n record: mode === 'create' ? undefined : projected,\n t,\n };\n // Item actions on the show surface (the runtime check of `<RecordActions/>`, P6-15).\n // Item actions are policy (P5 decision 12): their gates read the row as read.\n const policyRecord = policyRecordOf(controller, record);\n const rowId = record?.[idField];\n const actionRow = useMemo(\n () => ({\n ...(policyRecord ?? {}),\n id: typeof rowId === 'string' || typeof rowId === 'number' ? String(rowId) : '',\n }),\n [policyRecord, rowId],\n );\n const showItemActions = useShownItemActions(resource, actionRow, 'show');\n const showActions = mode === 'show' && record !== undefined && showItemActions.length > 0;\n const View = resolved.view;\n const builtin = isBuiltinRecordView(resolved);\n return (\n <>\n {builtin ? null : (\n <>\n <HeaderTypeNotice resource={resource} />\n <ChangeTypeButton />\n </>\n )}\n <TypeChromeDrawnContext.Provider value={!builtin}>\n <Suspense fallback={<RecordState state=\"loading\" />}>\n <FrameObligations\n id={id}\n mode={mode}\n showActions={showActions}\n root={chrome.root ?? NO_ROOT}\n >\n <View {...props} />\n </FrameObligations>\n </Suspense>\n </TypeChromeDrawnContext.Provider>\n </>\n );\n}\n","'use client';\nimport type { TypeOfferState } from '@burojs/core';\nimport { useApp, useOptionalT, useTestIds } from '@burojs/react';\nimport type { ReactElement } from 'react';\nimport { FieldDisplay } from '../forms/field.js';\nimport { Skeleton } from '../primitives/skeleton.js';\n\nexport interface TypeOfferProps {\n /** The resource's canonical name. */\n readonly resource: string;\n readonly offer: TypeOfferState;\n readonly onChoose: (type: string) => void;\n}\n\n/**\n * The built-in type offer of a typed create (P1b+P1c decision 24): one option\n * per offered type, in declaration order, each shown as the discriminator's\n * value (its label and icon, through the field's display). Pending while the\n * offer's `scope` is; an empty offer says so.\n */\nexport function TypeOffer({ resource, offer, onChoose }: TypeOfferProps): ReactElement {\n const app = useApp();\n const t = useOptionalT();\n const tid = useTestIds();\n const def = app.registry.get(resource);\n const by = def?.types?.by;\n const field = by === undefined ? undefined : def?.fields[by];\n const ref = def?.ref ?? { namespace: 'default', id: resource };\n return (\n <section aria-labelledby=\"type-offer-title\" className=\"flex flex-col gap-3\">\n <div className=\"flex flex-col gap-1\">\n <h2 id=\"type-offer-title\" className=\"text-base font-semibold\">\n {t('create.typeOffer.title', { defaultValue: 'Choose a type' })}\n </h2>\n <p className=\"text-sm text-muted-foreground\">\n {t('create.typeOffer.hint', {\n defaultValue: 'The type decides which fields the record has.',\n })}\n </p>\n </div>\n {offer.status === 'pending' ? (\n <div aria-busy=\"true\" className=\"flex flex-col gap-2\">\n <Skeleton className=\"h-10 w-full\" />\n <Skeleton className=\"h-10 w-full\" />\n </div>\n ) : offer.types.length === 0 ? (\n <p role=\"status\" className=\"text-sm text-muted-foreground\">\n {t('create.typeOffer.empty', { defaultValue: 'No type can be created here.' })}\n </p>\n ) : (\n <ul className=\"grid grid-cols-1 gap-2 sm:grid-cols-2\">\n {offer.types.map((type) => (\n <li key={type}>\n <button\n type=\"button\"\n data-testid={tid.typeOffer(resource, type)}\n onClick={() => onChoose(type)}\n className=\"flex w-full items-center gap-2 rounded-md border px-3 py-2 text-left text-sm hover:bg-muted focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring\"\n >\n {by === undefined || field === undefined ? (\n type\n ) : (\n <FieldDisplay\n resource={ref}\n name={by}\n field={field as never}\n value={type}\n fallback={<span>{type}</span>}\n />\n )}\n </button>\n </li>\n ))}\n </ul>\n )}\n </section>\n );\n}\n","'use client';\nimport {\n type AnyFrameHandle,\n type FrameHandle,\n type ResourceHandle,\n canonicalEntityNodeKey,\n normalizeEntityRef,\n} from '@burojs/core';\nimport {\n type FormController,\n RecordFrameContext,\n type RecordFrameValue,\n RecordScopeProvider,\n ResourceContext,\n RouteSourceContext,\n ScreenStateProvider,\n useApp,\n useFormController,\n useNavigationGuardText,\n useOptionalRouterAdapter,\n usePublishDocVariant,\n useRouteNavigate,\n useTestIds,\n} from '@burojs/react';\nimport {\n type ReactElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { CheckConfirmDialog } from '../checks/check-confirm-dialog.js';\nimport { DeepLinkScope } from '../quick/use-deep-link.js';\nimport { FormControlProvider } from '../resource/form-context.js';\nimport { UndeclaredTypeNotice } from '../frames/builtin-record.js';\nimport { RecordFrameView } from '../frames/record-frame-host.js';\nimport { frameRecordId } from '../frames/slot-wrapper.js';\nimport { useTabsUrlState } from '../screen/use-tabs-url-state.js';\nimport { type FrameChrome, FrameChromeContext } from './frame-context.js';\nimport { FormActions } from './frame-pieces.js';\nimport { RecordState } from './record-state.js';\nimport {\n QuickScreenClaimContext,\n RouteScreenClaimContext,\n RouteScreenContext,\n useIsRouteScreen,\n} from './route-screen-context.js';\nimport { TypeOffer } from './type-offer.js';\n\n// biome-ignore lint/suspicious/noExplicitAny: any resource handle\ntype AnyResourceHandle = ResourceHandle<any, any, any, any>;\n\nexport interface RecordScreenProps {\n /** A canonical resource name, or its handle. */\n readonly resource: string | AnyResourceHandle;\n readonly mode: 'show' | 'edit' | 'create';\n /** The record to read (show, edit); not needed when `record` is given. */\n readonly recordId?: string;\n /**\n * The accepted type of a typed create. Without a router, changing it remounts the form for the\n * new type and discards unsaved input without asking for confirmation.\n */\n readonly type?: string;\n /** A row the caller already holds: nothing is read. */\n readonly record?: Readonly<Record<string, unknown>>;\n /** The caller's starting values of a create, above the field defaults. */\n readonly defaults?: Readonly<Record<string, unknown>>;\n /**\n * User input for a create (a search text typed into a relation select): after the first settled\n * plan each key whose field the plan holds `active` is set once, as the user typing it would\n * (the form is dirty); any other key is dropped. Not a default, never trusted.\n */\n readonly input?: Readonly<Record<string, unknown>>;\n /** Replaces the built-in update or create; receives the payload. */\n readonly onSubmit?: (payload: Record<string, unknown>) => Promise<unknown>;\n /** Called after a successful submit with what the write returned. */\n readonly onSuccess?: (result: unknown) => void;\n /** Replaces Cancel's default back navigation. */\n readonly onCancel?: () => void;\n /** The submit button's label. */\n readonly submitLabel?: string;\n /** Rendered after the record's actions in show. */\n readonly extraActions?: ReactNode;\n /**\n * This instance's record frame (code only): used when its slots cover every slot the screen\n * fills, else a development error and the screen's own frame (spec 3.3).\n */\n readonly frame?: FrameHandle<'record'> | AnyFrameHandle;\n}\n\n/** An `AbortError` by name, from any realm. */\nfunction isAbort(error: unknown): boolean {\n if (error === null || (typeof error !== 'object' && typeof error !== 'function')) return false;\n try {\n return (error as { readonly name?: unknown }).name === 'AbortError';\n } catch {\n return false;\n }\n}\n\n/** The canonical name of a resource prop. */\nfunction canonicalName(resource: RecordScreenProps['resource']): string {\n const ref = normalizeEntityRef(typeof resource === 'string' ? resource : resource.ref);\n return canonicalEntityNodeKey({ name: ref.id, ref });\n}\n\nfunction frameId(frame: RecordFrameValue): string | undefined {\n return frameRecordId(frame);\n}\n\ninterface FrameHostProps extends Omit<RecordScreenProps, 'resource'> {\n readonly resource: string;\n /** A typed create: sets (or, with `undefined`, clears) the chosen type. */\n readonly chooseType: (type: string | undefined) => void;\n /** A quick entry's own screen: the host draws the title. */\n readonly hostTitle: boolean;\n}\n\n/** Mounts the controller inside the screen state, provides the frame, renders it. */\nfunction RecordFrameHost(props: FrameHostProps): ReactElement {\n const { resource, mode } = props;\n const controller: FormController = useFormController({\n resource,\n mode,\n ...(props.recordId === undefined ? {} : { recordId: props.recordId }),\n ...(props.type === undefined ? {} : { type: props.type }),\n ...(props.record === undefined ? {} : { record: props.record as Record<string, unknown> }),\n ...(props.defaults === undefined\n ? {}\n : { defaults: props.defaults as Record<string, unknown> }),\n ...(props.onSubmit === undefined ? {} : { onSubmit: props.onSubmit }),\n // A quick entry's own screen plans the entry's body: its declared one, else the route's.\n ...(props.hostTitle ? { entry: 'quick' as const } : {}),\n });\n // The caller's input, once, after the plan settles: only to fields the plan holds active\n // (P5's `field/edit` and `system` decide), through the same `setValue` the user's typing uses.\n const inputApplied = useRef(false);\n const { input } = props;\n const plan = controller.plan;\n useEffect(() => {\n if (inputApplied.current || input === undefined || mode !== 'create' || plan === null) return;\n inputApplied.current = true;\n for (const [key, value] of Object.entries(input))\n if (plan.fields[key] === 'active') controller.setValue(key, value);\n }, [input, mode, plan, controller]);\n const tid = useTestIds();\n const formId = `record-form-${useId()}`;\n const root = useRef<HTMLDivElement>(null);\n const [submitError, setSubmitError] = useState<unknown>(undefined);\n const latest = useRef({ controller, onSuccess: props.onSuccess });\n latest.current = { controller, onSuccess: props.onSuccess };\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const submit = useCallback(async () => {\n setSubmitError(undefined);\n const outcome = await latest.current.controller.submit();\n if (!mounted.current) return;\n if (outcome.status === 'submitted') latest.current.onSuccess?.(outcome.result);\n // An aborted write saved nothing and failed nothing the user must read about.\n else if (outcome.status === 'failed' && !isAbort(outcome.error))\n setSubmitError(outcome.error ?? null);\n }, []);\n const record = controller.record;\n const frame = useMemo<RecordFrameValue>(\n () => ({ resource, recordId: props.recordId, mode, record, controller }),\n [resource, props.recordId, mode, record, controller],\n );\n // A typed create whose type was accepted can go back to the offer.\n const { chooseType } = props;\n const typedAndAccepted =\n mode === 'create' && controller.typeOffer !== null && controller.failure === null;\n // Change type remounts the form under a new key. A route screen asks the unsaved-changes\n // guard (it navigates); anywhere else nothing would, so a dirty form asks here first, with the\n // guard's own text and the same `window.confirm` fallback (final review I2).\n const routeScreen = useIsRouteScreen();\n const adapter = useOptionalRouterAdapter();\n const hostRouter = routeScreen ? adapter : null;\n const guardText = useNavigationGuardText();\n const changeType = useMemo(\n () =>\n typedAndAccepted\n ? () => {\n if (\n hostRouter === null &&\n latest.current.controller.isDirty &&\n !window.confirm(`${guardText.title}\\n\\n${guardText.body}`)\n )\n return;\n chooseType(undefined);\n }\n : undefined,\n [typedAndAccepted, chooseType, hostRouter, guardText.title, guardText.body],\n );\n // A typed resource's record whose discriminator names no declared type (decision 64): show\n // renders the base tree with a notice, edit refuses (fail closed).\n const app = useApp();\n const typesDecl = (\n app.registry.get(resource) as\n | { readonly types?: { readonly by: string; readonly items: readonly { name: string }[] } }\n | undefined\n )?.types;\n const loaded = controller.record;\n const unsupportedType = useMemo<string | null | undefined>(() => {\n if (mode === 'create' || typesDecl === undefined || loaded === undefined) return undefined;\n const value = loaded[typesDecl.by];\n const name = typeof value === 'string' && value !== '' ? value : null;\n return name !== null && typesDecl.items.some((item) => item.name === name) ? undefined : name;\n }, [mode, typesDecl, loaded]);\n const chrome = useMemo<FrameChrome>(\n () => ({\n ...(props.onCancel === undefined ? {} : { onCancel: props.onCancel }),\n ...(props.submitLabel === undefined ? {} : { submitLabel: props.submitLabel }),\n ...(props.extraActions === undefined ? {} : { extraActions: props.extraActions }),\n ...(changeType === undefined ? {} : { changeType }),\n ...(unsupportedType === undefined ? {} : { unsupportedType }),\n ...(props.hostTitle ? { hostTitle: true as const } : {}),\n formId,\n submitError,\n submit,\n root,\n }),\n [\n props.onCancel,\n props.submitLabel,\n props.extraActions,\n changeType,\n unsupportedType,\n props.hostTitle,\n formId,\n submitError,\n submit,\n ],\n );\n usePublishDocVariant(mode === 'show' ? resource : undefined, record as Record<string, unknown>);\n const failure = controller.failure;\n // A typed create without an accepted type shows the offer: the normal path, not a failure.\n const offering = failure?.kind === 'type-required' && controller.typeOffer !== null;\n useEffect(() => {\n if (failure === null || offering || process.env.NODE_ENV === 'production') return;\n console.error(\n `[burojs] <RecordScreen resource=\"${resource}\" mode=\"${mode}\"> cannot render its screen: ${\n failure.kind === 'screen'\n ? `${failure.failure.code} at ${failure.failure.path.join('.')}: ${failure.failure.message}`\n : 'a typed create needs an accepted type'\n }.`,\n );\n }, [failure, offering, resource, mode]);\n const setValues = useCallback((patch: Record<string, unknown>) => {\n for (const [name, value] of Object.entries(patch))\n latest.current.controller.setValue(name, value);\n }, []);\n const formControl = useMemo(() => ({ setValues }), [setValues]);\n const id = frameId(frame);\n const rootId =\n mode === 'show'\n ? tid.pageShow(resource, id ?? '')\n : mode === 'edit'\n ? tid.pageEdit(resource, id ?? '')\n : tid.pageCreate(resource);\n // The route source is this screen's controller's alone (spec 4.5): anything below it — a\n // block that mounts its own form controller — reads `{}`.\n // The record's scope frame (read-scope spec §4 rule 1): show narrows the reads below it by the\n // read record, edit and create by the live form values, so a changed scope field re-scopes them.\n const scopeValues = mode === 'show' ? controller.record : controller.values;\n return (\n <RecordScopeProvider\n resource={resource}\n {...(props.recordId === undefined ? {} : { recordId: props.recordId })}\n values={scopeValues}\n >\n <RouteSourceContext.Provider value={null}>\n <RecordFrameContext.Provider value={frame}>\n <FrameChromeContext.Provider value={chrome}>\n <FormControlProvider value={formControl}>\n <DeepLinkScope plan={controller.plan} enabled={routeScreen && mode !== 'create'}>\n <div\n ref={root}\n data-testid={rootId}\n className=\"flex flex-col gap-[var(--buro-section-gap)]\"\n >\n {offering && controller.typeOffer !== null ? (\n <TypeOffer\n resource={resource}\n offer={controller.typeOffer}\n onChoose={(type) => chooseType(type)}\n />\n ) : failure !== null ? (\n <>\n <RecordState state=\"error\" />\n <FormActions />\n </>\n ) : mode === 'edit' && unsupportedType !== undefined ? (\n <UndeclaredTypeNotice resource={resource} typeValue={unsupportedType} />\n ) : (\n <RecordFrameView\n {...(props.frame === undefined ? {} : { frame: props.frame })}\n />\n )}\n </div>\n </DeepLinkScope>\n {controller.checkGate === null ? null : (\n <CheckConfirmDialog\n state={controller.checkGate}\n testid={`${tid.form(resource, mode, id)}:checks`}\n />\n )}\n </FormControlProvider>\n </FrameChromeContext.Provider>\n </RecordFrameContext.Provider>\n </RouteSourceContext.Provider>\n </RecordScopeProvider>\n );\n}\n\n/**\n * A record's show, edit or create screen outside a route (P1b+P1c decision\n * 20): the planned screen in its frame (the screen's, the app's, the built-in\n * one, or this instance's `frame`). Reads the record by `recordId` unless\n * `record` is given; writes with the resource's update or create unless\n * `onSubmit` is given. A resource the app does not know renders not-found.\n */\nexport function RecordScreen(props: RecordScreenProps): ReactElement {\n const app = useApp();\n // The route's own screen claims the route (a screen nested in it is not one).\n const routeScreen = useContext(RouteScreenClaimContext);\n // A quick entry's own screen (P3-14): not a route screen, but it reads the entry's `route`.\n const quickScreen = useContext(QuickScreenClaimContext);\n // Only the route's (or the quick entry's) own screen reads `route`; a nested one reads `{}`.\n const route = useContext(RouteSourceContext);\n const resource = canonicalName(props.resource);\n // Above the screen state, which it controls: the URL's keyed tabs reach the plan.\n const tabs = useTabsUrlState(props.mode, routeScreen);\n // A typed create's type (decision 24): on a route screen under a router, the URL's `?type=`\n // (a choice navigates, guarded, keeping the other parameters); anywhere else — no router, or\n // a screen beside the page's own such as a quick entry — this component's own state, so the\n // page's URL is left alone (P3-35). Either way the controller re-checks it against the offer.\n const adapter = useOptionalRouterAdapter();\n const router = routeScreen ? adapter : null;\n const navigate = useRouteNavigate();\n const [local, setLocal] = useState(props.type);\n // A new `type` prop replaces the local choice (a host following its own state remounts the\n // form for the new type, and the payload follows it).\n const [typeProp, setTypeProp] = useState(props.type);\n if (props.type !== typeProp) {\n setTypeProp(props.type);\n setLocal(props.type);\n }\n // Under a router a `type` prop is the starting choice; once the user picks or changes the\n // type through the offer, the URL's `?type=` decides (final review M1).\n const [chose, setChose] = useState(false);\n const fromUrl = router?.searchParams.get('type') ?? undefined;\n const type =\n props.mode !== 'create'\n ? props.type\n : router === null\n ? local\n : chose\n ? fromUrl\n : (props.type ?? fromUrl);\n const chooseType = useCallback(\n (next: string | undefined) => {\n if (router === null) {\n setLocal(next);\n return;\n }\n setChose(true);\n const params = new URLSearchParams(router.searchParams);\n if (next === undefined) params.delete('type');\n else params.set('type', next);\n const query = params.toString();\n navigate(query === '' ? router.pathname : `${router.pathname}?${query}`);\n },\n [router, navigate],\n );\n if (app.registry.get(resource) === undefined) return <RecordState state=\"not-found\" />;\n const { type: _declared, ...rest } = props;\n return (\n <RouteScreenClaimContext.Provider value={false}>\n <QuickScreenClaimContext.Provider value={false}>\n <RouteSourceContext.Provider value={routeScreen || quickScreen ? route : null}>\n <RouteScreenContext.Provider value={routeScreen}>\n <ResourceContext.Provider value={{ resource }}>\n <ScreenStateProvider open={tabs.open} onOpenChange={tabs.onOpenChange}>\n <RecordFrameHost\n key={type ?? ''}\n {...rest}\n {...(type === undefined ? {} : { type })}\n resource={resource}\n chooseType={chooseType}\n hostTitle={quickScreen}\n />\n </ScreenStateProvider>\n </ResourceContext.Provider>\n </RouteScreenContext.Provider>\n </RouteSourceContext.Provider>\n </QuickScreenClaimContext.Provider>\n </RouteScreenClaimContext.Provider>\n );\n}\n","'use client';\nimport { useApp } from '@burojs/react';\nimport { useCallback, useEffect, useSyncExternalStore } from 'react';\n\n/**\n * What a record or page-flow route tells the header's trail once it has\n * decided what to show: the record's title, and a page-hosted flow's label.\n * The page publishes it only from the states that display the record — a\n * loaded show or edit page, a flow's form or its \"not available\" notice — so a\n * loading, not-found or forbidden route publishes nothing, and the header's\n * trail ends at the id there. The header never reads the record itself: the\n * page's gates (permissions, row rules, projection) decide what it may name.\n */\nexport interface PublishedRecordTrail {\n /** The route the entry belongs to, from `recordTrailKey`. */\n readonly key: string;\n /** The record's display title; `''` when it has none and the id stands in. */\n readonly title: string;\n /** A page-hosted flow's label: the trail's current crumb on the flow's route. */\n readonly flowLabel?: string;\n}\n\ninterface Store {\n current: PublishedRecordTrail | null;\n readonly listeners: Set<() => void>;\n}\n\n/** One store per app: two apps on one page never read each other's trail. */\nconst stores = new WeakMap<object, Store>();\n\nfunction storeOf(app: object): Store {\n let store = stores.get(app);\n if (store === undefined) {\n store = { current: null, listeners: new Set() };\n stores.set(app, store);\n }\n return store;\n}\n\nfunction set(store: Store, value: PublishedRecordTrail | null): void {\n store.current = value;\n for (const listener of store.listeners) listener();\n}\n\n/** The key of a record route (`show`/`edit`/`create`) or of a page-hosted flow's route. */\nexport function recordTrailKey(resource: string, id: string, route: string): string {\n return JSON.stringify([resource, id, route]);\n}\n\n/**\n * Publishes `entry` for as long as the calling component is mounted with it;\n * `null` publishes nothing. Unmounting, or a new entry, withdraws the old one.\n *\n * The store holds ONE entry per app, and the last writer wins: when two\n * mounted components publish at once, the later effect replaces the earlier\n * entry, and the earlier one's cleanup no longer clears it (it only clears an\n * entry that is still its own). The header reads the entry only for its own\n * route key, so the one page that owns the route should be the only publisher.\n */\nexport function usePublishRecordTrail(entry: PublishedRecordTrail | null): void {\n const app = useApp();\n const key = entry?.key;\n const title = entry?.title;\n const flowLabel = entry?.flowLabel;\n useEffect(() => {\n if (key === undefined || title === undefined) return;\n const store = storeOf(app);\n const value: PublishedRecordTrail = {\n key,\n title,\n ...(flowLabel === undefined ? {} : { flowLabel }),\n };\n set(store, value);\n return () => {\n if (store.current === value) set(store, null);\n };\n }, [app, key, title, flowLabel]);\n}\n\n/** The entry the route `key` published, or `null` while it has published none. */\nexport function usePublishedRecordTrail(key: string): PublishedRecordTrail | null {\n const store = storeOf(useApp());\n const subscribe = useCallback(\n (listener: () => void) => {\n store.listeners.add(listener);\n return () => {\n store.listeners.delete(listener);\n };\n },\n [store],\n );\n const current = useSyncExternalStore(\n subscribe,\n () => store.current,\n () => null,\n );\n return current !== null && current.key === key ? current : null;\n}\n","'use client';\nimport {\n type AppRuntime,\n type I18nCaps,\n type NavGroupDef,\n type NavNode,\n type RouteMatch,\n type ScreenMode,\n matchPath,\n navHrefFor,\n resolveNavLabel,\n declaredText,\n} from '@burojs/core';\nimport { resolveRoute, useApp, useI18nCaps, useT } from '@burojs/react';\nimport { canonicalNavKey } from '../resource-key.js';\nimport type { BreadcrumbsProps } from './breadcrumbs.js';\nimport { isShowAvailable, recordRouteAvailable, showTarget } from './record-targets.js';\nimport { useNavVisible } from './use-nav-routing.js';\n\n/**\n * The one trail builder. The header draws the only trail of a page\n * (`<HeaderBreadcrumbs>`), record and flow routes included; every shape comes\n * from here and renders through `<Breadcrumbs>`, so a group crumb follows one\n * rule everywhere: a link to the group's first reachable member, or text when\n * it has none.\n */\nexport interface Crumb {\n label: string;\n href?: string;\n}\n\nexport interface TrailContext {\n readonly registry: AppRuntime['registry'];\n readonly caps: I18nCaps;\n readonly isVisible: (node: NavNode) => boolean;\n readonly t: (key: string) => string;\n}\n\n/** What every trail reads: the registry, the i18n caps, the nav visibility predicate and `t`. */\nexport function useTrailContext(): TrailContext {\n const app = useApp();\n const caps = useI18nCaps();\n const isVisible = useNavVisible();\n const t = useT();\n return { registry: app.registry, caps, isVisible, t };\n}\n\n/**\n * A group crumb's link, or none when the group has no reachable target — a\n * pathless group's `navHrefFor` throws then, and a pathed one's resolves to a\n * root `matchPath` refuses. Either way the crumb renders as text.\n */\nexport function groupCrumbHref(\n registry: AppRuntime['registry'],\n group: string,\n isVisible: (node: NavNode) => boolean,\n): string | undefined {\n let href: string;\n try {\n href = navHrefFor(registry, group, { isVisible });\n } catch {\n return undefined;\n }\n return matchPath(registry, href, { isVisible }) === null ? undefined : href;\n}\n\nexport function groupCrumbs(ctx: TrailContext, chain: readonly NavGroupDef[]): Crumb[] {\n return chain.map((group) => {\n const key = canonicalNavKey(group);\n return {\n label: resolveNavLabel(ctx.caps, `groups.${key}`, declaredText('chrome', group, 'label')),\n href: groupCrumbHref(ctx.registry, key, ctx.isVisible),\n };\n });\n}\n\n/** The crumbs, or `undefined` when there are none — `<Breadcrumbs>` then renders no leading run. */\nexport function nonEmpty(crumbs: Crumb[]): Crumb[] | undefined {\n return crumbs.length > 0 ? crumbs : undefined;\n}\n\n/** The record action a route match addresses, or `undefined`. */\nexport function recordActionOf(match: RouteMatch | null): ScreenMode | undefined {\n if (match === null || match.kind !== 'resource') return undefined;\n switch (match.action) {\n case 'show':\n case 'edit':\n case 'create':\n return match.action;\n default:\n return undefined;\n }\n}\n\nexport interface RecordTrailInput {\n readonly resource: string;\n readonly action: ScreenMode;\n /** The record id as the URL carries it; `''` on create or when none is known. */\n readonly id: string;\n /** The record's display title; `''` when none is known, and the id stands in. */\n readonly title: string;\n readonly groupChain: readonly NavGroupDef[];\n}\n\n/**\n * A record route's trail, the one `<RecordBreadcrumbs>` draws in the header: the group chain, the resource, then the record\n * (show), the record linking to show when show is available plus \"Edit\"\n * (edit), or \"Create\" (create). With no id at all it ends at the resource.\n */\nexport function recordTrail(ctx: TrailContext, input: RecordTrailInput): BreadcrumbsProps {\n const { resource, action, id } = input;\n const leadingSegments = nonEmpty(groupCrumbs(ctx, input.groupChain));\n if (action !== 'create' && id === '') return { resource, leadingSegments };\n const recordLabel = input.title || id;\n const middleSegments =\n action === 'edit'\n ? [\n isShowAvailable(ctx.registry, resource)\n ? { label: recordLabel, href: resolveRoute(showTarget(resource, id), ctx.registry) }\n : { label: recordLabel },\n ]\n : undefined;\n const pageLabel =\n action === 'create'\n ? ctx.t('breadcrumbs.create')\n : action === 'edit'\n ? ctx.t('breadcrumbs.edit')\n : recordLabel;\n return {\n resource,\n recordId: action === 'create' ? undefined : id,\n pageLabel,\n leadingSegments,\n middleSegments,\n };\n}\n\n/**\n * The route the record trail (`<RecordBreadcrumbs>`) is drawn for: a record\n * route whose operation is available — decided with `recordRouteAvailable`,\n * the router's own gate, so the trail and the router cannot disagree — or a\n * page-hosted flow's route (`flow` is its name). `id` is `''` on create.\n * `null` on every other match.\n */\nexport interface RecordTrailRoute {\n readonly resource: string;\n readonly action: ScreenMode;\n readonly id: string;\n readonly flow?: string;\n readonly groupChain: readonly NavGroupDef[];\n}\n\nexport function recordTrailRoute(\n registry: AppRuntime['registry'],\n match: RouteMatch | null,\n): RecordTrailRoute | null {\n if (match === null || match.kind !== 'resource') return null;\n const resource = canonicalNavKey(match);\n const { groupChain } = match;\n if (match.action === 'flow') {\n return { resource, action: 'show', id: match.id ?? '', flow: match.flow ?? '', groupChain };\n }\n const action = recordActionOf(match);\n if (action === undefined || !recordRouteAvailable(registry, resource, action)) return null;\n return { resource, action, id: action === 'create' ? '' : (match.id ?? ''), groupChain };\n}\n\n/**\n * The header's trail for the current match, the record trail aside:\n * - a resource list: the group chain, then the resource as the current crumb;\n * - a custom page: the group chain, then the page;\n * - a group index: the chain, its last entry (the matched group) current;\n * - a record route whose operation is available, or a page-hosted flow's\n * route: nothing here — `<HeaderBreadcrumbs>` draws the record trail\n * (`<RecordBreadcrumbs>`, see `recordTrailRoute`) for those;\n * - a record route whose operation is off (the router renders not-found):\n * the group chain, the resource linking to its list, and the page's title;\n * - no match: nothing.\n */\nexport function headerTrail(ctx: TrailContext, match: RouteMatch | null): BreadcrumbsProps | null {\n if (match === null) return null;\n const key = canonicalNavKey(match);\n switch (match.kind) {\n case 'resource': {\n const leadingSegments = nonEmpty(groupCrumbs(ctx, match.groupChain));\n const action = recordActionOf(match);\n // The record trail's routes: `<RecordBreadcrumbs>` draws those.\n if (recordTrailRoute(ctx.registry, match) !== null) return null;\n if (action === undefined) return { resource: key, leadingSegments };\n return {\n resource: key,\n recordId: match.id,\n pageLabel: ctx.t('router.notFoundTitle'),\n leadingSegments,\n };\n }\n case 'custom-page': {\n const page = ctx.registry.customPages.get(match.name);\n // A page the user may not open is the route's not-found, and the header says nothing of it:\n // the same trail a missing page gets. `isVisible` is the page's `visible` and its `requires`\n // decision (the check `PageHost` makes); undecided is denied, so no label shows early.\n if (page === undefined || !ctx.isVisible(page as NavNode)) return null;\n return {\n name: key,\n pageLabel: resolveNavLabel(ctx.caps, `pages.${key}`, declaredText('chrome', page, 'label')),\n leadingSegments: nonEmpty(groupCrumbs(ctx, match.groupChain)),\n };\n }\n case 'group-index': {\n const own = match.groupChain[match.groupChain.length - 1];\n if (own === undefined) return null;\n const crumbs = groupCrumbs(ctx, match.groupChain);\n const current = crumbs[crumbs.length - 1] as Crumb;\n return {\n name: canonicalNavKey(own),\n pageLabel: current.label,\n leadingSegments: nonEmpty(crumbs.slice(0, -1)),\n };\n }\n default:\n return null;\n }\n}\n","/*\n * The recently visited records the command palette offers (internal). `<RecordPage>` writes a\n * visit as it reads a record (`./use-record-visit.ts`); the palette's Recent group reads them\n * back. Stored per signed-in user under `buro:recent:v2:<userId>`; nothing is stored without one,\n * and `@burojs/react`'s `BuroProvider` removes the list when that user signs out.\n */\n\n/** One visited record: the resource's canonical ref, the record id, its label then, and when. */\nexport interface RecentRecord {\n readonly canonicalRef: string;\n readonly id: string;\n /** Resolved when visited (alias → name → title → label → id), so a deleted record still reads. */\n readonly label: string;\n /**\n * The field the label was read from, absent when it is the id. The palette shows the label only\n * while that field is still visible to the signed-in user (P5 spec 3.8).\n */\n readonly labelField?: string;\n /** ISO time of the latest visit. */\n readonly at: string;\n}\n\ninterface RecentEnvelope {\n readonly version: 2;\n readonly items: readonly RecentRecord[];\n}\n\n/** The number of entries kept: the newest first, the oldest dropped. */\nexport const RECENT_LIMIT = 5;\n\n/** The storage key of a user's list. */\nexport function recentStorageKey(userId: string): string {\n return `buro:recent:v2:${userId}`;\n}\n\nfunction isRecent(value: unknown): value is RecentRecord {\n if (typeof value !== 'object' || value === null) return false;\n const entry = value as Record<string, unknown>;\n return (\n typeof entry.canonicalRef === 'string' &&\n typeof entry.id === 'string' &&\n typeof entry.label === 'string' &&\n (entry.labelField === undefined || typeof entry.labelField === 'string') &&\n typeof entry.at === 'string'\n );\n}\n\n/** The stored list; malformed JSON, another version or a malformed entry reads as nothing. */\nfunction parse(raw: string | null): RecentRecord[] {\n if (raw === null) return [];\n try {\n const parsed: unknown = JSON.parse(raw);\n if (typeof parsed !== 'object' || parsed === null) return [];\n const envelope = parsed as { readonly version?: unknown; readonly items?: unknown };\n if (envelope.version !== 2 || !Array.isArray(envelope.items)) return [];\n return envelope.items.filter(isRecent);\n } catch {\n return [];\n }\n}\n\n/** The user's visited records, newest first. SSR-safe; a storage error reads as nothing. */\nexport function readRecentRecords(userId: string): RecentRecord[] {\n if (typeof window === 'undefined') return [];\n try {\n return parse(window.localStorage.getItem(recentStorageKey(userId)));\n } catch {\n return [];\n }\n}\n\n/**\n * Moves `entry` to the front of the user's list (one entry per `(canonicalRef, id)`), keeping\n * `RECENT_LIMIT`. A storage error (quota, private mode) is dropped: the palette keeps what the\n * last successful write left.\n */\nexport function writeRecentRecord(userId: string, entry: RecentRecord): void {\n if (typeof window === 'undefined') return;\n try {\n const key = recentStorageKey(userId);\n const others = parse(window.localStorage.getItem(key)).filter(\n (item) => !(item.canonicalRef === entry.canonicalRef && item.id === entry.id),\n );\n const envelope: RecentEnvelope = {\n version: 2,\n items: [entry, ...others].slice(0, RECENT_LIMIT),\n };\n window.localStorage.setItem(key, JSON.stringify(envelope));\n } catch {\n // Unavailable storage: the rest of the UI keeps working.\n }\n}\n\nfunction text(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nexport const RECENT_LABEL_KEYS: readonly string[] = ['alias', 'name', 'title', 'label'];\n\n/**\n * A record's label as the palette shows it: alias, name, title, label, else its id. A field the\n * resource guards (`isGuarded`: `sensitive`, or addressed by a `field/view` rule or `requires`) is\n * never stored (it is skipped, as drafts skip it). `field` names the field the label came from.\n */\nexport function recentLabel(\n record: Readonly<Record<string, unknown>>,\n id: string,\n isGuarded: (field: string) => boolean = () => false,\n): { readonly label: string; readonly field?: string } {\n for (const key of RECENT_LABEL_KEYS) {\n if (isGuarded(key)) continue;\n const value = text(record[key]);\n if (value !== undefined) return { label: value, field: key };\n }\n return { label: id };\n}\n","'use client';\nimport { addressesCapability, fieldSensitivity } from '@burojs/core';\nimport { useApp, useCurrentUserId } from '@burojs/react';\nimport { useEffect } from 'react';\nimport { recentLabel, writeRecentRecord } from './recent-records.js';\nimport { canonicalResourceName } from '../list-kit/list-slots.js';\n\n/**\n * Records a visit of `record` of `resource` for the signed-in user (internal; `<RecordPage>`\n * calls it with the record it read). Nothing is written without a user id, while the record is\n * placeholder data, or when the record has no string or number `id`. A `sensitive` field is never\n * stored as the label. Writes again when the\n * record, its label or the user changes.\n */\nexport function useRecordVisit(\n resource: string,\n record: Readonly<Record<string, unknown>> | null | undefined,\n opts: { readonly isCurrentData: boolean },\n): void {\n const userId = useCurrentUserId();\n const raw = record?.id;\n const id = typeof raw === 'string' || typeof raw === 'number' ? String(raw) : undefined;\n const app = useApp();\n const fields = (\n app.registry.get(resource) as { readonly fields?: Record<string, unknown> } | undefined\n )?.fields;\n // A bare hook host has no rule source: nothing is addressed there.\n const rules = app.ruleSource?.rules(resource) ?? [];\n // A label never comes from a field the resource guards: `sensitive`, or addressed by a view\n // rule (an authored `field/view` rule or a lowered `requires.view`), whatever its `when` says.\n const isGuarded = (field: string) =>\n (fields !== undefined &&\n Object.hasOwn(fields, field) &&\n fieldSensitivity(fields[field]) !== undefined) ||\n addressesCapability(rules, 'view', { kind: 'field', name: field });\n const picked =\n record != null && id !== undefined ? recentLabel(record, id, isGuarded) : undefined;\n const label = picked?.label;\n const labelField = picked?.field;\n const canonicalRef = canonicalResourceName(resource);\n const { isCurrentData } = opts;\n useEffect(() => {\n if (userId === null || !isCurrentData || id === undefined || id === '') return;\n if (label === undefined) return;\n writeRecentRecord(userId, {\n canonicalRef,\n id,\n label,\n ...(labelField === undefined ? {} : { labelField }),\n at: new Date().toISOString(),\n });\n }, [userId, isCurrentData, canonicalRef, id, label, labelField]);\n}\n","'use client';\nimport {\n type AppContext,\n type ScreenMode,\n addressesCapability,\n dtoFields,\n normalizeDataError,\n} from '@burojs/core';\nimport {\n RouteSourceContext,\n useApp,\n useOne,\n useProjectedRecord,\n useOptionalDataRuntime,\n useOptionalRouterAdapter,\n useRecordTitle,\n retryRecordRead,\n useAvailabilityResolver,\n useCtx,\n useRouteNavigate,\n} from '@burojs/react';\nimport { type ReactElement, useEffect, useMemo, useRef } from 'react';\nimport { RecordScreen } from '../record/record-screen.js';\nimport { RouteScreenClaimContext } from '../record/route-screen-context.js';\nimport { type RecordErrorState, RecordState } from '../record/record-state.js';\nimport { PageHeader } from '../resource/page-header.js';\nimport { recordTrailKey, usePublishRecordTrail } from './record-trail-store.js';\nimport { listTarget, recordReturnTarget } from './record-targets.js';\nimport { recordActionOf } from './route-trail.js';\nimport { useMatch } from './use-nav-routing.js';\nimport { useRecordVisit } from './use-record-visit.js';\n\n/**\n * A record page's resource and action. Inside a record slot both default to\n * the route (`<RecordPage defaults={{ type }} />`); outside one both are\n * required, and a missing one renders not-found with a development error.\n * `defaults` exists on `create` only: show and edit render the record as it\n * is, so the type refuses it there rather than ignoring it.\n */\nexport type RecordPageProps =\n | {\n readonly resource?: string;\n readonly action: Exclude<ScreenMode, 'create'>;\n readonly defaults?: never;\n }\n | {\n readonly resource?: string;\n readonly action?: Extract<ScreenMode, 'create'>;\n /**\n * The caller's tier of starting values, above each field's declared\n * default, the matched type's `defaults` and URL prefill.\n */\n readonly defaults?: Record<string, unknown>;\n };\n\ntype RecordTarget =\n | {\n readonly resource: string;\n readonly action: Exclude<ScreenMode, 'create'>;\n readonly defaults?: never;\n }\n | {\n readonly resource: string;\n readonly action: Extract<ScreenMode, 'create'>;\n readonly defaults?: Record<string, unknown>;\n };\n\nexport type RecordRouteProps = RecordTarget & {\n /** The record id as the URL carries it; the provider coerces it. `''` renders not-found without a request. */\n readonly id: string;\n};\n\ntype RecordReadProps = RecordRouteProps & { readonly action: Exclude<ScreenMode, 'create'> };\ntype RecordCreateProps = RecordRouteProps & { readonly action: Extract<ScreenMode, 'create'> };\n\ntype LoadedRecord = { id: string } & Record<string, unknown>;\n\ninterface LoadedRecordProps {\n readonly resource: string;\n readonly id: string;\n /** The row as read: the screen projects it itself and keeps it for policy (gates, flows). */\n readonly record: LoadedRecord;\n /** The projected row: what the header and the header's trail read. */\n readonly shown: LoadedRecord;\n}\n\n/**\n * The state a failed read renders. `not-found` and `forbidden` render\n * identically (no existence oracle). `auth` is a session-expired state with no\n * Retry: the session failed rather than the request, and the runtime's auth\n * controller has already tried to recover. Every other kind — including an\n * error of no recognisable shape, which normalizes to `transport` — is the\n * error state with Retry. The mapping is the providers' job, never a status\n * fallback here.\n */\nexport function recordErrorState(error: unknown): RecordErrorState {\n const { kind } = normalizeDataError(error);\n if (kind === 'not-found' || kind === 'forbidden') return 'not-found';\n if (kind === 'auth') return 'session-expired';\n return 'error';\n}\n\n/**\n * Whether the calling component is still mounted — read after an `await`.\n * Set in the effect as well as cleared in its cleanup, so a StrictMode\n * remount reads true again.\n */\nfunction useMountedRef(): { readonly current: boolean } {\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n return mounted;\n}\n\n/**\n * The route's heading above the frame: an `sr-only` h1 that titles the page. The\n * trail is the header's (`<HeaderBreadcrumbs>`); the heading tells it the record's\n * title, which it shows in place of the id once the record is loaded.\n */\nfunction RecordRouteHeader({\n resource,\n action,\n id,\n record,\n}: {\n readonly resource: string;\n readonly action: ScreenMode;\n readonly id: string;\n readonly record?: LoadedRecord;\n}): ReactElement {\n const recordName = useRecordTitle(resource, action === 'create' ? undefined : id, record);\n usePublishRecordTrail(\n action === 'create' ? null : { key: recordTrailKey(resource, id, action), title: recordName },\n );\n return (\n <PageHeader\n resource={resource}\n mode={action}\n {...(action === 'create' ? {} : { recordName })}\n />\n );\n}\n\nfunction RecordShow({ resource, id, record, shown }: LoadedRecordProps): ReactElement {\n return (\n <div>\n <RecordRouteHeader resource={resource} action=\"show\" id={id} record={shown} />\n <RecordScreen resource={resource} mode=\"show\" recordId={id} record={record} />\n </div>\n );\n}\n\nfunction RecordEdit({ resource, id, record, shown }: LoadedRecordProps): ReactElement {\n const app = useApp();\n const navigate = useRouteNavigate();\n const mounted = useMountedRef();\n const back = recordReturnTarget(app.registry, resource, id);\n return (\n <div>\n <RecordRouteHeader resource={resource} action=\"edit\" id={id} record={shown} />\n <RecordScreen\n resource={resource}\n mode=\"edit\"\n recordId={id}\n record={record}\n onCancel={() => navigate(back)}\n onSuccess={() => {\n // The controller has released the unsaved-changes guard before resolving; a save\n // that settles after the user left navigates nowhere.\n if (mounted.current) navigate(back);\n }}\n />\n </div>\n );\n}\n\n/** The id a create returned, as the route reads it. */\nfunction createdId(result: unknown): string | undefined {\n const id = (result as { readonly id?: unknown } | null | undefined)?.id;\n return typeof id === 'string' || typeof id === 'number' ? String(id) : undefined;\n}\n\nfunction RecordCreate({ resource, defaults }: RecordCreateProps): ReactElement {\n const app = useApp();\n const navigate = useRouteNavigate();\n const mounted = useMountedRef();\n const adapter = useOptionalRouterAdapter();\n const list = listTarget(resource);\n // The accepted type of a typed create comes from the route (decision 24).\n const type = adapter?.searchParams.get('type') ?? undefined;\n return (\n <div>\n <RecordRouteHeader resource={resource} action=\"create\" id=\"\" />\n {/* The route's own screen: its typed create's `?type=` is the URL's (P3-35). */}\n <RouteScreenClaimContext.Provider value={true}>\n <RecordScreen\n resource={resource}\n mode=\"create\"\n {...(type === undefined ? {} : { type })}\n {...(defaults === undefined ? {} : { defaults })}\n onCancel={() => navigate(list)}\n onSuccess={(result) => {\n if (!mounted.current) return;\n const id = createdId(result);\n navigate(id === undefined ? list : recordReturnTarget(app.registry, resource, id));\n }}\n />\n </RouteScreenClaimContext.Provider>\n </div>\n );\n}\n\nfunction RecordRead({ resource, action, id }: RecordReadProps): ReactElement {\n const app = useApp();\n const def = app.registry.get(resource);\n // The record DTO (decision 41): the same projection the screen's source resolver reads with,\n // so the two share one request.\n const projection = useMemo(\n () => (def === undefined ? undefined : dtoFields(def, 'record')),\n [def],\n );\n const query = useOne(resource, {\n id,\n retry: retryRecordRead,\n ...(projection === undefined ? {} : { projection }),\n });\n const result = query.data as { readonly data?: unknown } | undefined;\n const read = result?.data;\n // The route row, projected once (P5 spec 3.6): the title, the breadcrumbs and the screen read\n // this and never the row as read. Placeholder data of the previous record never decides.\n const projected = useProjectedRecord(resource, read, { placeholder: query.isPlaceholderData });\n const showAvailability = useAvailabilityResolver(resource, 'show');\n const permissions = useCtx((c: AppContext) => c.permissions);\n // Only a resource with a rule on `show` is re-checked against the row it read.\n const showRuled = addressesCapability(app.ruleSource.rules(resource), 'run', {\n kind: 'action',\n name: 'show',\n });\n // A row the `show` rule does not make available (hidden, absent or disabled) is neither shown\n // nor recorded as a visit.\n const showHidden =\n showRuled &&\n read !== null &&\n typeof read === 'object' &&\n showAvailability('show', read).state !== 'available';\n // The visit waits for the re-check to settle: a loading or failed map, or placeholder data of\n // the previous record, decides nothing yet.\n const showSettled =\n !showRuled ||\n (!query.isPlaceholderData &&\n permissions?.status !== 'loading' &&\n permissions?.status !== 'error');\n // The visit is recorded from the record this route read, show and edit alike (decision 54).\n useRecordVisit(\n resource,\n projected.status === 'ready' && showSettled && !showHidden ? projected.value : null,\n { isCurrentData: !query.isPlaceholderData },\n );\n const route = useMemo(() => Object.freeze({ id }), [id]);\n const availability = useAvailabilityResolver(resource, 'edit');\n\n if (result !== undefined) {\n const record = result.data;\n if (record === null || typeof record !== 'object') {\n return <RecordState state=\"not-found\" />;\n }\n const loaded = record as LoadedRecord;\n // The route re-checks the row-level `show` rule against the row it read (P5 spec 3.16): a\n // row the rule hides is not-found in place — no navigation, no screen, no `with` reads.\n // Placeholder data of the previous record or an undecided map never decides.\n if (showRuled) {\n if (query.isPlaceholderData || permissions?.status === 'loading')\n return <RecordState state=\"loading\" />;\n if (permissions?.status === 'error') return <RecordState state=\"not-found\" />;\n if (showHidden) return <RecordState state=\"not-found\" />;\n }\n if (projected.status === 'pending' || projected.value === null)\n return <RecordState state=\"loading\" />;\n const shown = projected.value as LoadedRecord;\n // The edit route of a record whose `edit` a rule hides for this user (or that the resource\n // turned off) is not-found, as the hidden Edit control is absent: typing the URL opens no\n // form. A `disable` fallback keeps the page, read-only, with Save disabled.\n if (action === 'edit') {\n const edit = availability('edit', loaded).state;\n if (edit === 'hidden' || edit === 'absent') {\n return <RecordState state=\"not-found\" />;\n }\n }\n // The route's own screen: `state: 'url'` placements write the URL only there, and its\n // `route` source holds the URL's id (spec 4.5). The header, the breadcrumbs and the screen\n // read the projected row; the row as read decided `edit` above and nothing else.\n return (\n <RouteSourceContext.Provider value={route}>\n <RouteScreenClaimContext.Provider value={true}>\n {action === 'edit' ? (\n <RecordEdit resource={resource} id={id} record={loaded} shown={shown} />\n ) : (\n <RecordShow resource={resource} id={id} record={loaded} shown={shown} />\n )}\n </RouteScreenClaimContext.Provider>\n </RouteSourceContext.Provider>\n );\n }\n if (query.error != null) {\n const state = recordErrorState(query.error);\n return (\n <RecordState\n state={state}\n onRetry={state === 'error' ? () => void query.refetch() : undefined}\n />\n );\n }\n return <RecordState state=\"loading\" />;\n}\n\nfunction RecordRouteBody(props: RecordRouteProps): ReactElement {\n if (props.action === 'create') return <RecordCreate {...props} />;\n // Not-found without a request: `useOne` is never called for an empty id.\n if (props.id === '') {\n return <RecordState state=\"not-found\" />;\n }\n return <RecordRead {...props} />;\n}\n\n/**\n * A record route for an id the caller already resolved — what\n * `<ResourcePageRouter>` renders for its `show`, `edit` and `create` matches.\n *\n * Keyed by `${resource}:${id}`, so moving from one record to another remounts\n * the page and its form (which seeds its values once, on mount). Without a\n * data runtime it renders the error state instead of throwing: every data hook\n * throws without one, and `BuroProvider.dataRuntime` is optional. In\n * development it also logs a `console.error` naming the missing prop — the\n * user's generic error is a configuration error to the developer.\n */\nexport function RecordRoute(props: RecordRouteProps): ReactElement {\n const runtime = useOptionalDataRuntime();\n const missingRuntime = runtime === null;\n useEffect(() => {\n if (!missingRuntime || process.env.NODE_ENV === 'production') return;\n console.error(\n `[burojs] The '${props.resource}' record page has no data runtime to read or write ` +\n 'with: BuroProvider.dataRuntime is not set. Pass <BuroProvider dataRuntime={…}> ' +\n '(createDataRuntime from @burojs/react); until then record routes render the error state.',\n );\n }, [missingRuntime, props.resource]);\n if (missingRuntime) {\n return <RecordState state=\"error\" />;\n }\n return <RecordRouteBody key={`${props.resource}:${props.id}`} {...props} />;\n}\n\n/** What is wrong with a `<RecordPage>`'s inputs, as a development message, or null. */\nfunction recordPageProblem(input: {\n readonly props: RecordPageProps;\n readonly resource: string | undefined;\n readonly action: ScreenMode | undefined;\n readonly onRecordRoute: boolean;\n}): string | null {\n const { props, resource, action } = input;\n if (resource === undefined || action === undefined) {\n return (\n '[burojs] <RecordPage> needs both `resource` and `action`. Pass them; until then it ' +\n 'renders not-found.'\n );\n }\n if (!input.onRecordRoute) {\n return (\n `[burojs] <RecordPage resource=\"${resource}\" action=\"${action}\"> is not on a record ` +\n 'route (show, edit or create), so it has no record to read: render it on one, under a ' +\n 'RouterAdapterProvider. Until then it renders not-found.'\n );\n }\n if (props.defaults !== undefined && action !== 'create') {\n return `[burojs] <RecordPage defaults> applies to create only; on this '${action}' route it is ignored.`;\n }\n return null;\n}\n\n/**\n * The development messages already logged, per app: each distinct problem is\n * logged once, also under StrictMode, whose double effect run would log it twice.\n */\nconst recordPageProblemsLogged = new WeakMap<object, Set<string>>();\n\n/**\n * The record page — show, edit or create — wired to data. It reads the id\n * and the group chain from the current route match, reads with `useOne`,\n * renders the record through `<RecordScreen>` (which writes with the\n * resource's update or create), navigates after a write (show when the\n * resource has one, else the list), and renders translated loading,\n * not-found, session-expired and error states. It draws no breadcrumb trail:\n * the header's `<HeaderBreadcrumbs>` does, and shows the record's title once\n * this page has loaded it (the id until then). The open panel of a keyed tabs node lives in the URL as `?<tabsKey>=<panelKey>`.\n *\n * `<ResourcePageRouter>` renders the record route itself; a different layout is a frame on the\n * screen (`views.<mode>.frame`), never a replaced route (P6-56).\n */\nexport function RecordPage(props: RecordPageProps): ReactElement {\n const app = useApp();\n const match = useMatch();\n const id = match === null ? null : (match.id ?? '');\n const { resource, action } = props;\n const onRecordRoute = recordActionOf(match) !== undefined;\n const problem = recordPageProblem({ props, resource, action, onRecordRoute });\n useEffect(() => {\n if (problem === null || process.env.NODE_ENV === 'production') return;\n let logged = recordPageProblemsLogged.get(app);\n if (logged === undefined) {\n logged = new Set();\n recordPageProblemsLogged.set(app, logged);\n }\n if (logged.has(problem)) return;\n logged.add(problem);\n console.error(problem);\n }, [app, problem]);\n if (resource === undefined || action === undefined || id === null || !onRecordRoute) {\n return <RecordState state=\"not-found\" />;\n }\n const route: RecordTarget =\n action === 'create' ? { resource, action, defaults: props.defaults } : { resource, action };\n return <RecordRoute {...route} id={id} />;\n}\n","'use client';\nimport { type RouteMatch, hasListPage } from '@burojs/core';\nimport { useApp, useOptionalRouterAdapter, useT } from '@burojs/react';\nimport { Suspense, type ReactElement, useEffect } from 'react';\nimport { PageFlowRouteLoader } from '../flows/page-flow-loader.js';\nimport { ResourceListPage } from '../list-kit/resource-list-page.js';\nimport { NavChrome } from './nav-chrome.js';\nimport { PageHost } from './page-host.js';\nimport { RecordRoute } from './record-page.js';\nimport { recordRouteAvailable } from './record-targets.js';\nimport { recordActionOf } from './route-trail.js';\nimport { useMatch } from './use-nav-routing.js';\nimport { canonicalNavKey } from '../resource-key.js';\n\nexport interface ResourcePageRouterProps {\n match: RouteMatch;\n}\n\n/** Small \"nothing here\" panel — used for a match this router cannot dispatch. */\nfunction ResourcePageRouterEmpty(): ReactElement {\n const t = useT();\n return (\n <div\n data-testid=\"resource-page-router-empty\"\n className=\"flex flex-col items-center justify-center gap-1 px-6 py-24 text-center\"\n >\n <h2 className=\"text-base font-semibold tracking-tight\">{t('router.emptyTitle')}</h2>\n <p className=\"max-w-sm text-sm text-muted-foreground\">{t('router.emptyBody')}</p>\n </div>\n );\n}\n\n/**\n * Dispatch a resolved `RouteMatch` (from `matchPath`/`useMatch`) to the\n * framework component that renders it. Every branch is data-connected:\n *\n * - `{ kind: 'resource', action: 'list' }` → `<ResourceListPage>`, which\n * self-fetches through `useResourceList`;\n * - `show`, `edit` and `create` → `<RecordRoute>` (the\n * component `<RecordPage>` renders), which reads with `useOne`, writes with\n * `useUpdateOne`/`useCreateOne`, navigates after a write and renders the\n * record states, breadcrumbs and `?tab=`. A record route whose operation\n * the resource turned off (`operations.show: false`, …) renders the\n * not-found panel;\n * - `{ kind: 'group-index' }` → the group's index page when it has a\n * `body`, else that target's list when it is a resource;\n * - `custom-page` → the page's `body` behind the nav gate (`<PageHost>`: a\n * page whose `visible` or whose group's `visible` rejects it renders\n * not-found and mounts nothing); a page without `body` renders not-found,\n * because the host owns that route.\n *\n * A record route always renders the framework's record page: a different layout is a frame on\n * the screen (`views.<mode>.frame`), never a replaced route (P6-56).\n */\nexport function ResourcePageRouter({ match }: ResourcePageRouterProps): ReactElement {\n const app = useApp();\n const qualifiedMatch = match as RouteMatch & {\n readonly ref?: Readonly<{ namespace: string; id: string }>;\n readonly targetRef?: Readonly<{ namespace: string; id: string }>;\n };\n const resource = canonicalNavKey(qualifiedMatch);\n const target = canonicalNavKey({\n name: match.target ?? match.name,\n ref: qualifiedMatch.targetRef,\n });\n const recordAction = recordActionOf(match);\n\n switch (match.kind) {\n case 'resource': {\n if (match.action === 'list') {\n // `views.list.page: false` removes the list route (decision 50).\n const def = app.registry.get(resource);\n return def !== undefined && !hasListPage(def) ? (\n <NavAreaNotFound />\n ) : (\n <ResourceListPage resource={resource} />\n );\n }\n // A page-hosted flow's route (P6): it answers its own gate, in order, behind its chunk.\n if (match.action === 'flow') return <PageFlowRouteLoader match={match} />;\n if (recordAction === undefined) return <ResourcePageRouterEmpty />;\n // Record routes are gated by `operations` and `views.show.page` through\n // `recordRouteAvailable`: a route for an operation the resource turned off, or of a\n // resource without record pages, matches and renders nothing but not-found.\n if (!recordRouteAvailable(app.registry, resource, recordAction)) {\n return <NavAreaNotFound />;\n }\n return <RecordRoute resource={resource} action={recordAction} id={match.id ?? ''} />;\n }\n case 'custom-page': {\n const page = app.registry.customPages.get(resource);\n if (page === undefined) return <ResourcePageRouterEmpty />;\n // A page without a body is a nav entry over a route the host owns.\n if (!page.body?.length) return <NavAreaNotFound />;\n return <PageHost key={resource} page={page} match={match} notFound={<NavAreaNotFound />} />;\n }\n case 'group-index': {\n const indexPage = app.registry.customPages.get(target);\n if (indexPage?.body?.length)\n return (\n <PageHost key={target} page={indexPage} match={match} notFound={<NavAreaNotFound />} />\n );\n // First-descendant fallback: when the group's index target is itself a\n // registered resource (not a page), render its list — a group with no\n // custom landing page still lands somewhere useful.\n const targetDef = app.registry.get(target);\n if (targetDef !== undefined)\n return hasListPage(targetDef) ? (\n <ResourceListPage resource={target} />\n ) : (\n <NavAreaNotFound />\n );\n return <ResourcePageRouterEmpty />;\n }\n default:\n return <ResourcePageRouterEmpty />;\n }\n}\n\nfunction NavAreaPageSkeleton(): ReactElement {\n return (\n <div\n className=\"space-y-3 p-6\"\n role=\"status\"\n aria-busy=\"true\"\n aria-live=\"polite\"\n data-testid=\"nav-area-skeleton\"\n >\n <span className=\"sr-only\">Loading…</span>\n <div className=\"h-6 w-48 animate-pulse rounded bg-muted/60\" />\n <div className=\"h-4 w-full animate-pulse rounded bg-muted/40\" />\n <div className=\"h-4 w-5/6 animate-pulse rounded bg-muted/40\" />\n <div className=\"h-4 w-2/3 animate-pulse rounded bg-muted/40\" />\n </div>\n );\n}\n\n/** The framework's 404 panel, inside the shell: a route that names nothing the app declares. */\nexport function NavAreaNotFound(): ReactElement {\n const t = useT();\n return (\n <div\n data-testid=\"nav-area-not-found\"\n className=\"flex flex-col items-center justify-center gap-1 px-6 py-24 text-center\"\n >\n <h2 className=\"text-base font-semibold tracking-tight\">{t('router.notFoundTitle')}</h2>\n <p className=\"max-w-sm text-sm text-muted-foreground\">{t('router.notFoundBody')}</p>\n </div>\n );\n}\n\n/**\n * The apps that have already been told about a missing router adapter. Keyed\n * by the app a `BuroProvider` serves, so the notice is once per app rather than\n * per provider or per mount (StrictMode runs the effect twice).\n */\nconst adapterNoticeGiven = new WeakSet<object>();\n\n/**\n * Resolves the active route (`useMatch`, from the router adapter) and renders\n * it inside the group-chain chrome (`NavChrome`), dispatching to the right\n * framework component via `ResourcePageRouter`. No match → a not-found panel;\n * no router adapter at all → the same panel, and in development one\n * `console.error` naming `RouterAdapterProvider` (once per app), because\n * then EVERY route is not-found. Wrapped in a `Suspense` boundary so a\n * lazily-loaded custom page (`React.lazy`) degrades to a skeleton inside the\n * chrome.\n */\nexport function NavAreaPage(): ReactElement {\n const match = useMatch();\n const app = useApp();\n const noAdapter = useOptionalRouterAdapter() === null;\n useEffect(() => {\n if (!noAdapter || process.env.NODE_ENV === 'production') return;\n if (adapterNoticeGiven.has(app)) return;\n adapterNoticeGiven.add(app);\n console.error(\n '[burojs] <NavAreaPage> has no location to match: no RouterAdapterProvider is mounted. ' +\n 'Mount your router’s adapter (RouterAdapterProvider from @burojs/react) above ' +\n '<BuroProvider>; until then every route renders not-found.',\n );\n }, [app, noAdapter]);\n return (\n <Suspense fallback={<NavAreaPageSkeleton />}>\n {match ? (\n <NavChrome>\n <ResourcePageRouter match={match} />\n </NavChrome>\n ) : (\n <NavAreaNotFound />\n )}\n </Suspense>\n );\n}\n"],"mappings":";;;;;;;;;AAKA,SAAgB,gBAAgB,MAAkC;CAChE,OAAO,uBAAuB,IAAI;AACpC;AAGA,SAAgB,qBAAqB,KAA0B;CAC7D,OAAO,gBAAgB,GAAG;AAC5B;;;AC2BA,SAAgB,cAAc,MAAoC;CAChE,MAAM,EAAE,UAAU,MAAM,WAAW,OAAO,WAAW,aAAa,UAAU;CAC5E,MAAM,QAAQ,OAAO,cAAc,CAAC;CAGpC,MAAM,iBAAiB;CAMvB,MAAM,aACJ,kBA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