graview 0.1.55 → 0.1.56

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 (180) hide show
  1. package/dist/preview/{chunk.YGZGMRDC.js → chunk.22MIRLL6.js} +1 -1
  2. package/dist/preview/chunk.2BLRCT3E.js +1 -0
  3. package/dist/preview/chunk.2DETYEJM.js +1 -0
  4. package/dist/preview/{chunk.5EOSEVZB.js → chunk.2E6EWVWR.js} +1 -1
  5. package/dist/preview/{chunk.JRRVLGEK.js → chunk.2HZGUVB2.js} +1 -1
  6. package/dist/preview/{chunk.G5XTASMO.js → chunk.2OX4YI46.js} +1 -1
  7. package/dist/preview/{chunk.4OMSQFIY.js → chunk.2YNZVNCA.js} +1 -1
  8. package/dist/preview/chunk.3V2WH6F7.js +1 -0
  9. package/dist/preview/chunk.3X3GLNWQ.js +1 -0
  10. package/dist/preview/{chunk.FTW3K3G6.js → chunk.45VIF2SX.js} +2 -2
  11. package/dist/preview/{chunk.QWICAV2C.js → chunk.4EUH6TLG.js} +2 -2
  12. package/dist/preview/{chunk.35O5H5L7.js → chunk.4EY6WPSM.js} +2 -2
  13. package/dist/preview/{chunk.7Y6NK5CT.js → chunk.4KMY24YC.js} +1 -1
  14. package/dist/preview/chunk.4YI6656P.js +1 -0
  15. package/dist/preview/{chunk.XSMXSNDR.js → chunk.5B4HNQGR.js} +1 -1
  16. package/dist/preview/{chunk.P4ZZSFOQ.js → chunk.5MS2TQFX.js} +1 -1
  17. package/dist/preview/chunk.5MSWUTDB.js +1 -0
  18. package/dist/preview/{chunk.ATXSLBE3.js → chunk.64IKLRUS.js} +1 -1
  19. package/dist/preview/{chunk.6NQQUIBX.js → chunk.65Q5MKDW.js} +1 -1
  20. package/dist/preview/{chunk.KVQZ5FR6.js → chunk.6HLKAUWF.js} +1 -1
  21. package/dist/preview/chunk.6Q6BW4QT.js +2 -0
  22. package/dist/preview/{chunk.XTP5DGPJ.js → chunk.7NP2I2UP.js} +1 -1
  23. package/dist/preview/{chunk.FUZWXKTN.js → chunk.7O6Z3BFR.js} +1 -1
  24. package/dist/preview/chunk.7RJGEU3Y.js +1 -0
  25. package/dist/preview/{chunk.T66UK7PQ.js → chunk.7U2JO7ET.js} +1 -1
  26. package/dist/preview/chunk.7Z2PRPYE.js +1 -0
  27. package/dist/preview/{chunk.DBCVZGCC.js → chunk.7Z4USR3Y.js} +1 -1
  28. package/dist/preview/chunk.AGTFYPXY.js +1 -0
  29. package/dist/preview/{chunk.QIAH7HHO.js → chunk.AIK3Z25Y.js} +1 -1
  30. package/dist/preview/{chunk.XUHY4XO2.js → chunk.AKVBU5K5.js} +1 -1
  31. package/dist/preview/chunk.AKW6NR3X.js +1 -0
  32. package/dist/preview/{chunk.ZPXAKRKG.js → chunk.AM2YRNOQ.js} +1 -1
  33. package/dist/preview/{chunk.YRFN4VDD.js → chunk.APXYWI3L.js} +1 -1
  34. package/dist/preview/{chunk.HXR7EEXR.js → chunk.AQCU6TPV.js} +1 -1
  35. package/dist/preview/{chunk.YYWANGIC.js → chunk.AZUTYY2S.js} +1 -1
  36. package/dist/preview/{chunk.PIHCXN5U.js → chunk.BNEOLRQG.js} +1 -1
  37. package/dist/preview/chunk.BT7RLFPO.js +1 -0
  38. package/dist/preview/{chunk.DB3HOKZD.js → chunk.C2VFDBSG.js} +1 -1
  39. package/dist/preview/{chunk.62LPYPP3.js → chunk.CGM7OER2.js} +1 -1
  40. package/dist/preview/{chunk.DNJM6WQO.js → chunk.CKV2QCH5.js} +1 -1
  41. package/dist/preview/{chunk.NDLQXQV2.js → chunk.CU2NQ5WF.js} +1 -1
  42. package/dist/preview/{chunk.SUGOENC4.js → chunk.D4LN33J2.js} +1 -1
  43. package/dist/preview/{chunk.OT6EWYK2.js → chunk.D6BMAGPR.js} +1 -1
  44. package/dist/preview/{chunk.27ZSRO3O.js → chunk.D6KF72MZ.js} +1 -1
  45. package/dist/preview/{chunk.2SWQI4HF.js → chunk.DH7M57SE.js} +1 -1
  46. package/dist/preview/chunk.DPPT6WAJ.js +2 -0
  47. package/dist/preview/{chunk.6UAUME5U.js → chunk.DTSTUC2W.js} +1 -1
  48. package/dist/preview/{chunk.AFK5HHLL.js → chunk.DWMAFMYZ.js} +1 -1
  49. package/dist/preview/chunk.DZYLH5IM.js +1 -0
  50. package/dist/preview/{chunk.WUFCRE7O.js → chunk.E33EJU3Q.js} +1 -1
  51. package/dist/preview/{chunk.TAQB64FZ.js → chunk.E4EN4X5F.js} +1 -1
  52. package/dist/preview/{chunk.TUBAFVV4.js → chunk.E4HSSGF7.js} +1 -1
  53. package/dist/preview/{chunk.OL2N5NUV.js → chunk.E5XNQTEU.js} +1 -1
  54. package/dist/preview/{chunk.PIQ52FCI.js → chunk.EC5IWN74.js} +2 -2
  55. package/dist/preview/chunk.FBR4HJ2Q.js +1 -0
  56. package/dist/preview/{chunk.2HANQ737.js → chunk.FCUDBMGC.js} +1 -1
  57. package/dist/preview/chunk.FOQENWF5.js +1 -0
  58. package/dist/preview/{chunk.FUS2FJS3.js → chunk.G3ORIU7C.js} +1 -1
  59. package/dist/preview/chunk.GNQW4JOG.js +18 -0
  60. package/dist/preview/chunk.GUP7LC5O.js +21 -0
  61. package/dist/preview/{chunk.LMXNHBGH.js → chunk.HFVMGTNL.js} +2 -2
  62. package/dist/preview/chunk.HVN2DVP3.js +1 -0
  63. package/dist/preview/{chunk.YOBRVKJT.js → chunk.I2C5LPB5.js} +1 -1
  64. package/dist/preview/{chunk.LQCH2NFE.js → chunk.IF4FCQPG.js} +1 -1
  65. package/dist/preview/{chunk.K5WPS4RR.js → chunk.ILSK2E3R.js} +1 -1
  66. package/dist/preview/{chunk.RPVJ5IXD.js → chunk.IRMO4FUC.js} +1 -1
  67. package/dist/preview/chunk.IT763BYH.js +1 -0
  68. package/dist/preview/{chunk.QBMIET7P.js → chunk.IUQOSPQX.js} +1 -1
  69. package/dist/preview/{chunk.SIABGHF2.js → chunk.J3YBEZKE.js} +1 -1
  70. package/dist/preview/{chunk.4BFJWNVM.js → chunk.JHFHIG4P.js} +1 -1
  71. package/dist/preview/chunk.JL4DGITZ.js +1 -0
  72. package/dist/preview/{chunk.EJXUOL2C.js → chunk.JQY2UKU6.js} +1 -1
  73. package/dist/preview/{chunk.IXHLP2CL.js → chunk.JZDKHWRL.js} +1 -1
  74. package/dist/preview/{chunk.AFEEXRN3.js → chunk.K2JE3PD7.js} +1 -1
  75. package/dist/preview/chunk.K4MO22RM.js +1 -0
  76. package/dist/preview/{chunk.5DPFAVCZ.js → chunk.K5YLQAFW.js} +1 -1
  77. package/dist/preview/{chunk.CM2ETM2A.js → chunk.KBL4Y4UN.js} +1 -1
  78. package/dist/preview/chunk.KMEKMCKG.js +3 -0
  79. package/dist/preview/{chunk.ZOW7AC7U.js → chunk.LKK7VQBA.js} +1 -1
  80. package/dist/preview/chunk.LLOZKUCA.js +1 -0
  81. package/dist/preview/{chunk.QJ42D5GM.js → chunk.LP3SHWJG.js} +1 -1
  82. package/dist/preview/chunk.LVOVPU64.js +1 -0
  83. package/dist/preview/chunk.MEJUAV3Y.js +1 -0
  84. package/dist/preview/{chunk.PCKX2FHR.js → chunk.MFDSWA2W.js} +1 -1
  85. package/dist/preview/{chunk.U5AX4DD5.js → chunk.MJMVGW6Z.js} +1 -1
  86. package/dist/preview/{chunk.7WEQHJ3N.js → chunk.MLRPCZVS.js} +1 -1
  87. package/dist/preview/{chunk.Y3BEKXYB.js → chunk.MORMTKVR.js} +1 -1
  88. package/dist/preview/{chunk.O752PM42.js → chunk.N3Q5CPVA.js} +1 -1
  89. package/dist/preview/{chunk.AVVNQKA7.js → chunk.N7EEPFYV.js} +1 -1
  90. package/dist/preview/{chunk.PM64C5PX.js → chunk.NBLMANHT.js} +1 -1
  91. package/dist/preview/{chunk.6ZJE5M2A.js → chunk.NFU4UM6F.js} +1 -1
  92. package/dist/preview/{chunk.WSMYFEGU.js → chunk.NPAWTPLQ.js} +1 -1
  93. package/dist/preview/{chunk.4TLWZVVG.js → chunk.NQ4VGKEC.js} +1 -1
  94. package/dist/preview/{chunk.TT6GKRBE.js → chunk.NUE5VG4G.js} +1 -1
  95. package/dist/preview/{chunk.MFCBAQS3.js → chunk.O6LDZWLR.js} +1 -1
  96. package/dist/preview/chunk.OBUKZQCZ.js +1 -0
  97. package/dist/preview/{chunk.RZQKCLTW.js → chunk.ONGZ3YQF.js} +1 -1
  98. package/dist/preview/chunk.OYGPNO7A.js +1 -0
  99. package/dist/preview/chunk.PJCVFYFU.js +1 -0
  100. package/dist/preview/{chunk.5MCXTY2P.js → chunk.PMPDLE56.js} +1 -1
  101. package/dist/preview/{chunk.HXHFWZ2U.js → chunk.PRV3KYT6.js} +2 -2
  102. package/dist/preview/chunk.Q7X2IVLH.js +1 -0
  103. package/dist/preview/chunk.QAIYYIZQ.js +1 -0
  104. package/dist/preview/{chunk.PSLCI3GO.js → chunk.QNNRSPIJ.js} +1 -1
  105. package/dist/preview/{chunk.5L4J2XAI.js → chunk.QSO5BP2H.js} +1 -1
  106. package/dist/preview/{chunk.LYVRXRIH.js → chunk.QW3QLE53.js} +1 -1
  107. package/dist/preview/{chunk.USJ4J3GL.js → chunk.QYFZ7AZS.js} +2 -2
  108. package/dist/preview/{chunk.BRCKXL7B.js → chunk.RDL6652E.js} +1 -1
  109. package/dist/preview/{chunk.INBHY3SA.js → chunk.RR2IFETZ.js} +1 -1
  110. package/dist/preview/{chunk.NXM73RZA.js → chunk.RXYE2DAJ.js} +1 -1
  111. package/dist/preview/chunk.SOTB6C5A.js +1 -0
  112. package/dist/preview/{chunk.KHJ2MCMS.js → chunk.SRC37GNP.js} +1 -1
  113. package/dist/preview/{chunk.PHLMQO7V.js → chunk.SVAQGVS4.js} +1 -1
  114. package/dist/preview/chunk.T2RME6XF.js +1 -0
  115. package/dist/preview/{chunk.ZAHVKXYQ.js → chunk.T6HG2XIP.js} +1 -1
  116. package/dist/preview/{chunk.354A4QCG.js → chunk.TAIYNHSW.js} +1 -1
  117. package/dist/preview/chunk.TAJ2R44N.js +1 -0
  118. package/dist/preview/{chunk.5MSNKSTE.js → chunk.TQCRFZ53.js} +1 -1
  119. package/dist/preview/{chunk.RNYLNBIB.js → chunk.TXWCTHMI.js} +1 -1
  120. package/dist/preview/chunk.UE5YS3GN.js +1 -0
  121. package/dist/preview/{chunk.MFOSEOF4.js → chunk.UQQAGT3R.js} +1 -1
  122. package/dist/preview/chunk.USB6B6L3.js +104 -0
  123. package/dist/preview/{chunk.EKP3HQAX.js → chunk.USQNSNIA.js} +1 -1
  124. package/dist/preview/{chunk.CPNE6HPQ.js → chunk.V3NPUAPB.js} +1 -1
  125. package/dist/preview/{chunk.ZXOD5GM3.js → chunk.VDD3RHLB.js} +1 -1
  126. package/dist/preview/{chunk.O7RMVGAB.js → chunk.VEOS25PQ.js} +1 -1
  127. package/dist/preview/chunk.VIQ6EF2O.js +1 -0
  128. package/dist/preview/{chunk.UE5GAP67.js → chunk.VLBY66PB.js} +2 -2
  129. package/dist/preview/{chunk.OS5EALHY.js → chunk.VSM72NVF.js} +1 -1
  130. package/dist/preview/{chunk.WVKXELAF.js → chunk.VYW7DSUW.js} +2 -2
  131. package/dist/preview/{chunk.2KH2LWZL.js → chunk.WMB2NNBD.js} +1 -1
  132. package/dist/preview/{chunk.5SANELJT.js → chunk.WPJVMVAL.js} +1 -1
  133. package/dist/preview/{chunk.TDV7JGIQ.js → chunk.XGCOWCA2.js} +1 -1
  134. package/dist/preview/chunk.XJFAUOJS.js +1 -0
  135. package/dist/preview/{chunk.EGSE6NNE.js → chunk.XY5EVI22.js} +1 -1
  136. package/dist/preview/chunk.YEJ4LNUP.js +5 -0
  137. package/dist/preview/{chunk.6JYNNPAI.js → chunk.YL5ZCRHQ.js} +1 -1
  138. package/dist/preview/{chunk.DH4AC7TC.js → chunk.YLMOGGEP.js} +1 -1
  139. package/dist/preview/{chunk.V5PAFSWP.js → chunk.ZFXHZZHW.js} +1 -1
  140. package/dist/preview/index.html +50 -50
  141. package/dist/preview/page.js +2 -2
  142. package/package.json +6 -6
  143. package/dist/preview/chunk.2ORJGMRT.js +0 -104
  144. package/dist/preview/chunk.3IZOXNJH.js +0 -1
  145. package/dist/preview/chunk.5D6SIBOK.js +0 -1
  146. package/dist/preview/chunk.5EZDXWOE.js +0 -1
  147. package/dist/preview/chunk.5XUVCM7X.js +0 -1
  148. package/dist/preview/chunk.6NGSR2ZQ.js +0 -1
  149. package/dist/preview/chunk.7KERB5CH.js +0 -1
  150. package/dist/preview/chunk.AVNOLMCV.js +0 -1
  151. package/dist/preview/chunk.AZ6Q3WT2.js +0 -1
  152. package/dist/preview/chunk.DKJK2MMV.js +0 -2
  153. package/dist/preview/chunk.DU75P3Y7.js +0 -1
  154. package/dist/preview/chunk.DXJFAAOI.js +0 -1
  155. package/dist/preview/chunk.FVOFTM5J.js +0 -1
  156. package/dist/preview/chunk.G2XDQPE4.js +0 -1
  157. package/dist/preview/chunk.H536YUAZ.js +0 -3
  158. package/dist/preview/chunk.HNJFBI7J.js +0 -1
  159. package/dist/preview/chunk.HUABTCQE.js +0 -1
  160. package/dist/preview/chunk.KIMIPHAI.js +0 -1
  161. package/dist/preview/chunk.KXNWZ33P.js +0 -1
  162. package/dist/preview/chunk.LEPKPNPA.js +0 -1
  163. package/dist/preview/chunk.LLXEWLIP.js +0 -1
  164. package/dist/preview/chunk.LWLI5PI4.js +0 -1
  165. package/dist/preview/chunk.MIQMPOWF.js +0 -2
  166. package/dist/preview/chunk.MNSKBGRM.js +0 -1
  167. package/dist/preview/chunk.MSM6E6JK.js +0 -1
  168. package/dist/preview/chunk.NS6KWKF5.js +0 -1
  169. package/dist/preview/chunk.OIMYSR2J.js +0 -1
  170. package/dist/preview/chunk.QQ3YWKWU.js +0 -1
  171. package/dist/preview/chunk.R3ZS4QO6.js +0 -18
  172. package/dist/preview/chunk.SG67ID6C.js +0 -1
  173. package/dist/preview/chunk.SYX7AEHU.js +0 -1
  174. package/dist/preview/chunk.TEE23CVQ.js +0 -1
  175. package/dist/preview/chunk.TZTRGNAA.js +0 -1
  176. package/dist/preview/chunk.UADL2LHO.js +0 -1
  177. package/dist/preview/chunk.URDCHVH3.js +0 -21
  178. package/dist/preview/chunk.WR63RQGU.js +0 -5
  179. package/dist/preview/chunk.XEHLSKHP.js +0 -1
  180. package/dist/preview/chunk.YG2WZO53.js +0 -1
