graview 0.1.70 → 0.1.71

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 (216) hide show
  1. package/dist/preview/chunk.23DATB5Y.js +1 -0
  2. package/dist/preview/chunk.2INDKSJI.js +1 -0
  3. package/dist/preview/chunk.3CLTABGP.js +1 -0
  4. package/dist/preview/{chunk.4O3STSC4.js → chunk.3RRK6UTN.js} +1 -1
  5. package/dist/preview/chunk.45HUV56Z.js +1 -0
  6. package/dist/preview/chunk.4HU2ILFY.js +1 -0
  7. package/dist/preview/{chunk.M7DJJRFH.js → chunk.4LWWXIM4.js} +1 -1
  8. package/dist/preview/chunk.4O64QV2Y.js +1 -0
  9. package/dist/preview/{chunk.KP7HUXH5.js → chunk.4QMAYVPU.js} +1 -1
  10. package/dist/preview/chunk.4UDST6IF.js +1 -0
  11. package/dist/preview/{chunk.7TZXDPPO.js → chunk.4YZ2A6SJ.js} +3 -3
  12. package/dist/preview/{chunk.PAIBRJVZ.js → chunk.4ZEHLUXV.js} +1 -1
  13. package/dist/preview/{chunk.I7CSRZC2.js → chunk.5EQRIZ6I.js} +1 -1
  14. package/dist/preview/chunk.5OS4SYHE.js +1 -0
  15. package/dist/preview/{chunk.ZIGW5VOT.js → chunk.5PQV7GFE.js} +1 -1
  16. package/dist/preview/{chunk.SSHEFQ4R.js → chunk.5WCSQFS5.js} +1 -1
  17. package/dist/preview/{chunk.RJ7UV3XI.js → chunk.64K5ELSQ.js} +1 -1
  18. package/dist/preview/{chunk.2T24FYAO.js → chunk.67S2UWBT.js} +1 -1
  19. package/dist/preview/{chunk.FXCKKVT5.js → chunk.6A3KTD66.js} +1 -1
  20. package/dist/preview/chunk.6BBUTKFC.js +23 -0
  21. package/dist/preview/chunk.6IMRCKB4.js +1 -0
  22. package/dist/preview/chunk.6L6RUOSF.js +5 -0
  23. package/dist/preview/{chunk.ZGJUCVT5.js → chunk.6TBQV3NO.js} +1 -1
  24. package/dist/preview/chunk.6ZRVVRDQ.js +1 -0
  25. package/dist/preview/{chunk.4VTUC5TF.js → chunk.7FI75ZVE.js} +1 -1
  26. package/dist/preview/{chunk.NKUNCQB3.js → chunk.7KX36ENH.js} +1 -1
  27. package/dist/preview/{chunk.JPJHM62B.js → chunk.7LPHWJB4.js} +1 -1
  28. package/dist/preview/chunk.7MDGPTYF.js +1 -0
  29. package/dist/preview/{chunk.JEQ6CA5M.js → chunk.7PWLRRUS.js} +2 -2
  30. package/dist/preview/{chunk.YBQUP3KE.js → chunk.7TACFS7Q.js} +1 -1
  31. package/dist/preview/{chunk.DIVANC3G.js → chunk.7THS3DLZ.js} +1 -1
  32. package/dist/preview/{chunk.5W7EGQCQ.js → chunk.7XGU6KVF.js} +2 -2
  33. package/dist/preview/chunk.7ZLCA3WK.js +1 -0
  34. package/dist/preview/{chunk.4BSEYZMS.js → chunk.ARGEGV5T.js} +1 -1
  35. package/dist/preview/{chunk.3KF5RYPW.js → chunk.BSWR5SGX.js} +1 -1
  36. package/dist/preview/{chunk.BBMX3IIO.js → chunk.BWMPC7LK.js} +1 -1
  37. package/dist/preview/{chunk.55C7WO4X.js → chunk.CEJIH3CN.js} +1 -1
  38. package/dist/preview/{chunk.F5756PXX.js → chunk.CEOQY5KS.js} +2 -2
  39. package/dist/preview/{chunk.NZFO6BM3.js → chunk.CGRX6SDE.js} +1 -1
  40. package/dist/preview/{chunk.C67TMA4U.js → chunk.CPK6CYKN.js} +1 -1
  41. package/dist/preview/{chunk.T552MHMU.js → chunk.CVN2XFMF.js} +1 -1
  42. package/dist/preview/{chunk.MGG5DH2S.js → chunk.D4F6QX5L.js} +1 -1
  43. package/dist/preview/{chunk.M3HLZX6Q.js → chunk.D6ODKMOV.js} +1 -1
  44. package/dist/preview/{chunk.RECTEAG4.js → chunk.DDSAFU3B.js} +1 -1
  45. package/dist/preview/{chunk.UJF6YTEO.js → chunk.DG3YNOH3.js} +1 -1
  46. package/dist/preview/chunk.DGYWNM5U.js +1 -0
  47. package/dist/preview/{chunk.NBB5ALVJ.js → chunk.DHO3QZYK.js} +1 -1
  48. package/dist/preview/{chunk.4QBW46XV.js → chunk.DJGZOPAS.js} +1 -1
  49. package/dist/preview/{chunk.2MWEYNVH.js → chunk.DX7RGK5G.js} +1 -1
  50. package/dist/preview/{chunk.CZI6J5CE.js → chunk.EA2KYBBR.js} +1 -1
  51. package/dist/preview/{chunk.DWMFLLJO.js → chunk.EEGVI266.js} +1 -1
  52. package/dist/preview/{chunk.BQWMHHAZ.js → chunk.EHLV3LND.js} +2 -2
  53. package/dist/preview/{chunk.3MPLUSVY.js → chunk.EJC7ACZT.js} +1 -1
  54. package/dist/preview/{chunk.6NYSB6OZ.js → chunk.EJIQDMLU.js} +1 -1
  55. package/dist/preview/{chunk.QQUZ5RTQ.js → chunk.EOSN5DWW.js} +1 -1
  56. package/dist/preview/{chunk.2QALBEWP.js → chunk.EPSYX2SF.js} +1 -1
  57. package/dist/preview/chunk.EUXAIG73.js +1 -0
  58. package/dist/preview/{chunk.S4QSZRKH.js → chunk.EZQK23AB.js} +1 -1
  59. package/dist/preview/{chunk.ZTHZHBVN.js → chunk.F5O3HR7X.js} +1 -1
  60. package/dist/preview/chunk.F6MY6WJ4.js +1 -0
  61. package/dist/preview/{chunk.UVMHC6VM.js → chunk.F7KVEWFH.js} +1 -1
  62. package/dist/preview/{chunk.FJXKQZZS.js → chunk.FIUPDGUZ.js} +1 -1
  63. package/dist/preview/chunk.FNSVGSZI.js +1 -0
  64. package/dist/preview/chunk.FOHZPYUV.js +1 -0
  65. package/dist/preview/chunk.FW6M6GIU.js +32 -0
  66. package/dist/preview/{chunk.IJVR7ZL7.js → chunk.G5AF5IXL.js} +1 -1
  67. package/dist/preview/{chunk.SCN6IYDG.js → chunk.G767NLBH.js} +1 -1
  68. package/dist/preview/{chunk.X7HMTN3Z.js → chunk.GFBE4VNT.js} +1 -1
  69. package/dist/preview/{chunk.U5Q7EVZQ.js → chunk.GFOZVQBQ.js} +1 -1
  70. package/dist/preview/{chunk.KJAOJTZZ.js → chunk.GKYJQE5A.js} +1 -1
  71. package/dist/preview/{chunk.YCMMATFK.js → chunk.GOVRX2YX.js} +1 -1
  72. package/dist/preview/{chunk.U3CV227I.js → chunk.H33XWGAY.js} +1 -1
  73. package/dist/preview/{chunk.DGDOZHYK.js → chunk.H4BPTMED.js} +1 -1
  74. package/dist/preview/chunk.HLKDYI6J.js +1 -0
  75. package/dist/preview/{chunk.C4LC2UEU.js → chunk.HPFEYMGP.js} +1 -1
  76. package/dist/preview/{chunk.CLJKQLK2.js → chunk.HT35PAHI.js} +2 -2
  77. package/dist/preview/{chunk.6VG2LCES.js → chunk.HXRHEPPJ.js} +1 -1
  78. package/dist/preview/{chunk.LZNHTROY.js → chunk.IXYG65TM.js} +1 -1
  79. package/dist/preview/chunk.IZDB777E.js +1 -0
  80. package/dist/preview/{chunk.ZQSV5XVB.js → chunk.JAPTTM6Y.js} +1 -1
  81. package/dist/preview/{chunk.CUA7F3YJ.js → chunk.JCKIJSW7.js} +1 -1
  82. package/dist/preview/{chunk.WAIIXXVI.js → chunk.JLNTE5CH.js} +2 -2
  83. package/dist/preview/{chunk.5FQHZVE3.js → chunk.JNK5WBSU.js} +1 -1
  84. package/dist/preview/chunk.JREA2XDG.js +1 -0
  85. package/dist/preview/{chunk.CHG522KL.js → chunk.KBJ3UUER.js} +1 -1
  86. package/dist/preview/{chunk.VBHV4TLG.js → chunk.KHRS2SKB.js} +1 -1
  87. package/dist/preview/{chunk.CZUUFO6A.js → chunk.KJPLX72N.js} +1 -1
  88. package/dist/preview/{chunk.7LAXSQQY.js → chunk.KZUHXOZU.js} +2 -2
  89. package/dist/preview/{chunk.R65YX332.js → chunk.L3MLGFIS.js} +1 -1
  90. package/dist/preview/{chunk.RXUL6P7Y.js → chunk.L6P55HFW.js} +1 -1
  91. package/dist/preview/{chunk.J4NY2K2A.js → chunk.LDWWUKKX.js} +1 -1
  92. package/dist/preview/{chunk.RIP2SAQ5.js → chunk.LHCGC3K6.js} +1 -1
  93. package/dist/preview/{chunk.IQCMV5WD.js → chunk.LNKY6MT4.js} +1 -1
  94. package/dist/preview/chunk.LQ5J6YQW.js +1 -0
  95. package/dist/preview/{chunk.O2XPLDMM.js → chunk.MEAUTBVM.js} +1 -1
  96. package/dist/preview/chunk.MEBKTW7H.js +17 -0
  97. package/dist/preview/{chunk.K6EKSURO.js → chunk.MFMC35ET.js} +1 -1
  98. package/dist/preview/chunk.MJ4T6YXI.js +1 -0
  99. package/dist/preview/{chunk.SWY6DIE4.js → chunk.MKJV3BM5.js} +3 -3
  100. package/dist/preview/chunk.ML4X7VVK.js +1 -0
  101. package/dist/preview/{chunk.ZOSTOVXR.js → chunk.MM7MLBGB.js} +1 -1
  102. package/dist/preview/{chunk.NCBUECIW.js → chunk.MQNW3O67.js} +1 -1
  103. package/dist/preview/{chunk.CVVNHQPO.js → chunk.MT252WP4.js} +1 -1
  104. package/dist/preview/{chunk.VKQONZKR.js → chunk.MWWNKM3I.js} +1 -1
  105. package/dist/preview/chunk.N3MXLORL.js +3 -0
  106. package/dist/preview/{chunk.SUYYDJGZ.js → chunk.NH3VXTGX.js} +1 -1
  107. package/dist/preview/{chunk.IRPMGHZN.js → chunk.NI4OPHTL.js} +1 -1
  108. package/dist/preview/chunk.NNGG7RCO.js +1 -0
  109. package/dist/preview/{chunk.MZSWWMX6.js → chunk.NXHEOHRR.js} +1 -1
  110. package/dist/preview/{chunk.A5ENJJZN.js → chunk.O5RPSUXV.js} +1 -1
  111. package/dist/preview/{chunk.CM7EDQ4E.js → chunk.OKHXXIMN.js} +1 -1
  112. package/dist/preview/chunk.OOQG2AEF.js +1 -0
  113. package/dist/preview/{chunk.MYR36HW4.js → chunk.OPMGQS5J.js} +1 -1
  114. package/dist/preview/{chunk.TUVPQLFL.js → chunk.OUF2QFZL.js} +1 -1
  115. package/dist/preview/{chunk.6QMRDSTD.js → chunk.OVSKPBPS.js} +1 -1
  116. package/dist/preview/chunk.OYMN3IFX.js +1 -0
  117. package/dist/preview/{chunk.3HFBHLXC.js → chunk.P43LPXXJ.js} +1 -1
  118. package/dist/preview/{chunk.FSZQTX3K.js → chunk.PGT4ZQDG.js} +4 -4
  119. package/dist/preview/{chunk.5IM2X3VT.js → chunk.PQTXM4VY.js} +1 -1
  120. package/dist/preview/{chunk.U2DZE7A5.js → chunk.Q6GEPVQ7.js} +1 -1
  121. package/dist/preview/{chunk.HMV4ILAC.js → chunk.QDDDKEBH.js} +1 -1
  122. package/dist/preview/{chunk.6KYTCEIH.js → chunk.QJJWAYHB.js} +1 -1
  123. package/dist/preview/{chunk.QAERSZVB.js → chunk.QK4QZVQG.js} +1 -1
  124. package/dist/preview/{chunk.XAN7QXMQ.js → chunk.QKRQPUCE.js} +1 -1
  125. package/dist/preview/{chunk.I3ADXJQW.js → chunk.QNWGDG2Z.js} +1 -1
  126. package/dist/preview/{chunk.NZ5TJKPT.js → chunk.QVBP4UZG.js} +2 -2
  127. package/dist/preview/{chunk.YTRUZ56A.js → chunk.RDUGUC7R.js} +1 -1
  128. package/dist/preview/{chunk.TVNY7F64.js → chunk.RHIP2UYE.js} +1 -1
  129. package/dist/preview/{chunk.PYGNO2AV.js → chunk.RJ7VSWTA.js} +3 -3
  130. package/dist/preview/{chunk.LEZGBHPZ.js → chunk.RO3D2RNP.js} +1 -1
  131. package/dist/preview/{chunk.KOVTQCHX.js → chunk.S2BMI23H.js} +1 -1
  132. package/dist/preview/{chunk.XJ4JYROM.js → chunk.SPJ34VHA.js} +1 -1
  133. package/dist/preview/{chunk.LZ3HO3HM.js → chunk.T6KOL7TW.js} +1 -1
  134. package/dist/preview/{chunk.BJ3G7J2Z.js → chunk.T6UJEXFL.js} +3 -2
  135. package/dist/preview/{chunk.T4QRIJE4.js → chunk.TBEKEHFS.js} +1 -1
  136. package/dist/preview/chunk.TO3ZKCA2.js +1 -0
  137. package/dist/preview/{chunk.QILGAV7H.js → chunk.TQ3MNB6K.js} +1 -1
  138. package/dist/preview/{chunk.F5XWYO5W.js → chunk.TRP66PHK.js} +1 -1
  139. package/dist/preview/{chunk.QODVFVWE.js → chunk.TSZ2S3VG.js} +1 -1
  140. package/dist/preview/{chunk.DWPM7AWA.js → chunk.TTM5GQ2U.js} +1 -1
  141. package/dist/preview/chunk.TUBY6SV3.js +1 -0
  142. package/dist/preview/{chunk.7QWGIGHM.js → chunk.U5KJQFAP.js} +1 -1
  143. package/dist/preview/chunk.U6V4KZF5.js +1 -0
  144. package/dist/preview/chunk.UJ7RTNT4.js +1 -0
  145. package/dist/preview/{chunk.MR776WQ2.js → chunk.UQZ2P6KD.js} +1 -1
  146. package/dist/preview/{chunk.OXXZGPJZ.js → chunk.UZKBFI52.js} +1 -1
  147. package/dist/preview/{chunk.HIJ72QX6.js → chunk.V5JB5UJS.js} +1 -1
  148. package/dist/preview/{chunk.3I2SGKKF.js → chunk.VDFQFLTU.js} +1 -1
  149. package/dist/preview/{chunk.I6HIVTXU.js → chunk.VGYG2IBZ.js} +1 -1
  150. package/dist/preview/chunk.VICBF3MQ.js +2 -0
  151. package/dist/preview/{chunk.TD2V74XU.js → chunk.VL3YDD7D.js} +1 -1
  152. package/dist/preview/{chunk.A7JORJJL.js → chunk.VPFUOTY7.js} +1 -1
  153. package/dist/preview/{chunk.UWEFODVV.js → chunk.VUDNQOOX.js} +1 -1
  154. package/dist/preview/{chunk.YIDNZTON.js → chunk.VVIQSFM4.js} +1 -1
  155. package/dist/preview/{chunk.J65CZJIC.js → chunk.W332P5T3.js} +1 -1
  156. package/dist/preview/{chunk.S6IKR6RD.js → chunk.W3TJF4EH.js} +1 -1
  157. package/dist/preview/{chunk.7FTATAH2.js → chunk.W5O5F4FT.js} +1 -1
  158. package/dist/preview/chunk.W6L2VAJG.js +2 -0
  159. package/dist/preview/{chunk.QG3LV4RH.js → chunk.WGH2P2YL.js} +1 -1
  160. package/dist/preview/{chunk.KV3N6VRG.js → chunk.WS5ORRGS.js} +1 -1
  161. package/dist/preview/{chunk.7HNMG6LG.js → chunk.WU6D3SPL.js} +1 -1
  162. package/dist/preview/{chunk.MSWOETXN.js → chunk.X2UYEA7H.js} +1 -1
  163. package/dist/preview/{chunk.FBDCHJS2.js → chunk.X45EITTK.js} +1 -1
  164. package/dist/preview/{chunk.JIEBGUCA.js → chunk.X7U3JMBR.js} +1 -1
  165. package/dist/preview/chunk.XSM4OTF4.js +1 -0
  166. package/dist/preview/{chunk.5A5DI36V.js → chunk.XTHSPLZZ.js} +1 -1
  167. package/dist/preview/{chunk.TS5APXWC.js → chunk.Y5WQD6KV.js} +1 -1
  168. package/dist/preview/{chunk.3QPMFUMV.js → chunk.YXVUJ3NB.js} +1 -1
  169. package/dist/preview/{chunk.F5STM4DX.js → chunk.Z22C2JJ4.js} +1 -1
  170. package/dist/preview/{chunk.BBLA4PSP.js → chunk.Z2BCOZDZ.js} +1 -1
  171. package/dist/preview/{chunk.BZXJKWNI.js → chunk.Z3TK2LJM.js} +1 -1
  172. package/dist/preview/chunk.ZGLOXN7O.js +1 -0
  173. package/dist/preview/{chunk.UJM5EZDM.js → chunk.ZLQIGZXO.js} +1 -1
  174. package/dist/preview/{chunk.FUTSLXWN.js → chunk.ZONRIOIA.js} +1 -1
  175. package/dist/preview/{chunk.NTAC5NNE.js → chunk.ZY3NAJDM.js} +1 -1
  176. package/dist/preview/index.html +55 -55
  177. package/dist/preview/page.js +2 -2
  178. package/package.json +6 -6
  179. package/dist/preview/chunk.2QOB62XU.js +0 -1
  180. package/dist/preview/chunk.36FKQJFM.js +0 -2
  181. package/dist/preview/chunk.3A3DCALP.js +0 -1
  182. package/dist/preview/chunk.3GPYKWAD.js +0 -1
  183. package/dist/preview/chunk.3ZP6IDUC.js +0 -1
  184. package/dist/preview/chunk.53HW224Y.js +0 -1
  185. package/dist/preview/chunk.AW74DZ5V.js +0 -17
  186. package/dist/preview/chunk.CCCSZRKU.js +0 -1
  187. package/dist/preview/chunk.DBSSCJQM.js +0 -1
  188. package/dist/preview/chunk.DW6KXAUM.js +0 -1
  189. package/dist/preview/chunk.HHQUCFN4.js +0 -1
  190. package/dist/preview/chunk.HPWMCS3H.js +0 -23
  191. package/dist/preview/chunk.HRLCDBMO.js +0 -1
  192. package/dist/preview/chunk.I7ODVOO5.js +0 -1
  193. package/dist/preview/chunk.IANOWT3Z.js +0 -1
  194. package/dist/preview/chunk.IFPJPJ4M.js +0 -1
  195. package/dist/preview/chunk.IUVRJDL3.js +0 -5
  196. package/dist/preview/chunk.J4CSY2D5.js +0 -2
  197. package/dist/preview/chunk.JJIKTTXB.js +0 -1
  198. package/dist/preview/chunk.KDOJC4FX.js +0 -1
  199. package/dist/preview/chunk.KLZPUTMU.js +0 -1
  200. package/dist/preview/chunk.LQ2PDW2M.js +0 -32
  201. package/dist/preview/chunk.MNWP3TPN.js +0 -1
  202. package/dist/preview/chunk.NILR2BWR.js +0 -1
  203. package/dist/preview/chunk.NNYKLENL.js +0 -1
  204. package/dist/preview/chunk.PZHCWMKT.js +0 -1
  205. package/dist/preview/chunk.QVID5WHS.js +0 -1
  206. package/dist/preview/chunk.RHV73CBA.js +0 -3
  207. package/dist/preview/chunk.RP6C2IUM.js +0 -1
  208. package/dist/preview/chunk.RPHZY7N4.js +0 -1
  209. package/dist/preview/chunk.UYBSVE2W.js +0 -1
  210. package/dist/preview/chunk.WMZ2BINI.js +0 -1
  211. package/dist/preview/chunk.X2RHBTJI.js +0 -1
  212. package/dist/preview/chunk.X3FPVFFB.js +0 -1
  213. package/dist/preview/chunk.X4PFLIXB.js +0 -1
  214. package/dist/preview/chunk.YR7DKU5T.js +0 -1
  215. package/dist/preview/chunk.ZBK3FCVE.js +0 -1
  216. package/dist/preview/chunk.ZH5L746C.js +0 -1
