graview 0.1.54 → 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 (197) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/{chunk.XTT6ERI3.js → chunk.22MIRLL6.js} +1 -1
  5. package/dist/preview/chunk.2BLRCT3E.js +1 -0
  6. package/dist/preview/chunk.2DETYEJM.js +1 -0
  7. package/dist/preview/{chunk.AN5QCSVK.js → chunk.2E6EWVWR.js} +1 -1
  8. package/dist/preview/{chunk.RBYRT2I2.js → chunk.2HZGUVB2.js} +1 -1
  9. package/dist/preview/{chunk.ZBHFCSKO.js → chunk.2OX4YI46.js} +1 -1
  10. package/dist/preview/{chunk.E5JX5LWY.js → chunk.2YNZVNCA.js} +1 -1
  11. package/dist/preview/chunk.3V2WH6F7.js +1 -0
  12. package/dist/preview/chunk.3X3GLNWQ.js +1 -0
  13. package/dist/preview/chunk.45VIF2SX.js +5 -0
  14. package/dist/preview/{chunk.VGOWGOGD.js → chunk.4EUH6TLG.js} +2 -2
  15. package/dist/preview/chunk.4EY6WPSM.js +2 -0
  16. package/dist/preview/{chunk.Y2DFDMT6.js → chunk.4KMY24YC.js} +1 -1
  17. package/dist/preview/chunk.4YI6656P.js +1 -0
  18. package/dist/preview/{chunk.D2PJG5N7.js → chunk.5B4HNQGR.js} +1 -1
  19. package/dist/preview/chunk.5MS2TQFX.js +1 -0
  20. package/dist/preview/chunk.5MSWUTDB.js +1 -0
  21. package/dist/preview/{chunk.BOMYLOCX.js → chunk.64IKLRUS.js} +1 -1
  22. package/dist/preview/{chunk.VYKEIKY5.js → chunk.65Q5MKDW.js} +1 -1
  23. package/dist/preview/{chunk.3IEJQAK7.js → chunk.6HLKAUWF.js} +1 -1
  24. package/dist/preview/chunk.6Q6BW4QT.js +2 -0
  25. package/dist/preview/chunk.7ECBGIUK.js +1 -0
  26. package/dist/preview/{chunk.J2Z6WLCH.js → chunk.7NP2I2UP.js} +1 -1
  27. package/dist/preview/{chunk.5C43AM3X.js → chunk.7O6Z3BFR.js} +1 -1
  28. package/dist/preview/chunk.7RJGEU3Y.js +1 -0
  29. package/dist/preview/{chunk.TUNHUTQ5.js → chunk.7U2JO7ET.js} +1 -1
  30. package/dist/preview/chunk.7Z2PRPYE.js +1 -0
  31. package/dist/preview/{chunk.3JMZHCB4.js → chunk.7Z4USR3Y.js} +1 -1
  32. package/dist/preview/chunk.AGTFYPXY.js +1 -0
  33. package/dist/preview/{chunk.XZJ6XX5I.js → chunk.AIK3Z25Y.js} +1 -1
  34. package/dist/preview/{chunk.ZDDWXRPK.js → chunk.AKVBU5K5.js} +1 -1
  35. package/dist/preview/chunk.AKW6NR3X.js +1 -0
  36. package/dist/preview/{chunk.2DFWOLL2.js → chunk.AM2YRNOQ.js} +1 -1
  37. package/dist/preview/{chunk.2WSRJGW2.js → chunk.APXYWI3L.js} +1 -1
  38. package/dist/preview/{chunk.7SCENHVG.js → chunk.AQCU6TPV.js} +1 -1
  39. package/dist/preview/{chunk.B2X6DA2Q.js → chunk.AZUTYY2S.js} +1 -1
  40. package/dist/preview/chunk.BJUUSIQY.js +1 -0
  41. package/dist/preview/{chunk.FRZQSSGE.js → chunk.BNEOLRQG.js} +1 -1
  42. package/dist/preview/chunk.BT7RLFPO.js +1 -0
  43. package/dist/preview/{chunk.4GHXAWIE.js → chunk.C2VFDBSG.js} +1 -1
  44. package/dist/preview/{chunk.C3AHDHX7.js → chunk.CGM7OER2.js} +1 -1
  45. package/dist/preview/{chunk.4F5M5XZG.js → chunk.CKV2QCH5.js} +1 -1
  46. package/dist/preview/{chunk.4KTHJY5N.js → chunk.CU2NQ5WF.js} +1 -1
  47. package/dist/preview/{chunk.ARRLAAG6.js → chunk.D4LN33J2.js} +1 -1
  48. package/dist/preview/{chunk.W6NCLU5Y.js → chunk.D6BMAGPR.js} +1 -1
  49. package/dist/preview/{chunk.RCFAHV5N.js → chunk.D6KF72MZ.js} +1 -1
  50. package/dist/preview/{chunk.L7MFTL5S.js → chunk.DH7M57SE.js} +1 -1
  51. package/dist/preview/chunk.DPPT6WAJ.js +2 -0
  52. package/dist/preview/{chunk.45HTFSWD.js → chunk.DTSTUC2W.js} +1 -1
  53. package/dist/preview/{chunk.VTO6UWUP.js → chunk.DWMAFMYZ.js} +1 -1
  54. package/dist/preview/chunk.DZYLH5IM.js +1 -0
  55. package/dist/preview/{chunk.PZ4G5QA5.js → chunk.E33EJU3Q.js} +1 -1
  56. package/dist/preview/{chunk.33YC5RCB.js → chunk.E4EN4X5F.js} +1 -1
  57. package/dist/preview/{chunk.DF7IPT7V.js → chunk.E4HSSGF7.js} +1 -1
  58. package/dist/preview/{chunk.PZWJUQAO.js → chunk.E5XNQTEU.js} +1 -1
  59. package/dist/preview/{chunk.FWKNR7XF.js → chunk.EC5IWN74.js} +2 -2
  60. package/dist/preview/chunk.FBR4HJ2Q.js +1 -0
  61. package/dist/preview/{chunk.AKLVSZ5A.js → chunk.FCUDBMGC.js} +1 -1
  62. package/dist/preview/chunk.FOQENWF5.js +1 -0
  63. package/dist/preview/{chunk.SLBWPVIY.js → chunk.FQLNBIQ5.js} +1 -1
  64. package/dist/preview/{chunk.562IVJHX.js → chunk.G3ORIU7C.js} +1 -1
  65. package/dist/preview/chunk.GNQW4JOG.js +18 -0
  66. package/dist/preview/chunk.GUP7LC5O.js +21 -0
  67. package/dist/preview/{chunk.FWZF7X6A.js → chunk.HFVMGTNL.js} +2 -2
  68. package/dist/preview/chunk.HVN2DVP3.js +1 -0
  69. package/dist/preview/{chunk.4WH4N4V7.js → chunk.I2C5LPB5.js} +1 -1
  70. package/dist/preview/{chunk.BPWSQVEN.js → chunk.IF4FCQPG.js} +1 -1
  71. package/dist/preview/{chunk.U7GN6UPR.js → chunk.ILSK2E3R.js} +1 -1
  72. package/dist/preview/{chunk.2LMB5E6N.js → chunk.IRMO4FUC.js} +1 -1
  73. package/dist/preview/chunk.IT763BYH.js +1 -0
  74. package/dist/preview/chunk.IUQOSPQX.js +1 -0
  75. package/dist/preview/{chunk.Y36WSKL5.js → chunk.J3YBEZKE.js} +1 -1
  76. package/dist/preview/{chunk.4V64RBCK.js → chunk.JHFHIG4P.js} +1 -1
  77. package/dist/preview/chunk.JL4DGITZ.js +1 -0
  78. package/dist/preview/{chunk.463PGKOL.js → chunk.JQY2UKU6.js} +1 -1
  79. package/dist/preview/{chunk.IDYPQ45A.js → chunk.JZDKHWRL.js} +1 -1
  80. package/dist/preview/{chunk.6BBB7SJL.js → chunk.K2JE3PD7.js} +1 -1
  81. package/dist/preview/chunk.K4MO22RM.js +1 -0
  82. package/dist/preview/{chunk.NEJSKMJV.js → chunk.K5YLQAFW.js} +1 -1
  83. package/dist/preview/{chunk.IMHUKSPM.js → chunk.KBL4Y4UN.js} +1 -1
  84. package/dist/preview/chunk.KMEKMCKG.js +3 -0
  85. package/dist/preview/{chunk.3ZONBC6L.js → chunk.LKK7VQBA.js} +1 -1
  86. package/dist/preview/chunk.LLOZKUCA.js +1 -0
  87. package/dist/preview/{chunk.YXRKZMS5.js → chunk.LP3SHWJG.js} +1 -1
  88. package/dist/preview/chunk.LVOVPU64.js +1 -0
  89. package/dist/preview/chunk.MEJUAV3Y.js +1 -0
  90. package/dist/preview/{chunk.7JCUSYS5.js → chunk.MFDSWA2W.js} +1 -1
  91. package/dist/preview/{chunk.JTOAZ2IR.js → chunk.MJMVGW6Z.js} +1 -1
  92. package/dist/preview/{chunk.SDO3DD77.js → chunk.MLRPCZVS.js} +1 -1
  93. package/dist/preview/{chunk.OCV46AFN.js → chunk.MORMTKVR.js} +1 -1
  94. package/dist/preview/{chunk.FMP6NDRZ.js → chunk.N3Q5CPVA.js} +1 -1
  95. package/dist/preview/{chunk.VW6X53E7.js → chunk.N7EEPFYV.js} +1 -1
  96. package/dist/preview/{chunk.NGWHV4G6.js → chunk.NBLMANHT.js} +1 -1
  97. package/dist/preview/{chunk.5RH6FO3K.js → chunk.NFU4UM6F.js} +1 -1
  98. package/dist/preview/chunk.NPAWTPLQ.js +25 -0
  99. package/dist/preview/{chunk.B6PKKEY3.js → chunk.NQ4VGKEC.js} +1 -1
  100. package/dist/preview/{chunk.MNW2ZBQ6.js → chunk.NUE5VG4G.js} +1 -1
  101. package/dist/preview/{chunk.XBDFXFWM.js → chunk.O6LDZWLR.js} +1 -1
  102. package/dist/preview/chunk.OBUKZQCZ.js +1 -0
  103. package/dist/preview/{chunk.GKLDSHHH.js → chunk.ONGZ3YQF.js} +1 -1
  104. package/dist/preview/chunk.OYGPNO7A.js +1 -0
  105. package/dist/preview/chunk.PJCVFYFU.js +1 -0
  106. package/dist/preview/{chunk.IYYP6QUH.js → chunk.PMPDLE56.js} +1 -1
  107. package/dist/preview/{chunk.PR2TSHE7.js → chunk.PRV3KYT6.js} +2 -2
  108. package/dist/preview/chunk.Q7X2IVLH.js +1 -0
  109. package/dist/preview/chunk.QAIYYIZQ.js +1 -0
  110. package/dist/preview/chunk.QNNRSPIJ.js +2 -0
  111. package/dist/preview/{chunk.KI6M3EWZ.js → chunk.QSO5BP2H.js} +1 -1
  112. package/dist/preview/{chunk.WICMCZ27.js → chunk.QW3QLE53.js} +1 -1
  113. package/dist/preview/{chunk.WHGEDJB2.js → chunk.QYFZ7AZS.js} +2 -2
  114. package/dist/preview/{chunk.Q6RUTFU3.js → chunk.RDL6652E.js} +1 -1
  115. package/dist/preview/{chunk.MDWCX3YU.js → chunk.RR2IFETZ.js} +1 -1
  116. package/dist/preview/{chunk.R7RDUW37.js → chunk.RXYE2DAJ.js} +1 -1
  117. package/dist/preview/chunk.SDLUWRGI.js +1 -0
  118. package/dist/preview/chunk.SOTB6C5A.js +1 -0
  119. package/dist/preview/{chunk.3SOJJAMY.js → chunk.SRC37GNP.js} +1 -1
  120. package/dist/preview/{chunk.CB7IUKY7.js → chunk.SVAQGVS4.js} +1 -1
  121. package/dist/preview/chunk.T2RME6XF.js +1 -0
  122. package/dist/preview/{chunk.COWJTVZV.js → chunk.T6HG2XIP.js} +1 -1
  123. package/dist/preview/{chunk.6TILXTP6.js → chunk.TAIYNHSW.js} +1 -1
  124. package/dist/preview/chunk.TAJ2R44N.js +1 -0
  125. package/dist/preview/{chunk.BUDEUNBN.js → chunk.TQCRFZ53.js} +1 -1
  126. package/dist/preview/{chunk.ZYW7Q5EN.js → chunk.TXWCTHMI.js} +1 -1
  127. package/dist/preview/chunk.UE5YS3GN.js +1 -0
  128. package/dist/preview/{chunk.C6HBYRGJ.js → chunk.UQQAGT3R.js} +1 -1
  129. package/dist/preview/chunk.USB6B6L3.js +104 -0
  130. package/dist/preview/{chunk.KRVEAIKW.js → chunk.USQNSNIA.js} +1 -1
  131. package/dist/preview/{chunk.AZGXBTOQ.js → chunk.V3NPUAPB.js} +1 -1
  132. package/dist/preview/{chunk.NDI5OWIB.js → chunk.VDD3RHLB.js} +1 -1
  133. package/dist/preview/{chunk.ULSN3ASK.js → chunk.VEOS25PQ.js} +1 -1
  134. package/dist/preview/chunk.VIQ6EF2O.js +1 -0
  135. package/dist/preview/{chunk.OZ4EJ5M6.js → chunk.VLBY66PB.js} +2 -2
  136. package/dist/preview/chunk.VSM72NVF.js +1 -0
  137. package/dist/preview/{chunk.GVUJCOKD.js → chunk.VYW7DSUW.js} +2 -2
  138. package/dist/preview/{chunk.DTJ4FIHM.js → chunk.WMB2NNBD.js} +1 -1
  139. package/dist/preview/{chunk.KJGNLWU3.js → chunk.WPJVMVAL.js} +1 -1
  140. package/dist/preview/{chunk.CB5DGKR5.js → chunk.XGCOWCA2.js} +1 -1
  141. package/dist/preview/chunk.XJFAUOJS.js +1 -0
  142. package/dist/preview/{chunk.7TMWMW4W.js → chunk.XY5EVI22.js} +1 -1
  143. package/dist/preview/chunk.YEJ4LNUP.js +5 -0
  144. package/dist/preview/{chunk.FCZ7UFJI.js → chunk.YL5ZCRHQ.js} +1 -1
  145. package/dist/preview/{chunk.MAWP27FD.js → chunk.YLMOGGEP.js} +1 -1
  146. package/dist/preview/{chunk.WVWXNW74.js → chunk.ZFXHZZHW.js} +1 -1
  147. package/dist/preview/index.html +52 -51
  148. package/dist/preview/page.js +2 -2
  149. package/package.json +6 -6
  150. package/dist/preview/chunk.25P5SDNR.js +0 -1
  151. package/dist/preview/chunk.27O4LIDU.js +0 -1
  152. package/dist/preview/chunk.3G5DEGFA.js +0 -1
  153. package/dist/preview/chunk.3MZIWKNG.js +0 -5
  154. package/dist/preview/chunk.3V2WXZU3.js +0 -1
  155. package/dist/preview/chunk.4BX3KLAA.js +0 -1
  156. package/dist/preview/chunk.4TGQ6Z6E.js +0 -1
  157. package/dist/preview/chunk.57VTD3CU.js +0 -1
  158. package/dist/preview/chunk.5M62CMLA.js +0 -1
  159. package/dist/preview/chunk.5VF2RT4H.js +0 -1
  160. package/dist/preview/chunk.5XAIP3BS.js +0 -1
  161. package/dist/preview/chunk.5ZWE72VJ.js +0 -1
  162. package/dist/preview/chunk.6SPORDJC.js +0 -1
  163. package/dist/preview/chunk.7UD2JR6J.js +0 -1
  164. package/dist/preview/chunk.AG7CUSSV.js +0 -1
  165. package/dist/preview/chunk.C6HI3LRB.js +0 -1
  166. package/dist/preview/chunk.D6ACCKYJ.js +0 -1
  167. package/dist/preview/chunk.EC7I33WI.js +0 -1
  168. package/dist/preview/chunk.GHPCSNM6.js +0 -21
  169. package/dist/preview/chunk.HLDMTKUP.js +0 -1
  170. package/dist/preview/chunk.J3OX474P.js +0 -1
  171. package/dist/preview/chunk.JCFYZEMY.js +0 -1
  172. package/dist/preview/chunk.JLB4QP6Q.js +0 -1
  173. package/dist/preview/chunk.JXGDVJ4N.js +0 -1
  174. package/dist/preview/chunk.K2J26XMB.js +0 -104
  175. package/dist/preview/chunk.KLJDBYAZ.js +0 -1
  176. package/dist/preview/chunk.LNOWO3IY.js +0 -2
  177. package/dist/preview/chunk.LOUICR7K.js +0 -1
  178. package/dist/preview/chunk.LU3B3SZH.js +0 -1
  179. package/dist/preview/chunk.LVOL2LEC.js +0 -1
  180. package/dist/preview/chunk.LYFEGG6E.js +0 -1
  181. package/dist/preview/chunk.MPMROUZA.js +0 -1
  182. package/dist/preview/chunk.MVRNEC3Y.js +0 -2
  183. package/dist/preview/chunk.OLKFEHWB.js +0 -1
  184. package/dist/preview/chunk.PCNEM3WE.js +0 -1
  185. package/dist/preview/chunk.QB7RYJ67.js +0 -5
  186. package/dist/preview/chunk.RLO3RDYH.js +0 -2
  187. package/dist/preview/chunk.RYMSHMLM.js +0 -1
  188. package/dist/preview/chunk.SF4BYBH6.js +0 -25
  189. package/dist/preview/chunk.SG7YVKH4.js +0 -1
  190. package/dist/preview/chunk.T42H5RXN.js +0 -1
  191. package/dist/preview/chunk.TI4OSTQV.js +0 -1
  192. package/dist/preview/chunk.VFMC45E7.js +0 -1
  193. package/dist/preview/chunk.VWQ57LTT.js +0 -18
  194. package/dist/preview/chunk.Y36MLVMT.js +0 -1
  195. package/dist/preview/chunk.Z6O7RUSR.js +0 -1
  196. package/dist/preview/chunk.ZAGP3OKY.js +0 -1
  197. package/dist/preview/chunk.ZUBC3UFG.js +0 -2