@@ -1 +1 @@
1
- import{q as ce}from"./chunk.MSM6E6JK.js";import{a as Z,b as C,c as ee,d as te,g as oe,j as re,k as P,l as se,p as le,s as de}from"./chunk.35O5H5L7.js";import"./chunk.BJUUSIQY.js";import{a as ie,b as ne,c as ae}from"./chunk.BRCKXL7B.js";import"./chunk.CPNE6HPQ.js";import"./chunk.EKP3HQAX.js";import"./chunk.XOZU4OFA.js";import"./chunk.QQ3YWKWU.js";import{a as X}from"./chunk.IXHLP2CL.js";import"./chunk.DXJFAAOI.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import{c as _,j as J}from"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as me,J as U,T as V,ba as j}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{Rc as Y,ha as B}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var a=O(me(),1);var d=O(V(),1),ke=new Set(["show","go","to","open","the","a","an","me"]),ge=r=>r.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,""),W=(r,p)=>{let s=ge(r);return p.every(t=>s.includes(t))},pe=r=>r&&!/^.\p{Lu}/u.test(r)?`${r[0].toLowerCase()}${r.slice(1)}`:r,L={act:4,show:3,place:3,record:4},we=360,h=12;function De({face:r,opening:p,close:s}){let t=X(),{setMenuAt:v}=j(),n=(0,a.useMemo)(()=>p.target??Z(p.pointed??{about:[]},e=>t.store.graph.has(e)),[p,t.store]),f=(0,a.useMemo)(()=>oe(t.store,n,t.places),[t.store,n,t.places]),[u,y]=(0,a.useState)(""),[b,m]=(0,a.useState)(-1),[l,$]=(0,a.useState)(null),[A,I]=(0,a.useState)(null),E=(0,a.useRef)(null),z=(0,a.useRef)(null),T=(0,a.useId)(),R=(0,a.useRef)(!0),{ghost:G}=U(t.desk);(0,a.useEffect)(()=>()=>{R.current=!1;let e=t.desk.get().ghost;e?.onCard&&t.desk.setGhost({...e,onCard:!1})},[t.desk]);let M=(0,a.useMemo)(()=>{let e=P(t,n);return ee(t.store,n,{principal:t.principal,places:t.places,...e.acts?{acts:e.acts}:{}})},[t,n]),K=(0,a.useMemo)(()=>{let e=C(n);if(e.length===0)return[];let i=new Set(M.candidates.flatMap(c=>c.type==="act"?[c.mutation]:[]));return ie(t.store,e,{principal:t.principal,...e.length===1?{focus:e[0]}:{}}).affordances.filter(c=>!c.destructive&&i.has(c.mutation))},[t.store,t.principal,n,M]),q=(0,a.useCallback)(()=>{let e=p.returnTo,i=ue(E.current,n,r);s(),requestAnimationFrame(()=>{if(e?.isConnected&&!e.closest("[inert]"))return e.focus({preventScroll:!0});let c=(i&&i.tabIndex>=0?i:null)??document.querySelector("[data-graview-page-title]")??document.querySelector("main");c&&c.tabIndex<0&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","-1"),c?.focus({preventScroll:!0})})},[p.returnTo,n,r,s]),F=(0,a.useCallback)(e=>{if(e.open.length>0){let i=E.current?.getBoundingClientRect();s(),v({x:i?.left??0,y:i?.top??0,on:e.args.id??C(n)[0],about:C(n)});return}try{ae(t.store,e,{},{pressed:t.principal?{author:t.principal}:{}}),ne(t.store,e,{},{author:t.principal}),q()}catch(i){I(i instanceof Error?i.message:String(i))}},[t.store,t.principal,s,q,v,n]),H=(0,a.useCallback)(async e=>{let i=e.trim();if(!i)return;let c=l?.result?.answer?{said:l.said,answer:l.result.answer}:void 0;y(""),m(-1),I(null),$({said:i,result:null});let S=await re(t.ai,{...P(t,n,i),said:i,...c?{follows:c}:{}});t.desk.record(S.interaction),S.ghost&&S.ghost.proposals.length>0&&t.desk.setGhost({ghost:S.ghost,onCard:!0}),R.current&&$({said:i,result:S})},[l,t,n]),N=(0,a.useRef)(p.asked);(0,a.useEffect)(()=>{let e=N.current;N.current=void 0,e&&H(e)},[]);let k=(0,a.useMemo)(()=>{let e=u.trim();if(!e&&l)return[];let i=ge(e).split(/\s+/).filter(o=>o&&!ke.has(o)),c=/^show\b/i.test(e),S=/^(go|open)\b/i.test(e),x=[];if(!c&&!S)for(let o of K.filter(g=>W(g.label,i)).slice(0,L.act))x.push({id:`act:${o.id}`,kind:"act",label:o.label,hint:o.open.length>0?"asks more":"do it",take:()=>F(o)});let Q=e&&!/\?\s*$/.test(e)?te(t.store,n,{principal:t.principal,places:t.places,said:e}):[];for(let o of Q)x.push({id:`place:${o.place}`,kind:"place",label:o.fit==="full"?`Open ${o.title}`:`Open and adjust ${o.title}`,hint:o.fit==="full"?"a view you have":"adjust it",take:()=>{s(),t.goTo.place(o.place),o.fit==="partial"&&_(t.desk,{target:{on:"lens",place:o.place,...o.kind?{kind:o.kind}:{}},asked:e})}});if(!S){let o=M.candidates.filter(g=>g.type==="panel");for(let g of o.filter(D=>W(`show ${D.label}`,i)).slice(0,L.show))x.push({id:g.id,kind:"show",label:`Show ${pe(g.label)}`,hint:"a panel",take:()=>{s(),se(t,{title:g.label,recipe:{...g.panel,title:g.label}})}})}if(!c){for(let o of t.places.filter(g=>W(g.title,i)&&!Q.some(D=>D.place===g.as)).slice(0,L.place))x.push({id:`place:${o.as}`,kind:"place",label:`Go to ${o.title}`,take:()=>(s(),t.goTo.place(o.as))});if(i.length>0){let o=ce(t.store,e.replace(/^(go to|open)\s+/i,""),{principal:t.principal,from:C(n),limit:L.record}).hits;for(let g of o)g.about==="node"&&x.push({id:`record:${g.id}`,kind:"record",label:g.label,hint:B(t.store.schema,g.kind),take:()=>(s(),t.goTo.record(g.id))})}}return e&&x.push({id:"ask",kind:"ask",label:e,take:()=>void H(e)}),x},[u,K,M,t,n,F,H,s,l]);(0,a.useEffect)(()=>m(u.trim()?0:-1),[u]),(0,a.useLayoutEffect)(()=>{let e=E.current;if(!e)return;if(typeof e.showPopover=="function")try{e.showPopover()}catch{}z.current?.focus({preventScroll:!0});let i=0,c=()=>{be(e,ue(e,n,r)),i=requestAnimationFrame(c)};return c(),()=>cancelAnimationFrame(i)},[n,r]),(0,a.useEffect)(()=>{if(l)return;let e=i=>{i.target instanceof Node&&E.current?.contains(i.target)||s()};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[l,s]);let fe=e=>{if(e.key==="ArrowDown"&&k.length>0)e.preventDefault(),m(i=>Math.min(k.length-1,i+1));else if(e.key==="ArrowUp"&&k.length>0)e.preventDefault(),m(i=>Math.max(0,i-1));else if(e.key==="Enter"){e.preventDefault();let i=k[b];i?i.take():u.trim()&&H(u)}},w=l?.result??null,he=k[b];return(0,d.jsxs)("section",{ref:E,popover:"manual",role:"region","aria-label":l?`Answer about ${f}`:`Ask about ${f}`,"data-testid":"quick-ask","data-quick-ask":l?"answer":"bar","data-quick-ask-face":r,"data-graview-offstage":"","data-graview-overlay":"",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),q())},onMouseDown:e=>e.stopPropagation(),style:ve,children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-ask-about",style:{margin:0,flex:"1 1 auto",minWidth:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},children:["About ",f]}),(0,d.jsx)("button",{type:"button","data-testid":"quick-ask-close","aria-label":"Close",title:"Close",onClick:q,style:ye,children:(0,d.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),l?(0,d.jsxs)("div",{"data-testid":"quick-answer",style:{display:"grid",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-answer-asked",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",fontStyle:"italic",overflowWrap:"anywhere"},children:["\u201C",l.said,"\u201D"]}),(0,d.jsx)("p",{"data-testid":"quick-answer-text","aria-live":"polite",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:w?.interaction.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)",overflowWrap:"anywhere"},children:w===null?"Thinking\u2026":w.interaction.outcome==="failed"?w.interaction.failed??"The AI could not answer that here.":w.answer??""}),w&&w.offers.length>0?(0,d.jsx)("ul",{"aria-label":"What acts on it",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:w.offers.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button","data-testid":"quick-answer-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>{le(t,w,e,s).then(i=>{i&&R.current&&I(i)})},style:xe,children:e.type==="panel"?`Show ${pe(e.label)}`:e.type==="place"?`Go to ${e.label}`:e.label})},e.id))}):null,G?.onCard&&G.ghost.interaction===w?.interaction.id?(0,d.jsx)(de,{placement:"card"}):null]}):null,(0,d.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,d.jsx)("input",{ref:z,type:"text",role:"combobox","data-testid":"quick-ask-input","aria-label":l?`Ask a follow-up about ${f}`:`Ask about ${f}, or go somewhere`,"aria-expanded":k.length>0,"aria-controls":T,"aria-autocomplete":"list",...he?{"aria-activedescendant":`${T}-${b}`}:{},autoComplete:"off",enterKeyHint:"go",placeholder:l?"Ask a follow-up\u2026":"Ask, or go to\u2026",value:u,readOnly:l!==null&&w===null,"aria-busy":l!==null&&w===null,onChange:e=>y(e.target.value),onKeyDown:fe,style:Ae}),(0,d.jsx)("div",{id:T,role:"listbox","aria-label":u.trim()?`What \u201C${u.trim()}\u201D finds here`:"What can be done here",hidden:k.length===0,style:{display:k.length===0?"none":"grid",gap:1,maxHeight:280,overflowY:"auto"},children:k.map((e,i)=>(0,d.jsx)("div",{id:`${T}-${i}`,role:"option","aria-selected":i===b,"data-testid":"quick-ask-option","data-quick-ask-kind":e.kind,"data-quick-ask-row":e.id,onMouseEnter:()=>m(i),onMouseDown:c=>c.preventDefault(),onClick:e.take,style:{...Se,background:i===b?"var(--graview-panel-muted)":"transparent",...e.kind==="ask"?{borderTop:"1px solid var(--graview-edge)",marginTop:2}:{}},children:e.kind==="ask"?(0,d.jsxs)("span",{children:["Ask: ",(0,d.jsxs)("span",{style:{fontWeight:600},children:["\u2018",e.label,"\u2019"]})]}):(0,d.jsxs)("span",{children:[e.label,e.hint?(0,d.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.hint]}):null]})},e.id))})]}),A?(0,d.jsx)("p",{role:"alert","data-testid":"quick-ask-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:A}):null,(0,d.jsx)("span",{style:J,"aria-live":"polite",children:k.length>0&&u.trim()?`${k.length} ${k.length===1?"way":"ways"} to go on`:""})]})}function ue(r,p,s){let t=r?.closest("[data-graview-embed]")??document,v=p.on==="list"?[`aggregate:${p.kind}`,`kind:${p.kind}`]:p.on==="lens"&&p.kind?[`aggregate:${p.kind}`]:C(p);for(let n of v)for(let f of t.querySelectorAll(`[data-graview-view="${CSS.escape(n)}"], [data-graview-pick="${CSS.escape(n)}"]`)){if(r?.contains(f))continue;let u=f.getBoundingClientRect();if(u.width>0&&u.height>0)return f}return s==="pages"?t.querySelector("main [data-graview-page-title]")??t.querySelector("main h1"):null}function be(r,p){let s={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},t=Math.min(we,s.width-2*h),v=r.getBoundingClientRect().height,n=p?.getBoundingClientRect(),f,u,y,b=A=>Math.max(h,Math.min(A,s.height-v-h));if(n&&n.width>0&&n.bottom>0&&n.top<s.height)if(n.right+h+t<=s.width-h)f=n.right+h,u=b(n.top),y="right";else if(n.left-h-t>=h)f=n.left-h-t,u=b(n.top),y="left";else{f=Math.max(h,Math.min(n.left,s.width-t-h));let A=n.bottom+h;u=A+v<=s.height-h?A:b(n.top-h-v),y=A+v<=s.height-h?"below":"above"}else f=(s.width-t)/2,u=b(72),y="top";let m=r.style,l={left:`${Math.round(f)}px`,top:`${Math.round(u)}px`,width:`${Math.round(t)}px`};m.left!==l.left&&(m.left=l.left),m.top!==l.top&&(m.top=l.top),m.width!==l.width&&(m.width=l.width);let $=p?.getAttribute("data-graview-view")??p?.getAttribute("data-graview-pick")??(p?"page":"");r.getAttribute("data-quick-ask-beside")!==$&&r.setAttribute("data-quick-ask-beside",$),r.getAttribute("data-quick-ask-side")!==y&&r.setAttribute("data-quick-ask-side",y)}var ve={position:"fixed",inset:"auto",margin:0,zIndex:Y("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},ye={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"},Ae={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},Se={display:"flex",alignItems:"center",minHeight:30,padding:"4px 8px",borderRadius:6,cursor:"pointer",overflowWrap:"anywhere"},xe={display:"inline-flex",alignItems:"center",minHeight:30,padding:"2px 10px",font:"inherit",fontSize:"0.8125rem",borderRadius:8};export{De as QuickAskCard};
1
+ import{q as ce}from"./chunk.7RJGEU3Y.js";import{a as Z,b as C,c as ee,d as te,g as oe,j as re,k as P,l as se,p as le,s as de}from"./chunk.4EY6WPSM.js";import"./chunk.BJUUSIQY.js";import{a as ie,b as ne,c as ae}from"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import"./chunk.USQNSNIA.js";import"./chunk.XOZU4OFA.js";import"./chunk.IT763BYH.js";import{a as X}from"./chunk.JZDKHWRL.js";import"./chunk.SOTB6C5A.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import{c as _,j as J}from"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as me,J as U,T as V,ba as j}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import{Vc as Y,ja as B}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var a=O(me(),1);var d=O(V(),1),ke=new Set(["show","go","to","open","the","a","an","me"]),ge=r=>r.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,""),W=(r,p)=>{let s=ge(r);return p.every(t=>s.includes(t))},pe=r=>r&&!/^.\p{Lu}/u.test(r)?`${r[0].toLowerCase()}${r.slice(1)}`:r,L={act:4,show:3,place:3,record:4},we=360,h=12;function De({face:r,opening:p,close:s}){let t=X(),{setMenuAt:v}=j(),n=(0,a.useMemo)(()=>p.target??Z(p.pointed??{about:[]},e=>t.store.graph.has(e)),[p,t.store]),f=(0,a.useMemo)(()=>oe(t.store,n,t.places),[t.store,n,t.places]),[u,y]=(0,a.useState)(""),[b,m]=(0,a.useState)(-1),[l,$]=(0,a.useState)(null),[A,I]=(0,a.useState)(null),E=(0,a.useRef)(null),z=(0,a.useRef)(null),T=(0,a.useId)(),R=(0,a.useRef)(!0),{ghost:G}=U(t.desk);(0,a.useEffect)(()=>()=>{R.current=!1;let e=t.desk.get().ghost;e?.onCard&&t.desk.setGhost({...e,onCard:!1})},[t.desk]);let M=(0,a.useMemo)(()=>{let e=P(t,n);return ee(t.store,n,{principal:t.principal,places:t.places,...e.acts?{acts:e.acts}:{}})},[t,n]),K=(0,a.useMemo)(()=>{let e=C(n);if(e.length===0)return[];let i=new Set(M.candidates.flatMap(c=>c.type==="act"?[c.mutation]:[]));return ie(t.store,e,{principal:t.principal,...e.length===1?{focus:e[0]}:{}}).affordances.filter(c=>!c.destructive&&i.has(c.mutation))},[t.store,t.principal,n,M]),q=(0,a.useCallback)(()=>{let e=p.returnTo,i=ue(E.current,n,r);s(),requestAnimationFrame(()=>{if(e?.isConnected&&!e.closest("[inert]"))return e.focus({preventScroll:!0});let c=(i&&i.tabIndex>=0?i:null)??document.querySelector("[data-graview-page-title]")??document.querySelector("main");c&&c.tabIndex<0&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","-1"),c?.focus({preventScroll:!0})})},[p.returnTo,n,r,s]),F=(0,a.useCallback)(e=>{if(e.open.length>0){let i=E.current?.getBoundingClientRect();s(),v({x:i?.left??0,y:i?.top??0,on:e.args.id??C(n)[0],about:C(n)});return}try{ae(t.store,e,{},{pressed:t.principal?{author:t.principal}:{}}),ne(t.store,e,{},{author:t.principal}),q()}catch(i){I(i instanceof Error?i.message:String(i))}},[t.store,t.principal,s,q,v,n]),H=(0,a.useCallback)(async e=>{let i=e.trim();if(!i)return;let c=l?.result?.answer?{said:l.said,answer:l.result.answer}:void 0;y(""),m(-1),I(null),$({said:i,result:null});let S=await re(t.ai,{...P(t,n,i),said:i,...c?{follows:c}:{}});t.desk.record(S.interaction),S.ghost&&S.ghost.proposals.length>0&&t.desk.setGhost({ghost:S.ghost,onCard:!0}),R.current&&$({said:i,result:S})},[l,t,n]),N=(0,a.useRef)(p.asked);(0,a.useEffect)(()=>{let e=N.current;N.current=void 0,e&&H(e)},[]);let k=(0,a.useMemo)(()=>{let e=u.trim();if(!e&&l)return[];let i=ge(e).split(/\s+/).filter(o=>o&&!ke.has(o)),c=/^show\b/i.test(e),S=/^(go|open)\b/i.test(e),x=[];if(!c&&!S)for(let o of K.filter(g=>W(g.label,i)).slice(0,L.act))x.push({id:`act:${o.id}`,kind:"act",label:o.label,hint:o.open.length>0?"asks more":"do it",take:()=>F(o)});let Q=e&&!/\?\s*$/.test(e)?te(t.store,n,{principal:t.principal,places:t.places,said:e}):[];for(let o of Q)x.push({id:`place:${o.place}`,kind:"place",label:o.fit==="full"?`Open ${o.title}`:`Open and adjust ${o.title}`,hint:o.fit==="full"?"a view you have":"adjust it",take:()=>{s(),t.goTo.place(o.place),o.fit==="partial"&&_(t.desk,{target:{on:"lens",place:o.place,...o.kind?{kind:o.kind}:{}},asked:e})}});if(!S){let o=M.candidates.filter(g=>g.type==="panel");for(let g of o.filter(D=>W(`show ${D.label}`,i)).slice(0,L.show))x.push({id:g.id,kind:"show",label:`Show ${pe(g.label)}`,hint:"a panel",take:()=>{s(),se(t,{title:g.label,recipe:{...g.panel,title:g.label}})}})}if(!c){for(let o of t.places.filter(g=>W(g.title,i)&&!Q.some(D=>D.place===g.as)).slice(0,L.place))x.push({id:`place:${o.as}`,kind:"place",label:`Go to ${o.title}`,take:()=>(s(),t.goTo.place(o.as))});if(i.length>0){let o=ce(t.store,e.replace(/^(go to|open)\s+/i,""),{principal:t.principal,from:C(n),limit:L.record}).hits;for(let g of o)g.about==="node"&&x.push({id:`record:${g.id}`,kind:"record",label:g.label,hint:B(t.store.schema,g.kind),take:()=>(s(),t.goTo.record(g.id))})}}return e&&x.push({id:"ask",kind:"ask",label:e,take:()=>void H(e)}),x},[u,K,M,t,n,F,H,s,l]);(0,a.useEffect)(()=>m(u.trim()?0:-1),[u]),(0,a.useLayoutEffect)(()=>{let e=E.current;if(!e)return;if(typeof e.showPopover=="function")try{e.showPopover()}catch{}z.current?.focus({preventScroll:!0});let i=0,c=()=>{be(e,ue(e,n,r)),i=requestAnimationFrame(c)};return c(),()=>cancelAnimationFrame(i)},[n,r]),(0,a.useEffect)(()=>{if(l)return;let e=i=>{i.target instanceof Node&&E.current?.contains(i.target)||s()};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[l,s]);let fe=e=>{if(e.key==="ArrowDown"&&k.length>0)e.preventDefault(),m(i=>Math.min(k.length-1,i+1));else if(e.key==="ArrowUp"&&k.length>0)e.preventDefault(),m(i=>Math.max(0,i-1));else if(e.key==="Enter"){e.preventDefault();let i=k[b];i?i.take():u.trim()&&H(u)}},w=l?.result??null,he=k[b];return(0,d.jsxs)("section",{ref:E,popover:"manual",role:"region","aria-label":l?`Answer about ${f}`:`Ask about ${f}`,"data-testid":"quick-ask","data-quick-ask":l?"answer":"bar","data-quick-ask-face":r,"data-graview-offstage":"","data-graview-overlay":"",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),q())},onMouseDown:e=>e.stopPropagation(),style:ve,children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-ask-about",style:{margin:0,flex:"1 1 auto",minWidth:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},children:["About ",f]}),(0,d.jsx)("button",{type:"button","data-testid":"quick-ask-close","aria-label":"Close",title:"Close",onClick:q,style:ye,children:(0,d.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),l?(0,d.jsxs)("div",{"data-testid":"quick-answer",style:{display:"grid",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-answer-asked",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",fontStyle:"italic",overflowWrap:"anywhere"},children:["\u201C",l.said,"\u201D"]}),(0,d.jsx)("p",{"data-testid":"quick-answer-text","aria-live":"polite",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:w?.interaction.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)",overflowWrap:"anywhere"},children:w===null?"Thinking\u2026":w.interaction.outcome==="failed"?w.interaction.failed??"The AI could not answer that here.":w.answer??""}),w&&w.offers.length>0?(0,d.jsx)("ul",{"aria-label":"What acts on it",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:w.offers.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button","data-testid":"quick-answer-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>{le(t,w,e,s).then(i=>{i&&R.current&&I(i)})},style:xe,children:e.type==="panel"?`Show ${pe(e.label)}`:e.type==="place"?`Go to ${e.label}`:e.label})},e.id))}):null,G?.onCard&&G.ghost.interaction===w?.interaction.id?(0,d.jsx)(de,{placement:"card"}):null]}):null,(0,d.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,d.jsx)("input",{ref:z,type:"text",role:"combobox","data-testid":"quick-ask-input","aria-label":l?`Ask a follow-up about ${f}`:`Ask about ${f}, or go somewhere`,"aria-expanded":k.length>0,"aria-controls":T,"aria-autocomplete":"list",...he?{"aria-activedescendant":`${T}-${b}`}:{},autoComplete:"off",enterKeyHint:"go",placeholder:l?"Ask a follow-up\u2026":"Ask, or go to\u2026",value:u,readOnly:l!==null&&w===null,"aria-busy":l!==null&&w===null,onChange:e=>y(e.target.value),onKeyDown:fe,style:Ae}),(0,d.jsx)("div",{id:T,role:"listbox","aria-label":u.trim()?`What \u201C${u.trim()}\u201D finds here`:"What can be done here",hidden:k.length===0,style:{display:k.length===0?"none":"grid",gap:1,maxHeight:280,overflowY:"auto"},children:k.map((e,i)=>(0,d.jsx)("div",{id:`${T}-${i}`,role:"option","aria-selected":i===b,"data-testid":"quick-ask-option","data-quick-ask-kind":e.kind,"data-quick-ask-row":e.id,onMouseEnter:()=>m(i),onMouseDown:c=>c.preventDefault(),onClick:e.take,style:{...Se,background:i===b?"var(--graview-panel-muted)":"transparent",...e.kind==="ask"?{borderTop:"1px solid var(--graview-edge)",marginTop:2}:{}},children:e.kind==="ask"?(0,d.jsxs)("span",{children:["Ask: ",(0,d.jsxs)("span",{style:{fontWeight:600},children:["\u2018",e.label,"\u2019"]})]}):(0,d.jsxs)("span",{children:[e.label,e.hint?(0,d.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.hint]}):null]})},e.id))})]}),A?(0,d.jsx)("p",{role:"alert","data-testid":"quick-ask-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:A}):null,(0,d.jsx)("span",{style:J,"aria-live":"polite",children:k.length>0&&u.trim()?`${k.length} ${k.length===1?"way":"ways"} to go on`:""})]})}function ue(r,p,s){let t=r?.closest("[data-graview-embed]")??document,v=p.on==="list"?[`aggregate:${p.kind}`,`kind:${p.kind}`]:p.on==="lens"&&p.kind?[`aggregate:${p.kind}`]:C(p);for(let n of v)for(let f of t.querySelectorAll(`[data-graview-view="${CSS.escape(n)}"], [data-graview-pick="${CSS.escape(n)}"]`)){if(r?.contains(f))continue;let u=f.getBoundingClientRect();if(u.width>0&&u.height>0)return f}return s==="pages"?t.querySelector("main [data-graview-page-title]")??t.querySelector("main h1"):null}function be(r,p){let s={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},t=Math.min(we,s.width-2*h),v=r.getBoundingClientRect().height,n=p?.getBoundingClientRect(),f,u,y,b=A=>Math.max(h,Math.min(A,s.height-v-h));if(n&&n.width>0&&n.bottom>0&&n.top<s.height)if(n.right+h+t<=s.width-h)f=n.right+h,u=b(n.top),y="right";else if(n.left-h-t>=h)f=n.left-h-t,u=b(n.top),y="left";else{f=Math.max(h,Math.min(n.left,s.width-t-h));let A=n.bottom+h;u=A+v<=s.height-h?A:b(n.top-h-v),y=A+v<=s.height-h?"below":"above"}else f=(s.width-t)/2,u=b(72),y="top";let m=r.style,l={left:`${Math.round(f)}px`,top:`${Math.round(u)}px`,width:`${Math.round(t)}px`};m.left!==l.left&&(m.left=l.left),m.top!==l.top&&(m.top=l.top),m.width!==l.width&&(m.width=l.width);let $=p?.getAttribute("data-graview-view")??p?.getAttribute("data-graview-pick")??(p?"page":"");r.getAttribute("data-quick-ask-beside")!==$&&r.setAttribute("data-quick-ask-beside",$),r.getAttribute("data-quick-ask-side")!==y&&r.setAttribute("data-quick-ask-side",y)}var ve={position:"fixed",inset:"auto",margin:0,zIndex:Y("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},ye={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"},Ae={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},Se={display:"flex",alignItems:"center",minHeight:30,padding:"4px 8px",borderRadius:6,cursor:"pointer",overflowWrap:"anywhere"},xe={display:"inline-flex",alignItems:"center",minHeight:30,padding:"2px 10px",font:"inherit",fontSize:"0.8125rem",borderRadius:8};export{De as QuickAskCard};
@@ -1 +1 @@
1
- import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import{b as m}from"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{T as p}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{U as l}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function A({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{A as StatesBar};
1
+ import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import{b as m}from"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{T as p}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import{W as l}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function A({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{A as StatesBar};
@@ -1 +1 @@
1
- import"./chunk.WVUJXDXZ.js";import{a as k,b as q,c as pe}from"./chunk.HUABTCQE.js";import"./chunk.DXJFAAOI.js";import"./chunk.5MSNKSTE.js";import"./chunk.KVQZ5FR6.js";import"./chunk.2HANQ737.js";import"./chunk.H536YUAZ.js";import"./chunk.GZHZLJBF.js";import{n as me}from"./chunk.OL2N5NUV.js";import"./chunk.OJGHDWI6.js";import"./chunk.5DPFAVCZ.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as Le,M as S,O as ue,T as ce,ba as ge,ea as he}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{Qc as de,ka as oe,na as w,pa as le,ra as E,sa as x,ta as se,ua as Y}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as U}from"./chunk.AJZBJBMO.js";var h=U(Le(),1);async function ye(e,n){let i=await createImageBitmap(e);try{let r=Math.min(1,n/Math.max(i.width,i.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(i.width*r)),a.height=Math.max(1,Math.round(i.height*r));let l=a.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(i,0,0,a.width,a.height),a}finally{i.close()}}var t=U(ce(),1),Ve=2048,Ie=.85;function _(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function z(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let n=[...new Set(e.map(i=>i==="image/*"?"pictures":i==="video/*"?"videos":i==="*/*"||i==="*"?"any file":`${z({type:i})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function Fe(e,n){if(e.length===0)return!0;let i=`${n.split("/")[0]}/*`;return e.some(r=>r==="*"||r==="*/*"||r===n||r===i)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,n,i){let r=e.name||(i.camera?"photo.jpg":"file"),a=e.type||(be({type:"",name:r})?"image/heic":Be(r)??"application/octet-stream"),l=be({type:a,name:r}),u=a.startsWith("image/")||l;if(i.image&&!u)return{refused:`\u201C${r}\u201D isn\u2019t a picture.`};if(i.video)return a.startsWith("video/")?K({blob:e,name:r,type:a},n):{refused:`\u201C${r}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(a)&&(i.camera||e.size>n.maxBytes||e.size>15e5))try{let c=await ye(e,Ve),b=await new Promise(p=>c.toBlob(p,"image/jpeg",Ie));if(b)return K({blob:b,name:l?r.replace(/\.hei[cf]$/i,"")+".jpg":r,type:"image/jpeg",width:c.width,height:c.height},n)}catch{if(l&&!Fe(n.kinds,a))return{refused:`\u201C${r}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let y={};if(u&&!l)try{let c=await createImageBitmap(e);y={width:c.width,height:c.height},c.close()}catch{}return K({blob:e,name:r,type:a,...y},n)}function K(e,n){return Fe(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${_(e.blob.size)}; this host takes files up to ${_(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${z(e)} file; this host takes ${ke(n.kinds)}.`}}async function _e(e,n,i,r=!1){let a;try{a=await n.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(a)?i&&!E(a)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:r&&!x(a)?{refused:`The host kept \u201C${e.name}\u201D as ${z(a)}, not as a video.`}:{...a,...a.width===void 0&&e.width?{width:e.width}:{},...a.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function Z(e){let n=S(),i=ue()?.past!=null,[r,a]=(0,h.useState)(!1),l=n?.kept?ze(n,e.href):!0,[,u]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(y=>y+1)),()=>void(s=!1)},[l]),[l===!1||i&&r,()=>a(!0)]}var J=new WeakMap;function ze(e,n){let i=J.get(e)?.get(n);if(i!==void 0)return i;let r;try{r=e.kept(n)}catch{return!0}if(typeof r=="boolean")return r;let a=J.get(e)??new Map;J.set(e,a);let l=Promise.resolve(r).then(u=>u!==!1,()=>!0);return a.set(n,l),l.then(u=>a.set(n,u)),l}function ee({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${k(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function Q({file:e,size:n=56,style:i}){let r=S(),[a,l]=Z(e);return a?(0,t.jsx)(ee,{file:e,style:{width:n,height:n,flex:"none",...i}}):x(e)?(0,t.jsx)(Ae,{file:e,size:n,...i?{style:i}:{},onError:l}):(0,t.jsx)("img",{onError:l,src:w(r,e.href),alt:k(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...i}})}function $e(e){let[n,i]=(0,h.useState)({}),r=e.duration??n.duration;return[{...r!==void 0?{duration:r}:{},width:e.width??n.width,height:e.height??n.height},u=>{let s=u.currentTarget;i({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,xe=(e,n)=>`${k(e)}, ${se({...n!==void 0?{duration:n}:{}})}`,Oe=(0,t.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,t.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:n,style:i,onError:r}){let a=S(),[l,u]=$e(e),s={width:n,height:n,objectFit:"cover",display:"block",borderRadius:F,background:"var(--graview-edge)"};return(0,t.jsxs)("span",{role:"img","aria-label":xe(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:n,height:n,flex:"none",...i},children:[e.poster?(0,t.jsx)("img",{src:w(a,e.poster),alt:"",width:n,height:n,loading:"lazy",decoding:"async",onError:r,style:s}):(0,t.jsx)("video",{src:w(a,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:n,height:n,onLoadedMetadata:u,onError:r,style:s}),Oe,l.duration!==void 0?(0,t.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:q(l.duration)}):null]})}function Ge({file:e}){let n=S(),[i,r]=Z(e),[a,l]=$e(e);if(i)return(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let u=a.width!==void 0&&a.height!==void 0;return(0,t.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0},children:[(0,t.jsx)("video",{"data-graview-video":e.href,src:w(n,e.href),...e.poster?{poster:w(n,e.poster)}:{},controls:!0,preload:"metadata",playsInline:!0,...u?{width:a.width,height:a.height}:{},"aria-label":xe(e,a.duration),onLoadedMetadata:l,onError:r,style:{display:"block",width:"100%",maxWidth:u?Math.max(a.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:u?`${a.width} / ${a.height}`:"16 / 9",borderRadius:F,background:"#000"},children:e.captions?(0,t.jsx)("track",{kind:"captions",src:w(n,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),(0,t.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...a.duration!==void 0?[q(a.duration)]:[]].join(" \xB7 ")})]})}function Ue({file:e,onOpen:n}){let i=S(),[r,a]=Z(e);return r?(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${k(e)} full size`,onClick:l=>n(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:w(i,e.href),alt:k(e),loading:"lazy",decoding:"async",onError:a,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function X({files:e,label:n}){let i=S(),r=d=>w(i,d.href),a=e.filter(E),l=e.filter(x),u=e.filter(d=>!E(d)&&!x(d)),[s,y]=(0,h.useState)(null),c=(0,h.useRef)(null),b=(0,h.useRef)(null);(0,h.useEffect)(()=>{let d=c.current;s!==null&&d&&!d.open&&d.showModal?.()},[s]);let p=s===null?void 0:a[s];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((d,T)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ue,{file:d,onOpen:R=>{b.current=R,y(T)}})},d.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-videos":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:l.map(d=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ge,{file:d})},d.href))}):null,u.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:u.map(d=>(0,t.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,t.jsx)("object",{data:r(d),type:"application/pdf","aria-label":k(d),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:r(d),download:d.name,children:["download ",d.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:r(d),download:d.name,...d.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:d.name}),(0,t.jsxs)("span",{style:P,children:[z(d)," \xB7 ",_(d.bytes)]})]}),d.caption?(0,t.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,p?(0,t.jsx)("dialog",{ref:c,"data-graview-full":p.href,"aria-label":k(p),onClose:()=>{y(null),b.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:r(p),alt:k(p),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:p.caption??p.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:n,several:i,image:r,video:a=!1,label:l,thumbs:u=!0}){let s=S(),y=(0,h.useId)(),c=(0,h.useRef)(null),b=(0,h.useRef)(null),[p,d]=(0,h.useState)(null),[T,R]=(0,h.useState)(null),[te,H]=(0,h.useState)([]),[N,O]=(0,h.useState)(!1),W=r?"image/":a?"video/":void 0,C=s?W?s.kinds.filter(o=>o.startsWith(W)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||C.length>0:!1,Re=!a&&(s?s.kinds.length===0||(r?C:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,L=ne&&(!W||Pe),V=r?"picture":a?"video":"file",ae=i?`${V}s`:`a ${V}`,ie=W?C.length>0?C.join(","):`${W}*`:s?.kinds.join(",")||void 0,We=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,A=(0,h.useRef)(e);A.current=e;let re=(0,h.useRef)(null),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{let o=I.current;if(!o||o.from===e)return;I.current=null;let g=re.current?.children,f=g?.[Math.min(o.at,g.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let D=async(o,g)=>{if(!s||o.length===0)return;let f=i?o:o.slice(0,1),m=[],$=[];f.length<o.length&&$.push(`${l} holds one ${V}, so ${o.slice(1).map(v=>`\u201C${v.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),H([]),R(null);for(let v of f){d(`Sending ${v.name||"the photo"}\u2026`);let G=await je(v,s,{image:r,video:a,camera:g==="camera"});if("refused"in G){$.push(G.refused);continue}let M=await _e(G,s,r,a);"refused"in M?$.push(M.refused):[...i?A.current:[],...m].some(He=>He.href===M.href)?$.push(`\u201C${M.name}\u201D is already here.`):m.push(M)}if(d(null),H($),m.length!==0)try{n(i?[...A.current,...m]:m.slice(-1)),R(`Added ${m.map(v=>v.name).join(", ")}.`)}catch(v){H([...$,v instanceof Error?v.message:String(v)])}},B=(o,g,f)=>{try{I.current=f?{...f,from:e}:null,n(o),R(g)}catch(m){I.current=null,H([m instanceof Error?m.message:String(m)])}},j=o=>o?Array.from(o):[],Me=o=>{let g=j(o.clipboardData?.files);!L||g.length===0||(o.preventDefault(),D(g,"pasted"))},Te=o=>{O(!1),L&&(o.preventDefault(),D(j(o.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${y}-label`,"data-graview-file-editor":"","data-graview-dropping":N?"":void 0,onPaste:Me,onDragOver:o=>{L&&(o.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:Te,style:{display:"grid",gap:8,minWidth:0,padding:N?6:0,outline:N?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${y}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(i||e.length>1)?(0,t.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,g)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(E(o)||x(o))?(0,t.jsx)(Q,{file:o,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,t.jsx)(we,{file:o,onCaption:f=>B(e.map((m,$)=>$===g?ve(m,f):m),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),i&&g>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>B(e.map((f,m)=>m===g-1?o:m===g?e[g-1]:f),`Moved ${o.name} earlier.`,{at:g-1,what:"move"}),children:"\u2191"}):null,i?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>B(e.filter((f,m)=>m!==g),`Removed ${o.name}.`,{at:g,what:"remove"}),children:"Remove"}):null]},`${g}:${o.href}`))}):e.length===1?(0,t.jsx)(we,{file:e[0],onCaption:o=>B([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,L?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:i,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!i?`Replace the ${V}`:`Choose ${ae}`}),Re?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"camera")}}),We?(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",i?"them":"it"," here \xB7 ",s.kinds.length>0?ke(C.length>0?C:s.kinds):"any file",", up to ",_(s.maxBytes)]})]}):(0,t.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${a?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:p||T?void 0:0},"data-graview-file-status":"",children:p??T??""}),te.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:te.map((o,g)=>(0,t.jsx)("p",{style:{margin:0},children:o},g))}):null]})}var ve=(e,n)=>{let{caption:i,...r}=e;return n?{...r,caption:n}:r};function we({file:e,onCaption:n}){let[i,r]=(0,h.useState)(e.caption??"");(0,h.useEffect)(()=>r(e.caption??""),[e.caption]);let a=()=>{let l=i.trim().slice(0,500);l!==(e.caption??"")&&n(l)};return(0,t.jsx)("input",{type:"text",value:i,placeholder:E(e)||x(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${E(e)||x(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>r(l.target.value),onBlur:a,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:n,labelStyle:i,valueStyle:r,style:a,children:l}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...a},children:[(0,t.jsx)("dt",{style:i,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...r},children:l})]})}function Ce(e){let{nodeId:n,field:i,label:r,files:a}=e,{fields:l,commit:u}=me(n),s=l.find(p=>p.field===i&&p.takesValue),y=s?.shape,c=y?.type==="several"?y.of:y,b=y?.type==="several";return a.length===0&&c?.type!=="file"?null:(0,t.jsxs)(Ee,{...e,children:[(0,t.jsx)(X,{files:a,label:r}),s&&c?.type==="file"?(0,t.jsx)(Se,{value:a,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:r,onChange:p=>{let d=b?p:p[p.length-1];d!==void 0&&u(s,d)}}):null]})}function et(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(Ee,{...e,children:(0,t.jsx)(X,{files:e.files,label:e.label})}):null:(0,t.jsx)(Ce,{...e});case"unfilled":return(0,t.jsx)(Ye,{...e});case"thumb":return(0,t.jsx)(Q,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(Q,{file:e.files[0],size:72}):(0,t.jsx)(X,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:i=>e.onChange(e.several?i:i[i.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Ye({nodeId:e,skip:n,labels:i,labelStyle:r,style:a}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,y=pe(s).filter(c=>!n.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return y.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:y.map(c=>(0,t.jsx)(Ce,{nodeId:e,field:c,label:i?.[c]??oe(s,c),files:[],...r?{labelStyle:r}:{},...a?{style:a}:{}},c))})}export{Se as FilesEditor,Ve as SEND_EDGE,et as drawFiles,ke as kindsWords,je as prepare,_e as send,_ as sizeWords,Fe as takes,z as typeWords};
1
+ import"./chunk.WVUJXDXZ.js";import{a as k,b as q,c as pe}from"./chunk.T2RME6XF.js";import"./chunk.SOTB6C5A.js";import"./chunk.TQCRFZ53.js";import"./chunk.6HLKAUWF.js";import"./chunk.FCUDBMGC.js";import"./chunk.KMEKMCKG.js";import"./chunk.GZHZLJBF.js";import{n as me}from"./chunk.E5XNQTEU.js";import"./chunk.OJGHDWI6.js";import"./chunk.K5YLQAFW.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as Le,M as S,O as ue,T as ce,ba as ge,ea as he}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import{Uc as de,ma as oe,pa as w,ra as le,ta as E,ua as x,va as se,wa as Y}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as U}from"./chunk.AJZBJBMO.js";var h=U(Le(),1);async function ye(e,n){let i=await createImageBitmap(e);try{let r=Math.min(1,n/Math.max(i.width,i.height)),a=document.createElement("canvas");a.width=Math.max(1,Math.round(i.width*r)),a.height=Math.max(1,Math.round(i.height*r));let l=a.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(i,0,0,a.width,a.height),a}finally{i.close()}}var t=U(ce(),1),Ve=2048,Ie=.85;function _(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function z(e){if(e.type==="application/pdf")return"PDF";let n=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return n?n.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let n=[...new Set(e.map(i=>i==="image/*"?"pictures":i==="video/*"?"videos":i==="*/*"||i==="*"?"any file":`${z({type:i})} files`))];return n.length<=1?n[0]??"no files":`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`}function Fe(e,n){if(e.length===0)return!0;let i=`${n.split("/")[0]}/*`;return e.some(r=>r==="*"||r==="*/*"||r===n||r===i)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,n,i){let r=e.name||(i.camera?"photo.jpg":"file"),a=e.type||(be({type:"",name:r})?"image/heic":Be(r)??"application/octet-stream"),l=be({type:a,name:r}),u=a.startsWith("image/")||l;if(i.image&&!u)return{refused:`\u201C${r}\u201D isn\u2019t a picture.`};if(i.video)return a.startsWith("video/")?K({blob:e,name:r,type:a},n):{refused:`\u201C${r}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(a)&&(i.camera||e.size>n.maxBytes||e.size>15e5))try{let c=await ye(e,Ve),b=await new Promise(p=>c.toBlob(p,"image/jpeg",Ie));if(b)return K({blob:b,name:l?r.replace(/\.hei[cf]$/i,"")+".jpg":r,type:"image/jpeg",width:c.width,height:c.height},n)}catch{if(l&&!Fe(n.kinds,a))return{refused:`\u201C${r}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let y={};if(u&&!l)try{let c=await createImageBitmap(e);y={width:c.width,height:c.height},c.close()}catch{}return K({blob:e,name:r,type:a,...y},n)}function K(e,n){return Fe(n.kinds,e.type)?e.blob.size>n.maxBytes?{refused:`\u201C${e.name}\u201D is ${_(e.blob.size)}; this host takes files up to ${_(n.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${z(e)} file; this host takes ${ke(n.kinds)}.`}}async function _e(e,n,i,r=!1){let a;try{a=await n.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(a)?i&&!E(a)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:r&&!x(a)?{refused:`The host kept \u201C${e.name}\u201D as ${z(a)}, not as a video.`}:{...a,...a.width===void 0&&e.width?{width:e.width}:{},...a.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var F="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function Z(e){let n=S(),i=ue()?.past!=null,[r,a]=(0,h.useState)(!1),l=n?.kept?ze(n,e.href):!0,[,u]=(0,h.useState)(0);return(0,h.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(y=>y+1)),()=>void(s=!1)},[l]),[l===!1||i&&r,()=>a(!0)]}var J=new WeakMap;function ze(e,n){let i=J.get(e)?.get(n);if(i!==void 0)return i;let r;try{r=e.kept(n)}catch{return!0}if(typeof r=="boolean")return r;let a=J.get(e)??new Map;J.set(e,a);let l=Promise.resolve(r).then(u=>u!==!1,()=>!0);return a.set(n,l),l.then(u=>a.set(n,u)),l}function ee({file:e,style:n}){return(0,t.jsx)("span",{role:"img","aria-label":`${k(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:F,...n},children:"removed later"})}function Q({file:e,size:n=56,style:i}){let r=S(),[a,l]=Z(e);return a?(0,t.jsx)(ee,{file:e,style:{width:n,height:n,flex:"none",...i}}):x(e)?(0,t.jsx)(Ae,{file:e,size:n,...i?{style:i}:{},onError:l}):(0,t.jsx)("img",{onError:l,src:w(r,e.href),alt:k(e),width:n,height:n,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:n,height:n,objectFit:"cover",borderRadius:F,display:"block",flex:"none",background:"var(--graview-edge)",...i}})}function $e(e){let[n,i]=(0,h.useState)({}),r=e.duration??n.duration;return[{...r!==void 0?{duration:r}:{},width:e.width??n.width,height:e.height??n.height},u=>{let s=u.currentTarget;i({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,xe=(e,n)=>`${k(e)}, ${se({...n!==void 0?{duration:n}:{}})}`,Oe=(0,t.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,t.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,t.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,t.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:n,style:i,onError:r}){let a=S(),[l,u]=$e(e),s={width:n,height:n,objectFit:"cover",display:"block",borderRadius:F,background:"var(--graview-edge)"};return(0,t.jsxs)("span",{role:"img","aria-label":xe(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:n,height:n,flex:"none",...i},children:[e.poster?(0,t.jsx)("img",{src:w(a,e.poster),alt:"",width:n,height:n,loading:"lazy",decoding:"async",onError:r,style:s}):(0,t.jsx)("video",{src:w(a,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:n,height:n,onLoadedMetadata:u,onError:r,style:s}),Oe,l.duration!==void 0?(0,t.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:q(l.duration)}):null]})}function Ge({file:e}){let n=S(),[i,r]=Z(e),[a,l]=$e(e);if(i)return(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let u=a.width!==void 0&&a.height!==void 0;return(0,t.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0},children:[(0,t.jsx)("video",{"data-graview-video":e.href,src:w(n,e.href),...e.poster?{poster:w(n,e.poster)}:{},controls:!0,preload:"metadata",playsInline:!0,...u?{width:a.width,height:a.height}:{},"aria-label":xe(e,a.duration),onLoadedMetadata:l,onError:r,style:{display:"block",width:"100%",maxWidth:u?Math.max(a.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:u?`${a.width} / ${a.height}`:"16 / 9",borderRadius:F,background:"#000"},children:e.captions?(0,t.jsx)("track",{kind:"captions",src:w(n,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),(0,t.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...a.duration!==void 0?[q(a.duration)]:[]].join(" \xB7 ")})]})}function Ue({file:e,onOpen:n}){let i=S(),[r,a]=Z(e);return r?(0,t.jsx)(ee,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,t.jsx)("button",{type:"button","aria-label":`Open ${k(e)} full size`,onClick:l=>n(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:F},children:(0,t.jsx)("img",{src:w(i,e.href),alt:k(e),loading:"lazy",decoding:"async",onError:a,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:F,display:"block",background:"var(--graview-edge)"}})})}function X({files:e,label:n}){let i=S(),r=d=>w(i,d.href),a=e.filter(E),l=e.filter(x),u=e.filter(d=>!E(d)&&!x(d)),[s,y]=(0,h.useState)(null),c=(0,h.useRef)(null),b=(0,h.useRef)(null);(0,h.useEffect)(()=>{let d=c.current;s!==null&&d&&!d.open&&d.showModal?.()},[s]);let p=s===null?void 0:a[s];return(0,t.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[a.length>0?(0,t.jsx)("ul",{"data-graview-gallery":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:a.map((d,T)=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ue,{file:d,onOpen:R=>{b.current=R,y(T)}})},d.href))}):null,l.length>0?(0,t.jsx)("ul",{"data-graview-videos":"","aria-label":n,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:l.map(d=>(0,t.jsx)("li",{style:{minWidth:0},children:(0,t.jsx)(Ge,{file:d})},d.href))}):null,u.length>0?(0,t.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:u.map(d=>(0,t.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,t.jsx)("object",{data:r(d),type:"application/pdf","aria-label":k(d),style:{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:F},children:(0,t.jsxs)("p",{style:{margin:0,padding:12},children:["This browser shows no PDF here: ",(0,t.jsxs)("a",{href:r(d),download:d.name,children:["download ",d.name]}),"."]})}):null,(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,t.jsx)("a",{href:r(d),download:d.name,...d.type==="application/pdf"?{target:"_blank",rel:"noopener"}:{},children:d.name}),(0,t.jsxs)("span",{style:P,children:[z(d)," \xB7 ",_(d.bytes)]})]}),d.caption?(0,t.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,p?(0,t.jsx)("dialog",{ref:c,"data-graview-full":p.href,"aria-label":k(p),onClose:()=>{y(null),b.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:F,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,t.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,t.jsx)("img",{src:r(p),alt:k(p),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,t.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,t.jsx)("span",{children:p.caption??p.name}),(0,t.jsx)("form",{method:"dialog",style:{margin:0},children:(0,t.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:n,several:i,image:r,video:a=!1,label:l,thumbs:u=!0}){let s=S(),y=(0,h.useId)(),c=(0,h.useRef)(null),b=(0,h.useRef)(null),[p,d]=(0,h.useState)(null),[T,R]=(0,h.useState)(null),[te,H]=(0,h.useState)([]),[N,O]=(0,h.useState)(!1),W=r?"image/":a?"video/":void 0,C=s?W?s.kinds.filter(o=>o.startsWith(W)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||C.length>0:!1,Re=!a&&(s?s.kinds.length===0||(r?C:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,L=ne&&(!W||Pe),V=r?"picture":a?"video":"file",ae=i?`${V}s`:`a ${V}`,ie=W?C.length>0?C.join(","):`${W}*`:s?.kinds.join(",")||void 0,We=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,A=(0,h.useRef)(e);A.current=e;let re=(0,h.useRef)(null),I=(0,h.useRef)(null);(0,h.useEffect)(()=>{let o=I.current;if(!o||o.from===e)return;I.current=null;let g=re.current?.children,f=g?.[Math.min(o.at,g.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let D=async(o,g)=>{if(!s||o.length===0)return;let f=i?o:o.slice(0,1),m=[],$=[];f.length<o.length&&$.push(`${l} holds one ${V}, so ${o.slice(1).map(v=>`\u201C${v.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),H([]),R(null);for(let v of f){d(`Sending ${v.name||"the photo"}\u2026`);let G=await je(v,s,{image:r,video:a,camera:g==="camera"});if("refused"in G){$.push(G.refused);continue}let M=await _e(G,s,r,a);"refused"in M?$.push(M.refused):[...i?A.current:[],...m].some(He=>He.href===M.href)?$.push(`\u201C${M.name}\u201D is already here.`):m.push(M)}if(d(null),H($),m.length!==0)try{n(i?[...A.current,...m]:m.slice(-1)),R(`Added ${m.map(v=>v.name).join(", ")}.`)}catch(v){H([...$,v instanceof Error?v.message:String(v)])}},B=(o,g,f)=>{try{I.current=f?{...f,from:e}:null,n(o),R(g)}catch(m){I.current=null,H([m instanceof Error?m.message:String(m)])}},j=o=>o?Array.from(o):[],Me=o=>{let g=j(o.clipboardData?.files);!L||g.length===0||(o.preventDefault(),D(g,"pasted"))},Te=o=>{O(!1),L&&(o.preventDefault(),D(j(o.dataTransfer?.files),"dropped"))};return(0,t.jsxs)("div",{role:"group","aria-labelledby":`${y}-label`,"data-graview-file-editor":"","data-graview-dropping":N?"":void 0,onPaste:Me,onDragOver:o=>{L&&(o.preventDefault(),O(!0))},onDragLeave:()=>O(!1),onDrop:Te,style:{display:"grid",gap:8,minWidth:0,padding:N?6:0,outline:N?"2px dashed var(--graview-accent)":"none",borderRadius:F},children:[(0,t.jsx)("span",{id:`${y}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(i||e.length>1)?(0,t.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,g)=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(E(o)||x(o))?(0,t.jsx)(Q,{file:o,size:40}):null,(0,t.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,t.jsx)(we,{file:o,onCaption:f=>B(e.map((m,$)=>$===g?ve(m,f):m),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),i&&g>0?(0,t.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>B(e.map((f,m)=>m===g-1?o:m===g?e[g-1]:f),`Moved ${o.name} earlier.`,{at:g-1,what:"move"}),children:"\u2191"}):null,i?(0,t.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>B(e.filter((f,m)=>m!==g),`Removed ${o.name}.`,{at:g,what:"remove"}),children:"Remove"}):null]},`${g}:${o.href}`))}):e.length===1?(0,t.jsx)(we,{file:e[0],onCaption:o=>B([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,L?(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:i,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"picked")}}),(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!i?`Replace the ${V}`:`Choose ${ae}`}),Re?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let g=j(o.currentTarget.files);o.currentTarget.value="",D(g,"camera")}}),We?(0,t.jsx)("button",{type:"button",disabled:p!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,t.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",i?"them":"it"," here \xB7 ",s.kinds.length>0?ke(C.length>0?C:s.kinds):"any file",", up to ",_(s.maxBytes)]})]}):(0,t.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${a?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,t.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:p||T?void 0:0},"data-graview-file-status":"",children:p??T??""}),te.length>0?(0,t.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:te.map((o,g)=>(0,t.jsx)("p",{style:{margin:0},children:o},g))}):null]})}var ve=(e,n)=>{let{caption:i,...r}=e;return n?{...r,caption:n}:r};function we({file:e,onCaption:n}){let[i,r]=(0,h.useState)(e.caption??"");(0,h.useEffect)(()=>r(e.caption??""),[e.caption]);let a=()=>{let l=i.trim().slice(0,500);l!==(e.caption??"")&&n(l)};return(0,t.jsx)("input",{type:"text",value:i,placeholder:E(e)||x(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${E(e)||x(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>r(l.target.value),onBlur:a,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),a())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:n,labelStyle:i,valueStyle:r,style:a,children:l}){return(0,t.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...a},children:[(0,t.jsx)("dt",{style:i,children:n}),(0,t.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...r},children:l})]})}function Ce(e){let{nodeId:n,field:i,label:r,files:a}=e,{fields:l,commit:u}=me(n),s=l.find(p=>p.field===i&&p.takesValue),y=s?.shape,c=y?.type==="several"?y.of:y,b=y?.type==="several";return a.length===0&&c?.type!=="file"?null:(0,t.jsxs)(Ee,{...e,children:[(0,t.jsx)(X,{files:a,label:r}),s&&c?.type==="file"?(0,t.jsx)(Se,{value:a,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:r,onChange:p=>{let d=b?p:p[p.length-1];d!==void 0&&u(s,d)}}):null]})}function et(e){switch(e.as){case"field":return e.read?e.files.length>0?(0,t.jsx)(Ee,{...e,children:(0,t.jsx)(X,{files:e.files,label:e.label})}):null:(0,t.jsx)(Ce,{...e});case"unfilled":return(0,t.jsx)(Ye,{...e});case"thumb":return(0,t.jsx)(Q,{...e});case"block":return e.files.length>0?(0,t.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,t.jsx)(Q,{file:e.files[0],size:72}):(0,t.jsx)(X,{files:e.files,label:e.label})}):null;case"control":{let n=(0,t.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:i=>e.onChange(e.several?i:i[i.length-1])});return e.title===void 0?n:(0,t.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,t.jsx)("legend",{"data-graview-part":"label",children:e.title}),n]})}}}function Ye({nodeId:e,skip:n,labels:i,labelStyle:r,style:a}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,y=pe(s).filter(c=>!n.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return y.length===0?null:(0,t.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:y.map(c=>(0,t.jsx)(Ce,{nodeId:e,field:c,label:i?.[c]??oe(s,c),files:[],...r?{labelStyle:r}:{},...a?{style:a}:{}},c))})}export{Se as FilesEditor,Ve as SEND_EDGE,et as drawFiles,ke as kindsWords,je as prepare,_e as send,_ as sizeWords,Fe as takes,z as typeWords};
@@ -0,0 +1 @@
1
+ import{a as N,b as T}from"./chunk.25VJPUDH.js";import{e as D,f as E,g as R}from"./chunk.AKVBU5K5.js";import{b as I}from"./chunk.LLOZKUCA.js";import"./chunk.DH7M57SE.js";import{d as z}from"./chunk.CKV2QCH5.js";import"./chunk.TAJ2R44N.js";import{a as C}from"./chunk.V3NPUAPB.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import{j as f}from"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as M,Ra as W,T as k,Va as A,ba as b,da as H}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import{_a as x}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var n=v(M(),1);var e=v(k(),1);function O(t,o){let r=[t>0?`${t===1?"one suggestion":`${t} suggestions`} waiting`:"",o>0?`tidied ${o===1?"one thing":`${o} things`} while you were away`:""].filter(Boolean);return r.length>0?r.join(" \xB7 ").replace(/^./,s=>s.toUpperCase()):void 0}function F(){let{store:t,principal:o,dismissals:r,whileAway:s,app:u}=b(),h=H(),l=(0,n.useMemo)(()=>T(r,u?.name??"app",o),[r,u?.name,o]),[m,y]=(0,n.useReducer)(g=>g+1,0);(0,n.useEffect)(()=>l.onChange?.(y),[l]);let a=(0,n.useMemo)(()=>D(t,o,{dismissed:l.list()}),[t,o,h,l,m]),[w,p]=(0,n.useState)(""),i=A("suggested"),d=s?.tidied??0,c=s?O(a.length,d):void 0;if(a.length===0&&d===0)return null;let L=g=>{if(p(g),a.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}i.setOpen(!1),(document.querySelector('[data-testid="activity-button"]')??document.querySelector('[data-graview-app-bar] button:not([data-testid="suggested-button"])'))?.focus()};return(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...i.trigger,onClick:i.toggle,title:c??"What tidying suggests, waiting for you",...c?{"aria-label":`Suggested: ${c}`}:{},style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[a.length>0?a.length:`Tidied ${d}`,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),a.length>0?(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"}):null]}),i.open?(0,e.jsxs)("section",{...i.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...W,width:"min(320px, 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:{...f,margin:0},children:"Suggested"}),c?(0,e.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[c,"."]}):null,(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:a.length>0?"Not made yet: each waits for you.":"What it did is in Activity."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10,fontSize:"0.8125rem",minWidth:0},children:a.map(g=>(0,e.jsx)(q,{suggestion:g,notNow:l,settled:L},g.id))}),(0,e.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:f,children:w})]}):null]})}var S={minWidth:0,overflowWrap:"anywhere"},$={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow."};function q({suggestion:t,notNow:o,settled:r}){let{store:s,principal:u,seats:h,people:l}=b(),[m,y]=(0,n.useState)(null),a=(0,n.useId)(),w=x(t.author,{graph:s.graph,schema:s.schema,seats:h,people:l}),p=async i=>{y(null);try{i==="accept"?E(s,t.id,{author:u}):i==="decline"?R(s,t.id,{author:u}):await o.dismiss({suggestion:t.id,at:new Date().toISOString(),until:N()}),r($[i])}catch(d){y(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:5,lineHeight:1.45,minWidth:0},children:[(0,e.jsxs)("span",{"data-graview-suggestion-words":"",style:S,children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:w})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{...S,color:"var(--graview-ink-faint)"},children:C(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{"data-graview-suggestion-records":"",style:{display:"flex",flexWrap:"wrap",gap:4,minWidth:0},children:t.about.slice(0,4).map(i=>(0,e.jsx)(z,{label:I(s,i),pickId:i},i))}):null,(0,e.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6,minWidth:0},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void p("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void p("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void p("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":a,style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem",marginInlineStart:"auto",border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"},children:"Not now"}),(0,e.jsx)("span",{id:a,style:f,children:"Hides it from you until tomorrow; it still waits for everyone else."})]}),m?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{...S,fontSize:"0.75rem",color:"var(--graview-warn)"},children:m}):null]})}export{F as SuggestedTray,O as awayWords};
@@ -1,4 +1,4 @@
1
- import{Qc as e}from"./chunk.WR63RQGU.js";var i=`
1
+ import{Uc as e}from"./chunk.YEJ4LNUP.js";var i=`
2
2
  .graview-spec{display:flex;flex-direction:column;gap:6px;min-width:0;color:var(--graview-ink)}
3
3
 
4
4
  .graview-spec-row{flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px 10px;box-sizing:border-box;max-width:100%;padding:5px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius-sm,8px);background:var(--graview-panel);font-size:.875rem}
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk.AQCU6TPV.js";import"./chunk.6Q6BW4QT.js";import"./chunk.DTSTUC2W.js";import"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import"./chunk.IT763BYH.js";import"./chunk.T2RME6XF.js";import"./chunk.SOTB6C5A.js";import"./chunk.TQCRFZ53.js";import"./chunk.6HLKAUWF.js";import"./chunk.FCUDBMGC.js";import"./chunk.KMEKMCKG.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
@@ -0,0 +1 @@
1
+ import{a as Y,b as _,c as D,e as R,h as H,i as q,j as S,k as N,l as x,n as P,o as V}from"./chunk.7RJGEU3Y.js";import{b as U}from"./chunk.DPPT6WAJ.js";import{G as T,K as j,Q as A,Ya as F,Z as W,bb as I,da as k,ga as B}from"./chunk.YEJ4LNUP.js";function te(e,r){return e===void 0||e===!0?!0:e===!1?!1:e[r]!==!1}function ne(e){let r={};return e.query&&e.query.trim().length>0&&(r.q=e.query),e.archived!==void 0&&e.archived!==!1&&(r.archived=String(e.archived)),e.sort&&(r.sort=e.sort.direction==="desc"?`${e.sort.by}:desc`:e.sort.by),e.filter?.length&&(r.filter=e.filter.map(n=>`${n.key}:${n.value}`).join(",")),e.group&&(r.group=e.group.bucket?`${e.group.by}:${e.group.bucket}`:e.group.by),r}function oe(e,r){let n=[],d={};if(e.query&&(d.query=e.query),e.archived!==void 0&&e.archived!==!1&&(d.archived=e.archived),e.sort&&(r.sorts.some(u=>u.key===e.sort.by)?d.sort=e.sort:n.push(`sort ${e.sort.by}`)),e.filter){let u=e.filter.filter(c=>r.filters.find(a=>a.key===c.key)?!0:(n.push(`filter ${c.key}`),!1));u.length>0&&(d.filter=u)}return e.group&&(r.groups.some(u=>u.key===e.group.by)?d.group=e.group:n.push(`group ${e.group.by}`)),{arrangement:d,dropped:n}}function O(e,r){return B(e.schema.tryDefinition(r.kind),S(r))}var ie=(e,r)=>e==null?r==null?0:1:r==null?-1:typeof e=="number"&&typeof r=="number"?e-r:typeof e=="boolean"&&typeof r=="boolean"?e===r?0:e?1:-1:String(e).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"});function se(e,r,n){if(n==="label")return O(e,r);let d=e.schema.tryDefinition(r.kind);return d&&n in(d.fields.shape??{})?F(q(r),n,e.today??j()):d?.computed?.[n]!==void 0?e.read?.(r,n):N(e.graph,r.id,n).map(c=>O(e,c)).sort()[0]}var de=/^(\d{4})-(\d{2})-(\d{2})/;function Z(e,r){if(T.test(e)){let[s,i]=[e.slice(0,4),e.slice(5,7)];return r==="year"?`${s}-01-01`:r==="decade"?`${String(Number(s)-Number(s)%10).padStart(4,"0")}-01-01`:r==="month"&&i?`${s}-${i}-01`:e}let n=de.exec(e);if(!n)return;let[,d,u,c]=n;if(r==="day")return`${d}-${u}-${c}`;if(r==="month")return`${d}-${u}-01`;if(r==="year")return`${d}-01-01`;if(r==="decade")return`${String(Number(d)-Number(d)%10).padStart(4,"0")}-01-01`;let f=new Date(Date.UTC(Number(d),Number(u)-1,Number(c))),a=(f.getUTCDay()+6)%7;return f.setUTCDate(f.getUTCDate()-a),f.toISOString().slice(0,10)}function ue(e,r){return T.test(e)?A(e):r==="month"?W(e):r==="week"?`Week of ${A(e)}`:r==="year"?e.slice(0,4):r==="decade"?`The ${e.slice(0,4)}s`:A(e)}function fe(e,r,n){return z(e,n)(r)}function z(e,r){let{words:n,conditions:d}=P(r);if(n.length===0&&d.length===0)return()=>!0;let u=new Map,c=f=>{let a=u.get(f);return a||(a=new Set(R(e.schema,f).filters.map(s=>s.key)),u.set(f,a)),a};return f=>{let a=c(f.kind),s=d.filter(i=>a.has(i.key));return s.every(i=>x(e,f,i))?n.length>0?V(e.schema.tryDefinition(f.kind),S(f),n,e.searchIn)!==void 0:s.length>0:!1}}function ae(e,r,n){let d=r.query?.trim(),u=r.archived===void 0?e:e.filter(t=>I(t,r.archived)),c=d?u.filter(z(n,d)):u,f=r.filter?.length?c.filter(t=>r.filter.every(l=>x(n,t,l))):[...c],a=[];for(let t=r.sort;t&&a.length<4;t=t.then)a.push(t);let s=a.length>0?f.map((t,l)=>({node:t,index:l,values:a.map(o=>se(n,t,o.by))})).sort((t,l)=>{for(let[o,p]of a.entries()){let[b,E]=[t.values[o],l.values[o]],G=ie(b,E),M=p.direction==="desc"&&G!==0&&b!==void 0&&E!==void 0?-G:G;if(M!==0)return M}return t.index-l.index}).map(t=>t.node):f,i=r.group;if(!i)return{nodes:s,groups:[{key:"",label:"",nodes:s}],grouped:!1};let y=new Map,g=(t,l,o)=>{let p=y.get(t)??{label:l,nodes:[]};p.nodes.push(o),y.set(t,p)},L=s[0],m=L?n.schema.tryDefinition(L.kind):void 0,w=m?.fields.shape??{},X=m?Y(m,i.by):k(i.by),$=i.by in w,h=$?_(w[i.by]):void 0,ee=D(n.schema,L?.kind??"").find(t=>t.key===i.by)?.label,v=$?`No ${X.toLowerCase()}`:`Without ${(ee??k(i.by)).toLowerCase()}`,K=$?new Map:U([...new Map(s.flatMap(t=>N(n.graph,t.id,i.by)).map(t=>[t.id,t])).values()].map(S),t=>n.schema.tryDefinition(t));for(let t of s){if($){let o=F(q(t),i.by,n.today??j());if(o==null||o==="")g("",v,t);else if(h==="date"){let p=i.bucket??"day",b=Z(String(o),p);b?g(b,ue(b,p),t):g("",v,t)}else if(h==="boolean")g(o?"1":"0",o?"Yes":"No",t);else{let p=m?.display?.format?.[i.by];g(String(o),p?p(o):h==="choice"?k(String(o)):String(o),t)}continue}let l=N(n.graph,t.id,i.by).map(o=>({id:o.id,label:K.has(o.id)?`${O(n,o)} \xB7 ${K.get(o.id)}`:O(n,o)})).sort((o,p)=>o.label.localeCompare(p.label));l.length===0?g("",v,t):g(l.map(o=>o.id).join(","),l.map(o=>o.label).join(", "),t)}let C=h==="choice"?H(w[i.by]):void 0,re=[...y.entries()].sort(([t,l],[o,p])=>t===""?1:o===""?-1:C?C.indexOf(t)-C.indexOf(o):h==="boolean"?o.localeCompare(t):h==="date"?t.localeCompare(o):l.label.localeCompare(p.label)).map(([t,l])=>({key:t,label:l.label,nodes:l.nodes}));return{nodes:s,groups:re,grouped:!0}}function Q(e){if(e===void 0)return;if(typeof e=="string")return{by:e,direction:"asc"};let r=e.then===void 0?void 0:typeof e.then=="string"?{by:e.then,direction:"asc"}:{by:e.then.by,direction:e.then.direction??"asc"};return{by:e.by,direction:e.direction??"asc",...r?{then:r}:{}}}function J(e){if(e!==void 0)return typeof e=="string"?{by:e}:e}function le(e){let r=Q(e?.sort),n=J(e?.group);if(!(!r&&!n))return{...r?{sort:r}:{},...n?{group:{by:n.by}}:{}}}var ce=(e,r)=>r?e==="1"?"true":"false":e;function pe(e,r,n){let d=n.type==="boolean",u=d?["true","false"]:n.options??[],c=[...new Set([...(r.order??[]).filter(s=>u.includes(s)),...u])],f=r.closed??[],a=s=>{if(s.key==="")return[1,0];let i=ce(s.key,d);if(f.includes(i))return[2,f.indexOf(i)];let y=c.indexOf(i);return[0,y<0?c.length:y]};return e.map((s,i)=>({group:s,at:i,rank:a(s)})).sort((s,i)=>s.rank[0]-i.rank[0]||s.rank[1]-i.rank[1]||s.at-i.at).map(({group:s,rank:i})=>({...s,closed:i[0]===2}))}export{J as a,le as b,pe as c,te as d,ne as e,oe as f,fe as g,ae as h};
@@ -1 +1 @@
1
- import{fa as V,ga as w}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{qd as u,ud as h}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
1
+ import{fa as V,ga as w}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import{ud as u,yd as h}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
@@ -1,4 +1,4 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as X,c as H,d as J,e as Q}from"./chunk.YGZGMRDC.js";import{b as ie}from"./chunk.LWLI5PI4.js";import"./chunk.6ZJE5M2A.js";import"./chunk.XUHY4XO2.js";import"./chunk.DU75P3Y7.js";import"./chunk.2SWQI4HF.js";import"./chunk.QIAH7HHO.js";import"./chunk.DNJM6WQO.js";import"./chunk.5D6SIBOK.js";import"./chunk.CPNE6HPQ.js";import"./chunk.GZHZLJBF.js";import"./chunk.OL2N5NUV.js";import"./chunk.OJGHDWI6.js";import"./chunk.5DPFAVCZ.js";import"./chunk.5EZDXWOE.js";import"./chunk.MIQMPOWF.js";import"./chunk.T66UK7PQ.js";import"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{F as K,G as q,Ga 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.WSMYFEGU.js";import{a as N}from"./chunk.SDO3U72B.js";import{Xa as _,Ya as D,da as I,fa as G,ia as B,wb as W}from"./chunk.WR63RQGU.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.Q7X2IVLH.js";import{a as X,c as H,d as J,e as Q}from"./chunk.22MIRLL6.js";import"./chunk.NFU4UM6F.js";import"./chunk.AKVBU5K5.js";import"./chunk.LLOZKUCA.js";import"./chunk.DH7M57SE.js";import"./chunk.AIK3Z25Y.js";import"./chunk.CKV2QCH5.js";import"./chunk.TAJ2R44N.js";import"./chunk.V3NPUAPB.js";import"./chunk.GZHZLJBF.js";import"./chunk.E5XNQTEU.js";import"./chunk.OJGHDWI6.js";import"./chunk.K5YLQAFW.js";import"./chunk.XJFAUOJS.js";import"./chunk.DPPT6WAJ.js";import"./chunk.7U2JO7ET.js";import"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{F as K,G as q,Ga 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.NPAWTPLQ.js";import{a as N}from"./chunk.SDO3U72B.js";import{Za as _,_a as D,da as I,ga as G,ka as B,zb as W}from"./chunk.YEJ4LNUP.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)?I(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.LMXNHBGH.js","./chunk.DBCVZGCC.js","./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.PIHCXN5U.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.WSMYFEGU.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4OMSQFIY.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=>G(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.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BNEOLRQG.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.2YNZVNCA.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};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as B,g as ne,h as ie}from"./chunk.NFU4UM6F.js";import{a as Z,b as ee,c as te}from"./chunk.AKVBU5K5.js";import{b}from"./chunk.LLOZKUCA.js";import{d as D}from"./chunk.CKV2QCH5.js";import{a as X}from"./chunk.V3NPUAPB.js";import{a as I}from"./chunk.XJFAUOJS.js";import{j as Q}from"./chunk.HFVMGTNL.js";import{G as U,Ga as _,J as G,O,P as T,Ra as J,T as V,Va as K,ba as w,ja as Y}from"./chunk.NPAWTPLQ.js";import{a as P}from"./chunk.SDO3U72B.js";import{$a as q,_a as z,da as E,ga as F,zb as x}from"./chunk.YEJ4LNUP.js";import{b as L}from"./chunk.AJZBJBMO.js";var y=L(U(),1);var ae=L(U(),1);function re(){let{ai:i,aiDesk:n}=w(),{entries:r}=G(n),a=i.off===!0;return(0,ae.useEffect)(()=>{a||n.load()},[n,a]),a?[]:r}var e=L(V(),1),se=_(P(()=>(__graviewPreload(import.meta.url,["./chunk.65Q5MKDW.js","./chunk.JZDKHWRL.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4YI6656P.js")))),he=se.part((i,n)=>(0,e.jsx)(i.InteractionRow,{...n}),{quiet:!0,as:"li"}),ce=se.part((i,n)=>(0,e.jsx)(i.ActivityFilter,{...n}),{quiet:!0,as:"div"}),ye=i=>i.undoes===void 0&&i.primitives.some(n=>n.op==="remove-node"||n.op==="patch-node"&&n.after[q]===!0&&n.before[q]!==!0);function fe(i){let n=[...new Set(i.ops.filter(r=>!x(r)&&ye(r)).map(r=>r.intent))].filter(r=>r!==i.intent);return n.length===0?i.intent:`${i.intent} \u2014 ${n.join("; ")}`}var oe=(i,n,r=de(i,[n]))=>({intent:fe(n),author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:X(n.lineage)}:{},touched:[...new Set(n.ops.filter(a=>!x(a)).flatMap(a=>a.writes))],...ve(n.ops.filter(a=>!x(a)).flatMap(a=>a.writes),r),batch:n.id,at:n.at,...n.lineage?.interaction?{interaction:n.lineage.interaction}:{},seq:n.ops.at(-1).seq+1,...n.ops.every(x)?{withheld:!0}:{}});function me(i=4){let{store:n,principal:r}=w(),a=T(n,r),d=a.log.length;return(0,y.useMemo)(()=>{let s=a.batches(),l=de(a,s);return ee(s,o=>a.log.get(o)).reverse().slice(0,i).map(o=>{if("batch"in o){let p=oe(a,o.batch,l);return o.typed?{...p,intent:Z(o.typed,a.schema,a.graph),batches:o.typed.batches.filter(c=>!c.undone).map(c=>c.id)}:p}let u=[...o.digest.batches].reverse().map(p=>oe(a,p,l));return{intent:te(o.digest),author:o.digest.author.kind,...o.digest.author.id?{authorId:o.digest.author.id}:{},by:o.digest.author,touched:[...new Set(u.flatMap(p=>p.touched))],batch:"",...u[0]?.at?{at:u[0].at}:{},seq:u[0]?.seq??0,digest:u}})},[a,d,i])}function de(i,n){let r=new Map;for(let a of n)for(let d of a.ops)if(!x(d))for(let s of d.primitives)(s.op==="add-node"||s.op==="remove-node")&&s.node&&r.set(s.node.id,F(i.schema.tryDefinition(s.node.kind),s.node));return r}function ve(i,n){let r={};for(let a of i){let d=n.get(a);d!==void 0&&(r[a]=d)}return Object.keys(r).length>0?{named:r}:{}}function we({change:i}){let{store:n,principal:r,seats:a,people:d}=w();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[i.author==="human"&&i.by?.onBehalfOf===void 0&&(i.authorId===void 0||r.id===void 0||i.authorId===r.id)?"you":z(i.by??{kind:i.author,id:i.authorId},{graph:n.graph,schema:n.schema,seats:a,people:d}),I(i.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(i.via)]}):null]})}function be({change:i,goes:n}){let{store:r}=w(),[a,d]=(0,y.useState)(!1),s=i.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(we,{change:i})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:i.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":a,onClick:()=>d(l=>!l),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:a?"Hide":"Show each"})]}),a?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:s.map(l=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:l.intent}),l.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.basis]}):null]}),l.withheld?null:(0,e.jsx)(j,{batch:l.batch})]}),l.touched.length>0?(0,e.jsx)("div",{"data-touched":l.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:l.touched.slice(0,4).map(o=>(0,e.jsx)(M,{id:o,label:r.graph.has(o)?b(r,o):l.named?.[o]??b(r,o),go:n(o)},o))}):null]},l.batch))}):null]})}function j({batch:i}){let{store:n,principal:r,noteSeat:a}=w(),d=T(n,r),s=O()?.open??!1,l=d.log.length,[o,u]=(0,y.useState)(null),p=(0,y.useMemo)(()=>d.canUndo(i),[d,i,l]);if(s||!p.ok&&p.ops.length===0)return null;let c=!p.ok,k=c?p.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:c?`${p.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{u(null);try{let v=typeof i=="string"?[i]:i,S=d.log.all().find(C=>v.includes(C.batch)&&C.author.kind==="agent");d.undo(c?[...v,...k]:typeof i=="string"?i:[...i],{author:r}),S&&a({type:"home",author:S.author})}catch(v){u(v instanceof Error?v.message:String(v))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...c?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:c?`undo +${k.length}`:"undo"}),o?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:o}):null]})}function ke({seq:i,intent:n}){let r=O();if(!r)return null;let a=r.past?.seq===i;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":a,onPointerEnter:B,onFocus:B,onClick:()=>r.show(i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function xe(){let i=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(i())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function M({id:i,label:n,go:r}){return r?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":i,title:`Go to ${n}`,onClick:()=>r(i),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(D,{label:n})}):(0,e.jsx)(D,{label:n})}function Be({calls:i,seat:n,remembers:r=!1}){let a=me(),{store:d,principal:s,seats:l,people:o}=w(),u=re(),[p,c]=(0,y.useState)("all"),[k,v]=(0,y.useState)(!1),S=t=>t!==void 0&&(t.id===s.id||t.onBehalfOf?.id===s.id)&&s.id!==void 0,C=new Set(u.map(t=>t.id)),le=a.filter(t=>!(t.interaction!==void 0&&C.has(t.interaction))&&(!k||S(t.by))),pe=u.filter(t=>!k||S(t.by)).slice(0,4),R=[...p==="ai"?[]:le.map(t=>({at:t.at??"",change:t})),...p==="changes"?[]:pe.map(t=>({at:t.at,entry:t}))].sort((t,f)=>t.at<f.at?1:t.at>f.at?-1:0),m=T(d,s),H=i.some(t=>t.phase==="running"),ge=ne(),A=K("activity"),N=A.open,ue=Y(),$=O(),W=t=>m.graph.has(t)?f=>{A.setOpen(!1),$?.past&&$.show(null),ue.record(f)}:null;return n===void 0&&i.length===0&&a.length===0&&u.length===0&&!r&&ge===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...A.trigger,onClick:A.toggle,title:H?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:H?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[H?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,a.length>0?a.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!N&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,N?(0,e.jsxs)("section",{...A.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...J,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...Q,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:i.length>0||R.length>0?9:0,...i.length>0||R.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,i.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:i.slice(0,6).map((t,f)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",m.allMutations().find(g=>g.name===t.name)?.title??E(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)(M,{id:g,label:b(m,g),go:W(g)},g)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(g=>typeof g=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(g=>typeof g[1]=="string").slice(0,3).map(([g,h])=>(0,e.jsx)(M,{id:h,label:b(m,h),go:W(h)},g))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${f}`))}):null,u.length>0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(ce,{shows:p,onShows:c,mine:k,onMine:v})}):null,R.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:R.map(({change:t,entry:f},g)=>f!==void 0?(0,e.jsx)(y.Suspense,{fallback:null,children:(0,e.jsx)(he,{entry:f,undo:h=>(0,e.jsx)(j,{batch:h})})},`ai:${f.id}`):t.digest?(0,e.jsx)(be,{change:t,goes:W},`digest:${t.digest[0]?.batch??g}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${g}`):(0,e.jsxs)("li",{"data-batch":t.batch,style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||s.id===void 0||t.authorId===s.id)?"you":z(t.by??{kind:t.author,id:t.authorId},{graph:m.graph,schema:m.schema,seats:l,people:o}),I(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",I(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(ke,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(j,{batch:t.batches&&t.batches.length>0?t.batches.length===1?t.batches[0]:t.batches:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(h=>(0,e.jsx)(M,{id:h,label:m.graph.has(h)?b(m,h):t.named?.[h]??b(m,h),go:W(h)},h))})]},`change:${g}`))}):null,(0,e.jsx)(ie,{style:{paddingTop:8,borderTop:"1px solid var(--graview-edge)"}}),r?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(xe,{})]}):null]}):null]})}export{j as a,Be as b};
@@ -0,0 +1 @@
1
+ import{b as mt}from"./chunk.UQQAGT3R.js";import{a as pt}from"./chunk.6HLKAUWF.js";import{f as dt}from"./chunk.FCUDBMGC.js";import{a as F,f as q}from"./chunk.KMEKMCKG.js";import{F as Q,I as X,K as k,Nb as ft,Q as G,T as tt,V as nt,W as et,ba as rt,da as M,ga as _,ja as ot,kb as lt,ma as at,nb as ut,oa as st,od as ct}from"./chunk.YEJ4LNUP.js";import{e as it}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function J(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let s=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!s}),n=r.as==="open"}return e}function D(t,e){return J(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Et(t){return D(t,!1)}function Pt(t){return D(t,!0)}function yt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function z(t){let e=u=>J(u).map(({part:o,space:a})=>({...o,space:a})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,s=u=>`${D(n,u)}${r?`, when ${D(r,u)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:s(!1),said:s(!0)}}function Lt(t,e=!1){return t.line?yt(t.line,e):t.message}var gt=60,O=t=>({text:t,as:"name"}),c=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},L=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},R=(t,e)=>({text:t,as:"op",said:e}),v={text:"(",as:"open"},w={text:")",as:"close"},N={text:"\u2014",as:"value",said:"empty"},V={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},xt=t=>t.t==="binary"&&t.op in V;function I(t){return rt(t)}function bt(t){let{schema:e}=t,n=l=>l===null?void 0:e.tryDefinition(l),r=(l,m)=>{let g=n(l)?.edges;return g&&Object.hasOwn(g,m)?g[m]:void 0},s=(l,m)=>{let g=r(l,m)?.to;return Array.isArray(g)&&g.length===1?g[0]:null},u=(l,m)=>{let g=(e.edge(m)?.from??[]).filter(W=>{let K=r(W,m)?.to;return l===null||K==="*"||Array.isArray(K)&&K.includes(l)});return g.length===1?g[0]:null},o=(l,m)=>r(l,m)?M(m).toLowerCase():I(at(n(l),m)),a=l=>I(ot(e,l)),d=l=>I(dt(e).get(l)?.label??M(l)),b=l=>I(st(n(l),l)),i=(l,m)=>{let g=l===null?void 0:t.formatOf?.(l,m);if(g?.format)return g;let W=t.said?.get(m);return W?{...g,format:W}:g},p=l=>_(e.tryDefinition(l.kind),l),h=t.money?.locale,y=(l,m)=>{if(l==null)return N;if(l instanceof F){if(l.nodes.length===0)return N;let A=l.nodes.slice(0,3).map(p),Y=l.nodes.length-A.length;return L(Y>0?`${A.join(", ")} and ${Y} more`:A.length>1?`${A.slice(0,-1).join(", ")} and ${A[A.length-1]}`:A[0])}if(Array.isArray(l))return L(`{${l.map(A=>y(A,m).text).join(", ")}}`,l.map(A=>y(A,m).text).join(" or "));if(typeof l=="object")return L(p(l));if(typeof l=="boolean")return L(l?"yes":"no");let g=m?.format??(m?i(m.kind,m.key):void 0);if(typeof l=="number")return L(g&&g.format!=="date"?ft(l,{...t.money,...g}):et(l,h));if(Q.test(l)||g?.format==="date")return L(G(nt(l,t.money?.timeZone)??l.slice(0,10),h));if(X.test(l))return L(tt(l,h,t.money?.timeZone));let W=m&&m.kind!==null?n(m.kind)?.display?.format?.[m.key]:void 0;if(W)return L(W(l));let K=l.length>gt?`${l.slice(0,gt-1).trimEnd()}\u2026`:l;return L(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test(K)?K.replace(/[-_]+/g," "):K)};return{definition:n,relation:r,farOf:s,nearOf:u,fieldName:o,plural:a,noun:b,factName:d,formatOf:i,valueWords:y,locale:h}}function P(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:E(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=E(t.args[0],e,n),s=t.args[1];if(s.t==="ident")return{kind:r,key:s.name};if(s.t==="lit"&&typeof s.value=="string")return{kind:r,key:s.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return P(t.left,e,n)??P(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return P(t.args[1],e,n)??P(t.args[2],e,n)}function E(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(E(t.object,e,n),t.name);case"where":return E(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?E(t.left,e,n):null;case"call":{let r=s=>{let u=t.args[s];return u?.t==="lit"&&typeof u.value=="string"?u.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(E(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(E(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?E(t.args[0],e,n):null}default:return null}}function j(t){return t.t==="binary"?t.op==="||"?H(t)?4:1:t.op==="&&"?2:t.op in V||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var $=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function C(t,e){return t.t==="binary"&&t.op===e?[...C(t.left,e),...C(t.right,e)]:[t]}function H(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...C(t,"||"));let n,r=[];for(let s of e){if(s.t!=="binary"||s.op!=="=="||!$(s.right)||typeof s.right.value!="string"||n&&JSON.stringify(ht(n))!==JSON.stringify(ht(s.left)))return;n=s.left,r.push(s.right)}return n?{subject:n,values:r}:void 0}var ht=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function f(t,e,n,r){let s=(u,o,a=e)=>j(u)<o?[v,...f(u,a,n),w]:f(u,a,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(u=>u.t==="lit"?u.value:null),r)];case"ident":return[O(n.fieldName(e,t.name))];case"member":{let u=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),o=E(t.object,e,n);if(u&&o)return e!==null&&n.fieldName(e,t.name)===n.fieldName(o,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[O(`${n.noun(o)}'s ${n.fieldName(o,t.name)}`)]:[O(n.fieldName(o,t.name))];let a=f(t.object,e,n),d=a[a.length-1];return a.length===1&&d?.as==="name"?[O(`${d.text}'s ${n.fieldName(o,t.name)}`)]:[...a,c("'s"),O(n.fieldName(o,t.name))]}case"unary":return t.op==="-"?[R("\u2212","minus"),...s(t.operand,7)]:T(t.operand,e,n);case"where":{let u=E(t.set,e,n),o=f(t.filter,u,n),a=o.every(d=>d.as==="name"||d.as==="word"&&d.text==="not");return[...s(t.set,4),...a?[]:[c("with")],...j(t.filter)<=2?[v,...o,w]:o]}case"binary":return Rt(t,e,n);case"call":return jt(t,e,n)}}function T(t,e,n){return xt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...f(t.args[0],e,n),R("=","is"),N]:t.t==="ident"?[c("not"),O(n.fieldName(e,t.name))]:[c("not"),v,...f(t,e,n),w]}function Rt(t,e,n){let r=(o,a)=>j(o)<a?[v,...f(o,e,n),w]:f(o,e,n);if(t.op==="&&"||t.op==="||"){let o=H(t);if(o){let d=P(o.subject,e,n);return[...f(o.subject,e,n),R("\u2208","is one of"),n.valueWords(o.values.map(b=>b.value),d)]}let a=t.op==="&&"?2:1;return[...r(t.left,a),c(t.op==="&&"?"and":"or"),...r(t.right,a+.5)]}if(t.op in V){if($(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?f(t.left,e,n):T(t.left,e,n);let[o,a]=V[t.op],d=P(t.left,e,n),b=P(t.right,e,n);return[...S(t.left,e,n,b),R(o,a),...S(t.right,e,n,d)]}if(t.op==="in")return[...r(t.left,5),R("\u2208","is one of"),...S(t.right,e,n,P(t.left,e,n))];let s=At[t.op];if(s){let o=j(t);return[...r(t.left,o),R(s[0],s[1]),...r(t.right,o+.5)]}let u={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),c(u[t.op]??t.op),...r(t.right,5)]}function S(t,e,n,r){return t.t==="lit"||t.t==="list"?f(t,e,n,r):j(t)<5?[v,...f(t,e,n),w]:f(t,e,n)}function jt(t,e,n){let r=o=>t.args[o],s=o=>{let a=t.args[o];return a?.t==="lit"&&typeof a.value=="string"?a.value:void 0},u=o=>{let a=r(o);return j(a)<9&&a.t!=="where"?[v,...f(a,e,n),w]:f(a,e,n)};switch(t.fn){case"out":{let o=s(t.args.length-1)??"",a=O(M(o).toLowerCase());return t.args.length===2?[a,c("of"),...u(0)]:[a]}case"in":{let o=s(t.args.length-1)??"",a=t.args.length===2?n.nearOf(E(r(0),e,n),o):n.nearOf(e,o),d=O(a?n.plural(a):M(o).toLowerCase());return t.args.length===2?[d,c("of"),...u(0)]:[d]}case"all":{let o=s(0),a=t.args[1]?.t==="lit"?t.args[1].value:void 0,d=a===!0?[c("archived")]:a==="all"?[c("archived or not")]:[];return a===!0?[...d,O(o?n.plural(o):"everything")]:[O(o?n.plural(o):"everything"),...d]}case"fact":{let o=s(0);return[O(o?n.factName(o):"fact")]}case"count":return[c("number of"),...u(0)];case"exists":return[...u(0),R("\u2260","is not"),N];case"present":return[...f(r(0),e,n),R("\u2260","is not"),N];case"some":case"every":{let o=E(r(0),e,n),a=r(1);return[...t.fn==="some"?[c("some")]:[],...u(0),c(t.fn==="some"?"with":"all with"),...j(a)<=2?[v,...f(a,o,n),w]:f(a,o,n)]}case"sum":case"min":case"max":{let o=E(r(0),e,n),a=r(1),d=a.t==="lit"&&typeof a.value=="string"?[O(n.fieldName(o,a.value))]:j(a)<9?[v,...f(a,o,n),w]:f(a,o,n);return[c(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...d,c("of"),...u(0)]}case"first":{let o=r(0);if(x(o,"all")){let a=o.args[0]?.value;if(typeof a=="string")return[O(`the ${n.noun(a)}`)]}return[c("first of"),...u(0)]}case"sort":return[...u(0),c("by"),...f(r(1),E(r(0),e,n),n)];case"len":return[c("length of"),...f(r(0),e,n)];case"lower":return f(r(0),e,n);case"contains":case"startsWith":return[...f(r(0),e,n),c(t.fn==="contains"?"contains":"starts with"),...S(r(1),e,n,P(r(0),e,n))];case"today":return[L("today")];case"now":return[L("now")];case"date":return $(r(0))&&typeof r(0).value=="string"?[L(G(String(r(0).value),n.locale))]:f(r(0),e,n);case"days":case"hours":{let o=t.fn,[a,d]=[r(0),r(1)];return x(d,"today")||x(d,"now")?[c(`${o} since`),...f(a,e,n)]:x(a,"today")||x(a,"now")?[c(`${o} until`),...f(d,e,n)]:[c(`${o} from`),...f(a,e,n),c("to"),...f(d,e,n)]}case"if":return[v,...f(r(1),e,n),c("if"),...f(r(0),e,n),c(","),c("else"),...f(r(2),e,n),w];case"either":return t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),c("else"),...f(o,e,n)]);default:return[c(t.fn),v,...t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),...f(o,e,n)]),w]}}function U(t,e){let n=bt(e),r=t.over==="graph"?null:t.over;return z({...r===null?{}:{kind:r},parts:f(t.require,r,n),...t.when?{when:f(t.when,r,n)}:{}})}function Z(t,e,n){let r=bt(e),s=t.over==="graph"?null:t.over,u=n.subject,o=i=>{try{return q(i,{...n,budget:2e3})}catch{return}},a=(i,p)=>{let h=S(i,s,r,p);if(i.t==="lit"||i.t==="list"||x(i,"today")||x(i,"now")||x(i,"date"))return h;let y=o(i);if(y===void 0)return h;let l=P(i,s,r),m=r.valueWords(y,l?{...l,format:r.formatOf(l.kind,l.key)??(p?r.formatOf(p.kind,p.key):void 0)}:p);return y instanceof F?[...h,c(":"),m]:[...h,m]},d=i=>{if(i.t==="binary"&&i.op==="&&"){let p=[];p.push(...C(i,"&&"));let h=p.filter(y=>o(y)!==!0);return(h.length>0?h:p).flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op==="||"){let p=H(i);if(p){let y=P(p.subject,s,r);return[...a(p.subject),R("\u2209","is not one of"),r.valueWords(p.values.map(l=>l.value),y)]}let h=[];return h.push(...C(i,"||")),h.flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op in V){if($(i.right)&&typeof i.right.value=="boolean"&&(i.op==="=="||i.op==="!="))return i.op==="=="===i.right.value?T(i.left,s,r):f(i.left,s,r);let p=B[i.op],[h,y]=V[p],l=P(i.left,s,r),m=P(i.right,s,r);if($(i.right)&&i.right.value===null)return[...p==="=="?S(i.left,s,r,m):a(i.left,m),R(h,y),N];let g=p==="=="&&($(i.right)||$(i.left));return[...g?S(i.left,s,r,m):a(i.left,m),R(h,y),...g?S(i.right,s,r,l):a(i.right,l)]}if(i.t==="binary"&&i.op==="in")return[...a(i.left),R("\u2209","is not one of"),...S(i.right,s,r,P(i.left,s,r))];if(i.t==="unary"&&i.op==="!"){let p=i.operand;return xt(p)?d({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...a(p.args[0]),R("\u2260","is not"),N]:p.t==="ident"?f(p,s,r):[c("not"),v,...T(p,s,r),w]}if(x(i,"present")||x(i,"exists"))return[...f(i.args[0],s,r),R("=","is"),N];if(x(i,"some"))return[...f(i,s,r).slice(1),R("=","is"),N];if(x(i,"every")&&i.args.length===2){let p=o(i.args[0]);if(p instanceof F){let h=p.nodes.filter(y=>{try{return q(i.args[1],{...n,subject:y,budget:2e3})!==!0}catch{return!0}});return[...f(i,s,r),c(","),c("not"),r.valueWords(new F(h))]}}return i.t==="ident"?[c("not"),O(r.fieldName(s,i.name))]:[c("not"),v,...f(i,s,r),w]},b;try{b=d(t.require)}catch{b=[c("not"),v,...f(t.require,s,r),w]}return z({...s===null?{}:{kind:s},parts:b,...u?{record:_(e.schema.tryDefinition(u.kind),u)}:{}})}function vt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function St(t){return(e,n)=>{let r=t[e]?.fields?.[n],s=r?.format??(r?.type==="date"?"date":void 0);return s||r?.unit?{...s?{format:s}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Ot(t,e){return{schema:e,said:vt(t.says),...t.declared?{formatOf:St(t.declared)}:{},...t.money?{money:t.money}:{}}}function Qt(t,e){return t.shape?U(t.shape,Ot(t.shape,e)):void 0}var wt=new WeakMap;function Nt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let s=$t(r),u=n.get(s.invariant)?.shape;if(!u||s.status&&s.status!=="violated")return s;let o=s.subjectId?t.graph.getNode(s.subjectId):void 0;if(u.over!=="graph"&&!o)return s;let a=u.kinds;a||(a=wt.get(t.schema),a||wt.set(t.schema,a=pt(t.schema)));try{let d=t.today?.()??u.today?.()??k(),b=Z(u,Ot(u,t.schema),{graph:t.graph,subject:o??null,kinds:a,today:d});return{...s,line:b,...u.says?{}:{message:`${s.message} \u2014 ${b.text}`}}}catch{return s}})}function Wt(){ut((t,e,n,r)=>Nt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),mt(Kt)}function Kt(t,e,n,r){let s=e.graph,u=lt.from(t.schema,s.snapshot(),{validate:!1});for(let b of n?[...r].reverse().map(it):r)try{u.applyPrimitives([b],{restoring:!0})}catch{}let o=b=>t.violations(void 0,b),a=o(n?u:s),d=o(n?s:u);return{...ct(t.allInvariants(),a,d),violationsAfter:d}}function $t(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}Wt();export{Z as brokenLineOf,Wt as judgeWithLines,Kt as judgedForASeat,Lt as problemWords,Qt as ruleLine,U as ruleLineOf,yt as ruleLineWords,J as ruleSpacing,Pt as ruleSpoken,Et as ruleText,$t as unlined,Nt as withLines};
@@ -1,2 +1,2 @@
1
- import{a as Z,b as qe}from"./chunk.KHRS2SKB.js";import"./chunk.644FUGSX.js";import"./chunk.7KERB5CH.js";import"./chunk.HXR7EEXR.js";import{j as De,k as Ne,l as Oe}from"./chunk.PIQ52FCI.js";import"./chunk.Y3BEKXYB.js";import"./chunk.XEHLSKHP.js";import"./chunk.MSM6E6JK.js";import"./chunk.HJCQ6I3S.js";import"./chunk.FUZWXKTN.js";import"./chunk.YOBRVKJT.js";import"./chunk.DKJK2MMV.js";import"./chunk.XUHY4XO2.js";import{a as We,b as S}from"./chunk.DU75P3Y7.js";import{a as X,b as $e}from"./chunk.2SWQI4HF.js";import"./chunk.DNJM6WQO.js";import"./chunk.5D6SIBOK.js";import"./chunk.ATXSLBE3.js";import"./chunk.6UAUME5U.js";import"./chunk.BRCKXL7B.js";import{b as Pe,c as Le}from"./chunk.CPNE6HPQ.js";import"./chunk.EKP3HQAX.js";import"./chunk.XOZU4OFA.js";import"./chunk.QQ3YWKWU.js";import"./chunk.7ECBGIUK.js";import"./chunk.MFOSEOF4.js";import"./chunk.HUABTCQE.js";import"./chunk.DXJFAAOI.js";import"./chunk.5MSNKSTE.js";import"./chunk.KVQZ5FR6.js";import"./chunk.2HANQ737.js";import"./chunk.H536YUAZ.js";import{u as Re}from"./chunk.OL2N5NUV.js";import"./chunk.OJGHDWI6.js";import"./chunk.5DPFAVCZ.js";import"./chunk.5EZDXWOE.js";import{l as ze}from"./chunk.MIQMPOWF.js";import{c as Ce}from"./chunk.T66UK7PQ.js";import{j as Ie}from"./chunk.LMXNHBGH.js";import"./chunk.DBCVZGCC.js";import{G as ot,Ma as J,Ra as He,T as Me,Va as Ee,ba as O,h as Ae,u as Te}from"./chunk.WSMYFEGU.js";import"./chunk.SDO3U72B.js";import{Cb as be,Rc as Se,la as Q,ma as N,oc as xe,qc as ke}from"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(ot(),1);var t=Y(Me(),1);function wt(u,r,o){let c=r.on??r.about[r.about.length-1];De(u,r.about,{...o,pins:Z(),...c===void 0?{}:{focus:c}})}function bt({placement:u="float",chosen:r=!0}={}){let{menuAt:o}=O();return u==="menu"&&o===null?r?(0,t.jsx)(at,{}):null:(0,t.jsx)(lt,{placement:u})}function at(){let{store:u,setMenuAt:r,view:o}=O(),{selection:c}=J(),h=(0,a.useRef)(null),[E,y]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==E&&y(m)});let v=c.length===1&&!o.overview?u.graph.getNode(c[0]):void 0;return!v||E===null||E>=Be?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${S(u,v.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:v.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Be=564;function lt({placement:u}){let{store:r,menuAt:o,setMenuAt:c,view:h,signIn:E}=O(),y=(0,a.useRef)(null),v=(0,a.useRef)(null),b=(0,a.useRef)(null),m=(0,a.useRef)(null);o?.returnTo&&(m.current=o.returnTo);let Ke=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),d=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");v.current=d===null?null:{key:d,element:e}};(0,a.useEffect)(()=>{let e=y.current,i=v.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){v.current=null;let k=m.current;m.current=null,(k?.isConnected?k:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[_e,je]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent??y.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();je(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ue,set:Ve,clear:Ge}=J(),s=o?.about??Ue,[q,Ye]=(0,a.useState)(()=>Z()),F=o?.on??s[s.length-1],B=o?.about,Qe=(0,a.useMemo)(()=>({pins:q,...F===void 0?{}:{focus:F},...B?{about:B}:{}}),[q,F,B]),Je=(0,a.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:g,withheld:ee,observations:te}=Ne(Qe),I=ke(ee,E),f=I?st:ee,Xe=o===null?null:{face:o.face??"scene",on:o.on,about:s,field:o.field,place:o.place,href:o.href,act:o.act,element:o.returnTo},ne=Re(Xe),ie=te.some(e=>e.id.startsWith("schema:waits:")),{apply:Ze,preview:et}=Oe(),[C,z]=(0,a.useState)(null),[tt,re]=(0,a.useState)(!1),[oe,ae]=(0,a.useState)(!1),[L,R]=(0,a.useState)(""),nt=$e({letters:!0}),[le,K]=(0,a.useState)(null),_=(0,a.useRef)([]),j=(e,i)=>{try{return et(e,i),Ze(e,i),K(null),c(null),_.current=[],!0}catch(n){return K(ze(r.schema,r.allMutations(),n)),_.current=n instanceof be?n.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},$=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=$.length>0?$:[...new Set(s.flatMap(e=>Te(e)))],p=s.length===1?Ae(s[0]):null,U=p?{from:r.graph.getNode(p.from),to:r.graph.getNode(p.to)}:null,se=p?Le(r,p):void 0,de=se?.provisional?se:void 0,ue=p?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(p.from)?.kind??"")?.edges?.[p.kind],i=r.graph.getNode(p.to);return e?.inverse&&i?`From ${S(r,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),re(!1),ae(!1),K(null),R("")},[s,o?.about]);let l=o!==null,it=u==="menu"&&!l,A=(0,a.useRef)(o);A.current=o;let pe=Ee("acts",{open:l&&u==="menu",onOpenChange:e=>{e||c(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ce=(_e?.width??Number.POSITIVE_INFINITY)<Be;if((0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent;if(!e||!ce||l)return;let i=y.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let d=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=d}}),s.length===0&&!l)return null;let ge=o?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),he=Math.max(1,Math.min(9,g.length)),T=[...g.filter(e=>e.provider==="invariant"&&!e.destructive),...g.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...g.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.destructive)],me=T.length>he&&!l,fe=L.trim().toLowerCase(),w=me&&fe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(fe)):null,V=w??(tt||l?T:T.slice(0,he)),ye=w?0:T.length-V.length,W=[];for(let e of V){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,d=!l&&!i&&!n&&e.ties===!0&&!e.destructive,k=i?e.why:n?"pinned":d?"its ties":null,D=i?"violation":n||d?"ties":null,H=W[W.length-1];H&&H.heading===k?H.items.push(e):W.push({heading:k,tone:D,items:[e]})}let G=g.find(e=>e.id===C),P=s.length===1?S(r,s[0]):null,ve=e=>{if(!P)return e;let i=e.startsWith(`"${P}"`)?e.slice(P.length+2):e.startsWith(P)?e.slice(P.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},rt=new Set(l?[]:V.filter(e=>e.provider==="invariant").map(e=>e.why)),M=te.filter(e=>!rt.has(e.text)).map(e=>({...e,text:ve(e.text)}));return it?null:(0,t.jsxs)("section",{...l?pe.pane:{},ref:e=>{y.current=e,l&&pe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Ke(e.target),onBlur:e=>{e.relatedTarget!==null&&(v.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?He:{position:"absolute",zIndex:Se("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ce?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...Ie,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:ge||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[ge?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:o?.title??(s.length===1?S(r,s[0]):`${s.length} selected`)}),$.length>0||p?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:p?"relation":$.map(e=>N(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!p&&o?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{c(null),Ge()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),p&&U?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[ue?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ue}):null,de?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Pe(de)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",U.from],["to",U.to]].map(([e,i],n)=>(0,t.jsxs)(a.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>Ve([i.id]),title:`Select ${S(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:S(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!p&&s.length===1&&xe(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,M.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
1
+ import{a as Z,b as qe}from"./chunk.KHRS2SKB.js";import"./chunk.3X3GLNWQ.js";import"./chunk.644FUGSX.js";import"./chunk.AQCU6TPV.js";import{j as De,k as Ne,l as Oe}from"./chunk.EC5IWN74.js";import"./chunk.MORMTKVR.js";import"./chunk.PJCVFYFU.js";import"./chunk.7RJGEU3Y.js";import"./chunk.HJCQ6I3S.js";import"./chunk.7O6Z3BFR.js";import"./chunk.I2C5LPB5.js";import"./chunk.6Q6BW4QT.js";import"./chunk.AKVBU5K5.js";import{a as We,b as S}from"./chunk.LLOZKUCA.js";import{a as X,b as $e}from"./chunk.DH7M57SE.js";import"./chunk.CKV2QCH5.js";import"./chunk.TAJ2R44N.js";import"./chunk.64IKLRUS.js";import"./chunk.DTSTUC2W.js";import"./chunk.RDL6652E.js";import{b as Pe,c as Le}from"./chunk.V3NPUAPB.js";import"./chunk.USQNSNIA.js";import"./chunk.XOZU4OFA.js";import"./chunk.IT763BYH.js";import"./chunk.7ECBGIUK.js";import"./chunk.UQQAGT3R.js";import"./chunk.T2RME6XF.js";import"./chunk.SOTB6C5A.js";import"./chunk.TQCRFZ53.js";import"./chunk.6HLKAUWF.js";import"./chunk.FCUDBMGC.js";import"./chunk.KMEKMCKG.js";import{u as Re}from"./chunk.E5XNQTEU.js";import"./chunk.OJGHDWI6.js";import"./chunk.K5YLQAFW.js";import"./chunk.XJFAUOJS.js";import{l as ze}from"./chunk.DPPT6WAJ.js";import{c as Ce}from"./chunk.7U2JO7ET.js";import{j as Ie}from"./chunk.HFVMGTNL.js";import"./chunk.7Z4USR3Y.js";import{G as ot,Ma as J,Ra as He,T as Me,Va as Ee,ba as O,h as Ae,u as Te}from"./chunk.NPAWTPLQ.js";import"./chunk.SDO3U72B.js";import{Fb as be,Vc as Se,na as Q,oa as N,rc as xe,tc as ke}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(ot(),1);var t=Y(Me(),1);function wt(u,r,o){let c=r.on??r.about[r.about.length-1];De(u,r.about,{...o,pins:Z(),...c===void 0?{}:{focus:c}})}function bt({placement:u="float",chosen:r=!0}={}){let{menuAt:o}=O();return u==="menu"&&o===null?r?(0,t.jsx)(at,{}):null:(0,t.jsx)(lt,{placement:u})}function at(){let{store:u,setMenuAt:r,view:o}=O(),{selection:c}=J(),h=(0,a.useRef)(null),[E,y]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==E&&y(m)});let v=c.length===1&&!o.overview?u.graph.getNode(c[0]):void 0;return!v||E===null||E>=Be?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${S(u,v.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:v.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var Be=564;function lt({placement:u}){let{store:r,menuAt:o,setMenuAt:c,view:h,signIn:E}=O(),y=(0,a.useRef)(null),v=(0,a.useRef)(null),b=(0,a.useRef)(null),m=(0,a.useRef)(null);o?.returnTo&&(m.current=o.returnTo);let Ke=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),d=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");v.current=d===null?null:{key:d,element:e}};(0,a.useEffect)(()=>{let e=y.current,i=v.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){v.current=null;let k=m.current;m.current=null,(k?.isConnected?k:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[_e,je]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent??y.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();je(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ue,set:Ve,clear:Ge}=J(),s=o?.about??Ue,[q,Ye]=(0,a.useState)(()=>Z()),F=o?.on??s[s.length-1],B=o?.about,Qe=(0,a.useMemo)(()=>({pins:q,...F===void 0?{}:{focus:F},...B?{about:B}:{}}),[q,F,B]),Je=(0,a.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:g,withheld:ee,observations:te}=Ne(Qe),I=ke(ee,E),f=I?st:ee,Xe=o===null?null:{face:o.face??"scene",on:o.on,about:s,field:o.field,place:o.place,href:o.href,act:o.act,element:o.returnTo},ne=Re(Xe),ie=te.some(e=>e.id.startsWith("schema:waits:")),{apply:Ze,preview:et}=Oe(),[C,z]=(0,a.useState)(null),[tt,re]=(0,a.useState)(!1),[oe,ae]=(0,a.useState)(!1),[L,R]=(0,a.useState)(""),nt=$e({letters:!0}),[le,K]=(0,a.useState)(null),_=(0,a.useRef)([]),j=(e,i)=>{try{return et(e,i),Ze(e,i),K(null),c(null),_.current=[],!0}catch(n){return K(ze(r.schema,r.allMutations(),n)),_.current=n instanceof be?n.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},$=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=$.length>0?$:[...new Set(s.flatMap(e=>Te(e)))],p=s.length===1?Ae(s[0]):null,U=p?{from:r.graph.getNode(p.from),to:r.graph.getNode(p.to)}:null,se=p?Le(r,p):void 0,de=se?.provisional?se:void 0,ue=p?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(p.from)?.kind??"")?.edges?.[p.kind],i=r.graph.getNode(p.to);return e?.inverse&&i?`From ${S(r,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),re(!1),ae(!1),K(null),R("")},[s,o?.about]);let l=o!==null,it=u==="menu"&&!l,A=(0,a.useRef)(o);A.current=o;let pe=Ee("acts",{open:l&&u==="menu",onOpenChange:e=>{e||c(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ce=(_e?.width??Number.POSITIVE_INFINITY)<Be;if((0,a.useLayoutEffect)(()=>{let e=y.current?.offsetParent;if(!e||!ce||l)return;let i=y.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let d=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=d}}),s.length===0&&!l)return null;let ge=o?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),he=Math.max(1,Math.min(9,g.length)),T=[...g.filter(e=>e.provider==="invariant"&&!e.destructive),...g.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...g.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...g.filter(e=>e.destructive)],me=T.length>he&&!l,fe=L.trim().toLowerCase(),w=me&&fe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(fe)):null,V=w??(tt||l?T:T.slice(0,he)),ye=w?0:T.length-V.length,W=[];for(let e of V){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,d=!l&&!i&&!n&&e.ties===!0&&!e.destructive,k=i?e.why:n?"pinned":d?"its ties":null,D=i?"violation":n||d?"ties":null,H=W[W.length-1];H&&H.heading===k?H.items.push(e):W.push({heading:k,tone:D,items:[e]})}let G=g.find(e=>e.id===C),P=s.length===1?S(r,s[0]):null,ve=e=>{if(!P)return e;let i=e.startsWith(`"${P}"`)?e.slice(P.length+2):e.startsWith(P)?e.slice(P.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},rt=new Set(l?[]:V.filter(e=>e.provider==="invariant").map(e=>e.why)),M=te.filter(e=>!rt.has(e.text)).map(e=>({...e,text:ve(e.text)}));return it?null:(0,t.jsxs)("section",{...l?pe.pane:{},ref:e=>{y.current=e,l&&pe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Ke(e.target),onBlur:e=>{e.relatedTarget!==null&&(v.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?He:{position:"absolute",zIndex:Se("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ce?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...Ie,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:ge||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[ge?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:o?.title??(s.length===1?S(r,s[0]):`${s.length} selected`)}),$.length>0||p?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:p?"relation":$.map(e=>N(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!p&&o?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{c(null),Ge()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),p&&U?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[ue?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ue}):null,de?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Pe(de)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",U.from],["to",U.to]].map(([e,i],n)=>(0,t.jsxs)(a.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>Ve([i.id]),title:`Select ${S(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:S(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!p&&s.length===1&&xe(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,M.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
2
2
  `),style:{display:"grid",gap:3},children:M.slice(0,2).map(e=>(0,t.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===M[1]&&M.length>2?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",M.length-2]}):null]},e.id))}):null,l?ne.start.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,le?(0,t.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:le}):null,me?(0,t.jsx)("input",{"data-testid":"action-filter",value:L,onChange:e=>R(e.target.value),placeholder:`Filter ${T.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),L.length>0?R(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?z(i.id):j(i)&&R("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,t.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",L.trim(),"\u201D."]}):null,I&&g.length===0||g.length===0&&!ie&&s.length===0?null:g.length===0&&!ie?(0,t.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${p?"this relation":x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:p?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Ce(r.schema,r.graph.getNode(p.from)?.kind??"",p.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?Q(N(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,t.jsxs)("ol",{...nt,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[W.map((e,i)=>(0,t.jsxs)(a.Fragment,{children:[e.heading?(0,t.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?ve(e.heading):e.heading]}):i>0?(0,t.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},onKeyDown:d=>{if(d.metaKey||d.ctrlKey||d.altKey)return;let k=d.currentTarget.querySelector("[data-affordance]"),D=d.currentTarget.querySelector("[data-pin-for]"),H=d.target===D,we=d.key==="ArrowRight"&&!H?D:H&&["ArrowLeft","ArrowUp","ArrowDown"].includes(d.key)?k:null;we&&(d.preventDefault(),d.stopPropagation(),we.focus())},children:[(0,t.jsxs)("button",{type:"button",[X]:"","data-affordance":n.id,"data-rank":n.rank,"data-graview-destructive":n.destructive||void 0,"aria-pressed":C===n.id,title:n.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===n.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...n.destructive?{color:"var(--graview-warn)"}:{},...C===n.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(n.open.length>0){z(C===n.id?null:n.id);return}j(n)},children:[n.label,n.open.length>0?(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===n.id&&!n.destructive?(0,t.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,t.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":n.mutation,"aria-pressed":n.pinned!==void 0,"aria-label":n.pinned!==void 0?`Unpin ${n.label}`:`Pin ${n.label}`,title:n.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":n.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Ye(qe(q,n.mutation,Je.has(n.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:n.pinned==="user"?"var(--graview-accent)":n.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:n.pinned!==void 0?"\u2605":"\u2606"})]},n.id))]},`${e.heading??"plain"}-${i}`)),ye>0?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",[X]:"",onClick:()=>re(!0),title:`Show all ${g.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",ye," more"]})}):null]}),I?(0,t.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{c(null),I.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:I.label}):null,f.length>0?(0,t.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,l||oe?f.length:3).map(e=>(0,t.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,t.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,t.jsx)("s",{children:e.label})}),(0,t.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!oe&&f.length>3?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>ae(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,l?ne.end.map(e=>(0,t.jsx)(Fe,{section:e,close:()=>c(null)},e.id)):null,G?(0,t.jsx)(We,{affordance:G,onApply:e=>{if(j(G,e))z(null);else return _.current},onCancel:()=>z(null)}):null]})}var st=[];function Fe({section:u,close:r}){return(0,t.jsxs)("div",{"data-menu-section":u.id,...u.heading?{role:"group","aria-label":u.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[u.heading?(0,t.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:u.heading}):null,u.items&&u.items.length>0?(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:u.items.map(o=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-menu-item":o.id,onClick:()=>{r(),o.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[o.label,o.hint?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",o.hint]}):null]})},o.id))}):null,u.render?.(r)]})}export{bt as InspectorPane,wt as prepareActs};
@@ -1 +1 @@
1
- import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk.LQCH2NFE.js";import"./chunk.PXQVXBNG.js";import"./chunk.B3WVCSW5.js";import"./chunk.WR63RQGU.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as createLinks,f as judgeDestination,e as listsOf,c as nowhere,a as placesSaid,b as quoted,d as whereOfWords};
1
+ import{b as a,c as b,d as c,e as d,f as e,g as f,h as g}from"./chunk.IF4FCQPG.js";import"./chunk.PXQVXBNG.js";import"./chunk.B3WVCSW5.js";import"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as createLinks,f as judgeDestination,e as listsOf,c as nowhere,a as placesSaid,b as quoted,d as whereOfWords};
@@ -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 t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.TAQB64FZ.js","./chunk.BBLIT7S7.js","./chunk.KY7QD22S.js","./chunk.LQCH2NFE.js","./chunk.PXQVXBNG.js","./chunk.F5RN6YXG.js","./chunk.ZPXAKRKG.js","./chunk.B3WVCSW5.js","./chunk.G2XDQPE4.js","./chunk.5XUVCM7X.js","./chunk.SDO3U72B.js","./chunk.WR63RQGU.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.URDCHVH3.js")));function v(i,r){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void i().then(m=>{e||r(m)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}export{d as a,v 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 t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.E4EN4X5F.js","./chunk.BBLIT7S7.js","./chunk.KY7QD22S.js","./chunk.IF4FCQPG.js","./chunk.PXQVXBNG.js","./chunk.F5RN6YXG.js","./chunk.AM2YRNOQ.js","./chunk.B3WVCSW5.js","./chunk.AGTFYPXY.js","./chunk.FBR4HJ2Q.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.GUP7LC5O.js")));function v(i,r){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void i().then(m=>{e||r(m)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}export{d as a,v as b};