@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.
Files changed (221) hide show
  1. package/README.md +4 -3
  2. package/dist/client/assets/LayoutBuilder-MPzkVU2e.js.map +1 -1
  3. package/dist/client/assets/index-D2dHI6hR.js.map +1 -1
  4. package/dist/client/assets/shell-TreN_uLs.js.map +1 -1
  5. package/dist/docs/access-model.md +1 -1
  6. package/dist/docs/build-and-deploy.md +0 -1
  7. package/dist/docs/cli.md +1 -1
  8. package/dist/docs/glossary.md +3 -3
  9. package/dist/docs/query.md +9 -21
  10. package/dist/docs/status.md +3 -3
  11. package/dist/embed/react/chunks/LayoutBuilder-Cbxa_wve.js.map +1 -1
  12. package/dist/embed/react/chunks/app-0UZ1Re1k.js.map +1 -1
  13. package/dist/embed/react/chunks/page-Bx4o1kpQ.js.map +1 -1
  14. package/dist/embed/react/chunks/palette-Bb7Lf6eo.js.map +1 -1
  15. package/dist/embed/react/chunks/shell-DZRACiB9.js.map +1 -1
  16. package/dist/embed/react/chunks/write-BQO4CFc9.js.map +1 -1
  17. package/dist/embed/react/index.js +1 -1
  18. package/dist/server/build/dockerfile.js +1 -1
  19. package/dist/server/cli/usage.js +2 -2
  20. package/dist/ui/index.js +2 -2
  21. package/dist/ui/page.js +2 -2
  22. package/dist/ui/{shared-N4Ej8yRD.js → shared-1PD7TOTJ.js} +5 -5
  23. package/dist/ui/{shared-N4Ej8yRD.js.map → shared-1PD7TOTJ.js.map} +1 -1
  24. package/dist/ui/{shared-D5m86-4o.js → shared-1gMnOu9J.js} +6 -6
  25. package/dist/ui/{shared-D5m86-4o.js.map → shared-1gMnOu9J.js.map} +1 -1
  26. package/dist/ui/{shared-Ctaj8mR2.js → shared-5RQMi4BR.js} +3 -3
  27. package/dist/ui/{shared-Ctaj8mR2.js.map → shared-5RQMi4BR.js.map} +1 -1
  28. package/dist/ui/{shared-DpLeIATZ.js → shared-B-BUF9fx.js} +2 -2
  29. package/dist/ui/{shared-DpLeIATZ.js.map → shared-B-BUF9fx.js.map} +1 -1
  30. package/dist/ui/{shared-DWYnjItP.js → shared-B-MhiPIN.js} +9 -9
  31. package/dist/ui/{shared-DWYnjItP.js.map → shared-B-MhiPIN.js.map} +1 -1
  32. package/dist/ui/{shared-0fNuhSbG.js → shared-B07qIMlE.js} +5 -5
  33. package/dist/ui/{shared-0fNuhSbG.js.map → shared-B07qIMlE.js.map} +1 -1
  34. package/dist/ui/{shared-lYtMadRU.js → shared-B1SAS_J-.js} +3 -3
  35. package/dist/ui/{shared-lYtMadRU.js.map → shared-B1SAS_J-.js.map} +1 -1
  36. package/dist/ui/{shared-CpI0Y8M5.js → shared-B4jgU8h9.js} +6 -6
  37. package/dist/ui/{shared-CpI0Y8M5.js.map → shared-B4jgU8h9.js.map} +1 -1
  38. package/dist/ui/{shared-Cxu1c35l.js → shared-B5aBCUi7.js} +30 -30
  39. package/dist/ui/{shared-Cxu1c35l.js.map → shared-B5aBCUi7.js.map} +1 -1
  40. package/dist/ui/{shared-CAe-US1q.js → shared-B9H7_Pji.js} +5 -5
  41. package/dist/ui/{shared-CAe-US1q.js.map → shared-B9H7_Pji.js.map} +1 -1
  42. package/dist/ui/{shared-Q2bgBaYo.js → shared-BAXr20S-.js} +4 -4
  43. package/dist/ui/{shared-Q2bgBaYo.js.map → shared-BAXr20S-.js.map} +1 -1
  44. package/dist/ui/{shared-CyEefFFb.js → shared-BDDUzH-f.js} +19 -19
  45. package/dist/ui/{shared-CyEefFFb.js.map → shared-BDDUzH-f.js.map} +1 -1
  46. package/dist/ui/{shared-BdhPI6dq.js → shared-BGmkeDeW.js} +3 -3
  47. package/dist/ui/{shared-BdhPI6dq.js.map → shared-BGmkeDeW.js.map} +1 -1
  48. package/dist/ui/{shared-DONIpq2q.js → shared-BHCQ60yN.js} +2 -2
  49. package/dist/ui/{shared-DONIpq2q.js.map → shared-BHCQ60yN.js.map} +1 -1
  50. package/dist/ui/{shared-CNmaAv64.js → shared-BHsjawAG.js} +8 -8
  51. package/dist/ui/{shared-CNmaAv64.js.map → shared-BHsjawAG.js.map} +1 -1
  52. package/dist/ui/{shared-DgjU9kOy.js → shared-BIQuK_nq.js} +4 -4
  53. package/dist/ui/{shared-DgjU9kOy.js.map → shared-BIQuK_nq.js.map} +1 -1
  54. package/dist/ui/{shared-icSQAj21.js → shared-BOe4W2FI.js} +3 -3
  55. package/dist/ui/{shared-icSQAj21.js.map → shared-BOe4W2FI.js.map} +1 -1
  56. package/dist/ui/{shared-BlxoOJSk.js → shared-BPpC08ip.js} +3 -3
  57. package/dist/ui/{shared-BlxoOJSk.js.map → shared-BPpC08ip.js.map} +1 -1
  58. package/dist/ui/{shared-BtiFL37J.js → shared-BdA3LPCB.js} +2 -2
  59. package/dist/ui/{shared-BtiFL37J.js.map → shared-BdA3LPCB.js.map} +1 -1
  60. package/dist/ui/{shared-CvR94vn4.js → shared-Be3nbWsd.js} +11 -11
  61. package/dist/ui/{shared-CvR94vn4.js.map → shared-Be3nbWsd.js.map} +1 -1
  62. package/dist/ui/{shared-Bl_nF_IH.js → shared-Bf30ZLoS.js} +8 -4
  63. package/dist/ui/shared-Bf30ZLoS.js.map +1 -0
  64. package/dist/ui/{shared-DijrJ_V-.js → shared-BguP_BaR.js} +7 -7
  65. package/dist/ui/{shared-DijrJ_V-.js.map → shared-BguP_BaR.js.map} +1 -1
  66. package/dist/ui/{shared-DPAVoWY0.js → shared-BoLbc2WD.js} +17 -2
  67. package/dist/ui/{shared-DPAVoWY0.js.map → shared-BoLbc2WD.js.map} +1 -1
  68. package/dist/ui/{shared-BkdBTYwx.js → shared-BttyOW4W.js} +3 -3
  69. package/dist/ui/{shared-BkdBTYwx.js.map → shared-BttyOW4W.js.map} +1 -1
  70. package/dist/ui/{shared-CQWLz8uT.js → shared-BumxsBlA.js} +10 -10
  71. package/dist/ui/{shared-CQWLz8uT.js.map → shared-BumxsBlA.js.map} +1 -1
  72. package/dist/ui/{shared-Dzu7tFiC.js → shared-Bw73ktBk.js} +3 -3
  73. package/dist/ui/{shared-Dzu7tFiC.js.map → shared-Bw73ktBk.js.map} +1 -1
  74. package/dist/ui/{shared-BhAYErSx.js → shared-C1B0GH0e.js} +4 -4
  75. package/dist/ui/{shared-BhAYErSx.js.map → shared-C1B0GH0e.js.map} +1 -1
  76. package/dist/ui/{shared-BQJQcGgj.js → shared-C2FsyYr7.js} +4 -4
  77. package/dist/ui/{shared-BQJQcGgj.js.map → shared-C2FsyYr7.js.map} +1 -1
  78. package/dist/ui/{shared-B9lw2Ryh.js → shared-C2RU1qjv.js} +4 -4
  79. package/dist/ui/{shared-B9lw2Ryh.js.map → shared-C2RU1qjv.js.map} +1 -1
  80. package/dist/ui/{shared-DQYNI9wO.js → shared-C42f07hJ.js} +5 -5
  81. package/dist/ui/{shared-DQYNI9wO.js.map → shared-C42f07hJ.js.map} +1 -1
  82. package/dist/ui/{shared-CqCZ8wMY.js → shared-C4LkPCU4.js} +3 -3
  83. package/dist/ui/{shared-CqCZ8wMY.js.map → shared-C4LkPCU4.js.map} +1 -1
  84. package/dist/ui/{shared-BhtpgOpa.js → shared-C4wSfz6k.js} +9 -9
  85. package/dist/ui/{shared-BhtpgOpa.js.map → shared-C4wSfz6k.js.map} +1 -1
  86. package/dist/ui/{shared-BHc2Izkj.js → shared-C9DZtSFH.js} +2 -2
  87. package/dist/ui/{shared-BHc2Izkj.js.map → shared-C9DZtSFH.js.map} +1 -1
  88. package/dist/ui/{shared-DW1YuiNS.js → shared-CA52ClGo.js} +2 -2
  89. package/dist/ui/{shared-DW1YuiNS.js.map → shared-CA52ClGo.js.map} +1 -1
  90. package/dist/ui/{shared-BbSbilkh.js → shared-CBciTwm6.js} +9 -9
  91. package/dist/ui/{shared-BbSbilkh.js.map → shared-CBciTwm6.js.map} +1 -1
  92. package/dist/ui/{shared-C-J32eBn.js → shared-CL3RLKDA.js} +16 -16
  93. package/dist/ui/{shared-C-J32eBn.js.map → shared-CL3RLKDA.js.map} +1 -1
  94. package/dist/ui/{shared-Ck8S4OxW.js → shared-CLq3-_hW.js} +3 -3
  95. package/dist/ui/{shared-Ck8S4OxW.js.map → shared-CLq3-_hW.js.map} +1 -1
  96. package/dist/ui/{shared-Q5WefT7G.js → shared-CMjK-Ucd.js} +3 -3
  97. package/dist/ui/{shared-Q5WefT7G.js.map → shared-CMjK-Ucd.js.map} +1 -1
  98. package/dist/ui/{shared-D3MAuEA3.js → shared-CPjpSFGh.js} +2 -2
  99. package/dist/ui/{shared-D3MAuEA3.js.map → shared-CPjpSFGh.js.map} +1 -1
  100. package/dist/ui/{shared-VshXGwXP.js → shared-CSPhENq3.js} +2 -2
  101. package/dist/ui/{shared-VshXGwXP.js.map → shared-CSPhENq3.js.map} +1 -1
  102. package/dist/ui/{shared-DJrJaE73.js → shared-CZJE4Bmp.js} +3 -3
  103. package/dist/ui/{shared-DJrJaE73.js.map → shared-CZJE4Bmp.js.map} +1 -1
  104. package/dist/ui/{shared-D7ONOwI7.js → shared-C_BhUL2I.js} +7 -7
  105. package/dist/ui/{shared-D7ONOwI7.js.map → shared-C_BhUL2I.js.map} +1 -1
  106. package/dist/ui/{shared-j-2peBIB.js → shared-CbeujwdU.js} +4 -4
  107. package/dist/ui/{shared-j-2peBIB.js.map → shared-CbeujwdU.js.map} +1 -1
  108. package/dist/ui/{shared-D5GrOEa2.js → shared-Cbf-o4Dt.js} +4 -4
  109. package/dist/ui/{shared-D5GrOEa2.js.map → shared-Cbf-o4Dt.js.map} +1 -1
  110. package/dist/ui/{shared-HwiPIajr.js → shared-CdNmeNHh.js} +3 -3
  111. package/dist/ui/{shared-HwiPIajr.js.map → shared-CdNmeNHh.js.map} +1 -1
  112. package/dist/ui/{shared-ZCFt-CPb.js → shared-CdQOMD8J.js} +3 -3
  113. package/dist/ui/{shared-ZCFt-CPb.js.map → shared-CdQOMD8J.js.map} +1 -1
  114. package/dist/ui/{shared-ClhXSGGK.js → shared-CdiPYlTh.js} +2 -2
  115. package/dist/ui/{shared-ClhXSGGK.js.map → shared-CdiPYlTh.js.map} +1 -1
  116. package/dist/ui/{shared-DA8_pVRZ.js → shared-CepLAhwm.js} +2 -2
  117. package/dist/ui/{shared-DA8_pVRZ.js.map → shared-CepLAhwm.js.map} +1 -1
  118. package/dist/ui/{shared-BrYKjrnM.js → shared-Ch82h_Fu.js} +6 -6
  119. package/dist/ui/{shared-BrYKjrnM.js.map → shared-Ch82h_Fu.js.map} +1 -1
  120. package/dist/ui/{shared-C4UrE8Fb.js → shared-Chp88all.js} +3 -3
  121. package/dist/ui/{shared-C4UrE8Fb.js.map → shared-Chp88all.js.map} +1 -1
  122. package/dist/ui/{shared-CWa80DTO.js → shared-Ci16s2rN.js} +9 -9
  123. package/dist/ui/{shared-CWa80DTO.js.map → shared-Ci16s2rN.js.map} +1 -1
  124. package/dist/ui/{shared-tksTLD6Q.js → shared-CiqNkoE1.js} +5 -5
  125. package/dist/ui/{shared-tksTLD6Q.js.map → shared-CiqNkoE1.js.map} +1 -1
  126. package/dist/ui/{shared-yt7DjSrq.js → shared-CpMhOq8F.js} +2 -2
  127. package/dist/ui/{shared-yt7DjSrq.js.map → shared-CpMhOq8F.js.map} +1 -1
  128. package/dist/ui/{shared-Dm0z5WUl.js → shared-CrWv5JKH.js} +6 -6
  129. package/dist/ui/{shared-Dm0z5WUl.js.map → shared-CrWv5JKH.js.map} +1 -1
  130. package/dist/ui/{shared-CQL3FGHc.js → shared-Csfi3Pti.js} +2 -2
  131. package/dist/ui/{shared-CQL3FGHc.js.map → shared-Csfi3Pti.js.map} +1 -1
  132. package/dist/ui/{shared-BKNRbm-V.js → shared-CuZt26rm.js} +2 -2
  133. package/dist/ui/{shared-BKNRbm-V.js.map → shared-CuZt26rm.js.map} +1 -1
  134. package/dist/ui/{shared-Guq3upiR.js → shared-Cws_z-TS.js} +2 -2
  135. package/dist/ui/{shared-Guq3upiR.js.map → shared-Cws_z-TS.js.map} +1 -1
  136. package/dist/ui/{shared-Bw_qZeIj.js → shared-D1KWuCg6.js} +2 -2
  137. package/dist/ui/{shared-Bw_qZeIj.js.map → shared-D1KWuCg6.js.map} +1 -1
  138. package/dist/ui/{shared-CuCZKwXW.js → shared-D66ju_Cb.js} +23 -23
  139. package/dist/ui/{shared-CuCZKwXW.js.map → shared-D66ju_Cb.js.map} +1 -1
  140. package/dist/ui/{shared-DYfX7NSM.js → shared-DGaQZXnw.js} +2 -2
  141. package/dist/ui/{shared-DYfX7NSM.js.map → shared-DGaQZXnw.js.map} +1 -1
  142. package/dist/ui/{shared-B3Hp8tOv.js → shared-DHy41sET.js} +6 -6
  143. package/dist/ui/{shared-B3Hp8tOv.js.map → shared-DHy41sET.js.map} +1 -1
  144. package/dist/ui/{shared-CXyd7IKi.js → shared-DKEOMQ6l.js} +2 -2
  145. package/dist/ui/{shared-CXyd7IKi.js.map → shared-DKEOMQ6l.js.map} +1 -1
  146. package/dist/ui/{shared-Ccmc8YO0.js → shared-DSUICuaJ.js} +33 -33
  147. package/dist/ui/{shared-Ccmc8YO0.js.map → shared-DSUICuaJ.js.map} +1 -1
  148. package/dist/ui/{shared-CL2iw_js.js → shared-DUPMRoO0.js} +13 -13
  149. package/dist/ui/{shared-CL2iw_js.js.map → shared-DUPMRoO0.js.map} +1 -1
  150. package/dist/ui/{shared-Dtp4eRul.js → shared-DVfdm6ah.js} +2 -2
  151. package/dist/ui/{shared-Dtp4eRul.js.map → shared-DVfdm6ah.js.map} +1 -1
  152. package/dist/ui/{shared-BJ5Ex32G.js → shared-DXM7d7lJ.js} +3 -3
  153. package/dist/ui/{shared-BJ5Ex32G.js.map → shared-DXM7d7lJ.js.map} +1 -1
  154. package/dist/ui/{shared-BFr6ld0e.js → shared-DXbMlcev.js} +2 -2
  155. package/dist/ui/{shared-BFr6ld0e.js.map → shared-DXbMlcev.js.map} +1 -1
  156. package/dist/ui/{shared-BUp3jv-N.js → shared-D_SkPtJ9.js} +6 -6
  157. package/dist/ui/{shared-BUp3jv-N.js.map → shared-D_SkPtJ9.js.map} +1 -1
  158. package/dist/ui/{shared-CdNomVzH.js → shared-Dd21k2ic.js} +4 -4
  159. package/dist/ui/{shared-CdNomVzH.js.map → shared-Dd21k2ic.js.map} +1 -1
  160. package/dist/ui/{shared-gRMbxmpu.js → shared-Dh0nHtLZ.js} +8 -8
  161. package/dist/ui/{shared-gRMbxmpu.js.map → shared-Dh0nHtLZ.js.map} +1 -1
  162. package/dist/ui/{shared-BKGJgjog.js → shared-DkOdSpSK.js} +3 -3
  163. package/dist/ui/{shared-BKGJgjog.js.map → shared-DkOdSpSK.js.map} +1 -1
  164. package/dist/ui/{shared-BMsh72Uq.js → shared-Dkph5ckT.js} +2 -2
  165. package/dist/ui/{shared-BMsh72Uq.js.map → shared-Dkph5ckT.js.map} +1 -1
  166. package/dist/ui/{shared-Be1HpDOB.js → shared-Dl1_Nx--.js} +3 -3
  167. package/dist/ui/{shared-Be1HpDOB.js.map → shared-Dl1_Nx--.js.map} +1 -1
  168. package/dist/ui/{shared-BQIZWOoJ.js → shared-Dm0IGbAf.js} +2 -2
  169. package/dist/ui/{shared-BQIZWOoJ.js.map → shared-Dm0IGbAf.js.map} +1 -1
  170. package/dist/ui/{shared-DSUtcU5S.js → shared-DnIkTpPr.js} +5 -5
  171. package/dist/ui/{shared-DSUtcU5S.js.map → shared-DnIkTpPr.js.map} +1 -1
  172. package/dist/ui/{shared-DsxGbYlV.js → shared-Docl_0tq.js} +3 -3
  173. package/dist/ui/{shared-DsxGbYlV.js.map → shared-Docl_0tq.js.map} +1 -1
  174. package/dist/ui/{shared-DZskrV26.js → shared-DprrHC72.js} +2 -2
  175. package/dist/ui/{shared-DZskrV26.js.map → shared-DprrHC72.js.map} +1 -1
  176. package/dist/ui/{shared-Bmw43Hwf.js → shared-DyKsJTZs.js} +2 -2
  177. package/dist/ui/{shared-Bmw43Hwf.js.map → shared-DyKsJTZs.js.map} +1 -1
  178. package/dist/ui/{shared-BLG88Pya.js → shared-FO7vfI3F.js} +4 -4
  179. package/dist/ui/{shared-BLG88Pya.js.map → shared-FO7vfI3F.js.map} +1 -1
  180. package/dist/ui/{shared-DLSd80D1.js → shared-HalAVHjv.js} +3 -3
  181. package/dist/ui/{shared-DLSd80D1.js.map → shared-HalAVHjv.js.map} +1 -1
  182. package/dist/ui/{shared-D1mMBLdj.js → shared-JvcI-LWp.js} +15 -15
  183. package/dist/ui/{shared-D1mMBLdj.js.map → shared-JvcI-LWp.js.map} +1 -1
  184. package/dist/ui/{shared-C6Hv_4O0.js → shared-K7Ym27yg.js} +2 -2
  185. package/dist/ui/{shared-C6Hv_4O0.js.map → shared-K7Ym27yg.js.map} +1 -1
  186. package/dist/ui/{shared-B39ln7oi.js → shared-SzlnwfJO.js} +3 -3
  187. package/dist/ui/{shared-B39ln7oi.js.map → shared-SzlnwfJO.js.map} +1 -1
  188. package/dist/ui/{shared-DgPn_Jll.js → shared-TrGbd1FY.js} +3 -3
  189. package/dist/ui/{shared-DgPn_Jll.js.map → shared-TrGbd1FY.js.map} +1 -1
  190. package/dist/ui/{shared-DrFb-XtA.js → shared-WhbuObEW.js} +2 -2
  191. package/dist/ui/{shared-DrFb-XtA.js.map → shared-WhbuObEW.js.map} +1 -1
  192. package/dist/ui/{shared-DiFQljcq.js → shared-XcSKDp6N.js} +11 -11
  193. package/dist/ui/{shared-DiFQljcq.js.map → shared-XcSKDp6N.js.map} +1 -1
  194. package/dist/ui/{shared-CMAg58rY.js → shared-Z4uBJU6I.js} +7 -6
  195. package/dist/ui/shared-Z4uBJU6I.js.map +1 -0
  196. package/dist/ui/{shared-BnUptuUp.js → shared-bAgeiRa5.js} +2 -2
  197. package/dist/ui/{shared-BnUptuUp.js.map → shared-bAgeiRa5.js.map} +1 -1
  198. package/dist/ui/{shared-BxMvSjey.js → shared-cgXG7OgZ.js} +5 -5
  199. package/dist/ui/{shared-BxMvSjey.js.map → shared-cgXG7OgZ.js.map} +1 -1
  200. package/dist/ui/{shared-u4CG2kQJ.js → shared-eZ0SB_zm.js} +2 -2
  201. package/dist/ui/{shared-u4CG2kQJ.js.map → shared-eZ0SB_zm.js.map} +1 -1
  202. package/dist/ui/{shared-L90bWW8e.js → shared-frKFb79C.js} +2 -2
  203. package/dist/ui/{shared-L90bWW8e.js.map → shared-frKFb79C.js.map} +1 -1
  204. package/dist/ui/{shared-Dd34nhkw.js → shared-hAayNSRA.js} +3 -3
  205. package/dist/ui/{shared-Dd34nhkw.js.map → shared-hAayNSRA.js.map} +1 -1
  206. package/dist/ui/{shared-DzC64cpp.js → shared-j_J16p2B.js} +2 -2
  207. package/dist/ui/{shared-DzC64cpp.js.map → shared-j_J16p2B.js.map} +1 -1
  208. package/dist/ui/{shared-DX7HRIV-.js → shared-tqpl5N3g.js} +6 -6
  209. package/dist/ui/{shared-DX7HRIV-.js.map → shared-tqpl5N3g.js.map} +1 -1
  210. package/dist/ui/{shared-BS5dBMpA.js → shared-y-6_ZDts.js} +2 -2
  211. package/dist/ui/{shared-BS5dBMpA.js.map → shared-y-6_ZDts.js.map} +1 -1
  212. package/dist/ui/{shared-Cv5v_MP1.js → shared-zG6e1Rhz.js} +13 -13
  213. package/dist/ui/{shared-Cv5v_MP1.js.map → shared-zG6e1Rhz.js.map} +1 -1
  214. package/dist/ui/testing.js +1 -1
  215. package/package.json +4 -4
  216. package/dist/docs/cli-browser.md +0 -232
  217. package/dist/docs/database-browser.md +0 -115
  218. package/dist/docs/keyboard.md +0 -63
  219. package/dist/docs/mcp.md +0 -86
  220. package/dist/ui/shared-Bl_nF_IH.js.map +0 -1
  221. package/dist/ui/shared-CMAg58rY.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shared-Cxu1c35l.js","names":["request","resourceOf","say","say","say","say","_Fragment","say","recordKey","callApi","checkedRecordKey","say","resourceOf","_Fragment","say","sayCopy","_Fragment","say","resourceOf","say","_Fragment","say","_Fragment","say","say","say","api","recordKey","coreApi","checkedKey","_Fragment","_Fragment","resourceOf","_Fragment"],"sources":["../../../kit/src/client/components/pageContext.ts","../../../kit/src/client/copy/record/components/PageSectionBox.ts","../../../kit/src/client/components/PageSectionBox.tsx","../../../kit/src/client/recordSource.ts","../../../kit/src/client/components/pageFieldsRead.ts","../../../kit/src/client/copy/record/components/WorkflowStatus.ts","../../../kit/src/client/components/WorkflowStatus.tsx","../../../kit/src/client/components/PageHeadline.tsx","../../../kit/src/client/copy/record/components/PageFields.ts","../../../kit/src/client/components/PageFields.tsx","../../../kit/src/client/copy/dashboards/components/PageMetrics.ts","../../../kit/src/client/components/PageMetrics.tsx","../../../kit/src/client/copy/record/components/PageTimeline.ts","../../../kit/src/client/components/PageTimeline.tsx","../../../kit/src/client/prefs.js","../../../engine/src/shared/fileBounds.ts","../../../kit/src/client/copy/record/components/PageCurrent.ts","../../../kit/src/client/components/PageCurrent.tsx","../../../kit/src/client/delete.js","../../../kit/src/client/copy/record/components/PageRelated.ts","../../../kit/src/client/components/PageRelated.tsx","../../../kit/src/client/copy/record/components/PageEmptyRun.ts","../../../kit/src/client/components/PageEmptyRun.tsx","../../../kit/src/client/components/PageSections.tsx"],"sourcesContent":["/**\n * What every part of a page reads from the page around it: whether it is an\n * authoring preview, whose connection its reads go through, whether it is\n * still the current surface, and how a related New form opens inside a host.\n * Also the props one section is drawn from, and how a page says a name.\n *\n * Kept apart from Page.tsx so the head, the layout and each section can read\n * it without importing the page that draws them.\n */\nimport { createContext, useContext, type ComponentType, type ReactNode } from 'react';\nimport { ownedBy } from '../requestIdentity.js';\nimport { api as request, findTable, labelPath, recordLabel, state } from '../core.js';\nimport type { AppAction } from '@mistriwork/engine/schema/model.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { shell } from '../shellMode.js';\nimport { resourceOf } from './appRooms.js';\nimport type { DatabaseSchema, TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { RecordReadNames } from '@mistriwork/engine/shared/recordReads.js';\nimport type { FormCuration, InsertResult } from './NewRecord.js';\nimport type { PageDef, PageEntry, PageSection, SectionPlan } from './pageModel.js';\n\n/* App mode reads pages in the app's words — derived human labels, real\n names kept in tooltips. The workbench reads them raw. */\nexport const spoken = (name: string) => (shell().inApp() ? humanName(name) : name);\n/** Whether the page is an App's, for a section's words; through this module, so a section needs no edge of its own to appnav. */\nexport const inAppPage = () => shell().inApp();\nexport type RelatedCreator = (table: TableMeta, form: FormCuration, onAdded: (result: InsertResult) => void) => void;\n/** The record's own verbs, as the head's bar has them: fixed edits and separately granted business commands. */\nexport interface RecordActions {\n list: AppAction[];\n matches: (when: string) => Promise<boolean>;\n queryScope?: number;\n canUpdate?: boolean;\n grantedCommands?: string[];\n /** Fixed actions a role of this reader runs here without write, by label. */\n grantedActions?: readonly string[];\n}\n/**\n * The record's verbs as a bar draws them (Actions.tsx, the App's): the props\n * the kit's record page, its related lists and a row's menu hand the bar the\n * shell installs (shellMode.ts `slots`).\n */\nexport interface ActionBarProps {\n tableId: string;\n actions: AppAction[];\n /** The record's key, as the API names it. */\n recordKey: Record<string, unknown>;\n /** What the record is called, for the confirmation. */\n label: string;\n /** Whether the record satisfies a condition in the query language. */\n matches: (when: string) => Promise<boolean>;\n /** Isolate visibility reads from retired route/modal owners, including the\n * same record reopened before an old invalidation request settles. */\n queryScope?: number;\n /** After a write: the page repaints so the record reads as it now is. */\n onDone: () => void;\n canUpdate?: boolean;\n /** Server-projected supported grants, never authored access policy. */\n grantedCommands?: string[];\n /** Fixed actions a role of this reader runs here without write, by label (the server's answer). */\n grantedActions?: readonly string[];\n /** Additional captured surface lifetime, stable through refresh/lease renewal. */\n isCurrent?: () => boolean;\n /** On a phone: one button, the rest in More, instead of wrapping. */\n compact?: boolean;\n /** A record header's reading of which verbs take something away: drawn after the rest, and quiet where\n they stand as buttons, so the filled first button is always the forward one. */\n destructive?: (action: AppAction) => boolean;\n /** A record header's `primary`: the label of the verb drawn filled and first, where it is shown now (actionOrder.ts). */\n primary?: string;\n /** A record header's `actions`: the verbs it draws as buttons, by id and in this order; every other verb is in More. */\n only?: readonly string[];\n /** Items drawn last in More, after the record's own verbs: Delete. Their presence alone gives the bar a More menu. */\n menuTail?: ReactNode;\n /** A row's own menu: every shown verb an item of one ⋯ menu the caller opens, no buttons. */\n menuOnly?: { label: string; open: boolean; onOpenChange: (open: boolean) => void };\n /** Every verb a quiet button, none filled: a related list's head, where the record's forward verb is not. */\n quiet?: boolean;\n}\n/** `onGone`: a section found the record itself missing, so the page says so once (Page.tsx). */\n/* `recordName` is the page record's name as its title says it: a list of its\n children leaves it out of theirs (PageRelated.tsx). */\n/**\n * What a host draws at a record's own field: in the empty mark's place when the field is empty, trailing the value on\n * the same line when it is not. Props only: the page knows nothing of what it is (an App's decision, mistri's), and\n * draws the empty mark itself when the host returns nothing.\n */\nexport type FieldAdornment = (\n field: Readonly<{ table: string; column: string; key: Readonly<Record<string, unknown>>; filled: boolean }>,\n) => ReactNode;\n\nexport const PageRenderContext = createContext<{\n /** The host's field adornment (Page.tsx's `host.adorn`). */\n adorn?: FieldAdornment;\n /** The columns the host is still asking about. A field keeps its empty mark meanwhile, so it moves nothing; a header\n leaves an empty fact out altogether, so while one of these is an empty fact its facts' line waits rather than\n grow when the answer comes. Only these: a line that could never grow is never held. */\n adornHeld?: readonly string[];\n preview?: boolean;\n connection?: string;\n isCurrent?: () => boolean;\n openRelated?: RelatedCreator;\n actions?: RecordActions;\n onGone?: () => void;\n recordName?: string;\n /** A verb ran from a row of one of the page's lists: the record and its lists are read again. */\n onActionDone?: () => void;\n}>({});\nexport function usePageApi() {\n const { connection } = useContext(PageRenderContext);\n const scoped: typeof request = (path, ...args) => {\n // Add only routing identity; preserve the selected route/body tuple. No\n // operation fields are changed and no endpoint falls back to an untyped API.\n const owned = connection && args[0] ? ([{ ...args[0], ...ownedBy(connection) }] as typeof args) : args;\n return request(path, ...owned);\n };\n return scoped;\n}\n\n/**\n * What the page hands a custom section beside a section's own props: its\n * request, whether it is a preview, and how every section says loading and a\n * failed read. Handed, not imported — the page's modules import each other in\n * a circle this chunk stays out of (test/repo/runtime-cycles). The App's\n * component draws it (sdk/CustomSection.tsx), reached through the shell's slot.\n */\nexport interface CustomSectionFrame {\n pageApi: ReturnType<typeof usePageApi>;\n preview?: boolean;\n Loading: ComponentType<{ section: SlotProps['section'] }>;\n SectionBox: ComponentType<{ section: SlotProps['section']; body: ReactNode; foldable: boolean; broken?: string; hidden?: boolean }>;\n}\n\nexport interface SlotProps {\n page: PageDef;\n section: PageSection;\n index: number;\n plan: SectionPlan;\n base: TableMeta;\n recordKey: Record<string, unknown>;\n foldable: boolean;\n entry: PageEntry;\n onLabel?: (label: string) => void;\n onSectionLabel?: (index: number, label: string | undefined) => void;\n onEdit: (opts?: { inPlace?: boolean }) => void;\n /** The fields section that says the record's name in the head. */\n titleOwner?: number;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n /** An empty related list said in one line with its neighbours: it draws its Add alone (PageEmptyRun.tsx). */\n collapsed?: boolean;\n}\n\n/**\n * How this reader's rows are named, as a record page's reads are built from\n * it (shared/recordReads.ts): the schema it was served, whether it reads in\n * an App's words, and each table's record name as its App says it. The\n * server builds the same requests from the same three (recordCompose.ts).\n */\nexport function recordReadNames(): RecordReadNames {\n return {\n schema: state.schema as unknown as DatabaseSchema,\n app: Boolean(shell().inApp()),\n recordLabel: (tableId: string) => recordLabel({ id: tableId } as TableMeta) as string | false | undefined,\n namePath: (table: TableMeta) => labelPath(table) as string | undefined,\n table: (id: string) => findTable(id) as TableMeta | undefined,\n defined: (id: string) => resourceOf(shell().app(), id)?.defined,\n };\n}\n","/** What PageSectionBox 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 {\n history: 'History',\n flows: 'Flows',\n diagram: 'Steps',\n thisSection: 'This section',\n },\n /* An untitled history() says its title in the reader's language; Spanish is the shell's second one. */\n { es: { history: 'Historial', flows: 'Flujos', diagram: 'Pasos', thisSection: 'Esta sección' } },\n);\n","/**\n * A page section's box, whatever is in it: its heading, a fold when it is a\n * later group of fields, the placeholder while its data is on the way, and the note that names a section that\n * could not run. Every section kind draws through this, so they all head,\n * fold and break the same way.\n *\n * A section's heading is an h2: the record's name in the head is the room's\n * one h1, and what a section holds (a card's title) is the h3 under it. The\n * size is the class's, not the tag's, so the level can say the outline.\n */\nimport { useContext, useEffect, useRef, type ReactNode } from 'react';\nimport { disclosure, findTable } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { GridSkeleton } from './Skeleton.js';\nimport { sectionClass, type PageSection } from './pageModel.js';\nimport { PageRenderContext, spoken } from './pageContext.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { Problem } from './Notes.js';\nimport { useListNavigation } from './listNavigation.js';\nimport { say } from '../copy/record/components/PageSectionBox.js';\n\n/* A suggested page titles a related list by its table's name (`visit_attachment`), which an App says as words, as\n every untitled list's head already is. An authored title has words or capitals of its own and is left as written. */\nconst titled = (title: string) => (/^[a-z][a-z0-9_.]*$/.test(title) ? spoken(title) : title);\n\n/** A section's box: its heading, or a fold when it is a later group of fields. */\nexport function SectionBox({\n section,\n body,\n foldable,\n broken,\n crashed,\n hidden,\n tools,\n}: {\n section: PageSection;\n body: ReactNode;\n /** What the section offers beside its heading — a related list's Add and verbs — drawn in the heading's row. */\n tools?: ReactNode;\n foldable: boolean;\n broken?: string;\n /** Kept drawn but taking no place: a custom section whose component draws nothing. */\n hidden?: boolean;\n /** A boundary's note, for a section that threw while drawing: said under its heading like a failed read. */\n crashed?: ReactNode;\n}) {\n useMessageLanguage();\n const { preview } = useContext(PageRenderContext);\n const content = preview ? (\n <div style={{ display: 'contents' }} inert>\n {body}\n </div>\n ) : (\n body\n );\n const heading =\n (section.title === undefined ? undefined : titled(section.title)) ??\n (section.kind === 'history'\n ? say('history')\n : section.kind === 'flows'\n ? say('flows')\n : section.kind === 'diagram'\n ? say('diagram')\n : undefined) ??\n spoken(section.kind === 'fields' ? '' : ((findTable(section.from ?? '') as TableMeta | undefined)?.name ?? section.from ?? ''));\n const details = useRef<HTMLDetailsElement>(null);\n const bound = useRef(false);\n // The shell's navigation: viewLink would be an import back into the walk that draws this page.\n const navigate = useListNavigation();\n useEffect(() => {\n if (details.current && !bound.current) {\n bound.current = true;\n disclosure(details.current, { dismissible: false });\n }\n });\n if (broken !== undefined || crashed !== undefined) {\n return (\n <section className={`${sectionClass(section)} page-broken`}>\n <h2 className=\"page-section-head\">{heading || say('thisSection')}</h2>\n {crashed ?? <Problem text={broken ?? ''} />}\n </section>\n );\n }\n if (foldable && heading) {\n return (\n <section className={sectionClass(section)}>\n <details className=\"page-fold\" ref={details} open>\n <summary className=\"page-section-head page-fold-head\">\n <span>{heading}</span>\n </summary>\n {content}\n </details>\n </section>\n );\n }\n /* A gallery is a picture: its title names it for assistive technology,\n and a \"Photos\" heading over the photos says nothing a sighted reader\n needs. It leads the page without a rule above it. */\n const gallery = section.kind === 'list' && section.presentation === 'gallery';\n /* An embedded list view's heading is the way to the whole of it: the view's own room, where the reader has it. */\n const room = section.view && !preview ? navigate?.(section.view) : undefined;\n const headed = heading && (\n <h2 className={gallery ? 'page-section-head visually-hidden' : 'page-section-head'}>\n {room ? (\n <a className=\"page-section-link\" {...room}>\n {heading}\n </a>\n ) : (\n heading\n )}\n </h2>\n );\n return (\n <section className={`${sectionClass(section)}${gallery ? ' page-gallery' : ''}`} hidden={hidden || undefined}>\n {tools ? (\n <div className=\"page-section-bar\">\n {headed}\n {tools}\n </div>\n ) : (\n headed\n )}\n {content}\n </section>\n );\n}\n\nexport function Loading({ section }: { section: PageSection }) {\n return (\n <section className={`${sectionClass(section)} loading`}>\n {section.title && <h2 className=\"page-section-head\">{titled(section.title)}</h2>}\n {section.kind === 'list' ? <GridSkeleton columns={4} rows={3} /> : <div className=\"sk-bar\" />}\n </section>\n );\n}\n","import { replaceEqualDeep } from '@tanstack/react-query';\n\nlet epoch = 0;\n\n/** Advance before Undo reconciliation so equal rows become fresh editor sources. */\nexport function advanceRecordSource(): void {\n epoch += 1;\n}\n\nexport async function readRecordSource<T extends object>(read: () => Promise<T>): Promise<T & { recordSourceEpoch: number }> {\n // A response arriving after reconciliation still belongs to its starting epoch.\n const recordSourceEpoch = epoch;\n return { ...(await read()), recordSourceEpoch };\n}\n\nconst epochOf = (value: unknown): unknown =>\n value !== null && typeof value === 'object' ? (value as { recordSourceEpoch?: unknown }).recordSourceEpoch : undefined;\n\nexport function shareRecordSource(old: unknown, next: unknown): unknown {\n return epochOf(old) !== epochOf(next) ? next : replaceEqualDeep(old, next);\n}\n","/**\n * A page's fields sections read their record together.\n *\n * Each fields section names its own columns, and each used to read the root\n * row for them alone: a record page with a headline, contact details, an\n * address and two more groups sent five reads of one row, each paying a\n * tenant request's whole admission and fences, all in the same moment. The\n * sections that ask in the same tick for the same record through the same\n * connection now share one read of every column any of them named, and each\n * is handed exactly the part it asked for — its columns, its resolved\n * descriptions, its row — so a section cannot tell the difference.\n *\n * Nothing is kept: the batch is the callers of one tick, never a cache, so a\n * refetch after an edit reads the row again (together, when the sections\n * refetch together). A shared read that fails, or answers with the language's\n * errors, is asked again a section at a time: one section naming a column this\n * reader may not see must break that section only, as it did alone.\n */\nimport type { HttpFilter } from '@mistriwork/engine/shared/resourceHttp.js';\n/* Exactly what a section would have been answered alone: the rule a composed page's row answers by too. */\nimport { rowPart } from '@mistriwork/engine/shared/recordReadKeys.js';\n\ninterface ViewReply {\n view: { columns: Array<{ path: string }> } & Record<string, unknown>;\n columns: string[];\n rows: Array<Record<string, unknown>>;\n resolved?: Array<{ path: string; name?: string }>;\n}\ntype Reply = ViewReply | { errors: Array<{ message: string }> };\n/** What a section's read is: the same request it would have sent alone. */\ninterface FieldsRead {\n /** Where the read goes: the page's connection, and the owner scope it asks under. */\n readonly owner: string;\n readonly pageId: string;\n readonly base: { id: string; name: string };\n readonly filter: HttpFilter<'path'>;\n readonly columns: readonly string[];\n}\n/** The one request a batch sends: a view of the root row. */\ninterface FieldsBody {\n count: 'none';\n view: { id: string; name: string; base: string; columns: Array<{ path: string }>; filter: HttpFilter<'path'>; limit: 1 };\n}\ntype Send = (body: FieldsBody) => Promise<Reply>;\ninterface Waiting {\n read: FieldsRead;\n send: Send;\n resolve: (reply: Reply) => void;\n reject: (error: unknown) => void;\n}\n\nlet waiting: Waiting[] = [];\n\nconst bodyFor = (read: FieldsRead, columns: readonly string[]): FieldsBody => ({\n count: 'none',\n view: {\n id: `page:${read.pageId}:fields`,\n name: read.base.name,\n base: read.base.id,\n columns: columns.map((path) => ({ path })),\n filter: read.filter,\n limit: 1,\n },\n});\n\n/** One section's read, answered with the others of this tick where they read the same row. */\nexport function readPageFields(read: FieldsRead, send: Send): Promise<Reply> {\n return new Promise<Reply>((resolve, reject) => {\n if (!waiting.length) queueMicrotask(flush);\n waiting.push({ read, send, resolve, reject });\n });\n}\n\nconst alone = (item: Waiting) => item.send(bodyFor(item.read, item.read.columns)).then(item.resolve, item.reject);\n\nfunction flush() {\n const batch = waiting;\n waiting = [];\n const groups = new Map<string, Waiting[]>();\n for (const item of batch) {\n const key = JSON.stringify([item.read.owner, item.read.pageId, item.read.base.id, item.read.filter]);\n const group = groups.get(key);\n if (group) group.push(item);\n else groups.set(key, [item]);\n }\n for (const group of groups.values()) {\n if (group.length === 1) {\n void alone(group[0]);\n continue;\n }\n const columns = [...new Set(group.flatMap((item) => item.read.columns))];\n void group[0]\n .send(bodyFor(group[0].read, columns))\n .then((reply) => {\n if (!reply || typeof reply !== 'object' || !('view' in reply) || !Array.isArray(reply.rows)) throw new Error('unshared');\n for (const item of group) item.resolve(rowPart(reply, item.read.columns));\n })\n .catch(() => {\n for (const item of group) void alone(item);\n });\n }\n}\n","/** What WorkflowStatus 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 workflowStatus: 'Workflow status',\n passed: '(passed)',\n availableFromHere: '(available from here)',\n currentState: 'Current state:',\n notSet: 'Not set',\n});\n","/**\n * The workflow strip: where a record stands in its status vocabulary. Only\n * the current state is known. Where the author says the steps are an order\n * (`ordered`), the steps before it are drawn as passed — the order written\n * down, not a history of the record — and a state outside the steps passes\n * none. A step one of the record's own edits can move it to now is marked\n * as reachable; the strip still moves nothing, the record's actions do.\n *\n * An ordered strip reads as a way travelled: a passed step's mark is filled\n * in the ink, the current one in the accent, the steps ahead hollow, and a\n * hairline joins each step to the next — in the ink where it has been walked.\n */\nimport { useLayoutEffect, useRef } from 'react';\nimport { workflowLabel, type ResolvedWorkflowStatus as WorkflowDefinition } from '@mistriwork/engine/shared/pageModel.js';\nimport { say } from '../copy/record/components/WorkflowStatus.js';\n\nexport function WorkflowStatus({\n definition,\n value,\n reachable,\n}: {\n definition: WorkflowDefinition;\n value: unknown;\n reachable?: ReadonlySet<string>;\n}) {\n const current = definition.steps.findIndex((step) => step.value === value);\n const known = current !== -1;\n /* On a narrow screen the strip is one line that scrolls sideways (page.css); the current step is brought into\n view by moving the strip alone, never the page, so a record opened at \"Negotiation\" shows Negotiation. */\n const strip = useRef<HTMLOListElement>(null);\n useLayoutEffect(() => {\n const ol = strip.current;\n const step = ol?.querySelector<HTMLElement>('[aria-current=\"step\"]');\n if (!ol || !step || ol.scrollWidth <= ol.clientWidth) return;\n /* The strip starts at the step before the current one, whole, so the way in reads \"Proposal — Negotiation\"\n rather than from the middle of a word. */\n const from = (step.previousElementSibling as HTMLElement | null) ?? step;\n ol.scrollLeft = Math.max(0, from.offsetLeft - ol.offsetLeft);\n edges(ol);\n }, [current]);\n return (\n <div className=\"workflow-status\">\n <ol\n ref={strip}\n onScroll={(event) => edges(event.currentTarget)}\n aria-label={say('workflowStatus')}\n className=\"workflow-steps\"\n data-scrolls=\"\"\n data-ordered={definition.ordered === true || undefined}\n >\n {definition.steps.map((step, index) => {\n const passed = definition.ordered === true && known && index < current;\n const next = index !== current && reachable?.has(String(step.value)) === true;\n return (\n <li\n key={step.value}\n aria-current={index === current ? 'step' : undefined}\n data-passed={passed || undefined}\n data-reachable={next || undefined}\n >\n <span className=\"workflow-marker\" aria-hidden=\"true\" />\n {step.label}\n {passed && <span className=\"visually-hidden\"> {say('passed')}</span>}\n {next && <span className=\"visually-hidden\"> {say('availableFromHere')}</span>}\n </li>\n );\n })}\n </ol>\n {!known && (\n <p className=\"workflow-unmapped\" role=\"status\">\n {say('currentState')} {value === null || value === undefined || value === '' ? say('notSet') : workflowLabel(String(value))}\n </p>\n )}\n </div>\n );\n}\n\n/* Which ends of a scrolling strip have more beyond them, for its fade (page.css). */\nfunction edges(ol: HTMLOListElement) {\n ol.toggleAttribute('data-more-before', ol.scrollLeft > 1);\n ol.toggleAttribute('data-more-after', ol.scrollLeft + ol.clientWidth < ol.scrollWidth - 1);\n}\n","/**\n * A record's headline, for a page that offers the record to someone: the\n * first field as the figure — a price, in its display rule — the rest as a\n * row of facts under their captions, and one or two calls to action that\n * open one of the App's views (the inquiry form, say). It sits under the\n * record's name, so what a reader decides on is above the fold.\n *\n * The figure's earlier value (`was`) is struck through beside it while it\n * stands above the figure — a reduced price — and is not drawn otherwise. A\n * fact with no value is left out, never said as \"Caption —\".\n *\n * A second, smaller figure (`subfigure`) may follow the first — an estimate,\n * a unit price — and a line of small print (`note`) says what the figures\n * assume. A call to action that opens a public form may start the form\n * filled: from this record's fields (`prefill`, so the visitor never copies\n * a reference by hand) and with the author's words (`defaults`). They are\n * where the form starts, carried in its address, never what it sends.\n *\n * A list or dashboard is found among the rooms the App serves this reader;\n * a public form is asked of the public forms route once, only when an\n * action names something no room is. An action that names neither is not\n * drawn: a button to nowhere is worse than none.\n *\n * A public form is the App's front door for someone with no account: it\n * runs under a public principal and writes what a visitor may. A signed-in\n * reader works the App's own rooms (the staff who read a listing take a\n * viewing in the Viewings list), so the form is not offered to them as the\n * way to reach out about a record they already hold.\n */\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { useQuery } from '@tanstack/react-query';\nimport { api, columnLabel, state } from '../core.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport type { ColumnMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { PageHeadlineAction } from '@mistriwork/engine/shared/pageModel.js';\nimport { Value } from './Value.js';\nimport { formLink, viewLink, type ViewLink } from './viewLink.js';\nimport { useState } from 'react';\nimport { shell } from '../shellMode.js';\nimport { sessionIdentity } from '../sessionIdentity.js';\n\ninterface PageHeadlineProps {\n tableId: string;\n row: Record<string, unknown>;\n /** The figure first, then the facts. */\n paths: readonly string[];\n column: (path: string) => ColumnMeta | undefined;\n actions: ReadonlyArray<PageHeadlineAction>;\n /** A second figure under the first. */\n subfigure?: string;\n /** The figure's earlier value, struck through beside it when it is set and higher. */\n was?: string;\n /** Small print under the actions. */\n note?: string;\n}\n\n/** A public form's address with the inputs the action fills: the record's own values, then the author's words. */\nexport function prefilledFormLink(link: ViewLink, action: PageHeadlineAction, row: Record<string, unknown>): ViewLink {\n const params = new URLSearchParams();\n for (const [input, path] of Object.entries(action.prefill ?? {})) {\n const value = row[path];\n if (value !== null && value !== undefined && String(value) !== '') params.set(input, String(value));\n }\n for (const [input, text] of Object.entries(action.defaults ?? {})) params.set(input, text);\n const query = params.toString();\n return query ? { ...link, href: `${link.href}?${query}` } : link;\n}\n\n/** A value the headline has: not null, not missing, not blank. */\nconst hasValue = (value: unknown) => value !== null && value !== undefined && String(value).trim() !== '';\n\n/** The earlier value is said only where it is a figure above the one in hand: a reduction, never a rise or a repeat. */\nexport function wasShown(row: Record<string, unknown>, figure: string | undefined, was: string | undefined): boolean {\n if (!figure || !was || !hasValue(row[was]) || !hasValue(row[figure])) return false;\n const [then, now] = [Number(row[was]), Number(row[figure])];\n return Number.isFinite(then) && Number.isFinite(now) && then > now;\n}\n\nexport function PageHeadline({ tableId, row, paths, column, actions, subfigure, was, note }: PageHeadlineProps) {\n useMessageLanguage();\n const caption = (path: string) => (columnLabel(tableId, path) as string | null) ?? humanName(path.split('.').pop() ?? path);\n const [figure, ...facts] = paths;\n /* A call to action into another App of the suite, and a public form over the record, are the App framework's:\n the shell's to draw (shellMode.ts), and not drawn where it has none. */\n const { TargetAction, FormDialog } = shell().slots;\n const rooms = actions.map((action) => ('view' in action ? viewLink(action.view) : undefined));\n const signedIn = sessionIdentity().mode === 'authenticated';\n const forms = useQuery({\n queryKey: ['public-forms', state.activeConnection ?? ''],\n enabled: !signedIn && actions.some((action, index) => 'view' in action && !rooms[index]),\n staleTime: Infinity,\n queryFn: async () => new Set(((await api('/api/forms')) as { forms?: Array<{ id: string }> }).forms?.map((form) => form.id) ?? []),\n });\n const links = actions.map((action, index) => {\n if ('to' in action) return { action, kind: action.intent ?? (index === 0 ? 'primary' : 'secondary') };\n const form =\n !signedIn && !rooms[index] && forms.data?.has(action.view) ? prefilledFormLink(formLink(action.view), action, row) : undefined;\n const link = rooms[index] ?? form;\n /* `open: 'modal'` draws the form over this record instead of leaving for\n its page: a public form, or a signed-in form this reader is served (its room's address still opens it on its\n own). A list or a dashboard is only ever a room. */\n const asked = form ?? (rooms[index] && action.open === 'modal' ? prefilledFormLink(rooms[index]!, action, row) : undefined);\n const dialog =\n action.open === 'modal' && asked && FormDialog ? { view: action.view, prefill: asked.href.split('?')[1] ?? '' } : undefined;\n return link ? { label: action.label, link, dialog, kind: action.intent ?? (index === 0 ? 'primary' : 'secondary') } : null;\n });\n const [asking, setAsking] = useState<{ view: string; prefill: string } | null>(null);\n const second = subfigure !== undefined && hasValue(row[subfigure]);\n const earlier = wasShown(row, figure, was);\n const shownFacts = facts.filter((path) => hasValue(row[path]));\n return (\n <div className=\"page-headline\">\n {figure !== undefined && (\n <p className=\"page-headline-figure\">\n <span className=\"visually-hidden\">{caption(figure)}: </span>\n <Value col={column(figure)} value={row[figure]} tableId={tableId} compact row={row} />\n {earlier && (\n <>\n {' '}\n <s className=\"page-headline-was\">\n <span className=\"visually-hidden\">{caption(was!)}: </span>\n <Value col={column(was!)} value={row[was!]} tableId={tableId} compact />\n </s>\n </>\n )}\n </p>\n )}\n {second && (\n <p className=\"page-headline-sub\">\n <span className=\"page-headline-sub-caption\">{caption(subfigure!)}</span>{' '}\n <Value col={column(subfigure!)} value={row[subfigure!]} tableId={tableId} compact />\n </p>\n )}\n {links.some(Boolean) && (\n <div className=\"page-headline-actions\">\n {links.map((entry, index) =>\n !entry ? null : 'action' in entry && entry.action ? (\n TargetAction && (\n <TargetAction\n key={index}\n label={entry.action.label}\n to={entry.action.to}\n row={row}\n className={`page-headline-action is-${entry.kind}`}\n />\n )\n ) : (\n /* Still a link: its address is the form's own page, so a new tab,\n a middle click or a copied link all still work. A plain click\n opens the dialog instead. */\n <a\n key={index}\n className={`page-headline-action is-${entry.kind}`}\n href={entry.link!.href}\n onClick={\n entry.dialog\n ? (event) => {\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) return;\n event.preventDefault();\n setAsking(entry.dialog!);\n }\n : entry.link!.onClick\n }\n >\n {entry.label}\n </a>\n ),\n )}\n </div>\n )}\n {shownFacts.length > 0 && (\n <dl className=\"page-headline-facts\">\n {shownFacts.map((path) => (\n <div key={path}>\n <dt>{caption(path)}</dt>\n <dd>\n <Value col={column(path)} value={row[path]} tableId={tableId} compact />\n </dd>\n </div>\n ))}\n </dl>\n )}\n {note && <p className=\"page-headline-note\">{note}</p>}\n {asking && FormDialog && <FormDialog view={asking.view} prefill={asking.prefill} onClose={() => setAsking(null)} />}\n </div>\n );\n}\n","/** What PageFields 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 theseFieldsCouldNotBeRead: 'These fields could not be read.',\n noneYet: 'No {caption} yet',\n nothingHereEveryField: 'Nothing here: every field in this group is empty.',\n});\n","/**\n * A page's fields section: the root record's own values, read as one row\n * and drawn in the dress the section asks for — a headline, a facts line, a\n * sheet, or the field grid, editable where the record may be changed. It\n * also names the record for the head and, in an App, hands the head the\n * editor for the record's name.\n */\nimport { shell } from '../shellMode.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { useContext, useEffect, type CSSProperties, type ReactNode } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { readRecordSource, shareRecordSource } from '../recordSource.js';\nimport { readPageFields } from './pageFieldsRead.js';\nimport { dressFor, sayValue, type DisplayRule } from './valueModel.js';\nimport { pathEqualityFilter, recordKey as checkedRecordKey } from '../resourceRequests.js';\nimport { columnDisplay, columnLabel, emptyWord, findTable, labelPath, primaryKey, rowLabel, state } from '../core.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { resourceOf } from './appRooms.js';\nimport { recordNoun } from '@mistriwork/engine/shared/appNoun.js';\nimport { canEditRow } from '../write.js';\nimport { cardStem, sharedPrefix } from '@mistriwork/engine/shared/pagePaths.js';\nimport type { ColumnMeta } from '@mistriwork/engine/shared/schema.js';\nimport { Editable } from './Editable.js';\nimport { RefJump, Value } from './Value.js';\nimport { defaultFieldPaths, definedThrough, fieldsColumns } from '@mistriwork/engine/shared/recordReads.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { WorkflowStatus } from './WorkflowStatus.js';\nimport { api as callApi, toast } from '../core.js';\nimport { ownedBy } from '../requestIdentity.js';\nimport type { AppUpdateAction } from '@mistriwork/engine/schema/model.js';\nimport { PageHeadline } from './PageHeadline.js';\nimport { PageRenderContext, recordReadNames, usePageApi, type RecordActions, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { sectionClass } from './pageModel.js';\nimport { say } from '../copy/record/components/PageFields.js';\nimport { onDemand } from './onDemand.js';\n\nconst DefinedFields = onDemand(() => import('./DefinedFields.js'), 'DefinedFields', { quiet: true });\n\n/** A property the reader cannot write but an action of theirs moves: the values it can reach, as a picker. The action is the\n ordinary one — the server judges it again — so a refusal is said as the action's own would be. */\nfunction ActionPick({\n tableId,\n recordKey,\n column,\n value,\n actions,\n caption,\n onDone,\n connection,\n}: {\n tableId: string;\n recordKey: Record<string, unknown>;\n column: string;\n value: unknown;\n actions: RecordActions;\n caption: string;\n onDone?: () => void;\n connection?: string;\n}) {\n const reachable = shell().slots.useReachable(tableId, recordKey, column, actions);\n const moves = actions.list.filter(\n (action): action is AppUpdateAction =>\n !action.command &&\n Object.keys((action as AppUpdateAction).set).length === 1 &&\n column in (action as AppUpdateAction).set &&\n !(action as AppUpdateAction).reason &&\n !(action as AppUpdateAction).confirm,\n );\n const current = value === null || value === undefined ? '' : String(value);\n const options = [\n ...new Set([current, ...[...reachable].filter((next) => moves.some((action) => String(action.set[column]) === next))]),\n ].filter(Boolean);\n if (options.length < 2) return null;\n const move = async (next: string) => {\n const action = moves.find((candidate) => String(candidate.set[column]) === next);\n if (!action?.set) return;\n try {\n await callApi('/api/update', {\n ...ownedBy(connection ?? state.activeConnection ?? ''),\n table: tableId,\n key: checkedRecordKey(recordKey),\n values: action.set!,\n });\n onDone?.();\n } catch (error) {\n toast((error as Error).message, 'error');\n }\n };\n return (\n <select className=\"page-field-pick\" aria-label={caption} value={current} onChange={(event) => void move(event.target.value)}>\n {options.map((option) => (\n <option key={option} value={option}>\n {option}\n </option>\n ))}\n </select>\n );\n}\n\n/** The root's own fields — one section among several, not a record page with extras. */\nexport function FieldsSection({\n page,\n section,\n index,\n base,\n recordKey: key,\n foldable,\n onLabel,\n onSectionLabel,\n onEdit,\n titleOwner,\n onTitleEditor,\n}: SlotProps) {\n useMessageLanguage();\n const api = usePageApi();\n const { preview, isCurrent, actions: recordActions, onGone, connection, adorn } = useContext(PageRenderContext);\n const paths = section.paths?.length ? section.paths : defaultFieldPaths(base, shell().inApp());\n const namePath = labelPath(base) as string | undefined;\n /* What it shows, its references' names, the record's name, a headline's\n second figure and the fields its actions fill a form from — built as the\n server builds it for the page's compose (shared/recordReads.ts). */\n const { fetched, labels: refLabels } = fieldsColumns(recordReadNames(), base, section);\n const data = useQuery({\n queryKey: ['page-fields', page.id, base.id, key, fetched],\n // Undo can restore the cached row; only its reconciliation read needs a\n // fresh editor source, without remounting or clearing staged drafts.\n structuralSharing: shareRecordSource,\n /* With the page's other fields sections, as one read of the row (pageFieldsRead.ts). */\n queryFn: () =>\n readRecordSource(() =>\n readPageFields(\n {\n owner: connection ?? '',\n pageId: page.id,\n base,\n filter: pathEqualityFilter(Object.fromEntries((primaryKey(base) as string[]).map((column) => [column, key[column]]))),\n columns: fetched,\n },\n (body) => api('/api/view/run', body),\n ),\n ),\n staleTime: 0,\n });\n const got = data.data && 'view' in data.data ? data.data : undefined;\n const row = got?.rows[0];\n const reachable = shell().slots.useReachable(base.id, key, section.workflow?.field, recordActions);\n useEffect(() => {\n /* The row is here, so the crumb and the pill can stop saying the key. */\n if (row) {\n const label = rowLabel(base, row);\n if (onSectionLabel) onSectionLabel(index, label);\n else onLabel?.(label);\n }\n }, [row, onSectionLabel, index]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(\n () => () => {\n onSectionLabel?.(index, undefined);\n },\n [onSectionLabel, index],\n );\n /* In an App the head says the record's name, so the section that owns it\n stops repeating the field below, and where the name may be changed, the\n head is where: the same editor and Save as any other field. */\n const named = shell().inApp() && !preview && !section.of && Boolean(namePath) && !namePath!.includes('.');\n const titled = named && titleOwner === index;\n const titleColumn = titled ? base.columns.find((c) => c.name === namePath) : undefined;\n const titleEditable = Boolean(\n titleColumn && !titleColumn.primaryKey && titleColumn.writable !== false && (canEditRow(base, key) as boolean),\n );\n useEffect(() => {\n if (!onTitleEditor) 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 onTitleEditor?.(index, undefined);\n },\n [onTitleEditor, index],\n );\n /* The record's own fields found no record: the page says that once, for\n every section, and offers nothing to do to it (Page.tsx). */\n const missing = !section.of && ((data.isError && (data.error as { status?: number }).status === 404) || (Boolean(got) && !row));\n useEffect(() => {\n if (missing) onGone?.();\n }, [missing]); // eslint-disable-line react-hooks/exhaustive-deps\n if (data.isPending) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n if (data.data && !('view' in data.data))\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={data.data.errors[0]?.message ?? say('theseFieldsCouldNotBeRead')}\n />\n );\n if (!row) return <SectionBox section={section} body={null} foldable={false} broken={say('common.thatRecordIsNoLonger')} />;\n\n const byName = new Map(base.columns.map((c) => [c.name, c]));\n const byPath = new Map((got?.resolved ?? []).map((c) => [c.path, c]));\n /* A path's column as the schema has it: the result's resolved column says\n its type but not what it references, so `employee_id.department_id`\n would otherwise read as the bare key. */\n const presented = presentationColumns(state.schema, base, paths);\n const columnAt = (path: string) =>\n (byName.get(path) ?? presented.get(path) ?? byPath.get(path)) as\n | (ColumnMeta & { references?: { table: string; column: string } })\n | undefined;\n const captionOf = (path: string) => (columnLabel(base.id, path) as string | null) ?? humanName(path.split('.').pop() ?? path);\n /* A fields section in the aside is a property rail unless it says otherwise: caption beside value is\n what a side panel holds. The main region keeps the summary grid. */\n const presentation = section.presentation ?? (section.region === 'aside' ? 'properties' : 'summary');\n const rail = presentation === 'properties';\n const filled = (path: string) => row[path] !== null && row[path] !== undefined && row[path] !== '';\n /* A value as a line of facts or a card says it: a reference is the record\n it names, by its label where the section fetched one, never its key. */\n const said = (path: string, compact?: boolean) => {\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={compact} row={row} />\n );\n };\n /* A headline is the record offered: its figure, its facts and what to do next. */\n if (section.presentation === 'headline') {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <PageHeadline\n tableId={base.id}\n row={row}\n paths={paths}\n column={columnAt}\n actions={section.actions ?? []}\n subfigure={section.subfigure}\n was={section.was}\n note={section.note}\n />\n }\n />\n );\n }\n /* A facts line: the values alone, each after a dot, in the order named.\n An empty one is left out rather than said as a dash in the middle of a\n sentence; each caption stays for assistive technology. */\n if (section.presentation === 'facts') {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <ul className=\"page-facts\" aria-label={section.title ?? say('common.keyFacts')}>\n {paths.filter(filled).map((path) => {\n /* A bare number says nothing in a line of words (\"1998 · 24\"): it keeps its caption, in sight. A figure\n that already says what it is (money, a percent, a unit) does not need one. */\n const bare =\n typeof row[path] === 'number' && !columnAt(path)?.references && !columnDisplay(base.id, columnAt(path)?.name ?? '');\n return (\n <li key={path} className=\"page-fact\">\n {bare ? (\n <span className=\"page-fact-caption\">{captionOf(path)} </span>\n ) : (\n <span className=\"visually-hidden\">{captionOf(path)}: </span>\n )}\n {said(path, true)}\n </li>\n );\n })}\n </ul>\n }\n />\n );\n }\n /* A sheet: caption beside value on one row, a hairline between rows, the\n rows in `columns` columns where the room has the width. A value the\n record does not have is a row nobody needs. */\n if (section.presentation === 'table') {\n const sheetColumns = typeof section.columns === 'number' ? section.columns : undefined;\n return (\n <SectionBox\n section={section}\n foldable={foldable}\n body={\n <dl className=\"page-sheet\" style={sheetColumns ? ({ '--page-sheet-columns': String(sheetColumns) } as CSSProperties) : undefined}>\n {paths.filter(filled).map((path) => {\n return (\n <div key={path} className=\"page-sheet-row\">\n <dt>{captionOf(path)}</dt>\n <dd>{said(path)}</dd>\n </div>\n );\n })}\n </dl>\n }\n />\n );\n }\n /* A card: the record a reference names, as one box — who sells the car,\n who owns the account. Its first field is the title; a reference there\n is the named record, opening its page, and \"View dealer\" says so again\n at the foot for a reader who scans past a name. The rest are its facts,\n captioned without the hop they share. Never folded: a card is small, and\n a chevron on it said \"optional\" about the one thing a buyer checks. */\n if (section.presentation === 'card') {\n const [titlePath, ...rest] = paths;\n const titleColumn = columnAt(titlePath);\n const reference = titleColumn?.references && filled(titlePath) ? titleColumn.references : undefined;\n const titleLabel = refLabels.get(titlePath);\n const factsStem = cardStem(paths) as string;\n // The resource's own `noun` where it says one (\"View seller\", not \"View dealer_account\").\n const noun = reference\n ? recordNoun(\n resourceOf(shell().app(), reference.table)?.noun,\n (findTable(reference.table) as { name?: string } | undefined)?.name ?? reference.table,\n )\n : '';\n const jump = (className: string, text?: string) => (\n <RefJump\n references={reference!}\n value={row[titlePath]}\n label={titleLabel ? row[titleLabel] : undefined}\n table={base}\n column={titlePath}\n row={row}\n className={className}\n text={text}\n />\n );\n return (\n <section className={`${sectionClass(section)} page-card-section page-reference-card`}>\n <div className=\"page-card\">\n {section.title && <h2 className=\"page-card-caption\">{section.title}</h2>}\n <p className=\"page-card-title\">\n {reference ? (\n jump('page-card-name')\n ) : filled(titlePath) ? (\n <Value col={titleColumn} value={row[titlePath]} tableId={base.id} />\n ) : (\n emptyWord()\n )}\n </p>\n {rest.some(filled) && (\n <dl className=\"page-card-facts\">\n {rest.filter(filled).map((path) => (\n <div key={path} className=\"page-card-fact\">\n <dt>{columnLabel(base.id, path, factsStem) ?? captionOf(path)}</dt>\n <dd>{said(path)}</dd>\n </div>\n ))}\n </dl>\n )}\n {reference && <p className=\"page-card-foot\">{jump('page-card-more', say('common.view', { noun }))}</p>}\n </div>\n </section>\n );\n }\n /* A group of fields that all follow the same reference is that record\n shown inline; its labels drop the hop they all share. */\n const stem = sharedPrefix(paths) as string;\n const shared = stem ? `${stem}.` : '';\n const own = !section.of && !stem;\n const editing = !preview && own && (canEditRow(base, key) as boolean);\n\n /* A group that follows a reference to nothing — \"Converted to\" on a lead\n that has not been — is one dash, not four labels over four dashes. */\n if (stem && shell().inApp() && paths.length && paths.every((p) => row[p] === null || row[p] === undefined)) {\n return (\n <SectionBox\n section={section}\n foldable={foldable}\n body={\n <p className=\"page-group-empty\" title={say('nothingHereEveryField')}>\n —\n </p>\n }\n />\n );\n }\n\n const bound = resourceOf(shell().app(), base.id)?.defined;\n const definedOf = (id: string) => resourceOf(shell().app(), id)?.defined;\n const fields = (named ? paths.filter((path) => path !== namePath) : paths).map((path) => {\n const value = row[path];\n const column = columnAt(path);\n /* A row-defined column is its fields, each drawn here as one of the record's own (DefinedFields.tsx). */\n if (own && bound && Object.hasOwn(bound, path))\n return (\n <DefinedFields\n key={path}\n base={base}\n row={row}\n column={path}\n binding={bound[path]}\n recordKey={key}\n editing={editing && column?.writable !== false}\n onSaved={onEdit}\n isCurrent={isCurrent}\n connection={connection}\n />\n );\n /* And through a reference (`requested_item_id.answers`): the referenced\n record's fields, read here as they are on its own page, not its JSON. */\n const through = own && bound && Object.hasOwn(bound, path) ? undefined : definedThrough(state.schema, base.id, path, definedOf);\n if (through && through.prefix) {\n const per = through.binding.per;\n return (\n <DefinedFields\n key={path}\n base={through.table}\n row={{ [through.column]: value, ...(per ? { [per]: row[`${through.prefix}.${per}`] } : {}) }}\n column={through.column}\n binding={through.binding}\n recordKey={{}}\n editing={false}\n isCurrent={isCurrent}\n connection={connection}\n />\n );\n }\n let dd: ReactNode;\n /* The host's word at this field (a suggestion waiting on it): in the empty mark's place, or after the value on\n its line — the field's height is the same with it as without, so nothing below moves when it arrives. */\n const adorned =\n adorn && own && !editing && !preview && byName.has(path)\n ? adorn({ table: base.id, column: path, key, filled: value !== null && value !== undefined && value !== '' })\n : null;\n if (editing && byName.has(path) && !column?.primaryKey && column?.writable !== false) {\n const display = (next: unknown, referenceLabel?: string) =>\n column?.references && next !== null && next !== undefined && String(next) !== '' ? (\n <RefJump\n references={column.references}\n value={next}\n label={referenceLabel ?? (String(next) === String(value) && refLabels.get(path) ? row[refLabels.get(path)!] : undefined)}\n table={base}\n column={path}\n row={{ ...row, [path]: next }}\n />\n ) : (\n /* A record's own field is where rich text is read whole; a list or a card shows its excerpt. */\n <Value col={column} value={next} tableId={base.id} compact links wholeText />\n );\n dd = (\n <dd className=\"page-field-edit\">\n <Editable\n table={base}\n row={row}\n column={byName.get(path)!}\n recordKey={key}\n onSaved={onEdit}\n isCurrent={isCurrent}\n app={shell().inApp()}\n display={shell().inApp() ? display : undefined}\n />\n </dd>\n );\n } else if (\n section.edit &&\n !preview &&\n own &&\n recordActions &&\n byName.has(path) &&\n !column?.primaryKey &&\n recordActions.list.some(\n (action) => !action.command && Object.keys((action as { set: object }).set).length === 1 && path in (action as { set: object }).set,\n )\n ) {\n dd = (\n <dd className=\"page-field-edit\">\n <ActionPick\n tableId={base.id}\n recordKey={key}\n column={path}\n value={value}\n actions={recordActions}\n caption={columnLabel(base.id, path, stem) ?? path}\n onDone={onEdit}\n connection={connection}\n />\n </dd>\n );\n } else if (value === null || value === undefined) {\n /* A text a section is only about, with nothing in it, is one muted line saying so, not a dash alone in the\n room of a paragraph. */\n const about = Boolean(section.title) && paths.length === 1 && !rail && column?.references === undefined;\n dd = adorned ? (\n <dd className=\"page-field-adorned\">{adorned}</dd>\n ) : about ? (\n <dd className=\"page-prose-empty\">{say('noneYet', { caption: (columnLabel(base.id, path, stem) ?? path).toLowerCase() })}</dd>\n ) : (\n <dd className=\"null\" title=\"null\">\n {emptyWord()}\n </dd>\n );\n } else if (column?.references && String(value) !== '') {\n const labelAt = refLabels.get(path);\n dd = (\n <dd>\n <RefJump\n references={column.references}\n value={value}\n label={labelAt ? row[labelAt] : undefined}\n table={base}\n column={path}\n row={row}\n />\n {adorned}\n </dd>\n );\n } else {\n dd = (\n <dd>\n <Value col={column} value={value} tableId={base.id} row={row} />\n {adorned}\n </dd>\n );\n }\n const shownAs = shared ? path.slice(shared.length) : path;\n const label = columnLabel(base.id, path, stem) ?? shownAs;\n /* A titled group that holds only its own field says its name once: the\n section's title stands for the field's label, which stays for\n assistive technology. A property rail is caption beside value by its\n shape, so its one row keeps the caption: \"Mar 31, 2026\" alone under\n \"Completed\" read as a stray value, not a rail. */\n /* Text to read rather than a value to glance at goes under its caption at the\n rail's whole width, as a document says it (Document.tsx): beside\n its caption in an aside, Depot's product description wrapped word by word. */\n const rule = columnDisplay(base.id, path) as DisplayRule | null;\n const dress = column?.references || value === null || value === undefined ? null : dressFor(rule, value);\n const long =\n rule?.format === 'richText' ||\n (rail && !column?.references && value != null && (dress ? dress.kind === 'richText' : sayValue(column, value).kind === 'long'));\n /* …and a long text alone under its section's title is read under that title, as a document's paragraph. */\n const lone = Boolean(section.title) && paths.length === 1 && (!rail || long);\n /* …and set as a paragraph: body weight and size, a readable measure, never the weight of a heading. */\n const prose = lone && typeof value === 'string' && !column?.references;\n return (\n <div key={path} className={`page-field${long ? ' page-field-wide' : ''}${prose ? ' page-field-prose' : ''}`}>\n <dt title={path} className={lone ? 'visually-hidden' : undefined}>\n {label}\n </dt>\n {dd}\n </div>\n );\n });\n const columns = typeof section.columns === 'number' ? section.columns : undefined;\n /* Both are lists of terms, so both are drawn as one: a property rail says\n caption beside value, the grid says them in columns. A grid of <dt>/<dd>\n in a <div> had no list for assistive technology to announce. */\n const grid = rail ? (\n <dl className=\"page-properties\" style={columns ? ({ '--page-properties-columns': String(columns) } as CSSProperties) : undefined}>\n {fields}\n </dl>\n ) : (\n <dl\n className={`page-field-grid${presentation === 'summary' ? ' page-field-summary' : ''}`}\n data-columns={columns}\n style={columns ? ({ '--page-field-columns': `repeat(${columns}, minmax(0, 1fr))` } as CSSProperties) : undefined}\n >\n {fields}\n </dl>\n );\n return (\n <SectionBox\n section={section}\n foldable={foldable}\n body={\n <>\n {section.workflow && <WorkflowStatus definition={section.workflow} value={row[section.workflow.field]} reachable={reachable} />}\n {grid}\n </>\n }\n />\n );\n}\n","/** What PageMetrics says, in the dashboards room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n thisMetricHasNoView: 'This metric has no view definition.',\n thisRecordHasNoToCount: 'This record has no {of} to count through.',\n thisMetricCouldNotBeRead: 'This metric could not be read.',\n openTheThisCounted: 'Open the {from} this counted',\n thisCountCannotBeReopened: '{from} — this count cannot be reopened as a query',\n thisSectionHasNo: 'This section has no breakdown definition.',\n noIsSetSo: 'No {reference} is set, so there is nothing to count.',\n theseGroupsCouldNotBeRead: 'These groups could not be read.',\n nothingToCountYet: 'Nothing to count yet.',\n noForThisRecord: 'No {from} for this record.',\n openWhere: 'Open {from} where {by} = {row}',\n andSmallerGroups: { one: 'and {count} smaller group', other: 'and {count} smaller groups' },\n thisChartHasNoBreakdown: 'This chart has no breakdown definition.',\n noIsSetSoThere: 'No {reference} is set, so there is nothing to draw.',\n thisChartCouldNotBeRead: 'This chart could not be read.',\n nothingToDrawYet: 'Nothing to draw yet.',\n});\n","/**\n * A page's counting sections: a metric (one number over the record's related\n * rows, reopenable as the query it counted), a breakdown (those rows in\n * groups, biggest first, each group a way into its rows) and a chart (those\n * groups measured and drawn). All read a plan the server compiled; none writes.\n */\nimport { metricMeasure } from '@mistriwork/engine/shared/recordReads.js';\nimport { useContext } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { batchedBreakdown } from '../breakdownBatch.js';\nimport { ownedBy } from '../requestIdentity.js';\nimport type { ResourceClientReply } from '@mistriwork/engine/shared/resourceHttp.js';\nimport { columnDisplay, columnLabel, findTable, go, quote, state, tableView } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { andQuery } from '@mistriwork/engine/shared/query.js';\nimport { formatNumber } from '../locale.js';\nimport { inAppPage, PageRenderContext, usePageApi, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { dressFor, groupLabel, withUnit, type DisplayRule } from './valueModel.js';\nimport { barShare, CurrencyFigures, EXACT, figureSayer, namedGroups, orderGroups, sayer } from './dashboardModel.js';\nimport { currencyPath } from '@mistriwork/engine/shared/money.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { Empty } from './Notes.js';\nimport { say as sayCopy } from '../copy/dashboards/components/PageMetrics.js';\n\n/* The drawing (and the chart kit under it) is fetched the first time a page\n holds a chart, beside the chart's read: most pages have none, and a first\n page is held to a budget (scripts/bundle-budget.mjs). */\nconst ChartFigure = onDemand(() => import('./ChartFigure.js'), 'ChartFigure');\n\n/** One number, and a way to see what it counted. */\nexport function MetricSection({ section, plan }: SlotProps) {\n const api = usePageApi();\n const { connection } = useContext(PageRenderContext);\n /* A count is the rows its view names, counted: the same filter as one\n group with no key, so it is asked as a breakdown and goes with the page's\n other figures in one request (breakdownBatch.ts) — a record with three\n counted tabs sent three reads, each a tenant request of its own. */\n const planned = metricMeasure(plan);\n /* Money each row says its own currency for is summed apart per currency: one figure each, never yen added to dollars. */\n const ownRule =\n !section.format && !plan.counts && section.fn !== 'count' && section.column\n ? (columnDisplay(section.from, section.column) as (DisplayRule & { currencyColumn?: string }) | null)\n : null;\n const split = planned && !planned.by.length && ownRule?.format === 'money' ? currencyPath(ownRule, section.column ?? '') : undefined;\n const measure = planned && split ? { ...planned, by: [{ path: split, alias: 'currency' }], limit: 6 } : planned;\n const counted = plan.counts && plan.view && !plan.breakdown ? measure : undefined;\n const data = useQuery<ResourceClientReply<'/api/view/run'>>({\n queryKey: ['page-metric', plan.view],\n queryFn: () => {\n if (!plan.view) throw new Error(sayCopy('thisMetricHasNoView'));\n return api('/api/view/run', { view: plan.view });\n },\n enabled: !plan.empty && Boolean(plan.view) && !measure,\n staleTime: 0,\n });\n /* A narrowed or distant measure is one group of the child's own rows —\n a breakdown with no key — and its figure is that group's `value`. */\n const measured = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-metric-measure', measure],\n queryFn: () => batchedBreakdown<ResourceClientReply<'/api/breakdown'>>({ def: measure!, owner: ownedBy(connection) }),\n enabled: !plan.empty && Boolean(measure),\n staleTime: 0,\n });\n if (plan.empty) {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <span\n className=\"page-metric-value page-metric-empty\"\n title={sayCopy('thisRecordHasNoToCount', { of: section.of ?? 'reference' })}\n >\n —\n </span>\n }\n />\n );\n }\n if (!plan.view && !plan.breakdown)\n return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('thisMetricHasNoView')} />;\n const reading = measure ? measured : data;\n /* Pending, the figure's own box, unseen: a row of metrics is as tall as its\n figures, and a loading bar of another height moved every section under\n the row when they came (test/built-client-vitals.mjs). */\n if (reading.isPending)\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <button type=\"button\" className=\"page-metric-value\" disabled tabIndex={-1} aria-hidden=\"true\" style={{ visibility: 'hidden' }}>\n <span className=\"metric-number\">0</span>\n <span className=\"metric-of\">{section.title ? '' : section.from}</span>\n </button>\n }\n />\n );\n if (reading.isError) return <SectionBox section={section} body={null} foldable={false} broken={(reading.error as Error).message} />;\n let aggregate: unknown;\n if (measure) {\n const got = measured.data;\n if (!got || 'errors' in got)\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={(got && 'errors' in got ? got.errors[0]?.message : undefined) ?? sayCopy('thisMetricCouldNotBeRead')}\n />\n );\n const figures = got.rows.flatMap((row) =>\n typeof row.currency === 'string' && row.currency.trim() ? [[row.currency.trim().toUpperCase(), row.value] as const] : [],\n );\n aggregate = split ? (figures.length ? new CurrencyFigures(figures) : undefined) : got.rows[0]?.value;\n } else {\n const got = data.data;\n if (!got || !('view' in got))\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={got?.errors[0]?.message ?? sayCopy('thisMetricCouldNotBeRead')}\n />\n );\n const row = got.rows[0] ?? {};\n aggregate = 'value' in row ? row.value : Object.entries(row).find(([k]) => k !== 'id')?.[1];\n }\n const got = data.data && 'view' in data.data ? data.data : undefined;\n const value = plan.counts ? (counted ? (aggregate ?? 0) : (got?.total ?? '—')) : (aggregate ?? (section.fn === 'sum' ? 0 : '—'));\n const open = plan.query\n ? () => go(tableView(section.from, plan.query), 'push')\n : plan.viewText\n ? () => go(tableView(section.from, section.from, `view+${encodeURIComponent(plan.viewText!).replace(/!/g, '%21')}`), 'push')\n : null;\n /* The author's word for the figure stands over its column's, as on a dashboard. */\n const { format, unit } = section;\n const rule: DisplayRule | null = format\n ? { format }\n : !plan.counts && section.fn !== 'count' && section.column\n ? (columnDisplay(section.from, section.column) as DisplayRule | null)\n : null;\n const dress = rule?.format === 'money' && !(value instanceof CurrencyFigures) ? dressFor(rule, value) : null;\n /* An average is said to one place at or past 1, as a dashboard's is: \"3.3\", not \"3.333\". */\n /* A record's own figure is exact, money to its currency's minor digits at any size, each currency's sum too. */\n const said = value === '—' ? value : dress?.text ? withUnit(dress.text, unit) : figureSayer(rule, unit, EXACT)(value);\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <button\n type=\"button\"\n className=\"page-metric-value\"\n disabled={!open}\n title={\n open\n ? sayCopy('openTheThisCounted', { from: section.from ?? '' })\n : sayCopy('thisCountCannotBeReopened', { from: section.from ?? '' })\n }\n onClick={open ?? undefined}\n >\n <span className=\"metric-number\">{said}</span>\n <span className=\"metric-of\">{section.title ? '' : section.from}</span>\n </button>\n }\n />\n );\n}\n\n/** Groups of related rows, biggest first: the \"mostly what?\" answer. */\nexport function BreakdownSection({ section, plan, base }: SlotProps) {\n const { connection } = useContext(PageRenderContext);\n const data = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-breakdown', plan.breakdown],\n queryFn: () => {\n if (!plan.breakdown) throw new Error(sayCopy('thisSectionHasNo'));\n return batchedBreakdown<ResourceClientReply<'/api/breakdown'>>({ def: plan.breakdown, owner: ownedBy(connection) });\n },\n enabled: !plan.empty && Boolean(plan.breakdown),\n staleTime: 0,\n });\n if (plan.empty) {\n /* Said as the reader would: which reference is unset, not a column's name. */\n const reference = section.of\n ? inAppPage()\n ? ((columnLabel(base.id, section.of) as string | null) ?? humanName(section.of)).replace(/[\\s_]+id$/i, '').toLocaleLowerCase()\n : section.of\n : 'reference';\n return <SectionBox section={section} foldable={false} body={<Empty text={sayCopy('noIsSetSo', { reference })} />} />;\n }\n if (!plan.breakdown) return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('thisSectionHasNo')} />;\n if (data.isPending) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n const got = data.data;\n if (!got) return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('theseGroupsCouldNotBeRead')} />;\n if ('errors' in got)\n return (\n <SectionBox section={section} body={null} foldable={false} broken={got.errors[0]?.message ?? sayCopy('theseGroupsCouldNotBeRead')} />\n );\n const [keyName, countName] = got.columns;\n /* Biggest first, as the plan asks the server — or, where the column has a\n vocabulary, in its order (dashboardModel.ts, orderGroups). */\n /* The grouped column read through its path, so `campaign_id.kind` finds the vocabulary of the campaign's kind. */\n const allowed = presentationColumns(state.schema, findTable(section.from) as TableMeta | undefined, [section.by ?? '']).get(\n section.by ?? '',\n )?.allowed;\n const rows = orderGroups(got.rows, keyName, countName, allowed);\n // A table's name (\"campaign_member\") is the Workbench's vocabulary, not an\n // App reader's; a breakdown's title names groups, so it cannot be reused.\n if (!rows.length)\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={<Empty text={inAppPage() ? sayCopy('nothingToCountYet') : sayCopy('noForThisRecord', { from: section.from ?? '' })} />}\n />\n );\n /* A group as a doorway: the anchoring condition comes off the compiled plan. */\n const conds = plan.breakdown.filter?.groups?.length === 1 ? plan.breakdown.filter.groups[0] : null;\n const anchor = conds?.find((c) => c.path === section.path && c.op === '=' && c.value != null);\n const drill =\n anchor && section.by\n ? (value: unknown) => {\n const where = andQuery(\n `${anchor.path} = ${quote(String(anchor.value))}`,\n section.filter,\n `${section.by} = ${quote(String(value))}`,\n );\n go(tableView(plan.breakdown!.base, `${plan.breakdown!.base} ${where}`), 'push');\n }\n : null;\n const largest = Math.max(...rows.map((r) => Number(r[countName]) || 0));\n // A measured breakdown (\"sum open_value\") dresses its figures as the column it reads, as a metric does.\n /* The author's word for the figures stands over the column's, as on a metric (G111). */\n const rule: DisplayRule | null = section.format\n ? { format: section.format }\n : section.fn && section.fn !== 'count' && section.column\n ? (columnDisplay(section.from, section.column) as DisplayRule | null)\n : null;\n const sayFigure = section.format || section.unit ? figureSayer(rule, section.unit) : formatNumber;\n const more = typeof got.total === 'number' && got.total > rows.length ? got.total - rows.length : 0;\n const sayKey = namedGroups(got, keyName, (key) =>\n groupLabel(columnDisplay(section.from, section.by) as DisplayRule | null, key, allowed),\n );\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <div className=\"page-breakdown-rows\">\n {rows.map((row, i) => {\n const count = Number(row[countName]) || 0;\n const dress = rule?.format === 'money' && row[countName] != null ? dressFor(rule, row[countName]) : null;\n const shown = row[countName] == null ? '0' : dress?.text ? withUnit(dress.text, section.unit) : sayFigure(row[countName]);\n const parts = (\n <>\n <span className=\"pbd-label\">{sayKey(row[keyName])}</span>\n <span className=\"pbd-bar\">\n <span className=\"pbd-fill\" style={{ width: `${barShare(count, largest)}%` }} />\n </span>\n <span className=\"pbd-count\">{shown}</span>\n </>\n );\n return drill && row[keyName] != null ? (\n <button\n key={i}\n type=\"button\"\n className=\"pbd-row pbd-drill\"\n title={sayCopy('openWhere', { from: section.from ?? '', by: section.by ?? '', row: String(row[keyName]) })}\n onClick={() => drill(row[keyName])}\n >\n {parts}\n </button>\n ) : (\n <div key={i} className=\"pbd-row\">\n {parts}\n </div>\n );\n })}\n {more > 0 && <p className=\"note pbd-more\">{sayCopy('andSmallerGroups', { count: more })}</p>}\n </div>\n }\n />\n );\n}\n\n/**\n * The related rows measured and drawn — the dashboard's chart about one\n * record. The plan is a breakdown anchored on the record (page.ts, chartPlan);\n * the drawing is the dashboard's own (ChartFigure).\n */\nexport function ChartSection({ section, plan, base }: SlotProps) {\n const { connection } = useContext(PageRenderContext);\n /* The section's own skeleton stands until the drawing has come as well as the answer. */\n const drawable = useArrived(ChartFigure, !plan.empty && Boolean(plan.breakdown));\n const data = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-breakdown', 'chart', plan.breakdown],\n queryFn: () => {\n if (!plan.breakdown) throw new Error(sayCopy('thisChartHasNoBreakdown'));\n return batchedBreakdown<ResourceClientReply<'/api/breakdown'>>({ def: plan.breakdown, owner: ownedBy(connection) });\n },\n enabled: !plan.empty && Boolean(plan.breakdown),\n staleTime: 0,\n });\n if (plan.empty) {\n const reference = section.of\n ? inAppPage()\n ? ((columnLabel(base.id, section.of) as string | null) ?? humanName(section.of)).replace(/[\\s_]+id$/i, '').toLocaleLowerCase()\n : section.of\n : 'reference';\n return <SectionBox section={section} foldable={false} body={<Empty text={sayCopy('noIsSetSoThere', { reference })} />} />;\n }\n if (!plan.breakdown) return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('thisChartHasNoBreakdown')} />;\n if (data.isPending || (!drawable && !data.isError)) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n const got = data.data;\n if (!got || 'errors' in got)\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={(got && 'errors' in got ? got.errors[0]?.message : undefined) ?? sayCopy('thisChartCouldNotBeRead')}\n />\n );\n const from = section.from ?? '';\n /* Each key's column, its period dropped: \"month issued_on\" is labelled as issued_on is. */\n const [first = '', second = ''] = (section.by ?? '').split(',').map((key) => key.trim().split(/\\s+/).pop() ?? '');\n const say = sayer({\n kind: 'chart',\n table: from,\n measure: section.fn && section.fn !== 'count' ? `${section.fn} ${section.column ?? ''}` : undefined,\n format: section.format,\n unit: section.unit,\n });\n const labelFor = (path: string) => {\n const allowed = presentationColumns(state.schema, findTable(from) as TableMeta | undefined, [path]).get(path)?.allowed;\n const rule = columnDisplay(from, path) as DisplayRule | null;\n return { say: (key: unknown) => groupLabel(rule, key, allowed), allowed };\n };\n const firstLabel = labelFor(first);\n /* The column a category order reads rides after the figures (page.ts, chartOrder): it is no series of the drawing. */\n const drawn = { ...got, columns: got.columns.slice(0, (second ? 2 : 1) + 1) };\n /* A slice — or a line's point — is a way into its rows where the key is a plain column, as a breakdown's group is. */\n const conds = plan.breakdown.filter?.groups?.length === 1 ? plan.breakdown.filter.groups[0] : null;\n const anchor = conds?.find((c) => c.path === section.path && c.op === '=' && c.value != null);\n const plainKey = !/\\s/.test((section.by ?? '').split(',')[0].trim());\n const drill =\n anchor && plainKey && (section.shape === 'donut' || section.shape === 'line')\n ? (value: unknown) => {\n if (value == null) return;\n const where = andQuery(`${anchor.path} = ${quote(String(anchor.value))}`, section.filter, `${first} = ${quote(String(value))}`);\n go(tableView(plan.breakdown!.base, `${plan.breakdown!.base} ${where}`), 'push');\n }\n : null;\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <ChartFigure\n answer={drawn}\n arrange={section.sort === 'value' ? 'value' : plan.breakdown.orderBy?.[0]?.name === 'value' ? undefined : 'answer'}\n shape={section.shape}\n limit={section.limit}\n target={section.target}\n height={section.height}\n say={say}\n label={namedGroups(got, got.columns[0], firstLabel.say)}\n seriesLabel={namedGroups(got, second ? got.columns[1] : undefined, labelFor(second).say)}\n vocabulary={firstLabel.allowed}\n onPick={drill}\n empty={inAppPage() ? sayCopy('nothingToDrawYet') : sayCopy('noForThisRecord', { from })}\n />\n }\n />\n );\n}\n","/** What PageTimeline 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 thisActivityStreamHasNoView: 'This activity stream has no view definition.',\n thisActivityStreamCould: 'This activity stream could not be read.',\n nothingDatedYetForThisRecord: 'Nothing dated yet for this record.',\n updates: { one: '{count} update', other: '{count} updates' },\n});\n","/**\n * A page's timeline section: the record's activity as one stream, its\n * streams read together and merged newest-first, and, where the App lets\n * this record add to its first stream, the composer that does it through\n * the same related-create plan and form a related list uses.\n */\nimport { useContext, useId, useLayoutEffect, useRef, useState } from 'react';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { findTable, labelPath, state } from '../core.js';\nimport { shell } from '../shellMode.js';\nimport { resourceOf } from './appRooms.js';\nimport { headingOf, recordNoun } from '@mistriwork/engine/shared/appNoun.js';\nimport { dayOf, formatDateTime, formatDayHeading, formatTimeOfDay } from '../locale.js';\nimport { hueOf, initialsOf } from './valueModel.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { relatedCreatePlan } from '@mistriwork/engine/shared/relatedCreate.js';\nimport { timelineReads } from '@mistriwork/engine/shared/recordReads.js';\nimport { type TimelineTone } from '@mistriwork/engine/shared/pageModel.js';\nimport { canInsert, openRelatedRecord } from '../insert.js';\nimport { PageRenderContext, usePageApi, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { Empty } from './Notes.js';\nimport { Value } from './Value.js';\nimport { listColumn } from './listColumn.js';\nimport type { ColumnMeta } from '@mistriwork/engine/shared/schema.js';\nimport { say } from '../copy/record/components/PageTimeline.js';\n\n/**\n * What a merged row says it is: its resource's noun (\"Call\", \"Note\"), the word\n * a New button and a page already use, and the table's name as a person says\n * it where the resource names none — never a source's qualified name\n * (`sales.deal_estimate`). The Workbench shows the table as it is.\n */\nfunction streamSource(tableId: string, table: TableMeta | undefined): string {\n if (!shell().inApp()) return table?.name ?? tableId;\n const name = table?.name ?? tableId;\n return headingOf(recordNoun(resourceOf(shell().app(), table?.id ?? tableId)?.noun, name.slice(name.lastIndexOf('.') + 1)));\n}\n\n/** One row of the merged stream: what it says, who, when, and how the section's rules dress it. */\ninterface TimelineRow {\n when: string;\n text: unknown;\n textColumn?: ColumnMeta;\n detail: unknown;\n detailColumn?: ColumnMeta;\n table: string;\n by: string | null;\n source: string;\n tone?: TimelineTone;\n compact?: boolean;\n /** The other party's, as the section's `side` says: drawn against the far edge. */\n other?: boolean;\n}\n\n/** A row no person wrote, as the section's `compact` rule says: a row without an author is not one (a customer's\n message may have none where the author is the agent). */\nconst isEvent = (r: TimelineRow) => Boolean(r.compact);\n\n/** The rows by calendar day, each day's runs of two or more events folded into one item. */\nfunction byDay(rows: TimelineRow[]) {\n const days: Array<{ day: string; items: Array<TimelineRow | TimelineRow[]> }> = [];\n for (const r of rows) {\n const day = dayOf(r.when) ?? '';\n let last = days.at(-1);\n if (!last || last.day !== day) days.push((last = { day, items: [] }));\n const prev = last.items.at(-1);\n if (isEvent(r) && prev && (Array.isArray(prev) || isEvent(prev))) last.items[last.items.length - 1] = [prev, r].flat();\n else last.items.push(r);\n }\n return days;\n}\n\n/** The time of day a row was written; the day is its group's heading, the whole moment its title. */\nfunction When({ at }: { at: string }) {\n const time = formatTimeOfDay(at);\n return time ? (\n <time className=\"timeline-when\" dateTime={at} title={formatDateTime(at)}>\n {time}\n </time>\n ) : null;\n}\n\n/** Whether a message goes on its author's run: the same person, on the same side, in the same dress, right after. */\nconst runsOn = (r: TimelineRow, prev: TimelineRow | TimelineRow[] | undefined) =>\n Boolean(prev && !Array.isArray(prev) && !isEvent(prev) && r.by && prev.by === r.by && prev.other === r.other && prev.tone === r.tone);\n\n/** One row: an event is one quiet line; a message is who, what kind and when over its words, its author said once a run\n where the section has sides. */\nfunction Row({\n r,\n multi,\n conversation,\n continued = false,\n}: {\n r: TimelineRow;\n multi: boolean;\n conversation: boolean;\n continued?: boolean;\n}) {\n const words =\n r.text == null || r.text === '' ? (\n ''\n ) : (\n <Value tableId={r.table} col={r.textColumn} value={r.text} compact links wholeText={conversation} />\n );\n const tone = r.tone ? { 'data-tone': r.tone } : {};\n if (isEvent(r))\n return (\n <li className=\"timeline-row is-compact\" data-timeline-row {...tone}>\n <span className=\"timeline-text\">{words}</span>\n <When at={r.when} />\n </li>\n );\n return (\n <li\n className={`timeline-row${r.tone ? ' is-tinted' : ''}${r.other ? ' is-other' : ''}${continued ? ' is-continued' : ''}`}\n data-timeline-row\n {...tone}\n >\n {r.by && !continued ? (\n <span className={`timeline-avatar avatar avatar-c${hueOf(r.by)}`} aria-hidden=\"true\">\n {initialsOf(r.by)}\n </span>\n ) : (\n <span className=\"timeline-avatar\" aria-hidden=\"true\" />\n )}\n <span className=\"timeline-head\">\n {r.by && (continued ? <span className=\"visually-hidden\">{r.by}</span> : <span className=\"timeline-by\">{r.by}</span>)}\n {r.detail != null && (\n <span className=\"timeline-kind\">\n <Value tableId={r.table} col={r.detailColumn} value={r.detail} compact />\n </span>\n )}\n {multi && <span className=\"timeline-source\">{r.source}</span>}\n <When at={r.when} />\n </span>\n <div className=\"timeline-text prose\">{words}</div>\n </li>\n );\n}\n\n/** Two or more events in a row, said as their count and opened in place. */\nfunction Fold({ rows, multi, conversation }: { rows: TimelineRow[]; multi: boolean; conversation: boolean }) {\n const [open, setOpen] = useState(false);\n const id = useId();\n return (\n <li className=\"timeline-fold\">\n <button type=\"button\" className=\"timeline-fold-toggle\" aria-expanded={open} aria-controls={id} onClick={() => setOpen(!open)}>\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M6 4l4 4-4 4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n {say('updates', { count: rows.length })}\n </button>\n <ol className=\"timeline-rows\" id={id} hidden={!open}>\n {rows.map((r, i) => (\n <Row key={i} r={r} multi={multi} conversation={conversation} />\n ))}\n </ol>\n </li>\n );\n}\n\n/** The record's activity as one stream, merged newest-first (or, as a conversation, oldest-first) across its streams. */\n/* The other side's stylesheet, a part of its own: only a section with a `side` (its own or a stream's) asks for it. */\nconst Sides = onDemand(() => import('./TimelineSides.js'), 'TimelineSides', { quiet: true });\n\nexport function TimelineSection({ section, plan, base, recordKey }: SlotProps) {\n /* Rows with sides wait for their dress, under the section's one skeleton, so nothing moves when it comes. */\n const sided = Boolean(section.side || section.streams?.some((stream) => stream.side));\n const sidesHere = useArrived(Sides, sided);\n const api = usePageApi();\n const { preview, isCurrent, openRelated } = useContext(PageRenderContext);\n const queries = useQueryClient();\n const [added, setAdded] = useState(false);\n const createButton = useRef<HTMLButtonElement>(null);\n const streams = plan.streams ?? [];\n const conversation = section.newest === 'last';\n /* The conversation's box, as a state: a sided conversation draws its placeholder until its sides arrive, and the box\n drawn then is a new one the first scroll never saw. */\n const [scroller, setScroller] = useState<HTMLDivElement | null>(null);\n /* Whether the reader is at the foot: the box keeps them there while it settles, and leaves them where they scrolled. */\n const atFoot = useRef(true);\n /* A row's line and detail are values of their stream's table, dressed by its display rules and drawn by its\n value components as a grid cell is; `table` is whose rules they are. */\n const data = useQuery<TimelineRow[]>({\n queryKey: ['page-timeline', plan.streams, section.limit, section.tone, section.compact, section.streams],\n queryFn: async () => {\n const answers = await Promise.all(\n streams.map(async (stream, s) => {\n /* The stream as authored: its own tone and compact stand over the section's rules. */\n const own = section.streams?.[s];\n if (stream.error) throw new Error(stream.error);\n if (stream.empty) return [];\n if (!stream.view) throw new Error(say('thisActivityStreamHasNoView'));\n const table = findTable(stream.from) as TableMeta | undefined;\n /* An author that is a reference (`author: 'owner_id'`) says the person's name, as a list column of the same\n reference does: read through the reference to the record's label, where this reader reads that table.\n The other party's rows are the same read narrowed by the section's `side`, asked beside it: their keys.\n Both as the page's planned reads ask them (shared recordReads.ts `timelineReads`), so a composed page's\n answers are these very reads. */\n if (stream.side?.error) throw new Error(stream.side.error);\n const asked = timelineReads(\n { table: (id) => findTable(id) as TableMeta | undefined, namePath: (target) => labelPath(target) },\n stream,\n )!;\n const view = asked.view;\n const named = asked.view !== stream.view ? asked.view.columns?.at(-1)?.path : undefined;\n const byPath = named ?? stream.by;\n const others = asked.side ? api('/api/view/run', { view: asked.side, offset: 0 }) : undefined;\n const [got, otherRows] = await Promise.all([api('/api/view/run', { view, offset: 0 }), others]);\n if (!('view' in got)) throw new Error(got.errors[0]?.message ?? say('thisActivityStreamCould'));\n if (otherRows && !('view' in otherRows)) throw new Error(otherRows.errors[0]?.message ?? say('thisActivityStreamCould'));\n const keyOf = (row: Record<string, unknown>, names: string[], cols: string[]) =>\n JSON.stringify(stream.key!.map((column) => row[cols[names.indexOf(column)] ?? column] ?? null));\n const otherKeys =\n otherRows &&\n new Set(otherRows.rows.map((row: Record<string, unknown>) => keyOf(row, stream.key!, otherRows.columns ?? stream.key!)));\n const names = (view.columns ?? []).map((c) => c.path);\n const cols: string[] = got.columns ?? names;\n const atCol = cols[names.indexOf(stream.at)] ?? stream.at;\n const showCol = cols[names.indexOf(stream.show)] ?? stream.show;\n const detailCol = stream.detail ? (cols[names.indexOf(stream.detail)] ?? stream.detail) : null;\n const byCol = byPath ? (cols[names.indexOf(byPath)] ?? byPath) : null;\n const markCol = (name: string) => cols[names.indexOf(name)] ?? name;\n const shown = table && listColumn(table, stream.show);\n const detailed = table && stream.detail ? listColumn(table, stream.detail) : undefined;\n return got.rows.map((row): TimelineRow => ({\n when: row[atCol] == null ? '' : String(row[atCol]),\n text: row[showCol] ?? null,\n ...(shown ? { textColumn: { ...shown, name: stream.show } } : {}),\n detail: detailCol && row[detailCol] != null && row[detailCol] !== '' ? row[detailCol] : null,\n ...(detailed ? { detailColumn: { ...detailed, name: stream.detail! } } : {}),\n table: table?.id ?? stream.from,\n by: byCol && row[byCol] != null ? String(row[byCol]) : null,\n source: streamSource(stream.from, table),\n /* A column's value picks the tone, and a one-line row: the section's rules read each row's own columns,\n where the stream says neither for all its rows. */\n ...(() => {\n const said = (column: string) => (row[markCol(column)] == null ? undefined : String(row[markCol(column)]));\n const tone =\n own?.tone ??\n Object.entries(section.tone ?? {})\n .map(([column, tones]) => tones[said(column) ?? ''])\n .find(Boolean);\n const small =\n own?.compact === true ||\n (own?.compact === undefined &&\n Object.entries(section.compact ?? {}).some(([column, values]) => values.includes(said(column) ?? '')));\n const other = !small && otherKeys?.has(keyOf(row, names, cols));\n return { ...(tone ? { tone } : {}), ...(small ? { compact: true } : {}), ...(other ? { other: true } : {}) };\n })(),\n }));\n }),\n );\n return answers\n .flat()\n .filter((r) => r.when)\n .sort((a, b) => (a.when < b.when ? 1 : a.when > b.when ? -1 : 0))\n .slice(0, section.limit ?? 20);\n },\n staleTime: 0,\n });\n /* A conversation reads to its newest line, at the foot: scrolled there when it arrives and when a message is added,\n and kept there while what is above it settles — a face's metrics, an avatar, a message's prose drawn a moment\n later. Scrolled there once, it was left a few pixels short at a desk and most of a message short on a phone as\n the rows grew under it, the top line cut, neither at the first message nor at the newest (G184). Once the reader\n scrolls away from the foot, the box stays where they put it. */\n useLayoutEffect(() => {\n if (!conversation || !scroller) return;\n const box = scroller;\n /* At the foot the box's top edge falls wherever the height runs out, mostly inside a message: so the box stands a\n little shorter than its most, by less than one message, for that edge to fall where a message (or a day) starts.\n Only while the reader is at the foot; their own scroll is theirs. */\n const foot = () => {\n if (!atFoot.current) return;\n box.style.maxHeight = '';\n const room = box.clientHeight,\n whole = box.scrollHeight;\n if (whole > room + 1) {\n const origin = box.getBoundingClientRect().top - box.scrollTop;\n const over = whole - room;\n /* The box's height and its scroll are whole pixels and a face's lines are not (Barlow's start at fractions):\n floored, the edge fell up to a pixel inside the line it was meant to start. Rounded, it falls within half a\n pixel of that line's start, on either side, so a line is taken only where rounding lands no lower. */\n const edge = [...box.querySelectorAll<HTMLElement>('.timeline-day-label, [data-timeline-row], .timeline-fold')]\n .filter((line) => line.offsetHeight > 0)\n .map((line) => line.getBoundingClientRect().top - origin)\n .filter((top) => top >= over - 0.5)\n .sort((a, b) => a - b)[0];\n const height = edge === undefined ? room : Math.round(whole - edge);\n if (height < room) box.style.maxHeight = `${height}px`;\n }\n box.scrollTop = box.scrollHeight;\n };\n atFoot.current = true;\n foot();\n const read = () => {\n atFoot.current = box.scrollTop + box.clientHeight >= box.scrollHeight - 2;\n };\n box.addEventListener('scroll', read, { passive: true });\n const settle = new ResizeObserver(foot);\n settle.observe(box);\n for (const child of box.children) settle.observe(child);\n return () => {\n box.removeEventListener('scroll', read);\n settle.disconnect();\n };\n }, [conversation, scroller]);\n // A message added (the reader's own, or one that arrived) takes the reader to the foot, where it is.\n useLayoutEffect(() => {\n if (!conversation || !scroller) return;\n atFoot.current = true;\n scroller.scrollTop = scroller.scrollHeight;\n }, [conversation, scroller, data.data]);\n if (data.isPending || (sided && !sidesHere)) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n const rows = conversation ? [...(data.data ?? [])].reverse() : (data.data ?? []);\n /* A message names its stream only where the messages come from more than one: a conversation whose second stream\n is all quiet lines (time logged) said \"Activity\" over every message, a word that told the reader nothing. */\n const multi = new Set(rows.filter((r) => !isEvent(r)).map((r) => r.source)).size > 1;\n /* The composer adds a row of the first stream, bound to this record the way\n a related list's create is: the same plan, the same form, no new write\n path. A stream narrowed by a query could hide the row it just added. */\n const first = section.streams?.[0];\n const table = first ? (findTable(first.from) as TableMeta | undefined) : undefined;\n const creation =\n section.create && first && !first.filter && table && state.schema\n ? relatedCreatePlan(state.schema, base.id, table.id, first.path, section.create)\n : undefined;\n const defaults = creation?.bindings && Object.fromEntries(creation.bindings.map((b) => [b.column, recordKey[b.parent]]));\n const canCreate =\n !preview &&\n shell().inApp() &&\n table &&\n canInsert(table) &&\n defaults &&\n Object.values(defaults).every((v) => typeof v === 'string' || typeof v === 'number');\n const composeButton = !section.composer && canCreate && (\n <div className=\"page-related-create timeline-compose\">\n {added && <span role=\"status\">{say('common.added')}</span>}\n <button\n type=\"button\"\n className=\"ghost\"\n ref={createButton}\n onClick={() => {\n if (isCurrent && !isCurrent()) return;\n setAdded(false);\n (openRelated ?? openRelatedRecord)(\n table,\n { show: creation!.show, defaults: { ...(creation!.defaults ?? {}), ...defaults } },\n () => {\n if (isCurrent && !isCurrent()) return;\n setAdded(true);\n void queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n createButton.current?.focus();\n },\n );\n }}\n >\n + {section.create!.label}\n </button>\n </div>\n );\n /* The composer sends through the App's commands (TimelineComposer.tsx), drawn through the shell's slot. */\n const { TimelineComposer } = shell().slots;\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <>\n {composeButton}\n {rows.length ? (\n <div\n className={conversation ? 'timeline-scroll' : undefined}\n {...(conversation ? { 'data-scrolls': '' } : {})}\n ref={setScroller}\n >\n <ol className=\"timeline\">\n {byDay(rows).map(({ day, items }, d) => (\n <li key={day || d} className=\"timeline-day\">\n {day && (\n <time className=\"timeline-day-label\" dateTime={day}>\n {formatDayHeading(day)}\n </time>\n )}\n <ol className=\"timeline-rows\">\n {items.map((item, i) =>\n Array.isArray(item) ? (\n <Fold key={`${item[0]!.when} ${item[0]!.table}`} rows={item} multi={multi} conversation={conversation} />\n ) : (\n <Row\n key={`${item.when} ${item.table}`}\n r={item}\n multi={multi}\n conversation={conversation}\n continued={sided && runsOn(item, items[i - 1])}\n />\n ),\n )}\n </ol>\n </li>\n ))}\n </ol>\n </div>\n ) : (\n <Empty text={say('nothingDatedYetForThisRecord')} />\n )}\n {section.composer && !preview && shell().inApp() && TimelineComposer && (\n <TimelineComposer\n composer={section.composer}\n recordKey={recordKey as Record<string, string | number>}\n table={base?.id}\n onSent={() =>\n void queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n })\n }\n />\n )}\n </>\n }\n />\n );\n}\n","/**\n * The reader's own settings, in one quiet place.\n *\n * Density, rows per list, rows per related list: each existed (or wanted\n * to) as its own control in its own corner, which is fine for one\n * preference and a scavenger hunt for three. The dialog holds them\n * together; every choice applies as it is made, because a Save button on\n * a preferences panel is a promise the panel could have kept already.\n *\n * All of it is per-browser, like the theme: these are facts about the\n * reader's eyes and screen, not about the data, so they belong beside the\n * chair rather than in the team's config.\n */\nimport { createElement } from 'react';\nimport { mount, unmount } from './components/mount.js';\nimport { onDemand } from './components/onDemand.js';\nimport { portalRoot } from './shellHost.js';\nexport { relatedRows } from './relatedRows.js';\n\n/* Loaded the first time it opens. */\nconst PrefsDialog = onDemand(() => import('./components/Prefs.js'), 'PrefsDialog', { quiet: true });\n\n/** The dialog is `components/Prefs.tsx`; this is its one host on the body. */\nexport function openPrefs() {\n const host = document.createElement('div');\n host.className = 'host-contents';\n portalRoot().append(host);\n mount(\n host,\n createElement(PrefsDialog, {\n onClose: () => {\n unmount(host);\n host.remove();\n },\n }),\n );\n}\n","/**\n * The most bytes one uploaded file may be, whatever a resource says: an App's\n * `file` block may ask for less, never more (appModel.ts), and the server\n * sizes the one request body allowed past its usual bound from it (server\n * http/reply.ts FILE_UPLOAD_BODY). Uploads cross as base64 inside JSON.\n */\nexport const FILE_MAX_BYTES_CEILING = 25 * 1024 * 1024;\n\n/** An upload's cap when the resource does not say. */\nexport const FILE_MAX_BYTES_DEFAULT = 10 * 1024 * 1024;\n","/** What PageCurrent 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","/**\n * A current card (`current(title, from, whose, { query, sort })`, a related\n * list with presentation 'card'): the one row the query and the sort choose —\n * the active lease of a unit, the latest visit — as the record-card a\n * reference draws (PageFields.tsx), captioned by the section's title. The\n * row's name is its title and opens it — said without the page record's own\n * name, as a child list says it (\"Telehealth\", not \"Noah Fischer ·\n * telehealth\" on Noah's page); the columns its `show` names are the facts,\n * in that order, each dressed by its display rule, and nothing else the read\n * carried to name or open the row; \"View lease\" says so again at the foot.\n * With no such row the card says what that means, in the author's words\n * where there are some.\n */\nimport type { ReactNode } from 'react';\nimport { columnLabel, labelPath, openRecord, state } from '../core.js';\nimport { opensRecord } from '../recordIntent.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { primaryKey, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { Value } from './Value.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { say } from '../copy/record/components/PageCurrent.js';\n\nexport function CurrentCard({\n table,\n caption,\n row,\n columns,\n show,\n labels,\n referenceLabels,\n record,\n title,\n noun,\n empty,\n}: {\n table: TableMeta;\n /** The section's title: what the card is (\"Current lease\"). */\n caption?: string;\n row: Record<string, unknown> | undefined;\n /** The row's shown columns, the list's private projection already left out. */\n columns: string[];\n /** The section's `show`: the facts, in its order. Without one, every shown column but the name and the key. */\n show?: readonly string[];\n labels?: Record<string, string>;\n /** Column → the joined column naming the record it references. */\n referenceLabels?: Record<string, string>;\n record: { key: Record<string, unknown> | null; label: string } | undefined;\n /** The name the card is titled by, where it says less than the record's own (its parent's name left out);\n null where it is the page's own name, which the heading already says. */\n title?: string | null;\n /** What one row is called, for the foot's \"View …\". */\n noun: string;\n empty: ReactNode;\n}) {\n const naming = labelPath(table);\n const keys = primaryKey(table);\n /* A card titled by a computed name still reads a column to name the row by\n where the App names none: that column is the title, not a fact the\n author asked for. */\n const asked = (show?.length ? show.filter((name) => columns.includes(name)) : columns).filter(\n (name) => name !== naming && !keys.includes(name),\n );\n const facts = asked.filter((name) => row && row[name] !== null && row[name] !== undefined && row[name] !== '');\n const metadata = presentationColumns(state.schema, table, facts);\n const open = () => {\n if (record?.key) void openRecord(table.id, record.key, record.label);\n };\n return (\n <div className=\"page-card page-current\">\n {caption && <h2 className=\"page-card-caption\">{caption}</h2>}\n {row && record ? (\n <>\n {title !== null && (\n <p className=\"page-card-title\">\n {record.key ? (\n <button type=\"button\" className=\"ref-jump page-card-name\" data-opens={opensRecord(table.id, record.key)} onClick={open}>\n {title ?? record.label}\n </button>\n ) : (\n <span>{title ?? record.label}</span>\n )}\n </p>\n )}\n {facts.length > 0 && (\n <dl className=\"page-card-facts\">\n {facts.map((name) => {\n const label = referenceLabels?.[name] ? row[referenceLabels[name]] : undefined;\n const col = metadata.get(name) ?? { name, type: 'TEXT', nullable: true, primaryKey: false };\n return (\n <div key={name} className=\"page-card-fact\">\n <dt>{labels?.[name] ?? columnLabel(table.id, name) ?? humanName(name)}</dt>\n <dd>\n <Value tableId={table.id} col={label == null ? col : { ...col, type: 'TEXT' }} value={label ?? row[name]} compact />\n </dd>\n </div>\n );\n })}\n </dl>\n )}\n {record.key && (\n <p className=\"page-card-foot\">\n <button type=\"button\" className=\"ref-jump page-card-more\" data-opens={opensRecord(table.id, record.key)} onClick={open}>\n {say('common.view', { noun })}\n </button>\n </p>\n )}\n </>\n ) : (\n <div className=\"page-current-empty\">{empty}</div>\n )}\n </div>\n );\n}\n","/**\n * Deleting a row, having first said what that would do.\n *\n * This is the one destructive action in tablewalk, and it is also the one place\n * the tool has a genuine advantage over every other database client — not\n * through cleverness, but because of what it already knows. It counts what\n * points at a row in order to draw the Related panel; the same counts answer\n * \"what breaks if this goes\" *before* the delete rather than as a constraint\n * violation afterwards.\n *\n * The count alone is not the answer, which is the part most tools would get\n * wrong if they tried. Three rows pointing at this one means three rows\n * deleted under `cascade`, three rows left holding a null under `set null`, and\n * a delete that simply fails under `restrict`. Three outcomes behind one\n * number. So the dialog leads with the *rule*, and a rule the adapter could not\n * determine says so rather than being quietly rendered as harmless.\n *\n * The button and its dialog are a component (components/DeleteButton.tsx); what\n * stays here is the gate every write affordance shares.\n */\nimport { state, writeAllowed } from './core.js';\n\n/**\n * Whether this connection will accept a delete at all.\n *\n * Asked of the server's own answer rather than inferred: `writable` is on the\n * connection list precisely so the interface does not offer a button the server\n * would refuse.\n */\nexport function canDelete(table) {\n if (!state.canWrite || !table || table.isView || table.deletable === false) return false;\n if (!writeAllowed(table.id)) return false;\n return Boolean(state.connections?.find((c) => c.id === state.activeConnection)?.writable);\n}\n","/** What PageRelated 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 thisListHasNoView: 'This list has no view definition.',\n nothingHereYet: 'Nothing here yet.',\n noIsSetSoThere: 'No {reference} is set, so there are no {things} to show.',\n thisListCouldNotBeRead: 'This list could not be read.',\n noRelatedRecordsYet: 'No related records yet.',\n noRightNow: 'No {thing} right now.',\n thisPageHasMoved: 'This page has moved on; nothing was renamed.',\n thisPageHasMovedOn: 'This page has moved on; nothing was removed.',\n theFileWasNotRemoved: 'The file was not removed.',\n thisPageHasMovedOnNothing: 'This page has moved on; nothing was attached.',\n recordAdded: 'Record added',\n photos: 'Photos',\n noPhotosYet: 'No photos yet.',\n noFilesYet: 'No files yet.',\n attachFiles: 'Attach files',\n addThing: 'Add {thing}',\n noForThisRecord: 'No {name} for this record.',\n previousRows: 'Previous rows',\n moreRows: 'More rows',\n totalAllThings: 'Total · all {things}',\n totalAllCountThings: 'Total · all {count} {things}',\n recordsNoun: 'records',\n});\n","/**\n * A page's related list: the rows that point at the root, a page at a time,\n * drawn as the section asks — a grid, cards, a gallery of photos, or\n * attachments when the rows are files — with the create, upload and pager\n * a list offers. Adding refreshes every list, timeline and count on the page.\n */\nimport { PresentationSwitch } from './PresentationSwitch.js';\nimport { useContext, useMemo, useRef, useState } from 'react';\nimport { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { ownedBy } from '../requestIdentity.js';\nimport type { ResourceClientReply } from '@mistriwork/engine/shared/resourceHttp.js';\nimport { columnLabel, recordLabel, api as coreApi, findTable, openRecord, rowLabel, state, writeAllowed } from '../core.js';\nimport { relatedRows } from '../prefs.js';\nimport { formatBytes, formatNumber, formatRelativeDay } from '../locale.js';\nimport { columnKind, type DatabaseSchema, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { recordViewKey, recordViewLabel, withoutParent, withoutParentName } from '@mistriwork/engine/shared/referenceModel.js';\nimport { groupsBody, listView } from '@mistriwork/engine/shared/recordReads.js';\nimport { GROUP_ROWS_DEFAULT, GROUPS_DEFAULT } from '@mistriwork/engine/shared/pageModel.js';\nimport { groupFactPaths, groupTable } from '@mistriwork/engine/shared/pagePaths.js';\nimport { andQuery, quoteValue } from '@mistriwork/engine/shared/query.js';\nimport { Grid } from './Grid.js';\nimport { RowActions } from './RowActions.js';\nimport { RowTrailHosts, rowKeyString } from './RowHost.js';\nimport type { GroupMoves } from './groupMoves.js';\nimport { wholeColumn } from './placeOrder.js';\nimport { mayRunAny } from '../actionGrants.js';\nimport { offeredBy } from './appRooms.js';\nimport { Icon } from './Icon.js';\nimport { relatedCreatePlan } from '@mistriwork/engine/shared/relatedCreate.js';\nimport { inlineFileAddress } from './cardsModel.js';\nimport { filesOnLease, saveFileOnLease } from '../fileSource.js';\nimport { FILE_MAX_BYTES_DEFAULT } from '@mistriwork/engine/shared/fileBounds.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { pluralOf, recordNoun } from '@mistriwork/engine/shared/appNoun.js';\nimport type { ServedResource } from '@mistriwork/engine/shared/servedApp.js';\nimport { canInsert, openRelatedRecord } from '../insert.js';\nimport type { FormCuration } from './newRecordModel.js';\nimport { formShownFields } from '@mistriwork/engine/shared/form.js';\nimport { pinnedBy, sectionClass } from './pageModel.js';\nimport { CurrentCard } from './PageCurrent.js';\nimport { PageRenderContext, recordReadNames, spoken, usePageApi, type RecordActions, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { ListEmpty } from './ListEmpty.js';\nimport { Empty } from './Notes.js';\nimport { RecordSummaries } from './RecordSummaries.js';\nimport { canDelete } from '../delete.js';\nimport { updateAttempts } from '../updateAttempts.js';\nimport { shell } from '../shellMode.js';\nimport { recordKey as checkedKey } from '../resourceRequests.js';\nimport { countsChanged } from './navCounts.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { say } from '../copy/record/components/PageRelated.js';\nimport { served } from '../addressMount.js';\n\n/* A list of files draws as attachments, fetched the first time a page holds one. */\nconst AttachmentList = onDemand(() => import('./AttachmentList.js'), 'AttachmentList');\nconst CardsList = onDemand(() => import('./CardsList.js'), 'CardsList');\n/* A grouped list is one the page's author asked for; the rest of the record page never draws it. */\nconst GroupedBody = onDemand(() => import('./PageGroups.js'), 'GroupedBody');\nconst Gallery = onDemand(() => import('./Gallery.js'), 'Gallery');\n\n/** The App resource over this table, if there is one. */\nfunction resourceOf(table: TableMeta | undefined): ServedResource | undefined {\n if (!table) return undefined;\n const resources = (shell().app() as { resources?: Record<string, ServedResource> } | null)?.resources ?? {};\n return resources[table.id] ?? resources[table.name];\n}\n\n/** The `file` block of the App resource over this table, when its rows are files. */\nfunction fileOf(table: TableMeta | undefined): ServedResource['file'] {\n return resourceOf(table)?.file;\n}\n\n/** Rows related to the root: the real list. */\nexport function ListSection(props: SlotProps) {\n return <RelatedList {...props} />;\n}\n\n/** Its first page as the server asks it for the page's compose (shared/recordReads.ts): the names and keys a row needs added. */\nexport function listRead(section: SlotProps['section'], plan: SlotProps['plan']) {\n return listView(recordReadNames(), section, plan, section.limit ?? (section.group ? GROUP_ROWS_DEFAULT : (relatedRows() as number)));\n}\n\n/** What a list's rows are called in a sentence: the section's title, or the table's name as the reader says it. */\nexport function listThings(section: SlotProps['section']): string {\n const table = findTable(section.from ?? '') as TableMeta | undefined;\n return (\n section.title ??\n (shell().inApp()\n ? (resourceOf(table)?.noun?.many ?? pluralOf(recordNoun(undefined, table?.name ?? section.from ?? '')))\n : (table?.name ?? section.from ?? ''))\n ).toLocaleLowerCase();\n}\n\n/**\n * The doors a related list offers this reader: the Add of its own, as a list view offers New, and the record's verbs\n * that add to it (`actions`). An empty list that offers one is never taken away, so this is asked by the list when it\n * draws its head and by the page when it decides whether to leave the list out (PageEmptyRun.tsx).\n */\nexport function relatedDoor(\n section: SlotProps['section'],\n base: TableMeta,\n recordKey: Record<string, unknown>,\n context: { preview?: boolean; actions?: RecordActions },\n) {\n const table = findTable(section.from ?? '') as TableMeta | undefined;\n const app = shell().inApp();\n /* A list of files uploads where the reader may add them, whether or not it names a create: the\n file's own columns are the upload's to fill, so there is nothing for a create to say but its label. Any other\n list of the record's children offers its Add as a list view offers New — where this reader may add a row,\n through the child's own New form, bound to the record — unless it says `create: false`, or adds\n through the record's own verbs (`actions`) instead. */\n const noun = (\n app ? (resourceOf(table)?.noun?.one ?? recordNoun(undefined, table?.name ?? section.from ?? '')) : (table?.name ?? '')\n ).toLocaleLowerCase();\n const create = section.noCreate\n ? undefined\n : (section.create ??\n (app && fileOf(table)\n ? { label: say('attachFiles') }\n : app && !section.listActions && !section.similar && noun\n ? { label: say('addThing', { thing: noun }) }\n : undefined));\n /* `actions`: the record's own verbs that add to this list, in its head and not the record's (Page.tsx), each\n offered as the head would offer it — granted, and while its condition holds. */\n const placed =\n section.listActions && app && !context.preview && context.actions\n ? context.actions.list.filter((action) => section.listActions!.includes(action.id))\n : [];\n const creation =\n create && table && state.schema\n ? relatedCreatePlan(state.schema, base.id, table.id, section.path ?? '', create, {\n filter: section.filter,\n })\n : undefined;\n const defaults = creation?.bindings && Object.fromEntries(creation.bindings.map((b) => [b.column, recordKey[b.parent]]));\n /* An Add the list offers on its own stands back where the child needs another record this one cannot name (a work\n order's bike, from its mechanic's page): the author's `create` still offers it, asking for that record. */\n const offeredAlone = section.create === undefined && !(app && fileOf(table));\n const canCreate = Boolean(\n !context.preview &&\n app &&\n table &&\n !(offeredAlone && creation?.otherParents?.length) &&\n canInsert(table) &&\n defaults &&\n Object.values(defaults).every((v) => typeof v === 'string' || typeof v === 'number'),\n );\n return { noun, create, placed, creation, defaults, canCreate, door: canCreate || placed.length > 0 };\n}\n\n/** Rows related to the root, a page at a time — the real list, not a sample of one. */\nfunction RelatedList({ section, plan, base, recordKey, onEdit, collapsed }: SlotProps) {\n const api = usePageApi();\n const { preview, isCurrent, openRelated, connection, recordName, onActionDone, actions: recordActions } = useContext(PageRenderContext);\n const queries = useQueryClient();\n const [added, setAdded] = useState(false);\n const createButton = useRef<HTMLButtonElement>(null);\n const table = findTable(section.from ?? '') as TableMeta | undefined;\n const columnsOf = () =>\n Array.isArray(section.columns) && section.columns.length ? section.columns : (table?.columns ?? []).map((c) => c.name);\n /* A grouped list's `limit` is the rows to a group, and its pages are of groups (PageGroups.tsx). */\n const grouped = Boolean(section.group && plan.groups);\n const limit = section.limit ?? (grouped ? GROUP_ROWS_DEFAULT : (relatedRows() as number));\n const app = shell().inApp();\n const presentation = useMemo(() => listRead(section, plan), [plan.view, section.limit, limit, table, app]); // eslint-disable-line react-hooks/exhaustive-deps\n const { view, labelColumns, keyColumns, labelColumn } = presentation;\n /* A list of the record's own children holds the column that points back\n at it to one value, the record the page is on: like a tab's\n `status = new` in a summary (docs/design.md), it says nothing, so it is\n left out while anything else is shown. A similar list is not held. */\n const hidden = useMemo(() => {\n const back = app && !section.similar && section.path && !section.path.includes('.') ? section.path : undefined;\n const held = presentation.hidden as string[];\n const shown = columnsOf().filter((name) => !held.includes(name));\n return back && shown.includes(back) && shown.length > 1 ? [...held, back] : held;\n }, [presentation, app, section.similar, section.path, section.columns, table]); // eslint-disable-line react-hooks/exhaustive-deps\n const [offset, setOffset] = useState(0);\n const [layout, setLayout] = useState('records');\n /* A list of files waits for its drawing as it waits for its rows, in the section's own skeleton. */\n const attachmentsHere = useArrived(AttachmentList, Boolean(app && fileOf(table)));\n /* Cards and a gallery likewise: each is a part of its own, asked for beside the rows. */\n const asCards = typeof section.presentation === 'object' && section.presentation.kind === 'cards';\n const cardsHere = useArrived(CardsList, asCards);\n const galleryHere = useArrived(Gallery, section.presentation === 'gallery');\n const data = useQuery<ResourceClientReply<'/api/view/run'>>({\n queryKey: ['page-list', view, offset],\n queryFn: () => {\n if (!view) throw new Error(say('thisListHasNoView'));\n return api('/api/view/run', { view, offset });\n },\n enabled: !plan.empty && Boolean(view) && !grouped,\n staleTime: 0,\n });\n /* A grouped list asks its groups first, a page of them at a time; each group's rows follow (PageGroups.tsx). */\n const groupsAsked = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-list', 'groups', plan.groups, offset],\n queryFn: () => api('/api/breakdown', groupsBody(plan.groups!, offset)),\n enabled: !plan.empty && grouped,\n staleTime: 0,\n /* A page of groups turned keeps the one standing until the next is in, so the box holds its height. */\n placeholderData: keepPreviousData,\n });\n /* The footer's sums: one row measured over every related row, planned on\n the server beside the list, so it counts past the page on screen. */\n const sums = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-list', 'totals', plan.totals],\n queryFn: () => api('/api/breakdown', { def: plan.totals! }),\n enabled: !plan.empty && Boolean(plan.totals),\n staleTime: 0,\n });\n /* A similar list is empty when the record has no value to match on — no\n body type — and reads then as one that matched nothing: it has no\n reference to be missing. */\n /* Left out, or said in one line with its neighbours, while it has no rows, is the page's to decide: it alone sees\n the lists beside this one (PageEmptyRun.tsx). The line asks this list for its Add alone, below. */\n if (collapsed && plan.empty) return null;\n /* What the rows are called in a sentence: the section's title, or the table's name as the reader says it. */\n const things = listThings(section);\n const nothingYet = things ? say('common.noYet', { things }) : say('nothingHereYet');\n if (plan.empty && section.similar) {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={section.empty ? <ListEmpty spec={section.empty} /> : <Empty className=\"page-group-empty\" text={nothingYet} />}\n />\n );\n }\n /* The record names no parent to list through. Said as the reader would\n say it — which reference is unset, and so what cannot be shown — with no\n header row over nothing: \"This record has no account_id to list\n through\" named a column, and the empty grid under it looked broken. */\n if (plan.empty) {\n const reference = section.of\n ? app\n ? ((columnLabel(base.id, section.of) as string | null) ?? humanName(section.of)).replace(/[\\s_]+id$/i, '').toLocaleLowerCase()\n : section.of\n : 'reference';\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={<Empty text={say('noIsSetSoThere', { reference, things: things || say('recordsNoun') })} />}\n />\n );\n }\n if (!view) return <SectionBox section={section} body={null} foldable={false} broken={say('thisListHasNoView')} />;\n if (\n (grouped ? groupsAsked.isPending : data.isPending) ||\n (!attachmentsHere && app && fileOf(table)) ||\n (asCards && !cardsHere) ||\n (section.presentation === 'gallery' && !galleryHere)\n )\n return <Loading section={section} />;\n const asking = grouped ? groupsAsked : data;\n if (asking.isError) return <SectionBox section={section} body={null} foldable={false} broken={(asking.error as Error).message} />;\n const groupsGot = grouped && groupsAsked.data && !('errors' in groupsAsked.data) ? groupsAsked.data : undefined;\n /* A grouped list draws its rows group by group (PageGroups.tsx): the flat read below stands as an empty page. */\n const got = grouped ? ((groupsGot ? { view: view, columns: [], rows: [] } : undefined) as typeof data.data) : data.data;\n if (!got || !('view' in got))\n return <SectionBox section={section} body={null} foldable={false} broken={got?.errors[0]?.message ?? say('thisListCouldNotBeRead')} />;\n /* Its children's names say the word that tells them apart, not the page's title again. */\n const rows = app && !section.similar ? withoutParentName(got.rows, Object.values(labelColumns), recordName) : got.rows;\n const summed = sums.data && 'rows' in sums.data ? ((sums.data.rows?.[0] ?? {}) as Record<string, unknown>) : undefined;\n const totals =\n section.totals?.length && plan.totals\n ? Object.fromEntries(section.totals.map((column, i) => [column, summed ? (summed[`total_${i}`] ?? 0) : undefined]))\n : undefined;\n const noRows = grouped ? (groupsGot?.rows.length ?? 0) === 0 : rows.length === 0;\n const authoredEmpty = offset === 0 && noRows && section.empty ? <ListEmpty spec={section.empty} /> : undefined;\n /* In an App an empty list is the empty sentence, not a header row over nothing. */\n const plainEmpty = app && offset === 0 && noRows ? <Empty text={section.title ? nothingYet : say('noRelatedRecordsYet')} /> : undefined;\n /* A footer that sums more rows than the page shows says so: \"Total\" under\n two rows that add up to less read as arithmetic gone wrong. */\n const totalsLabel =\n totals && (got.more || offset > 0 || (got.total !== undefined && got.total > rows.length))\n ? got.total === undefined\n ? say('totalAllThings', { things: things || say('recordsNoun') })\n : say('totalAllCountThings', { count: formatNumber(got.total), things: things || say('recordsNoun') })\n : undefined;\n const pinned = pinnedBy(view);\n const recordForRow = (row: Record<string, unknown>, outputs: readonly string[] = got.columns) => {\n const key = recordViewKey(keyColumns, outputs, row);\n // Inferred names live in the authored row. Explicit names must use only\n // the private projection, so a colliding output cannot impersonate them.\n const naming = table && recordLabel(table) === undefined ? row : {};\n return {\n key,\n label: table ? (rowLabel(table, { ...naming, ...pinned, ...key, ...recordViewLabel(labelColumn, outputs, row) }) as string) : '',\n };\n };\n /* The card's name as said on this page: without the page record's name\n before it, and none where it is that name — a review file named by its\n application's reference repeated the heading (\"AL-1006\" twice). The\n foot's \"View …\" still opens it. */\n const cardTitle = (label: string, page: string | undefined): string | null =>\n page?.trim() && label.trim() === page.trim() ? null : String(withoutParent(label, page));\n /* The one current row as a card, or the card saying there is none. */\n if (section.presentation === 'card' && table) {\n const noun = (app ? (resourceOf(table)?.noun?.one ?? recordNoun(undefined, table.name)) : table.name).toLocaleLowerCase();\n const shown = (got.columns ?? []).filter((name) => !(hidden as string[]).includes(name));\n const record = rows[0] ? recordForRow(rows[0]) : undefined;\n return (\n <section className={`${sectionClass(section)} page-card-section`}>\n <CurrentCard\n table={table}\n caption={section.title}\n row={rows[0]}\n columns={shown}\n show={Array.isArray(section.columns) ? section.columns : undefined}\n referenceLabels={labelColumns}\n labels={(section as { labels?: Record<string, string> }).labels}\n record={record}\n title={record && app ? cardTitle(record.label, recordName) : undefined}\n noun={noun}\n /* Said with the record's noun, never the title: a title is a heading, not a noun (\"In the shop now\" said\n \"No in the shop now right now.\"). */\n empty={authoredEmpty ?? <Empty text={say('noRightNow', { thing: noun })} />}\n />\n </section>\n );\n }\n const summaries = app && table && keyColumns.length > 0 && rows.length > 0;\n /* `rowActions`: each row's own verbs from a ⋯ at its end — the same menu a list view's row has. A verb on a\n child moves the record too (a payment voided marks the order), so the page is read again after it. */\n const offered = section.rowActions && app && !preview && table ? offeredBy(resourceOf(table)).actions : undefined;\n const rowVerbs = offered?.some((action) => action.header !== false) && mayRunAny(shell().app(), table!.id, offered) ? offered : undefined;\n /* The list reads its key under its own output names (recordViewKey); a row's menu, like a list view's, names\n its record by the table's own columns, so they ride on each row, kept out of sight. */\n const keyNames = rowVerbs ? keyColumns.map(({ column }) => column).filter((column) => !(got.columns ?? []).includes(column)) : [];\n const gridRows = rowVerbs ? rows.map((row) => ({ ...row, ...(recordViewKey(keyColumns, got.columns, row) ?? {}) })) : rows;\n const hiddenColumns = new Set<string>(hidden);\n /* Related rows as cards: each row carries its key under its own column\n names, which is what a card opens its record with. */\n const drawn = typeof section.presentation === 'object' ? section.presentation : undefined;\n const cards = drawn?.kind === 'cards' ? drawn : undefined;\n /* An embedded custom list: its component draws the rows, each with its key under its own column names. */\n const custom = drawn?.kind === 'custom' ? drawn : undefined;\n const cardRows = drawn ? rows.map((row) => ({ ...row, ...(recordViewKey(keyColumns, got.columns, row) ?? {}) })) : [];\n /* An embedded board or calendar is drawn by the App's own component, as the view draws it, held to this record: a\n board reads each lane by its own query, so the record's condition is said in the query language. A list reached\n through `of` names its rows by another record's key, so it keeps the rows read here. */\n const lanes = section.lanes;\n const heldKey = Object.values(recordKey);\n const presented =\n lanes && table && app && shell().present && keyColumns.length\n ? shell().present!({\n presentation: lanes,\n table,\n data: { ...got, rows, table: table.id, ms: 0 } as never,\n entry: {\n kind: 'table',\n table: table.id,\n query:\n section.of || section.similar || heldKey.length !== 1\n ? ''\n : andQuery(section.filter, `${section.path} = ${quoteValue(heldKey[0])}`),\n },\n actions: undefined,\n listLabel: section.title ?? spoken(table.name),\n referenceLabels: labelColumns,\n interactive: !preview,\n recordNavigation: true,\n list: undefined,\n current: undefined,\n order: undefined,\n at: { page: 0, size: limit },\n })\n : null;\n const paged = !grouped && !presented && (got.more || offset > 0);\n const { create, placed, creation, defaults, canCreate } = relatedDoor(section, base, recordKey, { preview, actions: recordActions });\n /* The New form a row of this list is added through: the child resource's own\n (its captions, help, groups and narrowed pickers), asking what the create\n shows, starting from the create's defaults, the list's equalities and the\n record's own values it fills — and bound to the record, which it never asks. */\n const createForm = async (): Promise<FormCuration> => {\n const own = resourceOf(table)?.form as FormCuration | undefined;\n const bound = new Set(creation!.bindings!.map((b) => b.column));\n const shown = [...(create!.show ?? formShownFields(own) ?? creation!.show!)].filter((name) => !bound.has(name));\n const fill = Object.entries(creation!.fill ?? {});\n let filled: Record<string, unknown> = {};\n if (fill.length) {\n /* The record's values, read as this reader reads them: a column they cannot read fills nothing. */\n try {\n const data = await coreApi('/api/query', {\n ...ownedBy(connection ?? state.activeConnection),\n table: base.id,\n columns: [...new Set(fill.map(([, parent]) => parent))],\n filter: {\n groups: [Object.entries(recordKey).map(([column, value]) => ({ column, op: '=' as const, value: value as string | number }))],\n },\n limit: 1,\n offset: 0,\n });\n const row = (data.rows as Array<Record<string, unknown>> | undefined)?.[0] ?? {};\n filled = Object.fromEntries(\n fill.flatMap(([child, parent]) => (row[parent] === null || row[parent] === undefined ? [] : [[child, row[parent]]])),\n );\n } catch {\n filled = {};\n }\n }\n return {\n // A row added beside its record stays beside it: the drawer, whatever the resource's own New form opens as.\n ...(own ?? {}),\n show: shown,\n open: 'drawer',\n // Steps carve the resource's own form; a create asks its own fields, on one page.\n steps: create!.show\n ? undefined\n : own?.steps\n ?.map((step) => ({ ...step, fields: step.fields.filter((name) => shown.includes(name)) }))\n .filter((step) => step.fields.length),\n defaults: { ...(creation!.defaults ?? {}), ...filled, ...defaults },\n };\n };\n const refreshLists = () =>\n void queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n /* A resource whose rows are files draws as attachments: each a download,\n and, where the list may add, an upload bound to this record the way a\n related New form is. The file's own columns are the upload's to fill. */\n const file = app ? fileOf(table) : undefined;\n const owner = connection ?? state.activeConnection;\n /* Rename and Remove are offered where the server would accept them — the\n catalog's own answer for this reader, as the record's Delete asks it —\n and never in a preview, which writes nothing. */\n const nameColumn = file && table ? table.columns.find((column) => column.name === file.name) : undefined;\n const connectionWritable = Boolean(state.connections?.some((c: { id: string; writable?: boolean }) => c.id === owner && c.writable));\n const renamable = Boolean(\n !preview &&\n file &&\n table &&\n nameColumn &&\n !nameColumn.primaryKey &&\n nameColumn.writable !== false &&\n !table.isView &&\n writeAllowed(table.id) &&\n connectionWritable,\n );\n /* A grouped list's rows move between groups, and to their place in a ranked one (groupMoves.tsx), on the board's\n two paths: an ordinary update of the grouped column where this reader may write it, else the one command of the\n row's own that takes the group (`moveToSprint` with `{ sprint }`), asked nothing more. A ranked list is one read\n in a single number column, ascending, that the reader may write, as a list view's hand order is. */\n const groupMoves = ((): GroupMoves | undefined => {\n const by = section.group?.by;\n if (!grouped || !app || preview || !table || !by || by.includes('.') || !keyColumns.length || table.isView) return undefined;\n const may = (name: string) => {\n const column = table.columns.find((c) => c.name === name);\n return Boolean(\n column &&\n !column.primaryKey &&\n column.writable !== false &&\n column.changesBy !== 'actions' &&\n writeAllowed(table.id) &&\n connectionWritable,\n );\n };\n const parent = state.schema\n ? (groupTable(state.schema as DatabaseSchema, { from: table.id, group: section.group }) as TableMeta | undefined)\n : undefined;\n type Said = Record<string, string | number | boolean | null>;\n const write = async (key: Record<string, unknown>, values: Said, expected: Said) => {\n if (isCurrent && !isCurrent()) return { message: say('thisPageHasMoved'), refused: false };\n const outcome = await updateAttempts.run({ connection: owner ?? null, table: table.id, key }, values, () =>\n coreApi('/api/update', { ...ownedBy(owner), table: table.id, key: checkedKey(key), values, expected }),\n );\n return outcome.kind === 'applied'\n ? null\n : { message: outcome.message ?? '', refused: outcome.kind === 'rejected' || outcome.kind === 'blocked' };\n };\n const verb = may(by)\n ? undefined\n : (offeredBy(resourceOf(table))?.actions ?? [])\n .flatMap((action) => {\n if (action.command === undefined) return [];\n const takes = action.command.input.filter(\n (field) => field.name === by || (field.type === 'reference' && parent !== undefined && field.from === parent.id),\n );\n const rest = action.command.input.filter((field) => !takes.includes(field) && 'required' in field && field.required);\n const run =\n takes.length === 1 && !rest.length ? shell().slots.recordCommand?.(action.command, String(action.label)) : undefined;\n return run ? [{ run, input: takes[0].name, required: Boolean((takes[0] as { required?: boolean }).required) }] : [];\n })\n .at(0);\n if (!may(by) && !verb) return undefined;\n const order = (view?.orderBy ?? []) as Array<{ path: string; direction?: string }>;\n const sort = order.length === 1 ? order[0] : undefined;\n const rankColumn = sort && sort.direction !== 'desc' ? table.columns.find((c) => c.name === sort.path) : undefined;\n const ranked =\n rankColumn && may(rankColumn.name) && /int|real|num|dec|double|float|serial/i.test(rankColumn.type ?? '') ? rankColumn : undefined;\n return {\n keyOf: (row, columns) => {\n const key = recordViewKey(keyColumns, columns, row);\n const id = key ? rowKeyString(table, key) : null;\n return key && id ? { key, id } : null;\n },\n labelOf: (row, columns) => recordForRow(row, [...columns]).label,\n enters: (key) => (key === null || key === undefined ? may(by) || (verb !== undefined && !verb.required) : true),\n regroup: async (key, _label, from, to) => {\n if (verb) {\n const outcome = await verb.run(key as Record<string, string | number>, { [verb.input]: to ?? null });\n // A refusal is said where it was refused (the command's own pipeline).\n return outcome.status === 'applied' || outcome.status === 'done' ? null : '';\n }\n const failed = await write(key, { [by]: (to ?? null) as Said[string] }, { [by]: (from ?? null) as Said[string] });\n return failed ? failed.message : null;\n },\n ...(ranked\n ? {\n rank: {\n column: ranked.name,\n whole: wholeColumn(ranked.type),\n write: (key: Record<string, unknown>, _label: string, value: number, expected: unknown) =>\n write(key, { [ranked.name]: value }, { [ranked.name]: (expected ?? null) as Said[string] }),\n },\n }\n : {}),\n done: async () => {\n await queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n void shell().undo.refresh();\n countsChanged();\n },\n };\n })();\n const removable = Boolean(!preview && file && table && canDelete(table));\n const renameFile = async (rowKey: Record<string, unknown>, next: string, original: string | null): Promise<string | null> => {\n if (!table || !file || (isCurrent && !isCurrent())) return say('thisPageHasMoved');\n const values = { [file.name]: next };\n const outcome = await updateAttempts.run({ connection: owner ?? null, table: table.id, key: rowKey }, values, () =>\n coreApi('/api/update', { ...ownedBy(owner), table: table.id, key: checkedKey(rowKey), values, expected: { [file.name]: original } }),\n );\n if (outcome.kind !== 'applied') return outcome.message;\n void shell().undo.refresh();\n refreshLists();\n return null;\n };\n const removeFile = async (rowKey: Record<string, unknown>): Promise<string | null> => {\n if (!table || (isCurrent && !isCurrent())) return say('thisPageHasMovedOn');\n try {\n const result = (await coreApi('/api/delete', { ...ownedBy(owner), table: table.id, key: checkedKey(rowKey), confirm: true })) as {\n deleted?: boolean | null;\n errors?: Array<{ message: string }>;\n };\n if (result?.deleted !== true || result.errors?.length) return result?.errors?.[0]?.message ?? say('theFileWasNotRemoved');\n refreshLists();\n countsChanged();\n return null;\n } catch (error) {\n return (error as Error).message;\n }\n };\n const lease = filesOnLease();\n const attachments =\n file && table\n ? rows.flatMap((row) => {\n const rowKey = recordViewKey(keyColumns, got.columns, row);\n if (!rowKey) return [];\n const name =\n String(row[file.name] ?? '') || rowLabel(table, { ...pinned, ...rowKey, ...recordViewLabel(labelColumn, got.columns, row) });\n const meta = (got.columns ?? [])\n .filter(\n (column) =>\n ![file.name, file.content, file.type, file.thumbnail].includes(column) &&\n !(keyColumns as ReadonlyArray<{ column: string }>).some((key) => key.column === column) &&\n !(hidden as string[]).includes(column) &&\n row[column] != null &&\n row[column] !== '',\n )\n .map((column) =>\n column === file.size ? formatBytes(Number(row[column])) : (formatRelativeDay(String(row[column])) ?? String(row[column])),\n );\n const href = served(`/api/file?${new URLSearchParams({ ...ownedBy(owner), table: table.id, key: JSON.stringify(rowKey) })}`);\n const type = file.type && typeof row[file.type] === 'string' ? (row[file.type] as string) : undefined;\n return [\n {\n id: JSON.stringify(rowKey),\n name,\n href,\n meta,\n ...(type ? { type } : {}),\n inline: inlineFileAddress(table.id, rowKey, owner),\n ...(lease ? { save: () => saveFileOnLease(table.id, rowKey) } : {}),\n onOpen: () => void openRecord(table.id, rowKey, name),\n ...(renamable\n ? { rename: (next: string) => renameFile(rowKey, next, row[file.name] == null ? null : String(row[file.name])) }\n : {}),\n ...(removable ? { remove: () => removeFile(rowKey) } : {}),\n },\n ];\n })\n : [];\n /* A caption is words: a reference (the building the photo hangs from) or a number (its place in the order) says\n nothing under a picture, and read as \"· 1 · 1\". */\n const captions = (column: string) => {\n const meta = table?.columns.find((candidate) => candidate.name === column);\n return Boolean(meta && !meta.references && columnKind(meta.type) === 'text');\n };\n /* A gallery is the same rows as photos, drawn in place through the file\n route's inline mode; the shown columns that are not the file's own are\n each photo's caption. A resource whose rows are not files keeps its grid. */\n const gallery =\n /* On a tenant lease a photo has no address to draw in place (fileSource.ts): the files are listed instead. */\n section.presentation === 'gallery' && file && table && !lease\n ? rows.flatMap((row) => {\n const rowKey = recordViewKey(keyColumns, got.columns, row);\n if (!rowKey) return [];\n const words = (got.columns ?? [])\n .filter(\n (column) =>\n ![file.name, file.content, file.type, file.size, file.thumbnail].includes(column) &&\n !(keyColumns as ReadonlyArray<{ column: string }>).some((key) => key.column === column) &&\n !(hidden as string[]).includes(column) &&\n row[column] != null &&\n row[column] !== '' &&\n captions(column),\n )\n .map((column) => String(row[column]));\n const alt = words[0] ?? String(row[file.name] ?? '');\n return [\n {\n id: JSON.stringify(rowKey),\n src: inlineFileAddress(table.id, rowKey, owner),\n ...(file.thumbnail ? { thumb: inlineFileAddress(table.id, rowKey, owner, 'thumb') } : {}),\n alt,\n ...(words.length ? { caption: words.join(' · ') } : {}),\n },\n ];\n })\n : undefined;\n const send = async (picked: File): Promise<string | null> => {\n if (!table || (isCurrent && !isCurrent())) return say('thisPageHasMovedOnNothing');\n try {\n /* The encoder is the attachment list's, here since its Attach button was. */\n const { fileToBase64 } = await import('./AttachmentList.js');\n /* The file's row starts as a New from this list would: the create's\n defaults and the list's equalities, then the binding to this record. */\n const data = (await coreApi('/api/file/upload', {\n table: table.id,\n values: { ...creation!.defaults, ...defaults },\n ...ownedBy(connection),\n file: { name: picked.name, type: picked.type, data: await fileToBase64(picked) },\n })) as { errors?: Array<{ message: string }> };\n if (data?.errors?.length) return data.errors[0].message;\n setOffset(0);\n refreshLists();\n return null;\n } catch (error) {\n return (error as Error).message;\n }\n };\n /* The list's verbs stand in its heading's row, after the heading, and go under it where the column is narrow,\n from the same edge: an aside's related list kept them on a row of their own, pushed to the far side. */\n /* A placed verb is the App's (Actions.tsx), and an embedded list's own component with the page's side of\n @mistriwork/mistri/ui (sdk/CustomList.tsx): each drawn through the shell's slot. */\n const { ActionBar, CustomList } = shell().slots;\n const tools =\n (canCreate && !file) || placed.length > 0 ? (\n <div className=\"page-related-create\">\n {added && <span role=\"status\">{say('recordAdded')}</span>}\n {placed.length > 0 && ActionBar && (\n <ActionBar\n tableId={base.id}\n actions={placed}\n recordKey={recordKey}\n label={recordName ?? ''}\n matches={recordActions!.matches}\n queryScope={recordActions!.queryScope}\n isCurrent={isCurrent}\n only={section.listActions}\n quiet\n canUpdate={recordActions!.canUpdate}\n grantedCommands={recordActions!.grantedCommands}\n grantedActions={recordActions!.grantedActions}\n onDone={() => {\n refreshLists();\n /* The record moved too (its counts, its stage): read again as the head's own verbs read it. */\n if (onActionDone) onActionDone();\n else onEdit({ inPlace: false });\n }}\n />\n )}\n {canCreate && !file && (\n <button\n type=\"button\"\n className=\"ghost\"\n ref={createButton}\n onClick={() => {\n if (isCurrent && !isCurrent()) return;\n setAdded(false);\n void createForm().then((form) =>\n isCurrent && !isCurrent()\n ? undefined\n : (openRelated ?? openRelatedRecord)(table!, form, () => {\n if (isCurrent && !isCurrent()) return;\n setAdded(true);\n setOffset(0);\n void queries.invalidateQueries({\n predicate: (query) =>\n ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n createButton.current?.focus();\n }),\n );\n }}\n >\n + {create!.label}\n </button>\n )}\n </div>\n ) : undefined;\n /* An empty list said in one line: only its Add stands there, an upload for a list of files. */\n if (collapsed)\n return file && canCreate ? (\n <AttachmentList\n items={[]}\n empty={false}\n emptyText=\"\"\n upload={{ label: create!.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send }}\n />\n ) : (\n (tools ?? null)\n );\n return (\n <SectionBox\n section={section}\n foldable={false}\n tools={tools}\n body={\n <div className=\"page-list-body\">\n {(file ? undefined : authoredEmpty) ??\n (grouped && groupsGot && view ? (\n <GroupedBody\n section={section}\n groups={groupsGot}\n offset={offset}\n perPage={section.group?.limit ?? GROUPS_DEFAULT}\n onOffset={setOffset}\n view={view}\n labelColumns={labelColumns}\n rowsPerGroup={limit}\n {...(groupMoves ? { moves: groupMoves } : {})}\n overall={\n summed && totals\n ? { label: say('totalAllThings', { things: things || say('recordsNoun') }), sums: totals as Record<string, unknown> }\n : undefined\n }\n grid={(data, subtotals, subtotalsLabel) => {\n /* Each group's table draws the same ⋯ an ungrouped list does: its own rows carry their keys, and\n the host/menu pair belongs to this table alone, so one group's menu never reaches another's. */\n const keyed = rowVerbs || groupMoves;\n const groupKeys = keyed\n ? keyColumns.map(({ column }) => column).filter((column) => !(data.columns ?? []).includes(column))\n : [];\n const groupRows = keyed\n ? ((data.rows ?? []) as Array<Record<string, unknown>>).map((row) => ({\n ...row,\n ...(recordViewKey(keyColumns, data.columns ?? [], row) ?? {}),\n }))\n : data.rows;\n const table_ = (\n <Grid\n table={table}\n sizing={section.sizing}\n data={keyed ? { ...data, rows: groupRows, columns: [...(data.columns ?? []), ...groupKeys] } : data}\n hide={[...hidden, ...groupFactPaths(section), ...groupKeys, '__rank']}\n referenceLabels={labelColumns}\n totals={subtotals}\n totalsLabel={subtotalsLabel}\n interactive={false}\n virtual={false}\n dropColumns\n emptyText={say('noRelatedRecordsYet')}\n onRowClick={\n table && keyColumns.length\n ? (row) => {\n const record = recordForRow(row, data.columns ?? []);\n if (record.key) void openRecord(table.id, record.key, record.label);\n }\n : undefined\n }\n />\n );\n return rowVerbs ? (\n <RowTrailHosts>\n <RowActions\n table={table!}\n rows={groupRows as Array<Record<string, unknown>>}\n actions={rowVerbs}\n onDone={() => {\n refreshLists();\n onActionDone?.();\n }}\n />\n {table_}\n </RowTrailHosts>\n ) : (\n table_\n );\n }}\n />\n ) : presented ? (\n presented.element\n ) : custom && table && CustomList ? (\n cardRows.length ? (\n <CustomList\n table={table}\n rows={cardRows}\n spec={custom}\n interactive={!preview}\n label={section.title ?? spoken(table.name)}\n page={{ index: Math.floor(offset / Math.max(1, limit)), size: limit }}\n />\n ) : (\n <Empty className=\"page-group-empty\" text={nothingYet} />\n )\n ) : cards && table ? (\n cardRows.length ? (\n <CardsList table={table} rows={cardRows} spec={cards} label={section.title ?? spoken(table.name)} />\n ) : (\n <Empty className=\"page-group-empty\" text={nothingYet} />\n )\n ) : gallery ? (\n <>\n {/* A gallery's New is an upload, for a reader who may add the files; everyone else sees the photos. */}\n {canCreate && (\n <AttachmentList\n items={[]}\n empty={false}\n emptyText=\"\"\n upload={{ label: create!.label, maxBytes: file!.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send }}\n />\n )}\n <Gallery\n items={gallery}\n label={section.title ?? say('photos')}\n emptyText={section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noPhotosYet')}\n />\n </>\n ) : file ? (\n <AttachmentList\n items={attachments}\n empty={authoredEmpty}\n emptyText={section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noFilesYet')}\n upload={canCreate ? { label: create!.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send } : undefined}\n />\n ) : (\n (plainEmpty ?? (\n <div className={summaries ? `responsive-results page-related-results show-${layout}` : undefined}>\n {summaries && (\n <>\n <PresentationSwitch\n layout={layout}\n onChange={setLayout}\n label={say('common.listPresentation')}\n records={say('common.records')}\n table={say('common.table')}\n />\n {/* A summary's title is the row's name, which on its parent's page says the word alone too. */}\n <RecordSummaries\n table={table}\n data={{ ...got, rows }}\n columns={got.columns.filter((name) => !hiddenColumns.has(name))}\n referenceLabels={labelColumns}\n parent={!section.similar && section.path && !section.path.includes('.') ? section.path : undefined}\n recordForRow={\n section.similar\n ? recordForRow\n : (row) => {\n const record = recordForRow(row);\n return { ...record, label: withoutParent(record.label, recordName) };\n }\n }\n />\n </>\n )}\n <div className=\"result-table\">\n {((grid) =>\n rowVerbs ? (\n <RowTrailHosts>\n <RowActions\n table={table!}\n rows={gridRows}\n actions={rowVerbs}\n onDone={() => {\n refreshLists();\n onActionDone?.();\n }}\n />\n {grid}\n </RowTrailHosts>\n ) : (\n grid\n ))(\n <Grid\n table={table}\n sizing={section.sizing}\n data={{ ...got, rows: gridRows, columns: [...(got.columns ?? columnsOf()), ...keyNames] }}\n hide={keyNames.length ? [...hidden, ...keyNames] : hidden}\n referenceLabels={labelColumns}\n totals={totals}\n totalsLabel={totalsLabel}\n interactive={false}\n virtual={false}\n /* Beside an aside the main column is narrow: columns past the room are left out, the name and status kept, rather than cut at the edge. */\n dropColumns\n emptyText={\n app\n ? section.title\n ? say('common.noYet', { things: section.title.toLocaleLowerCase() })\n : say('noRelatedRecordsYet')\n : say('noForThisRecord', { name: table?.name ?? section.from ?? '' })\n }\n onRowClick={\n table && keyColumns.length\n ? (row) => {\n const record = recordForRow(row);\n if (record.key) void openRecord(table.id, record.key, record.label);\n }\n : undefined\n }\n />,\n )}\n </div>\n </div>\n ))\n ))}\n {paged && (\n <div className=\"page-pager\">\n <span className=\"step-control\">\n <button\n type=\"button\"\n className=\"step-button\"\n aria-label={say('previousRows')}\n disabled={offset === 0}\n onClick={() => setOffset(Math.max(0, offset - limit))}\n >\n <Icon name=\"caret-left\" size={16} />\n </button>\n <span className=\"page-range step-position\">\n {`${formatNumber(offset + 1)}–${formatNumber(offset + rows.length)}${got.total === undefined ? '' : say('common.ofTotal', { total: formatNumber(got.total) })}`}\n </span>\n <button\n type=\"button\"\n className=\"step-button\"\n aria-label={say('moreRows')}\n disabled={!got.more}\n onClick={() => setOffset(offset + limit)}\n >\n <Icon name=\"caret-right\" size={16} />\n </button>\n </span>\n </div>\n )}\n </div>\n }\n />\n );\n}\n","/** What PageEmptyRun 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 noThingsYet: 'No {things} yet',\n});\n","/**\n * Related lists that may be left out while they have no rows (`empty: 'hide' | 'collapse'`, or the page's), decided\n * where a run of them stands, because only the page sees the lists beside each one. Each list is asked the question\n * it asks itself (the same query, so the answer is shared), and then:\n *\n * - a list with rows is drawn as ever;\n * - an empty one that hides is left out, unless the reader may add to it: a door is never taken away, so it collapses;\n * - empty ones that collapse, side by side, are one quiet line where the first stood — \"No charges, payments or notes\n * yet\" — each with its Add, instead of one \"No … yet\" sentence under each of several headings;\n * - a tab keeps at least one list: where a tab holds nothing but lists and they are all empty, they are said in a\n * line rather than leaving the tab blank.\n *\n * Inside a `listTabs` strip an empty list is neither hidden nor collapsed: its tab shows it (PageSections.tsx).\n */\nimport { shellRoot } from '../shellHost.js';\nimport { useContext, type ReactNode } from 'react';\nimport { useQueries } from '@tanstack/react-query';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { PageSection, SectionPlan } from './pageModel.js';\nimport { rootMatches } from './pageModel.js';\nimport { PageRenderContext, usePageApi } from './pageContext.js';\nimport { listRead, listThings, relatedDoor } from './PageRelated.js';\nimport { groupsBody } from '@mistriwork/engine/shared/recordReads.js';\nimport { Empty } from './Notes.js';\nimport { say } from '../copy/record/components/PageEmptyRun.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\n\ninterface RunItem {\n section: PageSection;\n index: number;\n}\n\n/** What a list is, for deciding: waiting to know, with rows (or broken, which it says itself), or empty. */\ntype Standing = 'wait' | 'rows' | 'empty' | 'gone';\n\n/** The names said as a sentence's list: \"charges, payments or notes\". */\nfunction said(names: string[]): string {\n try {\n return new Intl.ListFormat(shellRoot().lang || undefined, { type: 'disjunction', style: 'long' }).format(names);\n } catch {\n return names.join(', ');\n }\n}\n\nexport function EmptyRun({\n items,\n plans,\n base,\n recordKey,\n draw,\n rescue,\n}: {\n items: RunItem[];\n plans: SectionPlan[];\n base: TableMeta;\n recordKey: Record<string, unknown>;\n /** One list as the page draws it; `collapsed` draws only its Add. */\n draw: (item: RunItem, collapsed?: boolean) => ReactNode;\n /** The run is all a tab holds: it never leaves the tab with nothing. */\n rescue: boolean;\n}) {\n useMessageLanguage();\n const api = usePageApi();\n const context = useContext(PageRenderContext);\n const planOf = (item: RunItem): SectionPlan => plans.find((p) => p.index === item.index) ?? { index: item.index };\n const reads = items.map((item) => listRead(item.section, planOf(item)).view);\n const asked = useQueries({\n queries: items.map((item, i) => {\n const plan = planOf(item);\n const view = reads[i];\n /* A grouped list is empty when it has no groups: it asks the groups it asks itself (PageRelated.tsx). */\n if (item.section.group && plan.groups) {\n const groups = plan.groups;\n return {\n queryKey: ['page-list', 'groups', groups, 0],\n queryFn: () => api('/api/breakdown', groupsBody(groups, 0)),\n enabled: !plan.empty && !plan.error,\n staleTime: 0,\n };\n }\n return {\n queryKey: ['page-list', view, 0],\n queryFn: () => api('/api/view/run', { view: view!, offset: 0 }),\n enabled: !plan.empty && !plan.error && Boolean(view),\n staleTime: 0,\n };\n }),\n });\n const gates = useQueries({\n queries: items.map((item) => ({\n queryKey: ['when', base.id, recordKey, item.section.when ?? `none-${item.index}`],\n queryFn: () => rootMatches(base, recordKey, item.section.when!, context.connection),\n enabled: Boolean(item.section.when),\n staleTime: 0,\n })),\n });\n const standing = (i: number): Standing => {\n const { section } = items[i];\n const plan = planOf(items[i]);\n if (section.when && gates[i].data !== true) return gates[i].isPending ? 'wait' : 'gone';\n if (plan.error) return 'rows';\n if (plan.empty) return 'empty';\n const grouped = Boolean(section.group && plan.groups);\n if (!reads[i] && !grouped) return 'rows';\n const got = asked[i].data;\n if (asked[i].isPending) return 'wait';\n if (grouped) return got && !('errors' in got) && got.rows.length === 0 ? 'empty' : 'rows';\n return got && 'view' in got && got.rows.length === 0 ? 'empty' : 'rows';\n };\n const states = items.map((_, i) => standing(i));\n /* Nothing here is drawn as a list: the run is all that stands in its tab, so it may not vanish. */\n const nothingElse = rescue && states.every((state) => state === 'empty' || state === 'gone') && states.includes('empty');\n const door = (item: RunItem) => relatedDoor(item.section, base, recordKey, { preview: context.preview, actions: context.actions }).door;\n\n const laid: ReactNode[] = [];\n let line: RunItem[] = [];\n const flush = () => {\n if (!line.length) return;\n const group = line;\n line = [];\n const adds = group.map((item) => draw(item, true));\n laid.push(\n <Empty\n key={`empty-${group[0].index}`}\n className=\"page-empty-run\"\n text={say('noThingsYet', { things: said(group.map((item) => listThings(item.section))) })}\n action={adds.some(Boolean) ? <>{adds}</> : undefined}\n />,\n );\n };\n items.forEach((item, i) => {\n const state = states[i];\n if (state === 'gone') return;\n if (state !== 'empty') {\n flush();\n laid.push(draw(item));\n return;\n }\n if (item.section.emptyMode === 'collapse' || nothingElse || door(item)) line.push(item);\n });\n flush();\n return <>{laid}</>;\n}\n","/**\n * How a page's sections are laid out: which are shown in which region, and\n * how neighbors group — a run of metrics is one strip, a run of lists is a\n * tab strip whose tabs are fetched when opened, and sections named into tabs (`tab`) are one strip of\n * panels standing where the first of them stands. Each section is a Slot:\n * gated by its `when`, then handed to the module that draws its kind.\n */\nimport { tabMatches } from '@mistriwork/engine/shared/addressParams.js';\nimport { shell } from '../shellMode.js';\nimport { useContext, useEffect, useId, useRef, useState, type ReactNode } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { findTable } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { rootMatches, sectionClass, type PageDef, type PageEntry, type PageSection, type SectionPlan } from './pageModel.js';\nimport { PageRenderContext, inAppPage, spoken, usePageApi, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { FieldsSection } from './PageFields.js';\nimport { BreakdownSection, ChartSection, MetricSection } from './PageMetrics.js';\nimport { DashboardNote } from './DashboardNote.js';\nimport { TimelineSection } from './PageTimeline.js';\nimport type { HistoryApi } from './PageHistory.js';\nimport type { FlowsApi } from './PageFlows.js';\nimport { ListSection } from './PageRelated.js';\nimport { EmptyRun } from './PageEmptyRun.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { useTabFold } from './useTabFold.js';\nimport { DropItem, DropMenu } from '@mistriwork/ui/DropMenu.js';\nimport { message } from '../messages.js';\nimport { ErrorBoundary } from './ErrorBoundary.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { assertNever } from '@mistriwork/engine/shared/model.js';\nimport { appTargetFields } from '@mistriwork/engine/shared/appLinks.js';\nimport { readPageFields } from './pageFieldsRead.js';\nimport { pathEqualityFilter } from '../resourceRequests.js';\nimport { resourceOf } from './appRooms.js';\n\n/* A record's history, fetched the first time a page holds one. */\nconst RecordHistory = onDemand(() => import('./PageHistory.js'), 'RecordHistory');\n/* A record's flow runs, fetched the first time a page holds one. */\nconst RecordFlows = onDemand(() => import('./PageFlows.js'), 'RecordFlows');\n/* A flow's steps drawn, fetched the first time a page holds one: no first page carries it. */\nconst FlowDiagram = onDemand(() => import('./PageFlowDiagram.js'), 'FlowDiagram');\n\n/* The page's request and its section chrome, handed to the custom section: an author's component, and the page's\n side of @mistriwork/mistri/ui with it (sdk/CustomSection.tsx), drawn through the shell's slot. */\nfunction CustomSlot(props: SlotProps) {\n const pageApi = usePageApi();\n const { preview } = useContext(PageRenderContext);\n const { CustomSection } = shell().slots;\n return CustomSection ? <CustomSection {...props} frame={{ pageApi, preview, Loading, SectionBox }} /> : null;\n}\n\n/** One section: gated by its `when`, loading until its data is here, broken in place if it cannot run. */\nfunction Slot(props: SlotProps) {\n const { connection } = useContext(PageRenderContext);\n const { section, base, recordKey: key, plan } = props;\n const gate = useQuery({\n queryKey: ['when', base.id, key, section.when],\n queryFn: () => rootMatches(base, key, section.when!, connection),\n enabled: Boolean(section.when),\n staleTime: 0,\n });\n if (section.when && gate.data !== true) return null;\n if (plan.error && section.kind !== 'fields') return <SectionBox section={section} body={null} foldable={false} broken={plan.error} />;\n switch (section.kind) {\n case 'fields':\n return <FieldsSection {...props} />;\n case 'metric':\n return <MetricSection {...props} />;\n case 'breakdown':\n return <BreakdownSection {...props} />;\n case 'chart':\n return <ChartSection {...props} />;\n case 'note':\n return <NoteSection {...props} />;\n case 'timeline':\n return <TimelineSection {...props} />;\n case 'history':\n return <HistorySlot {...props} />;\n case 'flows':\n return <FlowsSlot {...props} />;\n case 'diagram':\n return <DiagramSlot {...props} />;\n case 'custom':\n return <CustomSlot {...props} />;\n case 'list':\n return <ListSection {...props} />;\n default:\n return assertNever(section.kind);\n }\n}\n\n/* The history section is handed the page's reads and frame, so it need not\n import them (PageHistory.tsx says why). */\nfunction HistorySlot({ section, base, recordKey }: SlotProps) {\n const api = usePageApi() as unknown as HistoryApi;\n const { preview } = useContext(PageRenderContext);\n /* Until its module is here the section waits as its first read does, in its own skeleton. */\n const here = useArrived(RecordHistory);\n /* A record's history is the operator's, and its route is behind sign-in:\n asked for a public visitor, its 401 drew the sign-in screen over a page\n the visitor may read. The storefront leaves it out (docs/design.md). */\n if (shell().publicVisitor() && !preview) return null;\n if (!here) return <Loading section={section} />;\n return (\n <RecordHistory\n section={section}\n base={base}\n recordKey={recordKey}\n api={api}\n preview={preview}\n loading={<Loading section={section} />}\n frame={(body, broken) => <SectionBox section={section} body={body} foldable={false} broken={broken} />}\n />\n );\n}\n\n/* The flows section is handed the page's reads and frame as the history's is. Its route is the operator's too,\n behind sign-in, so a public visitor's page leaves it out. */\nfunction FlowsSlot({ section, base, recordKey }: SlotProps) {\n const api = usePageApi() as unknown as FlowsApi;\n const { preview } = useContext(PageRenderContext);\n const here = useArrived(RecordFlows);\n if (shell().publicVisitor() && !preview) return null;\n if (!here) return <Loading section={section} />;\n return (\n <RecordFlows\n base={base}\n recordKey={recordKey}\n api={api}\n preview={preview}\n loading={<Loading section={section} />}\n frame={(body, broken) => <SectionBox section={section} body={body} foldable={false} broken={broken} />}\n />\n );\n}\n\n/* A flow's diagram reads its steps as the reader's rows, through the page's own reads, and is framed as the flows\n are. The steps table is the one the App's flows binding names for this page's table (shared/app.ts), as this\n reader's catalog has it: a reader who cannot read the steps is shown none. On a record's page it draws the\n record's run, whose route is the operator's, behind sign-in, so a public visitor's page leaves it out. */\nfunction DiagramSlot({ section, base, recordKey }: SlotProps) {\n const api = usePageApi() as unknown as FlowsApi;\n const { preview } = useContext(PageRenderContext);\n const here = useArrived(FlowDiagram);\n const diagram = resourceOf(shell().app(), base.id)?.flowDiagram;\n if (diagram?.run && shell().publicVisitor() && !preview) return null;\n if (!here) return <Loading section={section} />;\n return (\n <FlowDiagram\n base={base}\n recordKey={recordKey}\n diagram={diagram}\n steps={diagram ? findTable(diagram.steps) : undefined}\n api={api}\n preview={preview}\n loading={<Loading section={section} />}\n frame={(body, broken) => <SectionBox section={section} body={body} foldable={false} broken={broken} />}\n />\n );\n}\n\nconst noTargetLinks = () => null;\n\n/* Bound navigation reads only its explicit, schema-visible source fields, through the page's ordinary reader. */\nfunction NoteSection({ section, page, base, recordKey }: SlotProps) {\n useMessageLanguage();\n const api = usePageApi();\n const { connection, preview, isCurrent } = useContext(PageRenderContext);\n /* The suite's links are the App framework's (shellMode.ts `useTargetLinks`): none where the shell has none, and nothing read for them. */\n const scope = (shell().slots.useTargetLinks ?? noTargetLinks)();\n const columns = section.action && 'to' in section.action ? appTargetFields(section.action.to) : [];\n const keys = base.columns.filter((column) => column.primaryKey).map((column) => column.name);\n const readable =\n Boolean(scope) &&\n !preview &&\n columns.length > 0 &&\n columns.every((name) => base.columns.some((column) => column.name === name)) &&\n keys.length > 0 &&\n keys.every((name) => Object.hasOwn(recordKey, name) && recordKey[name] !== null && recordKey[name] !== undefined);\n const data = useQuery({\n queryKey: ['page-link-fields', scope?.owner.epoch, page.id, base.id, recordKey, columns],\n enabled: readable,\n queryFn: () =>\n readPageFields(\n {\n owner: connection ?? '',\n pageId: page.id,\n base,\n filter: pathEqualityFilter(Object.fromEntries(keys.map((name) => [name, recordKey[name]]))),\n columns,\n },\n (body) => api('/api/view/run', body),\n ),\n staleTime: 0,\n });\n const row = readable && (!isCurrent || isCurrent()) && data.data && 'view' in data.data ? data.data.rows[0] : undefined;\n return (\n <section className={sectionClass(section)}>\n <DashboardNote\n title={section.title}\n text={section.text ?? ''}\n icon={section.icon}\n variant={section.variant}\n action={preview && section.action && 'to' in section.action ? undefined : section.action}\n row={row}\n />\n </section>\n );\n}\n\ninterface Shown {\n section: PageSection;\n index: number;\n}\ninterface Tab {\n key: string | number;\n token: string;\n label: ReactNode;\n}\n\n/** Names across the top, one panel under them, each panel drawn the first time it is opened (or at once, where `eager`). */\nexport function TabStrip({\n tabs,\n name,\n entry,\n onTab,\n draw,\n scoped,\n eager = [],\n className = '',\n}: {\n tabs: Tab[];\n name: string;\n entry: PageEntry;\n onTab: (tab: string | undefined) => void;\n draw: (i: number) => ReactNode;\n scoped: boolean;\n eager?: number[];\n className?: string;\n}) {\n const id = useId();\n // An address says a tab as its word (appAddress.ts): matched by the token or by it.\n const asked = tabs.findIndex((tab) => tabMatches(tab.token, entry.tab));\n const [active, setActive] = useState(asked === -1 ? 0 : asked);\n const [drawn, setDrawn] = useState<Set<number>>(() => new Set([asked === -1 ? 0 : asked, ...eager]));\n const buttons = useRef<Array<HTMLButtonElement | null>>([]);\n /* The tabs that do not fit go under More (useTabFold.ts); the chosen one is never among them. */\n const { strip, folded } = useTabFold(tabs.length, active);\n /* A tab reached by the keyboard may have been under More: it is focused once the fold has made room for it. */\n const focusing = useRef<number | undefined>(undefined);\n useEffect(() => {\n if (focusing.current === undefined || folded.has(focusing.current)) return;\n buttons.current[focusing.current]?.focus();\n focusing.current = undefined;\n });\n const show = (i: number) => {\n setActive(i);\n setDrawn((s) => new Set(s).add(i));\n /* Written into the address bar without re-rendering: what you are looking\n at is what a link should carry. The first tab writes nothing. */\n onTab(!scoped && i === 0 ? undefined : tabs[i].token);\n };\n return (\n <div className={`page-tabs${className}`}>\n {/* The strip is the row that is measured; the tabs are its tablist, and More stands beside them, not among them. */}\n <div className=\"page-tabstrip folds\" ref={strip}>\n <div className=\"page-tablist\" role=\"tablist\" aria-label={name}>\n {tabs.map((tab, i) => (\n <button\n key={tab.key}\n type=\"button\"\n className=\"page-tab\"\n data-fold={i}\n data-folded={folded.has(i) ? '' : undefined}\n aria-hidden={folded.has(i) || undefined}\n role=\"tab\"\n id={`${id}-tab-${i}`}\n aria-controls={`${id}-tabpanel-${i}`}\n aria-selected={i === active}\n tabIndex={i === active ? 0 : -1}\n ref={(el) => {\n buttons.current[i] = el;\n }}\n onClick={() => show(i)}\n onKeyDown={(e) => {\n const step = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;\n const to = step ? (i + step + tabs.length) % tabs.length : e.key === 'Home' ? 0 : e.key === 'End' ? tabs.length - 1 : -1;\n if (to < 0) return;\n e.preventDefault();\n show(to);\n if (folded.has(to)) focusing.current = to;\n else buttons.current[to]?.focus();\n }}\n >\n {tab.label}\n </button>\n ))}\n </div>\n <div className=\"page-tab-more\" data-fold-more=\"\" data-folded={folded.size ? undefined : ''} aria-hidden={!folded.size || undefined}>\n <DropMenu\n className=\"page-tab-more-menu\"\n triggerClassName=\"page-tab\"\n label={message('common.more')}\n popupClassName=\"page-actions-popup\"\n align=\"end\"\n >\n {tabs.map((tab, i) =>\n folded.has(i) ? (\n <DropItem key={tab.key} className=\"page-actions-item\" onClick={() => show(i)}>\n {tab.label}\n </DropItem>\n ) : null,\n )}\n </DropMenu>\n </div>\n </div>\n <div className=\"page-tabpanels\">\n {tabs.map((tab, i) => (\n <div\n key={tab.key}\n className=\"page-tabpanel\"\n role=\"tabpanel\"\n id={`${id}-tabpanel-${i}`}\n aria-labelledby={`${id}-tab-${i}`}\n tabIndex={i === active ? 0 : -1}\n hidden={i !== active}\n inert={i !== active}\n aria-hidden={i !== active}\n >\n {drawn.has(i) ? draw(i) : null}\n </div>\n ))}\n </div>\n </div>\n );\n}\n\n/** A run of lists as tabs: the names across the top, one table under them, fetched when opened. */\nfunction ListTabs({\n items,\n entry,\n onTab,\n draw,\n scoped,\n}: {\n items: Shown[];\n entry: PageEntry;\n onTab: (tab: string | undefined) => void;\n draw: (item: Shown) => ReactNode;\n scoped: boolean;\n}) {\n useMessageLanguage();\n /* The token is the source's words (apps.ts keepAddresses), so an address names one tab in every language. */\n const named = (item: Shown) =>\n item.section.addressWords?.title ??\n item.section.title ??\n (findTable(item.section.from ?? '') as TableMeta | undefined)?.name ??\n item.section.from ??\n '';\n // Read as the strip renders: the run is still being gathered when the strip is created.\n const tabs = items.map((item) => ({\n key: item.index,\n token: scoped ? `section:${item.index}` : named(item),\n label: item.section.title ?? spoken((findTable(item.section.from ?? '') as TableMeta | undefined)?.name ?? item.section.from ?? ''),\n }));\n return <TabStrip tabs={tabs} name=\"Related lists\" entry={entry} onTab={onTab} draw={(i) => draw(items[i])} scoped={scoped} />;\n}\n\n/** The record's sections as tabs: a panel is sections again, laid out as the page lays them out. */\nfunction SectionTabs({\n groups,\n entry,\n onTab,\n lay,\n scoped,\n}: {\n groups: Array<{ name: string; items: Shown[] }>;\n entry: PageEntry;\n onTab: (tab: string | undefined) => void;\n lay: (items: Shown[]) => ReactNode[];\n scoped: boolean;\n}) {\n useMessageLanguage();\n /* Tokened by the tab's source words (apps.ts keepAddresses): an address names one tab in every language. */\n const tabs = groups.map((group) => ({\n key: group.name,\n token: `tab:${group.items.find(({ section }) => section.addressWords?.tab)?.section.addressWords?.tab ?? group.name}`,\n label: group.name,\n }));\n /* A panel holding the record's own fields is drawn at once, hidden: those\n fields are what name the record in its head, and one row costs nothing.\n A panel of lists still costs nothing until it is opened. */\n const eager = groups.flatMap((group, i) => (group.items.some(({ section }) => section.kind === 'fields') ? [i] : []));\n return (\n <TabStrip\n tabs={tabs}\n name=\"Record sections\"\n entry={entry}\n onTab={onTab}\n scoped={scoped}\n eager={eager}\n className=\" page-tabs-sections\"\n draw={(i) => <div className=\"page-tab-sections\">{lay(groups[i].items)}</div>}\n />\n );\n}\n\nexport function Sections({\n page,\n base,\n recordKey: key,\n plans,\n entry,\n onLabel,\n onEdit,\n onTab,\n region,\n onSectionLabel,\n titleOwner,\n onTitleEditor,\n only,\n}: {\n page: PageDef;\n base: TableMeta;\n recordKey: Record<string, unknown>;\n plans: SectionPlan[];\n entry: PageEntry;\n onLabel: (label: string) => void;\n onEdit: (opts?: { inPlace?: boolean }) => void;\n onTab: (tab: string | undefined) => void;\n region?: 'main' | 'aside';\n onSectionLabel: (index: number, label: string | undefined) => void;\n titleOwner?: number;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n /** A part of the region, by section index: a listing draws its photos and its body as two bands (PageLayout.tsx). */\n only?: (index: number) => boolean;\n}) {\n /* Hidden sections are dropped here: hiding is a layout decision, and the\n original index travels with each one, because that is what the plan is\n keyed by. */\n const shown: Shown[] = page.sections\n .map((section, index) => ({ section, index }))\n /* A record header is drawn in the head (PageHead.tsx), not where it is written. */\n .filter(\n ({ section, index }) =>\n !section.hidden &&\n (!only || only(index)) &&\n !(section.kind === 'fields' && section.presentation === 'header') &&\n (!region || (section.region ?? 'main') === region),\n );\n const firstFields = shown.find(({ section }) => section.kind === 'fields')?.index;\n /* Only the aside's strips are scoped: the main column is the page, with or\n without an aside beside it, so its tabs keep their words in the address\n (/accounts/26/opportunities), never an index. */\n const scoped = region === 'aside';\n /* Each section stands behind its own boundary: one that throws while\n drawing says so under its heading, and the rest of the page stays. */\n const draw = (item: Shown, collapsed?: boolean) => (\n <ErrorBoundary\n key={`${item.index}${collapsed ? '-add' : ''}`}\n fallback={(note) => <SectionBox section={item.section} body={null} foldable={false} crashed={note} />}\n >\n <Slot\n page={page}\n section={item.section}\n index={item.index}\n plan={plans.find((p) => p.index === item.index) ?? { index: item.index }}\n base={base}\n recordKey={key}\n foldable={item.section.kind === 'fields' && item.index !== firstFields && !shell().publicVisitor()}\n entry={entry}\n onLabel={region ? undefined : onLabel}\n onSectionLabel={region ? onSectionLabel : undefined}\n onEdit={onEdit}\n titleOwner={titleOwner}\n onTitleEditor={onTitleEditor}\n collapsed={collapsed}\n />\n </ErrorBoundary>\n );\n /* A sequence of sections as the page draws them. `listTabs` is off inside\n a section's tab: a strip of lists inside a strip of sections is tabs in\n tabs, so there a panel's lists stack. */\n /* An App's page is laid out as its author wrote it: lists side by side\n become a tab strip only where the page says `listTabs: true` (or names\n tabs). A strip made on its own put two half-width lists in one\n full-width box. The Workbench's pages, built from the schema or by\n drag, keep the strip unless they say `listTabs: false`. */\n const autoTabs = inAppPage() ? page.listTabs === true : page.listTabs !== false;\n const lay = (items: Shown[], listTabs: boolean, grouped = false): ReactNode[] => {\n /* How long the run of lists containing each section is, so a run of one\n stays a plain section: one tab is a heading with a border around it. */\n const listRuns = new Map<number, number>();\n /* A gallery is a picture, not a table: it stands on its own, never a tab.\n Nor does a list an App's author gave a width: `width: 'half'` is a\n place on the page, and a tab strip spans it whole. The Workbench's\n builder gives every list it adds a width, so there a width is not a\n placement anyone chose, and its lists keep the strip. */\n /* A list that says what it does while empty (`empty: 'hide' | 'collapse'`) is a tab like any other: inside a strip\n an empty list is neither hidden nor collapsed, its tab shows it and the strip already folds it. */\n const tabbed = (section: PageSection) =>\n section.kind === 'list' && section.presentation !== 'gallery' && (section.width === undefined || !inAppPage());\n /* Outside a strip, such a list is left out or said in one line with its neighbours (PageEmptyRun.tsx). */\n const emptyable = (section: PageSection) => section.kind === 'list' && Boolean(section.emptyMode) && section.presentation !== 'card';\n /* Where a tab holds nothing but such lists, it never ends up with nothing. */\n const onlyEmptyable = items.length > 0 && items.every(({ section }) => emptyable(section));\n for (let i = 0; i < items.length; i += 1) {\n if (!tabbed(items[i].section)) continue;\n let end = i;\n while (end + 1 < items.length && tabbed(items[end + 1].section)) end += 1;\n for (let at = i; at <= end; at += 1) listRuns.set(at, end - i + 1);\n i = end;\n }\n const laid: ReactNode[] = [];\n let run: Shown[] | null = null;\n let strip: Shown[] | null = null;\n let leave: Shown[] | null = null;\n items.forEach((item, i) => {\n if (item.section.kind === 'metric') {\n strip = null;\n leave = null;\n if (!run) {\n run = [];\n laid.push(<MetricRun key={`run-${i}`} items={run} draw={draw} />);\n }\n run.push(item);\n return;\n }\n run = null;\n if (listTabs && autoTabs && listRuns.has(i) && (listRuns.get(i) ?? 0) > 1) {\n if (!strip) {\n strip = [];\n laid.push(<ListTabs key={`tabs-${i}`} items={strip} entry={entry} onTab={onTab} draw={draw} scoped={scoped} />);\n }\n strip.push(item);\n leave = null;\n return;\n }\n strip = null;\n if (emptyable(item.section)) {\n if (!leave) {\n leave = [];\n laid.push(\n <EmptyRun\n key={`empty-${i}`}\n items={leave}\n plans={plans}\n base={base}\n recordKey={key}\n draw={draw}\n rescue={grouped && onlyEmptyable}\n />,\n );\n }\n leave.push(item);\n return;\n }\n leave = null;\n laid.push(draw(item));\n });\n return laid;\n };\n /* Sections named into tabs: one strip per region, standing where the first\n of them stands, its tabs in the order their names first appear. The\n sections without a tab keep their order around it. One name alone is no\n strip — the parser refuses it, and a hidden section can still leave one —\n so its sections are drawn as they are. */\n const groups: Array<{ name: string; items: Shown[] }> = [];\n for (const item of shown) {\n const name = item.section.tab;\n if (!name) continue;\n const group = groups.find((g) => g.name === name);\n if (group) group.items.push(item);\n else groups.push({ name, items: [item] });\n }\n if (groups.length < 2) return <>{lay(shown, true)}</>;\n const first = shown.findIndex((item) => item.section.tab);\n return (\n <>\n {lay(shown.slice(0, first), true)}\n <SectionTabs groups={groups} entry={entry} onTab={onTab} scoped={scoped} lay={(items) => lay(items, false, true)} />\n {lay(\n shown.slice(first).filter((item) => !item.section.tab),\n true,\n )}\n </>\n );\n}\n\n/** A run of metrics is one item, not several: a strip with a line of its own. */\nfunction MetricRun({ items, draw }: { items: Shown[]; draw: (item: Shown) => ReactNode }) {\n return <div className=\"page-metric-row\">{items.map(draw)}</div>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,UAAU,SAAkB,MAAM,CAAC,CAAC,MAAM,IAAI,UAAU,IAAI,IAAI;;AAE7E,IAAa,kBAAkB,MAAM,CAAC,CAAC,MAAM;AAkE7C,IAAa,oBAAoB,cAgB9B,CAAC,CAAC;AACL,SAAgB,aAAa;CAC3B,MAAM,EAAE,eAAe,WAAW,iBAAiB;CACnD,MAAM,UAA0B,MAAM,GAAG,SAAS;EAGhD,MAAM,QAAQ,cAAc,KAAK,KAAM,CAAC;GAAE,GAAG,KAAK;GAAI,GAAG,QAAQ,UAAU;EAAE,CAAC,IAAoB;EAClG,OAAOA,IAAQ,MAAM,GAAG,KAAK;CAC/B;CACA,OAAO;AACT;;;;;;;AAyCA,SAAgB,kBAAmC;CACjD,OAAO;EACL,QAAQ,MAAM;EACd,KAAK,QAAQ,MAAM,CAAC,CAAC,MAAM,CAAC;EAC5B,cAAc,YAAoB,YAAY,EAAE,IAAI,QAAQ,CAAc;EAC1E,WAAW,UAAqB,UAAU,KAAK;EAC/C,QAAQ,OAAe,UAAU,EAA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,KAAK,OAAO,GAAG;IAC3B,IAAI,CAAC,OAAO;KACV,QAAQ,CAAC;KACT,KAAK,KACH,oBAAC,UAAD;MAEE,OAAO;MACA;MACD;MACN,WAAW;MACL;MACN,QAAQ,WAAW;KACpB,GAPM,SAAS,GAOf,CACH;IACF;IACA,MAAM,KAAK,IAAI;IACf;GACF;GACA,QAAQ;GACR,KAAK,KAAK,KAAK,IAAI,CAAC;EACtB,CAAC;EACD,OAAO;CACT;CAMA,MAAM,SAAkD,CAAC;CACzD,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,KAAK,QAAQ;EAC1B,IAAI,CAAC,MAAM;EACX,MAAM,QAAQ,OAAO,MAAM,MAAM,EAAE,SAAS,IAAI;EAChD,IAAI,OAAO,MAAM,MAAM,KAAK,IAAI;OAC3B,OAAO,KAAK;GAAE;GAAM,OAAO,CAAC,IAAI;EAAE,CAAC;CAC1C;CACA,IAAI,OAAO,SAAS,GAAG,OAAO,oBAAAC,YAAA,EAAA,UAAG,IAAI,OAAO,IAAI,EAAI,CAAA;CACpD,MAAM,QAAQ,MAAM,WAAW,SAAS,KAAK,QAAQ,GAAG;CACxD,OACE,qBAAAA,YAAA,EAAA,UAAA;EACG,IAAI,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI;EAChC,oBAAC,aAAD;GAAqB;GAAe;GAAc;GAAe;GAAQ,MAAM,UAAU,IAAI,OAAO,OAAO,IAAI;EAAI,CAAA;EAClH,IACC,MAAM,MAAM,KAAK,CAAC,CAAC,QAAQ,SAAS,CAAC,KAAK,QAAQ,GAAG,GACrD,IACF;CACA,EAAA,CAAA;AAEN;;AAGA,SAAS,UAAU,EAAE,OAAO,QAA8D;CACxF,OAAO,oBAAC,OAAD;EAAK,WAAU;EAAmB,UAAA,MAAM,IAAI,IAAI;CAAO,CAAA;AAChE"}
1
+ {"version":3,"file":"shared-B5aBCUi7.js","names":["request","resourceOf","say","say","say","say","_Fragment","say","recordKey","callApi","checkedRecordKey","say","resourceOf","_Fragment","say","sayCopy","_Fragment","say","resourceOf","say","_Fragment","say","_Fragment","say","say","say","api","recordKey","coreApi","checkedKey","_Fragment","_Fragment","resourceOf","_Fragment"],"sources":["../../../kit/src/client/components/pageContext.ts","../../../kit/src/client/copy/record/components/PageSectionBox.ts","../../../kit/src/client/components/PageSectionBox.tsx","../../../kit/src/client/recordSource.ts","../../../kit/src/client/components/pageFieldsRead.ts","../../../kit/src/client/copy/record/components/WorkflowStatus.ts","../../../kit/src/client/components/WorkflowStatus.tsx","../../../kit/src/client/components/PageHeadline.tsx","../../../kit/src/client/copy/record/components/PageFields.ts","../../../kit/src/client/components/PageFields.tsx","../../../kit/src/client/copy/dashboards/components/PageMetrics.ts","../../../kit/src/client/components/PageMetrics.tsx","../../../kit/src/client/copy/record/components/PageTimeline.ts","../../../kit/src/client/components/PageTimeline.tsx","../../../kit/src/client/prefs.js","../../../engine/src/shared/fileBounds.ts","../../../kit/src/client/copy/record/components/PageCurrent.ts","../../../kit/src/client/components/PageCurrent.tsx","../../../kit/src/client/delete.js","../../../kit/src/client/copy/record/components/PageRelated.ts","../../../kit/src/client/components/PageRelated.tsx","../../../kit/src/client/copy/record/components/PageEmptyRun.ts","../../../kit/src/client/components/PageEmptyRun.tsx","../../../kit/src/client/components/PageSections.tsx"],"sourcesContent":["/**\n * What every part of a page reads from the page around it: whether it is an\n * authoring preview, whose connection its reads go through, whether it is\n * still the current surface, and how a related New form opens inside a host.\n * Also the props one section is drawn from, and how a page says a name.\n *\n * Kept apart from Page.tsx so the head, the layout and each section can read\n * it without importing the page that draws them.\n */\nimport { createContext, useContext, type ComponentType, type ReactNode } from 'react';\nimport { ownedBy } from '../requestIdentity.js';\nimport { api as request, findTable, labelPath, recordLabel, state } from '../core.js';\nimport type { AppAction } from '@mistriwork/engine/schema/model.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { shell } from '../shellMode.js';\nimport { resourceOf } from './appRooms.js';\nimport type { DatabaseSchema, TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { RecordReadNames } from '@mistriwork/engine/shared/recordReads.js';\nimport type { FormCuration, InsertResult } from './NewRecord.js';\nimport type { PageDef, PageEntry, PageSection, SectionPlan } from './pageModel.js';\n\n/* App mode reads pages in the app's words — derived human labels, real\n names kept in tooltips. The workbench reads them raw. */\nexport const spoken = (name: string) => (shell().inApp() ? humanName(name) : name);\n/** Whether the page is an App's, for a section's words; through this module, so a section needs no edge of its own to appnav. */\nexport const inAppPage = () => shell().inApp();\nexport type RelatedCreator = (table: TableMeta, form: FormCuration, onAdded: (result: InsertResult) => void) => void;\n/** The record's own verbs, as the head's bar has them: fixed edits and separately granted business commands. */\nexport interface RecordActions {\n list: AppAction[];\n matches: (when: string) => Promise<boolean>;\n queryScope?: number;\n canUpdate?: boolean;\n grantedCommands?: string[];\n /** Fixed actions a role of this reader runs here without write, by label. */\n grantedActions?: readonly string[];\n}\n/**\n * The record's verbs as a bar draws them (Actions.tsx, the App's): the props\n * the kit's record page, its related lists and a row's menu hand the bar the\n * shell installs (shellMode.ts `slots`).\n */\nexport interface ActionBarProps {\n tableId: string;\n actions: AppAction[];\n /** The record's key, as the API names it. */\n recordKey: Record<string, unknown>;\n /** What the record is called, for the confirmation. */\n label: string;\n /** Whether the record satisfies a condition in the query language. */\n matches: (when: string) => Promise<boolean>;\n /** Isolate visibility reads from retired route/modal owners, including the\n * same record reopened before an old invalidation request settles. */\n queryScope?: number;\n /** After a write: the page repaints so the record reads as it now is. */\n onDone: () => void;\n canUpdate?: boolean;\n /** Server-projected supported grants, never authored access policy. */\n grantedCommands?: string[];\n /** Fixed actions a role of this reader runs here without write, by label (the server's answer). */\n grantedActions?: readonly string[];\n /** Additional captured surface lifetime, stable through refresh/lease renewal. */\n isCurrent?: () => boolean;\n /** On a phone: one button, the rest in More, instead of wrapping. */\n compact?: boolean;\n /** A record header's reading of which verbs take something away: drawn after the rest, and quiet where\n they stand as buttons, so the filled first button is always the forward one. */\n destructive?: (action: AppAction) => boolean;\n /** A record header's `primary`: the label of the verb drawn filled and first, where it is shown now (actionOrder.ts). */\n primary?: string;\n /** A record header's `actions`: the verbs it draws as buttons, by id and in this order; every other verb is in More. */\n only?: readonly string[];\n /** Items drawn last in More, after the record's own verbs: Delete. Their presence alone gives the bar a More menu. */\n menuTail?: ReactNode;\n /** A row's own menu: every shown verb an item of one ⋯ menu the caller opens, no buttons. */\n menuOnly?: { label: string; open: boolean; onOpenChange: (open: boolean) => void };\n /** Every verb a quiet button, none filled: a related list's head, where the record's forward verb is not. */\n quiet?: boolean;\n}\n/** `onGone`: a section found the record itself missing, so the page says so once (Page.tsx). */\n/* `recordName` is the page record's name as its title says it: a list of its\n children leaves it out of theirs (PageRelated.tsx). */\n/**\n * What a host draws at a record's own field: in the empty mark's place when the field is empty, trailing the value on\n * the same line when it is not. Props only: the page knows nothing of what it is (an App's decision, mistri's), and\n * draws the empty mark itself when the host returns nothing.\n */\nexport type FieldAdornment = (\n field: Readonly<{ table: string; column: string; key: Readonly<Record<string, unknown>>; filled: boolean }>,\n) => ReactNode;\n\nexport const PageRenderContext = createContext<{\n /** The host's field adornment (Page.tsx's `host.adorn`). */\n adorn?: FieldAdornment;\n /** The columns the host is still asking about. A field keeps its empty mark meanwhile, so it moves nothing; a header\n leaves an empty fact out altogether, so while one of these is an empty fact its facts' line waits rather than\n grow when the answer comes. Only these: a line that could never grow is never held. */\n adornHeld?: readonly string[];\n preview?: boolean;\n connection?: string;\n isCurrent?: () => boolean;\n openRelated?: RelatedCreator;\n actions?: RecordActions;\n onGone?: () => void;\n recordName?: string;\n /** A verb ran from a row of one of the page's lists: the record and its lists are read again. */\n onActionDone?: () => void;\n}>({});\nexport function usePageApi() {\n const { connection } = useContext(PageRenderContext);\n const scoped: typeof request = (path, ...args) => {\n // Add only routing identity; preserve the selected route/body tuple. No\n // operation fields are changed and no endpoint falls back to an untyped API.\n const owned = connection && args[0] ? ([{ ...args[0], ...ownedBy(connection) }] as typeof args) : args;\n return request(path, ...owned);\n };\n return scoped;\n}\n\n/**\n * What the page hands a custom section beside a section's own props: its\n * request, whether it is a preview, and how every section says loading and a\n * failed read. Handed, not imported — the page's modules import each other in\n * a circle this chunk stays out of (test/repo/runtime-cycles). The App's\n * component draws it (sdk/CustomSection.tsx), reached through the shell's slot.\n */\nexport interface CustomSectionFrame {\n pageApi: ReturnType<typeof usePageApi>;\n preview?: boolean;\n Loading: ComponentType<{ section: SlotProps['section'] }>;\n SectionBox: ComponentType<{ section: SlotProps['section']; body: ReactNode; foldable: boolean; broken?: string; hidden?: boolean }>;\n}\n\nexport interface SlotProps {\n page: PageDef;\n section: PageSection;\n index: number;\n plan: SectionPlan;\n base: TableMeta;\n recordKey: Record<string, unknown>;\n foldable: boolean;\n entry: PageEntry;\n onLabel?: (label: string) => void;\n onSectionLabel?: (index: number, label: string | undefined) => void;\n onEdit: (opts?: { inPlace?: boolean }) => void;\n /** The fields section that says the record's name in the head. */\n titleOwner?: number;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n /** An empty related list said in one line with its neighbours: it draws its Add alone (PageEmptyRun.tsx). */\n collapsed?: boolean;\n}\n\n/**\n * How this reader's rows are named, as a record page's reads are built from\n * it (shared/recordReads.ts): the schema it was served, whether it reads in\n * an App's words, and each table's record name as its App says it. The\n * server builds the same requests from the same three (recordCompose.ts).\n */\nexport function recordReadNames(): RecordReadNames {\n return {\n schema: state.schema as unknown as DatabaseSchema,\n app: Boolean(shell().inApp()),\n recordLabel: (tableId: string) => recordLabel({ id: tableId } as TableMeta) as string | false | undefined,\n namePath: (table: TableMeta) => labelPath(table) as string | undefined,\n table: (id: string) => findTable(id) as TableMeta | undefined,\n defined: (id: string) => resourceOf(shell().app(), id)?.defined,\n };\n}\n","/** What PageSectionBox 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 {\n history: 'History',\n flows: 'Flows',\n diagram: 'Steps',\n thisSection: 'This section',\n },\n /* An untitled history() says its title in the reader's language; Spanish is the shell's second one. */\n { es: { history: 'Historial', flows: 'Flujos', diagram: 'Pasos', thisSection: 'Esta sección' } },\n);\n","/**\n * A page section's box, whatever is in it: its heading, a fold when it is a\n * later group of fields, the placeholder while its data is on the way, and the note that names a section that\n * could not run. Every section kind draws through this, so they all head,\n * fold and break the same way.\n *\n * A section's heading is an h2: the record's name in the head is the room's\n * one h1, and what a section holds (a card's title) is the h3 under it. The\n * size is the class's, not the tag's, so the level can say the outline.\n */\nimport { useContext, useEffect, useRef, type ReactNode } from 'react';\nimport { disclosure, findTable } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { GridSkeleton } from './Skeleton.js';\nimport { sectionClass, type PageSection } from './pageModel.js';\nimport { PageRenderContext, spoken } from './pageContext.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { Problem } from './Notes.js';\nimport { useListNavigation } from './listNavigation.js';\nimport { say } from '../copy/record/components/PageSectionBox.js';\n\n/* A suggested page titles a related list by its table's name (`visit_attachment`), which an App says as words, as\n every untitled list's head already is. An authored title has words or capitals of its own and is left as written. */\nconst titled = (title: string) => (/^[a-z][a-z0-9_.]*$/.test(title) ? spoken(title) : title);\n\n/** A section's box: its heading, or a fold when it is a later group of fields. */\nexport function SectionBox({\n section,\n body,\n foldable,\n broken,\n crashed,\n hidden,\n tools,\n}: {\n section: PageSection;\n body: ReactNode;\n /** What the section offers beside its heading — a related list's Add and verbs — drawn in the heading's row. */\n tools?: ReactNode;\n foldable: boolean;\n broken?: string;\n /** Kept drawn but taking no place: a custom section whose component draws nothing. */\n hidden?: boolean;\n /** A boundary's note, for a section that threw while drawing: said under its heading like a failed read. */\n crashed?: ReactNode;\n}) {\n useMessageLanguage();\n const { preview } = useContext(PageRenderContext);\n const content = preview ? (\n <div style={{ display: 'contents' }} inert>\n {body}\n </div>\n ) : (\n body\n );\n const heading =\n (section.title === undefined ? undefined : titled(section.title)) ??\n (section.kind === 'history'\n ? say('history')\n : section.kind === 'flows'\n ? say('flows')\n : section.kind === 'diagram'\n ? say('diagram')\n : undefined) ??\n spoken(section.kind === 'fields' ? '' : ((findTable(section.from ?? '') as TableMeta | undefined)?.name ?? section.from ?? ''));\n const details = useRef<HTMLDetailsElement>(null);\n const bound = useRef(false);\n // The shell's navigation: viewLink would be an import back into the walk that draws this page.\n const navigate = useListNavigation();\n useEffect(() => {\n if (details.current && !bound.current) {\n bound.current = true;\n disclosure(details.current, { dismissible: false });\n }\n });\n if (broken !== undefined || crashed !== undefined) {\n return (\n <section className={`${sectionClass(section)} page-broken`}>\n <h2 className=\"page-section-head\">{heading || say('thisSection')}</h2>\n {crashed ?? <Problem text={broken ?? ''} />}\n </section>\n );\n }\n if (foldable && heading) {\n return (\n <section className={sectionClass(section)}>\n <details className=\"page-fold\" ref={details} open>\n <summary className=\"page-section-head page-fold-head\">\n <span>{heading}</span>\n </summary>\n {content}\n </details>\n </section>\n );\n }\n /* A gallery is a picture: its title names it for assistive technology,\n and a \"Photos\" heading over the photos says nothing a sighted reader\n needs. It leads the page without a rule above it. */\n const gallery = section.kind === 'list' && section.presentation === 'gallery';\n /* An embedded list view's heading is the way to the whole of it: the view's own room, where the reader has it. */\n const room = section.view && !preview ? navigate?.(section.view) : undefined;\n const headed = heading && (\n <h2 className={gallery ? 'page-section-head visually-hidden' : 'page-section-head'}>\n {room ? (\n <a className=\"page-section-link\" {...room}>\n {heading}\n </a>\n ) : (\n heading\n )}\n </h2>\n );\n return (\n <section className={`${sectionClass(section)}${gallery ? ' page-gallery' : ''}`} hidden={hidden || undefined}>\n {tools ? (\n <div className=\"page-section-bar\">\n {headed}\n {tools}\n </div>\n ) : (\n headed\n )}\n {content}\n </section>\n );\n}\n\nexport function Loading({ section }: { section: PageSection }) {\n return (\n <section className={`${sectionClass(section)} loading`}>\n {section.title && <h2 className=\"page-section-head\">{titled(section.title)}</h2>}\n {section.kind === 'list' ? <GridSkeleton columns={4} rows={3} /> : <div className=\"sk-bar\" />}\n </section>\n );\n}\n","import { replaceEqualDeep } from '@tanstack/react-query';\n\nlet epoch = 0;\n\n/** Advance before Undo reconciliation so equal rows become fresh editor sources. */\nexport function advanceRecordSource(): void {\n epoch += 1;\n}\n\nexport async function readRecordSource<T extends object>(read: () => Promise<T>): Promise<T & { recordSourceEpoch: number }> {\n // A response arriving after reconciliation still belongs to its starting epoch.\n const recordSourceEpoch = epoch;\n return { ...(await read()), recordSourceEpoch };\n}\n\nconst epochOf = (value: unknown): unknown =>\n value !== null && typeof value === 'object' ? (value as { recordSourceEpoch?: unknown }).recordSourceEpoch : undefined;\n\nexport function shareRecordSource(old: unknown, next: unknown): unknown {\n return epochOf(old) !== epochOf(next) ? next : replaceEqualDeep(old, next);\n}\n","/**\n * A page's fields sections read their record together.\n *\n * Each fields section names its own columns, and each used to read the root\n * row for them alone: a record page with a headline, contact details, an\n * address and two more groups sent five reads of one row, each paying a\n * tenant request's whole admission and fences, all in the same moment. The\n * sections that ask in the same tick for the same record through the same\n * connection now share one read of every column any of them named, and each\n * is handed exactly the part it asked for — its columns, its resolved\n * descriptions, its row — so a section cannot tell the difference.\n *\n * Nothing is kept: the batch is the callers of one tick, never a cache, so a\n * refetch after an edit reads the row again (together, when the sections\n * refetch together). A shared read that fails, or answers with the language's\n * errors, is asked again a section at a time: one section naming a column this\n * reader may not see must break that section only, as it did alone.\n */\nimport type { HttpFilter } from '@mistriwork/engine/shared/resourceHttp.js';\n/* Exactly what a section would have been answered alone: the rule a composed page's row answers by too. */\nimport { rowPart } from '@mistriwork/engine/shared/recordReadKeys.js';\n\ninterface ViewReply {\n view: { columns: Array<{ path: string }> } & Record<string, unknown>;\n columns: string[];\n rows: Array<Record<string, unknown>>;\n resolved?: Array<{ path: string; name?: string }>;\n}\ntype Reply = ViewReply | { errors: Array<{ message: string }> };\n/** What a section's read is: the same request it would have sent alone. */\ninterface FieldsRead {\n /** Where the read goes: the page's connection, and the owner scope it asks under. */\n readonly owner: string;\n readonly pageId: string;\n readonly base: { id: string; name: string };\n readonly filter: HttpFilter<'path'>;\n readonly columns: readonly string[];\n}\n/** The one request a batch sends: a view of the root row. */\ninterface FieldsBody {\n count: 'none';\n view: { id: string; name: string; base: string; columns: Array<{ path: string }>; filter: HttpFilter<'path'>; limit: 1 };\n}\ntype Send = (body: FieldsBody) => Promise<Reply>;\ninterface Waiting {\n read: FieldsRead;\n send: Send;\n resolve: (reply: Reply) => void;\n reject: (error: unknown) => void;\n}\n\nlet waiting: Waiting[] = [];\n\nconst bodyFor = (read: FieldsRead, columns: readonly string[]): FieldsBody => ({\n count: 'none',\n view: {\n id: `page:${read.pageId}:fields`,\n name: read.base.name,\n base: read.base.id,\n columns: columns.map((path) => ({ path })),\n filter: read.filter,\n limit: 1,\n },\n});\n\n/** One section's read, answered with the others of this tick where they read the same row. */\nexport function readPageFields(read: FieldsRead, send: Send): Promise<Reply> {\n return new Promise<Reply>((resolve, reject) => {\n if (!waiting.length) queueMicrotask(flush);\n waiting.push({ read, send, resolve, reject });\n });\n}\n\nconst alone = (item: Waiting) => item.send(bodyFor(item.read, item.read.columns)).then(item.resolve, item.reject);\n\nfunction flush() {\n const batch = waiting;\n waiting = [];\n const groups = new Map<string, Waiting[]>();\n for (const item of batch) {\n const key = JSON.stringify([item.read.owner, item.read.pageId, item.read.base.id, item.read.filter]);\n const group = groups.get(key);\n if (group) group.push(item);\n else groups.set(key, [item]);\n }\n for (const group of groups.values()) {\n if (group.length === 1) {\n void alone(group[0]);\n continue;\n }\n const columns = [...new Set(group.flatMap((item) => item.read.columns))];\n void group[0]\n .send(bodyFor(group[0].read, columns))\n .then((reply) => {\n if (!reply || typeof reply !== 'object' || !('view' in reply) || !Array.isArray(reply.rows)) throw new Error('unshared');\n for (const item of group) item.resolve(rowPart(reply, item.read.columns));\n })\n .catch(() => {\n for (const item of group) void alone(item);\n });\n }\n}\n","/** What WorkflowStatus 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 workflowStatus: 'Workflow status',\n passed: '(passed)',\n availableFromHere: '(available from here)',\n currentState: 'Current state:',\n notSet: 'Not set',\n});\n","/**\n * The workflow strip: where a record stands in its status vocabulary. Only\n * the current state is known. Where the author says the steps are an order\n * (`ordered`), the steps before it are drawn as passed — the order written\n * down, not a history of the record — and a state outside the steps passes\n * none. A step one of the record's own edits can move it to now is marked\n * as reachable; the strip still moves nothing, the record's actions do.\n *\n * An ordered strip reads as a way travelled: a passed step's mark is filled\n * in the ink, the current one in the accent, the steps ahead hollow, and a\n * hairline joins each step to the next — in the ink where it has been walked.\n */\nimport { useLayoutEffect, useRef } from 'react';\nimport { workflowLabel, type ResolvedWorkflowStatus as WorkflowDefinition } from '@mistriwork/engine/shared/pageModel.js';\nimport { say } from '../copy/record/components/WorkflowStatus.js';\n\nexport function WorkflowStatus({\n definition,\n value,\n reachable,\n}: {\n definition: WorkflowDefinition;\n value: unknown;\n reachable?: ReadonlySet<string>;\n}) {\n const current = definition.steps.findIndex((step) => step.value === value);\n const known = current !== -1;\n /* On a narrow screen the strip is one line that scrolls sideways (page.css); the current step is brought into\n view by moving the strip alone, never the page, so a record opened at \"Negotiation\" shows Negotiation. */\n const strip = useRef<HTMLOListElement>(null);\n useLayoutEffect(() => {\n const ol = strip.current;\n const step = ol?.querySelector<HTMLElement>('[aria-current=\"step\"]');\n if (!ol || !step || ol.scrollWidth <= ol.clientWidth) return;\n /* The strip starts at the step before the current one, whole, so the way in reads \"Proposal — Negotiation\"\n rather than from the middle of a word. */\n const from = (step.previousElementSibling as HTMLElement | null) ?? step;\n ol.scrollLeft = Math.max(0, from.offsetLeft - ol.offsetLeft);\n edges(ol);\n }, [current]);\n return (\n <div className=\"workflow-status\">\n <ol\n ref={strip}\n onScroll={(event) => edges(event.currentTarget)}\n aria-label={say('workflowStatus')}\n className=\"workflow-steps\"\n data-scrolls=\"\"\n data-ordered={definition.ordered === true || undefined}\n >\n {definition.steps.map((step, index) => {\n const passed = definition.ordered === true && known && index < current;\n const next = index !== current && reachable?.has(String(step.value)) === true;\n return (\n <li\n key={step.value}\n aria-current={index === current ? 'step' : undefined}\n data-passed={passed || undefined}\n data-reachable={next || undefined}\n >\n <span className=\"workflow-marker\" aria-hidden=\"true\" />\n {step.label}\n {passed && <span className=\"visually-hidden\"> {say('passed')}</span>}\n {next && <span className=\"visually-hidden\"> {say('availableFromHere')}</span>}\n </li>\n );\n })}\n </ol>\n {!known && (\n <p className=\"workflow-unmapped\" role=\"status\">\n {say('currentState')} {value === null || value === undefined || value === '' ? say('notSet') : workflowLabel(String(value))}\n </p>\n )}\n </div>\n );\n}\n\n/* Which ends of a scrolling strip have more beyond them, for its fade (page.css). */\nfunction edges(ol: HTMLOListElement) {\n ol.toggleAttribute('data-more-before', ol.scrollLeft > 1);\n ol.toggleAttribute('data-more-after', ol.scrollLeft + ol.clientWidth < ol.scrollWidth - 1);\n}\n","/**\n * A record's headline, for a page that offers the record to someone: the\n * first field as the figure — a price, in its display rule — the rest as a\n * row of facts under their captions, and one or two calls to action that\n * open one of the App's views (the inquiry form, say). It sits under the\n * record's name, so what a reader decides on is above the fold.\n *\n * The figure's earlier value (`was`) is struck through beside it while it\n * stands above the figure — a reduced price — and is not drawn otherwise. A\n * fact with no value is left out, never said as \"Caption —\".\n *\n * A second, smaller figure (`subfigure`) may follow the first — an estimate,\n * a unit price — and a line of small print (`note`) says what the figures\n * assume. A call to action that opens a public form may start the form\n * filled: from this record's fields (`prefill`, so the visitor never copies\n * a reference by hand) and with the author's words (`defaults`). They are\n * where the form starts, carried in its address, never what it sends.\n *\n * A list or dashboard is found among the rooms the App serves this reader;\n * a public form is asked of the public forms route once, only when an\n * action names something no room is. An action that names neither is not\n * drawn: a button to nowhere is worse than none.\n *\n * A public form is the App's front door for someone with no account: it\n * runs under a public principal and writes what a visitor may. A signed-in\n * reader works the App's own rooms (the staff who read a listing take a\n * viewing in the Viewings list), so the form is not offered to them as the\n * way to reach out about a record they already hold.\n */\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { useQuery } from '@tanstack/react-query';\nimport { api, columnLabel, state } from '../core.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport type { ColumnMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { PageHeadlineAction } from '@mistriwork/engine/shared/pageModel.js';\nimport { Value } from './Value.js';\nimport { formLink, viewLink, type ViewLink } from './viewLink.js';\nimport { useState } from 'react';\nimport { shell } from '../shellMode.js';\nimport { sessionIdentity } from '../sessionIdentity.js';\n\ninterface PageHeadlineProps {\n tableId: string;\n row: Record<string, unknown>;\n /** The figure first, then the facts. */\n paths: readonly string[];\n column: (path: string) => ColumnMeta | undefined;\n actions: ReadonlyArray<PageHeadlineAction>;\n /** A second figure under the first. */\n subfigure?: string;\n /** The figure's earlier value, struck through beside it when it is set and higher. */\n was?: string;\n /** Small print under the actions. */\n note?: string;\n}\n\n/** A public form's address with the inputs the action fills: the record's own values, then the author's words. */\nexport function prefilledFormLink(link: ViewLink, action: PageHeadlineAction, row: Record<string, unknown>): ViewLink {\n const params = new URLSearchParams();\n for (const [input, path] of Object.entries(action.prefill ?? {})) {\n const value = row[path];\n if (value !== null && value !== undefined && String(value) !== '') params.set(input, String(value));\n }\n for (const [input, text] of Object.entries(action.defaults ?? {})) params.set(input, text);\n const query = params.toString();\n return query ? { ...link, href: `${link.href}?${query}` } : link;\n}\n\n/** A value the headline has: not null, not missing, not blank. */\nconst hasValue = (value: unknown) => value !== null && value !== undefined && String(value).trim() !== '';\n\n/** The earlier value is said only where it is a figure above the one in hand: a reduction, never a rise or a repeat. */\nexport function wasShown(row: Record<string, unknown>, figure: string | undefined, was: string | undefined): boolean {\n if (!figure || !was || !hasValue(row[was]) || !hasValue(row[figure])) return false;\n const [then, now] = [Number(row[was]), Number(row[figure])];\n return Number.isFinite(then) && Number.isFinite(now) && then > now;\n}\n\nexport function PageHeadline({ tableId, row, paths, column, actions, subfigure, was, note }: PageHeadlineProps) {\n useMessageLanguage();\n const caption = (path: string) => (columnLabel(tableId, path) as string | null) ?? humanName(path.split('.').pop() ?? path);\n const [figure, ...facts] = paths;\n /* A call to action into another App of the suite, and a public form over the record, are the App framework's:\n the shell's to draw (shellMode.ts), and not drawn where it has none. */\n const { TargetAction, FormDialog } = shell().slots;\n const rooms = actions.map((action) => ('view' in action ? viewLink(action.view) : undefined));\n const signedIn = sessionIdentity().mode === 'authenticated';\n const forms = useQuery({\n queryKey: ['public-forms', state.activeConnection ?? ''],\n enabled: !signedIn && actions.some((action, index) => 'view' in action && !rooms[index]),\n staleTime: Infinity,\n queryFn: async () => new Set(((await api('/api/forms')) as { forms?: Array<{ id: string }> }).forms?.map((form) => form.id) ?? []),\n });\n const links = actions.map((action, index) => {\n if ('to' in action) return { action, kind: action.intent ?? (index === 0 ? 'primary' : 'secondary') };\n const form =\n !signedIn && !rooms[index] && forms.data?.has(action.view) ? prefilledFormLink(formLink(action.view), action, row) : undefined;\n const link = rooms[index] ?? form;\n /* `open: 'modal'` draws the form over this record instead of leaving for\n its page: a public form, or a signed-in form this reader is served (its room's address still opens it on its\n own). A list or a dashboard is only ever a room. */\n const asked = form ?? (rooms[index] && action.open === 'modal' ? prefilledFormLink(rooms[index]!, action, row) : undefined);\n const dialog =\n action.open === 'modal' && asked && FormDialog ? { view: action.view, prefill: asked.href.split('?')[1] ?? '' } : undefined;\n return link ? { label: action.label, link, dialog, kind: action.intent ?? (index === 0 ? 'primary' : 'secondary') } : null;\n });\n const [asking, setAsking] = useState<{ view: string; prefill: string } | null>(null);\n const second = subfigure !== undefined && hasValue(row[subfigure]);\n const earlier = wasShown(row, figure, was);\n const shownFacts = facts.filter((path) => hasValue(row[path]));\n return (\n <div className=\"page-headline\">\n {figure !== undefined && (\n <p className=\"page-headline-figure\">\n <span className=\"visually-hidden\">{caption(figure)}: </span>\n <Value col={column(figure)} value={row[figure]} tableId={tableId} compact row={row} />\n {earlier && (\n <>\n {' '}\n <s className=\"page-headline-was\">\n <span className=\"visually-hidden\">{caption(was!)}: </span>\n <Value col={column(was!)} value={row[was!]} tableId={tableId} compact />\n </s>\n </>\n )}\n </p>\n )}\n {second && (\n <p className=\"page-headline-sub\">\n <span className=\"page-headline-sub-caption\">{caption(subfigure!)}</span>{' '}\n <Value col={column(subfigure!)} value={row[subfigure!]} tableId={tableId} compact />\n </p>\n )}\n {links.some(Boolean) && (\n <div className=\"page-headline-actions\">\n {links.map((entry, index) =>\n !entry ? null : 'action' in entry && entry.action ? (\n TargetAction && (\n <TargetAction\n key={index}\n label={entry.action.label}\n to={entry.action.to}\n row={row}\n className={`page-headline-action is-${entry.kind}`}\n />\n )\n ) : (\n /* Still a link: its address is the form's own page, so a new tab,\n a middle click or a copied link all still work. A plain click\n opens the dialog instead. */\n <a\n key={index}\n className={`page-headline-action is-${entry.kind}`}\n href={entry.link!.href}\n onClick={\n entry.dialog\n ? (event) => {\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0) return;\n event.preventDefault();\n setAsking(entry.dialog!);\n }\n : entry.link!.onClick\n }\n >\n {entry.label}\n </a>\n ),\n )}\n </div>\n )}\n {shownFacts.length > 0 && (\n <dl className=\"page-headline-facts\">\n {shownFacts.map((path) => (\n <div key={path}>\n <dt>{caption(path)}</dt>\n <dd>\n <Value col={column(path)} value={row[path]} tableId={tableId} compact />\n </dd>\n </div>\n ))}\n </dl>\n )}\n {note && <p className=\"page-headline-note\">{note}</p>}\n {asking && FormDialog && <FormDialog view={asking.view} prefill={asking.prefill} onClose={() => setAsking(null)} />}\n </div>\n );\n}\n","/** What PageFields 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 theseFieldsCouldNotBeRead: 'These fields could not be read.',\n noneYet: 'No {caption} yet',\n nothingHereEveryField: 'Nothing here: every field in this group is empty.',\n});\n","/**\n * A page's fields section: the root record's own values, read as one row\n * and drawn in the dress the section asks for — a headline, a facts line, a\n * sheet, or the field grid, editable where the record may be changed. It\n * also names the record for the head and, in an App, hands the head the\n * editor for the record's name.\n */\nimport { shell } from '../shellMode.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { useContext, useEffect, type CSSProperties, type ReactNode } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { readRecordSource, shareRecordSource } from '../recordSource.js';\nimport { readPageFields } from './pageFieldsRead.js';\nimport { dressFor, sayValue, type DisplayRule } from './valueModel.js';\nimport { pathEqualityFilter, recordKey as checkedRecordKey } from '../resourceRequests.js';\nimport { columnDisplay, columnLabel, emptyWord, findTable, labelPath, primaryKey, rowLabel, state } from '../core.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { resourceOf } from './appRooms.js';\nimport { recordNoun } from '@mistriwork/engine/shared/appNoun.js';\nimport { canEditRow } from '../write.js';\nimport { cardStem, sharedPrefix } from '@mistriwork/engine/shared/pagePaths.js';\nimport type { ColumnMeta } from '@mistriwork/engine/shared/schema.js';\nimport { Editable } from './Editable.js';\nimport { RefJump, Value } from './Value.js';\nimport { defaultFieldPaths, definedThrough, fieldsColumns } from '@mistriwork/engine/shared/recordReads.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { WorkflowStatus } from './WorkflowStatus.js';\nimport { api as callApi, toast } from '../core.js';\nimport { ownedBy } from '../requestIdentity.js';\nimport type { AppUpdateAction } from '@mistriwork/engine/schema/model.js';\nimport { PageHeadline } from './PageHeadline.js';\nimport { PageRenderContext, recordReadNames, usePageApi, type RecordActions, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { sectionClass } from './pageModel.js';\nimport { say } from '../copy/record/components/PageFields.js';\nimport { onDemand } from './onDemand.js';\n\nconst DefinedFields = onDemand(() => import('./DefinedFields.js'), 'DefinedFields', { quiet: true });\n\n/** A property the reader cannot write but an action of theirs moves: the values it can reach, as a picker. The action is the\n ordinary one — the server judges it again — so a refusal is said as the action's own would be. */\nfunction ActionPick({\n tableId,\n recordKey,\n column,\n value,\n actions,\n caption,\n onDone,\n connection,\n}: {\n tableId: string;\n recordKey: Record<string, unknown>;\n column: string;\n value: unknown;\n actions: RecordActions;\n caption: string;\n onDone?: () => void;\n connection?: string;\n}) {\n const reachable = shell().slots.useReachable(tableId, recordKey, column, actions);\n const moves = actions.list.filter(\n (action): action is AppUpdateAction =>\n !action.command &&\n Object.keys((action as AppUpdateAction).set).length === 1 &&\n column in (action as AppUpdateAction).set &&\n !(action as AppUpdateAction).reason &&\n !(action as AppUpdateAction).confirm,\n );\n const current = value === null || value === undefined ? '' : String(value);\n const options = [\n ...new Set([current, ...[...reachable].filter((next) => moves.some((action) => String(action.set[column]) === next))]),\n ].filter(Boolean);\n if (options.length < 2) return null;\n const move = async (next: string) => {\n const action = moves.find((candidate) => String(candidate.set[column]) === next);\n if (!action?.set) return;\n try {\n await callApi('/api/update', {\n ...ownedBy(connection ?? state.activeConnection ?? ''),\n table: tableId,\n key: checkedRecordKey(recordKey),\n values: action.set!,\n });\n onDone?.();\n } catch (error) {\n toast((error as Error).message, 'error');\n }\n };\n return (\n <select className=\"page-field-pick\" aria-label={caption} value={current} onChange={(event) => void move(event.target.value)}>\n {options.map((option) => (\n <option key={option} value={option}>\n {option}\n </option>\n ))}\n </select>\n );\n}\n\n/** The root's own fields — one section among several, not a record page with extras. */\nexport function FieldsSection({\n page,\n section,\n index,\n base,\n recordKey: key,\n foldable,\n onLabel,\n onSectionLabel,\n onEdit,\n titleOwner,\n onTitleEditor,\n}: SlotProps) {\n useMessageLanguage();\n const api = usePageApi();\n const { preview, isCurrent, actions: recordActions, onGone, connection, adorn } = useContext(PageRenderContext);\n const paths = section.paths?.length ? section.paths : defaultFieldPaths(base, shell().inApp());\n const namePath = labelPath(base) as string | undefined;\n /* What it shows, its references' names, the record's name, a headline's\n second figure and the fields its actions fill a form from — built as the\n server builds it for the page's compose (shared/recordReads.ts). */\n const { fetched, labels: refLabels } = fieldsColumns(recordReadNames(), base, section);\n const data = useQuery({\n queryKey: ['page-fields', page.id, base.id, key, fetched],\n // Undo can restore the cached row; only its reconciliation read needs a\n // fresh editor source, without remounting or clearing staged drafts.\n structuralSharing: shareRecordSource,\n /* With the page's other fields sections, as one read of the row (pageFieldsRead.ts). */\n queryFn: () =>\n readRecordSource(() =>\n readPageFields(\n {\n owner: connection ?? '',\n pageId: page.id,\n base,\n filter: pathEqualityFilter(Object.fromEntries((primaryKey(base) as string[]).map((column) => [column, key[column]]))),\n columns: fetched,\n },\n (body) => api('/api/view/run', body),\n ),\n ),\n staleTime: 0,\n });\n const got = data.data && 'view' in data.data ? data.data : undefined;\n const row = got?.rows[0];\n const reachable = shell().slots.useReachable(base.id, key, section.workflow?.field, recordActions);\n useEffect(() => {\n /* The row is here, so the crumb and the pill can stop saying the key. */\n if (row) {\n const label = rowLabel(base, row);\n if (onSectionLabel) onSectionLabel(index, label);\n else onLabel?.(label);\n }\n }, [row, onSectionLabel, index]); // eslint-disable-line react-hooks/exhaustive-deps\n useEffect(\n () => () => {\n onSectionLabel?.(index, undefined);\n },\n [onSectionLabel, index],\n );\n /* In an App the head says the record's name, so the section that owns it\n stops repeating the field below, and where the name may be changed, the\n head is where: the same editor and Save as any other field. */\n const named = shell().inApp() && !preview && !section.of && Boolean(namePath) && !namePath!.includes('.');\n const titled = named && titleOwner === index;\n const titleColumn = titled ? base.columns.find((c) => c.name === namePath) : undefined;\n const titleEditable = Boolean(\n titleColumn && !titleColumn.primaryKey && titleColumn.writable !== false && (canEditRow(base, key) as boolean),\n );\n useEffect(() => {\n if (!onTitleEditor) 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 onTitleEditor?.(index, undefined);\n },\n [onTitleEditor, index],\n );\n /* The record's own fields found no record: the page says that once, for\n every section, and offers nothing to do to it (Page.tsx). */\n const missing = !section.of && ((data.isError && (data.error as { status?: number }).status === 404) || (Boolean(got) && !row));\n useEffect(() => {\n if (missing) onGone?.();\n }, [missing]); // eslint-disable-line react-hooks/exhaustive-deps\n if (data.isPending) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n if (data.data && !('view' in data.data))\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={data.data.errors[0]?.message ?? say('theseFieldsCouldNotBeRead')}\n />\n );\n if (!row) return <SectionBox section={section} body={null} foldable={false} broken={say('common.thatRecordIsNoLonger')} />;\n\n const byName = new Map(base.columns.map((c) => [c.name, c]));\n const byPath = new Map((got?.resolved ?? []).map((c) => [c.path, c]));\n /* A path's column as the schema has it: the result's resolved column says\n its type but not what it references, so `employee_id.department_id`\n would otherwise read as the bare key. */\n const presented = presentationColumns(state.schema, base, paths);\n const columnAt = (path: string) =>\n (byName.get(path) ?? presented.get(path) ?? byPath.get(path)) as\n | (ColumnMeta & { references?: { table: string; column: string } })\n | undefined;\n const captionOf = (path: string) => (columnLabel(base.id, path) as string | null) ?? humanName(path.split('.').pop() ?? path);\n /* A fields section in the aside is a property rail unless it says otherwise: caption beside value is\n what a side panel holds. The main region keeps the summary grid. */\n const presentation = section.presentation ?? (section.region === 'aside' ? 'properties' : 'summary');\n const rail = presentation === 'properties';\n const filled = (path: string) => row[path] !== null && row[path] !== undefined && row[path] !== '';\n /* A value as a line of facts or a card says it: a reference is the record\n it names, by its label where the section fetched one, never its key. */\n const said = (path: string, compact?: boolean) => {\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={compact} row={row} />\n );\n };\n /* A headline is the record offered: its figure, its facts and what to do next. */\n if (section.presentation === 'headline') {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <PageHeadline\n tableId={base.id}\n row={row}\n paths={paths}\n column={columnAt}\n actions={section.actions ?? []}\n subfigure={section.subfigure}\n was={section.was}\n note={section.note}\n />\n }\n />\n );\n }\n /* A facts line: the values alone, each after a dot, in the order named.\n An empty one is left out rather than said as a dash in the middle of a\n sentence; each caption stays for assistive technology. */\n if (section.presentation === 'facts') {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <ul className=\"page-facts\" aria-label={section.title ?? say('common.keyFacts')}>\n {paths.filter(filled).map((path) => {\n /* A bare number says nothing in a line of words (\"1998 · 24\"): it keeps its caption, in sight. A figure\n that already says what it is (money, a percent, a unit) does not need one. */\n const bare =\n typeof row[path] === 'number' && !columnAt(path)?.references && !columnDisplay(base.id, columnAt(path)?.name ?? '');\n return (\n <li key={path} className=\"page-fact\">\n {bare ? (\n <span className=\"page-fact-caption\">{captionOf(path)} </span>\n ) : (\n <span className=\"visually-hidden\">{captionOf(path)}: </span>\n )}\n {said(path, true)}\n </li>\n );\n })}\n </ul>\n }\n />\n );\n }\n /* A sheet: caption beside value on one row, a hairline between rows, the\n rows in `columns` columns where the room has the width. A value the\n record does not have is a row nobody needs. */\n if (section.presentation === 'table') {\n const sheetColumns = typeof section.columns === 'number' ? section.columns : undefined;\n return (\n <SectionBox\n section={section}\n foldable={foldable}\n body={\n <dl className=\"page-sheet\" style={sheetColumns ? ({ '--page-sheet-columns': String(sheetColumns) } as CSSProperties) : undefined}>\n {paths.filter(filled).map((path) => {\n return (\n <div key={path} className=\"page-sheet-row\">\n <dt>{captionOf(path)}</dt>\n <dd>{said(path)}</dd>\n </div>\n );\n })}\n </dl>\n }\n />\n );\n }\n /* A card: the record a reference names, as one box — who sells the car,\n who owns the account. Its first field is the title; a reference there\n is the named record, opening its page, and \"View dealer\" says so again\n at the foot for a reader who scans past a name. The rest are its facts,\n captioned without the hop they share. Never folded: a card is small, and\n a chevron on it said \"optional\" about the one thing a buyer checks. */\n if (section.presentation === 'card') {\n const [titlePath, ...rest] = paths;\n const titleColumn = columnAt(titlePath);\n const reference = titleColumn?.references && filled(titlePath) ? titleColumn.references : undefined;\n const titleLabel = refLabels.get(titlePath);\n const factsStem = cardStem(paths) as string;\n // The resource's own `noun` where it says one (\"View seller\", not \"View dealer_account\").\n const noun = reference\n ? recordNoun(\n resourceOf(shell().app(), reference.table)?.noun,\n (findTable(reference.table) as { name?: string } | undefined)?.name ?? reference.table,\n )\n : '';\n const jump = (className: string, text?: string) => (\n <RefJump\n references={reference!}\n value={row[titlePath]}\n label={titleLabel ? row[titleLabel] : undefined}\n table={base}\n column={titlePath}\n row={row}\n className={className}\n text={text}\n />\n );\n return (\n <section className={`${sectionClass(section)} page-card-section page-reference-card`}>\n <div className=\"page-card\">\n {section.title && <h2 className=\"page-card-caption\">{section.title}</h2>}\n <p className=\"page-card-title\">\n {reference ? (\n jump('page-card-name')\n ) : filled(titlePath) ? (\n <Value col={titleColumn} value={row[titlePath]} tableId={base.id} />\n ) : (\n emptyWord()\n )}\n </p>\n {rest.some(filled) && (\n <dl className=\"page-card-facts\">\n {rest.filter(filled).map((path) => (\n <div key={path} className=\"page-card-fact\">\n <dt>{columnLabel(base.id, path, factsStem) ?? captionOf(path)}</dt>\n <dd>{said(path)}</dd>\n </div>\n ))}\n </dl>\n )}\n {reference && <p className=\"page-card-foot\">{jump('page-card-more', say('common.view', { noun }))}</p>}\n </div>\n </section>\n );\n }\n /* A group of fields that all follow the same reference is that record\n shown inline; its labels drop the hop they all share. */\n const stem = sharedPrefix(paths) as string;\n const shared = stem ? `${stem}.` : '';\n const own = !section.of && !stem;\n const editing = !preview && own && (canEditRow(base, key) as boolean);\n\n /* A group that follows a reference to nothing — \"Converted to\" on a lead\n that has not been — is one dash, not four labels over four dashes. */\n if (stem && shell().inApp() && paths.length && paths.every((p) => row[p] === null || row[p] === undefined)) {\n return (\n <SectionBox\n section={section}\n foldable={foldable}\n body={\n <p className=\"page-group-empty\" title={say('nothingHereEveryField')}>\n —\n </p>\n }\n />\n );\n }\n\n const bound = resourceOf(shell().app(), base.id)?.defined;\n const definedOf = (id: string) => resourceOf(shell().app(), id)?.defined;\n const fields = (named ? paths.filter((path) => path !== namePath) : paths).map((path) => {\n const value = row[path];\n const column = columnAt(path);\n /* A row-defined column is its fields, each drawn here as one of the record's own (DefinedFields.tsx). */\n if (own && bound && Object.hasOwn(bound, path))\n return (\n <DefinedFields\n key={path}\n base={base}\n row={row}\n column={path}\n binding={bound[path]}\n recordKey={key}\n editing={editing && column?.writable !== false}\n onSaved={onEdit}\n isCurrent={isCurrent}\n connection={connection}\n />\n );\n /* And through a reference (`requested_item_id.answers`): the referenced\n record's fields, read here as they are on its own page, not its JSON. */\n const through = own && bound && Object.hasOwn(bound, path) ? undefined : definedThrough(state.schema, base.id, path, definedOf);\n if (through && through.prefix) {\n const per = through.binding.per;\n return (\n <DefinedFields\n key={path}\n base={through.table}\n row={{ [through.column]: value, ...(per ? { [per]: row[`${through.prefix}.${per}`] } : {}) }}\n column={through.column}\n binding={through.binding}\n recordKey={{}}\n editing={false}\n isCurrent={isCurrent}\n connection={connection}\n />\n );\n }\n let dd: ReactNode;\n /* The host's word at this field (a suggestion waiting on it): in the empty mark's place, or after the value on\n its line — the field's height is the same with it as without, so nothing below moves when it arrives. */\n const adorned =\n adorn && own && !editing && !preview && byName.has(path)\n ? adorn({ table: base.id, column: path, key, filled: value !== null && value !== undefined && value !== '' })\n : null;\n if (editing && byName.has(path) && !column?.primaryKey && column?.writable !== false) {\n const display = (next: unknown, referenceLabel?: string) =>\n column?.references && next !== null && next !== undefined && String(next) !== '' ? (\n <RefJump\n references={column.references}\n value={next}\n label={referenceLabel ?? (String(next) === String(value) && refLabels.get(path) ? row[refLabels.get(path)!] : undefined)}\n table={base}\n column={path}\n row={{ ...row, [path]: next }}\n />\n ) : (\n /* A record's own field is where rich text is read whole; a list or a card shows its excerpt. */\n <Value col={column} value={next} tableId={base.id} compact links wholeText />\n );\n dd = (\n <dd className=\"page-field-edit\">\n <Editable\n table={base}\n row={row}\n column={byName.get(path)!}\n recordKey={key}\n onSaved={onEdit}\n isCurrent={isCurrent}\n app={shell().inApp()}\n display={shell().inApp() ? display : undefined}\n />\n </dd>\n );\n } else if (\n section.edit &&\n !preview &&\n own &&\n recordActions &&\n byName.has(path) &&\n !column?.primaryKey &&\n recordActions.list.some(\n (action) => !action.command && Object.keys((action as { set: object }).set).length === 1 && path in (action as { set: object }).set,\n )\n ) {\n dd = (\n <dd className=\"page-field-edit\">\n <ActionPick\n tableId={base.id}\n recordKey={key}\n column={path}\n value={value}\n actions={recordActions}\n caption={columnLabel(base.id, path, stem) ?? path}\n onDone={onEdit}\n connection={connection}\n />\n </dd>\n );\n } else if (value === null || value === undefined) {\n /* A text a section is only about, with nothing in it, is one muted line saying so, not a dash alone in the\n room of a paragraph. */\n const about = Boolean(section.title) && paths.length === 1 && !rail && column?.references === undefined;\n dd = adorned ? (\n <dd className=\"page-field-adorned\">{adorned}</dd>\n ) : about ? (\n <dd className=\"page-prose-empty\">{say('noneYet', { caption: (columnLabel(base.id, path, stem) ?? path).toLowerCase() })}</dd>\n ) : (\n <dd className=\"null\" title=\"null\">\n {emptyWord()}\n </dd>\n );\n } else if (column?.references && String(value) !== '') {\n const labelAt = refLabels.get(path);\n dd = (\n <dd>\n <RefJump\n references={column.references}\n value={value}\n label={labelAt ? row[labelAt] : undefined}\n table={base}\n column={path}\n row={row}\n />\n {adorned}\n </dd>\n );\n } else {\n dd = (\n <dd>\n <Value col={column} value={value} tableId={base.id} row={row} />\n {adorned}\n </dd>\n );\n }\n const shownAs = shared ? path.slice(shared.length) : path;\n const label = columnLabel(base.id, path, stem) ?? shownAs;\n /* A titled group that holds only its own field says its name once: the\n section's title stands for the field's label, which stays for\n assistive technology. A property rail is caption beside value by its\n shape, so its one row keeps the caption: \"Mar 31, 2026\" alone under\n \"Completed\" read as a stray value, not a rail. */\n /* Text to read rather than a value to glance at goes under its caption at the\n rail's whole width, as a document says it (Document.tsx): beside\n its caption in an aside, Depot's product description wrapped word by word. */\n const rule = columnDisplay(base.id, path) as DisplayRule | null;\n const dress = column?.references || value === null || value === undefined ? null : dressFor(rule, value);\n const long =\n rule?.format === 'richText' ||\n (rail && !column?.references && value != null && (dress ? dress.kind === 'richText' : sayValue(column, value).kind === 'long'));\n /* …and a long text alone under its section's title is read under that title, as a document's paragraph. */\n const lone = Boolean(section.title) && paths.length === 1 && (!rail || long);\n /* …and set as a paragraph: body weight and size, a readable measure, never the weight of a heading. */\n const prose = lone && typeof value === 'string' && !column?.references;\n return (\n <div key={path} className={`page-field${long ? ' page-field-wide' : ''}${prose ? ' page-field-prose' : ''}`}>\n <dt title={path} className={lone ? 'visually-hidden' : undefined}>\n {label}\n </dt>\n {dd}\n </div>\n );\n });\n const columns = typeof section.columns === 'number' ? section.columns : undefined;\n /* Both are lists of terms, so both are drawn as one: a property rail says\n caption beside value, the grid says them in columns. A grid of <dt>/<dd>\n in a <div> had no list for assistive technology to announce. */\n const grid = rail ? (\n <dl className=\"page-properties\" style={columns ? ({ '--page-properties-columns': String(columns) } as CSSProperties) : undefined}>\n {fields}\n </dl>\n ) : (\n <dl\n className={`page-field-grid${presentation === 'summary' ? ' page-field-summary' : ''}`}\n data-columns={columns}\n style={columns ? ({ '--page-field-columns': `repeat(${columns}, minmax(0, 1fr))` } as CSSProperties) : undefined}\n >\n {fields}\n </dl>\n );\n return (\n <SectionBox\n section={section}\n foldable={foldable}\n body={\n <>\n {section.workflow && <WorkflowStatus definition={section.workflow} value={row[section.workflow.field]} reachable={reachable} />}\n {grid}\n </>\n }\n />\n );\n}\n","/** What PageMetrics says, in the dashboards room (packages/kit/src/client/messages.ts says how the catalog is split). */\nimport { defineMessages } from '../../../messages.js';\n\nexport const say = defineMessages({\n thisMetricHasNoView: 'This metric has no view definition.',\n thisRecordHasNoToCount: 'This record has no {of} to count through.',\n thisMetricCouldNotBeRead: 'This metric could not be read.',\n openTheThisCounted: 'Open the {from} this counted',\n thisCountCannotBeReopened: '{from} — this count cannot be reopened as a query',\n thisSectionHasNo: 'This section has no breakdown definition.',\n noIsSetSo: 'No {reference} is set, so there is nothing to count.',\n theseGroupsCouldNotBeRead: 'These groups could not be read.',\n nothingToCountYet: 'Nothing to count yet.',\n noForThisRecord: 'No {from} for this record.',\n openWhere: 'Open {from} where {by} = {row}',\n andSmallerGroups: { one: 'and {count} smaller group', other: 'and {count} smaller groups' },\n thisChartHasNoBreakdown: 'This chart has no breakdown definition.',\n noIsSetSoThere: 'No {reference} is set, so there is nothing to draw.',\n thisChartCouldNotBeRead: 'This chart could not be read.',\n nothingToDrawYet: 'Nothing to draw yet.',\n});\n","/**\n * A page's counting sections: a metric (one number over the record's related\n * rows, reopenable as the query it counted), a breakdown (those rows in\n * groups, biggest first, each group a way into its rows) and a chart (those\n * groups measured and drawn). All read a plan the server compiled; none writes.\n */\nimport { metricMeasure } from '@mistriwork/engine/shared/recordReads.js';\nimport { useContext } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { batchedBreakdown } from '../breakdownBatch.js';\nimport { ownedBy } from '../requestIdentity.js';\nimport type { ResourceClientReply } from '@mistriwork/engine/shared/resourceHttp.js';\nimport { columnDisplay, columnLabel, findTable, go, quote, state, tableView } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { andQuery } from '@mistriwork/engine/shared/query.js';\nimport { formatNumber } from '../locale.js';\nimport { inAppPage, PageRenderContext, usePageApi, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { dressFor, groupLabel, withUnit, type DisplayRule } from './valueModel.js';\nimport { barShare, CurrencyFigures, EXACT, figureSayer, namedGroups, orderGroups, sayer } from './dashboardModel.js';\nimport { currencyPath } from '@mistriwork/engine/shared/money.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { Empty } from './Notes.js';\nimport { say as sayCopy } from '../copy/dashboards/components/PageMetrics.js';\n\n/* The drawing (and the chart kit under it) is fetched the first time a page\n holds a chart, beside the chart's read: most pages have none, and a first\n page is held to a budget (scripts/bundle-budget.mjs). */\nconst ChartFigure = onDemand(() => import('./ChartFigure.js'), 'ChartFigure');\n\n/** One number, and a way to see what it counted. */\nexport function MetricSection({ section, plan }: SlotProps) {\n const api = usePageApi();\n const { connection } = useContext(PageRenderContext);\n /* A count is the rows its view names, counted: the same filter as one\n group with no key, so it is asked as a breakdown and goes with the page's\n other figures in one request (breakdownBatch.ts) — a record with three\n counted tabs sent three reads, each a tenant request of its own. */\n const planned = metricMeasure(plan);\n /* Money each row says its own currency for is summed apart per currency: one figure each, never yen added to dollars. */\n const ownRule =\n !section.format && !plan.counts && section.fn !== 'count' && section.column\n ? (columnDisplay(section.from, section.column) as (DisplayRule & { currencyColumn?: string }) | null)\n : null;\n const split = planned && !planned.by.length && ownRule?.format === 'money' ? currencyPath(ownRule, section.column ?? '') : undefined;\n const measure = planned && split ? { ...planned, by: [{ path: split, alias: 'currency' }], limit: 6 } : planned;\n const counted = plan.counts && plan.view && !plan.breakdown ? measure : undefined;\n const data = useQuery<ResourceClientReply<'/api/view/run'>>({\n queryKey: ['page-metric', plan.view],\n queryFn: () => {\n if (!plan.view) throw new Error(sayCopy('thisMetricHasNoView'));\n return api('/api/view/run', { view: plan.view });\n },\n enabled: !plan.empty && Boolean(plan.view) && !measure,\n staleTime: 0,\n });\n /* A narrowed or distant measure is one group of the child's own rows —\n a breakdown with no key — and its figure is that group's `value`. */\n const measured = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-metric-measure', measure],\n queryFn: () => batchedBreakdown<ResourceClientReply<'/api/breakdown'>>({ def: measure!, owner: ownedBy(connection) }),\n enabled: !plan.empty && Boolean(measure),\n staleTime: 0,\n });\n if (plan.empty) {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <span\n className=\"page-metric-value page-metric-empty\"\n title={sayCopy('thisRecordHasNoToCount', { of: section.of ?? 'reference' })}\n >\n —\n </span>\n }\n />\n );\n }\n if (!plan.view && !plan.breakdown)\n return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('thisMetricHasNoView')} />;\n const reading = measure ? measured : data;\n /* Pending, the figure's own box, unseen: a row of metrics is as tall as its\n figures, and a loading bar of another height moved every section under\n the row when they came (test/built-client-vitals.mjs). */\n if (reading.isPending)\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <button type=\"button\" className=\"page-metric-value\" disabled tabIndex={-1} aria-hidden=\"true\" style={{ visibility: 'hidden' }}>\n <span className=\"metric-number\">0</span>\n <span className=\"metric-of\">{section.title ? '' : section.from}</span>\n </button>\n }\n />\n );\n if (reading.isError) return <SectionBox section={section} body={null} foldable={false} broken={(reading.error as Error).message} />;\n let aggregate: unknown;\n if (measure) {\n const got = measured.data;\n if (!got || 'errors' in got)\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={(got && 'errors' in got ? got.errors[0]?.message : undefined) ?? sayCopy('thisMetricCouldNotBeRead')}\n />\n );\n const figures = got.rows.flatMap((row) =>\n typeof row.currency === 'string' && row.currency.trim() ? [[row.currency.trim().toUpperCase(), row.value] as const] : [],\n );\n aggregate = split ? (figures.length ? new CurrencyFigures(figures) : undefined) : got.rows[0]?.value;\n } else {\n const got = data.data;\n if (!got || !('view' in got))\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={got?.errors[0]?.message ?? sayCopy('thisMetricCouldNotBeRead')}\n />\n );\n const row = got.rows[0] ?? {};\n aggregate = 'value' in row ? row.value : Object.entries(row).find(([k]) => k !== 'id')?.[1];\n }\n const got = data.data && 'view' in data.data ? data.data : undefined;\n const value = plan.counts ? (counted ? (aggregate ?? 0) : (got?.total ?? '—')) : (aggregate ?? (section.fn === 'sum' ? 0 : '—'));\n const open = plan.query\n ? () => go(tableView(section.from, plan.query), 'push')\n : plan.viewText\n ? () => go(tableView(section.from, section.from, `view+${encodeURIComponent(plan.viewText!).replace(/!/g, '%21')}`), 'push')\n : null;\n /* The author's word for the figure stands over its column's, as on a dashboard. */\n const { format, unit } = section;\n const rule: DisplayRule | null = format\n ? { format }\n : !plan.counts && section.fn !== 'count' && section.column\n ? (columnDisplay(section.from, section.column) as DisplayRule | null)\n : null;\n const dress = rule?.format === 'money' && !(value instanceof CurrencyFigures) ? dressFor(rule, value) : null;\n /* An average is said to one place at or past 1, as a dashboard's is: \"3.3\", not \"3.333\". */\n /* A record's own figure is exact, money to its currency's minor digits at any size, each currency's sum too. */\n const said = value === '—' ? value : dress?.text ? withUnit(dress.text, unit) : figureSayer(rule, unit, EXACT)(value);\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <button\n type=\"button\"\n className=\"page-metric-value\"\n disabled={!open}\n title={\n open\n ? sayCopy('openTheThisCounted', { from: section.from ?? '' })\n : sayCopy('thisCountCannotBeReopened', { from: section.from ?? '' })\n }\n onClick={open ?? undefined}\n >\n <span className=\"metric-number\">{said}</span>\n <span className=\"metric-of\">{section.title ? '' : section.from}</span>\n </button>\n }\n />\n );\n}\n\n/** Groups of related rows, biggest first: the \"mostly what?\" answer. */\nexport function BreakdownSection({ section, plan, base }: SlotProps) {\n const { connection } = useContext(PageRenderContext);\n const data = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-breakdown', plan.breakdown],\n queryFn: () => {\n if (!plan.breakdown) throw new Error(sayCopy('thisSectionHasNo'));\n return batchedBreakdown<ResourceClientReply<'/api/breakdown'>>({ def: plan.breakdown, owner: ownedBy(connection) });\n },\n enabled: !plan.empty && Boolean(plan.breakdown),\n staleTime: 0,\n });\n if (plan.empty) {\n /* Said as the reader would: which reference is unset, not a column's name. */\n const reference = section.of\n ? inAppPage()\n ? ((columnLabel(base.id, section.of) as string | null) ?? humanName(section.of)).replace(/[\\s_]+id$/i, '').toLocaleLowerCase()\n : section.of\n : 'reference';\n return <SectionBox section={section} foldable={false} body={<Empty text={sayCopy('noIsSetSo', { reference })} />} />;\n }\n if (!plan.breakdown) return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('thisSectionHasNo')} />;\n if (data.isPending) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n const got = data.data;\n if (!got) return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('theseGroupsCouldNotBeRead')} />;\n if ('errors' in got)\n return (\n <SectionBox section={section} body={null} foldable={false} broken={got.errors[0]?.message ?? sayCopy('theseGroupsCouldNotBeRead')} />\n );\n const [keyName, countName] = got.columns;\n /* Biggest first, as the plan asks the server — or, where the column has a\n vocabulary, in its order (dashboardModel.ts, orderGroups). */\n /* The grouped column read through its path, so `campaign_id.kind` finds the vocabulary of the campaign's kind. */\n const allowed = presentationColumns(state.schema, findTable(section.from) as TableMeta | undefined, [section.by ?? '']).get(\n section.by ?? '',\n )?.allowed;\n const rows = orderGroups(got.rows, keyName, countName, allowed);\n // A table's name (\"campaign_member\") is the Workbench's vocabulary, not an\n // App reader's; a breakdown's title names groups, so it cannot be reused.\n if (!rows.length)\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={<Empty text={inAppPage() ? sayCopy('nothingToCountYet') : sayCopy('noForThisRecord', { from: section.from ?? '' })} />}\n />\n );\n /* A group as a doorway: the anchoring condition comes off the compiled plan. */\n const conds = plan.breakdown.filter?.groups?.length === 1 ? plan.breakdown.filter.groups[0] : null;\n const anchor = conds?.find((c) => c.path === section.path && c.op === '=' && c.value != null);\n const drill =\n anchor && section.by\n ? (value: unknown) => {\n const where = andQuery(\n `${anchor.path} = ${quote(String(anchor.value))}`,\n section.filter,\n `${section.by} = ${quote(String(value))}`,\n );\n go(tableView(plan.breakdown!.base, `${plan.breakdown!.base} ${where}`), 'push');\n }\n : null;\n const largest = Math.max(...rows.map((r) => Number(r[countName]) || 0));\n // A measured breakdown (\"sum open_value\") dresses its figures as the column it reads, as a metric does.\n /* The author's word for the figures stands over the column's, as on a metric (G111). */\n const rule: DisplayRule | null = section.format\n ? { format: section.format }\n : section.fn && section.fn !== 'count' && section.column\n ? (columnDisplay(section.from, section.column) as DisplayRule | null)\n : null;\n const sayFigure = section.format || section.unit ? figureSayer(rule, section.unit) : formatNumber;\n const more = typeof got.total === 'number' && got.total > rows.length ? got.total - rows.length : 0;\n const sayKey = namedGroups(got, keyName, (key) =>\n groupLabel(columnDisplay(section.from, section.by) as DisplayRule | null, key, allowed),\n );\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <div className=\"page-breakdown-rows\">\n {rows.map((row, i) => {\n const count = Number(row[countName]) || 0;\n const dress = rule?.format === 'money' && row[countName] != null ? dressFor(rule, row[countName]) : null;\n const shown = row[countName] == null ? '0' : dress?.text ? withUnit(dress.text, section.unit) : sayFigure(row[countName]);\n const parts = (\n <>\n <span className=\"pbd-label\">{sayKey(row[keyName])}</span>\n <span className=\"pbd-bar\">\n <span className=\"pbd-fill\" style={{ width: `${barShare(count, largest)}%` }} />\n </span>\n <span className=\"pbd-count\">{shown}</span>\n </>\n );\n return drill && row[keyName] != null ? (\n <button\n key={i}\n type=\"button\"\n className=\"pbd-row pbd-drill\"\n title={sayCopy('openWhere', { from: section.from ?? '', by: section.by ?? '', row: String(row[keyName]) })}\n onClick={() => drill(row[keyName])}\n >\n {parts}\n </button>\n ) : (\n <div key={i} className=\"pbd-row\">\n {parts}\n </div>\n );\n })}\n {more > 0 && <p className=\"note pbd-more\">{sayCopy('andSmallerGroups', { count: more })}</p>}\n </div>\n }\n />\n );\n}\n\n/**\n * The related rows measured and drawn — the dashboard's chart about one\n * record. The plan is a breakdown anchored on the record (page.ts, chartPlan);\n * the drawing is the dashboard's own (ChartFigure).\n */\nexport function ChartSection({ section, plan, base }: SlotProps) {\n const { connection } = useContext(PageRenderContext);\n /* The section's own skeleton stands until the drawing has come as well as the answer. */\n const drawable = useArrived(ChartFigure, !plan.empty && Boolean(plan.breakdown));\n const data = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-breakdown', 'chart', plan.breakdown],\n queryFn: () => {\n if (!plan.breakdown) throw new Error(sayCopy('thisChartHasNoBreakdown'));\n return batchedBreakdown<ResourceClientReply<'/api/breakdown'>>({ def: plan.breakdown, owner: ownedBy(connection) });\n },\n enabled: !plan.empty && Boolean(plan.breakdown),\n staleTime: 0,\n });\n if (plan.empty) {\n const reference = section.of\n ? inAppPage()\n ? ((columnLabel(base.id, section.of) as string | null) ?? humanName(section.of)).replace(/[\\s_]+id$/i, '').toLocaleLowerCase()\n : section.of\n : 'reference';\n return <SectionBox section={section} foldable={false} body={<Empty text={sayCopy('noIsSetSoThere', { reference })} />} />;\n }\n if (!plan.breakdown) return <SectionBox section={section} body={null} foldable={false} broken={sayCopy('thisChartHasNoBreakdown')} />;\n if (data.isPending || (!drawable && !data.isError)) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n const got = data.data;\n if (!got || 'errors' in got)\n return (\n <SectionBox\n section={section}\n body={null}\n foldable={false}\n broken={(got && 'errors' in got ? got.errors[0]?.message : undefined) ?? sayCopy('thisChartCouldNotBeRead')}\n />\n );\n const from = section.from ?? '';\n /* Each key's column, its period dropped: \"month issued_on\" is labelled as issued_on is. */\n const [first = '', second = ''] = (section.by ?? '').split(',').map((key) => key.trim().split(/\\s+/).pop() ?? '');\n const say = sayer({\n kind: 'chart',\n table: from,\n measure: section.fn && section.fn !== 'count' ? `${section.fn} ${section.column ?? ''}` : undefined,\n format: section.format,\n unit: section.unit,\n });\n const labelFor = (path: string) => {\n const allowed = presentationColumns(state.schema, findTable(from) as TableMeta | undefined, [path]).get(path)?.allowed;\n const rule = columnDisplay(from, path) as DisplayRule | null;\n return { say: (key: unknown) => groupLabel(rule, key, allowed), allowed };\n };\n const firstLabel = labelFor(first);\n /* The column a category order reads rides after the figures (page.ts, chartOrder): it is no series of the drawing. */\n const drawn = { ...got, columns: got.columns.slice(0, (second ? 2 : 1) + 1) };\n /* A slice — or a line's point — is a way into its rows where the key is a plain column, as a breakdown's group is. */\n const conds = plan.breakdown.filter?.groups?.length === 1 ? plan.breakdown.filter.groups[0] : null;\n const anchor = conds?.find((c) => c.path === section.path && c.op === '=' && c.value != null);\n const plainKey = !/\\s/.test((section.by ?? '').split(',')[0].trim());\n const drill =\n anchor && plainKey && (section.shape === 'donut' || section.shape === 'line')\n ? (value: unknown) => {\n if (value == null) return;\n const where = andQuery(`${anchor.path} = ${quote(String(anchor.value))}`, section.filter, `${first} = ${quote(String(value))}`);\n go(tableView(plan.breakdown!.base, `${plan.breakdown!.base} ${where}`), 'push');\n }\n : null;\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <ChartFigure\n answer={drawn}\n arrange={section.sort === 'value' ? 'value' : plan.breakdown.orderBy?.[0]?.name === 'value' ? undefined : 'answer'}\n shape={section.shape}\n limit={section.limit}\n target={section.target}\n height={section.height}\n say={say}\n label={namedGroups(got, got.columns[0], firstLabel.say)}\n seriesLabel={namedGroups(got, second ? got.columns[1] : undefined, labelFor(second).say)}\n vocabulary={firstLabel.allowed}\n onPick={drill}\n empty={inAppPage() ? sayCopy('nothingToDrawYet') : sayCopy('noForThisRecord', { from })}\n />\n }\n />\n );\n}\n","/** What PageTimeline 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 thisActivityStreamHasNoView: 'This activity stream has no view definition.',\n thisActivityStreamCould: 'This activity stream could not be read.',\n nothingDatedYetForThisRecord: 'Nothing dated yet for this record.',\n updates: { one: '{count} update', other: '{count} updates' },\n});\n","/**\n * A page's timeline section: the record's activity as one stream, its\n * streams read together and merged newest-first, and, where the App lets\n * this record add to its first stream, the composer that does it through\n * the same related-create plan and form a related list uses.\n */\nimport { useContext, useId, useLayoutEffect, useRef, useState } from 'react';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { findTable, labelPath, state } from '../core.js';\nimport { shell } from '../shellMode.js';\nimport { resourceOf } from './appRooms.js';\nimport { headingOf, recordNoun } from '@mistriwork/engine/shared/appNoun.js';\nimport { dayOf, formatDateTime, formatDayHeading, formatTimeOfDay } from '../locale.js';\nimport { hueOf, initialsOf } from './valueModel.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { relatedCreatePlan } from '@mistriwork/engine/shared/relatedCreate.js';\nimport { timelineReads } from '@mistriwork/engine/shared/recordReads.js';\nimport { type TimelineTone } from '@mistriwork/engine/shared/pageModel.js';\nimport { canInsert, openRelatedRecord } from '../insert.js';\nimport { PageRenderContext, usePageApi, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { Empty } from './Notes.js';\nimport { Value } from './Value.js';\nimport { listColumn } from './listColumn.js';\nimport type { ColumnMeta } from '@mistriwork/engine/shared/schema.js';\nimport { say } from '../copy/record/components/PageTimeline.js';\n\n/**\n * What a merged row says it is: its resource's noun (\"Call\", \"Note\"), the word\n * a New button and a page already use, and the table's name as a person says\n * it where the resource names none — never a source's qualified name\n * (`sales.deal_estimate`). The Workbench shows the table as it is.\n */\nfunction streamSource(tableId: string, table: TableMeta | undefined): string {\n if (!shell().inApp()) return table?.name ?? tableId;\n const name = table?.name ?? tableId;\n return headingOf(recordNoun(resourceOf(shell().app(), table?.id ?? tableId)?.noun, name.slice(name.lastIndexOf('.') + 1)));\n}\n\n/** One row of the merged stream: what it says, who, when, and how the section's rules dress it. */\ninterface TimelineRow {\n when: string;\n text: unknown;\n textColumn?: ColumnMeta;\n detail: unknown;\n detailColumn?: ColumnMeta;\n table: string;\n by: string | null;\n source: string;\n tone?: TimelineTone;\n compact?: boolean;\n /** The other party's, as the section's `side` says: drawn against the far edge. */\n other?: boolean;\n}\n\n/** A row no person wrote, as the section's `compact` rule says: a row without an author is not one (a customer's\n message may have none where the author is the agent). */\nconst isEvent = (r: TimelineRow) => Boolean(r.compact);\n\n/** The rows by calendar day, each day's runs of two or more events folded into one item. */\nfunction byDay(rows: TimelineRow[]) {\n const days: Array<{ day: string; items: Array<TimelineRow | TimelineRow[]> }> = [];\n for (const r of rows) {\n const day = dayOf(r.when) ?? '';\n let last = days.at(-1);\n if (!last || last.day !== day) days.push((last = { day, items: [] }));\n const prev = last.items.at(-1);\n if (isEvent(r) && prev && (Array.isArray(prev) || isEvent(prev))) last.items[last.items.length - 1] = [prev, r].flat();\n else last.items.push(r);\n }\n return days;\n}\n\n/** The time of day a row was written; the day is its group's heading, the whole moment its title. */\nfunction When({ at }: { at: string }) {\n const time = formatTimeOfDay(at);\n return time ? (\n <time className=\"timeline-when\" dateTime={at} title={formatDateTime(at)}>\n {time}\n </time>\n ) : null;\n}\n\n/** Whether a message goes on its author's run: the same person, on the same side, in the same dress, right after. */\nconst runsOn = (r: TimelineRow, prev: TimelineRow | TimelineRow[] | undefined) =>\n Boolean(prev && !Array.isArray(prev) && !isEvent(prev) && r.by && prev.by === r.by && prev.other === r.other && prev.tone === r.tone);\n\n/** One row: an event is one quiet line; a message is who, what kind and when over its words, its author said once a run\n where the section has sides. */\nfunction Row({\n r,\n multi,\n conversation,\n continued = false,\n}: {\n r: TimelineRow;\n multi: boolean;\n conversation: boolean;\n continued?: boolean;\n}) {\n const words =\n r.text == null || r.text === '' ? (\n ''\n ) : (\n <Value tableId={r.table} col={r.textColumn} value={r.text} compact links wholeText={conversation} />\n );\n const tone = r.tone ? { 'data-tone': r.tone } : {};\n if (isEvent(r))\n return (\n <li className=\"timeline-row is-compact\" data-timeline-row {...tone}>\n <span className=\"timeline-text\">{words}</span>\n <When at={r.when} />\n </li>\n );\n return (\n <li\n className={`timeline-row${r.tone ? ' is-tinted' : ''}${r.other ? ' is-other' : ''}${continued ? ' is-continued' : ''}`}\n data-timeline-row\n {...tone}\n >\n {r.by && !continued ? (\n <span className={`timeline-avatar avatar avatar-c${hueOf(r.by)}`} aria-hidden=\"true\">\n {initialsOf(r.by)}\n </span>\n ) : (\n <span className=\"timeline-avatar\" aria-hidden=\"true\" />\n )}\n <span className=\"timeline-head\">\n {r.by && (continued ? <span className=\"visually-hidden\">{r.by}</span> : <span className=\"timeline-by\">{r.by}</span>)}\n {r.detail != null && (\n <span className=\"timeline-kind\">\n <Value tableId={r.table} col={r.detailColumn} value={r.detail} compact />\n </span>\n )}\n {multi && <span className=\"timeline-source\">{r.source}</span>}\n <When at={r.when} />\n </span>\n <div className=\"timeline-text prose\">{words}</div>\n </li>\n );\n}\n\n/** Two or more events in a row, said as their count and opened in place. */\nfunction Fold({ rows, multi, conversation }: { rows: TimelineRow[]; multi: boolean; conversation: boolean }) {\n const [open, setOpen] = useState(false);\n const id = useId();\n return (\n <li className=\"timeline-fold\">\n <button type=\"button\" className=\"timeline-fold-toggle\" aria-expanded={open} aria-controls={id} onClick={() => setOpen(!open)}>\n <svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" aria-hidden=\"true\" focusable=\"false\">\n <path d=\"M6 4l4 4-4 4\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.6\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n {say('updates', { count: rows.length })}\n </button>\n <ol className=\"timeline-rows\" id={id} hidden={!open}>\n {rows.map((r, i) => (\n <Row key={i} r={r} multi={multi} conversation={conversation} />\n ))}\n </ol>\n </li>\n );\n}\n\n/** The record's activity as one stream, merged newest-first (or, as a conversation, oldest-first) across its streams. */\n/* The other side's stylesheet, a part of its own: only a section with a `side` (its own or a stream's) asks for it. */\nconst Sides = onDemand(() => import('./TimelineSides.js'), 'TimelineSides', { quiet: true });\n\nexport function TimelineSection({ section, plan, base, recordKey }: SlotProps) {\n /* Rows with sides wait for their dress, under the section's one skeleton, so nothing moves when it comes. */\n const sided = Boolean(section.side || section.streams?.some((stream) => stream.side));\n const sidesHere = useArrived(Sides, sided);\n const api = usePageApi();\n const { preview, isCurrent, openRelated } = useContext(PageRenderContext);\n const queries = useQueryClient();\n const [added, setAdded] = useState(false);\n const createButton = useRef<HTMLButtonElement>(null);\n const streams = plan.streams ?? [];\n const conversation = section.newest === 'last';\n /* The conversation's box, as a state: a sided conversation draws its placeholder until its sides arrive, and the box\n drawn then is a new one the first scroll never saw. */\n const [scroller, setScroller] = useState<HTMLDivElement | null>(null);\n /* Whether the reader is at the foot: the box keeps them there while it settles, and leaves them where they scrolled. */\n const atFoot = useRef(true);\n /* A row's line and detail are values of their stream's table, dressed by its display rules and drawn by its\n value components as a grid cell is; `table` is whose rules they are. */\n const data = useQuery<TimelineRow[]>({\n queryKey: ['page-timeline', plan.streams, section.limit, section.tone, section.compact, section.streams],\n queryFn: async () => {\n const answers = await Promise.all(\n streams.map(async (stream, s) => {\n /* The stream as authored: its own tone and compact stand over the section's rules. */\n const own = section.streams?.[s];\n if (stream.error) throw new Error(stream.error);\n if (stream.empty) return [];\n if (!stream.view) throw new Error(say('thisActivityStreamHasNoView'));\n const table = findTable(stream.from) as TableMeta | undefined;\n /* An author that is a reference (`author: 'owner_id'`) says the person's name, as a list column of the same\n reference does: read through the reference to the record's label, where this reader reads that table.\n The other party's rows are the same read narrowed by the section's `side`, asked beside it: their keys.\n Both as the page's planned reads ask them (shared recordReads.ts `timelineReads`), so a composed page's\n answers are these very reads. */\n if (stream.side?.error) throw new Error(stream.side.error);\n const asked = timelineReads(\n { table: (id) => findTable(id) as TableMeta | undefined, namePath: (target) => labelPath(target) },\n stream,\n )!;\n const view = asked.view;\n const named = asked.view !== stream.view ? asked.view.columns?.at(-1)?.path : undefined;\n const byPath = named ?? stream.by;\n const others = asked.side ? api('/api/view/run', { view: asked.side, offset: 0 }) : undefined;\n const [got, otherRows] = await Promise.all([api('/api/view/run', { view, offset: 0 }), others]);\n if (!('view' in got)) throw new Error(got.errors[0]?.message ?? say('thisActivityStreamCould'));\n if (otherRows && !('view' in otherRows)) throw new Error(otherRows.errors[0]?.message ?? say('thisActivityStreamCould'));\n const keyOf = (row: Record<string, unknown>, names: string[], cols: string[]) =>\n JSON.stringify(stream.key!.map((column) => row[cols[names.indexOf(column)] ?? column] ?? null));\n const otherKeys =\n otherRows &&\n new Set(otherRows.rows.map((row: Record<string, unknown>) => keyOf(row, stream.key!, otherRows.columns ?? stream.key!)));\n const names = (view.columns ?? []).map((c) => c.path);\n const cols: string[] = got.columns ?? names;\n const atCol = cols[names.indexOf(stream.at)] ?? stream.at;\n const showCol = cols[names.indexOf(stream.show)] ?? stream.show;\n const detailCol = stream.detail ? (cols[names.indexOf(stream.detail)] ?? stream.detail) : null;\n const byCol = byPath ? (cols[names.indexOf(byPath)] ?? byPath) : null;\n const markCol = (name: string) => cols[names.indexOf(name)] ?? name;\n const shown = table && listColumn(table, stream.show);\n const detailed = table && stream.detail ? listColumn(table, stream.detail) : undefined;\n return got.rows.map((row): TimelineRow => ({\n when: row[atCol] == null ? '' : String(row[atCol]),\n text: row[showCol] ?? null,\n ...(shown ? { textColumn: { ...shown, name: stream.show } } : {}),\n detail: detailCol && row[detailCol] != null && row[detailCol] !== '' ? row[detailCol] : null,\n ...(detailed ? { detailColumn: { ...detailed, name: stream.detail! } } : {}),\n table: table?.id ?? stream.from,\n by: byCol && row[byCol] != null ? String(row[byCol]) : null,\n source: streamSource(stream.from, table),\n /* A column's value picks the tone, and a one-line row: the section's rules read each row's own columns,\n where the stream says neither for all its rows. */\n ...(() => {\n const said = (column: string) => (row[markCol(column)] == null ? undefined : String(row[markCol(column)]));\n const tone =\n own?.tone ??\n Object.entries(section.tone ?? {})\n .map(([column, tones]) => tones[said(column) ?? ''])\n .find(Boolean);\n const small =\n own?.compact === true ||\n (own?.compact === undefined &&\n Object.entries(section.compact ?? {}).some(([column, values]) => values.includes(said(column) ?? '')));\n const other = !small && otherKeys?.has(keyOf(row, names, cols));\n return { ...(tone ? { tone } : {}), ...(small ? { compact: true } : {}), ...(other ? { other: true } : {}) };\n })(),\n }));\n }),\n );\n return answers\n .flat()\n .filter((r) => r.when)\n .sort((a, b) => (a.when < b.when ? 1 : a.when > b.when ? -1 : 0))\n .slice(0, section.limit ?? 20);\n },\n staleTime: 0,\n });\n /* A conversation reads to its newest line, at the foot: scrolled there when it arrives and when a message is added,\n and kept there while what is above it settles — a face's metrics, an avatar, a message's prose drawn a moment\n later. Scrolled there once, it was left a few pixels short at a desk and most of a message short on a phone as\n the rows grew under it, the top line cut, neither at the first message nor at the newest (G184). Once the reader\n scrolls away from the foot, the box stays where they put it. */\n useLayoutEffect(() => {\n if (!conversation || !scroller) return;\n const box = scroller;\n /* At the foot the box's top edge falls wherever the height runs out, mostly inside a message: so the box stands a\n little shorter than its most, by less than one message, for that edge to fall where a message (or a day) starts.\n Only while the reader is at the foot; their own scroll is theirs. */\n const foot = () => {\n if (!atFoot.current) return;\n box.style.maxHeight = '';\n const room = box.clientHeight,\n whole = box.scrollHeight;\n if (whole > room + 1) {\n const origin = box.getBoundingClientRect().top - box.scrollTop;\n const over = whole - room;\n /* The box's height and its scroll are whole pixels and a face's lines are not (Barlow's start at fractions):\n floored, the edge fell up to a pixel inside the line it was meant to start. Rounded, it falls within half a\n pixel of that line's start, on either side, so a line is taken only where rounding lands no lower. */\n const edge = [...box.querySelectorAll<HTMLElement>('.timeline-day-label, [data-timeline-row], .timeline-fold')]\n .filter((line) => line.offsetHeight > 0)\n .map((line) => line.getBoundingClientRect().top - origin)\n .filter((top) => top >= over - 0.5)\n .sort((a, b) => a - b)[0];\n const height = edge === undefined ? room : Math.round(whole - edge);\n if (height < room) box.style.maxHeight = `${height}px`;\n }\n box.scrollTop = box.scrollHeight;\n };\n atFoot.current = true;\n foot();\n const read = () => {\n atFoot.current = box.scrollTop + box.clientHeight >= box.scrollHeight - 2;\n };\n box.addEventListener('scroll', read, { passive: true });\n const settle = new ResizeObserver(foot);\n settle.observe(box);\n for (const child of box.children) settle.observe(child);\n return () => {\n box.removeEventListener('scroll', read);\n settle.disconnect();\n };\n }, [conversation, scroller]);\n // A message added (the reader's own, or one that arrived) takes the reader to the foot, where it is.\n useLayoutEffect(() => {\n if (!conversation || !scroller) return;\n atFoot.current = true;\n scroller.scrollTop = scroller.scrollHeight;\n }, [conversation, scroller, data.data]);\n if (data.isPending || (sided && !sidesHere)) return <Loading section={section} />;\n if (data.isError) return <SectionBox section={section} body={null} foldable={false} broken={(data.error as Error).message} />;\n const rows = conversation ? [...(data.data ?? [])].reverse() : (data.data ?? []);\n /* A message names its stream only where the messages come from more than one: a conversation whose second stream\n is all quiet lines (time logged) said \"Activity\" over every message, a word that told the reader nothing. */\n const multi = new Set(rows.filter((r) => !isEvent(r)).map((r) => r.source)).size > 1;\n /* The composer adds a row of the first stream, bound to this record the way\n a related list's create is: the same plan, the same form, no new write\n path. A stream narrowed by a query could hide the row it just added. */\n const first = section.streams?.[0];\n const table = first ? (findTable(first.from) as TableMeta | undefined) : undefined;\n const creation =\n section.create && first && !first.filter && table && state.schema\n ? relatedCreatePlan(state.schema, base.id, table.id, first.path, section.create)\n : undefined;\n const defaults = creation?.bindings && Object.fromEntries(creation.bindings.map((b) => [b.column, recordKey[b.parent]]));\n const canCreate =\n !preview &&\n shell().inApp() &&\n table &&\n canInsert(table) &&\n defaults &&\n Object.values(defaults).every((v) => typeof v === 'string' || typeof v === 'number');\n const composeButton = !section.composer && canCreate && (\n <div className=\"page-related-create timeline-compose\">\n {added && <span role=\"status\">{say('common.added')}</span>}\n <button\n type=\"button\"\n className=\"ghost\"\n ref={createButton}\n onClick={() => {\n if (isCurrent && !isCurrent()) return;\n setAdded(false);\n (openRelated ?? openRelatedRecord)(\n table,\n { show: creation!.show, defaults: { ...(creation!.defaults ?? {}), ...defaults } },\n () => {\n if (isCurrent && !isCurrent()) return;\n setAdded(true);\n void queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n createButton.current?.focus();\n },\n );\n }}\n >\n + {section.create!.label}\n </button>\n </div>\n );\n /* The composer sends through the App's commands (TimelineComposer.tsx), drawn through the shell's slot. */\n const { TimelineComposer } = shell().slots;\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={\n <>\n {composeButton}\n {rows.length ? (\n <div\n className={conversation ? 'timeline-scroll' : undefined}\n {...(conversation ? { 'data-scrolls': '' } : {})}\n ref={setScroller}\n >\n <ol className=\"timeline\">\n {byDay(rows).map(({ day, items }, d) => (\n <li key={day || d} className=\"timeline-day\">\n {day && (\n <time className=\"timeline-day-label\" dateTime={day}>\n {formatDayHeading(day)}\n </time>\n )}\n <ol className=\"timeline-rows\">\n {items.map((item, i) =>\n Array.isArray(item) ? (\n <Fold key={`${item[0]!.when} ${item[0]!.table}`} rows={item} multi={multi} conversation={conversation} />\n ) : (\n <Row\n key={`${item.when} ${item.table}`}\n r={item}\n multi={multi}\n conversation={conversation}\n continued={sided && runsOn(item, items[i - 1])}\n />\n ),\n )}\n </ol>\n </li>\n ))}\n </ol>\n </div>\n ) : (\n <Empty text={say('nothingDatedYetForThisRecord')} />\n )}\n {section.composer && !preview && shell().inApp() && TimelineComposer && (\n <TimelineComposer\n composer={section.composer}\n recordKey={recordKey as Record<string, string | number>}\n table={base?.id}\n onSent={() =>\n void queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n })\n }\n />\n )}\n </>\n }\n />\n );\n}\n","/**\n * The reader's own settings, in one quiet place.\n *\n * Density, rows per list, rows per related list: each existed (or wanted\n * to) as its own control in its own corner, which is fine for one\n * preference and a scavenger hunt for three. The dialog holds them\n * together; every choice applies as it is made, because a Save button on\n * a preferences panel is a promise the panel could have kept already.\n *\n * All of it is per-browser, like the theme: these are facts about the\n * reader's eyes and screen, not about the data, so they belong beside the\n * chair rather than in the team's config.\n */\nimport { createElement } from 'react';\nimport { mount, unmount } from './components/mount.js';\nimport { onDemand } from './components/onDemand.js';\nimport { portalRoot } from './shellHost.js';\nexport { relatedRows } from './relatedRows.js';\n\n/* Loaded the first time it opens. */\nconst PrefsDialog = onDemand(() => import('./components/Prefs.js'), 'PrefsDialog', { quiet: true });\n\n/** The dialog is `components/Prefs.tsx`; this is its one host on the body. */\nexport function openPrefs() {\n const host = document.createElement('div');\n host.className = 'host-contents';\n portalRoot().append(host);\n mount(\n host,\n createElement(PrefsDialog, {\n onClose: () => {\n unmount(host);\n host.remove();\n },\n }),\n );\n}\n","/**\n * The most bytes one uploaded file may be, whatever a resource says: an App's\n * `file` block may ask for less, never more (appModel.ts), and the server\n * sizes the one request body allowed past its usual bound from it (server\n * http/reply.ts FILE_UPLOAD_BODY). Uploads cross as base64 inside JSON.\n */\nexport const FILE_MAX_BYTES_CEILING = 25 * 1024 * 1024;\n\n/** An upload's cap when the resource does not say. */\nexport const FILE_MAX_BYTES_DEFAULT = 10 * 1024 * 1024;\n","/** What PageCurrent 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","/**\n * A current card (`current(title, from, whose, { query, sort })`, a related\n * list with presentation 'card'): the one row the query and the sort choose —\n * the active lease of a unit, the latest visit — as the record-card a\n * reference draws (PageFields.tsx), captioned by the section's title. The\n * row's name is its title and opens it — said without the page record's own\n * name, as a child list says it (\"Telehealth\", not \"Noah Fischer ·\n * telehealth\" on Noah's page); the columns its `show` names are the facts,\n * in that order, each dressed by its display rule, and nothing else the read\n * carried to name or open the row; \"View lease\" says so again at the foot.\n * With no such row the card says what that means, in the author's words\n * where there are some.\n */\nimport type { ReactNode } from 'react';\nimport { columnLabel, labelPath, openRecord, state } from '../core.js';\nimport { opensRecord } from '../recordIntent.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { primaryKey, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { Value } from './Value.js';\nimport { presentationColumns } from './columnPresentation.js';\nimport { say } from '../copy/record/components/PageCurrent.js';\n\nexport function CurrentCard({\n table,\n caption,\n row,\n columns,\n show,\n labels,\n referenceLabels,\n record,\n title,\n noun,\n empty,\n}: {\n table: TableMeta;\n /** The section's title: what the card is (\"Current lease\"). */\n caption?: string;\n row: Record<string, unknown> | undefined;\n /** The row's shown columns, the list's private projection already left out. */\n columns: string[];\n /** The section's `show`: the facts, in its order. Without one, every shown column but the name and the key. */\n show?: readonly string[];\n labels?: Record<string, string>;\n /** Column → the joined column naming the record it references. */\n referenceLabels?: Record<string, string>;\n record: { key: Record<string, unknown> | null; label: string } | undefined;\n /** The name the card is titled by, where it says less than the record's own (its parent's name left out);\n null where it is the page's own name, which the heading already says. */\n title?: string | null;\n /** What one row is called, for the foot's \"View …\". */\n noun: string;\n empty: ReactNode;\n}) {\n const naming = labelPath(table);\n const keys = primaryKey(table);\n /* A card titled by a computed name still reads a column to name the row by\n where the App names none: that column is the title, not a fact the\n author asked for. */\n const asked = (show?.length ? show.filter((name) => columns.includes(name)) : columns).filter(\n (name) => name !== naming && !keys.includes(name),\n );\n const facts = asked.filter((name) => row && row[name] !== null && row[name] !== undefined && row[name] !== '');\n const metadata = presentationColumns(state.schema, table, facts);\n const open = () => {\n if (record?.key) void openRecord(table.id, record.key, record.label);\n };\n return (\n <div className=\"page-card page-current\">\n {caption && <h2 className=\"page-card-caption\">{caption}</h2>}\n {row && record ? (\n <>\n {title !== null && (\n <p className=\"page-card-title\">\n {record.key ? (\n <button type=\"button\" className=\"ref-jump page-card-name\" data-opens={opensRecord(table.id, record.key)} onClick={open}>\n {title ?? record.label}\n </button>\n ) : (\n <span>{title ?? record.label}</span>\n )}\n </p>\n )}\n {facts.length > 0 && (\n <dl className=\"page-card-facts\">\n {facts.map((name) => {\n const label = referenceLabels?.[name] ? row[referenceLabels[name]] : undefined;\n const col = metadata.get(name) ?? { name, type: 'TEXT', nullable: true, primaryKey: false };\n return (\n <div key={name} className=\"page-card-fact\">\n <dt>{labels?.[name] ?? columnLabel(table.id, name) ?? humanName(name)}</dt>\n <dd>\n <Value tableId={table.id} col={label == null ? col : { ...col, type: 'TEXT' }} value={label ?? row[name]} compact />\n </dd>\n </div>\n );\n })}\n </dl>\n )}\n {record.key && (\n <p className=\"page-card-foot\">\n <button type=\"button\" className=\"ref-jump page-card-more\" data-opens={opensRecord(table.id, record.key)} onClick={open}>\n {say('common.view', { noun })}\n </button>\n </p>\n )}\n </>\n ) : (\n <div className=\"page-current-empty\">{empty}</div>\n )}\n </div>\n );\n}\n","/**\n * Deleting a row, having first said what that would do.\n *\n * This is the one destructive action in tablewalk, and it is also the one place\n * the tool has a genuine advantage over every other database client — not\n * through cleverness, but because of what it already knows. It counts what\n * points at a row in order to draw the Related panel; the same counts answer\n * \"what breaks if this goes\" *before* the delete rather than as a constraint\n * violation afterwards.\n *\n * The count alone is not the answer, which is the part most tools would get\n * wrong if they tried. Three rows pointing at this one means three rows\n * deleted under `cascade`, three rows left holding a null under `set null`, and\n * a delete that simply fails under `restrict`. Three outcomes behind one\n * number. So the dialog leads with the *rule*, and a rule the adapter could not\n * determine says so rather than being quietly rendered as harmless.\n *\n * The button and its dialog are a component (components/DeleteButton.tsx); what\n * stays here is the gate every write affordance shares.\n */\nimport { state, writeAllowed } from './core.js';\n\n/**\n * Whether this connection will accept a delete at all.\n *\n * Asked of the server's own answer rather than inferred: `writable` is on the\n * connection list precisely so the interface does not offer a button the server\n * would refuse.\n */\nexport function canDelete(table) {\n if (!state.canWrite || !table || table.isView || table.deletable === false) return false;\n if (!writeAllowed(table.id)) return false;\n return Boolean(state.connections?.find((c) => c.id === state.activeConnection)?.writable);\n}\n","/** What PageRelated 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 thisListHasNoView: 'This list has no view definition.',\n nothingHereYet: 'Nothing here yet.',\n noIsSetSoThere: 'No {reference} is set, so there are no {things} to show.',\n thisListCouldNotBeRead: 'This list could not be read.',\n noRelatedRecordsYet: 'No related records yet.',\n noRightNow: 'No {thing} right now.',\n thisPageHasMoved: 'This page has moved on; nothing was renamed.',\n thisPageHasMovedOn: 'This page has moved on; nothing was removed.',\n theFileWasNotRemoved: 'The file was not removed.',\n thisPageHasMovedOnNothing: 'This page has moved on; nothing was attached.',\n recordAdded: 'Record added',\n photos: 'Photos',\n noPhotosYet: 'No photos yet.',\n noFilesYet: 'No files yet.',\n attachFiles: 'Attach files',\n addThing: 'Add {thing}',\n noForThisRecord: 'No {name} for this record.',\n previousRows: 'Previous rows',\n moreRows: 'More rows',\n totalAllThings: 'Total · all {things}',\n totalAllCountThings: 'Total · all {count} {things}',\n recordsNoun: 'records',\n});\n","/**\n * A page's related list: the rows that point at the root, a page at a time,\n * drawn as the section asks — a grid, cards, a gallery of photos, or\n * attachments when the rows are files — with the create, upload and pager\n * a list offers. Adding refreshes every list, timeline and count on the page.\n */\nimport { PresentationSwitch } from './PresentationSwitch.js';\nimport { useContext, useMemo, useRef, useState } from 'react';\nimport { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query';\nimport { ownedBy } from '../requestIdentity.js';\nimport type { ResourceClientReply } from '@mistriwork/engine/shared/resourceHttp.js';\nimport { columnLabel, recordLabel, api as coreApi, findTable, openRecord, rowLabel, state, writeAllowed } from '../core.js';\nimport { relatedRows } from '../prefs.js';\nimport { formatBytes, formatNumber, formatRelativeDay } from '../locale.js';\nimport { columnKind, type DatabaseSchema, type TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { recordViewKey, recordViewLabel, withoutParent, withoutParentName } from '@mistriwork/engine/shared/referenceModel.js';\nimport { groupsBody, listView } from '@mistriwork/engine/shared/recordReads.js';\nimport { GROUP_ROWS_DEFAULT, GROUPS_DEFAULT } from '@mistriwork/engine/shared/pageModel.js';\nimport { groupFactPaths, groupTable } from '@mistriwork/engine/shared/pagePaths.js';\nimport { andQuery, quoteValue } from '@mistriwork/engine/shared/query.js';\nimport { Grid } from './Grid.js';\nimport { RowActions } from './RowActions.js';\nimport { RowTrailHosts, rowKeyString } from './RowHost.js';\nimport type { GroupMoves } from './groupMoves.js';\nimport { wholeColumn } from './placeOrder.js';\nimport { mayRunAny } from '../actionGrants.js';\nimport { offeredBy } from './appRooms.js';\nimport { Icon } from './Icon.js';\nimport { relatedCreatePlan } from '@mistriwork/engine/shared/relatedCreate.js';\nimport { inlineFileAddress } from './cardsModel.js';\nimport { filesOnLease, saveFileOnLease } from '../fileSource.js';\nimport { FILE_MAX_BYTES_DEFAULT } from '@mistriwork/engine/shared/fileBounds.js';\nimport { humanName } from '@mistriwork/engine/shared/model.js';\nimport { pluralOf, recordNoun } from '@mistriwork/engine/shared/appNoun.js';\nimport type { ServedResource } from '@mistriwork/engine/shared/servedApp.js';\nimport { canInsert, openRelatedRecord } from '../insert.js';\nimport type { FormCuration } from './newRecordModel.js';\nimport { formShownFields } from '@mistriwork/engine/shared/form.js';\nimport { pinnedBy, sectionClass } from './pageModel.js';\nimport { CurrentCard } from './PageCurrent.js';\nimport { PageRenderContext, recordReadNames, spoken, usePageApi, type RecordActions, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { ListEmpty } from './ListEmpty.js';\nimport { Empty } from './Notes.js';\nimport { RecordSummaries } from './RecordSummaries.js';\nimport { canDelete } from '../delete.js';\nimport { updateAttempts } from '../updateAttempts.js';\nimport { shell } from '../shellMode.js';\nimport { recordKey as checkedKey } from '../resourceRequests.js';\nimport { countsChanged } from './navCounts.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { say } from '../copy/record/components/PageRelated.js';\nimport { served } from '../addressMount.js';\n\n/* A list of files draws as attachments, fetched the first time a page holds one. */\nconst AttachmentList = onDemand(() => import('./AttachmentList.js'), 'AttachmentList');\nconst CardsList = onDemand(() => import('./CardsList.js'), 'CardsList');\n/* A grouped list is one the page's author asked for; the rest of the record page never draws it. */\nconst GroupedBody = onDemand(() => import('./PageGroups.js'), 'GroupedBody');\nconst Gallery = onDemand(() => import('./Gallery.js'), 'Gallery');\n\n/** The App resource over this table, if there is one. */\nfunction resourceOf(table: TableMeta | undefined): ServedResource | undefined {\n if (!table) return undefined;\n const resources = (shell().app() as { resources?: Record<string, ServedResource> } | null)?.resources ?? {};\n return resources[table.id] ?? resources[table.name];\n}\n\n/** The `file` block of the App resource over this table, when its rows are files. */\nfunction fileOf(table: TableMeta | undefined): ServedResource['file'] {\n return resourceOf(table)?.file;\n}\n\n/** Rows related to the root: the real list. */\nexport function ListSection(props: SlotProps) {\n return <RelatedList {...props} />;\n}\n\n/** Its first page as the server asks it for the page's compose (shared/recordReads.ts): the names and keys a row needs added. */\nexport function listRead(section: SlotProps['section'], plan: SlotProps['plan']) {\n return listView(recordReadNames(), section, plan, section.limit ?? (section.group ? GROUP_ROWS_DEFAULT : (relatedRows() as number)));\n}\n\n/** What a list's rows are called in a sentence: the section's title, or the table's name as the reader says it. */\nexport function listThings(section: SlotProps['section']): string {\n const table = findTable(section.from ?? '') as TableMeta | undefined;\n return (\n section.title ??\n (shell().inApp()\n ? (resourceOf(table)?.noun?.many ?? pluralOf(recordNoun(undefined, table?.name ?? section.from ?? '')))\n : (table?.name ?? section.from ?? ''))\n ).toLocaleLowerCase();\n}\n\n/**\n * The doors a related list offers this reader: the Add of its own, as a list view offers New, and the record's verbs\n * that add to it (`actions`). An empty list that offers one is never taken away, so this is asked by the list when it\n * draws its head and by the page when it decides whether to leave the list out (PageEmptyRun.tsx).\n */\nexport function relatedDoor(\n section: SlotProps['section'],\n base: TableMeta,\n recordKey: Record<string, unknown>,\n context: { preview?: boolean; actions?: RecordActions },\n) {\n const table = findTable(section.from ?? '') as TableMeta | undefined;\n const app = shell().inApp();\n /* A list of files uploads where the reader may add them, whether or not it names a create: the\n file's own columns are the upload's to fill, so there is nothing for a create to say but its label. Any other\n list of the record's children offers its Add as a list view offers New — where this reader may add a row,\n through the child's own New form, bound to the record — unless it says `create: false`, or adds\n through the record's own verbs (`actions`) instead. */\n const noun = (\n app ? (resourceOf(table)?.noun?.one ?? recordNoun(undefined, table?.name ?? section.from ?? '')) : (table?.name ?? '')\n ).toLocaleLowerCase();\n const create = section.noCreate\n ? undefined\n : (section.create ??\n (app && fileOf(table)\n ? { label: say('attachFiles') }\n : app && !section.listActions && !section.similar && noun\n ? { label: say('addThing', { thing: noun }) }\n : undefined));\n /* `actions`: the record's own verbs that add to this list, in its head and not the record's (Page.tsx), each\n offered as the head would offer it — granted, and while its condition holds. */\n const placed =\n section.listActions && app && !context.preview && context.actions\n ? context.actions.list.filter((action) => section.listActions!.includes(action.id))\n : [];\n const creation =\n create && table && state.schema\n ? relatedCreatePlan(state.schema, base.id, table.id, section.path ?? '', create, {\n filter: section.filter,\n })\n : undefined;\n const defaults = creation?.bindings && Object.fromEntries(creation.bindings.map((b) => [b.column, recordKey[b.parent]]));\n /* An Add the list offers on its own stands back where the child needs another record this one cannot name (a work\n order's bike, from its mechanic's page): the author's `create` still offers it, asking for that record. */\n const offeredAlone = section.create === undefined && !(app && fileOf(table));\n const canCreate = Boolean(\n !context.preview &&\n app &&\n table &&\n !(offeredAlone && creation?.otherParents?.length) &&\n canInsert(table) &&\n defaults &&\n Object.values(defaults).every((v) => typeof v === 'string' || typeof v === 'number'),\n );\n return { noun, create, placed, creation, defaults, canCreate, door: canCreate || placed.length > 0 };\n}\n\n/** Rows related to the root, a page at a time — the real list, not a sample of one. */\nfunction RelatedList({ section, plan, base, recordKey, onEdit, collapsed }: SlotProps) {\n const api = usePageApi();\n const { preview, isCurrent, openRelated, connection, recordName, onActionDone, actions: recordActions } = useContext(PageRenderContext);\n const queries = useQueryClient();\n const [added, setAdded] = useState(false);\n const createButton = useRef<HTMLButtonElement>(null);\n const table = findTable(section.from ?? '') as TableMeta | undefined;\n const columnsOf = () =>\n Array.isArray(section.columns) && section.columns.length ? section.columns : (table?.columns ?? []).map((c) => c.name);\n /* A grouped list's `limit` is the rows to a group, and its pages are of groups (PageGroups.tsx). */\n const grouped = Boolean(section.group && plan.groups);\n const limit = section.limit ?? (grouped ? GROUP_ROWS_DEFAULT : (relatedRows() as number));\n const app = shell().inApp();\n const presentation = useMemo(() => listRead(section, plan), [plan.view, section.limit, limit, table, app]); // eslint-disable-line react-hooks/exhaustive-deps\n const { view, labelColumns, keyColumns, labelColumn } = presentation;\n /* A list of the record's own children holds the column that points back\n at it to one value, the record the page is on: like a tab's\n `status = new` in a summary (docs/design.md), it says nothing, so it is\n left out while anything else is shown. A similar list is not held. */\n const hidden = useMemo(() => {\n const back = app && !section.similar && section.path && !section.path.includes('.') ? section.path : undefined;\n const held = presentation.hidden as string[];\n const shown = columnsOf().filter((name) => !held.includes(name));\n return back && shown.includes(back) && shown.length > 1 ? [...held, back] : held;\n }, [presentation, app, section.similar, section.path, section.columns, table]); // eslint-disable-line react-hooks/exhaustive-deps\n const [offset, setOffset] = useState(0);\n const [layout, setLayout] = useState('records');\n /* A list of files waits for its drawing as it waits for its rows, in the section's own skeleton. */\n const attachmentsHere = useArrived(AttachmentList, Boolean(app && fileOf(table)));\n /* Cards and a gallery likewise: each is a part of its own, asked for beside the rows. */\n const asCards = typeof section.presentation === 'object' && section.presentation.kind === 'cards';\n const cardsHere = useArrived(CardsList, asCards);\n const galleryHere = useArrived(Gallery, section.presentation === 'gallery');\n const data = useQuery<ResourceClientReply<'/api/view/run'>>({\n queryKey: ['page-list', view, offset],\n queryFn: () => {\n if (!view) throw new Error(say('thisListHasNoView'));\n return api('/api/view/run', { view, offset });\n },\n enabled: !plan.empty && Boolean(view) && !grouped,\n staleTime: 0,\n });\n /* A grouped list asks its groups first, a page of them at a time; each group's rows follow (PageGroups.tsx). */\n const groupsAsked = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-list', 'groups', plan.groups, offset],\n queryFn: () => api('/api/breakdown', groupsBody(plan.groups!, offset)),\n enabled: !plan.empty && grouped,\n staleTime: 0,\n /* A page of groups turned keeps the one standing until the next is in, so the box holds its height. */\n placeholderData: keepPreviousData,\n });\n /* The footer's sums: one row measured over every related row, planned on\n the server beside the list, so it counts past the page on screen. */\n const sums = useQuery<ResourceClientReply<'/api/breakdown'>>({\n queryKey: ['page-list', 'totals', plan.totals],\n queryFn: () => api('/api/breakdown', { def: plan.totals! }),\n enabled: !plan.empty && Boolean(plan.totals),\n staleTime: 0,\n });\n /* A similar list is empty when the record has no value to match on — no\n body type — and reads then as one that matched nothing: it has no\n reference to be missing. */\n /* Left out, or said in one line with its neighbours, while it has no rows, is the page's to decide: it alone sees\n the lists beside this one (PageEmptyRun.tsx). The line asks this list for its Add alone, below. */\n if (collapsed && plan.empty) return null;\n /* What the rows are called in a sentence: the section's title, or the table's name as the reader says it. */\n const things = listThings(section);\n const nothingYet = things ? say('common.noYet', { things }) : say('nothingHereYet');\n if (plan.empty && section.similar) {\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={section.empty ? <ListEmpty spec={section.empty} /> : <Empty className=\"page-group-empty\" text={nothingYet} />}\n />\n );\n }\n /* The record names no parent to list through. Said as the reader would\n say it — which reference is unset, and so what cannot be shown — with no\n header row over nothing: \"This record has no account_id to list\n through\" named a column, and the empty grid under it looked broken. */\n if (plan.empty) {\n const reference = section.of\n ? app\n ? ((columnLabel(base.id, section.of) as string | null) ?? humanName(section.of)).replace(/[\\s_]+id$/i, '').toLocaleLowerCase()\n : section.of\n : 'reference';\n return (\n <SectionBox\n section={section}\n foldable={false}\n body={<Empty text={say('noIsSetSoThere', { reference, things: things || say('recordsNoun') })} />}\n />\n );\n }\n if (!view) return <SectionBox section={section} body={null} foldable={false} broken={say('thisListHasNoView')} />;\n if (\n (grouped ? groupsAsked.isPending : data.isPending) ||\n (!attachmentsHere && app && fileOf(table)) ||\n (asCards && !cardsHere) ||\n (section.presentation === 'gallery' && !galleryHere)\n )\n return <Loading section={section} />;\n const asking = grouped ? groupsAsked : data;\n if (asking.isError) return <SectionBox section={section} body={null} foldable={false} broken={(asking.error as Error).message} />;\n const groupsGot = grouped && groupsAsked.data && !('errors' in groupsAsked.data) ? groupsAsked.data : undefined;\n /* A grouped list draws its rows group by group (PageGroups.tsx): the flat read below stands as an empty page. */\n const got = grouped ? ((groupsGot ? { view: view, columns: [], rows: [] } : undefined) as typeof data.data) : data.data;\n if (!got || !('view' in got))\n return <SectionBox section={section} body={null} foldable={false} broken={got?.errors[0]?.message ?? say('thisListCouldNotBeRead')} />;\n /* Its children's names say the word that tells them apart, not the page's title again. */\n const rows = app && !section.similar ? withoutParentName(got.rows, Object.values(labelColumns), recordName) : got.rows;\n const summed = sums.data && 'rows' in sums.data ? ((sums.data.rows?.[0] ?? {}) as Record<string, unknown>) : undefined;\n const totals =\n section.totals?.length && plan.totals\n ? Object.fromEntries(section.totals.map((column, i) => [column, summed ? (summed[`total_${i}`] ?? 0) : undefined]))\n : undefined;\n const noRows = grouped ? (groupsGot?.rows.length ?? 0) === 0 : rows.length === 0;\n const authoredEmpty = offset === 0 && noRows && section.empty ? <ListEmpty spec={section.empty} /> : undefined;\n /* In an App an empty list is the empty sentence, not a header row over nothing. */\n const plainEmpty = app && offset === 0 && noRows ? <Empty text={section.title ? nothingYet : say('noRelatedRecordsYet')} /> : undefined;\n /* A footer that sums more rows than the page shows says so: \"Total\" under\n two rows that add up to less read as arithmetic gone wrong. */\n const totalsLabel =\n totals && (got.more || offset > 0 || (got.total !== undefined && got.total > rows.length))\n ? got.total === undefined\n ? say('totalAllThings', { things: things || say('recordsNoun') })\n : say('totalAllCountThings', { count: formatNumber(got.total), things: things || say('recordsNoun') })\n : undefined;\n const pinned = pinnedBy(view);\n const recordForRow = (row: Record<string, unknown>, outputs: readonly string[] = got.columns) => {\n const key = recordViewKey(keyColumns, outputs, row);\n // Inferred names live in the authored row. Explicit names must use only\n // the private projection, so a colliding output cannot impersonate them.\n const naming = table && recordLabel(table) === undefined ? row : {};\n return {\n key,\n label: table ? (rowLabel(table, { ...naming, ...pinned, ...key, ...recordViewLabel(labelColumn, outputs, row) }) as string) : '',\n };\n };\n /* The card's name as said on this page: without the page record's name\n before it, and none where it is that name — a review file named by its\n application's reference repeated the heading (\"AL-1006\" twice). The\n foot's \"View …\" still opens it. */\n const cardTitle = (label: string, page: string | undefined): string | null =>\n page?.trim() && label.trim() === page.trim() ? null : String(withoutParent(label, page));\n /* The one current row as a card, or the card saying there is none. */\n if (section.presentation === 'card' && table) {\n const noun = (app ? (resourceOf(table)?.noun?.one ?? recordNoun(undefined, table.name)) : table.name).toLocaleLowerCase();\n const shown = (got.columns ?? []).filter((name) => !(hidden as string[]).includes(name));\n const record = rows[0] ? recordForRow(rows[0]) : undefined;\n return (\n <section className={`${sectionClass(section)} page-card-section`}>\n <CurrentCard\n table={table}\n caption={section.title}\n row={rows[0]}\n columns={shown}\n show={Array.isArray(section.columns) ? section.columns : undefined}\n referenceLabels={labelColumns}\n labels={(section as { labels?: Record<string, string> }).labels}\n record={record}\n title={record && app ? cardTitle(record.label, recordName) : undefined}\n noun={noun}\n /* Said with the record's noun, never the title: a title is a heading, not a noun (\"In the shop now\" said\n \"No in the shop now right now.\"). */\n empty={authoredEmpty ?? <Empty text={say('noRightNow', { thing: noun })} />}\n />\n </section>\n );\n }\n const summaries = app && table && keyColumns.length > 0 && rows.length > 0;\n /* `rowActions`: each row's own verbs from a ⋯ at its end — the same menu a list view's row has. A verb on a\n child moves the record too (a payment voided marks the order), so the page is read again after it. */\n const offered = section.rowActions && app && !preview && table ? offeredBy(resourceOf(table)).actions : undefined;\n const rowVerbs = offered?.some((action) => action.header !== false) && mayRunAny(shell().app(), table!.id, offered) ? offered : undefined;\n /* The list reads its key under its own output names (recordViewKey); a row's menu, like a list view's, names\n its record by the table's own columns, so they ride on each row, kept out of sight. */\n const keyNames = rowVerbs ? keyColumns.map(({ column }) => column).filter((column) => !(got.columns ?? []).includes(column)) : [];\n const gridRows = rowVerbs ? rows.map((row) => ({ ...row, ...(recordViewKey(keyColumns, got.columns, row) ?? {}) })) : rows;\n const hiddenColumns = new Set<string>(hidden);\n /* Related rows as cards: each row carries its key under its own column\n names, which is what a card opens its record with. */\n const drawn = typeof section.presentation === 'object' ? section.presentation : undefined;\n const cards = drawn?.kind === 'cards' ? drawn : undefined;\n /* An embedded custom list: its component draws the rows, each with its key under its own column names. */\n const custom = drawn?.kind === 'custom' ? drawn : undefined;\n const cardRows = drawn ? rows.map((row) => ({ ...row, ...(recordViewKey(keyColumns, got.columns, row) ?? {}) })) : [];\n /* An embedded board or calendar is drawn by the App's own component, as the view draws it, held to this record: a\n board reads each lane by its own query, so the record's condition is said in the query language. A list reached\n through `of` names its rows by another record's key, so it keeps the rows read here. */\n const lanes = section.lanes;\n const heldKey = Object.values(recordKey);\n const presented =\n lanes && table && app && shell().present && keyColumns.length\n ? shell().present!({\n presentation: lanes,\n table,\n data: { ...got, rows, table: table.id, ms: 0 } as never,\n entry: {\n kind: 'table',\n table: table.id,\n query:\n section.of || section.similar || heldKey.length !== 1\n ? ''\n : andQuery(section.filter, `${section.path} = ${quoteValue(heldKey[0])}`),\n },\n actions: undefined,\n listLabel: section.title ?? spoken(table.name),\n referenceLabels: labelColumns,\n interactive: !preview,\n recordNavigation: true,\n list: undefined,\n current: undefined,\n order: undefined,\n at: { page: 0, size: limit },\n })\n : null;\n const paged = !grouped && !presented && (got.more || offset > 0);\n const { create, placed, creation, defaults, canCreate } = relatedDoor(section, base, recordKey, { preview, actions: recordActions });\n /* The New form a row of this list is added through: the child resource's own\n (its captions, help, groups and narrowed pickers), asking what the create\n shows, starting from the create's defaults, the list's equalities and the\n record's own values it fills — and bound to the record, which it never asks. */\n const createForm = async (): Promise<FormCuration> => {\n const own = resourceOf(table)?.form as FormCuration | undefined;\n const bound = new Set(creation!.bindings!.map((b) => b.column));\n const shown = [...(create!.show ?? formShownFields(own) ?? creation!.show!)].filter((name) => !bound.has(name));\n const fill = Object.entries(creation!.fill ?? {});\n let filled: Record<string, unknown> = {};\n if (fill.length) {\n /* The record's values, read as this reader reads them: a column they cannot read fills nothing. */\n try {\n const data = await coreApi('/api/query', {\n ...ownedBy(connection ?? state.activeConnection),\n table: base.id,\n columns: [...new Set(fill.map(([, parent]) => parent))],\n filter: {\n groups: [Object.entries(recordKey).map(([column, value]) => ({ column, op: '=' as const, value: value as string | number }))],\n },\n limit: 1,\n offset: 0,\n });\n const row = (data.rows as Array<Record<string, unknown>> | undefined)?.[0] ?? {};\n filled = Object.fromEntries(\n fill.flatMap(([child, parent]) => (row[parent] === null || row[parent] === undefined ? [] : [[child, row[parent]]])),\n );\n } catch {\n filled = {};\n }\n }\n return {\n // A row added beside its record stays beside it: the drawer, whatever the resource's own New form opens as.\n ...(own ?? {}),\n show: shown,\n open: 'drawer',\n // Steps carve the resource's own form; a create asks its own fields, on one page.\n steps: create!.show\n ? undefined\n : own?.steps\n ?.map((step) => ({ ...step, fields: step.fields.filter((name) => shown.includes(name)) }))\n .filter((step) => step.fields.length),\n defaults: { ...(creation!.defaults ?? {}), ...filled, ...defaults },\n };\n };\n const refreshLists = () =>\n void queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n /* A resource whose rows are files draws as attachments: each a download,\n and, where the list may add, an upload bound to this record the way a\n related New form is. The file's own columns are the upload's to fill. */\n const file = app ? fileOf(table) : undefined;\n const owner = connection ?? state.activeConnection;\n /* Rename and Remove are offered where the server would accept them — the\n catalog's own answer for this reader, as the record's Delete asks it —\n and never in a preview, which writes nothing. */\n const nameColumn = file && table ? table.columns.find((column) => column.name === file.name) : undefined;\n const connectionWritable = Boolean(state.connections?.some((c: { id: string; writable?: boolean }) => c.id === owner && c.writable));\n const renamable = Boolean(\n !preview &&\n file &&\n table &&\n nameColumn &&\n !nameColumn.primaryKey &&\n nameColumn.writable !== false &&\n !table.isView &&\n writeAllowed(table.id) &&\n connectionWritable,\n );\n /* A grouped list's rows move between groups, and to their place in a ranked one (groupMoves.tsx), on the board's\n two paths: an ordinary update of the grouped column where this reader may write it, else the one command of the\n row's own that takes the group (`moveToSprint` with `{ sprint }`), asked nothing more. A ranked list is one read\n in a single number column, ascending, that the reader may write, as a list view's hand order is. */\n const groupMoves = ((): GroupMoves | undefined => {\n const by = section.group?.by;\n if (!grouped || !app || preview || !table || !by || by.includes('.') || !keyColumns.length || table.isView) return undefined;\n const may = (name: string) => {\n const column = table.columns.find((c) => c.name === name);\n return Boolean(\n column &&\n !column.primaryKey &&\n column.writable !== false &&\n column.changesBy !== 'actions' &&\n writeAllowed(table.id) &&\n connectionWritable,\n );\n };\n const parent = state.schema\n ? (groupTable(state.schema as DatabaseSchema, { from: table.id, group: section.group }) as TableMeta | undefined)\n : undefined;\n type Said = Record<string, string | number | boolean | null>;\n const write = async (key: Record<string, unknown>, values: Said, expected: Said) => {\n if (isCurrent && !isCurrent()) return { message: say('thisPageHasMoved'), refused: false };\n const outcome = await updateAttempts.run({ connection: owner ?? null, table: table.id, key }, values, () =>\n coreApi('/api/update', { ...ownedBy(owner), table: table.id, key: checkedKey(key), values, expected }),\n );\n return outcome.kind === 'applied'\n ? null\n : { message: outcome.message ?? '', refused: outcome.kind === 'rejected' || outcome.kind === 'blocked' };\n };\n const verb = may(by)\n ? undefined\n : (offeredBy(resourceOf(table))?.actions ?? [])\n .flatMap((action) => {\n if (action.command === undefined) return [];\n const takes = action.command.input.filter(\n (field) => field.name === by || (field.type === 'reference' && parent !== undefined && field.from === parent.id),\n );\n const rest = action.command.input.filter((field) => !takes.includes(field) && 'required' in field && field.required);\n const run =\n takes.length === 1 && !rest.length ? shell().slots.recordCommand?.(action.command, String(action.label)) : undefined;\n return run ? [{ run, input: takes[0].name, required: Boolean((takes[0] as { required?: boolean }).required) }] : [];\n })\n .at(0);\n if (!may(by) && !verb) return undefined;\n const order = (view?.orderBy ?? []) as Array<{ path: string; direction?: string }>;\n const sort = order.length === 1 ? order[0] : undefined;\n const rankColumn = sort && sort.direction !== 'desc' ? table.columns.find((c) => c.name === sort.path) : undefined;\n const ranked =\n rankColumn && may(rankColumn.name) && /int|real|num|dec|double|float|serial/i.test(rankColumn.type ?? '') ? rankColumn : undefined;\n return {\n keyOf: (row, columns) => {\n const key = recordViewKey(keyColumns, columns, row);\n const id = key ? rowKeyString(table, key) : null;\n return key && id ? { key, id } : null;\n },\n labelOf: (row, columns) => recordForRow(row, [...columns]).label,\n enters: (key) => (key === null || key === undefined ? may(by) || (verb !== undefined && !verb.required) : true),\n regroup: async (key, _label, from, to) => {\n if (verb) {\n const outcome = await verb.run(key as Record<string, string | number>, { [verb.input]: to ?? null });\n // A refusal is said where it was refused (the command's own pipeline).\n return outcome.status === 'applied' || outcome.status === 'done' ? null : '';\n }\n const failed = await write(key, { [by]: (to ?? null) as Said[string] }, { [by]: (from ?? null) as Said[string] });\n return failed ? failed.message : null;\n },\n ...(ranked\n ? {\n rank: {\n column: ranked.name,\n whole: wholeColumn(ranked.type),\n write: (key: Record<string, unknown>, _label: string, value: number, expected: unknown) =>\n write(key, { [ranked.name]: value }, { [ranked.name]: (expected ?? null) as Said[string] }),\n },\n }\n : {}),\n done: async () => {\n await queries.invalidateQueries({\n predicate: (query) => ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n void shell().undo.refresh();\n countsChanged();\n },\n };\n })();\n const removable = Boolean(!preview && file && table && canDelete(table));\n const renameFile = async (rowKey: Record<string, unknown>, next: string, original: string | null): Promise<string | null> => {\n if (!table || !file || (isCurrent && !isCurrent())) return say('thisPageHasMoved');\n const values = { [file.name]: next };\n const outcome = await updateAttempts.run({ connection: owner ?? null, table: table.id, key: rowKey }, values, () =>\n coreApi('/api/update', { ...ownedBy(owner), table: table.id, key: checkedKey(rowKey), values, expected: { [file.name]: original } }),\n );\n if (outcome.kind !== 'applied') return outcome.message;\n void shell().undo.refresh();\n refreshLists();\n return null;\n };\n const removeFile = async (rowKey: Record<string, unknown>): Promise<string | null> => {\n if (!table || (isCurrent && !isCurrent())) return say('thisPageHasMovedOn');\n try {\n const result = (await coreApi('/api/delete', { ...ownedBy(owner), table: table.id, key: checkedKey(rowKey), confirm: true })) as {\n deleted?: boolean | null;\n errors?: Array<{ message: string }>;\n };\n if (result?.deleted !== true || result.errors?.length) return result?.errors?.[0]?.message ?? say('theFileWasNotRemoved');\n refreshLists();\n countsChanged();\n return null;\n } catch (error) {\n return (error as Error).message;\n }\n };\n const lease = filesOnLease();\n const attachments =\n file && table\n ? rows.flatMap((row) => {\n const rowKey = recordViewKey(keyColumns, got.columns, row);\n if (!rowKey) return [];\n const name =\n String(row[file.name] ?? '') || rowLabel(table, { ...pinned, ...rowKey, ...recordViewLabel(labelColumn, got.columns, row) });\n const meta = (got.columns ?? [])\n .filter(\n (column) =>\n ![file.name, file.content, file.type, file.thumbnail].includes(column) &&\n !(keyColumns as ReadonlyArray<{ column: string }>).some((key) => key.column === column) &&\n !(hidden as string[]).includes(column) &&\n row[column] != null &&\n row[column] !== '',\n )\n .map((column) =>\n column === file.size ? formatBytes(Number(row[column])) : (formatRelativeDay(String(row[column])) ?? String(row[column])),\n );\n const href = served(`/api/file?${new URLSearchParams({ ...ownedBy(owner), table: table.id, key: JSON.stringify(rowKey) })}`);\n const type = file.type && typeof row[file.type] === 'string' ? (row[file.type] as string) : undefined;\n return [\n {\n id: JSON.stringify(rowKey),\n name,\n href,\n meta,\n ...(type ? { type } : {}),\n inline: inlineFileAddress(table.id, rowKey, owner),\n ...(lease ? { save: () => saveFileOnLease(table.id, rowKey) } : {}),\n onOpen: () => void openRecord(table.id, rowKey, name),\n ...(renamable\n ? { rename: (next: string) => renameFile(rowKey, next, row[file.name] == null ? null : String(row[file.name])) }\n : {}),\n ...(removable ? { remove: () => removeFile(rowKey) } : {}),\n },\n ];\n })\n : [];\n /* A caption is words: a reference (the building the photo hangs from) or a number (its place in the order) says\n nothing under a picture, and read as \"· 1 · 1\". */\n const captions = (column: string) => {\n const meta = table?.columns.find((candidate) => candidate.name === column);\n return Boolean(meta && !meta.references && columnKind(meta.type) === 'text');\n };\n /* A gallery is the same rows as photos, drawn in place through the file\n route's inline mode; the shown columns that are not the file's own are\n each photo's caption. A resource whose rows are not files keeps its grid. */\n const gallery =\n /* On a tenant lease a photo has no address to draw in place (fileSource.ts): the files are listed instead. */\n section.presentation === 'gallery' && file && table && !lease\n ? rows.flatMap((row) => {\n const rowKey = recordViewKey(keyColumns, got.columns, row);\n if (!rowKey) return [];\n const words = (got.columns ?? [])\n .filter(\n (column) =>\n ![file.name, file.content, file.type, file.size, file.thumbnail].includes(column) &&\n !(keyColumns as ReadonlyArray<{ column: string }>).some((key) => key.column === column) &&\n !(hidden as string[]).includes(column) &&\n row[column] != null &&\n row[column] !== '' &&\n captions(column),\n )\n .map((column) => String(row[column]));\n const alt = words[0] ?? String(row[file.name] ?? '');\n return [\n {\n id: JSON.stringify(rowKey),\n src: inlineFileAddress(table.id, rowKey, owner),\n ...(file.thumbnail ? { thumb: inlineFileAddress(table.id, rowKey, owner, 'thumb') } : {}),\n alt,\n ...(words.length ? { caption: words.join(' · ') } : {}),\n },\n ];\n })\n : undefined;\n const send = async (picked: File): Promise<string | null> => {\n if (!table || (isCurrent && !isCurrent())) return say('thisPageHasMovedOnNothing');\n try {\n /* The encoder is the attachment list's, here since its Attach button was. */\n const { fileToBase64 } = await import('./AttachmentList.js');\n /* The file's row starts as a New from this list would: the create's\n defaults and the list's equalities, then the binding to this record. */\n const data = (await coreApi('/api/file/upload', {\n table: table.id,\n values: { ...creation!.defaults, ...defaults },\n ...ownedBy(connection),\n file: { name: picked.name, type: picked.type, data: await fileToBase64(picked) },\n })) as { errors?: Array<{ message: string }> };\n if (data?.errors?.length) return data.errors[0].message;\n setOffset(0);\n refreshLists();\n return null;\n } catch (error) {\n return (error as Error).message;\n }\n };\n /* The list's verbs stand in its heading's row, after the heading, and go under it where the column is narrow,\n from the same edge: an aside's related list kept them on a row of their own, pushed to the far side. */\n /* A placed verb is the App's (Actions.tsx), and an embedded list's own component with the page's side of\n @mistriwork/mistri/ui (sdk/CustomList.tsx): each drawn through the shell's slot. */\n const { ActionBar, CustomList } = shell().slots;\n const tools =\n (canCreate && !file) || placed.length > 0 ? (\n <div className=\"page-related-create\">\n {added && <span role=\"status\">{say('recordAdded')}</span>}\n {placed.length > 0 && ActionBar && (\n <ActionBar\n tableId={base.id}\n actions={placed}\n recordKey={recordKey}\n label={recordName ?? ''}\n matches={recordActions!.matches}\n queryScope={recordActions!.queryScope}\n isCurrent={isCurrent}\n only={section.listActions}\n quiet\n canUpdate={recordActions!.canUpdate}\n grantedCommands={recordActions!.grantedCommands}\n grantedActions={recordActions!.grantedActions}\n onDone={() => {\n refreshLists();\n /* The record moved too (its counts, its stage): read again as the head's own verbs read it. */\n if (onActionDone) onActionDone();\n else onEdit({ inPlace: false });\n }}\n />\n )}\n {canCreate && !file && (\n <button\n type=\"button\"\n className=\"ghost\"\n ref={createButton}\n onClick={() => {\n if (isCurrent && !isCurrent()) return;\n setAdded(false);\n void createForm().then((form) =>\n isCurrent && !isCurrent()\n ? undefined\n : (openRelated ?? openRelatedRecord)(table!, form, () => {\n if (isCurrent && !isCurrent()) return;\n setAdded(true);\n setOffset(0);\n void queries.invalidateQueries({\n predicate: (query) =>\n ['page-list', 'page-timeline', 'page-metric', 'page-breakdown'].includes(String(query.queryKey[0])),\n });\n createButton.current?.focus();\n }),\n );\n }}\n >\n + {create!.label}\n </button>\n )}\n </div>\n ) : undefined;\n /* An empty list said in one line: only its Add stands there, an upload for a list of files. */\n if (collapsed)\n return file && canCreate ? (\n <AttachmentList\n items={[]}\n empty={false}\n emptyText=\"\"\n upload={{ label: create!.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send }}\n />\n ) : (\n (tools ?? null)\n );\n return (\n <SectionBox\n section={section}\n foldable={false}\n tools={tools}\n body={\n <div className=\"page-list-body\">\n {(file ? undefined : authoredEmpty) ??\n (grouped && groupsGot && view ? (\n <GroupedBody\n section={section}\n groups={groupsGot}\n offset={offset}\n perPage={section.group?.limit ?? GROUPS_DEFAULT}\n onOffset={setOffset}\n view={view}\n labelColumns={labelColumns}\n rowsPerGroup={limit}\n {...(groupMoves ? { moves: groupMoves } : {})}\n overall={\n summed && totals\n ? { label: say('totalAllThings', { things: things || say('recordsNoun') }), sums: totals as Record<string, unknown> }\n : undefined\n }\n grid={(data, subtotals, subtotalsLabel) => {\n /* Each group's table draws the same ⋯ an ungrouped list does: its own rows carry their keys, and\n the host/menu pair belongs to this table alone, so one group's menu never reaches another's. */\n const keyed = rowVerbs || groupMoves;\n const groupKeys = keyed\n ? keyColumns.map(({ column }) => column).filter((column) => !(data.columns ?? []).includes(column))\n : [];\n const groupRows = keyed\n ? ((data.rows ?? []) as Array<Record<string, unknown>>).map((row) => ({\n ...row,\n ...(recordViewKey(keyColumns, data.columns ?? [], row) ?? {}),\n }))\n : data.rows;\n const table_ = (\n <Grid\n table={table}\n sizing={section.sizing}\n data={keyed ? { ...data, rows: groupRows, columns: [...(data.columns ?? []), ...groupKeys] } : data}\n hide={[...hidden, ...groupFactPaths(section), ...groupKeys, '__rank']}\n referenceLabels={labelColumns}\n totals={subtotals}\n totalsLabel={subtotalsLabel}\n interactive={false}\n virtual={false}\n dropColumns\n emptyText={say('noRelatedRecordsYet')}\n onRowClick={\n table && keyColumns.length\n ? (row) => {\n const record = recordForRow(row, data.columns ?? []);\n if (record.key) void openRecord(table.id, record.key, record.label);\n }\n : undefined\n }\n />\n );\n return rowVerbs ? (\n <RowTrailHosts>\n <RowActions\n table={table!}\n rows={groupRows as Array<Record<string, unknown>>}\n actions={rowVerbs}\n onDone={() => {\n refreshLists();\n onActionDone?.();\n }}\n />\n {table_}\n </RowTrailHosts>\n ) : (\n table_\n );\n }}\n />\n ) : presented ? (\n presented.element\n ) : custom && table && CustomList ? (\n cardRows.length ? (\n <CustomList\n table={table}\n rows={cardRows}\n spec={custom}\n interactive={!preview}\n label={section.title ?? spoken(table.name)}\n page={{ index: Math.floor(offset / Math.max(1, limit)), size: limit }}\n />\n ) : (\n <Empty className=\"page-group-empty\" text={nothingYet} />\n )\n ) : cards && table ? (\n cardRows.length ? (\n <CardsList table={table} rows={cardRows} spec={cards} label={section.title ?? spoken(table.name)} />\n ) : (\n <Empty className=\"page-group-empty\" text={nothingYet} />\n )\n ) : gallery ? (\n <>\n {/* A gallery's New is an upload, for a reader who may add the files; everyone else sees the photos. */}\n {canCreate && (\n <AttachmentList\n items={[]}\n empty={false}\n emptyText=\"\"\n upload={{ label: create!.label, maxBytes: file!.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send }}\n />\n )}\n <Gallery\n items={gallery}\n label={section.title ?? say('photos')}\n emptyText={section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noPhotosYet')}\n />\n </>\n ) : file ? (\n <AttachmentList\n items={attachments}\n empty={authoredEmpty}\n emptyText={section.title ? say('common.noYet', { things: section.title.toLocaleLowerCase() }) : say('noFilesYet')}\n upload={canCreate ? { label: create!.label, maxBytes: file.maxBytes ?? FILE_MAX_BYTES_DEFAULT, send } : undefined}\n />\n ) : (\n (plainEmpty ?? (\n <div className={summaries ? `responsive-results page-related-results show-${layout}` : undefined}>\n {summaries && (\n <>\n <PresentationSwitch\n layout={layout}\n onChange={setLayout}\n label={say('common.listPresentation')}\n records={say('common.records')}\n table={say('common.table')}\n />\n {/* A summary's title is the row's name, which on its parent's page says the word alone too. */}\n <RecordSummaries\n table={table}\n data={{ ...got, rows }}\n columns={got.columns.filter((name) => !hiddenColumns.has(name))}\n referenceLabels={labelColumns}\n parent={!section.similar && section.path && !section.path.includes('.') ? section.path : undefined}\n recordForRow={\n section.similar\n ? recordForRow\n : (row) => {\n const record = recordForRow(row);\n return { ...record, label: withoutParent(record.label, recordName) };\n }\n }\n />\n </>\n )}\n <div className=\"result-table\">\n {((grid) =>\n rowVerbs ? (\n <RowTrailHosts>\n <RowActions\n table={table!}\n rows={gridRows}\n actions={rowVerbs}\n onDone={() => {\n refreshLists();\n onActionDone?.();\n }}\n />\n {grid}\n </RowTrailHosts>\n ) : (\n grid\n ))(\n <Grid\n table={table}\n sizing={section.sizing}\n data={{ ...got, rows: gridRows, columns: [...(got.columns ?? columnsOf()), ...keyNames] }}\n hide={keyNames.length ? [...hidden, ...keyNames] : hidden}\n referenceLabels={labelColumns}\n totals={totals}\n totalsLabel={totalsLabel}\n interactive={false}\n virtual={false}\n /* Beside an aside the main column is narrow: columns past the room are left out, the name and status kept, rather than cut at the edge. */\n dropColumns\n emptyText={\n app\n ? section.title\n ? say('common.noYet', { things: section.title.toLocaleLowerCase() })\n : say('noRelatedRecordsYet')\n : say('noForThisRecord', { name: table?.name ?? section.from ?? '' })\n }\n onRowClick={\n table && keyColumns.length\n ? (row) => {\n const record = recordForRow(row);\n if (record.key) void openRecord(table.id, record.key, record.label);\n }\n : undefined\n }\n />,\n )}\n </div>\n </div>\n ))\n ))}\n {paged && (\n <div className=\"page-pager\">\n <span className=\"step-control\">\n <button\n type=\"button\"\n className=\"step-button\"\n aria-label={say('previousRows')}\n disabled={offset === 0}\n onClick={() => setOffset(Math.max(0, offset - limit))}\n >\n <Icon name=\"caret-left\" size={16} />\n </button>\n <span className=\"page-range step-position\">\n {`${formatNumber(offset + 1)}–${formatNumber(offset + rows.length)}${got.total === undefined ? '' : say('common.ofTotal', { total: formatNumber(got.total) })}`}\n </span>\n <button\n type=\"button\"\n className=\"step-button\"\n aria-label={say('moreRows')}\n disabled={!got.more}\n onClick={() => setOffset(offset + limit)}\n >\n <Icon name=\"caret-right\" size={16} />\n </button>\n </span>\n </div>\n )}\n </div>\n }\n />\n );\n}\n","/** What PageEmptyRun 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 noThingsYet: 'No {things} yet',\n});\n","/**\n * Related lists that may be left out while they have no rows (`empty: 'hide' | 'collapse'`, or the page's), decided\n * where a run of them stands, because only the page sees the lists beside each one. Each list is asked the question\n * it asks itself (the same query, so the answer is shared), and then:\n *\n * - a list with rows is drawn as ever;\n * - an empty one that hides is left out, unless the reader may add to it: a door is never taken away, so it collapses;\n * - empty ones that collapse, side by side, are one quiet line where the first stood — \"No charges, payments or notes\n * yet\" — each with its Add, instead of one \"No … yet\" sentence under each of several headings;\n * - a tab keeps at least one list: where a tab holds nothing but lists and they are all empty, they are said in a\n * line rather than leaving the tab blank.\n *\n * Inside a `listTabs` strip an empty list is neither hidden nor collapsed: its tab shows it (PageSections.tsx).\n */\nimport { shellRoot } from '../shellHost.js';\nimport { useContext, type ReactNode } from 'react';\nimport { useQueries } from '@tanstack/react-query';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport type { PageSection, SectionPlan } from './pageModel.js';\nimport { rootMatches } from './pageModel.js';\nimport { PageRenderContext, usePageApi } from './pageContext.js';\nimport { listRead, listThings, relatedDoor } from './PageRelated.js';\nimport { groupsBody } from '@mistriwork/engine/shared/recordReads.js';\nimport { Empty } from './Notes.js';\nimport { say } from '../copy/record/components/PageEmptyRun.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\n\ninterface RunItem {\n section: PageSection;\n index: number;\n}\n\n/** What a list is, for deciding: waiting to know, with rows (or broken, which it says itself), or empty. */\ntype Standing = 'wait' | 'rows' | 'empty' | 'gone';\n\n/** The names said as a sentence's list: \"charges, payments or notes\". */\nfunction said(names: string[]): string {\n try {\n return new Intl.ListFormat(shellRoot().lang || undefined, { type: 'disjunction', style: 'long' }).format(names);\n } catch {\n return names.join(', ');\n }\n}\n\nexport function EmptyRun({\n items,\n plans,\n base,\n recordKey,\n draw,\n rescue,\n}: {\n items: RunItem[];\n plans: SectionPlan[];\n base: TableMeta;\n recordKey: Record<string, unknown>;\n /** One list as the page draws it; `collapsed` draws only its Add. */\n draw: (item: RunItem, collapsed?: boolean) => ReactNode;\n /** The run is all a tab holds: it never leaves the tab with nothing. */\n rescue: boolean;\n}) {\n useMessageLanguage();\n const api = usePageApi();\n const context = useContext(PageRenderContext);\n const planOf = (item: RunItem): SectionPlan => plans.find((p) => p.index === item.index) ?? { index: item.index };\n const reads = items.map((item) => listRead(item.section, planOf(item)).view);\n const asked = useQueries({\n queries: items.map((item, i) => {\n const plan = planOf(item);\n const view = reads[i];\n /* A grouped list is empty when it has no groups: it asks the groups it asks itself (PageRelated.tsx). */\n if (item.section.group && plan.groups) {\n const groups = plan.groups;\n return {\n queryKey: ['page-list', 'groups', groups, 0],\n queryFn: () => api('/api/breakdown', groupsBody(groups, 0)),\n enabled: !plan.empty && !plan.error,\n staleTime: 0,\n };\n }\n return {\n queryKey: ['page-list', view, 0],\n queryFn: () => api('/api/view/run', { view: view!, offset: 0 }),\n enabled: !plan.empty && !plan.error && Boolean(view),\n staleTime: 0,\n };\n }),\n });\n const gates = useQueries({\n queries: items.map((item) => ({\n queryKey: ['when', base.id, recordKey, item.section.when ?? `none-${item.index}`],\n queryFn: () => rootMatches(base, recordKey, item.section.when!, context.connection),\n enabled: Boolean(item.section.when),\n staleTime: 0,\n })),\n });\n const standing = (i: number): Standing => {\n const { section } = items[i];\n const plan = planOf(items[i]);\n if (section.when && gates[i].data !== true) return gates[i].isPending ? 'wait' : 'gone';\n if (plan.error) return 'rows';\n if (plan.empty) return 'empty';\n const grouped = Boolean(section.group && plan.groups);\n if (!reads[i] && !grouped) return 'rows';\n const got = asked[i].data;\n if (asked[i].isPending) return 'wait';\n if (grouped) return got && !('errors' in got) && got.rows.length === 0 ? 'empty' : 'rows';\n return got && 'view' in got && got.rows.length === 0 ? 'empty' : 'rows';\n };\n const states = items.map((_, i) => standing(i));\n /* Nothing here is drawn as a list: the run is all that stands in its tab, so it may not vanish. */\n const nothingElse = rescue && states.every((state) => state === 'empty' || state === 'gone') && states.includes('empty');\n const door = (item: RunItem) => relatedDoor(item.section, base, recordKey, { preview: context.preview, actions: context.actions }).door;\n\n const laid: ReactNode[] = [];\n let line: RunItem[] = [];\n const flush = () => {\n if (!line.length) return;\n const group = line;\n line = [];\n const adds = group.map((item) => draw(item, true));\n laid.push(\n <Empty\n key={`empty-${group[0].index}`}\n className=\"page-empty-run\"\n text={say('noThingsYet', { things: said(group.map((item) => listThings(item.section))) })}\n action={adds.some(Boolean) ? <>{adds}</> : undefined}\n />,\n );\n };\n items.forEach((item, i) => {\n const state = states[i];\n if (state === 'gone') return;\n if (state !== 'empty') {\n flush();\n laid.push(draw(item));\n return;\n }\n if (item.section.emptyMode === 'collapse' || nothingElse || door(item)) line.push(item);\n });\n flush();\n return <>{laid}</>;\n}\n","/**\n * How a page's sections are laid out: which are shown in which region, and\n * how neighbors group — a run of metrics is one strip, a run of lists is a\n * tab strip whose tabs are fetched when opened, and sections named into tabs (`tab`) are one strip of\n * panels standing where the first of them stands. Each section is a Slot:\n * gated by its `when`, then handed to the module that draws its kind.\n */\nimport { tabMatches } from '@mistriwork/engine/shared/addressParams.js';\nimport { shell } from '../shellMode.js';\nimport { useContext, useEffect, useId, useRef, useState, type ReactNode } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { findTable } from '../core.js';\nimport type { TableMeta } from '@mistriwork/engine/shared/schema.js';\nimport { rootMatches, sectionClass, type PageDef, type PageEntry, type PageSection, type SectionPlan } from './pageModel.js';\nimport { PageRenderContext, inAppPage, spoken, usePageApi, type SlotProps } from './pageContext.js';\nimport { Loading, SectionBox } from './PageSectionBox.js';\nimport { FieldsSection } from './PageFields.js';\nimport { BreakdownSection, ChartSection, MetricSection } from './PageMetrics.js';\nimport { DashboardNote } from './DashboardNote.js';\nimport { TimelineSection } from './PageTimeline.js';\nimport type { HistoryApi } from './PageHistory.js';\nimport type { FlowsApi } from './PageFlows.js';\nimport { ListSection } from './PageRelated.js';\nimport { EmptyRun } from './PageEmptyRun.js';\nimport { useMessageLanguage } from './useMessageLanguage.js';\nimport { useTabFold } from './useTabFold.js';\nimport { DropItem, DropMenu } from '@mistriwork/ui/DropMenu.js';\nimport { message } from '../messages.js';\nimport { ErrorBoundary } from './ErrorBoundary.js';\nimport { onDemand, useArrived } from './onDemand.js';\nimport { assertNever } from '@mistriwork/engine/shared/model.js';\nimport { appTargetFields } from '@mistriwork/engine/shared/appLinks.js';\nimport { readPageFields } from './pageFieldsRead.js';\nimport { pathEqualityFilter } from '../resourceRequests.js';\nimport { resourceOf } from './appRooms.js';\n\n/* A record's history, fetched the first time a page holds one. */\nconst RecordHistory = onDemand(() => import('./PageHistory.js'), 'RecordHistory');\n/* A record's flow runs, fetched the first time a page holds one. */\nconst RecordFlows = onDemand(() => import('./PageFlows.js'), 'RecordFlows');\n/* A flow's steps drawn, fetched the first time a page holds one: no first page carries it. */\nconst FlowDiagram = onDemand(() => import('./PageFlowDiagram.js'), 'FlowDiagram');\n\n/* The page's request and its section chrome, handed to the custom section: an author's component, and the page's\n side of @mistriwork/mistri/ui with it (sdk/CustomSection.tsx), drawn through the shell's slot. */\nfunction CustomSlot(props: SlotProps) {\n const pageApi = usePageApi();\n const { preview } = useContext(PageRenderContext);\n const { CustomSection } = shell().slots;\n return CustomSection ? <CustomSection {...props} frame={{ pageApi, preview, Loading, SectionBox }} /> : null;\n}\n\n/** One section: gated by its `when`, loading until its data is here, broken in place if it cannot run. */\nfunction Slot(props: SlotProps) {\n const { connection } = useContext(PageRenderContext);\n const { section, base, recordKey: key, plan } = props;\n const gate = useQuery({\n queryKey: ['when', base.id, key, section.when],\n queryFn: () => rootMatches(base, key, section.when!, connection),\n enabled: Boolean(section.when),\n staleTime: 0,\n });\n if (section.when && gate.data !== true) return null;\n if (plan.error && section.kind !== 'fields') return <SectionBox section={section} body={null} foldable={false} broken={plan.error} />;\n switch (section.kind) {\n case 'fields':\n return <FieldsSection {...props} />;\n case 'metric':\n return <MetricSection {...props} />;\n case 'breakdown':\n return <BreakdownSection {...props} />;\n case 'chart':\n return <ChartSection {...props} />;\n case 'note':\n return <NoteSection {...props} />;\n case 'timeline':\n return <TimelineSection {...props} />;\n case 'history':\n return <HistorySlot {...props} />;\n case 'flows':\n return <FlowsSlot {...props} />;\n case 'diagram':\n return <DiagramSlot {...props} />;\n case 'custom':\n return <CustomSlot {...props} />;\n case 'list':\n return <ListSection {...props} />;\n default:\n return assertNever(section.kind);\n }\n}\n\n/* The history section is handed the page's reads and frame, so it need not\n import them (PageHistory.tsx says why). */\nfunction HistorySlot({ section, base, recordKey }: SlotProps) {\n const api = usePageApi() as unknown as HistoryApi;\n const { preview } = useContext(PageRenderContext);\n /* Until its module is here the section waits as its first read does, in its own skeleton. */\n const here = useArrived(RecordHistory);\n /* A record's history is the operator's, and its route is behind sign-in:\n asked for a public visitor, its 401 drew the sign-in screen over a page\n the visitor may read. The storefront leaves it out (docs/design.md). */\n if (shell().publicVisitor() && !preview) return null;\n if (!here) return <Loading section={section} />;\n return (\n <RecordHistory\n section={section}\n base={base}\n recordKey={recordKey}\n api={api}\n preview={preview}\n loading={<Loading section={section} />}\n frame={(body, broken) => <SectionBox section={section} body={body} foldable={false} broken={broken} />}\n />\n );\n}\n\n/* The flows section is handed the page's reads and frame as the history's is. Its route is the operator's too,\n behind sign-in, so a public visitor's page leaves it out. */\nfunction FlowsSlot({ section, base, recordKey }: SlotProps) {\n const api = usePageApi() as unknown as FlowsApi;\n const { preview } = useContext(PageRenderContext);\n const here = useArrived(RecordFlows);\n if (shell().publicVisitor() && !preview) return null;\n if (!here) return <Loading section={section} />;\n return (\n <RecordFlows\n base={base}\n recordKey={recordKey}\n api={api}\n preview={preview}\n loading={<Loading section={section} />}\n frame={(body, broken) => <SectionBox section={section} body={body} foldable={false} broken={broken} />}\n />\n );\n}\n\n/* A flow's diagram reads its steps as the reader's rows, through the page's own reads, and is framed as the flows\n are. The steps table is the one the App's flows binding names for this page's table (shared/app.ts), as this\n reader's catalog has it: a reader who cannot read the steps is shown none. On a record's page it draws the\n record's run, whose route is the operator's, behind sign-in, so a public visitor's page leaves it out. */\nfunction DiagramSlot({ section, base, recordKey }: SlotProps) {\n const api = usePageApi() as unknown as FlowsApi;\n const { preview } = useContext(PageRenderContext);\n const here = useArrived(FlowDiagram);\n const diagram = resourceOf(shell().app(), base.id)?.flowDiagram;\n if (diagram?.run && shell().publicVisitor() && !preview) return null;\n if (!here) return <Loading section={section} />;\n return (\n <FlowDiagram\n base={base}\n recordKey={recordKey}\n diagram={diagram}\n steps={diagram ? findTable(diagram.steps) : undefined}\n api={api}\n preview={preview}\n loading={<Loading section={section} />}\n frame={(body, broken) => <SectionBox section={section} body={body} foldable={false} broken={broken} />}\n />\n );\n}\n\nconst noTargetLinks = () => null;\n\n/* Bound navigation reads only its explicit, schema-visible source fields, through the page's ordinary reader. */\nfunction NoteSection({ section, page, base, recordKey }: SlotProps) {\n useMessageLanguage();\n const api = usePageApi();\n const { connection, preview, isCurrent } = useContext(PageRenderContext);\n /* The suite's links are the App framework's (shellMode.ts `useTargetLinks`): none where the shell has none, and nothing read for them. */\n const scope = (shell().slots.useTargetLinks ?? noTargetLinks)();\n const columns = section.action && 'to' in section.action ? appTargetFields(section.action.to) : [];\n const keys = base.columns.filter((column) => column.primaryKey).map((column) => column.name);\n const readable =\n Boolean(scope) &&\n !preview &&\n columns.length > 0 &&\n columns.every((name) => base.columns.some((column) => column.name === name)) &&\n keys.length > 0 &&\n keys.every((name) => Object.hasOwn(recordKey, name) && recordKey[name] !== null && recordKey[name] !== undefined);\n const data = useQuery({\n queryKey: ['page-link-fields', scope?.owner.epoch, page.id, base.id, recordKey, columns],\n enabled: readable,\n queryFn: () =>\n readPageFields(\n {\n owner: connection ?? '',\n pageId: page.id,\n base,\n filter: pathEqualityFilter(Object.fromEntries(keys.map((name) => [name, recordKey[name]]))),\n columns,\n },\n (body) => api('/api/view/run', body),\n ),\n staleTime: 0,\n });\n const row = readable && (!isCurrent || isCurrent()) && data.data && 'view' in data.data ? data.data.rows[0] : undefined;\n return (\n <section className={sectionClass(section)}>\n <DashboardNote\n title={section.title}\n text={section.text ?? ''}\n icon={section.icon}\n variant={section.variant}\n action={preview && section.action && 'to' in section.action ? undefined : section.action}\n row={row}\n />\n </section>\n );\n}\n\ninterface Shown {\n section: PageSection;\n index: number;\n}\ninterface Tab {\n key: string | number;\n token: string;\n label: ReactNode;\n}\n\n/** Names across the top, one panel under them, each panel drawn the first time it is opened (or at once, where `eager`). */\nexport function TabStrip({\n tabs,\n name,\n entry,\n onTab,\n draw,\n scoped,\n eager = [],\n className = '',\n}: {\n tabs: Tab[];\n name: string;\n entry: PageEntry;\n onTab: (tab: string | undefined) => void;\n draw: (i: number) => ReactNode;\n scoped: boolean;\n eager?: number[];\n className?: string;\n}) {\n const id = useId();\n // An address says a tab as its word (appAddress.ts): matched by the token or by it.\n const asked = tabs.findIndex((tab) => tabMatches(tab.token, entry.tab));\n const [active, setActive] = useState(asked === -1 ? 0 : asked);\n const [drawn, setDrawn] = useState<Set<number>>(() => new Set([asked === -1 ? 0 : asked, ...eager]));\n const buttons = useRef<Array<HTMLButtonElement | null>>([]);\n /* The tabs that do not fit go under More (useTabFold.ts); the chosen one is never among them. */\n const { strip, folded } = useTabFold(tabs.length, active);\n /* A tab reached by the keyboard may have been under More: it is focused once the fold has made room for it. */\n const focusing = useRef<number | undefined>(undefined);\n useEffect(() => {\n if (focusing.current === undefined || folded.has(focusing.current)) return;\n buttons.current[focusing.current]?.focus();\n focusing.current = undefined;\n });\n const show = (i: number) => {\n setActive(i);\n setDrawn((s) => new Set(s).add(i));\n /* Written into the address bar without re-rendering: what you are looking\n at is what a link should carry. The first tab writes nothing. */\n onTab(!scoped && i === 0 ? undefined : tabs[i].token);\n };\n return (\n <div className={`page-tabs${className}`}>\n {/* The strip is the row that is measured; the tabs are its tablist, and More stands beside them, not among them. */}\n <div className=\"page-tabstrip folds\" ref={strip}>\n <div className=\"page-tablist\" role=\"tablist\" aria-label={name}>\n {tabs.map((tab, i) => (\n <button\n key={tab.key}\n type=\"button\"\n className=\"page-tab\"\n data-fold={i}\n data-folded={folded.has(i) ? '' : undefined}\n aria-hidden={folded.has(i) || undefined}\n role=\"tab\"\n id={`${id}-tab-${i}`}\n aria-controls={`${id}-tabpanel-${i}`}\n aria-selected={i === active}\n tabIndex={i === active ? 0 : -1}\n ref={(el) => {\n buttons.current[i] = el;\n }}\n onClick={() => show(i)}\n onKeyDown={(e) => {\n const step = e.key === 'ArrowRight' ? 1 : e.key === 'ArrowLeft' ? -1 : 0;\n const to = step ? (i + step + tabs.length) % tabs.length : e.key === 'Home' ? 0 : e.key === 'End' ? tabs.length - 1 : -1;\n if (to < 0) return;\n e.preventDefault();\n show(to);\n if (folded.has(to)) focusing.current = to;\n else buttons.current[to]?.focus();\n }}\n >\n {tab.label}\n </button>\n ))}\n </div>\n <div className=\"page-tab-more\" data-fold-more=\"\" data-folded={folded.size ? undefined : ''} aria-hidden={!folded.size || undefined}>\n <DropMenu\n className=\"page-tab-more-menu\"\n triggerClassName=\"page-tab\"\n label={message('common.more')}\n popupClassName=\"page-actions-popup\"\n align=\"end\"\n >\n {tabs.map((tab, i) =>\n folded.has(i) ? (\n <DropItem key={tab.key} className=\"page-actions-item\" onClick={() => show(i)}>\n {tab.label}\n </DropItem>\n ) : null,\n )}\n </DropMenu>\n </div>\n </div>\n <div className=\"page-tabpanels\">\n {tabs.map((tab, i) => (\n <div\n key={tab.key}\n className=\"page-tabpanel\"\n role=\"tabpanel\"\n id={`${id}-tabpanel-${i}`}\n aria-labelledby={`${id}-tab-${i}`}\n tabIndex={i === active ? 0 : -1}\n hidden={i !== active}\n inert={i !== active}\n aria-hidden={i !== active}\n >\n {drawn.has(i) ? draw(i) : null}\n </div>\n ))}\n </div>\n </div>\n );\n}\n\n/** A run of lists as tabs: the names across the top, one table under them, fetched when opened. */\nfunction ListTabs({\n items,\n entry,\n onTab,\n draw,\n scoped,\n}: {\n items: Shown[];\n entry: PageEntry;\n onTab: (tab: string | undefined) => void;\n draw: (item: Shown) => ReactNode;\n scoped: boolean;\n}) {\n useMessageLanguage();\n /* The token is the source's words (apps.ts keepAddresses), so an address names one tab in every language. */\n const named = (item: Shown) =>\n item.section.addressWords?.title ??\n item.section.title ??\n (findTable(item.section.from ?? '') as TableMeta | undefined)?.name ??\n item.section.from ??\n '';\n // Read as the strip renders: the run is still being gathered when the strip is created.\n const tabs = items.map((item) => ({\n key: item.index,\n token: scoped ? `section:${item.index}` : named(item),\n label: item.section.title ?? spoken((findTable(item.section.from ?? '') as TableMeta | undefined)?.name ?? item.section.from ?? ''),\n }));\n return <TabStrip tabs={tabs} name=\"Related lists\" entry={entry} onTab={onTab} draw={(i) => draw(items[i])} scoped={scoped} />;\n}\n\n/** The record's sections as tabs: a panel is sections again, laid out as the page lays them out. */\nfunction SectionTabs({\n groups,\n entry,\n onTab,\n lay,\n scoped,\n}: {\n groups: Array<{ name: string; items: Shown[] }>;\n entry: PageEntry;\n onTab: (tab: string | undefined) => void;\n lay: (items: Shown[]) => ReactNode[];\n scoped: boolean;\n}) {\n useMessageLanguage();\n /* Tokened by the tab's source words (apps.ts keepAddresses): an address names one tab in every language. */\n const tabs = groups.map((group) => ({\n key: group.name,\n token: `tab:${group.items.find(({ section }) => section.addressWords?.tab)?.section.addressWords?.tab ?? group.name}`,\n label: group.name,\n }));\n /* A panel holding the record's own fields is drawn at once, hidden: those\n fields are what name the record in its head, and one row costs nothing.\n A panel of lists still costs nothing until it is opened. */\n const eager = groups.flatMap((group, i) => (group.items.some(({ section }) => section.kind === 'fields') ? [i] : []));\n return (\n <TabStrip\n tabs={tabs}\n name=\"Record sections\"\n entry={entry}\n onTab={onTab}\n scoped={scoped}\n eager={eager}\n className=\" page-tabs-sections\"\n draw={(i) => <div className=\"page-tab-sections\">{lay(groups[i].items)}</div>}\n />\n );\n}\n\nexport function Sections({\n page,\n base,\n recordKey: key,\n plans,\n entry,\n onLabel,\n onEdit,\n onTab,\n region,\n onSectionLabel,\n titleOwner,\n onTitleEditor,\n only,\n}: {\n page: PageDef;\n base: TableMeta;\n recordKey: Record<string, unknown>;\n plans: SectionPlan[];\n entry: PageEntry;\n onLabel: (label: string) => void;\n onEdit: (opts?: { inPlace?: boolean }) => void;\n onTab: (tab: string | undefined) => void;\n region?: 'main' | 'aside';\n onSectionLabel: (index: number, label: string | undefined) => void;\n titleOwner?: number;\n onTitleEditor?: (index: number, render: (() => ReactNode) | undefined) => void;\n /** A part of the region, by section index: a listing draws its photos and its body as two bands (PageLayout.tsx). */\n only?: (index: number) => boolean;\n}) {\n /* Hidden sections are dropped here: hiding is a layout decision, and the\n original index travels with each one, because that is what the plan is\n keyed by. */\n const shown: Shown[] = page.sections\n .map((section, index) => ({ section, index }))\n /* A record header is drawn in the head (PageHead.tsx), not where it is written. */\n .filter(\n ({ section, index }) =>\n !section.hidden &&\n (!only || only(index)) &&\n !(section.kind === 'fields' && section.presentation === 'header') &&\n (!region || (section.region ?? 'main') === region),\n );\n const firstFields = shown.find(({ section }) => section.kind === 'fields')?.index;\n /* Only the aside's strips are scoped: the main column is the page, with or\n without an aside beside it, so its tabs keep their words in the address\n (/accounts/26/opportunities), never an index. */\n const scoped = region === 'aside';\n /* Each section stands behind its own boundary: one that throws while\n drawing says so under its heading, and the rest of the page stays. */\n const draw = (item: Shown, collapsed?: boolean) => (\n <ErrorBoundary\n key={`${item.index}${collapsed ? '-add' : ''}`}\n fallback={(note) => <SectionBox section={item.section} body={null} foldable={false} crashed={note} />}\n >\n <Slot\n page={page}\n section={item.section}\n index={item.index}\n plan={plans.find((p) => p.index === item.index) ?? { index: item.index }}\n base={base}\n recordKey={key}\n foldable={item.section.kind === 'fields' && item.index !== firstFields && !shell().publicVisitor()}\n entry={entry}\n onLabel={region ? undefined : onLabel}\n onSectionLabel={region ? onSectionLabel : undefined}\n onEdit={onEdit}\n titleOwner={titleOwner}\n onTitleEditor={onTitleEditor}\n collapsed={collapsed}\n />\n </ErrorBoundary>\n );\n /* A sequence of sections as the page draws them. `listTabs` is off inside\n a section's tab: a strip of lists inside a strip of sections is tabs in\n tabs, so there a panel's lists stack. */\n /* An App's page is laid out as its author wrote it: lists side by side\n become a tab strip only where the page says `listTabs: true` (or names\n tabs). A strip made on its own put two half-width lists in one\n full-width box. The Workbench's pages, built from the schema or by\n drag, keep the strip unless they say `listTabs: false`. */\n const autoTabs = inAppPage() ? page.listTabs === true : page.listTabs !== false;\n const lay = (items: Shown[], listTabs: boolean, grouped = false): ReactNode[] => {\n /* How long the run of lists containing each section is, so a run of one\n stays a plain section: one tab is a heading with a border around it. */\n const listRuns = new Map<number, number>();\n /* A gallery is a picture, not a table: it stands on its own, never a tab.\n Nor does a list an App's author gave a width: `width: 'half'` is a\n place on the page, and a tab strip spans it whole. The Workbench's\n builder gives every list it adds a width, so there a width is not a\n placement anyone chose, and its lists keep the strip. */\n /* A list that says what it does while empty (`empty: 'hide' | 'collapse'`) is a tab like any other: inside a strip\n an empty list is neither hidden nor collapsed, its tab shows it and the strip already folds it. */\n const tabbed = (section: PageSection) =>\n section.kind === 'list' && section.presentation !== 'gallery' && (section.width === undefined || !inAppPage());\n /* Outside a strip, such a list is left out or said in one line with its neighbours (PageEmptyRun.tsx). */\n const emptyable = (section: PageSection) => section.kind === 'list' && Boolean(section.emptyMode) && section.presentation !== 'card';\n /* Where a tab holds nothing but such lists, it never ends up with nothing. */\n const onlyEmptyable = items.length > 0 && items.every(({ section }) => emptyable(section));\n for (let i = 0; i < items.length; i += 1) {\n if (!tabbed(items[i].section)) continue;\n let end = i;\n while (end + 1 < items.length && tabbed(items[end + 1].section)) end += 1;\n for (let at = i; at <= end; at += 1) listRuns.set(at, end - i + 1);\n i = end;\n }\n const laid: ReactNode[] = [];\n let run: Shown[] | null = null;\n let strip: Shown[] | null = null;\n let leave: Shown[] | null = null;\n items.forEach((item, i) => {\n if (item.section.kind === 'metric') {\n strip = null;\n leave = null;\n if (!run) {\n run = [];\n laid.push(<MetricRun key={`run-${i}`} items={run} draw={draw} />);\n }\n run.push(item);\n return;\n }\n run = null;\n if (listTabs && autoTabs && listRuns.has(i) && (listRuns.get(i) ?? 0) > 1) {\n if (!strip) {\n strip = [];\n laid.push(<ListTabs key={`tabs-${i}`} items={strip} entry={entry} onTab={onTab} draw={draw} scoped={scoped} />);\n }\n strip.push(item);\n leave = null;\n return;\n }\n strip = null;\n if (emptyable(item.section)) {\n if (!leave) {\n leave = [];\n laid.push(\n <EmptyRun\n key={`empty-${i}`}\n items={leave}\n plans={plans}\n base={base}\n recordKey={key}\n draw={draw}\n rescue={grouped && onlyEmptyable}\n />,\n );\n }\n leave.push(item);\n return;\n }\n leave = null;\n laid.push(draw(item));\n });\n return laid;\n };\n /* Sections named into tabs: one strip per region, standing where the first\n of them stands, its tabs in the order their names first appear. The\n sections without a tab keep their order around it. One name alone is no\n strip — the parser refuses it, and a hidden section can still leave one —\n so its sections are drawn as they are. */\n const groups: Array<{ name: string; items: Shown[] }> = [];\n for (const item of shown) {\n const name = item.section.tab;\n if (!name) continue;\n const group = groups.find((g) => g.name === name);\n if (group) group.items.push(item);\n else groups.push({ name, items: [item] });\n }\n if (groups.length < 2) return <>{lay(shown, true)}</>;\n const first = shown.findIndex((item) => item.section.tab);\n return (\n <>\n {lay(shown.slice(0, first), true)}\n <SectionTabs groups={groups} entry={entry} onTab={onTab} scoped={scoped} lay={(items) => lay(items, false, true)} />\n {lay(\n shown.slice(first).filter((item) => !item.section.tab),\n true,\n )}\n </>\n );\n}\n\n/** A run of metrics is one item, not several: a strip with a line of its own. */\nfunction MetricRun({ items, draw }: { items: Shown[]; draw: (item: Shown) => ReactNode }) {\n return <div className=\"page-metric-row\">{items.map(draw)}</div>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuBA,IAAa,UAAU,SAAkB,MAAM,CAAC,CAAC,MAAM,IAAI,UAAU,IAAI,IAAI;;AAE7E,IAAa,kBAAkB,MAAM,CAAC,CAAC,MAAM;AAkE7C,IAAa,oBAAoB,cAgB9B,CAAC,CAAC;AACL,SAAgB,aAAa;CAC3B,MAAM,EAAE,eAAe,WAAW,iBAAiB;CACnD,MAAM,UAA0B,MAAM,GAAG,SAAS;EAGhD,MAAM,QAAQ,cAAc,KAAK,KAAM,CAAC;GAAE,GAAG,KAAK;GAAI,GAAG,QAAQ,UAAU;EAAE,CAAC,IAAoB;EAClG,OAAOA,IAAQ,MAAM,GAAG,KAAK;CAC/B;CACA,OAAO;AACT;;;;;;;AAyCA,SAAgB,kBAAmC;CACjD,OAAO;EACL,QAAQ,MAAM;EACd,KAAK,QAAQ,MAAM,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