graview 0.1.66 → 0.1.68

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 (197) hide show
  1. package/dist/preview/{chunk.OJY7VJ7D.js → chunk.2BMZPALF.js} +1 -1
  2. package/dist/preview/{chunk.OTV5XTBB.js → chunk.2KCDLCB2.js} +1 -1
  3. package/dist/preview/{chunk.WVLEGCRI.js → chunk.2ME4DVBI.js} +1 -1
  4. package/dist/preview/chunk.2TUEBU7X.js +8 -0
  5. package/dist/preview/{chunk.QHMHUL6B.js → chunk.2U6HB4XU.js} +1 -1
  6. package/dist/preview/{chunk.ZQR2SN65.js → chunk.32JE2WS7.js} +1 -1
  7. package/dist/preview/{chunk.OEIWIZCP.js → chunk.3DEWQDP7.js} +1 -1
  8. package/dist/preview/{chunk.2VR7YEJ6.js → chunk.3JMQKANL.js} +1 -1
  9. package/dist/preview/chunk.3VEZ5MOC.js +25 -0
  10. package/dist/preview/chunk.3WPCS6KP.js +1 -0
  11. package/dist/preview/{chunk.FXT5CN32.js → chunk.42C3FIKK.js} +1 -1
  12. package/dist/preview/{chunk.QQAZQDRW.js → chunk.42KHFGN6.js} +1 -1
  13. package/dist/preview/{chunk.ANS2IEEV.js → chunk.4DXPPM6T.js} +1 -1
  14. package/dist/preview/chunk.4GVKKBQL.js +1 -0
  15. package/dist/preview/{chunk.5CXIEYHY.js → chunk.4TT3ZHSJ.js} +2 -2
  16. package/dist/preview/{chunk.OMT4QUZY.js → chunk.4YAO3A5Q.js} +4 -4
  17. package/dist/preview/{chunk.M2JCFNHJ.js → chunk.5JKUT2OM.js} +1 -1
  18. package/dist/preview/chunk.5L4ADKTW.js +1 -0
  19. package/dist/preview/{chunk.YNEHJWJV.js → chunk.64LCHHZB.js} +1 -1
  20. package/dist/preview/{chunk.6HY6ZGEE.js → chunk.6AANHELP.js} +1 -1
  21. package/dist/preview/{chunk.6TLXFMX2.js → chunk.6DMCEBSO.js} +1 -1
  22. package/dist/preview/{chunk.IWYMKGZZ.js → chunk.6IR5LBJU.js} +1 -1
  23. package/dist/preview/{chunk.YIPXZUTT.js → chunk.6WB2TYK7.js} +1 -1
  24. package/dist/preview/chunk.6ZENHSTQ.js +1 -0
  25. package/dist/preview/{chunk.7ZKBYXUM.js → chunk.7K2V5FUB.js} +1 -1
  26. package/dist/preview/chunk.7OL6H4LF.js +1 -0
  27. package/dist/preview/{chunk.FBILPNGH.js → chunk.7TDML5YU.js} +1 -1
  28. package/dist/preview/{chunk.45JP6VGJ.js → chunk.7WPVLEX2.js} +2 -2
  29. package/dist/preview/{chunk.W4YDPHCQ.js → chunk.7ZTGB4O7.js} +1 -1
  30. package/dist/preview/{chunk.4FDVINRJ.js → chunk.ACNOP2IU.js} +1 -1
  31. package/dist/preview/{chunk.AK7NGFEX.js → chunk.AENP662H.js} +1 -1
  32. package/dist/preview/{chunk.MWGZKZD6.js → chunk.AQ2PI6MR.js} +1 -1
  33. package/dist/preview/chunk.ARS4HJD2.js +1 -0
  34. package/dist/preview/{chunk.FDZE5LTJ.js → chunk.AWV57UBJ.js} +2 -2
  35. package/dist/preview/{chunk.C2C3AXGI.js → chunk.AYZL3LCR.js} +3 -3
  36. package/dist/preview/{chunk.FIFUMX5X.js → chunk.BHJRT57H.js} +1 -1
  37. package/dist/preview/{chunk.IAEHUSQQ.js → chunk.BPNW5KCP.js} +1 -1
  38. package/dist/preview/{chunk.HOCD7KIR.js → chunk.BQAFFEOA.js} +1 -1
  39. package/dist/preview/chunk.C2QKA6XY.js +1 -0
  40. package/dist/preview/{chunk.NJRLJEJY.js → chunk.CE3NKAF7.js} +1 -1
  41. package/dist/preview/{chunk.5LJVOLKR.js → chunk.CFE3MHWZ.js} +1 -1
  42. package/dist/preview/{chunk.DQFHIJFN.js → chunk.CGBOPPNL.js} +1 -1
  43. package/dist/preview/{chunk.V7W5AQKL.js → chunk.CNN32262.js} +1 -1
  44. package/dist/preview/{chunk.6EHHMWPP.js → chunk.DCLF4WWZ.js} +1 -1
  45. package/dist/preview/{chunk.OO2OP76C.js → chunk.DGDW54KE.js} +1 -1
  46. package/dist/preview/{chunk.XMQG2PSM.js → chunk.DLSS56EU.js} +1 -1
  47. package/dist/preview/{chunk.WSO7JOW5.js → chunk.DMZRFXH7.js} +1 -1
  48. package/dist/preview/{chunk.DEHIR4EG.js → chunk.DPHH5ZVL.js} +1 -1
  49. package/dist/preview/{chunk.XOE4KNP2.js → chunk.DZ6UDZOB.js} +2 -2
  50. package/dist/preview/{chunk.WAB3L3ZI.js → chunk.E423JCOS.js} +1 -1
  51. package/dist/preview/{chunk.CTASTRQN.js → chunk.EB7PZJEO.js} +1 -1
  52. package/dist/preview/{chunk.QPF4KSAW.js → chunk.ECNGVD25.js} +1 -1
  53. package/dist/preview/{chunk.JXNVNFV4.js → chunk.EGSOHTZZ.js} +1 -1
  54. package/dist/preview/{chunk.CEVGND3Y.js → chunk.EGVM24ND.js} +3 -3
  55. package/dist/preview/{chunk.6LXIEM6B.js → chunk.ENLIIZF2.js} +1 -1
  56. package/dist/preview/{chunk.GME63ZHI.js → chunk.EP5JS7ZH.js} +1 -1
  57. package/dist/preview/{chunk.QGIM2WAY.js → chunk.F5GNNVSQ.js} +1 -1
  58. package/dist/preview/chunk.FHQ25SWY.js +1 -0
  59. package/dist/preview/{chunk.OOSIKCOS.js → chunk.FSW535EA.js} +1 -1
  60. package/dist/preview/{chunk.ZD7T234N.js → chunk.FZELUSK5.js} +1 -1
  61. package/dist/preview/{chunk.LINSO5PN.js → chunk.G2BDEWJC.js} +1 -1
  62. package/dist/preview/chunk.GF3ZCX46.js +2 -0
  63. package/dist/preview/{chunk.J7W2OFHY.js → chunk.GJTEV6CK.js} +1 -1
  64. package/dist/preview/{chunk.VKZIEZ5C.js → chunk.GKTQ5CZA.js} +2 -2
  65. package/dist/preview/{chunk.GEFXU4VO.js → chunk.GONZB3J3.js} +1 -1
  66. package/dist/preview/{chunk.VGHO3VCB.js → chunk.GRBWXTST.js} +1 -1
  67. package/dist/preview/{chunk.YXEO3Y65.js → chunk.GRTBEA7O.js} +1 -1
  68. package/dist/preview/chunk.H3IGXHZR.js +93 -0
  69. package/dist/preview/{chunk.QFHWG4LN.js → chunk.H3W5C3XQ.js} +1 -1
  70. package/dist/preview/{chunk.TGEL6EUA.js → chunk.H4VNIAHN.js} +1 -1
  71. package/dist/preview/{chunk.IGK7EZCX.js → chunk.HH4D3JEI.js} +1 -1
  72. package/dist/preview/{chunk.F4VB6Q2W.js → chunk.HWFJQ42Y.js} +1 -1
  73. package/dist/preview/{chunk.OWFS2YDQ.js → chunk.HXTKBISQ.js} +1 -1
  74. package/dist/preview/{chunk.ZR2TP3BF.js → chunk.I34BWUB4.js} +1 -1
  75. package/dist/preview/{chunk.EXYCN4WI.js → chunk.I63462I3.js} +1 -1
  76. package/dist/preview/{chunk.7VADSNPZ.js → chunk.IKKKHHRN.js} +1 -1
  77. package/dist/preview/{chunk.FK722SHI.js → chunk.IPGLITWA.js} +1 -1
  78. package/dist/preview/{chunk.BXBEGMPO.js → chunk.IT5DVKXY.js} +2 -2
  79. package/dist/preview/{chunk.LLIURXFP.js → chunk.IXMIU4D4.js} +1 -1
  80. package/dist/preview/{chunk.INHS3KTK.js → chunk.JCETQQ7J.js} +1 -1
  81. package/dist/preview/{chunk.PPSYUOH7.js → chunk.JGRSUTPJ.js} +1 -1
  82. package/dist/preview/{chunk.4U4D7WOI.js → chunk.JLDJZET2.js} +1 -1
  83. package/dist/preview/{chunk.Z7Y3R3YR.js → chunk.JULD4XFB.js} +1 -1
  84. package/dist/preview/{chunk.PAGEGBUD.js → chunk.JV432T4Q.js} +1 -1
  85. package/dist/preview/{chunk.4FCFNAA4.js → chunk.KAM73WVF.js} +1 -1
  86. package/dist/preview/{chunk.6P6NGZ6D.js → chunk.KUCBNMIY.js} +1 -1
  87. package/dist/preview/{chunk.I2737CPF.js → chunk.L7XKYGV7.js} +1 -1
  88. package/dist/preview/{chunk.7VP6Y6D2.js → chunk.LFFJB6D3.js} +1 -1
  89. package/dist/preview/{chunk.BFAFCVL4.js → chunk.LMTG5NPG.js} +1 -1
  90. package/dist/preview/{chunk.QOS5T46W.js → chunk.LOKGUALC.js} +1 -1
  91. package/dist/preview/chunk.LZ6MSQ5O.js +1 -0
  92. package/dist/preview/chunk.MBTEOF4R.js +1 -0
  93. package/dist/preview/{chunk.PFQBCHQA.js → chunk.MIOLBZBS.js} +1 -1
  94. package/dist/preview/{chunk.PDDIQ6PK.js → chunk.MK5RPEB2.js} +1 -1
  95. package/dist/preview/{chunk.FV72U33M.js → chunk.MKL4THIV.js} +1 -1
  96. package/dist/preview/{chunk.2MHNPBHC.js → chunk.MPWLDQOG.js} +1 -1
  97. package/dist/preview/chunk.MSUZAJ2K.js +4 -0
  98. package/dist/preview/{chunk.EMFOMSMI.js → chunk.N5Z34V7U.js} +1 -1
  99. package/dist/preview/chunk.N64RVSH3.js +1 -0
  100. package/dist/preview/{chunk.5B5SRTUK.js → chunk.ND3DEDWB.js} +1 -1
  101. package/dist/preview/{chunk.3L4JMM3P.js → chunk.NFTPJAMJ.js} +1 -1
  102. package/dist/preview/{chunk.J2MM6BUW.js → chunk.NRCWMYLH.js} +1 -1
  103. package/dist/preview/{chunk.OPTYYIGC.js → chunk.O2VXTYUJ.js} +1 -1
  104. package/dist/preview/{chunk.4AC2QM7T.js → chunk.O32F6LGK.js} +1 -1
  105. package/dist/preview/{chunk.W53YNBSM.js → chunk.O5FTWXA2.js} +1 -1
  106. package/dist/preview/{chunk.U6TEW6YD.js → chunk.ODYJEDIW.js} +1 -1
  107. package/dist/preview/{chunk.E7EWNWAN.js → chunk.OQ4ZO3YY.js} +1 -1
  108. package/dist/preview/chunk.PI4RFOBU.js +1 -0
  109. package/dist/preview/{chunk.BMENTGDC.js → chunk.PIMAG4WT.js} +2 -2
  110. package/dist/preview/{chunk.DTCAUPLC.js → chunk.PLIV3IQK.js} +1 -1
  111. package/dist/preview/{chunk.4JULYKGD.js → chunk.PPCDPYYU.js} +1 -1
  112. package/dist/preview/{chunk.BGAC3B7X.js → chunk.PZQ5P6WK.js} +1 -1
  113. package/dist/preview/chunk.Q42R2KW4.js +1 -0
  114. package/dist/preview/{chunk.2KFZHUAC.js → chunk.Q4VFLLUT.js} +1 -1
  115. package/dist/preview/{chunk.ONYBW45K.js → chunk.Q6H5HESF.js} +1 -1
  116. package/dist/preview/chunk.QM54TGU6.js +3 -0
  117. package/dist/preview/{chunk.6MQ5NT7S.js → chunk.QOQ26NXM.js} +1 -1
  118. package/dist/preview/{chunk.FFOD5B4B.js → chunk.QUETLFBJ.js} +1 -1
  119. package/dist/preview/{chunk.DSYP43NN.js → chunk.QWLK3GKG.js} +1 -1
  120. package/dist/preview/{chunk.RWIN3POV.js → chunk.QYPU444Y.js} +1 -1
  121. package/dist/preview/{chunk.ES63XSIM.js → chunk.QZP3ARLH.js} +1 -1
  122. package/dist/preview/{chunk.CVPMSPCH.js → chunk.R3GE37OI.js} +1 -1
  123. package/dist/preview/chunk.R66ZVMWB.js +1 -0
  124. package/dist/preview/chunk.RD2FSSLV.js +1 -0
  125. package/dist/preview/{chunk.72ZCLEQC.js → chunk.RQG672MJ.js} +1 -1
  126. package/dist/preview/chunk.RYA7A4NA.js +1 -0
  127. package/dist/preview/{chunk.BUVTUAB5.js → chunk.SADR3MQI.js} +1 -1
  128. package/dist/preview/{chunk.EQ4OODGO.js → chunk.SS6KL5NT.js} +1 -1
  129. package/dist/preview/chunk.SUG6LIOX.js +1 -0
  130. package/dist/preview/{chunk.WSDJPXJD.js → chunk.TFJA4QV4.js} +1 -1
  131. package/dist/preview/{chunk.3PBTN7RO.js → chunk.TOUSIUJF.js} +1 -1
  132. package/dist/preview/{chunk.CU2WCYMK.js → chunk.TR4YFVZN.js} +1 -1
  133. package/dist/preview/{chunk.GNEOSHQ6.js → chunk.TRNJKHIA.js} +1 -1
  134. package/dist/preview/{chunk.72XP2ARZ.js → chunk.TVWK3SGD.js} +1 -1
  135. package/dist/preview/chunk.U7PAFLUM.js +1 -0
  136. package/dist/preview/{chunk.QU52E5RG.js → chunk.UAMPR4MD.js} +1 -1
  137. package/dist/preview/{chunk.KBPJ7X7W.js → chunk.UD7VLXPM.js} +1 -1
  138. package/dist/preview/{chunk.M6ZN2KUO.js → chunk.UFURYU4R.js} +1 -1
  139. package/dist/preview/{chunk.6FQW6FNL.js → chunk.UODTUBQ7.js} +1 -1
  140. package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
  141. package/dist/preview/{chunk.KSIEO5W7.js → chunk.VES4XMZX.js} +1 -1
  142. package/dist/preview/chunk.VLXLBGMY.js +90 -0
  143. package/dist/preview/{chunk.QWNSHISU.js → chunk.VTDOWXCP.js} +1 -1
  144. package/dist/preview/{chunk.5FNFRVTL.js → chunk.VV5JAM5W.js} +1 -1
  145. package/dist/preview/{chunk.DZFM6GSY.js → chunk.VW632VNJ.js} +1 -1
  146. package/dist/preview/{chunk.LSN2IPAI.js → chunk.WC5WE34A.js} +1 -1
  147. package/dist/preview/chunk.WN7SAAH6.js +1 -0
  148. package/dist/preview/{chunk.B6JRTW3A.js → chunk.WV45KLXC.js} +1 -1
  149. package/dist/preview/{chunk.TXHYGFIZ.js → chunk.XDZDNZ7B.js} +1 -1
  150. package/dist/preview/{chunk.7BIPZTJB.js → chunk.XFH6GHBQ.js} +1 -1
  151. package/dist/preview/{chunk.HSSIMVVM.js → chunk.XRE7SHLD.js} +1 -1
  152. package/dist/preview/{chunk.LETAQTLJ.js → chunk.XXCHO2A5.js} +1 -1
  153. package/dist/preview/{chunk.KACSYPEV.js → chunk.Y7OGJOPA.js} +1 -1
  154. package/dist/preview/{chunk.LGRVEHXT.js → chunk.YBQ5GVAX.js} +2 -2
  155. package/dist/preview/{chunk.PSQYDCVM.js → chunk.YL2RBZFE.js} +1 -1
  156. package/dist/preview/{chunk.BZ7QWHAE.js → chunk.YM6SWEUI.js} +1 -1
  157. package/dist/preview/{chunk.CBXS23YH.js → chunk.Z2X7BFCB.js} +2 -2
  158. package/dist/preview/{chunk.U3ED7W2U.js → chunk.Z67LBSQO.js} +1 -1
  159. package/dist/preview/chunk.ZKXIZBCN.js +1 -0
  160. package/dist/preview/{chunk.E3UL4MCD.js → chunk.ZLEBOR5T.js} +1 -1
  161. package/dist/preview/{chunk.5BX66FBP.js → chunk.ZLNUZ6LR.js} +1 -1
  162. package/dist/preview/chunk.ZMADWPJO.js +1 -0
  163. package/dist/preview/chunk.ZO6VMEPP.js +1 -0
  164. package/dist/preview/chunk.ZUG7U7AT.js +1 -0
  165. package/dist/preview/index.html +56 -56
  166. package/dist/preview/page.js +2 -2
  167. package/package.json +6 -6
  168. package/dist/preview/chunk.4WGYUYWU.js +0 -2
  169. package/dist/preview/chunk.5EMIWORS.js +0 -1
  170. package/dist/preview/chunk.6EVMXBNB.js +0 -1
  171. package/dist/preview/chunk.BCQWAFGD.js +0 -1
  172. package/dist/preview/chunk.BOCVLC7X.js +0 -1
  173. package/dist/preview/chunk.DPJNGFEZ.js +0 -4
  174. package/dist/preview/chunk.E4VRRWFP.js +0 -1
  175. package/dist/preview/chunk.EUAO4QNV.js +0 -1
  176. package/dist/preview/chunk.F7672TKJ.js +0 -1
  177. package/dist/preview/chunk.FA42HCPW.js +0 -1
  178. package/dist/preview/chunk.FBJAQPZ6.js +0 -1
  179. package/dist/preview/chunk.GAFMWOME.js +0 -1
  180. package/dist/preview/chunk.I4Z7HVRT.js +0 -1
  181. package/dist/preview/chunk.JMXXA4YG.js +0 -1
  182. package/dist/preview/chunk.JMYUQNXN.js +0 -6
  183. package/dist/preview/chunk.K6DFXDPZ.js +0 -1
  184. package/dist/preview/chunk.KF27ME27.js +0 -1
  185. package/dist/preview/chunk.L25DCT5S.js +0 -1
  186. package/dist/preview/chunk.MODLZJD4.js +0 -25
  187. package/dist/preview/chunk.OJGHDWI6.js +0 -1
  188. package/dist/preview/chunk.SSF47GUY.js +0 -1
  189. package/dist/preview/chunk.T6DPWW2K.js +0 -3
  190. package/dist/preview/chunk.TA36WBHK.js +0 -1
  191. package/dist/preview/chunk.TTGKX7LT.js +0 -1
  192. package/dist/preview/chunk.U3HERHAI.js +0 -88
  193. package/dist/preview/chunk.V5I4GZEY.js +0 -1
  194. package/dist/preview/chunk.VT2YGDK2.js +0 -1
  195. package/dist/preview/chunk.XK65Y2KX.js +0 -1
  196. package/dist/preview/chunk.Z274CL7J.js +0 -1
  197. package/dist/preview/chunk.ZBVYD4OX.js +0 -90
