graview 0.1.67 → 0.1.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/preview/{chunk.YCD4JSXD.js → chunk.2BMZPALF.js} +1 -1
  2. package/dist/preview/{chunk.SNHKYH72.js → chunk.2KCDLCB2.js} +1 -1
  3. package/dist/preview/{chunk.O2OL6RQQ.js → chunk.2ME4DVBI.js} +1 -1
  4. package/dist/preview/chunk.2TUEBU7X.js +8 -0
  5. package/dist/preview/{chunk.LYEGRY77.js → chunk.2U6HB4XU.js} +1 -1
  6. package/dist/preview/{chunk.7S6ZRMW4.js → chunk.32JE2WS7.js} +1 -1
  7. package/dist/preview/{chunk.RG5G6YQD.js → chunk.3DEWQDP7.js} +1 -1
  8. package/dist/preview/{chunk.GVT4UUQA.js → chunk.3JMQKANL.js} +1 -1
  9. package/dist/preview/{chunk.A5PSEU3W.js → chunk.3VEZ5MOC.js} +1 -1
  10. package/dist/preview/chunk.3WPCS6KP.js +1 -0
  11. package/dist/preview/{chunk.5R744JGZ.js → chunk.42C3FIKK.js} +1 -1
  12. package/dist/preview/{chunk.IAEGJDF3.js → chunk.42KHFGN6.js} +1 -1
  13. package/dist/preview/{chunk.DZMIYEHQ.js → chunk.4DXPPM6T.js} +1 -1
  14. package/dist/preview/chunk.4GVKKBQL.js +1 -0
  15. package/dist/preview/{chunk.KX5ZBHMA.js → chunk.4TT3ZHSJ.js} +1 -1
  16. package/dist/preview/{chunk.QXLJGHMC.js → chunk.4YAO3A5Q.js} +3 -3
  17. package/dist/preview/{chunk.Z4TY44CD.js → chunk.5JKUT2OM.js} +1 -1
  18. package/dist/preview/chunk.5L4ADKTW.js +1 -0
  19. package/dist/preview/{chunk.BKYZSV2Y.js → chunk.64LCHHZB.js} +1 -1
  20. package/dist/preview/{chunk.ZEZUKRC6.js → chunk.6AANHELP.js} +1 -1
  21. package/dist/preview/{chunk.ZAQ4IDX6.js → chunk.6DMCEBSO.js} +1 -1
  22. package/dist/preview/{chunk.NKLPL7QD.js → chunk.6IR5LBJU.js} +1 -1
  23. package/dist/preview/{chunk.X226YATK.js → chunk.6WB2TYK7.js} +1 -1
  24. package/dist/preview/chunk.6ZENHSTQ.js +1 -0
  25. package/dist/preview/{chunk.EJ2EZL2G.js → chunk.7K2V5FUB.js} +1 -1
  26. package/dist/preview/chunk.7OL6H4LF.js +1 -0
  27. package/dist/preview/{chunk.4W57E7AX.js → chunk.7TDML5YU.js} +1 -1
  28. package/dist/preview/{chunk.AJMVRFYX.js → chunk.7WPVLEX2.js} +2 -2
  29. package/dist/preview/{chunk.XSWSBTUO.js → chunk.7ZTGB4O7.js} +1 -1
  30. package/dist/preview/{chunk.FRQSLWP4.js → chunk.ACNOP2IU.js} +1 -1
  31. package/dist/preview/{chunk.N4ZKZ4GM.js → chunk.AENP662H.js} +1 -1
  32. package/dist/preview/{chunk.SFBHPYRD.js → chunk.AQ2PI6MR.js} +1 -1
  33. package/dist/preview/chunk.ARS4HJD2.js +1 -0
  34. package/dist/preview/{chunk.STPA7HBK.js → chunk.AWV57UBJ.js} +1 -1
  35. package/dist/preview/{chunk.D7NWMXSX.js → chunk.AYZL3LCR.js} +3 -3
  36. package/dist/preview/{chunk.URQTF5SY.js → chunk.BHJRT57H.js} +1 -1
  37. package/dist/preview/{chunk.7UHPHEH5.js → chunk.BPNW5KCP.js} +1 -1
  38. package/dist/preview/{chunk.TTSGCNPT.js → chunk.BQAFFEOA.js} +1 -1
  39. package/dist/preview/chunk.C2QKA6XY.js +1 -0
  40. package/dist/preview/{chunk.6KJGRM7A.js → chunk.CE3NKAF7.js} +1 -1
  41. package/dist/preview/{chunk.QRQ5WPZI.js → chunk.CFE3MHWZ.js} +1 -1
  42. package/dist/preview/{chunk.H6KIEDZN.js → chunk.CGBOPPNL.js} +1 -1
  43. package/dist/preview/{chunk.LP2ZMAT2.js → chunk.CNN32262.js} +1 -1
  44. package/dist/preview/{chunk.HJUZMOW2.js → chunk.DCLF4WWZ.js} +1 -1
  45. package/dist/preview/{chunk.GMLONS5L.js → chunk.DGDW54KE.js} +1 -1
  46. package/dist/preview/{chunk.3GNT5MKP.js → chunk.DLSS56EU.js} +1 -1
  47. package/dist/preview/{chunk.QAM76AXV.js → chunk.DMZRFXH7.js} +1 -1
  48. package/dist/preview/{chunk.Z2XUVJAL.js → chunk.DPHH5ZVL.js} +1 -1
  49. package/dist/preview/{chunk.Z27NSSYL.js → chunk.DZ6UDZOB.js} +2 -2
  50. package/dist/preview/{chunk.6W6XMLSF.js → chunk.E423JCOS.js} +1 -1
  51. package/dist/preview/{chunk.35KMZHB7.js → chunk.EB7PZJEO.js} +1 -1
  52. package/dist/preview/{chunk.V7H4BUEB.js → chunk.ECNGVD25.js} +1 -1
  53. package/dist/preview/{chunk.B7KZBT27.js → chunk.EGSOHTZZ.js} +1 -1
  54. package/dist/preview/{chunk.OCXY5DCD.js → chunk.EGVM24ND.js} +1 -1
  55. package/dist/preview/{chunk.UDHPMVC4.js → chunk.ENLIIZF2.js} +1 -1
  56. package/dist/preview/{chunk.H3EGBDW2.js → chunk.EP5JS7ZH.js} +1 -1
  57. package/dist/preview/{chunk.TI5FR2QQ.js → chunk.F5GNNVSQ.js} +1 -1
  58. package/dist/preview/chunk.FHQ25SWY.js +1 -0
  59. package/dist/preview/{chunk.F464JKHZ.js → chunk.FSW535EA.js} +1 -1
  60. package/dist/preview/{chunk.G5GVT6JY.js → chunk.FZELUSK5.js} +1 -1
  61. package/dist/preview/{chunk.UWS4RMM3.js → chunk.G2BDEWJC.js} +1 -1
  62. package/dist/preview/chunk.GF3ZCX46.js +2 -0
  63. package/dist/preview/{chunk.UW52CMGJ.js → chunk.GJTEV6CK.js} +1 -1
  64. package/dist/preview/{chunk.A7GVTE5Y.js → chunk.GKTQ5CZA.js} +2 -2
  65. package/dist/preview/{chunk.ZG5VGP5U.js → chunk.GONZB3J3.js} +1 -1
  66. package/dist/preview/{chunk.FLJXYESX.js → chunk.GRBWXTST.js} +1 -1
  67. package/dist/preview/{chunk.Z3O2VZAJ.js → chunk.GRTBEA7O.js} +1 -1
  68. package/dist/preview/{chunk.QNP5OR3P.js → chunk.H3IGXHZR.js} +2 -2
  69. package/dist/preview/{chunk.ILJDLBPJ.js → chunk.H3W5C3XQ.js} +1 -1
  70. package/dist/preview/{chunk.O5VFKVZS.js → chunk.H4VNIAHN.js} +1 -1
  71. package/dist/preview/{chunk.7ARRVNUR.js → chunk.HH4D3JEI.js} +1 -1
  72. package/dist/preview/{chunk.MUSMNKE4.js → chunk.HWFJQ42Y.js} +1 -1
  73. package/dist/preview/{chunk.37RFCHSS.js → chunk.HXTKBISQ.js} +1 -1
  74. package/dist/preview/{chunk.J2OPIS3H.js → chunk.I34BWUB4.js} +1 -1
  75. package/dist/preview/{chunk.ZAPS4J6G.js → chunk.I63462I3.js} +1 -1
  76. package/dist/preview/{chunk.6UQFV53C.js → chunk.IKKKHHRN.js} +1 -1
  77. package/dist/preview/{chunk.GRFD42WM.js → chunk.IPGLITWA.js} +1 -1
  78. package/dist/preview/{chunk.3NSV3WKM.js → chunk.IT5DVKXY.js} +2 -2
  79. package/dist/preview/{chunk.JQ2WNKDW.js → chunk.IXMIU4D4.js} +1 -1
  80. package/dist/preview/{chunk.JVB5KDSG.js → chunk.JCETQQ7J.js} +1 -1
  81. package/dist/preview/{chunk.M7KXQGQL.js → chunk.JGRSUTPJ.js} +1 -1
  82. package/dist/preview/{chunk.KFT7JIEH.js → chunk.JLDJZET2.js} +1 -1
  83. package/dist/preview/{chunk.JQ63N4MZ.js → chunk.JULD4XFB.js} +1 -1
  84. package/dist/preview/{chunk.LVOTLGJB.js → chunk.JV432T4Q.js} +1 -1
  85. package/dist/preview/{chunk.6SJEZWH3.js → chunk.KAM73WVF.js} +1 -1
  86. package/dist/preview/{chunk.AKJS2NUM.js → chunk.KUCBNMIY.js} +1 -1
  87. package/dist/preview/{chunk.DWM7AR5Y.js → chunk.L7XKYGV7.js} +1 -1
  88. package/dist/preview/{chunk.EP6Q32WT.js → chunk.LFFJB6D3.js} +1 -1
  89. package/dist/preview/{chunk.264PB572.js → chunk.LMTG5NPG.js} +1 -1
  90. package/dist/preview/{chunk.EGPCVMDU.js → chunk.LOKGUALC.js} +1 -1
  91. package/dist/preview/{chunk.FPHRAO3R.js → chunk.LZ6MSQ5O.js} +1 -1
  92. package/dist/preview/chunk.MBTEOF4R.js +1 -0
  93. package/dist/preview/{chunk.RJY7VJBH.js → chunk.MIOLBZBS.js} +1 -1
  94. package/dist/preview/{chunk.G3GFDVO2.js → chunk.MK5RPEB2.js} +1 -1
  95. package/dist/preview/{chunk.NSOPYIT4.js → chunk.MKL4THIV.js} +1 -1
  96. package/dist/preview/{chunk.FVQKSN33.js → chunk.MPWLDQOG.js} +1 -1
  97. package/dist/preview/chunk.MSUZAJ2K.js +4 -0
  98. package/dist/preview/{chunk.MSAYU25L.js → chunk.N5Z34V7U.js} +1 -1
  99. package/dist/preview/chunk.N64RVSH3.js +1 -0
  100. package/dist/preview/{chunk.HAOB6O72.js → chunk.ND3DEDWB.js} +1 -1
  101. package/dist/preview/{chunk.GFLH7RCI.js → chunk.NFTPJAMJ.js} +1 -1
  102. package/dist/preview/{chunk.QZQCQWQG.js → chunk.NRCWMYLH.js} +1 -1
  103. package/dist/preview/{chunk.47XEJZ3O.js → chunk.O2VXTYUJ.js} +1 -1
  104. package/dist/preview/{chunk.6N4PE3U5.js → chunk.O32F6LGK.js} +1 -1
  105. package/dist/preview/{chunk.PZ7KY6XH.js → chunk.O5FTWXA2.js} +1 -1
  106. package/dist/preview/{chunk.T2OUHRAA.js → chunk.ODYJEDIW.js} +1 -1
  107. package/dist/preview/{chunk.DKEIEH2D.js → chunk.OQ4ZO3YY.js} +1 -1
  108. package/dist/preview/chunk.PI4RFOBU.js +1 -0
  109. package/dist/preview/{chunk.E5PYNAYT.js → chunk.PIMAG4WT.js} +2 -2
  110. package/dist/preview/{chunk.EFVSZKB5.js → chunk.PLIV3IQK.js} +1 -1
  111. package/dist/preview/{chunk.77C556NM.js → chunk.PPCDPYYU.js} +1 -1
  112. package/dist/preview/{chunk.MW7R5G3C.js → chunk.PZQ5P6WK.js} +1 -1
  113. package/dist/preview/chunk.Q42R2KW4.js +1 -0
  114. package/dist/preview/{chunk.WEMUKZKH.js → chunk.Q4VFLLUT.js} +1 -1
  115. package/dist/preview/{chunk.SY5ID44D.js → chunk.Q6H5HESF.js} +1 -1
  116. package/dist/preview/chunk.QM54TGU6.js +3 -0
  117. package/dist/preview/{chunk.HN4ZJ4B4.js → chunk.QOQ26NXM.js} +1 -1
  118. package/dist/preview/{chunk.SJQPTDAT.js → chunk.QUETLFBJ.js} +1 -1
  119. package/dist/preview/{chunk.P2EKKKK2.js → chunk.QWLK3GKG.js} +1 -1
  120. package/dist/preview/{chunk.JEC5FDKX.js → chunk.QYPU444Y.js} +1 -1
  121. package/dist/preview/{chunk.TXZQEJ5T.js → chunk.QZP3ARLH.js} +1 -1
  122. package/dist/preview/{chunk.WALVW3KJ.js → chunk.R3GE37OI.js} +1 -1
  123. package/dist/preview/chunk.R66ZVMWB.js +1 -0
  124. package/dist/preview/{chunk.YZPESGCP.js → chunk.RQG672MJ.js} +1 -1
  125. package/dist/preview/chunk.RYA7A4NA.js +1 -0
  126. package/dist/preview/{chunk.LRNFE3UK.js → chunk.SADR3MQI.js} +1 -1
  127. package/dist/preview/{chunk.MJY4SLWA.js → chunk.SS6KL5NT.js} +1 -1
  128. package/dist/preview/chunk.SUG6LIOX.js +1 -0
  129. package/dist/preview/{chunk.SO6NT5K7.js → chunk.TFJA4QV4.js} +1 -1
  130. package/dist/preview/{chunk.D4WJ7OM5.js → chunk.TOUSIUJF.js} +1 -1
  131. package/dist/preview/{chunk.ARWO4WOV.js → chunk.TR4YFVZN.js} +1 -1
  132. package/dist/preview/{chunk.XFLGSUYO.js → chunk.TRNJKHIA.js} +1 -1
  133. package/dist/preview/{chunk.5AKZROMR.js → chunk.TVWK3SGD.js} +1 -1
  134. package/dist/preview/chunk.U7PAFLUM.js +1 -0
  135. package/dist/preview/{chunk.NKYWIGC7.js → chunk.UAMPR4MD.js} +1 -1
  136. package/dist/preview/{chunk.UGQYMN4J.js → chunk.UD7VLXPM.js} +1 -1
  137. package/dist/preview/{chunk.UQIPEMJ5.js → chunk.UFURYU4R.js} +1 -1
  138. package/dist/preview/{chunk.R6JBA7UK.js → chunk.UODTUBQ7.js} +1 -1
  139. package/dist/preview/{chunk.NRURQGXV.js → chunk.VES4XMZX.js} +1 -1
  140. package/dist/preview/{chunk.QWGWOEBZ.js → chunk.VLXLBGMY.js} +1 -1
  141. package/dist/preview/{chunk.IDALEKIW.js → chunk.VTDOWXCP.js} +1 -1
  142. package/dist/preview/{chunk.4EMKCKDB.js → chunk.VV5JAM5W.js} +1 -1
  143. package/dist/preview/{chunk.JU6UFWS3.js → chunk.VW632VNJ.js} +1 -1
  144. package/dist/preview/{chunk.25QFDTCU.js → chunk.WC5WE34A.js} +1 -1
  145. package/dist/preview/chunk.WN7SAAH6.js +1 -0
  146. package/dist/preview/{chunk.4UUJHLHR.js → chunk.WV45KLXC.js} +1 -1
  147. package/dist/preview/{chunk.NAXOXBOF.js → chunk.XDZDNZ7B.js} +1 -1
  148. package/dist/preview/{chunk.MAKCZ6B6.js → chunk.XFH6GHBQ.js} +1 -1
  149. package/dist/preview/{chunk.2VUX54XH.js → chunk.XRE7SHLD.js} +1 -1
  150. package/dist/preview/{chunk.J6HF7IRQ.js → chunk.XXCHO2A5.js} +1 -1
  151. package/dist/preview/{chunk.A4EZAGG7.js → chunk.Y7OGJOPA.js} +1 -1
  152. package/dist/preview/{chunk.6NG76MDA.js → chunk.YBQ5GVAX.js} +2 -2
  153. package/dist/preview/{chunk.QF5QB5YR.js → chunk.YL2RBZFE.js} +1 -1
  154. package/dist/preview/{chunk.RSQ432QN.js → chunk.YM6SWEUI.js} +1 -1
  155. package/dist/preview/{chunk.7BJRHPE3.js → chunk.Z2X7BFCB.js} +2 -2
  156. package/dist/preview/{chunk.VBLQJVQ5.js → chunk.Z67LBSQO.js} +1 -1
  157. package/dist/preview/{chunk.OHAO6KKH.js → chunk.ZKXIZBCN.js} +1 -1
  158. package/dist/preview/{chunk.BDNQMKDG.js → chunk.ZLEBOR5T.js} +1 -1
  159. package/dist/preview/{chunk.CKDCTFLU.js → chunk.ZLNUZ6LR.js} +1 -1
  160. package/dist/preview/chunk.ZMADWPJO.js +1 -0
  161. package/dist/preview/chunk.ZO6VMEPP.js +1 -0
  162. package/dist/preview/chunk.ZUG7U7AT.js +1 -0
  163. package/dist/preview/index.html +55 -55
  164. package/dist/preview/page.js +2 -2
  165. package/package.json +6 -6
  166. package/dist/preview/chunk.2FHIINXG.js +0 -2
  167. package/dist/preview/chunk.3ENPWZBG.js +0 -1
  168. package/dist/preview/chunk.3ZODN6BW.js +0 -1
  169. package/dist/preview/chunk.55G4IPOO.js +0 -1
  170. package/dist/preview/chunk.5J6DVR7S.js +0 -1
  171. package/dist/preview/chunk.7WHQWLL6.js +0 -1
  172. package/dist/preview/chunk.B5SJMCTT.js +0 -7
  173. package/dist/preview/chunk.CTUJZ3IV.js +0 -1
  174. package/dist/preview/chunk.CY7FFKEZ.js +0 -1
  175. package/dist/preview/chunk.DEKRFTRN.js +0 -4
  176. package/dist/preview/chunk.EBKH3ILT.js +0 -1
  177. package/dist/preview/chunk.FOUBDGL3.js +0 -1
  178. package/dist/preview/chunk.HB5NWHFP.js +0 -3
  179. package/dist/preview/chunk.HVBKI5ZO.js +0 -1
  180. package/dist/preview/chunk.I3SDKMQS.js +0 -1
  181. package/dist/preview/chunk.J5OLYVZ4.js +0 -1
  182. package/dist/preview/chunk.JKFVNQY7.js +0 -1
  183. package/dist/preview/chunk.KGMSSXZL.js +0 -1
  184. package/dist/preview/chunk.NXZL5CA2.js +0 -1
  185. package/dist/preview/chunk.PSNMZBVS.js +0 -1
  186. package/dist/preview/chunk.R7CRBRD4.js +0 -1
  187. package/dist/preview/chunk.RR25BGWP.js +0 -1
  188. package/dist/preview/chunk.T27QKVKP.js +0 -1
  189. package/dist/preview/chunk.T3WCRS6M.js +0 -1