@@ -1,4 +1,4 @@
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 Ft,b as _t,c as Kt,d as Gn}from"./chunk.BQWMHHAZ.js";import{a as qt}from"./chunk.2QALBEWP.js";import{a as Hn,b as It,c as Vn,d as Bt,e as Wt,f as Ht}from"./chunk.WAIIXXVI.js";import{a as Vt,b as tn,c as Gt,d as jt}from"./chunk.RECTEAG4.js";import{c as Ut,g as Yt,h as Qt,i as Jt}from"./chunk.QQUZ5RTQ.js";import{e as Tt}from"./chunk.KP7HUXH5.js";import{m as zt}from"./chunk.4BSEYZMS.js";import{a as Nt,b as Dt}from"./chunk.KV3N6VRG.js";import{f as Lt,h as Pt}from"./chunk.FUTSLXWN.js";import{e as Mt}from"./chunk.MZSWWMX6.js";import{b as Ot,c as me,d as ke,e as ze}from"./chunk.SUYYDJGZ.js";import{e as At,l as Rt}from"./chunk.IRPMGHZN.js";import{l as Et,m as Wn}from"./chunk.RP6C2IUM.js";import{g as In,h as Bn}from"./chunk.CVVNHQPO.js";import{d as $t}from"./chunk.YIDNZTON.js";import{k as Fe,m as Ct}from"./chunk.PYGNO2AV.js";import{$ as bt,G as Ee,Ta as kt,Ua as nn,Y as te,ga as oe,ha as xt,ia as St,l as en}from"./chunk.CUA7F3YJ.js";import{$ as ct,Bc as yt,G as st,I as lt,Md as zn,Xc as be,Ya as mt,Z as cn,_ as dt,aa as Tn,ab as pt,ba as ut,bb as ft,ca as Xe,cb as ht,la as Ge,lb as Dn,le as vt,ma as xe,oa as qe,pa as un,qa as gn,rd as Ze,sa as Nn,sd as wt,ua as gt,va as mn,yd as Te}from"./chunk.IUVRJDL3.js";import{b as q}from"./chunk.AJZBJBMO.js";var Qr=q(Ee(),1);var jn=q(te(),1);function Ie(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var ar=q(Ee(),1);var rn=q(Ee(),1);var Xt=e=>`place:${e}`;function Zt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var er=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function nr(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void er(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(p=>p.switchExport(r,i,e,s))}]:[]]};return r}function tr({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void er(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var rr=q(Ee(),1),pn=(0,rr.createContext)(null);var qn=q(te(),1),Xr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Zr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,ar.useContext)(pn),{view:i,go:s}=nn(),c=Zr.some(E=>i.within?.[E]!==void 0)?Nt(i):t.arrangedBy??{},b=e.nodes??[],u=t.kind??b[0]?.kind??e.node?.kind,w=c.archived!==void 0&&c.archived!==!1&&u!==void 0&&!t.subject?n.graph.nodesOfKind(u,{archived:c.archived}):b,h=t.subject??(t.only?w.filter(t.only):w),o=t.subject?[]:t.only?w.filter(E=>!t.only(E)):[],l=t.kind??h[0]?.kind,C=Xr(t.allow,t.lensAllows),g=l?Mt(n.schema,String(l)):void 0,S=g?Lt(c,g).arrangement:{},A=Pt(h,C===!1?{}:S,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,v=l!==void 0&&T&&t.exportable!==!1,O=nr(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:A.groups,grouped:A.grouped,onExport:r,words:{labelOf:xe,readableFields:$t,withComputed:Rt}}));Zt(a&&v?Xt(a.as):void 0,O);let m=l&&C!==!1&&T&&(h.length>1||L>0)?(0,qn.jsx)(zt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:S,allow:C,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:h,flagged:new Set(e.flagged??[])}}:{},onChange:E=>s(Dt(i,E)),kept:{shown:A.nodes.length,of:h.length},...L>0?{past:{count:L,widen:()=>s(Tt(i,!0))}}:{},...v&&!O.off?{end:(0,qn.jsx)(tr,{said:O})}:{}}):null;return{nodes:[...o,...A.nodes],arranged:A,arrangement:S,bar:m}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ge(t.tryDefinition(i.kind),i))}var Be=q(Ee(),1);var j=q(te(),1),ea=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
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 Ft,b as _t,c as Kt,d as Gn}from"./chunk.EHLV3LND.js";import{a as qt}from"./chunk.EPSYX2SF.js";import{a as Hn,b as It,c as Vn,d as Bt,e as Wt,f as Ht}from"./chunk.JLNTE5CH.js";import{a as Vt,b as tn,c as Gt,d as jt}from"./chunk.DDSAFU3B.js";import{c as Ut,g as Yt,h as Qt,i as Jt}from"./chunk.EOSN5DWW.js";import{e as Tt}from"./chunk.4QMAYVPU.js";import{m as zt}from"./chunk.ARGEGV5T.js";import{a as Nt,b as Dt}from"./chunk.WS5ORRGS.js";import{f as Lt,h as Pt}from"./chunk.ZONRIOIA.js";import{e as Mt}from"./chunk.NXHEOHRR.js";import{b as Ot,c as me,d as ke,e as ze}from"./chunk.NH3VXTGX.js";import{e as At,l as Rt}from"./chunk.NI4OPHTL.js";import{l as Et,m as Wn}from"./chunk.3CLTABGP.js";import{g as In,h as Bn}from"./chunk.MT252WP4.js";import{d as $t}from"./chunk.VVIQSFM4.js";import{k as Fe,m as Ct}from"./chunk.RJ7VSWTA.js";import{$ as bt,G as Ee,Ta as kt,Ua as nn,Y as te,ga as oe,ha as xt,ia as St,l as en}from"./chunk.JCKIJSW7.js";import{$ as ct,Bc as yt,G as st,I as lt,Md as zn,Xc as be,Ya as mt,Z as cn,_ as dt,aa as Tn,ab as pt,ba as ut,bb as ft,ca as Xe,cb as ht,la as Ge,lb as Dn,le as vt,ma as xe,oa as qe,pa as un,qa as gn,rd as Ze,sa as Nn,sd as wt,ua as gt,va as mn,yd as Te}from"./chunk.6L6RUOSF.js";import{b as q}from"./chunk.AJZBJBMO.js";var Qr=q(Ee(),1);var jn=q(te(),1);function Ie(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var ar=q(Ee(),1);var rn=q(Ee(),1);var Xt=e=>`place:${e}`;function Zt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var er=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function nr(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void er(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(p=>p.switchExport(r,i,e,s))}]:[]]};return r}function tr({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void er(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var rr=q(Ee(),1),pn=(0,rr.createContext)(null);var qn=q(te(),1),Xr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Zr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,ar.useContext)(pn),{view:i,go:s}=nn(),c=Zr.some(E=>i.within?.[E]!==void 0)?Nt(i):t.arrangedBy??{},b=e.nodes??[],u=t.kind??b[0]?.kind??e.node?.kind,w=c.archived!==void 0&&c.archived!==!1&&u!==void 0&&!t.subject?n.graph.nodesOfKind(u,{archived:c.archived}):b,h=t.subject??(t.only?w.filter(t.only):w),o=t.subject?[]:t.only?w.filter(E=>!t.only(E)):[],l=t.kind??h[0]?.kind,C=Xr(t.allow,t.lensAllows),g=l?Mt(n.schema,String(l)):void 0,S=g?Lt(c,g).arrangement:{},A=Pt(h,C===!1?{}:S,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,v=l!==void 0&&T&&t.exportable!==!1,O=nr(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:A.groups,grouped:A.grouped,onExport:r,words:{labelOf:xe,readableFields:$t,withComputed:Rt}}));Zt(a&&v?Xt(a.as):void 0,O);let m=l&&C!==!1&&T&&(h.length>1||L>0)?(0,qn.jsx)(zt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:S,allow:C,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:h,flagged:new Set(e.flagged??[])}}:{},onChange:E=>s(Dt(i,E)),kept:{shown:A.nodes.length,of:h.length},...L>0?{past:{count:L,widen:()=>s(Tt(i,!0))}}:{},...v&&!O.off?{end:(0,qn.jsx)(tr,{said:O})}:{}}):null;return{nodes:[...o,...A.nodes],arranged:A,arrangement:S,bar:m}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ge(t.tryDefinition(i.kind),i))}var Be=q(Ee(),1);var j=q(te(),1),ea=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
2
2
  ${r}`);this.hint=r;this.name="BoardBindingError"}},ir=e=>Math.max(0,Math.min(1,e));function Fn(e,t,n,r){let a=l=>l,i=l=>r?xe(r.tryDefinition(l.kind),l):String(a(l).label??l.id);if(r&&r.tryDefinition(n.slots)===void 0)throw new fn(`No kind is declared for "${n.slots}".`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let s=e.filter(l=>l.kind===n.slots);if(!r&&s.length===0)throw new fn(`Nothing to arrange: no "${n.slots}" nodes.`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let p=t.filter(l=>l.kind===n.fill),c=new Map(e.map(l=>[l.id,l])),b=new Map(e.map((l,C)=>[l.id,C])),u=s.map(l=>{let C=a(l),g=n.fillFrom==="occupant",S=p.filter(A=>(g?A.to:A.from)===l.id).map(A=>c.get(g?A.from:A.to)).filter(A=>A!==void 0).sort((A,L)=>(b.get(A.id)??0)-(b.get(L.id)??0)).map(A=>({id:A.id,label:i(A)}));return{id:l.id,code:String(C[n.slotCode??""]??"").trim()||i(l),label:i(l),x:ir(Number(C[n.x]??.5)),y:ir(Number(C[n.y]??.5)),occupants:S}}).sort((l,C)=>l.y-C.y||l.x-C.x),w=new Set(u.flatMap(l=>l.occupants.map(C=>C.id))),h=new Set([...w].map(l=>c.get(l)?.kind).filter(l=>l!==void 0)),o=e.filter(l=>h.has(l.kind)&&!w.has(l.id)).map(l=>({id:l.id,label:i(l)})).sort((l,C)=>l.label<C.label?-1:l.label>C.label?1:0);return{slots:u,empty:u.filter(l=>l.occupants.length===0).map(l=>l.id),spare:o}}function na({nodes:e,occupants:t,label:n,fidelity:r,mode:a,options:i,schema:s,implicated:p=[],flagged:c=[]}){let{store:b}=oe(),u=_e(b.graph,b.schema,e),w=t?[...u.filter(d=>d.kind===i.slots),...t.map(d=>b.graph.getNode(d)).filter(d=>d!==void 0)]:u,h=Fn(w,b.graph.allEdges(),i,s),o=new Set(p),l=new Set(c),C=kt(),g=new Map;for(let d of C)for(let y of d.nodeIds)g.set(y,[...g.get(y)??[],d.message]);let S=d=>d?g.get(d)??[]:[];if(r==="glyph")return(0,j.jsx)(ke,{label:`${n??"Board"} \xB7 ${h.slots.length-h.empty.length}/${h.slots.length}`,hue:be("board")});if(r==="summary"){let d=h.slots.filter(y=>h.empty.includes(y.id));return(0,j.jsx)(me,{title:n??"Board",meta:`${h.slots.length-h.empty.length}/${h.slots.length}`,tone:d.length>0?"warning":"muted",fit:!0,children:d.length>0?(0,j.jsx)(ze,{pick:!0,max:5,items:d.map(y=>({id:y.id,label:y.code}))}):(0,j.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"Every slot filled."})})}let A=i.aspect??.68,L=(0,Be.useRef)(null),[T,v]=(0,Be.useState)(!1),[O,m]=(0,Be.useState)(null),E=160,[D,G]=(0,Be.useState)(!1);(0,Be.useEffect)(()=>{let d=L.current;if(!d||typeof ResizeObserver>"u")return;let y=new ResizeObserver(x=>{let R=x[0]?.contentRect;if(!R)return;let f=R.height<E;G(f),v(!f&&A<1&&R.width/R.height>1.3),m(f?null:R.height)});return y.observe(d),()=>y.disconnect()},[A]);let k=(d,y)=>T?{x:1-y,y:d}:{x:d,y},_=(()=>{let d=new Map,y=(x,R,f)=>{let $=d.get(f)??{ids:[],codes:[]};$.ids.includes(x)||($.ids.push(x),$.codes.includes(R)||$.codes.push(R)),d.set(f,$)};for(let x of h.slots){for(let R of S(x.id))y(x.id,x.code,R);for(let R of x.occupants)for(let f of S(R.id))y(R.id,R.label,f)}return[...d.entries()].map(([x,R])=>({id:R.ids[0],code:R.codes.join(", "),text:x}))})(),W=a==="fullscreen",le=_.length===0?null:(0,j.jsxs)("ul",{"data-graview-primitive":"board-key",style:{margin:"2px 0 0",padding:0,listStyle:"none",display:"grid",gap:3,flex:"0 0 auto"},children:[_.slice(0,W?6:2).map(d=>(0,j.jsxs)("li",{"data-graview-pick":d.id,"data-graview-emphasis":o.size===0?"plain":o.has(d.id)?"lit":"dimmed",title:d.text,style:{display:W?"grid":"flex",gap:W?1:7,alignItems:W?"start":"baseline",fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",minHeight:24,width:"fit-content",maxWidth:"100%",padding:W?"2px 0":"3px 6px",marginLeft:W?0:-6,borderRadius:7,cursor:"pointer"},children:[(0,j.jsxs)("span",{style:{flex:"0 0 auto",fontWeight:600,color:"var(--graview-warn)",letterSpacing:"0.02em"},children:["\u26A0 ",d.code]}),(0,j.jsx)("span",{style:{minWidth:0,...W?{}:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:d.text})]},d.id)),_.length>(W?6:2)?(0,j.jsxs)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:["+",_.length-(W?6:2)," more"]}):null]}),ee=i.arrange==="shelf",ie=h.slots.every(d=>d.code.length<=3&&!/\s/.test(d.code)),N=(d,y)=>{let x=d.occupants.length===0,R=o.size>0&&!o.has(d.id)&&!d.occupants.some(Q=>o.has(Q.id)),f=l.has(d.id),$=d.occupants.some(Q=>l.has(Q.id)),P=f,ne=[...S(d.id),...d.occupants.flatMap(Q=>S(Q.id))],H=d.occupants.length===1?d.occupants[0]:null,K=i.pickTarget==="slot"?d.id:H?H.id:d.id,J=Q=>H?{}:{"data-graview-pick":Q.id,"data-graview-emphasis":o.size===0?"plain":R?"dimmed":"lit"},Y=Q=>l.has(Q.id)?"var(--graview-warn)":"var(--graview-ink-muted)",ue=i.emptyLabel??"empty";return(0,j.jsxs)("div",{"data-graview-pick":K,"data-graview-slot":d.id,"data-graview-mark":ie?"disc":"token","data-graview-flagged":f&&$?"both":f?"slot":$?"occupant":void 0,"data-graview-emphasis":o.size===0?"plain":R?"dimmed":"lit",title:[x?`${d.label} \u2014 nobody in it`:`${d.occupants.map(Q=>Q.label).join(", ")} at ${d.label}`,...ne].join(`