@@ -1,3 +1,3 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as j,e as B}from"./chunk.7VADSNPZ.js";import{t as I}from"./chunk.U3HERHAI.js";import{G as J,La as M,Ua as R,W as b,Ya as $,ea as A,ga as H}from"./chunk.MODLZJD4.js";import{a as L}from"./chunk.SDO3U72B.js";import{b as c}from"./chunk.AJZBJBMO.js";var t=c(J(),1);var S=c(b(),1),E=M(L(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.6EHHMWPP.js","./chunk.TXHYGFIZ.js","./chunk.WAB3L3ZI.js","./chunk.W53YNBSM.js","./chunk.2KFZHUAC.js","./chunk.V5I4GZEY.js","./chunk.QOS5T46W.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.U3HERHAI.js","./chunk.FBILPNGH.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F7672TKJ.js")))),W=E.part((a,n)=>(0,S.jsx)(a.SuggestedCount,{...n}),{quiet:!0}),ro=E.part((a,n)=>(0,S.jsx)(a.SuggestedList,{...n}),{quiet:!0,as:"div"});var o=c(b(),1),K=I.part((a,n)=>(0,o.jsx)(a.InboxPane,{...n}),{what:"The inbox"}),Q=[],U=[],oo=a=>a>99?"99+":String(a);function to(a,n){let d=[a>0?`${a} waiting for you`:"",n>0?`${n===1?"1 change":`${n} changes`}`:""].filter(Boolean);return d.length>0?`Inbox \u2014 ${d.join(", ")}`:"Inbox"}function po({calls:a=Q,seat:n,remembers:d=!1}){let{store:C,principal:f,whileAway:V,notifications:m=U,onNotificationsSeen:y,ai:Y}=A(),_=H(),r=B({calls:a,seat:n,remembers:d}),N=j(),q=Y.off!==!0,p=(0,t.useMemo)(()=>f.id===void 0?[]:N.filter(e=>e.by.id===f.id||e.by.onBehalfOf?.id===f.id),[N,f.id]),F=(0,t.useMemo)(()=>C.log.all().some(e=>e.suggests!==void 0&&!e.withheld),[C,_]),h=(V?.tidied??0)>0,v=F||h,[G,z]=(0,t.useState)(0),g=m.filter(e=>!e.read),u=G+g.length,x=u+r.recent,i=$("inbox"),s=i.open,[l,P]=(0,t.useState)("activity"),w=(0,t.useRef)(!1);if(s&&!w.current){w.current=!0;let e=u>0||h?"for-you":r.has?"activity":p.length>0?"asks":"for-you";e!==l&&P(e)}s||(w.current=!1);let T=(0,t.useRef)("");(0,t.useEffect)(()=>{if(!s||l!=="for-you"||g.length===0||!y)return;let e=g.map(Z=>Z.id);T.current!==e.join(`
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as j,e as B}from"./chunk.IKKKHHRN.js";import{t as I}from"./chunk.H3IGXHZR.js";import{G as J,La as M,Ua as R,W as b,Ya as $,ea as A,ga as H}from"./chunk.3VEZ5MOC.js";import{a as L}from"./chunk.SDO3U72B.js";import{b as c}from"./chunk.AJZBJBMO.js";var t=c(J(),1);var S=c(b(),1),E=M(L(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.DCLF4WWZ.js","./chunk.XDZDNZ7B.js","./chunk.E423JCOS.js","./chunk.O5FTWXA2.js","./chunk.Q4VFLLUT.js","./chunk.6ZENHSTQ.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4GVKKBQL.js")))),W=E.part((a,n)=>(0,S.jsx)(a.SuggestedCount,{...n}),{quiet:!0}),ro=E.part((a,n)=>(0,S.jsx)(a.SuggestedList,{...n}),{quiet:!0,as:"div"});var o=c(b(),1),K=I.part((a,n)=>(0,o.jsx)(a.InboxPane,{...n}),{what:"The inbox"}),Q=[],U=[],oo=a=>a>99?"99+":String(a);function to(a,n){let d=[a>0?`${a} waiting for you`:"",n>0?`${n===1?"1 change":`${n} changes`}`:""].filter(Boolean);return d.length>0?`Inbox \u2014 ${d.join(", ")}`:"Inbox"}function po({calls:a=Q,seat:n,remembers:d=!1}){let{store:C,principal:f,whileAway:V,notifications:m=U,onNotificationsSeen:y,ai:Y}=A(),_=H(),r=B({calls:a,seat:n,remembers:d}),N=j(),q=Y.off!==!0,p=(0,t.useMemo)(()=>f.id===void 0?[]:N.filter(e=>e.by.id===f.id||e.by.onBehalfOf?.id===f.id),[N,f.id]),F=(0,t.useMemo)(()=>C.log.all().some(e=>e.suggests!==void 0&&!e.withheld),[C,_]),h=(V?.tidied??0)>0,v=F||h,[G,z]=(0,t.useState)(0),g=m.filter(e=>!e.read),u=G+g.length,x=u+r.recent,i=$("inbox"),s=i.open,[l,P]=(0,t.useState)("activity"),w=(0,t.useRef)(!1);if(s&&!w.current){w.current=!0;let e=u>0||h?"for-you":r.has?"activity":p.length>0?"asks":"for-you";e!==l&&P(e)}s||(w.current=!1);let T=(0,t.useRef)("");(0,t.useEffect)(()=>{if(!s||l!=="for-you"||g.length===0||!y)return;let e=g.map(Z=>Z.id);T.current!==e.join(`
2
2
  `)&&(T.current=e.join(`
3
3
  `),y(e))},[s,l,g,y]);let D=(0,t.useCallback)(()=>i.setOpen(!1),[i]),X=(0,t.useCallback)(e=>z(e),[]);if(!(r.has||v||m.length>0||p.length>0))return null;let k=to(u,r.recent),O=()=>I.prefetch();return(0,o.jsxs)("div",{className:"graview-bar-inbox",style:{position:"relative"},children:[v?(0,o.jsx)(t.Suspense,{fallback:null,children:(0,o.jsx)(W,{onCount:X})}):null,(0,o.jsxs)("button",{type:"button",className:"graview-bar-tool","data-testid":"inbox-button","data-count":x,...i.trigger,onClick:i.toggle,onPointerEnter:O,onFocus:O,"aria-label":r.running?`${k} \u2014 an agent is working`:k,title:r.running?"Inbox \u2014 an agent is working":k,...r.running?{"data-running":""}:{},children:[(0,o.jsx)(eo,{}),x>0?(0,o.jsx)("span",{className:"graview-bar-badge","data-testid":"inbox-count","aria-hidden":"true",children:oo(x)}):r.running?(0,o.jsx)("span",{className:"graview-bar-badge","data-dot":"","aria-hidden":"true"}):null]}),(!s||l!=="activity")&&n!==void 0?(0,o.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,s?(0,o.jsx)("section",{...i.pane,"aria-label":"Inbox","data-testid":"inbox","data-graview-offstage":"","data-tab":l,tabIndex:-1,style:{...R,width:"min(360px, calc(100vw - 16px))",maxHeight:"min(70vh, 520px)",overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column",padding:0,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",outline:"none"},children:(0,o.jsx)(t.Suspense,{fallback:null,children:(0,o.jsx)(K,{tab:l,choose:P,asksOn:q,counts:{"for-you":u,activity:r.recent,asks:p.length},notifications:m,asks:p,tray:v,waits:u>0||h,activityHas:r.has,calls:a,remembers:d,close:D,...n!==void 0?{seat:n}:{}})})}):null]})}function eo(){return(0,o.jsxs)("svg",{width:16,height:16,viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:[(0,o.jsx)("path",{d:"M4 11.25 V7.25 a4 4 0 0 1 8 0 V11.25 L13.25 12.5 H2.75 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M6.5 14 h3",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}export{ro as a,po as b};
@@ -1,2 +1,2 @@
1
- import{g as F,l as b}from"./chunk.OEIWIZCP.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],g=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&g&&r.push(g),(l.fn==="out"||l.fn==="in")&&g&&s.push(g),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
1
+ import{g as F,l as b}from"./chunk.3DEWQDP7.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],g=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&g&&r.push(g),(l.fn==="out"||l.fn==="in")&&g&&s.push(g),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
2
2
  `||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let a=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(a,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,a,t);o.push({k:"num",v:l,at:a});continue}if(r==="'"||r==='"'){let a=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",a,t);e++,o.push({k:"str",v:i,at:a});continue}if(/[A-Za-z_]/.test(r)){let a=e;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(a,e),l=Object.hasOwn(j,i)?j[i]:void 0;o.push(l?{k:"op",v:l,at:a}:{k:"id",v:i,at:a});continue}let s=D.find(a=>t.startsWith(a,e));if(!s)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:s,at:e}),e+=s.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>T)throw new p(`an expression may be at most ${T} characters`,0,t.slice(0,40));let o=H(t),e=0,r=()=>o[e],s=n=>{let d=r();return d.k==="op"&&d.v===n},a=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!s(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let m=d();for(;;){let y=r(),S=y.k==="op"?n.find(q=>q===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!S)return m;e++,m={t:"binary",op:S,left:m,right:d(),at:y.at}}},g=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(s("(")){e++;let d=[];if(!s(")"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!s("]"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=g();for(;;){if(s(".")){let d=r();e++;let m=r();if(m.k!=="id")throw new p('expected a field name after "."',m.at,t);e++,n={t:"member",object:n,name:m.v,at:d.at};continue}if(a("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},P=c(["*","/","%"],k),z=c(["+","-"],P),N=c(["&"],z),R=c(["|"],N),_=()=>{let n=R(),d=r(),m=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return m?(e++,{t:"binary",op:m,left:n,right:R(),at:d.at}):n},O=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,O),at:n.at}):_()},B=c(["&&"],O),I=c(["||"],B);function h(){return I()}let K=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return K}function E(t){let o,e=-1,r=0;for(let s=0;s<t.length;s++){let a=t[s];if(o){a==="\\"?s++:a===o&&(o=void 0);continue}a==="'"||a==='"'?o=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:a==="|"&&r===0&&(t[s+1]==="|"?s++:e=s)}if(e>0&&t.slice(e+1).trim()===x){let s=E(t.slice(0,e));if(s>=0)return s}return e}var x="capital",$=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function U(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...C(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:C(t)}function C(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let s=t.slice(o+1).trim();if(!/^\d+$/.test(s)||Number(s)<20||Number(s)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(s)}else if(o>=0&&e==="money"){if(t.slice(o+1).trim()!=="0")throw new u("money is told 0 for whole units, rounded \u2014 {total | money: 0} \u2014 or nothing, for cents only where a sum has them");r.push("0")}else if(o>=0){let s=t.slice(o+1),a=0;for(;a<s.length;){$.lastIndex=a;let i=$.exec(s);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),a=$.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&e!=="money"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function Y(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let s=t.indexOf("}",r);if(s<0)throw new u(`a "{" at character ${r+1} is never closed`);let a=t.slice(r+1,s),i=E(a),l=(i>=0?a.slice(0,i):a).trim(),f=i>=0?U(a.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=s+1}return o}function A(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function re(t){let o=A(t);if(o.size===0)return;let e=new Map;for(let[r,s]of o)try{e.set(r,w(s.expr))}catch(a){if(!(a instanceof p))throw a}return e}function Z(t,o,e=new Set){let r=A(t).get(o);if(!r||e.has(o))return!1;let s;try{s=w(r.expr)}catch{return!1}let a=M(s);if(a.edges.length>0||a.sweeps.length>0||[...a.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...a.names].every(c=>l(c)||Z(t,c,f))}export{M as a,p as b,w as c,u as d,Y as e,A as f,re as g,Z as h};
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{F as g,G as T,La as C,W as v,fa as S}from"./chunk.MODLZJD4.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.MWGZKZD6.js","./chunk.QFHWG4LN.js","./chunk.YIPXZUTT.js","./chunk.BJUUSIQY.js","./chunk.EMFOMSMI.js","./chunk.PSQYDCVM.js","./chunk.QOS5T46W.js","./chunk.PPSYUOH7.js","./chunk.XOZU4OFA.js","./chunk.GME63ZHI.js","./chunk.NJRLJEJY.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.U3HERHAI.js","./chunk.FBILPNGH.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.INHS3KTK.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
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{F as g,G as T,La as C,W as v,fa as S}from"./chunk.3VEZ5MOC.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.AQ2PI6MR.js","./chunk.H3W5C3XQ.js","./chunk.6WB2TYK7.js","./chunk.BJUUSIQY.js","./chunk.N5Z34V7U.js","./chunk.YL2RBZFE.js","./chunk.LOKGUALC.js","./chunk.JGRSUTPJ.js","./chunk.XOZU4OFA.js","./chunk.EP5JS7ZH.js","./chunk.CE3NKAF7.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.JCETQQ7J.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
@@ -1 +1 @@
1
- import"./chunk.WSDJPXJD.js";import"./chunk.F4VB6Q2W.js";import"./chunk.FFOD5B4B.js";import{a as m}from"./chunk.Z7Y3R3YR.js";import"./chunk.YXEO3Y65.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{W as p}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{Z as l}from"./chunk.6HY6ZGEE.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
+ import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import{a as m}from"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{W as p}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{Z as l}from"./chunk.6AANHELP.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 +1 @@
1
- var s="graview:pins",t={pinned:[],unpinned:[]},p=e=>Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function f(){try{let e=globalThis.localStorage?.getItem(s);if(!e)return t;let o=JSON.parse(e);if(Array.isArray(o))return{pinned:p(o),unpinned:[]};if(typeof o=="object"&&o!==null){let n=o;return{pinned:p(n.pinned),unpinned:p(n.unpinned)}}return t}catch{return t}}function a(e){try{globalThis.localStorage?.setItem(s,JSON.stringify(e))}catch{}}function u(e,o,n=!1){let r=l=>l.filter(d=>d!==o),i=n?e.unpinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:r(e.pinned),unpinned:[...e.unpinned,o]}:e.pinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:[...e.pinned,o],unpinned:r(e.unpinned)};return a(i),i}export{f as a,u as b};
1
+ var s="graview:pins",t={pinned:[],unpinned:[]},i=e=>Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function f(){try{let e=globalThis.localStorage?.getItem(s);if(!e)return t;let o=JSON.parse(e);if(Array.isArray(o))return{pinned:i(o),unpinned:[]};if(typeof o=="object"&&o!==null){let n=o;return{pinned:i(n.pinned),unpinned:i(n.unpinned)}}return t}catch{return t}}function a(e){try{globalThis.localStorage?.setItem(s,JSON.stringify(e))}catch{}}function u(e,o,n=!1){let r=l=>l.filter(d=>d!==o),p=n?e.unpinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:r(e.pinned),unpinned:[...e.unpinned,o]}:e.pinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:[...e.pinned,o],unpinned:r(e.unpinned)};return a(p),p}export{f as a,u as b};
@@ -1 +1 @@
1
- import{Zc as g}from"./chunk.6HY6ZGEE.js";function b(){let t=new Uint8Array(16);return globalThis.crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}function k(t,e){if(!t)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};"record"in e?t.record(e.record,i):"list"in e?t.list(e.list,i):t.place(e.place,i)}function w(t,e){if(!t?.href)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};return t.href("record"in e?{record:e.record}:"list"in e?{list:e.list}:{place:e.place},i)}var v=[["accent","--graview-accent"],["ground","--graview-ground"],["panel","--graview-panel"],["ink","--graview-ink"],["inkMuted","--graview-ink-muted"],["edge","--graview-edge"],["fontBody","--graview-font-body"],["fontDisplay","--graview-font-display"],["fontMono","--graview-font-mono"],["radius","--graview-radius"]];function B(t){let e=t.ownerDocument.defaultView,i=e.getComputedStyle(t),s=t.closest("[data-graview-scheme]")?.getAttribute("data-graview-scheme"),d={scheme:s==="dark"||s==="light"?s:/\bdark\b/.test(i.colorScheme??"")?"dark":/\blight\b/.test(i.colorScheme??"")?"light":e.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"};for(let[l,u]of v)d[l]=i.getPropertyValue(u).trim();return d}function R(t,e){let i=t.defaultView;if(!i||typeof i.MutationObserver!="function")return()=>{};let s=new i.MutationObserver(e);s.observe(t.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-graview-scheme","data-theme"]});let o=i.matchMedia?.("(prefers-color-scheme: dark)");return o?.addEventListener?.("change",e),()=>{s.disconnect(),o?.removeEventListener?.("change",e)}}function T(t,e,i){let s=e?.(),o=t(),d=s?.logo,l=i.url(typeof d=="string"||d===void 0?d:o.scheme==="dark"&&d.dark?d.dark:d.light);return{...o,...s?.name?{name:s.name}:{},...l?{logo:l}:{}}}function x(t,e,i){let s,o,d=n=>{n?.startsWith("blob:")&&t.URL.revokeObjectURL(n)},l=async n=>{if(n.startsWith("<"))return g(n)===null?new t.Blob([n],{type:"image/svg+xml"}):void 0;if(/\\|%2e/i.test(n)||n.split(/[?#]/)[0].split("/").some(m=>m==="."||m===".."))return;let r=new t.URL(n,t.document.baseURI);if(r.origin!==t.location.origin||!/^https?:$/.test(r.protocol))return;let a=await t.fetch(r.href,{credentials:"same-origin"}),c=(a.headers.get("content-type")??"").split(";")[0].trim();return a.ok&&c.startsWith("image/")?new t.Blob([await a.arrayBuffer()],{type:c}):void 0},u=n=>new Promise(r=>{let a=new t.Image;a.onload=()=>r(!0),a.onerror=()=>r(!1),t.setTimeout(()=>r(!1),2e3),a.src=n}),p=n=>new Promise((r,a)=>{let c=new t.FileReader;c.onload=()=>r(String(c.result)),c.onerror=a,c.readAsDataURL(n)}),h=async n=>{if(/^data:image\//i.test(n))return n;let r=await l(n);if(!(!r||s!==n)){if(i==="blob"){let a=t.URL.createObjectURL(r);if(await u(a))return a;t.URL.revokeObjectURL(a)}return p(r)}},f=(n,r)=>{if(s!==n)return d(r);r!==o&&(d(o),o=r,e())};return{url(n){let r=n?.trim()||void 0;return r!==s&&(s=r,r?h(r).then(a=>f(r,a),()=>f(r,void 0)):(d(o),o=void 0)),o},dispose(){s=void 0,d(o),o=void 0}}}export{b as a,k as b,w as c,B as d,R as e,T as f,x as g};
1
+ import{Zc as g}from"./chunk.6AANHELP.js";function b(){let t=new Uint8Array(16);return globalThis.crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}function k(t,e){if(!t)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};"record"in e?t.record(e.record,i):"list"in e?t.list(e.list,i):t.place(e.place,i)}function w(t,e){if(!t?.href)return;let i={..."filter"in e&&e.filter?{filter:e.filter}:{},...e.section?{section:e.section}:{}};return t.href("record"in e?{record:e.record}:"list"in e?{list:e.list}:{place:e.place},i)}var v=[["accent","--graview-accent"],["ground","--graview-ground"],["panel","--graview-panel"],["ink","--graview-ink"],["inkMuted","--graview-ink-muted"],["edge","--graview-edge"],["fontBody","--graview-font-body"],["fontDisplay","--graview-font-display"],["fontMono","--graview-font-mono"],["radius","--graview-radius"]];function B(t){let e=t.ownerDocument.defaultView,i=e.getComputedStyle(t),s=t.closest("[data-graview-scheme]")?.getAttribute("data-graview-scheme"),d={scheme:s==="dark"||s==="light"?s:/\bdark\b/.test(i.colorScheme??"")?"dark":/\blight\b/.test(i.colorScheme??"")?"light":e.matchMedia?.("(prefers-color-scheme: dark)").matches?"dark":"light"};for(let[l,u]of v)d[l]=i.getPropertyValue(u).trim();return d}function R(t,e){let i=t.defaultView;if(!i||typeof i.MutationObserver!="function")return()=>{};let s=new i.MutationObserver(e);s.observe(t.documentElement,{attributes:!0,subtree:!0,attributeFilter:["data-graview-scheme","data-theme"]});let o=i.matchMedia?.("(prefers-color-scheme: dark)");return o?.addEventListener?.("change",e),()=>{s.disconnect(),o?.removeEventListener?.("change",e)}}function T(t,e,i){let s=e?.(),o=t(),d=s?.logo,l=i.url(typeof d=="string"||d===void 0?d:o.scheme==="dark"&&d.dark?d.dark:d.light);return{...o,...s?.name?{name:s.name}:{},...l?{logo:l}:{}}}function x(t,e,i){let s,o,d=n=>{n?.startsWith("blob:")&&t.URL.revokeObjectURL(n)},l=async n=>{if(n.startsWith("<"))return g(n)===null?new t.Blob([n],{type:"image/svg+xml"}):void 0;if(/\\|%2e/i.test(n)||n.split(/[?#]/)[0].split("/").some(m=>m==="."||m===".."))return;let r=new t.URL(n,t.document.baseURI);if(r.origin!==t.location.origin||!/^https?:$/.test(r.protocol))return;let a=await t.fetch(r.href,{credentials:"same-origin"}),c=(a.headers.get("content-type")??"").split(";")[0].trim();return a.ok&&c.startsWith("image/")?new t.Blob([await a.arrayBuffer()],{type:c}):void 0},u=n=>new Promise(r=>{let a=new t.Image;a.onload=()=>r(!0),a.onerror=()=>r(!1),t.setTimeout(()=>r(!1),2e3),a.src=n}),p=n=>new Promise((r,a)=>{let c=new t.FileReader;c.onload=()=>r(String(c.result)),c.onerror=a,c.readAsDataURL(n)}),h=async n=>{if(/^data:image\//i.test(n))return n;let r=await l(n);if(!(!r||s!==n)){if(i==="blob"){let a=t.URL.createObjectURL(r);if(await u(a))return a;t.URL.revokeObjectURL(a)}return p(r)}},f=(n,r)=>{if(s!==n)return d(r);r!==o&&(d(o),o=r,e())};return{url(n){let r=n?.trim()||void 0;return r!==s&&(s=r,r?h(r).then(a=>f(r,a),()=>f(r,void 0)):(d(o),o=void 0)),o},dispose(){s=void 0,d(o),o=void 0}}}export{b as a,k as b,w as c,B as d,R as e,T as f,x as g};
@@ -0,0 +1,90 @@
1
+ import{a as L,b as _,c as B,d as V,e as E,r as G,t as H,u as S,v as N,w as q,x as W,y as z,z as Q}from"./chunk.RD2FSSLV.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var j=["drawElementImageToTexture","copyElementImageToTexture"],T=null,M=(r,e)=>r==="texture"?{texture:e}:{destination:{texture:e}};function ne(){return typeof globalThis>"u"?void 0:globalThis}function v(r,e){let t=[],n=ne(),s=!!(n?.navigator&&"gpu"in n.navigator);s||t.push("navigator.gpu is absent \u2014 WebGPU is unavailable.");let o=r??n?.GPUQueue?.prototype??void 0,i=null;if(o){for(let d of j)if(typeof o[d]=="function"){i=d;break}}i||t.push("No element-capture method on GPUQueue. Run Chromium 147+ with --enable-blink-features=CanvasDrawElement.");let c=e??n?.HTMLCanvasElement?.prototype??void 0,l=typeof c?.updateElementGeometry=="function";l||t.push("canvas.updateElementGeometry is absent \u2014 geometry cannot be reported.");let p=typeof c?.requestPaint=="function";p||t.push("canvas.requestPaint is absent \u2014 there is no capture-safe moment to hook.");let y=!1,h="unknown";if(typeof document<"u"){let d=document.createElement("canvas");y="layoutSubtree"in d||typeof d.captureElementImage=="function","layoutSubtree"in d?h="no":typeof d.captureElementImage=="function"&&(h="yes")}return{available:i!==null,captureMethod:i,geometrySync:l,hitTestFollowsGeometry:l?h:"no",layoutSubtree:y,paintEvents:p,webgpu:s,usable:s&&i!==null,notes:t}}var w=class extends Error{constructor(t){super(`HTML-in-Canvas is unavailable:
2
+ ${t.notes.join(`
3
+ `)}`);this.capabilities=t;this.name="PlatformUnavailableError"}};function O(r,e,t){let n=r;for(let s of j){let o=n[s];if(typeof o=="function"){if(T){o.call(n,{source:e},M(T,t));return}try{o.call(n,{source:e},M("texture",t)),T="texture"}catch(i){if(!(i instanceof TypeError)||!/texture/i.test(i.message))throw i;o.call(n,{source:e},M("destination",t)),T="destination"}return}}throw new w(v(r))}function F(r,e=!0){e?r.setAttribute("drawable",""):r.removeAttribute("drawable")}function D(r){let e=r.changedElements;return e?new Set(Array.from(e)):null}function re(r,e){let t=r;if(typeof t.captureElementImage!="function")throw new w(v(void 0,r));return t.captureElementImage(e)}function U(r,e,t){let n=r;if(typeof n.updateElementGeometry!="function")throw new w(v(void 0,r));n.updateElementGeometry(e,t)}function ie(r,e){r.clearElementGeometry?.(e)}function m(r){r.requestPaint?.()}function I(r,e=!0){let t=r;e?t.setAttribute("content","drawable"):t.removeAttribute("content"),"layoutSubtree"in t?t.layoutSubtree=e:e?t.setAttribute("layoutsubtree",""):t.removeAttribute("layoutsubtree")}var R=`
4
+ struct Plane {
5
+ // x, y, width, height in canvas pixels, after the plane transform.
6
+ rect: vec4f,
7
+ // blur radius in texels, contrast falloff 0..1, shadow strength (cast by
8
+ // the view's own panel, so unused here), and the view's own opacity \u2014 which is how a node entering or leaving the scene
9
+ // fades rather than popping.
10
+ style: vec4f,
11
+ // canvas size in pixels, and the ground color's rgb packed as xyz.
12
+ canvas: vec4f,
13
+ ground: vec4f,
14
+ }
15
+
16
+ @group(0) @binding(0) var<uniform> plane: Plane;
17
+ @group(0) @binding(1) var view_texture: texture_2d<f32>;
18
+ @group(0) @binding(2) var view_sampler: sampler;
19
+
20
+ struct VertexOut {
21
+ @builtin(position) position: vec4f,
22
+ @location(0) uv: vec2f,
23
+ }
24
+
25
+ @vertex
26
+ fn vs_main(@builtin(vertex_index) index: u32) -> VertexOut {
27
+ // Two triangles, no vertex buffer: the quad is entirely a function of the
28
+ // plane rect, so nothing has to be uploaded per frame except the uniform.
29
+ var corners = array<vec2f, 6>(
30
+ vec2f(0.0, 0.0), vec2f(1.0, 0.0), vec2f(0.0, 1.0),
31
+ vec2f(0.0, 1.0), vec2f(1.0, 0.0), vec2f(1.0, 1.0),
32
+ );
33
+ let corner = corners[index];
34
+ let pixel = plane.rect.xy + corner * plane.rect.zw;
35
+ // Canvas pixels to clip space, y down.
36
+ let ndc = vec2f(
37
+ pixel.x / plane.canvas.x * 2.0 - 1.0,
38
+ 1.0 - pixel.y / plane.canvas.y * 2.0,
39
+ );
40
+ var out: VertexOut;
41
+ out.position = vec4f(ndc, 0.0, 1.0);
42
+ out.uv = corner;
43
+ return out;
44
+ }
45
+
46
+ fn blurred(uv: vec2f, radius: f32) -> vec4f {
47
+ if (radius <= 0.0) {
48
+ return textureSample(view_texture, view_sampler, uv);
49
+ }
50
+ let size = vec2f(textureDimensions(view_texture, 0));
51
+ let step = radius / size;
52
+ var sum = vec4f(0.0);
53
+ var weight = 0.0;
54
+ // A 9-tap kernel: enough to read as depth-of-field at plane scale, cheap
55
+ // enough to run on every capture every frame.
56
+ for (var y = -1; y <= 1; y = y + 1) {
57
+ for (var x = -1; x <= 1; x = x + 1) {
58
+ let offset = vec2f(f32(x), f32(y)) * step;
59
+ let w = select(1.0, 2.0, x == 0 && y == 0);
60
+ sum = sum + textureSample(view_texture, view_sampler, uv + offset) * w;
61
+ weight = weight + w;
62
+ }
63
+ }
64
+ return sum / weight;
65
+ }
66
+
67
+ @fragment
68
+ fn fs_main(in: VertexOut) -> @location(0) vec4f {
69
+ let radius = plane.style.x;
70
+ let falloff = plane.style.y;
71
+ let opacity = plane.style.w;
72
+
73
+ let color = blurred(in.uv, radius);
74
+
75
+ // Recession dims the view toward whatever is under it \u2014 the ground \u2014 by
76
+ // the same share the DOM path's \`opacity\` does (\`recededOpacity\`), and
77
+ // the plane's shadow is the view's own panel, captured with it. Mixing
78
+ // toward a fixed ground color and darkening the quad's edges here drew a
79
+ // different picture from the DOM path's: gray bands down a light card,
80
+ // and haze of the wrong color in the other scheme.
81
+ let alpha = opacity * (1.0 - falloff * 0.55);
82
+
83
+ // A capture arrives with STRAIGHT alpha and the canvas composites
84
+ // premultiplied, so the color is multiplied by its own alpha here, once.
85
+ // Without it a panel's soft shadow \u2014 dark at a low alpha \u2014 came out
86
+ // lighter than the ground it fell on.
87
+ let a = color.a * alpha;
88
+ return vec4f(color.rgb * a, a);
89
+ }
90
+ `;var X=64,C=256,Y=C/4,$=64,b=class{constructor(e,t,n={}){this.canvas=e;this.deps=t;this.options=n;I(e,!0),this.blur=n.blur??!0,this.scheme=n.scheme??"dark",this.capabilities=v(t.gpu.device.gpu.queue,e);let s=n.platformHandlesHitTesting??this.capabilities.hitTestFollowsGeometry==="yes";this.router=new z(e,{platformHandlesHitTesting:s}),e.setAttribute("data-graview-hit",s?"platform":"router")}views=new Map;idOf=new WeakMap;resources=new Map;capturedAt={};uniforms=null;staging=new Float32Array(0);slotCount=0;nextSlot=0;freeSlots=[];reported=new Map;router;pipeline=null;sampler=null;frame=0;detachRouter=null;connectors=[];lastPlan=null;lastPlacements=[];blur;scheme;capabilities;attach(){return this.detachRouter=this.router.attach(),()=>this.detach()}detach(){this.detachRouter?.(),this.detachRouter=null}reconcile(e){let t=new Map(e.map(n=>[n.id,n]));for(let n of[...this.views.keys()])t.has(n)||this.remove(n);for(let n of e){let s=this.views.get(n.id);if(!s){this.add(n);continue}let[o,i]=[S(s),S(n)],c=o.width!==i.width||o.height!==i.height,l=s.element!==n.element||(s.dom??!1)!==(n.dom??!1);l&&this.track(n);let p=(s.opacity??1)!==(n.opacity??1),y=s.dirty||n.dirty===!0||c||l||p;this.views.set(n.id,{...n,dirty:y}),(l||c)&&delete this.capturedAt[n.id]}}add(e){if(!e.dom&&e.element.parentElement!==this.canvas)throw new Error(`View "${e.id}" must be an immediate child of the scene canvas \u2014 the capture API rejects deeper descendants. Nest inside a view, never between views.`);this.track(e),this.views.set(e.id,{...e,dirty:!0})}track(e){this.idOf.set(e.element,e.id),e.dom||F(e.element)}remove(e){let t=this.resources.get(e);t?.texture.destroy(),t&&this.freeSlots.push(t.slot),this.resources.delete(e),this.reported.delete(e),this.views.delete(e),delete this.capturedAt[e]}setBlur(e){this.blur=e}setScheme(e){this.scheme=e}setConnectors(e){this.connectors=e}invalidate(e){let t=this.views.get(e);t&&this.views.set(e,{...t,dirty:!0})}all(){return[...this.views.values()]}plan(){return this.lastPlan}placements(){return this.lastPlacements}deviceForProbe(){return this.deps.gpu.device.gpu}scheduleFrame(){m(this.canvas)}paint(e){return this.render(D(e))}render(e){let t=this.deps.gpu.device.gpu,n=t.queue;this.frame+=1;let s=this.canvas.width,o=this.canvas.height,i;if(e){i=new Set;for(let u of e){let a=this.idOf.get(u);a!==void 0&&i.add(a)}}let c=i?new Set(i):null,l=q([...this.views.values()],this.connectors,{canvasWidth:s,canvasHeight:o,capturedAt:this.capturedAt,captureBudget:this.options.captureBudget??N,scheme:this.scheme,...i?{changed:i}:{},...this.options.connectorOverrides?{connectorOverrides:this.options.connectorOverrides}:{}});this.lastPlan=l;let p=[];for(let u of l.captures){let a=this.views.get(u.viewId);if(!a)continue;let g=this.ensureResources(t,a);try{O(n,a.element,g.texture)}catch(f){if(!(f instanceof DOMException&&f.name==="InvalidStateError"))throw f;this.capturedAt[a.id]===void 0&&p.push(a.id),a.dirty||this.views.set(a.id,{...a,dirty:!0});continue}this.capturedAt[a.id]=this.frame,this.views.set(a.id,{...a,dirty:!1}),i?.delete(a.id)}for(let u of[...i??[],...l.deferred]){let a=this.views.get(u);a&&!a.dirty&&this.views.set(u,{...a,dirty:!0})}let y=t.createCommandEncoder({label:"graview-compositor"}),h=y.beginRenderPass({colorAttachments:[{view:this.deps.surface.context.getCurrentTexture().createView(),clearValue:this.options.transparent?{r:0,g:0,b:0,a:0}:this.groundColor(),loadOp:"clear",storeOp:"store"}]});h.setPipeline(this.ensurePipeline(t));let d=this.options.ground??[.957,.949,.933],A=[],x=-1;for(let u of l.draws){if(p.includes(u.viewId))continue;let a=this.resources.get(u.viewId);!a||!this.views.has(u.viewId)||(J(this.staging,a.slot*Y,u,s,o,d,this.blur),a.slot>x&&(x=a.slot),A.push(a))}x>=0&&this.uniforms&&n.writeBuffer(this.uniforms,0,this.staging.buffer,0,(x+1)*C);for(let u of A)h.setBindGroup(0,this.ensureBindGroup(t,u)),h.draw(6);let P=[];for(let u of l.placements){let a=this.views.get(u.viewId);a&&P.push({element:a.element,transform:u.transform,width:u.width,height:u.height,depth:u.depth})}if(h.end(),n.submit([y.finish()]),this.capabilities.geometrySync){let u=[];for(let a of[...l.geometry,...l.offCanvas]){let g=this.views.get(a.viewId);if(!g)continue;let f=a.transform.join(",");this.reported.get(a.viewId)!==f&&u.push({element:g.element,id:a.viewId,key:f,transform:a.transform})}for(let{element:a,id:g,key:f,transform:te}of u.slice(0,$))U(this.canvas,a,{canvasTransform:E(te)}),this.reported.set(g,f);u.length>$&&m(this.canvas)}return this.lastPlacements=P,this.router.setPlacements(P),p.length===0?{...l,missed:p,changed:c}:{...l,draws:l.draws.filter(u=>!p.includes(u.viewId)),missed:p,changed:c}}groundColor(){let[e,t,n]=this.options.ground??[.957,.949,.933];return{r:e,g:t,b:n,a:1}}ensurePipeline(e){if(this.pipeline)return this.pipeline;let t=e.createShaderModule({code:R,label:"graview-compositor"});return this.pipeline=e.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main"},fragment:{module:t,entryPoint:"fs_main",targets:[{format:navigator.gpu.getPreferredCanvasFormat(),blend:{color:{srcFactor:"one",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha"}}}]},primitive:{topology:"triangle-list"}}),this.pipeline}ensureResources(e,t){let n=S(t),s=Math.max(1,Math.ceil(n.width)),o=Math.max(1,Math.ceil(n.height)),i=this.resources.get(t.id);if(i&&i.width===s&&i.height===o)return i;i?.texture.destroy();let c=i?.slot??this.takeSlot(e),p={texture:e.createTexture({size:[s,o],format:"rgba8unorm",usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT,label:`graview-view-${t.id}`}),width:s,height:o,bindGroup:null,slot:c};return this.resources.set(t.id,p),p}takeSlot(e){let t=this.freeSlots.pop();if(t!==void 0)return t;let n=this.nextSlot++;if(n>=this.slotCount){let s=Math.max(64,this.slotCount*2);this.uniforms?.destroy(),this.uniforms=e.createBuffer({size:s*C,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST,label:"graview-planes"});let o=new Float32Array(s*Y);o.set(this.staging),this.staging=o,this.slotCount=s;for(let i of this.resources.values())i.bindGroup=null}return n}ensureBindGroup(e,t){return t.bindGroup||(this.sampler??=e.createSampler({magFilter:"linear",minFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}),t.bindGroup=e.createBindGroup({layout:this.ensurePipeline(e).getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this.uniforms,offset:t.slot*C,size:X}},{binding:1,resource:t.texture.createView()},{binding:2,resource:this.sampler}]})),t.bindGroup}dispose(){this.detach(),this.canvas.removeAttribute("data-graview-hit");for(let e of[...this.resources.keys()])this.remove(e);this.uniforms?.destroy(),this.uniforms=null}};function oe(r,e,t,n,s=!0){let o=new Float32Array(X/4);return J(o,0,r,e,t,n,s),o}function J(r,e,t,n,s,o,i){r[e]=t.transform[12],r[e+1]=t.transform[13],r[e+2]=t.width,r[e+3]=t.height,r[e+4]=i?t.blur:0,r[e+5]=t.style.falloff,r[e+6]=t.style.shadow,r[e+7]=t.opacity,r[e+8]=n,r[e+9]=s,r[e+10]=0,r[e+11]=0,r[e+12]=o[0],r[e+13]=o[1],r[e+14]=o[2],r[e+15]=1}var se=3,K=4,Z=1500,ee=Q*.75;function ae(r={}){let e=new WeakMap;return t=>{let n=e.get(t.canvas);(!n||n.disposed)&&(n=new k(t.canvas,r),e.set(t.canvas,n)),n.show(t);let s=n;return()=>s.release()}}var k=class{constructor(e,t){this.canvas=e;this.options=t;let n=()=>{this.stale=!0,m(this.canvas)};this.observer=typeof MutationObserver>"u"?null:new MutationObserver(n),this.observer?.observe(e,{childList:!0}),this.outsets=typeof MutationObserver>"u"?null:new MutationObserver(n),this.outsets?.observe(e,{subtree:!0,attributeFilter:[G]}),this.start()}disposed=!1;scene=null;compositor=null;ownDevice=null;stale=!0;onDom=new Set;lateFor=new Map;releasing=null;waiting=null;firstFrames=[];gone=!1;observer;outsets;onPaint=e=>this.paint(e);show(e){if(this.releasing&&clearTimeout(this.releasing),this.releasing=null,this.scene=e,this.stale=!0,this.compositor?.setBlur(e.blur??!0),e.scheme&&this.compositor?.setScheme(e.scheme),this.gone){e.fallBack?.();return}m(this.canvas)}release(){this.releasing&&clearTimeout(this.releasing),this.releasing=setTimeout(()=>this.dispose(),0)}async start(){try{let e=this.options.gpu;if(!e){let s=await navigator.gpu?.requestAdapter();if(!s)throw new Error("No WebGPU adapter.");let o=await s.requestDevice();this.ownDevice=o,o.lost.then(()=>{this.disposed||this.fallBack()}),e={device:{gpu:o}}}if(this.disposed)return;let t=e.device.gpu;if(!v(t.queue,this.canvas).usable)throw new Error("No element capture.");let n=this.canvas.getContext("webgpu");if(!n)throw new Error("No WebGPU context on the scene canvas.");n.configure({device:t,format:navigator.gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),this.compositor=new b(this.canvas,{gpu:e,surface:{context:n}},{transparent:!0,...this.options,blur:this.scene?.blur??this.options.blur??!0,...this.scene?.scheme?{scheme:this.scene.scheme}:{}}),this.compositor.attach(),this.canvas.addEventListener("paint",this.onPaint),this.stale=!0,this.waiting=setTimeout(()=>this.fallBack(),Z),m(this.canvas)}catch{this.fallBack()}}fallBack(){if(this.gone)return;this.gone=!0,this.waiting&&clearTimeout(this.waiting),this.waiting=null,this.canvas.removeEventListener("paint",this.onPaint),this.compositor?.dispose(),this.compositor=null;let e=this.scene;e&&(e.fallBack?e.fallBack():e.drawOnDom?.(new Set(e.layout.nodes.map(t=>t.id))))}checkFirstFrame(e){let t=this.firstFrames;if(!t||(this.waiting&&clearTimeout(this.waiting),this.waiting=null,t.push(e),t.length<K))return;let n=[...t].sort((s,o)=>s-o)[Math.floor(t.length/2)];this.firstFrames=null,n>ee&&this.fallBack()}paint(e){let t=this.compositor,n=this.scene;if(!t||!n)return;let s=performance.now(),o;try{this.stale&&(this.stale=!1,t.reconcile(this.views(n))),o=t.paint(e)}catch{this.fallBack();return}if(this.checkFirstFrame(performance.now()-s),this.gone)return;this.options.onFrame?.(o,t);let i=!1,c=new Set(o.deferred);for(let l of[...this.lateFor.keys()])c.has(l)||this.lateFor.delete(l);for(let l of c){if(o.changed&&!o.changed.has(l))continue;let p=(this.lateFor.get(l)??0)+1;this.lateFor.set(l,p),p>=se&&!this.onDom.has(l)&&(this.onDom.add(l),this.lateFor.delete(l),i=!0)}i&&n.drawOnDom?.(new Set(this.onDom)),(o.deferred.length>0||o.missed.length>0)&&m(this.canvas)}views(e){let t=new Map;for(let i of this.canvas.children){let c=i.getAttribute("data-graview-view");c!==null&&t.set(c,i)}let n=new Set,s=[];for(let i of W(e.layout,e.dirty).views){n.add(i.id);let c=t.get(i.id)??e.hostOf(i.id);if(!c)continue;let l=H(c.getAttribute(G));s.push({...i,element:c,...l?{outset:l}:{},...c.parentElement===this.canvas?{}:{dom:!0}})}let o=!1;for(let i of this.onDom)n.has(i)||(this.onDom.delete(i),o=!0);return o&&e.drawOnDom?.(new Set(this.onDom)),s}dispose(){this.disposed=!0,this.waiting&&clearTimeout(this.waiting),this.waiting=null,this.observer?.disconnect(),this.outsets?.disconnect(),this.canvas.removeEventListener("paint",this.onPaint),this.compositor?.dispose(),this.compositor=null,this.ownDevice?.destroy(),this.ownDevice=null}};export{R as COMPOSITOR_WGSL,b as Compositor,K as FIRST_FRAMES,ee as FIRST_FRAME_BUDGET_MS,Z as FIRST_PAINT_WAIT_MS,_ as IDENTITY,w as PlatformUnavailableError,ae as attachGpu,O as captureElement,re as captureElementImage,D as changedElementsOf,ie as clearElementGeometry,v as detectCapabilities,L as isAffine,F as markDrawable,oe as packUniform,V as perspectiveProbeMatrix,B as planeTransform,m as requestPaint,I as setLayoutSubtree,E as toDOMMatrix,U as updateElementGeometry};
@@ -1,4 +1,4 @@
1
- import{a as k}from"./chunk.G4JJXA63.js";import{b as Q}from"./chunk.V7W5AQKL.js";import{a as Z}from"./chunk.PPSYUOH7.js";import{a as Y}from"./chunk.NJRLJEJY.js";import{c as V}from"./chunk.KBPJ7X7W.js";import{ee as P,ge as H,he as T,ie as U,yb as z,zb as B}from"./chunk.6HY6ZGEE.js";var x=n=>"failed"in n;function fn(n,e){let s=n.schema.kinds,t=n.policy?.sees;if(!t?.length||B(e))return{kinds:s};let o=z(e).roles??[],r=new Set(t.filter(i=>i.roles==="*"||o.some(a=>i.roles.includes(a))).flatMap(i=>i.kinds));return{kinds:s.filter(i=>r.has(i))}}function O(n,e){if(!e)return n;let s=new Set(e.kinds.filter(r=>n.tryDefinition(r)!==void 0));if(s.size===n.kinds.length)return n;let t=new Map,o=r=>{if(s.has(r)){if(!t.has(r)){let i=n.tryDefinition(r),a=Object.fromEntries(Object.entries(i?.edges??{}).flatMap(([l,d])=>{if(d.to==="*")return[[l,d]];let c=d.to.filter(u=>s.has(u));return c.length>0?[[l,{...d,to:c}]]:[]}));t.set(r,{...i,edges:a})}return t.get(r)}};return{...n,definitions:n.definitions.filter(r=>s.has(r.kind)),kinds:n.kinds.filter(r=>s.has(r)),tryDefinition:o,definition:r=>{let i=o(r);if(!i)throw new Error(`Unknown node kind "${r}"`);return i}}}var gn=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),b=n=>gn(n).replace(/[-_]+/g," ").trim();function j(n){let e=[];for(let t of n.kinds){let o=n.tryDefinition(t);if(!o)continue;let r=o.display?.labels??{},i=Object.entries(o.fields?.shape??{}).filter(([d])=>d!=="id"&&d!=="kind").map(([d,c])=>{let u=Y(c);return{name:d,type:u?.type==="enum"&&u.multiple?"list":u?.type,...u?.options?{options:u.options}:{},words:(r[d]??b(d)).toLowerCase()}}),a=Object.entries(o.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?n.kinds.filter(u=>u!==t):c.to,words:b(d)})),l=(o.plural??`${b(t)}s`).toLowerCase();e.push({kind:t,plural:l,noun:(o.noun??b(t)).toLowerCase(),fields:i,roles:o.fieldRoles??{},edges:a})}let s=new Map(e.map(t=>[t.kind,t]));return{schema:n,kinds:e,info:t=>s.get(t)}}var $=(n,e)=>e===void 0?void 0:n.fields.find(s=>s.name===e),R=n=>n?.type==="date"||n?.type==="datetime",K=n=>n?.type==="number"||n?.type==="integer"||n?.type==="duration",sn=n=>` ${n.toLowerCase().replace(/[“”"’‘]/g,"'").replace(/[^\p{L}\p{N}' -]+/gu," ").replace(/\s+/g," ").trim()} `,A=(n,e)=>n.includes(` ${e} `),L=n=>n.endsWith("ies")?`${n.slice(0,-3)}y`:n.endsWith("ses")?n.slice(0,-2):n.endsWith("s")?n.slice(0,-1):n;function yn(n,e){let s=[];for(let t of e.kinds){let o=new Set([t.plural,t.noun,`${t.noun}s`,b(t.kind),`${b(t.kind)}s`]),r=-1;for(let i of o){let a=n.indexOf(` ${i} `);a>=0&&(r<0||a<r)&&(r=a)}r>=0&&s.push({info:t,at:r})}return s.sort((t,o)=>t.at-o.at).map(t=>t.info)}function I(n,e,s){let t=e.trim().toLowerCase();if(t.length===0)return;let o=n.fields.filter(r=>!s||s(r));return o.find(r=>r.words===t||b(r.name)===t||r.name.toLowerCase()===t)??o.find(r=>r.words===L(t)||b(r.name)===L(t))??o.find(r=>t.split(" ").some(i=>i.length>2&&(r.words.split(" ").includes(i)||r.words.split(" ").includes(L(i)))))}function rn(n,e,s){let t=e.trim().toLowerCase();if(t.length!==0)return n.edges.find(o=>o.words===t||o.name.toLowerCase()===t)??n.edges.find(o=>o.to.some(r=>{let i=s.info(r);return i!==void 0&&(i.noun===L(t)||i.plural===t||b(r)===L(t))}))??n.edges.find(o=>t.split(" ").some(r=>r.length>2&&o.words.split(" ").includes(r)))}function W(n){return/ (?:grouped |group |split |sorted |organi[sz]ed )?by ([\p{L}\p{N}' -]+?)(?= (?:and|with|for|in|on|only|where|from|this|that|as|sorted|grouped) |\s*$)/u.exec(n)?.[1]?.trim()}var mn=/\bwho\b.*\b(covers?|cover|tends?|owns?|handles?|does|works? on|looks? after|is on|is assigned|staffs?|runs?)\b|\bcoverage\b|\bmatrix\b|\bwho covers\b/,bn=/\bcalendar\b|\bmonth\b|\bagenda\b|\bschedule\b|\bdue\b|\bdeadlines?\b|\bdates?\b|\bwhen\b/,hn=/\btimeline\b|\bover time\b|\bgantt\b|\bspans?\b|\bweek\b/,pn=/\bboard\b|\bkanban\b|\bcolumns?\b|\bpipeline\b|\bstages?\b|\bstatus\b/,wn=/\blaid out\b|\blayout\b|\bseating\b|\bwhere (?:they|it|each) (?:sits?|lies?|stands?)\b|\bfloor\b/,kn=/\bplan\b|\bmap\b|\bregions?\b/,$n=/\blist\b|\btable\b|\bgroup(?:ed)? by\b|\bsort(?:ed)? by\b|\bonly\b|\bjust the\b/;function Sn(n){let e=[];return/\blist\b|\btable\b/.test(n)&&e.push("blocks"),mn.test(n)&&e.push("coverage"),wn.test(n)&&e.push("board"),(/\bfloor plan\b/.test(n)||kn.test(n))&&e.push("plan"),hn.test(n)&&e.push("timeline"),bn.test(n)&&e.push("calendar"),pn.test(n)&&e.push("columns"),$n.test(n)&&!e.includes("blocks")&&e.push("blocks"),e.length===0&&W(n)&&e.push("columns"),e}var on=n=>{let e=s=>s?` and not ${s}`:"";if(/\boverdue\b|\blate\b|\bpast due\b/.test(n))return{cond:(s,t)=>`days(today(), ${s}) < 0${e(t)}`,says:s=>`overdue by ${s.words}`};if(/\btoday\b/.test(n))return{range:"day",cond:s=>`days(today(), ${s}) == 0`,says:s=>`with ${s.words} today`};if(/\bthis week\b|\bnext 7 days\b|\bnext week\b/.test(n))return{range:"week",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 6`,says:s=>`with ${s.words} in the next week`};if(/\bthis month\b|\bnext 30 days\b|\bnext month\b/.test(n))return{range:"month",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 30`,says:s=>`with ${s.words} in the next month`};if(/\blast month\b|\bpast month\b/.test(n))return{range:"month",cond:s=>`days(today(), ${s}) >= -30 and days(today(), ${s}) <= 0`,says:s=>`with ${s.words} in the last month`};if(/\bthis year\b/.test(n))return{range:"year",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 365`,says:s=>`with ${s.words} in the next year`};if(/\bquarter\b/.test(n))return{range:"quarter",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 91`,says:s=>`with ${s.words} in the next quarter`}},_=n=>{if(/\bagenda\b|\bin order\b/.test(n))return"agenda";if(/\btoday\b|\bday\b/.test(n))return"day";if(/\bweek\b/.test(n))return"week";if(/\bquarter\b/.test(n))return"quarter";if(/\byears\b/.test(n))return"years";if(/\byear\b/.test(n))return"year";if(/\bmonth\b/.test(n))return"month"},X=/^(user|person|people|member|staff|gardener|volunteer|owner|agent|employee|worker|team|player|customer|client|contact|party|attendee|guest)s?$/,N=class extends Error{},h=n=>{throw new N(n)};function Dn(n,e){let s=n.fields.filter(r=>r.type==="enum");if(e){let r=I(n,e);if(r&&r.type==="enum")return r;r&&h(`${n.plural}' ${r.words} is not a choice, so it has no columns`)}let t=$(n,n.roles.status??n.roles.column);if(t?.type==="enum")return t;let o=s.find(r=>/^(status|stage|state|phase)$/.test(r.name));return o||(s[0]?s[0]:h(`${n.plural} have no choice field to put in columns`))}function nn(n,e){let s=n.fields.filter(R),t=l=>{let d=$(n,n.roles[l]);return R(d)?d:void 0},r=s.find(l=>A(e,l.words)||A(e,b(l.name)))??t("start")??s.find(l=>/^(due|date|on|at|start|starts|begins|from|sown|when)/i.test(l.name))??s[0];if(!r)return h(`no date field on ${n.plural}`);let i=t("end")??s.find(l=>l!==r&&/^(end|ends|until|to|finish|finished|harvested|due|closes|through)/i.test(l.name)),a=n.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));return{start:r,...i&&i!==r?{end:i}:{},...a?{done:a}:{}}}function an(n){let e=$(n,n.roles.start),s=$(n,n.roles.end),t=$(n,n.roles.column??n.roles.day??n.roles.columns);if(K(e)&&K(s)&&t?.type==="enum")return{start:e,end:s,column:t}}function vn(n,e,s,t){let o=[];for(let i of n.kinds)for(let a of i.edges)for(let l of a.to){let d=n.info(l);if(!d||d.kind===i.kind)continue;let c=0;e.includes(i)&&(c+=4),e.includes(d)&&(c+=4),(X.test(d.kind)||X.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===L(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&s.includes(` ${u}`))&&(c+=2),o.push({rows:i,across:d,link:a,score:c})}let r=o.sort((i,a)=>a.score-i.score)[0];return r||h(e[0]?`${e[0].plural} are joined to nothing else, so there is no who-covers-what to draw`:"nothing here is joined to anything else, so there is no who-covers-what to draw")}function dn(n,e,s,t,o){let r=W(t);switch(n){case"columns":{if(r){let i=I(e,r);if(!i||i.type!=="enum"){let a=rn(e,r,s);if(a){let l=s.info(a.to[0]);return{lens:"coverage",kind:e.kind,across:l.kind,link:a.name}}}}return{lens:"columns",kind:e.kind,column:Dn(e,r).name}}case"calendar":{let i=nn(e,t),a=_(t);return{lens:"calendar",kind:e.kind,start:i.start.name,...i.end?{end:i.end.name}:{},...i.done?{done:i.done.name}:{},...a?{range:a}:{}}}case"timeline":{let i=an(e);if(i&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:e.kind,start:i.start.name,end:i.end.name,column:i.column.name};let a=nn(e,t);return{lens:"calendar",kind:e.kind,start:a.start.name,...a.end?{end:a.end.name}:{},...a.done?{done:a.done.name}:{},range:_(t)??"quarter"}}case"coverage":{let i=vn(s,o,t,r);return{lens:"coverage",kind:i.rows.kind,across:i.across.kind,link:i.link.name}}case"board":{let i=$(e,e.roles.x)??e.fields.find(c=>c.name==="x"),a=$(e,e.roles.y)??e.fields.find(c=>c.name==="y");if(!K(i)||!K(a))return h(`${e.plural} have no x and y to be laid out by`);let d=s.kinds.flatMap(c=>c.edges.filter(u=>u.to.includes(e.kind)&&c.kind!==e.kind))[0]??e.edges[0];return d?{lens:"board",kind:e.kind,x:i.name,y:a.name,fill:d.name,...d.from!==e.kind?{fillFrom:"occupant"}:{}}:h(`nothing is joined to ${e.plural} to fill them`)}case"plan":{let i=$(e,e.roles.outline)??e.fields.find(a=>a.name==="outline");return i?{lens:"plan",kind:e.kind,outline:i.name}:h(`${e.plural} have no outline to draw a plan from`)}case"blocks":{let i={lens:"blocks",kind:e.kind,as:/\bcards?\b/.test(t)?"card":"row"},a=/ group(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|sorted|with)|\s*$)/u.exec(t)?.[1]??(r&&!/ sort(?:ed)? by /.test(t)?r:void 0);if(a){let c=I(e,a);if(!c||c.type!=="enum")return h(c?`${e.plural}' ${c.words} is not a choice, so they cannot be grouped by it`:`${e.plural} have nothing called ${a} to group by`);i.group=c.name}let l=/ sort(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|grouped|with)|\s*$)/u.exec(t)?.[1];if(l){let c=I(e,l);if(!c)return h(`${e.plural} have nothing called ${l} to sort by`);i.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=q(e,t);return d.length>0&&(i.where=d),i}}}function q(n,e){let s=[],t=on(e);if(t){let o=n.fields.filter(R),r=$(n,n.roles.start),i=o.find(l=>A(e,l.words))??(R(r)?r:void 0)??o[0];(!i||!R(i))&&h(`no date field on ${n.plural}`);let a=n.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));s.push({expr:t.cond(i.name,/\boverdue\b|\blate\b|\bpast due\b/.test(e)?a?.name:void 0),says:t.says(i)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(e)){for(let o of n.fields){if(o.type!=="enum")continue;let r=o.options?.find(i=>A(e,i.toLowerCase())||A(e,b(i)));r&&s.push({expr:`${o.name} == '${r.replace(/'/g,"")}'`,says:`that are ${b(r)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(e)){let o=n.fields.find(r=>r.type==="boolean"&&/^(done|finished|complete|completed)$/.test(r.name));o&&s.push({expr:`not ${o.name}`,says:`not ${o.words}`})}}return s}var J={columns:"A board",calendar:"A calendar",timeline:"A timeline",coverage:"A grid",board:"A layout",plan:"A plan",blocks:"A list",reach:"A picture"};function Rn(n,e){let s=e.info(n.kind),t=o=>o?$(s,o)?.words??b(o):"";switch(n.lens){case"columns":return{title:`${k(s.plural)} by ${t(n.column)}`,detail:`of ${s.plural} by ${t(n.column)}`};case"calendar":{let o=n.range??"month";if(o==="agenda")return{title:`${k(s.plural)} in date order`,detail:`of ${s.plural} in order of ${t(n.start)}`};let r=o==="years"?"year":o;return{title:`${k(s.plural)} by ${r}`,detail:`of ${s.plural} by ${t(n.start)}, a ${r} at a time`}}case"timeline":return{title:`${k(s.plural)} over the ${t(n.column)}`,detail:`of ${s.plural} from ${t(n.start)} to ${t(n.end)}, by ${t(n.column)}`};case"coverage":{let o=e.info(n.across);return{title:`${k(s.plural)} by ${o.noun}`,detail:`of which ${o.noun} covers which ${s.noun}`}}case"board":return{title:`${k(s.plural)} where they stand`,detail:`of ${s.plural} where they stand`};case"plan":return{title:`${k(s.plural)} on a plan`,detail:`of ${s.plural}`};default:{let o=[n.where?.map(r=>r.says).join(" and "),n.group?`by ${t(n.group)}`:void 0,n.sort?`in order of ${t(n.sort.by)}`:void 0].filter(r=>!!r);return{title:[k(s.plural),...o].join(" "),detail:[`of ${s.plural}`,...o].join(" ")}}}}function An(n,e){let s={title:e,on:n.kind};switch(n.lens){case"columns":return{name:"columns",...s,bindings:{[n.kind]:{column:n.column}}};case"calendar":return{name:"calendar",...s,bindings:{[n.kind]:{start:n.start,...n.end?{end:n.end}:{},...n.done?{done:n.done}:{}}},...n.range?{options:{range:n.range}}:{}};case"timeline":return{name:"timeline",...s,bindings:{[n.kind]:{start:n.start,end:n.end,column:n.column}}};case"coverage":return{name:"coverage",...s,bindings:{rows:{kind:n.kind},columns:{kind:n.across},link:{edge:n.link}}};case"board":return{name:"board",...s,bindings:{slots:{kind:n.kind},x:{field:n.x,on:"slots"},y:{field:n.y,on:"slots"},fill:{edge:n.fill}},...n.fillFrom?{options:{fillFrom:n.fillFrom}}:{}};case"plan":return{name:"plan",...s,bindings:{regions:{kind:n.kind},outline:{field:n.outline,on:"regions"}}};default:{let t=n.where?.length?` where ${n.where.map(r=>n.where.length>1?`(${r.expr})`:r.expr).join(" and ")}`:"",o={list:`all('${n.kind}')${t}`,as:n.as??"row"};return n.group&&(o.group=n.group),n.sort&&(o.sort=n.sort.direction?{by:n.sort.by,direction:n.sort.direction}:n.sort.by),o.empty="Nothing here yet.",{name:"blocks",...s,options:{blocks:[o]}}}}}function F(n,e){let{app:s}=e,t=r=>r.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),o=new Set(["home","overview",...Q(s,e.views?{views:e.views}:{}).map(r=>r.slug),...(s.lenses??[]).flatMap(r=>r.title?[t(r.title)]:[])]);if(!o.has(t(n)))return n;for(let r=2;;r++)if(!o.has(t(`${n} ${r}`)))return`${n} ${r}`}var en={title:[],headline:[],text:["tone"],figure:["as","currency","label"],list:["sort","limit","group","empty","as"],progress:["label"],group:["direction"],when:["show"],divider:[]};function Ln(n,e){if(!Array.isArray(e)||e.length===0)return"it has no blocks to draw";if(e.length>40)return"it has more blocks than a place draws";let s=(i,a)=>{if(typeof i!="string"||i.trim()==="")return`its ${a} says nothing`;try{return V(i)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=i=>{if(i.t==="where")return t(i.set);if(i.t==="call"&&i.fn==="all"){let a=i.args[0];return a?.t==="lit"&&typeof a.value=="string"?n.info(a.value)??null:void 0}},o=(i,a)=>{switch(i.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===i.name)&&!a.edges.some(l=>l.name===i.name)?`${a.plural} have nothing called ${i.name}`:void 0;case"member":return o(i.object,a);case"list":return i.items.map(l=>o(l,a)).find(Boolean);case"unary":return o(i.operand,a);case"binary":return o(i.left,a)??o(i.right,a);case"where":{let l=t(i.set);return l===null?"Nothing by that name here":o(i.set,a)??o(i.filter,l??void 0)}case"call":return i.fn==="all"?t(i)===null?"Nothing by that name here":void 0:i.args.map(l=>o(l,a)).find(Boolean)}},r=(i,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of i){if(!w(l))return"a block is not an object";let d=Object.keys(en).find(g=>g in l);if(!d)return`"${Object.keys(l)[0]??""}" is not a block a place draws`;let c=Object.keys(l).find(g=>g!==d&&g!=="key"&&!en[d].includes(g));if(c)return`a ${d} block takes no "${c}"`;let u=l[d];if(d==="list"||d==="figure"||d==="when"){if(d==="figure"&&u===!0)continue;let g=s(u,d);if(typeof g=="string")return g;let m=o(g,void 0);if(m)return m;if(d==="list"){let f=t(g);if(f==null)return f===null?"Nothing by that name here":"its list does not say which records it lists, like all('task')";for(let y of["group","sort"]){let p=l[y],S=typeof p=="string"?p:w(p)&&typeof p.by=="string"?p.by:void 0;if(p===void 0)continue;let D=S?f.fields.find(un=>un.name===S):void 0;if(!D)return`${f.plural} have nothing called ${String(S??p)} to ${y} by`;if(y==="group"&&D.type!=="enum")return`${f.plural}' ${D.words} is not a choice, so they cannot be grouped by it`}}if(d==="when"){let f=l.show;if(!Array.isArray(f))return"a when block shows a list of blocks";let y=r(f,a+1);if(y)return y}}else if(d==="group"){if(!Array.isArray(u))return"a group block holds a list of blocks";let g=r(u,a+1);if(g)return g}else{if(d!=="divider"&&typeof u!="string")return`a ${d} block says words`;if(typeof u=="string")for(let g of u.matchAll(/\{([^{}]*)\}/g)){let m=g[1].split(/\|(?![|])/)[0],f=s(m,`${d}'s braces`);if(typeof f=="string")return f;let y=o(f,void 0);if(y)return y}}}};return r(e,1)}function E(n,e,s){let t=O(n.schema,s),o=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!T(e.name)||e.name==="reach")return o(`"${String(e.name)}" is not a picture the seat can draw; it draws ${H.filter(f=>f!=="reach").join(", ")}`);if(typeof e.title!="string"||e.title.trim().length===0||e.title.length>80)return o("it needs a title of a few words");if(typeof e.on!="string"||!t.tryDefinition(e.on))return o("Nothing by that name here");let r=P[e.name],i=e.bindings??{};if(r.binds==="fields")for(let[f,y]of Object.entries(i)){if(!t.tryDefinition(f))return o("Nothing by that name here");let p=Object.keys(t.tryDefinition(f).fields?.shape??{});for(let[S,D]of Object.entries(y??{}))if(typeof D!="string"||!p.includes(D))return o(`${b(f)} has no field "${String(D)}" for its ${S}`);for(let S of r.requiredRoles)if(!(S in(y??{})))return o(`a ${e.name} needs ${b(f)}'s ${S}`)}else if(r.binds==="entities")for(let f of r.requiredRoles){let y=i[f];if(!y)return o(`a ${e.name} needs its ${f}`);if(typeof y.kind=="string"&&!t.tryDefinition(y.kind))return o("Nothing by that name here")}let a={...n,schema:t,lenses:[...n.lenses??[],e]},l=a.lenses.length-1,d=U(a),c=`lenses.${l}`,u=d.findings.find(f=>f.path===c||f.path.startsWith(`${c}.`));if(u)return o(u.message.replace(/^"[^"]*" /,"it "));let g=d.undrawn.find(f=>f.index===l);if(g)return o(g.why);let m=d.drawn.find(f=>f.index===l);if(!m)return o("its bindings name something the app does not have");if(m.as==="overview")return o(`"${e.title}" is the scene's own address; give it another title`);if(e.name==="blocks"){let f=Ln(j(t),e.options?.blocks);if(f)return o(f)}return{ok:!0,drawn:m}}function G(n){return{op:"add-lens",title:n.title,lens:n.name,on:n.on,...n.bindings?{bindings:n.bindings}:{},...n.options?{options:n.options}:{}}}function In(n){return{op:"remove-lens",title:n.title,on:n.on}}var w=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function ln(n){let e=w(n)?n:{},s=String(e.lens??e.name??""),t=e.bindings,o=typeof e.on=="string"?e.on:w(t)&&P[s]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:s,title:typeof e.title=="string"?e.title.trim():"",on:o,...w(t)?{bindings:t}:{},...w(e.options)?{options:e.options}:{}}}function On(n){let e=o=>w(n.bindings?.[o])?n.bindings[o]:{},s=o=>typeof o=="string"?o:void 0,t=e(n.on);switch(n.name){case"columns":return s(t.column)?{lens:"columns",kind:n.on,column:t.column}:void 0;case"calendar":{let o=s(n.options?.range);return s(t.start)?{lens:"calendar",kind:n.on,start:t.start,...s(t.end)?{end:t.end}:{},...s(t.done)?{done:t.done}:{},...o?{range:o}:{}}:void 0}case"timeline":return s(t.start)&&s(t.end)&&s(t.column)?{lens:"timeline",kind:n.on,start:t.start,end:t.end,column:t.column}:void 0;case"coverage":{let o=w(n.bindings?.columns)?s(n.bindings.columns.kind):void 0,r=w(n.bindings?.link)?s(n.bindings.link.edge):void 0;return o&&r?{lens:"coverage",kind:n.on,across:o,link:r}:void 0}case"blocks":{let o=n.options?.blocks;if(!Array.isArray(o)||o.length!==1||!w(o[0]))return;let r=o[0],i=new RegExp(`^all\\('${n.on}'\\)(?: where (.+))?$`).exec(String(r.list??""));if(!i)return;let a=r.sort;return{lens:"blocks",kind:n.on,as:r.as==="card"?"card":"row",...typeof r.group=="string"?{group:r.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...i[1]?{where:[{expr:i[1],says:"as asked"}]}:{}}}default:return}}function M(n,e,s,t,o){let r=j(O(n.schema,t)).info(e.on),i=On(e);return{title:e.title,said:`${J[e.name]??"A picture"} of ${r?.plural??b(e.on)}.`,kind:e.on,lens:e,drawn:s,edit:G(e),by:o,asks:[],...i?{recipe:i}:{}}}function tn(n){return{title:n.title,said:n.said,lens:{title:n.lens.title,lens:n.lens.name,on:n.lens.on,...n.lens.bindings?{bindings:n.lens.bindings}:{},...n.lens.options?{options:n.lens.options}:{}},edit:n.edit,by:n.by,check:"It draws, and graview check would take it."}}function C(n,e,s,t,o){let r=Rn(n,e),i=n.title??o??F(r.title,s),a=An(n,i),l=E(s.app,a,s.sight);return l.ok?{title:i,said:`${J[n.lens]} ${r.detail}.`,kind:n.kind,lens:a,drawn:l.drawn,edit:G(a),by:"template",asks:t,recipe:n}:{failed:l.failed,...s.lastGood?{lastGood:s.lastGood}:{}}}function zn(n,e){let s=j(O(e.app.schema,e.sight)),t=s.info(n.kind);if(!t)return{failed:"Couldn't draw that: Nothing by that name here."};let o=n.lens==="blocks"&&!n.group&&!n.sort&&!n.where?.length&&n.title===void 0;return C(o?{...n,title:F(`Every ${t.noun}`,e)}:n,s,e,[])}function jn(n,e,s,t){if(s.length>0)return s;let o=i=>{switch(n){case"columns":return i.fields.some(a=>a.type==="enum");case"calendar":return i.fields.some(R);case"timeline":return an(i)!==void 0||i.fields.some(R);case"coverage":return i.edges.some(a=>a.to.some(l=>l!==i.kind));case"board":return i.fields.some(a=>a.name==="x")&&i.fields.some(a=>a.name==="y");case"plan":return i.fields.some(a=>a.name==="outline")||i.roles.outline!==void 0;default:return!0}};return[...e.kinds.filter(o)].sort((i,a)=>Number(a.fields.some(l=>A(t,l.words)))-Number(i.fields.some(l=>A(t,l.words))))}function xn(n,e){let s=j(O(e.app.schema,e.sight)),t=sn(n),o=Sn(t);if(o.length===0)return;let r=yn(t,s),i;for(let a of o){let l=a==="coverage"?[r[0]??s.kinds[0]].filter(d=>!!d):jn(a,s,r,t);for(let d of l)try{let c=dn(a,d,s,t,r),u=C(c,s,e,[n]);if(!x(u))return u;i??=u.failed}catch(c){if(!(c instanceof N))throw c;i??=`Couldn't draw that: ${c.message}.`}l.length===0&&r.length===0&&(i??=`Couldn't draw that: nothing here has what ${J[a].toLowerCase()} needs.`)}return{failed:i??"Couldn't draw that: Nothing by that name here.",...e.lastGood?{lastGood:e.lastGood}:{}}}async function Nn(n,e){let s=e.lastGood?{lastGood:e.lastGood}:{};if(n.trim().length===0)return{failed:"Say what you would like to see, like \u201Ca board of tasks by status\u201D.",...s};let t=xn(n,e);if(t&&!x(t))return t;if(!e.complete)return t??{failed:"Couldn't draw that: drawing freely needs AI, which isn't on here. Ask for a board, a calendar, a timeline, a list or who covers what.",...s};let o=await cn(n,e,void 0);return x(o)&&t?t:o}async function En(n,e,s){let t={lastGood:n},o={...s,lastGood:n},r=j(O(s.app.schema,s.sight)),i=sn(e),a=r.info(n.kind),l=[...n.asks,e];if(!a)return{failed:"Couldn't change that: Nothing by that name here.",...t};let d=n.recipe,c=/^ (?:call|name|title) (?:it|this)? ?(.+?) $/.exec(i)??/ (?:call|name) it (.+?) $/.exec(i);try{if(c){let m=e.replace(/^.*?\b(?:call|name|title)\b\s*(?:it|this)?\s*/i,"").replace(/^["“']|["”']$/g,"").trim();if(m.length===0)return{failed:"Couldn't change that: say what to call it.",...t};let f={...n.lens,title:F(m,s)},y=E(s.app,f,s.sight);return y.ok?{...n,title:f.title,lens:f,drawn:y.drawn,edit:G(f),asks:l,...d?{recipe:{...d,title:f.title}}:{}}:{failed:y.failed,...t}}let g=/ as (?:a |an )?(board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)\b/.exec(i);if(g){let m=g[1]==="board"||g[1]==="kanban"?"columns":g[1]==="calendar"?"calendar":g[1]==="timeline"?"timeline":g[1]==="grid"?"coverage":g[1]==="plan"?"plan":g[1]==="layout"?"board":"blocks",f=dn(m,a,r,i,[a]),y=g[1]==="cards"?"card":g[1]==="rows"?"row":void 0,p=m==="blocks"&&d?.lens==="blocks"?{...d,...y?{as:y}:{}}:m==="blocks"&&d?.lens==="columns"?{...f,group:d.column,...y?{as:y}:{}}:f;return C(v(p),r,o,l)}if(d){let m=Kn(d,a,r,i);if(m)return C(m,r,o,l)}}catch(g){if(!(g instanceof N))throw g;return{failed:`Couldn't change that: ${g.message}.`,...t}}if(!s.complete)return{failed:"Couldn't change that: changing it freely needs AI, which isn't on here. Try \u201Cgroup by status\u201D, \u201Conly this month\u201D or \u201Cas a calendar\u201D.",...t};let u=await cn(e,o,n);return x(u)?u:{...u,asks:l}}var v=n=>{let{title:e,...s}=n;return s};function Kn(n,e,s,t){let o=/ (?:group(?:ed)?|split|organi[sz]ed?|put them|columns) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1]??(/^ by /.test(t)?W(t):void 0);if(o){let d=I(e,o);if(d?.type==="enum")return n.lens==="blocks"?{...v(n),group:d.name}:{lens:"columns",kind:n.kind,column:d.name};let c=rn(e,o,s);return c?{lens:"coverage",kind:n.kind,across:c.to[0],link:c.name}:h(d?`${e.plural}' ${d.words} is not a choice, so they cannot be grouped by it`:`${e.plural} have nothing called ${o} to group by`)}let r=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(r){let d=I(e,r);return d?{...n.lens==="blocks"?v(n):{lens:"blocks",kind:n.kind,as:"row",...n.lens==="columns"?{group:n.column}:{}},sort:{by:d.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}:h(`${e.plural} have nothing called ${r} to sort by`)}if(/\b(?:all of them|everything|show all|clear the filter|no filter|without the filter)\b/.test(t)){if(n.lens!=="blocks"||!n.where)return h("it already shows all of them");let{where:d,...c}=v(n);return c}let i=on(t);if(i&&n.lens==="calendar"&&i.range)return{...v(n),range:i.range};if(i&&n.lens==="calendar"&&!i.range)return{lens:"blocks",kind:n.kind,as:"row",sort:{by:n.start},where:q(e,t)};let a=q(e,t);if(a.length>0){let d=n.lens==="blocks"?v(n):{lens:"blocks",kind:n.kind,as:"row",...n.lens==="columns"?{group:n.column}:{}};return{...d,where:[...d.where??[],...a]}}let l=n.lens==="calendar"?_(t):void 0;if(l)return{...v(n),range:l}}function Cn(n){return n.kinds.map(e=>{let s=e.fields.map(r=>`${r.name} (${r.type??"value"}${r.options?`: ${r.options.join(" | ")}`:""})`).join(", "),t=e.edges.map(r=>`${r.name} \u2192 ${r.to.join(" | ")}`).join(", "),o=Object.entries(e.roles).map(([r,i])=>`${r}=${i}`).join(", ");return`- ${e.kind} ("${e.plural}"): ${s}${t?`; relations: ${t}`:""}${o?`; roles: ${o}`:""}`}).join(`
1
+ import{a as k}from"./chunk.G4JJXA63.js";import{b as Q}from"./chunk.CNN32262.js";import{a as Z}from"./chunk.JGRSUTPJ.js";import{a as Y}from"./chunk.CE3NKAF7.js";import{c as V}from"./chunk.UD7VLXPM.js";import{ee as P,ge as H,he as T,ie as U,yb as z,zb as B}from"./chunk.6AANHELP.js";var x=n=>"failed"in n;function fn(n,e){let s=n.schema.kinds,t=n.policy?.sees;if(!t?.length||B(e))return{kinds:s};let o=z(e).roles??[],r=new Set(t.filter(i=>i.roles==="*"||o.some(a=>i.roles.includes(a))).flatMap(i=>i.kinds));return{kinds:s.filter(i=>r.has(i))}}function O(n,e){if(!e)return n;let s=new Set(e.kinds.filter(r=>n.tryDefinition(r)!==void 0));if(s.size===n.kinds.length)return n;let t=new Map,o=r=>{if(s.has(r)){if(!t.has(r)){let i=n.tryDefinition(r),a=Object.fromEntries(Object.entries(i?.edges??{}).flatMap(([l,d])=>{if(d.to==="*")return[[l,d]];let c=d.to.filter(u=>s.has(u));return c.length>0?[[l,{...d,to:c}]]:[]}));t.set(r,{...i,edges:a})}return t.get(r)}};return{...n,definitions:n.definitions.filter(r=>s.has(r.kind)),kinds:n.kinds.filter(r=>s.has(r)),tryDefinition:o,definition:r=>{let i=o(r);if(!i)throw new Error(`Unknown node kind "${r}"`);return i}}}var gn=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),b=n=>gn(n).replace(/[-_]+/g," ").trim();function j(n){let e=[];for(let t of n.kinds){let o=n.tryDefinition(t);if(!o)continue;let r=o.display?.labels??{},i=Object.entries(o.fields?.shape??{}).filter(([d])=>d!=="id"&&d!=="kind").map(([d,c])=>{let u=Y(c);return{name:d,type:u?.type==="enum"&&u.multiple?"list":u?.type,...u?.options?{options:u.options}:{},words:(r[d]??b(d)).toLowerCase()}}),a=Object.entries(o.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?n.kinds.filter(u=>u!==t):c.to,words:b(d)})),l=(o.plural??`${b(t)}s`).toLowerCase();e.push({kind:t,plural:l,noun:(o.noun??b(t)).toLowerCase(),fields:i,roles:o.fieldRoles??{},edges:a})}let s=new Map(e.map(t=>[t.kind,t]));return{schema:n,kinds:e,info:t=>s.get(t)}}var $=(n,e)=>e===void 0?void 0:n.fields.find(s=>s.name===e),R=n=>n?.type==="date"||n?.type==="datetime",K=n=>n?.type==="number"||n?.type==="integer"||n?.type==="duration",sn=n=>` ${n.toLowerCase().replace(/[“”"’‘]/g,"'").replace(/[^\p{L}\p{N}' -]+/gu," ").replace(/\s+/g," ").trim()} `,A=(n,e)=>n.includes(` ${e} `),L=n=>n.endsWith("ies")?`${n.slice(0,-3)}y`:n.endsWith("ses")?n.slice(0,-2):n.endsWith("s")?n.slice(0,-1):n;function yn(n,e){let s=[];for(let t of e.kinds){let o=new Set([t.plural,t.noun,`${t.noun}s`,b(t.kind),`${b(t.kind)}s`]),r=-1;for(let i of o){let a=n.indexOf(` ${i} `);a>=0&&(r<0||a<r)&&(r=a)}r>=0&&s.push({info:t,at:r})}return s.sort((t,o)=>t.at-o.at).map(t=>t.info)}function I(n,e,s){let t=e.trim().toLowerCase();if(t.length===0)return;let o=n.fields.filter(r=>!s||s(r));return o.find(r=>r.words===t||b(r.name)===t||r.name.toLowerCase()===t)??o.find(r=>r.words===L(t)||b(r.name)===L(t))??o.find(r=>t.split(" ").some(i=>i.length>2&&(r.words.split(" ").includes(i)||r.words.split(" ").includes(L(i)))))}function rn(n,e,s){let t=e.trim().toLowerCase();if(t.length!==0)return n.edges.find(o=>o.words===t||o.name.toLowerCase()===t)??n.edges.find(o=>o.to.some(r=>{let i=s.info(r);return i!==void 0&&(i.noun===L(t)||i.plural===t||b(r)===L(t))}))??n.edges.find(o=>t.split(" ").some(r=>r.length>2&&o.words.split(" ").includes(r)))}function W(n){return/ (?:grouped |group |split |sorted |organi[sz]ed )?by ([\p{L}\p{N}' -]+?)(?= (?:and|with|for|in|on|only|where|from|this|that|as|sorted|grouped) |\s*$)/u.exec(n)?.[1]?.trim()}var mn=/\bwho\b.*\b(covers?|cover|tends?|owns?|handles?|does|works? on|looks? after|is on|is assigned|staffs?|runs?)\b|\bcoverage\b|\bmatrix\b|\bwho covers\b/,bn=/\bcalendar\b|\bmonth\b|\bagenda\b|\bschedule\b|\bdue\b|\bdeadlines?\b|\bdates?\b|\bwhen\b/,hn=/\btimeline\b|\bover time\b|\bgantt\b|\bspans?\b|\bweek\b/,pn=/\bboard\b|\bkanban\b|\bcolumns?\b|\bpipeline\b|\bstages?\b|\bstatus\b/,wn=/\blaid out\b|\blayout\b|\bseating\b|\bwhere (?:they|it|each) (?:sits?|lies?|stands?)\b|\bfloor\b/,kn=/\bplan\b|\bmap\b|\bregions?\b/,$n=/\blist\b|\btable\b|\bgroup(?:ed)? by\b|\bsort(?:ed)? by\b|\bonly\b|\bjust the\b/;function Sn(n){let e=[];return/\blist\b|\btable\b/.test(n)&&e.push("blocks"),mn.test(n)&&e.push("coverage"),wn.test(n)&&e.push("board"),(/\bfloor plan\b/.test(n)||kn.test(n))&&e.push("plan"),hn.test(n)&&e.push("timeline"),bn.test(n)&&e.push("calendar"),pn.test(n)&&e.push("columns"),$n.test(n)&&!e.includes("blocks")&&e.push("blocks"),e.length===0&&W(n)&&e.push("columns"),e}var on=n=>{let e=s=>s?` and not ${s}`:"";if(/\boverdue\b|\blate\b|\bpast due\b/.test(n))return{cond:(s,t)=>`days(today(), ${s}) < 0${e(t)}`,says:s=>`overdue by ${s.words}`};if(/\btoday\b/.test(n))return{range:"day",cond:s=>`days(today(), ${s}) == 0`,says:s=>`with ${s.words} today`};if(/\bthis week\b|\bnext 7 days\b|\bnext week\b/.test(n))return{range:"week",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 6`,says:s=>`with ${s.words} in the next week`};if(/\bthis month\b|\bnext 30 days\b|\bnext month\b/.test(n))return{range:"month",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 30`,says:s=>`with ${s.words} in the next month`};if(/\blast month\b|\bpast month\b/.test(n))return{range:"month",cond:s=>`days(today(), ${s}) >= -30 and days(today(), ${s}) <= 0`,says:s=>`with ${s.words} in the last month`};if(/\bthis year\b/.test(n))return{range:"year",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 365`,says:s=>`with ${s.words} in the next year`};if(/\bquarter\b/.test(n))return{range:"quarter",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 91`,says:s=>`with ${s.words} in the next quarter`}},_=n=>{if(/\bagenda\b|\bin order\b/.test(n))return"agenda";if(/\btoday\b|\bday\b/.test(n))return"day";if(/\bweek\b/.test(n))return"week";if(/\bquarter\b/.test(n))return"quarter";if(/\byears\b/.test(n))return"years";if(/\byear\b/.test(n))return"year";if(/\bmonth\b/.test(n))return"month"},X=/^(user|person|people|member|staff|gardener|volunteer|owner|agent|employee|worker|team|player|customer|client|contact|party|attendee|guest)s?$/,N=class extends Error{},h=n=>{throw new N(n)};function Dn(n,e){let s=n.fields.filter(r=>r.type==="enum");if(e){let r=I(n,e);if(r&&r.type==="enum")return r;r&&h(`${n.plural}' ${r.words} is not a choice, so it has no columns`)}let t=$(n,n.roles.status??n.roles.column);if(t?.type==="enum")return t;let o=s.find(r=>/^(status|stage|state|phase)$/.test(r.name));return o||(s[0]?s[0]:h(`${n.plural} have no choice field to put in columns`))}function nn(n,e){let s=n.fields.filter(R),t=l=>{let d=$(n,n.roles[l]);return R(d)?d:void 0},r=s.find(l=>A(e,l.words)||A(e,b(l.name)))??t("start")??s.find(l=>/^(due|date|on|at|start|starts|begins|from|sown|when)/i.test(l.name))??s[0];if(!r)return h(`no date field on ${n.plural}`);let i=t("end")??s.find(l=>l!==r&&/^(end|ends|until|to|finish|finished|harvested|due|closes|through)/i.test(l.name)),a=n.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));return{start:r,...i&&i!==r?{end:i}:{},...a?{done:a}:{}}}function an(n){let e=$(n,n.roles.start),s=$(n,n.roles.end),t=$(n,n.roles.column??n.roles.day??n.roles.columns);if(K(e)&&K(s)&&t?.type==="enum")return{start:e,end:s,column:t}}function vn(n,e,s,t){let o=[];for(let i of n.kinds)for(let a of i.edges)for(let l of a.to){let d=n.info(l);if(!d||d.kind===i.kind)continue;let c=0;e.includes(i)&&(c+=4),e.includes(d)&&(c+=4),(X.test(d.kind)||X.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===L(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&s.includes(` ${u}`))&&(c+=2),o.push({rows:i,across:d,link:a,score:c})}let r=o.sort((i,a)=>a.score-i.score)[0];return r||h(e[0]?`${e[0].plural} are joined to nothing else, so there is no who-covers-what to draw`:"nothing here is joined to anything else, so there is no who-covers-what to draw")}function dn(n,e,s,t,o){let r=W(t);switch(n){case"columns":{if(r){let i=I(e,r);if(!i||i.type!=="enum"){let a=rn(e,r,s);if(a){let l=s.info(a.to[0]);return{lens:"coverage",kind:e.kind,across:l.kind,link:a.name}}}}return{lens:"columns",kind:e.kind,column:Dn(e,r).name}}case"calendar":{let i=nn(e,t),a=_(t);return{lens:"calendar",kind:e.kind,start:i.start.name,...i.end?{end:i.end.name}:{},...i.done?{done:i.done.name}:{},...a?{range:a}:{}}}case"timeline":{let i=an(e);if(i&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:e.kind,start:i.start.name,end:i.end.name,column:i.column.name};let a=nn(e,t);return{lens:"calendar",kind:e.kind,start:a.start.name,...a.end?{end:a.end.name}:{},...a.done?{done:a.done.name}:{},range:_(t)??"quarter"}}case"coverage":{let i=vn(s,o,t,r);return{lens:"coverage",kind:i.rows.kind,across:i.across.kind,link:i.link.name}}case"board":{let i=$(e,e.roles.x)??e.fields.find(c=>c.name==="x"),a=$(e,e.roles.y)??e.fields.find(c=>c.name==="y");if(!K(i)||!K(a))return h(`${e.plural} have no x and y to be laid out by`);let d=s.kinds.flatMap(c=>c.edges.filter(u=>u.to.includes(e.kind)&&c.kind!==e.kind))[0]??e.edges[0];return d?{lens:"board",kind:e.kind,x:i.name,y:a.name,fill:d.name,...d.from!==e.kind?{fillFrom:"occupant"}:{}}:h(`nothing is joined to ${e.plural} to fill them`)}case"plan":{let i=$(e,e.roles.outline)??e.fields.find(a=>a.name==="outline");return i?{lens:"plan",kind:e.kind,outline:i.name}:h(`${e.plural} have no outline to draw a plan from`)}case"blocks":{let i={lens:"blocks",kind:e.kind,as:/\bcards?\b/.test(t)?"card":"row"},a=/ group(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|sorted|with)|\s*$)/u.exec(t)?.[1]??(r&&!/ sort(?:ed)? by /.test(t)?r:void 0);if(a){let c=I(e,a);if(!c||c.type!=="enum")return h(c?`${e.plural}' ${c.words} is not a choice, so they cannot be grouped by it`:`${e.plural} have nothing called ${a} to group by`);i.group=c.name}let l=/ sort(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|grouped|with)|\s*$)/u.exec(t)?.[1];if(l){let c=I(e,l);if(!c)return h(`${e.plural} have nothing called ${l} to sort by`);i.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=q(e,t);return d.length>0&&(i.where=d),i}}}function q(n,e){let s=[],t=on(e);if(t){let o=n.fields.filter(R),r=$(n,n.roles.start),i=o.find(l=>A(e,l.words))??(R(r)?r:void 0)??o[0];(!i||!R(i))&&h(`no date field on ${n.plural}`);let a=n.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));s.push({expr:t.cond(i.name,/\boverdue\b|\blate\b|\bpast due\b/.test(e)?a?.name:void 0),says:t.says(i)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(e)){for(let o of n.fields){if(o.type!=="enum")continue;let r=o.options?.find(i=>A(e,i.toLowerCase())||A(e,b(i)));r&&s.push({expr:`${o.name} == '${r.replace(/'/g,"")}'`,says:`that are ${b(r)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(e)){let o=n.fields.find(r=>r.type==="boolean"&&/^(done|finished|complete|completed)$/.test(r.name));o&&s.push({expr:`not ${o.name}`,says:`not ${o.words}`})}}return s}var J={columns:"A board",calendar:"A calendar",timeline:"A timeline",coverage:"A grid",board:"A layout",plan:"A plan",blocks:"A list",reach:"A picture"};function Rn(n,e){let s=e.info(n.kind),t=o=>o?$(s,o)?.words??b(o):"";switch(n.lens){case"columns":return{title:`${k(s.plural)} by ${t(n.column)}`,detail:`of ${s.plural} by ${t(n.column)}`};case"calendar":{let o=n.range??"month";if(o==="agenda")return{title:`${k(s.plural)} in date order`,detail:`of ${s.plural} in order of ${t(n.start)}`};let r=o==="years"?"year":o;return{title:`${k(s.plural)} by ${r}`,detail:`of ${s.plural} by ${t(n.start)}, a ${r} at a time`}}case"timeline":return{title:`${k(s.plural)} over the ${t(n.column)}`,detail:`of ${s.plural} from ${t(n.start)} to ${t(n.end)}, by ${t(n.column)}`};case"coverage":{let o=e.info(n.across);return{title:`${k(s.plural)} by ${o.noun}`,detail:`of which ${o.noun} covers which ${s.noun}`}}case"board":return{title:`${k(s.plural)} where they stand`,detail:`of ${s.plural} where they stand`};case"plan":return{title:`${k(s.plural)} on a plan`,detail:`of ${s.plural}`};default:{let o=[n.where?.map(r=>r.says).join(" and "),n.group?`by ${t(n.group)}`:void 0,n.sort?`in order of ${t(n.sort.by)}`:void 0].filter(r=>!!r);return{title:[k(s.plural),...o].join(" "),detail:[`of ${s.plural}`,...o].join(" ")}}}}function An(n,e){let s={title:e,on:n.kind};switch(n.lens){case"columns":return{name:"columns",...s,bindings:{[n.kind]:{column:n.column}}};case"calendar":return{name:"calendar",...s,bindings:{[n.kind]:{start:n.start,...n.end?{end:n.end}:{},...n.done?{done:n.done}:{}}},...n.range?{options:{range:n.range}}:{}};case"timeline":return{name:"timeline",...s,bindings:{[n.kind]:{start:n.start,end:n.end,column:n.column}}};case"coverage":return{name:"coverage",...s,bindings:{rows:{kind:n.kind},columns:{kind:n.across},link:{edge:n.link}}};case"board":return{name:"board",...s,bindings:{slots:{kind:n.kind},x:{field:n.x,on:"slots"},y:{field:n.y,on:"slots"},fill:{edge:n.fill}},...n.fillFrom?{options:{fillFrom:n.fillFrom}}:{}};case"plan":return{name:"plan",...s,bindings:{regions:{kind:n.kind},outline:{field:n.outline,on:"regions"}}};default:{let t=n.where?.length?` where ${n.where.map(r=>n.where.length>1?`(${r.expr})`:r.expr).join(" and ")}`:"",o={list:`all('${n.kind}')${t}`,as:n.as??"row"};return n.group&&(o.group=n.group),n.sort&&(o.sort=n.sort.direction?{by:n.sort.by,direction:n.sort.direction}:n.sort.by),o.empty="Nothing here yet.",{name:"blocks",...s,options:{blocks:[o]}}}}}function F(n,e){let{app:s}=e,t=r=>r.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),o=new Set(["home","overview",...Q(s,e.views?{views:e.views}:{}).map(r=>r.slug),...(s.lenses??[]).flatMap(r=>r.title?[t(r.title)]:[])]);if(!o.has(t(n)))return n;for(let r=2;;r++)if(!o.has(t(`${n} ${r}`)))return`${n} ${r}`}var en={title:[],headline:[],text:["tone"],figure:["as","currency","label"],list:["sort","limit","group","empty","as"],progress:["label"],group:["direction"],when:["show"],divider:[]};function Ln(n,e){if(!Array.isArray(e)||e.length===0)return"it has no blocks to draw";if(e.length>40)return"it has more blocks than a place draws";let s=(i,a)=>{if(typeof i!="string"||i.trim()==="")return`its ${a} says nothing`;try{return V(i)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=i=>{if(i.t==="where")return t(i.set);if(i.t==="call"&&i.fn==="all"){let a=i.args[0];return a?.t==="lit"&&typeof a.value=="string"?n.info(a.value)??null:void 0}},o=(i,a)=>{switch(i.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===i.name)&&!a.edges.some(l=>l.name===i.name)?`${a.plural} have nothing called ${i.name}`:void 0;case"member":return o(i.object,a);case"list":return i.items.map(l=>o(l,a)).find(Boolean);case"unary":return o(i.operand,a);case"binary":return o(i.left,a)??o(i.right,a);case"where":{let l=t(i.set);return l===null?"Nothing by that name here":o(i.set,a)??o(i.filter,l??void 0)}case"call":return i.fn==="all"?t(i)===null?"Nothing by that name here":void 0:i.args.map(l=>o(l,a)).find(Boolean)}},r=(i,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of i){if(!w(l))return"a block is not an object";let d=Object.keys(en).find(g=>g in l);if(!d)return`"${Object.keys(l)[0]??""}" is not a block a place draws`;let c=Object.keys(l).find(g=>g!==d&&g!=="key"&&!en[d].includes(g));if(c)return`a ${d} block takes no "${c}"`;let u=l[d];if(d==="list"||d==="figure"||d==="when"){if(d==="figure"&&u===!0)continue;let g=s(u,d);if(typeof g=="string")return g;let m=o(g,void 0);if(m)return m;if(d==="list"){let f=t(g);if(f==null)return f===null?"Nothing by that name here":"its list does not say which records it lists, like all('task')";for(let y of["group","sort"]){let p=l[y],S=typeof p=="string"?p:w(p)&&typeof p.by=="string"?p.by:void 0;if(p===void 0)continue;let D=S?f.fields.find(un=>un.name===S):void 0;if(!D)return`${f.plural} have nothing called ${String(S??p)} to ${y} by`;if(y==="group"&&D.type!=="enum")return`${f.plural}' ${D.words} is not a choice, so they cannot be grouped by it`}}if(d==="when"){let f=l.show;if(!Array.isArray(f))return"a when block shows a list of blocks";let y=r(f,a+1);if(y)return y}}else if(d==="group"){if(!Array.isArray(u))return"a group block holds a list of blocks";let g=r(u,a+1);if(g)return g}else{if(d!=="divider"&&typeof u!="string")return`a ${d} block says words`;if(typeof u=="string")for(let g of u.matchAll(/\{([^{}]*)\}/g)){let m=g[1].split(/\|(?![|])/)[0],f=s(m,`${d}'s braces`);if(typeof f=="string")return f;let y=o(f,void 0);if(y)return y}}}};return r(e,1)}function E(n,e,s){let t=O(n.schema,s),o=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!T(e.name)||e.name==="reach")return o(`"${String(e.name)}" is not a picture the seat can draw; it draws ${H.filter(f=>f!=="reach").join(", ")}`);if(typeof e.title!="string"||e.title.trim().length===0||e.title.length>80)return o("it needs a title of a few words");if(typeof e.on!="string"||!t.tryDefinition(e.on))return o("Nothing by that name here");let r=P[e.name],i=e.bindings??{};if(r.binds==="fields")for(let[f,y]of Object.entries(i)){if(!t.tryDefinition(f))return o("Nothing by that name here");let p=Object.keys(t.tryDefinition(f).fields?.shape??{});for(let[S,D]of Object.entries(y??{}))if(typeof D!="string"||!p.includes(D))return o(`${b(f)} has no field "${String(D)}" for its ${S}`);for(let S of r.requiredRoles)if(!(S in(y??{})))return o(`a ${e.name} needs ${b(f)}'s ${S}`)}else if(r.binds==="entities")for(let f of r.requiredRoles){let y=i[f];if(!y)return o(`a ${e.name} needs its ${f}`);if(typeof y.kind=="string"&&!t.tryDefinition(y.kind))return o("Nothing by that name here")}let a={...n,schema:t,lenses:[...n.lenses??[],e]},l=a.lenses.length-1,d=U(a),c=`lenses.${l}`,u=d.findings.find(f=>f.path===c||f.path.startsWith(`${c}.`));if(u)return o(u.message.replace(/^"[^"]*" /,"it "));let g=d.undrawn.find(f=>f.index===l);if(g)return o(g.why);let m=d.drawn.find(f=>f.index===l);if(!m)return o("its bindings name something the app does not have");if(m.as==="overview")return o(`"${e.title}" is the scene's own address; give it another title`);if(e.name==="blocks"){let f=Ln(j(t),e.options?.blocks);if(f)return o(f)}return{ok:!0,drawn:m}}function G(n){return{op:"add-lens",title:n.title,lens:n.name,on:n.on,...n.bindings?{bindings:n.bindings}:{},...n.options?{options:n.options}:{}}}function In(n){return{op:"remove-lens",title:n.title,on:n.on}}var w=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function ln(n){let e=w(n)?n:{},s=String(e.lens??e.name??""),t=e.bindings,o=typeof e.on=="string"?e.on:w(t)&&P[s]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:s,title:typeof e.title=="string"?e.title.trim():"",on:o,...w(t)?{bindings:t}:{},...w(e.options)?{options:e.options}:{}}}function On(n){let e=o=>w(n.bindings?.[o])?n.bindings[o]:{},s=o=>typeof o=="string"?o:void 0,t=e(n.on);switch(n.name){case"columns":return s(t.column)?{lens:"columns",kind:n.on,column:t.column}:void 0;case"calendar":{let o=s(n.options?.range);return s(t.start)?{lens:"calendar",kind:n.on,start:t.start,...s(t.end)?{end:t.end}:{},...s(t.done)?{done:t.done}:{},...o?{range:o}:{}}:void 0}case"timeline":return s(t.start)&&s(t.end)&&s(t.column)?{lens:"timeline",kind:n.on,start:t.start,end:t.end,column:t.column}:void 0;case"coverage":{let o=w(n.bindings?.columns)?s(n.bindings.columns.kind):void 0,r=w(n.bindings?.link)?s(n.bindings.link.edge):void 0;return o&&r?{lens:"coverage",kind:n.on,across:o,link:r}:void 0}case"blocks":{let o=n.options?.blocks;if(!Array.isArray(o)||o.length!==1||!w(o[0]))return;let r=o[0],i=new RegExp(`^all\\('${n.on}'\\)(?: where (.+))?$`).exec(String(r.list??""));if(!i)return;let a=r.sort;return{lens:"blocks",kind:n.on,as:r.as==="card"?"card":"row",...typeof r.group=="string"?{group:r.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...i[1]?{where:[{expr:i[1],says:"as asked"}]}:{}}}default:return}}function M(n,e,s,t,o){let r=j(O(n.schema,t)).info(e.on),i=On(e);return{title:e.title,said:`${J[e.name]??"A picture"} of ${r?.plural??b(e.on)}.`,kind:e.on,lens:e,drawn:s,edit:G(e),by:o,asks:[],...i?{recipe:i}:{}}}function tn(n){return{title:n.title,said:n.said,lens:{title:n.lens.title,lens:n.lens.name,on:n.lens.on,...n.lens.bindings?{bindings:n.lens.bindings}:{},...n.lens.options?{options:n.lens.options}:{}},edit:n.edit,by:n.by,check:"It draws, and graview check would take it."}}function C(n,e,s,t,o){let r=Rn(n,e),i=n.title??o??F(r.title,s),a=An(n,i),l=E(s.app,a,s.sight);return l.ok?{title:i,said:`${J[n.lens]} ${r.detail}.`,kind:n.kind,lens:a,drawn:l.drawn,edit:G(a),by:"template",asks:t,recipe:n}:{failed:l.failed,...s.lastGood?{lastGood:s.lastGood}:{}}}function zn(n,e){let s=j(O(e.app.schema,e.sight)),t=s.info(n.kind);if(!t)return{failed:"Couldn't draw that: Nothing by that name here."};let o=n.lens==="blocks"&&!n.group&&!n.sort&&!n.where?.length&&n.title===void 0;return C(o?{...n,title:F(`Every ${t.noun}`,e)}:n,s,e,[])}function jn(n,e,s,t){if(s.length>0)return s;let o=i=>{switch(n){case"columns":return i.fields.some(a=>a.type==="enum");case"calendar":return i.fields.some(R);case"timeline":return an(i)!==void 0||i.fields.some(R);case"coverage":return i.edges.some(a=>a.to.some(l=>l!==i.kind));case"board":return i.fields.some(a=>a.name==="x")&&i.fields.some(a=>a.name==="y");case"plan":return i.fields.some(a=>a.name==="outline")||i.roles.outline!==void 0;default:return!0}};return[...e.kinds.filter(o)].sort((i,a)=>Number(a.fields.some(l=>A(t,l.words)))-Number(i.fields.some(l=>A(t,l.words))))}function xn(n,e){let s=j(O(e.app.schema,e.sight)),t=sn(n),o=Sn(t);if(o.length===0)return;let r=yn(t,s),i;for(let a of o){let l=a==="coverage"?[r[0]??s.kinds[0]].filter(d=>!!d):jn(a,s,r,t);for(let d of l)try{let c=dn(a,d,s,t,r),u=C(c,s,e,[n]);if(!x(u))return u;i??=u.failed}catch(c){if(!(c instanceof N))throw c;i??=`Couldn't draw that: ${c.message}.`}l.length===0&&r.length===0&&(i??=`Couldn't draw that: nothing here has what ${J[a].toLowerCase()} needs.`)}return{failed:i??"Couldn't draw that: Nothing by that name here.",...e.lastGood?{lastGood:e.lastGood}:{}}}async function Nn(n,e){let s=e.lastGood?{lastGood:e.lastGood}:{};if(n.trim().length===0)return{failed:"Say what you would like to see, like \u201Ca board of tasks by status\u201D.",...s};let t=xn(n,e);if(t&&!x(t))return t;if(!e.complete)return t??{failed:"Couldn't draw that: drawing freely needs AI, which isn't on here. Ask for a board, a calendar, a timeline, a list or who covers what.",...s};let o=await cn(n,e,void 0);return x(o)&&t?t:o}async function En(n,e,s){let t={lastGood:n},o={...s,lastGood:n},r=j(O(s.app.schema,s.sight)),i=sn(e),a=r.info(n.kind),l=[...n.asks,e];if(!a)return{failed:"Couldn't change that: Nothing by that name here.",...t};let d=n.recipe,c=/^ (?:call|name|title) (?:it|this)? ?(.+?) $/.exec(i)??/ (?:call|name) it (.+?) $/.exec(i);try{if(c){let m=e.replace(/^.*?\b(?:call|name|title)\b\s*(?:it|this)?\s*/i,"").replace(/^["“']|["”']$/g,"").trim();if(m.length===0)return{failed:"Couldn't change that: say what to call it.",...t};let f={...n.lens,title:F(m,s)},y=E(s.app,f,s.sight);return y.ok?{...n,title:f.title,lens:f,drawn:y.drawn,edit:G(f),asks:l,...d?{recipe:{...d,title:f.title}}:{}}:{failed:y.failed,...t}}let g=/ as (?:a |an )?(board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)\b/.exec(i);if(g){let m=g[1]==="board"||g[1]==="kanban"?"columns":g[1]==="calendar"?"calendar":g[1]==="timeline"?"timeline":g[1]==="grid"?"coverage":g[1]==="plan"?"plan":g[1]==="layout"?"board":"blocks",f=dn(m,a,r,i,[a]),y=g[1]==="cards"?"card":g[1]==="rows"?"row":void 0,p=m==="blocks"&&d?.lens==="blocks"?{...d,...y?{as:y}:{}}:m==="blocks"&&d?.lens==="columns"?{...f,group:d.column,...y?{as:y}:{}}:f;return C(v(p),r,o,l)}if(d){let m=Kn(d,a,r,i);if(m)return C(m,r,o,l)}}catch(g){if(!(g instanceof N))throw g;return{failed:`Couldn't change that: ${g.message}.`,...t}}if(!s.complete)return{failed:"Couldn't change that: changing it freely needs AI, which isn't on here. Try \u201Cgroup by status\u201D, \u201Conly this month\u201D or \u201Cas a calendar\u201D.",...t};let u=await cn(e,o,n);return x(u)?u:{...u,asks:l}}var v=n=>{let{title:e,...s}=n;return s};function Kn(n,e,s,t){let o=/ (?:group(?:ed)?|split|organi[sz]ed?|put them|columns) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1]??(/^ by /.test(t)?W(t):void 0);if(o){let d=I(e,o);if(d?.type==="enum")return n.lens==="blocks"?{...v(n),group:d.name}:{lens:"columns",kind:n.kind,column:d.name};let c=rn(e,o,s);return c?{lens:"coverage",kind:n.kind,across:c.to[0],link:c.name}:h(d?`${e.plural}' ${d.words} is not a choice, so they cannot be grouped by it`:`${e.plural} have nothing called ${o} to group by`)}let r=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(r){let d=I(e,r);return d?{...n.lens==="blocks"?v(n):{lens:"blocks",kind:n.kind,as:"row",...n.lens==="columns"?{group:n.column}:{}},sort:{by:d.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}:h(`${e.plural} have nothing called ${r} to sort by`)}if(/\b(?:all of them|everything|show all|clear the filter|no filter|without the filter)\b/.test(t)){if(n.lens!=="blocks"||!n.where)return h("it already shows all of them");let{where:d,...c}=v(n);return c}let i=on(t);if(i&&n.lens==="calendar"&&i.range)return{...v(n),range:i.range};if(i&&n.lens==="calendar"&&!i.range)return{lens:"blocks",kind:n.kind,as:"row",sort:{by:n.start},where:q(e,t)};let a=q(e,t);if(a.length>0){let d=n.lens==="blocks"?v(n):{lens:"blocks",kind:n.kind,as:"row",...n.lens==="columns"?{group:n.column}:{}};return{...d,where:[...d.where??[],...a]}}let l=n.lens==="calendar"?_(t):void 0;if(l)return{...v(n),range:l}}function Cn(n){return n.kinds.map(e=>{let s=e.fields.map(r=>`${r.name} (${r.type??"value"}${r.options?`: ${r.options.join(" | ")}`:""})`).join(", "),t=e.edges.map(r=>`${r.name} \u2192 ${r.to.join(" | ")}`).join(", "),o=Object.entries(e.roles).map(([r,i])=>`${r}=${i}`).join(", ");return`- ${e.kind} ("${e.plural}"): ${s}${t?`; relations: ${t}`:""}${o?`; roles: ${o}`:""}`}).join(`
2
2
  `)}var Fn=['columns \u2014 a board, records in columns by one choice field: {"lens": "columns", "on": K, "bindings": {K: {"column": "<enum field>"}}}','calendar \u2014 records on a calendar by a date: {"lens": "calendar", "on": K, "bindings": {K: {"start": "<date field>", "end"?: "<date field>", "done"?: "<boolean field>"}}, "options": {"range"?: "day" | "week" | "month" | "quarter" | "year" | "agenda"}}','timeline \u2014 minutes of a day in columns: {"lens": "timeline", "on": K, "bindings": {K: {"start": "<number field>", "end": "<number field>", "column": "<enum field>"}}}','coverage \u2014 who covers what, a grid of two kinds joined by a relation: {"lens": "coverage", "on": K, "bindings": {"rows": {"kind": K}, "columns": {"kind": J}, "link": {"edge": "<relation of K to J>"}}}',`blocks \u2014 anything else, as blocks: {"lens": "blocks", "on": K, "options": {"blocks": [{"headline": "words"}, {"list": "all('K') where <condition>", "group"?: "<enum field>", "sort"?: "<field>" | {"by": "<field>", "direction": "desc"}, "as"?: "row" | "card", "empty"?: "words"}, {"figure": "count(all('K'))", "label": "words"}]}}. Conditions read a record's own fields: status == 'open', not done, days(today(), due) <= 7.`].join(`
3
3
  `);function Gn(n,e,s){return["You draw a view of an app's data as JSON \u2014 never code. The app's kinds, their fields (with types) and relations:",Cn(e),"","The lenses you may use (prefer the first four; use blocks only when none of them fits):",Fn,"",s?`The view on screen now:
4
4
  ${JSON.stringify(s.lens)}
@@ -1,3 +1,3 @@
1
- import{b as te}from"./chunk.OJY7VJ7D.js";import"./chunk.WSDJPXJD.js";import"./chunk.F4VB6Q2W.js";import"./chunk.FFOD5B4B.js";import{b as ne}from"./chunk.Z7Y3R3YR.js";import"./chunk.YXEO3Y65.js";import{G as ge,W as ee}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{la as X,na as Z,rd as q}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var M=T(ge(),1);var ye=6;function re($,S,m,x,E){let t=new Set($),o=new Map;for(let i of S)for(let[h,l,b]of[[i.from,i.to,"out"],[i.to,i.from,"in"]]){if(!t.has(h)||t.has(l))continue;let f=m(l);if(f===void 0)continue;let p=`${h}|${i.kind}|${b}|${f}`,v=o.get(p);v?v.others.includes(l)||v.others.push(l):o.set(p,{self:h,edge:i.kind,direction:b,kind:f,others:[l]})}let d=[];for(let i of o.values()){let h=m(i.self)??"",l=ne(E,i.direction==="out"?h:i.kind,i.edge,i.direction);if(i.others.length>ye){d.push({...i,others:i.others,lands:"district",words:l});continue}let b=[],f=[];for(let p of i.others)(x(p)?b:f).push(p);for(let p of b)d.push({...i,others:[p],lands:"record",words:l});f.length>0&&d.push({...i,others:f,lands:"district",words:l})}return d}function ie($,S=[]){let m=[...S],x=new Map,E=t=>m.some(o=>t.x<o.x+o.width&&o.x<t.x+t.width&&t.y<o.y+o.height&&o.y<t.y+t.height);for(let t of[...$].sort((o,d)=>o.y-d.y||o.x-d.x)){let o={x:t.x-t.width/2,y:t.y-t.height,width:t.width,height:t.height};for(let d=0;d<12&&E(o);d++)o.y+=t.height+2;m.push(o),x.set(t.key,{x:o.x,y:o.y})}return x}var s=T(ee(),1),he=4;function xe({frame:$,width:S,height:m,stageRef:x,tick:E,store:t,graphVersion:o,selection:d,view:i,rulers:{visibleRect:h,clipQuadratic:l,unsureOf:b,unsureDash:f,unsureOpacity:p}}){let v=n=>t.graph.getNode(n)?.kind,C=te(d,i,v),R=C.lens===null&&C.records.length<=he?C.records:[],oe=R.join(`
1
+ import{b as te}from"./chunk.2BMZPALF.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import{b as ne}from"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import{G as ge,W as ee}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{la as X,na as Z,rd as q}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var M=T(ge(),1);var ye=6;function re($,S,m,x,E){let t=new Set($),o=new Map;for(let i of S)for(let[h,l,b]of[[i.from,i.to,"out"],[i.to,i.from,"in"]]){if(!t.has(h)||t.has(l))continue;let f=m(l);if(f===void 0)continue;let p=`${h}|${i.kind}|${b}|${f}`,v=o.get(p);v?v.others.includes(l)||v.others.push(l):o.set(p,{self:h,edge:i.kind,direction:b,kind:f,others:[l]})}let d=[];for(let i of o.values()){let h=m(i.self)??"",l=ne(E,i.direction==="out"?h:i.kind,i.edge,i.direction);if(i.others.length>ye){d.push({...i,others:i.others,lands:"district",words:l});continue}let b=[],f=[];for(let p of i.others)(x(p)?b:f).push(p);for(let p of b)d.push({...i,others:[p],lands:"record",words:l});f.length>0&&d.push({...i,others:f,lands:"district",words:l})}return d}function ie($,S=[]){let m=[...S],x=new Map,E=t=>m.some(o=>t.x<o.x+o.width&&o.x<t.x+t.width&&t.y<o.y+o.height&&o.y<t.y+t.height);for(let t of[...$].sort((o,d)=>o.y-d.y||o.x-d.x)){let o={x:t.x-t.width/2,y:t.y-t.height,width:t.width,height:t.height};for(let d=0;d<12&&E(o);d++)o.y+=t.height+2;m.push(o),x.set(t.key,{x:o.x,y:o.y})}return x}var s=T(ee(),1),he=4;function xe({frame:$,width:S,height:m,stageRef:x,tick:E,store:t,graphVersion:o,selection:d,view:i,rulers:{visibleRect:h,clipQuadratic:l,unsureOf:b,unsureDash:f,unsureOpacity:p}}){let v=n=>t.graph.getNode(n)?.kind,C=te(d,i,v),R=C.lens===null&&C.records.length<=he?C.records:[],oe=R.join(`
2
2
  `),[y,K]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{let n=x.current;if(!i.overview||R.length===0||!n||typeof document>"u"||$.t<1){K(null);return}let w=n.getBoundingClientRect(),B=e=>({x:e.left-w.left,y:e.top-w.top,width:e.width,height:e.height}),D=new Map,se=R.map(e=>`[data-graview-view="${CSS.escape(e)}"]`).join(","),k=null,H=()=>{if(k)return k;k={drawn:new Map,buildings:new Map};for(let e of n.querySelectorAll("[data-graview-pick], [data-graview-view], [data-graview-building]")){let r=e.getAttribute("data-graview-pick"),a=e.getAttribute("data-graview-view");for(let c of r!==null&&r===a?[r]:[r,a]){if(c===null)continue;let u=k.drawn.get(c);u?u.push(e):k.drawn.set(c,[e])}let L=e.getAttribute("data-graview-building");L!==null&&!k.buildings.has(L)&&k.buildings.set(L,e)}return k},P=e=>{if(D.has(e))return D.get(e);let r=null;for(let a of H().drawn.get(e)??[])if(!a.closest("[data-graview-offstage], [data-graview-screen]")&&!(!R.includes(e)&&a.closest(se))&&(r=h(a,n),r))break;if(!r){let a=H().buildings.get(e);a&&(r=B(a.getBoundingClientRect()))}return D.set(e,r),r},W=e=>{let r=n.querySelector(`[data-graview-plot="kind:${CSS.escape(e)}"] .graview-plot-tile`);return r?B(r.getBoundingClientRect()):null},de=re(R,t.graph.allEdges(),v,e=>P(e)!==null,t.schema),z=[];for(let e of n.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')){let r=h(e,n);r&&z.push(r)}let Q=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),O=[],V=new Set(R),I=new Set;for(let e of de){let r=v(e.self),a=P(e.self)??(r?W(r):null),L=e.lands==="record"?P(e.others[0]):W(e.kind);if(!a||!L)continue;for(let g of e.others)V.add(g);I.add(e.kind),r&&I.add(r);let c=Q(a),u=Q(L),A=Math.hypot(u.x-c.x,u.y-c.y);if(A<6)continue;let G=Math.min(40,A*.12)*(O.length%2===0?1:-1),le={x:(c.x+u.x)/2-(u.y-c.y)/A*G,y:(c.y+u.y)/2+(u.x-c.x)/A*G},J=l({p0:c,c:le,p1:u},z);if(J.length===0)continue;let ce=J.map(g=>`M ${g.p0.x.toFixed(1)} ${g.p0.y.toFixed(1)} Q ${g.c.x.toFixed(1)} ${g.c.y.toFixed(1)} ${g.p1.x.toFixed(1)} ${g.p1.y.toFixed(1)}`).join(" "),ue=g=>{let j=t.graph.getNode(g);return j?X(t.schema.tryDefinition(j.kind),j):g},U=e.lands==="record"?`${e.words}: ${ue(e.others[0])}`:`${e.words}: ${Z(t.schema,e.kind,e.others.length)}`,F=e.others[0],_=e.lands==="record"?b?.(e.edge,e.direction==="out"?e.self:F,e.direction==="out"?F:e.self):void 0;O.push({key:`${e.self}|${e.edge}|${e.direction}|${e.lands}|${F}`,link:e,d:ce,end:u,said:_!==void 0?`${U} \xB7 unsure`:U,..._!==void 0?{unsure:_}:{}})}let Y=[];for(let e of n.querySelectorAll(".graview-kind-face[data-graview-nameplate]")){let r=h(e,n);r&&Y.push(r)}let ae=ie(O.map(e=>({key:e.key,x:e.end.x,y:e.end.y-6,width:Math.min(260,14+e.said.length*6.6),height:20})),Y);K({lines:O,labels:ae,reached:[...V],districts:[...I]})},[oe,i.overview,$,o,E,S,m,x,t]);let N=(0,M.useMemo)(()=>{if(!y)return"";let n=y.reached.map(B=>`[data-graview-building="${CSS.escape(B)}"]`).join(","),w=y.districts.map(B=>`[data-graview-plot="kind:${CSS.escape(B)}"]`).join(",");return[".graview-ground[data-graview-altitude] .graview-building { opacity: 0.22; }",n?`.graview-ground[data-graview-altitude] .graview-building:is(${n}) { opacity: 1; }`:"",w?`.graview-ground[data-graview-altitude] .graview-plot:not(:is(${w})) .graview-plot-tile { opacity: 0.4; }`:""].join(`
3
3
  `)},[y]);return!y||y.lines.length===0?N?(0,s.jsx)("style",{children:N}):null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("style",{children:N}),(0,s.jsx)("svg",{className:"graview-record-links","data-graview-world":"","data-graview-record-links":y.lines.length,"aria-hidden":"true",width:S,height:m,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:q.lines},children:y.lines.map(n=>(0,s.jsxs)("g",{className:"graview-record-link","data-graview-link":n.link.edge,"data-graview-lands":n.link.lands,"data-graview-direction":n.link.direction,"data-graview-provisional":n.unsure!==void 0||void 0,children:[(0,s.jsx)("path",{className:"graview-record-link-line",d:n.d,...n.unsure!==void 0?{strokeDasharray:f,strokeOpacity:p}:{}}),n.link.lands==="record"?(0,s.jsx)("circle",{className:"graview-record-link-end",cx:n.end.x,cy:n.end.y,r:3}):null]},n.key))}),(0,s.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:q.tieLabels},children:y.lines.map(n=>{let w=y.labels.get(n.key);return w?(0,s.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":n.link.edge,"data-graview-lands":n.link.lands,...n.unsure!==void 0?{title:n.unsure}:{},style:{position:"absolute",left:w.x,top:w.y,...n.unsure!==void 0?{pointerEvents:"auto"}:{}},children:n.said},n.key):null})})]})}export{xe as RecordLinks};
@@ -1 +1 @@
1
- import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as R,Va as g,W as y,Xa as h}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{lb as b,td as m}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
1
+ import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as R,Va as g,W as y,Xa as h}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{lb as b,td as m}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
@@ -1 +1 @@
1
- import{d as K}from"./chunk.B6JRTW3A.js";import{Fb as h,Gb as v,Hc as $,Ic as N,Nb as V,h as P,k as R,pc as Y,q as I,qb as G,qc as X,tc as B,ua as q,x as _}from"./chunk.6HY6ZGEE.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
1
+ import{d as K}from"./chunk.WV45KLXC.js";import{Fb as h,Gb as v,Hc as $,Ic as N,Nb as V,h as P,k as R,pc as Y,q as I,qb as G,qc as X,tc as B,ua as q,x as _}from"./chunk.6AANHELP.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
@@ -0,0 +1 @@
1
+ import{k as a,l as o}from"./chunk.42KHFGN6.js";import"./chunk.RQG672MJ.js";import"./chunk.Q6H5HESF.js";import"./chunk.3JMQKANL.js";import"./chunk.2ME4DVBI.js";import"./chunk.XXCHO2A5.js";import"./chunk.SADR3MQI.js";import"./chunk.LFFJB6D3.js";import"./chunk.DMZRFXH7.js";import"./chunk.DZ6UDZOB.js";import"./chunk.Q4VFLLUT.js";import"./chunk.6ZENHSTQ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.MIE4TJRW.js";import"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{ya as n}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function p(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{p as frameworkViews};
@@ -1 +1 @@
1
- import{Fb as a,la as l,ra as p}from"./chunk.6HY6ZGEE.js";import{c}from"./chunk.FQLNBIQ5.js";function m(e){if(e.withheld===!0||e.undoes!==void 0||e.mutation?.name!==a)return;let{node:n,field:r}=e.mutation.args??{};return typeof n=="string"&&typeof r=="string"?{node:n,field:r}:void 0}function R(e,n){return e.kind!==n.kind?!1:e.id!==void 0||n.id!==void 0?e.id===n.id&&e.onBehalfOf===n.onBehalfOf:(e.name??"")===(n.name??"")}var f=e=>{let n=0;for(let r of e)n++;return n};function k(e){if(e.length===0)return;let n=m(e[0]);if(!n)return;let r=0,o=0;for(let i of e){let d=m(i);if(!d||d.node!==n.node||d.field!==n.field)return;for(let t of i.primitives)if(t.op==="splice-text"&&t.id===n.node&&t.field===n.field)r+=f(t.inserted),o+=f(t.removed);else if(t.op==="patch-node"&&t.id===n.node&&Object.prototype.hasOwnProperty.call(t.after,n.field)){let s=t.before[n.field],u=t.after[n.field];r+=typeof u=="string"?f(u):0,o+=typeof s=="string"&&!c(s)?f(s):0}}return{...n,inserted:r,removed:o}}var T=(e,n)=>({node:e.node,field:e.field,inserted:e.inserted+n.inserted,removed:e.removed+n.removed});function y(e){return`(${[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]].join(" ")})`}function w(e,n,r,o=!0){let i=r?.getNode(e.node),d=i?n.tryDefinition(i.kind):void 0,t=p(d,e.field);return`Wrote in ${i&&o?`${l(d,i)}'s ${t.toLowerCase()}`:t} ${y(e)}`}export{R as a,k as b,T as c,w as d};
1
+ import{Fb as a,la as l,ra as p}from"./chunk.6AANHELP.js";import{c}from"./chunk.FQLNBIQ5.js";function m(e){if(e.withheld===!0||e.undoes!==void 0||e.mutation?.name!==a)return;let{node:n,field:r}=e.mutation.args??{};return typeof n=="string"&&typeof r=="string"?{node:n,field:r}:void 0}function R(e,n){return e.kind!==n.kind?!1:e.id!==void 0||n.id!==void 0?e.id===n.id&&e.onBehalfOf===n.onBehalfOf:(e.name??"")===(n.name??"")}var f=e=>{let n=0;for(let r of e)n++;return n};function k(e){if(e.length===0)return;let n=m(e[0]);if(!n)return;let r=0,o=0;for(let i of e){let d=m(i);if(!d||d.node!==n.node||d.field!==n.field)return;for(let t of i.primitives)if(t.op==="splice-text"&&t.id===n.node&&t.field===n.field)r+=f(t.inserted),o+=f(t.removed);else if(t.op==="patch-node"&&t.id===n.node&&Object.prototype.hasOwnProperty.call(t.after,n.field)){let s=t.before[n.field],u=t.after[n.field];r+=typeof u=="string"?f(u):0,o+=typeof s=="string"&&!c(s)?f(s):0}}return{...n,inserted:r,removed:o}}var T=(e,n)=>({node:e.node,field:e.field,inserted:e.inserted+n.inserted,removed:e.removed+n.removed});function y(e){return`(${[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]].join(" ")})`}function w(e,n,r,o=!0){let i=r?.getNode(e.node),d=i?n.tryDefinition(i.kind):void 0,t=p(d,e.field);return`Wrote in ${i&&o?`${l(d,i)}'s ${t.toLowerCase()}`:t} ${y(e)}`}export{R as a,k as b,T as c,w as d};
@@ -1 +1 @@
1
- import{$ as z,Ac as ne,Cb as H,Cc as te,Db as U,Dc as oe,Eb as X,Ec as I,Fb as Z,Fc as R,Gc as E,Jc as P,Kd as ie,L,Mc as N,R as G,U as F,Y as T,jc as Q,ob as Y,pb as v,ra as J,wc as O,yb as q,zc as ee}from"./chunk.6HY6ZGEE.js";import{j as y}from"./chunk.FQLNBIQ5.js";var re=e=>q(e).id??e.session;function j(e,i={}){let n=O(e),o=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||n.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:re(s.author);if(a===void 0)continue;let r=o.get(s.vote.suggestion);r||o.set(s.vote.suggestion,r=new Map),s.vote.vote===null?r.delete(a):r.set(a,s.vote.vote)}return o}function se(e){let i=0,n=0;for(let o of e?.values()??[])o==="for"?i++:n++;return{for:i,against:n}}function he(e,i,n){let o=I(i)?R(i):void 0,t=i&&(o===void 0?re(i):void 0),s=o!==void 0?n?.get(o):t!==void 0?e?.get(t):void 0,a=se(n);return{...se(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var V=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Se=(e,i,n)=>(e??[]).some(o=>o.suggestion===i&&(o.until===void 0||Date.parse(o.until)>Date.parse(n)));function ae(e,i=()=>!0,n={}){let o=O(e),t=Ae(e),s=n.now??new Date().toISOString(),a,r;return e.filter(d=>d.suggests&&!d.withheld&&!o.has(d.id)&&t.get(d.id)!=="all"&&!V(d,s)&&!Se(n.dismissed,d.id,s)).flatMap(({id:d,batch:u,suggests:l,suggestsSaid:c,intent:g,batchIntent:p,author:S,lineage:w,at:f,expiresAt:me})=>{let B=t.get(d),M=ve(l,c,g).filter(h=>!B?.has(h.at));if(M.length===0)return[];let _=M.map(h=>h.call),W=new Set;return JSON.stringify(_.map(h=>h.args),(h,D)=>(typeof D=="string"&&i(D)&&W.add(D),D)),[{id:d,batch:u,calls:_,intent:B?M.map(h=>h.intent).join("; "):g,...p!==void 0?{headline:p}:{},items:M,author:S,...w?{lineage:w}:{},at:f,expiresAt:me,about:[...W],tally:he((a??=j(e)).get(d),n.voter,(r??=j(e,{advisory:!0})).get(d))}]})}function ve(e,i,n){let o=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:o?.[s]??(e.length===1?n:t.name)}))}function Ae(e){let i=new Map;for(let o of e){let t=o.lineage?.suggestion;if(t===void 0)continue;let s=o.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let r=a??new Set;for(let d of s)r.add(d);i.set(t,r)}}let n=new Map(e.filter(o=>o.suggests&&i.has(o.id)).map(o=>[o.id,o.suggests.length]));for(let[o,t]of i)t!=="all"&&n.has(o)&&t.size>=n.get(o)&&i.set(o,"all");return i}var le=e=>JSON.stringify(e,(i,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort()):n);var we=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function xe(e,i){let n=ie(e.name),o=i?.act(e.name),t=e.args??{},s=o?o.derived:Q(n),{id:a}=t;if(s&&typeof a=="string"){if(we.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let r=o?.subject?.arg??"id",[d,u]=Object.keys(t).filter(l=>l!==r);return o?.connects?.length===1&&d&&!u&&i.has(t[r])&&i.has(t[d])?["connect",o.connects[0],t[r],t[d]]:[n,o?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var A=(e,i)=>`\u2248${le(e.map(n=>xe(n,i)))}`,de=e=>`\u2248${le([["connect",e.kind,e.from,e.to]])}`;function ue(e,i,n,o){let t=C(e,n,o);return[i,...i.map(s=>[s])].map(s=>t.get(A(s,n))).find(Boolean)}function C(e,i,n){let o=O(e),t=new Map(e.map(r=>[r.id,r])),s=new Map;for(let[r,d]of Object.entries(n??{}))o.has(d.id)||s.set(r,d);let a=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&a.set(r.lineage.suggestion,[...a.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let d=!o.has(r.id)&&!r.withheld,u=r.author.kind==="human",l=r.undoes!==void 0&&d?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let c=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||u),g=l?.suggests?l.suggests.filter((p,S)=>!a.get(l.id)?.includes(S)):c?[l.mutation]:[];if(g.length>0)for(let p of[g,...g.map(S=>[S])])s.set(A(p,i),r);if(!(!d||!u||r.undoes!==void 0))for(let p of r.primitives)p.op==="remove-edge"?s.set(de(p.edge),r):p.op==="add-edge"&&s.delete(de(p.edge))}return s}function ge(e){return Object.fromEntries([...e].map(([i,n])=>[i,{id:n.id,at:n.at,author:n.author,...n.undoes!==void 0&&{undoes:n.undoes}}]))}function ce(e,i){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&i(n.undoes)?.suggests!==void 0)}var K=e=>[...e].length;function Oe(e){let i,n=0,o=0;for(let t of e.ops){let s=t.mutation?.name===Z&&t.withheld!==!0&&t.undoes===void 0?t.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||i&&(i.node!==s.node||i.field!==s.field))return;i={node:s.node,field:s.field};for(let a of t.primitives)a.op==="splice-text"?(n+=K(a.inserted),o+=K(a.removed)):a.op==="patch-node"&&typeof a.after[s.field]=="string"&&(n+=K(a.after[s.field]))}return i&&{...i,inserted:n,removed:o}}function be(e,i,n){let o=n.getNode(e.node)?.kind,t=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${J(o?i.tryDefinition(o):void 0,e.field)} (${t.join(" ")})`}var b=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),ke=e=>e.ops.find(i=>i.lineage?.run!==void 0)?.lineage?.run;function Me(e,i=()=>{}){let n=[];for(let o of e){if(ce(o,i))continue;if(!P(o.author)){let l=Oe(o),c=n.at(-1),g=l&&c&&"batch"in c&&b(c.batch.author)===b(o.author)&&c.typed?.node===l.node&&c.typed.field===l.field?c.typed:void 0;g?n[n.length-1]={batch:o,typed:{...g,batches:[...g.batches,o],inserted:g.inserted+l.inserted,removed:g.removed+l.removed}}:n.push(l?{batch:o,typed:{batches:[o],...l}}:{batch:o});continue}let t=ke(o),s=b(o.author),a=t!==void 0?n.findIndex(l=>"digest"in l&&l.digest.run===t&&b(l.digest.author)===s):n.length-1,r=n[a],d=r!==void 0&&"digest"in r&&b(r.digest.author)===s&&r.digest.run===t?r.digest:void 0,u=[...d?.batches??[],o];d&&n.splice(a,1),n.push({digest:{author:o.author,batches:u,things:De(u),at:o.at,...t!==void 0?{run:t}:{}}})}return n}var De=e=>e.reduce((i,n)=>i+(n.undone?0:n.ops.length),0),Ie=e=>{let i=Date.parse(e);if(Number.isNaN(i))return!1;let{minutes:n}=F(i,G());return n<6*60||n>=21*60};function Re(e,i=T(new Date().toISOString())??L()){let n=T(e.at)??e.at.slice(0,10),t=e.run!==void 0&&n===i&&[e.at,...(e.batches??[]).map(a=>a.at)].every(Ie)?"overnight":n===i?"today":`on ${z(n)}`,s=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${s} ${t}`:`Tidied ${s} ${t}`}N.declined=ue;N.kept=(e,i,n)=>ge(C(e,i,n));var m=e=>e,x=(e,i)=>i===void 0?{}:{[e]:i};function tn(e,i,n){let o=y(e)?.store??e,t=m(o),s=ne(n.lineage);if(s===void 0)throw new v("A suggestion says what it is based on: { basis, confidence? }");let a=n.author??t.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new v(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let r=t.actMeanings(),d=A(i,r),u=$(o).find(f=>A(f.calls,r)===d);if(u)return o.log.get(u.id);t.refuseDeclined(i,a);let l=t.rehearsal();l.suggesting=!0;let c=l.applying(i,{author:a,lineage:s,...x("via",n.via)});if(c.ops.length===0)return;let g=[...new Set(c.ops.flatMap(f=>f.described??[]))],p=c.ops.filter(f=>f.mutation!==null&&f.author===a),S=i.length>1&&p.length===i.length?p.map(f=>f.intent):void 0,w={id:t.nextId(),seq:o.log.length,batch:t.mintBatch("batch"),author:a,intent:c.ops.map(f=>f.intent).join("; "),...x("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...g.length>0?{described:g}:{},at:t.now(),...x("via",n.via),lineage:s,suggests:i,...x("suggestsSaid",S),...x("expiresAt",n.expiresAt)};return o.log.append(w),o.notify(Y,[w]),w}function $(e,i,n={}){let o=y(e),t=o?.store??e,s=i??o?.principal,a=(s!==void 0?t.seenBy(s):t).log.all();return ae(a,r=>t.graph.has(r),{now:m(t).now(),dismissed:n.dismissed,voter:s})}function pe(e,i,n){let o=y(e),t=o?.store??e,s=n??o?.principal??m(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function fe(e,i,n,o={}){let t=y(e)?.store??e,s=o.author??m(t).by;k(t,i,s);let a=t.applyAll([{name:oe,args:{suggestion:i,vote:n}}],{...o,author:s});return n===null?a:{...a,voted:n}}function k(e,i,n){let o=$(e,n).find(s=>s.id===i),t=o?void 0:e.log.get(i);if(t?.suggests&&V(t,m(e).now()))throw new v(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!o)throw new v("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return o}function on(e,i,n={}){let o=y(e)?.store??e,{items:t,...s}=n,a=s.author??m(o).by,r=k(o,i,a),d=t===void 0?r.items:r.items.filter(g=>t.includes(g.at));if(t!==void 0&&(t.length===0||d.length!==new Set(t).size))throw new v("Name the changes to accept by their place among those still waiting in the suggestion.");let u={...r,calls:d.map(g=>g.call)};if(!pe(o,u,a))return fe(o,i,"for",{...s,author:a});let l=o.log.get(i)?.suggests?.length??d.length,c=d.length<l?{items:d.map(g=>g.at)}:{};return o.applyAll(u.calls,{...s,author:a,lineage:{...r.lineage,suggestion:i,...c}})}function sn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(!pe(o,s,t))return fe(o,i,"against",{...n,author:t});let a=ye(s)&&n.intent===void 0?{intent:`Declined ${$e(je(s))} proposal: ${s.intent}`}:{};return o.undo(s.batch,{...n,...a,author:t})}function rn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new v("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return o.undo(s.batch,{...n,author:t})}var Pe={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};E.op=(e,i,n,o,t,s)=>{let a=e,{suggestion:r,vote:d}=n.args,u=k(a,r,t),l=I(t)?R(t):void 0,c=d==="for"?`For: ${u.intent}`:d==="against"?`Against: ${u.intent}`:`Withdraws a vote on: ${u.intent}`;return{id:i.id,seq:a.log.length,batch:o,author:t,intent:c,mutation:n,primitives:[],reads:[],writes:[],...u.about.length>0?{described:u.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:r,vote:d,...l!==void 0?{advisory:!0,voter:l}:{}}}};E.accepting=(e,i)=>{let n=e,o=n.tidying?.autoAcceptAt;if(o===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(n).find(u=>u.id===t);if(!s)return;let r=[...j(n.log.all()).get(t)??[]].filter(([,u])=>u==="for").map(([u])=>u);if(r.length<o)return;let d=P(s.author)?s.author:Pe;return{calls:s.calls,author:d,lineage:{...s.lineage,suggestion:t,voters:r.slice(0,ee)}}};var ye=e=>e.lineage?.proposedBy!==void 0,je=e=>e.author.name??e.author.id??"Somebody",$e=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function an(e,i,n,o){let t=y(e)?.store??e,s=m(t).actMeanings(),a=A(n,s),r=$(t,i).find(u=>ye(u)&&A(u.calls,s)===a);if(r)return t.log.get(r.id);let d={calls:n.map(({name:u,args:l})=>({name:u,args:l})),...x("intent",o)};return t.applyAll([{name:te,args:d}],{author:i}).ops.find(u=>u.suggests!==void 0)}function dn(e,i,n){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let o=new Set(H(e,i,n));return n.filter(t=>!o.has(t)&&U(t).some(s=>X(e,i,t.name,s)))}export{be as a,Me as b,Re as c,tn as d,$ as e,pe as f,fe as g,on as h,sn as i,rn as j,ye as k,an as l,dn as m};
1
+ import{$ as z,Ac as ne,Cb as H,Cc as te,Db as U,Dc as oe,Eb as X,Ec as I,Fb as Z,Fc as R,Gc as E,Jc as P,Kd as ie,L,Mc as N,R as G,U as F,Y as T,jc as Q,ob as Y,pb as v,ra as J,wc as O,yb as q,zc as ee}from"./chunk.6AANHELP.js";import{j as y}from"./chunk.FQLNBIQ5.js";var re=e=>q(e).id??e.session;function j(e,i={}){let n=O(e),o=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||n.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:re(s.author);if(a===void 0)continue;let r=o.get(s.vote.suggestion);r||o.set(s.vote.suggestion,r=new Map),s.vote.vote===null?r.delete(a):r.set(a,s.vote.vote)}return o}function se(e){let i=0,n=0;for(let o of e?.values()??[])o==="for"?i++:n++;return{for:i,against:n}}function he(e,i,n){let o=I(i)?R(i):void 0,t=i&&(o===void 0?re(i):void 0),s=o!==void 0?n?.get(o):t!==void 0?e?.get(t):void 0,a=se(n);return{...se(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var V=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Se=(e,i,n)=>(e??[]).some(o=>o.suggestion===i&&(o.until===void 0||Date.parse(o.until)>Date.parse(n)));function ae(e,i=()=>!0,n={}){let o=O(e),t=Ae(e),s=n.now??new Date().toISOString(),a,r;return e.filter(d=>d.suggests&&!d.withheld&&!o.has(d.id)&&t.get(d.id)!=="all"&&!V(d,s)&&!Se(n.dismissed,d.id,s)).flatMap(({id:d,batch:u,suggests:l,suggestsSaid:c,intent:g,batchIntent:p,author:S,lineage:w,at:f,expiresAt:me})=>{let B=t.get(d),M=ve(l,c,g).filter(h=>!B?.has(h.at));if(M.length===0)return[];let _=M.map(h=>h.call),W=new Set;return JSON.stringify(_.map(h=>h.args),(h,D)=>(typeof D=="string"&&i(D)&&W.add(D),D)),[{id:d,batch:u,calls:_,intent:B?M.map(h=>h.intent).join("; "):g,...p!==void 0?{headline:p}:{},items:M,author:S,...w?{lineage:w}:{},at:f,expiresAt:me,about:[...W],tally:he((a??=j(e)).get(d),n.voter,(r??=j(e,{advisory:!0})).get(d))}]})}function ve(e,i,n){let o=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:o?.[s]??(e.length===1?n:t.name)}))}function Ae(e){let i=new Map;for(let o of e){let t=o.lineage?.suggestion;if(t===void 0)continue;let s=o.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let r=a??new Set;for(let d of s)r.add(d);i.set(t,r)}}let n=new Map(e.filter(o=>o.suggests&&i.has(o.id)).map(o=>[o.id,o.suggests.length]));for(let[o,t]of i)t!=="all"&&n.has(o)&&t.size>=n.get(o)&&i.set(o,"all");return i}var le=e=>JSON.stringify(e,(i,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort()):n);var we=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function xe(e,i){let n=ie(e.name),o=i?.act(e.name),t=e.args??{},s=o?o.derived:Q(n),{id:a}=t;if(s&&typeof a=="string"){if(we.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let r=o?.subject?.arg??"id",[d,u]=Object.keys(t).filter(l=>l!==r);return o?.connects?.length===1&&d&&!u&&i.has(t[r])&&i.has(t[d])?["connect",o.connects[0],t[r],t[d]]:[n,o?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var A=(e,i)=>`\u2248${le(e.map(n=>xe(n,i)))}`,de=e=>`\u2248${le([["connect",e.kind,e.from,e.to]])}`;function ue(e,i,n,o){let t=C(e,n,o);return[i,...i.map(s=>[s])].map(s=>t.get(A(s,n))).find(Boolean)}function C(e,i,n){let o=O(e),t=new Map(e.map(r=>[r.id,r])),s=new Map;for(let[r,d]of Object.entries(n??{}))o.has(d.id)||s.set(r,d);let a=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&a.set(r.lineage.suggestion,[...a.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let d=!o.has(r.id)&&!r.withheld,u=r.author.kind==="human",l=r.undoes!==void 0&&d?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let c=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||u),g=l?.suggests?l.suggests.filter((p,S)=>!a.get(l.id)?.includes(S)):c?[l.mutation]:[];if(g.length>0)for(let p of[g,...g.map(S=>[S])])s.set(A(p,i),r);if(!(!d||!u||r.undoes!==void 0))for(let p of r.primitives)p.op==="remove-edge"?s.set(de(p.edge),r):p.op==="add-edge"&&s.delete(de(p.edge))}return s}function ge(e){return Object.fromEntries([...e].map(([i,n])=>[i,{id:n.id,at:n.at,author:n.author,...n.undoes!==void 0&&{undoes:n.undoes}}]))}function ce(e,i){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&i(n.undoes)?.suggests!==void 0)}var K=e=>[...e].length;function Oe(e){let i,n=0,o=0;for(let t of e.ops){let s=t.mutation?.name===Z&&t.withheld!==!0&&t.undoes===void 0?t.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||i&&(i.node!==s.node||i.field!==s.field))return;i={node:s.node,field:s.field};for(let a of t.primitives)a.op==="splice-text"?(n+=K(a.inserted),o+=K(a.removed)):a.op==="patch-node"&&typeof a.after[s.field]=="string"&&(n+=K(a.after[s.field]))}return i&&{...i,inserted:n,removed:o}}function be(e,i,n){let o=n.getNode(e.node)?.kind,t=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${J(o?i.tryDefinition(o):void 0,e.field)} (${t.join(" ")})`}var b=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),ke=e=>e.ops.find(i=>i.lineage?.run!==void 0)?.lineage?.run;function Me(e,i=()=>{}){let n=[];for(let o of e){if(ce(o,i))continue;if(!P(o.author)){let l=Oe(o),c=n.at(-1),g=l&&c&&"batch"in c&&b(c.batch.author)===b(o.author)&&c.typed?.node===l.node&&c.typed.field===l.field?c.typed:void 0;g?n[n.length-1]={batch:o,typed:{...g,batches:[...g.batches,o],inserted:g.inserted+l.inserted,removed:g.removed+l.removed}}:n.push(l?{batch:o,typed:{batches:[o],...l}}:{batch:o});continue}let t=ke(o),s=b(o.author),a=t!==void 0?n.findIndex(l=>"digest"in l&&l.digest.run===t&&b(l.digest.author)===s):n.length-1,r=n[a],d=r!==void 0&&"digest"in r&&b(r.digest.author)===s&&r.digest.run===t?r.digest:void 0,u=[...d?.batches??[],o];d&&n.splice(a,1),n.push({digest:{author:o.author,batches:u,things:De(u),at:o.at,...t!==void 0?{run:t}:{}}})}return n}var De=e=>e.reduce((i,n)=>i+(n.undone?0:n.ops.length),0),Ie=e=>{let i=Date.parse(e);if(Number.isNaN(i))return!1;let{minutes:n}=F(i,G());return n<6*60||n>=21*60};function Re(e,i=T(new Date().toISOString())??L()){let n=T(e.at)??e.at.slice(0,10),t=e.run!==void 0&&n===i&&[e.at,...(e.batches??[]).map(a=>a.at)].every(Ie)?"overnight":n===i?"today":`on ${z(n)}`,s=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${s} ${t}`:`Tidied ${s} ${t}`}N.declined=ue;N.kept=(e,i,n)=>ge(C(e,i,n));var m=e=>e,x=(e,i)=>i===void 0?{}:{[e]:i};function tn(e,i,n){let o=y(e)?.store??e,t=m(o),s=ne(n.lineage);if(s===void 0)throw new v("A suggestion says what it is based on: { basis, confidence? }");let a=n.author??t.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new v(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let r=t.actMeanings(),d=A(i,r),u=$(o).find(f=>A(f.calls,r)===d);if(u)return o.log.get(u.id);t.refuseDeclined(i,a);let l=t.rehearsal();l.suggesting=!0;let c=l.applying(i,{author:a,lineage:s,...x("via",n.via)});if(c.ops.length===0)return;let g=[...new Set(c.ops.flatMap(f=>f.described??[]))],p=c.ops.filter(f=>f.mutation!==null&&f.author===a),S=i.length>1&&p.length===i.length?p.map(f=>f.intent):void 0,w={id:t.nextId(),seq:o.log.length,batch:t.mintBatch("batch"),author:a,intent:c.ops.map(f=>f.intent).join("; "),...x("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...g.length>0?{described:g}:{},at:t.now(),...x("via",n.via),lineage:s,suggests:i,...x("suggestsSaid",S),...x("expiresAt",n.expiresAt)};return o.log.append(w),o.notify(Y,[w]),w}function $(e,i,n={}){let o=y(e),t=o?.store??e,s=i??o?.principal,a=(s!==void 0?t.seenBy(s):t).log.all();return ae(a,r=>t.graph.has(r),{now:m(t).now(),dismissed:n.dismissed,voter:s})}function pe(e,i,n){let o=y(e),t=o?.store??e,s=n??o?.principal??m(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function fe(e,i,n,o={}){let t=y(e)?.store??e,s=o.author??m(t).by;k(t,i,s);let a=t.applyAll([{name:oe,args:{suggestion:i,vote:n}}],{...o,author:s});return n===null?a:{...a,voted:n}}function k(e,i,n){let o=$(e,n).find(s=>s.id===i),t=o?void 0:e.log.get(i);if(t?.suggests&&V(t,m(e).now()))throw new v(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!o)throw new v("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return o}function on(e,i,n={}){let o=y(e)?.store??e,{items:t,...s}=n,a=s.author??m(o).by,r=k(o,i,a),d=t===void 0?r.items:r.items.filter(g=>t.includes(g.at));if(t!==void 0&&(t.length===0||d.length!==new Set(t).size))throw new v("Name the changes to accept by their place among those still waiting in the suggestion.");let u={...r,calls:d.map(g=>g.call)};if(!pe(o,u,a))return fe(o,i,"for",{...s,author:a});let l=o.log.get(i)?.suggests?.length??d.length,c=d.length<l?{items:d.map(g=>g.at)}:{};return o.applyAll(u.calls,{...s,author:a,lineage:{...r.lineage,suggestion:i,...c}})}function sn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(!pe(o,s,t))return fe(o,i,"against",{...n,author:t});let a=ye(s)&&n.intent===void 0?{intent:`Declined ${$e(je(s))} proposal: ${s.intent}`}:{};return o.undo(s.batch,{...n,...a,author:t})}function rn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new v("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return o.undo(s.batch,{...n,author:t})}var Pe={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};E.op=(e,i,n,o,t,s)=>{let a=e,{suggestion:r,vote:d}=n.args,u=k(a,r,t),l=I(t)?R(t):void 0,c=d==="for"?`For: ${u.intent}`:d==="against"?`Against: ${u.intent}`:`Withdraws a vote on: ${u.intent}`;return{id:i.id,seq:a.log.length,batch:o,author:t,intent:c,mutation:n,primitives:[],reads:[],writes:[],...u.about.length>0?{described:u.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:r,vote:d,...l!==void 0?{advisory:!0,voter:l}:{}}}};E.accepting=(e,i)=>{let n=e,o=n.tidying?.autoAcceptAt;if(o===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(n).find(u=>u.id===t);if(!s)return;let r=[...j(n.log.all()).get(t)??[]].filter(([,u])=>u==="for").map(([u])=>u);if(r.length<o)return;let d=P(s.author)?s.author:Pe;return{calls:s.calls,author:d,lineage:{...s.lineage,suggestion:t,voters:r.slice(0,ee)}}};var ye=e=>e.lineage?.proposedBy!==void 0,je=e=>e.author.name??e.author.id??"Somebody",$e=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function an(e,i,n,o){let t=y(e)?.store??e,s=m(t).actMeanings(),a=A(n,s),r=$(t,i).find(u=>ye(u)&&A(u.calls,s)===a);if(r)return t.log.get(r.id);let d={calls:n.map(({name:u,args:l})=>({name:u,args:l})),...x("intent",o)};return t.applyAll([{name:te,args:d}],{author:i}).ops.find(u=>u.suggests!==void 0)}function dn(e,i,n){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let o=new Set(H(e,i,n));return n.filter(t=>!o.has(t)&&U(t).some(s=>X(e,i,t.name,s)))}export{be as a,Me as b,Re as c,tn as d,$ as e,pe as f,fe as g,on as h,sn as i,rn as j,ye as k,an as l,dn as m};