graview 0.1.66 → 0.1.67

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/preview/{chunk.LSN2IPAI.js → chunk.25QFDTCU.js} +1 -1
  2. package/dist/preview/{chunk.BFAFCVL4.js → chunk.264PB572.js} +1 -1
  3. package/dist/preview/chunk.2FHIINXG.js +2 -0
  4. package/dist/preview/{chunk.HSSIMVVM.js → chunk.2VUX54XH.js} +1 -1
  5. package/dist/preview/{chunk.CTASTRQN.js → chunk.35KMZHB7.js} +1 -1
  6. package/dist/preview/{chunk.OWFS2YDQ.js → chunk.37RFCHSS.js} +1 -1
  7. package/dist/preview/chunk.3ENPWZBG.js +1 -0
  8. package/dist/preview/{chunk.XMQG2PSM.js → chunk.3GNT5MKP.js} +1 -1
  9. package/dist/preview/{chunk.BXBEGMPO.js → chunk.3NSV3WKM.js} +2 -2
  10. package/dist/preview/chunk.3ZODN6BW.js +1 -0
  11. package/dist/preview/{chunk.OPTYYIGC.js → chunk.47XEJZ3O.js} +1 -1
  12. package/dist/preview/{chunk.5FNFRVTL.js → chunk.4EMKCKDB.js} +1 -1
  13. package/dist/preview/{chunk.B6JRTW3A.js → chunk.4UUJHLHR.js} +1 -1
  14. package/dist/preview/{chunk.FBILPNGH.js → chunk.4W57E7AX.js} +1 -1
  15. package/dist/preview/chunk.55G4IPOO.js +1 -0
  16. package/dist/preview/{chunk.72XP2ARZ.js → chunk.5AKZROMR.js} +1 -1
  17. package/dist/preview/chunk.5J6DVR7S.js +1 -0
  18. package/dist/preview/{chunk.FXT5CN32.js → chunk.5R744JGZ.js} +1 -1
  19. package/dist/preview/{chunk.NJRLJEJY.js → chunk.6KJGRM7A.js} +1 -1
  20. package/dist/preview/{chunk.4AC2QM7T.js → chunk.6N4PE3U5.js} +1 -1
  21. package/dist/preview/{chunk.LGRVEHXT.js → chunk.6NG76MDA.js} +2 -2
  22. package/dist/preview/{chunk.4FCFNAA4.js → chunk.6SJEZWH3.js} +1 -1
  23. package/dist/preview/{chunk.7VADSNPZ.js → chunk.6UQFV53C.js} +1 -1
  24. package/dist/preview/{chunk.WAB3L3ZI.js → chunk.6W6XMLSF.js} +1 -1
  25. package/dist/preview/{chunk.4JULYKGD.js → chunk.77C556NM.js} +1 -1
  26. package/dist/preview/{chunk.IGK7EZCX.js → chunk.7ARRVNUR.js} +1 -1
  27. package/dist/preview/{chunk.CBXS23YH.js → chunk.7BJRHPE3.js} +2 -2
  28. package/dist/preview/{chunk.ZQR2SN65.js → chunk.7S6ZRMW4.js} +1 -1
  29. package/dist/preview/{chunk.IAEHUSQQ.js → chunk.7UHPHEH5.js} +1 -1
  30. package/dist/preview/chunk.7WHQWLL6.js +1 -0
  31. package/dist/preview/{chunk.KACSYPEV.js → chunk.A4EZAGG7.js} +1 -1
  32. package/dist/preview/chunk.A5PSEU3W.js +25 -0
  33. package/dist/preview/{chunk.VKZIEZ5C.js → chunk.A7GVTE5Y.js} +2 -2
  34. package/dist/preview/{chunk.45JP6VGJ.js → chunk.AJMVRFYX.js} +2 -2
  35. package/dist/preview/{chunk.6P6NGZ6D.js → chunk.AKJS2NUM.js} +1 -1
  36. package/dist/preview/{chunk.CU2WCYMK.js → chunk.ARWO4WOV.js} +1 -1
  37. package/dist/preview/chunk.B5SJMCTT.js +7 -0
  38. package/dist/preview/{chunk.JXNVNFV4.js → chunk.B7KZBT27.js} +1 -1
  39. package/dist/preview/{chunk.E3UL4MCD.js → chunk.BDNQMKDG.js} +1 -1
  40. package/dist/preview/{chunk.YNEHJWJV.js → chunk.BKYZSV2Y.js} +1 -1
  41. package/dist/preview/{chunk.5BX66FBP.js → chunk.CKDCTFLU.js} +1 -1
  42. package/dist/preview/chunk.CTUJZ3IV.js +1 -0
  43. package/dist/preview/chunk.CY7FFKEZ.js +1 -0
  44. package/dist/preview/{chunk.3PBTN7RO.js → chunk.D4WJ7OM5.js} +1 -1
  45. package/dist/preview/{chunk.C2C3AXGI.js → chunk.D7NWMXSX.js} +3 -3
  46. package/dist/preview/chunk.DEKRFTRN.js +4 -0
  47. package/dist/preview/{chunk.E7EWNWAN.js → chunk.DKEIEH2D.js} +1 -1
  48. package/dist/preview/{chunk.I2737CPF.js → chunk.DWM7AR5Y.js} +1 -1
  49. package/dist/preview/{chunk.ANS2IEEV.js → chunk.DZMIYEHQ.js} +1 -1
  50. package/dist/preview/{chunk.BMENTGDC.js → chunk.E5PYNAYT.js} +2 -2
  51. package/dist/preview/chunk.EBKH3ILT.js +1 -0
  52. package/dist/preview/{chunk.DTCAUPLC.js → chunk.EFVSZKB5.js} +1 -1
  53. package/dist/preview/{chunk.QOS5T46W.js → chunk.EGPCVMDU.js} +1 -1
  54. package/dist/preview/{chunk.7ZKBYXUM.js → chunk.EJ2EZL2G.js} +1 -1
  55. package/dist/preview/{chunk.7VP6Y6D2.js → chunk.EP6Q32WT.js} +1 -1
  56. package/dist/preview/{chunk.OOSIKCOS.js → chunk.F464JKHZ.js} +1 -1
  57. package/dist/preview/{chunk.VGHO3VCB.js → chunk.FLJXYESX.js} +1 -1
  58. package/dist/preview/chunk.FOUBDGL3.js +1 -0
  59. package/dist/preview/chunk.FPHRAO3R.js +1 -0
  60. package/dist/preview/{chunk.4FDVINRJ.js → chunk.FRQSLWP4.js} +1 -1
  61. package/dist/preview/{chunk.2MHNPBHC.js → chunk.FVQKSN33.js} +1 -1
  62. package/dist/preview/{chunk.PDDIQ6PK.js → chunk.G3GFDVO2.js} +1 -1
  63. package/dist/preview/{chunk.ZD7T234N.js → chunk.G5GVT6JY.js} +1 -1
  64. package/dist/preview/{chunk.3L4JMM3P.js → chunk.GFLH7RCI.js} +1 -1
  65. package/dist/preview/{chunk.OO2OP76C.js → chunk.GMLONS5L.js} +1 -1
  66. package/dist/preview/{chunk.FK722SHI.js → chunk.GRFD42WM.js} +1 -1
  67. package/dist/preview/{chunk.2VR7YEJ6.js → chunk.GVT4UUQA.js} +1 -1
  68. package/dist/preview/{chunk.GME63ZHI.js → chunk.H3EGBDW2.js} +1 -1
  69. package/dist/preview/{chunk.DQFHIJFN.js → chunk.H6KIEDZN.js} +1 -1
  70. package/dist/preview/{chunk.5B5SRTUK.js → chunk.HAOB6O72.js} +1 -1
  71. package/dist/preview/chunk.HB5NWHFP.js +3 -0
  72. package/dist/preview/{chunk.6EHHMWPP.js → chunk.HJUZMOW2.js} +1 -1
  73. package/dist/preview/{chunk.6MQ5NT7S.js → chunk.HN4ZJ4B4.js} +1 -1
  74. package/dist/preview/chunk.HVBKI5ZO.js +1 -0
  75. package/dist/preview/chunk.I3SDKMQS.js +1 -0
  76. package/dist/preview/{chunk.QQAZQDRW.js → chunk.IAEGJDF3.js} +1 -1
  77. package/dist/preview/{chunk.QWNSHISU.js → chunk.IDALEKIW.js} +1 -1
  78. package/dist/preview/{chunk.QFHWG4LN.js → chunk.ILJDLBPJ.js} +1 -1
  79. package/dist/preview/{chunk.ZR2TP3BF.js → chunk.J2OPIS3H.js} +1 -1
  80. package/dist/preview/chunk.J5OLYVZ4.js +1 -0
  81. package/dist/preview/{chunk.LETAQTLJ.js → chunk.J6HF7IRQ.js} +1 -1
  82. package/dist/preview/{chunk.RWIN3POV.js → chunk.JEC5FDKX.js} +1 -1
  83. package/dist/preview/chunk.JKFVNQY7.js +1 -0
  84. package/dist/preview/{chunk.LLIURXFP.js → chunk.JQ2WNKDW.js} +1 -1
  85. package/dist/preview/{chunk.Z7Y3R3YR.js → chunk.JQ63N4MZ.js} +1 -1
  86. package/dist/preview/{chunk.DZFM6GSY.js → chunk.JU6UFWS3.js} +1 -1
  87. package/dist/preview/{chunk.INHS3KTK.js → chunk.JVB5KDSG.js} +1 -1
  88. package/dist/preview/{chunk.4U4D7WOI.js → chunk.KFT7JIEH.js} +1 -1
  89. package/dist/preview/chunk.KGMSSXZL.js +1 -0
  90. package/dist/preview/{chunk.5CXIEYHY.js → chunk.KX5ZBHMA.js} +2 -2
  91. package/dist/preview/{chunk.V7W5AQKL.js → chunk.LP2ZMAT2.js} +1 -1
  92. package/dist/preview/{chunk.BUVTUAB5.js → chunk.LRNFE3UK.js} +1 -1
  93. package/dist/preview/{chunk.PAGEGBUD.js → chunk.LVOTLGJB.js} +1 -1
  94. package/dist/preview/{chunk.QHMHUL6B.js → chunk.LYEGRY77.js} +1 -1
  95. package/dist/preview/{chunk.PPSYUOH7.js → chunk.M7KXQGQL.js} +1 -1
  96. package/dist/preview/{chunk.7BIPZTJB.js → chunk.MAKCZ6B6.js} +1 -1
  97. package/dist/preview/{chunk.EQ4OODGO.js → chunk.MJY4SLWA.js} +1 -1
  98. package/dist/preview/{chunk.EMFOMSMI.js → chunk.MSAYU25L.js} +1 -1
  99. package/dist/preview/{chunk.F4VB6Q2W.js → chunk.MUSMNKE4.js} +1 -1
  100. package/dist/preview/{chunk.BGAC3B7X.js → chunk.MW7R5G3C.js} +1 -1
  101. package/dist/preview/{chunk.AK7NGFEX.js → chunk.N4ZKZ4GM.js} +1 -1
  102. package/dist/preview/{chunk.TXHYGFIZ.js → chunk.NAXOXBOF.js} +1 -1
  103. package/dist/preview/{chunk.IWYMKGZZ.js → chunk.NKLPL7QD.js} +1 -1
  104. package/dist/preview/{chunk.QU52E5RG.js → chunk.NKYWIGC7.js} +1 -1
  105. package/dist/preview/{chunk.KSIEO5W7.js → chunk.NRURQGXV.js} +1 -1
  106. package/dist/preview/{chunk.FV72U33M.js → chunk.NSOPYIT4.js} +1 -1
  107. package/dist/preview/chunk.NXZL5CA2.js +1 -0
  108. package/dist/preview/{chunk.WVLEGCRI.js → chunk.O2OL6RQQ.js} +1 -1
  109. package/dist/preview/{chunk.TGEL6EUA.js → chunk.O5VFKVZS.js} +1 -1
  110. package/dist/preview/{chunk.CEVGND3Y.js → chunk.OCXY5DCD.js} +3 -3
  111. package/dist/preview/chunk.OHAO6KKH.js +1 -0
  112. package/dist/preview/{chunk.DSYP43NN.js → chunk.P2EKKKK2.js} +1 -1
  113. package/dist/preview/chunk.PSNMZBVS.js +1 -0
  114. package/dist/preview/{chunk.W53YNBSM.js → chunk.PZ7KY6XH.js} +1 -1
  115. package/dist/preview/{chunk.WSO7JOW5.js → chunk.QAM76AXV.js} +1 -1
  116. package/dist/preview/{chunk.PSQYDCVM.js → chunk.QF5QB5YR.js} +1 -1
  117. package/dist/preview/chunk.QNP5OR3P.js +93 -0
  118. package/dist/preview/{chunk.5LJVOLKR.js → chunk.QRQ5WPZI.js} +1 -1
  119. package/dist/preview/chunk.QWGWOEBZ.js +90 -0
  120. package/dist/preview/{chunk.OMT4QUZY.js → chunk.QXLJGHMC.js} +4 -4
  121. package/dist/preview/{chunk.J2MM6BUW.js → chunk.QZQCQWQG.js} +1 -1
  122. package/dist/preview/{chunk.6FQW6FNL.js → chunk.R6JBA7UK.js} +1 -1
  123. package/dist/preview/chunk.R7CRBRD4.js +1 -0
  124. package/dist/preview/chunk.RD2FSSLV.js +1 -0
  125. package/dist/preview/{chunk.OEIWIZCP.js → chunk.RG5G6YQD.js} +1 -1
  126. package/dist/preview/{chunk.PFQBCHQA.js → chunk.RJY7VJBH.js} +1 -1
  127. package/dist/preview/chunk.RR25BGWP.js +1 -0
  128. package/dist/preview/{chunk.BZ7QWHAE.js → chunk.RSQ432QN.js} +1 -1
  129. package/dist/preview/{chunk.MWGZKZD6.js → chunk.SFBHPYRD.js} +1 -1
  130. package/dist/preview/{chunk.FFOD5B4B.js → chunk.SJQPTDAT.js} +1 -1
  131. package/dist/preview/{chunk.OTV5XTBB.js → chunk.SNHKYH72.js} +1 -1
  132. package/dist/preview/{chunk.WSDJPXJD.js → chunk.SO6NT5K7.js} +1 -1
  133. package/dist/preview/{chunk.FDZE5LTJ.js → chunk.STPA7HBK.js} +2 -2
  134. package/dist/preview/{chunk.ONYBW45K.js → chunk.SY5ID44D.js} +1 -1
  135. package/dist/preview/chunk.T27QKVKP.js +1 -0
  136. package/dist/preview/{chunk.U6TEW6YD.js → chunk.T2OUHRAA.js} +1 -1
  137. package/dist/preview/chunk.T3WCRS6M.js +1 -0
  138. package/dist/preview/{chunk.QGIM2WAY.js → chunk.TI5FR2QQ.js} +1 -1
  139. package/dist/preview/{chunk.HOCD7KIR.js → chunk.TTSGCNPT.js} +1 -1
  140. package/dist/preview/{chunk.ES63XSIM.js → chunk.TXZQEJ5T.js} +1 -1
  141. package/dist/preview/{chunk.6LXIEM6B.js → chunk.UDHPMVC4.js} +1 -1
  142. package/dist/preview/{chunk.KBPJ7X7W.js → chunk.UGQYMN4J.js} +1 -1
  143. package/dist/preview/{chunk.M6ZN2KUO.js → chunk.UQIPEMJ5.js} +1 -1
  144. package/dist/preview/{chunk.FIFUMX5X.js → chunk.URQTF5SY.js} +1 -1
  145. package/dist/preview/{chunk.J7W2OFHY.js → chunk.UW52CMGJ.js} +1 -1
  146. package/dist/preview/{chunk.LINSO5PN.js → chunk.UWS4RMM3.js} +1 -1
  147. package/dist/preview/{chunk.QPF4KSAW.js → chunk.V7H4BUEB.js} +1 -1
  148. package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
  149. package/dist/preview/{chunk.U3ED7W2U.js → chunk.VBLQJVQ5.js} +1 -1
  150. package/dist/preview/{chunk.CVPMSPCH.js → chunk.WALVW3KJ.js} +1 -1
  151. package/dist/preview/{chunk.2KFZHUAC.js → chunk.WEMUKZKH.js} +1 -1
  152. package/dist/preview/{chunk.YIPXZUTT.js → chunk.X226YATK.js} +1 -1
  153. package/dist/preview/{chunk.GNEOSHQ6.js → chunk.XFLGSUYO.js} +1 -1
  154. package/dist/preview/{chunk.W4YDPHCQ.js → chunk.XSWSBTUO.js} +1 -1
  155. package/dist/preview/{chunk.OJY7VJ7D.js → chunk.YCD4JSXD.js} +1 -1
  156. package/dist/preview/{chunk.72ZCLEQC.js → chunk.YZPESGCP.js} +1 -1
  157. package/dist/preview/{chunk.XOE4KNP2.js → chunk.Z27NSSYL.js} +2 -2
  158. package/dist/preview/{chunk.DEHIR4EG.js → chunk.Z2XUVJAL.js} +1 -1
  159. package/dist/preview/{chunk.YXEO3Y65.js → chunk.Z3O2VZAJ.js} +1 -1
  160. package/dist/preview/{chunk.M2JCFNHJ.js → chunk.Z4TY44CD.js} +1 -1
  161. package/dist/preview/{chunk.EXYCN4WI.js → chunk.ZAPS4J6G.js} +1 -1
  162. package/dist/preview/{chunk.6TLXFMX2.js → chunk.ZAQ4IDX6.js} +1 -1
  163. package/dist/preview/{chunk.6HY6ZGEE.js → chunk.ZEZUKRC6.js} +1 -1
  164. package/dist/preview/{chunk.GEFXU4VO.js → chunk.ZG5VGP5U.js} +1 -1
  165. package/dist/preview/index.html +56 -56
  166. package/dist/preview/page.js +2 -2
  167. package/package.json +6 -6
  168. package/dist/preview/chunk.4WGYUYWU.js +0 -2
  169. package/dist/preview/chunk.5EMIWORS.js +0 -1
  170. package/dist/preview/chunk.6EVMXBNB.js +0 -1
  171. package/dist/preview/chunk.BCQWAFGD.js +0 -1
  172. package/dist/preview/chunk.BOCVLC7X.js +0 -1
  173. package/dist/preview/chunk.DPJNGFEZ.js +0 -4
  174. package/dist/preview/chunk.E4VRRWFP.js +0 -1
  175. package/dist/preview/chunk.EUAO4QNV.js +0 -1
  176. package/dist/preview/chunk.F7672TKJ.js +0 -1
  177. package/dist/preview/chunk.FA42HCPW.js +0 -1
  178. package/dist/preview/chunk.FBJAQPZ6.js +0 -1
  179. package/dist/preview/chunk.GAFMWOME.js +0 -1
  180. package/dist/preview/chunk.I4Z7HVRT.js +0 -1
  181. package/dist/preview/chunk.JMXXA4YG.js +0 -1
  182. package/dist/preview/chunk.JMYUQNXN.js +0 -6
  183. package/dist/preview/chunk.K6DFXDPZ.js +0 -1
  184. package/dist/preview/chunk.KF27ME27.js +0 -1
  185. package/dist/preview/chunk.L25DCT5S.js +0 -1
  186. package/dist/preview/chunk.MODLZJD4.js +0 -25
  187. package/dist/preview/chunk.OJGHDWI6.js +0 -1
  188. package/dist/preview/chunk.SSF47GUY.js +0 -1
  189. package/dist/preview/chunk.T6DPWW2K.js +0 -3
  190. package/dist/preview/chunk.TA36WBHK.js +0 -1
  191. package/dist/preview/chunk.TTGKX7LT.js +0 -1
  192. package/dist/preview/chunk.U3HERHAI.js +0 -88
  193. package/dist/preview/chunk.V5I4GZEY.js +0 -1
  194. package/dist/preview/chunk.VT2YGDK2.js +0 -1
  195. package/dist/preview/chunk.XK65Y2KX.js +0 -1
  196. package/dist/preview/chunk.Z274CL7J.js +0 -1
  197. package/dist/preview/chunk.ZBVYD4OX.js +0 -90
