graview 0.1.63 → 0.1.65

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 (225) hide show
  1. package/dist/preview/chunk.2P34ML3O.js +111 -0
  2. package/dist/preview/{chunk.A2R53GWF.js → chunk.2PK335JQ.js} +1 -1
  3. package/dist/preview/{chunk.NIAM7OTV.js → chunk.2QQ37RCZ.js} +1 -1
  4. package/dist/preview/{chunk.FGDGTES4.js → chunk.2TZSLREX.js} +2 -2
  5. package/dist/preview/chunk.2UW5CRHF.js +1 -0
  6. package/dist/preview/{chunk.H7AH3IW4.js → chunk.2YMO7ZVX.js} +1 -1
  7. package/dist/preview/chunk.33ULA3CG.js +1 -0
  8. package/dist/preview/{chunk.HMMK7LCL.js → chunk.35E75QJ7.js} +1 -1
  9. package/dist/preview/chunk.3CJLAJXP.js +25 -0
  10. package/dist/preview/chunk.3IJSB5ET.js +1 -0
  11. package/dist/preview/{chunk.OM2NIQWA.js → chunk.3IZEZPJB.js} +1 -1
  12. package/dist/preview/chunk.3KO35VN4.js +1 -0
  13. package/dist/preview/{chunk.Q2EGESEZ.js → chunk.3KUYB5ZT.js} +1 -1
  14. package/dist/preview/chunk.3RFAUIGT.js +1 -0
  15. package/dist/preview/{chunk.Q4GJIJAU.js → chunk.3WP66LB5.js} +1 -1
  16. package/dist/preview/{chunk.2RASWDMQ.js → chunk.44ZHHPPJ.js} +2 -2
  17. package/dist/preview/chunk.4GJ7F4SP.js +35 -0
  18. package/dist/preview/{chunk.4MEQUUG4.js → chunk.4IJTPV5X.js} +1 -1
  19. package/dist/preview/{chunk.DWK3GXRR.js → chunk.4JFBLVXJ.js} +1 -1
  20. package/dist/preview/{chunk.XUXZW7DU.js → chunk.4O3C2LJF.js} +1 -1
  21. package/dist/preview/chunk.4PCVQEVI.js +1 -0
  22. package/dist/preview/{chunk.WBS7ND2C.js → chunk.5FQSYMAE.js} +1 -1
  23. package/dist/preview/chunk.5M34BJIQ.js +1 -0
  24. package/dist/preview/chunk.5NCLZ4NZ.js +1 -0
  25. package/dist/preview/{chunk.36OE6RKG.js → chunk.5THLLSS4.js} +1 -1
  26. package/dist/preview/chunk.5YNLFOBJ.js +5 -0
  27. package/dist/preview/{chunk.DZSZUX34.js → chunk.64FCAUAJ.js} +1 -1
  28. package/dist/preview/chunk.6RZHKQP3.js +1 -0
  29. package/dist/preview/chunk.6YDC6IDA.js +1 -0
  30. package/dist/preview/{chunk.BN7C5ZYX.js → chunk.74B6KQF4.js} +1 -1
  31. package/dist/preview/chunk.77XQEDT5.js +1 -0
  32. package/dist/preview/chunk.7E4CSXBT.js +1 -0
  33. package/dist/preview/chunk.7HPQI5SY.js +1 -0
  34. package/dist/preview/{chunk.Y4ZM75WL.js → chunk.7IGD2K4M.js} +1 -1
  35. package/dist/preview/{chunk.2F4AZZQR.js → chunk.7Q43N5JS.js} +1 -1
  36. package/dist/preview/{chunk.KB5BCW23.js → chunk.7VQ3C7F4.js} +1 -1
  37. package/dist/preview/{chunk.MT5DXJKN.js → chunk.A4VA3DU5.js} +1 -1
  38. package/dist/preview/{chunk.6Z2GHQQH.js → chunk.AB4RZSYW.js} +31 -23
  39. package/dist/preview/chunk.ABSY3UZF.js +1 -0
  40. package/dist/preview/chunk.ARHAD5IS.js +1 -0
  41. package/dist/preview/chunk.BOC2EOGB.js +9 -0
  42. package/dist/preview/chunk.BR6TINGU.js +1 -0
  43. package/dist/preview/{chunk.B5PJCYBU.js → chunk.BU5PVRX7.js} +1 -1
  44. package/dist/preview/{chunk.PDMX3GTL.js → chunk.BUQKRXI6.js} +1 -1
  45. package/dist/preview/{chunk.RUFYORIJ.js → chunk.C437FVD7.js} +1 -1
  46. package/dist/preview/chunk.CD6YWH6T.js +3 -0
  47. package/dist/preview/chunk.CDEAAWPS.js +1 -0
  48. package/dist/preview/{chunk.XUO67YMT.js → chunk.CGQ6KXVK.js} +1 -1
  49. package/dist/preview/{chunk.WYPCLZL7.js → chunk.CPYBJNHP.js} +1 -1
  50. package/dist/preview/{chunk.FXCQJPN4.js → chunk.CS72MISN.js} +2 -2
  51. package/dist/preview/chunk.CXJJB3MK.js +1 -0
  52. package/dist/preview/{chunk.CAXILB7K.js → chunk.CXLQPE4J.js} +1 -1
  53. package/dist/preview/{chunk.REUMBCSV.js → chunk.DA4RSHLW.js} +1 -1
  54. package/dist/preview/{chunk.YXAKHXYB.js → chunk.DICM56FT.js} +1 -1
  55. package/dist/preview/{chunk.ZSGDVNVN.js → chunk.DJMSXXP4.js} +1 -1
  56. package/dist/preview/{chunk.ZY7US4Y7.js → chunk.DJPNVXBQ.js} +1 -1
  57. package/dist/preview/chunk.DJVHKBEI.js +1 -0
  58. package/dist/preview/chunk.E5WJSTOV.js +1 -0
  59. package/dist/preview/{chunk.KPQLM4TM.js → chunk.F2TWV4TX.js} +1 -1
  60. package/dist/preview/chunk.F5VEHAP2.js +1 -0
  61. package/dist/preview/{chunk.GHN62OMG.js → chunk.FDWRH5P2.js} +1 -1
  62. package/dist/preview/chunk.FEGSYSA7.js +1 -0
  63. package/dist/preview/{chunk.T3JIZNE7.js → chunk.FHHVW2WB.js} +1 -1
  64. package/dist/preview/chunk.FOSY7MZF.js +2 -0
  65. package/dist/preview/{chunk.ZZAI57VI.js → chunk.FXG5AJF6.js} +1 -1
  66. package/dist/preview/{chunk.K7TK3KRB.js → chunk.G3Q5IMM3.js} +1 -1
  67. package/dist/preview/{chunk.KXFNRJ46.js → chunk.GPCKOYSF.js} +1 -1
  68. package/dist/preview/{chunk.YOUB3J3Y.js → chunk.HJS3LTSR.js} +1 -1
  69. package/dist/preview/chunk.HJUXC5GM.js +1 -0
  70. package/dist/preview/chunk.HNMSYQRA.js +1 -0
  71. package/dist/preview/chunk.HWLRKOI3.js +1 -0
  72. package/dist/preview/{chunk.BQM3YAMR.js → chunk.IFBGYFS4.js} +1 -1
  73. package/dist/preview/chunk.IHUMKFYH.js +10 -0
  74. package/dist/preview/{chunk.AW26EETU.js → chunk.IJ3YDBWI.js} +1 -1
  75. package/dist/preview/{chunk.SMHP2CQH.js → chunk.IMKD6QQG.js} +1 -1
  76. package/dist/preview/{chunk.75GENXGP.js → chunk.INTJD5WG.js} +1 -1
  77. package/dist/preview/chunk.IQ54QTA5.js +1 -0
  78. package/dist/preview/{chunk.MIE3ODQ2.js → chunk.IQC3GOXO.js} +1 -1
  79. package/dist/preview/{chunk.2PJ6STKA.js → chunk.IR4OW67N.js} +1 -1
  80. package/dist/preview/{chunk.72YXFJKC.js → chunk.ISN2QTVL.js} +1 -1
  81. package/dist/preview/{chunk.Q4MI53KK.js → chunk.J24YPQ5I.js} +5 -5
  82. package/dist/preview/chunk.J545NAMY.js +1 -0
  83. package/dist/preview/{chunk.57YDGGJK.js → chunk.J6KNEI5R.js} +1 -1
  84. package/dist/preview/chunk.K3JARAWU.js +1 -0
  85. package/dist/preview/{chunk.MY5HJW2Z.js → chunk.KHAVEYT7.js} +1 -1
  86. package/dist/preview/{chunk.STDJ6XG5.js → chunk.KIQXTQDU.js} +1 -1
  87. package/dist/preview/chunk.KROR65KD.js +2 -0
  88. package/dist/preview/chunk.KV7GZBJ6.js +50 -0
  89. package/dist/preview/{chunk.CGK2PY76.js → chunk.L6FGKJ5H.js} +1 -1
  90. package/dist/preview/chunk.L7NJLZWV.js +1 -0
  91. package/dist/preview/{chunk.HOFATBGD.js → chunk.LGRQDILY.js} +1 -1
  92. package/dist/preview/{chunk.IEDCFSN5.js → chunk.LKK5YF2H.js} +1 -1
  93. package/dist/preview/chunk.LON75VHP.js +1 -0
  94. package/dist/preview/chunk.LQWVJQ5X.js +18 -0
  95. package/dist/preview/{chunk.PDS4HT46.js → chunk.LVD3V77M.js} +1 -1
  96. package/dist/preview/{chunk.JIEDJEHK.js → chunk.LY5CY7GE.js} +1 -1
  97. package/dist/preview/{chunk.OXWOUE3W.js → chunk.M5W2RHC6.js} +1 -1
  98. package/dist/preview/chunk.M6BTLH24.js +1 -0
  99. package/dist/preview/chunk.MAGKI4PD.js +1 -0
  100. package/dist/preview/chunk.MD36ZSM5.js +74 -0
  101. package/dist/preview/chunk.MFZJVHWP.js +1 -0
  102. package/dist/preview/{chunk.VCTAFSZ5.js → chunk.MH46V556.js} +1 -1
  103. package/dist/preview/chunk.MHTA4HYB.js +19 -0
  104. package/dist/preview/{chunk.QSPLKCTX.js → chunk.N2FNHRI2.js} +1 -1
  105. package/dist/preview/chunk.N2YM247R.js +1 -0
  106. package/dist/preview/chunk.N35SJWAM.js +1 -0
  107. package/dist/preview/chunk.NBVPWLRY.js +3 -0
  108. package/dist/preview/{chunk.NEPQBMFT.js → chunk.NKYYDFIX.js} +1 -1
  109. package/dist/preview/chunk.NSO6RUKW.js +1 -0
  110. package/dist/preview/{chunk.OIMGD7FR.js → chunk.O2W5JTWA.js} +1 -1
  111. package/dist/preview/chunk.OHMHPTEW.js +1 -0
  112. package/dist/preview/{chunk.XBYJCGPU.js → chunk.P6TZGR3A.js} +1 -1
  113. package/dist/preview/{chunk.KQPKYWDM.js → chunk.PTQPS2FJ.js} +1 -1
  114. package/dist/preview/chunk.PV2I4UPH.js +1 -0
  115. package/dist/preview/chunk.QFQSSZN7.js +1 -0
  116. package/dist/preview/{chunk.OTSBF367.js → chunk.QO5RXOCS.js} +2 -2
  117. package/dist/preview/{chunk.VZDHRY3U.js → chunk.QSDBF7VL.js} +1 -1
  118. package/dist/preview/{chunk.V4HVFLFQ.js → chunk.R2TSTDS3.js} +1 -1
  119. package/dist/preview/{chunk.34DRUCH2.js → chunk.RFVOXX3P.js} +1 -1
  120. package/dist/preview/chunk.RSS6OHXG.js +1 -0
  121. package/dist/preview/{chunk.XYGNS637.js → chunk.S2DOVJRL.js} +1 -1
  122. package/dist/preview/chunk.S3EEY7T3.js +1 -0
  123. package/dist/preview/chunk.SBCAYTMT.js +1 -0
  124. package/dist/preview/chunk.SMTGRCMG.js +3 -0
  125. package/dist/preview/{chunk.NTC2H5ZX.js → chunk.SOMRYDDH.js} +1 -1
  126. package/dist/preview/{chunk.4EXC26LI.js → chunk.SPCAMQJE.js} +1 -1
  127. package/dist/preview/{chunk.SGPXYDSG.js → chunk.T3KNLP7C.js} +1 -1
  128. package/dist/preview/chunk.TBY5IR7C.js +1 -0
  129. package/dist/preview/chunk.TCZIZ2PU.js +1 -0
  130. package/dist/preview/{chunk.PWAP2GJS.js → chunk.TUCSUZNO.js} +1 -1
  131. package/dist/preview/{chunk.DIFIHNR3.js → chunk.TY74U3EI.js} +1 -1
  132. package/dist/preview/chunk.U74PTRHJ.js +1 -0
  133. package/dist/preview/chunk.UAORKZLO.js +1 -0
  134. package/dist/preview/chunk.UDVTPI2W.js +1 -0
  135. package/dist/preview/{chunk.OMRQTLI5.js → chunk.UETLP5KC.js} +1 -1
  136. package/dist/preview/chunk.UHI3X2YD.js +1 -0
  137. package/dist/preview/chunk.UL62ELNR.js +1 -0
  138. package/dist/preview/chunk.VRYSZYAD.js +1 -0
  139. package/dist/preview/{chunk.CI4RZL4Z.js → chunk.VUZFLDOX.js} +1 -1
  140. package/dist/preview/chunk.X2NGFOAF.js +1 -0
  141. package/dist/preview/chunk.XE762VL2.js +2 -0
  142. package/dist/preview/{chunk.QS32TO4N.js → chunk.XSWR5LI4.js} +1 -1
  143. package/dist/preview/{chunk.JVDPRQ7J.js → chunk.XTTESA7X.js} +1 -1
  144. package/dist/preview/chunk.Y2RZ5B4U.js +1 -0
  145. package/dist/preview/chunk.Y7QDQ3WF.js +1 -0
  146. package/dist/preview/{chunk.O3YIWIVQ.js → chunk.YKMBXMZE.js} +1 -1
  147. package/dist/preview/chunk.Z34KASY7.js +1 -0
  148. package/dist/preview/{chunk.XCWZFLIB.js → chunk.ZDUTEM3Z.js} +1 -1
  149. package/dist/preview/{chunk.EJ4MSVX2.js → chunk.ZJFXM3LE.js} +1 -1
  150. package/dist/preview/chunk.ZMGKWMID.js +1 -0
  151. package/dist/preview/{chunk.AHPYNDVA.js → chunk.ZMWAZACO.js} +1 -1
  152. package/dist/preview/chunk.ZT5YQSSP.js +21 -0
  153. package/dist/preview/{chunk.B46UZHGW.js → chunk.ZTN7BS5O.js} +1 -1
  154. package/dist/preview/{chunk.HRNNRA2I.js → chunk.ZYNC73DJ.js} +1 -1
  155. package/dist/preview/chunk.ZZM75ZTN.js +4 -0
  156. package/dist/preview/index.html +56 -56
  157. package/dist/preview/page.js +2 -2
  158. package/dist/preview/splash.js +3 -3
  159. package/package.json +6 -6
  160. package/dist/preview/chunk.24HNOLUS.js +0 -3
  161. package/dist/preview/chunk.25CQCCLN.js +0 -1
  162. package/dist/preview/chunk.26H33GJC.js +0 -50
  163. package/dist/preview/chunk.2KIWGQXC.js +0 -2
  164. package/dist/preview/chunk.33XNYHI6.js +0 -1
  165. package/dist/preview/chunk.37FLKAVZ.js +0 -1
  166. package/dist/preview/chunk.3JCHJLH6.js +0 -1
  167. package/dist/preview/chunk.3OQ6S6H4.js +0 -1
  168. package/dist/preview/chunk.47QEWSSE.js +0 -1
  169. package/dist/preview/chunk.4DAKQXDG.js +0 -1
  170. package/dist/preview/chunk.4TH3CGAZ.js +0 -1
  171. package/dist/preview/chunk.5GC4VAHU.js +0 -1
  172. package/dist/preview/chunk.5QXQ7PBI.js +0 -35
  173. package/dist/preview/chunk.6CSHRMJC.js +0 -1
  174. package/dist/preview/chunk.6HKWAHPT.js +0 -1
  175. package/dist/preview/chunk.6XHPBJ5F.js +0 -1
  176. package/dist/preview/chunk.6YK5E7ZQ.js +0 -4
  177. package/dist/preview/chunk.735AFUP5.js +0 -1
  178. package/dist/preview/chunk.ATDIDPKZ.js +0 -1
  179. package/dist/preview/chunk.AWUO3M5D.js +0 -1
  180. package/dist/preview/chunk.BF3EZCG3.js +0 -1
  181. package/dist/preview/chunk.BKQICGFW.js +0 -1
  182. package/dist/preview/chunk.C65EHQ7V.js +0 -1
  183. package/dist/preview/chunk.CCQMDZHO.js +0 -1
  184. package/dist/preview/chunk.CYTTZOYL.js +0 -25
  185. package/dist/preview/chunk.D5LOTCBU.js +0 -3
  186. package/dist/preview/chunk.DBFJVVWF.js +0 -1
  187. package/dist/preview/chunk.DDFRFSVN.js +0 -1
  188. package/dist/preview/chunk.E3XJMO7Q.js +0 -1
  189. package/dist/preview/chunk.EJ2WE764.js +0 -18
  190. package/dist/preview/chunk.ERPILTRY.js +0 -1
  191. package/dist/preview/chunk.FFXBDOKA.js +0 -1
  192. package/dist/preview/chunk.FNVGNISQ.js +0 -3
  193. package/dist/preview/chunk.G2JAYG2Z.js +0 -1
  194. package/dist/preview/chunk.H5SN46VK.js +0 -1
  195. package/dist/preview/chunk.HSMJHCR3.js +0 -1
  196. package/dist/preview/chunk.JNIDS66Z.js +0 -1
  197. package/dist/preview/chunk.JO3BBRSR.js +0 -1
  198. package/dist/preview/chunk.KL5H7KEV.js +0 -1
  199. package/dist/preview/chunk.KZUMXT5J.js +0 -74
  200. package/dist/preview/chunk.MAHNJO6U.js +0 -1
  201. package/dist/preview/chunk.MBB5A6BT.js +0 -1
  202. package/dist/preview/chunk.MENLUNM5.js +0 -1
  203. package/dist/preview/chunk.N3T2O6EW.js +0 -9
  204. package/dist/preview/chunk.NWWJNNEK.js +0 -2
  205. package/dist/preview/chunk.O67JXUVG.js +0 -1
  206. package/dist/preview/chunk.QAMW5QDT.js +0 -19
  207. package/dist/preview/chunk.R4HDKNT3.js +0 -88
  208. package/dist/preview/chunk.SJUXFPTI.js +0 -1
  209. package/dist/preview/chunk.SME4HD5I.js +0 -1
  210. package/dist/preview/chunk.SSAETRHR.js +0 -5
  211. package/dist/preview/chunk.T535ZLRM.js +0 -1
  212. package/dist/preview/chunk.UAVK54Z6.js +0 -1
  213. package/dist/preview/chunk.V6IL7CIZ.js +0 -1
  214. package/dist/preview/chunk.WNS5LEO5.js +0 -1
  215. package/dist/preview/chunk.WUVXIUA7.js +0 -1
  216. package/dist/preview/chunk.XCEZCOX4.js +0 -1
  217. package/dist/preview/chunk.XIW4SZHD.js +0 -1
  218. package/dist/preview/chunk.YZBJUAS6.js +0 -1
  219. package/dist/preview/chunk.Z2ZQJ3DD.js +0 -1
  220. package/dist/preview/chunk.ZELWW7UA.js +0 -21
  221. package/dist/preview/chunk.ZLTHWCKL.js +0 -2
  222. package/dist/preview/chunk.ZP7JEVVU.js +0 -1
  223. package/dist/preview/chunk.ZRH5X3MR.js +0 -1
  224. package/dist/preview/chunk.ZVG4FXJK.js +0 -1
  225. /package/dist/preview/{chunk.GZHZLJBF.js → chunk.MIE4TJRW.js} +0 -0