@@ -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.XTT6ERI3.js";import{b as ie}from"./chunk.5VF2RT4H.js";import"./chunk.5RH6FO3K.js";import"./chunk.ZDDWXRPK.js";import"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import"./chunk.XZJ6XX5I.js";import"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import"./chunk.AZGXBTOQ.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import"./chunk.FWZF7X6A.js";import"./chunk.3JMZHCB4.js";import{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.SF4BYBH6.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.3MZIWKNG.js";import"./chunk.SLBWPVIY.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.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.FRZQSSGE.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.E5JX5LWY.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};
@@ -0,0 +1,2 @@
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
+ `),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.BPWSQVEN.js";import"./chunk.PXQVXBNG.js";import"./chunk.B3WVCSW5.js";import"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.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.33YC5RCB.js","./chunk.BBLIT7S7.js","./chunk.KY7QD22S.js","./chunk.BPWSQVEN.js","./chunk.PXQVXBNG.js","./chunk.F5RN6YXG.js","./chunk.2DFWOLL2.js","./chunk.B3WVCSW5.js","./chunk.LU3B3SZH.js","./chunk.HLDMTKUP.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.GHPCSNM6.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};
@@ -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 $e,b as ze,c as Ee,d as Ca,e as Aa,h as Ce,i as Ae,k as Te,l as Me,m as Ta}from"./chunk.EC7I33WI.js";import{c as Se}from"./chunk.3ZONBC6L.js";import{g as ka,h as $a,i as za}from"./chunk.FWKNR7XF.js";import"./chunk.GKLDSHHH.js";import{b as ha,c as xa,d as ke,e as ba}from"./chunk.OCV46AFN.js";import"./chunk.Y36MLVMT.js";import{p as ua,q as ma,r as fa}from"./chunk.MPMROUZA.js";import{a as Sa}from"./chunk.HJCQ6I3S.js";import{b as ya}from"./chunk.5C43AM3X.js";import"./chunk.4WH4N4V7.js";import{b as ga}from"./chunk.5VF2RT4H.js";import{b as he,d as be,e as ye}from"./chunk.5RH6FO3K.js";import"./chunk.ZDDWXRPK.js";import{b as xe}from"./chunk.LOUICR7K.js";import"./chunk.L7MFTL5S.js";import"./chunk.4F5M5XZG.js";import"./chunk.3G5DEGFA.js";import"./chunk.BOMYLOCX.js";import"./chunk.45HTFSWD.js";import"./chunk.Q6RUTFU3.js";import"./chunk.AZGXBTOQ.js";import{e as Ea}from"./chunk.2WSRJGW2.js";import"./chunk.7TMWMW4W.js";import"./chunk.TI4OSTQV.js";import"./chunk.C6HBYRGJ.js";import"./chunk.GZHZLJBF.js";import{c as sa,d as la,e as ee,o as pa}from"./chunk.PZWJUQAO.js";import"./chunk.OJGHDWI6.js";import"./chunk.NEJSKMJV.js";import"./chunk.5ZWE72VJ.js";import"./chunk.RLO3RDYH.js";import"./chunk.TUNHUTQ5.js";import{E as wa,c as oa,d as da,j as fe,l as ca,s as va}from"./chunk.FWZF7X6A.js";import{b as Ze,c as Ga}from"./chunk.3JMZHCB4.js";import{G as F,Ga as pe,Na as ta,Oa as K,Ra as ia,T as f,Va as na,_ as ea,aa,ba as S,da as le,i as ue,j as ne,ka as ra,m as Y,n as oe,o as me,r as de,x as Xe,y as se,z as Je}from"./chunk.SF4BYBH6.js";import{a as Q}from"./chunk.SDO3U72B.js";import{Oc as P,Qc as D,U as je,ga as Qe,ia as ie,rc as Ye}from"./chunk.3MZIWKNG.js";import"./chunk.SLBWPVIY.js";import{b as g}from"./chunk.AJZBJBMO.js";function _a(e){return`
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 $e,b as ze,c as Ee,d as Ca,e as Aa,h as Ce,i as Ae,k as Te,l as Me,m as Ta}from"./chunk.IUQOSPQX.js";import{c as Se}from"./chunk.LKK7VQBA.js";import{g as ka,h as $a,i as za}from"./chunk.EC5IWN74.js";import"./chunk.ONGZ3YQF.js";import{b as ha,c as xa,d as ke,e as ba}from"./chunk.MORMTKVR.js";import"./chunk.PJCVFYFU.js";import{p as ua,q as ma,r as fa}from"./chunk.7RJGEU3Y.js";import{a as Sa}from"./chunk.HJCQ6I3S.js";import{b as ya}from"./chunk.7O6Z3BFR.js";import"./chunk.I2C5LPB5.js";import{b as ga}from"./chunk.Q7X2IVLH.js";import{b as he,d as be,e as ye}from"./chunk.NFU4UM6F.js";import"./chunk.AKVBU5K5.js";import{b as xe}from"./chunk.LLOZKUCA.js";import"./chunk.DH7M57SE.js";import"./chunk.CKV2QCH5.js";import"./chunk.TAJ2R44N.js";import"./chunk.64IKLRUS.js";import"./chunk.DTSTUC2W.js";import"./chunk.RDL6652E.js";import"./chunk.V3NPUAPB.js";import{e as Ea}from"./chunk.APXYWI3L.js";import"./chunk.XY5EVI22.js";import"./chunk.UQQAGT3R.js";import"./chunk.GZHZLJBF.js";import{c as sa,d as la,e as ee,o as pa}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{E as wa,c as oa,d as da,j as fe,l as ca,s as va}from"./chunk.HFVMGTNL.js";import{b as Ze,c as Ga}from"./chunk.7Z4USR3Y.js";import{G as F,Ga as pe,Na as ta,Oa as K,Ra as ia,T as f,Va as na,_ as ea,aa,ba as S,da as le,i as ue,j as ne,ka as ra,m as Y,n as oe,o as me,r as de,x as Xe,y as se,z as Je}from"./chunk.NPAWTPLQ.js";import{a as Q}from"./chunk.SDO3U72B.js";import{Tc as P,Vc as D,W as je,ia as Qe,ka as ie,uc as Ye}from"./chunk.YEJ4LNUP.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";function _a(e){return`
2
2
 
3
3
 
4
4
  .graview-altitude-control {
@@ -1128,5 +1128,5 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
1128
1128
  }
1129
1129
  [data-graview-connector][data-graview-activity] {
1130
1130
  animation: graview-relation 1200ms cubic-bezier(0.22, 1, 0.36, 1);
1131
- }`}function Ie(e="dark",n={}){let l=_a(e);return n.scope===void 0?l:Ze(l,n.scope)}var B=g(F(),1);var q=g(f(),1),Ua=pe(Q(()=>(__graviewPreload(import.meta.url,["./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.IMHUKSPM.js")))).part(e=>(0,q.jsx)(e.MapKey,{}),{quiet:!0});function Re(){let{store:e}=S(),{view:n}=K(),l=le(),o=(0,B.useMemo)(()=>e.graph.allEdges().length>0,[e,l]),[r,w]=(0,B.useState)(!1),c=(0,B.useId)(),v=(0,B.useRef)(null),T=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!r)return;let z=h=>{let M=h.target;M&&(T.current?.contains(M)||v.current?.contains(M))||w(!1)};return document.addEventListener("pointerdown",z,!0),()=>document.removeEventListener("pointerdown",z,!0)},[r]),o?(0,q.jsxs)("div",{style:{display:"contents"},onKeyDown:z=>{z.key!=="Escape"||!r||(z.preventDefault(),z.stopPropagation(),w(!1),v.current?.focus({preventScroll:!0}))},children:[(0,q.jsx)("button",{ref:v,type:"button","data-testid":"lines-key","aria-expanded":r,"aria-controls":c,title:"What the lines mean",onClick:()=>w(z=>!z),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:r?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),r?(0,q.jsxs)("div",{ref:T,id:c,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:Aa,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[n.overview?(0,q.jsx)(Ua,{}):null,(0,q.jsx)(Ca,{inside:!0,widthOf:Sa})]}):null]}):null}var ce=g(F(),1),ge=g(f(),1);function Ma(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Va=pe(Q(()=>(__graviewPreload(import.meta.url,["./chunk.FWKNR7XF.js","./chunk.CB5DGKR5.js","./chunk.OCV46AFN.js","./chunk.Y36MLVMT.js","./chunk.MPMROUZA.js","./chunk.HJCQ6I3S.js","./chunk.5C43AM3X.js","./chunk.4WH4N4V7.js","./chunk.4F5M5XZG.js","./chunk.LVOL2LEC.js","./chunk.3G5DEGFA.js","./chunk.OZ4EJ5M6.js","./chunk.BOMYLOCX.js","./chunk.45HTFSWD.js","./chunk.Q6RUTFU3.js","./chunk.AZGXBTOQ.js","./chunk.C6HBYRGJ.js","./chunk.WVUJXDXZ.js","./chunk.3V2WXZU3.js","./chunk.7UD2JR6J.js","./chunk.BUDEUNBN.js","./chunk.3IEJQAK7.js","./chunk.AKLVSZ5A.js","./chunk.ZUBC3UFG.js","./chunk.GZHZLJBF.js","./chunk.PZWJUQAO.js","./chunk.OJGHDWI6.js","./chunk.NEJSKMJV.js","./chunk.5ZWE72VJ.js","./chunk.RLO3RDYH.js","./chunk.TUNHUTQ5.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.CB7IUKY7.js")))),ja=Va.part((e,n)=>(0,ge.jsx)(e.MapPanelFor,{showing:n.showing}),{what:"This panel",quiet:!0});function Le(){let{store:e,view:n,selection:l,hiddenKinds:o,seatTalk:r}=S();le();let w=(0,ce.useSyncExternalStore)(r.subscribe,()=>r.get().draft!==null,()=>!1);if(!n.overview||w)return null;let c=Ma(ya(l,{...n,beside:!0},v=>e.graph.getNode(v)?.kind));return!c||c.what!=="record"&&(o.has(c.kind)||!e.schema.kinds.includes(c.kind))?null:(0,ge.jsx)(ce.Suspense,{fallback:null,children:(0,ge.jsx)(ja,{showing:c})})}var Qa=g(F(),1);var O=g(f(),1);function Ne(){let{view:e,go:n}=K(),{store:l,views:o,hiddenKinds:r}=S(),w=e.overview??!1,c=o.places().map($=>$.kind).filter($=>!r.has($)),v=wa(e,l.schema.kinds,c),T=()=>{n(ne(Y(e,!1),v))},z=(()=>{if(!v)return null;let $=Xe(v)[0],x=e.within?.view,R=(x?o.places().find(b=>b.as===x):void 0)??($?o.places().filter(b=>b.kind===$).at(-1):void 0);return R?R.title:$?ie(l.schema,$):l.graph.getNode(v)?.label??null})(),h=w?"Close the map":"Up",M=w&&z?`Close the map, down to ${z}`:h;return(0,O.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":M,title:w?M:"Up \u2014 the whole thing, from above",onClick:()=>w?T():n(Y(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,O.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,O.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,O.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,O.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,O.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,O.jsx)("span",{className:"graview-altitude-label",children:h})]})}var He=g(f(),1);function Pe(){let{administered:e}=S(),{view:n,go:l}=K(),o=e.filter(r=>r.canShow);return o.length===0?null:(0,He.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:o.map(r=>(0,He.jsx)("button",{type:"button","aria-pressed":r.shown,"data-testid":`show-${r.name}`,title:r.shown?`Hide the ${r.name}'s own districts again`:r.description??`Show the ${r.name}'s own districts beside the domain`,onClick:()=>l(ha(n,r.name,!r.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:r.shown?"var(--graview-accent)":"var(--graview-edge)",color:r.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:r.shown?"var(--graview-panel)":"transparent"},children:r.shown?`Hide the ${r.name}`:`Show the ${r.name}`},r.name))})}var m=g(F(),1);var s=g(f(),1);ea({search:ma,touchWeights:ua});var Ya=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Na({compact:e=!1}){let{store:n,view:l,setView:o,principal:r,setMenuAt:w,brand:c,aiDesk:v,selection:T}=S(),z=da(v),h=aa(),M=ta(),$=pa().marks.flag,x=(0,m.useRef)(null),R=(0,m.useRef)(null),b=(0,m.useId)(),[L,I]=(0,m.useState)(!1),[G,qe]=(0,m.useState)(null),[Z,ae]=(0,m.useState)(null),C=l.q??"";(0,m.useEffect)(()=>{let a=t=>{if(t.defaultPrevented)return;let i=t.key.toLowerCase()==="k"&&(t.metaKey||t.ctrlKey)&&!t.altKey&&!t.shiftKey,p=t.key==="/"&&!t.metaKey&&!t.ctrlKey&&!t.altKey;if(!i&&!p)return;let d=x.current;if(!d)return;let U=d.closest("[data-graview-embed]"),N=t.target,V=N===document.body||N===document.documentElement||N===window;if(U&&!(i&&V||N instanceof Node&&U.contains(N)))return;let j=document.activeElement,Wa=j instanceof HTMLInputElement||j instanceof HTMLTextAreaElement||j instanceof HTMLSelectElement||j instanceof HTMLElement&&j.isContentEditable;p&&Wa||(t.preventDefault(),d.getClientRects().length===0&&d.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),d.focus({preventScroll:!0}),d.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let We=(0,m.useMemo)(()=>Z&&C.trim()?fa(n,Z,h?.words??C,{principal:r,limit:4}):[],[n,C,h,Z,r]),ve=(0,m.useMemo)(()=>{let a=new Map;for(let[t,i]of(h?.hits??[]).entries()){if(i.about==="act")continue;let p=Ya(i),d=a.get(p)??[];if(d.push({id:`${b}-${t}`,hit:i}),a.set(p,d),i.about==="node"&&i.id===Z)for(let[U,N]of We.entries())d.push({id:`${b}-${t}-act-${U}`,hit:N})}return[...a.entries()]},[h,We,Z,b]),H=z&&C.trim()?{id:`${b}-ask`,ask:C.trim()}:null,k=(0,m.useMemo)(()=>[...ve.flatMap(([,a])=>a),...H?[H]:[]],[ve,H?.ask]),A=k.find(a=>a.id===G)??k[0],Ge=(h?.hits??[]).filter(a=>a.about==="node").length;(0,m.useEffect)(()=>{qe(null),ae(null)},[C]);let re=(0,m.useRef)(null);(0,m.useEffect)(()=>{let a=re.current;if(!a)return;re.current=null;let t=0,i=()=>{let p=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),d=document.activeElement;if(!(!d||d===document.body||d===document.documentElement||d===x.current||d===R.current||d===p))return;let N=[...p?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(V=>V.checkVisibility?.()??!0);if(N)return N.focus({preventScroll:!0});p&&p.tabIndex>=0&&d!==p&&p.focus({preventScroll:!0}),++t<240?requestAnimationFrame(i):document.activeElement===R.current&&R.current?.blur()};requestAnimationFrame(i)},[l]);let _e=(a,t)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let p=R.current;if(!p)return x.current?.blur();p.setAttribute("aria-label",t),p.focus({preventScroll:!0})},_=a=>{if(a){if(qe(a.id),"ask"in a){ae(null);return}a.hit.about==="node"?ae(a.hit.id):a.hit.about!=="act"&&ae(null)}},Ue=a=>{let t=document.getElementById(b),i=t?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,p=t?.clientHeight??0;return Math.min(a,i>0&&p>0?Math.max(1,Math.floor(p/i)-1):er)};(0,m.useEffect)(()=>{G&&document.getElementById(G)?.scrollIntoView?.({block:"nearest"})},[G]);let we=a=>{if(!a)return;if("ask"in a){oa(v,{pointed:{...T[0]!==void 0?{on:T[0]}:{},about:T},asked:a.ask}),o(i=>ke(i)),I(!1);return}let t=a.hit;switch(t.about){case"node":o(i=>oe(ne(Y(i,!1),t.id),[t.id]));break;case"kind":return o(i=>se(Y(i,!1),de(t.kind),{ownPicture:!0})),re.current=t.kind,I(!1),_e(t.kind,`Opening ${t.label}\u2026`);case"place":return o(i=>Je(i,t.kind,t.as)),re.current=t.kind,I(!1),_e(t.kind,`Opening ${t.title}\u2026`);case"rule":{let i=M.filter(p=>p.invariant===t.name).flatMap(p=>p.nodeIds);o(p=>oe(p,[...new Set(i)]));break}case"act":{o(p=>oe(p,[t.subject]));let i=x.current?.getBoundingClientRect();w({x:i?.left??0,y:(i?.bottom??0)+6,on:t.subject});break}}I(!1),x.current?.blur()},Ka=h?Za(h.byKind,h.hits,n.schema):"",te=L&&C.trim().length>0,qa=(0,m.useCallback)(()=>{let a=x.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-rr};let t=x.current?.getBoundingClientRect();return t?{x:t.right,y:t.bottom}:null},[]),Ve=na("find",{open:te,onOpenChange:a=>{a||I(!1)},...e?{at:qa}:{}});return(0,s.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,s.jsx)("input",{ref:a=>{x.current=a,Ve.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":te,"aria-controls":b,"aria-autocomplete":"list",...te&&A?{"aria-activedescendant":A.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:C,onChange:a=>{let t=a.target.value;I(!0),o(i=>xa(i,t.length>0?t:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:a=>{let t=G!==null&&A?k.indexOf(A):-1,i=d=>d!==void 0&&!("ask"in d)&&d.hit.about==="act",p=t>=0&&A!==void 0&&!("ask"in A)&&A.hit.about==="node";if(a.key==="ArrowDown"){a.preventDefault(),I(!0);let d=t+1;if(p)for(;d<k.length-1&&i(k[d]);)d+=1;_(k[Math.min(k.length-1,d)])}else if(a.key==="ArrowUp")a.preventDefault(),_(k[Math.max(0,t-1)]);else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let d=k.flatMap((V,j)=>i(V)?[]:[j]),U=Math.max(0,d.findIndex(V=>V>=Math.max(t,0))),N=a.key==="PageDown"?Ue(k.length):-Ue(k.length);_(k[d[Math.min(d.length-1,Math.max(0,(t<0?-1:U)+N))]])}else if(a.key==="ArrowRight"&&p&&i(k[t+1]))a.preventDefault(),_(k[t+1]);else if(a.key==="ArrowLeft"&&i(A)){a.preventDefault();let d=t-1;for(;d>0&&i(k[d]);)d-=1;_(k[d])}else a.key==="Enter"?(a.preventDefault(),we(A)):a.key==="Escape"&&(a.preventDefault(),C?o(d=>ke(d)):x.current?.blur())},style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${C?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,s.jsx)("span",{role:"status","aria-live":"polite",style:fe,"data-testid":"find-count",children:C.trim()?Ka:""}),(0,s.jsx)("span",{ref:R,tabIndex:-1,role:"status",style:fe,"data-testid":"find-landing"}),(0,s.jsxs)("div",{...Ve.pane,id:b,role:"listbox","aria-label":C?`What \u201C${C}\u201D finds`:"What the words find","data-testid":"find-strip",hidden:!te,onMouseDown:a=>a.preventDefault(),style:e?{...Ra,...tr}:Ra,children:[k.every(a=>"ask"in a)?(0,s.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",h?.words||C,"\u201D."]}):ve.map(([a,t])=>(0,s.jsxs)("div",{role:"group","aria-label":Ia(a,n.schema),children:[(0,s.jsxs)("div",{role:"presentation",style:ir,children:[a!=="rule:"?(0,s.jsx)(Ja,{kind:a,accents:c?.accents}):null,Ia(a,n.schema)]}),t.map(i=>(0,s.jsx)("div",{id:i.id,role:"option","aria-selected":i===A,"data-testid":"find-hit","data-about":i.hit.about,...i.hit.about==="node"&&i.hit.near?{"data-near":""}:{},onMouseEnter:()=>_(i),onClick:()=>we(i),style:{...La,...i.hit.about==="act"?{paddingLeft:30}:{},background:i===A?"var(--graview-panel-muted)":"transparent"},children:(0,s.jsx)(Xa,{hit:i.hit,flag:$})},i.id))]},a)),H?(0,s.jsx)("div",{id:H.id,role:"option","aria-selected":H===A||A?.id===H.id,"data-testid":"find-ask",onMouseEnter:()=>_(H),onClick:()=>we(H),style:{...La,borderTop:"1px solid var(--graview-edge)",marginTop:4,background:A?.id===H.id?"var(--graview-panel-muted)":"transparent"},children:(0,s.jsxs)("span",{children:["Ask: ",(0,s.jsxs)("span",{style:{fontWeight:600},children:["\u2018",H.ask,"\u2019"]})]})}):null,Ge>ar?(0,s.jsxs)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 2px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},"data-testid":"find-more-words",children:[je(Ge)," found: another word of the name narrows them."]}):null,h&&h.searched.past===!1&&h.searched.kinds.some(a=>n.schema.tryDefinition(a)?.lifecycle)?(0,s.jsx)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 8px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"Current ones; add is:any for the past."}):null]})]})}function Xa({hit:e,flag:n}){switch(e.about){case"node":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{style:{fontWeight:600,overflowWrap:"anywhere"},children:[e.flagged?(0,s.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[n," "]}):null,e.label,e.apart?(0,s.jsxs)("span",{style:X,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,s.jsx)("span",{style:X,children:" \xB7 past"})]}),e.near?(0,s.jsxs)("span",{style:X,"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: ${e.why.fragment}`:""]}):e.why.field!=="label"?(0,s.jsxs)("span",{style:X,children:[e.why.reading.toLowerCase(),": ",e.why.fragment]}):null]});case"kind":return(0,s.jsxs)("span",{children:[e.label,(0,s.jsxs)("span",{style:X,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,s.jsxs)("span",{children:["Go to ",e.title]});case"rule":return(0,s.jsxs)("span",{children:["The rule \u201C",e.label,"\u201D"]});case"act":return(0,s.jsxs)("span",{style:e.destructive?{color:"var(--graview-warn)"}:void 0,children:[e.title,(0,s.jsxs)("span",{style:X,children:[" \xB7 ",e.why.field==="title"?"act":`on ${e.why.fragment}`]})]})}}function Ja({kind:e,accents:n}){let l=Math.round(Ye(e,n));return(0,s.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${l} 55% 52%)`}})}function Ia(e,n){return e==="rule:"?"Rules":e==="act:"?"Acts":n.tryDefinition(e)?.plural??`${e}s`}function Za(e,n,l){let o=Object.entries(e).map(([c,v])=>Qe(l,c,v)),r=n.filter(c=>c.about==="kind"||c.about==="place"||c.about==="rule").length;r>0&&o.push(`${r} ${r===1?"place or rule":"places and rules"}`);let w=n.filter(c=>c.about==="node"&&c.near).length;return o.length===0?"Nothing found":`${o.join(", ")} found${w>0?`, ${w} of them near`:""}`}var er=10,ar=12,Ra={...ia,width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(60vh, 28rem)",overflowY:"auto",boxSizing:"border-box",background:"var(--graview-panel)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:"4px 0"},rr=6,tr={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},ir={display:"flex",alignItems:"center",gap:6,padding:"8px 12px 2px",fontSize:"0.6875rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},La={display:"grid",gap:1,minHeight:32,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)"},X={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400};var J=g(F(),1);var Be=g(Ga(),1);var Pa=g(f(),1);function Ha(){let{following:e,follow:n}=S();return e?(0,Pa.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>n(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var Ba=g(F(),1);var y=g(f(),1);function Da({home:e,homeLabel:n,children:l,onPicture:o=!1}){let{view:r,focus:w,show:c,go:v}=K(),{store:T}=S(),{movedByHand:z}=S(),h=z&&(r.pan!==void 0||Object.keys(r.pins).length>0),M=r.focusId&&r.focusId!==e?T.graph.getNode(r.focusId):void 0,$=L=>ie(T.schema,L),x={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=n!==void 0&&M!==void 0,b=[];if(M&&!o&&b.push({key:"focused",node:(0,y.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>v(me({...r,focusId:e},!1)),title:xe(T,M.id),style:{...x,maxWidth:"min(14rem, 15vw)"},children:[(0,y.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:xe(T,M.id)}),(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.past&&b.push({key:"past",node:(0,y.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>v(ba(r,!1)),title:"Back to now \u2014 retired things leave the picture again",style:x,children:["the past",(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.zoom&&b.push({key:"zoomed",node:(0,y.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>v(me(r,!1)),title:"Zoom back out",style:x,children:["zoomed in",(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),h&&b.push({key:"moved",node:(0,y.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>v(ue(r)),title:"Put the camera and everything you dragged back where the layout wanted them",style:x,children:"Reset view"})}),r.relation){let L=r.relation;b.push({key:"raised",node:(0,y.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,y.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>v(se(r,de(L),{ownPicture:!0})),title:`Go into the ${$(L).toLowerCase()}`,"aria-label":`Go into the ${$(L).toLowerCase()}`,style:{...x,color:"var(--graview-ink)"},children:[$(L),(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,y.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>c(null),title:`Stop showing ${$(L).toLowerCase()}`,"aria-label":`Stop showing ${$(L).toLowerCase()}`,style:{...x,minWidth:26,justifyContent:"center"},children:(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return o&&!R&&b.length===0&&l===void 0?null:(0,y.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...o?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,y.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:n}):null,b.map(({key:L,node:I},G)=>(0,y.jsxs)(Ba.Fragment,{children:[R||G>0?(0,y.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,I]},L)),l]})}var E=g(f(),1);function De(){let[e,n]=(0,J.useState)([]),l=(0,J.useCallback)(o=>{n(r=>{let w=o.phase!=="running"&&r[0]?.name===o.name&&r[0]?.at===o.at;return[o,...w?r.slice(1):r].slice(0,12)})},[]);return[e,l]}function Oe({find:e,calls:n,seat:l,remembers:o=!1}){return e?(0,E.jsxs)(E.Fragment,{children:[(0,Be.createPortal)((0,E.jsx)(Na,{compact:e.compact}),e.slot),e.own?(0,Be.createPortal)((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(J.Suspense,{fallback:null,children:(0,E.jsx)(Ta,{})}),(0,E.jsx)(ga,{calls:n,remembers:o,...l!==void 0?{seat:l}:{}})]}),e.own):null]}):null}function Fe({home:e=null}){return(0,E.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,E.jsx)(Da,{home:e,onPicture:!0}),(0,E.jsx)("span",{style:{pointerEvents:"auto"},children:(0,E.jsx)(Ha,{})})]})}var W=g(F(),1);var Oa=g(f(),1),nr=Q(()=>(__graviewPreload(import.meta.url,["./chunk.UGFDSE37.js","./chunk.FWZF7X6A.js","./chunk.3JMZHCB4.js","./chunk.SF4BYBH6.js","./chunk.SDO3U72B.js","./chunk.3MZIWKNG.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.NDI5OWIB.js")));function Ke(){let{store:e,principal:n}=S(),l=(0,W.useContext)(ca),o=(0,W.useRef)(null),r=(0,W.useRef)(!1);return(0,W.useEffect)(()=>()=>void(r.current=!0),[]),(0,W.useEffect)(()=>{let w=e.batches().length,c=nr().then(v=>v.sceneWay(e,n,l,w,o.current),()=>{});return()=>void c.then(v=>v?.(r.current))},[e,n,l]),(0,Oa.jsx)("span",{ref:o,hidden:!0})}var Fa=g(F(),1);var u=g(f(),1);function Dt({address:e=!1,auto:n,quickAsk:l=!0,scheme:o,scope:r}){let w=(0,Fa.useMemo)(()=>`${Me({scope:`.${r}`})}
1131
+ }`}function Ie(e="dark",n={}){let l=_a(e);return n.scope===void 0?l:Ze(l,n.scope)}var B=g(F(),1);var q=g(f(),1),Ua=pe(Q(()=>(__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.KBL4Y4UN.js")))).part(e=>(0,q.jsx)(e.MapKey,{}),{quiet:!0});function Re(){let{store:e}=S(),{view:n}=K(),l=le(),o=(0,B.useMemo)(()=>e.graph.allEdges().length>0,[e,l]),[r,w]=(0,B.useState)(!1),c=(0,B.useId)(),v=(0,B.useRef)(null),T=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!r)return;let z=h=>{let M=h.target;M&&(T.current?.contains(M)||v.current?.contains(M))||w(!1)};return document.addEventListener("pointerdown",z,!0),()=>document.removeEventListener("pointerdown",z,!0)},[r]),o?(0,q.jsxs)("div",{style:{display:"contents"},onKeyDown:z=>{z.key!=="Escape"||!r||(z.preventDefault(),z.stopPropagation(),w(!1),v.current?.focus({preventScroll:!0}))},children:[(0,q.jsx)("button",{ref:v,type:"button","data-testid":"lines-key","aria-expanded":r,"aria-controls":c,title:"What the lines mean",onClick:()=>w(z=>!z),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:r?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Key"}),r?(0,q.jsxs)("div",{ref:T,id:c,"data-testid":"lines-key-pane","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("rail"),width:Aa,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[n.overview?(0,q.jsx)(Ua,{}):null,(0,q.jsx)(Ca,{inside:!0,widthOf:Sa})]}):null]}):null}var ce=g(F(),1),ge=g(f(),1);function Ma(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Va=pe(Q(()=>(__graviewPreload(import.meta.url,["./chunk.EC5IWN74.js","./chunk.XGCOWCA2.js","./chunk.MORMTKVR.js","./chunk.PJCVFYFU.js","./chunk.7RJGEU3Y.js","./chunk.HJCQ6I3S.js","./chunk.7O6Z3BFR.js","./chunk.I2C5LPB5.js","./chunk.CKV2QCH5.js","./chunk.BT7RLFPO.js","./chunk.TAJ2R44N.js","./chunk.VLBY66PB.js","./chunk.64IKLRUS.js","./chunk.DTSTUC2W.js","./chunk.RDL6652E.js","./chunk.V3NPUAPB.js","./chunk.UQQAGT3R.js","./chunk.WVUJXDXZ.js","./chunk.T2RME6XF.js","./chunk.SOTB6C5A.js","./chunk.TQCRFZ53.js","./chunk.6HLKAUWF.js","./chunk.FCUDBMGC.js","./chunk.KMEKMCKG.js","./chunk.GZHZLJBF.js","./chunk.E5XNQTEU.js","./chunk.OJGHDWI6.js","./chunk.K5YLQAFW.js","./chunk.XJFAUOJS.js","./chunk.DPPT6WAJ.js","./chunk.7U2JO7ET.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SVAQGVS4.js")))),ja=Va.part((e,n)=>(0,ge.jsx)(e.MapPanelFor,{showing:n.showing}),{what:"This panel",quiet:!0});function Le(){let{store:e,view:n,selection:l,hiddenKinds:o,seatTalk:r}=S();le();let w=(0,ce.useSyncExternalStore)(r.subscribe,()=>r.get().draft!==null,()=>!1);if(!n.overview||w)return null;let c=Ma(ya(l,{...n,beside:!0},v=>e.graph.getNode(v)?.kind));return!c||c.what!=="record"&&(o.has(c.kind)||!e.schema.kinds.includes(c.kind))?null:(0,ge.jsx)(ce.Suspense,{fallback:null,children:(0,ge.jsx)(ja,{showing:c})})}var Qa=g(F(),1);var O=g(f(),1);function Ne(){let{view:e,go:n}=K(),{store:l,views:o,hiddenKinds:r}=S(),w=e.overview??!1,c=o.places().map($=>$.kind).filter($=>!r.has($)),v=wa(e,l.schema.kinds,c),T=()=>{n(ne(Y(e,!1),v))},z=(()=>{if(!v)return null;let $=Xe(v)[0],x=e.within?.view,R=(x?o.places().find(b=>b.as===x):void 0)??($?o.places().filter(b=>b.kind===$).at(-1):void 0);return R?R.title:$?ie(l.schema,$):l.graph.getNode(v)?.label??null})(),h=w?"Close the map":"Up",M=w&&z?`Close the map, down to ${z}`:h;return(0,O.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":w,"aria-label":M,title:w?M:"Up \u2014 the whole thing, from above",onClick:()=>w?T():n(Y(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:D("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":w?1:0,...w?{color:"var(--graview-accent)"}:{}},children:[(0,O.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,O.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,O.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,O.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,O.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,O.jsx)("span",{className:"graview-altitude-label",children:h})]})}var He=g(f(),1);function Pe(){let{administered:e}=S(),{view:n,go:l}=K(),o=e.filter(r=>r.canShow);return o.length===0?null:(0,He.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:o.map(r=>(0,He.jsx)("button",{type:"button","aria-pressed":r.shown,"data-testid":`show-${r.name}`,title:r.shown?`Hide the ${r.name}'s own districts again`:r.description??`Show the ${r.name}'s own districts beside the domain`,onClick:()=>l(ha(n,r.name,!r.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:r.shown?"var(--graview-accent)":"var(--graview-edge)",color:r.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:r.shown?"var(--graview-panel)":"transparent"},children:r.shown?`Hide the ${r.name}`:`Show the ${r.name}`},r.name))})}var m=g(F(),1);var s=g(f(),1);ea({search:ma,touchWeights:ua});var Ya=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Na({compact:e=!1}){let{store:n,view:l,setView:o,principal:r,setMenuAt:w,brand:c,aiDesk:v,selection:T}=S(),z=da(v),h=aa(),M=ta(),$=pa().marks.flag,x=(0,m.useRef)(null),R=(0,m.useRef)(null),b=(0,m.useId)(),[L,I]=(0,m.useState)(!1),[G,qe]=(0,m.useState)(null),[Z,ae]=(0,m.useState)(null),C=l.q??"";(0,m.useEffect)(()=>{let a=t=>{if(t.defaultPrevented)return;let i=t.key.toLowerCase()==="k"&&(t.metaKey||t.ctrlKey)&&!t.altKey&&!t.shiftKey,p=t.key==="/"&&!t.metaKey&&!t.ctrlKey&&!t.altKey;if(!i&&!p)return;let d=x.current;if(!d)return;let U=d.closest("[data-graview-embed]"),N=t.target,V=N===document.body||N===document.documentElement||N===window;if(U&&!(i&&V||N instanceof Node&&U.contains(N)))return;let j=document.activeElement,Wa=j instanceof HTMLInputElement||j instanceof HTMLTextAreaElement||j instanceof HTMLSelectElement||j instanceof HTMLElement&&j.isContentEditable;p&&Wa||(t.preventDefault(),d.getClientRects().length===0&&d.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),d.focus({preventScroll:!0}),d.select(),I(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let We=(0,m.useMemo)(()=>Z&&C.trim()?fa(n,Z,h?.words??C,{principal:r,limit:4}):[],[n,C,h,Z,r]),ve=(0,m.useMemo)(()=>{let a=new Map;for(let[t,i]of(h?.hits??[]).entries()){if(i.about==="act")continue;let p=Ya(i),d=a.get(p)??[];if(d.push({id:`${b}-${t}`,hit:i}),a.set(p,d),i.about==="node"&&i.id===Z)for(let[U,N]of We.entries())d.push({id:`${b}-${t}-act-${U}`,hit:N})}return[...a.entries()]},[h,We,Z,b]),H=z&&C.trim()?{id:`${b}-ask`,ask:C.trim()}:null,k=(0,m.useMemo)(()=>[...ve.flatMap(([,a])=>a),...H?[H]:[]],[ve,H?.ask]),A=k.find(a=>a.id===G)??k[0],Ge=(h?.hits??[]).filter(a=>a.about==="node").length;(0,m.useEffect)(()=>{qe(null),ae(null)},[C]);let re=(0,m.useRef)(null);(0,m.useEffect)(()=>{let a=re.current;if(!a)return;re.current=null;let t=0,i=()=>{let p=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),d=document.activeElement;if(!(!d||d===document.body||d===document.documentElement||d===x.current||d===R.current||d===p))return;let N=[...p?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(V=>V.checkVisibility?.()??!0);if(N)return N.focus({preventScroll:!0});p&&p.tabIndex>=0&&d!==p&&p.focus({preventScroll:!0}),++t<240?requestAnimationFrame(i):document.activeElement===R.current&&R.current?.blur()};requestAnimationFrame(i)},[l]);let _e=(a,t)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let p=R.current;if(!p)return x.current?.blur();p.setAttribute("aria-label",t),p.focus({preventScroll:!0})},_=a=>{if(a){if(qe(a.id),"ask"in a){ae(null);return}a.hit.about==="node"?ae(a.hit.id):a.hit.about!=="act"&&ae(null)}},Ue=a=>{let t=document.getElementById(b),i=t?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,p=t?.clientHeight??0;return Math.min(a,i>0&&p>0?Math.max(1,Math.floor(p/i)-1):er)};(0,m.useEffect)(()=>{G&&document.getElementById(G)?.scrollIntoView?.({block:"nearest"})},[G]);let we=a=>{if(!a)return;if("ask"in a){oa(v,{pointed:{...T[0]!==void 0?{on:T[0]}:{},about:T},asked:a.ask}),o(i=>ke(i)),I(!1);return}let t=a.hit;switch(t.about){case"node":o(i=>oe(ne(Y(i,!1),t.id),[t.id]));break;case"kind":return o(i=>se(Y(i,!1),de(t.kind),{ownPicture:!0})),re.current=t.kind,I(!1),_e(t.kind,`Opening ${t.label}\u2026`);case"place":return o(i=>Je(i,t.kind,t.as)),re.current=t.kind,I(!1),_e(t.kind,`Opening ${t.title}\u2026`);case"rule":{let i=M.filter(p=>p.invariant===t.name).flatMap(p=>p.nodeIds);o(p=>oe(p,[...new Set(i)]));break}case"act":{o(p=>oe(p,[t.subject]));let i=x.current?.getBoundingClientRect();w({x:i?.left??0,y:(i?.bottom??0)+6,on:t.subject});break}}I(!1),x.current?.blur()},Ka=h?Za(h.byKind,h.hits,n.schema):"",te=L&&C.trim().length>0,qa=(0,m.useCallback)(()=>{let a=x.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-rr};let t=x.current?.getBoundingClientRect();return t?{x:t.right,y:t.bottom}:null},[]),Ve=na("find",{open:te,onOpenChange:a=>{a||I(!1)},...e?{at:qa}:{}});return(0,s.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,s.jsx)("input",{ref:a=>{x.current=a,Ve.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":te,"aria-controls":b,"aria-autocomplete":"list",...te&&A?{"aria-activedescendant":A.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:C,onChange:a=>{let t=a.target.value;I(!0),o(i=>xa(i,t.length>0?t:null))},onFocus:()=>I(!0),onBlur:()=>I(!1),onKeyDown:a=>{let t=G!==null&&A?k.indexOf(A):-1,i=d=>d!==void 0&&!("ask"in d)&&d.hit.about==="act",p=t>=0&&A!==void 0&&!("ask"in A)&&A.hit.about==="node";if(a.key==="ArrowDown"){a.preventDefault(),I(!0);let d=t+1;if(p)for(;d<k.length-1&&i(k[d]);)d+=1;_(k[Math.min(k.length-1,d)])}else if(a.key==="ArrowUp")a.preventDefault(),_(k[Math.max(0,t-1)]);else if((a.key==="PageDown"||a.key==="PageUp")&&k.length>0){a.preventDefault(),I(!0);let d=k.flatMap((V,j)=>i(V)?[]:[j]),U=Math.max(0,d.findIndex(V=>V>=Math.max(t,0))),N=a.key==="PageDown"?Ue(k.length):-Ue(k.length);_(k[d[Math.min(d.length-1,Math.max(0,(t<0?-1:U)+N))]])}else if(a.key==="ArrowRight"&&p&&i(k[t+1]))a.preventDefault(),_(k[t+1]);else if(a.key==="ArrowLeft"&&i(A)){a.preventDefault();let d=t-1;for(;d>0&&i(k[d]);)d-=1;_(k[d])}else a.key==="Enter"?(a.preventDefault(),we(A)):a.key==="Escape"&&(a.preventDefault(),C?o(d=>ke(d)):x.current?.blur())},style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${C?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,s.jsx)("span",{role:"status","aria-live":"polite",style:fe,"data-testid":"find-count",children:C.trim()?Ka:""}),(0,s.jsx)("span",{ref:R,tabIndex:-1,role:"status",style:fe,"data-testid":"find-landing"}),(0,s.jsxs)("div",{...Ve.pane,id:b,role:"listbox","aria-label":C?`What \u201C${C}\u201D finds`:"What the words find","data-testid":"find-strip",hidden:!te,onMouseDown:a=>a.preventDefault(),style:e?{...Ra,...tr}:Ra,children:[k.every(a=>"ask"in a)?(0,s.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",h?.words||C,"\u201D."]}):ve.map(([a,t])=>(0,s.jsxs)("div",{role:"group","aria-label":Ia(a,n.schema),children:[(0,s.jsxs)("div",{role:"presentation",style:ir,children:[a!=="rule:"?(0,s.jsx)(Ja,{kind:a,accents:c?.accents}):null,Ia(a,n.schema)]}),t.map(i=>(0,s.jsx)("div",{id:i.id,role:"option","aria-selected":i===A,"data-testid":"find-hit","data-about":i.hit.about,...i.hit.about==="node"&&i.hit.near?{"data-near":""}:{},onMouseEnter:()=>_(i),onClick:()=>we(i),style:{...La,...i.hit.about==="act"?{paddingLeft:30}:{},background:i===A?"var(--graview-panel-muted)":"transparent"},children:(0,s.jsx)(Xa,{hit:i.hit,flag:$})},i.id))]},a)),H?(0,s.jsx)("div",{id:H.id,role:"option","aria-selected":H===A||A?.id===H.id,"data-testid":"find-ask",onMouseEnter:()=>_(H),onClick:()=>we(H),style:{...La,borderTop:"1px solid var(--graview-edge)",marginTop:4,background:A?.id===H.id?"var(--graview-panel-muted)":"transparent"},children:(0,s.jsxs)("span",{children:["Ask: ",(0,s.jsxs)("span",{style:{fontWeight:600},children:["\u2018",H.ask,"\u2019"]})]})}):null,Ge>ar?(0,s.jsxs)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 2px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},"data-testid":"find-more-words",children:[je(Ge)," found: another word of the name narrows them."]}):null,h&&h.searched.past===!1&&h.searched.kinds.some(a=>n.schema.tryDefinition(a)?.lifecycle)?(0,s.jsx)("p",{role:"presentation",style:{margin:0,padding:"6px 12px 8px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"Current ones; add is:any for the past."}):null]})]})}function Xa({hit:e,flag:n}){switch(e.about){case"node":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{style:{fontWeight:600,overflowWrap:"anywhere"},children:[e.flagged?(0,s.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[n," "]}):null,e.label,e.apart?(0,s.jsxs)("span",{style:X,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,s.jsx)("span",{style:X,children:" \xB7 past"})]}),e.near?(0,s.jsxs)("span",{style:X,"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: ${e.why.fragment}`:""]}):e.why.field!=="label"?(0,s.jsxs)("span",{style:X,children:[e.why.reading.toLowerCase(),": ",e.why.fragment]}):null]});case"kind":return(0,s.jsxs)("span",{children:[e.label,(0,s.jsxs)("span",{style:X,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,s.jsxs)("span",{children:["Go to ",e.title]});case"rule":return(0,s.jsxs)("span",{children:["The rule \u201C",e.label,"\u201D"]});case"act":return(0,s.jsxs)("span",{style:e.destructive?{color:"var(--graview-warn)"}:void 0,children:[e.title,(0,s.jsxs)("span",{style:X,children:[" \xB7 ",e.why.field==="title"?"act":`on ${e.why.fragment}`]})]})}}function Ja({kind:e,accents:n}){let l=Math.round(Ye(e,n));return(0,s.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${l} 55% 52%)`}})}function Ia(e,n){return e==="rule:"?"Rules":e==="act:"?"Acts":n.tryDefinition(e)?.plural??`${e}s`}function Za(e,n,l){let o=Object.entries(e).map(([c,v])=>Qe(l,c,v)),r=n.filter(c=>c.about==="kind"||c.about==="place"||c.about==="rule").length;r>0&&o.push(`${r} ${r===1?"place or rule":"places and rules"}`);let w=n.filter(c=>c.about==="node"&&c.near).length;return o.length===0?"Nothing found":`${o.join(", ")} found${w>0?`, ${w} of them near`:""}`}var er=10,ar=12,Ra={...ia,width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(60vh, 28rem)",overflowY:"auto",boxSizing:"border-box",background:"var(--graview-panel)",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:"4px 0"},rr=6,tr={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},ir={display:"flex",alignItems:"center",gap:6,padding:"8px 12px 2px",fontSize:"0.6875rem",letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},La={display:"grid",gap:1,minHeight:32,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)"},X={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400};var J=g(F(),1);var Be=g(Ga(),1);var Pa=g(f(),1);function Ha(){let{following:e,follow:n}=S();return e?(0,Pa.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>n(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var Ba=g(F(),1);var y=g(f(),1);function Da({home:e,homeLabel:n,children:l,onPicture:o=!1}){let{view:r,focus:w,show:c,go:v}=K(),{store:T}=S(),{movedByHand:z}=S(),h=z&&(r.pan!==void 0||Object.keys(r.pins).length>0),M=r.focusId&&r.focusId!==e?T.graph.getNode(r.focusId):void 0,$=L=>ie(T.schema,L),x={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=n!==void 0&&M!==void 0,b=[];if(M&&!o&&b.push({key:"focused",node:(0,y.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>v(me({...r,focusId:e},!1)),title:xe(T,M.id),style:{...x,maxWidth:"min(14rem, 15vw)"},children:[(0,y.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:xe(T,M.id)}),(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.past&&b.push({key:"past",node:(0,y.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>v(ba(r,!1)),title:"Back to now \u2014 retired things leave the picture again",style:x,children:["the past",(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),r.zoom&&b.push({key:"zoomed",node:(0,y.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>v(me(r,!1)),title:"Zoom back out",style:x,children:["zoomed in",(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),h&&b.push({key:"moved",node:(0,y.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>v(ue(r)),title:"Put the camera and everything you dragged back where the layout wanted them",style:x,children:"Reset view"})}),r.relation){let L=r.relation;b.push({key:"raised",node:(0,y.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,y.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>v(se(r,de(L),{ownPicture:!0})),title:`Go into the ${$(L).toLowerCase()}`,"aria-label":`Go into the ${$(L).toLowerCase()}`,style:{...x,color:"var(--graview-ink)"},children:[$(L),(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,y.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>c(null),title:`Stop showing ${$(L).toLowerCase()}`,"aria-label":`Stop showing ${$(L).toLowerCase()}`,style:{...x,minWidth:26,justifyContent:"center"},children:(0,y.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return o&&!R&&b.length===0&&l===void 0?null:(0,y.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...o?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,y.jsx)("button",{type:"button",onClick:()=>w(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:n}):null,b.map(({key:L,node:I},G)=>(0,y.jsxs)(Ba.Fragment,{children:[R||G>0?(0,y.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,I]},L)),l]})}var E=g(f(),1);function De(){let[e,n]=(0,J.useState)([]),l=(0,J.useCallback)(o=>{n(r=>{let w=o.phase!=="running"&&r[0]?.name===o.name&&r[0]?.at===o.at;return[o,...w?r.slice(1):r].slice(0,12)})},[]);return[e,l]}function Oe({find:e,calls:n,seat:l,remembers:o=!1}){return e?(0,E.jsxs)(E.Fragment,{children:[(0,Be.createPortal)((0,E.jsx)(Na,{compact:e.compact}),e.slot),e.own?(0,Be.createPortal)((0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(J.Suspense,{fallback:null,children:(0,E.jsx)(Ta,{})}),(0,E.jsx)(ga,{calls:n,remembers:o,...l!==void 0?{seat:l}:{}})]}),e.own):null]}):null}function Fe({home:e=null}){return(0,E.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:D("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,E.jsx)(Da,{home:e,onPicture:!0}),(0,E.jsx)("span",{style:{pointerEvents:"auto"},children:(0,E.jsx)(Ha,{})})]})}var W=g(F(),1);var Oa=g(f(),1),nr=Q(()=>(__graviewPreload(import.meta.url,["./chunk.UGFDSE37.js","./chunk.HFVMGTNL.js","./chunk.7Z4USR3Y.js","./chunk.NPAWTPLQ.js","./chunk.SDO3U72B.js","./chunk.YEJ4LNUP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VDD3RHLB.js")));function Ke(){let{store:e,principal:n}=S(),l=(0,W.useContext)(ca),o=(0,W.useRef)(null),r=(0,W.useRef)(!1);return(0,W.useEffect)(()=>()=>void(r.current=!0),[]),(0,W.useEffect)(()=>{let w=e.batches().length,c=nr().then(v=>v.sceneWay(e,n,l,w,o.current),()=>{});return()=>void c.then(v=>v?.(r.current))},[e,n,l]),(0,Oa.jsx)("span",{ref:o,hidden:!0})}var Fa=g(F(),1);var u=g(f(),1);function Dt({address:e=!1,auto:n,quickAsk:l=!0,scheme:o,scope:r}){let w=(0,Fa.useMemo)(()=>`${Me({scope:`.${r}`})}
1132
1132
  ${Ie(o,{scope:`.${r}`})}`,[o,r]),c=va(),[v]=De();return(0,u.jsx)(ra.Provider,{value:!0,children:(0,u.jsxs)("div",{"data-embed-content":"",style:{position:"relative",flex:n?`0 0 ${Ea}px`:"1 1 auto",minHeight:0,containerType:"size"},children:[(0,u.jsx)("style",{children:w}),e?(0,u.jsx)(za,{}):null,(0,u.jsx)($a,{}),(0,u.jsx)(Fe,{}),(0,u.jsx)(Ne,{}),(0,u.jsx)(Re,{}),(0,u.jsxs)(ka,{children:[(0,u.jsx)(ze,{}),(0,u.jsx)(Ee,{face:"scene",on:l}),(0,u.jsx)(Le,{}),(0,u.jsx)(be,{children:(0,u.jsx)(Se,{children:(0,u.jsx)(Ce,{children:(0,u.jsx)(Te,{children:(0,u.jsx)($e,{placement:"menu"})})})})}),(0,u.jsx)(ye,{}),(0,u.jsx)(Ae,{}),(0,u.jsx)(Oe,{find:c,calls:v}),(0,u.jsx)(Ke,{}),(0,u.jsx)(he,{face:"scene"})]})]})})}function Ot(){return(0,u.jsx)(Pe,{})}export{Dt as SceneFace,Ot as SceneKeeping};
@@ -1 +1 @@
1
- import{b as cn,c as un}from"./chunk.AZGXBTOQ.js";import{j as x}from"./chunk.RLO3RDYH.js";import{c as Z}from"./chunk.TUNHUTQ5.js";import{Nb as on,Ob as E,Wb as rn,Xb as an,Za as V,cd as dn,da as T,ea as K,fa as H,ga as en,ha as tn,hc as Q,ka as sn,la as J,ma as G,oc as U}from"./chunk.3MZIWKNG.js";function fn(){return{name:"insight",derive({store:n,nodes:d,kindSelection:t}){let f=[],v=l=>T(n.schema.tryDefinition(l.kind),l);for(let l of d){if([...n.schema.edgeKinds].reduce((c,w)=>c+n.graph.out(l.id,w).length+n.graph.in(l.id,w).length,0)===0){f.push({id:`insight:island:${l.id}`,text:`${v(l)} is connected to nothing yet`,nodeIds:[l.id]});continue}for(let c of n.schema.edgeKinds){let w=n.graph.in(l.id,c).length;if(w<3)continue;let s=[...n.graph.allEdges()].filter(a=>a.kind===c),e=s.length;e>=4&&w/e>.6&&f.push({id:`insight:load:${l.id}:${c}`,text:`${v(l)} ${vn(n,s,c,w)}`,nodeIds:[l.id]})}}for(let l of t){if(n.graph.nodesOfKind(l).length>0)continue;let A=n.schema.definitions.filter(c=>c.kind!==l).filter(c=>Object.values(c.edges).some(w=>w.to!=="*"&&w.to.includes(l))).map(c=>c.plural??`${c.kind}s`);A.length>0&&f.push({id:`insight:gap:${l}`,text:`Nothing here yet, though ${A.join(" and ")} expect to connect to these`,nodeIds:[]})}return{observations:f}}}}function vn(n,d,t,f){let v=new Set(d.map(s=>n.graph.getNode(s.from)?.kind).filter(s=>s!==void 0)),l=v.size===1?[...v][0]:void 0,A=d.length,c=Z(n.schema,l??[...v][0]??"",t,"in"),w=s=>l?en(n.schema,l,s):String(s);return f===A?`${c}: all ${w(f)}`:`${c}: ${f} of the ${w(A)}`}function ln(n){let d=new Map;if(n.length===0)return d;let t=n.slice(-512),f=new Set;for(let l of t)l.undoes&&f.add(l.undoes);let v=n[n.length-1].seq;for(let l of t){if(!l.mutation||f.has(l.id))continue;let A=Math.pow(.5,(v-l.seq)/64);d.set(l.mutation.name,(d.get(l.mutation.name)??0)+A)}return d}function hn(n){return 8*(n/(n+1))}var bn=100;function gn(){return{name:"invariant",derive({store:n,selection:d,nodes:t,violations:f}){let v=s=>T(n.schema.tryDefinition(s.kind),s),l=new Set(d),A=f.filter(s=>s.nodeIds.some(e=>l.has(e))||s.subjectId!==void 0&&l.has(s.subjectId)),c=[],w=[];A.forEach((s,e)=>{w.push({id:`violation:${s.invariant}:${e}`,text:s.message,nodeIds:s.nodeIds}),s.repairs.forEach((a,h)=>{c.push({id:`invariant:${s.invariant}:${e}:${h}`,label:a.label,provider:"invariant",mutation:a.mutation,args:a.args??{},open:(a.missing??[]).map(m=>{let r=n.allMutations().find(g=>g.name===a.mutation);if(!r)return{name:m};let o=E(r.input).find(g=>g.name===m),k=o?o.kinds.includes("*")?n.graph.allNodes().map(g=>g.id):o.kinds.flatMap(g=>n.graph.nodesOfKind(g).map($=>$.id)):void 0;return{name:m,shape:x(r.input,m),...o?{kinds:o.kinds}:{},...k?{candidates:k}:{}}}),score:bn-h-(a.missing?.length??0),why:s.message,nodeIds:s.nodeIds,...s.subjectId===void 0?{}:{subjectId:s.subjectId}})})});for(let s of t){let e=n.allInvariants().filter(a=>{if(a.scope==="graph")return!1;let h=a.scope;return h.kind!==s.kind?!1:h.match?h.match(s):!0});e.length!==0&&(A.some(a=>a.subjectId===s.id||a.nodeIds.includes(s.id))||w.push({id:`holds:${s.id}`,text:`${v(s)} holds \u2014 nothing currently breaks ${e.length===1?"it":`any of its ${e.length} rules`}`,nodeIds:[s.id]}))}return{affordances:c,observations:w}}}}var X=40;function pn(){return{name:"schema",derive({store:n,selection:d,nodes:t,kindSelection:f,edgeSelection:v,principal:l}){let A=(e,a)=>l!==void 0&&!n.permits({name:e,args:a},l).ok,c=[];if(t.length===0&&v.length>0){for(let e of v){let a=n.graph.getNode(e.from),h=n.graph.getNode(e.to);if(!a||!h)continue;let m=un(n,e);m?.provisional&&c.push({id:`schema:edge:${Q}:${e.kind}:${e.from}:${e.to}`,label:"Keep this link",provider:"schema",mutation:Q,args:{kind:e.kind,from:e.from,to:e.to},open:[],score:64,why:cn(m),nodeIds:[e.from,e.to]});for(let r of n.allMutations()){let o=(r.connects??[]).includes(e.kind),k=(r.severs??[]).includes(e.kind);if(!o&&!k||r.derived?.relation!==void 0&&r.derived.kind!==a.kind)continue;let g={},$=[],j=E(r.input);for(let p of j){let S=p.kinds.includes("*")||p.kinds.includes(a.kind),P=p.kinds.includes("*")||p.kinds.includes(h.kind),y=S&&!j.some(I=>I!==p&&(I.kinds.includes(a.kind)||I.kinds.includes("*")));S&&!P?g[p.name]=e.from:P&&!S?g[p.name]=e.to:S&&P&&y?g[p.name]=e.from:$.push({name:p.name,kinds:p.kinds,candidates:[e.from,e.to],shape:x(r.input,p.name)})}for(let p of q(r.input,""))p in g||$.some(S=>S.name===p)||$.push({name:p,shape:x(r.input,p)});$.every(p=>p.optional===!0?!0:p.kinds!==void 0?(p.candidates?.length??0)>0:(p.candidates?.length??0)>0||p.shape!==void 0&&p.shape.type!=="unknown")&&(o&&!k&&$.length===0||c.push({id:`schema:edge:${r.name}:${e.kind}:${e.from}:${e.to}`,label:K(r),provider:"schema",mutation:r.name,args:g,open:$,...r.destructive?{destructive:!0}:{},score:(k?62:58)-$.length,why:`this line is "${Z(n.schema,n.graph.getNode(e.from)?.kind??"",e.kind,"out")}"`,nodeIds:[e.from,e.to]}))}}return{affordances:c}}if(t.length===0&&f.length>0){let e=new Set(f),a=[];for(let h of n.allMutations()){if(!(h.creates??[]).some(o=>e.has(o)))continue;let m=[];for(let o of E(h.input)){let k=o.kinds.includes("*")?n.graph.allNodes().map(g=>g.id):o.kinds.flatMap(g=>n.graph.nodesOfKind(g).map($=>$.id));m.push({name:o.name,kinds:o.kinds,candidates:k,shape:x(h.input,o.name),...o.optional?{optional:!0}:{}})}for(let o of q(h.input,""))m.some(k=>k.name===o)||m.push({name:o,shape:x(h.input,o)});if(!m.every(o=>o.optional===!0?!0:o.kinds!==void 0?(o.candidates?.length??0)>0:(o.candidates?.length??0)>0||o.shape!==void 0&&o.shape.type!=="unknown")&&!A(h.name,{})){let o=m.filter(k=>k.optional!==!0&&k.kinds!==void 0&&!k.kinds.includes("*")&&(k.candidates?.length??0)===0);if(o.length>0){let k=[...new Set(o.flatMap(g=>g.kinds??[]))].map(g=>J(G(n.schema.tryDefinition(g),g)));a.push({id:`schema:waits:${h.name}`,text:`"${h.title??h.name}" cannot begin until there is ${k.length===1?k[0]:`${k.slice(0,-1).join(", ")} and ${k[k.length-1]}`}.`,nodeIds:[]})}continue}c.push({id:`schema:add:${h.name}`,label:K(h),provider:"schema",mutation:h.name,args:{},open:m,score:X-m.length,why:`this makes ${(h.creates??[]).filter(o=>e.has(o)).map(o=>J(G(n.schema.tryDefinition(o),o))).join(", ")}`,nodeIds:[]})}return{affordances:c,observations:a}}if(t.length===0)return{};let w=new Set(t.map(e=>e.kind)),s=(e,a,h)=>{let m=[];for(let r of n.graph.allEdges()){if(!a.includes(r.kind))continue;let o=r.from===e?r.to:r.to===e?r.from:null;if(!o)continue;let k=n.graph.getNode(o);k&&(!h.includes("*")&&!h.includes(k.kind)||m.includes(o)||m.push(o))}return m};for(let e of n.allMutations()){let a=e.subject;if(!a||!(a.kinds==="*"?!0:[...w].every(u=>a.kinds.includes(u))))continue;let m=e.derived?.act;if((m==="archive"||m==="merge")&&t.some(u=>V(u))||m==="unarchive"&&!t.some(u=>V(u))||m==="leave-alone"&&t.every(u=>U(n,u.id))||m==="allow-tidying"&&!t.some(u=>U(n,u.id)))continue;let r=t.length===1?t[0].id:null,o=e.severs??[],k=e.connects??[];if(r&&o.length>0&&k.length===0&&s(r,o,["*"]).length===0)continue;let g=[];for(let u of E(e.input)){if(u.name===a.arg)continue;let p=u.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):u.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(P=>P.id));if(r&&k.length>0){let S=new Set(s(r,k,u.kinds));p=p.filter(P=>!S.has(P))}else r&&o.length>0&&(p=s(r,o,u.kinds));g.push({name:u.name,kinds:u.kinds,candidates:p.filter(S=>!d.includes(S)),shape:x(e.input,u.name),...u.optional?{optional:!0}:{}})}for(let u of q(e.input,a.arg))g.some(p=>p.name===u)||g.push({name:u,shape:x(e.input,u)});if(g.length===0&&r){let u=Sn(e.input,a.arg);if(u.length>0&&!wn(n,e.name,{[a.arg]:r}))for(let p of u){let S=E(e.input).find(P=>P.name===p);g.push({name:p,optional:!0,...S?{kinds:S.kinds}:{},shape:x(e.input,p)})}}if(!g.every(u=>u.optional===!0?!0:u.kinds!==void 0?(u.candidates?.length??0)>0:(u.candidates?.length??0)>0||u.shape!==void 0&&u.shape.type!=="unknown")&&!A(e.name,r?{[a.arg]:r}:{}))continue;let j=t.map(u=>({[a.arg]:u.id}));g.length===0&&!j.some(u=>n.wouldChange({name:e.name,args:u}))||c.push({id:`schema:${e.name}`,label:t.length>1?`${K(e)} (${t.length})`:K(e),provider:"schema",mutation:e.name,args:j[0]??{},open:g,...e.destructive?{destructive:!0}:{},...e.derived?.act==="archive"||e.derived?.act==="merge"||e.derived?.act==="leave-alone"||e.derived?.act==="allow-tidying"?{setsAside:!0}:{},...o.length>0||k.length>0?{ties:!0}:{},...t.length>1?{batch:j}:{},score:X-g.length,why:t.length>1?`all ${t.length} selected nodes are ${[...w].map(u=>tn(n.schema,u).toLowerCase()).join(" or ")}`:`this is ${J(G(n.schema.tryDefinition(t[0].kind),t[0].kind))}`,nodeIds:t.map(u=>u.id)})}if(t.length===1){let e=t[0];for(let a of n.allMutations()){let h=a.subject,m=a.severs??[],r=a.connects??[];if(!h||m.length===0&&r.length===0)continue;let o=h.kinds==="*"?"*":h.kinds;if(o==="*"||o.includes(e.kind))continue;let k=E(a.input),g=k.find(y=>y.name!==h.arg&&(y.kinds.includes("*")||y.kinds.includes(e.kind)));if(!g)continue;let $=o,j=$.includes("*")?n.graph.allNodes().map(y=>y.id):$.flatMap(y=>n.graph.nodesOfKind(y).map(I=>I.id)),u=new Set(s(e.id,r.length>0?r:m,$)),p=r.length>0?j.filter(y=>!u.has(y)):j.filter(y=>u.has(y));if(p.length===0)continue;let S=[{name:h.arg,kinds:$,candidates:p,shape:x(a.input,h.arg)}];for(let y of k){if(y.name===g.name||y.name===h.arg)continue;let I=y.kinds.includes("*")?n.graph.allNodes().map(L=>L.id):y.kinds.flatMap(L=>n.graph.nodesOfKind(L).map(O=>O.id));S.push({name:y.name,kinds:y.kinds,candidates:I,shape:x(a.input,y.name),...y.optional?{optional:!0}:{}})}for(let y of q(a.input,g.name))y===h.arg||S.some(I=>I.name===y)||S.push({name:y,shape:x(a.input,y)});S.every(y=>y.optional===!0?!0:y.kinds!==void 0?(y.candidates?.length??0)>0:(y.candidates?.length??0)>0||y.shape!==void 0&&y.shape.type!=="unknown")&&c.push({id:`schema:tie:${a.name}:${e.id}`,label:a.fromTheOtherEnd??K(a),provider:"schema",mutation:a.name,args:{[g.name]:e.id},open:S,ties:!0,...a.destructive?{destructive:!0}:{},score:X-S.length+2,why:`${m.length>0?"this one is on":"this one could join"} ${S[0].candidates.length===1?"it":"one of these"}`,nodeIds:[e.id]})}}return{affordances:c}}}}function Sn(n,d){let t=n.shape;return t?Object.entries(t).filter(([f,v])=>f!==d&&v.safeParse(void 0).success).map(([f])=>f):[]}function wn(n,d,t){try{return n.preview({name:d,args:t}),!0}catch{return!1}}function q(n,d){let t=n.shape;return t?Object.entries(t).filter(([f,v])=>f!==d&&!v.safeParse(void 0).success).map(([f])=>f):[]}var An=70,$n=80,On=new Set(["id","kind"]);function mn(){return{name:"structure",derive({store:n,nodes:d}){let t=c=>T(n.schema.tryDefinition(c.kind),c);if(d.length<2)return{};let f=[],v=[],l=d.map(c=>c.id);for(let c of n.schema.edgeKinds){let w=In(d.map(e=>new Set([...n.graph.out(e.id,c).map(a=>a.id),...n.graph.in(e.id,c).map(a=>a.id)])));for(let e of w){let a=n.graph.getNode(e);a&&f.push({id:`shared:${c}:${e}`,text:`all ${d.length} share "${t(a)}" (${H(c).toLowerCase()})`,nodeIds:[...l,e]})}let s=new Map;for(let e of d)for(let a of[...n.graph.out(e.id,c),...n.graph.in(e.id,c)])s.set(a.id,(s.get(a.id)??0)+1);for(let[e,a]of s){if(a!==d.length-1||d.length<3||l.includes(e))continue;let h=n.graph.getNode(e);if(!h)continue;let m=d.find(r=>![...n.graph.out(r.id,c),...n.graph.in(r.id,c)].some(o=>o.id===e));if(m&&(f.push({id:`near-shared:${c}:${e}`,text:`all but "${t(m)}" share "${t(h)}" (${H(c).toLowerCase()})`,nodeIds:[...l,e]}),!(!n.schema.edgeAllowed(c,m.kind,h.kind)&&!n.schema.edgeAllowed(c,h.kind,m.kind))))for(let r of n.allMutations()){let o=r.subject;if(!o||o.kinds!=="*"&&!o.kinds.includes(m.kind)||(r.connects!==void 0||r.severs!==void 0)&&!(r.connects??[]).includes(c))continue;let g=Pn(r.input,h.kind);g&&v.push({id:`structure:join:${r.name}:${m.id}:${e}`,label:`${K(r)}: bring "${t(m)}" in line with the others`,provider:"structure",mutation:r.name,args:{[o.arg]:m.id,[g]:e},open:[],score:An,why:`every other selected node is connected to "${t(h)}"`,nodeIds:[m.id,e]})}}}let A=new Map;for(let c of d)A.set(c.kind,[...A.get(c.kind)??[],c]);for(let[c,w]of A){if(w.length<2)continue;let s=w,e=w.map(r=>r.id),a=A.size>1?`${c}:`:"",h=new Set;for(let r of s)for(let o of Object.keys(r))On.has(o)||h.add(o);let m=r=>n.schema.definitions.find(o=>o.kind===r);for(let r of[...h].sort()){let o=m(s[0].kind),k=sn(o,r).toLowerCase(),g=o?.display?.format?.[r],$=O=>{if(!g)return O;try{return String(g(JSON.parse(O)))}catch{return O}},j=s.map(O=>O[r]),u=new Map;if(j.forEach((O,R)=>{let D=JSON.stringify(O??null),M=u.get(D);M?M.push(s[R]):u.set(D,[s[R]])}),u.size===1){let O=[...u.keys()][0];if(O==="null")continue;f.push({id:`agree:${a}${r}`,text:`all ${s.length} share the ${k} ${$(O)}`,nodeIds:e});continue}if(s.length<3||u.size!==2)continue;let p=[...u.entries()].sort((O,R)=>R[1].length-O[1].length),[S,P]=p[0],[,y]=p[1];if(y.length!==1||S==="null")continue;let I=y[0],L=JSON.parse(S);f.push({id:`odd-one-out:${a}${r}`,text:`${P.length} share the ${k} ${$(S)}; "${t(I)}" does not`,nodeIds:e});for(let O of n.allMutations()){let R=O.subject;if(!R||R.kinds!=="*"&&!R.kinds.includes(I.kind))continue;let D=kn(O.input);if(!D||!(r in D))continue;let M={[R.arg]:I.id,[r]:L},C=!0;for(let[W,z]of Object.entries(D)){if(W in M||z.safeParse(void 0).success)continue;let B=I[W];if(B===void 0){C=!1;break}M[W]=B}!C||!O.input.safeParse(M).success||v.push({id:`structure:align:${O.name}:${r}:${I.id}`,label:`Align the ${k} of "${t(I)}" with the other ${P.length}`,provider:"structure",mutation:O.name,args:M,open:[],score:$n,why:`${P.length} of ${s.length} share the ${k} ${$(S)}`,nodeIds:e})}}}return{affordances:v,observations:f}}}}function In(n){if(n.length===0)return[];let[d,...t]=n;return[...d].filter(f=>t.every(v=>v.has(f))).sort()}function kn(n){return n.shape??null}function Pn(n,d){let t=kn(n);if(!t)return null;for(let[f]of Object.entries(t)){let v=on(t[f]);if(v&&(v.includes("*")||v.includes(d)))return f}return null}function jn(){return[gn(),mn(),pn(),fn()]}function Xn(n,d,t={}){let f=yn(),v=t.providers??jn(),l=d.map(i=>n.graph.getNode(i)).filter(i=>i!==void 0),A={store:n,selection:d,nodes:l,kindSelection:t.kindSelection??[],edgeSelection:t.edgeSelection??[],violations:n.violations(t.context),context:t.context??{},principal:t.principal??{kind:"human"}},c=[],w=[];for(let i of v){let b=i.derive(A);c.push(...b.affordances??[]),w.push(...b.observations??[])}let s=new Map(n.allMutations().map(i=>[i.name,i]));c.forEach((i,b)=>{let N=i.open.length>1?s.get(i.mutation):void 0;N&&(c[b]={...i,open:an(i.open,rn(n.schema,N))})});let e=new Set(n.allMutations().filter(i=>i.pinned).map(i=>i.name)),a=new Set(t.pins?.pinned??[]),h=new Set(t.pins?.unpinned??[]),m=i=>a.has(i.mutation)?"user":e.has(i.mutation)&&!h.has(i.mutation)?"declared":void 0,r=i=>{let b=m(i);return b?{...i,pinned:b}:i},o=new Map;for(let[i,b]of ln(n.log.all()))o.set(i,hn(b));let k=i=>i.pinned==="user"?0:i.pinned==="declared"?1:2,g=i=>i.score+(o.get(i.mutation)??0),$=new Map(n.allMutations().map(i=>[i.name,i])),j=new Map,u=i=>{let b=$.get(i.mutation);if(!b)return[];let N=j.get(i.mutation);N||(N=E(b.input).map(F=>F.name),j.set(i.mutation,N));let _=[];for(let F of i.batch??[i.args])for(let Y of N){let nn=F[Y]??i.args[Y];typeof nn=="string"&&_.push(nn)}return _},p=t.focus,S=4,P=i=>i.open.length>0?1:0,y=i=>{if(p===void 0)return S;let b=u(i);return b.length>0?b.includes(p)?I(i,0):S:i.nodeIds.includes(p)||i.subjectId===p?I(i,1):S},I=(i,b)=>i.provider==="invariant"?b:2+P(i),L=i=>i.setsAside?1:0,O=Nn(c).map(r),R=new Map(O.map((i,b)=>[i,b])),D=O.sort((i,b)=>{let N=Number(i.destructive??!1)-Number(b.destructive??!1);if(N!==0)return N;let _=L(i)-L(b);if(_!==0)return _;let F=y(i)-y(b);return F!==0?F:y(i)<2?R.get(i)-R.get(b):+(b.provider==="invariant")-+(i.provider==="invariant")||k(i)-k(b)||g(b)-g(i)||i.id.localeCompare(b.id)}),M=t.principal??{kind:"human"},C=[],W=[];for(let i of D){let b=n.permits({name:i.mutation,args:{...i.args,...i.batch?.[0]??{}}},M);if(b.ok)C.push(i);else{let N=Rn(n,i,M);if(N==="done")continue;N?C.push(N):W.push({...i,refusal:b.refusal})}}let z=C.map((i,b)=>({...i,rank:b})),B=W.map((i,b)=>({...i,rank:C.length+b}));return{affordances:t.limit===void 0?z:z.slice(0,t.limit),withheld:B,observations:xn(w),ms:yn()-f}}function Nn(n){let d=new Map;for(let t of n){let f=[t.mutation,JSON.stringify(t.args),JSON.stringify(t.batch??null)].join("|"),v=d.get(f);(!v||t.score>v.score)&&d.set(f,t)}return[...d.values()]}function xn(n){let d=new Map;for(let t of n)d.set(t.text,t);return[...d.values()]}function yn(){return typeof performance<"u"?performance.now():Date.now()}function Yn(n,d,t={},f={}){let v=(d.batch??[d.args]).map(A=>({name:d.mutation,args:{...d.args,...A,...t}})),l=n.allMutations().find(A=>A.name===d.mutation);return n.applyAll(v,{...l?.describe?{}:{intent:d.label},...f.author?{author:f.author}:{}})}function ne(n,d,t={},f={}){try{return n.preview({name:d.mutation,args:{...d.args,...t}})}catch(v){throw f.pressed&&dn(v,f.pressed.author?.id),v}}function Rn(n,d,t){let f=n.allMutations().find(s=>s.name===d.mutation)?.subject,v=f!==void 0&&d.args[f.arg]===void 0,l=v?d.open.find(s=>s.name===f.arg):d.open.find(s=>s.name!==f?.arg&&s.candidates);if(!l?.candidates)return;let A=s=>n.permits({name:d.mutation,args:{...d.args,...d.batch?.[0]??{},[l.name]:s}},t).ok,c=l.candidates.filter(A),w=t.id===void 0?void 0:n.graph.getNode(t.id);if(c.length===0){let s=v?f.kinds:"*";return w!==void 0&&(s==="*"||s.includes(w.kind))&&A(w.id)?"done":void 0}return c.length===1&&c[0]===t.id?{...d,args:{...d.args,[l.name]:t.id},open:d.open.filter(s=>s!==l)}:{...d,open:d.open.map(s=>s===l?{...s,candidates:c}:s)}}export{Xn as a,Yn as b,ne as c};
1
+ import{b as cn,c as un}from"./chunk.V3NPUAPB.js";import{j as x}from"./chunk.DPPT6WAJ.js";import{c as Z}from"./chunk.7U2JO7ET.js";import{Qb as on,Rb as E,Zb as rn,_b as an,ab as V,da as H,ga as T,ha as K,ia as en,ja as tn,kc as Q,kd as dn,ma as sn,na as J,oa as G,rc as U}from"./chunk.YEJ4LNUP.js";function fn(){return{name:"insight",derive({store:n,nodes:d,kindSelection:t}){let f=[],v=l=>T(n.schema.tryDefinition(l.kind),l);for(let l of d){if([...n.schema.edgeKinds].reduce((c,w)=>c+n.graph.out(l.id,w).length+n.graph.in(l.id,w).length,0)===0){f.push({id:`insight:island:${l.id}`,text:`${v(l)} is connected to nothing yet`,nodeIds:[l.id]});continue}for(let c of n.schema.edgeKinds){let w=n.graph.in(l.id,c).length;if(w<3)continue;let s=[...n.graph.allEdges()].filter(a=>a.kind===c),e=s.length;e>=4&&w/e>.6&&f.push({id:`insight:load:${l.id}:${c}`,text:`${v(l)} ${vn(n,s,c,w)}`,nodeIds:[l.id]})}}for(let l of t){if(n.graph.nodesOfKind(l).length>0)continue;let A=n.schema.definitions.filter(c=>c.kind!==l).filter(c=>Object.values(c.edges).some(w=>w.to!=="*"&&w.to.includes(l))).map(c=>c.plural??`${c.kind}s`);A.length>0&&f.push({id:`insight:gap:${l}`,text:`Nothing here yet, though ${A.join(" and ")} expect to connect to these`,nodeIds:[]})}return{observations:f}}}}function vn(n,d,t,f){let v=new Set(d.map(s=>n.graph.getNode(s.from)?.kind).filter(s=>s!==void 0)),l=v.size===1?[...v][0]:void 0,A=d.length,c=Z(n.schema,l??[...v][0]??"",t,"in"),w=s=>l?en(n.schema,l,s):String(s);return f===A?`${c}: all ${w(f)}`:`${c}: ${f} of the ${w(A)}`}function ln(n){let d=new Map;if(n.length===0)return d;let t=n.slice(-512),f=new Set;for(let l of t)l.undoes&&f.add(l.undoes);let v=n[n.length-1].seq;for(let l of t){if(!l.mutation||f.has(l.id))continue;let A=Math.pow(.5,(v-l.seq)/64);d.set(l.mutation.name,(d.get(l.mutation.name)??0)+A)}return d}function hn(n){return 8*(n/(n+1))}var bn=100;function gn(){return{name:"invariant",derive({store:n,selection:d,nodes:t,violations:f}){let v=s=>T(n.schema.tryDefinition(s.kind),s),l=new Set(d),A=f.filter(s=>s.nodeIds.some(e=>l.has(e))||s.subjectId!==void 0&&l.has(s.subjectId)),c=[],w=[];A.forEach((s,e)=>{w.push({id:`violation:${s.invariant}:${e}`,text:s.message,nodeIds:s.nodeIds}),s.repairs.forEach((a,h)=>{c.push({id:`invariant:${s.invariant}:${e}:${h}`,label:a.label,provider:"invariant",mutation:a.mutation,args:a.args??{},open:(a.missing??[]).map(m=>{let r=n.allMutations().find(g=>g.name===a.mutation);if(!r)return{name:m};let o=E(r.input).find(g=>g.name===m),k=o?o.kinds.includes("*")?n.graph.allNodes().map(g=>g.id):o.kinds.flatMap(g=>n.graph.nodesOfKind(g).map($=>$.id)):void 0;return{name:m,shape:x(r.input,m),...o?{kinds:o.kinds}:{},...k?{candidates:k}:{}}}),score:bn-h-(a.missing?.length??0),why:s.message,nodeIds:s.nodeIds,...s.subjectId===void 0?{}:{subjectId:s.subjectId}})})});for(let s of t){let e=n.allInvariants().filter(a=>{if(a.scope==="graph")return!1;let h=a.scope;return h.kind!==s.kind?!1:h.match?h.match(s):!0});e.length!==0&&(A.some(a=>a.subjectId===s.id||a.nodeIds.includes(s.id))||w.push({id:`holds:${s.id}`,text:`${v(s)} holds \u2014 nothing currently breaks ${e.length===1?"it":`any of its ${e.length} rules`}`,nodeIds:[s.id]}))}return{affordances:c,observations:w}}}}var X=40;function pn(){return{name:"schema",derive({store:n,selection:d,nodes:t,kindSelection:f,edgeSelection:v,principal:l}){let A=(e,a)=>l!==void 0&&!n.permits({name:e,args:a},l).ok,c=[];if(t.length===0&&v.length>0){for(let e of v){let a=n.graph.getNode(e.from),h=n.graph.getNode(e.to);if(!a||!h)continue;let m=un(n,e);m?.provisional&&c.push({id:`schema:edge:${Q}:${e.kind}:${e.from}:${e.to}`,label:"Keep this link",provider:"schema",mutation:Q,args:{kind:e.kind,from:e.from,to:e.to},open:[],score:64,why:cn(m),nodeIds:[e.from,e.to]});for(let r of n.allMutations()){let o=(r.connects??[]).includes(e.kind),k=(r.severs??[]).includes(e.kind);if(!o&&!k||r.derived?.relation!==void 0&&r.derived.kind!==a.kind)continue;let g={},$=[],j=E(r.input);for(let p of j){let S=p.kinds.includes("*")||p.kinds.includes(a.kind),P=p.kinds.includes("*")||p.kinds.includes(h.kind),y=S&&!j.some(I=>I!==p&&(I.kinds.includes(a.kind)||I.kinds.includes("*")));S&&!P?g[p.name]=e.from:P&&!S?g[p.name]=e.to:S&&P&&y?g[p.name]=e.from:$.push({name:p.name,kinds:p.kinds,candidates:[e.from,e.to],shape:x(r.input,p.name)})}for(let p of q(r.input,""))p in g||$.some(S=>S.name===p)||$.push({name:p,shape:x(r.input,p)});$.every(p=>p.optional===!0?!0:p.kinds!==void 0?(p.candidates?.length??0)>0:(p.candidates?.length??0)>0||p.shape!==void 0&&p.shape.type!=="unknown")&&(o&&!k&&$.length===0||c.push({id:`schema:edge:${r.name}:${e.kind}:${e.from}:${e.to}`,label:K(r),provider:"schema",mutation:r.name,args:g,open:$,...r.destructive?{destructive:!0}:{},score:(k?62:58)-$.length,why:`this line is "${Z(n.schema,n.graph.getNode(e.from)?.kind??"",e.kind,"out")}"`,nodeIds:[e.from,e.to]}))}}return{affordances:c}}if(t.length===0&&f.length>0){let e=new Set(f),a=[];for(let h of n.allMutations()){if(!(h.creates??[]).some(o=>e.has(o)))continue;let m=[];for(let o of E(h.input)){let k=o.kinds.includes("*")?n.graph.allNodes().map(g=>g.id):o.kinds.flatMap(g=>n.graph.nodesOfKind(g).map($=>$.id));m.push({name:o.name,kinds:o.kinds,candidates:k,shape:x(h.input,o.name),...o.optional?{optional:!0}:{}})}for(let o of q(h.input,""))m.some(k=>k.name===o)||m.push({name:o,shape:x(h.input,o)});if(!m.every(o=>o.optional===!0?!0:o.kinds!==void 0?(o.candidates?.length??0)>0:(o.candidates?.length??0)>0||o.shape!==void 0&&o.shape.type!=="unknown")&&!A(h.name,{})){let o=m.filter(k=>k.optional!==!0&&k.kinds!==void 0&&!k.kinds.includes("*")&&(k.candidates?.length??0)===0);if(o.length>0){let k=[...new Set(o.flatMap(g=>g.kinds??[]))].map(g=>J(G(n.schema.tryDefinition(g),g)));a.push({id:`schema:waits:${h.name}`,text:`"${h.title??h.name}" cannot begin until there is ${k.length===1?k[0]:`${k.slice(0,-1).join(", ")} and ${k[k.length-1]}`}.`,nodeIds:[]})}continue}c.push({id:`schema:add:${h.name}`,label:K(h),provider:"schema",mutation:h.name,args:{},open:m,score:X-m.length,why:`this makes ${(h.creates??[]).filter(o=>e.has(o)).map(o=>J(G(n.schema.tryDefinition(o),o))).join(", ")}`,nodeIds:[]})}return{affordances:c,observations:a}}if(t.length===0)return{};let w=new Set(t.map(e=>e.kind)),s=(e,a,h)=>{let m=[];for(let r of n.graph.allEdges()){if(!a.includes(r.kind))continue;let o=r.from===e?r.to:r.to===e?r.from:null;if(!o)continue;let k=n.graph.getNode(o);k&&(!h.includes("*")&&!h.includes(k.kind)||m.includes(o)||m.push(o))}return m};for(let e of n.allMutations()){let a=e.subject;if(!a||!(a.kinds==="*"?!0:[...w].every(u=>a.kinds.includes(u))))continue;let m=e.derived?.act;if((m==="archive"||m==="merge")&&t.some(u=>V(u))||m==="unarchive"&&!t.some(u=>V(u))||m==="leave-alone"&&t.every(u=>U(n,u.id))||m==="allow-tidying"&&!t.some(u=>U(n,u.id)))continue;let r=t.length===1?t[0].id:null,o=e.severs??[],k=e.connects??[];if(r&&o.length>0&&k.length===0&&s(r,o,["*"]).length===0)continue;let g=[];for(let u of E(e.input)){if(u.name===a.arg)continue;let p=u.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):u.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(P=>P.id));if(r&&k.length>0){let S=new Set(s(r,k,u.kinds));p=p.filter(P=>!S.has(P))}else r&&o.length>0&&(p=s(r,o,u.kinds));g.push({name:u.name,kinds:u.kinds,candidates:p.filter(S=>!d.includes(S)),shape:x(e.input,u.name),...u.optional?{optional:!0}:{}})}for(let u of q(e.input,a.arg))g.some(p=>p.name===u)||g.push({name:u,shape:x(e.input,u)});if(g.length===0&&r){let u=Sn(e.input,a.arg);if(u.length>0&&!wn(n,e.name,{[a.arg]:r}))for(let p of u){let S=E(e.input).find(P=>P.name===p);g.push({name:p,optional:!0,...S?{kinds:S.kinds}:{},shape:x(e.input,p)})}}if(!g.every(u=>u.optional===!0?!0:u.kinds!==void 0?(u.candidates?.length??0)>0:(u.candidates?.length??0)>0||u.shape!==void 0&&u.shape.type!=="unknown")&&!A(e.name,r?{[a.arg]:r}:{}))continue;let j=t.map(u=>({[a.arg]:u.id}));g.length===0&&!j.some(u=>n.wouldChange({name:e.name,args:u}))||c.push({id:`schema:${e.name}`,label:t.length>1?`${K(e)} (${t.length})`:K(e),provider:"schema",mutation:e.name,args:j[0]??{},open:g,...e.destructive?{destructive:!0}:{},...e.derived?.act==="archive"||e.derived?.act==="merge"||e.derived?.act==="leave-alone"||e.derived?.act==="allow-tidying"?{setsAside:!0}:{},...o.length>0||k.length>0?{ties:!0}:{},...t.length>1?{batch:j}:{},score:X-g.length,why:t.length>1?`all ${t.length} selected nodes are ${[...w].map(u=>tn(n.schema,u).toLowerCase()).join(" or ")}`:`this is ${J(G(n.schema.tryDefinition(t[0].kind),t[0].kind))}`,nodeIds:t.map(u=>u.id)})}if(t.length===1){let e=t[0];for(let a of n.allMutations()){let h=a.subject,m=a.severs??[],r=a.connects??[];if(!h||m.length===0&&r.length===0)continue;let o=h.kinds==="*"?"*":h.kinds;if(o==="*"||o.includes(e.kind))continue;let k=E(a.input),g=k.find(y=>y.name!==h.arg&&(y.kinds.includes("*")||y.kinds.includes(e.kind)));if(!g)continue;let $=o,j=$.includes("*")?n.graph.allNodes().map(y=>y.id):$.flatMap(y=>n.graph.nodesOfKind(y).map(I=>I.id)),u=new Set(s(e.id,r.length>0?r:m,$)),p=r.length>0?j.filter(y=>!u.has(y)):j.filter(y=>u.has(y));if(p.length===0)continue;let S=[{name:h.arg,kinds:$,candidates:p,shape:x(a.input,h.arg)}];for(let y of k){if(y.name===g.name||y.name===h.arg)continue;let I=y.kinds.includes("*")?n.graph.allNodes().map(L=>L.id):y.kinds.flatMap(L=>n.graph.nodesOfKind(L).map(O=>O.id));S.push({name:y.name,kinds:y.kinds,candidates:I,shape:x(a.input,y.name),...y.optional?{optional:!0}:{}})}for(let y of q(a.input,g.name))y===h.arg||S.some(I=>I.name===y)||S.push({name:y,shape:x(a.input,y)});S.every(y=>y.optional===!0?!0:y.kinds!==void 0?(y.candidates?.length??0)>0:(y.candidates?.length??0)>0||y.shape!==void 0&&y.shape.type!=="unknown")&&c.push({id:`schema:tie:${a.name}:${e.id}`,label:a.fromTheOtherEnd??K(a),provider:"schema",mutation:a.name,args:{[g.name]:e.id},open:S,ties:!0,...a.destructive?{destructive:!0}:{},score:X-S.length+2,why:`${m.length>0?"this one is on":"this one could join"} ${S[0].candidates.length===1?"it":"one of these"}`,nodeIds:[e.id]})}}return{affordances:c}}}}function Sn(n,d){let t=n.shape;return t?Object.entries(t).filter(([f,v])=>f!==d&&v.safeParse(void 0).success).map(([f])=>f):[]}function wn(n,d,t){try{return n.preview({name:d,args:t}),!0}catch{return!1}}function q(n,d){let t=n.shape;return t?Object.entries(t).filter(([f,v])=>f!==d&&!v.safeParse(void 0).success).map(([f])=>f):[]}var An=70,$n=80,On=new Set(["id","kind"]);function mn(){return{name:"structure",derive({store:n,nodes:d}){let t=c=>T(n.schema.tryDefinition(c.kind),c);if(d.length<2)return{};let f=[],v=[],l=d.map(c=>c.id);for(let c of n.schema.edgeKinds){let w=In(d.map(e=>new Set([...n.graph.out(e.id,c).map(a=>a.id),...n.graph.in(e.id,c).map(a=>a.id)])));for(let e of w){let a=n.graph.getNode(e);a&&f.push({id:`shared:${c}:${e}`,text:`all ${d.length} share "${t(a)}" (${H(c).toLowerCase()})`,nodeIds:[...l,e]})}let s=new Map;for(let e of d)for(let a of[...n.graph.out(e.id,c),...n.graph.in(e.id,c)])s.set(a.id,(s.get(a.id)??0)+1);for(let[e,a]of s){if(a!==d.length-1||d.length<3||l.includes(e))continue;let h=n.graph.getNode(e);if(!h)continue;let m=d.find(r=>![...n.graph.out(r.id,c),...n.graph.in(r.id,c)].some(o=>o.id===e));if(m&&(f.push({id:`near-shared:${c}:${e}`,text:`all but "${t(m)}" share "${t(h)}" (${H(c).toLowerCase()})`,nodeIds:[...l,e]}),!(!n.schema.edgeAllowed(c,m.kind,h.kind)&&!n.schema.edgeAllowed(c,h.kind,m.kind))))for(let r of n.allMutations()){let o=r.subject;if(!o||o.kinds!=="*"&&!o.kinds.includes(m.kind)||(r.connects!==void 0||r.severs!==void 0)&&!(r.connects??[]).includes(c))continue;let g=Pn(r.input,h.kind);g&&v.push({id:`structure:join:${r.name}:${m.id}:${e}`,label:`${K(r)}: bring "${t(m)}" in line with the others`,provider:"structure",mutation:r.name,args:{[o.arg]:m.id,[g]:e},open:[],score:An,why:`every other selected node is connected to "${t(h)}"`,nodeIds:[m.id,e]})}}}let A=new Map;for(let c of d)A.set(c.kind,[...A.get(c.kind)??[],c]);for(let[c,w]of A){if(w.length<2)continue;let s=w,e=w.map(r=>r.id),a=A.size>1?`${c}:`:"",h=new Set;for(let r of s)for(let o of Object.keys(r))On.has(o)||h.add(o);let m=r=>n.schema.definitions.find(o=>o.kind===r);for(let r of[...h].sort()){let o=m(s[0].kind),k=sn(o,r).toLowerCase(),g=o?.display?.format?.[r],$=O=>{if(!g)return O;try{return String(g(JSON.parse(O)))}catch{return O}},j=s.map(O=>O[r]),u=new Map;if(j.forEach((O,R)=>{let D=JSON.stringify(O??null),M=u.get(D);M?M.push(s[R]):u.set(D,[s[R]])}),u.size===1){let O=[...u.keys()][0];if(O==="null")continue;f.push({id:`agree:${a}${r}`,text:`all ${s.length} share the ${k} ${$(O)}`,nodeIds:e});continue}if(s.length<3||u.size!==2)continue;let p=[...u.entries()].sort((O,R)=>R[1].length-O[1].length),[S,P]=p[0],[,y]=p[1];if(y.length!==1||S==="null")continue;let I=y[0],L=JSON.parse(S);f.push({id:`odd-one-out:${a}${r}`,text:`${P.length} share the ${k} ${$(S)}; "${t(I)}" does not`,nodeIds:e});for(let O of n.allMutations()){let R=O.subject;if(!R||R.kinds!=="*"&&!R.kinds.includes(I.kind))continue;let D=kn(O.input);if(!D||!(r in D))continue;let M={[R.arg]:I.id,[r]:L},C=!0;for(let[W,z]of Object.entries(D)){if(W in M||z.safeParse(void 0).success)continue;let B=I[W];if(B===void 0){C=!1;break}M[W]=B}!C||!O.input.safeParse(M).success||v.push({id:`structure:align:${O.name}:${r}:${I.id}`,label:`Align the ${k} of "${t(I)}" with the other ${P.length}`,provider:"structure",mutation:O.name,args:M,open:[],score:$n,why:`${P.length} of ${s.length} share the ${k} ${$(S)}`,nodeIds:e})}}}return{affordances:v,observations:f}}}}function In(n){if(n.length===0)return[];let[d,...t]=n;return[...d].filter(f=>t.every(v=>v.has(f))).sort()}function kn(n){return n.shape??null}function Pn(n,d){let t=kn(n);if(!t)return null;for(let[f]of Object.entries(t)){let v=on(t[f]);if(v&&(v.includes("*")||v.includes(d)))return f}return null}function jn(){return[gn(),mn(),pn(),fn()]}function Xn(n,d,t={}){let f=yn(),v=t.providers??jn(),l=d.map(i=>n.graph.getNode(i)).filter(i=>i!==void 0),A={store:n,selection:d,nodes:l,kindSelection:t.kindSelection??[],edgeSelection:t.edgeSelection??[],violations:n.violations(t.context),context:t.context??{},principal:t.principal??{kind:"human"}},c=[],w=[];for(let i of v){let b=i.derive(A);c.push(...b.affordances??[]),w.push(...b.observations??[])}let s=new Map(n.allMutations().map(i=>[i.name,i]));c.forEach((i,b)=>{let N=i.open.length>1?s.get(i.mutation):void 0;N&&(c[b]={...i,open:an(i.open,rn(n.schema,N))})});let e=new Set(n.allMutations().filter(i=>i.pinned).map(i=>i.name)),a=new Set(t.pins?.pinned??[]),h=new Set(t.pins?.unpinned??[]),m=i=>a.has(i.mutation)?"user":e.has(i.mutation)&&!h.has(i.mutation)?"declared":void 0,r=i=>{let b=m(i);return b?{...i,pinned:b}:i},o=new Map;for(let[i,b]of ln(n.log.all()))o.set(i,hn(b));let k=i=>i.pinned==="user"?0:i.pinned==="declared"?1:2,g=i=>i.score+(o.get(i.mutation)??0),$=new Map(n.allMutations().map(i=>[i.name,i])),j=new Map,u=i=>{let b=$.get(i.mutation);if(!b)return[];let N=j.get(i.mutation);N||(N=E(b.input).map(F=>F.name),j.set(i.mutation,N));let _=[];for(let F of i.batch??[i.args])for(let Y of N){let nn=F[Y]??i.args[Y];typeof nn=="string"&&_.push(nn)}return _},p=t.focus,S=4,P=i=>i.open.length>0?1:0,y=i=>{if(p===void 0)return S;let b=u(i);return b.length>0?b.includes(p)?I(i,0):S:i.nodeIds.includes(p)||i.subjectId===p?I(i,1):S},I=(i,b)=>i.provider==="invariant"?b:2+P(i),L=i=>i.setsAside?1:0,O=Nn(c).map(r),R=new Map(O.map((i,b)=>[i,b])),D=O.sort((i,b)=>{let N=Number(i.destructive??!1)-Number(b.destructive??!1);if(N!==0)return N;let _=L(i)-L(b);if(_!==0)return _;let F=y(i)-y(b);return F!==0?F:y(i)<2?R.get(i)-R.get(b):+(b.provider==="invariant")-+(i.provider==="invariant")||k(i)-k(b)||g(b)-g(i)||i.id.localeCompare(b.id)}),M=t.principal??{kind:"human"},C=[],W=[];for(let i of D){let b=n.permits({name:i.mutation,args:{...i.args,...i.batch?.[0]??{}}},M);if(b.ok)C.push(i);else{let N=Rn(n,i,M);if(N==="done")continue;N?C.push(N):W.push({...i,refusal:b.refusal})}}let z=C.map((i,b)=>({...i,rank:b})),B=W.map((i,b)=>({...i,rank:C.length+b}));return{affordances:t.limit===void 0?z:z.slice(0,t.limit),withheld:B,observations:xn(w),ms:yn()-f}}function Nn(n){let d=new Map;for(let t of n){let f=[t.mutation,JSON.stringify(t.args),JSON.stringify(t.batch??null)].join("|"),v=d.get(f);(!v||t.score>v.score)&&d.set(f,t)}return[...d.values()]}function xn(n){let d=new Map;for(let t of n)d.set(t.text,t);return[...d.values()]}function yn(){return typeof performance<"u"?performance.now():Date.now()}function Yn(n,d,t={},f={}){let v=(d.batch??[d.args]).map(A=>({name:d.mutation,args:{...d.args,...A,...t}})),l=n.allMutations().find(A=>A.name===d.mutation);return n.applyAll(v,{...l?.describe?{}:{intent:d.label},...f.author?{author:f.author}:{}})}function ne(n,d,t={},f={}){try{return n.preview({name:d.mutation,args:{...d.args,...t}})}catch(v){throw f.pressed&&dn(v,f.pressed.author?.id),v}}function Rn(n,d,t){let f=n.allMutations().find(s=>s.name===d.mutation)?.subject,v=f!==void 0&&d.args[f.arg]===void 0,l=v?d.open.find(s=>s.name===f.arg):d.open.find(s=>s.name!==f?.arg&&s.candidates);if(!l?.candidates)return;let A=s=>n.permits({name:d.mutation,args:{...d.args,...d.batch?.[0]??{},[l.name]:s}},t).ok,c=l.candidates.filter(A),w=t.id===void 0?void 0:n.graph.getNode(t.id);if(c.length===0){let s=v?f.kinds:"*";return w!==void 0&&(s==="*"||s.includes(w.kind))&&A(w.id)?"done":void 0}return c.length===1&&c[0]===t.id?{...d,args:{...d.args,[l.name]:t.id},open:d.open.filter(s=>s!==l)}:{...d,open:d.open.map(s=>s===l?{...s,candidates:c}:s)}}export{Xn as a,Yn as b,ne as c};