graview 0.1.63 → 0.1.64

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 (179) hide show
  1. package/dist/preview/chunk.2D7K2IJQ.js +4 -0
  2. package/dist/preview/{chunk.GHN62OMG.js → chunk.2DH42I7L.js} +1 -1
  3. package/dist/preview/chunk.2E62YCMZ.js +1 -0
  4. package/dist/preview/{chunk.DIFIHNR3.js → chunk.2G5WLG3Z.js} +1 -1
  5. package/dist/preview/chunk.2HV5FF6O.js +1 -0
  6. package/dist/preview/{chunk.6Z2GHQQH.js → chunk.2JDAUKSN.js} +3 -3
  7. package/dist/preview/{chunk.DZSZUX34.js → chunk.2JEN2RCB.js} +1 -1
  8. package/dist/preview/{chunk.NEPQBMFT.js → chunk.2TCOLAL2.js} +1 -1
  9. package/dist/preview/{chunk.VZDHRY3U.js → chunk.2V7QTIAV.js} +1 -1
  10. package/dist/preview/{chunk.T3JIZNE7.js → chunk.2VIS2NAT.js} +1 -1
  11. package/dist/preview/{chunk.2PJ6STKA.js → chunk.2VYGDY5Z.js} +1 -1
  12. package/dist/preview/{chunk.5QXQ7PBI.js → chunk.37I45R6V.js} +1 -1
  13. package/dist/preview/chunk.3FKKH2XU.js +74 -0
  14. package/dist/preview/chunk.3J7XLJP2.js +1 -0
  15. package/dist/preview/chunk.3OEODIHB.js +1 -0
  16. package/dist/preview/{chunk.R4HDKNT3.js → chunk.3RD4JHVG.js} +1 -1
  17. package/dist/preview/{chunk.XCEZCOX4.js → chunk.3RUV4HE4.js} +1 -1
  18. package/dist/preview/{chunk.WUVXIUA7.js → chunk.3SAESG6X.js} +1 -1
  19. package/dist/preview/{chunk.OIMGD7FR.js → chunk.47N2G7A5.js} +1 -1
  20. package/dist/preview/{chunk.B5PJCYBU.js → chunk.4DZOAB4D.js} +1 -1
  21. package/dist/preview/chunk.4HTB6TX2.js +1 -0
  22. package/dist/preview/{chunk.EJ2WE764.js → chunk.4Q5PCMGZ.js} +4 -4
  23. package/dist/preview/{chunk.2F4AZZQR.js → chunk.4U45EY5M.js} +1 -1
  24. package/dist/preview/{chunk.PDMX3GTL.js → chunk.4VRX7FCO.js} +1 -1
  25. package/dist/preview/{chunk.HRNNRA2I.js → chunk.4XCYZRZ3.js} +1 -1
  26. package/dist/preview/chunk.52MBXPEK.js +1 -0
  27. package/dist/preview/{chunk.D5LOTCBU.js → chunk.5AD2QHWH.js} +1 -1
  28. package/dist/preview/{chunk.36OE6RKG.js → chunk.5B7NG6WH.js} +1 -1
  29. package/dist/preview/chunk.5HJ2GTKZ.js +1 -0
  30. package/dist/preview/{chunk.2KIWGQXC.js → chunk.5IEZF433.js} +1 -1
  31. package/dist/preview/{chunk.UAVK54Z6.js → chunk.5PPCK7QT.js} +1 -1
  32. package/dist/preview/{chunk.SSAETRHR.js → chunk.6NRWLCIZ.js} +2 -2
  33. package/dist/preview/{chunk.REUMBCSV.js → chunk.75JQCTR6.js} +1 -1
  34. package/dist/preview/{chunk.A2R53GWF.js → chunk.77JI5T4F.js} +1 -1
  35. package/dist/preview/{chunk.BQM3YAMR.js → chunk.77MLXWZV.js} +1 -1
  36. package/dist/preview/{chunk.33XNYHI6.js → chunk.7AOEZJRM.js} +1 -1
  37. package/dist/preview/{chunk.4EXC26LI.js → chunk.7CLKGKSF.js} +1 -1
  38. package/dist/preview/{chunk.NTC2H5ZX.js → chunk.7SRSE5IS.js} +1 -1
  39. package/dist/preview/{chunk.SMHP2CQH.js → chunk.7VAHHEDX.js} +1 -1
  40. package/dist/preview/{chunk.4MEQUUG4.js → chunk.7ZG77OI3.js} +1 -1
  41. package/dist/preview/chunk.7ZHH7WBN.js +1 -0
  42. package/dist/preview/{chunk.ZY7US4Y7.js → chunk.AJEK3I5X.js} +1 -1
  43. package/dist/preview/{chunk.T535ZLRM.js → chunk.APRWUIE3.js} +1 -1
  44. package/dist/preview/{chunk.KXFNRJ46.js → chunk.APUQIELA.js} +1 -1
  45. package/dist/preview/{chunk.OXWOUE3W.js → chunk.ATHLE33D.js} +1 -1
  46. package/dist/preview/chunk.B2YTHEX5.js +1 -0
  47. package/dist/preview/{chunk.KB5BCW23.js → chunk.B6JR7EQO.js} +1 -1
  48. package/dist/preview/{chunk.H5SN46VK.js → chunk.BN42H3C6.js} +1 -1
  49. package/dist/preview/{chunk.OM2NIQWA.js → chunk.BVIJXL4J.js} +1 -1
  50. package/dist/preview/{chunk.N3T2O6EW.js → chunk.CC7P435K.js} +2 -2
  51. package/dist/preview/{chunk.XBYJCGPU.js → chunk.CJHYGRWV.js} +1 -1
  52. package/dist/preview/chunk.CM65MCHA.js +1 -0
  53. package/dist/preview/{chunk.STDJ6XG5.js → chunk.D2XLECMP.js} +1 -1
  54. package/dist/preview/{chunk.72YXFJKC.js → chunk.DJIF7IAQ.js} +1 -1
  55. package/dist/preview/{chunk.CGK2PY76.js → chunk.DLWFULWE.js} +1 -1
  56. package/dist/preview/{chunk.MT5DXJKN.js → chunk.DMENNIHT.js} +1 -1
  57. package/dist/preview/{chunk.Q4GJIJAU.js → chunk.DN7UCBOA.js} +1 -1
  58. package/dist/preview/{chunk.EJ4MSVX2.js → chunk.DQAMVVE6.js} +1 -1
  59. package/dist/preview/{chunk.75GENXGP.js → chunk.DUP2CGVH.js} +1 -1
  60. package/dist/preview/{chunk.6XHPBJ5F.js → chunk.DYRULRFX.js} +1 -1
  61. package/dist/preview/{chunk.MY5HJW2Z.js → chunk.E4TXLT25.js} +1 -1
  62. package/dist/preview/{chunk.BN7C5ZYX.js → chunk.F6BNFLQM.js} +1 -1
  63. package/dist/preview/chunk.FN34P4IS.js +1 -0
  64. package/dist/preview/{chunk.MBB5A6BT.js → chunk.FUPYIOXZ.js} +1 -1
  65. package/dist/preview/{chunk.HSMJHCR3.js → chunk.FXRYMT3U.js} +1 -1
  66. package/dist/preview/{chunk.CI4RZL4Z.js → chunk.G5BVZLCM.js} +1 -1
  67. package/dist/preview/{chunk.4TH3CGAZ.js → chunk.G7YLK4PX.js} +1 -1
  68. package/dist/preview/chunk.GF62K25C.js +1 -0
  69. package/dist/preview/chunk.GFQPO3NC.js +1 -0
  70. package/dist/preview/{chunk.YOUB3J3Y.js → chunk.GH5UBSQI.js} +1 -1
  71. package/dist/preview/{chunk.DBFJVVWF.js → chunk.GHHKRFPD.js} +1 -1
  72. package/dist/preview/{chunk.24HNOLUS.js → chunk.GP5DAA4P.js} +1 -1
  73. package/dist/preview/{chunk.DWK3GXRR.js → chunk.HPG6CNKM.js} +1 -1
  74. package/dist/preview/chunk.HSJEOM3W.js +1 -0
  75. package/dist/preview/{chunk.JVDPRQ7J.js → chunk.HZPRMHSL.js} +1 -1
  76. package/dist/preview/{chunk.Q4MI53KK.js → chunk.IQGSEAQ2.js} +5 -5
  77. package/dist/preview/{chunk.JIEDJEHK.js → chunk.ITBG37WJ.js} +1 -1
  78. package/dist/preview/{chunk.HOFATBGD.js → chunk.JHUCKEJS.js} +1 -1
  79. package/dist/preview/{chunk.Y4ZM75WL.js → chunk.JOM6MFVE.js} +1 -1
  80. package/dist/preview/{chunk.ZSGDVNVN.js → chunk.JS2UZYGB.js} +1 -1
  81. package/dist/preview/{chunk.DDFRFSVN.js → chunk.K2PXP5H6.js} +1 -1
  82. package/dist/preview/{chunk.KL5H7KEV.js → chunk.K54ISAXN.js} +1 -1
  83. package/dist/preview/{chunk.YXAKHXYB.js → chunk.K5YFUMRS.js} +1 -1
  84. package/dist/preview/chunk.KHXRJLLU.js +50 -0
  85. package/dist/preview/{chunk.E3XJMO7Q.js → chunk.KMIFSPGQ.js} +1 -1
  86. package/dist/preview/chunk.L4V5VLSM.js +1 -0
  87. package/dist/preview/{chunk.VCTAFSZ5.js → chunk.LDMBJC3B.js} +1 -1
  88. package/dist/preview/{chunk.MIE3ODQ2.js → chunk.LTOQ22ZJ.js} +1 -1
  89. package/dist/preview/{chunk.CCQMDZHO.js → chunk.M5VHUIDB.js} +1 -1
  90. package/dist/preview/chunk.N643PVQA.js +1 -0
  91. package/dist/preview/{chunk.XUO67YMT.js → chunk.NGRL3QOI.js} +1 -1
  92. package/dist/preview/{chunk.ZELWW7UA.js → chunk.NRPBTV6O.js} +2 -2
  93. package/dist/preview/{chunk.ZLTHWCKL.js → chunk.O7HHNQK4.js} +2 -2
  94. package/dist/preview/{chunk.SGPXYDSG.js → chunk.OW3M4OBN.js} +1 -1
  95. package/dist/preview/{chunk.KQPKYWDM.js → chunk.OXFDB5BB.js} +1 -1
  96. package/dist/preview/{chunk.ZZAI57VI.js → chunk.P4TAX3HE.js} +1 -1
  97. package/dist/preview/{chunk.XUXZW7DU.js → chunk.P6FNJR6E.js} +1 -1
  98. package/dist/preview/{chunk.25CQCCLN.js → chunk.PR74PGLC.js} +1 -1
  99. package/dist/preview/{chunk.AW26EETU.js → chunk.PVDDSBRG.js} +1 -1
  100. package/dist/preview/{chunk.SME4HD5I.js → chunk.QROPDEJF.js} +1 -1
  101. package/dist/preview/{chunk.AWUO3M5D.js → chunk.QRT6BZR6.js} +1 -1
  102. package/dist/preview/{chunk.AHPYNDVA.js → chunk.R5MLRKAO.js} +1 -1
  103. package/dist/preview/{chunk.NWWJNNEK.js → chunk.RDA35HZB.js} +1 -1
  104. package/dist/preview/{chunk.FXCQJPN4.js → chunk.REXU6ARY.js} +1 -1
  105. package/dist/preview/{chunk.OMRQTLI5.js → chunk.S6QZBWCJ.js} +1 -1
  106. package/dist/preview/{chunk.RUFYORIJ.js → chunk.S7SHWDPR.js} +1 -1
  107. package/dist/preview/{chunk.QAMW5QDT.js → chunk.SADHOSRC.js} +1 -1
  108. package/dist/preview/chunk.SJHUC4TL.js +1 -0
  109. package/dist/preview/chunk.SL5FXE3R.js +1 -0
  110. package/dist/preview/{chunk.WBS7ND2C.js → chunk.T4JP6BGP.js} +1 -1
  111. package/dist/preview/{chunk.34DRUCH2.js → chunk.T4TRJDBF.js} +1 -1
  112. package/dist/preview/{chunk.QS32TO4N.js → chunk.TA2JTUNX.js} +1 -1
  113. package/dist/preview/{chunk.PWAP2GJS.js → chunk.TMHVYI5R.js} +1 -1
  114. package/dist/preview/chunk.TOLW64EO.js +1 -0
  115. package/dist/preview/chunk.TP3PZRHE.js +1 -0
  116. package/dist/preview/{chunk.57YDGGJK.js → chunk.TQ2G4AM4.js} +1 -1
  117. package/dist/preview/{chunk.O3YIWIVQ.js → chunk.TUR2DA2M.js} +1 -1
  118. package/dist/preview/{chunk.CAXILB7K.js → chunk.TYIBLD2D.js} +1 -1
  119. package/dist/preview/{chunk.FFXBDOKA.js → chunk.UD2GGG7L.js} +1 -1
  120. package/dist/preview/{chunk.Q2EGESEZ.js → chunk.UDU545CL.js} +1 -1
  121. package/dist/preview/{chunk.IEDCFSN5.js → chunk.UDYFGYJP.js} +1 -1
  122. package/dist/preview/{chunk.K7TK3KRB.js → chunk.UJNLT3L6.js} +1 -1
  123. package/dist/preview/chunk.UN2IAA5R.js +1 -0
  124. package/dist/preview/chunk.VLX7YWVH.js +25 -0
  125. package/dist/preview/{chunk.735AFUP5.js → chunk.VT4YBFZL.js} +1 -1
  126. package/dist/preview/{chunk.2RASWDMQ.js → chunk.VZAF3452.js} +2 -2
  127. package/dist/preview/{chunk.OTSBF367.js → chunk.WFCE7NLK.js} +2 -2
  128. package/dist/preview/{chunk.XCWZFLIB.js → chunk.WHX47OJM.js} +1 -1
  129. package/dist/preview/{chunk.ZRH5X3MR.js → chunk.WMARJ5E3.js} +1 -1
  130. package/dist/preview/chunk.WPQP54FM.js +1 -0
  131. package/dist/preview/{chunk.HMMK7LCL.js → chunk.WX23K7ZU.js} +1 -1
  132. package/dist/preview/{chunk.H7AH3IW4.js → chunk.X36BYTEG.js} +1 -1
  133. package/dist/preview/{chunk.B46UZHGW.js → chunk.XCLW4GP7.js} +1 -1
  134. package/dist/preview/{chunk.JO3BBRSR.js → chunk.XEG7ZDRG.js} +1 -1
  135. package/dist/preview/{chunk.KPQLM4TM.js → chunk.XIVELWAM.js} +1 -1
  136. package/dist/preview/{chunk.PDS4HT46.js → chunk.XJWKIXPV.js} +1 -1
  137. package/dist/preview/{chunk.5GC4VAHU.js → chunk.XQ5RTPEF.js} +1 -1
  138. package/dist/preview/{chunk.NIAM7OTV.js → chunk.YEXFVDRA.js} +1 -1
  139. package/dist/preview/{chunk.FGDGTES4.js → chunk.YIZPW7IK.js} +2 -2
  140. package/dist/preview/chunk.YLOGIJOH.js +1 -0
  141. package/dist/preview/chunk.YMXWS4XN.js +3 -0
  142. package/dist/preview/{chunk.WYPCLZL7.js → chunk.YSBTE3PX.js} +1 -1
  143. package/dist/preview/{chunk.V4HVFLFQ.js → chunk.Z26T5E76.js} +1 -1
  144. package/dist/preview/{chunk.37FLKAVZ.js → chunk.Z4XGEV34.js} +1 -1
  145. package/dist/preview/{chunk.XYGNS637.js → chunk.ZA5TDCBC.js} +1 -1
  146. package/dist/preview/{chunk.3OQ6S6H4.js → chunk.ZNDVJGTY.js} +1 -1
  147. package/dist/preview/{chunk.YZBJUAS6.js → chunk.ZQGLPP7A.js} +1 -1
  148. package/dist/preview/index.html +53 -53
  149. package/dist/preview/page.js +2 -2
  150. package/dist/preview/splash.js +3 -3
  151. package/package.json +6 -6
  152. package/dist/preview/chunk.26H33GJC.js +0 -50
  153. package/dist/preview/chunk.3JCHJLH6.js +0 -1
  154. package/dist/preview/chunk.47QEWSSE.js +0 -1
  155. package/dist/preview/chunk.4DAKQXDG.js +0 -1
  156. package/dist/preview/chunk.6CSHRMJC.js +0 -1
  157. package/dist/preview/chunk.6HKWAHPT.js +0 -1
  158. package/dist/preview/chunk.6YK5E7ZQ.js +0 -4
  159. package/dist/preview/chunk.ATDIDPKZ.js +0 -1
  160. package/dist/preview/chunk.BF3EZCG3.js +0 -1
  161. package/dist/preview/chunk.BKQICGFW.js +0 -1
  162. package/dist/preview/chunk.C65EHQ7V.js +0 -1
  163. package/dist/preview/chunk.CYTTZOYL.js +0 -25
  164. package/dist/preview/chunk.ERPILTRY.js +0 -1
  165. package/dist/preview/chunk.FNVGNISQ.js +0 -3
  166. package/dist/preview/chunk.G2JAYG2Z.js +0 -1
  167. package/dist/preview/chunk.JNIDS66Z.js +0 -1
  168. package/dist/preview/chunk.KZUMXT5J.js +0 -74
  169. package/dist/preview/chunk.MAHNJO6U.js +0 -1
  170. package/dist/preview/chunk.MENLUNM5.js +0 -1
  171. package/dist/preview/chunk.O67JXUVG.js +0 -1
  172. package/dist/preview/chunk.QSPLKCTX.js +0 -1
  173. package/dist/preview/chunk.SJUXFPTI.js +0 -1
  174. package/dist/preview/chunk.V6IL7CIZ.js +0 -1
  175. package/dist/preview/chunk.WNS5LEO5.js +0 -1
  176. package/dist/preview/chunk.XIW4SZHD.js +0 -1
  177. package/dist/preview/chunk.Z2ZQJ3DD.js +0 -1
  178. package/dist/preview/chunk.ZP7JEVVU.js +0 -1
  179. package/dist/preview/chunk.ZVG4FXJK.js +0 -1
