@mistriwork/mistri 1.0.0-rc.12 → 1.0.0-rc.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -3
- package/dist/client/assets/LayoutBuilder-MPzkVU2e.js.map +1 -1
- package/dist/client/assets/index-D2dHI6hR.js.map +1 -1
- package/dist/client/assets/shell-TreN_uLs.js.map +1 -1
- package/dist/docs/access-model.md +1 -1
- package/dist/docs/build-and-deploy.md +0 -1
- package/dist/docs/cli.md +1 -1
- package/dist/docs/glossary.md +3 -3
- package/dist/docs/query.md +9 -21
- package/dist/docs/status.md +3 -3
- package/dist/embed/react/chunks/LayoutBuilder-Cbxa_wve.js.map +1 -1
- package/dist/embed/react/chunks/app-0UZ1Re1k.js.map +1 -1
- package/dist/embed/react/chunks/page-Bx4o1kpQ.js.map +1 -1
- package/dist/embed/react/chunks/palette-Bb7Lf6eo.js.map +1 -1
- package/dist/embed/react/chunks/shell-DZRACiB9.js.map +1 -1
- package/dist/embed/react/chunks/write-BQO4CFc9.js.map +1 -1
- package/dist/embed/react/index.js +1 -1
- package/dist/server/build/dockerfile.js +1 -1
- package/dist/server/cli/usage.js +2 -2
- package/dist/ui/index.js +2 -2
- package/dist/ui/page.js +2 -2
- package/dist/ui/{shared-N4Ej8yRD.js → shared-1PD7TOTJ.js} +5 -5
- package/dist/ui/{shared-N4Ej8yRD.js.map → shared-1PD7TOTJ.js.map} +1 -1
- package/dist/ui/{shared-D5m86-4o.js → shared-1gMnOu9J.js} +6 -6
- package/dist/ui/{shared-D5m86-4o.js.map → shared-1gMnOu9J.js.map} +1 -1
- package/dist/ui/{shared-Ctaj8mR2.js → shared-5RQMi4BR.js} +3 -3
- package/dist/ui/{shared-Ctaj8mR2.js.map → shared-5RQMi4BR.js.map} +1 -1
- package/dist/ui/{shared-DpLeIATZ.js → shared-B-BUF9fx.js} +2 -2
- package/dist/ui/{shared-DpLeIATZ.js.map → shared-B-BUF9fx.js.map} +1 -1
- package/dist/ui/{shared-DWYnjItP.js → shared-B-MhiPIN.js} +9 -9
- package/dist/ui/{shared-DWYnjItP.js.map → shared-B-MhiPIN.js.map} +1 -1
- package/dist/ui/{shared-0fNuhSbG.js → shared-B07qIMlE.js} +5 -5
- package/dist/ui/{shared-0fNuhSbG.js.map → shared-B07qIMlE.js.map} +1 -1
- package/dist/ui/{shared-lYtMadRU.js → shared-B1SAS_J-.js} +3 -3
- package/dist/ui/{shared-lYtMadRU.js.map → shared-B1SAS_J-.js.map} +1 -1
- package/dist/ui/{shared-CpI0Y8M5.js → shared-B4jgU8h9.js} +6 -6
- package/dist/ui/{shared-CpI0Y8M5.js.map → shared-B4jgU8h9.js.map} +1 -1
- package/dist/ui/{shared-Cxu1c35l.js → shared-B5aBCUi7.js} +30 -30
- package/dist/ui/{shared-Cxu1c35l.js.map → shared-B5aBCUi7.js.map} +1 -1
- package/dist/ui/{shared-CAe-US1q.js → shared-B9H7_Pji.js} +5 -5
- package/dist/ui/{shared-CAe-US1q.js.map → shared-B9H7_Pji.js.map} +1 -1
- package/dist/ui/{shared-Q2bgBaYo.js → shared-BAXr20S-.js} +4 -4
- package/dist/ui/{shared-Q2bgBaYo.js.map → shared-BAXr20S-.js.map} +1 -1
- package/dist/ui/{shared-CyEefFFb.js → shared-BDDUzH-f.js} +19 -19
- package/dist/ui/{shared-CyEefFFb.js.map → shared-BDDUzH-f.js.map} +1 -1
- package/dist/ui/{shared-BdhPI6dq.js → shared-BGmkeDeW.js} +3 -3
- package/dist/ui/{shared-BdhPI6dq.js.map → shared-BGmkeDeW.js.map} +1 -1
- package/dist/ui/{shared-DONIpq2q.js → shared-BHCQ60yN.js} +2 -2
- package/dist/ui/{shared-DONIpq2q.js.map → shared-BHCQ60yN.js.map} +1 -1
- package/dist/ui/{shared-CNmaAv64.js → shared-BHsjawAG.js} +8 -8
- package/dist/ui/{shared-CNmaAv64.js.map → shared-BHsjawAG.js.map} +1 -1
- package/dist/ui/{shared-DgjU9kOy.js → shared-BIQuK_nq.js} +4 -4
- package/dist/ui/{shared-DgjU9kOy.js.map → shared-BIQuK_nq.js.map} +1 -1
- package/dist/ui/{shared-icSQAj21.js → shared-BOe4W2FI.js} +3 -3
- package/dist/ui/{shared-icSQAj21.js.map → shared-BOe4W2FI.js.map} +1 -1
- package/dist/ui/{shared-BlxoOJSk.js → shared-BPpC08ip.js} +3 -3
- package/dist/ui/{shared-BlxoOJSk.js.map → shared-BPpC08ip.js.map} +1 -1
- package/dist/ui/{shared-BtiFL37J.js → shared-BdA3LPCB.js} +2 -2
- package/dist/ui/{shared-BtiFL37J.js.map → shared-BdA3LPCB.js.map} +1 -1
- package/dist/ui/{shared-CvR94vn4.js → shared-Be3nbWsd.js} +11 -11
- package/dist/ui/{shared-CvR94vn4.js.map → shared-Be3nbWsd.js.map} +1 -1
- package/dist/ui/{shared-Bl_nF_IH.js → shared-Bf30ZLoS.js} +8 -4
- package/dist/ui/shared-Bf30ZLoS.js.map +1 -0
- package/dist/ui/{shared-DijrJ_V-.js → shared-BguP_BaR.js} +7 -7
- package/dist/ui/{shared-DijrJ_V-.js.map → shared-BguP_BaR.js.map} +1 -1
- package/dist/ui/{shared-DPAVoWY0.js → shared-BoLbc2WD.js} +17 -2
- package/dist/ui/{shared-DPAVoWY0.js.map → shared-BoLbc2WD.js.map} +1 -1
- package/dist/ui/{shared-BkdBTYwx.js → shared-BttyOW4W.js} +3 -3
- package/dist/ui/{shared-BkdBTYwx.js.map → shared-BttyOW4W.js.map} +1 -1
- package/dist/ui/{shared-CQWLz8uT.js → shared-BumxsBlA.js} +10 -10
- package/dist/ui/{shared-CQWLz8uT.js.map → shared-BumxsBlA.js.map} +1 -1
- package/dist/ui/{shared-Dzu7tFiC.js → shared-Bw73ktBk.js} +3 -3
- package/dist/ui/{shared-Dzu7tFiC.js.map → shared-Bw73ktBk.js.map} +1 -1
- package/dist/ui/{shared-BhAYErSx.js → shared-C1B0GH0e.js} +4 -4
- package/dist/ui/{shared-BhAYErSx.js.map → shared-C1B0GH0e.js.map} +1 -1
- package/dist/ui/{shared-BQJQcGgj.js → shared-C2FsyYr7.js} +4 -4
- package/dist/ui/{shared-BQJQcGgj.js.map → shared-C2FsyYr7.js.map} +1 -1
- package/dist/ui/{shared-B9lw2Ryh.js → shared-C2RU1qjv.js} +4 -4
- package/dist/ui/{shared-B9lw2Ryh.js.map → shared-C2RU1qjv.js.map} +1 -1
- package/dist/ui/{shared-DQYNI9wO.js → shared-C42f07hJ.js} +5 -5
- package/dist/ui/{shared-DQYNI9wO.js.map → shared-C42f07hJ.js.map} +1 -1
- package/dist/ui/{shared-CqCZ8wMY.js → shared-C4LkPCU4.js} +3 -3
- package/dist/ui/{shared-CqCZ8wMY.js.map → shared-C4LkPCU4.js.map} +1 -1
- package/dist/ui/{shared-BhtpgOpa.js → shared-C4wSfz6k.js} +9 -9
- package/dist/ui/{shared-BhtpgOpa.js.map → shared-C4wSfz6k.js.map} +1 -1
- package/dist/ui/{shared-BHc2Izkj.js → shared-C9DZtSFH.js} +2 -2
- package/dist/ui/{shared-BHc2Izkj.js.map → shared-C9DZtSFH.js.map} +1 -1
- package/dist/ui/{shared-DW1YuiNS.js → shared-CA52ClGo.js} +2 -2
- package/dist/ui/{shared-DW1YuiNS.js.map → shared-CA52ClGo.js.map} +1 -1
- package/dist/ui/{shared-BbSbilkh.js → shared-CBciTwm6.js} +9 -9
- package/dist/ui/{shared-BbSbilkh.js.map → shared-CBciTwm6.js.map} +1 -1
- package/dist/ui/{shared-C-J32eBn.js → shared-CL3RLKDA.js} +16 -16
- package/dist/ui/{shared-C-J32eBn.js.map → shared-CL3RLKDA.js.map} +1 -1
- package/dist/ui/{shared-Ck8S4OxW.js → shared-CLq3-_hW.js} +3 -3
- package/dist/ui/{shared-Ck8S4OxW.js.map → shared-CLq3-_hW.js.map} +1 -1
- package/dist/ui/{shared-Q5WefT7G.js → shared-CMjK-Ucd.js} +3 -3
- package/dist/ui/{shared-Q5WefT7G.js.map → shared-CMjK-Ucd.js.map} +1 -1
- package/dist/ui/{shared-D3MAuEA3.js → shared-CPjpSFGh.js} +2 -2
- package/dist/ui/{shared-D3MAuEA3.js.map → shared-CPjpSFGh.js.map} +1 -1
- package/dist/ui/{shared-VshXGwXP.js → shared-CSPhENq3.js} +2 -2
- package/dist/ui/{shared-VshXGwXP.js.map → shared-CSPhENq3.js.map} +1 -1
- package/dist/ui/{shared-DJrJaE73.js → shared-CZJE4Bmp.js} +3 -3
- package/dist/ui/{shared-DJrJaE73.js.map → shared-CZJE4Bmp.js.map} +1 -1
- package/dist/ui/{shared-D7ONOwI7.js → shared-C_BhUL2I.js} +7 -7
- package/dist/ui/{shared-D7ONOwI7.js.map → shared-C_BhUL2I.js.map} +1 -1
- package/dist/ui/{shared-j-2peBIB.js → shared-CbeujwdU.js} +4 -4
- package/dist/ui/{shared-j-2peBIB.js.map → shared-CbeujwdU.js.map} +1 -1
- package/dist/ui/{shared-D5GrOEa2.js → shared-Cbf-o4Dt.js} +4 -4
- package/dist/ui/{shared-D5GrOEa2.js.map → shared-Cbf-o4Dt.js.map} +1 -1
- package/dist/ui/{shared-HwiPIajr.js → shared-CdNmeNHh.js} +3 -3
- package/dist/ui/{shared-HwiPIajr.js.map → shared-CdNmeNHh.js.map} +1 -1
- package/dist/ui/{shared-ZCFt-CPb.js → shared-CdQOMD8J.js} +3 -3
- package/dist/ui/{shared-ZCFt-CPb.js.map → shared-CdQOMD8J.js.map} +1 -1
- package/dist/ui/{shared-ClhXSGGK.js → shared-CdiPYlTh.js} +2 -2
- package/dist/ui/{shared-ClhXSGGK.js.map → shared-CdiPYlTh.js.map} +1 -1
- package/dist/ui/{shared-DA8_pVRZ.js → shared-CepLAhwm.js} +2 -2
- package/dist/ui/{shared-DA8_pVRZ.js.map → shared-CepLAhwm.js.map} +1 -1
- package/dist/ui/{shared-BrYKjrnM.js → shared-Ch82h_Fu.js} +6 -6
- package/dist/ui/{shared-BrYKjrnM.js.map → shared-Ch82h_Fu.js.map} +1 -1
- package/dist/ui/{shared-C4UrE8Fb.js → shared-Chp88all.js} +3 -3
- package/dist/ui/{shared-C4UrE8Fb.js.map → shared-Chp88all.js.map} +1 -1
- package/dist/ui/{shared-CWa80DTO.js → shared-Ci16s2rN.js} +9 -9
- package/dist/ui/{shared-CWa80DTO.js.map → shared-Ci16s2rN.js.map} +1 -1
- package/dist/ui/{shared-tksTLD6Q.js → shared-CiqNkoE1.js} +5 -5
- package/dist/ui/{shared-tksTLD6Q.js.map → shared-CiqNkoE1.js.map} +1 -1
- package/dist/ui/{shared-yt7DjSrq.js → shared-CpMhOq8F.js} +2 -2
- package/dist/ui/{shared-yt7DjSrq.js.map → shared-CpMhOq8F.js.map} +1 -1
- package/dist/ui/{shared-Dm0z5WUl.js → shared-CrWv5JKH.js} +6 -6
- package/dist/ui/{shared-Dm0z5WUl.js.map → shared-CrWv5JKH.js.map} +1 -1
- package/dist/ui/{shared-CQL3FGHc.js → shared-Csfi3Pti.js} +2 -2
- package/dist/ui/{shared-CQL3FGHc.js.map → shared-Csfi3Pti.js.map} +1 -1
- package/dist/ui/{shared-BKNRbm-V.js → shared-CuZt26rm.js} +2 -2
- package/dist/ui/{shared-BKNRbm-V.js.map → shared-CuZt26rm.js.map} +1 -1
- package/dist/ui/{shared-Guq3upiR.js → shared-Cws_z-TS.js} +2 -2
- package/dist/ui/{shared-Guq3upiR.js.map → shared-Cws_z-TS.js.map} +1 -1
- package/dist/ui/{shared-Bw_qZeIj.js → shared-D1KWuCg6.js} +2 -2
- package/dist/ui/{shared-Bw_qZeIj.js.map → shared-D1KWuCg6.js.map} +1 -1
- package/dist/ui/{shared-CuCZKwXW.js → shared-D66ju_Cb.js} +23 -23
- package/dist/ui/{shared-CuCZKwXW.js.map → shared-D66ju_Cb.js.map} +1 -1
- package/dist/ui/{shared-DYfX7NSM.js → shared-DGaQZXnw.js} +2 -2
- package/dist/ui/{shared-DYfX7NSM.js.map → shared-DGaQZXnw.js.map} +1 -1
- package/dist/ui/{shared-B3Hp8tOv.js → shared-DHy41sET.js} +6 -6
- package/dist/ui/{shared-B3Hp8tOv.js.map → shared-DHy41sET.js.map} +1 -1
- package/dist/ui/{shared-CXyd7IKi.js → shared-DKEOMQ6l.js} +2 -2
- package/dist/ui/{shared-CXyd7IKi.js.map → shared-DKEOMQ6l.js.map} +1 -1
- package/dist/ui/{shared-Ccmc8YO0.js → shared-DSUICuaJ.js} +33 -33
- package/dist/ui/{shared-Ccmc8YO0.js.map → shared-DSUICuaJ.js.map} +1 -1
- package/dist/ui/{shared-CL2iw_js.js → shared-DUPMRoO0.js} +13 -13
- package/dist/ui/{shared-CL2iw_js.js.map → shared-DUPMRoO0.js.map} +1 -1
- package/dist/ui/{shared-Dtp4eRul.js → shared-DVfdm6ah.js} +2 -2
- package/dist/ui/{shared-Dtp4eRul.js.map → shared-DVfdm6ah.js.map} +1 -1
- package/dist/ui/{shared-BJ5Ex32G.js → shared-DXM7d7lJ.js} +3 -3
- package/dist/ui/{shared-BJ5Ex32G.js.map → shared-DXM7d7lJ.js.map} +1 -1
- package/dist/ui/{shared-BFr6ld0e.js → shared-DXbMlcev.js} +2 -2
- package/dist/ui/{shared-BFr6ld0e.js.map → shared-DXbMlcev.js.map} +1 -1
- package/dist/ui/{shared-BUp3jv-N.js → shared-D_SkPtJ9.js} +6 -6
- package/dist/ui/{shared-BUp3jv-N.js.map → shared-D_SkPtJ9.js.map} +1 -1
- package/dist/ui/{shared-CdNomVzH.js → shared-Dd21k2ic.js} +4 -4
- package/dist/ui/{shared-CdNomVzH.js.map → shared-Dd21k2ic.js.map} +1 -1
- package/dist/ui/{shared-gRMbxmpu.js → shared-Dh0nHtLZ.js} +8 -8
- package/dist/ui/{shared-gRMbxmpu.js.map → shared-Dh0nHtLZ.js.map} +1 -1
- package/dist/ui/{shared-BKGJgjog.js → shared-DkOdSpSK.js} +3 -3
- package/dist/ui/{shared-BKGJgjog.js.map → shared-DkOdSpSK.js.map} +1 -1
- package/dist/ui/{shared-BMsh72Uq.js → shared-Dkph5ckT.js} +2 -2
- package/dist/ui/{shared-BMsh72Uq.js.map → shared-Dkph5ckT.js.map} +1 -1
- package/dist/ui/{shared-Be1HpDOB.js → shared-Dl1_Nx--.js} +3 -3
- package/dist/ui/{shared-Be1HpDOB.js.map → shared-Dl1_Nx--.js.map} +1 -1
- package/dist/ui/{shared-BQIZWOoJ.js → shared-Dm0IGbAf.js} +2 -2
- package/dist/ui/{shared-BQIZWOoJ.js.map → shared-Dm0IGbAf.js.map} +1 -1
- package/dist/ui/{shared-DSUtcU5S.js → shared-DnIkTpPr.js} +5 -5
- package/dist/ui/{shared-DSUtcU5S.js.map → shared-DnIkTpPr.js.map} +1 -1
- package/dist/ui/{shared-DsxGbYlV.js → shared-Docl_0tq.js} +3 -3
- package/dist/ui/{shared-DsxGbYlV.js.map → shared-Docl_0tq.js.map} +1 -1
- package/dist/ui/{shared-DZskrV26.js → shared-DprrHC72.js} +2 -2
- package/dist/ui/{shared-DZskrV26.js.map → shared-DprrHC72.js.map} +1 -1
- package/dist/ui/{shared-Bmw43Hwf.js → shared-DyKsJTZs.js} +2 -2
- package/dist/ui/{shared-Bmw43Hwf.js.map → shared-DyKsJTZs.js.map} +1 -1
- package/dist/ui/{shared-BLG88Pya.js → shared-FO7vfI3F.js} +4 -4
- package/dist/ui/{shared-BLG88Pya.js.map → shared-FO7vfI3F.js.map} +1 -1
- package/dist/ui/{shared-DLSd80D1.js → shared-HalAVHjv.js} +3 -3
- package/dist/ui/{shared-DLSd80D1.js.map → shared-HalAVHjv.js.map} +1 -1
- package/dist/ui/{shared-D1mMBLdj.js → shared-JvcI-LWp.js} +15 -15
- package/dist/ui/{shared-D1mMBLdj.js.map → shared-JvcI-LWp.js.map} +1 -1
- package/dist/ui/{shared-C6Hv_4O0.js → shared-K7Ym27yg.js} +2 -2
- package/dist/ui/{shared-C6Hv_4O0.js.map → shared-K7Ym27yg.js.map} +1 -1
- package/dist/ui/{shared-B39ln7oi.js → shared-SzlnwfJO.js} +3 -3
- package/dist/ui/{shared-B39ln7oi.js.map → shared-SzlnwfJO.js.map} +1 -1
- package/dist/ui/{shared-DgPn_Jll.js → shared-TrGbd1FY.js} +3 -3
- package/dist/ui/{shared-DgPn_Jll.js.map → shared-TrGbd1FY.js.map} +1 -1
- package/dist/ui/{shared-DrFb-XtA.js → shared-WhbuObEW.js} +2 -2
- package/dist/ui/{shared-DrFb-XtA.js.map → shared-WhbuObEW.js.map} +1 -1
- package/dist/ui/{shared-DiFQljcq.js → shared-XcSKDp6N.js} +11 -11
- package/dist/ui/{shared-DiFQljcq.js.map → shared-XcSKDp6N.js.map} +1 -1
- package/dist/ui/{shared-CMAg58rY.js → shared-Z4uBJU6I.js} +7 -6
- package/dist/ui/shared-Z4uBJU6I.js.map +1 -0
- package/dist/ui/{shared-BnUptuUp.js → shared-bAgeiRa5.js} +2 -2
- package/dist/ui/{shared-BnUptuUp.js.map → shared-bAgeiRa5.js.map} +1 -1
- package/dist/ui/{shared-BxMvSjey.js → shared-cgXG7OgZ.js} +5 -5
- package/dist/ui/{shared-BxMvSjey.js.map → shared-cgXG7OgZ.js.map} +1 -1
- package/dist/ui/{shared-u4CG2kQJ.js → shared-eZ0SB_zm.js} +2 -2
- package/dist/ui/{shared-u4CG2kQJ.js.map → shared-eZ0SB_zm.js.map} +1 -1
- package/dist/ui/{shared-L90bWW8e.js → shared-frKFb79C.js} +2 -2
- package/dist/ui/{shared-L90bWW8e.js.map → shared-frKFb79C.js.map} +1 -1
- package/dist/ui/{shared-Dd34nhkw.js → shared-hAayNSRA.js} +3 -3
- package/dist/ui/{shared-Dd34nhkw.js.map → shared-hAayNSRA.js.map} +1 -1
- package/dist/ui/{shared-DzC64cpp.js → shared-j_J16p2B.js} +2 -2
- package/dist/ui/{shared-DzC64cpp.js.map → shared-j_J16p2B.js.map} +1 -1
- package/dist/ui/{shared-DX7HRIV-.js → shared-tqpl5N3g.js} +6 -6
- package/dist/ui/{shared-DX7HRIV-.js.map → shared-tqpl5N3g.js.map} +1 -1
- package/dist/ui/{shared-BS5dBMpA.js → shared-y-6_ZDts.js} +2 -2
- package/dist/ui/{shared-BS5dBMpA.js.map → shared-y-6_ZDts.js.map} +1 -1
- package/dist/ui/{shared-Cv5v_MP1.js → shared-zG6e1Rhz.js} +13 -13
- package/dist/ui/{shared-Cv5v_MP1.js.map → shared-zG6e1Rhz.js.map} +1 -1
- package/dist/ui/testing.js +1 -1
- package/package.json +4 -4
- package/dist/docs/cli-browser.md +0 -232
- package/dist/docs/database-browser.md +0 -115
- package/dist/docs/keyboard.md +0 -63
- package/dist/docs/mcp.md +0 -86
- package/dist/ui/shared-Bl_nF_IH.js.map +0 -1
- package/dist/ui/shared-CMAg58rY.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared-CuCZKwXW.js","names":["say","say","say","say","checkedRecordKey","recordKey","say","say","say","_Fragment","say","say","say","_Fragment"],"sources":["../../../kit/src/client/copy/record/components/RecordGone.ts","../../../kit/src/client/components/RecordGone.tsx","../../../kit/src/client/pagemarks.js","../../../kit/src/client/copy/record/components/DeleteButton.ts","../../../kit/src/client/components/DeleteButton.tsx","../../../kit/src/client/copy/record/components/RecordTags.ts","../../../kit/src/client/components/RecordTags.tsx","../../../kit/src/client/documents.ts","../../../kit/src/client/copy/record/components/PageHead.ts","../../../kit/src/client/components/PageHead.tsx","../../../kit/src/client/copy/record/components/PageLayout.ts","../../../kit/src/client/components/PageLayout.tsx","../../../kit/src/client/components/Page.tsx","../../src/client/copy/record/components/RecordPageBody.ts","../../src/client/components/decisionAdornment.tsx","../../src/client/components/RecordPageBody.tsx"],"sourcesContent":["/** What RecordGone says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n backToTheList: 'Back to the {spoken} list',\n recordNotFound: '{Spoken} not found',\n});\n","/**\n * A record that is gone — deleted under an open page, or a link to one that\n * never was — said once in plain words, with the way back to its list. The\n * sentence starts on the content's own edge (the empty block, Notes.tsx), and\n * names no key: \"1 names nothing\" read like a bug to the person who followed\n * the link. The caller says the table's name as its page does (`spoken` in\n * pageContext.ts): this module imports nothing of the page around it, so the\n * page may import it without a cycle.\n */\nimport { go, tableView } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { Button } from '@mistriwork/ui/Button.js';\nimport { Empty } from './Notes.js';\nimport { say } from '../copy/record/components/RecordGone.js';\n\nexport const recordNotFound = (spoken: string) => {\n const name = spoken.toLowerCase();\n return say('recordNotFound', { Spoken: name.charAt(0).toUpperCase() + name.slice(1) });\n};\n\nexport function RecordGone({ base, spoken, className }: { base: TableMeta; spoken: string; className?: string }) {\n const name = spoken.toLowerCase();\n return (\n <Empty\n className={className}\n text={say('common.thatIsNoLonger', { spoken: name })}\n action={\n <Button intent=\"secondary\" onClick={() => go(tableView(base.id), 'push')}>\n {say('backToTheList', { spoken: name })}\n </Button>\n }\n />\n );\n}\n","/**\n * Pages you pinned, and pages you were just on.\n *\n * A page is the most expensive thing anyone builds in tablewalk — sections\n * chosen, columns picked, an order decided — and until now the only way back\n * to one was to remember its name and type it into ⌘K. Everything else the\n * tool remembers for you (the trail, the last root of each page, saved\n * filters) it remembers because retyping it is the tax on coming back\n * tomorrow, and this is the same tax on the most expensive thing.\n *\n * Two lists, because they answer two different questions. Pinned is \"the\n * pages I work in\", stated once. Recent is \"where was I\", which nobody\n * states — and a recent entry carries the record as well as the page, since\n * being sent back to \"choose a customer\" is not being sent back to where you\n * were.\n *\n * Per connection, like every other memory here: the same page name means a\n * different thing on staging and on production, and the last customer you\n * looked at on one is not a record on the other.\n */\nimport { loadJson, saveJson, state } from './core.js';\n\nconst PINNED_KEY = 'mistri.pages.pinned.v1';\nconst VISITS_KEY = 'mistri.pages.visits.v1';\n\n/** How many positions are worth keeping. Enough for a day's work, not a log. */\nconst VISITS_MAX = 12;\n\nconst conn = () => state.activeConnection ?? 'default';\nconst read = (key) => loadJson(key, {})[conn()] ?? [];\n\nfunction write(key, value) {\n const all = loadJson(key, {});\n all[conn()] = value;\n saveJson(key, all);\n}\n\n/* ---------- pinned ---------- */\n\n/**\n * The pinned pages, each carrying its own name and base table.\n *\n * Stored rather than looked up, because the list of pages this connection\n * *has* does not include the suggested one — the page every table has and\n * nobody built — and pinning \"the customer page\" is exactly what someone\n * does before they have built anything. A pin that could only name pages\n * from a file would be a pin that silently dropped the commonest case.\n */\nexport function pinnedPages() {\n return read(PINNED_KEY).filter((p) => p && p.id);\n}\n\nexport function isPinned(pageId) {\n return pinnedPages().some((p) => p.id === pageId);\n}\n\n/** Pin or unpin, and answer what it is now. */\nexport function togglePinned(page) {\n const pinned = pinnedPages();\n const next = pinned.some((p) => p.id === page.id)\n ? pinned.filter((p) => p.id !== page.id)\n : [...pinned, { id: page.id, name: page.name, base: page.base }];\n write(PINNED_KEY, next);\n return next.some((p) => p.id === page.id);\n}\n\n/* ---------- where you were ---------- */\n\n/**\n * Record a position: this page, and the record it was about.\n *\n * Keyed by page *and* record, so opening three customers leaves three\n * entries rather than one that keeps changing — \"the last three customers I\n * looked at\" is the useful list, and a single slot per page throws away two\n * of them. A page with no root chosen still counts: getting back to the\n * chooser is worth one line.\n */\nexport function rememberVisit({ pageId, name, base, key, label }) {\n if (!pageId) return;\n /* The same record, however it was reached, is one visit. A row opened\n from a list carried a numeric key and one opened from a link a string\n one, so `{\"id\":5}` and `{\"id\":\"5\"}` sat side by side as two chips; the\n same record read through two pages over one table did the same. Keys\n compare as text, and a record is identified by its table when it has\n one, by its page only when it does not. */\n const stamp = JSON.stringify(normalKey(key));\n const same = (v) => JSON.stringify(normalKey(v.key)) === stamp && (base && v.base ? v.base === base : v.pageId === pageId);\n const visits = read(VISITS_KEY).filter((v) => !same(v));\n visits.unshift({ pageId, name, base, key, label });\n write(VISITS_KEY, visits.slice(0, VISITS_MAX));\n}\n\n/** A key with every value spelled as text, so 5 and \"5\" are one key. */\nfunction normalKey(key) {\n if (!key || typeof key !== 'object') return null;\n return Object.fromEntries(\n Object.keys(key)\n .sort()\n .map((k) => [k, key[k] == null ? null : String(key[k])]),\n );\n}\n\nexport function recentVisits() {\n return read(VISITS_KEY);\n}\n\n/** Forget a page entirely — it was deleted, or renamed out of existence. */\nexport function forgetPage(pageId) {\n write(\n PINNED_KEY,\n pinnedPages().filter((p) => p.id !== pageId),\n );\n write(\n VISITS_KEY,\n recentVisits().filter((v) => v.pageId !== pageId),\n );\n}\n","/** What DeleteButton says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n deletionWasNotConfirmed: 'Deletion was not confirmed. Refresh and reconcile this record before deleting again.',\n inWillBeDeleted: '{n} in {t} will be deleted too',\n inWillBeKept: '{n} in {t} will be kept, with the reference emptied',\n inWillBeKeptWithTheReference: '{n} in {t} will be kept, with the reference reset',\n inWillBlockThisTheDatabase: '{n} in {t} will block this — the database will refuse it',\n theDeletionPreviewIsUnavailable: 'The deletion preview is unavailable. Refresh the record.',\n deleteThisRow: 'Delete this {name} row',\n thisDeletionBelongsToAPrevious: 'This deletion belongs to a previous session or connection.',\n theRowWasNotDeleted: 'The row was not deleted.',\n deleted: 'Deleted {name} {label}.',\n deleteNameLabel: 'Delete {name} {label}?',\n thisRowIsReferenced: 'This row is referenced. Here is what the database will do:',\n couldNotBeCounted: '{table} could not be counted',\n inThisConstraintsRule: \"{rows} in {table} — this constraint's rule is unknown\",\n onDeleteRule: 'on delete {rule}',\n ruleUnknown: 'rule unknown',\n cascadesAreCountedOne: 'Cascades are counted one level deep. Rows deleted by a cascade may take their own children with them.',\n nothingPointsAtThis: 'Nothing points at this row, so nothing else is affected.',\n theDatabaseWillRefuse:\n 'The database will refuse this while those references exist. You can try anyway — its answer is the authority, not ours.',\n tryAnyway: 'Try anyway',\n});\n","/**\n * Deleting a row, having first said what that would do.\n *\n * The one destructive action here, and the one place the tool has a real\n * advantage: it already counts what points at a row, and the same counts\n * answer \"what breaks if this goes\" *before* the delete rather than as a\n * constraint violation afterwards. The count alone is not the answer —\n * three rows pointing here means three deleted under `cascade`, three left\n * holding a null under `set null`, a refusal under `restrict` — so the\n * dialog leads with the rule, and a rule the adapter could not determine\n * says so.\n */\nimport { useRef, useState } from 'react';\nimport { Modal, type ModalHandle } from '@mistriwork/ui/Modal.js';\nimport { Button } from '@mistriwork/ui/Button.js';\nimport { useMutation } from '@tanstack/react-query';\nimport { api, go, state, toast } from '../core.js';\nimport { recordKey as checkedRecordKey } from '../resourceRequests.js';\nimport { canDelete } from '../delete.js';\nimport { countsChanged } from './navCounts.js';\nimport { captureSessionIdentity, sessionIdentity } from '../sessionIdentity.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { HttpRecordKey } from '@mistriwork/engine/shared/resourceHttp.js';\nimport { shell } from '../shellMode.js';\nimport { say } from '../copy/record/components/DeleteButton.js';\n\ninterface Impact {\n table: string;\n count: number;\n onDelete?: string;\n}\ninterface Report {\n impact?: Impact[];\n deleted?: boolean | null;\n outcome?: string;\n errors?: Array<{ message: string }>;\n undoId?: unknown;\n}\nconst UNKNOWN = say('deletionWasNotConfirmed');\nconst refusedError = (err: { status?: number; outcome?: string }) =>\n err.outcome !== 'unknown' &&\n (err.outcome === 'rejected' ||\n err.outcome === 'not_applied' ||\n (err.outcome === undefined && [400, 401, 403, 404, 409, 422, 501].includes(err.status ?? 0)));\n\nconst CONSEQUENCE: Record<string, { tone: string; says: (n: string, t: string) => string }> = {\n cascade: { tone: 'bad', says: (n, t) => say('inWillBeDeleted', { n, t }) },\n 'set null': { tone: 'warn', says: (n, t) => say('inWillBeKept', { n, t }) },\n 'set default': { tone: 'warn', says: (n, t) => say('inWillBeKeptWithTheReference', { n, t }) },\n restrict: { tone: 'stop', says: (n, t) => say('inWillBlockThisTheDatabase', { n, t }) },\n 'no action': { tone: 'stop', says: (n, t) => say('inWillBlockThisTheDatabase', { n, t }) },\n};\n\nconst rows = (n: number) => say('common.rows2', { count: n });\n\nexport type DeleteState = 'pending' | 'uncertain' | 'applied' | 'rejected';\nexport interface DeleteButtonHost {\n /** Supplemental generation/authority predicate. Never replaces URL/session fences. */\n isCurrent: () => boolean;\n onDeleted: () => void;\n /** Store synchronously before confirmation closes. Pending/uncertain must\n * block voluntary host exit/replacement; unmount is NOT settlement. No idle\n * notification is emitted on cleanup. Retirement belongs to the host. */\n onStateChange: (state: DeleteState) => void;\n}\nconst hostCurrent = (host?: DeleteButtonHost) => {\n try {\n return host === undefined || host.isCurrent() === true;\n } catch {\n return false;\n }\n};\n\ninterface DeleteProps {\n table: TableMeta;\n recordKey: Record<string, unknown>;\n label: string;\n host?: DeleteButtonHost;\n}\n\n/**\n * Delete for one record, for a host that draws the trigger itself. A menu\n * item unmounts when its menu closes, so the confirmation lives with the\n * host (`dialog`), not with the item that opened it.\n */\nexport function useDelete({ table, recordKey, label, host }: DeleteProps) {\n const [report, setReport] = useState<{ data: Report; key: HttpRecordKey; host?: DeleteButtonHost } | null>(null);\n const [blocked, setBlocked] = useState(false);\n const available = canDelete(table);\n const ask = async () => {\n if (blocked || !hostCurrent(host)) return;\n const identity = captureSessionIdentity();\n const connection = state.activeConnection;\n const route = location.href;\n const current = () =>\n identity === sessionIdentity() && connection === state.activeConnection && route === location.href && hostCurrent(host);\n try {\n const key = checkedRecordKey(recordKey);\n const result: Report = await api('/api/delete', { table: table.id, key });\n if (!current()) return;\n if (result.deleted !== false || result.errors?.length || !Array.isArray(result.impact)) {\n toast(result.errors?.[0]?.message ?? say('theDeletionPreviewIsUnavailable'), 'error');\n return;\n }\n setReport({ data: result, key, host });\n } catch (err) {\n if (current()) toast((err as Error).message, 'error');\n }\n };\n const dialog = report ? (\n <DeleteConfirm\n table={table}\n recordKey={report.key}\n label={label}\n report={report.data}\n host={report.host}\n setBlocked={setBlocked}\n onClose={() => setReport(null)}\n />\n ) : null;\n return { available, blocked, ask: () => void ask(), dialog };\n}\n\nexport function DeleteButton(props: DeleteProps) {\n const { available, blocked, ask, dialog } = useDelete(props);\n if (!available) return null;\n return (\n <>\n <button\n type=\"button\"\n className=\"ghost record-delete\"\n disabled={blocked}\n title={say('deleteThisRow', { name: props.table.name })}\n onClick={ask}\n >\n {say('common.delete')}\n </button>\n {dialog}\n </>\n );\n}\n\nfunction DeleteConfirm({\n table,\n recordKey,\n label,\n report,\n onClose,\n setBlocked,\n host,\n}: {\n table: TableMeta;\n recordKey: HttpRecordKey;\n label: string;\n report: Report;\n onClose: () => void;\n setBlocked: (blocked: boolean) => void;\n host?: DeleteButtonHost;\n}) {\n const dialog = useRef<ModalHandle>(null);\n const owner = useRef({ identity: captureSessionIdentity(), connection: state.activeConnection, route: location.href }).current;\n const current = () =>\n owner.identity === sessionIdentity() &&\n owner.connection === state.activeConnection &&\n owner.route === location.href &&\n hostCurrent(host);\n const submitted = useRef(false);\n // A presentation failure after dispatch must never reclassify a known result\n // or release a pending/unknown close guard. The host retains its last status.\n const notify = (status: DeleteState) => {\n try {\n host?.onStateChange(status);\n } catch {\n /* presentation only */\n }\n };\n const remove = useMutation({\n mutationFn: async () => {\n if (!current()) throw new Error(say('thisDeletionBelongsToAPrevious'));\n const tracked = shell().mutations.start('delete', owner.identity);\n try {\n const result: Report = await api('/api/delete', { table: table.id, key: recordKey, confirm: true });\n const definite =\n (result.deleted === true && !result.errors?.length && (result.outcome === undefined || result.outcome === 'applied')) ||\n (result.deleted === false && result.outcome === 'rejected');\n if (definite) shell().mutations.settle(tracked);\n else shell().mutations.unknown(tracked);\n return result;\n } catch (error) {\n if (error && typeof error === 'object' && refusedError(error)) shell().mutations.settle(tracked);\n else shell().mutations.unknown(tracked);\n throw error;\n }\n },\n onSuccess: (result: Report) => {\n if (!current()) return;\n if (result.deleted !== true || result.errors?.length || (result.outcome !== undefined && result.outcome !== 'applied')) {\n const rejected = result.deleted === false && result.outcome === 'rejected';\n setBlocked(!rejected);\n notify(rejected ? 'rejected' : 'uncertain');\n if (!rejected) void shell().undo.refresh();\n toast(rejected ? (result.errors?.[0]?.message ?? say('theRowWasNotDeleted')) : UNKNOWN, 'error');\n return;\n }\n void shell().undo.refresh();\n /* The reader is on the list by the time they read this; Undo puts the\n record back into it (the list and its counts refresh, the reader stays). */\n toast(\n say('deleted', { name: table.name, label }),\n 'ok',\n shell().undo.toast(result.undoId, () => countsChanged()),\n );\n notify('applied');\n /* Back to the table, not to the record that no longer exists. */\n if (host) {\n if (current())\n try {\n host.onDeleted();\n } catch {\n /* a confirmed deletion is never retried */\n }\n } else go({ kind: 'table', table: table.id, query: table.id, tab: 'rows' }, 'reset');\n // One row fewer on every count of the connection, the menu's included.\n countsChanged();\n },\n onError: (err: Error & { status?: number; outcome?: string }) => {\n if (!current()) return;\n const rejected = refusedError(err);\n setBlocked(!rejected);\n notify(rejected ? 'rejected' : 'uncertain');\n if (!rejected) void shell().undo.refresh();\n toast(rejected ? err.message : UNKNOWN, 'error');\n },\n });\n const impact = report.impact ?? [];\n const blocked = impact.some((i) => i.onDelete === 'restrict' || i.onDelete === 'no action');\n return (\n <Modal className=\"confirm delete-confirm\" ref={dialog} onClose={onClose}>\n <h2>{say('deleteNameLabel', { name: table.name, label })}</h2>\n {impact.length ? (\n <div>\n <p>{say('thisRowIsReferenced')}</p>\n <ul className=\"delete-impact\">\n {impact.map((i, k) => {\n const rule = i.onDelete ? CONSEQUENCE[i.onDelete] : undefined;\n return (\n <li key={k} className={`impact-${rule?.tone ?? 'unknown'}`}>\n <span className=\"impact-what\">\n {i.count < 0\n ? say('couldNotBeCounted', { table: i.table })\n : rule\n ? rule.says(rows(i.count), i.table)\n : say('inThisConstraintsRule', { rows: rows(i.count), table: i.table })}\n </span>\n <span className=\"impact-rule\">{i.onDelete ? say('onDeleteRule', { rule: i.onDelete }) : say('ruleUnknown')}</span>\n </li>\n );\n })}\n </ul>\n {impact.some((i) => i.onDelete === 'cascade') && <p className=\"delete-note\">{say('cascadesAreCountedOne')}</p>}\n </div>\n ) : (\n <p>{say('nothingPointsAtThis')}</p>\n )}\n {blocked && <p className=\"delete-blocked\">{say('theDatabaseWillRefuse')}</p>}\n <div className=\"confirm-actions\">\n <Button intent=\"secondary\" onClick={onClose}>\n {say('common.cancel')}\n </Button>\n <Button\n intent=\"danger\"\n onClick={() => {\n if (submitted.current || !current()) return;\n // Fail closed if the host cannot retain the pending operation. This\n // runs before closing the nested confirmation or dispatching a write.\n try {\n host?.onStateChange('pending');\n } catch {\n return;\n }\n if (!current()) return;\n submitted.current = true;\n setBlocked(true);\n onClose();\n remove.mutate();\n }}\n >\n {blocked ? say('tryAnyway') : 'Delete'}\n </Button>\n </div>\n </Modal>\n );\n}\n","/** What RecordTags says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n tagAdded: 'Tag added',\n removed: 'Removed “{label}”',\n removeLabel: 'Remove {label}',\n addNoun: 'Add {noun}',\n plusAddNoun: '+ Add {noun}',\n addTag: 'Add tag',\n removeTag: 'Remove tag',\n});\n","/**\n * A record's tags, as chips under its title: rows of another table linked\n * through a link table (`tags` on the resource). Where the link table may be\n * written and deleted from, a picker adds a tag (a link row inserted) and a\n * chip's × removes one (its link row deleted): ordinary writes, each checked\n * like any insert or delete, recorded, and undoable. Where the resource names\n * its own commands (`tags: { add, remove }`), the picker runs those instead,\n * told the tag's key, and needs no write on the link table.\n */\nimport { useEffect, useRef, useState } from 'react';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { api, findTable, quote, state, toast } from '../core.js';\nimport { ownedBy } from '../requestIdentity.js';\nimport { canInsert } from '../insert.js';\nimport { canDelete } from '../delete.js';\nimport { primaryKey, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { DISPLAY_TONES, humanName } from '@mistriwork/engine/shared/model.js';\nimport type { AppTagRule } from '@mistriwork/engine/shared/servedApp.js';\nimport { RecordPicker } from './RecordPicker.js';\nimport { shell } from '../shellMode.js';\nimport { say } from '../copy/record/components/RecordTags.js';\n\ninterface Tag {\n link: Record<string, string | number>;\n value: string;\n label: string;\n tone: string;\n}\ntype Reply = { rows?: Array<Record<string, unknown>>; errors?: Array<{ message: string }> };\n\nexport function RecordTags({\n rule,\n recordKey,\n isCurrent,\n}: {\n rule: AppTagRule;\n recordKey: Record<string, unknown>;\n isCurrent?: () => boolean;\n}) {\n const connection = state.activeConnection ?? null;\n const client = useQueryClient();\n const [adding, setAdding] = useState(false);\n const [busy, setBusy] = useState(false);\n const picker = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (adding) picker.current?.focus();\n }, [adding]);\n const through = findTable(rule.through) as TableMeta | undefined;\n const to = findTable(rule.to) as TableMeta | undefined;\n const parent = recordKey[rule.key];\n const linkKey = through ? (primaryKey(through) as string[]) : [];\n const literal = typeof parent === 'number' ? String(parent) : quote(String(parent ?? ''));\n const columns = [...new Set([...linkKey, rule.via, `${rule.via}.${rule.label}`, ...(rule.tone ? [`${rule.via}.${rule.tone}`] : [])])];\n const q = through && parent != null ? `${rule.through} ${rule.from} = ${literal} show ${columns.join(', ')}` : '';\n const answer = useQuery({\n queryKey: ['run', connection ?? '', 'tags', q],\n enabled: Boolean(q),\n queryFn: async () => {\n const data = (await api('/api/run', { q, limit: 200, offset: 0, count: 'none', ...ownedBy(connection) })) as Reply;\n if (data.errors?.length) throw new Error(data.errors[0].message);\n return data.rows ?? [];\n },\n });\n const tags: Tag[] = (answer.data ?? [])\n .flatMap((row) => {\n const value = row[rule.via];\n if (value == null || linkKey.some((column) => row[column] == null)) return [];\n const tone = rule.tone ? String(row[`${rule.via}.${rule.tone}`] ?? '') : '';\n return [\n {\n link: Object.fromEntries(linkKey.map((column) => [column, row[column] as string | number])),\n value: String(value),\n label: String(row[`${rule.via}.${rule.label}`] ?? value),\n tone: (DISPLAY_TONES as readonly string[]).includes(tone) ? tone : 'neutral',\n },\n ];\n })\n .sort((a, b) => a.label.localeCompare(b.label));\n /* The App's own commands when it names them (each run only for a reader granted it, and only in a shell that runs\n them: shellMode.ts `recordCommand`), else the link table's writes. */\n const recordCommand = shell().slots.recordCommand;\n const tagged = rule.add && rule.remove ? recordCommand?.(rule.add, say('addTag')) : undefined;\n const untagged = rule.add && rule.remove ? recordCommand?.(rule.remove, say('removeTag')) : undefined;\n const byCommand = Boolean(rule.add && rule.remove);\n const editable = byCommand ? Boolean(tagged && untagged) : Boolean(through && to && canInsert(through, true) && canDelete(through));\n const commandKey = () =>\n Object.fromEntries(\n Object.entries(recordKey).filter(\n (entry): entry is [string, string | number] => typeof entry[1] === 'string' || typeof entry[1] === 'number',\n ),\n );\n /* A command's outcome as the settle step reads a write's answer: a refusal is already said, so it is only kept from the toast. */\n const ran = async (run: () => Promise<{ status: string; message?: string }>) => {\n const outcome = await run();\n return outcome.status === 'refused' ? { errors: [{ message: outcome.message ?? '' }], said: true } : undefined;\n };\n if (!through || !to || parent == null || (!tags.length && !editable)) return null;\n\n const settle = async (work: () => Promise<unknown>, done: string) => {\n if (busy || (isCurrent && !isCurrent())) return;\n setBusy(true);\n try {\n const data = (await work()) as { errors?: Array<{ message: string }>; said?: boolean } | undefined;\n if (data?.errors?.length) {\n if (!data.said) toast(data.errors[0].message, 'error');\n return;\n }\n toast(done, 'ok');\n await client.invalidateQueries({ queryKey: ['run', connection ?? ''] });\n } catch (error) {\n toast((error as Error).message, 'error');\n } finally {\n setBusy(false);\n }\n };\n const add = (value: string) => {\n setAdding(false);\n if (!value || tags.some((tag) => tag.value === value)) return;\n void settle(\n () =>\n tagged\n ? ran(() => tagged(commandKey(), { tag: value }))\n : api('/api/insert', {\n table: rule.through,\n values: { [rule.from]: parent as string | number, [rule.via]: value },\n ...ownedBy(connection),\n }),\n say('tagAdded'),\n );\n };\n const remove = (tag: Tag) =>\n void settle(\n () =>\n untagged\n ? ran(() => untagged(commandKey(), { tag: tag.value }))\n : api('/api/delete', { table: rule.through, key: tag.link, confirm: true, ...ownedBy(connection) }),\n say('removed', { label: tag.label }),\n );\n const noun = humanName(to.name).toLowerCase();\n\n return (\n <div className=\"record-tags\" role=\"group\" aria-label={humanName(to.name)}>\n {tags.length > 0 && (\n <ul className=\"record-tags-list\">\n {tags.map((tag) => (\n <li key={tag.value} className={`record-tag tone tone-${tag.tone}`}>\n <span>{tag.label}</span>\n {editable && (\n <button\n type=\"button\"\n className=\"record-tag-remove\"\n aria-label={say('removeLabel', { label: tag.label })}\n disabled={busy}\n onClick={() => remove(tag)}\n >\n ×\n </button>\n )}\n </li>\n ))}\n </ul>\n )}\n {editable &&\n (adding ? (\n <span className=\"record-tags-pick\">\n <RecordPicker\n table={to}\n value=\"\"\n onChange={add}\n app\n hideKey\n ariaLabel={say('addNoun', { noun })}\n inputRef={picker}\n editing={{ onStateChange: () => {}, onCancel: () => setAdding(false) }}\n />\n </span>\n ) : (\n <button type=\"button\" className=\"ghost record-tags-add\" disabled={busy} onClick={() => setAdding(true)}>\n {say('plusAddNoun', { noun })}\n </button>\n ))}\n </div>\n );\n}\n","/**\n * Which documents a record has, and which one an address asks for\n * (shared/appDocuments.ts). A document is the last segment of its record's\n * address, where a record page's tab is said, so the walk carries it as the\n * entry's `tab`: the room that draws the record yields to the sheet when the\n * word names one of its table's documents. Small, and on every App page: the\n * sheet itself is a part loaded on demand.\n */\nimport { shell } from './shellMode.js';\nimport { tabWord } from '@mistriwork/engine/shared/addressParams.js';\nimport type { AppPayloadDocument } from '@mistriwork/engine/shared/servedApp.js';\n\n/** The documents of a table this reader is served, in the App's order. */\nexport function documentsOf(tableId: string | undefined): AppPayloadDocument[] {\n if (!tableId || !shell().inApp()) return [];\n return (shell().app()?.documents ?? []).filter((document) => document.base === tableId);\n}\n\n/** The document a record entry is on: its tab names one of its table's documents, by key or as an address says it. */\nexport function documentAt(entry: { table?: string; key?: unknown; tab?: string }): AppPayloadDocument | undefined {\n if (!entry.key || !entry.tab) return undefined;\n const asked = entry.tab;\n return documentsOf(entry.table).find((document) => document.id === asked || tabWord(document.id) === asked);\n}\n","/** What PageHead says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n isPinnedToTheHome: '\"{name}\" is pinned to the home screen',\n pinToTheHome: 'Pin \"{name}\" to the home screen',\n addRemoveAndReorder: 'Add, remove and reorder the sections of this page',\n thisPageBelongsToTheFile: 'This page belongs to the file it came from — editing it starts your own copy',\n layout: 'Layout',\n copyLayout: 'Copy layout',\n});\n","/**\n * A page's head: the page's name (a picker among the table's other pages\n * while authoring), pin and layout, and, once a record is chosen, the\n * record's name as the room's heading with its star, trail, actions,\n * Delete, tags and pending bar. Everything that acts on the whole record\n * sits here, above the sections.\n */\nimport { PHONE_QUERY, useMediaQuery } from './useMediaQuery.js';\nimport { useContext, useEffect, useState, useSyncExternalStore, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useQuery } from '@tanstack/react-query';\nimport { Button } from '@mistriwork/ui/Button.js';\nimport { columnDisplay, columnLabel, go, labelPath, rowLabel, state } from '../core.js';\nimport { readRecordSource, shareRecordSource } from '../recordSource.js';\nimport { pathEqualityFilter } from '../resourceRequests.js';\nimport { canEditRow, pendingCount, sameRow, stagedVersion, subscribeStaged } from '../write.js';\nimport type { AppAction } from '@mistriwork/engine/schema/model.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { factWord } from '@mistriwork/engine/shared/appCards.js';\nimport type { ColumnMeta, TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { shell } from '../shellMode.js';\nimport { isPinned, togglePinned } from '../pagemarks.js';\nimport { Editable, PendingBar } from './Editable.js';\nimport { RefJump, Value } from './Value.js';\nimport { headerColumns } from '@mistriwork/engine/shared/recordReads.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { useDelete } from './DeleteButton.js';\nimport { DropItem } from '@mistriwork/ui/DropMenu.js';\nimport { FavoriteStar } from './FavoriteStar.js';\nimport { relabelFavorite, type Favorite } from './favorites.js';\nimport { Dropdown } from './Dropdown.js';\nimport { RecordTags } from './RecordTags.js';\nimport { RecordTrailNav } from './RecordTrailNav.js';\nimport { useWalk } from './walk.js';\nimport { rootLabel, sourceOf, type PageDef, type PageSection } from './pageModel.js';\nimport { PageRenderContext, recordReadNames, spoken, usePageApi } from './pageContext.js';\nimport { hueOf, initialsOf } from './valueModel.js';\nimport { useAvatarPhotos } from './avatarPhotos.js';\nimport { primaryKey } from '@mistriwork/engine/shared/schema.js';\nimport { documentsOf } from '../documents.js';\nimport type { PageProps } from './Page.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { say } from '../copy/record/components/PageHead.js';\nimport { recordNotFound } from './RecordGone.js';\nimport { drawnLayout } from '@mistriwork/engine/shared/pageLayouts.js';\nimport { useCrumbSlots } from './crumbSlot.js';\nimport { onDemand } from './onDemand.js';\nimport { liveKeyText, useLiveActive, useRecentChange } from '../liveState.js';\n\n/* \"Updated by Ana just now\", once another person's change to this record has been told (liveState.ts). */\nconst LiveUpdatedLine = onDemand(() => import('./LiveNotices.js'), 'LiveUpdatedLine', { quiet: true });\n\nexport function PageHead({\n entry,\n page,\n base,\n others,\n onLayout,\n actions,\n host,\n onPending,\n title,\n gone = false,\n header,\n onSectionLabel,\n onTitleEditor,\n titleOwner,\n}: PageProps & {\n onPending: (opts?: { inPlace?: boolean }) => void;\n title?: () => ReactNode;\n gone?: boolean;\n /** The page's record header (useRecordHeader, below), drawn here wherever it is written. */\n header?: { section: PageSection; index: number };\n onSectionLabel?: (index: number, label: string | undefined) => void;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n titleOwner?: number;\n}) {\n useMessageLanguage();\n useWalk();\n const { isCurrent } = useContext(PageRenderContext);\n const authoring = !shell().inApp() && !host;\n const key = entry.key;\n const changedElsewhere = useRecentChange(base.id, key ? liveKeyText(key) : '');\n /* A draft of this record under live sync: the notice that may come over it has its row reserved from the first\n edit, so its arrival moves nothing (LiveNotices.css). */\n useSyncExternalStore(subscribeStaged, stagedVersion, stagedVersion);\n const liveDraft = useLiveActive(base.id) && Boolean(key) && sameRow(base.id, key) && pendingCount() > 0;\n const [pinned, setPinned] = useState(() => isPinned(page.id) as boolean);\n const suggested = { id: `suggested:${page.base}`, name: `${page.base} (default)`, source: 'suggested' };\n const items = [...others, ...(others.some((p) => p.id === suggested.id) ? [] : [suggested])].filter((p) => p.id !== page.id);\n const sayPage = (p: { name: string; source: string }) => (p.source === 'suggested' ? spoken(p.name) : p.name);\n /* A record that is gone has no name any more: the one the link carried is the last it was known by, and\n as the page's heading it says the record exists. The crumb trail keeps it, as where the reader came from. */\n const label = gone ? recordNotFound(spoken(base.name)) : (entry.label ?? (key ? rootLabel(key) : ''));\n const phone = useMediaQuery(PHONE_QUERY);\n /* A record page's verbs stand at the end of the crumb bar, as a list's New\n does: the bar stays at the top of the pane however long the page, so the\n record's next step is always in reach, and the name beneath it is free to\n take its line. A room drawn inside another (a split's detail, a dialog)\n and a phone keep them in the head; a phone holds them at the foot of the\n screen (page.css). */\n const { tools: crumbTools } = useCrumbSlots();\n const actionsInBar = Boolean(crumbTools && !host && !phone && shell().inApp());\n const said = useRecordHeader({\n page,\n base,\n recordKey: key,\n header: gone ? undefined : header,\n onSectionLabel,\n onTitleEditor,\n titleOwner,\n onEdit: onPending,\n });\n /* Which verbs take something away is read on every App record page, with\n or without a header: its first verb is the filled one, and a confirmed\n or bad-toned one first would fill the button that ends the record. */\n const named = header?.section.destructive;\n const destructive =\n header || shell().inApp()\n ? (() => {\n const tones = tonesOf(base.id);\n return (action: Parameters<typeof isDestructive>[0]) => isDestructive(action, named, tones);\n })()\n : undefined;\n const deleting = useDelete({\n table: base,\n recordKey: key ?? {},\n label,\n host: host\n ? {\n isCurrent: isCurrent!,\n onDeleted: host.onDeleted,\n onStateChange: host.onDeleteStateChange,\n }\n : undefined,\n });\n /* A star only where the App offers one (`favorite: true` on the resource). */\n const starred: Favorite | undefined =\n key && shell().inApp() && shell().app()?.resources[base.id]?.favorite\n ? { kind: 'record', table: base.id, key, label, pageId: page.id }\n : undefined;\n const starredId = starred ? JSON.stringify([starred.table, starred.key]) : '';\n /* Tags where the App gives the resource some (`tags`): chips under the title. */\n const tagRule = key && shell().inApp() ? shell().app()?.resources[base.id]?.tags : undefined;\n /* A record avatar is presentation of the label already loaded for this\n heading. It is deliberately limited to an explicit local display rule:\n composite labels and key fallbacks must not invent an identity mark or\n trigger another read. */\n const recordLabelPath = key && shell().inApp() ? labelPath(base) : undefined;\n /* Whether the resource gives its records an avatar is the App's to say, known before the name arrives: a head\n that stands it large beside the name (recipes.header 'hero', themeFamilies.css) keeps its room from the first paint. */\n const avatarDeclared = Boolean(\n !gone && recordLabelPath && !recordLabelPath.includes('.') && shell().app()?.resources[base.id]?.display?.[recordLabelPath]?.avatar,\n );\n const recordAvatar = avatarDeclared && Boolean(entry.label);\n /* A person whose avatar is their photo (`avatar: { from, whose }`) wears it\n here too, as in every list that names them; the initials stand in where\n there is none, or the reader may not read it. */\n const avatarRule = recordAvatar ? shell().app()?.resources[base.id]?.display?.[recordLabelPath!] : undefined;\n const ownKey = primaryKey(base);\n const photos = useAvatarPhotos(\n recordAvatar && ownKey.length === 1 ? [{ name: recordLabelPath!, display: avatarRule as never, photoOwner: ownKey[0] }] : [],\n recordAvatar && key ? [key] : [],\n );\n const photo = recordAvatar && key && ownKey.length === 1 ? photos(recordLabelPath!, key[ownKey[0]]) : undefined;\n const [brokenPhoto, setBrokenPhoto] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (starred) relabelFavorite(starred);\n }, [starredId, label]);\n /* The record put on paper — its invoice, its packing slip — is a verb on it, in More, before Delete: reading, not changing. */\n const documents = key && !gone ? documentsOf(base.id) : [];\n /* A record that is gone has nothing to be done to it: no verbs, no Delete. */\n /* The verbs, the documents and Delete stand in the App's bar (Actions.tsx), drawn through the shell's slot. */\n const { ActionBar } = shell().slots;\n const toolbar =\n ActionBar && key && !gone && (actions || deleting.available || documents.length) ? (\n <div className=\"page-head-actions\">\n <ActionBar\n tableId={base.id}\n actions={actions?.list ?? []}\n recordKey={key}\n label={label}\n matches={actions?.matches ?? (async () => false)}\n queryScope={actions?.queryScope}\n isCurrent={isCurrent}\n compact={phone}\n destructive={destructive}\n primary={header?.section.primary}\n only={header?.section.headerActions}\n canUpdate={actions?.canUpdate}\n grantedCommands={actions?.grantedCommands}\n grantedActions={actions?.grantedActions}\n menuTail={\n documents.length || deleting.available ? (\n <>\n {documents.map((document) => (\n <DropItem\n key={document.id}\n className=\"page-actions-item\"\n onClick={() => go({ kind: 'page', pageId: page.id, table: base.id, key, label, tab: document.id })}\n >\n {document.label}\n </DropItem>\n ))}\n {deleting.available && (\n <DropItem className=\"page-actions-item is-danger\" disabled={deleting.blocked} onClick={deleting.ask}>\n {say('common.delete')}\n </DropItem>\n )}\n </>\n ) : undefined\n }\n onDone={() => {\n if (host) {\n if (isCurrent?.()) host.onActionDone();\n } else onPending({ inPlace: false });\n }}\n />\n </div>\n ) : null;\n return (\n <div\n className={`page-head${key ? ' has-record' : ''}${!host && shell().inApp() ? ' is-room' : ''}${avatarDeclared ? ' has-avatar' : ''}`}\n data-layout={drawnLayout(page)}\n >\n <div className=\"page-head-top\">\n {authoring && items.length ? (\n <div className=\"page-title-pick\">\n <Dropdown\n ariaLabel={say('common.page')}\n value={page.id}\n items={[\n { value: page.id, label: sayPage(page), detail: sourceOf(page) },\n ...items.map((p) => ({ value: p.id, label: sayPage(p), detail: sourceOf(p) })),\n ]}\n onChange={(id) => {\n if (id !== page.id) go({ ...entry, pageId: id }, 'replace');\n }}\n valueClassName=\"page-title\"\n />\n </div>\n ) : key ? (\n /* Over a record's name its kind is a label for someone who works\n across tables; a public reader came for the car, not \"VEHICLE\". */\n shell().publicVisitor() ? null : (\n <span className=\"page-title\">{sayPage(page)}</span>\n )\n ) : (\n <h1 className=\"page-title\">{sayPage(page)}</h1>\n )}\n {!shell().inApp() && (\n <button\n type=\"button\"\n className={`ghost page-pin${pinned ? ' is-pinned' : ''}`}\n aria-pressed={pinned}\n title={pinned ? say('isPinnedToTheHome', { name: page.name }) : say('pinToTheHome', { name: page.name })}\n aria-label={pinned ? say('isPinnedToTheHome', { name: page.name }) : say('pinToTheHome', { name: page.name })}\n onClick={() => setPinned(togglePinned(page) as boolean)}\n >\n {pinned ? '★' : '☆'}\n </button>\n )}\n {key && changedElsewhere && !gone && <LiveUpdatedLine table={base} recordKey={key} />}\n {authoring && (\n <Button\n size=\"compact\"\n className=\"page-edit\"\n title={page.source === 'saved' ? say('addRemoveAndReorder') : say('thisPageBelongsToTheFile')}\n onClick={onLayout}\n >\n {page.source === 'saved' ? say('layout') : say('copyLayout')}\n </Button>\n )}\n </div>\n {key && (\n <div className=\"root-bar\">\n {recordAvatar &&\n (photo && photo !== brokenPhoto ? (\n <img\n className={`page-record-avatar avatar avatar-photo avatar-c${hueOf(label)}`}\n src={photo}\n alt=\"\"\n decoding=\"async\"\n onError={() => setBrokenPhoto(photo)}\n />\n ) : (\n <span className={`page-record-avatar avatar avatar-c${hueOf(label)}`} aria-hidden=\"true\">\n {initialsOf(label)}\n </span>\n ))}\n {title ? (\n // Named by the record, not by the Edit button inside it.\n <div className=\"root-current\" role=\"heading\" aria-level={1} aria-label={label}>\n {title()}\n </div>\n ) : (\n <h1 className=\"root-current\">\n {/* One line, cut short where it must: the whole name is the crumb's and this one's title. */}\n <span title={label}>{label}</span>\n </h1>\n )}\n {starred && <FavoriteStar favorite={starred} name={label} />}\n {said.status}\n {/* \"3 of 20\" and the arrows, where the record was opened from a list. */}\n <RecordTrailNav entry={entry} />\n </div>\n )}\n {/* The head's second column (page.css), unless the crumb bar holds the verbs. */}\n {toolbar && actionsInBar ? createPortal(toolbar, crumbTools!, 'record-actions') : toolbar}\n {/* A header's facts: under the name, in its column (page.css). */}\n {key && said.facts}\n {key && tagRule && <RecordTags rule={tagRule} recordKey={key} isCurrent={isCurrent} />}\n {deleting.dialog}\n {key && (\n <div className={`page-pending${liveDraft ? ' has-live-draft' : ''}`}>\n <PendingBar\n table={base}\n recordKey={key}\n placement={host?.pendingBar}\n isCurrent={isCurrent}\n onDone={(done) => onPending(host ? done : (done ?? { inPlace: true }))}\n />\n </div>\n )}\n </div>\n );\n}\n\n/* A record header (`header({ status, facts })`, presentation 'header'): the\n * head told what else to say. The status column's tone is a chip beside the\n * name; the facts are one line under it, each a value under its caption, or\n * dressed by a fact's word after or before it (\"3 beds\", \"Born Apr 24, 2017\")\n * where the author wrote one. It reads the record's row once,\n * names the record for the head as a fields section would, and hands the head\n * the editor for the name where the name may change. It lives in this module\n * rather than one of its own because it reads the page context, the editor\n * and the App, which already import the page: a module of its own joined that\n * cycle (test/repo/runtime-cycles.test.ts). Which verbs are destructive is said\n * here too: the head draws them last and quiet, never as the filled first\n * button (docs/design.md, the record head). */\ntype Tones = Record<string, Record<string, string> | undefined>;\n\n/**\n * Whether a verb takes something away: named (by id) in the header's `destructive`,\n * or an update that asks to be confirmed, or one that sets a value its\n * column's display tones call bad (\"Mark lost\" → `lost: 'bad'`). A command\n * says nothing of what it writes, so only its name makes it one.\n */\nexport function isDestructive(action: AppAction, named: readonly string[] | undefined, tones: Tones): boolean {\n if (named?.includes(action.id)) return true;\n if (action.command) return false;\n if (action.confirm) return true;\n return Object.entries(action.set ?? {}).some(([column, value]) => typeof value === 'string' && tones[column]?.[value] === 'bad');\n}\n\n/** The display tones of a table's columns in the App, by column. */\nfunction tonesOf(tableId: string): Tones {\n const display =\n (shell().app() as { resources?: Record<string, { display?: Record<string, { tone?: Record<string, string> }> }> } | null)?.resources?.[\n tableId\n ]?.display ?? {};\n return Object.fromEntries(Object.entries(display).map(([column, rule]) => [column, rule?.tone]));\n}\n\ninterface HeaderParts {\n status: ReactNode;\n facts: ReactNode;\n}\n\n/**\n * The header's row and what the head draws from it. Called by the head on\n * every render; with no header it reads nothing and draws nothing.\n */\nfunction useRecordHeader({\n page,\n base,\n recordKey: key,\n header,\n onSectionLabel,\n onTitleEditor,\n titleOwner,\n onEdit,\n}: {\n page: PageDef;\n base: TableMeta;\n recordKey: Record<string, unknown> | undefined;\n header: { section: PageSection; index: number } | undefined;\n onSectionLabel?: (index: number, label: string | undefined) => void;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n titleOwner?: number;\n onEdit?: (opts?: { inPlace?: boolean }) => void;\n}): HeaderParts {\n const api = usePageApi();\n const { preview, isCurrent, adorn, adornHeld } = useContext(PageRenderContext);\n const section = header?.section;\n const index = header?.index ?? -1;\n const facts = section?.paths ?? [];\n const status = section?.status;\n const namePath = labelPath(base) as string | undefined;\n /* Built as the server builds it for the page's compose (shared/recordReads.ts). */\n const { fetched, labels: refLabels } = headerColumns(recordReadNames(), base, section ?? { kind: 'fields' });\n const data = useQuery({\n queryKey: ['page-fields', page.id, base.id, key, fetched],\n structuralSharing: shareRecordSource,\n queryFn: () =>\n readRecordSource(() =>\n api('/api/view/run', {\n count: 'none',\n view: {\n id: `page:${page.id}:header`,\n name: base.name,\n base: base.id,\n columns: fetched.map((path) => ({ path })),\n filter: pathEqualityFilter(Object.fromEntries((primaryKey(base) as string[]).map((column) => [column, key![column]]))),\n limit: 1,\n },\n }),\n ),\n enabled: Boolean(section && key),\n staleTime: 0,\n });\n const got = data.data && 'view' in data.data ? data.data : undefined;\n const row = got?.rows[0];\n /* The header names the record for the head, first of every section. */\n useEffect(() => {\n if (row && header) onSectionLabel?.(index, rowLabel(base, row));\n }, [row, index]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(\n () => () => {\n if (header) onSectionLabel?.(index, undefined);\n },\n [index],\n ); // eslint-disable-line react-hooks/exhaustive-deps\n const titleColumn =\n header && titleOwner === index && shell().inApp() && !preview && namePath && !namePath.includes('.')\n ? base.columns.find((c) => c.name === namePath)\n : undefined;\n const titleEditable = Boolean(\n key && titleColumn && !titleColumn.primaryKey && titleColumn.writable !== false && (canEditRow(base, key) as boolean),\n );\n useEffect(() => {\n if (!onTitleEditor || !header) return;\n if (!row || !titleEditable || !titleColumn) {\n onTitleEditor(index, undefined);\n return;\n }\n onTitleEditor(index, () => (\n <Editable\n table={base}\n row={row}\n column={titleColumn}\n recordKey={key!}\n onSaved={onEdit ?? (() => {})}\n isCurrent={isCurrent}\n app\n display={(next) => <span>{next === null || next === undefined || String(next) === '' ? rowLabel(base, row) : String(next)}</span>}\n />\n ));\n }, [row, titleEditable, index]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(\n () => () => {\n if (header) onTitleEditor?.(index, undefined);\n },\n [index],\n ); // eslint-disable-line react-hooks/exhaustive-deps\n /* The facts' line is held while the row is on its way: under the name it\n pushed the whole page down when it came (test/built-client-vitals.mjs). So is it while the host's adornments are\n asked about one of its empty facts: an empty fact is left out, and one the host adorns would join the line late. */\n const waitsOnHost = Boolean(row && adornHeld?.length) && facts.some((path) => adornHeld!.includes(path) && (row![path] ?? '') === '');\n if (section && ((!row && data.isPending) || waitsOnHost) && facts.length)\n return {\n status: null,\n facts: (\n <ul className=\"page-facts page-head-facts\" aria-hidden=\"true\" style={{ visibility: 'hidden' }}>\n <li className=\"page-fact\"> </li>\n </ul>\n ),\n };\n if (!section || !row) return { status: null, facts: null };\n\n const presented = presentationColumns(state.schema, base, [...(status ? [status] : []), ...facts]);\n const byPath = new Map((got?.resolved ?? []).map((c) => [c.path, c]));\n const columnAt = (path: string) =>\n (base.columns.find((c) => c.name === path) ?? presented.get(path) ?? byPath.get(path)) as\n | (ColumnMeta & { references?: { table: string; column: string } })\n | undefined;\n const filled = (path: string) => row[path] !== null && row[path] !== undefined && row[path] !== '';\n const captionOf = (path: string) => (columnLabel(base.id, path) as string | null) ?? humanName(path.split('.').pop() ?? path);\n const said = (path: string) => {\n const column = columnAt(path);\n const labelAt = refLabels.get(path);\n return column?.references ? (\n <RefJump\n references={column.references}\n value={row[path]}\n label={labelAt ? row[labelAt] : undefined}\n table={base}\n column={path}\n row={row}\n />\n ) : (\n <Value col={column} value={row[path]} tableId={base.id} compact />\n );\n };\n /* What the host draws at an own column: beside a filled fact's value, or as an empty fact's whole value. */\n const adornedAt = (path: string) =>\n adorn && key && !preview && !path.includes('.') && base.columns.some((c) => c.name === path)\n ? adorn({ table: base.id, column: path, key, filled: filled(path) })\n : undefined;\n const adornments = new Map(facts.map((path) => [path, adornedAt(path)] as const));\n const shown = facts.filter((path) => filled(path) || adornments.get(path));\n return {\n /* Its caption is heard, not seen: beside the name a chip is its own word. */\n status:\n status && filled(status) ? (\n <span className=\"page-head-status\">\n <span className=\"visually-hidden\">{captionOf(status)}: </span>\n {said(status)}\n </span>\n ) : null,\n facts: shown.length ? (\n <ul className=\"page-facts page-head-facts\" aria-label={say('common.keyFacts')}>\n {shown.map((path) => {\n const labels = section.factLabels;\n const word =\n labels && Object.hasOwn(labels, path)\n ? factWord(labels[path], row[path], columnDisplay(base.id, path) as { format?: string; unit?: string; bar?: boolean } | null)\n : undefined;\n const before = word !== undefined && labels![path].position === 'before';\n return (\n <li key={path} className=\"page-fact\">\n {/* A fact is a captioned value, as a field is: \"Close date\" over \"Dec 11, 2026\". An authored word\n (\"3 beds\", \"Asking $22,495\") is its own caption. */}\n {word === undefined && (\n <span className=\"page-fact-caption\">\n {captionOf(path)}\n <span className=\"visually-hidden\">: </span>\n </span>\n )}\n {before && <span className=\"page-fact-word\">{word} </span>}\n {filled(path) && said(path)}\n {word !== undefined && !before && <span className=\"page-fact-word\"> {word}</span>}\n {adornments.get(path)}\n </li>\n );\n })}\n </ul>\n ) : null,\n };\n}\n","/** What PageLayout says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n recordContext: 'Record context',\n /** A showcase's panel, named by what it offers: \"Home: Asking rent\". */\n showcasePanel: '{noun}: {figure}',\n});\n","/**\n * The record's main content and optional context rail share one responsive layout, arranged by the page's\n * archetype (shared/pageLayouts.ts). `data-layout` names it from the first render, so the columns are the\n * archetype's before any section has landed; the geometry is page.css's, keyed on it.\n */\nimport type { ReactNode } from 'react';\nimport type { PageLayoutName } from '@mistriwork/engine/shared/pageLayouts.js';\nimport { say } from '../copy/record/components/PageLayout.js';\n\nexport function PageLayout({\n children,\n aside,\n asideLabel = say('recordContext'),\n layout,\n leads,\n below,\n panel,\n}: {\n children: ReactNode;\n aside?: ReactNode;\n asideLabel?: string;\n layout?: PageLayoutName;\n /** The aside holds an offer, a reference's card or the one current row, which stacked columns weave into the main one. */\n leads?: boolean;\n /** A showcase's body: the main column's sections after its photos, under the showcase band at full width. */\n below?: ReactNode;\n /** A showcase's panel, named by what it offers (\"Home: Asking rent\") rather than as the record's context. */\n panel?: { noun: string; figure?: string };\n}) {\n if (!aside) {\n return (\n <div className=\"page-body\" data-layout={layout}>\n {children}\n {below}\n </div>\n );\n }\n /* A showcase is two bands, in reading order: the photos with the panel beside them, then the body under both. On\n a phone the three stack as written, so the price and its call to action follow the photos, not every list. */\n if (layout === 'showcase') {\n return (\n <div className=\"page-layout\" data-layout=\"showcase\">\n <div className=\"page-body page-main page-showcase\">{children}</div>\n <aside\n className=\"page-body page-aside page-panel\"\n aria-label={panel ? (panel.figure ? say('showcasePanel', { noun: panel.noun, figure: panel.figure }) : panel.noun) : asideLabel}\n >\n {aside}\n </aside>\n {below && <div className=\"page-body page-showcase-body\">{below}</div>}\n </div>\n );\n }\n return (\n <div className=\"page-layout\" data-layout={layout} data-leads={leads || undefined}>\n <div className=\"page-body page-main\">{children}</div>\n <aside className=\"page-body page-aside\" aria-label={asideLabel}>\n {aside}\n </aside>\n </div>\n );\n}\n","/**\n * A page: one record, and everything around it at once.\n *\n * Sections are Queries started together that land as they arrive, each in\n * its own place: a page with a count over a large child table should not\n * hold up the record's own name. A section with a `when` is shown only\n * while the root satisfies it; a run of metrics is one strip; a run of\n * lists is a tab strip whose tabs are fetched when opened, which is the\n * whole reason six lists as tabs are cheaper than six lists down a page.\n * One bad section is named in place and does not take the page with it.\n *\n * The leaves — a value in its dress, a reference chip, an editable field,\n * the pending bar, Delete, the layout builder — are the vanilla client's\n * still, drawn into place.\n *\n * This module is the page itself: which surface it belongs to, which\n * section names the record, and the related New form a host keeps open\n * across refreshes. The head is PageHead.tsx and the sections' layout\n * PageSections.tsx; each kind draws in its own module (PageFields,\n * PageMetrics, PageTimeline, PageRelated) through one box (PageSectionBox),\n * reading the page around it from pageContext.ts.\n */\nimport { ErrorBoundary } from './ErrorBoundary.js';\nimport { ProblemScopeProvider } from './Notes.js';\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { columnLabel, registerSurfaceMutationPendingProbe, state } from '../core.js';\nimport { refreshRecordInPlace } from '../recordWriteRefresh.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { PendingBarPlacement } from './Editable.js';\nimport type { DeleteButtonHost } from './DeleteButton.js';\nimport type { RecordSurfaceOwner } from './recordSurface.js';\nimport { openRelatedRecord } from '../insert.js';\nimport type { NewRecordProps } from './NewRecord.js';\nimport { onDemand } from './onDemand.js';\nimport { RecordGone } from './RecordGone.js';\nimport { headerOf, rootLabel, type PageDef, type PageEntry, type SectionPlan } from './pageModel.js';\nimport { PageRenderContext, spoken, type RecordActions, type RelatedCreator } from './pageContext.js';\nimport { shell } from '../shellMode.js';\nimport { PageHead } from './PageHead.js';\nimport { Sections } from './PageSections.js';\nimport { PageLayout } from './PageLayout.js';\nimport { drawnLayout, showcaseIndex } from '@mistriwork/engine/shared/pageLayouts.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\n\n/* The form and its field library load when a related New first opens. */\nconst NewRecordDialog = onDemand(() => import('./NewRecord.js'), 'NewRecordDialog', { quiet: true });\n\n/** One explicitly owned, non-route editor (never a second active draft). Keep owner stable through lease\n * renewal and ordinary refresh; replace it on close/reopen or another entry.\n * The host owns navigation and must retain pending/uncertain deletion status\n * synchronously, blocking voluntary close/replacement until reconciled. */\nexport interface PageViewHost {\n owner: RecordSurfaceOwner;\n pendingBar: PendingBarPlacement;\n /** undefined is staging/discard, NOT acknowledgement; true is confirmed\n * Save/Undo, false requests refresh. Refresh this surface without remounting\n * its editor or replacing dirty fields. */\n onRecordChange: (opts?: { inPlace?: boolean }) => void;\n /** Includes both authored fixed actions and separately granted commands. */\n onActionDone: () => void;\n onDeleted: () => void;\n onDeleteStateChange: DeleteButtonHost['onStateChange'];\n}\n\nexport interface PageProps {\n entry: PageEntry;\n page: PageDef;\n base: TableMeta;\n plans: SectionPlan[];\n /** With no record chosen, the list *is* the chooser, drawn into the body. */\n chooser?: ReactNode;\n /** The other pages this table has, for the title's picker. */\n others: Array<{ id: string; name: string; source: string }>;\n onLabel: (label: string) => void;\n onTab: (tab: string | undefined) => void;\n onLayout: () => void;\n /** Fixed edits and separately granted business commands. */\n actions?: RecordActions;\n /** Authoring preview: no write/navigation leaves, with reads pinned to the editor's connection. */\n preview?: { connection: string };\n host?: PageViewHost;\n /** No head: the sections alone, as a free-form page's block places them (RecordPageBody's `only`). */\n bare?: boolean;\n}\n\n/* ---------- the page ---------- */\n\nexport function PageView(props: PageProps) {\n const { entry, page, base, plans, chooser, host } = props;\n const queries = useQueryClient();\n const keyText = JSON.stringify(entry.key);\n const surface = useMemo(\n () => (host ? { owner: host.owner, pageId: entry.pageId, table: base.id, keyText } : undefined),\n [host?.owner, entry.pageId, base.id, keyText],\n );\n const activeSurface = useRef(surface);\n activeSurface.current = surface;\n const activeEntry = useRef(entry);\n activeEntry.current = entry;\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const isCurrent = useCallback(\n () =>\n !surface ||\n (mounted.current &&\n activeSurface.current === surface &&\n surface.owner.isCurrent() &&\n activeEntry.current.pageId === surface.pageId &&\n JSON.stringify(activeEntry.current.key) === surface.keyText),\n [surface],\n );\n // Keep the child above section loading/error branches: a related refresh must\n // not unmount a pending form or the parent field editor. The actual Dialog is\n // still a descendant of the record Modal in React's focus-ownership tree.\n type RelatedForm = { surface: typeof surface; props?: NewRecordProps; unresolved: boolean; changed: (value: boolean) => void };\n const [related, setRelated] = useState<RelatedForm | null>(null);\n const activeRelated = useRef<RelatedForm | null>(null);\n const relatedAnchor = useRef<HTMLSpanElement>(null);\n useLayoutEffect(() => {\n if (!surface) return;\n return registerSurfaceMutationPendingProbe(\n () => isCurrent() && activeRelated.current?.surface === surface && activeRelated.current.unresolved,\n );\n }, [surface, isCurrent]);\n const openRelated: RelatedCreator = (table, form, onAdded) => {\n if (!surface || !isCurrent() || !relatedAnchor.current || activeRelated.current?.surface === surface) return;\n const child: RelatedForm = {\n surface,\n unresolved: false,\n changed: (value) => {\n if (isCurrent() && activeRelated.current === child) child.unresolved = value;\n },\n };\n activeRelated.current = child;\n const current = () => isCurrent() && activeRelated.current === child;\n openRelatedRecord(table, form, onAdded, {\n host: relatedAnchor.current,\n isCurrent: current,\n close: () => {\n if (current()) {\n activeRelated.current = null;\n setRelated(null);\n }\n },\n render: (props) => {\n if (current()) {\n child.props = props;\n setRelated(child);\n }\n },\n });\n if (!child.props && activeRelated.current === child) activeRelated.current = null;\n };\n const onLabel = (label: string) => {\n if (isCurrent()) props.onLabel(label);\n };\n const onTab = (tab: string | undefined) => {\n if (isCurrent()) props.onTab(tab);\n };\n const hasAside = page.sections.some((section) => section.region === 'aside' && !section.hidden);\n /* An aside that says something of the record's surroundings — an offer, a reference's card, the one current row —\n is woven into the main column where the columns stack (page.css). Said from the page, as the archetype is, rather\n than asked of the drawn sections with :has(), which restyled the whole page each time an element came or went\n in it (test/built-client-vitals.mjs). */\n const leads = page.sections.some(\n (section) => section.region === 'aside' && !section.hidden && (section.presentation === 'headline' || section.presentation === 'card'),\n );\n const [labelOwner, setLabelOwner] = useState<number | undefined>(undefined);\n const [titleEditor, setTitleEditor] = useState<{ index: number; render: () => ReactNode } | null>(null);\n const onTitleEditor = useCallback((index: number, render: (() => ReactNode) | undefined) => {\n setTitleEditor((current) => (render ? { index, render } : current?.index === index ? null : current));\n }, []);\n /* A record header names the record first: it is the head. */\n const header = useMemo(() => headerOf(page), [page]);\n /* A verb a related list draws in its own head (`actions`) is that list's, not the record's head's — unless the\n record's header names it too. */\n const headActions = useMemo(() => {\n const placed = new Set(page.sections.flatMap((section) => section.listActions ?? []));\n for (const id of header?.section.headerActions ?? []) placed.delete(id);\n const all = props.actions;\n return all && placed.size ? { ...all, list: all.list.filter((action) => !placed.has(action.id)) } : all;\n }, [page, header, props.actions]);\n const labelOrder = useMemo(() => {\n const fields = page.sections\n .map((section, index) => ({ section, index }))\n .filter(({ section }) => section.kind === 'fields' && !section.hidden);\n const heads = fields.filter(({ section }) => section.presentation === 'header');\n const rest = fields.filter(({ section }) => section.presentation !== 'header');\n return [\n ...heads,\n ...rest.filter(({ section }) => section.region !== 'aside'),\n ...rest.filter(({ section }) => section.region === 'aside'),\n ];\n }, [page]);\n const titleOwner = hasAside ? labelOwner : labelOrder[0]?.index;\n // Keyed on what identifies the record and its page, not on object identity:\n // a host that rebuilds its props per render must not restart label ownership.\n const labels = useMemo(() => ({ values: new Map<number, string>(), published: undefined as string | undefined }), [page.id, keyText]); // eslint-disable-line react-hooks/exhaustive-deps\n const activeLabels = useRef(labels);\n activeLabels.current = labels;\n const publishLabel = useRef(onLabel);\n publishLabel.current = onLabel;\n const onSectionLabel = useCallback(\n (index: number, label: string | undefined) => {\n // Cleanup from an old page must not publish into its replacement.\n if (activeLabels.current !== labels || !isCurrent()) return;\n if (label === undefined) labels.values.delete(index);\n else labels.values.set(index, label);\n // A gated or slow main section must not prevent an already-loaded section\n // from naming the record; an aside can never supersede a loaded main label.\n const owner = labelOrder.find((item) => labels.values.has(item.index));\n setLabelOwner(owner?.index);\n const chosen = owner && labels.values.get(owner.index);\n if (chosen !== undefined && chosen !== labels.published) {\n labels.published = chosen;\n publishLabel.current(chosen);\n }\n },\n [labels, labelOrder, isCurrent],\n );\n /* A write that landed in place needs no repaint — the bar reads the\n store and the fields confirm themselves; one that asked for it gets one. */\n const refreshInPlace = () => {\n if (!entry.key) return;\n refreshRecordInPlace(\n queries,\n { connection: state.activeConnection ?? '', table: base.id, key: entry.key, queryScope: props.actions?.queryScope },\n true,\n );\n };\n /* What the shell draws at the record's own fields (a suggestion waiting on one): asked by every record page, routed\n or in a dialog, never by a preview. The slot is the shell's for its whole life, so the hook's place is fixed. A\n suggestion that landed wrote to the record, so it is read again as any write asks. */\n const landed = useRef<() => void>(() => {});\n const adornment = shell().slots.useFieldAdornment?.(\n host?.owner.connection ?? state.activeConnection ?? '',\n base.id,\n props.preview ? undefined : entry.key,\n () => landed.current(),\n );\n const onPending = (opts?: { inPlace?: boolean }) => {\n if (host) {\n if (isCurrent()) host.onRecordChange(opts);\n return;\n }\n /* Re-read in place, never by replacing the walk entry: that started the\n room over and blanked the record until every read had answered again\n (recordWriteRefresh.ts, refreshRecordInPlace). */\n if (opts && opts.inPlace === false) refreshInPlace();\n else if (opts?.inPlace && page.sections.some((section) => section.workflow))\n void queries.invalidateQueries({ queryKey: ['page-fields', page.id, base.id, entry.key] });\n };\n /* A record that is gone — deleted under an open page, or a link to one\n that never was — fails every section at once. It is said once, in the\n words the room uses for a missing record (PageRoom.tsx), and the head\n offers no verbs for it: each section repeating a 404 beside Start work\n and Mark done was a page still open for business. */\n landed.current = () => onPending({ inPlace: false });\n const [goneKey, setGone] = useState<string | null>(null);\n const gone = goneKey === keyText;\n const onGone = useCallback(() => setGone(keyText), [keyText]);\n if (host && !isCurrent()) return null;\n /* The archetype (shared/pageLayouts.ts) is on the page the payload carries, so its columns are drawn on the first\n render, before any section has answered. */\n const layout = drawnLayout(page);\n const showcase = showcaseIndex(page);\n const sectionsOf = (region: 'main' | 'aside' | undefined, only?: (index: number) => boolean) =>\n entry.key ? (\n <Sections\n page={page}\n base={base}\n recordKey={entry.key}\n plans={plans}\n entry={entry}\n onLabel={onLabel}\n onEdit={onPending}\n onTab={onTab}\n region={region}\n onSectionLabel={onSectionLabel}\n titleOwner={titleOwner}\n onTitleEditor={onTitleEditor}\n only={only}\n />\n ) : null;\n /* A showcase's panel is named by what it offers, \"Home: Asking rent\", where a record's aside is its context. */\n const offer =\n layout === 'showcase' ? page.sections.find((section) => section.region === 'aside' && section.presentation === 'headline') : undefined;\n const figure = offer?.paths?.[0];\n const panel =\n layout === 'showcase'\n ? {\n noun: page.name,\n figure: figure ? ((columnLabel(base.id, figure) as string | null) ?? humanName(figure.split('.').pop() ?? figure)) : undefined,\n }\n : undefined;\n return (\n <PageRenderContext.Provider\n value={{\n ...(adornment?.adorn && !props.preview ? { adorn: adornment.adorn } : {}),\n ...(adornment?.held.length && !props.preview ? { adornHeld: adornment.held } : {}),\n preview: Boolean(props.preview),\n connection: props.preview?.connection ?? host?.owner.connection,\n isCurrent: host ? isCurrent : undefined,\n openRelated: host ? openRelated : undefined,\n actions: props.preview || gone ? undefined : props.actions,\n onGone,\n recordName: entry.label,\n ...(host ? { onActionDone: host.onActionDone } : {}),\n }}\n >\n <ProblemScopeProvider>\n {props.preview ? (\n <div className=\"page-head\">\n <h2 className=\"page-title\">{page.name}</h2>\n <div className=\"root-bar\">\n <h1 className=\"root-current\">{entry.label ?? (entry.key ? rootLabel(entry.key) : '')}</h1>\n </div>\n </div>\n ) : props.bare ? null : (\n <ErrorBoundary>\n <PageHead\n {...props}\n actions={gone ? undefined : headActions}\n gone={gone}\n onPending={onPending}\n title={titleEditor && titleEditor.index === titleOwner ? titleEditor.render : undefined}\n header={header}\n onSectionLabel={onSectionLabel}\n onTitleEditor={onTitleEditor}\n titleOwner={titleOwner}\n />\n </ErrorBoundary>\n )}\n {gone && entry.key ? (\n <PageLayout>\n <RecordGone base={base} spoken={spoken(base.name)} className=\"page-gone\" />\n </PageLayout>\n ) : entry.key ? (\n showcase !== undefined ? (\n <PageLayout\n layout={layout}\n panel={panel}\n aside={hasAside ? sectionsOf('aside') : undefined}\n below={sectionsOf(hasAside ? 'main' : undefined, (index) => index !== showcase)}\n >\n {sectionsOf(hasAside ? 'main' : undefined, (index) => index === showcase)}\n </PageLayout>\n ) : (\n <PageLayout layout={layout} leads={leads} aside={hasAside ? sectionsOf('aside') : undefined}>\n {sectionsOf(hasAside ? 'main' : undefined)}\n </PageLayout>\n )\n ) : (\n <PageLayout>{chooser}</PageLayout>\n )}\n {host && <span hidden ref={relatedAnchor} />}\n {related?.props && related.surface === surface && (\n <NewRecordDialog {...related.props} retainUncertain onUnresolvedChange={related.changed} />\n )}\n </ProblemScopeProvider>\n </PageRenderContext.Provider>\n );\n}\n","/** What RecordPageBody says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '@mistriwork/kit/client/messages.js';\n\nexport const say = defineMessages({\n thisRecordIsNoLonger: 'This record is no longer available.',\n theDeletionResultIsNotYet: 'The deletion result is not yet confirmed. Keep this tab open; do not submit another deletion.',\n});\n","/**\n * A record's waiting suggestions, drawn at their fields through the page's adornment slot (kit's pageContext.ts\n * `FieldAdornment`): asked beside the record's own read, only for a table the App says a decision answers, and drawn\n * by DecisionChip, which loads when a record first has one — an App that decides nothing never fetches it.\n *\n * Until the chip's code is here its place is held by the answer's words in the same muted ink, so the line it stands\n * on is the height it will be.\n */\nimport { lazy, Suspense, useMemo, useRef } from 'react';\nimport { useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query';\nimport { api } from '@mistriwork/kit/client/core.js';\nimport type { FieldAdornment } from '@mistriwork/kit/client/components/pageContext.js';\nimport type { FieldSuggestion } from '../../shared/decisionSuggestions.js';\nimport { activeApp } from '../appState.js';\nimport './decisionMarks.css';\n\nconst NOTHING: readonly string[] = Object.freeze([]);\n\nconst DecisionChip = lazy(() => import('./DecisionChip.js'));\n\nconst suggestionsKey = (connection: string, table: string, key?: string) =>\n key === undefined ? ['record-decisions', connection, table] : ['record-decisions', connection, table, key];\n\n/** Ask a record's suggestions again: after a command landed on it, or one was settled. */\nexport function refreshDecisions(client: QueryClient, connection: string, table: string): void {\n void client.invalidateQueries({ queryKey: suggestionsKey(connection, table) });\n}\n\n/**\n * A record's suggestions, drawn at its fields, and whether they are still being asked for the first time — the shell's\n * `useFieldAdornment` slot (kit's shellMode.ts), read by every record page. While asked, a header leaves an empty fact\n * out, so its facts' line waits for them (kit's pageContext.ts `adornHeld`) rather than grow when they come. An error is\n * not a wait. No key (a preview, a list with no record chosen) asks nothing.\n */\nexport function useRecordDecisions(\n connection: string,\n table: string,\n recordKey: Readonly<Record<string, unknown>> | undefined,\n onLanded: () => void,\n): { adorn?: FieldAdornment; held: readonly string[] } {\n const keyText = JSON.stringify(recordKey ?? null);\n const client = useQueryClient();\n const answered = activeApp()?.decisions?.[table];\n const decided = Boolean(answered) && recordKey !== undefined;\n const asked = useQuery({\n queryKey: suggestionsKey(connection, table, keyText),\n queryFn: async () =>\n ((await api('/api/record-decisions', { table, key: recordKey })) as { suggestions: FieldSuggestion[] }).suggestions,\n enabled: decided,\n staleTime: 0,\n });\n const suggestions = asked.data;\n const landed = useRef(onLanded);\n landed.current = onLanded;\n const adorn = useMemo((): FieldAdornment | undefined => {\n if (!decided || !recordKey || !suggestions?.length) return undefined;\n const settled = () => {\n refreshDecisions(client, connection, table);\n landed.current();\n };\n return ({ column }) => {\n const suggestion = suggestions.find((each) => each.field === column);\n if (!suggestion) return null;\n return (\n <Suspense fallback={<span className=\"decision-chip-held\">{suggestion.label}</span>}>\n <DecisionChip suggestion={suggestion} table={table} recordKey={recordKey} onSettled={settled} />\n </Suspense>\n );\n };\n }, [decided, suggestions, client, connection, table, keyText]); // eslint-disable-line react-hooks/exhaustive-deps\n const held = decided && asked.isPending && asked.fetchStatus !== 'idle' ? Object.keys(answered!) : NOTHING;\n return adorn ? { adorn, held } : { held };\n}\n","/**\n * An App record's page, for a host that is not a route: the record dialog and\n * a split's detail pane. Reads go through the record surface, whose owner\n * fences every reply; writes and commands report to the host through\n * PageView's `host`, never the walk. The host remounts it per record (a\n * `key`), so one record's actions, drafts and delete state never reach the\n * next.\n */\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { rowLabel } from '@mistriwork/kit/client/core.js';\nimport { applyingStaged, subscribeStaged, stagedVersion } from '@mistriwork/kit/client/write.js';\nimport { updateAttempts } from '@mistriwork/kit/client/updateAttempts.js';\nimport { commandOperations } from '../commandState.js';\nimport { refreshRecordInPlace } from '@mistriwork/kit/client/recordWriteRefresh.js';\nimport { PageView } from '@mistriwork/kit/client/components/Page.js';\nimport type { DeleteState } from '@mistriwork/kit/client/components/DeleteButton.js';\nimport {\n RECORD_REFRESH_FAILED,\n useRecordSurface,\n type RecordSurfaceEntry,\n type RecordSurfaceOwner,\n} from '@mistriwork/kit/client/components/recordSurface.js';\nimport type { PageDef } from '@mistriwork/engine/shared/page.js';\nimport { say } from '../copy/record/components/RecordPageBody.js';\nimport { refreshDecisions } from './decisionAdornment.js';\n\nexport type PageSections = PageDef['sections'];\n\ninterface RecordPageBodyProps {\n owner: RecordSurfaceOwner;\n tableId: string;\n recordKey: Record<string, unknown>;\n label?: string;\n pageId: string;\n close: () => void;\n /** Install synchronously before controls can dispatch. */\n setPendingProbe: (probe: () => boolean) => void;\n onName: (name: string) => void;\n /** Called once the record's page has something to show — its fields, or why it has none. */\n onSettled: () => void;\n /** The host's sections in place of the page's own: a split's authored `detail.show`, as one fields section. */\n sections?: PageSections;\n /** Only the page's own sections of this kind, and no head: a free-form page's `<Timeline>` (sdk/blocks.tsx). */\n only?: string;\n}\n\nexport function RecordPageBody({\n owner,\n tableId,\n recordKey,\n label,\n pageId,\n close,\n setPendingProbe,\n onName,\n onSettled,\n sections,\n only,\n}: RecordPageBodyProps) {\n const [tab, setTab] = useState<string>();\n const [name, setName] = useState(label);\n const entry = useMemo<RecordSurfaceEntry>(\n () => ({ kind: 'page', pageId, table: tableId, key: recordKey, label: name, tab }),\n [pageId, tableId, recordKey, name, tab],\n );\n const { result, rootRow } = useRecordSurface({ owner, entry });\n const client = useQueryClient();\n useSyncExternalStore(subscribeStaged, stagedVersion, stagedVersion);\n useSyncExternalStore(updateAttempts.subscribe, updateAttempts.version, updateAttempts.version);\n useSyncExternalStore(commandOperations.subscribe, commandOperations.version, commandOperations.version);\n const deletion = useRef<DeleteState | undefined>(undefined);\n const [deleteStatus, setDeleteStatus] = useState<DeleteState>();\n const surfaced = result.status === 'ready' ? result.content : undefined;\n /* One page object per plan and per host sections: PageView keys its label\n ownership on the page it is given (recordSurface.ts), so a fresh spread\n every render would republish the label forever. With the host's sections\n the page's plans no longer line up by index; a fields section reads its\n own values. */\n /* `only` hides the rest rather than dropping them, so each plan still lines up with its section by index. */\n const page = useMemo(\n () =>\n surfaced && sections\n ? { ...surfaced.page, sections }\n : surfaced && only\n ? {\n ...surfaced.page,\n sections: surfaced.page.sections.map((section) => (section.kind === only ? section : { ...section, hidden: true })),\n }\n : surfaced?.page,\n [surfaced?.page, sections, only],\n );\n const content = surfaced && page ? { ...surfaced, page, plans: sections ? [] : surfaced.plans } : undefined;\n const settled = Boolean(content) || result.status === 'error' || result.status === 'missing';\n useEffect(() => {\n if (settled) onSettled();\n }, [settled]); // eslint-disable-line react-hooks/exhaustive-deps\n const actions = useRef(content?.actions);\n if (content) actions.current = content.actions;\n const pending = () =>\n owner.isCurrent() &&\n (applyingStaged() ||\n Boolean(updateAttempts.get({ connection: owner.connection, table: tableId, key: recordKey })) ||\n deletion.current === 'pending' ||\n deletion.current === 'uncertain' ||\n Boolean(\n actions.current?.list.some((action) => {\n if (!action.command) return false;\n const operation = commandOperations.get({\n connection: owner.connection,\n target: tableId,\n key: recordKey,\n command: action.command.id,\n commandVersion: action.command.version,\n });\n return operation?.phase === 'pending' || operation?.phase === 'unknown';\n }),\n ));\n useLayoutEffect(() => {\n setPendingProbe(pending);\n }, [owner, tableId, recordKey, setPendingProbe]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (!content || !rootRow || !owner.isCurrent()) return;\n const said = rowLabel(content.base, rootRow) as string | null;\n if (said) setName(said);\n }, [rootRow, content?.base, owner]); // eslint-disable-line react-hooks/exhaustive-deps\n const refresh = (fields: boolean) => {\n if (!owner.isCurrent()) return;\n // Keep the editor mounted. Save's confirmed overlay remains authoritative;\n // command completion/explicit refresh can request fresh field values.\n refreshRecordInPlace(client, { connection: owner.connection, table: tableId, key: recordKey, queryScope: owner.queryScope }, fields);\n // What a command wrote may have settled a suggestion, or filled its field.\n refreshDecisions(client, owner.connection, tableId);\n };\n if (result.status === 'retired') return null;\n if (result.status === 'error') return <p className=\"note\">{result.message}</p>;\n if (result.status === 'missing') return <p className=\"note\">{say('thisRecordIsNoLonger')}</p>;\n if (!content) return <p className=\"note\">{say('common.reading')}</p>;\n return (\n <>\n {result.status === 'ready' && result.refreshFailed && (\n <p role=\"alert\" className=\"note\">\n {RECORD_REFRESH_FAILED}\n </p>\n )}\n {deleteStatus === 'uncertain' && <p role=\"alert\">{say('theDeletionResultIsNotYet')}</p>}\n <PageView\n {...content}\n {...(only ? { bare: true } : {})}\n onLayout={() => {}}\n onLabel={(next) => {\n setName(next);\n onName(next);\n }}\n onTab={setTab}\n host={{\n owner,\n pendingBar: 'inline',\n onRecordChange: (opts) => {\n if (opts) refresh(opts.inPlace === false);\n },\n onActionDone: () => refresh(true),\n onDeleteStateChange: (status) => {\n deletion.current = status;\n setDeleteStatus(status);\n },\n onDeleted: () => {\n refresh(false);\n close();\n },\n }}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAaA,QAAM,eAAe;CAChC,eAAe;CACf,gBAAgB;AAClB,CAAC;;;;;;;;;;;ACSD,IAAa,kBAAkB,WAAmB;CAChD,MAAM,OAAO,OAAO,YAAY;CAChC,OAAOC,MAAI,kBAAkB,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,KAAK,MAAM,CAAC,EAAE,CAAC;AACvF;AAEA,SAAgB,WAAW,EAAE,MAAM,QAAQ,aAAsE;CAC/G,MAAM,OAAO,OAAO,YAAY;CAChC,OACE,oBAAC,OAAD;EACa;EACX,MAAMA,MAAI,yBAAyB,EAAE,QAAQ,KAAK,CAAC;EACnD,QACE,oBAAC,QAAD;GAAQ,QAAO;GAAY,eAAe,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AAW,CAAA;CAC7E,IAAI,OAAO,WAAW,WAAW,OAAO,oBAAC,KAAD;EAAG,WAAU;EAAQ,UAAA,IAAI,sBAAsB;CAAK,CAAA;CAC5F,IAAI,CAAC,SAAS,OAAO,oBAAC,KAAD;EAAG,WAAU;EAAQ,UAAA,IAAI,gBAAgB;CAAK,CAAA;CACnE,OACE,qBAAAC,YAAA,EAAA,UAAA;EACG,OAAO,WAAW,WAAW,OAAO,iBACnC,oBAAC,KAAD;GAAG,MAAK;GAAQ,WAAU;GACvB,UAAA;EACA,CAAA;EAEJ,iBAAiB,eAAe,oBAAC,KAAD;GAAG,MAAK;GAAS,UAAA,IAAI,2BAA2B;EAAK,CAAA;EACtF,oBAAC,UAAD;GACE,GAAI;GACJ,GAAK,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;GAC9B,gBAAgB,CAAC;GACjB,UAAU,SAAS;IACjB,QAAQ,IAAI;IACZ,OAAO,IAAI;GACb;GACA,OAAO;GACP,MAAM;IACJ;IACA,YAAY;IACZ,iBAAiB,SAAS;KACxB,IAAI,MAAM,QAAQ,KAAK,YAAY,KAAK;IAC1C;IACA,oBAAoB,QAAQ,IAAI;IAChC,sBAAsB,WAAW;KAC/B,SAAS,UAAU;KACnB,gBAAgB,MAAM;IACxB;IACA,iBAAiB;KACf,QAAQ,KAAK;KACb,MAAM;IACR;GACF;EACD,CAAA;CACD,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"shared-D66ju_Cb.js","names":["say","say","say","say","checkedRecordKey","recordKey","say","say","say","_Fragment","say","say","say","_Fragment"],"sources":["../../../kit/src/client/copy/record/components/RecordGone.ts","../../../kit/src/client/components/RecordGone.tsx","../../../kit/src/client/pagemarks.js","../../../kit/src/client/copy/record/components/DeleteButton.ts","../../../kit/src/client/components/DeleteButton.tsx","../../../kit/src/client/copy/record/components/RecordTags.ts","../../../kit/src/client/components/RecordTags.tsx","../../../kit/src/client/documents.ts","../../../kit/src/client/copy/record/components/PageHead.ts","../../../kit/src/client/components/PageHead.tsx","../../../kit/src/client/copy/record/components/PageLayout.ts","../../../kit/src/client/components/PageLayout.tsx","../../../kit/src/client/components/Page.tsx","../../src/client/copy/record/components/RecordPageBody.ts","../../src/client/components/decisionAdornment.tsx","../../src/client/components/RecordPageBody.tsx"],"sourcesContent":["/** What RecordGone says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n backToTheList: 'Back to the {spoken} list',\n recordNotFound: '{Spoken} not found',\n});\n","/**\n * A record that is gone — deleted under an open page, or a link to one that\n * never was — said once in plain words, with the way back to its list. The\n * sentence starts on the content's own edge (the empty block, Notes.tsx), and\n * names no key: \"1 names nothing\" read like a bug to the person who followed\n * the link. The caller says the table's name as its page does (`spoken` in\n * pageContext.ts): this module imports nothing of the page around it, so the\n * page may import it without a cycle.\n */\nimport { go, tableView } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { Button } from '@mistriwork/ui/Button.js';\nimport { Empty } from './Notes.js';\nimport { say } from '../copy/record/components/RecordGone.js';\n\nexport const recordNotFound = (spoken: string) => {\n const name = spoken.toLowerCase();\n return say('recordNotFound', { Spoken: name.charAt(0).toUpperCase() + name.slice(1) });\n};\n\nexport function RecordGone({ base, spoken, className }: { base: TableMeta; spoken: string; className?: string }) {\n const name = spoken.toLowerCase();\n return (\n <Empty\n className={className}\n text={say('common.thatIsNoLonger', { spoken: name })}\n action={\n <Button intent=\"secondary\" onClick={() => go(tableView(base.id), 'push')}>\n {say('backToTheList', { spoken: name })}\n </Button>\n }\n />\n );\n}\n","/**\n * Pages you pinned, and pages you were just on.\n *\n * A page is the most expensive thing anyone builds in tablewalk — sections\n * chosen, columns picked, an order decided — and until now the only way back\n * to one was to remember its name and type it into ⌘K. Everything else the\n * tool remembers for you (the trail, the last root of each page, saved\n * filters) it remembers because retyping it is the tax on coming back\n * tomorrow, and this is the same tax on the most expensive thing.\n *\n * Two lists, because they answer two different questions. Pinned is \"the\n * pages I work in\", stated once. Recent is \"where was I\", which nobody\n * states — and a recent entry carries the record as well as the page, since\n * being sent back to \"choose a customer\" is not being sent back to where you\n * were.\n *\n * Per connection, like every other memory here: the same page name means a\n * different thing on staging and on production, and the last customer you\n * looked at on one is not a record on the other.\n */\nimport { loadJson, saveJson, state } from './core.js';\n\nconst PINNED_KEY = 'mistri.pages.pinned.v1';\nconst VISITS_KEY = 'mistri.pages.visits.v1';\n\n/** How many positions are worth keeping. Enough for a day's work, not a log. */\nconst VISITS_MAX = 12;\n\nconst conn = () => state.activeConnection ?? 'default';\nconst read = (key) => loadJson(key, {})[conn()] ?? [];\n\nfunction write(key, value) {\n const all = loadJson(key, {});\n all[conn()] = value;\n saveJson(key, all);\n}\n\n/* ---------- pinned ---------- */\n\n/**\n * The pinned pages, each carrying its own name and base table.\n *\n * Stored rather than looked up, because the list of pages this connection\n * *has* does not include the suggested one — the page every table has and\n * nobody built — and pinning \"the customer page\" is exactly what someone\n * does before they have built anything. A pin that could only name pages\n * from a file would be a pin that silently dropped the commonest case.\n */\nexport function pinnedPages() {\n return read(PINNED_KEY).filter((p) => p && p.id);\n}\n\nexport function isPinned(pageId) {\n return pinnedPages().some((p) => p.id === pageId);\n}\n\n/** Pin or unpin, and answer what it is now. */\nexport function togglePinned(page) {\n const pinned = pinnedPages();\n const next = pinned.some((p) => p.id === page.id)\n ? pinned.filter((p) => p.id !== page.id)\n : [...pinned, { id: page.id, name: page.name, base: page.base }];\n write(PINNED_KEY, next);\n return next.some((p) => p.id === page.id);\n}\n\n/* ---------- where you were ---------- */\n\n/**\n * Record a position: this page, and the record it was about.\n *\n * Keyed by page *and* record, so opening three customers leaves three\n * entries rather than one that keeps changing — \"the last three customers I\n * looked at\" is the useful list, and a single slot per page throws away two\n * of them. A page with no root chosen still counts: getting back to the\n * chooser is worth one line.\n */\nexport function rememberVisit({ pageId, name, base, key, label }) {\n if (!pageId) return;\n /* The same record, however it was reached, is one visit. A row opened\n from a list carried a numeric key and one opened from a link a string\n one, so `{\"id\":5}` and `{\"id\":\"5\"}` sat side by side as two chips; the\n same record read through two pages over one table did the same. Keys\n compare as text, and a record is identified by its table when it has\n one, by its page only when it does not. */\n const stamp = JSON.stringify(normalKey(key));\n const same = (v) => JSON.stringify(normalKey(v.key)) === stamp && (base && v.base ? v.base === base : v.pageId === pageId);\n const visits = read(VISITS_KEY).filter((v) => !same(v));\n visits.unshift({ pageId, name, base, key, label });\n write(VISITS_KEY, visits.slice(0, VISITS_MAX));\n}\n\n/** A key with every value spelled as text, so 5 and \"5\" are one key. */\nfunction normalKey(key) {\n if (!key || typeof key !== 'object') return null;\n return Object.fromEntries(\n Object.keys(key)\n .sort()\n .map((k) => [k, key[k] == null ? null : String(key[k])]),\n );\n}\n\nexport function recentVisits() {\n return read(VISITS_KEY);\n}\n\n/** Forget a page entirely — it was deleted, or renamed out of existence. */\nexport function forgetPage(pageId) {\n write(\n PINNED_KEY,\n pinnedPages().filter((p) => p.id !== pageId),\n );\n write(\n VISITS_KEY,\n recentVisits().filter((v) => v.pageId !== pageId),\n );\n}\n","/** What DeleteButton says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n deletionWasNotConfirmed: 'Deletion was not confirmed. Refresh and reconcile this record before deleting again.',\n inWillBeDeleted: '{n} in {t} will be deleted too',\n inWillBeKept: '{n} in {t} will be kept, with the reference emptied',\n inWillBeKeptWithTheReference: '{n} in {t} will be kept, with the reference reset',\n inWillBlockThisTheDatabase: '{n} in {t} will block this — the database will refuse it',\n theDeletionPreviewIsUnavailable: 'The deletion preview is unavailable. Refresh the record.',\n deleteThisRow: 'Delete this {name} row',\n thisDeletionBelongsToAPrevious: 'This deletion belongs to a previous session or connection.',\n theRowWasNotDeleted: 'The row was not deleted.',\n deleted: 'Deleted {name} {label}.',\n deleteNameLabel: 'Delete {name} {label}?',\n thisRowIsReferenced: 'This row is referenced. Here is what the database will do:',\n couldNotBeCounted: '{table} could not be counted',\n inThisConstraintsRule: \"{rows} in {table} — this constraint's rule is unknown\",\n onDeleteRule: 'on delete {rule}',\n ruleUnknown: 'rule unknown',\n cascadesAreCountedOne: 'Cascades are counted one level deep. Rows deleted by a cascade may take their own children with them.',\n nothingPointsAtThis: 'Nothing points at this row, so nothing else is affected.',\n theDatabaseWillRefuse:\n 'The database will refuse this while those references exist. You can try anyway — its answer is the authority, not ours.',\n tryAnyway: 'Try anyway',\n});\n","/**\n * Deleting a row, having first said what that would do.\n *\n * The one destructive action here, and the one place the tool has a real\n * advantage: it already counts what points at a row, and the same counts\n * answer \"what breaks if this goes\" *before* the delete rather than as a\n * constraint violation afterwards. The count alone is not the answer —\n * three rows pointing here means three deleted under `cascade`, three left\n * holding a null under `set null`, a refusal under `restrict` — so the\n * dialog leads with the rule, and a rule the adapter could not determine\n * says so.\n */\nimport { useRef, useState } from 'react';\nimport { Modal, type ModalHandle } from '@mistriwork/ui/Modal.js';\nimport { Button } from '@mistriwork/ui/Button.js';\nimport { useMutation } from '@tanstack/react-query';\nimport { api, go, state, toast } from '../core.js';\nimport { recordKey as checkedRecordKey } from '../resourceRequests.js';\nimport { canDelete } from '../delete.js';\nimport { countsChanged } from './navCounts.js';\nimport { captureSessionIdentity, sessionIdentity } from '../sessionIdentity.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { HttpRecordKey } from '@mistriwork/engine/shared/resourceHttp.js';\nimport { shell } from '../shellMode.js';\nimport { say } from '../copy/record/components/DeleteButton.js';\n\ninterface Impact {\n table: string;\n count: number;\n onDelete?: string;\n}\ninterface Report {\n impact?: Impact[];\n deleted?: boolean | null;\n outcome?: string;\n errors?: Array<{ message: string }>;\n undoId?: unknown;\n}\nconst UNKNOWN = say('deletionWasNotConfirmed');\nconst refusedError = (err: { status?: number; outcome?: string }) =>\n err.outcome !== 'unknown' &&\n (err.outcome === 'rejected' ||\n err.outcome === 'not_applied' ||\n (err.outcome === undefined && [400, 401, 403, 404, 409, 422, 501].includes(err.status ?? 0)));\n\nconst CONSEQUENCE: Record<string, { tone: string; says: (n: string, t: string) => string }> = {\n cascade: { tone: 'bad', says: (n, t) => say('inWillBeDeleted', { n, t }) },\n 'set null': { tone: 'warn', says: (n, t) => say('inWillBeKept', { n, t }) },\n 'set default': { tone: 'warn', says: (n, t) => say('inWillBeKeptWithTheReference', { n, t }) },\n restrict: { tone: 'stop', says: (n, t) => say('inWillBlockThisTheDatabase', { n, t }) },\n 'no action': { tone: 'stop', says: (n, t) => say('inWillBlockThisTheDatabase', { n, t }) },\n};\n\nconst rows = (n: number) => say('common.rows2', { count: n });\n\nexport type DeleteState = 'pending' | 'uncertain' | 'applied' | 'rejected';\nexport interface DeleteButtonHost {\n /** Supplemental generation/authority predicate. Never replaces URL/session fences. */\n isCurrent: () => boolean;\n onDeleted: () => void;\n /** Store synchronously before confirmation closes. Pending/uncertain must\n * block voluntary host exit/replacement; unmount is NOT settlement. No idle\n * notification is emitted on cleanup. Retirement belongs to the host. */\n onStateChange: (state: DeleteState) => void;\n}\nconst hostCurrent = (host?: DeleteButtonHost) => {\n try {\n return host === undefined || host.isCurrent() === true;\n } catch {\n return false;\n }\n};\n\ninterface DeleteProps {\n table: TableMeta;\n recordKey: Record<string, unknown>;\n label: string;\n host?: DeleteButtonHost;\n}\n\n/**\n * Delete for one record, for a host that draws the trigger itself. A menu\n * item unmounts when its menu closes, so the confirmation lives with the\n * host (`dialog`), not with the item that opened it.\n */\nexport function useDelete({ table, recordKey, label, host }: DeleteProps) {\n const [report, setReport] = useState<{ data: Report; key: HttpRecordKey; host?: DeleteButtonHost } | null>(null);\n const [blocked, setBlocked] = useState(false);\n const available = canDelete(table);\n const ask = async () => {\n if (blocked || !hostCurrent(host)) return;\n const identity = captureSessionIdentity();\n const connection = state.activeConnection;\n const route = location.href;\n const current = () =>\n identity === sessionIdentity() && connection === state.activeConnection && route === location.href && hostCurrent(host);\n try {\n const key = checkedRecordKey(recordKey);\n const result: Report = await api('/api/delete', { table: table.id, key });\n if (!current()) return;\n if (result.deleted !== false || result.errors?.length || !Array.isArray(result.impact)) {\n toast(result.errors?.[0]?.message ?? say('theDeletionPreviewIsUnavailable'), 'error');\n return;\n }\n setReport({ data: result, key, host });\n } catch (err) {\n if (current()) toast((err as Error).message, 'error');\n }\n };\n const dialog = report ? (\n <DeleteConfirm\n table={table}\n recordKey={report.key}\n label={label}\n report={report.data}\n host={report.host}\n setBlocked={setBlocked}\n onClose={() => setReport(null)}\n />\n ) : null;\n return { available, blocked, ask: () => void ask(), dialog };\n}\n\nexport function DeleteButton(props: DeleteProps) {\n const { available, blocked, ask, dialog } = useDelete(props);\n if (!available) return null;\n return (\n <>\n <button\n type=\"button\"\n className=\"ghost record-delete\"\n disabled={blocked}\n title={say('deleteThisRow', { name: props.table.name })}\n onClick={ask}\n >\n {say('common.delete')}\n </button>\n {dialog}\n </>\n );\n}\n\nfunction DeleteConfirm({\n table,\n recordKey,\n label,\n report,\n onClose,\n setBlocked,\n host,\n}: {\n table: TableMeta;\n recordKey: HttpRecordKey;\n label: string;\n report: Report;\n onClose: () => void;\n setBlocked: (blocked: boolean) => void;\n host?: DeleteButtonHost;\n}) {\n const dialog = useRef<ModalHandle>(null);\n const owner = useRef({ identity: captureSessionIdentity(), connection: state.activeConnection, route: location.href }).current;\n const current = () =>\n owner.identity === sessionIdentity() &&\n owner.connection === state.activeConnection &&\n owner.route === location.href &&\n hostCurrent(host);\n const submitted = useRef(false);\n // A presentation failure after dispatch must never reclassify a known result\n // or release a pending/unknown close guard. The host retains its last status.\n const notify = (status: DeleteState) => {\n try {\n host?.onStateChange(status);\n } catch {\n /* presentation only */\n }\n };\n const remove = useMutation({\n mutationFn: async () => {\n if (!current()) throw new Error(say('thisDeletionBelongsToAPrevious'));\n const tracked = shell().mutations.start('delete', owner.identity);\n try {\n const result: Report = await api('/api/delete', { table: table.id, key: recordKey, confirm: true });\n const definite =\n (result.deleted === true && !result.errors?.length && (result.outcome === undefined || result.outcome === 'applied')) ||\n (result.deleted === false && result.outcome === 'rejected');\n if (definite) shell().mutations.settle(tracked);\n else shell().mutations.unknown(tracked);\n return result;\n } catch (error) {\n if (error && typeof error === 'object' && refusedError(error)) shell().mutations.settle(tracked);\n else shell().mutations.unknown(tracked);\n throw error;\n }\n },\n onSuccess: (result: Report) => {\n if (!current()) return;\n if (result.deleted !== true || result.errors?.length || (result.outcome !== undefined && result.outcome !== 'applied')) {\n const rejected = result.deleted === false && result.outcome === 'rejected';\n setBlocked(!rejected);\n notify(rejected ? 'rejected' : 'uncertain');\n if (!rejected) void shell().undo.refresh();\n toast(rejected ? (result.errors?.[0]?.message ?? say('theRowWasNotDeleted')) : UNKNOWN, 'error');\n return;\n }\n void shell().undo.refresh();\n /* The reader is on the list by the time they read this; Undo puts the\n record back into it (the list and its counts refresh, the reader stays). */\n toast(\n say('deleted', { name: table.name, label }),\n 'ok',\n shell().undo.toast(result.undoId, () => countsChanged()),\n );\n notify('applied');\n /* Back to the table, not to the record that no longer exists. */\n if (host) {\n if (current())\n try {\n host.onDeleted();\n } catch {\n /* a confirmed deletion is never retried */\n }\n } else go({ kind: 'table', table: table.id, query: table.id, tab: 'rows' }, 'reset');\n // One row fewer on every count of the connection, the menu's included.\n countsChanged();\n },\n onError: (err: Error & { status?: number; outcome?: string }) => {\n if (!current()) return;\n const rejected = refusedError(err);\n setBlocked(!rejected);\n notify(rejected ? 'rejected' : 'uncertain');\n if (!rejected) void shell().undo.refresh();\n toast(rejected ? err.message : UNKNOWN, 'error');\n },\n });\n const impact = report.impact ?? [];\n const blocked = impact.some((i) => i.onDelete === 'restrict' || i.onDelete === 'no action');\n return (\n <Modal className=\"confirm delete-confirm\" ref={dialog} onClose={onClose}>\n <h2>{say('deleteNameLabel', { name: table.name, label })}</h2>\n {impact.length ? (\n <div>\n <p>{say('thisRowIsReferenced')}</p>\n <ul className=\"delete-impact\">\n {impact.map((i, k) => {\n const rule = i.onDelete ? CONSEQUENCE[i.onDelete] : undefined;\n return (\n <li key={k} className={`impact-${rule?.tone ?? 'unknown'}`}>\n <span className=\"impact-what\">\n {i.count < 0\n ? say('couldNotBeCounted', { table: i.table })\n : rule\n ? rule.says(rows(i.count), i.table)\n : say('inThisConstraintsRule', { rows: rows(i.count), table: i.table })}\n </span>\n <span className=\"impact-rule\">{i.onDelete ? say('onDeleteRule', { rule: i.onDelete }) : say('ruleUnknown')}</span>\n </li>\n );\n })}\n </ul>\n {impact.some((i) => i.onDelete === 'cascade') && <p className=\"delete-note\">{say('cascadesAreCountedOne')}</p>}\n </div>\n ) : (\n <p>{say('nothingPointsAtThis')}</p>\n )}\n {blocked && <p className=\"delete-blocked\">{say('theDatabaseWillRefuse')}</p>}\n <div className=\"confirm-actions\">\n <Button intent=\"secondary\" onClick={onClose}>\n {say('common.cancel')}\n </Button>\n <Button\n intent=\"danger\"\n onClick={() => {\n if (submitted.current || !current()) return;\n // Fail closed if the host cannot retain the pending operation. This\n // runs before closing the nested confirmation or dispatching a write.\n try {\n host?.onStateChange('pending');\n } catch {\n return;\n }\n if (!current()) return;\n submitted.current = true;\n setBlocked(true);\n onClose();\n remove.mutate();\n }}\n >\n {blocked ? say('tryAnyway') : 'Delete'}\n </Button>\n </div>\n </Modal>\n );\n}\n","/** What RecordTags says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n tagAdded: 'Tag added',\n removed: 'Removed “{label}”',\n removeLabel: 'Remove {label}',\n addNoun: 'Add {noun}',\n plusAddNoun: '+ Add {noun}',\n addTag: 'Add tag',\n removeTag: 'Remove tag',\n});\n","/**\n * A record's tags, as chips under its title: rows of another table linked\n * through a link table (`tags` on the resource). Where the link table may be\n * written and deleted from, a picker adds a tag (a link row inserted) and a\n * chip's × removes one (its link row deleted): ordinary writes, each checked\n * like any insert or delete, recorded, and undoable. Where the resource names\n * its own commands (`tags: { add, remove }`), the picker runs those instead,\n * told the tag's key, and needs no write on the link table.\n */\nimport { useEffect, useRef, useState } from 'react';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { api, findTable, quote, state, toast } from '../core.js';\nimport { ownedBy } from '../requestIdentity.js';\nimport { canInsert } from '../insert.js';\nimport { canDelete } from '../delete.js';\nimport { primaryKey, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { DISPLAY_TONES, humanName } from '@mistriwork/engine/shared/model.js';\nimport type { AppTagRule } from '@mistriwork/engine/shared/servedApp.js';\nimport { RecordPicker } from './RecordPicker.js';\nimport { shell } from '../shellMode.js';\nimport { say } from '../copy/record/components/RecordTags.js';\n\ninterface Tag {\n link: Record<string, string | number>;\n value: string;\n label: string;\n tone: string;\n}\ntype Reply = { rows?: Array<Record<string, unknown>>; errors?: Array<{ message: string }> };\n\nexport function RecordTags({\n rule,\n recordKey,\n isCurrent,\n}: {\n rule: AppTagRule;\n recordKey: Record<string, unknown>;\n isCurrent?: () => boolean;\n}) {\n const connection = state.activeConnection ?? null;\n const client = useQueryClient();\n const [adding, setAdding] = useState(false);\n const [busy, setBusy] = useState(false);\n const picker = useRef<HTMLInputElement>(null);\n useEffect(() => {\n if (adding) picker.current?.focus();\n }, [adding]);\n const through = findTable(rule.through) as TableMeta | undefined;\n const to = findTable(rule.to) as TableMeta | undefined;\n const parent = recordKey[rule.key];\n const linkKey = through ? (primaryKey(through) as string[]) : [];\n const literal = typeof parent === 'number' ? String(parent) : quote(String(parent ?? ''));\n const columns = [...new Set([...linkKey, rule.via, `${rule.via}.${rule.label}`, ...(rule.tone ? [`${rule.via}.${rule.tone}`] : [])])];\n const q = through && parent != null ? `${rule.through} ${rule.from} = ${literal} show ${columns.join(', ')}` : '';\n const answer = useQuery({\n queryKey: ['run', connection ?? '', 'tags', q],\n enabled: Boolean(q),\n queryFn: async () => {\n const data = (await api('/api/run', { q, limit: 200, offset: 0, count: 'none', ...ownedBy(connection) })) as Reply;\n if (data.errors?.length) throw new Error(data.errors[0].message);\n return data.rows ?? [];\n },\n });\n const tags: Tag[] = (answer.data ?? [])\n .flatMap((row) => {\n const value = row[rule.via];\n if (value == null || linkKey.some((column) => row[column] == null)) return [];\n const tone = rule.tone ? String(row[`${rule.via}.${rule.tone}`] ?? '') : '';\n return [\n {\n link: Object.fromEntries(linkKey.map((column) => [column, row[column] as string | number])),\n value: String(value),\n label: String(row[`${rule.via}.${rule.label}`] ?? value),\n tone: (DISPLAY_TONES as readonly string[]).includes(tone) ? tone : 'neutral',\n },\n ];\n })\n .sort((a, b) => a.label.localeCompare(b.label));\n /* The App's own commands when it names them (each run only for a reader granted it, and only in a shell that runs\n them: shellMode.ts `recordCommand`), else the link table's writes. */\n const recordCommand = shell().slots.recordCommand;\n const tagged = rule.add && rule.remove ? recordCommand?.(rule.add, say('addTag')) : undefined;\n const untagged = rule.add && rule.remove ? recordCommand?.(rule.remove, say('removeTag')) : undefined;\n const byCommand = Boolean(rule.add && rule.remove);\n const editable = byCommand ? Boolean(tagged && untagged) : Boolean(through && to && canInsert(through, true) && canDelete(through));\n const commandKey = () =>\n Object.fromEntries(\n Object.entries(recordKey).filter(\n (entry): entry is [string, string | number] => typeof entry[1] === 'string' || typeof entry[1] === 'number',\n ),\n );\n /* A command's outcome as the settle step reads a write's answer: a refusal is already said, so it is only kept from the toast. */\n const ran = async (run: () => Promise<{ status: string; message?: string }>) => {\n const outcome = await run();\n return outcome.status === 'refused' ? { errors: [{ message: outcome.message ?? '' }], said: true } : undefined;\n };\n if (!through || !to || parent == null || (!tags.length && !editable)) return null;\n\n const settle = async (work: () => Promise<unknown>, done: string) => {\n if (busy || (isCurrent && !isCurrent())) return;\n setBusy(true);\n try {\n const data = (await work()) as { errors?: Array<{ message: string }>; said?: boolean } | undefined;\n if (data?.errors?.length) {\n if (!data.said) toast(data.errors[0].message, 'error');\n return;\n }\n toast(done, 'ok');\n await client.invalidateQueries({ queryKey: ['run', connection ?? ''] });\n } catch (error) {\n toast((error as Error).message, 'error');\n } finally {\n setBusy(false);\n }\n };\n const add = (value: string) => {\n setAdding(false);\n if (!value || tags.some((tag) => tag.value === value)) return;\n void settle(\n () =>\n tagged\n ? ran(() => tagged(commandKey(), { tag: value }))\n : api('/api/insert', {\n table: rule.through,\n values: { [rule.from]: parent as string | number, [rule.via]: value },\n ...ownedBy(connection),\n }),\n say('tagAdded'),\n );\n };\n const remove = (tag: Tag) =>\n void settle(\n () =>\n untagged\n ? ran(() => untagged(commandKey(), { tag: tag.value }))\n : api('/api/delete', { table: rule.through, key: tag.link, confirm: true, ...ownedBy(connection) }),\n say('removed', { label: tag.label }),\n );\n const noun = humanName(to.name).toLowerCase();\n\n return (\n <div className=\"record-tags\" role=\"group\" aria-label={humanName(to.name)}>\n {tags.length > 0 && (\n <ul className=\"record-tags-list\">\n {tags.map((tag) => (\n <li key={tag.value} className={`record-tag tone tone-${tag.tone}`}>\n <span>{tag.label}</span>\n {editable && (\n <button\n type=\"button\"\n className=\"record-tag-remove\"\n aria-label={say('removeLabel', { label: tag.label })}\n disabled={busy}\n onClick={() => remove(tag)}\n >\n ×\n </button>\n )}\n </li>\n ))}\n </ul>\n )}\n {editable &&\n (adding ? (\n <span className=\"record-tags-pick\">\n <RecordPicker\n table={to}\n value=\"\"\n onChange={add}\n app\n hideKey\n ariaLabel={say('addNoun', { noun })}\n inputRef={picker}\n editing={{ onStateChange: () => {}, onCancel: () => setAdding(false) }}\n />\n </span>\n ) : (\n <button type=\"button\" className=\"ghost record-tags-add\" disabled={busy} onClick={() => setAdding(true)}>\n {say('plusAddNoun', { noun })}\n </button>\n ))}\n </div>\n );\n}\n","/**\n * Which documents a record has, and which one an address asks for\n * (shared/appDocuments.ts). A document is the last segment of its record's\n * address, where a record page's tab is said, so the walk carries it as the\n * entry's `tab`: the room that draws the record yields to the sheet when the\n * word names one of its table's documents. Small, and on every App page: the\n * sheet itself is a part loaded on demand.\n */\nimport { shell } from './shellMode.js';\nimport { tabWord } from '@mistriwork/engine/shared/addressParams.js';\nimport type { AppPayloadDocument } from '@mistriwork/engine/shared/servedApp.js';\n\n/** The documents of a table this reader is served, in the App's order. */\nexport function documentsOf(tableId: string | undefined): AppPayloadDocument[] {\n if (!tableId || !shell().inApp()) return [];\n return (shell().app()?.documents ?? []).filter((document) => document.base === tableId);\n}\n\n/** The document a record entry is on: its tab names one of its table's documents, by key or as an address says it. */\nexport function documentAt(entry: { table?: string; key?: unknown; tab?: string }): AppPayloadDocument | undefined {\n if (!entry.key || !entry.tab) return undefined;\n const asked = entry.tab;\n return documentsOf(entry.table).find((document) => document.id === asked || tabWord(document.id) === asked);\n}\n","/** What PageHead says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n isPinnedToTheHome: '\"{name}\" is pinned to the home screen',\n pinToTheHome: 'Pin \"{name}\" to the home screen',\n addRemoveAndReorder: 'Add, remove and reorder the sections of this page',\n thisPageBelongsToTheFile: 'This page belongs to the file it came from — editing it starts your own copy',\n layout: 'Layout',\n copyLayout: 'Copy layout',\n});\n","/**\n * A page's head: the page's name (a picker among the table's other pages\n * while authoring), pin and layout, and, once a record is chosen, the\n * record's name as the room's heading with its star, trail, actions,\n * Delete, tags and pending bar. Everything that acts on the whole record\n * sits here, above the sections.\n */\nimport { PHONE_QUERY, useMediaQuery } from './useMediaQuery.js';\nimport { useContext, useEffect, useState, useSyncExternalStore, type ReactNode } from 'react';\nimport { createPortal } from 'react-dom';\nimport { useQuery } from '@tanstack/react-query';\nimport { Button } from '@mistriwork/ui/Button.js';\nimport { columnDisplay, columnLabel, go, labelPath, rowLabel, state } from '../core.js';\nimport { readRecordSource, shareRecordSource } from '../recordSource.js';\nimport { pathEqualityFilter } from '../resourceRequests.js';\nimport { canEditRow, pendingCount, sameRow, stagedVersion, subscribeStaged } from '../write.js';\nimport type { AppAction } from '@mistriwork/engine/schema/model.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { factWord } from '@mistriwork/engine/shared/appCards.js';\nimport type { ColumnMeta, TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { shell } from '../shellMode.js';\nimport { isPinned, togglePinned } from '../pagemarks.js';\nimport { Editable, PendingBar } from './Editable.js';\nimport { RefJump, Value } from './Value.js';\nimport { headerColumns } from '@mistriwork/engine/shared/recordReads.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { useDelete } from './DeleteButton.js';\nimport { DropItem } from '@mistriwork/ui/DropMenu.js';\nimport { FavoriteStar } from './FavoriteStar.js';\nimport { relabelFavorite, type Favorite } from './favorites.js';\nimport { Dropdown } from './Dropdown.js';\nimport { RecordTags } from './RecordTags.js';\nimport { RecordTrailNav } from './RecordTrailNav.js';\nimport { useWalk } from './walk.js';\nimport { rootLabel, sourceOf, type PageDef, type PageSection } from './pageModel.js';\nimport { PageRenderContext, recordReadNames, spoken, usePageApi } from './pageContext.js';\nimport { hueOf, initialsOf } from './valueModel.js';\nimport { useAvatarPhotos } from './avatarPhotos.js';\nimport { primaryKey } from '@mistriwork/engine/shared/schema.js';\nimport { documentsOf } from '../documents.js';\nimport type { PageProps } from './Page.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { say } from '../copy/record/components/PageHead.js';\nimport { recordNotFound } from './RecordGone.js';\nimport { drawnLayout } from '@mistriwork/engine/shared/pageLayouts.js';\nimport { useCrumbSlots } from './crumbSlot.js';\nimport { onDemand } from './onDemand.js';\nimport { liveKeyText, useLiveActive, useRecentChange } from '../liveState.js';\n\n/* \"Updated by Ana just now\", once another person's change to this record has been told (liveState.ts). */\nconst LiveUpdatedLine = onDemand(() => import('./LiveNotices.js'), 'LiveUpdatedLine', { quiet: true });\n\nexport function PageHead({\n entry,\n page,\n base,\n others,\n onLayout,\n actions,\n host,\n onPending,\n title,\n gone = false,\n header,\n onSectionLabel,\n onTitleEditor,\n titleOwner,\n}: PageProps & {\n onPending: (opts?: { inPlace?: boolean }) => void;\n title?: () => ReactNode;\n gone?: boolean;\n /** The page's record header (useRecordHeader, below), drawn here wherever it is written. */\n header?: { section: PageSection; index: number };\n onSectionLabel?: (index: number, label: string | undefined) => void;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n titleOwner?: number;\n}) {\n useMessageLanguage();\n useWalk();\n const { isCurrent } = useContext(PageRenderContext);\n const authoring = !shell().inApp() && !host;\n const key = entry.key;\n const changedElsewhere = useRecentChange(base.id, key ? liveKeyText(key) : '');\n /* A draft of this record under live sync: the notice that may come over it has its row reserved from the first\n edit, so its arrival moves nothing (LiveNotices.css). */\n useSyncExternalStore(subscribeStaged, stagedVersion, stagedVersion);\n const liveDraft = useLiveActive(base.id) && Boolean(key) && sameRow(base.id, key) && pendingCount() > 0;\n const [pinned, setPinned] = useState(() => isPinned(page.id) as boolean);\n const suggested = { id: `suggested:${page.base}`, name: `${page.base} (default)`, source: 'suggested' };\n const items = [...others, ...(others.some((p) => p.id === suggested.id) ? [] : [suggested])].filter((p) => p.id !== page.id);\n const sayPage = (p: { name: string; source: string }) => (p.source === 'suggested' ? spoken(p.name) : p.name);\n /* A record that is gone has no name any more: the one the link carried is the last it was known by, and\n as the page's heading it says the record exists. The crumb trail keeps it, as where the reader came from. */\n const label = gone ? recordNotFound(spoken(base.name)) : (entry.label ?? (key ? rootLabel(key) : ''));\n const phone = useMediaQuery(PHONE_QUERY);\n /* A record page's verbs stand at the end of the crumb bar, as a list's New\n does: the bar stays at the top of the pane however long the page, so the\n record's next step is always in reach, and the name beneath it is free to\n take its line. A room drawn inside another (a split's detail, a dialog)\n and a phone keep them in the head; a phone holds them at the foot of the\n screen (page.css). */\n const { tools: crumbTools } = useCrumbSlots();\n const actionsInBar = Boolean(crumbTools && !host && !phone && shell().inApp());\n const said = useRecordHeader({\n page,\n base,\n recordKey: key,\n header: gone ? undefined : header,\n onSectionLabel,\n onTitleEditor,\n titleOwner,\n onEdit: onPending,\n });\n /* Which verbs take something away is read on every App record page, with\n or without a header: its first verb is the filled one, and a confirmed\n or bad-toned one first would fill the button that ends the record. */\n const named = header?.section.destructive;\n const destructive =\n header || shell().inApp()\n ? (() => {\n const tones = tonesOf(base.id);\n return (action: Parameters<typeof isDestructive>[0]) => isDestructive(action, named, tones);\n })()\n : undefined;\n const deleting = useDelete({\n table: base,\n recordKey: key ?? {},\n label,\n host: host\n ? {\n isCurrent: isCurrent!,\n onDeleted: host.onDeleted,\n onStateChange: host.onDeleteStateChange,\n }\n : undefined,\n });\n /* A star only where the App offers one (`favorite: true` on the resource). */\n const starred: Favorite | undefined =\n key && shell().inApp() && shell().app()?.resources[base.id]?.favorite\n ? { kind: 'record', table: base.id, key, label, pageId: page.id }\n : undefined;\n const starredId = starred ? JSON.stringify([starred.table, starred.key]) : '';\n /* Tags where the App gives the resource some (`tags`): chips under the title. */\n const tagRule = key && shell().inApp() ? shell().app()?.resources[base.id]?.tags : undefined;\n /* A record avatar is presentation of the label already loaded for this\n heading. It is deliberately limited to an explicit local display rule:\n composite labels and key fallbacks must not invent an identity mark or\n trigger another read. */\n const recordLabelPath = key && shell().inApp() ? labelPath(base) : undefined;\n /* Whether the resource gives its records an avatar is the App's to say, known before the name arrives: a head\n that stands it large beside the name (recipes.header 'hero', themeFamilies.css) keeps its room from the first paint. */\n const avatarDeclared = Boolean(\n !gone && recordLabelPath && !recordLabelPath.includes('.') && shell().app()?.resources[base.id]?.display?.[recordLabelPath]?.avatar,\n );\n const recordAvatar = avatarDeclared && Boolean(entry.label);\n /* A person whose avatar is their photo (`avatar: { from, whose }`) wears it\n here too, as in every list that names them; the initials stand in where\n there is none, or the reader may not read it. */\n const avatarRule = recordAvatar ? shell().app()?.resources[base.id]?.display?.[recordLabelPath!] : undefined;\n const ownKey = primaryKey(base);\n const photos = useAvatarPhotos(\n recordAvatar && ownKey.length === 1 ? [{ name: recordLabelPath!, display: avatarRule as never, photoOwner: ownKey[0] }] : [],\n recordAvatar && key ? [key] : [],\n );\n const photo = recordAvatar && key && ownKey.length === 1 ? photos(recordLabelPath!, key[ownKey[0]]) : undefined;\n const [brokenPhoto, setBrokenPhoto] = useState<string | undefined>(undefined);\n useEffect(() => {\n if (starred) relabelFavorite(starred);\n }, [starredId, label]);\n /* The record put on paper — its invoice, its packing slip — is a verb on it, in More, before Delete: reading, not changing. */\n const documents = key && !gone ? documentsOf(base.id) : [];\n /* A record that is gone has nothing to be done to it: no verbs, no Delete. */\n /* The verbs, the documents and Delete stand in the App's bar (Actions.tsx), drawn through the shell's slot. */\n const { ActionBar } = shell().slots;\n const toolbar =\n ActionBar && key && !gone && (actions || deleting.available || documents.length) ? (\n <div className=\"page-head-actions\">\n <ActionBar\n tableId={base.id}\n actions={actions?.list ?? []}\n recordKey={key}\n label={label}\n matches={actions?.matches ?? (async () => false)}\n queryScope={actions?.queryScope}\n isCurrent={isCurrent}\n compact={phone}\n destructive={destructive}\n primary={header?.section.primary}\n only={header?.section.headerActions}\n canUpdate={actions?.canUpdate}\n grantedCommands={actions?.grantedCommands}\n grantedActions={actions?.grantedActions}\n menuTail={\n documents.length || deleting.available ? (\n <>\n {documents.map((document) => (\n <DropItem\n key={document.id}\n className=\"page-actions-item\"\n onClick={() => go({ kind: 'page', pageId: page.id, table: base.id, key, label, tab: document.id })}\n >\n {document.label}\n </DropItem>\n ))}\n {deleting.available && (\n <DropItem className=\"page-actions-item is-danger\" disabled={deleting.blocked} onClick={deleting.ask}>\n {say('common.delete')}\n </DropItem>\n )}\n </>\n ) : undefined\n }\n onDone={() => {\n if (host) {\n if (isCurrent?.()) host.onActionDone();\n } else onPending({ inPlace: false });\n }}\n />\n </div>\n ) : null;\n return (\n <div\n className={`page-head${key ? ' has-record' : ''}${!host && shell().inApp() ? ' is-room' : ''}${avatarDeclared ? ' has-avatar' : ''}`}\n data-layout={drawnLayout(page)}\n >\n <div className=\"page-head-top\">\n {authoring && items.length ? (\n <div className=\"page-title-pick\">\n <Dropdown\n ariaLabel={say('common.page')}\n value={page.id}\n items={[\n { value: page.id, label: sayPage(page), detail: sourceOf(page) },\n ...items.map((p) => ({ value: p.id, label: sayPage(p), detail: sourceOf(p) })),\n ]}\n onChange={(id) => {\n if (id !== page.id) go({ ...entry, pageId: id }, 'replace');\n }}\n valueClassName=\"page-title\"\n />\n </div>\n ) : key ? (\n /* Over a record's name its kind is a label for someone who works\n across tables; a public reader came for the car, not \"VEHICLE\". */\n shell().publicVisitor() ? null : (\n <span className=\"page-title\">{sayPage(page)}</span>\n )\n ) : (\n <h1 className=\"page-title\">{sayPage(page)}</h1>\n )}\n {!shell().inApp() && (\n <button\n type=\"button\"\n className={`ghost page-pin${pinned ? ' is-pinned' : ''}`}\n aria-pressed={pinned}\n title={pinned ? say('isPinnedToTheHome', { name: page.name }) : say('pinToTheHome', { name: page.name })}\n aria-label={pinned ? say('isPinnedToTheHome', { name: page.name }) : say('pinToTheHome', { name: page.name })}\n onClick={() => setPinned(togglePinned(page) as boolean)}\n >\n {pinned ? '★' : '☆'}\n </button>\n )}\n {key && changedElsewhere && !gone && <LiveUpdatedLine table={base} recordKey={key} />}\n {authoring && (\n <Button\n size=\"compact\"\n className=\"page-edit\"\n title={page.source === 'saved' ? say('addRemoveAndReorder') : say('thisPageBelongsToTheFile')}\n onClick={onLayout}\n >\n {page.source === 'saved' ? say('layout') : say('copyLayout')}\n </Button>\n )}\n </div>\n {key && (\n <div className=\"root-bar\">\n {recordAvatar &&\n (photo && photo !== brokenPhoto ? (\n <img\n className={`page-record-avatar avatar avatar-photo avatar-c${hueOf(label)}`}\n src={photo}\n alt=\"\"\n decoding=\"async\"\n onError={() => setBrokenPhoto(photo)}\n />\n ) : (\n <span className={`page-record-avatar avatar avatar-c${hueOf(label)}`} aria-hidden=\"true\">\n {initialsOf(label)}\n </span>\n ))}\n {title ? (\n // Named by the record, not by the Edit button inside it.\n <div className=\"root-current\" role=\"heading\" aria-level={1} aria-label={label}>\n {title()}\n </div>\n ) : (\n <h1 className=\"root-current\">\n {/* One line, cut short where it must: the whole name is the crumb's and this one's title. */}\n <span title={label}>{label}</span>\n </h1>\n )}\n {starred && <FavoriteStar favorite={starred} name={label} />}\n {said.status}\n {/* \"3 of 20\" and the arrows, where the record was opened from a list. */}\n <RecordTrailNav entry={entry} />\n </div>\n )}\n {/* The head's second column (page.css), unless the crumb bar holds the verbs. */}\n {toolbar && actionsInBar ? createPortal(toolbar, crumbTools!, 'record-actions') : toolbar}\n {/* A header's facts: under the name, in its column (page.css). */}\n {key && said.facts}\n {key && tagRule && <RecordTags rule={tagRule} recordKey={key} isCurrent={isCurrent} />}\n {deleting.dialog}\n {key && (\n <div className={`page-pending${liveDraft ? ' has-live-draft' : ''}`}>\n <PendingBar\n table={base}\n recordKey={key}\n placement={host?.pendingBar}\n isCurrent={isCurrent}\n onDone={(done) => onPending(host ? done : (done ?? { inPlace: true }))}\n />\n </div>\n )}\n </div>\n );\n}\n\n/* A record header (`header({ status, facts })`, presentation 'header'): the\n * head told what else to say. The status column's tone is a chip beside the\n * name; the facts are one line under it, each a value under its caption, or\n * dressed by a fact's word after or before it (\"3 beds\", \"Born Apr 24, 2017\")\n * where the author wrote one. It reads the record's row once,\n * names the record for the head as a fields section would, and hands the head\n * the editor for the name where the name may change. It lives in this module\n * rather than one of its own because it reads the page context, the editor\n * and the App, which already import the page: a module of its own joined that\n * cycle (test/repo/runtime-cycles.test.ts). Which verbs are destructive is said\n * here too: the head draws them last and quiet, never as the filled first\n * button (docs/design.md, the record head). */\ntype Tones = Record<string, Record<string, string> | undefined>;\n\n/**\n * Whether a verb takes something away: named (by id) in the header's `destructive`,\n * or an update that asks to be confirmed, or one that sets a value its\n * column's display tones call bad (\"Mark lost\" → `lost: 'bad'`). A command\n * says nothing of what it writes, so only its name makes it one.\n */\nexport function isDestructive(action: AppAction, named: readonly string[] | undefined, tones: Tones): boolean {\n if (named?.includes(action.id)) return true;\n if (action.command) return false;\n if (action.confirm) return true;\n return Object.entries(action.set ?? {}).some(([column, value]) => typeof value === 'string' && tones[column]?.[value] === 'bad');\n}\n\n/** The display tones of a table's columns in the App, by column. */\nfunction tonesOf(tableId: string): Tones {\n const display =\n (shell().app() as { resources?: Record<string, { display?: Record<string, { tone?: Record<string, string> }> }> } | null)?.resources?.[\n tableId\n ]?.display ?? {};\n return Object.fromEntries(Object.entries(display).map(([column, rule]) => [column, rule?.tone]));\n}\n\ninterface HeaderParts {\n status: ReactNode;\n facts: ReactNode;\n}\n\n/**\n * The header's row and what the head draws from it. Called by the head on\n * every render; with no header it reads nothing and draws nothing.\n */\nfunction useRecordHeader({\n page,\n base,\n recordKey: key,\n header,\n onSectionLabel,\n onTitleEditor,\n titleOwner,\n onEdit,\n}: {\n page: PageDef;\n base: TableMeta;\n recordKey: Record<string, unknown> | undefined;\n header: { section: PageSection; index: number } | undefined;\n onSectionLabel?: (index: number, label: string | undefined) => void;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n titleOwner?: number;\n onEdit?: (opts?: { inPlace?: boolean }) => void;\n}): HeaderParts {\n const api = usePageApi();\n const { preview, isCurrent, adorn, adornHeld } = useContext(PageRenderContext);\n const section = header?.section;\n const index = header?.index ?? -1;\n const facts = section?.paths ?? [];\n const status = section?.status;\n const namePath = labelPath(base) as string | undefined;\n /* Built as the server builds it for the page's compose (shared/recordReads.ts). */\n const { fetched, labels: refLabels } = headerColumns(recordReadNames(), base, section ?? { kind: 'fields' });\n const data = useQuery({\n queryKey: ['page-fields', page.id, base.id, key, fetched],\n structuralSharing: shareRecordSource,\n queryFn: () =>\n readRecordSource(() =>\n api('/api/view/run', {\n count: 'none',\n view: {\n id: `page:${page.id}:header`,\n name: base.name,\n base: base.id,\n columns: fetched.map((path) => ({ path })),\n filter: pathEqualityFilter(Object.fromEntries((primaryKey(base) as string[]).map((column) => [column, key![column]]))),\n limit: 1,\n },\n }),\n ),\n enabled: Boolean(section && key),\n staleTime: 0,\n });\n const got = data.data && 'view' in data.data ? data.data : undefined;\n const row = got?.rows[0];\n /* The header names the record for the head, first of every section. */\n useEffect(() => {\n if (row && header) onSectionLabel?.(index, rowLabel(base, row));\n }, [row, index]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(\n () => () => {\n if (header) onSectionLabel?.(index, undefined);\n },\n [index],\n ); // eslint-disable-line react-hooks/exhaustive-deps\n const titleColumn =\n header && titleOwner === index && shell().inApp() && !preview && namePath && !namePath.includes('.')\n ? base.columns.find((c) => c.name === namePath)\n : undefined;\n const titleEditable = Boolean(\n key && titleColumn && !titleColumn.primaryKey && titleColumn.writable !== false && (canEditRow(base, key) as boolean),\n );\n useEffect(() => {\n if (!onTitleEditor || !header) return;\n if (!row || !titleEditable || !titleColumn) {\n onTitleEditor(index, undefined);\n return;\n }\n onTitleEditor(index, () => (\n <Editable\n table={base}\n row={row}\n column={titleColumn}\n recordKey={key!}\n onSaved={onEdit ?? (() => {})}\n isCurrent={isCurrent}\n app\n display={(next) => <span>{next === null || next === undefined || String(next) === '' ? rowLabel(base, row) : String(next)}</span>}\n />\n ));\n }, [row, titleEditable, index]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(\n () => () => {\n if (header) onTitleEditor?.(index, undefined);\n },\n [index],\n ); // eslint-disable-line react-hooks/exhaustive-deps\n /* The facts' line is held while the row is on its way: under the name it\n pushed the whole page down when it came (test/built-client-vitals.mjs). So is it while the host's adornments are\n asked about one of its empty facts: an empty fact is left out, and one the host adorns would join the line late. */\n const waitsOnHost = Boolean(row && adornHeld?.length) && facts.some((path) => adornHeld!.includes(path) && (row![path] ?? '') === '');\n if (section && ((!row && data.isPending) || waitsOnHost) && facts.length)\n return {\n status: null,\n facts: (\n <ul className=\"page-facts page-head-facts\" aria-hidden=\"true\" style={{ visibility: 'hidden' }}>\n <li className=\"page-fact\"> </li>\n </ul>\n ),\n };\n if (!section || !row) return { status: null, facts: null };\n\n const presented = presentationColumns(state.schema, base, [...(status ? [status] : []), ...facts]);\n const byPath = new Map((got?.resolved ?? []).map((c) => [c.path, c]));\n const columnAt = (path: string) =>\n (base.columns.find((c) => c.name === path) ?? presented.get(path) ?? byPath.get(path)) as\n | (ColumnMeta & { references?: { table: string; column: string } })\n | undefined;\n const filled = (path: string) => row[path] !== null && row[path] !== undefined && row[path] !== '';\n const captionOf = (path: string) => (columnLabel(base.id, path) as string | null) ?? humanName(path.split('.').pop() ?? path);\n const said = (path: string) => {\n const column = columnAt(path);\n const labelAt = refLabels.get(path);\n return column?.references ? (\n <RefJump\n references={column.references}\n value={row[path]}\n label={labelAt ? row[labelAt] : undefined}\n table={base}\n column={path}\n row={row}\n />\n ) : (\n <Value col={column} value={row[path]} tableId={base.id} compact />\n );\n };\n /* What the host draws at an own column: beside a filled fact's value, or as an empty fact's whole value. */\n const adornedAt = (path: string) =>\n adorn && key && !preview && !path.includes('.') && base.columns.some((c) => c.name === path)\n ? adorn({ table: base.id, column: path, key, filled: filled(path) })\n : undefined;\n const adornments = new Map(facts.map((path) => [path, adornedAt(path)] as const));\n const shown = facts.filter((path) => filled(path) || adornments.get(path));\n return {\n /* Its caption is heard, not seen: beside the name a chip is its own word. */\n status:\n status && filled(status) ? (\n <span className=\"page-head-status\">\n <span className=\"visually-hidden\">{captionOf(status)}: </span>\n {said(status)}\n </span>\n ) : null,\n facts: shown.length ? (\n <ul className=\"page-facts page-head-facts\" aria-label={say('common.keyFacts')}>\n {shown.map((path) => {\n const labels = section.factLabels;\n const word =\n labels && Object.hasOwn(labels, path)\n ? factWord(labels[path], row[path], columnDisplay(base.id, path) as { format?: string; unit?: string; bar?: boolean } | null)\n : undefined;\n const before = word !== undefined && labels![path].position === 'before';\n return (\n <li key={path} className=\"page-fact\">\n {/* A fact is a captioned value, as a field is: \"Close date\" over \"Dec 11, 2026\". An authored word\n (\"3 beds\", \"Asking $22,495\") is its own caption. */}\n {word === undefined && (\n <span className=\"page-fact-caption\">\n {captionOf(path)}\n <span className=\"visually-hidden\">: </span>\n </span>\n )}\n {before && <span className=\"page-fact-word\">{word} </span>}\n {filled(path) && said(path)}\n {word !== undefined && !before && <span className=\"page-fact-word\"> {word}</span>}\n {adornments.get(path)}\n </li>\n );\n })}\n </ul>\n ) : null,\n };\n}\n","/** What PageLayout says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n recordContext: 'Record context',\n /** A showcase's panel, named by what it offers: \"Home: Asking rent\". */\n showcasePanel: '{noun}: {figure}',\n});\n","/**\n * The record's main content and optional context rail share one responsive layout, arranged by the page's\n * archetype (shared/pageLayouts.ts). `data-layout` names it from the first render, so the columns are the\n * archetype's before any section has landed; the geometry is page.css's, keyed on it.\n */\nimport type { ReactNode } from 'react';\nimport type { PageLayoutName } from '@mistriwork/engine/shared/pageLayouts.js';\nimport { say } from '../copy/record/components/PageLayout.js';\n\nexport function PageLayout({\n children,\n aside,\n asideLabel = say('recordContext'),\n layout,\n leads,\n below,\n panel,\n}: {\n children: ReactNode;\n aside?: ReactNode;\n asideLabel?: string;\n layout?: PageLayoutName;\n /** The aside holds an offer, a reference's card or the one current row, which stacked columns weave into the main one. */\n leads?: boolean;\n /** A showcase's body: the main column's sections after its photos, under the showcase band at full width. */\n below?: ReactNode;\n /** A showcase's panel, named by what it offers (\"Home: Asking rent\") rather than as the record's context. */\n panel?: { noun: string; figure?: string };\n}) {\n if (!aside) {\n return (\n <div className=\"page-body\" data-layout={layout}>\n {children}\n {below}\n </div>\n );\n }\n /* A showcase is two bands, in reading order: the photos with the panel beside them, then the body under both. On\n a phone the three stack as written, so the price and its call to action follow the photos, not every list. */\n if (layout === 'showcase') {\n return (\n <div className=\"page-layout\" data-layout=\"showcase\">\n <div className=\"page-body page-main page-showcase\">{children}</div>\n <aside\n className=\"page-body page-aside page-panel\"\n aria-label={panel ? (panel.figure ? say('showcasePanel', { noun: panel.noun, figure: panel.figure }) : panel.noun) : asideLabel}\n >\n {aside}\n </aside>\n {below && <div className=\"page-body page-showcase-body\">{below}</div>}\n </div>\n );\n }\n return (\n <div className=\"page-layout\" data-layout={layout} data-leads={leads || undefined}>\n <div className=\"page-body page-main\">{children}</div>\n <aside className=\"page-body page-aside\" aria-label={asideLabel}>\n {aside}\n </aside>\n </div>\n );\n}\n","/**\n * A page: one record, and everything around it at once.\n *\n * Sections are Queries started together that land as they arrive, each in\n * its own place: a page with a count over a large child table should not\n * hold up the record's own name. A section with a `when` is shown only\n * while the root satisfies it; a run of metrics is one strip; a run of\n * lists is a tab strip whose tabs are fetched when opened, which is the\n * whole reason six lists as tabs are cheaper than six lists down a page.\n * One bad section is named in place and does not take the page with it.\n *\n * The leaves — a value in its dress, a reference chip, an editable field,\n * the pending bar, Delete, the layout builder — are the vanilla client's\n * still, drawn into place.\n *\n * This module is the page itself: which surface it belongs to, which\n * section names the record, and the related New form a host keeps open\n * across refreshes. The head is PageHead.tsx and the sections' layout\n * PageSections.tsx; each kind draws in its own module (PageFields,\n * PageMetrics, PageTimeline, PageRelated) through one box (PageSectionBox),\n * reading the page around it from pageContext.ts.\n */\nimport { ErrorBoundary } from './ErrorBoundary.js';\nimport { ProblemScopeProvider } from './Notes.js';\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { columnLabel, registerSurfaceMutationPendingProbe, state } from '../core.js';\nimport { refreshRecordInPlace } from '../recordWriteRefresh.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { PendingBarPlacement } from './Editable.js';\nimport type { DeleteButtonHost } from './DeleteButton.js';\nimport type { RecordSurfaceOwner } from './recordSurface.js';\nimport { openRelatedRecord } from '../insert.js';\nimport type { NewRecordProps } from './NewRecord.js';\nimport { onDemand } from './onDemand.js';\nimport { RecordGone } from './RecordGone.js';\nimport { headerOf, rootLabel, type PageDef, type PageEntry, type SectionPlan } from './pageModel.js';\nimport { PageRenderContext, spoken, type RecordActions, type RelatedCreator } from './pageContext.js';\nimport { shell } from '../shellMode.js';\nimport { PageHead } from './PageHead.js';\nimport { Sections } from './PageSections.js';\nimport { PageLayout } from './PageLayout.js';\nimport { drawnLayout, showcaseIndex } from '@mistriwork/engine/shared/pageLayouts.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\n\n/* The form and its field library load when a related New first opens. */\nconst NewRecordDialog = onDemand(() => import('./NewRecord.js'), 'NewRecordDialog', { quiet: true });\n\n/** One explicitly owned, non-route editor (never a second active draft). Keep owner stable through lease\n * renewal and ordinary refresh; replace it on close/reopen or another entry.\n * The host owns navigation and must retain pending/uncertain deletion status\n * synchronously, blocking voluntary close/replacement until reconciled. */\nexport interface PageViewHost {\n owner: RecordSurfaceOwner;\n pendingBar: PendingBarPlacement;\n /** undefined is staging/discard, NOT acknowledgement; true is confirmed\n * Save/Undo, false requests refresh. Refresh this surface without remounting\n * its editor or replacing dirty fields. */\n onRecordChange: (opts?: { inPlace?: boolean }) => void;\n /** Includes both authored fixed actions and separately granted commands. */\n onActionDone: () => void;\n onDeleted: () => void;\n onDeleteStateChange: DeleteButtonHost['onStateChange'];\n}\n\nexport interface PageProps {\n entry: PageEntry;\n page: PageDef;\n base: TableMeta;\n plans: SectionPlan[];\n /** With no record chosen, the list *is* the chooser, drawn into the body. */\n chooser?: ReactNode;\n /** The other pages this table has, for the title's picker. */\n others: Array<{ id: string; name: string; source: string }>;\n onLabel: (label: string) => void;\n onTab: (tab: string | undefined) => void;\n onLayout: () => void;\n /** Fixed edits and separately granted business commands. */\n actions?: RecordActions;\n /** Authoring preview: no write/navigation leaves, with reads pinned to the editor's connection. */\n preview?: { connection: string };\n host?: PageViewHost;\n /** No head: the sections alone, as a free-form page's block places them (RecordPageBody's `only`). */\n bare?: boolean;\n}\n\n/* ---------- the page ---------- */\n\nexport function PageView(props: PageProps) {\n const { entry, page, base, plans, chooser, host } = props;\n const queries = useQueryClient();\n const keyText = JSON.stringify(entry.key);\n const surface = useMemo(\n () => (host ? { owner: host.owner, pageId: entry.pageId, table: base.id, keyText } : undefined),\n [host?.owner, entry.pageId, base.id, keyText],\n );\n const activeSurface = useRef(surface);\n activeSurface.current = surface;\n const activeEntry = useRef(entry);\n activeEntry.current = entry;\n const mounted = useRef(true);\n useEffect(() => {\n mounted.current = true;\n return () => {\n mounted.current = false;\n };\n }, []);\n const isCurrent = useCallback(\n () =>\n !surface ||\n (mounted.current &&\n activeSurface.current === surface &&\n surface.owner.isCurrent() &&\n activeEntry.current.pageId === surface.pageId &&\n JSON.stringify(activeEntry.current.key) === surface.keyText),\n [surface],\n );\n // Keep the child above section loading/error branches: a related refresh must\n // not unmount a pending form or the parent field editor. The actual Dialog is\n // still a descendant of the record Modal in React's focus-ownership tree.\n type RelatedForm = { surface: typeof surface; props?: NewRecordProps; unresolved: boolean; changed: (value: boolean) => void };\n const [related, setRelated] = useState<RelatedForm | null>(null);\n const activeRelated = useRef<RelatedForm | null>(null);\n const relatedAnchor = useRef<HTMLSpanElement>(null);\n useLayoutEffect(() => {\n if (!surface) return;\n return registerSurfaceMutationPendingProbe(\n () => isCurrent() && activeRelated.current?.surface === surface && activeRelated.current.unresolved,\n );\n }, [surface, isCurrent]);\n const openRelated: RelatedCreator = (table, form, onAdded) => {\n if (!surface || !isCurrent() || !relatedAnchor.current || activeRelated.current?.surface === surface) return;\n const child: RelatedForm = {\n surface,\n unresolved: false,\n changed: (value) => {\n if (isCurrent() && activeRelated.current === child) child.unresolved = value;\n },\n };\n activeRelated.current = child;\n const current = () => isCurrent() && activeRelated.current === child;\n openRelatedRecord(table, form, onAdded, {\n host: relatedAnchor.current,\n isCurrent: current,\n close: () => {\n if (current()) {\n activeRelated.current = null;\n setRelated(null);\n }\n },\n render: (props) => {\n if (current()) {\n child.props = props;\n setRelated(child);\n }\n },\n });\n if (!child.props && activeRelated.current === child) activeRelated.current = null;\n };\n const onLabel = (label: string) => {\n if (isCurrent()) props.onLabel(label);\n };\n const onTab = (tab: string | undefined) => {\n if (isCurrent()) props.onTab(tab);\n };\n const hasAside = page.sections.some((section) => section.region === 'aside' && !section.hidden);\n /* An aside that says something of the record's surroundings — an offer, a reference's card, the one current row —\n is woven into the main column where the columns stack (page.css). Said from the page, as the archetype is, rather\n than asked of the drawn sections with :has(), which restyled the whole page each time an element came or went\n in it (test/built-client-vitals.mjs). */\n const leads = page.sections.some(\n (section) => section.region === 'aside' && !section.hidden && (section.presentation === 'headline' || section.presentation === 'card'),\n );\n const [labelOwner, setLabelOwner] = useState<number | undefined>(undefined);\n const [titleEditor, setTitleEditor] = useState<{ index: number; render: () => ReactNode } | null>(null);\n const onTitleEditor = useCallback((index: number, render: (() => ReactNode) | undefined) => {\n setTitleEditor((current) => (render ? { index, render } : current?.index === index ? null : current));\n }, []);\n /* A record header names the record first: it is the head. */\n const header = useMemo(() => headerOf(page), [page]);\n /* A verb a related list draws in its own head (`actions`) is that list's, not the record's head's — unless the\n record's header names it too. */\n const headActions = useMemo(() => {\n const placed = new Set(page.sections.flatMap((section) => section.listActions ?? []));\n for (const id of header?.section.headerActions ?? []) placed.delete(id);\n const all = props.actions;\n return all && placed.size ? { ...all, list: all.list.filter((action) => !placed.has(action.id)) } : all;\n }, [page, header, props.actions]);\n const labelOrder = useMemo(() => {\n const fields = page.sections\n .map((section, index) => ({ section, index }))\n .filter(({ section }) => section.kind === 'fields' && !section.hidden);\n const heads = fields.filter(({ section }) => section.presentation === 'header');\n const rest = fields.filter(({ section }) => section.presentation !== 'header');\n return [\n ...heads,\n ...rest.filter(({ section }) => section.region !== 'aside'),\n ...rest.filter(({ section }) => section.region === 'aside'),\n ];\n }, [page]);\n const titleOwner = hasAside ? labelOwner : labelOrder[0]?.index;\n // Keyed on what identifies the record and its page, not on object identity:\n // a host that rebuilds its props per render must not restart label ownership.\n const labels = useMemo(() => ({ values: new Map<number, string>(), published: undefined as string | undefined }), [page.id, keyText]); // eslint-disable-line react-hooks/exhaustive-deps\n const activeLabels = useRef(labels);\n activeLabels.current = labels;\n const publishLabel = useRef(onLabel);\n publishLabel.current = onLabel;\n const onSectionLabel = useCallback(\n (index: number, label: string | undefined) => {\n // Cleanup from an old page must not publish into its replacement.\n if (activeLabels.current !== labels || !isCurrent()) return;\n if (label === undefined) labels.values.delete(index);\n else labels.values.set(index, label);\n // A gated or slow main section must not prevent an already-loaded section\n // from naming the record; an aside can never supersede a loaded main label.\n const owner = labelOrder.find((item) => labels.values.has(item.index));\n setLabelOwner(owner?.index);\n const chosen = owner && labels.values.get(owner.index);\n if (chosen !== undefined && chosen !== labels.published) {\n labels.published = chosen;\n publishLabel.current(chosen);\n }\n },\n [labels, labelOrder, isCurrent],\n );\n /* A write that landed in place needs no repaint — the bar reads the\n store and the fields confirm themselves; one that asked for it gets one. */\n const refreshInPlace = () => {\n if (!entry.key) return;\n refreshRecordInPlace(\n queries,\n { connection: state.activeConnection ?? '', table: base.id, key: entry.key, queryScope: props.actions?.queryScope },\n true,\n );\n };\n /* What the shell draws at the record's own fields (a suggestion waiting on one): asked by every record page, routed\n or in a dialog, never by a preview. The slot is the shell's for its whole life, so the hook's place is fixed. A\n suggestion that landed wrote to the record, so it is read again as any write asks. */\n const landed = useRef<() => void>(() => {});\n const adornment = shell().slots.useFieldAdornment?.(\n host?.owner.connection ?? state.activeConnection ?? '',\n base.id,\n props.preview ? undefined : entry.key,\n () => landed.current(),\n );\n const onPending = (opts?: { inPlace?: boolean }) => {\n if (host) {\n if (isCurrent()) host.onRecordChange(opts);\n return;\n }\n /* Re-read in place, never by replacing the walk entry: that started the\n room over and blanked the record until every read had answered again\n (recordWriteRefresh.ts, refreshRecordInPlace). */\n if (opts && opts.inPlace === false) refreshInPlace();\n else if (opts?.inPlace && page.sections.some((section) => section.workflow))\n void queries.invalidateQueries({ queryKey: ['page-fields', page.id, base.id, entry.key] });\n };\n /* A record that is gone — deleted under an open page, or a link to one\n that never was — fails every section at once. It is said once, in the\n words the room uses for a missing record (PageRoom.tsx), and the head\n offers no verbs for it: each section repeating a 404 beside Start work\n and Mark done was a page still open for business. */\n landed.current = () => onPending({ inPlace: false });\n const [goneKey, setGone] = useState<string | null>(null);\n const gone = goneKey === keyText;\n const onGone = useCallback(() => setGone(keyText), [keyText]);\n if (host && !isCurrent()) return null;\n /* The archetype (shared/pageLayouts.ts) is on the page the payload carries, so its columns are drawn on the first\n render, before any section has answered. */\n const layout = drawnLayout(page);\n const showcase = showcaseIndex(page);\n const sectionsOf = (region: 'main' | 'aside' | undefined, only?: (index: number) => boolean) =>\n entry.key ? (\n <Sections\n page={page}\n base={base}\n recordKey={entry.key}\n plans={plans}\n entry={entry}\n onLabel={onLabel}\n onEdit={onPending}\n onTab={onTab}\n region={region}\n onSectionLabel={onSectionLabel}\n titleOwner={titleOwner}\n onTitleEditor={onTitleEditor}\n only={only}\n />\n ) : null;\n /* A showcase's panel is named by what it offers, \"Home: Asking rent\", where a record's aside is its context. */\n const offer =\n layout === 'showcase' ? page.sections.find((section) => section.region === 'aside' && section.presentation === 'headline') : undefined;\n const figure = offer?.paths?.[0];\n const panel =\n layout === 'showcase'\n ? {\n noun: page.name,\n figure: figure ? ((columnLabel(base.id, figure) as string | null) ?? humanName(figure.split('.').pop() ?? figure)) : undefined,\n }\n : undefined;\n return (\n <PageRenderContext.Provider\n value={{\n ...(adornment?.adorn && !props.preview ? { adorn: adornment.adorn } : {}),\n ...(adornment?.held.length && !props.preview ? { adornHeld: adornment.held } : {}),\n preview: Boolean(props.preview),\n connection: props.preview?.connection ?? host?.owner.connection,\n isCurrent: host ? isCurrent : undefined,\n openRelated: host ? openRelated : undefined,\n actions: props.preview || gone ? undefined : props.actions,\n onGone,\n recordName: entry.label,\n ...(host ? { onActionDone: host.onActionDone } : {}),\n }}\n >\n <ProblemScopeProvider>\n {props.preview ? (\n <div className=\"page-head\">\n <h2 className=\"page-title\">{page.name}</h2>\n <div className=\"root-bar\">\n <h1 className=\"root-current\">{entry.label ?? (entry.key ? rootLabel(entry.key) : '')}</h1>\n </div>\n </div>\n ) : props.bare ? null : (\n <ErrorBoundary>\n <PageHead\n {...props}\n actions={gone ? undefined : headActions}\n gone={gone}\n onPending={onPending}\n title={titleEditor && titleEditor.index === titleOwner ? titleEditor.render : undefined}\n header={header}\n onSectionLabel={onSectionLabel}\n onTitleEditor={onTitleEditor}\n titleOwner={titleOwner}\n />\n </ErrorBoundary>\n )}\n {gone && entry.key ? (\n <PageLayout>\n <RecordGone base={base} spoken={spoken(base.name)} className=\"page-gone\" />\n </PageLayout>\n ) : entry.key ? (\n showcase !== undefined ? (\n <PageLayout\n layout={layout}\n panel={panel}\n aside={hasAside ? sectionsOf('aside') : undefined}\n below={sectionsOf(hasAside ? 'main' : undefined, (index) => index !== showcase)}\n >\n {sectionsOf(hasAside ? 'main' : undefined, (index) => index === showcase)}\n </PageLayout>\n ) : (\n <PageLayout layout={layout} leads={leads} aside={hasAside ? sectionsOf('aside') : undefined}>\n {sectionsOf(hasAside ? 'main' : undefined)}\n </PageLayout>\n )\n ) : (\n <PageLayout>{chooser}</PageLayout>\n )}\n {host && <span hidden ref={relatedAnchor} />}\n {related?.props && related.surface === surface && (\n <NewRecordDialog {...related.props} retainUncertain onUnresolvedChange={related.changed} />\n )}\n </ProblemScopeProvider>\n </PageRenderContext.Provider>\n );\n}\n","/** What RecordPageBody says, in the record page room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '@mistriwork/kit/client/messages.js';\n\nexport const say = defineMessages({\n thisRecordIsNoLonger: 'This record is no longer available.',\n theDeletionResultIsNotYet: 'The deletion result is not yet confirmed. Keep this tab open; do not submit another deletion.',\n});\n","/**\n * A record's waiting suggestions, drawn at their fields through the page's adornment slot (kit's pageContext.ts\n * `FieldAdornment`): asked beside the record's own read, only for a table the App says a decision answers, and drawn\n * by DecisionChip, which loads when a record first has one — an App that decides nothing never fetches it.\n *\n * Until the chip's code is here its place is held by the answer's words in the same muted ink, so the line it stands\n * on is the height it will be.\n */\nimport { lazy, Suspense, useMemo, useRef } from 'react';\nimport { useQuery, useQueryClient, type QueryClient } from '@tanstack/react-query';\nimport { api } from '@mistriwork/kit/client/core.js';\nimport type { FieldAdornment } from '@mistriwork/kit/client/components/pageContext.js';\nimport type { FieldSuggestion } from '../../shared/decisionSuggestions.js';\nimport { activeApp } from '../appState.js';\nimport './decisionMarks.css';\n\nconst NOTHING: readonly string[] = Object.freeze([]);\n\nconst DecisionChip = lazy(() => import('./DecisionChip.js'));\n\nconst suggestionsKey = (connection: string, table: string, key?: string) =>\n key === undefined ? ['record-decisions', connection, table] : ['record-decisions', connection, table, key];\n\n/** Ask a record's suggestions again: after a command landed on it, or one was settled. */\nexport function refreshDecisions(client: QueryClient, connection: string, table: string): void {\n void client.invalidateQueries({ queryKey: suggestionsKey(connection, table) });\n}\n\n/**\n * A record's suggestions, drawn at its fields, and whether they are still being asked for the first time — the shell's\n * `useFieldAdornment` slot (kit's shellMode.ts), read by every record page. While asked, a header leaves an empty fact\n * out, so its facts' line waits for them (kit's pageContext.ts `adornHeld`) rather than grow when they come. An error is\n * not a wait. No key (a preview, a list with no record chosen) asks nothing.\n */\nexport function useRecordDecisions(\n connection: string,\n table: string,\n recordKey: Readonly<Record<string, unknown>> | undefined,\n onLanded: () => void,\n): { adorn?: FieldAdornment; held: readonly string[] } {\n const keyText = JSON.stringify(recordKey ?? null);\n const client = useQueryClient();\n const answered = activeApp()?.decisions?.[table];\n const decided = Boolean(answered) && recordKey !== undefined;\n const asked = useQuery({\n queryKey: suggestionsKey(connection, table, keyText),\n queryFn: async () =>\n ((await api('/api/record-decisions', { table, key: recordKey })) as { suggestions: FieldSuggestion[] }).suggestions,\n enabled: decided,\n staleTime: 0,\n });\n const suggestions = asked.data;\n const landed = useRef(onLanded);\n landed.current = onLanded;\n const adorn = useMemo((): FieldAdornment | undefined => {\n if (!decided || !recordKey || !suggestions?.length) return undefined;\n const settled = () => {\n refreshDecisions(client, connection, table);\n landed.current();\n };\n return ({ column }) => {\n const suggestion = suggestions.find((each) => each.field === column);\n if (!suggestion) return null;\n return (\n <Suspense fallback={<span className=\"decision-chip-held\">{suggestion.label}</span>}>\n <DecisionChip suggestion={suggestion} table={table} recordKey={recordKey} onSettled={settled} />\n </Suspense>\n );\n };\n }, [decided, suggestions, client, connection, table, keyText]); // eslint-disable-line react-hooks/exhaustive-deps\n const held = decided && asked.isPending && asked.fetchStatus !== 'idle' ? Object.keys(answered!) : NOTHING;\n return adorn ? { adorn, held } : { held };\n}\n","/**\n * An App record's page, for a host that is not a route: the record dialog and\n * a split's detail pane. Reads go through the record surface, whose owner\n * fences every reply; writes and commands report to the host through\n * PageView's `host`, never the walk. The host remounts it per record (a\n * `key`), so one record's actions, drafts and delete state never reach the\n * next.\n */\nimport { useEffect, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';\nimport { useQueryClient } from '@tanstack/react-query';\nimport { rowLabel } from '@mistriwork/kit/client/core.js';\nimport { applyingStaged, subscribeStaged, stagedVersion } from '@mistriwork/kit/client/write.js';\nimport { updateAttempts } from '@mistriwork/kit/client/updateAttempts.js';\nimport { commandOperations } from '../commandState.js';\nimport { refreshRecordInPlace } from '@mistriwork/kit/client/recordWriteRefresh.js';\nimport { PageView } from '@mistriwork/kit/client/components/Page.js';\nimport type { DeleteState } from '@mistriwork/kit/client/components/DeleteButton.js';\nimport {\n RECORD_REFRESH_FAILED,\n useRecordSurface,\n type RecordSurfaceEntry,\n type RecordSurfaceOwner,\n} from '@mistriwork/kit/client/components/recordSurface.js';\nimport type { PageDef } from '@mistriwork/engine/shared/page.js';\nimport { say } from '../copy/record/components/RecordPageBody.js';\nimport { refreshDecisions } from './decisionAdornment.js';\n\nexport type PageSections = PageDef['sections'];\n\ninterface RecordPageBodyProps {\n owner: RecordSurfaceOwner;\n tableId: string;\n recordKey: Record<string, unknown>;\n label?: string;\n pageId: string;\n close: () => void;\n /** Install synchronously before controls can dispatch. */\n setPendingProbe: (probe: () => boolean) => void;\n onName: (name: string) => void;\n /** Called once the record's page has something to show — its fields, or why it has none. */\n onSettled: () => void;\n /** The host's sections in place of the page's own: a split's authored `detail.show`, as one fields section. */\n sections?: PageSections;\n /** Only the page's own sections of this kind, and no head: a free-form page's `<Timeline>` (sdk/blocks.tsx). */\n only?: string;\n}\n\nexport function RecordPageBody({\n owner,\n tableId,\n recordKey,\n label,\n pageId,\n close,\n setPendingProbe,\n onName,\n onSettled,\n sections,\n only,\n}: RecordPageBodyProps) {\n const [tab, setTab] = useState<string>();\n const [name, setName] = useState(label);\n const entry = useMemo<RecordSurfaceEntry>(\n () => ({ kind: 'page', pageId, table: tableId, key: recordKey, label: name, tab }),\n [pageId, tableId, recordKey, name, tab],\n );\n const { result, rootRow } = useRecordSurface({ owner, entry });\n const client = useQueryClient();\n useSyncExternalStore(subscribeStaged, stagedVersion, stagedVersion);\n useSyncExternalStore(updateAttempts.subscribe, updateAttempts.version, updateAttempts.version);\n useSyncExternalStore(commandOperations.subscribe, commandOperations.version, commandOperations.version);\n const deletion = useRef<DeleteState | undefined>(undefined);\n const [deleteStatus, setDeleteStatus] = useState<DeleteState>();\n const surfaced = result.status === 'ready' ? result.content : undefined;\n /* One page object per plan and per host sections: PageView keys its label\n ownership on the page it is given (recordSurface.ts), so a fresh spread\n every render would republish the label forever. With the host's sections\n the page's plans no longer line up by index; a fields section reads its\n own values. */\n /* `only` hides the rest rather than dropping them, so each plan still lines up with its section by index. */\n const page = useMemo(\n () =>\n surfaced && sections\n ? { ...surfaced.page, sections }\n : surfaced && only\n ? {\n ...surfaced.page,\n sections: surfaced.page.sections.map((section) => (section.kind === only ? section : { ...section, hidden: true })),\n }\n : surfaced?.page,\n [surfaced?.page, sections, only],\n );\n const content = surfaced && page ? { ...surfaced, page, plans: sections ? [] : surfaced.plans } : undefined;\n const settled = Boolean(content) || result.status === 'error' || result.status === 'missing';\n useEffect(() => {\n if (settled) onSettled();\n }, [settled]); // eslint-disable-line react-hooks/exhaustive-deps\n const actions = useRef(content?.actions);\n if (content) actions.current = content.actions;\n const pending = () =>\n owner.isCurrent() &&\n (applyingStaged() ||\n Boolean(updateAttempts.get({ connection: owner.connection, table: tableId, key: recordKey })) ||\n deletion.current === 'pending' ||\n deletion.current === 'uncertain' ||\n Boolean(\n actions.current?.list.some((action) => {\n if (!action.command) return false;\n const operation = commandOperations.get({\n connection: owner.connection,\n target: tableId,\n key: recordKey,\n command: action.command.id,\n commandVersion: action.command.version,\n });\n return operation?.phase === 'pending' || operation?.phase === 'unknown';\n }),\n ));\n useLayoutEffect(() => {\n setPendingProbe(pending);\n }, [owner, tableId, recordKey, setPendingProbe]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(() => {\n if (!content || !rootRow || !owner.isCurrent()) return;\n const said = rowLabel(content.base, rootRow) as string | null;\n if (said) setName(said);\n }, [rootRow, content?.base, owner]); // eslint-disable-line react-hooks/exhaustive-deps\n const refresh = (fields: boolean) => {\n if (!owner.isCurrent()) return;\n // Keep the editor mounted. Save's confirmed overlay remains authoritative;\n // command completion/explicit refresh can request fresh field values.\n refreshRecordInPlace(client, { connection: owner.connection, table: tableId, key: recordKey, queryScope: owner.queryScope }, fields);\n // What a command wrote may have settled a suggestion, or filled its field.\n refreshDecisions(client, owner.connection, tableId);\n };\n if (result.status === 'retired') return null;\n if (result.status === 'error') return <p className=\"note\">{result.message}</p>;\n if (result.status === 'missing') return <p className=\"note\">{say('thisRecordIsNoLonger')}</p>;\n if (!content) return <p className=\"note\">{say('common.reading')}</p>;\n return (\n <>\n {result.status === 'ready' && result.refreshFailed && (\n <p role=\"alert\" className=\"note\">\n {RECORD_REFRESH_FAILED}\n </p>\n )}\n {deleteStatus === 'uncertain' && <p role=\"alert\">{say('theDeletionResultIsNotYet')}</p>}\n <PageView\n {...content}\n {...(only ? { bare: true } : {})}\n onLayout={() => {}}\n onLabel={(next) => {\n setName(next);\n onName(next);\n }}\n onTab={setTab}\n host={{\n owner,\n pendingBar: 'inline',\n onRecordChange: (opts) => {\n if (opts) refresh(opts.inPlace === false);\n },\n onActionDone: () => refresh(true),\n onDeleteStateChange: (status) => {\n deletion.current = status;\n setDeleteStatus(status);\n },\n onDeleted: () => {\n refresh(false);\n close();\n },\n }}\n />\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAaA,QAAM,eAAe;CAChC,eAAe;CAC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