graview 0.1.52 → 0.1.54

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 (222) hide show
  1. package/dist/preview/chunk.25P5SDNR.js +1 -0
  2. package/dist/preview/chunk.27O4LIDU.js +1 -0
  3. package/dist/preview/{chunk.RWCWRJJC.js → chunk.2DFWOLL2.js} +1 -1
  4. package/dist/preview/{chunk.R6FHEEJ7.js → chunk.2LMB5E6N.js} +1 -1
  5. package/dist/preview/chunk.2WSRJGW2.js +1 -0
  6. package/dist/preview/{chunk.IVI3HRSF.js → chunk.33YC5RCB.js} +1 -1
  7. package/dist/preview/chunk.3G5DEGFA.js +1 -0
  8. package/dist/preview/{chunk.73EKJ4JN.js → chunk.3IEJQAK7.js} +1 -1
  9. package/dist/preview/chunk.3JMZHCB4.js +293 -0
  10. package/dist/preview/chunk.3MZIWKNG.js +5 -0
  11. package/dist/preview/{chunk.FLNYLE6S.js → chunk.3SOJJAMY.js} +1 -1
  12. package/dist/preview/{chunk.QRCTTDDQ.js → chunk.3V2WXZU3.js} +1 -1
  13. package/dist/preview/{chunk.R77TACXU.js → chunk.3ZONBC6L.js} +1 -1
  14. package/dist/preview/{chunk.SZCZD2GM.js → chunk.45HTFSWD.js} +1 -1
  15. package/dist/preview/chunk.463PGKOL.js +35 -0
  16. package/dist/preview/chunk.4BX3KLAA.js +1 -0
  17. package/dist/preview/chunk.4F5M5XZG.js +1 -0
  18. package/dist/preview/{chunk.ZK42LPF5.js → chunk.4GHXAWIE.js} +1 -1
  19. package/dist/preview/chunk.4KTHJY5N.js +19 -0
  20. package/dist/preview/{chunk.ULAMIQ52.js → chunk.4TGQ6Z6E.js} +1 -1
  21. package/dist/preview/{chunk.VKOCD5CL.js → chunk.4V64RBCK.js} +1 -1
  22. package/dist/preview/{chunk.I2W7HSBU.js → chunk.4WH4N4V7.js} +1 -1
  23. package/dist/preview/{chunk.NAPTE3S6.js → chunk.562IVJHX.js} +1 -1
  24. package/dist/preview/chunk.57VTD3CU.js +1 -0
  25. package/dist/preview/{chunk.JQBP6QWQ.js → chunk.5C43AM3X.js} +1 -1
  26. package/dist/preview/chunk.5M62CMLA.js +1 -0
  27. package/dist/preview/chunk.5RH6FO3K.js +1 -0
  28. package/dist/preview/chunk.5VF2RT4H.js +1 -0
  29. package/dist/preview/chunk.5XAIP3BS.js +1 -0
  30. package/dist/preview/{chunk.CV4QA4ZF.js → chunk.5ZWE72VJ.js} +1 -1
  31. package/dist/preview/{chunk.NB6WN4DO.js → chunk.644FUGSX.js} +1 -1
  32. package/dist/preview/chunk.6BBB7SJL.js +1 -0
  33. package/dist/preview/chunk.6SPORDJC.js +1 -0
  34. package/dist/preview/{chunk.C4UNAJWC.js → chunk.6TILXTP6.js} +1 -1
  35. package/dist/preview/{chunk.7UXDIEPK.js → chunk.7JCUSYS5.js} +1 -1
  36. package/dist/preview/{chunk.NHIPVAGR.js → chunk.7SCENHVG.js} +1 -1
  37. package/dist/preview/{chunk.HSGUXMAO.js → chunk.7TMWMW4W.js} +1 -1
  38. package/dist/preview/{chunk.3TME4BG3.js → chunk.7UD2JR6J.js} +1 -1
  39. package/dist/preview/{chunk.C7EEYSAM.js → chunk.AG7CUSSV.js} +1 -1
  40. package/dist/preview/{chunk.INL4OZI7.js → chunk.AKLVSZ5A.js} +1 -1
  41. package/dist/preview/chunk.AN5QCSVK.js +1 -0
  42. package/dist/preview/chunk.ARRLAAG6.js +1 -0
  43. package/dist/preview/{chunk.7354O67H.js → chunk.AZGXBTOQ.js} +1 -1
  44. package/dist/preview/{chunk.FJC6PMOG.js → chunk.B2X6DA2Q.js} +4 -4
  45. package/dist/preview/chunk.B3WVCSW5.js +1 -0
  46. package/dist/preview/chunk.B6PKKEY3.js +1 -0
  47. package/dist/preview/{chunk.VGTEEANA.js → chunk.BOMYLOCX.js} +1 -1
  48. package/dist/preview/chunk.BPWSQVEN.js +1 -0
  49. package/dist/preview/{chunk.I43ONAEL.js → chunk.BUDEUNBN.js} +1 -1
  50. package/dist/preview/chunk.C3AHDHX7.js +1 -0
  51. package/dist/preview/{chunk.FEBCIEI3.js → chunk.C6HBYRGJ.js} +1 -1
  52. package/dist/preview/chunk.C6HI3LRB.js +1 -0
  53. package/dist/preview/{chunk.7XJ3XQZD.js → chunk.CB5DGKR5.js} +1 -1
  54. package/dist/preview/{chunk.2K3YQJW3.js → chunk.CB7IUKY7.js} +2 -2
  55. package/dist/preview/{chunk.GZHEGKPF.js → chunk.COWJTVZV.js} +1 -1
  56. package/dist/preview/{chunk.5DDHFNZM.js → chunk.D2PJG5N7.js} +1 -1
  57. package/dist/preview/chunk.D6ACCKYJ.js +1 -0
  58. package/dist/preview/{chunk.CBGKWYGI.js → chunk.DF7IPT7V.js} +2 -2
  59. package/dist/preview/{chunk.R7CRV2FE.js → chunk.DTJ4FIHM.js} +1 -1
  60. package/dist/preview/chunk.DVG47BK3.js +1 -0
  61. package/dist/preview/{chunk.LTJYKQJG.js → chunk.E5JX5LWY.js} +1 -1
  62. package/dist/preview/chunk.EC7I33WI.js +1 -0
  63. package/dist/preview/chunk.F5RN6YXG.js +4 -0
  64. package/dist/preview/chunk.FCZ7UFJI.js +1 -0
  65. package/dist/preview/chunk.FMP6NDRZ.js +1 -0
  66. package/dist/preview/{chunk.OS3WZV6C.js → chunk.FRZQSSGE.js} +2 -2
  67. package/dist/preview/chunk.FWKNR7XF.js +4 -0
  68. package/dist/preview/chunk.FWZF7X6A.js +67 -0
  69. package/dist/preview/{chunk.BHPZK4WJ.js → chunk.GHPCSNM6.js} +2 -2
  70. package/dist/preview/{chunk.52J42KR5.js → chunk.GKLDSHHH.js} +1 -1
  71. package/dist/preview/{chunk.7UJZP3YK.js → chunk.GVUJCOKD.js} +2 -2
  72. package/dist/preview/chunk.HLDMTKUP.js +1 -0
  73. package/dist/preview/{chunk.DGWNVDZB.js → chunk.IDYPQ45A.js} +1 -1
  74. package/dist/preview/{chunk.RBWYXVUW.js → chunk.IMHUKSPM.js} +2 -2
  75. package/dist/preview/chunk.IYYP6QUH.js +1 -0
  76. package/dist/preview/chunk.J2Z6WLCH.js +88 -0
  77. package/dist/preview/chunk.J3OX474P.js +1 -0
  78. package/dist/preview/chunk.JCFYZEMY.js +1 -0
  79. package/dist/preview/chunk.JLB4QP6Q.js +1 -0
  80. package/dist/preview/{chunk.R7ZZJOJW.js → chunk.JTOAZ2IR.js} +1 -1
  81. package/dist/preview/chunk.JXGDVJ4N.js +1 -0
  82. package/dist/preview/{chunk.D62V3TBW.js → chunk.K2J26XMB.js} +2 -2
  83. package/dist/preview/{chunk.J6IB2HUZ.js → chunk.KI6M3EWZ.js} +1 -1
  84. package/dist/preview/{chunk.LESRQN3Y.js → chunk.KJGNLWU3.js} +2 -2
  85. package/dist/preview/chunk.KLJDBYAZ.js +1 -0
  86. package/dist/preview/{chunk.XLM4ONUB.js → chunk.KRVEAIKW.js} +1 -1
  87. package/dist/preview/{chunk.KVEDMKUN.js → chunk.KY7QD22S.js} +1 -1
  88. package/dist/preview/{chunk.J2R55TM7.js → chunk.L7MFTL5S.js} +1 -1
  89. package/dist/preview/chunk.LNOWO3IY.js +2 -0
  90. package/dist/preview/{chunk.DXZ5VYCQ.js → chunk.LOUICR7K.js} +1 -1
  91. package/dist/preview/{chunk.NVNQSZ43.js → chunk.LU3B3SZH.js} +1 -1
  92. package/dist/preview/chunk.LVOL2LEC.js +1 -0
  93. package/dist/preview/chunk.LYFEGG6E.js +1 -0
  94. package/dist/preview/chunk.MAWP27FD.js +28 -0
  95. package/dist/preview/chunk.MDWCX3YU.js +1 -0
  96. package/dist/preview/chunk.MNW2ZBQ6.js +1 -0
  97. package/dist/preview/{chunk.7KZ44FEU.js → chunk.MPMROUZA.js} +1 -1
  98. package/dist/preview/{chunk.BJL6EL6B.js → chunk.MVRNEC3Y.js} +1 -1
  99. package/dist/preview/chunk.NDI5OWIB.js +1 -0
  100. package/dist/preview/chunk.NEJSKMJV.js +2 -0
  101. package/dist/preview/{chunk.N7D5LKBI.js → chunk.NGWHV4G6.js} +1 -1
  102. package/dist/preview/{chunk.T2Q3AAQI.js → chunk.OCV46AFN.js} +1 -1
  103. package/dist/preview/{chunk.7IOC6U3C.js → chunk.OLKFEHWB.js} +1 -1
  104. package/dist/preview/{chunk.GL3YVGAP.js → chunk.OZ4EJ5M6.js} +2 -2
  105. package/dist/preview/chunk.PCNEM3WE.js +1 -0
  106. package/dist/preview/chunk.PR2TSHE7.js +9 -0
  107. package/dist/preview/{chunk.C4EPMV7O.js → chunk.PZ4G5QA5.js} +1 -1
  108. package/dist/preview/{chunk.YKACMLLU.js → chunk.PZWJUQAO.js} +1 -1
  109. package/dist/preview/{chunk.7FZY5E2U.js → chunk.Q6RUTFU3.js} +1 -1
  110. package/dist/preview/chunk.QB7RYJ67.js +5 -0
  111. package/dist/preview/{chunk.P5PXWOHI.js → chunk.R7RDUW37.js} +1 -1
  112. package/dist/preview/{chunk.XZLKTOJE.js → chunk.RBYRT2I2.js} +1 -1
  113. package/dist/preview/{chunk.6CY3EA6U.js → chunk.RCFAHV5N.js} +1 -1
  114. package/dist/preview/{chunk.OYRZ2DEI.js → chunk.RLO3RDYH.js} +1 -1
  115. package/dist/preview/chunk.RYMSHMLM.js +1 -0
  116. package/dist/preview/chunk.SDO3DD77.js +6 -0
  117. package/dist/preview/chunk.SF4BYBH6.js +25 -0
  118. package/dist/preview/chunk.SG7YVKH4.js +1 -0
  119. package/dist/preview/chunk.T42H5RXN.js +1 -0
  120. package/dist/preview/{chunk.7EA7THSM.js → chunk.TUNHUTQ5.js} +1 -1
  121. package/dist/preview/chunk.U7GN6UPR.js +1 -0
  122. package/dist/preview/{chunk.QWQBPJ4U.js → chunk.ULSN3ASK.js} +1 -1
  123. package/dist/preview/chunk.V6X3U3JF.js +1 -0
  124. package/dist/preview/chunk.VFMC45E7.js +1 -0
  125. package/dist/preview/{chunk.3FKP32RG.js → chunk.VGOWGOGD.js} +2 -2
  126. package/dist/preview/chunk.VTO6UWUP.js +1 -0
  127. package/dist/preview/chunk.VW6X53E7.js +1 -0
  128. package/dist/preview/chunk.VWQ57LTT.js +18 -0
  129. package/dist/preview/chunk.VYKEIKY5.js +1 -0
  130. package/dist/preview/{chunk.EIWTZC4A.js → chunk.W6NCLU5Y.js} +1 -1
  131. package/dist/preview/{chunk.KFTZLNHY.js → chunk.WHGEDJB2.js} +19 -14
  132. package/dist/preview/{chunk.J263VQF5.js → chunk.WICMCZ27.js} +1 -1
  133. package/dist/preview/{chunk.QPP3OJVR.js → chunk.WVWXNW74.js} +2 -2
  134. package/dist/preview/chunk.XBDFXFWM.js +1 -0
  135. package/dist/preview/chunk.XE72DFBV.js +13 -0
  136. package/dist/preview/{chunk.LSL25VXW.js → chunk.XTT6ERI3.js} +1 -1
  137. package/dist/preview/{chunk.KPUX27ZT.js → chunk.XZJ6XX5I.js} +1 -1
  138. package/dist/preview/chunk.Y2DFDMT6.js +1 -0
  139. package/dist/preview/{chunk.G7XKQNOL.js → chunk.Y36MLVMT.js} +1 -1
  140. package/dist/preview/chunk.Y36WSKL5.js +1 -0
  141. package/dist/preview/chunk.YXRKZMS5.js +1 -0
  142. package/dist/preview/chunk.Z6O7RUSR.js +1 -0
  143. package/dist/preview/chunk.ZAGP3OKY.js +1 -0
  144. package/dist/preview/{chunk.M33LUF3Q.js → chunk.ZBHFCSKO.js} +1 -1
  145. package/dist/preview/{chunk.Y37DXEHG.js → chunk.ZDDWXRPK.js} +1 -1
  146. package/dist/preview/{chunk.5WU2UTP7.js → chunk.ZUBC3UFG.js} +1 -1
  147. package/dist/preview/{chunk.7FMS57QO.js → chunk.ZYW7Q5EN.js} +1 -1
  148. package/dist/preview/index.html +50 -51
  149. package/dist/preview/page.js +2 -2
  150. package/package.json +6 -6
  151. package/dist/preview/chunk.2EB7COX5.js +0 -1
  152. package/dist/preview/chunk.2X3UZJWI.js +0 -1
  153. package/dist/preview/chunk.337JMOTL.js +0 -1
  154. package/dist/preview/chunk.3ZQAPPJ5.js +0 -18
  155. package/dist/preview/chunk.4LI73QOY.js +0 -6
  156. package/dist/preview/chunk.4VI3EYDL.js +0 -1
  157. package/dist/preview/chunk.4ZLCMATU.js +0 -2
  158. package/dist/preview/chunk.5LWPNOJA.js +0 -1
  159. package/dist/preview/chunk.63SRVTG2.js +0 -19
  160. package/dist/preview/chunk.6BA6RUK7.js +0 -1
  161. package/dist/preview/chunk.6JERQFZI.js +0 -1
  162. package/dist/preview/chunk.6NIE3ILA.js +0 -1
  163. package/dist/preview/chunk.6QNBUBGD.js +0 -1
  164. package/dist/preview/chunk.7OAXW7QF.js +0 -1
  165. package/dist/preview/chunk.7SNIX56B.js +0 -1
  166. package/dist/preview/chunk.AI2HBKVP.js +0 -359
  167. package/dist/preview/chunk.BDQ4FUKO.js +0 -1
  168. package/dist/preview/chunk.BRDAO2OF.js +0 -4
  169. package/dist/preview/chunk.CC7E6NUQ.js +0 -1
  170. package/dist/preview/chunk.CHMUL36A.js +0 -1
  171. package/dist/preview/chunk.D2T563AA.js +0 -1
  172. package/dist/preview/chunk.DC7M56NM.js +0 -9
  173. package/dist/preview/chunk.DIS7JS7X.js +0 -1
  174. package/dist/preview/chunk.DVLWSCIC.js +0 -35
  175. package/dist/preview/chunk.EHOEMVQP.js +0 -1
  176. package/dist/preview/chunk.EME5HQ3H.js +0 -1
  177. package/dist/preview/chunk.FJEXINFF.js +0 -1
  178. package/dist/preview/chunk.G446PWV6.js +0 -1
  179. package/dist/preview/chunk.HST7BYFW.js +0 -1
  180. package/dist/preview/chunk.JOWJNIWH.js +0 -4
  181. package/dist/preview/chunk.JV7FLVUV.js +0 -1
  182. package/dist/preview/chunk.KQSD5MLY.js +0 -1
  183. package/dist/preview/chunk.KSJ3J5UN.js +0 -1
  184. package/dist/preview/chunk.LXJW2Z2M.js +0 -1
  185. package/dist/preview/chunk.MBNZ2HK7.js +0 -1
  186. package/dist/preview/chunk.MCFLCC42.js +0 -12
  187. package/dist/preview/chunk.MYKRJ4SV.js +0 -1
  188. package/dist/preview/chunk.NICCIJV4.js +0 -1
  189. package/dist/preview/chunk.NQPNK6I5.js +0 -1
  190. package/dist/preview/chunk.NWK4E7TJ.js +0 -1
  191. package/dist/preview/chunk.NZB5S5UO.js +0 -1
  192. package/dist/preview/chunk.PFXGWY3P.js +0 -1
  193. package/dist/preview/chunk.PRCWGE7A.js +0 -1
  194. package/dist/preview/chunk.PXHBPLTQ.js +0 -1
  195. package/dist/preview/chunk.PXVJBL2C.js +0 -1
  196. package/dist/preview/chunk.Q3XKNZQW.js +0 -1
  197. package/dist/preview/chunk.Q5IAXTF5.js +0 -25
  198. package/dist/preview/chunk.Q5WEOX3Q.js +0 -1
  199. package/dist/preview/chunk.QXCYAFRT.js +0 -1
  200. package/dist/preview/chunk.RMRO5JZX.js +0 -1
  201. package/dist/preview/chunk.S4ZWBCYC.js +0 -1
  202. package/dist/preview/chunk.SELLAVIQ.js +0 -1
  203. package/dist/preview/chunk.SHNYYBNW.js +0 -1
  204. package/dist/preview/chunk.SM6HTPYF.js +0 -1
  205. package/dist/preview/chunk.T6KKNWZT.js +0 -1
  206. package/dist/preview/chunk.U6PCKJ26.js +0 -1
  207. package/dist/preview/chunk.UEPVA6IS.js +0 -1
  208. package/dist/preview/chunk.UMS7XRPO.js +0 -1
  209. package/dist/preview/chunk.VGIWQNJB.js +0 -1
  210. package/dist/preview/chunk.VOHRQXCF.js +0 -5
  211. package/dist/preview/chunk.W5UJLKIT.js +0 -1
  212. package/dist/preview/chunk.WUEU3QBL.js +0 -1
  213. package/dist/preview/chunk.WWUMSCYC.js +0 -1
  214. package/dist/preview/chunk.XPR3QFF4.js +0 -1
  215. package/dist/preview/chunk.YKXUDACI.js +0 -28
  216. package/dist/preview/chunk.YUEOUV7G.js +0 -5
  217. package/dist/preview/chunk.YYWLYVAW.js +0 -1
  218. package/dist/preview/chunk.Z2JMTRF4.js +0 -1
  219. package/dist/preview/chunk.Z2UFPOAN.js +0 -88
  220. package/dist/preview/chunk.ZEKKIMKI.js +0 -1
  221. package/dist/preview/chunk.ZJXUWOG3.js +0 -1
  222. package/dist/preview/chunk.ZZGXVYW2.js +0 -1
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{s as P}from"./chunk.PZWJUQAO.js";import{G as M,Ga as S,O as w,T as y,ba as m,ca as I,s as b,w as T,x as A}from"./chunk.SF4BYBH6.js";import{a as p}from"./chunk.SDO3U72B.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.JTOAZ2IR.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.VW6X53E7.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.RBYRT2I2.js","./chunk.JTOAZ2IR.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.U7GN6UPR.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as q,g as te,h as ne}from"./chunk.5RH6FO3K.js";import{a as X,b as Z,c as ee}from"./chunk.ZDDWXRPK.js";import{b}from"./chunk.LOUICR7K.js";import{d as B}from"./chunk.4F5M5XZG.js";import{a as Q}from"./chunk.AZGXBTOQ.js";import{a as I}from"./chunk.5ZWE72VJ.js";import{j as K}from"./chunk.FWZF7X6A.js";import{G as P,Ga as Y,J as U,O as T,P as M,Ra as _,T as G,Va as J,ba as w,ja as V}from"./chunk.SF4BYBH6.js";import{a as F}from"./chunk.SDO3U72B.js";import{Ya as z,da as E,fa as $,wb as A}from"./chunk.3MZIWKNG.js";import{b as L}from"./chunk.AJZBJBMO.js";var y=L(P(),1);var ie=L(P(),1);function ae(){let{ai:i,aiDesk:n}=w(),{entries:r}=U(n),a=i.off===!0;return(0,ie.useEffect)(()=>{a||n.load()},[n,a]),a?[]:r}var e=L(G(),1),oe=Y(F(()=>(__graviewPreload(import.meta.url,["./chunk.VYKEIKY5.js","./chunk.IDYPQ45A.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.27O4LIDU.js")))),ue=oe.part((i,n)=>(0,e.jsx)(i.InteractionRow,{...n}),{quiet:!0,as:"li"}),he=oe.part((i,n)=>(0,e.jsx)(i.ActivityFilter,{...n}),{quiet:!0,as:"div"}),re=(i,n,r=se(i,[n]))=>({intent:n.intent,author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:Q(n.lineage)}:{},touched:[...new Set(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes))],...ye(n.ops.filter(a=>!A(a)).flatMap(a=>a.writes),r),batch:n.id,at:n.at,...n.lineage?.interaction?{interaction:n.lineage.interaction}:{},seq:n.ops.at(-1).seq+1,...n.ops.every(A)?{withheld:!0}:{}});function ce(i=4){let{store:n,principal:r}=w(),a=M(n,r),d=a.log.length;return(0,y.useMemo)(()=>{let s=a.batches(),l=se(a,s);return Z(s,o=>a.log.get(o)).reverse().slice(0,i).map(o=>{if("batch"in o){let p=re(a,o.batch,l);return o.typed?{...p,intent:X(o.typed,a.schema,a.graph),batches:o.typed.batches.filter(c=>!c.undone).map(c=>c.id)}:p}let u=[...o.digest.batches].reverse().map(p=>re(a,p,l));return{intent:ee(o.digest),author:o.digest.author.kind,...o.digest.author.id?{authorId:o.digest.author.id}:{},by:o.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[a,d,i])}function se(i,n){let r=new Map;for(let a of n)for(let d of a.ops)if(!A(d))for(let s of d.primitives)(s.op==="add-node"||s.op==="remove-node")&&s.node&&r.set(s.node.id,E(i.schema.tryDefinition(s.node.kind),s.node));return r}function ye(i,n){let r={};for(let a of i){let d=n.get(a);d!==void 0&&(r[a]=d)}return Object.keys(r).length>0?{named:r}:{}}function fe({change:i}){let{store:n,principal:r,seats:a,people:d}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[i.author==="human"&&i.by?.onBehalfOf===void 0&&(i.authorId===void 0||r.id===void 0||i.authorId===r.id)?"you":z(i.by??{kind:i.author,id:i.authorId},{graph:n.graph,schema:n.schema,seats:a,people:d}),I(i.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(i.via)]}):null]})}function me({change:i,goes:n}){let{store:r}=w(),[a,d]=(0,y.useState)(!1),s=i.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(fe,{change:i})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:i.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":a,onClick:()=>d(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:a?"Hide":"Show each"})]}),a?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:s.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(D,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:l.touched.slice(0,4).map(o=>(0,e.jsx)(O,{id:o,label:r.graph.has(o)?b(r,o):l.named?.[o]??b(r,o),go:n(o)},o))}):null]},l.batch))}):null]})}function D({batch:i}){let{store:n,principal:r,noteSeat:a}=w(),d=M(n,r),s=T()?.open??!1,l=d.log.length,[o,u]=(0,y.useState)(null),p=(0,y.useMemo)(()=>d.canUndo(i),[d,i,l]);if(s||!p.ok&&p.ops.length===0)return null;let c=!p.ok,k=c?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:c?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof i=="string"?[i]:i,x=d.log.all().find(C=>v.includes(C.batch)&&C.author.kind==="agent");d.undo(c?[...v,...k]:typeof i=="string"?i:[...i],{author:r}),x&&a({type:"home",author:x.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...c?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:c?`undo +${k.length}`:"undo"}),o?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:o}):null]})}function ve({seq:i,intent:n}){let r=T();if(!r)return null;let a=r.past?.seq===i;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":a,onPointerEnter:q,onFocus:q,onClick:()=>r.show(i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function we(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(i())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function O({id:i,label:n,go:r}){return r?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":i,title:`Go to ${n}`,onClick:()=>r(i),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(B,{label:n})}):(0,e.jsx)(B,{label:n})}function He({calls:i,seat:n,remembers:r=!1}){let a=ce(),{store:d,principal:s,seats:l,people:o}=w(),u=ae(),[p,c]=(0,y.useState)("all"),[k,v]=(0,y.useState)(!1),x=t=>t!==void 0&&(t.id===s.id||t.onBehalfOf?.id===s.id)&&s.id!==void 0,C=new Set(u.map(t=>t.id)),de=a.filter(t=>!(t.interaction!==void 0&&C.has(t.interaction))&&(!k||x(t.by))),le=u.filter(t=>!k||x(t.by)).slice(0,4),R=[...p==="ai"?[]:de.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:le.map(t=>({at:t.at,entry:t}))].sort((t,f)=>t.at<f.at?1:t.at>f.at?-1:0),m=M(d,s),H=i.some(t=>t.phase==="running"),pe=te(),S=J("activity"),N=S.open,ge=V(),j=T(),W=t=>m.graph.has(t)?f=>{S.setOpen(!1),j?.past&&j.show(null),ge.record(f)}:null;return n===void 0&&i.length===0&&a.length===0&&u.length===0&&!r&&pe===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...S.trigger,onClick:S.toggle,title:H?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:H?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[H?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,a.length>0?a.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!N&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,N?(0,e.jsxs)("section",{...S.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{..._,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...K,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||R.length>0?9:0,...i.length>0||R.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.slice(0,6).map((t,f)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??$(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(g=>(0,e.jsx)(O,{id:g,label:b(m,g),go:W(g)},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,h])=>(0,e.jsx)(O,{id:h,label:b(m,h),go:W(h)},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${f}`))}):null,u.length>0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(he,{shows:p,onShows:c,mine:k,onMine:v})}):null,R.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:R.map(({change:t,entry:f},g)=>f!==void 0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(ue,{entry:f,undo:h=>(0,e.jsx)(D,{batch:h})})},`ai:${f.id}`):t.digest?(0,e.jsx)(me,{change:t,goes:W},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||s.id===void 0||t.authorId===s.id)?"you":z(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:o}),I(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(ve,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(D,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(h=>(0,e.jsx)(O,{id:h,label:m.graph.has(h)?b(m,h):t.named?.[h]??b(m,h),go:W(h)},h))})]},`change:${g}`))}):null,(0,e.jsx)(ne,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),r?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(we,{})]}):null]}):null]})}export{D as a,He as b};
@@ -0,0 +1 @@
1
+ import{a as R,b as W}from"./chunk.25VJPUDH.js";import{e as E,f as C,g as z}from"./chunk.ZDDWXRPK.js";import{b as N}from"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import{d as I}from"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import{a as D}from"./chunk.AZGXBTOQ.js";import"./chunk.TI4OSTQV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import{j as f}from"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as M,Ra as H,T as k,Va as A,ba as b,da as x}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Ya as S}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as w}from"./chunk.AJZBJBMO.js";var n=w(M(),1);var e=w(k(),1);function O(t,o){let r=[t>0?`${t===1?"one suggestion":`${t} suggestions`} waiting`:"",o>0?`tidied ${o===1?"one thing":`${o} things`} while you were away`:""].filter(Boolean);return r.length>0?r.join(" \xB7 ").replace(/^./,s=>s.toUpperCase()):void 0}function _(){let{store:t,principal:o,dismissals:r,whileAway:s,app:u}=b(),h=x(),l=(0,n.useMemo)(()=>W(r,u?.name??"app",o),[r,u?.name,o]),[m,y]=(0,n.useReducer)(g=>g+1,0);(0,n.useEffect)(()=>l.onChange?.(y),[l]);let a=(0,n.useMemo)(()=>E(t,o,{dismissed:l.list()}),[t,o,h,l,m]),[v,p]=(0,n.useState)(""),i=A("suggested"),d=s?.tidied??0,c=s?O(a.length,d):void 0;if(a.length===0&&d===0)return null;let L=g=>{if(p(g),a.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}i.setOpen(!1),(document.querySelector('[data-testid="activity-button"]')??document.querySelector('[data-graview-app-bar] button:not([data-testid="suggested-button"])'))?.focus()};return(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...i.trigger,onClick:i.toggle,title:c??"What tidying suggests, waiting for you",...c?{"aria-label":`Suggested: ${c}`}:{},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[a.length>0?a.length:`Tidied ${d}`,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),a.length>0?(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"}):null]}),i.open?(0,e.jsxs)("section",{...i.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...H,width:320,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...f,margin:0},children:"Suggested"}),c?(0,e.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[c,"."]}):null,(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:a.length>0?"Not made yet: each waits for you.":"What it did is in Activity."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10,fontSize:"0.8125rem"},children:a.map(g=>(0,e.jsx)($,{suggestion:g,notNow:l,settled:L},g.id))}),(0,e.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:f,children:v})]}):null]})}var T={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow."};function $({suggestion:t,notNow:o,settled:r}){let{store:s,principal:u,seats:h,people:l}=b(),[m,y]=(0,n.useState)(null),a=(0,n.useId)(),v=S(t.author,{graph:s.graph,schema:s.schema,seats:h,people:l}),p=async i=>{y(null);try{i==="accept"?C(s,t.id,{author:u}):i==="decline"?z(s,t.id,{author:u}):await o.dismiss({suggestion:t.id,at:new Date().toISOString(),until:R()}),r(T[i])}catch(d){y(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:v})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:D(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(i=>(0,e.jsx)(I,{label:N(s,i),pickId:i},i))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void p("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void p("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void p("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":a,style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",marginInlineStart:"auto",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Not now"}),(0,e.jsx)("span",{id:a,style:f,children:"Hides it from you until tomorrow; it still waits for everyone else."})]}),m?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:m}):null]})}export{_ as SuggestedTray,O as awayWords};
@@ -1 +1 @@
1
- import{E as b,L as w,M as N,N as T,P as O,Q as S,U as m}from"./chunk.VOHRQXCF.js";var x=864e5,j=/^(\d{4})-(\d{2})-(\d{2})/,p=e=>String(e).padStart(2,"0"),D=e=>new Date(e).toISOString().slice(0,10),a=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),g=(e,t)=>D(a(e)+t*x),W=e=>new Date(a(e)).getUTCDay();function c(e,t,r){if(!(t>=1&&t<=12&&r>=1&&r<=31))return;let i=`${String(e).padStart(4,"0")}-${p(t)}-${p(r)}`;return D(a(i))===i?i:void 0}function F(e=new Date){let t=N();return t?O(e.getTime(),t):{day:`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var h=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function l(e){if(typeof e!="string")return;if(h(e)){let i=new Date(e);return Number.isNaN(i.getTime())?void 0:F(i)}let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t||!c(Number(t[1]),Number(t[2]),Number(t[3])))return;let r=e.slice(0,10);return t[4]===void 0?{day:r}:{day:r,minutes:Number(t[4])*60+Number(t[5])}}function A(e,t){if(!t.time)return e.day;let r=e.minutes??9*60;if(!t.instant)return`${e.day}T${p(Math.floor(r/60))}:${p(r%60)}`;let i=N(),[,n,o,d]=j.exec(e.day);return(i?new Date(S(e.day,r,i)):new Date(Number(n),Number(o)-1,Number(d),Math.floor(r/60),r%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function z(e,t=new Date){let r=T(),i=r;try{i=new Intl.DateTimeFormat(e??b,{timeZoneName:"short",timeZone:r}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??r}catch{i=r}return{zone:r,short:i}}function L(e,t,r,i){let n=l(t);if(!n)return r;let o=e===void 0?void 0:l(e),d=r===void 0?void 0:l(r),u=s=>a(s.day)+(s.minutes??0)*6e4,f=(s,$)=>{let y=u(s)+$;return{day:D(y),...i.time?{minutes:Math.round(y%x/6e4)}:{}}};return o&&d?A(f(d,u(n)-u(o)),i):d&&u(d)>=u(n)?r:i.time?A(f(n,36e5),i):r}var Y=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,B=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function P(e,t={}){let r=(t.start&&e.includes(t.start)?t.start:void 0)??e.find(n=>Y.test(n)),i=(t.end&&e.includes(t.end)?t.end:void 0)??e.find(n=>n!==r&&B.test(n));return r&&i?{start:r,end:i}:void 0}var Z=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],H=["sun","mon","tue","wed","thu","fri","sat"],I="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",E="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",C=e=>Z.indexOf(e.slice(0,3))+1,M=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function U(e){try{let t=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(r=>r.type);return t.indexOf("month")<t.indexOf("day")}catch{return!0}}function v(e){let t=(n,o)=>({minutes:o,rest:`${e.slice(0,n.index)} ${e.slice(n.index+n[0].length)}`}),r=/\b(noon|midday)\b/.exec(e);if(r)return t(r,12*60);if(r=/\bmidnight\b/.exec(e),r)return t(r,0);if(r=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),r){let n=Number(r[1]),o=Number(r[2]??0);return n<1||n>12||o>59?{rest:e,bad:!0}:t(r,(n%12+(r[3]==="p"?12:0))*60+o)}if(r=/\b(\d{1,2}):(\d{2})\b/.exec(e),r){let n=Number(r[1]),o=Number(r[2]);return n>23||o>59?{rest:e,bad:!0}:t(r,n*60+o)}if(r=/\bat\s+(\d{1,2})\b/.exec(e),r){let n=Number(r[1]);return n>23?{rest:e,bad:!0}:t(r,(n>=1&&n<=7?n+12:n)*60)}let i=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return i?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[i[1]]*60,rest:i[1]==="tonight"?`${e.slice(0,i.index)} today ${e.slice(i.index+i[0].length)}`:`${e.slice(0,i.index)} ${e.slice(i.index+i[0].length)}`}:{rest:e}}function K(e,t,r){let i=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(i==="")return null;if(i==="today"||i==="now")return t;if(i==="tomorrow"||i==="tmrw"||i==="tmr")return g(t,1);if(i==="yesterday")return g(t,-1);if(i==="next week")return g(t,7);let n=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(i);if(n)return g(t,Number(n[1])*(n[2].startsWith("week")?7:1));if(n=new RegExp(`^(next )?${E}$`).exec(i),n){let s=(H.indexOf(n[2].slice(0,3))-W(t)+7)%7;return g(t,n[1]&&s===0?7:s)}if(n=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(i),n)return c(Number(n[1]),Number(n[2]),Number(n[3]));let o=i.replace(new RegExp(`^${E} `),"");n=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${I}(?: (\\d{4}))?$`).exec(o);let d=n?{date:n[1],month:n[2],year:n[3]}:void 0;n=new RegExp(`^${I} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(o);let u=d??(n?{date:n[2],month:n[1],year:n[3]}:void 0);if(u)return R(t,M(u.year),C(u.month),Number(u.date));if(n=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(o),n){let[f,s]=[Number(n[1]),Number(n[2])],[$,y]=U(r)?[f,s]:[s,f];return R(t,M(n[3]),$,y)}}function R(e,t,r,i){if(t!==void 0)return c(t,r,i);let n=Number(e.slice(0,4)),o=c(n,r,i);return o===void 0?c(n+1,r,i):a(e)-a(o)>183*x?c(n+1,r,i):o}function q(e,t){let r=e.trim();if(h(r)){let u=l(r);if(u)return t.time?u:{day:u.day}}let i=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(i==="")return;let n=v(i);if(n.bad)return;let o=K(n.rest,t.today,t.locale??b);if(o===void 0||o===null&&n.minutes===void 0)return;let d=o??t.base?.day??t.today;return t.time?{day:d,minutes:n.minutes??t.base?.minutes??9*60}:{day:d}}function G(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[t,...r]=e.split(":"),i=r.join(":");return(t==="mcp"||t==="view")&&i?`via ${i}`:t==="mcp"?"via an agent's tools":`via ${e}`}var _=e=>{if(!e.currency)return{before:!0};try{let t=w(e.locale),r=new Intl.NumberFormat(t,{style:"currency",currency:e.currency}).formatToParts(1),i=r.findIndex(d=>d.type==="currency"),n=r.findIndex(d=>d.type==="integer"),o;try{o=new Intl.DisplayNames([t],{type:"currency"}).of(e.currency)}catch{}return{...i>=0?{symbol:r[i].value}:{},before:i<n,...o?{name:o}:{}}}catch{return{symbol:e.currency,before:!0}}};function J(e){let t=e.locale;if(e.format==="money"){let{symbol:r,before:i,name:n}=_(e),o=m(1250,t,{minimumFractionDigits:2,maximumFractionDigits:2});return{...r?i?{prefix:r}:{suffix:r}:{},placeholder:o,hint:n?`in ${n}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:m(15,t),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function Q(e,t){return e===void 0||!Number.isFinite(e)?"":t.format==="money"?m(e,t.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):t.format==="percent"?m(e*100,t.locale,{maximumFractionDigits:4}):m(e,t.locale,{maximumFractionDigits:6})}function V(e){try{let t=new Intl.NumberFormat(w(e)).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function X(e,t){let{group:r,decimal:i}=V(t),n=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(i!=="."&&!n.includes(i)&&/^-?\d+\.\d{1,2}$/.test(n))return Number(n);if(r&&(n=n.split(r).join("")),i!=="."&&(n=n.replace(i,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(n))return;let o=Number(n);return Number.isFinite(o)?o:void 0}function k(e,t){let r=e.trim();if(r==="")return;let i=t?.format==="money"&&t.currency?_(t).symbol:void 0,n=r;i&&(n=n.split(i).join("")),t?.currency&&(n=n.replace(new RegExp(t.currency,"gi"),"")),n=n.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(n)&&(n=n.replace(/%\s*$/,"")),t?.unit&&t.format!=="money"&&(n=n.replace(new RegExp(`\\s*${t.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let d=X(n,t?.locale);if(d!==void 0)return t?.format==="percent"?d/100:d}export{G as a,J as b,Q as c,k as d,F as e,h as f,l as g,A as h,z as i,L as j,P as k,q as l};
1
+ import{E as b,L as w,M as N,N as T,P as O,Q as S,U as m}from"./chunk.3MZIWKNG.js";var x=864e5,j=/^(\d{4})-(\d{2})-(\d{2})/,p=e=>String(e).padStart(2,"0"),D=e=>new Date(e).toISOString().slice(0,10),a=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),g=(e,t)=>D(a(e)+t*x),W=e=>new Date(a(e)).getUTCDay();function c(e,t,r){if(!(t>=1&&t<=12&&r>=1&&r<=31))return;let i=`${String(e).padStart(4,"0")}-${p(t)}-${p(r)}`;return D(a(i))===i?i:void 0}function F(e=new Date){let t=N();return t?O(e.getTime(),t):{day:`${e.getFullYear()}-${p(e.getMonth()+1)}-${p(e.getDate())}`,minutes:e.getHours()*60+e.getMinutes()}}var h=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e);function l(e){if(typeof e!="string")return;if(h(e)){let i=new Date(e);return Number.isNaN(i.getTime())?void 0:F(i)}let t=/^(\d{4})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2}))?/.exec(e);if(!t||!c(Number(t[1]),Number(t[2]),Number(t[3])))return;let r=e.slice(0,10);return t[4]===void 0?{day:r}:{day:r,minutes:Number(t[4])*60+Number(t[5])}}function A(e,t){if(!t.time)return e.day;let r=e.minutes??9*60;if(!t.instant)return`${e.day}T${p(Math.floor(r/60))}:${p(r%60)}`;let i=N(),[,n,o,d]=j.exec(e.day);return(i?new Date(S(e.day,r,i)):new Date(Number(n),Number(o)-1,Number(d),Math.floor(r/60),r%60)).toISOString().replace(/\.\d{3}Z$/,"Z")}function z(e,t=new Date){let r=T(),i=r;try{i=new Intl.DateTimeFormat(e??b,{timeZoneName:"short",timeZone:r}).formatToParts(t).find(n=>n.type==="timeZoneName")?.value??r}catch{i=r}return{zone:r,short:i}}function L(e,t,r,i){let n=l(t);if(!n)return r;let o=e===void 0?void 0:l(e),d=r===void 0?void 0:l(r),u=s=>a(s.day)+(s.minutes??0)*6e4,f=(s,$)=>{let y=u(s)+$;return{day:D(y),...i.time?{minutes:Math.round(y%x/6e4)}:{}}};return o&&d?A(f(d,u(n)-u(o)),i):d&&u(d)>=u(n)?r:i.time?A(f(n,36e5),i):r}var Y=/^(start|starts|startsAt|startsOn|startAt|begins|from|opens|checkIn)$/i,B=/^(end|ends|endsAt|endsOn|endAt|until|to|finish|finishes|closes|through|checkOut)$/i;function P(e,t={}){let r=(t.start&&e.includes(t.start)?t.start:void 0)??e.find(n=>Y.test(n)),i=(t.end&&e.includes(t.end)?t.end:void 0)??e.find(n=>n!==r&&B.test(n));return r&&i?{start:r,end:i}:void 0}var Z=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],H=["sun","mon","tue","wed","thu","fri","sat"],I="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",E="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",C=e=>Z.indexOf(e.slice(0,3))+1,M=e=>e===void 0?void 0:e.length===2?2e3+Number(e):Number(e);function U(e){try{let t=new Intl.DateTimeFormat(e,{month:"numeric",day:"numeric"}).formatToParts(0).map(r=>r.type);return t.indexOf("month")<t.indexOf("day")}catch{return!0}}function v(e){let t=(n,o)=>({minutes:o,rest:`${e.slice(0,n.index)} ${e.slice(n.index+n[0].length)}`}),r=/\b(noon|midday)\b/.exec(e);if(r)return t(r,12*60);if(r=/\bmidnight\b/.exec(e),r)return t(r,0);if(r=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(e),r){let n=Number(r[1]),o=Number(r[2]??0);return n<1||n>12||o>59?{rest:e,bad:!0}:t(r,(n%12+(r[3]==="p"?12:0))*60+o)}if(r=/\b(\d{1,2}):(\d{2})\b/.exec(e),r){let n=Number(r[1]),o=Number(r[2]);return n>23||o>59?{rest:e,bad:!0}:t(r,n*60+o)}if(r=/\bat\s+(\d{1,2})\b/.exec(e),r){let n=Number(r[1]);return n>23?{rest:e,bad:!0}:t(r,(n>=1&&n<=7?n+12:n)*60)}let i=/\b(morning|afternoon|evening|tonight)\b/.exec(e);return i?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[i[1]]*60,rest:i[1]==="tonight"?`${e.slice(0,i.index)} today ${e.slice(i.index+i[0].length)}`:`${e.slice(0,i.index)} ${e.slice(i.index+i[0].length)}`}:{rest:e}}function K(e,t,r){let i=e.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(i==="")return null;if(i==="today"||i==="now")return t;if(i==="tomorrow"||i==="tmrw"||i==="tmr")return g(t,1);if(i==="yesterday")return g(t,-1);if(i==="next week")return g(t,7);let n=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(i);if(n)return g(t,Number(n[1])*(n[2].startsWith("week")?7:1));if(n=new RegExp(`^(next )?${E}$`).exec(i),n){let s=(H.indexOf(n[2].slice(0,3))-W(t)+7)%7;return g(t,n[1]&&s===0?7:s)}if(n=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(i),n)return c(Number(n[1]),Number(n[2]),Number(n[3]));let o=i.replace(new RegExp(`^${E} `),"");n=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${I}(?: (\\d{4}))?$`).exec(o);let d=n?{date:n[1],month:n[2],year:n[3]}:void 0;n=new RegExp(`^${I} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(o);let u=d??(n?{date:n[2],month:n[1],year:n[3]}:void 0);if(u)return R(t,M(u.year),C(u.month),Number(u.date));if(n=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(o),n){let[f,s]=[Number(n[1]),Number(n[2])],[$,y]=U(r)?[f,s]:[s,f];return R(t,M(n[3]),$,y)}}function R(e,t,r,i){if(t!==void 0)return c(t,r,i);let n=Number(e.slice(0,4)),o=c(n,r,i);return o===void 0?c(n+1,r,i):a(e)-a(o)>183*x?c(n+1,r,i):o}function q(e,t){let r=e.trim();if(h(r)){let u=l(r);if(u)return t.time?u:{day:u.day}}let i=e.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(i==="")return;let n=v(i);if(n.bad)return;let o=K(n.rest,t.today,t.locale??b);if(o===void 0||o===null&&n.minutes===void 0)return;let d=o??t.base?.day??t.today;return t.time?{day:d,minutes:n.minutes??t.base?.minutes??9*60}:{day:d}}function G(e){if(e===void 0||e==="web"||e.startsWith("ai:")||e.startsWith("app:"))return;if(e==="api")return"via the API";if(e==="cli")return"via the command line";let[t,...r]=e.split(":"),i=r.join(":");return(t==="mcp"||t==="view")&&i?`via ${i}`:t==="mcp"?"via an agent's tools":`via ${e}`}var _=e=>{if(!e.currency)return{before:!0};try{let t=w(e.locale),r=new Intl.NumberFormat(t,{style:"currency",currency:e.currency}).formatToParts(1),i=r.findIndex(d=>d.type==="currency"),n=r.findIndex(d=>d.type==="integer"),o;try{o=new Intl.DisplayNames([t],{type:"currency"}).of(e.currency)}catch{}return{...i>=0?{symbol:r[i].value}:{},before:i<n,...o?{name:o}:{}}}catch{return{symbol:e.currency,before:!0}}};function J(e){let t=e.locale;if(e.format==="money"){let{symbol:r,before:i,name:n}=_(e),o=m(1250,t,{minimumFractionDigits:2,maximumFractionDigits:2});return{...r?i?{prefix:r}:{suffix:r}:{},placeholder:o,hint:n?`in ${n}`:e.currency?`in ${e.currency}`:"an amount of money"}}return e.format==="percent"?{suffix:"%",placeholder:m(15,t),hint:"as a percent"}:{...e.unit?{suffix:e.unit}:{},placeholder:"",hint:e.unit?`in ${e.unit}`:"a number"}}function Q(e,t){return e===void 0||!Number.isFinite(e)?"":t.format==="money"?m(e,t.locale,Number.isInteger(e)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):t.format==="percent"?m(e*100,t.locale,{maximumFractionDigits:4}):m(e,t.locale,{maximumFractionDigits:6})}function V(e){try{let t=new Intl.NumberFormat(w(e)).formatToParts(12345.6);return{group:t.find(r=>r.type==="group")?.value??",",decimal:t.find(r=>r.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function X(e,t){let{group:r,decimal:i}=V(t),n=e.replace(/[\s  ']/g,"").replace(/[−–]/g,"-");if(i!=="."&&!n.includes(i)&&/^-?\d+\.\d{1,2}$/.test(n))return Number(n);if(r&&(n=n.split(r).join("")),i!=="."&&(n=n.replace(i,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(n))return;let o=Number(n);return Number.isFinite(o)?o:void 0}function k(e,t){let r=e.trim();if(r==="")return;let i=t?.format==="money"&&t.currency?_(t).symbol:void 0,n=r;i&&(n=n.split(i).join("")),t?.currency&&(n=n.replace(new RegExp(t.currency,"gi"),"")),n=n.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(n)&&(n=n.replace(/%\s*$/,"")),t?.unit&&t.format!=="money"&&(n=n.replace(new RegExp(`\\s*${t.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let d=X(n,t?.locale);if(d!==void 0)return t?.format==="percent"?d/100:d}export{G as a,J as b,Q as c,k as d,F as e,h as f,l as g,A as h,z as i,L as j,P as k,q as l};
@@ -1 +1 @@
1
- var o=new Set(["tell","me","about","what","how","show","describe","the","a","an","and","please"]),k=new Set([...o,"where","is","are","was","find","any","anything","something","things","called","named","which","who","of","for","with","to","in","on","i","my","do","does","have","has","can","you","it","that","this","there","we","our","got","be"]);function S(t){return t.flatMap(e=>{let n=e.repairs.find(s=>!s.missing?.length);return n?[{mutation:n.mutation,args:{...n.args},why:e.message}]:[]})}export{S as a};
1
+ var o=new Set(["tell","me","about","what","how","show","describe","the","a","an","and","please"]),i=new Set([...o,"where","is","are","was","find","any","anything","something","things","called","named","which","who","of","for","with","to","in","on","i","my","do","does","have","has","can","you","it","that","this","there","we","our","got","be"]);function r(t){return t.flatMap(e=>{let n=e.repairs.find(s=>!s.missing?.length);return n?[{mutation:n.mutation,args:{...n.args},why:e.message}]:[]})}export{r as a};
@@ -0,0 +1 @@
1
+ import{a as Ie}from"./chunk.HJCQ6I3S.js";import{a as Se,b as Fe,c as Te,d as Ce}from"./chunk.5C43AM3X.js";import"./chunk.TKUNRFDE.js";import{c as Me}from"./chunk.4WH4N4V7.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import{G as Qe,T as Oe}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as Re}from"./chunk.AJZBJBMO.js";var I=Re(Qe(),1);var O=.5,fe=1,Pe=.76,Ne=3,Ze=3,Ae=.6;function et(t){let n=De(t);for(;;){let s=n.next();if(s.done)return s.value}}function*De(t){let{ribbons:n,plots:s,cell:i}=t,u=t.tilt??.5,g=t.labels??[],k=[...s.values()],p=new Map;if(k.length===0||i<=0)return p;let R=1/0,j=1/0,E=-1/0,W=-1/0;for(let o of k)R=Math.min(R,o.col),j=Math.min(j,o.row),E=Math.max(E,o.col+o.side),W=Math.max(W,o.row+o.side);R-=3,j-=3,E+=3,W+=3;let M=Math.round((E-R)/O)+1,P=Math.round((W-j)/O)+1,H=o=>R+o*O,_=o=>j+o*O,B=4,te=(o,c)=>{if(g.length===0)return!1;let l=Me(o,c,i,u);for(let f of g)if(l.x>f.x-B&&l.x<f.x+f.width+B&&l.y>f.y-B&&l.y<f.y+f.height+B)return!0;return!1},L=(o,c)=>{for(let l of k)if(o>l.col-Pe&&o<l.col+l.side+Pe&&c>l.row-Pe&&c<l.row+l.side+Pe)return!0;return!1},A=M*P,N=new Uint8Array(A),S=new Uint8Array(A),ne=new Uint8Array(A),oe=new Uint8Array(A),G=new Uint8Array(A),re=new Uint8Array(A),V=new Float32Array(A);for(let o=0;o<P;o++){let c=_(o);for(let l=0;l<M;l++){let f=H(l),m=o*M+l;if(S[m]=L(f,c)?0:1,N[m]=S[m]&&!te(f,c)?1:0,l+1<M){let a=f+O/2;oe[m]=L(a,c)?0:1,ne[m]=oe[m]&&!te(a,c)?1:0}if(o+1<P){let a=c+O/2;re[m]=L(f,a)?0:1,G[m]=re[m]&&!te(f,a)?1:0}let e=1/0;for(let a of k)e=Math.min(e,Math.max(0,a.col-f,f-(a.col+a.side),a.row-c,c-(a.row+a.side)));V[m]=e}}let J=(o,c)=>{let l=[],f=(e,a)=>{let w=[],b=Math.min(1,a/3);for(let r=Math.ceil((e+b)/O-1e-9)*O;r<=e+a-b+1e-9;r+=O)w.push(r);return w},m=(e,a,w,b)=>{let r=Math.round((e-R)/O),d=Math.round((a-j)/O);r>=0&&d>=0&&r<M&&d<P&&c[d*M+r]&&l.push({i:r,j:d,out:w,curb:b})};for(let e of f(o.row,o.side))m(o.col-fe,e,1,{col:o.col,row:e}),m(o.col+o.side+fe,e,0,{col:o.col+o.side,row:e});for(let e of f(o.col,o.side))m(e,o.row-fe,3,{col:e,row:o.row}),m(e,o.row+o.side+fe,2,{col:e,row:o.row+o.side});return l};yield;let se=new Uint8Array(A),ie=new Uint8Array(A),le=[[1,0],[-1,0],[0,1],[0,-1]],ae=[1,0,3,2],D=A*4,X=new Float64Array(D),F=[new Int32Array(D),new Int32Array(D)],U=new je,ge=(o,c,l,f,m)=>{let e=l?N:S,a=l?ne:oe,w=l?G:re,b=J(o,e),r=J(c,e),d=new Map(r.map(h=>[h.j*M+h.i,h]));if(b.length===0||r.length===0)return{reached:-1,best:1/0,starts:b,goal:d,back:f};let y=(h,x)=>{let $=H(h),K=_(x);return(Math.max(0,c.col-$,$-(c.col+c.side))+Math.max(0,c.row-K,K-(c.row+c.side)))*Ae};X.fill(1/0),f.fill(-1),U.clear();let Y=-1,v=1/0;for(let h of b){let x=(h.j*M+h.i)*4+h.out;X[x]=0,U.push(x,y(h.i,h.j))}for(;U.size>0;){let h=U.peekKey();if(h>=v||h>=m)break;let x=U.pop(),$=x>>2,K=x&3,ee=$%M,ue=($-ee)/M,Ee=d.get($);if(Ee){let q=X[x]+(K===ae[Ee.out]?0:Ne);q<v&&(v=q,Y=x);continue}for(let q=0;q<4;q++){let[pe,Be]=le[q],be=ee+pe,xe=ue+Be;if(be<0||xe<0||be>=M||xe>=P)continue;let ke=xe*M+be;if(!e[ke])continue;let Le=pe+Be>0?$:ke;if(!(pe!==0?a:w)[Le])continue;let _e=(pe!==0?se:ie)[Le]?Ae:1,Je=O*_e*(1+Math.max(0,V[ke]-Ze))+(q===K?0:Ne),ve=ke*4+q,$e=X[x]+Je;$e<X[ve]&&(X[ve]=$e,f[ve]=x,U.push(ve,$e+y(be,xe)))}}return{reached:Y,best:v,starts:b,goal:d,back:f}},Q=new Map;for(let o of n){let c=s.get(o.from),l=s.get(o.to);if(!c||!l||c===l)continue;let f=ge(c,l,!1,F[1],1/0);if(f.reached===-1){yield;continue}let m=ge(c,l,!0,F[0],1.3*f.best+2+Ae*fe+1e-9),e=m.reached!==-1&&m.best<=1.3*f.best+2?m:f;if(e.reached===-1)continue;let{reached:a,starts:w,goal:b,back:r}=e,d=[];for(let v=a;v!==-1;v=r[v]){let h=v>>2,x=d[d.length-1],$={i:h%M,j:Math.floor(h/M)};(!x||x.i!==$.i||x.j!==$.j)&&d.push($)}d.reverse();for(let v=1;v<d.length;v++){let h=d[v-1],x=d[v],$=h.i+h.j<x.i+x.j?h:x;(h.i!==x.i?se:ie)[$.j*M+$.i]=1}let y=w.find(v=>v.i===d[0].i&&v.j===d[0].j),Y=b.get(d[d.length-1].j*M+d[d.length-1].i);Q.set(o.key,{cells:d,start:y.curb,end:Y.curb}),yield}let ce=new Map(n.map(o=>[o.key,o.width])),de=new Map(n.map((o,c)=>[o.key,c])),we=i*u/Math.sqrt(1+u*u),Z=(o,c)=>o==="col"?`r${c.row.toFixed(2)}`:`c${c.col.toFixed(2)}`,T=new Map;for(let[o,c]of Q)for(let l=1;l<c.cells.length;l++){let f=c.cells[l-1],m=c.cells[l],e=Z(f.i!==m.i?"col":"row",{col:H(f.i),row:_(f.j)});T.set(e,(T.get(e)??new Set).add(o))}for(let[o,c]of Q){let l=[c.start,...c.cells.map(r=>({col:H(r.i),row:_(r.j)})),c.end],f=r=>r>=2&&r<=c.cells.length,m=[];for(let r=1;r<l.length;r++){let d=Math.abs(l[r].col-l[r-1].col)>1e-9?"col":"row",y=m[m.length-1];y&&y.axis===d?y.to=r:m.push({from:r-1,to:r,axis:d})}if(m.length===0)continue;let e=m.map(r=>{if(!Array.from({length:r.to-r.from},(h,x)=>f(r.from+1+x)).some(Boolean))return 0;let d=T.get(Z(r.axis,l[r.from]))??new Set;if(!d.has(o))return 0;let y=[...d].sort((h,x)=>(de.get(h)??0)-(de.get(x)??0)),v=-(y.reduce((h,x)=>h+(ce.get(x)??2)+2,0)-2)/2;for(let h of y){if(h===o)return(v+(ce.get(h)??2)/2)/we;v+=(ce.get(h)??2)+2}return 0}),a=r=>{let d=m[r],y=l[d.from];return d.axis==="col"?{row:y.row+e[r]}:{col:y.col+e[r]}},w=(r,d,y)=>({col:r.col??d.col??y.col,row:r.row??d.row??y.row}),b=[w(a(0),{},l[0])];for(let r=0;r+1<m.length;r++)b.push(w(a(r),a(r+1),l[m[r].to]));b.push(w(a(m.length-1),{},l[l.length-1])),p.set(o,b.map(r=>Me(r.col,r.row,i,u)))}return p}var je=class{items=[];keys=[];get size(){return this.items.length}clear(){this.items.length=0,this.keys.length=0}peekKey(){return this.keys[0]??1/0}push(n,s){this.items.push(n),this.keys.push(s);let i=this.items.length-1;for(;i>0;){let u=i-1>>1;if(this.keys[u]<=this.keys[i])break;this.swap(i,u),i=u}}pop(){let n=this.items[0],s=this.items.pop(),i=this.keys.pop();if(this.items.length>0){this.items[0]=s,this.keys[0]=i;let u=0;for(;;){let g=2*u+1,k=g+1,p=u;if(g<this.items.length&&this.keys[g]<this.keys[p]&&(p=g),k<this.items.length&&this.keys[k]<this.keys[p]&&(p=k),p===u)break;this.swap(u,p),u=p}}return n}swap(n,s){let i=this.items[n];this.items[n]=this.items[s],this.items[s]=i;let u=this.keys[n];this.keys[n]=this.keys[s],this.keys[s]=u}},tt=16,z=new Map,Ue=0;function me(t){let n=[...t.plots].map(([s,i])=>`${s}:${i.col},${i.row},${i.side}`).join(";");return`${t.ribbons.map(s=>`${s.key}>${s.from}>${s.to}>${s.width}`).join(";")}|${n}`}var nt=t=>t.map(n=>`${Math.round(n.x)},${Math.round(n.y)},${Math.round(n.width)},${Math.round(n.height)}`).join(";"),Ke=(t,n)=>`${n}|${t.cell}|${t.tilt??.5}|${nt(t.labels??[])}`;function qe(t,n,s){for(z.set(Ke(t,n),{ground:n,cell:t.cell,tilt:t.tilt??.5,runs:s});z.size>tt;)z.delete(z.keys().next().value)}function ye(t){let n=Ke(t,me(t)),s=z.get(n);if(s)return z.delete(n),z.set(n,s),s.runs}function ze(t){let n=ye(t);if(n)return n;Ue+=1;let s=et(t);return qe(t,me(t),s),s}function We(t,n,s=8){let i=ye(t);if(i)return n(i),()=>{};let u=me(t),g=De(t),k=!1,p;Ue+=1;let R=()=>{if(p=void 0,k)return;let j=performance.now();for(;;){let E=g.next();if(E.done){qe(t,u,E.value),n(E.value);return}if(performance.now()-j>=s)break}p=setTimeout(R,0)};return p=setTimeout(R,0),()=>{k=!0,p!==void 0&&clearTimeout(p)}}function Ge(t,n,s){let i;for(let g of z.values())g.ground===t&&g.tilt===s&&(i=g);if(!i||n<=0)return;if(i.cell===n)return i.runs;let u=n/i.cell;return new Map([...i.runs].map(([g,k])=>[g,k.map(p=>({x:p.x*u,y:p.y*u}))]))}function Ve(t,n){let s=t.col+t.side,i=s+.25+.22*Math.max(0,n),u=t.row+t.side*Math.max(.1,.3-.06*n),g=t.row+t.side*Math.min(.9,.7+.06*n);return[{col:s,row:u},{col:i,row:u},{col:i,row:g},{col:s,row:g}]}function Xe(t,n){return t.map(s=>Me(s.col,s.row,n.cell,n.tilt))}function Ye(t){return t.map((n,s)=>`${s===0?"M":"L"} ${n.x.toFixed(1)} ${n.y.toFixed(1)}`).join(" ")}function He(t){if(t.length===0)return{x:0,y:0};let n=0;for(let i=1;i<t.length;i++)n+=Math.hypot(t[i].x-t[i-1].x,t[i].y-t[i-1].y);let s=n/2;for(let i=1;i<t.length;i++){let u=t[i-1],g=t[i],k=Math.hypot(g.x-u.x,g.y-u.y);if(k>=s&&k>0)return{x:u.x+(g.x-u.x)*s/k,y:u.y+(g.y-u.y)*s/k};s-=k}return t[t.length-1]}var C=Re(Oe(),1),he=new Map,ot=(t,n)=>t.length===n.length&&t.every((s,i)=>Math.round(s.x)===Math.round(n[i].x)&&Math.round(s.y)===Math.round(n[i].y)&&Math.round(s.width)===Math.round(n[i].width)&&Math.round(s.height)===Math.round(n[i].height));function dt({frame:t,width:n,height:s,pan:i,store:u,graphVersion:g,selection:k,view:p,emphasis:R,hiddenKinds:j,drawn:E}){let[W,M]=(0,I.useState)(null),P=t.city,H=e=>u.graph.getNode(e)?.kind,_=(0,I.useMemo)(()=>Se(u.graph.allEdges(),e=>u.graph.getNode(e)?.kind),[u,g]),B=new Map;for(let e of t.nodes){let a=e.id.startsWith("kind:")?Te(e.id):null;a!==null&&e.plot&&Math.round(e.plane)===2&&B.set(a,e.plot)}let te=[...B].map(([e,a])=>`${e}:${a.col},${a.row},${a.side}`).join(";"),L=P?.cell??0,A=_.filter(e=>B.has(e.from)&&B.has(e.to)&&!j.has(e.from)&&!j.has(e.to)&&E(e.edge)),N=P?.tilt??.5,S=`${te}|${L}|${N}`,[ne,oe]=(0,I.useState)(null),[G,re]=(0,I.useState)(null),V=t.t>=1,J=!!P&&!!p.overview;(0,I.useLayoutEffect)(()=>{let e=G?.parentElement;if(!e||!P||!V)return;let a=e.getBoundingClientRect(),w=P.originX+i.x,b=P.originY+i.y,r=[...e.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')].flatMap(d=>{let y=d.getBoundingClientRect();return y.width>0&&y.height>0?[{x:y.left-a.left-w,y:y.top-a.top-b,width:y.width,height:y.height}]:[]});for(he.set(S,r);he.size>16;)he.delete(he.keys().next().value);oe(d=>d?.cards===S&&ot(d.labels,r)?d:{cards:S,labels:r})},[G,V,S]);let se=Math.max(0,...A.map(e=>e.links)),ie=A.map(e=>({key:e.key,from:e.from,to:e.to,width:Ie(e.links,se)})),le=me({ribbons:ie,plots:B}),ae=typeof window>"u",D=ne?.cards===S?ne.labels:he.get(S)??(ae?[]:void 0),F=L>0&&J&&V&&D!==void 0?{ribbons:ie,plots:B,cell:L,tilt:N,labels:D}:null,[U,ge]=(0,I.useState)(0),Q=F!==null&&!ae&&ye(F)===void 0,ce=`${le}|${L}|${N}|${(D??[]).map(e=>`${Math.round(e.x)},${Math.round(e.y)},${Math.round(e.width)},${Math.round(e.height)}`).join(";")}`;(0,I.useEffect)(()=>{if(!(!Q||!F))return We(F,()=>ge(e=>e+1))},[Q,ce]);let de=(0,I.useMemo)(()=>{if(L===0||!J)return[];let e=F?ae?ze(F):ye(F):Ge(le,L,N);if(!e)return[];let a=new Map;return A.flatMap(w=>{let b;if(w.from===w.to){let r=a.get(w.from)??0;a.set(w.from,r+1),b=Xe(Ve(B.get(w.from),r),{cell:L,tilt:N})}else b=e.get(w.key);return!b||b.length<2?[]:[{ribbon:w,points:b,d:Ye(b),middle:He(b),width:Ie(w.links,se)}]})},[L,N,le,D,V,J,U]),we=(0,I.useRef)([]),Z=(0,I.useRef)({x:0,y:0});if(Z.current=P?{x:P.originX+i.x,y:P.originY+i.y}:{x:0,y:0},(0,I.useEffect)(()=>{let e=G?.parentElement;if(!e||typeof window>"u")return;let a=0,w=null,b=()=>{a=0;let y=w;if(!y)return;let Y=y.target;if(y.pointerType==="touch"||y.buttons!==0||Y?.closest("[data-graview-view], button, a, input, select, textarea, [data-graview-overlay], [data-graview-offstage]")){M(null);return}let v=e.getBoundingClientRect(),h=y.clientX-v.left-Z.current.x,x=y.clientY-v.top-Z.current.y,$=null,K=1/0;for(let ee of we.current){let ue=rt(ee.points,h,x);ue<=ee.reach&&ue<K&&(K=ue,$=ee.key)}M($)},r=y=>{w=y,a===0&&(a=requestAnimationFrame(b))},d=()=>M(null);return e.addEventListener("pointermove",r,{passive:!0}),e.addEventListener("pointerleave",d),()=>{a!==0&&cancelAnimationFrame(a),e.removeEventListener("pointermove",r),e.removeEventListener("pointerleave",d)}},[G]),!P||!p.overview)return null;let T=Fe(k,p,H);if(T.records.length>0||T.lens!==null)return null;let o=T.districts.length>0?de.filter(({ribbon:e})=>T.districts.includes(e.from)||T.districts.includes(e.to)):de;if(o.length===0&&A.length===0)return null;let c=R??null,l=o.find(({ribbon:e})=>e.key===W);we.current=o.map(({ribbon:e,points:a,width:w})=>({key:e.key,points:a,reach:w/2+6}));let f={x:P.originX+i.x,y:P.originY+i.y},m=`translate(${f.x.toFixed(1)} ${f.y.toFixed(1)})`;return(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("svg",{ref:re,className:"graview-ribbons","aria-hidden":"true","data-graview-world":"","data-graview-ribbons":o.length,width:n,height:s,style:{position:"absolute",left:0,top:0,pointerEvents:"none",overflow:"visible"},children:(0,C.jsx)("g",{transform:m,children:o.map(({ribbon:e,d:a,width:w})=>{let b=W===e.key||c!==null&&c===e.edge||T.districts.length>0,r=c!==null&&c!==e.edge;return(0,C.jsx)("g",{className:"graview-ribbon","data-graview-ribbon":e.edge,"data-graview-from":`kind:${e.from}`,"data-graview-to":`kind:${e.to}`,"data-graview-links":e.links,"data-graview-lit":b&&!r?"":void 0,"data-graview-receded":r?"":void 0,children:(0,C.jsx)("path",{className:"graview-ribbon-band",d:a,style:{strokeWidth:w}})},e.key)})})}),l?(0,C.jsx)("div",{className:"graview-ribbon-said","data-graview-world":"","data-testid":"ribbon-said",role:"status",style:{position:"absolute",left:f.x+l.middle.x,top:f.y+l.middle.y,pointerEvents:"none"},children:Ce(u.schema,l.ribbon)}):null]})}function rt(t,n,s){let i=1/0;for(let u=1;u<t.length;u++){let g=t[u-1],k=t[u],p=k.x-g.x,R=k.y-g.y,j=p*p+R*R,E=j===0?0:Math.max(0,Math.min(1,((n-g.x)*p+(s-g.y)*R)/j));i=Math.min(i,Math.hypot(n-(g.x+E*p),s-(g.y+E*R)))}return i}export{dt as Ribbons,rt as distanceTo};
@@ -0,0 +1 @@
1
+ import{a}from"./chunk.5VF2RT4H.js";import"./chunk.5RH6FO3K.js";import"./chunk.ZDDWXRPK.js";import"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import"./chunk.AZGXBTOQ.js";import{b as n}from"./chunk.VYKEIKY5.js";import"./chunk.IDYPQ45A.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{T as i}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
@@ -1 +1 @@
1
- import{d as K}from"./chunk.R7ZZJOJW.js";import{Ab as V,Yb as Y,Zb as X,ac as B,gb as G,h as P,ic as $,jc as N,k as R,ma as q,ob as h,pb as v,q as I,x as _}from"./chunk.VOHRQXCF.js";import{a as T,c as C,h as L}from"./chunk.SLBWPVIY.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 p=N(s);return p?.check==="max_length"&&(p.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),p=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:p,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,p=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",f=T(p+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:p+e.removed+r,inserted:f})}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,p){if(typeof p!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let c of o.primitives){let a=j(c,i,t);if(a){r.push(a);continue}if(M(c,i,t))return;c.op==="splice-text"&&c.id===i&&c.field===t&&r.push(c)}let f=p;try{for(let o=r.length-1;o>=0;o--){let c=r[o];f=T(f,{at:c.at,removed:c.inserted,inserted:c.removed})}}catch{return}return{then:f,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:p,field:r,insert:f,remove:o}=t;return K({node:p,field:r,inserted:[...String(f??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:p,field:r,at:f,remove:o,insert:c,rev:a}=s;(![f,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||f<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(p);if(!d)throw new G(p,"\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&&c==="")return;let l=d[r];if(typeof l!="string"||l===""){t.patchNode(p,{[r]:c});return}let g=e.graph.getNode(p)?.[r],m=a===void 0?{then:l,since:[]}:E(e.log.all(),e.log.horizon,p,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;f+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${f}${o>0?`\u2013${f+o}`:""} to type over`);let x=A({at:f,removed:u.slice(f,f+o),inserted:c},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:p,field:r,...x})}}}function ee(e,n,i,t){let s=i===void 0?void 0:e.tryDefinition(i);if(!s||typeof t!="string")return[];let p=new Set;for(let r of n)if(!(r.name===h||!Y(e,r).includes(i)||!X(r,s).includes(t))){p.add(r.name);for(let f of B(e,n,r)??[])p.add(f)}return[...p]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,p=[];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}`),p.push(r);continue}let f=e.graph.getNode(r.id),o={},c={},a=[];for(let[d,l]of Object.entries(r.after)){let g=f?.[d],m=`${r.id}\0${d}`;if(typeof l=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,f?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,l,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],c[d]=l,s.add(m)}Object.keys(c).length>0&&p.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:c}:r),p.push(...a)}return p}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 p=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,f=[];return s.forEach((o,c)=>{if(o.op!=="splice-text")return void f.push(o);let a=A(o,J([...t.primitives.slice(r-c),...p,...i,...f],o.id,o.field));(a.removed!==""||a.inserted!=="")&&f.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...f),{op:t,primitives:f}})}function ae(e,n){let i=(t,s)=>e.some(p=>M(p,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=[],p=new Set;for(let a of e){let d=a.primitives[0],l=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(l?.node),String(l?.field));g?s.push({batch:a.batch,node:String(l?.node),field:String(l?.field),splice:g}):p.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,f=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),c=s;for(let a of n){if(o.has(a.batch)){c=c.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let l=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(c.filter(m=>m.node===l).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,l,g);for(let u of c)u.node!==l||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&f.add(r(u)))}}}c.forEach((a,d)=>{if(!o.has(a.batch))return;let l={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of c.slice(d+1))r(g)===r(a)&&([l,g.splice]=b(l,g.splice))});for(let a of i){let d=c.filter(l=>l.batch===a);d.length===0||p.has(a)||d.some(l=>f.has(r(l)))||t.set(a,d.map(l=>({name:h,args:{node:l.node,field:l.field,at:l.splice.at,remove:l.splice.removed.length,insert:l.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:p}=e,r=new Map,f=(o,c)=>{r.get(o)?.(c),r.delete(o)};return{store:n,apply:(o,c)=>e.appliedAll(o,{...i?{author:i}:{},...c!==void 0?{batch:c}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(c=>r.set(o,c)))},ask:(o,c)=>void p.set(o,{calls:c}),send(o,c){p.set(o,{calls:c});let a=e.sent(o,c),d=()=>f(o,a);return a.then(l=>{Array.isArray(l?.ops)&&l.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),p.delete(o),e.land([],[o]),f(o)},seen:e.seen,gone:e.gone,ahead(o,c,a){let d=t.indexOf(o),l=n.log.all(),g=m=>l.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===c&&y.field===a||y.op==="patch-node"&&y.id===c&&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 pe=400,ce=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),p=s.findIndex(o=>o.batch===n);if(p<0)return;let r=W(e.graph.getNode(i)?.[t]),f;for(let o=s.length-1;o>=p;o--){let c=s[o];c.batch===n&&f===void 0&&(f=r);for(let a=c.primitives.length-1;a>=0;a--){let d=c.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(!(f===void 0||f===r))return S(r,f)}function Xe(e,n,i){let t,s=[],p,r,f=!1,o=new Set,c=l=>({name:h,args:{node:e,field:n,at:l.at,remove:l.removed.length,insert:l.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(p!==void 0||f||i.gone())return;let l=s.shift();if(l===void 0)return;let g=i.ahead(l,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(l),f=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);f=!1,d()});return}let m=z(i.store,l,e,n);if(!m)return i.drop(l),d();p=l,i.send(l,[c(m)]).finally(()=>{p=void 0,d()})};return{splice(l,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:l,removed:u.slice(l,l+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:l,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,[c(k)]),ce.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,pe),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(p!==void 0?1:0)}}function Be(e,n){let i=n.find(f=>f.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,p=()=>e.graph.getNode(t)?.[s],r=p();return{node:t,field:s,yours:r,over:f=>{let o=p();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:f}}}}}export{pe as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
1
+ import{d as K}from"./chunk.JTOAZ2IR.js";import{Ab as V,Yb as Y,Zb as X,ac as B,gb as G,h as P,ic as $,jc as N,k as R,ma as q,ob as h,pb as v,q as I,x as _}from"./chunk.3MZIWKNG.js";import{a as T,c as C,h as L}from"./chunk.SLBWPVIY.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 p=N(s);return p?.check==="max_length"&&(p.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),p=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:p,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,p=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",f=T(p+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:p+e.removed+r,inserted:f})}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,p){if(typeof p!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let c of o.primitives){let a=j(c,i,t);if(a){r.push(a);continue}if(M(c,i,t))return;c.op==="splice-text"&&c.id===i&&c.field===t&&r.push(c)}let f=p;try{for(let o=r.length-1;o>=0;o--){let c=r[o];f=T(f,{at:c.at,removed:c.inserted,inserted:c.removed})}}catch{return}return{then:f,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:p,field:r,insert:f,remove:o}=t;return K({node:p,field:r,inserted:[...String(f??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:p,field:r,at:f,remove:o,insert:c,rev:a}=s;(![f,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||f<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(p);if(!d)throw new G(p,"\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&&c==="")return;let l=d[r];if(typeof l!="string"||l===""){t.patchNode(p,{[r]:c});return}let g=e.graph.getNode(p)?.[r],m=a===void 0?{then:l,since:[]}:E(e.log.all(),e.log.horizon,p,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;f+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${f}${o>0?`\u2013${f+o}`:""} to type over`);let x=A({at:f,removed:u.slice(f,f+o),inserted:c},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:p,field:r,...x})}}}function ee(e,n,i,t){let s=i===void 0?void 0:e.tryDefinition(i);if(!s||typeof t!="string")return[];let p=new Set;for(let r of n)if(!(r.name===h||!Y(e,r).includes(i)||!X(r,s).includes(t))){p.add(r.name);for(let f of B(e,n,r)??[])p.add(f)}return[...p]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,p=[];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}`),p.push(r);continue}let f=e.graph.getNode(r.id),o={},c={},a=[];for(let[d,l]of Object.entries(r.after)){let g=f?.[d],m=`${r.id}\0${d}`;if(typeof l=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,f?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,l,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],c[d]=l,s.add(m)}Object.keys(c).length>0&&p.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:c}:r),p.push(...a)}return p}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 p=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,f=[];return s.forEach((o,c)=>{if(o.op!=="splice-text")return void f.push(o);let a=A(o,J([...t.primitives.slice(r-c),...p,...i,...f],o.id,o.field));(a.removed!==""||a.inserted!=="")&&f.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...f),{op:t,primitives:f}})}function ae(e,n){let i=(t,s)=>e.some(p=>M(p,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=[],p=new Set;for(let a of e){let d=a.primitives[0],l=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(l?.node),String(l?.field));g?s.push({batch:a.batch,node:String(l?.node),field:String(l?.field),splice:g}):p.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,f=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),c=s;for(let a of n){if(o.has(a.batch)){c=c.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let l=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(c.filter(m=>m.node===l).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,l,g);for(let u of c)u.node!==l||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&f.add(r(u)))}}}c.forEach((a,d)=>{if(!o.has(a.batch))return;let l={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of c.slice(d+1))r(g)===r(a)&&([l,g.splice]=b(l,g.splice))});for(let a of i){let d=c.filter(l=>l.batch===a);d.length===0||p.has(a)||d.some(l=>f.has(r(l)))||t.set(a,d.map(l=>({name:h,args:{node:l.node,field:l.field,at:l.splice.at,remove:l.splice.removed.length,insert:l.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:p}=e,r=new Map,f=(o,c)=>{r.get(o)?.(c),r.delete(o)};return{store:n,apply:(o,c)=>e.appliedAll(o,{...i?{author:i}:{},...c!==void 0?{batch:c}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(c=>r.set(o,c)))},ask:(o,c)=>void p.set(o,{calls:c}),send(o,c){p.set(o,{calls:c});let a=e.sent(o,c),d=()=>f(o,a);return a.then(l=>{Array.isArray(l?.ops)&&l.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),p.delete(o),e.land([],[o]),f(o)},seen:e.seen,gone:e.gone,ahead(o,c,a){let d=t.indexOf(o),l=n.log.all(),g=m=>l.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===c&&y.field===a||y.op==="patch-node"&&y.id===c&&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 pe=400,ce=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),p=s.findIndex(o=>o.batch===n);if(p<0)return;let r=W(e.graph.getNode(i)?.[t]),f;for(let o=s.length-1;o>=p;o--){let c=s[o];c.batch===n&&f===void 0&&(f=r);for(let a=c.primitives.length-1;a>=0;a--){let d=c.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(!(f===void 0||f===r))return S(r,f)}function Xe(e,n,i){let t,s=[],p,r,f=!1,o=new Set,c=l=>({name:h,args:{node:e,field:n,at:l.at,remove:l.removed.length,insert:l.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(p!==void 0||f||i.gone())return;let l=s.shift();if(l===void 0)return;let g=i.ahead(l,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(l),f=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);f=!1,d()});return}let m=z(i.store,l,e,n);if(!m)return i.drop(l),d();p=l,i.send(l,[c(m)]).finally(()=>{p=void 0,d()})};return{splice(l,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:l,removed:u.slice(l,l+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:l,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,[c(k)]),ce.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,pe),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(p!==void 0?1:0)}}function Be(e,n){let i=n.find(f=>f.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,p=()=>e.graph.getNode(t)?.[s],r=p();return{node:t,field:s,yours:r,over:f=>{let o=p();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:f}}}}}export{pe as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
@@ -1 +1 @@
1
- import{H as $}from"./chunk.AI2HBKVP.js";import{G as L,Na as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.Q5IAXTF5.js";import{Fd as s,Md as b,Nd as r}from"./chunk.VOHRQXCF.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
1
+ import{E as $}from"./chunk.FWZF7X6A.js";import{G as L,Oa as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.SF4BYBH6.js";import{Hd as s,Od as b,Pd as r}from"./chunk.3MZIWKNG.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
@@ -1 +1 @@
1
- import{e as $}from"./chunk.BJL6EL6B.js";import{a as C}from"./chunk.7FZY5E2U.js";import{l as M}from"./chunk.OYRZ2DEI.js";import{Bb as x,da as k,ea as v,ga as j}from"./chunk.VOHRQXCF.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
1
+ import{e as $}from"./chunk.MVRNEC3Y.js";import{a as C}from"./chunk.Q6RUTFU3.js";import{l as M}from"./chunk.RLO3RDYH.js";import{Bb as x,da as k,ea as v,ga as j}from"./chunk.3MZIWKNG.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
@@ -1 +1 @@
1
- import{G as h}from"./chunk.Q5IAXTF5.js";import{Ec as m,gd as u,sc as a}from"./chunk.VOHRQXCF.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
1
+ import{G as h}from"./chunk.SF4BYBH6.js";import{Ec as m,id as u,sc as a}from"./chunk.3MZIWKNG.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
@@ -1 +1 @@
1
- import{a as b}from"./chunk.7EA7THSM.js";import{D as k,H as g,Lb as h,va as u,ya as w}from"./chunk.VOHRQXCF.js";var s=i=>i?._zod?.def,x=Symbol.for("@graview/core:collaborative"),O=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function v(i){let n=s(i),p=!0,a;for(let e=0;n&&e<4;e++){if(n.type==="optional"||n.type==="nullable")p=!1;else if(n.type==="default")p=!1,a=n.defaultValue;else break;n=s(n.innerType)}if(!n)return{why:"it is not a zod field"};let l=k(i),r={...p?{required:!0}:{},...a!==void 0?{default:a}:{},...l?{description:l}:{}},f=(n.checks??[]).map(e=>s(e)),c=u(i);if(c)return{spec:{type:c,...r}};if(w(i))return{spec:{type:"app-link",...r}};let d;for(let e=s(i),t=0;e&&d===void 0&&t<4;e=s(e.innerType),t++)d=e[x];let m=e=>d!==void 0&&d===1!=(e==="text")?{collaborative:d===1}:{};if(b(i))return{spec:{type:"text",format:"markdown",...r,...m("text")}};let y=h(i);if(y)return{spec:{type:y,...r}};switch(n.type){case"string":{let e=n.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||f.some(t=>t?.fn===g)?{spec:{type:"datetime",...r}}:f.some(t=>t?.format==="regex"&&O.test(String(t?.pattern?.source??"")))?{spec:{type:"date",...r}}:{spec:{type:"string",...r,...m("string")}}}case"number":{let e={};for(let t of f){let o=t?.value;typeof o=="number"&&(t?.check==="greater_than"&&t.inclusive?e.min=Math.max(e.min??o,o):t?.check==="less_than"&&t.inclusive?e.max=Math.min(e.max??o,o):t?.check==="multiple_of"&&(e.step=o))}return{spec:{type:f.some(t=>t?.format==="safeint"||t?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(n.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=s(n.element),t=u(n.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return t?{spec:{type:"list",of:t,...r}}:{why:`it is a list of ${String(e?.type??"something")}, and a document lists words, numbers, dates, images, videos or files`}}default:return{why:`it is a ${String(n.type)}, which a document has no field type for`}}}function M(i){let n=v(i);return"spec"in n?n.spec:void 0}export{M as a};
1
+ import{a as b}from"./chunk.TUNHUTQ5.js";import{D as k,H as g,Lb as h,va as u,ya as w}from"./chunk.3MZIWKNG.js";var s=i=>i?._zod?.def,x=Symbol.for("@graview/core:collaborative"),O=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function v(i){let n=s(i),p=!0,a;for(let e=0;n&&e<4;e++){if(n.type==="optional"||n.type==="nullable")p=!1;else if(n.type==="default")p=!1,a=n.defaultValue;else break;n=s(n.innerType)}if(!n)return{why:"it is not a zod field"};let l=k(i),r={...p?{required:!0}:{},...a!==void 0?{default:a}:{},...l?{description:l}:{}},f=(n.checks??[]).map(e=>s(e)),c=u(i);if(c)return{spec:{type:c,...r}};if(w(i))return{spec:{type:"app-link",...r}};let d;for(let e=s(i),t=0;e&&d===void 0&&t<4;e=s(e.innerType),t++)d=e[x];let m=e=>d!==void 0&&d===1!=(e==="text")?{collaborative:d===1}:{};if(b(i))return{spec:{type:"text",format:"markdown",...r,...m("text")}};let y=h(i);if(y)return{spec:{type:y,...r}};switch(n.type){case"string":{let e=n.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||f.some(t=>t?.fn===g)?{spec:{type:"datetime",...r}}:f.some(t=>t?.format==="regex"&&O.test(String(t?.pattern?.source??"")))?{spec:{type:"date",...r}}:{spec:{type:"string",...r,...m("string")}}}case"number":{let e={};for(let t of f){let o=t?.value;typeof o=="number"&&(t?.check==="greater_than"&&t.inclusive?e.min=Math.max(e.min??o,o):t?.check==="less_than"&&t.inclusive?e.max=Math.min(e.max??o,o):t?.check==="multiple_of"&&(e.step=o))}return{spec:{type:f.some(t=>t?.format==="safeint"||t?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(n.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=s(n.element),t=u(n.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return t?{spec:{type:"list",of:t,...r}}:{why:`it is a list of ${String(e?.type??"something")}, and a document lists words, numbers, dates, images, videos or files`}}default:return{why:`it is a ${String(n.type)}, which a document has no field type for`}}}function M(i){let n=v(i);return"spec"in n?n.spec:void 0}export{M as a};
@@ -1 +1 @@
1
- import{h,i as E}from"./chunk.OYRZ2DEI.js";import{a as M,f as z}from"./chunk.7EA7THSM.js";import{C as y,Fa as O,Nb as N,Qa as P,Qc as K,Ra as D,Rc as k,Wb as T,Xb as Z,Yb as q,Zb as v,ab as L,fa as S,qb as V,rb as I,sb as g,va as R,ya as j}from"./chunk.VOHRQXCF.js";var J=n=>n.safeParse?.(void 0).success??!1,C=n=>h(n).shape,A=n=>{let r=h(n);if(y(r)?.type!=="literal")return;let o=y(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function F(n,r){let o=J(r),e=h(r),t=y(e)?.type,c=N(r);if(c)return{control:"node",name:n,optional:o,kinds:c};let p=O(r);if(p)return{control:"linked",name:n,optional:o,relation:p};if(D(r)){let d=P(n);return{control:"repeat",name:n,optional:o,...d?{of:d}:{}}}if(t==="boolean")return{control:"boolean",name:n,optional:o};let f=R(e);if(f)return{control:"file",name:n,optional:o,...f==="image"?{image:!0}:f==="video"?{video:!0}:{}};if(t==="object"){let d=e.shape??{};return{control:"group",name:n,optional:o,fields:Object.entries(d).map(([a,l])=>F(a,l))}}if(t==="union"){let d=y(e)?.options??[],a=d.map(s=>C(s));if(a.every(s=>s!==void 0)){let s=Object.keys(a[0]??{}).find(u=>a.every(m=>A(m?.[u])!==void 0));if(s)return{control:"variant",name:n,optional:o,tag:s,options:d.map((u,m)=>({value:A(a[m]?.[s])??"",fields:Object.entries(a[m]??{}).filter(([w])=>w!==s).map(([w,B])=>F(w,B))}))}}let l=d.map(s=>A(s));return l.every(s=>s!==void 0)?{control:"choice",name:n,optional:o,options:l}:{control:"opaque",name:n,optional:o}}if(t==="array"){let d=y(e)?.element;return d!==void 0?{control:"list",name:n,optional:o,item:F(n,d)}:{control:"opaque",name:n,optional:o}}let i=E(r);return i.type==="text"?{control:"text",name:n,optional:o,...i.long?{long:!0}:{},...j(e)?{app:!0}:{},...M(e)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:o,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:o,...i.time?{time:!0}:{},...i.instant?{instant:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:o,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:o,options:i.options}:{control:"opaque",name:n,optional:o}}function H(n){let r=n.shape;return r?Object.entries(r).map(([o,e])=>F(o,e)):[]}function W(n,r){let o={...r};for(let e of n){let t=r[e.name];t===void 0&&!e.optional&&(e.control==="list"||e.control==="boolean")&&(o[e.name]=e.control==="list"?[]:!1),e.control==="text"&&e.holds&&typeof t=="string"&&(o[e.name]=t.trim()===""?void 0:e.holds==="duration"?z(t)??t:t.trim()),e.control==="group"&&t!==void 0&&typeof t=="object"&&t!==null&&(o[e.name]=W(e.fields,t))}return o}function G(n,r){return Z(H(r.input),T(n,r))}var x="visitor";function gn(n,r,o,e){let t=K.keptFrom?.(n,r),c=new Set;if(!t)return c;let p=Object.keys(o.input.shape??{});for(let a of o.creates??[]){let l=t({id:"\0new",kind:a});for(let s of p)l?.(s)&&c.add(s)}let f=e===void 0?void 0:n.graph.getNode(e),i=f&&n.schema.tryDefinition(f.kind),d=f&&t(f);if(i&&d)for(let a of v(o,i))d(a)&&p.includes(a)&&c.add(a);return c}function _(n,r,o,e){let t=new Set,c=r?.sees??[];if(I(o)||!c.some(k))return t;let p=V(o),f=(l,s)=>{let u=c.filter(m=>m.kinds.includes(l)&&g(m,p));return u.some(k)?L.has(s)||u.some(m=>!k(m)||(m.fields===void 0||m.fields.includes(s))&&!m.hide?.includes(s)):!0},i=Object.keys(e.input.shape??{}),d=new Map,a=(l,s)=>d.set(l,d.get(l)===!0||s);for(let l of e.creates??[]){let s=Object.keys(n.tryDefinition(l)?.fields.shape??{});for(let u of i)s.includes(u)&&a(u,f(l,u))}for(let l of q(n,e)){let s=n.tryDefinition(l);if(s)for(let u of v(e,s))i.includes(u)&&a(u,f(l,u))}for(let[l,s]of d)s||t.add(l);return t}var $=(n,r)=>r.title??S(n);function Q(n,r,o){let e=n?.sees;return!e||e.length===0?!0:e.some(t=>t.kinds.includes(o)&&g(t,r)&&!t.own&&!t.via)}function b(n){switch(n.control){case"node":return[n];case"group":return n.fields.flatMap(b);case"variant":return n.options.flatMap(r=>r.fields.flatMap(b));case"list":return b(n.item);default:return[]}}function U(n,r,o,e){return e.has(o.name)?!1:b(o).every(t=>t.kinds.some(c=>c!=="*"&&Q(n,r,c)))}var X=n=>({kind:"human",id:"form:",roles:[n]});function vn(n,r,o=n.mutations??[]){let e=n.forms?.[r];if(!e)return;let t=o.find(a=>a.name===e.act);if(!t)return;let c=e.role??x,p=X(c),f=_(n.schema,n.policy,p,t),i=G(n.schema,t),d=e.fields?e.fields.flatMap(a=>i.find(l=>l.name===a)??[]):i.filter(a=>U(n.policy,p,a,f));return{name:r,title:$(r,e),...e.intro?{intro:e.intro}:{},...e.say?{say:e.say}:{},submit:e.submit??t.title??S(t.name),role:c,act:t,fields:d}}function An(n,r,o){let e=n.forms?.[r];if(!e)throw new Error(`There is no form called "${r}"${n.forms?`: the forms are ${Object.keys(n.forms).join(", ")}`:": the app declares none"}.`);return{kind:"visitor",id:o,name:`a visitor via the ${$(r,e)} form`,roles:[e.role??x]}}function xn(n){return{said:"Received \u2014 thank you.",...n.say?{next:n.say}:{}}}export{H as a,W as b,G as c,gn as d,_ as e,vn as f,An as g,xn as h};
1
+ import{h,i as E}from"./chunk.RLO3RDYH.js";import{a as M,f as z}from"./chunk.TUNHUTQ5.js";import{C as y,Fa as O,Nb as N,Qa as P,Ra as D,Sc as K,Tc as k,Wb as T,Xb as Z,Yb as q,Zb as v,ab as L,fa as S,qb as V,rb as I,sb as g,va as R,ya as j}from"./chunk.3MZIWKNG.js";var J=n=>n.safeParse?.(void 0).success??!1,C=n=>h(n).shape,A=n=>{let r=h(n);if(y(r)?.type!=="literal")return;let o=y(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function F(n,r){let o=J(r),e=h(r),t=y(e)?.type,c=N(r);if(c)return{control:"node",name:n,optional:o,kinds:c};let p=O(r);if(p)return{control:"linked",name:n,optional:o,relation:p};if(D(r)){let d=P(n);return{control:"repeat",name:n,optional:o,...d?{of:d}:{}}}if(t==="boolean")return{control:"boolean",name:n,optional:o};let f=R(e);if(f)return{control:"file",name:n,optional:o,...f==="image"?{image:!0}:f==="video"?{video:!0}:{}};if(t==="object"){let d=e.shape??{};return{control:"group",name:n,optional:o,fields:Object.entries(d).map(([a,l])=>F(a,l))}}if(t==="union"){let d=y(e)?.options??[],a=d.map(s=>C(s));if(a.every(s=>s!==void 0)){let s=Object.keys(a[0]??{}).find(u=>a.every(m=>A(m?.[u])!==void 0));if(s)return{control:"variant",name:n,optional:o,tag:s,options:d.map((u,m)=>({value:A(a[m]?.[s])??"",fields:Object.entries(a[m]??{}).filter(([w])=>w!==s).map(([w,B])=>F(w,B))}))}}let l=d.map(s=>A(s));return l.every(s=>s!==void 0)?{control:"choice",name:n,optional:o,options:l}:{control:"opaque",name:n,optional:o}}if(t==="array"){let d=y(e)?.element;return d!==void 0?{control:"list",name:n,optional:o,item:F(n,d)}:{control:"opaque",name:n,optional:o}}let i=E(r);return i.type==="text"?{control:"text",name:n,optional:o,...i.long?{long:!0}:{},...j(e)?{app:!0}:{},...M(e)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:o,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:o,...i.time?{time:!0}:{},...i.instant?{instant:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:o,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:o,options:i.options}:{control:"opaque",name:n,optional:o}}function H(n){let r=n.shape;return r?Object.entries(r).map(([o,e])=>F(o,e)):[]}function W(n,r){let o={...r};for(let e of n){let t=r[e.name];t===void 0&&!e.optional&&(e.control==="list"||e.control==="boolean")&&(o[e.name]=e.control==="list"?[]:!1),e.control==="text"&&e.holds&&typeof t=="string"&&(o[e.name]=t.trim()===""?void 0:e.holds==="duration"?z(t)??t:t.trim()),e.control==="group"&&t!==void 0&&typeof t=="object"&&t!==null&&(o[e.name]=W(e.fields,t))}return o}function G(n,r){return Z(H(r.input),T(n,r))}var x="visitor";function gn(n,r,o,e){let t=K.keptFrom?.(n,r),c=new Set;if(!t)return c;let p=Object.keys(o.input.shape??{});for(let a of o.creates??[]){let l=t({id:"\0new",kind:a});for(let s of p)l?.(s)&&c.add(s)}let f=e===void 0?void 0:n.graph.getNode(e),i=f&&n.schema.tryDefinition(f.kind),d=f&&t(f);if(i&&d)for(let a of v(o,i))d(a)&&p.includes(a)&&c.add(a);return c}function _(n,r,o,e){let t=new Set,c=r?.sees??[];if(I(o)||!c.some(k))return t;let p=V(o),f=(l,s)=>{let u=c.filter(m=>m.kinds.includes(l)&&g(m,p));return u.some(k)?L.has(s)||u.some(m=>!k(m)||(m.fields===void 0||m.fields.includes(s))&&!m.hide?.includes(s)):!0},i=Object.keys(e.input.shape??{}),d=new Map,a=(l,s)=>d.set(l,d.get(l)===!0||s);for(let l of e.creates??[]){let s=Object.keys(n.tryDefinition(l)?.fields.shape??{});for(let u of i)s.includes(u)&&a(u,f(l,u))}for(let l of q(n,e)){let s=n.tryDefinition(l);if(s)for(let u of v(e,s))i.includes(u)&&a(u,f(l,u))}for(let[l,s]of d)s||t.add(l);return t}var $=(n,r)=>r.title??S(n);function Q(n,r,o){let e=n?.sees;return!e||e.length===0?!0:e.some(t=>t.kinds.includes(o)&&g(t,r)&&!t.own&&!t.via)}function b(n){switch(n.control){case"node":return[n];case"group":return n.fields.flatMap(b);case"variant":return n.options.flatMap(r=>r.fields.flatMap(b));case"list":return b(n.item);default:return[]}}function U(n,r,o,e){return e.has(o.name)?!1:b(o).every(t=>t.kinds.some(c=>c!=="*"&&Q(n,r,c)))}var X=n=>({kind:"human",id:"form:",roles:[n]});function vn(n,r,o=n.mutations??[]){let e=n.forms?.[r];if(!e)return;let t=o.find(a=>a.name===e.act);if(!t)return;let c=e.role??x,p=X(c),f=_(n.schema,n.policy,p,t),i=G(n.schema,t),d=e.fields?e.fields.flatMap(a=>i.find(l=>l.name===a)??[]):i.filter(a=>U(n.policy,p,a,f));return{name:r,title:$(r,e),...e.intro?{intro:e.intro}:{},...e.say?{say:e.say}:{},submit:e.submit??t.title??S(t.name),role:c,act:t,fields:d}}function An(n,r,o){let e=n.forms?.[r];if(!e)throw new Error(`There is no form called "${r}"${n.forms?`: the forms are ${Object.keys(n.forms).join(", ")}`:": the app declares none"}.`);return{kind:"visitor",id:o,name:`a visitor via the ${$(r,e)} form`,roles:[e.role??x]}}function xn(n){return{said:"Received \u2014 thank you.",...n.say?{next:n.say}:{}}}export{H as a,W as b,G as c,gn as d,_ as e,vn as f,An as g,xn as h};
@@ -1,2 +1,2 @@
1
- import{g as F,l as b}from"./chunk.5WU2UTP7.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],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),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.ZUBC3UFG.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],m=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&m&&r.push(m),(l.fn==="out"||l.fn==="in")&&m&&s.push(m),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 g=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 g;e++,g={t:"binary",op:S,left:g,right:d(),at:y.at}}},m=()=>{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=m();for(;;){if(s(".")){let d=r();e++;let g=r();if(g.k!=="id")throw new p('expected a field name after "."',g.at,t);e++,n={t:"member",object:n,name:g.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(),g=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return g?(e++,{t:"binary",op:g,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){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"&&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};
@@ -0,0 +1 @@
1
+ import"./chunk.GZHZLJBF.js";import{n as P}from"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as A,T as S,ca as b}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Ba as w,Pc as x,oa as L}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var T=e=>(0,n.jsx)(H,{...e}),U=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,U as drawLinkedPicker,T as drawLinkedRecord};
@@ -0,0 +1 @@
1
+ import"./chunk.GZHZLJBF.js";import{n as D}from"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import{a as $}from"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{G as P,T as C}from"./chunk.SF4BYBH6.js";import"./chunk.SDO3U72B.js";import{Na as w,Pa as R,Ta as c,Y as S}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as k}from"./chunk.AJZBJBMO.js";var m=k(P(),1);var e=k(C(),1),W=[["","Does not repeat"],["day","Daily"],["week","Weekly"],["month","Monthly"],["year","Yearly"]],E=r=>`${r}${r%100>=11&&r%100<=13?"th":["th","st","nd","rd"][r%10]??"th"}`,v={display:"flex",flexWrap:"wrap",gap:"6px 12px",alignItems:"center"};function N({value:r,onChange:d,start:p,label:s,name:l="repeat"}){let f=(0,m.useId)(),a=c(r)?r:void 0,i=typeof p=="string"&&/^\d{4}-\d{2}-\d{2}/.test(p)?p:void 0,u=i?w[new Date(`${i.slice(0,10)}T00:00:00Z`).getUTCDay()]:void 0,o=t=>{let n={...a??{every:"week"},...t};for(let b of Object.keys(n))n[b]===void 0&&delete n[b];d(n)},y=a?.every??"week",g=a?.on??(u?[u]:[]);return(0,e.jsxs)("fieldset",{"data-graview-part":"field","data-graview-field":"repeat","data-graview-repeat":l,style:{display:"grid",gap:8,border:"1px solid var(--graview-edge)",borderRadius:8,padding:"8px 12px",margin:0,minWidth:0},children:[(0,e.jsx)("legend",{"data-graview-part":"label",style:{padding:"0 4px"},children:s}),(0,e.jsxs)("div",{style:v,children:[(0,e.jsx)("label",{htmlFor:`${f}-every`,children:"Repeats"}),(0,e.jsx)("select",{id:`${f}-every`,name:`${l}.every`,value:a?.every??"",onChange:t=>{let n=t.target.value;d(n===""?void 0:{...a?.interval?{interval:a.interval}:{},...a?.until?{until:a.until}:{},every:n})},"data-graview-part":"control",children:W.map(([t,n])=>(0,e.jsx)("option",{value:t,children:n},t))}),a?(0,e.jsxs)("label",{style:v,children:["every",(0,e.jsx)("input",{type:"number",min:1,max:99,name:`${l}.interval`,"aria-label":`Every how many ${y}s`,value:a.interval??1,onChange:t=>o({interval:Number(t.target.value)>1?Math.min(99,Math.round(Number(t.target.value))):void 0}),style:{width:"4.5em"},"data-graview-part":"control"}),y,(a.interval??1)>1?"s":""]}):null]}),a?.every==="week"?(0,e.jsxs)("div",{role:"group","aria-label":"On",style:v,children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"On"}),w.map((t,n)=>(0,e.jsxs)("label",{style:{display:"inline-flex",gap:4,alignItems:"center",minHeight:24},children:[(0,e.jsx)("input",{type:"checkbox",name:`${l}.on`,value:t,checked:g.includes(t),onChange:b=>{let h=w.filter(x=>x===t?b.target.checked:g.includes(x));o({on:h.length===0||h.length===1&&h[0]===u?void 0:h})}}),S(n,"short")]},t))]}):null,a?.every==="month"?(0,e.jsxs)("label",{style:v,children:["On",(0,e.jsxs)("select",{name:`${l}.on`,value:a.on?.[0]===-1?"last":"",onChange:t=>o({on:t.target.value==="last"?[-1]:void 0}),"data-graview-part":"control",children:[(0,e.jsx)("option",{value:"",children:i?`the ${E(Number(i.slice(8,10)))}`:"the same day"}),(0,e.jsx)("option",{value:"last",children:"the last day"})]})]}):null,a?(0,e.jsxs)("label",{style:v,children:["Until",(0,e.jsx)("input",{type:"date",name:`${l}.until`,value:a.until??"",onChange:t=>o({until:t.target.value||void 0}),"data-graview-part":"control"})]}):null,(0,e.jsx)("p",{"aria-live":"polite","data-graview-repeat-said":"",style:{margin:0,color:"var(--graview-ink-dim)",fontSize:"0.8125rem"},children:a?$(i??"",a):"Does not repeat"})]})}function K({nodeId:r,field:d,start:p,value:s,label:l}){let{fields:f,commit:a}=D(r),i=f.find(t=>t.field===R(d)&&t.takesValue&&t.open.length===0),[u,o]=(0,m.useState)(!1),[y,g]=(0,m.useState)(c(s)?s:void 0);return i?u?(0,e.jsxs)("form",{onSubmit:t=>{t.preventDefault(),o(!1),a(i,y??null)},style:{display:"grid",gap:6,marginTop:6},children:[(0,e.jsx)(N,{value:y,onChange:g,start:p,label:l,name:R(d)}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("button",{type:"submit","data-graview-repeat-keep":d,children:"Keep"}),(0,e.jsx)("button",{type:"button",onClick:()=>o(!1),children:"Cancel"})]})]}):(0,e.jsx)("button",{type:"button","data-graview-repeat-open":d,onClick:()=>(g(c(s)?s:void 0),o(!0)),style:{marginInlineStart:8,fontSize:"0.75rem",padding:"1px 8px",borderRadius:999,minHeight:24},children:c(s)?"Change how it repeats":"Repeat\u2026"}):null}export{K as RepeatEditor,N as RepeatPicker};
@@ -1 +1 @@
1
- import{Xa as g}from"./chunk.VOHRQXCF.js";function y(e){return[`based on \u201C${e.basis}\u201D`,...e.confidence!==void 0?[`${Math.round(e.confidence*100)}% sure`]:[],...e.model?[e.model]:[]].join(" \xB7 ")}var u=e=>`Not yet kept by a person. ${e.by.name??e.by.id??"Something"} made it${e.lineage?`, ${y(e.lineage)}`:""}.`,p=e=>`${e.kind}\0${e.from}\0${e.to}`;function k(e,o){let r=new Map;for(let n of e){if(n.undoes!==void 0||o.has(n.id)||n.withheld)continue;let l=g(n.author),s=l==="human"||l==="visitor",c=new Map;for(let t of n.primitives){if(t.op!=="add-edge"&&t.op!=="remove-edge")continue;let i=p(t.edge),a=r.get(i)??c.get(i);if(r.delete(i),t.op==="remove-edge")a&&c.set(i,a);else if(a&&(s||!n.lineage))r.set(i,s?{...a,provisional:!1,keptBy:n.id}:a);else{let d=n.lineage;r.set(i,{edge:t.edge,made:n.id,by:n.author,...d?{lineage:d}:{},provisional:!s&&(d?.confidence??1)<1})}}}return r}var f=new WeakMap;function v({log:e}){let o=e.all(),r=`${e.horizon}:${o.length}:${o.at(-1)?.id}`,n=f.get(e);return n?.at!==r&&f.set(e,n={at:r,links:k(o,e.undoneIds())}),n.links}var L=(e,o)=>v(e).get(p(o));var m=e=>[...v(e).values()].filter(o=>o.provisional);export{y as a,u as b,L as c,m as d};
1
+ import{Xa as g}from"./chunk.3MZIWKNG.js";function y(e){return[`based on \u201C${e.basis}\u201D`,...e.confidence!==void 0?[`${Math.round(e.confidence*100)}% sure`]:[],...e.model?[e.model]:[]].join(" \xB7 ")}var u=e=>`Not yet kept by a person. ${e.by.name??e.by.id??"Something"} made it${e.lineage?`, ${y(e.lineage)}`:""}.`,p=e=>`${e.kind}\0${e.from}\0${e.to}`;function k(e,o){let r=new Map;for(let n of e){if(n.undoes!==void 0||o.has(n.id)||n.withheld)continue;let l=g(n.author),s=l==="human"||l==="visitor",c=new Map;for(let t of n.primitives){if(t.op!=="add-edge"&&t.op!=="remove-edge")continue;let i=p(t.edge),a=r.get(i)??c.get(i);if(r.delete(i),t.op==="remove-edge")a&&c.set(i,a);else if(a&&(s||!n.lineage))r.set(i,s?{...a,provisional:!1,keptBy:n.id}:a);else{let d=n.lineage;r.set(i,{edge:t.edge,made:n.id,by:n.author,...d?{lineage:d}:{},provisional:!s&&(d?.confidence??1)<1})}}}return r}var f=new WeakMap;function v({log:e}){let o=e.all(),r=`${e.horizon}:${o.length}:${o.at(-1)?.id}`,n=f.get(e);return n?.at!==r&&f.set(e,n={at:r,links:k(o,e.undoneIds())}),n.links}var L=(e,o)=>v(e).get(p(o));var m=e=>[...v(e).values()].filter(o=>o.provisional);export{y as a,u as b,L as c,m as d};