@@ -1 +1 @@
1
- import{a as O,b}from"./chunk.36OE6RKG.js";import"./chunk.IEDCFSN5.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as z,T as M,ba as S}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{yd as A}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function $({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[C,x]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='activity-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){x(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),x(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),C?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:C}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function j({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='activity-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{j as NotifiedList,$ as NotifySheet};
1
+ import{a as O,b}from"./chunk.5B7NG6WH.js";import"./chunk.UDYFGYJP.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as z,V as M,da as S}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{Ad as A}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function $({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[C,x]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='activity-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){x(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),x(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),C?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:C}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function j({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='activity-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{j as NotifiedList,$ as NotifySheet};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f}from"./chunk.XCLW4GP7.js";import"./chunk.BIDL7GQD.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.2E62YCMZ.js";import"./chunk.DUP2CGVH.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as PROPOSE_CHANGE,b as documentOfApp,f as proposeReshape,d as readReshape,e as reshapeCard,c as reshapeQuestions};
@@ -1,4 +1,4 @@
1
- import{d as z,e as D,f as H}from"./chunk.DBFJVVWF.js";import"./chunk.SSAETRHR.js";import{a as P,b as A,c as p,d as W}from"./chunk.Q355UPFG.js";import"./chunk.YZBJUAS6.js";import"./chunk.2RASWDMQ.js";import"./chunk.XCWZFLIB.js";import"./chunk.AWUO3M5D.js";import"./chunk.VZDHRY3U.js";import"./chunk.V4HVFLFQ.js";import"./chunk.A2R53GWF.js";import"./chunk.QAMW5QDT.js";import"./chunk.B5PJCYBU.js";import"./chunk.Q2EGESEZ.js";import"./chunk.SMHP2CQH.js";import"./chunk.ZZAI57VI.js";import"./chunk.34DRUCH2.js";import"./chunk.NEPQBMFT.js";import"./chunk.2PJ6STKA.js";import"./chunk.MBB5A6BT.js";import"./chunk.T535ZLRM.js";import"./chunk.ERPILTRY.js";import"./chunk.OTSBF367.js";import{a as C,b as O}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.GZHZLJBF.js";import"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{G as B,Sa as k,T as L}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{qd as R}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as E}from"./chunk.AJZBJBMO.js";var r=E(B(),1);var s=E(L(),1);function M(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let n=c??document,o=n.querySelector("main")??n.querySelector("[data-graview-page]")??null,t=n.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??o;t instanceof HTMLElement&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}var I=1500;function N(c,e,n){let{store:o,principal:t}=c,l=z(o),g=(0,r.useMemo)(()=>P(o,t),[o,t,l]),w=(0,r.useRef)(n),[b,d]=(0,r.useState)(),[y,u]=(0,r.useState)("");(0,r.useEffect)(()=>{let a=A(o,t,w.current);w.current=o.batches().length,a&&(d({batch:a.batch,at:e,when:Date.now()}),u(""))},[o,t,l]),(0,r.useEffect)(()=>{d(a=>!a||a.at===e?a:Date.now()-a.when<I?{...a,at:e}:void 0)},[e]);let[x,i]=(0,r.useState)(null),v=(0,r.useCallback)(()=>{d(void 0),i(null)},[]),f=(0,r.useCallback)(()=>{i(null);try{let a=W(o,t);a&&u(`Took back \u201C${a.intent}\u201D`)}catch(a){i(a instanceof Error?a.message:String(a))}},[o,t]),S=g&&b?.batch===g.batch&&b.at===e?g:void 0;return{change:g,offered:S,close:v,takeBack:f,refused:x,said:y}}function ee({context:c,docked:e,at:n,since:o,compact:t=!1,className:l,size:g}){let{change:w,offered:b,close:d,takeBack:y,refused:u,said:x}=N(c,n,o),i=e?b:w,v=(0,r.useRef)(null),f=e&&(i!==void 0||u!==null);j(v,f),(0,r.useEffect)(()=>{if(!f)return;let m,h=()=>m=setTimeout(()=>v.current?.matches(":hover, :focus-within")?h():d(),1e4);return h(),()=>clearTimeout(m)},[f,i?.batch,u,d]);let S=x||(e&&i?p(i):""),a=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:R("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...f?{}:{display:"none"}}:{},T=i?(0,s.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${p(i)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");y(),requestAnimationFrame(()=>M(h))},...e?{style:U}:{className:H("graview-undo",l),...D(g),...t?{"data-compact":"","aria-label":p(i)}:{}},children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),e?(0,s.jsx)("span",{style:K,children:p(i)}):(0,s.jsx)("span",{className:"graview-undo-words",children:t?"Undo":p(i)})]}):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{role:"status","aria-live":"polite",style:V,children:S}),(0,s.jsxs)("div",{ref:v,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",...e?{style:{...F,...a}}:{className:"graview-undo-place"},children:[e?null:(0,s.jsx)("style",{children:q}),e&&i?(0,s.jsxs)("div",{"data-testid":"page-undo-notice",style:Z,children:[T,(0,s.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${p(i)}`,title:"Dismiss",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");d(),requestAnimationFrame(()=>M(h))},style:$,children:"\xD7"})]}):T,u?(0,s.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",className:"graview-undo-refused",...e?{style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",borderRadius:6,background:"var(--graview-float)",padding:"4px 8px"}}:{},children:u}):null]})]})}function j(c,e){(0,r.useLayoutEffect)(()=>{let n=c.current;if(!n||!e)return;if(typeof n.showPopover=="function"&&!k(n))try{n.showPopover()}catch{}let o=()=>n.parentElement?.closest("[data-embed-content]")??null,t=()=>{O(n,o()),dispatchEvent(new Event(C))};t(),addEventListener("resize",t),addEventListener("scroll",t,!0);let l=typeof ResizeObserver=="function"?new ResizeObserver(t):null;return l?.observe(n),()=>{if(l?.disconnect(),removeEventListener("resize",t),removeEventListener("scroll",t,!0),n.isConnected&&k(n))try{n.hidePopover()}catch{}dispatchEvent(new Event(C))}},[c,e])}var q=`:where(.graview-undo-place){display:grid;justify-items:end;gap:4px;max-width:100%;min-width:0}
1
+ import{d as z,e as D,f as H}from"./chunk.GHHKRFPD.js";import"./chunk.6NRWLCIZ.js";import{a as P,b as A,c as p,d as W}from"./chunk.Q355UPFG.js";import"./chunk.ZQGLPP7A.js";import"./chunk.VZAF3452.js";import"./chunk.WHX47OJM.js";import"./chunk.QRT6BZR6.js";import"./chunk.2V7QTIAV.js";import"./chunk.Z26T5E76.js";import"./chunk.77JI5T4F.js";import"./chunk.SADHOSRC.js";import"./chunk.4DZOAB4D.js";import"./chunk.UDU545CL.js";import"./chunk.7VAHHEDX.js";import"./chunk.P4TAX3HE.js";import"./chunk.T4TRJDBF.js";import"./chunk.2TCOLAL2.js";import"./chunk.2VYGDY5Z.js";import"./chunk.FUPYIOXZ.js";import"./chunk.APRWUIE3.js";import"./chunk.3OEODIHB.js";import"./chunk.WFCE7NLK.js";import{a as C,b as O}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.GZHZLJBF.js";import"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as B,Ua as k,V as L}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{sd as R}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as E}from"./chunk.AJZBJBMO.js";var r=E(B(),1);var s=E(L(),1);function M(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let n=c??document,o=n.querySelector("main")??n.querySelector("[data-graview-page]")??null,t=n.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??o;t instanceof HTMLElement&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}var I=1500;function N(c,e,n){let{store:o,principal:t}=c,l=z(o),g=(0,r.useMemo)(()=>P(o,t),[o,t,l]),w=(0,r.useRef)(n),[b,d]=(0,r.useState)(),[y,u]=(0,r.useState)("");(0,r.useEffect)(()=>{let a=A(o,t,w.current);w.current=o.batches().length,a&&(d({batch:a.batch,at:e,when:Date.now()}),u(""))},[o,t,l]),(0,r.useEffect)(()=>{d(a=>!a||a.at===e?a:Date.now()-a.when<I?{...a,at:e}:void 0)},[e]);let[x,i]=(0,r.useState)(null),v=(0,r.useCallback)(()=>{d(void 0),i(null)},[]),f=(0,r.useCallback)(()=>{i(null);try{let a=W(o,t);a&&u(`Took back \u201C${a.intent}\u201D`)}catch(a){i(a instanceof Error?a.message:String(a))}},[o,t]),S=g&&b?.batch===g.batch&&b.at===e?g:void 0;return{change:g,offered:S,close:v,takeBack:f,refused:x,said:y}}function ee({context:c,docked:e,at:n,since:o,compact:t=!1,className:l,size:g}){let{change:w,offered:b,close:d,takeBack:y,refused:u,said:x}=N(c,n,o),i=e?b:w,v=(0,r.useRef)(null),f=e&&(i!==void 0||u!==null);j(v,f),(0,r.useEffect)(()=>{if(!f)return;let m,h=()=>m=setTimeout(()=>v.current?.matches(":hover, :focus-within")?h():d(),1e4);return h(),()=>clearTimeout(m)},[f,i?.batch,u,d]);let S=x||(e&&i?p(i):""),a=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:R("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...f?{}:{display:"none"}}:{},T=i?(0,s.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${p(i)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");y(),requestAnimationFrame(()=>M(h))},...e?{style:U}:{className:H("graview-undo",l),...D(g),...t?{"data-compact":"","aria-label":p(i)}:{}},children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),e?(0,s.jsx)("span",{style:K,children:p(i)}):(0,s.jsx)("span",{className:"graview-undo-words",children:t?"Undo":p(i)})]}):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{role:"status","aria-live":"polite",style:V,children:S}),(0,s.jsxs)("div",{ref:v,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",...e?{style:{...F,...a}}:{className:"graview-undo-place"},children:[e?null:(0,s.jsx)("style",{children:q}),e&&i?(0,s.jsxs)("div",{"data-testid":"page-undo-notice",style:Z,children:[T,(0,s.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${p(i)}`,title:"Dismiss",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");d(),requestAnimationFrame(()=>M(h))},style:$,children:"\xD7"})]}):T,u?(0,s.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",className:"graview-undo-refused",...e?{style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",borderRadius:6,background:"var(--graview-float)",padding:"4px 8px"}}:{},children:u}):null]})]})}function j(c,e){(0,r.useLayoutEffect)(()=>{let n=c.current;if(!n||!e)return;if(typeof n.showPopover=="function"&&!k(n))try{n.showPopover()}catch{}let o=()=>n.parentElement?.closest("[data-embed-content]")??null,t=()=>{O(n,o()),dispatchEvent(new Event(C))};t(),addEventListener("resize",t),addEventListener("scroll",t,!0);let l=typeof ResizeObserver=="function"?new ResizeObserver(t):null;return l?.observe(n),()=>{if(l?.disconnect(),removeEventListener("resize",t),removeEventListener("scroll",t,!0),n.isConnected&&k(n))try{n.hidePopover()}catch{}dispatchEvent(new Event(C))}},[c,e])}var q=`:where(.graview-undo-place){display:grid;justify-items:end;gap:4px;max-width:100%;min-width:0}
2
2
  :where(.graview-undo){box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;min-height:var(--graview-control-height,36px);max-width:min(100%,var(--graview-undo-widest,18rem));min-width:0;padding:0 14px;border-radius:999px;border:1px solid var(--graview-edge);background:var(--graview-float);color:var(--graview-ink);font:inherit;font-size:.875rem;cursor:pointer}
3
3
  :where(.graview-undo[data-size=sm]){--graview-control-height:30px}
4
4
  :where(.graview-undo[data-compact]){padding:0 10px}
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as q,b as ye,e as fe,f as he,g as be}from"./chunk.ERPILTRY.js";import{b as X}from"./chunk.OTSBF367.js";import{c as ge}from"./chunk.XYGNS637.js";import{o as V}from"./chunk.WUVXIUA7.js";import{b as R,c as pe,d as ue,j as ce,k as me}from"./chunk.REUMBCSV.js";import{d as le,e as de}from"./chunk.2KIWGQXC.js";import{b as j,f as se}from"./chunk.D5LOTCBU.js";import{G as Se,Ha as ie,Ia as oe,S as ne,T as ae,ba as F,ca as re,ea as G}from"./chunk.CYTTZOYL.js";import{a as te}from"./chunk.SDO3U72B.js";import{Eb as ee,ga as $,ra as Z}from"./chunk.Q4MI53KK.js";import{b as K}from"./chunk.AJZBJBMO.js";var d=K(Se(),1);var xe=oe(te(()=>(__graviewPreload(import.meta.url,["./chunk.T535ZLRM.js","./chunk.ERPILTRY.js","./chunk.OTSBF367.js","./chunk.WVUJXDXZ.js","./chunk.XYGNS637.js","./chunk.DZSZUX34.js","./chunk.4EXC26LI.js","./chunk.PWAP2GJS.js","./chunk.AHPYNDVA.js","./chunk.FNVGNISQ.js","./chunk.GZHZLJBF.js","./chunk.WUVXIUA7.js","./chunk.OJGHDWI6.js","./chunk.BN7C5ZYX.js","./chunk.REUMBCSV.js","./chunk.2KIWGQXC.js","./chunk.D5LOTCBU.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.JO3BBRSR.js")))),ve=xe.part((i,n)=>i.drawAppLink(n),{quiet:!0});var e=K(ae(),1);function Y({nodeId:i,field:n,value:l,stored:s=l,said:f,blank:m=!1}){let{fields:o,commit:g}=V(i),t=o.find(r=>r.field===n),{store:k,principal:v}=F(),L=k.graph.getNode(i)?.kind,S=k.schema.definitions.find(r=>r.kind===L),h=Z(S,n),a=h.toLowerCase(),T=f??`${h.charAt(0).toUpperCase()}${h.slice(1)}: ${l}`,[E,M]=(0,d.useState)(!1),p=t?.shape.type==="number"?t.shape.amount:void 0,W=p&&s!==""&&Number.isFinite(Number(s))?pe(Number(s),p):s,[b,P]=(0,d.useState)(W),c=(0,d.useRef)(null),z=(0,d.useRef)(null),U=(0,d.useRef)(!1),[J,O]=(0,d.useState)(void 0),x=r=>{U.current=r,M(!1)};(0,d.useEffect)(()=>P(W),[W,E]);let Q=t?.shape.type==="date";if((0,d.useEffect)(()=>{if(Q)return ie(()=>void be())},[Q]),(0,d.useEffect)(()=>{E?c.current?.focus():U.current&&(U.current=!1,z.current?.focus())},[E]),!t)return(0,e.jsx)("span",{"data-graview-field":n,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${a}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:l});if(!E){let r=(0,e.jsx)("button",{ref:z,type:"button","data-graview-field":n,"data-graview-editable":t.mutation,...m?{"data-graview-blank":""}:{},...T===l?{}:{"aria-label":T},title:`${t.title} \u2014 changes the ${a}, and can be undone`,onClick:()=>{O(void 0),M(!0)},style:{all:"unset",cursor:"text",display:"inline-flex",alignItems:"flex-end",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",paddingBottom:1,borderBottom:"1px dashed var(--graview-edge-bright)",color:m?"var(--graview-ink-muted)":"var(--graview-ink)"},children:m?"add":l});return J?(0,e.jsxs)(e.Fragment,{children:[r,(0,e.jsx)("span",{role:"status","data-graview-refused":n,style:{marginLeft:6,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:J})]}):r}let N=(r,{left:y=!1}={})=>{if(x(!y),r!==s){if(r===""||r===void 0||r===null){if(s==="")return;t.clearable?g(t,null):O(`${h.charAt(0).toUpperCase()}${h.slice(1)} can't be empty; it keeps ${l}.`);return}t.shape.type==="date"&&typeof r=="string"&&ke(r)||g(t,r)}},ke=r=>{if(t.shape.type!=="date")return!1;let y=o.filter(H=>H.shape.type==="date"&&H.takesValue),C=me(y.map(H=>H.field),S?.fieldRoles??{}),I=C?.start===n?y.find(H=>H.field===C.end):void 0,w=k.graph.getNode(i)?.[C?.end??""];if(!I||typeof w!="string")return!1;let A=ce(s===""?void 0:s,r,w,{time:t.shape.time===!0,instant:t.shape.instant===!0});if(A===void 0||A===w)return!1;let B=t.call(r),_=I.call(A);return k.applyAll(B.name===_.name?[{name:B.name,args:{...B.args,..._.args}}]:[B,_],{author:v}),!0};if(!t.takesValue){let r=[t,...t.alternatives];return(0,e.jsx)("span",{role:"group","aria-label":`Change ${$(n).toLowerCase()}`,"data-graview-field":n,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:y=>{y.key==="Escape"&&x(!0)},children:r.map((y,C)=>(0,e.jsx)("button",{type:"button",ref:C===0?c:void 0,"data-graview-act":y.mutation,onClick:()=>{x(!0),g(y,void 0)},onBlur:I=>{let u=I.relatedTarget;(!u||!I.currentTarget.parentElement?.contains(u))&&x(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:y.title},y.mutation))})}if(t.shape.type==="several"&&t.shape.of.type==="choice"){let r=t.shape.of.options,y=k.graph.getNode(i),C=Array.isArray(y?.[n])?y[n].map(String):[],I=u=>{let w=r.filter(A=>u.includes(A));if(w.length>0)return g(t,w);t.clearable?g(t,null):O(`${h.charAt(0).toUpperCase()}${h.slice(1)} can't be empty; it keeps ${l}.`)};return(0,e.jsxs)("fieldset",{"data-graview-field":n,"data-graview-choices":n,style:{display:"inline-flex",flexWrap:"wrap",gap:"4px 12px",margin:0,padding:"2px 6px",border:"1px solid var(--graview-edge-bright)",borderRadius:6,maxWidth:"100%"},onKeyDown:u=>{u.key==="Escape"&&x(!0)},onBlur:u=>{let w=u.relatedTarget;(!w||!u.currentTarget.contains(w))&&x(!1)},children:[(0,e.jsx)("legend",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:$(n)}),r.map((u,w)=>(0,e.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,cursor:"pointer"},children:[(0,e.jsx)("input",{ref:w===0?c:void 0,type:"checkbox",value:u,checked:C.includes(u),onChange:A=>I(A.target.checked?[...C,u]:C.filter(B=>B!==u))}),j(S,n,u)]},u))]})}return(0,e.jsxs)("form",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,maxWidth:"100%"},onSubmit:r=>{r.preventDefault(),N(we(t,b))},children:[t.shape.type==="choice"?(0,e.jsxs)("select",{ref:c,"aria-label":$(n),"data-graview-field":n,value:b,onChange:r=>N(r.target.value),onBlur:()=>x(!1),style:{font:"inherit",fontSize:"inherit"},children:[b===""?(0,e.jsx)("option",{value:"",disabled:!0,children:"Choose\u2026"}):null,t.shape.options.map(r=>(0,e.jsx)("option",{value:r,children:j(S,n,r)},r))]}):t.shape.type==="date"?(0,e.jsx)(he,{inputRef:c,label:$(n),value:b===""?void 0:b,time:t.shape.time===!0,instant:t.shape.instant===!0,partial:t.shape.partial===!0,onChange:r=>P(r??""),onLeave:r=>N(r,{left:!0}),onCancel:()=>x(!0),autoSelect:!0,boxStyle:{fontSize:"inherit",minHeight:24,padding:"0 3px"}}):(0,e.jsxs)(e.Fragment,{children:[p&&R(p).prefix?(0,e.jsx)("span",{"aria-hidden":"true",children:R(p).prefix}):null,(0,e.jsx)("input",{ref:c,"aria-label":p?`${$(n)}, ${R(p).hint}`:$(n),"data-graview-field":n,...p?{inputMode:"decimal",placeholder:R(p).placeholder,"data-graview-amount":p.format??"unit"}:{},type:p?"text":t.shape.type==="number"&&!t.shape.duration?"number":"text",...t.shape.type==="number"&&t.shape.duration?{placeholder:"1h 30m"}:{},...t.shape.type==="text"&&t.shape.holds==="phone"?{inputMode:"tel",autoComplete:"tel"}:{},...t.shape.type==="number"&&t.shape.min!==void 0&&!p?{min:t.shape.min}:{},...t.shape.type==="number"&&t.shape.max!==void 0&&!p?{max:t.shape.max}:{},...t.shape.type==="number"&&t.shape.step!==void 0&&!p?{step:t.shape.step}:{},value:b,onChange:r=>P(r.target.value),onBlur:()=>N(we(t,b),{left:!0}),onKeyDown:r=>{r.key==="Escape"&&x(!0)},style:{font:"inherit",fontSize:"inherit",width:`min(${Math.max(6,b.length+1)}ch, 100%)`,maxWidth:"100%",minWidth:0,boxSizing:"border-box",minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),p&&R(p).suffix?(0,e.jsx)("span",{"aria-hidden":"true",children:R(p).suffix}):null]}),t.open.length>0?(0,e.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",t.open.map(r=>r.name).join(", ")]}):null]})}function we(i,n){return n.trim()===""?"":i.shape.type==="number"&&i.shape.amount?ue(n,i.shape.amount):i.shape.type==="number"?i.shape.duration?se(n)??n:Number(n):i.shape.type==="text"&&i.shape.holds?n.trim():n}function Ce({href:i,field:n,value:l,stored:s,nodeId:f}){let m=i.startsWith("tel:"),o=(g,t)=>(0,e.jsx)("a",{href:i,"data-graview-link":n,...t?{"aria-label":t}:{},...m?{}:{target:"_blank",rel:"noopener noreferrer"},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",color:"var(--graview-accent)"},children:g});return f===void 0?o(l):(0,e.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"center",gap:"0 10px",maxWidth:"100%"},children:[(0,e.jsx)(Y,{nodeId:f,field:n,value:l,...s===void 0?{}:{stored:s}}),o(m?"Call":"Map",m?`Call ${l}`:`Open ${l} in maps`)]})}function Ge({id:i,hide:n=[],limit:l=10,labels:s={},shown:f=[]}){let{store:m}=F(),o=G(i);if(!o)return null;let g=m.schema.tryDefinition(o.kind),t=le(o,g,{limit:l,said:f}).filter(v=>!n.includes(v.key)),k=ge(g).length>0;return t.length===0&&!k?null:(0,e.jsxs)("div",{"data-graview-fields":o.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:[de(g,t).map((v,L)=>{let S=(0,e.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:v.fields.map(a=>a.files?(0,e.jsx)(q,{as:"field",nodeId:o.id,field:a.key,label:s[a.key]??a.label,files:a.files,labelStyle:D,style:{marginTop:6}},a.key):a.long?(0,e.jsx)(Le,{nodeId:o.id,field:a.key,label:s[a.key]??a.label,value:a.value,markdown:a.markdown,labelStyle:D,style:{gridColumn:"1 / -1",marginTop:6}},a.key):(0,e.jsxs)("div",{style:{display:"contents"},children:[(0,e.jsx)("dt",{style:{...D,whiteSpace:"nowrap"},children:s[a.key]??a.label}),(0,e.jsxs)("dd",{style:{margin:0,minWidth:0},children:[a.linked?(0,e.jsx)(ye,{relation:a.linked.relation,refs:a.linked.refs,nodeId:o.id,field:a.key}):a.app?(0,e.jsx)(ve,{address:a.app,as:"record",nodeId:o.id,field:a.key}):a.href?(0,e.jsx)(Ce,{href:a.href,field:a.key,value:a.value,stored:a.stored,nodeId:o.id}):(0,e.jsx)(Y,{nodeId:o.id,field:a.key,value:a.value,stored:a.stored}),a.repeats?(0,e.jsx)(fe,{nodeId:o.id,field:a.key,start:o[a.key],value:o[`${a.key}Repeat`],label:`${s[a.key]??a.label} repeats`}):null]})]},a.key))});if(!v.title)return(0,e.jsx)("div",{children:S},L);let h=`graview-field-group-${o.id}-${L}`;return(0,e.jsxs)("div",{role:"group","aria-labelledby":h,style:{display:"grid",gap:6,minWidth:0},children:[(0,e.jsx)("p",{id:h,"data-graview-field-group":v.title,style:Ee,children:v.title}),S]},L)}),k?(0,e.jsx)(q,{as:"unfilled",nodeId:o.id,skip:n,labels:s,labelStyle:D}):null]})}var D={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},Ee={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function Le(i){return re()?(0,e.jsx)(We,{...i}):(0,e.jsx)(Te,{...i})}function Te({field:i,label:n,value:l,labelStyle:s,valueStyle:f,style:m,markdown:o}){return(0,e.jsxs)("div",{"data-graview-long":i,style:{display:"grid",gap:6,minWidth:0,...m},children:[(0,e.jsx)("dt",{style:s,children:n}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...f},children:(0,e.jsx)("div",{"data-graview-field":i,children:(0,e.jsx)(X,{text:l,markdown:o})})})]})}function We({nodeId:i,field:n,label:l,value:s,labelStyle:f,valueStyle:m,style:o,markdown:g}){let{fields:t,commit:k}=V(i),{store:v,principal:L}=F(),S=(0,d.useContext)(ne)!==null&&v.collaborative(i,n),h=t.find(c=>c.field===n&&c.takesValue),a=h&&(!S||v.permits({name:ee,args:{node:i,field:n,at:0,remove:0,insert:""}},L).ok)?h:void 0,[T,E]=(0,d.useState)(!1),M=(0,d.useRef)(null),p=(0,d.useRef)(!1);(0,d.useEffect)(()=>{!T&&p.current&&(p.current=!1,M.current?.focus())},[T]);let W=c=>{p.current=c,E(!1)},b=l.toLowerCase(),P=(0,e.jsx)(X,{text:s,markdown:g});return(0,e.jsxs)("div",{"data-graview-long":n,style:{display:"grid",gap:6,minWidth:0,...o},children:[(0,e.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...f},children:[(0,e.jsx)("span",{children:l}),a&&!T?(0,e.jsx)("button",{ref:M,type:"button","data-graview-editable":a.mutation,"aria-label":`Edit the ${b}`,title:`${a.title} \u2014 changes the ${b}, and can be undone`,onClick:()=>E(!0),style:Ae,children:"Edit"}):null]}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...m},children:T&&a?(0,e.jsx)(d.Suspense,{fallback:P,children:(0,e.jsx)(Ie,{nodeId:i,field:n,label:l,value:s,...g?{markdown:!0}:{},onCancel:()=>W(!0),onDone:c=>W(!c),onSave:(c,z)=>{W(!z),c!==s&&k(a,c)}})}):(0,e.jsx)("div",{"data-graview-field":n,...a?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${b}`},...a?{onClick:()=>E(!0)}:{},style:{cursor:a?"text":"default",minWidth:0},children:P})})]})}var Ie=(0,d.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.OTSBF367.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KPQLM4TM.js"))),Ae={all:"unset",cursor:"pointer",fontSize:"0.75rem",letterSpacing:"normal",textTransform:"none",color:"var(--graview-accent)",borderBottom:"1px dashed currentColor",minHeight:24,minWidth:24,display:"inline-flex",alignItems:"flex-end"};function je({nodeId:i,children:n}){let{fields:l}=V(i),s=G(i);if(!s)return(0,e.jsx)(e.Fragment,{children:n});let f=l.find(m=>{let o=s[m.field];return typeof o=="string"&&o===n});return f?(0,e.jsx)(Y,{nodeId:i,field:f.field,value:n,said:n}):(0,e.jsx)(e.Fragment,{children:n})}export{ve as a,Y as b,Ce as c,Ge as d,Le as e,je as f};
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as q,b as ye,e as fe,f as he,g as be}from"./chunk.3OEODIHB.js";import{b as X}from"./chunk.WFCE7NLK.js";import{c as ge}from"./chunk.ZA5TDCBC.js";import{o as V}from"./chunk.3SAESG6X.js";import{b as R,c as pe,d as ue,j as ce,k as me}from"./chunk.75JQCTR6.js";import{d as le,e as de}from"./chunk.5IEZF433.js";import{b as j,f as se}from"./chunk.5AD2QHWH.js";import{G as Se,Ja as ie,Ka as oe,U as ne,V as ae,da as F,ea as re,ga as G}from"./chunk.VLX7YWVH.js";import{a as te}from"./chunk.SDO3U72B.js";import{Eb as ee,ga as $,ra as Z}from"./chunk.IQGSEAQ2.js";import{b as K}from"./chunk.AJZBJBMO.js";var d=K(Se(),1);var xe=oe(te(()=>(__graviewPreload(import.meta.url,["./chunk.APRWUIE3.js","./chunk.3OEODIHB.js","./chunk.WFCE7NLK.js","./chunk.WVUJXDXZ.js","./chunk.ZA5TDCBC.js","./chunk.2JEN2RCB.js","./chunk.7CLKGKSF.js","./chunk.TMHVYI5R.js","./chunk.R5MLRKAO.js","./chunk.YMXWS4XN.js","./chunk.GZHZLJBF.js","./chunk.3SAESG6X.js","./chunk.OJGHDWI6.js","./chunk.F6BNFLQM.js","./chunk.75JQCTR6.js","./chunk.5IEZF433.js","./chunk.5AD2QHWH.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XEG7ZDRG.js")))),ve=xe.part((i,n)=>i.drawAppLink(n),{quiet:!0});var e=K(ae(),1);function Y({nodeId:i,field:n,value:l,stored:s=l,said:f,blank:m=!1}){let{fields:o,commit:g}=V(i),t=o.find(r=>r.field===n),{store:k,principal:v}=F(),L=k.graph.getNode(i)?.kind,S=k.schema.definitions.find(r=>r.kind===L),h=Z(S,n),a=h.toLowerCase(),T=f??`${h.charAt(0).toUpperCase()}${h.slice(1)}: ${l}`,[E,M]=(0,d.useState)(!1),p=t?.shape.type==="number"?t.shape.amount:void 0,W=p&&s!==""&&Number.isFinite(Number(s))?pe(Number(s),p):s,[b,P]=(0,d.useState)(W),c=(0,d.useRef)(null),z=(0,d.useRef)(null),U=(0,d.useRef)(!1),[J,O]=(0,d.useState)(void 0),x=r=>{U.current=r,M(!1)};(0,d.useEffect)(()=>P(W),[W,E]);let Q=t?.shape.type==="date";if((0,d.useEffect)(()=>{if(Q)return ie(()=>void be())},[Q]),(0,d.useEffect)(()=>{E?c.current?.focus():U.current&&(U.current=!1,z.current?.focus())},[E]),!t)return(0,e.jsx)("span",{"data-graview-field":n,"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${a}`,style:{color:"var(--graview-ink)",cursor:"default",overflowWrap:"anywhere"},children:l});if(!E){let r=(0,e.jsx)("button",{ref:z,type:"button","data-graview-field":n,"data-graview-editable":t.mutation,...m?{"data-graview-blank":""}:{},...T===l?{}:{"aria-label":T},title:`${t.title} \u2014 changes the ${a}, and can be undone`,onClick:()=>{O(void 0),M(!0)},style:{all:"unset",cursor:"text",display:"inline-flex",alignItems:"flex-end",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",paddingBottom:1,borderBottom:"1px dashed var(--graview-edge-bright)",color:m?"var(--graview-ink-muted)":"var(--graview-ink)"},children:m?"add":l});return J?(0,e.jsxs)(e.Fragment,{children:[r,(0,e.jsx)("span",{role:"status","data-graview-refused":n,style:{marginLeft:6,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:J})]}):r}let N=(r,{left:y=!1}={})=>{if(x(!y),r!==s){if(r===""||r===void 0||r===null){if(s==="")return;t.clearable?g(t,null):O(`${h.charAt(0).toUpperCase()}${h.slice(1)} can't be empty; it keeps ${l}.`);return}t.shape.type==="date"&&typeof r=="string"&&ke(r)||g(t,r)}},ke=r=>{if(t.shape.type!=="date")return!1;let y=o.filter(H=>H.shape.type==="date"&&H.takesValue),C=me(y.map(H=>H.field),S?.fieldRoles??{}),I=C?.start===n?y.find(H=>H.field===C.end):void 0,w=k.graph.getNode(i)?.[C?.end??""];if(!I||typeof w!="string")return!1;let A=ce(s===""?void 0:s,r,w,{time:t.shape.time===!0,instant:t.shape.instant===!0});if(A===void 0||A===w)return!1;let B=t.call(r),_=I.call(A);return k.applyAll(B.name===_.name?[{name:B.name,args:{...B.args,..._.args}}]:[B,_],{author:v}),!0};if(!t.takesValue){let r=[t,...t.alternatives];return(0,e.jsx)("span",{role:"group","aria-label":`Change ${$(n).toLowerCase()}`,"data-graview-field":n,style:{display:"inline-flex",gap:6,alignItems:"center",flexWrap:"wrap"},onKeyDown:y=>{y.key==="Escape"&&x(!0)},children:r.map((y,C)=>(0,e.jsx)("button",{type:"button",ref:C===0?c:void 0,"data-graview-act":y.mutation,onClick:()=>{x(!0),g(y,void 0)},onBlur:I=>{let u=I.relatedTarget;(!u||!I.currentTarget.parentElement?.contains(u))&&x(!1)},style:{padding:"2px 9px",fontSize:"0.8125rem",borderRadius:999},children:y.title},y.mutation))})}if(t.shape.type==="several"&&t.shape.of.type==="choice"){let r=t.shape.of.options,y=k.graph.getNode(i),C=Array.isArray(y?.[n])?y[n].map(String):[],I=u=>{let w=r.filter(A=>u.includes(A));if(w.length>0)return g(t,w);t.clearable?g(t,null):O(`${h.charAt(0).toUpperCase()}${h.slice(1)} can't be empty; it keeps ${l}.`)};return(0,e.jsxs)("fieldset",{"data-graview-field":n,"data-graview-choices":n,style:{display:"inline-flex",flexWrap:"wrap",gap:"4px 12px",margin:0,padding:"2px 6px",border:"1px solid var(--graview-edge-bright)",borderRadius:6,maxWidth:"100%"},onKeyDown:u=>{u.key==="Escape"&&x(!0)},onBlur:u=>{let w=u.relatedTarget;(!w||!u.currentTarget.contains(w))&&x(!1)},children:[(0,e.jsx)("legend",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:$(n)}),r.map((u,w)=>(0,e.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,cursor:"pointer"},children:[(0,e.jsx)("input",{ref:w===0?c:void 0,type:"checkbox",value:u,checked:C.includes(u),onChange:A=>I(A.target.checked?[...C,u]:C.filter(B=>B!==u))}),j(S,n,u)]},u))]})}return(0,e.jsxs)("form",{style:{display:"inline-flex",flexWrap:"wrap",gap:4,maxWidth:"100%"},onSubmit:r=>{r.preventDefault(),N(we(t,b))},children:[t.shape.type==="choice"?(0,e.jsxs)("select",{ref:c,"aria-label":$(n),"data-graview-field":n,value:b,onChange:r=>N(r.target.value),onBlur:()=>x(!1),style:{font:"inherit",fontSize:"inherit"},children:[b===""?(0,e.jsx)("option",{value:"",disabled:!0,children:"Choose\u2026"}):null,t.shape.options.map(r=>(0,e.jsx)("option",{value:r,children:j(S,n,r)},r))]}):t.shape.type==="date"?(0,e.jsx)(he,{inputRef:c,label:$(n),value:b===""?void 0:b,time:t.shape.time===!0,instant:t.shape.instant===!0,partial:t.shape.partial===!0,onChange:r=>P(r??""),onLeave:r=>N(r,{left:!0}),onCancel:()=>x(!0),autoSelect:!0,boxStyle:{fontSize:"inherit",minHeight:24,padding:"0 3px"}}):(0,e.jsxs)(e.Fragment,{children:[p&&R(p).prefix?(0,e.jsx)("span",{"aria-hidden":"true",children:R(p).prefix}):null,(0,e.jsx)("input",{ref:c,"aria-label":p?`${$(n)}, ${R(p).hint}`:$(n),"data-graview-field":n,...p?{inputMode:"decimal",placeholder:R(p).placeholder,"data-graview-amount":p.format??"unit"}:{},type:p?"text":t.shape.type==="number"&&!t.shape.duration?"number":"text",...t.shape.type==="number"&&t.shape.duration?{placeholder:"1h 30m"}:{},...t.shape.type==="text"&&t.shape.holds==="phone"?{inputMode:"tel",autoComplete:"tel"}:{},...t.shape.type==="number"&&t.shape.min!==void 0&&!p?{min:t.shape.min}:{},...t.shape.type==="number"&&t.shape.max!==void 0&&!p?{max:t.shape.max}:{},...t.shape.type==="number"&&t.shape.step!==void 0&&!p?{step:t.shape.step}:{},value:b,onChange:r=>P(r.target.value),onBlur:()=>N(we(t,b),{left:!0}),onKeyDown:r=>{r.key==="Escape"&&x(!0)},style:{font:"inherit",fontSize:"inherit",width:`min(${Math.max(6,b.length+1)}ch, 100%)`,maxWidth:"100%",minWidth:0,boxSizing:"border-box",minHeight:24,display:"inline-flex",alignItems:"center",padding:"0 3px"}}),p&&R(p).suffix?(0,e.jsx)("span",{"aria-hidden":"true",children:R(p).suffix}):null]}),t.open.length>0?(0,e.jsxs)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["also needs ",t.open.map(r=>r.name).join(", ")]}):null]})}function we(i,n){return n.trim()===""?"":i.shape.type==="number"&&i.shape.amount?ue(n,i.shape.amount):i.shape.type==="number"?i.shape.duration?se(n)??n:Number(n):i.shape.type==="text"&&i.shape.holds?n.trim():n}function Ce({href:i,field:n,value:l,stored:s,nodeId:f}){let m=i.startsWith("tel:"),o=(g,t)=>(0,e.jsx)("a",{href:i,"data-graview-link":n,...t?{"aria-label":t}:{},...m?{}:{target:"_blank",rel:"noopener noreferrer"},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,maxWidth:"100%",overflowWrap:"anywhere",color:"var(--graview-accent)"},children:g});return f===void 0?o(l):(0,e.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"center",gap:"0 10px",maxWidth:"100%"},children:[(0,e.jsx)(Y,{nodeId:f,field:n,value:l,...s===void 0?{}:{stored:s}}),o(m?"Call":"Map",m?`Call ${l}`:`Open ${l} in maps`)]})}function Ge({id:i,hide:n=[],limit:l=10,labels:s={},shown:f=[]}){let{store:m}=F(),o=G(i);if(!o)return null;let g=m.schema.tryDefinition(o.kind),t=le(o,g,{limit:l,said:f}).filter(v=>!n.includes(v.key)),k=ge(g).length>0;return t.length===0&&!k?null:(0,e.jsxs)("div",{"data-graview-fields":o.id,style:{display:"grid",gap:14,alignContent:"start",minWidth:0,fontSize:"0.875rem"},children:[de(g,t).map((v,L)=>{let S=(0,e.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"auto 1fr",gap:"5px 16px",alignContent:"start",minWidth:0},children:v.fields.map(a=>a.files?(0,e.jsx)(q,{as:"field",nodeId:o.id,field:a.key,label:s[a.key]??a.label,files:a.files,labelStyle:D,style:{marginTop:6}},a.key):a.long?(0,e.jsx)(Le,{nodeId:o.id,field:a.key,label:s[a.key]??a.label,value:a.value,markdown:a.markdown,labelStyle:D,style:{gridColumn:"1 / -1",marginTop:6}},a.key):(0,e.jsxs)("div",{style:{display:"contents"},children:[(0,e.jsx)("dt",{style:{...D,whiteSpace:"nowrap"},children:s[a.key]??a.label}),(0,e.jsxs)("dd",{style:{margin:0,minWidth:0},children:[a.linked?(0,e.jsx)(ye,{relation:a.linked.relation,refs:a.linked.refs,nodeId:o.id,field:a.key}):a.app?(0,e.jsx)(ve,{address:a.app,as:"record",nodeId:o.id,field:a.key}):a.href?(0,e.jsx)(Ce,{href:a.href,field:a.key,value:a.value,stored:a.stored,nodeId:o.id}):(0,e.jsx)(Y,{nodeId:o.id,field:a.key,value:a.value,stored:a.stored}),a.repeats?(0,e.jsx)(fe,{nodeId:o.id,field:a.key,start:o[a.key],value:o[`${a.key}Repeat`],label:`${s[a.key]??a.label} repeats`}):null]})]},a.key))});if(!v.title)return(0,e.jsx)("div",{children:S},L);let h=`graview-field-group-${o.id}-${L}`;return(0,e.jsxs)("div",{role:"group","aria-labelledby":h,style:{display:"grid",gap:6,minWidth:0},children:[(0,e.jsx)("p",{id:h,"data-graview-field-group":v.title,style:Ee,children:v.title}),S]},L)}),k?(0,e.jsx)(q,{as:"unfilled",nodeId:o.id,skip:n,labels:s,labelStyle:D}):null]})}var D={color:"var(--graview-ink-faint)",fontSize:"0.8125rem"},Ee={margin:0,fontSize:"0.75rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)",fontWeight:560};function Le(i){return re()?(0,e.jsx)(We,{...i}):(0,e.jsx)(Te,{...i})}function Te({field:i,label:n,value:l,labelStyle:s,valueStyle:f,style:m,markdown:o}){return(0,e.jsxs)("div",{"data-graview-long":i,style:{display:"grid",gap:6,minWidth:0,...m},children:[(0,e.jsx)("dt",{style:s,children:n}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...f},children:(0,e.jsx)("div",{"data-graview-field":i,children:(0,e.jsx)(X,{text:l,markdown:o})})})]})}function We({nodeId:i,field:n,label:l,value:s,labelStyle:f,valueStyle:m,style:o,markdown:g}){let{fields:t,commit:k}=V(i),{store:v,principal:L}=F(),S=(0,d.useContext)(ne)!==null&&v.collaborative(i,n),h=t.find(c=>c.field===n&&c.takesValue),a=h&&(!S||v.permits({name:ee,args:{node:i,field:n,at:0,remove:0,insert:""}},L).ok)?h:void 0,[T,E]=(0,d.useState)(!1),M=(0,d.useRef)(null),p=(0,d.useRef)(!1);(0,d.useEffect)(()=>{!T&&p.current&&(p.current=!1,M.current?.focus())},[T]);let W=c=>{p.current=c,E(!1)},b=l.toLowerCase(),P=(0,e.jsx)(X,{text:s,markdown:g});return(0,e.jsxs)("div",{"data-graview-long":n,style:{display:"grid",gap:6,minWidth:0,...o},children:[(0,e.jsxs)("dt",{style:{display:"flex",alignItems:"baseline",gap:10,...f},children:[(0,e.jsx)("span",{children:l}),a&&!T?(0,e.jsx)("button",{ref:M,type:"button","data-graview-editable":a.mutation,"aria-label":`Edit the ${b}`,title:`${a.title} \u2014 changes the ${b}, and can be undone`,onClick:()=>E(!0),style:Ae,children:"Edit"}):null]}),(0,e.jsx)("dd",{style:{margin:0,minWidth:0,...m},children:T&&a?(0,e.jsx)(d.Suspense,{fallback:P,children:(0,e.jsx)(Ie,{nodeId:i,field:n,label:l,value:s,...g?{markdown:!0}:{},onCancel:()=>W(!0),onDone:c=>W(!c),onSave:(c,z)=>{W(!z),c!==s&&k(a,c)}})}):(0,e.jsx)("div",{"data-graview-field":n,...a?{}:{"data-graview-readonly":"",title:`Read-only \u2014 nothing this app declares changes the ${b}`},...a?{onClick:()=>E(!0)}:{},style:{cursor:a?"text":"default",minWidth:0},children:P})})]})}var Ie=(0,d.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.WFCE7NLK.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XIVELWAM.js"))),Ae={all:"unset",cursor:"pointer",fontSize:"0.75rem",letterSpacing:"normal",textTransform:"none",color:"var(--graview-accent)",borderBottom:"1px dashed currentColor",minHeight:24,minWidth:24,display:"inline-flex",alignItems:"flex-end"};function je({nodeId:i,children:n}){let{fields:l}=V(i),s=G(i);if(!s)return(0,e.jsx)(e.Fragment,{children:n});let f=l.find(m=>{let o=s[m.field];return typeof o=="string"&&o===n});return f?(0,e.jsx)(Y,{nodeId:i,field:f.field,value:n,said:n}):(0,e.jsx)(e.Fragment,{children:n})}export{ve as a,Y as b,Ce as c,Ge as d,Le as e,je as f};
@@ -1 +1 @@
1
- import{d as i}from"./chunk.MBB5A6BT.js";import{T as o}from"./chunk.CYTTZOYL.js";import{b as a}from"./chunk.AJZBJBMO.js";var t=a(o(),1);function s({id:r,label:e,go:n,testId:d}){return n?(0,t.jsx)("button",{type:"button","data-testid":d,"data-record":r,title:`Go to ${e}`,onClick:()=>n(r),style:{all:"unset",display:"inline-flex",maxWidth:"100%",minWidth:0,cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,t.jsx)(i,{label:e})}):(0,t.jsx)(i,{label:e})}export{s as a};
1
+ import{d as i}from"./chunk.FUPYIOXZ.js";import{V as o}from"./chunk.VLX7YWVH.js";import{b as a}from"./chunk.AJZBJBMO.js";var t=a(o(),1);function s({id:r,label:e,go:n,testId:d}){return n?(0,t.jsx)("button",{type:"button","data-testid":d,"data-record":r,title:`Go to ${e}`,onClick:()=>n(r),style:{all:"unset",display:"inline-flex",maxWidth:"100%",minWidth:0,cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,t.jsx)(i,{label:e})}):(0,t.jsx)(i,{label:e})}export{s as a};
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as N,g as se,h as de}from"./chunk.34DRUCH2.js";import{a as R}from"./chunk.KXFNRJ46.js";import{a as ie,b as oe,c as re}from"./chunk.OMRQTLI5.js";import{b}from"./chunk.MIE3ODQ2.js";import{a as ae}from"./chunk.H7AH3IW4.js";import{a as S,b as T,c as A,d as $}from"./chunk.U5P23GO7.js";import{a as C}from"./chunk.REUMBCSV.js";import{j as ne}from"./chunk.KZUMXT5J.js";import{G as X,Ia as Z,J,O as H,P as q,Ra as ee,T as K,Va as te,ba as w,la as Q}from"./chunk.CYTTZOYL.js";import{a as _}from"./chunk.SDO3U72B.js";import{Ib as x,db as j,eb as E,ga as U,la as Y,we as G}from"./chunk.Q4MI53KK.js";import{b as z}from"./chunk.AJZBJBMO.js";var h=z(X(),1);var le=z(X(),1);function pe(){let{ai:n,aiDesk:a}=w(),{entries:o}=J(a),i=n.off===!0;return(0,le.useEffect)(()=>{i||a.load()},[a,i]),i?[]:o}var e=z(K(),1),ue=Z(_(()=>(__graviewPreload(import.meta.url,["./chunk.DDFRFSVN.js","./chunk.U5P23GO7.js","./chunk.YOUB3J3Y.js","./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZP7JEVVU.js")))),ve=ue.part((n,a)=>(0,e.jsx)(n.InteractionRow,{...a}),{quiet:!0,as:"li"}),me=ue.part((n,a)=>(0,e.jsx)(n.ActivityFilter,{...a}),{quiet:!0,as:"div"}),we=n=>n.undoes===void 0&&n.primitives.some(a=>a.op==="remove-node"||a.op==="patch-node"&&a.after[E]===!0&&a.before[E]!==!0);function ke(n){let a=[...new Set(n.ops.filter(o=>!x(o)&&we(o)).map(o=>o.intent))].filter(o=>o!==n.intent);return a.length===0?n.intent:`${n.intent} \u2014 ${a.join("; ")}`}var ge=(n,a,o=ce(n,[a]))=>({intent:ke(a),author:a.author.kind,...a.author.id?{authorId:a.author.id}:{},by:a.author,...a.ops[0]?.via?{via:a.ops[0].via}:{},...a.lineage?{basis:ae(a.lineage)}:{},touched:[...new Set(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes))],...xe(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes),o),batch:a.id,at:a.at,...a.lineage?.interaction?{interaction:a.lineage.interaction}:{},seq:a.ops.at(-1).seq+1,...a.ops.every(x)?{withheld:!0}:{}});function be(n=4){let{store:a,principal:o}=w(),i=q(a,o),s=i.log.length;return(0,h.useMemo)(()=>{let d=i.batches(),l=ce(i,d);return oe(d,r=>i.log.get(r)).reverse().slice(0,n).map(r=>{if("batch"in r){let p=ge(i,r.batch,l);return r.typed?{...p,intent:ie(r.typed,i.schema,i.graph),batches:r.typed.batches.filter(k=>!k.undone).map(k=>k.id)}:p}let u=[...r.digest.batches].reverse().map(p=>ge(i,p,l));return{intent:re(r.digest),author:r.digest.author.kind,...r.digest.author.id?{authorId:r.digest.author.id}:{},by:r.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[i,s,n])}function ce(n,a){let o=new Map;for(let i of a)for(let s of i.ops)if(!x(s))for(let d of s.primitives)(d.op==="add-node"||d.op==="remove-node")&&d.node&&o.set(d.node.id,Y(n.schema.tryDefinition(d.node.kind),d.node));return o}function xe(n,a){let o={};for(let i of n){let s=a.get(i);s!==void 0&&(o[i]=s)}return Object.keys(o).length>0?{named:o}:{}}function Se({change:n}){let{store:a,principal:o,seats:i,people:s}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[n.author==="human"&&n.by?.onBehalfOf===void 0&&(n.authorId===void 0||o.id===void 0||n.authorId===o.id)?"you":j(n.by??{kind:n.author,id:n.authorId},{graph:a.graph,schema:a.schema,seats:i,people:s}),C(n.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(n.via)]}):null]})}function Ae({change:n,goes:a}){let{store:o}=w(),[i,s]=(0,h.useState)(!1),d=n.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{...S,gap:5},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)(Se,{change:n})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:n.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":i,onClick:()=>s(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:i?"Hide":"Show each"})]}),i?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:d.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(V,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:$,children:l.touched.slice(0,4).map(r=>(0,e.jsx)(R,{id:r,label:o.graph.has(r)?b(o,r):l.named?.[r]??b(o,r),go:a(r),testId:"activity-record"},r))}):null]},l.batch))}):null]})}function V({batch:n}){let{store:a,principal:o,noteSeat:i}=w(),s=q(a,o),d=H()?.open??!1,l=s.log.length,[r,u]=(0,h.useState)(null),p=(0,h.useMemo)(()=>s.canUndo(n),[s,n,l]),k=(0,h.useMemo)(()=>p.ok?s.mayUndo(n,o):{ok:!0},[s,n,l,o,p]);if(d||!p.ok&&p.ops.length===0||!k.ok)return null;let f=!p.ok,W=f?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:f?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof n=="string"?[n]:n,L=s.log.all().find(O=>v.includes(O.batch)&&O.author.kind==="agent");s.undo(f?[...v,...W]:typeof n=="string"?n:[...n],{author:o}),L&&i({type:"home",author:L.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...f?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:f?`undo +${W.length}`:"undo"}),r?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:r}):null]})}function Ie({seq:n,intent:a}){let o=H();if(!o)return null;let i=o.past?.seq===n;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${a}\u201D`,title:"Show the app as it was here","aria-pressed":i,onPointerEnter:N,onFocus:N,onClick:()=>o.show(n),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function Ce(){let n=()=>G(window.location.href);return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:a=>{a.preventDefault(),window.location.assign(n())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function Ve({calls:n,seat:a,remembers:o=!1}){let i=be(),{store:s,principal:d,seats:l,people:r}=w(),u=pe(),[p,k]=(0,h.useState)("all"),[f,W]=(0,h.useState)(!1),v=t=>t!==void 0&&(t.id===d.id||t.onBehalfOf?.id===d.id)&&d.id!==void 0,L=new Set(u.map(t=>t.id)),O=i.filter(t=>!(t.interaction!==void 0&&L.has(t.interaction))&&(!f||v(t.by))),he=u.filter(t=>!f||v(t.by)).slice(0,4),M=[...p==="ai"?[]:O.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:he.map(t=>({at:t.at,entry:t}))].sort((t,y)=>t.at<y.at?1:t.at>y.at?-1:0),m=q(s,d),B=n.some(t=>t.phase==="running"),ye=se(),I=te("activity"),F=I.open,fe=Q(),P=H(),D=t=>m.graph.has(t)?y=>{I.setOpen(!1),P?.past&&P.show(null),fe.record(y)}:null;return a===void 0&&n.length===0&&i.length===0&&u.length===0&&!o&&ye===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...I.trigger,onClick:I.toggle,title:B?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:B?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[B?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,i.length>0?i.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!F&&a!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:a}):null,F?(0,e.jsxs)("section",{...I.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...ee,width:"min(300px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...ne,margin:0},children:"Activity"}),a!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:n.length>0||M.length>0?9:0,...n.length>0||M.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),a]}):null,n.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:n.slice(0,6).map((t,y)=>(0,e.jsxs)("li",{style:{...S,gap:2,fontSize:"0.8125rem"},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{"data-graview-activity-words":"",style:{...A,color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??U(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(g=>(0,e.jsx)(R,{id:g,label:b(m,g),go:D(g),testId:"activity-record"},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,c])=>(0,e.jsx)(R,{id:c,label:b(m,c),go:D(c),testId:"activity-record"},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${y}`))}):null,u.length>0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(me,{shows:p,onShows:k,mine:f,onMine:W})}):null,M.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:M.map(({change:t,entry:y},g)=>y!==void 0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(ve,{entry:y,undo:c=>(0,e.jsx)(V,{batch:c})})},`ai:${y.id}`):t.digest?(0,e.jsx)(Ae,{change:t,goes:D},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:S,children:(0,e.jsx)("span",{"data-touched":"",style:{...A,color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||d.id===void 0||t.authorId===d.id)?"you":j(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:r}),C(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(Ie,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(V,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:$,children:t.touched.slice(0,4).map(c=>(0,e.jsx)(R,{id:c,label:m.graph.has(c)?b(m,c):t.named?.[c]??b(m,c),go:D(c),testId:"activity-record"},c))})]},`change:${g}`))}):null,(0,e.jsx)(de,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),o?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(Ce,{})]}):null]}):null]})}export{V as a,Ve as b};
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 N,g as se,h as de}from"./chunk.T4TRJDBF.js";import{a as R}from"./chunk.APUQIELA.js";import{a as ie,b as oe,c as re}from"./chunk.S6QZBWCJ.js";import{b}from"./chunk.LTOQ22ZJ.js";import{a as ae}from"./chunk.X36BYTEG.js";import{a as S,b as T,c as A,d as $}from"./chunk.U5P23GO7.js";import{a as C}from"./chunk.75JQCTR6.js";import{k as ne}from"./chunk.3FKKH2XU.js";import{G as X,J,Ka as Z,Q as H,R as q,Ta as ee,V as K,Xa as te,da as w,na as Q}from"./chunk.VLX7YWVH.js";import{a as _}from"./chunk.SDO3U72B.js";import{Ib as x,db as j,eb as E,ga as U,la as Y,ye as G}from"./chunk.IQGSEAQ2.js";import{b as z}from"./chunk.AJZBJBMO.js";var h=z(X(),1);var le=z(X(),1);function pe(){let{ai:n,aiDesk:a}=w(),{entries:o}=J(a),i=n.off===!0;return(0,le.useEffect)(()=>{i||a.load()},[a,i]),i?[]:o}var e=z(K(),1),ue=Z(_(()=>(__graviewPreload(import.meta.url,["./chunk.K2PXP5H6.js","./chunk.U5P23GO7.js","./chunk.GH5UBSQI.js","./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.B2YTHEX5.js")))),ve=ue.part((n,a)=>(0,e.jsx)(n.InteractionRow,{...a}),{quiet:!0,as:"li"}),me=ue.part((n,a)=>(0,e.jsx)(n.ActivityFilter,{...a}),{quiet:!0,as:"div"}),we=n=>n.undoes===void 0&&n.primitives.some(a=>a.op==="remove-node"||a.op==="patch-node"&&a.after[E]===!0&&a.before[E]!==!0);function ke(n){let a=[...new Set(n.ops.filter(o=>!x(o)&&we(o)).map(o=>o.intent))].filter(o=>o!==n.intent);return a.length===0?n.intent:`${n.intent} \u2014 ${a.join("; ")}`}var ge=(n,a,o=ce(n,[a]))=>({intent:ke(a),author:a.author.kind,...a.author.id?{authorId:a.author.id}:{},by:a.author,...a.ops[0]?.via?{via:a.ops[0].via}:{},...a.lineage?{basis:ae(a.lineage)}:{},touched:[...new Set(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes))],...xe(a.ops.filter(i=>!x(i)).flatMap(i=>i.writes),o),batch:a.id,at:a.at,...a.lineage?.interaction?{interaction:a.lineage.interaction}:{},seq:a.ops.at(-1).seq+1,...a.ops.every(x)?{withheld:!0}:{}});function be(n=4){let{store:a,principal:o}=w(),i=q(a,o),s=i.log.length;return(0,h.useMemo)(()=>{let d=i.batches(),l=ce(i,d);return oe(d,r=>i.log.get(r)).reverse().slice(0,n).map(r=>{if("batch"in r){let p=ge(i,r.batch,l);return r.typed?{...p,intent:ie(r.typed,i.schema,i.graph),batches:r.typed.batches.filter(k=>!k.undone).map(k=>k.id)}:p}let u=[...r.digest.batches].reverse().map(p=>ge(i,p,l));return{intent:re(r.digest),author:r.digest.author.kind,...r.digest.author.id?{authorId:r.digest.author.id}:{},by:r.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[i,s,n])}function ce(n,a){let o=new Map;for(let i of a)for(let s of i.ops)if(!x(s))for(let d of s.primitives)(d.op==="add-node"||d.op==="remove-node")&&d.node&&o.set(d.node.id,Y(n.schema.tryDefinition(d.node.kind),d.node));return o}function xe(n,a){let o={};for(let i of n){let s=a.get(i);s!==void 0&&(o[i]=s)}return Object.keys(o).length>0?{named:o}:{}}function Se({change:n}){let{store:a,principal:o,seats:i,people:s}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[n.author==="human"&&n.by?.onBehalfOf===void 0&&(n.authorId===void 0||o.id===void 0||n.authorId===o.id)?"you":j(n.by??{kind:n.author,id:n.authorId},{graph:a.graph,schema:a.schema,seats:i,people:s}),C(n.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(n.via)]}):null]})}function Ae({change:n,goes:a}){let{store:o}=w(),[i,s]=(0,h.useState)(!1),d=n.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{...S,gap:5},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)(Se,{change:n})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:n.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":i,onClick:()=>s(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:i?"Hide":"Show each"})]}),i?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:d.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(V,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:$,children:l.touched.slice(0,4).map(r=>(0,e.jsx)(R,{id:r,label:o.graph.has(r)?b(o,r):l.named?.[r]??b(o,r),go:a(r),testId:"activity-record"},r))}):null]},l.batch))}):null]})}function V({batch:n}){let{store:a,principal:o,noteSeat:i}=w(),s=q(a,o),d=H()?.open??!1,l=s.log.length,[r,u]=(0,h.useState)(null),p=(0,h.useMemo)(()=>s.canUndo(n),[s,n,l]),k=(0,h.useMemo)(()=>p.ok?s.mayUndo(n,o):{ok:!0},[s,n,l,o,p]);if(d||!p.ok&&p.ops.length===0||!k.ok)return null;let f=!p.ok,W=f?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:f?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof n=="string"?[n]:n,L=s.log.all().find(O=>v.includes(O.batch)&&O.author.kind==="agent");s.undo(f?[...v,...W]:typeof n=="string"?n:[...n],{author:o}),L&&i({type:"home",author:L.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...f?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:f?`undo +${W.length}`:"undo"}),r?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:r}):null]})}function Ie({seq:n,intent:a}){let o=H();if(!o)return null;let i=o.past?.seq===n;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${a}\u201D`,title:"Show the app as it was here","aria-pressed":i,onPointerEnter:N,onFocus:N,onClick:()=>o.show(n),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function Ce(){let n=()=>G(window.location.href);return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:a=>{a.preventDefault(),window.location.assign(n())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function Ve({calls:n,seat:a,remembers:o=!1}){let i=be(),{store:s,principal:d,seats:l,people:r}=w(),u=pe(),[p,k]=(0,h.useState)("all"),[f,W]=(0,h.useState)(!1),v=t=>t!==void 0&&(t.id===d.id||t.onBehalfOf?.id===d.id)&&d.id!==void 0,L=new Set(u.map(t=>t.id)),O=i.filter(t=>!(t.interaction!==void 0&&L.has(t.interaction))&&(!f||v(t.by))),he=u.filter(t=>!f||v(t.by)).slice(0,4),M=[...p==="ai"?[]:O.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:he.map(t=>({at:t.at,entry:t}))].sort((t,y)=>t.at<y.at?1:t.at>y.at?-1:0),m=q(s,d),B=n.some(t=>t.phase==="running"),ye=se(),I=te("activity"),F=I.open,fe=Q(),P=H(),D=t=>m.graph.has(t)?y=>{I.setOpen(!1),P?.past&&P.show(null),fe.record(y)}:null;return a===void 0&&n.length===0&&i.length===0&&u.length===0&&!o&&ye===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...I.trigger,onClick:I.toggle,title:B?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:B?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[B?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,i.length>0?i.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!F&&a!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:a}):null,F?(0,e.jsxs)("section",{...I.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...ee,width:"min(300px, calc(100vw - 16px))",maxHeight:"min(52cqh, 460px)",overflowX:"hidden",overflowY:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...ne,margin:0},children:"Activity"}),a!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:n.length>0||M.length>0?9:0,...n.length>0||M.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),a]}):null,n.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:n.slice(0,6).map((t,y)=>(0,e.jsxs)("li",{style:{...S,gap:2,fontSize:"0.8125rem"},children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{"data-graview-activity-words":"",style:{...A,color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??U(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(g=>(0,e.jsx)(R,{id:g,label:b(m,g),go:D(g),testId:"activity-record"},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,c])=>(0,e.jsx)(R,{id:c,label:b(m,c),go:D(c),testId:"activity-record"},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${y}`))}):null,u.length>0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(me,{shows:p,onShows:k,mine:f,onMine:W})}):null,M.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:M.map(({change:t,entry:y},g)=>y!==void 0?(0,e.jsx)(h.Suspense,{fallback:null,children:(0,e.jsx)(ve,{entry:y,undo:c=>(0,e.jsx)(V,{batch:c})})},`ai:${y.id}`):t.digest?(0,e.jsx)(Ae,{change:t,goes:D},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:S,children:(0,e.jsx)("span",{"data-touched":"",style:{...A,color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:S,children:[(0,e.jsxs)("div",{"data-graview-activity-head":"",style:T,children:[(0,e.jsxs)("span",{"data-graview-activity-words":"",style:A,children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||d.id===void 0||t.authorId===d.id)?"you":j(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:r}),C(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",C(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(Ie,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(V,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:$,children:t.touched.slice(0,4).map(c=>(0,e.jsx)(R,{id:c,label:m.graph.has(c)?b(m,c):t.named?.[c]??b(m,c),go:D(c),testId:"activity-record"},c))})]},`change:${g}`))}):null,(0,e.jsx)(de,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),o?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(Ce,{})]}):null]}):null]})}export{V as a,Ve as b};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.K2PXP5H6.js";import"./chunk.U5P23GO7.js";import"./chunk.GH5UBSQI.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
@@ -1 +1 @@
1
- import{e as $}from"./chunk.72YXFJKC.js";import{a as C}from"./chunk.57YDGGJK.js";import{l as M}from"./chunk.2KIWGQXC.js";import{Nb as x,la as k,ma as v,na as j}from"./chunk.Q4MI53KK.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
1
+ import{e as $}from"./chunk.DJIF7IAQ.js";import{a as C}from"./chunk.TQ2G4AM4.js";import{l as M}from"./chunk.5IEZF433.js";import{Nb as x,la as k,ma as v,na as j}from"./chunk.IQGSEAQ2.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
@@ -1 +1 @@
1
- import"./chunk.WVUJXDXZ.js";import{k as x}from"./chunk.XYGNS637.js";import"./chunk.DZSZUX34.js";import"./chunk.4EXC26LI.js";import"./chunk.PWAP2GJS.js";import"./chunk.AHPYNDVA.js";import"./chunk.FNVGNISQ.js";import"./chunk.D5LOTCBU.js";import{fb as f,hb as N,la as S}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
1
+ import"./chunk.WVUJXDXZ.js";import{k as x}from"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.5AD2QHWH.js";import{fb as f,hb as N,la as S}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
@@ -1 +1 @@
1
- import{d as K}from"./chunk.IEDCFSN5.js";import{Eb as h,Fb as v,Gc as $,Hc as N,Mb as V,h as P,k as R,oc as Y,pb as G,pc as X,q as I,sc as B,ta as q,x as _}from"./chunk.Q4MI53KK.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.UDYFGYJP.js";import{Eb as h,Fb as v,Gc as $,Hc as N,Mb as V,h as P,k as R,oc as Y,pb as G,pc as X,q as I,sc as B,ta as q,x as _}from"./chunk.IQGSEAQ2.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,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{b as ie}from"./chunk.OXWOUE3W.js";import{a as X,c as H,d as J,e as Q}from"./chunk.ZZAI57VI.js";import"./chunk.34DRUCH2.js";import"./chunk.KXFNRJ46.js";import"./chunk.OMRQTLI5.js";import"./chunk.MIE3ODQ2.js";import"./chunk.NEPQBMFT.js";import"./chunk.2PJ6STKA.js";import"./chunk.MBB5A6BT.js";import"./chunk.ERPILTRY.js";import"./chunk.H7AH3IW4.js";import"./chunk.U5P23GO7.js";import"./chunk.GZHZLJBF.js";import"./chunk.WUVXIUA7.js";import"./chunk.OJGHDWI6.js";import"./chunk.BN7C5ZYX.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import"./chunk.D5LOTCBU.js";import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{F as K,G as q,Ia as z,Ra as U,T as x,U as F,Va as Y,ba as b,c as j,x as V}from"./chunk.CYTTZOYL.js";import{a as N}from"./chunk.SDO3U72B.js";import{Ib as W,cb as _,db as D,ga as I,la as G,pa as B}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var ae=w(q(),1);function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var M=w(x(),1);function Z(){let{seats:e,principal:t,takeSeat:i}=b();return e.length<2?null:(0,M.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,M.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(a=>{let l=oe(t,a.principal);return(0,M.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...P(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function oe(e,t){return e.kind===t.kind&&e.id===t.id}var E=w(q(),1),c=w(x(),1),se=`
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{b as ie}from"./chunk.ATHLE33D.js";import{a as X,c as H,d as J,e as Q}from"./chunk.P4TAX3HE.js";import"./chunk.T4TRJDBF.js";import"./chunk.APUQIELA.js";import"./chunk.S6QZBWCJ.js";import"./chunk.LTOQ22ZJ.js";import"./chunk.2TCOLAL2.js";import"./chunk.2VYGDY5Z.js";import"./chunk.FUPYIOXZ.js";import"./chunk.3OEODIHB.js";import"./chunk.X36BYTEG.js";import"./chunk.U5P23GO7.js";import"./chunk.GZHZLJBF.js";import"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{F as K,G as q,Ka as z,Ta as U,V as x,W as F,Xa as Y,c as j,da as b,x as V}from"./chunk.VLX7YWVH.js";import{a as N}from"./chunk.SDO3U72B.js";import{Ib as W,cb as _,db as D,ga as I,la as G,pa as B}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var ae=w(q(),1);function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var M=w(x(),1);function Z(){let{seats:e,principal:t,takeSeat:i}=b();return e.length<2?null:(0,M.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,M.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(a=>{let l=oe(t,a.principal);return(0,M.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...P(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function oe(e,t){return e.kind===t.kind&&e.id===t.id}var E=w(q(),1),c=w(x(),1),se=`
2
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)}
@@ -6,4 +6,4 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
6
6
  .graview-here-mark[data-agent]{border-radius:5px}
7
7
  .graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
8
8
  .graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
9
- .graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=V(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=D(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(O,{one:r},r.participant))}):(0,c.jsx)(O,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(O,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function me(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function L(e,t,i,a,l,d){let s=me(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},ne=500,ye=10;function fe(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},L(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?L(t,p,l,d):L(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.KZUMXT5J.js","./chunk.CGK2PY76.js","./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.K7TK3KRB.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.CYTTZOYL.js","./chunk.SDO3U72B.js","./chunk.Q4MI53KK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WYPCLZL7.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(J,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>I(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Z,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:we}}),"Graview"]})]}):null]})})}var we='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',re={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
9
+ .graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=V(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=D(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(O,{one:r},r.participant))}):(0,c.jsx)(O,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(O,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function me(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function L(e,t,i,a,l,d){let s=me(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},ne=500,ye=10;function fe(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},L(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?L(t,p,l,d):L(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.3FKKH2XU.js","./chunk.DLWFULWE.js","./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UJNLT3L6.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.VLX7YWVH.js","./chunk.SDO3U72B.js","./chunk.IQGSEAQ2.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.YSBTE3PX.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(J,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>I(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Z,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:we}}),"Graview"]})]}):null]})})}var we='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',re={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
@@ -1,4 +1,4 @@
1
- import"./chunk.KZUMXT5J.js";import"./chunk.CGK2PY76.js";import{T as o,ba as n}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
1
+ import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{V as o,da as n}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
2
2
  .graview-map-key>div{display:flex;align-items:center;gap:8px}
3
3
  .graview-map-key>div:first-child{color:var(--graview-ink)}
4
4
  .graview-map-key i{flex:none;width:14px;height:10px;border-radius:2px;background:${e(i?34:42)}}
@@ -0,0 +1 @@
1
+ import{G as l,N as p,U as k,W as y,c}from"./chunk.KHXRJLLU.js";import"./chunk.GHHKRFPD.js";import"./chunk.6NRWLCIZ.js";import"./chunk.Q355UPFG.js";import{b as m}from"./chunk.ZQGLPP7A.js";import"./chunk.VZAF3452.js";import"./chunk.WHX47OJM.js";import"./chunk.QRT6BZR6.js";import"./chunk.2V7QTIAV.js";import"./chunk.Z26T5E76.js";import"./chunk.77JI5T4F.js";import"./chunk.SADHOSRC.js";import"./chunk.4DZOAB4D.js";import"./chunk.UDU545CL.js";import"./chunk.7VAHHEDX.js";import"./chunk.P4TAX3HE.js";import"./chunk.T4TRJDBF.js";import"./chunk.2TCOLAL2.js";import"./chunk.2VYGDY5Z.js";import"./chunk.FUPYIOXZ.js";import"./chunk.APRWUIE3.js";import"./chunk.3OEODIHB.js";import"./chunk.WFCE7NLK.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.ZA5TDCBC.js";import"./chunk.2JEN2RCB.js";import"./chunk.7CLKGKSF.js";import"./chunk.TMHVYI5R.js";import"./chunk.R5MLRKAO.js";import"./chunk.YMXWS4XN.js";import"./chunk.GZHZLJBF.js";import"./chunk.3SAESG6X.js";import"./chunk.OJGHDWI6.js";import"./chunk.F6BNFLQM.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import"./chunk.5AD2QHWH.js";import"./chunk.3FKKH2XU.js";import"./chunk.DLWFULWE.js";import{G as S,H as s,I as d,V as f,ea as g}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1,3 +1,3 @@
1
- import{b as te}from"./chunk.EJ4MSVX2.js";import"./chunk.REUMBCSV.js";import"./chunk.2KIWGQXC.js";import{c as ne}from"./chunk.D5LOTCBU.js";import{G as ge,T as ee}from"./chunk.CYTTZOYL.js";import"./chunk.SDO3U72B.js";import{la as X,na as Z,od as q}from"./chunk.Q4MI53KK.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var M=T(ge(),1);var ye=6;function re($,S,m,x,E){let t=new Set($),o=new Map;for(let i of S)for(let[h,l,b]of[[i.from,i.to,"out"],[i.to,i.from,"in"]]){if(!t.has(h)||t.has(l))continue;let f=m(l);if(f===void 0)continue;let p=`${h}|${i.kind}|${b}|${f}`,v=o.get(p);v?v.others.includes(l)||v.others.push(l):o.set(p,{self:h,edge:i.kind,direction:b,kind:f,others:[l]})}let d=[];for(let i of o.values()){let h=m(i.self)??"",l=ne(E,i.direction==="out"?h:i.kind,i.edge,i.direction);if(i.others.length>ye){d.push({...i,others:i.others,lands:"district",words:l});continue}let b=[],f=[];for(let p of i.others)(x(p)?b:f).push(p);for(let p of b)d.push({...i,others:[p],lands:"record",words:l});f.length>0&&d.push({...i,others:f,lands:"district",words:l})}return d}function ie($,S=[]){let m=[...S],x=new Map,E=t=>m.some(o=>t.x<o.x+o.width&&o.x<t.x+t.width&&t.y<o.y+o.height&&o.y<t.y+t.height);for(let t of[...$].sort((o,d)=>o.y-d.y||o.x-d.x)){let o={x:t.x-t.width/2,y:t.y-t.height,width:t.width,height:t.height};for(let d=0;d<12&&E(o);d++)o.y+=t.height+2;m.push(o),x.set(t.key,{x:o.x,y:o.y})}return x}var s=T(ee(),1),he=4;function xe({frame:$,width:S,height:m,stageRef:x,tick:E,store:t,graphVersion:o,selection:d,view:i,rulers:{visibleRect:h,clipQuadratic:l,unsureOf:b,unsureDash:f,unsureOpacity:p}}){let v=n=>t.graph.getNode(n)?.kind,C=te(d,i,v),R=C.lens===null&&C.records.length<=he?C.records:[],oe=R.join(`
1
+ import{b as te}from"./chunk.DQAMVVE6.js";import"./chunk.75JQCTR6.js";import"./chunk.5IEZF433.js";import{c as ne}from"./chunk.5AD2QHWH.js";import{G as ge,V as ee}from"./chunk.VLX7YWVH.js";import"./chunk.SDO3U72B.js";import{la as X,na as Z,qd as q}from"./chunk.IQGSEAQ2.js";import"./chunk.FQLNBIQ5.js";import{b as T}from"./chunk.AJZBJBMO.js";var M=T(ge(),1);var ye=6;function re($,S,m,x,E){let t=new Set($),o=new Map;for(let i of S)for(let[h,l,b]of[[i.from,i.to,"out"],[i.to,i.from,"in"]]){if(!t.has(h)||t.has(l))continue;let f=m(l);if(f===void 0)continue;let p=`${h}|${i.kind}|${b}|${f}`,v=o.get(p);v?v.others.includes(l)||v.others.push(l):o.set(p,{self:h,edge:i.kind,direction:b,kind:f,others:[l]})}let d=[];for(let i of o.values()){let h=m(i.self)??"",l=ne(E,i.direction==="out"?h:i.kind,i.edge,i.direction);if(i.others.length>ye){d.push({...i,others:i.others,lands:"district",words:l});continue}let b=[],f=[];for(let p of i.others)(x(p)?b:f).push(p);for(let p of b)d.push({...i,others:[p],lands:"record",words:l});f.length>0&&d.push({...i,others:f,lands:"district",words:l})}return d}function ie($,S=[]){let m=[...S],x=new Map,E=t=>m.some(o=>t.x<o.x+o.width&&o.x<t.x+t.width&&t.y<o.y+o.height&&o.y<t.y+t.height);for(let t of[...$].sort((o,d)=>o.y-d.y||o.x-d.x)){let o={x:t.x-t.width/2,y:t.y-t.height,width:t.width,height:t.height};for(let d=0;d<12&&E(o);d++)o.y+=t.height+2;m.push(o),x.set(t.key,{x:o.x,y:o.y})}return x}var s=T(ee(),1),he=4;function xe({frame:$,width:S,height:m,stageRef:x,tick:E,store:t,graphVersion:o,selection:d,view:i,rulers:{visibleRect:h,clipQuadratic:l,unsureOf:b,unsureDash:f,unsureOpacity:p}}){let v=n=>t.graph.getNode(n)?.kind,C=te(d,i,v),R=C.lens===null&&C.records.length<=he?C.records:[],oe=R.join(`
2
2
  `),[y,K]=(0,M.useState)(null);(0,M.useLayoutEffect)(()=>{let n=x.current;if(!i.overview||R.length===0||!n||typeof document>"u"||$.t<1){K(null);return}let w=n.getBoundingClientRect(),B=e=>({x:e.left-w.left,y:e.top-w.top,width:e.width,height:e.height}),D=new Map,se=R.map(e=>`[data-graview-view="${CSS.escape(e)}"]`).join(","),k=null,H=()=>{if(k)return k;k={drawn:new Map,buildings:new Map};for(let e of n.querySelectorAll("[data-graview-pick], [data-graview-view], [data-graview-building]")){let r=e.getAttribute("data-graview-pick"),a=e.getAttribute("data-graview-view");for(let c of r!==null&&r===a?[r]:[r,a]){if(c===null)continue;let u=k.drawn.get(c);u?u.push(e):k.drawn.set(c,[e])}let L=e.getAttribute("data-graview-building");L!==null&&!k.buildings.has(L)&&k.buildings.set(L,e)}return k},P=e=>{if(D.has(e))return D.get(e);let r=null;for(let a of H().drawn.get(e)??[])if(!a.closest("[data-graview-offstage], [data-graview-screen]")&&!(!R.includes(e)&&a.closest(se))&&(r=h(a,n),r))break;if(!r){let a=H().buildings.get(e);a&&(r=B(a.getBoundingClientRect()))}return D.set(e,r),r},W=e=>{let r=n.querySelector(`[data-graview-plot="kind:${CSS.escape(e)}"] .graview-plot-tile`);return r?B(r.getBoundingClientRect()):null},de=re(R,t.graph.allEdges(),v,e=>P(e)!==null,t.schema),z=[];for(let e of n.querySelectorAll('[data-graview-view^="kind:"] .graview-kind-face')){let r=h(e,n);r&&z.push(r)}let Q=e=>({x:e.x+e.width/2,y:e.y+e.height/2}),O=[],V=new Set(R),I=new Set;for(let e of de){let r=v(e.self),a=P(e.self)??(r?W(r):null),L=e.lands==="record"?P(e.others[0]):W(e.kind);if(!a||!L)continue;for(let g of e.others)V.add(g);I.add(e.kind),r&&I.add(r);let c=Q(a),u=Q(L),A=Math.hypot(u.x-c.x,u.y-c.y);if(A<6)continue;let G=Math.min(40,A*.12)*(O.length%2===0?1:-1),le={x:(c.x+u.x)/2-(u.y-c.y)/A*G,y:(c.y+u.y)/2+(u.x-c.x)/A*G},J=l({p0:c,c:le,p1:u},z);if(J.length===0)continue;let ce=J.map(g=>`M ${g.p0.x.toFixed(1)} ${g.p0.y.toFixed(1)} Q ${g.c.x.toFixed(1)} ${g.c.y.toFixed(1)} ${g.p1.x.toFixed(1)} ${g.p1.y.toFixed(1)}`).join(" "),ue=g=>{let j=t.graph.getNode(g);return j?X(t.schema.tryDefinition(j.kind),j):g},U=e.lands==="record"?`${e.words}: ${ue(e.others[0])}`:`${e.words}: ${Z(t.schema,e.kind,e.others.length)}`,F=e.others[0],_=e.lands==="record"?b?.(e.edge,e.direction==="out"?e.self:F,e.direction==="out"?F:e.self):void 0;O.push({key:`${e.self}|${e.edge}|${e.direction}|${e.lands}|${F}`,link:e,d:ce,end:u,said:_!==void 0?`${U} \xB7 unsure`:U,..._!==void 0?{unsure:_}:{}})}let Y=[];for(let e of n.querySelectorAll(".graview-kind-face[data-graview-nameplate]")){let r=h(e,n);r&&Y.push(r)}let ae=ie(O.map(e=>({key:e.key,x:e.end.x,y:e.end.y-6,width:Math.min(260,14+e.said.length*6.6),height:20})),Y);K({lines:O,labels:ae,reached:[...V],districts:[...I]})},[oe,i.overview,$,o,E,S,m,x,t]);let N=(0,M.useMemo)(()=>{if(!y)return"";let n=y.reached.map(B=>`[data-graview-building="${CSS.escape(B)}"]`).join(","),w=y.districts.map(B=>`[data-graview-plot="kind:${CSS.escape(B)}"]`).join(",");return[".graview-ground[data-graview-altitude] .graview-building { opacity: 0.22; }",n?`.graview-ground[data-graview-altitude] .graview-building:is(${n}) { opacity: 1; }`:"",w?`.graview-ground[data-graview-altitude] .graview-plot:not(:is(${w})) .graview-plot-tile { opacity: 0.4; }`:""].join(`
3
3
  `)},[y]);return!y||y.lines.length===0?N?(0,s.jsx)("style",{children:N}):null:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("style",{children:N}),(0,s.jsx)("svg",{className:"graview-record-links","data-graview-world":"","data-graview-record-links":y.lines.length,"aria-hidden":"true",width:S,height:m,style:{position:"absolute",left:0,top:0,pointerEvents:"none",zIndex:q.lines},children:y.lines.map(n=>(0,s.jsxs)("g",{className:"graview-record-link","data-graview-link":n.link.edge,"data-graview-lands":n.link.lands,"data-graview-direction":n.link.direction,"data-graview-provisional":n.unsure!==void 0||void 0,children:[(0,s.jsx)("path",{className:"graview-record-link-line",d:n.d,...n.unsure!==void 0?{strokeDasharray:f,strokeOpacity:p}:{}}),n.link.lands==="record"?(0,s.jsx)("circle",{className:"graview-record-link-end",cx:n.end.x,cy:n.end.y,r:3}):null]},n.key))}),(0,s.jsx)("div",{"aria-hidden":"true","data-graview-world":"",style:{position:"absolute",inset:0,pointerEvents:"none",zIndex:q.tieLabels},children:y.lines.map(n=>{let w=y.labels.get(n.key);return w?(0,s.jsx)("span",{className:"graview-record-link-said","data-graview-link-said":n.link.edge,"data-graview-lands":n.link.lands,...n.unsure!==void 0?{title:n.unsure}:{},style:{position:"absolute",left:w.x,top:w.y,...n.unsure!==void 0?{pointerEvents:"auto"}:{}},children:n.said},n.key):null})})]})}export{xe as RecordLinks};