graview 0.1.70 → 0.1.72

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 (235) hide show
  1. package/dist/preview/chunk.2IOJNFCR.js +1 -0
  2. package/dist/preview/{chunk.I7CSRZC2.js → chunk.2Q4ZXP7P.js} +1 -1
  3. package/dist/preview/{chunk.O2XPLDMM.js → chunk.2TTKQAWQ.js} +1 -1
  4. package/dist/preview/chunk.2YSE3SQN.js +23 -0
  5. package/dist/preview/{chunk.NZFO6BM3.js → chunk.2ZPR6FRI.js} +1 -1
  6. package/dist/preview/chunk.3BE4SHZD.js +1 -0
  7. package/dist/preview/{chunk.QODVFVWE.js → chunk.43HWCHBN.js} +1 -1
  8. package/dist/preview/{chunk.QILGAV7H.js → chunk.45OLF6BK.js} +1 -1
  9. package/dist/preview/{chunk.NTAC5NNE.js → chunk.47QWCVZD.js} +1 -1
  10. package/dist/preview/{chunk.7HNMG6LG.js → chunk.4A7BRBEA.js} +1 -1
  11. package/dist/preview/chunk.4EPCI6VY.js +1 -0
  12. package/dist/preview/{chunk.OXXZGPJZ.js → chunk.4PB5UFUJ.js} +1 -1
  13. package/dist/preview/{chunk.SWY6DIE4.js → chunk.4TDYDIIM.js} +3 -3
  14. package/dist/preview/{chunk.6VG2LCES.js → chunk.4VX7GPFS.js} +1 -1
  15. package/dist/preview/{chunk.TUVPQLFL.js → chunk.523X2YEQ.js} +1 -1
  16. package/dist/preview/{chunk.CHG522KL.js → chunk.53GQQETN.js} +1 -1
  17. package/dist/preview/{chunk.NBB5ALVJ.js → chunk.5MKZTHU2.js} +1 -1
  18. package/dist/preview/chunk.5OS4SYHE.js +1 -0
  19. package/dist/preview/{chunk.ZTHZHBVN.js → chunk.5ZT4R227.js} +1 -1
  20. package/dist/preview/{chunk.RIP2SAQ5.js → chunk.65SI77M7.js} +1 -1
  21. package/dist/preview/chunk.6ESAFTWB.js +1 -0
  22. package/dist/preview/chunk.6GUIFP2A.js +1 -0
  23. package/dist/preview/{chunk.M3HLZX6Q.js → chunk.6GZYKHEN.js} +1 -1
  24. package/dist/preview/{chunk.UVMHC6VM.js → chunk.6YKKZI4H.js} +1 -1
  25. package/dist/preview/{chunk.BBLA4PSP.js → chunk.73RMM4W7.js} +1 -1
  26. package/dist/preview/chunk.7DCBIMOI.js +1 -0
  27. package/dist/preview/chunk.7JE3J7H4.js +1 -0
  28. package/dist/preview/{chunk.YTRUZ56A.js → chunk.7QGDWAHH.js} +1 -1
  29. package/dist/preview/{chunk.JEQ6CA5M.js → chunk.7VCYVCYM.js} +2 -2
  30. package/dist/preview/{chunk.X7HMTN3Z.js → chunk.A4TBVXHQ.js} +1 -1
  31. package/dist/preview/{chunk.J4NY2K2A.js → chunk.A6LJPXJ3.js} +1 -1
  32. package/dist/preview/chunk.AAPXF6NP.js +1 -0
  33. package/dist/preview/chunk.APUICV5Z.js +1 -0
  34. package/dist/preview/chunk.ASNVH2G4.js +25 -0
  35. package/dist/preview/{chunk.CM7EDQ4E.js → chunk.CJHCUHVN.js} +1 -1
  36. package/dist/preview/chunk.CUEPNS3Z.js +1 -0
  37. package/dist/preview/{chunk.U3CV227I.js → chunk.CUJRWBPX.js} +1 -1
  38. package/dist/preview/{chunk.7TZXDPPO.js → chunk.D5PW6YWF.js} +3 -3
  39. package/dist/preview/chunk.DCIYOZYP.js +1 -0
  40. package/dist/preview/chunk.DEBW4FH6.js +1 -0
  41. package/dist/preview/{chunk.MR776WQ2.js → chunk.DYPSFTRP.js} +1 -1
  42. package/dist/preview/{chunk.BBMX3IIO.js → chunk.E6QZUT4L.js} +1 -1
  43. package/dist/preview/chunk.E7QZZRAQ.js +17 -0
  44. package/dist/preview/chunk.EHCMBAZO.js +3 -0
  45. package/dist/preview/chunk.EXTD5JWD.js +1 -0
  46. package/dist/preview/{chunk.KOVTQCHX.js → chunk.EZF2T3XQ.js} +1 -1
  47. package/dist/preview/chunk.EZSST3IU.js +1 -0
  48. package/dist/preview/{chunk.DIVANC3G.js → chunk.F2BZ4SC4.js} +1 -1
  49. package/dist/preview/chunk.F2I7ERGM.js +1 -0
  50. package/dist/preview/{chunk.UWEFODVV.js → chunk.FCV3NX6L.js} +1 -1
  51. package/dist/preview/{chunk.NZ5TJKPT.js → chunk.FFTBUXKX.js} +2 -2
  52. package/dist/preview/chunk.FILBI7XA.js +1 -0
  53. package/dist/preview/{chunk.MGG5DH2S.js → chunk.FKSI5522.js} +1 -1
  54. package/dist/preview/{chunk.I3ADXJQW.js → chunk.FQ2QUDZS.js} +1 -1
  55. package/dist/preview/{chunk.A5ENJJZN.js → chunk.G2ZDDO3C.js} +1 -1
  56. package/dist/preview/{chunk.IPKODEOZ.js → chunk.GAVEWSXU.js} +1 -1
  57. package/dist/preview/chunk.GH6QX7JR.js +87 -0
  58. package/dist/preview/chunk.GMHBAS45.js +1 -0
  59. package/dist/preview/{chunk.YCMMATFK.js → chunk.GOVRX2YX.js} +1 -1
  60. package/dist/preview/chunk.GXK5PI7I.js +1 -0
  61. package/dist/preview/{chunk.RECTEAG4.js → chunk.GYP3EF6Z.js} +1 -1
  62. package/dist/preview/chunk.H2RVMT4Y.js +111 -0
  63. package/dist/preview/chunk.HCHGKI64.js +1 -0
  64. package/dist/preview/chunk.HE7SAJKZ.js +1 -0
  65. package/dist/preview/{chunk.WAIIXXVI.js → chunk.HIIYDKFC.js} +2 -2
  66. package/dist/preview/chunk.HPDUGKEF.js +32 -0
  67. package/dist/preview/{chunk.DGDOZHYK.js → chunk.HQRPOGTS.js} +1 -1
  68. package/dist/preview/chunk.HUJLELZ3.js +1 -0
  69. package/dist/preview/chunk.HVRUHRXR.js +1 -0
  70. package/dist/preview/{chunk.6KYTCEIH.js → chunk.I46VNAMS.js} +1 -1
  71. package/dist/preview/{chunk.QAERSZVB.js → chunk.ID4GOKT6.js} +1 -1
  72. package/dist/preview/{chunk.RJ7UV3XI.js → chunk.IZKCTF2R.js} +1 -1
  73. package/dist/preview/chunk.IZUAZ6EV.js +1 -0
  74. package/dist/preview/{chunk.ZIGW5VOT.js → chunk.J3CUBMUZ.js} +1 -1
  75. package/dist/preview/{chunk.3HFBHLXC.js → chunk.J4D4BIB4.js} +1 -1
  76. package/dist/preview/{chunk.IRPMGHZN.js → chunk.J7GH2CGV.js} +1 -1
  77. package/dist/preview/{chunk.SSHEFQ4R.js → chunk.JE4RBRKH.js} +1 -1
  78. package/dist/preview/{chunk.4BSEYZMS.js → chunk.JJSZLCNU.js} +1 -1
  79. package/dist/preview/{chunk.KV3N6VRG.js → chunk.JKX4J3KG.js} +1 -1
  80. package/dist/preview/{chunk.FUTSLXWN.js → chunk.JMXBMLKH.js} +1 -1
  81. package/dist/preview/chunk.JOB3EKS6.js +1 -0
  82. package/dist/preview/{chunk.5IM2X3VT.js → chunk.JP33TNCH.js} +1 -1
  83. package/dist/preview/{chunk.BZXJKWNI.js → chunk.K6EN2YR4.js} +1 -1
  84. package/dist/preview/chunk.K6YKXTKC.js +1 -0
  85. package/dist/preview/{chunk.A7JORJJL.js → chunk.KAIZDIRK.js} +1 -1
  86. package/dist/preview/{chunk.7LAXSQQY.js → chunk.KAQGSLC6.js} +3 -3
  87. package/dist/preview/{chunk.QG3LV4RH.js → chunk.KFYSKZC4.js} +1 -1
  88. package/dist/preview/{chunk.VBHV4TLG.js → chunk.KHRS2SKB.js} +1 -1
  89. package/dist/preview/chunk.KHVW6Q3T.js +1 -0
  90. package/dist/preview/chunk.KMFH26SS.js +1 -0
  91. package/dist/preview/{chunk.2T24FYAO.js → chunk.L3ST2YKI.js} +1 -1
  92. package/dist/preview/{chunk.HIJ72QX6.js → chunk.L6BLZJ6K.js} +1 -1
  93. package/dist/preview/{chunk.NCBUECIW.js → chunk.LG2BQ5LB.js} +1 -1
  94. package/dist/preview/{chunk.LZ3HO3HM.js → chunk.LLYHHG67.js} +1 -1
  95. package/dist/preview/{chunk.VKQONZKR.js → chunk.LPWANRBL.js} +1 -1
  96. package/dist/preview/{chunk.3MPLUSVY.js → chunk.LSS64NAA.js} +1 -1
  97. package/dist/preview/{chunk.SUYYDJGZ.js → chunk.MFNWHXGL.js} +1 -1
  98. package/dist/preview/{chunk.UJF6YTEO.js → chunk.MNH3WUAB.js} +1 -1
  99. package/dist/preview/chunk.MQ7AB5N4.js +1 -0
  100. package/dist/preview/{chunk.CZUUFO6A.js → chunk.MU5JK5TK.js} +1 -1
  101. package/dist/preview/{chunk.RXUL6P7Y.js → chunk.N5CACZ5F.js} +1 -1
  102. package/dist/preview/{chunk.S6IKR6RD.js → chunk.NFC2TYA6.js} +1 -1
  103. package/dist/preview/{chunk.TD2V74XU.js → chunk.NKRDVOLJ.js} +1 -1
  104. package/dist/preview/{chunk.SGYZM6ZU.js → chunk.NNK2E2EP.js} +1 -1
  105. package/dist/preview/{chunk.J65CZJIC.js → chunk.NVPKYWMF.js} +1 -1
  106. package/dist/preview/{chunk.DWMFLLJO.js → chunk.NWJ7ELHN.js} +1 -1
  107. package/dist/preview/{chunk.NKUNCQB3.js → chunk.O5P6LXHF.js} +1 -1
  108. package/dist/preview/{chunk.2MWEYNVH.js → chunk.OFK6673S.js} +1 -1
  109. package/dist/preview/{chunk.C4LC2UEU.js → chunk.OG6FEP3K.js} +1 -1
  110. package/dist/preview/{chunk.CZI6J5CE.js → chunk.OHGAZ3D5.js} +1 -1
  111. package/dist/preview/{chunk.XJ4JYROM.js → chunk.ONVYKLRX.js} +1 -1
  112. package/dist/preview/chunk.OQ3FKUP2.js +1 -0
  113. package/dist/preview/chunk.OUJV4CYS.js +1 -0
  114. package/dist/preview/{chunk.T552MHMU.js → chunk.OWHH7JDV.js} +1 -1
  115. package/dist/preview/{chunk.SCN6IYDG.js → chunk.OXDCGGZV.js} +1 -1
  116. package/dist/preview/{chunk.YIDNZTON.js → chunk.P3Z4ZCL3.js} +1 -1
  117. package/dist/preview/chunk.PF7XQ5R5.js +1 -0
  118. package/dist/preview/{chunk.FSZQTX3K.js → chunk.PGT4ZQDG.js} +4 -4
  119. package/dist/preview/chunk.PH547SON.js +1 -0
  120. package/dist/preview/chunk.PS765ODQ.js +3 -0
  121. package/dist/preview/{chunk.MZSWWMX6.js → chunk.PVAYYFT2.js} +1 -1
  122. package/dist/preview/{chunk.F5STM4DX.js → chunk.Q6WOIE5I.js} +1 -1
  123. package/dist/preview/{chunk.55C7WO4X.js → chunk.QE257AXE.js} +1 -1
  124. package/dist/preview/chunk.QKNC5OUC.js +1 -0
  125. package/dist/preview/chunk.QMGBAKX6.js +2 -0
  126. package/dist/preview/{chunk.4QBW46XV.js → chunk.QNFX5VHW.js} +1 -1
  127. package/dist/preview/chunk.QPCDAQTW.js +1 -0
  128. package/dist/preview/{chunk.TS5APXWC.js → chunk.QPTQIGLX.js} +1 -1
  129. package/dist/preview/{chunk.LZNHTROY.js → chunk.R5YGW5ZX.js} +1 -1
  130. package/dist/preview/{chunk.4VTUC5TF.js → chunk.RJ6KEVZC.js} +1 -1
  131. package/dist/preview/{chunk.6QMRDSTD.js → chunk.RKVMRP7B.js} +1 -1
  132. package/dist/preview/{chunk.YBQUP3KE.js → chunk.S7U2CHHG.js} +1 -1
  133. package/dist/preview/{chunk.CLJKQLK2.js → chunk.SD2UYSV6.js} +2 -2
  134. package/dist/preview/chunk.SI5GGFQR.js +1 -0
  135. package/dist/preview/{chunk.7QWGIGHM.js → chunk.SMF5S4DQ.js} +1 -1
  136. package/dist/preview/{chunk.LEZGBHPZ.js → chunk.SNDFIJVX.js} +1 -1
  137. package/dist/preview/{chunk.F5756PXX.js → chunk.STHWM422.js} +2 -2
  138. package/dist/preview/{chunk.JIEBGUCA.js → chunk.SV75TRCH.js} +1 -1
  139. package/dist/preview/{chunk.U2DZE7A5.js → chunk.SXGPRFA4.js} +1 -1
  140. package/dist/preview/{chunk.ZGJUCVT5.js → chunk.T3RFZ66S.js} +1 -1
  141. package/dist/preview/{chunk.I6HIVTXU.js → chunk.T6ISUVUP.js} +1 -1
  142. package/dist/preview/{chunk.R65YX332.js → chunk.TBLOBXZ2.js} +1 -1
  143. package/dist/preview/{chunk.CVVNHQPO.js → chunk.TDWJU6GW.js} +1 -1
  144. package/dist/preview/{chunk.2QALBEWP.js → chunk.THLT6NVO.js} +1 -1
  145. package/dist/preview/{chunk.7FTATAH2.js → chunk.TQCVEKPH.js} +1 -1
  146. package/dist/preview/{chunk.PAIBRJVZ.js → chunk.TQF5XCUS.js} +1 -1
  147. package/dist/preview/{chunk.F5XWYO5W.js → chunk.TRP66PHK.js} +1 -1
  148. package/dist/preview/chunk.TWXYI5AP.js +2 -0
  149. package/dist/preview/{chunk.IQCMV5WD.js → chunk.UOUQZYVD.js} +1 -1
  150. package/dist/preview/{chunk.FJXKQZZS.js → chunk.UPL3D3ZO.js} +1 -1
  151. package/dist/preview/{chunk.U5Q7EVZQ.js → chunk.UXW43HNW.js} +1 -1
  152. package/dist/preview/{chunk.ZOSTOVXR.js → chunk.V4GSVXSV.js} +1 -1
  153. package/dist/preview/chunk.VCEDSOAK.js +1 -0
  154. package/dist/preview/{chunk.4O3STSC4.js → chunk.VE4AQFLW.js} +1 -1
  155. package/dist/preview/{chunk.HMV4ILAC.js → chunk.VGQDPEB5.js} +1 -1
  156. package/dist/preview/{chunk.5A5DI36V.js → chunk.VMYXBFPE.js} +1 -1
  157. package/dist/preview/{chunk.BQWMHHAZ.js → chunk.VNI6HZEF.js} +2 -2
  158. package/dist/preview/chunk.VQRY2NQ6.js +1 -0
  159. package/dist/preview/{chunk.K6EKSURO.js → chunk.VUE6ILQV.js} +1 -1
  160. package/dist/preview/{chunk.3KF5RYPW.js → chunk.W2VSEEKX.js} +1 -1
  161. package/dist/preview/{chunk.KP7HUXH5.js → chunk.WAPY4RCS.js} +1 -1
  162. package/dist/preview/chunk.WFRSGGU5.js +1 -0
  163. package/dist/preview/{chunk.XAN7QXMQ.js → chunk.WIVNFOQR.js} +1 -1
  164. package/dist/preview/chunk.WRIBFLVG.js +1 -0
  165. package/dist/preview/{chunk.TVNY7F64.js → chunk.WWD2TS47.js} +1 -1
  166. package/dist/preview/{chunk.5W7EGQCQ.js → chunk.WWFOQDPR.js} +2 -2
  167. package/dist/preview/{chunk.FBDCHJS2.js → chunk.X45EITTK.js} +1 -1
  168. package/dist/preview/{chunk.5FQHZVE3.js → chunk.X5MCAUFX.js} +1 -1
  169. package/dist/preview/{chunk.IJVR7ZL7.js → chunk.XBWFQ54R.js} +1 -1
  170. package/dist/preview/{chunk.JPJHM62B.js → chunk.XMBGT6UT.js} +1 -1
  171. package/dist/preview/chunk.XP4IVKKR.js +1 -0
  172. package/dist/preview/chunk.XYBWBMNU.js +1 -0
  173. package/dist/preview/{chunk.MYR36HW4.js → chunk.YC2IDHQX.js} +1 -1
  174. package/dist/preview/{chunk.ZQSV5XVB.js → chunk.YCYJHPWS.js} +1 -1
  175. package/dist/preview/{chunk.BJ3G7J2Z.js → chunk.YF5GCOSZ.js} +3 -2
  176. package/dist/preview/{chunk.3I2SGKKF.js → chunk.YGGBGHZU.js} +1 -1
  177. package/dist/preview/chunk.YRC6PKXP.js +1 -0
  178. package/dist/preview/{chunk.6NYSB6OZ.js → chunk.YRN67Z5K.js} +1 -1
  179. package/dist/preview/chunk.ZDUKVXBI.js +5 -0
  180. package/dist/preview/index.html +55 -55
  181. package/dist/preview/page.js +2 -2
  182. package/package.json +6 -6
  183. package/dist/preview/chunk.2QOB62XU.js +0 -1
  184. package/dist/preview/chunk.36FKQJFM.js +0 -2
  185. package/dist/preview/chunk.3A3DCALP.js +0 -1
  186. package/dist/preview/chunk.3GPYKWAD.js +0 -1
  187. package/dist/preview/chunk.3QPMFUMV.js +0 -1
  188. package/dist/preview/chunk.3ZP6IDUC.js +0 -1
  189. package/dist/preview/chunk.53HW224Y.js +0 -1
  190. package/dist/preview/chunk.AW74DZ5V.js +0 -17
  191. package/dist/preview/chunk.C67TMA4U.js +0 -111
  192. package/dist/preview/chunk.CCCSZRKU.js +0 -1
  193. package/dist/preview/chunk.CUA7F3YJ.js +0 -25
  194. package/dist/preview/chunk.DBSSCJQM.js +0 -1
  195. package/dist/preview/chunk.DW6KXAUM.js +0 -1
  196. package/dist/preview/chunk.DWPM7AWA.js +0 -1
  197. package/dist/preview/chunk.FXCKKVT5.js +0 -1
  198. package/dist/preview/chunk.HHQUCFN4.js +0 -1
  199. package/dist/preview/chunk.HPWMCS3H.js +0 -23
  200. package/dist/preview/chunk.HRLCDBMO.js +0 -1
  201. package/dist/preview/chunk.I7ODVOO5.js +0 -1
  202. package/dist/preview/chunk.IANOWT3Z.js +0 -1
  203. package/dist/preview/chunk.IFPJPJ4M.js +0 -1
  204. package/dist/preview/chunk.IUVRJDL3.js +0 -5
  205. package/dist/preview/chunk.J4CSY2D5.js +0 -2
  206. package/dist/preview/chunk.JJIKTTXB.js +0 -1
  207. package/dist/preview/chunk.KDOJC4FX.js +0 -1
  208. package/dist/preview/chunk.KJAOJTZZ.js +0 -1
  209. package/dist/preview/chunk.KLZPUTMU.js +0 -1
  210. package/dist/preview/chunk.LQ2PDW2M.js +0 -32
  211. package/dist/preview/chunk.M7DJJRFH.js +0 -1
  212. package/dist/preview/chunk.MNWP3TPN.js +0 -1
  213. package/dist/preview/chunk.MSWOETXN.js +0 -1
  214. package/dist/preview/chunk.NILR2BWR.js +0 -1
  215. package/dist/preview/chunk.NNYKLENL.js +0 -1
  216. package/dist/preview/chunk.PYGNO2AV.js +0 -87
  217. package/dist/preview/chunk.PZHCWMKT.js +0 -1
  218. package/dist/preview/chunk.QQUZ5RTQ.js +0 -1
  219. package/dist/preview/chunk.QVID5WHS.js +0 -1
  220. package/dist/preview/chunk.RHV73CBA.js +0 -3
  221. package/dist/preview/chunk.RP6C2IUM.js +0 -1
  222. package/dist/preview/chunk.RPHZY7N4.js +0 -1
  223. package/dist/preview/chunk.RSMCTI2N.js +0 -1
  224. package/dist/preview/chunk.S4QSZRKH.js +0 -1
  225. package/dist/preview/chunk.T4QRIJE4.js +0 -1
  226. package/dist/preview/chunk.UJM5EZDM.js +0 -3
  227. package/dist/preview/chunk.UJPX3BUV.js +0 -1
  228. package/dist/preview/chunk.UYBSVE2W.js +0 -1
  229. package/dist/preview/chunk.WMZ2BINI.js +0 -1
  230. package/dist/preview/chunk.X2RHBTJI.js +0 -1
  231. package/dist/preview/chunk.X3FPVFFB.js +0 -1
  232. package/dist/preview/chunk.X4PFLIXB.js +0 -1
  233. package/dist/preview/chunk.YR7DKU5T.js +0 -1
  234. package/dist/preview/chunk.ZBK3FCVE.js +0 -1
  235. package/dist/preview/chunk.ZH5L746C.js +0 -1
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.4VX7GPFS.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.FQ2QUDZS.js";import{a as ie}from"./chunk.VGQDPEB5.js";import{a as Y}from"./chunk.6YKKZI4H.js";import{a as X,e as O}from"./chunk.GH6QX7JR.js";import{E as K,G as Ie,J as Q,U as V,_,ia as j}from"./chunk.ASNVH2G4.js";import{zd as J}from"./chunk.ZDUKVXBI.js";import{b as N}from"./chunk.AJZBJBMO.js";var c=N(Ie(),1);var o=N(_(),1);function he(e,a,t){let i=a.on==="selection"?a.ids:a.on==="record"||a.on==="field"?[a.id]:[],l=i.length>0?ie(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:a,principal:e.principal,interaction:se(),places:e.places,selection:e.selection,...l?{acts:l}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function be(e,a,t){let i=await (__graviewPreload(import.meta.url,["./chunk.IZKCTF2R.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.JP33TNCH.js","./chunk.BIDL7GQD.js","./chunk.O5P6LXHF.js","./chunk.ONVYKLRX.js","./chunk.XOZU4OFA.js","./chunk.53GQQETN.js","./chunk.Q5WEOX3Q.js","./chunk.7DCBIMOI.js","./chunk.GXK5PI7I.js","./chunk.DYPSFTRP.js","./chunk.WVUJXDXZ.js","./chunk.J7GH2CGV.js","./chunk.SMF5S4DQ.js","./chunk.XP4IVKKR.js","./chunk.R5YGW5ZX.js","./chunk.QMGBAKX6.js","./chunk.PS765ODQ.js","./chunk.T3RFZ66S.js","./chunk.TDWJU6GW.js","./chunk.P3Z4ZCL3.js","./chunk.45OLF6BK.js","./chunk.T6ISUVUP.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XYBWBMNU.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
@@ -1,4 +1,4 @@
1
- import{a as _,b as I,c as T,d as j,e as P,f as F,g as S,j as D}from"./chunk.F5XWYO5W.js";import{a as M}from"./chunk.FSZQTX3K.js";var q=0,Q=1,ee=2,ne=3,U=1,te=2,$=3,re=1,se=3,ie=8,z="~",R=s=>typeof s=="object"&&s!==null&&!Array.isArray(s),H=new Set(["input","select","textarea","option"]),oe=new Set(["value","checked","selected"]),W=["aria-label","aria-labelledby","title"],ae=s=>W.some(r=>(s.getAttribute(r)??"").trim()!=="");function ge(s,r){let l=s.ownerDocument??s,h=r.maxNodes??5e3,f=[],p=new Map,E=new WeakMap,b={dom:s,name:"div",namespace:"html",children:[],id:z};p.set(z,b);let v=0,L=!1,k=new WeakMap,A=new Map,w=new Map,c=e=>{f.push(e),f.length>200&&f.shift(),r.onRefused?.(e)},y=()=>({dom:l.createComment(""),children:[],refused:!0}),Y=(e,a)=>{if(e.namespace==="html"&&e.name&&H.has(e.name))return e.dom;if(a?.namespace==="html"&&a.name==="textarea")return a.dom},O=(e,a)=>{let o=e.dom,i=k.get(o)??o.getAttribute("role");if(i===null||!i.split(/\s+/).some(t=>_.includes(t.toLowerCase())))return void k.delete(o);if(ae(o)){k.delete(o),o.getAttribute("role")!==i&&o.setAttribute("role",i);return}k.set(o,i),o.removeAttribute("role"),a&&c({reason:"value",element:e.name,name:"role"})},Z=()=>{if(w.size===0)return;let e=new Set,a=o=>{for(let i of o.children){if(i.refused||i.text)continue;let t=i.dom.getAttribute("id");t&&e.add(t),a(i)}};a(b);for(let[o,i]of w){if(o.id===void 0||p.get(o.id)!==o){w.delete(o);continue}let t=o.dom;for(let[n,u]of i){let d=u.value.split(/\s+/).filter(g=>g!==""),m=d.filter(g=>!e.has(g));if(d.length>0&&m.length===0){if(u.drawn)continue;u.drawn=!0,t.setAttribute(n,u.value),O(o,!1)}else u.drawn&&(u.drawn=!1,t.removeAttribute(n),c({reason:"reference",element:o.name,name:n,ids:m.length>0?m:d}),O(o,!0))}}},N=(e,a,o,i=!0)=>{let t=e.dom;if(o!=null&&typeof o!="string")return c({reason:"value",element:e.name,name:a});let n=D(e.namespace,e.name,a,o??null,r);if("refused"in n){let g=D(e.namespace,e.name,a,null,r);return"refused"in g||t.removeAttribute(g.name),!("refused"in g)&&g.name==="role"&&k.delete(t),c(n.refused)}for(let g of n.dropped??[])c(g);let u=e.namespace==="html"&&oe.has(n.name)&&H.has(e.name),d=t,m=u?n.name==="value"?d.value:n.name==="checked"?d.checked:d.selected:void 0;if(n.name==="role"&&k.delete(t),I.includes(n.name)){let g=w.get(e)??new Map;n.value===null?g.delete(n.name):g.set(n.name,{value:n.value,drawn:!0}),g.size>0?w.set(e,g):w.delete(e)}n.value===null?t.removeAttribute(n.name):t.setAttribute(n.name,n.value),i&&(n.name==="role"||W.includes(n.name))&&O(e,n.name==="role"),r.onAttribute?.(t,n.name),u&&(n.name==="value"&&"value"in d?(d.value=n.value??"",m!==d.value&&r.onFieldSet?.(t)):n.name==="checked"&&"checked"in d?(d.checked=n.value!==null,m!==d.checked&&r.onFieldSet?.(t)):n.name==="selected"&&"selected"in d&&(d.selected=n.value!==null,m!==d.selected&&r.onFieldSet?.(t.parentElement?.closest("select")??t)))},x=e=>{if(!e.refused){v-=1,e.id!==void 0&&p.delete(e.id);for(let a of e.children)x(a)}},C=(e,a)=>{if(!R(e)||typeof e.id!="string"||p.has(e.id))return c({reason:"record"}),y();if(v>=h)return c({reason:"budget"}),L||(L=!0,r.onOverBudget?.()),y();let o=e.id;if(e.type===ie)return y();if(e.type===se){if(S(a.namespace,a.name))return c({reason:"child",element:a.name}),y();let d=l.createTextNode(String(e.data??"").slice(0,T)),m={dom:d,children:[],text:!0,id:o,parent:a};return p.set(o,m),E.set(d,o),v+=1,m}if(e.type!==re)return c({reason:"record"}),y();let i=String(e.element);if(S(a.namespace,a.name))return c({reason:"child",element:i}),y();let t=F(i,a.namespace);if("refused"in t)return c(t.refused),y();let n=l.createElementNS(t.namespace==="svg"?P:j,t.name);t.as&&n.setAttribute("data-graview-as",t.as),t.namespace==="html"&&t.name==="img"&&n.setAttribute("referrerpolicy","no-referrer"),t.namespace==="html"&&t.name==="a"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"),n.setAttribute("referrerpolicy","no-referrer"));let u={dom:n,name:t.name,namespace:t.namespace,children:[],id:o,parent:a};if(p.set(o,u),E.set(n,o),v+=1,R(e.attributes)){for(let[d,m]of Object.entries(e.attributes))N(u,d,m,!1);O(u,!0)}if(r.decorate?.(n,t.name,t.namespace),R(e.properties))for(let d of Object.keys(e.properties))c({reason:"attribute",element:t.name,name:d});if(R(e.eventListeners))for(let d of Object.keys(e.eventListeners))e.eventListeners[d]!=null&&c({reason:"attribute",element:t.name,name:`on${d}`});if(Array.isArray(e.children))for(let d of e.children){let m=C(d,u);u.children.push(m),n.appendChild(m.dom)}return u},K=e=>{if(!Array.isArray(e))return c({reason:"record"});let[a,o]=e,i=typeof o=="string"?p.get(o):void 0;if(!i)return c({reason:"record"});switch(a){case q:{if(i.text)return c({reason:"record"});let t=Number(e[3]),n=Number.isInteger(t)&&t>=0&&t<=i.children.length?t:i.children.length,u=e[2],d=R(u)&&typeof u.id=="string"?A.get(u.id):void 0,m;d&&d.parent?.namespace===i.namespace&&!S(i.namespace,i.name)?(A.delete(u.id),d.parent=i,m=d):m=C(u,i),i.dom.insertBefore(m.dom,i.children[n]?.dom??null),i.children.splice(n,0,m),i.namespace==="html"&&i.name==="textarea"&&r.onFieldSet?.(i.dom);return}case Q:{let t=Number(e[2]),n=i.children[t];if(!n)return c({reason:"record"});i.children.splice(t,1),n.dom.parentNode?.removeChild(n.dom),n.id!==void 0&&!n.refused?A.set(n.id,n):x(n);return}case ee:{if(!i.text)return c({reason:"record"});i.dom.data=String(e[2]??"").slice(0,T);let t=Y(i,i.parent);t&&r.onFieldSet?.(t);return}case ne:{if(i===b||i.text)return c({reason:"record"});let t=String(e[2]),n=e[4]??U;return n===te?N(i,t,e[3]):c(n===U||n===$?{reason:"attribute",element:i.name,name:n===$?`on${t}`:t}:{reason:"record"})}default:return c({reason:"record"})}};return{apply(e,a){if(!Array.isArray(e))return c({reason:"record"}),!0;try{for(let o=0;o<e.length;o+=1){if(a&&o%32===0&&a())return!1;K(e[o])}return!0}finally{for(let o of A.values())x(o);A.clear(),Z()}},get refused(){return f},get size(){return v},idOf:e=>E.get(e),elementOf(e){let a=p.get(e);return a&&!a.text&&a!==b?a.dom:void 0},dispose(){for(let e of b.children)x(e);for(b.children.length=0;s.firstChild;)s.removeChild(s.firstChild)}}}var de="@layer graview-motion, graview-region, graview-view, graview-theme;",le=new Set(["media","supports","container","keyframes","-webkit-keyframes"]),ce=new Set(["src","image-set","-webkit-image-set"]),ue={"}":"{",")":"(","]":"["};function G(s){let r=[],l=M(s);for(let[h,f]of l.entries())switch(f.type){case"bad-string":case"bad-url":case"url":case"CDO":case"CDC":return!1;case"delim":if(f.value==="\\")return!1;break;case"at-keyword":if(!le.has(f.value.toLowerCase()))return!1;break;case";":if(r.length===0)return!1;break;case"function":{let p=f.value.toLowerCase();if(ce.has(p))return!1;if(p==="url"){let E=l[h+1];if(E?.type!=="string"||!E.value.startsWith("#"))return!1}r.push("(");break}case"{":case"(":case"[":r.push(f.type);break;case"}":case")":case"]":if(r.pop()!==ue[f.type])return!1;break;default:}return r.length===0}function B(s,r){return r.trim()===""||!G(r)?"":`@layer ${s} {
1
+ import{a as _,b as I,c as T,d as j,e as P,f as F,g as S,j as D}from"./chunk.TRP66PHK.js";import{a as M}from"./chunk.PGT4ZQDG.js";var q=0,Q=1,ee=2,ne=3,U=1,te=2,$=3,re=1,se=3,ie=8,z="~",R=s=>typeof s=="object"&&s!==null&&!Array.isArray(s),H=new Set(["input","select","textarea","option"]),oe=new Set(["value","checked","selected"]),W=["aria-label","aria-labelledby","title"],ae=s=>W.some(r=>(s.getAttribute(r)??"").trim()!=="");function ge(s,r){let l=s.ownerDocument??s,h=r.maxNodes??5e3,f=[],p=new Map,E=new WeakMap,b={dom:s,name:"div",namespace:"html",children:[],id:z};p.set(z,b);let v=0,L=!1,k=new WeakMap,A=new Map,w=new Map,c=e=>{f.push(e),f.length>200&&f.shift(),r.onRefused?.(e)},y=()=>({dom:l.createComment(""),children:[],refused:!0}),Y=(e,a)=>{if(e.namespace==="html"&&e.name&&H.has(e.name))return e.dom;if(a?.namespace==="html"&&a.name==="textarea")return a.dom},O=(e,a)=>{let o=e.dom,i=k.get(o)??o.getAttribute("role");if(i===null||!i.split(/\s+/).some(t=>_.includes(t.toLowerCase())))return void k.delete(o);if(ae(o)){k.delete(o),o.getAttribute("role")!==i&&o.setAttribute("role",i);return}k.set(o,i),o.removeAttribute("role"),a&&c({reason:"value",element:e.name,name:"role"})},Z=()=>{if(w.size===0)return;let e=new Set,a=o=>{for(let i of o.children){if(i.refused||i.text)continue;let t=i.dom.getAttribute("id");t&&e.add(t),a(i)}};a(b);for(let[o,i]of w){if(o.id===void 0||p.get(o.id)!==o){w.delete(o);continue}let t=o.dom;for(let[n,u]of i){let d=u.value.split(/\s+/).filter(g=>g!==""),m=d.filter(g=>!e.has(g));if(d.length>0&&m.length===0){if(u.drawn)continue;u.drawn=!0,t.setAttribute(n,u.value),O(o,!1)}else u.drawn&&(u.drawn=!1,t.removeAttribute(n),c({reason:"reference",element:o.name,name:n,ids:m.length>0?m:d}),O(o,!0))}}},N=(e,a,o,i=!0)=>{let t=e.dom;if(o!=null&&typeof o!="string")return c({reason:"value",element:e.name,name:a});let n=D(e.namespace,e.name,a,o??null,r);if("refused"in n){let g=D(e.namespace,e.name,a,null,r);return"refused"in g||t.removeAttribute(g.name),!("refused"in g)&&g.name==="role"&&k.delete(t),c(n.refused)}for(let g of n.dropped??[])c(g);let u=e.namespace==="html"&&oe.has(n.name)&&H.has(e.name),d=t,m=u?n.name==="value"?d.value:n.name==="checked"?d.checked:d.selected:void 0;if(n.name==="role"&&k.delete(t),I.includes(n.name)){let g=w.get(e)??new Map;n.value===null?g.delete(n.name):g.set(n.name,{value:n.value,drawn:!0}),g.size>0?w.set(e,g):w.delete(e)}n.value===null?t.removeAttribute(n.name):t.setAttribute(n.name,n.value),i&&(n.name==="role"||W.includes(n.name))&&O(e,n.name==="role"),r.onAttribute?.(t,n.name),u&&(n.name==="value"&&"value"in d?(d.value=n.value??"",m!==d.value&&r.onFieldSet?.(t)):n.name==="checked"&&"checked"in d?(d.checked=n.value!==null,m!==d.checked&&r.onFieldSet?.(t)):n.name==="selected"&&"selected"in d&&(d.selected=n.value!==null,m!==d.selected&&r.onFieldSet?.(t.parentElement?.closest("select")??t)))},x=e=>{if(!e.refused){v-=1,e.id!==void 0&&p.delete(e.id);for(let a of e.children)x(a)}},C=(e,a)=>{if(!R(e)||typeof e.id!="string"||p.has(e.id))return c({reason:"record"}),y();if(v>=h)return c({reason:"budget"}),L||(L=!0,r.onOverBudget?.()),y();let o=e.id;if(e.type===ie)return y();if(e.type===se){if(S(a.namespace,a.name))return c({reason:"child",element:a.name}),y();let d=l.createTextNode(String(e.data??"").slice(0,T)),m={dom:d,children:[],text:!0,id:o,parent:a};return p.set(o,m),E.set(d,o),v+=1,m}if(e.type!==re)return c({reason:"record"}),y();let i=String(e.element);if(S(a.namespace,a.name))return c({reason:"child",element:i}),y();let t=F(i,a.namespace);if("refused"in t)return c(t.refused),y();let n=l.createElementNS(t.namespace==="svg"?P:j,t.name);t.as&&n.setAttribute("data-graview-as",t.as),t.namespace==="html"&&t.name==="img"&&n.setAttribute("referrerpolicy","no-referrer"),t.namespace==="html"&&t.name==="a"&&(n.setAttribute("target","_blank"),n.setAttribute("rel","noopener noreferrer"),n.setAttribute("referrerpolicy","no-referrer"));let u={dom:n,name:t.name,namespace:t.namespace,children:[],id:o,parent:a};if(p.set(o,u),E.set(n,o),v+=1,R(e.attributes)){for(let[d,m]of Object.entries(e.attributes))N(u,d,m,!1);O(u,!0)}if(r.decorate?.(n,t.name,t.namespace),R(e.properties))for(let d of Object.keys(e.properties))c({reason:"attribute",element:t.name,name:d});if(R(e.eventListeners))for(let d of Object.keys(e.eventListeners))e.eventListeners[d]!=null&&c({reason:"attribute",element:t.name,name:`on${d}`});if(Array.isArray(e.children))for(let d of e.children){let m=C(d,u);u.children.push(m),n.appendChild(m.dom)}return u},K=e=>{if(!Array.isArray(e))return c({reason:"record"});let[a,o]=e,i=typeof o=="string"?p.get(o):void 0;if(!i)return c({reason:"record"});switch(a){case q:{if(i.text)return c({reason:"record"});let t=Number(e[3]),n=Number.isInteger(t)&&t>=0&&t<=i.children.length?t:i.children.length,u=e[2],d=R(u)&&typeof u.id=="string"?A.get(u.id):void 0,m;d&&d.parent?.namespace===i.namespace&&!S(i.namespace,i.name)?(A.delete(u.id),d.parent=i,m=d):m=C(u,i),i.dom.insertBefore(m.dom,i.children[n]?.dom??null),i.children.splice(n,0,m),i.namespace==="html"&&i.name==="textarea"&&r.onFieldSet?.(i.dom);return}case Q:{let t=Number(e[2]),n=i.children[t];if(!n)return c({reason:"record"});i.children.splice(t,1),n.dom.parentNode?.removeChild(n.dom),n.id!==void 0&&!n.refused?A.set(n.id,n):x(n);return}case ee:{if(!i.text)return c({reason:"record"});i.dom.data=String(e[2]??"").slice(0,T);let t=Y(i,i.parent);t&&r.onFieldSet?.(t);return}case ne:{if(i===b||i.text)return c({reason:"record"});let t=String(e[2]),n=e[4]??U;return n===te?N(i,t,e[3]):c(n===U||n===$?{reason:"attribute",element:i.name,name:n===$?`on${t}`:t}:{reason:"record"})}default:return c({reason:"record"})}};return{apply(e,a){if(!Array.isArray(e))return c({reason:"record"}),!0;try{for(let o=0;o<e.length;o+=1){if(a&&o%32===0&&a())return!1;K(e[o])}return!0}finally{for(let o of A.values())x(o);A.clear(),Z()}},get refused(){return f},get size(){return v},idOf:e=>E.get(e),elementOf(e){let a=p.get(e);return a&&!a.text&&a!==b?a.dom:void 0},dispose(){for(let e of b.children)x(e);for(b.children.length=0;s.firstChild;)s.removeChild(s.firstChild)}}}var de="@layer graview-motion, graview-region, graview-view, graview-theme;",le=new Set(["media","supports","container","keyframes","-webkit-keyframes"]),ce=new Set(["src","image-set","-webkit-image-set"]),ue={"}":"{",")":"(","]":"["};function G(s){let r=[],l=M(s);for(let[h,f]of l.entries())switch(f.type){case"bad-string":case"bad-url":case"url":case"CDO":case"CDC":return!1;case"delim":if(f.value==="\\")return!1;break;case"at-keyword":if(!le.has(f.value.toLowerCase()))return!1;break;case";":if(r.length===0)return!1;break;case"function":{let p=f.value.toLowerCase();if(ce.has(p))return!1;if(p==="url"){let E=l[h+1];if(E?.type!=="string"||!E.value.startsWith("#"))return!1}r.push("(");break}case"{":case"(":case"[":r.push(f.type);break;case"}":case")":case"]":if(r.pop()!==ue[f.type])return!1;break;default:}return r.length===0}function B(s,r){return r.trim()===""||!G(r)?"":`@layer ${s} {
2
2
  ${r}
3
3
  }`}function Ee(s,r){return s.trim()===""?G(r)?r:"":[de,B("graview-theme",s),B("graview-view",r)].filter(l=>l!=="").join(`
4
4
  `)}var fe=s=>typeof s=="string"&&/^#[A-Za-z_][A-Za-z0-9_.:-]{0,199}$/.test(s),V=["https:","mailto:","tel:"];function X(s){if(!(typeof s!="string"||s.length>2e3||/[\s<>"]/.test(s.trim())||s.trim()!==s))try{let r=new URL(s);return!V.includes(r.protocol)||r.protocol==="https:"&&(r.hostname===""||r.username!==""||r.password!=="")?void 0:r.href}catch{return}}function ke(s){let r=new Set,l=h=>{if(typeof h!="string"||!/^(https|mailto|tel):/i.test(h))return;let f=X(h);f&&r.add(f)};for(let h of[...s?.node?[s.node]:[],...s?.nodes??[]])for(let[f,p]of Object.entries(h))f==="id"||f==="kind"||(Array.isArray(p)?p.forEach(l):l(p));return r}function J(s){return(s??[]).flatMap(r=>{try{let l=new URL(r);return l.protocol==="https:"&&l.hostname!==""&&l.username===""&&l.password===""?[l.origin]:[]}catch{return[]}})}function we(s,r){if(fe(s))return s;let l=X(s);if(l&&(r.handed.has(l)||l.startsWith("https:")&&J(r.origins).includes(new URL(l).origin)))return l}function ve(s,r){let l=s.length>120?`${s.slice(0,119)}\u2026`:s,h="";try{h=new URL(s).protocol}catch{h=""}if(!V.includes(h))return`The link "${l}" was not drawn: a view links only to an https:, mailto: or tel: address.`;let f=J(r);return`The link "${l}" was not drawn: it is no address this view was handed. A view links out only to an address a record it was shown holds (a url field), as the record holds it${f.length>0?`, or an https: address on ${f.join(", ")}`:""}; a record or a place of this app is <a data-record> or <a data-place>.`}export{ge as a,de as b,B as c,Ee as d,ke as e,we as f,ve as g};
@@ -0,0 +1 @@
1
+ import{e as wn,f as bn,g as ie,h as vn,i as X,k as $e,l as De,q as On,v as de,x as xn}from"./chunk.PS765ODQ.js";import{$a as an,B as we,C as pe,Db as ze,Eb as cn,F as Ue,Fa as Re,H as We,Ia as nn,K as Je,L as Ye,La as tn,Na as rn,Ra as Se,Sa as Ae,Xb as I,Ya as on,_c as gn,ac as ln,b as Ce,bc as fn,c as Ie,d as Ve,dc as un,e as B,g as ye,h as _,ha as xe,i as Ke,ia as Qe,ic as pn,j as Ze,k as he,ka as Xe,l as qe,ld as yn,m as Be,md as hn,nc as mn,nd as Ee,o as _e,od as kn,p as fe,pd as je,q as Oe,ua as en,v as He,vb as sn,x as ue,yb as dn,z as ke}from"./chunk.ZDUKVXBI.js";var Gn=[{where:"settings[]",was:"honoured",now:"honored",since:"0.1.16"},{where:"pages",was:"overview",now:"scene",since:"0.1.17"}],H=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Rn(e,d=Gn){if(!H(e))return{document:e,respelled:[]};let n=[],t=e;for(let s of d)t=Le(t,s.where.split("."),s,"",n);return{document:t,respelled:n}}function Le(e,d,n,t,s){if(d.length===0){if(!H(e)||!Object.hasOwn(e,n.was))return e;s.push(`${t}${n.was}`);let{[n.was]:ae,...U}=e;return Object.hasOwn(e,n.now)?U:{...U,[n.now]:ae}}if(!H(e))return e;let[g,...j]=d,w=g.endsWith("[]"),x=w?g.slice(0,-2):g,N=e[x],ne=N;if(!w)ne=Le(N,j,n,`${t}${x}.`,s);else if(Array.isArray(N)){let ae=N.map((U,L)=>Le(U,j,n,`${t}${x}.${L}.`,s));ne=ae.some((U,L)=>U!==N[L])?ae:N}return ne===N?e:{...e,[x]:ne}}var Sn=new WeakMap;function An(e,d){Sn.set(e,d)}function qn(e){return Sn.get(e)}function zn(e){if(typeof e=="string")return{form:"string",light:e};if(typeof e!="object"||e===null)return;let d=e,n=w=>typeof d[w]=="string"?d[w]:void 0,t=n("light")??n("src");if(t===void 0)return;let[s,g,j]=[n("dark"),n("alt"),n("darkFallback")];return{form:n("light")!==void 0?"light":"src",light:t,...s!==void 0?{dark:s}:{},...g!==void 0?{alt:g}:{},...j!==void 0?{darkFallback:j}:{}}}function Xn(e,d){let n=e.brand??{},t=n.ground,s=n.accent?je(n.accent,t):void 0;t&&kn(s?.ok?s.schemes:Ee(t),n.accent)&&(d.push(De("brand","brand.ground","words would not read on that page background, so the app keeps Graview's","pick a lighter ground for the light scheme, a darker one for the dark")),t=void 0,s=n.accent?je(n.accent):void 0),s&&!s.ok&&d.push(De("brand","brand.accent",`that accent cannot make a readable brand, so the app keeps Graview's colors: ${s.why}`,"pick a color further from orange-red, or a darker one"));let g=zn(n.logo),j=n.name??e.name,w=n.typography?Object.fromEntries(Object.entries(n.typography).filter(([,x])=>typeof x=="string"&&hn(x)===null).map(([x,N])=>[x,yn(N)])):void 0;return{name:j,schemes:s?.ok?s.schemes:t?Ee(t):gn,...n.currency?{currency:n.currency}:{},...n.locale?{locale:n.locale}:{},...n.timeZone?{timeZone:n.timeZone}:{},...g?{logo:g.dark||g.darkFallback==="invert"?{light:g.light,...g.dark?{dark:g.dark}:{darkFallback:"invert"}}:g.light,logoAlt:g.alt??j}:{},...n.favicon?{favicon:n.favicon}:{},...e.description?{subtitle:e.description}:{},...n.subtitle===!1?{subtitleDrawn:!1}:{},...w?{typography:w}:{},...n.shape?{shape:n.shape}:{},...n.accents?{accents:n.accents}:{},...n.scheme?{scheme:n.scheme}:{},...n.views&&(n.views.css||n.views.motion||n.views.fonts?.length)?{views:{...n.views.css?{css:n.views.css}:{},...n.views.motion?{motion:n.views.motion}:{},...n.views.fonts?.length?{fonts:n.views.fonts}:{}}}:{}}}function En(e){let{currency:d,locale:n,timeZone:t}=e.brand??{};return{...d?{currency:d}:{},...n?{locale:n}:{},...t?{timeZone:t}:{}}}var Mn=Symbol.for("@graview/core:typed-field"),jn=(e,d)=>(/^(phone|place|duration)$/.test(d)&&(pe(e)[Mn]=d),e),$n=/^(?=(?:\D*\d){3})\+?[\d ()./-]+(?: *(?:ext\.?|x|#) *\d+)?$/i;function Dn(e){let d=_().check(B(300),ke(t=>tn(t,e)!==void 0,`a record of ${e.kinds.join(" or ")} in ${e.address}, as "<kind>:<id>"`)),n=e.cardinality==="one"?d:fe(d).check(B(200));return rn(e.description?n.check(we(e.description)):n,e)}var Ln="graview-compiled@1";function Nn(e,d){return e.find(([n,t])=>n!==ee&&"ref"in t&&(t.ref==="*"||t.ref.includes(d)))?.[0]}var ee="id",me=e=>typeof e=="string"&&/^\$[A-Za-z][A-Za-z0-9]*$/.test(e)?e.slice(1):void 0;function Pn(e){let d=Object.entries(e.fields),n=t=>["name","title","label"].find(s=>t.some(([g])=>g===s))??t[0]?.[0];return n(d.filter(([,t])=>t.required&&(t.type==="string"||t.type==="text")))??n(d.filter(([,t])=>t.type==="string"))}function Tn(e,d,n){let t;switch(e.type){case"string":case"place":t=_().check(B(500));break;case"phone":t=_().check(B(40),ye($n,"a phone number"));break;case"text":t=_().check(B(2e4)),e.format&&(pe(t)[Symbol.for("@graview/core:markdown")]=1);break;case"number":case"integer":case"duration":{let g=e.min??(e.type==="duration"?0:void 0),j=[...e.type==="number"?[]:[qe()],...g===void 0?[]:[Ie(g)],...e.max===void 0?[]:[Ce(e.max)],...e.step===void 0?[]:[Ve(e.step)]];t=j.length>0?he().check(...j):he();break}case"boolean":t=Be();break;case"date":t=_().check(ye(We,"a date like 2026-10-02, or a month (2016-05) or a year (2006) alone"));break;case"datetime":t=_().check(ke(Je,"a date and time like 2026-10-02T14:30:00Z"));break;case"enum":t=He(e.options),e.multiple&&(t=fe(t).check(B(e.options.length)));break;case"list":t=fe(e.of==="number"?he():e.of==="date"?_().check(ye(Ue)):e.of==="image"||e.of==="video"||e.of==="file"?Re(e.of):_().check(B(500))).check(B(200));break;case"image":case"video":case"file":t=Re(e.type);break;case"app-link":t=nn();break;case"url":t=Ze();break;case"email":t=Ke();break}let s=e.type==="number"||e.type==="integer";return jn(t,s&&e.format==="duration"?"duration":e.type),e.collaborative!==void 0&&(e.type==="text"||e.type==="string")&&(pe(t)[Symbol.for("@graview/core:collaborative")]=e.collaborative?1:0),e.description&&(t=t.check(we(e.description))),s&&(e.format==="money"||e.format==="percent"||!e.format&&e.unit)&&pn(t,{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}),d?ue(t):t}var ge=e=>{throw new I(`there is no record "${e}"`,"invalid")},Cn=(e,d)=>"field"in e?Tn(e.field,e.optional,d):"ref"in e?mn(e.ref):ue(_e()),In=new WeakMap;var Pe=(e,d)=>H(d)&&Object.keys(e??{}).length===Object.keys(d).length&&Object.keys(e??{}).every(n=>Object.hasOwn(d,n));function Rt(e,d={}){let n=H(e)?e.format:void 0;if(n!==Ln)return{ok:!1,findings:[$e("compiled-format","format",n===void 0?"this is not a compiled Graview app":`this compiled app is ${JSON.stringify(n)}, and this build reads ${Ln}`,"compile the document instead")]};let t=e,s=Rn(t.document).document,g=s===t.document?t:{...t,document:s},j=H(s)&&typeof s.name=="string"&&H(s.kinds)&&Pe(s.kinds,g.kinds)&&Pe(s.acts,g.acts)&&Pe(s.rules,g.rules)&&Array.isArray(g.edges)&&Array.isArray(g.findings),w={ok:!1,findings:[$e("compiled-shape","","this compiled app's parts do not match its document","compile the document instead")]};if(!j)return w;try{return Vn(g,d)}catch{return w}}function Vn(e,d={}){let{document:n}=e,t=n.brand?.timeZone,s=d.today??(()=>Ye(t)),g={...n.brand?.locale?{locale:n.brand.locale}:{},...t?{timeZone:t}:{}},j=new Map(e.edges.map(([y,o])=>[y,o])),w=new Map;for(let[y,o]of Object.entries(n.kinds)){let R=e.kinds[y]?.computed,v=Ae(o.edges),$=new Map(Object.entries(o.fields).flatMap(([z,O])=>O.type==="enum"?[[z,O.optionLabels??{}]]:[]));w.set(y,{fields:new Set([...Object.keys(o.fields),...v.keys()]),edges:new Map(Object.entries(Se(o.edges)).map(([z,O])=>[z,O.cardinality??"many"])),...R?{computed:new Map(R)}:{},...v.size>0?{linked:v}:{},...$.size>0?{choices:$}:{}})}e.facts&&w.set(bn,{computed:new Map(e.facts)});let x=En(n),N=y=>({from:y.from,via:y.via,sourceEnd:y.sourceEnd,back:y.back,values(o,R,v){let $={};for(let[z,O]of y.set)if("value"in O)$[z]=O.value;else try{let P=X(O.expr,{graph:o,subject:R,kinds:w,bindings:{to:v},today:s(),...g});(P===null||typeof P!="object"||Array.isArray(P))&&($[z]=P)}catch(P){if(!(P instanceof ie))throw P}return $}}),ne=new Map,ae=Object.entries(n.kinds).map(([y,o])=>{let R={};for(let[r,i]of Object.entries(o.fields))R[r]=Tn(i,!i.required,x),i.repeats&&(R[on(r)]=ue(an()));for(let[r,i]of Ae(o.edges))R[r]=ue(Dn(i));let{label:v,describe:$,durations:z}=e.kinds[y]??{},O=Object.entries(o.computed??{}).map(([r,i])=>[r,typeof i=="string"?{expr:i}:i]),P=Object.hasOwn(o.fields,"label")&&!o.fields.label.label&&!/\{\s*label\b/.test(o.label??`{${Pn(o)??""}}`),te=Object.fromEntries([...P?[["label","Label"]]:[],...Object.entries(o.fields).filter(([,r])=>r.label).map(([r,i])=>[r,i.label]),...O.filter(([,r])=>r.label).map(([r,i])=>[r,i.label])]),J=Object.keys(te).length>0,D=Object.entries(o.fields).filter(([,r])=>r.type==="enum"&&(r.optionLabels&&Object.keys(r.optionLabels).length>0||r.multiple)),m=r=>i=>typeof i=="string"&&r.optionLabels&&Object.hasOwn(r.optionLabels,i)?r.optionLabels[i]:Qe(String(i)),C=Object.fromEntries(D.map(([r,i])=>[r,i.multiple?E=>Array.isArray(E)?E.map(m(i)).join(", "):m(i)(E):m(i)])),V=D.length>0,K=Object.fromEntries(Object.entries(o.fields).filter(([,r])=>r.default!==void 0).map(([r,i])=>[r,i.default]));ne.set(y,K);let W=Object.fromEntries(Object.entries(Se(o.edges)).map(([r,{renamedFrom:i,...E}])=>[r,E])),Z=Object.entries(o.fields).flatMap(([r,i])=>i.aliases?[[r,i.aliases]]:[]),T=r=>o[r]?{[r]:o[r]}:{};return Xe(y,{fields:Oe(R),edges:W,...T("plural"),...T("noun"),...T("aliases"),...Z.length>0?{fieldAliases:Object.fromEntries(Z)}:{},...T("description"),...v?{label:r=>de(v,{node:r,kinds:w,today:s(),money:x})||r.id}:{},...$?{describe:r=>de($,{node:r,kinds:w,today:s(),money:x})}:{},...T("lifecycle"),...T("figure"),...T("fieldRoles"),...T("people"),archives:o.archives,...o.tidying?{tidying:o.tidying}:{},...O.length>0?{computed:Object.fromEntries(O.map(([r,i])=>[r,Kn(i,z?.includes(r)??!1,x)??o.computed[r]]))}:{},...J||V||o.glance||o.page?{display:{...J?{labels:te}:{},...V?{format:C}:{},...o.glance?{glance:[...o.glance]}:{},...o.page?{page:o.page}:{}}}:{},...Object.keys(K).length>0?{defaults:K}:{},...e.kinds[y]?.keptInStep?{keptInStep:e.kinds[y].keptInStep}:{},...e.kinds[y]?.derives?{derives:N(e.kinds[y].derives)}:{}})}),U=sn(ae,n.computed);function L(y){return U.tryDefinition(y.kind)?.label?.(y)??y.id}let Te=y=>({id:"",kind:y,...ne.get(y)}),Ge=[];for(let[y,o]of Object.entries(n.acts??{})){let R=e.acts[y],{title:v,effects:$,guard:z,refusal:O,destructive:P,idempotent:te,creates:J,connects:D,severs:m,writes:C,writesOther:V,sets:K}=R,W={};for(let c of $)"through"in c&&(W[c.through]=[...new Set([...W[c.through]??[],...Object.keys(c.set)])]);let Z=new Map(R.args),T={};for(let[c,S]of Z)T[c]=Cn(S,x);let r=[o.on??[]].flat(),i=new Map(R.exprs),E=$.find(c=>"create"in c),Y=(c,S,l,b=null)=>{if(H(c)&&"expr"in c)return X(i.get(c.expr),{graph:l,subject:b,kinds:w,bindings:S,args:S,today:s(),...g});let h=me(c);return h===void 0?typeof c=="string"&&c.startsWith("$$")?c.slice(1):c:h==="now"?new Date().toISOString():h==="today"?s():S[h]},ce=(c,S)=>{if(!E)return"";let l=n.kinds[E.create].fields,b=Te(E.create),h=[];for(let[A,le]of Object.entries(E.set??{})){try{b[A]=Y(le,c,S)??b[A]}catch{}let se=me(le);se&&c[se]!==void 0&&h.push(A)}let G=L(b).trim(),re=h.filter(A=>b[A]!==!1&&l[A].type!=="text"&&!(/[^]{41}/.test(b[A])||/ .*[.!?]$/.test(b[A])&&!/[ .][A-Z]\w{0,3}\.$/.test(b[A]))&&L({...b,[A]:void 0}).trim()===G).map(A=>b[A]===!0?l[A].label??xe(A):On(b[A],l[A].format,s(),[],x));return G&&re.length>0?`${G} (${re.join(", ")})`:G};Ge.push(un(y,{input:Oe(T),title:v,...o.description?{description:o.description}:{},...o.fromTheOtherEnd?{fromTheOtherEnd:o.fromTheOtherEnd}:{},...Z.has(ee)?{subject:{kinds:r.length>0?r:"*",arg:ee}}:{},...P?{destructive:!0}:{},...te?{idempotent:!0}:{},...JSON.stringify(o).includes('"$me"')?{doneAsMe:!0}:{},...J.length>0?{creates:J}:{},...D.length>0?{connects:D}:{},...m.length>0?{severs:m}:{},writes:C,...Object.keys(V).length>0?{writesOther:V}:{},...Object.keys(W).length>0?{writesLinked:W}:{},...Object.keys(K).length>0?{sets:K}:{},...z?{allowedOn:(c,S)=>{let l=c.getNode(S);if(!l||r.length>0&&!r.includes(l.kind))return!1;try{return X(z,{graph:c,subject:l,kinds:w,bindings:{},today:s(),...g})===!0}catch{return!1}}}:{},describe:(c,S)=>{let l=typeof c[ee]=="string"?S.getNode(c[ee]):void 0,b=l?L(l):ce(c,S);return b?`${v}: ${b}`:v},apply(c,S){let l=c.graph,b=typeof S[ee]=="string"?S[ee]:void 0,h=b?l.getNode(b):void 0;if(b&&!h&&ge(b),h&&r.length>0&&!r.includes(h.kind))throw new I(`"${v}" acts on ${r.join(" or ")}, not on ${en(h.kind)}`,"invalid");let G={};for(let[a,p]of Object.entries(S))p!==void 0&&(G[a]=p);if(z&&h){let a;try{a=X(z,{graph:l,subject:h,kinds:w,bindings:G,args:G,today:s(),...g})}catch(p){throw p instanceof ie?new I(`"${v}" could not be judged: ${p.sentence}`):p}if(a!==!0)throw new I(O?de(O,{node:h,kinds:w,graph:l,bindings:G,args:G,today:s(),money:x}):`"${v}" is not allowed for ${L(h)} right now`)}let re=new Map,A=a=>l.has(a)||[...re.values()].includes(a),le=new Set,se=a=>{let p=dn(a);le.has(p)||(le.add(p),c.removeEdge(a))},ve=(a,p,f)=>{let u=a===void 0?void 0:n.kinds[a],k=u?.fields[p];if(k?.required){let M=k.label??xe(p);throw new I(`"${v}" cannot clear ${M}${f?` of ${L(f)}`:""}: every ${u.noun??a} has one`,"invalid")}},oe=(a,p)=>{let f=me(a);if(f==="subject")return b;if(f==="me"){let u=c.me;if(u&&n.kinds[l.getNode(u)?.kind]?.people)return u;throw new I(`"${v}" is done as you, and you have no record here`)}if(re.has(f))return re.get(f);try{return Y(a,G,l,p??h??null)}catch(u){throw u instanceof ie?new I(`"${v}" could not work out a value: ${u.sentence}`):u}};for(let a of $)if("create"in a){let p=n.kinds[a.create],f=Te(a.create);for(let[q,Q]of Object.entries(a.set??{})){let Ne=Q===null?ve(a.create,q):oe(Q,void 0);Ne!==void 0&&(f[q]=Ne)}let u=Pn(p),k=String((u&&f[u])??a.create),M=fn(k,a.create,f,(q,Q)=>ln(n.policy?.sees,q,Q)),F=c.freshId(M?a.create:k,a.create,f);c.addNode({...f,id:F}),a.as&&re.set(a.as,F)}else if("connect"in a||"sever"in a){let p="connect"in a?a.connect:a.sever,f=String(oe(a.from,void 0)??""),u=String(oe(a.to,void 0)??"");if(A(f)||ge(f),A(u)||ge(u),"connect"in a){if(j.get(p)?.cardinality==="one")for(let k of l.out(f,p))k.id!==u&&se({kind:p,from:f,to:k.id});l.out(f,p).some(k=>k.id===u)||c.addEdge({kind:p,from:f,to:u})}else{let k=[l.getNode(f),l.getNode(u)];if(k[0]&&k[1]&&!l.out(f,p,{archived:"all"}).some(M=>M.id===u))throw new I(`"${v}" has nothing to take away: ${L(k[0])} is not linked to ${L(k[1])} that way`);se({kind:p,from:f,to:u})}}else if("through"in a){if(!h)throw new I(`"${v}" carries a change to linked records, and has no record to start from`,"invalid");let f=j.get(a.through)?.from.includes(h.kind)??!0?l.out(h.id,a.through):l.in(h.id,a.through);for(let u of f){let k={};for(let[M,F]of Object.entries(a.set)){let q;if(me(F)==="to")q=u.id;else if(H(F)&&"expr"in F)try{q=X(i.get(F.expr),{graph:l,subject:h,kinds:w,bindings:{...G,to:u},args:G,today:s(),...g})}catch(Q){throw Q instanceof ie?new I(`"${v}" could not work out a value for ${L(u)}: ${Q.sentence}`):Q}else q=oe(F,void 0);F===null?k[M]=ve(u.kind,M,u):q!==void 0&&(k[M]=q)}Object.keys(k).length>0&&c.patchNode(u.id,k)}}else if("set"in a){let p=String(oe(a.target??"$subject",void 0)??""),f=l.getNode(p);!f&&!A(p)&&ge(p);let u={};for(let[k,M]of Object.entries(a.set))if(M===null)u[k]=ve(f?.kind,k,f);else{let F=oe(M,f);F!==void 0&&(u[k]=F)}Object.keys(u).length>0&&c.patchNode(p,u)}else if("remove"in a){let p=String(oe(a.remove,void 0)??"");l.has(p)||ge(p),c.removeNode(p)}else if("replace"in a&&h){let p=S.to;for(let f of a.replace){let u=j.get(f)?.from.includes(h.kind)??!0;for(let k of u?l.out(h.id,f):l.in(h.id,f))f===a.keep&&k.id===p||se(u?{kind:f,from:h.id,to:k.id}:{kind:f,from:k.id,to:h.id})}}}}))}let Me=[];for(let[y,o]of Object.entries(n.rules??{})){let{title:R,require:v,when:$,says:z,covers:O}=e.rules[y],P=o.repairs??[],te=(D,m,C=s(),V)=>{let K=[],W={graph:D,subject:m,kinds:w,today:C,...g,...V?{linked:V}:{},onUnread:i=>K.push(i)},Z,T=[];try{if($&&X($,W)!==!0)return[];if(O&&m?(T=xn(D,m,O),Z=T.length===0):Z=X(v,W)===!0,!Z&&K.length>0)throw new ie(`it reads ${wn(K[0])}`,0)}catch(i){throw i instanceof vn?new cn(i.sentence):i instanceof ie?new Error(i.sentence):i}if(Z)return[];let r=P.flatMap(i=>{let E=n.acts?.[i.act],Y={},ce=m&&E?.on&&E.fromTheOtherEnd&&![E.on].flat().includes(m.kind)?Nn(e.acts[i.act].args,m.kind):void 0;ce?Y[ce]=m.id:m&&(E?.on||/^(edit|remove|archive|unarchive|merge|skip|detach|split)-/.test(i.act))&&(Y[ee]=m.id);for(let[l,b]of Object.entries(i.args??{}))Y[l]=me(b)==="subject"?m?.id:b;let S=(E?e.acts[i.act].args:[]).filter(([l,b])=>b.required&&Y[l]===void 0).map(([l])=>l);return[{mutation:i.act,label:i.label??(ce?E.fromTheOtherEnd:E?.title)??i.act.replace(/-/g," "),args:Y,...S.length>0?{missing:S}:{}}]});return O&&m?T.map(i=>({invariant:y,subjectId:m.id,label:R,message:z?de(z,{node:m,kinds:w,graph:D,today:C,money:x,bindings:{[m.kind]:m,[i.kind]:i}}):`${L(m)}: ${R} \u2014 ${L(i)}`,nodeIds:[m.id,i.id],repairs:r})):[{invariant:y,...m?{subjectId:m.id}:{},label:R,message:z?de(z,{node:m,kinds:w,graph:D,today:C,money:x}):m?`${L(m)}: ${R}`:R,nodeIds:m?[m.id]:[],repairs:r}]},J={label:R,shape:{over:o.over,require:v,...O?{covers:O}:{},when:$,says:z,declared:n.kinds,money:x,kinds:w,today:s},judgment:{...o.require?{require:o.require}:{},...o.covers?{covers:o.covers}:{},...o.when?{when:o.when}:{},...o.says?{says:o.says}:{}},...o.description?{description:o.description}:{},...P.length>0?{repairs:P.map(D=>D.act)}:{}};Me.push(o.over==="graph"?ze(y,{scope:"graph",...J,evaluate:({graph:D,today:m,context:C})=>te(D,null,m,C?.linked)}):ze(y,{scope:{kind:o.over},...J,evaluate:({graph:D,subject:m,today:C,context:V})=>te(D,m,C,V?.linked)}))}let Fe=n.policy&&{...n.policy,...n.roles?{roles:n.roles}:{}},be={name:n.name,schema:U,mutations:Ge,invariants:Me,...Fe?{policy:Fe}:{},...e.brand?{brand:e.brand}:{},...n.modules?{modules:n.modules}:{},...n.lenses?{lenses:n.lenses}:{},...n.pages?{pages:n.pages}:{},...n.settings?{settings:n.settings}:{},...n.connections?{connections:n.connections}:{},...n.forms?{forms:n.forms}:{},...n.publishing?{publishing:n.publishing}:{},...n.tidying?{tidying:n.tidying}:{},...n.purpose?{purpose:n.purpose}:{},...e.viewSpecs?{viewSpecs:e.viewSpecs}:{},...e.home?{home:e.home}:{},version:n.version??1};return An(be,n),In.set(be,e),{ok:!0,app:be,document:n,findings:e.findings,sights:n.policy?.sees,kinds:w}}function Kn(e,d,n){let t=d||e.format==="duration",s=e.format==="money"||e.format==="percent"||!e.format&&e.unit!==void 0;if(!(!t&&!s))return{...e,...t?{as:"duration"}:{},...s?{amount:{...n,...e.format?{format:e.format}:{},...e.unit?{unit:e.unit}:{},...e.places===0?{places:0}:{}}}:{}}}export{H as a,Rn as b,qn as c,Xn as d,Ln as e,ee as f,me as g,Pn as h,Rt as i,Vn as j};
@@ -1,2 +1,2 @@
1
- import{b as Ve}from"./chunk.NKUNCQB3.js";import{c as Be,d as Ie,f as Ge}from"./chunk.CHG522KL.js";import{e as Re,f as Fe,k as Me,l as ne,n as Oe}from"./chunk.IRPMGHZN.js";import{f as Ae}from"./chunk.36FKQJFM.js";import{d as z,e as Ce,k as te}from"./chunk.YIDNZTON.js";import{a as je,d as Pe}from"./chunk.QILGAV7H.js";import{Ac as ye,C as J,L as ce,Md as ke,cd as we,ea as de,ed as be,ee as xe,gc as he,gd as $e,ha as U,ia as ue,la as H,ma as W,na as me,oa as Q,oe as Se,pa as pe,rd as Z,sa as fe,sd as ve,ta as ge,va as _,xe as De,zc as ee}from"./chunk.IUVRJDL3.js";function Ye(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=J(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=J(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(t,e,n){let o=Ye(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:je(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${ge(r,n)}`}),a}function q(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function re(t,e,n,o,r=E(t.schema,n.kind,o)){return Ne(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ne(t,e,n,o,r=E(t.schema,n.kind,o)){let a=Ke(t.schema,t.allMutations(),n.kind,o,r),s=q(n,o,r),p=_(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,G,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{he(t.graph,c,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:G??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ke(t,e,n,o,r=E(t,n,o)){let a=Te(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Te(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&ee(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!ee(t,a).includes(n)||!ye(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var se=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Je(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?W(t.tryDefinition(c.kind),c):c[w],G=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:W(t.tryDefinition(c.kind),c),group:se(w,n.rowGroup),ref:se(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:W(t.tryDefinition(c.kind),c),group:se(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:G,columns:V,cells:A}}function He(t,e,n){let{rows:o,columns:r,cells:a}=Je(t,e,n),s=(i,v)=>Q(t,i,v),p=i=>Q(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:W(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=W(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ke(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=ve(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),G=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>G.get(P.columnId)-G.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function oe(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Oe(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Fe(typeof a[0]?.t=="string"?a:Re(a),p)}function X(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(_(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${X(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>X(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>ue(s.value))};default:return{...a,input:"answer"}}}function Ee(t,e,n){let o=Ie(t,e,n),r=t.schema,a=Be(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=me(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>X(r,p,m=>te(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>X(t,n,o=>te(t,e.act,o)))}}function Ze(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function _e(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=L(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Qe(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Qe=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,et=240,Ue=10,tt=1160,nt=40,qe=640,rt=3,st=t=>Math.max(1,Math.floor((Math.min(t,tt)-nt+Ue)/(et+Ue)));function ot(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??ce(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ve(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,G=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=G!==void 0?Ge(r,G):void 0;if(V)return{ok:!0,description:it(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=st(a),k=(l,h)=>oe(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=W(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let I=k(l,{slot:h}),[B,...O]=I,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:I,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?ne(m,A,l):l,T=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:T.map(I=>({t:"text",text:I.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,T)=>{let I=`${M}.${T+g}`;switch("problem"in u&&u.problem&&c.push({at:`${I}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?Pe(u.text):u.runs?ct(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${I}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${I}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>rt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(Y=>Y.value===D.value)??D).members.length}:{},items:D.members.map(Y=>f(Y,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=W(l,x);P={slug:x.id,title:h,kind:x.kind,address:xe(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(..._e(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?ne(m,A,x):x;for(let $ of Ce(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?Se(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ze(t,e,l.kind).map(d=>Ee(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=$e(d)?.light,u=$&&be($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...we(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let T=t.kindsKeptFrom(e),I=new Set([...r.pages?.hide??[],...T,...t.modules.disabledKinds]),B=De(m.kinds,r.pages?.order).filter(O=>!I.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=E(m,g,$),T=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?W(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${T.length} ${L(m,g,T.length)} in columns by ${fe(m.tryDefinition(g),$).toLowerCase()}.`});let I=u.map(y=>({column:y,items:T.filter(D=>q(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:I});let B=new Map;for(let y of T)for(let D of re(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=He(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Xe=a<qe?"phone":"wide",ae=P.kind===null?at(m,A):[],le={...v?{masthead:v}:{},...ae.length>0?{facts:ae}:{},place:P,seat:K,width:a,variant:Xe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...le,text:ie(le)}}}function it(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<qe?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ie(r)}}function at(t,e){let n=Me(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...Ae(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function L(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=pe(t,e);return de(r)}function ie(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${lt(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
1
+ import{b as Ve}from"./chunk.O5P6LXHF.js";import{c as Be,d as Ie,f as Ge}from"./chunk.53GQQETN.js";import{e as Re,f as Fe,k as Me,l as ne,n as Oe}from"./chunk.J7GH2CGV.js";import{f as Ae}from"./chunk.QMGBAKX6.js";import{d as z,e as Ce,k as te}from"./chunk.P3Z4ZCL3.js";import{a as je,d as Pe}from"./chunk.45OLF6BK.js";import{Ac as ye,C as J,L as ce,Md as ke,cd as we,ea as de,ed as be,ee as xe,gc as he,gd as $e,ha as U,ia as ue,la as H,ma as W,na as me,oa as Q,oe as Se,pa as pe,rd as Z,sa as fe,sd as ve,ta as ge,va as _,xe as De,zc as ee}from"./chunk.ZDUKVXBI.js";function Ye(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=J(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=J(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(t,e,n){let o=Ye(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:je(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${ge(r,n)}`}),a}function q(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function re(t,e,n,o,r=E(t.schema,n.kind,o)){return Ne(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ne(t,e,n,o,r=E(t.schema,n.kind,o)){let a=Ke(t.schema,t.allMutations(),n.kind,o,r),s=q(n,o,r),p=_(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,G,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{he(t.graph,c,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:G??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ke(t,e,n,o,r=E(t,n,o)){let a=Te(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Te(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&ee(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!ee(t,a).includes(n)||!ye(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var se=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Je(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?W(t.tryDefinition(c.kind),c):c[w],G=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:W(t.tryDefinition(c.kind),c),group:se(w,n.rowGroup),ref:se(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:W(t.tryDefinition(c.kind),c),group:se(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:G,columns:V,cells:A}}function He(t,e,n){let{rows:o,columns:r,cells:a}=Je(t,e,n),s=(i,v)=>Q(t,i,v),p=i=>Q(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:W(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=W(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ke(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=ve(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),G=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>G.get(P.columnId)-G.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function oe(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Oe(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Fe(typeof a[0]?.t=="string"?a:Re(a),p)}function X(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(_(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${X(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>X(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>ue(s.value))};default:return{...a,input:"answer"}}}function Ee(t,e,n){let o=Ie(t,e,n),r=t.schema,a=Be(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=me(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>X(r,p,m=>te(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>X(t,n,o=>te(t,e.act,o)))}}function Ze(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function _e(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=L(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Qe(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Qe=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,et=240,Ue=10,tt=1160,nt=40,qe=640,rt=3,st=t=>Math.max(1,Math.floor((Math.min(t,tt)-nt+Ue)/(et+Ue)));function ot(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??ce(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ve(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,G=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=G!==void 0?Ge(r,G):void 0;if(V)return{ok:!0,description:it(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=st(a),k=(l,h)=>oe(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=W(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let I=k(l,{slot:h}),[B,...O]=I,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:I,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?ne(m,A,l):l,T=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:T.map(I=>({t:"text",text:I.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,T)=>{let I=`${M}.${T+g}`;switch("problem"in u&&u.problem&&c.push({at:`${I}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?Pe(u.text):u.runs?ct(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${I}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${I}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>rt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(Y=>Y.value===D.value)??D).members.length}:{},items:D.members.map(Y=>f(Y,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=W(l,x);P={slug:x.id,title:h,kind:x.kind,address:xe(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(..._e(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?ne(m,A,x):x;for(let $ of Ce(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?Se(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ze(t,e,l.kind).map(d=>Ee(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=$e(d)?.light,u=$&&be($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...we(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let T=t.kindsKeptFrom(e),I=new Set([...r.pages?.hide??[],...T,...t.modules.disabledKinds]),B=De(m.kinds,r.pages?.order).filter(O=>!I.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=E(m,g,$),T=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?W(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${T.length} ${L(m,g,T.length)} in columns by ${fe(m.tryDefinition(g),$).toLowerCase()}.`});let I=u.map(y=>({column:y,items:T.filter(D=>q(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:I});let B=new Map;for(let y of T)for(let D of re(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=He(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Xe=a<qe?"phone":"wide",ae=P.kind===null?at(m,A):[],le={...v?{masthead:v}:{},...ae.length>0?{facts:ae}:{},place:P,seat:K,width:a,variant:Xe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...le,text:ie(le)}}}function it(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<qe?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ie(r)}}function at(t,e){let n=Me(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...Ae(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function L(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=pe(t,e);return de(r)}function ie(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${lt(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
2
2
  `)}function lt(t){let e=t.autoplay?"plays as a background, muted and looping, with no controls":"plays with the browser's controls";return`${t.text} (${t.field} of ${t.record}): ${t.source}${t.duration!==void 0?`, ${Math.round(t.duration)} s`:""}, ${t.poster?"with a poster":"no poster"}; ${e}${t.cover?", filling its box":""}; ${t.playable?"playable":`not playable: ${t.why??"it is not a video a browser plays"}`}.`}function ct(t){return t.map((e,n)=>(n===0?"":e.field===void 0&&t[n-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{E as a,q as b,re as c,Ne as d,Ke as e,Te as f,We as g,oe as h,_e as i,ot as j,ie as k};
@@ -0,0 +1,111 @@
1
+ import{b as W,e as Oe,f as Be,g as Fe,h as He,i as Ie,j as ze,k as Ke,l as ne,m as Ve}from"./chunk.FKSI5522.js";import{a as Ge,c as je}from"./chunk.V4GSVXSV.js";import{b as De}from"./chunk.L6BLZJ6K.js";import{a as Me,b as Pe,c as qe,d as j}from"./chunk.VNI6HZEF.js";import"./chunk.THLT6NVO.js";import{k as Te,l as Ee}from"./chunk.HIIYDKFC.js";import"./chunk.GYP3EF6Z.js";import"./chunk.KMFH26SS.js";import"./chunk.YF5GCOSZ.js";import"./chunk.F2BZ4SC4.js";import{e as Ce}from"./chunk.WAPY4RCS.js";import{m as $e}from"./chunk.JJSZLCNU.js";import{a as Re,b as Le}from"./chunk.JKX4J3KG.js";import{h as Ae}from"./chunk.JMXBMLKH.js";import{e as be,f as ke}from"./chunk.PVAYYFT2.js";import"./chunk.HJCQ6I3S.js";import"./chunk.QNFX5VHW.js";import"./chunk.UXW43HNW.js";import"./chunk.LG2BQ5LB.js";import"./chunk.L3ST2YKI.js";import"./chunk.7VCYVCYM.js";import{a as me}from"./chunk.2TTKQAWQ.js";import"./chunk.CJHCUHVN.js";import"./chunk.MFNWHXGL.js";import"./chunk.DCIYOZYP.js";import{a as ye,b as xe,j as Se}from"./chunk.IZKCTF2R.js";import"./chunk.G4JJXA63.js";import{a as fe}from"./chunk.TBY5IR7C.js";import"./chunk.JP33TNCH.js";import"./chunk.BIDL7GQD.js";import"./chunk.O5P6LXHF.js";import"./chunk.VGQDPEB5.js";import"./chunk.WIVNFOQR.js";import"./chunk.ONVYKLRX.js";import"./chunk.XOZU4OFA.js";import"./chunk.53GQQETN.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.7DCBIMOI.js";import"./chunk.GXK5PI7I.js";import"./chunk.DYPSFTRP.js";import"./chunk.WVUJXDXZ.js";import"./chunk.J7GH2CGV.js";import"./chunk.SMF5S4DQ.js";import"./chunk.XP4IVKKR.js";import"./chunk.R5YGW5ZX.js";import"./chunk.QMGBAKX6.js";import"./chunk.PS765ODQ.js";import"./chunk.MIE4TJRW.js";import{s as he}from"./chunk.DEBW4FH6.js";import"./chunk.RD2FSSLV.js";import"./chunk.OWHH7JDV.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import{l as ue}from"./chunk.P3Z4ZCL3.js";import"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import{G as Ne,t as U}from"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{G as Je,Va as ae,Wa as Y,_ as ge,ba as we,ia as I,j as le,ka as te,l as pe,m as ce,r as J,va as ve}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{L as ie,T as oe,Z as C,ma as re,oa as ee,qa as se,sa as de}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as Z}from"./chunk.AJZBJBMO.js";var o=Z(Je(),1);var e=Z(ge(),1),Ye=560;function Ue(t,n){let[d,g]=(0,o.useState)(0);return(0,o.useEffect)(()=>{let r=t.current;if(!r||!n){g(0);return}let i=0,c=()=>{i=0;let f=r.getBoundingClientRect().bottom;g([...r.querySelectorAll('[data-testid="kind-stop-table"] tbody tr[data-graview-pick]')].filter(S=>S.getBoundingClientRect().top>f-24).length)},b=()=>{i||(i=requestAnimationFrame(c))};c(),r.addEventListener("scroll",b,{passive:!0});let L=typeof ResizeObserver>"u"?null:new ResizeObserver(b);L?.observe(r);let R=r.querySelector('[data-testid="kind-stop-body"]');return R&&L?.observe(R),()=>{r.removeEventListener("scroll",b),L?.disconnect(),i&&cancelAnimationFrame(i)}},[t,n]),d}function Xe({narrow:t,at:n,children:d}){return t?(0,e.jsx)("div",{ref:n,className:"graview-kind-stop-scroll","data-testid":"kind-stop-scroll",children:d}):(0,e.jsx)(e.Fragment,{children:d})}function Ze(t){let[n,d]=(0,o.useState)(!1);return(0,o.useLayoutEffect)(()=>{let g=t.current;if(!g)return;let r=()=>{let c=g.getBoundingClientRect().width;c>0&&d(c<Ye)};if(r(),typeof ResizeObserver>"u")return;let i=new ResizeObserver(r);return i.observe(g),()=>i.disconnect()},[t]),n}var _e="as",et=(t,n)=>`graview:kind-seen:${t}:${n}`;function tt(t){try{return localStorage.getItem(t)}catch{return null}}function at(t,n){try{localStorage.setItem(t,n)}catch{}}var nt=(t,n)=>({...le(ce(t,!1),n),relation:null});function Mt({kind:t,members:n,flagged:d=[],label:g,retired:r=0}){let{store:i,brand:c,principal:b,views:L,view:R}=I(),{go:f}=Y(),S=te(),w=i.schema,$=w.tryDefinition(t),p=g??se(w,t),A=i.today()??ie(),l=n,N=(0,o.useId)(),h=(0,o.useMemo)(()=>Oe(w,t,l,A),[w,t,l,A]),u=R.within?.[_e]==="table"?{shape:"table"}:h,y=Re(R),T=u.shape==="table"&&!y.sort?Be(w,t):void 0,x=T?{...y,sort:T}:y,M=(0,o.useMemo)(()=>new Set(d),[d]),s=(0,o.useMemo)(()=>Ae(l,x,{schema:w,graph:i.graph,flagged:M,today:A}),[l,x,w,i,M,A,S]),k=(0,o.useMemo)(()=>ke(w,be(w,t)),[w,t]),D=L.arrangement?.()?.lists?.[t]?.filters,H=q=>f(Le(R,q)),V=(0,o.useMemo)(()=>({name:c?.name??"app",schema:w,...i.policy?{policy:i.policy}:{}}),[c,w,i]),_=JSON.stringify(Fe(t,u,x)),O=(0,o.useMemo)(()=>{let q=Se(JSON.parse(_),{app:V,sight:xe(V,b)});return ye(q)?void 0:q},[_,V,b]),G=u.shape!=="table"&&O!==void 0,z=(0,o.useRef)(null),P=Ze(z),[K,a]=(0,o.useState)(!1),m=(0,o.useId)(),B=(0,o.useMemo)(()=>fe(i,b),[i,b]),F=(l.length>1||r>0)&&!G?(0,e.jsx)($e,{schema:w,graph:i.graph,kind:t,arrangement:x,onChange:H,offers:k,...D?{filters:D}:{},kept:{shown:s.nodes.length,of:l.length},testId:"kind-arrange",chips:{nodes:l,flagged:M,today:A},...r>0?{past:{count:r,widen:()=>f(Ce(R,!0))}}:{}}):null,E=!!x.query||(x.filter?.length??0)>0,Q=(0,o.useRef)(null),X=Ue(Q,P&&!G);return(0,e.jsxs)("section",{ref:z,"aria-labelledby":N,className:"graview-kind-stop","data-testid":"kind-stop","data-graview-kind-stop":t,"data-graview-shape":u.shape,"data-graview-narrow":P||void 0,children:[(0,e.jsx)("style",{children:ct}),(0,e.jsxs)(Xe,{narrow:P,at:Q,children:[(0,e.jsx)(it,{kind:t,plural:p,count:l.length,headingId:N,description:$?.description,...P?{tools:{open:K,id:m,toggle:()=>a(q=>!q),narrowed:E}}:{}}),P&&K?(0,e.jsxs)("div",{id:m,className:"graview-kind-stop-tools","data-testid":"kind-stop-tools",role:"group","aria-label":`Find, filter and arrange the ${p.toLowerCase()}`,children:[F,l.length>0?(0,e.jsx)(We,{derived:h,shape:u,draft:O,author:!1}):null,(0,e.jsx)(Qe,{kind:t,plural:p})]}):null,(0,e.jsx)(rt,{kind:t,plural:p,members:l,today:A,arrangement:x,onArrange:H,compact:P}),P&&E&&!K?(0,e.jsxs)("p",{className:"graview-kind-stop-narrowed","data-testid":"kind-stop-narrowed",children:[(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[C(s.nodes.length)," of ",C(l.length)," shown"]})," ",(0,e.jsx)("button",{type:"button",className:"graview-kind-stop-link",onClick:()=>H({}),children:"Show all"})]}):null,P?null:F,l.length>0&&!P?(0,e.jsx)(We,{derived:h,shape:u,draft:O,author:B}):null,(0,e.jsx)("div",{className:"graview-kind-stop-body","data-testid":"kind-stop-body",children:l.length===0?(0,e.jsx)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-empty",children:"Nothing here yet."}):G?(0,e.jsx)(lt,{draft:O,nodes:l}):s.nodes.length===0?(0,e.jsxs)("p",{className:"graview-kind-stop-empty","data-testid":"kind-stop-none-kept",children:["None of the ",C(l.length)," ",p.toLowerCase()," ",x.query?`says \u201C${x.query}\u201D`:"is kept by these filters","."," ",(0,e.jsx)("button",{type:"button",className:"graview-kind-stop-link",onClick:()=>H({}),children:"Show them all"})]}):(0,e.jsx)(pt,{kind:t,nodes:s.nodes,groups:s.grouped?s.groups.map(q=>({key:q.key,label:q.label,nodes:q.nodes})):void 0,flagged:M,plural:p,arrangement:x})})]}),X>0?(0,e.jsxs)("button",{type:"button",className:"graview-kind-stop-below","data-testid":"kind-stop-below","data-graview-below":X,onClick:()=>Q.current?.scrollBy({top:Math.round(Q.current.clientHeight*.8),behavior:"smooth"}),children:[ee(w,t,X).replace(/^(\S+)\s/,"$1 more ")," below ",(0,e.jsx)("span",{"aria-hidden":"true",children:"\u2193"})]}):null]})}function Qe({kind:t,plural:n}){let{setSelection:d,setMenuAt:g}=I();return(0,e.jsx)("button",{type:"button",className:"graview-kind-stop-quiet","data-testid":"kind-stop-acts","aria-haspopup":"menu","aria-label":`What can be done with the ${n.toLowerCase()}`,onClick:r=>{let i=r.currentTarget.getBoundingClientRect();d([J(t)]),g({x:Math.round(i.left),y:Math.round(i.bottom+4),on:J(t)})},children:"Acts\u2026"})}function it({kind:t,plural:n,count:d,headingId:g,description:r,tools:i}){let{store:c}=I(),b=(0,o.useMemo)(()=>({about:[J(t)]}),[t]),{affordances:L}=Te(b),{apply:R,preview:f}=Ee(),S=(0,o.useMemo)(()=>{let v=u=>c.allMutations().find(y=>y.name===u.mutation)?.creates?.includes(t)??!1;return L.find(u=>!u.destructive&&!u.setsAside&&v(u))},[L,c,t]),[w,$]=(0,o.useState)(!1),[p,A]=(0,o.useState)(null),l=(0,o.useRef)(null),N=(0,o.useRef)(null);(0,o.useEffect)(()=>{let v=N.current;if(!v||v.closest('[data-testid="kind-stop"]')?.contains(document.activeElement))return;let u=!1;try{u=document.activeElement instanceof HTMLElement&&document.activeElement!==document.body&&document.activeElement.matches(":focus-visible")}catch{u=!0}u?delete v.dataset.graviewQuietFocus:v.dataset.graviewQuietFocus="",v.focus({preventScroll:!0})},[t]);let h=(v,u)=>{try{f(v,u),R(v,u),A(null),$(!1),requestAnimationFrame(()=>l.current?.focus())}catch(y){return A(ue(c.schema,c.allMutations(),y)),[]}};return(0,e.jsxs)("header",{className:"graview-kind-stop-head",children:[(0,e.jsxs)("div",{className:"graview-kind-stop-title",children:[(0,e.jsx)("h2",{id:g,ref:N,tabIndex:-1,"data-testid":"kind-stop-title",onKeyDown:v=>delete v.currentTarget.dataset.graviewQuietFocus,onBlur:v=>delete v.currentTarget.dataset.graviewQuietFocus,children:n}),(0,e.jsxs)("p",{"data-testid":"kind-stop-count",children:[ee(c.schema,t,d),r?` \xB7 ${r}`:""]})]}),(0,e.jsxs)("div",{className:"graview-kind-stop-acts",children:[S?(0,e.jsx)("button",{ref:l,type:"button",className:"graview-kind-stop-primary","data-testid":"kind-stop-primary","data-affordance":S.id,"aria-expanded":S.open.length>0?w:void 0,onClick:()=>{A(null),S.open.length===0?h(S):$(v=>!v)},children:S.label}):null,i?(0,e.jsx)("button",{type:"button",className:"graview-kind-stop-more-tools","data-testid":"kind-stop-tools-open","aria-expanded":i.open,"aria-controls":i.open?i.id:void 0,"aria-label":`Find, filter, arrange and act on the ${n.toLowerCase()}`,title:"Find, filter, arrange and acts","data-narrowed":i.narrowed||void 0,onClick:i.toggle,children:(0,e.jsx)("span",{"aria-hidden":"true",children:"\u22EF"})}):(0,e.jsx)(Qe,{kind:t,plural:n})]}),w&&S?(0,e.jsx)("div",{className:"graview-kind-stop-ask","data-testid":"kind-stop-ask","aria-label":S.label,role:"group",children:(0,e.jsx)(me,{affordance:S,onApply:v=>h(S,v),onCancel:()=>{$(!1),l.current?.focus()}})}):null,p?(0,e.jsx)("p",{role:"alert",className:"graview-kind-stop-failed","data-testid":"kind-stop-failed",children:p}):null]})}var ot=U.part((t,n)=>(0,e.jsx)(t.ProblemRows,{...n}),{what:"The problems",as:"li"});function rt({kind:t,plural:n,members:d,today:g,arrangement:r,onArrange:i,compact:c=!1}){let{store:b,brand:L,setSelection:R}=I(),f=b.schema,S=ae(),w=(0,o.useMemo)(()=>new Set(d.map(s=>s.id)),[d]),$=(0,o.useMemo)(()=>ze(S,w,s=>b.allInvariants().find(k=>k.name===s)?.label),[S,w,b]),p=(0,o.useMemo)(()=>Ke(f,t,d,g),[f,t,d,g]),A=et(Ne(L,f),t),[l]=(0,o.useState)(()=>tt(A));(0,o.useEffect)(()=>()=>at(A,new Date().toISOString()),[A]);let N=te(),h=(0,o.useMemo)(()=>l?Ve(b.log.all(),t,l,s=>b.graph.getNode(s)?.kind):null,[l,b,t,N]),[v,u]=(0,o.useState)(null),y=s=>i({...r,filter:[...(r.filter??[]).filter(k=>!s?.some(D=>D.key===k.key)),...s??[]]}),T=$.reduce((s,k)=>s+k.violations.length,0),x=[];if(p&&(p.overdue>0||p.soon>0)){let s=p.field;x.push((0,e.jsxs)("li",{"data-testid":"kind-stop-dates",children:[p.overdue>0?(0,e.jsxs)("button",{type:"button",className:"graview-kind-stop-fact","data-tone":"warn",onClick:()=>y(ne(p,"overdue",g)),"aria-label":`${C(p.overdue)} overdue \u2014 show only these`,children:[C(p.overdue)," overdue"]}):null,p.soon>0?(0,e.jsxs)("button",{type:"button",className:"graview-kind-stop-fact",onClick:()=>y(ne(p,"soon",g)),"aria-label":`${C(p.soon)} in the next 7 days \u2014 show only these`,children:[C(p.soon)," ",p.due?"due":""," in the next 7 days"]}):null,(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" by ",de(f.tryDefinition(t),s).toLowerCase()]})]},"dates"))}let M=(r.filter??[]).some(s=>s.key==="is"&&s.value==="flagged");if($.length>0&&c){let s=$.map(k=>k.label).join(", ");x.push((0,e.jsxs)("li",{className:"graview-kind-stop-problems-line","data-testid":"kind-stop-problems","data-graview-problems":T,children:[(0,e.jsxs)("span",{className:"graview-kind-stop-warn",children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"\u26A0 "}),T===1?"1 problem":`${C(T)} problems`]}),(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text graview-kind-stop-rules-said",title:s,children:[" ","\xB7 ",s]}),(0,e.jsx)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-only-problems","aria-pressed":M,"aria-label":M?`Show all the ${n.toLowerCase()}`:`Show only the ${n.toLowerCase()} with a problem`,onClick:()=>M?i({...r,filter:(r.filter??[]).filter(k=>!(k.key==="is"&&k.value==="flagged"))}):y([{key:"is",value:"flagged"}]),children:M?"Show all":"Show"})]},"problems"))}else $.length>0&&x.push((0,e.jsxs)("li",{"data-testid":"kind-stop-problems","data-graview-problems":T,children:[(0,e.jsxs)("span",{className:"graview-kind-stop-warn",children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"\u26A0 "}),T===1?"1 problem":`${C(T)} problems`]}),(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:[" in ",n.toLowerCase(),":"]}),(0,e.jsx)("ul",{className:"graview-kind-stop-rules",children:$.map(s=>(0,e.jsx)(st,{group:s,open:v===s.invariant,onToggle:()=>u(k=>k===s.invariant?null:s.invariant),onPick:k=>R([k])},s.invariant))}),(0,e.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-only-problems",onClick:()=>y([{key:"is",value:"flagged"}]),children:["Show only the ",n.toLowerCase()," with a problem"]})]},"problems"));if(h&&(h.added>0||h.changed>0)){let s=[h.added>0?`${C(h.added)} added`:"",h.changed>0?`${C(h.changed)} changed`:""].filter(Boolean);x.push((0,e.jsxs)("li",{"data-testid":"kind-stop-since",children:[(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["Since you last looked (",oe(l.slice(0,10)),"):"]})," ",s.join(", ")]},"since"))}return x.length===0?null:(0,e.jsx)("ul",{className:"graview-kind-stop-going-on","aria-label":`What is going on in the ${n.toLowerCase()}`,"data-testid":"kind-stop-going-on",children:x})}function st({group:t,open:n,onToggle:d,onPick:g}){let r=(0,o.useId)();return(0,e.jsxs)("li",{"data-graview-rule":t.invariant,children:[(0,e.jsxs)("button",{type:"button",className:"graview-kind-stop-rule","aria-expanded":n,"aria-controls":r,onClick:d,onPointerEnter:U.prefetch,onFocus:U.prefetch,children:[(0,e.jsx)("span",{"aria-hidden":"true",className:"graview-kind-stop-chevron","data-open":n||void 0,children:"\u203A"}),t.label," ",(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",C(t.violations.length)]})]}),n?(0,e.jsx)("ol",{id:r,className:"graview-kind-stop-problem-rows","data-testid":"kind-stop-problem-rows",children:(0,e.jsx)(o.Suspense,{fallback:null,children:(0,e.jsx)(ot,{violations:t.violations,pick:i=>{let c=i.subjectId??t.records[0]??i.nodeIds[0];c!==void 0&&g(c)}})})}):null]})}var dt={board:"Board",calendar:"Calendar",table:"Table"};function We({derived:t,shape:n,draft:d,author:g}){let{view:r}=I(),{go:i}=Y(),{keep:c}=Ge(je()),[b,L]=(0,o.useState)(!1),R=t.shape==="table"?[]:[t.shape,"table"];return!g&&R.length===0?null:(0,e.jsxs)("div",{className:"graview-kind-stop-shape","data-testid":"kind-stop-shape",children:[R.length>0?(0,e.jsx)("span",{role:"group","aria-label":"Show as",className:"graview-kind-stop-switch",children:R.map(f=>(0,e.jsx)("button",{type:"button","aria-pressed":n.shape===f,"data-testid":`kind-stop-as-${f}`,onClick:()=>i(pe(r,_e,f===t.shape?null:f)),children:dt[f]},f))}):null,g?(0,e.jsx)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-derived",children:d?`${d.said.replace(/\.$/,"")}, derived from the declaration`:"Derived from the declaration"}):null,d&&g?(0,e.jsx)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-keep",disabled:b,title:`Keep \u201C${d.title}\u201D as a lens: a place of its own`,onClick:()=>{L(!0),c(d).finally(()=>L(!1))},children:"Keep as a lens"}):null]})}function lt({draft:t,nodes:n}){let d=De(t.drawn);return(0,e.jsx)("div",{className:"graview-kind-stop-lens","data-graview-draft":t.lens.name,children:(0,e.jsx)(we,{mode:"scene",children:(0,e.jsx)(he,{kind:t.kind,view:t.title,children:(0,e.jsx)(d,{nodes:n,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})})}function pt({kind:t,nodes:n,groups:d,flagged:g,plural:r,arrangement:i}){let{store:c,views:b,view:L,selection:R,setSelection:f,setMenuAt:S,principal:w}=I(),{go:$}=Y(),p=c.schema,A=c.graph,l=(0,o.useMemo)(()=>(d?d.flatMap(a=>a.nodes):n).map(a=>a.id),[n,d]),N=Me(l),h=(0,o.useMemo)(()=>c.permittedMutations(w).some(a=>{let m=a.subject?.kinds;return m!==void 0&&(m==="*"||m.includes(t))}),[c,w,t]),v=(0,o.useRef)(null),u=a=>{N.choose(a),requestAnimationFrame(()=>{let m=N.list.current;((a[0]===void 0?null:m?.querySelector(`[data-graview-choose-box="${CSS.escape(a[0])}"]`))??m)?.focus({preventScroll:!0})})},y=N.chosen.length,T=b.lookup(t,{cardinality:"one",fidelity:"glyph"}),x=T!==void 0&&!ve(T)?T:void 0,M=a=>R.includes(a),s=ae(),k=(0,o.useMemo)(()=>He(p,t,n,A),[p,t,n,A]),[D,H]=(0,o.useState)(W);(0,o.useEffect)(()=>H(W),[i.query,i.filter?.length,i.sort?.by,i.group?.by]);let V=p.tryDefinition(t),_=a=>s.filter(m=>m.nodeIds.includes(a)||m.subjectId===a).map(m=>m.message),O=i.sort?.by,G=`${r}${i.sort?`, in order of ${k.find(a=>a.key===O)?.label.toLowerCase()??O}`:""}`,z=D,P=a=>{let m=re(V,a),B=g.has(a.id)?_(a.id):[];return(0,e.jsxs)("tr",{"data-graview-pick":a.id,tabIndex:-1,"data-graview-record":a.id,"data-flagged":B.length>0||void 0,...h?{"data-graview-choose":a.id}:{},children:[h?(0,e.jsx)("td",{className:"graview-choose-at",children:(0,e.jsx)("input",{...N.boxProps(a.id,m),onPointerEnter:j,onFocus:j})}):null,(0,e.jsxs)("th",{scope:"row",className:"graview-kind-stop-name",children:[x?(0,e.jsx)("div",{"data-graview-pick":a.id,className:"graview-kind-stop-own-row",children:(0,e.jsx)(x,{node:a,cardinality:"one",fidelity:"glyph",mode:"scene",selected:M(a.id),...B.length>0?{flagged:[a.id]}:{}})}):(0,e.jsx)("button",{type:"button","data-testid":"kind-stop-row-go",title:`Go to ${m}`,onClick:()=>$(nt(L,a.id)),children:m}),B.length>0?(0,e.jsxs)("span",{className:"graview-kind-stop-flag",title:B.join(" \xB7 "),children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"\u26A0"}),(0,e.jsx)("span",{className:"graview-kind-stop-hidden",children:`Problem: ${B.join(". ")}`})]}):null]}),k.map(F=>{let E=Ie(p,a,F,A);return(0,e.jsx)("td",{"data-label":F.label,"data-short":E.text.length>0&&E.text.length<=14||void 0,"data-empty":E.text?void 0:"",...E.title?{title:E.title}:{},children:E.text?(0,e.jsx)("span",{children:E.text}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("b",{"aria-hidden":"true",children:"\u2014"}),(0,e.jsx)("i",{className:"graview-kind-stop-hidden",children:"none"})]})},F.key)}),(0,e.jsx)("td",{className:"graview-kind-stop-row-acts",children:(0,e.jsx)("button",{type:"button","data-testid":"kind-stop-row-acts","aria-haspopup":"menu","aria-label":`What can be done with ${m}`,onClick:F=>{let E=F.currentTarget.getBoundingClientRect();f([a.id]),S({x:Math.round(E.left),y:Math.round(E.bottom+4),on:a.id})},children:(0,e.jsx)("span",{"aria-hidden":"true",children:"\u22EF"})})})]},a.id)},K=a=>{let m=a.slice(0,Math.max(0,z));return z-=m.length,m.map(P)};return(0,e.jsxs)("div",{className:"graview-kind-stop-table-at",...h?{...N.listProps,ref:a=>{v.current=a,N.list.current=a},tabIndex:-1,role:"group","aria-label":y>0?`${r}, ${y} chosen`:r,"data-graview-choosable":""}:{},children:[h?(0,e.jsx)("style",{children:Pe}):null,(0,e.jsxs)("table",{className:"graview-kind-stop-table","data-testid":"kind-stop-table",children:[(0,e.jsx)("caption",{className:"graview-kind-stop-hidden",children:G}),(0,e.jsx)("thead",{children:(0,e.jsxs)("tr",{children:[h?(0,e.jsx)("td",{className:"graview-choose-at graview-choose-all",children:(0,e.jsx)("input",{type:"checkbox",className:"graview-choose-box","data-testid":"kind-stop-choose-all","aria-label":`Choose all ${C(n.length)} ${r.toLowerCase()}`,checked:y>0&&y===n.length,ref:a=>{a&&(a.indeterminate=y>0&&y<n.length)},onPointerEnter:j,onFocus:j,onChange:()=>y===n.length?N.clear():N.choose(l)})}):null,(0,e.jsx)("th",{scope:"col","aria-sort":O==="label"?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:"Name"}),k.map(a=>(0,e.jsx)("th",{scope:"col","aria-sort":a.about==="field"&&a.key===O?i.sort?.direction==="desc"?"descending":"ascending":void 0,children:a.label},a.key)),(0,e.jsx)("th",{scope:"col",children:(0,e.jsx)("span",{className:"graview-kind-stop-hidden",children:"Acts"})})]})}),d?d.map(a=>z<=0?null:(0,e.jsxs)("tbody",{"data-graview-group":a.key,children:[(0,e.jsx)("tr",{className:"graview-kind-stop-group",children:(0,e.jsxs)("th",{scope:"rowgroup",colSpan:k.length+(h?3:2),children:[a.label," ",(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text",children:["\xB7 ",C(a.nodes.length)]})]})}),K(a.nodes)]},a.key||"-")):(0,e.jsx)("tbody",{children:K(n)})]}),h?(0,e.jsx)(qe,{store:c,chosen:N.chosen,principal:w,anchor:()=>v.current?.closest('[data-testid="kind-stop"]')??null,of:l.length,onChooseAll:()=>N.choose(l),onClear:N.clear,onActed:u}):null,n.length>D?(0,e.jsxs)("p",{className:"graview-kind-stop-more",children:[(0,e.jsxs)("span",{className:"graview-kind-stop-quiet-text","data-testid":"kind-stop-shown",children:[C(D)," of ",C(n.length)," shown"]})," ",(0,e.jsxs)("button",{type:"button",className:"graview-kind-stop-link","data-testid":"kind-stop-more",onClick:()=>H(a=>a+W),children:["Show ",C(Math.min(W,n.length-D))," more"]})]}):null]})}var ct=`
2
+ .graview-kind-stop{container-type:inline-size;box-sizing:border-box;height:100%;min-height:0;display:flex;flex-direction:column;gap:10px;padding:16px 18px 12px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius,12px);background:var(--graview-panel);color:var(--graview-ink);box-shadow:var(--graview-lift-low);overflow:auto;overscroll-behavior:contain}
3
+ [data-graview-map-panel] .graview-kind-stop{height:auto;padding:4px 6px 12px;border:0;box-shadow:none;background:none;overflow:visible}
4
+ .graview-kind-stop :focus-visible{outline:2px solid var(--graview-accent);outline-offset:2px}
5
+ .graview-kind-stop h2[data-graview-quiet-focus]:focus{outline:none}
6
+ .graview-kind-stop button{font:inherit;cursor:pointer}
7
+ .graview-kind-stop :is(.graview-kind-stop-more-tools,.graview-kind-stop-link,.graview-kind-stop-rule,.graview-kind-stop-name button,.graview-kind-stop-row-acts button,.graview-kind-stop-fact,.graview-kind-stop-switch button){box-shadow:none}
8
+ .graview-kind-stop-head{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px 16px}
9
+ .graview-kind-stop-title{flex:1 1 16rem;min-width:0}
10
+ .graview-kind-stop-title h2{margin:0;outline-offset:2px;font-size:var(--graview-text-heading);line-height:1.3;overflow-wrap:anywhere}
11
+ .graview-kind-stop-title p{margin:2px 0 0;font-size:.875rem;color:var(--graview-ink-muted);overflow-wrap:anywhere}
12
+ .graview-kind-stop-acts{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
13
+ .graview-kind-stop-primary,.graview-kind-stop-quiet{min-height:32px;padding:0 14px;border-radius:8px;font-size:.875rem}
14
+ .graview-kind-stop-primary{border:1px solid var(--graview-accent);background:var(--graview-accent);color:var(--graview-accent-ink);font-weight:600}
15
+ .graview-kind-stop-quiet{border:1px solid var(--graview-edge);background:transparent;color:var(--graview-ink)}
16
+ .graview-kind-stop-ask{flex:1 1 100%;min-width:0;padding:10px 12px;border:1px solid var(--graview-edge);border-radius:10px}
17
+ .graview-kind-stop-failed{flex:1 1 100%;margin:0;font-size:var(--graview-text-small);color:var(--graview-warn)}
18
+ .graview-kind-stop-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
19
+ .graview-kind-stop-going-on{list-style:none;margin:0;padding:0;display:grid;gap:6px;font-size:.875rem}
20
+ .graview-kind-stop-going-on>li{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;min-width:0}
21
+ .graview-kind-stop-fact{min-height:28px;padding:0 10px;border:1px solid var(--graview-edge);border-radius:999px;background:transparent;color:var(--graview-ink)}
22
+ .graview-kind-stop-fact[data-tone=warn],.graview-kind-stop-warn{color:var(--graview-warn);font-weight:600}
23
+ .graview-kind-stop-quiet-text{color:var(--graview-ink-muted)}
24
+ .graview-kind-stop-rules{list-style:none;margin:0;padding:0;flex:1 1 100%;display:grid;gap:2px}
25
+ .graview-kind-stop-rule{display:inline-flex;align-items:center;gap:6px;min-height:28px;max-width:100%;padding:0 6px;border:1px solid transparent;border-radius:7px;background:none;color:var(--graview-ink);text-align:left;overflow-wrap:anywhere}
26
+ .graview-kind-stop-rule:hover{border-color:var(--graview-edge)}
27
+ .graview-kind-stop-chevron{display:inline-block;width:.8em}
28
+ .graview-kind-stop-chevron[data-open]{transform:rotate(90deg)}
29
+ .graview-kind-stop-problem-rows{list-style:none;margin:2px 0 6px 18px;padding:0;max-width:44rem}
30
+ .graview-kind-stop-link{min-height:28px;padding:0 4px;border:0;background:none;color:var(--graview-accent);text-decoration:underline;text-underline-offset:2px}
31
+ .graview-kind-stop-link:disabled{opacity:.6;cursor:default}
32
+ .graview-kind-stop-shape{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;font-size:var(--graview-text-small)}
33
+ .graview-kind-stop-switch{display:inline-flex;border:1px solid var(--graview-edge);border-radius:8px;overflow:hidden}
34
+ .graview-kind-stop-switch button{min-height:28px;padding:0 12px;border:0;background:transparent;color:var(--graview-ink-muted)}
35
+ .graview-kind-stop-switch button+button{border-left:1px solid var(--graview-edge)}
36
+ .graview-kind-stop-switch button[aria-pressed=true]{background:color-mix(in srgb,var(--graview-accent) 16%,transparent);color:var(--graview-ink);font-weight:600}
37
+ .graview-kind-stop-body{flex:1 0 auto;min-width:0}
38
+ .graview-kind-stop-empty{margin:24px 0;color:var(--graview-ink-muted)}
39
+ .graview-kind-stop-lens{min-width:0}
40
+
41
+ .graview-kind-stop-table-at{min-width:0}
42
+ .graview-kind-stop-table{width:100%;border-collapse:collapse;font-size:.875rem}
43
+ .graview-kind-stop-table th,.graview-kind-stop-table td{padding:7px 8px;text-align:left;vertical-align:top;border-top:1px solid var(--graview-edge);overflow-wrap:break-word}
44
+ .graview-kind-stop-table td{color:var(--graview-ink)}
45
+ .graview-kind-stop-table td>span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
46
+ .graview-kind-stop-table td[data-short]{white-space:nowrap;font-variant-numeric:tabular-nums}
47
+ .graview-kind-stop-table thead th{border-top:0;font-size:var(--graview-text-small);font-weight:600;letter-spacing:.04em;color:var(--graview-ink-muted)}
48
+ .graview-kind-stop-name{font-weight:500;min-width:8rem;max-width:22rem}
49
+ .graview-kind-stop-name button{display:inline-block;min-width:24px;min-height:24px;padding:0;border:0;background:none;color:var(--graview-ink);font-weight:500;text-align:left;text-decoration:underline;text-decoration-color:var(--graview-edge);text-underline-offset:3px}
50
+ .graview-kind-stop-name button:hover{text-decoration-color:currentColor}
51
+ .graview-kind-stop-own-row{display:inline-block;max-width:100%;cursor:pointer}
52
+ .graview-kind-stop-flag{margin-left:6px;color:var(--graview-warn)}
53
+ .graview-kind-stop-group th{padding-top:12px;font-weight:600;color:var(--graview-ink)}
54
+ .graview-kind-stop-row-acts{width:1%;white-space:nowrap;text-align:right}
55
+ .graview-kind-stop-row-acts button{min-width:32px;min-height:28px;border:1px solid var(--graview-edge-bright,var(--graview-edge));border-radius:7px;background:none;color:var(--graview-ink);font-size:1.125rem;font-weight:700;line-height:1}
56
+ .graview-kind-stop-row-acts button:hover{background:color-mix(in srgb,var(--graview-ink) 8%,transparent)}
57
+ .graview-kind-stop-table td[data-empty] b{font-weight:400;color:var(--graview-ink-faint)}
58
+ .graview-kind-stop-table tr[data-graview-pick]{cursor:default}
59
+ .graview-kind-stop-more{margin:10px 0 0;font-size:.875rem}
60
+ .graview-kind-stop-table-at[data-graview-choosable]{outline:none}
61
+ [data-graview-choosable]:hover .graview-choose-all .graview-choose-box{opacity:1}
62
+ .graview-kind-stop-table .graview-choose-at{width:1%;padding-right:0;vertical-align:middle}
63
+ .graview-kind-stop-more-tools{position:relative;min-width:32px;min-height:32px;padding:0 8px;border:0;border-radius:8px;background:none;color:var(--graview-ink);font-size:1.125rem;line-height:1}
64
+ .graview-kind-stop-more-tools:hover,.graview-kind-stop-more-tools[aria-expanded=true]{background:color-mix(in srgb,var(--graview-ink) 8%,transparent)}
65
+ .graview-kind-stop-more-tools[data-narrowed]::after{content:"";position:absolute;top:8px;right:6px;width:7px;height:7px;border-radius:50%;background:var(--graview-accent)}
66
+ .graview-kind-stop-tools{display:grid;gap:8px;justify-items:start;padding:10px;border:1px solid var(--graview-edge);border-radius:10px}
67
+ .graview-kind-stop-tools>*{max-width:100%}
68
+ .graview-kind-stop-problems-line{flex-wrap:nowrap!important}
69
+ .graview-kind-stop-problems-line .graview-kind-stop-warn{flex:0 0 auto;white-space:nowrap}
70
+ .graview-kind-stop-rules-said{flex:1 1 auto;min-width:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
71
+ .graview-kind-stop-problems-line .graview-kind-stop-link{flex:0 0 auto}
72
+ .graview-kind-stop-narrowed{margin:0;font-size:.875rem}
73
+ .graview-kind-stop[data-graview-narrow]{overflow:hidden}
74
+
75
+ .graview-kind-stop[data-graview-narrow]{height:auto;max-height:100%;flex:0 1 auto;margin-bottom:auto}
76
+ .graview-kind-stop-scroll{flex:1 1 auto;min-height:0;padding:4px;margin:-4px;display:flex;flex-direction:column;gap:10px;overflow:auto;overscroll-behavior:contain}
77
+ [data-graview-map-panel] .graview-kind-stop-scroll{overflow:visible}
78
+ [data-graview-map-panel] .graview-kind-stop[data-graview-narrow]{overflow:visible}
79
+ .graview-kind-stop-below{align-self:stretch;flex:0 0 auto;margin:0 -16px -12px;min-height:44px;padding:0 16px;border:0;border-top:1px solid var(--graview-edge);background:var(--graview-panel);color:var(--graview-accent);font-size:.875rem;text-align:left}
80
+ @container (max-width: 559px){
81
+ .graview-kind-stop{padding:14px 16px 12px}
82
+ .graview-kind-stop-head{position:relative;padding-right:52px}
83
+ .graview-kind-stop-acts{flex:1 1 100%}
84
+ .graview-kind-stop-primary{flex:0 0 auto}
85
+ .graview-kind-stop-more-tools{position:absolute;top:-6px;right:0}
86
+ .graview-kind-stop-name button{text-decoration:none}
87
+ .graview-kind-stop-row-acts button{border-color:transparent;font-weight:400;color:var(--graview-ink-muted)}
88
+ .graview-kind-stop-row-acts button:hover{color:var(--graview-ink)}
89
+ .graview-kind-stop-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
90
+ .graview-kind-stop-table,.graview-kind-stop-table tbody,.graview-kind-stop-table tr{display:block}
91
+ .graview-kind-stop-table tr{position:relative;padding:8px 40px 8px 0;border-top:1px solid var(--graview-edge)}
92
+ .graview-kind-stop-table th,.graview-kind-stop-table td{display:block;padding:1px 0;border:0}
93
+ .graview-kind-stop-table td>span{display:inline}
94
+ .graview-kind-stop-table td[data-short]{white-space:normal}
95
+ .graview-kind-stop-table td[data-label]::before{content:attr(data-label) " \xB7 ";color:var(--graview-ink-muted)}
96
+ .graview-kind-stop-row-acts{position:absolute;top:6px;right:0;width:auto}
97
+ .graview-kind-stop-table [data-graview-choose]{padding-left:34px}
98
+ .graview-kind-stop-table td.graview-choose-at{position:absolute;left:0;top:8px;width:auto;padding:0}
99
+ .graview-kind-stop-table thead .graview-choose-at{position:static}
100
+ }
101
+ @media (pointer: coarse){
102
+ .graview-kind-stop-table-at:not([data-graview-choosing]) .graview-choose-at{display:none}
103
+ .graview-kind-stop-table-at:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
104
+ }
105
+ @media (pointer: coarse){
106
+ .graview-kind-stop-primary,.graview-kind-stop-quiet,.graview-kind-stop-fact,.graview-kind-stop-rule,.graview-kind-stop-link,.graview-kind-stop-switch button,.graview-kind-stop-row-acts button{min-height:44px}
107
+ .graview-kind-stop-row-acts button,.graview-kind-stop-more-tools{min-width:44px;min-height:44px}
108
+ .graview-kind-stop-name button{min-height:44px}
109
+ }
110
+ @media (prefers-reduced-motion: reduce){.graview-kind-stop *{transition:none!important;animation:none!important}}
111
+ `;export{Mt as KindStop};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as le,b as M,c as ue}from"./chunk.65SI77M7.js";import{A as te,C as re,E as oe,G as ae,I as ie,M as se,O as de,R as ce,i as J,j as Q,l as X,r as Y,u as ee,v as ne}from"./chunk.GH6QX7JR.js";import{a as W}from"./chunk.J4D4BIB4.js";import{Da as _,Ea as H,Fa as j,G as $,Ra as Z,Ya as U,_ as G,ia as q,ka as z}from"./chunk.ASNVH2G4.js";import{a as K}from"./chunk.SDO3U72B.js";import{fd as T,jd as I}from"./chunk.ZDUKVXBI.js";import{b as B}from"./chunk.AJZBJBMO.js";var o=B($(),1);var h=B($(),1),k,he=K(()=>(__graviewPreload(import.meta.url,["./chunk.NNK2E2EP.js","./chunk.CEQQIW7Z.js","./chunk.VUE6ILQV.js","./chunk.2IOJNFCR.js","./chunk.AAPXF6NP.js","./chunk.QDVGHI7R.js","./chunk.TBLOBXZ2.js","./chunk.MIE4TJRW.js","./chunk.DEBW4FH6.js","./chunk.RD2FSSLV.js","./chunk.OWHH7JDV.js","./chunk.T3RFZ66S.js","./chunk.TDWJU6GW.js","./chunk.P3Z4ZCL3.js","./chunk.45OLF6BK.js","./chunk.T6ISUVUP.js","./chunk.ASNVH2G4.js","./chunk.SDO3U72B.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.PF7XQ5R5.js"))),ye=()=>he().then(e=>void(k=e),()=>new Promise(e=>setTimeout(e,2e3)).then(ye)),pe=j(ye),ke=e=>!!e&&k===void 0;function Ae({onReady:e,fetch:n}){return(0,h.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var ge=0;function xe(e){let[n,t]=(0,h.useState)(()=>k);(0,h.useEffect)(()=>{if(!e||n)return;let i=!1;return pe().then(()=>{i||t(k)}),()=>{i=!0}},[e,n]);let r=(0,h.useMemo)(()=>ge+=1,[e]);return{over:(0,h.useMemo)(()=>{let i=n??k;if(!e||!i)return;let{source:s,worker:d,...l}=e,c={...l,worker:d??{source:s},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:g=>i.registerWorkerView(g,c)}},[e,n]),n:r}}var we=[];function me(e,n,t){let[r,a]=(0,h.useState)(we);return(0,h.useEffect)(()=>{let i=()=>void pe().then(()=>a(n.forked()));if(n?.forked)return n.forked().length>0&&i(),n.onChange?.(i)},[n]),(0,h.useMemo)(()=>r.length>0&&k?r.reduce((i,s)=>k.registerWorkerView(i,{manifest:s.manifest,worker:{source:s.source},...s.draft?{keepsNothing:!0}:{}}),H(_(t),e)):e,[e,r,t])}var p=B(G(),1),De=e=>typeof e=="object"?e:{};function Ne({rootRef:e,firstLook:n,app:t}){let r=(0,o.useCallback)(()=>e.current,[e]);return n?(0,p.jsx)(ce,{firstLook:n,root:r,app:t}):null}function Le(e,n,t){let{app:r}=e,a=(0,o.useMemo)(()=>{let s=se(n(r.schema,r.viewSpecs),r),d=t?Se(s,t):s,l=e.views?e.views(r.schema,d):s,c=l===d?s:H(s,l);return de(c,r.schema,ae(e.brand??r.brand,r.schema)),t?t.register(c):c},[e.views,r.schema,r.viewSpecs,r.lenses,r.pages,r.home,t]),i=me(a,e.keptViews,r.schema);return Z(i,e.keptViews)}function Se(e,n){let t={...e,register(r,a,i,s){return s?.name!==n.name&&e.register(r,a,i,s),t},...e.home?{home:(r,a)=>(n.home||e.home(r,a),t)}:{}};return t}var P=e=>e?e.getBoundingClientRect().height:0;function Te(e,n,t){let r=(0,o.useRef)(t);r.current=t;let a=t!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let s=()=>{let m=[...i.children],w=m.find(R=>R.hasAttribute("data-graview-app-bar")),f=m.find(R=>R.hasAttribute("data-embed-content")),S=f?.querySelector("[data-embed-measure]")??null,u=m.find(R=>R.hasAttribute("data-graview-place-line"));return{strip:w,line:u,content:f,measure:S}},d=-1,l=()=>{let{strip:m,line:w,content:f,measure:S}=s(),u=Math.ceil(P(m)+P(w)+P(S||f));u!==d&&(d=u,r.current?.(u))};if(l(),typeof ResizeObserver>"u")return;let c=new ResizeObserver(l),g=()=>{c.disconnect();let{strip:m,line:w,content:f,measure:S}=s();for(let u of[i,m,w,f,S])u&&c.observe(u)};g();let b=new MutationObserver(()=>{g(),l()});return b.observe(i,{childList:!0}),()=>{c.disconnect(),b.disconnect()}},[e,n,a])}var Ie=480,ve=0;function Ke(e){let{app:n,seed:t,scheme:r="auto",brand:a=n.brand,fonts:i=!0,height:s="100%",label:d}=e,l=(0,o.useRef)(null);U(l);let c=s==="viewport"?"100dvh":s,g=X(typeof c=="string"&&/vh\b/.test(c)),b=(0,o.useMemo)(()=>`graview-embed-${++ve}`,[]),m=(0,o.useMemo)(()=>e.store??e.remote?.store??M(n,t),[e.store,e.remote,n,t]),w=e.presence??e.remote?.presence,f=e.hostContext?.theme,S=ue(r==="auto"&&f===void 0,a?.scheme),u=r==="auto"?f??S:r,R=(0,o.useMemo)(()=>W(u,a,{scope:`.${b}`}),[u,a,b]);J(e.favicon?I(e.assetsAt,T(a)):void 0),Q(e.favicon?a:void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let v=le(a);if(!v||document.querySelector(`link[href="${v}"]`))return;let y=document.createElement("link");y.rel="stylesheet",y.href=v,document.head.appendChild(y)},[a,i]);let C=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let v=l.current,y=C.current;if(C.current=d,!v||!d)return;let V=E=>{let A=E.getAttribute("aria-label")??"",x=y&&y!==d?A.startsWith(`${y} \xB7 `)?A.slice(y.length+3):A===y?"":A:A;x===d&&(E.getAttribute("role")==="region"||E.tagName==="SECTION"&&!E.hasAttribute("role"))&&E.setAttribute("role","group");let L=x.startsWith(`${d} \xB7 `)||x===d?x:x?`${d} \xB7 ${x}`:d;L!==A&&E.setAttribute("aria-label",L)},F=()=>v.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(E=>{E.hasAttribute("data-graview-named-by-lens")||V(E)});F();let N=new MutationObserver(F);return N.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>N.disconnect()},[d]);let O=g?`${c}`.replace(/([\d.]+)[sdl]?vh\b/g,(v,y)=>`${+y*g/100}px`):c;return{rootRef:l,scope:b,css:R,scheme:u,store:m,presence:w,brand:a,auto:s==="auto",height:O}}function We({rootRef:e,board:n,onReport:t,where:r}){let a=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]),i=(0,o.useRef)(r);i.current=r;let s=(0,o.useMemo)(()=>t?{tell:t,where:()=>i.current()}:void 0,[t]);return(0,p.jsx)(Y,{board:n,anchor:a,report:s})}function $e(e){let n=e.split(/[?#]/)[0].split("/").filter(Boolean).map(t=>{try{return decodeURIComponent(t)}catch{return t}});return n.length===0?{place:"home"}:n[0]==="places"?{place:n[1]??"places"}:{place:n[0],...n[1]!==void 0?{record:n[1]}:{}}}function Ge(e,n,t){return{brand:t,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:n,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,onProposeChange:e.onProposeChange,composeChange:e.composeChange,onDraftChange:e.onDraftChange,displayOptions:e.displayOptions,ai:e.ai,files:e.files,viewerState:e.viewerState,assetsAt:e.assetsAt,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,notifications:e.notifications,onNotificationsSeen:e.onNotificationsSeen,workflowRuns:e.workflowRuns,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function qe({name:e,heading:n,faces:t,at:r,without:a,home:i,reach:s,standing:d,hostActions:l,barActions:c,appMenu:g,schemeChoice:b,share:m,status:w,keeping:f,onFind:S,named:u=!0,history:R=!0}){let{brand:C,store:O,principal:v,views:y}=q();z();let V=a?.has("places")?[]:ee({store:O,principal:v,views:y}),F=oe();return(0,p.jsx)(te,{brand:C,name:e,named:u,history:R,description:C?.subtitle,heading:n,faces:t,home:i,places:V,current:r===null?null:ne(V,r),reach:s,onFind:S,...t||r===null?{scenePlaces:F}:{},...c?{actions:c}:{},...g?{appMenu:g}:{},...b?{scheme:b}:{},...m?{share:m}:{},...w?{status:w}:{},tools:(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(ie,{clean:d}),(0,p.jsx)(re,{...l?{hostActions:l}:{},...f?{keeping:f}:{}})]})})}var ze=e=>({appMenu:e.appMenu,share:e.share,status:e.status,schemeChoice:e.schemeChoice,notifications:e.notifications});function _e(e){return{appMenu:e.appMenu,share:e.share,status:e.status,schemeChoice:e.schemeChoice,notifications:e.notifications}}var je=e=>e===!1?2:Math.min(e+1,6);function Ze(e){let[n,t]=(0,o.useState)(e),r=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:r,at:t,pending:a}),[]),s=(0,o.useCallback)(d=>{if(r.current){r.current(d);return}a.current=d,t(d)},[]);return{at:n,setAt:t,steering:i,steer:s}}function be(e){let n=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof n=="string"&&n.length>0?n:typeof e=="object"?"Error":typeof e}}var D=()=>typeof performance<"u"?performance.now():Date.now();function Ue(e,n){let t=(0,o.useRef)({onError:e,face:n});return t.current={onError:e,face:n},(0,o.useCallback)((r,a)=>t.current.onError?.(be(r),{module:a.module,face:t.current.face}),[])}function Je(e,n){let t=(0,o.useRef)(null);t.current===null&&(t.current=D());let r=(0,o.useRef)({onReady:e,face:n});r.current={onReady:e,face:n};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,r.current.onReady?.({ms:Math.max(0,D()-(t.current??D())),face:i}))},[])}var fe=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(n,t){console.error(`[graview] ${this.props.module} threw while rendering`,n,t.componentStack),this.props.report(n,{module:this.props.module})}render(){return this.state.failed?(0,p.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,p.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,p.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{pe as a,ke as b,Ae as c,xe as d,De as e,Ne as f,Le as g,Te as h,Ie as i,Ke as j,We as k,$e as l,Ge as m,qe as n,ze as o,_e as p,je as q,Ze as r,Ue as s,Je as t,fe as u};
@@ -0,0 +1 @@
1
+ import{i as R}from"./chunk.TRP66PHK.js";import{f as v,g as _,h as B}from"./chunk.PGT4ZQDG.js";import"./chunk.AJZBJBMO.js";var F=e=>`The app's face "${String(e)}" for its views`,D=(e,t,n)=>`${F(e)} is not loaded: ${t} answered ${n||"no type"}, not a font.`;function k(e,t){let n=`${F(e.family)} is not loaded`,a=B(e,_(t.typography));if(a)return{refused:`${n}: ${a}.`};let s=v(e.src);if("asset"in s){let i=t.asset?.(s.asset);return i?{url:i}:{refused:`${n}: this host says nowhere the app's own files are served (\`asset\`), so ${e.src} is not fetched.`}}return R(t.origins).includes(new URL(s.https).origin)?{url:s.https}:{refused:`${n}: ${s.origin} is no origin this host lists for the faces its views are lent (\`fonts.origins\`), so it is not fetched.`}}async function J(e,t,n,a="same-origin"){let s=await e(t,{signal:n,credentials:a,redirect:"error"});if(!s.ok)return s.body?.cancel(),"failed";let i=(s.headers.get("content-type")??"").split(";")[0].trim().toLowerCase();if(i!==""&&!i.startsWith("font/")&&!i.startsWith("application/font-")&&!i.startsWith("application/x-font-")&&i!=="application/octet-stream")return s.body?.cancel(),{type:i};let o=Number(s.headers.get("content-length")??NaN);if(Number.isFinite(o)&&o>2e6)return s.body?.cancel(),"over";let c=s.body?.getReader();if(!c)return"failed";let f=[],g=0;for(;;){let{done:r,value:d}=await c.read();if(r)break;if(g+=d.byteLength,g>2e6)return c.cancel(),"over";f.push(d)}let h=new Uint8Array(g),l=0;for(let r of f)h.set(r,l),l+=r.byteLength;return h.buffer}var G=new WeakMap,j=new WeakMap,A=e=>{let t=String(e.weight??"normal").trim().replace(/\s+/g," ").toLowerCase();return t==="normal"?"400":t==="bold"?"700":t},U=e=>JSON.stringify([e.family.toLowerCase(),A(e),(e.style??"normal").toLowerCase()]);function L(e,t){let n;for(let i=t.files.length-1;i>=0&&!n;i-=1)t.files[i].face&&(n=t.files[i]);for(let i of t.files)i===n||!i.drawn||(e.fonts?.delete(i.face),i.drawn=!1);n&&!n.drawn&&(e.fonts?.add(n.face),n.drawn=!0);let a=t.files.filter(i=>[...i.holders.keys()].some(o=>!o.going));if(a.length<2){t.told=void 0;return}if(!n||n!==a.at(-1)||t.told===n.url)return;t.told=n.url;let s=new Set;for(let i of a)for(let[o,c]of i.holders)o.going||s.has(o)||(s.add(o),o.say(`${F(c)} is lent from ${a.length} files on this page, and the one drawn in every view is ${n.url}.`))}function Z(e,t,n,a,s){let i=e.defaultView,o=G.get(e)??new Map;G.set(e,o);let c={say:a,going:!1},f=s?j.get(s):void 0;f&&(f.going=!0);let g=[];t.length>8&&a(`The app lends its views ${t.length} faces and at most ${8} are loaded, so ${t.slice(8).map(r=>`"${r.family}"`).join(", ")} ${t.length-8===1?"is":"are"} not.`);for(let r of t.slice(0,8)){let d=k(r,n);if("refused"in d){a(d.refused);continue}let $="asset"in v(r.src),N=i?.FontFace,M=i?.fetch?.bind(i);if(!N||!e.fonts||$&&!M)continue;let O=U(r),y=o.get(O)??{files:[]};o.set(O,y);let b=y.files.find(u=>u.url===d.url);if(b){b.holders.set(c,r.family),y.files.splice(y.files.indexOf(b),1),y.files.push(b),g.push({name:y,one:b}),L(e,y);continue}let C=()=>{},z=new Promise(u=>C=u),p={url:d.url,stop:new AbortController,holders:new Map([[c,r.family]]),settled:z,settle:C,drawn:!1};y.files.push(p),g.push({name:y,one:p});let S=u=>{if(p.settle(),p.stop.signal.aborted)return;let w=y.files.indexOf(p);w>=0&&y.files.splice(w,1);for(let[W,H]of p.holders)W.going||W.say(u(H));L(e,y),y.files.length===0&&o.get(O)===y&&o.delete(O)},V=()=>S(u=>`${F(u)} could not be loaded from ${d.url}.`),T={display:"swap",...r.weight!==void 0?{weight:A(r)}:{},...r.style?{style:r.style.toLowerCase()}:{}},P=u=>{let w=new N(r.family,u,T);w.status==="error"&&(w=new N(JSON.stringify(r.family),u,T)),w.load().then(()=>{p.settle(),!(p.stop.signal.aborted||!y.files.includes(p))&&(p.face=w,L(e,y))},V)};$?J(M,d.url,p.stop.signal).then(u=>{if(p.stop.signal.aborted)return p.settle();if(u==="failed")return V();if(typeof u=="object"&&"type"in u)return S(w=>D(w,d.url,u.type));if(u==="over")return S(w=>`${F(w)} is not loaded: its file, ${d.url}, is more than ${2e6/1e6} MB, the most a file the app holds may be as a face for its views.`);P(u)},V):P(`url(${JSON.stringify(d.url)})`)}let h=!1,l=()=>{if(!h){h=!0,s?.();for(let{name:r,one:d}of g){if(d.holders.delete(c),d.holders.size>0)continue;d.stop.abort(),d.settle();let $=r.files.indexOf(d);$>=0&&r.files.splice($,1),d.drawn&&e.fonts?.delete(d.face),d.drawn=!1,L(e,r)}for(let[r,d]of o)d.files.length===0&&o.delete(r)}};return j.set(l,c),s&&Promise.all(g.map(({one:r})=>r.settled)).then(()=>s()),l}var I=e=>`font/${/\.(woff2|woff|ttf|otf)(?:[?#]|$)/i.exec(e)?.[1]?.toLowerCase()??"woff2"}`;function q(e){let t=new Uint8Array(e),n="";for(let a=0;a<t.length;a+=32768)n+=String.fromCharCode(...t.subarray(a,a+32768));return btoa(n)}async function K(e,t,n){e.length>8&&n(`The app lends its views ${e.length} faces and at most ${8} are loaded, so ${e.slice(8).map(o=>`"${o.family}"`).join(", ")} ${e.length-8===1?"is":"are"} not.`);let a=new Map;for(let o of e.slice(0,8)){let c=k(o,t);if("refused"in c){n(c.refused);continue}let f=U(o),g=(a.get(f)??[]).filter(h=>h.url!==c.url);g.push({font:o,url:c.url}),a.set(f,g)}let s=t.signal??new AbortController().signal;return(await Promise.all([...a.values()].map(async o=>{try{for(let c=o.length-1;c>=0;c-=1){let{font:f,url:g}=o[c],h="asset"in v(f.src),l=await J(t.fetch,g,s,h?"same-origin":"omit").catch(()=>"failed");if(s.aborted)return;if(l==="failed"){n(`${F(f.family)} could not be loaded from ${g}.`);continue}if(l==="over"){n(`${F(f.family)} is not loaded: its file, ${g}, is more than ${2e6/1e6} MB, the most a file may be as a face for the app's views.`);continue}if(!(l instanceof ArrayBuffer)){n(D(f.family,g,l.type));continue}return o.length>1&&n(`${F(f.family)} is lent from ${o.length} files, and the one drawn in the frame is ${g}.`),{family:f.family,...f.weight!==void 0?{weight:A(f)}:{},...f.style?{style:f.style.toLowerCase()}:{},src:`data:${I(g)};base64,${q(l)}`}}return}finally{t.settled?.(o[0].font.family)}}))).filter(o=>o!==void 0)}var E=new WeakMap,Y=8;function ee(e,t,n){let a=t.map(l=>{let r=v(l.src);return r&&"asset"in r?n.asset?.(r.asset)??null:null}),s=JSON.stringify([t,n.typography??null,n.origins??[],a]),i=E.get(e)??new Map;E.set(e,i);let o=i.get(s);if(o)return o;let c=[],f=new Set;for(let l of t.slice(0,8))"refused"in k(l,n)||f.add(l.family);let g=K(t,{...n,fetch:e.fetch.bind(e),settled:l=>f.delete(l)},l=>c.push(l)).then(l=>({fonts:l,said:c})),h={read:g,waiting:()=>[...f]};return i.set(s,h),i.size>Y&&i.delete(i.keys().next().value),g.then(l=>{l.said.length>0&&i.get(s)===h&&i.delete(s)},()=>i.delete(s)),h}export{K as frameFonts,Z as loadViewFonts,ee as readFrameFonts,k as viewFontAddress};