3
3
  `),style:{...y,display:"grid",justifyItems:ie?"center":"start",gap:3,opacity:R?.5:1,transition:"opacity 160ms ease"},children:[ie?(0,j.jsxs)("span",{style:{position:"relative",width:34,height:34,borderRadius:999,display:"grid",placeItems:"center",fontSize:"0.75rem",letterSpacing:"0.02em",border:x?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:x?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",color:x||P?"var(--graview-warn)":"var(--graview-ink)",boxShadow:x?void 0:"var(--graview-lift-low)"},children:[d.code,f&&!x?(0,j.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,fontSize:"0.6875rem",lineHeight:1,color:"var(--graview-warn)"},children:"\u26A0"}):null]}):(0,j.jsxs)("span",{style:{display:"grid",gap:1,minWidth:0,maxWidth:180,padding:"5px 10px 6px",borderRadius:8,border:x?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:x?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",boxShadow:x?void 0:"var(--graview-lift-low)"},children:[(0,j.jsxs)("span",{style:{fontSize:"0.8125rem",fontWeight:550,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:x||P?"var(--graview-warn)":"var(--graview-ink)"},children:[d.code,f&&!x?" \u26A0":null]}),x?(0,j.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.3,color:"var(--graview-warn)"},children:ue}):(0,j.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:"0 8px",fontSize:"0.75rem",lineHeight:1.3},children:d.occupants.map(Q=>(0,j.jsxs)("span",{...J(Q),style:{whiteSpace:"nowrap",color:Y(Q)},children:[Q.label,l.has(Q.id)?" \u26A0":""]},Q.id))})]}),ie?x?(0,j.jsx)("span",{style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:"var(--graview-warn)"},children:ue}):d.occupants.map(Q=>(0,j.jsxs)("span",{...J(Q),style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:Y(Q)},children:[Q.label,l.has(Q.id)?" \u26A0":""]},Q.id)):null]},d.id)},U=i.zones??[],de=U.map((d,y)=>({label:d.label,slots:h.slots.filter(x=>x.y>=d.from&&(x.y<d.to||y===U.length-1&&x.y<=d.to))})),B=new Set(de.flatMap(d=>d.slots.map(y=>y.id))),we=h.slots.filter(d=>!B.has(d.id));(we.length>0||de.length===0)&&de.push({label:"",slots:we});let M={boxSizing:"border-box",borderRadius:12,border:"1px solid var(--graview-edge)",background:"linear-gradient(var(--graview-panel-muted), var(--graview-panel-muted)), var(--graview-panel)",overflow:"hidden"};return(0,j.jsxs)(me,{title:n??"Board",meta:h.slots.length===0?void 0:h.empty.length===0?`all ${h.slots.length} filled`:`${h.empty.length} unfilled`,...W?{style:{flex:"1 1 auto",minHeight:0,height:"100%"}}:{},children:[(0,j.jsxs)("div",{ref:L,style:{display:"flex",gap:28,alignItems:"stretch",justifyContent:"center",flex:"1 1 auto",minHeight:0},children:[W&&le?(0,j.jsxs)("div",{style:{width:260,flex:"0 0 auto",alignSelf:"center",display:"grid",gap:8},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"What is marked"}),le]}):null,ee?(0,j.jsx)("div",{"data-graview-primitive":"board","data-graview-arrange":"shelf",style:{...M,overflow:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"stretch",display:"grid",alignContent:"start"},children:de.map((d,y)=>(0,j.jsxs)("section",{"data-graview-zone":d.label||void 0,style:{display:"grid",gap:8,padding:"10px 14px 14px",...y>0?{borderTop:"1px dashed var(--graview-edge)"}:{}},children:[d.label?(0,j.jsx)("span",{style:{fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:d.label}):null,d.slots.length>0?(0,j.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px 12px",alignItems:"flex-start"},children:d.slots.map(x=>N(x,{}))}):(0,j.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"nothing here"})]},d.label||`band-${y}`))}):(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"stretch",minWidth:0,...D?{flex:"1 1 auto",alignSelf:"flex-start"}:{}},children:[!T&&U.length>0?(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"relative",width:15,flex:"0 0 auto",alignSelf:"stretch"},children:U.map(d=>(0,j.jsx)("span",{title:d.label,style:{position:"absolute",top:`${d.from*100}%`,height:`${(d.to-d.from)*100}%`,right:0,writingMode:"vertical-rl",transform:"rotate(180deg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:d.label},d.label))}):null,(0,j.jsxs)("div",{"data-graview-primitive":"board","data-graview-arrange":"exact",style:{...M,position:"relative",aspectRatio:`${T?1/A:A}`,...D?{width:"100%",height:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"flex-start"}:{height:"100%",flex:"0 1 auto",...O!==null?{width:Math.round(O*(T?1/A:A))}:{}},maxWidth:"100%"},children:[U.map(d=>(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",...T?{top:0,bottom:0,left:`${(1-d.to)*100}%`,width:`${(d.to-d.from)*100}%`,borderLeft:"1px dashed var(--graview-edge)"}:{left:0,right:0,top:`${d.from*100}%`,height:`${(d.to-d.from)*100}%`,borderBottom:"1px dashed var(--graview-edge)"}}},d.label)),T?U.map(d=>(0,j.jsx)("span",{"aria-hidden":"true",title:d.label,style:{position:"absolute",bottom:3,left:`${(1-d.to)*100}%`,width:`${(d.to-d.from)*100}%`,textAlign:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:d.label},`label-${d.label}`)):null,h.slots.map(d=>N(d,{position:"absolute",left:`${k(d.x,d.y).x*100}%`,top:`${k(d.x,d.y).y*100}%`,transform:"translate(-50%, -50%)",width:"max-content",maxWidth:"100%"}))]})]}),h.spare.length>0?(0,j.jsxs)("div",{style:{display:"grid",gap:6,alignContent:"start",minWidth:0},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"Not in"}),(0,j.jsx)(ze,{pick:!0,max:10,items:h.spare.map(d=>({...d,emphasis:o.size===0?"plain":o.has(d.id)?"lit":"dimmed"}))})]}):null]}),W?null:le]})}function or(e){function t(n){let{store:r}=oe(),a=Fn(_e(r.graph,r.schema,n.nodes),r.graph.allEdges(),e,r.schema),s=[...a.slots.flatMap(u=>u.occupants.map(w=>w.id)),...a.spare.map(u=>u.id)].map(u=>r.graph.getNode(u)).filter(u=>u!==void 0),{arranged:p,bar:c}=Ne(n,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{group:!1},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},subject:s}),b=(0,j.jsx)(na,{schema:r.schema,...n,options:e,...e.arranging===!1?{}:{occupants:p.nodes.map(u=>u.id)}});return Ie(n,r.schema,c?(0,j.jsxs)("div",{style:{display:"grid",gap:6,height:"100%",minHeight:0,gridTemplateRows:"auto 1fr"},children:[c,b]}):b)}return{name:"board",requiredRoles:[...ea],options:e,View:t,build(n,r,a){return Fn(n,r,e,a)}}}var Cn=q(Ee(),1);var sr=864e5;function ta(e){if(typeof e!="string")return null;if(In(e))return Bn(e)?.day??null;let t=/^(\d{4}-\d{2}-\d{2})/.exec(e);return t?t[1]:null}function _n(e){if(typeof e=="string"&&st.test(e))return e.length===4?null:lt(e)??null;let t=ta(e);return t===null?null:{from:t,to:t}}var lr=e=>typeof e=="string"&&/^\d{4}$/.test(e);function yn(e){if(typeof e!="string")return null;if(In(e))return Bn(e)?.minutes??null;let t=/^\d{4}-\d{2}-\d{2}[T ](\d{2}):(\d{2})/.exec(e);return t?Number(t[1])*60+Number(t[2]):null}var hn=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10))),wn=e=>new Date(e).toISOString().slice(0,10);function Ae(e,t){return wn(hn(e)+t*sr)}function je(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+t,a=Number(e.slice(8,10)),i=new Date(Date.UTC(n,r+1,0)).getUTCDate();return wn(Date.UTC(n,r,Math.min(a,i)))}var Kn=e=>new Date(hn(e)).getUTCDay();function Ke(e,t=1){let n=(Kn(e)-t+7)%7;return Ae(e,-n)}var Un=e=>`${e.slice(0,7)}-01`;function ye(e,t){return Math.round((hn(t)-hn(e))/sr)}function Ue(e,t){return Array.from({length:t},(n,r)=>Ae(e,r))}var dr=e=>ut(e,"short"),De=e=>dt(e,{weekday:"short"}),Yn=e=>Xe(e);function We(e,t){let n=t?.fieldRoles?.when;return e&&!e.start&&n?{...e,start:n}:e}function cr(e,t){return t===void 0?!1:typeof t=="string"?e[t]===!0:t.is.includes(e[t.field])}var vn=["start"],ra=["day","week","month","quarter","year","agenda"];function bn(e){return e.horizon?["day","week","month","quarter","year","years","agenda"]:ra}function ur(e,t){return e==="years"?t?.title??"Years":`The ${e}`}function gr(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Qn=class extends Error{constructor(n,r){super(`The calendar lens has no binding for ${r.map(a=>`"${a}"`).join(", ")} on "${n}". Bind them in the lens declaration: bindings: { ${n}: { start: "<field>" } }.`);this.kind=n;this.missing=r;this.name="CalendarBindingError"}};function xn(e,t,n){let r=We(t[e.kind],n?.tryDefinition(e.kind));if(!r)return null;let a=e,i=n?.tryDefinition(e.kind)?.fields.shape,s=vn.filter(h=>{let o=r[h];return o?i?!(o in i):!(o in a):!0});if(s.length>0)throw new Qn(e.kind,s);let p=_n(a[r.start]);if(p===null)return null;let c=p.from,b=(r.end?_n(a[r.end])?.to:null)??p.to,u=yn(a[r.start]),w=r.label?a[r.label]:void 0;return{id:e.id,kind:e.kind,label:typeof w=="string"&&w.length>0?w:xe(n?.tryDefinition(e.kind),e),from:c,to:ye(c,b)<0?c:b,at:r.allDay&&a[r.allDay]===!0?null:u,allDay:r.allDay&&a[r.allDay]===!0||u===null,done:cr(a,r.done)}}function mr(e,t,n,r){let a=xn(e,t,n);if(!a)return[];let i=We(t[e.kind],n?.tryDefinition(e.kind)).start,s=e,p=s[i],c=s[mt(i)];if(typeof p!="string"||!pt(c))return[a];let b=ye(a.from,a.to);return("next"in r?[ht(p,c,r.next)]:ft(p,c,{from:Ae(r.from,-b),to:r.to,limit:400})).map(w=>({...a,from:w.slice(0,10),to:Ae(w.slice(0,10),b),repeats:!0}))}function Sn(e,t){return e.filter(n=>ye(n.from,t)>=0&&ye(t,n.to)>=0).sort((n,r)=>n.allDay!==r.allDay?n.allDay?-1:1:n.at!==r.at?(n.at??0)-(r.at??0):n.label.localeCompare(r.label))}function pr(e,t,n){let r=yt(e.schema,e.allMutations()).get(t)?.get(n)??[],a=new Map(e.allMutations().map(s=>[s.name,s]));for(let s of r){let p=a.get(s),c=p?.subject;if(!p||!c)continue;let b=p.input?.shape??{};if(n in b)return{name:p.name,arg:c.arg}}let i=e.allMutations().find(s=>s.derived?.act==="edit"&&s.derived.kind===t);return i?.subject?{name:i.name,arg:i.subject.arg}:null}var fr=(e,t)=>({from:Un(e),to:hr(e),label:Tn(e,{short:!0,year:t})});function hr(e){return wn(Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7)),0))}function aa(e){let t=Math.floor((Number(e.slice(5,7))-1)/3);return`${e.slice(0,4)}-${String(t*3+1).padStart(2,"0")}-01`}function yr(e,t,n={}){let r=n.weekStartsOn??1,a=(c,b)=>({from:c,to:c,label:String(Number(c.slice(8,10))),...b?{outside:!0}:{}});if(e==="day")return{title:De(t),grain:"day",columns:1,cells:[a(t)]};if(e==="week"){let c=Ke(t,r);return{title:`${De(c)} \u2013 ${De(Ae(c,6))}`,grain:"day",columns:7,cells:Ue(c,7).map(b=>a(b))}}if(e==="agenda")return{title:`From ${De(t)}`,grain:"day",columns:1,cells:Ue(t,42).map(c=>a(c))};if(e==="quarter"){let c=aa(t),b=hr(je(c,2)),u=[];for(let w=Ke(c,r);ye(w,b)>=0;w=Ae(w,7))u.push({from:w,to:Ae(w,6),label:ct(w),...ye(w,c)>0&&ye(Ae(w,6),c)>0?{outside:!0}:{}});return{title:`Q${Math.floor((Number(t.slice(5,7))-1)/3)+1} ${t.slice(0,4)}`,grain:"week",columns:4,cells:u}}if(e==="year"){let c=t.slice(0,4);return{title:c,grain:"month",columns:4,cells:Array.from({length:12},(b,u)=>fr(`${c}-${String(u+1).padStart(2,"0")}-01`,!1))}}if(e==="years"){let c=Number(t.slice(0,4)),b=c+Math.max(1,n.horizon?.years??1)-1,u=n.horizon?.from!==void 0||n.horizon?.to!==void 0,w=u?n.horizon?.from??c:Math.min(c,n.fit?.first??c),o=(u?Math.max(w,n.horizon?.to??w+Math.max(1,n.horizon?.years??1)-1):Math.max(b,n.fit?.last??b))-w+1,l=Array.from({length:o},(C,g)=>String(w+g));return o>ia?{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"year",columns:5,years:l,cells:l.map(C=>({from:`${C}-01-01`,to:`${C}-12-31`,label:C}))}:{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"month",columns:4,years:l,cells:l.flatMap(C=>Array.from({length:12},(g,S)=>fr(`${C}-${String(S+1).padStart(2,"0")}-01`,!0)))}}let i=Un(t),s=Ke(i,r),p=t.slice(0,7);return{title:Tn(t),grain:"day",columns:7,cells:Ue(s,42).map(c=>a(c,c.slice(0,7)!==p))}}function wr(e,t,n){return e.filter(r=>ye(r.from,n)>=0&&ye(t,r.to)>=0).sort((r,a)=>r.allDay!==a.allDay?r.allDay?-1:1:r.from!==a.from?r.from.localeCompare(a.from):r.at!==a.at?(r.at??0)-(a.at??0):r.label.localeCompare(a.label))}var ia=10;function vr(e){return e==="year"?"year":e==="month"?"month":e==="week"?"week":"day"}var br=q(Ee(),1);var ae=q(te(),1);function Jn({label:e,glyph:t,onPress:n}){return(0,ae.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,style:Ye,children:t})}var Ye={minHeight:24,minWidth:24,padding:"2px 9px",borderRadius:6,fontSize:"0.8125rem",borderWidth:1,borderStyle:"solid",borderColor:"transparent",color:"var(--graview-ink-muted)",background:"transparent"},xr={day:12,week:4,month:3,year:5};function Sr({span:e,weekStartsOn:t,entries:n,today:r,perCell:a,emphasisOf:i,broken:s,hue:p,onOpen:c,onMove:b}){let u=(0,br.useRef)(null),w=Fe(u),h=w===null?e.columns:Math.max(1,Math.floor(w/44)),o=h<e.columns,l=o?h:e.columns,C=!o&&e.grain==="day"&&e.columns===7?Ue(Ke(e.cells[0]?.from??r,t),7):e.grain==="day"&&e.columns===1?e.cells.map(g=>g.from):null;return o&&e.grain==="day"&&e.columns>1?(0,ae.jsx)("div",{ref:u,"data-calendar-shape":"agenda",style:{display:"grid",minHeight:0,flex:1},children:(0,ae.jsx)(kn,{days:e.cells.map(g=>g.from),entries:n,today:r,emphasisOf:i,broken:s,hue:p,onMove:(g,S)=>b(g,{from:S,to:S,label:S},"day")})}):(0,ae.jsxs)("div",{ref:u,"data-calendar-shape":o?"wrapped":"grid",style:{display:"grid",gap:4,gridTemplateRows:C?"auto 1fr":"1fr",minHeight:0,flex:1},children:[C?(0,ae.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gap:4},children:C.map(g=>(0,ae.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-muted)",textAlign:"center"},children:e.columns===7?dr(Kn(g)):De(g)},g))}):null,(0,ae.jsx)("div",{tabIndex:0,"aria-label":`The days of ${e.title}`,style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gridAutoRows:"max-content",gap:4,minHeight:0,overflow:"auto"},children:e.cells.map((g,S)=>{let A=wr(n,g.from,g.to),L=A.slice(0,a),T=A.slice(a),v=T.filter(m=>s.has(m.id)).length,O=ye(g.from,r)>=0&&ye(r,g.to)>=0;return(0,ae.jsxs)("div",{"data-calendar-day":e.grain==="day"?g.from:void 0,"data-calendar-cell":g.from,"data-calendar-grain":e.grain,"data-calendar-count":A.length,"data-calendar-outside":g.outside||void 0,onDragOver:m=>{m.dataTransfer.types.includes("text/graview-node")&&(m.preventDefault(),m.dataTransfer.dropEffect="move")},onDrop:m=>{let E=m.dataTransfer.getData("text/graview-node");E&&(m.preventDefault(),m.stopPropagation(),b(E,g,e.grain))},style:{minHeight:62,display:"flex",flexDirection:"column",gap:2,padding:4,borderRadius:7,border:"1px solid var(--graview-edge)",background:O?"var(--graview-panel)":g.outside?"var(--graview-panel-muted)":"transparent"},children:[(0,ae.jsxs)("span",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,ae.jsx)("span",{style:{fontSize:"0.75rem",fontVariantNumeric:"tabular-nums",color:O?"var(--graview-accent)":"var(--graview-ink-faint)"},children:g.label}),e.grain!=="day"&&A.length>0?(0,ae.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",marginLeft:"auto"},children:A.length}):null]}),L.map(m=>(0,ae.jsx)(kr,{entry:m,cell:g,rowStart:S%l===0,emphasis:i(m.id),flagged:s.has(m.id),hue:p(m)},`${m.id}:${m.from}:${g.from}`)),T.length>0?(0,ae.jsxs)("button",{type:"button","data-testid":`calendar-more-${g.from}`,onClick:()=>c(g),title:`Open ${g.label}`,style:{minHeight:24,padding:"1px 5px",fontSize:"0.75rem",borderRadius:5,border:"1px dashed var(--graview-edge)",background:"transparent",color:v>0?"var(--graview-warn)":"var(--graview-ink-muted)",textAlign:"left"},children:["+",T.length," more",v>0?` \xB7 ${v} flagged`:""]}):null]},g.from)})})]})}function kn({days:e,entries:t,today:n,emphasisOf:r,broken:a,hue:i,onMove:s}){let p=e.map(c=>({day:c,here:Sn(t,c)})).filter(({here:c})=>c.length>0);return p.length===0?(0,ae.jsx)("p",{"data-testid":"calendar-empty",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:"Nothing is scheduled in the next six weeks."}):(0,ae.jsx)("ol",{tabIndex:0,"aria-label":"What is scheduled",style:{margin:0,padding:0,listStyle:"none",display:"grid",alignContent:"start",gap:10,overflow:"auto",minHeight:0},children:p.map(({day:c,here:b})=>(0,ae.jsxs)("li",{"data-calendar-day":c,onDragOver:u=>{u.dataTransfer.types.includes("text/graview-node")&&(u.preventDefault(),u.dataTransfer.dropEffect="move")},onDrop:u=>{let w=u.dataTransfer.getData("text/graview-node");w&&(u.preventDefault(),u.stopPropagation(),s(w,c))},style:{display:"grid",gap:4},children:[(0,ae.jsxs)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:c===n?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[De(c),c===n?" \xB7 today":""]}),b.map(u=>(0,ae.jsx)(kr,{entry:u,cell:{from:c,to:c,label:c},emphasis:r(u.id),flagged:a.has(u.id),hue:i(u)},`${u.id}:${u.from}:${c}`))]},c))})}function kr({entry:e,cell:t,emphasis:n,flagged:r,hue:a,rowStart:i=!1}){let s=ye(t.from,e.from)>=0,p=ye(e.to,t.to)>=0,c=!(s&&p),b=e.at!==null&&s&&e.from===t.from?`${Yn(e.at)} ${e.label}`:e.label;return(0,ae.jsx)("span",{"data-graview-pick":e.id,"data-calendar-entry":e.id,"data-calendar-repeat":e.repeats?e.from:void 0,draggable:!e.repeats,onDragStart:u=>{u.dataTransfer.setData("text/graview-node",e.id),u.dataTransfer.effectAllowed="move"},"data-graview-emphasis":n,"data-calendar-part":c?s?"opens":p?"closes":"through":void 0,"data-calendar-in":t.from,title:c?`${e.label} \xB7 ${e.from} \u2013 ${e.to}`:`${e.label}${e.at===null?" \xB7 all day":` \xB7 ${Yn(e.at)}`}${e.repeats?" \xB7 repeats":""}`,style:{display:"block",minHeight:24,boxSizing:"border-box",padding:"3px 6px",fontSize:"0.75rem",lineHeight:1.35,borderRadius:c?s?"5px 0 0 5px":p?"0 5px 5px 0":0:5,whiteSpace:"normal",overflowWrap:"anywhere",hyphens:"auto",textDecoration:e.done?"line-through":"none",opacity:n==="dimmed"?.35:e.done?.6:1,background:`color-mix(in oklab, hsl(${Math.round(a)} 70% 55%) ${n==="lit"?38:20}%, transparent)`,color:"var(--graview-ink)",...n==="lit"?{outline:"1px solid var(--graview-accent)"}:{},...r?{borderLeft:"3px solid var(--graview-warn)",paddingLeft:4}:{}},children:s||i?e.repeats?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("span",{"aria-hidden":"true",children:"\u21BB "}),b]}):b:" "})}var Z=q(te(),1);function oa(e){let t=1/0,n=-1/0;for(let r of e)r&&(t=Math.min(t,Number(r.from.slice(0,4))),n=Math.max(n,Number(r.to.slice(0,4))));return Number.isFinite(t)&&Number.isFinite(n)?{first:t,last:n}:void 0}function Cr(e){let t=n=>function(a){let{store:i}=oe(),{view:s}=nn(),p=n?{...e,range:n}:e,c=s.within?.range??p.range??"month",b=Object.keys(e.bindings),{nodes:u,arranged:w,arrangement:h,bar:o}=Ne(a,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{sort:!1,group:c==="agenda"},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},...e.search?{search:e.search}:{},...e.filters?{filters:e.filters}:{},...b[0]?{kind:(a.nodes??[]).find(A=>b.includes(String(A.kind)))?.kind??b[0]}:{}}),l=c==="agenda"&&w.grouped&&h.group?w.groups.map(A=>({label:A.label,ids:new Set(A.nodes.map(L=>L.id))})):void 0,C=new Set((a.nodes??[]).map(A=>String(A.kind))),g=b.filter(A=>!C.has(A)&&i.schema.tryDefinition(A)!==void 0).flatMap(A=>{let L=i.schema.tryDefinition(A);return i.graph.nodesOfKind(A).filter(T=>s.past===!0||Ge(L,T))}),S=g.length===0?u:[...u,...a.budget!==void 0?g.slice(0,a.budget):g];return Ie(a,i.schema,(0,Z.jsx)(sa,{schema:i.schema,...a,nodes:S,options:{...p,today:p.today??i.today()??gr()},...o?{bar:o}:{},...l?{groups:l}:{}}))};return{name:"calendar",requiredRoles:[...vn],bindings:e.bindings,options:e,View:t(),at:n=>t(n),ranges:()=>bn(e).map(n=>({range:n,title:ur(n,e.horizon)})),place:(n,r)=>n.map(a=>xn(a,e.bindings,r)).filter(a=>a!==null)}}function sa({nodes:e,label:t,fidelity:n,mode:r,options:a,schema:i,selectedIds:s=[],implicated:p=[],flagged:c=[],bar:b,groups:u}){let{view:w,go:h}=nn(),{store:o,principal:l}=oe(),C=w.within?.at??a.today,g=w.within?.range??a.range??"month",S=a.weekStartsOn??1,A=new Set([...p,...s]),L=M=>A.size===0?"plain":A.has(M)?"lit":"dimmed",T=new Set(c),v=g==="years"&&w.within?.at===void 0?oa((e??[]).map(M=>xn(M,a.bindings,i))):void 0,O=yr(g,C,{weekStartsOn:S,...a.horizon?{horizon:a.horizon}:{},...v?{fit:v}:{}}),E=n==="glyph"||n==="summary"?{next:a.today}:{from:O.cells[0]?.from??C,to:O.cells[O.cells.length-1]?.to??C},D=(e??[]).flatMap(M=>mr(M,a.bindings,i,E)),G=a.hueOf??(M=>be(M.kind)),k=(e??[]).filter(M=>{let d=We(a.bindings[M.kind],i?.tryDefinition(M.kind));return d!==void 0&&lr(M[d.start])}).length;if(n==="glyph")return(0,Z.jsx)(ke,{label:`${t??"Calendar"} \xB7 ${D.length}`,hue:be("calendar")});if(n==="summary"){let M=Sn(D,a.today);return(0,Z.jsx)(me,{title:t??"Calendar",meta:`${D.length} dated`,tone:"muted",children:(0,Z.jsx)(ze,{max:6,items:M.length>0?M.map(d=>({id:d.id,label:d.label,hue:G(d)})):D.filter(d=>ye(a.today,d.from)>=0).sort((d,y)=>d.from.localeCompare(y.from)).slice(0,6).map(d=>({id:d.id,label:`${d.from.slice(5)} ${d.label}`,hue:G(d)}))})})}let _=r==="fullscreen",[W,le]=(0,Cn.useState)(null),ee=(M,d,y)=>{let x=o.graph.getNode(M);if(!x)return;let R=We(a.bindings[x.kind],o.schema.tryDefinition(x.kind));if(!R)return;let f=pr(o,x.kind,R.start);if(!f){le({text:`Nothing declared writes the ${Nn(o.schema.definitions.find(Y=>Y.kind===x.kind),R.start).toLowerCase()}, so this cannot be moved from here.`,tone:"refused"});return}let $=d.from,P=x[R.start],H=yn(P)===null?$:`${$}${String(P).slice(10)}`,K={name:f.name,args:{[f.arg]:M,[R.start]:H}},J=o.permits(K,l);if(!J.ok){le({text:J.refusal.message,tone:"refused"});return}try{o.apply(K,{author:l}),le(y==="day"?null:{text:`Moved to ${De($)} \u2014 a ${y} is coarser than the ${Nn(o.schema.definitions.find(Y=>Y.kind===x.kind),R.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,tone:"rounded"})}catch(Y){le({text:Y instanceof Error?Y.message:String(Y),tone:"refused"})}},ie=M=>{let d=g==="years"?je(`${O.years?.[0]??C.slice(0,4)}${C.slice(4)}`,M*12*Math.max(1,O.years?.length??a.horizon?.years??1)):g==="year"?je(C,M*12):g==="quarter"?je(C,M*3):g==="month"?je(C,M):g==="week"?Ae(C,M*7):Ae(C,M);h(en(w,"at",d))},N=(M,d)=>{let y=en(w,"range",M);d!==void 0&&(y=en(y,"at",d)),h(y)},U=(0,Cn.useRef)(null),de=Fe(U),B=de!==null&&de<420,we=M=>M==="years"?a.horizon?.title??"years":M.charAt(0).toUpperCase()+M.slice(1);return(0,Z.jsx)(me,{title:t??"Calendar",meta:O.title,style:{gap:10,..._?{flex:"1 1 auto",minHeight:0,height:"100%"}:{}},children:(0,Z.jsxs)("div",{ref:U,"data-testid":"calendar","data-calendar-range":g,"data-calendar-at":C,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:8},children:[(0,Z.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6},children:[(0,Z.jsxs)("nav",{"aria-label":"When",style:{display:"flex",gap:4},children:[(0,Z.jsx)(Jn,{label:"Previous",glyph:"\u2039",onPress:()=>ie(-1)}),(0,Z.jsx)("button",{type:"button","data-testid":"calendar-today",onClick:()=>h(en(w,"at",a.today)),style:Ye,children:"Today"}),(0,Z.jsx)(Jn,{label:"Next",glyph:"\u203A",onPress:()=>ie(1)})]}),B?(0,Z.jsx)("select",{"aria-label":"Range","data-testid":"calendar-ranges",value:g,onChange:M=>N(M.target.value),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",background:void 0,backgroundColor:"transparent",marginLeft:"auto",maxWidth:"50%",paddingRight:24,appearance:"none",WebkitAppearance:"none",backgroundImage:"linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",backgroundPosition:"calc(100% - 13px) 55%, calc(100% - 9px) 55%",backgroundSize:"4px 4px, 4px 4px",backgroundRepeat:"no-repeat"},children:bn(a).map(M=>(0,Z.jsx)("option",{value:M,children:we(M)},M))}):(0,Z.jsx)("div",{role:"group","aria-label":"Range","data-testid":"calendar-ranges",style:{display:"flex",flexWrap:"wrap",gap:4,marginLeft:"auto"},children:bn(a).map(M=>(0,Z.jsx)("button",{type:"button","aria-pressed":M===g,"data-testid":`calendar-range-${M}`,onClick:()=>N(M),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",...M==="years"?{}:{textTransform:"capitalize"},...M===g?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)",background:"var(--graview-panel)"}:{}},children:M==="years"?a.horizon?.title??"years":M},M))})]}),k>0?(0,Z.jsx)("p",{"data-testid":"calendar-year-only",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k===1?"1 knows only its year, so it is not placed.":`${k} know only their year, so they are not placed.`}):null,W?(0,Z.jsx)("p",{"data-testid":W.tone==="refused"?"calendar-refused":"calendar-rounded",role:"status",style:{margin:0,fontSize:"0.8125rem",color:W.tone==="refused"?"var(--graview-warn)":"var(--graview-ink-muted)"},children:W.text}):null,O.years?(0,Z.jsx)("nav",{"aria-label":"Years","data-testid":"calendar-years",style:{display:"flex",flexWrap:"wrap",gap:4},children:O.years.map(M=>(0,Z.jsx)("button",{type:"button","data-testid":`calendar-year-${M}`,onClick:()=>N("year",`${M}-01-01`),style:Ye,children:M},M))}):null,b,g==="agenda"&&u?(0,Z.jsx)("div",{"data-testid":"calendar-groups",style:{display:"grid",gap:10,minHeight:0,overflow:"auto"},children:u.map(M=>(0,Z.jsxs)("section",{"data-testid":"calendar-group",style:{display:"grid",gap:4},children:[(0,Z.jsxs)("h3",{style:{margin:0,fontSize:"0.8125rem",letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},children:[M.label," ",(0,Z.jsx)("span",{style:{fontWeight:400},children:M.ids.size})]}),(0,Z.jsx)(kn,{days:O.cells.map(d=>d.from),entries:D.filter(d=>M.ids.has(d.id)),today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(d,y)=>ee(d,{from:y,to:y,label:y},"day")})]},M.label))}):g==="agenda"?(0,Z.jsx)(kn,{days:O.cells.map(M=>M.from),entries:D,today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(M,d)=>ee(M,{from:d,to:d,label:d},"day")}):(0,Z.jsx)(Sr,{span:O,weekStartsOn:S,entries:D,today:a.today,perCell:a.perCell??xr[O.grain],emphasisOf:L,broken:T,hue:G,onOpen:M=>N(vr(O.grain),M.from),onMove:ee})]})})}var re=q(Ee(),1);var Qe=q(Ee(),1),Re=q(te(),1),$n={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"};function $r({choices:e,close:t}){let[n,r]=(0,Qe.useState)(!1),a=(0,Qe.useRef)(null);return(0,Qe.useLayoutEffect)(()=>{n&&a.current?.querySelector("button:not([disabled])")?.focus()},[n]),(0,Re.jsxs)("div",{children:[(0,Re.jsxs)("button",{type:"button","data-menu-item":"move-to","aria-expanded":n,onClick:()=>r(i=>!i),style:$n,children:["Move to ",(0,Re.jsx)("span",{"aria-hidden":"true",children:"\u203A"})]}),n?(0,Re.jsx)("ul",{ref:a,"aria-label":"Move to","data-testid":"move-to",style:{margin:"2px 0 0 12px",padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:e.map(i=>i.run?(0,Re.jsx)("li",{children:(0,Re.jsx)("button",{type:"button","data-move-to":i.to,onClick:()=>{t(),i.run()},style:$n,children:i.label})},i.to):(0,Re.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,Re.jsx)("button",{type:"button",disabled:!0,"data-move-to":i.to,"data-withheld":"",style:{...$n,borderStyle:"dashed"},children:(0,Re.jsx)("s",{children:i.label})}),(0,Re.jsx)("span",{"data-testid":"move-to-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:i.why})]},i.to))}):null]})}function Or({choose:e,close:t}){return(0,Re.jsx)("button",{type:"button","data-menu-item":"choose-several",onClick:()=>{t(),e()},style:$n,children:"Choose several"})}var z=q(te(),1),la=`
4
4
  .graview-columns { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
@@ -1 +1 @@
1
- import{c as M}from"./chunk.DW6KXAUM.js";import{ha as b}from"./chunk.IUVRJDL3.js";var k=["owners","status","schedule","budget","places","sources","stock","votes","private","history","publishing","roster","routines","comparison"],y={owners:"people who own things",status:"a status that moves",schedule:"dates it is due by, or a schedule",budget:"money against a budget",places:"places",sources:"sources behind claims",stock:"counts in stock",votes:"votes or picks",private:"private to its owner",history:"a history, a record book",publishing:"content to publish",roster:"a roster of people",routines:"repeating routines",comparison:"a comparison to pick one from"},J={owners:"a person kind (or the people the app has), an owner link, Give it to someone, a rule that every one has somebody on it, and Who has what",status:"a status with named steps (or the one the app has), an act for each step, and a board",schedule:"a due date, Set the date, the on-time rule, and a calendar",budget:"a cost beside the money the app keeps, a budget on the kind it is grouped under, Set the budget, and the over-budget rule",places:"a place kind, a link to one, and a map of where things are",sources:"a source kind, a link from each claim to its source, and the rule that a claim names one",stock:"what is on hand and the reorder level, Count the stock, and the running-low rule",votes:"a vote on each, Vote for it, and a tally",private:"a sight that keeps each person's own records to them",history:"the record book: an era or season each belongs to, and a timeline",publishing:"a published status, Publish it, and what the public sees",roster:"a person kind with the fields a roster keeps, and the list of who is here",routines:"how often each repeats and when it was last done, Mark it done, and the overdue rule",comparison:"a side-by-side of the candidates, one chosen, and Choose it"},U=new Set(["person","people","member","user","player","guest","candidate","participant","traveler","volunteer","interviewer","interviewee","contact","trade","staff","student","employee","teammate","crew","attendee","friend","customer","client","driver","speaker","host","teacher","parent","kid","child","coach","patient","tenant","resident","neighbor","applicant","recruit","contributor","assignee","worker","collaborator","runner"]),K=new Set(["place","venue","location","room","site","building","store","warehouse","city","country","region","address","hall","stadium","office","shelf"]),z=new Set(["source","reference","citation","evidence"]),H=new Set(["season","era","period","epoch","edition","generation","age","campaign","tournament"]),ae=/owner|owned|assign|^lead$|responsible|^by$|^by-|done-?by|interviewer|reviewer|maker|author|keeper|givenby|^for-?person$/i,oe=/due|deadline|until|needed|needby|target|expires|^ends?(on|at)?$|^by$/i,de=/^(date|day|when|at|start|starts|startsat|startson|startdate|scheduled|scheduledfor|scheduledon|happens|happenson|held|heldon|from|time|exchangedate|.*date|.*day)$/i,le=/released|fixed|published|applied|checked|created|added|done|last|first|updated|seen|born|birth|founded|finished|completed|closed/i,X=/status|stage|state|phase|progress/i,W=/budget|limit|cap$|allowance/i,ce=/budget|cost|price|quote|amount|salary|fee|spend|total|paid|owed/i,pe=/^(place|location|venue|address|where|city|town)$/i,B=/reorder|onhand|instock|^stock|quantity|^qty/i,he=/^votes?$|votecount|upvotes|^score$|^points$/i,fe=/^(votes?|votesfor|votedby|voters|picks?|chooses|choices|favorites|likes)$/i,ue=/often|frequency|cadence|^every$|repeat|interval/i,ge=/^last/i,Q=/^(published|live|public)$/i,ye=/count\(.*\bwhere\b.*\)\s*<=\s*1\b/,u=e=>e.toLowerCase(),w=(e,t)=>u(e.kinds[t]?.noun??b(t)),$=(e,t)=>u(e.kinds[t]?.plural??`${w(e,t)}s`),me=e=>e.charAt(0).toUpperCase()+e.slice(1),p=(e,t)=>me($(e,t)),we=e=>/^[aeiou]/i.test(e)?"an":"a",x=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,N=e=>new Set((e??"").split(/[^A-Za-z0-9_-]+/).filter(Boolean)),v=e=>Object.entries(e.kinds),m=(e,t)=>Object.entries(e.acts??{}).filter(([,s])=>[s.on??[]].flat().includes(t)),_=e=>Array.isArray(e.lenses)?e.lenses:[],I=e=>typeof e.title=="string"?e.title:void 0,A=e=>e.bindings&&typeof e.bindings=="object"?e.bindings:{},R=(e,t)=>Array.isArray(t)&&t.length===1&&typeof t[0]=="string"&&e.kinds[t[0]]?t[0]:void 0;function V(e,t){let s=e.kinds[t];if(!s)return!1;let r=n=>u(n).replace(/ll/g,"l");return s.people===!0||U.has(r(t))||U.has(r(w(e,t)))}var Y=(e,t)=>K.has(u(t))||K.has(w(e,t)),ke=(e,t)=>z.has(u(t))||z.has(w(e,t)),be=(e,t)=>H.has(u(t))||H.has(w(e,t)),$e=(e,t)=>(t.type==="number"||t.type==="integer")&&(t.format==="money"||ce.test(e)),j=e=>e.type==="date"||e.type==="datetime";function P(e,t,s,r,n){return _(e).filter(d=>d.name===t&&A(d)[s]?.[r]===n).map(I).filter(d=>d!==void 0)}function D(e,t,s,r){return _(e).filter(n=>n.name==="coverage"&&A(n)[s]?.kind===t&&(r===void 0||A(n).link?.edge===r)).map(I).filter(n=>n!==void 0)}function f(e,t,s){let r=new Set(t);return Object.entries(e.rules??{}).filter(([,n])=>(s===void 0||n.over==="graph"||s.includes(n.over))&&[...N(`${n.when??""} ${n.require??""} ${n.says??""}`)].some(d=>r.has(d))).map(([n])=>n)}var G=class{kinds=new Set;fields=new Set;relations=new Set;rules=new Set;lenses=new Set;acts=new Set;said;add=(t,...s)=>{for(let r of s)this[t].add(r)};say=t=>{this.said??=t};any=()=>this.kinds.size+this.fields.size+this.relations.size+this.rules.size+this.lenses.size+this.acts.size>0;asTrait=t=>({trait:t,words:y[t],said:this.said??y[t],kinds:[...this.kinds],fields:[...this.fields],relations:[...this.relations],rules:[...this.rules],lenses:[...this.lenses],acts:[...this.acts]})};function ve(e){let t;for(let[s,r]of v(e)){let n=Object.keys(r.fields).length+Object.keys(r.edges??{}).length;(!t||n>t.fields)&&(t={kind:s,fields:n})}return t?.kind}function g(e){let t=ve(e);return v(e).sort(([s],[r])=>+(r===t)-+(s===t))}function Z(e,t){let s=e.kinds[t];if(!s)return[];let r=[];for(let[n,d]of Object.entries(s.fields)){if(d.type!=="enum"||!Array.isArray(d.options)||d.options.length<2)continue;let i=m(e,t).filter(([,a])=>typeof a.sets?.[n]=="string"&&d.options.includes(a.sets[n])).map(([a])=>a);((X.test(n)||s.lifecycle?.field===n)&&i.length>=1||i.length>=2)&&r.push({field:n,options:d.options,steps:i})}return r}var ee={owners(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!V(e,i)||!ae.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("lenses",...D(e,s,"rows",n)),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`Each ${w(e,s)} has one of the ${$(e,i)} on it (${n}).`))}},status(e,t){for(let[s]of g(e))for(let{field:r,options:n,steps:d}of Z(e,s))t.add("kinds",s),t.add("fields",`${s}.${r}`),t.add("acts",...d),t.add("rules",...f(e,[r],[s])),t.add("lenses",...P(e,"columns",s,"column",r)),t.say(`${p(e,s)} move through ${x(n.map(u))}.`)},schedule(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.fields)){if(!j(d)||le.test(n))continue;let i=P(e,"calendar",s,"start",n),o=oe.test(n);if(!o&&!de.test(n)&&i.length===0)continue;t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("lenses",...i),t.add("rules",...f(e,[n],[s])),t.add("acts",...m(e,s).filter(([,l])=>(l.writes??[]).includes(n)||l.sets?.[n]!==void 0).map(([l])=>l));let a=/date|day|when|time/i.test(n)?u(b(n)):`date (${n})`;t.say(o?`${p(e,s)} are due by a date (${n}).`:`${p(e,s)} have ${we(a)} ${a}${i.length>0?", on a calendar":""}.`)}},budget(e,t){let s=v(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>(h.type==="number"||h.type==="integer")&&W.test(l)).map(([l])=>({kind:o,name:l})));if(s.length===0)return;let r=g(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>$e(l,h)&&!W.test(l)).map(([l])=>({kind:o,name:l})));if(r.length===0)return;let n=[...s,...r].map(o=>o.name);for(let o of[...s,...r])t.add("kinds",o.kind),t.add("fields",`${o.kind}.${o.name}`),t.add("acts",...m(e,o.kind).filter(([,a])=>(a.writes??[]).includes(o.name)||a.sets?.[o.name]!==void 0).map(([a])=>a));t.add("rules",...f(e,n).filter(o=>s.some(a=>N(e.rules[o].require??"").has(a.name))));let d=r[0],i=s.find(o=>o.kind===d.kind)??s[0];t.say(`${p(e,d.kind)}' ${u(b(d.name))} against ${i.kind===d.kind?"each one's":`each ${w(e,i.kind)}'s`} ${u(b(i.name))}.`)},places(e,t){for(let[s,r]of g(e)){Y(e,s)&&(t.add("kinds",s),t.add("lenses",...D(e,s,"columns")));for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!Y(e,i)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.say(`${p(e,s)} are at ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="place"&&!(d.type==="string"&&pe.test(n))||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.say(`${p(e,s)} say where (${n}).`))}t.any()&&!t.said&&t.say(`${x([...t.kinds].map(s=>p(e,s)))} are places.`)},sources(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!ke(e,i)&&!/^cite/i.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} cite ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="url"||!/^source/i.test(n)||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} link to their source (${n}).`))}},stock(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([a,l])=>(l.type==="number"||l.type==="integer")&&B.test(a)).map(([a])=>a),d=Object.keys(r.computed??{}).filter(a=>B.test(a)),i=n.some(a=>/reorder/i.test(a)),o=v(e).some(([,a])=>Object.entries(a.fields).some(([l,h])=>/^(change|delta|moved)$/i.test(l)&&(h.type==="number"||h.type==="integer")));!i&&!(d.length+n.length>0&&o)||(t.add("kinds",s),t.add("fields",...n.map(a=>`${s}.${a}`),...d.map(a=>`${s}.${a}`)),t.add("rules",...f(e,[...n,...d],[s])),t.add("acts",...m(e,s).filter(([,a])=>n.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(`${p(e,s)} have a count in stock${i?" and a reorder point":""}.`))}},votes(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.fields)){if(d.type!=="number"&&d.type!=="integer"||!he.test(n))continue;let i=m(e,s).filter(([,o])=>o.sets?.[n]!==void 0).map(([o])=>o);i.length!==0&&(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("acts",...i),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} collect votes (${n}).`))}for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!fe.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} pick ${$(e,i)} (${n}).`))}}},private(e,t){let s=[];for(let r of e.policy?.sees??[])if(!(!r.own&&!r.via)){for(let n of r.kinds)if(e.kinds[n]&&(t.add("kinds",n),s.includes(n)||s.push(n),r.via))for(let[d,i]of v(e))i.edges?.[r.via]&&t.add("relations",`${d}.${r.via}`)}s.length>0&&t.say(`${x(s.map(r=>p(e,r)))} are seen only by whose they are.`)},history(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!be(e,i)||!Object.entries(r.fields).some(([a,l])=>j(l)||/year|result|outcome|score|finish/i.test(a))||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("lenses",...D(e,s,"rows",n),..._(e).filter(a=>a.name==="timeline"&&A(a)[s]!==void 0).map(I).filter(a=>a!==void 0)),t.say(`${p(e,s)} grouped into ${$(e,i)}, a record book.`))}},publishing(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,i])=>i.type==="text").map(([i])=>i);if(n.length===0)continue;let d=Z(e,s).map(i=>i.field);for(let[i,o]of Object.entries(r.fields)){if(o.type!=="enum"||!(X.test(i)||d.includes(i))||!(o.options??[]).some(l=>Q.test(l)))continue;let a=(o.options??[]).find(l=>Q.test(l));t.add("kinds",s),t.add("fields",`${s}.${i}`,...n.map(l=>`${s}.${l}`)),t.add("acts",...m(e,s).filter(([,l])=>l.sets?.[i]===a).map(([l])=>l)),t.add("rules",...f(e,[i,...n],[s]).filter(l=>N(`${e.rules[l].when??""} ${e.rules[l].require??""}`).has(a)||n.some(h=>N(e.rules[l].require??"").has(h)))),t.say(`${p(e,s)} go from ${u(o.options[0])} to ${u(a)}, with their words.`)}}},roster(e,t){for(let[s,r]of g(e)){if(!V(e,s))continue;let n=Object.keys(r.fields);n.length<2||(t.add("kinds",s),t.add("fields",...n.map(d=>`${s}.${d}`)),t.add("lenses",...D(e,s,"columns"),...D(e,s,"rows")),t.say(`${p(e,s)}, with ${x(n.slice(1).map(d=>u(b(d))))}.`))}},routines(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,a])=>j(a)&&a.repeats===!0).map(([a])=>a),d=Object.entries(r.fields).filter(([a,l])=>(l.type==="enum"||l.type==="string"||l.type==="integer"||l.type==="number")&&ue.test(a)).map(([a])=>a),i=Object.entries(r.fields).filter(([a,l])=>j(l)&&ge.test(a)).map(([a])=>a);if(n.length===0&&!(d.length>0&&i.length>0))continue;let o=[...n,...d,...i];t.add("kinds",s),t.add("fields",...o.map(a=>`${s}.${a}`)),t.add("rules",...f(e,o,[s])),t.add("lenses",...o.flatMap(a=>P(e,"calendar",s,"start",a))),t.add("acts",...m(e,s).filter(([,a])=>o.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(n.length>0?`${p(e,s)} repeat (${n[0]}).`:`${p(e,s)} come round again, each with when it was last done.`)}},comparison(e,t){for(let[s,r]of Object.entries(e.rules??{})){if(!r.require||!ye.test(r.require))continue;let n=r.over==="graph"?void 0:r.over,d=/in\('([^']+)'\)/.exec(r.require)?.[1],i=/all\('([^']+)'/.exec(r.require)?.[1],o=n?d?v(e).find(([,l])=>l.edges?.[d])?.[0]:void 0:i&&e.kinds[i]?i:void 0;if(!o&&!n)continue;let a=/==\s*'([^']+)'/.exec(r.require)?.[1];t.add("kinds",...o?[o]:[],...n?[n]:[]),t.add("rules",s),o&&a&&t.add("acts",...m(e,o).filter(([,l])=>Object.values(l.sets??{}).includes(a)).map(([l])=>l)),t.say(o&&n?`${p(e,o)} compared within each ${w(e,n)}, one ${a??"chosen"}.`:o?`${p(e,o)} compared, one ${a??"chosen"}.`:`One ${a??"chosen"} per ${w(e,n)}.`)}}};function E(e){let t=[];for(let s of k){let r=new G;ee[s](e,r),r.any()&&t.push(r.asTrait(s))}return t}function L(e,t){let s=new G;return ee[t](e,s),s.any()}var Oe=e=>Math.round(Math.max(0,Math.min(1,e))*100)/100;function q(e){return e?.type==="noul"&&Number.isFinite(e.noul)?Oe(e.noul):void 0}var Re={add:.7,drop:.7},Fe="propose_change";function Me(e){return M(e)}var De=e=>e.toLowerCase(),Te=e=>e.charAt(0).toUpperCase()+e.slice(1),O=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,Se=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").toLowerCase(),T=(e,t)=>{let s=e.kinds[t];return De(s?.plural??(s?.noun?`${s.noun}s`:`${Se(t)}s`))},xe=e=>k.includes(e),se=(e,t)=>k.indexOf(e)-k.indexOf(t);function je(e){let t=E(e),s=new Set(t.map(r=>r.trait));return{name:e.name,keeps:Object.keys(e.kinds).map(r=>T(e,r)),"made of":t.map(r=>r.said),lacks:k.filter(r=>!s.has(r)).map(r=>y[r])}}function Ne(e,t){let s=new Set(E(t).map(n=>n.trait)),r={};for(let n of k)s.has(n)||(r[`need:${n}`]={type:"noul",instructions:`Does what they asked for need ${y[n]}, which ${t.name} has no part for yet?`,criteria:{true:`It needs ${y[n]}: they asked for it, or what they asked for cannot be kept without it.`,false:"Not asked for, and not needed to keep what they asked for."}});for(let n of Object.keys(t.kinds)){let d=T(t,n);r[`drop:kind:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop keeping ${d}?`,criteria:{true:`They said the ${d} go: to drop them, remove them or stop tracking them.`,false:`${Te(d)} stay: nothing they said asks for them to go.`}}}for(let n of k)s.has(n)&&(r[`drop:trait:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop having ${y[n]}?`,criteria:{true:`They said it goes: to drop or stop ${y[n]}.`,false:"It stays: nothing they said asks for it to go."}});return{state:{said:e,app:je(t)},questions:r}}var te=/^drop:(kind|trait):(.+)$/s;function Ae(e,t={}){let s={...Re,...t},r=Object.keys(e);if(r.length===0)throw new Error("readReshape was handed no answers.");let n=r.filter(o=>!/^need:/.test(o)&&!te.test(o));if(n.length>0)throw new Error(`readReshape does not know the question ${n.map(o=>`"${o}"`).join(", ")}: it reads need:<trait>, drop:kind:<name> and drop:trait:<name>.`);let d={},i={};for(let[o,a]of Object.entries(e)){let l=te.exec(o);if(l){i[`${l[1]}:${l[2]}`]=q(a)??0;continue}let h=o.slice(5);xe(h)&&(d[h]=q(a)??0)}return{add:Object.keys(d).filter(o=>d[o]>=s.add).sort(se),drop:Object.entries(i).filter(([,o])=>o>=s.drop).map(([o])=>o.slice(o.indexOf(":")+1)),needs:d,drops:i}}function Ge(e){let{said:t,document:s}=e,r=[...new Set(e.add)].sort(se),n=[...new Set(e.drop)],d=E(s),i=r.filter(c=>!L(s,c)).map(c=>({what:"trait",name:c,words:y[c],brings:J[c]})),o=r.filter(c=>L(s,c)),a=Object.keys(s.kinds).filter(c=>n.includes(c)),l=d.filter(c=>n.includes(c.trait)&&!Object.hasOwn(s.kinds,c.trait)),h=[...a.map(c=>({what:"kind",name:c,words:T(s,c)})),...l.map(c=>({what:"trait",name:c.trait,words:y[c.trait]}))],C=Object.keys(s.kinds).filter(c=>!a.includes(c)).map(c=>({what:"kind",name:c,words:T(s,c)})),ne=[...a.map(c=>`All ${T(s,c)} records go, with their links.`),...l.flatMap(c=>{let F=[...c.fields,...c.relations];return F.length>0?[`What carries ${y[c.trait]} goes: ${O(F)}, with its values and links.`]:[]})],S=[];i.length>0&&S.push(`adds ${O(i.map(c=>c.words))}`),h.length>0&&S.push(`drops ${O(h.map(c=>c.words))}`),C.length>0&&S.push(`keeps ${O(C.map(c=>c.words))}`);let re=i.length+h.length===0?`Nothing in ${s.name} changes for that.`:`This ${O(S)}.`,ie=o.length>0?` ${s.name} already has ${O(o.map(c=>y[c]))}.`:"";return{said:t,add:i.map(c=>c.name),drop:h.map(c=>c.name),card:{said:`${re}${ie}`,adds:i,keeps:C,drops:h,breaking:ne}}}async function Ue(e){let{state:t,questions:s}=Ne(e.said,e.document),{answers:r,usage:n}=await e.decide(t,s),d=Ae(r,e.thresholds??{}),i=d.add.length+d.drop.length===0?null:Ge({said:e.said,document:e.document,add:d.add,drop:d.drop});return{proposal:i&&i.add.length+i.drop.length===0?null:i,reading:d,answers:r,usage:n}}export{Fe as a,Me as b,Ne as c,Ae as d,Ge as e,Ue as f};
1
+ import{c as M}from"./chunk.OYMN3IFX.js";import{ha as b}from"./chunk.6L6RUOSF.js";var k=["owners","status","schedule","budget","places","sources","stock","votes","private","history","publishing","roster","routines","comparison"],y={owners:"people who own things",status:"a status that moves",schedule:"dates it is due by, or a schedule",budget:"money against a budget",places:"places",sources:"sources behind claims",stock:"counts in stock",votes:"votes or picks",private:"private to its owner",history:"a history, a record book",publishing:"content to publish",roster:"a roster of people",routines:"repeating routines",comparison:"a comparison to pick one from"},J={owners:"a person kind (or the people the app has), an owner link, Give it to someone, a rule that every one has somebody on it, and Who has what",status:"a status with named steps (or the one the app has), an act for each step, and a board",schedule:"a due date, Set the date, the on-time rule, and a calendar",budget:"a cost beside the money the app keeps, a budget on the kind it is grouped under, Set the budget, and the over-budget rule",places:"a place kind, a link to one, and a map of where things are",sources:"a source kind, a link from each claim to its source, and the rule that a claim names one",stock:"what is on hand and the reorder level, Count the stock, and the running-low rule",votes:"a vote on each, Vote for it, and a tally",private:"a sight that keeps each person's own records to them",history:"the record book: an era or season each belongs to, and a timeline",publishing:"a published status, Publish it, and what the public sees",roster:"a person kind with the fields a roster keeps, and the list of who is here",routines:"how often each repeats and when it was last done, Mark it done, and the overdue rule",comparison:"a side-by-side of the candidates, one chosen, and Choose it"},U=new Set(["person","people","member","user","player","guest","candidate","participant","traveler","volunteer","interviewer","interviewee","contact","trade","staff","student","employee","teammate","crew","attendee","friend","customer","client","driver","speaker","host","teacher","parent","kid","child","coach","patient","tenant","resident","neighbor","applicant","recruit","contributor","assignee","worker","collaborator","runner"]),K=new Set(["place","venue","location","room","site","building","store","warehouse","city","country","region","address","hall","stadium","office","shelf"]),z=new Set(["source","reference","citation","evidence"]),H=new Set(["season","era","period","epoch","edition","generation","age","campaign","tournament"]),ae=/owner|owned|assign|^lead$|responsible|^by$|^by-|done-?by|interviewer|reviewer|maker|author|keeper|givenby|^for-?person$/i,oe=/due|deadline|until|needed|needby|target|expires|^ends?(on|at)?$|^by$/i,de=/^(date|day|when|at|start|starts|startsat|startson|startdate|scheduled|scheduledfor|scheduledon|happens|happenson|held|heldon|from|time|exchangedate|.*date|.*day)$/i,le=/released|fixed|published|applied|checked|created|added|done|last|first|updated|seen|born|birth|founded|finished|completed|closed/i,X=/status|stage|state|phase|progress/i,W=/budget|limit|cap$|allowance/i,ce=/budget|cost|price|quote|amount|salary|fee|spend|total|paid|owed/i,pe=/^(place|location|venue|address|where|city|town)$/i,B=/reorder|onhand|instock|^stock|quantity|^qty/i,he=/^votes?$|votecount|upvotes|^score$|^points$/i,fe=/^(votes?|votesfor|votedby|voters|picks?|chooses|choices|favorites|likes)$/i,ue=/often|frequency|cadence|^every$|repeat|interval/i,ge=/^last/i,Q=/^(published|live|public)$/i,ye=/count\(.*\bwhere\b.*\)\s*<=\s*1\b/,u=e=>e.toLowerCase(),w=(e,t)=>u(e.kinds[t]?.noun??b(t)),$=(e,t)=>u(e.kinds[t]?.plural??`${w(e,t)}s`),me=e=>e.charAt(0).toUpperCase()+e.slice(1),p=(e,t)=>me($(e,t)),we=e=>/^[aeiou]/i.test(e)?"an":"a",x=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,N=e=>new Set((e??"").split(/[^A-Za-z0-9_-]+/).filter(Boolean)),v=e=>Object.entries(e.kinds),m=(e,t)=>Object.entries(e.acts??{}).filter(([,s])=>[s.on??[]].flat().includes(t)),_=e=>Array.isArray(e.lenses)?e.lenses:[],I=e=>typeof e.title=="string"?e.title:void 0,A=e=>e.bindings&&typeof e.bindings=="object"?e.bindings:{},R=(e,t)=>Array.isArray(t)&&t.length===1&&typeof t[0]=="string"&&e.kinds[t[0]]?t[0]:void 0;function V(e,t){let s=e.kinds[t];if(!s)return!1;let r=n=>u(n).replace(/ll/g,"l");return s.people===!0||U.has(r(t))||U.has(r(w(e,t)))}var Y=(e,t)=>K.has(u(t))||K.has(w(e,t)),ke=(e,t)=>z.has(u(t))||z.has(w(e,t)),be=(e,t)=>H.has(u(t))||H.has(w(e,t)),$e=(e,t)=>(t.type==="number"||t.type==="integer")&&(t.format==="money"||ce.test(e)),j=e=>e.type==="date"||e.type==="datetime";function P(e,t,s,r,n){return _(e).filter(d=>d.name===t&&A(d)[s]?.[r]===n).map(I).filter(d=>d!==void 0)}function D(e,t,s,r){return _(e).filter(n=>n.name==="coverage"&&A(n)[s]?.kind===t&&(r===void 0||A(n).link?.edge===r)).map(I).filter(n=>n!==void 0)}function f(e,t,s){let r=new Set(t);return Object.entries(e.rules??{}).filter(([,n])=>(s===void 0||n.over==="graph"||s.includes(n.over))&&[...N(`${n.when??""} ${n.require??""} ${n.says??""}`)].some(d=>r.has(d))).map(([n])=>n)}var G=class{kinds=new Set;fields=new Set;relations=new Set;rules=new Set;lenses=new Set;acts=new Set;said;add=(t,...s)=>{for(let r of s)this[t].add(r)};say=t=>{this.said??=t};any=()=>this.kinds.size+this.fields.size+this.relations.size+this.rules.size+this.lenses.size+this.acts.size>0;asTrait=t=>({trait:t,words:y[t],said:this.said??y[t],kinds:[...this.kinds],fields:[...this.fields],relations:[...this.relations],rules:[...this.rules],lenses:[...this.lenses],acts:[...this.acts]})};function ve(e){let t;for(let[s,r]of v(e)){let n=Object.keys(r.fields).length+Object.keys(r.edges??{}).length;(!t||n>t.fields)&&(t={kind:s,fields:n})}return t?.kind}function g(e){let t=ve(e);return v(e).sort(([s],[r])=>+(r===t)-+(s===t))}function Z(e,t){let s=e.kinds[t];if(!s)return[];let r=[];for(let[n,d]of Object.entries(s.fields)){if(d.type!=="enum"||!Array.isArray(d.options)||d.options.length<2)continue;let i=m(e,t).filter(([,a])=>typeof a.sets?.[n]=="string"&&d.options.includes(a.sets[n])).map(([a])=>a);((X.test(n)||s.lifecycle?.field===n)&&i.length>=1||i.length>=2)&&r.push({field:n,options:d.options,steps:i})}return r}var ee={owners(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!V(e,i)||!ae.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("lenses",...D(e,s,"rows",n)),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`Each ${w(e,s)} has one of the ${$(e,i)} on it (${n}).`))}},status(e,t){for(let[s]of g(e))for(let{field:r,options:n,steps:d}of Z(e,s))t.add("kinds",s),t.add("fields",`${s}.${r}`),t.add("acts",...d),t.add("rules",...f(e,[r],[s])),t.add("lenses",...P(e,"columns",s,"column",r)),t.say(`${p(e,s)} move through ${x(n.map(u))}.`)},schedule(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.fields)){if(!j(d)||le.test(n))continue;let i=P(e,"calendar",s,"start",n),o=oe.test(n);if(!o&&!de.test(n)&&i.length===0)continue;t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("lenses",...i),t.add("rules",...f(e,[n],[s])),t.add("acts",...m(e,s).filter(([,l])=>(l.writes??[]).includes(n)||l.sets?.[n]!==void 0).map(([l])=>l));let a=/date|day|when|time/i.test(n)?u(b(n)):`date (${n})`;t.say(o?`${p(e,s)} are due by a date (${n}).`:`${p(e,s)} have ${we(a)} ${a}${i.length>0?", on a calendar":""}.`)}},budget(e,t){let s=v(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>(h.type==="number"||h.type==="integer")&&W.test(l)).map(([l])=>({kind:o,name:l})));if(s.length===0)return;let r=g(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>$e(l,h)&&!W.test(l)).map(([l])=>({kind:o,name:l})));if(r.length===0)return;let n=[...s,...r].map(o=>o.name);for(let o of[...s,...r])t.add("kinds",o.kind),t.add("fields",`${o.kind}.${o.name}`),t.add("acts",...m(e,o.kind).filter(([,a])=>(a.writes??[]).includes(o.name)||a.sets?.[o.name]!==void 0).map(([a])=>a));t.add("rules",...f(e,n).filter(o=>s.some(a=>N(e.rules[o].require??"").has(a.name))));let d=r[0],i=s.find(o=>o.kind===d.kind)??s[0];t.say(`${p(e,d.kind)}' ${u(b(d.name))} against ${i.kind===d.kind?"each one's":`each ${w(e,i.kind)}'s`} ${u(b(i.name))}.`)},places(e,t){for(let[s,r]of g(e)){Y(e,s)&&(t.add("kinds",s),t.add("lenses",...D(e,s,"columns")));for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!Y(e,i)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.say(`${p(e,s)} are at ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="place"&&!(d.type==="string"&&pe.test(n))||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.say(`${p(e,s)} say where (${n}).`))}t.any()&&!t.said&&t.say(`${x([...t.kinds].map(s=>p(e,s)))} are places.`)},sources(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!ke(e,i)&&!/^cite/i.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} cite ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="url"||!/^source/i.test(n)||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} link to their source (${n}).`))}},stock(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([a,l])=>(l.type==="number"||l.type==="integer")&&B.test(a)).map(([a])=>a),d=Object.keys(r.computed??{}).filter(a=>B.test(a)),i=n.some(a=>/reorder/i.test(a)),o=v(e).some(([,a])=>Object.entries(a.fields).some(([l,h])=>/^(change|delta|moved)$/i.test(l)&&(h.type==="number"||h.type==="integer")));!i&&!(d.length+n.length>0&&o)||(t.add("kinds",s),t.add("fields",...n.map(a=>`${s}.${a}`),...d.map(a=>`${s}.${a}`)),t.add("rules",...f(e,[...n,...d],[s])),t.add("acts",...m(e,s).filter(([,a])=>n.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(`${p(e,s)} have a count in stock${i?" and a reorder point":""}.`))}},votes(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.fields)){if(d.type!=="number"&&d.type!=="integer"||!he.test(n))continue;let i=m(e,s).filter(([,o])=>o.sets?.[n]!==void 0).map(([o])=>o);i.length!==0&&(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("acts",...i),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} collect votes (${n}).`))}for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!fe.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} pick ${$(e,i)} (${n}).`))}}},private(e,t){let s=[];for(let r of e.policy?.sees??[])if(!(!r.own&&!r.via)){for(let n of r.kinds)if(e.kinds[n]&&(t.add("kinds",n),s.includes(n)||s.push(n),r.via))for(let[d,i]of v(e))i.edges?.[r.via]&&t.add("relations",`${d}.${r.via}`)}s.length>0&&t.say(`${x(s.map(r=>p(e,r)))} are seen only by whose they are.`)},history(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!be(e,i)||!Object.entries(r.fields).some(([a,l])=>j(l)||/year|result|outcome|score|finish/i.test(a))||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("lenses",...D(e,s,"rows",n),..._(e).filter(a=>a.name==="timeline"&&A(a)[s]!==void 0).map(I).filter(a=>a!==void 0)),t.say(`${p(e,s)} grouped into ${$(e,i)}, a record book.`))}},publishing(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,i])=>i.type==="text").map(([i])=>i);if(n.length===0)continue;let d=Z(e,s).map(i=>i.field);for(let[i,o]of Object.entries(r.fields)){if(o.type!=="enum"||!(X.test(i)||d.includes(i))||!(o.options??[]).some(l=>Q.test(l)))continue;let a=(o.options??[]).find(l=>Q.test(l));t.add("kinds",s),t.add("fields",`${s}.${i}`,...n.map(l=>`${s}.${l}`)),t.add("acts",...m(e,s).filter(([,l])=>l.sets?.[i]===a).map(([l])=>l)),t.add("rules",...f(e,[i,...n],[s]).filter(l=>N(`${e.rules[l].when??""} ${e.rules[l].require??""}`).has(a)||n.some(h=>N(e.rules[l].require??"").has(h)))),t.say(`${p(e,s)} go from ${u(o.options[0])} to ${u(a)}, with their words.`)}}},roster(e,t){for(let[s,r]of g(e)){if(!V(e,s))continue;let n=Object.keys(r.fields);n.length<2||(t.add("kinds",s),t.add("fields",...n.map(d=>`${s}.${d}`)),t.add("lenses",...D(e,s,"columns"),...D(e,s,"rows")),t.say(`${p(e,s)}, with ${x(n.slice(1).map(d=>u(b(d))))}.`))}},routines(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,a])=>j(a)&&a.repeats===!0).map(([a])=>a),d=Object.entries(r.fields).filter(([a,l])=>(l.type==="enum"||l.type==="string"||l.type==="integer"||l.type==="number")&&ue.test(a)).map(([a])=>a),i=Object.entries(r.fields).filter(([a,l])=>j(l)&&ge.test(a)).map(([a])=>a);if(n.length===0&&!(d.length>0&&i.length>0))continue;let o=[...n,...d,...i];t.add("kinds",s),t.add("fields",...o.map(a=>`${s}.${a}`)),t.add("rules",...f(e,o,[s])),t.add("lenses",...o.flatMap(a=>P(e,"calendar",s,"start",a))),t.add("acts",...m(e,s).filter(([,a])=>o.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(n.length>0?`${p(e,s)} repeat (${n[0]}).`:`${p(e,s)} come round again, each with when it was last done.`)}},comparison(e,t){for(let[s,r]of Object.entries(e.rules??{})){if(!r.require||!ye.test(r.require))continue;let n=r.over==="graph"?void 0:r.over,d=/in\('([^']+)'\)/.exec(r.require)?.[1],i=/all\('([^']+)'/.exec(r.require)?.[1],o=n?d?v(e).find(([,l])=>l.edges?.[d])?.[0]:void 0:i&&e.kinds[i]?i:void 0;if(!o&&!n)continue;let a=/==\s*'([^']+)'/.exec(r.require)?.[1];t.add("kinds",...o?[o]:[],...n?[n]:[]),t.add("rules",s),o&&a&&t.add("acts",...m(e,o).filter(([,l])=>Object.values(l.sets??{}).includes(a)).map(([l])=>l)),t.say(o&&n?`${p(e,o)} compared within each ${w(e,n)}, one ${a??"chosen"}.`:o?`${p(e,o)} compared, one ${a??"chosen"}.`:`One ${a??"chosen"} per ${w(e,n)}.`)}}};function E(e){let t=[];for(let s of k){let r=new G;ee[s](e,r),r.any()&&t.push(r.asTrait(s))}return t}function L(e,t){let s=new G;return ee[t](e,s),s.any()}var Oe=e=>Math.round(Math.max(0,Math.min(1,e))*100)/100;function q(e){return e?.type==="noul"&&Number.isFinite(e.noul)?Oe(e.noul):void 0}var Re={add:.7,drop:.7},Fe="propose_change";function Me(e){return M(e)}var De=e=>e.toLowerCase(),Te=e=>e.charAt(0).toUpperCase()+e.slice(1),O=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,Se=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").toLowerCase(),T=(e,t)=>{let s=e.kinds[t];return De(s?.plural??(s?.noun?`${s.noun}s`:`${Se(t)}s`))},xe=e=>k.includes(e),se=(e,t)=>k.indexOf(e)-k.indexOf(t);function je(e){let t=E(e),s=new Set(t.map(r=>r.trait));return{name:e.name,keeps:Object.keys(e.kinds).map(r=>T(e,r)),"made of":t.map(r=>r.said),lacks:k.filter(r=>!s.has(r)).map(r=>y[r])}}function Ne(e,t){let s=new Set(E(t).map(n=>n.trait)),r={};for(let n of k)s.has(n)||(r[`need:${n}`]={type:"noul",instructions:`Does what they asked for need ${y[n]}, which ${t.name} has no part for yet?`,criteria:{true:`It needs ${y[n]}: they asked for it, or what they asked for cannot be kept without it.`,false:"Not asked for, and not needed to keep what they asked for."}});for(let n of Object.keys(t.kinds)){let d=T(t,n);r[`drop:kind:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop keeping ${d}?`,criteria:{true:`They said the ${d} go: to drop them, remove them or stop tracking them.`,false:`${Te(d)} stay: nothing they said asks for them to go.`}}}for(let n of k)s.has(n)&&(r[`drop:trait:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop having ${y[n]}?`,criteria:{true:`They said it goes: to drop or stop ${y[n]}.`,false:"It stays: nothing they said asks for it to go."}});return{state:{said:e,app:je(t)},questions:r}}var te=/^drop:(kind|trait):(.+)$/s;function Ae(e,t={}){let s={...Re,...t},r=Object.keys(e);if(r.length===0)throw new Error("readReshape was handed no answers.");let n=r.filter(o=>!/^need:/.test(o)&&!te.test(o));if(n.length>0)throw new Error(`readReshape does not know the question ${n.map(o=>`"${o}"`).join(", ")}: it reads need:<trait>, drop:kind:<name> and drop:trait:<name>.`);let d={},i={};for(let[o,a]of Object.entries(e)){let l=te.exec(o);if(l){i[`${l[1]}:${l[2]}`]=q(a)??0;continue}let h=o.slice(5);xe(h)&&(d[h]=q(a)??0)}return{add:Object.keys(d).filter(o=>d[o]>=s.add).sort(se),drop:Object.entries(i).filter(([,o])=>o>=s.drop).map(([o])=>o.slice(o.indexOf(":")+1)),needs:d,drops:i}}function Ge(e){let{said:t,document:s}=e,r=[...new Set(e.add)].sort(se),n=[...new Set(e.drop)],d=E(s),i=r.filter(c=>!L(s,c)).map(c=>({what:"trait",name:c,words:y[c],brings:J[c]})),o=r.filter(c=>L(s,c)),a=Object.keys(s.kinds).filter(c=>n.includes(c)),l=d.filter(c=>n.includes(c.trait)&&!Object.hasOwn(s.kinds,c.trait)),h=[...a.map(c=>({what:"kind",name:c,words:T(s,c)})),...l.map(c=>({what:"trait",name:c.trait,words:y[c.trait]}))],C=Object.keys(s.kinds).filter(c=>!a.includes(c)).map(c=>({what:"kind",name:c,words:T(s,c)})),ne=[...a.map(c=>`All ${T(s,c)} records go, with their links.`),...l.flatMap(c=>{let F=[...c.fields,...c.relations];return F.length>0?[`What carries ${y[c.trait]} goes: ${O(F)}, with its values and links.`]:[]})],S=[];i.length>0&&S.push(`adds ${O(i.map(c=>c.words))}`),h.length>0&&S.push(`drops ${O(h.map(c=>c.words))}`),C.length>0&&S.push(`keeps ${O(C.map(c=>c.words))}`);let re=i.length+h.length===0?`Nothing in ${s.name} changes for that.`:`This ${O(S)}.`,ie=o.length>0?` ${s.name} already has ${O(o.map(c=>y[c]))}.`:"";return{said:t,add:i.map(c=>c.name),drop:h.map(c=>c.name),card:{said:`${re}${ie}`,adds:i,keeps:C,drops:h,breaking:ne}}}async function Ue(e){let{state:t,questions:s}=Ne(e.said,e.document),{answers:r,usage:n}=await e.decide(t,s),d=Ae(r,e.thresholds??{}),i=d.add.length+d.drop.length===0?null:Ge({said:e.said,document:e.document,add:d.add,drop:d.drop});return{proposal:i&&i.add.length+i.drop.length===0?null:i,reading:d,answers:r,usage:n}}export{Fe as a,Me as b,Ne as c,Ae as d,Ge as e,Ue as f};
@@ -1 +1 @@
1
- import{C as o}from"./chunk.IUVRJDL3.js";var r=Symbol.for("@graview/core:markdown");function t(e){let n=o(e);return!!n&&(n[r]===1||t(n.innerType))}export{t as a};
1
+ import{C as o}from"./chunk.6L6RUOSF.js";var r=Symbol.for("@graview/core:markdown");function t(e){let n=o(e);return!!n&&(n[r]===1||t(n.innerType))}export{t as a};
@@ -0,0 +1,2 @@
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 Ve,b as Yt}from"./chunk.KHRS2SKB.js";import"./chunk.T6PU3NKP.js";import"./chunk.U6V4KZF5.js";import"./chunk.6ZRVVRDQ.js";import{j as Ut,k as Gt,l as Qt}from"./chunk.JLNTE5CH.js";import"./chunk.DDSAFU3B.js";import"./chunk.4QMAYVPU.js";import"./chunk.ZONRIOIA.js";import"./chunk.NXHEOHRR.js";import"./chunk.HJCQ6I3S.js";import"./chunk.DJGZOPAS.js";import"./chunk.GFOZVQBQ.js";import{a as Wt}from"./chunk.5OS4SYHE.js";import"./chunk.G767NLBH.js";import{a as qt,b as O}from"./chunk.MEAUTBVM.js";import{a as Ye,b as jt}from"./chunk.OKHXXIMN.js";import"./chunk.NH3VXTGX.js";import"./chunk.6IMRCKB4.js";import"./chunk.RDUGUC7R.js";import"./chunk.TBY5IR7C.js";import"./chunk.PQTXM4VY.js";import"./chunk.BIDL7GQD.js";import"./chunk.7KX36ENH.js";import"./chunk.QDDDKEBH.js";import{b as Kt,c as Bt}from"./chunk.QKRQPUCE.js";import"./chunk.SPJ34VHA.js";import"./chunk.XOZU4OFA.js";import"./chunk.KBJ3UUER.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.4O64QV2Y.js";import"./chunk.OYMN3IFX.js";import"./chunk.YFVJUHAK.js";import"./chunk.UQZ2P6KD.js";import"./chunk.NI4OPHTL.js";import"./chunk.U5KJQFAP.js";import"./chunk.FOHZPYUV.js";import"./chunk.IXYG65TM.js";import"./chunk.W6L2VAJG.js";import"./chunk.N3MXLORL.js";import{v as Ft}from"./chunk.3CLTABGP.js";import"./chunk.RD2FSSLV.js";import"./chunk.CVN2XFMF.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import{l as _t}from"./chunk.VVIQSFM4.js";import{b as zt}from"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import{a as Be,c as Ue,e as Ge,f as Nt,m as Qe}from"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import{$a as Pt,G as Se,Sa as Ke,Xa as Dt,Y as Ot,ga as xe,h as Lt,u as It}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import{Qb as Et,Tc as $t,Zb as Rt,qa as At,td as Ht,ua as ve,va as ke,zd as Ct}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import{b as ee}from"./chunk.AJZBJBMO.js";var s=ee(Se(),1);function Vt(a){return a.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(Boolean)}function Jt(a,r){let n=Vt(r);if(n.length===0)return!0;let l=Vt(a);return n.every(b=>l.some(m=>m.startsWith(b)))}var te=ee(Se(),1),Je=250,Xe=.2,In=a=>a===void 0||a.off?void 0:a.fast??(a.decide?{model:a.name??"decide",decide:a.decide}:void 0);function Xt(a,r,n){let[l,b]=(0,te.useState)(null),m=(0,te.useRef)(n);m.current=n;let y=n.map(c=>`${c.key}\0${c.label}`).join(""),u=In(a);return(0,te.useEffect)(()=>{let c=r.trim();if(!u||c===""||m.current.length===0)return;let g=!0,x=new Map(m.current.map((w,f)=>[`r${f+1}`,w])),v=setTimeout(()=>{u.decide({typed:c},{row:{type:"choice",instructions:`Which of these menu rows does somebody typing \u201C${c}\u201D mean?`,criteria:{...Object.fromEntries([...x].map(([w,f])=>[w,f.label])),none:"None of these rows"}}}).then(w=>{a?.meter?.({tier:"fast",model:u.model,inputTokens:w.usage.inputTokens,outputTokens:w.usage.outputTokens,interaction:"menu"});let f=w.answers.row;if(!g||f?.type!=="choice")return;let k=new Map;for(let[G,ne]of Object.entries(f.probabilities)){let B=x.get(G);B&&k.set(B.key,ne)}if(f.choice==="none")return b({words:c,chances:new Map});let S=x.get(f.choice);S&&!k.has(S.key)&&k.set(S.key,f.confidence),b({words:c,chances:k})}).catch(()=>{})},Je);return()=>{g=!1,clearTimeout(v)}},[r,y,u===void 0]),l!==null&&l.words===r.trim()?l.chances:null}var N=ee(Se(),1),en=2,Zt,On=()=>Zt??=(__graviewPreload(import.meta.url,["./chunk.QNWGDG2Z.js","./chunk.BJUUSIQY.js","./chunk.U5KJQFAP.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.CEJIH3CN.js")).catch(a=>(Zt=void 0,Promise.reject(a)));function tn(a,r,n,l,b,m,y=4){let u=a&&!a.off?a.told:void 0,c=l.trim()!=="",[g,x]=(0,N.useState)(null);(0,N.useEffect)(()=>x(null),[m]);let[v,w]=(0,N.useState)(!1);return(0,N.useEffect)(()=>{if(!u||m===null||m===void 0)return;let f=globalThis;if(!f.requestIdleCallback)return;let k=f.requestIdleCallback(()=>w(!0),{timeout:3e3});return()=>f.cancelIdleCallback?.(k)},[u,m]),(0,N.useEffect)(()=>{if(!u||g||!(c||v))return;let f=!0;return On().then(async k=>{let S=await k.readToldHere(u,r,n);f&&x({tellings:S,module:k})}).catch(()=>{}),()=>{f=!1}},[u,c,v,g,r,n]),(0,N.useMemo)(()=>g?c?g.module.toldSuggestionsFrom(g.tellings,r,n,l,b,y):g.module.toldForHere(g.tellings,r,n,b,3):[],[g,c,l,r,n,b,y])}var K=ee(Se(),1),nn=a=>a.replace(/\s*…\s*$/u,"").replace(/\s+/g," ").trim().toLowerCase();function rn(a,r,n={},l){if(!r)return[];let b=[],m=[];for(let y of a){if(y.destructive||y.setsAside||y.ties)continue;let u=y.open.filter(f=>!f.optional);if(u.length===0&&y.open.length===0&&l){let f=y.label.replace(/\b(it|this one|this)\b/u,`\u201C${l}\u201D`);m.push({key:`act:${y.id}`,label:f!==y.label?f:`${y.label} \u201C${l}\u201D`,mode:"chat",source:"act"});continue}let c=u[0];if(u.length!==1||c?.shape?.type!=="choice"||!c.shape.options||c.shape.options.length<2)continue;let g=c.shape.options,x=g.indexOf(String(r[c.name]??"")),v=x>=0?g[x+1]:void 0;if(v===void 0)continue;let w=n[c.name]?.[v]??v.replace(/[-_]+/g," ").replace(/^./u,f=>f.toUpperCase());b.push({key:`act:${y.id}:${v}`,label:`${y.label.replace(/\s*…\s*$/u,"")} to ${w}`,mode:"chat",source:"act"})}return[...b,...m]}function an(a,r){let n=new Set(r.map(nn));return a.filter(l=>!n.has(nn(l.label)))}var Dn=3,Pn=a=>a===void 0||a.off||a.suggestOnOpen===!1?void 0:a.fast??(a.decide?{model:a.name??"decide",decide:a.decide}:void 0),Ze=new WeakMap,on=(a,r)=>a?Ze.get(a)?.get(r):void 0;function Nn(a){let r=u=>a.filter(c=>c.source===u),[n,l,b]=[r("nudge"),r("told"),r("act")],m=[],y=Math.max(n.length,l.length,b.length);for(let u=0;u<y;u++)for(let c of[n,l,b])c[u]&&m.push(c[u]);return m}function ln(a,r,n,l){let b=Pn(a),m=r.map(v=>`${v.key}\0${v.label}`).join(""),[y,u]=(0,K.useState)(null),c=on(n.depends,m)??y;(0,K.useEffect)(()=>{if(on(n.depends,m)||(u(null),!b||r.length===0||n.opened===null||n.opened===void 0))return;let v=!0,w=new Map(r.map((k,S)=>[`s${S+1}`,k])),f={pick:{type:"choice",instructions:`Somebody right-clicked \u201C${n.name}\u201D in an app. Which of these would they most likely want to do next?`,criteria:Object.fromEntries([...w].map(([k,S])=>[k,S.label]))}};if(n.better)for(let[k,S]of w)f[`about_${k}`]={type:"choice",instructions:`Is \u201C${S.label}\u201D about how \u201C${n.name}\u201D looks or is laid out, or about the records in it?`,criteria:{look:"How it looks or is laid out: style, size, what each row or card shows, its order or grouping",records:"The records themselves: changing, finishing, adding, assigning or asking about them"}};return b.decide({on:n.name},f).then(k=>{if(a?.meter?.({tier:"fast",model:b.model,inputTokens:k.usage.inputTokens,outputTokens:k.usage.outputTokens,interaction:"menu"}),!v)return;let S=k.answers.pick,G=R=>S?.type==="choice"?S.probabilities[R]??(S.choice===R?S.confidence:0):0,ne=[...w.keys()].sort((R,oe)=>G(oe)-G(R)).map(R=>w.get(R).key),B=new Map;for(let[R,oe]of w){let Q=k.answers[`about_${R}`];Q?.type==="choice"&&B.set(oe.key,Q.choice==="look"?"better":"chat")}let p={said:m,order:ne,modes:B};if(n.depends){let R=Ze.get(n.depends)??new Map;R.set(m,p),Ze.set(n.depends,R)}u(p)}).catch(()=>{}),()=>{v=!1}},[m,n.opened,n.depends,b===void 0]);let g=(0,K.useMemo)(()=>(c&&c.said===m?c.order.map(w=>r.find(f=>f.key===w)).filter(Boolean):Nn(r)).slice(0,Dn).map(w=>({...w,mode:c?.modes.get(w.key)??w.mode})),[c,m,r]),x=(0,K.useRef)(g);return l||(x.current=g),l?x.current:g}var i=ee(Ot(),1);function mo(a,r,n){let l=r.on??r.about[r.about.length-1];Ut(a,r.about,{...n,pins:Ve(),...l===void 0?{}:{focus:l}})}function fo({placement:a="float",chosen:r=!0}={}){let{menuAt:n}=xe();return a==="menu"&&n===null?r?(0,i.jsx)(Wn,{}):null:(0,i.jsx)(_n,{placement:a})}function Wn(){let{store:a,setMenuAt:r,view:n}=xe(),{selection:l}=Ke(),b=(0,s.useRef)(null),[m,y]=(0,s.useState)(null),[u,c]=(0,s.useState)(null);(0,s.useLayoutEffect)(()=>{let x=b.current?.offsetParent??b.current?.parentElement;if(!x)return;let v=x.getBoundingClientRect(),w=Math.round(v.width);w!==m&&y(w);let f=[...x.querySelectorAll('[data-testid="lines-key"][data-graview-up-row], [data-testid="overview"]')].map(S=>S.getBoundingClientRect()).filter(S=>S.width>0&&S.top-v.top<40),k=f.length>0?Math.round(v.right-Math.min(...f.map(S=>S.left))+8):null;k!==u&&c(k)});let g=l.length===1&&!n.overview?a.graph.getNode(l[0]):void 0;return!g||m===null||m>=un?(0,i.jsx)("span",{ref:b,hidden:!0}):(0,i.jsx)("button",{type:"button",ref:b,"data-testid":"chosen-acts","aria-label":`What can be done with ${O(a,g.id)}`,"aria-haspopup":"menu",onClick:x=>{let v=x.currentTarget.getBoundingClientRect();r({x:Math.round(v.right),y:Math.round(v.bottom+4),on:g.id})},style:{position:"absolute",...u!==null?{right:u,top:14,minHeight:38}:{right:"calc(14px + var(--graview-dock, 0px))",top:98},zIndex:"var(--graview-layer-overview, 10)",...u===null?{minHeight:30}:{},padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}function zn(a,r,n){let l=u=>ke(a.schema.tryDefinition(u),u),b=u=>At(a.schema,u).toLowerCase(),m=r.filter(u=>a.allMutations().some(c=>{let g=c.subject;return g?.kinds==="*"||(g?.kinds??[]).includes(u)})),y=n.length!==1||n.some(u=>u.startsWith("aggregate:"));return m.length>0&&y?r.length===1?`Nothing here is done to all the ${b(r[0])} at once. Right-click one ${l(r[0])} to see what you can do with it.`:"Nothing here is done to all of these at once. Right-click one of them to see what you can do with it.":m.length>0?`There is nothing you can do with ${r.length===1?ve(l(r[0])):"these"} here right now.`:r.length===1?`There is nothing to do with ${ve(l(r[0]))} in this app yet.`:"There is nothing to do with these in this app yet."}var un=564;function _n({placement:a}){let{store:r,menuAt:n,setMenuAt:l,view:b,signIn:m,aiDesk:y,ai:u,principal:c}=xe(),g=(0,s.useRef)(null),x=(0,s.useRef)(null),v=(0,s.useRef)(null),w=(0,s.useRef)(null);n?.returnTo&&(w.current=n.returnTo);let f=e=>{let t=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),o=e.getAttribute("data-pin-for"),d=t??e.getAttribute("data-affordance")??(o===null?null:`pin:${o}`)??e.getAttribute("data-menu-item");x.current=d===null?null:{key:d,element:e}};(0,s.useEffect)(()=>{let e=g.current,t=x.current;if(t===null||document.activeElement!==document.body||t.element.isConnected)return;let o=t.key;if(!e){x.current=null;let M=w.current;w.current=null,(M?.isConnected?M:v.current)?.focus();return}((o.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(o.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(o)}"]:not([disabled])`)??e).focus()});let[k,S]=(0,s.useState)(null);(0,s.useLayoutEffect)(()=>{let e=g.current?.offsetParent??g.current?.parentElement;if(e instanceof HTMLElement&&(v.current=e),!e)return;let t=e.getBoundingClientRect();S(o=>o&&o.left===t.left&&o.top===t.top&&o.width===t.width&&o.height===t.height?o:{left:t.left,top:t.top,width:t.width,height:t.height})});let{selection:G,set:ne,clear:B}=Ke(),p=n?.about??G,[R,oe]=(0,s.useState)(()=>Ve()),Q=n?.on??p[p.length-1],Ae=n?.about,gn=(0,s.useMemo)(()=>({pins:R,...Q===void 0?{}:{focus:Q},...Ae?{about:Ae}:{}}),[R,Q,Ae]),pn=(0,s.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:T,withheld:de,observations:Ee}=Gt(gn),re=$t(de,m),D=re?Gn:de,hn=n===null?null:{face:n.face??"scene",on:n.on,about:p,field:n.field,place:n.place,href:n.href,act:n.act,column:n.column,...n.section?{section:n.section}:{},...n.page?{page:n.page}:{},element:n.returnTo},P=Ft(hn),tt=Ee.some(e=>e.id.startsWith("schema:waits:")),{apply:mn,preview:fn}=Qt(),[ie,Y]=(0,s.useState)(null),[Re,yn]=(0,s.useState)(null),[nt,$e]=(0,s.useState)(!1),[ot,rt]=(0,s.useState)(!1),[ue,ce]=(0,s.useState)(""),bn=jt({letters:n===null}),[H,ge]=(0,s.useState)(""),it=(0,s.useRef)(null);(0,s.useEffect)(()=>ge(""),[n]);let V=Nt(y),U=tn(V?u:void 0,r,c,n===null?"":H,n?.on,n),wn=(0,s.useMemo)(()=>n===null?[]:[...P.start.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...T.map(e=>({key:`act:${e.id}`,label:e.label})),...P.end.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...U.map(e=>({key:e.key,label:e.label}))],[n,P,T,U]),at=Xt(u,n===null?"":H,wn),[ae,lt]=(0,s.useState)(!1),He=(0,s.useRef)({words:"",rank:null});ae||(He.current={words:H.trim(),rank:at});let W=ae?He.current.words===H.trim()?He.current.rank:null:at,L=(0,s.useMemo)(()=>[...P.start,...P.end].find(e=>e.mode)?.mode,[P]),$=n===null?[]:[...V?["chat"]:[],...L?["better"]:[]],[vn,st]=(0,s.useState)(null),[Ce,kn]=(0,s.useState)(null);(0,s.useEffect)(()=>st(null),[n,H]),(0,s.useEffect)(()=>{let e=H.trim();if(!L||!V||e==="")return;let t=!0,o=setTimeout(()=>void L.claims(e).then(d=>t&&kn({words:e,mode:d?"better":"chat"}),()=>{}),Je);return()=>{t=!1,clearTimeout(o)}},[H,L,V]);let pe=$.length===0?null:vn??($.length===1?$[0]:Ce&&Ce.words===H.trim()?Ce.mode:"chat"),Sn=(0,s.useMemo)(()=>{if(n===null||$.length===0)return[];let e=(L?.nudges?.()??[]).map((C,q)=>({key:`nudge:${q}`,label:C,mode:"better",source:"nudge"})),t=U.slice(0,2).map(C=>({key:C.key,label:C.label,mode:"chat",source:"told"})),o=n.on??(p.length===1?p[0]:void 0),d=o!==void 0?r.graph.getNode(o):void 0,M=rn(T,d,d?Ht(r.schema,[d.kind])[d.kind]:void 0,d?O(r,d.id):void 0).slice(0,2);return an(V?[...e,...t,...M]:e,[...T,...de].map(C=>C.label))},[n,$.length,L,U,T,de,V,r,p]),xn=(0,s.useMemo)(()=>(n?.on!==void 0?r.graph.getNode(n.on):void 0)??jn(r),[n,r,T]),Le=ln(u,Sn,{name:n?.title??(p.length===1?O(r,p[0]):"this"),opened:n,better:L!==void 0,depends:xn},ae),[dt,Ie]=(0,s.useState)(null),Oe=(0,s.useRef)([]),he=(e,t)=>{try{return fn(e,t),mn(e,t),Ie(null),l(null),Oe.current=[],!0}catch(o){return Ie(_t(r.schema,r.allMutations(),o)),Oe.current=o instanceof Rt?o.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},me=[...new Set(p.flatMap(e=>{let t=r.graph.getNode(e);return t?[t.kind]:[]}))],fe=me.length>0?me:[...new Set(p.flatMap(e=>It(e)))],A=p.length===1?Lt(p[0]):null,De=A?{from:r.graph.getNode(A.from),to:r.graph.getNode(A.to)}:null,ut=A?Bt(r,A):void 0,ct=ut?.provisional?ut:void 0,gt=A?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(A.from)?.kind??"")?.edges?.[A.kind],t=r.graph.getNode(A.to);return e?.inverse&&t?`From ${O(r,t.id)}: ${e.inverse}`:null})():null;(0,s.useEffect)(()=>{Y(null),$e(!1),rt(!1),Ie(null),ce("")},[p,n?.about]);let pt=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=n?.begin;if(!e||pt.current===n)return;let t=T.find(d=>d.mutation===e.act);if(!t)return;pt.current=n;let o={...e.given};yn({id:t.id,given:o}),t.open.every(d=>d.name in o)?he({...t,args:{...t.args,...o},open:[]}):Y(t.id)},[n,T]);let h=n!==null,Mn=a==="menu"&&!h,J=(0,s.useRef)(n);J.current=n;let ht=Pt("acts",{open:h&&a==="menu",onOpenChange:e=>{e||l(null)},at:()=>J.current?{x:J.current.x,y:J.current.y}:null,returnTo:()=>{let e=J.current?.returnTo;if(e?.isConnected)return e;let t=J.current?.on;return t?document.querySelector(`[data-graview-view="${CSS.escape(t)}"]`):null},align:"start"}),mt=(k?.width??Number.POSITIVE_INFINITY)<un;if((0,s.useLayoutEffect)(()=>{let e=g.current?.offsetParent;if(!e||!mt||h)return;let t=g.current?.getBoundingClientRect().height??0,o=`${Math.round(t)+20}px`;if(e.style.paddingBottom===o)return;let d=e.style.paddingBottom;return e.style.paddingBottom=o,()=>{e.style.paddingBottom=d}}),p.length===0&&!h)return null;let ft=n?.title!==void 0||p.length>0&&!(p.length===1&&p[0]===b.focusId),le=h?4:Math.max(1,Math.min(9,T.length)),z=[...T.filter(e=>e.provider==="invariant"&&!e.destructive),...T.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...T.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...T.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...T.filter(e=>e.destructive)],yt=z.length>le&&!h,bt=ue.trim().toLowerCase(),_=yt&&bt.length>0?z.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(bt)):null,E=h?H.trim():"",Pe=(e,t)=>E===""||Jt(t,E)||(W?.get(e)??0)>=Xe,F=(_??(nt||h?z:z.slice(0,le))).filter(e=>Pe(`act:${e.id}`,e.label)),wt=_||E?0:z.length-F.length,ye=E?D.filter(e=>Pe(`act:${e.id}`,e.label)):D,vt=e=>E===""?e:e.flatMap(t=>{let o=(t.items??[]).filter(d=>Pe(`item:${d.id}`,d.label));return o.length>0?[{id:t.id,...t.heading?{heading:t.heading}:{},items:o}]:[]}),j=h&&!nt&&E==="",Ne=vt(P.start).filter(e=>(e.items?.length??0)>0||e.render),be=vt(P.end).filter(e=>(e.items?.length??0)>0||e.render),kt=new Set(j?F.slice(le).map(e=>e.id):[]),We=j&&z.length>=le,Tn=j&&(z.length>le||We&&D.length>0||Ee.length>0||P.end.some(e=>(e.items?.length??0)>0||e.render)),An=n?.title??(p.length===1?O(r,p[0]):p.length>1?`${p.length} selected`:"this"),St=h&&E!==""&&$.length>0,ze=h&&E!==""?(W===null?U:[...U].sort((e,t)=>(W.get(t.key)??0)-(W.get(e.key)??0))).slice(0,en):[],En=[...Ne.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...F.filter(e=>!e.destructive).map(e=>`act:${e.id}`),...be.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...ze.map(e=>e.key)],Rn=W===null?void 0:[...En].sort((e,t)=>(W.get(t)??0)-(W.get(e)??0)).find(e=>(W.get(e)??0)>=Xe),I=E===""?null:Rn??Ne.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??F.filter(e=>!e.destructive).map(e=>`act:${e.id}`)[0]??be.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??(St&&pe?"mode":null),$n=(e=E)=>{if(!n)return;let t=n.returnTo??null,o=Be(g.current);l(null),Ge(y,{pointed:{on:n.on,about:p,field:n.field,place:n.place},...e?{asked:e}:{},returnTo:t,...o?{from:o}:{}})},_e=(e,t=E)=>{if(n){if(e==="chat")return $n(t);l(null),L?.open(t||void 0)}},Hn=e=>{let t=e.source==="told"?U.find(o=>o.key===e.key):void 0;if(t&&e.mode==="chat")return xt(t);_e(e.mode==="better"&&L?"better":"chat",e.label)},xt=e=>{if(!n)return;let t=n.returnTo??null,o=Be(g.current);l(null),Ge(y,{pointed:{on:n.on,about:p,field:n.field,place:n.place},asked:e.label,suggested:e.telling.id,returnTo:t,...o?{from:o}:{}})},Fe=()=>[...g.current?.querySelectorAll("[data-affordance]:not([disabled]), [data-menu-item]:not([data-menu-mode])")??[]].filter(e=>e.closest("[data-graview-asking], [hidden]")===null),je=()=>g.current?.querySelector("[data-menu-lit]")??null,Cn=e=>{let t=e.target,o=it.current;if(!o||t===o||e.metaKey||e.ctrlKey||e.altKey||t.closest("[data-graview-asking]")||Fn(t))return;let d=e.key.length===1&&e.key!==" ";if(d||e.key==="Backspace"&&H!==""){e.preventDefault(),e.stopPropagation(),d&&H===""&&y&&Ue(y),ge(M=>d?M+e.key:M.slice(0,-1)),o.focus({preventScroll:!0});return}e.key==="ArrowUp"&&Fe()[0]===t&&(e.preventDefault(),e.stopPropagation(),o.focus({preventScroll:!0}))},we=[];for(let e of F){let t=!h&&e.provider==="invariant",o=!h&&!t&&e.pinned!==void 0&&!e.destructive,d=!h&&!t&&!o&&e.ties===!0&&!e.destructive,M=t?e.why:o?"pinned":d?"its ties":null,C=t?"violation":o||d?"ties":null,q=we[we.length-1];q&&q.heading===M?q.items.push(e):we.push({heading:M,tone:C,items:[e]})}let X=T.find(e=>e.id===ie),qe=X&&Re?.id===X.id?{...X,args:{...X.args,...Re.given},open:X.open.filter(e=>!(e.name in Re.given))}:X,se=p.length===1?O(r,p[0]):null,Mt=e=>{if(!se)return e;let t=e.startsWith(`"${se}"`)?e.slice(se.length+2):e.startsWith(se)?e.slice(se.length):null;if(t===null)return e;let o=t.trimStart();return o.length===0?e:o[0].toUpperCase()+o.slice(1)},Ln=new Set(h?[]:F.filter(e=>e.provider==="invariant").map(e=>e.why)),Z=Ee.filter(e=>!Ln.has(e.text)).map(e=>({...e,text:Mt(e.text)}));return Mn?null:(0,i.jsxs)("section",{...h?ht.pane:{},ref:e=>{g.current=e,h&&ht.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":h?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>f(e.target),onBlur:e=>{e.relatedTarget!==null&&(x.current=null)},onMouseDown:e=>e.stopPropagation(),onKeyDownCapture:h?e=>Cn(e):void 0,onPointerMove:h?e=>{let t=e.target.closest?.("[data-menu-item], [data-affordance]")!=null;t!==ae&&lt(t)}:void 0,onPointerLeave:h&&ae?()=>lt(!1):void 0,style:{...h?Dt:{position:"absolute",zIndex:Ct("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...h?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:mt?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:b.overview?"min(296px, 38cqh)":44,width:236,maxHeight:b.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,i.jsx)("h2",{style:{...Qe,margin:0},children:"Inspector"}),(0,i.jsxs)("div",{style:{display:ft||!h?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:h?0:24},children:[ft?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:n?.title??(p.length===1?O(r,p[0]):`${p.length} selected`)}),me.length>0||A?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:A?"relation":me.map(e=>ke(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,p.length===1&&!A&&n?.face!=="pages"?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:b.expanded.includes(p[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,i.jsx)("span",{style:{flex:"1 1 auto"}})]}),h?null:(0,i.jsx)("button",{type:"button",onClick:()=>{l(null),B()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),h?(0,i.jsx)("input",{ref:it,type:"text","data-testid":"menu-type",...qn()?{}:{"data-graview-not-first":""},value:H,onChange:e=>{H===""&&e.target.value!==""&&y&&Ue(y),ge(e.target.value)},onKeyDown:e=>{if(e.key==="Enter"){e.preventDefault();let t=je();t?.focus({preventScroll:!0}),t?.click()}else e.key==="ArrowDown"?(e.preventDefault(),(je()??Fe()[0])?.focus()):e.key==="ArrowUp"?(e.preventDefault(),Fe().at(-1)?.focus()):e.key==="Enter"&&!je()&&pe?(e.preventDefault(),_e(pe)):e.key==="Escape"&&H!==""&&(e.preventDefault(),e.stopPropagation(),ge(""))},placeholder:$.length>0?"Tell Graview what you want\u2026":"Type to filter\u2026","aria-label":$.length>0?`Tell Graview what you want with ${An}, or filter what can be done here`:"Filter what can be done here",autoComplete:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"go",style:{boxSizing:"border-box",width:"100%",font:"inherit",fontSize:"max(1rem, 16px)",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,h&&$.length>0?(0,i.jsx)("div",{role:"group","aria-label":$.length>1?"Chat or Better UI":"Chat","data-testid":"menu-modes",style:{display:"flex",gap:6},children:$.map(e=>{let t=pe===e,o=e==="chat"?"Chat":L?.label??"Better UI",d=e==="chat"?"\u{1F4AC}":L?.mark??"\u2728";return(0,i.jsxs)("button",{type:"button","data-menu-mode":e,...e==="chat"?{"data-menu-item":"ask-typed"}:{},"data-menu-lit":I==="mode"&&t||void 0,"aria-pressed":t,"aria-label":E?`${o}: ${E}`:o,onClick:()=>_e(e),onKeyDown:M=>{if(M.key!=="ArrowLeft"&&M.key!=="ArrowRight")return;M.preventDefault(),M.stopPropagation();let C=$[($.indexOf(e)+(M.key==="ArrowRight"?1:$.length-1))%$.length];st(C),g.current?.querySelector(`[data-menu-mode="${C}"]`)?.focus()},style:t?Kn:Bn,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:d})," ",o,I==="mode"&&t?Te:null]},e)})}):null,h&&E===""&&Le.length>0?(0,i.jsxs)("div",{"data-menu-section":"suggested",role:"group","aria-label":"Suggested",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5,minHeight:Le.length*31+22},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:Un,children:"Suggested"}),Le.map((e,t)=>(0,i.jsxs)("button",{type:"button","data-menu-item":`suggested-${t}`,"data-suggested-mode":e.mode,onClick:()=>Hn(e),style:{...Me,display:"flex",gap:8,alignItems:"baseline",minWidth:0},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:"\u2726"}),(0,i.jsx)("span",{title:e.label,style:{flex:"1 1 auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),(0,i.jsxs)("span",{title:e.mode==="better"?"Better UI":"Chat",style:{fontSize:"0.8125rem"},children:[(0,i.jsx)("span",{"aria-hidden":"true",children:e.mode==="better"?"\u2728":"\u{1F4AC}"}),(0,i.jsx)("span",{style:Qe,children:e.mode==="better"?" (Better UI)":" (Chat)"})]})]},e.key))]}):null,A&&De?(0,i.jsxs)("div",{style:{display:"grid",gap:6},children:[gt?(0,i.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:gt}):null,ct?(0,i.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Kt(ct)}):null,(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",De.from],["to",De.to]].map(([e,t],o)=>(0,i.jsxs)(s.Fragment,{children:[o===1?(0,i.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,t?(0,i.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>ne([t.id]),title:`Select ${O(r,t.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:O(r,t.id)}):(0,i.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!A&&p.length===1&&Et(r,p[0])?(0,i.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,Z.length>0?(0,i.jsx)("div",{"data-testid":"observations",title:Z.map(e=>e.text).join(`
2
+ `),hidden:j,style:{display:j?"none":"grid",gap:3},children:Z.slice(0,2).map(e=>(0,i.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===Z[1]&&Z.length>2?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",Z.length-2]}):null]},e.id))}):null,h?Ne.map(e=>(0,i.jsx)(dn,{section:e,lit:I,close:()=>l(null)},e.id)):null,dt?(0,i.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:dt}):null,yt?(0,i.jsx)("input",{"data-testid":"action-filter",value:ue,onChange:e=>ce(e.target.value),placeholder:`Filter ${z.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),ue.length>0?ce(""):e.currentTarget.blur();return}if(e.key==="Enter"&&_?.length===1){let t=_[0];if(t.destructive)return;t.open.length>0?Y(t.id):he(t)&&ce("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,_!==null&&_.length===0?(0,i.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",ue.trim(),"\u201D."]}):null,E!==""&&F.length===0||re&&T.length===0||T.length===0&&!tt&&p.length===0?null:T.length===0&&!tt?(0,i.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:D.length>0?`Nothing you may do with ${A?"this relation":fe.length===1?ve(ke(r.schema.tryDefinition(fe[0]),fe[0])):"this mix of kinds"} \u2014 ${D.length} action${D.length===1?"":"s"} withheld.`:A?`There is nothing to do with this line here: nothing in this app makes or breaks \u201C${zt(r.schema,r.graph.getNode(A.from)?.kind??"",A.kind,"out")}\u201D.`:zn(r,fe,p)}):(0,i.jsxs)("ol",{...bn,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[we.map((e,t)=>(0,i.jsxs)(s.Fragment,{children:[e.heading?(0,i.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:t>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?Mt(e.heading):e.heading]}):t>0?(0,i.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(o=>(0,i.jsxs)("li",{hidden:kt.has(o.id),style:{display:kt.has(o.id)?"none":"flex",gap:2,alignItems:"stretch"},onKeyDown:d=>{if(d.metaKey||d.ctrlKey||d.altKey)return;let M=d.currentTarget.querySelector("[data-affordance]"),C=d.currentTarget.querySelector("[data-pin-for]"),q=d.target===C,Tt=d.key==="ArrowRight"&&!q?C:q&&["ArrowLeft","ArrowUp","ArrowDown"].includes(d.key)?M:null;Tt&&(d.preventDefault(),d.stopPropagation(),Tt.focus())},children:[(0,i.jsxs)("button",{type:"button",[Ye]:"","data-affordance":o.id,"data-rank":o.rank,"data-graview-destructive":o.destructive||void 0,"data-menu-lit":I===`act:${o.id}`||void 0,"aria-pressed":ie===o.id,title:o.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:ie===o.id?"var(--graview-accent)":h?"transparent":"var(--graview-edge)",background:h?"none":"var(--graview-panel)",boxShadow:"none",...o.destructive?{color:"var(--graview-warn)"}:{},...ie===o.id?{color:"var(--graview-accent)"}:{},...I===`act:${o.id}`?et:{}},onClick:()=>{if(o.open.length>0){Y(ie===o.id?null:o.id);return}he(o)},children:[o.label,o.open.length>0?(0,i.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,I===`act:${o.id}`?Te:null,_?.length===1&&_[0]?.id===o.id&&!o.destructive?(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,i.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":o.mutation,"aria-pressed":o.pinned!==void 0,"aria-label":o.pinned!==void 0?`Unpin ${o.label}`:`Pin ${o.label}`,title:o.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":o.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>oe(Yt(R,o.mutation,pn.has(o.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:o.pinned==="user"?"var(--graview-accent)":o.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:o.pinned!==void 0?"\u2605":"\u2606"})]},o.id))]},`${e.heading??"plain"}-${t}`)),wt>0&&!h?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",[Ye]:"",onClick:()=>$e(!0),title:`Show all ${T.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",wt," more"]})}):null]}),re?(0,i.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{l(null),re.run()},style:Wt,children:re.label}):null,ye.length>0?(0,i.jsxs)("ul",{hidden:We,"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:We?"none":"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[ye.slice(0,h||ot?ye.length:3).map(e=>(0,i.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,i.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,i.jsx)("s",{children:e.label})}),(0,i.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!h&&!ot&&D.length>3?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>rt(!0),title:`Show all ${D.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",D.length-3," more withheld"]})}):null]}):null,Tn?(0,i.jsx)("button",{type:"button","data-menu-item":"more",onClick:e=>{let o=[...e.currentTarget.parentElement?.querySelectorAll("li[hidden], [data-menu-more][hidden]")??[]];$e(!0),requestAnimationFrame(()=>{for(let d of o){let M=d.querySelector("button:not([disabled]), a[href], input");if(M&&M.getClientRects().length>0)return M.focus()}})},style:{...Me,color:"var(--graview-ink-muted)"},children:"More\u2026"}):null,h&&be.length>0?(0,i.jsx)("div",{"data-menu-more":"",hidden:j,style:{display:j?"none":"contents"},children:be.filter(e=>!j||!e.render).map(e=>(0,i.jsx)(dn,{section:e,lit:I,close:()=>l(null)},e.id))}):null,ze.length>0?(0,i.jsx)("div",{"data-menu-section":"told",role:"group","aria-label":"Suggested",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:ze.map(e=>(0,i.jsxs)("button",{type:"button","data-menu-item":e.key,"data-told-suggestion":e.telling.id,"data-menu-lit":I===e.key||void 0,onClick:()=>xt(e),style:{...Me,...I===e.key?et:{}},children:[e.label,I===e.key?Te:null]},e.key))}):null,h&&E!==""&&!St&&I===null&&F.length===0&&ye.length===0?(0,i.jsxs)("p",{"data-testid":"menu-no-match",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing here matches \u201C",E,"\u201D."]}):null,qe?(0,i.jsx)(qt,{affordance:qe,onApply:e=>{if(he(qe,e))Y(null);else return Oe.current},onCancel:()=>Y(null)}):null]})}function Fn(a){return a.isContentEditable||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement?!0:a instanceof HTMLInputElement&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(a.type)}var Me={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},et={background:"var(--graview-panel-muted)"},sn=new WeakMap;function jn(a){let r=a.log.all().length,n=sn.get(a);if(n&&n.length===r)return n.stamp;let l={length:r};return sn.set(a,{length:r,stamp:l}),l}var qn=()=>typeof matchMedia=="function"&&matchMedia("(pointer: fine)").matches,cn={display:"inline-flex",alignItems:"center",gap:5,minHeight:30,padding:"0 11px",fontSize:"0.8125rem",borderRadius:999,cursor:"pointer",borderWidth:1,borderStyle:"solid",boxShadow:"none"},Kn={...cn,borderColor:"var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 14%, transparent)",color:"var(--graview-ink)",fontWeight:600},Bn={...cn,borderColor:"var(--graview-edge)",background:"none",color:"var(--graview-ink-muted)"},Un={fontSize:"0.6875rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)",padding:"0 10px"},Te=(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}),Gn=[];function dn({section:a,lit:r=null,close:n}){return(0,i.jsxs)("div",{"data-menu-section":a.id,...a.heading?{role:"group","aria-label":a.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[a.heading?(0,i.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:a.heading}):null,a.items&&a.items.length>0?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:a.items.map(l=>(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-menu-item":l.id,"data-menu-lit":r===`item:${l.id}`||void 0,onClick:()=>{n(),l.run()},style:{...Me,...r===`item:${l.id}`?et:{}},children:[l.label,l.hint?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.hint]}):null,r===`item:${l.id}`?Te:null]})},l.id))}):null,a.render?.(n)]})}export{fo as InspectorPane,mo as prepareActs};
@@ -1 +1 @@
1
- import{c as m}from"./chunk.36FKQJFM.js";import{ha as c,ma as u,na as p,pa as f,ua as h,va as l}from"./chunk.IUVRJDL3.js";function M(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function d(t,e){let n=t.graph?.getNode(e);return n?u(t.schema.tryDefinition(n.kind),n):e}function g(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?p(n):c(e)}function v(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=s=>l(t.schema.tryDefinition(s),s),i=s=>{let a=o(s);return`${/^[aeiou]/i.test(a)?"an":"a"} ${a}`};switch(n.on){case"act":{let s=n.act!==void 0?`\u201C${g(t,n.act)}\u201D`:"an act";return`When ${r} runs ${s}${n.record!==void 0?` on \u201C${d(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${d(t,n.record)}\u201D`:`When ${r} changes any of the ${f(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${d(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{M as a,v as b};
1
+ import{c as m}from"./chunk.W6L2VAJG.js";import{ha as c,ma as u,na as p,pa as f,ua as h,va as l}from"./chunk.6L6RUOSF.js";function M(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function d(t,e){let n=t.graph?.getNode(e);return n?u(t.schema.tryDefinition(n.kind),n):e}function g(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?p(n):c(e)}function v(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=s=>l(t.schema.tryDefinition(s),s),i=s=>{let a=o(s);return`${/^[aeiou]/i.test(a)?"an":"a"} ${a}`};switch(n.on){case"act":{let s=n.act!==void 0?`\u201C${g(t,n.act)}\u201D`:"an act";return`When ${r} runs ${s}${n.record!==void 0?` on \u201C${d(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${d(t,n.record)}\u201D`:`When ${r} changes any of the ${f(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${d(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{M as a,v as b};
@@ -1 +1 @@
1
- import{dd as m}from"./chunk.IUVRJDL3.js";function b(){let t=new Uint8Array(16);return globalThis.crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}function k(t,e){if(!t)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};"record"in e?t.record(e.record,i):"list"in e?t.list(e.list,i):t.place(e.place,i)}function w(t,e){if(!t?.href)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};return t.href("record"in e?{record:e.record}:"list"in e?{list:e.list}:{place:e.place},i)}var y=[["accent","--graview-accent"],["ground","--graview-ground"],["panel","--graview-panel"],["ink","--graview-ink"],["inkMuted","--graview-ink-muted"],["edge","--graview-edge"],["fontBody","--graview-font-body"],["fontDisplay","--graview-font-display"],["fontMono","--graview-font-mono"],["radius","--graview-radius"]];function B(t){let e=t.ownerDocument.defaultView,i=e.getComputedStyle(t),s=t.closest("[data-graview-scheme]")?.getAttribute("data-graview-scheme"),d={scheme:s==="dark"||s==="light"?s:/\bdark\b/.test(i.colorScheme??"")?"dark":/\blight\b/.test(i.colorScheme??"")?"light":e.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"};for(let[l,u]of y)d[l]=i.getPropertyValue(u).trim();return d}function R(t,e){let i=t.defaultView;if(!i||typeof i.MutationObserver!="function")return()=>{};let s=new i.MutationObserver(e);s.observe(t.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-graview-scheme","data-theme"]});let o=i.matchMedia?.("(prefers-color-scheme: dark)");return o?.addEventListener?.("change",e),()=>{s.disconnect(),o?.removeEventListener?.("change",e)}}function T(t,e,i){let s=e?.(),o=t(),d=s?.logo,l=i.url(typeof d=="string"||d===void 0?d:o.scheme==="dark"&&d.dark?d.dark:d.light);return{...o,...s?.name?{name:s.name}:{},...l?{logo:l}:{}}}function x(t,e,i){let s,o,d=n=>{n?.startsWith("blob:")&&t.URL.revokeObjectURL(n)},l=async n=>{if(n.startsWith("<"))return m(n)===null?new t.Blob([n],{type:"image/svg+xml"}):void 0;if(/\\|%2e/i.test(n)||n.split(/[?#]/)[0].split("/").some(g=>g==="."||g===".."))return;let r=new t.URL(n,t.document.baseURI);if(r.origin!==t.location.origin||!/^https?:$/.test(r.protocol))return;let a=await t.fetch(r.href,{credentials:"same-origin"}),c=(a.headers.get("content-type")??"").split(";")[0].trim();return a.ok&&c.startsWith("image/")?new t.Blob([await a.arrayBuffer()],{type:c}):void 0},u=n=>new Promise(r=>{let a=new t.Image;a.onload=()=>r(!0),a.onerror=()=>r(!1),t.setTimeout(()=>r(!1),2e3),a.src=n}),p=n=>new Promise((r,a)=>{let c=new t.FileReader;c.onload=()=>r(String(c.result)),c.onerror=a,c.readAsDataURL(n)}),h=async n=>{if(/^data:image\//i.test(n))return n;let r=await l(n);if(!(!r||s!==n)){if(i==="blob"){let a=t.URL.createObjectURL(r);if(await u(a))return a;t.URL.revokeObjectURL(a)}return p(r)}},f=(n,r)=>{if(s!==n)return d(r);r!==o&&(d(o),o=r,e())};return{url(n){let r=n?.trim()||void 0;return r!==s&&(s=r,r?h(r).then(a=>f(r,a),()=>f(r,void 0)):(d(o),o=void 0)),o},dispose(){s=void 0,d(o),o=void 0}}}export{b as a,k as b,w as c,B as d,R as e,T as f,x as g};
1
+ import{dd as m}from"./chunk.6L6RUOSF.js";function b(){let t=new Uint8Array(16);return globalThis.crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}function k(t,e){if(!t)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};"record"in e?t.record(e.record,i):"list"in e?t.list(e.list,i):t.place(e.place,i)}function w(t,e){if(!t?.href)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};return t.href("record"in e?{record:e.record}:"list"in e?{list:e.list}:{place:e.place},i)}var y=[["accent","--graview-accent"],["ground","--graview-ground"],["panel","--graview-panel"],["ink","--graview-ink"],["inkMuted","--graview-ink-muted"],["edge","--graview-edge"],["fontBody","--graview-font-body"],["fontDisplay","--graview-font-display"],["fontMono","--graview-font-mono"],["radius","--graview-radius"]];function B(t){let e=t.ownerDocument.defaultView,i=e.getComputedStyle(t),s=t.closest("[data-graview-scheme]")?.getAttribute("data-graview-scheme"),d={scheme:s==="dark"||s==="light"?s:/\bdark\b/.test(i.colorScheme??"")?"dark":/\blight\b/.test(i.colorScheme??"")?"light":e.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"};for(let[l,u]of y)d[l]=i.getPropertyValue(u).trim();return d}function R(t,e){let i=t.defaultView;if(!i||typeof i.MutationObserver!="function")return()=>{};let s=new i.MutationObserver(e);s.observe(t.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-graview-scheme","data-theme"]});let o=i.matchMedia?.("(prefers-color-scheme: dark)");return o?.addEventListener?.("change",e),()=>{s.disconnect(),o?.removeEventListener?.("change",e)}}function T(t,e,i){let s=e?.(),o=t(),d=s?.logo,l=i.url(typeof d=="string"||d===void 0?d:o.scheme==="dark"&&d.dark?d.dark:d.light);return{...o,...s?.name?{name:s.name}:{},...l?{logo:l}:{}}}function x(t,e,i){let s,o,d=n=>{n?.startsWith("blob:")&&t.URL.revokeObjectURL(n)},l=async n=>{if(n.startsWith("<"))return m(n)===null?new t.Blob([n],{type:"image/svg+xml"}):void 0;if(/\\|%2e/i.test(n)||n.split(/[?#]/)[0].split("/").some(g=>g==="."||g===".."))return;let r=new t.URL(n,t.document.baseURI);if(r.origin!==t.location.origin||!/^https?:$/.test(r.protocol))return;let a=await t.fetch(r.href,{credentials:"same-origin"}),c=(a.headers.get("content-type")??"").split(";")[0].trim();return a.ok&&c.startsWith("image/")?new t.Blob([await a.arrayBuffer()],{type:c}):void 0},u=n=>new Promise(r=>{let a=new t.Image;a.onload=()=>r(!0),a.onerror=()=>r(!1),t.setTimeout(()=>r(!1),2e3),a.src=n}),p=n=>new Promise((r,a)=>{let c=new t.FileReader;c.onload=()=>r(String(c.result)),c.onerror=a,c.readAsDataURL(n)}),h=async n=>{if(/^data:image\//i.test(n))return n;let r=await l(n);if(!(!r||s!==n)){if(i==="blob"){let a=t.URL.createObjectURL(r);if(await u(a))return a;t.URL.revokeObjectURL(a)}return p(r)}},f=(n,r)=>{if(s!==n)return d(r);r!==o&&(d(o),o=r,e())};return{url(n){let r=n?.trim()||void 0;return r!==s&&(s=r,r?h(r).then(a=>f(r,a),()=>f(r,void 0)):(d(o),o=void 0)),o},dispose(){s=void 0,d(o),o=void 0}}}export{b as a,k as b,w as c,B as d,R as e,T as f,x as g};
@@ -1 +1 @@
1
- import"./chunk.VBHV4TLG.js";import"./chunk.T6PU3NKP.js";import"./chunk.X3FPVFFB.js";import"./chunk.53HW224Y.js";import{a as x,b as P,c as L}from"./chunk.ZOSTOVXR.js";import{b as R}from"./chunk.HIJ72QX6.js";import"./chunk.BQWMHHAZ.js";import"./chunk.2QALBEWP.js";import"./chunk.WAIIXXVI.js";import"./chunk.RECTEAG4.js";import"./chunk.QQUZ5RTQ.js";import"./chunk.BJ3G7J2Z.js";import"./chunk.DIVANC3G.js";import"./chunk.KP7HUXH5.js";import"./chunk.4BSEYZMS.js";import"./chunk.KV3N6VRG.js";import"./chunk.FUTSLXWN.js";import"./chunk.MZSWWMX6.js";import"./chunk.HJCQ6I3S.js";import"./chunk.4QBW46XV.js";import"./chunk.U5Q7EVZQ.js";import"./chunk.NCBUECIW.js";import"./chunk.2T24FYAO.js";import"./chunk.JEQ6CA5M.js";import"./chunk.25VJPUDH.js";import"./chunk.SCN6IYDG.js";import"./chunk.O2XPLDMM.js";import"./chunk.CM7EDQ4E.js";import"./chunk.SUYYDJGZ.js";import"./chunk.YR7DKU5T.js";import"./chunk.YTRUZ56A.js";import"./chunk.TBY5IR7C.js";import"./chunk.5IM2X3VT.js";import"./chunk.BIDL7GQD.js";import"./chunk.NKUNCQB3.js";import"./chunk.HMV4ILAC.js";import"./chunk.XAN7QXMQ.js";import"./chunk.XJ4JYROM.js";import"./chunk.XOZU4OFA.js";import"./chunk.CHG522KL.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.ZBK3FCVE.js";import"./chunk.DW6KXAUM.js";import"./chunk.YFVJUHAK.js";import"./chunk.MR776WQ2.js";import"./chunk.WVUJXDXZ.js";import"./chunk.IRPMGHZN.js";import"./chunk.7QWGIGHM.js";import"./chunk.HRLCDBMO.js";import"./chunk.LZNHTROY.js";import"./chunk.36FKQJFM.js";import"./chunk.RHV73CBA.js";import"./chunk.MIE4TJRW.js";import{s as T}from"./chunk.RP6C2IUM.js";import"./chunk.RD2FSSLV.js";import"./chunk.T552MHMU.js";import"./chunk.ZGJUCVT5.js";import"./chunk.CVVNHQPO.js";import"./chunk.YIDNZTON.js";import"./chunk.QILGAV7H.js";import"./chunk.I6HIVTXU.js";import"./chunk.PYGNO2AV.js";import"./chunk.3HFBHLXC.js";import{G as S,I as $,Y as p,ga as C,ia as A}from"./chunk.CUA7F3YJ.js";import"./chunk.SDO3U72B.js";import{la as v,zd as k}from"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Q({page:n=!1,go:E,onPick:y,onDiscard:N}){let{store:d,seatTalk:c}=C(),u=$(c),D=L(),h=E??D,{keep:M}=x(h),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||P(!1)},[n]);let w=(0,r.useRef)(null),b=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=w.current;if(!b||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[b]),!t)return null;let G=R(t.drawn),F=d.schema.tryDefinition(t.kind),O=d.graph.nodesOfKind(t.kind).filter(s=>v(F,s)),q=()=>{c.setDraft(null),N?.()};return(0,e.jsxs)("section",{ref:w,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...z,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),M(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:q,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):h({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(T,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:O,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var z={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Q as DraftFrame};
1
+ import"./chunk.KHRS2SKB.js";import"./chunk.T6PU3NKP.js";import"./chunk.U6V4KZF5.js";import"./chunk.6ZRVVRDQ.js";import{a as x,b as P,c as L}from"./chunk.MM7MLBGB.js";import{b as R}from"./chunk.V5JB5UJS.js";import"./chunk.EHLV3LND.js";import"./chunk.EPSYX2SF.js";import"./chunk.JLNTE5CH.js";import"./chunk.DDSAFU3B.js";import"./chunk.EOSN5DWW.js";import"./chunk.T6UJEXFL.js";import"./chunk.7THS3DLZ.js";import"./chunk.4QMAYVPU.js";import"./chunk.ARGEGV5T.js";import"./chunk.WS5ORRGS.js";import"./chunk.ZONRIOIA.js";import"./chunk.NXHEOHRR.js";import"./chunk.HJCQ6I3S.js";import"./chunk.DJGZOPAS.js";import"./chunk.GFOZVQBQ.js";import"./chunk.MQNW3O67.js";import"./chunk.67S2UWBT.js";import"./chunk.7PWLRRUS.js";import"./chunk.25VJPUDH.js";import"./chunk.G767NLBH.js";import"./chunk.MEAUTBVM.js";import"./chunk.OKHXXIMN.js";import"./chunk.NH3VXTGX.js";import"./chunk.6IMRCKB4.js";import"./chunk.RDUGUC7R.js";import"./chunk.TBY5IR7C.js";import"./chunk.PQTXM4VY.js";import"./chunk.BIDL7GQD.js";import"./chunk.7KX36ENH.js";import"./chunk.QDDDKEBH.js";import"./chunk.QKRQPUCE.js";import"./chunk.SPJ34VHA.js";import"./chunk.XOZU4OFA.js";import"./chunk.KBJ3UUER.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.4O64QV2Y.js";import"./chunk.OYMN3IFX.js";import"./chunk.YFVJUHAK.js";import"./chunk.UQZ2P6KD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.NI4OPHTL.js";import"./chunk.U5KJQFAP.js";import"./chunk.FOHZPYUV.js";import"./chunk.IXYG65TM.js";import"./chunk.W6L2VAJG.js";import"./chunk.N3MXLORL.js";import"./chunk.MIE4TJRW.js";import{s as T}from"./chunk.3CLTABGP.js";import"./chunk.RD2FSSLV.js";import"./chunk.CVN2XFMF.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import"./chunk.VVIQSFM4.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import{G as S,I as $,Y as p,ga as C,ia as A}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import{la as v,zd as k}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Q({page:n=!1,go:E,onPick:y,onDiscard:N}){let{store:d,seatTalk:c}=C(),u=$(c),D=L(),h=E??D,{keep:M}=x(h),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||P(!1)},[n]);let w=(0,r.useRef)(null),b=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=w.current;if(!b||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[b]),!t)return null;let G=R(t.drawn),F=d.schema.tryDefinition(t.kind),O=d.graph.nodesOfKind(t.kind).filter(s=>v(F,s)),q=()=>{c.setDraft(null),N?.()};return(0,e.jsxs)("section",{ref:w,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...z,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),M(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:q,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):h({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(T,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:O,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var z={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Q as DraftFrame};
@@ -1,2 +1,2 @@
1
- import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.QILGAV7H.js";import{a as ue}from"./chunk.I6HIVTXU.js";import{$ as C,Ba as oe,C as W,Ca as re,Da as ie,Ea as se,H as v,Ha as U,J as E,K as Y,L as q,Ma as de,Oa as V,T as S,W as J,Wa as G,X as Q,Zb as ce,_a as ae,ab as le,ba as ee,cb as fe,ea as ne,ia as I,jc as O,lc as ye,ma as M,mc as K,sa as R,va as te}from"./chunk.IUVRJDL3.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
1
+ import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.TQ3MNB6K.js";import{a as ue}from"./chunk.VGYG2IBZ.js";import{$ as C,Ba as oe,C as W,Ca as re,Da as ie,Ea as se,H as v,Ha as U,J as E,K as Y,L as q,Ma as de,Oa as V,T as S,W as J,Wa as G,X as Q,Zb as ce,_a as ae,ab as le,ba as ee,cb as fe,ea as ne,ia as I,jc as O,lc as ye,ma as M,mc as K,sa as R,va as te}from"./chunk.6L6RUOSF.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
2
2
  `)||n.length>We)}function un(t,e){let n=t?.display?.page,r=n?.groups??[],d=new Map(e.map(i=>[i.key,i])),a=new Set(Ae(n)),l=i=>i.flatMap(u=>d.has(u)?[d.get(u)]:[]),s=e.filter(i=>!a.has(i.key));return[{fields:[...l(n?.fields??[]),...r.length>0?[]:s]},...r.map(i=>({title:i.title,fields:l(i.fields)})),...r.length>0?[{title:"Details",fields:s}]:[]].filter(i=>i.fields.length>0)}function Ue(t,e,n){let r=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let d of r){let a=t.tryDefinition(d),l=a?.fields?.shape??{};if(!a||!(n in l))continue;let s=a.display?.format?.[n];return{label:a.display?.labels?.[n]??R(a,n),option:i=>s?s(i):I(i)}}return{label:R(void 0,n),option:d=>I(d)}}function gn(t,e,n){if(n instanceof ce){let r=e.find(a=>a.name===n.mutation);return`Not yet: ${n.issues.map(a=>{let l=a.path.length>0?Ue(t,r,String(a.path[0])).label:void 0;return l?`${l} \u2014 ${ne(a.message)}`:a.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Ve=t=>/^[A-Z]{3}$/.test(t??"");function $e(t){let{format:e,unit:n,currency:r,locale:d,places:a}=t,l=Ve(n),s=e==="money"||!e&&l,c=s?l?n:r:void 0;return{...s?{format:"money"}:e?{format:e}:{},...n&&!(s&&l)?{unit:n}:{},...c?{currency:c}:{},...d?{locale:d}:{},...s&&a===0?{places:a}:{}}}function kn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function Re(t){let e=W(t)?.innerType;return e===void 0?t:Re(e)}var Ge={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ke=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function _e(t){let e=Re(t),n=W(e),r=n?.type,d=Ke(e);if(r==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let a=se(e);if(a)return a==="image"?{type:"file",image:!0}:a==="video"?{type:"file",video:!0}:{type:"file"};if(r==="boolean")return{type:"boolean"};if(r==="array"){let l=_e(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(r==="number"){let l,s,c;for(let i of d){i.check==="multiple_of"&&typeof i.value=="number"?c=i.value:i.check==="number_format"&&(i.format==="safeint"||i.format==="int32"||i.format==="uint32")&&(c??=1);let u=i.check==="number_format"&&i.format?Ge[i.format]:void 0,g=u?u[0]:i.check==="greater_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0,h=u?u[1]:i.check==="less_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0;g!==void 0&&(l=l===void 0?g:Math.max(l,g)),h!==void 0&&(s=s===void 0?h:Math.min(s,h))}return{type:"number",...l===void 0?{}:{min:l},...s===void 0?{}:{max:s},...c===void 0?{}:{step:c},...K(e)==="duration"?{duration:!0}:{},...O(t)?{amount:$e(O(t))}:{}}}if(r==="string"){if(d.some(u=>u.fn===Y||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let s=[n?.pattern,...d.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(s.some(u=>u.includes("\\d{4}")))return s.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:s.includes(v.source)?{type:"date",partial:!0}:{type:"date"};let c=d.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.maximum>500),i=K(e);return c?{type:"text",long:!0}:i==="phone"||i==="place"?{type:"text",holds:i}:{type:"text"}}return{type:"unknown"}}function vn(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:_e(n[e])}export{Oe as a,ln as b,fn as c,Ne as d,un as e,$e as f,kn as g,Re as h,_e as i,vn as j,Ue as k,gn as l};
@@ -1,4 +1,4 @@
1
- import{b as L}from"./chunk.FSZQTX3K.js";import{c as P}from"./chunk.6VG2LCES.js";import{G as De,Y as U}from"./chunk.CUA7F3YJ.js";import{zd as B}from"./chunk.IUVRJDL3.js";import{b as C}from"./chunk.AJZBJBMO.js";var Q=e=>e===void 0||e.off?void 0:e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0),Te=/\b(look|looks|looking|nicer|prettier|cleaner|ugly|layout|laid out|lay it out|design|style|styled|theme|colou?rs?|font|bigger|smaller|larger|wider|narrower|taller|shorter|spacing|space|padding|margin|compact|dense|denser|roomier|columns?|grid|cards?|rows?|show (?:the )?\S+ (?:on|in) (?:each|every|the)|sort(?:ed)? by|order(?:ed)? by|group(?:ed)? by|readable|easier to read|at a glance|icons?|badges?|headings?|bold|highlight)\b/i;async function Ae(e,t,r){let n=t.trim(),a=Q(e);if(a&&n)try{let o=await a.decide({typed:n,on:r},{about:{type:"choice",instructions:`Somebody right-clicked \u201C${r}\u201D in an app and typed \u201C${n}\u201D. Is it about how \u201C${r}\u201D looks or is laid out, or about the records in it?`,criteria:{look:"How it looks or is laid out: making it look better, its style, size or spacing, what each row, card or page shows, its order or grouping",records:"The records themselves: changing, closing, assigning, adding, deleting or moving them, or a question about them"}}});e?.meter?.({tier:"fast",model:a.model,inputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,interaction:"menu"});let s=o.answers.about;if(s?.type==="choice"&&(s.choice==="look"||s.choice==="records"))return{about:s.choice,by:"fast",confidence:s.confidence}}catch{}return{about:Te.test(n)?"look":"records",by:"words"}}var Pe=/\b(colou?rs?|font|typeface|bigger|smaller|larger|wider|narrower|taller|spacing|padding|margin|border|shadow|rounded|corners?|columns? side by side|side by side|grid|chart|graph|picture of|animation|background|gradient|icons?|css|kanban|calendar)\b/i,X=.6;async function Oe(e,t,r){let n=t.trim();if(!n)return{can:!0,by:"words"};let a=Q(e);if(a)try{let o=await a.decide({asked:n,on:r.name,page:r.slot},{can:{type:"choice",instructions:`Somebody asked of the page \u201C${r.name}\u201D: \u201C${n}\u201D. Can the app's view settings do it, or does it need drawing of its own?`,criteria:{spec:"The view settings can do it: which fields a card, a row or a page shows and in what order, a headline, a badge with a tone, a figure, a progress bar, a list of related records, how a list is sorted, grouped or filtered, a field's label or format",drawing:"It needs drawing the settings have no word for: colors, fonts, sizes, spacing, borders or shadows, a layout or columns side by side, a chart, a calendar, a board, or markup and styles of its own"}}});e?.meter?.({tier:"fast",model:a.model,inputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,interaction:"section"});let s=o.answers.can;if(s?.type==="choice"&&(s.choice==="spec"||s.choice==="drawing"))return{can:s.choice==="spec"||s.confidence<X,by:"fast",confidence:s.confidence}}catch{}return{can:!Pe.test(n),by:"words"}}var ee=["set-view","set-glance","set-page-fields","arrange-pages","set-label","set-format"],Ee=new Set(["sort","group","filters"]);function te(e){let t=[];e.length===0&&t.push("It changed nothing.");for(let r of e){let n=r?.op;if(typeof n!="string"||!ee.includes(n)){t.push(`\u201C${String(n)}\u201D is not a change to how a page reads.`);continue}if(n==="arrange-pages")for(let a of Object.keys(r))a!=="op"&&!Ee.has(a)&&t.push(`arrange-pages may say only sort, group and filters here, not \u201C${a}\u201D.`);n==="set-label"&&r.field===void 0&&t.push("set-label may name only a field's label here, not a kind's.")}return t}var ne=["You change how one page of a Graview app reads, by editing its view spec: data that says what a kind's card, row and page show, and how a list opens. Nothing in it is code: no CSS, no markup, no colors or sizes of your own.","You are told the page (a kind's list, one group of it, a record's page, or the home), what was asked, the kind's fields and relations, and its spec as it stands.",'Answer with one JSON object and nothing else: {"edits": [...], "said": "<one sentence to the person saying what will change>"}. Or, where the spec has no word for it (colors, fonts, sizes, spacing, layout, a chart), answer {"cannot": "<one sentence saying what it would need>"}.',"The edits you may use, and no others:",`{"op":"set-view","kind":K,"slot":"card"|"row"|"page","blocks":[...]} \u2014 a kind's card, its row on a list, the blocks over its record page; {"op":"set-view","slot":"home","blocks":[...]} \u2014 the home. Blocks: {"title":"{name}"}, {"headline":"{count(out('rel'))} things"}, {"text":"{field}","lines":2}, {"badge":"{field}","tone":"good"|"warn"|"bad"|"neutral"|"accent"}, {"field":"due","as":"date"|"time"|"datetime"|"relative"|"money"|"percent"|"count","label":"Due"}, {"figure":"expr","as":"number"|"money"|"percent","label":"..."}, {"progress":{"value":"done","max":"total"},"label":"..."}, {"list":"out('rel')" or "all('kind')","as":"row"|"card","sort":{"by":"f","direction":"asc"|"desc"},"limit":5,"group":{"by":"f"},"empty":"None yet."}, {"group":[...blocks],"direction":"row"|"column"}, {"when":"rule expression","show":[...blocks]}, {"divider":true}. Templates say {field}; a row always leads with {"title":"{name}"} or the record's label field.`,`{"op":"set-glance","kind":K,"fields":[...]} \u2014 the few facts said beside a record's name on a list.`,`{"op":"set-page-fields","kind":K,"fields":[...],"groups":[{"title":"...","fields":[...]}]} \u2014 the order and groups of a record page's facts.`,`{"op":"arrange-pages","sort":{K:{"by":"f","direction":"asc"|"desc"}},"group":{K:{"by":"f"}},"filters":{K:["f"]}} \u2014 how a kind's list opens. A list sorts by one of its kind's fields or computed values, and groups only by a choice or a yes-or-no field of its own: grouping by a relation or by the record that holds it is not the spec's to say.`,'{"op":"set-label","kind":K,"field":F,"label":"..."}, {"op":"set-format","kind":K,"field":F,"format":"money"|"percent"|"duration"|null}.',"Name only fields and relations the kind has. Change only what the ask needs, on this page's kind. Keep every fact the page shows now unless asked to drop one.","Do what was asked or answer cannot: never something else in its place (grouping by another field than the one asked for, say)."].join(`
1
+ import{b as L}from"./chunk.PGT4ZQDG.js";import{c as P}from"./chunk.HXRHEPPJ.js";import{G as De,Y as U}from"./chunk.JCKIJSW7.js";import{zd as B}from"./chunk.6L6RUOSF.js";import{b as C}from"./chunk.AJZBJBMO.js";var Q=e=>e===void 0||e.off?void 0:e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0),Te=/\b(look|looks|looking|nicer|prettier|cleaner|ugly|layout|laid out|lay it out|design|style|styled|theme|colou?rs?|font|bigger|smaller|larger|wider|narrower|taller|shorter|spacing|space|padding|margin|compact|dense|denser|roomier|columns?|grid|cards?|rows?|show (?:the )?\S+ (?:on|in) (?:each|every|the)|sort(?:ed)? by|order(?:ed)? by|group(?:ed)? by|readable|easier to read|at a glance|icons?|badges?|headings?|bold|highlight)\b/i;async function Ae(e,t,r){let n=t.trim(),a=Q(e);if(a&&n)try{let o=await a.decide({typed:n,on:r},{about:{type:"choice",instructions:`Somebody right-clicked \u201C${r}\u201D in an app and typed \u201C${n}\u201D. Is it about how \u201C${r}\u201D looks or is laid out, or about the records in it?`,criteria:{look:"How it looks or is laid out: making it look better, its style, size or spacing, what each row, card or page shows, its order or grouping",records:"The records themselves: changing, closing, assigning, adding, deleting or moving them, or a question about them"}}});e?.meter?.({tier:"fast",model:a.model,inputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,interaction:"menu"});let s=o.answers.about;if(s?.type==="choice"&&(s.choice==="look"||s.choice==="records"))return{about:s.choice,by:"fast",confidence:s.confidence}}catch{}return{about:Te.test(n)?"look":"records",by:"words"}}var Pe=/\b(colou?rs?|font|typeface|bigger|smaller|larger|wider|narrower|taller|spacing|padding|margin|border|shadow|rounded|corners?|columns? side by side|side by side|grid|chart|graph|picture of|animation|background|gradient|icons?|css|kanban|calendar)\b/i,X=.6;async function Oe(e,t,r){let n=t.trim();if(!n)return{can:!0,by:"words"};let a=Q(e);if(a)try{let o=await a.decide({asked:n,on:r.name,page:r.slot},{can:{type:"choice",instructions:`Somebody asked of the page \u201C${r.name}\u201D: \u201C${n}\u201D. Can the app's view settings do it, or does it need drawing of its own?`,criteria:{spec:"The view settings can do it: which fields a card, a row or a page shows and in what order, a headline, a badge with a tone, a figure, a progress bar, a list of related records, how a list is sorted, grouped or filtered, a field's label or format",drawing:"It needs drawing the settings have no word for: colors, fonts, sizes, spacing, borders or shadows, a layout or columns side by side, a chart, a calendar, a board, or markup and styles of its own"}}});e?.meter?.({tier:"fast",model:a.model,inputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,interaction:"section"});let s=o.answers.can;if(s?.type==="choice"&&(s.choice==="spec"||s.choice==="drawing"))return{can:s.choice==="spec"||s.confidence<X,by:"fast",confidence:s.confidence}}catch{}return{can:!Pe.test(n),by:"words"}}var ee=["set-view","set-glance","set-page-fields","arrange-pages","set-label","set-format"],Ee=new Set(["sort","group","filters"]);function te(e){let t=[];e.length===0&&t.push("It changed nothing.");for(let r of e){let n=r?.op;if(typeof n!="string"||!ee.includes(n)){t.push(`\u201C${String(n)}\u201D is not a change to how a page reads.`);continue}if(n==="arrange-pages")for(let a of Object.keys(r))a!=="op"&&!Ee.has(a)&&t.push(`arrange-pages may say only sort, group and filters here, not \u201C${a}\u201D.`);n==="set-label"&&r.field===void 0&&t.push("set-label may name only a field's label here, not a kind's.")}return t}var ne=["You change how one page of a Graview app reads, by editing its view spec: data that says what a kind's card, row and page show, and how a list opens. Nothing in it is code: no CSS, no markup, no colors or sizes of your own.","You are told the page (a kind's list, one group of it, a record's page, or the home), what was asked, the kind's fields and relations, and its spec as it stands.",'Answer with one JSON object and nothing else: {"edits": [...], "said": "<one sentence to the person saying what will change>"}. Or, where the spec has no word for it (colors, fonts, sizes, spacing, layout, a chart), answer {"cannot": "<one sentence saying what it would need>"}.',"The edits you may use, and no others:",`{"op":"set-view","kind":K,"slot":"card"|"row"|"page","blocks":[...]} \u2014 a kind's card, its row on a list, the blocks over its record page; {"op":"set-view","slot":"home","blocks":[...]} \u2014 the home. Blocks: {"title":"{name}"}, {"headline":"{count(out('rel'))} things"}, {"text":"{field}","lines":2}, {"badge":"{field}","tone":"good"|"warn"|"bad"|"neutral"|"accent"}, {"field":"due","as":"date"|"time"|"datetime"|"relative"|"money"|"percent"|"count","label":"Due"}, {"figure":"expr","as":"number"|"money"|"percent","label":"..."}, {"progress":{"value":"done","max":"total"},"label":"..."}, {"list":"out('rel')" or "all('kind')","as":"row"|"card","sort":{"by":"f","direction":"asc"|"desc"},"limit":5,"group":{"by":"f"},"empty":"None yet."}, {"group":[...blocks],"direction":"row"|"column"}, {"when":"rule expression","show":[...blocks]}, {"divider":true}. Templates say {field}; a row always leads with {"title":"{name}"} or the record's label field.`,`{"op":"set-glance","kind":K,"fields":[...]} \u2014 the few facts said beside a record's name on a list.`,`{"op":"set-page-fields","kind":K,"fields":[...],"groups":[{"title":"...","fields":[...]}]} \u2014 the order and groups of a record page's facts.`,`{"op":"arrange-pages","sort":{K:{"by":"f","direction":"asc"|"desc"}},"group":{K:{"by":"f"}},"filters":{K:["f"]}} \u2014 how a kind's list opens. A list sorts by one of its kind's fields or computed values, and groups only by a choice or a yes-or-no field of its own: grouping by a relation or by the record that holds it is not the spec's to say.`,'{"op":"set-label","kind":K,"field":F,"label":"..."}, {"op":"set-format","kind":K,"field":F,"format":"money"|"percent"|"duration"|null}.',"Name only fields and relations the kind has. Change only what the ask needs, on this page's kind. Keep every fact the page shows now unless asked to drop one.","Do what was asked or answer cannot: never something else in its place (grouping by another field than the one asked for, say)."].join(`
2
2
  `);function O(e){let t=e.part.kind,r=e.document,n=t?r.kinds[t]:void 0,a=e.mode==="just"?"Make this page better: easier to read at a glance, the facts a person needs first. Change no data.":(e.words??"").trim();return JSON.stringify({page:{name:e.part.name,is:e.part.slot==="list"?"a kind's list":e.part.slot==="group"?`one group of a kind's list (\u201C${e.part.group}\u201D)`:e.part.slot==="record"?"a record's page (every record of the kind)":e.part.slot==="home"?"the home":"a place",...t?{kind:t}:{}},asked:a,...e.highlighted?.length?{pointed_at:e.highlighted}:{},...n?{fields:n.fields,relations:n.edges??n.relations,computed:n.computed,glance:n.glance,pageFields:n.pageFields}:{kinds:Object.keys(r.kinds)},now:{...t?{views:r.views?.[t]??null,list:r.pages?.lists?.[t]??null}:{home:r.views?.home??null}},...e.shows?{shows:e.shows.slice(0,1500)}:{},...e.findings?.length?{your_last_answer:e.last,what_broke:e.findings,repair:"Your last answer was refused as said in what_broke. Answer again, fixing each one \u2014 or, where the spec cannot do what was asked, answer cannot."}:{}})}function re(e){let t=/```(?:json|js|javascript)?\s*([\s\S]*?)```/.exec(e)?.[1];for(let r of t?[t,e]:[e]){let n=r.indexOf("{"),a=r.lastIndexOf("}");if(!(n<0||a<=n))try{let o=JSON.parse(r.slice(n,a+1));if(o&&typeof o=="object"&&!Array.isArray(o))return o}catch{}}}function se(e){let t=re(e);if(t){if(typeof t.cannot=="string"&&t.cannot.trim())return{cannot:t.cannot.trim()};if(Array.isArray(t.edits))return{edits:t.edits,said:typeof t.said=="string"&&t.said.trim()?t.said.trim():"Changed how this page reads."}}}function je(e){return async(t,r,n,a)=>{let o=Date.now();try{let s=await t.think({system:n,prompt:a,state:{},catalog:{candidates:[]}});return e.push({stage:r,model:t.model,ms:Date.now()-o,...s.usage?{usage:s.usage}:{}}),s.text}catch{e.push({stage:r,model:t.model,ms:Date.now()-o});return}}}async function Ne(e){let t=[],r=e.ai.off?void 0:e.ai.light,n=P(e.ai),a=r??n;if(!a)return{ok:!1,refused:e.ai.withoutModel??"Changing a page needs AI, and none is on here.",stages:t};let o=je(t),s={part:e.part,document:e.document,mode:e.mode,...e.words?{words:e.words}:{},...e.highlighted?{highlighted:e.highlighted}:{},...e.shows?{shows:e.shows}:{}},i=async(u,k,S)=>{let f=await o(u,k,ne,S);return f===void 0?void 0:se(f)},c=await i(a,r?"light":"thinking",O(s));if(!c&&r&&(c=await i(r,"light",O(s))),!c)return{ok:!1,refused:"The model did not answer with a change to this page.",stages:t};if("cannot"in c)return{ok:!1,cannot:c.cannot,refused:c.cannot,stages:t};let l=async u=>{let k=te(u);return k.length>0?k:[...await e.judge(u)]},g=await l(c.edits);if(g.length===0)return{ok:!0,edits:c.edits,said:c.said,repaired:!1,stages:t};let m=a;e.repairing?.(g);let y=await i(m,m===r?"light":"thinking",O({...s,findings:g,last:c}));return y&&"cannot"in y?{ok:!1,cannot:y.cannot,refused:y.cannot,stages:t}:y?(g=await l(y.edits),g.length>0?{ok:!1,refused:`It could not be changed so: ${g.join(" ")}`,stages:t}:{ok:!0,edits:y.edits,said:y.said,repaired:!0,stages:t}):{ok:!1,refused:`It could not be changed so: ${g.join(" ")}`,stages:t}}var Z=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)||"page";function Ie(e,t,r=[]){let n={...t.kinds.length?{kinds:[...t.kinds]}:{},...t.edges.length?{edges:[...t.edges]}:{}},a={...Object.keys(n).length>0?{reads:n}:{},...r.length>0?{acts:[...r]}:{}};if((e.slot==="list"||e.slot==="group")&&e.kind)return{name:`${Z(e.kind)}-list`,attach:e.kind,cardinality:"many",replaces:"page",...a};if(e.slot==="record"&&e.kind)return{name:`${Z(e.kind)}-page`,attach:e.kind,cardinality:"one",replaces:"page",...a};if(e.slot==="home")return{name:"home-page",attach:"home",cardinality:"many",...a}}var K=["You write a Graview worker view: one plain script, no imports and no build, that draws one page of an app through the global `graview`, in place of the page the app drew by itself.","The global: graview.style(css) a stylesheet; graview.onProps((props) => \u2026) on every push of what it is shown; graview.render(graview.html`\u2026`) draws markup, every ${value} escaped; graview.html`` nests: a list is ${items.map((one) => graview.html`<li>\u2026</li>`)}. Never build HTML as a string or with join(): a string is drawn as its words.","props.nodes holds the records a view of many is drawn for and those it reads; props.node the record a view of one is drawn for. A record is plain data: id, kind, label, and each field by name. props.edges are {kind, from, to}. props.choices[kind][field][option] is a choice's label.",'Link to a record with <a data-record="${node.id}">\u2026</a>. Give repeated rows data-key="${node.id}". Name each part a person would name with a heading inside a <section aria-labelledby="x-h"> whose heading has id="x-h"; never aria-label.',"The page draws its own title above your view: never draw the page's title again. Draw each other heading the page had, with the same words, and every record the page showed: each record still says what its row said (its status, its dates, its counts, in words) and stays under the heading it was under, unless what was asked changes that.",'Say things in words a person reads: a date as the page said it (\u201CSep 3\u201D), never as stored (2026-09-03). A date kept as YYYY-MM-DD is a day, not an instant: read it as new Date(`${value}T00:00`) \u2014 new Date(value) alone is midnight in London and the day before here \u2014 then .toLocaleDateString(props.locale, { month: "short", day: "numeric" }); never show a field\'s own name (order, done, holds), an id, true, false, null or undefined. Leave out a value the page did not show unless asked for it.',`CSS the host keeps: plain rules on your own classes and elements, one level, and @media. Give your outer element a class (class="pg") and style that: never :host, ::slotted or ::part, no url(), @import, @font-face, @keyframes or nesting. Colors, type and corners only through var(--graview-ink), var(--graview-ink-muted), var(--graview-panel), var(--graview-edge), var(--graview-accent), var(--graview-ground), var(--graview-radius). position may be static, relative, absolute or sticky. Set no height; lay it out well at a phone's width and at a desk's.`,"Never write the words import, export or require, nor <script>, <style>, or on\u2026= attributes.",'Answer with one JSON object and nothing else: {"source": "<the whole script>", "said": "<a few words on what you changed>"}.'].join(`
3
3
  `);function G(e){return e.records.map(t=>{let r=e.says?.[t];return{record:t,...r?.id?{id:r.id}:{},...r?.shows?.length?{must_show:r.shows}:{},...r?.under?{under:r.under}:{}}})}function F(e){let[t,r]=e.record==="from"?["from","to"]:["to","from"];return`Group the records as the page did: each record sits under a heading that is the label of the ${e.kind} it is linked to \u2014 find the edge in props.edges with kind "${e.edge}" whose ${t} is the record's id; the ${e.kind} is props.nodes' node whose id is the edge's ${r}. Draw the headings in keep_these_headings' order; never guess a record's group from its fields.`}function z(e){let t=re(e),r=t?.source,n=typeof r=="string"?r.trim().replace(/^```(?:js|javascript)?\s*/i,"").replace(/\s*```$/,"").replace(/^<script[^>]*>\s*/i,"").replace(/\s*<\/script>\s*$/i,""):void 0;if(!(typeof n!="string"||!/graview\.(render|onProps)/.test(n)))return{source:n,said:typeof t.said=="string"?t.said.trim():""}}var de=["look","read","edit","draft","done","ask"],ae=64e3,Me=e=>e.length>80?`${e.slice(0,79)}\u2026`:e;function le(e,t,r){let n=[],a=e;return t.forEach((o,s)=>{let i=`Edit ${s+1}: \u201C${Me(o.find)}\u201D`;if(!o.find)return void n.push(`${i} is no text to find: quote the text to change, exactly as it stands in ${r}.`);let c=0;for(let g=a.indexOf(o.find);g>=0&&c<2;g=a.indexOf(o.find,g+o.find.length))c+=1;if(c===0){let g=y=>y.replace(/\s+/g,""),m=g(o.find).length>0&&g(a).includes(g(o.find));return void n.push(`${i} is not in ${r}${m?" as written, but is there with other spacing":""}: quote it exactly as it stands there, spaces and quotes included.`)}if(c>1){let g=a.split(o.find).length-1;return void n.push(`${i} appears ${g} times in ${r}: quote more of the text around the place you mean, so it appears once.`)}let l=a.indexOf(o.find);a=`${a.slice(0,l)}${o.replace}${a.slice(l+o.find.length)}`}),n.length>0?{findings:n}:a===e?{findings:[`Your edits change nothing in ${r}: replace the text with something else, or say you are done.`]}:{source:a}}var ce=12,W=[K.split(`
4
4
  `).filter(e=>!e.startsWith("Answer with one JSON object")).join(`
@@ -1 +1 @@
1
- import{a as I,c as x}from"./chunk.IJVR7ZL7.js";import"./chunk.PYGNO2AV.js";import"./chunk.3HFBHLXC.js";import{b,c as A,j as v,q as w,s as O,v as G}from"./chunk.CUA7F3YJ.js";import"./chunk.SDO3U72B.js";import{Be as S,Ce as W,de as k,ue as E}from"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
1
+ import{a as I,c as x}from"./chunk.G5AF5IXL.js";import"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import{b,c as A,j as v,q as w,s as O,v as G}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import{Be as S,Ce as W,de as k,ue as E}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};