@@ -1 +1 @@
1
- import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as R,Va as g,W as y,Xa as h}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{lb as b,td as m}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
1
+ import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as R,Va as g,W as y,Xa as h}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{lb as b,td as m}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
@@ -1 +1 @@
1
- import{d as K}from"./chunk.4UUJHLHR.js";import{Fb as h,Gb as v,Hc as $,Ic as N,Nb as V,h as P,k as R,pc as Y,q as I,qb as G,qc as X,tc as B,ua as q,x as _}from"./chunk.ZEZUKRC6.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
1
+ import{d as K}from"./chunk.WV45KLXC.js";import{Fb as h,Gb as v,Hc as $,Ic as N,Nb as V,h as P,k as R,pc as Y,q as I,qb as G,qc as X,tc as B,ua as q,x as _}from"./chunk.6AANHELP.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
@@ -0,0 +1 @@
1
+ import{k as a,l as o}from"./chunk.42KHFGN6.js";import"./chunk.RQG672MJ.js";import"./chunk.Q6H5HESF.js";import"./chunk.3JMQKANL.js";import"./chunk.2ME4DVBI.js";import"./chunk.XXCHO2A5.js";import"./chunk.SADR3MQI.js";import"./chunk.LFFJB6D3.js";import"./chunk.DMZRFXH7.js";import"./chunk.DZ6UDZOB.js";import"./chunk.Q4VFLLUT.js";import"./chunk.6ZENHSTQ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.MIE4TJRW.js";import"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{ya as n}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function p(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{p as frameworkViews};
@@ -1 +1 @@
1
- import{Fb as a,la as l,ra as p}from"./chunk.ZEZUKRC6.js";import{c}from"./chunk.FQLNBIQ5.js";function m(e){if(e.withheld===!0||e.undoes!==void 0||e.mutation?.name!==a)return;let{node:n,field:r}=e.mutation.args??{};return typeof n=="string"&&typeof r=="string"?{node:n,field:r}:void 0}function R(e,n){return e.kind!==n.kind?!1:e.id!==void 0||n.id!==void 0?e.id===n.id&&e.onBehalfOf===n.onBehalfOf:(e.name??"")===(n.name??"")}var f=e=>{let n=0;for(let r of e)n++;return n};function k(e){if(e.length===0)return;let n=m(e[0]);if(!n)return;let r=0,o=0;for(let i of e){let d=m(i);if(!d||d.node!==n.node||d.field!==n.field)return;for(let t of i.primitives)if(t.op==="splice-text"&&t.id===n.node&&t.field===n.field)r+=f(t.inserted),o+=f(t.removed);else if(t.op==="patch-node"&&t.id===n.node&&Object.prototype.hasOwnProperty.call(t.after,n.field)){let s=t.before[n.field],u=t.after[n.field];r+=typeof u=="string"?f(u):0,o+=typeof s=="string"&&!c(s)?f(s):0}}return{...n,inserted:r,removed:o}}var T=(e,n)=>({node:e.node,field:e.field,inserted:e.inserted+n.inserted,removed:e.removed+n.removed});function y(e){return`(${[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]].join(" ")})`}function w(e,n,r,o=!0){let i=r?.getNode(e.node),d=i?n.tryDefinition(i.kind):void 0,t=p(d,e.field);return`Wrote in ${i&&o?`${l(d,i)}'s ${t.toLowerCase()}`:t} ${y(e)}`}export{R as a,k as b,T as c,w as d};
1
+ import{Fb as a,la as l,ra as p}from"./chunk.6AANHELP.js";import{c}from"./chunk.FQLNBIQ5.js";function m(e){if(e.withheld===!0||e.undoes!==void 0||e.mutation?.name!==a)return;let{node:n,field:r}=e.mutation.args??{};return typeof n=="string"&&typeof r=="string"?{node:n,field:r}:void 0}function R(e,n){return e.kind!==n.kind?!1:e.id!==void 0||n.id!==void 0?e.id===n.id&&e.onBehalfOf===n.onBehalfOf:(e.name??"")===(n.name??"")}var f=e=>{let n=0;for(let r of e)n++;return n};function k(e){if(e.length===0)return;let n=m(e[0]);if(!n)return;let r=0,o=0;for(let i of e){let d=m(i);if(!d||d.node!==n.node||d.field!==n.field)return;for(let t of i.primitives)if(t.op==="splice-text"&&t.id===n.node&&t.field===n.field)r+=f(t.inserted),o+=f(t.removed);else if(t.op==="patch-node"&&t.id===n.node&&Object.prototype.hasOwnProperty.call(t.after,n.field)){let s=t.before[n.field],u=t.after[n.field];r+=typeof u=="string"?f(u):0,o+=typeof s=="string"&&!c(s)?f(s):0}}return{...n,inserted:r,removed:o}}var T=(e,n)=>({node:e.node,field:e.field,inserted:e.inserted+n.inserted,removed:e.removed+n.removed});function y(e){return`(${[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]].join(" ")})`}function w(e,n,r,o=!0){let i=r?.getNode(e.node),d=i?n.tryDefinition(i.kind):void 0,t=p(d,e.field);return`Wrote in ${i&&o?`${l(d,i)}'s ${t.toLowerCase()}`:t} ${y(e)}`}export{R as a,k as b,T as c,w as d};
@@ -1 +1 @@
1
- import{$ as z,Ac as ne,Cb as H,Cc as te,Db as U,Dc as oe,Eb as X,Ec as I,Fb as Z,Fc as R,Gc as E,Jc as P,Kd as ie,L,Mc as N,R as G,U as F,Y as T,jc as Q,ob as Y,pb as v,ra as J,wc as O,yb as q,zc as ee}from"./chunk.ZEZUKRC6.js";import{j as y}from"./chunk.FQLNBIQ5.js";var re=e=>q(e).id??e.session;function j(e,i={}){let n=O(e),o=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||n.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:re(s.author);if(a===void 0)continue;let r=o.get(s.vote.suggestion);r||o.set(s.vote.suggestion,r=new Map),s.vote.vote===null?r.delete(a):r.set(a,s.vote.vote)}return o}function se(e){let i=0,n=0;for(let o of e?.values()??[])o==="for"?i++:n++;return{for:i,against:n}}function he(e,i,n){let o=I(i)?R(i):void 0,t=i&&(o===void 0?re(i):void 0),s=o!==void 0?n?.get(o):t!==void 0?e?.get(t):void 0,a=se(n);return{...se(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var V=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Se=(e,i,n)=>(e??[]).some(o=>o.suggestion===i&&(o.until===void 0||Date.parse(o.until)>Date.parse(n)));function ae(e,i=()=>!0,n={}){let o=O(e),t=Ae(e),s=n.now??new Date().toISOString(),a,r;return e.filter(d=>d.suggests&&!d.withheld&&!o.has(d.id)&&t.get(d.id)!=="all"&&!V(d,s)&&!Se(n.dismissed,d.id,s)).flatMap(({id:d,batch:u,suggests:l,suggestsSaid:c,intent:g,batchIntent:p,author:S,lineage:w,at:f,expiresAt:me})=>{let B=t.get(d),M=ve(l,c,g).filter(h=>!B?.has(h.at));if(M.length===0)return[];let _=M.map(h=>h.call),W=new Set;return JSON.stringify(_.map(h=>h.args),(h,D)=>(typeof D=="string"&&i(D)&&W.add(D),D)),[{id:d,batch:u,calls:_,intent:B?M.map(h=>h.intent).join("; "):g,...p!==void 0?{headline:p}:{},items:M,author:S,...w?{lineage:w}:{},at:f,expiresAt:me,about:[...W],tally:he((a??=j(e)).get(d),n.voter,(r??=j(e,{advisory:!0})).get(d))}]})}function ve(e,i,n){let o=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:o?.[s]??(e.length===1?n:t.name)}))}function Ae(e){let i=new Map;for(let o of e){let t=o.lineage?.suggestion;if(t===void 0)continue;let s=o.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let r=a??new Set;for(let d of s)r.add(d);i.set(t,r)}}let n=new Map(e.filter(o=>o.suggests&&i.has(o.id)).map(o=>[o.id,o.suggests.length]));for(let[o,t]of i)t!=="all"&&n.has(o)&&t.size>=n.get(o)&&i.set(o,"all");return i}var le=e=>JSON.stringify(e,(i,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort()):n);var we=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function xe(e,i){let n=ie(e.name),o=i?.act(e.name),t=e.args??{},s=o?o.derived:Q(n),{id:a}=t;if(s&&typeof a=="string"){if(we.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let r=o?.subject?.arg??"id",[d,u]=Object.keys(t).filter(l=>l!==r);return o?.connects?.length===1&&d&&!u&&i.has(t[r])&&i.has(t[d])?["connect",o.connects[0],t[r],t[d]]:[n,o?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var A=(e,i)=>`\u2248${le(e.map(n=>xe(n,i)))}`,de=e=>`\u2248${le([["connect",e.kind,e.from,e.to]])}`;function ue(e,i,n,o){let t=C(e,n,o);return[i,...i.map(s=>[s])].map(s=>t.get(A(s,n))).find(Boolean)}function C(e,i,n){let o=O(e),t=new Map(e.map(r=>[r.id,r])),s=new Map;for(let[r,d]of Object.entries(n??{}))o.has(d.id)||s.set(r,d);let a=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&a.set(r.lineage.suggestion,[...a.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let d=!o.has(r.id)&&!r.withheld,u=r.author.kind==="human",l=r.undoes!==void 0&&d?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let c=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||u),g=l?.suggests?l.suggests.filter((p,S)=>!a.get(l.id)?.includes(S)):c?[l.mutation]:[];if(g.length>0)for(let p of[g,...g.map(S=>[S])])s.set(A(p,i),r);if(!(!d||!u||r.undoes!==void 0))for(let p of r.primitives)p.op==="remove-edge"?s.set(de(p.edge),r):p.op==="add-edge"&&s.delete(de(p.edge))}return s}function ge(e){return Object.fromEntries([...e].map(([i,n])=>[i,{id:n.id,at:n.at,author:n.author,...n.undoes!==void 0&&{undoes:n.undoes}}]))}function ce(e,i){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&i(n.undoes)?.suggests!==void 0)}var K=e=>[...e].length;function Oe(e){let i,n=0,o=0;for(let t of e.ops){let s=t.mutation?.name===Z&&t.withheld!==!0&&t.undoes===void 0?t.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||i&&(i.node!==s.node||i.field!==s.field))return;i={node:s.node,field:s.field};for(let a of t.primitives)a.op==="splice-text"?(n+=K(a.inserted),o+=K(a.removed)):a.op==="patch-node"&&typeof a.after[s.field]=="string"&&(n+=K(a.after[s.field]))}return i&&{...i,inserted:n,removed:o}}function be(e,i,n){let o=n.getNode(e.node)?.kind,t=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${J(o?i.tryDefinition(o):void 0,e.field)} (${t.join(" ")})`}var b=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),ke=e=>e.ops.find(i=>i.lineage?.run!==void 0)?.lineage?.run;function Me(e,i=()=>{}){let n=[];for(let o of e){if(ce(o,i))continue;if(!P(o.author)){let l=Oe(o),c=n.at(-1),g=l&&c&&"batch"in c&&b(c.batch.author)===b(o.author)&&c.typed?.node===l.node&&c.typed.field===l.field?c.typed:void 0;g?n[n.length-1]={batch:o,typed:{...g,batches:[...g.batches,o],inserted:g.inserted+l.inserted,removed:g.removed+l.removed}}:n.push(l?{batch:o,typed:{batches:[o],...l}}:{batch:o});continue}let t=ke(o),s=b(o.author),a=t!==void 0?n.findIndex(l=>"digest"in l&&l.digest.run===t&&b(l.digest.author)===s):n.length-1,r=n[a],d=r!==void 0&&"digest"in r&&b(r.digest.author)===s&&r.digest.run===t?r.digest:void 0,u=[...d?.batches??[],o];d&&n.splice(a,1),n.push({digest:{author:o.author,batches:u,things:De(u),at:o.at,...t!==void 0?{run:t}:{}}})}return n}var De=e=>e.reduce((i,n)=>i+(n.undone?0:n.ops.length),0),Ie=e=>{let i=Date.parse(e);if(Number.isNaN(i))return!1;let{minutes:n}=F(i,G());return n<6*60||n>=21*60};function Re(e,i=T(new Date().toISOString())??L()){let n=T(e.at)??e.at.slice(0,10),t=e.run!==void 0&&n===i&&[e.at,...(e.batches??[]).map(a=>a.at)].every(Ie)?"overnight":n===i?"today":`on ${z(n)}`,s=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${s} ${t}`:`Tidied ${s} ${t}`}N.declined=ue;N.kept=(e,i,n)=>ge(C(e,i,n));var m=e=>e,x=(e,i)=>i===void 0?{}:{[e]:i};function tn(e,i,n){let o=y(e)?.store??e,t=m(o),s=ne(n.lineage);if(s===void 0)throw new v("A suggestion says what it is based on: { basis, confidence? }");let a=n.author??t.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new v(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let r=t.actMeanings(),d=A(i,r),u=$(o).find(f=>A(f.calls,r)===d);if(u)return o.log.get(u.id);t.refuseDeclined(i,a);let l=t.rehearsal();l.suggesting=!0;let c=l.applying(i,{author:a,lineage:s,...x("via",n.via)});if(c.ops.length===0)return;let g=[...new Set(c.ops.flatMap(f=>f.described??[]))],p=c.ops.filter(f=>f.mutation!==null&&f.author===a),S=i.length>1&&p.length===i.length?p.map(f=>f.intent):void 0,w={id:t.nextId(),seq:o.log.length,batch:t.mintBatch("batch"),author:a,intent:c.ops.map(f=>f.intent).join("; "),...x("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...g.length>0?{described:g}:{},at:t.now(),...x("via",n.via),lineage:s,suggests:i,...x("suggestsSaid",S),...x("expiresAt",n.expiresAt)};return o.log.append(w),o.notify(Y,[w]),w}function $(e,i,n={}){let o=y(e),t=o?.store??e,s=i??o?.principal,a=(s!==void 0?t.seenBy(s):t).log.all();return ae(a,r=>t.graph.has(r),{now:m(t).now(),dismissed:n.dismissed,voter:s})}function pe(e,i,n){let o=y(e),t=o?.store??e,s=n??o?.principal??m(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function fe(e,i,n,o={}){let t=y(e)?.store??e,s=o.author??m(t).by;k(t,i,s);let a=t.applyAll([{name:oe,args:{suggestion:i,vote:n}}],{...o,author:s});return n===null?a:{...a,voted:n}}function k(e,i,n){let o=$(e,n).find(s=>s.id===i),t=o?void 0:e.log.get(i);if(t?.suggests&&V(t,m(e).now()))throw new v(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!o)throw new v("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return o}function on(e,i,n={}){let o=y(e)?.store??e,{items:t,...s}=n,a=s.author??m(o).by,r=k(o,i,a),d=t===void 0?r.items:r.items.filter(g=>t.includes(g.at));if(t!==void 0&&(t.length===0||d.length!==new Set(t).size))throw new v("Name the changes to accept by their place among those still waiting in the suggestion.");let u={...r,calls:d.map(g=>g.call)};if(!pe(o,u,a))return fe(o,i,"for",{...s,author:a});let l=o.log.get(i)?.suggests?.length??d.length,c=d.length<l?{items:d.map(g=>g.at)}:{};return o.applyAll(u.calls,{...s,author:a,lineage:{...r.lineage,suggestion:i,...c}})}function sn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(!pe(o,s,t))return fe(o,i,"against",{...n,author:t});let a=ye(s)&&n.intent===void 0?{intent:`Declined ${$e(je(s))} proposal: ${s.intent}`}:{};return o.undo(s.batch,{...n,...a,author:t})}function rn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new v("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return o.undo(s.batch,{...n,author:t})}var Pe={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};E.op=(e,i,n,o,t,s)=>{let a=e,{suggestion:r,vote:d}=n.args,u=k(a,r,t),l=I(t)?R(t):void 0,c=d==="for"?`For: ${u.intent}`:d==="against"?`Against: ${u.intent}`:`Withdraws a vote on: ${u.intent}`;return{id:i.id,seq:a.log.length,batch:o,author:t,intent:c,mutation:n,primitives:[],reads:[],writes:[],...u.about.length>0?{described:u.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:r,vote:d,...l!==void 0?{advisory:!0,voter:l}:{}}}};E.accepting=(e,i)=>{let n=e,o=n.tidying?.autoAcceptAt;if(o===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(n).find(u=>u.id===t);if(!s)return;let r=[...j(n.log.all()).get(t)??[]].filter(([,u])=>u==="for").map(([u])=>u);if(r.length<o)return;let d=P(s.author)?s.author:Pe;return{calls:s.calls,author:d,lineage:{...s.lineage,suggestion:t,voters:r.slice(0,ee)}}};var ye=e=>e.lineage?.proposedBy!==void 0,je=e=>e.author.name??e.author.id??"Somebody",$e=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function an(e,i,n,o){let t=y(e)?.store??e,s=m(t).actMeanings(),a=A(n,s),r=$(t,i).find(u=>ye(u)&&A(u.calls,s)===a);if(r)return t.log.get(r.id);let d={calls:n.map(({name:u,args:l})=>({name:u,args:l})),...x("intent",o)};return t.applyAll([{name:te,args:d}],{author:i}).ops.find(u=>u.suggests!==void 0)}function dn(e,i,n){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let o=new Set(H(e,i,n));return n.filter(t=>!o.has(t)&&U(t).some(s=>X(e,i,t.name,s)))}export{be as a,Me as b,Re as c,tn as d,$ as e,pe as f,fe as g,on as h,sn as i,rn as j,ye as k,an as l,dn as m};
1
+ import{$ as z,Ac as ne,Cb as H,Cc as te,Db as U,Dc as oe,Eb as X,Ec as I,Fb as Z,Fc as R,Gc as E,Jc as P,Kd as ie,L,Mc as N,R as G,U as F,Y as T,jc as Q,ob as Y,pb as v,ra as J,wc as O,yb as q,zc as ee}from"./chunk.6AANHELP.js";import{j as y}from"./chunk.FQLNBIQ5.js";var re=e=>q(e).id??e.session;function j(e,i={}){let n=O(e),o=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||n.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:re(s.author);if(a===void 0)continue;let r=o.get(s.vote.suggestion);r||o.set(s.vote.suggestion,r=new Map),s.vote.vote===null?r.delete(a):r.set(a,s.vote.vote)}return o}function se(e){let i=0,n=0;for(let o of e?.values()??[])o==="for"?i++:n++;return{for:i,against:n}}function he(e,i,n){let o=I(i)?R(i):void 0,t=i&&(o===void 0?re(i):void 0),s=o!==void 0?n?.get(o):t!==void 0?e?.get(t):void 0,a=se(n);return{...se(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var V=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Se=(e,i,n)=>(e??[]).some(o=>o.suggestion===i&&(o.until===void 0||Date.parse(o.until)>Date.parse(n)));function ae(e,i=()=>!0,n={}){let o=O(e),t=Ae(e),s=n.now??new Date().toISOString(),a,r;return e.filter(d=>d.suggests&&!d.withheld&&!o.has(d.id)&&t.get(d.id)!=="all"&&!V(d,s)&&!Se(n.dismissed,d.id,s)).flatMap(({id:d,batch:u,suggests:l,suggestsSaid:c,intent:g,batchIntent:p,author:S,lineage:w,at:f,expiresAt:me})=>{let B=t.get(d),M=ve(l,c,g).filter(h=>!B?.has(h.at));if(M.length===0)return[];let _=M.map(h=>h.call),W=new Set;return JSON.stringify(_.map(h=>h.args),(h,D)=>(typeof D=="string"&&i(D)&&W.add(D),D)),[{id:d,batch:u,calls:_,intent:B?M.map(h=>h.intent).join("; "):g,...p!==void 0?{headline:p}:{},items:M,author:S,...w?{lineage:w}:{},at:f,expiresAt:me,about:[...W],tally:he((a??=j(e)).get(d),n.voter,(r??=j(e,{advisory:!0})).get(d))}]})}function ve(e,i,n){let o=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:o?.[s]??(e.length===1?n:t.name)}))}function Ae(e){let i=new Map;for(let o of e){let t=o.lineage?.suggestion;if(t===void 0)continue;let s=o.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let r=a??new Set;for(let d of s)r.add(d);i.set(t,r)}}let n=new Map(e.filter(o=>o.suggests&&i.has(o.id)).map(o=>[o.id,o.suggests.length]));for(let[o,t]of i)t!=="all"&&n.has(o)&&t.size>=n.get(o)&&i.set(o,"all");return i}var le=e=>JSON.stringify(e,(i,n)=>n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).sort()):n);var we=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function xe(e,i){let n=ie(e.name),o=i?.act(e.name),t=e.args??{},s=o?o.derived:Q(n),{id:a}=t;if(s&&typeof a=="string"){if(we.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let r=o?.subject?.arg??"id",[d,u]=Object.keys(t).filter(l=>l!==r);return o?.connects?.length===1&&d&&!u&&i.has(t[r])&&i.has(t[d])?["connect",o.connects[0],t[r],t[d]]:[n,o?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var A=(e,i)=>`\u2248${le(e.map(n=>xe(n,i)))}`,de=e=>`\u2248${le([["connect",e.kind,e.from,e.to]])}`;function ue(e,i,n,o){let t=C(e,n,o);return[i,...i.map(s=>[s])].map(s=>t.get(A(s,n))).find(Boolean)}function C(e,i,n){let o=O(e),t=new Map(e.map(r=>[r.id,r])),s=new Map;for(let[r,d]of Object.entries(n??{}))o.has(d.id)||s.set(r,d);let a=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&a.set(r.lineage.suggestion,[...a.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let d=!o.has(r.id)&&!r.withheld,u=r.author.kind==="human",l=r.undoes!==void 0&&d?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let c=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||u),g=l?.suggests?l.suggests.filter((p,S)=>!a.get(l.id)?.includes(S)):c?[l.mutation]:[];if(g.length>0)for(let p of[g,...g.map(S=>[S])])s.set(A(p,i),r);if(!(!d||!u||r.undoes!==void 0))for(let p of r.primitives)p.op==="remove-edge"?s.set(de(p.edge),r):p.op==="add-edge"&&s.delete(de(p.edge))}return s}function ge(e){return Object.fromEntries([...e].map(([i,n])=>[i,{id:n.id,at:n.at,author:n.author,...n.undoes!==void 0&&{undoes:n.undoes}}]))}function ce(e,i){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&i(n.undoes)?.suggests!==void 0)}var K=e=>[...e].length;function Oe(e){let i,n=0,o=0;for(let t of e.ops){let s=t.mutation?.name===Z&&t.withheld!==!0&&t.undoes===void 0?t.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||i&&(i.node!==s.node||i.field!==s.field))return;i={node:s.node,field:s.field};for(let a of t.primitives)a.op==="splice-text"?(n+=K(a.inserted),o+=K(a.removed)):a.op==="patch-node"&&typeof a.after[s.field]=="string"&&(n+=K(a.after[s.field]))}return i&&{...i,inserted:n,removed:o}}function be(e,i,n){let o=n.getNode(e.node)?.kind,t=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${J(o?i.tryDefinition(o):void 0,e.field)} (${t.join(" ")})`}var b=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),ke=e=>e.ops.find(i=>i.lineage?.run!==void 0)?.lineage?.run;function Me(e,i=()=>{}){let n=[];for(let o of e){if(ce(o,i))continue;if(!P(o.author)){let l=Oe(o),c=n.at(-1),g=l&&c&&"batch"in c&&b(c.batch.author)===b(o.author)&&c.typed?.node===l.node&&c.typed.field===l.field?c.typed:void 0;g?n[n.length-1]={batch:o,typed:{...g,batches:[...g.batches,o],inserted:g.inserted+l.inserted,removed:g.removed+l.removed}}:n.push(l?{batch:o,typed:{batches:[o],...l}}:{batch:o});continue}let t=ke(o),s=b(o.author),a=t!==void 0?n.findIndex(l=>"digest"in l&&l.digest.run===t&&b(l.digest.author)===s):n.length-1,r=n[a],d=r!==void 0&&"digest"in r&&b(r.digest.author)===s&&r.digest.run===t?r.digest:void 0,u=[...d?.batches??[],o];d&&n.splice(a,1),n.push({digest:{author:o.author,batches:u,things:De(u),at:o.at,...t!==void 0?{run:t}:{}}})}return n}var De=e=>e.reduce((i,n)=>i+(n.undone?0:n.ops.length),0),Ie=e=>{let i=Date.parse(e);if(Number.isNaN(i))return!1;let{minutes:n}=F(i,G());return n<6*60||n>=21*60};function Re(e,i=T(new Date().toISOString())??L()){let n=T(e.at)??e.at.slice(0,10),t=e.run!==void 0&&n===i&&[e.at,...(e.batches??[]).map(a=>a.at)].every(Ie)?"overnight":n===i?"today":`on ${z(n)}`,s=e.things===1?"one thing":`${e.things} things`;return e.author?.id?.startsWith("workflow:")&&e.author.name?`${e.author.name}: ${s} ${t}`:`Tidied ${s} ${t}`}N.declined=ue;N.kept=(e,i,n)=>ge(C(e,i,n));var m=e=>e,x=(e,i)=>i===void 0?{}:{[e]:i};function tn(e,i,n){let o=y(e)?.store??e,t=m(o),s=ne(n.lineage);if(s===void 0)throw new v("A suggestion says what it is based on: { basis, confidence? }");let a=n.author??t.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new v(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let r=t.actMeanings(),d=A(i,r),u=$(o).find(f=>A(f.calls,r)===d);if(u)return o.log.get(u.id);t.refuseDeclined(i,a);let l=t.rehearsal();l.suggesting=!0;let c=l.applying(i,{author:a,lineage:s,...x("via",n.via)});if(c.ops.length===0)return;let g=[...new Set(c.ops.flatMap(f=>f.described??[]))],p=c.ops.filter(f=>f.mutation!==null&&f.author===a),S=i.length>1&&p.length===i.length?p.map(f=>f.intent):void 0,w={id:t.nextId(),seq:o.log.length,batch:t.mintBatch("batch"),author:a,intent:c.ops.map(f=>f.intent).join("; "),...x("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...g.length>0?{described:g}:{},at:t.now(),...x("via",n.via),lineage:s,suggests:i,...x("suggestsSaid",S),...x("expiresAt",n.expiresAt)};return o.log.append(w),o.notify(Y,[w]),w}function $(e,i,n={}){let o=y(e),t=o?.store??e,s=i??o?.principal,a=(s!==void 0?t.seenBy(s):t).log.all();return ae(a,r=>t.graph.has(r),{now:m(t).now(),dismissed:n.dismissed,voter:s})}function pe(e,i,n){let o=y(e),t=o?.store??e,s=n??o?.principal??m(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function fe(e,i,n,o={}){let t=y(e)?.store??e,s=o.author??m(t).by;k(t,i,s);let a=t.applyAll([{name:oe,args:{suggestion:i,vote:n}}],{...o,author:s});return n===null?a:{...a,voted:n}}function k(e,i,n){let o=$(e,n).find(s=>s.id===i),t=o?void 0:e.log.get(i);if(t?.suggests&&V(t,m(e).now()))throw new v(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!o)throw new v("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return o}function on(e,i,n={}){let o=y(e)?.store??e,{items:t,...s}=n,a=s.author??m(o).by,r=k(o,i,a),d=t===void 0?r.items:r.items.filter(g=>t.includes(g.at));if(t!==void 0&&(t.length===0||d.length!==new Set(t).size))throw new v("Name the changes to accept by their place among those still waiting in the suggestion.");let u={...r,calls:d.map(g=>g.call)};if(!pe(o,u,a))return fe(o,i,"for",{...s,author:a});let l=o.log.get(i)?.suggests?.length??d.length,c=d.length<l?{items:d.map(g=>g.at)}:{};return o.applyAll(u.calls,{...s,author:a,lineage:{...r.lineage,suggestion:i,...c}})}function sn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(!pe(o,s,t))return fe(o,i,"against",{...n,author:t});let a=ye(s)&&n.intent===void 0?{intent:`Declined ${$e(je(s))} proposal: ${s.intent}`}:{};return o.undo(s.batch,{...n,...a,author:t})}function rn(e,i,n={}){let o=y(e)?.store??e,t=n.author??m(o).by,s=k(o,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new v("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return o.undo(s.batch,{...n,author:t})}var Pe={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};E.op=(e,i,n,o,t,s)=>{let a=e,{suggestion:r,vote:d}=n.args,u=k(a,r,t),l=I(t)?R(t):void 0,c=d==="for"?`For: ${u.intent}`:d==="against"?`Against: ${u.intent}`:`Withdraws a vote on: ${u.intent}`;return{id:i.id,seq:a.log.length,batch:o,author:t,intent:c,mutation:n,primitives:[],reads:[],writes:[],...u.about.length>0?{described:u.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:r,vote:d,...l!==void 0?{advisory:!0,voter:l}:{}}}};E.accepting=(e,i)=>{let n=e,o=n.tidying?.autoAcceptAt;if(o===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(n).find(u=>u.id===t);if(!s)return;let r=[...j(n.log.all()).get(t)??[]].filter(([,u])=>u==="for").map(([u])=>u);if(r.length<o)return;let d=P(s.author)?s.author:Pe;return{calls:s.calls,author:d,lineage:{...s.lineage,suggestion:t,voters:r.slice(0,ee)}}};var ye=e=>e.lineage?.proposedBy!==void 0,je=e=>e.author.name??e.author.id??"Somebody",$e=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function an(e,i,n,o){let t=y(e)?.store??e,s=m(t).actMeanings(),a=A(n,s),r=$(t,i).find(u=>ye(u)&&A(u.calls,s)===a);if(r)return t.log.get(r.id);let d={calls:n.map(({name:u,args:l})=>({name:u,args:l})),...x("intent",o)};return t.applyAll([{name:te,args:d}],{author:i}).ops.find(u=>u.suggests!==void 0)}function dn(e,i,n){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let o=new Set(H(e,i,n));return n.filter(t=>!o.has(t)&&U(t).some(s=>X(e,i,t.name,s)))}export{be as a,Me as b,Re as c,tn as d,$ as e,pe as f,fe as g,on as h,sn as i,rn as j,ye as k,an as l,dn as m};
@@ -1 +1 @@
1
- import{b as X}from"./chunk.Z27NSSYL.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as ce,W as Y,ea as N,ha as _}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Fb as R,ye as U}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var u=O(ce(),1);function M(e,t,s=!1){if(e<t.at||e===t.at&&s)return e;let i=t.at+t.removed.length;return e>=i?e+t.inserted.length-t.removed.length:s?t.at:t.at+t.inserted.length}var G=e=>e>=55296&&e<=56319,V=e=>e>=56320&&e<=57343;function q(e,t,s){let i=Math.min(e.length,t.length),n=0,l=Math.max(0,Math.min(i,t.length-s));for(;n<l&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;let r=0;for(;r<i-n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return r>0&&G(e.charCodeAt(r-1))&&r--,n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:r,removed:e.slice(r,e.length-n),inserted:t.slice(r,t.length-n)}}function B(e,t){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)===t.charCodeAt(i);)i++;i>0&&G(e.charCodeAt(i-1))&&i--;let n=0;for(;n<s-i&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;return n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:i,removed:e.slice(i,e.length-n),inserted:t.slice(i,t.length-n)}}function Z(e,t){let s=c=>c.at+c.removed.length;if(s(e)<t.at)return e;if(e.at>s(t))return{...e,at:e.at+t.inserted.length-t.removed.length};let i=Math.min(e.at,t.at),n=s(e)-s(t),l=e.removed.slice(0,t.at-i)+t.inserted+(n>0?e.removed.slice(e.removed.length-n):""),r=t.at<=e.at?t.inserted+e.inserted:e.inserted+t.inserted,d=B(l,r);return{...d,at:i+d.at}}function I(e,t){let s=M(e.start,t,!0),i=e.end===e.start?s:M(e.end,t);return{start:s,end:Math.max(s,i)}}function le(e,t){let{kind:s,id:i,session:n}=e.author,l=`${s}:${i??""}:`;return t.startsWith(l)&&(!n||t.slice(l.length)===n)}function J(e,t,s,i){let n=e.anchor,l=e.head;for(let d of s)if(!(d.seq<e.rev||le(d,t)))for(let c of d.primitives)c.op!=="splice-text"||c.id!==e.node||c.field!==e.field||(n=M(n,c),l=M(l,c));let r=d=>Math.max(0,Math.min(i,d));return{start:r(n),end:r(l)}}var W=(e,t,s)=>e.ops.length>0&&e.ops.every(i=>{let n=i.mutation?.args;return i.mutation?.name===R&&n?.node===t&&n.field===s}),de=(e,t,s,i)=>t.ops.length>0&&t.ops.every(n=>n.undoes!==void 0)&&e.batches().some(n=>t.ops.some(l=>l.undoes===n.id||l.undoes===n.ops[0]?.id)&&W(n,s,i)),Q=(e,t)=>e.author.kind==="human"&&(t?.id===void 0||e.author.id===void 0||e.author.id===t.id);function j(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(!(!Q(r,t)||r.undone||!W(r,s,i))&&e.canUndo(r.id).ok)return r.id}}function ee(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(Q(r,t)){if(W(r,s,i))return;if(de(e,r,s,i))return r.undone?void 0:r.id}}}var p=O(Y(),1);function ue(e){let{store:t}=N(),{live:s,nodeId:i,field:n}=e,[l,r]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let d=!0;return s.typing(i,n).then(c=>d&&r(c)),()=>{d=!1}},[i,n]),l&&!t.collaborative(i,n)?(0,p.jsx)(p.Fragment,{children:e.writtenWhole}):(0,p.jsx)(pe,{...e,typing:l})}function pe({nodeId:e,field:t,label:s,markdown:i,live:n,onDone:l,typing:r}){let{store:d,principal:c}=N(),m=_(e),f=ne(m?.[t]),[T,ie]=(0,u.useState)(!1),v=(0,u.useRef)(null),D=(0,u.useRef)(f),E=(0,u.useRef)(!1),H=(0,u.useRef)(n);H.current=n;let K=()=>ne(d.graph.getNode(e)?.[t]),b=!r||d.permits({name:R,args:{node:e,field:t,at:0,remove:0,insert:""}},c).ok;(0,u.useEffect)(()=>v.current?.focus(),[T,r]);let C=(0,u.useRef)(void 0),k=()=>{C.current===void 0&&(C.current=setTimeout(()=>{C.current=void 0;let o=v.current;if(!o||o.ownerDocument.activeElement!==o)return;let a=o.selectionDirection==="backward";H.current.sayCaret({node:e,field:t,anchor:a?o.selectionEnd:o.selectionStart,head:a?o.selectionStart:o.selectionEnd,rev:d.log.length})},ge))};(0,u.useEffect)(()=>()=>{clearTimeout(C.current),H.current.sayCaret(null)},[]);let F=o=>{let a=v.current;if(a){if(a.value!==o){let h=I({start:a.selectionStart,end:a.selectionEnd},B(a.value,o)),g=a.selectionDirection??"none";a.value=o,a.setSelectionRange(h.start,h.end,g)}D.current=o}},$=()=>{let o=v.current;if(!o||!r||!b||E.current)return;let a=D.current,h=K(),g=q(a,o.value,o.selectionEnd);if(g.removed===""&&g.inserted==="")return F(h);let y=a===h?g:Z(g,B(a,h));try{r.splice(y.at,y.removed.length,y.inserted)}catch{}let w=K();if(o.value!==w){o.value=w;let S=Math.min(w.length,y.at+y.inserted.length);o.setSelectionRange(S,S)}D.current=w,k()};(0,u.useLayoutEffect)(()=>{E.current||F(f)},[f]);let ae=async o=>{if(!r)return;r.flush();for(let h=0;r.waiting()>0&&h<100;h++)await new Promise(g=>setTimeout(g,30));let a=o?ee(d,c,e,t):j(d,c,e,t);if(a)try{o?d.redo(a,{author:c}):d.undo(a,{author:c})}catch{}},x=o=>{r?.flush(),n.sayCaret(null),l(o)},A=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>A.current?.(),[]);let se=o=>{A.current?.();let a=o.ownerDocument,h=v.current?.closest("[data-graview-live]"),g=P=>{let L=P.target;if(L instanceof Node&&h?.contains(L))return S();L instanceof Element&&L.closest(te)||(S(),x(!0))},y=()=>{let P=a.activeElement;P!==null&&P!==a.body||o.isConnected&&fe(o)||(S(),v.current?.focus({preventScroll:!0}))},w=new MutationObserver(y);w.observe(a.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open","hidden"]}),a.addEventListener("focusin",g),a.addEventListener("toggle",y,!0);let S=()=>{A.current=void 0,w.disconnect(),a.removeEventListener("focusin",g),a.removeEventListener("toggle",y,!0)};A.current=S},z=[...n.who.values()].filter(o=>o.caret?.node===e&&o.caret.field===t);return(0,p.jsxs)("div",{style:{display:"grid",gap:8,minWidth:0},"data-graview-live":t,children:[T?(0,p.jsx)("div",{"data-graview-preview":t,"aria-label":`${s}, as it will read`,role:"region",style:ye,children:(0,p.jsx)(X,{text:f,markdown:!0})}):(0,p.jsxs)("div",{style:{position:"relative",minWidth:0},children:[(0,p.jsx)("textarea",{ref:v,"aria-label":s,"data-graview-field":t,defaultValue:f,readOnly:!r||!b,rows:3,onInput:$,onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1,$()},onSelect:k,onFocus:k,onPointerDown:()=>r?.flush(),onKeyDown:o=>{let a=o.key;a==="Escape"?(o.preventDefault(),x(!1)):(o.metaKey||o.ctrlKey)&&!o.altKey&&a.toLowerCase()==="z"?(o.preventDefault(),ae(o.shiftKey)):(o.metaKey||o.ctrlKey)&&a==="Enter"?(o.preventDefault(),x(!1)):(a==="Enter"||me.has(a))&&r?.flush()},onKeyUp:k,onBlur:o=>{r?.flush(),n.sayCaret(null);let a=o.relatedTarget;if(a instanceof Node&&o.currentTarget.closest("[data-graview-live]")?.contains(a))return;let h=a instanceof Element?a.closest(te):null;if(h)return se(h);x(!0)},style:ve}),z.length>0?(0,p.jsx)(he,{text:f,others:z,area:v,log:d.log.all()}):null]}),(0,p.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,p.jsx)("button",{type:"button",onClick:()=>x(!1),style:re,children:"Done"}),i?(0,p.jsx)("button",{type:"button","aria-pressed":T,onClick:()=>ie(!T),style:re,children:T?"Write":"Preview"}):null,(0,p.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},...b?{}:{"data-graview-readonly":""},children:b?"Saved as you type \xB7 Ctrl or \u2318 Z takes back your typing":`Read only: the ${s.toLowerCase()} can't be changed here now`})]})]})}function he({text:e,others:t,area:s,log:i}){let n=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{let c=s.current,m=n.current;if(!c||!m)return;let f=()=>{m.scrollTop=c.scrollTop};return f(),c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)});let l=t.map(c=>({one:c,at:J(c.caret,c.participant,i,e.length).end})).sort((c,m)=>c.at-m.at),r=[],d=0;for(let{one:c,at:m}of l){r.push(e.slice(d,m)),d=m;let f=U(c)||"Somebody";r.push((0,p.jsx)("span",{"data-graview-caret":c.participant,title:`${f} is typing here`,style:{borderLeft:`2px solid hsl(${Math.round(c.hue)} 55% 52%)`,marginLeft:-1,marginRight:-1,pointerEvents:"auto"}},c.participant))}return r.push(`${e.slice(d)}\u200B`),(0,p.jsx)("div",{ref:n,"aria-hidden":"true",style:we,children:r})}var te='[data-graview-overlay], dialog, [role="dialog"], [role="alertdialog"], [popover]',fe=e=>{if(e.hasAttribute("hidden")||e instanceof HTMLDialogElement&&!e.open)return!1;if(e.hasAttribute("popover"))try{return e.matches(":popover-open")}catch{}return!0},ge=120,ne=e=>typeof e=="string"?e:"",me=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),ye={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},re={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},oe={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",borderRadius:6},ve={...oe,resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)"},we={...oe,position:"absolute",inset:0,height:"100%",border:"1px solid transparent",color:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"hidden",pointerEvents:"none"};export{ue as default};
1
+ import{b as X}from"./chunk.DZ6UDZOB.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as ce,W as Y,ea as N,ha as _}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{Fb as R,ye as U}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var u=O(ce(),1);function M(e,t,s=!1){if(e<t.at||e===t.at&&s)return e;let i=t.at+t.removed.length;return e>=i?e+t.inserted.length-t.removed.length:s?t.at:t.at+t.inserted.length}var G=e=>e>=55296&&e<=56319,V=e=>e>=56320&&e<=57343;function q(e,t,s){let i=Math.min(e.length,t.length),n=0,l=Math.max(0,Math.min(i,t.length-s));for(;n<l&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;let r=0;for(;r<i-n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return r>0&&G(e.charCodeAt(r-1))&&r--,n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:r,removed:e.slice(r,e.length-n),inserted:t.slice(r,t.length-n)}}function B(e,t){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)===t.charCodeAt(i);)i++;i>0&&G(e.charCodeAt(i-1))&&i--;let n=0;for(;n<s-i&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;return n>0&&V(e.charCodeAt(e.length-n))&&n--,{at:i,removed:e.slice(i,e.length-n),inserted:t.slice(i,t.length-n)}}function Z(e,t){let s=c=>c.at+c.removed.length;if(s(e)<t.at)return e;if(e.at>s(t))return{...e,at:e.at+t.inserted.length-t.removed.length};let i=Math.min(e.at,t.at),n=s(e)-s(t),l=e.removed.slice(0,t.at-i)+t.inserted+(n>0?e.removed.slice(e.removed.length-n):""),r=t.at<=e.at?t.inserted+e.inserted:e.inserted+t.inserted,d=B(l,r);return{...d,at:i+d.at}}function I(e,t){let s=M(e.start,t,!0),i=e.end===e.start?s:M(e.end,t);return{start:s,end:Math.max(s,i)}}function le(e,t){let{kind:s,id:i,session:n}=e.author,l=`${s}:${i??""}:`;return t.startsWith(l)&&(!n||t.slice(l.length)===n)}function J(e,t,s,i){let n=e.anchor,l=e.head;for(let d of s)if(!(d.seq<e.rev||le(d,t)))for(let c of d.primitives)c.op!=="splice-text"||c.id!==e.node||c.field!==e.field||(n=M(n,c),l=M(l,c));let r=d=>Math.max(0,Math.min(i,d));return{start:r(n),end:r(l)}}var W=(e,t,s)=>e.ops.length>0&&e.ops.every(i=>{let n=i.mutation?.args;return i.mutation?.name===R&&n?.node===t&&n.field===s}),de=(e,t,s,i)=>t.ops.length>0&&t.ops.every(n=>n.undoes!==void 0)&&e.batches().some(n=>t.ops.some(l=>l.undoes===n.id||l.undoes===n.ops[0]?.id)&&W(n,s,i)),Q=(e,t)=>e.author.kind==="human"&&(t?.id===void 0||e.author.id===void 0||e.author.id===t.id);function j(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(!(!Q(r,t)||r.undone||!W(r,s,i))&&e.canUndo(r.id).ok)return r.id}}function ee(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(Q(r,t)){if(W(r,s,i))return;if(de(e,r,s,i))return r.undone?void 0:r.id}}}var p=O(Y(),1);function ue(e){let{store:t}=N(),{live:s,nodeId:i,field:n}=e,[l,r]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let d=!0;return s.typing(i,n).then(c=>d&&r(c)),()=>{d=!1}},[i,n]),l&&!t.collaborative(i,n)?(0,p.jsx)(p.Fragment,{children:e.writtenWhole}):(0,p.jsx)(pe,{...e,typing:l})}function pe({nodeId:e,field:t,label:s,markdown:i,live:n,onDone:l,typing:r}){let{store:d,principal:c}=N(),m=_(e),f=ne(m?.[t]),[T,ie]=(0,u.useState)(!1),v=(0,u.useRef)(null),D=(0,u.useRef)(f),E=(0,u.useRef)(!1),H=(0,u.useRef)(n);H.current=n;let K=()=>ne(d.graph.getNode(e)?.[t]),b=!r||d.permits({name:R,args:{node:e,field:t,at:0,remove:0,insert:""}},c).ok;(0,u.useEffect)(()=>v.current?.focus(),[T,r]);let C=(0,u.useRef)(void 0),k=()=>{C.current===void 0&&(C.current=setTimeout(()=>{C.current=void 0;let o=v.current;if(!o||o.ownerDocument.activeElement!==o)return;let a=o.selectionDirection==="backward";H.current.sayCaret({node:e,field:t,anchor:a?o.selectionEnd:o.selectionStart,head:a?o.selectionStart:o.selectionEnd,rev:d.log.length})},ge))};(0,u.useEffect)(()=>()=>{clearTimeout(C.current),H.current.sayCaret(null)},[]);let F=o=>{let a=v.current;if(a){if(a.value!==o){let h=I({start:a.selectionStart,end:a.selectionEnd},B(a.value,o)),g=a.selectionDirection??"none";a.value=o,a.setSelectionRange(h.start,h.end,g)}D.current=o}},$=()=>{let o=v.current;if(!o||!r||!b||E.current)return;let a=D.current,h=K(),g=q(a,o.value,o.selectionEnd);if(g.removed===""&&g.inserted==="")return F(h);let y=a===h?g:Z(g,B(a,h));try{r.splice(y.at,y.removed.length,y.inserted)}catch{}let w=K();if(o.value!==w){o.value=w;let S=Math.min(w.length,y.at+y.inserted.length);o.setSelectionRange(S,S)}D.current=w,k()};(0,u.useLayoutEffect)(()=>{E.current||F(f)},[f]);let ae=async o=>{if(!r)return;r.flush();for(let h=0;r.waiting()>0&&h<100;h++)await new Promise(g=>setTimeout(g,30));let a=o?ee(d,c,e,t):j(d,c,e,t);if(a)try{o?d.redo(a,{author:c}):d.undo(a,{author:c})}catch{}},x=o=>{r?.flush(),n.sayCaret(null),l(o)},A=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>A.current?.(),[]);let se=o=>{A.current?.();let a=o.ownerDocument,h=v.current?.closest("[data-graview-live]"),g=P=>{let L=P.target;if(L instanceof Node&&h?.contains(L))return S();L instanceof Element&&L.closest(te)||(S(),x(!0))},y=()=>{let P=a.activeElement;P!==null&&P!==a.body||o.isConnected&&fe(o)||(S(),v.current?.focus({preventScroll:!0}))},w=new MutationObserver(y);w.observe(a.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open","hidden"]}),a.addEventListener("focusin",g),a.addEventListener("toggle",y,!0);let S=()=>{A.current=void 0,w.disconnect(),a.removeEventListener("focusin",g),a.removeEventListener("toggle",y,!0)};A.current=S},z=[...n.who.values()].filter(o=>o.caret?.node===e&&o.caret.field===t);return(0,p.jsxs)("div",{style:{display:"grid",gap:8,minWidth:0},"data-graview-live":t,children:[T?(0,p.jsx)("div",{"data-graview-preview":t,"aria-label":`${s}, as it will read`,role:"region",style:ye,children:(0,p.jsx)(X,{text:f,markdown:!0})}):(0,p.jsxs)("div",{style:{position:"relative",minWidth:0},children:[(0,p.jsx)("textarea",{ref:v,"aria-label":s,"data-graview-field":t,defaultValue:f,readOnly:!r||!b,rows:3,onInput:$,onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1,$()},onSelect:k,onFocus:k,onPointerDown:()=>r?.flush(),onKeyDown:o=>{let a=o.key;a==="Escape"?(o.preventDefault(),x(!1)):(o.metaKey||o.ctrlKey)&&!o.altKey&&a.toLowerCase()==="z"?(o.preventDefault(),ae(o.shiftKey)):(o.metaKey||o.ctrlKey)&&a==="Enter"?(o.preventDefault(),x(!1)):(a==="Enter"||me.has(a))&&r?.flush()},onKeyUp:k,onBlur:o=>{r?.flush(),n.sayCaret(null);let a=o.relatedTarget;if(a instanceof Node&&o.currentTarget.closest("[data-graview-live]")?.contains(a))return;let h=a instanceof Element?a.closest(te):null;if(h)return se(h);x(!0)},style:ve}),z.length>0?(0,p.jsx)(he,{text:f,others:z,area:v,log:d.log.all()}):null]}),(0,p.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,p.jsx)("button",{type:"button",onClick:()=>x(!1),style:re,children:"Done"}),i?(0,p.jsx)("button",{type:"button","aria-pressed":T,onClick:()=>ie(!T),style:re,children:T?"Write":"Preview"}):null,(0,p.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},...b?{}:{"data-graview-readonly":""},children:b?"Saved as you type \xB7 Ctrl or \u2318 Z takes back your typing":`Read only: the ${s.toLowerCase()} can't be changed here now`})]})]})}function he({text:e,others:t,area:s,log:i}){let n=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{let c=s.current,m=n.current;if(!c||!m)return;let f=()=>{m.scrollTop=c.scrollTop};return f(),c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)});let l=t.map(c=>({one:c,at:J(c.caret,c.participant,i,e.length).end})).sort((c,m)=>c.at-m.at),r=[],d=0;for(let{one:c,at:m}of l){r.push(e.slice(d,m)),d=m;let f=U(c)||"Somebody";r.push((0,p.jsx)("span",{"data-graview-caret":c.participant,title:`${f} is typing here`,style:{borderLeft:`2px solid hsl(${Math.round(c.hue)} 55% 52%)`,marginLeft:-1,marginRight:-1,pointerEvents:"auto"}},c.participant))}return r.push(`${e.slice(d)}\u200B`),(0,p.jsx)("div",{ref:n,"aria-hidden":"true",style:we,children:r})}var te='[data-graview-overlay], dialog, [role="dialog"], [role="alertdialog"], [popover]',fe=e=>{if(e.hasAttribute("hidden")||e instanceof HTMLDialogElement&&!e.open)return!1;if(e.hasAttribute("popover"))try{return e.matches(":popover-open")}catch{}return!0},ge=120,ne=e=>typeof e=="string"?e:"",me=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),ye={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},re={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},oe={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",borderRadius:6},ve={...oe,resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)"},we={...oe,position:"absolute",inset:0,height:"100%",border:"1px solid transparent",color:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"hidden",pointerEvents:"none"};export{ue as default};
@@ -1 +1 @@
1
- import{c as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk.H6KIEDZN.js";import"./chunk.264PB572.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.LP2ZMAT2.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{h as createLinks,g as judgeDestination,e as listsOf,c as nowhere,f as placeVocabulary,a as placesSaid,b as quoted,d as whereOfWords};
1
+ import{c as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk.CGBOPPNL.js";import"./chunk.LMTG5NPG.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.CNN32262.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{h as createLinks,g as judgeDestination,e as listsOf,c as nowhere,f as placeVocabulary,a as placesSaid,b as quoted,d as whereOfWords};
@@ -1 +1 @@
1
- import{a as Y,b as _,c as D,e as R,h as z,i as q,j as k,k as S,l as N,o as H,p as P}from"./chunk.LRNFE3UK.js";import{b as V}from"./chunk.SJQPTDAT.js";import{G,L as T,T as A,aa as W,cb as F,ga as j,ha as B,hb as U,la as I}from"./chunk.ZEZUKRC6.js";function ne(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function oe(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ie(e,r){let n=[],d={};if(e.query&&(d.query=e.query),e.archived!==void 0&&e.archived!==!1&&(d.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?d.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(a=>a.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(d.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?d.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:d,dropped:n}}function x(e,r){return I(e.schema.tryDefinition(r.kind),k(r))}var se=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function de(e,r,n){if(n==="label")return x(e,r);let d=e.schema.tryDefinition(r.kind);return d&&n in(d.fields.shape??{})?F(q(r),n,e.today??T()):d?.computed?.[n]!==void 0?e.read?.(r,n):S(e.graph,r.id,n).map(c=>x(e,c)).sort()[0]}var ue=/^(\d{4})-(\d{2})-(\d{2})/;function Z(e,r){if(G.test(e)){let[s,i]=[e.slice(0,4),e.slice(5,7)];return r==="year"?`${s}-01-01`:r==="decade"?`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`:r==="month"&&i?`${s}-${i}-01`:e}let n=ue.exec(e);if(!n)return;let[,d,u,c]=n;if(r==="day")return`${d}-${u}-${c}`;if(r==="month")return`${d}-${u}-01`;if(r==="year")return`${d}-01-01`;if(r==="decade")return`${String(Number(d)-Number(d)%10).padStart(4,"0")}-01-01`;let l=new Date(Date.UTC(Number(d),Number(u)-1,Number(c))),a=(l.getUTCDay()+6)%7;return l.setUTCDate(l.getUTCDate()-a),l.toISOString().slice(0,10)}function le(e,r){return G.test(e)?A(e):r==="month"?W(e):r==="week"?`Week of ${A(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:A(e)}function ae(e,r,n){return Q(e,n)(r)}function Q(e,r){let{words:n,conditions:d}=H(r);if(n.length===0&&d.length===0)return()=>!0;let u=new Map,c=l=>{let a=u.get(l);return a||(a=new Set(R(e.schema,l).filters.map(s=>s.key)),u.set(l,a)),a};return l=>{let a=c(l.kind),s=d.filter(i=>a.has(i.key));return s.every(i=>N(e,l,i))?n.length>0?P(e.schema.tryDefinition(l.kind),k(l),n,e.searchIn)!==void 0:s.length>0:!1}}function fe(e,r,n){let d=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>U(t,r.archived)),c=d?u.filter(Q(n,d)):u,l=r.filter?.length?c.filter(t=>r.filter.every(f=>N(n,t,f))):[...c],a=[];for(let t=r.sort;t&&a.length<4;t=t.then)a.push(t);let s=a.length>0?l.map((t,f)=>({node:t,index:f,values:a.map(o=>de(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of a.entries()){let[b,E]=[t.values[o],f.values[o]],C=se(b,E),M=p.direction==="desc"&&C!==0&&b!==void 0&&E!==void 0?-C:C;if(M!==0)return M}return t.index-f.index}).map(t=>t.node):l,i=r.group;if(!i)return{nodes:s,groups:[{key:"",label:"",nodes:s}],grouped:!1};let y=new Map,g=(t,f,o)=>{let p=y.get(t)??{label:f,nodes:[]};p.nodes.push(o),y.set(t,p)},O=s[0],m=O?n.schema.tryDefinition(O.kind):void 0,L=m?.fields.shape??{},ee=m?Y(m,i.by):j(i.by),$=i.by in L,h=$?_(L[i.by]):void 0,re=D(n.schema,O?.kind??"").find(t=>t.key===i.by)?.label,w=$?`No ${ee.toLowerCase()}`:`Without ${(re??j(i.by)).toLowerCase()}`,K=$?new Map:V([...new Map(s.flatMap(t=>S(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(k),t=>n.schema.tryDefinition(t));for(let t of s){if($){let o=F(q(t),i.by,n.today??T());if(o==null||o==="")g("",w,t);else if(h==="date"){let p=i.bucket??"day",b=Z(String(o),p);b?g(b,le(b,p),t):g("",w,t)}else if(h==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):h==="choice"?B(String(o)):String(o),t)}continue}let f=S(n.graph,t.id,i.by).map(o=>({id:o.id,label:K.has(o.id)?`${x(n,o)} \xB7 ${K.get(o.id)}`:x(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",w,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let v=h==="choice"?z(L[i.by]):void 0,te=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:v?v.indexOf(t)-v.indexOf(o):h==="boolean"?o.localeCompare(t):h==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:s,groups:te,grouped:!0}}function J(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function X(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function ce(e){let r=J(e?.sort),n=X(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var pe=(e,r)=>r?e==="1"?"true":"false":e;function ge(e,r,n){let d=n.type==="boolean",u=d?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(s=>u.includes(s)),...u])],l=r.closed??[],a=s=>{if(s.key==="")return[1,0];let i=pe(s.key,d);if(l.includes(i))return[2,l.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((s,i)=>({group:s,at:i,rank:a(s)})).sort((s,i)=>s.rank[0]-i.rank[0]||s.rank[1]-i.rank[1]||s.at-i.at).map(({group:s,rank:i})=>({...s,closed:i[0]===2}))}export{X as a,ce as b,ge as c,ne as d,oe as e,ie as f,ae as g,fe as h};
1
+ import{a as Y,b as _,c as D,e as R,h as z,i as q,j as k,k as S,l as N,o as H,p as P}from"./chunk.SADR3MQI.js";import{b as V}from"./chunk.QUETLFBJ.js";import{G,L as T,T as A,aa as W,cb as F,ga as j,ha as B,hb as U,la as I}from"./chunk.6AANHELP.js";function ne(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function oe(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function ie(e,r){let n=[],d={};if(e.query&&(d.query=e.query),e.archived!==void 0&&e.archived!==!1&&(d.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?d.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(a=>a.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(d.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?d.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:d,dropped:n}}function x(e,r){return I(e.schema.tryDefinition(r.kind),k(r))}var se=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function de(e,r,n){if(n==="label")return x(e,r);let d=e.schema.tryDefinition(r.kind);return d&&n in(d.fields.shape??{})?F(q(r),n,e.today??T()):d?.computed?.[n]!==void 0?e.read?.(r,n):S(e.graph,r.id,n).map(c=>x(e,c)).sort()[0]}var ue=/^(\d{4})-(\d{2})-(\d{2})/;function Z(e,r){if(G.test(e)){let[s,i]=[e.slice(0,4),e.slice(5,7)];return r==="year"?`${s}-01-01`:r==="decade"?`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`:r==="month"&&i?`${s}-${i}-01`:e}let n=ue.exec(e);if(!n)return;let[,d,u,c]=n;if(r==="day")return`${d}-${u}-${c}`;if(r==="month")return`${d}-${u}-01`;if(r==="year")return`${d}-01-01`;if(r==="decade")return`${String(Number(d)-Number(d)%10).padStart(4,"0")}-01-01`;let l=new Date(Date.UTC(Number(d),Number(u)-1,Number(c))),a=(l.getUTCDay()+6)%7;return l.setUTCDate(l.getUTCDate()-a),l.toISOString().slice(0,10)}function le(e,r){return G.test(e)?A(e):r==="month"?W(e):r==="week"?`Week of ${A(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:A(e)}function ae(e,r,n){return Q(e,n)(r)}function Q(e,r){let{words:n,conditions:d}=H(r);if(n.length===0&&d.length===0)return()=>!0;let u=new Map,c=l=>{let a=u.get(l);return a||(a=new Set(R(e.schema,l).filters.map(s=>s.key)),u.set(l,a)),a};return l=>{let a=c(l.kind),s=d.filter(i=>a.has(i.key));return s.every(i=>N(e,l,i))?n.length>0?P(e.schema.tryDefinition(l.kind),k(l),n,e.searchIn)!==void 0:s.length>0:!1}}function fe(e,r,n){let d=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>U(t,r.archived)),c=d?u.filter(Q(n,d)):u,l=r.filter?.length?c.filter(t=>r.filter.every(f=>N(n,t,f))):[...c],a=[];for(let t=r.sort;t&&a.length<4;t=t.then)a.push(t);let s=a.length>0?l.map((t,f)=>({node:t,index:f,values:a.map(o=>de(n,t,o.by))})).sort((t,f)=>{for(let[o,p]of a.entries()){let[b,E]=[t.values[o],f.values[o]],C=se(b,E),M=p.direction==="desc"&&C!==0&&b!==void 0&&E!==void 0?-C:C;if(M!==0)return M}return t.index-f.index}).map(t=>t.node):l,i=r.group;if(!i)return{nodes:s,groups:[{key:"",label:"",nodes:s}],grouped:!1};let y=new Map,g=(t,f,o)=>{let p=y.get(t)??{label:f,nodes:[]};p.nodes.push(o),y.set(t,p)},O=s[0],m=O?n.schema.tryDefinition(O.kind):void 0,L=m?.fields.shape??{},ee=m?Y(m,i.by):j(i.by),$=i.by in L,h=$?_(L[i.by]):void 0,re=D(n.schema,O?.kind??"").find(t=>t.key===i.by)?.label,w=$?`No ${ee.toLowerCase()}`:`Without ${(re??j(i.by)).toLowerCase()}`,K=$?new Map:V([...new Map(s.flatMap(t=>S(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(k),t=>n.schema.tryDefinition(t));for(let t of s){if($){let o=F(q(t),i.by,n.today??T());if(o==null||o==="")g("",w,t);else if(h==="date"){let p=i.bucket??"day",b=Z(String(o),p);b?g(b,le(b,p),t):g("",w,t)}else if(h==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):h==="choice"?B(String(o)):String(o),t)}continue}let f=S(n.graph,t.id,i.by).map(o=>({id:o.id,label:K.has(o.id)?`${x(n,o)} \xB7 ${K.get(o.id)}`:x(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));f.length===0?g("",w,t):g(f.map(o=>o.id).join(","),f.map(o=>o.label).join(", "),t)}let v=h==="choice"?z(L[i.by]):void 0,te=[...y.entries()].sort(([t,f],[o,p])=>t===""?1:o===""?-1:v?v.indexOf(t)-v.indexOf(o):h==="boolean"?o.localeCompare(t):h==="date"?t.localeCompare(o):f.label.localeCompare(p.label)).map(([t,f])=>({key:t,label:f.label,nodes:f.nodes}));return{nodes:s,groups:te,grouped:!0}}function J(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function X(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function ce(e){let r=J(e?.sort),n=X(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var pe=(e,r)=>r?e==="1"?"true":"false":e;function ge(e,r,n){let d=n.type==="boolean",u=d?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(s=>u.includes(s)),...u])],l=r.closed??[],a=s=>{if(s.key==="")return[1,0];let i=pe(s.key,d);if(l.includes(i))return[2,l.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((s,i)=>({group:s,at:i,rank:a(s)})).sort((s,i)=>s.rank[0]-i.rank[0]||s.rank[1]-i.rank[1]||s.at-i.at).map(({group:s,rank:i})=>({...s,closed:i[0]===2}))}export{X as a,ce as b,ge as c,ne as d,oe as e,ie as f,ae as g,fe as h};
@@ -1 +1 @@
1
- import{pc as k}from"./chunk.ZEZUKRC6.js";function C(e){let o=e+1;return o*o-x(o).length}function x(e){if(e<3)return[];if(e%2===1){let s=(e-1)/2;return[[s,s]]}let o=e/2-1,t=e/2;return[[o,o],[t,o],[o,t],[t,t]]}function M(e){let o=2166136261;for(let t=0;t<e.length;t++)o=Math.imul(o^e.charCodeAt(t),16777619);return(o>>>0)%1e3/1e3}function O(e,o){let t=e.side+1,s=new Set(x(t).map(([r,d])=>`${r},${d}`)),a=e.side/t,l=[];for(let r=0;r<t;r++)for(let d=0;d<t;d++)s.has(`${d},${r}`)||l.push([d,r]);l.sort((r,d)=>r[0]+r[1]-(d[0]+d[1])||r[0]-d[0]);let i=o.slice(0,l.length);return{buildings:i.map((r,d)=>{let[m,y]=l[d];return{id:r,col:e.col+(m+.5)*a,row:e.row+(y+.5)*a,footprint:a*.62,height:.55+M(r)*.7}}),rest:Math.max(0,o.length-i.length)}}var S={done:.12,waiting:.55,active:1.05};function T(e,o,t=[]){let s=e.side,a=s/Math.max(1,o.length),l=Math.max(1,...o.map(n=>n.length)),i=a;for(let n=1;a/n>=s/8-1e-9&&(i=a/n,!(n*Math.floor(s/i+1e-9)>=l));n++);let c=Math.max(1,Math.floor(a/i+1e-9)),r=Math.max(1,Math.floor(s/i+1e-9)),d=s/r,m=[],y=[];return o.forEach((n,u)=>{let g=n.slice(0,c*r);if(g.forEach((j,b)=>{m.push({id:j,lane:u,col:e.col+(b%r+.5)*d,row:e.row+u*a+(Math.floor(b/r)+.5)*i,footprint:Math.min(d,i)*.66,height:t[u]??S.waiting})}),n.length<=g.length)return;let p=y[0],w=n.length-g.length;p?y[0]={...p,count:p.count+w,rows:p.rows+1}:y.push({lane:u,count:w,rows:1,col:e.col-.15,row:e.row+(u+.5)*a})}),m.sort((n,u)=>n.col+n.row-(u.col+u.row)||n.col-u.col),{blocks:m,rests:y}}var R=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),f=e=>typeof e=="string"?[e]:Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function $(e,o,t){let s=Object.entries(o??{});if(s.length===0)return[];let a=new Set(e.schema.kinds),l=new Map(t.map(c=>[c.name,c])),i=c=>{let r=l.get(c);return r?[...k(e.schema,r),...r.creates??[]]:[]};return s.map(([c,r])=>{let d=[],m=[];for(let n of r.when??[])d.push(...f(n.made),...f(n.changed));for(let n of r.steps??[]){let u=R(n.over)?f(n.over.kind):[],g=Array.isArray(n.from)?n.from.flatMap(p=>R(p)?f(p.kind):[]):[];d.push(...u,...f(n.reads),...g,...f(n.archive),...f(n.classify)),m.push(...[...f(n.act),...f(n.acts)].flatMap(i),...f(n.generate),...f(n.archive),...f(n.classify))}let y=n=>[...new Set(n)].filter(u=>a.has(u));return{name:c,title:r.title,status:r.status==="paused"?"paused":"active",reads:y(d),writes:y(m)}})}function v(e,o){let t=new Map,s=[];for(let a of e){let l=[...a.writes,...a.reads].find(r=>o.has(r));if(l===void 0)continue;let i=o.get(l),c=t.get(l)??0;t.set(l,c+1),s.push({name:a.name,beside:l,col:i.col+i.side+1,row:i.row+.5+c})}return s}var h=e=>typeof e=="number"?Number.isFinite(e)&&e>0?Math.floor(e):0:Array.isArray(e)?e.length:0;function A(e,o=Date.now()){let t=Math.floor((new Date(o).getTime()-new Date(e).getTime())/6e4);if(!Number.isFinite(t)||t<1)return"just now";if(t<60)return t===1?"a minute ago":`${t} minutes ago`;let s=Math.floor(t/60);if(s<24)return s===1?"an hour ago":`${s} hours ago`;let a=Math.floor(s/24);return a===1?"yesterday":`${a} days ago`}function D(e,o=Date.now()){if(!e)return"Has not run yet";let t=`Last ran ${A(e.finished,o)}`;if(e.outcome==="failed")return`${t} and failed`;if(e.outcome==="held")return`${t}: held back`;let a=[[h(e.made),e.dry?"would make":"made"],[h(e.changed),e.dry?"would change":"changed"],[h(e.archived),e.dry?"would set aside":"set aside"],[h(e.suggested),e.dry?"would suggest":"suggested"]].filter(([i])=>i>0).map(([i,c])=>`${c} ${i}`),l=a.length>0?a.join(", "):"nothing new";return`${t}${e.dry?", as a dry run":""}: ${l}${e.outcome==="partial"?" (part of it did not run)":""}`}export{C as a,M as b,O as c,S as d,T as e,$ as f,v as g,D as h};
1
+ import{pc as k}from"./chunk.6AANHELP.js";function C(e){let o=e+1;return o*o-x(o).length}function x(e){if(e<3)return[];if(e%2===1){let s=(e-1)/2;return[[s,s]]}let o=e/2-1,t=e/2;return[[o,o],[t,o],[o,t],[t,t]]}function M(e){let o=2166136261;for(let t=0;t<e.length;t++)o=Math.imul(o^e.charCodeAt(t),16777619);return(o>>>0)%1e3/1e3}function O(e,o){let t=e.side+1,s=new Set(x(t).map(([r,d])=>`${r},${d}`)),a=e.side/t,l=[];for(let r=0;r<t;r++)for(let d=0;d<t;d++)s.has(`${d},${r}`)||l.push([d,r]);l.sort((r,d)=>r[0]+r[1]-(d[0]+d[1])||r[0]-d[0]);let i=o.slice(0,l.length);return{buildings:i.map((r,d)=>{let[m,y]=l[d];return{id:r,col:e.col+(m+.5)*a,row:e.row+(y+.5)*a,footprint:a*.62,height:.55+M(r)*.7}}),rest:Math.max(0,o.length-i.length)}}var S={done:.12,waiting:.55,active:1.05};function T(e,o,t=[]){let s=e.side,a=s/Math.max(1,o.length),l=Math.max(1,...o.map(n=>n.length)),i=a;for(let n=1;a/n>=s/8-1e-9&&(i=a/n,!(n*Math.floor(s/i+1e-9)>=l));n++);let c=Math.max(1,Math.floor(a/i+1e-9)),r=Math.max(1,Math.floor(s/i+1e-9)),d=s/r,m=[],y=[];return o.forEach((n,u)=>{let g=n.slice(0,c*r);if(g.forEach((j,b)=>{m.push({id:j,lane:u,col:e.col+(b%r+.5)*d,row:e.row+u*a+(Math.floor(b/r)+.5)*i,footprint:Math.min(d,i)*.66,height:t[u]??S.waiting})}),n.length<=g.length)return;let p=y[0],w=n.length-g.length;p?y[0]={...p,count:p.count+w,rows:p.rows+1}:y.push({lane:u,count:w,rows:1,col:e.col-.15,row:e.row+(u+.5)*a})}),m.sort((n,u)=>n.col+n.row-(u.col+u.row)||n.col-u.col),{blocks:m,rests:y}}var R=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),f=e=>typeof e=="string"?[e]:Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function $(e,o,t){let s=Object.entries(o??{});if(s.length===0)return[];let a=new Set(e.schema.kinds),l=new Map(t.map(c=>[c.name,c])),i=c=>{let r=l.get(c);return r?[...k(e.schema,r),...r.creates??[]]:[]};return s.map(([c,r])=>{let d=[],m=[];for(let n of r.when??[])d.push(...f(n.made),...f(n.changed));for(let n of r.steps??[]){let u=R(n.over)?f(n.over.kind):[],g=Array.isArray(n.from)?n.from.flatMap(p=>R(p)?f(p.kind):[]):[];d.push(...u,...f(n.reads),...g,...f(n.archive),...f(n.classify)),m.push(...[...f(n.act),...f(n.acts)].flatMap(i),...f(n.generate),...f(n.archive),...f(n.classify))}let y=n=>[...new Set(n)].filter(u=>a.has(u));return{name:c,title:r.title,status:r.status==="paused"?"paused":"active",reads:y(d),writes:y(m)}})}function v(e,o){let t=new Map,s=[];for(let a of e){let l=[...a.writes,...a.reads].find(r=>o.has(r));if(l===void 0)continue;let i=o.get(l),c=t.get(l)??0;t.set(l,c+1),s.push({name:a.name,beside:l,col:i.col+i.side+1,row:i.row+.5+c})}return s}var h=e=>typeof e=="number"?Number.isFinite(e)&&e>0?Math.floor(e):0:Array.isArray(e)?e.length:0;function A(e,o=Date.now()){let t=Math.floor((new Date(o).getTime()-new Date(e).getTime())/6e4);if(!Number.isFinite(t)||t<1)return"just now";if(t<60)return t===1?"a minute ago":`${t} minutes ago`;let s=Math.floor(t/60);if(s<24)return s===1?"an hour ago":`${s} hours ago`;let a=Math.floor(s/24);return a===1?"yesterday":`${a} days ago`}function D(e,o=Date.now()){if(!e)return"Has not run yet";let t=`Last ran ${A(e.finished,o)}`;if(e.outcome==="failed")return`${t} and failed`;if(e.outcome==="held")return`${t}: held back`;let a=[[h(e.made),e.dry?"would make":"made"],[h(e.changed),e.dry?"would change":"changed"],[h(e.archived),e.dry?"would set aside":"set aside"],[h(e.suggested),e.dry?"would suggest":"suggested"]].filter(([i])=>i>0).map(([i,c])=>`${c} ${i}`),l=a.length>0?a.join(", "):"nothing new";return`${t}${e.dry?", as a dry run":""}: ${l}${e.outcome==="partial"?" (part of it did not run)":""}`}export{C as a,M as b,O as c,S as d,T as e,$ as f,v as g,D as h};
@@ -1,6 +1,6 @@
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{G as C,La as K,W as k}from"./chunk.A5PSEU3W.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
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{G as C,La as K,W as k}from"./chunk.3VEZ5MOC.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
2
2
  .graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
3
3
  [data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
4
4
  [data-graview-choose]{-webkit-touch-callout:none}
5
5
  [data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
6
- `;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.47XEJZ3O.js","./chunk.BKYZSV2Y.js","./chunk.MB7LKKUD.js","./chunk.6W6XMLSF.js","./chunk.PZ7KY6XH.js","./chunk.T27QKVKP.js","./chunk.LP2ZMAT2.js","./chunk.MSAYU25L.js","./chunk.EGPCVMDU.js","./chunk.H3EGBDW2.js","./chunk.DWM7AR5Y.js","./chunk.6KJGRM7A.js","./chunk.WALVW3KJ.js","./chunk.SNHKYH72.js","./chunk.UGQYMN4J.js","./chunk.RG5G6YQD.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7S6ZRMW4.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
6
+ `;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.O2VXTYUJ.js","./chunk.64LCHHZB.js","./chunk.MB7LKKUD.js","./chunk.E423JCOS.js","./chunk.O5FTWXA2.js","./chunk.6ZENHSTQ.js","./chunk.CNN32262.js","./chunk.N5Z34V7U.js","./chunk.LOKGUALC.js","./chunk.EP5JS7ZH.js","./chunk.L7XKYGV7.js","./chunk.CE3NKAF7.js","./chunk.R3GE37OI.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.32JE2WS7.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
@@ -1 +1 @@
1
- import{G as g,S as y,ea as m,oa as d}from"./chunk.A5PSEU3W.js";import{b as S}from"./chunk.AJZBJBMO.js";var v=S(g(),1);function k(){let{store:w,principal:a,ai:n,aiDesk:r,seatTalk:i,views:p,app:t,brand:l,view:A,selection:s}=m(),e=y(w,a),c=d(),o=A.within?.view;return(0,v.useMemo)(()=>({store:e,principal:a,ai:n,desk:r,seatTalk:i,goTo:c,places:[...p.places()],app:t??{name:l?.name??"app",schema:e.schema,...e.policy?{policy:e.policy}:{}},...o?{place:o}:{},selection:s}),[e,a,n,r,i,c,p,t,l,o,s])}export{k as a};
1
+ import{G as g,S as y,ea as m,oa as d}from"./chunk.3VEZ5MOC.js";import{b as S}from"./chunk.AJZBJBMO.js";var v=S(g(),1);function k(){let{store:w,principal:a,ai:n,aiDesk:r,seatTalk:i,views:p,app:t,brand:l,view:A,selection:s}=m(),e=y(w,a),c=d(),o=A.within?.view;return(0,v.useMemo)(()=>({store:e,principal:a,ai:n,desk:r,seatTalk:i,goTo:c,places:[...p.places()],app:t??{name:l?.name??"app",schema:e.schema,...e.policy?{policy:e.policy}:{}},...o?{place:o}:{},selection:s}),[e,a,n,r,i,c,p,t,l,o,s])}export{k as a};
@@ -1 +1 @@
1
- import{ia as V,ja as w}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Ud as u,Yd as h}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
1
+ import{ia as V,ja as w}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{Ud as u,Yd as h}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
@@ -1,4 +1,4 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as de,b as xe}from"./chunk.NKYWIGC7.js";import{b as pe,c as ce,d as ue}from"./chunk.6UQFV53C.js";import{a as ie,c as G,d as se,e as le}from"./chunk.T2OUHRAA.js";import"./chunk.GRFD42WM.js";import"./chunk.EP6Q32WT.js";import"./chunk.U5P23GO7.js";import"./chunk.HJUZMOW2.js";import"./chunk.NAXOXBOF.js";import"./chunk.6W6XMLSF.js";import"./chunk.PZ7KY6XH.js";import"./chunk.WEMUKZKH.js";import"./chunk.T27QKVKP.js";import"./chunk.EGPCVMDU.js";import"./chunk.MIE4TJRW.js";import"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{h as oe,m as _}from"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{F as te,G as D,La as B,Ua as re,W as P,X as ne,Ya as ae,c as Q,ea as A,x as ee}from"./chunk.A5PSEU3W.js";import{a as W}from"./chunk.SDO3U72B.js";import{Jb as Z,Yc as J,db as Y,eb as X,ga as V,la as q,pa as U}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as k}from"./chunk.AJZBJBMO.js";var ve=k(D(),1);function L(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var T=k(P(),1);function ge(){let{seats:e,principal:t,takeSeat:n}=A();return e.length<2?null:(0,T.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,T.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(r=>{let d=ke(t,r.principal);return(0,T.jsx)("button",{type:"button","aria-pressed":d,"data-testid":`seat-${r.principal.id??r.label}`,title:`Sit down as ${r.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>n(r.principal),style:{...L(d),whiteSpace:"nowrap"},children:r.label},r.principal.id??r.label)})]})}function ke(e,t){return e.kind===t.kind&&e.id===t.id}var R=k(D(),1),y=k(P(),1),Se=`
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 de,b as xe}from"./chunk.UAMPR4MD.js";import{b as pe,c as ce,d as ue}from"./chunk.IKKKHHRN.js";import{a as ie,c as G,d as se,e as le}from"./chunk.ODYJEDIW.js";import"./chunk.IPGLITWA.js";import"./chunk.LFFJB6D3.js";import"./chunk.U5P23GO7.js";import"./chunk.DCLF4WWZ.js";import"./chunk.XDZDNZ7B.js";import"./chunk.E423JCOS.js";import"./chunk.O5FTWXA2.js";import"./chunk.Q4VFLLUT.js";import"./chunk.6ZENHSTQ.js";import"./chunk.LOKGUALC.js";import"./chunk.MIE4TJRW.js";import"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import{h as oe,m as _}from"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{F as te,G as D,La as B,Ua as re,W as P,X as ne,Ya as ae,c as Q,ea as A,x as ee}from"./chunk.3VEZ5MOC.js";import{a as W}from"./chunk.SDO3U72B.js";import{Jb as Z,Yc as J,db as Y,eb as X,ga as V,la as q,pa as U}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as k}from"./chunk.AJZBJBMO.js";var ve=k(D(),1);function L(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var T=k(P(),1);function ge(){let{seats:e,principal:t,takeSeat:n}=A();return e.length<2?null:(0,T.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,T.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(r=>{let d=ke(t,r.principal);return(0,T.jsx)("button",{type:"button","aria-pressed":d,"data-testid":`seat-${r.principal.id??r.label}`,title:`Sit down as ${r.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>n(r.principal),style:{...L(d),whiteSpace:"nowrap"},children:r.label},r.principal.id??r.label)})]})}function ke(e,t){return e.kind===t.kind&&e.id===t.id}var R=k(D(),1),y=k(P(),1),Se=`
2
2
  .graview-here{display:flex;flex:none}
3
3
  .graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
4
4
  .graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
@@ -20,4 +20,4 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
20
20
  .graview-app-menu-group+.graview-app-menu-group{padding-top:4px;border-top:1px solid var(--graview-edge)}
21
21
  .graview-app-menu-choice{display:flex;gap:2px;margin:4px 8px 6px;padding:2px;border:1px solid var(--graview-edge);border-radius:8px}
22
22
  .graview-app-menu-choice button{flex:1 1 0;min-height:28px;margin:0;padding:0 8px;border:0;border-radius:6px;background:none;box-shadow:none;font:inherit;font-size:.8125rem;color:var(--graview-ink-muted);cursor:pointer}
23
- .graview-app-menu-choice button[aria-pressed=true]{background:color-mix(in srgb,var(--graview-accent) 16%,transparent);color:var(--graview-ink);font-weight:600}`,We={system:"System",light:"Light",dark:"Dark"};function De({faces:e,rows:t,scheme:n,close:r}){let d=n?.offers??["system","light","dark"];return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("style",{children:ze}),e?(0,l.jsx)("div",{role:"group","aria-label":`${e.scene.label} or ${e.pages.label}`,"data-testid":"app-faces",className:"graview-app-menu-group",children:["scene","pages"].map(i=>{let o=e[i];return(0,l.jsxs)("button",{type:"button",className:"graview-bar-item","data-testid":`app-face-${i}`,"aria-pressed":o.current,...o.reach&&!o.current?{onPointerEnter:o.reach,onPointerDown:o.reach,onFocus:o.reach}:{},onClick:()=>{r(),o.current||o.go()},children:[(0,l.jsx)("span",{className:"graview-bar-mark",children:i==="scene"?(0,l.jsx)(Ge,{}):(0,l.jsx)(Fe,{})}),(0,l.jsx)("span",{style:{flex:"1 1 auto"},children:o.label}),o.current?(0,l.jsx)("span",{className:"graview-bar-mark","aria-hidden":"true",children:(0,l.jsx)(je,{})}):null]},i)})}):null,t.length>0?(0,l.jsx)("ul",{"aria-label":"From the host","data-testid":"app-menu-rows",className:"graview-app-menu-group",children:t.map(i=>(0,l.jsx)("li",{children:(0,l.jsx)(Be,{row:i,close:r})},i.label))}):null,n?(0,l.jsxs)("div",{role:"group","aria-labelledby":"graview-app-menu-scheme","data-testid":"app-menu-scheme",className:"graview-app-menu-group",children:[(0,l.jsx)("p",{id:"graview-app-menu-scheme",children:"Appearance"}),(0,l.jsx)("div",{className:"graview-app-menu-choice",children:d.map(i=>(0,l.jsx)("button",{type:"button","data-testid":`app-menu-scheme-${i}`,"aria-pressed":n.value===i,onClick:()=>n.onChoose(i),children:We[i]},i))})]}):null]})}function Be({row:e,close:t}){let n=e.href!==void 0?"a":"button";return(0,l.jsxs)(n,{className:"graview-bar-item","data-testid":"app-menu-row",...e.href!==void 0?{href:e.href,...e.target?{target:e.target,rel:"noopener"}:{}}:{type:"button"},onClick:r=>{t(),e.onSelect?.()},children:[(0,l.jsx)("span",{className:"graview-bar-mark",children:e.icon?(0,l.jsx)(_e,{icon:e.icon}):null}),(0,l.jsx)("span",{children:e.label})]})}function _e({icon:e}){let t=oe(J(e)?e:void 0);return t?(0,l.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",dangerouslySetInnerHTML:t}):(0,l.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",children:e})}function j({children:e}){return(0,l.jsx)("svg",{width:14,height:14,viewBox:"0 0 14 14","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:e})}function Ge(){return(0,l.jsxs)(j,{children:[(0,l.jsx)("path",{d:"M7 1.5 L12.5 4.5 L7 7.5 L1.5 4.5 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),(0,l.jsx)("path",{d:"M1.5 7.5 L7 10.5 L12.5 7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",strokeLinecap:"round"})]})}function Fe(){return(0,l.jsxs)(j,{children:[(0,l.jsx)("rect",{x:"2.25",y:"1.75",width:"9.5",height:"10.5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,l.jsx)("path",{d:"M4.5 5 H9.5 M4.5 7.25 H9.5 M4.5 9.5 H7.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function je(){return(0,l.jsx)(j,{children:(0,l.jsx)("path",{d:"M3 7.25 L5.75 10 L11 4.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ke(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function H(e,t,n,r,d,i){let o=Ke(t),p=e.getBoundingClientRect(),b={...o,face:n?"scene":"pages",x:Math.round(d??p.left+Math.min(16,p.width/2)),y:Math.round(i??Math.min(p.bottom,p.top+36)),returnTo:e},u=n?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");u?u.dispatchEvent(new CustomEvent(ne,{detail:b})):r(b)}var O={on:null,at:0},fe=500,Ve=10;function qe(e,t,n,r,d,i,o){let p=t.getAttribute("data-testid")??"",b=p==="app-places-open"?r:p.slice(10),u=n.find(f=>f.key===b);if(!u)return;if(e.type==="keydown")return O={on:t,at:Date.now()},H(t,u,d,i);let{clientX:h,clientY:m}=e;if(e.type==="contextmenu")return O.on===t&&Date.now()-O.at<700?void 0:h===0&&m===0?H(t,u,d,i):H(t,u,d,i,h,m);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),x=!1,v=f=>{Math.hypot(f.clientX-h,f.clientY-m)>Ve&&(x=!0)};document.addEventListener("pointermove",v),setTimeout(()=>{document.removeEventListener("pointermove",v),!(x||o.at!==0&&o.at-S<fe)&&(O={on:t,at:Date.now()},t.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation()},{capture:!0,once:!0}),H(t,u,d,i,h,m))},Math.max(0,fe-(Date.now()-S)))}var a=k(P(),1),wt=B(W(()=>(__graviewPreload(import.meta.url,["./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F464JKHZ.js")))).part((e,t)=>(0,a.jsx)(e.TidyGroups,{...t}),{quiet:!0}),Ue=B(W(()=>(__graviewPreload(import.meta.url,["./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UQIPEMJ5.js")))).part((e,t)=>(0,a.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function xt({violations:e,pick:t}){let{store:n,brand:r,setMenuAt:d}=A(),i=ie(n,e);return(0,a.jsx)(a.Fragment,{children:i.map((o,p)=>{let b=le(o),u=o.repairs.length>0?`${o.repairs.length} ${o.repairs.length===1?"way":"ways"} to fix`:"";return(0,a.jsx)("li",{style:{borderTop:p===0?"none":"1px solid var(--graview-edge)"},children:(0,a.jsxs)("button",{type:"button",onClick:h=>{let m=h.currentTarget.closest("ol").getBoundingClientRect();t(o),d({x:m.left,y:m.top,on:o.subjectId})},...G(o)!==void 0?{title:G(o)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[o.line?(0,a.jsx)(se,{line:o.line,schema:n.schema,...r?{brand:r}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,a.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:o.message}),b||u?(0,a.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[b,u].filter(Boolean).join(" \xB7 ")}):null]})},`${o.invariant}:${p}`)})})}function kt({name:e,me:t,profileHref:n,hostActions:r,close:d,part:i,signature:o=!1}){let{principal:p,seats:b,settings:u,settingValues:h,chooseSetting:m,sharing:S,ai:x}=A(),v=p.roles??[],f={setOpen:c=>d()};return(0,a.jsx)(a.Fragment,{children:i==="top"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,a.jsx)("span",{style:z,children:"Signed in as"}),(0,a.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:v.length>0?v.map(c=>V(c)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&n!==void 0?(0,a.jsx)("a",{href:n(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,S?(0,a.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",S.name]}):null]}),r.length>0?(0,a.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...I,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:r.map(c=>(0,a.jsx)("li",{children:c.href!==void 0?(0,a.jsx)("a",{href:c.href,"data-testid":"host-action",className:"graview-host-action",...c.target?{target:c.target,rel:"noopener"}:{},onClick:()=>{c.onSelect?.(),f.setOpen(!1)},style:be,children:c.label}):(0,a.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{f.setOpen(!1),c.onSelect?.()},style:{...be,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:c.label})},c.label))}):null]}):(0,a.jsxs)(a.Fragment,{children:[b.length>1?(0,a.jsxs)("div",{style:{display:"grid",gap:6,...I},children:[(0,a.jsx)("span",{style:z,children:"Sit as somebody else"}),(0,a.jsx)(ge,{})]}):null,u.length>0?(0,a.jsx)("div",{style:{display:"grid",gap:10,...I},children:u.map(c=>(0,a.jsxs)("fieldset",{"data-testid":`setting-${c.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,a.jsx)("legend",{style:{...z,padding:0},children:c.title}),c.description?(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:c.description}):null,(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:c.options.map(M=>{let w=(h[c.name]??c.initial)===M.value;return(0,a.jsx)("button",{type:"button","aria-pressed":w,"data-testid":`setting-${c.name}-${M.value}`,onClick:()=>m(c.name,M.value),style:L(w),children:M.label},M.value)})})]},c.name))}):null,te(x)?(0,a.jsx)(ve.Suspense,{fallback:null,children:(0,a.jsx)(Ue,{legend:z,style:I,choice:L})}):null,o?(0,a.jsxs)("p",{"data-testid":"graview-signature",style:{...I,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,a.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,a.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:Ye}}),"Graview"]})]}):null]})})}var Ye='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',be={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},z={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},I={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{De as AppMenuPane,Le as Here,xe as Inbox,Re as InboxPane,xt as ProblemRows,kt as ProfilePane,wt as TidyFoot,qe as placeGesture,Ee as sayTheirChange};
23
+ .graview-app-menu-choice button[aria-pressed=true]{background:color-mix(in srgb,var(--graview-accent) 16%,transparent);color:var(--graview-ink);font-weight:600}`,We={system:"System",light:"Light",dark:"Dark"};function De({faces:e,rows:t,scheme:n,close:r}){let d=n?.offers??["system","light","dark"];return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("style",{children:ze}),e?(0,l.jsx)("div",{role:"group","aria-label":`${e.scene.label} or ${e.pages.label}`,"data-testid":"app-faces",className:"graview-app-menu-group",children:["scene","pages"].map(i=>{let o=e[i];return(0,l.jsxs)("button",{type:"button",className:"graview-bar-item","data-testid":`app-face-${i}`,"aria-pressed":o.current,...o.reach&&!o.current?{onPointerEnter:o.reach,onPointerDown:o.reach,onFocus:o.reach}:{},onClick:()=>{r(),o.current||o.go()},children:[(0,l.jsx)("span",{className:"graview-bar-mark",children:i==="scene"?(0,l.jsx)(Ge,{}):(0,l.jsx)(Fe,{})}),(0,l.jsx)("span",{style:{flex:"1 1 auto"},children:o.label}),o.current?(0,l.jsx)("span",{className:"graview-bar-mark","aria-hidden":"true",children:(0,l.jsx)(je,{})}):null]},i)})}):null,t.length>0?(0,l.jsx)("ul",{"aria-label":"From the host","data-testid":"app-menu-rows",className:"graview-app-menu-group",children:t.map(i=>(0,l.jsx)("li",{children:(0,l.jsx)(Be,{row:i,close:r})},i.label))}):null,n?(0,l.jsxs)("div",{role:"group","aria-labelledby":"graview-app-menu-scheme","data-testid":"app-menu-scheme",className:"graview-app-menu-group",children:[(0,l.jsx)("p",{id:"graview-app-menu-scheme",children:"Appearance"}),(0,l.jsx)("div",{className:"graview-app-menu-choice",children:d.map(i=>(0,l.jsx)("button",{type:"button","data-testid":`app-menu-scheme-${i}`,"aria-pressed":n.value===i,onClick:()=>n.onChoose(i),children:We[i]},i))})]}):null]})}function Be({row:e,close:t}){let n=e.href!==void 0?"a":"button";return(0,l.jsxs)(n,{className:"graview-bar-item","data-testid":"app-menu-row",...e.href!==void 0?{href:e.href,...e.target?{target:e.target,rel:"noopener"}:{}}:{type:"button"},onClick:r=>{t(),e.onSelect?.()},children:[(0,l.jsx)("span",{className:"graview-bar-mark",children:e.icon?(0,l.jsx)(_e,{icon:e.icon}):null}),(0,l.jsx)("span",{children:e.label})]})}function _e({icon:e}){let t=oe(J(e)?e:void 0);return t?(0,l.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",dangerouslySetInnerHTML:t}):(0,l.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",children:e})}function j({children:e}){return(0,l.jsx)("svg",{width:14,height:14,viewBox:"0 0 14 14","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:e})}function Ge(){return(0,l.jsxs)(j,{children:[(0,l.jsx)("path",{d:"M7 1.5 L12.5 4.5 L7 7.5 L1.5 4.5 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),(0,l.jsx)("path",{d:"M1.5 7.5 L7 10.5 L12.5 7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",strokeLinecap:"round"})]})}function Fe(){return(0,l.jsxs)(j,{children:[(0,l.jsx)("rect",{x:"2.25",y:"1.75",width:"9.5",height:"10.5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,l.jsx)("path",{d:"M4.5 5 H9.5 M4.5 7.25 H9.5 M4.5 9.5 H7.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function je(){return(0,l.jsx)(j,{children:(0,l.jsx)("path",{d:"M3 7.25 L5.75 10 L11 4.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Ke(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function H(e,t,n,r,d,i){let o=Ke(t),p=e.getBoundingClientRect(),b={...o,face:n?"scene":"pages",x:Math.round(d??p.left+Math.min(16,p.width/2)),y:Math.round(i??Math.min(p.bottom,p.top+36)),returnTo:e},u=n?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");u?u.dispatchEvent(new CustomEvent(ne,{detail:b})):r(b)}var O={on:null,at:0},fe=500,Ve=10;function qe(e,t,n,r,d,i,o){let p=t.getAttribute("data-testid")??"",b=p==="app-places-open"?r:p.slice(10),u=n.find(f=>f.key===b);if(!u)return;if(e.type==="keydown")return O={on:t,at:Date.now()},H(t,u,d,i);let{clientX:h,clientY:m}=e;if(e.type==="contextmenu")return O.on===t&&Date.now()-O.at<700?void 0:h===0&&m===0?H(t,u,d,i):H(t,u,d,i,h,m);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),x=!1,v=f=>{Math.hypot(f.clientX-h,f.clientY-m)>Ve&&(x=!0)};document.addEventListener("pointermove",v),setTimeout(()=>{document.removeEventListener("pointermove",v),!(x||o.at!==0&&o.at-S<fe)&&(O={on:t,at:Date.now()},t.addEventListener("click",f=>{f.preventDefault(),f.stopPropagation()},{capture:!0,once:!0}),H(t,u,d,i,h,m))},Math.max(0,fe-(Date.now()-S)))}var a=k(P(),1),wt=B(W(()=>(__graviewPreload(import.meta.url,["./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FSW535EA.js")))).part((e,t)=>(0,a.jsx)(e.TidyGroups,{...t}),{quiet:!0}),Ue=B(W(()=>(__graviewPreload(import.meta.url,["./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UFURYU4R.js")))).part((e,t)=>(0,a.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function xt({violations:e,pick:t}){let{store:n,brand:r,setMenuAt:d}=A(),i=ie(n,e);return(0,a.jsx)(a.Fragment,{children:i.map((o,p)=>{let b=le(o),u=o.repairs.length>0?`${o.repairs.length} ${o.repairs.length===1?"way":"ways"} to fix`:"";return(0,a.jsx)("li",{style:{borderTop:p===0?"none":"1px solid var(--graview-edge)"},children:(0,a.jsxs)("button",{type:"button",onClick:h=>{let m=h.currentTarget.closest("ol").getBoundingClientRect();t(o),d({x:m.left,y:m.top,on:o.subjectId})},...G(o)!==void 0?{title:G(o)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[o.line?(0,a.jsx)(se,{line:o.line,schema:n.schema,...r?{brand:r}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,a.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:o.message}),b||u?(0,a.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[b,u].filter(Boolean).join(" \xB7 ")}):null]})},`${o.invariant}:${p}`)})})}function kt({name:e,me:t,profileHref:n,hostActions:r,close:d,part:i,signature:o=!1}){let{principal:p,seats:b,settings:u,settingValues:h,chooseSetting:m,sharing:S,ai:x}=A(),v=p.roles??[],f={setOpen:c=>d()};return(0,a.jsx)(a.Fragment,{children:i==="top"?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,a.jsx)("span",{style:z,children:"Signed in as"}),(0,a.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:v.length>0?v.map(c=>V(c)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&n!==void 0?(0,a.jsx)("a",{href:n(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,S?(0,a.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",S.name]}):null]}),r.length>0?(0,a.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...I,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:r.map(c=>(0,a.jsx)("li",{children:c.href!==void 0?(0,a.jsx)("a",{href:c.href,"data-testid":"host-action",className:"graview-host-action",...c.target?{target:c.target,rel:"noopener"}:{},onClick:()=>{c.onSelect?.(),f.setOpen(!1)},style:be,children:c.label}):(0,a.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{f.setOpen(!1),c.onSelect?.()},style:{...be,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:c.label})},c.label))}):null]}):(0,a.jsxs)(a.Fragment,{children:[b.length>1?(0,a.jsxs)("div",{style:{display:"grid",gap:6,...I},children:[(0,a.jsx)("span",{style:z,children:"Sit as somebody else"}),(0,a.jsx)(ge,{})]}):null,u.length>0?(0,a.jsx)("div",{style:{display:"grid",gap:10,...I},children:u.map(c=>(0,a.jsxs)("fieldset",{"data-testid":`setting-${c.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,a.jsx)("legend",{style:{...z,padding:0},children:c.title}),c.description?(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:c.description}):null,(0,a.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:c.options.map(M=>{let w=(h[c.name]??c.initial)===M.value;return(0,a.jsx)("button",{type:"button","aria-pressed":w,"data-testid":`setting-${c.name}-${M.value}`,onClick:()=>m(c.name,M.value),style:L(w),children:M.label},M.value)})})]},c.name))}):null,te(x)?(0,a.jsx)(ve.Suspense,{fallback:null,children:(0,a.jsx)(Ue,{legend:z,style:I,choice:L})}):null,o?(0,a.jsxs)("p",{"data-testid":"graview-signature",style:{...I,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,a.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,a.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:Ye}}),"Graview"]})]}):null]})})}var Ye='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',be={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},z={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},I={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{De as AppMenuPane,Le as Here,xe as Inbox,Re as InboxPane,xt as ProblemRows,kt as ProfilePane,wt as TidyFoot,qe as placeGesture,Ee as sayTheirChange};