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 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as _e,b as Xe}from"./chunk.U2DZE7A5.js";import{a as Qe,b as Je,c as ne,d as Ze}from"./chunk.JPJHM62B.js";import{a as Ne,b as ze,c as Ue,d as Ve}from"./chunk.DOJCYXIJ.js";import{a as Fe,b as je,c as Ye,f as qe,l as Ke,m as me,n as Ge,o as he}from"./chunk.J65CZJIC.js";import{d as We}from"./chunk.6VG2LCES.js";import{A as Be,x as $e}from"./chunk.RP6C2IUM.js";import{m as Oe}from"./chunk.PYGNO2AV.js";import{G as He,Oa as fe,Y as te,ga as Le}from"./chunk.CUA7F3YJ.js";import{a as pe}from"./chunk.SDO3U72B.js";import{ma as Ie,zd as q}from"./chunk.IUVRJDL3.js";import{b as z}from"./chunk.AJZBJBMO.js";var i=z(He(),1);var C=z(He(),1);var c=z(te(),1),vt=640,we=372,kt=1100,et=()=>typeof innerWidth!="number"||innerWidth>=kt?"side":innerWidth>=vt?"drawer":"sheet";function St(){let e=document.querySelector('[data-testid="app-bar"]');return e||([...document.querySelectorAll("header")].find(n=>{let u=n.getBoundingClientRect();return u.top<=1&&u.width>=innerWidth*.8&&u.height>0})??null)}function xt(e){let n=document.querySelector("[data-graview-page-main], main");for(;n?.parentElement&&n.parentElement!==document.body&&!(e&&n.parentElement.contains(e));)n=n.parentElement;return n}function Ct(e){let[n,u]=(0,C.useState)(et);return(0,C.useLayoutEffect)(()=>{let p=document.body.style,w=p.paddingBottom,f=null,s="",r=0,d=(m,t)=>{f&&f!==m&&(f.style.paddingRight=s),m&&m!==f&&(s=m.style.paddingRight),f=m,f&&(f.style.paddingRight=t?`${we}px`:s)},o=()=>{let m=et();u(m);let t=St(),h=Math.max(0,Math.round(t?.getBoundingClientRect().bottom??0));e.current&&m!=="sheet"&&(e.current.style.top=`${h}px`),d(xt(t),m==="side"),p.paddingBottom=m==="sheet"?`${Math.round((e.current?.getBoundingClientRect().height??0)+16)}px`:w,r=requestAnimationFrame(o)};return o(),()=>{cancelAnimationFrame(r),d(null,!1),p.paddingBottom=w}},[e]),n}var Pt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e%6e4/1e3)).padStart(2,"0")}`;function rt(e){let n=(0,C.useRef)(null),u=(0,C.useRef)(null),p=(0,C.useRef)(null),[w,f]=(0,C.useState)(""),[,s]=(0,C.useState)(0),r=Ct(n);(0,C.useEffect)(()=>{if(!e.working)return;let t=setInterval(()=>s(h=>h+1),1e3);return()=>clearInterval(t)},[e.working]),(0,C.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[e.talk.length,e.steps.length]),(0,C.useEffect)(()=>{e.working||p.current?.focus({preventScroll:!0})},[e.working,e.phase]);let d=e.talk.map(t=>t.who).lastIndexOf("person"),o=e.steps.length>0?(0,c.jsx)("li",{"data-testid":"better-steps",style:Ht,children:(0,c.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:3},children:e.steps.map((t,h)=>{let y=e.working&&h===e.steps.length-1;return(0,c.jsxs)("li",{"data-testid":"better-step","data-step-kind":t.kind,style:{display:"flex",gap:6,alignItems:"baseline",color:y?"var(--graview-ink)":"var(--graview-ink-muted)"},children:[(0,c.jsx)("span",{"aria-hidden":"true",style:{width:14,flex:"none",color:t.kind==="check"||t.kind==="stuck"?"var(--graview-warn)":"var(--graview-accent)"},children:y?"\u2026":t.kind==="check"||t.kind==="stuck"?"!":"\u2713"}),(0,c.jsx)("span",{children:t.text})]},`s${h}`)})})}):null,m=e.talk.length===0;return(0,c.jsxs)("aside",{ref:n,role:"complementary","aria-label":`Change how \u201C${e.name}\u201D looks`,"data-testid":"better-panel","data-better-phase":e.phase,"data-better-dock":r,"data-graview-popover":"",style:r==="sheet"?Tt:r==="drawer"?Et:at,children:[(0,c.jsxs)("header",{style:Rt,children:[(0,c.jsxs)("p",{style:{margin:0,fontWeight:600},children:["Change how \u201C",e.name,"\u201D looks"]}),(0,c.jsx)("button",{type:"button","data-testid":"better-close","aria-label":"Close",onClick:e.close,style:Lt,children:"\xD7"})]}),(0,c.jsx)("p",{"data-testid":"better-scope",style:tt,children:e.scope}),e.about?(0,c.jsxs)("p",{"data-testid":"better-about",style:Dt,children:["About: ",e.about]}):null,(0,c.jsxs)("ol",{ref:u,"data-testid":"better-talk",style:Mt,children:[e.talk.map((t,h)=>(0,c.jsxs)(C.Fragment,{children:[(0,c.jsx)("li",{"data-testid":"better-message","data-who":t.who,style:t.who==="person"?At:It,children:t.said}),h===d?o:null]},`t${h}`)),d<0?o:null]}),e.working?(0,c.jsxs)("div",{style:K,children:[(0,c.jsxs)("p",{role:"status","aria-live":"polite","data-testid":"better-working",style:{margin:0,flex:1,color:"var(--graview-ink-muted)"},children:["Graview is working on \u201C",e.name,"\u201D \xB7 ",(0,c.jsx)("span",{"data-testid":"better-time",children:Pt(Date.now()-e.since)})]}),(0,c.jsx)("button",{type:"button","data-testid":"better-stop",onClick:e.stop,style:I,children:"Stop"})]}):null,e.draft&&!e.working?(0,c.jsxs)("div",{"data-testid":"better-draft",style:{flexShrink:0,display:"grid",gap:6},children:[(0,c.jsx)("p",{"data-testid":"better-changed",style:{margin:0},children:e.draft.said}),(0,c.jsxs)("div",{style:K,children:[(0,c.jsx)("div",{role:"group","aria-label":"Compare",style:$t,children:["Before","After"].map(t=>{let h=t==="Before"?e.draft.before:!e.draft.before;return(0,c.jsx)("button",{type:"button","data-testid":`better-${t.toLowerCase()}`,"aria-pressed":h,onClick:()=>e.compare(t==="Before"),style:h?Bt:Wt,children:t},t)})}),(0,c.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:6},children:[(0,c.jsx)("button",{type:"button","data-testid":"better-keep",onClick:e.keep,style:nt,children:"Keep"}),(0,c.jsx)("button",{type:"button","data-testid":"better-discard",onClick:e.discard,style:I,children:"Discard"})]})]})]}):null,e.stuck&&!e.working?(0,c.jsxs)("div",{"data-testid":"better-stuck",style:K,children:[e.stuck.keepAnyway?(0,c.jsx)("button",{type:"button","data-testid":"better-keep-anyway",onClick:e.stuck.keepAnyway,style:I,children:"Keep anyway"}):null,(0,c.jsx)("button",{type:"button","data-testid":"better-stuck-stop",onClick:e.stuck.stop,style:I,children:"Stop"})]}):null,e.children,e.kept&&!e.working?(0,c.jsxs)("div",{"data-testid":"better-kept",style:K,children:[(0,c.jsx)("p",{style:{margin:0,flex:1},children:e.kept.note?/^kept\b/i.test(e.kept.note.trim())?e.kept.note.trim():`Kept. ${e.kept.note}`:"Kept."}),e.kept.undo?(0,c.jsx)("button",{type:"button","data-testid":"better-undo",onClick:e.kept.undo,style:I,children:"Undo"}):null]}):null,m&&!e.working?(0,c.jsxs)("div",{style:K,children:[(0,c.jsx)("button",{type:"button","data-testid":"better-just",onClick:e.just,style:I,children:"Make it easier to read"}),(0,c.jsx)("button",{type:"button","data-testid":"better-point",onClick:e.point,style:I,children:"Point at a part\u2026"})]}):null,e.pointed&&!e.working?(0,c.jsxs)("p",{"data-testid":"better-pointed",style:tt,children:["You pointed at ",e.pointed,"."]}):null,(0,c.jsxs)("form",{onSubmit:t=>{t.preventDefault(),!(!w.trim()||e.working)&&(e.ask(w.trim()),f(""))},style:{flexShrink:0,display:"flex",gap:6},children:[(0,c.jsx)("label",{htmlFor:"graview-better-panel-words",style:Oe,children:"Tell Graview what to change"}),(0,c.jsx)("input",{id:"graview-better-panel-words",ref:p,"data-testid":"better-words",value:w,disabled:e.working,onChange:t=>f(t.target.value),placeholder:m?"What should change?":"Tell Graview what to change\u2026",style:Ot}),(0,c.jsx)("button",{type:"submit",disabled:e.working||!w.trim(),"data-testid":"better-send",style:nt,children:"Send"})]})]})}var ot={position:"fixed",zIndex:q("popover"),boxSizing:"border-box",display:"flex",flexDirection:"column",gap:10,padding:14,margin:0,fontSize:"0.875rem",lineHeight:1.45,color:"var(--graview-ink)",background:"var(--graview-panel)",overflow:"hidden"},at={...ot,top:0,right:0,bottom:0,width:we,borderLeft:"1px solid var(--graview-edge)"},Et={...at,width:`min(${we}px, 86vw)`,boxShadow:"var(--graview-lift-high, -12px 0 32px rgba(0,0,0,0.18))"},Tt={...ot,left:0,right:0,bottom:0,maxHeight:"55vh",borderTop:"1px solid var(--graview-edge)",borderRadius:"14px 14px 0 0",boxShadow:"var(--graview-lift-high, 0 -12px 32px rgba(0,0,0,0.18))"},Dt={flexShrink:0,margin:0,justifySelf:"start",alignSelf:"flex-start",padding:"2px 10px",borderRadius:999,fontSize:"0.8125rem",color:"var(--graview-ink)",background:"var(--graview-ground)",border:"1px solid var(--graview-edge)"},Rt={flexShrink:0,display:"flex",alignItems:"center",gap:8,justifyContent:"space-between"},tt={flexShrink:0,margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},Mt={margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:8,overflowY:"auto",flex:"1 1 0",minHeight:0},it={padding:"7px 10px",borderRadius:10,maxWidth:"88%",whiteSpace:"pre-wrap",flex:"none"},At={...it,alignSelf:"flex-end",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},It={...it,alignSelf:"flex-start",background:"var(--graview-ground)"},Ht={flex:"none",padding:"6px 10px",borderRadius:10,border:"1px dashed var(--graview-edge)",fontSize:"0.8125rem"},K={flexShrink:0,display:"flex",flexWrap:"wrap",alignItems:"center",gap:6},re={minHeight:32,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",cursor:"pointer"},nt={...re,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},I={...re,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},Lt={...I,minHeight:28,padding:"0 9px",fontSize:"1rem",lineHeight:1},Ot={flex:"1 1 auto",minWidth:0,minHeight:34,padding:"0 10px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.875rem"},$t={display:"inline-flex",border:"1px solid var(--graview-edge)",borderRadius:999,padding:2},Bt={...re,minHeight:28,borderRadius:999,border:"none",color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)"},Wt={...re,minHeight:28,borderRadius:999,border:"none",color:"var(--graview-ink)",background:"transparent"};var x=z(te(),1);var ye=fe(pe(()=>(__graviewPreload(import.meta.url,["./chunk.I3ADXJQW.js","./chunk.BJUUSIQY.js","./chunk.7QWGIGHM.js","./chunk.I6HIVTXU.js","./chunk.PYGNO2AV.js","./chunk.3HFBHLXC.js","./chunk.CUA7F3YJ.js","./chunk.SDO3U72B.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.55C7WO4X.js")))),Nt=ye.part((e,n)=>(0,x.jsx)(e.RateTelling,{...n}),{quiet:!0});function Sn({ask:e,open:n,close:u}){return e?.part?(0,x.jsx)(Ut,{ask:e,close:u},e.at):e?.section?(0,x.jsx)(Kt,{ask:e,close:u},e.at):n?(0,x.jsx)(he,{elements:n}):null}var zt=fe(pe(()=>(__graviewPreload(import.meta.url,["./chunk.5FQHZVE3.js","./chunk.U2DZE7A5.js","./chunk.JPJHM62B.js","./chunk.DOJCYXIJ.js","./chunk.J65CZJIC.js","./chunk.FSZQTX3K.js","./chunk.TBY5IR7C.js","./chunk.6VG2LCES.js","./chunk.I3ADXJQW.js","./chunk.BJUUSIQY.js","./chunk.XJ4JYROM.js","./chunk.XOZU4OFA.js","./chunk.CHG522KL.js","./chunk.7QWGIGHM.js","./chunk.MIE4TJRW.js","./chunk.RP6C2IUM.js","./chunk.RD2FSSLV.js","./chunk.T552MHMU.js","./chunk.ZGJUCVT5.js","./chunk.CVVNHQPO.js","./chunk.YIDNZTON.js","./chunk.QILGAV7H.js","./chunk.I6HIVTXU.js","./chunk.PYGNO2AV.js","./chunk.3HFBHLXC.js","./chunk.CUA7F3YJ.js","./chunk.SDO3U72B.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.NZ5TJKPT.js")))),Ut=zt.part((e,n)=>(0,x.jsx)(e.PageCard,{...n}),{what:"Make this better"}),Vt=360,T=12;function xn(e,n){let u={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},p=Math.min(Vt,u.width-2*T),w=e.getBoundingClientRect().height,f=d=>Math.max(T,Math.min(d,u.height-w-T)),s=(u.width-p)/2,r=f(72);n&&n.width>0&&(n.right+T+p<=u.width-T?[s,r]=[n.right+T,f(n.top)]:n.left-T-p>=T?[s,r]=[n.left-T-p,f(n.top)]:(s=Math.max(T,Math.min(n.left,u.width-p-T)),r=n.bottom+T+w<=u.height-T?n.bottom+T:f(n.top-T-w))),e.style.left=`${Math.round(s)}px`,e.style.top=`${Math.round(r)}px`,e.style.width=`${Math.round(p)}px`}var Ft=e=>e.map(n=>n.innerText??n.textContent??"").join(" ").replace(/\s+/g," ").trim(),st=e=>{let n=e.getBoundingClientRect();return{tag:(e.getAttribute("data-graview-as")??e.localName).toLowerCase(),classes:[...e.classList],text:e.textContent??"",box:{left:n.left,top:n.top,width:n.width,height:n.height}}};function jt(e,n,u){let p=[...e.querySelectorAll("*")].filter(s=>{let r=s.getBoundingClientRect();return r.width>0&&r.height>0});if(u){let s=p.filter(o=>{let m=o.getBoundingClientRect();return n.left>=m.left&&n.left<=m.right&&n.top>=m.top&&n.top<=m.bottom}),d=s.filter(o=>!s.some(m=>m!==o&&o.contains(m)))[0];if(!d)return[];for(let o=d;o&&o!==e;o=o.parentElement)if(o.classList.length>0||/^(h[1-6]|li|a|button|img|p|article|section)$/.test(o.localName))return[o];return[d]}let w=p.filter(s=>{let r=s.getBoundingClientRect();return r.left>=n.left-2&&r.right<=n.right+2&&r.top>=n.top-2&&r.bottom<=n.bottom+2}),f=w.filter(s=>!w.some(r=>r!==s&&r.contains(s)));for(;f.length===1;){let s=[...f[0].children].filter(r=>w.includes(r));if(s.length<2)break;f=s}return f}function Yt(e,n,u={}){let p=d=>({source:d.source,css:d.css,...d.root?{drawing:d.root}:{},...d.height!==void 0?{height:d.height}:{}}),w=Xe(p(e),p(n)),f=[];for(let d of w.unstyled)f.push(`The class \u201C${d.class}\u201D is still drawn and no rule styles it now.`);let s=d=>d.root?_e(d.root).map(o=>o.name):[],r=e.root&&n.root?Fe(w.sectionsMissing.map(d=>d.name),s(e),s(n),u):w.sectionsMissing.map(d=>d.name);for(let d of r)f.push(`\u201C${d}\u201D is not drawn any more.`);return f}function qt(e,n,u,p,w,f){let s=p.drawing(),r=Yt({source:e,css:n.css,root:n.root,height:n.height},{source:w,css:s.css,root:s.root,height:s.height},f);for(let d of p.refused())u.includes(d)||r.push(d);return r}function Kt({ask:e,close:n}){let{ai:u,aiDesk:p,aiHere:w,session:f,principal:s,keptViews:r,store:d}=Le(),[o,m]=(0,i.useState)(e.section),t=Ne(e.section),h=(0,i.useRef)($e(t)),y=(0,i.useRef)(null),[l,P]=(0,i.useState)(e.mode==="highlight"?{at:"highlighting"}:{at:"open"}),ae=(0,i.useRef)(void 0),be=(0,i.useRef)(null),ve=(0,i.useRef)(null),S=(0,i.useRef)([]),U=(0,i.useRef)([]),H=(0,i.useRef)([]),ie=(0,i.useRef)(Date.now()),L=(0,i.useRef)(null),G=(0,i.useRef)(null),_=(0,i.useRef)(null),[ct,se]=(0,i.useState)(!1),[le,X]=(0,i.useState)(!1),[,ut]=(0,i.useState)(0),Q=(0,i.useCallback)(()=>ut(a=>a+1),[]),[ke,gt]=(0,i.useState)(null),Se=(0,i.useRef)(null),M=(0,i.useCallback)(a=>{let g=Se.current;g&&u.told&&ye.load().then(b=>b.changeTelling(u.told,g.id,{outcome:a}),()=>{})},[u.told]),xe=(0,i.useCallback)((a,g,b,R,v,ce)=>{let Z=u.told;Z&&ye.load().then(A=>{let Y=A.keepTelling(Z,{words:a,target:{on:"place",place:g.view},decided:b?{type:"refusal"}:{type:"view",section:g.name},slot:"full",stages:R.map(O=>({stage:O.stage==="thinking"?"full":"light",ms:O.ms,model:O.model})),ms:v,outcome:b?"abandoned":"previewed",interaction:ce},s);Se.current=Y??null,gt(Y??null)},()=>{})},[u.told,s]);(0,i.useEffect)(()=>()=>{L.current?.abort(),y.current?.dispose(),y.current=null},[]);let Ce=l.at==="working";(0,i.useEffect)(()=>{if(Ce)return w({participant:`agent:graview-for-${s.id??"anyone"}:${f}`,kind:"agent",name:"Graview",...s.id?{onBehalfOf:s.id}:{},over:null,robot:{at:null,mode:"thinking"}}),()=>w(null)},[Ce]);let V=(0,i.useCallback)((a,g,b,R={})=>({id:We(),at:new Date().toISOString(),by:s,target:{on:"place",place:o.view},targetLabel:h.current?.title??o.view,ask:{kind:"section",said:a},offered:[],outcome:g,stages:b.map(v=>({stage:v.stage,ms:v.ms,model:v.model})),usage:b.flatMap(v=>v.usage?[{tier:v.stage==="light"?"fast":"thinking",model:v.model,inputTokens:v.usage.inputTokens,outputTokens:v.usage.outputTokens}]:[]),...R}),[s,o.view]),$=(0,i.useCallback)(async a=>{y.current?.dispose();let b=h.current.draft(a);return y.current=b,await b.drawn,b},[]),B=(0,i.useCallback)(async()=>{let a=S.current.at(-1);X(!1),a?await $(a.source):(y.current?.dispose(),y.current=null)},[$]),E=(0,i.useCallback)((a,g)=>{U.current.push({who:a,said:g}),Q()},[Q]),F=()=>U.current.filter(a=>a.who==="person").map(a=>a.said).join(" "),J=(0,i.useCallback)(async a=>{let g=h.current;if(!g||l.at==="working")return;let b=G.current;G.current=null,b&&(_.current=b),E("person",a),H.current=[],ie.current=Date.now(),P({at:"working"});let R=await g.source();if(R===void 0)return E("graview","This view can't be changed here."),P({at:"open"});ae.current??=R;let v=g.drawing(),ce=g.refused(),Z=k=>{let W=d.graph.getNode(k);return W?Ie(d.schema.tryDefinition(W.kind),W):void 0};be.current??=ne(v.root?.parentElement??v.root??t,Qe(v.root,Z)),ve.current??=Je(o.elements);let A=be.current,Y=ve.current,O=new AbortController;L.current=O;let wt=Date.now(),yt=S.current.length,D=await Ke({ai:u,part:{name:o.name,slot:"place"},manifest:{name:g.name,attach:"view",cardinality:"many"},talk:U.current,keep:{title:"",headings:A.headings,records:A.records.map(k=>k.label),says:Object.fromEntries(A.records.flatMap(k=>k.facts?.length||k.under?[[k.label,{...k.facts?.length?{shows:k.facts}:{},...k.under?{under:k.under}:{}}]]:[]))},current:S.current.at(-1)?.source??R,section:o.name,rewordable:Y,noun:"records",..._.current?{about:_.current}:{},host:{look:()=>me(ne(g.drawing().root?.parentElement??t,A.records.map(k=>k.label))),read:()=>({shows:Ft(o.elements)}),draft:async k=>{se(!0);try{let W=await g.check(k);if(W.length>0)return await B(),{findings:W,drew:void 0};let ue=await $(k),{failed:De}=await ue.drawn;if(De)return await B(),{findings:[`The view did not draw: ${De}`],drew:void 0};await new Promise(N=>requestAnimationFrame(()=>requestAnimationFrame(N)));let Re=ue.drawing().root,ge=ne(Re?.parentElement??Re,A.records.map(N=>N.label)),bt=g.presses?await g.presses(k).catch(()=>{}):void 0,Me={asked:F(),mayReword:Y},Ae=[...qt(ae.current,v,ce,ue,k,Me),...je(A,ge,Me),...(bt?.problems??[]).slice(0,5).map(N=>`${N.control}: ${N.says}`)];return Ae.length>0?await B():(S.current.push({source:k,said:Ye(o.name,A,ge)??`\u201C${o.name}\u201D has changed. Compare Before and After.`,entry:V(`Make \u201C${o.name}\u201D better: ${F()}`,"offered",[])}),X(!1)),{findings:Ae,drew:me(ge)}}finally{se(!1)}}},onEvent:k=>{H.current.at(-1)?.kind==="streaming"&&H.current.pop(),H.current.push(k),Q()},signal:O.signal});if(L.current!==O)return;L.current=null,H.current.at(-1)?.kind==="streaming"&&H.current.pop();let ee=S.current.length>yt,Te=V(`Make \u201C${o.name}\u201D better: ${F()}`,ee?"offered":"failed",D.stages,ee?{}:{failed:D.last?.findings.join(" ")??D.said});if(p.record(Te),xe(F(),o,!ee,D.stages,Date.now()-wt,Te.id),E("graview",D.passed&&qe.test(D.said)?"Here it is on the page.":D.said),D.ended==="stuck"&&!ee)return P({at:"stuck",...D.keepable&&D.last?{source:D.last.source}:{}});P(S.current.length>0?{at:"draft"}:{at:"open"})},[u,p,$,V,l.at,t,Q,E,o,B,d,xe]),de=(0,i.useCallback)(()=>{if(l.at!=="working")return;let a=L.current;L.current=null,a?.abort(),se(!1);let g=new Date(ie.current).toISOString();S.current=S.current.filter(b=>b.entry.at<g),B(),E("graview","Stopped. The view is as it was."),P(S.current.length>0?{at:"draft"}:{at:"open"})},[l.at,E,B]),Pe=(0,i.useRef)(!1);(0,i.useEffect)(()=>{Pe.current||!(e.mode==="just"||e.mode==="describe"&&e.words)||(Pe.current=!0,J(e.mode==="just"?"Make it easier to read at a glance":e.words))},[e.mode,e.words,J]);let j=S.current.at(-1),pt=(0,i.useCallback)(async a=>{!j||a===le||(X(a),a?(y.current?.dispose(),y.current=null):await $(j.source))},[j,le,$]),Ee=(0,i.useCallback)(async a=>{a!==void 0&&l.at==="stuck"&&S.current.push({source:a,said:`\u201C${o.name}\u201D kept as it was last drafted.`,entry:V(`Make \u201C${o.name}\u201D better: ${F()}`,"offered",[])});let g=S.current.at(-1);if(l.at!=="draft"&&!(a!==void 0&&l.at==="stuck")||!g||!r?.revise||!h.current)return;let b=h.current,R=await b.source()??"";P({at:"keeping"});try{let v=await r.revise({name:b.name,title:b.title,source:g.source,before:R,section:o.name,said:g.said});y.current?.dispose(),y.current=null,b.draw(g.source),p.record({...g.entry,outcome:"accepted"}),M("accepted"),S.current=[],P({at:"kept",source:R,...v&&v.note?{note:v.note}:{},answer:v,entry:g.entry})}catch{if(E("graview","It couldn't be kept."),a!==void 0)return S.current.pop(),P(S.current.length>0?{at:"draft"}:{at:"open"});P({at:"draft"})}},[l,r,p,o.name,M,E,V]),ft=(0,i.useCallback)(()=>{E("graview","Stopped. The view is as it was."),P(S.current.length>0?{at:"draft"}:{at:"open"})},[E]),mt=(0,i.useCallback)(()=>{y.current?.dispose(),y.current=null;let a=S.current.at(-1);a&&(p.record({...a.entry,outcome:"dismissed"}),M("declined")),S.current=[],X(!1),E("graview","Put back as it was."),P({at:"open"})},[p,M,E]),ht=(0,i.useCallback)(async()=>{if(l.at!=="kept"||!h.current)return;let a=h.current,g=await a.source()??"";try{l.answer&&typeof l.answer.undo=="function"?await l.answer.undo():await r?.revise?.({name:a.name,title:a.title,source:l.source,before:g,section:o.name,said:"Put back as it was.",undoes:!0}),a.draw(l.source===ae.current?void 0:l.source),p.record({...l.entry,outcome:"dismissed"}),M("undone"),E("graview","Undone. The view is as it was."),P({at:"undone"})}catch{E("graview","It couldn't be put back.")}},[l,r,p,o.name,M,E]);return(0,i.useEffect)(()=>{let a=g=>{if(!(g.key!=="Escape"||l.at==="highlighting")){if(g.preventDefault(),l.at==="working")return de();S.current.length>0&&M("declined"),n(),e.returnTo?.focus?.()}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[l.at,de,n,M,e.returnTo]),l.at==="highlighting"?(0,x.jsx)(Gt,{box:t,root:t?.querySelector("[data-worker-view]")?.shadowRoot?.querySelector("[data-graview-view-root]")??void 0,whole:o.elements,cancel:()=>P({at:"open"}),chose:a=>{let g=a[0],b=g?Be(g):void 0;m(b??o),G.current={name:Ve(a)??ze(a.map(st)),lines:Ue(a.map(st))},P({at:"open"})}}):(0,x.jsxs)(x.Fragment,{children:[o.elements.length>0&&l.at==="open"&&U.current.length===0?(0,x.jsx)(he,{elements:o.elements}):null,ct?(0,x.jsx)(Ze,{over:t,name:o.name,said:`Graview is drafting \u201C${o.name}\u201D\u2026`}):null,(0,x.jsx)(rt,{name:o.name,scope:`This changes how \u201C${o.name}\u201D looks for everyone in this app.`,phase:l.at,talk:U.current,steps:H.current,since:ie.current,working:l.at==="working"||l.at==="keeping",...j&&l.at==="draft"?{draft:{said:j.said,before:le}}:{},...l.at==="kept"?{kept:{...l.note?{note:l.note}:{},undo:()=>void ht()}}:{},...l.at==="stuck"?{stuck:{...l.source!==void 0?{keepAnyway:()=>void Ee(l.source)}:{},stop:ft}}:{},about:(G.current??_.current)?.name??o.name,ask:a=>void J(a),just:()=>void J("Make it easier to read at a glance"),point:()=>P({at:"highlighting"}),stop:de,compare:a=>void pt(a),keep:()=>void Ee(),discard:mt,close:()=>{L.current?.abort(),S.current.length>0&&M("declined"),n()},children:ke&&u.told&&l.at!=="working"?(0,x.jsx)(Nt,{told:u.told,telling:ke}):null})]})}function Gt({box:e,root:n,whole:u,wholeSaid:p="The whole section",cancel:w,chose:f}){let s=(0,i.useRef)(null),[r,d]=(0,i.useState)(null);(0,i.useLayoutEffect)(()=>{let t=0,h=()=>{let y=e?Ge([e]):null,l=s.current;l&&y&&(l.style.left=`${Math.round(y.left-oe)}px`,l.style.top=`${Math.round(y.top-oe)}px`,l.style.width=`${Math.round(y.width+2*oe)}px`,l.style.height=`${Math.round(y.height+2*oe)}px`),t=requestAnimationFrame(h)};return h(),()=>cancelAnimationFrame(t)},[e]),(0,i.useEffect)(()=>{s.current?.focus()},[]);let o=t=>{if(!r||!n)return d(null);let h=Math.hypot(t.clientX-r.x0,t.clientY-r.y0)>4,y={left:Math.min(r.x0,t.clientX),top:Math.min(r.y0,t.clientY),right:Math.max(r.x0,t.clientX),bottom:Math.max(r.y0,t.clientY)};d(null);let l=jt(n,y,!h);l.length>0&&f(l)},m=r?{left:Math.min(r.x0,r.x1),top:Math.min(r.y0,r.y1),width:Math.abs(r.x1-r.x0),height:Math.abs(r.y1-r.y0)}:null;return(0,x.jsxs)("div",{ref:s,tabIndex:-1,role:"application","aria-label":"Highlight the area to change: drag over it, or click one part","data-testid":"section-highlighter","data-graview-popover":"",onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),w())},onMouseDown:t=>t.preventDefault(),onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture?.(t.pointerId),d({x0:t.clientX,y0:t.clientY,x1:t.clientX,y1:t.clientY})},onPointerMove:t=>d(h=>h&&{...h,x1:t.clientX,y1:t.clientY}),onPointerUp:o,onPointerCancel:()=>d(null),style:rn,children:[(0,x.jsxs)("p",{style:on,children:["Drag over the part to change, or click one \xB7"," ",(0,x.jsx)("button",{type:"button",onPointerDown:t=>t.stopPropagation(),onClick:()=>f(u),style:lt,children:p})," ","\xB7"," ",(0,x.jsx)("button",{type:"button",onPointerDown:t=>t.stopPropagation(),onClick:w,style:lt,children:"Cancel"})]}),m?(0,x.jsx)("div",{"data-testid":"section-drag",style:{...an,left:m.left-(s.current?.getBoundingClientRect().left??0),top:m.top-(s.current?.getBoundingClientRect().top??0),width:m.width,height:m.height}}):null]})}var _t={position:"fixed",zIndex:q("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float, var(--graview-panel))",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},Xt={margin:0,fontSize:"0.9375rem"},Qt={margin:0,color:"var(--graview-ink-muted)"},Jt={margin:0,color:"var(--graview-ink)",fontStyle:"italic"},Zt={display:"flex",flexWrap:"wrap",gap:8},en={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},dt={minHeight:36,padding:"0 14px",font:"inherit",borderRadius:8,cursor:"pointer"},tn={...dt,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},nn={...dt,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},lt={font:"inherit",color:"inherit",background:"none",border:0,padding:0,textDecoration:"underline",cursor:"pointer"},oe=12,rn={userSelect:"none",WebkitUserSelect:"none",position:"fixed",zIndex:q("popover"),boxSizing:"border-box",cursor:"crosshair",touchAction:"none",outline:"2px dashed var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 6%, transparent)"},on={position:"absolute",left:8,top:8,margin:0,padding:"4px 10px",borderRadius:999,fontSize:"0.8125rem",color:"var(--graview-ink)",background:"var(--graview-float, var(--graview-panel))",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-low)",cursor:"default"},an={position:"absolute",border:"2px solid var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 14%, transparent)",borderRadius:4,pointerEvents:"none"},Cn={CARD:_t,HEAD:Xt,MUTED:Qt,THINKING:Jt,ROW:Zt,FIELD:en,PRIMARY:tn,QUIET:nn};export{rt as a,Sn as b,xn as c,st as d,Yt as e,Kt as f,Gt as g,Cn as h};
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 _e,b as Xe}from"./chunk.Q6GEPVQ7.js";import{a as Qe,b as Je,c as ne,d as Ze}from"./chunk.7LPHWJB4.js";import{a as Ne,b as ze,c as Ue,d as Ve}from"./chunk.DOJCYXIJ.js";import{a as Fe,b as je,c as Ye,f as qe,l as Ke,m as me,n as Ge,o as he}from"./chunk.W332P5T3.js";import{d as We}from"./chunk.HXRHEPPJ.js";import{A as Be,x as $e}from"./chunk.3CLTABGP.js";import{m as Oe}from"./chunk.RJ7VSWTA.js";import{G as He,Oa as fe,Y as te,ga as Le}from"./chunk.JCKIJSW7.js";import{a as pe}from"./chunk.SDO3U72B.js";import{ma as Ie,zd as q}from"./chunk.6L6RUOSF.js";import{b as z}from"./chunk.AJZBJBMO.js";var i=z(He(),1);var C=z(He(),1);var c=z(te(),1),vt=640,we=372,kt=1100,et=()=>typeof innerWidth!="number"||innerWidth>=kt?"side":innerWidth>=vt?"drawer":"sheet";function St(){let e=document.querySelector('[data-testid="app-bar"]');return e||([...document.querySelectorAll("header")].find(n=>{let u=n.getBoundingClientRect();return u.top<=1&&u.width>=innerWidth*.8&&u.height>0})??null)}function xt(e){let n=document.querySelector("[data-graview-page-main], main");for(;n?.parentElement&&n.parentElement!==document.body&&!(e&&n.parentElement.contains(e));)n=n.parentElement;return n}function Ct(e){let[n,u]=(0,C.useState)(et);return(0,C.useLayoutEffect)(()=>{let p=document.body.style,w=p.paddingBottom,f=null,s="",r=0,d=(m,t)=>{f&&f!==m&&(f.style.paddingRight=s),m&&m!==f&&(s=m.style.paddingRight),f=m,f&&(f.style.paddingRight=t?`${we}px`:s)},o=()=>{let m=et();u(m);let t=St(),h=Math.max(0,Math.round(t?.getBoundingClientRect().bottom??0));e.current&&m!=="sheet"&&(e.current.style.top=`${h}px`),d(xt(t),m==="side"),p.paddingBottom=m==="sheet"?`${Math.round((e.current?.getBoundingClientRect().height??0)+16)}px`:w,r=requestAnimationFrame(o)};return o(),()=>{cancelAnimationFrame(r),d(null,!1),p.paddingBottom=w}},[e]),n}var Pt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e%6e4/1e3)).padStart(2,"0")}`;function rt(e){let n=(0,C.useRef)(null),u=(0,C.useRef)(null),p=(0,C.useRef)(null),[w,f]=(0,C.useState)(""),[,s]=(0,C.useState)(0),r=Ct(n);(0,C.useEffect)(()=>{if(!e.working)return;let t=setInterval(()=>s(h=>h+1),1e3);return()=>clearInterval(t)},[e.working]),(0,C.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[e.talk.length,e.steps.length]),(0,C.useEffect)(()=>{e.working||p.current?.focus({preventScroll:!0})},[e.working,e.phase]);let d=e.talk.map(t=>t.who).lastIndexOf("person"),o=e.steps.length>0?(0,c.jsx)("li",{"data-testid":"better-steps",style:Ht,children:(0,c.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:3},children:e.steps.map((t,h)=>{let y=e.working&&h===e.steps.length-1;return(0,c.jsxs)("li",{"data-testid":"better-step","data-step-kind":t.kind,style:{display:"flex",gap:6,alignItems:"baseline",color:y?"var(--graview-ink)":"var(--graview-ink-muted)"},children:[(0,c.jsx)("span",{"aria-hidden":"true",style:{width:14,flex:"none",color:t.kind==="check"||t.kind==="stuck"?"var(--graview-warn)":"var(--graview-accent)"},children:y?"\u2026":t.kind==="check"||t.kind==="stuck"?"!":"\u2713"}),(0,c.jsx)("span",{children:t.text})]},`s${h}`)})})}):null,m=e.talk.length===0;return(0,c.jsxs)("aside",{ref:n,role:"complementary","aria-label":`Change how \u201C${e.name}\u201D looks`,"data-testid":"better-panel","data-better-phase":e.phase,"data-better-dock":r,"data-graview-popover":"",style:r==="sheet"?Tt:r==="drawer"?Et:at,children:[(0,c.jsxs)("header",{style:Rt,children:[(0,c.jsxs)("p",{style:{margin:0,fontWeight:600},children:["Change how \u201C",e.name,"\u201D looks"]}),(0,c.jsx)("button",{type:"button","data-testid":"better-close","aria-label":"Close",onClick:e.close,style:Lt,children:"\xD7"})]}),(0,c.jsx)("p",{"data-testid":"better-scope",style:tt,children:e.scope}),e.about?(0,c.jsxs)("p",{"data-testid":"better-about",style:Dt,children:["About: ",e.about]}):null,(0,c.jsxs)("ol",{ref:u,"data-testid":"better-talk",style:Mt,children:[e.talk.map((t,h)=>(0,c.jsxs)(C.Fragment,{children:[(0,c.jsx)("li",{"data-testid":"better-message","data-who":t.who,style:t.who==="person"?At:It,children:t.said}),h===d?o:null]},`t${h}`)),d<0?o:null]}),e.working?(0,c.jsxs)("div",{style:K,children:[(0,c.jsxs)("p",{role:"status","aria-live":"polite","data-testid":"better-working",style:{margin:0,flex:1,color:"var(--graview-ink-muted)"},children:["Graview is working on \u201C",e.name,"\u201D \xB7 ",(0,c.jsx)("span",{"data-testid":"better-time",children:Pt(Date.now()-e.since)})]}),(0,c.jsx)("button",{type:"button","data-testid":"better-stop",onClick:e.stop,style:I,children:"Stop"})]}):null,e.draft&&!e.working?(0,c.jsxs)("div",{"data-testid":"better-draft",style:{flexShrink:0,display:"grid",gap:6},children:[(0,c.jsx)("p",{"data-testid":"better-changed",style:{margin:0},children:e.draft.said}),(0,c.jsxs)("div",{style:K,children:[(0,c.jsx)("div",{role:"group","aria-label":"Compare",style:$t,children:["Before","After"].map(t=>{let h=t==="Before"?e.draft.before:!e.draft.before;return(0,c.jsx)("button",{type:"button","data-testid":`better-${t.toLowerCase()}`,"aria-pressed":h,onClick:()=>e.compare(t==="Before"),style:h?Bt:Wt,children:t},t)})}),(0,c.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:6},children:[(0,c.jsx)("button",{type:"button","data-testid":"better-keep",onClick:e.keep,style:nt,children:"Keep"}),(0,c.jsx)("button",{type:"button","data-testid":"better-discard",onClick:e.discard,style:I,children:"Discard"})]})]})]}):null,e.stuck&&!e.working?(0,c.jsxs)("div",{"data-testid":"better-stuck",style:K,children:[e.stuck.keepAnyway?(0,c.jsx)("button",{type:"button","data-testid":"better-keep-anyway",onClick:e.stuck.keepAnyway,style:I,children:"Keep anyway"}):null,(0,c.jsx)("button",{type:"button","data-testid":"better-stuck-stop",onClick:e.stuck.stop,style:I,children:"Stop"})]}):null,e.children,e.kept&&!e.working?(0,c.jsxs)("div",{"data-testid":"better-kept",style:K,children:[(0,c.jsx)("p",{style:{margin:0,flex:1},children:e.kept.note?/^kept\b/i.test(e.kept.note.trim())?e.kept.note.trim():`Kept. ${e.kept.note}`:"Kept."}),e.kept.undo?(0,c.jsx)("button",{type:"button","data-testid":"better-undo",onClick:e.kept.undo,style:I,children:"Undo"}):null]}):null,m&&!e.working?(0,c.jsxs)("div",{style:K,children:[(0,c.jsx)("button",{type:"button","data-testid":"better-just",onClick:e.just,style:I,children:"Make it easier to read"}),(0,c.jsx)("button",{type:"button","data-testid":"better-point",onClick:e.point,style:I,children:"Point at a part\u2026"})]}):null,e.pointed&&!e.working?(0,c.jsxs)("p",{"data-testid":"better-pointed",style:tt,children:["You pointed at ",e.pointed,"."]}):null,(0,c.jsxs)("form",{onSubmit:t=>{t.preventDefault(),!(!w.trim()||e.working)&&(e.ask(w.trim()),f(""))},style:{flexShrink:0,display:"flex",gap:6},children:[(0,c.jsx)("label",{htmlFor:"graview-better-panel-words",style:Oe,children:"Tell Graview what to change"}),(0,c.jsx)("input",{id:"graview-better-panel-words",ref:p,"data-testid":"better-words",value:w,disabled:e.working,onChange:t=>f(t.target.value),placeholder:m?"What should change?":"Tell Graview what to change\u2026",style:Ot}),(0,c.jsx)("button",{type:"submit",disabled:e.working||!w.trim(),"data-testid":"better-send",style:nt,children:"Send"})]})]})}var ot={position:"fixed",zIndex:q("popover"),boxSizing:"border-box",display:"flex",flexDirection:"column",gap:10,padding:14,margin:0,fontSize:"0.875rem",lineHeight:1.45,color:"var(--graview-ink)",background:"var(--graview-panel)",overflow:"hidden"},at={...ot,top:0,right:0,bottom:0,width:we,borderLeft:"1px solid var(--graview-edge)"},Et={...at,width:`min(${we}px, 86vw)`,boxShadow:"var(--graview-lift-high, -12px 0 32px rgba(0,0,0,0.18))"},Tt={...ot,left:0,right:0,bottom:0,maxHeight:"55vh",borderTop:"1px solid var(--graview-edge)",borderRadius:"14px 14px 0 0",boxShadow:"var(--graview-lift-high, 0 -12px 32px rgba(0,0,0,0.18))"},Dt={flexShrink:0,margin:0,justifySelf:"start",alignSelf:"flex-start",padding:"2px 10px",borderRadius:999,fontSize:"0.8125rem",color:"var(--graview-ink)",background:"var(--graview-ground)",border:"1px solid var(--graview-edge)"},Rt={flexShrink:0,display:"flex",alignItems:"center",gap:8,justifyContent:"space-between"},tt={flexShrink:0,margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},Mt={margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:8,overflowY:"auto",flex:"1 1 0",minHeight:0},it={padding:"7px 10px",borderRadius:10,maxWidth:"88%",whiteSpace:"pre-wrap",flex:"none"},At={...it,alignSelf:"flex-end",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},It={...it,alignSelf:"flex-start",background:"var(--graview-ground)"},Ht={flex:"none",padding:"6px 10px",borderRadius:10,border:"1px dashed var(--graview-edge)",fontSize:"0.8125rem"},K={flexShrink:0,display:"flex",flexWrap:"wrap",alignItems:"center",gap:6},re={minHeight:32,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",cursor:"pointer"},nt={...re,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},I={...re,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},Lt={...I,minHeight:28,padding:"0 9px",fontSize:"1rem",lineHeight:1},Ot={flex:"1 1 auto",minWidth:0,minHeight:34,padding:"0 10px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.875rem"},$t={display:"inline-flex",border:"1px solid var(--graview-edge)",borderRadius:999,padding:2},Bt={...re,minHeight:28,borderRadius:999,border:"none",color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)"},Wt={...re,minHeight:28,borderRadius:999,border:"none",color:"var(--graview-ink)",background:"transparent"};var x=z(te(),1);var ye=fe(pe(()=>(__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")))),Nt=ye.part((e,n)=>(0,x.jsx)(e.RateTelling,{...n}),{quiet:!0});function Sn({ask:e,open:n,close:u}){return e?.part?(0,x.jsx)(Ut,{ask:e,close:u},e.at):e?.section?(0,x.jsx)(Kt,{ask:e,close:u},e.at):n?(0,x.jsx)(he,{elements:n}):null}var zt=fe(pe(()=>(__graviewPreload(import.meta.url,["./chunk.JNK5WBSU.js","./chunk.Q6GEPVQ7.js","./chunk.7LPHWJB4.js","./chunk.DOJCYXIJ.js","./chunk.W332P5T3.js","./chunk.PGT4ZQDG.js","./chunk.TBY5IR7C.js","./chunk.HXRHEPPJ.js","./chunk.QNWGDG2Z.js","./chunk.BJUUSIQY.js","./chunk.SPJ34VHA.js","./chunk.XOZU4OFA.js","./chunk.KBJ3UUER.js","./chunk.U5KJQFAP.js","./chunk.MIE4TJRW.js","./chunk.3CLTABGP.js","./chunk.RD2FSSLV.js","./chunk.CVN2XFMF.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.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.QVBP4UZG.js")))),Ut=zt.part((e,n)=>(0,x.jsx)(e.PageCard,{...n}),{what:"Make this better"}),Vt=360,T=12;function xn(e,n){let u={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},p=Math.min(Vt,u.width-2*T),w=e.getBoundingClientRect().height,f=d=>Math.max(T,Math.min(d,u.height-w-T)),s=(u.width-p)/2,r=f(72);n&&n.width>0&&(n.right+T+p<=u.width-T?[s,r]=[n.right+T,f(n.top)]:n.left-T-p>=T?[s,r]=[n.left-T-p,f(n.top)]:(s=Math.max(T,Math.min(n.left,u.width-p-T)),r=n.bottom+T+w<=u.height-T?n.bottom+T:f(n.top-T-w))),e.style.left=`${Math.round(s)}px`,e.style.top=`${Math.round(r)}px`,e.style.width=`${Math.round(p)}px`}var Ft=e=>e.map(n=>n.innerText??n.textContent??"").join(" ").replace(/\s+/g," ").trim(),st=e=>{let n=e.getBoundingClientRect();return{tag:(e.getAttribute("data-graview-as")??e.localName).toLowerCase(),classes:[...e.classList],text:e.textContent??"",box:{left:n.left,top:n.top,width:n.width,height:n.height}}};function jt(e,n,u){let p=[...e.querySelectorAll("*")].filter(s=>{let r=s.getBoundingClientRect();return r.width>0&&r.height>0});if(u){let s=p.filter(o=>{let m=o.getBoundingClientRect();return n.left>=m.left&&n.left<=m.right&&n.top>=m.top&&n.top<=m.bottom}),d=s.filter(o=>!s.some(m=>m!==o&&o.contains(m)))[0];if(!d)return[];for(let o=d;o&&o!==e;o=o.parentElement)if(o.classList.length>0||/^(h[1-6]|li|a|button|img|p|article|section)$/.test(o.localName))return[o];return[d]}let w=p.filter(s=>{let r=s.getBoundingClientRect();return r.left>=n.left-2&&r.right<=n.right+2&&r.top>=n.top-2&&r.bottom<=n.bottom+2}),f=w.filter(s=>!w.some(r=>r!==s&&r.contains(s)));for(;f.length===1;){let s=[...f[0].children].filter(r=>w.includes(r));if(s.length<2)break;f=s}return f}function Yt(e,n,u={}){let p=d=>({source:d.source,css:d.css,...d.root?{drawing:d.root}:{},...d.height!==void 0?{height:d.height}:{}}),w=Xe(p(e),p(n)),f=[];for(let d of w.unstyled)f.push(`The class \u201C${d.class}\u201D is still drawn and no rule styles it now.`);let s=d=>d.root?_e(d.root).map(o=>o.name):[],r=e.root&&n.root?Fe(w.sectionsMissing.map(d=>d.name),s(e),s(n),u):w.sectionsMissing.map(d=>d.name);for(let d of r)f.push(`\u201C${d}\u201D is not drawn any more.`);return f}function qt(e,n,u,p,w,f){let s=p.drawing(),r=Yt({source:e,css:n.css,root:n.root,height:n.height},{source:w,css:s.css,root:s.root,height:s.height},f);for(let d of p.refused())u.includes(d)||r.push(d);return r}function Kt({ask:e,close:n}){let{ai:u,aiDesk:p,aiHere:w,session:f,principal:s,keptViews:r,store:d}=Le(),[o,m]=(0,i.useState)(e.section),t=Ne(e.section),h=(0,i.useRef)($e(t)),y=(0,i.useRef)(null),[l,P]=(0,i.useState)(e.mode==="highlight"?{at:"highlighting"}:{at:"open"}),ae=(0,i.useRef)(void 0),be=(0,i.useRef)(null),ve=(0,i.useRef)(null),S=(0,i.useRef)([]),U=(0,i.useRef)([]),H=(0,i.useRef)([]),ie=(0,i.useRef)(Date.now()),L=(0,i.useRef)(null),G=(0,i.useRef)(null),_=(0,i.useRef)(null),[ct,se]=(0,i.useState)(!1),[le,X]=(0,i.useState)(!1),[,ut]=(0,i.useState)(0),Q=(0,i.useCallback)(()=>ut(a=>a+1),[]),[ke,gt]=(0,i.useState)(null),Se=(0,i.useRef)(null),M=(0,i.useCallback)(a=>{let g=Se.current;g&&u.told&&ye.load().then(b=>b.changeTelling(u.told,g.id,{outcome:a}),()=>{})},[u.told]),xe=(0,i.useCallback)((a,g,b,R,v,ce)=>{let Z=u.told;Z&&ye.load().then(A=>{let Y=A.keepTelling(Z,{words:a,target:{on:"place",place:g.view},decided:b?{type:"refusal"}:{type:"view",section:g.name},slot:"full",stages:R.map(O=>({stage:O.stage==="thinking"?"full":"light",ms:O.ms,model:O.model})),ms:v,outcome:b?"abandoned":"previewed",interaction:ce},s);Se.current=Y??null,gt(Y??null)},()=>{})},[u.told,s]);(0,i.useEffect)(()=>()=>{L.current?.abort(),y.current?.dispose(),y.current=null},[]);let Ce=l.at==="working";(0,i.useEffect)(()=>{if(Ce)return w({participant:`agent:graview-for-${s.id??"anyone"}:${f}`,kind:"agent",name:"Graview",...s.id?{onBehalfOf:s.id}:{},over:null,robot:{at:null,mode:"thinking"}}),()=>w(null)},[Ce]);let V=(0,i.useCallback)((a,g,b,R={})=>({id:We(),at:new Date().toISOString(),by:s,target:{on:"place",place:o.view},targetLabel:h.current?.title??o.view,ask:{kind:"section",said:a},offered:[],outcome:g,stages:b.map(v=>({stage:v.stage,ms:v.ms,model:v.model})),usage:b.flatMap(v=>v.usage?[{tier:v.stage==="light"?"fast":"thinking",model:v.model,inputTokens:v.usage.inputTokens,outputTokens:v.usage.outputTokens}]:[]),...R}),[s,o.view]),$=(0,i.useCallback)(async a=>{y.current?.dispose();let b=h.current.draft(a);return y.current=b,await b.drawn,b},[]),B=(0,i.useCallback)(async()=>{let a=S.current.at(-1);X(!1),a?await $(a.source):(y.current?.dispose(),y.current=null)},[$]),E=(0,i.useCallback)((a,g)=>{U.current.push({who:a,said:g}),Q()},[Q]),F=()=>U.current.filter(a=>a.who==="person").map(a=>a.said).join(" "),J=(0,i.useCallback)(async a=>{let g=h.current;if(!g||l.at==="working")return;let b=G.current;G.current=null,b&&(_.current=b),E("person",a),H.current=[],ie.current=Date.now(),P({at:"working"});let R=await g.source();if(R===void 0)return E("graview","This view can't be changed here."),P({at:"open"});ae.current??=R;let v=g.drawing(),ce=g.refused(),Z=k=>{let W=d.graph.getNode(k);return W?Ie(d.schema.tryDefinition(W.kind),W):void 0};be.current??=ne(v.root?.parentElement??v.root??t,Qe(v.root,Z)),ve.current??=Je(o.elements);let A=be.current,Y=ve.current,O=new AbortController;L.current=O;let wt=Date.now(),yt=S.current.length,D=await Ke({ai:u,part:{name:o.name,slot:"place"},manifest:{name:g.name,attach:"view",cardinality:"many"},talk:U.current,keep:{title:"",headings:A.headings,records:A.records.map(k=>k.label),says:Object.fromEntries(A.records.flatMap(k=>k.facts?.length||k.under?[[k.label,{...k.facts?.length?{shows:k.facts}:{},...k.under?{under:k.under}:{}}]]:[]))},current:S.current.at(-1)?.source??R,section:o.name,rewordable:Y,noun:"records",..._.current?{about:_.current}:{},host:{look:()=>me(ne(g.drawing().root?.parentElement??t,A.records.map(k=>k.label))),read:()=>({shows:Ft(o.elements)}),draft:async k=>{se(!0);try{let W=await g.check(k);if(W.length>0)return await B(),{findings:W,drew:void 0};let ue=await $(k),{failed:De}=await ue.drawn;if(De)return await B(),{findings:[`The view did not draw: ${De}`],drew:void 0};await new Promise(N=>requestAnimationFrame(()=>requestAnimationFrame(N)));let Re=ue.drawing().root,ge=ne(Re?.parentElement??Re,A.records.map(N=>N.label)),bt=g.presses?await g.presses(k).catch(()=>{}):void 0,Me={asked:F(),mayReword:Y},Ae=[...qt(ae.current,v,ce,ue,k,Me),...je(A,ge,Me),...(bt?.problems??[]).slice(0,5).map(N=>`${N.control}: ${N.says}`)];return Ae.length>0?await B():(S.current.push({source:k,said:Ye(o.name,A,ge)??`\u201C${o.name}\u201D has changed. Compare Before and After.`,entry:V(`Make \u201C${o.name}\u201D better: ${F()}`,"offered",[])}),X(!1)),{findings:Ae,drew:me(ge)}}finally{se(!1)}}},onEvent:k=>{H.current.at(-1)?.kind==="streaming"&&H.current.pop(),H.current.push(k),Q()},signal:O.signal});if(L.current!==O)return;L.current=null,H.current.at(-1)?.kind==="streaming"&&H.current.pop();let ee=S.current.length>yt,Te=V(`Make \u201C${o.name}\u201D better: ${F()}`,ee?"offered":"failed",D.stages,ee?{}:{failed:D.last?.findings.join(" ")??D.said});if(p.record(Te),xe(F(),o,!ee,D.stages,Date.now()-wt,Te.id),E("graview",D.passed&&qe.test(D.said)?"Here it is on the page.":D.said),D.ended==="stuck"&&!ee)return P({at:"stuck",...D.keepable&&D.last?{source:D.last.source}:{}});P(S.current.length>0?{at:"draft"}:{at:"open"})},[u,p,$,V,l.at,t,Q,E,o,B,d,xe]),de=(0,i.useCallback)(()=>{if(l.at!=="working")return;let a=L.current;L.current=null,a?.abort(),se(!1);let g=new Date(ie.current).toISOString();S.current=S.current.filter(b=>b.entry.at<g),B(),E("graview","Stopped. The view is as it was."),P(S.current.length>0?{at:"draft"}:{at:"open"})},[l.at,E,B]),Pe=(0,i.useRef)(!1);(0,i.useEffect)(()=>{Pe.current||!(e.mode==="just"||e.mode==="describe"&&e.words)||(Pe.current=!0,J(e.mode==="just"?"Make it easier to read at a glance":e.words))},[e.mode,e.words,J]);let j=S.current.at(-1),pt=(0,i.useCallback)(async a=>{!j||a===le||(X(a),a?(y.current?.dispose(),y.current=null):await $(j.source))},[j,le,$]),Ee=(0,i.useCallback)(async a=>{a!==void 0&&l.at==="stuck"&&S.current.push({source:a,said:`\u201C${o.name}\u201D kept as it was last drafted.`,entry:V(`Make \u201C${o.name}\u201D better: ${F()}`,"offered",[])});let g=S.current.at(-1);if(l.at!=="draft"&&!(a!==void 0&&l.at==="stuck")||!g||!r?.revise||!h.current)return;let b=h.current,R=await b.source()??"";P({at:"keeping"});try{let v=await r.revise({name:b.name,title:b.title,source:g.source,before:R,section:o.name,said:g.said});y.current?.dispose(),y.current=null,b.draw(g.source),p.record({...g.entry,outcome:"accepted"}),M("accepted"),S.current=[],P({at:"kept",source:R,...v&&v.note?{note:v.note}:{},answer:v,entry:g.entry})}catch{if(E("graview","It couldn't be kept."),a!==void 0)return S.current.pop(),P(S.current.length>0?{at:"draft"}:{at:"open"});P({at:"draft"})}},[l,r,p,o.name,M,E,V]),ft=(0,i.useCallback)(()=>{E("graview","Stopped. The view is as it was."),P(S.current.length>0?{at:"draft"}:{at:"open"})},[E]),mt=(0,i.useCallback)(()=>{y.current?.dispose(),y.current=null;let a=S.current.at(-1);a&&(p.record({...a.entry,outcome:"dismissed"}),M("declined")),S.current=[],X(!1),E("graview","Put back as it was."),P({at:"open"})},[p,M,E]),ht=(0,i.useCallback)(async()=>{if(l.at!=="kept"||!h.current)return;let a=h.current,g=await a.source()??"";try{l.answer&&typeof l.answer.undo=="function"?await l.answer.undo():await r?.revise?.({name:a.name,title:a.title,source:l.source,before:g,section:o.name,said:"Put back as it was.",undoes:!0}),a.draw(l.source===ae.current?void 0:l.source),p.record({...l.entry,outcome:"dismissed"}),M("undone"),E("graview","Undone. The view is as it was."),P({at:"undone"})}catch{E("graview","It couldn't be put back.")}},[l,r,p,o.name,M,E]);return(0,i.useEffect)(()=>{let a=g=>{if(!(g.key!=="Escape"||l.at==="highlighting")){if(g.preventDefault(),l.at==="working")return de();S.current.length>0&&M("declined"),n(),e.returnTo?.focus?.()}};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[l.at,de,n,M,e.returnTo]),l.at==="highlighting"?(0,x.jsx)(Gt,{box:t,root:t?.querySelector("[data-worker-view]")?.shadowRoot?.querySelector("[data-graview-view-root]")??void 0,whole:o.elements,cancel:()=>P({at:"open"}),chose:a=>{let g=a[0],b=g?Be(g):void 0;m(b??o),G.current={name:Ve(a)??ze(a.map(st)),lines:Ue(a.map(st))},P({at:"open"})}}):(0,x.jsxs)(x.Fragment,{children:[o.elements.length>0&&l.at==="open"&&U.current.length===0?(0,x.jsx)(he,{elements:o.elements}):null,ct?(0,x.jsx)(Ze,{over:t,name:o.name,said:`Graview is drafting \u201C${o.name}\u201D\u2026`}):null,(0,x.jsx)(rt,{name:o.name,scope:`This changes how \u201C${o.name}\u201D looks for everyone in this app.`,phase:l.at,talk:U.current,steps:H.current,since:ie.current,working:l.at==="working"||l.at==="keeping",...j&&l.at==="draft"?{draft:{said:j.said,before:le}}:{},...l.at==="kept"?{kept:{...l.note?{note:l.note}:{},undo:()=>void ht()}}:{},...l.at==="stuck"?{stuck:{...l.source!==void 0?{keepAnyway:()=>void Ee(l.source)}:{},stop:ft}}:{},about:(G.current??_.current)?.name??o.name,ask:a=>void J(a),just:()=>void J("Make it easier to read at a glance"),point:()=>P({at:"highlighting"}),stop:de,compare:a=>void pt(a),keep:()=>void Ee(),discard:mt,close:()=>{L.current?.abort(),S.current.length>0&&M("declined"),n()},children:ke&&u.told&&l.at!=="working"?(0,x.jsx)(Nt,{told:u.told,telling:ke}):null})]})}function Gt({box:e,root:n,whole:u,wholeSaid:p="The whole section",cancel:w,chose:f}){let s=(0,i.useRef)(null),[r,d]=(0,i.useState)(null);(0,i.useLayoutEffect)(()=>{let t=0,h=()=>{let y=e?Ge([e]):null,l=s.current;l&&y&&(l.style.left=`${Math.round(y.left-oe)}px`,l.style.top=`${Math.round(y.top-oe)}px`,l.style.width=`${Math.round(y.width+2*oe)}px`,l.style.height=`${Math.round(y.height+2*oe)}px`),t=requestAnimationFrame(h)};return h(),()=>cancelAnimationFrame(t)},[e]),(0,i.useEffect)(()=>{s.current?.focus()},[]);let o=t=>{if(!r||!n)return d(null);let h=Math.hypot(t.clientX-r.x0,t.clientY-r.y0)>4,y={left:Math.min(r.x0,t.clientX),top:Math.min(r.y0,t.clientY),right:Math.max(r.x0,t.clientX),bottom:Math.max(r.y0,t.clientY)};d(null);let l=jt(n,y,!h);l.length>0&&f(l)},m=r?{left:Math.min(r.x0,r.x1),top:Math.min(r.y0,r.y1),width:Math.abs(r.x1-r.x0),height:Math.abs(r.y1-r.y0)}:null;return(0,x.jsxs)("div",{ref:s,tabIndex:-1,role:"application","aria-label":"Highlight the area to change: drag over it, or click one part","data-testid":"section-highlighter","data-graview-popover":"",onKeyDown:t=>{t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),w())},onMouseDown:t=>t.preventDefault(),onPointerDown:t=>{t.preventDefault(),t.currentTarget.setPointerCapture?.(t.pointerId),d({x0:t.clientX,y0:t.clientY,x1:t.clientX,y1:t.clientY})},onPointerMove:t=>d(h=>h&&{...h,x1:t.clientX,y1:t.clientY}),onPointerUp:o,onPointerCancel:()=>d(null),style:rn,children:[(0,x.jsxs)("p",{style:on,children:["Drag over the part to change, or click one \xB7"," ",(0,x.jsx)("button",{type:"button",onPointerDown:t=>t.stopPropagation(),onClick:()=>f(u),style:lt,children:p})," ","\xB7"," ",(0,x.jsx)("button",{type:"button",onPointerDown:t=>t.stopPropagation(),onClick:w,style:lt,children:"Cancel"})]}),m?(0,x.jsx)("div",{"data-testid":"section-drag",style:{...an,left:m.left-(s.current?.getBoundingClientRect().left??0),top:m.top-(s.current?.getBoundingClientRect().top??0),width:m.width,height:m.height}}):null]})}var _t={position:"fixed",zIndex:q("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float, var(--graview-panel))",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},Xt={margin:0,fontSize:"0.9375rem"},Qt={margin:0,color:"var(--graview-ink-muted)"},Jt={margin:0,color:"var(--graview-ink)",fontStyle:"italic"},Zt={display:"flex",flexWrap:"wrap",gap:8},en={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},dt={minHeight:36,padding:"0 14px",font:"inherit",borderRadius:8,cursor:"pointer"},tn={...dt,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},nn={...dt,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},lt={font:"inherit",color:"inherit",background:"none",border:0,padding:0,textDecoration:"underline",cursor:"pointer"},oe=12,rn={userSelect:"none",WebkitUserSelect:"none",position:"fixed",zIndex:q("popover"),boxSizing:"border-box",cursor:"crosshair",touchAction:"none",outline:"2px dashed var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 6%, transparent)"},on={position:"absolute",left:8,top:8,margin:0,padding:"4px 10px",borderRadius:999,fontSize:"0.8125rem",color:"var(--graview-ink)",background:"var(--graview-float, var(--graview-panel))",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-low)",cursor:"default"},an={position:"absolute",border:"2px solid var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 14%, transparent)",borderRadius:4,pointerEvents:"none"},Cn={CARD:_t,HEAD:Xt,MUTED:Qt,THINKING:Jt,ROW:Zt,FIELD:en,PRIMARY:tn,QUIET:nn};export{rt as a,Sn as b,xn as c,st as d,Yt as e,Kt as f,Gt as g,Cn as h};
@@ -0,0 +1 @@
1
+ import{a as b,b as c,c as d,d as e,e as f}from"./chunk.4O64QV2Y.js";import"./chunk.OYMN3IFX.js";import"./chunk.FOHZPYUV.js";import"./chunk.W6L2VAJG.js";import"./chunk.N3MXLORL.js";import{Xb as a}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
@@ -1 +1 @@
1
- import{h,i as E}from"./chunk.YIDNZTON.js";import{e as z}from"./chunk.QILGAV7H.js";import{a as M}from"./chunk.I6HIVTXU.js";import{$b as k,Ac as v,C as y,Ea as R,Ha as j,Oa as O,Za as P,_a as D,_b as N,fb as L,ha as S,jb as V,kb as g,oc as T,ub as I,xc as Z,yc as q,zc as K}from"./chunk.IUVRJDL3.js";var J=n=>n.safeParse?.(void 0).success??!1,C=n=>h(n).shape,A=n=>{let r=h(n);if(y(r)?.type!=="literal")return;let o=y(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function F(n,r){let o=J(r),e=h(r),t=y(e)?.type,c=T(r);if(c)return{control:"node",name:n,optional:o,kinds:c};let m=O(r);if(m)return{control:"linked",name:n,optional:o,relation:m};if(D(r)){let d=P(n);return{control:"repeat",name:n,optional:o,...d?{of:d}:{}}}if(t==="boolean")return{control:"boolean",name:n,optional:o};let f=R(e);if(f)return{control:"file",name:n,optional:o,...f==="image"?{image:!0}:f==="video"?{video:!0}:{}};if(t==="object"){let d=e.shape??{};return{control:"group",name:n,optional:o,fields:Object.entries(d).map(([a,l])=>F(a,l))}}if(t==="union"){let d=y(e)?.options??[],a=d.map(s=>C(s));if(a.every(s=>s!==void 0)){let s=Object.keys(a[0]??{}).find(u=>a.every(p=>A(p?.[u])!==void 0));if(s)return{control:"variant",name:n,optional:o,tag:s,options:d.map((u,p)=>({value:A(a[p]?.[s])??"",fields:Object.entries(a[p]??{}).filter(([w])=>w!==s).map(([w,B])=>F(w,B))}))}}let l=d.map(s=>A(s));return l.every(s=>s!==void 0)?{control:"choice",name:n,optional:o,options:l}:{control:"opaque",name:n,optional:o}}if(t==="array"){let d=y(e)?.element,a=d===void 0?void 0:F(n,d);return a?.control==="choice"?{...a,optional:o,multiple:!0}:a!==void 0?{control:"list",name:n,optional:o,item:a}:{control:"opaque",name:n,optional:o}}let i=E(r);return i.type==="text"?{control:"text",name:n,optional:o,...i.long?{long:!0}:{},...j(e)?{app:!0}:{},...M(e)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:o,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:o,...i.time?{time:!0}:{},...i.instant?{instant:!0}:{},...i.partial?{partial:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:o,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:o,options:i.options}:{control:"opaque",name:n,optional:o}}function H(n){let r=n.shape;return r?Object.entries(r).map(([o,e])=>F(o,e)):[]}function W(n,r){let o={...r};for(let e of n){let t=r[e.name];t===void 0&&!e.optional&&(e.control==="list"||e.control==="boolean")&&(o[e.name]=e.control==="list"?[]:!1),e.control==="text"&&e.holds&&typeof t=="string"&&(o[e.name]=t.trim()===""?void 0:e.holds==="duration"?z(t)??t:t.trim()),e.control==="group"&&t!==void 0&&typeof t=="object"&&t!==null&&(o[e.name]=W(e.fields,t))}return o}function G(n,r){return q(H(r.input),Z(n,r))}var x="visitor";function gn(n,r,o,e){let t=N.keptFrom?.(n,r),c=new Set;if(!t)return c;let m=Object.keys(o.input.shape??{});for(let a of o.creates??[]){let l=t({id:"\0new",kind:a});for(let s of m)l?.(s)&&c.add(s)}let f=e===void 0?void 0:n.graph.getNode(e),i=f&&n.schema.tryDefinition(f.kind),d=f&&t(f);if(i&&d)for(let a of v(o,i))d(a)&&m.includes(a)&&c.add(a);return c}function _(n,r,o,e){let t=new Set,c=r?.sees??[];if(V(o)||!c.some(k))return t;let m=L(o),f=(l,s)=>{let u=c.filter(p=>p.kinds.includes(l)&&g(p,m));return u.some(k)?I.has(s)||u.some(p=>!k(p)||(p.fields===void 0||p.fields.includes(s))&&!p.hide?.includes(s)):!0},i=Object.keys(e.input.shape??{}),d=new Map,a=(l,s)=>d.set(l,d.get(l)===!0||s);for(let l of e.creates??[]){let s=Object.keys(n.tryDefinition(l)?.fields.shape??{});for(let u of i)s.includes(u)&&a(u,f(l,u))}for(let l of K(n,e)){let s=n.tryDefinition(l);if(s)for(let u of v(e,s))i.includes(u)&&a(u,f(l,u))}for(let[l,s]of d)s||t.add(l);return t}var $=(n,r)=>r.title??S(n);function Q(n,r,o){let e=n?.sees;return!e||e.length===0?!0:e.some(t=>t.kinds.includes(o)&&g(t,r)&&!t.own&&!t.via)}function b(n){switch(n.control){case"node":return[n];case"group":return n.fields.flatMap(b);case"variant":return n.options.flatMap(r=>r.fields.flatMap(b));case"list":return b(n.item);default:return[]}}function U(n,r,o,e){return e.has(o.name)?!1:b(o).every(t=>t.kinds.some(c=>c!=="*"&&Q(n,r,c)))}var X=n=>({kind:"human",id:"form:",roles:[n]});function vn(n,r,o=n.mutations??[]){let e=n.forms?.[r];if(!e)return;let t=o.find(a=>a.name===e.act);if(!t)return;let c=e.role??x,m=X(c),f=_(n.schema,n.policy,m,t),i=G(n.schema,t),d=e.fields?e.fields.flatMap(a=>i.find(l=>l.name===a)??[]):i.filter(a=>U(n.policy,m,a,f));return{name:r,title:$(r,e),...e.intro?{intro:e.intro}:{},...e.say?{say:e.say}:{},submit:e.submit??t.title??S(t.name),role:c,act:t,fields:d}}function An(n,r,o){let e=n.forms?.[r];if(!e)throw new Error(`There is no form called "${r}"${n.forms?`: the forms are ${Object.keys(n.forms).join(", ")}`:": the app declares none"}.`);return{kind:"visitor",id:o,name:`a visitor via the ${$(r,e)} form`,roles:[e.role??x]}}function xn(n){return{said:"Received \u2014 thank you.",...n.say?{next:n.say}:{}}}export{H as a,W as b,G as c,gn as d,_ as e,vn as f,An as g,xn as h};
1
+ import{h,i as E}from"./chunk.VVIQSFM4.js";import{e as z}from"./chunk.TQ3MNB6K.js";import{a as M}from"./chunk.VGYG2IBZ.js";import{$b as k,Ac as v,C as y,Ea as R,Ha as j,Oa as O,Za as P,_a as D,_b as N,fb as L,ha as S,jb as V,kb as g,oc as T,ub as I,xc as Z,yc as q,zc as K}from"./chunk.6L6RUOSF.js";var J=n=>n.safeParse?.(void 0).success??!1,C=n=>h(n).shape,A=n=>{let r=h(n);if(y(r)?.type!=="literal")return;let o=y(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function F(n,r){let o=J(r),e=h(r),t=y(e)?.type,c=T(r);if(c)return{control:"node",name:n,optional:o,kinds:c};let m=O(r);if(m)return{control:"linked",name:n,optional:o,relation:m};if(D(r)){let d=P(n);return{control:"repeat",name:n,optional:o,...d?{of:d}:{}}}if(t==="boolean")return{control:"boolean",name:n,optional:o};let f=R(e);if(f)return{control:"file",name:n,optional:o,...f==="image"?{image:!0}:f==="video"?{video:!0}:{}};if(t==="object"){let d=e.shape??{};return{control:"group",name:n,optional:o,fields:Object.entries(d).map(([a,l])=>F(a,l))}}if(t==="union"){let d=y(e)?.options??[],a=d.map(s=>C(s));if(a.every(s=>s!==void 0)){let s=Object.keys(a[0]??{}).find(u=>a.every(p=>A(p?.[u])!==void 0));if(s)return{control:"variant",name:n,optional:o,tag:s,options:d.map((u,p)=>({value:A(a[p]?.[s])??"",fields:Object.entries(a[p]??{}).filter(([w])=>w!==s).map(([w,B])=>F(w,B))}))}}let l=d.map(s=>A(s));return l.every(s=>s!==void 0)?{control:"choice",name:n,optional:o,options:l}:{control:"opaque",name:n,optional:o}}if(t==="array"){let d=y(e)?.element,a=d===void 0?void 0:F(n,d);return a?.control==="choice"?{...a,optional:o,multiple:!0}:a!==void 0?{control:"list",name:n,optional:o,item:a}:{control:"opaque",name:n,optional:o}}let i=E(r);return i.type==="text"?{control:"text",name:n,optional:o,...i.long?{long:!0}:{},...j(e)?{app:!0}:{},...M(e)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:o,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:o,...i.time?{time:!0}:{},...i.instant?{instant:!0}:{},...i.partial?{partial:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:o,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:o,options:i.options}:{control:"opaque",name:n,optional:o}}function H(n){let r=n.shape;return r?Object.entries(r).map(([o,e])=>F(o,e)):[]}function W(n,r){let o={...r};for(let e of n){let t=r[e.name];t===void 0&&!e.optional&&(e.control==="list"||e.control==="boolean")&&(o[e.name]=e.control==="list"?[]:!1),e.control==="text"&&e.holds&&typeof t=="string"&&(o[e.name]=t.trim()===""?void 0:e.holds==="duration"?z(t)??t:t.trim()),e.control==="group"&&t!==void 0&&typeof t=="object"&&t!==null&&(o[e.name]=W(e.fields,t))}return o}function G(n,r){return q(H(r.input),Z(n,r))}var x="visitor";function gn(n,r,o,e){let t=N.keptFrom?.(n,r),c=new Set;if(!t)return c;let m=Object.keys(o.input.shape??{});for(let a of o.creates??[]){let l=t({id:"\0new",kind:a});for(let s of m)l?.(s)&&c.add(s)}let f=e===void 0?void 0:n.graph.getNode(e),i=f&&n.schema.tryDefinition(f.kind),d=f&&t(f);if(i&&d)for(let a of v(o,i))d(a)&&m.includes(a)&&c.add(a);return c}function _(n,r,o,e){let t=new Set,c=r?.sees??[];if(V(o)||!c.some(k))return t;let m=L(o),f=(l,s)=>{let u=c.filter(p=>p.kinds.includes(l)&&g(p,m));return u.some(k)?I.has(s)||u.some(p=>!k(p)||(p.fields===void 0||p.fields.includes(s))&&!p.hide?.includes(s)):!0},i=Object.keys(e.input.shape??{}),d=new Map,a=(l,s)=>d.set(l,d.get(l)===!0||s);for(let l of e.creates??[]){let s=Object.keys(n.tryDefinition(l)?.fields.shape??{});for(let u of i)s.includes(u)&&a(u,f(l,u))}for(let l of K(n,e)){let s=n.tryDefinition(l);if(s)for(let u of v(e,s))i.includes(u)&&a(u,f(l,u))}for(let[l,s]of d)s||t.add(l);return t}var $=(n,r)=>r.title??S(n);function Q(n,r,o){let e=n?.sees;return!e||e.length===0?!0:e.some(t=>t.kinds.includes(o)&&g(t,r)&&!t.own&&!t.via)}function b(n){switch(n.control){case"node":return[n];case"group":return n.fields.flatMap(b);case"variant":return n.options.flatMap(r=>r.fields.flatMap(b));case"list":return b(n.item);default:return[]}}function U(n,r,o,e){return e.has(o.name)?!1:b(o).every(t=>t.kinds.some(c=>c!=="*"&&Q(n,r,c)))}var X=n=>({kind:"human",id:"form:",roles:[n]});function vn(n,r,o=n.mutations??[]){let e=n.forms?.[r];if(!e)return;let t=o.find(a=>a.name===e.act);if(!t)return;let c=e.role??x,m=X(c),f=_(n.schema,n.policy,m,t),i=G(n.schema,t),d=e.fields?e.fields.flatMap(a=>i.find(l=>l.name===a)??[]):i.filter(a=>U(n.policy,m,a,f));return{name:r,title:$(r,e),...e.intro?{intro:e.intro}:{},...e.say?{say:e.say}:{},submit:e.submit??t.title??S(t.name),role:c,act:t,fields:d}}function An(n,r,o){let e=n.forms?.[r];if(!e)throw new Error(`There is no form called "${r}"${n.forms?`: the forms are ${Object.keys(n.forms).join(", ")}`:": the app declares none"}.`);return{kind:"visitor",id:o,name:`a visitor via the ${$(r,e)} form`,roles:[e.role??x]}}function xn(n){return{said:"Received \u2014 thank you.",...n.say?{next:n.say}:{}}}export{H as a,W as b,G as c,gn as d,_ as e,vn as f,An as g,xn as h};
@@ -1 +1 @@
1
- var s="graview:pins",t={pinned:[],unpinned:[]},i=e=>Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function f(){try{let e=globalThis.localStorage?.getItem(s);if(!e)return t;let o=JSON.parse(e);if(Array.isArray(o))return{pinned:i(o),unpinned:[]};if(typeof o=="object"&&o!==null){let n=o;return{pinned:i(n.pinned),unpinned:i(n.unpinned)}}return t}catch{return t}}function a(e){try{globalThis.localStorage?.setItem(s,JSON.stringify(e))}catch{}}function u(e,o,n=!1){let r=l=>l.filter(d=>d!==o),p=n?e.unpinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:r(e.pinned),unpinned:[...e.unpinned,o]}:e.pinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:[...e.pinned,o],unpinned:r(e.unpinned)};return a(p),p}export{f as a,u as b};
1
+ var s="graview:pins",t={pinned:[],unpinned:[]},p=e=>Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function f(){try{let e=globalThis.localStorage?.getItem(s);if(!e)return t;let o=JSON.parse(e);if(Array.isArray(o))return{pinned:p(o),unpinned:[]};if(typeof o=="object"&&o!==null){let n=o;return{pinned:p(n.pinned),unpinned:p(n.unpinned)}}return t}catch{return t}}function a(e){try{globalThis.localStorage?.setItem(s,JSON.stringify(e))}catch{}}function u(e,o,n=!1){let r=l=>l.filter(d=>d!==o),i=n?e.unpinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:r(e.pinned),unpinned:[...e.unpinned,o]}:e.pinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:[...e.pinned,o],unpinned:r(e.unpinned)};return a(i),i}export{f as a,u as b};
@@ -1 +1 @@
1
- import{c as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk.BBLA4PSP.js";import"./chunk.QG3LV4RH.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.NKUNCQB3.js";import"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{h as createLinks,g as judgeDestination,e as listsOf,c as nowhere,f as placeVocabulary,a as placesSaid,b as quoted,d as whereOfWords};
1
+ import{c as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk.Z2BCOZDZ.js";import"./chunk.WGH2P2YL.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.7KX36ENH.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{h as createLinks,g as judgeDestination,e as listsOf,c as nowhere,f as placeVocabulary,a as placesSaid,b as quoted,d as whereOfWords};
@@ -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{c as lt}from"./chunk.U2DZE7A5.js";import{a as Xe}from"./chunk.CEQQIW7Z.js";import{a as W,b as Ue,c as q,d as J,e as le,g as he,h as $e,i as Ve,j as Q}from"./chunk.BBLA4PSP.js";import"./chunk.QG3LV4RH.js";import{a as Qe,d as et,e as tt,f as rt,g as nt}from"./chunk.YCMMATFK.js";import{h as We}from"./chunk.F5XWYO5W.js";import{b as He,c as Fe}from"./chunk.FSZQTX3K.js";import{h as X,i as st,k as at}from"./chunk.OXXZGPJZ.js";import{e as Ke}from"./chunk.K6EKSURO.js";import{b as be,c as qe,h as Je,i as Ye,j as Ze}from"./chunk.KJAOJTZZ.js";import{f as Be,g as ze}from"./chunk.S4QSZRKH.js";import{d as Ge}from"./chunk.QDVGHI7R.js";import{a as de,c as se,d as ge,e as _e,h as ce,j as ye}from"./chunk.M5FP4Y4Q.js";import{d as ot,k as it}from"./chunk.RSMCTI2N.js";import"./chunk.5IM2X3VT.js";import{a as Ae,b as Me,c as Le}from"./chunk.NKUNCQB3.js";import"./chunk.MR776WQ2.js";import"./chunk.CVVNHQPO.js";import{Wb as fe,Wd as Re,Zb as me,ma as Ce,se as je,te as De}from"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var Ct="http://www.w3.org/1999/xhtml",ae=class{constructor(t){this.ownerDocument=t}parentNode=null;childNodes=[];get firstChild(){return this.childNodes[0]??null}get parentElement(){return this.parentNode instanceof U?this.parentNode:null}get textContent(){return this.childNodes.map(t=>t.textContent).join("")}insertBefore(t,r){t.parentNode&&t.parentNode.removeChild(t);let s=r?this.childNodes.indexOf(r):-1;return s<0?this.childNodes.push(t):this.childNodes.splice(s,0,t),t.parentNode=this,t}appendChild(t){return this.insertBefore(t,null)}removeChild(t){let r=this.childNodes.indexOf(t);return r>=0&&this.childNodes.splice(r,1),t.parentNode=null,t}},ee=class extends ae{constructor(r,s){super(r);this.data=s}nodeType=3;get textContent(){return this.data}},Te=class extends ae{nodeType=8;get textContent(){return""}},U=class extends ae{constructor(r,s,a){super(r);this.namespaceURI=s;this.localName=a}nodeType=1;attributes=new Map;value="";checked=!1;selected=!1;setAttribute(r,s){this.attributes.set(r,String(s))}removeAttribute(r){this.attributes.delete(r)}getAttribute(r){return this.attributes.get(r)??null}hasAttribute(r){return this.attributes.has(r)}closest(r){for(let s=this;s;s=s.parentElement)if(s.localName===r)return s;return null}},Ee=class extends ae{nodeType=9;constructor(){super(null)}createElementNS(t,r){return new U(this,t,r)}createElement(t){return new U(this,Ct,t)}createTextNode(t){return new ee(this,t)}createComment(t){return new Te(this)}};function dt(){let e=new Ee,t=e.createElement("div");return t.setAttribute("data-graview-view-root",""),e.appendChild(t),{document:e,root:t}}function we(e,t,r){let{root:s}=dt(),a=!1,i=Qe(s,{origin:r.origin??"null",...r.imageOrigins?{imageOrigins:r.imageOrigins}:{},...r.asset?{asset:r.asset}:{},...r.link?{link:r.link}:{},maxNodes:r.maxNodes,onOverBudget:()=>a=!0});for(let b of e)i.apply(b);let p=[...i.refused],l="";if(t){let b=Fe(t);l=b.css;for(let o of b.refused)p.push({reason:"css",name:"stylesheet",css:o})}let d=r.theme?He(r.theme).css:"",f=et(d,l);return{root:s,refused:p,size:i.size,over:a,css:f,elementOf:b=>i.elementOf(b),idOf:b=>i.idOf(b)}}var ue=function*(e){for(let t of e.childNodes)t instanceof U&&(yield t,yield*ue(t))},ve=(e,t,r)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(r(s))return s},ct=e=>{let t=["id","class","data-record","data-place","data-act","role","name"].flatMap(r=>e.getAttribute(r)===null?[]:[` ${r}="${e.getAttribute(r).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},ut=e=>e.childNodes.map(t=>t instanceof U?ut(t):t.nodeType===3?t.textContent:"").join("");function Oe(e,t,r){let s=r.typed??{},a=[],i=[...ue(e)].filter(p=>p.getAttribute("data-act")!==null).map(p=>p.getAttribute("data-act"));for(let p of ue(e)){let l=p.getAttribute("name");if(!l||!["input","select","textarea"].includes(p.localName))continue;let d=(p.getAttribute("type")??"text").toLowerCase(),f=Object.hasOwn(s,l);if(d==="radio"){let b=p.getAttribute("value")??"on";if(f?String(s[l])!==b:!p.checked)continue;a.push({name:l,value:b,typed:f,empty:!1,chosen:!0})}else if(p.localName==="select"){let b=[...ue(p)].filter(T=>T.localName==="option"),o=b.find(T=>T.selected||T.getAttribute("selected")!==null)??b[0],A=f?String(s[l]):o?o.getAttribute("value")??ut(o).trim():"";a.push({name:l,value:A,typed:f,empty:A===""&&!f,chosen:!0})}else if(d==="checkbox"){let b=f?s[l]===!0||s[l]==="true"||s[l]==="on":p.checked;a.push({name:l,value:b,typed:f,empty:!b&&!f})}else{let b=ve(p,e,N=>N.getAttribute("data-record")!==null)?.getAttribute("data-record")??t,o=p.value===""&&p.getAttribute("data-prefill")===l&&b?at(r.store,r.principal,r.manifest,r.shown,{record:b,field:l,acts:i}):void 0,A=o!==void 0?{record:b,field:l,value:o}:void 0,T=f?s[l]:o??p.value,y=(d==="number"||d==="range")&&T!==""&&Number.isFinite(Number(T))?Number(T):typeof T=="boolean"?String(T):T;a.push({name:l,value:y,typed:f||A!==void 0,empty:y===""&&!f&&!A,...A?{from:A}:{}})}}return a}function pt(e,t,r,s){let a=r.asked.slice(e.asked),i=r.went.slice(e.went),p=r.renders.length>e.renders,l=e.target!==void 0?t.elementOf(e.target):void 0,d=[...a.map(y=>`its code asked for "${y.name}"`),...i.map(y=>`its code asked to go to "${"record"in y?y.record:y.place}"`),...p?["it drew again"]:[]],f=d.length>0?` When the view heard the click, ${d.join(", ")}.`:"";if(!l)return{selector:e.selector,asked:a,went:i,redrew:p,says:`"${e.selector}" matches nothing the view drew: there is nothing there to press.`};let b=t.root,o={},A=[],T=ye(l,b,y=>ce(y,[...ue(y)].some(de)));if(T){let y=T.getAttribute("data-filter"),N=T.getAttribute("data-section"),k=T.getAttribute("data-record"),$={...y?{where:he(y)}:{},...N?{section:N}:{}},u=k?{record:k,...$}:{place:T.getAttribute("data-place")??"",...$},h=Q(u,{sees:n=>s.shown.has(n),places:s.places,lists:s.lists,schema:s.store.schema});if(h.ok){o.opens=h.arrival;let n=h.arrival,c="filter"in n&&n.filter?`, narrowed to ${n.filter}`:"";A.push(`It opens ${"record"in n?`the record "${n.record}"`:"place"in n?`the place "${n.place}"`:`the list of ${n.list}`}${c}${n.section?`, at "${n.section}"`:""}.`)}else{let n="place"in u?u.place:u.record,c=!("record"in u&&s.shown.has(u.record))&&!W(s.places,n)&&!s.lists.some(g=>g.slug===n||g.kind===n);o.lost=s.placesUnsure&&c?`${h.says}${J}`:h.says,A.push(`It lands in a link that goes nowhere: ${o.lost}`)}}let m=ve(l,b,y=>y.getAttribute("data-act")!==null);if(m){let y=m.getAttribute("data-act"),N=se(m);if(N)A.push(`It is bound to "${y}", and is never pressed: ${N}`);else if(ge(m)){let k=ve(m,b,c=>c.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,$=ve(m,b,c=>c.localName==="fieldset"||c.getAttribute("role")==="group")??b,u={as:y,...k!==void 0?{record:k}:{},fields:Oe($,k,s)},h=X(s.store,s.manifest,s.shown,u);if(!h.ok)o.act={as:y,ok:!1,reason:h.reason,message:h.message};else try{let c=s.store.previewAll([{name:h.name,args:h.args}],{author:s.principal,via:`view:${s.manifest.name}`});o.act={as:y,ok:!0,name:h.name,args:h.args,intent:c.intent,changes:c.ops.length>0}}catch(c){o.act=c instanceof fe?{as:y,ok:!1,reason:"refused",message:c.refusal.message}:c instanceof me?{as:y,ok:!1,reason:"failed",message:Be(c)}:{as:y,ok:!1,reason:"failed",message:"The act could not be applied."}}let n=o.act;A.push(n.ok?`It asks for "${n.name}" with ${JSON.stringify(n.args)}: ${n.changes?`\u201C${n.intent}\u201D, applied for this seat, were it pressed.`:"applied for this seat, it would change nothing."}`:`It asks for "${y}", which the host refuses (${n.reason}): ${n.message}`)}}return A.length===0&&A.push(`It is bound to no act and lands in no link: the host does nothing there${d.length>0?"":", and the view's code does nothing either"}.`),{selector:e.selector,element:ct(l),...o,asked:a,went:i,redrew:p,says:`A press on ${ct(l)}: ${A.join(" ")}${f}`}}var te=function*(e){for(let t of e.childNodes)t instanceof U&&(yield t,yield*te(t))},oe=(e,t,r)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(r(s))return s},ke=e=>e.childNodes.map(t=>t instanceof U?t.getAttribute("aria-hidden")==="true"?"":ke(t):t.nodeType===3?t.textContent:"").join(""),gt=e=>{let t=["id","class","data-record","data-place","data-act","data-file","href","role","name"].flatMap(r=>e.getAttribute(r)===null?[]:[` ${r}="${e.getAttribute(r).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},Rt=e=>{for(let t=e.parentElement;t;t=t.parentElement)if(t.localName==="label")return t.childNodes.map(r=>r===e?"":r instanceof U?ke(r):r.nodeType===3?r.textContent:"").join("");return""},I=e=>{let t=(e.getAttribute("aria-label")??(e.localName==="select"?Rt(e):ke(e))).replace(/\s+/g," ").trim()||e.getAttribute("title")||e.getAttribute("name")||"";return t?`\u201C${t.length>60?`${t.slice(0,59)}\u2026`:t}\u201D`:gt(e)},ft={number:"1",range:"1",date:"2026-01-15","datetime-local":"2026-01-15T09:00",time:"09:00",month:"2026-01",week:"2026-W03",email:"someone@example.com",url:"https://example.com",tel:"+1 555 0100",text:"A test",search:"A test",textarea:"A test"},mt=e=>e.localName==="select"?void 0:e.localName==="textarea"?ft.textarea:ft[(e.getAttribute("type")??"text").toLowerCase()],jt=e=>{let t=[...te(e)].filter(i=>i.localName==="option"),r=i=>i.getAttribute("value")??ke(i).trim(),s=t.find(i=>i.selected||i.getAttribute("selected")!==null)??t[0],a=t.find(i=>i!==s&&i.getAttribute("disabled")===null&&r(i)!==""&&(!s||r(i)!==r(s)));return a?r(a):s?r(s):""},ht=new Set(["input","textarea","select"]),Dt=e=>e.localName==="button"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"||_e(e)||["link","menuitem","menuitemcheckbox","menuitemradio","option"].includes(e.getAttribute("role")??"")||e.localName==="a"&&!e.hasAttribute("href")&&!e.hasAttribute("data-record")&&!e.hasAttribute("data-place")&&!e.hasAttribute("data-file"),Mt=new Set(["tab","option","gridcell"]),Lt=new Set(["checkbox","menuitemcheckbox","menuitemradio","option","radio","switch","treeitem"]),Ht=new Set(["group","radiogroup","tablist","listbox","menu","menubar","toolbar","grid","tree"]),Ft=new Set(["","undefined","false"]),Ut=new Set(["link","tab","menuitem","treeitem","option"]),_t=e=>{let t=e.getAttribute("role");return t===null?e.localName==="a":Ut.has(t)},Vt=e=>{let t=e.getAttribute("role")??"";if(e.getAttribute("aria-pressed")==="true")return{name:"aria-pressed",value:"true"};if(e.getAttribute("aria-selected")==="true"&&Mt.has(t))return{name:"aria-selected",value:"true"};if(e.getAttribute("aria-checked")==="true"&&Lt.has(t))return{name:"aria-checked",value:"true"};let r=e.getAttribute("aria-current");return r!==null&&!Ft.has(r)&&_t(e)?{name:"aria-current",value:r}:void 0},Bt=(e,t)=>oe(e,t,r=>r.hasAttribute("hidden")||r.getAttribute("aria-hidden")==="true"||/(?:^|;)\s*(?:display\s*:\s*none|visibility\s*:\s*hidden)/i.test(r.getAttribute("style")??""))!==void 0,zt=(e,t,r)=>{let s=e.getAttribute("role"),a=e.parentElement,i=a?a.childNodes.filter(d=>d instanceof U):[],l=(a?.localName==="li"&&t==="aria-current"?a.parentElement??void 0:void 0)??(a?oe(a,r,d=>Ht.has(d.getAttribute("role")??"")):void 0);return[...new Set([...i,...l?te(l):[]])].filter(d=>{if(d===e||d.localName!==e.localName||d.getAttribute("role")!==s||Bt(d,r))return!1;let f=d.getAttribute(t);return f==="false"||t==="aria-current"&&f===null})},Wt=e=>e.localName==="summary"||e.hasAttribute("data-lightbox")||e.hasAttribute("data-drop")||e.localName==="graview-video";async function yt(e){let{drawn:t,store:r,principal:s,manifest:a}=e,i=t.root,p=[...te(i)],l=new Set(e.clicks),d=n=>oe(n,i,c=>l.has(t.idOf(c)??""))!==void 0,f=new Set(p.flatMap(n=>n.getAttribute("id")?[n.getAttribute("id")]:[])),b=[],o=(n,c,g,w)=>b.push({control:I(n),element:gt(n),does:c,ok:g,says:w}),A=`view:${a.name}`,T=(n,c)=>{try{return{ok:!0,intent:r.previewAll([{name:n,args:c}],{author:s,via:A}).intent}}catch(g){return g instanceof fe?{ok:!1,message:`this seat may not: ${g.refusal.message}`,missing:!1}:g instanceof me?{ok:!1,message:ze(g),missing:g.issues.some(w=>/required|received undefined/i.test(w.message))}:{ok:!1,message:`the act threw: ${g instanceof Error?g.message.slice(0,200):String(g)}`,missing:!1}}},m=(n,c)=>{let g=oe(n,i,O=>O.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,w=oe(n,i,O=>O.localName==="fieldset"||O.getAttribute("role")==="group")??i;return{as:n.getAttribute("data-act"),...g!==void 0?{record:g}:{},fields:Oe(w,g,{store:r,principal:s,manifest:a,shown:e.shown,places:e.places,lists:e.lists,typed:c})}},y=(n,c)=>{let g=m(n,c),w=X(r,a,e.shown,g);if(!w.ok)return{ok:!1,message:w.message,missing:!1,press:g};let O=T(w.name,w.args);return O.ok?{ok:!0,intent:O.intent,args:w.args,press:g}:{...O,press:g}},N=(n,c)=>{let g=I(n),w=n.getAttribute("data-act"),O=oe(n,i,x=>x.localName==="fieldset"||x.getAttribute("role")==="group")??i,Y=[...te(O)].filter(x=>ht.has(x.localName)&&x.getAttribute("name")),L=c==="save"&&n.localName==="select"&&n.getAttribute("name")?{[n.getAttribute("name")]:jt(n)}:{},R=y(n,L),_=!1,j=Y.filter(x=>x.value===""&&!R.press.fields.find(D=>D.name===x.getAttribute("name"))?.from&&mt(x)!==void 0),K=Object.fromEntries(j.map(x=>[x.getAttribute("name"),mt(x)]));if(j.length>0){let x=y(n,{...L,...K});x.ok?[R,_]=[x,!R.ok]:(R.ok||R.missing)&&(R=x)}if(!R.ok)return o(n,c,!1,`${g} is refused: ${R.message.replace(/\.$/,"")}.`);let S=r.allMutations().find(x=>x.name===X(r,a,e.shown,R.press).name)?.input?.shape??{},E=R.press.fields.filter(x=>x.from&&Object.hasOwn(S,x.name)&&st(S[x.name],void 0)).map(x=>x.name);if(E.length>0){let x={...L,..._?K:{},...Object.fromEntries(E.map(P=>[P,""]))},D=y(n,x);if(!D.ok)return o(n,c,!1,`${g} is refused when ${E.map(P=>`\u201C${P}\u201D`).join(" and ")} ${E.length===1?"is":"are"} emptied: ${D.message.replace(/\.$/,"")}.`)}return o(n,c,!0,`${g} asks for \u201C${w}\u201D${_?" once its fields are filled":""}${R.intent?`: \u201C${R.intent}\u201D`:", which changes nothing as it is drawn"}.`)},k=0,$=e.maxRuns??24;for(let n of p){if(Wt(n))continue;if(n.hasAttribute("data-act")){let S=se(n);if(ht.has(n.localName)&&n.hasAttribute("data-save")){let E=n.getAttribute("data-save");E!=="input"&&E!=="change"?o(n,"save",!1,`${I(n)} saves nothing: data-save is "input" or "change", not "${E}".`):N(n,"save")}else S?o(n,"act",!1,`${I(n)} is bound to \u201C${n.getAttribute("data-act")}\u201D and is never pressed: ${S}`):ge(n)&&N(n,"act");continue}if(n.localName==="a"&&(n.getAttribute("href")??"").startsWith("#")){let S=n.getAttribute("href").slice(1);o(n,"jump",f.has(S),f.has(S)?`${I(n)} jumps to #${S}.`:`${I(n)} jumps to #${S}, and the view drew no element with that id.`);continue}if(n.hasAttribute("data-file")){let S=n.getAttribute("data-file")??"",E=n.getAttribute("data-field")??"",x=e.shown.has(S)?r.seenBy(s).graph.getNode(S):void 0,D=x&&E?Ge(x[E]):[],P=Number(n.getAttribute("data-index")??"0"),V=D[Number.isInteger(P)&&P>=0?P:0];n.localName!=="a"?o(n,"file",!1,`${I(n)} is a file link on a <${n.localName}>: a file link is an <a data-file>.`):x?V?o(n,"file",!0,`${I(n)} ${n.hasAttribute("data-download")?"downloads":"opens"} \u201C${V.name??"the file"}\u201D.`):o(n,"file",!1,`${I(n)} links to the file in "${E||"(no data-field)"}" of "${S}", which holds none.`):o(n,"file",!1,`${I(n)} links to a file of "${S}", which is no record this view was shown.`);continue}if(ce(n,[...te(n)].some(de))){let S=n.getAttribute("data-filter"),E=n.getAttribute("data-section"),x=n.getAttribute("data-record"),D={...S?{where:he(S)}:{},...E?{section:E}:{}},P=x?{record:x,...D}:{place:n.getAttribute("data-place")??"",...D},V=Q(P,{sees:v=>e.shown.has(v),places:e.places,lists:e.lists,schema:r.schema});if(V.ok){let v=V.arrival;o(n,"link",!0,`${I(n)} opens ${"record"in v?`the record "${v.record}"`:"place"in v?`the place "${v.place}"`:`the list of ${v.list}`}.`)}else{let v="place"in P?P.place:P.record,H="place"in P&&!W(e.places,v)&&!e.lists.some(B=>B.slug===v||B.kind===v);e.placesUnsure&&H?o(n,"link",!0,`${I(n)} may go nowhere: ${V.says}${J}`):o(n,"link",!1,`${I(n)} goes nowhere: ${V.says}`)}continue}let c=t.idOf(n),g=l.has(c??"");if(!Dt(n)&&!g||!g&&ye(n,i,S=>ce(S,[...te(S)].some(de))))continue;if(!d(n)){o(n,"nothing",!1,`${I(n)} does nothing: it is bound to no act (data-act), goes nowhere (data-record, data-place), and the view hears no click on it.`);continue}if(c===void 0)continue;if(k>=$){o(n,"code",!0,`${I(n)} was not pressed: the check presses ${$} controls the view's code hears, and this is past them.`);continue}k+=1;let w=await e.rerun(c);if(!w.ok){o(n,"code",!1,w.reason==="error"?`${I(n)} throws when pressed: ${w.detail.replace(/^It threw: /,"")}`:`${I(n)}, pressed, stopped the view (${w.reason}): ${w.detail}`);continue}let O=w.transcript.pressed;if(!O||O.target===void 0){o(n,"code",!1,`${I(n)} could not be pressed in a run of its own: it was not drawn there the same way.`);continue}let Y=w.transcript.asked.slice(O.asked),L=w.transcript.went.slice(O.went),R=w.transcript.renders.length>O.renders,_=[];for(let S of Y){let E=Ke(r,a,S.name,S.args??{},{shown:e.shown,file:()=>{},dropped:()=>{}});if(!E.ok)_.push(`it asks for \u201C${S.name}\u201D from its code, which is refused: ${E.message}${E.reason==="press-only"?` Bind the button to it instead: data-act="${S.name}".`:""}`);else{let x=T(E.name,E.args);x.ok||_.push(`it asks for \u201C${S.name}\u201D, which is refused: ${x.message}`)}}for(let S of L){let E=Q(S,{sees:x=>e.shown.has(x),places:e.places,lists:e.lists,schema:r.schema});E.ok||_.push(`it asks to go nowhere: ${E.says}`)}let j=Y.length===0&&L.length===0&&!R?Vt(n):void 0,K=!1,ie=!1;if(j)for(let S of zt(n,j.name,i)){let E=j.name==="aria-current";if(S.hasAttribute("data-act")||E&&(S.hasAttribute("data-record")||S.hasAttribute("data-place")||S.hasAttribute("href"))){K=!0;break}let x=t.idOf(S);if(x===void 0||!d(S))continue;if(k>=$){ie=!0;break}k+=1;let D=await e.rerun(x),P=D.ok?D.transcript.pressed:void 0;if(!D.ok||!P||P.target===void 0)continue;let V=we(D.transcript.renders,void 0,{maxNodes:1e5}).elementOf(c);if(D.transcript.asked.length>P.asked||E&&D.transcript.went.length>P.went||V?.getAttribute(j.name)!==j.value){K=!0;break}}_.length>0?o(n,"code",!1,`${I(n)}, pressed: ${_.join("; ")}`):j&&K?o(n,"code",!0,`${I(n)} is already in the state it shows (${j.name}="${j.value}"): pressed, it leaves the view as it is.`):j&&ie?o(n,"code",!0,`${I(n)} was not pressed: the check presses ${$} controls the view's code hears, and this is past them.`):j?o(n,"code",!1,`${I(n)} does nothing when pressed: it says ${j.name}="${j.value}", and no press on this view takes that from it.`):Y.length===0&&L.length===0&&!R?o(n,"code",!1,`${I(n)} does nothing when pressed: the view hears the click, and asks for no act, goes nowhere and draws nothing new.`):o(n,"code",!0,`${I(n)}, pressed, ${[...Y.length>0?[`asks for ${Y.map(S=>`\u201C${S.name}\u201D`).join(", ")}`]:[],...L.length>0?["goes where it says"]:[],...R?["draws again"]:[]].join(" and ")}.`)}let u=b.filter(n=>!n.ok),h=[`Presses: ${b.length} control${b.length===1?"":"s"} pressed, ${u.length===0?"every one does what it says":`${u.length} ${u.length===1?"fails":"fail"}`}.`];for(let n of b)h.push(` ${n.ok?"ok ":"FAILS"} ${n.says}`);return{ok:u.length===0,controls:b,problems:u,text:`${h.join(`
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as lt}from"./chunk.Q6GEPVQ7.js";import{a as Xe}from"./chunk.CEQQIW7Z.js";import{a as W,b as Ue,c as q,d as J,e as le,g as he,h as $e,i as Ve,j as Q}from"./chunk.Z2BCOZDZ.js";import"./chunk.WGH2P2YL.js";import{a as Qe,d as et,e as tt,f as rt,g as nt}from"./chunk.GOVRX2YX.js";import{h as We}from"./chunk.TRP66PHK.js";import{b as He,c as Fe}from"./chunk.PGT4ZQDG.js";import{h as X,i as st,k as at}from"./chunk.UZKBFI52.js";import{e as Ke}from"./chunk.MFMC35ET.js";import{b as be,c as qe,h as Je,i as Ye,j as Ze}from"./chunk.GKYJQE5A.js";import{f as Be,g as ze}from"./chunk.EZQK23AB.js";import{d as Ge}from"./chunk.QDVGHI7R.js";import{a as de,c as se,d as ge,e as _e,h as ce,j as ye}from"./chunk.M5FP4Y4Q.js";import{d as ot,k as it}from"./chunk.RSMCTI2N.js";import"./chunk.PQTXM4VY.js";import{a as Ae,b as Me,c as Le}from"./chunk.7KX36ENH.js";import"./chunk.UQZ2P6KD.js";import"./chunk.MT252WP4.js";import{Wb as fe,Wd as Re,Zb as me,ma as Ce,se as je,te as De}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var Ct="http://www.w3.org/1999/xhtml",ae=class{constructor(t){this.ownerDocument=t}parentNode=null;childNodes=[];get firstChild(){return this.childNodes[0]??null}get parentElement(){return this.parentNode instanceof U?this.parentNode:null}get textContent(){return this.childNodes.map(t=>t.textContent).join("")}insertBefore(t,r){t.parentNode&&t.parentNode.removeChild(t);let s=r?this.childNodes.indexOf(r):-1;return s<0?this.childNodes.push(t):this.childNodes.splice(s,0,t),t.parentNode=this,t}appendChild(t){return this.insertBefore(t,null)}removeChild(t){let r=this.childNodes.indexOf(t);return r>=0&&this.childNodes.splice(r,1),t.parentNode=null,t}},ee=class extends ae{constructor(r,s){super(r);this.data=s}nodeType=3;get textContent(){return this.data}},Te=class extends ae{nodeType=8;get textContent(){return""}},U=class extends ae{constructor(r,s,a){super(r);this.namespaceURI=s;this.localName=a}nodeType=1;attributes=new Map;value="";checked=!1;selected=!1;setAttribute(r,s){this.attributes.set(r,String(s))}removeAttribute(r){this.attributes.delete(r)}getAttribute(r){return this.attributes.get(r)??null}hasAttribute(r){return this.attributes.has(r)}closest(r){for(let s=this;s;s=s.parentElement)if(s.localName===r)return s;return null}},Ee=class extends ae{nodeType=9;constructor(){super(null)}createElementNS(t,r){return new U(this,t,r)}createElement(t){return new U(this,Ct,t)}createTextNode(t){return new ee(this,t)}createComment(t){return new Te(this)}};function dt(){let e=new Ee,t=e.createElement("div");return t.setAttribute("data-graview-view-root",""),e.appendChild(t),{document:e,root:t}}function we(e,t,r){let{root:s}=dt(),a=!1,i=Qe(s,{origin:r.origin??"null",...r.imageOrigins?{imageOrigins:r.imageOrigins}:{},...r.asset?{asset:r.asset}:{},...r.link?{link:r.link}:{},maxNodes:r.maxNodes,onOverBudget:()=>a=!0});for(let b of e)i.apply(b);let p=[...i.refused],l="";if(t){let b=Fe(t);l=b.css;for(let o of b.refused)p.push({reason:"css",name:"stylesheet",css:o})}let d=r.theme?He(r.theme).css:"",f=et(d,l);return{root:s,refused:p,size:i.size,over:a,css:f,elementOf:b=>i.elementOf(b),idOf:b=>i.idOf(b)}}var ue=function*(e){for(let t of e.childNodes)t instanceof U&&(yield t,yield*ue(t))},ve=(e,t,r)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(r(s))return s},ct=e=>{let t=["id","class","data-record","data-place","data-act","role","name"].flatMap(r=>e.getAttribute(r)===null?[]:[` ${r}="${e.getAttribute(r).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},ut=e=>e.childNodes.map(t=>t instanceof U?ut(t):t.nodeType===3?t.textContent:"").join("");function Oe(e,t,r){let s=r.typed??{},a=[],i=[...ue(e)].filter(p=>p.getAttribute("data-act")!==null).map(p=>p.getAttribute("data-act"));for(let p of ue(e)){let l=p.getAttribute("name");if(!l||!["input","select","textarea"].includes(p.localName))continue;let d=(p.getAttribute("type")??"text").toLowerCase(),f=Object.hasOwn(s,l);if(d==="radio"){let b=p.getAttribute("value")??"on";if(f?String(s[l])!==b:!p.checked)continue;a.push({name:l,value:b,typed:f,empty:!1,chosen:!0})}else if(p.localName==="select"){let b=[...ue(p)].filter(T=>T.localName==="option"),o=b.find(T=>T.selected||T.getAttribute("selected")!==null)??b[0],A=f?String(s[l]):o?o.getAttribute("value")??ut(o).trim():"";a.push({name:l,value:A,typed:f,empty:A===""&&!f,chosen:!0})}else if(d==="checkbox"){let b=f?s[l]===!0||s[l]==="true"||s[l]==="on":p.checked;a.push({name:l,value:b,typed:f,empty:!b&&!f})}else{let b=ve(p,e,N=>N.getAttribute("data-record")!==null)?.getAttribute("data-record")??t,o=p.value===""&&p.getAttribute("data-prefill")===l&&b?at(r.store,r.principal,r.manifest,r.shown,{record:b,field:l,acts:i}):void 0,A=o!==void 0?{record:b,field:l,value:o}:void 0,T=f?s[l]:o??p.value,y=(d==="number"||d==="range")&&T!==""&&Number.isFinite(Number(T))?Number(T):typeof T=="boolean"?String(T):T;a.push({name:l,value:y,typed:f||A!==void 0,empty:y===""&&!f&&!A,...A?{from:A}:{}})}}return a}function pt(e,t,r,s){let a=r.asked.slice(e.asked),i=r.went.slice(e.went),p=r.renders.length>e.renders,l=e.target!==void 0?t.elementOf(e.target):void 0,d=[...a.map(y=>`its code asked for "${y.name}"`),...i.map(y=>`its code asked to go to "${"record"in y?y.record:y.place}"`),...p?["it drew again"]:[]],f=d.length>0?` When the view heard the click, ${d.join(", ")}.`:"";if(!l)return{selector:e.selector,asked:a,went:i,redrew:p,says:`"${e.selector}" matches nothing the view drew: there is nothing there to press.`};let b=t.root,o={},A=[],T=ye(l,b,y=>ce(y,[...ue(y)].some(de)));if(T){let y=T.getAttribute("data-filter"),N=T.getAttribute("data-section"),k=T.getAttribute("data-record"),$={...y?{where:he(y)}:{},...N?{section:N}:{}},u=k?{record:k,...$}:{place:T.getAttribute("data-place")??"",...$},h=Q(u,{sees:n=>s.shown.has(n),places:s.places,lists:s.lists,schema:s.store.schema});if(h.ok){o.opens=h.arrival;let n=h.arrival,c="filter"in n&&n.filter?`, narrowed to ${n.filter}`:"";A.push(`It opens ${"record"in n?`the record "${n.record}"`:"place"in n?`the place "${n.place}"`:`the list of ${n.list}`}${c}${n.section?`, at "${n.section}"`:""}.`)}else{let n="place"in u?u.place:u.record,c=!("record"in u&&s.shown.has(u.record))&&!W(s.places,n)&&!s.lists.some(g=>g.slug===n||g.kind===n);o.lost=s.placesUnsure&&c?`${h.says}${J}`:h.says,A.push(`It lands in a link that goes nowhere: ${o.lost}`)}}let m=ve(l,b,y=>y.getAttribute("data-act")!==null);if(m){let y=m.getAttribute("data-act"),N=se(m);if(N)A.push(`It is bound to "${y}", and is never pressed: ${N}`);else if(ge(m)){let k=ve(m,b,c=>c.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,$=ve(m,b,c=>c.localName==="fieldset"||c.getAttribute("role")==="group")??b,u={as:y,...k!==void 0?{record:k}:{},fields:Oe($,k,s)},h=X(s.store,s.manifest,s.shown,u);if(!h.ok)o.act={as:y,ok:!1,reason:h.reason,message:h.message};else try{let c=s.store.previewAll([{name:h.name,args:h.args}],{author:s.principal,via:`view:${s.manifest.name}`});o.act={as:y,ok:!0,name:h.name,args:h.args,intent:c.intent,changes:c.ops.length>0}}catch(c){o.act=c instanceof fe?{as:y,ok:!1,reason:"refused",message:c.refusal.message}:c instanceof me?{as:y,ok:!1,reason:"failed",message:Be(c)}:{as:y,ok:!1,reason:"failed",message:"The act could not be applied."}}let n=o.act;A.push(n.ok?`It asks for "${n.name}" with ${JSON.stringify(n.args)}: ${n.changes?`\u201C${n.intent}\u201D, applied for this seat, were it pressed.`:"applied for this seat, it would change nothing."}`:`It asks for "${y}", which the host refuses (${n.reason}): ${n.message}`)}}return A.length===0&&A.push(`It is bound to no act and lands in no link: the host does nothing there${d.length>0?"":", and the view's code does nothing either"}.`),{selector:e.selector,element:ct(l),...o,asked:a,went:i,redrew:p,says:`A press on ${ct(l)}: ${A.join(" ")}${f}`}}var te=function*(e){for(let t of e.childNodes)t instanceof U&&(yield t,yield*te(t))},oe=(e,t,r)=>{for(let s=e;s&&s!==t;s=s.parentElement)if(r(s))return s},ke=e=>e.childNodes.map(t=>t instanceof U?t.getAttribute("aria-hidden")==="true"?"":ke(t):t.nodeType===3?t.textContent:"").join(""),gt=e=>{let t=["id","class","data-record","data-place","data-act","data-file","href","role","name"].flatMap(r=>e.getAttribute(r)===null?[]:[` ${r}="${e.getAttribute(r).slice(0,80)}"`]);return`<${e.localName}${t.join("")}>`},Rt=e=>{for(let t=e.parentElement;t;t=t.parentElement)if(t.localName==="label")return t.childNodes.map(r=>r===e?"":r instanceof U?ke(r):r.nodeType===3?r.textContent:"").join("");return""},I=e=>{let t=(e.getAttribute("aria-label")??(e.localName==="select"?Rt(e):ke(e))).replace(/\s+/g," ").trim()||e.getAttribute("title")||e.getAttribute("name")||"";return t?`\u201C${t.length>60?`${t.slice(0,59)}\u2026`:t}\u201D`:gt(e)},ft={number:"1",range:"1",date:"2026-01-15","datetime-local":"2026-01-15T09:00",time:"09:00",month:"2026-01",week:"2026-W03",email:"someone@example.com",url:"https://example.com",tel:"+1 555 0100",text:"A test",search:"A test",textarea:"A test"},mt=e=>e.localName==="select"?void 0:e.localName==="textarea"?ft.textarea:ft[(e.getAttribute("type")??"text").toLowerCase()],jt=e=>{let t=[...te(e)].filter(i=>i.localName==="option"),r=i=>i.getAttribute("value")??ke(i).trim(),s=t.find(i=>i.selected||i.getAttribute("selected")!==null)??t[0],a=t.find(i=>i!==s&&i.getAttribute("disabled")===null&&r(i)!==""&&(!s||r(i)!==r(s)));return a?r(a):s?r(s):""},ht=new Set(["input","textarea","select"]),Dt=e=>e.localName==="button"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"||_e(e)||["link","menuitem","menuitemcheckbox","menuitemradio","option"].includes(e.getAttribute("role")??"")||e.localName==="a"&&!e.hasAttribute("href")&&!e.hasAttribute("data-record")&&!e.hasAttribute("data-place")&&!e.hasAttribute("data-file"),Mt=new Set(["tab","option","gridcell"]),Lt=new Set(["checkbox","menuitemcheckbox","menuitemradio","option","radio","switch","treeitem"]),Ht=new Set(["group","radiogroup","tablist","listbox","menu","menubar","toolbar","grid","tree"]),Ft=new Set(["","undefined","false"]),Ut=new Set(["link","tab","menuitem","treeitem","option"]),_t=e=>{let t=e.getAttribute("role");return t===null?e.localName==="a":Ut.has(t)},Vt=e=>{let t=e.getAttribute("role")??"";if(e.getAttribute("aria-pressed")==="true")return{name:"aria-pressed",value:"true"};if(e.getAttribute("aria-selected")==="true"&&Mt.has(t))return{name:"aria-selected",value:"true"};if(e.getAttribute("aria-checked")==="true"&&Lt.has(t))return{name:"aria-checked",value:"true"};let r=e.getAttribute("aria-current");return r!==null&&!Ft.has(r)&&_t(e)?{name:"aria-current",value:r}:void 0},Bt=(e,t)=>oe(e,t,r=>r.hasAttribute("hidden")||r.getAttribute("aria-hidden")==="true"||/(?:^|;)\s*(?:display\s*:\s*none|visibility\s*:\s*hidden)/i.test(r.getAttribute("style")??""))!==void 0,zt=(e,t,r)=>{let s=e.getAttribute("role"),a=e.parentElement,i=a?a.childNodes.filter(d=>d instanceof U):[],l=(a?.localName==="li"&&t==="aria-current"?a.parentElement??void 0:void 0)??(a?oe(a,r,d=>Ht.has(d.getAttribute("role")??"")):void 0);return[...new Set([...i,...l?te(l):[]])].filter(d=>{if(d===e||d.localName!==e.localName||d.getAttribute("role")!==s||Bt(d,r))return!1;let f=d.getAttribute(t);return f==="false"||t==="aria-current"&&f===null})},Wt=e=>e.localName==="summary"||e.hasAttribute("data-lightbox")||e.hasAttribute("data-drop")||e.localName==="graview-video";async function yt(e){let{drawn:t,store:r,principal:s,manifest:a}=e,i=t.root,p=[...te(i)],l=new Set(e.clicks),d=n=>oe(n,i,c=>l.has(t.idOf(c)??""))!==void 0,f=new Set(p.flatMap(n=>n.getAttribute("id")?[n.getAttribute("id")]:[])),b=[],o=(n,c,g,w)=>b.push({control:I(n),element:gt(n),does:c,ok:g,says:w}),A=`view:${a.name}`,T=(n,c)=>{try{return{ok:!0,intent:r.previewAll([{name:n,args:c}],{author:s,via:A}).intent}}catch(g){return g instanceof fe?{ok:!1,message:`this seat may not: ${g.refusal.message}`,missing:!1}:g instanceof me?{ok:!1,message:ze(g),missing:g.issues.some(w=>/required|received undefined/i.test(w.message))}:{ok:!1,message:`the act threw: ${g instanceof Error?g.message.slice(0,200):String(g)}`,missing:!1}}},m=(n,c)=>{let g=oe(n,i,O=>O.getAttribute("data-record")!==null)?.getAttribute("data-record")??void 0,w=oe(n,i,O=>O.localName==="fieldset"||O.getAttribute("role")==="group")??i;return{as:n.getAttribute("data-act"),...g!==void 0?{record:g}:{},fields:Oe(w,g,{store:r,principal:s,manifest:a,shown:e.shown,places:e.places,lists:e.lists,typed:c})}},y=(n,c)=>{let g=m(n,c),w=X(r,a,e.shown,g);if(!w.ok)return{ok:!1,message:w.message,missing:!1,press:g};let O=T(w.name,w.args);return O.ok?{ok:!0,intent:O.intent,args:w.args,press:g}:{...O,press:g}},N=(n,c)=>{let g=I(n),w=n.getAttribute("data-act"),O=oe(n,i,x=>x.localName==="fieldset"||x.getAttribute("role")==="group")??i,Y=[...te(O)].filter(x=>ht.has(x.localName)&&x.getAttribute("name")),L=c==="save"&&n.localName==="select"&&n.getAttribute("name")?{[n.getAttribute("name")]:jt(n)}:{},R=y(n,L),_=!1,j=Y.filter(x=>x.value===""&&!R.press.fields.find(D=>D.name===x.getAttribute("name"))?.from&&mt(x)!==void 0),K=Object.fromEntries(j.map(x=>[x.getAttribute("name"),mt(x)]));if(j.length>0){let x=y(n,{...L,...K});x.ok?[R,_]=[x,!R.ok]:(R.ok||R.missing)&&(R=x)}if(!R.ok)return o(n,c,!1,`${g} is refused: ${R.message.replace(/\.$/,"")}.`);let S=r.allMutations().find(x=>x.name===X(r,a,e.shown,R.press).name)?.input?.shape??{},E=R.press.fields.filter(x=>x.from&&Object.hasOwn(S,x.name)&&st(S[x.name],void 0)).map(x=>x.name);if(E.length>0){let x={...L,..._?K:{},...Object.fromEntries(E.map(P=>[P,""]))},D=y(n,x);if(!D.ok)return o(n,c,!1,`${g} is refused when ${E.map(P=>`\u201C${P}\u201D`).join(" and ")} ${E.length===1?"is":"are"} emptied: ${D.message.replace(/\.$/,"")}.`)}return o(n,c,!0,`${g} asks for \u201C${w}\u201D${_?" once its fields are filled":""}${R.intent?`: \u201C${R.intent}\u201D`:", which changes nothing as it is drawn"}.`)},k=0,$=e.maxRuns??24;for(let n of p){if(Wt(n))continue;if(n.hasAttribute("data-act")){let S=se(n);if(ht.has(n.localName)&&n.hasAttribute("data-save")){let E=n.getAttribute("data-save");E!=="input"&&E!=="change"?o(n,"save",!1,`${I(n)} saves nothing: data-save is "input" or "change", not "${E}".`):N(n,"save")}else S?o(n,"act",!1,`${I(n)} is bound to \u201C${n.getAttribute("data-act")}\u201D and is never pressed: ${S}`):ge(n)&&N(n,"act");continue}if(n.localName==="a"&&(n.getAttribute("href")??"").startsWith("#")){let S=n.getAttribute("href").slice(1);o(n,"jump",f.has(S),f.has(S)?`${I(n)} jumps to #${S}.`:`${I(n)} jumps to #${S}, and the view drew no element with that id.`);continue}if(n.hasAttribute("data-file")){let S=n.getAttribute("data-file")??"",E=n.getAttribute("data-field")??"",x=e.shown.has(S)?r.seenBy(s).graph.getNode(S):void 0,D=x&&E?Ge(x[E]):[],P=Number(n.getAttribute("data-index")??"0"),V=D[Number.isInteger(P)&&P>=0?P:0];n.localName!=="a"?o(n,"file",!1,`${I(n)} is a file link on a <${n.localName}>: a file link is an <a data-file>.`):x?V?o(n,"file",!0,`${I(n)} ${n.hasAttribute("data-download")?"downloads":"opens"} \u201C${V.name??"the file"}\u201D.`):o(n,"file",!1,`${I(n)} links to the file in "${E||"(no data-field)"}" of "${S}", which holds none.`):o(n,"file",!1,`${I(n)} links to a file of "${S}", which is no record this view was shown.`);continue}if(ce(n,[...te(n)].some(de))){let S=n.getAttribute("data-filter"),E=n.getAttribute("data-section"),x=n.getAttribute("data-record"),D={...S?{where:he(S)}:{},...E?{section:E}:{}},P=x?{record:x,...D}:{place:n.getAttribute("data-place")??"",...D},V=Q(P,{sees:v=>e.shown.has(v),places:e.places,lists:e.lists,schema:r.schema});if(V.ok){let v=V.arrival;o(n,"link",!0,`${I(n)} opens ${"record"in v?`the record "${v.record}"`:"place"in v?`the place "${v.place}"`:`the list of ${v.list}`}.`)}else{let v="place"in P?P.place:P.record,H="place"in P&&!W(e.places,v)&&!e.lists.some(B=>B.slug===v||B.kind===v);e.placesUnsure&&H?o(n,"link",!0,`${I(n)} may go nowhere: ${V.says}${J}`):o(n,"link",!1,`${I(n)} goes nowhere: ${V.says}`)}continue}let c=t.idOf(n),g=l.has(c??"");if(!Dt(n)&&!g||!g&&ye(n,i,S=>ce(S,[...te(S)].some(de))))continue;if(!d(n)){o(n,"nothing",!1,`${I(n)} does nothing: it is bound to no act (data-act), goes nowhere (data-record, data-place), and the view hears no click on it.`);continue}if(c===void 0)continue;if(k>=$){o(n,"code",!0,`${I(n)} was not pressed: the check presses ${$} controls the view's code hears, and this is past them.`);continue}k+=1;let w=await e.rerun(c);if(!w.ok){o(n,"code",!1,w.reason==="error"?`${I(n)} throws when pressed: ${w.detail.replace(/^It threw: /,"")}`:`${I(n)}, pressed, stopped the view (${w.reason}): ${w.detail}`);continue}let O=w.transcript.pressed;if(!O||O.target===void 0){o(n,"code",!1,`${I(n)} could not be pressed in a run of its own: it was not drawn there the same way.`);continue}let Y=w.transcript.asked.slice(O.asked),L=w.transcript.went.slice(O.went),R=w.transcript.renders.length>O.renders,_=[];for(let S of Y){let E=Ke(r,a,S.name,S.args??{},{shown:e.shown,file:()=>{},dropped:()=>{}});if(!E.ok)_.push(`it asks for \u201C${S.name}\u201D from its code, which is refused: ${E.message}${E.reason==="press-only"?` Bind the button to it instead: data-act="${S.name}".`:""}`);else{let x=T(E.name,E.args);x.ok||_.push(`it asks for \u201C${S.name}\u201D, which is refused: ${x.message}`)}}for(let S of L){let E=Q(S,{sees:x=>e.shown.has(x),places:e.places,lists:e.lists,schema:r.schema});E.ok||_.push(`it asks to go nowhere: ${E.says}`)}let j=Y.length===0&&L.length===0&&!R?Vt(n):void 0,K=!1,ie=!1;if(j)for(let S of zt(n,j.name,i)){let E=j.name==="aria-current";if(S.hasAttribute("data-act")||E&&(S.hasAttribute("data-record")||S.hasAttribute("data-place")||S.hasAttribute("href"))){K=!0;break}let x=t.idOf(S);if(x===void 0||!d(S))continue;if(k>=$){ie=!0;break}k+=1;let D=await e.rerun(x),P=D.ok?D.transcript.pressed:void 0;if(!D.ok||!P||P.target===void 0)continue;let V=we(D.transcript.renders,void 0,{maxNodes:1e5}).elementOf(c);if(D.transcript.asked.length>P.asked||E&&D.transcript.went.length>P.went||V?.getAttribute(j.name)!==j.value){K=!0;break}}_.length>0?o(n,"code",!1,`${I(n)}, pressed: ${_.join("; ")}`):j&&K?o(n,"code",!0,`${I(n)} is already in the state it shows (${j.name}="${j.value}"): pressed, it leaves the view as it is.`):j&&ie?o(n,"code",!0,`${I(n)} was not pressed: the check presses ${$} controls the view's code hears, and this is past them.`):j?o(n,"code",!1,`${I(n)} does nothing when pressed: it says ${j.name}="${j.value}", and no press on this view takes that from it.`):Y.length===0&&L.length===0&&!R?o(n,"code",!1,`${I(n)} does nothing when pressed: the view hears the click, and asks for no act, goes nowhere and draws nothing new.`):o(n,"code",!0,`${I(n)}, pressed, ${[...Y.length>0?[`asks for ${Y.map(S=>`\u201C${S.name}\u201D`).join(", ")}`]:[],...L.length>0?["goes where it says"]:[],...R?["draws again"]:[]].join(" and ")}.`)}let u=b.filter(n=>!n.ok),h=[`Presses: ${b.length} control${b.length===1?"":"s"} pressed, ${u.length===0?"every one does what it says":`${u.length} ${u.length===1?"fails":"fail"}`}.`];for(let n of b)h.push(` ${n.ok?"ok ":"FAILS"} ${n.says}`);return{ok:u.length===0,controls:b,problems:u,text:`${h.join(`
2
2
  `)}
3
3
  `}}var Gt=e=>`
4
4
  ;(function () {
@@ -17,5 +17,5 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
17
17
  "use strict";
18
18
  ${e}
19
19
  });
20
- `}var rr={scheme:"light",accent:"#2f7d8c",ground:"#f6f8f9",panel:"#ffffff",ink:"#14212b",inkMuted:"#4f6470",edge:"rgba(20, 33, 43, 0.14)",fontBody:"system-ui, sans-serif",fontDisplay:"system-ui, sans-serif",fontMono:"ui-monospace, monospace",radius:"12px"},G=(e,t,r)=>({ok:!1,reason:e,detail:t,...r?{transcript:r}:{}}),ne=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),nr=["manifest","source","refused","error","silent","nodes","flood","slow","act","isolate"];function sr(e){if(!ne(e))return;let{renders:t,sheets:r,asked:s,went:a,ms:i,logs:p,messages:l,gestures:d,pressed:f,clicks:b}=e;if(!(!Array.isArray(t)||!t.every(Array.isArray)||!Array.isArray(s)||!Array.isArray(a)||!Array.isArray(p))&&!(typeof i!="number"||typeof l!="number"||r!==void 0&&!(Array.isArray(r)&&r.every(o=>typeof o=="string"))))return{renders:t,...Array.isArray(r)?{sheets:r}:{},asked:s.filter(ne).map(o=>({name:String(o.name),args:o.args})),went:a.filter(ne).flatMap(o=>{let A=typeof o.section=="string"?{section:o.section}:{},T=o.where!==void 0?{where:o.where}:{};return typeof o.record=="string"?[{record:o.record,...T,...A}]:typeof o.place=="string"?[{place:o.place,...T,...A}]:[]}),ms:i,logs:p.map(String).slice(0,50),messages:l,...Array.isArray(b)?{clicks:b.filter(o=>typeof o=="string").slice(0,2e3)}:{},...Array.isArray(d)?{gestures:d.filter(ne).slice(0,32).map(o=>({event:String(o.event),selector:String(o.selector)}))}:{},...ne(f)&&typeof f.selector=="string"&&[f.asked,f.went,f.renders].every(o=>typeof o=="number")?{pressed:{selector:f.selector,...typeof f.target=="string"?{target:f.target}:{},asked:f.asked,went:f.went,renders:f.renders}}:{}}}function ar(e,t){let r=t.gestures??[];return r.length>0&&e.gestures!==!0?[{at:"gestures",says:`It listens for ${r.map(a=>`${a.event} on "${a.selector}"`).join(", ")}, and its manifest does not say "gestures": true: the host forwards no wheel, drag or pinch, and the page scrolls under it. Say "gestures": true in the manifest.`}]:r.length===0&&e.gestures===!0?[{at:"gestures",says:'Its manifest says "gestures": true, and it listens for no wheel, drag or pinch: graview.on("wheel" | "drag" | "pinch", selector, \u2026) is where the host sends one.'}]:[]}var or=e=>e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,ir=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");async function lr(e,t){let r=d=>typeof d=="object"&&d!==null&&!(typeof d.kind=="string"&&d.kind.length>0),s=d=>{let{as:f,slug:b}=d;return typeof f=="string"&&f.length>0?f:typeof b=="string"&&b.length>0?b:void 0},a=e.filter(d=>r(d)&&![void 0,je,De].includes(s(d)));if(a.length===0)return e;let i=t.app?Me(t.app,{views:t.views}):Le(t.schema,t.views.flatMap(d=>Ae(d)??[])),p=d=>i.find(f=>f.slug===s(d)&&f.kind!==null),l=a.filter(d=>!p(d)).map(d=>`"${s(d)}"`);if(l.length>0){let d=l.length===1?"that slug":"those slugs",f=t.app?`the app declares no place by ${d}`:`no kind's list or view the run holds is at ${d}, and the app, which would say its lenses, was not handed (\`app\`)`;throw new TypeError(`runWorkerViewHeadless was handed the place${l.length===1?"":"s"} ${l.join(", ")} without ${l.length===1?"its kind":"their kinds"}, and ${f}: hand each place's \`kind\` as \`placesOf(app)\` lists it, or the app.`)}return e.map(d=>{if(!a.includes(d))return d;let f=p(d);return{...d,kind:f.kind,...f.over?{over:f.over}:{}}})}async function Pe(e){if(typeof e.run!="function")throw new TypeError("runWorkerViewHeadless runs a view only in an isolate the host supplies (`run`); it never runs one in the host's own context.");let{manifest:t,source:r,store:s,principal:a}=e,i={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,pushMs:e.limits?.pushMs??1e3,runMs:e.limits?.runMs??5e3},p=qe(t,s);if(p.length>0)return G("manifest",p.join(" "));if(typeof r!="string")return G("source","A view's source is text.");if(new TextEncoder().encode(r).length>i.maxSourceBytes)return G("source",`Its code is longer than the ${i.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`);let l=Xe(r);if(l.length>0)return G("source",l.join(" "));let d=[...e.views??[],t].flatMap(v=>Ae(v)??[]).map(v=>({as:v.as,title:v.title,kind:v.kind})),f=new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds]),b=await lr(e.places??[],{schema:s.schema,...e.app?{app:e.app}:{},views:[...e.views??[],t]}),o=Ve(s.schema,[...b,...d],{kept:f}),A=e.views===void 0,T=Ye(s,t)?(await (__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.IRPMGHZN.js","./chunk.7QWGIGHM.js","./chunk.HRLCDBMO.js","./chunk.LZNHTROY.js","./chunk.36FKQJFM.js","./chunk.RHV73CBA.js","./chunk.QILGAV7H.js","./chunk.I6HIVTXU.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KDOJC4FX.js"))).computedOn(s.schema):void 0,m={...Ze(s,a,{manifest:t,...e.input?{input:e.input}:{},theme:e.theme??rr,places:Ue(o),...T?{computed:T}:{}}),mine:{}},y=t.pictures?it(m,{view:`"${t.title??t.name}"`,pictures:t.pictures,standIn:ot,limits:{...e.limits?.pictureBytes!==void 0?{pictureBytes:e.limits.pictureBytes}:{},...e.limits?.picturesBytes!==void 0?{picturesBytes:e.limits.picturesBytes}:{}}}):{props:m,left:[]},N=y.props,k={props:N,acts:be(t).map(v=>v.as??v.act),...t.accepts?{accepts:t.accepts.map(({kind:v,field:H})=>({kind:v,field:H}))}:{},places:o.map(v=>({as:v.as,title:v.title})),...A?{placesUnsure:!0}:{},...e.images?{imageOrigins:[...e.images.origins]}:{},...e.links?{linkOrigins:[...e.links.origins]}:{},...e.asset?{assets:!0}:{},...e.origin?{origin:e.origin}:{},lists:$e(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])).flatMap(v=>[v.slug,v.kind]),limits:{maxNodes:i.maxNodes,messages:i.messages,pushMs:i.pushMs},...e.press!==void 0?{press:{selector:typeof e.press=="string"?e.press:e.press.selector}}:{}},$=async v=>{let H,B;try{let Z=e.run({script:tr(r),entry:At,input:JSON.stringify(v),timeoutMs:i.runMs}),It=new Promise((mr,Pt)=>{B=setTimeout(()=>Pt(Object.assign(new Error("past runMs"),{reason:"slow"})),i.runMs+1e3)});H=await Promise.race([Z,It])}catch(Z){return ne(Z)&&Z.reason==="slow"?G("slow",`It ran longer than the ${i.runMs.toLocaleString("en-US")} ms a headless run may take.`):G("isolate",`The isolate could not run it: ${Z instanceof Error?Z.message:String(Z)}`)}finally{B!==void 0&&clearTimeout(B)}let F;try{F=JSON.parse(String(H))}catch{return G("isolate","The isolate answered with something that is not an outcome.")}if(!ne(F))return G("isolate","The isolate answered with something that is not an outcome.");let Se=sr(F.transcript);if(F.ok!==!0){let Z=nr.includes(F.reason)?F.reason:"isolate";return G(Z,typeof F.detail=="string"?F.detail.slice(0,2e3):"It failed, and the isolate did not say why.",Se)}return Se?{ok:!0,transcript:Se}:G("isolate","The isolate answered without what the view sent.")},u=await $(k);if(!u.ok)return u;let h=u.transcript,n=e.press!==void 0?h.pressed:void 0,c=St(n?{...h,renders:h.renders.slice(0,n.renders)}:h,k,e.brand?.views?.css?{theme:e.brand.views.css}:{});if(!c.ok)return G(c.reason,c.detail,h);let g=new Set([...N.node?[N.node.id]:[],...(N.nodes??[]).map(v=>v.id)]),w=$e(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])),O=[];for(let v of h.went){if(!("where"in v)&&!("section"in v))continue;let H=Q(v,{sees:F=>g.has(F),places:o,lists:w,schema:s.schema}),B="place"in v?W(k.places,v.place)!==void 0||(k.lists??[]).includes(v.place):!0;!H.ok&&B&&O.push({at:"navigate",says:H.says})}let Y=typeof e.press=="object"&&e.press.typed?{typed:e.press.typed}:{},L=n?pt(n,c.drawn,h,{store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...A?{placesUnsure:!0}:{},...Y}):void 0,R=L&&(!L.element||L.lost)?[{at:`press "${L.selector}"`,says:L.lost??L.says}]:[],_;if(e.presses){let v=c.drawn;_=await(typeof e.presses=="function"?e.presses:e.presses.check)({store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...A?{placesUnsure:!0}:{},drawn:v,clicks:h.clicks??[],...typeof e.presses=="object"&&e.presses.maxRuns!==void 0?{maxRuns:e.presses.maxRuns}:{},rerun:async B=>{let F=await $({...k,press:{selector:`[data-graview-check="${B}"]`,target:B}});return F.ok?F:{ok:!1,reason:F.reason,detail:F.detail}}})}let j=t.title??t.name,K=N.today?lt(r,{today:N.today,title:t.attach==="home"?"Home":j,...N.locale?{locale:N.locale}:{}}):[],ie=[...Je(s,t).map(v=>({at:"reads",says:v})),...y.left.map(v=>({at:"pictures",says:v})),...c.problems,...O,...ar(t,h),...R,...(_?.problems??[]).map(v=>({at:`press ${v.control}`,says:v.says})),...K.map(({at:v,says:H})=>({at:v,says:H}))],S=t.title?ir(t.title):t.name,E=t.attach==="home"?null:t.attach,x={place:{slug:t.attach==="home"?"home":S,title:j,kind:E,address:t.attach==="home"?"/":`/places/${encodeURIComponent(S)}`},seat:or(a),width:e.width??1440,variant:(e.width??1440)<640?"phone":"wide",drawnBy:`view:${t.name}`,parts:c.parts,...c.videos.length>0?{videos:c.videos}:{},problems:ie},{placeText:D}=await (__graviewPreload(import.meta.url,["./chunk.RECTEAG4.js","./chunk.NKUNCQB3.js","./chunk.CHG522KL.js","./chunk.IRPMGHZN.js","./chunk.7QWGIGHM.js","./chunk.HRLCDBMO.js","./chunk.LZNHTROY.js","./chunk.36FKQJFM.js","./chunk.RHV73CBA.js","./chunk.YIDNZTON.js","./chunk.QILGAV7H.js","./chunk.I6HIVTXU.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.NILR2BWR.js")),P,V;if(e.audit===!0){let{auditView:v}=await (__graviewPreload(import.meta.url,["./chunk.JO2X52D4.js","./chunk.M5FP4Y4Q.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5A5DI36V.js")),H=(h.clicks??[]).flatMap(B=>c.drawn.elementOf(B)??[]);P=v(c.drawn.root,{host:"pending",clicked:H}),e.drawing===!0&&(V={root:c.drawn.root,clicked:H})}return{ok:!0,description:{...x,text:D(x)},props:N,transcript:h,css:c.drawn.css,...L?{pressed:L}:{},...P?{audit:P}:{},...V?{drawing:V}:{},..._?{presses:_}:{}}}var dr=6,xe=function*(e){for(let t of e.childNodes)t.nodeType===1&&(yield t,yield*xe(t))},cr=(e,t)=>{for(let r=t;r;r=r.parentElement)if(r===e)return!0;return!1};function Et(e,t){let r=[...xe(e)].filter(l=>l.getAttribute("data-record")===t);if(r.length===0)return null;let s=r[0];for(;s&&!r.every(l=>cr(s,l));)s=s.parentElement;let a=s??e,i=[a,...xe(a)].flatMap(l=>l.getAttribute("data-act")?[l.getAttribute("data-act")]:[]),p=[a,...xe(a)].flatMap(l=>l.getAttribute("aria-pressed")||l.getAttribute("aria-checked")?[`${l.getAttribute("aria-pressed")??""}${l.getAttribute("aria-checked")??""}`]:[]);return`${a.textContent.replace(/\s+/g," ").trim()}|${i.join(",")}|${p.join(",")}`}var Ot=(e,t)=>new RegExp(`\\s${t}="([^"]*)"`).exec(e)?.[1];function ur(e){return new Re({schema:e.schema,mutations:e.allMutations(),invariants:e.allInvariants(),...e.policy?{policy:e.policy}:{},snapshot:e.graph.snapshot()})}var pr=e=>JSON.stringify(Object.entries(e??{}).filter(([,t])=>typeof t=="boolean").sort(([t],[r])=>t.localeCompare(r)));async function vn(e){let t=bt(),r=await Pe({...e,run:t,presses:yt,audit:!0,drawing:!0});if(!r.ok||!r.presses||!r.drawing)return r;let s=await fr(e,r.presses,r.drawing.root,t);if(s.length===0)return r;let a=[...r.presses.problems,...s];return{...r,presses:{...r.presses,ok:!1,controls:[...r.presses.controls,...s],problems:a,text:`${r.presses.text}${s.map(i=>` FAILS ${i.says}
20
+ `}var rr={scheme:"light",accent:"#2f7d8c",ground:"#f6f8f9",panel:"#ffffff",ink:"#14212b",inkMuted:"#4f6470",edge:"rgba(20, 33, 43, 0.14)",fontBody:"system-ui, sans-serif",fontDisplay:"system-ui, sans-serif",fontMono:"ui-monospace, monospace",radius:"12px"},G=(e,t,r)=>({ok:!1,reason:e,detail:t,...r?{transcript:r}:{}}),ne=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),nr=["manifest","source","refused","error","silent","nodes","flood","slow","act","isolate"];function sr(e){if(!ne(e))return;let{renders:t,sheets:r,asked:s,went:a,ms:i,logs:p,messages:l,gestures:d,pressed:f,clicks:b}=e;if(!(!Array.isArray(t)||!t.every(Array.isArray)||!Array.isArray(s)||!Array.isArray(a)||!Array.isArray(p))&&!(typeof i!="number"||typeof l!="number"||r!==void 0&&!(Array.isArray(r)&&r.every(o=>typeof o=="string"))))return{renders:t,...Array.isArray(r)?{sheets:r}:{},asked:s.filter(ne).map(o=>({name:String(o.name),args:o.args})),went:a.filter(ne).flatMap(o=>{let A=typeof o.section=="string"?{section:o.section}:{},T=o.where!==void 0?{where:o.where}:{};return typeof o.record=="string"?[{record:o.record,...T,...A}]:typeof o.place=="string"?[{place:o.place,...T,...A}]:[]}),ms:i,logs:p.map(String).slice(0,50),messages:l,...Array.isArray(b)?{clicks:b.filter(o=>typeof o=="string").slice(0,2e3)}:{},...Array.isArray(d)?{gestures:d.filter(ne).slice(0,32).map(o=>({event:String(o.event),selector:String(o.selector)}))}:{},...ne(f)&&typeof f.selector=="string"&&[f.asked,f.went,f.renders].every(o=>typeof o=="number")?{pressed:{selector:f.selector,...typeof f.target=="string"?{target:f.target}:{},asked:f.asked,went:f.went,renders:f.renders}}:{}}}function ar(e,t){let r=t.gestures??[];return r.length>0&&e.gestures!==!0?[{at:"gestures",says:`It listens for ${r.map(a=>`${a.event} on "${a.selector}"`).join(", ")}, and its manifest does not say "gestures": true: the host forwards no wheel, drag or pinch, and the page scrolls under it. Say "gestures": true in the manifest.`}]:r.length===0&&e.gestures===!0?[{at:"gestures",says:'Its manifest says "gestures": true, and it listens for no wheel, drag or pinch: graview.on("wheel" | "drag" | "pinch", selector, \u2026) is where the host sends one.'}]:[]}var or=e=>e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,ir=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");async function lr(e,t){let r=d=>typeof d=="object"&&d!==null&&!(typeof d.kind=="string"&&d.kind.length>0),s=d=>{let{as:f,slug:b}=d;return typeof f=="string"&&f.length>0?f:typeof b=="string"&&b.length>0?b:void 0},a=e.filter(d=>r(d)&&![void 0,je,De].includes(s(d)));if(a.length===0)return e;let i=t.app?Me(t.app,{views:t.views}):Le(t.schema,t.views.flatMap(d=>Ae(d)??[])),p=d=>i.find(f=>f.slug===s(d)&&f.kind!==null),l=a.filter(d=>!p(d)).map(d=>`"${s(d)}"`);if(l.length>0){let d=l.length===1?"that slug":"those slugs",f=t.app?`the app declares no place by ${d}`:`no kind's list or view the run holds is at ${d}, and the app, which would say its lenses, was not handed (\`app\`)`;throw new TypeError(`runWorkerViewHeadless was handed the place${l.length===1?"":"s"} ${l.join(", ")} without ${l.length===1?"its kind":"their kinds"}, and ${f}: hand each place's \`kind\` as \`placesOf(app)\` lists it, or the app.`)}return e.map(d=>{if(!a.includes(d))return d;let f=p(d);return{...d,kind:f.kind,...f.over?{over:f.over}:{}}})}async function Pe(e){if(typeof e.run!="function")throw new TypeError("runWorkerViewHeadless runs a view only in an isolate the host supplies (`run`); it never runs one in the host's own context.");let{manifest:t,source:r,store:s,principal:a}=e,i={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,pushMs:e.limits?.pushMs??1e3,runMs:e.limits?.runMs??5e3},p=qe(t,s);if(p.length>0)return G("manifest",p.join(" "));if(typeof r!="string")return G("source","A view's source is text.");if(new TextEncoder().encode(r).length>i.maxSourceBytes)return G("source",`Its code is longer than the ${i.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`);let l=Xe(r);if(l.length>0)return G("source",l.join(" "));let d=[...e.views??[],t].flatMap(v=>Ae(v)??[]).map(v=>({as:v.as,title:v.title,kind:v.kind})),f=new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds]),b=await lr(e.places??[],{schema:s.schema,...e.app?{app:e.app}:{},views:[...e.views??[],t]}),o=Ve(s.schema,[...b,...d],{kept:f}),A=e.views===void 0,T=Ye(s,t)?(await (__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.23DATB5Y.js"))).computedOn(s.schema):void 0,m={...Ze(s,a,{manifest:t,...e.input?{input:e.input}:{},theme:e.theme??rr,places:Ue(o),...T?{computed:T}:{}}),mine:{}},y=t.pictures?it(m,{view:`"${t.title??t.name}"`,pictures:t.pictures,standIn:ot,limits:{...e.limits?.pictureBytes!==void 0?{pictureBytes:e.limits.pictureBytes}:{},...e.limits?.picturesBytes!==void 0?{picturesBytes:e.limits.picturesBytes}:{}}}):{props:m,left:[]},N=y.props,k={props:N,acts:be(t).map(v=>v.as??v.act),...t.accepts?{accepts:t.accepts.map(({kind:v,field:H})=>({kind:v,field:H}))}:{},places:o.map(v=>({as:v.as,title:v.title})),...A?{placesUnsure:!0}:{},...e.images?{imageOrigins:[...e.images.origins]}:{},...e.links?{linkOrigins:[...e.links.origins]}:{},...e.asset?{assets:!0}:{},...e.origin?{origin:e.origin}:{},lists:$e(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])).flatMap(v=>[v.slug,v.kind]),limits:{maxNodes:i.maxNodes,messages:i.messages,pushMs:i.pushMs},...e.press!==void 0?{press:{selector:typeof e.press=="string"?e.press:e.press.selector}}:{}},$=async v=>{let H,B;try{let Z=e.run({script:tr(r),entry:At,input:JSON.stringify(v),timeoutMs:i.runMs}),It=new Promise((mr,Pt)=>{B=setTimeout(()=>Pt(Object.assign(new Error("past runMs"),{reason:"slow"})),i.runMs+1e3)});H=await Promise.race([Z,It])}catch(Z){return ne(Z)&&Z.reason==="slow"?G("slow",`It ran longer than the ${i.runMs.toLocaleString("en-US")} ms a headless run may take.`):G("isolate",`The isolate could not run it: ${Z instanceof Error?Z.message:String(Z)}`)}finally{B!==void 0&&clearTimeout(B)}let F;try{F=JSON.parse(String(H))}catch{return G("isolate","The isolate answered with something that is not an outcome.")}if(!ne(F))return G("isolate","The isolate answered with something that is not an outcome.");let Se=sr(F.transcript);if(F.ok!==!0){let Z=nr.includes(F.reason)?F.reason:"isolate";return G(Z,typeof F.detail=="string"?F.detail.slice(0,2e3):"It failed, and the isolate did not say why.",Se)}return Se?{ok:!0,transcript:Se}:G("isolate","The isolate answered without what the view sent.")},u=await $(k);if(!u.ok)return u;let h=u.transcript,n=e.press!==void 0?h.pressed:void 0,c=St(n?{...h,renders:h.renders.slice(0,n.renders)}:h,k,e.brand?.views?.css?{theme:e.brand.views.css}:{});if(!c.ok)return G(c.reason,c.detail,h);let g=new Set([...N.node?[N.node.id]:[],...(N.nodes??[]).map(v=>v.id)]),w=$e(s.schema,new Set([...s.kindsKeptFrom(a),...s.modules.disabledKinds])),O=[];for(let v of h.went){if(!("where"in v)&&!("section"in v))continue;let H=Q(v,{sees:F=>g.has(F),places:o,lists:w,schema:s.schema}),B="place"in v?W(k.places,v.place)!==void 0||(k.lists??[]).includes(v.place):!0;!H.ok&&B&&O.push({at:"navigate",says:H.says})}let Y=typeof e.press=="object"&&e.press.typed?{typed:e.press.typed}:{},L=n?pt(n,c.drawn,h,{store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...A?{placesUnsure:!0}:{},...Y}):void 0,R=L&&(!L.element||L.lost)?[{at:`press "${L.selector}"`,says:L.lost??L.says}]:[],_;if(e.presses){let v=c.drawn;_=await(typeof e.presses=="function"?e.presses:e.presses.check)({store:s,principal:a,manifest:t,shown:g,places:o,lists:w,...A?{placesUnsure:!0}:{},drawn:v,clicks:h.clicks??[],...typeof e.presses=="object"&&e.presses.maxRuns!==void 0?{maxRuns:e.presses.maxRuns}:{},rerun:async B=>{let F=await $({...k,press:{selector:`[data-graview-check="${B}"]`,target:B}});return F.ok?F:{ok:!1,reason:F.reason,detail:F.detail}}})}let j=t.title??t.name,K=N.today?lt(r,{today:N.today,title:t.attach==="home"?"Home":j,...N.locale?{locale:N.locale}:{}}):[],ie=[...Je(s,t).map(v=>({at:"reads",says:v})),...y.left.map(v=>({at:"pictures",says:v})),...c.problems,...O,...ar(t,h),...R,...(_?.problems??[]).map(v=>({at:`press ${v.control}`,says:v.says})),...K.map(({at:v,says:H})=>({at:v,says:H}))],S=t.title?ir(t.title):t.name,E=t.attach==="home"?null:t.attach,x={place:{slug:t.attach==="home"?"home":S,title:j,kind:E,address:t.attach==="home"?"/":`/places/${encodeURIComponent(S)}`},seat:or(a),width:e.width??1440,variant:(e.width??1440)<640?"phone":"wide",drawnBy:`view:${t.name}`,parts:c.parts,...c.videos.length>0?{videos:c.videos}:{},problems:ie},{placeText:D}=await (__graviewPreload(import.meta.url,["./chunk.DDSAFU3B.js","./chunk.7KX36ENH.js","./chunk.KBJ3UUER.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.NNGG7RCO.js")),P,V;if(e.audit===!0){let{auditView:v}=await (__graviewPreload(import.meta.url,["./chunk.JO2X52D4.js","./chunk.M5FP4Y4Q.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XTHSPLZZ.js")),H=(h.clicks??[]).flatMap(B=>c.drawn.elementOf(B)??[]);P=v(c.drawn.root,{host:"pending",clicked:H}),e.drawing===!0&&(V={root:c.drawn.root,clicked:H})}return{ok:!0,description:{...x,text:D(x)},props:N,transcript:h,css:c.drawn.css,...L?{pressed:L}:{},...P?{audit:P}:{},...V?{drawing:V}:{},..._?{presses:_}:{}}}var dr=6,xe=function*(e){for(let t of e.childNodes)t.nodeType===1&&(yield t,yield*xe(t))},cr=(e,t)=>{for(let r=t;r;r=r.parentElement)if(r===e)return!0;return!1};function Et(e,t){let r=[...xe(e)].filter(l=>l.getAttribute("data-record")===t);if(r.length===0)return null;let s=r[0];for(;s&&!r.every(l=>cr(s,l));)s=s.parentElement;let a=s??e,i=[a,...xe(a)].flatMap(l=>l.getAttribute("data-act")?[l.getAttribute("data-act")]:[]),p=[a,...xe(a)].flatMap(l=>l.getAttribute("aria-pressed")||l.getAttribute("aria-checked")?[`${l.getAttribute("aria-pressed")??""}${l.getAttribute("aria-checked")??""}`]:[]);return`${a.textContent.replace(/\s+/g," ").trim()}|${i.join(",")}|${p.join(",")}`}var Ot=(e,t)=>new RegExp(`\\s${t}="([^"]*)"`).exec(e)?.[1];function ur(e){return new Re({schema:e.schema,mutations:e.allMutations(),invariants:e.allInvariants(),...e.policy?{policy:e.policy}:{},snapshot:e.graph.snapshot()})}var pr=e=>JSON.stringify(Object.entries(e??{}).filter(([,t])=>typeof t=="boolean").sort(([t],[r])=>t.localeCompare(r)));async function vn(e){let t=bt(),r=await Pe({...e,run:t,presses:yt,audit:!0,drawing:!0});if(!r.ok||!r.presses||!r.drawing)return r;let s=await fr(e,r.presses,r.drawing.root,t);if(s.length===0)return r;let a=[...r.presses.problems,...s];return{...r,presses:{...r.presses,ok:!1,controls:[...r.presses.controls,...s],problems:a,text:`${r.presses.text}${s.map(i=>` FAILS ${i.says}
21
21
  `).join("")}`}}}async function fr(e,t,r,s){let{store:a,principal:i,manifest:p}=e,l=new Set(a.graph.allNodes().map(b=>b.id)),d=new Set,f=[];for(let b of t.controls){if(d.size>=dr)break;if(b.does!=="act"||!b.ok)continue;let o=Ot(b.element,"data-act"),A=Ot(b.element,"data-record");if(!o||!A)continue;let T=a.graph.getNode(A),m=`${o}|${pr(T)}`;if(d.has(m))continue;d.add(m);let y=X(a,p,l,{as:o,record:A,fields:[]});if(!y.ok)continue;let N={name:y.name,args:y.args},k=T?`\u201C${Ce(a.schema.tryDefinition(T.kind),T)}\u201D`:`\u201C${A}\u201D`;if(!a.wouldChange(N,i)){let h=g=>new Set(a.allMutations().find(w=>w.name===g)?.writes??[]),n=h(y.name),c=be(p).filter(g=>g.act!==y.name&&n.size>0&&[...h(g.act)].some(w=>n.has(w))).filter(g=>{let w=X(a,p,l,{as:g.as??g.act,record:A,fields:[]});return w.ok&&a.wouldChange({name:w.name,args:w.args},i)}).map(g=>`\u201C${g.as??g.act}\u201D`);f.push({control:b.control,element:b.element,does:"act",ok:!1,says:`On ${k} it asks for \u201C${o}\u201D, which changes nothing there: it is so already.${c.length>0?` Bind its press there to ${c.join(" or ")} instead, as the page did, so a person can take it back.`:""}`});continue}let $=ur(a);try{$.apply(N,{author:i})}catch{continue}let u=await Pe({...e,store:$,run:s,audit:!0,drawing:!0});!u.ok||!u.drawing||Et(u.drawing.root,A)===Et(r,A)&&f.push({control:b.control,element:b.element,does:"act",ok:!1,says:`Pressed on ${k}, it lands, and the design draws ${k} just as before it: show what it changed \u2014 its words or its control (a finished task says so and offers the act that takes it back).`})}return f}export{Et as drawnRecord,vn as pressedHere};
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as i}from"./chunk.SDO3U72B.js";var m=i(()=>(__graviewPreload(import.meta.url,["./chunk.JO2X52D4.js","./chunk.A7JORJJL.js","./chunk.SGYZM6ZU.js","./chunk.CEQQIW7Z.js","./chunk.ONAH6MC4.js","./chunk.BBLA4PSP.js","./chunk.QG3LV4RH.js","./chunk.F5XWYO5W.js","./chunk.FSZQTX3K.js","./chunk.K6EKSURO.js","./chunk.KJAOJTZZ.js","./chunk.S4QSZRKH.js","./chunk.QDVGHI7R.js","./chunk.M5FP4Y4Q.js","./chunk.NKUNCQB3.js","./chunk.SDO3U72B.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.CLJKQLK2.js")));function f(r,s){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void r().then(d=>{e||s(d)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}var t;function l(r){t=r}function u(){return t}export{m as a,f as b,l as c,u as d};
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 i}from"./chunk.SDO3U72B.js";var m=i(()=>(__graviewPreload(import.meta.url,["./chunk.JO2X52D4.js","./chunk.VPFUOTY7.js","./chunk.SGYZM6ZU.js","./chunk.CEQQIW7Z.js","./chunk.ONAH6MC4.js","./chunk.Z2BCOZDZ.js","./chunk.WGH2P2YL.js","./chunk.TRP66PHK.js","./chunk.PGT4ZQDG.js","./chunk.MFMC35ET.js","./chunk.GKYJQE5A.js","./chunk.EZQK23AB.js","./chunk.QDVGHI7R.js","./chunk.M5FP4Y4Q.js","./chunk.7KX36ENH.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HT35PAHI.js")));function f(r,s){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void r().then(d=>{e||s(d)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}var t;function l(r){t=r}function u(){return t}export{m as a,f as b,l as c,u as d};
@@ -1 +1 @@
1
- import{a as V}from"./chunk.F5STM4DX.js";import"./chunk.YR7DKU5T.js";import"./chunk.XOZU4OFA.js";import{f as C,g as x,h as R}from"./chunk.CHG522KL.js";import{a as D}from"./chunk.SSHEFQ4R.js";import{a as T,b as A,c as M}from"./chunk.RIP2SAQ5.js";import"./chunk.ZGJUCVT5.js";import"./chunk.CVVNHQPO.js";import"./chunk.YIDNZTON.js";import"./chunk.QILGAV7H.js";import"./chunk.I6HIVTXU.js";import{a as F,c as $}from"./chunk.3HFBHLXC.js";import{G as k,O as E,V as H,Y as g}from"./chunk.CUA7F3YJ.js";import"./chunk.SDO3U72B.js";import"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import{b as l}from"./chunk.AJZBJBMO.js";var m=l(k());var n=l(g()),B={maxWidth:560,margin:"0 auto",padding:"40px 20px 64px",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:16};function G({app:r,store:e,form:o,principal:i,heading:f=1,onSubmitted:a}){let t=(0,m.useMemo)(()=>C(r,o,e.allMutations()),[r,o,e]),d=H(e),v=(0,m.useMemo)(()=>d?e.seenBy(i):e,[d,e,i]),[p,b]=(0,m.useState)(!1),u=(0,m.useRef)(null);(0,m.useEffect)(()=>{p&&u.current?.focus()},[p]);let y=`h${f}`;if(!d)return null;if(!t)return(0,n.jsx)("main",{"data-graview-visitor-form":o,style:B,children:(0,n.jsx)("p",{role:"alert",children:"There is no form here."})});let S=R(t);return(0,n.jsxs)("main",{"data-graview-visitor-form":o,"aria-labelledby":"graview-visitor-form-title",style:B,children:[(0,n.jsx)(y,{id:"graview-visitor-form-title",style:{margin:0,fontSize:"var(--graview-text-title)"},children:t.title}),p?(0,n.jsxs)("div",{ref:u,role:"status",tabIndex:-1,"data-graview-part":"received",style:{display:"grid",gap:8,outline:"none"},children:[(0,n.jsx)("p",{style:{margin:0,fontWeight:600},children:S.said}),S.next?(0,n.jsx)("p",{style:{margin:0},children:S.next}):null]}):(0,n.jsxs)(n.Fragment,{children:[t.intro?(0,n.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:t.intro}):null,(0,n.jsx)(V,{store:v,mutation:t.act,principal:i,only:t.fields.map(h=>h.name),label:t.submit,onDone:()=>{b(!0),a?.(o)}})]})]})}var s=l(k()),P=l($()),O=l(D());var c=l(g());function L(r){let{app:e,form:o,principal:i,scheme:f="auto",brand:a=e.brand,fonts:t=!0,height:d}=r,v=(0,s.useMemo)(()=>typeof i!="string"?i:e.forms?.[o]?x(e,o,i):{kind:"human",id:i,roles:[]},[e,o,i]),p=(0,s.useMemo)(()=>r.store??r.remote?.store??A(e,r.seed),[r.store,r.remote,e,r.seed]),b=M(f==="auto",a?.scheme),u=f==="auto"?b:f,y=`graview-form-${(0,s.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,S=(0,s.useMemo)(()=>F(u,a,{scope:`.${y}`}),[u,a,y]);return(0,s.useEffect)(()=>{if(!t||typeof document>"u")return;let h=T(a);if(!h||document.querySelector(`link[href="${h}"]`))return;let w=document.createElement("link");w.rel="stylesheet",w.href=h,document.head.appendChild(w)},[a,t]),(0,c.jsxs)("section",{className:y,"aria-label":r.label??e.forms?.[o]?.title??e.name,"data-graview-embed":"form","data-graview-scheme":u,style:{position:"relative",isolation:"isolate",...d===void 0?{}:{minHeight:d},background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,c.jsx)("style",{children:S}),(0,c.jsx)(E.Provider,{value:r.assetsAt,children:(0,c.jsx)(G,{app:e,store:p,form:o,principal:v,heading:r.heading??1,...r.onSubmitted?{onSubmitted:r.onSubmitted}:{}})})]})}function U(r,e){e.app.forms?.[e.form]||x(e.app,e.form,"form:");let o=e.store??e.remote?.store??A(e.app,e.seed),i=null;function f(){let[t,d]=(0,s.useState)(e.scheme??"auto");return i=d,(0,c.jsx)(L,{...e,store:o,scheme:t})}let a=(0,O.createRoot)(r);return(0,P.flushSync)(()=>a.render((0,c.jsx)(f,{}))),{store:o,setScheme:t=>(0,P.flushSync)(()=>i?.(t)),unmount:()=>a.unmount()}}export{L as FormEmbed,U as mount};
1
+ import{a as V}from"./chunk.Z22C2JJ4.js";import"./chunk.6IMRCKB4.js";import"./chunk.XOZU4OFA.js";import{f as C,g as x,h as R}from"./chunk.KBJ3UUER.js";import{a as D}from"./chunk.5WCSQFS5.js";import{a as T,b as A,c as M}from"./chunk.LHCGC3K6.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import"./chunk.VVIQSFM4.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import{a as F,c as $}from"./chunk.P43LPXXJ.js";import{G as k,O as E,V as H,Y as g}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import{b as l}from"./chunk.AJZBJBMO.js";var m=l(k());var n=l(g()),B={maxWidth:560,margin:"0 auto",padding:"40px 20px 64px",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:16};function G({app:r,store:e,form:o,principal:i,heading:f=1,onSubmitted:a}){let t=(0,m.useMemo)(()=>C(r,o,e.allMutations()),[r,o,e]),d=H(e),v=(0,m.useMemo)(()=>d?e.seenBy(i):e,[d,e,i]),[p,b]=(0,m.useState)(!1),u=(0,m.useRef)(null);(0,m.useEffect)(()=>{p&&u.current?.focus()},[p]);let y=`h${f}`;if(!d)return null;if(!t)return(0,n.jsx)("main",{"data-graview-visitor-form":o,style:B,children:(0,n.jsx)("p",{role:"alert",children:"There is no form here."})});let S=R(t);return(0,n.jsxs)("main",{"data-graview-visitor-form":o,"aria-labelledby":"graview-visitor-form-title",style:B,children:[(0,n.jsx)(y,{id:"graview-visitor-form-title",style:{margin:0,fontSize:"var(--graview-text-title)"},children:t.title}),p?(0,n.jsxs)("div",{ref:u,role:"status",tabIndex:-1,"data-graview-part":"received",style:{display:"grid",gap:8,outline:"none"},children:[(0,n.jsx)("p",{style:{margin:0,fontWeight:600},children:S.said}),S.next?(0,n.jsx)("p",{style:{margin:0},children:S.next}):null]}):(0,n.jsxs)(n.Fragment,{children:[t.intro?(0,n.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:t.intro}):null,(0,n.jsx)(V,{store:v,mutation:t.act,principal:i,only:t.fields.map(h=>h.name),label:t.submit,onDone:()=>{b(!0),a?.(o)}})]})]})}var s=l(k()),P=l($()),O=l(D());var c=l(g());function L(r){let{app:e,form:o,principal:i,scheme:f="auto",brand:a=e.brand,fonts:t=!0,height:d}=r,v=(0,s.useMemo)(()=>typeof i!="string"?i:e.forms?.[o]?x(e,o,i):{kind:"human",id:i,roles:[]},[e,o,i]),p=(0,s.useMemo)(()=>r.store??r.remote?.store??A(e,r.seed),[r.store,r.remote,e,r.seed]),b=M(f==="auto",a?.scheme),u=f==="auto"?b:f,y=`graview-form-${(0,s.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,S=(0,s.useMemo)(()=>F(u,a,{scope:`.${y}`}),[u,a,y]);return(0,s.useEffect)(()=>{if(!t||typeof document>"u")return;let h=T(a);if(!h||document.querySelector(`link[href="${h}"]`))return;let w=document.createElement("link");w.rel="stylesheet",w.href=h,document.head.appendChild(w)},[a,t]),(0,c.jsxs)("section",{className:y,"aria-label":r.label??e.forms?.[o]?.title??e.name,"data-graview-embed":"form","data-graview-scheme":u,style:{position:"relative",isolation:"isolate",...d===void 0?{}:{minHeight:d},background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,c.jsx)("style",{children:S}),(0,c.jsx)(E.Provider,{value:r.assetsAt,children:(0,c.jsx)(G,{app:e,store:p,form:o,principal:v,heading:r.heading??1,...r.onSubmitted?{onSubmitted:r.onSubmitted}:{}})})]})}function U(r,e){e.app.forms?.[e.form]||x(e.app,e.form,"form:");let o=e.store??e.remote?.store??A(e.app,e.seed),i=null;function f(){let[t,d]=(0,s.useState)(e.scheme??"auto");return i=d,(0,c.jsx)(L,{...e,store:o,scheme:t})}let a=(0,O.createRoot)(r);return(0,P.flushSync)(()=>a.render((0,c.jsx)(f,{}))),{store:o,setScheme:t=>(0,P.flushSync)(()=>i?.(t)),unmount:()=>a.unmount()}}export{L as FormEmbed,U as mount};
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as v}from"./chunk.JEQ6CA5M.js";import"./chunk.PYGNO2AV.js";import"./chunk.3HFBHLXC.js";import{G as S,X as y,Y as b}from"./chunk.CUA7F3YJ.js";import"./chunk.SDO3U72B.js";import"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import{b as u}from"./chunk.AJZBJBMO.js";var r=u(S(),1);var t=u(b(),1);function E(o){let a=(0,r.useContext)(y),l=(0,t.jsx)(C,{...o});return!a||o.nodeId===void 0?l:(0,t.jsx)(P,{nodeId:o.nodeId,field:o.field,label:o.label,...o.markdown?{markdown:!0}:{},live:a,onDone:d=>o.onDone?o.onDone(d):o.onCancel(),writtenWhole:l})}var P=(0,r.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.JEQ6CA5M.js","./chunk.PYGNO2AV.js","./chunk.3HFBHLXC.js","./chunk.CUA7F3YJ.js","./chunk.SDO3U72B.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DWPM7AWA.js")));function C({field:o,label:a,value:l,markdown:d,onSave:s,onCancel:c}){let[i,h]=(0,r.useState)(l),[n,w]=(0,r.useState)(!1),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>f.current?.focus(),[n]),(0,r.useLayoutEffect)(()=>{let e=f.current;if(!e||n||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let p=()=>{e.style.height="auto";let m=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(m.borderTopWidth)+parseFloat(m.borderBottomWidth)}px`};p();let x=requestAnimationFrame(p);return()=>cancelAnimationFrame(x)},[i,n]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),s(i,!1)},children:[n?(0,t.jsx)("div",{"data-graview-preview":o,"aria-label":`${a}, as it will read`,role:"region",style:k,children:(0,t.jsx)(v,{text:i,markdown:!0})}):(0,t.jsx)("textarea",{ref:f,"aria-label":a,"data-graview-field":o,value:i,rows:3,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),c()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s(i,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||s(i,!0)},style:T}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:g,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:c,style:g,children:"Cancel"}),d?(0,t.jsx)("button",{type:"button","aria-pressed":n,onClick:()=>w(!n),style:g,children:n?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var k={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},g={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},T={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{E as default};
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{b as v}from"./chunk.7PWLRRUS.js";import"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import{G as S,X as y,Y as b}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import{b as u}from"./chunk.AJZBJBMO.js";var r=u(S(),1);var t=u(b(),1);function E(o){let a=(0,r.useContext)(y),l=(0,t.jsx)(C,{...o});return!a||o.nodeId===void 0?l:(0,t.jsx)(P,{nodeId:o.nodeId,field:o.field,label:o.label,...o.markdown?{markdown:!0}:{},live:a,onDone:d=>o.onDone?o.onDone(d):o.onCancel(),writtenWhole:l})}var P=(0,r.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.7PWLRRUS.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TTM5GQ2U.js")));function C({field:o,label:a,value:l,markdown:d,onSave:s,onCancel:c}){let[i,h]=(0,r.useState)(l),[n,w]=(0,r.useState)(!1),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>f.current?.focus(),[n]),(0,r.useLayoutEffect)(()=>{let e=f.current;if(!e||n||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let p=()=>{e.style.height="auto";let m=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(m.borderTopWidth)+parseFloat(m.borderBottomWidth)}px`};p();let x=requestAnimationFrame(p);return()=>cancelAnimationFrame(x)},[i,n]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),s(i,!1)},children:[n?(0,t.jsx)("div",{"data-graview-preview":o,"aria-label":`${a}, as it will read`,role:"region",style:k,children:(0,t.jsx)(v,{text:i,markdown:!0})}):(0,t.jsx)("textarea",{ref:f,"aria-label":a,"data-graview-field":o,value:i,rows:3,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),c()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s(i,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||s(i,!0)},style:T}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:g,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:c,style:g,children:"Cancel"}),d?(0,t.jsx)("button",{type:"button","aria-pressed":n,onClick:()=>w(!n),style:g,children:n?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var k={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},g={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},T={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{E as default};
@@ -1 +1 @@
1
- import{G as h}from"./chunk.CUA7F3YJ.js";import{Wd as u,Yc as a,kd as m}from"./chunk.IUVRJDL3.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
1
+ import{G as h}from"./chunk.JCKIJSW7.js";import{Wd as u,Yc as a,kd as m}from"./chunk.6L6RUOSF.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
@@ -1,4 +1,4 @@
1
- import{a as I,j as M,k as O}from"./chunk.4BSEYZMS.js";import"./chunk.KV3N6VRG.js";import{g as P}from"./chunk.FUTSLXWN.js";import{l as D}from"./chunk.MZSWWMX6.js";import"./chunk.ZGJUCVT5.js";import"./chunk.CVVNHQPO.js";import"./chunk.YIDNZTON.js";import{a as C}from"./chunk.QILGAV7H.js";import"./chunk.I6HIVTXU.js";import"./chunk.PYGNO2AV.js";import"./chunk.3HFBHLXC.js";import{G as q,Y as F}from"./chunk.CUA7F3YJ.js";import"./chunk.SDO3U72B.js";import{ma as L,yd as E}from"./chunk.IUVRJDL3.js";import"./chunk.FQLNBIQ5.js";import{b as N}from"./chunk.AJZBJBMO.js";var f=N(q(),1);var n=N(F(),1),R=40,B=60;function T(l,o,s){return l.allNodes().filter(i=>i.kind===o).map(i=>i[s])}function Y(l){if(l.length<2)return[];let o=[...l].sort((a,d)=>a-d),s=o[o.length-1]-o[0];if(s<=0)return[];let i=Math.max(1,10**Math.floor(Math.log10(s/4))),e=s/4>=i*5?i*5:i,t=a=>Math.round(a/e)*e;return[...new Set([.2,.4,.6,.8].map(a=>t(o[Math.floor(a*(o.length-1))])))].filter(a=>a>0)}function _(l,o,s){let i=new Set(s.far??[]),e=new Map;for(let t of o.allNodes())i.has(t.kind)&&e.set(t.id,L(l.tryDefinition(t.kind),t));return[...e.entries()].map(([t,a])=>({id:t,label:a}))}function K(l,o,s){let i=_(l,o,s);return(i.length<=R?i:i.map(t=>({end:t,ties:o.out(t.id).length+o.in(t.id).length})).sort((t,a)=>a.ties-t.ties||t.end.label.localeCompare(a.end.label)).slice(0,R).map(t=>t.end)).sort((t,a)=>t.label.localeCompare(a.label))}function U(l,o,s){let i=[];for(let e of s.filters){let t=i.length;if(e.about==="is")for(let a of e.options??[])i.push({value:`is:${a}`,label:a,group:e.label,condition:{key:"is",value:a}});else if(e.about==="edge"){i.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),i.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let a of K(l,o,e))i.push({value:`${e.key}:${a.id}`,label:a.label,group:e.label,condition:{key:e.key,value:a.id}})}else if(e.type==="date")for(let a of["before","after","on"])i.push({value:`${e.key}:${a}`,label:`${a}\u2026`,group:e.label,ask:{key:e.key,op:a,label:e.label}});else if(e.type==="number"){let a=l.tryDefinition(s.kind),d=Y(T(o,s.kind,e.key).filter(p=>typeof p=="number"));for(let p of["at-most","at-least"])for(let v of p==="at-most"?d:[...d].reverse())i.push({value:`${e.key}:${p}:${v}`,label:`${p==="at-most"?"at most":"at least"} ${C(a,e.key,v)}`,group:e.label,condition:{key:e.key,value:`${p}:${v}`}})}else if(e.type==="text"){let a=[...new Set(T(o,s.kind,e.key).filter(d=>typeof d=="string"&&d.length>0&&!d.includes(",")))].sort((d,p)=>d.localeCompare(p));if(a.length>=2&&a.length<=B)for(let d of a)i.push({value:`${e.key}:${d}`,label:d,group:e.label,condition:{key:e.key,value:d}})}else if(e.type==="boolean")i.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),i.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else if(e.about==="via"){let a=l.tryDefinition(e.far?.[0]??"");for(let d of e.options??[])i.push({value:`${e.key}:${d}`,label:C(a,e.key.split(".")[1],d),group:e.label,condition:{key:e.key,value:d}})}else for(let a of e.options??[])i.push({value:`${e.key}:${a}`,label:C(l.tryDefinition(s.kind),e.key,a),group:e.label,condition:{key:e.key,value:a}});for(let a=t;a<i.length;a++)i[a]={...i[a],key:e.key}}return i}function V(l,o,s,i){let e=l.tryDefinition(o);return["at-most","at-least"].map(t=>({value:`${s.key}:${t}:${i}`,label:`${t==="at-most"?"at most":"at least"} ${C(e,s.key,i)}`,group:s.label,key:s.key,condition:{key:s.key,value:`${t}:${i}`}}))}function G(l){let o=l.trim().replace(/(?<=\d),(?=\d{3}\b)/g,"");return/^-?\d+(\.\d+)?$/.test(o)?Number(o):null}function j(l,o,s){let i=U(l,o,s);return s.filters.flatMap(e=>{let t=i.filter(d=>d.key===e.key);if(e.type==="number"&&e.about!=="edge")return[{key:e.key,label:e.label,entries:t,atNumber:d=>V(l,s.kind,e,d)}];if(t.length===0)return[];if(e.about!=="edge")return[{key:e.key,label:e.label,entries:t}];let a=_(l,o,e);return a.length<I?[{key:e.key,label:e.label,entries:t}]:[{key:e.key,label:e.label,entries:t.filter(d=>d.value===`${e.key}:*`||d.value===`${e.key}:none`),typed:[...a].sort((d,p)=>d.label.localeCompare(p.label))}]})}var z=8;function H(l,o){let s=o.trim().toLocaleLowerCase();if(!s)return{shown:[],more:0};let e=[...l.filter(t=>t.label.toLocaleLowerCase().includes(s))].sort((t,a)=>+!t.label.toLocaleLowerCase().startsWith(s)-+!a.label.toLocaleLowerCase().startsWith(s));return{shown:e.slice(0,z),more:Math.max(0,e.length-z)}}var J=["day","week","month","year","decade"];function ie(l){let{which:o,schema:s,graph:i,offers:e,arrangement:t,set:a,toggle:d,has:p,done:v}=l,m=l.testId,A=(0,f.useRef)(null);(0,f.useEffect)(()=>{let u=A.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let y=t.sort?e.sorts.find(u=>u.key===t.sort.by):void 0,S=t.group?e.groups.find(u=>u.key===t.group.by):void 0,b=O(y),r=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,k=o==="filter"||o==="all"&&l.parts?.filter?j(s,i,e):[],w=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Sort by"}),(0,n.jsx)($,{testId:`${m}-sort-default`,value:"",on:!t.sort,onPress:()=>(a({sort:void 0}),u()),children:r?`As declared (${M(r.label)})`:"As they were added"}),e.sorts.map(g=>(0,n.jsx)($,{value:g.key,on:t.sort?.by===g.key,onPress:()=>(a({sort:{by:g.key,direction:t.sort?.direction??"asc"}}),u()),children:g.label},g.key)),t.sort?(0,n.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${m}-direction`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(g=>(0,n.jsx)($,{testId:`${m}-direction-${g}`,value:g,on:t.sort.direction===g,onPress:()=>(a({sort:{by:t.sort.by,direction:g}}),u()),children:b[g]},g))]}):null]}),c=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Group by"}),(0,n.jsx)($,{testId:`${m}-group-none`,value:"",on:!t.group,onPress:()=>(a({group:void 0}),u()),children:"Not grouped"}),e.groups.map(g=>(0,n.jsx)($,{value:g.key,on:t.group?.by===g.key,onPress:()=>(a({group:{by:g.key}}),u()),children:g.label},g.key)),t.group&&S?.buckets?(0,n.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${m}-bucket`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Each group"}),J.map(g=>(0,n.jsx)($,{testId:`${m}-bucket-${g}`,value:g,on:(t.group.bucket??"day")===g,onPress:()=>(a({group:{by:t.group.by,bucket:g}}),u()),children:`A ${g}`},g))]}):null]}),x=u=>(0,n.jsx)(Q,{sections:k,has:p,testId:m,onToggle:g=>(d(g),u())}),h=l.parts??{sort:!0,group:!0,filter:!0};return(0,n.jsxs)("div",{ref:A,style:{display:"contents"},children:[(0,n.jsx)("style",{children:Z}),o==="sort"?w(v):o==="group"?c(v):o==="filter"?x(v):(0,n.jsxs)(n.Fragment,{children:[h.sort?(0,n.jsx)("div",{role:"group","aria-label":"Sort",children:w(v)}):null,h.group?(0,n.jsx)("div",{role:"group","aria-label":"Group",children:c(v)}):null,h.filter?(0,n.jsx)("div",{role:"group","aria-label":"Filter",children:x(v)}):null]})]})}function $({value:l,on:o,onPress:s,testId:i,children:e}){return(0,n.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":o,onClick:s,...i?{"data-testid":i}:{},children:e})}function Q({sections:l,has:o,testId:s,onToggle:i}){let[e,t]=(0,f.useState)(null),[a,d]=(0,f.useState)(""),[p,v]=(0,f.useState)(()=>new Set(l.length===1?[l[0].key]:[])),[m,A]=(0,f.useState)({});if(e)return(0,n.jsx)(X,{ask:e,testId:s,onDay:r=>i({key:e.key,value:`${e.op}:${r}`}),onCancel:()=>t(null)});let y=r=>(0,n.jsx)($,{value:r.value,on:r.condition?o(r.condition):!1,onPress:()=>r.condition?i(r.condition):t(r.ask),children:r.label},r.value),S=(r,k)=>{let w=(r.typed??[]).filter(h=>o({key:r.key,value:h.id})),c=H(r.typed??[],k),x=[...w,...c.shown.filter(h=>!w.includes(h))];return(0,n.jsxs)(n.Fragment,{children:[x.map(h=>y({value:`${r.key}:${h.id}`,label:h.label,group:r.label,key:r.key,condition:{key:r.key,value:h.id}})),k.trim()&&c.shown.length===0?(0,n.jsx)("span",{className:"graview-arrange-none",children:"None is called that."}):null,c.more>0?(0,n.jsx)("span",{className:"graview-arrange-none",children:`${c.more} more \u2014 type more of the name`}):null]})},b=a.trim().toLocaleLowerCase();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:"graview-arrange-find",children:[(0,n.jsx)("span",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:"Find a filter"}),(0,n.jsx)("input",{type:"search","data-testid":`${s}-filter-find`,value:a,placeholder:"Find a filter, a name or a number\u2026",onChange:r=>d(r.target.value)})]}),l.map(r=>{let k=r.entries.filter(c=>c.condition&&o(c.condition)).length+(r.typed??[]).filter(c=>o({key:r.key,value:c.id})).length;if(b){let c=r.label.toLocaleLowerCase().includes(b),x=r.atNumber&&G(b)!==null?r.atNumber(G(b)):[],h=[...x,...c?r.entries:r.entries.filter(g=>g.label.toLocaleLowerCase().includes(b)&&!x.some(W=>W.value===g.value))],u=r.typed?H(r.typed,b):{shown:[],more:0};return h.length===0&&u.shown.length===0?null:(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:r.label}),h.map(y),r.typed?S(r,b):null]},r.key)}if(r.entries.length===0&&!r.typed)return null;let w=p.has(r.key);return(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-section","data-testid":`${s}-section`,"data-key":r.key,"aria-expanded":w,onClick:()=>v(c=>c.has(r.key)?new Set([...c].filter(x=>x!==r.key)):new Set([...c,r.key])),children:[(0,n.jsx)("span",{children:r.label}),k>0?(0,n.jsx)("span",{className:"graview-arrange-on",children:`${k} on`}):null]}),w?(0,n.jsxs)(n.Fragment,{children:[r.typed?(0,n.jsx)("input",{type:"search",className:"graview-arrange-far","data-testid":`${s}-far-find`,"data-key":r.key,"aria-label":`${r.label}: type a name`,placeholder:`Type a name (${r.typed.length})\u2026`,autoFocus:!0,value:m[r.key]??"",onChange:c=>A({...m,[r.key]:c.target.value})}):null,r.entries.map(y),r.typed?S(r,m[r.key]??""):null]}):null]},r.key)})]})}function X({ask:l,testId:o,onDay:s,onCancel:i}){let[e,t]=(0,f.useState)(""),a=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{a&&s(e)};return(0,n.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${o}-ask-day`,className:"graview-arrange-ask",children:[(0,n.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,n.jsx)("input",{type:"date","data-testid":`${o}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:p=>t(p.target.value),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),d()):p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),i())}}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{type:"button","data-testid":`${o}-day-add`,disabled:!a,onClick:d,children:"Add"}),(0,n.jsx)("button",{type:"button",onClick:i,children:"Never mind"})]})]})}var Z=`
1
+ import{a as I,j as M,k as O}from"./chunk.ARGEGV5T.js";import"./chunk.WS5ORRGS.js";import{g as P}from"./chunk.ZONRIOIA.js";import{l as D}from"./chunk.NXHEOHRR.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import"./chunk.VVIQSFM4.js";import{a as C}from"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import{G as q,Y as F}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import{ma as L,yd as E}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import{b as N}from"./chunk.AJZBJBMO.js";var f=N(q(),1);var n=N(F(),1),R=40,B=60;function T(l,o,s){return l.allNodes().filter(i=>i.kind===o).map(i=>i[s])}function Y(l){if(l.length<2)return[];let o=[...l].sort((a,d)=>a-d),s=o[o.length-1]-o[0];if(s<=0)return[];let i=Math.max(1,10**Math.floor(Math.log10(s/4))),e=s/4>=i*5?i*5:i,t=a=>Math.round(a/e)*e;return[...new Set([.2,.4,.6,.8].map(a=>t(o[Math.floor(a*(o.length-1))])))].filter(a=>a>0)}function _(l,o,s){let i=new Set(s.far??[]),e=new Map;for(let t of o.allNodes())i.has(t.kind)&&e.set(t.id,L(l.tryDefinition(t.kind),t));return[...e.entries()].map(([t,a])=>({id:t,label:a}))}function K(l,o,s){let i=_(l,o,s);return(i.length<=R?i:i.map(t=>({end:t,ties:o.out(t.id).length+o.in(t.id).length})).sort((t,a)=>a.ties-t.ties||t.end.label.localeCompare(a.end.label)).slice(0,R).map(t=>t.end)).sort((t,a)=>t.label.localeCompare(a.label))}function U(l,o,s){let i=[];for(let e of s.filters){let t=i.length;if(e.about==="is")for(let a of e.options??[])i.push({value:`is:${a}`,label:a,group:e.label,condition:{key:"is",value:a}});else if(e.about==="edge"){i.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),i.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let a of K(l,o,e))i.push({value:`${e.key}:${a.id}`,label:a.label,group:e.label,condition:{key:e.key,value:a.id}})}else if(e.type==="date")for(let a of["before","after","on"])i.push({value:`${e.key}:${a}`,label:`${a}\u2026`,group:e.label,ask:{key:e.key,op:a,label:e.label}});else if(e.type==="number"){let a=l.tryDefinition(s.kind),d=Y(T(o,s.kind,e.key).filter(p=>typeof p=="number"));for(let p of["at-most","at-least"])for(let v of p==="at-most"?d:[...d].reverse())i.push({value:`${e.key}:${p}:${v}`,label:`${p==="at-most"?"at most":"at least"} ${C(a,e.key,v)}`,group:e.label,condition:{key:e.key,value:`${p}:${v}`}})}else if(e.type==="text"){let a=[...new Set(T(o,s.kind,e.key).filter(d=>typeof d=="string"&&d.length>0&&!d.includes(",")))].sort((d,p)=>d.localeCompare(p));if(a.length>=2&&a.length<=B)for(let d of a)i.push({value:`${e.key}:${d}`,label:d,group:e.label,condition:{key:e.key,value:d}})}else if(e.type==="boolean")i.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),i.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else if(e.about==="via"){let a=l.tryDefinition(e.far?.[0]??"");for(let d of e.options??[])i.push({value:`${e.key}:${d}`,label:C(a,e.key.split(".")[1],d),group:e.label,condition:{key:e.key,value:d}})}else for(let a of e.options??[])i.push({value:`${e.key}:${a}`,label:C(l.tryDefinition(s.kind),e.key,a),group:e.label,condition:{key:e.key,value:a}});for(let a=t;a<i.length;a++)i[a]={...i[a],key:e.key}}return i}function V(l,o,s,i){let e=l.tryDefinition(o);return["at-most","at-least"].map(t=>({value:`${s.key}:${t}:${i}`,label:`${t==="at-most"?"at most":"at least"} ${C(e,s.key,i)}`,group:s.label,key:s.key,condition:{key:s.key,value:`${t}:${i}`}}))}function G(l){let o=l.trim().replace(/(?<=\d),(?=\d{3}\b)/g,"");return/^-?\d+(\.\d+)?$/.test(o)?Number(o):null}function j(l,o,s){let i=U(l,o,s);return s.filters.flatMap(e=>{let t=i.filter(d=>d.key===e.key);if(e.type==="number"&&e.about!=="edge")return[{key:e.key,label:e.label,entries:t,atNumber:d=>V(l,s.kind,e,d)}];if(t.length===0)return[];if(e.about!=="edge")return[{key:e.key,label:e.label,entries:t}];let a=_(l,o,e);return a.length<I?[{key:e.key,label:e.label,entries:t}]:[{key:e.key,label:e.label,entries:t.filter(d=>d.value===`${e.key}:*`||d.value===`${e.key}:none`),typed:[...a].sort((d,p)=>d.label.localeCompare(p.label))}]})}var z=8;function H(l,o){let s=o.trim().toLocaleLowerCase();if(!s)return{shown:[],more:0};let e=[...l.filter(t=>t.label.toLocaleLowerCase().includes(s))].sort((t,a)=>+!t.label.toLocaleLowerCase().startsWith(s)-+!a.label.toLocaleLowerCase().startsWith(s));return{shown:e.slice(0,z),more:Math.max(0,e.length-z)}}var J=["day","week","month","year","decade"];function ie(l){let{which:o,schema:s,graph:i,offers:e,arrangement:t,set:a,toggle:d,has:p,done:v}=l,m=l.testId,A=(0,f.useRef)(null);(0,f.useEffect)(()=>{let u=A.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let y=t.sort?e.sorts.find(u=>u.key===t.sort.by):void 0,S=t.group?e.groups.find(u=>u.key===t.group.by):void 0,b=O(y),r=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,k=o==="filter"||o==="all"&&l.parts?.filter?j(s,i,e):[],w=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Sort by"}),(0,n.jsx)($,{testId:`${m}-sort-default`,value:"",on:!t.sort,onPress:()=>(a({sort:void 0}),u()),children:r?`As declared (${M(r.label)})`:"As they were added"}),e.sorts.map(g=>(0,n.jsx)($,{value:g.key,on:t.sort?.by===g.key,onPress:()=>(a({sort:{by:g.key,direction:t.sort?.direction??"asc"}}),u()),children:g.label},g.key)),t.sort?(0,n.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${m}-direction`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(g=>(0,n.jsx)($,{testId:`${m}-direction-${g}`,value:g,on:t.sort.direction===g,onPress:()=>(a({sort:{by:t.sort.by,direction:g}}),u()),children:b[g]},g))]}):null]}),c=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Group by"}),(0,n.jsx)($,{testId:`${m}-group-none`,value:"",on:!t.group,onPress:()=>(a({group:void 0}),u()),children:"Not grouped"}),e.groups.map(g=>(0,n.jsx)($,{value:g.key,on:t.group?.by===g.key,onPress:()=>(a({group:{by:g.key}}),u()),children:g.label},g.key)),t.group&&S?.buckets?(0,n.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${m}-bucket`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Each group"}),J.map(g=>(0,n.jsx)($,{testId:`${m}-bucket-${g}`,value:g,on:(t.group.bucket??"day")===g,onPress:()=>(a({group:{by:t.group.by,bucket:g}}),u()),children:`A ${g}`},g))]}):null]}),x=u=>(0,n.jsx)(Q,{sections:k,has:p,testId:m,onToggle:g=>(d(g),u())}),h=l.parts??{sort:!0,group:!0,filter:!0};return(0,n.jsxs)("div",{ref:A,style:{display:"contents"},children:[(0,n.jsx)("style",{children:Z}),o==="sort"?w(v):o==="group"?c(v):o==="filter"?x(v):(0,n.jsxs)(n.Fragment,{children:[h.sort?(0,n.jsx)("div",{role:"group","aria-label":"Sort",children:w(v)}):null,h.group?(0,n.jsx)("div",{role:"group","aria-label":"Group",children:c(v)}):null,h.filter?(0,n.jsx)("div",{role:"group","aria-label":"Filter",children:x(v)}):null]})]})}function $({value:l,on:o,onPress:s,testId:i,children:e}){return(0,n.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":o,onClick:s,...i?{"data-testid":i}:{},children:e})}function Q({sections:l,has:o,testId:s,onToggle:i}){let[e,t]=(0,f.useState)(null),[a,d]=(0,f.useState)(""),[p,v]=(0,f.useState)(()=>new Set(l.length===1?[l[0].key]:[])),[m,A]=(0,f.useState)({});if(e)return(0,n.jsx)(X,{ask:e,testId:s,onDay:r=>i({key:e.key,value:`${e.op}:${r}`}),onCancel:()=>t(null)});let y=r=>(0,n.jsx)($,{value:r.value,on:r.condition?o(r.condition):!1,onPress:()=>r.condition?i(r.condition):t(r.ask),children:r.label},r.value),S=(r,k)=>{let w=(r.typed??[]).filter(h=>o({key:r.key,value:h.id})),c=H(r.typed??[],k),x=[...w,...c.shown.filter(h=>!w.includes(h))];return(0,n.jsxs)(n.Fragment,{children:[x.map(h=>y({value:`${r.key}:${h.id}`,label:h.label,group:r.label,key:r.key,condition:{key:r.key,value:h.id}})),k.trim()&&c.shown.length===0?(0,n.jsx)("span",{className:"graview-arrange-none",children:"None is called that."}):null,c.more>0?(0,n.jsx)("span",{className:"graview-arrange-none",children:`${c.more} more \u2014 type more of the name`}):null]})},b=a.trim().toLocaleLowerCase();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:"graview-arrange-find",children:[(0,n.jsx)("span",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:"Find a filter"}),(0,n.jsx)("input",{type:"search","data-testid":`${s}-filter-find`,value:a,placeholder:"Find a filter, a name or a number\u2026",onChange:r=>d(r.target.value)})]}),l.map(r=>{let k=r.entries.filter(c=>c.condition&&o(c.condition)).length+(r.typed??[]).filter(c=>o({key:r.key,value:c.id})).length;if(b){let c=r.label.toLocaleLowerCase().includes(b),x=r.atNumber&&G(b)!==null?r.atNumber(G(b)):[],h=[...x,...c?r.entries:r.entries.filter(g=>g.label.toLocaleLowerCase().includes(b)&&!x.some(W=>W.value===g.value))],u=r.typed?H(r.typed,b):{shown:[],more:0};return h.length===0&&u.shown.length===0?null:(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:r.label}),h.map(y),r.typed?S(r,b):null]},r.key)}if(r.entries.length===0&&!r.typed)return null;let w=p.has(r.key);return(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-section","data-testid":`${s}-section`,"data-key":r.key,"aria-expanded":w,onClick:()=>v(c=>c.has(r.key)?new Set([...c].filter(x=>x!==r.key)):new Set([...c,r.key])),children:[(0,n.jsx)("span",{children:r.label}),k>0?(0,n.jsx)("span",{className:"graview-arrange-on",children:`${k} on`}):null]}),w?(0,n.jsxs)(n.Fragment,{children:[r.typed?(0,n.jsx)("input",{type:"search",className:"graview-arrange-far","data-testid":`${s}-far-find`,"data-key":r.key,"aria-label":`${r.label}: type a name`,placeholder:`Type a name (${r.typed.length})\u2026`,autoFocus:!0,value:m[r.key]??"",onChange:c=>A({...m,[r.key]:c.target.value})}):null,r.entries.map(y),r.typed?S(r,m[r.key]??""):null]}):null]},r.key)})]})}function X({ask:l,testId:o,onDay:s,onCancel:i}){let[e,t]=(0,f.useState)(""),a=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{a&&s(e)};return(0,n.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${o}-ask-day`,className:"graview-arrange-ask",children:[(0,n.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,n.jsx)("input",{type:"date","data-testid":`${o}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:p=>t(p.target.value),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),d()):p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),i())}}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{type:"button","data-testid":`${o}-day-add`,disabled:!a,onClick:d,children:"Add"}),(0,n.jsx)("button",{type:"button",onClick:i,children:"Never mind"})]})]})}var Z=`
2
2
  .graview-arrange-list{display:grid;align-content:start;width:min(300px,calc(100vw - 24px));height:auto;max-height:min(70vh,520px);overflow:auto;overscroll-behavior:contain;margin:0;padding:0 6px 6px;border-radius:10px;border:1px solid var(--graview-edge);background:linear-gradient(var(--graview-float),var(--graview-float)),var(--graview-panel);box-shadow:var(--graview-lift-high);color:var(--graview-ink);font-size:.875rem;line-height:1.3}
3
3
  .graview-arrange-list>*:first-child:not(.graview-arrange-find){margin-top:6px}
4
4
  @media (max-width:519px){.graview-arrange-list{left:0!important;right:0!important;top:auto!important;bottom:0!important;width:100%!important;max-height:min(80dvh,560px)!important;border-radius:14px 14px 0 0;padding-bottom:calc(10px + env(safe-area-inset-bottom))}}
@@ -0,0 +1 @@
1
+ import{h as S}from"./chunk.ZONRIOIA.js";import{e as x}from"./chunk.NXHEOHRR.js";import{a as C}from"./chunk.TBY5IR7C.js";import{c as P}from"./chunk.W6L2VAJG.js";import{je as b,ma as y,qa as k,sa as w,va as h}from"./chunk.6L6RUOSF.js";function v(e,t){try{let n=P(e);return n.t==="call"&&n.fn==="all"&&n.args.length===1&&n.args[0].t==="lit"&&n.args[0].value===t}catch{return!1}}function M(e,t){let n=e.options??{};if(e.name===void 0||e.name==="blocks"){let r=n.blocks;if(!Array.isArray(r)||r.length!==1)return!0;let i=r[0];return typeof i?.list!="string"||!v(i.list,t)||i.limit!==void 0}return e.name==="columns"?n.cap!==void 0||Array.isArray(n.hidden)&&n.hidden.length>0:e.name==="calendar"?n.horizon!==void 0:!1}function V(e,t,n,r,i,c=new Set){let g=i?b({filter:i}).filter??[]:[],l=g.length>0?x(e,n).filters:[],s=g.filter(o=>l.some(a=>a.key===o.key));return s.length===0?r:S(r,{filter:s},{schema:e,graph:t,flagged:c}).nodes}var T=new WeakMap,N=e=>e.charAt(0).toUpperCase()+e.slice(1),R=e=>(e??"").replace(/\s+/g," ").trim();function E(e){let t=e.cloneNode(!0);for(let n of t.querySelectorAll("span"))n.remove();return R(t.textContent).replace(/^[▸▾]\s*/,"")}function W(e,t){let n=e.at;if(!n.isConnected||n.closest("[data-graview-popover], [data-worker-view]"))return;let r=n.closest("[data-graview-page-main], main")??n.closest("[data-graview-face]"),i=t.store.schema,c=e.about?.length===1&&e.about[0].startsWith("aggregate:")?e.about[0].slice(10):void 0,g=c&&!c.includes("+")&&i.tryDefinition(c)?c:void 0,l,s=e.on!==void 0?t.store.graph.getNode(e.on):void 0;if(s)l={name:`${N(h(i.tryDefinition(s.kind),s.kind))} page`,slot:"record",kind:s.kind,record:s.id,elements:r?[r]:[],main:r};else if(e.place!==void 0){let o=t.views.places?.().find(a=>a.as===e.place);o&&(l={name:o.title,slot:"place",kind:o.kind,place:o.as,elements:r?[r]:[],main:r})}else if(g){let o=n.closest(".graview-group-head"),a=o?.closest('[data-testid="list-group"]'),f=o?E(o):"";l=a&&f?{name:f,slot:"group",kind:g,group:f,elements:[a],main:r}:{name:k(i,g),slot:"list",kind:g,elements:r?[r]:[],main:r}}else e.home&&(l={name:"Home",slot:"home",elements:r?[r]:[],main:r});return l}function j(e,t){let n=t.onProposeChange!==void 0&&t.composeChange!==void 0&&C(t.store,t.principal),r=e.slot!=="place"&&typeof t.keptViews?.fork=="function"&&typeof t.keptViews.draftFork=="function"&&t.keptViews.current().may.views===!0;return n||r}var m=/^\d{4}-\d{2}-\d{2}/,L=e=>{if(typeof e=="number")return String(e);if(!(typeof e!="string"||!e.trim())){if(m.test(e)){let t=new Date(`${e.slice(0,10)}T12:00:00`);return Number.isNaN(t.getTime())?void 0:t.toLocaleDateString("en-US",{month:"short",day:"numeric"})}return e.length<=40?e:void 0}};function F(e,t){let n=[],{store:r}=t,i=(e.main?.innerText??"").toLowerCase();if((e.slot==="list"||e.slot==="group")&&e.kind){let c=r.schema.tryDefinition(e.kind),g=Object.keys(c?.fields?.shape??{}).filter(d=>!["label","name","title"].includes(d)),l=r.graph.nodesOfKind(e.kind).filter(d=>i.includes(y(c,d).toLowerCase())).slice(0,6),s=d=>w(c,d).toLowerCase(),o=g.find(d=>l.some(u=>typeof u[d]=="string"&&m.test(String(u[d])))),a=g.find(d=>{let u=l.map(p=>L(p[d])).filter(p=>p!==void 0);return u.length>0&&u.every(p=>!i.includes(p.toLowerCase()))});if(a){let d=l.some(u=>m.test(String(u[a]??"")));n.push(d&&!/date|day/.test(s(a))?`Show the ${s(a)} date on each row`:`Show ${s(a)} on each row`)}let f=t.views.arrangement?.()?.lists?.[e.kind],A=typeof f?.sort=="string"?f.sort:f?.sort?.by;o&&A!==o&&n.push(`Sort these by ${/date|day/.test(s(o))?s(o):`${s(o)} date`}, soonest first`)}return n.push(`Make \u201C${e.name}\u201D easier to read at a glance`),n.slice(0,3)}export{M as a,V as b,T as c,W as d,j as e,F as f};