@@ -1 +0,0 @@
1
- import"./chunk.WVUJXDXZ.js";import{a as F,b as K,c as pe}from"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.GZHZLJBF.js";import{o as me}from"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as Te,M as C,O as ue,T as ce,ba as ge,ea as he}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{Aa as se,Ba as Y,pd as de,ra as oe,ua as x,wa as le,ya as W,za as E}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as q}from"./chunk.AJZBJBMO.js";var g=q(Te(),1);async function ye(e,t){let a=await createImageBitmap(e);try{let i=Math.min(1,t/Math.max(a.width,a.height)),r=document.createElement("canvas");r.width=Math.max(1,Math.round(a.width*i)),r.height=Math.max(1,Math.round(a.height*i));let l=r.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(a,0,0,r.width,r.height),r}finally{a.close()}}var n=q(ce(),1),He=2048,Ie=.85;function T(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function H(e){if(e.type==="application/pdf")return"PDF";let t=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return t?t.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let t=[...new Set(e.map(a=>a==="image/*"?"pictures":a==="video/*"?"videos":a==="*/*"||a==="*"?"any file":`${H({type:a})} files`))];return t.length<=1?t[0]??"no files":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function xe(e,t){if(e.length===0)return!0;let a=`${t.split("/")[0]}/*`;return e.some(i=>i==="*"||i==="*/*"||i===t||i===a)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,t,a){let i=e.name||(a.camera?"photo.jpg":"file"),r=e.type||(be({type:"",name:i})?"image/heic":Be(i)??"application/octet-stream"),l=be({type:r,name:i}),u=r.startsWith("image/")||l;if(a.image&&!u)return{refused:`\u201C${i}\u201D isn\u2019t a picture.`};if(a.video)return r.startsWith("video/")?J({blob:e,name:i,type:r},t):{refused:`\u201C${i}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(r)&&(a.camera||e.size>t.maxBytes||e.size>15e5))try{let c=await ye(e,He),b=await new Promise(m=>c.toBlob(m,"image/jpeg",Ie));if(b)return J({blob:b,name:l?i.replace(/\.hei[cf]$/i,"")+".jpg":i,type:"image/jpeg",width:c.width,height:c.height},t)}catch{if(l&&!xe(t.kinds,r))return{refused:`\u201C${i}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let p={};if(u&&!l)try{let c=await createImageBitmap(e);p={width:c.width,height:c.height},c.close()}catch{}return J({blob:e,name:i,type:r,...p},t)}function J(e,t){return xe(t.kinds,e.type)?e.blob.size>t.maxBytes?{refused:`\u201C${e.name}\u201D is ${T(e.blob.size)}; this host takes files up to ${T(t.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${H(e)} file; this host takes ${ke(t.kinds)}.`}}async function _e(e,t,a,i=!1){let r;try{r=await t.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(r)?a&&!W(r)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:i&&!E(r)?{refused:`The host kept \u201C${e.name}\u201D as ${H(r)}, not as a video.`}:{...r,...r.width===void 0&&e.width?{width:e.width}:{},...r.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var $="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function ee(e){let t=C(),a=ue()?.past!=null,[i,r]=(0,g.useState)(!1),l=t?.kept?ze(t,e.href):!0,[,u]=(0,g.useState)(0);return(0,g.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(p=>p+1)),()=>void(s=!1)},[l]),[l===!1||a&&i,()=>r(!0)]}var Q=new WeakMap;function ze(e,t){let a=Q.get(e)?.get(t);if(a!==void 0)return a;let i;try{i=e.kept(t)}catch{return!0}if(typeof i=="boolean")return i;let r=Q.get(e)??new Map;Q.set(e,r);let l=Promise.resolve(i).then(u=>u!==!1,()=>!0);return r.set(t,l),l.then(u=>r.set(t,u)),l}function te({file:e,style:t}){return(0,n.jsx)("span",{role:"img","aria-label":`${F(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:$,...t},children:"removed later"})}function X({file:e,size:t=56,style:a}){let i=C(),[r,l]=ee(e);return r?(0,n.jsx)(te,{file:e,style:{width:t,height:t,flex:"none",...a}}):E(e)?(0,n.jsx)(Ae,{file:e,size:t,...a?{style:a}:{},onError:l}):(0,n.jsx)("img",{onError:l,src:x(i,e.href),alt:F(e),width:t,height:t,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:t,height:t,objectFit:"cover",borderRadius:$,display:"block",flex:"none",background:"var(--graview-edge)",...a}})}function Fe(e){let[t,a]=(0,g.useState)({}),i=e.duration??t.duration;return[{...i!==void 0?{duration:i}:{},width:e.width??t.width,height:e.height??t.height},u=>{let s=u.currentTarget;a({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,$e=(e,t)=>`${F(e)}, ${se({...t!==void 0?{duration:t}:{}})}`,Oe=(0,n.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,n.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,n.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:t,style:a,onError:i}){let r=C(),[l,u]=Fe(e),s={width:t,height:t,objectFit:"cover",display:"block",borderRadius:$,background:"var(--graview-edge)"};return(0,n.jsxs)("span",{role:"img","aria-label":$e(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:t,height:t,flex:"none",...a},children:[e.poster?(0,n.jsx)("img",{src:x(r,e.poster),alt:"",width:t,height:t,loading:"lazy",decoding:"async",onError:i,style:s}):(0,n.jsx)("video",{src:x(r,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:t,height:t,onLoadedMetadata:u,onError:i,style:s}),Oe,l.duration!==void 0?(0,n.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:K(l.duration)}):null]})}function Ge(){let e=()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):void 0,[t,a]=(0,g.useState)(()=>e()?.matches===!0);return(0,g.useEffect)(()=>{let i=e();if(!i)return;let r=()=>a(i.matches);return r(),i.addEventListener?.("change",r),()=>i.removeEventListener?.("change",r)},[]),t}function Ue({file:e,autoplay:t=!1,cover:a=!1}){let i=C(),[r,l]=ee(e),[u,s]=Fe(e),p=Ge(),c=t&&p,b=(0,g.useRef)(null),m=(0,g.useRef)(c);if((0,g.useEffect)(()=>{let d=b.current;!d||!t||(c?d.pause():m.current&&d.play?.()?.catch?.(()=>{}),m.current=c)},[t,c]),r)return(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let v=u.width!==void 0&&u.height!==void 0,w=a?{display:"block",width:"100%",height:"100%",objectFit:"cover",background:"#000"}:{display:"block",width:"100%",maxWidth:v?Math.max(u.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:v?`${u.width} / ${u.height}`:"16 / 9",borderRadius:$,background:"#000"};return(0,n.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0,...a?{height:"100%"}:{}},children:[(0,n.jsx)("video",{ref:b,"data-graview-video":e.href,...t?{"data-graview-video-autoplay":""}:{},...a?{"data-graview-video-cover":""}:{},...c?{"data-graview-video-still":""}:{},src:x(i,e.href),...e.poster?{poster:x(i,e.poster)}:{},...t?{muted:!0,loop:!0,...c?{}:{autoPlay:!0}}:{controls:!0},preload:t&&!c?"auto":"metadata",playsInline:!0,...v?{width:u.width,height:u.height}:{},"aria-label":$e(e,u.duration),onLoadedMetadata:s,onError:l,style:w,children:e.captions?(0,n.jsx)("track",{kind:"captions",src:x(i,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),t?null:(0,n.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...u.duration!==void 0?[K(u.duration)]:[]].join(" \xB7 ")})]})}function qe({file:e,onOpen:t}){let a=C(),[i,r]=ee(e);return i?(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,n.jsx)("button",{type:"button","aria-label":`Open ${F(e)} full size`,onClick:l=>t(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:$},children:(0,n.jsx)("img",{src:x(a,e.href),alt:F(e),loading:"lazy",decoding:"async",onError:r,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:$,display:"block",background:"var(--graview-edge)"}})})}function Ye({src:e,file:t}){let[a,i]=(0,g.useState)(!1);return(0,n.jsx)("object",{data:e,type:"application/pdf","aria-label":F(t),"data-graview-pdf":a?"shown":"waiting",onLoad:()=>i(!0),style:a?{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:$}:{width:"100%",height:0,display:"block"}})}function Z({files:e,label:t,autoplay:a,cover:i}){let r=C(),l=d=>x(r,d.href),u=e.filter(W),s=e.filter(E),p=e.filter(d=>!W(d)&&!E(d)),[c,b]=(0,g.useState)(null),m=(0,g.useRef)(null),v=(0,g.useRef)(null);(0,g.useEffect)(()=>{let d=m.current;c!==null&&d&&!d.open&&d.showModal?.()},[c]);let w=c===null?void 0:u[c];return(0,n.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[u.length>0?(0,n.jsx)("ul",{"data-graview-gallery":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:u.map((d,I)=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(qe,{file:d,onOpen:M=>{v.current=M,b(I)}})},d.href))}):null,s.length>0?(0,n.jsx)("ul",{"data-graview-videos":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:s.map(d=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(Ue,{file:d,...a?{autoplay:a}:{},...i?{cover:i}:{}})},d.href))}):null,p.length>0?(0,n.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:p.map(d=>(0,n.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,n.jsx)(Ye,{src:l(d),file:d}):null,d.type==="application/pdf"?(0,n.jsxs)("span",{"data-graview-file-line":"",style:{minWidth:0,overflowWrap:"anywhere",lineHeight:1.5},children:[d.name," ",(0,n.jsxs)("span",{style:P,children:["\xB7 ",H(d)," \xB7 ",T(d.bytes)," \u2014"]})," ",(0,n.jsx)("a",{href:l(d),target:"_blank",rel:"noopener",children:"Open"})," ",(0,n.jsx)("span",{style:P,"aria-hidden":"true",children:"/"})," ",(0,n.jsx)("a",{href:l(d),download:d.name,children:"Download"})]}):(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,n.jsx)("a",{href:l(d),download:d.name,children:d.name}),(0,n.jsxs)("span",{style:P,children:[H(d)," \xB7 ",T(d.bytes)]})]}),d.caption?(0,n.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,w?(0,n.jsx)("dialog",{ref:m,"data-graview-full":w.href,"aria-label":F(w),onClose:()=>{b(null),v.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:$,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,n.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,n.jsx)("img",{src:l(w),alt:F(w),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,n.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)("span",{children:w.caption??w.name}),(0,n.jsx)("form",{method:"dialog",style:{margin:0},children:(0,n.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:t,several:a,image:i,video:r=!1,label:l,thumbs:u=!0}){let s=C(),p=(0,g.useId)(),c=(0,g.useRef)(null),b=(0,g.useRef)(null),[m,v]=(0,g.useState)(null),[w,d]=(0,g.useState)(null),[I,M]=(0,g.useState)([]),[O,A]=(0,g.useState)(!1),L=i?"image/":r?"video/":void 0,R=s?L?s.kinds.filter(o=>o.startsWith(L)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||R.length>0:!1,We=!r&&(s?s.kinds.length===0||(i?R:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,D=ne&&(!L||Pe),B=i?"picture":r?"video":"file",ae=a?`${B}s`:`a ${B}`,ie=L?R.length>0?R.join(","):`${L}*`:s?.kinds.join(",")||void 0,Me=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,G=(0,g.useRef)(e);G.current=e;let re=(0,g.useRef)(null),j=(0,g.useRef)(null);(0,g.useEffect)(()=>{let o=j.current;if(!o||o.from===e)return;j.current=null;let h=re.current?.children,f=h?.[Math.min(o.at,h.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let _=async(o,h)=>{if(!s||o.length===0)return;let f=a?o:o.slice(0,1),y=[],S=[];f.length<o.length&&S.push(`${l} holds one ${B}, so ${o.slice(1).map(k=>`\u201C${k.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),M([]),d(null);for(let k of f){v(`Sending ${k.name||"the photo"}\u2026`);let U=await je(k,s,{image:i,video:r,camera:h==="camera"});if("refused"in U){S.push(U.refused);continue}let V=await _e(U,s,i,r);"refused"in V?S.push(V.refused):[...a?G.current:[],...y].some(Ve=>Ve.href===V.href)?S.push(`\u201C${V.name}\u201D is already here.`):y.push(V)}if(v(null),M(S),y.length!==0)try{t(a?[...G.current,...y]:y.slice(-1)),d(`Added ${y.map(k=>k.name).join(", ")}.`)}catch(k){M([...S,k instanceof Error?k.message:String(k)])}},z=(o,h,f)=>{try{j.current=f?{...f,from:e}:null,t(o),d(h)}catch(y){j.current=null,M([y instanceof Error?y.message:String(y)])}},N=o=>o?Array.from(o):[],Re=o=>{let h=N(o.clipboardData?.files);!D||h.length===0||(o.preventDefault(),_(h,"pasted"))},Le=o=>{A(!1),D&&(o.preventDefault(),_(N(o.dataTransfer?.files),"dropped"))};return(0,n.jsxs)("div",{role:"group","aria-labelledby":`${p}-label`,"data-graview-file-editor":"","data-graview-dropping":O?"":void 0,onPaste:Re,onDragOver:o=>{D&&(o.preventDefault(),A(!0))},onDragLeave:()=>A(!1),onDrop:Le,style:{display:"grid",gap:8,minWidth:0,padding:O?6:0,outline:O?"2px dashed var(--graview-accent)":"none",borderRadius:$},children:[(0,n.jsx)("span",{id:`${p}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(a||e.length>1)?(0,n.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,h)=>(0,n.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(W(o)||E(o))?(0,n.jsx)(X,{file:o,size:40}):null,(0,n.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,n.jsx)(we,{file:o,onCaption:f=>z(e.map((y,S)=>S===h?ve(y,f):y),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),a&&h>0?(0,n.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>z(e.map((f,y)=>y===h-1?o:y===h?e[h-1]:f),`Moved ${o.name} earlier.`,{at:h-1,what:"move"}),children:"\u2191"}):null,a?(0,n.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>z(e.filter((f,y)=>y!==h),`Removed ${o.name}.`,{at:h,what:"remove"}),children:"Remove"}):null]},`${h}:${o.href}`))}):e.length===1?(0,n.jsx)(we,{file:e[0],onCaption:o=>z([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,D?(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,n.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:a,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"picked")}}),(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!a?`Replace the ${B}`:`Choose ${ae}`}),We?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"camera")}}),Me?(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,n.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",a?"them":"it"," here \xB7 ",s.kinds.length>0?ke(R.length>0?R:s.kinds):"any file",", up to ",T(s.maxBytes)]})]}):(0,n.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${r?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,n.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:m||w?void 0:0},"data-graview-file-status":"",children:m??w??""}),I.length>0?(0,n.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:I.map((o,h)=>(0,n.jsx)("p",{style:{margin:0},children:o},h))}):null]})}var ve=(e,t)=>{let{caption:a,...i}=e;return t?{...i,caption:t}:i};function we({file:e,onCaption:t}){let[a,i]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>i(e.caption??""),[e.caption]);let r=()=>{let l=a.trim().slice(0,500);l!==(e.caption??"")&&t(l)};return(0,n.jsx)("input",{type:"text",value:a,placeholder:W(e)||E(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${W(e)||E(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>i(l.target.value),onBlur:r,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),r())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:t,labelStyle:a,valueStyle:i,style:r,children:l}){return(0,n.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...r},children:[(0,n.jsx)("dt",{style:a,children:t}),(0,n.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...i},children:l})]})}function Ce(e){let{nodeId:t,field:a,label:i,files:r}=e,{fields:l,commit:u}=me(t),s=l.find(m=>m.field===a&&m.takesValue),p=s?.shape,c=p?.type==="several"?p.of:p,b=p?.type==="several";return r.length===0&&c?.type!=="file"?null:(0,n.jsxs)(Ee,{...e,children:[(0,n.jsx)(Z,{files:r,label:i}),s&&c?.type==="file"?(0,n.jsx)(Se,{value:r,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:i,onChange:m=>{let v=b?m:m[m.length-1];v!==void 0&&u(s,v)}}):null]})}function nt(e){switch(e.as){case"field":{if(!e.read)return(0,n.jsx)(Ce,{...e});let{autoplay:t,cover:a,...i}=e;return e.files.length>0?(0,n.jsx)(Ee,{...i,children:(0,n.jsx)(Z,{files:e.files,label:e.label,...t?{autoplay:t}:{},...a?{cover:a}:{}})}):null}case"unfilled":return(0,n.jsx)(Ke,{...e});case"thumb":return(0,n.jsx)(X,{...e});case"block":return e.files.length>0?(0,n.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,n.jsx)(X,{file:e.files[0],size:72}):(0,n.jsx)(Z,{files:e.files,label:e.label,...e.autoplay?{autoplay:!0}:{},...e.cover?{cover:!0}:{}})}):null;case"control":{let t=(0,n.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:a=>e.onChange(e.several?a:a[a.length-1])});return e.title===void 0?t:(0,n.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,n.jsx)("legend",{"data-graview-part":"label",children:e.title}),t]})}}}function Ke({nodeId:e,skip:t,labels:a,labelStyle:i,style:r}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,p=pe(s).filter(c=>!t.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return p.length===0?null:(0,n.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:p.map(c=>(0,n.jsx)(Ce,{nodeId:e,field:c,label:a?.[c]??oe(s,c),files:[],...i?{labelStyle:i}:{},...r?{style:r}:{}},c))})}export{Se as FilesEditor,He as SEND_EDGE,nt as drawFiles,ke as kindsWords,je as prepare,_e as send,T as sizeWords,xe as takes,H as typeWords};
@@ -1,3 +0,0 @@
1
- import{$b as X,F as W,G,H as an,I as z,J as D,Ka as yn,L as j,M as sn,Q as dn,Sa as pn,T as _,U as ln,V as un,W as H,X as fn,Y,Z as q,bb as hn,da as J,fa as B,fb as mn,gc as wn,ha as cn,ia as gn,sa as Q}from"./chunk.Q4MI53KK.js";var vn=864e5,P=e=>String(e).padStart(2,"0"),U=e=>new Date(e).toISOString().slice(0,10),E=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),Kn=(e,t)=>U(E(e)+t*vn),Sn=e=>new Date(E(e)).getUTCDay(),zn=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e),nn=["sun","mon","tue","wed","thu","fri","sat"],An=e=>sn(e)??"UTC";function Nn(e,t){if(W.test(e))return U(E(e))===e?{day:e}:void 0;if(G.test(e))return{day:e.length===4?`${e}-01-01`:`${e}-01`};if(D.test(e)&&!zn(e)){let l=e.slice(0,10);return U(E(l))!==l?void 0:{day:l,minutes:Number(e.slice(11,13))*60+Number(e.slice(14,16))}}let s=Date.parse(e);if(!Number.isNaN(s))return{...ln(s,t),stamp:s}}var $n=["EEEE","EEE","MMMM","MMM","yyyy","HH","mm","h","a","d"],bn=/[A-Za-z]+/y;function Hn(e){let t=[],s=0;for(;s<e.length;){let l=e[s];if(l==="'"){let f="",g=s+1;for(;g<e.length;g++){if(e[g]==="'"){if(e[g+1]==="'"){f+="'",g++;continue}break}f+=e[g]}if(g>=e.length)return`the quoted words in "${e}" are never closed`;t.push({text:f}),s=g+1;continue}bn.lastIndex=s;let u=bn.exec(e);if(u){let f=u[0];for(;f.length>0;){let g=$n.find($=>f.startsWith($));if(!g)return`"${f}" is not a piece of a date pattern; the pieces are ${$n.map($=>`${$}`).join(", ")}, and other words go in single quotes`;t.push(g),f=f.slice(g.length)}s+=u[0].length;continue}t.push({text:l}),s++}return t}var kn="UTC",xn=new Map;function Yn(e,t){let s=`${e}|${JSON.stringify(t)}`,l=xn.get(s);if(!l){try{l=new Intl.DateTimeFormat(e,{...t,timeZone:kn})}catch{l=new Intl.DateTimeFormat("en-US",{...t,timeZone:kn})}xn.set(s,l)}return l}var C=(e,t,s,l)=>Yn(e,t).formatToParts(s).find(u=>u.type===l)?.value??"";function Mn(e,t,s){let l=Hn(t);if(typeof l=="string")return{problem:l};let u=dn(s),f=E(e.day),g=e.minutes,$=g===void 0?void 0:f+g*6e4;return l.map(x=>{if(typeof x!="string")return x.text;switch(x){case"EEEE":return C(u,{weekday:"long"},f,"weekday");case"EEE":return C(u,{weekday:"short"},f,"weekday");case"MMMM":return C(u,{month:"long"},f,"month");case"MMM":return C(u,{month:"short"},f,"month");case"yyyy":return e.day.slice(0,4);case"d":return String(Number(e.day.slice(8,10)));case"HH":return g===void 0?"":P(Math.floor(g/60));case"mm":return g===void 0?"":P(g%60);case"h":return g===void 0?"":String((Math.floor(g/60)+11)%12+1);case"a":return $===void 0?"":C(u,{hour:"numeric",hour12:!0},$,"dayPeriod")}}).join("")}var qn=/^(\d{1,2}):(\d{2})$/;function Rn(e){let t=qn.exec(e.trim());if(!t)return;let s=Number(t[1]),l=Number(t[2]);return s<=23&&l<=59?s*60+l:void 0}var On=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Jn=(e,t)=>`${e}T${P(Math.floor(t/60))}:${P(t%60)}`;function En(e,t,s){return On(un(e.day,t,s))}function Tn(e,t){if(e.stamp!==void 0)return On(e.stamp+t*6e4);let s=E(e.day)+(e.minutes??0)*6e4+t*6e4,l=U(s);return Jn(l,Math.round((s-E(l))/6e4))}var Fn=e=>nn[Sn(e.day)];function Gn(e,t){let s=(Sn(e.day)-nn.indexOf(t)+7)%7;return Kn(e.day,-s)}var Dn=e=>typeof e=="string"&&nn.includes(e);var Bn=1e4,w=class{constructor(t){this.nodes=t}},Wn=Symbol.for("@graview/core:far-record"),Qn=e=>typeof e=="object"&&e!==null&&e[Wn]===!0;function Xn(e){let t={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(t,Wn,{value:!0}),t}function $e(e){let t=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${t} is not one this viewer may open`:`${t} has not been read`}var ne="",y=class extends Error{constructor(s,l){super(s);this.sentence=s;this.at=l}},en=class extends y{},T=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof w)&&typeof e.id=="string",Vn=e=>{let t=new Set;return new w(e.filter(s=>!t.has(s.id)&&t.add(s.id)))},k=e=>e===null?"nothing":e instanceof w?"a set of records":Array.isArray(e)?"a list":T(e)?"a record":typeof e=="string"?"a word":typeof e;function ee(e,t){if(!G.test(e)&&!G.test(t))return;let s=f=>z(D.test(f)?f.slice(0,10):f),l=s(e),u=s(t);return l&&u?[l,u]:void 0}function _n(e,t){let s=t.budget??Bn,l=(n,d)=>{if(s-=n,s<0)throw new en("this rule looks at too much of the graph to judge in one go",d)},u=t.today??j(),f=t.now??new Date().toISOString(),g=An(t.timeZone),$=new Map,x=new Set,S=t.bindings,rn=(n,d,o,i)=>{let p=`${n?.id}\0${d}`;if($.has(p))return $.get(p);if(x.has(p))throw new y(`"${d}"${n?` of ${Q(n.kind)}`:""} depends on itself`,i);x.add(p);let r=S;S=void 0;try{let a=A(o,n);return $.set(p,a),a}finally{S=r,x.delete(p)}},I=(n,d,o)=>{l(1,o);let i=t.kinds.get(n.kind),p=i?.computed?.get(d);if(p)return rn(n,d,p,o);let r=i?.linked?.get(d);if(r){let h=yn(Object.hasOwn(n,d)?n[d]:void 0,r);l(h.length,o);let b=t.linked??pn(t.graph),m=h.flatMap(N=>{let K=b?b(N):{unread:!0};return"record"in K?[Xn(K.record)]:(t.onUnread?.({relation:d,ref:N,reason:"denied"in K?"denied":"unread"}),[])});return r.cardinality==="one"?m[0]??null:new w(m)}let a=Object.hasOwn(n,d);if(i?.fields.has(d)||a){let h=a?hn(n,d,u):void 0;return h===void 0?null:h}let c=i?.edges.get(d);if(c){let h=t.graph.out(n.id,d);return l(h.length,o),c==="one"?h[0]??null:new w(h)}if(d==="id")return n.id;if(Qn(n))return null;throw new y(`${Q(n.kind)} has no field or relation called "${d}"`,o)},M=(n,d,o)=>{if(n instanceof w)return n;if(n===null)return new w([]);if(T(n))return new w([n]);throw new y(`${o}(\u2026) needs a set of records, and was given ${k(n)}`,d)},O=(n,d,o)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new y(`${o}(\u2026) needs a word, and was given ${k(n)}`,d)},v=(n,d,o)=>{let i=O(n,d,o);if(i===null)return null;let p=G.test(i)?z(i).from:i,r=Date.parse(p.length===10?`${p}T00:00:00Z`:p);if(Number.isNaN(r))throw new y(`${o}(\u2026) needs a date, and "${i}" is not one`,d);return r},V=(n,d,o)=>{if(n===null)return null;if(typeof n!="string")throw new y(`${o}(\u2026) needs a date, and was given ${k(n)}`,d);let i=Nn(n,g);if(!i)throw new y(`${o}(\u2026) needs a date, and "${n}" is not one`,d);return i},F=(n,d)=>T(n)&&T(d)?n.id===d.id:T(n)&&typeof d=="string"?n.id===d:typeof n=="string"&&T(d)?n===d.id:Array.isArray(n)&&Array.isArray(d)?n.length===d.length&&n.every((o,i)=>F(o,d[i])):n===d,R=(n,d,o)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new y(`${o} must be true or false, and was ${k(n)}`,d)},L=(n,d)=>A(d,n);function A(n,d){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(o=>A(o,d));case"ident":{let o=S&&Object.hasOwn(S,n.name)?S[n.name]:void 0;if(o!==void 0)return o;if(d)return I(d,n.name,n.at);throw new y(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let o=A(n.object,d);if(o===null)return null;if(T(o))return I(o,n.name,n.at);throw new y(`".${n.name}" needs a record before it, and was given ${k(o)}`,n.at)}case"unary":{let o=A(n.operand,d);if(n.op==="!")return!R(o,n.at,"what follows not");if(o===null)return null;if(typeof o!="number")throw new y(`"-" needs a number, and was given ${k(o)}`,n.at);return-o}case"where":{let o=M(A(n.set,d),n.at,"where");return l(o.nodes.length,n.at),new w(o.nodes.filter(i=>R(L(i,n.filter),n.at,"a where condition")))}case"binary":return Un(n,d);case"call":return Zn(n,d)}}function Un(n,d){if(n.op==="&&")return R(A(n.left,d),n.at,"each side of and")&&R(A(n.right,d),n.at,"each side of and");if(n.op==="||")return R(A(n.left,d),n.at,"each side of or")||R(A(n.right,d),n.at,"each side of or");let o=A(n.left,d),i=A(n.right,d);if(n.op==="&"||n.op==="|"||n.op==="-"&&(o instanceof w||i instanceof w)){let p=M(o,n.at,n.op).nodes,r=M(i,n.at,n.op).nodes;l(p.length+r.length,n.at);let a=new Set(r.map(c=>c.id));return Vn(n.op==="|"?[...p,...r]:p.filter(c=>a.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return F(o,i);case"!=":return!F(o,i);case"in":{if(i===null)return!1;if(i instanceof w)return i.nodes.some(p=>F(o,p));if(Array.isArray(i))return i.some(p=>F(o,p));if(typeof i=="string"&&typeof o=="string")return i.includes(o);throw new y(`"in" needs a list or a set on its right, and was given ${k(i)}`,n.at)}case"<":case"<=":case">":case">=":{if(o===null||i===null)return!1;if(!(typeof o=="number"&&typeof i=="number"||typeof o=="string"&&typeof i=="string"))throw new y(`cannot compare ${k(o)} with ${k(i)}`,n.at);let r=typeof o=="string"&&typeof i=="string"?ee(o,i):void 0;if(r){let[a,c]=r,h=a.to<c.from,b=a.from>c.to,m=a.from===c.from&&a.to===c.to;return n.op==="<"?h:n.op==="<="?h||m:n.op===">"?b:b||m}return n.op==="<"?o<i:n.op==="<="?o<=i:n.op===">"?o>i:o>=i}default:{if(o===null||i===null)return null;if(n.op==="+"&&(typeof o=="string"||typeof i=="string")){let p=`${O(o,n.at,"+")}${O(i,n.at,"+")}`;if(p.length>1e4)throw new y("that makes a word too long",n.at);return p}if(typeof o!="number"||typeof i!="number")throw new y(`"${n.op}" needs numbers, and was given ${k(o)} and ${k(i)}`,n.at);return(n.op==="/"||n.op==="%")&&i===0?null:n.op==="+"?o+i:n.op==="-"?o-i:n.op==="*"?o*i:n.op==="/"?o/i:o%i}}}function Zn(n,d){let o=(r,a=r)=>{if(n.args.length<r||n.args.length>a)throw new y(`${n.fn}(\u2026) takes ${r===a?r:`${r} to ${a}`} argument${a===1?"":"s"}`,n.at)},i=r=>A(n.args[r],d),p=r=>{let a=i(r);if(typeof a!="string")throw new y(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return a};switch(n.fn){case"out":case"in":{o(1,2);let r=(h,b)=>n.fn==="out"?t.graph.out(h,b):t.graph.in(h,b);if(n.args.length===2){let h=M(i(0),n.at,n.fn).nodes,b=p(1);return Vn(h.flatMap(m=>{let N=r(m.id,b);return l(N.length+1,n.at),N}))}let a=p(0);if(!d)throw new y(`${n.fn}('${a}') needs a record to start from`,n.at);let c=r(d.id,a);return l(c.length,n.at),new w(c)}case"all":{o(1,2);let r=t.graph.nodesOfKind(p(0),{archived:n.args.length===2?i(1):!1});return l(r.length,n.at),new w(r)}case"archived":return o(0,1),mn(n.args.length===1?i(0):d);case"count":return o(1),M(i(0),n.at,"count").nodes.length;case"exists":return o(1),M(i(0),n.at,"exists").nodes.length>0;case"every":case"some":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let a=c=>R(L(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(a):r.nodes.some(a)}case"sum":case"min":case"max":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let a=n.args[1],c=a.t==="lit"&&typeof a.value=="string"?a.value:void 0,h=a.t==="ident"?`'${a.name}'`:c!==void 0?`'${c}'`:"\u2026",b=r.nodes.map(m=>a.t==="ident"?I(m,a.name,n.at):c!==void 0?I(m,c,n.at):L(m,a)).filter(m=>{if(m===null)return!1;if(typeof m!="number")throw new y(`${n.fn}(\u2026, ${h}) needs a number for each member, and found ${k(m)}`,n.at);return!0});return n.fn==="sum"?b.reduce((m,N)=>m+N,0):b.length===0?null:n.fn==="min"?Math.min(...b):Math.max(...b)}case"fact":{o(1);let r=p(0),a=t.kinds.get(ne)?.computed?.get(r);if(!a)throw new y(`no fact is called "${r}"`,n.at);return rn(null,r,a,n.at)}case"first":return o(1),M(i(0),n.at,"first").nodes[0]??null;case"sort":{o(2,3);let r=M(i(0),n.at,"sort"),a=n.args.length===3?i(2):"asc";if(a!=="asc"&&a!=="desc")throw new y("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let h=r.nodes.map((m,N)=>({node:m,i:N,key:L(m,n.args[1])})),b=a==="desc"?-1:1;return h.sort((m,N)=>on(m.key,N.key,b,n.at)||m.i-N.i),new w(h.map(m=>m.node))}case"either":{if(n.args.length<1)throw new y("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let a=i(r);if(a!==null&&!(a instanceof w&&a.nodes.length===0))return a}return null}case"present":{o(1);let r=i(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof w?r.nodes.length>0:!0}case"len":{o(1);let r=i(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof w)return r.nodes.length;throw new y(`len(\u2026) needs a word or a list, and was given ${k(r)}`,n.at)}case"contains":case"startsWith":{o(2);let r=i(0),a=i(1);if(r===null||a===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(b=>F(b,a));let c=O(r,n.at,n.fn),h=O(a,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(h.toLowerCase()):c.startsWith(h)}case"lower":{o(1);let r=O(i(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"concat":{if(n.args.length<1)throw new y("concat(\u2026) takes at least one argument",n.at);let r="";for(let a=0;a<n.args.length;a++)r+=O(i(a),n.at,"concat")??"";if(r.length>1e4)throw new y("that makes a word too long",n.at);return r}case"format":{o(2);let r=V(i(0),n.at,"format"),a=i(1);if(typeof a!="string")throw new y("format(\u2026) says its pattern in quotes, like format(start, 'EEE h:mm a')",n.at);if(r===null)return null;let c=Mn(r,a,t.locale);if(typeof c!="string")throw new y(c.problem,n.at);return c}case"datetime":case"at":{o(2);let r=V(i(0),n.at,n.fn),a=i(1);if(a===null||r===null)return null;let c=typeof a=="string"?Rn(a):void 0;if(c===void 0)throw new y(`${n.fn}(\u2026) needs a time of day written like '09:30', and was given ${typeof a=="string"?`"${a}"`:k(a)}`,n.at);return En(r,c,g)}case"addMinutes":{o(2);let r=V(i(0),n.at,"addMinutes"),a=i(1);if(r===null||a===null)return null;if(typeof a!="number"||!Number.isFinite(a))throw new y(`addMinutes(\u2026) needs a number of minutes, and was given ${k(a)}`,n.at);return Tn(r,Math.round(a))}case"weekday":{o(1);let r=V(i(0),n.at,"weekday");return r===null?null:Fn(r)}case"startOfWeek":{o(1,2);let r=V(i(0),n.at,"startOfWeek"),a=n.args.length===2?i(1):"mon";if(!Dn(a))throw new y("startOfWeek(\u2026) starts the week on a day said 'mon' to 'sun'",n.at);return r===null?null:Gn(r,a)}case"today":return o(0),u;case"now":return o(0),f;case"date":{o(1);let r=v(i(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{o(2);let r=v(i(0),n.at,n.fn),a=v(i(1),n.at,n.fn);if(r===null||a===null)return null;let c=(a-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"round":{o(1,2);let r=i(0);if(r===null)return null;if(typeof r!="number")throw new y(`round(\u2026) needs a number, and was given ${k(r)}`,n.at);let a=n.args.length===2?i(1):0;if(typeof a!="number"||!Number.isInteger(a)||a<0||a>12)throw new y("round(\u2026, places) takes a whole number of places from 0 to 12",n.at);let c=10**a,h=Math.sign(r)*Math.round(Math.abs(r)*c*(1+Number.EPSILON))/c;return Object.is(h,-0)?0:h}case"if":return o(3),R(i(0),n.at,"the condition in if(\u2026)")?i(1):i(2);default:throw new y(`"${n.fn}" is not a function the rule language knows`,n.at)}}function on(n,d,o,i){if(n===null||d===null)return n===d?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(d)){for(let r=0;r<Math.max(n.length,d.length);r++){let a=on(n[r]??null,d[r]??null,o,i);if(a!==0)return a}return 0}let p=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:k(r);if(p(n)!==p(d)||typeof n=="object"||typeof d=="object")throw new y(`sort(\u2026) cannot put ${k(n)} and ${k(d)} in order`,i);return typeof n=="string"?o*(n<d?-1:n>d?1:0):o*(Number(n)-Number(d))}return A(e,t.subject)}var be=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived","round","concat","format","datetime","at","addMinutes","weekday","startOfWeek"];var te=(e,t,s,l,u)=>({severity:"error",code:e,path:t,message:s,...l?{fix:l}:{},...u}),xe=(e,t,s,l,u)=>({...te(e,t,s,l,u?.length?{edits:u}:void 0),severity:"warning"}),Se=e=>e.some(t=>t.severity==="error");function re(e,t){return[...(e.edits??[]).map(s=>`${t}edit: ${JSON.stringify(s)}`),...e.details?[`${t}details: ${e.details}`]:[],...(e.fixes??[]).flatMap(s=>[`${t}fix: ${s.label}`,...(s.edits??[]).map(l=>`${t} edit: ${JSON.stringify(l)}`)])].map(s=>`
2
- ${s}`).join("")}function Ae(e){return e.map(t=>`${t.severity==="error"?"\u2717":t.severity==="warning"?"!":"\xB7"} ${t.path||"(document)"}: ${t.message}${t.fix?` \u2014 ${t.fix}`:""}${re(t," ")}`).join(`
3
- `)}var oe=(e,t)=>e.to==="*"||e.to.includes(t);function Cn(e,t,s){let l=s(e);if(l){if(t.some(u=>l.from.includes(u)))return{step:{relation:e,out:!0},far:l.to};if(t.some(u=>oe(l,u)))return{step:{relation:e,out:!1},far:l.from}}}function Me(e,t,s,l){if(!l(t.every))return{problem:{key:"every",message:`"${t.every}" is not a kind this document declares`}};let u=Cn(t.through,[e],s);if(!u){let S=s(t.through);return{problem:{key:"through",message:S?`"${t.through}" is a relation of ${S.from.join(", ")}, not of ${e}, so a ${e} cannot be followed through it`:`"${t.through}" is not a relation any kind declares`,fix:S?`name a relation ${e} declares, or one that points at ${e}`:void 0}}}let f=u.far==="*"?"*":u.far;if(!t.via)return f==="*"||f.includes(t.every)?{plan:{every:t.every,through:u.step}}:{problem:{key:"through",message:`"${t.through}" reaches ${f.join(", ")}, not ${t.every}`,fix:`add "via": the relation from ${f.join(" or ")} to ${t.every}, or name a relation that reaches ${t.every}`}};let g=f==="*"?[t.every]:f,$=Cn(t.via,g,s);if(!$){let S=s(t.via);return{problem:{key:"via",message:S?`"${t.via}" is a relation of ${S.from.join(", ")}, which "${t.through}" does not reach`:`"${t.via}" is not a relation any kind declares`,fix:S?`name a relation of ${g.join(" or ")}, or one that points at it`:void 0}}}let x=f==="*"?[t.every]:$.far;return x==="*"||x.includes(t.every)?{plan:{every:t.every,through:u.step,via:f==="*"?{relation:$.step.relation,out:!$.step.out}:$.step}}:{problem:{key:"via",message:`"${t.via}" reaches ${x.join(", ")}, not ${t.every}`,fix:`name a relation that reaches ${t.every}`}}}var In=(e,t,s)=>s.out?e.out(t,s.relation):e.in(t,s.relation);function Re(e,t,s){let l=new Set;for(let u of In(e,t.id,s.through)){if(!s.via){l.add(u.id);continue}for(let f of In(e,u.id,s.via))l.add(f.id)}return e.nodesOfKind(s.every).filter(u=>!l.has(u.id))}var We=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],ie={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function _e(e,t,s,l=[],u,f=Z){return tn(e,t,s,l,u,f)}var Ln=(e,t)=>e.capital?J(t):t,ae=new Set(["words","plural","relative"]);function Ce(e,t){let s=e[0];return!s||s.text!==void 0||!s.format||!ae.has(s.format)?t:/^[a-z][a-z'’-]*(?=\s|$|[,.;:!?])/.test(t)?J(t):t}function se(e){return e?t=>{let s=e.tryDefinition(t.kind)?.label;return s?s(t):Z(t)}:Z}var jn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Pn=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function de(e,t){return!Number.isInteger(e)||e<0||e>99?q(e,t):e<20?jn[e]:e%10===0?Pn[e/10]:`${Pn[Math.floor(e/10)]}-${jn[e%10]}`}function le(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var Z=e=>String(e.name??e.title??e.label??e.id);function tn(e,t,s,l=[],u,f=Z){if(t==="plural"){let g=e instanceof w?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return g===null||l[0]===void 0?"\u2014":g===1?l[0]:l[1]??le(l[0])}if(e===null)return"\u2014";if(e instanceof w)return t==="count"?String(e.nodes.length):t==="and"?B(e.nodes.map(f)):e.nodes.map(f).join(", ");if(Array.isArray(e)){if(t==="count")return String(e.length);let g=e.map($=>tn($,void 0,s,[],u,f));return t==="and"?B(g):g.join(", ")}if(typeof e=="object")return f(e);switch(t){case"words":return typeof e=="number"?de(e,u?.locale):String(e);case"money":return typeof e=="number"?X(e,u,l[0]==="0"?0:void 0):String(e);case"percent":return typeof e=="number"?q(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return wn(String(e),Number(l[0])||void 0);case"date":return _(Y(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&W.test(e)?_(e,u?.locale):fn(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&W.test(e)?_(e,u?.locale):H(String(e),u?.locale,u?.timeZone);case"relative":{let g=Y(String(e),u?.timeZone),$=g===void 0?Date.parse(String(e)):Date.parse(`${g}T00:00:00Z`);if(Number.isNaN($))return String(e);let x=Math.round(($-Date.parse(`${s}T00:00:00Z`))/864e5);return x===0?"today":x===1?"tomorrow":x===-1?"yesterday":x>0?`in ${x} days`:`${-x} days ago`}default:return typeof e=="string"&&an.test(e)?_(e,u?.locale):typeof e=="string"&&D.test(e)?H(e,u?.locale,u?.timeZone):String(e)}}function ue(e,t,s){return(Array.isArray(e)?e:[e]).map(l=>t[String(l)]??(s?cn(String(l)):gn(String(l)))).join(", ")}function Ie(e,t){let s=t.today??j(),l=t.name??se(t.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let f=_n(u.expr,{graph:t.graph??ie,subject:t.node,kinds:t.kinds,today:s,budget:t.budget??500,...t.bindings?{bindings:t.bindings}:{}}),g=!u.format&&u.expr.t==="ident"&&t.node?t.kinds.get(t.node.kind)?.choices?.get(u.expr.name):void 0;return g&&(typeof f=="string"||Array.isArray(f))?Ln(u,ue(f,g,e.length===1)):Ln(u,tn(f,u.format,s,u.formatArgs,t.money,l))}catch(f){if(f instanceof y)return"\u2014";throw f}}).join("")}export{w as a,$e as b,ne as c,y as d,en as e,_n as f,be as g,te as h,xe as i,Se as j,Ae as k,We as l,ie as m,_e as n,Ln as o,Ce as p,se as q,ue as r,Ie as s,Me as t,Re as u};
@@ -1 +0,0 @@
1
- import{a as U,b as Y,c as G,d as D}from"./chunk.IEDCFSN5.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as ae,O as L,P as F,T as V,ca as _}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{W as H,cb as K,db as B,qd as M}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.sentOut!==void 0)).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
@@ -1 +0,0 @@
1
- import"./chunk.WVUJXDXZ.js";import{k as x}from"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.D5LOTCBU.js";import{fb as f,hb as N,la as S}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
@@ -1 +0,0 @@
1
- import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import{b as m}from"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{T as p}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{Z as l}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function A({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{A as StatesBar};
@@ -1 +0,0 @@
1
- import{a}from"./chunk.OXWOUE3W.js";import"./chunk.34DRUCH2.js";import"./chunk.KXFNRJ46.js";import"./chunk.OMRQTLI5.js";import"./chunk.MIE3ODQ2.js";import"./chunk.NEPQBMFT.js";import"./chunk.MBB5A6BT.js";import"./chunk.ERPILTRY.js";import"./chunk.H7AH3IW4.js";import{b as n}from"./chunk.DDFRFSVN.js";import"./chunk.U5P23GO7.js";import"./chunk.YOUB3J3Y.js";import"./chunk.GZHZLJBF.js";import"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{T as i}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
@@ -1 +0,0 @@
1
- import{b as x}from"./chunk.T535ZLRM.js";import"./chunk.ERPILTRY.js";import"./chunk.OTSBF367.js";import"./chunk.WVUJXDXZ.js";import"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.GZHZLJBF.js";import{o as R}from"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as A,T as v,ca as g}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{pd as k,ra as y,va as c}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as u}from"./chunk.AJZBJBMO.js";var f=u(A(),1);var L=u(A(),1),S=(0,L.createContext)(void 0);var i=u(v(),1),W=new WeakMap,m=new WeakMap,P=(e,n)=>`${n.kind}\0${n.id??""}\0${e}`;function b(e,n,a){let p=P(n,a),o=W.get(e);o||W.set(e,o=new Map);let t=o.get(p);return t||(t=Promise.resolve().then(()=>e(n,a)).then(r=>C(r)?r:null,()=>null).then(r=>{let s=m.get(e);return s||m.set(e,s=new Map),s.set(p,r),r}),o.set(p,t)),t}function C(e){if(e===null)return!0;if(typeof e!="object"||e===void 0)return!1;if(e.denied===!0)return!0;let n=e;return typeof n.name=="string"&&n.name.trim()!==""&&typeof n.href=="string"}function h(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}}var N=e=>h(e)??(c(e)?e:void 0),E=e=>h(e)??(e.startsWith("/")&&c(e)?e:void 0),I={kind:"human"},w={color:"var(--graview-ink-muted)"};function M({icon:e}){if(!e)return null;let n=E(e);if(n)return(0,i.jsx)("img",{src:n,alt:"",width:20,height:20,"data-graview-app-icon":"",style:{width:20,height:20,borderRadius:5,objectFit:"cover",flex:"0 0 auto"}});let a=[...e.trim()].slice(0,2).join("");return a?(0,i.jsx)("span",{"aria-hidden":"true","data-graview-app-icon":"",style:{flex:"0 0 auto",lineHeight:"20px"},children:a}):null}function V(e){let n=g(),a=(0,f.useContext)(S)??n?.resolveApp,p=n?.principal??I,o=()=>a?m.get(a)?.get(P(e,p))??"asking":null,[t,r]=(0,f.useState)(o);return(0,f.useEffect)(()=>{let s=o();if(r(s),s!=="asking"||!a)return;let l=!0;return b(a,e,p).then(d=>l&&r(d)),()=>{l=!1}},[a,e,p.kind,p.id]),t}function D({address:e,as:n="chip",nodeId:a,field:p,style:o}){let t=V(e),r={position:"relative",zIndex:k.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%",...o},s;if(t==="asking")s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"asking","aria-busy":"true",style:{...w,...r},children:"Linked app"});else if(t&&"denied"in t)s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"denied",style:{...w,fontStyle:"italic",...r},children:"linked app (no access)"});else if(t){let l=N(t.href),d=n==="record"?t.headline?.trim():void 0;s=(0,i.jsxs)(l?"a":"span",{"data-graview-app-link":"","data-graview-app-state":"found",...l?{href:l}:{},...!d&&t.headline?{title:t.headline}:{},style:{display:"inline-flex",alignItems:d?"flex-start":"center",minHeight:24,gap:8,color:"inherit",textUnderlineOffset:3,...r},children:[(0,i.jsx)(M,{icon:t.icon}),(0,i.jsxs)("span",{style:{display:"grid",minWidth:0},children:[(0,i.jsx)("span",{"data-graview-app-name":"",style:{fontWeight:600},children:t.name}),d?(0,i.jsx)("span",{"data-graview-app-headline":"",style:{...w,fontSize:"0.8125em",fontWeight:400},children:d}):null]})]})}else{let l=h(e);s=l?(0,i.jsx)("a",{"data-graview-app-link":"","data-graview-app-state":"plain",href:l,rel:"noopener noreferrer",target:"_blank",style:{color:"var(--graview-accent)",display:"inline-flex",alignItems:"center",minHeight:24,...r},children:e}):(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"plain",style:r,children:e})}return a&&p?(0,i.jsx)(H,{nodeId:a,field:p,address:e,drawn:s}):s}function H({nodeId:e,field:n,address:a,drawn:p}){let o=R(e).fields.some(s=>s.field===n),t=g()?.store;if(!o)return p;let r=y(t?t.schema.tryDefinition(String(t.graph.getNode(e)?.kind)):void 0,n).toLowerCase();return(0,i.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px",maxWidth:"100%",minWidth:0},children:[p,(0,i.jsx)("span",{style:{fontSize:"0.8125rem"},children:(0,i.jsx)(x,{nodeId:e,field:n,value:"Change",stored:a,said:`Change the ${r}`})})]})}var Y=e=>(0,i.jsx)(D,{...e});export{D as AppLink,Y as drawAppLink};
@@ -1 +0,0 @@
1
- import{a as C,e as L,n as H,o as R,p as k}from"./chunk.ZLTHWCKL.js";import"./chunk.BJUUSIQY.js";import"./chunk.57YDGGJK.js";import"./chunk.H7AH3IW4.js";import"./chunk.VCTAFSZ5.js";import"./chunk.XOZU4OFA.js";import"./chunk.4TH3CGAZ.js";import{a as S}from"./chunk.YOUB3J3Y.js";import"./chunk.DZSZUX34.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as T,Sa as E,T as b}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{qd as x}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function V({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{V as HoverChip};
@@ -1,74 +0,0 @@
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 mr}from"./chunk.CGK2PY76.js";import{G as R,Ia as O,Ma as bn,Na as kn,Oa as xn,Ra as j,T as P,Va as Y,a as Ne,ba as fe,ca as J,e as Te,l as gn,m as mn,na as hn,s as yn,v as oe,va as vn,z as wn}from"./chunk.CYTTZOYL.js";import{a as C}from"./chunk.SDO3U72B.js";import{Pc as Xe,Pd as ue,Qd as ae,Rd as an,Td as Ee,Vd as on,Wc as $,Wd as sn,Xc as en,Xd as Z,Yc as nn,_c as rn,ad as tn,ce as ln,db as Ze,de as dn,ee as cn,fe as pn,he as un,ie as Ae,la as Ye,me as fn,pa as Ue,qa as Qe,vb as Je}from"./chunk.Q4MI53KK.js";import{b as v}from"./chunk.AJZBJBMO.js";var He=v(R(),1),Sn=new WeakMap,ge=e=>{let n=Sn.get(e);return n||Sn.set(e,n={open:null,drawn:0,listeners:new Set}),n},yr=e=>{for(let n of[...e.listeners])n()},wr=0;function Mt(e,n){let t=ge(e);t.open=n?{...n,at:++wr}:null,yr(t)}var Pn=e=>n=>{let t=ge(e);return t.listeners.add(n),()=>void t.listeners.delete(n)};function Ln(e){let n=()=>e?ge(e).drawn>0:!1;return(0,He.useSyncExternalStore)(e?Pn(e):hr,n,n)}var hr=()=>()=>{};function Ct(e){let n=()=>ge(e).open;return(0,He.useSyncExternalStore)(Pn(e),n,n)}var V=v(R(),1),En=v(mr(),1);function vr(e){let[n,t]=(0,V.useState)(null),[r,o]=(0,V.useState)(null);return(0,V.useLayoutEffect)(()=>{e.current!==r&&o(e.current)}),(0,V.useLayoutEffect)(()=>{if(!r||typeof ResizeObserver>"u")return;let a=()=>Math.round(r.getBoundingClientRect().width),i=a();t(i);let p=new ResizeObserver(()=>{let c=a();c!==i&&(i=c,(0,En.flushSync)(()=>t(c)))});return p.observe(r),()=>p.disconnect()},[r]),n}function br(e=!0){let[n,t]=(0,V.useState)();return(0,V.useEffect)(()=>{if(!e)return t(void 0);let r=0,o=()=>t(innerHeight),a=()=>{o(),clearTimeout(r),r=window.setTimeout(o,300)},i=p=>{for(let[c,d]of[[window,"resize"],[window,"orientationchange"],[window.visualViewport,"resize"]])c?.[p](d,a)};return i("addEventListener"),o(),()=>{clearTimeout(r),i("removeEventListener")}},[e]),n}var me={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap"};var A=v(R(),1);var H=v(P(),1),An=6e3;function kr(e){return{...e,notify:n=>e.notify({...n,from:"framework"})}}var xr=e=>({place:"overview",...e&&!/^(aggregate|kind):/.test(e)?{record:e}:{}});function Sr(){let e=[],n=0,t=new Set,r=new Map,o,a=()=>{for(let d of[...t])d()},i=d=>{if(clearTimeout(r.get(d.id)),r.delete(d.id),d.kind!=="toast")return;let u=(d.actions?.length??0)+(d.action?1:0),l=d.timeout??(u>0?!1:An);l!==!1&&r.set(d.id,setTimeout(()=>o?.()?i(d):p(d.id),l))},p=d=>{clearTimeout(r.get(d)),r.delete(d),e.some(u=>u.id===d)&&(e=e.filter(u=>u.id!==d),a())},c=d=>{e=e.some(u=>u.id===d.id)?e.map(u=>u.id===d.id?d:u):[...e,d],i(d),a()};return{notify(d){let u=d.id??`notice-${++n}`;return c({...d,id:u,said:++n}),{id:u,dismiss:()=>p(u),update:l=>{let m=e.find(w=>w.id===u);m&&c({...m,...l,id:u,kind:m.kind,said:l.sentence!==void 0&&l.sentence!==m.sentence?++n:m.said})}}},dismiss:p,hold(d){o=d},list:()=>e,subscribe(d){return t.add(d),()=>t.delete(d)}}}function Pr({notices:e}){let n=e.reduce((p,c)=>!p||c.said>p.said?c:p,void 0),[t,r]=(0,A.useState)(""),[o,a]=(0,A.useState)(""),i=(0,A.useRef)(0);return(0,A.useEffect)(()=>{if(!n||n.said===i.current)return;i.current=n.said;let p=n.tone==="bad";(p?a:r)("");let c=setTimeout(()=>(p?a:r)(n.sentence),50);return()=>clearTimeout(c)},[n]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:me,children:t}),(0,H.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:me,children:o})]})}var Lr=(0,A.createContext)(null);function Er({board:e,anchor:n,report:t}){let r=(0,A.useSyncExternalStore)(e.subscribe,e.list,e.list);return(0,A.useEffect)(()=>Tr(Be.prefetch),[]),(0,H.jsxs)(H.Fragment,{children:[r.length>0?(0,H.jsx)(A.Suspense,{fallback:null,children:(0,H.jsx)(Nr,{notices:r,anchor:n,board:e,...t?{report:t}:{}})}):null,(0,H.jsx)(Pr,{notices:r})]})}var Be=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.MB7LKKUD.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2F4AZZQR.js")))),Ar=()=>Be.load().then(()=>{},()=>{}),Nr=Be.part((e,n)=>(0,H.jsx)(e.NoticeStacks,{...n}),{quiet:!0});function Tr(e){let n=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(n,{timeout:5e3});return()=>t.cancelIdleCallback?.(o)}let r=setTimeout(n,2500);return()=>clearTimeout(r)}var M=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.OXWOUE3W.js","./chunk.ZZAI57VI.js","./chunk.34DRUCH2.js","./chunk.KXFNRJ46.js","./chunk.OMRQTLI5.js","./chunk.MIE3ODQ2.js","./chunk.NEPQBMFT.js","./chunk.2PJ6STKA.js","./chunk.MBB5A6BT.js","./chunk.ERPILTRY.js","./chunk.H7AH3IW4.js","./chunk.U5P23GO7.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.N3T2O6EW.js"))));var y=v(R(),1);var Hn=v(R(),1);var Nn=v(R(),1);function ie(e){return(0,Nn.useMemo)(()=>e===void 0||e===""?void 0:{__html:e},[e])}var _=v(P(),1);function Me({brand:e,size:n=22}){let t=rn(e),r=Tn(t?.light),o=r?Tn(t?.dark):void 0,a=ie(r!==void 0&&$(r)?r:void 0),i=ie(o!==void 0&&$(o)?o:void 0),p={display:"inline-flex",flex:"0 0 auto",height:n,color:"var(--graview-accent)"},c=tn(e);if(c)return(0,_.jsx)("span",{className:"graview-logo graview-emoji-mark","data-testid":"app-mark","aria-hidden":!0,style:{...p,alignItems:"center",fontSize:`${n*.86/16}rem`,lineHeight:1},children:c});if(!r)return null;let d=e?.logoAlt??e?.name??"",u=d!==""&&d!==e?.name,l=u?{role:"img","aria-label":d}:{"aria-hidden":!0};if(o){let w=(h,S,b)=>$(h)?(0,_.jsx)("span",{className:"graview-logo-face","data-graview-scheme-only":b,dangerouslySetInnerHTML:S}):(0,_.jsx)("img",{className:"graview-logo-face","data-graview-scheme-only":b,src:h,alt:""});return(0,_.jsxs)("span",{className:"graview-logo","data-testid":"app-mark",style:p,...l,children:[w(r,a,"light"),w(o,i,"dark")]})}let m=t?.darkFallback==="invert"?{"data-graview-logo-fallback":"invert"}:{};return $(r)?(0,_.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:p,...m,...l,dangerouslySetInnerHTML:a}):(0,_.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:r,alt:u?d:"",...m,style:{...p,width:"auto"}})}function Tn(e){if(!(!e||!nn(e)))return $(e)&&en(e)!==null?void 0:e}function Hr(e){(0,Hn.useEffect)(()=>{if(!e||typeof document>"u")return;let n=[...document.querySelectorAll('link[rel~="icon"]')],t=n.map(o=>o.getAttribute("href")),r;n.length===0&&(r=document.createElement("link"),r.rel="icon",r.setAttribute("data-graview-favicon",""),document.head.appendChild(r),n.push(r));for(let o of n)o.href=e;return()=>{r&&r.remove(),n.forEach((o,a)=>{o!==r&&t[a]!==null&&t[a]!==void 0&&o.setAttribute("href",t[a])})}},[e])}var s=v(P(),1),Br=M.part((e,n)=>(0,s.jsx)(e.TidyFoot,{...n}),{quiet:!0}),Mr=M.part((e,n)=>(0,s.jsx)(e.Here,{...n}),{quiet:!0});function Cr(){let e=J(),[n,t]=(0,y.useState)("");return(0,y.useEffect)(()=>e?.store.subscribe((r,o)=>{o.some(a=>a.author.id!==e.principal.id)&&M.load().then(a=>a.sayTheirChange(o,e,t),String)}),[e]),(0,s.jsx)("span",{role:"status",className:"graview-bar-said",children:n})}var Bn="home",Mn="/",U="scene:whole";function Rr(e){let{store:n,principal:t,views:r}=e,o=n.kindsKeptFrom(t),a=n.schema.kinds.filter(f=>!n.modules.disabledKinds.has(f)&&!o.has(f)),i=r?.arrangement?.(),p=r?.places()??[],c=pn(i,n.schema,p),d=cn(n.schema,i,[...n.modules.administered.values()].flatMap(f=>f.kinds??[])),u=(f,x)=>(!n.graph.size.nodes||n.graph.count(f)>0)&&(c?x?c.places.has(`${f}|${x}`):c.kinds.has(f):!d.has(f)),l=[{key:Bn,label:"Home",path:Mn,group:"home",primary:!0}],m=p.filter(f=>a.includes(f.kind)&&f.as!==un),w=m.filter(f=>!f.hidden),h=new Set(ae(w).map(f=>Z(f,p,n.schema).toLowerCase())),S=f=>on(f.as,sn(f,p)?Ee(n.schema,f.kind).slice(1):void 0),b=new Set(i?.hide??[]),L=fn(a,i?.order,w);for(let{kind:f,view:x}of L){if(x){l.push({key:`place:${x.kind}:${x.as}`,label:Z(x,p,n.schema),path:S(x),group:"lists",kind:f,primary:c?c.places.has(`${f}|${x.as}`):!0});continue}let Q=Ue(n.schema,f),T=h.has(Q.toLowerCase());l.push({key:`kind:${f}`,label:T?Qe(n.schema,f):Q,path:Ee(n.schema,f),group:"lists",kind:f,primary:T||b.has(f)?!1:u(f),...b.has(f)?{hidden:!0}:{}})}for(let f of ae(m)){if(L.some(T=>T.view&&ue(T.view,f)))continue;let x=S(f),Q=[f.kind,...f.over??[]].some(T=>a.includes(T)&&u(T,f.as));l.some(T=>T.path===x)||l.push({key:`place:${f.kind}:${f.as}`,label:Z(f,p,n.schema),path:x,group:"pictures",kind:f.kind,primary:Q,hidden:f.hidden})}return a.some(f=>Object.keys(n.schema.tryDefinition(f)?.edges??{}).length>0)&&l.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),l}function Or(e,n){let[t="/",r=""]=n.split("?"),o=e.find(i=>i.path===(r?`${t}?${r}`:t))??e.find(i=>i.path===t);if(o)return o.key;let a=`/${t.split("/").filter(Boolean)[0]??""}`;return e.find(i=>i.group==="lists"&&i.path===a)?.key??null}var Cn=(0,y.createContext)(null),Fr=()=>(0,y.useContext)(Cn),W=30,Rn=48,X=640,Re=4,Ce=2;function On(e){let{widths:n,current:t,room:r,more:o,gap:a=Re,primary:i,most:p=dn}=e;if(n.length===0||!(r>0)||!(o>0)||n.some(l=>!(l>0)))return null;let c=(l,m)=>l.reduce((w,h)=>w+n[h],0)+a*Math.max(0,l.length-1)+(m?a+o:0),d=(l,m)=>t<0||!l.includes(t)||l.slice(0,m).includes(t)?l.slice(0,m):[...l.filter(w=>w!==t).slice(0,m-1),t].sort((w,h)=>w-h),u=d(n.map((l,m)=>m).filter(l=>i?.[l]!==!1||l===t),p);if(c(u,u.length<n.length)<=r)return u.length>=Ce?u:null;for(let l=u.length-1;l>=Ce;l--){let m=d(u,l);if(c(m,!0)<=r)return m}return null}var Vr=`
2
- .graview-bar{display:block;margin:0;padding:0;container:graview-bar/inline-size;flex:0 0 auto;position:relative;background:var(--graview-bar);border-bottom:1px solid var(--graview-edge);color:var(--graview-ink);font-family:var(--graview-font-body,system-ui)}
3
- .graview-bar-row{display:flex;flex-wrap:nowrap;align-items:center;gap:16px;height:${Rn-1}px;margin:0;padding:0 16px}
4
- .graview-bar-home,.graview-bar-face,.graview-bar-place,.graview-bar-item,.graview-bar-at{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;margin:0;border:0;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-decoration:none;color:var(--graview-ink);cursor:pointer;text-align:left}
5
- .graview-bar-app{display:flex;flex:0 1 auto;max-width:50%}
6
- .graview-bar-app::after{content:"";flex:0 100000 auto;width:2px;min-width:0}
7
- .graview-bar-name{margin:0;display:flex;font-family:var(--graview-font-display,var(--graview-font-body,system-ui));font-size:.9375rem;font-weight:600;line-height:1.25}
8
- .graview-bar-home{gap:8px;min-width:auto;min-height:30px;padding:0;letter-spacing:-.005em}
9
- .graview-bar-app-name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}
10
- .graview-bar-faces{display:inline-flex;flex:0 0 auto;box-sizing:border-box;height:30px;margin:0;padding:2px;gap:2px;border:1px solid var(--graview-edge);border-radius:8px}
11
- .graview-bar-face{gap:6px;padding:0 10px;border-radius:6px;font-size:.8125rem;white-space:nowrap;color:var(--graview-ink-muted)}
12
- .graview-bar-face span{min-width:0;max-width:11em;overflow:hidden;text-overflow:ellipsis}
13
- .graview-bar-face[aria-pressed=true]{color:var(--graview-ink);font-weight:600;background:color-mix(in srgb,var(--graview-accent) 16%,transparent)}
14
- [data-switch-drawn=icons] .graview-bar-face{padding:0 8px}
15
- .graview-bar-said,[data-switch-drawn=icons] .graview-bar-face span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
16
- .graview-bar-mid{display:flex;flex:1 100 0;min-width:0}
17
- .graview-bar-mid[data-place]{min-width:9em;flex-basis:auto}
18
- .graview-bar-place-at{position:relative;display:inline-flex;min-width:0;max-width:100%}
19
- .graview-bar-place{gap:6px;height:30px;max-width:100%;padding:0 8px;border:1px solid transparent;border-radius:8px;font-size:.875rem;font-weight:600}
20
- .graview-bar-face:hover,.graview-bar-place:hover{border-color:var(--graview-edge);color:var(--graview-ink)}
21
- .graview-bar-place-words{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
22
- .graview-bar-mid[data-places=standing]{flex:0 0 auto}
23
- .graview-bar-places{display:flex;align-items:center;gap:${Re}px;min-width:0;margin:0;padding:0}
24
- .graview-bar-at{gap:6px;flex:0 0 auto;height:30px;padding:0 8px;border-block:2px solid transparent;border-radius:0;font-size:.875rem;font-weight:500;white-space:nowrap;color:var(--graview-ink-muted)}
25
- .graview-bar-at:is(:hover,[aria-current],[aria-expanded=true]){color:var(--graview-ink)}
26
- .graview-bar-at[aria-current]{font-weight:600;border-bottom-color:var(--graview-accent)}
27
- .graview-bar-ruler{position:absolute;left:0;top:0;display:flex;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none}
28
- .graview-bar-ruler .graview-bar-at{font-weight:600}
29
- .graview-bar-ruler>.graview-bar-name{flex:none;white-space:nowrap;letter-spacing:-.005em}
30
- .graview-bar-list{display:grid;align-content:start;width:min(320px,calc(100vw - 24px));height:auto;max-height:min(70vh,560px);overflow:auto;margin:0;padding:6px;border-radius:10px;border:1px solid var(--graview-edge);background:var(--graview-float);box-shadow:var(--graview-lift-high);color:var(--graview-ink)}
31
- .graview-bar-list[hidden]{display:none}
32
- .graview-bar-list p{margin:8px 8px 2px;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--graview-ink-muted)}
33
- .graview-bar-list ul,.graview-bar-list li{display:grid;margin:0;padding:0;list-style:none}
34
- .graview-bar-item{align-items:flex-start;gap:10px;width:100%;padding:7px 8px;border-radius:7px;font-size:.875rem;line-height:1.3;overflow-wrap:anywhere}
35
- .graview-bar-item:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
36
- .graview-bar-item[aria-current]{font-weight:600;background:color-mix(in srgb,var(--graview-accent) 14%,transparent)}
37
- .graview-bar-mark{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:14px;height:1.3em;color:var(--graview-ink-muted)}
38
- .graview-bar :focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}
39
- .graview-bar-tools{display:contents}
40
- .graview-bar-tools>*{margin-left:-8px}
41
- .graview-bar-tools>:is(.graview-bar-find,.graview-bar-find-open){margin-left:auto}
42
- .graview-bar-own{display:flex;align-items:center;flex:0 0 auto}
43
- .graview-bar-own:empty{display:none}
44
- .graview-bar-host{display:flex;align-items:center;gap:2px;flex:0 0 auto}
45
- .graview-bar-host-action{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-width:${W}px;height:${W}px;margin:0;padding:0 10px;border-radius:8px;border:1px solid transparent;background:none;box-shadow:none;font:inherit;font-size:.875rem;font-weight:500;letter-spacing:normal;text-transform:none;white-space:nowrap;color:var(--graview-ink-muted);cursor:pointer}
46
- .graview-bar-host-action:is(:hover,[aria-expanded=true]){border-color:var(--graview-edge);color:var(--graview-ink)}
47
- .graview-bar-host-action[data-folded]{padding:0}
48
- .graview-bar-host-mark{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:16px;height:16px;font-size:.9375rem;line-height:1}
49
- .graview-bar-host-mark svg{width:16px;height:16px}
50
- .graview-bar-list .graview-bar-host-action{width:100%;justify-content:flex-start;white-space:normal;overflow-wrap:anywhere}
51
- .graview-bar-find{position:relative;display:flex;min-width:7.5rem;flex:0 600 9rem;--graview-bar-find-end:3.25em}
52
- .graview-bar-find-slot{display:flex;flex:1;min-width:0}
53
- .graview-bar-find-keys{position:absolute;right:10px;line-height:30px;pointer-events:none;font-size:.75rem;color:var(--graview-ink-faint)}
54
- .graview-bar-find:is(:focus-within,:has(input:not(:placeholder-shown))){flex-basis:16rem;--graview-bar-find-end:10px}
55
- :is(:focus-within,:has(input:not(:placeholder-shown)))>.graview-bar-find-keys,.graview-bar-find-open{display:none}
56
- .graview-bar-line{display:flex;flex:0 0 auto;padding:6px 8px;background:var(--graview-ground);border-bottom:1px solid var(--graview-edge);font-family:var(--graview-font-body,system-ui)}
57
- .graview-bar-line .graview-bar-place{height:auto;min-height:32px}
58
- .graview-bar-line .graview-bar-place-words{white-space:normal}
59
- @media (pointer:coarse){.graview-bar-find-keys{display:none}}
60
- @container graview-bar (max-width: ${X-1}px){
61
- .graview-bar-row{gap:10px;padding:0 12px}
62
- .graview-bar-app,.graview-bar-home{max-width:none;flex:1 1 auto;min-width:28px}
63
- .graview-bar-name,.graview-bar-app-name{min-width:0}
64
- .graview-bar-mid,.graview-bar-find{display:none}
65
- .graview-bar-find-open{display:inline-flex}
66
- .graview-bar-own{--graview-activity-mark:inline}
67
- .graview-bar-own .graview-activity-word{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
68
- .graview-bar[data-finding] :is(.graview-bar-app,.graview-bar-faces,.graview-bar-find-open){display:none}
69
- .graview-bar[data-finding] .graview-bar-find{display:flex;flex:1 1 auto;min-width:0}
70
- }
71
- @container graview-bar (max-width: 300px){
72
- .graview-bar-row{gap:4px;padding:0 10px}
73
- }`,ee={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:W,height:W,padding:0,borderRadius:8,border:"1px solid transparent",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.875rem",cursor:"pointer",flex:"0 0 auto"};function Dr({brand:e,name:n,heading:t=1,home:r,faces:o,places:a,current:i,reach:p,tools:c,find:d=!0,description:u,findBox:l,onFind:m,switch:w="words",scenePlaces:h,skips:S,named:b=!0,actions:L}){let se=(0,y.useRef)(null),f=J()?.who.size,[x,Q]=(0,y.useState)(null),[T,Xn]=(0,y.useState)(null),[E,er]=(0,y.useState)(!1),[nr,$e]=(0,y.useState)(!1),[rr,tr]=(0,y.useState)(!0),[_e,ar]=(0,y.useState)(null),[or,ir]=(0,y.useState)(!0),le=o?o.pages.current:!h,te=le?{places:a,current:i,reach:p}:h,xe=te&&{...te,places:an(te.places),here:te.places.find(g=>g.key===te.current)?.label},k=xe&&xe.places.length>0?xe:null,Se=k?k.places.findIndex(g=>g.key===k.current):-1,We=!!o&&w==="words",Ke=k?k.places.map(g=>g.primary===!1?"0":"1").join(""):"",I=(0,y.useCallback)(()=>{let g=se.current;if(!g)return;let B=Zr(g,Se,We,Ke);B!==void 0&&ar(B);let z=B?!0:$r(g);z!==null&&tr(z)},[Se,We,Ke]);(0,y.useLayoutEffect)(()=>{let g=se.current;if(!g)return;let B=()=>{let G=g.getBoundingClientRect().width;er(G<X);let gr=g.querySelector("[data-graview-bar-host-ruler]");ir(G>=X+(gr?.getBoundingClientRect().width??0)),g.style.setProperty("--graview-bar-width",`${Math.round(G)}px`),I()};B();let z=typeof document>"u"?void 0:document.fonts;if(z?.ready.then(I),z?.addEventListener?.("loadingdone",I),typeof ResizeObserver>"u")return()=>z?.removeEventListener?.("loadingdone",I);let pe=new ResizeObserver(B);pe.observe(g);for(let G of g.querySelectorAll(".graview-bar-tools > *"))pe.observe(G);let Le=g.querySelector(".graview-bar-tools"),je=typeof MutationObserver>"u"||!Le?null:new MutationObserver(()=>{for(let G of Le.children)pe.observe(G)});return je?.observe(Le,{childList:!0}),()=>{je?.disconnect(),pe.disconnect(),z?.removeEventListener?.("loadingdone",I)}},[I]);let Pe=(0,y.useRef)(m);Pe.current=m,(0,y.useLayoutEffect)(()=>{Pe.current?.(d&&x?{slot:x,compact:E,own:T}:null)},[d,x,E,T]),(0,y.useLayoutEffect)(()=>()=>Pe.current?.(null),[]);let sr=(0,y.useCallback)(()=>{$e(!0),requestAnimationFrame(()=>x?.querySelector("input")?.focus())},[x]),qe=(0,y.useRef)(null),de=(0,y.useRef)(!1),ze=(0,y.useCallback)(()=>{$e(!1),de.current&&(de.current=!1,requestAnimationFrame(()=>qe.current?.focus()))},[]),lr=t===!1?"span":`h${t}`,dr=r.href!==void 0?"a":"button",cr=g=>B=>{!g||!Dn(B)||(B.preventDefault(),g())},pr=!le,Ge=k&&!E&&_e!==null&&!(Se<0&&k.here)?_e.split(",").map(Number).filter(g=>g<k.places.length):null,ce=k?(0,s.jsx)(Ur,{places:k.places,current:k.current,here:k.here,reach:k.reach,scene:pr,stands:Ge}):null,ur=k?k.places.map(g=>g.label).join(`
74
- `):"";(0,y.useLayoutEffect)(I,[I,n,e,ur,k?.current,le,E,w,d]);let fr=w==="icons"||!rr||E?"icons":"words";return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("header",{ref:se,className:"graview-bar","data-testid":"app-bar","data-graview-app-bar":"",...nr&&E?{"data-finding":""}:{},children:[(0,s.jsx)("style",{children:Vr}),S,(0,s.jsxs)("div",{className:"graview-bar-row",children:[b?(0,s.jsx)("div",{className:"graview-bar-app",children:(0,s.jsx)(lr,{className:"graview-bar-name",children:(0,s.jsxs)(dr,{...r.href!==void 0?{href:r.href,onClick:cr(r.go)}:{type:"button",onClick:r.go},"data-testid":"app-home",...r.current?{"aria-current":"page"}:{},title:u?`${n} \u2014 ${u}`:`${n} \u2014 home`,className:"graview-bar-home",children:[(0,s.jsx)(Me,{brand:e,size:20}),(0,s.jsx)("span",{className:"graview-bar-app-name","data-testid":"app-name",children:n})]})})}):null,o?(0,s.jsx)(Ir,{faces:o,form:w,drawn:fr}):null,(0,s.jsx)("div",{className:"graview-bar-mid",...Ge?{"data-places":"standing"}:!E&&ce?{"data-place":""}:{},children:E?null:ce}),!E&&k&&k.places.length>1?(0,s.jsxs)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-ruler":"",children:[k.places.map(g=>(0,s.jsx)("span",{className:"graview-bar-at",children:g.label},g.key)),(0,s.jsxs)("span",{className:"graview-bar-at",children:[ye,(0,s.jsx)($n,{})]})]}):null,L&&L.length>0?(0,s.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-host-ruler":"",children:(0,s.jsx)("span",{className:"graview-bar-host",children:L.map(g=>(0,s.jsxs)("span",{className:"graview-bar-host-action",children:[g.icon?(0,s.jsx)(_n,{icon:g.icon}):null,(0,s.jsx)("span",{children:g.label})]},g.label))})}):null,b?(0,s.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true",children:(0,s.jsx)("span",{className:"graview-bar-name",children:n})}):null,(0,s.jsxs)("div",{className:"graview-bar-tools",children:[d?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"graview-bar-find-open",ref:qe,"data-testid":"app-find-open","aria-label":"Find",title:"Find",onClick:sr,style:{...ee,display:void 0},children:(0,s.jsx)(qr,{})}),(0,s.jsxs)("div",{className:"graview-bar-find","data-testid":"app-find",onBlur:g=>{let B=g.relatedTarget;B instanceof Node&&g.currentTarget.contains(B)||g.currentTarget.querySelector("input")?.value||ze()},onKeyDownCapture:g=>{g.key==="Escape"&&E&&(de.current=!0)},onKeyDown:g=>{g.key!=="Escape"||!E||(!g.defaultPrevented||!g.currentTarget.querySelector("input")?.value?ze():de.current=!1)},children:[(0,s.jsx)("div",{ref:Q,className:"graview-bar-find-slot",children:l}),(0,s.jsx)(Wr,{})]})]}):null,(0,s.jsx)("div",{ref:Xn,className:"graview-bar-own","data-graview-bar-own":""}),f?(0,s.jsx)(y.Suspense,{fallback:null,children:(0,s.jsx)(Mr,{scene:!le,compact:E})}):null,(0,s.jsx)(Cr,{}),L&&L.length>0?(0,s.jsx)(jr,{actions:L,folded:E||!or}):null,c]})]})]}),E&&ce?(0,s.jsx)("div",{className:"graview-bar-line","data-graview-place-line":"","data-testid":"app-place-line",children:ce}):null]})}function Ir({faces:e,form:n,drawn:t}){let r=o=>{let a=e[o];return(0,s.jsxs)("button",{type:"button",className:"graview-bar-face","data-testid":`app-face-${o}`,"aria-pressed":a.current,title:a.label,...a.reach&&!a.current?{onPointerEnter:a.reach,onPointerDown:a.reach,onFocus:a.reach}:{},onClick:()=>{a.current||a.go()},children:[o==="scene"?(0,s.jsx)(In,{}):(0,s.jsx)(Kr,{}),(0,s.jsx)("span",{children:a.label})]})};return(0,s.jsxs)("div",{className:"graview-bar-faces",role:"group","aria-label":`${e.scene.label} or ${e.pages.label}`,"data-testid":"app-faces","data-switch":n,"data-switch-drawn":t,children:[r("scene"),r("pages")]})}function $r(e){let n=e.querySelector(".graview-bar-faces"),t=e.querySelector(".graview-bar-mid"),r=e.querySelector(".graview-bar-find");if(!n||!t||r?.matches(":focus-within")||e.getBoundingClientRect().width<X)return null;let a=Kn(n),i=t.querySelector(".graview-bar-place-words"),p=i?parseFloat(getComputedStyle(i).fontSize)||14:0,c=i?Math.min(i.scrollWidth+34,14*p):0,d=Vn(e);if(d===null)return!1;let u=t.getBoundingClientRect().width-c-d-Fn(e);if(r&&r.getBoundingClientRect().width>0){let l=parseFloat(getComputedStyle(r).flexBasis);isFinite(l)&&(u-=Math.max(0,l-r.getBoundingClientRect().width))}return n.getAttribute("data-switch-drawn")==="icons"?u>=a+2:u>=-1}function Fn(e){let n=e.querySelector(".graview-bar-row"),t=e.getBoundingClientRect();if(!n||!(t.width>0))return 0;let r=t.right-(parseFloat(getComputedStyle(n).paddingRight)||0),o=r;for(let a of n.querySelectorAll(":scope > *, .graview-bar-tools > *")){if(a.classList.contains("graview-bar-tools")||a.classList.contains("graview-bar-ruler")||a.classList.contains("graview-bar-said"))continue;let i=a.getBoundingClientRect();i.width>0&&(o=Math.max(o,i.right))}return Math.max(0,o-r)}function Vn(e){let n=e.querySelector(".graview-bar-app"),t=e.querySelector(".graview-bar-ruler>.graview-bar-name");if(!n||!t)return 0;let r=i=>i?.getBoundingClientRect().width??0,o=r(n.firstElementChild)-r(e.querySelector(".graview-bar-app-name"))+r(t)+2,a=parseFloat(getComputedStyle(n).maxWidth)/100*(n.parentElement.clientWidth-2*n.offsetLeft)||1/0;return o>a+.5?null:Math.max(0,o-r(n))}var Dn=e=>e.button===0&&!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey);function _r(){let e=globalThis.navigator?.platform??"";return/Mac|iPhone|iPad|iPod/.test(e)?"\u2318K":"Ctrl K"}function Wr(){let e=Ln(J()?.aiDesk);return(0,s.jsx)("span",{className:"graview-bar-find-keys","data-testid":"app-find-keys","aria-hidden":"true",children:e?"/":_r()})}function ne({size:e,box:n=e,children:t}){return(0,s.jsx)("svg",{width:e,height:e,viewBox:`0 0 ${n} ${n}`,"aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:t})}function In(){return(0,s.jsxs)(ne,{size:14,children:[(0,s.jsx)("path",{d:"M7 1.5 L12.5 4.5 L7 7.5 L1.5 4.5 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M1.5 7.5 L7 10.5 L12.5 7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",strokeLinecap:"round"})]})}function Kr(){return(0,s.jsxs)(ne,{size:14,children:[(0,s.jsx)("rect",{x:"2.25",y:"1.75",width:"9.5",height:"10.5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,s.jsx)("path",{d:"M4.5 5 H9.5 M4.5 7.25 H9.5 M4.5 9.5 H7.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function $n(){return(0,s.jsx)(ne,{size:10,children:(0,s.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function qr(){return(0,s.jsxs)(ne,{size:16,children:[(0,s.jsx)("circle",{cx:"7",cy:"7",r:"4.75",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),(0,s.jsx)("path",{d:"M10.5 10.5 L14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function zr({place:e}){if(e.key===U)return(0,s.jsx)(In,{});if(e.group==="home")return(0,s.jsx)(ne,{size:13,box:14,children:(0,s.jsx)("path",{d:"M2 6.5 L7 2 L12 6.5 V12 H2 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})});let n=e.kind?`hsl(${Math.round(Xe(e.kind))} 55% 52%`:"rgb(128 128 128";return(0,s.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:12,height:8,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",background:e.group==="lists"?`${n})`:`linear-gradient(${n}), ${n})) center / 6px 4px no-repeat, ${n} / 0.35)`}})}var Gr=[{group:"home"},{group:"lists",heading:"Lists"},{group:"pictures",heading:"Pictures"}],ye="More";function jr({actions:e,folded:n}){let t=Y("host-actions",{popover:n}),r=e.map(a=>a.label).join(", "),o=a=>e.map(i=>(0,s.jsxs)("button",{type:"button",className:n?"graview-bar-host-action graview-bar-item":"graview-bar-host-action","data-testid":"host-bar-action",onClick:()=>{a(),i.onSelect()},children:[i.icon?(0,s.jsx)(_n,{icon:i.icon}):null,(0,s.jsx)("span",{children:i.label})]},i.label));return n?(0,s.jsxs)("div",{className:"graview-bar-host",children:[(0,s.jsx)("button",{type:"button",className:"graview-bar-host-action","data-testid":"host-bar-actions-open","data-folded":"",...t.trigger,onClick:t.toggle,"aria-label":`${ye} \u2014 ${r}`,title:r,children:(0,s.jsxs)(ne,{size:16,children:[(0,s.jsx)("circle",{cx:"3",cy:"8",r:"1.4",fill:"currentColor"}),(0,s.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,s.jsx)("circle",{cx:"13",cy:"8",r:"1.4",fill:"currentColor"})]})}),(0,s.jsx)("div",{...t.pane,"data-testid":"host-bar-actions",hidden:!t.open,className:"graview-bar-list",style:j,"aria-label":"From the host",children:o(()=>t.setOpen(!1))})]}):(0,s.jsx)("div",{className:"graview-bar-host","data-testid":"host-bar-actions-standing",role:"group","aria-label":"From the host",children:o(()=>{})})}function _n({icon:e}){let n=ie($(e)?e:void 0);return n?(0,s.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",dangerouslySetInnerHTML:n}):(0,s.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",children:e})}function Wn({place:e,current:n,reach:t,standing:r,done:o}){let a=e.key===n,i=t.href?.(e.path);return(0,s.jsxs)(i!==void 0?"a":"button",{className:r?"graview-bar-at":"graview-bar-item","data-testid":`app-place-${e.key}`,"data-place-path":e.path,...a?{"aria-current":"page"}:{},...i!==void 0?{href:i}:{type:"button"},onClick:c=>{o(),t.go&&(i!==void 0&&!Dn(c)||(c.preventDefault(),t.go(e)))},children:[r?null:(0,s.jsx)("span",{className:"graview-bar-mark",children:(0,s.jsx)(zr,{place:e})}),r&&a?(0,s.jsx)("span",{"data-testid":"app-place-current",children:e.label}):(0,s.jsx)("span",{children:e.label})]})}function Yr({places:e,current:n,reach:t,id:r,done:o}){return(0,s.jsx)(s.Fragment,{children:Gr.map(({group:a,heading:i})=>{let p=e.filter(d=>d.group===a);if(p.length===0)return null;let c=`${r}-${a}`;return(0,s.jsxs)("div",{role:"group",...i?{"aria-labelledby":c}:{"aria-label":p[0].label},"data-place-group":a,children:[i?(0,s.jsx)("p",{id:c,children:i}):null,(0,s.jsx)("ul",{children:p.map(d=>(0,s.jsx)("li",{children:(0,s.jsx)(Wn,{place:d,current:n,reach:t,standing:!1,done:o})},d.key))})]},a)})})}function Ur({places:e,current:n,here:t,reach:r,scene:o,stands:a}){let i=Y("places"),p=(0,y.useRef)(a);i.open||(p.current=a);let c=p.current,u=e.find(b=>b.key===n)?.label??t??"Places",l=c?e.filter((b,L)=>!c.includes(L)):e,m=Qr(e,n,o),w=J(),h=w?.keptViews?.current(),S=!!(h&&(h.removed.length>0||w.views.places().some(b=>b.hidden)||h.may.lenses&&(w.views.arrangement?.()?.hide?.length??0)>0));return(0,s.jsxs)("nav",{className:c?"graview-bar-places":"graview-bar-place-at","aria-label":o?"What the scene shows":"The app\u2019s places",...c?{"data-testid":"app-places-standing"}:{},...m,children:[c?.map(b=>(0,s.jsx)(Wn,{place:e[b],current:n,reach:r,standing:!0,done:()=>{}},e[b].key)),l.length>0||S?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("button",{type:"button",className:c?"graview-bar-at":"graview-bar-place","data-testid":"app-places-open",...i.trigger,onClick:i.toggle,"aria-label":c?`${ye} \u2014 ${l.length} more ${o?"pictures":"places"}`:`${u} \u2014 ${o?"everything the scene shows":"every place"}`,title:c?l.map(b=>b.label).join(", "):u,children:[c?ye:(0,s.jsx)("span",{className:"graview-bar-place-words","data-testid":"app-place-current",children:u}),(0,s.jsx)($n,{})]}),(0,s.jsxs)("div",{...i.pane,"data-testid":"app-places",hidden:!i.open,className:"graview-bar-list",style:j,children:[(0,s.jsx)(Yr,{places:l,current:n,reach:r,id:i.pane.id,done:()=>i.setOpen(!1)}),S&&i.open?(0,s.jsx)(y.Suspense,{fallback:null,children:(0,s.jsx)(Br,{id:i.pane.id,scene:o,reach:r,done:()=>i.setOpen(!1)})}):null]})]}):null]})}function Qr(e,n,t){let r=J()?.setMenuAt,o=a=>{let i=a.target.closest?.("[data-place-path],[data-testid=app-places-open]");if(!i||!r)return;let p={at:0};a.type==="pointerdown"?document.addEventListener("pointerup",()=>p.at||=Date.now(),{once:!0}):a.preventDefault();let c=a.nativeEvent;M.load().then(d=>d.placeGesture(c,i,e,n,t,r,p),String)};return{onContextMenu:a=>a.shiftKey||o(a),onKeyDown:a=>(a.key==="ContextMenu"||a.key==="F10"&&a.shiftKey)&&o(a),onPointerDown:a=>a.pointerType!=="mouse"&&a.isPrimary&&o(a)}}function Zr(e,n,t,r){let o=e.querySelector("[data-graview-bar-ruler]"),a=e.querySelector(".graview-bar-mid");if(!o||!a)return null;let i=e.querySelector(".graview-bar-find");if(i?.matches(":focus-within"))return;if(e.getBoundingClientRect().width<X)return null;let p=Vn(e);if(p===null)return null;let c=[...o.children].map(L=>L.getBoundingClientRect().width),d=c.pop()??0,u=e.querySelector(".graview-bar-faces"),l=u&&t?Kn(u):0,m=u?.getAttribute("data-switch-drawn")==="words"?l:0,w=a.getBoundingClientRect().left+p,h=i?.getBoundingClientRect(),S=(h&&h.width>0?h.right-w-(parseFloat(getComputedStyle(i).minWidth)||0)-16:a.getBoundingClientRect().width-p)-Fn(e),b=[...r].map(L=>L!=="0");return On({widths:c,current:n,room:Math.floor(S+m-l),more:d,primary:b})?.join(",")??null}function Kn(e){return[...e.querySelectorAll(".graview-bar-face span")].reduce((n,t)=>n+t.scrollWidth+10,0)}var Jr=e=>`graview:lenses:${e}`,Xr=(e,n)=>e?.name??n.kinds.join(",");function Oe(e){try{let n=JSON.parse(localStorage.getItem(Jr(e))??"[]");return Array.isArray(n)?n.filter(t=>typeof t?.title=="string"&&typeof t.lens=="string"):[]}catch{return[]}}var K=v(R(),1);var N=v(P(),1);function et({scheme:e,onScheme:n,profileHref:t,keeping:r,hostActions:o=nt,signature:a=!1}){let{store:i,principal:p,seats:c,people:d}=fe(),u=Y("profile"),l=u.open,[m,w]=(0,K.useState)(!1);(0,K.useEffect)(()=>at(we),[]),l&&!m&&w(!0),(0,K.useEffect)(()=>{l&&we()},[l]);let h=p.id===void 0?void 0:i.graph.getNode(p.id),S=h===void 0?p.id===void 0?"Nobody in particular":Ze(p,{graph:i.graph,schema:i.schema,seats:c,people:d}):Ye(i.schema.tryDefinition(h.kind),h);return(0,N.jsxs)("div",{style:{position:"relative"},children:[(0,N.jsx)("button",{type:"button","data-testid":"profile-button",...u.trigger,onClick:u.toggle,onPointerEnter:we,onFocus:we,"aria-label":`${S} \u2014 you, your seat and your settings`,title:`${S} \u2014 you, your seat and your settings`,style:{...ee,borderRadius:999},children:(0,N.jsx)("span",{"aria-hidden":"true","data-testid":"profile-mark",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:W-4,height:W-4,borderRadius:999,fontSize:"0.8125rem",fontWeight:600,background:"var(--graview-panel-muted)",color:"var(--graview-ink)",border:"1px solid var(--graview-edge)"},children:ot(S)})}),(0,N.jsxs)("section",{...u.pane,"aria-label":"Profile","data-testid":"profile","data-graview-offstage":"",hidden:!l,style:{...j,width:280,maxWidth:"calc(100vw - 32px)",maxHeight:"min(62cqh, 520px)",overflowY:"auto",overflowX:"hidden",display:l?"grid":"none",gap:12,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[m?(0,N.jsx)(K.Suspense,{fallback:null,children:(0,N.jsx)(rt,{part:"top",name:S,me:h,profileHref:t,hostActions:o,close:()=>u.setOpen(!1)})}):null,(0,N.jsxs)("div",{className:"graview-profile-keeping","data-testid":"profile-keeping",style:st,children:[(0,N.jsx)("span",{style:it,children:"Keeping this app"}),r]}),m?(0,N.jsx)(K.Suspense,{fallback:null,children:(0,N.jsx)(tt,{part:"rest",name:S,me:h,scheme:e,onScheme:n,hostActions:o,signature:a,close:()=>u.setOpen(!1)})}):null]})]})}var nt=[],we=()=>M.prefetch(),rt=M.part((e,n)=>(0,N.jsx)(e.ProfilePane,{...n}),{what:"The rest of your menu"}),tt=M.part((e,n)=>(0,N.jsx)(e.ProfilePane,{...n}),{quiet:!0});function at(e){let n=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},t=globalThis;if(t.requestIdleCallback){let o=t.requestIdleCallback(n,{timeout:5e3});return()=>t.cancelIdleCallback?.(o)}let r=setTimeout(n,2500);return()=>clearTimeout(r)}function ot(e){return(e.trim()[0]??"?").toUpperCase()}var it={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},st={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};function lt(e){return!(e==="hidden"||e===!1)}var Fe=v(R(),1);var qn="The whole thing",he=e=>`scene:${e.kind}:${e.as}`;function zn(e){let{view:n}=e,t=e.places.filter(l=>!e.hidden.has(l.kind)),r=ae(t),o=(l,m)=>{if(l===U)return gn(mn(m,!0),"view",null);let w=r.find(h=>he(h)===l);return w?wn(m,w.over?.find(h=>m.focusId===oe(h))??w.kind,w.as):null},a=n.within?.view,i=l=>n.focusId===oe(l.kind)&&(a===void 0?t.filter(m=>m.kind===l.kind).at(-1)===l:a===l.as),p=t.find(l=>i(l)&&(a!==void 0||!n.overview)),c=p?r.find(l=>ue(l,p)):void 0,d=r.filter(l=>!l.hidden||l===c);return{places:[{key:U,label:qn,path:`${Ae}${Te(o(U,Ne))}`,group:"home"},...d.map(l=>({key:he(l),label:Z(l,t,e.schema),path:`${Ae}${Te(o(he(l),Ne))}`,group:"pictures",kind:l.kind,hidden:l.hidden}))],current:c?he(c):U,to:o}}function dt(){let{store:e,views:n,hiddenKinds:t}=fe(),{view:r,go:o}=xn(),a=n.places(),i=(0,Fe.useMemo)(()=>zn({places:a,hidden:t,view:r,schema:e.schema}),[a,t,r,e.schema]),p=(0,Fe.useMemo)(()=>({go:c=>{let d=i.to(c.key,r);d&&o(d)}}),[i,r,o]);return{places:i.places,current:i.current,reach:p}}var re=v(R(),1);var F=v(P(),1),ct=M.part((e,n)=>(0,F.jsx)(e.ProblemRows,{...n}),{what:"The problems",as:"li"}),Ve=()=>M.prefetch();function pt({clean:e="All rules hold"}){let n=kn(),{set:t}=bn(),r=n.length,[o,a]=(0,re.useState)(!1),i=Y("problems",{open:o&&r>0,onOpenChange:a}),p=i.open,c=jn(n,e);return(0,re.useEffect)(()=>{if(r===0)return;let d=setTimeout(Ve,1500);return()=>clearTimeout(d)},[r>0]),(0,F.jsxs)("div",{style:{position:"relative",display:"inline-flex"},children:[(0,F.jsxs)("button",{type:"button","data-testid":"standing",...i.trigger,"aria-disabled":r===0?!0:void 0,"aria-label":c,onClick:r===0?void 0:i.toggle,onPointerEnter:r===0?void 0:Ve,onFocus:r===0?void 0:Ve,title:c,style:{...ee,padding:r===0?0:"0 8px",cursor:r===0?"default":"pointer",color:r===0?"var(--graview-ink-muted)":Gn(n),fontVariantNumeric:"tabular-nums",fontWeight:600},children:[(0,F.jsx)(Yn,{tone:r===0?"var(--graview-good)":Gn(n)}),r>0?(0,F.jsx)("span",{"aria-hidden":"true",children:r}):null]}),p?(0,F.jsx)("ol",{...i.pane,"data-testid":"problems",style:{...j,width:300,maxHeight:"min(48cqh, 420px)",overflow:"auto",margin:0,padding:4,listStyle:"none",display:"grid",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:(0,F.jsx)(re.Suspense,{fallback:null,children:(0,F.jsx)(ct,{violations:n,pick:d=>{t(d.nodeIds),i.setOpen(!1)}})})}):null]})}function jn(e,n){return e.length===0?n:`${Je(e)} \u2014 open what is broken, and what would fix it`}var Gn=e=>e.some(n=>n.status==="could-not-judge"||n.status==="over-budget")?"var(--graview-bad)":"var(--graview-warn)";function Yn({tone:e}){return(0,F.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:999,flex:"0 0 auto",background:e}})}function ut(e,n,t=[]){if(e.focusId)return e.focusId;let o=(e.selection??[]).map(yn).find(a=>a!==null)??t.find(a=>n.includes(a))??n[0]??null;return o===null?null:oe(o)}var be=v(P(),1),ve=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.AWUO3M5D.js","./chunk.VZDHRY3U.js","./chunk.V4HVFLFQ.js","./chunk.A2R53GWF.js","./chunk.B5PJCYBU.js","./chunk.Q2EGESEZ.js","./chunk.SMHP2CQH.js","./chunk.2PJ6STKA.js","./chunk.MBB5A6BT.js","./chunk.T535ZLRM.js","./chunk.ERPILTRY.js","./chunk.OTSBF367.js","./chunk.WVUJXDXZ.js","./chunk.XYGNS637.js","./chunk.DZSZUX34.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6HKWAHPT.js"))));function ft(){return ve.load().then(()=>{})}var gt=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function mt({schema:e,specs:n,kind:t,view:r}){let o=ve.current.frameworkViews(e,n).lookup(t,{cardinality:r.cardinality,fidelity:r.fidelity});return o?(0,be.jsx)(o,{...r}):null}var yt=ve.part((e,n)=>(0,be.jsx)(mt,{...n}),{what:"This view"});function Un(e,n,t){for(let r of n.kinds){let o=t?.[r];for(let a of gt){let i=c=>(0,be.jsx)(yt,{schema:n,specs:t,kind:r,view:c}),p=a.slot!==void 0&&o?.[a.slot]!==void 0;p&&(i.says=(c,d)=>ve.current?.frameworkViews(n,t).lookup(r,{cardinality:a.cardinality,fidelity:a.fidelity})?.says?.(c,d)),e.register(r,{cardinality:a.cardinality,fidelity:a.fidelity},p?i:hn(i))}}return e}function wt(e,n){return Un(vn(e),e,n)}var De=v(R(),1);var D=v(P(),1),Qn=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.GHN62OMG.js","./chunk.2RASWDMQ.js","./chunk.XCWZFLIB.js","./chunk.6YK5E7ZQ.js","./chunk.AWUO3M5D.js","./chunk.VZDHRY3U.js","./chunk.V4HVFLFQ.js","./chunk.A2R53GWF.js","./chunk.QAMW5QDT.js","./chunk.B5PJCYBU.js","./chunk.Q2EGESEZ.js","./chunk.SMHP2CQH.js","./chunk.HJCQ6I3S.js","./chunk.EJ4MSVX2.js","./chunk.KQPKYWDM.js","./chunk.72YXFJKC.js","./chunk.2PJ6STKA.js","./chunk.MBB5A6BT.js","./chunk.T535ZLRM.js","./chunk.ERPILTRY.js","./chunk.OTSBF367.js","./chunk.BIDL7GQD.js","./chunk.QS32TO4N.js","./chunk.JVDPRQ7J.js","./chunk.57YDGGJK.js","./chunk.H7AH3IW4.js","./chunk.4TH3CGAZ.js","./chunk.Q5WEOX3Q.js","./chunk.MAHNJO6U.js","./chunk.75GENXGP.js","./chunk.NIAM7OTV.js","./chunk.WVUJXDXZ.js","./chunk.XYGNS637.js","./chunk.DZSZUX34.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZVG4FXJK.js"))));function ht({lens:e,view:n}){let t=Qn.current.declaredLensView(e);return(0,D.jsx)(t,{...n})}var vt=Qn.part((e,n)=>(0,D.jsx)(ht,{...n}),{what:"This picture"});function bt(e){let n=r=>(0,D.jsx)(De.Suspense,{fallback:null,children:(0,D.jsx)(vt,{lens:e,view:r})});e.lens==="blocks"&&(n.flows=!0);let t=e.lens==="blocks"?e.options.blocks?.[0]:void 0;return typeof t?.headline=="string"&&(n.lede=t),e.create===!1&&(n.creates=!1),n}var Zn=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.AWUO3M5D.js","./chunk.VZDHRY3U.js","./chunk.V4HVFLFQ.js","./chunk.A2R53GWF.js","./chunk.B5PJCYBU.js","./chunk.Q2EGESEZ.js","./chunk.SMHP2CQH.js","./chunk.2PJ6STKA.js","./chunk.MBB5A6BT.js","./chunk.T535ZLRM.js","./chunk.ERPILTRY.js","./chunk.OTSBF367.js","./chunk.WVUJXDXZ.js","./chunk.XYGNS637.js","./chunk.DZSZUX34.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.3JCHJLH6.js"))));function kt({blocks:e,view:n}){let t=Zn.current.homeView(e);return(0,D.jsx)(t,{...n})}var xt=Zn.part((e,n)=>(0,D.jsx)(kt,{...n}),{what:"The home"});function St(e){let n=t=>(0,D.jsx)(De.Suspense,{fallback:null,children:(0,D.jsx)(xt,{blocks:e,view:t})});return Object.defineProperty(n,Symbol.for("graview.home-blocks"),{value:!0}),n}function Pt(e,n){return n.home&&n.home.length>0&&e.home?.(St(n.home)),Jn(e,n),e.arrange?.(n.pages),e}function Jn(e,n,t){for(let r of ln(n).drawn){if(t&&e.places().some(i=>i.title===r.title))continue;let o=bt(r),a={title:r.title,lens:r.lens,...r.across?{across:r.across}:{},...t?{beside:t}:{},...r.hidden?{hidden:!0}:{},over:r.kinds,...t?{}:{declared:!0}};for(let i of r.kinds)e.register(i,{cardinality:"many",fidelity:"full"},o,a),e.register(i,{cardinality:"many",fidelity:"summary"},o,a)}}function Lt(e,n,t){t.length>0&&Jn(e,{schema:n,lenses:t.map(({lens:r,...o})=>({...o,name:r}))},!0)}function Et(e,n,t){Lt(e,n,Oe(t))}var q=v(R(),1),ke=v(P(),1);var Ie=e=>`graview:first-look:${e}`;function At(e,n){if(e.seen!==void 0)try{return typeof e.seen=="function"?e.seen():e.seen}catch{return!0}try{return window.localStorage.getItem(Ie(n))!==null}catch{return!1}}function Nt(e,n){if(e.seen===void 0)try{window.localStorage.setItem(Ie(n),"seen")}catch{}}var Tt=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UAVK54Z6.js")))),Ht=Tt.part((e,n)=>{let t=e.FirstLookHints;return(0,ke.jsx)(t,{...n})},{quiet:!0});function Bt({firstLook:e,root:n,app:t}){let r=(0,q.useRef)(null);r.current=e===!0?{}:e||null;let[o,a]=(0,q.useState)(()=>r.current!==null&&typeof window<"u"&&!At(r.current,t)),i=(0,q.useCallback)(p=>{if(a(!1),p===null)return;let c=r.current??{};Nt(c,t),c.onDone?.(p)},[t]);return!o||r.current===null?null:(0,ke.jsx)(q.Suspense,{fallback:null,children:(0,ke.jsx)(Ht,{root:n,steps:r.current.steps??[],onEnd:i})})}export{ge as a,yr as b,Mt as c,Ln as d,Ct as e,ie as f,Hr as g,vr as h,br as i,me as j,kr as k,xr as l,Sr as m,Lr as n,Er as o,Ar as p,M as q,Rr as r,Or as s,Cn as t,Fr as u,ee as v,Dr as w,et as x,lt as y,dt as z,Jr as A,Xr as B,Oe as C,pt as D,jn as E,Yn as F,ut as G,Pt as H,Lt as I,Et as J,ft as K,wt as L,Bt as M};
@@ -1 +0,0 @@
1
- import{a as fe,b as Ne,d as Ze,e as He,f as he,g as F,h as ke,j as We}from"./chunk.75GENXGP.js";import{h as Je,i as Xe,j as Qe}from"./chunk.4EXC26LI.js";import{a as ae,b as ce,c as J,d as Ye,e as Q,g as se,h as en}from"./chunk.AHPYNDVA.js";import{c as Be,h as k,i as Ue,j as ze,t as ye}from"./chunk.FNVGNISQ.js";import{A as re,Ha as Ie,Ic as qe,Jc as Ve,Oa as Ke,Pa as oe,Qa as me,b as Z,c as U,e as ue,f as Me,g as P,h as O,hc as Pe,ic as ge,jc as Le,k as L,kc as Ge,l as X,lc as Ce,m as _,n as _e,o as H,p as I,r as $,s as te,t as R,u as j,v as C,w as T,x as n,y as N,z as Y}from"./chunk.Q4MI53KK.js";var be=e=>Object.entries(e).map(([s,i])=>[s,Object.keys(oe(i?.edges))]),$e=(e,s)=>Le(e,be(s));function nn(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(be(e.kinds))]}var V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tn(e){if(!V(e)||!V(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,l])=>[g,V(l)&&V(l.edges)?{edges:l.edges}:{}]));s=nn({acts:V(e.acts)?e.acts:{},kinds:f})}catch{return e}let i=new Set(s),t=!1,o=f=>{if(typeof f!="string"||i.has(f))return f;let g=qe(f,s);return g===void 0?f:(t=!0,g)},a=V(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>V(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(o)}:f)}:void 0,u=V(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,V(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(l=>V(l)?{...l,act:o(l.act)}:l)}:g])):void 0;return t?{...e,...a?{policy:a}:{},...u?{rules:u}:{}}:e}function we(e,s){let i=Ve(e,nn(s));return i&&i!==e?`did you mean "${i}"?`:void 0}var Oe="graview-document",je=1,xe=256*1024,ee=64*1024,vn=["plain","editorial","shader","ascii"];var Se=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ve=/^[a-z][A-Za-z0-9]*$/,On=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,on=12,sn=60,jn=new Set(["id","kind"]),xn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,An=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function En(){let e=h=>h in Object.prototype,s=Y(h=>!e(h),"every object already has this name \u2014 choose another"),i=(h,D)=>[...h===void 0?[]:[Me(h)],...D===void 0?[]:[ue(D)]],t=(h,D)=>O().check(...i(h,D)),o=(h,D,ne)=>I(h).check(...i(D,ne)),a=h=>O().check(P(Se,`${h} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(P(xn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(P(ve,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(h=>!jn.has(h),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),g=t(1,500),l=O().check(ue(40),P(On,'an alias is up to three lower-case words, like "supplier"')),r=t(1,2e3),p=t(1,300),y=$({type:C(An),required:n(_()),description:n(g),label:n(t(1,60)),aliases:n(o(l,1,on)),options:n(o(t(1,80),1,100)),multiple:n(_()),optionLabels:n(j(t(1,80),t(1,80))),of:n(C(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(C(["money","percent","duration","markdown"])),places:n(T(0)),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(O().check(P(ve))),repeats:n(_()),collaborative:n(_())}).check(re((h,D)=>{h.type==="enum"&&!h.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),h.type!=="enum"&&h.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),h.type!=="enum"&&h.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let ne of Object.keys(h.optionLabels??{}))h.options?.includes(ne)||D.addIssue({code:"custom",message:`"${ne}" is labeled, and is none of the field's options`,path:["optionLabels",ne]});h.type!=="list"&&h.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),h.places!==void 0&&!(h.format==="money"||!h.format&&/^[A-Z]{3}$/.test(h.unit??""))&&D.addIssue({code:"custom",message:'"places" belongs only on money: a number field with "format": "money"',path:["places"]}),h.repeats&&h.type!=="date"&&h.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=O().check(P(new RegExp(`${Se.source}|${Ie.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([o(m,1),T("*")]),cardinality:n(C(["one","many"])),description:n(g),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(T("never"))}),c=R([r,$({expr:r,label:n(t(1,60)),description:n(g),format:n(C(["money","percent","duration"])),unit:n(t(1,12)),places:n(T(0)),hidden:n(_())})]),w=R([O(),L(),_(),_e(),I(H()),$({expr:r})]),b=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(o(l,1,on)),description:n(g),fields:j(f,y).check(Y(h=>Object.keys(h).length>0,"a kind has at least one field")),label:n(p),describe:n(p),lifecycle:n($({field:f,retired:o(R([O(),L(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(o(f,1,20)),page:n($({fields:n(o(f,1,40)),groups:n(o($({title:t(1,60),fields:o(f,1,40)}),1,12))})),edges:n(j(u,d)),computed:n(j(O(),c).check(Y(h=>Object.keys(h).length<=sn,`a kind works out at most ${sn} computed fields`))),fieldRoles:n(j(O(),O())),renamedFrom:n(O().check(P(Se))),people:n(_()),archives:n(T(!1)),tidying:n(C(["never","no-links"])),derives:n($({from:a("kind"),via:u,set:j(f,w)}))}),S=O().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),x=R([$({create:a("kind"),as:n(O().check(P(ve))),set:n(j(f,w))}),$({set:j(f,w),target:n(S)}),$({connect:u,from:S,to:S}),$({sever:u,from:S,to:S}),$({remove:S})]),E=$({title:n(t(1,80)),description:n(g),fromTheOtherEnd:n(t(1,80)),on:n(R([a("kind"),o(a("kind"),1)])),creates:n(a("kind")),sets:n(j(f,w)),writes:n(o(f,1)),connects:n(u),severs:n(u),setsOther:n(j(f,w)),setsLinked:n(j(u,j(f,w))),replaces:n(R([T(!0),o(u,1,10)])),removes:n(T(!0)),args:n(j(f,y)),effects:n(o(x,1,20)),allowedWhen:n(r),refusal:n(p),destructive:n(_())}),v=$({act:a("act"),label:n(t(1,80)),args:n(j(O(),w))}),B=$({every:a("kind"),through:u,via:n(u)}),G=$({title:n(t(1,120)),description:n(g),over:R([T("graph"),a("kind")]),when:n(r),require:n(r),covers:n(B),says:n(p),repairs:n(o(v,void 0,10))}).check(re((h,D)=>{!h.require&&!h.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),h.require&&h.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),h.covers&&h.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),z=$({roles:R([o(a("role"),1),T("*")]),mutations:R([o(a("act")),T("*")]),kinds:n(R([I(a("kind")),T("*")])),describe:n(g),self:n(_()),ownEnd:n(_()),propose:n(R([o(a("act"),1),T("*")]))}).check(re((h,D)=>{Array.isArray(h.mutations)&&h.mutations.length===0&&h.propose===void 0&&D.addIssue({code:"custom",message:'a grant names at least one act in "mutations", or the acts it lets these roles propose in "propose"',path:["mutations"]})})),A=n(o(f,1)),M=$({roles:R([o(a("role"),1),T("*")]),kinds:o(a("kind"),1),own:n(_()),via:n(u),fields:A,hide:A}),ie=$({grants:I(z),sees:n(I(M))}),W=$({accent:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(O().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(O().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ee),$({src:t(1,ee),alt:n(t(1,120))}),$({light:t(1,ee),dark:n(t(1,ee)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(R([t(1,ee),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),Z(32))),density:n(L().check(U(.75),Z(1.5)))})),accents:n(j(O(),L().check(U(0),Z(360)))),scheme:n(C(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:C(vn),image:n(t(1,ee)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40))})),views:n($({css:n(t(1)),motion:n(C(["none","fade"]))}))}),q=j(O(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(C(["asc","desc"]))})]),De=L().check(X(),U(1),Z(9999)),hn=te({create:n(_()),options:n(te({sort:n(Fe),columnSort:n(Fe),search:n(o(t(1,120),void 0,40)),filters:n(o(t(1,120),void 0,40)),horizon:n(R([L().check(X(),U(1),Z(200)),te({years:L().check(X(),U(1),Z(200)),title:t(1,80),from:n(De),to:n(De)})]))}))}),kn=$({card:n(I(H())),row:n(I(H())),page:n(I(H()))}),bn=()=>{let h=n(C(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:h,then:n(R([t(1,120),$({by:t(1,120),direction:h})]))})])},$n=()=>R([t(1,120),$({by:t(1,120),order:n(o(t(1,80),void 0,40)),closed:n(o(t(1,80),void 0,40))})]),Te=te({order:n(I(O())),hide:n(I(O())),first:n(O()),primary:n(o(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(j(O(),$({filters:n(o(t(1,120),void 0,40)),sort:n(bn()),group:n($n()),export:n(_())})))}),wn=$({act:a("act"),title:n(t(1,80)),intro:n(g),fields:n(o(f,1,40)),say:n(g),submit:n(t(1,80)),role:n(a("role"))}),Sn=$({$schema:n(O()),format:T(Oe),formatVersion:T(je),name:t(1,80),description:n(g),version:n(L().check(X(),U(1))),kinds:j(a("kind"),b).check(Y(h=>Object.keys(h).length>0,"a document declares at least one kind"),Y(h=>Object.keys(h).length<=40,"a document declares at most 40 kinds")),computed:n(j(O(),c)),acts:n(j(a("act"),E)),rules:n(j(a("rule"),G)),roles:n(I(a("role"))),policy:n(ie),modules:n(q),lenses:n(I(hn)),pages:n(Te),views:n(j(O(),R([kn,I(H())]))),brand:n(W),settings:n(I(q)),migrations:n(I(q)),connections:n(j(a("connection"),q)),purpose:n(q),workflows:n(j(a("workflow"),q)),forms:n(j(a("form"),wn)),publishing:n($({mode:C(["live","on-publish"]),working:o(a("role"),void 0,40),publishers:n(o(a("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(X(),U(1),Z(1e4)))}))});return{FieldSpec:y,EdgeSpec:d,ComputedSpec:c,KindSpec:b,ValueSpec:w,EffectSpec:x,ActSpec:E,RepairSpec:v,CoverSpec:B,RuleSpec:G,GrantSpec:z,SightSpec:M,PolicySpec:ie,BrandSpec:W,PagesSpec:Te,DocumentSpec:Sn}}var Rn,K=()=>Rn??=En(),Xn=N(()=>K().FieldSpec),Qn=N(()=>K().EdgeSpec),et=N(()=>K().ComputedSpec),nt=N(()=>K().KindSpec),tt=N(()=>K().ValueSpec),ot=N(()=>K().EffectSpec),st=N(()=>K().ActSpec),it=N(()=>K().RepairSpec),rt=N(()=>K().CoverSpec),at=N(()=>K().RuleSpec),ct=N(()=>K().GrantSpec),lt=N(()=>K().SightSpec),dt=N(()=>K().PolicySpec),pt=N(()=>K().BrandSpec),ft=N(()=>K().PagesSpec),rn=N(()=>K().DocumentSpec);var Fn={};function an(e,s=Fn,i=je){let{document:t,respelled:o}=Ne(e),a=o.length>0?{respelled:o}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Oe||typeof u.formatVersion!="number"||u.formatVersion>=i)return{document:t,...a};let f=u.formatVersion,g=structuredClone(u);for(let l=f;l<i;l++){let r=s[l];if(!r)throw new Error(`there is no upgrade from format ${l} to ${l+1}`);g={...r(g),formatVersion:l+1}}return{document:g,from:f,...a}}function Ae(e,s,i){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let o=t.map(f=>e[f].edges[s].to),a=o.some(f=>f==="*")?"*":[...new Set(o.flatMap(f=>f))];if(i.length===0||i.some(f=>t.includes(f)))return{reversed:!1,kinds:a};let u=t.filter(f=>{let g=e[f].edges[s].to;return g==="*"||i.every(l=>g.includes(l))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:a}}var dn=(e,s)=>{let i=e?.fields[s];return i!==void 0&&(i.type==="duration"||(i.type==="number"||i.type==="integer")&&i.format==="duration")};function cn(e,s,i,t){if(t==="out"){let o=e[s]?.edges?.[i]?.to;return o===void 0?[]:o==="*"?Object.keys(e):o}return Object.entries(e).filter(([,o])=>{let a=o.edges?.[i]?.to;return a!==void 0&&(a==="*"||a.includes(s))}).map(([o])=>o)}function Ee(e,s,i){if(i.t==="ident")return e[s]?.edges?.[i.name]?cn(e,s,i.name,"out"):void 0;if(i.t==="where")return Ee(e,s,i.set);if(i.t==="call"&&(i.fn==="out"||i.fn==="in")&&i.args[0]?.t==="lit"&&typeof i.args[0].value=="string")return cn(e,s,i.args[0].value,i.fn)}var ln=(e,s,i)=>{let t=s.filter(o=>e[o]?.fields[i]!==void 0);return t.length>0&&t.every(o=>dn(e[o],i))};function pn(e,s,i){let t=e.kinds,o=t[s],a=new Map(i),u=new Map,f=(l,r)=>{if(r>8)return!1;switch(l.t){case"ident":return dn(o,l.name)||g(l.name,r+1);case"member":{let p=Ee(t,s,l.object);return p!==void 0&&ln(t,p,l.name)}case"call":{if(l.fn!=="sum"&&l.fn!=="min"&&l.fn!=="max")return!1;let[p,y]=l.args,m=p&&Ee(t,s,p);return m!==void 0&&y?.t==="ident"&&ln(t,m,y.name)}case"binary":return(l.op==="+"||l.op==="-")&&f(l.left,r)&&f(l.right,r);case"unary":return l.op==="-"&&f(l.operand,r);default:return!1}},g=(l,r)=>{if(o?.computed?.[l]===void 0)return!1;if(u.has(l))return u.get(l);u.set(l,!1);let p=a.get(l),y=p!==void 0&&f(p,r);return u.set(l,y),y};return i.map(([l])=>l).filter(l=>g(l,0))}var Dn="several choices";var Tn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Dn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var fn=new Set(Object.values(Tn).flat());function un(e,s){let i=new Map;if(!e||typeof e!="object")return new Map;let t=Object.values(e).flatMap(o=>o&&typeof o=="object"&&o.system==="notion"&&Array.isArray(o.sources)?o.sources.filter(a=>a&&typeof a=="object").map(a=>({system:"notion",kind:a.kind,properties:a.properties})):[o]);for(let o of t){if(!o||typeof o!="object"||typeof o.kind!="string")continue;let a=s[o.kind]?.fields;if(!a)continue;let u=[];o.system==="google-calendar"&&o.fields&&typeof o.fields=="object"?u=Object.values(o.fields).filter(g=>typeof g=="string"):o.system==="notion"&&(u=o.properties&&typeof o.properties=="object"?Object.keys(o.properties):Object.keys(a).filter(g=>fn.has(a[g].type)));let f=i.get(o.kind)??new Set;for(let g of u)Object.hasOwn(a,g)&&f.add(g);i.set(o.kind,f)}return new Map([...i].filter(([,o])=>o.size>0).map(([o,a])=>[o,Object.keys(s[o].fields).filter(u=>a.has(u))]))}function mn(e,s,i=`kinds.${e}.page`){let t=s.page;if(!t)return[];let o=[],a=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(l,r)=>{a.includes(l)?u.has(l)&&o.push(k("page-field-twice",r,`"${l}" is on ${e}'s page twice; name each field once`)):o.push(k("page-field",r,`${e}'s page is to show "${l}", and ${e} has no field or computed field called that`,`use one of: ${a.join(", ")}`)),u.add(l)};(t.fields??[]).forEach((l,r)=>f(l,`${i}.fields.${r}`));let g=new Set;return(t.groups??[]).forEach((l,r)=>{let p=l.title.trim().toLowerCase();g.has(p)&&o.push(k("page-group-twice",`${i}.groups.${r}.title`,`${e}'s page has two groups called "${l.title}"; give each its own title`)),g.add(p),l.fields.forEach((y,m)=>f(y,`${i}.groups.${r}.fields.${m}`))}),o}function gn(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(i=>i.fields)],must:i=>!!e.fields[i].required&&e.fields[i].default===void 0,naming:s})}var Nn=new Set(["subject","now","today","me"]);function Mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>xe)return{findings:[k("too-large","",`a document may be at most ${xe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[k("not-json","",`this is not JSON: ${t.message}`)]}}try{e=an(e).document}catch(t){return{findings:[k("format","formatVersion",t.message)]}}e=tn(e);let s=rn.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let o=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return k("unknown-key",o,`${t.keys.map(a=>`"${a}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(o))return k("effect-shape",o,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let a=t.issues?.[0]?.message;return k("shape",o,`the name "${String(t.path.at(-1))}" is not allowed here${a?`: ${a}`:""}`)}return k("shape",o,t.message)})};let i=s.data;return{document:i,findings:_n(i)}}var pe=e=>[e??[]].flat();function zn(e){let s=new Map;for(let[i,t]of Object.entries(e.kinds))for(let[o,a]of Object.entries(oe(t.edges))){let u=s.get(o);s.set(o,{name:o,from:[...u?.from??[],i],to:a.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...a.to])],cardinality:a.cardinality??"many"})}return s}function Ht(e){let s=new Map;for(let[t,o]of Object.entries(e.kinds)){let a=se(o),u=me(o.edges);s.set(t,{fields:new Set([...Object.keys(o.fields),...u.keys()]),edges:new Map(Object.entries(oe(o.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...a?{computed:a}:{},...u.size>0?{linked:u}:{}})}let i=se(e);return i&&s.set(Be,{computed:i}),s}function yn(e,s){let i=[],t=pe(e.on),o=(a,u)=>{let f=Ae(s.kinds,a,t)?.reversed===!0,[g,l]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:a,from:g,to:l}:{sever:a,from:g,to:l}};if(e.creates){let a=s.kinds[e.creates],u={};for(let f of Object.keys(a?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);i.push({create:e.creates,as:"new",set:u})}if(e.sets&&i.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&i.push({set:Object.fromEntries(e.writes.map(a=>[a,`$${a}`]))}),e.connects&&(e.replaces&&i.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),i.push(o(e.connects,"connect"))),e.severs&&i.push(o(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&i.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[a,u]of Object.entries(e.setsLinked))i.push({set:u,through:a});return e.removes&&i.push({remove:"$subject"}),e.effects&&i.push(...e.effects.filter(a=>!(e.creates&&"set"in a&&!("create"in a)&&F(a.target)==="new"))),i}function le(e,s,i){try{let t=J(e),o=ae(t);for(let a of o.unknownFunctions)i.push(k("unknown-function",s,`"${a}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ce){i.push(k("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Re(e,s,i){try{return Q(e)}catch(t){if(t instanceof Ye||t instanceof ce){i.push(k("template",s,(t instanceof ce,t.sentence)));return}throw t}}function _n(e){let s=[],i=new Set(Object.keys(e.kinds)),t=zn(e),o=e.acts??{},a=new Set(e.roles??[]),u=(l,r)=>me(e.kinds[l]?.edges).has(r),f=l=>Object.keys(e.kinds).some(r=>u(r,l));for(let[l,r]of Object.entries(e.kinds)){let p=`kinds.${l}`;for(let[m,d]of Object.entries(r.edges??{})){if(!Ke(d)&&d.to!=="*")for(let c of d.to)i.has(c)||s.push(k("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));r.fields[m]&&s.push(k("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${l}`,"rename one of them"))}r.lifecycle&&!r.fields[r.lifecycle.field]&&s.push(k("lifecycle-field",`${p}.lifecycle.field`,`${l} has no field "${r.lifecycle.field}"`));let y=m=>r.computed!==void 0&&Object.hasOwn(r.computed,m);for(let m of r.glance??[])!r.fields[m]&&!y(m)&&s.push(k("glance-field",`${p}.glance`,`a glance at ${l} is to say "${m}", and ${l} has no field or computed field called that`,`use one of: ${[...Object.keys(r.fields),...Object.keys(r.computed??{})].join(", ")}`));s.push(...mn(l,r));for(let m of["label","describe"]){let d=r[m];if(!d)continue;let c=Re(d,`${p}.${m}`,s);for(let w of c??[])if(w.expr){for(let b of ae(w.expr).names)if(!r.fields[b]){if(y(b)){en(r,b)||s.push(k("template-field",`${p}.${m}`,`${l}'s ${b} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${l}'s own fields`));continue}s.push(k("template-field",`${p}.${m}`,`${l} has no field "${b}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(r.derives?.set??{}))fe(d)&&"expr"in d&&le(String(d.expr),`${p}.derives.set.${m}`,s);for(let[m,d]of Object.entries(r.fields)){if(d.default!==void 0&&d.type==="enum"){let b=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(S=>!d.options?.includes(String(S)));(b!==void 0||!d.multiple&&Array.isArray(d.default))&&s.push(k("default-option",`${p}.fields.${m}.default`,`"${String(b??d.default)}" is not one of ${m}'s options`))}let c=`${m}Repeat`;d.repeats&&(r.fields[c]||r.edges?.[c]||r.computed?.[c])&&s.push(k("repeat-clash",`${p}.fields.${m}.repeats`,`${l} already has "${c}", where how ${m} repeats is kept`))}}for(let[l,r]of Object.entries(o)){let p=`acts.${l}`;for(let c of pe(r.on))i.has(c)||s.push(k("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let y=pe(r.on),m=yn(r,e);if(r.creates&&r.on===void 0&&r.writes&&i.has(r.creates)){for(let c of r.writes)if(!e.kinds[r.creates].fields[c])if(e.kinds[r.creates].computed?.[c]!==void 0)s.push(k("computed-written",`${p}.writes`,`${r.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(r.creates,c))continue;s.push(k("act-field",`${p}.writes`,`${r.creates} has no field "${c}"`))}}m.length===0&&s.push(k("act-empty",p,`"${l}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((c,w)=>{let b=m.length-(r.effects?.length??0),S=r.effects&&w>=b?`${p}.effects.${w-b}`:p;if("create"in c){if(!i.has(c.create))s.push(k("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let v of Object.keys(c.set??{}))e.kinds[c.create].fields[v]||(e.kinds[c.create].computed?.[v]!==void 0?s.push(k("computed-written",`${S}.set.${v}`,`${c.create}'s ${v} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(k("act-field",`${S}.set.${v}`,`${c.create} has no field "${v}"`)));c.as&&d.set(c.as,c.create)}else if("connect"in c||"sever"in c){let v="connect"in c?c.connect:c.sever;!t.has(v)&&!f(v)&&s.push(k("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${v}" is not a relation any kind declares`)),F(c.from)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in c))if("set"in c){let v=F(c.target??"$subject"),B=v==="subject"?y:d.has(v??"")?[d.get(v)]:[];v==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" changes "$subject" but does not say which kinds it is "on"`));for(let G of Object.keys(c.set))for(let z of B)if(!(!i.has(z)||e.kinds[z].fields[G]))if(e.kinds[z].computed?.[G]!==void 0)s.push(k("computed-written",`${S}.set.${G}`,`${z}'s ${G} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,G))continue;s.push(k("act-field",`${S}.set.${G}`,`${z} has no field "${G}"`))}}else"remove"in c&&F(c.remove)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${l}" removes "$subject" but does not say which kinds it is "on"`));let x="set"in c&&c.set?Object.values(c.set):[],E="through"in c?`${p}.setsLinked.${c.through}`:`${S}.set`;x.forEach(v=>{v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&le(v.expr,E,s)})}),r.allowedWhen&&le(r.allowedWhen,`${p}.allowedWhen`,s),r.refusal&&Re(r.refusal,`${p}.refusal`,s)}for(let[l,r]of Object.entries(e.rules??{})){let p=`rules.${l}`;r.over!=="graph"&&!i.has(r.over)&&s.push(k("rule-kind",`${p}.over`,`"${r.over}" is not a kind this document declares`));let y=r.over==="graph"?void 0:e.kinds[r.over];if(r.covers&&y){let m=ye(r.over,r.covers,d=>t.get(d),d=>i.has(d));if("problem"in m){let{key:d,message:c,fix:w}=m.problem;d==="every"?s.push(k("rule-kind",`${p}.covers.every`,c,w)):s.push(k("rule-covers-relation",`${p}.covers.${d}`,c,w))}}for(let m of["when","require"]){let d=r[m];if(!d)continue;let c=le(d,`${p}.${m}`,s);if(!c)continue;let w=ae(c);for(let b of w.names)if(r.over==="graph")s.push(k("rule-name",`${p}.${m}`,`"${b}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(y&&!y.fields[b]&&!y.edges?.[b]&&y.computed?.[b]===void 0){let S=Object.keys(y.edges??{}).find(x=>x.includes("-")&&x.split("-").includes(b));s.push(k("rule-name",`${p}.${m}`,`${r.over} has no field or relation called "${b}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(x,E)=>E.toUpperCase())}"`:void 0))}for(let b of w.edges)!t.has(b)&&!f(b)&&s.push(k("rule-edge",`${p}.${m}`,`"${b}" is not a relation any kind declares`));for(let b of w.sweeps)i.has(b)?r.over!=="graph"&&s.push(Ue("rule-cost",`${p}.${m}`,`this rule looks at every ${b} for every ${r.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(k("rule-kind",`${p}.${m}`,`"${b}" is not a kind this document declares`))}r.says&&Re(r.says,`${p}.says`,s),(r.repairs??[]).forEach((m,d)=>{!o[m.act]&&!ge(m.act)&&!$e(m.act,e.kinds)&&s.push(k("repair-act",`${p}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,we(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((l,r)=>{if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("grant-role",`policy.grants.${r}.roles`,`"${p}" is not one of the document's roles`));for(let p of["mutations","propose"]){let y=l[p];if(y!==void 0&&y!=="*")for(let m of y)!o[m]&&!ge(m)&&!$e(m,e.kinds)&&s.push(k("grant-act",`policy.grants.${r}.${p}`,`"${m}" is not an act this document declares`,we(m,e)))}}),(g.sees??[]).forEach((l,r)=>{for(let p of l.kinds)i.has(p)||s.push(k("sight-kind",`policy.sees.${r}.kinds`,`"${p}" is not a kind this document declares`));if(l.roles!=="*"&&a.size>0)for(let p of l.roles)a.has(p)||s.push(k("sight-role",`policy.sees.${r}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Qe(e)),s}function In(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[ke(e)??[]].flat()}function Kn(e,s,i,t){let o=new Map,a=pe(e.on),u=new Map,f=new Map;(a.length>0||s.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&o.set(he,{ref:a.length>0?a:"*",required:!0});let l=e.args??{},r=e.writes?.length===1,p=(d,c)=>c&&d.type===c.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:d,y=(d,c)=>c&&d.type===c.type&&d.format===void 0&&d.unit===void 0?{...p(d,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(d,c),m=(d,c,w)=>{if(d===he||Nn.has(d)||u.has(d)||o.has(d))return;let b=l[d]?y(l[d],w):void 0;o.set(d,b?{field:b,optional:!b.required,required:!!b.required}:c())};for(let d of s)if("create"in d){let c=i.kinds[d.create],w=c?gn(c,In(c)):[],b=S=>w.includes(S)?w.indexOf(S):w.length;for(let[S,x]of Object.entries(d.set??{}).sort(([E],[v])=>b(E)-b(v))){let E=F(x),v=c?.fields[S];if(E&&v){let B=!!v.required&&v.default===void 0;m(E,()=>({field:v,optional:!B,required:B}),v)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let c=t.get("connect"in d?d.connect:d.sever);for(let[w,b]of[["from",d.from],["to",d.to]]){let S=F(b);if(!S)continue;let x=w==="to"?c?.to??"*":c?.from??"*";x!=="*"&&!f.has(S)&&f.set(S,x),m(S,()=>({ref:x,required:!0}))}}else if("through"in d){let c=Ae(i.kinds,d.through,a),w=c&&c.kinds!=="*"?c.kinds[0]:void 0;for(let[b,S]of Object.entries(d.set)){let x=F(S);if(!x||x==="to")continue;let E=w?i.kinds[w]?.fields[b]:void 0;m(x,()=>E?{field:E,optional:!0,required:!1}:{any:!0,required:!1},E)}}else if("set"in d){let c=F(d.target??"$subject"),w=c==="subject"?a[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[b,S]of Object.entries(d.set)){let x=F(S);if(!x)continue;let E=w?i.kinds[w]?.fields[b]:void 0;m(x,()=>E?{field:E,optional:!r,required:r}:{any:!0,required:!1},E)}}else if("remove"in d){let c=F(d.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[d,c]of Object.entries(l))o.has(d)||o.set(d,{field:c,optional:!c.required,required:!!c.required});return o}function Wt(e,s={}){let i=Mn(e);if(!i.document||ze(i.findings))return{ok:!1,findings:i.findings};let t=i.document,o=[...i.findings];s.previous&&o.push(...Gn(t,s.previous));let a=Ln(t,o);return ze(a.findings)?{ok:!1,findings:a.findings}:We(a,s)}function de(e,s,i){return e.map(t=>{if(t.format||t.expr?.t!=="ident")return t;let o=t.expr.name,a=i?.[o],u=s?.[o]??(typeof a=="object"?a:void 0),f=u?.format;return f==="money"||f==="percent"?{...t,format:f,...f==="money"&&u?.places===0?{formatArgs:["0"]}:{}}:t})}function Pn(e,s,i){let t=i.kinds[e]?.edges?.[s.via]!==void 0?"to":"from",o=i.kinds[s.from],a=[],u={};for(let[f,g]of Object.entries(s.set))if(fe(g)&&"expr"in g){let l=J(g.expr);a.push([f,{expr:l}]),l.t==="ident"&&o?.fields[l.name]&&(u[f]=l.name)}else a.push([f,{value:typeof g=="string"&&g.startsWith("$$")?g.slice(1):g}]);return{from:s.from,via:s.via,sourceEnd:t,set:a,back:u}}function Ln(e,s){let i=zn(e),t={},o=un(e.connections,e.kinds);for(let[r,p]of Object.entries(e.kinds)){let y=ke(p),m=p.label??(y?`{${y}}`:void 0),d=se(p),c=d?pn(e,r,[...d]):[];t[r]={...m?{label:de(Q(m),p.fields,p.computed)}:{},...p.describe?{describe:de(Q(p.describe),p.fields,p.computed)}:{},...d?{computed:[...d]}:{},...c.length>0?{durations:c}:{},...o.has(r)?{keptInStep:o.get(r)}:{},...p.derives?{derives:Pn(r,p.derives,e)}:{}}}let a={};for(let[r,p]of Object.entries(e.acts??{})){let y=yn(p,e),m=Kn(p,y,e,i),d=p.destructive??y.some(z=>"remove"in z||"sever"in z||"replace"in z),c=[...new Set(y.flatMap(z=>"create"in z?[z.create]:[]))],w=[...new Set(y.flatMap(z=>"connect"in z?[z.connect]:[]))],b=[...new Set(y.flatMap(z=>"sever"in z?[z.sever]:"replace"in z?z.replace:[]))],S=[...new Set(y.flatMap(z=>"set"in z&&!("create"in z)&&!("through"in z)&&F(z.target??"$subject")==="subject"?Object.keys(z.set):[]))],x=new Map;for(let z of y){if(!("connect"in z)&&!("sever"in z))continue;let A=i.get("connect"in z?z.connect:z.sever);for(let[M,ie]of[["from",z.from],["to",z.to]]){let W=F(ie),q=M==="to"?A?.to:A?.from;W&&W!=="subject"&&q&&q!=="*"&&x.set(W,[...new Set([...x.get(W)??[],...q])])}}let E={};for(let z of y){if(!("set"in z)||"create"in z||"through"in z)continue;let A=F(z.target??"$subject");for(let M of A&&A!=="subject"&&x.get(A)||[])E[M]=[...new Set([...E[M]??[],...Object.keys(z.set)])]}let v={};for(let z of y)if(!(!("set"in z)||"create"in z||"through"in z||F(z.target??"$subject")!=="subject"))for(let[A,M]of Object.entries(z.set??{}))typeof M=="string"&&F(M)===void 0||typeof M=="number"||typeof M=="boolean"?v[A]=typeof M=="string"&&M.startsWith("$$")?M.slice(1):M:delete v[A];let B=c.length===0&&y.every(z=>!("set"in z)||!z.set||Object.values(z.set).every(A=>!(A&&typeof A=="object"&&!Array.isArray(A)&&"expr"in A))),G=new Map;for(let z of y)if(!(!("set"in z)||!z.set))for(let A of Object.values(z.set))A&&typeof A=="object"&&!Array.isArray(A)&&"expr"in A&&G.set(A.expr,J(A.expr));a[r]={title:p.title??r.replace(/-/g," "),effects:y,args:[...m],...p.allowedWhen?{guard:J(p.allowedWhen)}:{},...p.refusal?{refusal:de(Q(p.refusal),e.kinds[[p.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...G],destructive:d,idempotent:B,creates:c,connects:w,severs:b,writes:S,writesOther:E,sets:v}}let u={};for(let[r,p]of Object.entries(e.rules??{})){let y=p.covers&&p.over!=="graph"?ye(p.over,p.covers,m=>i.get(m),m=>m in e.kinds):void 0;u[r]={title:p.title??r.replace(/-/g," "),...p.require?{require:J(p.require)}:{},...y&&"plan"in y?{covers:y.plan}:{},...p.when?{when:J(p.when)}:{},...p.says?{says:de(Q(p.says),e.kinds[p.over]?.fields)}:{}}}let f=Ze(e,s),g=Je(e),l=Xe(e);return{format:He,document:e,findings:s,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...i].map(([r,{from:p,to:y,cardinality:m}])=>[r,{from:p,to:y,cardinality:m}]),acts:a,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...l?{home:l}:{}}}function Yt(e,s,i){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],o=t?i.kinds[t]:void 0;if(!t||!o)return e;let a=Object.keys(o.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${a.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,s){let i=[],t=new Set(Object.values(s.kinds).flatMap(o=>Object.keys(o.edges??{})));for(let[o,a]of Object.entries(e.kinds)){let u=a.renamedFrom;u&&!s.kinds[u]&&i.push(k("renamed-from-nothing",`kinds.${o}.renamedFrom`,`${o} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??o];for(let[g,l]of Object.entries(a.fields)){let r=l.renamedFrom;r&&!f?.fields[r]&&i.push(k("renamed-from-nothing",`kinds.${o}.fields.${g}.renamedFrom`,`${g} says it was ${r}, and the previous ${u??o} has no field called ${r}`,"name the field it was, or drop renamedFrom"))}for(let[g,l]of Object.entries(a.edges??{})){let r=l.renamedFrom;r&&!t.has(r)&&i.push(k("renamed-from-nothing",`kinds.${o}.edges.${g}.renamedFrom`,`${g} says it was ${r}, and the previous version has no relation called ${r}`,"name the relation it was, or drop renamedFrom"))}}return i}export{Mn as a,Ht as b,yn as c,Wt as d,Yt as e};
@@ -1 +0,0 @@
1
- import{j as m}from"./chunk.KZUMXT5J.js";import{G as N,T as f,X as y}from"./chunk.CYTTZOYL.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var a=g(f(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,o]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);o(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let o=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:o||r,above:o&&e.scrollTop>1,below:o&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:o,children:r}){if(e===void 0)return(0,a.jsx)("strong",{style:o,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,a.jsx)(t,{style:{margin:0,...o},children:r})}function E({title:e,subtitle:l,meta:o,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:w,heading:b}){let c=(0,p.useRef)(null),{overflowing:v,above:x,below:S}=H(c),P=y(),n=(w??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),u=(0,p.useContext)(I);return(0,a.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":n?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:n?12:"var(--graview-gap, 7px)",height:n||s?"auto":"100%",maxHeight:n?"none":"100%",padding:n?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:n?0:"var(--graview-radius, 12px)",border:n?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:n?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:n?"visible":"hidden",...R[t],...n?{background:"transparent"}:{},...i},children:[t==="warning"?(0,a.jsx)("span",{"data-graview-broken":"",style:m,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,a.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,a.jsx)(O,{level:b,said:u===null||e!==u,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:n?"1.5625rem":"0.9375rem",lineHeight:n?1.15:1.25,fontWeight:n?600:560,letterSpacing:n?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),o===void 0?null:(0,a.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:o})]}),l===void 0?null:(0,a.jsx)("div",{style:{fontSize:n?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,a.jsx)("div",{ref:c,className:n?void 0:"graview-scroll",...v&&!n?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:n?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...n?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"},...!n&&!v?{overflow:"hidden"}:{}},"data-graview-more-above":x&&!n?"":void 0,"data-graview-more-below":S&&!n?"":void 0,children:d})]})}function h({label:e,hue:l,selected:o,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,a.jsxs)("span",{"data-graview-primitive":"chip","data-selected":o||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${o?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:o?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,a.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,a.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:o=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,a.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,a.jsx)(h,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:o.includes(i.id)},i.id)),d>0?(0,a.jsx)(h,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:o,onExpand:r,flagged:t,problems:d}){return(0,a.jsx)(E,{title:e,meta:d?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,a.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:o&&o.length>0?(0,a.jsx)(L,{items:o,max:6,pick:!0}):null})}export{A as a,I as b,E as c,h as d,L as e,F as f};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.KB5BCW23.js";import"./chunk.72YXFJKC.js";import"./chunk.JVDPRQ7J.js";import"./chunk.57YDGGJK.js";import"./chunk.H7AH3IW4.js";import"./chunk.4TH3CGAZ.js";import"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
@@ -1,9 +0,0 @@
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 ie}from"./chunk.OXWOUE3W.js";import{a as X,c as H,d as J,e as Q}from"./chunk.ZZAI57VI.js";import"./chunk.34DRUCH2.js";import"./chunk.KXFNRJ46.js";import"./chunk.OMRQTLI5.js";import"./chunk.MIE3ODQ2.js";import"./chunk.NEPQBMFT.js";import"./chunk.2PJ6STKA.js";import"./chunk.MBB5A6BT.js";import"./chunk.ERPILTRY.js";import"./chunk.H7AH3IW4.js";import"./chunk.U5P23GO7.js";import"./chunk.GZHZLJBF.js";import"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{F as K,G as q,Ia as z,Ra as U,T as x,U as F,Va as Y,ba as b,c as j,x as V}from"./chunk.CYTTZOYL.js";import{a as N}from"./chunk.SDO3U72B.js";import{Ib as W,cb as _,db as D,ga as I,la as G,pa as B}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var ae=w(q(),1);function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var M=w(x(),1);function Z(){let{seats:e,principal:t,takeSeat:i}=b();return e.length<2?null:(0,M.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,M.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(a=>{let l=oe(t,a.principal);return(0,M.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...P(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function oe(e,t){return e.kind===t.kind&&e.id===t.id}var E=w(q(),1),c=w(x(),1),se=`
2
- .graview-here{display:flex;flex:none}
3
- .graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
4
- .graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
5
- .graview-here-mark+.graview-here-mark{margin-left:-10px}
6
- .graview-here-mark[data-agent]{border-radius:5px}
7
- .graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
8
- .graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
9
- .graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=V(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=D(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(O,{one:r},r.participant))}):(0,c.jsx)(O,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(O,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function me(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function L(e,t,i,a,l,d){let s=me(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},ne=500,ye=10;function fe(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},L(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?L(t,p,l,d):L(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.K7TK3KRB.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WYPCLZL7.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(J,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>I(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Z,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:we}}),"Graview"]})]}):null]})})}var we='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',re={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};