@@ -1,4 +1,4 @@
1
- import{c as Ry}from"./chunk.FBILPNGH.js";import{G as Cy}from"./chunk.MODLZJD4.js";import{a as an}from"./chunk.AJZBJBMO.js";var Ti=an(J=>{"use strict";function Gf(l,a){var t=l.length;l.push(a);l:for(;0<t;){var u=t-1>>>1,n=l[u];if(0<tn(n,a))l[u]=a,l[t]=n,t=u;else break l}}function Ll(l){return l.length===0?null:l[0]}function nn(l){if(l.length===0)return null;var a=l[0],t=l.pop();if(t!==a){l[0]=t;l:for(var u=0,n=l.length,f=n>>>1;u<f;){var e=2*(u+1)-1,c=l[e],i=e+1,m=l[i];if(0>tn(c,t))i<n&&0>tn(m,c)?(l[u]=m,l[i]=t,u=i):(l[u]=c,l[e]=t,u=e);else if(i<n&&0>tn(m,t))l[u]=m,l[i]=t,u=i;else break l}}return a}function tn(l,a){var t=l.sortIndex-a.sortIndex;return t!==0?t:l.id-a.id}J.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(yi=performance,J.unstable_now=function(){return yi.now()}):(Yf=Date,mi=Yf.now(),J.unstable_now=function(){return Yf.now()-mi});var yi,Yf,mi,Il=[],Aa=[],jy=1,Bl=null,ml=3,Zf=!1,au=!1,tu=!1,Cf=!1,Si=typeof setTimeout=="function"?setTimeout:null,gi=typeof clearTimeout=="function"?clearTimeout:null,hi=typeof setImmediate<"u"?setImmediate:null;function un(l){for(var a=Ll(Aa);a!==null;){if(a.callback===null)nn(Aa);else if(a.startTime<=l)nn(Aa),a.sortIndex=a.expirationTime,Gf(Il,a);else break;a=Ll(Aa)}}function Rf(l){if(tu=!1,un(l),!au)if(Ll(Il)!==null)au=!0,ht||(ht=!0,mt());else{var a=Ll(Aa);a!==null&&jf(Rf,a.startTime-l)}}var ht=!1,uu=-1,bi=5,zi=-1;function Ai(){return Cf?!0:!(J.unstable_now()-zi<bi)}function Qf(){if(Cf=!1,ht){var l=J.unstable_now();zi=l;var a=!0;try{l:{au=!1,tu&&(tu=!1,gi(uu),uu=-1),Zf=!0;var t=ml;try{a:{for(un(l),Bl=Ll(Il);Bl!==null&&!(Bl.expirationTime>l&&Ai());){var u=Bl.callback;if(typeof u=="function"){Bl.callback=null,ml=Bl.priorityLevel;var n=u(Bl.expirationTime<=l);if(l=J.unstable_now(),typeof n=="function"){Bl.callback=n,un(l),a=!0;break a}Bl===Ll(Il)&&nn(Il),un(l)}else nn(Il);Bl=Ll(Il)}if(Bl!==null)a=!0;else{var f=Ll(Aa);f!==null&&jf(Rf,f.startTime-l),a=!1}}break l}finally{Bl=null,ml=t,Zf=!1}a=void 0}}finally{a?mt():ht=!1}}}var mt;typeof hi=="function"?mt=function(){hi(Qf)}:typeof MessageChannel<"u"?(Xf=new MessageChannel,di=Xf.port2,Xf.port1.onmessage=Qf,mt=function(){di.postMessage(null)}):mt=function(){Si(Qf,0)};var Xf,di;function jf(l,a){uu=Si(function(){l(J.unstable_now())},a)}J.unstable_IdlePriority=5;J.unstable_ImmediatePriority=1;J.unstable_LowPriority=4;J.unstable_NormalPriority=3;J.unstable_Profiling=null;J.unstable_UserBlockingPriority=2;J.unstable_cancelCallback=function(l){l.callback=null};J.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bi=0<l?Math.floor(1e3/l):5};J.unstable_getCurrentPriorityLevel=function(){return ml};J.unstable_next=function(l){switch(ml){case 1:case 2:case 3:var a=3;break;default:a=ml}var t=ml;ml=a;try{return l()}finally{ml=t}};J.unstable_requestPaint=function(){Cf=!0};J.unstable_runWithPriority=function(l,a){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var t=ml;ml=l;try{return a()}finally{ml=t}};J.unstable_scheduleCallback=function(l,a,t){var u=J.unstable_now();switch(typeof t=="object"&&t!==null?(t=t.delay,t=typeof t=="number"&&0<t?u+t:u):t=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=t+n,l={id:jy++,callback:a,priorityLevel:l,startTime:t,expirationTime:n,sortIndex:-1},t>u?(l.sortIndex=t,Gf(Aa,l),Ll(Il)===null&&l===Ll(Aa)&&(tu?(gi(uu),uu=-1):tu=!0,jf(Rf,t-u))):(l.sortIndex=n,Gf(Il,l),au||Zf||(au=!0,ht||(ht=!0,mt()))),l};J.unstable_shouldYield=Ai;J.unstable_wrapCallback=function(l){var a=ml;return function(){var t=ml;ml=a;try{return l.apply(this,arguments)}finally{ml=t}}}});var Mi=an((dd,Ei)=>{"use strict";Ei.exports=Ti()});var Qy=an(qf=>{"use strict";var tl=Mi(),w0=Cy(),Vy=Ry();function A(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)a+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function F0(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ku(l){var a=l,t=l;if(l.alternate)for(;a.return;)a=a.return;else{l=a;do a=l,(a.flags&4098)!==0&&(t=a.return),l=a.return;while(l)}return a.tag===3?t:null}function $0(l){if(l.tag===13){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function k0(l){if(l.tag===31){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function Oi(l){if(Ku(l)!==l)throw Error(A(188))}function xy(l){var a=l.alternate;if(!a){if(a=Ku(l),a===null)throw Error(A(188));return a!==l?null:l}for(var t=l,u=a;;){var n=t.return;if(n===null)break;var f=n.alternate;if(f===null){if(u=n.return,u!==null){t=u;continue}break}if(n.child===f.child){for(f=n.child;f;){if(f===t)return Oi(n),l;if(f===u)return Oi(n),a;f=f.sibling}throw Error(A(188))}if(t.return!==u.return)t=n,u=f;else{for(var e=!1,c=n.child;c;){if(c===t){e=!0,t=n,u=f;break}if(c===u){e=!0,u=n,t=f;break}c=c.sibling}if(!e){for(c=f.child;c;){if(c===t){e=!0,t=f,u=n;break}if(c===u){e=!0,u=f,t=n;break}c=c.sibling}if(!e)throw Error(A(189))}}if(t.alternate!==u)throw Error(A(190))}if(t.tag!==3)throw Error(A(188));return t.stateNode.current===t?l:a}function I0(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l;for(l=l.child;l!==null;){if(a=I0(l),a!==null)return a;l=l.sibling}return null}var L=Object.assign,py=Symbol.for("react.element"),fn=Symbol.for("react.transitional.element"),mu=Symbol.for("react.portal"),At=Symbol.for("react.fragment"),r0=Symbol.for("react.strict_mode"),Te=Symbol.for("react.profiler"),P0=Symbol.for("react.consumer"),fa=Symbol.for("react.context"),Sc=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),gc=Symbol.for("react.memo"),Ta=Symbol.for("react.lazy");Symbol.for("react.scope");var Oe=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var Ky=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var Di=Symbol.iterator;function nu(l){return l===null||typeof l!="object"?null:(l=Di&&l[Di]||l["@@iterator"],typeof l=="function"?l:null)}var Ly=Symbol.for("react.client.reference");function De(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Ly?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case At:return"Fragment";case Te:return"Profiler";case r0:return"StrictMode";case Ee:return"Suspense";case Me:return"SuspenseList";case Oe:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case mu:return"Portal";case fa:return l.displayName||"Context";case P0:return(l._context.displayName||"Context")+".Consumer";case Sc:var a=l.render;return l=l.displayName,l||(l=a.displayName||a.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case gc:return a=l.displayName||null,a!==null?a:De(l.type)||"Memo";case Ta:a=l._payload,l=l._init;try{return De(l(a))}catch{}}return null}var hu=Array.isArray,D=w0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Vy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ka={pending:!1,data:null,method:null,action:null},Ue=[],Tt=-1;function $l(l){return{current:l}}function fl(l){0>Tt||(l.current=Ue[Tt],Ue[Tt]=null,Tt--)}function x(l,a){Tt++,Ue[Tt]=l.current,l.current=a}var Fl=$l(null),Nu=$l(null),Ba=$l(null),jn=$l(null);function Vn(l,a){switch(x(Ba,a),x(Nu,l),x(Fl,null),a.nodeType){case 9:case 11:l=(l=a.documentElement)&&(l=l.namespaceURI)?B0(l):0;break;default:if(l=a.tagName,a=a.namespaceURI)a=B0(a),l=Ty(a,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}fl(Fl),x(Fl,l)}function Ct(){fl(Fl),fl(Nu),fl(Ba)}function se(l){l.memoizedState!==null&&x(jn,l);var a=Fl.current,t=Ty(a,l.type);a!==t&&(x(Nu,l),x(Fl,t))}function xn(l){Nu.current===l&&(fl(Fl),fl(Nu)),jn.current===l&&(fl(jn),Vu._currentValue=ka)}var Vf,Ui;function Wa(l){if(Vf===void 0)try{throw Error()}catch(t){var a=t.stack.trim().match(/\n( *(at )?)/);Vf=a&&a[1]||"",Ui=-1<t.stack.indexOf(`
1
+ import{c as Ry}from"./chunk.4W57E7AX.js";import{G as Cy}from"./chunk.A5PSEU3W.js";import{a as an}from"./chunk.AJZBJBMO.js";var Ti=an(J=>{"use strict";function Gf(l,a){var t=l.length;l.push(a);l:for(;0<t;){var u=t-1>>>1,n=l[u];if(0<tn(n,a))l[u]=a,l[t]=n,t=u;else break l}}function Ll(l){return l.length===0?null:l[0]}function nn(l){if(l.length===0)return null;var a=l[0],t=l.pop();if(t!==a){l[0]=t;l:for(var u=0,n=l.length,f=n>>>1;u<f;){var e=2*(u+1)-1,c=l[e],i=e+1,m=l[i];if(0>tn(c,t))i<n&&0>tn(m,c)?(l[u]=m,l[i]=t,u=i):(l[u]=c,l[e]=t,u=e);else if(i<n&&0>tn(m,t))l[u]=m,l[i]=t,u=i;else break l}}return a}function tn(l,a){var t=l.sortIndex-a.sortIndex;return t!==0?t:l.id-a.id}J.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(yi=performance,J.unstable_now=function(){return yi.now()}):(Yf=Date,mi=Yf.now(),J.unstable_now=function(){return Yf.now()-mi});var yi,Yf,mi,Il=[],Aa=[],jy=1,Bl=null,ml=3,Zf=!1,au=!1,tu=!1,Cf=!1,Si=typeof setTimeout=="function"?setTimeout:null,gi=typeof clearTimeout=="function"?clearTimeout:null,hi=typeof setImmediate<"u"?setImmediate:null;function un(l){for(var a=Ll(Aa);a!==null;){if(a.callback===null)nn(Aa);else if(a.startTime<=l)nn(Aa),a.sortIndex=a.expirationTime,Gf(Il,a);else break;a=Ll(Aa)}}function Rf(l){if(tu=!1,un(l),!au)if(Ll(Il)!==null)au=!0,ht||(ht=!0,mt());else{var a=Ll(Aa);a!==null&&jf(Rf,a.startTime-l)}}var ht=!1,uu=-1,bi=5,zi=-1;function Ai(){return Cf?!0:!(J.unstable_now()-zi<bi)}function Qf(){if(Cf=!1,ht){var l=J.unstable_now();zi=l;var a=!0;try{l:{au=!1,tu&&(tu=!1,gi(uu),uu=-1),Zf=!0;var t=ml;try{a:{for(un(l),Bl=Ll(Il);Bl!==null&&!(Bl.expirationTime>l&&Ai());){var u=Bl.callback;if(typeof u=="function"){Bl.callback=null,ml=Bl.priorityLevel;var n=u(Bl.expirationTime<=l);if(l=J.unstable_now(),typeof n=="function"){Bl.callback=n,un(l),a=!0;break a}Bl===Ll(Il)&&nn(Il),un(l)}else nn(Il);Bl=Ll(Il)}if(Bl!==null)a=!0;else{var f=Ll(Aa);f!==null&&jf(Rf,f.startTime-l),a=!1}}break l}finally{Bl=null,ml=t,Zf=!1}a=void 0}}finally{a?mt():ht=!1}}}var mt;typeof hi=="function"?mt=function(){hi(Qf)}:typeof MessageChannel<"u"?(Xf=new MessageChannel,di=Xf.port2,Xf.port1.onmessage=Qf,mt=function(){di.postMessage(null)}):mt=function(){Si(Qf,0)};var Xf,di;function jf(l,a){uu=Si(function(){l(J.unstable_now())},a)}J.unstable_IdlePriority=5;J.unstable_ImmediatePriority=1;J.unstable_LowPriority=4;J.unstable_NormalPriority=3;J.unstable_Profiling=null;J.unstable_UserBlockingPriority=2;J.unstable_cancelCallback=function(l){l.callback=null};J.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bi=0<l?Math.floor(1e3/l):5};J.unstable_getCurrentPriorityLevel=function(){return ml};J.unstable_next=function(l){switch(ml){case 1:case 2:case 3:var a=3;break;default:a=ml}var t=ml;ml=a;try{return l()}finally{ml=t}};J.unstable_requestPaint=function(){Cf=!0};J.unstable_runWithPriority=function(l,a){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var t=ml;ml=l;try{return a()}finally{ml=t}};J.unstable_scheduleCallback=function(l,a,t){var u=J.unstable_now();switch(typeof t=="object"&&t!==null?(t=t.delay,t=typeof t=="number"&&0<t?u+t:u):t=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=t+n,l={id:jy++,callback:a,priorityLevel:l,startTime:t,expirationTime:n,sortIndex:-1},t>u?(l.sortIndex=t,Gf(Aa,l),Ll(Il)===null&&l===Ll(Aa)&&(tu?(gi(uu),uu=-1):tu=!0,jf(Rf,t-u))):(l.sortIndex=n,Gf(Il,l),au||Zf||(au=!0,ht||(ht=!0,mt()))),l};J.unstable_shouldYield=Ai;J.unstable_wrapCallback=function(l){var a=ml;return function(){var t=ml;ml=a;try{return l.apply(this,arguments)}finally{ml=t}}}});var Mi=an((dd,Ei)=>{"use strict";Ei.exports=Ti()});var Qy=an(qf=>{"use strict";var tl=Mi(),w0=Cy(),Vy=Ry();function A(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)a+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function F0(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ku(l){var a=l,t=l;if(l.alternate)for(;a.return;)a=a.return;else{l=a;do a=l,(a.flags&4098)!==0&&(t=a.return),l=a.return;while(l)}return a.tag===3?t:null}function $0(l){if(l.tag===13){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function k0(l){if(l.tag===31){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function Oi(l){if(Ku(l)!==l)throw Error(A(188))}function xy(l){var a=l.alternate;if(!a){if(a=Ku(l),a===null)throw Error(A(188));return a!==l?null:l}for(var t=l,u=a;;){var n=t.return;if(n===null)break;var f=n.alternate;if(f===null){if(u=n.return,u!==null){t=u;continue}break}if(n.child===f.child){for(f=n.child;f;){if(f===t)return Oi(n),l;if(f===u)return Oi(n),a;f=f.sibling}throw Error(A(188))}if(t.return!==u.return)t=n,u=f;else{for(var e=!1,c=n.child;c;){if(c===t){e=!0,t=n,u=f;break}if(c===u){e=!0,u=n,t=f;break}c=c.sibling}if(!e){for(c=f.child;c;){if(c===t){e=!0,t=f,u=n;break}if(c===u){e=!0,u=f,t=n;break}c=c.sibling}if(!e)throw Error(A(189))}}if(t.alternate!==u)throw Error(A(190))}if(t.tag!==3)throw Error(A(188));return t.stateNode.current===t?l:a}function I0(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l;for(l=l.child;l!==null;){if(a=I0(l),a!==null)return a;l=l.sibling}return null}var L=Object.assign,py=Symbol.for("react.element"),fn=Symbol.for("react.transitional.element"),mu=Symbol.for("react.portal"),At=Symbol.for("react.fragment"),r0=Symbol.for("react.strict_mode"),Te=Symbol.for("react.profiler"),P0=Symbol.for("react.consumer"),fa=Symbol.for("react.context"),Sc=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),gc=Symbol.for("react.memo"),Ta=Symbol.for("react.lazy");Symbol.for("react.scope");var Oe=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var Ky=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var Di=Symbol.iterator;function nu(l){return l===null||typeof l!="object"?null:(l=Di&&l[Di]||l["@@iterator"],typeof l=="function"?l:null)}var Ly=Symbol.for("react.client.reference");function De(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Ly?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case At:return"Fragment";case Te:return"Profiler";case r0:return"StrictMode";case Ee:return"Suspense";case Me:return"SuspenseList";case Oe:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case mu:return"Portal";case fa:return l.displayName||"Context";case P0:return(l._context.displayName||"Context")+".Consumer";case Sc:var a=l.render;return l=l.displayName,l||(l=a.displayName||a.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case gc:return a=l.displayName||null,a!==null?a:De(l.type)||"Memo";case Ta:a=l._payload,l=l._init;try{return De(l(a))}catch{}}return null}var hu=Array.isArray,D=w0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Vy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ka={pending:!1,data:null,method:null,action:null},Ue=[],Tt=-1;function $l(l){return{current:l}}function fl(l){0>Tt||(l.current=Ue[Tt],Ue[Tt]=null,Tt--)}function x(l,a){Tt++,Ue[Tt]=l.current,l.current=a}var Fl=$l(null),Nu=$l(null),Ba=$l(null),jn=$l(null);function Vn(l,a){switch(x(Ba,a),x(Nu,l),x(Fl,null),a.nodeType){case 9:case 11:l=(l=a.documentElement)&&(l=l.namespaceURI)?B0(l):0;break;default:if(l=a.tagName,a=a.namespaceURI)a=B0(a),l=Ty(a,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}fl(Fl),x(Fl,l)}function Ct(){fl(Fl),fl(Nu),fl(Ba)}function se(l){l.memoizedState!==null&&x(jn,l);var a=Fl.current,t=Ty(a,l.type);a!==t&&(x(Nu,l),x(Fl,t))}function xn(l){Nu.current===l&&(fl(Fl),fl(Nu)),jn.current===l&&(fl(jn),Vu._currentValue=ka)}var Vf,Ui;function Wa(l){if(Vf===void 0)try{throw Error()}catch(t){var a=t.stack.trim().match(/\n( *(at )?)/);Vf=a&&a[1]||"",Ui=-1<t.stack.indexOf(`
2
2
  at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
3
3
  `+Vf+l+Ui}var xf=!1;function pf(l,a){if(!l||xf)return"";xf=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var z=function(){throw Error()};if(Object.defineProperty(z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(z,[])}catch(S){var d=S}Reflect.construct(l,[],z)}else{try{z.call()}catch(S){d=S}l.call(z.prototype)}}else{try{throw Error()}catch(S){d=S}(z=l())&&typeof z.catch=="function"&&z.catch(function(){})}}catch(S){if(S&&d&&typeof S.stack=="string")return[S.stack,d.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=u.DetermineComponentFrameRoot(),e=f[0],c=f[1];if(e&&c){var i=e.split(`
4
4
  `),m=c.split(`
@@ -1,3 +1,3 @@
1
- import{P as b,Z as g,cc as x,ga as h,gc as k,ha as $}from"./chunk.6HY6ZGEE.js";function z(t,n,e){let r=t?.display?.format?.[n];return r?r(e):typeof e=="string"?$(e):String(e)}function B(t,n,e,r){let s=t.tryDefinition(n)?.edges,i=s&&Object.hasOwn(s,e)?s[e]:void 0;return(r==="out"?i?.description:i?.inverse)??h(e).toLowerCase()}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,m=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,O=/^ {0,3}(?:`{3,}|~{3,})/,S=/^ {0,3}(?:>[ \t]?)+/,F=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,T={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function _(t){return t.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(n,e)=>T[e]??"")}function N(t,n,e){let r=t.replace(/\r\n?/g,`
1
+ import{P as b,Z as g,cc as x,ga as h,gc as k,ha as $}from"./chunk.ZEZUKRC6.js";function z(t,n,e){let r=t?.display?.format?.[n];return r?r(e):typeof e=="string"?$(e):String(e)}function B(t,n,e,r){let s=t.tryDefinition(n)?.edges,i=s&&Object.hasOwn(s,e)?s[e]:void 0;return(r==="out"?i?.description:i?.inverse)??h(e).toLowerCase()}var w=/^ {0,3}#{1,6}(?:[ \t]+|$)/,m=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,O=/^ {0,3}(?:`{3,}|~{3,})/,S=/^ {0,3}(?:>[ \t]?)+/,F=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,T={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function _(t){return t.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(n,e)=>T[e]??"")}function N(t,n,e){let r=t.replace(/\r\n?/g,`
2
2
  `).split(`
3
3
  `),s=[],i=[],u=0,d=!1,a=()=>{let o=i.join(" ").replace(/\s+/g," ").trim();o&&(s.push(o),u+=o.length),i=[]},c=0;for(;c<r.length&&u<=e;){let o=r[c++];if(n&&O.test(o)){d=!d,d||a();continue}if(!d&&(o.trim().length===0||n&&(R.test(o)||F.test(o.trim())))){a();continue}let f=!d&&n&&w.test(o),l=!d&&m.test(o);if((f||l)&&a(),n&&!d?(o=o.replace(S,""),f&&(o=o.replace(w,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(o=o.replace(m,"")),o.includes("|")&&(o=o.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),o=_(Number.isFinite(e)?o.slice(0,e*2+200):o)):l&&(o=o.replace(m,"")),i.push(o),f&&a(),i.reduce((p,A)=>p+A.length,0)>e)break}return a(),{blocks:s,more:r.slice(c).some(o=>o.trim().length>0&&!(n&&(O.test(o)||R.test(o))))}}function E(t,n){return`${(t.slice(0,n+1).replace(/\s+\S*$/,"")||t.slice(0,n)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function Q(t,n={}){let e=n.most??160,{blocks:r,more:s}=N(t,n.markdown===!0,e),i=r[0]??"";if(i.length<=e)return(s||r.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let u=k(i);return u&&u.length<=e?u:E(i,e)}var X=t=>N(t,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var j={d:1440,h:60,m:1};function K(t){if(typeof t=="number")return Number.isFinite(t)&&t>=0?Math.round(t):void 0;if(typeof t!="string")return;let n=t.trim().toLowerCase();if(/^\d+$/.test(n))return Number(n);let e=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(n);if(e)return Number(e[1])*60+Number(e[2])+Math.round(Number(e[3]??0)/60);let r=0,s=!1,i=n.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(u,d,a)=>(s=!0,r+=Number(d.replace(",","."))*j[a[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(r):void 0}function I(t,n){if(!Number.isFinite(t))return String(t);let e=Math.round(Math.abs(t)),r=Math.floor(e/60),s=e%60,i=[r?`${g(r,n)} h`:"",s||!r?`${g(s,n)} min`:""].filter(Boolean).join(" ");return t<0?`\u2212${i}`:i}var M=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function W(t,n){let e=t.trim(),r=/[-_](US|CA)\b/i.test(b(n))?M.exec(e):null;if(!r)return e;let[,s,i,u,d,a]=r;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${u}-${d}${a?` ext. ${a}`:""}`}function D(t){let[,n="",e]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(t.trim())??[],r=n.replace(/\D/g,"");return r.length<3?void 0:`tel:${n.startsWith("+")?"+":""}${r}${e?`;ext=${e}`:""}`}var P=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function L(t,n=P()){let e=encodeURIComponent(t.trim());return n?`https://maps.apple.com/?q=${e}`:`https://www.google.com/maps/search/?api=1&query=${e}`}var q=t=>t?.fields?.shape??{},C=(t,n)=>{let e=q(t);return Object.hasOwn(e,n)?x(e[n]):void 0},y=(t,n)=>{let e=t?.computed,r=e&&Object.hasOwn(e,n)?e[n]:void 0;return typeof r=="object"?r:void 0},H=(t,n)=>{let e=y(t,n);return e?.as??(e?.format==="duration"?"duration":void 0)};function v(t,n){let e=y(t,n);if(!e)return;if(e.amount)return e.amount;let r=e.format==="money"||e.format==="percent"?e.format:void 0;return r||!e.format&&e.unit?{...r?{format:r}:{},...e.unit?{unit:e.unit}:{}}:void 0}function ee(t,n){return y(t,n)?.hidden===!0}function ne(t,n){return C(t,n)??(t&&H(t,n)==="duration"?"duration":void 0)}function te(t,n,e){return t==="duration"?typeof n=="number"?I(n,e):void 0:t==="phone"?typeof n=="string"?W(n,e):void 0:t==="place"&&typeof n=="string"?n.trim():void 0}function re(t,n){if(!(typeof n!="string"||!n.trim()))return t==="phone"?D(n):t==="place"?L(n):void 0}export{z as a,B as b,Q as c,X as d,K as e,v as f,ee as g,ne as h,te as i,re as j};
@@ -1 +1 @@
1
- import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as R,Va as g,W as y,Xa as h}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{lb as b,td as m}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
1
+ import{a as v,b as w,c as x}from"./chunk.MB7LKKUD.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as R,Va as g,W as y,Xa as h}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{lb as b,td as m}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as p}from"./chunk.AJZBJBMO.js";var c=p(R(),1);var r=p(y(),1);function W({notices:e,anchor:n,board:a,report:i}){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="banner"),at:"top",anchor:n,board:a,report:i}),(0,r.jsx)(k,{notices:e.filter(s=>s.kind==="toast"),at:"foot",anchor:n,board:a,report:i})]})}var E={info:"var(--graview-accent)",good:"var(--graview-good)",warn:"var(--graview-warn)",bad:"var(--graview-bad)"},C={info:"i",good:"\u2713",warn:"!",bad:"!"};function k({notices:e,at:n,anchor:a,board:i,report:s}){let l=(0,c.useRef)(null),t=e.length>0;return(0,c.useLayoutEffect)(()=>{let o=l.current;if(!t||!o)return;if(typeof o.showPopover=="function"&&!g(o))try{o.showPopover()}catch{}let d=()=>(n==="top"?x:w)(o,a());d(),n==="foot"&&i.hold?.(()=>o.matches(":hover")||o.contains(document.activeElement));let N=h(o);addEventListener("resize",d),addEventListener("scroll",d,!0),n==="foot"&&addEventListener(v,d);let u=typeof ResizeObserver=="function"?new ResizeObserver(d):null;return u?.observe(o),()=>{if(N(),u?.disconnect(),removeEventListener("resize",d),removeEventListener("scroll",d,!0),removeEventListener(v,d),o.isConnected&&g(o))try{o.hidePopover()}catch{}}},[t,n,a,i]),t?(0,r.jsx)("div",{ref:l,popover:"manual",role:"region","aria-label":n==="top"?"Notices":"Messages","data-testid":n==="top"?"notices-banners":"notices-toasts","data-graview-offstage":"",style:{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:m("toast"),width:"max-content",height:"auto",maxWidth:"min(560px, calc(100vw - 32px))",display:"grid",gap:8,color:"var(--graview-ink)"},children:e.map(o=>(0,r.jsx)(O,{notice:o,board:i,report:s},o.id))}):null}var T=e=>e.split(/\s+/).filter(Boolean).map(n=>n.replace(/^Meta\+/,"\u2318").replace(/^Control\+/,"Ctrl+").replace(/^Alt\+/,"Alt+")).join(" or "),H=e=>/^.*?[.!?](?=\s|$)/.exec(e.trim())?.[0]??e.trim(),L=e=>e.from==="framework"&&(e.tone==="bad"||e.tone==="warn");function O({notice:e,board:n,report:a}){let i=e.tone??"info",s=[...e.action?[e.action]:[],...e.actions??[]],l=()=>n.dismiss(e.id);return(0,r.jsxs)("div",{"data-testid":"notice","data-kind":e.kind,"data-tone":i,style:{boxSizing:"border-box",display:"flex",flexWrap:"wrap",alignItems:"center",gap:"8px 12px",padding:e.kind==="banner"?"8px 10px 8px 12px":"10px 12px 10px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,r.jsx)("span",{"aria-hidden":"true","data-testid":"notice-chip",style:{width:20,height:20,borderRadius:"var(--graview-radius-sm, 6px)",flex:"0 0 auto",display:"inline-grid",placeItems:"center",fontSize:"0.75rem",fontWeight:700,lineHeight:1,color:"var(--graview-ink)",background:`color-mix(in srgb, ${E[i]} 22%, transparent)`},children:C[i]}),(0,r.jsx)("span",{"data-testid":"notice-sentence",style:{flex:"1 1 16rem",minWidth:0},children:e.sentence}),s.length>0?(0,r.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.map((t,o)=>t.href!==void 0?(0,r.jsx)("a",{href:t.href,...t.target?{target:t.target,rel:"noopener"}:{},"data-testid":"notice-action",onClick:()=>{t.onSelect?.(),l()},style:{...f,...o===0?S:{}},children:t.label},t.label):(0,r.jsx)("button",{type:"button","data-testid":"notice-action",...t.keys?{"aria-keyshortcuts":t.keys,title:`${t.label} \u2014 ${T(t.keys)}`}:{},onClick:()=>{l(),t.onSelect?.()},style:{...f,...o===0?S:{}},children:t.label},t.label))}):null,a&&L(e)?(0,r.jsx)("button",{type:"button","data-testid":"notice-report","aria-label":`Report this: ${H(e.sentence)}`,onClick:()=>a.tell({message:e.sentence,...e.code?{code:e.code}:{},...a.where(),version:b}),style:f,children:"Report this"}):null,(0,r.jsx)("button",{type:"button","data-testid":"notice-dismiss","aria-label":`Dismiss: ${e.sentence}`,title:"Dismiss",onClick:l,style:z,children:"\xD7"})]})}var f={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 12px",borderRadius:9,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",font:"inherit",fontWeight:500,textDecoration:"none",cursor:"pointer"},S={background:"var(--graview-accent)",borderColor:"var(--graview-accent)",color:"var(--graview-accent-ink)"},z={minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",fontSize:"1rem",cursor:"pointer"};export{W as NoticeStacks,H as firstSentenceOf,L as reportable};
@@ -1 +1 @@
1
- import{d as H,e as R,f as k}from"./chunk.MWGZKZD6.js";import{b as L}from"./chunk.QFHWG4LN.js";import{b as C}from"./chunk.YIPXZUTT.js";import"./chunk.BJUUSIQY.js";import"./chunk.EMFOMSMI.js";import{a as S}from"./chunk.PSQYDCVM.js";import"./chunk.QOS5T46W.js";import"./chunk.PPSYUOH7.js";import"./chunk.XOZU4OFA.js";import"./chunk.GME63ZHI.js";import"./chunk.NJRLJEJY.js";import"./chunk.WSDJPXJD.js";import"./chunk.F4VB6Q2W.js";import"./chunk.FFOD5B4B.js";import"./chunk.Z7Y3R3YR.js";import"./chunk.YXEO3Y65.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as T,Va as E,W as b}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{td as x}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function V({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{V as HoverChip};
1
+ import{d as H,e as R,f as k}from"./chunk.SFBHPYRD.js";import{b as L}from"./chunk.ILJDLBPJ.js";import{b as C}from"./chunk.X226YATK.js";import"./chunk.BJUUSIQY.js";import"./chunk.MSAYU25L.js";import{a as S}from"./chunk.QF5QB5YR.js";import"./chunk.EGPCVMDU.js";import"./chunk.M7KXQGQL.js";import"./chunk.XOZU4OFA.js";import"./chunk.H3EGBDW2.js";import"./chunk.6KJGRM7A.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as T,Va as E,W as b}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{td as x}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function V({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{V as HoverChip};
@@ -1 +1 @@
1
- import{sd as d}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m="data-graview-refused-note",u=`position:absolute;z-index:${d.over};box-sizing:border-box;margin:0;padding:4px 8px;max-width:min(40ch,calc(100% - 8px));border-radius:6px;font:inherit;font-size:0.8125rem;line-height:1.35;color:var(--graview-ink,CanvasText);background:var(--graview-panel,Canvas);border:1px solid var(--graview-danger,#b42318);box-shadow:0 2px 8px rgb(0 0 0 / 0.12);pointer-events:none;overflow-wrap:anywhere`;function v(s){let n=new Map,p=0,a=(t,o)=>{let e=s.host.getBoundingClientRect(),r=t.getBoundingClientRect(),f=o.offsetWidth,i=o.offsetHeight,g=Math.max(4,Math.min(r.left-e.left,e.width-f-4)),c=r.bottom-e.top+4,h=c+i<=e.height||r.top-e.top-i-4<0?c:r.top-e.top-i-4;o.style.left=`${Math.round(g)}px`,o.style.top=`${Math.round(h)}px`},l={say(t,o){l.clear(t);let e=s.ownerDocument.createElement("p");e.setAttribute(m,""),e.setAttribute("role","status"),e.id=`graview-refused-${p+=1}`,e.setAttribute("style",u),e.textContent=o,s.appendChild(e),n.set(t,e),a(t,e)},clear(t){let o=n.get(t);o&&(o.remove(),n.delete(t))},refresh(){for(let[t,o]of n)t.isConnected?a(t,o):(o.remove(),n.delete(t))}};return l}export{v as createRefusalNotes};
1
+ import{sd as d}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m="data-graview-refused-note",u=`position:absolute;z-index:${d.over};box-sizing:border-box;margin:0;padding:4px 8px;max-width:min(40ch,calc(100% - 8px));border-radius:6px;font:inherit;font-size:0.8125rem;line-height:1.35;color:var(--graview-ink,CanvasText);background:var(--graview-panel,Canvas);border:1px solid var(--graview-danger,#b42318);box-shadow:0 2px 8px rgb(0 0 0 / 0.12);pointer-events:none;overflow-wrap:anywhere`;function v(s){let n=new Map,p=0,a=(t,o)=>{let e=s.host.getBoundingClientRect(),r=t.getBoundingClientRect(),f=o.offsetWidth,i=o.offsetHeight,g=Math.max(4,Math.min(r.left-e.left,e.width-f-4)),c=r.bottom-e.top+4,h=c+i<=e.height||r.top-e.top-i-4<0?c:r.top-e.top-i-4;o.style.left=`${Math.round(g)}px`,o.style.top=`${Math.round(h)}px`},l={say(t,o){l.clear(t);let e=s.ownerDocument.createElement("p");e.setAttribute(m,""),e.setAttribute("role","status"),e.id=`graview-refused-${p+=1}`,e.setAttribute("style",u),e.textContent=o,s.appendChild(e),n.set(t,e),a(t,e)},clear(t){let o=n.get(t);o&&(o.remove(),n.delete(t))},refresh(){for(let[t,o]of n)t.isConnected?a(t,o):(o.remove(),n.delete(t))}};return l}export{v as createRefusalNotes};
@@ -0,0 +1 @@
1
+ import{d as b,e as c,f as d,g as e,h as f,i as g,j as h}from"./chunk.HB5NWHFP.js";import"./chunk.OCXY5DCD.js";import{s as a}from"./chunk.B5SJMCTT.js";import"./chunk.NYLKG25K.js";import"./chunk.TBY5IR7C.js";import"./chunk.ILJDLBPJ.js";import"./chunk.X226YATK.js";import"./chunk.BJUUSIQY.js";import"./chunk.M7KXQGQL.js";import"./chunk.XOZU4OFA.js";import"./chunk.H3EGBDW2.js";import"./chunk.6KJGRM7A.js";import"./chunk.MIE4TJRW.js";import"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as Highlighter,h as LOOK,f as SectionCard,b as SectionDrawn,a as SectionOutline,e as drawingFindings,c as placeBeside,d as readPart};
@@ -1,2 +1,2 @@
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 Ve,b as Qt}from"./chunk.KHRS2SKB.js";import"./chunk.T6PU3NKP.js";import"./chunk.U3ED7W2U.js";import"./chunk.OPTYYIGC.js";import{j as Bt,k as Ut,l as Gt}from"./chunk.DPJNGFEZ.js";import"./chunk.YNEHJWJV.js";import"./chunk.2VR7YEJ6.js";import"./chunk.LETAQTLJ.js";import"./chunk.BUVTUAB5.js";import"./chunk.HJCQ6I3S.js";import"./chunk.OJY7VJ7D.js";import"./chunk.GEFXU4VO.js";import"./chunk.TXHYGFIZ.js";import{a as Kt,b as O}from"./chunk.WAB3L3ZI.js";import{a as Ye,b as qt}from"./chunk.W53YNBSM.js";import"./chunk.2KFZHUAC.js";import"./chunk.V5I4GZEY.js";import"./chunk.TBY5IR7C.js";import"./chunk.FIFUMX5X.js";import"./chunk.BIDL7GQD.js";import"./chunk.V7W5AQKL.js";import"./chunk.EMFOMSMI.js";import{b as Nt,c as Wt}from"./chunk.QOS5T46W.js";import"./chunk.PPSYUOH7.js";import"./chunk.XOZU4OFA.js";import"./chunk.GME63ZHI.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.4FCFNAA4.js";import"./chunk.4AC2QM7T.js";import"./chunk.YFVJUHAK.js";import"./chunk.JXNVNFV4.js";import"./chunk.I2737CPF.js";import"./chunk.NJRLJEJY.js";import"./chunk.CVPMSPCH.js";import"./chunk.OTV5XTBB.js";import"./chunk.KBPJ7X7W.js";import"./chunk.OEIWIZCP.js";import{v as jt}from"./chunk.5LJVOLKR.js";import"./chunk.OJGHDWI6.js";import"./chunk.OWFS2YDQ.js";import"./chunk.WSDJPXJD.js";import"./chunk.F4VB6Q2W.js";import{l as Ft}from"./chunk.FFOD5B4B.js";import{b as _t}from"./chunk.Z7Y3R3YR.js";import"./chunk.YXEO3Y65.js";import{a as Be,c as Ue,e as Ge,f as zt,m as Qe}from"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as Se,Pa as Ke,Ua as Dt,W as Ot,Ya as Pt,ea as xe,h as Lt,u as It}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{Lc as Rt,Nc as $t,Pb as Et,nd as Ht,pa as At,ta as ve,td as Ct,ua as ke}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as ee}from"./chunk.AJZBJBMO.js";var s=ee(Se(),1);function Yt(a){return a.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(Boolean)}function Vt(a,r){let n=Yt(r);if(n.length===0)return!0;let l=Yt(a);return n.every(b=>l.some(m=>m.startsWith(b)))}var te=ee(Se(),1),Je=250,Xe=.2,Ln=a=>a===void 0||a.off?void 0:a.fast??(a.decide?{model:a.name??"decide",decide:a.decide}:void 0);function Jt(a,r,n){let[l,b]=(0,te.useState)(null),m=(0,te.useRef)(n);m.current=n;let y=n.map(c=>`${c.key}\0${c.label}`).join(""),u=Ln(a);return(0,te.useEffect)(()=>{let c=r.trim();if(!u||c===""||m.current.length===0)return;let g=!0,x=new Map(m.current.map((w,f)=>[`r${f+1}`,w])),v=setTimeout(()=>{u.decide({typed:c},{row:{type:"choice",instructions:`Which of these menu rows does somebody typing \u201C${c}\u201D mean?`,criteria:{...Object.fromEntries([...x].map(([w,f])=>[w,f.label])),none:"None of these rows"}}}).then(w=>{a?.meter?.({tier:"fast",model:u.model,inputTokens:w.usage.inputTokens,outputTokens:w.usage.outputTokens,interaction:"menu"});let f=w.answers.row;if(!g||f?.type!=="choice")return;let k=new Map;for(let[G,ne]of Object.entries(f.probabilities)){let B=x.get(G);B&&k.set(B.key,ne)}if(f.choice==="none")return b({words:c,chances:new Map});let S=x.get(f.choice);S&&!k.has(S.key)&&k.set(S.key,f.confidence),b({words:c,chances:k})}).catch(()=>{})},Je);return()=>{g=!1,clearTimeout(v)}},[r,y,u===void 0]),l!==null&&l.words===r.trim()?l.chances:null}var z=ee(Se(),1),Zt=2,Xt,In=()=>Xt??=(__graviewPreload(import.meta.url,["./chunk.YIPXZUTT.js","./chunk.BJUUSIQY.js","./chunk.NJRLJEJY.js","./chunk.YXEO3Y65.js","./chunk.U3HERHAI.js","./chunk.FBILPNGH.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5BX66FBP.js")).catch(a=>(Xt=void 0,Promise.reject(a)));function en(a,r,n,l,b,m,y=4){let u=a&&!a.off?a.told:void 0,c=l.trim()!=="",[g,x]=(0,z.useState)(null);(0,z.useEffect)(()=>x(null),[m]);let[v,w]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{if(!u||m===null||m===void 0)return;let f=globalThis;if(!f.requestIdleCallback)return;let k=f.requestIdleCallback(()=>w(!0),{timeout:3e3});return()=>f.cancelIdleCallback?.(k)},[u,m]),(0,z.useEffect)(()=>{if(!u||g||!(c||v))return;let f=!0;return In().then(async k=>{let S=await k.readToldHere(u,r,n);f&&x({tellings:S,module:k})}).catch(()=>{}),()=>{f=!1}},[u,c,v,g,r,n]),(0,z.useMemo)(()=>g?c?g.module.toldSuggestionsFrom(g.tellings,r,n,l,b,y):g.module.toldForHere(g.tellings,r,n,b,3):[],[g,c,l,r,n,b,y])}var K=ee(Se(),1),tn=a=>a.replace(/\s*…\s*$/u,"").replace(/\s+/g," ").trim().toLowerCase();function on(a,r,n={},l){if(!r)return[];let b=[],m=[];for(let y of a){if(y.destructive||y.setsAside||y.ties)continue;let u=y.open.filter(f=>!f.optional);if(u.length===0&&y.open.length===0&&l){let f=y.label.replace(/\b(it|this one|this)\b/u,`\u201C${l}\u201D`);m.push({key:`act:${y.id}`,label:f!==y.label?f:`${y.label} \u201C${l}\u201D`,mode:"chat",source:"act"});continue}let c=u[0];if(u.length!==1||c?.shape?.type!=="choice"||!c.shape.options||c.shape.options.length<2)continue;let g=c.shape.options,x=g.indexOf(String(r[c.name]??"")),v=x>=0?g[x+1]:void 0;if(v===void 0)continue;let w=n[c.name]?.[v]??v.replace(/[-_]+/g," ").replace(/^./u,f=>f.toUpperCase());b.push({key:`act:${y.id}:${v}`,label:`${y.label.replace(/\s*…\s*$/u,"")} to ${w}`,mode:"chat",source:"act"})}return[...b,...m]}function rn(a,r){let n=new Set(r.map(tn));return a.filter(l=>!n.has(tn(l.label)))}var On=3,Dn=a=>a===void 0||a.off||a.suggestOnOpen===!1?void 0:a.fast??(a.decide?{model:a.name??"decide",decide:a.decide}:void 0),Ze=new WeakMap,nn=(a,r)=>a?Ze.get(a)?.get(r):void 0;function Pn(a){let r=u=>a.filter(c=>c.source===u),[n,l,b]=[r("nudge"),r("told"),r("act")],m=[],y=Math.max(n.length,l.length,b.length);for(let u=0;u<y;u++)for(let c of[n,l,b])c[u]&&m.push(c[u]);return m}function an(a,r,n,l){let b=Dn(a),m=r.map(v=>`${v.key}\0${v.label}`).join(""),[y,u]=(0,K.useState)(null),c=nn(n.depends,m)??y;(0,K.useEffect)(()=>{if(nn(n.depends,m)||(u(null),!b||r.length===0||n.opened===null||n.opened===void 0))return;let v=!0,w=new Map(r.map((k,S)=>[`s${S+1}`,k])),f={pick:{type:"choice",instructions:`Somebody right-clicked \u201C${n.name}\u201D in an app. Which of these would they most likely want to do next?`,criteria:Object.fromEntries([...w].map(([k,S])=>[k,S.label]))}};if(n.better)for(let[k,S]of w)f[`about_${k}`]={type:"choice",instructions:`Is \u201C${S.label}\u201D about how \u201C${n.name}\u201D looks or is laid out, or about the records in it?`,criteria:{look:"How it looks or is laid out: style, size, what each row or card shows, its order or grouping",records:"The records themselves: changing, finishing, adding, assigning or asking about them"}};return b.decide({on:n.name},f).then(k=>{if(a?.meter?.({tier:"fast",model:b.model,inputTokens:k.usage.inputTokens,outputTokens:k.usage.outputTokens,interaction:"menu"}),!v)return;let S=k.answers.pick,G=R=>S?.type==="choice"?S.probabilities[R]??(S.choice===R?S.confidence:0):0,ne=[...w.keys()].sort((R,oe)=>G(oe)-G(R)).map(R=>w.get(R).key),B=new Map;for(let[R,oe]of w){let Q=k.answers[`about_${R}`];Q?.type==="choice"&&B.set(oe.key,Q.choice==="look"?"better":"chat")}let p={said:m,order:ne,modes:B};if(n.depends){let R=Ze.get(n.depends)??new Map;R.set(m,p),Ze.set(n.depends,R)}u(p)}).catch(()=>{}),()=>{v=!1}},[m,n.opened,n.depends,b===void 0]);let g=(0,K.useMemo)(()=>(c&&c.said===m?c.order.map(w=>r.find(f=>f.key===w)).filter(Boolean):Pn(r)).slice(0,On).map(w=>({...w,mode:c?.modes.get(w.key)??w.mode})),[c,m,r]),x=(0,K.useRef)(g);return l||(x.current=g),l?x.current:g}var i=ee(Ot(),1);function po(a,r,n){let l=r.on??r.about[r.about.length-1];Bt(a,r.about,{...n,pins:Ve(),...l===void 0?{}:{focus:l}})}function ho({placement:a="float",chosen:r=!0}={}){let{menuAt:n}=xe();return a==="menu"&&n===null?r?(0,i.jsx)(zn,{}):null:(0,i.jsx)(Wn,{placement:a})}function zn(){let{store:a,setMenuAt:r,view:n}=xe(),{selection:l}=Ke(),b=(0,s.useRef)(null),[m,y]=(0,s.useState)(null),[u,c]=(0,s.useState)(null);(0,s.useLayoutEffect)(()=>{let x=b.current?.offsetParent??b.current?.parentElement;if(!x)return;let v=x.getBoundingClientRect(),w=Math.round(v.width);w!==m&&y(w);let f=[...x.querySelectorAll('[data-testid="lines-key"][data-graview-up-row], [data-testid="overview"]')].map(S=>S.getBoundingClientRect()).filter(S=>S.width>0&&S.top-v.top<40),k=f.length>0?Math.round(v.right-Math.min(...f.map(S=>S.left))+8):null;k!==u&&c(k)});let g=l.length===1&&!n.overview?a.graph.getNode(l[0]):void 0;return!g||m===null||m>=dn?(0,i.jsx)("span",{ref:b,hidden:!0}):(0,i.jsx)("button",{type:"button",ref:b,"data-testid":"chosen-acts","aria-label":`What can be done with ${O(a,g.id)}`,"aria-haspopup":"menu",onClick:x=>{let v=x.currentTarget.getBoundingClientRect();r({x:Math.round(v.right),y:Math.round(v.bottom+4),on:g.id})},style:{position:"absolute",...u!==null?{right:u,top:14,minHeight:38}:{right:"calc(14px + var(--graview-dock, 0px))",top:98},zIndex:"var(--graview-layer-overview, 10)",...u===null?{minHeight:30}:{},padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}function Nn(a,r,n){let l=u=>ke(a.schema.tryDefinition(u),u),b=u=>At(a.schema,u).toLowerCase(),m=r.filter(u=>a.allMutations().some(c=>{let g=c.subject;return g?.kinds==="*"||(g?.kinds??[]).includes(u)})),y=n.length!==1||n.some(u=>u.startsWith("aggregate:"));return m.length>0&&y?r.length===1?`Nothing here is done to all the ${b(r[0])} at once. Right-click one ${l(r[0])} to see what you can do with it.`:"Nothing here is done to all of these at once. Right-click one of them to see what you can do with it.":m.length>0?`There is nothing you can do with ${r.length===1?ve(l(r[0])):"these"} here right now.`:r.length===1?`There is nothing to do with ${ve(l(r[0]))} in this app yet.`:"There is nothing to do with these in this app yet."}var dn=564;function Wn({placement:a}){let{store:r,menuAt:n,setMenuAt:l,view:b,signIn:m,aiDesk:y,ai:u,principal:c}=xe(),g=(0,s.useRef)(null),x=(0,s.useRef)(null),v=(0,s.useRef)(null),w=(0,s.useRef)(null);n?.returnTo&&(w.current=n.returnTo);let f=e=>{let t=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),o=e.getAttribute("data-pin-for"),d=t??e.getAttribute("data-affordance")??(o===null?null:`pin:${o}`)??e.getAttribute("data-menu-item");x.current=d===null?null:{key:d,element:e}};(0,s.useEffect)(()=>{let e=g.current,t=x.current;if(t===null||document.activeElement!==document.body||t.element.isConnected)return;let o=t.key;if(!e){x.current=null;let M=w.current;w.current=null,(M?.isConnected?M:v.current)?.focus();return}((o.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(o.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(o)}"]:not([disabled])`)??e).focus()});let[k,S]=(0,s.useState)(null);(0,s.useLayoutEffect)(()=>{let e=g.current?.offsetParent??g.current?.parentElement;if(e instanceof HTMLElement&&(v.current=e),!e)return;let t=e.getBoundingClientRect();S(o=>o&&o.left===t.left&&o.top===t.top&&o.width===t.width&&o.height===t.height?o:{left:t.left,top:t.top,width:t.width,height:t.height})});let{selection:G,set:ne,clear:B}=Ke(),p=n?.about??G,[R,oe]=(0,s.useState)(()=>Ve()),Q=n?.on??p[p.length-1],Ae=n?.about,cn=(0,s.useMemo)(()=>({pins:R,...Q===void 0?{}:{focus:Q},...Ae?{about:Ae}:{}}),[R,Q,Ae]),gn=(0,s.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:T,withheld:de,observations:Ee}=Ut(cn),re=$t(de,m),D=re?Un:de,pn=n===null?null:{face:n.face??"scene",on:n.on,about:p,field:n.field,place:n.place,href:n.href,act:n.act,column:n.column,...n.section?{section:n.section}:{},...n.page?{page:n.page}:{},element:n.returnTo},P=jt(pn),tt=Ee.some(e=>e.id.startsWith("schema:waits:")),{apply:hn,preview:mn}=Gt(),[ie,Y]=(0,s.useState)(null),[Re,fn]=(0,s.useState)(null),[nt,$e]=(0,s.useState)(!1),[ot,rt]=(0,s.useState)(!1),[ue,ce]=(0,s.useState)(""),yn=qt({letters:n===null}),[H,ge]=(0,s.useState)(""),it=(0,s.useRef)(null);(0,s.useEffect)(()=>ge(""),[n]);let V=zt(y),U=en(V?u:void 0,r,c,n===null?"":H,n?.on,n),bn=(0,s.useMemo)(()=>n===null?[]:[...P.start.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...T.map(e=>({key:`act:${e.id}`,label:e.label})),...P.end.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...U.map(e=>({key:e.key,label:e.label}))],[n,P,T,U]),at=Jt(u,n===null?"":H,bn),[ae,lt]=(0,s.useState)(!1),He=(0,s.useRef)({words:"",rank:null});ae||(He.current={words:H.trim(),rank:at});let N=ae?He.current.words===H.trim()?He.current.rank:null:at,L=(0,s.useMemo)(()=>[...P.start,...P.end].find(e=>e.mode)?.mode,[P]),$=n===null?[]:[...V?["chat"]:[],...L?["better"]:[]],[wn,st]=(0,s.useState)(null),[Ce,vn]=(0,s.useState)(null);(0,s.useEffect)(()=>st(null),[n,H]),(0,s.useEffect)(()=>{let e=H.trim();if(!L||!V||e==="")return;let t=!0,o=setTimeout(()=>void L.claims(e).then(d=>t&&vn({words:e,mode:d?"better":"chat"}),()=>{}),Je);return()=>{t=!1,clearTimeout(o)}},[H,L,V]);let pe=$.length===0?null:wn??($.length===1?$[0]:Ce&&Ce.words===H.trim()?Ce.mode:"chat"),kn=(0,s.useMemo)(()=>{if(n===null||$.length===0)return[];let e=(L?.nudges?.()??[]).map((C,q)=>({key:`nudge:${q}`,label:C,mode:"better",source:"nudge"})),t=U.slice(0,2).map(C=>({key:C.key,label:C.label,mode:"chat",source:"told"})),o=n.on??(p.length===1?p[0]:void 0),d=o!==void 0?r.graph.getNode(o):void 0,M=on(T,d,d?Ht(r.schema,[d.kind])[d.kind]:void 0,d?O(r,d.id):void 0).slice(0,2);return rn(V?[...e,...t,...M]:e,[...T,...de].map(C=>C.label))},[n,$.length,L,U,T,de,V,r,p]),Sn=(0,s.useMemo)(()=>(n?.on!==void 0?r.graph.getNode(n.on):void 0)??Fn(r),[n,r,T]),Le=an(u,kn,{name:n?.title??(p.length===1?O(r,p[0]):"this"),opened:n,better:L!==void 0,depends:Sn},ae),[dt,Ie]=(0,s.useState)(null),Oe=(0,s.useRef)([]),he=(e,t)=>{try{return mn(e,t),hn(e,t),Ie(null),l(null),Oe.current=[],!0}catch(o){return Ie(Ft(r.schema,r.allMutations(),o)),Oe.current=o instanceof Et?o.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},me=[...new Set(p.flatMap(e=>{let t=r.graph.getNode(e);return t?[t.kind]:[]}))],fe=me.length>0?me:[...new Set(p.flatMap(e=>It(e)))],A=p.length===1?Lt(p[0]):null,De=A?{from:r.graph.getNode(A.from),to:r.graph.getNode(A.to)}:null,ut=A?Wt(r,A):void 0,ct=ut?.provisional?ut:void 0,gt=A?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(A.from)?.kind??"")?.edges?.[A.kind],t=r.graph.getNode(A.to);return e?.inverse&&t?`From ${O(r,t.id)}: ${e.inverse}`:null})():null;(0,s.useEffect)(()=>{Y(null),$e(!1),rt(!1),Ie(null),ce("")},[p,n?.about]);let pt=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=n?.begin;if(!e||pt.current===n)return;let t=T.find(d=>d.mutation===e.act);if(!t)return;pt.current=n;let o={...e.given};fn({id:t.id,given:o}),t.open.every(d=>d.name in o)?he({...t,args:{...t.args,...o},open:[]}):Y(t.id)},[n,T]);let h=n!==null,xn=a==="menu"&&!h,J=(0,s.useRef)(n);J.current=n;let ht=Pt("acts",{open:h&&a==="menu",onOpenChange:e=>{e||l(null)},at:()=>J.current?{x:J.current.x,y:J.current.y}:null,returnTo:()=>{let e=J.current?.returnTo;if(e?.isConnected)return e;let t=J.current?.on;return t?document.querySelector(`[data-graview-view="${CSS.escape(t)}"]`):null},align:"start"}),mt=(k?.width??Number.POSITIVE_INFINITY)<dn;if((0,s.useLayoutEffect)(()=>{let e=g.current?.offsetParent;if(!e||!mt||h)return;let t=g.current?.getBoundingClientRect().height??0,o=`${Math.round(t)+20}px`;if(e.style.paddingBottom===o)return;let d=e.style.paddingBottom;return e.style.paddingBottom=o,()=>{e.style.paddingBottom=d}}),p.length===0&&!h)return null;let ft=n?.title!==void 0||p.length>0&&!(p.length===1&&p[0]===b.focusId),le=h?4:Math.max(1,Math.min(9,T.length)),W=[...T.filter(e=>e.provider==="invariant"&&!e.destructive),...T.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...T.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...T.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...T.filter(e=>e.destructive)],yt=W.length>le&&!h,bt=ue.trim().toLowerCase(),_=yt&&bt.length>0?W.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(bt)):null,E=h?H.trim():"",Pe=(e,t)=>E===""||Vt(t,E)||(N?.get(e)??0)>=Xe,F=(_??(nt||h?W:W.slice(0,le))).filter(e=>Pe(`act:${e.id}`,e.label)),wt=_||E?0:W.length-F.length,ye=E?D.filter(e=>Pe(`act:${e.id}`,e.label)):D,vt=e=>E===""?e:e.flatMap(t=>{let o=(t.items??[]).filter(d=>Pe(`item:${d.id}`,d.label));return o.length>0?[{id:t.id,...t.heading?{heading:t.heading}:{},items:o}]:[]}),j=h&&!nt&&E==="",ze=vt(P.start).filter(e=>(e.items?.length??0)>0||e.render),be=vt(P.end).filter(e=>(e.items?.length??0)>0||e.render),kt=new Set(j?F.slice(le).map(e=>e.id):[]),Ne=j&&W.length>=le,Mn=j&&(W.length>le||Ne&&D.length>0||Ee.length>0||P.end.some(e=>(e.items?.length??0)>0||e.render)),Tn=n?.title??(p.length===1?O(r,p[0]):p.length>1?`${p.length} selected`:"this"),St=h&&E!==""&&$.length>0,We=h&&E!==""?(N===null?U:[...U].sort((e,t)=>(N.get(t.key)??0)-(N.get(e.key)??0))).slice(0,Zt):[],An=[...ze.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...F.filter(e=>!e.destructive).map(e=>`act:${e.id}`),...be.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...We.map(e=>e.key)],En=N===null?void 0:[...An].sort((e,t)=>(N.get(t)??0)-(N.get(e)??0)).find(e=>(N.get(e)??0)>=Xe),I=E===""?null:En??ze.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??F.filter(e=>!e.destructive).map(e=>`act:${e.id}`)[0]??be.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??(St&&pe?"mode":null),Rn=(e=E)=>{if(!n)return;let t=n.returnTo??null,o=Be(g.current);l(null),Ge(y,{pointed:{on:n.on,about:p,field:n.field,place:n.place},...e?{asked:e}:{},returnTo:t,...o?{from:o}:{}})},_e=(e,t=E)=>{if(n){if(e==="chat")return Rn(t);l(null),L?.open(t||void 0)}},$n=e=>{let t=e.source==="told"?U.find(o=>o.key===e.key):void 0;if(t&&e.mode==="chat")return xt(t);_e(e.mode==="better"&&L?"better":"chat",e.label)},xt=e=>{if(!n)return;let t=n.returnTo??null,o=Be(g.current);l(null),Ge(y,{pointed:{on:n.on,about:p,field:n.field,place:n.place},asked:e.label,suggested:e.telling.id,returnTo:t,...o?{from:o}:{}})},Fe=()=>[...g.current?.querySelectorAll("[data-affordance]:not([disabled]), [data-menu-item]:not([data-menu-mode])")??[]].filter(e=>e.closest("[data-graview-asking], [hidden]")===null),je=()=>g.current?.querySelector("[data-menu-lit]")??null,Hn=e=>{let t=e.target,o=it.current;if(!o||t===o||e.metaKey||e.ctrlKey||e.altKey||t.closest("[data-graview-asking]")||_n(t))return;let d=e.key.length===1&&e.key!==" ";if(d||e.key==="Backspace"&&H!==""){e.preventDefault(),e.stopPropagation(),d&&H===""&&y&&Ue(y),ge(M=>d?M+e.key:M.slice(0,-1)),o.focus({preventScroll:!0});return}e.key==="ArrowUp"&&Fe()[0]===t&&(e.preventDefault(),e.stopPropagation(),o.focus({preventScroll:!0}))},we=[];for(let e of F){let t=!h&&e.provider==="invariant",o=!h&&!t&&e.pinned!==void 0&&!e.destructive,d=!h&&!t&&!o&&e.ties===!0&&!e.destructive,M=t?e.why:o?"pinned":d?"its ties":null,C=t?"violation":o||d?"ties":null,q=we[we.length-1];q&&q.heading===M?q.items.push(e):we.push({heading:M,tone:C,items:[e]})}let X=T.find(e=>e.id===ie),qe=X&&Re?.id===X.id?{...X,args:{...X.args,...Re.given},open:X.open.filter(e=>!(e.name in Re.given))}:X,se=p.length===1?O(r,p[0]):null,Mt=e=>{if(!se)return e;let t=e.startsWith(`"${se}"`)?e.slice(se.length+2):e.startsWith(se)?e.slice(se.length):null;if(t===null)return e;let o=t.trimStart();return o.length===0?e:o[0].toUpperCase()+o.slice(1)},Cn=new Set(h?[]:F.filter(e=>e.provider==="invariant").map(e=>e.why)),Z=Ee.filter(e=>!Cn.has(e.text)).map(e=>({...e,text:Mt(e.text)}));return xn?null:(0,i.jsxs)("section",{...h?ht.pane:{},ref:e=>{g.current=e,h&&ht.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":h?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>f(e.target),onBlur:e=>{e.relatedTarget!==null&&(x.current=null)},onMouseDown:e=>e.stopPropagation(),onKeyDownCapture:h?e=>Hn(e):void 0,onPointerMove:h?e=>{let t=e.target.closest?.("[data-menu-item], [data-affordance]")!=null;t!==ae&&lt(t)}:void 0,onPointerLeave:h&&ae?()=>lt(!1):void 0,style:{...h?Dt:{position:"absolute",zIndex:Ct("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)",...h?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:mt?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:b.overview?"min(296px, 38cqh)":44,width:236,maxHeight:b.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,i.jsx)("h2",{style:{...Qe,margin:0},children:"Inspector"}),(0,i.jsxs)("div",{style:{display:ft||!h?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:h?0:24},children:[ft?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:n?.title??(p.length===1?O(r,p[0]):`${p.length} selected`)}),me.length>0||A?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:A?"relation":me.map(e=>ke(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,p.length===1&&!A&&n?.face!=="pages"?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:b.expanded.includes(p[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,i.jsx)("span",{style:{flex:"1 1 auto"}})]}),h?null:(0,i.jsx)("button",{type:"button",onClick:()=>{l(null),B()},"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"}),h?(0,i.jsx)("input",{ref:it,type:"text","data-testid":"menu-type",...jn()?{}:{"data-graview-not-first":""},value:H,onChange:e=>{H===""&&e.target.value!==""&&y&&Ue(y),ge(e.target.value)},onKeyDown:e=>{if(e.key==="Enter"){e.preventDefault();let t=je();t?.focus({preventScroll:!0}),t?.click()}else e.key==="ArrowDown"?(e.preventDefault(),(je()??Fe()[0])?.focus()):e.key==="ArrowUp"?(e.preventDefault(),Fe().at(-1)?.focus()):e.key==="Enter"&&!je()&&pe?(e.preventDefault(),_e(pe)):e.key==="Escape"&&H!==""&&(e.preventDefault(),e.stopPropagation(),ge(""))},placeholder:$.length>0?"Tell Graview what you want\u2026":"Type to filter\u2026","aria-label":$.length>0?`Tell Graview what you want with ${Tn}, or filter what can be done here`:"Filter what can be done here",autoComplete:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"go",style:{boxSizing:"border-box",width:"100%",font:"inherit",fontSize:"max(1rem, 16px)",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,h&&$.length>0?(0,i.jsx)("div",{role:"group","aria-label":$.length>1?"Chat or Better UI":"Chat","data-testid":"menu-modes",style:{display:"flex",gap:6},children:$.map(e=>{let t=pe===e,o=e==="chat"?"Chat":L?.label??"Better UI",d=e==="chat"?"\u{1F4AC}":L?.mark??"\u2728";return(0,i.jsxs)("button",{type:"button","data-menu-mode":e,...e==="chat"?{"data-menu-item":"ask-typed"}:{},"data-menu-lit":I==="mode"&&t||void 0,"aria-pressed":t,"aria-label":E?`${o}: ${E}`:o,onClick:()=>_e(e),onKeyDown:M=>{if(M.key!=="ArrowLeft"&&M.key!=="ArrowRight")return;M.preventDefault(),M.stopPropagation();let C=$[($.indexOf(e)+(M.key==="ArrowRight"?1:$.length-1))%$.length];st(C),g.current?.querySelector(`[data-menu-mode="${C}"]`)?.focus()},style:t?qn:Kn,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:d})," ",o,I==="mode"&&t?Te:null]},e)})}):null,h&&E===""&&Le.length>0?(0,i.jsxs)("div",{"data-menu-section":"suggested",role:"group","aria-label":"Suggested",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5,minHeight:Le.length*31+22},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:Bn,children:"Suggested"}),Le.map((e,t)=>(0,i.jsxs)("button",{type:"button","data-menu-item":`suggested-${t}`,"data-suggested-mode":e.mode,onClick:()=>$n(e),style:{...Me,display:"flex",gap:8,alignItems:"baseline",minWidth:0},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:"\u2726"}),(0,i.jsx)("span",{title:e.label,style:{flex:"1 1 auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),(0,i.jsxs)("span",{title:e.mode==="better"?"Better UI":"Chat",style:{fontSize:"0.8125rem"},children:[(0,i.jsx)("span",{"aria-hidden":"true",children:e.mode==="better"?"\u2728":"\u{1F4AC}"}),(0,i.jsx)("span",{style:Qe,children:e.mode==="better"?" (Better UI)":" (Chat)"})]})]},e.key))]}):null,A&&De?(0,i.jsxs)("div",{style:{display:"grid",gap:6},children:[gt?(0,i.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:gt}):null,ct?(0,i.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Nt(ct)}):null,(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",De.from],["to",De.to]].map(([e,t],o)=>(0,i.jsxs)(s.Fragment,{children:[o===1?(0,i.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,t?(0,i.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>ne([t.id]),title:`Select ${O(r,t.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:O(r,t.id)}):(0,i.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!A&&p.length===1&&Rt(r,p[0])?(0,i.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,Z.length>0?(0,i.jsx)("div",{"data-testid":"observations",title:Z.map(e=>e.text).join(`
2
- `),hidden:j,style:{display:j?"none":"grid",gap:3},children:Z.slice(0,2).map(e=>(0,i.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===Z[1]&&Z.length>2?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",Z.length-2]}):null]},e.id))}):null,h?ze.map(e=>(0,i.jsx)(sn,{section:e,lit:I,close:()=>l(null)},e.id)):null,dt?(0,i.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:dt}):null,yt?(0,i.jsx)("input",{"data-testid":"action-filter",value:ue,onChange:e=>ce(e.target.value),placeholder:`Filter ${W.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),ue.length>0?ce(""):e.currentTarget.blur();return}if(e.key==="Enter"&&_?.length===1){let t=_[0];if(t.destructive)return;t.open.length>0?Y(t.id):he(t)&&ce("")}},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,_!==null&&_.length===0?(0,i.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",ue.trim(),"\u201D."]}):null,E!==""&&F.length===0||re&&T.length===0||T.length===0&&!tt&&p.length===0?null:T.length===0&&!tt?(0,i.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:D.length>0?`Nothing you may do with ${A?"this relation":fe.length===1?ve(ke(r.schema.tryDefinition(fe[0]),fe[0])):"this mix of kinds"} \u2014 ${D.length} action${D.length===1?"":"s"} withheld.`:A?`There is nothing to do with this line here: nothing in this app makes or breaks \u201C${_t(r.schema,r.graph.getNode(A.from)?.kind??"",A.kind,"out")}\u201D.`:Nn(r,fe,p)}):(0,i.jsxs)("ol",{...yn,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[we.map((e,t)=>(0,i.jsxs)(s.Fragment,{children:[e.heading?(0,i.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:t>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?Mt(e.heading):e.heading]}):t>0?(0,i.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(o=>(0,i.jsxs)("li",{hidden:kt.has(o.id),style:{display:kt.has(o.id)?"none":"flex",gap:2,alignItems:"stretch"},onKeyDown:d=>{if(d.metaKey||d.ctrlKey||d.altKey)return;let M=d.currentTarget.querySelector("[data-affordance]"),C=d.currentTarget.querySelector("[data-pin-for]"),q=d.target===C,Tt=d.key==="ArrowRight"&&!q?C:q&&["ArrowLeft","ArrowUp","ArrowDown"].includes(d.key)?M:null;Tt&&(d.preventDefault(),d.stopPropagation(),Tt.focus())},children:[(0,i.jsxs)("button",{type:"button",[Ye]:"","data-affordance":o.id,"data-rank":o.rank,"data-graview-destructive":o.destructive||void 0,"data-menu-lit":I===`act:${o.id}`||void 0,"aria-pressed":ie===o.id,title:o.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:ie===o.id?"var(--graview-accent)":h?"transparent":"var(--graview-edge)",background:h?"none":"var(--graview-panel)",boxShadow:"none",...o.destructive?{color:"var(--graview-warn)"}:{},...ie===o.id?{color:"var(--graview-accent)"}:{},...I===`act:${o.id}`?et:{}},onClick:()=>{if(o.open.length>0){Y(ie===o.id?null:o.id);return}he(o)},children:[o.label,o.open.length>0?(0,i.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,I===`act:${o.id}`?Te:null,_?.length===1&&_[0]?.id===o.id&&!o.destructive?(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,i.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":o.mutation,"aria-pressed":o.pinned!==void 0,"aria-label":o.pinned!==void 0?`Unpin ${o.label}`:`Pin ${o.label}`,title:o.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":o.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>oe(Qt(R,o.mutation,gn.has(o.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:o.pinned==="user"?"var(--graview-accent)":o.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:o.pinned!==void 0?"\u2605":"\u2606"})]},o.id))]},`${e.heading??"plain"}-${t}`)),wt>0&&!h?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",[Ye]:"",onClick:()=>$e(!0),title:`Show all ${T.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",wt," more"]})}):null]}),re?(0,i.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{l(null),re.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:re.label}):null,ye.length>0?(0,i.jsxs)("ul",{hidden:Ne,"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:Ne?"none":"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[ye.slice(0,h||ot?ye.length:3).map(e=>(0,i.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,i.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,i.jsx)("s",{children:e.label})}),(0,i.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)),!h&&!ot&&D.length>3?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>rt(!0),title:`Show all ${D.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",D.length-3," more withheld"]})}):null]}):null,Mn?(0,i.jsx)("button",{type:"button","data-menu-item":"more",onClick:e=>{let o=[...e.currentTarget.parentElement?.querySelectorAll("li[hidden], [data-menu-more][hidden]")??[]];$e(!0),requestAnimationFrame(()=>{for(let d of o){let M=d.querySelector("button:not([disabled]), a[href], input");if(M&&M.getClientRects().length>0)return M.focus()}})},style:{...Me,color:"var(--graview-ink-muted)"},children:"More\u2026"}):null,h&&be.length>0?(0,i.jsx)("div",{"data-menu-more":"",hidden:j,style:{display:j?"none":"contents"},children:be.filter(e=>!j||!e.render).map(e=>(0,i.jsx)(sn,{section:e,lit:I,close:()=>l(null)},e.id))}):null,We.length>0?(0,i.jsx)("div",{"data-menu-section":"told",role:"group","aria-label":"Suggested",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:We.map(e=>(0,i.jsxs)("button",{type:"button","data-menu-item":e.key,"data-told-suggestion":e.telling.id,"data-menu-lit":I===e.key||void 0,onClick:()=>xt(e),style:{...Me,...I===e.key?et:{}},children:[e.label,I===e.key?Te:null]},e.key))}):null,h&&E!==""&&!St&&I===null&&F.length===0&&ye.length===0?(0,i.jsxs)("p",{"data-testid":"menu-no-match",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing here matches \u201C",E,"\u201D."]}):null,qe?(0,i.jsx)(Kt,{affordance:qe,onApply:e=>{if(he(qe,e))Y(null);else return Oe.current},onCancel:()=>Y(null)}):null]})}function _n(a){return a.isContentEditable||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement?!0:a instanceof HTMLInputElement&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(a.type)}var Me={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},et={background:"var(--graview-panel-muted)"},ln=new WeakMap;function Fn(a){let r=a.log.all().length,n=ln.get(a);if(n&&n.length===r)return n.stamp;let l={length:r};return ln.set(a,{length:r,stamp:l}),l}var jn=()=>typeof matchMedia=="function"&&matchMedia("(pointer: fine)").matches,un={display:"inline-flex",alignItems:"center",gap:5,minHeight:30,padding:"0 11px",fontSize:"0.8125rem",borderRadius:999,cursor:"pointer",borderWidth:1,borderStyle:"solid",boxShadow:"none"},qn={...un,borderColor:"var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 14%, transparent)",color:"var(--graview-ink)",fontWeight:600},Kn={...un,borderColor:"var(--graview-edge)",background:"none",color:"var(--graview-ink-muted)"},Bn={fontSize:"0.6875rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)",padding:"0 10px"},Te=(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}),Un=[];function sn({section:a,lit:r=null,close:n}){return(0,i.jsxs)("div",{"data-menu-section":a.id,...a.heading?{role:"group","aria-label":a.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[a.heading?(0,i.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:a.heading}):null,a.items&&a.items.length>0?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:a.items.map(l=>(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-menu-item":l.id,"data-menu-lit":r===`item:${l.id}`||void 0,onClick:()=>{n(),l.run()},style:{...Me,...r===`item:${l.id}`?et:{}},children:[l.label,l.hint?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.hint]}):null,r===`item:${l.id}`?Te:null]})},l.id))}):null,a.render?.(n)]})}export{ho as InspectorPane,po as prepareActs};
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 Ve,b as Qt}from"./chunk.VBHV4TLG.js";import"./chunk.T6PU3NKP.js";import"./chunk.VBLQJVQ5.js";import"./chunk.47XEJZ3O.js";import{j as Bt,k as Ut,l as Gt}from"./chunk.DEKRFTRN.js";import"./chunk.BKYZSV2Y.js";import"./chunk.GVT4UUQA.js";import"./chunk.J6HF7IRQ.js";import"./chunk.LRNFE3UK.js";import"./chunk.HJCQ6I3S.js";import"./chunk.YCD4JSXD.js";import"./chunk.ZG5VGP5U.js";import"./chunk.NAXOXBOF.js";import{a as jt,b as O}from"./chunk.6W6XMLSF.js";import{a as Ye,b as Ft}from"./chunk.PZ7KY6XH.js";import"./chunk.WEMUKZKH.js";import"./chunk.T27QKVKP.js";import"./chunk.TBY5IR7C.js";import"./chunk.URQTF5SY.js";import"./chunk.BIDL7GQD.js";import"./chunk.LP2ZMAT2.js";import"./chunk.MSAYU25L.js";import{b as qt,c as Kt}from"./chunk.EGPCVMDU.js";import"./chunk.M7KXQGQL.js";import"./chunk.XOZU4OFA.js";import"./chunk.H3EGBDW2.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.6SJEZWH3.js";import"./chunk.6N4PE3U5.js";import"./chunk.YFVJUHAK.js";import"./chunk.B7KZBT27.js";import"./chunk.DWM7AR5Y.js";import"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import{v as _t}from"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import{l as Wt}from"./chunk.SJQPTDAT.js";import{b as Nt}from"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{a as Be,c as Ue,e as Ge,f as zt,m as Qe}from"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as Se,Pa as Ke,Ua as Dt,W as Ot,Ya as Pt,ea as xe,h as Lt,u as It}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Lc as Rt,Nc as $t,Pb as Et,nd as Ht,pa as At,ta as ve,td as Ct,ua as ke}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as ee}from"./chunk.AJZBJBMO.js";var s=ee(Se(),1);function Yt(a){return a.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(Boolean)}function Vt(a,r){let n=Yt(r);if(n.length===0)return!0;let l=Yt(a);return n.every(b=>l.some(m=>m.startsWith(b)))}var te=ee(Se(),1),Je=250,Xe=.2,Ln=a=>a===void 0||a.off?void 0:a.fast??(a.decide?{model:a.name??"decide",decide:a.decide}:void 0);function Jt(a,r,n){let[l,b]=(0,te.useState)(null),m=(0,te.useRef)(n);m.current=n;let y=n.map(c=>`${c.key}\0${c.label}`).join(""),u=Ln(a);return(0,te.useEffect)(()=>{let c=r.trim();if(!u||c===""||m.current.length===0)return;let g=!0,x=new Map(m.current.map((w,f)=>[`r${f+1}`,w])),v=setTimeout(()=>{u.decide({typed:c},{row:{type:"choice",instructions:`Which of these menu rows does somebody typing \u201C${c}\u201D mean?`,criteria:{...Object.fromEntries([...x].map(([w,f])=>[w,f.label])),none:"None of these rows"}}}).then(w=>{a?.meter?.({tier:"fast",model:u.model,inputTokens:w.usage.inputTokens,outputTokens:w.usage.outputTokens,interaction:"menu"});let f=w.answers.row;if(!g||f?.type!=="choice")return;let k=new Map;for(let[G,ne]of Object.entries(f.probabilities)){let B=x.get(G);B&&k.set(B.key,ne)}if(f.choice==="none")return b({words:c,chances:new Map});let S=x.get(f.choice);S&&!k.has(S.key)&&k.set(S.key,f.confidence),b({words:c,chances:k})}).catch(()=>{})},Je);return()=>{g=!1,clearTimeout(v)}},[r,y,u===void 0]),l!==null&&l.words===r.trim()?l.chances:null}var z=ee(Se(),1),Zt=2,Xt,In=()=>Xt??=(__graviewPreload(import.meta.url,["./chunk.X226YATK.js","./chunk.BJUUSIQY.js","./chunk.6KJGRM7A.js","./chunk.Z3O2VZAJ.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.CKDCTFLU.js")).catch(a=>(Xt=void 0,Promise.reject(a)));function en(a,r,n,l,b,m,y=4){let u=a&&!a.off?a.told:void 0,c=l.trim()!=="",[g,x]=(0,z.useState)(null);(0,z.useEffect)(()=>x(null),[m]);let[v,w]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{if(!u||m===null||m===void 0)return;let f=globalThis;if(!f.requestIdleCallback)return;let k=f.requestIdleCallback(()=>w(!0),{timeout:3e3});return()=>f.cancelIdleCallback?.(k)},[u,m]),(0,z.useEffect)(()=>{if(!u||g||!(c||v))return;let f=!0;return In().then(async k=>{let S=await k.readToldHere(u,r,n);f&&x({tellings:S,module:k})}).catch(()=>{}),()=>{f=!1}},[u,c,v,g,r,n]),(0,z.useMemo)(()=>g?c?g.module.toldSuggestionsFrom(g.tellings,r,n,l,b,y):g.module.toldForHere(g.tellings,r,n,b,3):[],[g,c,l,r,n,b,y])}var K=ee(Se(),1),tn=a=>a.replace(/\s*…\s*$/u,"").replace(/\s+/g," ").trim().toLowerCase();function on(a,r,n={},l){if(!r)return[];let b=[],m=[];for(let y of a){if(y.destructive||y.setsAside||y.ties)continue;let u=y.open.filter(f=>!f.optional);if(u.length===0&&y.open.length===0&&l){let f=y.label.replace(/\b(it|this one|this)\b/u,`\u201C${l}\u201D`);m.push({key:`act:${y.id}`,label:f!==y.label?f:`${y.label} \u201C${l}\u201D`,mode:"chat",source:"act"});continue}let c=u[0];if(u.length!==1||c?.shape?.type!=="choice"||!c.shape.options||c.shape.options.length<2)continue;let g=c.shape.options,x=g.indexOf(String(r[c.name]??"")),v=x>=0?g[x+1]:void 0;if(v===void 0)continue;let w=n[c.name]?.[v]??v.replace(/[-_]+/g," ").replace(/^./u,f=>f.toUpperCase());b.push({key:`act:${y.id}:${v}`,label:`${y.label.replace(/\s*…\s*$/u,"")} to ${w}`,mode:"chat",source:"act"})}return[...b,...m]}function rn(a,r){let n=new Set(r.map(tn));return a.filter(l=>!n.has(tn(l.label)))}var On=3,Dn=a=>a===void 0||a.off||a.suggestOnOpen===!1?void 0:a.fast??(a.decide?{model:a.name??"decide",decide:a.decide}:void 0),Ze=new WeakMap,nn=(a,r)=>a?Ze.get(a)?.get(r):void 0;function Pn(a){let r=u=>a.filter(c=>c.source===u),[n,l,b]=[r("nudge"),r("told"),r("act")],m=[],y=Math.max(n.length,l.length,b.length);for(let u=0;u<y;u++)for(let c of[n,l,b])c[u]&&m.push(c[u]);return m}function an(a,r,n,l){let b=Dn(a),m=r.map(v=>`${v.key}\0${v.label}`).join(""),[y,u]=(0,K.useState)(null),c=nn(n.depends,m)??y;(0,K.useEffect)(()=>{if(nn(n.depends,m)||(u(null),!b||r.length===0||n.opened===null||n.opened===void 0))return;let v=!0,w=new Map(r.map((k,S)=>[`s${S+1}`,k])),f={pick:{type:"choice",instructions:`Somebody right-clicked \u201C${n.name}\u201D in an app. Which of these would they most likely want to do next?`,criteria:Object.fromEntries([...w].map(([k,S])=>[k,S.label]))}};if(n.better)for(let[k,S]of w)f[`about_${k}`]={type:"choice",instructions:`Is \u201C${S.label}\u201D about how \u201C${n.name}\u201D looks or is laid out, or about the records in it?`,criteria:{look:"How it looks or is laid out: style, size, what each row or card shows, its order or grouping",records:"The records themselves: changing, finishing, adding, assigning or asking about them"}};return b.decide({on:n.name},f).then(k=>{if(a?.meter?.({tier:"fast",model:b.model,inputTokens:k.usage.inputTokens,outputTokens:k.usage.outputTokens,interaction:"menu"}),!v)return;let S=k.answers.pick,G=R=>S?.type==="choice"?S.probabilities[R]??(S.choice===R?S.confidence:0):0,ne=[...w.keys()].sort((R,oe)=>G(oe)-G(R)).map(R=>w.get(R).key),B=new Map;for(let[R,oe]of w){let Q=k.answers[`about_${R}`];Q?.type==="choice"&&B.set(oe.key,Q.choice==="look"?"better":"chat")}let p={said:m,order:ne,modes:B};if(n.depends){let R=Ze.get(n.depends)??new Map;R.set(m,p),Ze.set(n.depends,R)}u(p)}).catch(()=>{}),()=>{v=!1}},[m,n.opened,n.depends,b===void 0]);let g=(0,K.useMemo)(()=>(c&&c.said===m?c.order.map(w=>r.find(f=>f.key===w)).filter(Boolean):Pn(r)).slice(0,On).map(w=>({...w,mode:c?.modes.get(w.key)??w.mode})),[c,m,r]),x=(0,K.useRef)(g);return l||(x.current=g),l?x.current:g}var i=ee(Ot(),1);function po(a,r,n){let l=r.on??r.about[r.about.length-1];Bt(a,r.about,{...n,pins:Ve(),...l===void 0?{}:{focus:l}})}function ho({placement:a="float",chosen:r=!0}={}){let{menuAt:n}=xe();return a==="menu"&&n===null?r?(0,i.jsx)(zn,{}):null:(0,i.jsx)(Wn,{placement:a})}function zn(){let{store:a,setMenuAt:r,view:n}=xe(),{selection:l}=Ke(),b=(0,s.useRef)(null),[m,y]=(0,s.useState)(null),[u,c]=(0,s.useState)(null);(0,s.useLayoutEffect)(()=>{let x=b.current?.offsetParent??b.current?.parentElement;if(!x)return;let v=x.getBoundingClientRect(),w=Math.round(v.width);w!==m&&y(w);let f=[...x.querySelectorAll('[data-testid="lines-key"][data-graview-up-row], [data-testid="overview"]')].map(S=>S.getBoundingClientRect()).filter(S=>S.width>0&&S.top-v.top<40),k=f.length>0?Math.round(v.right-Math.min(...f.map(S=>S.left))+8):null;k!==u&&c(k)});let g=l.length===1&&!n.overview?a.graph.getNode(l[0]):void 0;return!g||m===null||m>=dn?(0,i.jsx)("span",{ref:b,hidden:!0}):(0,i.jsx)("button",{type:"button",ref:b,"data-testid":"chosen-acts","aria-label":`What can be done with ${O(a,g.id)}`,"aria-haspopup":"menu",onClick:x=>{let v=x.currentTarget.getBoundingClientRect();r({x:Math.round(v.right),y:Math.round(v.bottom+4),on:g.id})},style:{position:"absolute",...u!==null?{right:u,top:14,minHeight:38}:{right:"calc(14px + var(--graview-dock, 0px))",top:98},zIndex:"var(--graview-layer-overview, 10)",...u===null?{minHeight:30}:{},padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}function Nn(a,r,n){let l=u=>ke(a.schema.tryDefinition(u),u),b=u=>At(a.schema,u).toLowerCase(),m=r.filter(u=>a.allMutations().some(c=>{let g=c.subject;return g?.kinds==="*"||(g?.kinds??[]).includes(u)})),y=n.length!==1||n.some(u=>u.startsWith("aggregate:"));return m.length>0&&y?r.length===1?`Nothing here is done to all the ${b(r[0])} at once. Right-click one ${l(r[0])} to see what you can do with it.`:"Nothing here is done to all of these at once. Right-click one of them to see what you can do with it.":m.length>0?`There is nothing you can do with ${r.length===1?ve(l(r[0])):"these"} here right now.`:r.length===1?`There is nothing to do with ${ve(l(r[0]))} in this app yet.`:"There is nothing to do with these in this app yet."}var dn=564;function Wn({placement:a}){let{store:r,menuAt:n,setMenuAt:l,view:b,signIn:m,aiDesk:y,ai:u,principal:c}=xe(),g=(0,s.useRef)(null),x=(0,s.useRef)(null),v=(0,s.useRef)(null),w=(0,s.useRef)(null);n?.returnTo&&(w.current=n.returnTo);let f=e=>{let t=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),o=e.getAttribute("data-pin-for"),d=t??e.getAttribute("data-affordance")??(o===null?null:`pin:${o}`)??e.getAttribute("data-menu-item");x.current=d===null?null:{key:d,element:e}};(0,s.useEffect)(()=>{let e=g.current,t=x.current;if(t===null||document.activeElement!==document.body||t.element.isConnected)return;let o=t.key;if(!e){x.current=null;let M=w.current;w.current=null,(M?.isConnected?M:v.current)?.focus();return}((o.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(o.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(o)}"]:not([disabled])`)??e).focus()});let[k,S]=(0,s.useState)(null);(0,s.useLayoutEffect)(()=>{let e=g.current?.offsetParent??g.current?.parentElement;if(e instanceof HTMLElement&&(v.current=e),!e)return;let t=e.getBoundingClientRect();S(o=>o&&o.left===t.left&&o.top===t.top&&o.width===t.width&&o.height===t.height?o:{left:t.left,top:t.top,width:t.width,height:t.height})});let{selection:G,set:ne,clear:B}=Ke(),p=n?.about??G,[R,oe]=(0,s.useState)(()=>Ve()),Q=n?.on??p[p.length-1],Ae=n?.about,cn=(0,s.useMemo)(()=>({pins:R,...Q===void 0?{}:{focus:Q},...Ae?{about:Ae}:{}}),[R,Q,Ae]),gn=(0,s.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:T,withheld:de,observations:Ee}=Ut(cn),re=$t(de,m),D=re?Un:de,pn=n===null?null:{face:n.face??"scene",on:n.on,about:p,field:n.field,place:n.place,href:n.href,act:n.act,column:n.column,...n.section?{section:n.section}:{},...n.page?{page:n.page}:{},element:n.returnTo},P=_t(pn),tt=Ee.some(e=>e.id.startsWith("schema:waits:")),{apply:hn,preview:mn}=Gt(),[ie,Y]=(0,s.useState)(null),[Re,fn]=(0,s.useState)(null),[nt,$e]=(0,s.useState)(!1),[ot,rt]=(0,s.useState)(!1),[ue,ce]=(0,s.useState)(""),yn=Ft({letters:n===null}),[H,ge]=(0,s.useState)(""),it=(0,s.useRef)(null);(0,s.useEffect)(()=>ge(""),[n]);let V=zt(y),U=en(V?u:void 0,r,c,n===null?"":H,n?.on,n),bn=(0,s.useMemo)(()=>n===null?[]:[...P.start.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...T.map(e=>({key:`act:${e.id}`,label:e.label})),...P.end.flatMap(e=>(e.items??[]).map(t=>({key:`item:${t.id}`,label:t.label}))),...U.map(e=>({key:e.key,label:e.label}))],[n,P,T,U]),at=Jt(u,n===null?"":H,bn),[ae,lt]=(0,s.useState)(!1),He=(0,s.useRef)({words:"",rank:null});ae||(He.current={words:H.trim(),rank:at});let N=ae?He.current.words===H.trim()?He.current.rank:null:at,L=(0,s.useMemo)(()=>[...P.start,...P.end].find(e=>e.mode)?.mode,[P]),$=n===null?[]:[...V?["chat"]:[],...L?["better"]:[]],[wn,st]=(0,s.useState)(null),[Ce,vn]=(0,s.useState)(null);(0,s.useEffect)(()=>st(null),[n,H]),(0,s.useEffect)(()=>{let e=H.trim();if(!L||!V||e==="")return;let t=!0,o=setTimeout(()=>void L.claims(e).then(d=>t&&vn({words:e,mode:d?"better":"chat"}),()=>{}),Je);return()=>{t=!1,clearTimeout(o)}},[H,L,V]);let pe=$.length===0?null:wn??($.length===1?$[0]:Ce&&Ce.words===H.trim()?Ce.mode:"chat"),kn=(0,s.useMemo)(()=>{if(n===null||$.length===0)return[];let e=(L?.nudges?.()??[]).map((C,q)=>({key:`nudge:${q}`,label:C,mode:"better",source:"nudge"})),t=U.slice(0,2).map(C=>({key:C.key,label:C.label,mode:"chat",source:"told"})),o=n.on??(p.length===1?p[0]:void 0),d=o!==void 0?r.graph.getNode(o):void 0,M=on(T,d,d?Ht(r.schema,[d.kind])[d.kind]:void 0,d?O(r,d.id):void 0).slice(0,2);return rn(V?[...e,...t,...M]:e,[...T,...de].map(C=>C.label))},[n,$.length,L,U,T,de,V,r,p]),Sn=(0,s.useMemo)(()=>(n?.on!==void 0?r.graph.getNode(n.on):void 0)??Fn(r),[n,r,T]),Le=an(u,kn,{name:n?.title??(p.length===1?O(r,p[0]):"this"),opened:n,better:L!==void 0,depends:Sn},ae),[dt,Ie]=(0,s.useState)(null),Oe=(0,s.useRef)([]),he=(e,t)=>{try{return mn(e,t),hn(e,t),Ie(null),l(null),Oe.current=[],!0}catch(o){return Ie(Wt(r.schema,r.allMutations(),o)),Oe.current=o instanceof Et?o.issues.map(d=>String(d.path[0]??"")).filter(Boolean):[],!1}},me=[...new Set(p.flatMap(e=>{let t=r.graph.getNode(e);return t?[t.kind]:[]}))],fe=me.length>0?me:[...new Set(p.flatMap(e=>It(e)))],A=p.length===1?Lt(p[0]):null,De=A?{from:r.graph.getNode(A.from),to:r.graph.getNode(A.to)}:null,ut=A?Kt(r,A):void 0,ct=ut?.provisional?ut:void 0,gt=A?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(A.from)?.kind??"")?.edges?.[A.kind],t=r.graph.getNode(A.to);return e?.inverse&&t?`From ${O(r,t.id)}: ${e.inverse}`:null})():null;(0,s.useEffect)(()=>{Y(null),$e(!1),rt(!1),Ie(null),ce("")},[p,n?.about]);let pt=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=n?.begin;if(!e||pt.current===n)return;let t=T.find(d=>d.mutation===e.act);if(!t)return;pt.current=n;let o={...e.given};fn({id:t.id,given:o}),t.open.every(d=>d.name in o)?he({...t,args:{...t.args,...o},open:[]}):Y(t.id)},[n,T]);let h=n!==null,xn=a==="menu"&&!h,J=(0,s.useRef)(n);J.current=n;let ht=Pt("acts",{open:h&&a==="menu",onOpenChange:e=>{e||l(null)},at:()=>J.current?{x:J.current.x,y:J.current.y}:null,returnTo:()=>{let e=J.current?.returnTo;if(e?.isConnected)return e;let t=J.current?.on;return t?document.querySelector(`[data-graview-view="${CSS.escape(t)}"]`):null},align:"start"}),mt=(k?.width??Number.POSITIVE_INFINITY)<dn;if((0,s.useLayoutEffect)(()=>{let e=g.current?.offsetParent;if(!e||!mt||h)return;let t=g.current?.getBoundingClientRect().height??0,o=`${Math.round(t)+20}px`;if(e.style.paddingBottom===o)return;let d=e.style.paddingBottom;return e.style.paddingBottom=o,()=>{e.style.paddingBottom=d}}),p.length===0&&!h)return null;let ft=n?.title!==void 0||p.length>0&&!(p.length===1&&p[0]===b.focusId),le=h?4:Math.max(1,Math.min(9,T.length)),W=[...T.filter(e=>e.provider==="invariant"&&!e.destructive),...T.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...T.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...T.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...T.filter(e=>e.destructive)],yt=W.length>le&&!h,bt=ue.trim().toLowerCase(),_=yt&&bt.length>0?W.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(bt)):null,E=h?H.trim():"",Pe=(e,t)=>E===""||Vt(t,E)||(N?.get(e)??0)>=Xe,F=(_??(nt||h?W:W.slice(0,le))).filter(e=>Pe(`act:${e.id}`,e.label)),wt=_||E?0:W.length-F.length,ye=E?D.filter(e=>Pe(`act:${e.id}`,e.label)):D,vt=e=>E===""?e:e.flatMap(t=>{let o=(t.items??[]).filter(d=>Pe(`item:${d.id}`,d.label));return o.length>0?[{id:t.id,...t.heading?{heading:t.heading}:{},items:o}]:[]}),j=h&&!nt&&E==="",ze=vt(P.start).filter(e=>(e.items?.length??0)>0||e.render),be=vt(P.end).filter(e=>(e.items?.length??0)>0||e.render),kt=new Set(j?F.slice(le).map(e=>e.id):[]),Ne=j&&W.length>=le,Mn=j&&(W.length>le||Ne&&D.length>0||Ee.length>0||P.end.some(e=>(e.items?.length??0)>0||e.render)),Tn=n?.title??(p.length===1?O(r,p[0]):p.length>1?`${p.length} selected`:"this"),St=h&&E!==""&&$.length>0,We=h&&E!==""?(N===null?U:[...U].sort((e,t)=>(N.get(t.key)??0)-(N.get(e.key)??0))).slice(0,Zt):[],An=[...ze.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...F.filter(e=>!e.destructive).map(e=>`act:${e.id}`),...be.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`)),...We.map(e=>e.key)],En=N===null?void 0:[...An].sort((e,t)=>(N.get(t)??0)-(N.get(e)??0)).find(e=>(N.get(e)??0)>=Xe),I=E===""?null:En??ze.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??F.filter(e=>!e.destructive).map(e=>`act:${e.id}`)[0]??be.flatMap(e=>(e.items??[]).map(t=>`item:${t.id}`))[0]??(St&&pe?"mode":null),Rn=(e=E)=>{if(!n)return;let t=n.returnTo??null,o=Be(g.current);l(null),Ge(y,{pointed:{on:n.on,about:p,field:n.field,place:n.place},...e?{asked:e}:{},returnTo:t,...o?{from:o}:{}})},_e=(e,t=E)=>{if(n){if(e==="chat")return Rn(t);l(null),L?.open(t||void 0)}},$n=e=>{let t=e.source==="told"?U.find(o=>o.key===e.key):void 0;if(t&&e.mode==="chat")return xt(t);_e(e.mode==="better"&&L?"better":"chat",e.label)},xt=e=>{if(!n)return;let t=n.returnTo??null,o=Be(g.current);l(null),Ge(y,{pointed:{on:n.on,about:p,field:n.field,place:n.place},asked:e.label,suggested:e.telling.id,returnTo:t,...o?{from:o}:{}})},Fe=()=>[...g.current?.querySelectorAll("[data-affordance]:not([disabled]), [data-menu-item]:not([data-menu-mode])")??[]].filter(e=>e.closest("[data-graview-asking], [hidden]")===null),je=()=>g.current?.querySelector("[data-menu-lit]")??null,Hn=e=>{let t=e.target,o=it.current;if(!o||t===o||e.metaKey||e.ctrlKey||e.altKey||t.closest("[data-graview-asking]")||_n(t))return;let d=e.key.length===1&&e.key!==" ";if(d||e.key==="Backspace"&&H!==""){e.preventDefault(),e.stopPropagation(),d&&H===""&&y&&Ue(y),ge(M=>d?M+e.key:M.slice(0,-1)),o.focus({preventScroll:!0});return}e.key==="ArrowUp"&&Fe()[0]===t&&(e.preventDefault(),e.stopPropagation(),o.focus({preventScroll:!0}))},we=[];for(let e of F){let t=!h&&e.provider==="invariant",o=!h&&!t&&e.pinned!==void 0&&!e.destructive,d=!h&&!t&&!o&&e.ties===!0&&!e.destructive,M=t?e.why:o?"pinned":d?"its ties":null,C=t?"violation":o||d?"ties":null,q=we[we.length-1];q&&q.heading===M?q.items.push(e):we.push({heading:M,tone:C,items:[e]})}let X=T.find(e=>e.id===ie),qe=X&&Re?.id===X.id?{...X,args:{...X.args,...Re.given},open:X.open.filter(e=>!(e.name in Re.given))}:X,se=p.length===1?O(r,p[0]):null,Mt=e=>{if(!se)return e;let t=e.startsWith(`"${se}"`)?e.slice(se.length+2):e.startsWith(se)?e.slice(se.length):null;if(t===null)return e;let o=t.trimStart();return o.length===0?e:o[0].toUpperCase()+o.slice(1)},Cn=new Set(h?[]:F.filter(e=>e.provider==="invariant").map(e=>e.why)),Z=Ee.filter(e=>!Cn.has(e.text)).map(e=>({...e,text:Mt(e.text)}));return xn?null:(0,i.jsxs)("section",{...h?ht.pane:{},ref:e=>{g.current=e,h&&ht.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":h?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>f(e.target),onBlur:e=>{e.relatedTarget!==null&&(x.current=null)},onMouseDown:e=>e.stopPropagation(),onKeyDownCapture:h?e=>Hn(e):void 0,onPointerMove:h?e=>{let t=e.target.closest?.("[data-menu-item], [data-affordance]")!=null;t!==ae&&lt(t)}:void 0,onPointerLeave:h&&ae?()=>lt(!1):void 0,style:{...h?Dt:{position:"absolute",zIndex:Ct("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)",...h?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:mt?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:b.overview?"min(296px, 38cqh)":44,width:236,maxHeight:b.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,i.jsx)("h2",{style:{...Qe,margin:0},children:"Inspector"}),(0,i.jsxs)("div",{style:{display:ft||!h?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:h?0:24},children:[ft?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:n?.title??(p.length===1?O(r,p[0]):`${p.length} selected`)}),me.length>0||A?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:A?"relation":me.map(e=>ke(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,p.length===1&&!A&&n?.face!=="pages"?(0,i.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:b.expanded.includes(p[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,i.jsx)("span",{style:{flex:"1 1 auto"}})]}),h?null:(0,i.jsx)("button",{type:"button",onClick:()=>{l(null),B()},"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"}),h?(0,i.jsx)("input",{ref:it,type:"text","data-testid":"menu-type",...jn()?{}:{"data-graview-not-first":""},value:H,onChange:e=>{H===""&&e.target.value!==""&&y&&Ue(y),ge(e.target.value)},onKeyDown:e=>{if(e.key==="Enter"){e.preventDefault();let t=je();t?.focus({preventScroll:!0}),t?.click()}else e.key==="ArrowDown"?(e.preventDefault(),(je()??Fe()[0])?.focus()):e.key==="ArrowUp"?(e.preventDefault(),Fe().at(-1)?.focus()):e.key==="Enter"&&!je()&&pe?(e.preventDefault(),_e(pe)):e.key==="Escape"&&H!==""&&(e.preventDefault(),e.stopPropagation(),ge(""))},placeholder:$.length>0?"Tell Graview what you want\u2026":"Type to filter\u2026","aria-label":$.length>0?`Tell Graview what you want with ${Tn}, or filter what can be done here`:"Filter what can be done here",autoComplete:"off",autoCorrect:"off",spellCheck:!1,enterKeyHint:"go",style:{boxSizing:"border-box",width:"100%",font:"inherit",fontSize:"max(1rem, 16px)",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,h&&$.length>0?(0,i.jsx)("div",{role:"group","aria-label":$.length>1?"Chat or Better UI":"Chat","data-testid":"menu-modes",style:{display:"flex",gap:6},children:$.map(e=>{let t=pe===e,o=e==="chat"?"Chat":L?.label??"Better UI",d=e==="chat"?"\u{1F4AC}":L?.mark??"\u2728";return(0,i.jsxs)("button",{type:"button","data-menu-mode":e,...e==="chat"?{"data-menu-item":"ask-typed"}:{},"data-menu-lit":I==="mode"&&t||void 0,"aria-pressed":t,"aria-label":E?`${o}: ${E}`:o,onClick:()=>_e(e),onKeyDown:M=>{if(M.key!=="ArrowLeft"&&M.key!=="ArrowRight")return;M.preventDefault(),M.stopPropagation();let C=$[($.indexOf(e)+(M.key==="ArrowRight"?1:$.length-1))%$.length];st(C),g.current?.querySelector(`[data-menu-mode="${C}"]`)?.focus()},style:t?qn:Kn,children:[(0,i.jsx)("span",{"aria-hidden":"true",children:d})," ",o,I==="mode"&&t?Te:null]},e)})}):null,h&&E===""&&Le.length>0?(0,i.jsxs)("div",{"data-menu-section":"suggested",role:"group","aria-label":"Suggested",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5,minHeight:Le.length*31+22},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:Bn,children:"Suggested"}),Le.map((e,t)=>(0,i.jsxs)("button",{type:"button","data-menu-item":`suggested-${t}`,"data-suggested-mode":e.mode,onClick:()=>$n(e),style:{...Me,display:"flex",gap:8,alignItems:"baseline",minWidth:0},children:[(0,i.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:"\u2726"}),(0,i.jsx)("span",{title:e.label,style:{flex:"1 1 auto",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),(0,i.jsxs)("span",{title:e.mode==="better"?"Better UI":"Chat",style:{fontSize:"0.8125rem"},children:[(0,i.jsx)("span",{"aria-hidden":"true",children:e.mode==="better"?"\u2728":"\u{1F4AC}"}),(0,i.jsx)("span",{style:Qe,children:e.mode==="better"?" (Better UI)":" (Chat)"})]})]},e.key))]}):null,A&&De?(0,i.jsxs)("div",{style:{display:"grid",gap:6},children:[gt?(0,i.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:gt}):null,ct?(0,i.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:qt(ct)}):null,(0,i.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",De.from],["to",De.to]].map(([e,t],o)=>(0,i.jsxs)(s.Fragment,{children:[o===1?(0,i.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,t?(0,i.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>ne([t.id]),title:`Select ${O(r,t.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:O(r,t.id)}):(0,i.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!A&&p.length===1&&Rt(r,p[0])?(0,i.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,Z.length>0?(0,i.jsx)("div",{"data-testid":"observations",title:Z.map(e=>e.text).join(`
2
+ `),hidden:j,style:{display:j?"none":"grid",gap:3},children:Z.slice(0,2).map(e=>(0,i.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===Z[1]&&Z.length>2?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",Z.length-2]}):null]},e.id))}):null,h?ze.map(e=>(0,i.jsx)(sn,{section:e,lit:I,close:()=>l(null)},e.id)):null,dt?(0,i.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:dt}):null,yt?(0,i.jsx)("input",{"data-testid":"action-filter",value:ue,onChange:e=>ce(e.target.value),placeholder:`Filter ${W.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),ue.length>0?ce(""):e.currentTarget.blur();return}if(e.key==="Enter"&&_?.length===1){let t=_[0];if(t.destructive)return;t.open.length>0?Y(t.id):he(t)&&ce("")}},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,_!==null&&_.length===0?(0,i.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",ue.trim(),"\u201D."]}):null,E!==""&&F.length===0||re&&T.length===0||T.length===0&&!tt&&p.length===0?null:T.length===0&&!tt?(0,i.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:D.length>0?`Nothing you may do with ${A?"this relation":fe.length===1?ve(ke(r.schema.tryDefinition(fe[0]),fe[0])):"this mix of kinds"} \u2014 ${D.length} action${D.length===1?"":"s"} withheld.`:A?`There is nothing to do with this line here: nothing in this app makes or breaks \u201C${Nt(r.schema,r.graph.getNode(A.from)?.kind??"",A.kind,"out")}\u201D.`:Nn(r,fe,p)}):(0,i.jsxs)("ol",{...yn,"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[we.map((e,t)=>(0,i.jsxs)(s.Fragment,{children:[e.heading?(0,i.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:t>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?Mt(e.heading):e.heading]}):t>0?(0,i.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(o=>(0,i.jsxs)("li",{hidden:kt.has(o.id),style:{display:kt.has(o.id)?"none":"flex",gap:2,alignItems:"stretch"},onKeyDown:d=>{if(d.metaKey||d.ctrlKey||d.altKey)return;let M=d.currentTarget.querySelector("[data-affordance]"),C=d.currentTarget.querySelector("[data-pin-for]"),q=d.target===C,Tt=d.key==="ArrowRight"&&!q?C:q&&["ArrowLeft","ArrowUp","ArrowDown"].includes(d.key)?M:null;Tt&&(d.preventDefault(),d.stopPropagation(),Tt.focus())},children:[(0,i.jsxs)("button",{type:"button",[Ye]:"","data-affordance":o.id,"data-rank":o.rank,"data-graview-destructive":o.destructive||void 0,"data-menu-lit":I===`act:${o.id}`||void 0,"aria-pressed":ie===o.id,title:o.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:ie===o.id?"var(--graview-accent)":h?"transparent":"var(--graview-edge)",background:h?"none":"var(--graview-panel)",boxShadow:"none",...o.destructive?{color:"var(--graview-warn)"}:{},...ie===o.id?{color:"var(--graview-accent)"}:{},...I===`act:${o.id}`?et:{}},onClick:()=>{if(o.open.length>0){Y(ie===o.id?null:o.id);return}he(o)},children:[o.label,o.open.length>0?(0,i.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,I===`act:${o.id}`?Te:null,_?.length===1&&_[0]?.id===o.id&&!o.destructive?(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,i.jsx)("button",{type:"button","data-testid":"pin-toggle",tabIndex:-1,"data-pin-for":o.mutation,"aria-pressed":o.pinned!==void 0,"aria-label":o.pinned!==void 0?`Unpin ${o.label}`:`Pin ${o.label}`,title:o.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":o.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>oe(Qt(R,o.mutation,gn.has(o.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:o.pinned==="user"?"var(--graview-accent)":o.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:o.pinned!==void 0?"\u2605":"\u2606"})]},o.id))]},`${e.heading??"plain"}-${t}`)),wt>0&&!h?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button",[Ye]:"",onClick:()=>$e(!0),title:`Show all ${T.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",wt," more"]})}):null]}),re?(0,i.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{l(null),re.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:re.label}):null,ye.length>0?(0,i.jsxs)("ul",{hidden:Ne,"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:Ne?"none":"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[ye.slice(0,h||ot?ye.length:3).map(e=>(0,i.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,i.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,i.jsx)("s",{children:e.label})}),(0,i.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)),!h&&!ot&&D.length>3?(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>rt(!0),title:`Show all ${D.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",D.length-3," more withheld"]})}):null]}):null,Mn?(0,i.jsx)("button",{type:"button","data-menu-item":"more",onClick:e=>{let o=[...e.currentTarget.parentElement?.querySelectorAll("li[hidden], [data-menu-more][hidden]")??[]];$e(!0),requestAnimationFrame(()=>{for(let d of o){let M=d.querySelector("button:not([disabled]), a[href], input");if(M&&M.getClientRects().length>0)return M.focus()}})},style:{...Me,color:"var(--graview-ink-muted)"},children:"More\u2026"}):null,h&&be.length>0?(0,i.jsx)("div",{"data-menu-more":"",hidden:j,style:{display:j?"none":"contents"},children:be.filter(e=>!j||!e.render).map(e=>(0,i.jsx)(sn,{section:e,lit:I,close:()=>l(null)},e.id))}):null,We.length>0?(0,i.jsx)("div",{"data-menu-section":"told",role:"group","aria-label":"Suggested",style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:We.map(e=>(0,i.jsxs)("button",{type:"button","data-menu-item":e.key,"data-told-suggestion":e.telling.id,"data-menu-lit":I===e.key||void 0,onClick:()=>xt(e),style:{...Me,...I===e.key?et:{}},children:[e.label,I===e.key?Te:null]},e.key))}):null,h&&E!==""&&!St&&I===null&&F.length===0&&ye.length===0?(0,i.jsxs)("p",{"data-testid":"menu-no-match",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing here matches \u201C",E,"\u201D."]}):null,qe?(0,i.jsx)(jt,{affordance:qe,onApply:e=>{if(he(qe,e))Y(null);else return Oe.current},onCancel:()=>Y(null)}):null]})}function _n(a){return a.isContentEditable||a instanceof HTMLTextAreaElement||a instanceof HTMLSelectElement?!0:a instanceof HTMLInputElement&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(a.type)}var Me={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},et={background:"var(--graview-panel-muted)"},ln=new WeakMap;function Fn(a){let r=a.log.all().length,n=ln.get(a);if(n&&n.length===r)return n.stamp;let l={length:r};return ln.set(a,{length:r,stamp:l}),l}var jn=()=>typeof matchMedia=="function"&&matchMedia("(pointer: fine)").matches,un={display:"inline-flex",alignItems:"center",gap:5,minHeight:30,padding:"0 11px",fontSize:"0.8125rem",borderRadius:999,cursor:"pointer",borderWidth:1,borderStyle:"solid",boxShadow:"none"},qn={...un,borderColor:"var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 14%, transparent)",color:"var(--graview-ink)",fontWeight:600},Kn={...un,borderColor:"var(--graview-edge)",background:"none",color:"var(--graview-ink-muted)"},Bn={fontSize:"0.6875rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)",padding:"0 10px"},Te=(0,i.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}),Un=[];function sn({section:a,lit:r=null,close:n}){return(0,i.jsxs)("div",{"data-menu-section":a.id,...a.heading?{role:"group","aria-label":a.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[a.heading?(0,i.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:a.heading}):null,a.items&&a.items.length>0?(0,i.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:a.items.map(l=>(0,i.jsx)("li",{children:(0,i.jsxs)("button",{type:"button","data-menu-item":l.id,"data-menu-lit":r===`item:${l.id}`||void 0,onClick:()=>{n(),l.run()},style:{...Me,...r===`item:${l.id}`?et:{}},children:[l.label,l.hint?(0,i.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",l.hint]}):null,r===`item:${l.id}`?Te:null]})},l.id))}):null,a.render?.(n)]})}export{ho as InspectorPane,po as prepareActs};
@@ -1 +1 @@
1
- import{$d as k,Vd as w,Wd as v,Yd as $,Zd as c,ae as x,ie as f,me as b,ne as S,oe as P,pa as u,pe as A,se as L,te as N}from"./chunk.6HY6ZGEE.js";function T(s){if(!(s.attach==="home"||s.cardinality==="one"||!s.title))return{kind:s.attach,title:s.title,as:$(s.title),name:s.name,lens:"view",...s.hidden?{hidden:!0}:{}}}function G(s,r=[]){let a=[];for(let n of f(s).drawn)for(let i of n.kinds)a.push({kind:i,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of[...s.views?.places?.()??[],...r.flatMap(i=>T(i)??[])])a.some(i=>i.kind===n.kind&&i.as===n.as)||a.push(n);return a}function J(s,r={}){return V(s.schema,G(s,r.views),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function V(s,r,a={}){let{pages:n}=a,i=s.kinds,d=r.filter(e=>i.includes(e.kind)),o=N(n?.first,s,d),O=new Set(n?.hide??[]),p=L(i,n?.order,d),m=p.flatMap(e=>e.view?[]:[e.kind]),E=p.flatMap(e=>e.view?[e.view]:[]),h=[{slug:b,title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...o?.to==="home"||o===void 0&&a.home?{first:!0}:{}},{slug:S,title:A(n),kind:null,cardinality:"many",address:P,stop:"#"}],H=v([...d].sort((e,t)=>m.indexOf(e.kind)-m.indexOf(t.kind))),g=e=>{let t=a.lenses?.find(l=>l.as===e.as&&l.kinds.includes(e.kind)),y=x(e,d);return{slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(l=>i.includes(l))}:{},cardinality:"many",address:k(e.as,y?c(s,e.kind).slice(1):void 0),stop:y?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...t?{lens:t.lens}:{},...e.name!==void 0?{view:e.name}:{},...e.hidden?{hidden:!0}:{},...o?.to==="place"&&o.place.as===e.as&&(o.place.kind===e.kind||e.over?.includes(o.place.kind))?{first:!0}:{}}};for(let e of H)E.some(t=>w(t,e))||h.push(g(e));for(let e of p){if(e.view){h.push(g(e.view));continue}let t=e.kind;h.push({slug:c(s,t).slice(1),title:u(s,t),kind:t,cardinality:"many",address:c(s,t),stop:`#focus=aggregate:${t}`,...O.has(t)?{hidden:!0}:{},...o?.to==="kind"&&o.kind===t?{first:!0}:{}})}return h}export{T as a,J as b,V as c};
1
+ import{$d as k,Vd as w,Wd as v,Yd as $,Zd as c,ae as x,ie as f,me as b,ne as S,oe as P,pa as u,pe as A,se as L,te as N}from"./chunk.ZEZUKRC6.js";function T(s){if(!(s.attach==="home"||s.cardinality==="one"||!s.title))return{kind:s.attach,title:s.title,as:$(s.title),name:s.name,lens:"view",...s.hidden?{hidden:!0}:{}}}function G(s,r=[]){let a=[];for(let n of f(s).drawn)for(let i of n.kinds)a.push({kind:i,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of[...s.views?.places?.()??[],...r.flatMap(i=>T(i)??[])])a.some(i=>i.kind===n.kind&&i.as===n.as)||a.push(n);return a}function J(s,r={}){return V(s.schema,G(s,r.views),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function V(s,r,a={}){let{pages:n}=a,i=s.kinds,d=r.filter(e=>i.includes(e.kind)),o=N(n?.first,s,d),O=new Set(n?.hide??[]),p=L(i,n?.order,d),m=p.flatMap(e=>e.view?[]:[e.kind]),E=p.flatMap(e=>e.view?[e.view]:[]),h=[{slug:b,title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...o?.to==="home"||o===void 0&&a.home?{first:!0}:{}},{slug:S,title:A(n),kind:null,cardinality:"many",address:P,stop:"#"}],H=v([...d].sort((e,t)=>m.indexOf(e.kind)-m.indexOf(t.kind))),g=e=>{let t=a.lenses?.find(l=>l.as===e.as&&l.kinds.includes(e.kind)),y=x(e,d);return{slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(l=>i.includes(l))}:{},cardinality:"many",address:k(e.as,y?c(s,e.kind).slice(1):void 0),stop:y?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...t?{lens:t.lens}:{},...e.name!==void 0?{view:e.name}:{},...e.hidden?{hidden:!0}:{},...o?.to==="place"&&o.place.as===e.as&&(o.place.kind===e.kind||e.over?.includes(o.place.kind))?{first:!0}:{}}};for(let e of H)E.some(t=>w(t,e))||h.push(g(e));for(let e of p){if(e.view){h.push(g(e.view));continue}let t=e.kind;h.push({slug:c(s,t).slice(1),title:u(s,t),kind:t,cardinality:"many",address:c(s,t),stop:`#focus=aggregate:${t}`,...O.has(t)?{hidden:!0}:{},...o?.to==="kind"&&o.kind===t?{first:!0}:{}})}return h}export{T as a,J as b,V as c};
@@ -1 +1 @@
1
- import{b as Ce,d as $e,i as U}from"./chunk.FFOD5B4B.js";import{d as Te}from"./chunk.Z7Y3R3YR.js";import{$d as We,Kc as se,L as ke,Qb as ae,Wd as Re,Zd as De,ae as Me,cb as Se,da as M,fa as xe,ga as W,gb as G,ka as _,la as z,ma as Ae,oa as we,pa as Ne,ve as je,wd as ve,xd as Oe}from"./chunk.6HY6ZGEE.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=ae.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(ae.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&se(a)||k==="allow-tidying"&&!se(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};
1
+ import{b as Ce,d as $e,i as U}from"./chunk.SJQPTDAT.js";import{d as Te}from"./chunk.JQ63N4MZ.js";import{$d as We,Kc as se,L as ke,Qb as ae,Wd as Re,Zd as De,ae as Me,cb as Se,da as M,fa as xe,ga as W,gb as G,ka as _,la as z,ma as Ae,oa as we,pa as Ne,ve as je,wd as ve,xd as Oe}from"./chunk.ZEZUKRC6.js";function V(n,e){return n.display?.labels?.[e]??W(e)}function de(n){let e=U(n);switch(e.type){case"text":case"date":case"number":case"boolean":case"choice":return e.type;default:return}}function Je(n,e){let t=new Map,i=n.tryDefinition(e);for(let[r,a]of Object.entries(i?.edges??{}))t.set(r,{key:r,label:a.description?M(a.description):W(r),about:"edge",far:a.to==="*"?[...n.kinds]:[...a.to]});for(let r of n.definitions)if(r.kind!==e)for(let[a,s]of Object.entries(r.edges??{}))t.has(a)||s.to!=="*"&&!s.to.includes(e)||t.set(a,{key:a,label:s.inverse?M(s.inverse):W(a),about:"edge",far:[r.kind]});return[...t.values()]}var Ze=["current","past","any","flagged","clear"];function Fe(n,e){let t=n?.lifecycle;if(!t||t.retired==="date")return!1;let i=t.retired.map(String);return e.some(r=>r.key===t.field&&i.includes(r.value))}function Be(n,e){let t=n.tryDefinition(e);if(!t)return{kind:e,sorts:[],filters:[],groups:[]};let i=new Set(t.display?.hide??[]),r=t.fields.shape??{},a=[{key:"label",label:"Name",about:"label",type:"text"}],s=[],u=[];for(let[g,k]of Object.entries(r)){if(g==="id"||g==="kind"||g==="label"||i.has(g))continue;let A=en(k);if(A){s.push({key:g,label:V(t,g),about:"field",type:"choice",options:A});continue}let w=de(k);if(!w)continue;let N=V(t,g),O=w==="choice"?Le(k):w==="boolean"?["true","false"]:void 0,S={key:g,label:N,about:"field",type:w,...O?{options:O}:{}};a.push(S),s.push(S),(w==="boolean"||w==="choice")&&u.push(S),w==="date"&&u.push({...S,buckets:["day","week","month","year","decade"]})}for(let g of Je(n,e))a.push(g),s.push(g),u.push(g);let l={key:"is",label:t.lifecycle?"Standing and currency":"Standing",about:"is",type:"choice",options:t.lifecycle?[...Ze]:["flagged","clear"]};s.push(l);let y=t.fieldRoles?.order,f=y&&(y in r||y==="label")?{by:y,direction:"asc"}:void 0;return{kind:e,sorts:a,filters:s,groups:u,...f?{natural:f}:{}}}function On(n,e){let t=[];for(let r of e.filters){let a=r.about==="edge"&&r.far?.length===1?n.tryDefinition(r.far[0]):void 0;if(!(!a||a.kind===e.kind))for(let[s,u]of Object.entries(a.fields.shape??{}))de(u)!=="choice"||a.display?.hide?.includes(s)||t.push({key:`${r.key}.${s}`,label:`${r.label} \xB7 ${V(a,s)}`,about:"via",type:"choice",options:Le(u),far:[a.kind]})}if(t.length===0)return e;let i=e.filters.filter(r=>r.about!=="is");return{...e,filters:[...i,...t,...e.filters.filter(r=>r.about==="is")]}}function Rn(n,e){let t=n.tryDefinition(e.kind),i=Object.entries(t?.computed??{});if(!t||i.length===0)return e;let r=i.filter(([a])=>!e.sorts.some(s=>s.key===a)).map(([a,s])=>({key:a,label:(typeof s=="object"?s.label:void 0)??V(t,a),about:"field",type:"number"}));return{...e,sorts:[...e.sorts,...r]}}function Le(n){let e=U(n);return e.type==="choice"?e.options:[]}function en(n){let e=U(n);return e.type==="several"&&e.of.type==="choice"?e.of.options:void 0}var Ie=n=>n,Pe=n=>n;function nn(n,e,t){let i=new Map;for(let r of[...n.out(e,t),...n.in(e,t)])i.set(r.id,r);return[...i.values()]}function le(n,e,t){let i=n.schema.tryDefinition(e.kind);if(t.key==="is")switch(t.value){case"current":return _(i,Pe(e),n.today);case"past":return!_(i,Pe(e),n.today);case"any":return!0;case"flagged":return n.flagged?.has(e.id)??!1;case"clear":return!(n.flagged?.has(e.id)??!1);default:return!0}let r=i?.fields.shape??{};if(t.key in r){let l=Se(Ie(e),t.key,n.today??ke()),y=de(r[t.key]);if(y==="date"){let[f,g]=t.value.split(":");if(typeof l!="string"||!g)return!1;let k=l.slice(0,10);return f==="before"?k<g:f==="after"?k>g:k===g}if(y==="boolean")return String(l)===t.value;if(Array.isArray(l))return l.some(f=>String(f)===t.value);if(y==="number"){let f=t.value.lastIndexOf(":"),g=f>0?t.value.slice(0,f):"",k=Number(t.value.slice(f+1));if(g==="at-most"||g==="at-least")return typeof l!="number"||!Number.isFinite(k)?!1:g==="at-most"?l<=k:l>=k}return String(l)===t.value}let[a,s]=t.key.split("."),u=nn(n.graph,e.id,a);return s?u.some(l=>String(Ie(l)[s])===t.value):t.value==="*"?u.length>0:t.value==="none"?u.length===0:u.some(l=>l.id===t.value)}var tn=5;function ze(n){return n.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[^\p{L}\p{N}]+/gu," ").trim()}function ce(n){return ze(n).replace(/ /g,"")}var X=new Map,rn=5e4;function $(n){let e=X.get(n);if(e===void 0){X.size>=rn&&X.clear();let t=ze(n);e={tokens:t.split(" ").filter(Boolean),whole:t.replace(/ /g,"")},X.set(n,e)}return e}var T=n=>[...$(n).tokens];function j(n,e){if(e.length===0)return;let{whole:t,tokens:i}=$(n),r=e.join("");if(t.length===0)return;if(t===r)return"exact";if(e.every(s=>i.some(u=>u.startsWith(s))))return t.startsWith(r)?"prefix":e.every(s=>i.includes(s))?"word":"part"}function q(n,e,t=48){let i=n.replace(/\s+/g," ").trim();if(i.length<=t)return i;let r=e[0],a=i.normalize("NFD").replace(/\p{M}/gu,"").toLowerCase(),s=r?a.search(new RegExp(`(^|[^\\p{L}\\p{N}])${on(r)}`,"u")):-1,u=s<0?0:s+(a[s]&&/[\p{L}\p{N}]/u.test(a[s])?0:1),l=Math.max(0,u-Math.floor(t/3));if(l>0){let f=i.lastIndexOf(" ",l);l=f<0?0:f+1}let y=Math.min(i.length,l+t);if(y<i.length){let f=i.indexOf(" ",y);y=f<0||f-y>16?y:f}return`${l>0?"\u2026":""}${i.slice(l,y).trim()}${y<i.length?"\u2026":""}`}var on=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),an=/^([\p{L}][\p{L}\p{N}_-]*):(\S+)$/u;function sn(n){let e=[],t=[];for(let i of n.trim().split(/\s+/).filter(Boolean)){let r=an.exec(i);r?t.push({key:r[1],value:r[2]}):e.push(i)}return{words:e.join(" "),conditions:t}}var Ee=new WeakMap;function Q(n,e){let t=Ee.get(e);if(t&&t.definition===n)return t.texts;let i=dn(n,e);return Ee.set(e,{definition:n,texts:i}),i}function dn(n,e){let t=z(n,e),i=[{field:"label",reading:"Name",text:t}];for(let r of $e(e,n,{limit:Number.POSITIVE_INFINITY}))r.key==="label"||r.value===t||typeof e[r.key]!="boolean"&&i.push({field:r.key,reading:r.label,text:r.markdown?Te(r.value):r.value});return i}var I={exact:0,prefix:1,word:2,part:3,field:4,near:5},Ge=new Set(["a","an","the","of","and","or","for","to","in","on","at","by","with","my","our","is"]);function Ke(n){let e=n;e.length>4&&e.endsWith("ies")?e=`${e.slice(0,-3)}y`:e.length>4&&/(ss|x|ch|sh|z)es$/.test(e)?e=e.slice(0,-2):e.length>3&&e.endsWith("s")&&!/(ss|us|is)$/.test(e)&&(e=e.slice(0,-1));for(let t of["ing","ed"])if(e.length>t.length+2&&e.endsWith(t)){e=e.slice(0,-t.length),/([b-df-hj-km-np-rtv-z])\1$/.test(e)&&(e=e.slice(0,-1));break}return e.length>3&&e.endsWith("e")?e.slice(0,-1):e}function He(n,e,t){if(Math.abs(n.length-e.length)>t)return t+1;let i=[],r=Array.from({length:e.length+1},(a,s)=>s);for(let a=1;a<=n.length;a++){let s=[a],u=a;for(let l=1;l<=e.length;l++){let y=Math.min(r[l]+1,s[l-1]+1,r[l-1]+(n[a-1]===e[l-1]?0:1));a>1&&l>1&&n[a-1]===e[l-2]&&n[a-2]===e[l-1]&&(y=Math.min(y,i[l-2]+1)),s[l]=y,y<u&&(u=y)}if(u>t)return t+1;i=r,r=s}return r[e.length]}var Y=new Map;function ln(n,e){let t=Y.get(n);t||(Y.size>=64&&Y.clear(),Y.set(n,t=new Map));let i=t.get(e);return i===void 0&&(i=cn(n,e)??null,t.set(e,i)),i??void 0}function cn(n,e){if(/\d/.test(n))return;let t=Ke(n);if(t.length>=3&&(Ke(e)===t||t.length>=4&&e.startsWith(t)))return"stem";let i=n.length<4?0:n.length<=7?1:2;if(i!==0){if(He(n,e,i)<=i)return"spelling";if(n.length>=5){for(let r=n.length-i;r<=n.length+i;r++)if(r<e.length&&He(n,e.slice(0,r),i)<=i)return"spelling"}}}function fn(n,e){let t=e.length>1?e.filter(r=>!Ge.has(r)):e;if(t.length===0)return;let i;for(let r of t){let a;for(let s of n){for(let u of $(s.text).tokens){if(u.startsWith(r)){a={text:s,matched:u};break}let l=a?void 0:ln(r,u);l&&(a={text:s,matched:u,by:l})}if(a&&!a.by)break}if(!a)return;a.by&&!i&&(i={text:a.text,asked:r,matched:a.matched,by:a.by})}if(i)return{field:i.text.field,reading:i.text.reading,fragment:q(i.text.text,[i.matched]),strength:"near",asked:i.asked,matched:i.matched,by:i.by}}var un=80;function gn(n,e,t){let i=T(e).filter(s=>!Ge.has(s)).join(" ")||e,r=t===void 0?[]:T(t),a=r.length>0&&n.find(s=>r.every(u=>$(s.text).tokens.some(l=>l.startsWith(u))))||n[0];return{field:a.field,reading:a.reading,fragment:q(a.text,r),strength:"near",asked:i,matched:(t??a.text).slice(0,un),by:"meaning"}}function _e(n,e,t,i){let r=T(t);if(r.length===0)return;if(i){let A=Q(n,e),w=i.includes("label")||i.some(v=>typeof e[v]=="string"&&e[v]===A[0].text),N=A.filter((v,D)=>D===0?w:i.includes(v.field)),O=v=>D=>$(D.text).tokens.some(P=>P.startsWith(v));if(!r.every(v=>N.some(O(v))))return;let S=N.find(O(r[0]));return{field:S.field,reading:S.reading,fragment:q(S.text,r),strength:S.field==="label"?j(S.text,r)??"field":"field"}}let a=Q(n,e),[s,...u]=a,l=j(s.text,r);if(l)return{field:"label",reading:s.reading,fragment:q(s.text,r),strength:l};let y=A=>w=>$(w.text).tokens.some(N=>N.startsWith(A));if(!r.every(A=>a.some(y(A))))return;let f=T(s.text),g=r.find(A=>!f.some(w=>w.startsWith(A)))??r[0],k=u.find(y(g));return{field:k.field,reading:k.reading,fragment:q(k.text,[g]),strength:"field"}}var yn=512,hn=64;function pn(n){let e=new Map;if(n.length===0)return e;let t=n.slice(-yn),i=n[n.length-1].seq;for(let r of t){let a=Math.pow(.5,(i-r.seq)/hn);for(let s of r.writes)e.set(s,(e.get(s)??0)+a)}return e}var ue=(n,e)=>we({tryDefinition:()=>n},e),fe=(n,e)=>De({tryDefinition:()=>n},e);function mn(n,e,t){let i=n.tryDefinition(e),r=[{field:"plural",text:ue(i,e)},{field:"kind",text:W(e)},...i?.noun?[{field:"noun",text:i.noun}]:[],...(i?.aliases??[]).map(s=>({field:"alias",text:s}))],a;for(let s of r){let u=j(s.text,t);u&&(!a||I[u]<I[a.strength])&&(a={strength:u,...s})}return a}var bn,kn=(n,e)=>(bn??=new Intl.Collator(void 0,{sensitivity:"base",numeric:!0})).compare(n,e),qe=(n,e)=>(n.nearly??0)-(e.nearly??0)||(n.archived??0)-(e.archived??0)||n.tier-e.tier||n.inKind-e.inKind||n.near-e.near||n.past-e.past||n.touched-e.touched||n.flagged-e.flagged||kn(n.name,e.name)||(n.id<e.id?-1:n.id>e.id?1:0);function En(n,e,t={}){let i=n.schema,r=sn(e),a=T(r.words),s=t.principal??{kind:"human"},u=n.kindsKeptFrom(s),l=n.modules.disabledKinds,y=r.conditions.filter(o=>o.key==="kind").map(o=>o.value),f=r.conditions.filter(o=>o.key==="is").map(o=>o.value),g=f.includes("any")||f.includes("past"),k=f.includes("past")&&!f.includes("any")&&!f.includes("current"),A=f.includes("archived")?!0:t.archived??"all",w=(o,d)=>{let c=ce(d),h=i.tryDefinition(o);return ce(o)===c||ce(ue(h,o))===c},N=i.kinds.filter(o=>!u.has(o)&&!l.has(o)&&(t.kinds===void 0||t.kinds.includes(o))&&(y.length===0||y.some(d=>w(o,d)))),S=r.conditions.filter(o=>o.key!=="kind").map(o=>({...o,admittedBy:N.filter(d=>Be(i,d).filters.some(c=>c.key===o.key))})),v=S.filter(o=>o.key!=="is"),D=f.filter(o=>o==="flagged"||o==="clear"||o==="past"||o==="archived"),P={kinds:N,past:g},Qe={hits:[],words:r.words,conditions:S,searched:P,byKind:{},total:0,matched:[]};if(a.length===0&&v.length===0&&D.length===0)return Qe;let J=t.today,F=t.flagged??new Set(n.violations().flatMap(o=>o.nodeIds)),Ue=t.touched??pn(n.log.all()),Z=new Set;for(let o of t.from??[]){Z.add(o);for(let d of n.graph.neighbors(o))Z.add(d.id)}let ge=ve(n,s)?Oe(n,s):void 0,ee=ae.keptFrom?.(n,s)&&n.seenBy(s).graph,ne=o=>je(o,t.basePath===void 0?{}:{basePath:t.basePath}),ye={schema:i,graph:n.graph,flagged:F,...J?{today:J}:{}},R=[],B={},L=[],E=[],K=(o,d,c,h,p,m)=>{let x=z(c,o);B[d]=(B[d]??0)+1,R.push({hit:{about:"node",id:o.id,kind:d,label:x,why:p,current:h,flagged:F.has(o.id),address:ne(`${fe(c,d)}/${encodeURIComponent(o.id)}`),...m===void 0?{}:{near:!0},...G(o)?{archived:!0}:{}},...m===void 0?{}:{nearly:2-m},tier:I[p.strength],inKind:d===t.inKind?0:1,near:Z.has(o.id)?0:1,past:h?0:1,archived:G(o)?1:0,touched:-(Ue.get(o.id)??0),flagged:F.has(o.id)?0:1,name:x,id:o.id})};for(let o of N){let d=i.tryDefinition(o),c=S.filter(p=>p.key!=="is"&&p.admittedBy.includes(o));if(a.length===0&&c.length===0&&D.length===0)continue;let h=Fe(d,c);for(let p of n.graph.nodesOfKind(o,{archived:A})){if(ge&&!ge(p.id))continue;let m=ee?ee.getNode(p.id):p;if(!m)continue;let x=_(d,m,J);if(!g&&!h&&!x){if(a.length>0&&f.length===0&&c.every(b=>le(ye,m,b))){let b=_e(d,m,r.words);b&&E.push({node:m,kind:o,definition:d,why:b})}continue}if(k&&x||!c.every(b=>le(ye,m,b))||f.includes("flagged")&&!F.has(m.id)||f.includes("clear")&&F.has(m.id))continue;let C=a.length>0?_e(d,m,r.words):c[0]?{field:c[0].key,reading:W(c[0].key),fragment:`${c[0].key}:${c[0].value}`,strength:"field"}:{field:"is",reading:"Is",fragment:`is:${D[0]}`,strength:"field"};C?K(m,o,d,x,C):a.length>0&&L.push({node:m,kind:o,definition:d,current:x})}}let te=o=>o.strength!=="field",re=!1;if(E.length>0&&R.length===0){re=!0;for(let o of E)K(o.node,o.kind,o.definition,!1,o.why)}else if(E.some(o=>te(o.why))&&!R.some(o=>te(o.hit.why))){re=!0;for(let o of E)te(o.why)&&K(o.node,o.kind,o.definition,!1,o.why)}let he=t.near!==!1&&a.length>0&&R.length<tn&&L.length>0,ie=new Set;if(he)for(let o of L){let d=fn(Q(o.definition,o.node),a);d&&(ie.add(o.node.id),K(o.node,o.kind,o.definition,o.current,d,d.by==="stem"?.9:.8))}let Ve=o=>o==="exact"||o==="prefix"?-1:I[o],oe=(o,d,c,h)=>({hit:o,tier:Ve(d),inKind:1,near:1,past:0,touched:0,flagged:1,name:c,id:h});if(a.length>0){for(let d of N){let c=mn(i,d,a);if(!c)continue;let h=Ne(i,d),p={field:c.field,reading:c.field==="plural"?"Plural":"Kind",fragment:c.text,strength:c.strength};R.push(oe({about:"kind",kind:d,label:h,why:p,count:B[d]??0,address:ne(fe(i.tryDefinition(d),d))},c.strength,h,`kind:${d}`))}let o=t.places??[];for(let d of Re(o.filter(c=>N.includes(c.kind)))){if(d.across&&u.has(d.across))continue;let c=j(d.title,a);if(!c)continue;let h={field:"title",reading:"Title",fragment:d.title,strength:c},p=Me(d,o)?fe(i.tryDefinition(d.kind),d.kind).slice(1):void 0,m=ne(We(d.as,p));R.push(oe({about:"place",kind:d.kind,title:d.title,as:d.as,why:h,address:m},c,d.title,`place:${d.kind}:${d.as}`))}for(let d of n.allInvariants()){let c=d.scope==="graph"?void 0:d.scope.kind;if(c&&!N.includes(c))continue;let h=d.label??W(d.name),p=j(h,a),m=p?void 0:j(W(d.name),a),x=p??m;if(!x)continue;let C={field:p?"label":"name",reading:p?"Rule":"Name",fragment:p?h:d.name,strength:x};R.push(oe({about:"rule",name:d.name,label:h,...c?{kind:c}:{},why:C},x,h,`rule:${d.name}`))}}let pe=()=>{R.sort(qe);let o=t.limit??50,d=R.slice(0,o).map(b=>b.hit),c=d.flatMap(b=>b.about==="node"?[(ee||n.graph).getNode(b.id)]:[]).filter(Boolean),h=Ce(c,b=>i.tryDefinition(b)),p=d.map(b=>b.about==="node"&&h.has(b.id)?{...b,apart:h.get(b.id)}:b),m=Object.values(B).reduce((b,Ye)=>b+Ye,0),x=R.flatMap(b=>b.hit.about==="node"?[b.hit.id]:[]),C=t.subject&&N.includes(String(n.graph.getNode(t.subject)?.kind))?xn(n,t.subject,r.words,{principal:s}):[];return{hits:[...p,...C],words:r.words,conditions:S,searched:re?{...P,past:!0}:P,byKind:{...B},total:m,matched:x}},H=pe(),me=t.rank;if(!he||!me)return H;let be=L.filter(o=>!ie.has(o.node.id)).map(({node:o,kind:d,definition:c})=>({id:o.id,kind:d,label:z(c,o),texts:Q(c,o)}));if(be.length===0)return H;let Xe=(async()=>{let o;try{o=await me(r.words,be)}catch{return H}let d=new Map(L.filter(h=>!ie.has(h.node.id)).map(h=>[h.node.id,h])),c=!1;for(let{id:h,score:p,matched:m}of Array.isArray(o)?o:[]){let x=d.get(h);!x||!(p>0)||(d.delete(h),c=!0,K(x.node,x.kind,x.definition,x.current,gn(Q(x.definition,x.node),r.words,typeof m=="string"?m:void 0),Math.min(1,p)))}return c?pe():H})();return{...H,later:Xe}}function xn(n,e,t,i={}){let r=i.principal??{kind:"human"},a=(ae.keptFrom?.(n,r)?n.seenBy(r):n).graph.getNode(e);if(!a)return[];if(n.kindsKeptFrom(r).has(a.kind))return[];let s=T(t),u=z(n.schema.tryDefinition(a.kind),a),l=[];for(let f of n.allMutations()){let g=f.subject;if(!g||g.kinds!=="*"&&!g.kinds.includes(a.kind))continue;let k=f.derived?.act;if((k==="archive"||k==="merge")&&G(a)||k==="unarchive"&&!G(a)||k==="leave-alone"&&se(a)||k==="allow-tidying"&&!se(a)||!n.permits({name:f.name,args:{[g.arg]:a.id}},r).ok)continue;let A=Ae(f),w=T(A),N=s.filter(v=>w.some(D=>D.startsWith(v))),O=N.length>0?j(A,N):void 0,S=O?{field:"title",reading:"Act",fragment:A,strength:O}:{field:"subject",reading:"On",fragment:u,strength:"field"};l.push({hit:{about:"act",name:f.name,title:A,subject:a.id,why:S,destructive:f.destructive===!0},tier:O?I[O]:I.field+1,inKind:0,near:0,past:f.destructive?1:0,touched:0,flagged:f.pinned?0:1,name:A,id:`act:${f.name}`})}l.sort(qe);let y=l.map(f=>f.hit);return i.limit===void 0?y:y.slice(0,i.limit)}function Kn(n,e){let t=e.kinds.map((a,s)=>{let u=ue(n.tryDefinition(a),a);return s===0?u:u.toLowerCase()}),i=xe(t)||"Nothing";return e.kinds.some(a=>n.tryDefinition(a)?.lifecycle)?e.past?`${M(i)}, past ones included.`:`${M(i)}, current ones; add is:any for past ones.`:`${M(i)}.`}export{V as a,de as b,Je as c,Fe as d,Be as e,On as f,Rn as g,Le as h,Ie as i,Pe as j,nn as k,le as l,ze as m,ce as n,sn as o,_e as p,pn as q,En as r,xn as s,Kn as t};
@@ -1 +1 @@
1
- import{G as h}from"./chunk.MODLZJD4.js";import{Qd as u,Sc as a,ed as m}from"./chunk.6HY6ZGEE.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
1
+ import{G as h}from"./chunk.A5PSEU3W.js";import{Qd as u,Sc as a,ed as m}from"./chunk.ZEZUKRC6.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function g(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.publishing?{publishing:e.publishing}:{},...e.tidying?{tidying:e.tidying}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{g as a,k as b,v as c};
@@ -1,3 +1,3 @@
1
- import"./chunk.DPJNGFEZ.js";import{a as _,b as me,c as he,e as fe}from"./chunk.ONYBW45K.js";import"./chunk.2VR7YEJ6.js";import"./chunk.LETAQTLJ.js";import"./chunk.BUVTUAB5.js";import"./chunk.HJCQ6I3S.js";import{a as we,d as ve}from"./chunk.OJY7VJ7D.js";import"./chunk.GEFXU4VO.js";import{d as ye}from"./chunk.WSO7JOW5.js";import"./chunk.XOE4KNP2.js";import{a as de}from"./chunk.2KFZHUAC.js";import"./chunk.V5I4GZEY.js";import"./chunk.FIFUMX5X.js";import"./chunk.BIDL7GQD.js";import"./chunk.V7W5AQKL.js";import"./chunk.EMFOMSMI.js";import"./chunk.QOS5T46W.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.4FCFNAA4.js";import"./chunk.4AC2QM7T.js";import"./chunk.JXNVNFV4.js";import"./chunk.WVUJXDXZ.js";import"./chunk.I2737CPF.js";import"./chunk.NJRLJEJY.js";import"./chunk.CVPMSPCH.js";import"./chunk.OTV5XTBB.js";import"./chunk.KBPJ7X7W.js";import"./chunk.OEIWIZCP.js";import"./chunk.MIE4TJRW.js";import{p as pe,s as K}from"./chunk.5LJVOLKR.js";import"./chunk.OJGHDWI6.js";import{a as ue}from"./chunk.OWFS2YDQ.js";import"./chunk.WSDJPXJD.js";import"./chunk.F4VB6Q2W.js";import"./chunk.FFOD5B4B.js";import{b as ce}from"./chunk.Z7Y3R3YR.js";import"./chunk.YXEO3Y65.js";import{t as ge}from"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as Ee,K as L,Qa as le,Ra as W,W as ie,Z as se,ea as P,ga as $,j as N,l as ae,m as q,r as C,ra as G,v as re,z as oe}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{Z as V,ka as I,la as B,na as F,pa as M,td as ne,ua as te}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as D}from"./chunk.AJZBJBMO.js";var p=D(Ee(),1);var e=D(ie(),1),Ae=ge.part((t,s)=>(0,e.jsx)(t.ProblemRows,{...s}),{what:"The problems",as:"li"}),R="var(--graview-gap, 8px)",Re=720;function je({showing:t}){return t.what==="lens"?(0,e.jsx)(Ne,{kind:t.kind},`lens:${t.kind}`):t.what==="record"?(0,e.jsx)(Ie,{id:t.id},`record:${t.id}`):(0,e.jsx)($e,{kind:t.kind},`district:${t.kind}`)}var U=[{height:"52%",share:.52,said:"Half of the screen"},{height:"66%",share:.66,said:"Two thirds of the screen"},{height:"calc(100% - 56px)",share:1,said:"Nearly all of the screen"}],xe=1,be=xe;function Ce(){let[t,s]=(0,p.useState)(be);return[t,n=>{be=n,s(n)}]}var Pe=t=>U.map(s=>s.share===1?t-56:t*s.share);function Te({region:t,rest:s,setRest:n,label:i}){let l=(0,p.useRef)(null),c=o=>n(Math.max(0,Math.min(2,o)));return(0,e.jsx)("div",{role:"separator","aria-orientation":"horizontal","aria-label":`How much of the screen ${i} takes`,"aria-valuemin":0,"aria-valuemax":2,"aria-valuenow":s,"aria-valuetext":U[s].said,tabIndex:0,"data-testid":"map-panel-handle","data-graview-rest":s,title:"Drag to see more or less of the map",onKeyDown:o=>{let r=o.key==="ArrowUp"?s+1:o.key==="ArrowDown"?s-1:o.key==="Home"?0:o.key==="End"?2:null;r!==null&&(o.preventDefault(),c(r))},onPointerDown:o=>{let r=t.current,u=r?.parentElement?.getBoundingClientRect().height??0;if(!(!r||u<=0||o.button!==0)){o.stopPropagation(),l.current={id:o.pointerId,from:o.clientY,height:r.getBoundingClientRect().height,rests:Pe(u)},r.style.transition="none";try{o.currentTarget.setPointerCapture(o.pointerId)}catch{}}},onPointerMove:o=>{let r=l.current,u=t.current;if(!r||!u||o.pointerId!==r.id)return;let g=r.rests;u.style.height=`${Math.round(Math.max(g[0]-24,Math.min(g[2],r.height+r.from-o.clientY)))}px`},onPointerUp:o=>{let r=l.current,u=t.current;if(l.current=null,!r||!u)return;let g=u.getBoundingClientRect().height;u.style.transition="",u.style.height="",Math.abs(o.clientY-r.from)<6?c(s===2?xe:s+1):c(r.rests.reduce((f,d,w)=>Math.abs(d-g)<Math.abs(r.rests[f]-g)?w:f,0))},onPointerCancel:()=>{let o=t.current;l.current=null,o&&(o.style.transition="",o.style.height="")},style:{flex:"0 0 auto",display:"flex",justifyContent:"center",alignItems:"center",height:22,cursor:"ns-resize",touchAction:"none"},children:(0,e.jsx)("span",{"aria-hidden":"true",style:{width:40,height:4,borderRadius:2,background:"var(--graview-edge-strong, var(--graview-edge))"}})})}function X({label:t,wide:s,testId:n,head:i,onClose:l,children:c}){let o=(0,p.useRef)(null),[r,u]=(0,p.useState)(!1),[g,f]=Ce(),d=U[g].height;(0,p.useLayoutEffect)(()=>{let v=o.current?.parentElement;if(!v)return;let S=()=>u(v.getBoundingClientRect().width<Re);if(S(),typeof ResizeObserver>"u")return;let h=new ResizeObserver(S);return h.observe(v),()=>h.disconnect()},[]);let w=(0,p.useRef)(l);return w.current=l,(0,p.useEffect)(()=>{let v=k=>{if(k.key!=="Escape"||k.defaultPrevented)return;let A=document.activeElement;A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement||document.querySelector("[data-graview-popover]:popover-open")||S||w.current()},S=!1,h=()=>{S=document.querySelector('[data-testid="following-who"]')!==null};return window.addEventListener("keydown",h,!0),document.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",h,!0),document.removeEventListener("keydown",v)}},[]),(0,e.jsxs)("section",{ref:o,"aria-label":t,"data-testid":n,"data-graview-map-panel":r?"sheet":"dock","data-graview-overlay":"","data-graview-offstage":"",className:"graview-map-panel",style:{position:"absolute",zIndex:ne("rail"),boxSizing:"border-box",display:"flex",flexDirection:"column",background:"var(--graview-panel)",color:"var(--graview-ink)",overflow:"hidden",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",boxShadow:"var(--graview-lift-high)",...r?{left:R,right:R,bottom:`calc(${R} + env(safe-area-inset-bottom, 0px))`,height:d,transition:"height 180ms ease-out"}:{top:R,right:R,bottom:R,width:s}},children:[r?(0,e.jsx)("style",{children:`:has(> [data-graview-map-panel="sheet"]) { --graview-sheet: calc(${d} + 2 * ${R} + env(safe-area-inset-bottom, 0px)); }`}):(0,e.jsx)("style",{children:`:has(> [data-graview-map-panel="dock"]) { --graview-dock: calc(${s} + 2 * ${R}); }`}),r?(0,e.jsx)(Te,{region:o,rest:g,setRest:f,label:t}):null,(0,e.jsxs)("header",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:r?"4px 14px 10px 18px":"14px 14px 10px 18px",borderBottom:"1px solid var(--graview-edge)"},children:[(0,e.jsx)("div",{style:{flex:"1 1 auto",minWidth:0},children:i}),(0,e.jsx)("button",{type:"button","data-testid":"map-panel-close","aria-label":"Close",title:"Close (Escape)",onClick:l,style:{flex:"0 0 auto",minWidth:32,height:32,borderRadius:8,fontSize:"1.1rem",lineHeight:1},children:"\xD7"})]}),(0,e.jsx)("div",{style:{flex:"1 1 auto",minHeight:0,overflow:"auto"},children:c})]})}var J={fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},Q={margin:"2px 0 0",fontSize:"1.125rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},Z={margin:"4px 0 0",fontSize:"0.875rem",color:"var(--graview-ink-muted)"},j={margin:"14px 18px 6px",fontSize:"0.8125rem",fontWeight:600,color:"var(--graview-ink-muted)"},z={listStyle:"none",margin:0,padding:"0 10px 6px"},Y={all:"unset",outline:"revert-layer",boxSizing:"border-box",display:"flex",alignItems:"baseline",gap:8,width:"100%",padding:"6px 8px",borderRadius:6,cursor:"pointer",fontSize:"0.875rem"},H={minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem"};function ee(){let{setSelection:t,setMenuAt:s}=P();return(n,i)=>{n.preventDefault(),t([i]),s({x:n.clientX,y:n.clientY,on:i})}}function Se({on:t,about:s}){let{setSelection:n,setMenuAt:i}=P();return(0,e.jsx)("button",{type:"button","data-testid":"map-panel-acts","aria-label":`What can be done with ${s}`,"aria-haspopup":"menu",style:H,onClick:l=>{let c=l.currentTarget.getBoundingClientRect();n([t]),i({x:Math.round(c.left),y:Math.round(c.bottom+4),on:t})},children:"Acts\u2026"})}var ke=(t,s)=>({...N(q(t,!1),s),relation:null});function Me(t,s){let n=`[data-graview-stage] [data-graview-view="${CSS.escape(t)}"][tabindex]`,i=null;for(let r=s?.parentElement??null;r&&!i;r=r.parentElement)i=r.querySelector(".graview-ground");i??=document.querySelector(".graview-ground");let l=i!==null&&!i.hasAttribute("tabindex");i&&l&&(i.setAttribute("tabindex","-1"),i.addEventListener("focusout",r=>{r.target===i&&i.removeAttribute("tabindex")},{once:!0})),i?.focus({preventScroll:!0});let c=performance.now()+5e3,o=()=>{let r=document.activeElement;if(!(r===null||r===document.body||r===document.documentElement||r===s||r===i))return;let g=document.querySelector(n);if(g&&g.isConnected&&!g.closest("[inert]"))return g.focus({preventScroll:!0});performance.now()<c&&requestAnimationFrame(o)};requestAnimationFrame(o)}function Ne({kind:t}){let s=ee(),{store:n,views:i,view:l,selection:c,setSelection:o}=P(),{go:r}=W(),u=$(),g=l.within?.view,f=i.places().filter(b=>b.kind===t),d=(g!==void 0?f.find(b=>b.as===g):void 0)??f.at(-1),w=i.resolve(t,{cardinality:"many",fidelity:"full"},d?.as??g),v=w?.view,S=n.schema.tryDefinition(t),h=(0,p.useMemo)(()=>n.graph.nodesOfKind(t).filter(b=>l.past===!0||I(S,b)),[n,t,u,l.past,S]),k=w?.title??d?.title??M(n.schema,t),A=v!==void 0&&G(v),m=c.filter(b=>n.graph.getNode(b)!==void 0),y=ue();return(0,e.jsxs)(X,{label:k,testId:"lens-panel",wide:"min(max(440px, 46%), 760px)",onClose:()=>r(ae(N(l,null),"view",null)),head:A?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:J,children:M(n.schema,t)}),(0,e.jsx)("h2",{style:Q,"data-testid":"lens-panel-title",children:k}),(0,e.jsxs)("p",{style:Z,children:[F(n.schema,t,h.length),S?.description?` \xB7 ${S.description}`:""]}),d?(0,e.jsx)("div",{style:{marginTop:10},children:(0,e.jsx)("button",{type:"button","data-testid":"lens-panel-open",style:H,title:`Open ${k} on its own`,onClick:()=>r(oe(l,t,d.as)),children:"Open \u2197"})}):null]}),children:[(0,e.jsx)("style",{children:`.graview-ground[data-graview-altitude] .graview-plot:not([data-graview-plot="${C(t)}"]) { opacity: 0.35; }
1
+ import"./chunk.DEKRFTRN.js";import{a as _,b as me,c as he,e as fe}from"./chunk.SY5ID44D.js";import"./chunk.GVT4UUQA.js";import"./chunk.J6HF7IRQ.js";import"./chunk.LRNFE3UK.js";import"./chunk.HJCQ6I3S.js";import{a as we,d as ve}from"./chunk.YCD4JSXD.js";import"./chunk.ZG5VGP5U.js";import{d as ye}from"./chunk.QAM76AXV.js";import"./chunk.Z27NSSYL.js";import{a as de}from"./chunk.WEMUKZKH.js";import"./chunk.T27QKVKP.js";import"./chunk.URQTF5SY.js";import"./chunk.BIDL7GQD.js";import"./chunk.LP2ZMAT2.js";import"./chunk.MSAYU25L.js";import"./chunk.EGPCVMDU.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.6SJEZWH3.js";import"./chunk.6N4PE3U5.js";import"./chunk.B7KZBT27.js";import"./chunk.WVUJXDXZ.js";import"./chunk.DWM7AR5Y.js";import"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.MIE4TJRW.js";import{p as pe,s as K}from"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import{a as ue}from"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import{b as ce}from"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{t as ge}from"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as Ee,K as L,Qa as le,Ra as W,W as ie,Z as se,ea as P,ga as $,j as N,l as ae,m as q,r as C,ra as G,v as re,z as oe}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Z as V,ka as I,la as B,na as F,pa as M,td as ne,ua as te}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as D}from"./chunk.AJZBJBMO.js";var p=D(Ee(),1);var e=D(ie(),1),Ae=ge.part((t,s)=>(0,e.jsx)(t.ProblemRows,{...s}),{what:"The problems",as:"li"}),R="var(--graview-gap, 8px)",Re=720;function je({showing:t}){return t.what==="lens"?(0,e.jsx)(Ne,{kind:t.kind},`lens:${t.kind}`):t.what==="record"?(0,e.jsx)(Ie,{id:t.id},`record:${t.id}`):(0,e.jsx)($e,{kind:t.kind},`district:${t.kind}`)}var U=[{height:"52%",share:.52,said:"Half of the screen"},{height:"66%",share:.66,said:"Two thirds of the screen"},{height:"calc(100% - 56px)",share:1,said:"Nearly all of the screen"}],xe=1,be=xe;function Ce(){let[t,s]=(0,p.useState)(be);return[t,n=>{be=n,s(n)}]}var Pe=t=>U.map(s=>s.share===1?t-56:t*s.share);function Te({region:t,rest:s,setRest:n,label:i}){let l=(0,p.useRef)(null),c=o=>n(Math.max(0,Math.min(2,o)));return(0,e.jsx)("div",{role:"separator","aria-orientation":"horizontal","aria-label":`How much of the screen ${i} takes`,"aria-valuemin":0,"aria-valuemax":2,"aria-valuenow":s,"aria-valuetext":U[s].said,tabIndex:0,"data-testid":"map-panel-handle","data-graview-rest":s,title:"Drag to see more or less of the map",onKeyDown:o=>{let r=o.key==="ArrowUp"?s+1:o.key==="ArrowDown"?s-1:o.key==="Home"?0:o.key==="End"?2:null;r!==null&&(o.preventDefault(),c(r))},onPointerDown:o=>{let r=t.current,u=r?.parentElement?.getBoundingClientRect().height??0;if(!(!r||u<=0||o.button!==0)){o.stopPropagation(),l.current={id:o.pointerId,from:o.clientY,height:r.getBoundingClientRect().height,rests:Pe(u)},r.style.transition="none";try{o.currentTarget.setPointerCapture(o.pointerId)}catch{}}},onPointerMove:o=>{let r=l.current,u=t.current;if(!r||!u||o.pointerId!==r.id)return;let g=r.rests;u.style.height=`${Math.round(Math.max(g[0]-24,Math.min(g[2],r.height+r.from-o.clientY)))}px`},onPointerUp:o=>{let r=l.current,u=t.current;if(l.current=null,!r||!u)return;let g=u.getBoundingClientRect().height;u.style.transition="",u.style.height="",Math.abs(o.clientY-r.from)<6?c(s===2?xe:s+1):c(r.rests.reduce((f,d,w)=>Math.abs(d-g)<Math.abs(r.rests[f]-g)?w:f,0))},onPointerCancel:()=>{let o=t.current;l.current=null,o&&(o.style.transition="",o.style.height="")},style:{flex:"0 0 auto",display:"flex",justifyContent:"center",alignItems:"center",height:22,cursor:"ns-resize",touchAction:"none"},children:(0,e.jsx)("span",{"aria-hidden":"true",style:{width:40,height:4,borderRadius:2,background:"var(--graview-edge-strong, var(--graview-edge))"}})})}function X({label:t,wide:s,testId:n,head:i,onClose:l,children:c}){let o=(0,p.useRef)(null),[r,u]=(0,p.useState)(!1),[g,f]=Ce(),d=U[g].height;(0,p.useLayoutEffect)(()=>{let v=o.current?.parentElement;if(!v)return;let S=()=>u(v.getBoundingClientRect().width<Re);if(S(),typeof ResizeObserver>"u")return;let h=new ResizeObserver(S);return h.observe(v),()=>h.disconnect()},[]);let w=(0,p.useRef)(l);return w.current=l,(0,p.useEffect)(()=>{let v=k=>{if(k.key!=="Escape"||k.defaultPrevented)return;let A=document.activeElement;A instanceof HTMLInputElement||A instanceof HTMLTextAreaElement||document.querySelector("[data-graview-popover]:popover-open")||S||w.current()},S=!1,h=()=>{S=document.querySelector('[data-testid="following-who"]')!==null};return window.addEventListener("keydown",h,!0),document.addEventListener("keydown",v),()=>{window.removeEventListener("keydown",h,!0),document.removeEventListener("keydown",v)}},[]),(0,e.jsxs)("section",{ref:o,"aria-label":t,"data-testid":n,"data-graview-map-panel":r?"sheet":"dock","data-graview-overlay":"","data-graview-offstage":"",className:"graview-map-panel",style:{position:"absolute",zIndex:ne("rail"),boxSizing:"border-box",display:"flex",flexDirection:"column",background:"var(--graview-panel)",color:"var(--graview-ink)",overflow:"hidden",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",boxShadow:"var(--graview-lift-high)",...r?{left:R,right:R,bottom:`calc(${R} + env(safe-area-inset-bottom, 0px))`,height:d,transition:"height 180ms ease-out"}:{top:R,right:R,bottom:R,width:s}},children:[r?(0,e.jsx)("style",{children:`:has(> [data-graview-map-panel="sheet"]) { --graview-sheet: calc(${d} + 2 * ${R} + env(safe-area-inset-bottom, 0px)); }`}):(0,e.jsx)("style",{children:`:has(> [data-graview-map-panel="dock"]) { --graview-dock: calc(${s} + 2 * ${R}); }`}),r?(0,e.jsx)(Te,{region:o,rest:g,setRest:f,label:t}):null,(0,e.jsxs)("header",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:r?"4px 14px 10px 18px":"14px 14px 10px 18px",borderBottom:"1px solid var(--graview-edge)"},children:[(0,e.jsx)("div",{style:{flex:"1 1 auto",minWidth:0},children:i}),(0,e.jsx)("button",{type:"button","data-testid":"map-panel-close","aria-label":"Close",title:"Close (Escape)",onClick:l,style:{flex:"0 0 auto",minWidth:32,height:32,borderRadius:8,fontSize:"1.1rem",lineHeight:1},children:"\xD7"})]}),(0,e.jsx)("div",{style:{flex:"1 1 auto",minHeight:0,overflow:"auto"},children:c})]})}var J={fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},Q={margin:"2px 0 0",fontSize:"1.125rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},Z={margin:"4px 0 0",fontSize:"0.875rem",color:"var(--graview-ink-muted)"},j={margin:"14px 18px 6px",fontSize:"0.8125rem",fontWeight:600,color:"var(--graview-ink-muted)"},z={listStyle:"none",margin:0,padding:"0 10px 6px"},Y={all:"unset",outline:"revert-layer",boxSizing:"border-box",display:"flex",alignItems:"baseline",gap:8,width:"100%",padding:"6px 8px",borderRadius:6,cursor:"pointer",fontSize:"0.875rem"},H={minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem"};function ee(){let{setSelection:t,setMenuAt:s}=P();return(n,i)=>{n.preventDefault(),t([i]),s({x:n.clientX,y:n.clientY,on:i})}}function Se({on:t,about:s}){let{setSelection:n,setMenuAt:i}=P();return(0,e.jsx)("button",{type:"button","data-testid":"map-panel-acts","aria-label":`What can be done with ${s}`,"aria-haspopup":"menu",style:H,onClick:l=>{let c=l.currentTarget.getBoundingClientRect();n([t]),i({x:Math.round(c.left),y:Math.round(c.bottom+4),on:t})},children:"Acts\u2026"})}var ke=(t,s)=>({...N(q(t,!1),s),relation:null});function Me(t,s){let n=`[data-graview-stage] [data-graview-view="${CSS.escape(t)}"][tabindex]`,i=null;for(let r=s?.parentElement??null;r&&!i;r=r.parentElement)i=r.querySelector(".graview-ground");i??=document.querySelector(".graview-ground");let l=i!==null&&!i.hasAttribute("tabindex");i&&l&&(i.setAttribute("tabindex","-1"),i.addEventListener("focusout",r=>{r.target===i&&i.removeAttribute("tabindex")},{once:!0})),i?.focus({preventScroll:!0});let c=performance.now()+5e3,o=()=>{let r=document.activeElement;if(!(r===null||r===document.body||r===document.documentElement||r===s||r===i))return;let g=document.querySelector(n);if(g&&g.isConnected&&!g.closest("[inert]"))return g.focus({preventScroll:!0});performance.now()<c&&requestAnimationFrame(o)};requestAnimationFrame(o)}function Ne({kind:t}){let s=ee(),{store:n,views:i,view:l,selection:c,setSelection:o}=P(),{go:r}=W(),u=$(),g=l.within?.view,f=i.places().filter(b=>b.kind===t),d=(g!==void 0?f.find(b=>b.as===g):void 0)??f.at(-1),w=i.resolve(t,{cardinality:"many",fidelity:"full"},d?.as??g),v=w?.view,S=n.schema.tryDefinition(t),h=(0,p.useMemo)(()=>n.graph.nodesOfKind(t).filter(b=>l.past===!0||I(S,b)),[n,t,u,l.past,S]),k=w?.title??d?.title??M(n.schema,t),A=v!==void 0&&G(v),m=c.filter(b=>n.graph.getNode(b)!==void 0),y=ue();return(0,e.jsxs)(X,{label:k,testId:"lens-panel",wide:"min(max(440px, 46%), 760px)",onClose:()=>r(ae(N(l,null),"view",null)),head:A?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:J,children:M(n.schema,t)}),(0,e.jsx)("h2",{style:Q,"data-testid":"lens-panel-title",children:k}),(0,e.jsxs)("p",{style:Z,children:[F(n.schema,t,h.length),S?.description?` \xB7 ${S.description}`:""]}),d?(0,e.jsx)("div",{style:{marginTop:10},children:(0,e.jsx)("button",{type:"button","data-testid":"lens-panel-open",style:H,title:`Open ${k} on its own`,onClick:()=>r(oe(l,t,d.as)),children:"Open \u2197"})}):null]}),children:[(0,e.jsx)("style",{children:`.graview-ground[data-graview-altitude] .graview-plot:not([data-graview-plot="${C(t)}"]) { opacity: 0.35; }
2
2
  .graview-ground[data-graview-altitude] [data-graview-view^="kind:"]:not([data-graview-view="${C(t)}"]) { opacity: 0.4; }`}),(0,e.jsx)("div",{"data-graview-lens":d?.as??"",style:{padding:"8px 12px 16px",minHeight:"100%",boxSizing:"border-box",display:"grid",gridTemplateRows:"1fr",gridTemplateColumns:"minmax(0, 1fr)",alignItems:"start"},onClick:b=>{let a=L(b.target);if(!a||n.graph.getNode(a)===void 0)return;let x=b.target.closest("button, a, input, select, textarea, [contenteditable='true']");x&&!x.hasAttribute("data-graview-pick")||o([a])},onDoubleClick:b=>{let a=L(b.target);!a||n.graph.getNode(a)===void 0||r(ke(l,a))},onContextMenu:b=>{let a=L(b.target);!a||n.graph.getNode(a)===void 0||s(b,a)},children:v?(0,e.jsx)(de.Provider,{value:k,children:(0,e.jsx)(se,{mode:"fullscreen",children:(0,e.jsx)(K,{kind:t,...w?.title?{view:w.title}:{},children:(0,e.jsx)(v,{nodes:h,label:k,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...m.length>0?{implicated:m}:{},...y.length>0?{flagged:y}:{}})})})}):null})]})}function He(t,s,n,i){let l=i(n),c=new Map;for(let o of s){let r=o.from===n;if(!r&&o.to!==n)continue;let u=r?o.to:o.from,g=i(u);if(g===void 0||l===void 0)continue;let f=`${o.kind}|${r?"out":"in"}|${g}`,d=c.get(f);if(d){d.others.includes(u)||d.others.push(u);continue}c.set(f,{key:f,edge:o.kind,words:ce(t,r?l:g,o.kind,r?"out":"in"),kind:g,others:[u]})}return[...c.values()]}function Ie({id:t}){let s=ee(),{store:n,views:i,view:l,setSelection:c}=P(),{go:o}=W(),r=$(),u=n.graph.getNode(t),g=m=>n.graph.getNode(m)?.kind,f=(0,p.useMemo)(()=>He(n.schema,n.graph.allEdges(),t,g),[n,t,r]);if(!u)return null;let d=u.kind,w=m=>{let y=n.graph.getNode(m);return y?B(n.schema.tryDefinition(y.kind),y):m},v=te(n.schema.tryDefinition(d),d),h=i.resolve(d,{cardinality:"one",fidelity:"full"})?.view,k=h!==void 0&&!G(h),A=()=>l.focusId===t?o({...N(l,null),selection:[]}):c([]);return(0,e.jsxs)(X,{label:`${w(t)}: its links`,testId:"record-panel",wide:k?"min(max(440px, 46%), 760px)":"min(360px, 40%)",onClose:A,head:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:J,children:v}),(0,e.jsx)("h2",{style:Q,"data-testid":"record-panel-title",children:w(t)}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:10},children:[(0,e.jsx)("button",{type:"button","data-testid":"record-panel-go",style:H,onClick:m=>{o(ke(l,t)),Me(t,m.currentTarget)},children:"Go to it"}),(0,e.jsx)(Se,{on:t,about:w(t)}),(0,e.jsxs)("button",{type:"button","data-testid":"record-panel-district",style:H,onClick:()=>c([C(d)]),children:["All ",M(n.schema,d).toLowerCase()]})]})]}),children:[(0,e.jsx)("div",{"data-graview-record-card":t,style:{padding:"8px 18px 0"},children:k?(0,e.jsx)(K,{kind:d,children:(0,e.jsx)(h,{node:u,fidelity:"full",cardinality:"one",mode:"fullscreen",selected:!1})}):(0,e.jsx)(ye,{id:t,shown:[w(t)]})}),f.length===0?(0,e.jsx)("p",{style:{...Z,margin:"14px 18px"},children:"No links yet."}):null,f.map(m=>(0,e.jsxs)("section",{"aria-label":m.words,"data-graview-links":m.edge,children:[(0,e.jsxs)("h3",{style:j,children:[m.words.charAt(0).toUpperCase()+m.words.slice(1)," ",(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-faint)"},children:["\xB7 ",m.others.length]})]}),(0,e.jsx)("ul",{style:z,children:m.others.map(y=>(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",className:"graview-map-panel-row","data-graview-record":y,style:Y,onClick:()=>c([y]),onContextMenu:T=>s(T,y),children:[(0,e.jsx)("span",{style:{flex:"1 1 auto",minWidth:0,overflowWrap:"anywhere"},children:w(y)}),m.kind!==d?null:(0,e.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:v})]})},y))})]},m.key))]})}var Le=24;function $e({kind:t}){let s=ee(),{store:n,view:i,setSelection:l,setEmphasis:c}=P(),{go:o}=W(),r=$(),[u,g]=(0,p.useState)(""),f=n.schema.tryDefinition(t),d=(0,p.useMemo)(()=>n.graph.nodesOfKind(t).filter(a=>i.past===!0||I(f,a)).map(a=>({id:a.id,name:B(f,a)})).sort((a,x)=>a.name.localeCompare(x.name)),[n,t,r,i.past,f]),w=(0,p.useMemo)(()=>{let a=E=>{let O=n.graph.getNode(E);return O!==void 0&&(i.past===!0||I(n.schema.tryDefinition(O.kind),O))},x=n.graph.allEdges().filter(E=>a(E.from)&&a(E.to));return we(x,E=>n.graph.getNode(E)?.kind).filter(E=>E.from===t||E.to===t)},[n,t,r,i.past]);(0,p.useEffect)(()=>()=>c(null),[c]);let v=le(),S=pe().marks.flag,h=(0,p.useMemo)(()=>{let a=new Set(d.map(x=>x.id));return v.filter(x=>x.nodeIds.some(E=>a.has(E)))},[v,d]),k=(0,p.useMemo)(()=>[...new Set(h.flatMap(a=>a.nodeIds))].filter(a=>n.graph.getNode(a)?.kind===t).slice(0,300),[h,n,t]),A=(0,p.useRef)(null),m=(0,p.useSyncExternalStore)(me,_,_);(0,p.useEffect)(()=>{m?.kind!==t||h.length===0||(A.current?.scrollIntoView?.({block:"start"}),A.current?.focus({preventScroll:!0}))},[m?.n,m?.kind,t,h.length>0]),(0,p.useEffect)(()=>()=>{he(),setTimeout(()=>{let a=document.activeElement;if(a&&a!==document.body)return;let x=CSS.escape(t);document.querySelector(`[data-testid="district-problems-${x}"]`)?.focus({preventScroll:!0})??document.querySelector(`[data-graview-view="${C(t).replace(/["\\]/g,"\\$&")}"]`)?.focus({preventScroll:!0})},0)},[t]);let y=M(n.schema,t),T=u.trim().toLowerCase(),b=T?d.filter(a=>a.name.toLowerCase().includes(T)):d;return(0,e.jsxs)(X,{label:y,testId:"district-panel",wide:"min(360px, 40%)",onClose:()=>l([]),head:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:J,children:"District"}),(0,e.jsx)("h2",{style:Q,"data-testid":"district-panel-title",children:y}),(0,e.jsxs)("p",{style:Z,children:[F(n.schema,t,d.length),f?.description?` \xB7 ${f.description}`:""]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:10},children:[(0,e.jsx)("button",{type:"button","data-testid":"district-panel-go",style:H,onClick:()=>o({...N(q(i,!1),re(t)),relation:null}),children:"Go in"}),(0,e.jsx)(Se,{on:C(t),about:`the ${y.toLowerCase()}`})]})]}),children:[h.length>0?(0,e.jsxs)("section",{"aria-label":"Problems","data-testid":"district-problems","data-graview-problems":h.length,children:[(0,e.jsx)("style",{children:`${k.map(a=>`.graview-ground[data-graview-altitude] .graview-building[data-graview-building="${CSS.escape(a)}"] polygon`).join(`,
3
3
  `)} { stroke: var(--graview-accent); stroke-width: 2.2; stroke-opacity: 1; }`}),(0,e.jsxs)("h3",{ref:A,tabIndex:-1,"data-testid":"district-problems-heading",style:{display:"flex",alignItems:"baseline",gap:8,margin:0,padding:"14px 18px 8px",fontSize:"0.9375rem",fontWeight:600,color:"var(--graview-warn)",borderTop:"1px solid var(--graview-edge)",scrollMarginTop:0,outlineOffset:-2},children:[(0,e.jsx)("span",{"aria-hidden":"true",children:S}),(0,e.jsx)("span",{style:{color:"var(--graview-ink)"},children:fe(h.length,y)})]}),(0,e.jsx)("ol",{style:z,"data-testid":"district-problem-rows",children:(0,e.jsx)(p.Suspense,{fallback:null,children:(0,e.jsx)(Ae,{violations:h,pick:a=>{let x=a.subjectId??a.nodeIds[0];x!==void 0&&l([x])}})})})]}):null,w.length>0?(0,e.jsxs)("section",{"aria-label":"Relations",children:[(0,e.jsx)("h3",{style:j,children:"Relations"}),(0,e.jsx)("ul",{style:z,children:w.map(a=>(0,e.jsx)("li",{children:(0,e.jsxs)("div",{"data-graview-relation-said":a.edge,tabIndex:0,style:{...Y,cursor:"default"},onPointerEnter:()=>c(a.edge),onPointerLeave:()=>c(null),onFocus:()=>c(a.edge),onBlur:()=>c(null),children:[(0,e.jsx)("span",{style:{flex:"1 1 auto",minWidth:0},children:ve(n.schema,a)}),(0,e.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},title:`${V(a.links)} links`,children:V(a.links)})]})},a.key))})]}):null,(0,e.jsxs)("div",{role:"group","aria-label":y,children:[(0,e.jsxs)("h3",{style:j,children:[y," ",(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-faint)"},children:["\xB7 ",d.length]})]}),d.length>Le?(0,e.jsx)("div",{style:{padding:"0 18px 6px"},children:(0,e.jsx)("input",{type:"search","data-testid":"district-panel-narrow","aria-label":`Narrow the ${y.toLowerCase()} by name`,placeholder:"Narrow by name",value:u,onChange:a=>g(a.target.value),style:{width:"100%",boxSizing:"border-box",minHeight:32}})}):null,(0,e.jsx)("ul",{style:z,children:b.map(a=>(0,e.jsx)("li",{children:(0,e.jsx)("button",{type:"button",className:"graview-map-panel-row","data-graview-record":a.id,style:Y,onClick:()=>l([a.id]),onContextMenu:x=>s(x,a.id),children:(0,e.jsx)("span",{style:{flex:"1 1 auto",minWidth:0,overflowWrap:"anywhere"},children:a.name})})},a.id))})]})]})}export{je as MapPanelFor};
@@ -1 +1 @@
1
- import{a as f}from"./chunk.GME63ZHI.js";import{la as d}from"./chunk.6HY6ZGEE.js";function S(e){let o=e.indexOf("{"),a=e.indexOf("["),t=a!==-1&&(o===-1||a<o)?a:o;if(t===-1)return;let n=e[t],r=n==="["?"]":"}",i=0,u=!1,l=!1;for(let s=t;s<e.length;s++){let c=e[s];if(u){l?l=!1:c==="\\"?l=!0:c==='"'&&(u=!1);continue}if(c==='"')u=!0;else if(c===n)i+=1;else if(c===r&&(i-=1,i===0))try{return JSON.parse(e.slice(t,s+1))}catch{return}}}function w(e,o){let a;try{a=e.mutation(o.mutation)}catch{return o}let t={...o.args},n=!1;for(let r of f(a.input)){if(r.control!=="node")continue;let i=t[r.name];if(typeof i!="string"||i.length===0||e.graph.getNode(i))continue;let u=i.trim().toLowerCase(),l=[...e.graph.allNodes()].filter(s=>(r.kinds.includes("*")||r.kinds.includes(s.kind))&&d(e.schema.tryDefinition(s.kind),s).trim().toLowerCase()===u);l.length===1&&(t[r.name]=l[0].id,n=!0)}return n?{...o,args:t}:o}function x(e,o,a){let t=a===void 0?null:new Set(a),n=[];for(let r of o){if(typeof r.mutation!="string")continue;let i=!0;try{e.mutation(r.mutation)}catch{i=!1}i?t&&!t.has(r.mutation)&&n.push({proposal:r,why:"not-allowed"}):n.push({proposal:r,why:"unknown"})}return n}function v(e,o,a){let t=a===void 0?null:new Set(a);return o.filter(n=>{if(typeof n.mutation!="string"||t&&!t.has(n.mutation))return!1;try{e.mutation(n.mutation)}catch{return!1}return n.args!==null&&typeof n.args=="object"})}export{S as a,w as b,x as c,v as d};
1
+ import{a as f}from"./chunk.H3EGBDW2.js";import{la as d}from"./chunk.ZEZUKRC6.js";function S(e){let o=e.indexOf("{"),a=e.indexOf("["),t=a!==-1&&(o===-1||a<o)?a:o;if(t===-1)return;let n=e[t],r=n==="["?"]":"}",i=0,u=!1,l=!1;for(let s=t;s<e.length;s++){let c=e[s];if(u){l?l=!1:c==="\\"?l=!0:c==='"'&&(u=!1);continue}if(c==='"')u=!0;else if(c===n)i+=1;else if(c===r&&(i-=1,i===0))try{return JSON.parse(e.slice(t,s+1))}catch{return}}}function w(e,o){let a;try{a=e.mutation(o.mutation)}catch{return o}let t={...o.args},n=!1;for(let r of f(a.input)){if(r.control!=="node")continue;let i=t[r.name];if(typeof i!="string"||i.length===0||e.graph.getNode(i))continue;let u=i.trim().toLowerCase(),l=[...e.graph.allNodes()].filter(s=>(r.kinds.includes("*")||r.kinds.includes(s.kind))&&d(e.schema.tryDefinition(s.kind),s).trim().toLowerCase()===u);l.length===1&&(t[r.name]=l[0].id,n=!0)}return n?{...o,args:t}:o}function x(e,o,a){let t=a===void 0?null:new Set(a),n=[];for(let r of o){if(typeof r.mutation!="string")continue;let i=!0;try{e.mutation(r.mutation)}catch{i=!1}i?t&&!t.has(r.mutation)&&n.push({proposal:r,why:"not-allowed"}):n.push({proposal:r,why:"unknown"})}return n}function v(e,o,a){let t=a===void 0?null:new Set(a);return o.filter(n=>{if(typeof n.mutation!="string"||t&&!t.has(n.mutation))return!1;try{e.mutation(n.mutation)}catch{return!1}return n.args!==null&&typeof n.args=="object"})}export{S as a,w as b,x as c,v as d};